r79160 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79159‎ | r79160 | r79161 >
Date:03:56, 29 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Inserted calls to new getFormTagComponents() where appropriate; improved some comments
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -130,7 +130,7 @@
131131 * unfortunately, str_replace() doesn't allow for that.
132132 * This code is basically copied directly from
133133 * http://www.php.net/manual/en/function.str-replace.php#86177
134 - * - this might make sense in some SF utils class, if it's useful in
 134+ * - this might make sense in the SFUtils class, if it's useful in
135135 * other places.
136136 */
137137 function strReplaceFirst( $search, $replace, $subject) {
@@ -255,8 +255,8 @@
256256 $wgParser->mOptions = new ParserOptions();
257257 $wgParser->mOptions->initialiseFromUser( $wgUser );
258258
259 - // get the form definition from the cache, if we're using caching and it's
260 - // there
 259+ // Get the form definition from the cache, if we're using caching and it's
 260+ // there.
261261 $got_form_def_from_cache = false;
262262 global $sfgCacheFormDefinitions;
263263 if ( $sfgCacheFormDefinitions && ! is_null( $form_id ) ) {
@@ -267,7 +267,7 @@
268268 $got_form_def_from_cache = true;
269269 }
270270 }
271 - // otherwise, parse it
 271+ // Otherwise, parse it.
272272 if ( ! $got_form_def_from_cache ) {
273273 $form_def = $wgParser->parse( $form_def, $this->mPageTitle, $wgParser->mOptions )->getText();
274274 }
@@ -293,7 +293,7 @@
294294 while ( $brackets_loc = strpos( $form_def, "{{{", $start_position ) ) {
295295 $brackets_end_loc = strpos( $form_def, "}}}", $brackets_loc );
296296 $bracketed_string = substr( $form_def, $brackets_loc + 3, $brackets_end_loc - ( $brackets_loc + 3 ) );
297 - $tag_components = explode( '|', $bracketed_string );
 297+ $tag_components = SFUtils::getFormTagComponents( $bracketed_string );
298298 $tag_title = trim( $tag_components[0] );
299299 if ( $tag_title == 'for template' || $tag_title == 'end template' ) {
300300 // create a section for everything up to here
@@ -326,7 +326,7 @@
327327 while ( $brackets_loc = strpos( $section, '{{{', $start_position ) ) {
328328 $brackets_end_loc = strpos( $section, "}}}", $brackets_loc );
329329 $bracketed_string = substr( $section, $brackets_loc + 3, $brackets_end_loc - ( $brackets_loc + 3 ) );
330 - $tag_components = explode( '|', $bracketed_string );
 330+ $tag_components = SFUtils::getFormTagComponents( $bracketed_string );
331331 $tag_title = trim( $tag_components[0] );
332332 // =====================================================
333333 // for template processing

Status & tagging log