Stylize API
authorSam Reed <reedy@users.mediawiki.org>
Tue, 6 Jul 2010 13:15:59 +0000 (13:15 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Tue, 6 Jul 2010 13:15:59 +0000 (13:15 +0000)
Add a few braces

includes/api/ApiBase.php
includes/api/ApiEditPage.php
includes/api/ApiParse.php
includes/api/ApiQueryFilearchive.php
includes/api/ApiQueryIWBacklinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiUpload.php

index 6023169..0d3d261 100644 (file)
@@ -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" ),
index 14b16d8..93da4a6 100644 (file)
@@ -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
index 2f61c48..1396c66 100644 (file)
@@ -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' ),
                ) );
        }
index dfacecd..1d4590e 100644 (file)
@@ -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 ) {
index 9ff1120..ad4e7c1 100644 (file)
@@ -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"',
index ac24d98..17cb2fa 100644 (file)
@@ -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() );
                                        }
                                        
index 82d8c02..9209789 100644 (file)
@@ -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 );
                }
 
index f92407e..0064e16 100644 (file)
@@ -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 );
                }
 
index cdc03c6..f3c3e4e 100644 (file)
@@ -99,7 +99,7 @@ class ApiUpload extends ApiBase {
                                                $this->mParams['comment'],
                                                $this->mParams['watchlist'],
                                                $this->mParams['ignorewarnings'],
-                                               $async);
+                                               $async );
 
                                $this->checkPermissions( $wgUser );
                                if ( $async ) {