Minor cleanup
authorYuri Astrakhan <yuriastrakhan@gmail.com>
Sat, 12 Jan 2013 06:50:48 +0000 (01:50 -0500)
committerYuri Astrakhan <yuriastrakhan@gmail.com>
Sat, 12 Jan 2013 06:50:48 +0000 (01:50 -0500)
Fixed spacing, eol chars, "string" --> 'string'

Change-Id: I630247c6c5b469efb67ec9de32e8533ae88e59fb

17 files changed:
includes/api/ApiBase.php
includes/api/ApiEditPage.php
includes/api/ApiFeedContributions.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiMain.php
includes/api/ApiMove.php
includes/api/ApiParse.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllMessages.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQuerySearch.php
includes/api/ApiQueryUsers.php
includes/api/ApiQueryWatchlist.php

index 1b176e7..0a3edb9 100644 (file)
@@ -340,13 +340,15 @@ abstract class ApiBase extends ContextSource {
                        return '';
                }
                if ( !is_array( $input ) ) {
-                       $input = array(
-                               $input
-                       );
+                       $input = array( $input );
                }
 
                if ( count( $input ) > 0 ) {
-                       $msg = $title . ( count( $input ) > 1 ? 's' : '' ) . ":\n  ";
+                       if ( $title ) {
+                               $msg = $title . ( count( $input ) > 1 ? 's' : '' ) . ":\n  ";
+                       } else {
+                               $msg = '  ';
+                       }
                        $msg .= implode( $prefix, $input ) . "\n";
                        return $msg;
                }
index cae4a21..b1066cc 100644 (file)
@@ -68,12 +68,12 @@ class ApiEditPage extends ApiBase {
                                $redirValues = array();
                                foreach ( $titles as $id => $newTitle ) {
 
-                                       if ( !isset( $titles[ $id - 1 ] ) ) {
-                                               $titles[ $id - 1 ] = $oldTitle;
+                                       if ( !isset( $titles[$id - 1] ) ) {
+                                               $titles[$id - 1] = $oldTitle;
                                        }
 
                                        $redirValues[] = array(
-                                               'from' => $titles[ $id - 1 ]->getPrefixedText(),
+                                               'from' => $titles[$id - 1]->getPrefixedText(),
                                                'to' => $newTitle->getPrefixedText()
                                        );
 
index fb6a06f..15a377c 100644 (file)
@@ -51,7 +51,7 @@ class ApiFeedContributions extends ApiBase {
                        $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                }
 
-               if( !isset( $wgFeedClasses[ $params['feedformat'] ] ) ) {
+               if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                        $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                }
 
index 6ccb02f..373abdb 100644 (file)
@@ -62,7 +62,7 @@ class ApiFeedWatchlist extends ApiBase {
                                $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                        }
 
-                       if( !isset( $wgFeedClasses[ $params['feedformat'] ] ) ) {
+                       if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                                $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                        }
                        if ( !is_null( $params['wlexcludeuser'] ) ) {
index 135e0bd..57ccc7a 100644 (file)
@@ -876,7 +876,7 @@ class ApiMain extends ApiBase {
                if ( !$table ) {
                        $chars = ';@$!*(),/:';
                        for ( $i = 0; $i < strlen( $chars ); $i++ ) {
-                               $table[ rawurlencode( $chars[$i] ) ] = $chars[$i];
+                               $table[rawurlencode( $chars[$i] )] = $chars[$i];
                        }
                }
                return strtr( rawurlencode( $s ), $table );
@@ -1140,6 +1140,7 @@ class ApiMain extends ApiBase {
                foreach ( array_keys( $this->mModules ) as $moduleName ) {
                        $module = new $this->mModules[$moduleName] ( $this, $moduleName );
                        $msg .= self::makeHelpMsgHeader( $module, 'action' );
+
                        $msg2 = $module->makeHelpMsg();
                        if ( $msg2 !== false ) {
                                $msg .= $msg2;
@@ -1150,9 +1151,8 @@ class ApiMain extends ApiBase {
                $msg .= "\n$astriks Permissions $astriks\n\n";
                foreach ( self::$mRights as $right => $rightMsg ) {
                        $groups = User::getGroupsWithPermission( $right );
-                       $msg .= "* " . $right . " *\n  " . wfMsgReplaceArgs( $rightMsg[ 'msg' ], $rightMsg[ 'params' ] ) .
+                       $msg .= "* " . $right . " *\n  " . wfMsgReplaceArgs( $rightMsg['msg'], $rightMsg['params'] ) .
                                                "\nGranted to:\n  " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n";
-
                }
 
                $msg .= "\n$astriks Formats  $astriks\n\n";
index 6c53e99..9b70b56 100644 (file)
@@ -129,7 +129,7 @@ class ApiMove extends ApiBase {
                        }
                }
 
-               $watch = "preferences";
+               $watch = 'preferences';
                if ( isset( $params['watchlist'] ) ) {
                        $watch = $params['watchlist'];
                } elseif ( $params['watch'] ) {
index 08764a5..94b4a8b 100644 (file)
@@ -450,14 +450,14 @@ class ApiParse extends ApiBase {
                        $text = Language::fetchLanguageName( $nt->getInterwiki() );
 
                        $langs[] = Html::element( 'a',
-                               array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
+                               array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => 'external' ),
                                $text == '' ? $l : $text );
                }
 
                $s .= implode( wfMessage( 'pipe-separator' )->escaped(), $langs );
 
                if ( $wgContLang->isRTL() ) {
-                       $s = Html::rawElement( 'span', array( 'dir' => "LTR" ), $s );
+                       $s = Html::rawElement( 'span', array( 'dir' => 'LTR' ), $s );
                }
 
                return $s;
index b37dbbf..3b478b0 100644 (file)
@@ -159,7 +159,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                                if ( $params['unique'] ) {
                                        $this->setContinueEnumParameter( 'continue', $row->pl_title );
                                } else {
-                                       $this->setContinueEnumParameter( 'continue', $row->pl_title . "|" . $row->pl_from );
+                                       $this->setContinueEnumParameter( 'continue', $row->pl_title . '|' . $row->pl_from );
                                }
                                break;
                        }
@@ -178,7 +178,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                                        if ( $params['unique'] ) {
                                                $this->setContinueEnumParameter( 'continue', $row->pl_title );
                                        } else {
-                                               $this->setContinueEnumParameter( 'continue', $row->pl_title . "|" . $row->pl_from );
+                                               $this->setContinueEnumParameter( 'continue', $row->pl_title . '|' . $row->pl_from );
                                        }
                                        break;
                                }
index f5e1146..9fd2db8 100644 (file)
@@ -143,7 +143,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
                                }
 
                                if ( $customiseFilterEnabled ) {
-                                       $messageIsCustomised = isset( $customisedMessages['pages'][ $langObj->ucfirst( $message ) ] );
+                                       $messageIsCustomised = isset( $customisedMessages['pages'][$langObj->ucfirst( $message )] );
                                        if ( $customised === $messageIsCustomised ) {
                                                if ( $customised ) {
                                                        $a['customised'] = '';
index 06db87b..6f45726 100644 (file)
@@ -455,12 +455,12 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_TYPE => 'namespace'
                        ),
-                       'dir' => array(\r
-                               ApiBase::PARAM_DFLT => 'ascending',\r
-                               ApiBase::PARAM_TYPE => array(\r
-                                       'ascending',\r
-                                       'descending'\r
-                               )\r
+                       'dir' => array(
+                               ApiBase::PARAM_DFLT => 'ascending',
+                               ApiBase::PARAM_TYPE => array(
+                                       'ascending',
+                                       'descending'
+                               )
                        ),
                        'filterredir' => array(
                                ApiBase::PARAM_DFLT => 'all',
index 55ce023..a07b049 100644 (file)
@@ -118,7 +118,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
 
                                // Add a WHERE clause for sortkey and from
                                // pack( "H*", $foo ) is used to convert hex back to binary
-                               $escSortkey = $this->getDB()->addQuotes( pack( "H*", $cont[1] ) );
+                               $escSortkey = $this->getDB()->addQuotes( pack( 'H*', $cont[1] ) );
                                $from = intval( $cont[2] );
                                $op = $dir == 'newer' ? '>' : '<';
                                // $contWhere is used further down
index 2be3393..0a0b5dd 100644 (file)
@@ -87,7 +87,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                }
 
                                $start = $skip ? $fromTimestamp : $params['start'];
-                               $pageId = $pageIds[NS_FILE][ $img->getTitle()->getDBkey() ];
+                               $pageId = $pageIds[NS_FILE][$img->getTitle()->getDBkey()];
 
                                $fit = $result->addValue(
                                        array( 'query', 'pages', intval( $pageId ) ),
index e5cea96..dd1326b 100644 (file)
@@ -118,11 +118,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'edit' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'edit' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['edit'] ) ) {
+                       ApiQueryInfo::$cachedTokens['edit'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'edit' ];
+               return ApiQueryInfo::$cachedTokens['edit'];
        }
 
        public static function getDeleteToken( $pageid, $title ) {
@@ -132,11 +132,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'delete' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'delete' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['delete'] ) ) {
+                       ApiQueryInfo::$cachedTokens['delete'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'delete' ];
+               return ApiQueryInfo::$cachedTokens['delete'];
        }
 
        public static function getProtectToken( $pageid, $title ) {
@@ -146,11 +146,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'protect' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'protect' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['protect'] ) ) {
+                       ApiQueryInfo::$cachedTokens['protect'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'protect' ];
+               return ApiQueryInfo::$cachedTokens['protect'];
        }
 
        public static function getMoveToken( $pageid, $title ) {
@@ -160,11 +160,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'move' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'move' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['move'] ) ) {
+                       ApiQueryInfo::$cachedTokens['move'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'move' ];
+               return ApiQueryInfo::$cachedTokens['move'];
        }
 
        public static function getBlockToken( $pageid, $title ) {
@@ -174,11 +174,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'block' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'block' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['block'] ) ) {
+                       ApiQueryInfo::$cachedTokens['block'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'block' ];
+               return ApiQueryInfo::$cachedTokens['block'];
        }
 
        public static function getUnblockToken( $pageid, $title ) {
@@ -193,11 +193,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'email' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'email' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['email'] ) ) {
+                       ApiQueryInfo::$cachedTokens['email'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'email' ];
+               return ApiQueryInfo::$cachedTokens['email'];
        }
 
        public static function getImportToken( $pageid, $title ) {
@@ -207,11 +207,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'import' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'import' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['import'] ) ) {
+                       ApiQueryInfo::$cachedTokens['import'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'import' ];
+               return ApiQueryInfo::$cachedTokens['import'];
        }
 
        public static function getWatchToken( $pageid, $title ) {
@@ -221,11 +221,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'watch' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'watch' ] = $wgUser->getEditToken( 'watch' );
+               if ( !isset( ApiQueryInfo::$cachedTokens['watch'] ) ) {
+                       ApiQueryInfo::$cachedTokens['watch'] = $wgUser->getEditToken( 'watch' );
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'watch' ];
+               return ApiQueryInfo::$cachedTokens['watch'];
        }
 
        public static function getOptionsToken( $pageid, $title ) {
@@ -235,11 +235,11 @@ class ApiQueryInfo extends ApiQueryBase {
                }
 
                // The token is always the same, let's exploit that
-               if ( !isset( ApiQueryInfo::$cachedTokens[ 'options' ] ) ) {
-                       ApiQueryInfo::$cachedTokens[ 'options' ] = $wgUser->getEditToken();
+               if ( !isset( ApiQueryInfo::$cachedTokens['options'] ) ) {
+                       ApiQueryInfo::$cachedTokens['options'] = $wgUser->getEditToken();
                }
 
-               return ApiQueryInfo::$cachedTokens[ 'options' ];
+               return ApiQueryInfo::$cachedTokens['options'];
        }
 
        public function execute() {
@@ -349,7 +349,7 @@ class ApiQueryInfo extends ApiQueryBase {
                        $pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
                        $pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
                        $pageInfo['counter'] = $wgDisableCounters
-                               ? ""
+                               ? ''
                                : intval( $this->pageCounter[$pageid] );
                        $pageInfo['length'] = intval( $this->pageLength[$pageid] );
 
index caed635..b2eebfb 100644 (file)
@@ -70,7 +70,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        'user' => array( 'JOIN',
                                'user_id=log_user' ),
                        'page' => array( 'LEFT JOIN',
-                               array(  'log_namespace=page_namespace',
+                               array( 'log_namespace=page_namespace',
                                        'log_title=page_title' ) ) ) );
                $index = array( 'logging' => 'times' ); // default, may change
 
@@ -209,15 +209,15 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                        $noredirKey = '5::noredir';
                                }
 
-                               if ( isset( $params[ $targetKey ] ) ) {
-                                       $title = Title::newFromText( $params[ $targetKey ] );
+                               if ( isset( $params[$targetKey] ) ) {
+                                       $title = Title::newFromText( $params[$targetKey] );
                                        if ( $title ) {
                                                $vals2 = array();
                                                ApiQueryBase::addTitleInfo( $vals2, $title, 'new_' );
                                                $vals[$type] = $vals2;
                                        }
                                }
-                               if ( isset( $params[ $noredirKey ] ) && $params[ $noredirKey ] ) {
+                               if ( isset( $params[$noredirKey] ) && $params[$noredirKey] ) {
                                        $vals[$type]['suppressedredirect'] = '';
                                }
                                $params = null;
index cfd08a8..a0a0fbe 100644 (file)
@@ -168,7 +168,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                        }
                                }
                                if ( isset( $prop['hasrelated'] ) && $result->hasRelated() ) {
-                                       $vals['hasrelated'] = "";
+                                       $vals['hasrelated'] = '';
                                }
 
                                // Add item to results and see whether it fits
index edcbc1a..e569018 100644 (file)
@@ -124,7 +124,7 @@ class ApiQueryUsers extends ApiQueryBase {
                                $this->addWhereFld( 'user_name', $goodNames );
                                $this->addTables( 'user_groups' );
                                $this->addJoinConds( array( 'user_groups' => array( 'INNER JOIN', 'ug_user=user_id' ) ) );
-                               $this->addFields( array('user_name', 'ug_group') );
+                               $this->addFields( array( 'user_name', 'ug_group' ) );
                                $userGroupsRes = $this->select( __METHOD__ );
 
                                foreach( $userGroupsRes as $row ) {
index a1a3372..22d98b7 100644 (file)
@@ -116,7 +116,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                ) );
 
                $userId = $user->getId();
-               $this->addJoinConds( array( 'watchlist' => array('INNER JOIN',
+               $this->addJoinConds( array( 'watchlist' => array( 'INNER JOIN',
                        array(
                                'wl_user' => $userId,
                                'wl_namespace=rc_namespace',