r70128 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70127‎ | r70128 | r70129 >
Date:07:20, 29 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Replace self with PPFrame to define proper location of some constants
Modified paths:
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_Hash.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Preprocessor_Hash.php
@@ -942,7 +942,7 @@
943943 if ( $contextNode->name == 'template' ) {
944944 # Double-brace expansion
945945 $bits = $contextNode->splitTemplate();
946 - if ( $flags & self::NO_TEMPLATES ) {
 946+ if ( $flags & PPFrame::NO_TEMPLATES ) {
947947 $newIterator = $this->virtualBracketedImplode( '{{', '|', '}}', $bits['title'], $bits['parts'] );
948948 } else {
949949 $ret = $this->parser->braceSubstitution( $bits, $this );
@@ -955,7 +955,7 @@
956956 } elseif ( $contextNode->name == 'tplarg' ) {
957957 # Triple-brace expansion
958958 $bits = $contextNode->splitTemplate();
959 - if ( $flags & self::NO_ARGS ) {
 959+ if ( $flags & PPFrame::NO_ARGS ) {
960960 $newIterator = $this->virtualBracketedImplode( '{{{', '|', '}}}', $bits['title'], $bits['parts'] );
961961 } else {
962962 $ret = $this->parser->argSubstitution( $bits, $this );
@@ -970,13 +970,13 @@
971971 # Remove it in HTML, pre+remove and STRIP_COMMENTS modes
972972 if ( $this->parser->ot['html']
973973 || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() )
974 - || ( $flags & self::STRIP_COMMENTS ) )
 974+ || ( $flags & PPFrame::STRIP_COMMENTS ) )
975975 {
976976 $out .= '';
977977 }
978978 # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
979979 # Not in RECOVER_COMMENTS mode (extractSections) though
980 - elseif ( $this->parser->ot['wiki'] && ! ( $flags & self::RECOVER_COMMENTS ) ) {
 980+ elseif ( $this->parser->ot['wiki'] && ! ( $flags & PPFrame::RECOVER_COMMENTS ) ) {
981981 $out .= $this->parser->insertStripItem( $contextNode->firstChild->value );
982982 }
983983 # Recover the literal comment in RECOVER_COMMENTS and pre+no-remove
@@ -988,7 +988,7 @@
989989 # OT_WIKI will only respect <ignore> in substed templates.
990990 # The other output types respect it unless NO_IGNORE is set.
991991 # extractSections() sets NO_IGNORE and so never respects it.
992 - if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & self::NO_IGNORE ) ) {
 992+ if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & PPFrame::NO_IGNORE ) ) {
993993 $out .= $contextNode->firstChild->value;
994994 } else {
995995 //$out .= '';
@@ -1285,7 +1285,7 @@
12861286 }
12871287 if ( !isset( $this->numberedExpansionCache[$index] ) ) {
12881288 # No trimming for unnamed arguments
1289 - $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], self::STRIP_COMMENTS );
 1289+ $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], PPFrame::STRIP_COMMENTS );
12901290 }
12911291 return $this->numberedExpansionCache[$index];
12921292 }
@@ -1297,7 +1297,7 @@
12981298 if ( !isset( $this->namedExpansionCache[$name] ) ) {
12991299 # Trim named arguments post-expand, for backwards compatibility
13001300 $this->namedExpansionCache[$name] = trim(
1301 - $this->parent->expand( $this->namedArgs[$name], self::STRIP_COMMENTS ) );
 1301+ $this->parent->expand( $this->namedArgs[$name], PPFrame::STRIP_COMMENTS ) );
13021302 }
13031303 return $this->namedExpansionCache[$name];
13041304 }
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -975,7 +975,7 @@
976976 $titles = $xpath->query( 'title', $contextNode );
977977 $title = $titles->item( 0 );
978978 $parts = $xpath->query( 'part', $contextNode );
979 - if ( $flags & self::NO_TEMPLATES ) {
 979+ if ( $flags & PPFrame::NO_TEMPLATES ) {
980980 $newIterator = $this->virtualBracketedImplode( '{{', '|', '}}', $title, $parts );
981981 } else {
982982 $lineStart = $contextNode->getAttribute( 'lineStart' );
@@ -996,7 +996,7 @@
997997 $titles = $xpath->query( 'title', $contextNode );
998998 $title = $titles->item( 0 );
999999 $parts = $xpath->query( 'part', $contextNode );
1000 - if ( $flags & self::NO_ARGS ) {
 1000+ if ( $flags & PPFrame::NO_ARGS ) {
10011001 $newIterator = $this->virtualBracketedImplode( '{{{', '|', '}}}', $title, $parts );
10021002 } else {
10031003 $params = array(
@@ -1014,13 +1014,13 @@
10151015 # Remove it in HTML, pre+remove and STRIP_COMMENTS modes
10161016 if ( $this->parser->ot['html']
10171017 || ( $this->parser->ot['pre'] && $this->parser->mOptions->getRemoveComments() )
1018 - || ( $flags & self::STRIP_COMMENTS ) )
 1018+ || ( $flags & PPFrame::STRIP_COMMENTS ) )
10191019 {
10201020 $out .= '';
10211021 }
10221022 # Add a strip marker in PST mode so that pstPass2() can run some old-fashioned regexes on the result
10231023 # Not in RECOVER_COMMENTS mode (extractSections) though
1024 - elseif ( $this->parser->ot['wiki'] && ! ( $flags & self::RECOVER_COMMENTS ) ) {
 1024+ elseif ( $this->parser->ot['wiki'] && ! ( $flags & PPFrame::RECOVER_COMMENTS ) ) {
10251025 $out .= $this->parser->insertStripItem( $contextNode->textContent );
10261026 }
10271027 # Recover the literal comment in RECOVER_COMMENTS and pre+no-remove
@@ -1032,7 +1032,7 @@
10331033 # OT_WIKI will only respect <ignore> in substed templates.
10341034 # The other output types respect it unless NO_IGNORE is set.
10351035 # extractSections() sets NO_IGNORE and so never respects it.
1036 - if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & self::NO_IGNORE ) ) {
 1036+ if ( ( !isset( $this->parent ) && $this->parser->ot['wiki'] ) || ( $flags & PPFrame::NO_IGNORE ) ) {
10371037 $out .= $contextNode->textContent;
10381038 } else {
10391039 $out .= '';
@@ -1335,7 +1335,7 @@
13361336 }
13371337 if ( !isset( $this->numberedExpansionCache[$index] ) ) {
13381338 # No trimming for unnamed arguments
1339 - $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], self::STRIP_COMMENTS );
 1339+ $this->numberedExpansionCache[$index] = $this->parent->expand( $this->numberedArgs[$index], PPFrame::STRIP_COMMENTS );
13401340 }
13411341 return $this->numberedExpansionCache[$index];
13421342 }
@@ -1347,7 +1347,7 @@
13481348 if ( !isset( $this->namedExpansionCache[$name] ) ) {
13491349 # Trim named arguments post-expand, for backwards compatibility
13501350 $this->namedExpansionCache[$name] = trim(
1351 - $this->parent->expand( $this->namedArgs[$name], self::STRIP_COMMENTS ) );
 1351+ $this->parent->expand( $this->namedArgs[$name], PPFrame::STRIP_COMMENTS ) );
13521352 }
13531353 return $this->namedExpansionCache[$name];
13541354 }

Status & tagging log