r99086 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99085‎ | r99086 | r99087 >
Date:11:28, 6 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Fixed (I hope) handling of templates whose name contains an apostrophe; improved formatting of some comments
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -514,6 +514,8 @@
515515 // Also replace periods with underlines, since that's what
516516 // POST does to strings anyway.
517517 $query_template_name = str_replace( '.', '_', $query_template_name );
 518+ // ...and escape apostrophes.
 519+ $query_template_name = str_replace( "'", "\'", $query_template_name );
518520 // Cycle through the other components.
519521 for ( $i = 2; $i < count( $tag_components ); $i++ ) {
520522 $component = $tag_components[$i];
@@ -1372,17 +1374,15 @@
13731375 $template_text .= SFFormUtils::addUnhandledFields( $template_name );
13741376 }
13751377 $template_text .= "}}";
1376 -
1377 -
1378 -
1379 - /*used on submission on the template form level
1380 - 1. the base $template_text will contain strings like "@replace_xxx@" in the hidden fields when the form will be submitted
1381 - on the following loops, the text for the multiple form templates is progressively reinserted in the main data, always keeping a trailing @replace_xxx@ for a given field
1382 - the trailing @replace_xxx@ will be deleted at the end with the data from
1383 -
1384 - note: this clean up step could also be done with a regexp instead of keeping a track array /@replace_(.*)@/
1385 - */
1386 -
 1378+
 1379+ // The base $template_text will contain strings like "@replace_xxx@"
 1380+ // in the hidden fields when the form is submitted.
 1381+ // On the following loops, the text for the multiple-instance templates
 1382+ // is progressively reinserted in the main data, always keeping a
 1383+ // trailing @replace_xxx@ for a given field
 1384+ // The trailing @replace_xxx@ is then deleted at the end.
 1385+ // Note: this cleanup step could also be done with a regexp, instead of
 1386+ // keeping a track array (e.g., /@replace_(.*)@/)
13871387 $reptmp = self::makePlaceholderInWikiText( $curPlaceholder );
13881388 if ( $curPlaceholder != null && $data_text && strpos( $data_text, $reptmp, 0 ) !== false) {
13891389 $data_text = preg_replace( '/' . $reptmp . '/', $template_text . $reptmp, $data_text );