r8489 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r8488‎ | r8489 | r8490 >
Date:06:30, 21 April 2005
Author:avar
Status:old
Tags:
Comment:
* (bug 1931) cleanup, removing unused code and variables.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -165,14 +165,14 @@
166166 $this->mTitle =& $title;
167167 $this->mOutputType = OT_HTML;
168168
169 - $stripState = NULL;
 169+ $this->mStripState = NULL;
170170 global $fnord; $fnord = 1;
171171 //$text = $this->strip( $text, $this->mStripState );
172172 // VOODOO MAGIC FIX! Sometimes the above segfaults in PHP5.
173173 $x =& $this->mStripState;
174174 $text = $this->strip( $text, $x );
175175
176 - $text = $this->internalParse( $text, $linestart );
 176+ $text = $this->internalParse( $text );
177177
178178 $dashReplace = array(
179179 '/ - /' => " – ", # N dash
@@ -368,7 +368,7 @@
369369
370370 # Extensions
371371 foreach ( $this->mTagHooks as $tag => $callback ) {
372 - $ext_contents[$tag] = array();
 372+ $ext_content[$tag] = array();
373373 $text = Parser::extractTags( $tag, $text, $ext_content[$tag], $uniq_prefix );
374374 foreach( $ext_content[$tag] as $marker => $content ) {
375375 if ( $render ) {
@@ -518,6 +518,7 @@
519519 1 => array('pipe', 'w'),
520520 2 => array('file', '/dev/null', 'a')
521521 );
 522+ $pipes = array();
522523 $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
523524 if (is_resource($process)) {
524525 fwrite($pipes[0], $text);
@@ -526,7 +527,7 @@
527528 $cleansource .= fgets($pipes[1], 1024);
528529 }
529530 fclose($pipes[1]);
530 - $return_value = proc_close($process);
 531+ proc_close($process);
531532 }
532533
533534 wfProfileOut( $fname );
@@ -677,7 +678,6 @@
678679 }
679680
680681 $t = implode ( "\n" , $t ) ;
681 - # $t = Sanitizer::removeHTMLtags( $t );
682682 wfProfileOut( $fname );
683683 return $t ;
684684 }
@@ -688,9 +688,10 @@
689689 *
690690 * @access private
691691 */
692 - function internalParse( $text, $linestart, $args = array(), $isMain=true ) {
 692+ function internalParse( $text ) {
693693 global $wgContLang;
694 -
 694+ $args = array();
 695+ $isMain = true;
695696 $fname = 'Parser::internalParse';
696697 wfProfileIn( $fname );
697698
@@ -1119,8 +1120,7 @@
11201121 * @access private
11211122 */
11221123 function replaceInternalLinks( $s ) {
1123 - global $wgLang, $wgContLang, $wgLinkCache;
1124 - global $wgDisableLangConversion;
 1124+ global $wgContLang, $wgLinkCache;
11251125 static $fname = 'Parser::replaceInternalLinks' ;
11261126
11271127 wfProfileIn( $fname );
@@ -1136,8 +1136,6 @@
11371137 # in Parser. Enable it, then disable it when we're done.
11381138 $saveParseColour = $sk->postParseLinkColour( !$wgUseOldExistenceCheck );
11391139
1140 - $redirect = MagicWord::get ( MAG_REDIRECT ) ;
1141 -
11421140 #split the entire text string on occurences of [[
11431141 $a = explode( '[[', ' ' . $s );
11441142 #get the first element (all text up to first [[), and remove the space we added
@@ -1559,7 +1557,7 @@
15601558 #
15611559 $textLines = explode( "\n", $text );
15621560
1563 - $lastPrefix = $output = $lastLine = '';
 1561+ $lastPrefix = $output = '';
15641562 $this->mDTopen = $inBlockElem = false;
15651563 $prefixLength = 0;
15661564 $paragraphStack = false;
@@ -1598,6 +1596,7 @@
15991597 # ; title : definition text
16001598 # So we check for : in the remainder text to split up the
16011599 # title and definition, without b0rking links.
 1600+ $term = $t2 = '';
16021601 if ($this->findColonNoLinks($t, $term, $t2) !== false) {
16031602 $t = $t2;
16041603 $output .= $term . $this->nextItem( ':' );
@@ -1834,7 +1833,6 @@
18351834 * @access private
18361835 */
18371836 function replaceVariables( $text, $args = array() ) {
1838 - global $wgLang, $wgScript, $wgArticlePath;
18391837
18401838 # Prevent too big inclusions
18411839 if( strlen( $text ) > MAX_INCLUDE_SIZE ) {
@@ -2417,7 +2415,7 @@
24182416 '%' => '.'
24192417 );
24202418 $canonized_headline = str_replace(array_keys($replacearray),array_values($replacearray),$canonized_headline);
2421 - $refer[$headlineCount] = $canonized_headline;
 2419+ $refers[$headlineCount] = $canonized_headline;
24222420
24232421 # count how many in assoc. array so we can track dupes in anchors
24242422 @$refers[$canonized_headline]++;
@@ -2456,7 +2454,6 @@
24572455 }
24582456
24592457 if( $doShowToc ) {
2460 - $toclines = $headlineCount;
24612458 $toc .= $sk->tocUnindent( $toclevel - 1 );
24622459 $toc = $sk->tocList( $toc );
24632460 }
@@ -2499,7 +2496,6 @@
25002497 * @access private
25012498 */
25022499 function magicISBN( $text ) {
2503 - global $wgLang;
25042500 $fname = 'Parser::magicISBN';
25052501 wfProfileIn( $fname );
25062502
@@ -2553,7 +2549,6 @@
25542550 * @return string
25552551 */
25562552 function magicRFC( $text, $keyword='RFC ', $urlmsg='rfcurl' ) {
2557 - global $wgLang;
25582553
25592554 $valid = '0123456789';
25602555 $internal = false;
@@ -2637,7 +2632,7 @@
26382633 $stripState = false;
26392634 $pairs = array(
26402635 "\r\n" => "\n",
2641 - );
 2636+ );
26422637 $text = str_replace( array_keys( $pairs ), array_values( $pairs ), $text );
26432638 $text = $this->strip( $text, $stripState, false );
26442639 $text = $this->pstPass2( $text, $user );
@@ -2651,7 +2646,7 @@
26522647 * @access private
26532648 */
26542649 function pstPass2( $text, &$user ) {
2655 - global $wgLang, $wgContLang, $wgLocaltimezone;
 2650+ global $wgContLang, $wgLocaltimezone;
26562651
26572652 # Variable replacement
26582653 # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
@@ -2675,7 +2670,7 @@
26762671 $d = $wgContLang->timeanddate( wfTimestampNow(), false, false) .
26772672 ' (' . date( 'T' ) . ')';
26782673 if ( isset( $wgLocaltimezone ) ) {
2679 - putenv( 'TZ='.$oldtzs );
 2674+ putenv( 'TZ='.$oldtz );
26802675 }
26812676
26822677 if( $user->getOption( 'fancysig' ) ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r8490* (bug 1931) cleanup, removing unused code and variables.avar06:32, 21 April 2005

Status & tagging log