fix some spacing
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 876e3b7..6270a87 100644 (file)
@@ -62,7 +62,6 @@
  * $wgAllowSpecialInclusion
  * $wgInterwikiMagic
  * $wgMaxArticleSize
- * $wgUseDynamicDates
  *
  * @ingroup Parser
  */
@@ -123,8 +122,8 @@ class Parser {
        var $mFunctionHooks = array();
        var $mFunctionSynonyms = array( 0 => array(), 1 => array() );
        var $mFunctionTagHooks = array();
-       var $mStripList  = array();
-       var $mDefaultStripList  = array();
+       var $mStripList = array();
+       var $mDefaultStripList = array();
        var $mVarCache = array();
        var $mImageParams = array();
        var $mImageParamsMagicArray = array();
@@ -306,12 +305,11 @@ class Parser {
                 * string constructs.
                 *
                 * Must not consist of all title characters, or else it will change
-                * the behaviour of <nowiki> in a link.
+                * the behavior of <nowiki> in a link.
                 */
                $this->mUniqPrefix = "\x7fUNIQ" . self::getRandomString();
                $this->mStripState = new StripState( $this->mUniqPrefix );
 
-
                # Clear these on every parse, bug 4549
                $this->mTplExpandCache = $this->mTplRedirCache = $this->mTplDomCache = array();
 
@@ -844,16 +842,16 @@ class Parser {
                        }
                        if ( count( $p ) > 5 ) {
                                # comment
-                               $element    = $p[4];
+                               $element = $p[4];
                                $attributes = '';
-                               $close      = '';
-                               $inside     = $p[5];
+                               $close = '';
+                               $inside = $p[5];
                        } else {
                                # tag
-                               $element    = $p[1];
+                               $element = $p[1];
                                $attributes = $p[2];
-                               $close      = $p[3];
-                               $inside     = $p[4];
+                               $close = $p[3];
+                               $inside = $p[4];
                        }
 
                        $marker = "$uniq_prefix-$element-" . sprintf( '%08X', $n++ ) . self::MARKER_SUFFIX;
@@ -1006,7 +1004,7 @@ class Parser {
                                array_push( $tr_history, false );
                                array_push( $td_history, false );
                                array_push( $last_tag_history, '' );
-                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line, 0, 2 )  === '|+' ) {
+                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line, 0, 2 ) === '|+' ) {
                                # This might be cell elements, td, th or captions
                                if ( substr( $line, 0, 2 ) === '|+' ) {
                                        $first_character = '+';
@@ -1090,7 +1088,7 @@ class Parser {
                                $out .= "</tr>\n";
                        }
                        if ( !array_pop( $has_opened_tr ) ) {
-                               $out .= "<tr><td></td></tr>\n" ;
+                               $out .= "<tr><td></td></tr>\n";
                        }
 
                        $out .= "</table>\n";
@@ -1131,7 +1129,7 @@ class Parser {
                # Hook to suspend the parser in this state
                if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) {
                        wfProfileOut( __METHOD__ );
-                       return $text ;
+                       return $text;
                }
 
                # if $frame is provided, then use $frame for replacing any variables
@@ -1165,10 +1163,6 @@ class Parser {
                $text = $this->doDoubleUnderscore( $text );
 
                $text = $this->doHeadings( $text );
-               if ( $this->mOptions->getUseDynamicDates() ) {
-                       $df = DateFormatter::getInstance();
-                       $text = $df->reformat( $this->mOptions->getDateFormat(), $text );
-               }
                $text = $this->replaceInternalLinks( $text );
                $text = $this->doAllQuotes( $text );
                $text = $this->replaceExternalLinks( $text );
@@ -1319,7 +1313,6 @@ class Parser {
                return $text . $trail;
        }
 
-
        /**
         * Parse headers and return html
         *
@@ -1419,7 +1412,7 @@ class Parser {
                                                        if ( $firstspace == -1 ) {
                                                                $firstspace = $i;
                                                        }
-                                               } elseif ( $x2 === ' ') {
+                                               } elseif ( $x2 === ' ' ) {
                                                        if ( $firstsingleletterword == -1 ) {
                                                                $firstsingleletterword = $i;
                                                        }
@@ -1760,7 +1753,7 @@ class Parser {
                wfProfileIn( __METHOD__ );
 
                wfProfileIn( __METHOD__ . '-setup' );
-               static $tc = FALSE, $e1, $e1_img;
+               static $tc = false, $e1, $e1_img;
                # the % is needed to support urlencoded titles as well
                if ( !$tc ) {
                        $tc = Title::legalChars() . '#%';
@@ -1810,7 +1803,7 @@ class Parser {
                wfProfileOut( __METHOD__ . '-setup' );
 
                # Loop for each link
-               for ( ; $line !== false && $line !== null ; $a->next(), $line = $a->current() ) {
+               for ( ; $line !== false && $line !== null; $a->next(), $line = $a->current() ) {
                        # Check for excessive memory usage
                        if ( $holders->isBig() ) {
                                # Too big
@@ -1870,7 +1863,7 @@ class Parser {
                                }
                                $trail = "";
                        } else { # Invalid form; output directly
-                               $s .= $prefix . '[[' . $line ;
+                               $s .= $prefix . '[[' . $line;
                                wfProfileOut( __METHOD__ . "-e1" );
                                continue;
                        }
@@ -1881,7 +1874,7 @@ class Parser {
                        # PROTO: where PROTO is a valid URL protocol; these
                        # should be external links.
                        if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $m[1] ) ) {
-                               $s .= $prefix . '[[' . $line ;
+                               $s .= $prefix . '[[' . $line;
                                wfProfileOut( __METHOD__ . "-misc" );
                                continue;
                        }
@@ -1957,7 +1950,7 @@ class Parser {
                                wfProfileOut( __METHOD__ . "-might_be_img" );
                        }
 
-                       $wasblank = ( $text  == '' );
+                       $wasblank = ( $text == '' );
                        if ( $wasblank ) {
                                $text = $link;
                        } else {
@@ -2337,7 +2330,7 @@ class Parser {
                                $output .= $this->nextItem( substr( $prefix, -1 ) );
                                $paragraphStack = false;
 
-                               if ( substr( $prefix, -1 ) === ';') {
+                               if ( substr( $prefix, -1 ) === ';' ) {
                                        # The one nasty exception: definition lists work like this:
                                        # ; title : definition text
                                        # So we check for : in the remainder text to split up the
@@ -2388,7 +2381,7 @@ class Parser {
                                wfProfileIn( __METHOD__ . "-paragraph" );
                                # No prefix (not in list)--go to paragraph mode
                                # XXX: use a stack for nestable elements like span, table and div
-                               $openmatch = preg_match('/(?:<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
+                               $openmatch = preg_match( '/(?:<table|<blockquote|<h1|<h2|<h3|<h4|<h5|<h6|<pre|<tr|<p|<ul|<ol|<dl|<li|<\\/tr|<\\/td|<\\/th)/iS', $t );
                                $closematch = preg_match(
                                        '/(?:<\\/table|<\\/blockquote|<\\/h1|<\\/h2|<\\/h3|<\\/h4|<\\/h5|<\\/h6|'.
                                        '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
@@ -3476,7 +3469,7 @@ class Parser {
                {
                        # Bug 529: if the template begins with a table or block-level
                        # element, it should be treated as beginning a new line.
-                       # This behaviour is somewhat controversial.
+                       # This behavior is somewhat controversial.
                        $text = "\n" . $text;
                }
 
@@ -4109,7 +4102,7 @@ class Parser {
                        $sectionIndex = false;
                        $numbering = '';
                        $markerMatches = array();
-                       if ( preg_match("/^$markerRegex/", $headline, $markerMatches ) ) {
+                       if ( preg_match( "/^$markerRegex/", $headline, $markerMatches ) ) {
                                $serial = $markerMatches[1];
                                list( $titleText, $sectionIndex ) = $this->mHeadings[$serial];
                                $isTemplate = ( $titleText != $baseTitleText );
@@ -4125,7 +4118,7 @@ class Parser {
                                # Increase TOC level
                                $toclevel++;
                                $sublevelCount[$toclevel] = 0;
-                               if ( $toclevel<$wgMaxTocLevel ) {
+                               if ( $toclevel < $wgMaxTocLevel ) {
                                        $prevtoclevel = $toclevel;
                                        $toc .= Linker::tocIndent();
                                        $numVisible++;
@@ -4147,7 +4140,7 @@ class Parser {
                                if ( $i == 0 ) {
                                        $toclevel = 1;
                                }
-                               if ( $toclevel<$wgMaxTocLevel ) {
+                               if ( $toclevel < $wgMaxTocLevel ) {
                                        if ( $prevtoclevel < $wgMaxTocLevel ) {
                                                # Unindent only if the previous toc level was shown :p
                                                $toc .= Linker::tocUnindent( $prevtoclevel - $toclevel );
@@ -4158,7 +4151,7 @@ class Parser {
                                }
                        } else {
                                # No change in level, end TOC line
-                               if ( $toclevel<$wgMaxTocLevel ) {
+                               if ( $toclevel < $wgMaxTocLevel ) {
                                        $toc .= Linker::tocLineEnd();
                                }
                        }
@@ -5240,7 +5233,7 @@ class Parser {
                } else { # Inline image
                        if ( !isset( $params['frame']['alt'] ) ) {
                                # No alt text, use the "caption" for the alt text
-                               if ( $caption !== '') {
+                               if ( $caption !== '' ) {
                                        $params['frame']['alt'] = $this->stripAltText( $caption, $holders );
                                } else {
                                        # No caption, fall back to using the filename for the