http://www.mediawiki.org/wiki/Special:Code/MediaWiki/69091

Revision: 69091
Author:   reedy
Date:     2010-07-06 13:15:59 +0000 (Tue, 06 Jul 2010)

Log Message:
-----------
Stylize API

Add a few braces

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiBase.php
    trunk/phase3/includes/api/ApiEditPage.php
    trunk/phase3/includes/api/ApiParse.php
    trunk/phase3/includes/api/ApiQueryFilearchive.php
    trunk/phase3/includes/api/ApiQueryIWBacklinks.php
    trunk/phase3/includes/api/ApiQueryImageInfo.php
    trunk/phase3/includes/api/ApiQueryLogEvents.php
    trunk/phase3/includes/api/ApiQueryWatchlist.php
    trunk/phase3/includes/api/ApiUpload.php

Modified: trunk/phase3/includes/api/ApiBase.php
===================================================================
--- trunk/phase3/includes/api/ApiBase.php       2010-07-06 11:34:15 UTC (rev 
69090)
+++ trunk/phase3/includes/api/ApiBase.php       2010-07-06 13:15:59 UTC (rev 
69091)
@@ -317,12 +317,13 @@
                                        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 @@
                                                $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 @@
                                                        $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 @@
                '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" ),

Modified: trunk/phase3/includes/api/ApiEditPage.php
===================================================================
--- trunk/phase3/includes/api/ApiEditPage.php   2010-07-06 11:34:15 UTC (rev 
69090)
+++ trunk/phase3/includes/api/ApiEditPage.php   2010-07-06 13:15:59 UTC (rev 
69091)
@@ -299,6 +299,7 @@
 
                        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 @@
                                // 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

Modified: trunk/phase3/includes/api/ApiParse.php
===================================================================
--- trunk/phase3/includes/api/ApiParse.php      2010-07-06 11:34:15 UTC (rev 
69090)
+++ trunk/phase3/includes/api/ApiParse.php      2010-07-06 13:15:59 UTC (rev 
69091)
@@ -452,7 +452,7 @@
                        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' ),
                ) );
        }

Modified: trunk/phase3/includes/api/ApiQueryFilearchive.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryFilearchive.php   2010-07-06 11:34:15 UTC 
(rev 69090)
+++ trunk/phase3/includes/api/ApiQueryFilearchive.php   2010-07-06 13:15:59 UTC 
(rev 69091)
@@ -147,13 +147,13 @@
                                $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 ) {

Modified: trunk/phase3/includes/api/ApiQueryIWBacklinks.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryIWBacklinks.php   2010-07-06 11:34:15 UTC 
(rev 69090)
+++ trunk/phase3/includes/api/ApiQueryIWBacklinks.php   2010-07-06 13:15:59 UTC 
(rev 69091)
@@ -143,7 +143,7 @@
        }
 
        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"',

Modified: trunk/phase3/includes/api/ApiQueryImageInfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryImageInfo.php     2010-07-06 11:34:15 UTC 
(rev 69090)
+++ trunk/phase3/includes/api/ApiQueryImageInfo.php     2010-07-06 13:15:59 UTC 
(rev 69091)
@@ -213,13 +213,13 @@
                                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() );
                                        }
                                        

Modified: trunk/phase3/includes/api/ApiQueryLogEvents.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryLogEvents.php     2010-07-06 11:34:15 UTC 
(rev 69090)
+++ trunk/phase3/includes/api/ApiQueryLogEvents.php     2010-07-06 13:15:59 UTC 
(rev 69091)
@@ -231,7 +231,7 @@
                        $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 );
                }
 

Modified: trunk/phase3/includes/api/ApiQueryWatchlist.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryWatchlist.php     2010-07-06 11:34:15 UTC 
(rev 69090)
+++ trunk/phase3/includes/api/ApiQueryWatchlist.php     2010-07-06 13:15:59 UTC 
(rev 69091)
@@ -258,8 +258,8 @@
                }
 
                if ( $this->fld_notificationtimestamp ) {
-                       $vals['notificationtimestamp'] = ( 
$row->wl_notificationtimestamp == null ) 
-                               ? '' 
+                       $vals['notificationtimestamp'] = ( 
$row->wl_notificationtimestamp == null )
+                               ? ''
                                : wfTimestamp( TS_ISO_8601, 
$row->wl_notificationtimestamp );
                }
 

Modified: trunk/phase3/includes/api/ApiUpload.php
===================================================================
--- trunk/phase3/includes/api/ApiUpload.php     2010-07-06 11:34:15 UTC (rev 
69090)
+++ trunk/phase3/includes/api/ApiUpload.php     2010-07-06 13:15:59 UTC (rev 
69091)
@@ -99,7 +99,7 @@
                                                $this->mParams['comment'],
                                                $this->mParams['watchlist'],
                                                
$this->mParams['ignorewarnings'],
-                                               $async);
+                                               $async );
 
                                $this->checkPermissions( $wgUser );
                                if ( $async ) {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to