Index: trunk/phase3/includes/Parser.php |
— | — | @@ -165,14 +165,14 @@ |
166 | 166 | $this->mTitle =& $title; |
167 | 167 | $this->mOutputType = OT_HTML; |
168 | 168 | |
169 | | - $stripState = NULL; |
| 169 | + $this->mStripState = NULL; |
170 | 170 | global $fnord; $fnord = 1; |
171 | 171 | //$text = $this->strip( $text, $this->mStripState ); |
172 | 172 | // VOODOO MAGIC FIX! Sometimes the above segfaults in PHP5. |
173 | 173 | $x =& $this->mStripState; |
174 | 174 | $text = $this->strip( $text, $x ); |
175 | 175 | |
176 | | - $text = $this->internalParse( $text, $linestart ); |
| 176 | + $text = $this->internalParse( $text ); |
177 | 177 | |
178 | 178 | $dashReplace = array( |
179 | 179 | '/ - /' => " – ", # N dash |
— | — | @@ -368,7 +368,7 @@ |
369 | 369 | |
370 | 370 | # Extensions |
371 | 371 | foreach ( $this->mTagHooks as $tag => $callback ) { |
372 | | - $ext_contents[$tag] = array(); |
| 372 | + $ext_content[$tag] = array(); |
373 | 373 | $text = Parser::extractTags( $tag, $text, $ext_content[$tag], $uniq_prefix ); |
374 | 374 | foreach( $ext_content[$tag] as $marker => $content ) { |
375 | 375 | if ( $render ) { |
— | — | @@ -518,6 +518,7 @@ |
519 | 519 | 1 => array('pipe', 'w'), |
520 | 520 | 2 => array('file', '/dev/null', 'a') |
521 | 521 | ); |
| 522 | + $pipes = array(); |
522 | 523 | $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes); |
523 | 524 | if (is_resource($process)) { |
524 | 525 | fwrite($pipes[0], $text); |
— | — | @@ -526,7 +527,7 @@ |
527 | 528 | $cleansource .= fgets($pipes[1], 1024); |
528 | 529 | } |
529 | 530 | fclose($pipes[1]); |
530 | | - $return_value = proc_close($process); |
| 531 | + proc_close($process); |
531 | 532 | } |
532 | 533 | |
533 | 534 | wfProfileOut( $fname ); |
— | — | @@ -677,7 +678,6 @@ |
678 | 679 | } |
679 | 680 | |
680 | 681 | $t = implode ( "\n" , $t ) ; |
681 | | - # $t = Sanitizer::removeHTMLtags( $t ); |
682 | 682 | wfProfileOut( $fname ); |
683 | 683 | return $t ; |
684 | 684 | } |
— | — | @@ -688,9 +688,10 @@ |
689 | 689 | * |
690 | 690 | * @access private |
691 | 691 | */ |
692 | | - function internalParse( $text, $linestart, $args = array(), $isMain=true ) { |
| 692 | + function internalParse( $text ) { |
693 | 693 | global $wgContLang; |
694 | | - |
| 694 | + $args = array(); |
| 695 | + $isMain = true; |
695 | 696 | $fname = 'Parser::internalParse'; |
696 | 697 | wfProfileIn( $fname ); |
697 | 698 | |
— | — | @@ -1119,8 +1120,7 @@ |
1120 | 1121 | * @access private |
1121 | 1122 | */ |
1122 | 1123 | function replaceInternalLinks( $s ) { |
1123 | | - global $wgLang, $wgContLang, $wgLinkCache; |
1124 | | - global $wgDisableLangConversion; |
| 1124 | + global $wgContLang, $wgLinkCache; |
1125 | 1125 | static $fname = 'Parser::replaceInternalLinks' ; |
1126 | 1126 | |
1127 | 1127 | wfProfileIn( $fname ); |
— | — | @@ -1136,8 +1136,6 @@ |
1137 | 1137 | # in Parser. Enable it, then disable it when we're done. |
1138 | 1138 | $saveParseColour = $sk->postParseLinkColour( !$wgUseOldExistenceCheck ); |
1139 | 1139 | |
1140 | | - $redirect = MagicWord::get ( MAG_REDIRECT ) ; |
1141 | | - |
1142 | 1140 | #split the entire text string on occurences of [[ |
1143 | 1141 | $a = explode( '[[', ' ' . $s ); |
1144 | 1142 | #get the first element (all text up to first [[), and remove the space we added |
— | — | @@ -1559,7 +1557,7 @@ |
1560 | 1558 | # |
1561 | 1559 | $textLines = explode( "\n", $text ); |
1562 | 1560 | |
1563 | | - $lastPrefix = $output = $lastLine = ''; |
| 1561 | + $lastPrefix = $output = ''; |
1564 | 1562 | $this->mDTopen = $inBlockElem = false; |
1565 | 1563 | $prefixLength = 0; |
1566 | 1564 | $paragraphStack = false; |
— | — | @@ -1598,6 +1596,7 @@ |
1599 | 1597 | # ; title : definition text |
1600 | 1598 | # So we check for : in the remainder text to split up the |
1601 | 1599 | # title and definition, without b0rking links. |
| 1600 | + $term = $t2 = ''; |
1602 | 1601 | if ($this->findColonNoLinks($t, $term, $t2) !== false) { |
1603 | 1602 | $t = $t2; |
1604 | 1603 | $output .= $term . $this->nextItem( ':' ); |
— | — | @@ -1834,7 +1833,6 @@ |
1835 | 1834 | * @access private |
1836 | 1835 | */ |
1837 | 1836 | function replaceVariables( $text, $args = array() ) { |
1838 | | - global $wgLang, $wgScript, $wgArticlePath; |
1839 | 1837 | |
1840 | 1838 | # Prevent too big inclusions |
1841 | 1839 | if( strlen( $text ) > MAX_INCLUDE_SIZE ) { |
— | — | @@ -2417,7 +2415,7 @@ |
2418 | 2416 | '%' => '.' |
2419 | 2417 | ); |
2420 | 2418 | $canonized_headline = str_replace(array_keys($replacearray),array_values($replacearray),$canonized_headline); |
2421 | | - $refer[$headlineCount] = $canonized_headline; |
| 2419 | + $refers[$headlineCount] = $canonized_headline; |
2422 | 2420 | |
2423 | 2421 | # count how many in assoc. array so we can track dupes in anchors |
2424 | 2422 | @$refers[$canonized_headline]++; |
— | — | @@ -2456,7 +2454,6 @@ |
2457 | 2455 | } |
2458 | 2456 | |
2459 | 2457 | if( $doShowToc ) { |
2460 | | - $toclines = $headlineCount; |
2461 | 2458 | $toc .= $sk->tocUnindent( $toclevel - 1 ); |
2462 | 2459 | $toc = $sk->tocList( $toc ); |
2463 | 2460 | } |
— | — | @@ -2499,7 +2496,6 @@ |
2500 | 2497 | * @access private |
2501 | 2498 | */ |
2502 | 2499 | function magicISBN( $text ) { |
2503 | | - global $wgLang; |
2504 | 2500 | $fname = 'Parser::magicISBN'; |
2505 | 2501 | wfProfileIn( $fname ); |
2506 | 2502 | |
— | — | @@ -2553,7 +2549,6 @@ |
2554 | 2550 | * @return string |
2555 | 2551 | */ |
2556 | 2552 | function magicRFC( $text, $keyword='RFC ', $urlmsg='rfcurl' ) { |
2557 | | - global $wgLang; |
2558 | 2553 | |
2559 | 2554 | $valid = '0123456789'; |
2560 | 2555 | $internal = false; |
— | — | @@ -2637,7 +2632,7 @@ |
2638 | 2633 | $stripState = false; |
2639 | 2634 | $pairs = array( |
2640 | 2635 | "\r\n" => "\n", |
2641 | | - ); |
| 2636 | + ); |
2642 | 2637 | $text = str_replace( array_keys( $pairs ), array_values( $pairs ), $text ); |
2643 | 2638 | $text = $this->strip( $text, $stripState, false ); |
2644 | 2639 | $text = $this->pstPass2( $text, $user ); |
— | — | @@ -2651,7 +2646,7 @@ |
2652 | 2647 | * @access private |
2653 | 2648 | */ |
2654 | 2649 | function pstPass2( $text, &$user ) { |
2655 | | - global $wgLang, $wgContLang, $wgLocaltimezone; |
| 2650 | + global $wgContLang, $wgLocaltimezone; |
2656 | 2651 | |
2657 | 2652 | # Variable replacement |
2658 | 2653 | # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags |
— | — | @@ -2675,7 +2670,7 @@ |
2676 | 2671 | $d = $wgContLang->timeanddate( wfTimestampNow(), false, false) . |
2677 | 2672 | ' (' . date( 'T' ) . ')'; |
2678 | 2673 | if ( isset( $wgLocaltimezone ) ) { |
2679 | | - putenv( 'TZ='.$oldtzs ); |
| 2674 | + putenv( 'TZ='.$oldtz ); |
2680 | 2675 | } |
2681 | 2676 | |
2682 | 2677 | if( $user->getOption( 'fancysig' ) ) { |