From 0769301e8706f9f44e8efc6c686c425562b3f3fc Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sat, 17 Apr 2010 20:58:04 +0000 Subject: [PATCH] Stylize Api upto date --- includes/api/ApiBase.php | 12 ++++++------ includes/api/ApiEmailUser.php | 6 +++--- includes/api/ApiFormatYaml_spyc.php | 2 +- includes/api/ApiMain.php | 14 +++++++------- includes/api/ApiPageSet.php | 2 +- includes/api/ApiParse.php | 6 +++--- includes/api/ApiQueryAllmessages.php | 4 ++-- includes/api/ApiQueryBacklinks.php | 2 +- includes/api/ApiQueryImageInfo.php | 4 ++-- includes/api/ApiRollback.php | 2 +- includes/api/ApiUpload.php | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index f195abd998..d4587d7354 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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: diff --git a/includes/api/ApiEmailUser.php b/includes/api/ApiEmailUser.php index 64a2c3556c..c1e5834c93 100644 --- a/includes/api/ApiEmailUser.php +++ b/includes/api/ApiEmailUser.php @@ -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 ); diff --git a/includes/api/ApiFormatYaml_spyc.php b/includes/api/ApiFormatYaml_spyc.php index 30f860dd4a..1fe6a2adf3 100644 --- a/includes/api/ApiFormatYaml_spyc.php +++ b/includes/api/ApiFormatYaml_spyc.php @@ -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 diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 419c22065d..edfd2d36b6 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -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 diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index fee47502db..7010d8fed5 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -79,7 +79,7 @@ class ApiPageSet extends ApiQueryBase { $this->mPendingRedirectIDs = array(); } - $this->mFakePageId = -1; + $this->mFakePageId = - 1; } /** diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index ab1d627af2..5618f97210 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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 } } diff --git a/includes/api/ApiQueryAllmessages.php b/includes/api/ApiQueryAllmessages.php index a8151697f0..82d4f10b8f 100644 --- a/includes/api/ApiQueryAllmessages.php +++ b/includes/api/ApiQueryAllmessages.php @@ -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 } } diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index b4a3b1bc05..a90969d783 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -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; diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 5f0d2bd609..84e3616700 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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, ); diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php index 27ce389a4d..2301e3adfe 100644 --- a/includes/api/ApiRollback.php +++ b/includes/api/ApiRollback.php @@ -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'] ); diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index 054b79b714..6d02fa3544 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -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'] ) ) { -- 2.20.1