From: Sam Reed Date: Tue, 6 Jul 2010 13:15:59 +0000 (+0000) Subject: Stylize API X-Git-Tag: 1.31.0-rc.0~36245 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=f5c639fd103ffa39d72c0172c346b2727a88a8ec;p=lhc%2Fweb%2Fwiklou.git Stylize API Add a few braces --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 60231693e6..0d3d2614f2 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -317,12 +317,13 @@ abstract class ApiBase { if ( is_array( $type ) ) { $choices = array(); $nothingPrompt = false; - foreach ( $type as $t ) + foreach ( $type as $t ) { if ( $t === '' ) { $nothingPrompt = 'Can be empty, or '; } else { $choices[] = $t; } + } $desc .= $paramPrefix . $nothingPrompt . $prompt . implode( ', ', $choices ); } else { switch ( $type ) { @@ -711,8 +712,10 @@ 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 ) { $title = Title::makeTitleSafe( NS_USER, $val ); if ( is_null( $title ) ) { @@ -721,9 +724,10 @@ abstract class ApiBase { $value[$key] = $title->getText(); } - if ( !$multi ) $value = $value[0]; - - break; + if ( !$multi ) { + $value = $value[0]; + } + break; default: ApiBase::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" ); } @@ -928,7 +932,7 @@ abstract class ApiBase { 'userrights-nodatabase' => array( 'code' => 'nosuchdatabase', 'info' => "Database ``\$1'' does not exist or is not local" ), 'nouserspecified' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ), 'noname' => array( 'code' => 'invaliduser', 'info' => "Invalid username ``\$1''" ), - 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required'), + 'summaryrequired' => array( 'code' => 'summaryrequired', 'info' => 'Summary required' ), // API-specific messages 'readrequired' => array( 'code' => 'readapidenied', 'info' => "You need read permission to use this module" ), diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 14b16d852e..93da4a67ad 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -299,6 +299,7 @@ class ApiEditPage extends ApiBase { case EditPage::AS_SUCCESS_NEW_ARTICLE: $r['new'] = ''; + case EditPage::AS_SUCCESS_UPDATE: $r['result'] = 'Success'; $r['pageid'] = intval( $titleObj->getArticleID() ); @@ -326,7 +327,7 @@ class ApiEditPage extends ApiBase { // This usually means some kind of race condition // or DB weirdness occurred. if ( is_array( $result ) && count( $result ) > 0 ) { - $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) ); + $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) ); } // Unknown error, but no specific error message diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index 2f61c4809e..1396c66d4d 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -452,7 +452,7 @@ class ApiParse extends ApiBase { array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ), array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revisions' ), array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ), - array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page'), + array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ), array( 'nosuchpageid' ), ) ); } diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index dfacecda1a..1d4590e349 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -147,13 +147,13 @@ class ApiQueryFilearchive extends ApiQueryBase { $file['height'] = $row->fa_height; $file['width'] = $row->fa_width; } - if ( $fld_description ){ + if ( $fld_description ) { $file['description'] = $row->fa_description; } - if ( $fld_metadata ){ + if ( $fld_metadata ) { $file['metadata'] = $row->fa_metadata ? ApiQueryImageInfo::processMetaData( unserialize( $row->fa_metadata ), $result ) : null; } - if ( $fld_bitdepth ){ + if ( $fld_bitdepth ) { $file['bitdepth'] = $row->fa_bits; } if ( $fld_mime ) { diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index 9ff1120c41..ad4e7c1b42 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -143,7 +143,7 @@ class ApiQueryIWBacklinks extends ApiQueryBase { } public function getDescription() { - return array('Find all pages that link to the given interwiki link.', + return array( 'Find all pages that link to the given interwiki link.', 'Can be used to find all links with a prefix, or', 'all links to a title (any prefix).', 'Using neither parameter is effectively "All IW Links"', diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index ac24d98076..17cb2facbd 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -213,13 +213,13 @@ class ApiQueryImageInfo extends ApiQueryBase { if ( $mto && !$mto->isError() ) { $vals['thumburl'] = wfExpandUrl( $mto->getUrl() ); - //bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted - //thumbnail sizes for the thumbnail actual size + // bug 23834 - If the URL's are the same, we haven't resized it, so shouldn't give the wanted + // thumbnail sizes for the thumbnail actual size if ( $mto->getUrl() !== $file->getUrl() ) { - $vals['thumbwidth'] = intval( $mto->getWidth() ); + $vals['thumbwidth'] = intval( $mto->getWidth() ); $vals['thumbheight'] = intval( $mto->getHeight() ); } else { - $vals['thumbwidth'] = intval( $file->getWidth() ); + $vals['thumbwidth'] = intval( $file->getWidth() ); $vals['thumbheight'] = intval( $file->getHeight() ); } diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 82d8c02de0..9209789256 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -231,7 +231,7 @@ class ApiQueryLogEvents extends ApiQueryBase { $vals['pageid'] = intval( $row->page_id ); } - if( $this->fld_title || $this->fld_parsedcomment ) { + if ( $this->fld_title || $this->fld_parsedcomment ) { $title = Title::makeTitle( $row->log_namespace, $row->log_title ); } diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index f92407e339..0064e16f01 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -258,8 +258,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { } if ( $this->fld_notificationtimestamp ) { - $vals['notificationtimestamp'] = ( $row->wl_notificationtimestamp == null ) - ? '' + $vals['notificationtimestamp'] = ( $row->wl_notificationtimestamp == null ) + ? '' : wfTimestamp( TS_ISO_8601, $row->wl_notificationtimestamp ); } diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php index cdc03c6e0c..f3c3e4e9e6 100644 --- a/includes/api/ApiUpload.php +++ b/includes/api/ApiUpload.php @@ -99,7 +99,7 @@ class ApiUpload extends ApiBase { $this->mParams['comment'], $this->mParams['watchlist'], $this->mParams['ignorewarnings'], - $async); + $async ); $this->checkPermissions( $wgUser ); if ( $async ) {