r82936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82935‎ | r82936 | r82937 >
Date:15:51, 28 February 2011
Author:yaron
Status:deferred
Tags:
Comment:
Further improvements to $wgParser call, with help from Tim Starling; plus some random comment improvements
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -367,10 +367,15 @@
368368 }
369369 // Otherwise, parse it.
370370 if ( ! $got_form_def_from_cache ) {
371 - $form_def = $wgParser->parse( $form_def, $this->mPageTitle, $wgParser->mOptions )->getText();
 371+ if ( $embedded) {
 372+ $form_def = $wgParser->recursiveTagParse( $form_def );
 373+ $form_def = $wgParser->mStripState->unstripBoth( $form_def );
 374+ } else {
 375+ $form_def = $wgParser->parse( $form_def, $this->mPageTitle, $wgParser->mOptions )->getText();
 376+ }
372377 }
373378
374 - // turn form definition file into an array of sections, one for each
 379+ // Turn form definition file into an array of sections, one for each
375380 // template definition (plus the first section)
376381 $form_def_sections = array();
377382 $start_position = 0;
@@ -393,7 +398,7 @@
394399 $tag_components = SFUtils::getFormTagComponents( $bracketed_string );
395400 $tag_title = trim( $tag_components[0] );
396401 if ( $tag_title == 'for template' || $tag_title == 'end template' ) {
397 - // create a section for everything up to here
 402+ // Create a section for everything up to here
398403 $section = substr( $form_def, $section_start, $brackets_loc - $section_start );
399404 $form_def_sections[] = $section;
400405 $section_start = $brackets_loc;
@@ -402,9 +407,9 @@
403408 } // end while
404409 $form_def_sections[] = trim( substr( $form_def, $section_start ) );
405410
406 - // cycle through form definition file (and possibly an existing article
 411+ // Cycle through form definition file (and possibly an existing article
407412 // as well), finding template and field declarations and replacing them
408 - // with form elements, either blank or pre-populated, as appropriate
 413+ // with form elements, either blank or pre-populated, as appropriate.
409414 $all_fields = array();
410415 $data_text = "";
411416 $template_name = "";

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82928Simplified form-parsing code, to work with latest MW 1.18; hopefully this sti...yaron03:39, 28 February 2011