r87565 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87564‎ | r87565 | r87566 >
Date:19:55, 6 May 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
revert switch from recursiveTagParse to parse
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -347,11 +347,9 @@
348348 // element, so that the wiki parser won't touch it - the parser will
349349 // remove the '<nowiki>' tags, leaving us with what we need.
350350 $form_def = "__NOEDITSECTION__" . strtr( $form_def, array( '{{{' => '<nowiki>{{{', '}}}' => '}}}</nowiki>' ) );
351 - if ( empty( $wgParser->mOptions ) ) {
352 - if ( !StubObject::isRealObject($wgParser) ) $wgParser -> _unstub();
353 - $wgParser->startExternalParse( $this->mPageTitle, ParserOptions::newFromUser($wgUser), Parser::OT_HTML, true );
354 - }
355351
 352+ $parser = new Parser();
 353+
356354 // Get the form definition from the cache, if we're using caching and it's
357355 // there.
358356 // $got_form_def_from_cache = false;
@@ -366,15 +364,9 @@
367365 // }
368366 // Otherwise, parse it.
369367 // if ( ! $got_form_def_from_cache ) {
370 - $form_def = $wgParser->recursiveTagParse( $form_def );
371 - $form_def = $wgParser->mStripState->unstripBoth( $form_def );
372 - $form_def = $wgParser->doBlockLevels( $form_def, true );
373 - wfRunHooks( 'ParserAfterTidy', array( &$wgParser, &$form_def ) );
374 -// } else {
375 -// $form_def = $wgParser->parse( $form_def, $this->mPageTitle, $wgParser->mOptions )->getText();
376 -// }
 368+ $form_def = $parser->parse($form_def, $this->mPageTitle, ParserOptions::newFromUser($wgUser))->getText();
377369 // }
378 -
 370+
379371 // Turn form definition file into an array of sections, one for each
380372 // template definition (plus the first section)
381373 $form_def_sections = array();
@@ -683,7 +675,7 @@
684676 if ( $sub_components[0] == 'input type' ) {
685677 $input_type = $sub_components[1];
686678 } elseif ( $sub_components[0] == 'default' ) {
687 - $default_value = $wgParser->recursiveTagParse( $sub_components[1] );
 679+ $default_value = $parser->recursiveTagParse( $sub_components[1] );
688680 } elseif ( $sub_components[0] == 'preload' ) {
689681 // free text field has special handling
690682 if ( $field_name == 'free text' || $field_name == '<freetext>' ) {
@@ -1415,8 +1407,7 @@
14161408 $data_text = $existing_page_content;
14171409
14181410 if ( !$embedded ) {
1419 - global $wgParser;
1420 - $form_page_title = $wgParser->recursiveTagParse( str_replace( "{{!}}", "|", $form_page_title ) );
 1411+ $form_page_title = $parser->recursiveTagParse( str_replace( "{{!}}", "|", $form_page_title ) );
14211412 } else {
14221413 $form_page_title = null;
14231414 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r88737followup r87565: FormEdit does not rely on initialized wgParser anymorefoxtrott18:56, 24 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86082bugfix: parser needs to be unstubbed before startExternalParsefoxtrott20:48, 14 April 2011