r80990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80989‎ | r80990 | r80991 >
Date:21:03, 25 January 2011
Author:foxtrott
Status:resolved (Comments)
Tags:
Comment:
bugfixes

* jQuery was only loaded after it was for certain skins (e.g. GuMaxDD)
* HeadItems required by parser functions were not included in RunQuery special page
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_RunQuery.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_RunQuery.php
@@ -130,7 +130,7 @@
131131 if ( $embedded ) {
132132 $wgParser->getOutput()->addHeadItem( $script );
133133 } else {
134 - $wgOut->addScript( $script );
 134+ $wgOut->addScript( $script . implode($wgParser->getOutput()->getHeadItems()) );
135135 }
136136 }
137137 }
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php
@@ -116,6 +116,11 @@
117117 $parser->setFunctionHook( 'arraymap', array( 'SFParserFunctions', 'renderArrayMap' ) );
118118 $parser->setFunctionHook( 'arraymaptemplate', array( 'SFParserFunctions', 'renderArrayMapTemplate' ) );
119119 }
 120+
 121+ // load jQuery
 122+ global $wgOut;
 123+ $wgOut->includeJQuery(); // only necessary in MW 1.16, does nothing in MW 1.17+
 124+
120125 return true;
121126 }
122127
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -1145,15 +1145,15 @@
11461146 // doing a replace
11471147 if ( $existing_page_content && strpos( $existing_page_content, '{{{insertionpoint}}}', 0 ) !== false ) {
11481148 $existing_page_content = preg_replace( '/\{\{\{insertionpoint\}\}\}(\r?\n?)/',
1149 - preg_replace( '/\}\}/m', '}�',
1150 - preg_replace( '/\{\{/m', '�{', $template_text ) ) .
 1149+ preg_replace( '/\}\}/m', '}�',
 1150+ preg_replace( '/\{\{/m', '�{', $template_text ) ) .
11511151 "\n{{{insertionpoint}}}",
11521152 $existing_page_content );
11531153 // otherwise, if it's a partial form, we have to add the new
11541154 // text somewhere
11551155 } elseif ( $form_is_partial && $wgRequest->getCheck( 'partial' ) ) {
1156 - $existing_page_content = preg_replace( '/\}\}/m', '}�',
1157 - preg_replace( '/\{\{/m', '�{', $template_text ) ) .
 1156+ $existing_page_content = preg_replace( '/\}\}/m', '}�',
 1157+ preg_replace( '/\{\{/m', '�{', $template_text ) ) .
11581158 "\n{{{insertionpoint}}}\n" . $existing_page_content;
11591159 }
11601160 }
@@ -1218,7 +1218,7 @@
12191219 $form_text .= SFFormUtils::hiddenFieldHTML( 'partial', 1 );
12201220 } else {
12211221 $free_text = null;
1222 - $existing_page_content = preg_replace( array( '/�\{/m','/\}�/m' ),
 1222+ $existing_page_content = preg_replace( array( '/�\{/m','/\}�/m' ),
12231223 array( '{{','}}' ),
12241224 $existing_page_content );
12251225 $existing_page_content = preg_replace( '/\{\{\{insertionpoint\}\}\}/', '', $existing_page_content );
@@ -1310,7 +1310,7 @@
13111311 global $wgParser;
13121312 $new_text = "";
13131313 if ( !$embedded ) {
1314 - $new_text = $wgParser->preprocess( str_replace( "{{!}}", "|", $form_page_title ), $this->mPageTitle, new ParserOptions() );
 1314+ $new_text = $wgParser->recursiveTagParse (str_replace( "{{!}}", "|", $form_page_title ) );
13151315 }
13161316
13171317 // If the form has already been submitted, i.e. this is just the redirect

Follow-up revisions

RevisionCommit summaryAuthorDate
r80994followup r80990: include modules registered with ResourceLoader, toofoxtrott21:29, 25 January 2011

Comments

#Comment by Nikerabbit (talk | contribs)   22:24, 25 January 2011

The encoding in SF_FormPrinter.php is borked. Was introduced in r29908.

#Comment by Jeroen De Dauw (talk | contribs)   15:28, 31 January 2011

Broke compatibility with 1.15.x. Fixed in r81251.

This is including jQuery for every page; not a good approach...

Status & tagging log