fix some spacing
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 26 Jan 2013 21:11:09 +0000 (22:11 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 26 Jan 2013 21:11:09 +0000 (22:11 +0100)
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2

23 files changed:
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiComparePages.php
includes/api/ApiParse.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiUpload.php
includes/cache/LocalisationCache.php
includes/db/DatabaseError.php
includes/db/DatabaseIbm_db2.php
includes/db/DatabaseMssql.php
includes/db/LoadBalancer.php
includes/diff/DairikiDiff.php
includes/logging/LogEventsList.php
includes/media/DjVu.php
includes/media/MediaTransformOutput.php
includes/media/SVGMetadataExtractor.php
includes/normal/UtfNormalBench.php
includes/normal/UtfNormalMemStress.php
includes/parser/LinkHolderArray.php
includes/parser/Parser.php
includes/parser/ParserOutput.php
includes/profiler/Profiler.php

index 78525e0..0599494 100644 (file)
@@ -654,7 +654,7 @@ abstract class ApiBase extends ContextSource {
                        array( $this, "parameterNotEmpty" ) ) ), $required );
 
                if ( count( $intersection ) > 1 ) {
-                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}",  $intersection ) . ' can not be used together', "{$p}invalidparammix" );
+                       $this->dieUsage( "The parameters {$p}" . implode( ", {$p}", $intersection ) . ' can not be used together', "{$p}invalidparammix" );
                } elseif ( count( $intersection ) == 0 ) {
                        $this->dieUsage( "One of the parameters {$p}" . implode( ", {$p}", $required ) . ' is required', "{$p}missingparam" );
                }
@@ -1369,7 +1369,7 @@ abstract class ApiBase extends ContextSource {
 
                // Check whether the error array was nested
                // array( array( <code>, <params> ), array( <another_code>, <params> ) )
-               if( is_array( $key ) ){
+               if( is_array( $key ) ) {
                        $error = $key;
                        $key = array_shift( $error );
                }
index b58be11..8f71b16 100644 (file)
@@ -108,7 +108,7 @@ class ApiBlock extends ApiBase {
                $res['userID'] = $target instanceof User ? $target->getId() : 0;
 
                $block = Block::newFromTarget( $target );
-               if( $block instanceof Block ){
+               if( $block instanceof Block ) {
                        $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity()
                                ? 'infinite'
                                : wfTimestamp( TS_ISO_8601, $block->mExpiry );
index 230ed33..863b70b 100644 (file)
@@ -85,11 +85,11 @@ class ApiComparePages extends ApiBase {
         * @return int
         */
        private function revisionOrTitleOrId( $revision, $titleText, $titleId ) {
-               if( $revision ){
+               if( $revision ) {
                        return $revision;
                } elseif( $titleText ) {
                        $title = Title::newFromText( $titleText );
-                       if( !$title ){
+                       if( !$title ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $titleText ) );
                        }
                        return $title->getLatestRevID();
index 143540b..e86c91c 100644 (file)
@@ -102,7 +102,7 @@ class ApiParse extends ApiBase {
                                $popts->enableLimitReport( !$params['disablepp'] );
 
                                // If for some reason the "oldid" is actually the current revision, it may be cached
-                               if ( $rev->isCurrent() )  {
+                               if ( $rev->isCurrent() ) {
                                        // May get from/save to parser cache
                                        $p_result = $this->getParsedContent( $pageObj, $popts,
                                                $pageid, isset( $prop['wikitext'] ) ) ;
index 6b77898..f89c826 100644 (file)
@@ -151,7 +151,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        if ( is_null( $title ) ) {
                                $this->dieUsage( "Bad title value '$prefix'", 'param_prefix' );
                        }
-                       $this->addWhereFld( 'log_namespace',  $title->getNamespace() );
+                       $this->addWhereFld( 'log_namespace', $title->getNamespace() );
                        $this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) );
                }
 
@@ -201,7 +201,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
        public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) {
                switch ( $type ) {
                        case 'move':
-                               if ( $legacy ){
+                               if ( $legacy ) {
                                        $targetKey = 0;
                                        $noredirKey = 1;
                                } else {
@@ -223,7 +223,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                $params = null;
                                break;
                        case 'patrol':
-                               if ( $legacy ){
+                               if ( $legacy ) {
                                        $cur = 0;
                                        $prev = 1;
                                        $auto = 2;
index a6a6dff..2fef68a 100644 (file)
@@ -559,7 +559,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                ksort( $myWgHooks );
 
                $data = array();
-               foreach ( $myWgHooks as $hook => $hooks )  {
+               foreach ( $myWgHooks as $hook => $hooks ) {
                        $arr = array(
                                'name' => $hook,
                                'subscribers' => array_map( array( 'SpecialVersion', 'arrayToString' ), $hooks ),
index 1d7ba0f..2d45b29 100644 (file)
@@ -122,7 +122,7 @@ class ApiUpload extends ApiBase {
         * Get an uplaod result based on upload context
         * @return array
         */
-       private function getContextResult(){
+       private function getContextResult() {
                $warnings = $this->getApiWarnings();
                if ( $warnings && !$this->mParams['ignorewarnings'] ) {
                        // Get warnings formated in result array format
@@ -144,7 +144,7 @@ class ApiUpload extends ApiBase {
         * @param $warnings array Array of Api upload warnings
         * @return array
         */
-       private function getStashResult( $warnings ){
+       private function getStashResult( $warnings ) {
                $result = array ();
                // Some uploads can request they be stashed, so as not to publish them immediately.
                // In this case, a failure to stash ought to be fatal
@@ -166,7 +166,7 @@ class ApiUpload extends ApiBase {
         * @param $warnings array Array of Api upload warnings
         * @return array
         */
-       private function getWarningsResult( $warnings ){
+       private function getWarningsResult( $warnings ) {
                $result = array();
                $result['result'] = 'Warning';
                $result['warnings'] = $warnings;
@@ -366,7 +366,7 @@ class ApiUpload extends ApiBase {
                if ( $this->mParams['chunk'] ) {
                        // Chunk upload
                        $this->mUpload = new UploadFromChunks();
-                       if( isset( $this->mParams['filekey'] ) ){
+                       if( isset( $this->mParams['filekey'] ) ) {
                                // handle new chunk
                                $this->mUpload->continueChunks(
                                        $this->mParams['filename'],
index 7cc1b9c..dc3151e 100644 (file)
@@ -604,7 +604,7 @@ class LocalisationCache {
                                } elseif ( in_array( $key, self::$mergeableAliasListKeys ) ) {
                                        $value = array_merge_recursive( $value, $fallbackValue );
                                } elseif ( in_array( $key, self::$optionalMergeKeys ) ) {
-                                       if ( !empty( $value['inherit'] ) )  {
+                                       if ( !empty( $value['inherit'] ) ) {
                                                $value = array_merge( $fallbackValue, $value );
                                        }
 
index a53a674..b6d0d00 100644 (file)
@@ -176,7 +176,7 @@ class DBConnectionError extends DBError {
                return "$text<hr />$extra";
        }
 
-       public function reportHTML(){
+       public function reportHTML() {
                global $wgUseFileCache;
 
                # Check whether we can serve a file-cached copy of the page with the error underneath
index 880d702..f2b4b09 100644 (file)
@@ -143,13 +143,12 @@ class IBM_DB2Result{
         * @param $sql String
         * @param $columns Array
         */
-       public function __construct( $db, $result, $num_rows, $sql, $columns ){
+       public function __construct( $db, $result, $num_rows, $sql, $columns ) {
                $this->db = $db;
 
-               if( $result instanceof ResultWrapper ){
+               if( $result instanceof ResultWrapper ) {
                        $this->result = $result->result;
-               }
-               else{
+               } else {
                        $this->result = $result;
                }
 
@@ -224,7 +223,7 @@ class IBM_DB2Result{
         * @return mixed Array on success, false on failure
         * @throws DBUnexpectedError
         */
-       public function fetchRow(){
+       public function fetchRow() {
                if ( $this->result
                                && $this->num_rows > 0
                                && $this->current_pos >= 0
@@ -239,7 +238,7 @@ class IBM_DB2Result{
                                }
                        }
 
-                       if ( $this->loadedLines > $this->current_pos ){
+                       if ( $this->loadedLines > $this->current_pos ) {
                                return $this->resultSet[$this->current_pos++];
                        }
 
@@ -251,7 +250,7 @@ class IBM_DB2Result{
         * Free a DB2 result object
         * @throws DBUnexpectedError
         */
-       public function freeResult(){
+       public function freeResult() {
                unset( $this->resultSet );
                if ( !@db2_free_result( $this->result ) ) {
                        throw new DBUnexpectedError( $this, "Unable to free DB2 result\n" );
@@ -420,7 +419,7 @@ class DatabaseIbm_db2 extends DatabaseBase {
         * Returns the database connection object
         * @return Object
         */
-       public function getDb(){
+       public function getDb() {
                return $this->mConn;
        }
 
index 317ff09..7def1b2 100644 (file)
@@ -102,7 +102,7 @@ class DatabaseMssql extends DatabaseBase {
                $ntAuthPassTest = strtolower( $password );
 
                // Decide which auth scenerio to use
-               if( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ){
+               if( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ) {
                        // Don't add credentials to $connectionInfo
                } else {
                        $connectionInfo['UID'] = $user;
@@ -414,7 +414,7 @@ class DatabaseMssql extends DatabaseBase {
                $identity = null;
                $tableRaw = preg_replace( '#\[([^\]]*)\]#', '$1', $table ); // strip matching square brackets from table name
                $res = $this->doQuery( "SELECT NAME AS idColumn FROM SYS.IDENTITY_COLUMNS WHERE OBJECT_NAME(OBJECT_ID)='{$tableRaw}'" );
-               if( $res && $res->numrows() ){
+               if( $res && $res->numrows() ) {
                        // There is an identity for this table.
                        $identity = array_pop( $res->fetch( SQLSRV_FETCH_ASSOC ) );
                }
@@ -431,7 +431,7 @@ class DatabaseMssql extends DatabaseBase {
                                // iterate through
                                foreach ($a as $k => $v ) {
                                        if ( $k == $identity ) {
-                                               if( !is_null($v) ){
+                                               if( !is_null($v) ) {
                                                        // there is a value being passed to us, we need to turn on and off inserted identity
                                                        $sqlPre = "SET IDENTITY_INSERT $table ON;" ;
                                                        $sqlPost = ";SET IDENTITY_INSERT $table OFF;";
@@ -930,7 +930,7 @@ class DatabaseMssql extends DatabaseBase {
         * Get the type of the DBMS, as it appears in $wgDBtype.
         * @return string
         */
-       function getType(){
+       function getType() {
                return 'mssql';
        }
 
index 2858cd9..2a0c50f 100644 (file)
@@ -209,7 +209,7 @@ class LoadBalancer {
                        return $this->getWriterIndex();
                }
 
-               if ( count( $this->mServers ) == 1 )  {
+               if ( count( $this->mServers ) == 1 ) {
                        # Skip the load balancing if there's only one server
                        return 0;
                } elseif ( $group === false and $this->mReadIndex >= 0 ) {
@@ -258,7 +258,7 @@ class LoadBalancer {
                                        $i = $this->pickRandom( $currentLoads );
                                } else {
                                        $i = $this->getRandomNonLagged( $currentLoads, $wiki );
-                                       if ( $i === false && count( $currentLoads ) != 0 )  {
+                                       if ( $i === false && count( $currentLoads ) != 0 ) {
                                                # All slaves lagged. Switch to read-only mode
                                                wfDebugLog( 'replication', "All slaves lagged. Switch to read-only mode\n" );
                                                $wgReadOnly = 'The database has been automatically locked ' .
@@ -392,7 +392,7 @@ class LoadBalancer {
                wfProfileIn( __METHOD__ );
                $this->mWaitForPos = $pos;
                for ( $i = 1; $i < count( $this->mServers ); $i++ ) {
-                       $this->doWait( $i , true );
+                       $this->doWait( $i, true );
                }
                wfProfileOut( __METHOD__ );
        }
index 6a6f930..2e8b354 100644 (file)
@@ -221,7 +221,7 @@ class _DiffEngine {
                        }
 
                        $add = array();
-                       while ( $yi < $n_to && $this->ychanged[$yi] )  {
+                       while ( $yi < $n_to && $this->ychanged[$yi] ) {
                                $add[] = $to_lines[$yi++];
                        }
 
index 1110249..03d5276 100644 (file)
@@ -560,7 +560,7 @@ class LogEventsList extends ContextSource {
                /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
                if ( wfRunHooks( 'LogEventsListShowLogExtract', array( &$s, $types, $page, $user, $param ) ) ) {
                        // $out can be either an OutputPage object or a String-by-reference
-                       if ( $out instanceof OutputPage ){
+                       if ( $out instanceof OutputPage ) {
                                $out->addHTML( $s );
                        } else {
                                $out = $s;
index 124db32..cd8a044 100644 (file)
@@ -247,7 +247,7 @@ class DjVuHandler extends ImageHandler {
                        $image->djvuTextTree = false;
                        $tree = new SimpleXMLElement( $metadata );
                        if( $tree->getName() == 'mw-djvu' ) {
-                               foreach($tree->children() as $b){
+                               foreach( $tree->children() as $b ) {
                                        if( $b->getName() == 'DjVuTxt' ) {
                                                $image->djvuTextTree = $b;
                                        }
index 7301df6..110c659 100644 (file)
@@ -237,7 +237,7 @@ class ThumbnailImage extends MediaTransformOutput {
                # Previous parameters:
                #   $file, $url, $width, $height, $path = false, $page = false
 
-               if( is_array( $parameters ) ){
+               if( is_array( $parameters ) ) {
                        $defaults = array(
                                'page' => false
                        );
index 456c016..d6624ee 100644 (file)
@@ -187,7 +187,7 @@ class SVGReader {
                while( $keepReading ) {
                        if( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
                                break;
-                       } elseif( $this->reader->nodeType == XmlReader::TEXT ){
+                       } elseif( $this->reader->nodeType == XmlReader::TEXT ) {
                                $this->metadata[$metafield] = trim( $this->reader->value );
                        }
                        $keepReading = $this->reader->read();
index 6642844..9a05b81 100644 (file)
@@ -80,7 +80,7 @@ function benchmarkTest( &$u, $filename, $desc ) {
        }
 }
 
-function benchTime(){
+function benchTime() {
        $st = explode( ' ', microtime() );
        return (float)$st[0] + (float)$st[1];
 }
index 1277dc2..7162a8b 100644 (file)
@@ -82,7 +82,7 @@ function benchmarkTest( &$u, $filename, $desc ) {
        }
 }
 
-function benchTime(){
+function benchTime() {
        $st = explode( ' ', microtime() );
        return (float)$st[0] + (float)$st[1];
 }
index 083bd29..0c05a51 100644 (file)
@@ -322,7 +322,7 @@ class LinkHolderArray {
                }
                if ( $queries ) {
                        $where = array();
-                       foreach( $queries as $ns => $pages ){
+                       foreach( $queries as $ns => $pages ) {
                                $where[] = $dbr->makeList(
                                        array(
                                                'page_namespace' => $ns,
@@ -514,7 +514,7 @@ class LinkHolderArray {
                }
 
 
-               if(!$linkBatch->isEmpty()){
+               if( !$linkBatch->isEmpty() ) {
                        // construct query
                        $dbr = wfGetDB( DB_SLAVE );
                        $varRes = $dbr->select( 'page',
@@ -570,16 +570,18 @@ class LinkHolderArray {
                        wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
 
                        // rebuild the categories in original order (if there are replacements)
-                       if(count($varCategories)>0){
+                       if( count( $varCategories ) > 0 ) {
                                $newCats = array();
                                $originalCats = $output->getCategories();
-                               foreach($originalCats as $cat => $sortkey){
+                               foreach( $originalCats as $cat => $sortkey ) {
                                        // make the replacement
-                                       if( array_key_exists($cat,$varCategories) )
+                                       if( array_key_exists( $cat, $varCategories ) ) {
                                                $newCats[$varCategories[$cat]] = $sortkey;
-                                       else $newCats[$cat] = $sortkey;
+                                       } else {
+                                               $newCats[$cat] = $sortkey;
+                                       }
                                }
-                               $output->setCategoryLinks($newCats);
+                               $output->setCategoryLinks( $newCats );
                        }
                }
        }
index 8f892a3..531e3f7 100644 (file)
@@ -215,8 +215,8 @@ class Parser {
        public function __construct( $conf = array() ) {
                $this->mConf = $conf;
                $this->mUrlProtocols = wfUrlProtocols();
-               $this->mExtLinkBracketedRegex = '/\[(((?i)' . $this->mUrlProtocols . ')'.
-                       self::EXT_LINK_URL_CLASS.'+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
+               $this->mExtLinkBracketedRegex = '/\[(((?i)' . $this->mUrlProtocols . ')' .
+                       self::EXT_LINK_URL_CLASS . '+)\p{Zs}*([^\]\\x00-\\x08\\x0a-\\x1F]*?)\]/Su';
                if ( isset( $conf['preprocessorClass'] ) ) {
                        $this->mPreprocessorClass = $conf['preprocessorClass'];
                } elseif ( defined( 'MW_COMPILED' ) ) {
@@ -357,7 +357,7 @@ class Parser {
                 */
 
                global $wgUseTidy, $wgAlwaysUseTidy;
-               $fname = __METHOD__.'-' . wfGetCaller();
+               $fname = __METHOD__ . '-' . wfGetCaller();
                wfProfileIn( __METHOD__ );
                wfProfileIn( $fname );
 
@@ -499,8 +499,8 @@ class Parser {
                                "Preprocessor generated node count: " .
                                        "{$this->mGeneratedPPNodeCount}/{$this->mOptions->getMaxGeneratedPPNodeCount()}\n" .
                                "Post-expand include size: {$this->mIncludeSizes['post-expand']}/$max bytes\n" .
-                               "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n".
-                               "Highest expansion depth: {$this->mHighestExpansionDepth}/{$this->mOptions->getMaxPPExpandDepth()}\n".
+                               "Template argument size: {$this->mIncludeSizes['arg']}/$max bytes\n" .
+                               "Highest expansion depth: {$this->mHighestExpansionDepth}/{$this->mOptions->getMaxPPExpandDepth()}\n" .
                                $PFreport;
                        wfRunHooks( 'ParserLimitReport', array( $this, &$limitReport ) );
                        $text .= "\n<!-- \n$limitReport-->\n";
@@ -937,33 +937,33 @@ class Parser {
                        $line = trim( $outLine );
 
                        if ( $line === '' ) { # empty line, go to next line
-                               $out .= $outLine."\n";
+                               $out .= $outLine . "\n";
                                continue;
                        }
 
                        $first_character = $line[0];
                        $matches = array();
 
-                       if ( preg_match( '/^(:*)\{\|(.*)$/', $line , $matches ) ) {
+                       if ( preg_match( '/^(:*)\{\|(.*)$/', $line, $matches ) ) {
                                # First check if we are starting a new table
                                $indent_level = strlen( $matches[1] );
 
                                $attributes = $this->mStripState->unstripBoth( $matches[2] );
-                               $attributes = Sanitizer::fixTagAttributes( $attributes , 'table' );
-
-                               $outLine = str_repeat( '<dl><dd>' , $indent_level ) . "<table{$attributes}>";
-                               array_push( $td_history , false );
-                               array_push( $last_tag_history , '' );
-                               array_push( $tr_history , false );
-                               array_push( $tr_attributes , '' );
-                               array_push( $has_opened_tr , false );
+                               $attributes = Sanitizer::fixTagAttributes( $attributes, 'table' );
+
+                               $outLine = str_repeat( '<dl><dd>', $indent_level ) . "<table{$attributes}>";
+                               array_push( $td_history, false );
+                               array_push( $last_tag_history, '' );
+                               array_push( $tr_history, false );
+                               array_push( $tr_attributes, '' );
+                               array_push( $has_opened_tr, false );
                        } elseif ( count( $td_history ) == 0 ) {
                                # Don't do any of the following
-                               $out .= $outLine."\n";
+                               $out .= $outLine . "\n";
                                continue;
-                       } elseif ( substr( $line , 0 , 2 ) === '|}' ) {
+                       } elseif ( substr( $line, 0, 2 ) === '|}' ) {
                                # We are ending a table
-                               $line = '</table>' . substr( $line , 2 );
+                               $line = '</table>' . substr( $line, 2 );
                                $last_tag = array_pop( $last_tag_history );
 
                                if ( !array_pop( $has_opened_tr ) ) {
@@ -978,8 +978,8 @@ class Parser {
                                        $line = "</{$last_tag}>{$line}";
                                }
                                array_pop( $tr_attributes );
-                               $outLine = $line . str_repeat( '</dd></dl>' , $indent_level );
-                       } elseif ( substr( $line , 0 , 2 ) === '|-' ) {
+                               $outLine = $line . str_repeat( '</dd></dl>', $indent_level );
+                       } elseif ( substr( $line, 0, 2 ) === '|-' ) {
                                # Now we have a table row
                                $line = preg_replace( '#^\|-+#', '', $line );
 
@@ -992,7 +992,7 @@ class Parser {
                                $line = '';
                                $last_tag = array_pop( $last_tag_history );
                                array_pop( $has_opened_tr );
-                               array_push( $has_opened_tr , true );
+                               array_push( $has_opened_tr, true );
 
                                if ( array_pop( $tr_history ) ) {
                                        $line = '</tr>';
@@ -1003,27 +1003,27 @@ class Parser {
                                }
 
                                $outLine = $line;
-                               array_push( $tr_history , false );
-                               array_push( $td_history , false );
-                               array_push( $last_tag_history , '' );
-                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line , 0 , 2 )  === '|+' ) {
+                               array_push( $tr_history, false );
+                               array_push( $td_history, false );
+                               array_push( $last_tag_history, '' );
+                       } elseif ( $first_character === '|' || $first_character === '!' || substr( $line, 0, 2 )  === '|+' ) {
                                # This might be cell elements, td, th or captions
-                               if ( substr( $line , 0 , 2 ) === '|+' ) {
+                               if ( substr( $line, 0, 2 ) === '|+' ) {
                                        $first_character = '+';
-                                       $line = substr( $line , 1 );
+                                       $line = substr( $line, 1 );
                                }
 
-                               $line = substr( $line , 1 );
+                               $line = substr( $line, 1 );
 
                                if ( $first_character === '!' ) {
-                                       $line = str_replace( '!!' , '||' , $line );
+                                       $line = str_replace( '!!', '||', $line );
                                }
 
                                # Split up multiple cells on the same line.
                                # FIXME : This can result in improper nesting of tags processed
                                # by earlier parser steps, but should avoid splitting up eg
                                # attribute values containing literal "||".
-                               $cells = StringUtils::explodeMarkup( '||' , $line );
+                               $cells = StringUtils::explodeMarkup( '||', $line );
 
                                $outLine = '';
 
@@ -1035,10 +1035,10 @@ class Parser {
                                                if ( !array_pop( $tr_history ) ) {
                                                        $previous = "<tr{$tr_after}>\n";
                                                }
-                                               array_push( $tr_history , true );
-                                               array_push( $tr_attributes , '' );
+                                               array_push( $tr_history, true );
+                                               array_push( $tr_attributes, '' );
                                                array_pop( $has_opened_tr );
-                                               array_push( $has_opened_tr , true );
+                                               array_push( $has_opened_tr, true );
                                        }
 
                                        $last_tag = array_pop( $last_tag_history );
@@ -1057,10 +1057,10 @@ class Parser {
                                                $last_tag = '';
                                        }
 
-                                       array_push( $last_tag_history , $last_tag );
+                                       array_push( $last_tag_history, $last_tag );
 
                                        # A cell could contain both parameters and data
-                                       $cell_data = explode( '|' , $cell , 2 );
+                                       $cell_data = explode( '|', $cell, 2 );
 
                                        # Bug 553: Note that a '|' inside an invalid link should not
                                        # be mistaken as delimiting cell parameters
@@ -1070,12 +1070,12 @@ class Parser {
                                                $cell = "{$previous}<{$last_tag}>{$cell_data[0]}";
                                        } else {
                                                $attributes = $this->mStripState->unstripBoth( $cell_data[0] );
-                                               $attributes = Sanitizer::fixTagAttributes( $attributes , $last_tag );
+                                               $attributes = Sanitizer::fixTagAttributes( $attributes, $last_tag );
                                                $cell = "{$previous}<{$last_tag}{$attributes}>{$cell_data[1]}";
                                        }
 
                                        $outLine .= $cell;
-                                       array_push( $td_history , true );
+                                       array_push( $td_history, true );
                                }
                        }
                        $out .= $outLine . "\n";
@@ -1175,7 +1175,7 @@ class Parser {
 
                # replaceInternalLinks may sometimes leave behind
                # absolute URLs, which have to be masked to hide them from replaceExternalLinks
-               $text = str_replace( $this->mUniqPrefix.'NOPARSE', '', $text );
+               $text = str_replace( $this->mUniqPrefix . 'NOPARSE', '', $text );
 
                $text = $this->doMagicLinks( $text );
                $text = $this->formatHeadings( $text, $origText, $isMain );
@@ -1243,7 +1243,7 @@ class Parser {
                                $CssClass = 'mw-magiclink-pmid';
                                $id = $m[4];
                        } else {
-                               throw new MWException( __METHOD__.': unrecognised match type "' .
+                               throw new MWException( __METHOD__ . ': unrecognised match type "' .
                                        substr( $m[0], 0, 20 ) . '"' );
                        }
                        $url = wfMessage( $urlmsg, $id )->inContentLanguage()->text();
@@ -1333,8 +1333,7 @@ class Parser {
                wfProfileIn( __METHOD__ );
                for ( $i = 6; $i >= 1; --$i ) {
                        $h = str_repeat( '=', $i );
-                       $text = preg_replace( "/^$h(.+)$h\\s*$/m",
-                         "<h$i>\\1</h$i>", $text );
+                       $text = preg_replace( "/^$h(.+)$h\\s*$/m", "<h$i>\\1</h$i>", $text );
                }
                wfProfileOut( __METHOD__ );
                return $text;
@@ -1355,7 +1354,7 @@ class Parser {
                foreach ( $lines as $line ) {
                        $outtext .= $this->doQuotes( $line ) . "\n";
                }
-               $outtext = substr( $outtext, 0,-1 );
+               $outtext = substr( $outtext, 0, -1 );
                wfProfileOut( __METHOD__ );
                return $outtext;
        }
@@ -1471,7 +1470,7 @@ class Parser {
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b></i><b>'; $state = 'b';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<b><i>'.$buffer.'</i>'; $state = 'b';
+                                                       $output .= '<b><i>' . $buffer . '</i>'; $state = 'b';
                                                } else { # $state can be 'b' or ''
                                                        $output .= '<i>'; $state .= 'i';
                                                }
@@ -1483,7 +1482,7 @@ class Parser {
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b>'; $state = 'i';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>'.$buffer.'</b>'; $state = 'i';
+                                                       $output .= '<i><b>' . $buffer . '</b>'; $state = 'i';
                                                } else { # $state can be 'i' or ''
                                                        $output .= '<b>'; $state .= 'b';
                                                }
@@ -1497,7 +1496,7 @@ class Parser {
                                                } elseif ( $state === 'ib' ) {
                                                        $output .= '</b></i>'; $state = '';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>'.$buffer.'</b></i>'; $state = '';
+                                                       $output .= '<i><b>' . $buffer . '</b></i>'; $state = '';
                                                } else { # ($state == '')
                                                        $buffer = ''; $state = 'both';
                                                }
@@ -1517,7 +1516,7 @@ class Parser {
                        }
                        # There might be lonely ''''', so make sure we have a buffer
                        if ( $state === 'both' && $buffer ) {
-                               $output .= '<b><i>'.$buffer.'</i></b>';
+                               $output .= '<b><i>' . $buffer . '</i></b>';
                        }
                        return $output;
                }
@@ -1760,7 +1759,7 @@ class Parser {
        function replaceInternalLinks2( &$s ) {
                wfProfileIn( __METHOD__ );
 
-               wfProfileIn( __METHOD__.'-setup' );
+               wfProfileIn( __METHOD__ . '-setup' );
                static $tc = FALSE, $e1, $e1_img;
                # the % is needed to support urlencoded titles as well
                if ( !$tc ) {
@@ -1790,9 +1789,9 @@ class Parser {
                }
 
                if ( is_null( $this->mTitle ) ) {
-                       wfProfileOut( __METHOD__.'-setup' );
+                       wfProfileOut( __METHOD__ . '-setup' );
                        wfProfileOut( __METHOD__ );
-                       throw new MWException( __METHOD__.": \$this->mTitle is null\n" );
+                       throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
                }
                $nottalk = !$this->mTitle->isTalkPage();
 
@@ -1814,7 +1813,7 @@ class Parser {
                        $selflink = array( $this->mTitle->getPrefixedText() );
                }
                $useSubpages = $this->areSubpagesAllowed();
-               wfProfileOut( __METHOD__.'-setup' );
+               wfProfileOut( __METHOD__ . '-setup' );
 
                # Loop for each link
                for ( ; $line !== false && $line !== null ; $a->next(), $line = $a->current() ) {
@@ -1827,24 +1826,24 @@ class Parser {
                        }
 
                        if ( $useLinkPrefixExtension ) {
-                               wfProfileIn( __METHOD__.'-prefixhandling' );
+                               wfProfileIn( __METHOD__ . '-prefixhandling' );
                                if ( preg_match( $e2, $s, $m ) ) {
                                        $prefix = $m[2];
                                        $s = $m[1];
                                } else {
-                                       $prefix='';
+                                       $prefix = '';
                                }
                                # first link
                                if ( $first_prefix ) {
                                        $prefix = $first_prefix;
                                        $first_prefix = false;
                                }
-                               wfProfileOut( __METHOD__.'-prefixhandling' );
+                               wfProfileOut( __METHOD__ . '-prefixhandling' );
                        }
 
                        $might_be_img = false;
 
-                       wfProfileIn( __METHOD__."-e1" );
+                       wfProfileIn( __METHOD__ . "-e1" );
                        if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
                                $text = $m[2];
                                # If we get a ] at the beginning of $m[3] that means we have a link that's something like:
@@ -1878,18 +1877,18 @@ class Parser {
                                $trail = "";
                        } else { # Invalid form; output directly
                                $s .= $prefix . '[[' . $line ;
-                               wfProfileOut( __METHOD__."-e1" );
+                               wfProfileOut( __METHOD__ . "-e1" );
                                continue;
                        }
-                       wfProfileOut( __METHOD__."-e1" );
-                       wfProfileIn( __METHOD__."-misc" );
+                       wfProfileOut( __METHOD__ . "-e1" );
+                       wfProfileIn( __METHOD__ . "-misc" );
 
                        # Don't allow internal links to pages containing
                        # PROTO: where PROTO is a valid URL protocol; these
                        # should be external links.
                        if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $m[1] ) ) {
                                $s .= $prefix . '[[' . $line ;
-                               wfProfileOut( __METHOD__."-misc" );
+                               wfProfileOut( __METHOD__ . "-misc" );
                                continue;
                        }
 
@@ -1906,21 +1905,21 @@ class Parser {
                                $link = substr( $link, 1 );
                        }
 
-                       wfProfileOut( __METHOD__."-misc" );
-                       wfProfileIn( __METHOD__."-title" );
+                       wfProfileOut( __METHOD__ . "-misc" );
+                       wfProfileIn( __METHOD__ . "-title" );
                        $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) );
                        if ( $nt === null ) {
                                $s .= $prefix . '[[' . $line;
-                               wfProfileOut( __METHOD__."-title" );
+                               wfProfileOut( __METHOD__ . "-title" );
                                continue;
                        }
 
                        $ns = $nt->getNamespace();
                        $iw = $nt->getInterWiki();
-                       wfProfileOut( __METHOD__."-title" );
+                       wfProfileOut( __METHOD__ . "-title" );
 
                        if ( $might_be_img ) { # if this is actually an invalid link
-                               wfProfileIn( __METHOD__."-might_be_img" );
+                               wfProfileIn( __METHOD__ . "-might_be_img" );
                                if ( $ns == NS_FILE && $noforce ) { # but might be an image
                                        $found = false;
                                        while ( true ) {
@@ -1952,16 +1951,16 @@ class Parser {
                                                $holders->merge( $this->replaceInternalLinks2( $text ) );
                                                $s .= "{$prefix}[[$link|$text";
                                                # note: no $trail, because without an end, there *is* no trail
-                                               wfProfileOut( __METHOD__."-might_be_img" );
+                                               wfProfileOut( __METHOD__ . "-might_be_img" );
                                                continue;
                                        }
                                } else { # it's not an image, so output it raw
                                        $s .= "{$prefix}[[$link|$text";
                                        # note: no $trail, because without an end, there *is* no trail
-                                       wfProfileOut( __METHOD__."-might_be_img" );
+                                       wfProfileOut( __METHOD__ . "-might_be_img" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__."-might_be_img" );
+                               wfProfileOut( __METHOD__ . "-might_be_img" );
                        }
 
                        $wasblank = ( $text  == '' );
@@ -1978,7 +1977,7 @@ class Parser {
                        # Link not escaped by : , create the various objects
                        if ( $noforce ) {
                                # Interwikis
-                               wfProfileIn( __METHOD__."-interwiki" );
+                               wfProfileIn( __METHOD__ . "-interwiki" );
                                if ( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && Language::fetchLanguageName( $iw, null, 'mw' ) ) {
                                        // XXX: the above check prevents links to sites with identifiers that are not language codes
 
@@ -1990,13 +1989,13 @@ class Parser {
 
                                        $s = rtrim( $s . $prefix );
                                        $s .= trim( $trail, "\n" ) == '' ? '': $prefix . $trail;
-                                       wfProfileOut( __METHOD__."-interwiki" );
+                                       wfProfileOut( __METHOD__ . "-interwiki" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__."-interwiki" );
+                               wfProfileOut( __METHOD__ . "-interwiki" );
 
                                if ( $ns == NS_FILE ) {
-                                       wfProfileIn( __METHOD__."-image" );
+                                       wfProfileIn( __METHOD__ . "-image" );
                                        if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
                                                if ( $wasblank ) {
                                                        # if no parameters were passed, $text
@@ -2017,12 +2016,12 @@ class Parser {
                                        } else {
                                                $s .= $prefix . $trail;
                                        }
-                                       wfProfileOut( __METHOD__."-image" );
+                                       wfProfileOut( __METHOD__ . "-image" );
                                        continue;
                                }
 
                                if ( $ns == NS_CATEGORY ) {
-                                       wfProfileIn( __METHOD__."-category" );
+                                       wfProfileIn( __METHOD__ . "-category" );
                                        $s = rtrim( $s . "\n" ); # bug 87
 
                                        if ( $wasblank ) {
@@ -2041,7 +2040,7 @@ class Parser {
                                         */
                                        $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail;
 
-                                       wfProfileOut( __METHOD__."-category" );
+                                       wfProfileOut( __METHOD__ . "-category" );
                                        continue;
                                }
                        }
@@ -2057,7 +2056,7 @@ class Parser {
                        # NS_MEDIA is a pseudo-namespace for linking directly to a file
                        # @todo FIXME: Should do batch file existence checks, see comment below
                        if ( $ns == NS_MEDIA ) {
-                               wfProfileIn( __METHOD__."-media" );
+                               wfProfileIn( __METHOD__ . "-media" );
                                # Give extensions a chance to select the file revision for us
                                $options = array();
                                $descQuery = false;
@@ -2068,11 +2067,11 @@ class Parser {
                                # Cloak with NOPARSE to avoid replacement in replaceExternalLinks
                                $s .= $prefix . $this->armorLinks(
                                        Linker::makeMediaLinkFile( $nt, $file, $text ) ) . $trail;
-                               wfProfileOut( __METHOD__."-media" );
+                               wfProfileOut( __METHOD__ . "-media" );
                                continue;
                        }
 
-                       wfProfileIn( __METHOD__."-always_known" );
+                       wfProfileIn( __METHOD__ . "-always_known" );
                        # Some titles, such as valid special pages or files in foreign repos, should
                        # be shown as bluelinks even though they're not included in the page table
                        #
@@ -2085,7 +2084,7 @@ class Parser {
                                # Links will be added to the output link list after checking
                                $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix );
                        }
-                       wfProfileOut( __METHOD__."-always_known" );
+                       wfProfileOut( __METHOD__ . "-always_known" );
                }
                wfProfileOut( __METHOD__ );
                return $holders;
@@ -2273,7 +2272,7 @@ class Parser {
                } else {
                        return '<!-- ERR 3 -->';
                }
-               return $text."\n";
+               return $text . "\n";
        }
        /**#@-*/
 
@@ -2388,13 +2387,13 @@ class Parser {
 
                        # If we have no prefixes, go to paragraph mode.
                        if ( 0 == $prefixLength ) {
-                               wfProfileIn( __METHOD__."-paragraph" );
+                               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 );
                                $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 );
+                                       '<td|<th|<\\/?div|<hr|<\\/pre|<\\/p|'.$this->mUniqPrefix . '-pre|<\\/li|<\\/ul|<\\/ol|<\\/dl|<\\/?center)/iS', $t );
                                if ( $openmatch or $closematch ) {
                                        $paragraphStack = false;
                                        # TODO bug 5718: paragraph closed
@@ -2408,7 +2407,7 @@ class Parser {
                                                # pre
                                                if ( $this->mLastSection !== 'pre' ) {
                                                        $paragraphStack = false;
-                                                       $output .= $this->closeParagraph().'<pre>';
+                                                       $output .= $this->closeParagraph() . '<pre>';
                                                        $this->mLastSection = 'pre';
                                                }
                                                $t = substr( $t, 1 );
@@ -2416,7 +2415,7 @@ class Parser {
                                                # paragraph
                                                if ( trim( $t ) === '' ) {
                                                        if ( $paragraphStack ) {
-                                                               $output .= $paragraphStack.'<br />';
+                                                               $output .= $paragraphStack . '<br />';
                                                                $paragraphStack = false;
                                                                $this->mLastSection = 'p';
                                                        } else {
@@ -2434,20 +2433,20 @@ class Parser {
                                                                $paragraphStack = false;
                                                                $this->mLastSection = 'p';
                                                        } elseif ( $this->mLastSection !== 'p' ) {
-                                                               $output .= $this->closeParagraph().'<p>';
+                                                               $output .= $this->closeParagraph() . '<p>';
                                                                $this->mLastSection = 'p';
                                                        }
                                                }
                                        }
                                }
-                               wfProfileOut( __METHOD__."-paragraph" );
+                               wfProfileOut( __METHOD__ . "-paragraph" );
                        }
                        # somewhere above we forget to get out of pre block (bug 785)
                        if ( $preCloseMatch && $this->mInPre ) {
                                $this->mInPre = false;
                        }
                        if ( $paragraphStack === false ) {
-                               $output .= $t."\n";
+                               $output .= $t . "\n";
                        }
                }
                while ( $prefixLength ) {
@@ -2581,7 +2580,7 @@ class Parser {
                                if ( $c === ">" ) {
                                        $stack--;
                                        if ( $stack < 0 ) {
-                                               wfDebug( __METHOD__.": Invalid input; too many close tags\n" );
+                                               wfDebug( __METHOD__ . ": Invalid input; too many close tags\n" );
                                                wfProfileOut( __METHOD__ );
                                                return false;
                                        }
@@ -2621,7 +2620,7 @@ class Parser {
                        }
                }
                if ( $stack > 0 ) {
-                       wfDebug( __METHOD__.": Invalid input; not enough close tags (stack $stack, state $state)\n" );
+                       wfDebug( __METHOD__ . ": Invalid input; not enough close tags (stack $stack, state $state)\n" );
                        wfProfileOut( __METHOD__ );
                        return false;
                }
@@ -2849,7 +2848,7 @@ class Parser {
                                $value = $this->getRevisionUser();
                                break;
                        case 'namespace':
-                               $value = str_replace( '_',' ',$wgContLang->getNsText( $this->mTitle->getNamespace() ) );
+                               $value = str_replace( '_', ' ', $wgContLang->getNsText( $this->mTitle->getNamespace() ) );
                                break;
                        case 'namespacee':
                                $value = wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) );
@@ -2858,7 +2857,7 @@ class Parser {
                                $value = $this->mTitle->getNamespace();
                                break;
                        case 'talkspace':
-                               $value = $this->mTitle->canTalk() ? str_replace( '_',' ',$this->mTitle->getTalkNsText() ) : '';
+                               $value = $this->mTitle->canTalk() ? str_replace( '_', ' ', $this->mTitle->getTalkNsText() ) : '';
                                break;
                        case 'talkspacee':
                                $value = $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : '';
@@ -3070,7 +3069,7 @@ class Parser {
                if ( $frame === false ) {
                        $frame = $this->getPreprocessor()->newFrame();
                } elseif ( !( $frame instanceof PPFrame ) ) {
-                       wfDebug( __METHOD__." called using plain parameters instead of a PPFrame instance. Creating custom frame.\n" );
+                       wfDebug( __METHOD__ . " called using plain parameters instead of a PPFrame instance. Creating custom frame.\n" );
                        $frame = $this->getPreprocessor()->newCustomFrame( $frame );
                }
 
@@ -3153,7 +3152,7 @@ class Parser {
        function braceSubstitution( $piece, $frame ) {
                global $wgContLang;
                wfProfileIn( __METHOD__ );
-               wfProfileIn( __METHOD__.'-setup' );
+               wfProfileIn( __METHOD__ . '-setup' );
 
                # Flags
                $found = false;             # $text has been filled
@@ -3178,12 +3177,12 @@ class Parser {
                # $args is a list of argument nodes, starting from index 0, not including $part1
                # @todo FIXME: If piece['parts'] is null then the call to getLength() below won't work b/c this $args isn't an object
                $args = ( null == $piece['parts'] ) ? array() : $piece['parts'];
-               wfProfileOut( __METHOD__.'-setup' );
+               wfProfileOut( __METHOD__ . '-setup' );
 
                $titleProfileIn = null; // profile templates
 
                # SUBST
-               wfProfileIn( __METHOD__.'-modifiers' );
+               wfProfileIn( __METHOD__ . '-modifiers' );
                if ( !$found ) {
 
                        $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 );
@@ -3240,7 +3239,7 @@ class Parser {
                                $forceRawInterwiki = true;
                        }
                }
-               wfProfileOut( __METHOD__.'-modifiers' );
+               wfProfileOut( __METHOD__ . '-modifiers' );
 
                # Parser functions
                if ( !$found ) {
@@ -3387,7 +3386,7 @@ class Parser {
                                        }
                                } elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
                                        $found = false; # access denied
-                                       wfDebug( __METHOD__.": template inclusion denied for " . $title->getPrefixedDBkey() );
+                                       wfDebug( __METHOD__ . ": template inclusion denied for " . $title->getPrefixedDBkey() );
                                } else {
                                        list( $text, $title ) = $this->getTemplateDom( $title );
                                        if ( $text !== false ) {
@@ -3422,7 +3421,7 @@ class Parser {
                                $text = '<span class="error">'
                                        . wfMessage( 'parser-template-loop-warning', $titleText )->inContentLanguage()->text()
                                        . '</span>';
-                               wfDebug( __METHOD__.": template loop broken at '$titleText'\n" );
+                               wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
                        wfProfileOut( __METHOD__ . '-loadtpl' );
                }
@@ -3898,7 +3897,7 @@ class Parser {
                } elseif ( $markerType === 'general' ) {
                        $this->mStripState->addGeneral( $marker, $output );
                } else {
-                       throw new MWException( __METHOD__.': invalid marker type' );
+                       throw new MWException( __METHOD__ . ': invalid marker type' );
                }
                return $marker;
        }
@@ -3997,7 +3996,7 @@ class Parser {
         */
        public function addTrackingCategory( $msg ) {
                if ( $this->mTitle->getNamespace() === NS_SPECIAL ) {
-                       wfDebug( __METHOD__.": Not adding tracking category $msg to special page!\n" );
+                       wfDebug( __METHOD__ . ": Not adding tracking category $msg to special page!\n" );
                        return false;
                }
                // Important to parse with correct title (bug 31469)
@@ -4016,7 +4015,7 @@ class Parser {
                        $this->mOutput->addCategory( $containerCategory->getDBkey(), $this->getDefaultSort() );
                        return true;
                } else {
-                       wfDebug( __METHOD__.": [[MediaWiki:$msg]] is not a valid title!\n" );
+                       wfDebug( __METHOD__ . ": [[MediaWiki:$msg]] is not a valid title!\n" );
                        return false;
                }
        }
@@ -4326,7 +4325,7 @@ class Parser {
                                // of data, but put the headline hint inside a content block because the language converter is supposed to
                                // be able to convert that piece of data.
                                $editlink = '<mw:editsection page="' . htmlspecialchars($editlinkArgs[0]);
-                               $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) .'"';
+                               $editlink .= '" section="' . htmlspecialchars($editlinkArgs[1]) . '"';
                                if ( isset($editlinkArgs[2]) ) {
                                        $editlink .= '>' . $editlinkArgs[2] . '</mw:editsection>';
                                } else {
@@ -4563,7 +4562,7 @@ class Parser {
                        } else {
                                # Failed to validate; fall back to the default
                                $nickname = $username;
-                               wfDebug( __METHOD__.": $username has bad XML tags in signature.\n" );
+                               wfDebug( __METHOD__ . ": $username has bad XML tags in signature.\n" );
                        }
                }
 
@@ -4824,7 +4823,7 @@ class Parser {
                # Add to function cache
                $mw = MagicWord::get( $id );
                if ( !$mw )
-                       throw new MWException( __METHOD__.'() expecting a magic word identifier.' );
+                       throw new MWException( __METHOD__ . '() expecting a magic word identifier.' );
 
                $synonyms = $mw->getSynonyms();
                $sensitive = intval( $mw->isCaseSensitive() );
@@ -4987,7 +4986,7 @@ class Parser {
                                        if ( $match = $magicWordAlt->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $alt = $this->stripAltText( $match, false );
                                        }
-                                       elseif( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ){
+                                       elseif( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $linkValue = strip_tags( $this->replaceLinkHoldersText( $match ) );
                                                $chars = self::EXT_LINK_URL_CLASS;
                                                $prots = $this->mUrlProtocols;
@@ -5010,7 +5009,7 @@ class Parser {
                                $label = substr( $label, 1 );
                        }
 
-                       $ig->add( $title, $label, $alt ,$link);
+                       $ig->add( $title, $label, $alt, $link );
                }
                return $ig->toHTML();
        }
@@ -5836,7 +5835,7 @@ class Parser {
         */
        function unserializeHalfParsedText( $data ) {
                if ( !isset( $data['version'] ) || $data['version'] != self::HALF_PARSED_VERSION ) {
-                       throw new MWException( __METHOD__.': invalid version' );
+                       throw new MWException( __METHOD__ . ': invalid version' );
                }
 
                # First, extract the strip state.
index 822b31b..f32d5b6 100644 (file)
@@ -390,7 +390,7 @@ class ParserOutput extends CacheTime {
                $this->mProperties[$name] = $value;
        }
 
-       public function getProperty( $name ){
+       public function getProperty( $name ) {
                return isset( $this->mProperties[$name] ) ? $this->mProperties[$name] : false;
        }
 
@@ -407,20 +407,20 @@ class ParserOutput extends CacheTime {
         * into account to produce this output or false if not available.
         * @return mixed Array
         */
-        public function getUsedOptions() {
+       public function getUsedOptions() {
                if ( !isset( $this->mAccessedOptions ) ) {
                        return array();
                }
                return array_keys( $this->mAccessedOptions );
-        }
+       }
 
-        /**
-         * Callback passed by the Parser to the ParserOptions to keep track of which options are used.
-         * @access private
-         */
-        function recordOption( $option ) {
-                $this->mAccessedOptions[$option] = true;
-        }
+       /**
+        * Callback passed by the Parser to the ParserOptions to keep track of which options are used.
+        * @access private
+        */
+       function recordOption( $option ) {
+               $this->mAccessedOptions[$option] = true;
+       }
 
        /**
         * Adds an update job to the output. Any update jobs added to the output will eventually bexecuted in order to
@@ -458,6 +458,6 @@ class ParserOutput extends CacheTime {
                $linksUpdate = new LinksUpdate( $title, $this, $recursive );
 
                return array_merge( $this->mSecondaryDataUpdates, array( $linksUpdate ) );
-        }
+       }
 
 }
index baffcd8..b30b031 100644 (file)
@@ -157,7 +157,7 @@ class Profiler {
         */
        public function profileIn( $functionname ) {
                global $wgDebugFunctionEntry;
-               if( $wgDebugFunctionEntry ){
+               if( $wgDebugFunctionEntry ) {
                        $this->debug( str_repeat( ' ', count( $this->mWorkStack ) ) . 'Entering ' . $functionname . "\n" );
                }
 
@@ -174,7 +174,7 @@ class Profiler {
                $memory = memory_get_usage();
                $time = $this->getTime();
 
-               if( $wgDebugFunctionEntry ){
+               if( $wgDebugFunctionEntry ) {
                        $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
                }
 
@@ -183,13 +183,13 @@ class Profiler {
                if (!$bit) {
                        $this->debug("Profiling error, !\$bit: $functionname\n");
                } else {
-                       //if( $wgDebugProfiling ){
-                               if( $functionname == 'close' ){
+                       //if( $wgDebugProfiling ) {
+                               if( $functionname == 'close' ) {
                                        $message = "Profile section ended by close(): {$bit[0]}";
                                        $this->debug( "$message\n" );
                                        $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
                                }
-                               elseif( $bit[0] != $functionname ){
+                               elseif( $bit[0] != $functionname ) {
                                        $message = "Profiling error: in({$bit[0]}), out($functionname)";
                                        $this->debug( "$message\n" );
                                        $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
@@ -205,7 +205,7 @@ class Profiler {
         * Close opened profiling sections
         */
        public function close() {
-               while( count( $this->mWorkStack ) ){
+               while( count( $this->mWorkStack ) ) {
                        $this->profileOut( 'close' );
                }
        }
@@ -228,7 +228,7 @@ class Profiler {
                global $wgDebugFunctionEntry, $wgProfileCallTree;
                $wgDebugFunctionEntry = false;
 
-               if( !count( $this->mStack ) && !count( $this->mCollated ) ){
+               if( !count( $this->mStack ) && !count( $this->mCollated ) ) {
                        return "No profiling output\n";
                }
 
@@ -254,16 +254,16 @@ class Profiler {
         * @return array
         */
        function remapCallTree( $stack ) {
-               if( count( $stack ) < 2 ){
+               if( count( $stack ) < 2 ) {
                        return $stack;
                }
                $outputs = array ();
-               for( $max = count( $stack ) - 1; $max > 0; ){
+               for( $max = count( $stack ) - 1; $max > 0; ) {
                        /* Find all items under this entry */
                        $level = $stack[$max][1];
                        $working = array ();
-                       for( $i = $max -1; $i >= 0; $i-- ){
-                               if( $stack[$i][1] > $level ){
+                       for( $i = $max -1; $i >= 0; $i-- ) {
+                               if( $stack[$i][1] > $level ) {
                                        $working[] = $stack[$i];
                                } else {
                                        break;
@@ -271,7 +271,7 @@ class Profiler {
                        }
                        $working = $this->remapCallTree( array_reverse( $working ) );
                        $output = array();
-                       foreach( $working as $item ){
+                       foreach( $working as $item ) {
                                array_push( $output, $item );
                        }
                        array_unshift( $output, $stack[$max] );
@@ -280,8 +280,8 @@ class Profiler {
                        array_unshift( $outputs, $output );
                }
                $final = array();
-               foreach( $outputs as $output ){
-                       foreach( $output as $item ){
+               foreach( $outputs as $output ) {
+                       foreach( $output as $item ) {
                                $final[] = $item;
                        }
                }
@@ -391,18 +391,18 @@ class Profiler {
 
                # First, subtract the overhead!
                $overheadTotal = $overheadMemory = $overheadInternal = array();
-               foreach( $this->mStack as $entry ){
+               foreach( $this->mStack as $entry ) {
                        $fname = $entry[0];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
                        $memory = $entry[5] - $entry[3];
 
-                       if( $fname == '-overhead-total' ){
+                       if( $fname == '-overhead-total' ) {
                                $overheadTotal[] = $elapsed;
                                $overheadMemory[] = $memory;
                        }
-                       elseif( $fname == '-overhead-internal' ){
+                       elseif( $fname == '-overhead-internal' ) {
                                $overheadInternal[] = $elapsed;
                        }
                }
@@ -411,7 +411,7 @@ class Profiler {
                $overheadInternal = $overheadInternal ? array_sum( $overheadInternal ) / count( $overheadInternal ) : 0;
 
                # Collate
-               foreach( $this->mStack as $index => $entry ){
+               foreach( $this->mStack as $index => $entry ) {
                        $fname = $entry[0];
                        $start = $entry[2];
                        $end = $entry[4];
@@ -420,7 +420,7 @@ class Profiler {
                        $memory = $entry[5] - $entry[3];
                        $subcalls = $this->calltreeCount( $this->mStack, $index );
 
-                       if( !preg_match( '/^-overhead/', $fname ) ){
+                       if( !preg_match( '/^-overhead/', $fname ) ) {
                                # Adjust for profiling overhead (except special values with elapsed=0
                                if( $elapsed ) {
                                        $elapsed -= $overheadInternal;
@@ -429,7 +429,7 @@ class Profiler {
                                }
                        }
 
-                       if( !array_key_exists( $fname, $this->mCollated ) ){
+                       if( !array_key_exists( $fname, $this->mCollated ) ) {
                                $this->mCollated[$fname] = 0;
                                $this->mCalls[$fname] = 0;
                                $this->mMemory[$fname] = 0;
@@ -467,11 +467,11 @@ class Profiler {
 
                $total = isset( $this->mCollated['-total'] ) ? $this->mCollated['-total'] : 0;
 
-               foreach( $this->mCollated as $fname => $elapsed ){
+               foreach( $this->mCollated as $fname => $elapsed ) {
                        $calls = $this->mCalls[$fname];
                        $percent = $total ? 100. * $elapsed / $total : 0;
                        $memory = $this->mMemory[$fname];
-                       $prof .= sprintf($format, substr($fname, 0, $nameWidth), $calls, (float) ($elapsed * 1000), (float) ($elapsed * 1000) / $calls, $percent, $memory, ($this->mMin[$fname] * 1000.0), ($this->mMax[$fname] * 1000.0), $this->mOverhead[$fname]);
+                       $prof .= sprintf( $format, substr( $fname, 0, $nameWidth ), $calls, (float) ($elapsed * 1000), (float) ($elapsed * 1000) / $calls, $percent, $memory, ( $this->mMin[$fname] * 1000.0 ), ( $this->mMax[$fname] * 1000.0 ), $this->mOverhead[$fname] );
                }
                $prof .= "\nTotal: $total\n\n";
 
@@ -483,7 +483,7 @@ class Profiler {
         */
        protected static function calculateOverhead( $profileCount ) {
                wfProfileIn( '-overhead-total' );
-               for( $i = 0; $i < $profileCount; $i++ ){
+               for( $i = 0; $i < $profileCount; $i++ ) {
                        wfProfileIn( '-overhead-internal' );
                        wfProfileOut( '-overhead-internal' );
                }
@@ -524,7 +524,7 @@ class Profiler {
                        return;
                }
 
-               if( $wgProfilePerHost ){
+               if( $wgProfilePerHost ) {
                        $pfhost = wfHostname();
                } else {
                        $pfhost = '';
@@ -533,7 +533,7 @@ class Profiler {
                try {
                        $this->collateData();
 
-                       foreach( $this->mCollated as $name => $elapsed ){
+                       foreach( $this->mCollated as $name => $elapsed ) {
                                $eventCount = $this->mCalls[$name];
                                $timeSum = (float) ($elapsed * 1000);
                                $memorySum = (float)$this->mMemory[$name];