Stylize Api upto date
authorSam Reed <reedy@users.mediawiki.org>
Sat, 17 Apr 2010 20:58:04 +0000 (20:58 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 17 Apr 2010 20:58:04 +0000 (20:58 +0000)
includes/api/ApiBase.php
includes/api/ApiEmailUser.php
includes/api/ApiFormatYaml_spyc.php
includes/api/ApiMain.php
includes/api/ApiPageSet.php
includes/api/ApiParse.php
includes/api/ApiQueryAllmessages.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiRollback.php
includes/api/ApiUpload.php

index f195abd..d4587d7 100644 (file)
@@ -475,7 +475,7 @@ abstract class ApiBase {
                $params = $this->getFinalParams();
                $results = array();
 
-               if( $params ) { // getFinalParams() can return false
+               if ( $params ) { // getFinalParams() can return false
                        foreach ( $params as $paramName => $paramSettings ) {
                                $results[$paramName] = $this->getParameterFromSettings( $paramName, $paramSettings, $parseLimit );
                        }
@@ -559,7 +559,7 @@ abstract class ApiBase {
                                }
                                # If no user option was passed, use watchdefault or watchcreation
                                if ( is_null( $userOption ) ) {
-                                       $userOption = $titleObj->exists() 
+                                       $userOption = $titleObj->exists()
                                                ? 'watchdefault' : 'watchcreations';
                                }
                                # If the corresponding user option is true, watch, else no change
@@ -581,7 +581,7 @@ abstract class ApiBase {
         */
        protected function setWatch ( $watch, $titleObj, $userOption = null ) {
                $value = $this->getWatchlistValue( $watch, $titleObj, $userOption );
-               if( $value === null ) { 
+               if ( $value === null ) {
                        return;
                }
 
@@ -705,9 +705,9 @@ abstract class ApiBase {
                                                $value = wfTimestamp( TS_MW, $value );
                                                break;
                                        case 'user':
-                                               if( !is_array( $value ) ) $value = array( $value );
+                                               if ( !is_array( $value ) ) $value = array( $value );
                                                
-                                               foreach( $value as $key => $val ) {
+                                               foreach ( $value as $key => $val ) {
                                                        $title = Title::makeTitleSafe( NS_USER, $val );
                                                        if ( is_null( $title ) ) {
                                                                $this->dieUsage( "Invalid value for user parameter $encParamName", "baduser_{$encParamName}" );
@@ -715,7 +715,7 @@ abstract class ApiBase {
                                                        $value[$key] = $title->getText();
                                                }
                                                
-                                               if( !$multi ) $value = $value[0];
+                                               if ( !$multi ) $value = $value[0];
                                                
                                                break;
                                        default:
index 64a2c35..c1e5834 100644 (file)
@@ -61,9 +61,9 @@ class ApiEmailUser extends ApiBase {
                }
 
                $data = array(
-                       'Target' => $targetUser->getName(), 
-                       'Text' => $params['text'], 
-                       'Subject' => $params['subject'], 
+                       'Target' => $targetUser->getName(),
+                       'Text' => $params['text'],
+                       'Subject' => $params['subject'],
                        'CCMe' => $params['ccme'],
                );
                $retval = SpecialEmailuser::submit( $data );
index 30f860d..1fe6a2a 100644 (file)
@@ -185,7 +185,7 @@ class Spyc {
                        else
                                $string = $spaces . "-\n";
                } else {
-                        if ($key == '*') //bug 21922 - Quote asterix used as keys
+                        if ( $key == '*' ) // bug 21922 - Quote asterix used as keys
                                $key = "'*'";
                
                        // It's mapped
index 419c220..edfd2d3 100644 (file)
@@ -168,7 +168,7 @@ class ApiMain extends ApiBase {
 
                $this->mRequest = &$request;
 
-               $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
+               $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()
                $this->mCommit = false;
        }
 
@@ -451,7 +451,7 @@ class ApiMain extends ApiBase {
         * @param $params Array an array containing the request parameters.
         * @return boolean True on success, false should exit immediately
         */
-       protected function checkMaxLag($module, $params) {
+       protected function checkMaxLag( $module, $params ) {
                if ( $module->shouldCheckMaxlag() && isset( $params['maxlag'] ) ) {
                        // Check for maxlag
                        global $wgShowHostnames;
@@ -476,7 +476,7 @@ class ApiMain extends ApiBase {
         * Check for sufficient permissions to execute
         * @param $module object An Api module
         */
-       protected function checkExecutePermissions($module) {
+       protected function checkExecutePermissions( $module ) {
                global $wgUser, $wgGroupPermissions;
                if ( $module->isReadMode() && !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) )
                {
@@ -500,7 +500,7 @@ class ApiMain extends ApiBase {
         * @param $module object An Api module
         * @param $params Array an array with the request parameters
         */
-       protected function setupExternalResponse($module, $params) {
+       protected function setupExternalResponse( $module, $params ) {
                // Ignore mustBePosted() for internal calls
                if ( $module->mustBePosted() && !$this->mRequest->wasPosted() ) {
                        $this->dieUsageMsg( array( 'mustbeposted', $this->mAction ) );
@@ -525,12 +525,12 @@ class ApiMain extends ApiBase {
                $params = $this->setupExecuteAction();
                $module = $this->setupModule();
 
-               $this->checkExecutePermissions($module);
+               $this->checkExecutePermissions( $module );
 
-               if(!$this->checkMaxLag($module, $params)) return;
+               if ( !$this->checkMaxLag( $module, $params ) ) return;
 
                if ( !$this->mInternalMode ) {
-                       $this->setupExternalResponse($module, $params);
+                       $this->setupExternalResponse( $module, $params );
                }
 
                // Execute
index fee4750..7010d8f 100644 (file)
@@ -79,7 +79,7 @@ class ApiPageSet extends ApiQueryBase {
                        $this->mPendingRedirectIDs = array();
                }
 
-               $this->mFakePageId = -1;
+               $this->mFakePageId = - 1;
        }
 
        /**
index ab1d627..5618f97 100644 (file)
@@ -54,10 +54,10 @@ class ApiParse extends ApiBase {
                // $title parameter in Parser::parse isn't enough *sigh*
                global $wgParser, $wgUser, $wgTitle, $wgEnableParserCache, $wgLang;
                
-               //Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks
+               // Current unncessary, code to act as a safeguard against any change in current behaviour of uselang breaks
                $oldLang = null;
                if ( isset( $params['uselang'] ) && $params['uselang'] != $wgLang->getCode() ) {
-                       $oldLang = $wgLang; //Backup wgLang
+                       $oldLang = $wgLang; // Backup wgLang
                        $wgLang = Language::factory( $params['uselang'] );
                }
                
@@ -214,7 +214,7 @@ class ApiParse extends ApiBase {
                $result->addValue( null, $this->getModuleName(), $result_array );
                
                if ( !is_null( $oldLang ) ) {
-                       $wgLang = $oldLang; //Reset $wgLang to $oldLang
+                       $wgLang = $oldLang; // Reset $wgLang to $oldLang
                }
        }
 
index a815169..82d4f10 100644 (file)
@@ -46,7 +46,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
                
                $oldLang = null;
                if ( !is_null( $params['lang'] ) && $params['lang'] != $wgLang->getCode() ) {
-                       $oldLang = $wgLang; //Keep $wgLang for restore later
+                       $oldLang = $wgLang; // Keep $wgLang for restore later
                        $wgLang = Language::factory( $params['lang'] );
                }
 
@@ -125,7 +125,7 @@ class ApiQueryAllmessages extends ApiQueryBase {
                $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'message' );
                
                if ( !is_null( $oldLang ) ) {
-                       $wgLang = $oldLang; //Restore $oldLang
+                       $wgLang = $oldLang; // Restore $oldLang
                }
        }
 
index b4a3b1b..a90969d 100644 (file)
@@ -246,7 +246,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                                        if ( $this->hasNS ) {
                                                $parentID = $this->pageMap[$row-> { $this->bl_ns } ][$row-> { $this->bl_title } ];
                                        } else {
-                                               $parentID = $this->pageMap[NS_IMAGE][$row->{$this->bl_title}];
+                                               $parentID = $this->pageMap[NS_IMAGE][$row-> { $this->bl_title } ];
                                        }
                                        $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id );
                                        break;
index 5f0d2bd..84e3616 100644 (file)
@@ -288,11 +288,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        ),
                        'urlwidth' => array(
                                ApiBase::PARAM_TYPE => 'integer',
-                               ApiBase::PARAM_DFLT => -1
+                               ApiBase::PARAM_DFLT => - 1
                        ),
                        'urlheight' => array(
                                ApiBase::PARAM_TYPE => 'integer',
-                               ApiBase::PARAM_DFLT => -1
+                               ApiBase::PARAM_DFLT => - 1
                        ),
                        'continue' => null,
                );
index 27ce389..2301e3a 100644 (file)
@@ -155,7 +155,7 @@ class ApiRollback extends ApiBase {
 
                $params = $this->extractRequestParams();
                if ( !isset( $params['title'] ) ) {
-                       $this->dieUsageMsg( array( 'missingparam', 'title' ) ); 
+                       $this->dieUsageMsg( array( 'missingparam', 'title' ) );
                }
 
                $this->mTitleObj = Title::newFromText( $params['title'] );
index 054b79b..6d02fa3 100644 (file)
@@ -241,7 +241,7 @@ class ApiUpload extends ApiBase {
                $this->verifyUpload();
 
                $warnings = $this->checkForWarnings();
-               if( isset($warnings) ) return $warnings;
+               if ( isset( $warnings ) ) return $warnings;
 
                // Use comment as initial page text by default
                if ( is_null( $this->mParams['text'] ) ) {