Merge "Fixed Bug 40464 Placeholder attribute of searchInput element"
authorTheDJ <hartman.wiki@gmail.com>
Sun, 21 Apr 2013 16:59:00 +0000 (16:59 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 21 Apr 2013 16:59:00 +0000 (16:59 +0000)
324 files changed:
includes/Article.php
includes/AutoLoader.php
includes/Block.php
includes/Cdb.php
includes/Cdb_PHP.php
includes/ChangeTags.php
includes/ChangesFeed.php
includes/ChangesList.php
includes/Collation.php
includes/ConfEditor.php
includes/CryptRand.php
includes/DataUpdate.php
includes/Exception.php
includes/Export.php
includes/Fallback.php
includes/Feed.php
includes/FeedUtils.php
includes/FileDeleteForm.php
includes/ForkController.php
includes/FormOptions.php
includes/GitInfo.php
includes/HTMLForm.php
includes/HashRing.php
includes/HistoryBlob.php
includes/Hooks.php
includes/Html.php
includes/HttpFunctions.php
includes/IP.php
includes/ImageGallery.php
includes/ImagePage.php
includes/ImageQueryPage.php
includes/Import.php
includes/Licenses.php
includes/LinkFilter.php
includes/Linker.php
includes/LinksUpdate.php
includes/MWFunction.php
includes/MagicWord.php
includes/Message.php
includes/Metadata.php
includes/MimeMagic.php
includes/OutputHandler.php
includes/Pager.php
includes/PathRouter.php
includes/Preferences.php
includes/PrefixSearch.php
includes/ProtectionForm.php
includes/QueryPage.php
includes/Revision.php
includes/RevisionList.php
includes/Sanitizer.php
includes/Setup.php
includes/SiteConfiguration.php
includes/SiteStats.php
includes/Skin.php
includes/SkinLegacy.php
includes/SkinTemplate.php
includes/SpecialPage.php
includes/SpecialPageFactory.php
includes/Status.php
includes/StringUtils.php
includes/Timestamp.php
includes/User.php
includes/UserMailer.php
includes/UserRightsProxy.php
includes/WatchedItem.php
includes/WebRequest.php
includes/WebResponse.php
includes/WebStart.php
includes/Wiki.php
includes/WikiError.php
includes/WikiMap.php
includes/WikiPage.php
includes/Xml.php
includes/XmlTypeCheck.php
includes/ZhClient.php
includes/actions/CreditsAction.php
includes/actions/HistoryAction.php
includes/actions/InfoAction.php
includes/actions/PurgeAction.php
includes/actions/RawAction.php
includes/api/ApiBase.php
includes/api/ApiBlock.php
includes/api/ApiComparePages.php
includes/api/ApiCreateAccount.php
includes/api/ApiFeedContributions.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiImageRotate.php
includes/api/ApiImport.php
includes/api/ApiMain.php
includes/api/ApiMove.php
includes/api/ApiPurge.php
includes/api/ApiQueryAllMessages.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiUpload.php
includes/cache/BacklinkCache.php
includes/cache/CacheDependency.php
includes/cache/FileCacheBase.php
includes/cache/GenderCache.php
includes/cache/LinkBatch.php
includes/cache/LinkCache.php
includes/cache/MessageCache.php
includes/cache/SquidUpdate.php
includes/context/RequestContext.php
includes/db/CloneDatabase.php
includes/db/Database.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysql.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/db/LoadBalancer.php
includes/db/LoadMonitor.php
includes/debug/Debug.php
includes/diff/DairikiDiff.php
includes/externalstore/ExternalStoreDB.php
includes/filebackend/FSFileBackend.php
includes/filebackend/FileBackend.php
includes/filebackend/FileBackendGroup.php
includes/filebackend/FileBackendStore.php
includes/filebackend/FileOp.php
includes/filebackend/SwiftFileBackend.php
includes/filebackend/filejournal/DBFileJournal.php
includes/filebackend/lockmanager/DBLockManager.php
includes/filebackend/lockmanager/LockManagerGroup.php
includes/filerepo/FSRepo.php
includes/filerepo/FileRepo.php
includes/filerepo/ForeignAPIRepo.php
includes/filerepo/ForeignDBRepo.php
includes/filerepo/LocalRepo.php
includes/filerepo/RepoGroup.php
includes/filerepo/file/ArchivedFile.php
includes/filerepo/file/File.php
includes/filerepo/file/ForeignAPIFile.php
includes/filerepo/file/LocalFile.php
includes/installer/CliInstaller.php
includes/installer/DatabaseInstaller.php
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/MysqlInstaller.php
includes/installer/MysqlUpdater.php
includes/installer/PostgresInstaller.php
includes/installer/PostgresUpdater.php
includes/installer/SqliteInstaller.php
includes/installer/WebInstaller.php
includes/installer/WebInstallerOutput.php
includes/installer/WebInstallerPage.php
includes/job/Job.php
includes/job/JobQueueAggregatorMemc.php
includes/job/JobQueueDB.php
includes/job/JobQueueFederated.php
includes/job/JobQueueRedis.php
includes/job/jobs/AssembleUploadChunksJob.php
includes/job/jobs/EnotifNotifyJob.php
includes/job/jobs/HTMLCacheUpdateJob.php
includes/job/jobs/PublishStashedFileJob.php
includes/job/jobs/RefreshLinksJob.php
includes/logging/DeleteLogFormatter.php
includes/logging/LogEntry.php
includes/logging/LogEventsList.php
includes/logging/LogFormatter.php
includes/logging/LogPage.php
includes/logging/LogPager.php
includes/logging/MoveLogFormatter.php
includes/media/BMP.php
includes/media/Bitmap.php
includes/media/BitmapMetadataHandler.php
includes/media/DjVu.php
includes/media/DjVuImage.php
includes/media/Exif.php
includes/media/FormatMetadata.php
includes/media/GIF.php
includes/media/GIFMetadataExtractor.php
includes/media/ImageHandler.php
includes/media/Jpeg.php
includes/media/JpegMetadataExtractor.php
includes/media/MediaHandler.php
includes/media/MediaTransformOutput.php
includes/media/PNG.php
includes/media/PNGMetadataExtractor.php
includes/media/SVG.php
includes/media/SVGMetadataExtractor.php
includes/media/XCF.php
includes/media/XMP.php
includes/media/XMPInfo.php
includes/objectcache/BagOStuff.php
includes/objectcache/MemcachedBagOStuff.php
includes/objectcache/MemcachedClient.php
includes/objectcache/ObjectCache.php
includes/objectcache/ObjectCacheSessionHandler.php
includes/parser/CacheTime.php
includes/parser/CoreParserFunctions.php
includes/parser/CoreTagHooks.php
includes/parser/DateFormatter.php
includes/parser/LinkHolderArray.php
includes/parser/Parser.php
includes/parser/ParserCache.php
includes/parser/ParserOptions.php
includes/parser/ParserOutput.php
includes/parser/Parser_DiffTest.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/parser/Tidy.php
includes/profiler/Profiler.php
includes/profiler/ProfilerSimpleUDP.php
includes/resourceloader/ResourceLoaderStartUpModule.php
includes/resourceloader/ResourceLoaderUserGroupsModule.php
includes/revisiondelete/RevisionDelete.php
includes/revisiondelete/RevisionDeleteAbstracts.php
includes/revisiondelete/RevisionDeleteUser.php
includes/revisiondelete/RevisionDeleter.php
includes/search/SearchEngine.php
includes/search/SearchMssql.php
includes/search/SearchMySQL.php
includes/search/SearchOracle.php
includes/search/SearchPostgres.php
includes/search/SearchSqlite.php
includes/search/SearchUpdate.php
includes/specials/SpecialAllmessages.php
includes/specials/SpecialAllpages.php
includes/specials/SpecialAncientpages.php
includes/specials/SpecialBlock.php
includes/specials/SpecialBlockList.php
includes/specials/SpecialBlockme.php
includes/specials/SpecialBooksources.php
includes/specials/SpecialBrokenRedirects.php
includes/specials/SpecialCachedPage.php
includes/specials/SpecialCategories.php
includes/specials/SpecialChangeEmail.php
includes/specials/SpecialChangePassword.php
includes/specials/SpecialComparePages.php
includes/specials/SpecialConfirmemail.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeadendpages.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialDisambiguations.php
includes/specials/SpecialDoubleRedirects.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialEmailuser.php
includes/specials/SpecialExport.php
includes/specials/SpecialFewestrevisions.php
includes/specials/SpecialFileDuplicateSearch.php
includes/specials/SpecialFilepath.php
includes/specials/SpecialImport.php
includes/specials/SpecialJavaScriptTest.php
includes/specials/SpecialLinkSearch.php
includes/specials/SpecialListfiles.php
includes/specials/SpecialListgrouprights.php
includes/specials/SpecialListredirects.php
includes/specials/SpecialListusers.php
includes/specials/SpecialLog.php
includes/specials/SpecialLonelypages.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialNewimages.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialPasswordReset.php
includes/specials/SpecialPopularpages.php
includes/specials/SpecialPrefixindex.php
includes/specials/SpecialProtectedpages.php
includes/specials/SpecialProtectedtitles.php
includes/specials/SpecialRandompage.php
includes/specials/SpecialRecentchanges.php
includes/specials/SpecialRecentchangeslinked.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialSearch.php
includes/specials/SpecialSpecialpages.php
includes/specials/SpecialStatistics.php
includes/specials/SpecialTags.php
includes/specials/SpecialUnblock.php
includes/specials/SpecialUncategorizedpages.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUploadStash.php
includes/specials/SpecialUserlogin.php
includes/specials/SpecialUserrights.php
includes/specials/SpecialVersion.php
includes/specials/SpecialWatchlist.php
includes/specials/SpecialWhatlinkshere.php
includes/specials/SpecialWithoutinterwiki.php
includes/templates/Usercreate.php
includes/templates/Userlogin.php
includes/templates/UserloginVForm.php
includes/upload/UploadBase.php
includes/upload/UploadFromChunks.php
includes/upload/UploadFromFile.php
includes/upload/UploadFromStash.php
includes/upload/UploadFromUrl.php
includes/upload/UploadStash.php
languages/messages/MessagesAst.php
languages/messages/MessagesBcl.php
languages/messages/MessagesBn.php
languages/messages/MessagesCa.php
languages/messages/MessagesCs.php
languages/messages/MessagesCy.php
languages/messages/MessagesDe.php
languages/messages/MessagesDiq.php
languages/messages/MessagesEs.php
languages/messages/MessagesKo.php
languages/messages/MessagesKsh.php
languages/messages/MessagesLb.php
languages/messages/MessagesLij.php
languages/messages/MessagesOr.php
languages/messages/MessagesPms.php
languages/messages/MessagesTet.php
languages/messages/MessagesVmf.php
languages/messages/MessagesZh_hans.php
languages/messages/MessagesZh_hant.php
skins/monobook/main.css
skins/vector/screen.css

index d2f52bc..1354a48 100644 (file)
@@ -673,12 +673,12 @@ class Article implements Page {
                                                wfDebug( __METHOD__ . ": showing CSS/JS source\n" );
                                                $this->showCssOrJsPage();
                                                $outputDone = true;
-                                       } elseif( !wfRunHooks( 'ArticleContentViewCustom',
+                                       } elseif ( !wfRunHooks( 'ArticleContentViewCustom',
                                                        array( $this->fetchContentObject(), $this->getTitle(), $outputPage ) ) ) {
 
                                                # Allow extensions do their own custom view for certain pages
                                                $outputDone = true;
-                                       } elseif( !ContentHandler::runLegacyHooks( 'ArticleViewCustom',
+                                       } elseif ( !ContentHandler::runLegacyHooks( 'ArticleViewCustom',
                                                        array( $this->fetchContentObject(), $this->getTitle(), $outputPage ) ) ) {
 
                                                # Allow extensions do their own custom view for certain pages
@@ -875,7 +875,7 @@ class Article implements Page {
                        }
                        if ( Block::newFromTarget( $specificTarget, $vagueTarget ) instanceof Block ) {
                                return array(
-                                       'index'  => 'noindex',
+                                       'index' => 'noindex',
                                        'follow' => 'nofollow'
                                );
                        }
@@ -884,19 +884,19 @@ class Article implements Page {
                if ( $this->mPage->getID() === 0 || $this->getOldID() ) {
                        # Non-articles (special pages etc), and old revisions
                        return array(
-                               'index'  => 'noindex',
+                               'index' => 'noindex',
                                'follow' => 'nofollow'
                        );
                } elseif ( $this->getContext()->getOutput()->isPrintable() ) {
                        # Discourage indexing of printable versions, but encourage following
                        return array(
-                               'index'  => 'noindex',
+                               'index' => 'noindex',
                                'follow' => 'follow'
                        );
                } elseif ( $this->getContext()->getRequest()->getInt( 'curid' ) ) {
                        # For ?curid=x urls, disallow indexing
                        return array(
-                               'index'  => 'noindex',
+                               'index' => 'noindex',
                                'follow' => 'follow'
                        );
                }
index 4e562f6..8c20c8a 100644 (file)
@@ -574,9 +574,9 @@ $wgAutoloadLocalClasses = array(
        'LSLockManager' => 'includes/filebackend/lockmanager/LSLockManager.php',
        'MemcLockManager' => 'includes/filebackend/lockmanager/MemcLockManager.php',
        'QuorumLockManager' => 'includes/filebackend/lockmanager/QuorumLockManager.php',
-       'MySqlLockManager'=> 'includes/filebackend/lockmanager/DBLockManager.php',
-       'PostgreSqlLockManager'=> 'includes/filebackend/lockmanager/DBLockManager.php',
-       'RedisLockManager'=> 'includes/filebackend/lockmanager/RedisLockManager.php',
+       'MySqlLockManager' => 'includes/filebackend/lockmanager/DBLockManager.php',
+       'PostgreSqlLockManager' => 'includes/filebackend/lockmanager/DBLockManager.php',
+       'RedisLockManager' => 'includes/filebackend/lockmanager/RedisLockManager.php',
        'NullLockManager' => 'includes/filebackend/lockmanager/LockManager.php',
        'FileOp' => 'includes/filebackend/FileOp.php',
        'FileOpBatch' => 'includes/filebackend/FileOpBatch.php',
index 3f00a51..638b9a6 100644 (file)
@@ -65,11 +65,11 @@ class Block {
                $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
                $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '' )
        {
-               if( $timestamp === 0 ) {
+               if ( $timestamp === 0 ) {
                        $timestamp = wfTimestampNow();
                }
 
-               if( count( func_get_args() ) > 0 ) {
+               if ( count( func_get_args() ) > 0 ) {
                        # Soon... :D
                        # wfDeprecated( __METHOD__ . " with arguments" );
                }
@@ -206,16 +206,16 @@ class Block {
         */
        public function load( $address = '', $user = 0 ) {
                wfDeprecated( __METHOD__, '1.18' );
-               if( $user ) {
+               if ( $user ) {
                        $username = User::whoIs( $user );
                        $block = self::newFromTarget( $username, $address );
                } else {
                        $block = self::newFromTarget( null, $address );
                }
 
-               if( $block instanceof Block ) {
+               if ( $block instanceof Block ) {
                        # This is mildly evil, but hey, it's B/C :D
-                       foreach( $block as $variable => $value ) {
+                       foreach ( $block as $variable => $value ) {
                                $this->$variable = $value;
                        }
                        return true;
@@ -237,7 +237,7 @@ class Block {
        protected function newLoad( $vagueTarget = null ) {
                $db = wfGetDB( $this->mFromMaster ? DB_MASTER : DB_SLAVE );
 
-               if( $this->type !== null ) {
+               if ( $this->type !== null ) {
                        $conds = array(
                                'ipb_address' => array( (string)$this->target ),
                        );
@@ -247,7 +247,7 @@ class Block {
 
                # Be aware that the != '' check is explicit, since empty values will be
                # passed by some callers (bug 29116)
-               if( $vagueTarget != '' ) {
+               if ( $vagueTarget != '' ) {
                        list( $target, $type ) = self::parseTarget( $vagueTarget );
                        switch( $type ) {
                                case self::TYPE_USER:
@@ -285,20 +285,20 @@ class Block {
                # This is begging for $this = $bestBlock, but that's not allowed in PHP :(
                $bestBlockPreventsEdit = null;
 
-               foreach( $res as $row ) {
+               foreach ( $res as $row ) {
                        $block = self::newFromRow( $row );
 
                        # Don't use expired blocks
-                       if( $block->deleteIfExpired() ) {
+                       if ( $block->deleteIfExpired() ) {
                                continue;
                        }
 
                        # Don't use anon only blocks on users
-                       if( $this->type == self::TYPE_USER && !$block->isHardblock() ) {
+                       if ( $this->type == self::TYPE_USER && !$block->isHardblock() ) {
                                continue;
                        }
 
-                       if( $block->getType() == self::TYPE_RANGE ) {
+                       if ( $block->getType() == self::TYPE_RANGE ) {
                                # This is the number of bits that are allowed to vary in the block, give
                                # or take some floating point errors
                                $end = wfBaseconvert( $block->getRangeEnd(), 16, 10 );
@@ -313,14 +313,14 @@ class Block {
                                $score = $block->getType();
                        }
 
-                       if( $score < $bestBlockScore ) {
+                       if ( $score < $bestBlockScore ) {
                                $bestBlockScore = $score;
                                $bestRow = $row;
                                $bestBlockPreventsEdit = $block->prevents( 'edit' );
                        }
                }
 
-               if( $bestRow !== null ) {
+               if ( $bestRow !== null ) {
                        $this->initFromRow( $bestRow );
                        $this->prevents( 'edit', $bestBlockPreventsEdit );
                        return true;
@@ -579,7 +579,7 @@ class Block {
                global $wgPutIPinRC;
 
                // No IPs are in recentchanges table, so nothing to select
-               if( !$wgPutIPinRC ) {
+               if ( !$wgPutIPinRC ) {
                        return;
                }
 
@@ -601,7 +601,9 @@ class Block {
                        foreach ( $res as $row ) {
                                if ( $row->rc_ip ) {
                                        $id = $block->doAutoblock( $row->rc_ip );
-                                       if ( $id ) $blockIds[] = $id;
+                                       if ( $id ) {
+                                               $blockIds[] = $id;
+                                       }
                                }
                        }
                }
@@ -1057,24 +1059,24 @@ class Block {
        public static function newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) {
 
                list( $target, $type ) = self::parseTarget( $specificTarget );
-               if( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ) {
+               if ( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ) {
                        return Block::newFromID( $target );
 
-               } elseif( $target === null && $vagueTarget == '' ) {
+               } elseif ( $target === null && $vagueTarget == '' ) {
                        # We're not going to find anything useful here
                        # Be aware that the == '' check is explicit, since empty values will be
                        # passed by some callers (bug 29116)
                        return null;
 
-               } elseif( in_array( $type, array( Block::TYPE_USER, Block::TYPE_IP, Block::TYPE_RANGE, null ) ) ) {
+               } elseif ( in_array( $type, array( Block::TYPE_USER, Block::TYPE_IP, Block::TYPE_RANGE, null ) ) ) {
                        $block = new Block();
                        $block->fromMaster( $fromMaster );
 
-                       if( $type !== null ) {
+                       if ( $type !== null ) {
                                $block->setTarget( $target );
                        }
 
-                       if( $block->newLoad( $vagueTarget ) ) {
+                       if ( $block->newLoad( $vagueTarget ) ) {
                                return $block;
                        }
                }
@@ -1278,13 +1280,13 @@ class Block {
         */
        public static function parseTarget( $target ) {
                # We may have been through this before
-               if( $target instanceof User ) {
-                       if( IP::isValid( $target->getName() ) ) {
+               if ( $target instanceof User ) {
+                       if ( IP::isValid( $target->getName() ) ) {
                                return array( $target, self::TYPE_IP );
                        } else {
                                return array( $target, self::TYPE_USER );
                        }
-               } elseif( $target === null ) {
+               } elseif ( $target === null ) {
                        return array( null, null );
                }
 
@@ -1305,7 +1307,7 @@ class Block {
 
                # Consider the possibility that this is not a username at all
                # but actually an old subpage (bug #29797)
-               if( strpos( $target, '/' ) !== false ) {
+               if ( strpos( $target, '/' ) !== false ) {
                        # An old subpage, drill down to the user behind it
                        $parts = explode( '/', $target );
                        $target = $parts[0];
index a142c7c..81c0afe 100644 (file)
@@ -133,7 +133,7 @@ class CdbReader_DBA {
        }
 
        function close() {
-               if( isset( $this->handle ) ) {
+               if ( isset( $this->handle ) ) {
                        dba_close( $this->handle );
                }
                unset( $this->handle );
@@ -164,7 +164,7 @@ class CdbWriter_DBA {
        }
 
        function close() {
-               if( isset( $this->handle ) ) {
+               if ( isset( $this->handle ) ) {
                        dba_close( $this->handle );
                }
                if ( wfIsWindows() ) {
index e16397b..166242a 100644 (file)
@@ -138,7 +138,7 @@ class CdbReader_PHP extends CdbReader {
        }
 
        function close() {
-               if( isset( $this->handle ) ) {
+               if ( isset( $this->handle ) ) {
                        fclose( $this->handle );
                }
                unset( $this->handle );
@@ -332,7 +332,7 @@ class CdbWriter_PHP extends CdbWriter {
         */
        public function close() {
                $this->finish();
-               if( isset( $this->handle ) ) {
+               if ( isset( $this->handle ) ) {
                        fclose( $this->handle );
                }
                if ( wfIsWindows() && file_exists( $this->realFileName ) ) {
@@ -450,9 +450,11 @@ class CdbWriter_PHP extends CdbWriter {
                                $hp = $packedTables[$starts[$i] + $u];
                                $where = CdbFunctions::unsignedMod(
                                        CdbFunctions::unsignedShiftRight( $hp['h'], 8 ), $len );
-                               while ( $hashtable[$where]['p'] )
-                                       if ( ++$where == $len )
+                               while ( $hashtable[$where]['p'] ) {
+                                       if ( ++$where == $len ) {
                                                $where = 0;
+                                       }
+                               }
                                $hashtable[$where] = $hp;
                        }
 
index 3adf58f..5478396 100644 (file)
@@ -37,14 +37,15 @@ class ChangeTags {
        static function formatSummaryRow( $tags, $page ) {
                global $wgLang;
 
-               if( !$tags )
+               if ( !$tags ) {
                        return array( '', array() );
+               }
 
                $classes = array();
 
                $tags = explode( ',', $tags );
                $displayTags = array();
-               foreach( $tags as $tag ) {
+               foreach ( $tags as $tag ) {
                        $displayTags[] = Xml::tags(
                                'span',
                                array( 'class' => 'mw-tag-marker ' .
@@ -93,21 +94,21 @@ class ChangeTags {
 
                $tags = array_filter( $tags ); // Make sure we're submitting all tags...
 
-               if( !$rc_id && !$rev_id && !$log_id ) {
+               if ( !$rc_id && !$rev_id && !$log_id ) {
                        throw new MWException( "At least one of: RCID, revision ID, and log ID MUST be specified when adding a tag to a change!" );
                }
 
                $dbr = wfGetDB( DB_SLAVE );
 
                // Might as well look for rcids and so on.
-               if( !$rc_id ) {
+               if ( !$rc_id ) {
                        $dbr = wfGetDB( DB_MASTER ); // Info might be out of date, somewhat fractionally, on slave.
-                       if( $log_id ) {
+                       if ( $log_id ) {
                                $rc_id = $dbr->selectField( 'recentchanges', 'rc_id', array( 'rc_logid' => $log_id ), __METHOD__ );
-                       } elseif( $rev_id ) {
+                       } elseif ( $rev_id ) {
                                $rc_id = $dbr->selectField( 'recentchanges', 'rc_id', array( 'rc_this_oldid' => $rev_id ), __METHOD__ );
                        }
-               } elseif( !$log_id && !$rev_id ) {
+               } elseif ( !$log_id && !$rev_id ) {
                        $dbr = wfGetDB( DB_MASTER ); // Info might be out of date, somewhat fractionally, on slave.
                        $log_id = $dbr->selectField( 'recentchanges', 'rc_logid', array( 'rc_id' => $rc_id ), __METHOD__ );
                        $rev_id = $dbr->selectField( 'recentchanges', 'rc_this_oldid', array( 'rc_id' => $rc_id ), __METHOD__ );
@@ -138,7 +139,7 @@ class ChangeTags {
 
                // Insert the tags rows.
                $tagsRows = array();
-               foreach( $tags as $tag ) { // Filter so we don't insert NULLs as zero accidentally.
+               foreach ( $tags as $tag ) { // Filter so we don't insert NULLs as zero accidentally.
                        $tagsRows[] = array_filter(
                                array(
                                        'ct_tag' => $tag,
@@ -173,14 +174,14 @@ class ChangeTags {
                                                                                &$join_conds, &$options, $filter_tag = false ) {
                global $wgRequest, $wgUseTagFilter;
 
-               if( $filter_tag === false ) {
+               if ( $filter_tag === false ) {
                        $filter_tag = $wgRequest->getVal( 'tagfilter' );
                }
 
                // Figure out which conditions can be done.
                if ( in_array( 'recentchanges', $tables ) ) {
                        $join_cond = 'rc_id';
-               } elseif( in_array( 'logging', $tables ) ) {
+               } elseif ( in_array( 'logging', $tables ) ) {
                        $join_cond = 'log_id';
                } elseif ( in_array( 'revision', $tables ) ) {
                        $join_cond = 'rev_id';
@@ -193,7 +194,7 @@ class ChangeTags {
                $join_conds['tag_summary'] = array( 'LEFT JOIN', "ts_$join_cond=$join_cond" );
                $fields[] = 'ts_tags';
 
-               if( $wgUseTagFilter && $filter_tag ) {
+               if ( $wgUseTagFilter && $filter_tag ) {
                        // Somebody wants to filter on a tag.
                        // Add an INNER JOIN on change_tag
 
index e900e34..8e710de 100644 (file)
@@ -54,7 +54,7 @@ class ChangesFeed {
                        return false;
                }
 
-               if( !array_key_exists( $this->format, $wgFeedClasses ) ) {
+               if ( !array_key_exists( $this->format, $wgFeedClasses ) ) {
                        // falling back to atom
                        $this->format = 'atom';
                }
@@ -92,7 +92,7 @@ class ChangesFeed {
                 * gets it quick too.
                 */
                $cachedFeed = $this->loadFromCache( $lastmod, $timekey, $key );
-               if( is_string( $cachedFeed ) ) {
+               if ( is_string( $cachedFeed ) ) {
                        wfDebug( "RC: Outputting cached feed\n" );
                        $feed->httpHeaders();
                        echo $cachedFeed;
@@ -134,7 +134,7 @@ class ChangesFeed {
 
                $feedLastmod = $messageMemc->get( $timekey );
 
-               if( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) {
+               if ( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) {
                        /**
                         * If the cached feed was rendered very recently, we may
                         * go ahead and use it even if there have been edits made
@@ -146,7 +146,7 @@ class ChangesFeed {
                        $feedLastmodUnix = wfTimestamp( TS_UNIX, $feedLastmod );
                        $lastmodUnix = wfTimestamp( TS_UNIX, $lastmod );
 
-                       if( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix ) {
+                       if ( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix ) {
                                wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
                                if ( $feedLastmodUnix < $lastmodUnix ) {
                                        $wgOut->setLastModified( $feedLastmod ); // bug 21916
@@ -172,8 +172,8 @@ class ChangesFeed {
                # Merge adjacent edits by one user
                $sorted = array();
                $n = 0;
-               foreach( $rows as $obj ) {
-                       if( $n > 0 &&
+               foreach ( $rows as $obj ) {
+                       if ( $n > 0 &&
                                $obj->rc_type == RC_EDIT &&
                                $obj->rc_namespace >= 0 &&
                                $obj->rc_cur_id == $sorted[$n - 1]->rc_cur_id &&
@@ -185,11 +185,13 @@ class ChangesFeed {
                        }
                }
 
-               foreach( $sorted as $obj ) {
+               foreach ( $sorted as $obj ) {
                        $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title );
                        $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) ? $title->getTalkPage()->getFullURL() : '';
                        // Skip items with deleted content (avoids partially complete/inconsistent output)
-                       if( $obj->rc_deleted ) continue;
+                       if ( $obj->rc_deleted ) {
+                               continue;
+                       }
 
                        if ( $obj->rc_this_oldid ) {
                                $url = $title->getFullURL(
index 79e2d0b..3170a7d 100644 (file)
@@ -99,7 +99,7 @@ class ChangesList extends ContextSource {
                $user = $context->getUser();
                $sk = $context->getSkin();
                $list = null;
-               if( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
+               if ( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
                        $new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
                        return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
                } else {
@@ -120,7 +120,7 @@ class ChangesList extends ContextSource {
         * they are called often, we call them once and save them in $this->message
         */
        private function preCacheMessages() {
-               if( !isset( $this->message ) ) {
+               if ( !isset( $this->message ) ) {
                        foreach ( explode( ' ', 'cur diff hist last blocklink history ' .
                        'semicolon-separator pipe-separator' ) as $msg ) {
                                $this->message[$msg] = $this->msg( $msg )->escaped();
@@ -136,7 +136,7 @@ class ChangesList extends ContextSource {
         */
        protected function recentChangesFlags( $flags, $nothing = '&#160;' ) {
                $f = '';
-               foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) {
+               foreach ( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) {
                        $f .= isset( $flags[$flag] ) && $flags[$flag]
                                ? self::flag( $flag )
                                : $nothing;
@@ -162,7 +162,7 @@ class ChangesList extends ContextSource {
                                'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ),
                                'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ),
                        );
-                       foreach( $messages as &$value ) {
+                       foreach ( $messages as &$value ) {
                                $value[0] = wfMessage( $value[0] )->escaped();
                                $value[1] = wfMessage( $value[1] )->escaped();
                        }
@@ -227,7 +227,7 @@ class ChangesList extends ContextSource {
                        $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text();
                }
 
-               if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
+               if ( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
                        $tag = 'strong';
                } else {
                        $tag = 'span';
@@ -267,7 +267,7 @@ class ChangesList extends ContextSource {
                        $newlen = $old->mAttribs['rc_new_len'];
                }
 
-               if( $oldlen === null || $newlen === null ) {
+               if ( $oldlen === null || $newlen === null ) {
                        return '';
                }
 
@@ -279,7 +279,7 @@ class ChangesList extends ContextSource {
         * @return String
         */
        public function endRecentChangesList() {
-               if( $this->rclistOpen ) {
+               if ( $this->rclistOpen ) {
                        return "</ul>\n";
                } else {
                        return '';
@@ -293,8 +293,8 @@ class ChangesList extends ContextSource {
        public function insertDateHeader( &$s, $rc_timestamp ) {
                # Make date header if necessary
                $date = $this->getLanguage()->userDate( $rc_timestamp, $this->getUser() );
-               if( $date != $this->lastdate ) {
-                       if( $this->lastdate != '' ) {
+               if ( $date != $this->lastdate ) {
+                       if ( $this->lastdate != '' ) {
                                $s .= "</ul>\n";
                        }
                        $s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
@@ -321,7 +321,7 @@ class ChangesList extends ContextSource {
         */
        public function insertDiffHist( &$s, &$rc, $unpatrolled ) {
                # Diff link
-               if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
+               if ( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
                        $diffLink = $this->message['diff'];
                } elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
                        $diffLink = $this->message['diff'];
@@ -332,7 +332,7 @@ class ChangesList extends ContextSource {
                                'oldid' => $rc->mAttribs['rc_last_oldid']
                        );
 
-                       if( $unpatrolled ) {
+                       if ( $unpatrolled ) {
                                $query['rcid'] = $rc->mAttribs['rc_id'];
                        };
 
@@ -378,7 +378,7 @@ class ChangesList extends ContextSource {
                        array( 'class' => 'mw-changeslist-title' ),
                        $params
                );
-               if( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
+               if ( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) {
                        $articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
                }
                # To allow for boldening pages watched by this user
@@ -421,7 +421,7 @@ class ChangesList extends ContextSource {
         * @param &$rc RecentChange
         */
        public function insertUserRelatedLinks( &$s, &$rc ) {
-               if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+               if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
                        $s .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
                } else {
                        $s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
@@ -450,8 +450,8 @@ class ChangesList extends ContextSource {
         * @return string
         */
        public function insertComment( $rc ) {
-               if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
-                       if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
+               if ( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
+                       if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
                                return ' <span class="history-deleted">' . $this->msg( 'rev-deleted-comment' )->escaped() . '</span>';
                        } else {
                                return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
@@ -475,8 +475,8 @@ class ChangesList extends ContextSource {
         */
        protected function numberofWatchingusers( $count ) {
                static $cache = array();
-               if( $count > 0 ) {
-                       if( !isset( $cache[$count] ) ) {
+               if ( $count > 0 ) {
+                       if ( !isset( $cache[$count] ) ) {
                                $cache[$count] = $this->msg( 'number_of_watching_users_RCview' )->numParams( $count )->escaped();
                        }
                        return $cache[$count];
@@ -504,7 +504,7 @@ class ChangesList extends ContextSource {
         * @return Boolean
         */
        public static function userCan( $rc, $field, User $user = null ) {
-               if( $rc->mAttribs['rc_type'] == RC_LOG ) {
+               if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
                        return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
                } else {
                        return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
@@ -517,7 +517,7 @@ class ChangesList extends ContextSource {
         * @return string
         */
        protected function maybeWatchedLink( $link, $watched = false ) {
-               if( $watched ) {
+               if ( $watched ) {
                        return '<strong class="mw-watched">' . $link . '</strong>';
                } else {
                        return '<span class="mw-rc-unwatched">' . $link . '</span>';
@@ -530,7 +530,7 @@ class ChangesList extends ContextSource {
         * @param $rc RecentChange
         */
        public function insertRollback( &$s, &$rc ) {
-               if( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
+               if ( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
                        $page = $rc->getTitle();
                        /** Check for rollback and edit permissions, disallow special pages, and only
                          * show a link on the top-most revision */
@@ -554,8 +554,9 @@ class ChangesList extends ContextSource {
         * @param $classes
         */
        public function insertTags( &$s, &$rc, &$classes ) {
-               if ( empty( $rc->mAttribs['ts_tags'] ) )
+               if ( empty( $rc->mAttribs['ts_tags'] ) ) {
                        return;
+               }
 
                list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
                $classes = array_merge( $classes, $newClasses );
@@ -605,11 +606,10 @@ class OldChangesList extends ChangesList {
                $s = '';
                $classes = array();
                // use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
-               if( $linenumber ) {
-                       if( $linenumber & 1 ) {
+               if ( $linenumber ) {
+                       if ( $linenumber & 1 ) {
                                $classes[] = 'mw-line-odd';
-                       }
-                       else {
+                       } else {
                                $classes[] = 'mw-line-even';
                        }
                }
@@ -619,15 +619,15 @@ class OldChangesList extends ChangesList {
                $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
 
                // Moved pages (very very old, not supported anymore)
-               if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
+               if ( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
                // Log entries
-               } elseif( $rc->mAttribs['rc_log_type'] ) {
+               } elseif ( $rc->mAttribs['rc_log_type'] ) {
                        $logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
                        $this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
                // Log entries (old format) or log targets, and special pages
-               } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
+               } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
                        list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
-                       if( $name == 'Log' ) {
+                       if ( $name == 'Log' ) {
                                $this->insertLog( $s, $rc->getTitle(), $subpage );
                        }
                // Regular entries
@@ -673,11 +673,11 @@ class OldChangesList extends ChangesList {
                $this->insertExtra( $s, $rc, $classes );
 
                # How many users watch this page
-               if( $rc->numberofWatchingusers > 0 ) {
+               if ( $rc->numberofWatchingusers > 0 ) {
                        $s .= ' ' . $this->numberofWatchingusers( $rc->numberofWatchingusers );
                }
 
-               if( $this->watchlist ) {
+               if ( $this->watchlist ) {
                        $classes[] = Sanitizer::escapeClass( 'watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] );
                }
 
@@ -730,7 +730,7 @@ class EnhancedChangesList extends ChangesList {
                # If it's a new day, add the headline and flush the cache
                $date = $this->getLanguage()->userDate( $rc->mAttribs['rc_timestamp'], $this->getUser() );
                $ret = '';
-               if( $date != $this->lastdate ) {
+               if ( $date != $this->lastdate ) {
                        # Process current cache
                        $ret = $this->recentChangesBlock();
                        $this->rc_cache = array();
@@ -746,14 +746,14 @@ class EnhancedChangesList extends ChangesList {
                $type = $rc->mAttribs['rc_type'];
                $logType = $rc->mAttribs['rc_log_type'];
                // Page moves, very old style, not supported anymore
-               if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+               if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
                // New unpatrolled pages
-               } elseif( $rc->unpatrolled && $type == RC_NEW ) {
+               } elseif ( $rc->unpatrolled && $type == RC_NEW ) {
                        $clink = Linker::linkKnown( $rc->getTitle(), null, array(),
                                array( 'rcid' => $rc->mAttribs['rc_id'] ) );
                // Log entries
-               } elseif( $type == RC_LOG ) {
-                       if( $logType ) {
+               } elseif ( $type == RC_LOG ) {
+                       if ( $logType ) {
                                $logtitle = SpecialPage::getTitleFor( 'Log', $logType );
                                $logpage = new LogPage( $logType );
                                $logname = $logpage->getName()->escaped();
@@ -763,7 +763,7 @@ class EnhancedChangesList extends ChangesList {
                        }
                        $watched = false;
                // Log entries (old format) and special pages
-               } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
+               } elseif ( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
                        wfDebug( "Unexpected special page in recentchanges\n" );
                        $clink = '';
                // Edits
@@ -786,7 +786,7 @@ class EnhancedChangesList extends ChangesList {
                # called too many times (50% of CPU time on RecentChanges!).
                $thisOldid = $rc->mAttribs['rc_this_oldid'];
                $lastOldid = $rc->mAttribs['rc_last_oldid'];
-               if( $rc->unpatrolled ) {
+               if ( $rc->unpatrolled ) {
                        $rcIdQuery = array( 'rcid' => $rc->mAttribs['rc_id'] );
                } else {
                        $rcIdQuery = array();
@@ -795,10 +795,10 @@ class EnhancedChangesList extends ChangesList {
                $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' =>
                        $lastOldid ) + $rcIdQuery;
 
-               if( !$showdifflinks ) {
+               if ( !$showdifflinks ) {
                        $curLink = $this->message['cur'];
                        $diffLink = $this->message['diff'];
-               } elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+               } elseif ( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
                        if ( $type != RC_NEW ) {
                                $curLink = $this->message['cur'];
                        } else {
@@ -814,9 +814,9 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # Make "last" link
-               if( !$showdifflinks || !$lastOldid ) {
+               if ( !$showdifflinks || !$lastOldid ) {
                        $lastLink = $this->message['last'];
-               } elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
+               } elseif ( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
                        $lastLink = $this->message['last'];
                } else {
                        $lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'],
@@ -824,7 +824,7 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # Make user links
-               if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
+               if ( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
                        $rc->userlink = ' <span class="history-deleted">' . $this->msg( 'rev-deleted-user' )->escaped() . '</span>';
                } else {
                        $rc->userlink = Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
@@ -839,15 +839,15 @@ class EnhancedChangesList extends ChangesList {
                # Page moves go on their own line
                $title = $rc->getTitle();
                $secureName = $title->getPrefixedDBkey();
-               if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+               if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
                        # Use an @ character to prevent collision with page names
                        $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc );
                } else {
                        # Logs are grouped by type
-                       if( $type == RC_LOG ) {
+                       if ( $type == RC_LOG ) {
                                $secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey();
                        }
-                       if( !isset( $this->rc_cache[$secureName] ) ) {
+                       if ( !isset( $this->rc_cache[$secureName] ) ) {
                                $this->rc_cache[$secureName] = array();
                        }
 
@@ -893,39 +893,39 @@ class EnhancedChangesList extends ChangesList {
                # Some catalyst variables...
                $namehidden = true;
                $allLogs = true;
-               foreach( $block as $rcObj ) {
+               foreach ( $block as $rcObj ) {
                        $oldid = $rcObj->mAttribs['rc_last_oldid'];
-                       if( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
+                       if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
                                $isnew = true;
                        }
                        // If all log actions to this page were hidden, then don't
                        // give the name of the affected page for this block!
-                       if( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
+                       if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
                                $namehidden = false;
                        }
                        $u = $rcObj->userlink;
-                       if( !isset( $userlinks[$u] ) ) {
+                       if ( !isset( $userlinks[$u] ) ) {
                                $userlinks[$u] = 0;
                        }
-                       if( $rcObj->unpatrolled ) {
+                       if ( $rcObj->unpatrolled ) {
                                $unpatrolled = true;
                        }
-                       if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
+                       if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
                                $allLogs = false;
                        }
                        # Get the latest entry with a page_id and oldid
                        # since logs may not have these.
-                       if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
+                       if ( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
                                $curId = $rcObj->mAttribs['rc_cur_id'];
                        }
-                       if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
+                       if ( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
                                $currentRevision = $rcObj->mAttribs['rc_this_oldid'];
                        }
 
-                       if( !$rcObj->mAttribs['rc_bot'] ) {
+                       if ( !$rcObj->mAttribs['rc_bot'] ) {
                                $allBots = false;
                        }
-                       if( !$rcObj->mAttribs['rc_minor'] ) {
+                       if ( !$rcObj->mAttribs['rc_minor'] ) {
                                $allMinors = false;
                        }
 
@@ -936,10 +936,10 @@ class EnhancedChangesList extends ChangesList {
                krsort( $userlinks );
                asort( $userlinks );
                $users = array();
-               foreach( $userlinks as $userlink => $count ) {
+               foreach ( $userlinks as $userlink => $count ) {
                        $text = $userlink;
                        $text .= $this->getLanguage()->getDirMark();
-                       if( $count > 1 ) {
+                       if ( $count > 1 ) {
                                $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->formatNum( $count ) . '×' )->escaped();
                        }
                        array_push( $users, $text );
@@ -965,9 +965,9 @@ class EnhancedChangesList extends ChangesList {
                $r .= '&#160;' . $block[0]->timestamp . '&#160;</td><td>';
 
                # Article link
-               if( $namehidden ) {
+               if ( $namehidden ) {
                        $r .= ' <span class="history-deleted">' . $this->msg( 'rev-deleted-event' )->escaped() . '</span>';
-               } elseif( $allLogs ) {
+               } elseif ( $allLogs ) {
                        $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
                } else {
                        $this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
@@ -985,10 +985,10 @@ class EnhancedChangesList extends ChangesList {
                # Total change link
                $r .= ' ';
                $logtext = '';
-               if( !$allLogs ) {
-                       if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
+               if ( !$allLogs ) {
+                       if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
                                $logtext .= $nchanges[$n];
-                       } elseif( $isnew ) {
+                       } elseif ( $isnew ) {
                                $logtext .= $nchanges[$n];
                        } else {
                                $params = $queryParams;
@@ -1006,9 +1006,9 @@ class EnhancedChangesList extends ChangesList {
                }
 
                # History
-               if( $allLogs ) {
+               if ( $allLogs ) {
                        // don't show history link for logs
-               } elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
+               } elseif ( $namehidden || !$block[0]->getTitle()->exists() ) {
                        $logtext .= $this->message['pipe-separator'] . $this->message['hist'];
                } else {
                        $params = $queryParams;
@@ -1023,27 +1023,27 @@ class EnhancedChangesList extends ChangesList {
                                );
                }
 
-               if( $logtext !== '' ) {
+               if ( $logtext !== '' ) {
                        $r .= $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
                }
 
                $r .= ' <span class="mw-changeslist-separator">. .</span> ';
 
                # Character difference (does not apply if only log items)
-               if( $wgRCShowChangedSize && !$allLogs ) {
+               if ( $wgRCShowChangedSize && !$allLogs ) {
                        $last = 0;
                        $first = count( $block ) - 1;
                        # Some events (like logs) have an "empty" size, so we need to skip those...
-                       while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
+                       while ( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
                                $last++;
                        }
-                       while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
+                       while ( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
                                $first--;
                        }
                        # Get net change
                        $chardiff = $this->formatCharacterDifference( $block[$first], $block[$last] );
 
-                       if( $chardiff == '' ) {
+                       if ( $chardiff == '' ) {
                                $r .= ' ';
                        } else {
                                $r .= ' ' . $chardiff . ' <span class="mw-changeslist-separator">. .</span> ';
@@ -1054,7 +1054,7 @@ class EnhancedChangesList extends ChangesList {
                $r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers );
 
                # Sub-entries
-               foreach( $block as $rcObj ) {
+               foreach ( $block as $rcObj ) {
                        # Classes to apply -- TODO implement
                        $classes = array();
                        $type = $rcObj->mAttribs['rc_type'];
@@ -1070,15 +1070,15 @@ class EnhancedChangesList extends ChangesList {
 
                        $params = $queryParams;
 
-                       if( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
+                       if ( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
                                $params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
                        }
 
                        # Log timestamp
-                       if( $type == RC_LOG ) {
+                       if ( $type == RC_LOG ) {
                                $link = $rcObj->timestamp;
                        # Revision link
-                       } elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
+                       } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
                                $link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
                        } else {
                                if ( $rcObj->unpatrolled && $type == RC_NEW) {
@@ -1091,7 +1091,7 @@ class EnhancedChangesList extends ChangesList {
                                                array(),
                                                $params
                                        );
-                               if( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
+                               if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
                                        $link = '<span class="history-deleted">' . $link . '</span> ';
                                }
                        }
@@ -1192,7 +1192,7 @@ class EnhancedChangesList extends ChangesList {
                $type = $rcObj->mAttribs['rc_type'];
                $logType = $rcObj->mAttribs['rc_log_type'];
                $classes = array( 'mw-enhanced-rc' );
-               if( $logType ) {
+               if ( $logType ) {
                        # Log entry
                        $classes[] = Sanitizer::escapeClass( 'mw-changeslist-log-'
                                        . $logType . '-' . $rcObj->mAttribs['rc_title'] );
@@ -1206,7 +1206,7 @@ class EnhancedChangesList extends ChangesList {
 
                $r .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
                # Flag and Timestamp
-               if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
+               if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
                        $r .= '&#160;&#160;&#160;&#160;'; // 4 flags -> 4 spaces
                } else {
                        $r .= $this->recentChangesFlags( array(
@@ -1218,7 +1218,7 @@ class EnhancedChangesList extends ChangesList {
                }
                $r .= '&#160;' . $rcObj->timestamp . '&#160;</td><td>';
                # Article or log link
-               if( $logType ) {
+               if ( $logType ) {
                        $logPage = new LogPage( $logType );
                        $logTitle = SpecialPage::getTitleFor( 'Log', $logType );
                        $logName = $logPage->getName()->escaped();
@@ -1272,15 +1272,15 @@ class EnhancedChangesList extends ChangesList {
         * @return string
         */
        protected function recentChangesBlock() {
-               if( count ( $this->rc_cache ) == 0 ) {
+               if ( count ( $this->rc_cache ) == 0 ) {
                        return '';
                }
 
                wfProfileIn( __METHOD__ );
 
                $blockOut = '';
-               foreach( $this->rc_cache as $block ) {
-                       if( count( $block ) < 2 ) {
+               foreach ( $this->rc_cache as $block ) {
+                       if ( count( $block ) < 2 ) {
                                $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
                        } else {
                                $blockOut .= $this->recentChangesBlockGroup( $block );
index 723b38e..215659e 100644 (file)
@@ -430,7 +430,7 @@ class IcuCollation extends Collation {
 
                $prev = false;
                $duplicatePrefixes = array();
-               foreach( $letterMap as $key => $value ) {
+               foreach ( $letterMap as $key => $value ) {
                        // Remove terminator byte. Otherwise the prefix
                        // comparison will get hung up on that.
                        $trimmedKey = rtrim( $key, "\0" );
@@ -456,7 +456,7 @@ class IcuCollation extends Collation {
                        }
                        $prev = $trimmedKey;
                }
-               foreach( $duplicatePrefixes as $badKey ) {
+               foreach ( $duplicatePrefixes as $badKey ) {
                        wfDebug( "Removing '{$letterMap[$badKey]}' from first letters." );
                        unset( $letterMap[$badKey] );
                        // This code assumes that unsetting does not change sort order.
index 293d53d..78af1c1 100644 (file)
@@ -278,19 +278,23 @@ class ConfEditor {
        function getVars() {
                $vars = array();
                $this->parse();
-               foreach( $this->pathInfo as $path => $data ) {
-                       if ( $path[0] != '$' )
+               foreach ( $this->pathInfo as $path => $data ) {
+                       if ( $path[0] != '$' ) {
                                continue;
+                       }
                        $trimmedPath = substr( $path, 1 );
                        $name = $data['name'];
-                       if ( $name[0] == '@' )
+                       if ( $name[0] == '@' ) {
                                continue;
-                       if ( $name[0] == '$' )
+                       }
+                       if ( $name[0] == '$' ) {
                                $name = substr( $name, 1 );
+                       }
                        $parentPath = substr( $trimmedPath, 0,
                                strlen( $trimmedPath ) - strlen( $name ) );
-                       if( substr( $parentPath, -1 ) == '/' )
+                       if ( substr( $parentPath, -1 ) == '/' ) {
                                $parentPath = substr( $parentPath, 0, -1 );
+                       }
 
                        $value = substr( $this->text, $data['valueStartByte'],
                                $data['valueEndByte'] - $data['valueStartByte']
@@ -315,13 +319,15 @@ class ConfEditor {
                $target =& $array;
                if ( $path !== '' ) {
                        foreach ( $pathArr as $p ) {
-                               if( !isset( $target[$p] ) )
+                               if ( !isset( $target[$p] ) ) {
                                        $target[$p] = array();
+                               }
                                $target =& $target[$p];
                        }
                }
-               if ( !isset( $target[$key] ) )
+               if ( !isset( $target[$key] ) ) {
                        $target[$key] = $value;
+               }
        }
 
        /**
@@ -329,25 +335,30 @@ class ConfEditor {
         * @return mixed Parsed value
         */
        function parseScalar( $str ) {
-               if ( $str !== '' && $str[0] == '\'' )
+               if ( $str !== '' && $str[0] == '\'' ) {
                        // Single-quoted string
                        // @todo FIXME: trim() call is due to mystery bug where whitespace gets
                        // appended to the token; without it we ended up reading in the
                        // extra quote on the end!
                        return strtr( substr( trim( $str ), 1, -1 ),
                                array( '\\\'' => '\'', '\\\\' => '\\' ) );
-               if ( $str !== '' && $str[0] == '"' )
+               }
+               if ( $str !== '' && $str[0] == '"' ) {
                        // Double-quoted string
                        // @todo FIXME: trim() call is due to mystery bug where whitespace gets
                        // appended to the token; without it we ended up reading in the
                        // extra quote on the end!
                        return stripcslashes( substr( trim( $str ), 1, -1 ) );
-               if ( substr( $str, 0, 4 ) == 'true' )
+               }
+               if ( substr( $str, 0, 4 ) == 'true' ) {
                        return true;
-               if ( substr( $str, 0, 5 ) == 'false' )
+               }
+               if ( substr( $str, 0, 5 ) == 'false' ) {
                        return false;
-               if ( substr( $str, 0, 4 ) == 'null' )
+               }
+               if ( substr( $str, 0, 4 ) == 'null' ) {
                        return null;
+               }
                // Must be some kind of numeric value, so let PHP's weak typing
                // be useful for a change
                return $str;
@@ -617,16 +628,18 @@ class ConfEditor {
                                $this->expect( '=' );
                                $this->skipSpace();
                                $this->startPathValue();
-                               if ( $arrayAssign )
+                               if ( $arrayAssign ) {
                                        $this->pushState( 'expression', 'array assign end' );
-                               else
+                               } else {
                                        $this->pushState( 'expression', 'statement end' );
+                               }
                                break;
                        case 'array assign end':
                        case 'statement end':
                                $this->endPathValue();
-                               if ( $state == 'array assign end' )
+                               if ( $state == 'array assign end' ) {
                                        $this->popPath();
+                               }
                                $this->skipSpace();
                                $this->expect( ';' );
                                $this->nextPath( '@extra-' . ($this->serial++) );
index d0305d8..bac018e 100644 (file)
@@ -106,7 +106,7 @@ class MWCryptRand {
                                        }
                                }
                                // The absolute filename itself will differ from install to install so don't leave it out
-                               if( ( $path = realpath( $file ) ) !== false ) {
+                               if ( ( $path = realpath( $file ) ) !== false ) {
                                        $state .= $path;
                                } else {
                                        $state .= $file;
index c1076b2..7b9ac28 100644 (file)
@@ -78,7 +78,9 @@ abstract class DataUpdate implements DeferrableUpdate {
         * @throws Exception|null
         */
        public static function runUpdates( $updates ) {
-               if ( empty( $updates ) ) return; # nothing to do
+               if ( empty( $updates ) ) {
+                       return; # nothing to do
+               }
 
                $open_transactions = array();
                $exception = null;
index 93fddac..b42ae99 100644 (file)
@@ -333,7 +333,7 @@ class ErrorPageError extends MWException {
                // customized by the local wiki. So get the default English version for
                // passing to the parent constructor. Our overridden report() below
                // makes sure that the page shown to the user is not forced to English.
-               if( $msg instanceof Message ) {
+               if ( $msg instanceof Message ) {
                        $enMsg = clone( $msg );
                } else {
                        $enMsg = wfMessage( $msg, $params );
@@ -478,7 +478,7 @@ class UserBlockedError extends ErrorPageError {
                }
 
                $reason = $block->mReason;
-               if( $reason == '' ) {
+               if ( $reason == '' ) {
                        $reason = wfMessage( 'blockednoreason' )->text();
                }
 
index 996c14b..9400c41 100644 (file)
@@ -249,9 +249,13 @@ class WikiExporter {
                        $where = array( 'user_id = log_user' );
                        # Hide private logs
                        $hideLogs = LogEventsList::getExcludeClause( $this->db );
-                       if ( $hideLogs ) $where[] = $hideLogs;
+                       if ( $hideLogs ) {
+                               $where[] = $hideLogs;
+                       }
                        # Add on any caller specified conditions
-                       if ( $cond ) $where[] = $cond;
+                       if ( $cond ) {
+                               $where[] = $cond;
+                       }
                        # Get logging table name for logging.* clause
                        $logging = $this->db->tableName( 'logging' );
 
@@ -638,7 +642,7 @@ class XmlDumpWriter {
 
                $out = "    <revision>\n";
                $out .= "      " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n";
-               if( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
+               if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
                        $out .= "      " . Xml::element( 'parentid', null, strval( $row->rev_parent_id ) ) . "\n";
                }
 
index 2e19a09..cdf6c88 100644 (file)
@@ -35,13 +35,13 @@ class Fallback {
                if ( substr( $to, -8 ) == '//IGNORE' ) {
                        $to = substr( $to, 0, strlen( $to ) - 8 );
                }
-               if( strcasecmp( $from, $to ) == 0 ) {
+               if ( strcasecmp( $from, $to ) == 0 ) {
                        return $string;
                }
-               if( strcasecmp( $from, 'utf-8' ) == 0 ) {
+               if ( strcasecmp( $from, 'utf-8' ) == 0 ) {
                        return utf8_decode( $string );
                }
-               if( strcasecmp( $to, 'utf-8' ) == 0 ) {
+               if ( strcasecmp( $to, 'utf-8' ) == 0 ) {
                        return utf8_encode( $string );
                }
                return $string;
@@ -64,12 +64,12 @@ class Fallback {
         * @return string
         */
        public static function mb_substr( $str, $start, $count = 'end' ) {
-               if( $start != 0 ) {
+               if ( $start != 0 ) {
                        $split = self::mb_substr_split_unicode( $str, intval( $start ) );
                        $str = substr( $str, $split );
                }
 
-               if( $count !== 'end' ) {
+               if ( $count !== 'end' ) {
                        $split = self::mb_substr_split_unicode( $str, intval( $count ) );
                        $str = substr( $str, 0, $split );
                }
@@ -83,14 +83,14 @@ class Fallback {
         * @return int
         */
        public static function mb_substr_split_unicode( $str, $splitPos ) {
-               if( $splitPos == 0 ) {
+               if ( $splitPos == 0 ) {
                        return 0;
                }
 
                $byteLen = strlen( $str );
 
-               if( $splitPos > 0 ) {
-                       if( $splitPos > 256 ) {
+               if ( $splitPos > 0 ) {
+                       if ( $splitPos > 256 ) {
                                // Optimize large string offsets by skipping ahead N bytes.
                                // This will cut out most of our slow time on Latin-based text,
                                // and 1/2 to 1/3 on East European and Asian scripts.
@@ -104,7 +104,7 @@ class Fallback {
                                $bytePos = 0;
                        }
 
-                       while( $charPos++ < $splitPos ) {
+                       while ( $charPos++ < $splitPos ) {
                                ++$bytePos;
                                // Move past any tail bytes
                                while ( $bytePos < $byteLen && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
@@ -115,7 +115,7 @@ class Fallback {
                        $splitPosX = $splitPos + 1;
                        $charPos = 0; // relative to end of string; we don't care about the actual char position here
                        $bytePos = $byteLen;
-                       while( $bytePos > 0 && $charPos-- >= $splitPosX ) {
+                       while ( $bytePos > 0 && $charPos-- >= $splitPosX ) {
                                --$bytePos;
                                // Move past any tail bytes
                                while ( $bytePos > 0 && $str[$bytePos] >= "\x80" && $str[$bytePos] < "\xc0" ) {
@@ -138,12 +138,12 @@ class Fallback {
                $total = 0;
 
                // Count ASCII bytes
-               for( $i = 0; $i < 0x80; $i++ ) {
+               for ( $i = 0; $i < 0x80; $i++ ) {
                        $total += $counts[$i];
                }
 
                // Count multibyte sequence heads
-               for( $i = 0xc0; $i < 0xff; $i++ ) {
+               for ( $i = 0xc0; $i < 0xff; $i++ ) {
                        $total += $counts[$i];
                }
                return $total;
@@ -163,7 +163,7 @@ class Fallback {
                $ar = array();
                preg_match( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset );
 
-               if( isset( $ar[0][1] ) ) {
+               if ( isset( $ar[0][1] ) ) {
                        return $ar[0][1];
                } else {
                        return false;
@@ -184,7 +184,7 @@ class Fallback {
                $ar = array();
                preg_match_all( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset );
 
-               if( isset( $ar[0] ) && count( $ar[0] ) > 0 &&
+               if ( isset( $ar[0] ) && count( $ar[0] ) > 0 &&
                        isset( $ar[0][count( $ar[0] ) - 1][1] ) ) {
                        return $ar[0][count( $ar[0] ) - 1][1];
                } else {
index caf2e57..635b04e 100644 (file)
@@ -245,7 +245,7 @@ abstract class ChannelFeed extends FeedItem {
                global $wgRequest;
                $ctype = $wgRequest->getVal( 'ctype', 'application/xml' );
                $allowedctypes = array( 'application/xml', 'text/xml', 'application/rss+xml', 'application/atom+xml' );
-               return (in_array( $ctype, $allowedctypes ) ? $ctype : 'application/xml');
+               return ( in_array( $ctype, $allowedctypes ) ? $ctype : 'application/xml' );
        }
 
        /**
@@ -306,13 +306,13 @@ class RSSFeed extends ChannelFeed {
        function outItem( $item ) {
        ?>
                <item>
-                       <title><?php print $item->getTitle() ?></title>
-                       <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?></link>
-                       <guid<?php if( !$item->rssIsPermalink ) print ' isPermaLink="false"' ?>><?php print $item->getUniqueId() ?></guid>
+                       <title><?php print $item->getTitle(); ?></title>
+                       <link><?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ); ?></link>
+                       <guid<?php if ( !$item->rssIsPermalink ) { print ' isPermaLink="false"'; } ?>><?php print $item->getUniqueId(); ?></guid>
                        <description><?php print $item->getDescription() ?></description>
-                       <?php if( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ) ?></pubDate><?php } ?>
-                       <?php if( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor() ?></dc:creator><?php }?>
-                       <?php if( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ) ?></comments><?php }?>
+                       <?php if ( $item->getDate() ) { ?><pubDate><?php print $this->formatTime( $item->getDate() ); ?></pubDate><?php } ?>
+                       <?php if ( $item->getAuthor() ) { ?><dc:creator><?php print $item->getAuthor(); ?></dc:creator><?php }?>
+                       <?php if ( $item->getComments() ) { ?><comments><?php print wfExpandUrl( $item->getComments(), PROTO_CURRENT ); ?></comments><?php }?>
                </item>
 <?php
        }
@@ -392,15 +392,15 @@ class AtomFeed extends ChannelFeed {
                global $wgMimeType;
        ?>
        <entry>
-               <id><?php print $item->getUniqueId() ?></id>
-               <title><?php print $item->getTitle() ?></title>
-               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ) ?>"/>
-               <?php if( $item->getDate() ) { ?>
-               <updated><?php print $this->formatTime( $item->getDate() ) ?>Z</updated>
+               <id><?php print $item->getUniqueId(); ?></id>
+               <title><?php print $item->getTitle(); ?></title>
+               <link rel="alternate" type="<?php print $wgMimeType ?>" href="<?php print wfExpandUrl( $item->getUrl(), PROTO_CURRENT ); ?>"/>
+               <?php if ( $item->getDate() ) { ?>
+               <updated><?php print $this->formatTime( $item->getDate() ); ?>Z</updated>
                <?php } ?>
 
                <summary type="html"><?php print $item->getDescription() ?></summary>
-               <?php if( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor() ?></name></author><?php }?>
+               <?php if ( $item->getAuthor() ) { ?><author><name><?php print $item->getAuthor(); ?></name></author><?php }?>
        </entry>
 
 <?php /* @todo FIXME: Need to add comments
index 4842c38..6f3b42c 100644 (file)
@@ -59,7 +59,7 @@ class FeedUtils {
                        return false;
                }
 
-               if( !isset( $wgFeedClasses[$type] ) ) {
+               if ( !isset( $wgFeedClasses[$type] ) ) {
                        $wgOut->addWikiMsg( 'feed-invalid' );
                        return false;
                }
@@ -77,7 +77,7 @@ class FeedUtils {
                $titleObj = Title::makeTitle( $row->rc_namespace, $row->rc_title );
                $timestamp = wfTimestamp( TS_MW, $row->rc_timestamp );
                $actiontext = '';
-               if( $row->rc_type == RC_LOG ) {
+               if ( $row->rc_type == RC_LOG ) {
                        $rcRow = (array)$row; // newFromRow() only accepts arrays for RC rows
                        $actiontext = LogFormatter::newFromRow( $rcRow )->getActionText();
                }
@@ -121,12 +121,12 @@ class FeedUtils {
 
                // Can't diff special pages, unreadable pages or pages with no new revision
                // to compare against: just return the text.
-               if( $title->getNamespace() < 0 || $accErrors || !$newid ) {
+               if ( $title->getNamespace() < 0 || $accErrors || !$newid ) {
                        wfProfileOut( __METHOD__ );
                        return $completeText;
                }
 
-               if( $oldid ) {
+               if ( $oldid ) {
                        wfProfileIn( __METHOD__ . "-dodiff" );
 
                        #$diffText = $de->getDiff( wfMessage( 'revisionasof',
@@ -171,7 +171,7 @@ class FeedUtils {
                        wfProfileOut( __METHOD__ . "-dodiff" );
                } else {
                        $rev = Revision::newFromId( $newid );
-                       if( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
+                       if ( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
                                $newContent = ContentHandler::getForTitle( $title )->makeEmptyContent();
                        } else {
                                $newContent = $rev->getContent();
@@ -250,7 +250,7 @@ class FeedUtils {
                        'diffchange'       => 'font-weight: bold; text-decoration: none;',
                );
 
-               foreach( $styles as $class => $style ) {
+               foreach ( $styles as $class => $style ) {
                        $text = preg_replace( "/(<[^>]+)class=(['\"])$class\\2([^>]*>)/",
                                "\\1style=\"$style\"\\3", $text );
                }
index 9ce2f76..9fc70eb 100644 (file)
@@ -82,18 +82,18 @@ class FileDeleteForm {
                # Flag to hide all contents of the archived revisions
                $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' );
 
-               if( $this->oldimage ) {
+               if ( $this->oldimage ) {
                        $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage );
                }
 
-               if( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) {
+               if ( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) {
                        $wgOut->addHTML( $this->prepareMessage( 'filedelete-nofile' ) );
                        $wgOut->addReturnTo( $this->title );
                        return;
                }
 
                // Perform the deletion if appropriate
-               if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) {
+               if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) {
                        $deleteReasonList = $wgRequest->getText( 'wpDeleteReasonList' );
                        $deleteReason = $wgRequest->getText( 'wpReason' );
 
@@ -109,11 +109,11 @@ class FileDeleteForm {
 
                        $status = self::doDelete( $this->title, $this->file, $this->oldimage, $reason, $suppress, $wgUser );
 
-                       if( !$status->isGood() ) {
+                       if ( !$status->isGood() ) {
                                $wgOut->addHTML( '<h2>' . $this->prepareMessage( 'filedeleteerror-short' ) . "</h2>\n" );
                                $wgOut->addWikiText( '<div class="error">' . $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) . '</div>' );
                        }
-                       if( $status->ok ) {
+                       if ( $status->ok ) {
                                $wgOut->setPageTitle( wfMessage( 'actioncomplete' ) );
                                $wgOut->addHTML( $this->prepareMessage( 'filedelete-success' ) );
                                // Return to the main page if we just deleted all versions of the
@@ -153,13 +153,13 @@ class FileDeleteForm {
                        $user = $wgUser;
                }
 
-               if( $oldimage ) {
+               if ( $oldimage ) {
                        $page = null;
                        $status = $file->deleteOld( $oldimage, $reason, $suppress );
-                       if( $status->ok ) {
+                       if ( $status->ok ) {
                                // Need to do a log item
                                $logComment = wfMessage( 'deletedrevision', $oldimage )->inContentLanguage()->text();
-                               if( trim( $reason ) != '' ) {
+                               if ( trim( $reason ) != '' ) {
                                        $logComment .= wfMessage( 'colon-separator' )
                                                ->inContentLanguage()->text() . $reason;
                                }
@@ -187,7 +187,7 @@ class FileDeleteForm {
                                // or revision is missing, so check for isOK() rather than isGood()
                                if ( $deleteStatus->isOK() ) {
                                        $status = $file->delete( $reason, $suppress );
-                                       if( $status->isOK() ) {
+                                       if ( $status->isOK() ) {
                                                $dbw->commit( __METHOD__ );
                                        } else {
                                                $dbw->rollback( __METHOD__ );
@@ -213,7 +213,7 @@ class FileDeleteForm {
        private function showForm() {
                global $wgOut, $wgUser, $wgRequest;
 
-               if( $wgUser->isAllowed( 'suppressrevision' ) ) {
+               if ( $wgUser->isAllowed( 'suppressrevision' ) ) {
                        $suppress = "<tr id=\"wpDeleteSuppressRow\">
                                        <td></td>
                                        <td class='mw-input'><strong>" .
@@ -258,7 +258,7 @@ class FileDeleteForm {
                                "</td>
                        </tr>
                        {$suppress}";
-               if( $wgUser->isLoggedIn() ) {
+               if ( $wgUser->isLoggedIn() ) {
                        $form .= "
                        <tr>
                                <td></td>
@@ -314,7 +314,7 @@ class FileDeleteForm {
         */
        private function prepareMessage( $message ) {
                global $wgLang;
-               if( $this->oldimage ) {
+               if ( $this->oldimage ) {
                        return wfMessage(
                                "{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old'
                                wfEscapeWikiText( $this->title->getText() ),
@@ -375,7 +375,7 @@ class FileDeleteForm {
                $q = array();
                $q['action'] = 'delete';
 
-               if( $this->oldimage ) {
+               if ( $this->oldimage ) {
                        $q['oldimage'] = $this->oldimage;
                }
 
index 89ad955..ced45af 100644 (file)
@@ -121,7 +121,9 @@ class ForkController {
                        if ( function_exists( 'pcntl_signal_dispatch' ) ) {
                                pcntl_signal_dispatch();
                        } else {
-                               declare (ticks=1) { $status = $status; }
+                               declare( ticks = 1 ) {
+                                       $status = $status;
+                               }
                        }
                        // Respond to TERM signal
                        if ( $this->termReceived ) {
index 8477ed9..0a5cb68 100644 (file)
@@ -292,13 +292,17 @@ class FormOptions implements ArrayAccess {
 
                        switch( $type ) {
                                case self::BOOL:
-                                       $value = $r->getBool( $name, $default ); break;
+                                       $value = $r->getBool( $name, $default );
+                                       break;
                                case self::INT:
-                                       $value = $r->getInt( $name, $default ); break;
+                                       $value = $r->getInt( $name, $default );
+                                       break;
                                case self::STRING:
-                                       $value = $r->getText( $name, $default ); break;
+                                       $value = $r->getText( $name, $default );
+                                       break;
                                case self::INTNULL:
-                                       $value = $r->getIntOrNull( $name ); break;
+                                       $value = $r->getIntOrNull( $name );
+                                       break;
                                default:
                                        throw new MWException( 'Unsupported datatype' );
                        }
index bf3bff7..a54b807 100644 (file)
@@ -177,7 +177,7 @@ class GitInfo {
                if ( isset( $configArray['remote origin'] ) ) {
                        $remote = $configArray['remote origin'];
                } else {
-                       foreach( $configArray as $sectionName => $sectionConf ) {
+                       foreach ( $configArray as $sectionName => $sectionConf ) {
                                if ( substr( $sectionName, 0, 6 ) == 'remote' ) {
                                        $remote = $sectionConf;
                                }
@@ -192,7 +192,7 @@ class GitInfo {
                if ( substr( $url, -4 ) !== '.git' ) {
                        $url .= '.git';
                }
-               foreach( self::getViewers() as $repo => $viewer ) {
+               foreach ( self::getViewers() as $repo => $viewer ) {
                        $pattern = '#^' . $repo . '$#';
                        if ( preg_match( $pattern, $url ) ) {
                                $viewerUrl = preg_replace( $pattern, $viewer, $url );
@@ -238,7 +238,7 @@ class GitInfo {
        protected static function getViewers() {
                global $wgGitRepositoryViewers;
 
-               if( self::$viewers === false ) {
+               if ( self::$viewers === false ) {
                        self::$viewers = $wgGitRepositoryViewers;
                        wfRunHooks( 'GitViewers', array( &self::$viewers ) );
                }
index e204087..b7bdcfd 100644 (file)
@@ -277,7 +277,9 @@ class HTMLForm extends ContextSource {
         * done already.
         * @deprecated since 1.18 load modules with ResourceLoader instead
         */
-       static function addJS() { wfDeprecated( __METHOD__, '1.18' ); }
+       static function addJS() {
+               wfDeprecated( __METHOD__, '1.18' );
+       }
 
        /**
         * Initialise a new Object for the field
@@ -1978,10 +1980,11 @@ class HTMLSelectField extends HTMLFormField {
 
                $validOptions = HTMLFormField::flattenOptions( $this->mParams['options'] );
 
-               if ( in_array( $value, $validOptions ) )
+               if ( in_array( $value, $validOptions ) ) {
                        return true;
-               else
+               } else {
                        return $this->msg( 'htmlform-select-badoption' )->parse();
+               }
        }
 
        function getInputHTML( $value ) {
@@ -2530,7 +2533,9 @@ class HTMLHiddenField extends HTMLFormField {
                return $this->getTableRow( $value );
        }
 
-       public function getInputHTML( $value ) { return ''; }
+       public function getInputHTML( $value ) {
+               return '';
+       }
 }
 
 /**
index 976d36d..10a3c9c 100644 (file)
@@ -51,7 +51,7 @@ class HashRing {
                // Fit the map to weight-proportionate one with a space of size RING_SIZE
                $standardMap = array();
                foreach ( $map as $location => $weight ) {
-                       $standardMap[$location] = (int)floor( $weight/$sum * self::RING_SIZE );
+                       $standardMap[$location] = (int)floor( $weight / $sum * self::RING_SIZE );
                }
                // Build a ring of RING_SIZE spots, with each location at a spot in location hash order
                $index = 0;
index 1af733a..8d83751 100644 (file)
@@ -231,16 +231,16 @@ class HistoryBlobStub {
         * @return string
         */
        function getText() {
-               if( isset( self::$blobCache[$this->mOldId] ) ) {
+               if ( isset( self::$blobCache[$this->mOldId] ) ) {
                        $obj = self::$blobCache[$this->mOldId];
                } else {
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow( 'text', array( 'old_flags', 'old_text' ), array( 'old_id' => $this->mOldId ) );
-                       if( !$row ) {
+                       if ( !$row ) {
                                return false;
                        }
                        $flags = explode( ',', $row->old_flags );
-                       if( in_array( 'external', $flags ) ) {
+                       if ( in_array( 'external', $flags ) ) {
                                $url = $row->old_text;
                                $parts = explode( '://', $url, 2 );
                                if ( !isset( $parts[1] ) || $parts[1] == '' ) {
@@ -249,11 +249,11 @@ class HistoryBlobStub {
                                $row->old_text = ExternalStore::fetchFromUrl( $url );
 
                        }
-                       if( !in_array( 'object', $flags ) ) {
+                       if ( !in_array( 'object', $flags ) ) {
                                return false;
                        }
 
-                       if( in_array( 'gzip', $flags ) ) {
+                       if ( in_array( 'gzip', $flags ) ) {
                                // This shouldn't happen, but a bug in the compress script
                                // may at times gzip-compress a HistoryBlob object row.
                                $obj = unserialize( gzinflate( $row->old_text ) );
@@ -261,7 +261,7 @@ class HistoryBlobStub {
                                $obj = unserialize( $row->old_text );
                        }
 
-                       if( !is_object( $obj ) ) {
+                       if ( !is_object( $obj ) ) {
                                // Correct for old double-serialization bug.
                                $obj = unserialize( $obj );
                        }
@@ -318,7 +318,7 @@ class HistoryBlobCurStub {
        function getText() {
                $dbr = wfGetDB( DB_SLAVE );
                $row = $dbr->selectRow( 'cur', array( 'cur_text' ), array( 'cur_id' => $this->mCurId ) );
-               if( !$row ) {
+               if ( !$row ) {
                        return false;
                }
                return $row->cur_text;
index 740abf7..16fee41 100644 (file)
@@ -66,7 +66,7 @@ class Hooks {
         * @param $callback Mixed: callback function to attach
         */
        public static function register( $name, $callback ) {
-               if( !isset( self::$handlers[$name] ) ) {
+               if ( !isset( self::$handlers[$name] ) ) {
                        self::$handlers[$name] = array();
                }
 
@@ -265,11 +265,11 @@ class Hooks {
                        /* String return is an error; false return means stop processing. */
                        if ( is_string( $retval ) ) {
                                throw new FatalError( $retval );
-                       } elseif( $retval === null ) {
+                       } elseif ( $retval === null ) {
                                if ( $closure ) {
                                        $prettyFunc = "$event closure";
-                               } elseif( is_array( $callback ) ) {
-                                       if( is_object( $callback[0] ) ) {
+                               } elseif ( is_array( $callback ) ) {
+                                       if ( is_object( $callback[0] ) ) {
                                                $prettyClass = get_class( $callback[0] );
                                        } else {
                                                $prettyClass = strval( $callback[0] );
index 07bb42b..cb082a1 100644 (file)
@@ -207,7 +207,7 @@ class Html {
                        );
 
                        // Allow more input types in HTML5 mode
-                       if( $wgHtml5 ) {
+                       if ( $wgHtml5 ) {
                                $validTypes = array_merge( $validTypes, array(
                                        'datetime',
                                        'datetime-local',
@@ -340,7 +340,7 @@ class Html {
 
                foreach ( $attribs as $attrib => $value ) {
                        $lcattrib = strtolower( $attrib );
-                       if( is_array( $value ) ) {
+                       if ( is_array( $value ) ) {
                                $value = implode( ' ', $value );
                        } else {
                                $value = strval( $value );
@@ -962,7 +962,7 @@ class Html {
         */
        static function srcSet( $urls ) {
                $candidates = array();
-               foreach( $urls as $density => $url ) {
+               foreach ( $urls as $density => $url ) {
                        // Image candidate syntax per current whatwg live spec, 2012-09-23:
                        // http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#attr-img-srcset
                        $candidates[] = "{$url} {$density}x";
index 489a83a..28daf91 100644 (file)
@@ -232,7 +232,7 @@ class MWHttpRequest {
                } else {
                        $this->timeout = $wgHTTPTimeout;
                }
-               if( isset( $options['userAgent'] ) ) {
+               if ( isset( $options['userAgent'] ) ) {
                        $this->setUserAgent( $options['userAgent'] );
                }
 
@@ -841,7 +841,7 @@ class PhpHttpRequest extends MWHttpRequest {
                if ( $this->method == 'POST' ) {
                        // Required for HTTP 1.0 POSTs
                        $this->reqHeaders['Content-Length'] = strlen( $this->postData );
-                       if( !isset( $this->reqHeaders['Content-Type'] ) ) {
+                       if ( !isset( $this->reqHeaders['Content-Type'] ) ) {
                                $this->reqHeaders['Content-Type'] = "application/x-www-form-urlencoded";
                        }
                }
index 72b9a52..0a8faa2 100644 (file)
@@ -33,7 +33,7 @@ define( 'RE_IP_BLOCK', RE_IP_ADD . '\/' . RE_IP_PREFIX );
 // An IPv6 address is made up of 8 words (each x0000 to xFFFF).
 // However, the "::" abbreviation can be used on consecutive x0000 words.
 define( 'RE_IPV6_WORD', '([0-9A-Fa-f]{1,4})' );
-define( 'RE_IPV6_PREFIX', '(12[0-8]|1[01][0-9]|[1-9]?\d)');
+define( 'RE_IPV6_PREFIX', '(12[0-8]|1[01][0-9]|[1-9]?\d)' );
 define( 'RE_IPV6_ADD',
        '(?:' . // starts with "::" (including "::")
                ':(?::|(?::' . RE_IPV6_WORD . '){1,7})' .
@@ -392,11 +392,11 @@ class IP {
                static $privateRanges = false;
                if ( !$privateRanges ) {
                        $privateRanges = array(
-                               array( '10.0.0.0',    '10.255.255.255' ),   # RFC 1918 (private)
-                               array( '172.16.0.0',  '172.31.255.255' ),   #     "
-                               array( '192.168.0.0', '192.168.255.255' ),  #     "
-                               array( '0.0.0.0',     '0.255.255.255' ),    # this network
-                               array( '127.0.0.0',   '127.255.255.255' ),  # loopback
+                               array( '10.0.0.0', '10.255.255.255' ), # RFC 1918 (private)
+                               array( '172.16.0.0', '172.31.255.255' ), # RFC 1918 (private)
+                               array( '192.168.0.0', '192.168.255.255' ), # RFC 1918 (private)
+                               array( '0.0.0.0', '0.255.255.255' ), # this network
+                               array( '127.0.0.0', '127.255.255.255' ), # loopback
                        );
                }
 
index 8f8022f..43cf7f6 100644 (file)
@@ -282,11 +282,11 @@ class ImageGallery {
                                $img = false;
                        }
 
-                       if( !$img ) {
+                       if ( !$img ) {
                                # We're dealing with a non-image, spit out the name and be done with it.
                                $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
                                        . htmlspecialchars( $nt->getText() ) . '</div>';
-                       } elseif( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
+                       } elseif ( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
                                # The image is blacklisted, just show it as a text link.
                                $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">' .
                                        Linker::link(
@@ -297,7 +297,7 @@ class ImageGallery {
                                                array( 'known', 'noclasses' )
                                        ) .
                                        '</div>';
-                       } elseif( !( $thumb = $img->transform( $params ) ) ) {
+                       } elseif ( !( $thumb = $img->transform( $params ) ) ) {
                                # Error generating thumbnail.
                                $thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
                                        . htmlspecialchars( $img->getLastError() ) . '</div>';
@@ -334,8 +334,8 @@ class ImageGallery {
                        // $linkTarget = Title::newFromText( $wgContLang->getNsText( MWNamespace::getUser() ) . ":{$ut}" );
                        // $ul = Linker::link( $linkTarget, $ut );
 
-                       if( $this->mShowBytes ) {
-                               if( $img ) {
+                       if ( $this->mShowBytes ) {
+                               if ( $img ) {
                                        $fileSize = htmlspecialchars( $lang->formatSize( $img->getSize() ) );
                                } else {
                                        $fileSize = wfMessage( 'filemissing' )->escaped();
index 5e51878..e687046 100644 (file)
@@ -206,7 +206,7 @@ class ImagePage extends Article {
                }
 
                // Add remote Filepage.css
-               if( !$this->repo->isLocal() ) {
+               if ( !$this->repo->isLocal() ) {
                        $css = $this->repo->getDescriptionStylesheetUrl();
                        if ( $css ) {
                                $out->addStyle( $css );
@@ -597,7 +597,7 @@ EOT
                $descText = $this->mPage->getFile()->getDescriptionText();
 
                /* Add canonical to head if there is no local page for this shared file */
-               if( $descUrl && $this->mPage->getID() == 0 ) {
+               if ( $descUrl && $this->mPage->getID() == 0 ) {
                        $out->setCanonicalUrl( $descUrl );
                }
 
@@ -753,7 +753,7 @@ EOT
 
                // Create links for every element
                $currentCount = 0;
-               foreach( $rows as $element ) {
+               foreach ( $rows as $element ) {
                        $currentCount++;
                        if ( $currentCount > $limit ) {
                                break;
index b9ec6e0..eeec5cd 100644 (file)
@@ -41,12 +41,12 @@ abstract class ImageQueryPage extends QueryPage {
         * @param int $offset Paging offset
         */
        protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
-               if( $num > 0 ) {
+               if ( $num > 0 ) {
                        $gallery = new ImageGallery();
 
                        # $res might contain the whole 1,000 rows, so we read up to
                        # $num [should update this to use a Pager]
-                       for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
+                       for ( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
                                $namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
                                $title = Title::makeTitleSafe( $namespace, $row->title );
                                if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
index 0e12e6d..8220287 100644 (file)
@@ -66,7 +66,7 @@ class WikiImporter {
        }
 
        private function debug( $data ) {
-               if( $this->mDebug ) {
+               if ( $this->mDebug ) {
                        wfDebug( "IMPORT: $data\n" );
                }
        }
@@ -188,10 +188,10 @@ class WikiImporter {
         * @return bool
         */
        public function setTargetNamespace( $namespace ) {
-               if( is_null( $namespace ) ) {
+               if ( is_null( $namespace ) ) {
                        // Don't override namespaces
                        $this->mTargetNamespace = null;
-               } elseif( $namespace >= 0 ) {
+               } elseif ( $namespace >= 0 ) {
                        // @todo FIXME: Check for validity
                        $this->mTargetNamespace = intval( $namespace );
                } else {
@@ -206,16 +206,16 @@ class WikiImporter {
         */
        public function setTargetRootPage( $rootpage ) {
                $status = Status::newGood();
-               if( is_null( $rootpage ) ) {
+               if ( is_null( $rootpage ) ) {
                        // No rootpage
                        $this->mTargetRootPage = null;
-               } elseif( $rootpage !== '' ) {
+               } elseif ( $rootpage !== '' ) {
                        $rootpage = rtrim( $rootpage, '/' ); //avoid double slashes
                        $title = Title::newFromText( $rootpage, !is_null( $this->mTargetNamespace ) ? $this->mTargetNamespace : NS_MAIN );
-                       if( !$title || $title->isExternal() ) {
+                       if ( !$title || $title->isExternal() ) {
                                $status->fatal( 'import-rootpage-invalid' );
                        } else {
-                               if( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
+                               if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
                                        global $wgContLang;
 
                                        $displayNSText = $title->getNamespace() == NS_MAIN
@@ -304,7 +304,7 @@ class WikiImporter {
         */
        public function debugRevisionHandler( &$revision ) {
                $this->debug( "Got revision:" );
-               if( is_object( $revision->title ) ) {
+               if ( is_object( $revision->title ) ) {
                        $this->debug( "-- Title: " . $revision->title->getPrefixedText() );
                } else {
                        $this->debug( "-- Title: <invalid>" );
@@ -320,7 +320,7 @@ class WikiImporter {
         * @param $title Title
         */
        function pageCallback( $title ) {
-               if( isset( $this->mPageCallback ) ) {
+               if ( isset( $this->mPageCallback ) ) {
                        call_user_func( $this->mPageCallback, $title );
                }
        }
@@ -334,7 +334,7 @@ class WikiImporter {
         * @param array $pageInfo associative array of page information
         */
        private function pageOutCallback( $title, $origTitle, $revCount, $sucCount, $pageInfo ) {
-               if( isset( $this->mPageOutCallback ) ) {
+               if ( isset( $this->mPageOutCallback ) ) {
                        $args = func_get_args();
                        call_user_func_array( $this->mPageOutCallback, $args );
                }
@@ -376,11 +376,11 @@ class WikiImporter {
         * @access private
         */
        private function nodeContents() {
-               if( $this->reader->isEmptyElement ) {
+               if ( $this->reader->isEmptyElement ) {
                        return "";
                }
                $buffer = "";
-               while( $this->reader->read() ) {
+               while ( $this->reader->read() ) {
                        switch( $this->reader->nodeType ) {
                        case XmlReader::TEXT:
                        case XmlReader::SIGNIFICANT_WHITESPACE:
@@ -420,10 +420,10 @@ class WikiImporter {
                                "END_ELEMENT",
                                "END_ENTITY",
                                "XML_DECLARATION",
-                               );
+                       );
                        $lookup = array();
 
-                       foreach( $xmlReaderConstants as $name ) {
+                       foreach ( $xmlReaderConstants as $name ) {
                                $lookup[constant("XmlReader::$name")] = $name;
                        }
                }
@@ -666,7 +666,7 @@ class WikiImporter {
        private function processRevision( $pageInfo, $revisionInfo ) {
                $revision = new WikiRevision;
 
-               if( isset( $revisionInfo['id'] ) ) {
+               if ( isset( $revisionInfo['id'] ) ) {
                        $revision->setID( $revisionInfo['id'] );
                }
                if ( isset( $revisionInfo['text'] ) ) {
@@ -840,33 +840,33 @@ class WikiImporter {
                $workTitle = $text;
                $origTitle = Title::newFromText( $workTitle );
 
-               if( !is_null( $this->mTargetNamespace ) && !is_null( $origTitle ) ) {
+               if ( !is_null( $this->mTargetNamespace ) && !is_null( $origTitle ) ) {
                        # makeTitleSafe, because $origTitle can have a interwiki (different setting of interwiki map)
                        # and than dbKey can begin with a lowercase char
                        $title = Title::makeTitleSafe( $this->mTargetNamespace,
                                $origTitle->getDBkey() );
                } else {
-                       if( !is_null( $this->mTargetRootPage ) ) {
+                       if ( !is_null( $this->mTargetRootPage ) ) {
                                $workTitle = $this->mTargetRootPage . '/' . $workTitle;
                        }
                        $title = Title::newFromText( $workTitle );
                }
 
-               if( is_null( $title ) ) {
+               if ( is_null( $title ) ) {
                        # Invalid page title? Ignore the page
                        $this->notice( 'import-error-invalid', $workTitle );
                        return false;
-               } elseif( $title->isExternal() ) {
+               } elseif ( $title->isExternal() ) {
                        $this->notice( 'import-error-interwiki', $title->getPrefixedText() );
                        return false;
-               } elseif( !$title->canExist() ) {
+               } elseif ( !$title->canExist() ) {
                        $this->notice( 'import-error-special', $title->getPrefixedText() );
                        return false;
-               } elseif( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
+               } elseif ( !$title->userCan( 'edit' ) && !$wgCommandLineMode ) {
                        # Do not import if the importing wiki user cannot edit this page
                        $this->notice( 'import-error-edit', $title->getPrefixedText() );
                        return false;
-               } elseif( !$title->exists() && !$title->userCan( 'create' ) && !$wgCommandLineMode ) {
+               } elseif ( !$title->exists() && !$title->userCan( 'create' ) && !$wgCommandLineMode ) {
                        # Do not import if the importing wiki user cannot create this page
                        $this->notice( 'import-error-create', $title->getPrefixedText() );
                        return false;
@@ -997,11 +997,11 @@ class XMLReader2 extends XMLReader {
         * @return bool|string
         */
        function nodeContents() {
-               if( $this->isEmptyElement ) {
+               if ( $this->isEmptyElement ) {
                        return "";
                }
                $buffer = "";
-               while( $this->read() ) {
+               while ( $this->read() ) {
                        switch( $this->nodeType ) {
                        case XmlReader::TEXT:
                        case XmlReader::SIGNIFICANT_WHITESPACE:
@@ -1051,9 +1051,9 @@ class WikiRevision {
         * @throws MWException
         */
        function setTitle( $title ) {
-               if( is_object( $title ) ) {
+               if ( is_object( $title ) ) {
                        $this->title = $title;
-               } elseif( is_null( $title ) ) {
+               } elseif ( is_null( $title ) ) {
                        throw new MWException( "WikiRevision given a null title in import. You may need to adjust \$wgLegalTitleChars." );
                } else {
                        throw new MWException( "WikiRevision given non-object title in import." );
@@ -1369,7 +1369,7 @@ class WikiRevision {
 
                # Sneak a single revision into place
                $user = User::newFromName( $this->getUser() );
-               if( $user ) {
+               if ( $user ) {
                        $userId = intval( $user->getId() );
                        $userText = $user->getName();
                        $userObj = $user;
@@ -1384,7 +1384,7 @@ class WikiRevision {
                $linkCache->clear();
 
                $page = WikiPage::factory( $this->title );
-               if( !$page->exists() ) {
+               if ( !$page->exists() ) {
                        # must create the page...
                        $pageId = $page->insertOn( $dbw );
                        $created = true;
@@ -1400,7 +1400,7 @@ class WikiRevision {
                                        'rev_comment' => $this->getComment() ),
                                __METHOD__
                        );
-                       if( $prior ) {
+                       if ( $prior ) {
                                // @todo FIXME: This could fail slightly for multiple matches :P
                                wfDebug( __METHOD__ . ": skipping existing revision for [[" .
                                        $this->title->getPrefixedText() . "]], timestamp " . $this->timestamp . "\n" );
@@ -1440,7 +1440,7 @@ class WikiRevision {
        function importLogItem() {
                $dbw = wfGetDB( DB_MASTER );
                # @todo FIXME: This will not record autoblocks
-               if( !$this->getTitle() ) {
+               if ( !$this->getTitle() ) {
                        wfDebug( __METHOD__ . ": skipping invalid {$this->type}/{$this->action} log time, timestamp " .
                                $this->timestamp . "\n" );
                        return;
@@ -1459,7 +1459,7 @@ class WikiRevision {
                        __METHOD__
                );
                // @todo FIXME: This could fail slightly for multiple matches :P
-               if( $prior ) {
+               if ( $prior ) {
                        wfDebug( __METHOD__ . ": skipping existing item for Log:{$this->type}/{$this->action}, timestamp " .
                                $this->timestamp . "\n" );
                        return;
@@ -1500,7 +1500,7 @@ class WikiRevision {
                                wfDebug( __METHOD__ . "File already exists; importing as $archiveName\n" );
                        }
                }
-               if( !$file ) {
+               if ( !$file ) {
                        wfDebug( __METHOD__ . ': Bad file for ' . $this->getTitle() . "\n" );
                        return false;
                }
@@ -1512,7 +1512,7 @@ class WikiRevision {
                        $source = $this->downloadSource();
                        $flags |= File::DELETE_SOURCE;
                }
-               if( !$source ) {
+               if ( !$source ) {
                        wfDebug( __METHOD__ . ": Could not fetch remote file.\n" );
                        return false;
                }
@@ -1551,13 +1551,13 @@ class WikiRevision {
         */
        function downloadSource() {
                global $wgEnableUploads;
-               if( !$wgEnableUploads ) {
+               if ( !$wgEnableUploads ) {
                        return false;
                }
 
                $tempo = tempnam( wfTempDir(), 'download' );
                $f = fopen( $tempo, 'wb' );
-               if( !$f ) {
+               if ( !$f ) {
                        wfDebug( "IMPORT: couldn't write to temp file $tempo\n" );
                        return false;
                }
@@ -1565,7 +1565,7 @@ class WikiRevision {
                // @todo FIXME!
                $src = $this->getSrc();
                $data = Http::get( $src );
-               if( !$data ) {
+               if ( !$data ) {
                        wfDebug( "IMPORT: couldn't fetch source $src\n" );
                        fclose( $f );
                        unlink( $tempo );
@@ -1601,7 +1601,7 @@ class ImportStringSource {
         * @return bool|string
         */
        function readChunk() {
-               if( $this->atEnd() ) {
+               if ( $this->atEnd() ) {
                        return false;
                }
                $this->mRead = true;
@@ -1640,7 +1640,7 @@ class ImportStreamSource {
                wfSuppressWarnings();
                $file = fopen( $filename, 'rt' );
                wfRestoreWarnings();
-               if( !$file ) {
+               if ( !$file ) {
                        return Status::newFatal( "importcantopen" );
                }
                return Status::newGood( new ImportStreamSource( $file ) );
@@ -1653,10 +1653,10 @@ class ImportStreamSource {
        static function newFromUpload( $fieldname = "xmlimport" ) {
                $upload =& $_FILES[$fieldname];
 
-               if( $upload === null || !$upload['name'] ) {
+               if ( $upload === null || !$upload['name'] ) {
                        return Status::newFatal( 'importnofile' );
                }
-               if( !empty( $upload['error'] ) ) {
+               if ( !empty( $upload['error'] ) ) {
                        switch( $upload['error'] ) {
                                case 1: # The uploaded file exceeds the upload_max_filesize directive in php.ini.
                                        return Status::newFatal( 'importuploaderrorsize' );
@@ -1671,7 +1671,7 @@ class ImportStreamSource {
 
                }
                $fname = $upload['tmp_name'];
-               if( is_uploaded_file( $fname ) ) {
+               if ( is_uploaded_file( $fname ) ) {
                        return ImportStreamSource::newFromFile( $fname );
                } else {
                        return Status::newFatal( 'importnofile' );
@@ -1690,7 +1690,7 @@ class ImportStreamSource {
                # otherwise prevent importing from large sites, such
                # as the Wikimedia cluster, etc.
                $data = Http::request( $method, $url, array( 'followRedirects' => true ) );
-               if( $data !== false ) {
+               if ( $data !== false ) {
                        $file = tmpfile();
                        fwrite( $file, $data );
                        fflush( $file );
@@ -1710,17 +1710,23 @@ class ImportStreamSource {
         * @return Status
         */
        public static function newFromInterwiki( $interwiki, $page, $history = false, $templates = false, $pageLinkDepth = 0 ) {
-               if( $page == '' ) {
+               if ( $page == '' ) {
                        return Status::newFatal( 'import-noarticle' );
                }
                $link = Title::newFromText( "$interwiki:Special:Export/$page" );
-               if( is_null( $link ) || $link->getInterwiki() == '' ) {
+               if ( is_null( $link ) || $link->getInterwiki() == '' ) {
                        return Status::newFatal( 'importbadinterwiki' );
                } else {
                        $params = array();
-                       if ( $history ) $params['history'] = 1;
-                       if ( $templates ) $params['templates'] = 1;
-                       if ( $pageLinkDepth ) $params['pagelink-depth'] = $pageLinkDepth;
+                       if ( $history ) {
+                               $params['history'] = 1;
+                       }
+                       if ( $templates ) {
+                               $params['templates'] = 1;
+                       }
+                       if ( $pageLinkDepth ) {
+                               $params['pagelink-depth'] = $pageLinkDepth;
+                       }
                        $url = $link->getFullURL( $params );
                        # For interwikis, use POST to avoid redirects.
                        return ImportStreamSource::newFromURL( $url, "POST" );
index e8aee0b..6c582aa 100644 (file)
@@ -105,7 +105,7 @@ class Licenses extends HTMLFormField {
        protected function stackItem( &$list, $path, $item ) {
                $position =& $list;
                if ( $path ) {
-                       foreach( $path as $key ) {
+                       foreach ( $path as $key ) {
                                $position =& $position[$key];
                        }
                }
index 11b6559..d552c69 100644 (file)
@@ -152,11 +152,11 @@ class LinkFilter {
         * @return array filtered array
         */
        public static function keepOneWildcard( $arr ) {
-               if( !is_array( $arr ) ) {
+               if ( !is_array( $arr ) ) {
                        return $arr;
                }
 
-               foreach( $arr as $key => $value ) {
+               foreach ( $arr as $key => $value ) {
                        if ( $value instanceof LikeMatch ) {
                                return array_slice( $arr, 0, $key + 1 );
                        }
index 3e8a3c9..5e4675a 100644 (file)
@@ -199,7 +199,7 @@ class Linker {
                        return "<!-- ERROR -->$html";
                }
 
-               if( is_string( $query ) ) {
+               if ( is_string( $query ) ) {
                        // some functions withing core using this still hand over query strings
                        wfDeprecated( __METHOD__ . ' with parameter $query as string (should be array)', '1.20' );
                        $query = wfCgiToArray( $query );
@@ -644,7 +644,7 @@ class Linker {
                        # If a thumbnail width has not been provided, it is set
                        # to the default user option as specified in Language*.php
                        if ( $fp['align'] == '' ) {
-                               if( $parser instanceof Parser ) {
+                               if ( $parser instanceof Parser ) {
                                        $fp['align'] = $parser->getTargetLanguage()->alignEnd();
                                } else {
                                        # backwards compatibility, remove with makeImageLink2()
@@ -786,10 +786,18 @@ class Linker {
                $hp =& $handlerParams;
 
                $page = isset( $hp['page'] ) ? $hp['page'] : false;
-               if ( !isset( $fp['align'] ) ) $fp['align'] = 'right';
-               if ( !isset( $fp['alt'] ) ) $fp['alt'] = '';
-               if ( !isset( $fp['title'] ) ) $fp['title'] = '';
-               if ( !isset( $fp['caption'] ) ) $fp['caption'] = '';
+               if ( !isset( $fp['align'] ) ) {
+                       $fp['align'] = 'right';
+               }
+               if ( !isset( $fp['alt'] ) ) {
+                       $fp['alt'] = '';
+               }
+               if ( !isset( $fp['title'] ) ) {
+                       $fp['title'] = '';
+               }
+               if ( !isset( $fp['caption'] ) ) {
+                       $fp['caption'] = '';
+               }
 
                if ( empty( $hp['width'] ) ) {
                        // Reduce width for upright images when parameter 'upright' is used
@@ -970,12 +978,13 @@ class Linker {
        protected static function getUploadUrl( $destFile, $query = '' ) {
                global $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
                $q = 'wpDestFile=' . $destFile->getPartialURL();
-               if ( $query != '' )
+               if ( $query != '' ) {
                        $q .= '&' . $query;
+               }
 
                if ( $wgUploadMissingFileUrl ) {
                        return wfAppendQuery( $wgUploadMissingFileUrl, $q );
-               } elseif( $wgUploadNavigationUrl ) {
+               } elseif ( $wgUploadNavigationUrl ) {
                        return wfAppendQuery( $wgUploadNavigationUrl, $q );
                } else {
                        $upload = SpecialPage::getTitleFor( 'Upload' );
@@ -1450,8 +1459,9 @@ class Linker {
                                $trail = "";
                        }
                        $linkRegexp = '/\[\[(.*?)\]\]' . preg_quote( $trail, '/' ) . '/';
-                       if ( isset( $match[1][0] ) && $match[1][0] == ':' )
+                       if ( isset( $match[1][0] ) && $match[1][0] == ':' ) {
                                $match[1] = substr( $match[1], 1 );
+                       }
                        list( $inside, $trail ) = self::splitTrail( $trail );
 
                        $linkText = $text;
@@ -1695,13 +1705,14 @@ class Linker {
                $toc = '';
                $lastLevel = 0;
                foreach ( $tree as $section ) {
-                       if ( $section['toclevel'] > $lastLevel )
+                       if ( $section['toclevel'] > $lastLevel ) {
                                $toc .= self::tocIndent();
-                       elseif ( $section['toclevel'] < $lastLevel )
+                       } elseif ( $section['toclevel'] < $lastLevel ) {
                                $toc .= self::tocUnindent(
                                        $lastLevel - $section['toclevel'] );
-                       else
+                       } else {
                                $toc .= self::tocLineEnd();
+                       }
 
                        $toc .= self::tocLine( $section['anchor'],
                                $section['line'], $section['number'],
@@ -1895,21 +1906,21 @@ class Linker {
                }
 
                $disableRollbackEditCount = false;
-               if( $wgMiserMode ) {
-                       foreach( $disableRollbackEditCountSpecialPage as $specialPage ) {
-                               if( $context->getTitle()->isSpecial( $specialPage ) ) {
+               if ( $wgMiserMode ) {
+                       foreach ( $disableRollbackEditCountSpecialPage as $specialPage ) {
+                               if ( $context->getTitle()->isSpecial( $specialPage ) ) {
                                        $disableRollbackEditCount = true;
                                        break;
                                }
                        }
                }
 
-               if( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
+               if ( !$disableRollbackEditCount && is_int( $wgShowRollbackEditCount ) && $wgShowRollbackEditCount > 0 ) {
                        if ( !is_numeric( $editCount ) ) {
                                $editCount = self::getRollbackEditCount( $rev, false );
                        }
 
-                       if( $editCount > $wgShowRollbackEditCount ) {
+                       if ( $editCount > $wgShowRollbackEditCount ) {
                                $editCount_output = $context->msg( 'rollbacklinkcount-morethan' )->numParams( $wgShowRollbackEditCount )->parse();
                        } else {
                                $editCount_output = $context->msg( 'rollbacklinkcount' )->numParams( $editCount )->parse();
index f54487a..8c6d762 100644 (file)
@@ -354,7 +354,7 @@ class LinksUpdate extends SqlDataUpdate {
         */
        private function getLinkInsertions( $existing = array() ) {
                $arr = array();
-               foreach( $this->mLinks as $ns => $dbkeys ) {
+               foreach ( $this->mLinks as $ns => $dbkeys ) {
                        $diffs = isset( $existing[$ns] )
                                ? array_diff_key( $dbkeys, $existing[$ns] )
                                : $dbkeys;
@@ -376,7 +376,7 @@ class LinksUpdate extends SqlDataUpdate {
         */
        private function getTemplateInsertions( $existing = array() ) {
                $arr = array();
-               foreach( $this->mTemplates as $ns => $dbkeys ) {
+               foreach ( $this->mTemplates as $ns => $dbkeys ) {
                        $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
                        foreach ( $diffs as $dbk => $id ) {
                                $arr[] = array(
@@ -398,7 +398,7 @@ class LinksUpdate extends SqlDataUpdate {
        private function getImageInsertions( $existing = array() ) {
                $arr = array();
                $diffs = array_diff_key( $this->mImages, $existing );
-               foreach( $diffs as $iname => $dummy ) {
+               foreach ( $diffs as $iname => $dummy ) {
                        $arr[] = array(
                                'il_from' => $this->mId,
                                'il_to' => $iname
@@ -415,8 +415,8 @@ class LinksUpdate extends SqlDataUpdate {
        private function getExternalInsertions( $existing = array() ) {
                $arr = array();
                $diffs = array_diff_key( $this->mExternals, $existing );
-               foreach( $diffs as $url => $dummy ) {
-                       foreach( wfMakeUrlIndexes( $url ) as $index ) {
+               foreach ( $diffs as $url => $dummy ) {
+                       foreach ( wfMakeUrlIndexes( $url ) as $index ) {
                                $arr[] = array(
                                        'el_from' => $this->mId,
                                        'el_to' => $url,
@@ -481,7 +481,7 @@ class LinksUpdate extends SqlDataUpdate {
        private function getInterlangInsertions( $existing = array() ) {
                $diffs = array_diff_assoc( $this->mInterlangs, $existing );
                $arr = array();
-               foreach( $diffs as $lang => $title ) {
+               foreach ( $diffs as $lang => $title ) {
                        $arr[] = array(
                                'll_from' => $this->mId,
                                'll_lang' => $lang,
@@ -517,7 +517,7 @@ class LinksUpdate extends SqlDataUpdate {
         */
        private function getInterwikiInsertions( $existing = array() ) {
                $arr = array();
-               foreach( $this->mInterwikis as $prefix => $dbkeys ) {
+               foreach ( $this->mInterwikis as $prefix => $dbkeys ) {
                        $diffs = isset( $existing[$prefix] ) ? array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys;
                        foreach ( $diffs as $dbk => $id ) {
                                $arr[] = array(
index 240a6d3..3eaa8fe 100644 (file)
@@ -28,7 +28,7 @@ class MWFunction {
         * @throws MWException
         */
        protected static function cleanCallback( $callback ) {
-               if( is_string( $callback ) ) {
+               if ( is_string( $callback ) ) {
                        if ( strpos( $callback, '::' ) !== false ) {
                                // PHP 5.1 cannot use call_user_func( 'Class::Method' )
                                // It can only handle only call_user_func( array( 'Class', 'Method' ) )
@@ -36,7 +36,7 @@ class MWFunction {
                        }
                }
 
-               if( count( $callback ) == 2 && $callback[0] == 'self' || $callback[0] == 'parent' ) {
+               if ( count( $callback ) == 2 && $callback[0] == 'self' || $callback[0] == 'parent' ) {
                        throw new MWException( 'MWFunction cannot call self::method() or parent::method()' );
                }
 
@@ -74,7 +74,7 @@ class MWFunction {
         * @return object
         */
        public static function newObj( $class, $args = array() ) {
-               if( !count( $args ) ) {
+               if ( !count( $args ) ) {
                        return new $class;
                }
 
index 86508ec..18b79c4 100644 (file)
@@ -327,9 +327,10 @@ class MagicWord {
                usort( $synonyms, array( $this, 'compareStringLength' ) );
 
                $escSyn = array();
-               foreach ( $synonyms as $synonym )
+               foreach ( $synonyms as $synonym ) {
                        // In case a magic word contains /, like that's going to happen;)
                        $escSyn[] = preg_quote( $synonym, '/' );
+               }
                $this->mBaseRegex = implode( '|', $escSyn );
 
                $case = $this->mCaseSensitive ? '' : 'iu';
@@ -382,8 +383,9 @@ class MagicWord {
         * @return string
         */
        function getRegexCase() {
-               if ( $this->mRegex === '' )
+               if ( $this->mRegex === '' ) {
                        $this->initRegex();
+               }
 
                return $this->mCaseSensitive ? '' : 'iu';
        }
@@ -598,7 +600,7 @@ class MagicWord {
        function replaceMultiple( $magicarr, $subject, &$result ) {
                $search = array();
                $replace = array();
-               foreach( $magicarr as $id => $replacement ) {
+               foreach ( $magicarr as $id => $replacement ) {
                        $mw = MagicWord::get( $id );
                        $search[] = $mw->getRegex();
                        $replace[] = $replacement;
index 5719f83..531551d 100644 (file)
@@ -326,7 +326,7 @@ class Message {
                if ( isset( $params[0] ) && is_array( $params[0] ) ) {
                        $params = $params[0];
                }
-               foreach( $params as $param ) {
+               foreach ( $params as $param ) {
                        $this->parameters[] = self::rawParam( $param );
                }
                return $this;
@@ -344,7 +344,7 @@ class Message {
                if ( isset( $params[0] ) && is_array( $params[0] ) ) {
                        $params = $params[0];
                }
-               foreach( $params as $param ) {
+               foreach ( $params as $param ) {
                        $this->parameters[] = self::numParam( $param );
                }
                return $this;
@@ -377,7 +377,7 @@ class Message {
                if ( $lang instanceof Language || $lang instanceof StubUserLang ) {
                        $this->language = $lang;
                } elseif ( is_string( $lang ) ) {
-                       if( $this->language->getCode() != $lang ) {
+                       if ( $this->language->getCode() != $lang ) {
                                $this->language = Language::factory( $lang );
                        }
                } else {
@@ -484,17 +484,17 @@ class Message {
                $string = $this->replaceParameters( $string, 'before' );
 
                # Maybe transform using the full parser
-               if( $this->format === 'parse' ) {
+               if ( $this->format === 'parse' ) {
                        $string = $this->parseText( $string );
                        $m = array();
-                       if( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
+                       if ( preg_match( '/^<p>(.*)\n?<\/p>\n?$/sU', $string, $m ) ) {
                                $string = $m[1];
                        }
-               } elseif( $this->format === 'block-parse' ) {
+               } elseif ( $this->format === 'block-parse' ) {
                        $string = $this->parseText( $string );
-               } elseif( $this->format === 'text' ) {
+               } elseif ( $this->format === 'text' ) {
                        $string = $this->transformText( $string );
-               } elseif( $this->format === 'escaped' ) {
+               } elseif ( $this->format === 'escaped' ) {
                        $string = $this->transformText( $string );
                        $string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8', false );
                }
@@ -641,7 +641,7 @@ class Message {
         */
        protected function replaceParameters( $message, $type = 'before' ) {
                $replacementKeys = array();
-               foreach( $this->parameters as $n => $param ) {
+               foreach ( $this->parameters as $n => $param ) {
                        list( $paramType, $value ) = $this->extractParam( $param );
                        if ( $type === $paramType ) {
                                $replacementKeys['$' . ($n + 1)] = $value;
@@ -760,7 +760,7 @@ class RawMessage extends Message {
         */
        public function fetchMessage() {
                // Just in case the message is unset somewhere.
-               if( !isset( $this->message ) ) {
+               if ( !isset( $this->message ) ) {
                        $this->message = $this->key;
                }
                return $this->message;
index 96d00ae..cd77ef8 100644 (file)
@@ -42,7 +42,7 @@ abstract class RdfMetaData {
                $httpaccept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null;
                $rdftype = wfNegotiateType( wfAcceptToPrefs( $httpaccept ), wfAcceptToPrefs( self::RDF_TYPE_PREFS ) );
 
-               if( !$rdftype ) {
+               if ( !$rdftype ) {
                        throw new HttpError( 406, wfMessage( 'notacceptable' ) );
                }
 
@@ -70,7 +70,7 @@ abstract class RdfMetaData {
                $lastEditor = User::newFromId( $this->mArticle->getUser() );
                $this->person( 'creator', $lastEditor );
 
-               foreach( $this->mArticle->getContributors() as $user ) {
+               foreach ( $this->mArticle->getContributors() as $user ) {
                        $this->person( 'contributor', $user );
                }
 
@@ -89,13 +89,13 @@ abstract class RdfMetaData {
        }
 
        protected function pageOrString( $name, $page, $str ) {
-               if( $page instanceof Title ) {
+               if ( $page instanceof Title ) {
                        $nt = $page;
                } else {
                        $nt = Title::newFromText( $page );
                }
 
-               if( !$nt || $nt->getArticleID() == 0 ) {
+               if ( !$nt || $nt->getArticleID() == 0 ) {
                        $this->element( $name, $str );
                } else {
                        $this->page( $name, $nt );
@@ -116,11 +116,11 @@ abstract class RdfMetaData {
        }
 
        protected function person( $name, User $user ) {
-               if( $user->isAnon() ) {
+               if ( $user->isAnon() ) {
                        $this->element( $name, wfMessage( 'anonymous' )->numParams( 1 )->text() );
                } else {
                        $real = $user->getRealName();
-                       if( $real ) {
+                       if ( $real ) {
                                $this->element( $name, $real );
                        } else {
                                $userName = $user->getName();
@@ -140,12 +140,12 @@ abstract class RdfMetaData {
        protected function rights() {
                global $wgRightsPage, $wgRightsUrl, $wgRightsText;
 
-               if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) )
+               if ( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) )
                        && ( $nt->getArticleID() != 0 ) ) {
                        $this->page( 'rights', $nt );
-               } elseif( $wgRightsUrl ) {
+               } elseif ( $wgRightsUrl ) {
                        $this->url( 'rights', $wgRightsUrl );
-               } elseif( $wgRightsText ) {
+               } elseif ( $wgRightsText ) {
                        $this->element( 'rights', $wgRightsText );
                }
        }
@@ -153,11 +153,11 @@ abstract class RdfMetaData {
        protected function getTerms( $url ) {
                global $wgLicenseTerms;
 
-               if( $wgLicenseTerms ) {
+               if ( $wgLicenseTerms ) {
                        return $wgLicenseTerms;
                } else {
                        $known = $this->getKnownLicenses();
-                       if( isset( $known[$url] ) ) {
+                       if ( isset( $known[$url] ) ) {
                                return $known[$url];
                        } else {
                                return array();
@@ -173,7 +173,7 @@ abstract class RdfMetaData {
 
                foreach ( $ccVersions as $version ) {
                        foreach ( $ccLicenses as $license ) {
-                               if( $version == '2.0' && substr( $license, 0, 2 ) != 'by' ) {
+                               if ( $version == '2.0' && substr( $license, 0, 2 ) != 'by' ) {
                                        # 2.0 dropped the non-attribs licenses
                                        continue;
                                }
index 11fc574..24d803b 100644 (file)
@@ -39,7 +39,7 @@
  * appending MM_WELL_KNOWN_MIME_TYPES behind $wgMimeTypeFile, but who knows
  * what will break? In practice this probably isn't a problem anyway -- Bryan)
  */
-define('MM_WELL_KNOWN_MIME_TYPES', <<<END_STRING
+define( 'MM_WELL_KNOWN_MIME_TYPES', <<<END_STRING
 application/ogg ogx ogg ogm ogv oga spx
 application/pdf pdf
 application/vnd.oasis.opendocument.chart odc
@@ -91,7 +91,7 @@ END_STRING
  * An extensive list of well known mime types is provided by
  * the file mime.info in the includes directory.
  */
-define('MM_WELL_KNOWN_MIME_INFO', <<<END_STRING
+define( 'MM_WELL_KNOWN_MIME_INFO', <<<END_STRING
 application/pdf [OFFICE]
 application/vnd.oasis.opendocument.chart [OFFICE]
 application/vnd.oasis.opendocument.chart-template [OFFICE]
@@ -560,7 +560,7 @@ class MimeMagic {
 
                $mime = $this->doGuessMimeType( $file, $ext );
 
-               if( !$mime ) {
+               if ( !$mime ) {
                        wfDebug( __METHOD__ . ": internal type detection failed for $file (.$ext)...\n" );
                        $mime = $this->detectMimeType( $file, $ext );
                }
@@ -587,7 +587,7 @@ class MimeMagic {
                $f = fopen( $file, 'rt' );
                wfRestoreWarnings();
 
-               if( !$f ) {
+               if ( !$f ) {
                        return 'unknown/unknown';
                }
                $head = fread( $f, 1024 );
@@ -705,8 +705,8 @@ class MimeMagic {
                                $pack = array( 'UTF-16BE' => 'n*', 'UTF-16LE' => 'v*' );
                                $chars = unpack( $pack[$script_type], substr( $head, 2 ) );
                                $head = '';
-                               foreach( $chars as $codepoint ) {
-                                       if( $codepoint < 128 ) {
+                               foreach ( $chars as $codepoint ) {
+                                       if ( $codepoint < 128 ) {
                                                $head .= chr( $codepoint );
                                        } else {
                                                $head .= '?';
@@ -733,7 +733,7 @@ class MimeMagic {
                $gis = getimagesize( $file );
                wfRestoreWarnings();
 
-               if( $gis && isset( $gis['mime'] ) ) {
+               if ( $gis && isset( $gis['mime'] ) ) {
                        $mime = $gis['mime'];
                        wfDebug( __METHOD__ . ": getimagesize detected $file as $mime\n" );
                        return $mime;
@@ -741,7 +741,7 @@ class MimeMagic {
 
                // Also test DjVu
                $deja = new DjVuImage( $file );
-               if( $deja->isValid() ) {
+               if ( $deja->isValid() ) {
                        wfDebug( __METHOD__ . ": detected $file as image/vnd.djvu\n" );
                        return 'image/vnd.djvu';
                }
@@ -763,7 +763,7 @@ class MimeMagic {
         * @return string
         */
        function detectZipType( $header, $tail = null, $ext = false ) {
-               if( $ext ) { # TODO: remove $ext param
+               if ( $ext ) { # TODO: remove $ext param
                        wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. " .
                                "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" );
                }
@@ -935,7 +935,7 @@ class MimeMagic {
                        $ext = strtolower( $i ? substr( $file, $i + 1 ) : '' );
                }
                if ( $ext ) {
-                       if( $this->isRecognizableExtension( $ext ) ) {
+                       if ( $this->isRecognizableExtension( $ext ) ) {
                                wfDebug( __METHOD__ . ": refusing to guess mime type for .$ext file, we should have recognized it\n" );
                        } else {
                                $m = $this->guessTypesForExtension( $ext );
@@ -968,12 +968,12 @@ class MimeMagic {
         * @return (int?string?) a value to be used with the MEDIATYPE_xxx constants.
         */
        function getMediaType( $path = null, $mime = null ) {
-               if( !$mime && !$path ) {
+               if ( !$mime && !$path ) {
                        return MEDIATYPE_UNKNOWN;
                }
 
                // If mime type is unknown, guess it
-               if( !$mime ) {
+               if ( !$mime ) {
                        $mime = $this->guessMimeType( $path, false );
                }
 
@@ -983,22 +983,30 @@ class MimeMagic {
 
                        // Read a chunk of the file
                        $f = fopen( $path, "rt" );
-                       if ( !$f ) return MEDIATYPE_UNKNOWN;
+                       if ( !$f ) {
+                               return MEDIATYPE_UNKNOWN;
+                       }
                        $head = fread( $f, 256 );
                        fclose( $f );
 
                        $head = strtolower( $head );
 
                        // This is an UGLY HACK, file should be parsed correctly
-                       if ( strpos( $head, 'theora' ) !== false ) return MEDIATYPE_VIDEO;
-                       elseif ( strpos( $head, 'vorbis' ) !== false ) return MEDIATYPE_AUDIO;
-                       elseif ( strpos( $head, 'flac' ) !== false ) return MEDIATYPE_AUDIO;
-                       elseif ( strpos( $head, 'speex' ) !== false ) return MEDIATYPE_AUDIO;
-                       else return MEDIATYPE_MULTIMEDIA;
+                       if ( strpos( $head, 'theora' ) !== false ) {
+                               return MEDIATYPE_VIDEO;
+                       } elseif ( strpos( $head, 'vorbis' ) !== false ) {
+                               return MEDIATYPE_AUDIO;
+                       } elseif ( strpos( $head, 'flac' ) !== false ) {
+                               return MEDIATYPE_AUDIO;
+                       } elseif ( strpos( $head, 'speex' ) !== false ) {
+                               return MEDIATYPE_AUDIO;
+                       } else {
+                               return MEDIATYPE_MULTIMEDIA;
+                       }
                }
 
                // Check for entry for full mime type
-               if( $mime ) {
+               if ( $mime ) {
                        $type = $this->findMediaType( $mime );
                        if ( $type !== MEDIATYPE_UNKNOWN ) {
                                return $type;
@@ -1029,7 +1037,7 @@ class MimeMagic {
                        }
                }
 
-               if( !$type ) {
+               if ( !$type ) {
                        $type = MEDIATYPE_UNKNOWN;
                }
 
index 6b40c30..e7928cc 100644 (file)
@@ -64,10 +64,10 @@ function wfOutputHandler( $s ) {
  */
 function wfRequestExtension() {
        /// @todo FIXME: this sort of dupes some code in WebRequest::getRequestUrl()
-       if( isset( $_SERVER['REQUEST_URI'] ) ) {
+       if ( isset( $_SERVER['REQUEST_URI'] ) ) {
                // Strip the query string...
                list( $path ) = explode( '?', $_SERVER['REQUEST_URI'], 2 );
-       } elseif( isset( $_SERVER['SCRIPT_NAME'] ) ) {
+       } elseif ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
                // Probably IIS. QUERY_STRING appears separately.
                $path = $_SERVER['SCRIPT_NAME'];
        } else {
@@ -76,7 +76,7 @@ function wfRequestExtension() {
        }
 
        $period = strrpos( $path, '.' );
-       if( $period !== false ) {
+       if ( $period !== false ) {
                return strtolower( substr( $path, $period ) );
        }
        return '';
@@ -91,17 +91,17 @@ function wfRequestExtension() {
  * @return string
  */
 function wfGzipHandler( $s ) {
-       if( !function_exists( 'gzencode' ) ) {
+       if ( !function_exists( 'gzencode' ) ) {
                wfDebug( __FUNCTION__ . "() skipping compression (gzencode unavailable)\n" );
                return $s;
        }
-       if( headers_sent() ) {
+       if ( headers_sent() ) {
                wfDebug( __FUNCTION__ . "() skipping compression (headers already sent)\n" );
                return $s;
        }
 
        $ext = wfRequestExtension();
-       if( $ext == '.gz' || $ext == '.tgz' ) {
+       if ( $ext == '.gz' || $ext == '.tgz' ) {
                // Don't do gzip compression if the URL path ends in .gz or .tgz
                // This confuses Safari and triggers a download of the page,
                // even though it's pretty clearly labeled as viewable HTML.
@@ -109,7 +109,7 @@ function wfGzipHandler( $s ) {
                return $s;
        }
 
-       if( wfClientAcceptsGzip() ) {
+       if ( wfClientAcceptsGzip() ) {
                wfDebug( __FUNCTION__ . "() is compressing output\n" );
                header( 'Content-Encoding: gzip' );
                $s = gzencode( $s, 6 );
index 8058c09..d70734c 100644 (file)
@@ -155,13 +155,13 @@ abstract class IndexPager extends ContextSource implements Pager {
                $index = $this->getIndexField(); // column to sort on
                $extraSort = $this->getExtraSortFields(); // extra columns to sort on for query planning
                $order = $this->mRequest->getVal( 'order' );
-               if( is_array( $index ) && isset( $index[$order] ) ) {
+               if ( is_array( $index ) && isset( $index[$order] ) ) {
                        $this->mOrderType = $order;
                        $this->mIndexField = $index[$order];
                        $this->mExtraSortFields = isset( $extraSort[$order] )
                                ? (array)$extraSort[$order]
                                : array();
-               } elseif( is_array( $index ) ) {
+               } elseif ( is_array( $index ) ) {
                        # First element is the default
                        reset( $index );
                        list( $this->mOrderType, $this->mIndexField ) = each( $index );
@@ -175,7 +175,7 @@ abstract class IndexPager extends ContextSource implements Pager {
                        $this->mExtraSortFields = (array)$extraSort;
                }
 
-               if( !isset( $this->mDefaultDirection ) ) {
+               if ( !isset( $this->mDefaultDirection ) ) {
                        $dir = $this->getDefaultDirections();
                        $this->mDefaultDirection = is_array( $dir )
                                ? $dir[$this->mOrderType]
@@ -443,12 +443,12 @@ abstract class IndexPager extends ContextSource implements Pager {
                }
 
                $attrs = array();
-               if( in_array( $type, array( 'first', 'prev', 'next', 'last' ) ) ) {
+               if ( in_array( $type, array( 'first', 'prev', 'next', 'last' ) ) ) {
                        # HTML5 rel attributes
                        $attrs['rel'] = $type;
                }
 
-               if( $type ) {
+               if ( $type ) {
                        $attrs['class'] = "mw-{$type}link";
                }
 
@@ -685,7 +685,9 @@ abstract class IndexPager extends ContextSource implements Pager {
         *
         * @return Array
         */
-       protected function getExtraSortFields() { return array(); }
+       protected function getExtraSortFields() {
+               return array();
+       }
 
        /**
         * Return the default sorting direction: false for ascending, true for
@@ -706,7 +708,9 @@ abstract class IndexPager extends ContextSource implements Pager {
         *
         * @return Boolean
         */
-       protected function getDefaultDirections() { return false; }
+       protected function getDefaultDirections() {
+               return false;
+       }
 }
 
 /**
@@ -726,7 +730,7 @@ abstract class AlphabeticPager extends IndexPager {
                        return '';
                }
 
-               if( isset( $this->mNavigationBar ) ) {
+               if ( isset( $this->mNavigationBar ) ) {
                        return $this->mNavigationBar;
                }
 
@@ -749,7 +753,7 @@ abstract class AlphabeticPager extends IndexPager {
                        $this->msg( 'viewprevnext' )->rawParams( $pagingLinks['prev'],
                                $pagingLinks['next'], $limits )->escaped();
 
-               if( !is_array( $this->getIndexField() ) ) {
+               if ( !is_array( $this->getIndexField() ) ) {
                        # Early return to avoid undue nesting
                        return $this->mNavigationBar;
                }
@@ -757,14 +761,14 @@ abstract class AlphabeticPager extends IndexPager {
                $extra = '';
                $first = true;
                $msgs = $this->getOrderTypeMessages();
-               foreach( array_keys( $msgs ) as $order ) {
-                       if( $first ) {
+               foreach ( array_keys( $msgs ) as $order ) {
+                       if ( $first ) {
                                $first = false;
                        } else {
                                $extra .= $this->msg( 'pipe-separator' )->escaped();
                        }
 
-                       if( $order == $this->mOrderType ) {
+                       if ( $order == $this->mOrderType ) {
                                $extra .= $this->msg( $msgs[$order] )->escaped();
                        } else {
                                $extra .= $this->makeLink(
@@ -774,7 +778,7 @@ abstract class AlphabeticPager extends IndexPager {
                        }
                }
 
-               if( $extra !== '' ) {
+               if ( $extra !== '' ) {
                        $extra = ' ' . $this->msg( 'parentheses' )->rawParams( $extra )->escaped();
                        $this->mNavigationBar .= $extra;
                }
@@ -857,7 +861,7 @@ abstract class ReverseChronologicalPager extends IndexPager {
                        // If no year given, assume the current one
                        $year = gmdate( 'Y' );
                        // If this month hasn't happened yet this year, go back to last year's month
-                       if( $this->mMonth > gmdate( 'n' ) ) {
+                       if ( $this->mMonth > gmdate( 'n' ) ) {
                                $year--;
                        }
                }
@@ -1125,7 +1129,7 @@ abstract class TablePager extends IndexPager {
                        'next' => 'arrow_disabled_right_25.png',
                        'last' => 'arrow_disabled_last_25.png',
                );
-               if( $this->getLanguage()->isRTL() ) {
+               if ( $this->getLanguage()->isRTL() ) {
                        $keys = array_keys( $labels );
                        $images = array_combine( $keys, array_reverse( $images ) );
                        $disabledImages = array_combine( $keys, array_reverse( $disabledImages ) );
@@ -1169,7 +1173,7 @@ abstract class TablePager extends IndexPager {
                        # The pair is either $index => $limit, in which case the $value
                        # will be numeric, or $limit => $text, in which case the $value
                        # will be a string.
-                       if( is_int( $value ) ) {
+                       if ( is_int( $value ) ) {
                                $limit = $value;
                                $text = $this->getLanguage()->formatNum( $limit );
                        } else {
index fc891bb..435e09e 100644 (file)
@@ -141,10 +141,10 @@ class PathRouter {
                }
 
                $pattern = (object)array(
-                       'path'    => $path,
-                       'params'  => $params,
+                       'path' => $path,
+                       'params' => $params,
                        'options' => $options,
-                       'key'     => $key,
+                       'key' => $key,
                );
                $pattern->weight = self::makeWeight( $pattern );
                $this->patterns[] = $pattern;
@@ -185,7 +185,7 @@ class PathRouter {
         */
        protected function sortByWeight() {
                $weights = array();
-               foreach( $this->patterns as $key => $pattern ) {
+               foreach ( $this->patterns as $key => $pattern ) {
                        $weights[$key] = $pattern->weight;
                }
                array_multisort( $weights, SORT_DESC, SORT_NUMERIC, $this->patterns );
@@ -203,7 +203,7 @@ class PathRouter {
                $path = explode( '/', $pattern->path );
 
                # For each level of the path
-               foreach( $path as $piece ) {
+               foreach ( $path as $piece ) {
                        if ( preg_match( '/^\$(\d+|key)$/u', $piece ) ) {
                                # For a piece that is only a $1 variable add 1 points of weight
                                $weight += 1;
index 79c3dd3..44c87f0 100644 (file)
@@ -378,7 +378,7 @@ class Preferences {
                                        ? 'prefs-help-email-required'
                                        : 'prefs-help-email';
 
-                       if( $wgEnableUserEmail ) {
+                       if ( $wgEnableUserEmail ) {
                                // additional messages when users can send email to each other
                                $helpMessages[] = 'prefs-help-email-others';
                        }
@@ -1012,8 +1012,9 @@ class Preferences {
                $nsOptions = $wgContLang->getFormattedNamespaces();
                $nsOptions[0] = $context->msg( 'blanknamespace' )->text();
                foreach ( $nsOptions as $ns => $name ) {
-                       if ( $ns < 0 )
+                       if ( $ns < 0 ) {
                                unset( $nsOptions[$ns] );
+                       }
                }
 
                $defaultPreferences['searchnamespaces'] = array(
@@ -1351,7 +1352,9 @@ class Preferences {
                                        $data[0] = intval( $data[0] );
                                        $data[1] = intval( $data[1] );
                                        $minDiff = abs( $data[0] ) * 60 + $data[1];
-                                       if ( $data[0] < 0 ) $minDiff = - $minDiff;
+                                       if ( $data[0] < 0 ) {
+                                               $minDiff = - $minDiff;
+                                       }
                                } else {
                                        $minDiff = intval( $data[0] ) * 60;
                                }
@@ -1406,7 +1409,7 @@ class Preferences {
                # via $wgHiddenPrefs, we don't want to destroy that setting in case the preference
                # is subsequently re-enabled
                # TODO: maintenance script to actually delete these
-               foreach( $wgHiddenPrefs as $pref ) {
+               foreach ( $wgHiddenPrefs as $pref ) {
                        # If the user has not set a non-default value here, the default will be returned
                        # and subsequently discarded
                        $formData[$pref] = $user->getOption( $pref, null, true );
index e422a3b..3c464c5 100644 (file)
@@ -37,16 +37,16 @@ class PrefixSearch {
         */
        public static function titleSearch( $search, $limit, $namespaces = array() ) {
                $search = trim( $search );
-               if( $search == '' ) {
+               if ( $search == '' ) {
                        return array(); // Return empty result
                }
                $namespaces = self::validateNamespaces( $namespaces );
 
                // Find a Title which is not an interwiki and is in NS_MAIN
                $title = Title::newFromText( $search );
-               if( $title && $title->getInterwiki() == '' ) {
+               if ( $title && $title->getInterwiki() == '' ) {
                        $ns = array( $title->getNamespace() );
-                       if( $ns[0] == NS_MAIN ) {
+                       if ( $ns[0] == NS_MAIN ) {
                                $ns = $namespaces; // no explicit prefix, use default namespaces
                        }
                        return self::searchBackend(
@@ -55,7 +55,7 @@ class PrefixSearch {
 
                // Is this a namespace prefix?
                $title = Title::newFromText( $search . 'Dummy' );
-               if( $title && $title->getText() == 'Dummy'
+               if ( $title && $title->getText() == 'Dummy'
                        && $title->getNamespace() != NS_MAIN
                        && $title->getInterwiki() == '' ) {
                        return self::searchBackend(
@@ -73,16 +73,16 @@ class PrefixSearch {
         * @return Array of strings
         */
        protected static function searchBackend( $namespaces, $search, $limit ) {
-               if( count( $namespaces ) == 1 ) {
+               if ( count( $namespaces ) == 1 ) {
                        $ns = $namespaces[0];
-                       if( $ns == NS_MEDIA ) {
+                       if ( $ns == NS_MEDIA ) {
                                $namespaces = array( NS_FILE );
-                       } elseif( $ns == NS_SPECIAL ) {
+                       } elseif ( $ns == NS_SPECIAL ) {
                                return self::specialSearch( $search, $limit );
                        }
                }
                $srchres = array();
-               if( wfRunHooks( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres ) ) ) {
+               if ( wfRunHooks( 'PrefixSearchBackend', array( $namespaces, $search, $limit, &$srchres ) ) ) {
                        return self::defaultSearchBackend( $namespaces, $search, $limit );
                }
                return $srchres;
@@ -106,24 +106,24 @@ class PrefixSearch {
                // Unlike SpecialPage itself, we want the canonical forms of both
                // canonical and alias title forms...
                $keys = array();
-               foreach( SpecialPageFactory::getList() as $page => $class ) {
+               foreach ( SpecialPageFactory::getList() as $page => $class ) {
                        $keys[$wgContLang->caseFold( $page )] = $page;
                }
 
-               foreach( $wgContLang->getSpecialPageAliases() as $page => $aliases ) {
-                       if( !array_key_exists( $page, SpecialPageFactory::getList() ) ) {# bug 20885
+               foreach ( $wgContLang->getSpecialPageAliases() as $page => $aliases ) {
+                       if ( !array_key_exists( $page, SpecialPageFactory::getList() ) ) {# bug 20885
                                continue;
                        }
 
-                       foreach( $aliases as $alias ) {
+                       foreach ( $aliases as $alias ) {
                                $keys[$wgContLang->caseFold( $alias )] = $alias;
                        }
                }
                ksort( $keys );
 
                $srchres = array();
-               foreach( $keys as $pageKey => $page ) {
-                       if( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) {
+               foreach ( $keys as $pageKey => $page ) {
+                       if ( $searchKey === '' || strpos( $pageKey, $searchKey ) === 0 ) {
                                wfSuppressWarnings();
                                // bug 27671: Don't use SpecialPage::getTitleFor() here because it
                                // localizes its input leading to searches for e.g. Special:All
@@ -133,7 +133,7 @@ class PrefixSearch {
                                wfRestoreWarnings();
                        }
 
-                       if( count( $srchres ) >= $limit ) {
+                       if ( count( $srchres ) >= $limit ) {
                                break;
                        }
                }
@@ -154,7 +154,7 @@ class PrefixSearch {
         */
        protected static function defaultSearchBackend( $namespaces, $search, $limit ) {
                $ns = array_shift( $namespaces ); // support only one namespace
-               if( in_array( NS_MAIN, $namespaces ) ) {
+               if ( in_array( NS_MAIN, $namespaces ) ) {
                        $ns = NS_MAIN; // if searching on many always default to main
                }
 
@@ -196,14 +196,14 @@ class PrefixSearch {
 
                // We will look at each given namespace against wgContLang namespaces
                $validNamespaces = $wgContLang->getNamespaces();
-               if( is_array( $namespaces ) && count( $namespaces ) > 0 ) {
+               if ( is_array( $namespaces ) && count( $namespaces ) > 0 ) {
                        $valid = array();
                        foreach ( $namespaces as $ns ) {
-                               if( is_numeric( $ns ) && array_key_exists( $ns, $validNamespaces ) ) {
+                               if ( is_numeric( $ns ) && array_key_exists( $ns, $validNamespaces ) ) {
                                        $valid[] = $ns;
                                }
                        }
-                       if( count( $valid ) > 0 ) {
+                       if ( count( $valid ) > 0 ) {
                                return $valid;
                        }
                }
index de5e9db..9439b90 100644 (file)
@@ -91,7 +91,7 @@ class ProtectionForm {
                $this->mReasonSelection = $wgRequest->getText( 'wpProtectReasonSelection' );
                $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade', $this->mCascade );
 
-               foreach( $this->mApplicableTypes as $action ) {
+               foreach ( $this->mApplicableTypes as $action ) {
                        // @todo FIXME: This form currently requires individual selections,
                        // but the db allows multiples separated by commas.
 
@@ -132,15 +132,15 @@ class ProtectionForm {
                        }
 
                        $val = $wgRequest->getVal( "mwProtect-level-$action" );
-                       if( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) {
+                       if ( isset( $val ) && in_array( $val, $wgRestrictionLevels ) ) {
                                // Prevent users from setting levels that they cannot later unset
-                               if( $val == 'sysop' ) {
+                               if ( $val == 'sysop' ) {
                                        // Special case, rewrite sysop to either protect and editprotected
-                                       if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) )
-                                               continue;
-                               } else {
-                                       if( !$wgUser->isAllowed( $val ) )
+                                       if ( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) ) {
                                                continue;
+                                       }
+                               } elseif ( !$wgUser->isAllowed( $val ) ) {
+                                       continue;
                                }
                                $this->mRestrictions[$action] = $val;
                        }
@@ -188,8 +188,8 @@ class ProtectionForm {
                        throw new ErrorPageError( 'protect-badnamespace-title', 'protect-badnamespace-text' );
                }
 
-               if( $wgRequest->wasPosted() ) {
-                       if( $this->save() ) {
+               if ( $wgRequest->wasPosted() ) {
+                       if ( $this->save() ) {
                                $q = $this->mArticle->isRedirect() ? 'redirect=no' : '';
                                $wgOut->redirect( $this->mTitle->getFullURL( $q ) );
                        }
@@ -282,10 +282,11 @@ class ProtectionForm {
                        $reasonstr = $this->mReason;
                }
                $expiry = array();
-               foreach( $this->mApplicableTypes as $action ) {
+               foreach ( $this->mApplicableTypes as $action ) {
                        $expiry[$action] = $this->getExpiry( $action );
-                       if( empty( $this->mRestrictions[$action] ) )
+                       if ( empty( $this->mRestrictions[$action] ) ) {
                                continue; // unprotected
+                       }
                        if ( !$expiry[$action] ) {
                                $this->show( array( 'protect_expiry_invalid' ) );
                                return false;
@@ -300,9 +301,10 @@ class ProtectionForm {
                #  to a semi-protected page.
                $edit_restriction = isset( $this->mRestrictions['edit'] ) ? $this->mRestrictions['edit'] : '';
                $this->mCascade = $wgRequest->getBool( 'mwProtect-cascade' );
-               if ( $this->mCascade && ($edit_restriction != 'protect') &&
-                       !User::groupHasPermission( $edit_restriction, 'protect' ) )
+               if ( $this->mCascade && ( $edit_restriction != 'protect' ) &&
+                       !User::groupHasPermission( $edit_restriction, 'protect' ) ) {
                        $this->mCascade = false;
+               }
 
                $status = $this->mArticle->doUpdateRestrictions( $this->mRestrictions, $expiry, $this->mCascade, $reasonstr, $wgUser );
 
@@ -318,12 +320,12 @@ class ProtectionForm {
                 *             you can also return an array of message name and its parameters
                 */
                $errorMsg = '';
-               if( !wfRunHooks( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg ) ) ) {
+               if ( !wfRunHooks( 'ProtectionForm::save', array( $this->mArticle, &$errorMsg ) ) ) {
                        if ( $errorMsg == '' ) {
                                $errorMsg = array( 'hookaborted' );
                        }
                }
-               if( $errorMsg != '' ) {
+               if ( $errorMsg != '' ) {
                        $this->show( $errorMsg );
                        return false;
                }
@@ -356,7 +358,7 @@ class ProtectionForm {
                );
 
                $out = '';
-               if( !$this->disabled ) {
+               if ( !$this->disabled ) {
                        $wgOut->addModules( 'mediawiki.legacy.protect' );
                        $out .= Xml::openElement( 'form', array( 'method' => 'post',
                                'action' => $this->mTitle->getLocalURL( 'action=protect' ),
@@ -368,7 +370,7 @@ class ProtectionForm {
                        Xml::openElement( 'table', array( 'id' => 'mwProtectSet' ) ) .
                        Xml::openElement( 'tbody' );
 
-               foreach( $this->mRestrictions as $action => $selected ) {
+               foreach ( $this->mRestrictions as $action => $selected ) {
                        /* Not all languages have V_x <-> N_x relation */
                        $msg = wfMessage( 'restriction-' . $action );
                        $out .= "<tr><td>" .
@@ -412,7 +414,7 @@ class ProtectionForm {
                                wfMessage( 'protect-othertime-op' )->text(),
                                "othertime"
                        ) . "\n";
-                       foreach( explode( ',', $scExpiryOptions ) as $option ) {
+                       foreach ( explode( ',', $scExpiryOptions ) as $option ) {
                                if ( strpos( $option, ":" ) === false ) {
                                        $show = $value = $option;
                                } else {
@@ -423,7 +425,7 @@ class ProtectionForm {
                                $expiryFormOptions .= Xml::option( $show, $value, $this->mExpirySelection[$action] === $value ) . "\n";
                        }
                        # Add expiry dropdown
-                       if( $showProtectOptions && !$this->disabled ) {
+                       if ( $showProtectOptions && !$this->disabled ) {
                                $out .= "
                                        <table><tr>
                                                <td class='mw-label'>
@@ -463,7 +465,7 @@ class ProtectionForm {
                $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' );
 
                // JavaScript will add another row with a value-chaining checkbox
-               if( $this->mTitle->exists() ) {
+               if ( $this->mTitle->exists() ) {
                        $out .= Xml::openElement( 'table', array( 'id' => 'mw-protect-table2' ) ) .
                                Xml::openElement( 'tbody' );
                        $out .= '<tr>
@@ -481,7 +483,7 @@ class ProtectionForm {
                }
 
                # Add manual and custom reason field/selects as well as submit
-               if( !$this->disabled ) {
+               if ( !$this->disabled ) {
                        $out .= Xml::openElement( 'table', array( 'id' => 'mw-protect-table3' ) ) .
                                Xml::openElement( 'tbody' );
                        $out .= "
@@ -506,7 +508,7 @@ class ProtectionForm {
                                        "</td>
                                </tr>";
                        # Disallow watching is user is not logged in
-                       if( $wgUser->isLoggedIn() ) {
+                       if ( $wgUser->isLoggedIn() ) {
                                $out .= "
                                <tr>
                                        <td></td>
@@ -562,15 +564,17 @@ class ProtectionForm {
                global $wgRestrictionLevels, $wgUser;
 
                $levels = array();
-               foreach( $wgRestrictionLevels as $key ) {
+               foreach ( $wgRestrictionLevels as $key ) {
                        //don't let them choose levels above their own (aka so they can still unprotect and edit the page). but only when the form isn't disabled
-                       if( $key == 'sysop' ) {
+                       if ( $key == 'sysop' ) {
                                //special case, rewrite sysop to protect and editprotected
-                               if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) && !$this->disabled )
+                               if ( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) && !$this->disabled ) {
                                        continue;
+                               }
                        } else {
-                               if( !$wgUser->isAllowed( $key ) && !$this->disabled )
+                               if ( !$wgUser->isAllowed( $key ) && !$this->disabled ) {
                                        continue;
+                               }
                        }
                        $levels[] = $key;
                }
@@ -584,7 +588,7 @@ class ProtectionForm {
                        ) + $this->disabledAttrib;
 
                $out = Xml::openElement( 'select', $attribs );
-               foreach( $levels as $key ) {
+               foreach ( $levels as $key ) {
                        $out .= Xml::option( $this->getOptionLabel( $key ), $key, $key == $selected );
                }
                $out .= Xml::closeElement( 'select' );
@@ -598,11 +602,11 @@ class ProtectionForm {
         * @return String
         */
        private function getOptionLabel( $permission ) {
-               if( $permission == '' ) {
+               if ( $permission == '' ) {
                        return wfMessage( 'protect-default' )->text();
                } else {
                        $msg = wfMessage( "protect-level-{$permission}" );
-                       if( $msg->exists() ) {
+                       if ( $msg->exists() ) {
                                return $msg->text();
                        }
                        return wfMessage( 'protect-fallback', $permission )->text();
@@ -613,7 +617,7 @@ class ProtectionForm {
                global $wgRestrictionLevels, $wgOut;
 
                $cascadeableLevels = array();
-               foreach( $wgRestrictionLevels as $key ) {
+               foreach ( $wgRestrictionLevels as $key ) {
                        if ( User::groupHasPermission( $key, 'protect' )
                                || $key == 'protect'
                        ) {
index a4a1ffb..a93639a 100644 (file)
@@ -69,8 +69,9 @@ $wgQueryPages = array(
 wfRunHooks( 'wgQueryPages', array( &$wgQueryPages ) );
 
 global $wgDisableCounters;
-if ( !$wgDisableCounters )
+if ( !$wgDisableCounters ) {
        $wgQueryPages[] = array( 'PopularPagesPage', 'Popularpages' );
+}
 
 /**
  * This is a class for doing query pages; since they're almost all the same,
index 3ea5da4..1a7d825 100644 (file)
@@ -106,7 +106,7 @@ class Revision implements IDBAccessObject {
        public static function newFromTitle( $title, $id = 0, $flags = 0 ) {
                $conds = array(
                        'page_namespace' => $title->getNamespace(),
-                       'page_title'     => $title->getDBkey()
+                       'page_title' => $title->getDBkey()
                );
                if ( $id ) {
                        // Use the specified ID
@@ -228,8 +228,8 @@ class Revision implements IDBAccessObject {
         * @return Revision or null
         */
        public static function loadFromPageId( $db, $pageid, $id = 0 ) {
-               $conds = array( 'rev_page' => intval( $pageid ), 'page_id'  => intval( $pageid ) );
-               if( $id ) {
+               $conds = array( 'rev_page' => intval( $pageid ), 'page_id' => intval( $pageid ) );
+               if ( $id ) {
                        $conds['rev_id'] = intval( $id );
                } else {
                        $conds[] = 'rev_id=page_latest';
@@ -248,7 +248,7 @@ class Revision implements IDBAccessObject {
         * @return Revision or null
         */
        public static function loadFromTitle( $db, $title, $id = 0 ) {
-               if( $id ) {
+               if ( $id ) {
                        $matchId = intval( $id );
                } else {
                        $matchId = 'page_latest';
@@ -257,7 +257,7 @@ class Revision implements IDBAccessObject {
                        array(
                                "rev_id=$matchId",
                                'page_namespace' => $title->getNamespace(),
-                               'page_title'     => $title->getDBkey()
+                               'page_title' => $title->getDBkey()
                        )
                );
        }
@@ -275,9 +275,9 @@ class Revision implements IDBAccessObject {
        public static function loadFromTimestamp( $db, $title, $timestamp ) {
                return self::loadFromConds( $db,
                        array(
-                               'rev_timestamp'  => $db->timestamp( $timestamp ),
+                               'rev_timestamp' => $db->timestamp( $timestamp ),
                                'page_namespace' => $title->getNamespace(),
-                               'page_title'     => $title->getDBkey()
+                               'page_title' => $title->getDBkey()
                        )
                );
        }
@@ -312,9 +312,9 @@ class Revision implements IDBAccessObject {
         */
        private static function loadFromConds( $db, $conditions, $flags = 0 ) {
                $res = self::fetchFromConds( $db, $conditions, $flags );
-               if( $res ) {
+               if ( $res ) {
                        $row = $res->fetchObject();
-                       if( $row ) {
+                       if ( $row ) {
                                $ret = new Revision( $row );
                                return $ret;
                        }
@@ -337,7 +337,7 @@ class Revision implements IDBAccessObject {
                        array(
                                'rev_id=page_latest',
                                'page_namespace' => $title->getNamespace(),
-                               'page_title'     => $title->getDBkey()
+                               'page_title' => $title->getDBkey()
                        )
                );
        }
@@ -489,7 +489,7 @@ class Revision implements IDBAccessObject {
         * @access private
         */
        function __construct( $row ) {
-               if( is_object( $row ) ) {
+               if ( is_object( $row ) ) {
                        $this->mId        = intval( $row->rev_id );
                        $this->mPage      = intval( $row->rev_page );
                        $this->mTextId    = intval( $row->rev_text_id );
@@ -517,7 +517,7 @@ class Revision implements IDBAccessObject {
                                $this->mSha1 = $row->rev_sha1;
                        }
 
-                       if( isset( $row->page_latest ) ) {
+                       if ( isset( $row->page_latest ) ) {
                                $this->mCurrent = ( $row->rev_id == $row->page_latest );
                                $this->mTitle = Title::newFromRow( $row );
                        } else {
@@ -525,13 +525,13 @@ class Revision implements IDBAccessObject {
                                $this->mTitle = null;
                        }
 
-                       if( !isset( $row->rev_content_model ) || is_null( $row->rev_content_model ) ) {
+                       if ( !isset( $row->rev_content_model ) || is_null( $row->rev_content_model ) ) {
                                $this->mContentModel = null; # determine on demand if needed
                        } else {
                                $this->mContentModel = strval( $row->rev_content_model );
                        }
 
-                       if( !isset( $row->rev_content_format ) || is_null( $row->rev_content_format ) ) {
+                       if ( !isset( $row->rev_content_format ) || is_null( $row->rev_content_format ) ) {
                                $this->mContentFormat = null; # determine on demand if needed
                        } else {
                                $this->mContentFormat = strval( $row->rev_content_format );
@@ -539,7 +539,7 @@ class Revision implements IDBAccessObject {
 
                        // Lazy extraction...
                        $this->mText = null;
-                       if( isset( $row->old_text ) ) {
+                       if ( isset( $row->old_text ) ) {
                                $this->mTextRow = $row;
                        } else {
                                // 'text' table row entry will be lazy-loaded
@@ -554,7 +554,7 @@ class Revision implements IDBAccessObject {
                                $this->mUserText = $row->user_name; // logged-in user
                        }
                        $this->mOrigUserText = $row->rev_user_text;
-               } elseif( is_array( $row ) ) {
+               } elseif ( is_array( $row ) ) {
                        // Build a new revision to be saved...
                        global $wgUser; // ugh
 
@@ -714,10 +714,10 @@ class Revision implements IDBAccessObject {
         * @return Title|null
         */
        public function getTitle() {
-               if( isset( $this->mTitle ) ) {
+               if ( isset( $this->mTitle ) ) {
                        return $this->mTitle;
                }
-               if( !is_null( $this->mId ) ) { //rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
+               if ( !is_null( $this->mId ) ) { //rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow(
                                array( 'page', 'revision' ),
@@ -769,9 +769,9 @@ class Revision implements IDBAccessObject {
         * @return Integer
         */
        public function getUser( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
+               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
                        return 0;
-               } elseif( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
+               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
                        return 0;
                } else {
                        return $this->mUser;
@@ -801,9 +801,9 @@ class Revision implements IDBAccessObject {
         * @return string
         */
        public function getUserText( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
+               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_USER ) ) {
                        return '';
-               } elseif( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
+               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_USER, $user ) ) {
                        return '';
                } else {
                        return $this->getRawUserText();
@@ -841,9 +841,9 @@ class Revision implements IDBAccessObject {
         * @return String
         */
        function getComment( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
+               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_COMMENT ) ) {
                        return '';
-               } elseif( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_COMMENT, $user ) ) {
+               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_COMMENT, $user ) ) {
                        return '';
                } else {
                        return $this->mComment;
@@ -870,17 +870,17 @@ class Revision implements IDBAccessObject {
         * @return Integer rcid of the unpatrolled row, zero if there isn't one
         */
        public function isUnpatrolled() {
-               if( $this->mUnpatrolled !== null ) {
+               if ( $this->mUnpatrolled !== null ) {
                        return $this->mUnpatrolled;
                }
                $dbr = wfGetDB( DB_SLAVE );
                $this->mUnpatrolled = $dbr->selectField( 'recentchanges',
                        'rc_id',
                        array( // Add redundant user,timestamp condition so we can use the existing index
-                               'rc_user_text'  => $this->getRawUserText(),
-                               'rc_timestamp'  => $dbr->timestamp( $this->getTimestamp() ),
+                               'rc_user_text' => $this->getRawUserText(),
+                               'rc_timestamp' => $dbr->timestamp( $this->getTimestamp() ),
                                'rc_this_oldid' => $this->getId(),
-                               'rc_patrolled'  => 0
+                               'rc_patrolled' => 0
                        ),
                        __METHOD__
                );
@@ -943,9 +943,9 @@ class Revision implements IDBAccessObject {
         * @return Content|null
         */
        public function getContent( $audience = self::FOR_PUBLIC, User $user = null ) {
-               if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
+               if ( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
                        return null;
-               } elseif( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_TEXT, $user ) ) {
+               } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( self::DELETED_TEXT, $user ) ) {
                        return null;
                } else {
                        return $this->getContentInternal();
@@ -996,9 +996,9 @@ class Revision implements IDBAccessObject {
         * @return Content|null the Revision's content, or null on failure.
         */
        protected function getContentInternal() {
-               if( is_null( $this->mContent ) ) {
+               if ( is_null( $this->mContent ) ) {
                        // Revision is immutable. Load on demand:
-                       if( is_null( $this->mText ) ) {
+                       if ( is_null( $this->mText ) ) {
                                $this->mText = $this->loadText();
                        }
 
@@ -1097,9 +1097,9 @@ class Revision implements IDBAccessObject {
         * @return Revision|null
         */
        public function getPrevious() {
-               if( $this->getTitle() ) {
+               if ( $this->getTitle() ) {
                        $prev = $this->getTitle()->getPreviousRevisionID( $this->getId() );
-                       if( $prev ) {
+                       if ( $prev ) {
                                return self::newFromTitle( $this->getTitle(), $prev );
                        }
                }
@@ -1112,7 +1112,7 @@ class Revision implements IDBAccessObject {
         * @return Revision or null
         */
        public function getNext() {
-               if( $this->getTitle() ) {
+               if ( $this->getTitle() ) {
                        $next = $this->getTitle()->getNextRevisionID( $this->getId() );
                        if ( $next ) {
                                return self::newFromTitle( $this->getTitle(), $next );
@@ -1129,11 +1129,11 @@ class Revision implements IDBAccessObject {
         * @return Integer
         */
        private function getPreviousRevisionId( $db ) {
-               if( is_null( $this->mPage ) ) {
+               if ( is_null( $this->mPage ) ) {
                        return 0;
                }
                # Use page_latest if ID is not given
-               if( !$this->mId ) {
+               if ( !$this->mId ) {
                        $prevId = $db->selectField( 'page', 'page_latest',
                                array( 'page_id' => $this->mPage ),
                                __METHOD__ );
@@ -1166,13 +1166,13 @@ class Revision implements IDBAccessObject {
                $textField = $prefix . 'text';
                $flagsField = $prefix . 'flags';
 
-               if( isset( $row->$flagsField ) ) {
+               if ( isset( $row->$flagsField ) ) {
                        $flags = explode( ',', $row->$flagsField );
                } else {
                        $flags = array();
                }
 
-               if( isset( $row->$textField ) ) {
+               if ( isset( $row->$textField ) ) {
                        $text = $row->$textField;
                } else {
                        wfProfileOut( __METHOD__ );
@@ -1183,7 +1183,7 @@ class Revision implements IDBAccessObject {
                if ( in_array( 'external', $flags ) ) {
                        $url = $text;
                        $parts = explode( '://', $url, 2 );
-                       if( count( $parts ) == 1 || $parts[1] == '' ) {
+                       if ( count( $parts ) == 1 || $parts[1] == '' ) {
                                wfProfileOut( __METHOD__ );
                                return false;
                        }
@@ -1192,14 +1192,14 @@ class Revision implements IDBAccessObject {
 
                // If the text was fetched without an error, convert it
                if ( $text !== false ) {
-                       if( in_array( 'gzip', $flags ) ) {
+                       if ( in_array( 'gzip', $flags ) ) {
                                # Deal with optional compression of archived pages.
                                # This can be done periodically via maintenance/compressOld.php, and
                                # as pages are saved if $wgCompressRevisions is set.
                                $text = gzinflate( $text );
                        }
 
-                       if( in_array( 'object', $flags ) ) {
+                       if ( in_array( 'object', $flags ) ) {
                                # Generic compressed storage
                                $obj = unserialize( $text );
                                if ( !is_object( $obj ) ) {
@@ -1211,7 +1211,7 @@ class Revision implements IDBAccessObject {
                        }
 
                        global $wgLegacyEncoding;
-                       if( $text !== false && $wgLegacyEncoding
+                       if ( $text !== false && $wgLegacyEncoding
                                && !in_array( 'utf-8', $flags ) && !in_array( 'utf8', $flags ) )
                        {
                                # Old revisions kept around in a legacy encoding?
@@ -1244,8 +1244,8 @@ class Revision implements IDBAccessObject {
                # on load if $wgLegacyCharset is set in the future.
                $flags[] = 'utf-8';
 
-               if( $wgCompressRevisions ) {
-                       if( function_exists( 'gzdeflate' ) ) {
+               if ( $wgCompressRevisions ) {
+                       if ( function_exists( 'gzdeflate' ) ) {
                                $text = gzdeflate( $text );
                                $flags[] = 'gzip';
                        } else {
@@ -1274,33 +1274,35 @@ class Revision implements IDBAccessObject {
                $flags = self::compressRevisionText( $data );
 
                # Write to external storage if required
-               if( $wgDefaultExternalStore ) {
+               if ( $wgDefaultExternalStore ) {
                        // Store and get the URL
                        $data = ExternalStore::insertToDefault( $data );
-                       if( !$data ) {
+                       if ( !$data ) {
                                wfProfileOut( __METHOD__ );
                                throw new MWException( "Unable to store text to external storage" );
                        }
-                       if( $flags ) {
+                       if ( $flags ) {
                                $flags .= ',';
                        }
                        $flags .= 'external';
                }
 
                # Record the text (or external storage URL) to the text table
-               if( !isset( $this->mTextId ) ) {
+               if ( !isset( $this->mTextId ) ) {
                        $old_id = $dbw->nextSequenceValue( 'text_old_id_seq' );
                        $dbw->insert( 'text',
                                array(
-                                       'old_id'    => $old_id,
-                                       'old_text'  => $data,
+                                       'old_id' => $old_id,
+                                       'old_text' => $data,
                                        'old_flags' => $flags,
                                ), __METHOD__
                        );
                        $this->mTextId = $dbw->insertId();
                }
 
-               if ( $this->mComment === null ) $this->mComment = "";
+               if ( $this->mComment === null ) {
+                       $this->mComment = "";
+               }
 
                # Record the edit in revisions
                $rev_id = isset( $this->mId )
@@ -1424,9 +1426,9 @@ class Revision implements IDBAccessObject {
                global $wgRevisionCacheExpiry, $wgMemc;
                $textId = $this->getTextId();
                $key = wfMemcKey( 'revisiontext', 'textid', $textId );
-               if( $wgRevisionCacheExpiry ) {
+               if ( $wgRevisionCacheExpiry ) {
                        $text = $wgMemc->get( $key );
-                       if( is_string( $text ) ) {
+                       if ( is_string( $text ) ) {
                                wfDebug( __METHOD__ . ": got id $textId from cache\n" );
                                wfProfileOut( __METHOD__ );
                                return $text;
@@ -1441,7 +1443,7 @@ class Revision implements IDBAccessObject {
                        $row = null;
                }
 
-               if( !$row ) {
+               if ( !$row ) {
                        // Text data is immutable; check slaves first.
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow( 'text',
@@ -1450,7 +1452,7 @@ class Revision implements IDBAccessObject {
                                __METHOD__ );
                }
 
-               if( !$row && wfGetLB()->getServerCount() > 1 ) {
+               if ( !$row && wfGetLB()->getServerCount() > 1 ) {
                        // Possible slave lag!
                        $dbw = wfGetDB( DB_MASTER );
                        $row = $dbw->selectRow( 'text',
@@ -1462,7 +1464,7 @@ class Revision implements IDBAccessObject {
                $text = self::getRevisionText( $row );
 
                # No negative caching -- negative hits on text rows may be due to corrupted slave servers
-               if( $wgRevisionCacheExpiry && $text !== false ) {
+               if ( $wgRevisionCacheExpiry && $text !== false ) {
                        $wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
                }
 
@@ -1507,7 +1509,7 @@ class Revision implements IDBAccessObject {
                                ),
                        __METHOD__ );
 
-               if( $current ) {
+               if ( $current ) {
                        $row = array(
                                'page'       => $pageId,
                                'comment'    => $summary,
@@ -1560,7 +1562,7 @@ class Revision implements IDBAccessObject {
         * @return Boolean
         */
        public static function userCanBitfield( $bitfield, $field, User $user = null ) {
-               if( $bitfield & $field ) { // aspect is deleted
+               if ( $bitfield & $field ) { // aspect is deleted
                        if ( $bitfield & self::DELETED_RESTRICTED ) {
                                $permission = 'suppressrevision';
                        } elseif ( $field & self::DELETED_TEXT ) {
@@ -1613,7 +1615,7 @@ class Revision implements IDBAccessObject {
        static function countByPageId( $db, $id ) {
                $row = $db->selectRow( 'revision', array( 'revCount' => 'COUNT(*)' ),
                        array( 'rev_page' => $id ), __METHOD__ );
-               if( $row ) {
+               if ( $row ) {
                        return $row->revCount;
                }
                return 0;
@@ -1628,7 +1630,7 @@ class Revision implements IDBAccessObject {
         */
        static function countByTitle( $db, $title ) {
                $id = $title->getArticleID();
-               if( $id ) {
+               if ( $id ) {
                        return self::countByPageId( $db, $id );
                }
                return 0;
@@ -1650,7 +1652,9 @@ class Revision implements IDBAccessObject {
         * @return bool True if the given user was the only one to edit since the given timestamp
         */
        public static function userWasLastToEdit( $db, $pageId, $userId, $since ) {
-               if ( !$userId ) return false;
+               if ( !$userId ) {
+                       return false;
+               }
 
                if ( is_int( $db ) ) {
                        $db = wfGetDB( $db );
index 666df96..1b865bb 100644 (file)
@@ -105,7 +105,7 @@ abstract class RevisionListBase extends ContextSource {
         * @return int
         */
        public function length() {
-               if( !$this->res ) {
+               if ( !$this->res ) {
                        return 0;
                } else {
                        return $this->res->numRows();
index 3acb740..b9b0591 100644 (file)
@@ -405,7 +405,7 @@ class Sanitizer {
                                'td', 'th', 'tr',
                        );
                        $htmllist = array( # Tags used by list
-                               'ul','ol',
+                               'ul', 'ol',
                        );
                        $listtags = array( # Tags that can appear in a list
                                'li',
@@ -446,7 +446,7 @@ class Sanitizer {
                                # $params: String between element name and >
                                # $brace: Ending '>' or '/>'
                                # $rest: Everything until the next element of $bits
-                               if( preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs ) ) {
+                               if ( preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs ) ) {
                                        list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
                                } else {
                                        $slash = $t = $params = $brace = $rest = null;
@@ -537,7 +537,7 @@ class Sanitizer {
 
                                                # Replace any variables or template parameters with
                                                # plaintext results.
-                                               if( is_callable( $processCallback ) ) {
+                                               if ( is_callable( $processCallback ) ) {
                                                        call_user_func_array( $processCallback, array( &$params, $args ) );
                                                }
 
@@ -572,7 +572,7 @@ class Sanitizer {
                                @list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs;
                                $badtag = false;
                                if ( isset( $htmlelements[$t = strtolower( $t )] ) ) {
-                                       if( is_callable( $processCallback ) ) {
+                                       if ( is_callable( $processCallback ) ) {
                                                call_user_func_array( $processCallback, array( &$params, $args ) );
                                        }
 
@@ -623,8 +623,9 @@ class Sanitizer {
                                $spaceStart--;
                                $spaceLen++;
                        }
-                       while ( substr( $text, $spaceStart + $spaceLen, 1 ) === ' ' )
+                       while ( substr( $text, $spaceStart + $spaceLen, 1 ) === ' ' ) {
                                $spaceLen++;
+                       }
                        if ( substr( $text, $spaceStart, 1 ) === "\n" and substr( $text, $spaceStart + $spaceLen, 1 ) === "\n" ) {
                                # Remove the comment, leading and trailing
                                # spaces, and leave only one newline.
@@ -714,7 +715,7 @@ class Sanitizer {
                $hrefExp = '/^(' . wfUrlProtocols() . ')[^\s]+$/';
 
                $out = array();
-               foreach( $attribs as $attribute => $value ) {
+               foreach ( $attribs as $attribute => $value ) {
                        #allow XML namespace declaration if RDFa is enabled
                        if ( $wgAllowRdfaAttributes && preg_match( self::XMLNS_ATTRIBUTE_PATTERN, $attribute ) ) {
                                if ( !preg_match( self::EVIL_URI_PATTERN, $value ) ) {
@@ -731,7 +732,7 @@ class Sanitizer {
 
                        # Strip javascript "expression" from stylesheets.
                        # http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp
-                       if( $attribute == 'style' ) {
+                       if ( $attribute == 'style' ) {
                                $value = Sanitizer::checkCss( $value );
                        }
 
@@ -800,9 +801,10 @@ class Sanitizer {
         */
        static function mergeAttributes( $a, $b ) {
                $out = array_merge( $a, $b );
-               if( isset( $a['class'] ) && isset( $b['class'] )
-               && is_string( $a['class'] ) && is_string( $b['class'] )
-               && $a['class'] !== $b['class'] ) {
+               if ( isset( $a['class'] ) && isset( $b['class'] )
+                       && is_string( $a['class'] ) && is_string( $b['class'] )
+                       && $a['class'] !== $b['class']
+               ) {
                        $classes = preg_split( '/\s+/', "{$a['class']} {$b['class']}",
                                -1, PREG_SPLIT_NO_EMPTY );
                        $out['class'] = implode( ' ', array_unique( $classes ) );
@@ -925,7 +927,7 @@ class Sanitizer {
         * @return String
         */
        static function fixTagAttributes( $text, $element ) {
-               if( trim( $text ) == '' ) {
+               if ( trim( $text ) == '' ) {
                        return '';
                }
 
@@ -933,7 +935,7 @@ class Sanitizer {
                $stripped = Sanitizer::validateTagAttributes( $decoded, $element );
 
                $attribs = array();
-               foreach( $stripped as $attribute => $value ) {
+               foreach ( $stripped as $attribute => $value ) {
                        $encAttribute = htmlspecialchars( $attribute );
                        $encValue = Sanitizer::safeEncodeAttribute( $value );
 
@@ -1111,13 +1113,13 @@ class Sanitizer {
         * @return Array
         */
        public static function decodeTagAttributes( $text ) {
-               if( trim( $text ) == '' ) {
+               if ( trim( $text ) == '' ) {
                        return array();
                }
 
                $attribs = array();
                $pairs = array();
-               if( !preg_match_all(
+               if ( !preg_match_all(
                        self::getAttribsRegex(),
                        $text,
                        $pairs,
@@ -1125,7 +1127,7 @@ class Sanitizer {
                        return $attribs;
                }
 
-               foreach( $pairs as $set ) {
+               foreach ( $pairs as $set ) {
                        $attribute = strtolower( $set[1] );
                        $value = Sanitizer::getTagAttributeCallback( $set );
 
@@ -1148,19 +1150,19 @@ class Sanitizer {
         * @return String
         */
        private static function getTagAttributeCallback( $set ) {
-               if( isset( $set[6] ) ) {
+               if ( isset( $set[6] ) ) {
                        # Illegal #XXXXXX color with no quotes.
                        return $set[6];
-               } elseif( isset( $set[5] ) ) {
+               } elseif ( isset( $set[5] ) ) {
                        # No quotes.
                        return $set[5];
-               } elseif( isset( $set[4] ) ) {
+               } elseif ( isset( $set[4] ) ) {
                        # Single-quoted
                        return $set[4];
-               } elseif( isset( $set[3] ) ) {
+               } elseif ( isset( $set[3] ) ) {
                        # Double-quoted
                        return $set[3];
-               } elseif( !isset( $set[2] ) ) {
+               } elseif ( !isset( $set[2] ) ) {
                        # In XHTML, attributes must have a value.
                        # For 'reduced' form, return explicitly the attribute name here.
                        return $set[1];
@@ -1236,14 +1238,14 @@ class Sanitizer {
         */
        static function normalizeCharReferencesCallback( $matches ) {
                $ret = null;
-               if( $matches[1] != '' ) {
+               if ( $matches[1] != '' ) {
                        $ret = Sanitizer::normalizeEntity( $matches[1] );
-               } elseif( $matches[2] != '' ) {
+               } elseif ( $matches[2] != '' ) {
                        $ret = Sanitizer::decCharReference( $matches[2] );
-               } elseif( $matches[3] != '' ) {
+               } elseif ( $matches[3] != '' ) {
                        $ret = Sanitizer::hexCharReference( $matches[3] );
                }
-               if( is_null( $ret ) ) {
+               if ( is_null( $ret ) ) {
                        return htmlspecialchars( $matches[0] );
                } else {
                        return $ret;
@@ -1279,7 +1281,7 @@ class Sanitizer {
         */
        static function decCharReference( $codepoint ) {
                $point = intval( $codepoint );
-               if( Sanitizer::validateCodepoint( $point ) ) {
+               if ( Sanitizer::validateCodepoint( $point ) ) {
                        return sprintf( '&#%d;', $point );
                } else {
                        return null;
@@ -1292,7 +1294,7 @@ class Sanitizer {
         */
        static function hexCharReference( $codepoint ) {
                $point = hexdec( $codepoint );
-               if( Sanitizer::validateCodepoint( $point ) ) {
+               if ( Sanitizer::validateCodepoint( $point ) ) {
                        return sprintf( '&#x%x;', $point );
                } else {
                        return null;
@@ -1356,11 +1358,11 @@ class Sanitizer {
         * @return String
         */
        static function decodeCharReferencesCallback( $matches ) {
-               if( $matches[1] != '' ) {
+               if ( $matches[1] != '' ) {
                        return Sanitizer::decodeEntity( $matches[1] );
-               } elseif( $matches[2] != '' ) {
+               } elseif ( $matches[2] != '' ) {
                        return Sanitizer::decodeChar( intval( $matches[2] ) );
-               } elseif( $matches[3] != '' ) {
+               } elseif ( $matches[3] != '' ) {
                        return Sanitizer::decodeChar( hexdec( $matches[3] ) );
                }
                # Last case should be an ampersand by itself
@@ -1375,7 +1377,7 @@ class Sanitizer {
         * @private
         */
        static function decodeChar( $codepoint ) {
-               if( Sanitizer::validateCodepoint( $codepoint ) ) {
+               if ( Sanitizer::validateCodepoint( $codepoint ) ) {
                        return codepointToUtf8( $codepoint );
                } else {
                        return UTF8_REPLACEMENT;
@@ -1394,7 +1396,7 @@ class Sanitizer {
                if ( isset( self::$htmlEntityAliases[$name] ) ) {
                        $name = self::$htmlEntityAliases[$name];
                }
-               if( isset( self::$htmlEntities[$name] ) ) {
+               if ( isset( self::$htmlEntities[$name] ) ) {
                        return codepointToUtf8( self::$htmlEntities[$name] );
                } else {
                        return "&$name;";
@@ -1662,7 +1664,7 @@ class Sanitizer {
         */
        static function hackDocType() {
                $out = "<!DOCTYPE html [\n";
-               foreach( self::$htmlEntities as $entity => $codepoint ) {
+               foreach ( self::$htmlEntities as $entity => $codepoint ) {
                        $out .= "<!ENTITY $entity \"&#$codepoint;\">";
                }
                $out .= "]>\n";
@@ -1684,7 +1686,7 @@ class Sanitizer {
 
                # Validate hostname portion
                $matches = array();
-               if( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) {
+               if ( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) {
                        list( /* $whole */, $protocol, $host, $rest ) = $matches;
 
                        // Characters that will be ignored in IDNs.
@@ -1754,7 +1756,7 @@ class Sanitizer {
         */
        public static function validateEmail( $addr ) {
                $result = null;
-               if( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) {
+               if ( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result ) ) ) {
                        return $result;
                }
 
index 08ab143..1ceee49 100644 (file)
@@ -44,8 +44,12 @@ if ( !isset( $wgVersion ) ) {
 }
 
 // Set various default paths sensibly...
-if ( $wgScript === false ) $wgScript = "$wgScriptPath/index$wgScriptExtension";
-if ( $wgLoadScript === false ) $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+if ( $wgScript === false ) {
+       $wgScript = "$wgScriptPath/index$wgScriptExtension";
+}
+if ( $wgLoadScript === false ) {
+       $wgLoadScript = "$wgScriptPath/load$wgScriptExtension";
+}
 
 if ( $wgArticlePath === false ) {
        if ( $wgUsePathInfo ) {
@@ -61,24 +65,38 @@ if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
        $wgActionPaths['view'] = $wgArticlePath;
 }
 
-if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
-       # 'view' is assumed the default action path everywhere in the code
-       # but is rarely filled in $wgActionPaths
-       $wgActionPaths['view'] = $wgArticlePath;
+if ( $wgStylePath === false ) {
+       $wgStylePath = "$wgScriptPath/skins";
+}
+if ( $wgLocalStylePath === false ) {
+       $wgLocalStylePath = "$wgScriptPath/skins";
+}
+if ( $wgStyleDirectory === false ) {
+       $wgStyleDirectory = "$IP/skins";
+}
+if ( $wgExtensionAssetsPath === false ) {
+       $wgExtensionAssetsPath = "$wgScriptPath/extensions";
 }
 
-if ( $wgStylePath === false ) $wgStylePath = "$wgScriptPath/skins";
-if ( $wgLocalStylePath === false ) $wgLocalStylePath = "$wgScriptPath/skins";
-if ( $wgStyleDirectory === false ) $wgStyleDirectory = "$IP/skins";
-if ( $wgExtensionAssetsPath === false ) $wgExtensionAssetsPath = "$wgScriptPath/extensions";
-
-if ( $wgLogo === false ) $wgLogo = "$wgStylePath/common/images/wiki.png";
+if ( $wgLogo === false ) {
+       $wgLogo = "$wgStylePath/common/images/wiki.png";
+}
 
-if ( $wgUploadPath === false ) $wgUploadPath = "$wgScriptPath/images";
-if ( $wgUploadDirectory === false ) $wgUploadDirectory = "$IP/images";
-if ( $wgReadOnlyFile === false ) $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
-if ( $wgFileCacheDirectory === false ) $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
-if ( $wgDeletedDirectory === false ) $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+if ( $wgUploadPath === false ) {
+       $wgUploadPath = "$wgScriptPath/images";
+}
+if ( $wgUploadDirectory === false ) {
+       $wgUploadDirectory = "$IP/images";
+}
+if ( $wgReadOnlyFile === false ) {
+       $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
+}
+if ( $wgFileCacheDirectory === false ) {
+       $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
+}
+if ( $wgDeletedDirectory === false ) {
+       $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
+}
 
 if ( isset( $wgFileStore['deleted']['directory'] ) ) {
        $wgDeletedDirectory = $wgFileStore['deleted']['directory'];
@@ -129,13 +147,13 @@ $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
  * Initialise $wgLockManagers to include basic FS version
  */
 $wgLockManagers[] = array(
-       'name'          => 'fsLockManager',
-       'class'         => 'FSLockManager',
+       'name' => 'fsLockManager',
+       'class' => 'FSLockManager',
        'lockDirectory' => "{$wgUploadDirectory}/lockdir",
 );
 $wgLockManagers[] = array(
-       'name'          => 'nullLockManager',
-       'class'         => 'NullLockManager',
+       'name' => 'nullLockManager',
+       'class' => 'NullLockManager',
 );
 
 /**
@@ -201,15 +219,15 @@ if ( $wgUseSharedUploads ) {
 }
 if ( $wgUseInstantCommons ) {
        $wgForeignFileRepos[] = array(
-               'class'                  => 'ForeignAPIRepo',
-               'name'                   => 'wikimediacommons',
-               'apibase'                => WebRequest::detectProtocol() === 'https' ?
+               'class' => 'ForeignAPIRepo',
+               'name' => 'wikimediacommons',
+               'apibase' => WebRequest::detectProtocol() === 'https' ?
                        'https://commons.wikimedia.org/w/api.php' :
                        'http://commons.wikimedia.org/w/api.php',
-               'hashLevels'             => 2,
-               'fetchDescription'       => true,
+               'hashLevels' => 2,
+               'fetchDescription' => true,
                'descriptionCacheExpiry' => 43200,
-               'apiThumbCacheExpiry'    => 86400,
+               'apiThumbCacheExpiry' => 86400,
        );
 }
 /*
@@ -300,7 +318,7 @@ $wgCanonicalNamespaceNames = array(
 );
 
 /// @todo UGLY UGLY
-if( is_array( $wgExtraNamespaces ) ) {
+if ( is_array( $wgExtraNamespaces ) ) {
        $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
 }
 
@@ -322,7 +340,7 @@ if ( !$wgEnotifMinorEdits ) {
 }
 
 # $wgDisabledActions is deprecated as of 1.18
-foreach( $wgDisabledActions as $action ) {
+foreach ( $wgDisabledActions as $action ) {
        $wgActions[$action] = false;
 }
 
@@ -432,7 +450,7 @@ if ( is_null( $wgLocaltimezone ) ) {
 }
 
 date_default_timezone_set( $wgLocaltimezone );
-if( is_null( $wgLocalTZoffset ) ) {
+if ( is_null( $wgLocalTZoffset ) ) {
        $wgLocalTZoffset = date( 'Z' ) / 60;
 }
 
@@ -538,10 +556,11 @@ foreach ( $wgExtensionFunctions as $func ) {
        if ( is_object( $func ) && $func instanceof Closure ) {
                $profName = $fname . '-extensions-closure';
        } elseif ( is_array( $func ) ) {
-               if ( is_object( $func[0] ) )
+               if ( is_object( $func[0] ) ) {
                        $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
-               else
+               } else {
                        $profName = $fname . '-extensions-' . implode( '::', $func );
+               }
        } else {
                $profName = $fname . '-extensions-' . strval( $func );
        }
index 2d250df..63c3d34 100644 (file)
@@ -191,11 +191,11 @@ class SiteConfiguration {
         */
        protected function getSetting( $settingName, $wiki, /*array*/ $params ) {
                $retval = null;
-               if( array_key_exists( $settingName, $this->settings ) ) {
+               if ( array_key_exists( $settingName, $this->settings ) ) {
                        $thisSetting =& $this->settings[$settingName];
                        do {
                                // Do individual wiki settings
-                               if( array_key_exists( $wiki, $thisSetting ) ) {
+                               if ( array_key_exists( $wiki, $thisSetting ) ) {
                                        $retval = $thisSetting[$wiki];
                                        break;
                                } elseif ( array_key_exists( "+$wiki", $thisSetting ) && is_array( $thisSetting["+$wiki"] ) ) {
@@ -203,16 +203,16 @@ class SiteConfiguration {
                                }
 
                                // Do tag settings
-                               foreach( $params['tags'] as $tag ) {
-                                       if( array_key_exists( $tag, $thisSetting ) ) {
+                               foreach ( $params['tags'] as $tag ) {
+                                       if ( array_key_exists( $tag, $thisSetting ) ) {
                                                if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$tag] ) ) {
                                                        $retval = self::arrayMerge( $retval, $thisSetting[$tag] );
                                                } else {
                                                        $retval = $thisSetting[$tag];
                                                }
                                                break 2;
-                                       } elseif( array_key_exists( "+$tag", $thisSetting ) && is_array( $thisSetting["+$tag"] ) ) {
-                                               if( !isset( $retval ) ) {
+                                       } elseif ( array_key_exists( "+$tag", $thisSetting ) && is_array( $thisSetting["+$tag"] ) ) {
+                                               if ( !isset( $retval ) ) {
                                                        $retval = array();
                                                }
                                                $retval = self::arrayMerge( $retval, $thisSetting["+$tag"] );
@@ -220,8 +220,8 @@ class SiteConfiguration {
                                }
                                // Do suffix settings
                                $suffix = $params['suffix'];
-                               if( !is_null( $suffix ) ) {
-                                       if( array_key_exists( $suffix, $thisSetting ) ) {
+                               if ( !is_null( $suffix ) ) {
+                                       if ( array_key_exists( $suffix, $thisSetting ) ) {
                                                if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) {
                                                        $retval = self::arrayMerge( $retval, $thisSetting[$suffix] );
                                                } else {
@@ -237,8 +237,8 @@ class SiteConfiguration {
                                }
 
                                // Fall back to default.
-                               if( array_key_exists( 'default', $thisSetting ) ) {
-                                       if( is_array( $retval ) && is_array( $thisSetting['default'] ) ) {
+                               if ( array_key_exists( 'default', $thisSetting ) ) {
+                                       if ( is_array( $retval ) && is_array( $thisSetting['default'] ) ) {
                                                $retval = self::arrayMerge( $retval, $thisSetting['default'] );
                                        } else {
                                                $retval = $thisSetting['default'];
@@ -248,7 +248,7 @@ class SiteConfiguration {
                        } while ( false );
                }
 
-               if( !is_null( $retval ) && count( $params['params'] ) ) {
+               if ( !is_null( $retval ) && count( $params['params'] ) ) {
                        foreach ( $params['params'] as $key => $value ) {
                                $retval = $this->doReplace( '$' . $key, $value, $retval );
                        }
@@ -266,10 +266,10 @@ class SiteConfiguration {
         * @return string
         */
        function doReplace( $from, $to, $in ) {
-               if( is_string( $in ) ) {
+               if ( is_string( $in ) ) {
                        return str_replace( $from, $to, $in );
-               } elseif( is_array( $in ) ) {
-                       foreach( $in as $key => $val ) {
+               } elseif ( is_array( $in ) ) {
+                       foreach ( $in as $key => $val ) {
                                $in[$key] = $this->doReplace( $from, $to, $val );
                        }
                        return $in;
@@ -289,7 +289,7 @@ class SiteConfiguration {
        public function getAll( $wiki, $suffix = null, $params = array(), $wikiTags = array() ) {
                $params = $this->mergeParams( $wiki, $suffix, $params, $wikiTags );
                $localSettings = array();
-               foreach( $this->settings as $varname => $stuff ) {
+               foreach ( $this->settings as $varname => $stuff ) {
                        $append = false;
                        $var = $varname;
                        if ( substr( $varname, 0, 1 ) == '+' ) {
@@ -409,18 +409,18 @@ class SiteConfiguration {
                        'params' => array(),
                );
 
-               if( !is_callable( $this->siteParamsCallback ) ) {
+               if ( !is_callable( $this->siteParamsCallback ) ) {
                        return $default;
                }
 
                $ret = call_user_func_array( $this->siteParamsCallback, array( $this, $wiki ) );
                # Validate the returned value
-               if( !is_array( $ret ) ) {
+               if ( !is_array( $ret ) ) {
                        return $default;
                }
 
-               foreach( $default as $name => $def ) {
-                       if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) ) {
+               foreach ( $default as $name => $def ) {
+                       if ( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) ) {
                                $ret[$name] = $default[$name];
                        }
                }
@@ -443,7 +443,7 @@ class SiteConfiguration {
        protected function mergeParams( $wiki, $suffix, /*array*/ $params, /*array*/ $wikiTags ) {
                $ret = $this->getWikiParams( $wiki );
 
-               if( is_null( $ret['suffix'] ) ) {
+               if ( is_null( $ret['suffix'] ) ) {
                        $ret['suffix'] = $suffix;
                }
 
@@ -452,10 +452,10 @@ class SiteConfiguration {
                $ret['params'] += $params;
 
                // Automatically fill that ones if needed
-               if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ) {
+               if ( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ) {
                        $ret['params']['lang'] = $ret['lang'];
                }
-               if( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) ) {
+               if ( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) ) {
                        $ret['params']['site'] = $ret['suffix'];
                }
 
@@ -471,7 +471,7 @@ class SiteConfiguration {
        public function siteFromDB( $db ) {
                // Allow override
                $def = $this->getWikiParams( $db );
-               if( !is_null( $def['suffix'] ) && !is_null( $def['lang'] ) ) {
+               if ( !is_null( $def['suffix'] ) && !is_null( $def['lang'] ) ) {
                        return array( $def['suffix'], $def['lang'] );
                }
 
@@ -574,8 +574,8 @@ class SiteConfiguration {
         */
        static function arrayMerge( $array1/* ... */ ) {
                $out = $array1;
-               for( $i = 1; $i < func_num_args(); $i++ ) {
-                       foreach( func_get_arg( $i ) as $key => $value ) {
+               for ( $i = 1; $i < func_num_args(); $i++ ) {
+                       foreach ( func_get_arg( $i ) as $key => $value ) {
                                if ( isset( $out[$key] ) && is_array( $out[$key] ) && is_array( $value ) ) {
                                        $out[$key] = self::arrayMerge( $out[$key], $value );
                                } elseif ( !isset( $out[$key] ) || !$out[$key] && !is_numeric( $key ) ) {
index 4de7333..66bc9ee 100644 (file)
@@ -61,13 +61,13 @@ class SiteStats {
                wfDebug( __METHOD__ . ": reading site_stats from slave\n" );
                $row = self::doLoad( wfGetDB( DB_SLAVE ) );
 
-               if( !self::isSane( $row ) ) {
+               if ( !self::isSane( $row ) ) {
                        // Might have just been initialized during this request? Underflow?
                        wfDebug( __METHOD__ . ": site_stats damaged or missing on slave\n" );
                        $row = self::doLoad( wfGetDB( DB_MASTER ) );
                }
 
-               if( !self::isSane( $row ) ) {
+               if ( !self::isSane( $row ) ) {
                        // Normally the site_stats table is initialized at install time.
                        // Some manual construction scenarios may leave the table empty or
                        // broken, however, for instance when importing from a dump into a
@@ -79,7 +79,7 @@ class SiteStats {
                        $row = self::doLoad( wfGetDB( DB_MASTER ) );
                }
 
-               if( !self::isSane( $row ) ) {
+               if ( !self::isSane( $row ) ) {
                        wfDebug( __METHOD__ . ": site_stats persistently nonsensical o_O\n" );
                }
                return $row;
@@ -205,7 +205,7 @@ class SiteStats {
         */
        static function pagesInNs( $ns ) {
                wfProfileIn( __METHOD__ );
-               if( !isset( self::$pageCount[$ns] ) ) {
+               if ( !isset( self::$pageCount[$ns] ) ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        self::$pageCount[$ns] = (int)$dbr->selectField(
                                'page',
@@ -226,7 +226,7 @@ class SiteStats {
         * @return bool
         */
        private static function isSane( $row ) {
-               if(
+               if (
                        $row === false
                        || $row->ss_total_pages < $row->ss_good_articles
                        || $row->ss_total_edits < $row->ss_total_pages
@@ -234,9 +234,9 @@ class SiteStats {
                        return false;
                }
                // Now check for underflow/overflow
-               foreach( array( 'total_views', 'total_edits', 'good_articles',
+               foreach ( array( 'total_views', 'total_edits', 'good_articles',
                'total_pages', 'users', 'images' ) as $member ) {
-                       if(
+                       if (
                                $row->{"ss_$member"} > 2000000000
                                || $row->{"ss_$member"} < 0
                        ) {
@@ -592,19 +592,19 @@ class SiteStatsInit {
                $counter->files();
 
                // Only do views if we don't want to not count them
-               if( $options['views'] ) {
+               if ( $options['views'] ) {
                        $counter->views();
                }
 
                // Update/refresh
-               if( $options['update'] ) {
+               if ( $options['update'] ) {
                        $counter->update();
                } else {
                        $counter->refresh();
                }
 
                // Count active users if need be
-               if( $options['activeUsers'] ) {
+               if ( $options['activeUsers'] ) {
                        SiteStatsUpdate::cacheUpdate( wfGetDB( DB_MASTER ) );
                }
        }
index 117e6e2..24561d8 100644 (file)
@@ -81,7 +81,7 @@ abstract class Skin extends ContextSource {
         */
        static function getSkinNameMessages() {
                $messages = array();
-               foreach( self::getSkinNames() as $skinKey => $skinName ) {
+               foreach ( self::getSkinNames() as $skinKey => $skinName ) {
                        $messages[] = "skinname-$skinKey";
                }
                return $messages;
@@ -291,7 +291,7 @@ abstract class Skin extends ContextSource {
                        return $this->mRelevantUser;
                }
                $title = $this->getRelevantTitle();
-               if( $title->hasSubjectNamespace( NS_USER ) ) {
+               if ( $title->hasSubjectNamespace( NS_USER ) ) {
                        $rootUser = $title->getRootText();
                        if ( User::isIP( $rootUser ) ) {
                                $this->mRelevantUser = User::newFromName( $rootUser, false );
@@ -668,7 +668,7 @@ abstract class Skin extends ContextSource {
 
                                                if ( $c > 1 ) {
                                                        $subpages .= $wgLang->getDirMarkEntity() . $this->msg( 'pipe-separator' )->escaped();
-                                               } else  {
+                                               } else {
                                                        $subpages .= '&lt; ';
                                                }
 
@@ -1015,7 +1015,7 @@ abstract class Skin extends ContextSource {
         */
        static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) {
                $title = SpecialPage::getSafeTitleFor( $name );
-               if( is_null( $proto ) ) {
+               if ( is_null( $proto ) ) {
                        return $title->getLocalURL( $urlaction );
                } else {
                        return $title->getFullURL( $urlaction, false, $proto );
@@ -1392,17 +1392,17 @@ abstract class Skin extends ContextSource {
 
                $needParse = false;
 
-               if( $name === 'default' ) {
+               if ( $name === 'default' ) {
                        // special case
                        global $wgSiteNotice;
                        $notice = $wgSiteNotice;
-                       if( empty( $notice ) ) {
+                       if ( empty( $notice ) ) {
                                wfProfileOut( __METHOD__ );
                                return false;
                        }
                } else {
                        $msg = $this->msg( $name )->inContentLanguage();
-                       if( $msg->isDisabled() ) {
+                       if ( $msg->isDisabled() ) {
                                wfProfileOut( __METHOD__ );
                                return false;
                        }
@@ -1412,8 +1412,8 @@ abstract class Skin extends ContextSource {
                // Use the extra hash appender to let eg SSL variants separately cache.
                $key = wfMemcKey( $name . $wgRenderHashAppend );
                $cachedNotice = $parserMemc->get( $key );
-               if( is_array( $cachedNotice ) ) {
-                       if( md5( $notice ) == $cachedNotice['hash'] ) {
+               if ( is_array( $cachedNotice ) ) {
+                       if ( md5( $notice ) == $cachedNotice['hash'] ) {
                                $notice = $cachedNotice['html'];
                        } else {
                                $needParse = true;
index ca49024..9b9485e 100644 (file)
@@ -162,7 +162,7 @@ class LegacyTemplate extends BaseTemplate {
                $ret = array();
                $items = array( 'viewcount', 'credits', 'lastmod', 'numberofwatchingusers', 'copyright' );
 
-               foreach( $items as $item ) {
+               foreach ( $items as $item ) {
                        if ( $this->data[$item] !== false ) {
                                $ret[] = $this->data[$item];
                        }
@@ -707,8 +707,9 @@ class LegacyTemplate extends BaseTemplate {
                                case NS_FILE:
                                        $text = wfMessage( 'imagepage' );
                                        # Make link known if image exists, even if the desc. page doesn't.
-                                       if ( wfFindFile( $link ) )
+                                       if ( wfFindFile( $link ) ) {
                                                $linkOptions[] = 'known';
+                                       }
                                        break;
                                case NS_MEDIAWIKI:
                                        $text = wfMessage( 'mediawikipage' );
index a5709ea..17c7808 100644 (file)
@@ -43,7 +43,7 @@ class MediaWiki_I18N {
                $value = wfMessage( $value )->text();
                // interpolate variables
                $m = array();
-               while( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
+               while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
                        list( $src, $var ) = $m;
                        wfSuppressWarnings();
                        $varValue = $this->_context[$var];
@@ -122,6 +122,49 @@ class SkinTemplate extends Skin {
                return new $classname();
        }
 
+       /**
+        * Generates array of language links for the current page
+        *
+        * @return array
+        * @public
+        */
+       public function getLanguages() {
+               global $wgHideInterlanguageLinks;
+               $out = $this->getOutput();
+
+               # Language links
+               $language_urls = array();
+
+               if ( !$wgHideInterlanguageLinks ) {
+                       foreach ( $out->getLanguageLinks() as $languageLinkText ) {
+                               $languageLinkParts = explode( ':', $languageLinkText, 2 );
+                               $class = 'interwiki-' . $languageLinkParts[0];
+                               unset( $languageLinkParts );
+                               $languageLinkTitle = Title::newFromText( $languageLinkText );
+                               if ( $languageLinkTitle ) {
+                                       $ilInterwikiCode = $languageLinkTitle->getInterwiki();
+                                       $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
+
+                                       if ( strval( $ilLangName ) === '' ) {
+                                               $ilLangName = $languageLinkText;
+                                       } else {
+                                               $ilLangName = $this->formatLanguageName( $ilLangName );
+                                       }
+
+                                       $language_urls[] = array(
+                                               'href' => $languageLinkTitle->getFullURL(),
+                                               'text' => $ilLangName,
+                                               'title' => $languageLinkTitle->getText(),
+                                               'class' => $class,
+                                               'lang' => $ilInterwikiCode,
+                                               'hreflang' => $ilInterwikiCode
+                                       );
+                               }
+                       }
+               }
+               return $language_urls;
+       }
+
        /**
         * initialize various variables and generate the template
         *
@@ -132,7 +175,7 @@ class SkinTemplate extends Skin {
                global $wgScript, $wgStylePath;
                global $wgMimeType, $wgJsMimeType;
                global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
-               global $wgDisableCounters, $wgSitename, $wgLogo, $wgHideInterlanguageLinks;
+               global $wgDisableCounters, $wgSitename, $wgLogo;
                global $wgMaxCredits, $wgShowCreditsIfMax;
                global $wgPageShowWatchingUsers;
                global $wgArticlePath, $wgScriptPath, $wgServer;
@@ -229,9 +272,9 @@ class SkinTemplate extends Skin {
                }
 
                $tpl->set( 'catlinks', $this->getCategories() );
-               if( $out->isSyndicated() ) {
+               if ( $out->isSyndicated() ) {
                        $feeds = array();
-                       foreach( $out->getSyndicationLinks() as $format => $link ) {
+                       foreach ( $out->getSyndicationLinks() as $format => $link ) {
                                $feeds[$format] = array(
                                        'text' => $this->msg( "feed-$format" )->text(),
                                        'href' => $link
@@ -409,36 +452,7 @@ class SkinTemplate extends Skin {
                $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
                $tpl->setRef( 'bodytext', $out->mBodytext );
 
-               # Language links
-               $language_urls = array();
-
-               if ( !$wgHideInterlanguageLinks ) {
-                       foreach( $out->getLanguageLinks() as $languageLinkText ) {
-                               $languageLinkParts = explode( ':', $languageLinkText, 2 );
-                               $class = 'interwiki-' . $languageLinkParts[0];
-                               unset( $languageLinkParts );
-                               $languageLinkTitle = Title::newFromText( $languageLinkText );
-                               if ( $languageLinkTitle ) {
-                                       $ilInterwikiCode = $languageLinkTitle->getInterwiki();
-                                       $ilLangName = Language::fetchLanguageName( $ilInterwikiCode );
-
-                                       if ( strval( $ilLangName ) === '' ) {
-                                               $ilLangName = $languageLinkText;
-                                       } else {
-                                               $ilLangName = $this->formatLanguageName( $ilLangName );
-                                       }
-
-                                       $language_urls[] = array(
-                                               'href' => $languageLinkTitle->getFullURL(),
-                                               'text' => $ilLangName,
-                                               'title' => $languageLinkTitle->getText(),
-                                               'class' => $class,
-                                               'lang' => $ilInterwikiCode,
-                                               'hreflang' => $ilInterwikiCode
-                                       );
-                               }
-                       }
-               }
+               $language_urls = $this->getLanguages();
                if ( count( $language_urls ) ) {
                        $tpl->setRef( 'language_urls', $language_urls );
                } else {
@@ -469,7 +483,7 @@ class SkinTemplate extends Skin {
                $tpl->set( 'reporttime', wfReportTime() );
 
                // original version by hansm
-               if( !wfRunHooks( 'SkinTemplateOutputPageBeforeExec', array( &$this, &$tpl ) ) ) {
+               if ( !wfRunHooks( 'SkinTemplateOutputPageBeforeExec', array( &$this, &$tpl ) ) ) {
                        wfDebug( __METHOD__ . ": Hook SkinTemplateOutputPageBeforeExec broke outputPage execution!\n" );
                }
 
@@ -568,7 +582,7 @@ class SkinTemplate extends Skin {
                if ( strval( $page ) !== '' ) {
                        $a['returnto'] = $page;
                        $query = $request->getVal( 'returntoquery', $this->thisquery );
-                       if( $query != '' ) {
+                       if ( $query != '' ) {
                                $a['returntoquery'] = $query;
                        }
                }
@@ -578,7 +592,7 @@ class SkinTemplate extends Skin {
                }
 
                $returnto = wfArrayToCgi( $a );
-               if( $this->loggedin ) {
+               if ( $this->loggedin ) {
                        $personal_urls['userpage'] = array(
                                'text' => $this->username,
                                'href' => &$this->userpageUrlDetails['href'],
@@ -614,7 +628,7 @@ class SkinTemplate extends Skin {
                        # thickens, because the Title object is altered for special pages,
                        # so it doesn't contain the original alias-with-subpage.
                        $origTitle = Title::newFromText( $request->getText( 'title' ) );
-                       if( $origTitle instanceof Title && $origTitle->isSpecialPage() ) {
+                       if ( $origTitle instanceof Title && $origTitle->isSpecialPage() ) {
                                list( $spName, $spPar ) = SpecialPageFactory::resolveAlias( $origTitle->getText() );
                                $active = $spName == 'Contributions'
                                        && ( ( $spPar && $spPar == $this->username )
@@ -662,7 +676,7 @@ class SkinTemplate extends Skin {
                                'class' => $wgSecureLogin ? 'link-https' : ''
                        );
 
-                       if( $this->showIPinHeader() ) {
+                       if ( $this->showIPinHeader() ) {
                                $href = &$this->userpageUrlDetails['href'];
                                $personal_urls['anonuserpage'] = array(
                                        'text' => $this->username,
@@ -705,10 +719,10 @@ class SkinTemplate extends Skin {
         */
        function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
                $classes = array();
-               if( $selected ) {
+               if ( $selected ) {
                        $classes[] = 'selected';
                }
-               if( $checkEdit && !$title->isKnown() ) {
+               if ( $checkEdit && !$title->isKnown() ) {
                        $classes[] = 'new';
                        if ( $query !== '' ) {
                                $query = 'action=edit&redlink=1&' . $query;
@@ -733,7 +747,7 @@ class SkinTemplate extends Skin {
                }
 
                $result = array();
-               if( !wfRunHooks( 'SkinTemplateTabAction', array( &$this,
+               if ( !wfRunHooks( 'SkinTemplateTabAction', array( &$this,
                                $title, $message, $selected, $checkEdit,
                                &$classes, &$query, &$text, &$result ) ) ) {
                        return $result;
@@ -748,7 +762,7 @@ class SkinTemplate extends Skin {
 
        function makeTalkUrlDetails( $name, $urlaction = '' ) {
                $title = Title::newFromText( $name );
-               if( !is_object( $title ) ) {
+               if ( !is_object( $title ) ) {
                        throw new MWException( __METHOD__ . " given invalid pagename $name" );
                }
                $title = $title->getTalkPage();
@@ -831,7 +845,7 @@ class SkinTemplate extends Skin {
                wfRunHooks( 'SkinTemplatePreventOtherActiveTabs', array( &$this, &$preventActiveTabs ) );
 
                // Checks if page is some kind of content
-               if( $title->canExist() ) {
+               if ( $title->canExist() ) {
                        // Gets page objects for the related namespaces
                        $subjectPage = $title->getSubjectPage();
                        $talkPage = $title->getTalkPage();
@@ -1018,7 +1032,7 @@ class SkinTemplate extends Skin {
                                                $params = array();
                                        }
                                        // Loops over each variant
-                                       foreach( $variants as $code ) {
+                                       foreach ( $variants as $code ) {
                                                // Gets variant name from language code
                                                $varname = $pageLang->getVariantname( $code );
                                                // Appends variant link
@@ -1151,9 +1165,9 @@ class SkinTemplate extends Skin {
 
                $nav_urls = array();
                $nav_urls['mainpage'] = array( 'href' => self::makeMainPageUrl() );
-               if( $wgUploadNavigationUrl ) {
+               if ( $wgUploadNavigationUrl ) {
                        $nav_urls['upload'] = array( 'href' => $wgUploadNavigationUrl );
-               } elseif( UploadBase::isEnabled() && UploadBase::isAllowed( $this->getUser() ) === true ) {
+               } elseif ( UploadBase::isEnabled() && UploadBase::isAllowed( $this->getUser() ) === true ) {
                        $nav_urls['upload'] = array( 'href' => self::makeSpecialUrl( 'Upload' ) );
                } else {
                        $nav_urls['upload'] = false;
@@ -1503,8 +1517,9 @@ abstract class BaseTemplate extends QuickTemplate {
                                $ptool['active'] = $plink['active'];
                        }
                        foreach ( array( 'href', 'class', 'text' ) as $k ) {
-                               if ( isset( $plink[$k] ) )
+                               if ( isset( $plink[$k] ) ) {
                                        $ptool['links'][0][$k] = $plink[$k];
+                               }
                        }
                        $personal_tools[$key] = $ptool;
                }
@@ -1543,39 +1558,39 @@ abstract class BaseTemplate extends QuickTemplate {
                        case 'SEARCH':
                                // Search is a special case, skins should custom implement this
                                $boxes[$boxName] = array(
-                                       'id'        => 'p-search',
-                                       'header'    => $this->getMsg( 'search' )->text(),
+                                       'id' => 'p-search',
+                                       'header' => $this->getMsg( 'search' )->text(),
                                        'generated' => false,
-                                       'content'   => true,
+                                       'content' => true,
                                );
                                break;
                        case 'TOOLBOX':
                                $msgObj = $this->getMsg( 'toolbox' );
                                $boxes[$boxName] = array(
-                                       'id'        => 'p-tb',
-                                       'header'    => $msgObj->exists() ? $msgObj->text() : 'toolbox',
+                                       'id' => 'p-tb',
+                                       'header' => $msgObj->exists() ? $msgObj->text() : 'toolbox',
                                        'generated' => false,
-                                       'content'   => $this->getToolbox(),
+                                       'content' => $this->getToolbox(),
                                );
                                break;
                        case 'LANGUAGES':
                                if ( $this->data['language_urls'] ) {
                                        $msgObj = $this->getMsg( 'otherlanguages' );
                                        $boxes[$boxName] = array(
-                                               'id'        => 'p-lang',
-                                               'header'    => $msgObj->exists() ? $msgObj->text() : 'otherlanguages',
+                                               'id' => 'p-lang',
+                                               'header' => $msgObj->exists() ? $msgObj->text() : 'otherlanguages',
                                                'generated' => false,
-                                               'content'   => $this->data['language_urls'],
+                                               'content' => $this->data['language_urls'],
                                        );
                                }
                                break;
                        default:
                                $msgObj = $this->getMsg( $boxName );
                                $boxes[$boxName] = array(
-                                       'id'        => "p-$boxName",
-                                       'header'    => $msgObj->exists() ? $msgObj->text() : $boxName,
+                                       'id' => "p-$boxName",
+                                       'header' => $msgObj->exists() ? $msgObj->text() : $boxName,
                                        'generated' => true,
-                                       'content'   => $content,
+                                       'content' => $content,
                                );
                                break;
                        }
@@ -1615,10 +1630,10 @@ abstract class BaseTemplate extends QuickTemplate {
                } else {
                        if ( $hookContents ) {
                                $boxes['TOOLBOXEND'] = array(
-                                       'id'        => 'p-toolboxend',
-                                       'header'    => $boxes['TOOLBOX']['header'],
+                                       'id' => 'p-toolboxend',
+                                       'header' => $boxes['TOOLBOX']['header'],
                                        'generated' => false,
-                                       'content'   => "<ul>{$hookContents}</ul>",
+                                       'content' => "<ul>{$hookContents}</ul>",
                                );
                                // HACK: Make sure that TOOLBOXEND is sorted next to TOOLBOX
                                $boxes2 = array();
@@ -1868,10 +1883,10 @@ abstract class BaseTemplate extends QuickTemplate {
 
                // Reduce footer links down to only those which are being used
                $validFooterLinks = array();
-               foreach( $footerlinks as $category => $links ) {
+               foreach ( $footerlinks as $category => $links ) {
                        $validFooterLinks[$category] = array();
-                       foreach( $links as $link ) {
-                               if( isset( $this->data[$link] ) && $this->data[$link] ) {
+                       foreach ( $links as $link ) {
+                               if ( isset( $this->data[$link] ) && $this->data[$link] ) {
                                        $validFooterLinks[$category][] = $link;
                                }
                        }
index d8f6fd9..c2814e6 100644 (file)
@@ -445,7 +445,10 @@ class SpecialPage {
         * @return Mixed
         * @deprecated since 1.18
         */
-       function name( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mName, $x ); }
+       function name( $x = null ) {
+               wfDeprecated( __METHOD__, '1.18' );
+               return wfSetVar( $this->mName, $x );
+       }
 
        /**
         * These mutators are very evil, as the relevant variables should not mutate.  So
@@ -454,7 +457,10 @@ class SpecialPage {
         * @return Mixed
         * @deprecated since 1.18
         */
-       function restriction( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mRestriction, $x ); }
+       function restriction( $x = null ) {
+               wfDeprecated( __METHOD__, '1.18' );
+               return wfSetVar( $this->mRestriction, $x );
+       }
 
        /**
         * These mutators are very evil, as the relevant variables should not mutate.  So
@@ -463,7 +469,10 @@ class SpecialPage {
         * @return Mixed
         * @deprecated since 1.18
         */
-       function func( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFunction, $x ); }
+       function func( $x = null ) {
+               wfDeprecated( __METHOD__, '1.18' );
+               return wfSetVar( $this->mFunction, $x );
+       }
 
        /**
         * These mutators are very evil, as the relevant variables should not mutate.  So
@@ -472,7 +481,10 @@ class SpecialPage {
         * @return Mixed
         * @deprecated since 1.18
         */
-       function file( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mFile, $x ); }
+       function file( $x = null ) {
+               wfDeprecated( __METHOD__, '1.18' );
+               return wfSetVar( $this->mFile, $x );
+       }
 
        /**
         * These mutators are very evil, as the relevant variables should not mutate.  So
@@ -481,7 +493,10 @@ class SpecialPage {
         * @return Mixed
         * @deprecated since 1.18
         */
-       function includable( $x = null ) { wfDeprecated( __METHOD__, '1.18' ); return wfSetVar( $this->mIncludable, $x ); }
+       function includable( $x = null ) {
+               wfDeprecated( __METHOD__, '1.18' );
+               return wfSetVar( $this->mIncludable, $x );
+       }
 
        /**
         * Whether the special page is being evaluated via transclusion
@@ -917,11 +932,20 @@ abstract class FormSpecialPage extends SpecialPage {
        abstract protected function getFormFields();
 
        /**
-        * Add pre- or post-text to the form
+        * Add pre-text to the form
         * @return String HTML which will be sent to $form->addPreText()
         */
-       protected function preText() { return ''; }
-       protected function postText() { return ''; }
+       protected function preText() {
+               return '';
+       }
+
+       /**
+        * Add post-text to the form
+        * @return String HTML which will be sent to $form->addPostText()
+        */
+       protected function postText() {
+               return '';
+       }
 
        /**
         * Play with the HTMLForm if you need to more substantially
index a53b901..675fb83 100644 (file)
@@ -199,7 +199,7 @@ class SpecialPageFactory {
                                self::$mList['ChangeEmail'] = 'SpecialChangeEmail';
                        }
 
-                       if( $wgEnableJavaScriptTest ) {
+                       if ( $wgEnableJavaScriptTest ) {
                                self::$mList['JavaScriptTest'] = 'SpecialJavaScriptTest';
                        }
 
index d8ea24a..64a3c60 100644 (file)
@@ -212,7 +212,7 @@ class Status {
         */
        protected function getErrorMessage( $error ) {
                if ( is_array( $error ) ) {
-                       if( isset( $error['message'] ) && $error['message'] instanceof Message ) {
+                       if ( isset( $error['message'] ) && $error['message'] instanceof Message ) {
                                $msg = $error['message'];
                        } elseif ( isset( $error['message'] ) && isset( $error['params'] ) ) {
                                $msg = wfMessage( $error['message'],
@@ -294,9 +294,9 @@ class Status {
                $result = array();
                foreach ( $this->errors as $error ) {
                        if ( $error['type'] === $type ) {
-                               if( $error['message'] instanceof Message ) {
+                               if ( $error['message'] instanceof Message ) {
                                        $result[] = $error['message'];
-                               } elseif( $error['params'] ) {
+                               } elseif ( $error['params'] ) {
                                        $result[] = array_merge( array( $error['message'] ), $error['params'] );
                                } else {
                                        $result[] = array( $error['message'] );
index 21a392a..05b78e0 100644 (file)
@@ -233,7 +233,7 @@ class StringUtils {
 
                // Explode, then put the replaced separators back in
                $items = explode( $separator, $cleaned );
-               foreach( $items as $i => $str ) {
+               foreach ( $items as $i => $str ) {
                        $items[$i] = str_replace( $placeholder, $separator, $str );
                }
 
@@ -440,7 +440,7 @@ class ReplacementArray {
         * @param $data array
         */
        function removeArray( $data ) {
-               foreach( $data as $from => $to ) {
+               foreach ( $data as $from => $to ) {
                        $this->removePair( $from );
                }
                $this->fss = false;
index 7dbfabf..caf78b0 100644 (file)
@@ -133,7 +133,7 @@ class MWTimestamp {
                        throw new TimestampException( __METHOD__ . " : Invalid timestamp - $ts" );
                }
 
-               if( !$strtime ) {
+               if ( !$strtime ) {
                        $da = array_map( 'intval', $da );
                        $da[0] = "%04d-%02d-%02dT%02d:%02d:%02d.00+00:00";
                        $strtime = call_user_func_array( "sprintf", $da );
@@ -145,7 +145,7 @@ class MWTimestamp {
                        throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
                }
 
-               if( $final === false ) {
+               if ( $final === false ) {
                        throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' );
                }
                $this->timestamp = $final;
@@ -164,14 +164,14 @@ class MWTimestamp {
         * @return string The formatted timestamp
         */
        public function getTimestamp( $style = TS_UNIX ) {
-               if( !isset( self::$formats[$style] ) ) {
+               if ( !isset( self::$formats[$style] ) ) {
                        throw new TimestampException( __METHOD__ . ' : Illegal timestamp output type.' );
                }
 
-               if( is_object( $this->timestamp  ) ) {
+               if ( is_object( $this->timestamp  ) ) {
                        // DateTime object was used, call DateTime::format.
                        $output = $this->timestamp->format( self::$formats[$style] );
-               } elseif( TS_UNIX == $style ) {
+               } elseif ( TS_UNIX == $style ) {
                        // Unix timestamp was used and is wanted, just return it.
                        $output = $this->timestamp;
                } else {
@@ -203,9 +203,9 @@ class MWTimestamp {
                $timeago = ($now - $then) * 1000;
                $message = false;
 
-               foreach( self::$units as $unit => $factor ) {
+               foreach ( self::$units as $unit => $factor ) {
                        $next = $timeago / $factor;
-                       if( $next < 1 ) {
+                       if ( $next < 1 ) {
                                break;
                        } else {
                                $timeago = $next;
@@ -213,7 +213,7 @@ class MWTimestamp {
                        }
                }
 
-               if( $message ) {
+               if ( $message ) {
                        $initial = call_user_func_array( 'wfMessage', $message );
                        return wfMessage( 'ago', $initial->parse() );
                } else {
index eda8bc9..03e894e 100644 (file)
@@ -286,7 +286,7 @@ class User {
                                $this->loadFromId();
                                break;
                        case 'session':
-                               if( !$this->loadFromSession() ) {
+                               if ( !$this->loadFromSession() ) {
                                        // Loading from session failed. Load defaults.
                                        $this->loadDefaults();
                                }
@@ -426,7 +426,7 @@ class User {
                        'user_email_token' => md5( $code ),
                        'user_email_token_expires > ' . $dbr->addQuotes( $dbr->timestamp() ),
                        ) );
-               if( $id !== false ) {
+               if ( $id !== false ) {
                        return User::newFromId( $id );
                } else {
                        return null;
@@ -495,7 +495,7 @@ class User {
         */
        public static function idFromName( $name ) {
                $nt = Title::makeTitleSafe( NS_USER, $name );
-               if( is_null( $nt ) ) {
+               if ( is_null( $nt ) ) {
                        # Illegal name
                        return null;
                }
@@ -576,7 +576,7 @@ class User {
                // Ensure that the name can't be misresolved as a different title,
                // such as with extra namespace keys at the start.
                $parsed = Title::newFromText( $name );
-               if( is_null( $parsed )
+               if ( is_null( $parsed )
                        || $parsed->getNamespace()
                        || strcmp( $name, $parsed->getPrefixedText() ) ) {
                        wfDebugLog( 'username', __METHOD__ .
@@ -594,7 +594,7 @@ class User {
                        '\x{3000}' .          # ideographic space
                        '\x{e000}-\x{f8ff}' . # private use
                        ']/u';
-               if( preg_match( $unicodeBlacklist, $name ) ) {
+               if ( preg_match( $unicodeBlacklist, $name ) ) {
                        wfDebugLog( 'username', __METHOD__ .
                                ": '$name' invalid due to blacklisted characters" );
                        return false;
@@ -657,15 +657,15 @@ class User {
                // Ensure that the username isn't longer than 235 bytes, so that
                // (at least for the builtin skins) user javascript and css files
                // will work. (bug 23080)
-               if( strlen( $name ) > 235 ) {
+               if ( strlen( $name ) > 235 ) {
                        wfDebugLog( 'username', __METHOD__ .
                                ": '$name' invalid due to length" );
                        return false;
                }
 
                // Preg yells if you try to give it an empty string
-               if( $wgInvalidUsernameCharacters !== '' ) {
-                       if( preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ) ) {
+               if ( $wgInvalidUsernameCharacters !== '' ) {
+                       if ( preg_match( '/[' . preg_quote( $wgInvalidUsernameCharacters, '/' ) . ']/', $name ) ) {
                                wfDebugLog( 'username', __METHOD__ .
                                        ": '$name' invalid due to wgInvalidUsernameCharacters" );
                                return false;
@@ -702,11 +702,12 @@ class User {
 
                $result = false; //init $result to false for the internal checks
 
-               if( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) )
+               if ( !wfRunHooks( 'isValidPassword', array( $password, &$result, $this ) ) ) {
                        return $result;
+               }
 
                if ( $result === false ) {
-                       if( strlen( $password ) < $wgMinimalPasswordLength ) {
+                       if ( strlen( $password ) < $wgMinimalPasswordLength ) {
                                return 'passwordtooshort';
                        } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) {
                                return 'password-name-match';
@@ -719,7 +720,7 @@ class User {
                                //a valid password.
                                return true;
                        }
-               } elseif( $result === true ) {
+               } elseif ( $result === true ) {
                        return true;
                } else {
                        return $result; //the isValidPassword hook set a string $result and returned true
@@ -779,14 +780,15 @@ class User {
                # Reject names containing '#'; these will be cleaned up
                # with title normalisation, but then it's too late to
                # check elsewhere
-               if( strpos( $name, '#' ) !== false )
+               if ( strpos( $name, '#' ) !== false ) {
                        return false;
+               }
 
                # Clean up name according to title rules
                $t = ( $validate === 'valid' ) ?
                        Title::newFromText( $name ) : Title::makeTitle( NS_USER, $name );
                # Check for invalid titles
-               if( is_null( $t ) ) {
+               if ( is_null( $t ) ) {
                        return false;
                }
 
@@ -870,7 +872,7 @@ class User {
                $this->mOptionsLoaded = false;
 
                $loggedOut = $this->getRequest()->getCookie( 'LoggedOut' );
-               if( $loggedOut !== null ) {
+               if ( $loggedOut !== null ) {
                        $this->mTouched = wfTimestamp( TS_MW, $loggedOut );
                } else {
                        $this->mTouched = '1'; # Allow any pages to be cached
@@ -934,7 +936,7 @@ class User {
 
                if ( $cookieId !== null ) {
                        $sId = intval( $cookieId );
-                       if( $sessId !== null && $cookieId != $sessId ) {
+                       if ( $sessId !== null && $cookieId != $sessId ) {
                                wfDebugLog( 'loginSessions', "Session user ID ($sessId) and
                                        cookie user ID ($sId) don't match!" );
                                return false;
@@ -962,7 +964,7 @@ class User {
                }
 
                global $wgBlockDisablesLogin;
-               if( $wgBlockDisablesLogin && $proposedUser->isBlocked() ) {
+               if ( $wgBlockDisablesLogin && $proposedUser->isBlocked() ) {
                        # User blocked and we've disabled blocked user logins
                        return false;
                }
@@ -1004,7 +1006,7 @@ class User {
                $this->mId = intval( $this->mId );
 
                /** Anonymous user */
-               if( !$this->mId ) {
+               if ( !$this->mId ) {
                        $this->loadDefaults();
                        return false;
                }
@@ -1228,7 +1230,7 @@ class User {
                # default language setting
                $defOpt['variant'] = $wgContLang->getCode();
                $defOpt['language'] = $wgContLang->getCode();
-               foreach( SearchEngine::searchableNamespaces() as $nsnum => $nsname ) {
+               foreach ( SearchEngine::searchableNamespaces() as $nsnum => $nsname ) {
                        $defOpt['searchNs' . $nsnum] = !empty( $wgNamespacesToBeSearchedDefault[$nsnum] );
                }
                $defOpt['skin'] = $wgDefaultSkin;
@@ -1246,7 +1248,7 @@ class User {
         */
        public static function getDefaultOption( $opt ) {
                $defOpts = self::getDefaultOptions();
-               if( isset( $defOpts[$opt] ) ) {
+               if ( isset( $defOpts[$opt] ) ) {
                        return $defOpts[$opt];
                } else {
                        return null;
@@ -1356,11 +1358,13 @@ class User {
                global $wgEnableSorbs, $wgEnableDnsBlacklist,
                        $wgSorbsUrl, $wgDnsBlacklistUrls, $wgProxyWhitelist;
 
-               if ( !$wgEnableDnsBlacklist && !$wgEnableSorbs )
+               if ( !$wgEnableDnsBlacklist && !$wgEnableSorbs ) {
                        return false;
+               }
 
-               if ( $checkWhitelist && in_array( $ip, $wgProxyWhitelist ) )
+               if ( $checkWhitelist && in_array( $ip, $wgProxyWhitelist ) ) {
                        return false;
+               }
 
                $urls = array_merge( $wgDnsBlacklistUrls, (array)$wgSorbsUrl );
                return $this->inDnsBlacklist( $ip, $urls );
@@ -1378,15 +1382,15 @@ class User {
 
                $found = false;
                // @todo FIXME: IPv6 ???  (http://bugs.php.net/bug.php?id=33170)
-               if( IP::isIPv4( $ip ) ) {
+               if ( IP::isIPv4( $ip ) ) {
                        # Reverse IP, bug 21255
                        $ipReversed = implode( '.', array_reverse( explode( '.', $ip ) ) );
 
-                       foreach( (array)$bases as $base ) {
+                       foreach ( (array)$bases as $base ) {
                                # Make hostname
                                # If we have an access key, use that too (ProjectHoneypot, etc.)
-                               if( is_array( $base ) ) {
-                                       if( count( $base ) >= 2 ) {
+                               if ( is_array( $base ) ) {
+                                       if ( count( $base ) >= 2 ) {
                                                # Access key is 1, base URL is 0
                                                $host = "{$base[1]}.$ipReversed.{$base[0]}";
                                        } else {
@@ -1399,7 +1403,7 @@ class User {
                                # Send query
                                $ipList = gethostbynamel( $host );
 
-                               if( $ipList ) {
+                               if ( $ipList ) {
                                        wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!\n" );
                                        $found = true;
                                        break;
@@ -1454,7 +1458,7 @@ class User {
         */
        public function isPingLimitable() {
                global $wgRateLimitsExcludedIPs;
-               if( in_array( $this->getRequest()->getIP(), $wgRateLimitsExcludedIPs ) ) {
+               if ( in_array( $this->getRequest()->getIP(), $wgRateLimitsExcludedIPs ) ) {
                        // No other good way currently to disable rate limits
                        // for specific IPs. :P
                        // But this is a crappy hack and should die.
@@ -1476,18 +1480,19 @@ class User {
        public function pingLimiter( $action = 'edit' ) {
                # Call the 'PingLimiter' hook
                $result = false;
-               if( !wfRunHooks( 'PingLimiter', array( &$this, $action, &$result ) ) ) {
+               if ( !wfRunHooks( 'PingLimiter', array( &$this, $action, &$result ) ) ) {
                        return $result;
                }
 
                global $wgRateLimits;
-               if( !isset( $wgRateLimits[$action] ) ) {
+               if ( !isset( $wgRateLimits[$action] ) ) {
                        return false;
                }
 
                # Some groups shouldn't trigger the ping limiter, ever
-               if( !$this->isPingLimitable() )
+               if ( !$this->isPingLimitable() ) {
                        return false;
+               }
 
                global $wgMemc, $wgRateLimitLog;
                wfProfileIn( __METHOD__ );
@@ -1498,22 +1503,22 @@ class User {
                $ip = $this->getRequest()->getIP();
                $userLimit = false;
 
-               if( isset( $limits['anon'] ) && $id == 0 ) {
+               if ( isset( $limits['anon'] ) && $id == 0 ) {
                        $keys[wfMemcKey( 'limiter', $action, 'anon' )] = $limits['anon'];
                }
 
-               if( isset( $limits['user'] ) && $id != 0 ) {
+               if ( isset( $limits['user'] ) && $id != 0 ) {
                        $userLimit = $limits['user'];
                }
-               if( $this->isNewbie() ) {
-                       if( isset( $limits['newbie'] ) && $id != 0 ) {
+               if ( $this->isNewbie() ) {
+                       if ( isset( $limits['newbie'] ) && $id != 0 ) {
                                $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $limits['newbie'];
                        }
-                       if( isset( $limits['ip'] ) ) {
+                       if ( isset( $limits['ip'] ) ) {
                                $keys["mediawiki:limiter:$action:ip:$ip"] = $limits['ip'];
                        }
                        $matches = array();
-                       if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) {
+                       if ( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) {
                                $subnet = $matches[1];
                                $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet'];
                        }
@@ -1534,15 +1539,15 @@ class User {
                }
 
                $triggered = false;
-               foreach( $keys as $key => $limit ) {
+               foreach ( $keys as $key => $limit ) {
                        list( $max, $period ) = $limit;
                        $summary = "(limit $max in {$period}s)";
                        $count = $wgMemc->get( $key );
                        // Already pinged?
-                       if( $count ) {
-                               if( $count >= $max ) {
+                       if ( $count ) {
+                               if ( $count >= $max ) {
                                        wfDebug( __METHOD__ . ": tripped! $key at $count $summary\n" );
-                                       if( $wgRateLimitLog ) {
+                                       if ( $wgRateLimitLog ) {
                                                wfSuppressWarnings();
                                                file_put_contents( $wgRateLimitLog, wfTimestamp( TS_MW ) . ' ' . wfWikiID() . ': ' . $this->getName() . " tripped $key at $count $summary\n", FILE_APPEND );
                                                wfRestoreWarnings();
@@ -1645,13 +1650,13 @@ class User {
         * @return Bool True if blocked, false otherwise
         */
        public function isBlockedGlobally( $ip = '' ) {
-               if( $this->mBlockedGlobally !== null ) {
+               if ( $this->mBlockedGlobally !== null ) {
                        return $this->mBlockedGlobally;
                }
                // User is already an IP?
-               if( IP::isIPAddress( $this->getName() ) ) {
+               if ( IP::isIPAddress( $this->getName() ) ) {
                        $ip = $this->getName();
-               } elseif( !$ip ) {
+               } elseif ( !$ip ) {
                        $ip = $this->getRequest()->getIP();
                }
                $blocked = false;
@@ -1666,7 +1671,7 @@ class User {
         * @return Bool True if locked, false otherwise
         */
        public function isLocked() {
-               if( $this->mLocked !== null ) {
+               if ( $this->mLocked !== null ) {
                        return $this->mLocked;
                }
                global $wgAuth;
@@ -1681,11 +1686,11 @@ class User {
         * @return Bool True if hidden, false otherwise
         */
        public function isHidden() {
-               if( $this->mHideName !== null ) {
+               if ( $this->mHideName !== null ) {
                        return $this->mHideName;
                }
                $this->getBlockedStatus();
-               if( !$this->mHideName ) {
+               if ( !$this->mHideName ) {
                        global $wgAuth;
                        $authUser = $wgAuth->getUserInstance( $this );
                        $this->mHideName = (bool)$authUser->isHidden();
@@ -1698,11 +1703,10 @@ class User {
         * @return Int The user's ID; 0 if the user is anonymous or nonexistent
         */
        public function getId() {
-               if( $this->mId === null && $this->mName !== null
-               && User::isIP( $this->mName ) ) {
+               if ( $this->mId === null && $this->mName !== null && User::isIP( $this->mName ) ) {
                        // Special case, we know the user is anonymous
                        return 0;
-               } elseif( !$this->isItemLoaded( 'id' ) ) {
+               } elseif ( !$this->isItemLoaded( 'id' ) ) {
                        // Don't load if this was initialized from an ID
                        $this->load();
                }
@@ -1770,21 +1774,21 @@ class User {
                $this->load();
 
                # Load the newtalk status if it is unloaded (mNewtalk=-1)
-               if( $this->mNewtalk === -1 ) {
+               if ( $this->mNewtalk === -1 ) {
                        $this->mNewtalk = false; # reset talk page status
 
                        # Check memcached separately for anons, who have no
                        # entire User object stored in there.
-                       if( !$this->mId ) {
+                       if ( !$this->mId ) {
                                global $wgDisableAnonTalk;
-                               if( $wgDisableAnonTalk ) {
+                               if ( $wgDisableAnonTalk ) {
                                        // Anon newtalk disabled by configuration.
                                        $this->mNewtalk = false;
                                } else {
                                        global $wgMemc;
                                        $key = wfMemcKey( 'newtalk', 'ip', $this->getName() );
                                        $newtalk = $wgMemc->get( $key );
-                                       if( strval( $newtalk ) !== '' ) {
+                                       if ( strval( $newtalk ) !== '' ) {
                                                $this->mNewtalk = (bool)$newtalk;
                                        } else {
                                                // Since we are caching this, make sure it is up to date by getting it
@@ -1807,9 +1811,9 @@ class User {
         */
        public function getNewMessageLinks() {
                $talks = array();
-               if( !wfRunHooks( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) ) {
+               if ( !wfRunHooks( 'UserRetrieveNewTalks', array( &$this, &$talks ) ) ) {
                        return $talks;
-               } elseif( !$this->getNewtalk() ) {
+               } elseif ( !$this->getNewtalk() ) {
                        return array();
                }
                $utp = $this->getTalkPage();
@@ -1895,14 +1899,14 @@ class User {
         * @param $curRev Revision new, as yet unseen revision of the user talk page. Ignored if null or !$val.
         */
        public function setNewtalk( $val, $curRev = null ) {
-               if( wfReadOnly() ) {
+               if ( wfReadOnly() ) {
                        return;
                }
 
                $this->load();
                $this->mNewtalk = $val;
 
-               if( $this->isAnon() ) {
+               if ( $this->isAnon() ) {
                        $field = 'user_ip';
                        $id = $this->getName();
                } else {
@@ -1911,13 +1915,13 @@ class User {
                }
                global $wgMemc;
 
-               if( $val ) {
+               if ( $val ) {
                        $changed = $this->updateNewtalk( $field, $id, $curRev );
                } else {
                        $changed = $this->deleteNewtalk( $field, $id );
                }
 
-               if( $this->isAnon() ) {
+               if ( $this->isAnon() ) {
                        // Anons have a separate memcached space, since
                        // user records aren't kept for them.
                        $key = wfMemcKey( 'newtalk', 'ip', $id );
@@ -1947,7 +1951,7 @@ class User {
         */
        private function clearSharedCache() {
                $this->load();
-               if( $this->mId ) {
+               if ( $this->mId ) {
                        global $wgMemc;
                        $wgMemc->delete( wfMemcKey( 'user', 'id', $this->mId ) );
                }
@@ -2025,12 +2029,12 @@ class User {
        public function setPassword( $str ) {
                global $wgAuth;
 
-               if( $str !== null ) {
-                       if( !$wgAuth->allowPasswordChange() ) {
+               if ( $str !== null ) {
+                       if ( !$wgAuth->allowPasswordChange() ) {
                                throw new PasswordError( wfMessage( 'password-change-forbidden' )->text() );
                        }
 
-                       if( !$this->isValidPassword( $str ) ) {
+                       if ( !$this->isValidPassword( $str ) ) {
                                global $wgMinimalPasswordLength;
                                $valid = $this->getPasswordValidity( $str );
                                if ( is_array( $valid ) ) {
@@ -2044,7 +2048,7 @@ class User {
                        }
                }
 
-               if( !$wgAuth->setPassword( $this, $str ) ) {
+               if ( !$wgAuth->setPassword( $this, $str ) ) {
                        throw new PasswordError( wfMessage( 'externaldberror' )->text() );
                }
 
@@ -2064,7 +2068,7 @@ class User {
                $this->load();
                $this->setToken();
 
-               if( $str === null ) {
+               if ( $str === null ) {
                        // Save an invalid hash...
                        $this->mPassword = '';
                } else {
@@ -2157,7 +2161,7 @@ class User {
         */
        public function setEmail( $str ) {
                $this->load();
-               if( $str == $this->mEmail ) {
+               if ( $str == $this->mEmail ) {
                        return;
                }
                $this->mEmail = $str;
@@ -2241,7 +2245,7 @@ class User {
                # set it, and then it was disabled removing their ability to change it).  But
                # we don't want to erase the preferences in the database in case the preference
                # is re-enabled again.  So don't touch $mOptions, just override the returned value
-               if( in_array( $oname, $wgHiddenPrefs ) && !$ignoreHidden ) {
+               if ( in_array( $oname, $wgHiddenPrefs ) && !$ignoreHidden ) {
                        return self::getDefaultOption( $oname );
                }
 
@@ -2267,9 +2271,9 @@ class User {
                # set it, and then it was disabled removing their ability to change it).  But
                # we don't want to erase the preferences in the database in case the preference
                # is re-enabled again.  So don't touch $mOptions, just override the returned value
-               foreach( $wgHiddenPrefs as $pref ) {
+               foreach ( $wgHiddenPrefs as $pref ) {
                        $default = self::getDefaultOption( $pref );
-                       if( $default !== null ) {
+                       if ( $default !== null ) {
                                $options[$pref] = $default;
                        }
                }
@@ -2298,7 +2302,7 @@ class User {
         */
        public function getIntOption( $oname, $defaultOverride = 0 ) {
                $val = $this->getOption( $oname );
-               if( $val == '' ) {
+               if ( $val == '' ) {
                        $val = $defaultOverride;
                }
                return intval( $val );
@@ -2314,7 +2318,7 @@ class User {
                $this->loadOptions();
 
                // Explicitly NULL values should refer to defaults
-               if( is_null( $val ) ) {
+               if ( is_null( $val ) ) {
                        $val = self::getDefaultOption( $oname );
                }
 
@@ -2410,9 +2414,9 @@ class User {
                foreach ( $options as $key => $value ) {
                        if ( isset( $prefs[$key] ) ) {
                                $mapping[$key] = 'registered';
-                       } elseif( isset( $multiselectOptions[$key] ) ) {
+                       } elseif ( isset( $multiselectOptions[$key] ) ) {
                                $mapping[$key] = 'registered-multiselect';
-                       } elseif( isset( $checkmatrixOptions[$key] ) ) {
+                       } elseif ( isset( $checkmatrixOptions[$key] ) ) {
                                $mapping[$key] = 'registered-checkmatrix';
                        } elseif ( substr( $key, 0, 7 ) === 'userjs-' ) {
                                $mapping[$key] = 'userjs';
@@ -2598,14 +2602,14 @@ class User {
         * @return array Names of the groups the user has belonged to.
         */
        public function getFormerGroups() {
-               if( is_null( $this->mFormerGroups ) ) {
+               if ( is_null( $this->mFormerGroups ) ) {
                        $dbr = wfGetDB( DB_MASTER );
                        $res = $dbr->select( 'user_former_groups',
                                array( 'ufg_group' ),
                                array( 'ufg_user' => $this->mId ),
                                __METHOD__ );
                        $this->mFormerGroups = array();
-                       foreach( $res as $row ) {
+                       foreach ( $res as $row ) {
                                $this->mFormerGroups[] = $row->ufg_group;
                        }
                }
@@ -2632,7 +2636,7 @@ class User {
                                __METHOD__
                        );
 
-                       if( $count === null ) {
+                       if ( $count === null ) {
                                // it has not been initialized. do so.
                                $count = $this->initEditCount();
                        }
@@ -2648,9 +2652,9 @@ class User {
         * @param string $group Name of the group to add
         */
        public function addGroup( $group ) {
-               if( wfRunHooks( 'UserAddGroup', array( $this, &$group ) ) ) {
+               if ( wfRunHooks( 'UserAddGroup', array( $this, &$group ) ) ) {
                        $dbw = wfGetDB( DB_MASTER );
-                       if( $this->getId() ) {
+                       if ( $this->getId() ) {
                                $dbw->insert( 'user_groups',
                                        array(
                                                'ug_user' => $this->getID(),
@@ -2674,7 +2678,7 @@ class User {
         */
        public function removeGroup( $group ) {
                $this->load();
-               if( wfRunHooks( 'UserRemoveGroup', array( $this, &$group ) ) ) {
+               if ( wfRunHooks( 'UserRemoveGroup', array( $this, &$group ) ) ) {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->delete( 'user_groups',
                                array(
@@ -2723,8 +2727,8 @@ class User {
         */
        public function isAllowedAny( /*...*/ ) {
                $permissions = func_get_args();
-               foreach( $permissions as $permission ) {
-                       if( $this->isAllowed( $permission ) ) {
+               foreach ( $permissions as $permission ) {
+                       if ( $this->isAllowed( $permission ) ) {
                                return true;
                        }
                }
@@ -2738,8 +2742,8 @@ class User {
         */
        public function isAllowedAll( /*...*/ ) {
                $permissions = func_get_args();
-               foreach( $permissions as $permission ) {
-                       if( !$this->isAllowed( $permission ) ) {
+               foreach ( $permissions as $permission ) {
+                       if ( !$this->isAllowed( $permission ) ) {
                                return false;
                        }
                }
@@ -2756,10 +2760,11 @@ class User {
                        return true; // In the spirit of DWIM
                }
                # Patrolling may not be enabled
-               if( $action === 'patrol' || $action === 'autopatrol' ) {
+               if ( $action === 'patrol' || $action === 'autopatrol' ) {
                        global $wgUseRCPatrol, $wgUseNPPatrol;
-                       if( !$wgUseRCPatrol && !$wgUseNPPatrol )
+                       if ( !$wgUseRCPatrol && !$wgUseNPPatrol ) {
                                return false;
+                       }
                }
                # Use strict parameter to avoid matching numeric 0 accidentally inserted
                # by misconfiguration: 0 == 'foo'
@@ -2867,22 +2872,23 @@ class User {
                global $wgUseEnotif, $wgShowUpdatedMarker;
 
                # Do nothing if the database is locked to writes
-               if( wfReadOnly() ) {
+               if ( wfReadOnly() ) {
                        return;
                }
 
-               if( $title->getNamespace() == NS_USER_TALK &&
+               if ( $title->getNamespace() == NS_USER_TALK &&
                        $title->getText() == $this->getName() ) {
-                       if( !wfRunHooks( 'UserClearNewTalkNotification', array( &$this ) ) )
+                       if ( !wfRunHooks( 'UserClearNewTalkNotification', array( &$this ) ) ) {
                                return;
+                       }
                        $this->setNewtalk( false );
                }
 
-               if( !$wgUseEnotif && !$wgShowUpdatedMarker ) {
+               if ( !$wgUseEnotif && !$wgShowUpdatedMarker ) {
                        return;
                }
 
-               if( $this->isAnon() ) {
+               if ( $this->isAnon() ) {
                        // Nothing else to do...
                        return;
                }
@@ -2917,7 +2923,7 @@ class User {
                        return;
                }
                $id = $this->getId();
-               if( $id != 0 ) {
+               if ( $id != 0 ) {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update( 'watchlist',
                                array( /* SET */
@@ -2939,8 +2945,9 @@ class User {
         */
        private function decodeOptions( $str ) {
                wfDeprecated( __METHOD__, '1.19' );
-               if( !$str )
+               if ( !$str ) {
                        return;
+               }
 
                $this->mOptionsLoaded = true;
                $this->mOptionOverrides = array();
@@ -3048,7 +3055,7 @@ class User {
         * Log this user out.
         */
        public function logout() {
-               if( wfRunHooks( 'UserLogout', array( &$this ) ) ) {
+               if ( wfRunHooks( 'UserLogout', array( &$this ) ) ) {
                        $this->doLogout();
                }
        }
@@ -3078,8 +3085,12 @@ class User {
                global $wgAuth;
 
                $this->load();
-               if ( wfReadOnly() ) { return; }
-               if ( 0 == $this->mId ) { return; }
+               if ( wfReadOnly() ) {
+                       return;
+               }
+               if ( 0 == $this->mId ) {
+                       return;
+               }
 
                $this->mTouched = self::newTouchedTimestamp();
                if ( !$wgAuth->allowSetLocalPassword() ) {
@@ -3118,7 +3129,9 @@ class User {
         */
        public function idForName() {
                $s = trim( $this->getName() );
-               if ( $s === '' ) return 0;
+               if ( $s === '' ) {
+                       return 0;
+               }
 
                $dbr = wfGetDB( DB_SLAVE );
                $id = $dbr->selectField( 'user', 'user_id', array( 'user_name' => $s ), __METHOD__ );
@@ -3308,7 +3321,7 @@ class User {
                wfDeprecated( __METHOD__, '1.17' );
 
                global $wgRenderHashAppend, $wgLang, $wgContLang;
-               if( $this->mHash ) {
+               if ( $this->mHash ) {
                        return $this->mHash;
                }
 
@@ -3346,7 +3359,7 @@ class User {
         */
        public function isBlockedFromCreateAccount() {
                $this->getBlockedStatus();
-               if( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ) {
+               if ( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ) {
                        return $this->mBlock;
                }
 
@@ -3420,16 +3433,16 @@ class User {
                // to. Certain authentication plugins do NOT want to save
                // domain passwords in a mysql database, so we should
                // check this (in case $wgAuth->strict() is false).
-               if( !$this->isValidPassword( $password ) ) {
+               if ( !$this->isValidPassword( $password ) ) {
                        return false;
                }
 
-               if( $wgAuth->authenticate( $this->getName(), $password ) ) {
+               if ( $wgAuth->authenticate( $this->getName(), $password ) ) {
                        return true;
-               } elseif( $wgAuth->strict() ) {
+               } elseif ( $wgAuth->strict() ) {
                        /* Auth plugin doesn't allow local authentication */
                        return false;
-               } elseif( $wgAuth->strictUserAuth( $this->getName() ) ) {
+               } elseif ( $wgAuth->strictUserAuth( $this->getName() ) ) {
                        /* Auth plugin doesn't allow local authentication for this user name */
                        return false;
                }
@@ -3460,7 +3473,7 @@ class User {
                global $wgNewPasswordExpiry;
 
                $this->load();
-               if( self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() ) ) {
+               if ( self::comparePasswords( $this->mNewpassword, $plaintext, $this->getId() ) ) {
                        if ( is_null( $this->mNewpassTime ) ) {
                                return true;
                        }
@@ -3509,7 +3522,7 @@ class User {
                                $token = MWCryptRand::generateHex( 32 );
                                $request->setSessionData( 'wsEditToken', $token );
                        }
-                       if( is_array( $salt ) ) {
+                       if ( is_array( $salt ) ) {
                                $salt = implode( '|', $salt );
                        }
                        return md5( $token . $salt ) . EDIT_TOKEN_SUFFIX;
@@ -3604,7 +3617,7 @@ class User {
         * @return Status
         */
        public function sendMail( $subject, $body, $from = null, $replyto = null ) {
-               if( is_null( $from ) ) {
+               if ( is_null( $from ) ) {
                        global $wgPasswordSender, $wgPasswordSenderName;
                        $sender = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
                } else {
@@ -3726,7 +3739,7 @@ class User {
         */
        public function canSendEmail() {
                global $wgEnableEmail, $wgEnableUserEmail;
-               if( !$wgEnableEmail || !$wgEnableUserEmail || !$this->isAllowed( 'sendemail' ) ) {
+               if ( !$wgEnableEmail || !$wgEnableUserEmail || !$this->isAllowed( 'sendemail' ) ) {
                        return false;
                }
                $canSend = $this->isEmailConfirmed();
@@ -3757,14 +3770,14 @@ class User {
                global $wgEmailAuthentication;
                $this->load();
                $confirmed = true;
-               if( wfRunHooks( 'EmailConfirmed', array( &$this, &$confirmed ) ) ) {
-                       if( $this->isAnon() ) {
+               if ( wfRunHooks( 'EmailConfirmed', array( &$this, &$confirmed ) ) ) {
+                       if ( $this->isAnon() ) {
                                return false;
                        }
-                       if( !Sanitizer::validateEmail( $this->mEmail ) ) {
+                       if ( !Sanitizer::validateEmail( $this->mEmail ) ) {
                                return false;
                        }
-                       if( $wgEmailAuthentication && !$this->getEmailAuthenticationTimestamp() ) {
+                       if ( $wgEmailAuthentication && !$this->getEmailAuthenticationTimestamp() ) {
                                return false;
                        }
                        return true;
@@ -3807,7 +3820,7 @@ class User {
         *     non-existent/anonymous user accounts.
         */
        public function getFirstEditTimestamp() {
-               if( $this->getId() == 0 ) {
+               if ( $this->getId() == 0 ) {
                        return false; // anons
                }
                $dbr = wfGetDB( DB_SLAVE );
@@ -3816,7 +3829,7 @@ class User {
                        __METHOD__,
                        array( 'ORDER BY' => 'rev_timestamp ASC' )
                );
-               if( !$time ) {
+               if ( !$time ) {
                        return false; // no edits
                }
                return wfTimestamp( TS_MW, $time );
@@ -3832,16 +3845,16 @@ class User {
                global $wgGroupPermissions, $wgRevokePermissions;
                $rights = array();
                // grant every granted permission first
-               foreach( $groups as $group ) {
-                       if( isset( $wgGroupPermissions[$group] ) ) {
+               foreach ( $groups as $group ) {
+                       if ( isset( $wgGroupPermissions[$group] ) ) {
                                $rights = array_merge( $rights,
                                        // array_filter removes empty items
                                        array_keys( array_filter( $wgGroupPermissions[$group] ) ) );
                        }
                }
                // now revoke the revoked permissions
-               foreach( $groups as $group ) {
-                       if( isset( $wgRevokePermissions[$group] ) ) {
+               foreach ( $groups as $group ) {
+                       if ( isset( $wgRevokePermissions[$group] ) ) {
                                $rights = array_diff( $rights,
                                        array_keys( array_filter( $wgRevokePermissions[$group] ) ) );
                        }
@@ -3953,10 +3966,11 @@ class User {
         */
        public static function getGroupPage( $group ) {
                $msg = wfMessage( 'grouppage-' . $group )->inContentLanguage();
-               if( $msg->exists() ) {
+               if ( $msg->exists() ) {
                        $title = Title::newFromText( $msg->text() );
-                       if( is_object( $title ) )
+                       if ( is_object( $title ) ) {
                                return $title;
+                       }
                }
                return false;
        }
@@ -3970,11 +3984,11 @@ class User {
         * @return String HTML link to the group
         */
        public static function makeGroupLinkHTML( $group, $text = '' ) {
-               if( $text == '' ) {
+               if ( $text == '' ) {
                        $text = self::getGroupName( $group );
                }
                $title = self::getGroupPage( $group );
-               if( $title ) {
+               if ( $title ) {
                        return Linker::link( $title, htmlspecialchars( $text ) );
                } else {
                        return $text;
@@ -3990,11 +4004,11 @@ class User {
         * @return String Wikilink to the group
         */
        public static function makeGroupLinkWiki( $group, $text = '' ) {
-               if( $text == '' ) {
+               if ( $text == '' ) {
                        $text = self::getGroupName( $group );
                }
                $title = self::getGroupPage( $group );
-               if( $title ) {
+               if ( $title ) {
                        $page = $title->getPrefixedText();
                        return "[[$page|$text]]";
                } else {
@@ -4015,53 +4029,53 @@ class User {
                global $wgAddGroups, $wgRemoveGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
 
                $groups = array( 'add' => array(), 'remove' => array(), 'add-self' => array(), 'remove-self' => array() );
-               if( empty( $wgAddGroups[$group] ) ) {
+               if ( empty( $wgAddGroups[$group] ) ) {
                        // Don't add anything to $groups
-               } elseif( $wgAddGroups[$group] === true ) {
+               } elseif ( $wgAddGroups[$group] === true ) {
                        // You get everything
                        $groups['add'] = self::getAllGroups();
-               } elseif( is_array( $wgAddGroups[$group] ) ) {
+               } elseif ( is_array( $wgAddGroups[$group] ) ) {
                        $groups['add'] = $wgAddGroups[$group];
                }
 
                // Same thing for remove
-               if( empty( $wgRemoveGroups[$group] ) ) {
-               } elseif( $wgRemoveGroups[$group] === true ) {
+               if ( empty( $wgRemoveGroups[$group] ) ) {
+               } elseif ( $wgRemoveGroups[$group] === true ) {
                        $groups['remove'] = self::getAllGroups();
-               } elseif( is_array( $wgRemoveGroups[$group] ) ) {
+               } elseif ( is_array( $wgRemoveGroups[$group] ) ) {
                        $groups['remove'] = $wgRemoveGroups[$group];
                }
 
                // Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
-               if( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
-                       foreach( $wgGroupsAddToSelf as $key => $value ) {
-                               if( is_int( $key ) ) {
+               if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
+                       foreach ( $wgGroupsAddToSelf as $key => $value ) {
+                               if ( is_int( $key ) ) {
                                        $wgGroupsAddToSelf['user'][] = $value;
                                }
                        }
                }
 
-               if( empty( $wgGroupsRemoveFromSelf['user'] ) || $wgGroupsRemoveFromSelf['user'] !== true ) {
-                       foreach( $wgGroupsRemoveFromSelf as $key => $value ) {
-                               if( is_int( $key ) ) {
+               if ( empty( $wgGroupsRemoveFromSelf['user'] ) || $wgGroupsRemoveFromSelf['user'] !== true ) {
+                       foreach ( $wgGroupsRemoveFromSelf as $key => $value ) {
+                               if ( is_int( $key ) ) {
                                        $wgGroupsRemoveFromSelf['user'][] = $value;
                                }
                        }
                }
 
                // Now figure out what groups the user can add to him/herself
-               if( empty( $wgGroupsAddToSelf[$group] ) ) {
-               } elseif( $wgGroupsAddToSelf[$group] === true ) {
+               if ( empty( $wgGroupsAddToSelf[$group] ) ) {
+               } elseif ( $wgGroupsAddToSelf[$group] === true ) {
                        // No idea WHY this would be used, but it's there
                        $groups['add-self'] = User::getAllGroups();
-               } elseif( is_array( $wgGroupsAddToSelf[$group] ) ) {
+               } elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
                        $groups['add-self'] = $wgGroupsAddToSelf[$group];
                }
 
-               if( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
-               } elseif( $wgGroupsRemoveFromSelf[$group] === true ) {
+               if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
+               } elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
                        $groups['remove-self'] = User::getAllGroups();
-               } elseif( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
+               } elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
                        $groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
                }
 
@@ -4076,7 +4090,7 @@ class User {
         *  'remove-self' => array( removable groups from self) )
         */
        public function changeableGroups() {
-               if( $this->isAllowed( 'userrights' ) ) {
+               if ( $this->isAllowed( 'userrights' ) ) {
                        // This group gives the right to modify everything (reverse-
                        // compatibility with old "userrights lets you change
                        // everything")
@@ -4099,7 +4113,7 @@ class User {
                );
                $addergroups = $this->getEffectiveGroups();
 
-               foreach( $addergroups as $addergroup ) {
+               foreach ( $addergroups as $addergroup ) {
                        $groups = array_merge_recursive(
                                $groups, $this->changeableByGroup( $addergroup )
                        );
@@ -4116,7 +4130,7 @@ class User {
         * Will have no effect for anonymous users.
         */
        public function incEditCount() {
-               if( !$this->isAnon() ) {
+               if ( !$this->isAnon() ) {
                        $dbw = wfGetDB( DB_MASTER );
                        $dbw->update(
                                'user',
@@ -4126,10 +4140,10 @@ class User {
                        );
 
                        // Lazy initialization check...
-                       if( $dbw->affectedRows() == 0 ) {
+                       if ( $dbw->affectedRows() == 0 ) {
                                // Now here's a goddamn hack...
                                $dbr = wfGetDB( DB_SLAVE );
-                               if( $dbr !== $dbw ) {
+                               if ( $dbr !== $dbw ) {
                                        // If we actually have a slave server, the count is
                                        // at least one behind because the current transaction
                                        // has not been committed and replicated.
@@ -4216,11 +4230,11 @@ class User {
                global $wgPasswordSalt;
 
                $hash = '';
-               if( !wfRunHooks( 'UserCryptPassword', array( &$password, &$salt, &$wgPasswordSalt, &$hash ) ) ) {
+               if ( !wfRunHooks( 'UserCryptPassword', array( &$password, &$salt, &$wgPasswordSalt, &$hash ) ) ) {
                        return $hash;
                }
 
-               if( $wgPasswordSalt ) {
+               if ( $wgPasswordSalt ) {
                        if ( $salt === false ) {
                                $salt = MWCryptRand::generateHex( 8 );
                        }
@@ -4244,7 +4258,7 @@ class User {
                $type = substr( $hash, 0, 3 );
 
                $result = false;
-               if( !wfRunHooks( 'UserComparePasswords', array( &$hash, &$password, &$userId, &$result ) ) ) {
+               if ( !wfRunHooks( 'UserComparePasswords', array( &$hash, &$password, &$userId, &$result ) ) ) {
                        return $result;
                }
 
@@ -4283,7 +4297,7 @@ class User {
         */
        public function addNewUserLogEntry( $action = false, $reason = '' ) {
                global $wgUser, $wgNewUserLog;
-               if( empty( $wgNewUserLog ) ) {
+               if ( empty( $wgNewUserLog ) ) {
                        return true; // disabled
                }
 
@@ -4363,11 +4377,11 @@ class User {
                // Maybe load from the object
                if ( !is_null( $this->mOptionOverrides ) ) {
                        wfDebug( "User: loading options for user " . $this->getId() . " from override cache.\n" );
-                       foreach( $this->mOptionOverrides as $key => $value ) {
+                       foreach ( $this->mOptionOverrides as $key => $value ) {
                                $this->mOptions[$key] = $value;
                        }
                } else {
-                       if( !is_array( $data ) ) {
+                       if ( !is_array( $data ) ) {
                                wfDebug( "User: loading options for user " . $this->getId() . " from database.\n" );
                                // Load from database
                                $dbr = wfGetDB( DB_SLAVE );
@@ -4407,13 +4421,13 @@ class User {
 
                // Allow hooks to abort, for instance to save to a global profile.
                // Reset options to default state before saving.
-               if( !wfRunHooks( 'UserSaveOptions', array( $this, &$saveOptions ) ) ) {
+               if ( !wfRunHooks( 'UserSaveOptions', array( $this, &$saveOptions ) ) ) {
                        return;
                }
 
                $userId = $this->getId();
                $insert_rows = array();
-               foreach( $saveOptions as $key => $value ) {
+               foreach ( $saveOptions as $key => $value ) {
                        # Don't bother storing default values
                        $defaultOption = self::getDefaultOption( $key );
                        if ( ( is_null( $defaultOption ) &&
index 2eb8429..7eca76f 100644 (file)
@@ -119,7 +119,7 @@ class UserMailer {
         */
        static function arrayToHeaderString( $headers, $endl = "\n" ) {
                $strings = array();
-               foreach( $headers as $name => $value ) {
+               foreach ( $headers as $name => $value ) {
                        $strings[] = "$name: $value";
                }
                return implode( $endl, $strings );
@@ -338,7 +338,7 @@ class UserMailer {
                        #
                        # PHP mail()
                        #
-                       if( count( $to ) > 1 ) {
+                       if ( count( $to ) > 1 ) {
                                $headers['To'] = 'undisclosed-recipients:;';
                        }
                        $headers = self::arrayToHeaderString( $headers, $endl );
@@ -409,7 +409,7 @@ class UserMailer {
         */
        public static function quotedPrintable( $string, $charset = '' ) {
                # Probably incomplete; see RFC 2045
-               if( empty( $charset ) ) {
+               if ( empty( $charset ) ) {
                        $charset = 'UTF-8';
                }
                $charset = strtoupper( $charset );
@@ -417,7 +417,7 @@ class UserMailer {
 
                $illegal = '\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff=';
                $replace = $illegal . '\t ?_';
-               if( !preg_match( "/[$illegal]/", $string ) ) {
+               if ( !preg_match( "/[$illegal]/", $string ) ) {
                        return $string;
                }
                $out = "=?$charset?Q?";
@@ -791,8 +791,9 @@ class EmailNotification {
        function compose( $user ) {
                global $wgEnotifImpersonal;
 
-               if ( !$this->composed_common )
+               if ( !$this->composed_common ) {
                        $this->composeCommonMailtext();
+               }
 
                if ( $wgEnotifImpersonal ) {
                        $this->mailTargets[] = new MailAddress( $user );
index cd5dff8..56bb73f 100644 (file)
@@ -74,7 +74,7 @@ class UserRightsProxy {
         */
        public static function whoIs( $database, $id, $ignoreInvalidDB = false ) {
                $user = self::newFromId( $database, $id, $ignoreInvalidDB );
-               if( $user ) {
+               if ( $user ) {
                        return $user->name;
                } else {
                        return false;
@@ -114,12 +114,12 @@ class UserRightsProxy {
         */
        private static function newFromLookup( $database, $field, $value, $ignoreInvalidDB = false ) {
                $db = self::getDB( $database, $ignoreInvalidDB );
-               if( $db ) {
+               if ( $db ) {
                        $row = $db->selectRow( 'user',
                                array( 'user_id', 'user_name' ),
                                array( $field => $value ),
                                __METHOD__ );
-                       if( $row !== false ) {
+                       if ( $row !== false ) {
                                return new UserRightsProxy( $db, $database,
                                        $row->user_name,
                                        intval( $row->user_id ) );
@@ -138,8 +138,8 @@ class UserRightsProxy {
         */
        public static function getDB( $database, $ignoreInvalidDB = false ) {
                global $wgDBname;
-               if( self::validDatabase( $database ) ) {
-                       if( $database == $wgDBname ) {
+               if ( self::validDatabase( $database ) ) {
+                       if ( $database == $wgDBname ) {
                                // Hmm... this shouldn't happen though. :)
                                return wfGetDB( DB_MASTER );
                        } else {
index 5ac92f7..01376a0 100644 (file)
@@ -268,7 +268,7 @@ class WatchedItem {
                        );
                }
 
-               if( empty( $values ) ) {
+               if ( empty( $values ) ) {
                        // Nothing to do
                        return true;
                }
index 3bdf645..e85bf9c 100644 (file)
@@ -91,11 +91,11 @@ class WebRequest {
                        wfSuppressWarnings();
                        $a = parse_url( $url );
                        wfRestoreWarnings();
-                       if( $a ) {
+                       if ( $a ) {
                                $path = isset( $a['path'] ) ? $a['path'] : '';
 
                                global $wgScript;
-                               if( $path == $wgScript && $want !== 'all' ) {
+                               if ( $path == $wgScript && $want !== 'all' ) {
                                        // Script inside a rewrite path?
                                        // Abort to keep from breaking...
                                        return $matches;
@@ -106,7 +106,7 @@ class WebRequest {
                                // Raw PATH_INFO style
                                $router->add( "$wgScript/$1" );
 
-                               if( isset( $_SERVER['SCRIPT_NAME'] )
+                               if ( isset( $_SERVER['SCRIPT_NAME'] )
                                        && preg_match( '/\.php5?/', $_SERVER['SCRIPT_NAME'] ) )
                                {
                                        # Check for SCRIPT_NAME, we handle index.php explicitly
@@ -116,17 +116,17 @@ class WebRequest {
                                }
 
                                global $wgArticlePath;
-                               if( $wgArticlePath ) {
+                               if ( $wgArticlePath ) {
                                        $router->add( $wgArticlePath );
                                }
 
                                global $wgActionPaths;
-                               if( $wgActionPaths ) {
+                               if ( $wgActionPaths ) {
                                        $router->add( $wgActionPaths, array( 'action' => '$key' ) );
                                }
 
                                global $wgVariantArticlePath, $wgContLang;
-                               if( $wgVariantArticlePath ) {
+                               if ( $wgVariantArticlePath ) {
                                        $router->add( $wgVariantArticlePath,
                                                array( 'variant' => '$2' ),
                                                array( '$2' => $wgContLang->getVariants() )
@@ -224,7 +224,7 @@ class WebRequest {
                }
 
                $matches = self::getPathInfo( 'title' );
-               foreach( $matches as $key => $val ) {
+               foreach ( $matches as $key => $val ) {
                        $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val;
                }
        }
@@ -240,15 +240,15 @@ class WebRequest {
         * @return array of URL variables to interpolate; empty if no match
         */
        static function extractTitle( $path, $bases, $key = false ) {
-               foreach( (array)$bases as $keyValue => $base ) {
+               foreach ( (array)$bases as $keyValue => $base ) {
                        // Find the part after $wgArticlePath
                        $base = str_replace( '$1', '', $base );
                        $baseLen = strlen( $base );
-                       if( substr( $path, 0, $baseLen ) == $base ) {
+                       if ( substr( $path, 0, $baseLen ) == $base ) {
                                $raw = substr( $path, $baseLen );
-                               if( $raw !== '' ) {
+                               if ( $raw !== '' ) {
                                        $matches = array( 'title' => rawurldecode( $raw ) );
-                                       if( $key ) {
+                                       if ( $key ) {
                                                $matches[$key] = $keyValue;
                                        }
                                        return $matches;
@@ -271,8 +271,8 @@ class WebRequest {
         */
        private function &fix_magic_quotes( &$arr, $topLevel = true ) {
                $clean = array();
-               foreach( $arr as $key => $val ) {
-                       if( is_array( $val ) ) {
+               foreach ( $arr as $key => $val ) {
+                       if ( is_array( $val ) ) {
                                $cleanKey = $topLevel ? stripslashes( $key ) : $key;
                                $clean[$cleanKey] = $this->fix_magic_quotes( $arr[$key], false );
                        } else {
@@ -293,7 +293,7 @@ class WebRequest {
        private function checkMagicQuotes() {
                $mustFixQuotes = function_exists( 'get_magic_quotes_gpc' )
                        && get_magic_quotes_gpc();
-               if( $mustFixQuotes ) {
+               if ( $mustFixQuotes ) {
                        $this->fix_magic_quotes( $_COOKIE );
                        $this->fix_magic_quotes( $_ENV );
                        $this->fix_magic_quotes( $_GET );
@@ -311,8 +311,8 @@ class WebRequest {
         * @private
         */
        function normalizeUnicode( $data ) {
-               if( is_array( $data ) ) {
-                       foreach( $data as $key => $val ) {
+               if ( is_array( $data ) ) {
+                       foreach ( $data as $key => $val ) {
                                $data[$key] = $this->normalizeUnicode( $val );
                        }
                } else {
@@ -335,12 +335,12 @@ class WebRequest {
                # http://us2.php.net/variables.external#language.variables.external.dot-in-names
                # Work around PHP *feature* to avoid *bugs* elsewhere.
                $name = strtr( $name, '.', '_' );
-               if( isset( $arr[$name] ) ) {
+               if ( isset( $arr[$name] ) ) {
                        global $wgContLang;
                        $data = $arr[$name];
-                       if( isset( $_GET[$name] ) && !is_array( $data ) ) {
+                       if ( isset( $_GET[$name] ) && !is_array( $data ) ) {
                                # Check for alternate/legacy character encoding.
-                               if( isset( $wgContLang ) ) {
+                               if ( isset( $wgContLang ) ) {
                                        $data = $wgContLang->checkTitleEncoding( $data );
                                }
                        }
@@ -364,10 +364,10 @@ class WebRequest {
         */
        public function getVal( $name, $default = null ) {
                $val = $this->getGPCVal( $this->data, $name, $default );
-               if( is_array( $val ) ) {
+               if ( is_array( $val ) ) {
                        $val = $default;
                }
-               if( is_null( $val ) ) {
+               if ( is_null( $val ) ) {
                        return $val;
                } else {
                        return (string)$val;
@@ -414,7 +414,7 @@ class WebRequest {
         */
        public function getArray( $name, $default = null ) {
                $val = $this->getGPCVal( $this->data, $name, $default );
-               if( is_null( $val ) ) {
+               if ( is_null( $val ) ) {
                        return null;
                } else {
                        return (array)$val;
@@ -433,7 +433,7 @@ class WebRequest {
         */
        public function getIntArray( $name, $default = null ) {
                $val = $this->getArray( $name, $default );
-               if( is_array( $val ) ) {
+               if ( is_array( $val ) ) {
                        $val = array_map( 'intval', $val );
                }
                return $val;
@@ -615,7 +615,7 @@ class WebRequest {
         * @return Mixed: cookie value or $default if the cookie not set
         */
        public function getCookie( $key, $prefix = null, $default = null ) {
-               if( $prefix === null ) {
+               if ( $prefix === null ) {
                        global $wgCookiePrefix;
                        $prefix = $wgCookiePrefix;
                }
@@ -630,14 +630,14 @@ class WebRequest {
         * @return String
         */
        public function getRequestURL() {
-               if( isset( $_SERVER['REQUEST_URI'] ) && strlen( $_SERVER['REQUEST_URI'] ) ) {
+               if ( isset( $_SERVER['REQUEST_URI'] ) && strlen( $_SERVER['REQUEST_URI'] ) ) {
                        $base = $_SERVER['REQUEST_URI'];
                } elseif ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) && strlen( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
                        // Probably IIS; doesn't set REQUEST_URI
                        $base = $_SERVER['HTTP_X_ORIGINAL_URL'];
-               } elseif( isset( $_SERVER['SCRIPT_NAME'] ) ) {
+               } elseif ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
                        $base = $_SERVER['SCRIPT_NAME'];
-                       if( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ) {
+                       if ( isset( $_SERVER['QUERY_STRING'] ) && $_SERVER['QUERY_STRING'] != '' ) {
                                $base .= '?' . $_SERVER['QUERY_STRING'];
                        }
                } else {
@@ -651,11 +651,11 @@ class WebRequest {
                // need to strip it or we get false-positive redirect loops
                // or weird output URLs
                $hash = strpos( $base, '#' );
-               if( $hash !== false ) {
+               if ( $hash !== false ) {
                        $base = substr( $base, 0, $hash );
                }
 
-               if( $base[0] == '/' ) {
+               if ( $base[0] == '/' ) {
                        // More than one slash will look like it is protocol relative
                        return preg_replace( '!^/+!', '/', $base );
                } else {
@@ -739,21 +739,21 @@ class WebRequest {
                global $wgUser;
 
                $limit = $this->getInt( 'limit', 0 );
-               if( $limit < 0 ) {
+               if ( $limit < 0 ) {
                        $limit = 0;
                }
-               if( ( $limit == 0 ) && ( $optionname != '' ) ) {
+               if ( ( $limit == 0 ) && ( $optionname != '' ) ) {
                        $limit = $wgUser->getIntOption( $optionname );
                }
-               if( $limit <= 0 ) {
+               if ( $limit <= 0 ) {
                        $limit = $deflimit;
                }
-               if( $limit > 5000 ) {
+               if ( $limit > 5000 ) {
                        $limit = 5000; # We have *some* limits...
                }
 
                $offset = $this->getInt( 'offset', 0 );
-               if( $offset < 0 ) {
+               if ( $offset < 0 ) {
                        $offset = 0;
                }
 
@@ -893,7 +893,7 @@ class WebRequest {
         * @return Mixed
         */
        public function getSessionData( $key ) {
-               if( !isset( $_SESSION[$key] ) ) {
+               if ( !isset( $_SESSION[$key] ) ) {
                        return null;
                }
                return $_SESSION[$key];
@@ -1268,13 +1268,13 @@ class FauxRequest extends WebRequest {
         * @throws MWException
         */
        public function __construct( $data = array(), $wasPosted = false, $session = null ) {
-               if( is_array( $data ) ) {
+               if ( is_array( $data ) ) {
                        $this->data = $data;
                } else {
                        throw new MWException( "FauxRequest() got bogus data" );
                }
                $this->wasPosted = $wasPosted;
-               if( $session ) {
+               if ( $session ) {
                        $this->session = $session;
                }
        }
@@ -1359,7 +1359,7 @@ class FauxRequest extends WebRequest {
         * @return mixed
         */
        public function getSessionData( $key ) {
-               if( isset( $this->session[$key] ) ) {
+               if ( isset( $this->session[$key] ) ) {
                        return $this->session[$key];
                }
                return null;
index 8e15d71..d1f645c 100644 (file)
@@ -57,10 +57,10 @@ class WebResponse {
                if ( $expire == 0 ) {
                        $expire = time() + $wgCookieExpiration;
                }
-               if( $prefix === null ) {
+               if ( $prefix === null ) {
                        $prefix = $wgCookiePrefix;
                }
-               if( $domain === null ) {
+               if ( $domain === null ) {
                        $domain = $wgCookieDomain;
                }
 
@@ -116,7 +116,7 @@ class FauxResponse extends WebResponse {
                } else {
                        list( $key, $val ) = array_map( 'trim', explode( ":", $string, 2 ) );
 
-                       if( $replace || !isset( $this->headers[$key] ) ) {
+                       if ( $replace || !isset( $this->headers[$key] ) ) {
                                $this->headers[$key] = $val;
                        }
                }
index e6f3135..3b7d701 100644 (file)
@@ -48,7 +48,7 @@ if ( ini_get( 'register_globals' ) ) {
                'HTTP_SESSION_VARS'
        );
        foreach ( $_REQUEST as $name => $value ) {
-               if( in_array( $name, $verboten ) ) {
+               if ( in_array( $name, $verboten ) ) {
                        header( "HTTP/1.1 500 Internal Server Error" );
                        echo "register_globals security paranoia: trying to overwrite superglobals, aborting.";
                        die( -1 );
@@ -84,7 +84,7 @@ define( 'MEDIAWIKI', true );
 # if we don't have permissions on parent directories.
 $IP = getenv( 'MW_INSTALL_PATH' );
 if ( $IP === false ) {
-       if( realpath( '.' ) ) {
+       if ( realpath( '.' ) ) {
                $IP = realpath( '.' );
        } else {
                $IP = dirname( __DIR__ );
@@ -129,7 +129,7 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
        # LocalSettings.php is the per site customization file. If it does not exist
        # the wiki installer needs to be launched or the generated file uploaded to
        # the root wiki directory
-       if( !file_exists( MW_CONFIG_FILE ) ) {
+       if ( !file_exists( MW_CONFIG_FILE ) ) {
                require_once( "$IP/includes/templates/NoLocalSettings.php" );
                die();
        }
index b9a7aac..7d0d5af 100644 (file)
@@ -126,7 +126,7 @@ class MediaWiki {
         * @return Title
         */
        public function getTitle() {
-               if( $this->context->getTitle() === null ) {
+               if ( $this->context->getTitle() === null ) {
                        $this->context->setTitle( $this->parseTitle() );
                }
                return $this->context->getTitle();
@@ -480,7 +480,7 @@ class MediaWiki {
                                $resp->header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
                                $resp->header( 'X-Database-Lag: ' . intval( $lag ) );
                                $resp->header( 'Content-Type: text/plain' );
-                               if( $wgShowHostnames ) {
+                               if ( $wgShowHostnames ) {
                                        echo "Waiting for $host: $lag seconds lagged\n";
                                } else {
                                        echo "Waiting for a database server: $lag seconds lagged\n";
index 6278121..08eb800 100644 (file)
@@ -143,7 +143,7 @@ class WikiXmlError extends WikiError {
        }
 
        function _extractContext( $context, $offset ) {
-               if( is_null( $context ) ) {
+               if ( is_null( $context ) ) {
                        return null;
                } else {
                        // Hopefully integer overflow will be handled transparently here
index ab3d68d..5d90b12 100644 (file)
@@ -37,7 +37,7 @@ class WikiMap {
                $wgConf->loadFullData();
 
                list( $major, $minor ) = $wgConf->siteFromDB( $wikiID );
-               if( $major === null ) {
+               if ( $major === null ) {
                        return null;
                }
                $canonicalServer = $wgConf->get( 'wgCanonicalServer', $wikiID, $major,
index 3f7e497..39a71ad 100644 (file)
@@ -305,7 +305,7 @@ class WikiPage implements Page, IDBAccessObject {
        public function pageDataFromTitle( $dbr, $title, $options = array() ) {
                return $this->pageData( $dbr, array(
                        'page_namespace' => $title->getNamespace(),
-                       'page_title'     => $title->getDBkey() ), $options );
+                       'page_title' => $title->getDBkey() ), $options );
        }
 
        /**
@@ -462,7 +462,9 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public function isRedirect() {
                $content = $this->getContent();
-               if ( !$content ) return false;
+               if ( !$content ) {
+                       return false;
+               }
 
                return $content->isRedirect();
        }
@@ -906,10 +908,10 @@ class WikiPage implements Page, IDBAccessObject {
                $dbw = wfGetDB( DB_MASTER );
                $dbw->replace( 'redirect', array( 'rd_from' ),
                        array(
-                               'rd_from'      => $this->getId(),
+                               'rd_from' => $this->getId(),
                                'rd_namespace' => $rt->getNamespace(),
-                               'rd_title'     => $rt->getDBkey(),
-                               'rd_fragment'  => $rt->getFragment(),
+                               'rd_title' => $rt->getDBkey(),
+                               'rd_fragment' => $rt->getFragment(),
                                'rd_interwiki' => $rt->getInterwiki(),
                        ),
                        __METHOD__
@@ -1155,7 +1157,7 @@ class WikiPage implements Page, IDBAccessObject {
        public function doPurge() {
                global $wgUseSquid;
 
-               if( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
+               if ( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
                        return false;
                }
 
@@ -1182,7 +1184,9 @@ class WikiPage implements Page, IDBAccessObject {
                                $content = $this->getContent();
                                $text = $content === null ? null : $content->getWikitextForTransclusion();
 
-                               if ( $text === null ) $text = false;
+                               if ( $text === null ) {
+                                       $text = false;
+                               }
                        } else {
                                $text = false;
                        }
@@ -1698,7 +1702,9 @@ class WikiPage implements Page, IDBAccessObject {
 
                // Provide autosummaries if one is not provided and autosummaries are enabled.
                if ( $wgUseAutomaticEditSummaries && $flags & EDIT_AUTOSUMMARY && $summary == '' ) {
-                       if ( !$old_content ) $old_content = null;
+                       if ( !$old_content ) {
+                               $old_content = null;
+                       }
                        $summary = $handler->getAutosummary( $old_content, $content, $flags );
                }
 
@@ -2142,12 +2148,14 @@ class WikiPage implements Page, IDBAccessObject {
                if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
                        // XXX: could skip pseudo-messages like js/css here, based on content model.
                        $msgtext = $content ? $content->getWikitextForTransclusion() : null;
-                       if ( $msgtext === false || $msgtext === null ) $msgtext = '';
+                       if ( $msgtext === false || $msgtext === null ) {
+                               $msgtext = '';
+                       }
 
                        MessageCache::singleton()->replace( $shortTitle, $msgtext );
                }
 
-               if( $options['created'] ) {
+               if ( $options['created'] ) {
                        self::onArticleCreate( $this->mTitle );
                } else {
                        self::onArticleEdit( $this->mTitle );
@@ -2811,7 +2819,7 @@ class WikiPage implements Page, IDBAccessObject {
                        $wgContLang->timeanddate( wfTimestamp( TS_MW, $s->rev_timestamp ) ),
                        $current->getId(), $wgContLang->timeanddate( $current->getTimestamp() )
                );
-               if( $summary instanceof Message ) {
+               if ( $summary instanceof Message ) {
                        $summary = $summary->params( $args )->inContentLanguage()->text();
                } else {
                        $summary = wfMsgReplaceArgs( $summary, $args );
@@ -2852,8 +2860,8 @@ class WikiPage implements Page, IDBAccessObject {
                $resultDetails = array(
                        'summary' => $summary,
                        'current' => $current,
-                       'target'  => $target,
-                       'newid'   => $revId
+                       'target' => $target,
+                       'newid' => $revId
                );
 
                return array();
@@ -3082,11 +3090,11 @@ class WikiPage implements Page, IDBAccessObject {
                                        );
                                }
 
-                               foreach( $added as $catName ) {
+                               foreach ( $added as $catName ) {
                                        $cat = Category::newFromName( $catName );
                                        wfRunHooks( 'CategoryAfterPageAdded', array( $cat, $that ) );
                                }
-                               foreach( $deleted as $catName ) {
+                               foreach ( $deleted as $catName ) {
                                        $cat = Category::newFromName( $catName );
                                        wfRunHooks( 'CategoryAfterPageRemoved', array( $cat, $that ) );
                                }
index 29c240e..c62cbdf 100644 (file)
@@ -38,13 +38,13 @@ class Xml {
         */
        public static function element( $element, $attribs = null, $contents = '', $allowShortTag = true ) {
                $out = '<' . $element;
-               if( !is_null( $attribs ) ) {
+               if ( !is_null( $attribs ) ) {
                        $out .= self::expandAttributes( $attribs );
                }
-               if( is_null( $contents ) ) {
+               if ( is_null( $contents ) ) {
                        $out .= '>';
                } else {
-                       if( $allowShortTag && $contents === '' ) {
+                       if ( $allowShortTag && $contents === '' ) {
                                $out .= ' />';
                        } else {
                                $out .= '>' . htmlspecialchars( $contents ) . "</$element>";
@@ -64,10 +64,10 @@ class Xml {
         */
        public static function expandAttributes( $attribs ) {
                $out = '';
-               if( is_null( $attribs ) ) {
+               if ( is_null( $attribs ) ) {
                        return null;
-               } elseif( is_array( $attribs ) ) {
-                       foreach( $attribs as $name => $val ) {
+               } elseif ( is_array( $attribs ) ) {
+                       foreach ( $attribs as $name => $val ) {
                                $out .= " {$name}=\"" . Sanitizer::encodeAttribute( $val ) . '"';
                        }
                        return $out;
@@ -88,10 +88,10 @@ class Xml {
         */
        public static function elementClean( $element, $attribs = array(), $contents = '' ) {
                global $wgContLang;
-               if( $attribs ) {
+               if ( $attribs ) {
                        $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
                }
-               if( $contents ) {
+               if ( $contents ) {
                        wfProfileIn( __METHOD__ . '-norm' );
                        $contents = $wgContLang->normalize( $contents );
                        wfProfileOut( __METHOD__ . '-norm' );
@@ -115,7 +115,9 @@ class Xml {
         * @param string $element element name
         * @return string
         */
-       public static function closeElement( $element ) { return "</$element>"; }
+       public static function closeElement( $element ) {
+               return "</$element>";
+       }
 
        /**
         * Same as Xml::element(), but does not escape contents. Handy when the
@@ -144,11 +146,11 @@ class Xml {
                wfDeprecated( __METHOD__, '1.19' );
                return Html::namespaceSelector( array(
                        'selected' => $selected,
-                       'all'      => $all,
-                       'label'    => $label,
+                       'all' => $all,
+                       'label' => $label,
                ), array(
-                       'name'  => $element_name,
-                       'id'    => 'namespace',
+                       'name' => $element_name,
+                       'id' => 'namespace',
                        'class' => 'namespaceselector',
                ) );
        }
@@ -164,12 +166,15 @@ class Xml {
        public static function monthSelector( $selected = '', $allmonths = null, $id = 'month' ) {
                global $wgLang;
                $options = array();
-               if( is_null( $selected ) )
+               if ( is_null( $selected ) ) {
                        $selected = '';
-               if( !is_null( $allmonths ) )
+               }
+               if ( !is_null( $allmonths ) ) {
                        $options[] = self::option( wfMessage( 'monthsall' )->text(), $allmonths, $selected === $allmonths );
-               for( $i = 1; $i < 13; $i++ )
+               }
+               for ( $i = 1; $i < 13; $i++ ) {
                        $options[] = self::option( $wgLang->getMonthName( $i ), $i, $selected === $i );
+               }
                return self::openElement( 'select', array( 'id' => $id, 'name' => 'month', 'class' => 'mw-month-selector' ) )
                        . implode( "\n", $options )
                        . self::closeElement( 'select' );
@@ -182,17 +187,17 @@ class Xml {
         */
        public static function dateMenu( $year, $month ) {
                # Offset overrides year/month selection
-               if( $month && $month !== -1 ) {
+               if ( $month && $month !== -1 ) {
                        $encMonth = intval( $month );
                } else {
                        $encMonth = '';
                }
-               if( $year ) {
+               if ( $year ) {
                        $encYear = intval( $year );
-               } elseif( $encMonth ) {
+               } elseif ( $encMonth ) {
                        $thisMonth = intval( gmdate( 'n' ) );
                        $thisYear = intval( gmdate( 'Y' ) );
-                       if( intval( $encMonth ) > $thisMonth ) {
+                       if ( intval( $encMonth ) > $thisMonth ) {
                                $thisYear--;
                        }
                        $encYear = $thisYear;
@@ -224,7 +229,7 @@ class Xml {
 
                // Make sure the site language is in the list;
                // a custom language code might not have a defined name...
-               if( !array_key_exists( $wgLanguageCode, $languages ) ) {
+               if ( !array_key_exists( $wgLanguageCode, $languages ) ) {
                        $languages[$wgLanguageCode] = $wgLanguageCode;
                }
 
@@ -237,14 +242,14 @@ class Xml {
                 */
                $selected = isset( $languages[$selected] ) ? $selected : $wgLanguageCode;
                $options = "\n";
-               foreach( $languages as $code => $name ) {
+               foreach ( $languages as $code => $name ) {
                        $options .= Xml::option( "$code - $name", $code, ($code == $selected) ) . "\n";
                }
 
                $attrs = array( 'id' => 'wpUserLanguage', 'name' => 'wpUserLanguage' );
                $attrs = array_merge( $attrs, $overrideAttrs );
 
-               if( $msg === null ) {
+               if ( $msg === null ) {
                        $msg = wfMessage( 'yourlanguage' );
                }
                return array(
@@ -288,11 +293,11 @@ class Xml {
        public static function input( $name, $size = false, $value = false, $attribs = array() ) {
                $attributes = array( 'name' => $name );
 
-               if( $size ) {
+               if ( $size ) {
                        $attributes['size'] = $size;
                }
 
-               if( $value !== false ) { // maybe 0
+               if ( $value !== false ) { // maybe 0
                        $attributes['value'] = $value;
                }
 
@@ -369,10 +374,10 @@ class Xml {
                $a = array( 'for' => $id );
 
                # FIXME avoid copy pasting below:
-               if( isset( $attribs['class'] ) ) {
+               if ( isset( $attribs['class'] ) ) {
                                $a['class'] = $attribs['class'];
                }
-               if( isset( $attribs['title'] ) ) {
+               if ( isset( $attribs['title'] ) ) {
                                $a['title'] = $attribs['title'];
                }
 
@@ -468,10 +473,10 @@ class Xml {
         */
        public static function option( $text, $value = null, $selected = false,
                        $attribs = array() ) {
-               if( !is_null( $value ) ) {
+               if ( !is_null( $value ) ) {
                        $attribs['value'] = $value;
                }
-               if( $selected ) {
+               if ( $selected ) {
                        $attribs['selected'] = 'selected';
                }
                return Html::element( 'option', $attribs, $text );
@@ -500,7 +505,9 @@ class Xml {
                                } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
                                        // A new group is starting ...
                                        $value = trim( substr( $value, 1 ) );
-                                       if( $optgroup ) $options .= self::closeElement( 'optgroup' );
+                                       if ( $optgroup ) {
+                                               $options .= self::closeElement( 'optgroup' );
+                                       }
                                        $options .= self::openElement( 'optgroup', array( 'label' => $value ) );
                                        $optgroup = true;
                                } elseif ( substr( $value, 0, 2 ) == '**' ) {
@@ -509,26 +516,30 @@ class Xml {
                                        $options .= self::option( $value, $value, $selected === $value );
                                } else {
                                        // groupless reason list
-                                       if( $optgroup ) $options .= self::closeElement( 'optgroup' );
+                                       if ( $optgroup ) {
+                                               $options .= self::closeElement( 'optgroup' );
+                                       }
                                        $options .= self::option( $value, $value, $selected === $value );
                                        $optgroup = false;
                                }
                        }
 
-                       if( $optgroup ) $options .= self::closeElement( 'optgroup' );
+                       if ( $optgroup ) {
+                               $options .= self::closeElement( 'optgroup' );
+                       }
 
                $attribs = array();
 
-               if( $name ) {
+               if ( $name ) {
                        $attribs['id'] = $name;
                        $attribs['name'] = $name;
                }
 
-               if( $class ) {
+               if ( $class ) {
                        $attribs['class'] = $class;
                }
 
-               if( $tabindex ) {
+               if ( $tabindex ) {
                        $attribs['tabindex'] = $tabindex;
                }
 
@@ -679,7 +690,7 @@ class Xml {
                # case folding violates XML standard, turn it off
                xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false );
 
-               if( !xml_parse( $parser, $text, true ) ) {
+               if ( !xml_parse( $parser, $text, true ) ) {
                        //$err = xml_error_string( xml_get_error_code( $parser ) );
                        //$position = xml_get_current_byte_index( $parser );
                        //$fragment = $this->extractFragment( $html, $position );
@@ -736,7 +747,7 @@ class Xml {
                $form = '';
                $form .= "<table><tbody>";
 
-               foreach( $fields as $labelmsg => $input ) {
+               foreach ( $fields as $labelmsg => $input ) {
                        $id = "mw-$labelmsg";
                        $form .= Xml::openElement( 'tr', array( 'id' => $id ) );
                        $form .= Xml::tags( 'td', array( 'class' => 'mw-label' ), wfMessage( $labelmsg )->parse() );
@@ -744,7 +755,7 @@ class Xml {
                        $form .= Xml::closeElement( 'tr' );
                }
 
-               if( $submitLabel ) {
+               if ( $submitLabel ) {
                        $form .= Xml::openElement( 'tr' );
                        $form .= Xml::tags( 'td', array(), '' );
                        $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text() ) . Xml::closeElement( 'td' );
@@ -769,7 +780,7 @@ class Xml {
                if ( is_array( $headers ) ) {
                        $s .= Xml::openElement( 'thead', $attribs );
 
-                       foreach( $headers as $id => $header ) {
+                       foreach ( $headers as $id => $header ) {
                                $attribs = array();
 
                                if ( is_string( $id ) ) {
@@ -781,7 +792,7 @@ class Xml {
                        $s .= Xml::closeElement( 'thead' );
                }
 
-               foreach( $rows as $id => $row ) {
+               foreach ( $rows as $id => $row ) {
                        $attribs = array();
 
                        if ( is_string( $id ) ) {
@@ -805,8 +816,7 @@ class Xml {
        public static function buildTableRow( $attribs, $cells ) {
                $s = Xml::openElement( 'tr', $attribs );
 
-               foreach( $cells as $id => $cell ) {
-
+               foreach ( $cells as $id => $cell ) {
                        $attribs = array();
 
                        if ( is_string( $id ) ) {
@@ -902,7 +912,7 @@ class XmlSelect {
        static function formatOptions( $options, $default = false ) {
                $data = '';
 
-               foreach( $options as $label => $value ) {
+               foreach ( $options as $label => $value ) {
                        if ( is_array( $value ) ) {
                                $contents = self::formatOptions( $value, $default );
                                $data .= Html::rawElement( 'optgroup', array( 'label' => $label ), $contents ) . "\n";
index 5e4f118..25dde7d 100644 (file)
@@ -78,13 +78,13 @@ class XmlTypeCheck {
                                do {
                                        $chunk = fread( $file, 32768 );
                                        $ret = xml_parse( $parser, $chunk, feof( $file ) );
-                                       if( $ret == 0 ) {
+                                       if ( $ret == 0 ) {
                                                // XML isn't well-formed!
                                                fclose( $file );
                                                xml_parser_free( $parser );
                                                return;
                                        }
-                               } while( !feof( $file ) );
+                               } while ( !feof( $file ) );
 
                                fclose( $file );
                        }
@@ -103,7 +103,7 @@ class XmlTypeCheck {
        private function rootElementOpen( $parser, $name, $attribs ) {
                $this->rootElement = $name;
 
-               if( is_callable( $this->filterCallback ) ) {
+               if ( is_callable( $this->filterCallback ) ) {
                        xml_set_element_handler( $parser, array( $this, 'elementOpen' ), false );
                        $this->elementOpen( $parser, $name, $attribs );
                } else {
@@ -118,7 +118,7 @@ class XmlTypeCheck {
         * @param $attribs
         */
        private function elementOpen( $parser, $name, $attribs ) {
-               if( call_user_func( $this->filterCallback, $name, $attribs ) ) {
+               if ( call_user_func( $this->filterCallback, $name, $attribs ) ) {
                        // Filter hit!
                        $this->filterMatch = true;
                }
index fd03ec4..c5955ae 100644 (file)
@@ -81,14 +81,14 @@ class ZhClient {
                $result = fgets( $this->mFP, 1024 );
 
                list( $status, $len ) = explode( ' ', $result );
-               if( $status == 'ERROR' ) {
+               if ( $status == 'ERROR' ) {
                        // $len is actually the error code...
                        print "zhdaemon error $len<br />\n";
                        return false;
                }
                $bytesread = 0;
                $data = '';
-               while( !feof( $this->mFP ) && $bytesread < $len ) {
+               while ( !feof( $this->mFP ) && $bytesread < $len ) {
                        $str = fread( $this->mFP, $len - $bytesread );
                        $bytesread += strlen( $str );
                        $data .= $str;
@@ -131,7 +131,7 @@ class ZhClient {
                $info = explode( ';', $infoline );
                $ret = array();
                $i = 0;
-               foreach( $info as $variant ) {
+               foreach ( $info as $variant ) {
                        list( $code, $len ) = explode( ' ', $variant );
                        $ret[strtolower( $code )] = substr( $data, $i, $len );
                        $i += $len;
index 895f3d3..0a2bf30 100644 (file)
@@ -114,9 +114,10 @@ class CreditsAction extends FormlessAction {
                # Hmm... too many to fit!
                if ( $cnt > 0 && $contributors->count() > $cnt ) {
                        $others_link = $this->othersLink();
-                       if ( !$showIfMax )
+                       if ( !$showIfMax ) {
                                return $this->msg( 'othercontribs' )->rawParams(
                                        $others_link )->params( $contributors->count() )->escaped();
+                       }
                }
 
                $real_names = array();
index 7296126..911fd58 100644 (file)
@@ -211,7 +211,7 @@ class HistoryAction extends FormlessAction {
         */
        function fetchRevisions( $limit, $offset, $direction ) {
                // Fail if article doesn't exist.
-               if( !$this->getTitle()->exists() ) {
+               if ( !$this->getTitle()->exists() ) {
                        return new FakeResultWrapper( array() );
                }
 
@@ -367,14 +367,14 @@ class HistoryPager extends ReverseChronologicalPager {
 
        function getQueryInfo() {
                $queryInfo = array(
-                       'tables'  => array( 'revision', 'user' ),
-                       'fields'  => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
-                       'conds'   => array_merge(
+                       'tables' => array( 'revision', 'user' ),
+                       'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
+                       'conds' => array_merge(
                                array( 'rev_page' => $this->getWikiPage()->getId() ),
                                $this->conds ),
                        'options' => array( 'USE INDEX' => array( 'revision' => 'page_timestamp' ) ),
                        'join_conds' => array(
-                               'user'        => Revision::userJoinCond(),
+                               'user' => Revision::userJoinCond(),
                                'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
                );
                ChangeTags::modifyDisplayQuery(
@@ -413,10 +413,10 @@ class HistoryPager extends ReverseChronologicalPager {
                $batch = new LinkBatch();
                $revIds = array();
                foreach ( $this->mResult as $row ) {
-                       if( $row->rev_parent_id ) {
+                       if ( $row->rev_parent_id ) {
                                $revIds[] = $row->rev_parent_id;
                        }
-                       if( !is_null( $row->user_name ) ) {
+                       if ( !is_null( $row->user_name ) ) {
                                $batch->add( NS_USER, $row->user_name );
                                $batch->add( NS_USER_TALK, $row->user_name );
                        } else { # for anons or usernames of imported revisions
@@ -649,9 +649,9 @@ class HistoryPager extends ReverseChronologicalPager {
                                        $this->msg( 'editundo' )->escaped(),
                                        $undoTooltip,
                                        array(
-                                               'action'    => 'edit',
+                                               'action' => 'edit',
                                                'undoafter' => $prevRev->getId(),
-                                               'undo'      => $rev->getId()
+                                               'undo' => $rev->getId()
                                        )
                                );
                                $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
@@ -788,13 +788,13 @@ class HistoryPager extends ReverseChronologicalPager {
        function diffButtons( $rev, $firstInList ) {
                if ( $this->getNumRows() > 1 ) {
                        $id = $rev->getId();
-                       $radio = array( 'type'  => 'radio', 'value' => $id );
+                       $radio = array( 'type' => 'radio', 'value' => $id );
                        /** @todo: move title texts to javascript */
                        if ( $firstInList ) {
                                $first = Xml::element( 'input',
                                        array_merge( $radio, array(
                                                'style' => 'visibility:hidden',
-                                               'name'  => 'oldid',
+                                               'name' => 'oldid',
                                                'id' => 'mw-oldid-null' ) )
                                );
                                $checkmark = array( 'checked' => 'checked' );
@@ -811,13 +811,13 @@ class HistoryPager extends ReverseChronologicalPager {
                                }
                                $first = Xml::element( 'input',
                                        array_merge( $radio, $checkmark, array(
-                                               'name'  => 'oldid',
+                                               'name' => 'oldid',
                                                'id' => "mw-oldid-$id" ) ) );
                                $checkmark = array();
                        }
                        $second = Xml::element( 'input',
                                array_merge( $radio, $checkmark, array(
-                                       'name'  => 'diff',
+                                       'name' => 'diff',
                                        'id' => "mw-diff-$id" ) ) );
                        return $first . $second;
                } else {
index 55fa108..a8905d8 100644 (file)
@@ -602,7 +602,7 @@ class InfoAction extends FormlessAction {
                        'COUNT(*)',
                        array(
                                'wl_namespace' => $title->getNamespace(),
-                               'wl_title'     => $title->getDBkey(),
+                               'wl_title' => $title->getDBkey(),
                        ),
                        __METHOD__
                );
index 82cdc79..ed0bff7 100644 (file)
@@ -71,7 +71,7 @@ class PurgeAction extends FormAction {
                                $this->getRequest()->getQueryValues(),
                                array( 'title' => null, 'action' => null )
                        ) );
-                       if( $this->onSubmit( array() ) ) {
+                       if ( $this->onSubmit( array() ) ) {
                                $this->onSuccess();
                        }
                } else {
index 23db874..3fa20b7 100644 (file)
@@ -125,7 +125,7 @@ class RawAction extends FormlessAction {
                global $wgParser;
 
                # No longer used
-               if( $this->mGen ) {
+               if ( $this->mGen ) {
                        return '';
                }
 
@@ -194,14 +194,14 @@ class RawAction extends FormlessAction {
                switch ( $this->getRequest()->getText( 'direction' ) ) {
                        case 'next':
                                # output next revision, or nothing if there isn't one
-                               if( $oldid ) {
+                               if ( $oldid ) {
                                        $oldid = $this->getTitle()->getNextRevisionID( $oldid );
                                }
                                $oldid = $oldid ? $oldid : -1;
                                break;
                        case 'prev':
                                # output previous revision, or nothing if there isn't one
-                               if( !$oldid ) {
+                               if ( !$oldid ) {
                                        # get the current revision so we can get the penultimate one
                                        $oldid = $this->page->getLatest();
                                }
index 08fde7a..ee5aa97 100644 (file)
@@ -311,8 +311,7 @@ abstract class ApiBase extends ContextSource {
                                        );
                                }
                                $msg .= "Example" . ( count( $examples ) > 1 ? 's' : '' ) . ":\n";
-                               foreach( $examples as $k => $v ) {
-
+                               foreach ( $examples as $k => $v ) {
                                        if ( is_numeric( $k ) ) {
                                                $msg .= "  $v\n";
                                        } else {
@@ -1397,7 +1396,7 @@ abstract class ApiBase extends ContextSource {
        public function dieUsageMsg( $error ) {
                # most of the time we send a 1 element, so we might as well send it as
                # a string and make this an array here.
-               if( is_string( $error ) ) {
+               if ( is_string( $error ) ) {
                        $error = array( $error );
                }
                $parsed = $this->parseMsg( $error );
@@ -1412,10 +1411,10 @@ abstract class ApiBase extends ContextSource {
         */
        public function dieUsageMsgOrDebug( $error ) {
                global $wgDebugAPI;
-               if( $wgDebugAPI !== true ) {
+               if ( $wgDebugAPI !== true ) {
                        $this->dieUsageMsg( $error );
                } else {
-                       if( is_string( $error ) ) {
+                       if ( is_string( $error ) ) {
                                $error = array( $error );
                        }
                        $parsed = $this->parseMsg( $error );
@@ -1448,7 +1447,7 @@ abstract class ApiBase extends ContextSource {
 
                // Check whether the error array was nested
                // array( array( <code>, <params> ), array( <another_code>, <params> ) )
-               if( is_array( $key ) ) {
+               if ( is_array( $key ) ) {
                        $error = $key;
                        $key = array_shift( $error );
                }
index 90432b9..ab0a7e9 100644 (file)
@@ -104,7 +104,7 @@ class ApiBlock extends ApiBase {
                $res['userID'] = $target instanceof User ? $target->getId() : 0;
 
                $block = Block::newFromTarget( $target );
-               if( $block instanceof Block ) {
+               if ( $block instanceof Block ) {
                        $res['expiry'] = $block->mExpiry == $this->getDB()->getInfinity()
                                ? 'infinite'
                                : wfTimestamp( TS_ISO_8601, $block->mExpiry );
index 79ffcb0..1e35c34 100644 (file)
@@ -81,17 +81,17 @@ class ApiComparePages extends ApiBase {
         * @return int
         */
        private function revisionOrTitleOrId( $revision, $titleText, $titleId ) {
-               if( $revision ) {
+               if ( $revision ) {
                        return $revision;
-               } elseif( $titleText ) {
+               } elseif ( $titleText ) {
                        $title = Title::newFromText( $titleText );
-                       if( !$title || $title->isExternal() ) {
+                       if ( !$title || $title->isExternal() ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $titleText ) );
                        }
                        return $title->getLatestRevID();
                } elseif ( $titleId ) {
                        $title = Title::newFromID( $titleId );
-                       if( !$title ) {
+                       if ( !$title ) {
                                $this->dieUsageMsg( array( 'nosuchpageid', $titleId ) );
                        }
                        return $title->getLatestRevID();
index 278ea29..59ff324 100644 (file)
@@ -48,7 +48,7 @@ class ApiCreateAccount extends ApiBase {
                        wfSetupSession();
                }
 
-               if( $params['mailpassword'] && !$params['email'] ) {
+               if ( $params['mailpassword'] && !$params['email'] ) {
                        $this->dieUsageMsg( 'noemail' );
                }
 
@@ -80,20 +80,20 @@ class ApiCreateAccount extends ApiBase {
 
                $status = $loginForm->addNewaccountInternal();
                $result = array();
-               if( $status->isGood() ) {
+               if ( $status->isGood() ) {
                        // Success!
                        global $wgEmailAuthentication;
                        $user = $status->getValue();
 
-                       if( $params['language'] ) {
+                       if ( $params['language'] ) {
                                $user->setOption( 'language', $params['language'] );
                        }
 
-                       if( $params['mailpassword'] ) {
+                       if ( $params['mailpassword'] ) {
                                // If mailpassword was set, disable the password and send an email.
                                $user->setPassword( null );
                                $status->merge( $loginForm->mailPasswordInternal( $user, false, 'createaccount-title', 'createaccount-text' ) );
-                       } elseif( $wgEmailAuthentication && Sanitizer::validateEmail( $user->getEmail() ) ) {
+                       } elseif ( $wgEmailAuthentication && Sanitizer::validateEmail( $user->getEmail() ) ) {
                                // Send out an email authentication message if needed
                                $status->merge( $user->sendConfirmationMail() );
                        }
@@ -120,18 +120,18 @@ class ApiCreateAccount extends ApiBase {
 
                $apiResult = $this->getResult();
 
-               if( $status->hasMessage( 'sessionfailure' ) || $status->hasMessage( 'nocookiesfornew' ) ) {
+               if ( $status->hasMessage( 'sessionfailure' ) || $status->hasMessage( 'nocookiesfornew' ) ) {
                        // Token was incorrect, so add it to result, but don't throw an exception
                        // since not having the correct token is part of the normal
                        // flow of events.
                        $result['token'] = LoginForm::getCreateaccountToken();
                        $result['result'] = 'needtoken';
-               } elseif( !$status->isOK() ) {
+               } elseif ( !$status->isOK() ) {
                        // There was an error. Die now.
                        // Cannot use dieUsageMsg() directly because extensions
                        // might return custom error messages.
                        $errors = $status->getErrorsArray();
-                       if( $errors[0] instanceof Message ) {
+                       if ( $errors[0] instanceof Message ) {
                                $code = 'aborted';
                                $desc = $errors[0];
                        } else {
@@ -139,14 +139,14 @@ class ApiCreateAccount extends ApiBase {
                                $desc = wfMessage( $code, $errors[0] );
                        }
                        $this->dieUsage( $desc, $code );
-               } elseif( !$status->isGood() ) {
+               } elseif ( !$status->isGood() ) {
                        // Status is not good, but OK. This means warnings.
                        $result['result'] = 'warning';
 
                        // Add any warnings to the result
                        $warnings = $status->getErrorsByType( 'warning' );
-                       if( $warnings ) {
-                               foreach( $warnings as &$warning ) {
+                       if ( $warnings ) {
+                               foreach ( $warnings as &$warning ) {
                                        $apiResult->setIndexedTagName( $warning['params'], 'param' );
                                }
                                $apiResult->setIndexedTagName( $warnings, 'warning' );
@@ -259,7 +259,7 @@ class ApiCreateAccount extends ApiBase {
 
                $errors = parent::getPossibleErrors();
                // All local errors are from LoginForm, which means they're actually message keys.
-               foreach( $localErrors as $error ) {
+               foreach ( $localErrors as $error ) {
                        $errors[] = array( 'code' => $error, 'info' => wfMessage( $error )->parse() );
                }
 
index 42fb652..a11563b 100644 (file)
@@ -43,11 +43,11 @@ class ApiFeedContributions extends ApiBase {
 
                global $wgFeed, $wgFeedClasses, $wgSitename, $wgLanguageCode;
 
-               if( !$wgFeed ) {
+               if ( !$wgFeed ) {
                        $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                }
 
-               if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
+               if ( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                        $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                }
 
@@ -82,7 +82,7 @@ class ApiFeedContributions extends ApiBase {
                ) );
 
                $feedItems = array();
-               if( $pager->getNumRows() > 0 ) {
+               if ( $pager->getNumRows() > 0 ) {
                        foreach ( $pager->mResult as $row ) {
                                $feedItems[] = $this->feedItem( $row );
                        }
@@ -93,7 +93,7 @@ class ApiFeedContributions extends ApiBase {
 
        protected function feedItem( $row ) {
                $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
-               if( $title ) {
+               if ( $title ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
                        $revision = Revision::newFromRow( $row );
@@ -124,7 +124,7 @@ class ApiFeedContributions extends ApiBase {
         * @return string
         */
        protected function feedItemDesc( $revision ) {
-               if( $revision ) {
+               if ( $revision ) {
                        $msg = wfMessage( 'colon-separator' )->inContentLanguage()->text();
                        $content = $revision->getContent();
 
index b96ea37..ddcd6ac 100644 (file)
@@ -56,11 +56,11 @@ class ApiFeedWatchlist extends ApiBase {
                try {
                        $params = $this->extractRequestParams();
 
-                       if( !$wgFeed ) {
+                       if ( !$wgFeed ) {
                                $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
                        }
 
-                       if( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
+                       if ( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
                                $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                        }
 
index 3ecb0d5..7a60e83 100644 (file)
@@ -37,15 +37,15 @@ class ApiImageRotate extends ApiBase {
         */
        private static function addValues( array &$result, $values, $flag = null, $name = null ) {
                foreach ( $values as $val ) {
-                       if( $val instanceof Title ) {
+                       if ( $val instanceof Title ) {
                                $v = array();
                                ApiQueryBase::addTitleInfo( $v, $val );
-                       } elseif( $name !== null ) {
+                       } elseif ( $name !== null ) {
                                $v = array( $name => $val );
                        } else {
                                $v = $val;
                        }
-                       if( $flag !== null ) {
+                       if ( $flag !== null ) {
                                $v[$flag] = '';
                        }
                        $result[] = $v;
index 1f0a5fa..56af76f 100644 (file)
@@ -66,7 +66,7 @@ class ApiImport extends ApiBase {
                }
                if ( isset( $params['rootpage'] ) ) {
                        $statusRootPage = $importer->setTargetRootPage( $params['rootpage'] );
-                       if( !$statusRootPage->isGood() ) {
+                       if ( !$statusRootPage->isGood() ) {
                                $this->dieUsageMsg( $statusRootPage->getErrorsArray() );
                        }
                }
index 76f9b42..99847cf 100644 (file)
@@ -788,7 +788,7 @@ class ApiMain extends ApiBase {
 
                // Allow extensions to stop execution for arbitrary reasons.
                $message = false;
-               if( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
+               if ( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
                        $this->dieUsageMsg( $message );
                }
        }
@@ -950,7 +950,7 @@ class ApiMain extends ApiBase {
                        $unusedParams = array_diff( $allParams, $paramsUsed );
                }
 
-               if( count( $unusedParams ) ) {
+               if ( count( $unusedParams ) ) {
                        $s = count( $unusedParams ) > 1 ? 's' : '';
                        $this->setWarning( "Unrecognized parameter$s: '" . implode( $unusedParams, "', '" ) . "'" );
                }
@@ -963,7 +963,7 @@ class ApiMain extends ApiBase {
         */
        protected function printResult( $isError ) {
                global $wgDebugAPI;
-               if( $wgDebugAPI !== false ) {
+               if ( $wgDebugAPI !== false ) {
                        $this->setWarning( 'SECURITY WARNING: $wgDebugAPI is enabled' );
                }
 
@@ -1008,7 +1008,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 'help',
                                ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'action' )
                        ),
-                       'maxlag'  => array(
+                       'maxlag' => array(
                                ApiBase::PARAM_TYPE => 'integer'
                        ),
                        'smaxage' => array(
@@ -1020,7 +1020,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 0
                        ),
                        'requestid' => null,
-                       'servedby'  => false,
+                       'servedby' => false,
                        'origin' => null,
                );
        }
index 3e846e3..c18036c 100644 (file)
@@ -88,7 +88,7 @@ class ApiMove extends ApiBase {
                        $r['redirectcreated'] = '';
                }
 
-               if( $toTitleExists ) {
+               if ( $toTitleExists ) {
                        $r['moveoverredirect'] = '';
                }
 
@@ -99,7 +99,7 @@ class ApiMove extends ApiBase {
                        if ( $retval === true ) {
                                $r['talkfrom'] = $fromTalk->getPrefixedText();
                                $r['talkto'] = $toTalk->getPrefixedText();
-                               if( $toTalkExists ) {
+                               if ( $toTalkExists ) {
                                        $r['talkmoveoverredirect'] = '';
                                }
                        } else {
index f13a50e..b68dc5c 100644 (file)
@@ -42,15 +42,15 @@ class ApiPurge extends ApiBase {
         */
        private static function addValues( array &$result, $values, $flag = null, $name = null ) {
                foreach ( $values as $val ) {
-                       if( $val instanceof Title ) {
+                       if ( $val instanceof Title ) {
                                $v = array();
                                ApiQueryBase::addTitleInfo( $v, $val );
-                       } elseif( $name !== null ) {
+                       } elseif ( $name !== null ) {
                                $v = array( $name => $val );
                        } else {
                                $v = $val;
                        }
-                       if( $flag !== null ) {
+                       if ( $flag !== null ) {
                                $v[$flag] = '';
                        }
                        $result[] = $v;
index c9811b0..d47c7b7 100644 (file)
@@ -87,7 +87,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
                        foreach ( $messages_target as $message ) {
                                // === 0: must be at beginning of string (position 0)
                                if ( strpos( $message, $params['prefix'] ) === 0 ) {
-                                       if( !$skip ) {
+                                       if ( !$skip ) {
                                                $skip = true;
                                        }
                                        $messages_filtered[] = $message;
index d718b96..0d0c10f 100644 (file)
@@ -174,7 +174,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $res = $this->select( __METHOD__ );
 
                //Get gender information
-               if( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
+               if ( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
                        $users = array();
                        foreach ( $res as $row ) {
                                $users[] = $row->page_title;
index 7283aa0..1948a51 100644 (file)
@@ -83,12 +83,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
 
                if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) {
                        $groups = array();
-                       foreach( $params['rights'] as $r ) {
+                       foreach ( $params['rights'] as $r ) {
                                $groups = array_merge( $groups, User::getGroupsWithPermission( $r ) );
                        }
 
                        // no group with the given right(s) exists, no need for a query
-                       if( !count( $groups ) ) {
+                       if ( !count( $groups ) ) {
                                $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), '' );
                                return;
                        }
index 6899808..e39c25a 100644 (file)
@@ -229,10 +229,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $orderBy = array();
                $sort = ( $this->params['dir'] == 'descending' ? ' DESC' : '' );
                // Don't order by namespace/title if it's constant in the WHERE clause
-               if( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
+               if ( $this->hasNS && count( array_unique( $allRedirNs ) ) != 1 ) {
                        $orderBy[] = $this->bl_ns . $sort;
                }
-               if( count( array_unique( $allRedirDBkey ) ) != 1 ) {
+               if ( count( array_unique( $allRedirDBkey ) ) != 1 ) {
                        $orderBy[] = $this->bl_title . $sort;
                }
                $orderBy[] = $this->bl_from . $sort;
index ba90452..fa2a7c4 100644 (file)
@@ -94,8 +94,9 @@ class ApiQueryBlocks extends ApiQueryBase {
                        list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
                        if ( $ip && $range ) {
                                // We got a CIDR range
-                               if ( $range < 16 )
+                               if ( $range < 16 ) {
                                        $this->dieUsage( 'CIDR ranges broader than /16 are not accepted', 'cidrtoobroad' );
+                               }
                                $lower = wfBaseConvert( $ip, 10, 16, 8, false );
                                $upper = wfBaseConvert( $ip + pow( 2, 32 - $range ) - 1, 10, 16, 8, false );
                        } else {
index 31ca1ef..4a53409 100644 (file)
@@ -74,13 +74,13 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                if ( $mode == 'revs' || $mode == 'user' ) {
                        // Ignore namespace and unique due to inability to know whether they were purposely set
-                       foreach( array( 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ) as $p ) {
+                       foreach ( array( 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ) as $p ) {
                                if ( !is_null( $params[$p] ) ) {
                                        $this->dieUsage( "The '{$p}' parameter cannot be used in modes 1 or 2", 'badparams' );
                                }
                        }
                } else {
-                       foreach( array( 'start', 'end' ) as $p ) {
+                       foreach ( array( 'start', 'end' ) as $p ) {
                                if ( !is_null( $params[$p] ) ) {
                                        $this->dieUsage( "The {$p} parameter cannot be used in mode 3", 'badparams' );
                                }
index 7f73631..0311fa7 100644 (file)
@@ -58,7 +58,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                }
                $images = $namespaces[NS_FILE];
 
-               if( $params['dir'] == 'descending' ) {
+               if ( $params['dir'] == 'descending' ) {
                        $images = array_reverse( $images );
                }
 
@@ -79,7 +79,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                }
 
                $filesToFind = array_keys( $images );
-               if( $params['localonly'] ) {
+               if ( $params['localonly'] ) {
                        $files = RepoGroup::singleton()->getLocalRepo()->findFiles( $filesToFind );
                } else {
                        $files = RepoGroup::singleton()->findFiles( $filesToFind );
@@ -97,29 +97,29 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
 
                // find all files with the hashes, result format is: array( hash => array( dup1, dup2 ), hash1 => ... )
                $filesToFindBySha1s = array_unique( array_values( $sha1s ) );
-               if( $params['localonly'] ) {
+               if ( $params['localonly'] ) {
                        $filesBySha1s = RepoGroup::singleton()->getLocalRepo()->findBySha1s( $filesToFindBySha1s );
                } else {
                        $filesBySha1s = RepoGroup::singleton()->findBySha1s( $filesToFindBySha1s );
                }
 
                // iterate over $images to handle continue param correct
-               foreach( $images as $image => $pageId ) {
-                       if( !isset( $sha1s[$image] ) ) {
+               foreach ( $images as $image => $pageId ) {
+                       if ( !isset( $sha1s[$image] ) ) {
                                continue; //file does not exist
                        }
                        $sha1 = $sha1s[$image];
                        $dupFiles = $filesBySha1s[$sha1];
-                       if( $params['dir'] == 'descending' ) {
+                       if ( $params['dir'] == 'descending' ) {
                                $dupFiles = array_reverse( $dupFiles );
                        }
                        /** @var $dupFile File */
                        foreach ( $dupFiles as $dupFile ) {
                                $dupName = $dupFile->getName();
-                               if( $image == $dupName && $dupFile->isLocal() ) {
+                               if ( $image == $dupName && $dupFile->isLocal() ) {
                                        continue; //ignore the local file itself
                                }
-                               if( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) {
+                               if ( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) {
                                        continue; //skip to pos after the image from continue param
                                }
                                $skipUntilThisDup = false;
@@ -138,7 +138,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                                                'user' => $dupFile->getUser( 'text' ),
                                                'timestamp' => wfTimestamp( TS_ISO_8601, $dupFile->getTimestamp() )
                                        );
-                                       if( !$dupFile->isLocal() ) {
+                                       if ( !$dupFile->isLocal() ) {
                                                $r['shared'] = '';
                                        }
                                        $fit = $this->addPageSubItem( $pageId, $r );
@@ -148,7 +148,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                                        }
                                }
                        }
-                       if( !$fit ) {
+                       if ( !$fit ) {
                                break;
                        }
                }
index eb9cdf9..124d273 100644 (file)
@@ -123,7 +123,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                                if ( $fld_url ) {
                                        $to = $row->el_to;
                                        // expand protocol-relative urls
-                                       if( $params['expandurl'] ) {
+                                       if ( $params['expandurl'] ) {
                                                $to = wfExpandUrl( $to, PROTO_CANONICAL );
                                        }
                                        $vals['url'] = $to;
index 761b49e..56ee268 100644 (file)
@@ -88,7 +88,7 @@ class ApiQueryExternalLinks extends ApiQueryBase {
                        $entry = array();
                        $to = $row->el_to;
                        // expand protocol-relative urls
-                       if( $params['expandurl'] ) {
+                       if ( $params['expandurl'] ) {
                                $to = wfExpandUrl( $to, PROTO_CANONICAL );
                        }
                        ApiResult::setContent( $entry, $to );
index 0869cb9..c36821b 100644 (file)
@@ -72,7 +72,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
 
                        $result = $this->getResult();
                        //search only inside the local repo
-                       if( $params['localonly'] ) {
+                       if ( $params['localonly'] ) {
                                $images = RepoGroup::singleton()->getLocalRepo()->findFiles( $titles );
                        } else {
                                $images = RepoGroup::singleton()->findFiles( $titles );
index 37cd915..6dbda5f 100644 (file)
@@ -60,7 +60,7 @@ class ApiQueryInfo extends ApiQueryBase {
 
                $pageSet->requestField( 'page_restrictions' );
                // when resolving redirects, no page will have this field
-               if( !$pageSet->isResolvingRedirects() ) {
+               if ( !$pageSet->isResolvingRedirects() ) {
                        $pageSet->requestField( 'page_is_redirect' );
                }
                $pageSet->requestField( 'page_is_new' );
@@ -476,7 +476,7 @@ class ApiQueryInfo extends ApiQueryBase {
                                $this->protections[$title->getNamespace()][$title->getDBkey()][] = $a;
                        }
                        // Also check old restrictions
-                       foreach( $this->titles as $pageId => $title ) {
+                       foreach ( $this->titles as $pageId => $title ) {
                                if ( $this->pageRestrictions[$pageId] ) {
                                        $namespace = $title->getNamespace();
                                        $dbKey = $title->getDBkey();
index 73dcea4..33b70a4 100644 (file)
@@ -241,7 +241,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                break;
                        case 'rights':
                                $vals2 = array();
-                               if( $legacy ) {
+                               if ( $legacy ) {
                                        list( $vals2['old'], $vals2['new'] ) = $params;
                                } else {
                                        $vals2['new'] = implode( ', ', $params['5::newgroups'] );
index b03bdfb..9d0fd0a 100644 (file)
@@ -52,7 +52,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
                global $wgQueryPages;
                $this->qpMap = array();
                foreach ( $wgQueryPages as $page ) {
-                       if( !in_array( $page[1], $this->uselessQueryPages ) ) {
+                       if ( !in_array( $page[1], $this->uselessQueryPages ) ) {
                                $this->qpMap[$page[1]] = $page[0];
                        }
                }
index f79083e..37b22f1 100644 (file)
@@ -170,15 +170,15 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $data['lang'] = $GLOBALS['wgLanguageCode'];
 
                $fallbacks = array();
-               foreach( $wgContLang->getFallbackLanguages() as $code ) {
+               foreach ( $wgContLang->getFallbackLanguages() as $code ) {
                        $fallbacks[] = array( 'code' => $code );
                }
                $data['fallback'] = $fallbacks;
                $this->getResult()->setIndexedTagName( $data['fallback'], 'lang' );
 
-               if( $wgContLang->hasVariants() ) {
+               if ( $wgContLang->hasVariants() ) {
                        $variants = array();
-                       foreach( $wgContLang->getVariants() as $code ) {
+                       foreach ( $wgContLang->getVariants() as $code ) {
                                $variants[] = array( 'code' => $code );
                        }
                        $data['variants'] = $variants;
@@ -345,10 +345,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                                $val['language'] = $langNames[$prefix];
                        }
                        $val['url'] = wfExpandUrl( $row['iw_url'], PROTO_CURRENT );
-                       if( isset( $row['iw_wikiid'] ) ) {
+                       if ( isset( $row['iw_wikiid'] ) ) {
                                $val['wikiid'] = $row['iw_wikiid'];
                        }
-                       if( isset( $row['iw_api'] ) ) {
+                       if ( isset( $row['iw_api'] ) ) {
                                $val['api'] = $row['iw_api'];
                        }
 
@@ -520,7 +520,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
 
                $data = array(
                        'url' => $url ? $url : '',
-                       'text' => $text ?  $text : ''
+                       'text' => $text ? $text : ''
                );
 
                return $this->getResult()->addValue( 'query', $property, $data );
index 597c412..6d20d66 100644 (file)
@@ -83,10 +83,10 @@ class ApiQueryContributions extends ApiQueryBase {
                // Do the actual query.
                $res = $this->select( __METHOD__ );
 
-               if( $this->fld_sizediff ) {
+               if ( $this->fld_sizediff ) {
                        $revIds = array();
                        foreach ( $res as $row ) {
-                               if( $row->rev_parent_id ) {
+                               if ( $row->rev_parent_id ) {
                                        $revIds[] = $row->rev_parent_id;
                                }
                        }
index 1a491ec..8e65b40 100644 (file)
@@ -167,8 +167,9 @@ class ApiQueryUserInfo extends ApiQueryBase {
                if ( $user->isNewbie() ) {
                        $categories[] = 'ip';
                        $categories[] = 'subnet';
-                       if ( !$user->isAnon() )
+                       if ( !$user->isAnon() ) {
                                $categories[] = 'newbie';
+                       }
                }
                $categories = array_merge( $categories, $user->getGroups() );
 
index 72ab786..0a0aaee 100644 (file)
@@ -127,7 +127,7 @@ class ApiQueryUsers extends ApiQueryBase {
                                $this->addFields( array( 'user_name', 'ug_group' ) );
                                $userGroupsRes = $this->select( __METHOD__ );
 
-                               foreach( $userGroupsRes as $row ) {
+                               foreach ( $userGroupsRes as $row ) {
                                        $userGroups[$row->user_name][] = $row->ug_group;
                                }
                        }
index 9d30729..a8d7115 100644 (file)
@@ -56,7 +56,7 @@ class ApiUpload extends ApiBase {
                $this->mParams['chunk'] = $request->getFileName( 'chunk' );
 
                // Copy the session key to the file key, for backward compatibility.
-               if( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
+               if ( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
                        $this->mParams['filekey'] = $this->mParams['sessionkey'];
                }
 
@@ -82,7 +82,7 @@ class ApiUpload extends ApiBase {
                // Check if the uploaded file is sane
                if ( $this->mParams['chunk'] ) {
                        $maxSize = $this->mUpload->getMaxUploadSize();
-                       if( $this->mParams['filesize'] > $maxSize ) {
+                       if ( $this->mParams['filesize'] > $maxSize ) {
                                $this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
                        }
                        if ( !$this->mUpload->getTitle() ) {
@@ -354,7 +354,7 @@ class ApiUpload extends ApiBase {
                if ( $this->mParams['chunk'] ) {
                        // Chunk upload
                        $this->mUpload = new UploadFromChunks();
-                       if( isset( $this->mParams['filekey'] ) ) {
+                       if ( isset( $this->mParams['filekey'] ) ) {
                                // handle new chunk
                                $this->mUpload->continueChunks(
                                        $this->mParams['filename'],
index d3e85d8..193f20f 100644 (file)
@@ -237,7 +237,7 @@ class BacklinkCache {
                } else {
                        $prefix = null;
                        wfRunHooks( 'BacklinkCacheGetPrefix', array( $table, &$prefix ) );
-                       if( $prefix ) {
+                       if ( $prefix ) {
                                return $prefix;
                        } else {
                                throw new MWException( "Invalid table \"$table\" in " . __CLASS__ );
@@ -292,7 +292,7 @@ class BacklinkCache {
                        default:
                                $conds = null;
                                wfRunHooks( 'BacklinkCacheGetConditions', array( $table, $this->title, &$conds ) );
-                               if( !$conds ) {
+                               if ( !$conds ) {
                                        throw new MWException( "Invalid table \"$table\" in " . __CLASS__ );
                                }
                }
index 0f047e8..32bcdf7 100644 (file)
@@ -404,7 +404,7 @@ class GlobalDependency extends CacheDependency {
         * @return bool
         */
        function isExpired() {
-               if( !isset( $GLOBALS[$this->name] ) ) {
+               if ( !isset( $GLOBALS[$this->name] ) ) {
                        return true;
                }
                return $GLOBALS[$this->name] != $this->value;
index 74feffb..7310f61 100644 (file)
@@ -138,7 +138,7 @@ abstract class FileCacheBase {
         * @return string
         */
        public function fetchText() {
-               if( $this->useGzip() ) {
+               if ( $this->useGzip() ) {
                        $fh = gzopen( $this->cachePath(), 'rb' );
                        return stream_get_contents( $fh );
                } else {
index 63e4226..b7d1b26 100644 (file)
@@ -66,15 +66,14 @@ class GenderCache {
        public function getGenderOf( $username, $caller = '' ) {
                global $wgUser;
 
-               if( $username instanceof User ) {
+               if ( $username instanceof User ) {
                        $username = $username->getName();
                }
 
                $username = self::normalizeUsername( $username );
                if ( !isset( $this->cache[$username] ) ) {
-
                        if ( $this->misses >= $this->missLimit && $wgUser->getName() !== $username ) {
-                               if( $this->misses === $this->missLimit ) {
+                               if ( $this->misses === $this->missLimit ) {
                                        $this->misses++;
                                        wfDebug( __METHOD__ . ": too many misses, returning default onwards\n" );
                                }
@@ -84,7 +83,6 @@ class GenderCache {
                                $this->misses++;
                                $this->doQuery( $username, $caller );
                        }
-
                }
 
                /* Undefined if there is a valid username which for some reason doesn't
@@ -102,7 +100,9 @@ class GenderCache {
        public function doLinkBatch( $data, $caller = '' ) {
                $users = array();
                foreach ( $data as $ns => $pagenames ) {
-                       if ( !MWNamespace::hasGenderDistinction( $ns ) ) continue;
+                       if ( !MWNamespace::hasGenderDistinction( $ns ) ) {
+                               continue;
+                       }
                        foreach ( array_keys( $pagenames ) as $username ) {
                                $users[$username] = true;
                        }
@@ -150,7 +150,7 @@ class GenderCache {
                                // For existing users, this value will be overwritten by the correct value
                                $this->cache[$name] = $default;
                                // query only for valid names, which can be in the database
-                               if( User::isValidUserName( $name ) ) {
+                               if ( User::isValidUserName( $name ) ) {
                                        $usersToCheck[] = $name;
                                }
                        }
index 72a2e8e..f47107c 100644 (file)
@@ -39,7 +39,7 @@ class LinkBatch {
        protected $caller;
 
        function __construct( $arr = array() ) {
-               foreach( $arr as $item ) {
+               foreach ( $arr as $item ) {
                        $this->addObj( $item );
                }
        }
index 0e41e26..31982e0 100644 (file)
@@ -156,8 +156,13 @@ class LinkCache {
                unset( $this->mGoodLinkFields[$dbkey] );
        }
 
-       public function getGoodLinks() { return $this->mGoodLinks; }
-       public function getBadLinks() { return array_keys( $this->mBadLinks ); }
+       public function getGoodLinks() {
+               return $this->mGoodLinks;
+       }
+
+       public function getBadLinks() {
+               return array_keys( $this->mBadLinks );
+       }
 
        /**
         * Add a title to the link cache, return the page_id or zero if non-existent
@@ -167,7 +172,7 @@ class LinkCache {
         */
        public function addLink( $title ) {
                $nt = Title::newFromDBkey( $title );
-               if( $nt ) {
+               if ( $nt ) {
                        return $this->addLinkObj( $nt );
                } else {
                        return 0;
@@ -215,7 +220,9 @@ class LinkCache {
                }
 
                $f = array( 'page_id', 'page_len', 'page_is_redirect', 'page_latest' );
-               if ( $wgContentHandlerUseDB ) $f[] = 'page_content_model';
+               if ( $wgContentHandlerUseDB ) {
+                       $f[] = 'page_content_model';
+               }
 
                $s = $db->selectRow( 'page', $f,
                        array( 'page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey() ),
index 6cc2a7e..49db857 100644 (file)
@@ -205,7 +205,7 @@ class MessageCache {
        function load( $code = false ) {
                global $wgUseLocalMessageCache;
 
-               if( !is_string( $code ) ) {
+               if ( !is_string( $code ) ) {
                        # This isn't really nice, so at least make a note about it and try to
                        # fall back
                        wfDebug( __METHOD__ . " called without providing a language code\n" );
index 5f5d257..dd71801 100644 (file)
@@ -125,7 +125,7 @@ class SquidUpdate {
        static function purge( $urlArr ) {
                global $wgSquidServers, $wgHTCPMulticastRouting;
 
-               if( !$urlArr ) {
+               if ( !$urlArr ) {
                        return;
                }
 
@@ -172,7 +172,7 @@ class SquidUpdate {
                $htcpOpCLR = 4; // HTCP CLR
 
                // @todo FIXME: PHP doesn't support these socket constants (include/linux/in.h)
-               if( !defined( "IPPROTO_IP" ) ) {
+               if ( !defined( "IPPROTO_IP" ) ) {
                        define( "IPPROTO_IP", 0 );
                        define( "IP_MULTICAST_LOOP", 34 );
                        define( "IP_MULTICAST_TTL", 33 );
@@ -183,13 +183,14 @@ class SquidUpdate {
                if ( $conn ) {
                        // Set socket options
                        socket_set_option( $conn, IPPROTO_IP, IP_MULTICAST_LOOP, 0 );
-                       if ( $wgHTCPMulticastTTL != 1 )
+                       if ( $wgHTCPMulticastTTL != 1 ) {
                                socket_set_option( $conn, IPPROTO_IP, IP_MULTICAST_TTL,
                                        $wgHTCPMulticastTTL );
+                       }
 
                        $urlArr = array_unique( $urlArr ); // Remove duplicates
                        foreach ( $urlArr as $url ) {
-                               if( !is_string( $url ) ) {
+                               if ( !is_string( $url ) ) {
                                        wfProfileOut( __METHOD__ );
                                        throw new MWException( 'Bad purge URL' );
                                }
index 6aefc98..fd99caf 100644 (file)
@@ -401,10 +401,10 @@ class RequestContext implements IContextSource {
         */
        public function exportSession() {
                return array(
-                       'ip'        => $this->getRequest()->getIP(),
-                       'headers'   => $this->getRequest()->getAllHeaders(),
+                       'ip' => $this->getRequest()->getIP(),
+                       'headers' => $this->getRequest()->getAllHeaders(),
                        'sessionId' => session_id(),
-                       'userId'    => $this->getUser()->getId()
+                       'userId' => $this->getUser()->getId()
                );
        }
 
index 4e44374..2603b9f 100644 (file)
@@ -87,7 +87,7 @@ class CloneDatabase {
         * Clone the table structure
         */
        public function cloneTableStructure() {
-               foreach( $this->tablesToClone as $tbl ) {
+               foreach ( $this->tablesToClone as $tbl ) {
                        # Clean up from previous aborted run.  So that table escaping
                        # works correctly across DB engines, we need to change the pre-
                        # fix back and forth so tableName() works right.
@@ -98,7 +98,7 @@ class CloneDatabase {
                        self::changePrefix( $this->newTablePrefix );
                        $newTableName = $this->db->tableName( $tbl, 'raw' );
 
-                       if( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres', 'oracle' ) ) ) {
+                       if ( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres', 'oracle' ) ) ) {
                                $this->db->dropTable( $tbl, __METHOD__ );
                                wfDebug( __METHOD__ . " dropping {$newTableName}\n", true );
                                //Dropping the oldTable because the prefix was changed
@@ -115,9 +115,9 @@ class CloneDatabase {
         * @param bool $dropTables Optionally drop the tables we created
         */
        public function destroy( $dropTables = false ) {
-               if( $dropTables ) {
+               if ( $dropTables ) {
                        self::changePrefix( $this->newTablePrefix );
-                       foreach( $this->tablesToClone as $tbl ) {
+                       foreach ( $this->tablesToClone as $tbl ) {
                                $this->db->dropTable( $tbl );
                        }
                }
index 87d5f81..63c9cfe 100644 (file)
@@ -732,7 +732,7 @@ abstract class DatabaseBase implements DatabaseType {
                $dbType = strtolower( $dbType );
                $class = 'Database' . ucfirst( $dbType );
 
-               if( in_array( $dbType, $canonicalDBTypes ) || ( class_exists( $class ) && is_subclass_of( $class, 'DatabaseBase' ) ) ) {
+               if ( in_array( $dbType, $canonicalDBTypes ) || ( class_exists( $class ) && is_subclass_of( $class, 'DatabaseBase' ) ) ) {
                        return new $class(
                                isset( $p['host'] ) ? $p['host'] : false,
                                isset( $p['user'] ) ? $p['user'] : false,
@@ -1636,7 +1636,7 @@ abstract class DatabaseBase implements DatabaseType {
         * @return bool|null
         */
        public function indexExists( $table, $index, $fname = 'DatabaseBase::indexExists' ) {
-               if( !$this->tableExists( $table ) ) {
+               if ( !$this->tableExists( $table ) ) {
                        return null;
                }
 
@@ -2285,9 +2285,9 @@ abstract class DatabaseBase implements DatabaseType {
        protected function indexName( $index ) {
                // Backwards-compatibility hack
                $renamed = array(
-                       'ar_usertext_timestamp' => 'usertext_timestamp',
-                       'un_user_id'            => 'user_id',
-                       'un_user_ip'            => 'user_ip',
+                       'ar_usertext_timestamp' => 'usertext_timestamp',
+                       'un_user_id' => 'user_id',
+                       'un_user_ip' => 'user_ip',
                );
 
                if ( isset( $renamed[$index] ) ) {
@@ -2468,7 +2468,7 @@ abstract class DatabaseBase implements DatabaseType {
                        $rows = array( $rows );
                }
 
-               foreach( $rows as $row ) {
+               foreach ( $rows as $row ) {
                        # Delete rows which collide
                        if ( $uniqueIndexes ) {
                                $sql = "DELETE FROM $quotedTable WHERE ";
@@ -3122,13 +3122,13 @@ abstract class DatabaseBase implements DatabaseType {
                if ( $flush != 'flush' ) {
                        if ( !$this->mTrxLevel ) {
                                wfWarn( "$fname: No transaction to commit, something got out of sync!" );
-                       } elseif( $this->mTrxAutomatic ) {
+                       } elseif ( $this->mTrxAutomatic ) {
                                wfWarn( "$fname: Explicit commit of implicit transaction. Something may be out of sync!" );
                        }
                } else {
                        if ( !$this->mTrxLevel ) {
                                return; // nothing to do
-                       } elseif( !$this->mTrxAutomatic ) {
+                       } elseif ( !$this->mTrxAutomatic ) {
                                wfWarn( "$fname: Flushing an explicit transaction, getting out of sync!" );
                        }
                }
@@ -3674,11 +3674,11 @@ abstract class DatabaseBase implements DatabaseType {
         * @since 1.18
         */
        public function dropTable( $tableName, $fName = 'DatabaseBase::dropTable' ) {
-               if( !$this->tableExists( $tableName, $fName ) ) {
+               if ( !$this->tableExists( $tableName, $fName ) ) {
                        return false;
                }
                $sql = "DROP TABLE " . $this->tableName( $tableName );
-               if( $this->cascadingDeletes() ) {
+               if ( $this->cascadingDeletes() ) {
                        $sql .= " CASCADE";
                }
                return $this->query( $sql, $fName );
index 82b0e5a..427fd3d 100644 (file)
@@ -96,7 +96,7 @@ class DatabaseMssql extends DatabaseBase {
 
                $connectionInfo = array();
 
-               if( $dbName ) {
+               if ( $dbName ) {
                        $connectionInfo['Database'] = $dbName;
                }
 
@@ -109,7 +109,7 @@ class DatabaseMssql extends DatabaseBase {
                $ntAuthPassTest = strtolower( $password );
 
                // Decide which auth scenerio to use
-               if( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ) {
+               if ( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ) {
                        // Don't add credentials to $connectionInfo
                } else {
                        $connectionInfo['UID'] = $user;
@@ -344,7 +344,9 @@ class DatabaseMssql extends DatabaseBase {
                $rows = -1;
                if ( $res ) {
                        $row = $this->fetchRow( $res );
-                       if ( isset( $row['EstimateRows'] ) ) $rows = $row['EstimateRows'];
+                       if ( isset( $row['EstimateRows'] ) ) {
+                               $rows = $row['EstimateRows'];
+                       }
                }
                return $rows;
        }
@@ -421,7 +423,7 @@ class DatabaseMssql extends DatabaseBase {
                $identity = null;
                $tableRaw = preg_replace( '#\[([^\]]*)\]#', '$1', $table ); // strip matching square brackets from table name
                $res = $this->doQuery( "SELECT NAME AS idColumn FROM SYS.IDENTITY_COLUMNS WHERE OBJECT_NAME(OBJECT_ID)='{$tableRaw}'" );
-               if( $res && $res->numrows() ) {
+               if ( $res && $res->numrows() ) {
                        // There is an identity for this table.
                        $identity = array_pop( $res->fetch( SQLSRV_FETCH_ASSOC ) );
                }
@@ -434,11 +436,11 @@ class DatabaseMssql extends DatabaseBase {
                        $identityClause = '';
 
                        // if we have an identity column
-                       if( $identity ) {
+                       if ( $identity ) {
                                // iterate through
                                foreach ( $a as $k => $v ) {
                                        if ( $k == $identity ) {
-                                               if( !is_null( $v ) ) {
+                                               if ( !is_null( $v ) ) {
                                                        // there is a value being passed to us, we need to turn on and off inserted identity
                                                        $sqlPre = "SET IDENTITY_INSERT $table ON;";
                                                        $sqlPost = ";SET IDENTITY_INSERT $table OFF;";
@@ -1009,7 +1011,7 @@ class MssqlResult {
 
                $rows = sqlsrv_fetch_array( $queryresult, SQLSRV_FETCH_ASSOC );
 
-               foreach( $rows as $row ) {
+               foreach ( $rows as $row ) {
                        if ( $row !== null ) {
                                foreach ( $row as $k => $v ) {
                                        if ( is_object( $v ) && method_exists( $v, 'format' ) ) {// DateTime Object
index d6f6809..0009937 100644 (file)
@@ -42,7 +42,7 @@ class DatabaseMysql extends DatabaseBase {
         * @return resource
         */
        protected function doQuery( $sql ) {
-               if( $this->bufferResults() ) {
+               if ( $this->bufferResults() ) {
                        $ret = mysql_query( $sql, $this->mConn );
                } else {
                        $ret = mysql_unbuffered_query( $sql, $this->mConn );
@@ -153,7 +153,7 @@ class DatabaseMysql extends DatabaseBase {
 
                // Tell the server we're communicating with it in UTF-8.
                // This may engage various charset conversions.
-               if( $wgDBmysql5 ) {
+               if ( $wgDBmysql5 ) {
                        $this->query( 'SET NAMES utf8', __METHOD__ );
                } else {
                        $this->query( 'SET NAMES binary', __METHOD__ );
@@ -210,7 +210,7 @@ class DatabaseMysql extends DatabaseBase {
                // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
                // these are the only errors mysql_fetch_object can cause.
                // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
-               if( $errno == 2000 || $errno == 2013 ) {
+               if ( $errno == 2000 || $errno == 2013 ) {
                        throw new DBUnexpectedError( $this, 'Error in fetchObject(): ' . htmlspecialchars( $this->lastError() ) );
                }
                return $row;
@@ -234,7 +234,7 @@ class DatabaseMysql extends DatabaseBase {
                // Only check for CR_SERVER_LOST and CR_UNKNOWN_ERROR, as
                // these are the only errors mysql_fetch_object can cause.
                // See http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html.
-               if( $errno == 2000 || $errno == 2013 ) {
+               if ( $errno == 2000 || $errno == 2013 ) {
                        throw new DBUnexpectedError( $this, 'Error in fetchRow(): ' . htmlspecialchars( $this->lastError() ) );
                }
                return $row;
@@ -328,7 +328,7 @@ class DatabaseMysql extends DatabaseBase {
                } else {
                        $error = mysql_error();
                }
-               if( $error ) {
+               if ( $error ) {
                        $error .= ' (' . $this->mServer . ')';
                }
                return $error;
@@ -393,9 +393,9 @@ class DatabaseMysql extends DatabaseBase {
                        return false;
                }
                $n = mysql_num_fields( $res->result );
-               for( $i = 0; $i < $n; $i++ ) {
+               for ( $i = 0; $i < $n; $i++ ) {
                        $meta = mysql_fetch_field( $res->result, $i );
-                       if( $field == $meta->name ) {
+                       if ( $field == $meta->name ) {
                                return new MySQLField( $meta );
                        }
                }
@@ -452,7 +452,7 @@ class DatabaseMysql extends DatabaseBase {
        function strencode( $s ) {
                $sQuoted = mysql_real_escape_string( $s, $this->mConn );
 
-               if( $sQuoted === false ) {
+               if ( $sQuoted === false ) {
                        $this->ping();
                        $sQuoted = mysql_real_escape_string( $s, $this->mConn );
                }
@@ -537,11 +537,11 @@ class DatabaseMysql extends DatabaseBase {
        function getLagFromProcesslist() {
                wfDeprecated( __METHOD__, '1.19' );
                $res = $this->query( 'SHOW PROCESSLIST', __METHOD__ );
-               if( !$res ) {
+               if ( !$res ) {
                        return false;
                }
                # Find slave SQL thread
-               foreach( $res as $row ) {
+               foreach ( $res as $row ) {
                        /* This should work for most situations - when default db
                         * for thread is not specified, it had no events executed,
                         * and therefore it doesn't know yet how lagged it is.
@@ -721,7 +721,7 @@ class DatabaseMysql extends DatabaseBase {
                $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method );
                $row = $this->fetchObject( $result );
 
-               if( $row->lockstatus == 1 ) {
+               if ( $row->lockstatus == 1 ) {
                        return true;
                } else {
                        wfDebug( __METHOD__ . " failed to acquire lock\n" );
@@ -752,13 +752,13 @@ class DatabaseMysql extends DatabaseBase {
        public function lockTables( $read, $write, $method, $lowPriority = true ) {
                $items = array();
 
-               foreach( $write as $table ) {
+               foreach ( $write as $table ) {
                        $tbl = $this->tableName( $table ) .
                                        ( $lowPriority ? ' LOW_PRIORITY' : '' ) .
                                        ' WRITE';
                        $items[] = $tbl;
                }
-               foreach( $read as $table ) {
+               foreach ( $read as $table ) {
                        $items[] = $this->tableName( $table ) . ' READ';
                }
                $sql = "LOCK TABLES " . implode( ',', $items );
@@ -905,11 +905,11 @@ class DatabaseMysql extends DatabaseBase {
 
                $endArray = array();
 
-               foreach( $result as $table ) {
+               foreach ( $result as $table ) {
                        $vars = get_object_vars( $table );
                        $table = array_pop( $vars );
 
-                       if( !$prefix || strpos( $table, $prefix ) === 0 ) {
+                       if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
                                $endArray[] = $table;
                        }
                }
@@ -923,7 +923,7 @@ class DatabaseMysql extends DatabaseBase {
         * @return bool|ResultWrapper
         */
        public function dropTable( $tableName, $fName = 'DatabaseMysql::dropTable' ) {
-               if( !$this->tableExists( $tableName, $fName ) ) {
+               if ( !$this->tableExists( $tableName, $fName ) ) {
                        return false;
                }
                return $this->query( "DROP TABLE IF EXISTS " . $this->tableName( $tableName ), $fName );
index a57b24b..a3f6805 100644 (file)
@@ -324,7 +324,7 @@ class DatabaseOracle extends DatabaseBase {
 
                // handle some oracle specifics
                // remove AS column/table/subquery namings
-               if( !$this->getFlag( DBO_DDLMODE ) ) {
+               if ( !$this->getFlag( DBO_DDLMODE ) ) {
                        $sql = preg_replace( '/ as /i', ' ', $sql );
                }
 
@@ -756,7 +756,7 @@ class DatabaseOracle extends DatabaseBase {
 
        function unionQueries( $sqls, $all ) {
                $glue = ' UNION ALL ';
-               return 'SELECT * ' . ( $all ? '':'/* UNION_UNIQUE */ ' ) . 'FROM (' . implode( $glue, $sqls ) . ')';
+               return 'SELECT * ' . ( $all ? '' : '/* UNION_UNIQUE */ ' ) . 'FROM (' . implode( $glue, $sqls ) . ')';
        }
 
        function wasDeadlock() {
@@ -792,8 +792,9 @@ class DatabaseOracle extends DatabaseBase {
                $endArray[] = strtoupper( $prefix . 'IMAGE' );
                $fixedOrderTabs = $endArray;
                while ( ( $row = $result->fetchRow() ) !== false ) {
-                       if ( !in_array( $row['table_name'], $fixedOrderTabs ) )
+                       if ( !in_array( $row['table_name'], $fixedOrderTabs ) ) {
                                $endArray[] = $row['table_name'];
+                       }
                }
 
                return $endArray;
@@ -801,7 +802,7 @@ class DatabaseOracle extends DatabaseBase {
 
        public function dropTable( $tableName, $fName = 'DatabaseOracle::dropTable' ) {
                $tableName = $this->tableName( $tableName );
-               if( !$this->tableExists( $tableName ) ) {
+               if ( !$this->tableExists( $tableName ) ) {
                        return false;
                }
 
@@ -906,7 +907,7 @@ class DatabaseOracle extends DatabaseBase {
                if ( is_array( $table ) ) {
                        $table = array_map( array( &$this, 'tableNameInternal' ), $table );
                        $tableWhere = 'IN (';
-                       foreach( $table as &$singleTable ) {
+                       foreach ( $table as &$singleTable ) {
                                $singleTable = $this->removeIdentifierQuotes( $singleTable );
                                if ( isset( $this->mFieldInfoCache["$singleTable.$field"] ) ) {
                                        return $this->mFieldInfoCache["$singleTable.$field"];
@@ -931,7 +932,7 @@ class DatabaseOracle extends DatabaseBase {
                $res = new ORAResult( $this, $fieldInfoStmt );
                if ( $res->numRows() == 0 ) {
                        if ( is_array( $table ) ) {
-                               foreach( $table as &$singleTable ) {
+                               foreach ( $table as &$singleTable ) {
                                        $this->mFieldInfoCache["$singleTable.$field"] = false;
                                }
                        } else {
index bb35dc3..704b70e 100644 (file)
@@ -117,7 +117,7 @@ SQL;
         * @since 1.19
         */
        function defaultValue() {
-               if( $this->has_default ) {
+               if ( $this->has_default ) {
                        return $this->default;
                } else {
                        return false;
@@ -139,15 +139,15 @@ class PostgresTransactionState {
                array(
                        "desc" => "%s: Connection state changed from %s -> %s\n",
                        "states" => array(
-                               PGSQL_CONNECTION_OK       => "OK",
-                               PGSQL_CONNECTION_BAD      => "BAD"
+                               PGSQL_CONNECTION_OK => "OK",
+                               PGSQL_CONNECTION_BAD => "BAD"
                        )
                ),
                array(
                        "desc" => "%s: Transaction state changed from %s -> %s\n",
                        "states" => array(
-                               PGSQL_TRANSACTION_IDLE    => "IDLE",
-                               PGSQL_TRANSACTION_ACTIVE  => "ACTIVE",
+                               PGSQL_TRANSACTION_IDLE => "IDLE",
+                               PGSQL_TRANSACTION_ACTIVE => "ACTIVE",
                                PGSQL_TRANSACTION_INTRANS => "TRANS",
                                PGSQL_TRANSACTION_INERROR => "ERROR",
                                PGSQL_TRANSACTION_UNKNOWN => "UNKNOWN"
@@ -189,7 +189,7 @@ class PostgresTransactionState {
        }
 
        protected function describe_changed( $status, $desc_table ) {
-               if( isset( $desc_table[$status] ) ) {
+               if ( isset( $desc_table[$status] ) ) {
                        return $desc_table[$status];
                } else {
                        return "STATUS " . $status;
@@ -438,7 +438,7 @@ class DatabasePostgres extends DatabaseBase {
                        $sql = mb_convert_encoding( $sql, 'UTF-8' );
                }
                $this->mTransactionState->check();
-               if( pg_send_query( $this->mConn, $sql ) === false ) {
+               if ( pg_send_query( $this->mConn, $sql ) === false ) {
                        throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" );
                }
                $this->mLastResult = pg_get_result( $this->mConn );
@@ -464,7 +464,7 @@ class DatabasePostgres extends DatabaseBase {
                                PGSQL_DIAG_SOURCE_LINE,
                                PGSQL_DIAG_SOURCE_FUNCTION );
                foreach ( $diags as $d ) {
-                       wfDebug( sprintf("PgSQL ERROR(%d): %s\n", $d, pg_result_error_field( $this->mLastResult, $d ) ) );
+                       wfDebug( sprintf( "PgSQL ERROR(%d): %s\n", $d, pg_result_error_field( $this->mLastResult, $d ) ) );
                }
        }
 
@@ -509,7 +509,7 @@ class DatabasePostgres extends DatabaseBase {
 
                # @todo hashar: not sure if the following test really trigger if the object
                #          fetching failed.
-               if( pg_last_error( $this->mConn ) ) {
+               if ( pg_last_error( $this->mConn ) ) {
                        throw new DBUnexpectedError( $this, 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) );
                }
                return $row;
@@ -522,7 +522,7 @@ class DatabasePostgres extends DatabaseBase {
                wfSuppressWarnings();
                $row = pg_fetch_array( $res );
                wfRestoreWarnings();
-               if( pg_last_error( $this->mConn ) ) {
+               if ( pg_last_error( $this->mConn ) ) {
                        throw new DBUnexpectedError( $this, 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) );
                }
                return $row;
@@ -535,7 +535,7 @@ class DatabasePostgres extends DatabaseBase {
                wfSuppressWarnings();
                $n = pg_num_rows( $res );
                wfRestoreWarnings();
-               if( pg_last_error( $this->mConn ) ) {
+               if ( pg_last_error( $this->mConn ) ) {
                        throw new DBUnexpectedError( $this, 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) );
                }
                return $n;
@@ -596,7 +596,7 @@ class DatabasePostgres extends DatabaseBase {
                        // Forced result for simulated queries
                        return $this->mAffectedRows;
                }
-               if( empty( $this->mLastResult ) ) {
+               if ( empty( $this->mLastResult ) ) {
                        return 0;
                }
                return pg_affected_rows( $this->mLastResult );
@@ -617,7 +617,7 @@ class DatabasePostgres extends DatabaseBase {
                if ( $res ) {
                        $row = $this->fetchRow( $res );
                        $count = array();
-                       if( preg_match( '/rows=(\d+)/', $row[0], $count ) ) {
+                       if ( preg_match( '/rows=(\d+)/', $row[0], $count ) ) {
                                $rows = $count[1];
                        }
                }
@@ -650,8 +650,9 @@ class DatabasePostgres extends DatabaseBase {
         * @return Array
         */
        function indexAttributes( $index, $schema = false ) {
-               if ( $schema === false )
+               if ( $schema === false ) {
                        $schema = $this->getCoreSchema();
+               }
                /*
                 * A subquery would be not needed if we didn't care about the order
                 * of attributes, but we do
@@ -854,7 +855,7 @@ __INDEXATTR__;
        {
                $destTable = $this->tableName( $destTable );
 
-               if( !is_array( $insertOptions ) ) {
+               if ( !is_array( $insertOptions ) ) {
                        $insertOptions = array( $insertOptions );
                }
 
@@ -870,11 +871,11 @@ __INDEXATTR__;
                        $savepoint->savepoint();
                }
 
-               if( !is_array( $selectOptions ) ) {
+               if ( !is_array( $selectOptions ) ) {
                        $selectOptions = array( $selectOptions );
                }
                list( $startOpts, $useIndex, $tailOpts ) = $this->makeSelectOptions( $selectOptions );
-               if( is_array( $srcTable ) ) {
+               if ( is_array( $srcTable ) ) {
                        $srcTable = implode( ',', array_map( array( &$this, 'tableName' ), $srcTable ) );
                } else {
                        $srcTable = $this->tableName( $srcTable );
@@ -891,9 +892,9 @@ __INDEXATTR__;
                $sql .= " $tailOpts";
 
                $res = (bool)$this->query( $sql, $fname, $savepoint );
-               if( $savepoint ) {
+               if ( $savepoint ) {
                        $bar = pg_last_error();
-                       if( $bar != false ) {
+                       if ( $bar != false ) {
                                $savepoint->rollback();
                        } else {
                                $savepoint->release();
@@ -989,10 +990,10 @@ __INDEXATTR__;
                $result = $this->query( "SELECT tablename FROM pg_tables WHERE schemaname = $eschema", $fname );
                $endArray = array();
 
-               foreach( $result as $table ) {
+               foreach ( $result as $table ) {
                        $vars = get_object_vars( $table );
                        $table = array_pop( $vars );
-                       if( !$prefix || strpos( $table, $prefix ) === 0 ) {
+                       if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
                                $endArray[] = $table;
                        }
                }
@@ -1023,11 +1024,11 @@ __INDEXATTR__;
         * @return string
         */
        function pg_array_parse( $text, &$output, $limit = false, $offset = 1 ) {
-               if( false === $limit ) {
+               if ( false === $limit ) {
                        $limit = strlen( $text ) - 1;
                        $output = array();
                }
-               if( '{}' == $text ) {
+               if ( '{}' == $text ) {
                        return $output;
                }
                do {
index e2434a0..f702047 100644 (file)
@@ -78,7 +78,7 @@ class LoadBalancer {
                        }
                }
 
-               foreach( $params['servers'] as $i => $server ) {
+               foreach ( $params['servers'] as $i => $server ) {
                        $this->mLoads[$i] = $server['load'];
                        if ( isset( $server['groupLoads'] ) ) {
                                foreach ( $server['groupLoads'] as $group => $ratio ) {
@@ -665,7 +665,7 @@ class LoadBalancer {
         * @return bool
         */
        function isOpen( $index ) {
-               if( !is_integer( $index ) ) {
+               if ( !is_integer( $index ) ) {
                        return false;
                }
                return (bool)$this->getAnyOpenConnection( $index );
@@ -682,7 +682,7 @@ class LoadBalancer {
         * @return DatabaseBase
         */
        function reallyOpenConnection( $server, $dbNameOverride = false ) {
-               if( !is_array( $server ) ) {
+               if ( !is_array( $server ) ) {
                        throw new MWException( 'You must update your load-balancing configuration. ' .
                                'See DefaultSettings.php entry for $wgDBservers.' );
                }
@@ -833,7 +833,7 @@ class LoadBalancer {
         */
        function closeAll() {
                foreach ( $this->mConns as $conns2 ) {
-                       foreach  ( $conns2 as $conns3 ) {
+                       foreach ( $conns2 as $conns3 ) {
                                foreach ( $conns3 as $conn ) {
                                        $conn->close();
                                }
index ad7b3b2..4b9ecce 100644 (file)
@@ -135,8 +135,9 @@ class LoadMonitor_MySQL implements LoadMonitor {
                $requestRate = 10;
 
                global $wgMemc;
-               if ( empty( $wgMemc ) )
+               if ( empty( $wgMemc ) ) {
                        $wgMemc = wfGetMainCache();
+               }
 
                $masterName = $this->parent->getServerName( 0 );
                $memcKey = wfMemcKey( 'lag_times', $masterName );
index 582b3ac..d75a126 100644 (file)
@@ -484,10 +484,10 @@ class MWDebug {
                // output errors as debug info, when display_errors is on
                // this is necessary for all non html output of the api, because that clears all errors first
                $obContents = ob_get_contents();
-               if( $obContents ) {
+               if ( $obContents ) {
                        $obContentArray = explode( '<br />', $obContents );
-                       foreach( $obContentArray as $obContent ) {
-                               if( trim( $obContent ) ) {
+                       foreach ( $obContentArray as $obContent ) {
+                               if ( trim( $obContent ) ) {
                                        self::debugMsg( Sanitizer::stripAllTags( $obContent ) );
                                }
                        }
@@ -498,7 +498,7 @@ class MWDebug {
 
                $result->setIndexedTagName( $debugInfo, 'debuginfo' );
                $result->setIndexedTagName( $debugInfo['log'], 'line' );
-               foreach( $debugInfo['debugLog'] as $index => $debugLogText ) {
+               foreach ( $debugInfo['debugLog'] as $index => $debugLogText ) {
                        $vals = array();
                        ApiResult::setContent( $vals, $debugLogText );
                        $debugInfo['debugLog'][$index] = $vals; //replace
index f9cb656..e78045a 100644 (file)
@@ -271,7 +271,8 @@ class _DiffEngine {
                                $this->xchanged[$skip] = $this->ychanged[$skip] = false;
                        }
                        // Skip trailing common lines.
-                       $xi = $n_from; $yi = $n_to;
+                       $xi = $n_from;
+                       $yi = $n_to;
                        for ( $endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++ ) {
                                if ( $from_lines[$xi] !== $to_lines[$yi] ) {
                                        break;
@@ -394,7 +395,7 @@ class _DiffEngine {
                                                break;
                                        }
                                }
-                               while ( list ( , $y ) = each( $matches ) ) {
+                               while ( list( , $y ) = each( $matches ) ) {
                                        if ( $y > $this->seq[$k -1] ) {
                                                assert( '$y < $this->seq[$k]' );
                                                // Optimization: this is a common case:
@@ -471,8 +472,7 @@ class _DiffEngine {
         */
        function _compareseq( $xoff, $xlim, $yoff, $ylim ) {
                // Slide down the bottom initial diagonal.
-               while ( $xoff < $xlim && $yoff < $ylim
-               && $this->xv[$xoff] == $this->yv[$yoff] ) {
+               while ( $xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff] ) {
                        ++$xoff;
                        ++$yoff;
                }
@@ -491,7 +491,7 @@ class _DiffEngine {
                        // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5);
                        // $nchunks = max(2,min(8,(int)$nchunks));
                        $nchunks = min( 7, $xlim - $xoff, $ylim - $yoff ) + 1;
-                       list ( $lcs, $seps ) = $this->_diag( $xoff, $xlim, $yoff, $ylim, $nchunks );
+                       list( $lcs, $seps ) = $this->_diag( $xoff, $xlim, $yoff, $ylim, $nchunks );
                }
 
                if ( $lcs == 0 ) {
@@ -554,9 +554,11 @@ class _DiffEngine {
 
                        while ( $i < $len && ! $changed[$i] ) {
                                assert( '$j < $other_len && ! $other_changed[$j]' );
-                               $i++; $j++;
-                               while ( $j < $other_len && $other_changed[$j] )
+                               $i++;
                                $j++;
+                               while ( $j < $other_len && $other_changed[$j] ) {
+                                       $j++;
+                               }
                        }
 
                        if ( $i == $len ) {
index 46a863f..9919236 100644 (file)
@@ -152,7 +152,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                static $externalBlobCache = array();
 
                $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/";
-               if( isset( $externalBlobCache[$cacheID] ) ) {
+               if ( isset( $externalBlobCache[$cacheID] ) ) {
                        wfDebugLog( 'ExternalStoreDB-cache', "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
                        return $externalBlobCache[$cacheID];
                }
@@ -166,11 +166,11 @@ class ExternalStoreDB extends ExternalStoreMedium {
                        // Try the master
                        $dbw =& $this->getMaster( $cluster );
                        $ret = $dbw->selectField( $this->getTable( $dbw ), 'blob_text', array( 'blob_id' => $id ), __METHOD__ );
-                       if( $ret === false) {
+                       if ( $ret === false) {
                                wfDebugLog( 'ExternalStoreDB', "ExternalStoreDB::fetchBlob master failed to find $cacheID\n" );
                        }
                }
-               if( $itemID !== false && $ret !== false ) {
+               if ( $itemID !== false && $ret !== false ) {
                        // Unserialise object; caller extracts item
                        $ret = unserialize( $ret );
                }
index 92fee83..d4e32cf 100644 (file)
@@ -577,7 +577,7 @@ class FSFileBackend extends FileBackendStore {
                if ( $stat ) {
                        return array(
                                'mtime' => wfTimestamp( TS_MW, $stat['mtime'] ),
-                               'size'  => $stat['size']
+                               'size' => $stat['size']
                        );
                } elseif ( !$hadError ) {
                        return false; // file does not exist
@@ -862,7 +862,7 @@ abstract class FSFileBackendList implements Iterator {
         */
        public function __construct( $dir, array $params ) {
                $path = realpath( $dir ); // normalize
-               if( $path === false ) {
+               if ( $path === false ) {
                        $path = $dir;
                }
                $this->suffixStart = strlen( $path ) + 1; // size of "path/to/dir/"
@@ -963,7 +963,7 @@ abstract class FSFileBackendList implements Iterator {
         */
        protected function getRelPath( $dir ) {
                $path = realpath( $dir );
-               if( $path === false ) {
+               if ( $path === false ) {
                        $path = $dir;
                }
                return strtr( substr( $path, $this->suffixStart ), '\\', '/' );
index d505d6f..57fd4d7 100644 (file)
@@ -803,7 +803,9 @@ abstract class FileBackend {
        final protected function getScopedPHPBehaviorForOps() {
                if ( php_sapi_name() != 'cli' ) { // http://bugs.php.net/bug.php?id=47540
                        $old = ignore_user_abort( true ); // avoid half-finished operations
-                       return new ScopedCallback( function() use ( $old ) { ignore_user_abort( $old ); } );
+                       return new ScopedCallback( function() use ( $old ) {
+                               ignore_user_abort( $old );
+                       } );
                }
                return null;
        }
index d790a99..672e437 100644 (file)
@@ -95,17 +95,17 @@ class FileBackendGroup {
                                : 0644;
                        // Get the FS backend configuration
                        $autoBackends[] = array(
-                               'name'           => $backendName,
-                               'class'          => 'FSFileBackend',
-                               'lockManager'    => 'fsLockManager',
+                               'name' => $backendName,
+                               'class' => 'FSFileBackend',
+                               'lockManager' => 'fsLockManager',
                                'containerPaths' => array(
-                                       "{$repoName}-public"  => "{$directory}",
-                                       "{$repoName}-thumb"   => $thumbDir,
-                                       "{$repoName}-transcoded"   => $transcodedDir,
+                                       "{$repoName}-public" => "{$directory}",
+                                       "{$repoName}-thumb" => $thumbDir,
+                                       "{$repoName}-transcoded" => $transcodedDir,
                                        "{$repoName}-deleted" => $deletedDir,
-                                       "{$repoName}-temp"    => "{$directory}/temp"
+                                       "{$repoName}-temp" => "{$directory}/temp"
                                ),
-                               'fileMode'       => $fileMode,
+                               'fileMode' => $fileMode,
                        );
                }
 
@@ -135,8 +135,8 @@ class FileBackendGroup {
 
                        unset( $config['class'] ); // backend won't need this
                        $this->backends[$name] = array(
-                               'class'    => $class,
-                               'config'   => $config,
+                               'class' => $class,
+                               'config' => $config,
                                'instance' => null
                        );
                }
index 6d142b9..ea379bc 100644 (file)
@@ -1058,13 +1058,13 @@ abstract class FileBackendStore extends FileBackend {
         */
        final public function getOperationsInternal( array $ops ) {
                $supportedOps = array(
-                       'store'    => 'StoreFileOp',
-                       'copy'     => 'CopyFileOp',
-                       'move'     => 'MoveFileOp',
-                       'delete'   => 'DeleteFileOp',
-                       'create'   => 'CreateFileOp',
+                       'store' => 'StoreFileOp',
+                       'copy' => 'CopyFileOp',
+                       'move' => 'MoveFileOp',
+                       'delete' => 'DeleteFileOp',
+                       'create' => 'CreateFileOp',
                        'describe' => 'DescribeFileOp',
-                       'null'     => 'NullFileOp'
+                       'null' => 'NullFileOp'
                );
 
                $performOps = array(); // array of FileOp objects
index 62e9fba..80afcf2 100644 (file)
@@ -212,22 +212,22 @@ abstract class FileOp {
                $pathsUsed = array_merge( $this->storagePathsRead(), $this->storagePathsChanged() );
                foreach ( array_unique( $pathsUsed ) as $path ) {
                        $nullEntries[] = array( // assertion for recovery
-                               'op'      => 'null',
-                               'path'    => $path,
+                               'op' => 'null',
+                               'path' => $path,
                                'newSha1' => $this->fileSha1( $path, $oPredicates )
                        );
                }
                foreach ( $this->storagePathsChanged() as $path ) {
                        if ( $nPredicates['sha1'][$path] === false ) { // deleted
                                $deleteEntries[] = array(
-                                       'op'      => 'delete',
-                                       'path'    => $path,
+                                       'op' => 'delete',
+                                       'path' => $path,
                                        'newSha1' => ''
                                );
                        } else { // created/updated
                                $updateEntries[] = array(
-                                       'op'      => $this->fileExists( $path, $oPredicates ) ? 'update' : 'create',
-                                       'path'    => $path,
+                                       'op' => $this->fileExists( $path, $oPredicates ) ? 'update' : 'create',
+                                       'path' => $path,
                                        'newSha1' => $nPredicates['sha1'][$path]
                                );
                        }
index 00c0ff8..f0b289e 100644 (file)
@@ -807,8 +807,8 @@ class SwiftFileBackend extends FileBackendStore {
                        $stat = array(
                                // Convert dates like "Tue, 03 Jan 2012 22:01:04 GMT" to TS_MW
                                'mtime' => wfTimestamp( TS_MW, $srcObj->last_modified ),
-                               'size'  => (int)$srcObj->content_length,
-                               'sha1'  => $srcObj->getMetadataValue( 'Sha1base36' )
+                               'size' => (int)$srcObj->content_length,
+                               'sha1' => $srcObj->getMetadataValue( 'Sha1base36' )
                        );
                } catch ( NoSuchContainerException $e ) {
                } catch ( NoSuchObjectException $e ) {
@@ -1239,8 +1239,8 @@ class SwiftFileBackend extends FileBackendStore {
                                                str_replace( '/swift/v1', '', // S3 API is the rgw default
                                                        $sContObj->cfs_http->getStorageUrl() . $spath ),
                                                array(
-                                                       'Signature'      => $signature,
-                                                       'Expires'        => $expires,
+                                                       'Signature' => $signature,
+                                                       'Expires' => $expires,
                                                        'AWSAccessKeyId' => $this->rgwS3AccessKey )
                                        );
                                }
index 73f29a9..9250aa5 100644 (file)
@@ -65,11 +65,11 @@ class DBFileJournal extends FileJournal {
                foreach ( $entries as $entry ) {
                        $data[] = array(
                                'fj_batch_uuid' => $batchId,
-                               'fj_backend'    => $this->backend,
-                               'fj_op'         => $entry['op'],
-                               'fj_path'       => $entry['path'],
-                               'fj_new_sha1'   => $entry['newSha1'],
-                               'fj_timestamp'  => $dbw->timestamp( $now )
+                               'fj_backend' => $this->backend,
+                               'fj_op' => $entry['op'],
+                               'fj_path' => $entry['path'],
+                               'fj_new_sha1' => $entry['newSha1'],
+                               'fj_timestamp' => $dbw->timestamp( $now )
                        );
                }
 
index f02387d..e081987 100644 (file)
@@ -369,7 +369,9 @@ class PostgreSqlLockManager extends DBLockManager {
 
                $db = $this->getConnection( $lockSrv ); // checked in isServerUp()
                $bigints = array_unique( array_map(
-                       function( $key ) { return wfBaseConvert( substr( $key, 0, 15 ), 16, 10 ); },
+                       function( $key ) {
+                               return wfBaseConvert( substr( $key, 0, 15 ), 16, 10 );
+                       },
                        array_map( array( $this, 'sha1Base16Absolute' ), $paths )
                ) );
 
index ac0bd49..9aff241 100644 (file)
@@ -97,8 +97,8 @@ class LockManagerGroup {
                        $class = $config['class'];
                        unset( $config['class'] ); // lock manager won't need this
                        $this->managers[$name] = array(
-                               'class'    => $class,
-                               'config'   => $config,
+                               'class' => $class,
+                               'config' => $config,
                                'instance' => null
                        );
                }
index e49f37d..42c9c94 100644 (file)
@@ -56,16 +56,16 @@ class FSRepo extends FileRepo {
                        $repoName = $info['name'];
                        // Get the FS backend configuration
                        $backend = new FSFileBackend( array(
-                               'name'           => $info['name'] . '-backend',
-                               'lockManager'    => 'fsLockManager',
+                               'name' => $info['name'] . '-backend',
+                               'lockManager' => 'fsLockManager',
                                'containerPaths' => array(
-                                       "{$repoName}-public"  => "{$directory}",
-                                       "{$repoName}-temp"    => "{$directory}/temp",
-                                       "{$repoName}-thumb"   => $thumbDir,
-                                       "{$repoName}-transcoded"   => $transcodedDir,
+                                       "{$repoName}-public" => "{$directory}",
+                                       "{$repoName}-temp" => "{$directory}/temp",
+                                       "{$repoName}-thumb" => $thumbDir,
+                                       "{$repoName}-transcoded" => $transcodedDir,
                                        "{$repoName}-deleted" => $deletedDir
                                ),
-                               'fileMode'       => $fileMode,
+                               'fileMode' => $fileMode,
                        ) );
                        // Update repo config to use this backend
                        $info['backend'] = $backend;
index 0e30017..cfc3af7 100644 (file)
@@ -67,7 +67,7 @@ class FileRepo {
         */
        public function __construct( array $info = null ) {
                // Verify required settings presence
-               if(
+               if (
                        $info === null
                        || !array_key_exists( 'name', $info )
                        || !array_key_exists( 'backend', $info )
@@ -794,10 +794,10 @@ class FileRepo {
                                }
                        }
                        $operations[] = array(
-                               'op'            => $opName,
-                               'src'           => $srcPath,
-                               'dst'           => $dstPath,
-                               'overwrite'     => $flags & self::OVERWRITE,
+                               'op' => $opName,
+                               'src' => $srcPath,
+                               'dst' => $dstPath,
+                               'overwrite' => $flags & self::OVERWRITE,
                                'overwriteSame' => $flags & self::OVERWRITE_SAME,
                        );
                }
@@ -917,9 +917,9 @@ class FileRepo {
                        $src = $this->resolveToStoragePath( $src );
                        $dst = $this->resolveToStoragePath( $dst );
                        $operations[] = array(
-                               'op'          => FileBackend::isStoragePath( $src ) ? 'copy' : 'store',
-                               'src'         => $src,
-                               'dst'         => $dst,
+                               'op' => FileBackend::isStoragePath( $src ) ? 'copy' : 'store',
+                               'src' => $src,
+                               'dst' => $dst,
                                'disposition' => isset( $triple[2] ) ? $triple[2] : null
                        );
                        $status->merge( $this->initDirectory( dirname( $dst ) ) );
@@ -942,8 +942,8 @@ class FileRepo {
                $operations = array();
                foreach ( $paths as $path ) {
                        $operations[] = array(
-                               'op'                  => 'delete',
-                               'src'                 => $this->resolveToStoragePath( $path ),
+                               'op' => 'delete',
+                               'src' => $this->resolveToStoragePath( $path ),
                                'ignoreMissingSource' => true
                        );
                }
@@ -1132,9 +1132,9 @@ class FileRepo {
                        // race conditions unless an functioning LockManager is used.
                        // LocalFile also uses SELECT FOR UPDATE for synchronization.
                        $operations[] = array(
-                               'op'                  => 'copy',
-                               'src'                 => $dstPath,
-                               'dst'                 => $archivePath,
+                               'op' => 'copy',
+                               'src' => $dstPath,
+                               'dst' => $archivePath,
                                'ignoreMissingSource' => true
                        );
 
@@ -1142,28 +1142,28 @@ class FileRepo {
                        if ( FileBackend::isStoragePath( $srcPath ) ) {
                                if ( $flags & self::DELETE_SOURCE ) {
                                        $operations[] = array(
-                                               'op'        => 'move',
-                                               'src'       => $srcPath,
-                                               'dst'       => $dstPath,
+                                               'op' => 'move',
+                                               'src' => $srcPath,
+                                               'dst' => $dstPath,
                                                'overwrite' => true, // replace current
-                                               'headers'   => $headers
+                                               'headers' => $headers
                                        );
                                } else {
                                        $operations[] = array(
-                                               'op'        => 'copy',
-                                               'src'       => $srcPath,
-                                               'dst'       => $dstPath,
+                                               'op' => 'copy',
+                                               'src' => $srcPath,
+                                               'dst' => $dstPath,
                                                'overwrite' => true, // replace current
-                                               'headers'   => $headers
+                                               'headers' => $headers
                                        );
                                }
                        } else { // FS source path
                                $operations[] = array(
-                                       'op'        => 'store',
-                                       'src'       => $srcPath,
-                                       'dst'       => $dstPath,
+                                       'op' => 'store',
+                                       'src' => $srcPath,
+                                       'dst' => $dstPath,
                                        'overwrite' => true, // replace current
-                                       'headers'   => $headers
+                                       'headers' => $headers
                                );
                                if ( $flags & self::DELETE_SOURCE ) {
                                        $sourceFSFilesToDelete[] = $srcPath;
@@ -1324,9 +1324,9 @@ class FileRepo {
                        }
 
                        $operations[] = array(
-                               'op'            => 'move',
-                               'src'           => $srcPath,
-                               'dst'           => $archivePath,
+                               'op' => 'move',
+                               'src' => $srcPath,
+                               'dst' => $archivePath,
                                // We may have 2+ identical files being deleted,
                                // all of which will map to the same destination file
                                'overwriteSame' => true // also see bug 31792
@@ -1671,29 +1671,29 @@ class FileRepo {
         */
        public function getTempRepo() {
                return new TempFileRepo( array(
-                       'name'      => "{$this->name}-temp",
-                       'backend'   => $this->backend,
-                       'zones'     => array(
+                       'name' => "{$this->name}-temp",
+                       'backend' => $this->backend,
+                       'zones' => array(
                                'public' => array(
                                        'container' => $this->zones['temp']['container'],
                                        'directory' => $this->zones['temp']['directory']
                                ),
-                               'thumb'  => array(
+                               'thumb' => array(
                                        'container' => $this->zones['thumb']['container'],
                                        'directory' => ( $this->zones['thumb']['directory'] == '' )
                                                ? 'temp'
                                                : $this->zones['thumb']['directory'] . '/temp'
                                ),
-                               'transcoded'  => array(
+                               'transcoded' => array(
                                        'container' => $this->zones['transcoded']['container'],
                                        'directory' => ( $this->zones['transcoded']['directory'] == '' )
                                                ? 'temp'
                                                : $this->zones['transcoded']['directory'] . '/temp'
                                )
                        ),
-                       'url'        => $this->getZoneUrl( 'temp' ),
-                       'thumbUrl'   => $this->getZoneUrl( 'thumb' ) . '/temp',
-                       'transcodedUrl'   => $this->getZoneUrl( 'transcoded' ) . '/temp',
+                       'url' => $this->getZoneUrl( 'temp' ),
+                       'thumbUrl' => $this->getZoneUrl( 'thumb' ) . '/temp',
+                       'transcodedUrl' => $this->getZoneUrl( 'transcoded' ) . '/temp',
                        'hashLevels' => $this->hashLevels // performance
                ) );
        }
index ba574da..5cd6fc2 100644 (file)
@@ -61,21 +61,21 @@ class ForeignAPIRepo extends FileRepo {
                // http://commons.wikimedia.org/w/api.php
                $this->mApiBase = isset( $info['apibase'] ) ? $info['apibase'] : null;
 
-               if( isset( $info['apiThumbCacheExpiry'] ) ) {
+               if ( isset( $info['apiThumbCacheExpiry'] ) ) {
                        $this->apiThumbCacheExpiry = $info['apiThumbCacheExpiry'];
                }
-               if( isset( $info['fileCacheExpiry'] ) ) {
+               if ( isset( $info['fileCacheExpiry'] ) ) {
                        $this->fileCacheExpiry = $info['fileCacheExpiry'];
                }
-               if( !$this->scriptDirUrl ) {
+               if ( !$this->scriptDirUrl ) {
                        // hack for description fetches
                        $this->scriptDirUrl = dirname( $this->mApiBase );
                }
                // If we can cache thumbs we can guess sane defaults for these
-               if( $this->canCacheThumbs() && !$this->url ) {
+               if ( $this->canCacheThumbs() && !$this->url ) {
                        $this->url = $wgLocalFileRepo['url'];
                }
-               if( $this->canCacheThumbs() && !$this->thumbUrl ) {
+               if ( $this->canCacheThumbs() && !$this->thumbUrl ) {
                        $this->thumbUrl = $this->url . '/thumb';
                }
        }
@@ -105,7 +105,7 @@ class ForeignAPIRepo extends FileRepo {
                        if ( isset( $this->mFileExists[$k] ) ) {
                                $results[$k] = true;
                                unset( $files[$k] );
-                       } elseif( self::isVirtualUrl( $f ) ) {
+                       } elseif ( self::isVirtualUrl( $f ) ) {
                                # @todo FIXME: We need to be able to handle virtual
                                # URLs better, at least when we know they refer to the
                                # same repo.
@@ -120,9 +120,9 @@ class ForeignAPIRepo extends FileRepo {
 
                $data = $this->fetchImageQuery( array( 'titles' => implode( $files, '|' ),
                                                                                        'prop' => 'imageinfo' ) );
-               if( isset( $data['query']['pages'] ) ) {
+               if ( isset( $data['query']['pages'] ) ) {
                        $i = 0;
-                       foreach( $files as $key => $file ) {
+                       foreach ( $files as $key => $file ) {
                                $results[$key] = $this->mFileExists[$key] = !isset( $data['query']['pages'][$i]['missing'] );
                                $i++;
                        }
@@ -147,8 +147,8 @@ class ForeignAPIRepo extends FileRepo {
 
                $query = array_merge( $query,
                        array(
-                               'format'    => 'json',
-                               'action'    => 'query',
+                               'format' => 'json',
+                               'action' => 'query',
                                'redirects' => 'true'
                        ) );
                if ( $this->mApiBase ) {
@@ -157,10 +157,10 @@ class ForeignAPIRepo extends FileRepo {
                        $url = $this->makeUrl( $query, 'api' );
                }
 
-               if( !isset( $this->mQueryCache[$url] ) ) {
+               if ( !isset( $this->mQueryCache[$url] ) ) {
                        $key = $this->getLocalCacheKey( 'ForeignAPIRepo', 'Metadata', md5( $url ) );
                        $data = $wgMemc->get( $key );
-                       if( !$data ) {
+                       if ( !$data ) {
                                $data = self::httpGet( $url );
                                if ( !$data ) {
                                        return null;
@@ -168,7 +168,7 @@ class ForeignAPIRepo extends FileRepo {
                                $wgMemc->set( $key, $data, 3600 );
                        }
 
-                       if( count( $this->mQueryCache ) > 100 ) {
+                       if ( count( $this->mQueryCache ) > 100 ) {
                                // Keep the cache from growing infinitely
                                $this->mQueryCache = array();
                        }
@@ -182,9 +182,9 @@ class ForeignAPIRepo extends FileRepo {
         * @return bool|array
         */
        function getImageInfo( $data ) {
-               if( $data && isset( $data['query']['pages'] ) ) {
-                       foreach( $data['query']['pages'] as $info ) {
-                               if( isset( $info['imageinfo'][0] ) ) {
+               if ( $data && isset( $data['query']['pages'] ) ) {
+                       foreach ( $data['query']['pages'] as $info ) {
+                               if ( isset( $info['imageinfo'][0] ) ) {
                                        return $info['imageinfo'][0];
                                }
                        }
@@ -198,14 +198,15 @@ class ForeignAPIRepo extends FileRepo {
         */
        function findBySha1( $hash ) {
                $results = $this->fetchImageQuery( array(
-                                                                               'aisha1base36' => $hash,
-                                                                               'aiprop'       => ForeignAPIFile::getProps(),
-                                                                               'list'         => 'allimages', ) );
+                       'aisha1base36' => $hash,
+                       'aiprop' => ForeignAPIFile::getProps(),
+                       'list' => 'allimages',
+               ) );
                $ret = array();
                if ( isset( $results['query']['allimages'] ) ) {
                        foreach ( $results['query']['allimages'] as $img ) {
                                // 1.14 was broken, doesn't return name attribute
-                               if( !isset( $img['name'] ) ) {
+                               if ( !isset( $img['name'] ) ) {
                                        continue;
                                }
                                $ret[] = new ForeignAPIFile( Title::makeTitle( NS_FILE, $img['name'] ), $this, $img );
@@ -228,11 +229,11 @@ class ForeignAPIRepo extends FileRepo {
                        'iiprop' => 'url|timestamp',
                        'iiurlwidth' => $width,
                        'iiurlheight' => $height,
-                       'iiurlparam'  => $otherParams,
+                       'iiurlparam' => $otherParams,
                        'prop' => 'imageinfo' ) );
                $info = $this->getImageInfo( $data );
 
-               if( $data && $info && isset( $info['thumburl'] ) ) {
+               if ( $data && $info && isset( $info['thumburl'] ) ) {
                        wfDebug( __METHOD__ . " got remote thumb " . $info['thumburl'] . "\n" );
                        $result = $info;
                        return $info['thumburl'];
@@ -268,11 +269,11 @@ class ForeignAPIRepo extends FileRepo {
 
                /* Get the array of urls that we already know */
                $knownThumbUrls = $wgMemc->get( $key );
-               if( !$knownThumbUrls ) {
+               if ( !$knownThumbUrls ) {
                        /* No knownThumbUrls for this file */
                        $knownThumbUrls = array();
                } else {
-                       if( isset( $knownThumbUrls[$sizekey] ) ) {
+                       if ( isset( $knownThumbUrls[$sizekey] ) ) {
                                wfDebug( __METHOD__ . ': Got thumburl from local cache: ' .
                                        "{$knownThumbUrls[$sizekey]} \n" );
                                return $knownThumbUrls[$sizekey];
@@ -283,14 +284,14 @@ class ForeignAPIRepo extends FileRepo {
                $metadata = null;
                $foreignUrl = $this->getThumbUrl( $name, $width, $height, $metadata, $params );
 
-               if( !$foreignUrl ) {
+               if ( !$foreignUrl ) {
                        wfDebug( __METHOD__ . " Could not find thumburl\n" );
                        return false;
                }
 
                // We need the same filename as the remote one :)
                $fileName = rawurldecode( pathinfo( $foreignUrl, PATHINFO_BASENAME ) );
-               if( !$this->validateFilename( $fileName ) ) {
+               if ( !$this->validateFilename( $fileName ) ) {
                        wfDebug( __METHOD__ . " The deduced filename $fileName is not safe\n" );
                        return false;
                }
@@ -298,15 +299,14 @@ class ForeignAPIRepo extends FileRepo {
                $localFilename = $localPath . "/" . $fileName;
                $localUrl = $this->getZoneUrl( 'thumb' ) . "/" . $this->getHashPath( $name ) . rawurlencode( $name ) . "/" . rawurlencode( $fileName );
 
-               if( $backend->fileExists( array( 'src' => $localFilename ) )
-                       && isset( $metadata['timestamp'] ) )
-               {
+               if ( $backend->fileExists( array( 'src' => $localFilename ) )
+                       && isset( $metadata['timestamp'] ) ) {
                        wfDebug( __METHOD__ . " Thumbnail was already downloaded before\n" );
                        $modified = $backend->getFileTimestamp( array( 'src' => $localFilename ) );
                        $remoteModified = strtotime( $metadata['timestamp'] );
                        $current = time();
                        $diff = abs( $modified - $current );
-                       if( $remoteModified < $modified && $diff < $this->fileCacheExpiry ) {
+                       if ( $remoteModified < $modified && $diff < $this->fileCacheExpiry ) {
                                /* Use our current and already downloaded thumbnail */
                                $knownThumbUrls[$sizekey] = $localUrl;
                                $wgMemc->set( $key, $knownThumbUrls, $this->apiThumbCacheExpiry );
@@ -315,7 +315,7 @@ class ForeignAPIRepo extends FileRepo {
                        /* There is a new Commons file, or existing thumbnail older than a month */
                }
                $thumb = self::httpGet( $foreignUrl );
-               if( !$thumb ) {
+               if ( !$thumb ) {
                        wfDebug( __METHOD__ . " Could not download thumb\n" );
                        return false;
                }
@@ -323,7 +323,7 @@ class ForeignAPIRepo extends FileRepo {
                # @todo FIXME: Delete old thumbs that aren't being used. Maintenance script?
                $backend->prepare( array( 'dir' => dirname( $localFilename ) ) );
                $params = array( 'dst' => $localFilename, 'content' => $thumb );
-               if( !$backend->quickCreate( $params )->isOK() ) {
+               if ( !$backend->quickCreate( $params )->isOK() ) {
                        wfDebug( __METHOD__ . " could not write to thumb path '$localFilename'\n" );
                        return $foreignUrl;
                }
index 1865985..ecad618 100644 (file)
@@ -59,7 +59,7 @@ class ForeignDBRepo extends LocalRepo {
                        $this->dbConn = DatabaseBase::factory( $this->dbType,
                                array(
                                        'host' => $this->dbServer,
-                                       'user'   => $this->dbUser,
+                                       'user' => $this->dbUser,
                                        'password' => $this->dbPassword,
                                        'dbname' => $this->dbName,
                                        'flags' => $this->dbFlags,
index d017e13..549be40 100644 (file)
@@ -176,7 +176,7 @@ class LocalRepo extends FileRepo {
                } // else $cachedValue is false or null: cache miss
 
                $id = $this->getArticleID( $title );
-               if( !$id ) {
+               if ( !$id ) {
                        $wgMemc->set( $memcKey, " ", $expiry );
                        return false;
                }
@@ -188,7 +188,7 @@ class LocalRepo extends FileRepo {
                        __METHOD__
                );
 
-               if( $row && $row->rd_namespace == NS_FILE ) {
+               if ( $row && $row->rd_namespace == NS_FILE ) {
                        $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
                        $wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry );
                        return $targetTitle;
@@ -206,7 +206,7 @@ class LocalRepo extends FileRepo {
         * @return bool|int|mixed
         */
        protected function getArticleID( $title ) {
-               if( !$title instanceof Title ) {
+               if ( !$title instanceof Title ) {
                        return 0;
                }
                $dbr = $this->getSlaveDB();
@@ -258,7 +258,7 @@ class LocalRepo extends FileRepo {
         * @return array An Array of arrays or iterators of file objects and the hash as key
         */
        function findBySha1s( array $hashes ) {
-               if( !count( $hashes ) ) {
+               if ( !count( $hashes ) ) {
                        return array(); //empty parameter
                }
 
index 02dfdad..b2b9477 100644 (file)
@@ -209,7 +209,7 @@ class RepoGroup {
                }
 
                $redir = $this->localRepo->checkRedirect( $title );
-               if( $redir ) {
+               if ( $redir ) {
                        return $redir;
                }
                foreach ( $this->foreignRepos as $repo ) {
@@ -238,7 +238,9 @@ class RepoGroup {
                if ( !$file ) {
                        foreach ( $this->foreignRepos as $repo ) {
                                $file = $repo->findFileFromKey( $hash, $options );
-                               if ( $file ) break;
+                               if ( $file ) {
+                                       break;
+                               }
                        }
                }
                return $file;
@@ -279,7 +281,7 @@ class RepoGroup {
                        $result = array_merge_recursive( $result, $repo->findBySha1s( $hashes ) );
                }
                //sort the merged (and presorted) sublist of each hash
-               foreach( $result as $hash => $files ) {
+               foreach ( $result as $hash => $files ) {
                        usort( $result[$hash], 'File::compare' );
                }
                return $result;
@@ -339,9 +341,9 @@ class RepoGroup {
         * @return bool
         */
        function forEachForeignRepo( $callback, $params = array() ) {
-               foreach( $this->foreignRepos as $repo ) {
+               foreach ( $this->foreignRepos as $repo ) {
                        $args = array_merge( array( $repo ), $params );
-                       if( call_user_func_array( $callback, $args ) ) {
+                       if ( call_user_func_array( $callback, $args ) ) {
                                return true;
                        }
                }
index 3f78619..b753e18 100644 (file)
@@ -90,7 +90,7 @@ class ArchivedFile {
                $this->exists = false;
                $this->sha1 = '';
 
-               if( $title instanceof Title ) {
+               if ( $title instanceof Title ) {
                        $this->title = File::normalizeTitle( $title, 'exception' );
                        $this->name = $title->getDBkey();
                }
@@ -119,22 +119,22 @@ class ArchivedFile {
                }
                $conds = array();
 
-               if( $this->id > 0 ) {
+               if ( $this->id > 0 ) {
                        $conds['fa_id'] = $this->id;
                }
-               if( $this->key ) {
+               if ( $this->key ) {
                        $conds['fa_storage_group'] = $this->group;
                        $conds['fa_storage_key'] = $this->key;
                }
-               if( $this->title ) {
+               if ( $this->title ) {
                        $conds['fa_name'] = $this->title->getDBkey();
                }
 
-               if( !count( $conds ) ) {
+               if ( !count( $conds ) ) {
                        throw new MWException( "No specific information for retrieving archived file" );
                }
 
-               if( !$this->title || $this->title->getNamespace() == NS_FILE ) {
+               if ( !$this->title || $this->title->getNamespace() == NS_FILE ) {
                        $this->dataLoaded = true; // set it here, to have also true on miss
                        $dbr = wfGetDB( DB_SLAVE );
                        $row = $dbr->selectRow(
@@ -224,7 +224,7 @@ class ArchivedFile {
                $this->user_text = $row->fa_user_text;
                $this->timestamp = $row->fa_timestamp;
                $this->deleted = $row->fa_deleted;
-               if( isset( $row->fa_sha1 ) ) {
+               if ( isset( $row->fa_sha1 ) ) {
                        $this->sha1 = $row->fa_sha1;
                } else {
                        // old row, populate from key
@@ -409,7 +409,7 @@ class ArchivedFile {
         */
        public function getUser() {
                $this->load();
-               if( $this->isDeleted( File::DELETED_USER ) ) {
+               if ( $this->isDeleted( File::DELETED_USER ) ) {
                        return 0;
                } else {
                        return $this->user;
@@ -423,7 +423,7 @@ class ArchivedFile {
         */
        public function getUserText() {
                $this->load();
-               if( $this->isDeleted( File::DELETED_USER ) ) {
+               if ( $this->isDeleted( File::DELETED_USER ) ) {
                        return 0;
                } else {
                        return $this->user_text;
@@ -437,7 +437,7 @@ class ArchivedFile {
         */
        public function getDescription() {
                $this->load();
-               if( $this->isDeleted( File::DELETED_COMMENT ) ) {
+               if ( $this->isDeleted( File::DELETED_COMMENT ) ) {
                        return 0;
                } else {
                        return $this->description;
index 255da17..0da4036 100644 (file)
@@ -201,9 +201,9 @@ abstract class File {
                        'mpeg' => 'mpg',
                        'tiff' => 'tif',
                        'ogv' => 'ogg' );
-               if( isset( $squish[$lower] ) ) {
+               if ( isset( $squish[$lower] ) ) {
                        return $squish[$lower];
-               } elseif( preg_match( '/^[0-9a-z]+$/', $lower ) ) {
+               } elseif ( preg_match( '/^[0-9a-z]+$/', $lower ) ) {
                        return $lower;
                } else {
                        return '';
@@ -241,7 +241,7 @@ abstract class File {
         * @return array ("text", "html") etc
         */
        public static function splitMime( $mime ) {
-               if( strpos( $mime, '/' ) !== false ) {
+               if ( strpos( $mime, '/' ) !== false ) {
                        return explode( '/', $mime, 2 );
                } else {
                        return array( $mime, 'unknown' );
index edf623e..61d321e 100644 (file)
@@ -54,22 +54,22 @@ class ForeignAPIFile extends File {
         */
        static function newFromTitle( Title $title, $repo ) {
                $data = $repo->fetchImageQuery( array(
-                       'titles'            => 'File:' . $title->getDBkey(),
-                       'iiprop'            => self::getProps(),
-                       'prop'              => 'imageinfo',
+                       'titles' => 'File:' . $title->getDBkey(),
+                       'iiprop' => self::getProps(),
+                       'prop' => 'imageinfo',
                        'iimetadataversion' => MediaHandler::getMetadataVersion()
                ) );
 
                $info = $repo->getImageInfo( $data );
 
-               if( $info ) {
+               if ( $info ) {
                        $lastRedirect = isset( $data['query']['redirects'] )
                                ? count( $data['query']['redirects'] ) - 1
                                : -1;
-                       if( $lastRedirect >= 0 ) {
+                       if ( $lastRedirect >= 0 ) {
                                $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to'] );
                                $img = new self( $newtitle, $repo, $info, true );
-                               if( $img ) {
+                               if ( $img ) {
                                        $img->redirectedFrom( $title->getDBkey() );
                                }
                        } else {
@@ -111,7 +111,7 @@ class ForeignAPIFile extends File {
         * @return bool|MediaTransformOutput
         */
        function transform( $params, $flags = 0 ) {
-               if( !$this->canRender() ) {
+               if ( !$this->canRender() ) {
                        // show icon
                        return parent::transform( $params, $flags );
                }
@@ -161,11 +161,11 @@ class ForeignAPIFile extends File {
         * @return array
         */
        public static function parseMetadata( $metadata ) {
-               if( !is_array( $metadata ) ) {
+               if ( !is_array( $metadata ) ) {
                        return $metadata;
                }
                $ret = array();
-               foreach( $metadata as $meta ) {
+               foreach ( $metadata as $meta ) {
                        $ret[$meta['name']] = self::parseMetadata( $meta['value'] );
                }
                return $ret;
@@ -224,7 +224,7 @@ class ForeignAPIFile extends File {
         * @return string
         */
        function getMimeType() {
-               if( !isset( $this->mInfo['mime'] ) ) {
+               if ( !isset( $this->mInfo['mime'] ) ) {
                        $magic = MimeMagic::singleton();
                        $this->mInfo['mime'] = $magic->guessTypesForExtension( $this->getExtension() );
                }
index b481e83..8bd8376 100644 (file)
@@ -532,15 +532,15 @@ class LocalFile extends File {
 
                $dbw->update( 'image',
                        array(
-                               'img_size'       => $this->size, // sanity
-                               'img_width'      => $this->width,
-                               'img_height'     => $this->height,
-                               'img_bits'       => $this->bits,
+                               'img_size' => $this->size, // sanity
+                               'img_width' => $this->width,
+                               'img_height' => $this->height,
+                               'img_bits' => $this->bits,
                                'img_media_type' => $this->media_type,
                                'img_major_mime' => $major,
                                'img_minor_mime' => $minor,
-                               'img_metadata'   => $this->metadata,
-                               'img_sha1'       => $this->sha1,
+                               'img_metadata' => $this->metadata,
+                               'img_sha1' => $this->sha1,
                        ),
                        array( 'img_name' => $this->getName() ),
                        __METHOD__
@@ -803,7 +803,7 @@ class LocalFile extends File {
                $oldKey = $this->repo->getSharedCacheKey( 'oldfile', $hashedName );
 
                // Must purge thumbnails for old versions too! bug 30192
-               foreach( $this->getHistory() as $oldFile ) {
+               foreach ( $this->getHistory() as $oldFile ) {
                        $oldFile->purgeThumbnails();
                }
 
@@ -845,7 +845,7 @@ class LocalFile extends File {
                // Purge the squid
                if ( $wgUseSquid ) {
                        $urls = array();
-                       foreach( $files as $file ) {
+                       foreach ( $files as $file ) {
                                $urls[] = $this->getArchiveThumbUrl( $archiveName, $file );
                        }
                        SquidUpdate::purge( $urls );
@@ -866,7 +866,7 @@ class LocalFile extends File {
                // Always purge all files from squid regardless of handler filters
                if ( $wgUseSquid ) {
                        $urls = array();
-                       foreach( $files as $file ) {
+                       foreach ( $files as $file ) {
                                $urls[] = $this->getThumbUrl( $file );
                        }
                        array_shift( $urls ); // don't purge directory
@@ -1196,20 +1196,20 @@ class LocalFile extends File {
                # doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
                $dbw->insert( 'image',
                        array(
-                               'img_name'        => $this->getName(),
-                               'img_size'        => $this->size,
-                               'img_width'       => intval( $this->width ),
-                               'img_height'      => intval( $this->height ),
-                               'img_bits'        => $this->bits,
-                               'img_media_type'  => $this->media_type,
-                               'img_major_mime'  => $this->major_mime,
-                               'img_minor_mime'  => $this->minor_mime,
-                               'img_timestamp'   => $timestamp,
+                               'img_name' => $this->getName(),
+                               'img_size' => $this->size,
+                               'img_width' => intval( $this->width ),
+                               'img_height' => intval( $this->height ),
+                               'img_bits' => $this->bits,
+                               'img_media_type' => $this->media_type,
+                               'img_major_mime' => $this->major_mime,
+                               'img_minor_mime' => $this->minor_mime,
+                               'img_timestamp' => $timestamp,
                                'img_description' => $comment,
-                               'img_user'        => $user->getId(),
-                               'img_user_text'   => $user->getName(),
-                               'img_metadata'    => $this->metadata,
-                               'img_sha1'        => $this->sha1
+                               'img_user' => $user->getId(),
+                               'img_user_text' => $user->getName(),
+                               'img_metadata' => $this->metadata,
+                               'img_sha1' => $this->sha1
                        ),
                        __METHOD__,
                        'IGNORE'
@@ -1602,9 +1602,13 @@ class LocalFile extends File {
         */
        function getDescriptionText() {
                $revision = Revision::newFromTitle( $this->title, false, Revision::READ_NORMAL );
-               if ( !$revision ) return false;
+               if ( !$revision ) {
+                       return false;
+               }
                $content = $revision->getContent();
-               if ( !$content ) return false;
+               if ( !$content ) {
+                       return false;
+               }
                $pout = $content->getParserOutput( $this->title, null, new ParserOptions() );
                return $pout->getText();
        }
@@ -2174,7 +2178,7 @@ class LocalFileRestoreBatch {
                        $deletedRel = $this->file->repo->getDeletedHashPath( $row->fa_storage_key ) . $row->fa_storage_key;
                        $deletedUrl = $this->file->repo->getVirtualUrl() . '/deleted/' . $deletedRel;
 
-                       if( isset( $row->fa_sha1 ) ) {
+                       if ( isset( $row->fa_sha1 ) ) {
                                $sha1 = $row->fa_sha1;
                        } else {
                                // old row, populate from key
index bb7e877..e3bcb6f 100644 (file)
@@ -114,7 +114,7 @@ class CliInstaller extends Installer {
         */
        public function execute() {
                $vars = Installer::getExistingLocalSettings();
-               if( $vars ) {
+               if ( $vars ) {
                        $this->showStatusMessage(
                                Status::newFatal( "config-localsettings-cli-upgrade" )
                        );
index cd14e4e..13d5d42 100644 (file)
@@ -173,7 +173,7 @@ abstract class DatabaseInstaller {
                }
                $this->db->selectDB( $this->getVar( 'wgDBname' ) );
 
-               if( $this->db->tableExists( 'archive', __METHOD__ ) ) {
+               if ( $this->db->tableExists( 'archive', __METHOD__ ) ) {
                        $status->warning( 'config-install-tables-exist' );
                        $this->enableLB();
                        return $status;
@@ -183,7 +183,7 @@ abstract class DatabaseInstaller {
                $this->db->begin( __METHOD__ );
 
                $error = $this->db->sourceFile( $this->db->getSchemaPath() );
-               if( $error !== true ) {
+               if ( $error !== true ) {
                        $this->db->reportQueryError( $error, 0, '', __METHOD__ );
                        $this->db->rollback( __METHOD__ );
                        $status->fatal( 'config-install-tables-failed', $error );
@@ -191,7 +191,7 @@ abstract class DatabaseInstaller {
                        $this->db->commit( __METHOD__ );
                }
                // Resume normal operations
-               if( $status->isOk() ) {
+               if ( $status->isOk() ) {
                        $this->enableLB();
                }
                return $status;
@@ -569,7 +569,7 @@ abstract class DatabaseInstaller {
                        $this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
                }
 
-               if( $this->getVar( '_CreateDBAccount' ) && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
+               if ( $this->getVar( '_CreateDBAccount' ) && strval( $this->getVar( 'wgDBpassword' ) ) == '' ) {
                        return Status::newFatal( 'config-db-password-empty', $this->getVar( 'wgDBuser' ) );
                }
 
@@ -588,7 +588,7 @@ abstract class DatabaseInstaller {
                }
                $this->db->selectDB( $this->getVar( 'wgDBname' ) );
 
-               if( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) {
+               if ( $this->db->selectRow( 'interwiki', '*', array(), __METHOD__ ) ) {
                        $status->warning( 'config-install-interwiki-exists' );
                        return $status;
                }
@@ -601,9 +601,11 @@ abstract class DatabaseInstaller {
                if ( !$rows ) {
                        return Status::newFatal( 'config-install-interwiki-list' );
                }
-               foreach( $rows as $row ) {
+               foreach ( $rows as $row ) {
                        $row = preg_replace( '/^\s*([^#]*?)\s*(#.*)?$/', '\\1', $row ); // strip comments - whee
-                       if ( $row == "" ) continue;
+                       if ( $row == "" ) {
+                               continue;
+                       }
                        $row .= "||";
                        $interwikis[] = array_combine(
                                array( 'iw_prefix', 'iw_url', 'iw_local', 'iw_api', 'iw_wikiid' ),
index 3a9d82d..c2b74f9 100644 (file)
@@ -11713,7 +11713,6 @@ Donn Ding Daatebangk et beß janz woh anders hen, noh <code lang="en">/var/lib/m
        'config-type-postgres' => '<i lang="en">PostgreSQL</i>',
        'config-type-sqlite' => '<i lang="en">SQLite</i>',
        'config-type-oracle' => '<i lang="en">Oracle</i>',
-       'config-type-ibm_db2' => 'Dä <i lang="en">IBM</i> ier <i lang="en">DB2</i>',
        'config-support-info' => 'MediaWiki kann met heh dä Daatebangk_Süßteeme zosamme jonn:
 
 $1
@@ -11723,12 +11722,10 @@ Wann dat Daatebangk_Süßteem, wat De nämme wells, onge nit dobei es, dann donn
        'config-support-postgres' => '* <i lang="en">$1</i> es e bikannt Daatebangksüßteem met offe Quälltäxde, un en och en Wahl nävve <i lang="en">MySQL</i> ([http://www.php.net/manual/de/pgsql.installation.php Aanleidung för et Övversäze un Enreeschte von PHP met <i lang="en">PostgreSQL</i> dobei, op Deutsch]) Et sinn_er ävver paa klein Fählershe bekannt, um kunne dat em Momang för et reschtijje Werke nit emfähle.',
        'config-support-sqlite' => '* <i lang="en">$1</i> es e eijfach Daatebangksüßteem, wat joot ongershtöz weed. ([http://www.php.net/manual/de/pdo.installation.php Aanleidong för et Övversäze un Enreeschte von PHP met <i lang="en">SQLite</i> dobei, op Deutsch])',
        'config-support-oracle' => '* <i lang="en">$1</i> es e jeschäfflesch Daatebangksüßteem för Ferme. ([http://www.php.net/manual/de/oci8.installation.php Aanleidong för et Övversäze un Enreeschte von PHP met <i lang="en">OCI8</i> dobei, op Deutsch])',
-       'config-support-ibm_db2' => '* $1 es en Datebengk för et Jeschäff un fö Ongernehme.', # Fuzzy
        'config-header-mysql' => 'De Enshtällunge för de <i lang="en">MySQL</i> Daatebangk',
        'config-header-postgres' => 'De Enshtällunge för de <i lang="en">PostgreSQL</i> Daatebangk',
        'config-header-sqlite' => 'De Enshtällunge för de <i lang="en">SQLite</i> Daatebangk',
        'config-header-oracle' => 'De Enshtällunge för de <i lang="en">Oracle</i> Daatebangk',
-       'config-header-ibm_db2' => 'De Enshtällunge för de <i lang="en">IBM</i> ier <i lang="en">DB2</i>',
        'config-invalid-db-type' => 'Dat es en onjöltijje Zoot Daatebangk.',
        'config-missing-db-name' => 'Do moß jät enjävve för dä Name vun dä Daatebangk.',
        'config-missing-db-host' => 'Do moß jät enjävve för dä Name vun däm Rääschner met dä Daatebangk.',
@@ -11817,7 +11814,6 @@ Dat es flöcker un spaasaamer wi et UTF-8 Fommaat vum <i lang=\"en\">MySQL</i> u
 
 Beim Shpeishere em '''UTF-8 Fomaat''' deiht et <i lang=\"en\">MySQL</i> der Zeishesaz un de Kodeerung vun dä Daate känne, un kann se akeraat aanzeije un ömwandelle,
 allerdengs künne kein Zeishe ußerhalv vum [//de.wikipedia.org/wiki/Basic_Multilingual_Plane#Gliederung_in_Ebenen_und_Bl.C3.B6cke jrundlääje Knubbel för vill Shprooche (<i lang=\"en\">Basic Multilingual Plane — BMP</i>)] afjeshpeishert wääde.",
-       'config-ibm_db2-low-db-pagesize' => "De <i lang=\"en\">DB2</i> Daatebangk heh hät ene standattmääßeje Plaz för Tabälle met zoh klein Sigge. Dä Plaz en de Sigge moß '''32K''' udder mieh sin.",
        'config-site-name' => 'Däm Wiki singe Name:',
        'config-site-name-help' => 'Dä douch em Tittel vun de Brauserfinstere un aan ätlije andere Shtälle op.',
        'config-site-name-blank' => 'Donn ene Name för di Sait aanjävve.',
@@ -11927,7 +11923,7 @@ Et bäß es, wam_mer vum <i lang="en">world wide web</i> doh nit drahn kumme kan
        'config-logo-help' => 'De Schtandart_Bedeen_Bovverfläsch vum MediaWiki hät e Logo bovve en der Eck met 135x160 Pixele.
 Donn e zopaß Logo huh laade, un donn däm sing URL heh endraare.
 
-Wells De kei Logo han, draach heh nix en.',
+Wells De kei Logo han, draach heh nix en.', # Fuzzy
        'config-instantcommons' => 'Donn <i lang="en">InstantCommons</i> zohlohße.',
        'config-instantcommons-help' => '<i lang="en">[//www.mediawiki.org/wiki/InstantCommons InstantCommons]</i> es en Eijeschaff, di et för Wikis müjjelesch määt, Belder, Tondatteie un ander Meedijedatteie enzebenge, di op dä Webßait vun de <i lang="en">[//commons.wikimedia.org/ Wikimedia Commons]</i> ongerjebraat sin. Öm dat noze ze künne, moß dä ẞööver vum MediaWiki en Verbendung nohm Internet opnämme künne.
 
@@ -11953,7 +11949,7 @@ Se sullte ein pro Reih opjeschrevve sin, un en Pooz (<i lang="en">port</i>) ier
        'config-memcache-noport' => 'Do has kein Pooz (<code lang="en">port</code>) Nommer aanjejovve för mem <code lang="en">memcached</code> ẞööver ze bruche: $1.
 Wann De di Nommer nit weiß, der Shtandatt es 11211.',
        'config-memcache-badport' => 'Dem <code lang="en">memcached</code> ẞööver singe Pooz (<code lang="en">port</code>) Nommere sullte zwesche $1 un $2 sin.',
-       'config-extensions' => 'Projramm-Zosätz (<i lang="en">extensions</i>)',
+       'config-extensions' => 'Projramm-Zohsäz (<i lang="en">Extensions</i>)',
        'config-extensions-help' => 'Di bovve opjeleß Zohsazprojramme för et MediaWiki sin em Verzeischneß <code lang="en">./extensions</code> ald ze fenge.
 
 Do kann se heh un jez aanschallde, ävver se künnte noch zohsäzlesch Enshtellunge bruche.',
index 6a7970b..35a546c 100644 (file)
@@ -401,7 +401,7 @@ abstract class Installer {
         */
        public function doEnvironmentChecks() {
                $phpVersion = phpversion();
-               if( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
+               if ( version_compare( $phpVersion, self::MINIMUM_PHP_VERSION, '>=' ) ) {
                        $this->showMessage( 'config-env-php', $phpVersion );
                        $good = true;
                } else {
@@ -409,7 +409,7 @@ abstract class Installer {
                        $good = false;
                }
 
-               if( $good ) {
+               if ( $good ) {
                        foreach ( $this->envChecks as $check ) {
                                $status = $this->$check();
                                if ( $status === false ) {
@@ -486,7 +486,7 @@ abstract class Installer {
                $_lsExists = file_exists( "$IP/LocalSettings.php" );
                wfRestoreWarnings();
 
-               if( !$_lsExists ) {
+               if ( !$_lsExists ) {
                        return false;
                }
                unset( $_lsExists );
@@ -684,7 +684,7 @@ abstract class Installer {
         * Environment check for register_globals.
         */
        protected function envCheckRegisterGlobals() {
-               if( wfIniGetBool( 'register_globals' ) ) {
+               if ( wfIniGetBool( 'register_globals' ) ) {
                        $this->showMessage( 'config-register-globals' );
                }
        }
@@ -722,7 +722,7 @@ abstract class Installer {
         * @return bool
         */
        protected function envCheckMagicQuotes() {
-               if( wfIniGetBool( "magic_quotes_runtime" ) ) {
+               if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
                        $this->showError( 'config-magic-quotes-runtime' );
                        return false;
                }
@@ -830,10 +830,10 @@ abstract class Installer {
 
                $n = wfShorthandToInteger( $limit );
 
-               if( $n < $this->minMemorySize * 1024 * 1024 ) {
+               if ( $n < $this->minMemorySize * 1024 * 1024 ) {
                        $newLimit = "{$this->minMemorySize}M";
 
-                       if( ini_set( "memory_limit", $newLimit ) === false ) {
+                       if ( ini_set( "memory_limit", $newLimit ) === false ) {
                                $this->showMessage( 'config-memory-bad', $limit );
                        } else {
                                $this->showMessage( 'config-memory-raised', $limit, $newLimit );
@@ -1082,7 +1082,7 @@ abstract class Installer {
        protected function envCheckSuhosinMaxValueLength() {
                $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
                if ( $maxValueLength > 0 ) {
-                       if( $maxValueLength < 1024 ) {
+                       if ( $maxValueLength < 1024 ) {
                                # Only warn if the value is below the sane 1024
                                $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
                        }
@@ -1140,14 +1140,14 @@ abstract class Installer {
                 * We're going to prefer the pecl extension here unless
                 * utf8_normalize is more up to date.
                 */
-               if( $utf8 ) {
+               if ( $utf8 ) {
                        $useNormalizer = 'utf8';
                        $utf8 = utf8_normalize( $not_normal_c, UtfNormal::UNORM_NFC );
                        if ( $utf8 !== $normal_c ) {
                                $needsUpdate = true;
                        }
                }
-               if( $intl ) {
+               if ( $intl ) {
                        $useNormalizer = 'intl';
                        $intl = normalizer_normalize( $not_normal_c, Normalizer::FORM_C );
                        if ( $intl !== $normal_c ) {
@@ -1156,11 +1156,11 @@ abstract class Installer {
                }
 
                // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl'
-               if( $useNormalizer === 'php' ) {
+               if ( $useNormalizer === 'php' ) {
                        $this->showMessage( 'config-unicode-pure-php-warning' );
                } else {
                        $this->showMessage( 'config-unicode-using-' . $useNormalizer );
-                       if( $needsUpdate ) {
+                       if ( $needsUpdate ) {
                                $this->showMessage( 'config-unicode-update-warning' );
                        }
                }
@@ -1243,9 +1243,9 @@ abstract class Installer {
         * @return bool|string
         */
        public static function locateExecutableInDefaultPaths( $names, $versionInfo = false ) {
-               foreach( self::getPossibleBinPaths() as $path ) {
+               foreach ( self::getPossibleBinPaths() as $path ) {
                        $exe = self::locateExecutable( $path, $names, $versionInfo );
-                       if( $exe !== false ) {
+                       if ( $exe !== false ) {
                                return $exe;
                        }
                }
@@ -1344,7 +1344,7 @@ abstract class Installer {
         * @return array
         */
        public function findExtensions() {
-               if( $this->getVar( 'IP' ) === null ) {
+               if ( $this->getVar( 'IP' ) === null ) {
                        return array();
                }
 
@@ -1356,10 +1356,10 @@ abstract class Installer {
                $dh = opendir( $extDir );
                $exts = array();
                while ( ( $file = readdir( $dh ) ) !== false ) {
-                       if( !is_dir( "$extDir/$file" ) ) {
+                       if ( !is_dir( "$extDir/$file" ) ) {
                                continue;
                        }
-                       if( file_exists( "$extDir/$file/$file.php" ) ) {
+                       if ( file_exists( "$extDir/$file/$file.php" ) ) {
                                $exts[] = $file;
                        }
                }
@@ -1392,7 +1392,7 @@ abstract class Installer {
 
                require( "$IP/includes/DefaultSettings.php" );
 
-               foreach( $exts as $e ) {
+               foreach ( $exts as $e ) {
                        require_once( "$IP/extensions/$e/$e.php" );
                }
 
@@ -1431,9 +1431,9 @@ abstract class Installer {
 
                // Build the array of install steps starting from the core install list,
                // then adding any callbacks that wanted to attach after a given step
-               foreach( $coreInstallSteps as $step ) {
+               foreach ( $coreInstallSteps as $step ) {
                        $this->installSteps[] = $step;
-                       if( isset( $this->extraInstallSteps[$step['name']] ) ) {
+                       if ( isset( $this->extraInstallSteps[$step['name']] ) ) {
                                $this->installSteps = array_merge(
                                        $this->installSteps,
                                        $this->extraInstallSteps[$step['name']]
@@ -1442,7 +1442,7 @@ abstract class Installer {
                }
 
                // Prepend any steps that want to be at the beginning
-               if( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
+               if ( isset( $this->extraInstallSteps['BEGINNING'] ) ) {
                        $this->installSteps = array_merge(
                                $this->extraInstallSteps['BEGINNING'],
                                $this->installSteps
@@ -1450,7 +1450,7 @@ abstract class Installer {
                }
 
                // Extensions should always go first, chance to tie into hooks and such
-               if( count( $this->getVar( '_Extensions' ) ) ) {
+               if ( count( $this->getVar( '_Extensions' ) ) ) {
                        array_unshift( $this->installSteps,
                                array( 'name' => 'extensions', 'callback' => array( $this, 'includeExtensions' ) )
                        );
@@ -1475,7 +1475,7 @@ abstract class Installer {
                $installer = $this->getDBInstaller();
                $installer->preInstall();
                $steps = $this->getInstallSteps( $installer );
-               foreach( $steps as $stepObj ) {
+               foreach ( $steps as $stepObj ) {
                        $name = $stepObj['name'];
                        call_user_func_array( $startCB, array( $name ) );
 
@@ -1488,11 +1488,11 @@ abstract class Installer {
 
                        // If we've hit some sort of fatal, we need to bail.
                        // Callback already had a chance to do output above.
-                       if( !$status->isOk() ) {
+                       if ( !$status->isOk() ) {
                                break;
                        }
                }
-               if( $status->isOk() ) {
+               if ( $status->isOk() ) {
                        $this->setVar( '_InstallDone', true );
                }
                return $installResults;
@@ -1566,7 +1566,7 @@ abstract class Installer {
 
                        $user->addGroup( 'sysop' );
                        $user->addGroup( 'bureaucrat' );
-                       if( $this->getVar( '_AdminEmail' ) ) {
+                       if ( $this->getVar( '_AdminEmail' ) ) {
                                $user->setEmail( $this->getVar( '_AdminEmail' ) );
                        }
                        $user->saveSettings();
@@ -1577,7 +1577,7 @@ abstract class Installer {
                }
                $status = Status::newGood();
 
-               if( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
+               if ( $this->getVar( '_Subscribe' ) && $this->getVar( '_AdminEmail' ) ) {
                        $this->subscribeToMediaWikiAnnounce( $status );
                }
 
@@ -1589,23 +1589,23 @@ abstract class Installer {
         */
        private function subscribeToMediaWikiAnnounce( Status $s ) {
                $params = array(
-                       'email'    => $this->getVar( '_AdminEmail' ),
+                       'email' => $this->getVar( '_AdminEmail' ),
                        'language' => 'en',
-                       'digest'   => 0
+                       'digest' => 0
                );
 
                // Mailman doesn't support as many languages as we do, so check to make
                // sure their selected language is available
                $myLang = $this->getVar( '_UserLang' );
-               if( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
+               if ( in_array( $myLang, $this->mediaWikiAnnounceLanguages ) ) {
                        $myLang = $myLang == 'pt-br' ? 'pt_BR' : $myLang; // rewrite to Mailman's pt_BR
                        $params['language'] = $myLang;
                }
 
-               if( MWHttpRequest::canMakeRequests() ) {
+               if ( MWHttpRequest::canMakeRequests() ) {
                        $res = MWHttpRequest::factory( $this->mediaWikiAnnounceUrl,
                                array( 'method' => 'POST', 'postData' => $params ) )->execute();
-                       if( !$res->isOK() ) {
+                       if ( !$res->isOK() ) {
                                $s->warning( 'config-install-subscribe-fail', $res->getMessage() );
                        }
                } else {
index c9ebc7e..d3dfc83 100644 (file)
@@ -73,10 +73,10 @@ class LocalSettingsGenerator {
                        'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgEnableUploads', 'wgUseInstantCommons'
                );
 
-               foreach( $confItems as $c ) {
+               foreach ( $confItems as $c ) {
                        $val = $installer->getVar( $c );
 
-                       if( in_array( $c, $boolItems ) ) {
+                       if ( in_array( $c, $boolItems ) ) {
                                $val = wfBoolToStr( $val );
                        }
 
@@ -136,13 +136,13 @@ class LocalSettingsGenerator {
        public function getText() {
                $localSettings = $this->getDefaultText();
 
-               if( count( $this->extensions ) ) {
+               if ( count( $this->extensions ) ) {
                        $localSettings .= "
 # Enabled Extensions. Most extensions are enabled by including the base extension file here
 # but check specific extension documentation for more details
 # The following extensions were automatically enabled:\n";
 
-                       foreach( $this->extensions as $extName ) {
+                       foreach ( $this->extensions as $extName ) {
                                $encExtName = self::escapePhpString( $extName );
                                $localSettings .= "require_once( \"\$IP/extensions/$encExtName/$encExtName.php\" );\n";
                        }
@@ -169,13 +169,13 @@ class LocalSettingsGenerator {
        protected function buildMemcachedServerList() {
                $servers = $this->values['_MemCachedServers'];
 
-               if( !$servers ) {
+               if ( !$servers ) {
                        return 'array()';
                } else {
                        $ret = 'array( ';
                        $servers = explode( ',', $servers );
 
-                       foreach( $servers as $srv ) {
+                       foreach ( $servers as $srv ) {
                                $srv = trim( $srv );
                                $ret .= "'$srv', ";
                        }
@@ -188,14 +188,14 @@ class LocalSettingsGenerator {
         * @return String
         */
        protected function getDefaultText() {
-               if( !$this->values['wgImageMagickConvertCommand'] ) {
+               if ( !$this->values['wgImageMagickConvertCommand'] ) {
                        $this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert';
                        $magic = '#';
                } else {
                        $magic = '';
                }
 
-               if( !$this->values['wgShellLocale'] ) {
+               if ( !$this->values['wgShellLocale'] ) {
                        $this->values['wgShellLocale'] = 'en_US.UTF-8';
                        $locale = '#';
                } else {
@@ -205,16 +205,16 @@ class LocalSettingsGenerator {
                //$rightsUrl = $this->values['wgRightsUrl'] ? '' : '#'; // TODO: Fixme, I'm unused!
                $hashedUploads = $this->safeMode ? '' : '#';
                $metaNamespace = '';
-               if( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
+               if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
                        $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n";
                }
 
                $groupRights = '';
-               if( $this->groupPermissions ) {
+               if ( $this->groupPermissions ) {
                        $groupRights .= "# The following permissions were set based on your choice in the installer\n";
-                       foreach( $this->groupPermissions as $group => $rightArr ) {
+                       foreach ( $this->groupPermissions as $group => $rightArr ) {
                                $group = self::escapePhpString( $group );
-                               foreach( $rightArr as $right => $perm ) {
+                               foreach ( $rightArr as $right => $perm ) {
                                        $right = self::escapePhpString( $right );
                                        $groupRights .= "\$wgGroupPermissions['$group']['$right'] = " .
                                                wfBoolToStr( $perm ) . ";\n";
index 72514f2..d550909 100644 (file)
@@ -353,7 +353,7 @@ class MysqlInstaller extends DatabaseInstaller {
                $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() );
                $s .= Xml::closeElement( 'div' );
 
-               if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
+               if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
                        $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) );
                        $s .= '$(\'#dbMyisamWarning\').hide();';
                        $s .= Xml::closeElement( 'script' );
@@ -371,10 +371,12 @@ class MysqlInstaller extends DatabaseInstaller {
                                'itemAttribs' => array(
                                        'MyISAM' => array(
                                                'class' => 'showHideRadio',
-                                               'rel'   => 'dbMyisamWarning'),
+                                               'rel' => 'dbMyisamWarning'
+                                       ),
                                        'InnoDB' => array(
                                                'class' => 'hideShowRadio',
-                                               'rel'   => 'dbMyisamWarning')
+                                               'rel' => 'dbMyisamWarning'
+                                       )
                        )));
                        $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
                }
@@ -470,7 +472,7 @@ class MysqlInstaller extends DatabaseInstaller {
                }
                $conn = $status->value;
                $dbName = $this->getVar( 'wgDBname' );
-               if( !$conn->selectDB( $dbName ) ) {
+               if ( !$conn->selectDB( $dbName ) ) {
                        $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
                        $conn->selectDB( $dbName );
                }
@@ -483,7 +485,7 @@ class MysqlInstaller extends DatabaseInstaller {
         */
        public function setupUser() {
                $dbUser = $this->getVar( 'wgDBuser' );
-               if( $dbUser == $this->getVar( '_InstallUser' ) ) {
+               if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
                        return Status::newGood();
                }
                $status = $this->getConnection();
@@ -520,7 +522,7 @@ class MysqlInstaller extends DatabaseInstaller {
                        $tryToCreate = false;
                }
 
-               if( $tryToCreate ) {
+               if ( $tryToCreate ) {
                        $createHostList = array(
                                $server,
                                'localhost',
@@ -531,16 +533,16 @@ class MysqlInstaller extends DatabaseInstaller {
                        $createHostList = array_unique( $createHostList );
                        $escPass = $this->db->addQuotes( $password );
 
-                       foreach( $createHostList as $host ) {
+                       foreach ( $createHostList as $host ) {
                                $fullName = $this->buildFullUserName( $dbUser, $host );
-                               if( !$this->userDefinitelyExists( $dbUser, $host ) ) {
+                               if ( !$this->userDefinitelyExists( $dbUser, $host ) ) {
                                        try{
                                                $this->db->begin( __METHOD__ );
                                                $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
                                                $this->db->commit( __METHOD__ );
                                                $grantableNames[] = $fullName;
                                        } catch( DBQueryError $dqe ) {
-                                               if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
+                                               if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
                                                        // User (probably) already exists
                                                        $this->db->rollback( __METHOD__ );
                                                        $status->warning( 'config-install-user-alreadyexists', $dbUser );
@@ -563,7 +565,7 @@ class MysqlInstaller extends DatabaseInstaller {
 
                // Try to grant to all the users we know exist or we were able to create
                $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
-               foreach( $grantableNames as $name ) {
+               foreach ( $grantableNames as $name ) {
                        try {
                                $this->db->begin( __METHOD__ );
                                $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
index df1f610..1c22afb 100644 (file)
@@ -331,7 +331,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        return;
                }
 
-               if( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) {
+               if ( $this->applyPatch( 'patch-fix-il_from.sql', false, "Fixing ancient broken imagelinks table." ) ) {
                        $this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this." );
                }
        }
@@ -368,7 +368,7 @@ class MysqlUpdater extends DatabaseUpdater {
                $this->output( wfTimestamp( TS_DB ) );
                $this->output( "......checking for duplicate entries.\n" );
 
-               list ( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' );
+               list( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' );
 
                $rows = $this->db->query( "SELECT cur_title, cur_namespace, COUNT(cur_namespace) AS c
                                FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", __METHOD__ );
@@ -525,12 +525,12 @@ class MysqlUpdater extends DatabaseUpdater {
 
        protected function doNamespaceSize() {
                $tables = array(
-                       'page'          => 'page',
-                       'archive'       => 'ar',
+                       'page' => 'page',
+                       'archive' => 'ar',
                        'recentchanges' => 'rc',
-                       'watchlist'     => 'wl',
-                       'querycache'    => 'qc',
-                       'logging'       => 'log',
+                       'watchlist' => 'wl',
+                       'querycache' => 'qc',
+                       'logging' => 'log',
                );
                foreach ( $tables as $table => $prefix ) {
                        $field = $prefix . '_namespace';
@@ -651,7 +651,7 @@ class MysqlUpdater extends DatabaseUpdater {
                        foreach ( $groups as $group ) {
                                $this->db->insert( 'user_groups',
                                        array(
-                                               'ug_user'  => $row->ur_user,
+                                               'ug_user' => $row->ur_user,
                                                'ug_group' => $group ),
                                        __METHOD__ );
                        }
@@ -686,7 +686,7 @@ class MysqlUpdater extends DatabaseUpdater {
                $this->db->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", __METHOD__ );
                $rows = $this->db->affectedRows();
 
-               if( $rows ) {
+               if ( $rows ) {
                        $this->output( "Set page_random to a random value on $rows rows where it was set to 0\n" );
                } else {
                        $this->output( "...no page_random rows needed to be set\n" );
index e7ae8d5..3747189 100644 (file)
@@ -431,7 +431,7 @@ class PostgresInstaller extends DatabaseInstaller {
                        'callback' => array( $this, 'setupSchema' )
                );
 
-               if( $this->getVar( '_CreateDBAccount' ) ) {
+               if ( $this->getVar( '_CreateDBAccount' ) ) {
                        $this->parent->addInstallStep( $createDbAccount, 'database' );
                }
                $this->parent->addInstallStep( $commitCB, 'interwiki' );
@@ -469,7 +469,7 @@ class PostgresInstaller extends DatabaseInstaller {
                $schema = $this->getVar( 'wgDBmwschema' );
                $safeschema = $conn->addIdentifierQuotes( $schema );
                $safeuser = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
-               if( !$conn->schemaExists( $schema ) ) {
+               if ( !$conn->schemaExists( $schema ) ) {
                        try {
                                $conn->query( "CREATE SCHEMA $safeschema AUTHORIZATION $safeuser" );
                        } catch ( DBQueryError $e ) {
@@ -557,7 +557,7 @@ class PostgresInstaller extends DatabaseInstaller {
                 */
                $conn = $status->value;
 
-               if( $conn->tableExists( 'archive' ) ) {
+               if ( $conn->tableExists( 'archive' ) ) {
                        $status->warning( 'config-install-tables-exist' );
                        $this->enableLB();
                        return $status;
@@ -565,12 +565,12 @@ class PostgresInstaller extends DatabaseInstaller {
 
                $conn->begin( __METHOD__ );
 
-               if( !$conn->schemaExists( $schema ) ) {
+               if ( !$conn->schemaExists( $schema ) ) {
                        $status->fatal( 'config-install-pg-schema-not-exist' );
                        return $status;
                }
                $error = $conn->sourceFile( $conn->getSchemaPath() );
-               if( $error !== true ) {
+               if ( $error !== true ) {
                        $conn->reportQueryError( $error, 0, '', __METHOD__ );
                        $conn->rollback( __METHOD__ );
                        $status->fatal( 'config-install-tables-failed', $error );
@@ -578,7 +578,7 @@ class PostgresInstaller extends DatabaseInstaller {
                        $conn->commit( __METHOD__ );
                }
                // Resume normal operations
-               if( $status->isOk() ) {
+               if ( $status->isOk() ) {
                        $this->enableLB();
                }
                return $status;
index 2615fc6..58a54c4 100644 (file)
@@ -46,9 +46,9 @@ class PostgresUpdater extends DatabaseUpdater {
                        # r15791 Change reserved word table names "user" and "text"
                        array( 'renameTable', 'user', 'mwuser' ),
                        array( 'renameTable', 'text', 'pagecontent' ),
-                       array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey'),
+                       array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey' ),
                        array( 'renameIndex', 'mwuser', 'user_user_name_key', 'mwuser_user_name_key' ),
-                       array( 'renameIndex', 'pagecontent','text_pkey', 'pagecontent_pkey' ),
+                       array( 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ),
 
                        # renamed sequences
                        array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq'         ),
@@ -252,9 +252,9 @@ class PostgresUpdater extends DatabaseUpdater {
                        ),
                        'CREATE INDEX cl_sortkey ON "categorylinks" USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ),
                        array( 'checkIndex', 'iwl_prefix_title_from', array(
-                               array('iwl_prefix', 'text_ops', 'btree', 0),
-                               array('iwl_title', 'text_ops', 'btree', 0),
-                               array('iwl_from', 'int4_ops', 'btree', 0),
+                               array( 'iwl_prefix', 'text_ops', 'btree', 0 ),
+                               array( 'iwl_title', 'text_ops', 'btree', 0 ),
+                               array( 'iwl_from', 'int4_ops', 'btree', 0 ),
                        ),
                        'CREATE INDEX iwl_prefix_title_from ON "iwlinks" USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ),
                        array( 'checkIndex', 'logging_times', array(
@@ -308,11 +308,11 @@ class PostgresUpdater extends DatabaseUpdater {
                        array( 'checkOiNameConstraint' ),
                        array( 'checkPageDeletedTrigger' ),
                        array( 'checkRevUserFkey' ),
-                       array( 'dropIndex', 'ipblocks', 'ipb_address'),
+                       array( 'dropIndex', 'ipblocks', 'ipb_address' ),
                        array( 'checkIndex', 'ipb_address_unique', array(
                                array( 'ipb_address', 'text_ops', 'btree', 0 ),
-                               array( 'ipb_user',    'int4_ops', 'btree', 0 ),
-                               array( 'ipb_auto',    'int2_ops', 'btree', 0 ),
+                               array( 'ipb_user', 'int4_ops', 'btree', 0 ),
+                               array( 'ipb_auto', 'int2_ops', 'btree', 0 ),
                                array( 'ipb_anon_only', 'int2_ops', 'btree', 0 ),
                        ),
                        'CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ),
@@ -515,7 +515,7 @@ END;
                if ( !$this->db->sequenceExists( $ns ) ) {
                        $this->output( "Creating sequence $ns\n" );
                        $this->db->query( "CREATE SEQUENCE $ns" );
-                       if( $pkey !== false ) {
+                       if ( $pkey !== false ) {
                                $this->setDefault( $table, $pkey, '"nextval"(\'"' . $ns . '"\'::"regclass")' );
                        }
                }
@@ -538,7 +538,7 @@ END;
                        $old = $this->db->realTableName( $old, "quoted" );
                        $new = $this->db->realTableName( $new, "quoted" );
                        $this->db->query( "ALTER TABLE $old RENAME TO $new" );
-                       if( $patch !== false ) {
+                       if ( $patch !== false ) {
                                $this->applyPatch( $patch );
                        }
                }
@@ -592,9 +592,9 @@ END;
                        exit( 1 );
                }
 
-               if ( $fi->type() === $newtype )
+               if ( $fi->type() === $newtype ) {
                        $this->output( "...column '$table.$field' is already of type '$newtype'\n" );
-               else {
+               else {
                        $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" );
                        $sql = "ALTER TABLE $table ALTER $field TYPE $newtype";
                        if ( strlen( $default ) ) {
index 68df6ab..50a7181 100644 (file)
@@ -60,7 +60,7 @@ class SqliteInstaller extends DatabaseInstaller {
                        $result->fatal( 'config-outdated-sqlite', $db->getServerVersion(), self::MINIMUM_VERSION );
                }
                // Check for FTS3 full-text search module
-               if( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
+               if ( DatabaseSqlite::getFulltextSearchModule() != 'FTS3' ) {
                        $result->warning( 'config-no-fts3' );
                }
                return $result;
index 30aa956..9c56558 100644 (file)
@@ -154,7 +154,7 @@ class WebInstaller extends Installer {
                $this->exportVars();
                $this->setupLanguage();
 
-               if( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
+               if ( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
                        && $this->request->getVal( 'localsettings' ) )
                {
                        $this->request->response()->header( 'Content-type: application/x-httpd-php' );
@@ -164,7 +164,7 @@ class WebInstaller extends Installer {
 
                        $ls = InstallerOverrides::getLocalSettingsGenerator( $this );
                        $rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )];
-                       foreach( $rightsProfile as $group => $rightsArr ) {
+                       foreach ( $rightsProfile as $group => $rightsArr ) {
                                $ls->setGroupRights( $group, $rightsArr );
                        }
                        echo $ls->getText();
@@ -172,7 +172,7 @@ class WebInstaller extends Installer {
                }
 
                $cssDir = $this->request->getVal( 'css' );
-               if( $cssDir ) {
+               if ( $cssDir ) {
                        $cssDir = ( $cssDir == 'rtl' ? 'rtl' : 'ltr' );
                        $this->request->response()->header( 'Content-type: text/css' );
                        echo $this->output->getCSS( $cssDir );
@@ -250,7 +250,7 @@ class WebInstaller extends Installer {
                                do {
                                        $nextPageId--;
                                        $nextPage = $this->pageSequence[$nextPageId];
-                               } while( isset( $this->skippedPages[$nextPage] ) );
+                               } while ( isset( $this->skippedPages[$nextPage] ) );
                        } else {
                                $nextPage = $this->pageSequence[$lowestUnhappy];
                        }
@@ -263,7 +263,7 @@ class WebInstaller extends Installer {
                $this->currentPageName = $page->getName();
                $this->startPageWrapper( $pageName );
 
-               if( $page->isSlow() ) {
+               if ( $page->isSlow() ) {
                        $this->disableTimeLimit();
                }
 
@@ -324,7 +324,7 @@ class WebInstaller extends Installer {
         * @return bool
         */
        public function startSession() {
-               if( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
+               if ( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
                        // Done already
                        return true;
                }
@@ -889,7 +889,7 @@ class WebInstaller extends Installer {
                if ( !isset( $params['help'] ) ) {
                        $params['help'] = "";
                }
-               if( isset( $params['rawtext'] ) ) {
+               if ( isset( $params['rawtext'] ) ) {
                        $labelText = $params['rawtext'];
                } else {
                        $labelText = $this->parse( wfMessage( $params['label'] )->text() );
@@ -983,10 +983,10 @@ class WebInstaller extends Installer {
         * @param $status Status
         */
        public function showStatusBox( $status ) {
-               if( !$status->isGood() ) {
+               if ( !$status->isGood() ) {
                        $text = $status->getWikiText();
 
-                       if( $status->isOk() ) {
+                       if ( $status->isOk() ) {
                                $box = $this->getWarningBox( $text );
                        } else {
                                $box = $this->getErrorBox( $text );
index a6a8667..3e65eae 100644 (file)
@@ -146,7 +146,7 @@ class WebInstallerOutput {
                }
                wfRestoreWarnings();
 
-               if( $dir == 'rtl' ) {
+               if ( $dir == 'rtl' ) {
                        $css = CSSJanus::transform( $css, true );
                }
 
index 3f3e50a..b640fb8 100644 (file)
@@ -254,7 +254,9 @@ class WebInstaller_Language extends WebInstallerPage {
                $languages = Language::fetchLanguageNames();
                ksort( $languages );
                foreach ( $languages as $code => $lang ) {
-                       if ( isset( $wgDummyLanguageCodes[$code] ) ) continue;
+                       if ( isset( $wgDummyLanguageCodes[$code] ) ) {
+                               continue;
+                       }
                        $s .= "\n" . Xml::option( "$code - $lang", $code, $code == $selectedCode );
                }
                $s .= "\n</select>\n";
@@ -310,7 +312,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                $r = $this->parent->request;
                if ( $r->wasPosted() ) {
                        $key = $r->getText( 'config_wgUpgradeKey' );
-                       if( !$key || $key !== $vars['wgUpgradeKey'] ) {
+                       if ( !$key || $key !== $vars['wgUpgradeKey'] ) {
                                $this->parent->showError( 'config-localsettings-badkey' );
                                $this->showKeyForm();
                                return 'output';
@@ -458,7 +460,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
                // Give grep a chance to find the usages:
                // config-support-mysql, config-support-postgres, config-support-oracle, config-support-sqlite
                $dbSupport = '';
-               foreach( $this->parent->getDBTypes() as $type ) {
+               foreach ( $this->parent->getDBTypes() as $type ) {
                        $link = DatabaseBase::factory( $type )->getSoftwareLink();
                        $dbSupport .= wfMessage( "config-support-$type", $link )->plain() . "\n";
                }
@@ -552,7 +554,7 @@ class WebInstaller_Upgrade extends WebInstallerPage {
                        if ( $result ) {
                                // If they're going to possibly regenerate LocalSettings, we
                                // need to create the upgrade/secret keys. Bug 26481
-                               if( !$this->getVar( '_ExistingDBSettings' ) ) {
+                               if ( !$this->getVar( '_ExistingDBSettings' ) ) {
                                        $this->parent->generateKeys();
                                }
                                $this->setVar( '_UpgradeDone', true );
@@ -764,7 +766,7 @@ class WebInstaller_Name extends WebInstallerPage {
                // Make sure it won't conflict with any existing namespaces
                global $wgContLang;
                $nsIndex = $wgContLang->getNsIndex( $name );
-               if( $nsIndex !== false && $nsIndex !== NS_PROJECT ) {
+               if ( $nsIndex !== false && $nsIndex !== NS_PROJECT ) {
                        $this->parent->showError( 'config-ns-conflict', $name );
                        $retVal = false;
                }
@@ -812,13 +814,13 @@ class WebInstaller_Name extends WebInstallerPage {
 
                // Validate e-mail if provided
                $email = $this->getVar( '_AdminEmail' );
-               if( $email && !Sanitizer::validateEmail( $email ) ) {
+               if ( $email && !Sanitizer::validateEmail( $email ) ) {
                        $this->parent->showError( 'config-admin-error-bademail' );
                        $retVal = false;
                }
                // If they asked to subscribe to mediawiki-announce but didn't give
                // an e-mail, show an error. Bug 29332
-               if( !$email && $this->getVar( '_Subscribe' ) ) {
+               if ( !$email && $this->getVar( '_Subscribe' ) ) {
                        $this->parent->showError( 'config-subscribe-noemail' );
                        $retVal = false;
                }
@@ -911,10 +913,10 @@ class WebInstaller_Options extends WebInstallerPage {
 
                $extensions = $this->parent->findExtensions();
 
-               if( $extensions ) {
+               if ( $extensions ) {
                        $extHtml = $this->getFieldSetStart( 'config-extensions' );
 
-                       foreach( $extensions as $ext ) {
+                       foreach ( $extensions as $ext ) {
                                $extHtml .= $this->parent->getCheckBox( array(
                                        'var' => "ext-$ext",
                                        'rawtext' => $ext,
@@ -974,7 +976,7 @@ class WebInstaller_Options extends WebInstallerPage {
                );
 
                $caches = array( 'none' );
-               if( count( $this->getVar( '_Caches' ) ) ) {
+               if ( count( $this->getVar( '_Caches' ) ) ) {
                        $caches[] = 'accel';
                }
                $caches[] = 'memcached';
@@ -987,7 +989,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        // or going back!
                        $cacheval = 'none';
                }
-               $hidden = ($cacheval == 'memcached') ? '' : 'display: none';
+               $hidden = ( $cacheval == 'memcached' ) ? '' : 'display: none';
                $this->addHTML(
                        # Advanced settings
                        $this->getFieldSetStart( 'config-advanced-settings' ) .
@@ -1054,7 +1056,7 @@ class WebInstaller_Options extends WebInstallerPage {
                } else {
                        $iframeAttribs['src'] = $this->getCCPartnerUrl();
                }
-               $wrapperStyle = ($this->getVar( '_LicenseCode' ) == 'cc-choose') ? '' : 'display: none';
+               $wrapperStyle = ( $this->getVar( '_LicenseCode' ) == 'cc-choose' ) ? '' : 'display: none';
 
                return "<div class=\"config-cc-wrapper\" id=\"config-cc-wrapper\" style=\"$wrapperStyle\">\n" .
                        Html::element( 'iframe', $iframeAttribs, '', false /* not short */ ) .
@@ -1139,31 +1141,31 @@ class WebInstaller_Options extends WebInstallerPage {
 
                $extsAvailable = $this->parent->findExtensions();
                $extsToInstall = array();
-               foreach( $extsAvailable as $ext ) {
-                       if( $this->parent->request->getCheck( 'config_ext-' . $ext ) ) {
+               foreach ( $extsAvailable as $ext ) {
+                       if ( $this->parent->request->getCheck( 'config_ext-' . $ext ) ) {
                                $extsToInstall[] = $ext;
                        }
                }
                $this->parent->setVar( '_Extensions', $extsToInstall );
 
-               if( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) {
+               if ( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) {
                        $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) );
-                       if( !$memcServers ) {
+                       if ( !$memcServers ) {
                                $this->parent->showError( 'config-memcache-needservers' );
                                return false;
                        }
 
-                       foreach( $memcServers as $server ) {
+                       foreach ( $memcServers as $server ) {
                                $memcParts = explode( ":", $server, 2 );
                                if ( !isset( $memcParts[0] )
                                                || ( !IP::isValid( $memcParts[0] )
                                                        && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) ) ) {
                                        $this->parent->showError( 'config-memcache-badip', $memcParts[0] );
                                        return false;
-                               } elseif( !isset( $memcParts[1] )  ) {
+                               } elseif ( !isset( $memcParts[1] ) ) {
                                        $this->parent->showError( 'config-memcache-noport', $memcParts[0] );
                                        return false;
-                               } elseif( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
+                               } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
                                        $this->parent->showError( 'config-memcache-badport', 1, 65535 );
                                        return false;
                                }
@@ -1180,11 +1182,11 @@ class WebInstaller_Install extends WebInstallerPage {
        }
 
        public function execute() {
-               if( $this->getVar( '_UpgradeDone' ) ) {
+               if ( $this->getVar( '_UpgradeDone' ) ) {
                        return 'skip';
-               } elseif( $this->getVar( '_InstallDone' ) ) {
+               } elseif ( $this->getVar( '_InstallDone' ) ) {
                        return 'continue';
-               } elseif( $this->parent->request->wasPosted() ) {
+               } elseif ( $this->parent->request->wasPosted() ) {
                        $this->startForm();
                        $this->addHTML( "<ul>" );
                        $results = $this->parent->performInstallation(
@@ -1227,7 +1229,7 @@ class WebInstaller_Install extends WebInstallerPage {
                        $html = "<span class=\"error\">$html</span>";
                }
                $this->addHTML( $html . "</li>\n" );
-               if( !$status->isGood() ) {
+               if ( !$status->isGood() ) {
                        $this->parent->showStatusBox( $status );
                }
        }
@@ -1302,7 +1304,7 @@ abstract class WebInstaller_Document extends WebInstallerPage {
 
        public function getFileContents() {
                $file = __DIR__ . '/../../' . $this->getFileName();
-               if( ! file_exists( $file ) ) {
+               if ( ! file_exists( $file ) ) {
                        return wfMessage( 'config-nofile', $file )->plain();
                }
                return file_get_contents( $file );
@@ -1320,7 +1322,7 @@ class WebInstaller_ReleaseNotes extends WebInstaller_Document {
        protected function getFileName() {
                global $wgVersion;
 
-               if( !preg_match( '/^(\d+)\.(\d+).*/i', $wgVersion, $result ) ) {
+               if ( !preg_match( '/^(\d+)\.(\d+).*/i', $wgVersion, $result ) ) {
                        throw new MWException( 'Variable $wgVersion has an invalid value.' );
                }
 
index a765d5d..bb6fb04 100644 (file)
@@ -68,7 +68,7 @@ abstract class Job {
         */
        public static function factory( $command, Title $title, $params = false, $id = 0 ) {
                global $wgJobClasses;
-               if( isset( $wgJobClasses[$command] ) ) {
+               if ( isset( $wgJobClasses[$command] ) ) {
                        $class = $wgJobClasses[$command];
                        return new $class( $title, $params, $id );
                }
@@ -213,10 +213,10 @@ abstract class Job {
         */
        public function getDeduplicationInfo() {
                $info = array(
-                       'type'      => $this->getType(),
+                       'type' => $this->getType(),
                        'namespace' => $this->getTitle()->getNamespace(),
-                       'title'     => $this->getTitle()->getDBkey(),
-                       'params'    => $this->getParams()
+                       'title' => $this->getTitle()->getDBkey(),
+                       'params' => $this->getParams()
                );
                if ( is_array( $info['params'] ) ) {
                        // Identical jobs with different "root" jobs should count as duplicates
index c364209..9434da0 100644 (file)
@@ -91,7 +91,7 @@ class JobQueueAggregatorMemc extends JobQueueAggregator {
                        if ( $this->cache->add( "$key:rebuild", 1, 1800 ) ) { // lock
                                $pendingDbInfo = array(
                                        'pendingDBs' => $this->findPendingWikiQueues(),
-                                       'timestamp'  => time()
+                                       'timestamp' => time()
                                );
                                for ( $attempts = 1; $attempts <= 25; ++$attempts ) {
                                        if ( $this->cache->add( "$key:lock", 1, 60 ) ) { // lock
index e4825ed..e8e0385 100644 (file)
@@ -225,7 +225,7 @@ class JobQueueDB extends JobQueue {
                                $res = $dbw->select( 'job', 'job_sha1',
                                        array(
                                                // No job_type condition since it's part of the job_sha1 hash
-                                               'job_sha1'  => array_keys( $rowSet ),
+                                               'job_sha1' => array_keys( $rowSet ),
                                                'job_token' => '' // unclaimed
                                        ),
                                        $method
@@ -300,7 +300,7 @@ class JobQueueDB extends JobQueue {
                        $job->metadata['id'] = $row->job_id;
                        $job->id = $row->job_id; // XXX: work around broken subclasses
                        break; // done
-               } while( true );
+               } while ( true );
 
                return $job;
        }
@@ -332,7 +332,7 @@ class JobQueueDB extends JobQueue {
                                $dir = $gte ? 'ASC' : 'DESC';
                                $row = $dbw->selectRow( 'job', '*', // find a random job
                                        array(
-                                               'job_cmd'   => $this->type,
+                                               'job_cmd' => $this->type,
                                                'job_token' => '', // unclaimed
                                                "job_random {$ineq} {$dbw->addQuotes( $rand )}" ),
                                        __METHOD__,
@@ -349,7 +349,7 @@ class JobQueueDB extends JobQueue {
                                // instead of job_random for reducing excess claim retries.
                                $row = $dbw->selectRow( 'job', '*', // find a random job
                                        array(
-                                               'job_cmd'   => $this->type,
+                                               'job_cmd' => $this->type,
                                                'job_token' => '', // unclaimed
                                        ),
                                        __METHOD__,
@@ -364,7 +364,7 @@ class JobQueueDB extends JobQueue {
                        if ( $row ) { // claim the job
                                $dbw->update( 'job', // update by PK
                                        array(
-                                               'job_token'           => $uuid,
+                                               'job_token' => $uuid,
                                                'job_token_timestamp' => $dbw->timestamp(),
                                                'job_attempts = job_attempts+1' ),
                                        array( 'job_cmd' => $this->type, 'job_id' => $row->job_id, 'job_token' => '' ),
@@ -415,7 +415,7 @@ class JobQueueDB extends JobQueue {
                                // This uses as much of the DB wrapper functions as possible.
                                $dbw->update( 'job',
                                        array(
-                                               'job_token'           => $uuid,
+                                               'job_token' => $uuid,
                                                'job_token_timestamp' => $dbw->timestamp(),
                                                'job_attempts = job_attempts+1' ),
                                        array( 'job_id = (' .
@@ -514,7 +514,7 @@ class JobQueueDB extends JobQueue {
                return array(
                        'recycleAndDeleteStaleJobs' => array(
                                'callback' => array( $this, 'recycleAndDeleteStaleJobs' ),
-                               'period'   => ceil( $this->claimTTL / 2 )
+                               'period' => ceil( $this->claimTTL / 2 )
                        )
                );
        }
@@ -578,7 +578,11 @@ class JobQueueDB extends JobQueue {
                                        "job_attempts < {$dbw->addQuotes( $this->maxTries )}" ), // retries left
                                __METHOD__
                        );
-                       $ids = array_map( function( $o ) { return $o->job_id; }, iterator_to_array( $res ) );
+                       $ids = array_map(
+                               function( $o ) {
+                                       return $o->job_id;
+                               }, iterator_to_array( $res )
+                       );
                        if ( count( $ids ) ) {
                                // Reset job_token for these jobs so that other runners will pick them up.
                                // Set the timestamp to the current time, as it is useful to now that the job
@@ -610,10 +614,15 @@ class JobQueueDB extends JobQueue {
                // Get the IDs of jobs that are considered stale and should be removed. Selecting
                // the IDs first means that the UPDATE can be done by primary key (less deadlocks).
                $res = $dbw->select( 'job', 'job_id', $conds, __METHOD__ );
-               $ids = array_map( function( $o ) { return $o->job_id; }, iterator_to_array( $res ) );
+               $ids = array_map(
+                       function( $o ) {
+                               return $o->job_id;
+                       }, iterator_to_array( $res )
+               );
                if ( count( $ids ) ) {
                        $dbw->delete( 'job', array( 'job_id' => $ids ), __METHOD__ );
                        $count += $dbw->affectedRows();
+                       JobQueue::incrStats( 'job-abandon', $this->type, $dbw->affectedRows() );
                }
 
                $dbw->unlock( "jobqueue-recycle-{$this->type}", __METHOD__ );
index ed3c4f4..7a5d113 100644 (file)
@@ -61,7 +61,7 @@ class JobQueueFederated extends JobQueue {
        protected $cache;
 
        const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating
-       const CACHE_TTL_LONG  = 300; // integer; seconds to cache info that is kept up to date
+       const CACHE_TTL_LONG = 300; // integer; seconds to cache info that is kept up to date
 
        /**
         * @params include:
index f083fcc..249ba27 100644 (file)
@@ -649,7 +649,8 @@ LUA;
                        if ( $res ) {
                                list( $released, $abandoned, $pruned ) = $res;
                                $count += $released + $pruned;
-                               JobQueue::incrStats( 'job-recycle', $this->type, count( $released ) );
+                               JobQueue::incrStats( 'job-recycle', $this->type, $released );
+                               JobQueue::incrStats( 'job-abandon', $this->type, $abandoned );
                        }
                } catch ( RedisException $e ) {
                        $this->throwRedisException( $this->server, $conn, $e );
@@ -666,13 +667,13 @@ LUA;
                if ( $this->claimTTL > 0 ) {
                        $tasks['recycleAndDeleteStaleJobs'] = array(
                                'callback' => array( $this, 'recycleAndDeleteStaleJobs' ),
-                               'period'   => ceil( $this->claimTTL / 2 )
+                               'period' => ceil( $this->claimTTL / 2 )
                        );
                }
                if ( $this->checkDelay ) {
                        $tasks['releaseReadyDelayedJobs'] = array(
                                'callback' => array( $this, 'releaseReadyDelayedJobs' ),
-                               'period'   => 300 // 5 minutes
+                               'period' => 300 // 5 minutes
                        );
                }
                return $tasks;
index c5dd9ea..4fe1753 100644 (file)
@@ -82,11 +82,11 @@ class AssembleUploadChunksJob extends Job {
                        UploadBase::setSessionStatus(
                                $this->params['filekey'],
                                array(
-                                       'result'    => 'Success',
-                                       'stage'     => 'assembling',
-                                       'filekey'   => $newFileKey,
+                                       'result' => 'Success',
+                                       'stage' => 'assembling',
+                                       'filekey' => $newFileKey,
                                        'imageinfo' => $imageInfo,
-                                       'status'    => Status::newGood()
+                                       'status' => Status::newGood()
                                )
                        );
                } catch ( MWException $e ) {
@@ -94,7 +94,7 @@ class AssembleUploadChunksJob extends Job {
                                $this->params['filekey'],
                                array(
                                        'result' => 'Failure',
-                                       'stage'  => 'assembling',
+                                       'stage' => 'assembling',
                                        'status' => Status::newFatal( 'api-error-stashfailed' )
                                )
                        );
index 2be05b6..bbe988d 100644 (file)
@@ -35,7 +35,7 @@ class EnotifNotifyJob extends Job {
        function run() {
                $enotif = new EmailNotification();
                // Get the user from ID (rename safe). Anons are 0, so defer to name.
-               if( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
+               if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
                        $editor = User::newFromId( $this->params['editorID'] );
                // B/C, only the name might be given.
                } else {
index 376b388..44c240b 100644 (file)
@@ -154,7 +154,7 @@ class HTMLCacheUpdateJob extends Job {
                                        array(
                                                'table' => $this->params['table'],
                                                'start' => $start,
-                                               'end'   => $id - 1
+                                               'end' => $id - 1
                                        ) + $rootJobParams // carry over information for de-duplication
                                );
                                $start = $id;
@@ -167,7 +167,7 @@ class HTMLCacheUpdateJob extends Job {
                        array(
                                'table' => $this->params['table'],
                                'start' => $start,
-                               'end'   => $this->params['end']
+                               'end' => $this->params['end']
                        ) + $rootJobParams // carry over information for de-duplication
                );
                wfDebug( __METHOD__ . ": repartitioning into " . count( $jobs ) . " jobs\n" );
@@ -203,7 +203,7 @@ class HTMLCacheUpdateJob extends Job {
                                array(
                                        'table' => $this->params['table'],
                                        'start' => $start,
-                                       'end'   => $end,
+                                       'end' => $end,
                                ) + $rootJobParams // carry over information for de-duplication
                        );
                }
@@ -254,7 +254,7 @@ class HTMLCacheUpdateJob extends Job {
                }
 
                # Update file cache
-               if  ( $wgUseFileCache ) {
+               if ( $wgUseFileCache ) {
                        foreach ( $titleArray as $title ) {
                                HTMLFileCache::clearFileCache( $title );
                        }
index d3feda2..625e8aa 100644 (file)
@@ -94,11 +94,11 @@ class PublishStashedFileJob extends Job {
                        UploadBase::setSessionStatus(
                                $this->params['filekey'],
                                array(
-                                       'result'    => 'Success',
-                                       'stage'     => 'publish',
-                                       'filename'  => $upload->getLocalFile()->getName(),
+                                       'result' => 'Success',
+                                       'stage' => 'publish',
+                                       'filename' => $upload->getLocalFile()->getName(),
                                        'imageinfo' => $imageInfo,
-                                       'status'    => Status::newGood()
+                                       'status' => Status::newGood()
                                )
                        );
                } catch ( MWException $e ) {
@@ -106,7 +106,7 @@ class PublishStashedFileJob extends Job {
                                $this->params['filekey'],
                                array(
                                        'result' => 'Failure',
-                                       'stage'  => 'publish',
+                                       'stage' => 'publish',
                                        'status' => Status::newFatal( 'api-error-publishfailed' )
                                )
                        );
index 261ae63..4a5ecfc 100644 (file)
@@ -159,10 +159,10 @@ class RefreshLinksJob2 extends Job {
                                        list( $start, $end ) = $batch;
                                        $jobs[] = new RefreshLinksJob2( $this->title,
                                                array(
-                                                       'table'            => $table,
-                                                       'start'            => $start,
-                                                       'end'              => $end,
-                                                       'masterPos'        => $masterPos,
+                                                       'table' => $table,
+                                                       'start' => $start,
+                                                       'end' => $end,
+                                                       'masterPos' => $masterPos,
                                                ) + $this->getRootJobParams() // carry over information for de-duplication
                                        );
                                }
index 1e0e54f..ef9a2d4 100644 (file)
@@ -101,7 +101,7 @@ class DeleteLogFormatter extends LogFormatter {
 
                switch ( $this->entry->getSubtype() ) {
                case 'delete': // Show undelete link
-                       if( $user->isAllowed( 'undelete' ) ) {
+                       if ( $user->isAllowed( 'undelete' ) ) {
                                $message = 'undeletelink';
                        } else {
                                $message = 'undeleteviewlink';
@@ -147,8 +147,8 @@ class DeleteLogFormatter extends LogFormatter {
                                                $this->msg( 'diff' )->escaped(),
                                                array(),
                                                array(
-                                                       'target'    => $this->entry->getTarget()->getPrefixedDBkey(),
-                                                       'diff'      => 'prev',
+                                                       'target' => $this->entry->getTarget()->getPrefixedDBkey(),
+                                                       'diff' => 'prev',
                                                        'timestamp' => $ids[0]
                                                )
                                        );
index 0f20ed1..b99f16b 100644 (file)
@@ -151,7 +151,7 @@ class DatabaseLogEntry extends LogEntryBase {
                return array(
                        'tables' => $tables,
                        'fields' => $fields,
-                       'conds'  => array(),
+                       'conds' => array(),
                        'options' => array(),
                        'join_conds' => $joins,
                );
@@ -233,7 +233,7 @@ class DatabaseLogEntry extends LogEntryBase {
        }
 
        public function getPerformer() {
-               if( !$this->performer ) {
+               if ( !$this->performer ) {
                        $userId = (int) $this->row->log_user;
                        if ( $userId !== 0 ) { // logged-in users
                                if ( isset( $this->row->user_name ) ) {
@@ -291,7 +291,7 @@ class RCDatabaseLogEntry extends DatabaseLogEntry {
        }
 
        public function getPerformer() {
-               if( !$this->performer ) {
+               if ( !$this->performer ) {
                        $userId = (int) $this->row->rc_user;
                        if ( $userId !== 0 ) {
                                $this->performer = User::newFromId( $userId );
index fd598df..ba48bd7 100644 (file)
@@ -76,7 +76,7 @@ class LogEventsList extends ContextSource {
                // If only one log type is used, then show a special message...
                $headerType = (count( $type ) == 1) ? $type[0] : '';
                $out = $this->getOutput();
-               if( LogPage::isLogType( $headerType ) ) {
+               if ( LogPage::isLogType( $headerType ) ) {
                        $page = new LogPage( $headerType );
                        $out->setPageTitle( $page->getName()->text() );
                        $out->addHTML( $page->getDescription()->parseAsBlock() );
@@ -104,7 +104,7 @@ class LogEventsList extends ContextSource {
                $title = SpecialPage::getTitleFor( 'Log' );
 
                // For B/C, we take strings, but make sure they are converted...
-               $types = ($types === '') ? array() : (array)$types;
+               $types = ( $types === '' ) ? array() : (array)$types;
 
                $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
 
@@ -156,7 +156,7 @@ class LogEventsList extends ContextSource {
                // Option value -> message mapping
                $links = array();
                $hiddens = ''; // keep track for "go" button
-               foreach( $filter as $type => $val ) {
+               foreach ( $filter as $type => $val ) {
                        // Should the below assignment be outside the foreach?
                        // Then it would have to be copied. Not certain what is more expensive.
                        $query = $this->getDefaultQuery();
@@ -212,7 +212,7 @@ class LogEventsList extends ContextSource {
        public function getTypeSelector() {
                $typesByName = array(); // Temporary array
                // First pass to load the log names
-               foreach( LogPage::validTypes() as $type ) {
+               foreach ( LogPage::validTypes() as $type ) {
                        $page = new LogPage( $type );
                        $restriction = $page->getRestriction();
                        if ( $this->getUser()->isAllowed( $restriction ) ) {
@@ -229,7 +229,7 @@ class LogEventsList extends ContextSource {
                $typesByName = array( '' => $public ) + $typesByName;
 
                $select = new XmlSelect( 'type' );
-               foreach( $typesByName as $type => $name ) {
+               foreach ( $typesByName as $type => $name ) {
                        $select->addOption( $name, $type );
                }
 
@@ -273,10 +273,10 @@ class LogEventsList extends ContextSource {
        private function getExtraInputs( $types ) {
                $offender = $this->getRequest()->getVal( 'offender' );
                $user = User::newFromName( $offender, false );
-               if( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
+               if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
                        $offender = ''; // Blank field if invalid
                }
-               if( count( $types ) == 1 && $types[0] == 'suppress' ) {
+               if ( count( $types ) == 1 && $types[0] == 'suppress' ) {
                        return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
                                'mw-log-offender', 20, $offender );
                }
@@ -342,16 +342,16 @@ class LogEventsList extends ContextSource {
         * @return string
         */
        private function getShowHideLinks( $row ) {
-               if( ( $this->flags == self::NO_ACTION_LINK ) // we don't want to see the links
+               if ( ( $this->flags == self::NO_ACTION_LINK ) // we don't want to see the links
                        || $row->log_type == 'suppress' ) { // no one can hide items from the suppress log
                        return '';
                }
                $del = '';
                $user = $this->getUser();
                // Don't show useless checkbox to people who cannot hide log entries
-               if( $user->isAllowed( 'deletedhistory' ) ) {
+               if ( $user->isAllowed( 'deletedhistory' ) ) {
                        $canHide = $user->isAllowed( 'deletelogentry' );
-                       if( $row->log_deleted || $canHide ) {
+                       if ( $row->log_deleted || $canHide ) {
                                if ( $canHide && $this->flags & self::USE_REVDEL_CHECKBOXES ) { // Show checkboxes instead of links.
                                        if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) { // If event was hidden from sysops
                                                $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
@@ -364,8 +364,8 @@ class LogEventsList extends ContextSource {
                                        } else {
                                                $query = array(
                                                        'target' => SpecialPage::getTitleFor( 'Log', $row->log_type )->getPrefixedDBkey(),
-                                                       'type'   => 'logging',
-                                                       'ids'    => $row->log_id,
+                                                       'type' => 'logging',
+                                                       'ids' => $row->log_id,
                                                );
                                                $del = Linker::revDeleteLink( $query, self::isDeleted( $row, LogPage::DELETED_RESTRICTED ), $canHide );
                                        }
@@ -385,10 +385,10 @@ class LogEventsList extends ContextSource {
        public static function typeAction( $row, $type, $action, $right = '' ) {
                $match = is_array( $type ) ?
                        in_array( $row->log_type, $type ) : $row->log_type == $type;
-               if( $match ) {
+               if ( $match ) {
                        $match = is_array( $action ) ?
                                in_array( $row->log_action, $action ) : $row->log_action == $action;
-                       if( $match && $right ) {
+                       if ( $match && $right ) {
                                global $wgUser;
                                $match = $wgUser->isAllowed( $right );
                        }
@@ -419,7 +419,7 @@ class LogEventsList extends ContextSource {
         * @return Boolean
         */
        public static function userCanBitfield( $bitfield, $field, User $user = null ) {
-               if( $bitfield & $field ) {
+               if ( $bitfield & $field ) {
                        if ( $bitfield & LogPage::DELETED_RESTRICTED ) {
                                $permission = 'suppressrevision';
                        } else {
@@ -503,10 +503,12 @@ class LogEventsList extends ContextSource {
                if ( isset( $param['offset'] ) ) { # Tell pager to ignore WebRequest offset
                        $pager->setOffset( $param['offset'] );
                }
-               if( $lim > 0 ) $pager->mLimit = $lim;
+               if ( $lim > 0 ) {
+                       $pager->mLimit = $lim;
+               }
                $logBody = $pager->getBody();
                $s = '';
-               if( $logBody ) {
+               if ( $logBody ) {
                        if ( $msgKey[0] ) {
                                $s = '<div class="mw-warning-with-logexcerpt">';
 
@@ -521,26 +523,27 @@ class LogEventsList extends ContextSource {
                        $s .= $loglist->beginLogEventsList() .
                                $logBody .
                                $loglist->endLogEventsList();
-               } else {
-                       if ( $showIfEmpty ) {
-                               $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
-                                       $context->msg( 'logempty' )->parse() );
-                       }
+               } elseif ( $showIfEmpty ) {
+                       $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
+                               $context->msg( 'logempty' )->parse() );
                }
-               if( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link
+               if ( $pager->getNumRows() > $pager->mLimit ) { # Show "Full log" link
                        $urlParam = array();
                        if ( $page instanceof Title ) {
                                $urlParam['page'] = $page->getPrefixedDBkey();
                        } elseif ( $page != '' ) {
                                $urlParam['page'] = $page;
                        }
-                       if ( $user != '' )
+                       if ( $user != '' ) {
                                $urlParam['user'] = $user;
-                       if ( !is_array( $types ) ) # Make it an array, if it isn't
+                       }
+                       if ( !is_array( $types ) ) { # Make it an array, if it isn't
                                $types = array( $types );
+                       }
                        # If there is exactly one log type, we can link to Special:Log?type=foo
-                       if ( count( $types ) == 1 )
+                       if ( count( $types ) == 1 ) {
                                $urlParam['type'] = $types[0];
+                       }
                        $s .= Linker::link(
                                SpecialPage::getTitleFor( 'Log' ),
                                $context->msg( 'log-fulllog' )->escaped(),
@@ -589,14 +592,14 @@ class LogEventsList extends ContextSource {
                $hiddenLogs = array();
 
                // Don't show private logs to unprivileged users
-               foreach( $wgLogRestrictions as $logType => $right ) {
-                       if( $audience == 'public' || !$user->isAllowed( $right ) ) {
+               foreach ( $wgLogRestrictions as $logType => $right ) {
+                       if ( $audience == 'public' || !$user->isAllowed( $right ) ) {
                                $hiddenLogs[] = $logType;
                        }
                }
-               if( count( $hiddenLogs ) == 1 ) {
+               if ( count( $hiddenLogs ) == 1 ) {
                        return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
-               } elseif( $hiddenLogs ) {
+               } elseif ( $hiddenLogs ) {
                        return 'log_type NOT IN (' . $db->makeList( $hiddenLogs ) . ')';
                }
                return false;
index 683dc03..27526f5 100644 (file)
@@ -320,7 +320,7 @@ class LogFormatter {
                        // case 'suppress' --private log -- aaron  (sign your messages so we know who to blame in a few years :-D)
                        // default:
                }
-               if( is_null( $text ) ) {
+               if ( is_null( $text ) ) {
                        $text = $this->getPlainActionText();
                }
 
@@ -775,7 +775,7 @@ class LegacyLogFormatter extends LogFormatter {
                        return $this->msg( 'parentheses' )->rawParams(
                                $this->context->getLanguage()->pipeList( $links ) )->escaped();
                // Show unmerge link
-               } elseif( $type == 'merge' && $subtype == 'merge' ) {
+               } elseif ( $type == 'merge' && $subtype == 'merge' ) {
                        if ( !$this->context->getUser()->isAllowed( 'mergehistory' ) ) {
                                return '';
                        }
index 36ba200..3fe91fc 100644 (file)
@@ -94,7 +94,7 @@ class LogPage {
                $newId = !is_null( $log_id ) ? $log_id : $dbw->insertId();
 
                # And update recentchanges
-               if( $this->updateRecentChanges ) {
+               if ( $this->updateRecentChanges ) {
                        $titleObj = SpecialPage::getTitleFor( 'Log', $this->type );
 
                        RecentChange::notifyLog(
@@ -102,9 +102,9 @@ class LogPage {
                                $this->type, $this->action, $this->target, $this->comment,
                                $this->params, $newId, $this->getRcCommentIRC()
                        );
-               } elseif( $this->sendToUDP ) {
+               } elseif ( $this->sendToUDP ) {
                        # Don't send private logs to UDP
-                       if( isset( $wgLogRestrictions[$this->type] ) && $wgLogRestrictions[$this->type] != '*' ) {
+                       if ( isset( $wgLogRestrictions[$this->type] ) && $wgLogRestrictions[$this->type] != '*' ) {
                                return $newId;
                        }
 
@@ -129,7 +129,7 @@ class LogPage {
        public function getRcComment() {
                $rcComment = $this->actionText;
 
-               if( $this->comment != '' ) {
+               if ( $this->comment != '' ) {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
@@ -149,7 +149,7 @@ class LogPage {
        public function getRcCommentIRC() {
                $rcComment = $this->ircActionText;
 
-               if( $this->comment != '' ) {
+               if ( $this->comment != '' ) {
                        if ( $rcComment == '' ) {
                                $rcComment = $this->comment;
                        } else {
@@ -198,7 +198,7 @@ class LogPage {
        public static function logName( $type ) {
                global $wgLogNames;
 
-               if( isset( $wgLogNames[$type] ) ) {
+               if ( isset( $wgLogNames[$type] ) ) {
                        return str_replace( '_', ' ', wfMessage( $wgLogNames[$type] )->text() );
                } else {
                        // Bogus log types? Perhaps an extension was removed.
@@ -247,13 +247,13 @@ class LogPage {
 
                $key = "$type/$action";
 
-               if( isset( $wgLogActions[$key] ) ) {
-                       if( is_null( $title ) ) {
+               if ( isset( $wgLogActions[$key] ) ) {
+                       if ( is_null( $title ) ) {
                                $rv = wfMessage( $wgLogActions[$key] )->inLanguage( $langObj )->escaped();
                        } else {
                                $titleLink = self::getTitleLink( $type, $langObjOrNull, $title, $params );
 
-                               if( count( $params ) == 0 ) {
+                               if ( count( $params ) == 0 ) {
                                        $rv = wfMessage( $wgLogActions[$key] )->rawParams( $titleLink )->inLanguage( $langObj )->escaped();
                                } else {
                                        $details = '';
@@ -273,14 +273,14 @@ class LogPage {
                                        // Page protections
                                        } elseif ( $type == 'protect' && count( $params ) == 3 ) {
                                                // Restrictions and expiries
-                                               if( $skin ) {
+                                               if ( $skin ) {
                                                        $details .= $wgLang->getDirMark() . htmlspecialchars( " {$params[1]}" );
                                                } else {
                                                        $details .= " {$params[1]}";
                                                }
 
                                                // Cascading flag...
-                                               if( $params[2] ) {
+                                               if ( $params[2] ) {
                                                        $details .= ' [' . wfMessage( 'protect-summary-cascade' )->inLanguage( $langObj )->text() . ']';
                                                }
                                        }
@@ -291,7 +291,7 @@ class LogPage {
                } else {
                        global $wgLogActionsHandlers;
 
-                       if( isset( $wgLogActionsHandlers[$key] ) ) {
+                       if ( isset( $wgLogActionsHandlers[$key] ) ) {
                                $args = func_get_args();
                                $rv = call_user_func_array( $wgLogActionsHandlers[$key], $args );
                        } else {
@@ -310,7 +310,7 @@ class LogPage {
                // you want to link to something OTHER than the title of the log entry.
                // The real problem, which Erik was trying to fix (and it sort-of works now) is
                // that the same messages are being treated as both wikitext *and* HTML.
-               if( $filterWikilinks ) {
+               if ( $filterWikilinks ) {
                        $rv = str_replace( '[[', '', $rv );
                        $rv = str_replace( ']]', '', $rv );
                }
@@ -327,7 +327,7 @@ class LogPage {
         * @return String
         */
        protected static function getTitleLink( $type, $lang, $title, &$params ) {
-               if( !$lang ) {
+               if ( !$lang ) {
                        return $title->getPrefixedText();
                }
 
@@ -353,7 +353,7 @@ class LogPage {
                                }
                                break;
                        case 'block':
-                               if( substr( $title->getText(), 0, 1 ) == '#' ) {
+                               if ( substr( $title->getText(), 0, 1 ) == '#' ) {
                                        $titleLink = $title->getText();
                                } else {
                                        // @todo Store the user identifier in the parameters
@@ -377,11 +377,11 @@ class LogPage {
                                $params[1] = $lang->timeanddate( $params[1] );
                                break;
                        default:
-                               if( $title->isSpecialPage() ) {
+                               if ( $title->isSpecialPage() ) {
                                        list( $name, $par ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
 
                                        # Use the language name for log titles, rather than Log/X
-                                       if( $name == 'Log' ) {
+                                       if ( $name == 'Log' ) {
                                                $logPage = new LogPage( $par );
                                                $titleLink = Linker::link( $title, $logPage->getName()->escaped() );
                                                $titleLink = wfMessage( 'parentheses' )
@@ -465,13 +465,13 @@ class LogPage {
         * @return Boolean
         */
        public function addRelations( $field, $values, $logid ) {
-               if( !strlen( $field ) || empty( $values ) ) {
+               if ( !strlen( $field ) || empty( $values ) ) {
                        return false; // nothing
                }
 
                $data = array();
 
-               foreach( $values as $value ) {
+               foreach ( $values as $value ) {
                        $data[] = array(
                                'ls_field' => $field,
                                'ls_value' => $value,
@@ -520,8 +520,8 @@ class LogPage {
        public static function formatBlockFlags( $flags, $lang ) {
                $flags = explode( ',', trim( $flags ) );
 
-               if( count( $flags ) > 0 ) {
-                       for( $i = 0; $i < count( $flags ); $i++ ) {
+               if ( count( $flags ) > 0 ) {
+                       for ( $i = 0; $i < count( $flags ); $i++ ) {
                                $flags[$i] = self::formatBlockFlag( $flags[$i], $lang );
                        }
                        return wfMessage( 'parentheses' )->inLanguage( $lang )
@@ -541,7 +541,7 @@ class LogPage {
        public static function formatBlockFlag( $flag, $lang ) {
                static $messages = array();
 
-               if( !isset( $messages[$flag] ) ) {
+               if ( !isset( $messages[$flag] ) ) {
                        $messages[$flag] = htmlspecialchars( $flag ); // Fallback
 
                        // For grepping. The following core messages can be used here:
index 908755e..5ffad43 100644 (file)
@@ -71,16 +71,17 @@ class LogPager extends ReverseChronologicalPager {
        public function getFilterParams() {
                global $wgFilterLogTypes;
                $filters = array();
-               if( count( $this->types ) ) {
+               if ( count( $this->types ) ) {
                        return $filters;
                }
-               foreach( $wgFilterLogTypes as $type => $default ) {
+               foreach ( $wgFilterLogTypes as $type => $default ) {
                        // Avoid silly filtering
-                       if( $type !== 'patrol' || $this->getUser()->useNPPatrol() ) {
+                       if ( $type !== 'patrol' || $this->getUser()->useNPPatrol() ) {
                                $hide = $this->getRequest()->getInt( "hide_{$type}_log", $default );
                                $filters[$type] = $hide;
-                               if( $hide )
+                               if ( $hide ) {
                                        $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type );
+                               }
                        }
                }
                return $filters;
@@ -98,11 +99,11 @@ class LogPager extends ReverseChronologicalPager {
 
                $user = $this->getUser();
                // If $types is not an array, make it an array
-               $types = ($types === '') ? array() : (array)$types;
+               $types = ( $types === '' ) ? array() : (array)$types;
                // Don't even show header for private logs; don't recognize it...
                $needReindex = false;
                foreach ( $types as $type ) {
-                       if( isset( $wgLogRestrictions[$type] )
+                       if ( isset( $wgLogRestrictions[$type] )
                                && !$user->isAllowed( $wgLogRestrictions[$type] )
                        ) {
                                $needReindex = true;
@@ -119,13 +120,15 @@ class LogPager extends ReverseChronologicalPager {
                // Also, only show them upon specific request to avoid suprises.
                $audience = $types ? 'user' : 'public';
                $hideLogs = LogEventsList::getExcludeClause( $this->mDb, $audience, $user );
-               if( $hideLogs !== false ) {
+               if ( $hideLogs !== false ) {
                        $this->mConds[] = $hideLogs;
                }
-               if( count( $types ) ) {
+               if ( count( $types ) ) {
                        $this->mConds['log_type'] = $types;
                        // Set typeCGI; used in url param for paging
-                       if( count( $types ) == 1 ) $this->typeCGI = $types[0];
+                       if ( count( $types ) == 1 ) {
+                               $this->typeCGI = $types[0];
+                       }
                }
        }
 
@@ -136,16 +139,16 @@ class LogPager extends ReverseChronologicalPager {
         * @return bool
         */
        private function limitPerformer( $name ) {
-               if( $name == '' ) {
+               if ( $name == '' ) {
                        return false;
                }
                $usertitle = Title::makeTitleSafe( NS_USER, $name );
-               if( is_null( $usertitle ) ) {
+               if ( is_null( $usertitle ) ) {
                        return false;
                }
                /* Fetch userid at first, if known, provides awesome query plan afterwards */
                $userid = User::idFromName( $name );
-               if( !$userid ) {
+               if ( !$userid ) {
                        /* It should be nicer to abort query at all,
                           but for now it won't pass anywhere behind the optimizer */
                        $this->mConds[] = "NULL";
@@ -153,9 +156,9 @@ class LogPager extends ReverseChronologicalPager {
                        $this->mConds['log_user'] = $userid;
                        // Paranoia: avoid brute force searches (bug 17342)
                        $user = $this->getUser();
-                       if( !$user->isAllowed( 'deletedhistory' ) ) {
+                       if ( !$user->isAllowed( 'deletedhistory' ) ) {
                                $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::DELETED_USER ) . ' = 0';
-                       } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
+                       } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
                                $this->mConds[] = $this->mDb->bitAnd( 'log_deleted', LogPage::SUPPRESSED_USER ) .
                                        ' != ' . LogPage::SUPPRESSED_USER;
                        }
@@ -178,7 +181,7 @@ class LogPager extends ReverseChronologicalPager {
                        $title = $page;
                } else {
                        $title = Title::newFromText( $page );
-                       if( strlen( $page ) == 0 || !$title instanceof Title ) {
+                       if ( strlen( $page ) == 0 || !$title instanceof Title ) {
                                return false;
                        }
                }
@@ -198,7 +201,7 @@ class LogPager extends ReverseChronologicalPager {
                # use the page_time index.  That should have no more than a few hundred
                # log entries for even the busiest pages, so it can be safely scanned
                # in full to satisfy an impossible condition on user or similar.
-               if( $pattern && !$wgMiserMode ) {
+               if ( $pattern && !$wgMiserMode ) {
                        $this->mConds['log_namespace'] = $ns;
                        $this->mConds[] = 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() );
                        $this->pattern = $pattern;
@@ -208,9 +211,9 @@ class LogPager extends ReverseChronologicalPager {
                }
                // Paranoia: avoid brute force searches (bug 17342)
                $user = $this->getUser();
-               if( !$user->isAllowed( 'deletedhistory' ) ) {
+               if ( !$user->isAllowed( 'deletedhistory' ) ) {
                        $this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::DELETED_ACTION) . ' = 0';
-               } elseif( !$user->isAllowed( 'suppressrevision' ) ) {
+               } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
                        $this->mConds[] = $db->bitAnd( 'log_deleted', LogPage::SUPPRESSED_ACTION) .
                                ' != ' . LogPage::SUPPRESSED_ACTION;
                }
@@ -234,7 +237,7 @@ class LogPager extends ReverseChronologicalPager {
                # Add log_search table if there are conditions on it.
                # This filters the results to only include log rows that have
                # log_search records with the specified ls_field and ls_value values.
-               if( array_key_exists( 'ls_field', $this->mConds ) ) {
+               if ( array_key_exists( 'ls_field', $this->mConds ) ) {
                        $tables[] = 'log_search';
                        $index['log_search'] = 'ls_field_val';
                        $index['logging'] = 'PRIMARY';
@@ -249,12 +252,12 @@ class LogPager extends ReverseChronologicalPager {
                # Avoid usage of the wrong index by limiting
                # the choices of available indexes. This mainly
                # avoids site-breaking filesorts.
-               } elseif( $this->title || $this->pattern || $this->performer ) {
+               } elseif ( $this->title || $this->pattern || $this->performer ) {
                        $index['logging'] = array( 'page_time', 'user_time' );
-                       if( count( $this->types ) == 1 ) {
+                       if ( count( $this->types ) == 1 ) {
                                $index['logging'][] = 'log_user_type_time';
                        }
-               } elseif( count( $this->types ) == 1 ) {
+               } elseif ( count( $this->types ) == 1 ) {
                        $index['logging'] = 'type_time';
                } else {
                        $index['logging'] = 'times';
@@ -264,10 +267,10 @@ class LogPager extends ReverseChronologicalPager {
                $joins['log_search'] = array( 'INNER JOIN', 'ls_log_id=log_id' );
 
                $info = array(
-                       'tables'     => $tables,
-                       'fields'     => $fields,
-                       'conds'      => array_merge( $conds, $this->mConds ),
-                       'options'    => $options,
+                       'tables' => $tables,
+                       'fields' => $fields,
+                       'conds' => array_merge( $conds, $this->mConds ),
+                       'options' => $options,
                        'join_conds' => $joins,
                );
                # Add ChangeTags filter query
@@ -295,7 +298,7 @@ class LogPager extends ReverseChronologicalPager {
        public function getStartBody() {
                wfProfileIn( __METHOD__ );
                # Do a link batch query
-               if( $this->getNumRows() > 0 ) {
+               if ( $this->getNumRows() > 0 ) {
                        $lb = new LinkBatch;
                        foreach ( $this->mResult as $row ) {
                                $lb->add( $row->log_namespace, $row->log_title );
index 8dafb4a..589b1ba 100644 (file)
@@ -73,7 +73,7 @@ class MoveLogFormatter extends LogFormatter {
                        array(
                                'wpOldTitle' => $destTitle->getPrefixedDBkey(),
                                'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
-                               'wpReason'   => $this->msg( 'revertmove' )->inContentLanguage()->text(),
+                               'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(),
                                'wpMovetalk' => 0
                        )
                );
index e1bacf3..99b7741 100644 (file)
@@ -58,7 +58,7 @@ class BmpHandler extends BitmapHandler {
         */
        function getImageSize( $image, $filename ) {
                $f = fopen( $filename, 'rb' );
-               if( !$f ) {
+               if ( !$f ) {
                        return false;
                }
                $header = fread( $f, 54 );
index 1d8337d..1ce3d5e 100644 (file)
@@ -398,7 +398,7 @@ class BitmapHandler extends ImageHandler {
                                        $im->sharpenImage( $radius, $sigma );
                                }
                                $im->setCompressionQuality( 80 );
-                       } elseif( $params['mimeType'] == 'image/png' ) {
+                       } elseif ( $params['mimeType'] == 'image/png' ) {
                                $im->setCompressionQuality( 95 );
                        } elseif ( $params['mimeType'] == 'image/gif' ) {
                                if ( $this->getImageArea( $image ) > $wgMaxAnimatedGifArea ) {
index 3876c52..555a414 100644 (file)
@@ -156,7 +156,7 @@ class BitmapMetadataHandler {
                        $meta->addMetadata( Array( 'JPEGFileComment' => $seg['COM'] ), 'native' );
                }
                if ( isset( $seg['PSIR'] ) && count( $seg['PSIR'] ) > 0 ) {
-                       foreach( $seg['PSIR'] as $curPSIRValue ) {
+                       foreach ( $seg['PSIR'] as $curPSIRValue ) {
                                $meta->doApp13( $curPSIRValue );
                        }
                }
@@ -286,7 +286,9 @@ class BitmapMetadataHandler {
         */
        static function getTiffByteOrder( $filename ) {
                $fh = fopen( $filename, 'rb' );
-               if ( !$fh ) return false;
+               if ( !$fh ) {
+                       return false;
+               }
                $head = fread( $fh, 2 );
                fclose( $fh );
 
index a7aa82f..8d4e033 100644 (file)
@@ -246,12 +246,11 @@ class DjVuHandler extends ImageHandler {
                        $image->dejaMetaTree = false;
                        $image->djvuTextTree = false;
                        $tree = new SimpleXMLElement( $metadata );
-                       if( $tree->getName() == 'mw-djvu' ) {
-                               foreach( $tree->children() as $b ) {
-                                       if( $b->getName() == 'DjVuTxt' ) {
+                       if ( $tree->getName() == 'mw-djvu' ) {
+                               foreach ( $tree->children() as $b ) {
+                                       if ( $b->getName() == 'DjVuTxt' ) {
                                                $image->djvuTextTree = $b;
-                                       }
-                                       elseif ( $b->getName() == 'DjVuXML' ) {
+                                       } elseif ( $b->getName() == 'DjVuXML' ) {
                                                $image->dejaMetaTree = $b;
                                        }
                                }
@@ -263,7 +262,7 @@ class DjVuHandler extends ImageHandler {
                }
                wfRestoreWarnings();
                wfProfileOut( __METHOD__ );
-               if( $gettext ) {
+               if ( $gettext ) {
                        return $image->djvuTextTree;
                } else {
                        return $image->dejaMetaTree;
index 5d31898..54efe7a 100644 (file)
@@ -64,7 +64,7 @@ class DjVuImage {
        public function getImageSize() {
                $data = $this->getInfo();
 
-               if( $data !== false ) {
+               if ( $data !== false ) {
                        $width = $data['width'];
                        $height = $data['height'];
 
@@ -93,20 +93,20 @@ class DjVuImage {
                $start = ftell( $file );
                $secondary = fread( $file, 4 );
                echo str_repeat( ' ', $indent * 4 ) . "($secondary)\n";
-               while( ftell( $file ) - $start < $length ) {
+               while ( ftell( $file ) - $start < $length ) {
                        $chunkHeader = fread( $file, 8 );
-                       if( $chunkHeader == '' ) {
+                       if ( $chunkHeader == '' ) {
                                break;
                        }
                        // @todo FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                        extract( unpack( 'a4chunk/NchunkLength', $chunkHeader ) );
                        echo str_repeat( ' ', $indent * 4 ) . "$chunk $chunkLength\n";
 
-                       if( $chunk == 'FORM' ) {
+                       if ( $chunk == 'FORM' ) {
                                $this->dumpForm( $file, $chunkLength, $indent + 1 );
                        } else {
                                fseek( $file, $chunkLength, SEEK_CUR );
-                               if( $chunkLength & 1 == 1 ) {
+                               if ( $chunkLength & 1 == 1 ) {
                                        // Padding byte between chunks
                                        fseek( $file, 1, SEEK_CUR );
                                }
@@ -118,7 +118,7 @@ class DjVuImage {
                wfSuppressWarnings();
                $file = fopen( $this->mFilename, 'rb' );
                wfRestoreWarnings();
-               if( $file === false ) {
+               if ( $file === false ) {
                        wfDebug( __METHOD__ . ": missing or failed file read\n" );
                        return false;
                }
@@ -126,21 +126,21 @@ class DjVuImage {
                $header = fread( $file, 16 );
                $info = false;
 
-               if( strlen( $header ) < 16 ) {
+               if ( strlen( $header ) < 16 ) {
                        wfDebug( __METHOD__ . ": too short file header\n" );
                } else {
                        // @todo FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
                        extract( unpack( 'a4magic/a4form/NformLength/a4subtype', $header ) );
 
-                       if( $magic != 'AT&T' ) {
+                       if ( $magic != 'AT&T' ) {
                                wfDebug( __METHOD__ . ": not a DjVu file\n" );
-                       } elseif( $subtype == 'DJVU' ) {
+                       } elseif ( $subtype == 'DJVU' ) {
                                // Single-page document
                                $info = $this->getPageInfo( $file, $formLength );
-                       } elseif( $subtype == 'DJVM' ) {
+                       } elseif ( $subtype == 'DJVM' ) {
                                // Multi-page document
                                $info = $this->getMultiPageInfo( $file, $formLength );
-                       } else  {
+                       } else {
                                wfDebug( __METHOD__ . ": unrecognized DJVU file type '$formType'\n" );
                        }
                }
@@ -150,7 +150,7 @@ class DjVuImage {
 
        private function readChunk( $file ) {
                $header = fread( $file, 8 );
-               if( strlen( $header ) < 8 ) {
+               if ( strlen( $header ) < 8 ) {
                        return array( false, 0 );
                } else {
                        // @todo FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
@@ -162,7 +162,7 @@ class DjVuImage {
        private function skipChunk( $file, $chunkLength ) {
                fseek( $file, $chunkLength, SEEK_CUR );
 
-               if( $chunkLength & 0x01 == 1 && !feof( $file ) ) {
+               if ( $chunkLength & 0x01 == 1 && !feof( $file ) ) {
                        // padding byte
                        fseek( $file, 1, SEEK_CUR );
                }
@@ -174,13 +174,13 @@ class DjVuImage {
                $start = ftell( $file );
                do {
                        list( $chunk, $length ) = $this->readChunk( $file );
-                       if( !$chunk ) {
+                       if ( !$chunk ) {
                                break;
                        }
 
-                       if( $chunk == 'FORM' ) {
+                       if ( $chunk == 'FORM' ) {
                                $subtype = fread( $file, 4 );
-                               if( $subtype == 'DJVU' ) {
+                               if ( $subtype == 'DJVU' ) {
                                        wfDebug( __METHOD__ . ": found first subpage\n" );
                                        return $this->getPageInfo( $file, $length );
                                }
@@ -189,7 +189,7 @@ class DjVuImage {
                                wfDebug( __METHOD__ . ": skipping '$chunk' chunk\n" );
                                $this->skipChunk( $file, $length );
                        }
-               } while( $length != 0 && !feof( $file ) && ftell( $file ) - $start < $formLength );
+               } while ( $length != 0 && !feof( $file ) && ftell( $file ) - $start < $formLength );
 
                wfDebug( __METHOD__ . ": multi-page DJVU file contained no pages\n" );
                return false;
@@ -197,17 +197,17 @@ class DjVuImage {
 
        private function getPageInfo( $file, $formLength ) {
                list( $chunk, $length ) = $this->readChunk( $file );
-               if( $chunk != 'INFO' ) {
+               if ( $chunk != 'INFO' ) {
                        wfDebug( __METHOD__ . ": expected INFO chunk, got '$chunk'\n" );
                        return false;
                }
 
-               if( $length < 9 ) {
+               if ( $length < 9 ) {
                        wfDebug( __METHOD__ . ": INFO should be 9 or 10 bytes, found $length\n" );
                        return false;
                }
                $data = fread( $file, $length );
-               if( strlen( $data ) < $length ) {
+               if ( strlen( $data ) < $length ) {
                        wfDebug( __METHOD__ . ": INFO chunk cut off\n" );
                        return false;
                }
@@ -263,7 +263,7 @@ class DjVuImage {
                        $retval = '';
                        $txt = wfShellExec( $cmd, $retval, array(), array( 'memory' => self::DJVUTXT_MEMORY_LIMIT ) );
                        wfProfileOut( 'djvutxt' );
-                       if( $retval == 0 ) {
+                       if ( $retval == 0 ) {
                                # Strip some control characters
                                $txt = preg_replace( "/[\013\035\037]/", "", $txt );
                                $reg = <<<EOR
index 5581503..6058f45 100644 (file)
@@ -297,7 +297,7 @@ class Exif {
                }
 
                $this->debugFile( $this->basename, __FUNCTION__, true );
-               if( function_exists( 'exif_read_data' ) ) {
+               if ( function_exists( 'exif_read_data' ) ) {
                        wfSuppressWarnings();
                        $data = exif_read_data( $this->file, 0, true );
                        wfRestoreWarnings();
@@ -738,19 +738,20 @@ class Exif {
                $debug = "tag is '$tag'";
                $etype = $this->mExifTags[$section][$tag];
                $ecount = 1;
-               if( is_array( $etype ) ) {
+               if ( is_array( $etype ) ) {
                        list( $etype, $ecount ) = $etype;
-                       if ( $recursive )
+                       if ( $recursive ) {
                                $ecount = 1; // checking individual elements
+                       }
                }
                $count = count( $val );
-               if( $ecount != $count ) {
+               if ( $ecount != $count ) {
                        $this->debug( $val, __FUNCTION__, "Expected $ecount elements for $tag but got $count" );
                        return false;
                }
-               if( $count > 1 ) {
-                       foreach( $val as $v ) {
-                               if( !$this->validate( $section, $tag, $v, true ) ) {
+               if ( $count > 1 ) {
+                       foreach ( $val as $v ) {
+                               if ( !$this->validate( $section, $tag, $v, true ) ) {
                                        return false;
                                }
                        }
index 5bcb484..3d153eb 100644 (file)
@@ -307,11 +307,11 @@ class FormatMetadata {
 
                                case 'Flash':
                                        $flashDecode = array(
-                                               'fired'    => $val & bindec( '00000001' ),
-                                               'return'   => ( $val & bindec( '00000110' ) ) >> 1,
-                                               'mode'     => ( $val & bindec( '00011000' ) ) >> 3,
+                                               'fired' => $val & bindec( '00000001' ),
+                                               'return' => ( $val & bindec( '00000110' ) ) >> 1,
+                                               'mode' => ( $val & bindec( '00011000' ) ) >> 3,
                                                'function' => ( $val & bindec( '00100000' ) ) >> 5,
-                                               'redeye'   => ( $val & bindec( '01000000' ) ) >> 6,
+                                               'redeye' => ( $val & bindec( '01000000' ) ) >> 6,
 //                                             'reserved' => ($val & bindec( '10000000' )) >> 7,
                                        );
                                        $flashMsgs = array();
@@ -1015,8 +1015,9 @@ class FormatMetadata {
        static function msg( $tag, $val, $arg = null, $arg2 = null ) {
                global $wgContLang;
 
-               if ( $val === '' )
+               if ( $val === '' ) {
                        $val = 'value';
+               }
                return wfMessage( $wgContLang->lc( "exif-$tag-$val" ), $arg, $arg2 )->text();
        }
 
@@ -1031,9 +1032,9 @@ class FormatMetadata {
        static function formatNum( $num, $round = false ) {
                global $wgLang;
                $m = array();
-               if( is_array( $num ) ) {
+               if ( is_array( $num ) ) {
                        $out = array();
-                       foreach( $num as $number ) {
+                       foreach ( $num as $number ) {
                                $out[] = self::formatNum( $number );
                        }
                        return $wgLang->commaList( $out );
@@ -1071,7 +1072,7 @@ class FormatMetadata {
                        $numerator = intval( $m[1] );
                        $denominator = intval( $m[2] );
                        $gcd = self::gcd( abs( $numerator ), $denominator );
-                       if( $gcd != 0 ) {
+                       if ( $gcd != 0 ) {
                                // 0 shouldn't happen! ;)
                                return self::formatNum( $numerator / $gcd ) . '/' . self::formatNum( $denominator / $gcd );
                        }
@@ -1096,7 +1097,7 @@ class FormatMetadata {
                        else
                                return gcd( $b, $a % $b );
                */
-               while( $b != 0 ) {
+               while ( $b != 0 ) {
                        $remainder = $a % $b;
 
                        // tail recursion...
@@ -1236,7 +1237,7 @@ class FormatMetadata {
         * @return String of html-ish looking wikitext
         */
        public static function collapseContactInfo( $vals ) {
-               if( !( isset( $vals['CiAdrExtadr'] )
+               if ( !( isset( $vals['CiAdrExtadr'] )
                        || isset( $vals['CiAdrCity'] )
                        || isset( $vals['CiAdrCtry'] )
                        || isset( $vals['CiEmailWork'] )
@@ -1254,7 +1255,7 @@ class FormatMetadata {
                        // because people often insert >, etc into
                        // the metadata which should not be interpreted
                        // but we still want to auto-link urls.
-                       foreach( $vals as &$val ) {
+                       foreach ( $vals as &$val ) {
                                $val = htmlspecialchars( $val );
                        }
                        return self::flattenArray( $vals );
index 2e532fe..4bb7208 100644 (file)
@@ -86,7 +86,7 @@ class GIFHandler extends BitmapHandler {
                $ser = $image->getMetadata();
                if ( $ser ) {
                        $metadata = unserialize( $ser );
-                       if( $metadata['frameCount'] > 1 ) {
+                       if ( $metadata['frameCount'] > 1 ) {
                                return true;
                        }
                }
index 6a46cc0..968a2cd 100644 (file)
@@ -90,7 +90,7 @@ class GIFMetadataExtractor {
                // Skip over the GCT
                self::readGCT( $fh, $bpp );
 
-               while( !feof( $fh ) ) {
+               while ( !feof( $fh ) ) {
                        $buf = fread( $fh, 1 );
 
                        if ( $buf == self::$gif_frame_sep ) {
@@ -110,7 +110,9 @@ class GIFMetadataExtractor {
                                self::skipBlock( $fh );
                        } elseif ( $buf == self::$gif_extension_sep ) {
                                $buf = fread( $fh, 1 );
-                               if ( strlen( $buf ) < 1 ) throw new Exception( "Ran out of input" );
+                               if ( strlen( $buf ) < 1 ) {
+                                       throw new Exception( "Ran out of input" );
+                               }
                                $extension_code = unpack( 'C', $buf );
                                $extension_code = $extension_code[1];
 
@@ -121,7 +123,9 @@ class GIFMetadataExtractor {
                                        fread( $fh, 1 ); // Transparency, disposal method, user input
 
                                        $buf = fread( $fh, 2 ); // Delay, in hundredths of seconds.
-                                       if ( strlen( $buf ) < 2 ) throw new Exception( "Ran out of input" );
+                                       if ( strlen( $buf ) < 2 ) {
+                                               throw new Exception( "Ran out of input" );
+                                       }
                                        $delay = unpack( 'v', $buf );
                                        $delay = $delay[1];
                                        $duration += $delay * 0.01;
@@ -129,7 +133,9 @@ class GIFMetadataExtractor {
                                        fread( $fh, 1 ); // Transparent colour index
 
                                        $term = fread( $fh, 1 ); // Should be a terminator
-                                       if ( strlen( $term ) < 1 ) throw new Exception( "Ran out of input" );
+                                       if ( strlen( $term ) < 1 ) {
+                                               throw new Exception( "Ran out of input" );
+                                       }
                                        $term = unpack( 'C', $term );
                                        $term = $term[1];
                                        if ( $term != 0 ) {
@@ -168,7 +174,9 @@ class GIFMetadataExtractor {
                                        // Application extension (Netscape info about the animated gif)
                                        // or XMP (or theoretically any other type of extension block)
                                        $blockLength = fread( $fh, 1 );
-                                       if ( strlen( $blockLength ) < 1 ) throw new Exception( "Ran out of input" );
+                                       if ( strlen( $blockLength ) < 1 ) {
+                                               throw new Exception( "Ran out of input" );
+                                       }
                                        $blockLength = unpack( 'C', $blockLength );
                                        $blockLength = $blockLength[1];
                                        $data = fread( $fh, $blockLength );
@@ -190,7 +198,9 @@ class GIFMetadataExtractor {
 
                                                // Unsigned little-endian integer, loop count or zero for "forever"
                                                $loopData = fread( $fh, 2 );
-                                               if ( strlen( $loopData ) < 2 ) throw new Exception( "Ran out of input" );
+                                               if ( strlen( $loopData ) < 2 ) {
+                                                       throw new Exception( "Ran out of input" );
+                                               }
                                                $loopData = unpack( 'v', $loopData );
                                                $loopCount = $loopData[1];
 
@@ -228,7 +238,9 @@ class GIFMetadataExtractor {
                        } elseif ( $buf == self::$gif_term ) {
                                break;
                        } else {
-                               if ( strlen( $buf ) < 1 ) throw new Exception( "Ran out of input" );
+                               if ( strlen( $buf ) < 1 ) {
+                                       throw new Exception( "Ran out of input" );
+                               }
                                $byte = unpack( 'C', $buf );
                                $byte = $byte[1];
                                throw new Exception( "At position: " . ftell( $fh ) . ", Unknown byte " . $byte );
@@ -251,7 +263,7 @@ class GIFMetadataExtractor {
         */
        static function readGCT( $fh, $bpp ) {
                if ( $bpp > 0 ) {
-                       for( $i = 1; $i <= pow( 2, $bpp ); ++$i ) {
+                       for ( $i = 1; $i <= pow( 2, $bpp ); ++$i ) {
                                fread( $fh, 3 );
                        }
                }
@@ -263,7 +275,9 @@ class GIFMetadataExtractor {
         * @return int
         */
        static function decodeBPP( $data ) {
-               if ( strlen( $data ) < 1 ) throw new Exception( "Ran out of input" );
+               if ( strlen( $data ) < 1 ) {
+                       throw new Exception( "Ran out of input" );
+               }
                $buf = unpack( 'C', $data );
                $buf = $buf[1];
                $bpp = ( $buf & 7 ) + 1;
@@ -281,7 +295,9 @@ class GIFMetadataExtractor {
        static function skipBlock( $fh ) {
                while ( !feof( $fh ) ) {
                        $buf = fread( $fh, 1 );
-                       if ( strlen( $buf ) < 1 ) throw new Exception( "Ran out of input" );
+                       if ( strlen( $buf ) < 1 ) {
+                               throw new Exception( "Ran out of input" );
+                       }
                        $block_len = unpack( 'C', $buf );
                        $block_len = $block_len[1];
                        if ( $block_len == 0 ) {
@@ -310,7 +326,7 @@ class GIFMetadataExtractor {
                $subLength = fread( $fh, 1 );
                $blocks = 0;
 
-               while( $subLength !== "\0" ) {
+               while ( $subLength !== "\0" ) {
                        $blocks++;
                        if ( $blocks > self::MAX_SUBBLOCKS ) {
                                throw new Exception( "MAX_SUBBLOCKS exceeded (over $blocks sub-blocks)" );
index d2bf1f3..8e46f2f 100644 (file)
@@ -92,7 +92,7 @@ abstract class ImageHandler extends MediaHandler {
 
                if ( !isset( $params['page'] ) ) {
                        $params['page'] = 1;
-               } else  {
+               } else {
                        if ( $params['page'] > $image->pageCount() ) {
                                $params['page'] = $image->pageCount();
                        }
@@ -160,7 +160,7 @@ abstract class ImageHandler extends MediaHandler {
                $width = intval( $width );
 
                # Sanity check $width
-               if( $width <= 0 ) {
+               if ( $width <= 0 ) {
                        wfDebug( __METHOD__ . ": Invalid destination width: $width\n" );
                        return false;
                }
@@ -189,7 +189,7 @@ abstract class ImageHandler extends MediaHandler {
                }
                $url = wfAppendQuery( $script, $this->getScriptParams( $params ) );
 
-               if( $image->mustRender() || $params['width'] < $image->getWidth() ) {
+               if ( $image->mustRender() || $params['width'] < $image->getWidth() ) {
                        return new ThumbnailImage( $image, $url, false, $params );
                }
        }
index cb0fbb3..1feb378 100644 (file)
@@ -71,7 +71,7 @@ class JpegHandler extends ExifBitmapHandler {
 
                $rotation = ( $params['rotation'] + $this->getRotation( $file ) ) % 360;
 
-               if( $wgJpegTran && is_file( $wgJpegTran ) ) {
+               if ( $wgJpegTran && is_file( $wgJpegTran ) ) {
                        $cmd = wfEscapeShellArg( $wgJpegTran ) .
                                " -rotate " . wfEscapeShellArg( $rotation ) .
                                " -outfile " . wfEscapeShellArg( $params['dstPath'] ) .
index 121652f..5165760 100644 (file)
@@ -87,7 +87,7 @@ class JpegMetadataExtractor {
                        }
 
                        $buffer = fread( $fh, 1 );
-                       while( $buffer === "\xFF" && !feof( $fh ) ) {
+                       while ( $buffer === "\xFF" && !feof( $fh ) ) {
                                // Skip through any 0xFF padding bytes.
                                $buffer = fread( $fh, 1 );
                        }
@@ -155,7 +155,9 @@ class JpegMetadataExtractor {
                        } else {
                                // segment we don't care about, so skip
                                $size = wfUnpack( "nint", fread( $fh, 2 ), 2 );
-                               if ( $size['int'] <= 2 ) throw new MWException( "invalid marker size in jpeg" );
+                               if ( $size['int'] <= 2 ) {
+                                       throw new MWException( "invalid marker size in jpeg" );
+                               }
                                fseek( $fh, $size['int'] - 2, SEEK_CUR );
                        }
 
@@ -243,7 +245,9 @@ class JpegMetadataExtractor {
                        // PHP can take issue with very large unsigned ints and make them negative.
                        // Which should never ever happen, as this has to be inside a segment
                        // which is limited to a 16 bit number.
-                       if ( $lenData['len'] < 0 ) throw new MWException( "Too big PSIR (" . $lenData['len'] . ')' );
+                       if ( $lenData['len'] < 0 ) {
+                               throw new MWException( "Too big PSIR (" . $lenData['len'] . ')' );
+                       }
 
                        $offset += 4; // 4bytes length field;
 
@@ -267,7 +271,9 @@ class JpegMetadataExtractor {
 
                        // if odd, add 1 to length to account for
                        // null pad byte.
-                       if ( $lenData['len'] % 2 == 1 ) $lenData['len']++;
+                       if ( $lenData['len'] % 2 == 1 ) {
+                               $lenData['len']++;
+                       }
                        $offset += $lenData['len'];
 
                }
index b67f3d3..b368906 100644 (file)
@@ -116,7 +116,9 @@ abstract class MediaHandler {
         * @param string $path the filename
         * @return String
         */
-       function getMetadata( $image, $path ) { return ''; }
+       function getMetadata( $image, $path ) {
+               return '';
+       }
 
        /**
         * Get metadata version.
@@ -166,7 +168,9 @@ abstract class MediaHandler {
         *
         * @return string
         */
-       function getMetadataType( $image ) { return false; }
+       function getMetadataType( $image ) {
+               return false;
+       }
 
        /**
         * Check if the metadata string is valid for this handler.
@@ -255,46 +259,69 @@ abstract class MediaHandler {
         * True if the handled types can be transformed
         * @return bool
         */
-       function canRender( $file ) { return true; }
+       function canRender( $file ) {
+               return true;
+       }
+
        /**
         * True if handled types cannot be displayed directly in a browser
         * but can be rendered
         * @return bool
         */
-       function mustRender( $file ) { return false; }
+       function mustRender( $file ) {
+               return false;
+       }
+
        /**
         * True if the type has multi-page capabilities
         * @return bool
         */
-       function isMultiPage( $file ) { return false; }
+       function isMultiPage( $file ) {
+               return false;
+       }
+
        /**
         * Page count for a multi-page document, false if unsupported or unknown
         * @return bool
         */
-       function pageCount( $file ) { return false; }
+       function pageCount( $file ) {
+               return false;
+       }
+
        /**
         * The material is vectorized and thus scaling is lossless
         * @return bool
         */
-       function isVectorized( $file ) { return false; }
+       function isVectorized( $file ) {
+               return false;
+       }
+
        /**
         * The material is an image, and is animated.
         * In particular, video material need not return true.
         * @note Before 1.20, this was a method of ImageHandler only
         * @return bool
         */
-       function isAnimatedImage( $file ) { return false; }
+       function isAnimatedImage( $file ) {
+               return false;
+       }
+
        /**
         * If the material is animated, we can animate the thumbnail
         * @since 1.20
         * @return bool If material is not animated, handler may return any value.
         */
-       function canAnimateThumbnail( $file ) { return true; }
+       function canAnimateThumbnail( $file ) {
+               return true;
+       }
+
        /**
         * False if the handler is disabled for all files
         * @return bool
         */
-       function isEnabled() { return true; }
+       function isEnabled() {
+               return true;
+       }
 
        /**
         * Get an associative array of page dimensions
@@ -394,9 +421,9 @@ abstract class MediaHandler {
        function visibleMetadataFields() {
                $fields = array();
                $lines = explode( "\n", wfMessage( 'metadata-fields' )->inContentLanguage()->text() );
-               foreach( $lines as $line ) {
+               foreach ( $lines as $line ) {
                        $matches = array();
-                       if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
+                       if ( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) {
                                $fields[] = $matches[1];
                        }
                }
@@ -496,7 +523,7 @@ abstract class MediaHandler {
        public static function fitBoxWidth( $boxWidth, $boxHeight, $maxHeight ) {
                $idealWidth = $boxWidth * $maxHeight / $boxHeight;
                $roundedUp = ceil( $idealWidth );
-               if( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
+               if ( round( $roundedUp * $boxHeight / $boxWidth ) > $maxHeight ) {
                        return floor( $idealWidth );
                } else {
                        return $roundedUp;
@@ -535,9 +562,9 @@ abstract class MediaHandler {
         * @return bool True if removed, false otherwise
         */
        function removeBadFile( $dstPath, $retval = 0 ) {
-               if( file_exists( $dstPath ) ) {
+               if ( file_exists( $dstPath ) ) {
                        $thumbstat = stat( $dstPath );
-                       if( $thumbstat['size'] == 0 || $retval != 0 ) {
+                       if ( $thumbstat['size'] == 0 || $retval != 0 ) {
                                $result = unlink( $dstPath );
 
                                if ( $result ) {
index 2616edb..1d197b1 100644 (file)
@@ -205,7 +205,7 @@ abstract class MediaTransformOutput {
                if ( $this->page && $this->page !== 1 ) {
                        $query = 'page=' . urlencode( $this->page );
                }
-               if( $params ) {
+               if ( $params ) {
                        $query .= $query ? '&' . $params : $params;
                }
                $attribs = array(
@@ -242,7 +242,7 @@ class ThumbnailImage extends MediaTransformOutput {
                # Previous parameters:
                #   $file, $url, $width, $height, $path = false, $page = false
 
-               if( is_array( $parameters ) ) {
+               if ( is_array( $parameters ) ) {
                        $defaults = array(
                                'page' => false
                        );
index b8a5b40..9dfd5d1 100644 (file)
@@ -76,7 +76,9 @@ class PNGHandler extends BitmapHandler {
                $ser = $image->getMetadata();
                if ( $ser ) {
                        $metadata = unserialize( $ser );
-                       if( $metadata['frameCount'] > 1 ) return true;
+                       if ( $metadata['frameCount'] > 1 ) {
+                               return true;
+                       }
                }
                return false;
        }
@@ -129,8 +131,9 @@ class PNGHandler extends BitmapHandler {
                $metadata = unserialize( $image->getMetadata() );
                wfRestoreWarnings();
 
-               if( !$metadata || $metadata['frameCount'] <= 0 )
+               if ( !$metadata || $metadata['frameCount'] <= 0 ) {
                        return $original;
+               }
 
                $info = array();
                $info[] = $original;
index e65a558..d2e2cc9 100644 (file)
@@ -142,7 +142,7 @@ class PNGMetadataExtractor {
                                }
                        } elseif ( $chunk_type == "acTL" ) {
                                $buf = fread( $fh, $chunk_size );
-                               if( !$buf || strlen( $buf ) < $chunk_size || $chunk_size < 4 ) {
+                               if ( !$buf || strlen( $buf ) < $chunk_size || $chunk_size < 4 ) {
                                        throw new Exception( __METHOD__ . ": Read error" );
                                }
 
index cddab51..423e756 100644 (file)
@@ -56,7 +56,7 @@ class SvgHandler extends ImageHandler {
                $metadata = $file->getMetadata();
                if ( $metadata ) {
                        $metadata = $this->unpackMetadata( $metadata );
-                       if( isset( $metadata['animated'] ) ) {
+                       if ( isset( $metadata['animated'] ) ) {
                                return $metadata['animated'];
                        }
                }
@@ -267,7 +267,7 @@ class SvgHandler extends ImageHandler {
                        // File not found, broken, etc.
                        $metadata['error'] = array(
                                'message' => $e->getMessage(),
-                               'code'    => $e->getCode()
+                               'code' => $e->getCode()
                        );
                        wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
                }
index 592403a..c9a20f2 100644 (file)
@@ -128,7 +128,7 @@ class SVGReader {
                $keepReading = $this->reader->read();
 
                /* Skip until first element */
-               while( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) {
+               while ( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) {
                        $keepReading = $this->reader->read();
                }
 
@@ -187,14 +187,14 @@ class SVGReader {
         */
        private function readField( $name, $metafield = null ) {
                $this->debug( "Read field $metafield" );
-               if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
+               if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
                        return;
                }
                $keepReading = $this->reader->read();
-               while( $keepReading ) {
-                       if( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
+               while ( $keepReading ) {
+                       if ( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
                                break;
-                       } elseif( $this->reader->nodeType == XmlReader::TEXT ) {
+                       } elseif ( $this->reader->nodeType == XmlReader::TEXT ) {
                                $this->metadata[$metafield] = trim( $this->reader->value );
                        }
                        $keepReading = $this->reader->read();
@@ -209,11 +209,11 @@ class SVGReader {
         */
        private function readXml( $metafield = null ) {
                $this->debug( "Read top level metadata" );
-               if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
+               if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) {
                        return;
                }
                // TODO: find and store type of xml snippet. metadata['metadataType'] = "rdf"
-               if( method_exists( $this->reader, 'readInnerXML' ) ) {
+               if ( method_exists( $this->reader, 'readInnerXML' ) ) {
                        $this->metadata[$metafield] = trim( $this->reader->readInnerXML() );
                } else {
                        throw new MWException( "The PHP XMLReader extension does not come with readInnerXML() method. Your libxml is probably out of date (need 2.6.20 or later)." );
@@ -228,7 +228,7 @@ class SVGReader {
         */
        private function animateFilter( $name ) {
                $this->debug( "animate filter for tag $name" );
-               if( $this->reader->nodeType != XmlReader::ELEMENT ) {
+               if ( $this->reader->nodeType != XmlReader::ELEMENT ) {
                        return;
                }
                if ( $this->reader->isEmptyElement ) {
@@ -236,8 +236,8 @@ class SVGReader {
                }
                $exitDepth = $this->reader->depth;
                $keepReading = $this->reader->read();
-               while( $keepReading ) {
-                       if( $this->reader->localName == $name && $this->reader->depth <= $exitDepth
+               while ( $keepReading ) {
+                       if ( $this->reader->localName == $name && $this->reader->depth <= $exitDepth
                                && $this->reader->nodeType == XmlReader::END_ELEMENT ) {
                                break;
                        } elseif ( $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::ELEMENT ) {
@@ -267,7 +267,7 @@ class SVGReader {
        }
 
        private function debug( $data ) {
-               if( $this->mDebug ) {
+               if ( $this->mDebug ) {
                        wfDebug( "SVGReader: $data\n" );
                }
        }
@@ -292,37 +292,37 @@ class SVGReader {
                $width = null;
                $height = null;
 
-               if( $this->reader->getAttribute( 'viewBox' ) ) {
+               if ( $this->reader->getAttribute( 'viewBox' ) ) {
                        // min-x min-y width height
                        $viewBox = preg_split( '/\s+/', trim( $this->reader->getAttribute( 'viewBox' ) ) );
-                       if( count( $viewBox ) == 4 ) {
+                       if ( count( $viewBox ) == 4 ) {
                                $viewWidth = $this->scaleSVGUnit( $viewBox[2] );
                                $viewHeight = $this->scaleSVGUnit( $viewBox[3] );
-                               if( $viewWidth > 0 && $viewHeight > 0 ) {
+                               if ( $viewWidth > 0 && $viewHeight > 0 ) {
                                        $aspect = $viewWidth / $viewHeight;
                                        $defaultHeight = $defaultWidth / $aspect;
                                }
                        }
                }
-               if( $this->reader->getAttribute( 'width' ) ) {
+               if ( $this->reader->getAttribute( 'width' ) ) {
                        $width = $this->scaleSVGUnit( $this->reader->getAttribute( 'width' ), $defaultWidth );
                        $this->metadata['originalWidth'] = $this->reader->getAttribute( 'width' );
                }
-               if( $this->reader->getAttribute( 'height' ) ) {
+               if ( $this->reader->getAttribute( 'height' ) ) {
                        $height = $this->scaleSVGUnit( $this->reader->getAttribute( 'height' ), $defaultHeight );
                        $this->metadata['originalHeight'] = $this->reader->getAttribute( 'height' );
                }
 
-               if( !isset( $width ) && !isset( $height ) ) {
+               if ( !isset( $width ) && !isset( $height ) ) {
                        $width = $defaultWidth;
                        $height = $width / $aspect;
-               } elseif( isset( $width ) && !isset( $height ) ) {
+               } elseif ( isset( $width ) && !isset( $height ) ) {
                        $height = $width / $aspect;
-               } elseif( isset( $height ) && !isset( $width ) ) {
+               } elseif ( isset( $height ) && !isset( $width ) ) {
                        $width = $height * $aspect;
                }
 
-               if( $width > 0 && $height > 0 ) {
+               if ( $width > 0 && $height > 0 ) {
                        $this->metadata['width'] = intval( round( $width ) );
                        $this->metadata['height'] = intval( round( $height ) );
                }
@@ -346,13 +346,13 @@ class SVGReader {
                        'in' => 90.0,
                        'em' => 16.0, // fake it?
                        'ex' => 12.0, // fake it?
-                       ''   => 1.0, // "User units" pixels by default
+                       '' => 1.0, // "User units" pixels by default
                        );
                $matches = array();
-               if( preg_match( '/^\s*(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)\s*$/', $length, $matches ) ) {
+               if ( preg_match( '/^\s*(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)\s*$/', $length, $matches ) ) {
                        $length = floatval( $matches[1] );
                        $unit = $matches[2];
-                       if( $unit == '%' ) {
+                       if ( $unit == '%' ) {
                                return $length * 0.01 * $viewportSize;
                        } else {
                                return $length * $unitLength[$unit];
index ba38d15..8872d73 100644 (file)
@@ -78,7 +78,7 @@ class XCFHandler extends BitmapHandler {
        static function getXCFMetaData( $filename ) {
                # Decode master structure
                $f = fopen( $filename, 'rb' );
-               if( !$f ) {
+               if ( !$f ) {
                        return false;
                }
                # The image structure always starts at offset 0 in the XCF file.
@@ -115,7 +115,7 @@ class XCFHandler extends BitmapHandler {
                }
 
                # Check values
-               if( $header['magic'] !== 'gimp xcf' ) {
+               if ( $header['magic'] !== 'gimp xcf' ) {
                        wfDebug( __METHOD__ . " '$filename' has invalid magic signature.\n" );
                        return false;
                }
index 081433b..b2b95e4 100644 (file)
@@ -180,12 +180,12 @@ class XMPReader {
                ) {
                        // the is_array is just paranoia. It should always
                        // be an array.
-                       foreach( $data['xmp-special']['LocationShown'] as $loc ) {
+                       foreach ( $data['xmp-special']['LocationShown'] as $loc ) {
                                if ( !is_array( $loc ) ) {
                                        // To avoid copying over the _type meta-fields.
                                        continue;
                                }
-                               foreach( $loc as $field => $val ) {
+                               foreach ( $loc as $field => $val ) {
                                        $data['xmp-general'][$field . 'Dest'][] = $val;
                                }
                        }
@@ -195,12 +195,12 @@ class XMPReader {
                ) {
                        // the is_array is just paranoia. It should always
                        // be an array.
-                       foreach( $data['xmp-special']['LocationCreated'] as $loc ) {
+                       foreach ( $data['xmp-special']['LocationCreated'] as $loc ) {
                                if ( !is_array( $loc ) ) {
                                        // To avoid copying over the _type meta-fields.
                                        continue;
                                }
-                               foreach( $loc as $field => $val ) {
+                               foreach ( $loc as $field => $val ) {
                                        $data['xmp-general'][$field . 'Created'][] = $val;
                                }
                        }
@@ -391,7 +391,9 @@ class XMPReader {
                        throw new MWException( 'Unexpected character data before first rdf:Description element' );
                }
 
-               if ( $this->mode[0] === self::MODE_IGNORE ) return;
+               if ( $this->mode[0] === self::MODE_IGNORE ) {
+                       return;
+               }
 
                if ( $this->mode[0] !== self::MODE_SIMPLE
                        && $this->mode[0] !== self::MODE_QDESC
index feacc2a..f0b2cb5 100644 (file)
@@ -32,7 +32,7 @@ class XMPInfo {
         * @return Array XMP item configuration array.
         */
        public static function getItems() {
-               if( !self::$ranHooks ) {
+               if ( !self::$ranHooks ) {
                        // This is for if someone makes a custom metadata extension.
                        // For example, a medical wiki might want to decode DICOM xmp properties.
                        wfRunHooks( 'XMPGetInfo', Array( &self::$items ) );
index fbde251..58ddd6a 100644 (file)
@@ -187,7 +187,7 @@ abstract class BagOStuff {
                        }
                        usleep( $sleep ); // back off
                        $locked = $this->add( "{$key}:lock", $timeout );
-               } while( !$locked );
+               } while ( !$locked );
 
                return $locked;
        }
index 3f1fa3a..f1644ed 100644 (file)
@@ -43,7 +43,7 @@ class MemcachedBagOStuff extends BagOStuff {
                if ( !isset( $params['persistent'] ) ) {
                        $params['persistent'] = $GLOBALS['wgMemCachedPersistent'];
                }
-               if  ( !isset( $params['compress_threshold'] ) ) {
+               if ( !isset( $params['compress_threshold'] ) ) {
                        $params['compress_threshold'] = 1500;
                }
                if ( !isset( $params['timeout'] ) ) {
index bc2acb3..f4c034a 100644 (file)
@@ -329,7 +329,7 @@ class MWMemcached {
                        $this->stats['delete'] = 1;
                }
                $cmd = "delete $key $time\r\n";
-               if( !$this->_fwrite( $sock, $cmd ) ) {
+               if ( !$this->_fwrite( $sock, $cmd ) ) {
                        return false;
                }
                $res = $this->_fgets( $sock );
@@ -733,7 +733,7 @@ class MWMemcached {
                $sock = false;
                $timeout = $this->_connect_timeout;
                $errno = $errstr = null;
-               for( $i = 0; !$sock && $i < $this->_connect_attempts; $i++ ) {
+               for ( $i = 0; !$sock && $i < $this->_connect_attempts; $i++ ) {
                        wfSuppressWarnings();
                        if ( $this->_persistent == 1 ) {
                                $sock = pfsockopen( $ip, $port, $errno, $errstr, $timeout );
@@ -810,7 +810,7 @@ class MWMemcached {
                        $bu = array();
                        foreach ( $this->_servers as $v ) {
                                if ( is_array( $v ) ) {
-                                       for( $i = 0; $i < $v[1]; $i++ ) {
+                                       for ( $i = 0; $i < $v[1]; $i++ ) {
                                                $bu[] = $v[0];
                                        }
                                } else {
@@ -822,7 +822,7 @@ class MWMemcached {
                }
 
                $realkey = is_array( $key ) ? $key[1] : $key;
-               for( $tries = 0; $tries < 20; $tries++ ) {
+               for ( $tries = 0; $tries < 20; $tries++ ) {
                        $host = $this->_buckets[$hv % $this->_bucketcount];
                        $sock = $this->sock_to_host( $host );
                        if ( is_resource( $sock ) ) {
@@ -912,7 +912,7 @@ class MWMemcached {
                while ( 1 ) {
                        $decl = $this->_fgets( $sock );
 
-                       if( $decl === false ) {
+                       if ( $decl === false ) {
                                /*
                                 * If nothing can be read, something is wrong because we know exactly when
                                 * to stop reading (right after "END") and we return right after that.
index eafa836..f7247f9 100644 (file)
@@ -125,9 +125,9 @@ class ObjectCache {
        static function newAccelerator( $params ) {
                if ( function_exists( 'apc_fetch' ) ) {
                        $id = 'apc';
-               } elseif( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
+               } elseif ( function_exists( 'xcache_get' ) && wfIniGetBool( 'xcache.var_size' ) ) {
                        $id = 'xcache';
-               } elseif( function_exists( 'wincache_ucache_get' ) ) {
+               } elseif ( function_exists( 'wincache_ucache_get' ) ) {
                        $id = 'wincache';
                } else {
                        throw new MWException( "CACHE_ACCEL requested but no suitable object " .
index bc76294..7cf960e 100644 (file)
@@ -94,7 +94,7 @@ class ObjectCacheSessionHandler {
         */
        static function read( $id ) {
                $data = self::getCache()->get( self::getKey( $id ) );
-               if( $data === false ) {
+               if ( $data === false ) {
                        return '';
                }
                return $data;
index 6b70e1d..8190a8a 100644 (file)
@@ -93,7 +93,7 @@ class CacheTime {
                        $expire = min( $expire, $wgParserCacheExpireTime );
                }
 
-               if( $this->containsOldMagic() ) { //compatibility hack
+               if ( $this->containsOldMagic() ) { //compatibility hack
                        $expire = min( $expire, 3600 ); # 1 hour
                }
 
index 36bfb48..5b02e19 100644 (file)
@@ -138,8 +138,9 @@ class CoreParserFunctions {
 
                // Specify a different default date format other than the the normal default
                // iff the user has 'default' for their setting
-               if ( $pref == 'default' && $defaultPref )
+               if ( $pref == 'default' && $defaultPref ) {
                        $pref = $defaultPref;
+               }
 
                $date = $df->reformat( $pref, $date, array( 'match-whole' ) );
                return $date;
@@ -248,14 +249,15 @@ class CoreParserFunctions {
                # before arriving here; if that's true, then the title can't be created
                # and the variable will fail. If we can't get a decent title from the first
                # attempt, url-decode and try for a second.
-               if( is_null( $title ) )
+               if ( is_null( $title ) ) {
                        $title = Title::newFromURL( urldecode( $s ) );
-               if( !is_null( $title ) ) {
+               }
+               if ( !is_null( $title ) ) {
                        # Convert NS_MEDIA -> NS_FILE
-                       if( $title->getNamespace() == NS_MEDIA ) {
+                       if ( $title->getNamespace() == NS_MEDIA ) {
                                $title = Title::makeTitle( NS_FILE, $title->getDBkey() );
                        }
-                       if( !is_null( $arg ) ) {
+                       if ( !is_null( $arg ) ) {
                                $text = $title->$func( $arg );
                        } else {
                                $text = $title->$func();
@@ -377,12 +379,10 @@ class CoreParserFunctions {
                $text = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $text, null, array(), array(), $bad ) );
                $title = Title::newFromText( Sanitizer::stripAllTags( $text ) );
 
-               if( !$wgRestrictDisplayTitle ) {
+               if ( !$wgRestrictDisplayTitle ) {
+                       $parser->mOutput->setDisplayTitle( $text );
+               } elseif ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) {
                        $parser->mOutput->setDisplayTitle( $text );
-               } else {
-                       if ( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) {
-                               $parser->mOutput->setDisplayTitle( $text );
-                       }
                }
 
                return '';
@@ -404,7 +404,7 @@ class CoreParserFunctions {
        }
 
        static function formatRaw( $num, $raw ) {
-               if( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
+               if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
                        return $num;
                } else {
                        global $wgContLang;
@@ -451,44 +451,51 @@ class CoreParserFunctions {
         */
        static function mwnamespace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return str_replace( '_', ' ', $t->getNsText() );
        }
        static function namespacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfUrlencode( $t->getNsText() );
        }
        static function namespacenumber( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return $t->getNamespace();
        }
        static function talkspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return str_replace( '_', ' ', $t->getTalkNsText() );
        }
        static function talkspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return wfUrlencode( $t->getTalkNsText() );
        }
        static function subjectspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return str_replace( '_', ' ', $t->getSubjectNsText() );
        }
        static function subjectspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfUrlencode( $t->getSubjectNsText() );
        }
 
@@ -499,74 +506,86 @@ class CoreParserFunctions {
         */
        static function pagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getText() );
        }
        static function pagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getPartialURL() );
        }
        static function fullpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getPrefixedText() );
        }
        static function fullpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getPrefixedURL() );
        }
        static function subpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getSubpageText() );
        }
        static function subpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getSubpageUrlForm() );
        }
        static function basepagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getBaseText() );
        }
        static function basepagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
        }
        static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
        }
        static function talkpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() )
+               if ( is_null( $t ) || !$t->canTalk() ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
        }
        static function subjectpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
        }
        static function subjectpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) )
+               if ( is_null( $t ) ) {
                        return '';
+               }
                return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedURL() );
        }
 
@@ -589,7 +608,7 @@ class CoreParserFunctions {
                static $cache = array();
 
                // split the given option to its variable
-               if( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
+               if ( self::matchAgainstMagicword( 'rawsuffix', $arg1 ) ) {
                        //{{pagesincategory:|raw[|type]}}
                        $raw = $arg1;
                        $type = $magicWords->matchStartToEnd( $arg2 );
@@ -598,23 +617,23 @@ class CoreParserFunctions {
                        $type = $magicWords->matchStartToEnd( $arg1 );
                        $raw = $arg2;
                }
-               if( !$type ) { //backward compatibility
+               if ( !$type ) { //backward compatibility
                        $type = 'pagesincategory_all';
                }
 
                $title = Title::makeTitleSafe( NS_CATEGORY, $name );
-               if( !$title ) { # invalid title
+               if ( !$title ) { # invalid title
                        return self::formatRaw( 0, $raw );
                }
 
                // Normalize name for cache
                $name = $title->getDBkey();
 
-               if( !isset( $cache[$name] ) ) {
+               if ( !isset( $cache[$name] ) ) {
                        $category = Category::newFromTitle( $title );
 
                        $allCount = $subcatCount = $fileCount = $pagesCount = 0;
-                       if( $parser->incrementExpensiveFunctionCount() ) {
+                       if ( $parser->incrementExpensiveFunctionCount() ) {
                                // $allCount is the total number of cat members,
                                // not the count of how many members are normal pages.
                                $allCount = (int)$category->getPageCount();
@@ -653,7 +672,7 @@ class CoreParserFunctions {
                static $cache = array();
                $title = Title::newFromText( $page );
 
-               if( !is_object( $title ) ) {
+               if ( !is_object( $title ) ) {
                        $cache[$page] = 0;
                        return self::formatRaw( 0, $raw );
                }
@@ -662,9 +681,9 @@ class CoreParserFunctions {
                $page = $title->getPrefixedText();
 
                $length = 0;
-               if( isset( $cache[$page] ) ) {
+               if ( isset( $cache[$page] ) ) {
                        $length = $cache[$page];
-               } elseif( $parser->incrementExpensiveFunctionCount() ) {
+               } elseif ( $parser->incrementExpensiveFunctionCount() ) {
                        $rev = Revision::newFromTitle( $title, false, Revision::READ_NORMAL );
                        $pageID = $rev ? $rev->getPage() : 0;
                        $revID = $rev ? $rev->getId() : 0;
@@ -717,7 +736,9 @@ class CoreParserFunctions {
        static function pad( $parser, $string, $length, $padding = '0', $direction = STR_PAD_RIGHT ) {
                $padding = $parser->killMarkers( $padding );
                $lengthOfPadding = mb_strlen( $padding );
-               if ( $lengthOfPadding == 0 ) return $string;
+               if ( $lengthOfPadding == 0 ) {
+                       return $string;
+               }
 
                # The remaining length to add counts down to 0 as padding is added
                $length = min( $length, 500 ) - mb_strlen( $string );
@@ -786,14 +807,15 @@ class CoreParserFunctions {
                $arg = $magicWords->matchStartToEnd( $uarg );
 
                $text = trim( $text );
-               if( strlen( $text ) == 0 )
+               if ( strlen( $text ) == 0 ) {
                        return '';
+               }
                $old = $parser->getCustomDefaultSort();
                if ( $old === false || $arg !== 'defaultsort_noreplace' ) {
                        $parser->setDefaultSort( $text );
                }
 
-               if( $old === false || $old == $text || $arg ) {
+               if ( $old === false || $old == $text || $arg ) {
                        return '';
                } else {
                        return( '<span class="error">' .
@@ -807,14 +829,14 @@ class CoreParserFunctions {
        public static function filepath( $parser, $name = '', $argA = '', $argB = '' ) {
                $file = wfFindFile( $name );
 
-               if( $argA == 'nowiki' ) {
+               if ( $argA == 'nowiki' ) {
                        // {{filepath: | option [| size] }}
                        $isNowiki = true;
                        $parsedWidthParam = $parser->parseWidthParam( $argB );
                } else {
                        // {{filepath: [| size [|option]] }}
                        $parsedWidthParam = $parser->parseWidthParam( $argA );
-                       $isNowiki = ($argB == 'nowiki');
+                       $isNowiki = ( $argB == 'nowiki' );
                }
 
                if ( $file ) {
index 6505183..a2eb698 100644 (file)
@@ -77,7 +77,7 @@ class CoreTagHooks {
         */
        static function html( $content, $attributes, $parser ) {
                global $wgRawHtml;
-               if( $wgRawHtml ) {
+               if ( $wgRawHtml ) {
                        return array( $content, 'markerType' => 'nowiki' );
                } else {
                        throw new MWException( '<html> extension tag encountered unexpectedly' );
index 8103b60..c5dd09b 100644 (file)
@@ -198,8 +198,9 @@ class DateFormatter {
        function replace( $matches ) {
                # Extract information from $matches
                $linked = true;
-               if ( isset( $this->mLinked ) )
+               if ( isset( $this->mLinked ) ) {
                        $linked = $this->mLinked;
+               }
 
                $bits = array();
                $key = $this->keys[$this->mSource];
@@ -232,10 +233,12 @@ class DateFormatter {
                $fail = false;
 
                // Pre-generate y/Y stuff because we need the year for the <span> title.
-               if ( !isset( $bits['y'] ) && isset( $bits['Y'] ) )
+               if ( !isset( $bits['y'] ) && isset( $bits['Y'] ) ) {
                        $bits['y'] = $this->makeIsoYear( $bits['Y'] );
-               if ( !isset( $bits['Y'] ) && isset( $bits['y'] ) )
+               }
+               if ( !isset( $bits['Y'] ) && isset( $bits['y'] ) ) {
                        $bits['Y'] = $this->makeNormalYear( $bits['y'] );
+               }
 
                if ( !isset( $bits['m'] ) ) {
                        $m = $this->makeIsoMonth( $bits['F'] );
@@ -293,8 +296,9 @@ class DateFormatter {
                }
 
                $isoBits = array();
-               if ( isset( $bits['y'] ) )
+               if ( isset( $bits['y'] ) ) {
                        $isoBits[] = $bits['y'];
+               }
                $isoBits[] = $bits['m'];
                $isoBits[] = $bits['d'];
                $isoDate = implode( '-', $isoBits );
@@ -312,7 +316,7 @@ class DateFormatter {
         */
        function getMonthRegex() {
                $names = array();
-               for( $i = 1; $i <= 12; $i++ ) {
+               for ( $i = 1; $i <= 12; $i++ ) {
                        $names[] = $this->lang->getMonthName( $i );
                        $names[] = $this->lang->getMonthAbbreviation( $i );
                }
index f125510..6fc457d 100644 (file)
@@ -322,7 +322,7 @@ class LinkHolderArray {
                }
                if ( $queries ) {
                        $where = array();
-                       foreach( $queries as $ns => $pages ) {
+                       foreach ( $queries as $ns => $pages ) {
                                $where[] = $dbr->makeList(
                                        array(
                                                'page_namespace' => $ns,
@@ -362,7 +362,7 @@ class LinkHolderArray {
                wfProfileOut( __METHOD__ . '-check' );
 
                # Do a second query for different language variants of links and categories
-               if( $wgContLang->hasVariants() ) {
+               if ( $wgContLang->hasVariants() ) {
                        $this->doVariants( $colours );
                }
 
@@ -425,7 +425,7 @@ class LinkHolderArray {
                # Make interwiki link HTML
                $output = $this->parent->getOutput();
                $replacePairs = array();
-               foreach( $this->interwikis as $key => $link ) {
+               foreach ( $this->interwikis as $key => $link ) {
                        $replacePairs[$key] = Linker::link( $link['title'], $link['text'] );
                        $output->addInterwikiLink( $link['title'] );
                }
@@ -486,7 +486,7 @@ class LinkHolderArray {
                                $textVariant = $titlesAllVariants[$variantName][$i];
                                if ( $textVariant != $titlesAttrs[$i]['titleText'] ) {
                                        $variantTitle = Title::makeTitle( $titlesAttrs[$i]['ns'], $textVariant );
-                                       if( is_null( $variantTitle ) ) {
+                                       if ( is_null( $variantTitle ) ) {
                                                continue;
                                        }
                                        $linkBatch->addObj( $variantTitle );
@@ -514,7 +514,7 @@ class LinkHolderArray {
                        }
                }
 
-               if( !$linkBatch->isEmpty() ) {
+               if ( !$linkBatch->isEmpty() ) {
                        // construct query
                        $dbr = wfGetDB( DB_SLAVE );
                        $varRes = $dbr->select( 'page',
@@ -533,14 +533,14 @@ class LinkHolderArray {
                                $vardbk = $variantTitle->getDBkey();
 
                                $holderKeys = array();
-                               if( isset( $variantMap[$varPdbk] ) ) {
+                               if ( isset( $variantMap[$varPdbk] ) ) {
                                        $holderKeys = $variantMap[$varPdbk];
                                        $linkCache->addGoodLinkObjFromRow( $variantTitle, $s );
                                        $output->addLink( $variantTitle, $s->page_id );
                                }
 
                                // loop over link holders
-                               foreach( $holderKeys as $key ) {
+                               foreach ( $holderKeys as $key ) {
                                        list( $ns, $index ) = explode( ':', $key, 2 );
                                        $entry =& $this->internals[$ns][$index];
                                        $pdbk = $entry['pdbk'];
@@ -570,12 +570,12 @@ class LinkHolderArray {
                        wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
 
                        // rebuild the categories in original order (if there are replacements)
-                       if( count( $varCategories ) > 0 ) {
+                       if ( count( $varCategories ) > 0 ) {
                                $newCats = array();
                                $originalCats = $output->getCategories();
-                               foreach( $originalCats as $cat => $sortkey ) {
+                               foreach ( $originalCats as $cat => $sortkey ) {
                                        // make the replacement
-                                       if( array_key_exists( $cat, $varCategories ) ) {
+                                       if ( array_key_exists( $cat, $varCategories ) ) {
                                                $newCats[$varCategories[$cat]] = $sortkey;
                                        } else {
                                                $newCats[$cat] = $sortkey;
@@ -615,13 +615,13 @@ class LinkHolderArray {
        function replaceTextCallback( $matches ) {
                $type = $matches[1];
                $key = $matches[2];
-               if( $type == 'LINK' ) {
+               if ( $type == 'LINK' ) {
                        list( $ns, $index ) = explode( ':', $key, 2 );
-                       if( isset( $this->internals[$ns][$index]['text'] ) ) {
+                       if ( isset( $this->internals[$ns][$index]['text'] ) ) {
                                return $this->internals[$ns][$index]['text'];
                        }
-               } elseif( $type == 'IWLINK' ) {
-                       if( isset( $this->interwikis[$key]['text'] ) ) {
+               } elseif ( $type == 'IWLINK' ) {
+                       if ( isset( $this->interwikis[$key]['text'] ) ) {
                                return $this->interwikis[$key]['text'];
                        }
                }
index 3ada925..b51ef38 100644 (file)
@@ -769,9 +769,9 @@ class Parser {
 
                if ( $target !== null ) {
                        return $target;
-               } elseif( $this->mOptions->getInterfaceMessage() ) {
+               } elseif ( $this->mOptions->getInterfaceMessage() ) {
                        return $this->mOptions->getUserLangObj();
-               } elseif( is_null( $this->mTitle ) ) {
+               } elseif ( is_null( $this->mTitle ) ) {
                        throw new MWException( __METHOD__ . ': $this->mTitle is null' );
                }
 
@@ -1256,7 +1256,7 @@ class Parser {
                                'x' => 'X',
                        ));
                        $titleObj = SpecialPage::getTitleFor( 'Booksources', $num );
-                       return'<a href="' .
+                       return '<a href="' .
                                htmlspecialchars( $titleObj->getLocalURL() ) .
                                "\" class=\"internal mw-magiclink-isbn\">ISBN $isbn</a>";
                } else {
@@ -1462,41 +1462,57 @@ class Parser {
                                } else {
                                        if ( strlen( $r ) == 2 ) {
                                                if ( $state === 'i' ) {
-                                                       $output .= '</i>'; $state = '';
+                                                       $output .= '</i>';
+                                                       $state = '';
                                                } elseif ( $state === 'bi' ) {
-                                                       $output .= '</i>'; $state = 'b';
+                                                       $output .= '</i>';
+                                                       $state = 'b';
                                                } elseif ( $state === 'ib' ) {
-                                                       $output .= '</b></i><b>'; $state = 'b';
+                                                       $output .= '</b></i><b>';
+                                                       $state = 'b';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<b><i>' . $buffer . '</i>'; $state = 'b';
+                                                       $output .= '<b><i>' . $buffer . '</i>';
+                                                       $state = 'b';
                                                } else { # $state can be 'b' or ''
-                                                       $output .= '<i>'; $state .= 'i';
+                                                       $output .= '<i>';
+                                                       $state .= 'i';
                                                }
                                        } elseif ( strlen( $r ) == 3 ) {
                                                if ( $state === 'b' ) {
-                                                       $output .= '</b>'; $state = '';
+                                                       $output .= '</b>';
+                                                       $state = '';
                                                } elseif ( $state === 'bi' ) {
-                                                       $output .= '</i></b><i>'; $state = 'i';
+                                                       $output .= '</i></b><i>';
+                                                       $state = 'i';
                                                } elseif ( $state === 'ib' ) {
-                                                       $output .= '</b>'; $state = 'i';
+                                                       $output .= '</b>';
+                                                       $state = 'i';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>' . $buffer . '</b>'; $state = 'i';
+                                                       $output .= '<i><b>' . $buffer . '</b>';
+                                                       $state = 'i';
                                                } else { # $state can be 'i' or ''
-                                                       $output .= '<b>'; $state .= 'b';
+                                                       $output .= '<b>';
+                                                       $state .= 'b';
                                                }
                                        } elseif ( strlen( $r ) == 5 ) {
                                                if ( $state === 'b' ) {
-                                                       $output .= '</b><i>'; $state = 'i';
+                                                       $output .= '</b><i>';
+                                                       $state = 'i';
                                                } elseif ( $state === 'i' ) {
-                                                       $output .= '</i><b>'; $state = 'b';
+                                                       $output .= '</i><b>';
+                                                       $state = 'b';
                                                } elseif ( $state === 'bi' ) {
-                                                       $output .= '</i></b>'; $state = '';
+                                                       $output .= '</i></b>';
+                                                       $state = '';
                                                } elseif ( $state === 'ib' ) {
-                                                       $output .= '</b></i>'; $state = '';
+                                                       $output .= '</b></i>';
+                                                       $state = '';
                                                } elseif ( $state === 'both' ) {
-                                                       $output .= '<i><b>' . $buffer . '</b></i>'; $state = '';
+                                                       $output .= '<i><b>' . $buffer . '</b></i>';
+                                                       $state = '';
                                                } else { # ($state == '')
-                                                       $buffer = ''; $state = 'both';
+                                                       $buffer = '';
+                                                       $state = 'both';
                                                }
                                        }
                                }
@@ -2491,7 +2507,7 @@ class Parser {
                $state = self::COLON_STATE_TEXT;
                $stack = 0;
                $len = strlen( $str );
-               for( $i = 0; $i < $len; $i++ ) {
+               for ( $i = 0; $i < $len; $i++ ) {
                        $c = $str[$i];
 
                        switch( $state ) {
@@ -2778,7 +2794,7 @@ class Parser {
                                break;
                        case 'pageid': // requested in bug 23427
                                $pageid = $this->getTitle()->getArticleID();
-                               if( $pageid == 0 ) {
+                               if ( $pageid == 0 ) {
                                        # 0 means the page doesn't exist in the database,
                                        # which means the user is previewing a new page.
                                        # The vary-revision flag must be set, because the magic word
@@ -3662,9 +3678,9 @@ class Parser {
                        if ( $skip ) {
                                $text = false;
                                $deps[] = array(
-                                       'title'         => $title,
-                                       'page_id'       => $title->getArticleID(),
-                                       'rev_id'        => null
+                                       'title' => $title,
+                                       'page_id' => $title->getArticleID(),
+                                       'rev_id' => null
                                );
                                break;
                        }
@@ -3680,15 +3696,15 @@ class Parser {
                        }
 
                        $deps[] = array(
-                               'title'         => $title,
-                               'page_id'       => $title->getArticleID(),
-                               'rev_id'        => $rev_id );
+                               'title' => $title,
+                               'page_id' => $title->getArticleID(),
+                               'rev_id' => $rev_id );
                        if ( $rev && !$title->equals( $rev->getTitle() ) ) {
                                # We fetched a rev from a different title; register it too...
                                $deps[] = array(
-                                       'title'         => $rev->getTitle(),
-                                       'page_id'       => $rev->getPage(),
-                                       'rev_id'        => $rev_id );
+                                       'title' => $rev->getTitle(),
+                                       'page_id' => $rev->getPage(),
+                                       'rev_id' => $rev_id );
                        }
 
                        if ( $rev ) {
@@ -4233,7 +4249,7 @@ class Parser {
                        # count number of headlines for each level
                        $sublevelCount[$toclevel]++;
                        $dot = 0;
-                       for( $i = 1; $i <= $toclevel; $i++ ) {
+                       for ( $i = 1; $i <= $toclevel; $i++ ) {
                                if ( !empty( $sublevelCount[$i] ) ) {
                                        if ( $dot ) {
                                                $numbering .= '.';
@@ -4486,7 +4502,7 @@ class Parser {
                        "\r\n" => "\n",
                );
                $text = str_replace( array_keys( $pairs ), array_values( $pairs ), $text );
-               if( $options->getPreSaveTransform() ) {
+               if ( $options->getPreSaveTransform() ) {
                        $text = $this->pstPass2( $text, $user );
                }
                $text = $this->mStripState->unstripBoth( $text );
@@ -4605,8 +4621,9 @@ class Parser {
                $username = $user->getName();
 
                # If not given, retrieve from the user object.
-               if ( $nickname === false )
+               if ( $nickname === false ) {
                        $nickname = $user->getOption( 'nickname' );
+               }
 
                if ( is_null( $fancySig ) ) {
                        $fancySig = $user->getBoolOption( 'fancysig' );
@@ -4885,8 +4902,9 @@ class Parser {
 
                # Add to function cache
                $mw = MagicWord::get( $id );
-               if ( !$mw )
+               if ( !$mw ) {
                        throw new MWException( __METHOD__ . '() expecting a magic word identifier.' );
+               }
 
                $synonyms = $mw->getSynonyms();
                $sensitive = intval( $mw->isCaseSensitive() );
@@ -4930,7 +4948,9 @@ class Parser {
         */
        function setFunctionTagHook( $tag, $callback, $flags ) {
                $tag = strtolower( $tag );
-               if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
+               if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) {
+                       throw new MWException( "Invalid character {$m[0]} in setFunctionTagHook('$tag', ...) call" );
+               }
                $old = isset( $this->mFunctionTagHooks[$tag] ) ?
                        $this->mFunctionTagHooks[$tag] : null;
                $this->mFunctionTagHooks[$tag] = array( $callback, $flags );
@@ -5049,7 +5069,7 @@ class Parser {
                                        if ( $match = $magicWordAlt->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $alt = $this->stripAltText( $match, false );
                                        }
-                                       elseif( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ) {
+                                       elseif ( $match = $magicWordLink->matchVariableStartToEnd( $parameterMatch ) ) {
                                                $linkValue = strip_tags( $this->replaceLinkHoldersText( $match ) );
                                                $chars = self::EXT_LINK_URL_CLASS;
                                                $prots = $this->mUrlProtocols;
@@ -5189,14 +5209,14 @@ class Parser {
                                # Special case; width and height come in one variable together
                                if ( $type === 'handler' && $paramName === 'width' ) {
                                        $parsedWidthParam = $this->parseWidthParam( $value );
-                                       if( isset( $parsedWidthParam['width'] ) ) {
+                                       if ( isset( $parsedWidthParam['width'] ) ) {
                                                $width = $parsedWidthParam['width'];
                                                if ( $handler->validateParam( 'width', $width ) ) {
                                                        $params[$type]['width'] = $width;
                                                        $validated = true;
                                                }
                                        }
-                                       if( isset( $parsedWidthParam['height'] ) ) {
+                                       if ( isset( $parsedWidthParam['height'] ) ) {
                                                $height = $parsedWidthParam['height'];
                                                if ( $handler->validateParam( 'height', $height ) ) {
                                                        $params[$type]['height'] = $height;
@@ -5648,14 +5668,14 @@ class Parser {
         * @return String: user name
         */
        function getRevisionUser() {
-               if( is_null( $this->mRevisionUser ) ) {
+               if ( is_null( $this->mRevisionUser ) ) {
                        $revObject = $this->getRevisionObject();
 
                        # if this template is subst: the revision id will be blank,
                        # so just use the current user's name
-                       if( $revObject ) {
+                       if ( $revObject ) {
                                $this->mRevisionUser = $revObject->getUserText();
-                       } elseif( $this->ot['wiki'] || $this->mOptions->getIsPreview() ) {
+                       } elseif ( $this->ot['wiki'] || $this->mOptions->getIsPreview() ) {
                                $this->mRevisionUser = $this->getUser()->getName();
                        }
                }
@@ -5935,7 +5955,7 @@ class Parser {
         */
        public function parseWidthParam( $value ) {
                $parsedWidthParam = array();
-               if( $value === '' ) {
+               if ( $value === '' ) {
                        return $parsedWidthParam;
                }
                $m = array();
index 0faa40a..7c5eeb4 100644 (file)
@@ -67,7 +67,7 @@ class ParserCache {
 
                // idhash seem to mean 'page id' + 'rendering hash' (r3710)
                $pageid = $article->getID();
-               $renderkey = (int)($wgRequest->getVal( 'action' ) == 'render');
+               $renderkey = (int)( $wgRequest->getVal( 'action' ) == 'render' );
 
                $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
                return $key;
@@ -128,7 +128,7 @@ class ParserCache {
        public function getKey( $article, $popts, $useOutdated = true ) {
                global $wgCacheEpoch;
 
-               if( $popts instanceof User ) {
+               if ( $popts instanceof User ) {
                        wfWarn( "Use of outdated prototype ParserCache::getKey( &\$article, &\$user )\n" );
                        $popts = ParserOptions::newFromUser( $popts );
                }
@@ -227,7 +227,7 @@ class ParserCache {
        public function save( $parserOutput, $article, $popts ) {
                $expire = $parserOutput->getCacheExpiry();
 
-               if( $expire > 0 ) {
+               if ( $expire > 0 ) {
                        $now = wfTimestampNow();
 
                        $optionsKey = new CacheTime;
index 3eb83e3..2bd5a5d 100644 (file)
@@ -538,7 +538,7 @@ class ParserOptions {
 
                // add in language specific options, if any
                // @todo FIXME: This is just a way of retrieving the url/user preferred variant
-               if( !is_null( $title ) ) {
+               if ( !is_null( $title ) ) {
                        $confstr .= $title->getPageLanguage()->getExtraHashOptions();
                } else {
                        global $wgContLang;
@@ -557,8 +557,9 @@ class ParserOptions {
                        $confstr .= '!printable=1';
                }
 
-               if ( $this->mExtraKey != '' )
+               if ( $this->mExtraKey != '' ) {
                        $confstr .= $this->mExtraKey;
+               }
 
                // Give a chance for extensions to modify the hash, if they have
                // extra options or other effects on the parser cache.
index 3af3b7a..c5e42a4 100644 (file)
@@ -176,10 +176,10 @@ class ParserOutput extends CacheTime {
                global $wgServer, $wgRegisterInternalExternals;
 
                $registerExternalLink = true;
-               if( !$wgRegisterInternalExternals ) {
+               if ( !$wgRegisterInternalExternals ) {
                        $registerExternalLink = !self::isLinkInternal( $wgServer, $url );
                }
-               if( $registerExternalLink ) {
+               if ( $registerExternalLink ) {
                        $this->mExternalLinks[$url] = 1;
                }
        }
@@ -201,11 +201,11 @@ class ParserOutput extends CacheTime {
                if ( $ns == NS_MEDIA ) {
                        // Normalize this pseudo-alias if it makes it down here...
                        $ns = NS_FILE;
-               } elseif( $ns == NS_SPECIAL ) {
+               } elseif ( $ns == NS_SPECIAL ) {
                        // We don't record Special: links currently
                        // It might actually be wise to, but we'd need to do some normalization.
                        return;
-               } elseif( $dbk === '' ) {
+               } elseif ( $dbk === '' ) {
                        // Don't record self links -  [[#Foo]]
                        return;
                }
@@ -258,7 +258,7 @@ class ParserOutput extends CacheTime {
         */
        function addInterwikiLink( $title ) {
                $prefix = $title->getInterwiki();
-               if( $prefix == '' ) {
+               if ( $prefix == '' ) {
                        throw new MWException( 'Non-interwiki link passed, internal parser error.' );
                }
                if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
@@ -329,7 +329,7 @@ class ParserOutput extends CacheTime {
         */
        public function getDisplayTitle() {
                $t = $this->getTitleText();
-               if( $t === '' ) {
+               if ( $t === '' ) {
                        return false;
                }
                return $t;
index f25340f..aeae234 100644 (file)
@@ -122,7 +122,7 @@ class Parser_DiffTest
 
        function setFunctionHook( $id, $callback, $flags = 0 ) {
                $this->init();
-               foreach  ( $this->parsers as $parser ) {
+               foreach ( $this->parsers as $parser ) {
                        $parser->setFunctionHook( $id, $callback, $flags );
                }
        }
index 1e90928..4ea7dd4 100644 (file)
@@ -577,7 +577,7 @@ class Preprocessor_DOM implements Preprocessor {
                                                'open' => $curChar,
                                                'close' => $rule['end'],
                                                'count' => $count,
-                                               'lineStart' => ($i > 0 && $text[$i - 1] == "\n"),
+                                               'lineStart' => ( $i > 0 && $text[$i - 1] == "\n" ),
                                        );
 
                                        $stack->push( $piece );
@@ -1214,7 +1214,9 @@ class PPFrame_DOM implements PPFrame {
                $first = true;
                $s = '';
                foreach ( $args as $root ) {
-                       if ( $root instanceof PPNode_DOM ) $root = $root->node;
+                       if ( $root instanceof PPNode_DOM ) {
+                               $root = $root->node;
+                       }
                        if ( !is_array( $root ) && !( $root instanceof DOMNodeList ) ) {
                                $root = array( $root );
                        }
index 465c5a6..654a66e 100644 (file)
@@ -515,7 +515,7 @@ class Preprocessor_Hash implements Preprocessor {
                                                'open' => $curChar,
                                                'close' => $rule['end'],
                                                'count' => $count,
-                                               'lineStart' => ($i > 0 && $text[$i - 1] == "\n"),
+                                               'lineStart' => ( $i > 0 && $text[$i - 1] == "\n" ),
                                        );
 
                                        $stack->push( $piece );
index 0f7e0d3..e3ea40b 100644 (file)
@@ -158,7 +158,7 @@ class MWTidy {
                global $wgTidyInternal;
 
                $retval = 0;
-               if( $wgTidyInternal ) {
+               if ( $wgTidyInternal ) {
                        $errorStr = self::execInternalTidy( $text, true, $retval );
                } else {
                        $errorStr = self::execExternalTidy( $text, true, $retval );
index e39a7b2..49d961e 100644 (file)
@@ -75,10 +75,10 @@ class Profiler {
         * @return Profiler
         */
        public static function instance() {
-               if( is_null( self::$__instance ) ) {
+               if ( is_null( self::$__instance ) ) {
                        global $wgProfiler;
-                       if( is_array( $wgProfiler ) ) {
-                               if( !isset( $wgProfiler['class'] ) ) {
+                       if ( is_array( $wgProfiler ) ) {
+                               if ( !isset( $wgProfiler['class'] ) ) {
                                        wfDebug( __METHOD__ . " called without \$wgProfiler['class']"
                                                . " set, falling back to ProfilerStub for safety\n" );
                                        $class = 'ProfilerStub';
@@ -86,7 +86,7 @@ class Profiler {
                                        $class = $wgProfiler['class'];
                                }
                                self::$__instance = new $class( $wgProfiler );
-                       } elseif( $wgProfiler instanceof Profiler ) {
+                       } elseif ( $wgProfiler instanceof Profiler ) {
                                self::$__instance = $wgProfiler; // back-compat
                        } else {
                                wfDebug( __METHOD__ . ' called with bogus $wgProfiler setting,'
@@ -157,7 +157,7 @@ class Profiler {
         */
        public function profileIn( $functionname ) {
                global $wgDebugFunctionEntry;
-               if( $wgDebugFunctionEntry ) {
+               if ( $wgDebugFunctionEntry ) {
                        $this->debug( str_repeat( ' ', count( $this->mWorkStack ) ) . 'Entering ' . $functionname . "\n" );
                }
 
@@ -174,7 +174,7 @@ class Profiler {
                $memory = memory_get_usage();
                $time = $this->getTime();
 
-               if( $wgDebugFunctionEntry ) {
+               if ( $wgDebugFunctionEntry ) {
                        $this->debug( str_repeat( ' ', count( $this->mWorkStack ) - 1 ) . 'Exiting ' . $functionname . "\n" );
                }
 
@@ -184,12 +184,11 @@ class Profiler {
                        $this->debug( "Profiling error, !\$bit: $functionname\n" );
                } else {
                        //if( $wgDebugProfiling ) {
-                               if( $functionname == 'close' ) {
+                               if ( $functionname == 'close' ) {
                                        $message = "Profile section ended by close(): {$bit[0]}";
                                        $this->debug( "$message\n" );
                                        $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
-                               }
-                               elseif( $bit[0] != $functionname ) {
+                               } elseif ( $bit[0] != $functionname ) {
                                        $message = "Profiling error: in({$bit[0]}), out($functionname)";
                                        $this->debug( "$message\n" );
                                        $this->mStack[] = array( $message, 0, 0.0, 0, 0.0, 0 );
@@ -205,7 +204,7 @@ class Profiler {
         * Close opened profiling sections
         */
        public function close() {
-               while( count( $this->mWorkStack ) ) {
+               while ( count( $this->mWorkStack ) ) {
                        $this->profileOut( 'close' );
                }
        }
@@ -228,11 +227,11 @@ class Profiler {
                global $wgDebugFunctionEntry, $wgProfileCallTree;
                $wgDebugFunctionEntry = false;
 
-               if( !count( $this->mStack ) && !count( $this->mCollated ) ) {
+               if ( !count( $this->mStack ) && !count( $this->mCollated ) ) {
                        return "No profiling output\n";
                }
 
-               if( $wgProfileCallTree ) {
+               if ( $wgProfileCallTree ) {
                        return $this->getCallTree();
                } else {
                        return $this->getFunctionReport();
@@ -254,16 +253,16 @@ class Profiler {
         * @return array
         */
        function remapCallTree( $stack ) {
-               if( count( $stack ) < 2 ) {
+               if ( count( $stack ) < 2 ) {
                        return $stack;
                }
                $outputs = array();
-               for( $max = count( $stack ) - 1; $max > 0; ) {
+               for ( $max = count( $stack ) - 1; $max > 0; ) {
                        /* Find all items under this entry */
                        $level = $stack[$max][1];
                        $working = array();
-                       for( $i = $max -1; $i >= 0; $i-- ) {
-                               if( $stack[$i][1] > $level ) {
+                       for ( $i = $max -1; $i >= 0; $i-- ) {
+                               if ( $stack[$i][1] > $level ) {
                                        $working[] = $stack[$i];
                                } else {
                                        break;
@@ -271,7 +270,7 @@ class Profiler {
                        }
                        $working = $this->remapCallTree( array_reverse( $working ) );
                        $output = array();
-                       foreach( $working as $item ) {
+                       foreach ( $working as $item ) {
                                array_push( $output, $item );
                        }
                        array_unshift( $output, $stack[$max] );
@@ -280,8 +279,8 @@ class Profiler {
                        array_unshift( $outputs, $output );
                }
                $final = array();
-               foreach( $outputs as $output ) {
-                       foreach( $output as $item ) {
+               foreach ( $outputs as $output ) {
+                       foreach ( $output as $item ) {
                                $final[] = $item;
                        }
                }
@@ -391,18 +390,17 @@ class Profiler {
 
                # First, subtract the overhead!
                $overheadTotal = $overheadMemory = $overheadInternal = array();
-               foreach( $this->mStack as $entry ) {
+               foreach ( $this->mStack as $entry ) {
                        $fname = $entry[0];
                        $start = $entry[2];
                        $end = $entry[4];
                        $elapsed = $end - $start;
                        $memory = $entry[5] - $entry[3];
 
-                       if( $fname == '-overhead-total' ) {
+                       if ( $fname == '-overhead-total' ) {
                                $overheadTotal[] = $elapsed;
                                $overheadMemory[] = $memory;
-                       }
-                       elseif( $fname == '-overhead-internal' ) {
+                       } elseif ( $fname == '-overhead-internal' ) {
                                $overheadInternal[] = $elapsed;
                        }
                }
@@ -411,7 +409,7 @@ class Profiler {
                $overheadInternal = $overheadInternal ? array_sum( $overheadInternal ) / count( $overheadInternal ) : 0;
 
                # Collate
-               foreach( $this->mStack as $index => $entry ) {
+               foreach ( $this->mStack as $index => $entry ) {
                        $fname = $entry[0];
                        $start = $entry[2];
                        $end = $entry[4];
@@ -420,16 +418,16 @@ class Profiler {
                        $memory = $entry[5] - $entry[3];
                        $subcalls = $this->calltreeCount( $this->mStack, $index );
 
-                       if( !preg_match( '/^-overhead/', $fname ) ) {
+                       if ( !preg_match( '/^-overhead/', $fname ) ) {
                                # Adjust for profiling overhead (except special values with elapsed=0
-                               if( $elapsed ) {
+                               if ( $elapsed ) {
                                        $elapsed -= $overheadInternal;
                                        $elapsed -= ($subcalls * $overheadTotal);
                                        $memory -= ($subcalls * $overheadMemory);
                                }
                        }
 
-                       if( !array_key_exists( $fname, $this->mCollated ) ) {
+                       if ( !array_key_exists( $fname, $this->mCollated ) ) {
                                $this->mCollated[$fname] = 0;
                                $this->mCalls[$fname] = 0;
                                $this->mMemory[$fname] = 0;
@@ -467,7 +465,7 @@ class Profiler {
 
                $total = isset( $this->mCollated['-total'] ) ? $this->mCollated['-total'] : 0;
 
-               foreach( $this->mCollated as $fname => $elapsed ) {
+               foreach ( $this->mCollated as $fname => $elapsed ) {
                        $calls = $this->mCalls[$fname];
                        $percent = $total ? 100. * $elapsed / $total : 0;
                        $memory = $this->mMemory[$fname];
@@ -483,7 +481,7 @@ class Profiler {
         */
        protected static function calculateOverhead( $profileCount ) {
                wfProfileIn( '-overhead-total' );
-               for( $i = 0; $i < $profileCount; $i++ ) {
+               for ( $i = 0; $i < $profileCount; $i++ ) {
                        wfProfileIn( '-overhead-internal' );
                        wfProfileOut( '-overhead-internal' );
                }
@@ -515,16 +513,16 @@ class Profiler {
                global $wgProfilePerHost, $wgProfileToDatabase;
 
                # Do not log anything if database is readonly (bug 5375)
-               if( wfReadOnly() || !$wgProfileToDatabase ) {
+               if ( wfReadOnly() || !$wgProfileToDatabase ) {
                        return;
                }
 
                $dbw = wfGetDB( DB_MASTER );
-               if( !is_object( $dbw ) ) {
+               if ( !is_object( $dbw ) ) {
                        return;
                }
 
-               if( $wgProfilePerHost ) {
+               if ( $wgProfilePerHost ) {
                        $pfhost = wfHostname();
                } else {
                        $pfhost = '';
@@ -533,7 +531,7 @@ class Profiler {
                try {
                        $this->collateData();
 
-                       foreach( $this->mCollated as $name => $elapsed ) {
+                       foreach ( $this->mCollated as $name => $elapsed ) {
                                $eventCount = $this->mCalls[$name];
                                $timeSum = (float) ($elapsed * 1000);
                                $memorySum = (float)$this->mMemory[$name];
@@ -585,7 +583,7 @@ class Profiler {
         * @param string $s to output
         */
        function debug( $s ) {
-               if( defined( 'MW_COMPILED' ) || function_exists( 'wfDebug' ) ) {
+               if ( defined( 'MW_COMPILED' ) || function_exists( 'wfDebug' ) ) {
                        wfDebug( $s );
                }
        }
index 1cf4fa7..83bdf71 100644 (file)
@@ -50,7 +50,7 @@ class ProfilerSimpleUDP extends ProfilerSimple {
                $plength = 0;
                $packet = "";
                foreach ( $this->mCollated as $entry => $pfdata ) {
-                       if( !isset( $pfdata['count'] )
+                       if ( !isset( $pfdata['count'] )
                                || !isset( $pfdata['cpu'] )
                                || !isset( $pfdata['cpu_sq'] )
                                || !isset( $pfdata['real'] )
index 5919cde..861ff18 100644 (file)
@@ -52,7 +52,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                 */
                $namespaceIds = $wgContLang->getNamespaceIds();
                $caseSensitiveNamespaces = array();
-               foreach( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
+               foreach ( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
                        $namespaceIds[$wgContLang->lc( $name )] = $index;
                        if ( !MWNamespace::isCapitalized( $index ) ) {
                                $caseSensitiveNamespaces[] = $index;
index 7586bb7..9064263 100644 (file)
@@ -54,7 +54,7 @@ class ResourceLoaderUserGroupsModule extends ResourceLoaderWikiModule {
                }
 
                $pages = array();
-               foreach( $user->getEffectiveGroups() as $group ) {
+               foreach ( $user->getEffectiveGroups() as $group ) {
                        if ( in_array( $group, array( '*', 'user' ) ) ) {
                                continue;
                        }
index d2ce0b7..ac72276 100644 (file)
@@ -52,7 +52,7 @@ class RevDel_RevisionList extends RevDel_List {
                        array_merge( Revision::selectFields(), Revision::selectUserFields() ),
                        array(
                                'rev_page' => $this->title->getArticleID(),
-                               'rev_id'   => $ids,
+                               'rev_id' => $ids,
                        ),
                        __METHOD__,
                        array( 'ORDER BY' => 'rev_id DESC' ),
@@ -292,7 +292,7 @@ class RevDel_ArchiveList extends RevDel_RevisionList {
                return $db->select( 'archive', '*',
                                array(
                                        'ar_namespace' => $this->title->getNamespace(),
-                                       'ar_title'     => $this->title->getDBkey(),
+                                       'ar_title' => $this->title->getDBkey(),
                                        'ar_timestamp' => $timestamps
                                ),
                                __METHOD__,
@@ -349,12 +349,12 @@ class RevDel_ArchiveItem extends RevDel_RevisionItem {
                $dbw->update( 'archive',
                        array( 'ar_deleted' => $bits ),
                        array(
-                               'ar_namespace'  => $this->list->title->getNamespace(),
-                               'ar_title'      => $this->list->title->getDBkey(),
+                               'ar_namespace' => $this->list->title->getNamespace(),
+                               'ar_title' => $this->list->title->getDBkey(),
                                // use timestamp for index
-                               'ar_timestamp'  => $this->row->ar_timestamp,
-                               'ar_rev_id'     => $this->row->ar_rev_id,
-                               'ar_deleted'    => $this->getBits()
+                               'ar_timestamp' => $this->row->ar_timestamp,
+                               'ar_rev_id' => $this->row->ar_rev_id,
+                               'ar_deleted' => $this->getBits()
                        ),
                        __METHOD__ );
                return (bool)$dbw->affectedRows();
@@ -449,14 +449,14 @@ class RevDel_FileList extends RevDel_List {
         */
        public function doQuery( $db ) {
                $archiveNames = array();
-               foreach( $this->ids as $timestamp ) {
+               foreach ( $this->ids as $timestamp ) {
                        $archiveNames[] = $timestamp . '!' . $this->title->getDBkey();
                }
                return $db->select(
                        'oldimage',
                        OldLocalFile::selectFields(),
                        array(
-                               'oi_name'         => $this->title->getDBkey(),
+                               'oi_name' => $this->title->getDBkey(),
                                'oi_archive_name' => $archiveNames
                        ),
                        __METHOD__,
@@ -623,8 +623,8 @@ class RevDel_FileItem extends RevDel_Item {
                                array(),
                                array(
                                        'target' => $this->list->title->getPrefixedText(),
-                                       'file'   => $this->file->getArchiveName(),
-                                       'token'  => $this->list->getUser()->getEditToken(
+                                       'file' => $this->file->getArchiveName(),
+                                       'token' => $this->list->getUser()->getEditToken(
                                                $this->file->getArchiveName() )
                                )
                        );
@@ -636,13 +636,13 @@ class RevDel_FileItem extends RevDel_Item {
         * @return string HTML
         */
        protected function getUserTools() {
-               if( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) {
+               if ( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) {
                        $link = Linker::userLink( $this->file->user, $this->file->user_text ) .
                                Linker::userToolLinks( $this->file->user, $this->file->user_text );
                } else {
                        $link = $this->list->msg( 'rev-deleted-user' )->escaped();
                }
-               if( $this->file->isDeleted( Revision::DELETED_USER ) ) {
+               if ( $this->file->isDeleted( Revision::DELETED_USER ) ) {
                        return '<span class="history-deleted">' . $link . '</span>';
                }
                return $link;
@@ -655,12 +655,12 @@ class RevDel_FileItem extends RevDel_Item {
         * @return string HTML
         */
        protected function getComment() {
-               if( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
+               if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
                        $block = Linker::commentBlock( $this->file->description );
                } else {
                        $block = ' ' . $this->list->msg( 'rev-deleted-comment' )->escaped();
                }
-               if( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
+               if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
                        return "<span class=\"history-deleted\">$block</span>";
                }
                return $block;
@@ -700,7 +700,7 @@ class RevDel_ArchivedFileList extends RevDel_FileList {
                        ArchivedFile::selectFields(),
                        array(
                                'fa_name' => $this->title->getDBkey(),
-                               'fa_id'   => $ids
+                               'fa_id' => $ids
                        ),
                        __METHOD__,
                        array( 'ORDER BY' => 'fa_id DESC' )
@@ -759,7 +759,7 @@ class RevDel_ArchivedFileItem extends RevDel_FileItem {
                        $this->file->getTimestamp(), $this->list->getUser() ) );
 
                # Hidden files...
-               if( !$this->canViewContent() ) {
+               if ( !$this->canViewContent() ) {
                        $link = $date;
                } else {
                        $undelete = SpecialPage::getTitleFor( 'Undelete' );
@@ -772,7 +772,7 @@ class RevDel_ArchivedFileItem extends RevDel_FileItem {
                                )
                        );
                }
-               if( $this->isDeleted() ) {
+               if ( $this->isDeleted() ) {
                        $link = '<span class="history-deleted">' . $link . '</span>';
                }
                return $link;
@@ -901,7 +901,7 @@ class RevDel_LogItem extends RevDel_Item {
                $action = $formatter->getActionText();
                // Comment
                $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
-               if( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
+               if ( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
                        $comment = '<span class="history-deleted">' . $comment . '</span>';
                }
 
index fcbec9e..9ace35a 100644 (file)
@@ -94,14 +94,14 @@ abstract class RevDel_List extends RevisionListBase {
                        }
                        if ( !$item->canView() ) {
                                // Cannot access this revision
-                               $msg = ($opType == 'show') ?
+                               $msg = ( $opType == 'show' ) ?
                                        'revdelete-show-no-access' : 'revdelete-modify-no-access';
                                $status->error( $msg, $item->formatDate(), $item->formatTime() );
                                $status->failCount++;
                                continue;
                        }
                        // Cannot just "hide from Sysops" without hiding any fields
-                       if( $newBits == Revision::DELETED_RESTRICTED ) {
+                       if ( $newBits == Revision::DELETED_RESTRICTED ) {
                                $status->warning( 'revdelete-only-restricted', $item->formatDate(), $item->formatTime() );
                                $status->failCount++;
                                continue;
@@ -113,9 +113,9 @@ abstract class RevDel_List extends RevisionListBase {
                        if ( $ok ) {
                                $idsForLog[] = $item->getId();
                                $status->successCount++;
-                               if( $item->getAuthorId() > 0 ) {
+                               if ( $item->getAuthorId() > 0 ) {
                                        $authorIds[] = $item->getAuthorId();
-                               } elseif( IP::isIPAddress( $item->getAuthorName() ) ) {
+                               } elseif ( IP::isIPAddress( $item->getAuthorName() ) ) {
                                        $authorIPs[] = $item->getAuthorName();
                                }
                        } else {
@@ -189,7 +189,7 @@ abstract class RevDel_List extends RevisionListBase {
        protected function updateLog( $params ) {
                // Get the URL param's corresponding DB field
                $field = RevisionDeleter::getRelationType( $this->getType() );
-               if( !$field ) {
+               if ( !$field ) {
                        throw new MWException( "Bad log URL param type!" );
                }
                // Put things hidden from sysops in the oversight log
index c02e9c7..4505ee1 100644 (file)
@@ -54,7 +54,7 @@ class RevisionDeleteUser {
                # The same goes for the sysop-restricted *_deleted bit.
                $delUser = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
                $delAction = LogPage::DELETED_ACTION | Revision::DELETED_RESTRICTED;
-               if( $op == '&' ) {
+               if ( $op == '&' ) {
                        $delUser = "~{$delUser}";
                        $delAction = "~{$delAction}";
                }
index d2e10e1..2de19ac 100644 (file)
@@ -39,7 +39,7 @@ class RevisionDeleter {
         * @param array $arr the array to update.
         */
        protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
-               if( $diff & $field ) {
+               if ( $diff & $field ) {
                        $arr[( $new & $field ) ? 0 : 1][] = $desc;
                }
        }
@@ -73,11 +73,12 @@ class RevisionDeleter {
                self::checkItem( 'revdelete-uname',
                        Revision::DELETED_USER, $diff, $n, $ret );
                // Restriction application to sysops
-               if( $diff & Revision::DELETED_RESTRICTED ) {
-                       if( $n & Revision::DELETED_RESTRICTED )
+               if ( $diff & Revision::DELETED_RESTRICTED ) {
+                       if ( $n & Revision::DELETED_RESTRICTED ) {
                                $ret[2][] = 'revdelete-restricted';
-                       else
+                       } else {
                                $ret[2][] = 'revdelete-unrestricted';
+                       }
                }
                return $ret;
        }
index cfd941a..de9e99c 100644 (file)
@@ -331,8 +331,9 @@ class SearchEngine {
                                $parsed = substr( $query, strlen( $prefix ) + 1 );
                        }
                }
-               if ( trim( $parsed ) == '' )
+               if ( trim( $parsed ) == '' ) {
                        $parsed = $query; // prefix was the whole query
+               }
 
                wfRunHooks( 'SearchEngineReplacePrefixesComplete', array( $this, $query, &$parsed ) );
 
@@ -420,8 +421,9 @@ class SearchEngine {
 
                $formatted = array_map( array( $wgContLang, 'getFormattedNsText' ), $namespaces );
                foreach ( $formatted as $key => $ns ) {
-                       if ( empty( $ns ) )
+                       if ( empty( $ns ) ) {
                                $formatted[$key] = wfMessage( 'blanknamespace' )->text();
+                       }
                }
                return $formatted;
        }
@@ -641,26 +643,30 @@ class SqlSearchResultSet extends SearchResultSet {
        }
 
        function numRows() {
-               if ( $this->mResultSet === false )
+               if ( $this->mResultSet === false ) {
                        return false;
+               }
 
                return $this->mResultSet->numRows();
        }
 
        function next() {
-               if ( $this->mResultSet === false )
+               if ( $this->mResultSet === false ) {
                        return false;
+               }
 
                $row = $this->mResultSet->fetchObject();
-               if ( $row === false )
+               if ( $row === false ) {
                        return false;
+               }
 
                return SearchResult::newFromRow( $row );
        }
 
        function free() {
-               if ( $this->mResultSet === false )
+               if ( $this->mResultSet === false ) {
                        return false;
+               }
 
                $this->mResultSet->free();
        }
@@ -750,8 +756,9 @@ class SearchResult {
                        wfRunHooks( 'SearchResultInitFromTitle', array( $title, &$id ) );
                        $this->mRevision = Revision::newFromTitle(
                                $this->mTitle, $id, Revision::READ_NORMAL );
-                       if ( $this->mTitle->getNamespace() === NS_FILE )
+                       if ( $this->mTitle->getNamespace() === NS_FILE ) {
                                $this->mImage = wfFindFile( $this->mTitle );
+                       }
                }
        }
 
@@ -761,8 +768,9 @@ class SearchResult {
         * @return Boolean
         */
        function isBrokenTitle() {
-               if ( is_null( $this->mTitle ) )
+               if ( is_null( $this->mTitle ) ) {
                        return true;
+               }
                return false;
        }
 
@@ -816,10 +824,11 @@ class SearchResult {
                // TODO: make highliter take a content object. Make ContentHandler a factory for SearchHighliter.
                list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs( $wgUser );
                $h = new SearchHighlighter();
-               if ( $wgAdvancedSearchHighlighting )
+               if ( $wgAdvancedSearchHighlighting ) {
                        return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars );
-               else
+               } else {
                        return $h->highlightSimple( $this->mText, $terms, $contextlines, $contextchars );
+               }
        }
 
        /**
@@ -863,10 +872,11 @@ class SearchResult {
         * @return String: timestamp
         */
        function getTimestamp() {
-               if ( $this->mRevision )
+               if ( $this->mRevision ) {
                        return $this->mRevision->getTimestamp();
-               elseif ( $this->mImage )
+               } elseif ( $this->mImage ) {
                        return $this->mImage->getTimestamp();
+               }
                return '';
        }
 
@@ -952,8 +962,9 @@ class SearchHighlighter {
                global $wgSearchHighlightBoundaries;
                $fname = __METHOD__;
 
-               if ( $text == '' )
+               if ( $text == '' ) {
                        return '';
+               }
 
                // spli text into text + templates/links/tables
                $spat = "/(\\{\\{)|(\\[\\[[^\\]:]+:)|(\n\\{\\|)";
@@ -984,8 +995,9 @@ class SearchHighlighter {
                                                if ( $key == 2 ) {
                                                        // see if this is an image link
                                                        $ns = substr( $val[0], 2, - 1 );
-                                                       if ( $wgContLang->getNsIndex( $ns ) != NS_FILE )
+                                                       if ( $wgContLang->getNsIndex( $ns ) != NS_FILE ) {
                                                                break;
+                                                       }
 
                                                }
                                                $epat = $endPatterns[$key];
@@ -1155,17 +1167,19 @@ class SearchHighlighter {
                $last = - 1;
                $extract = '';
                foreach ( $snippets as $index => $line ) {
-                       if ( $last == - 1 )
+                       if ( $last == - 1 ) {
                                $extract .= $line; // first line
-                       elseif ( $last + 1 == $index && $offsets[$last] + strlen( $snippets[$last] ) >= strlen( $all[$last] ) )
+                       } elseif ( $last + 1 == $index && $offsets[$last] + strlen( $snippets[$last] ) >= strlen( $all[$last] ) ) {
                                $extract .= " " . $line; // continous lines
-                       else
+                       } else {
                                $extract .= '<b> ... </b>' . $line;
+                       }
 
                        $last = $index;
                }
-               if ( $extract )
+               if ( $extract ) {
                        $extract .= '<b> ... </b>';
+               }
 
                $processed = array();
                foreach ( $terms as $term ) {
@@ -1193,8 +1207,9 @@ class SearchHighlighter {
                $split = explode( "\n", $this->mCleanWikitext ? $this->removeWiki( $text ) : $text );
                foreach ( $split as $line ) {
                        $tt = trim( $line );
-                       if ( $tt )
+                       if ( $tt ) {
                                $extracts[$count++] = $tt;
+                       }
                }
        }
 
@@ -1268,8 +1283,9 @@ class SearchHighlighter {
                        while ( $char >= 0x80 && $char < 0xc0 ) {
                                // skip trailing bytes
                                $point++;
-                               if ( $point >= strlen( $text ) )
+                               if ( $point >= strlen( $text ) ) {
                                        return strlen( $text );
+                               }
                                $char = ord( $text[$point] );
                        }
                        return $point;
@@ -1289,24 +1305,28 @@ class SearchHighlighter {
         * @protected
         */
        function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
-               if ( $linesleft == 0 )
+               if ( $linesleft == 0 ) {
                        return; // nothing to do
+               }
                foreach ( $extracts as $index => $line ) {
-                       if ( array_key_exists( $index, $out ) )
+                       if ( array_key_exists( $index, $out ) ) {
                                continue; // this line already highlighted
+                       }
 
                        $m = array();
-                       if ( !preg_match( $pattern, $line, $m, PREG_OFFSET_CAPTURE ) )
+                       if ( !preg_match( $pattern, $line, $m, PREG_OFFSET_CAPTURE ) ) {
                                continue;
+                       }
 
                        $offset = $m[0][1];
                        $len = strlen( $m[0][0] );
-                       if ( $offset + $len < $contextchars )
+                       if ( $offset + $len < $contextchars ) {
                                $begin = 0;
-                       elseif ( $len > $contextchars )
+                       } elseif ( $len > $contextchars ) {
                                $begin = $offset;
-                       else
+                       } else {
                                $begin = $offset + intval( ( $len - $contextchars ) / 2 );
+                       }
 
                        $end = $begin + $contextchars;
 
@@ -1315,8 +1335,9 @@ class SearchHighlighter {
                        $out[$index] = $this->extract( $line, $begin, $end, $posBegin );
                        $offsets[$index] = $posBegin;
                        $linesleft--;
-                       if ( $linesleft == 0 )
+                       if ( $linesleft == 0 ) {
                                return;
+                       }
                }
        }
 
@@ -1357,16 +1378,17 @@ class SearchHighlighter {
         */
        function linkReplace( $matches ) {
                $colon = strpos( $matches[1], ':' );
-               if ( $colon === false )
+               if ( $colon === false ) {
                        return $matches[2]; // replace with caption
+               }
                global $wgContLang;
                $ns = substr( $matches[1], 0, $colon );
                $index = $wgContLang->getNsIndex( $ns );
-               if ( $index !== false && ( $index == NS_FILE || $index == NS_CATEGORY ) )
+               if ( $index !== false && ( $index == NS_FILE || $index == NS_CATEGORY ) ) {
                        return $matches[0]; // return the whole thing
-               else
+               } else {
                        return $matches[2];
-
+               }
        }
 
        /**
index 163d9dc..cbc1a7a 100644 (file)
@@ -170,8 +170,9 @@ class SearchMssql extends SearchEngine {
 
                                if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
-                                       if ( $terms[4] )
+                                       if ( $terms[4] ) {
                                                $regexp .= "[0-9A-Za-z_]+";
+                                       }
                                } else {
                                        $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
                                }
@@ -247,8 +248,9 @@ class MssqlSearchResultSet extends SearchResultSet {
 
        function next() {
                $row = $this->mResultSet->fetchObject();
-               if ( $row === false )
+               if ( $row === false ) {
                        return false;
+               }
                return new SearchResult( $row );
        }
 }
index ddfd1b3..f63931d 100644 (file)
@@ -57,12 +57,12 @@ class SearchMySQL extends SearchEngine {
 
                # @todo FIXME: This doesn't handle parenthetical expressions.
                $m = array();
-               if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
+               if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
-                       foreach( $m as $bits ) {
+                       foreach ( $m as $bits ) {
                                @list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
 
-                               if( $nonQuoted != '' ) {
+                               if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
                                        $quote = '';
                                } else {
@@ -70,8 +70,10 @@ class SearchMySQL extends SearchEngine {
                                        $quote = '"';
                                }
 
-                               if( $searchon !== '' ) $searchon .= ' ';
-                               if( $this->strictMatching && ($modifier == '') ) {
+                               if ( $searchon !== '' ) {
+                                       $searchon .= ' ';
+                               }
+                               if ( $this->strictMatching && ( $modifier == '' ) ) {
                                        // If we leave this out, boolean op defaults to OR which is rarely helpful.
                                        $modifier = '+';
                                }
@@ -79,7 +81,7 @@ class SearchMySQL extends SearchEngine {
                                // Some languages such as Serbian store the input form in the search index,
                                // so we may need to search for matches in multiple writing system variants.
                                $convertedVariants = $wgContLang->autoConvertToAllVariants( $term );
-                               if( is_array( $convertedVariants ) ) {
+                               if ( is_array( $convertedVariants ) ) {
                                        $variants = array_unique( array_values( $convertedVariants ) );
                                } else {
                                        $variants = array( $term );
@@ -99,11 +101,12 @@ class SearchMySQL extends SearchEngine {
                                $strippedVariants = array_unique( $strippedVariants );
 
                                $searchon .= $modifier;
-                               if( count( $strippedVariants ) > 1 )
+                               if ( count( $strippedVariants ) > 1 ) {
                                        $searchon .= '(';
-                               foreach( $strippedVariants as $stripped ) {
+                               }
+                               foreach ( $strippedVariants as $stripped ) {
                                        $stripped = $this->normalizeText( $stripped );
-                                       if( $nonQuoted && strpos( $stripped, ' ' ) !== false ) {
+                                       if ( $nonQuoted && strpos( $stripped, ' ' ) !== false ) {
                                                // Hack for Chinese: we need to toss in quotes for
                                                // multiple-character phrases since normalizeForSearch()
                                                // added spaces between them to make word breaks.
@@ -111,8 +114,9 @@ class SearchMySQL extends SearchEngine {
                                        }
                                        $searchon .= "$quote$stripped$quote$wildcard ";
                                }
-                               if( count( $strippedVariants ) > 1 )
+                               if ( count( $strippedVariants ) > 1 ) {
                                        $searchon .= ')';
+                               }
 
                                // Match individual terms or quoted phrase in result highlighting...
                                // Note that variants will be introduced in a later stage for highlighting!
@@ -134,8 +138,8 @@ class SearchMySQL extends SearchEngine {
                global $wgContLang;
 
                $regex = preg_quote( $string, '/' );
-               if( $wgContLang->hasWordBreaks() ) {
-                       if( $wildcard ) {
+               if ( $wgContLang->hasWordBreaks() ) {
+                       if ( $wildcard ) {
                                // Don't cut off the final bit!
                                $regex = "\b$regex";
                        } else {
@@ -177,7 +181,9 @@ class SearchMySQL extends SearchEngine {
                global $wgCountTotalSearchHits;
 
                // This seems out of place, why is this called with empty term?
-               if ( trim( $term ) === '' ) return null;
+               if ( trim( $term ) === '' ) {
+                       return null;
+               }
 
                $filteredTerm = $this->filter( $term );
                $query = $this->getQuery( $filteredTerm, $fulltext );
@@ -187,7 +193,7 @@ class SearchMySQL extends SearchEngine {
                );
 
                $total = null;
-               if( $wgCountTotalSearchHits ) {
+               if ( $wgCountTotalSearchHits ) {
                        $query = $this->getCountQuery( $filteredTerm, $fulltext );
                        $totalResult = $this->db->select(
                                $query['tables'], $query['fields'], $query['conds'],
@@ -195,7 +201,7 @@ class SearchMySQL extends SearchEngine {
                        );
 
                        $row = $totalResult->fetchObject();
-                       if( $row ) {
+                       if ( $row ) {
                                $total = intval( $row->c );
                        }
                        $totalResult->free();
@@ -223,7 +229,7 @@ class SearchMySQL extends SearchEngine {
                foreach ( $this->features as $feature => $value ) {
                        if ( $feature === 'list-redirects' && !$value ) {
                                $query['conds']['page_is_redirect'] = 0;
-                       } elseif( $feature === 'title-suffix-filter' && $value ) {
+                       } elseif ( $feature === 'title-suffix-filter' && $value ) {
                                $query['conds'][] = 'page_title' . $this->db->buildLike( $this->db->anyString(), $value );
                        }
                }
@@ -358,7 +364,7 @@ class SearchMySQL extends SearchEngine {
 
                $dbw->update( 'searchindex',
                        array( 'si_title' => $this->normalizeText( $title ) ),
-                       array( 'si_page'  => $id ),
+                       array( 'si_page' => $id ),
                        __METHOD__,
                        array( $dbw->lowPriorityOption() ) );
        }
@@ -386,7 +392,7 @@ class SearchMySQL extends SearchEngine {
                // ignores short words... Pad them so we can pass them
                // through without reconfiguring the server...
                $minLength = $this->minSearchLength();
-               if( $minLength > 1 ) {
+               if ( $minLength > 1 ) {
                        $n = $minLength - 1;
                        $out = preg_replace(
                                "/\b(\w{1,$n})\b/",
@@ -427,7 +433,7 @@ class SearchMySQL extends SearchEngine {
         * @return int
         */
        protected function minSearchLength() {
-               if( is_null( self::$mMinSearchLength ) ) {
+               if ( is_null( self::$mMinSearchLength ) ) {
                        $sql = "SHOW GLOBAL VARIABLES LIKE 'ft\\_min\\_word\\_len'";
 
                        $dbr = wfGetDB( DB_SLAVE );
@@ -435,7 +441,7 @@ class SearchMySQL extends SearchEngine {
                        $row = $result->fetchObject();
                        $result->free();
 
-                       if( $row && $row->Variable_name == 'ft_min_word_len' ) {
+                       if ( $row && $row->Variable_name == 'ft_min_word_len' ) {
                                self::$mMinSearchLength = intval( $row->Value );
                        } else {
                                self::$mMinSearchLength = 0;
index dd152f7..a847965 100644 (file)
@@ -74,8 +74,9 @@ class SearchOracle extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchText( $term ) {
-               if ( $term == '' )
+               if ( $term == '' ) {
                        return new SqlSearchResultSet( false, '' );
+               }
 
                $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
@@ -88,8 +89,9 @@ class SearchOracle extends SearchEngine {
         * @return SqlSearchResultSet
         */
        function searchTitle( $term ) {
-               if ( $term == '' )
+               if ( $term == '' ) {
                        return new SqlSearchResultSet( false, '' );
+               }
 
                $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
                return new MySQLSearchResultSet( $resultSet, $this->searchTerms );
@@ -112,8 +114,9 @@ class SearchOracle extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null( $this->namespaces ) )
+               if ( is_null( $this->namespaces ) ) {
                        return '';
+               }
                if ( !count( $this->namespaces ) ) {
                        $namespaces = '0';
                } else {
@@ -197,23 +200,24 @@ class SearchOracle extends SearchEngine {
                $searchon = '';
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
-                       foreach( $m as $terms ) {
+                       foreach ( $m as $terms ) {
                                // Search terms in all variant forms, only
                                // apply on wiki with LanguageConverter
                                $temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] );
-                               if( is_array( $temp_terms ) ) {
+                               if ( is_array( $temp_terms ) ) {
                                        $temp_terms = array_unique( array_values( $temp_terms ) );
-                                       foreach( $temp_terms as $t ) {
-                                               $searchon .= ($terms[1] == '-' ? ' ~' : ' & ') . $this->escapeTerm( $t );
+                                       foreach ( $temp_terms as $t ) {
+                                               $searchon .= ( $terms[1] == '-' ? ' ~' : ' & ' ) . $this->escapeTerm( $t );
                                        }
                                }
                                else {
-                                       $searchon .= ($terms[1] == '-' ? ' ~' : ' & ') . $this->escapeTerm( $terms[2] );
+                                       $searchon .= ( $terms[1] == '-' ? ' ~' : ' & ' ) . $this->escapeTerm( $terms[2] );
                                }
                                if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
-                                       if ( $terms[4] )
+                                       if ( $terms[4] ) {
                                                $regexp .= "[0-9A-Za-z_]+";
+                                       }
                                } else {
                                        $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
                                }
@@ -275,7 +279,7 @@ class SearchOracle extends SearchEngine {
 
                $dbw->update( 'searchindex',
                        array( 'si_title' => $title ),
-                       array( 'si_page'  => $id ),
+                       array( 'si_page' => $id ),
                        'SearchOracle::updateTitle',
                        array() );
        }
index 148a657..2fe31c9 100644 (file)
@@ -97,8 +97,8 @@ class SearchPostgres extends SearchEngine {
 
                $searchstring = '';
                $m = array();
-               if( preg_match_all( '/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) {
-                       foreach( $m as $terms ) {
+               if ( preg_match_all( '/([-!]?)(\S+)\s*/', $term, $m, PREG_SET_ORDER ) ) {
+                       foreach ( $m as $terms ) {
                                if ( strlen( $terms[1] ) ) {
                                        $searchstring .= ' & !';
                                }
@@ -169,8 +169,8 @@ class SearchPostgres extends SearchEngine {
                }
                else {
                        $m = array();
-                       if( preg_match_all( "/'([^']+)'/", $top, $m, PREG_SET_ORDER ) ) {
-                               foreach( $m as $terms ) {
+                       if ( preg_match_all( "/'([^']+)'/", $top, $m, PREG_SET_ORDER ) ) {
+                               foreach ( $m as $terms ) {
                                        $this->searchTerms[$terms[1]] = $terms[1];
                                }
                        }
@@ -182,11 +182,12 @@ class SearchPostgres extends SearchEngine {
                }
 
                ## Redirects
-               if ( !$this->showRedirects )
+               if ( !$this->showRedirects ) {
                        $query .= ' AND page_is_redirect = 0';
+               }
 
                ## Namespaces - defaults to 0
-               if( !is_null( $this->namespaces ) ) { // null -> search all
+               if ( !is_null( $this->namespaces ) ) { // null -> search all
                        if ( count( $this->namespaces ) < 1 ) {
                                $query .= ' AND page_namespace = 0';
                        } else {
@@ -244,7 +245,7 @@ class PostgresSearchResultSet extends SqlSearchResultSet {
 
        function next() {
                $row = $this->mResultSet->fetchObject();
-               if( $row === false ) {
+               if ( $row === false ) {
                        return false;
                } else {
                        return new PostgresSearchResult( $row );
index 5b0b7f7..71fd021 100644 (file)
@@ -61,12 +61,12 @@ class SearchSqlite extends SearchEngine {
                $this->searchTerms = array();
 
                $m = array();
-               if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
+               if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
-                       foreach( $m as $bits ) {
+                       foreach ( $m as $bits ) {
                                @list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
 
-                               if( $nonQuoted != '' ) {
+                               if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
                                        $quote = '';
                                } else {
@@ -74,14 +74,14 @@ class SearchSqlite extends SearchEngine {
                                        $quote = '"';
                                }
 
-                               if( $searchon !== '' ) {
+                               if ( $searchon !== '' ) {
                                        $searchon .= ' ';
                                }
 
                                // Some languages such as Serbian store the input form in the search index,
                                // so we may need to search for matches in multiple writing system variants.
                                $convertedVariants = $wgContLang->autoConvertToAllVariants( $term );
-                               if( is_array( $convertedVariants ) ) {
+                               if ( is_array( $convertedVariants ) ) {
                                        $variants = array_unique( array_values( $convertedVariants ) );
                                } else {
                                        $variants = array( $term );
@@ -101,10 +101,11 @@ class SearchSqlite extends SearchEngine {
                                $strippedVariants = array_unique( $strippedVariants );
 
                                $searchon .= $modifier;
-                               if( count( $strippedVariants ) > 1 )
+                               if ( count( $strippedVariants ) > 1 ) {
                                        $searchon .= '(';
-                               foreach( $strippedVariants as $stripped ) {
-                                       if( $nonQuoted && strpos( $stripped, ' ' ) !== false ) {
+                               }
+                               foreach ( $strippedVariants as $stripped ) {
+                                       if ( $nonQuoted && strpos( $stripped, ' ' ) !== false ) {
                                                // Hack for Chinese: we need to toss in quotes for
                                                // multiple-character phrases since normalizeForSearch()
                                                // added spaces between them to make word breaks.
@@ -112,8 +113,9 @@ class SearchSqlite extends SearchEngine {
                                        }
                                        $searchon .= "$quote$stripped$quote$wildcard ";
                                }
-                               if( count( $strippedVariants ) > 1 )
+                               if ( count( $strippedVariants ) > 1 ) {
                                        $searchon .= ')';
+                               }
 
                                // Match individual terms or quoted phrase in result highlighting...
                                // Note that variants will be introduced in a later stage for highlighting!
@@ -134,8 +136,8 @@ class SearchSqlite extends SearchEngine {
                global $wgContLang;
 
                $regex = preg_quote( $string, '/' );
-               if( $wgContLang->hasWordBreaks() ) {
-                       if( $wildcard ) {
+               if ( $wgContLang->hasWordBreaks() ) {
+                       if ( $wildcard ) {
                                // Don't cut off the final bit!
                                $regex = "\b$regex";
                        } else {
@@ -184,10 +186,10 @@ class SearchSqlite extends SearchEngine {
                $resultSet = $this->db->query( $this->getQuery( $filteredTerm, $fulltext ) );
 
                $total = null;
-               if( $wgCountTotalSearchHits ) {
+               if ( $wgCountTotalSearchHits ) {
                        $totalResult = $this->db->query( $this->getCountQuery( $filteredTerm, $fulltext ) );
                        $row = $totalResult->fetchObject();
-                       if( $row ) {
+                       if ( $row ) {
                                $total = intval( $row->c );
                        }
                        $totalResult->free();
@@ -201,7 +203,7 @@ class SearchSqlite extends SearchEngine {
         * @return String
         */
        function queryRedirect() {
-               if( $this->showRedirects ) {
+               if ( $this->showRedirects ) {
                        return '';
                } else {
                        return 'AND page_is_redirect=0';
@@ -213,8 +215,9 @@ class SearchSqlite extends SearchEngine {
         * @return String
         */
        function queryNamespaces() {
-               if( is_null( $this->namespaces ) )
+               if ( is_null( $this->namespaces ) ) {
                        return '';  # search all
+               }
                if ( !count( $this->namespaces ) ) {
                        $namespaces = '0';
                } else {
@@ -324,7 +327,7 @@ class SearchSqlite extends SearchEngine {
 
                $dbw->update( 'searchindex',
                        array( 'si_title' => $title ),
-                       array( 'rowid'  => $id ),
+                       array( 'rowid' => $id ),
                        __METHOD__ );
        }
 }
index 35199d6..8c1bda2 100644 (file)
@@ -40,7 +40,7 @@ class SearchUpdate implements DeferrableUpdate {
                        $nt = $title;
                }
 
-               if( $nt ) {
+               if ( $nt ) {
                        $this->mId = $id;
                        $this->mText = $text;
 
@@ -56,7 +56,7 @@ class SearchUpdate implements DeferrableUpdate {
        function doUpdate() {
                global $wgContLang, $wgDisableSearchUpdate;
 
-               if( $wgDisableSearchUpdate || !$this->mId ) {
+               if ( $wgDisableSearchUpdate || !$this->mId ) {
                        return;
                }
 
@@ -65,7 +65,7 @@ class SearchUpdate implements DeferrableUpdate {
                $search = SearchEngine::create();
                $lc = SearchEngine::legalSearchChars() . '&#;';
 
-               if( $this->mText === false ) {
+               if ( $this->mText === false ) {
                        $search->updateTitle( $this->mId,
                                $search->normalizeText( Title::indexTitle( $this->mNamespace, $this->mTitle ) ) );
                        wfProfileOut( __METHOD__ );
index 16652a9..35d6a0c 100644 (file)
@@ -54,6 +54,7 @@ class SpecialAllmessages extends SpecialPage {
                global $wgUseDatabaseMessages;
                if ( !$wgUseDatabaseMessages ) {
                        $out->addWikiMsg( 'allmessagesnotsupportedDB' );
+
                        return;
                } else {
                        $this->outputHeader( 'allmessagestext' );
@@ -73,7 +74,6 @@ class SpecialAllmessages extends SpecialPage {
                        $this->table->getNavigationBar() .
                        $this->table->getBody() .
                        $this->table->getNavigationBar() );
-
        }
 
        protected function getGroupName() {
@@ -211,6 +211,7 @@ class AllmessagesTablePager extends TablePager {
                        $this->getHiddenFields( array( 'title', 'prefix', 'filter', 'lang', 'limit' ) ) .
                        Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' );
+
                return $out;
        }
 
@@ -227,6 +228,7 @@ class AllmessagesTablePager extends TablePager {
                $messageNames = array_map( array( $this->lang, 'ucfirst' ), $messageNames );
 
                wfProfileOut( __METHOD__ );
+
                return $messageNames;
        }
 
@@ -317,6 +319,7 @@ class AllmessagesTablePager extends TablePager {
                                break;
                        }
                }
+
                return $result;
        }
 
@@ -365,6 +368,7 @@ class AllmessagesTablePager extends TablePager {
                                                array( 'broken' )
                                        );
                                }
+
                                return $title . ' ' . $this->msg( 'parentheses' )->rawParams( $talk )->escaped();
 
                        case 'am_default' :
@@ -388,6 +392,7 @@ class AllmessagesTablePager extends TablePager {
                        $s .= Xml::tags( 'td', $this->getCellAttrs( 'am_actual', $row->am_actual ), $formatted )
                                . "</tr>\n";
                }
+
                return $s;
        }
 
@@ -399,6 +404,7 @@ class AllmessagesTablePager extends TablePager {
                if ( !$isSecond ) {
                        $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLanguage()->lcfirst( $row->am_title ) );
                }
+
                return $arr;
        }
 
index 8c93520..98ec4f6 100644 (file)
@@ -159,6 +159,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                $out .= Xml::closeElement( 'fieldset' );
                $out .= Xml::closeElement( 'form' );
                $out .= Xml::closeElement( 'div' );
+
                return $out;
        }
 
@@ -258,6 +259,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                        } else {
                                $output->addHTML( $this->namespaceForm( $namespace, $from, $to, $hideredirects ) );
                        }
+
                        return;
                }
 
@@ -317,7 +319,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                        'to' => $outpoint,
                );
 
-               if( $namespace ) {
+               if ( $namespace ) {
                        $queryParams['namespace'] = $namespace;
                }
                if ( $hideRedirects ) {
@@ -331,6 +333,7 @@ class SpecialAllpages extends IncludableSpecialPage {
                        "<a href=\"$link\">$inpointf</a></td><td>",
                        "</td><td><a href=\"$link\">$outpointf</a>"
                )->escaped();
+
                return '<tr><td class="mw-allpages-alphaindexline">' . $out . '</td></tr>';
        }
 
@@ -531,7 +534,6 @@ class SpecialAllpages extends IncludableSpecialPage {
                                        )
                        );
                }
-
        }
 
        /**
index 5d0b79f..b083032 100644 (file)
@@ -78,6 +78,7 @@ class AncientPagesPage extends QueryPage {
                        $title,
                        htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
                );
+
                return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
        }
 
index 2a5e504..645de23 100644 (file)
@@ -444,6 +444,7 @@ class SpecialBlock extends FormSpecialPage {
                } elseif ( IP::isIPAddress( $target ) ) {
                        return Title::makeTitleSafe( NS_USER, $target );
                }
+
                return null;
        }
 
@@ -510,6 +511,7 @@ class SpecialBlock extends FormSpecialPage {
                $status = self::validateTarget( $value, $form->getUser() );
                if ( !$status->isOK() ) {
                        $errors = $status->getErrorsArray();
+
                        return call_user_func_array( array( $form, 'msg' ), $errors[0] );
                } else {
                        return true;
@@ -954,4 +956,5 @@ class SpecialBlock extends FormSpecialPage {
 }
 
 # BC @since 1.18
-class IPBlockForm extends SpecialBlock {}
+class IPBlockForm extends SpecialBlock {
+}
index 4868a75..b83b499 100644 (file)
@@ -59,6 +59,7 @@ class SpecialBlockList extends SpecialPage {
                        # B/C @since 1.18: Unblock interface is now at Special:Unblock
                        $title = SpecialPage::getTitleFor( 'Unblock', $this->target );
                        $out->redirect( $title->getFullURL() );
+
                        return;
                }
 
@@ -182,10 +183,8 @@ class SpecialBlockList extends SpecialPage {
                                        $pager->getBody() .
                                        $pager->getNavigationBar()
                        );
-
                } elseif ( $this->target ) {
                        $out->addWikiMsg( 'ipblocklist-no-results' );
-
                } else {
                        $out->addWikiMsg( 'ipblocklist-empty' );
                }
@@ -482,5 +481,4 @@ class HTMLBlockedUsersItemSelect extends HTMLSelectField {
 
                return true;
        }
-
 }
index 1e5b524..c3d6080 100644 (file)
@@ -41,6 +41,7 @@ class SpecialBlockme extends UnlistedSpecialPage {
                $ip = $this->getRequest()->getIP();
                if ( !$wgBlockOpenProxies || $this->getRequest()->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) {
                        $this->getOutput()->addWikiMsg( 'proxyblocker-disabled' );
+
                        return;
                }
 
index b3933c5..0d76883 100644 (file)
@@ -95,6 +95,7 @@ class SpecialBookSources extends SpecialPage {
                                return true;
                        }
                }
+
                return false;
        }
 
@@ -124,6 +125,7 @@ class SpecialBookSources extends SpecialPage {
                $form .= '&#160;' . Xml::submitButton( $this->msg( 'booksources-go' )->text() ) . "</p>\n";
                $form .= Html::closeElement( 'form' ) . "\n";
                $form .= Html::closeElement( 'fieldset' ) . "\n";
+
                return $form;
        }
 
@@ -153,6 +155,7 @@ class SpecialBookSources extends SpecialPage {
 
                                $text = $content->getNativeData();
                                $this->getOutput()->addWikiText( str_replace( 'MAGICNUMBER', $this->isbn, $text ) );
+
                                return true;
                        } else {
                                throw new MWException( "Unexpected content type for book sources: " . $content->getModel() );
@@ -163,9 +166,11 @@ class SpecialBookSources extends SpecialPage {
                $this->getOutput()->addWikiMsg( 'booksources-text' );
                $this->getOutput()->addHTML( '<ul>' );
                $items = $wgContLang->getBookstoreList();
-               foreach ( $items as $label => $url )
+               foreach ( $items as $label => $url ) {
                        $this->getOutput()->addHTML( $this->makeListItem( $label, $url ) );
+               }
                $this->getOutput()->addHTML( '</ul>' );
+
                return true;
        }
 
@@ -178,6 +183,7 @@ class SpecialBookSources extends SpecialPage {
         */
        private function makeListItem( $label, $url ) {
                $url = str_replace( '$1', $this->isbn, $url );
+
                return Html::rawElement( 'li', array(),
                        Html::element( 'a', array( 'href' => $url, 'class' => 'external' ), $label ) );
        }
index dd878cf..b2ddc22 100644 (file)
@@ -51,6 +51,7 @@ class BrokenRedirectsPage extends QueryPage {
 
        function getQueryInfo() {
                $dbr = wfGetDB( DB_SLAVE );
+
                return array(
                        'tables' => array(
                                'redirect',
@@ -149,6 +150,7 @@ class BrokenRedirectsPage extends QueryPage {
 
                $out .= $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->pipeList( $links ) )->escaped();
                $out .= " {$arr} {$to}";
+
                return $out;
        }
 
index ddd11ad..39305f0 100644 (file)
@@ -194,5 +194,4 @@ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper {
                        $this->getOutput()->setSubtitle( $this->cacheHelper->getCachedNotice( $this->getContext() ) );
                }
        }
-
 }
index f7256a4..d01bfd7 100644 (file)
@@ -90,6 +90,7 @@ class CategoryPager extends AlphabeticPager {
        function getDefaultQuery() {
                parent::getDefaultQuery();
                unset( $this->mDefaultQuery['from'] );
+
                return $this->mDefaultQuery;
        }
 
@@ -114,6 +115,7 @@ class CategoryPager extends AlphabeticPager {
                }
                $batch->execute();
                $this->mResult->rewind();
+
                return parent::getBody();
        }
 
@@ -121,6 +123,7 @@ class CategoryPager extends AlphabeticPager {
                $title = Title::makeTitle( NS_CATEGORY, $result->cat_title );
                $titleText = Linker::link( $title, htmlspecialchars( $title->getText() ) );
                $count = $this->msg( 'nmembers' )->numParams( $result->cat_pages )->escaped();
+
                return Xml::tags( 'li', null, $this->getLanguage()->specialList( $titleText, $count ) ) . "\n";
        }
 
@@ -136,9 +139,9 @@ class CategoryPager extends AlphabeticPager {
                                        Xml::inputLabel(
                                                $this->msg( 'categoriesfrom' )->text(),
                                                'from', 'from', 20, $from ) .
-                                                       ' ' .
-                                                       Xml::submitButton( $this->msg( 'allpagessubmit' )->text()
-                                       )
+                                               ' ' .
+                                               Xml::submitButton( $this->msg( 'allpagessubmit' )->text()
+                                               )
                                )
                );
        }
index 2086fd3..9e435fb 100644 (file)
@@ -49,6 +49,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
         */
        function isListed() {
                global $wgAuth;
+
                return $wgAuth->allowPropChange( 'emailaddress' );
        }
 
@@ -67,6 +68,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                if ( !$wgAuth->allowPropChange( 'emailaddress' ) ) {
                        $this->error( 'cannotchangeemail' );
+
                        return;
                }
 
@@ -75,11 +77,13 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
                        $this->error( 'changeemail-no-info' );
+
                        return;
                }
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $this->doReturnTo();
+
                        return;
                }
 
@@ -203,6 +207,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                        $out .= "</td>\n";
                        $out .= "</tr>";
                }
+
                return $out;
        }
 
@@ -217,18 +222,21 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
 
                if ( $newaddr != '' && !Sanitizer::validateEmail( $newaddr ) ) {
                        $this->error( 'invalidemailaddress' );
+
                        return false;
                }
 
                $throttleCount = LoginForm::incLoginThrottle( $user->getName() );
                if ( $throttleCount === true ) {
                        $this->error( 'login-throttled' );
+
                        return false;
                }
 
                global $wgRequirePasswordforEmailChange;
                if ( $wgRequirePasswordforEmailChange && !$user->checkTemporaryPassword( $pass ) && !$user->checkPassword( $pass ) ) {
                        $this->error( 'wrongpassword' );
+
                        return false;
                }
 
@@ -243,6 +251,7 @@ class SpecialChangeEmail extends UnlistedSpecialPage {
                                '<p class="error">' .
                                        $this->getOutput()->parseInline( $status->getWikiText( 'mailerror' ) ) .
                                        '</p>' );
+
                        return false;
                }
 
index 95fbb0d..3f65520 100644 (file)
@@ -54,11 +54,13 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                $user = $this->getUser();
                if ( !$request->wasPosted() && !$user->isLoggedIn() ) {
                        $this->error( $this->msg( 'resetpass-no-info' )->text() );
+
                        return;
                }
 
                if ( $request->wasPosted() && $request->getBool( 'wpCancel' ) ) {
                        $this->doReturnTo();
+
                        return;
                }
 
@@ -69,6 +71,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                                $this->mDomain = $wgAuth->getDomain();
                                if ( !$wgAuth->allowPasswordChange() ) {
                                        $this->error( $this->msg( 'resetpass_forbidden' )->text() );
+
                                        return;
                                }
 
@@ -90,6 +93,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                                        $login->setContext( $this->getContext() );
                                        $login->execute( null );
                                }
+
                                return;
                        } catch ( PasswordError $e ) {
                                $this->error( $e->getMessage() );
@@ -218,6 +222,7 @@ class SpecialChangePassword extends UnlistedSpecialPage {
                        $out .= "</td>\n";
                        $out .= "</tr>";
                }
+
                return $out;
        }
 
index 3b82326..fc6b0c5 100644 (file)
@@ -136,6 +136,7 @@ class SpecialComparePages extends SpecialPage {
                                return $title->getLatestRevID();
                        }
                }
+
                return null;
        }
 
@@ -150,6 +151,7 @@ class SpecialComparePages extends SpecialPage {
                if ( !$title->exists() ) {
                        return $this->msg( 'compare-title-not-exists' )->parseAsBlock();
                }
+
                return true;
        }
 
@@ -161,6 +163,7 @@ class SpecialComparePages extends SpecialPage {
                if ( $revision === null ) {
                        return $this->msg( 'compare-revision-not-exists' )->parseAsBlock();
                }
+
                return true;
        }
 
index c8190c8..47808d1 100644 (file)
@@ -125,6 +125,7 @@ class EmailConfirmation extends UnlistedSpecialPage {
                $user = User::newFromConfirmationCode( $code );
                if ( !is_object( $user ) ) {
                        $this->getOutput()->addWikiMsg( 'confirmemail_invalid' );
+
                        return;
                }
 
@@ -167,6 +168,7 @@ class EmailInvalidation extends UnlistedSpecialPage {
                $user = User::newFromConfirmationCode( $code );
                if ( !is_object( $user ) ) {
                        $this->getOutput()->addWikiMsg( 'confirmemail_invalid' );
+
                        return;
                }
 
index 932f05e..a0351a4 100644 (file)
@@ -64,6 +64,7 @@ class SpecialContributions extends SpecialPage {
 
                if ( !strlen( $target ) ) {
                        $out->addHTML( $this->getForm() );
+
                        return;
                }
 
@@ -76,11 +77,13 @@ class SpecialContributions extends SpecialPage {
                $nt = Title::makeTitleSafe( NS_USER, $target );
                if ( !$nt ) {
                        $out->addHTML( $this->getForm() );
+
                        return;
                }
                $userObj = User::newFromName( $nt->getText(), false );
                if ( !$userObj ) {
                        $out->addHTML( $this->getForm() );
+
                        return;
                }
                $id = $userObj->getID();
@@ -158,6 +161,7 @@ class SpecialContributions extends SpecialPage {
                        $url = wfAppendQuery( wfScript( 'api' ), $apiParams );
 
                        $out->redirect( $url, '301' );
+
                        return;
                }
 
@@ -270,6 +274,7 @@ class SpecialContributions extends SpecialPage {
                $oldMsg = $this->msg( 'contribsub' );
                if ( $oldMsg->exists() ) {
                        $linksWithParentheses = $this->msg( 'parentheses' )->rawParams( $links )->escaped();
+
                        return $oldMsg->rawParams( "$user $linksWithParentheses" );
                }
 
@@ -308,6 +313,7 @@ class SpecialContributions extends SpecialPage {
                                        );
                                }
                        }
+
                        # Block log link
                        $tools[] = Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Log', 'block' ),
@@ -347,6 +353,7 @@ class SpecialContributions extends SpecialPage {
                }
 
                wfRunHooks( 'ContributionsToolLinks', array( $id, $userpage, &$tools ) );
+
                return $tools;
        }
 
@@ -496,32 +503,32 @@ class SpecialContributions extends SpecialPage {
                                        'class' => 'namespaceselector',
                                )
                        ) . '&#160;' .
-                       Html::rawElement(
-                               'span',
-                               array( 'style' => 'white-space: nowrap' ),
-                               Xml::checkLabel(
-                                       $this->msg( 'invert' )->text(),
-                                       'nsInvert',
-                                       'nsInvert',
-                                       $this->opts['nsInvert'],
-                                       array(
-                                               'title' => $this->msg( 'tooltip-invert' )->text(),
-                                               'class' => 'mw-input'
-                                       )
-                               ) . '&#160;'
-                       ) .
-                       Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
-                               Xml::checkLabel(
-                                       $this->msg( 'namespace_association' )->text(),
-                                       'associated',
-                                       'associated',
-                                       $this->opts['associated'],
-                                       array(
-                                               'title' => $this->msg( 'tooltip-namespace_association' )->text(),
-                                               'class' => 'mw-input'
-                                       )
-                               ) . '&#160;'
-                       )
+                               Html::rawElement(
+                                       'span',
+                                       array( 'style' => 'white-space: nowrap' ),
+                                       Xml::checkLabel(
+                                               $this->msg( 'invert' )->text(),
+                                               'nsInvert',
+                                               'nsInvert',
+                                               $this->opts['nsInvert'],
+                                               array(
+                                                       'title' => $this->msg( 'tooltip-invert' )->text(),
+                                                       'class' => 'mw-input'
+                                               )
+                                       ) . '&#160;'
+                               ) .
+                               Html::rawElement( 'span', array( 'style' => 'white-space: nowrap' ),
+                                       Xml::checkLabel(
+                                               $this->msg( 'namespace_association' )->text(),
+                                               'associated',
+                                               'associated',
+                                               $this->opts['associated'],
+                                               array(
+                                                       'title' => $this->msg( 'tooltip-namespace_association' )->text(),
+                                                       'class' => 'mw-input'
+                                               )
+                                       ) . '&#160;'
+                               )
                );
 
                if ( $this->getUser()->isAllowed( 'deletedhistory' ) ) {
@@ -644,6 +651,7 @@ class ContribsPager extends ReverseChronologicalPager {
        function getDefaultQuery() {
                $query = parent::getDefaultQuery();
                $query['target'] = $this->target;
+
                return $query;
        }
 
@@ -753,6 +761,7 @@ class ContribsPager extends ReverseChronologicalPager {
                );
 
                wfRunHooks( 'ContribsPager::getQueryInfo', array( &$this, &$queryInfo ) );
+
                return $queryInfo;
        }
 
@@ -1030,6 +1039,7 @@ class ContribsPager extends ReverseChronologicalPager {
                }
 
                wfProfileOut( __METHOD__ );
+
                return $ret;
        }
 
index 6978d6b..44137c1 100644 (file)
@@ -59,24 +59,29 @@ class DeadendPagesPage extends PageQueryPage {
        function getQueryInfo() {
                return array(
                        'tables' => array( 'page', 'pagelinks' ),
-                       'fields' => array( 'namespace' => 'page_namespace',
-                                       'title' => 'page_title',
-                                       'value' => 'page_title'
+                       'fields' => array(
+                               'namespace' => 'page_namespace',
+                               'title' => 'page_title',
+                               'value' => 'page_title'
                        ),
-                       'conds' => array( 'pl_from IS NULL',
-                                       'page_namespace' => MWNamespace::getContentNamespaces(),
-                                       'page_is_redirect' => 0
+                       'conds' => array(
+                               'pl_from IS NULL',
+                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_is_redirect' => 0
                        ),
-                       'join_conds' => array( 'pagelinks' => array( 'LEFT JOIN', array(
-                                       'page_id=pl_from'
-                       ) ) )
+                       'join_conds' => array(
+                               'pagelinks' => array(
+                                       'LEFT JOIN',
+                                       array( 'page_id=pl_from' )
+                               )
+                       )
                );
        }
 
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort
-               if( count( MWNamespace::getContentNamespaces() ) > 1 ) {
+               if ( count( MWNamespace::getContentNamespaces() ) > 1 ) {
                        return array( 'page_namespace', 'page_title' );
                } else {
                        return array( 'page_title' );
index 901c7f9..28ca24b 100644 (file)
@@ -49,6 +49,7 @@ class DeletedContribsPager extends IndexPager {
        function getDefaultQuery() {
                $query = parent::getDefaultQuery();
                $query['target'] = $this->target;
+
                return $query;
        }
 
@@ -63,6 +64,7 @@ class DeletedContribsPager extends IndexPager {
                        $conds[] = $this->mDb->bitAnd( 'ar_deleted', Revision::SUPPRESSED_USER ) .
                                ' != ' . Revision::SUPPRESSED_USER;
                }
+
                return array(
                        'tables' => array( 'archive' ),
                        'fields' => array(
@@ -255,6 +257,7 @@ class DeletedContribsPager extends IndexPager {
                $ret = Html::rawElement( 'li', array(), $ret ) . "\n";
 
                wfProfileOut( __METHOD__ );
+
                return $ret;
        }
 
@@ -290,6 +293,7 @@ class DeletedContributionsPage extends SpecialPage {
 
                if ( !$this->userCanExecute( $user ) ) {
                        $this->displayRestrictionError();
+
                        return;
                }
 
@@ -307,6 +311,7 @@ class DeletedContributionsPage extends SpecialPage {
 
                if ( !strlen( $target ) ) {
                        $out->addHTML( $this->getForm( '' ) );
+
                        return;
                }
 
@@ -316,6 +321,7 @@ class DeletedContributionsPage extends SpecialPage {
                $userObj = User::newFromName( $target, false );
                if ( !$userObj ) {
                        $out->addHTML( $this->getForm( '' ) );
+
                        return;
                }
                $this->getSkin()->setRelevantUser( $userObj );
@@ -334,6 +340,7 @@ class DeletedContributionsPage extends SpecialPage {
                $pager = new DeletedContribsPager( $this->getContext(), $target, $options['namespace'] );
                if ( !$pager->getNumRows() ) {
                        $out->addWikiMsg( 'nocontribs' );
+
                        return;
                }
 
index 51262b4..ceecd15 100644 (file)
@@ -54,32 +54,35 @@ class DisambiguationsPage extends QueryPage {
                # If the text can be treated as a title, use it verbatim.
                # Otherwise, pull the titles from the links table
                $dp = Title::newFromText( $dMsgText );
-               if( $dp ) {
-                       if( $dp->getNamespace() != NS_TEMPLATE ) {
+               if ( $dp ) {
+                       if ( $dp->getNamespace() != NS_TEMPLATE ) {
                                # @todo FIXME: We assume the disambiguation message is a template but
                                # the page can potentially be from another namespace :/
                                wfDebug( "Mediawiki:disambiguationspage message does not refer to a template!\n" );
                        }
                        $linkBatch->addObj( $dp );
                } else {
-                               # Get all the templates linked from the Mediawiki:Disambiguationspage
-                               $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
-                               $res = $dbr->select(
-                                       array( 'pagelinks', 'page' ),
-                                       'pl_title',
-                                       array( 'page_id = pl_from',
-                                               'pl_namespace' => NS_TEMPLATE,
-                                               'page_namespace' => $disPageObj->getNamespace(),
-                                               'page_title' => $disPageObj->getDBkey()
-                                       ), __METHOD__ );
-
-                               foreach ( $res as $row ) {
-                                       $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
-                               }
+                       # Get all the templates linked from the Mediawiki:Disambiguationspage
+                       $disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
+                       $res = $dbr->select(
+                               array( 'pagelinks', 'page' ),
+                               'pl_title',
+                               array(
+                                       'page_id = pl_from',
+                                       'pl_namespace' => NS_TEMPLATE,
+                                       'page_namespace' => $disPageObj->getNamespace(),
+                                       'page_title' => $disPageObj->getDBkey()
+                               ),
+                               __METHOD__
+                       );
+
+                       foreach ( $res as $row ) {
+                               $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ) );
+                       }
                }
                $set = $linkBatch->constructSet( 'tl', $dbr );
 
-               if( $set === false ) {
+               if ( $set === false ) {
                        # We must always return a valid SQL query, but this way
                        # the DB will always quickly return an empty result
                        $set = 'FALSE';
index 7564b00..c364f70 100644 (file)
@@ -122,10 +122,17 @@ class DoubleRedirectsPage extends QueryPage {
                // using the filter of reallyGetQueryInfo.
                if ( $result && !isset( $result->nsb ) ) {
                        $dbr = wfGetDB( DB_SLAVE );
-                       $qi = $this->reallyGetQueryInfo( $result->namespace,
-                                       $result->title );
-                       $res = $dbr->select( $qi['tables'], $qi['fields'],
-                                       $qi['conds'], __METHOD__ );
+                       $qi = $this->reallyGetQueryInfo(
+                               $result->namespace,
+                               $result->title
+                       );
+                       $res = $dbr->select(
+                               $qi['tables'],
+                               $qi['fields'],
+                               $qi['conds'],
+                               __METHOD__
+                       );
+
                        if ( $res ) {
                                $result = $dbr->fetchObject( $res );
                        }
@@ -166,7 +173,7 @@ class DoubleRedirectsPage extends QueryPage {
                $lang = $this->getLanguage();
                $arr = $lang->getArrow() . $lang->getDirMark();
 
-               return( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
+               return ( "{$linkA} {$edit} {$arr} {$linkB} {$arr} {$linkC}" );
        }
 
        protected function getGroupName() {
index ad06d5f..f297039 100644 (file)
@@ -35,7 +35,6 @@
  * @author Rob Church <robchur@gmail.com>
  */
 class SpecialEditWatchlist extends UnlistedSpecialPage {
-
        /**
         * Editing modes
         */
@@ -64,7 +63,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $out = $this->getOutput();
 
                # Anons don't get a watchlist
-               if( $this->getUser()->isAnon() ) {
+               if ( $this->getUser()->isAnon() ) {
                        $out->setPageTitle( $this->msg( 'watchnologin' ) );
                        $llink = Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Userlogin' ),
@@ -73,6 +72,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                array( 'returnto' => $this->getTitle()->getPrefixedText() )
                        );
                        $out->addHTML( $this->msg( 'watchlistanontext' )->rawParams( $llink )->parse() );
+
                        return;
                }
 
@@ -81,12 +81,12 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                $this->outputHeader();
 
-               $out->addSubtitle( $this->msg( 'watchlistfor2', $this->getUser()->getName()
-                       )->rawParams( SpecialEditWatchlist::buildTools( null ) ) );
+               $out->addSubtitle( $this->msg( 'watchlistfor2', $this->getUser()->getName() )
+                       ->rawParams( SpecialEditWatchlist::buildTools( null ) ) );
 
                # B/C: $mode used to be waaay down the parameter list, and the first parameter
                # was $wgUser
-               if( $mode instanceof User ) {
+               if ( $mode instanceof User ) {
                        $args = func_get_args();
                        if ( count( $args ) >= 4 ) {
                                $mode = $args[3];
@@ -94,7 +94,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                }
                $mode = self::getMode( $this->getRequest(), $mode );
 
-               switch( $mode ) {
+               switch ( $mode ) {
                        case self::EDIT_CLEAR:
                                // The "Clear" link scared people too much.
                                // Pass on to the raw editor, from which it's very easy to clear.
@@ -102,7 +102,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        case self::EDIT_RAW:
                                $out->setPageTitle( $this->msg( 'watchlistedit-raw-title' ) );
                                $form = $this->getRawForm();
-                               if( $form->show() ) {
+                               if ( $form->show() ) {
                                        $out->addHTML( $this->successMessage );
                                        $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
                                }
@@ -112,7 +112,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        default:
                                $out->setPageTitle( $this->msg( 'watchlistedit-normal-title' ) );
                                $form = $this->getNormalForm();
-                               if( $form->show() ) {
+                               if ( $form->show() ) {
                                        $out->addHTML( $this->successMessage );
                                        $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) );
                                } elseif ( $this->toc !== false ) {
@@ -131,15 +131,17 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        private function extractTitles( $list ) {
                $list = explode( "\n", trim( $list ) );
-               if( !is_array( $list ) ) {
+               if ( !is_array( $list ) ) {
                        return array();
                }
+
                $titles = array();
-               foreach( $list as $text ) {
+
+               foreach ( $list as $text ) {
                        $text = trim( $text );
-                       if( strlen( $text ) > 0 ) {
+                       if ( strlen( $text ) > 0 ) {
                                $title = Title::newFromText( $text );
-                               if( $title instanceof Title && $title->isWatchable() ) {
+                               if ( $title instanceof Title && $title->isWatchable() ) {
                                        $titles[] = $title;
                                }
                        }
@@ -148,9 +150,11 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                GenderCache::singleton()->doTitlesArray( $titles );
 
                $list = array();
-               foreach( $titles as $title ) {
+               /** @var Title $title */
+               foreach ( $titles as $title ) {
                        $list[] = $title->getPrefixedText();
                }
+
                return array_unique( $list );
        }
 
@@ -158,44 +162,45 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $wanted = $this->extractTitles( $data['Titles'] );
                $current = $this->getWatchlist();
 
-               if( count( $wanted ) > 0 ) {
+               if ( count( $wanted ) > 0 ) {
                        $toWatch = array_diff( $wanted, $current );
                        $toUnwatch = array_diff( $current, $wanted );
                        $this->watchTitles( $toWatch );
                        $this->unwatchTitles( $toUnwatch );
                        $this->getUser()->invalidateCache();
 
-                       if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
+                       if ( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) {
                                $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
                        } else {
                                return false;
                        }
 
-                       if( count( $toWatch ) > 0 ) {
+                       if ( count( $toWatch ) > 0 ) {
                                $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-added'
-                                       )->numParams( count( $toWatch ) )->parse();
+                               )->numParams( count( $toWatch ) )->parse();
                                $this->showTitles( $toWatch, $this->successMessage );
                        }
 
-                       if( count( $toUnwatch ) > 0 ) {
+                       if ( count( $toUnwatch ) > 0 ) {
                                $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed'
-                                       )->numParams( count( $toUnwatch ) )->parse();
+                               )->numParams( count( $toUnwatch ) )->parse();
                                $this->showTitles( $toUnwatch, $this->successMessage );
                        }
                } else {
                        $this->clearWatchlist();
                        $this->getUser()->invalidateCache();
 
-                       if( count( $current ) > 0 ) {
+                       if ( count( $current ) > 0 ) {
                                $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
                        } else {
                                return false;
                        }
 
-                       $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed'
-                               )->numParams( count( $current ) )->parse();
+                       $this->successMessage .= ' ' . $this->msg( 'watchlistedit-raw-removed' )
+                               ->numParams( count( $current ) )->parse();
                        $this->showTitles( $current, $this->successMessage );
                }
+
                return true;
        }
 
@@ -212,29 +217,35 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $talk = $this->msg( 'talkpagelinktext' )->escaped();
                // Do a batch existence check
                $batch = new LinkBatch();
-               foreach( $titles as $title ) {
-                       if( !$title instanceof Title ) {
+               foreach ( $titles as $title ) {
+                       if ( !$title instanceof Title ) {
                                $title = Title::newFromText( $title );
                        }
-                       if( $title instanceof Title ) {
+
+                       if ( $title instanceof Title ) {
                                $batch->addObj( $title );
                                $batch->addObj( $title->getTalkPage() );
                        }
                }
+
                $batch->execute();
+
                // Print out the list
                $output .= "<ul>\n";
-               foreach( $titles as $title ) {
-                       if( !$title instanceof Title ) {
+
+               foreach ( $titles as $title ) {
+                       if ( !$title instanceof Title ) {
                                $title = Title::newFromText( $title );
                        }
-                       if( $title instanceof Title ) {
+
+                       if ( $title instanceof Title ) {
                                $output .= "<li>"
                                        . Linker::link( $title )
                                        . ' (' . Linker::link( $title->getTalkPage(), $talk )
                                        . ")</li>\n";
                        }
                }
+
                $output .= "</ul>\n";
        }
 
@@ -247,6 +258,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        private function getWatchlist() {
                $list = array();
                $dbr = wfGetDB( DB_MASTER );
+
                $res = $dbr->select(
                        'watchlist',
                        array(
@@ -256,10 +268,12 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        ),
                        __METHOD__
                );
-               if( $res->numRows() > 0 ) {
+
+               if ( $res->numRows() > 0 ) {
                        $titles = array();
                        foreach ( $res as $row ) {
                                $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title );
+
                                if ( $this->checkTitle( $title, $row->wl_namespace, $row->wl_title )
                                        && !$title->isTalkPage()
                                ) {
@@ -270,11 +284,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                        GenderCache::singleton()->doTitlesArray( $titles );
 
-                       foreach( $titles as $title ) {
+                       foreach ( $titles as $title ) {
                                $list[] = $title->getPrefixedText();
                        }
                }
+
                $this->cleanupWatchlist();
+
                return $list;
        }
 
@@ -297,6 +313,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                );
 
                $lb = new LinkBatch();
+
                foreach ( $res as $row ) {
                        $lb->add( $row->wl_namespace, $row->wl_title );
                        if ( !MWNamespace::isTalk( $row->wl_namespace ) ) {
@@ -305,6 +322,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                }
 
                $lb->execute();
+
                return $titles;
        }
 
@@ -324,12 +342,14 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                ) {
                        $title = false; // unrecoverable
                }
+
                if ( !$title
                        || $title->getNamespace() != $namespace
                        || $title->getDBkey() != $dbKey
                ) {
                        $this->badItems[] = array( $title, $namespace, $dbKey );
                }
+
                return (bool)$title;
        }
 
@@ -337,16 +357,17 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         * Attempts to clean up broken items
         */
        private function cleanupWatchlist() {
-               if( !count( $this->badItems ) ) {
+               if ( !count( $this->badItems ) ) {
                        return; //nothing to do
                }
+
                $dbw = wfGetDB( DB_MASTER );
                $user = $this->getUser();
+
                foreach ( $this->badItems as $row ) {
                        list( $title, $namespace, $dbKey ) = $row;
-                       wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, "
-                               . ( $title ? 'cleaning up' : 'deleting' ) . ".\n"
-                       );
+                       $action = $title ? 'cleaning up' : 'deleting';
+                       wfDebug( "User {$user->getName()} has broken watchlist item ns($namespace):$dbKey, $action.\n" );
 
                        $dbw->delete( 'watchlist',
                                array(
@@ -387,11 +408,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        private function watchTitles( $titles ) {
                $dbw = wfGetDB( DB_MASTER );
                $rows = array();
-               foreach( $titles as $title ) {
-                       if( !$title instanceof Title ) {
+
+               foreach ( $titles as $title ) {
+                       if ( !$title instanceof Title ) {
                                $title = Title::newFromText( $title );
                        }
-                       if( $title instanceof Title ) {
+
+                       if ( $title instanceof Title ) {
                                $rows[] = array(
                                        'wl_user' => $this->getUser()->getId(),
                                        'wl_namespace' => MWNamespace::getSubject( $title->getNamespace() ),
@@ -406,6 +429,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                );
                        }
                }
+
                $dbw->insert( 'watchlist', $rows, __METHOD__, 'IGNORE' );
        }
 
@@ -419,11 +443,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        private function unwatchTitles( $titles ) {
                $dbw = wfGetDB( DB_MASTER );
-               foreach( $titles as $title ) {
-                       if( !$title instanceof Title ) {
+
+               foreach ( $titles as $title ) {
+                       if ( !$title instanceof Title ) {
                                $title = Title::newFromText( $title );
                        }
-                       if( $title instanceof Title ) {
+
+                       if ( $title instanceof Title ) {
                                $dbw->delete(
                                        'watchlist',
                                        array(
@@ -433,6 +459,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                        ),
                                        __METHOD__
                                );
+
                                $dbw->delete(
                                        'watchlist',
                                        array(
@@ -442,6 +469,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                        ),
                                        __METHOD__
                                );
+
                                $page = WikiPage::factory( $title );
                                wfRunHooks( 'UnwatchArticleComplete', array( $this->getUser(), &$page ) );
                        }
@@ -451,15 +479,16 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        public function submitNormal( $data ) {
                $removed = array();
 
-               foreach( $data as $titles ) {
+               foreach ( $data as $titles ) {
                        $this->unwatchTitles( $titles );
                        $removed = array_merge( $removed, $titles );
                }
 
-               if( count( $removed ) > 0 ) {
+               if ( count( $removed ) > 0 ) {
                        $this->successMessage = $this->msg( 'watchlistedit-normal-done'
-                               )->numParams( count( $removed ) )->parse();
+                       )->numParams( count( $removed ) )->parse();
                        $this->showTitles( $removed, $this->successMessage );
+
                        return true;
                } else {
                        return false;
@@ -477,7 +506,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $fields = array();
                $count = 0;
 
-               foreach( $this->getWatchlistInfo() as $namespace => $pages ) {
+               foreach ( $this->getWatchlistInfo() as $namespace => $pages ) {
                        if ( $namespace >= 0 ) {
                                $fields['TitlesNs' . $namespace] = array(
                                        'class' => 'EditWatchlistCheckboxSeriesField',
@@ -486,8 +515,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                );
                        }
 
-                       foreach( array_keys( $pages ) as $dbkey ) {
+                       foreach ( array_keys( $pages ) as $dbkey ) {
                                $title = Title::makeTitleSafe( $namespace, $dbkey );
+
                                if ( $this->checkTitle( $title, $namespace, $dbkey ) ) {
                                        $text = $this->buildRemoveLine( $title );
                                        $fields['TitlesNs' . $namespace]['options'][$text] = $title->getPrefixedText();
@@ -500,17 +530,18 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                if ( count( $fields ) > 1 && $count > 30 ) {
                        $this->toc = Linker::tocIndent();
                        $tocLength = 0;
-                       foreach( $fields as $data ) {
 
+                       foreach ( $fields as $data ) {
                                # strip out the 'ns' prefix from the section name:
                                $ns = substr( $data['section'], 2 );
 
-                               $nsText = ($ns == NS_MAIN)
+                               $nsText = ( $ns == NS_MAIN )
                                        ? $this->msg( 'blanknamespace' )->escaped()
                                        : htmlspecialchars( $wgContLang->getFormattedNsText( $ns ) );
                                $this->toc .= Linker::tocLine( "editwatchlist-{$data['section']}", $nsText,
                                        $this->getLanguage()->formatNum( ++$tocLength ), 1 ) . Linker::tocLineEnd();
                        }
+
                        $this->toc = Linker::tocList( $this->toc );
                } else {
                        $this->toc = false;
@@ -524,6 +555,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $form->setWrapperLegendMsg( 'watchlistedit-normal-legend' );
                $form->addHeaderText( $this->msg( 'watchlistedit-normal-explain' )->parse() );
                $form->setSubmitCallback( array( $this, 'submitNormal' ) );
+
                return $form;
        }
 
@@ -535,12 +567,15 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        private function buildRemoveLine( $title ) {
                $link = Linker::link( $title );
-               if( $title->isRedirect() ) {
+
+               if ( $title->isRedirect() ) {
                        // Linker already makes class mw-redirect, so this is redundant
                        $link = '<span class="watchlistredir">' . $link . '</span>';
                }
+
                $tools[] = Linker::link( $title->getTalkPage(), $this->msg( 'talkpagelinktext' )->escaped() );
-               if( $title->exists() ) {
+
+               if ( $title->exists() ) {
                        $tools[] = Linker::linkKnown(
                                $title,
                                $this->msg( 'history_short' )->escaped(),
@@ -548,7 +583,8 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                array( 'action' => 'history' )
                        );
                }
-               if( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
+
+               if ( $title->getNamespace() == NS_USER && !$title->isSubpage() ) {
                        $tools[] = Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Contributions', $title->getText() ),
                                $this->msg( 'contributions' )->escaped()
@@ -582,6 +618,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                $form->setWrapperLegendMsg( 'watchlistedit-raw-legend' );
                $form->addHeaderText( $this->msg( 'watchlistedit-raw-explain' )->parse() );
                $form->setSubmitCallback( array( $this, 'submitRaw' ) );
+
                return $form;
        }
 
@@ -595,19 +632,17 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        public static function getMode( $request, $par ) {
                $mode = strtolower( $request->getVal( 'action', $par ) );
-               switch( $mode ) {
+
+               switch ( $mode ) {
                        case 'clear':
                        case self::EDIT_CLEAR:
                                return self::EDIT_CLEAR;
-
                        case 'raw':
                        case self::EDIT_RAW:
                                return self::EDIT_RAW;
-
                        case 'edit':
                        case self::EDIT_NORMAL:
                                return self::EDIT_NORMAL;
-
                        default:
                                return false;
                }
@@ -629,21 +664,26 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        'edit' => array( 'EditWatchlist', false ),
                        'raw' => array( 'EditWatchlist', 'raw' ),
                );
-               foreach( $modes as $mode => $arr ) {
+
+               foreach ( $modes as $mode => $arr ) {
                        // can use messages 'watchlisttools-view', 'watchlisttools-edit', 'watchlisttools-raw'
                        $tools[] = Linker::linkKnown(
                                SpecialPage::getTitleFor( $arr[0], $arr[1] ),
                                wfMessage( "watchlisttools-{$mode}" )->escaped()
                        );
                }
-               return Html::rawElement( 'span',
-                                       array( 'class' => 'mw-watchlist-toollinks' ),
-                                       wfMessage( 'parentheses', $wgLang->pipeList( $tools ) )->text() );
+
+               return Html::rawElement(
+                       'span',
+                       array( 'class' => 'mw-watchlist-toollinks' ),
+                       wfMessage( 'parentheses', $wgLang->pipeList( $tools ) )->text()
+               );
        }
 }
 
 # B/C since 1.18
-class WatchlistEditor extends SpecialEditWatchlist {}
+class WatchlistEditor extends SpecialEditWatchlist {
+}
 
 /**
  * Extend HTMLForm purely so we can have a more sane way of getting the section headers
@@ -651,10 +691,12 @@ class WatchlistEditor extends SpecialEditWatchlist {}
 class EditWatchlistNormalHTMLForm extends HTMLForm {
        public function getLegend( $namespace ) {
                $namespace = substr( $namespace, 2 );
+
                return $namespace == NS_MAIN
                        ? $this->msg( 'blanknamespace' )->escaped()
                        : htmlspecialchars( $this->getContext()->getLanguage()->getFormattedNsText( $namespace ) );
        }
+
        public function getBody() {
                return $this->displaySection( $this->mFieldTree, '', 'editwatchlist-' );
        }
index 3607be9..d037d55 100644 (file)
 class SpecialEmailUser extends UnlistedSpecialPage {
        protected $mTarget;
 
+       /**
+        * @var User|string $mTargetObj
+        */
+       protected $mTargetObj;
+
        public function __construct() {
                parent::__construct( 'Emailuser' );
        }
 
        public function getDescription() {
                $target = self::getTarget( $this->mTarget );
-               if( !$target instanceof User ) {
+               if ( !$target instanceof User ) {
                        return $this->msg( 'emailuser-title-notarget' )->text();
                }
 
@@ -106,7 +111,11 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                $this->outputHeader();
 
                // error out if sending user cannot do this
-               $error = self::getPermissionsError( $this->getUser(), $this->getRequest()->getVal( 'wpEditToken' ) );
+               $error = self::getPermissionsError(
+                       $this->getUser(),
+                       $this->getRequest()->getVal( 'wpEditToken' )
+               );
+
                switch ( $error ) {
                        case null:
                                # Wahey!
@@ -127,12 +136,13 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                }
                // Got a valid target user name? Else ask for one.
                $ret = self::getTarget( $this->mTarget );
-               if( !$ret instanceof User ) {
-                       if( $this->mTarget != '' ) {
+               if ( !$ret instanceof User ) {
+                       if ( $this->mTarget != '' ) {
                                $ret = ( $ret == 'notarget' ) ? 'emailnotarget' : ( $ret . 'text' );
                                $out->wrapWikiMsg( "<p class='error'>$1</p>", $ret );
                        }
                        $out->addHTML( $this->userForm( $this->mTarget ) );
+
                        return false;
                }
 
@@ -147,13 +157,13 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                $form->setWrapperLegendMsg( 'email-legend' );
                $form->loadData();
 
-               if( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) {
+               if ( !wfRunHooks( 'EmailUserForm', array( &$form ) ) ) {
                        return false;
                }
 
                $result = $form->show();
 
-               if( $result === true || ( $result instanceof Status && $result->isGood() ) ) {
+               if ( $result === true || ( $result instanceof Status && $result->isGood() ) ) {
                        $out->setPageTitle( $this->msg( 'emailsent' ) );
                        $out->addWikiMsg( 'emailsenttext' );
                        $out->returnToMain( false, $this->mTargetObj->getUserPage() );
@@ -169,18 +179,22 @@ class SpecialEmailUser extends UnlistedSpecialPage {
        public static function getTarget( $target ) {
                if ( $target == '' ) {
                        wfDebug( "Target is empty.\n" );
+
                        return 'notarget';
                }
 
                $nu = User::newFromName( $target );
-               if( !$nu instanceof User || !$nu->getId() ) {
+               if ( !$nu instanceof User || !$nu->getId() ) {
                        wfDebug( "Target is invalid user.\n" );
+
                        return 'notarget';
                } elseif ( !$nu->isEmailConfirmed() ) {
                        wfDebug( "User has no valid email.\n" );
+
                        return 'noemail';
                } elseif ( !$nu->canReceiveEmail() ) {
                        wfDebug( "User does not allow user emails.\n" );
+
                        return 'nowikiemail';
                }
 
@@ -196,31 +210,36 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         */
        public static function getPermissionsError( $user, $editToken ) {
                global $wgEnableEmail, $wgEnableUserEmail;
-               if( !$wgEnableEmail || !$wgEnableUserEmail ) {
+
+               if ( !$wgEnableEmail || !$wgEnableUserEmail ) {
                        return 'usermaildisabled';
                }
 
-               if( !$user->isAllowed( 'sendemail' ) ) {
+               if ( !$user->isAllowed( 'sendemail' ) ) {
                        return 'badaccess';
                }
 
-               if( !$user->isEmailConfirmed() ) {
+               if ( !$user->isEmailConfirmed() ) {
                        return 'mailnologin';
                }
 
-               if( $user->isBlockedFromEmailuser() ) {
+               if ( $user->isBlockedFromEmailuser() ) {
                        wfDebug( "User is blocked from sending e-mail.\n" );
+
                        return "blockedemailuser";
                }
 
-               if( $user->pingLimiter( 'emailuser' ) ) {
+               if ( $user->pingLimiter( 'emailuser' ) ) {
                        wfDebug( "Ping limiter triggered.\n" );
+
                        return 'actionthrottledtext';
                }
 
                $hookErr = false;
+
                wfRunHooks( 'UserCanSendEmail', array( &$user, &$hookErr ) );
                wfRunHooks( 'EmailUserPermissionsErrors', array( $user, $editToken, &$hookErr ) );
+
                if ( $hookErr ) {
                        return $hookErr;
                }
@@ -236,14 +255,25 @@ class SpecialEmailUser extends UnlistedSpecialPage {
         */
        protected function userForm( $name ) {
                global $wgScript;
-               $string = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'askusername' ) ) .
+               $string = Xml::openElement(
+                       'form',
+                       array( 'method' => 'get', 'action' => $wgScript, 'id' => 'askusername' )
+               ) .
                        Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                        Xml::openElement( 'fieldset' ) .
                        Html::rawElement( 'legend', null, $this->msg( 'emailtarget' )->parse() ) .
-                       Xml::inputLabel( $this->msg( 'emailusername' )->text(), 'target', 'emailusertarget', 30, $name ) . ' ' .
+                       Xml::inputLabel(
+                               $this->msg( 'emailusername' )->text(),
+                               'target',
+                               'emailusertarget',
+                               30,
+                               $name
+                       ) .
+                       ' ' .
                        Xml::submitButton( $this->msg( 'emailusernamesubmit' )->text() ) .
                        Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' ) . "\n";
+
                return $string;
        }
 
@@ -273,9 +303,10 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                global $wgUserEmailUseReplyTo;
 
                $target = self::getTarget( $data['Target'] );
-               if( !$target instanceof User ) {
+               if ( !$target instanceof User ) {
                        return $context->msg( $target . 'text' )->parseAsBlock();
                }
+
                $to = new MailAddress( $target );
                $from = new MailAddress( $context->getUser() );
                $subject = $data['Subject'];
@@ -287,11 +318,11 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        $from->name, $to->name )->inContentLanguage()->text();
 
                $error = '';
-               if( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) {
+               if ( !wfRunHooks( 'EmailUser', array( &$to, &$from, &$subject, &$text, &$error ) ) ) {
                        return $error;
                }
 
-               if( $wgUserEmailUseReplyTo ) {
+               if ( $wgUserEmailUseReplyTo ) {
                        // Put the generic wiki autogenerated address in the From:
                        // header and reserve the user for Reply-To.
                        //
@@ -299,6 +330,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        // wiki-borne mails from direct mails and protects against
                        // SPF and bounce problems with some mailers (see below).
                        global $wgPasswordSender, $wgPasswordSenderName;
+
                        $mailFrom = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
                        $replyTo = $from;
                } else {
@@ -321,7 +353,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
 
                $status = UserMailer::send( $to, $mailFrom, $subject, $text, $replyTo );
 
-               if( !$status->isGood() ) {
+               if ( !$status->isGood() ) {
                        return $status;
                } else {
                        // if the user requested a copy of this mail, do this now,
@@ -336,6 +368,7 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        }
 
                        wfRunHooks( 'EmailUserComplete', array( $to, $from, $subject, $text ) );
+
                        return $status;
                }
        }
index ef86e8e..61ed34d 100644 (file)
@@ -29,7 +29,6 @@
  * @ingroup SpecialPage
  */
 class SpecialExport extends SpecialPage {
-
        private $curonly, $doExport, $pageLinkDepth, $templates;
        private $images;
 
@@ -75,8 +74,7 @@ class SpecialExport extends SpecialPage {
                                        }
                                }
                        }
-               }
-               elseif( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) {
+               } elseif ( $request->getCheck( 'addns' ) && $wgExportFromNamespaces ) {
                        $page = $request->getText( 'pages' );
                        $nsindex = $request->getText( 'nsindex', '' );
 
@@ -89,8 +87,7 @@ class SpecialExport extends SpecialPage {
                                        $page .= "\n" . implode( "\n", $nspages );
                                }
                        }
-               }
-               elseif( $request->getCheck( 'exportall' ) && $wgExportAllowAll ) {
+               } elseif ( $request->getCheck( 'exportall' ) && $wgExportAllowAll ) {
                        $this->doExport = true;
                        $exportall = true;
 
@@ -100,13 +97,12 @@ class SpecialExport extends SpecialPage {
                        doExport(...) further down) */
                        $page = '';
                        $history = '';
-               }
-               elseif( $request->wasPosted() && $par == '' ) {
+               } elseif ( $request->wasPosted() && $par == '' ) {
                        $page = $request->getText( 'pages' );
                        $this->curonly = $request->getCheck( 'curonly' );
                        $rawOffset = $request->getVal( 'offset' );
 
-                       if( $rawOffset ) {
+                       if ( $rawOffset ) {
                                $offset = wfTimestamp( TS_MW, $rawOffset );
                        } else {
                                $offset = null;
@@ -127,15 +123,17 @@ class SpecialExport extends SpecialPage {
                                if ( $limit > 0 && ( $wgExportMaxHistory == 0 || $limit < $wgExportMaxHistory ) ) {
                                        $history['limit'] = $limit;
                                }
+
                                if ( !is_null( $offset ) ) {
                                        $history['offset'] = $offset;
                                }
+
                                if ( strtolower( $dir ) == 'desc' ) {
                                        $history['dir'] = 'desc';
                                }
                        }
 
-                       if( $page != '' ) {
+                       if ( $page != '' ) {
                                $this->doExport = true;
                        }
                } else {
@@ -143,18 +141,18 @@ class SpecialExport extends SpecialPage {
                        $page = $request->getText( 'pages', $par );
                        $historyCheck = $request->getCheck( 'history' );
 
-                       if( $historyCheck ) {
+                       if ( $historyCheck ) {
                                $history = WikiExporter::FULL;
                        } else {
                                $history = WikiExporter::CURRENT;
                        }
 
-                       if( $page != '' ) {
+                       if ( $page != '' ) {
                                $this->doExport = true;
                        }
                }
 
-               if( !$wgExportAllowHistory ) {
+               if ( !$wgExportAllowHistory ) {
                        // Override
                        $history = WikiExporter::CURRENT;
                }
@@ -172,7 +170,7 @@ class SpecialExport extends SpecialPage {
                        wfResetOutputBuffers();
                        $request->response()->header( "Content-type: application/xml; charset=utf-8" );
 
-                       if( $request->getCheck( 'wpDownload' ) ) {
+                       if ( $request->getCheck( 'wpDownload' ) ) {
                                // Provide a sane filename suggestion
                                $filename = urlencode( $wgSitename . '-' . wfTimestampNow() . '.xml' );
                                $request->response()->header( "Content-disposition: attachment;filename={$filename}" );
@@ -188,8 +186,16 @@ class SpecialExport extends SpecialPage {
 
                $form = Xml::openElement( 'form', array( 'method' => 'post',
                        'action' => $this->getTitle()->getLocalURL( 'action=submit' ) ) );
-               $form .= Xml::inputLabel( $this->msg( 'export-addcattext' )->text(), 'catname', 'catname', 40 ) . '&#160;';
-               $form .= Xml::submitButton( $this->msg( 'export-addcat' )->text(), array( 'name' => 'addcat' ) ) . '<br />';
+               $form .= Xml::inputLabel(
+                       $this->msg( 'export-addcattext' )->text(),
+                       'catname',
+                       'catname',
+                       40
+               ) . '&#160;';
+               $form .= Xml::submitButton(
+                       $this->msg( 'export-addcat' )->text(),
+                       array( 'name' => 'addcat' )
+               ) . '<br />';
 
                if ( $wgExportFromNamespaces ) {
                        $form .= Html::namespaceSelector(
@@ -197,12 +203,15 @@ class SpecialExport extends SpecialPage {
                                        'selected' => $nsindex,
                                        'label' => $this->msg( 'export-addnstext' )->text()
                                ), array(
-                                       'name'  => 'nsindex',
-                                       'id'    => 'namespace',
+                                       'name' => 'nsindex',
+                                       'id' => 'namespace',
                                        'class' => 'namespaceselector',
                                )
                        ) . '&#160;';
-                       $form .= Xml::submitButton( $this->msg( 'export-addns' )->text(), array( 'name' => 'addns' ) ) . '<br />';
+                       $form .= Xml::submitButton(
+                               $this->msg( 'export-addns' )->text(),
+                               array( 'name' => 'addns' )
+                       ) . '<br />';
                }
 
                if ( $wgExportAllowAll ) {
@@ -214,10 +223,15 @@ class SpecialExport extends SpecialPage {
                        ) . '<br />';
                }
 
-               $form .= Xml::element( 'textarea', array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ), $page, false );
+               $form .= Xml::element(
+                       'textarea',
+                       array( 'name' => 'pages', 'cols' => 40, 'rows' => 10 ),
+                       $page,
+                       false
+               );
                $form .= '<br />';
 
-               if( $wgExportAllowHistory ) {
+               if ( $wgExportAllowHistory ) {
                        $form .= Xml::checkLabel(
                                $this->msg( 'exportcuronly' )->text(),
                                'curonly',
@@ -235,9 +249,16 @@ class SpecialExport extends SpecialPage {
                        $request->wasPosted() ? $request->getCheck( 'templates' ) : false
                ) . '<br />';
 
-               if( $wgExportMaxLinkDepth || $this->userCanOverrideExportDepth() ) {
-                       $form .= Xml::inputLabel( $this->msg( 'export-pagelinks' )->text(), 'pagelink-depth', 'pagelink-depth', 20, 0 ) . '<br />';
+               if ( $wgExportMaxLinkDepth || $this->userCanOverrideExportDepth() ) {
+                       $form .= Xml::inputLabel(
+                               $this->msg( 'export-pagelinks' )->text(),
+                               'pagelink-depth',
+                               'pagelink-depth',
+                               20,
+                               0
+                       ) . '<br />';
                }
+
                // Enable this when we can do something useful exporting/importing image information. :)
                //$form .= Xml::checkLabel( $this->msg( 'export-images' )->text(), 'images', 'wpExportImages', false ) . '<br />';
                $form .= Xml::checkLabel(
@@ -256,7 +277,10 @@ class SpecialExport extends SpecialPage {
                        ) . '<br />';
                }
 
-               $form .= Xml::submitButton( $this->msg( 'export-submit' )->text(), Linker::tooltipAndAccesskeyAttribs( 'export' ) );
+               $form .= Xml::submitButton(
+                       $this->msg( 'export-submit' )->text(),
+                       Linker::tooltipAndAccesskeyAttribs( 'export' )
+               );
                $form .= Xml::closeElement( 'form' );
 
                $out->addHTML( $form );
@@ -288,10 +312,10 @@ class SpecialExport extends SpecialPage {
                        $pageSet = array(); // Inverted index of all pages to look up
 
                        // Split up and normalize input
-                       foreach( explode( "\n", $page ) as $pageName ) {
+                       foreach ( explode( "\n", $page ) as $pageName ) {
                                $pageName = trim( $pageName );
                                $title = Title::newFromText( $pageName );
-                               if( $title && $title->getInterwiki() == '' && $title->getText() !== '' ) {
+                               if ( $title && $title->getInterwiki() == '' && $title->getText() !== '' ) {
                                        // Only record each page once!
                                        $pageSet[$title->getPrefixedText()] = true;
                                }
@@ -301,25 +325,23 @@ class SpecialExport extends SpecialPage {
                        $inputPages = array_keys( $pageSet );
 
                        // Look up any linked pages if asked...
-                       if( $this->templates ) {
+                       if ( $this->templates ) {
                                $pageSet = $this->getTemplates( $inputPages, $pageSet );
                        }
                        $linkDepth = $this->pageLinkDepth;
-                       if( $linkDepth ) {
+                       if ( $linkDepth ) {
                                $pageSet = $this->getPageLinks( $inputPages, $pageSet, $linkDepth );
                        }
 
-                       /*
-                        // Enable this when we can do something useful exporting/importing image information. :)
-                        if( $this->images ) ) {
-                        $pageSet = $this->getImages( $inputPages, $pageSet );
-                        }
-                       */
+                       // Enable this when we can do something useful exporting/importing image information.
+                       // if( $this->images ) ) {
+                       // $pageSet = $this->getImages( $inputPages, $pageSet );
+                       // }
 
                        $pages = array_keys( $pageSet );
 
                        // Normalize titles to the same format and remove dupes, see bug 17374
-                       foreach( $pages as $k => $v ) {
+                       foreach ( $pages as $k => $v ) {
                                $pages[$k] = str_replace( " ", "_", $v );
                        }
 
@@ -327,7 +349,7 @@ class SpecialExport extends SpecialPage {
                }
 
                /* Ok, let's get to it... */
-               if( $history == WikiExporter::CURRENT ) {
+               if ( $history == WikiExporter::CURRENT ) {
                        $lb = false;
                        $db = wfGetDB( DB_SLAVE );
                        $buffer = WikiExporter::BUFFER;
@@ -350,26 +372,17 @@ class SpecialExport extends SpecialPage {
                if ( $exportall ) {
                        $exporter->allPages();
                } else {
-                       foreach( $pages as $page ) {
-                       /*
-                        if( $wgExportMaxHistory && !$this->curonly ) {
-                        $title = Title::newFromText( $page );
-                        if( $title ) {
-                        $count = Revision::countByTitle( $db, $title );
-                        if( $count > $wgExportMaxHistory ) {
-                        wfDebug( __FUNCTION__ .
-                        ": Skipped $page, $count revisions too big\n" );
-                        continue;
-                        }
-                        }
-                        }*/
-                       #Bug 8824: Only export pages the user can read
+                       foreach ( $pages as $page ) {
+                               #Bug 8824: Only export pages the user can read
                                $title = Title::newFromText( $page );
-                               if( is_null( $title ) ) {
-                                       continue; #TODO: perhaps output an <error> tag or something.
+                               if ( is_null( $title ) ) {
+                                       // @todo Perhaps output an <error> tag or something.
+                                       continue;
                                }
-                               if( !$title->userCan( 'read', $this->getUser() ) ) {
-                                       continue; #TODO: perhaps output an <error> tag or something.
+
+                               if ( !$title->userCan( 'read', $this->getUser() ) ) {
+                                       // @todo Perhaps output an <error> tag or something.
+                                       continue;
                                }
 
                                $exporter->pageByTitle( $title );
@@ -378,7 +391,7 @@ class SpecialExport extends SpecialPage {
 
                $exporter->closeStream();
 
-               if( $lb ) {
+               if ( $lb ) {
                        $lb->closeAll();
                }
        }
@@ -412,6 +425,7 @@ class SpecialExport extends SpecialPage {
 
                        $pages[] = $n;
                }
+
                return $pages;
        }
 
@@ -443,6 +457,7 @@ class SpecialExport extends SpecialPage {
 
                        $pages[] = $n;
                }
+
                return $pages;
        }
 
@@ -468,12 +483,12 @@ class SpecialExport extends SpecialPage {
        private function validateLinkDepth( $depth ) {
                global $wgExportMaxLinkDepth;
 
-               if( $depth < 0 ) {
+               if ( $depth < 0 ) {
                        return 0;
                }
 
                if ( !$this->userCanOverrideExportDepth() ) {
-                       if( $depth > $wgExportMaxLinkDepth ) {
+                       if ( $depth > $wgExportMaxLinkDepth ) {
                                return $wgExportMaxLinkDepth;
                        }
                }
@@ -483,6 +498,7 @@ class SpecialExport extends SpecialPage {
                 * crazy-big export from being done by someone setting the depth
                 * number too high. In other words, last resort safety net.
                 */
+
                return intval( min( $depth, 5 ) );
        }
 
@@ -494,7 +510,7 @@ class SpecialExport extends SpecialPage {
         * @return array
         */
        private function getPageLinks( $inputPages, $pageSet, $depth ) {
-               for( ; $depth > 0; --$depth ) {
+               for ( ; $depth > 0; --$depth ) {
                        $pageSet = $this->getLinks(
                                $inputPages, $pageSet, 'pagelinks',
                                array( 'namespace' => 'pl_namespace', 'title' => 'pl_title' ),
@@ -536,10 +552,10 @@ class SpecialExport extends SpecialPage {
        private function getLinks( $inputPages, $pageSet, $table, $fields, $join ) {
                $dbr = wfGetDB( DB_SLAVE );
 
-               foreach( $inputPages as $page ) {
+               foreach ( $inputPages as $page ) {
                        $title = Title::newFromText( $page );
 
-                       if( $title ) {
+                       if ( $title ) {
                                $pageSet[$title->getPrefixedText()] = true;
                                /// @todo FIXME: May or may not be more efficient to batch these
                                ///        by namespace when given multiple input pages.
@@ -556,7 +572,7 @@ class SpecialExport extends SpecialPage {
                                        __METHOD__
                                );
 
-                               foreach( $result as $row ) {
+                               foreach ( $result as $row ) {
                                        $template = Title::makeTitle( $row->namespace, $row->title );
                                        $pageSet[$template->getPrefixedText()] = true;
                                }
index 41b1d4b..47a4d75 100644 (file)
@@ -28,7 +28,6 @@
  * @author Martin Drashkov
  */
 class FewestrevisionsPage extends QueryPage {
-
        function __construct( $name = 'Fewestrevisions' ) {
                parent::__construct( $name );
        }
@@ -44,19 +43,24 @@ class FewestrevisionsPage extends QueryPage {
        function getQueryInfo() {
                return array(
                        'tables' => array( 'revision', 'page' ),
-                       'fields' => array( 'namespace' => 'page_namespace',
-                                       'title' => 'page_title',
-                                       'value' => 'COUNT(*)',
-                                       'redirect' => 'page_is_redirect' ),
-                       'conds' => array( 'page_namespace' => MWNamespace::getContentNamespaces(),
-                                       'page_id = rev_page' ),
-                       'options' => array( 'HAVING' => 'COUNT(*) > 1',
-                       // ^^^ This was probably here to weed out redirects.
-                       // Since we mark them as such now, it might be
-                       // useful to remove this. People _do_ create pages
-                       // and never revise them, they aren't necessarily
-                       // redirects.
-                       'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' ) )
+                       'fields' => array(
+                               'namespace' => 'page_namespace',
+                               'title' => 'page_title',
+                               'value' => 'COUNT(*)',
+                               'redirect' => 'page_is_redirect'
+                       ),
+                       'conds' => array(
+                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_id = rev_page' ),
+                       'options' => array(
+                               'HAVING' => 'COUNT(*) > 1',
+                               // ^^^ This was probably here to weed out redirects.
+                               // Since we mark them as such now, it might be
+                               // useful to remove this. People _do_ create pages
+                               // and never revise them, they aren't necessarily
+                               // redirects.
+                               'GROUP BY' => array( 'page_namespace', 'page_title', 'page_is_redirect' )
+                       )
                );
        }
 
@@ -73,9 +77,16 @@ class FewestrevisionsPage extends QueryPage {
                global $wgContLang;
 
                $nt = Title::makeTitleSafe( $result->namespace, $result->title );
-               if( !$nt ) {
-                       return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
-                               Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
+               if ( !$nt ) {
+                       return Html::element(
+                               'span',
+                               array( 'class' => 'mw-invalidtitle' ),
+                               Linker::getInvalidTitleDescription(
+                                       $this->getContext(),
+                                       $result->namespace,
+                                       $result->title
+                               )
+                       );
                }
 
                $text = htmlspecialchars( $wgContLang->convert( $nt->getPrefixedText() ) );
index 71f19fa..4c6593b 100644 (file)
@@ -101,11 +101,11 @@ class FileDuplicateSearchPage extends QueryPage {
                $this->setHeaders();
                $this->outputHeader();
 
-               $this->filename = isset( $par ) ?  $par : $this->getRequest()->getText( 'filename' );
+               $this->filename = isset( $par ) ? $par : $this->getRequest()->getText( 'filename' );
                $this->file = null;
                $this->hash = '';
                $title = Title::newFromText( $this->filename, NS_FILE );
-               if( $title && $title->getText() != '' ) {
+               if ( $title && $title->getText() != '' ) {
                        $this->file = wfFindFile( $title );
                }
 
@@ -113,37 +113,46 @@ class FileDuplicateSearchPage extends QueryPage {
 
                # Create the input form
                $out->addHTML(
-                       Html::openElement( 'form', array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript ) ) . "\n" .
-                       Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n" .
-                       Html::openElement( 'fieldset' ) . "\n" .
-                       Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" .
-                       Xml::inputLabel( $this->msg( 'fileduplicatesearch-filename' )->text(), 'filename', 'filename', 50, $this->filename ) . "\n" .
-                       Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" .
-                       Html::closeElement( 'fieldset' ) . "\n" .
-                       Html::closeElement( 'form' )
+                       Html::openElement(
+                               'form',
+                               array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript )
+                       ) . "\n" .
+                               Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n" .
+                               Html::openElement( 'fieldset' ) . "\n" .
+                               Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" .
+                               Xml::inputLabel(
+                                       $this->msg( 'fileduplicatesearch-filename' )->text(),
+                                       'filename',
+                                       'filename',
+                                       50,
+                                       $this->filename
+                               ) . "\n" .
+                               Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" .
+                               Html::closeElement( 'fieldset' ) . "\n" .
+                               Html::closeElement( 'form' )
                );
 
-               if( $this->file ) {
+               if ( $this->file ) {
                        $this->hash = $this->file->getSha1();
-               } elseif( $this->filename !== '' ) {
+               } elseif ( $this->filename !== '' ) {
                        $out->wrapWikiMsg(
                                "<p class='mw-fileduplicatesearch-noresults'>\n$1\n</p>",
                                array( 'fileduplicatesearch-noresults', wfEscapeWikiText( $this->filename ) )
                        );
                }
 
-               if( $this->hash != '' ) {
+               if ( $this->hash != '' ) {
                        # Show a thumbnail of the file
                        $img = $this->file;
                        if ( $img ) {
                                $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
-                               if( $thumb ) {
+                               if ( $thumb ) {
                                        $out->addHTML( '<div id="mw-fileduplicatesearch-icon">' .
                                                $thumb->toHtml( array( 'desc-link' => false ) ) . '<br />' .
                                                $this->msg( 'fileduplicatesearch-info' )->numParams(
                                                        $img->getWidth(), $img->getHeight() )->params(
-                                                       $this->getLanguage()->formatSize( $img->getSize() ),
-                                                       $img->getMimeType() )->parseAsBlock() .
+                                                               $this->getLanguage()->formatSize( $img->getSize() ),
+                                                               $img->getMimeType() )->parseAsBlock() .
                                                '</div>' );
                                }
                        }
@@ -152,7 +161,7 @@ class FileDuplicateSearchPage extends QueryPage {
                        $numRows = count( $dupes );
 
                        # Show a short summary
-                       if( $numRows == 1 ) {
+                       if ( $numRows == 1 ) {
                                $out->wrapWikiMsg(
                                        "<p class='mw-fileduplicatesearch-result-1'>\n$1\n</p>",
                                        array( 'fileduplicatesearch-result-1', wfEscapeWikiText( $this->filename ) )
@@ -172,14 +181,16 @@ class FileDuplicateSearchPage extends QueryPage {
 
        function doBatchLookups( $list ) {
                $batch = new LinkBatch();
-               foreach( $list as $file ) {
+               /** @var File $file */
+               foreach ( $list as $file ) {
                        $batch->addObj( $file->getTitle() );
-                       if( $file->isLocal() ) {
+                       if ( $file->isLocal() ) {
                                $userName = $file->getUser( 'text' );
                                $batch->add( NS_USER, $userName );
                                $batch->add( NS_USER_TALK, $userName );
                        }
                }
+
                $batch->execute();
        }
 
index dc56b5a..d4b0285 100644 (file)
@@ -27,7 +27,6 @@
  * @ingroup SpecialPage
  */
 class SpecialFilepath extends SpecialPage {
-
        function __construct() {
                parent::__construct( 'Filepath' );
        }
@@ -55,6 +54,7 @@ class SpecialFilepath extends SpecialPage {
                                // If a width is requested...
                                if ( $width != -1 ) {
                                        $mto = $file->transform( array( 'width' => $width, 'height' => $height ) );
+
                                        // ... and we can
                                        if ( $mto && !$mto->isError() ) {
                                                // ... change the URL to point to a thumbnail.
@@ -76,14 +76,23 @@ class SpecialFilepath extends SpecialPage {
                global $wgScript;
 
                $this->getOutput()->addHTML(
-                       Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) .
-                       Html::openElement( 'fieldset' ) .
-                       Html::element( 'legend', null, $this->msg( 'filepath' )->text() ) .
-                       Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
-                       Xml::inputLabel( $this->msg( 'filepath-page' )->text(), 'file', 'file', 25, is_object( $title ) ? $title->getText() : '' ) . ' ' .
-                       Xml::submitButton( $this->msg( 'filepath-submit' )->text() ) . "\n" .
-                       Html::closeElement( 'fieldset' ) .
-                       Html::closeElement( 'form' )
+                       Html::openElement(
+                               'form',
+                               array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' )
+                       ) .
+                               Html::openElement( 'fieldset' ) .
+                               Html::element( 'legend', null, $this->msg( 'filepath' )->text() ) .
+                               Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
+                               Xml::inputLabel(
+                                       $this->msg( 'filepath-page' )->text(),
+                                       'file',
+                                       'file',
+                                       25,
+                                       is_object( $title ) ? $title->getText() : ''
+                               ) . ' ' .
+                               Xml::submitButton( $this->msg( 'filepath-submit' )->text() ) . "\n" .
+                               Html::closeElement( 'fieldset' ) .
+                               Html::closeElement( 'form' )
                );
        }
 
index 68b0024..0d54bb3 100644 (file)
@@ -30,7 +30,6 @@
  * @ingroup SpecialPage
  */
 class SpecialImport extends SpecialPage {
-
        private $interwiki = false;
        private $namespace;
        private $rootpage = '';
@@ -108,13 +107,13 @@ class SpecialImport extends SpecialPage {
                        $source = Status::newFatal( 'import-token-mismatch' );
                } elseif ( $sourceName == 'upload' ) {
                        $isUpload = true;
-                       if( $user->isAllowed( 'importupload' ) ) {
+                       if ( $user->isAllowed( 'importupload' ) ) {
                                $source = ImportStreamSource::newFromUpload( "xmlimport" );
                        } else {
                                throw new PermissionsError( 'importupload' );
                        }
                } elseif ( $sourceName == "interwiki" ) {
-                       if( !$user->isAllowed( 'import' ) ) {
+                       if ( !$user->isAllowed( 'import' ) ) {
                                throw new PermissionsError( 'import' );
                        }
                        $this->interwiki = $request->getVal( 'interwiki' );
@@ -136,24 +135,40 @@ class SpecialImport extends SpecialPage {
                }
 
                $out = $this->getOutput();
-               if( !$source->isGood() ) {
-                       $out->wrapWikiMsg( "<p class=\"error\">\n$1\n</p>", array( 'importfailed', $source->getWikiText() ) );
+               if ( !$source->isGood() ) {
+                       $out->wrapWikiMsg(
+                               "<p class=\"error\">\n$1\n</p>",
+                               array( 'importfailed', $source->getWikiText() )
+                       );
                } else {
                        $importer = new WikiImporter( $source->value );
-                       if( !is_null( $this->namespace ) ) {
+                       if ( !is_null( $this->namespace ) ) {
                                $importer->setTargetNamespace( $this->namespace );
                        }
-                       if( !is_null( $this->rootpage ) ) {
+                       if ( !is_null( $this->rootpage ) ) {
                                $statusRootPage = $importer->setTargetRootPage( $this->rootpage );
-                               if( !$statusRootPage->isGood() ) {
-                                       $out->wrapWikiMsg( "<p class=\"error\">\n$1\n</p>", array( 'import-options-wrong', $statusRootPage->getWikiText(), count( $statusRootPage->getErrorsArray() ) ) );
+                               if ( !$statusRootPage->isGood() ) {
+                                       $out->wrapWikiMsg(
+                                               "<p class=\"error\">\n$1\n</p>",
+                                               array(
+                                                       'import-options-wrong',
+                                                       $statusRootPage->getWikiText(),
+                                                       count( $statusRootPage->getErrorsArray() )
+                                               )
+                                       );
+
                                        return;
                                }
                        }
 
                        $out->addWikiMsg( "importstart" );
 
-                       $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki, $this->logcomment );
+                       $reporter = new ImportReporter(
+                               $importer,
+                               $isUpload,
+                               $this->interwiki,
+                               $this->logcomment
+                       );
                        $reporter->setContext( $this->getContext() );
                        $exception = false;
 
@@ -167,10 +182,16 @@ class SpecialImport extends SpecialPage {
 
                        if ( $exception ) {
                                # No source or XML parse error
-                               $out->wrapWikiMsg( "<p class=\"error\">\n$1\n</p>", array( 'importfailed', $exception->getMessage() ) );
-                       } elseif( !$result->isGood() ) {
+                               $out->wrapWikiMsg(
+                                       "<p class=\"error\">\n$1\n</p>",
+                                       array( 'importfailed', $exception->getMessage() )
+                               );
+                       } elseif ( !$result->isGood() ) {
                                # Zero revisions
-                               $out->wrapWikiMsg( "<p class=\"error\">\n$1\n</p>", array( 'importfailed', $result->getWikiText() ) );
+                               $out->wrapWikiMsg(
+                                       "<p class=\"error\">\n$1\n</p>",
+                                       array( 'importfailed', $result->getWikiText() )
+                               );
                        } else {
                                # Success!
                                $out->addWikiMsg( 'importsuccess' );
@@ -186,158 +207,191 @@ class SpecialImport extends SpecialPage {
                $user = $this->getUser();
                $out = $this->getOutput();
 
-               if( $user->isAllowed( 'importupload' ) ) {
+               if ( $user->isAllowed( 'importupload' ) ) {
                        $out->addHTML(
                                Xml::fieldset( $this->msg( 'import-upload' )->text() ) .
-                               Xml::openElement( 'form', array( 'enctype' => 'multipart/form-data', 'method' => 'post',
-                                       'action' => $action, 'id' => 'mw-import-upload-form' ) ) .
-                               $this->msg( 'importtext' )->parseAsBlock() .
-                               Html::hidden( 'action', 'submit' ) .
-                               Html::hidden( 'source', 'upload' ) .
-                               Xml::openElement( 'table', array( 'id' => 'mw-import-table-upload' ) ) .
-
-                               "<tr>
+                                       Xml::openElement(
+                                               'form',
+                                               array(
+                                                       'enctype' => 'multipart/form-data',
+                                                       'method' => 'post',
+                                                       'action' => $action,
+                                                       'id' => 'mw-import-upload-form'
+                                               )
+                                       ) .
+                                       $this->msg( 'importtext' )->parseAsBlock() .
+                                       Html::hidden( 'action', 'submit' ) .
+                                       Html::hidden( 'source', 'upload' ) .
+                                       Xml::openElement( 'table', array( 'id' => 'mw-import-table-upload' ) ) .
+                                       "<tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-upload-filename' )->text(), 'xmlimport' ) .
+                                       Xml::label( $this->msg( 'import-upload-filename' )->text(), 'xmlimport' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Html::input( 'xmlimport', '', 'file', array( 'id' => 'xmlimport' ) ) . ' ' .
+                                       Html::input( 'xmlimport', '', 'file', array( 'id' => 'xmlimport' ) ) . ' ' .
                                        "</td>
                                </tr>
                                <tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) .
+                                       Xml::label( $this->msg( 'import-comment' )->text(), 'mw-import-comment' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Xml::input( 'log-comment', 50, '',
-                                                       array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' .
+                                       Xml::input( 'log-comment', 50, '',
+                                               array( 'id' => 'mw-import-comment', 'type' => 'text' ) ) . ' ' .
                                        "</td>
                                </tr>
                                <tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-interwiki-rootpage' )->text(), 'mw-interwiki-rootpage-upload' ) .
+                                       Xml::label( $this->msg( 'import-interwiki-rootpage' )->text(), 'mw-interwiki-rootpage-upload' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Xml::input( 'rootpage', 50, $this->rootpage,
-                                                       array( 'id' => 'mw-interwiki-rootpage-upload', 'type' => 'text' ) ) . ' ' .
+                                       Xml::input( 'rootpage', 50, $this->rootpage,
+                                               array( 'id' => 'mw-interwiki-rootpage-upload', 'type' => 'text' ) ) . ' ' .
                                        "</td>
                                </tr>
                                <tr>
                                        <td></td>
                                        <td class='mw-submit'>" .
-                                               Xml::submitButton( $this->msg( 'uploadbtn' )->text() ) .
+                                       Xml::submitButton( $this->msg( 'uploadbtn' )->text() ) .
                                        "</td>
                                </tr>" .
-                               Xml::closeElement( 'table' ) .
-                               Html::hidden( 'editToken', $user->getEditToken() ) .
-                               Xml::closeElement( 'form' ) .
-                               Xml::closeElement( 'fieldset' )
+                                       Xml::closeElement( 'table' ) .
+                                       Html::hidden( 'editToken', $user->getEditToken() ) .
+                                       Xml::closeElement( 'form' ) .
+                                       Xml::closeElement( 'fieldset' )
                        );
                } else {
-                       if( empty( $wgImportSources ) ) {
+                       if ( empty( $wgImportSources ) ) {
                                $out->addWikiMsg( 'importnosources' );
                        }
                }
 
-               if( $user->isAllowed( 'import' ) && !empty( $wgImportSources ) ) {
+               if ( $user->isAllowed( 'import' ) && !empty( $wgImportSources ) ) {
                        # Show input field for import depth only if $wgExportMaxLinkDepth > 0
                        $importDepth = '';
-                       if( $wgExportMaxLinkDepth > 0 ) {
+                       if ( $wgExportMaxLinkDepth > 0 ) {
                                $importDepth = "<tr>
                                                        <td class='mw-label'>" .
-                                                               $this->msg( 'export-pagelinks' )->parse() .
-                                                       "</td>
+                                       $this->msg( 'export-pagelinks' )->parse() .
+                                       "</td>
                                                        <td class='mw-input'>" .
-                                                               Xml::input( 'pagelink-depth', 3, 0 ) .
-                                                       "</td>
-                                               </tr>";
+                                       Xml::input( 'pagelink-depth', 3, 0 ) .
+                                       "</td>
+                               </tr>";
                        }
 
                        $out->addHTML(
                                Xml::fieldset( $this->msg( 'importinterwiki' )->text() ) .
-                               Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'mw-import-interwiki-form' ) ) .
-                               $this->msg( 'import-interwiki-text' )->parseAsBlock() .
-                               Html::hidden( 'action', 'submit' ) .
-                               Html::hidden( 'source', 'interwiki' ) .
-                               Html::hidden( 'editToken', $user->getEditToken() ) .
-                               Xml::openElement( 'table', array( 'id' => 'mw-import-table-interwiki' ) ) .
-                               "<tr>
+                                       Xml::openElement(
+                                               'form',
+                                               array(
+                                                       'method' => 'post',
+                                                       'action' => $action,
+                                                       'id' => 'mw-import-interwiki-form'
+                                               )
+                                       ) .
+                                       $this->msg( 'import-interwiki-text' )->parseAsBlock() .
+                                       Html::hidden( 'action', 'submit' ) .
+                                       Html::hidden( 'source', 'interwiki' ) .
+                                       Html::hidden( 'editToken', $user->getEditToken() ) .
+                                       Xml::openElement( 'table', array( 'id' => 'mw-import-table-interwiki' ) ) .
+                                       "<tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-interwiki-source' )->text(), 'interwiki' ) .
+                                       Xml::label( $this->msg( 'import-interwiki-source' )->text(), 'interwiki' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Xml::openElement( 'select', array( 'name' => 'interwiki', 'id' => 'interwiki' ) )
+                                       Xml::openElement(
+                                               'select',
+                                               array( 'name' => 'interwiki', 'id' => 'interwiki' )
+                                       )
                        );
-                       foreach( $wgImportSources as $prefix ) {
+
+                       foreach ( $wgImportSources as $prefix ) {
                                $selected = ( $this->interwiki === $prefix ) ? ' selected="selected"' : '';
                                $out->addHTML( Xml::option( $prefix, $prefix, $selected ) );
                        }
 
                        $out->addHTML(
-                                               Xml::closeElement( 'select' ) .
-                                               Xml::input( 'frompage', 50, $this->frompage, array( 'id' => 'frompage' ) ) .
+                               Xml::closeElement( 'select' ) .
+                                       Xml::input( 'frompage', 50, $this->frompage, array( 'id' => 'frompage' ) ) .
                                        "</td>
                                </tr>
                                <tr>
                                        <td>
                                        </td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( $this->msg( 'import-interwiki-history' )->text(), 'interwikiHistory', 'interwikiHistory', $this->history ) .
+                                       Xml::checkLabel(
+                                               $this->msg( 'import-interwiki-history' )->text(),
+                                               'interwikiHistory',
+                                               'interwikiHistory',
+                                               $this->history
+                                       ) .
                                        "</td>
                                </tr>
                                <tr>
                                        <td>
                                        </td>
                                        <td class='mw-input'>" .
-                                               Xml::checkLabel( $this->msg( 'import-interwiki-templates' )->text(), 'interwikiTemplates', 'interwikiTemplates', $this->includeTemplates ) .
+                                       Xml::checkLabel(
+                                               $this->msg( 'import-interwiki-templates' )->text(),
+                                               'interwikiTemplates',
+                                               'interwikiTemplates',
+                                               $this->includeTemplates
+                                       ) .
                                        "</td>
                                </tr>
                                $importDepth
                                <tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-interwiki-namespace' )->text(), 'namespace' ) .
+                                       Xml::label( $this->msg( 'import-interwiki-namespace' )->text(), 'namespace' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Html::namespaceSelector(
-                                                       array(
-                                                               'selected' => $this->namespace,
-                                                               'all' => '',
-                                                       ), array(
-                                                               'name'  => 'namespace',
-                                                               'id'    => 'namespace',
-                                                               'class' => 'namespaceselector',
-                                                       )
-                                               ) .
+                                       Html::namespaceSelector(
+                                               array(
+                                                       'selected' => $this->namespace,
+                                                       'all' => '',
+                                               ), array(
+                                                       'name' => 'namespace',
+                                                       'id' => 'namespace',
+                                                       'class' => 'namespaceselector',
+                                               )
+                                       ) .
                                        "</td>
                                </tr>
                                <tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-comment' )->text(), 'mw-interwiki-comment' ) .
+                                       Xml::label( $this->msg( 'import-comment' )->text(), 'mw-interwiki-comment' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Xml::input( 'log-comment', 50, '',
-                                                       array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' .
+                                       Xml::input( 'log-comment', 50, '',
+                                               array( 'id' => 'mw-interwiki-comment', 'type' => 'text' ) ) . ' ' .
                                        "</td>
                                </tr>
                                <tr>
                                        <td class='mw-label'>" .
-                                               Xml::label( $this->msg( 'import-interwiki-rootpage' )->text(), 'mw-interwiki-rootpage-interwiki' ) .
+                                       Xml::label(
+                                               $this->msg( 'import-interwiki-rootpage' )->text(),
+                                               'mw-interwiki-rootpage-interwiki'
+                                       ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                               Xml::input( 'rootpage', 50, $this->rootpage,
-                                                       array( 'id' => 'mw-interwiki-rootpage-interwiki', 'type' => 'text' ) ) . ' ' .
+                                       Xml::input( 'rootpage', 50, $this->rootpage,
+                                               array( 'id' => 'mw-interwiki-rootpage-interwiki', 'type' => 'text' ) ) . ' ' .
                                        "</td>
                                </tr>
                                <tr>
                                        <td>
                                        </td>
                                        <td class='mw-submit'>" .
-                                               Xml::submitButton( $this->msg( 'import-interwiki-submit' )->text(), Linker::tooltipAndAccesskeyAttribs( 'import' ) ) .
+                                       Xml::submitButton(
+                                               $this->msg( 'import-interwiki-submit' )->text(),
+                                               Linker::tooltipAndAccesskeyAttribs( 'import' )
+                                       ) .
                                        "</td>
                                </tr>" .
-                               Xml::closeElement( 'table' ) .
-                               Xml::closeElement( 'form' ) .
-                               Xml::closeElement( 'fieldset' )
+                                       Xml::closeElement( 'table' ) .
+                                       Xml::closeElement( 'form' ) .
+                                       Xml::closeElement( 'fieldset' )
                        );
                }
        }
@@ -357,9 +411,16 @@ class ImportReporter extends ContextSource {
        private $mOriginalPageOutCallback = null;
        private $mLogItemCount = 0;
 
+
+       /**
+        * @param WikiImporter $importer
+        * @param $upload
+        * @param $interwiki
+        * @param string|bool $reason
+        */
        function __construct( $importer, $upload, $interwiki, $reason = false ) {
                $this->mOriginalPageOutCallback =
-                               $importer->setPageOutCallback( array( $this, 'reportPage' ) );
+                       $importer->setPageOutCallback( array( $this, 'reportPage' ) );
                $this->mOriginalLogCallback =
                        $importer->setLogItemCallback( array( $this, 'reportLogItem' ) );
                $importer->setNoticeCallback( array( $this, 'reportNotice' ) );
@@ -403,14 +464,15 @@ class ImportReporter extends ContextSource {
 
                $this->mPageCount++;
 
-               if( $successCount > 0 ) {
-                       $this->getOutput()->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .
-                               $this->msg( 'import-revision-count' )->numParams( $successCount )->escaped() .
-                               "</li>\n"
+               if ( $successCount > 0 ) {
+                       $this->getOutput()->addHTML(
+                               "<li>" . Linker::linkKnown( $title ) . " " .
+                                       $this->msg( 'import-revision-count' )->numParams( $successCount )->escaped() .
+                                       "</li>\n"
                        );
 
                        $log = new LogPage( 'import' );
-                       if( $this->mIsUpload ) {
+                       if ( $this->mIsUpload ) {
                                $detail = $this->msg( 'import-logentry-upload-detail' )->numParams(
                                        $successCount )->inContentLanguage()->text();
                                if ( $this->reason ) {
@@ -450,8 +512,9 @@ class ImportReporter extends ContextSource {
                if ( $this->mLogItemCount > 0 ) {
                        $msg = $this->msg( 'imported-log-entries' )->numParams( $this->mLogItemCount )->parse();
                        $out->addHTML( Xml::tags( 'li', null, $msg ) );
-               } elseif( $this->mPageCount == 0 && $this->mLogItemCount == 0 ) {
+               } elseif ( $this->mPageCount == 0 && $this->mLogItemCount == 0 ) {
                        $out->addHTML( "</ul>\n" );
+
                        return Status::newFatal( 'importnopages' );
                }
                $out->addHTML( "</ul>\n" );
index ab42549..63881a7 100644 (file)
@@ -85,7 +85,7 @@ class SpecialJavaScriptTest extends SpecialPage {
         */
        private function getFrameworkListHtml() {
                $list = '<ul>';
-               foreach( self::$frameworks as $framework => $initFn ) {
+               foreach ( self::$frameworks as $framework => $initFn ) {
                        $list .= Html::rawElement(
                                'li',
                                array(),
@@ -109,7 +109,7 @@ class SpecialJavaScriptTest extends SpecialPage {
         */
        private function wrapSummaryHtml( $html, $state ) {
                $validStates = array( 'noframework', 'unknownframework', 'frameworkfound' );
-               if( !in_array( $state, $validStates ) ) {
+               if ( !in_array( $state, $validStates ) ) {
                        throw new MWException( __METHOD__
                                . ' given an invalid state. Must be one of "'
                                . join( '", "', $validStates ) . '".'
index ded881c..3abfd5f 100644 (file)
@@ -55,7 +55,7 @@ class LinkSearchPage extends QueryPage {
                $namespace = $request->getIntorNull( 'namespace', null );
 
                $protocols_list = array();
-               foreach( $wgUrlProtocols as $prot ) {
+               foreach ( $wgUrlProtocols as $prot ) {
                        if ( $prot !== '//' ) {
                                $protocols_list[] = $prot;
                        }
@@ -111,14 +111,15 @@ class LinkSearchPage extends QueryPage {
                        Html::closeElement( 'form' ) . "\n";
                $out->addHTML( $s );
 
-               if( $target != '' ) {
+               if ( $target != '' ) {
                        $this->setParams( array(
                                'query' => $target2,
                                'namespace' => $namespace,
                                'protocol' => $protocol ) );
                        parent::execute( $par );
-                       if( $this->mMungedQuery === false )
+                       if ( $this->mMungedQuery === false ) {
                                $out->addWikiMsg( 'linksearch-error' );
+                       }
                }
        }
 
@@ -155,7 +156,7 @@ class LinkSearchPage extends QueryPage {
                global $wgMiserMode;
                $params = array();
                $params['target'] = $this->mProt . $this->mQuery;
-               if( isset( $this->mNs ) && !$wgMiserMode ) {
+               if ( isset( $this->mNs ) && !$wgMiserMode ) {
                        $params['namespace'] = $this->mNs;
                }
                return $params;
@@ -168,9 +169,10 @@ class LinkSearchPage extends QueryPage {
                // index-based-only lookup would be done
                list( $this->mMungedQuery, $clause ) = self::mungeQuery(
                                $this->mQuery, $this->mProt );
-               if( $this->mMungedQuery === false )
+               if ( $this->mMungedQuery === false ) {
                        // Invalid query; return no results
                        return array( 'tables' => 'page', 'fields' => 'page_id', 'conds' => '0=1' );
+               }
 
                $stripped = LinkFilter::keepOneWildcard( $this->mMungedQuery );
                $like = $dbr->buildLike( $stripped );
@@ -208,7 +210,7 @@ class LinkSearchPage extends QueryPage {
         */
        function doQuery( $offset = false, $limit = false ) {
                list( $this->mMungedQuery, ) = LinkSearchPage::mungeQuery( $this->mQuery, $this->mProt );
-               if( $this->mMungedQuery === false ) {
+               if ( $this->mMungedQuery === false ) {
                        $this->getOutput()->addWikiMsg( 'linksearch-error' );
                } else {
                        // For debugging
index c864ae2..9c2d039 100644 (file)
@@ -118,7 +118,7 @@ class ImageListPager extends TablePager {
                                'img_user_text' => $this->msg( 'listfiles_user' )->text(),
                                'img_description' => $this->msg( 'listfiles_description' )->text(),
                        );
-                       if( !$wgMiserMode ) {
+                       if ( !$wgMiserMode ) {
                                $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
                        }
                }
@@ -145,7 +145,7 @@ class ImageListPager extends TablePager {
                $options = $join_conds = array();
 
                # Depends on $wgMiserMode
-               if( isset( $this->mFieldNames['count'] ) ) {
+               if ( isset( $this->mFieldNames['count'] ) ) {
                        $tables[] = 'oldimage';
 
                        # Need to rewrite this one
@@ -157,7 +157,7 @@ class ImageListPager extends TablePager {
                        unset( $field );
 
                        $dbr = wfGetDB( DB_SLAVE );
-                       if( $dbr->implicitGroupby() ) {
+                       if ( $dbr->implicitGroupby() ) {
                                $options = array( 'GROUP BY' => 'img_name' );
                        } else {
                                $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
@@ -166,10 +166,10 @@ class ImageListPager extends TablePager {
                        $join_conds = array( 'oldimage' => array( 'LEFT JOIN', 'oi_name = img_name' ) );
                }
                return array(
-                       'tables'     => $tables,
-                       'fields'     => $fields,
-                       'conds'      => $this->mQueryConds,
-                       'options'    => $options,
+                       'tables' => $tables,
+                       'fields' => $fields,
+                       'conds' => $this->mQueryConds,
+                       'options' => $options,
                        'join_conds' => $join_conds
                );
        }
@@ -198,11 +198,13 @@ class ImageListPager extends TablePager {
                                return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
                        case 'img_name':
                                static $imgfile = null;
-                               if ( $imgfile === null ) $imgfile = $this->msg( 'imgfile' )->text();
+                               if ( $imgfile === null ) {
+                                       $imgfile = $this->msg( 'imgfile' )->text();
+                               }
 
                                // Weird files can maybe exist? Bug 22227
                                $filePage = Title::makeTitleSafe( NS_FILE, $value );
-                               if( $filePage ) {
+                               if ( $filePage ) {
                                        $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
                                        $download = Xml::element( 'a',
                                                array( 'href' => wfLocalFile( $filePage )->getURL() ),
@@ -240,15 +242,15 @@ class ImageListPager extends TablePager {
                if ( !$wgMiserMode ) {
                        $inputForm['listfiles_search_for'] = Html::input( 'ilsearch', $this->mSearch, 'text',
                                array(
-                                       'size'          => '40',
+                                       'size' => '40',
                                        'maxlength' => '255',
-                                       'id'            => 'mw-ilsearch',
+                                       'id' => 'mw-ilsearch',
                        ) );
                }
                $inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
-                       'size'          => '40',
+                       'size' => '40',
                        'maxlength' => '255',
-                       'id'            => 'mw-listfiles-user',
+                       'id' => 'mw-listfiles-user',
                ) );
                return Html::openElement( 'form',
                                array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
index 7cccf88..3309682 100644 (file)
@@ -85,7 +85,7 @@ class SpecialListGroupRights extends SpecialPage {
                                $msg->text() :
                                MWNamespace::getCanonicalName( NS_PROJECT ) . ':' . $groupname;
 
-                       if( $group == '*' ) {
+                       if ( $group == '*' ) {
                                // Do not make a link for the generic * group
                                $grouppage = htmlspecialchars( $groupnameLocalized );
                        } else {
@@ -149,9 +149,9 @@ class SpecialListGroupRights extends SpecialPage {
         */
        private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
                $r = array();
-               foreach( $permissions as $permission => $granted ) {
+               foreach ( $permissions as $permission => $granted ) {
                        //show as granted only if it isn't revoked to prevent duplicate display of permissions
-                       if( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) {
+                       if ( $granted && ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) ) {
                                $description = $this->msg( 'listgrouprights-right-display',
                                        User::getRightDescription( $permission ),
                                        '<span class="mw-listgrouprights-right-name">' . $permission . '</span>'
@@ -159,8 +159,8 @@ class SpecialListGroupRights extends SpecialPage {
                                $r[] = $description;
                        }
                }
-               foreach( $revoke as $permission => $revoked ) {
-                       if( $revoked ) {
+               foreach ( $revoke as $permission => $revoked ) {
+                       if ( $revoked ) {
                                $description = $this->msg( 'listgrouprights-right-revoked',
                                        User::getRightDescription( $permission ),
                                        '<span class="mw-listgrouprights-right-name">' . $permission . '</span>'
@@ -170,43 +170,43 @@ class SpecialListGroupRights extends SpecialPage {
                }
                sort( $r );
                $lang = $this->getLanguage();
-               if( $add === true ) {
+               if ( $add === true ) {
                        $r[] = $this->msg( 'listgrouprights-addgroup-all' )->escaped();
-               } elseif( is_array( $add ) && count( $add ) ) {
+               } elseif ( is_array( $add ) && count( $add ) ) {
                        $add = array_values( array_unique( $add ) );
                        $r[] = $this->msg( 'listgrouprights-addgroup',
                                $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $add ) ),
                                count( $add )
                        )->parse();
                }
-               if( $remove === true ) {
+               if ( $remove === true ) {
                        $r[] = $this->msg( 'listgrouprights-removegroup-all' )->escaped();
-               } elseif( is_array( $remove ) && count( $remove ) ) {
+               } elseif ( is_array( $remove ) && count( $remove ) ) {
                        $remove = array_values( array_unique( $remove ) );
                        $r[] = $this->msg( 'listgrouprights-removegroup',
                                $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $remove ) ),
                                count( $remove )
                        )->parse();
                }
-               if( $addSelf === true ) {
+               if ( $addSelf === true ) {
                        $r[] = $this->msg( 'listgrouprights-addgroup-self-all' )->escaped();
-               } elseif( is_array( $addSelf ) && count( $addSelf ) ) {
+               } elseif ( is_array( $addSelf ) && count( $addSelf ) ) {
                        $addSelf = array_values( array_unique( $addSelf ) );
                        $r[] = $this->msg( 'listgrouprights-addgroup-self',
                                $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $addSelf ) ),
                                count( $addSelf )
                        )->parse();
                }
-               if( $removeSelf === true ) {
+               if ( $removeSelf === true ) {
                        $r[] = $this->msg( 'listgrouprights-removegroup-self-all' )->parse();
-               } elseif( is_array( $removeSelf ) && count( $removeSelf ) ) {
+               } elseif ( is_array( $removeSelf ) && count( $removeSelf ) ) {
                        $removeSelf = array_values( array_unique( $removeSelf ) );
                        $r[] = $this->msg( 'listgrouprights-removegroup-self',
                                $lang->listToText( array_map( array( 'User', 'makeGroupLinkWiki' ), $removeSelf ) ),
                                count( $removeSelf )
                        )->parse();
                }
-               if( empty( $r ) ) {
+               if ( empty( $r ) ) {
                        return '';
                } else {
                        return '<ul><li>' . implode( "</li>\n<li>", $r ) . '</li></ul>';
index 24888c0..4401499 100644 (file)
@@ -121,7 +121,7 @@ class ListredirectsPage extends QueryPage {
 
                # Find out where the redirect leads
                $target = $this->getRedirectTarget( $result );
-               if( $target ) {
+               if ( $target ) {
                        # Make a link to the destination page
                        $lang = $this->getLanguage();
                        $arr = $lang->getArrow() . $lang->getDirMark();
index d253a4d..d674b05 100644 (file)
@@ -69,7 +69,7 @@ class UsersPager extends AlphabeticPager {
                $this->requestedUser = '';
                if ( $un != '' ) {
                        $username = Title::makeTitleSafe( NS_USER, $un );
-                       if( ! is_null( $username ) ) {
+                       if ( ! is_null( $username ) ) {
                                $this->requestedUser = $username->getText();
                        }
                }
@@ -90,26 +90,26 @@ class UsersPager extends AlphabeticPager {
                $dbr = wfGetDB( DB_SLAVE );
                $conds = array();
                // Don't show hidden names
-               if( !$this->getUser()->isAllowed( 'hideuser' ) ) {
+               if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
                        $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
                }
 
                $options = array();
 
-               if( $this->requestedGroup != '' ) {
+               if ( $this->requestedGroup != '' ) {
                        $conds['ug_group'] = $this->requestedGroup;
                } else {
                        //$options['USE INDEX'] = $this->creationSort ? 'PRIMARY' : 'user_name';
                }
-               if( $this->requestedUser != '' ) {
+               if ( $this->requestedUser != '' ) {
                        # Sorted either by account creation or name
-                       if( $this->creationSort ) {
+                       if ( $this->creationSort ) {
                                $conds[] = 'user_id >= ' . intval( User::idFromName( $this->requestedUser ) );
                        } else {
                                $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser );
                        }
                }
-               if( $this->editsOnly ) {
+               if ( $this->editsOnly ) {
                        $conds[] = 'user_editcount > 0';
                }
 
@@ -159,15 +159,16 @@ class UsersPager extends AlphabeticPager {
 
                $groups = '';
                $groups_list = self::getGroups( $row->user_id );
-               if( !$this->including && count( $groups_list ) > 0 ) {
+               if ( !$this->including && count( $groups_list ) > 0 ) {
                        $list = array();
-                       foreach( $groups_list as $group )
+                       foreach ( $groups_list as $group ) {
                                $list[] = self::buildGroupLink( $group, $userName );
+                       }
                        $groups = $lang->commaList( $list );
                }
 
                $item = $lang->specialList( $ulinks, $groups );
-               if( $row->ipb_deleted ) {
+               if ( $row->ipb_deleted ) {
                        $item = "<span class=\"deleted\">$item</span>";
                }
 
@@ -179,7 +180,7 @@ class UsersPager extends AlphabeticPager {
 
                $created = '';
                # Some rows may be NULL
-               if( !$this->including && $row->creation ) {
+               if ( !$this->including && $row->creation ) {
                        $user = $this->getUser();
                        $d = $lang->userDate( $row->creation, $user );
                        $t = $lang->userTime( $row->creation, $user );
@@ -233,8 +234,9 @@ class UsersPager extends AlphabeticPager {
                $out .= Xml::label( $this->msg( 'group' )->text(), 'group' ) . ' ' .
                        Xml::openElement( 'select', array( 'name' => 'group', 'id' => 'group' ) ) .
                        Xml::option( $this->msg( 'group-all' )->text(), '' );
-               foreach( $this->getAllGroups() as $group => $groupText )
+               foreach ( $this->getAllGroups() as $group => $groupText ) {
                        $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
+               }
                $out .= Xml::closeElement( 'select' ) . '<br />';
                $out .= Xml::checkLabel( $this->msg( 'listusers-editsonly' )->text(), 'editsOnly', 'editsOnly', $this->editsOnly );
                $out .= '&#160;';
@@ -259,7 +261,7 @@ class UsersPager extends AlphabeticPager {
         */
        function getAllGroups() {
                $result = array();
-               foreach( User::getAllGroups() as $group ) {
+               foreach ( User::getAllGroups() as $group ) {
                        $result[$group] = User::getGroupName( $group );
                }
                asort( $result );
@@ -272,10 +274,10 @@ class UsersPager extends AlphabeticPager {
         */
        function getDefaultQuery() {
                $query = parent::getDefaultQuery();
-               if( $this->requestedGroup != '' ) {
+               if ( $this->requestedGroup != '' ) {
                        $query['group'] = $this->requestedGroup;
                }
-               if( $this->requestedUser != '' ) {
+               if ( $this->requestedUser != '' ) {
                        $query['username'] = $this->requestedUser;
                }
                wfRunHooks( 'SpecialListusersDefaultQuery', array( $this, &$query ) );
@@ -337,7 +339,7 @@ class SpecialListUsers extends IncludableSpecialPage {
                        $s = $up->getPageHeader();
                }
 
-               if( $usersbody ) {
+               if ( $usersbody ) {
                        $s .= $up->getNavigationBar();
                        $s .= Html::rawElement( 'ul', array(), $usersbody );
                        $s .= $up->getNavigationBar();
index 4fc0f6e..5b6ff18 100644 (file)
@@ -99,10 +99,10 @@ class SpecialLog extends SpecialPage {
                # Some log types are only for a 'User:' title but we might have been given
                # only the username instead of the full title 'User:username'. This part try
                # to lookup for a user by that name and eventually fix user input. See bug 1697.
-               if( in_array( $opts->getValue( 'type' ), $this->typeOnUser ) ) {
+               if ( in_array( $opts->getValue( 'type' ), $this->typeOnUser ) ) {
                        # ok we have a type of log which expect a user title.
                        $target = Title::newFromText( $opts->getValue( 'page' ) );
-                       if( $target && $target->getNamespace() === NS_MAIN ) {
+                       if ( $target && $target->getNamespace() === NS_MAIN ) {
                                # User forgot to add 'User:', we are adding it for him
                                $opts->setValue( 'page',
                                        Title::makeTitleSafe( NS_USER, $opts->getValue( 'page' ) )
index 33f291b..6bccdc7 100644 (file)
@@ -75,7 +75,7 @@ class LonelyPagesPage extends PageQueryPage {
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort in MySQL 5
-               if( count( MWNamespace::getContentNamespaces() ) > 1 ) {
+               if ( count( MWNamespace::getContentNamespaces() ) > 1 ) {
                        return array( 'page_namespace', 'page_title' );
                } else {
                        return array( 'page_title' );
index 1476e15..013c800 100644 (file)
@@ -52,14 +52,14 @@ class SpecialMergeHistory extends SpecialPage {
                $this->mTargetID = intval( $request->getVal( 'targetID' ) );
                $this->mDestID = intval( $request->getVal( 'destID' ) );
                $this->mTimestamp = $request->getVal( 'mergepoint' );
-               if( !preg_match( '/[0-9]{14}/', $this->mTimestamp ) ) {
+               if ( !preg_match( '/[0-9]{14}/', $this->mTimestamp ) ) {
                        $this->mTimestamp = '';
                }
                $this->mComment = $request->getText( 'wpComment' );
 
                $this->mMerge = $request->wasPosted() && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) );
                // target page
-               if( $this->mSubmitted ) {
+               if ( $this->mSubmitted ) {
                        $this->mTargetObj = Title::newFromURL( $this->mTarget );
                        $this->mDestObj = Title::newFromURL( $this->mDest );
                } else {
@@ -75,7 +75,7 @@ class SpecialMergeHistory extends SpecialPage {
         */
        function preCacheMessages() {
                // Precache various messages
-               if( !isset( $this->message ) ) {
+               if ( !isset( $this->message ) ) {
                        $this->message['last'] = $this->msg( 'last' )->escaped();
                }
        }
@@ -89,7 +89,7 @@ class SpecialMergeHistory extends SpecialPage {
                $this->setHeaders();
                $this->outputHeader();
 
-               if( $this->mTargetID && $this->mDestID && $this->mAction == 'submit' && $this->mMerge ) {
+               if ( $this->mTargetID && $this->mDestID && $this->mAction == 'submit' && $this->mMerge ) {
                        $this->merge();
                        return;
                }
@@ -102,7 +102,7 @@ class SpecialMergeHistory extends SpecialPage {
                $errors = array();
                if ( !$this->mTargetObj instanceof Title ) {
                        $errors[] = $this->msg( 'mergehistory-invalid-source' )->parseAsBlock();
-               } elseif( !$this->mTargetObj->exists() ) {
+               } elseif ( !$this->mTargetObj->exists() ) {
                        $errors[] = $this->msg( 'mergehistory-no-source', array( 'parse' ),
                                wfEscapeWikiText( $this->mTargetObj->getPrefixedText() )
                        )->parseAsBlock();
@@ -110,7 +110,7 @@ class SpecialMergeHistory extends SpecialPage {
 
                if ( !$this->mDestObj instanceof Title ) {
                        $errors[] = $this->msg( 'mergehistory-invalid-destination' )->parseAsBlock();
-               } elseif( !$this->mDestObj->exists() ) {
+               } elseif ( !$this->mDestObj->exists() ) {
                        $errors[] = $this->msg( 'mergehistory-no-destination', array( 'parse' ),
                                wfEscapeWikiText( $this->mDestObj->getPrefixedText() )
                        )->parseAsBlock();
@@ -183,7 +183,7 @@ class SpecialMergeHistory extends SpecialPage {
                );
                $out->addHTML( $top );
 
-               if( $haveRevisions ) {
+               if ( $haveRevisions ) {
                        # Format the user-visible controls (comment field, submission button)
                        # in a nice little table
                        $table =
@@ -216,7 +216,7 @@ class SpecialMergeHistory extends SpecialPage {
                        $this->msg( 'mergehistory-list' )->escaped() . "</h2>\n"
                );
 
-               if( $haveRevisions ) {
+               if ( $haveRevisions ) {
                        $out->addHTML( $revisions->getNavigationBar() );
                        $out->addHTML( '<ul>' );
                        $out->addHTML( $revisions->getBody() );
@@ -261,14 +261,14 @@ class SpecialMergeHistory extends SpecialPage {
                        array(),
                        array( 'oldid' => $rev->getId() )
                );
-               if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
+               if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
                        $pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
                }
 
                # Last link
-               if( !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
+               if ( !$rev->userCan( Revision::DELETED_TEXT, $user ) ) {
                        $last = $this->message['last'];
-               } elseif( isset( $this->prevId[$row->rev_id] ) ) {
+               } elseif ( isset( $this->prevId[$row->rev_id] ) ) {
                        $last = Linker::linkKnown(
                                $rev->getTitle(),
                                $this->message['last'],
@@ -283,7 +283,7 @@ class SpecialMergeHistory extends SpecialPage {
                $userLink = Linker::revUserTools( $rev );
 
                $size = $row->rev_len;
-               if( !is_null( $size ) ) {
+               if ( !is_null( $size ) ) {
                        $stxt = Linker::formatRevisionSize( $size );
                }
                $comment = Linker::revComment( $rev );
@@ -298,10 +298,10 @@ class SpecialMergeHistory extends SpecialPage {
                # keep it consistent...
                $targetTitle = Title::newFromID( $this->mTargetID );
                $destTitle = Title::newFromID( $this->mDestID );
-               if( is_null( $targetTitle ) || is_null( $destTitle ) ) {
+               if ( is_null( $targetTitle ) || is_null( $destTitle ) ) {
                        return false; // validate these
                }
-               if( $targetTitle->getArticleID() == $destTitle->getArticleID() ) {
+               if ( $targetTitle->getArticleID() == $destTitle->getArticleID() ) {
                        return false;
                }
                # Verify that this timestamp is valid
@@ -317,7 +317,7 @@ class SpecialMergeHistory extends SpecialPage {
                        __METHOD__
                );
                # Destination page must exist with revisions
-               if( !$maxtimestamp ) {
+               if ( !$maxtimestamp ) {
                        $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
                        return false;
                }
@@ -329,12 +329,12 @@ class SpecialMergeHistory extends SpecialPage {
                        __METHOD__
                );
                # $this->mTimestamp must be older than $maxtimestamp
-               if( $this->mTimestamp >= $maxtimestamp ) {
+               if ( $this->mTimestamp >= $maxtimestamp ) {
                        $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
                        return false;
                }
                # Update the revisions
-               if( $this->mTimestamp ) {
+               if ( $this->mTimestamp ) {
                        $timewhere = "rev_timestamp <= {$this->mTimestamp}";
                        $timestampLimit = wfTimestamp( TS_MW, $this->mTimestamp );
                } else {
@@ -358,8 +358,8 @@ class SpecialMergeHistory extends SpecialPage {
                        __METHOD__,
                        array( 'FOR UPDATE' )
                );
-               if( !$haveRevisions ) {
-                       if( $this->mComment ) {
+               if ( !$haveRevisions ) {
+                       if ( $this->mComment ) {
                                $comment = $this->msg(
                                        'mergehistory-comment',
                                        $targetTitle->getPrefixedText(),
@@ -380,8 +380,8 @@ class SpecialMergeHistory extends SpecialPage {
                        if ( $redirectContent ) {
                                $redirectPage = WikiPage::factory( $targetTitle );
                                $redirectRevision = new Revision( array(
-                                       'title'   => $targetTitle,
-                                       'page'    => $this->mTargetID,
+                                       'title' => $targetTitle,
+                                       'page' => $this->mTargetID,
                                        'comment' => $comment,
                                        'content' => $redirectContent ) );
                                $redirectRevision->insertOn( $dbw );
@@ -392,9 +392,9 @@ class SpecialMergeHistory extends SpecialPage {
                                $dbw->delete( 'pagelinks', array( 'pl_from' => $this->mDestID ), __METHOD__ );
                                $dbw->insert( 'pagelinks',
                                        array(
-                                               'pl_from'      => $this->mDestID,
+                                               'pl_from' => $this->mDestID,
                                                'pl_namespace' => $destTitle->getNamespace(),
-                                               'pl_title'     => $destTitle->getDBkey() ),
+                                               'pl_title' => $destTitle->getDBkey() ),
                                        __METHOD__
                                );
                        } else {
@@ -405,7 +405,7 @@ class SpecialMergeHistory extends SpecialPage {
                }
                $destTitle->invalidateCache(); // update histories
                # Check if this did anything
-               if( !$count ) {
+               if ( !$count ) {
                        $this->getOutput()->addWikiMsg( 'mergehistory-fail' );
                        return false;
                }
@@ -462,9 +462,9 @@ class MergeHistoryPager extends ReverseChronologicalPager {
                        $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
 
                        $rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
-                       if( $rev_id > $row->rev_id ) {
+                       if ( $rev_id > $row->rev_id ) {
                                $this->mForm->prevId[$rev_id] = $row->rev_id;
-                       } elseif( $rev_id < $row->rev_id ) {
+                       } elseif ( $rev_id < $row->rev_id ) {
                                $this->mForm->prevId[$row->rev_id] = $rev_id;
                        }
 
@@ -489,7 +489,7 @@ class MergeHistoryPager extends ReverseChronologicalPager {
                return array(
                        'tables' => array( 'revision', 'page', 'user' ),
                        'fields' => array_merge( Revision::selectFields(), Revision::selectUserFields() ),
-                       'conds'  => $conds,
+                       'conds' => $conds,
                        'join_conds' => array(
                                'page' => Revision::pageJoinCond(),
                                'user' => Revision::userJoinCond() )
index c35c44e..e7a86a6 100644 (file)
@@ -55,10 +55,10 @@ class MovePageForm extends UnlistedSpecialPage {
                $oldTitleText = $request->getVal( 'wpOldTitle', $target );
                $this->oldTitle = Title::newFromText( $oldTitleText );
 
-               if( is_null( $this->oldTitle ) ) {
+               if ( is_null( $this->oldTitle ) ) {
                        throw new ErrorPageError( 'notargettitle', 'notargettext' );
                }
-               if( !$this->oldTitle->exists() ) {
+               if ( !$this->oldTitle->exists() ) {
                        throw new ErrorPageError( 'nopagetitle', 'nopagetext' );
                }
 
@@ -129,7 +129,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        # link, check for validity. We can then show some diagnostic
                        # information and save a click.
                        $newerr = $this->oldTitle->isValidMoveOperation( $newTitle );
-                       if( is_array( $newerr ) ) {
+                       if ( is_array( $newerr ) ) {
                                $err = $newerr;
                        }
                }
@@ -212,8 +212,8 @@ class MovePageForm extends UnlistedSpecialPage {
                                }
                        } else {
                                $errStr = array();
-                               foreach( $err as $errMsg ) {
-                                       if( $errMsg[0] == 'hookaborted' ) {
+                               foreach ( $err as $errMsg ) {
+                                       if ( $errMsg[0] == 'hookaborted' ) {
                                                $errStr[] = $errMsg[1];
                                        } else {
                                                $errMsgName = array_shift( $errMsg );
@@ -299,7 +299,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        </tr>"
                );
 
-               if( $considerTalk ) {
+               if ( $considerTalk ) {
                        $out->addHTML( "
                                <tr>
                                        <td></td>
@@ -334,7 +334,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        );
                }
 
-               if( $canMoveSubpage ) {
+               if ( $canMoveSubpage ) {
                        $out->addHTML( "
                                <tr>
                                        <td></td>
@@ -361,14 +361,14 @@ class MovePageForm extends UnlistedSpecialPage {
                $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' )
                        || $user->isWatched( $this->oldTitle ) );
                # Don't allow watching if user is not logged in
-               if( $user->isLoggedIn() ) {
+               if ( $user->isLoggedIn() ) {
                        $out->addHTML( "
                        <tr>
                                <td></td>
                                <td class='mw-input'>" .
                                        Xml::checkLabel( $this->msg( 'move-watch' )->text(), 'wpWatch', 'watch', $watchChecked ) .
                                "</td>
-                       </tr>");
+                       </tr>" );
                }
 
                $out->addHTML( "
@@ -502,7 +502,7 @@ class MovePageForm extends UnlistedSpecialPage {
                # Now we move extra pages we've been asked to move: subpages and talk
                # pages.  First, if the old page or the new page is a talk page, we
                # can't move any talk pages: cancel that.
-               if( $ot->isTalkPage() || $nt->isTalkPage() ) {
+               if ( $ot->isTalkPage() || $nt->isTalkPage() ) {
                        $this->moveTalk = false;
                }
 
@@ -524,7 +524,7 @@ class MovePageForm extends UnlistedSpecialPage {
 
                // @todo FIXME: Use Title::moveSubpages() here
                $dbr = wfGetDB( DB_MASTER );
-               if( $this->moveSubpages && (
+               if ( $this->moveSubpages && (
                        MWNamespace::hasSubpages( $nt->getNamespace() ) || (
                                $this->moveTalk &&
                                MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() )
@@ -535,13 +535,13 @@ class MovePageForm extends UnlistedSpecialPage {
                                        . ' OR page_title = ' . $dbr->addQuotes( $ot->getDBkey() )
                        );
                        $conds['page_namespace'] = array();
-                       if( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
+                       if ( MWNamespace::hasSubpages( $nt->getNamespace() ) ) {
                                $conds['page_namespace'][] = $ot->getNamespace();
                        }
-                       if( $this->moveTalk && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() ) ) {
+                       if ( $this->moveTalk && MWNamespace::hasSubpages( $nt->getTalkPage()->getNamespace() ) ) {
                                $conds['page_namespace'][] = $ot->getTalkPage()->getNamespace();
                        }
-               } elseif( $this->moveTalk ) {
+               } elseif ( $this->moveTalk ) {
                        $conds = array(
                                'page_namespace' => $ot->getTalkPage()->getNamespace(),
                                'page_title' => $ot->getDBkey()
@@ -552,7 +552,7 @@ class MovePageForm extends UnlistedSpecialPage {
                }
 
                $extraPages = array();
-               if( !is_null( $conds ) ) {
+               if ( !is_null( $conds ) ) {
                        $extraPages = TitleArray::newFromResult(
                                $dbr->select( 'page',
                                        array( 'page_id', 'page_namespace', 'page_title' ),
@@ -564,8 +564,8 @@ class MovePageForm extends UnlistedSpecialPage {
 
                $extraOutput = array();
                $count = 1;
-               foreach( $extraPages as $oldSubpage ) {
-                       if( $ot->equals( $oldSubpage ) ) {
+               foreach ( $extraPages as $oldSubpage ) {
+                       if ( $ot->equals( $oldSubpage ) ) {
                                # Already did this one.
                                continue;
                        }
@@ -575,7 +575,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                StringUtils::escapeRegexReplacement( $nt->getDBkey() ), # bug 21234
                                $oldSubpage->getDBkey()
                        );
-                       if( $oldSubpage->isTalkPage() ) {
+                       if ( $oldSubpage->isTalkPage() ) {
                                $newNs = $nt->getTalkPage()->getNamespace();
                        } else {
                                $newNs = $nt->getSubjectPage()->getNamespace();
@@ -583,7 +583,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        # Bug 14385: we need makeTitleSafe because the new page names may
                        # be longer than 255 characters.
                        $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
-                       if( !$newSubpage ) {
+                       if ( !$newSubpage ) {
                                $oldLink = Linker::linkKnown( $oldSubpage );
                                $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink
                                        )->params( Title::makeName( $newNs, $newPageName ) )->escaped();
@@ -596,7 +596,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                $extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
                        } else {
                                $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
-                               if( $success === true ) {
+                               if ( $success === true ) {
                                        if ( $this->fixRedirects ) {
                                                DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
                                        }
@@ -609,7 +609,7 @@ class MovePageForm extends UnlistedSpecialPage {
                                        $newLink = Linker::linkKnown( $newSubpage );
                                        $extraOutput[] = $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped();
                                        ++$count;
-                                       if( $count >= $wgMaximumMovedPages ) {
+                                       if ( $count >= $wgMaximumMovedPages ) {
                                                $extraOutput[] = $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped();
                                                break;
                                        }
@@ -622,12 +622,12 @@ class MovePageForm extends UnlistedSpecialPage {
 
                }
 
-               if( $extraOutput !== array() ) {
+               if ( $extraOutput !== array() ) {
                        $out->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $extraOutput ) . "</li>\n</ul>" );
                }
 
                # Deal with watches (we don't watch subpages)
-               if( $this->watch && $user->isLoggedIn() ) {
+               if ( $this->watch && $user->isLoggedIn() ) {
                        $user->addWatch( $ot );
                        $user->addWatch( $nt );
                } else {
@@ -638,7 +638,7 @@ class MovePageForm extends UnlistedSpecialPage {
                # Re-clear the file redirect cache, which may have been polluted by
                # parsing in messages above. See CR r56745.
                # @todo FIXME: Needs a more robust solution inside FileRepo.
-               if( $ot->getNamespace() == NS_FILE ) {
+               if ( $ot->getNamespace() == NS_FILE ) {
                        RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot );
                }
        }
@@ -651,8 +651,9 @@ class MovePageForm extends UnlistedSpecialPage {
        }
 
        function showSubpages( $title ) {
-               if( !MWNamespace::hasSubpages( $title->getNamespace() ) )
+               if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) {
                        return;
+               }
 
                $subpages = $title->getSubpages();
                $count = $subpages instanceof TitleArray ? $subpages->count() : 0;
@@ -669,7 +670,7 @@ class MovePageForm extends UnlistedSpecialPage {
                $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) );
                $out->addHTML( "<ul>\n" );
 
-               foreach( $subpages as $subpage ) {
+               foreach ( $subpages as $subpage ) {
                        $link = Linker::link( $subpage );
                        $out->addHTML( "<li>$link</li>\n" );
                }
index 52cbc3a..b865f40 100644 (file)
@@ -73,9 +73,9 @@ class NewFilesPager extends ReverseChronologicalPager {
                $conds = $jconds = array();
                $tables = array( 'image' );
 
-               if( !$this->showbots ) {
+               if ( !$this->showbots ) {
                        $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );
-                       if( count( $groupsWithBotPermission ) ) {
+                       if ( count( $groupsWithBotPermission ) ) {
                                $tables[] = 'user_groups';
                                $conds[] = 'ug_group IS NULL';
                                $jconds['user_groups'] = array(
@@ -88,10 +88,10 @@ class NewFilesPager extends ReverseChronologicalPager {
                        }
                }
 
-               if( !$wgMiserMode && $this->like !== null ) {
+               if ( !$wgMiserMode && $this->like !== null ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        $likeObj = Title::newFromURL( $this->like );
-                       if( $likeObj instanceof Title ) {
+                       if ( $likeObj instanceof Title ) {
                                $like = $dbr->buildLike( $dbr->anyString(), strtolower( $likeObj->getDBkey() ), $dbr->anyString() );
                                $conds[] = "LOWER(img_name) $like";
                        }
@@ -164,7 +164,7 @@ class NewFilesPager extends ReverseChronologicalPager {
                        ),
                );
 
-               if( $wgMiserMode ) {
+               if ( $wgMiserMode ) {
                        unset( $fields['like'] );
                }
 
index eefc1b7..46bf81a 100644 (file)
@@ -63,17 +63,19 @@ class SpecialNewpages extends IncludableSpecialPage {
 
                $this->customFilters = array();
                wfRunHooks( 'SpecialNewPagesFilters', array( $this, &$this->customFilters ) );
-               foreach( $this->customFilters as $key => $params ) {
+               foreach ( $this->customFilters as $key => $params ) {
                        $opts->add( $key, $params['default'] );
                }
 
                // Set values
                $opts->fetchValuesFromRequest( $this->getRequest() );
-               if ( $par ) $this->parseParams( $par );
+               if ( $par ) {
+                       $this->parseParams( $par );
+               }
 
                // Validate
                $opts->validateIntBounds( 'limit', 0, 5000 );
-               if( !$wgEnableNewpagesUserFilter ) {
+               if ( !$wgEnableNewpagesUserFilter ) {
                        $opts->setValue( 'username', '' );
                }
        }
@@ -113,7 +115,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                        }
                        if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
                                $ns = $this->getLanguage()->getNsIndex( $m[1] );
-                               if( $ns !== false ) {
+                               if ( $ns !== false ) {
                                        $this->opts->setValue( 'namespace', $ns );
                                }
                        }
@@ -135,12 +137,12 @@ class SpecialNewpages extends IncludableSpecialPage {
                $this->showNavigation = !$this->including(); // Maybe changed in setup
                $this->setup( $par );
 
-               if( !$this->including() ) {
+               if ( !$this->including() ) {
                        // Settings
                        $this->form();
 
                        $feedType = $this->opts->getValue( 'feed' );
-                       if( $feedType ) {
+                       if ( $feedType ) {
                                $this->feed( $feedType );
                                return;
                        }
@@ -154,7 +156,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $pager->mLimit = $this->opts->getValue( 'limit' );
                $pager->mOffset = $this->opts->getValue( 'offset' );
 
-               if( $pager->getNumRows() ) {
+               if ( $pager->getNumRows() ) {
                        $navigation = '';
                        if ( $this->showNavigation ) {
                                $navigation = $pager->getNavigationBar();
@@ -244,8 +246,8 @@ class SpecialNewpages extends IncludableSpecialPage {
                                                        'selected' => $namespace,
                                                        'all' => 'all',
                                                ), array(
-                                                       'name'  => 'namespace',
-                                                       'id'    => 'namespace',
+                                                       'name' => 'namespace',
+                                                       'id' => 'namespace',
                                                        'class' => 'namespaceselector',
                                                )
                                        ) . '&#160;' .
@@ -331,7 +333,7 @@ class SpecialNewpages extends IncludableSpecialPage {
 
                $query = array( 'redirect' => 'no' );
 
-               if( $this->patrollable( $result ) ) {
+               if ( $this->patrollable( $result ) ) {
                        $query['rcid'] = $result->rc_id;
                }
 
@@ -369,7 +371,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                }
 
                # Tags, if any.
-               if( isset( $result->ts_tags ) ) {
+               if ( isset( $result->ts_tags ) ) {
                        list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages' );
                        $classes = array_merge( $classes, $newClasses );
                } else {
@@ -411,7 +413,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                        return;
                }
 
-               if( !isset( $wgFeedClasses[$type] ) ) {
+               if ( !isset( $wgFeedClasses[$type] ) ) {
                        $this->getOutput()->addWikiMsg( 'feed-invalid' );
                        return;
                }
@@ -427,7 +429,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                $pager->mLimit = min( $limit, $wgFeedLimit );
 
                $feed->outHeader();
-               if( $pager->getNumRows() > 0 ) {
+               if ( $pager->getNumRows() > 0 ) {
                        foreach ( $pager->mResult as $row ) {
                                $feed->outItem( $this->feedItem( $row ) );
                        }
@@ -443,7 +445,7 @@ class SpecialNewpages extends IncludableSpecialPage {
 
        protected function feedItem( $row ) {
                $title = Title::makeTitle( intval( $row->rc_namespace ), $row->rc_title );
-               if( $title ) {
+               if ( $title ) {
                        $date = $row->rc_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
 
@@ -466,7 +468,7 @@ class SpecialNewpages extends IncludableSpecialPage {
 
        protected function feedItemDesc( $row ) {
                $revision = Revision::newFromId( $row->rev_id );
-               if( $revision ) {
+               if ( $revision ) {
                        //XXX: include content model/type in feed item?
                        return '<p>' . htmlspecialchars( $revision->getUserText() ) .
                                $this->msg( 'colon-separator' )->inContentLanguage()->escaped() .
@@ -511,7 +513,7 @@ class NewPagesPager extends ReverseChronologicalPager {
                $username = $this->opts->getValue( 'username' );
                $user = Title::makeTitleSafe( NS_USER, $username );
 
-               if( $namespace !== false ) {
+               if ( $namespace !== false ) {
                        if ( $this->opts->getValue( 'invert' ) ) {
                                $conds[] = 'rc_namespace != ' . $this->mDb->addQuotes( $namespace );
                        } else {
@@ -523,18 +525,18 @@ class NewPagesPager extends ReverseChronologicalPager {
                }
 
                # $wgEnableNewpagesUserFilter - temp WMF hack
-               if( $wgEnableNewpagesUserFilter && $user ) {
+               if ( $wgEnableNewpagesUserFilter && $user ) {
                        $conds['rc_user_text'] = $user->getText();
                        $rcIndexes = 'rc_user_text';
                # If anons cannot make new pages, don't "exclude logged in users"!
-               } elseif( User::groupHasPermission( '*', 'createpage' ) && $this->opts->getValue( 'hideliu' ) ) {
+               } elseif ( User::groupHasPermission( '*', 'createpage' ) && $this->opts->getValue( 'hideliu' ) ) {
                        $conds['rc_user'] = 0;
                }
                # If this user cannot see patrolled edits or they are off, don't do dumb queries!
-               if( $this->opts->getValue( 'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
+               if ( $this->opts->getValue( 'hidepatrolled' ) && $this->getUser()->useNPPatrol() ) {
                        $conds['rc_patrolled'] = 0;
                }
-               if( $this->opts->getValue( 'hidebots' ) ) {
+               if ( $this->opts->getValue( 'hidebots' ) ) {
                        $conds['rc_bot'] = 0;
                }
 
@@ -546,7 +548,7 @@ class NewPagesPager extends ReverseChronologicalPager {
                $tables = array( 'recentchanges', 'page' );
                $fields = array(
                        'rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', 'rc_user_text',
-                       'rc_comment', 'rc_timestamp', 'rc_patrolled','rc_id', 'rc_deleted',
+                       'rc_comment', 'rc_timestamp', 'rc_patrolled', 'rc_id', 'rc_deleted',
                        'length' => 'page_len', 'rev_id' => 'page_latest', 'rc_this_oldid',
                        'page_namespace', 'page_title'
                );
@@ -556,10 +558,10 @@ class NewPagesPager extends ReverseChronologicalPager {
                        array( &$this, $this->opts, &$conds, &$tables, &$fields, &$join_conds ) );
 
                $info = array(
-                       'tables'         => $tables,
-                       'fields'         => $fields,
-                       'conds'          => $conds,
-                       'options'        => array( 'USE INDEX' => array( 'recentchanges' => $rcIndexes ) ),
+                       'tables' => $tables,
+                       'fields' => $fields,
+                       'conds' => $conds,
+                       'options' => array( 'USE INDEX' => array( 'recentchanges' => $rcIndexes ) ),
                        'join_conds' => $join_conds
                );
 
index a166b56..df9ed57 100644 (file)
@@ -70,7 +70,7 @@ class SpecialPasswordReset extends FormSpecialPage {
                                'type' => 'text',
                                'label-message' => 'passwordreset-username',
                        );
-                       if( $this->getUser()->isLoggedIn() ) {
+                       if ( $this->getUser()->isLoggedIn() ) {
                                $a['Username']['default'] = $this->getUser()->getName();
                        }
                }
@@ -91,7 +91,7 @@ class SpecialPasswordReset extends FormSpecialPage {
                        );
                }
 
-               if( $this->getUser()->isAllowed( 'passwordreset' ) ) {
+               if ( $this->getUser()->isAllowed( 'passwordreset' ) ) {
                        $a['Capture'] = array(
                                'type' => 'check',
                                'label-message' => 'passwordreset-capture',
@@ -141,7 +141,7 @@ class SpecialPasswordReset extends FormSpecialPage {
                        }
                }
 
-               if( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ) {
+               if ( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ) {
                        // The user knows they don't have the passwordreset permission, but they tried to spoof the form.  That's naughty
                        throw new PermissionsError( 'passwordreset' );
                }
@@ -167,7 +167,7 @@ class SpecialPasswordReset extends FormSpecialPage {
                        );
                        if ( $res ) {
                                $users = array();
-                               foreach( $res as $row ) {
+                               foreach ( $res as $row ) {
                                        $users[] = User::newFromRow( $row );
                                }
                        } else {
@@ -185,8 +185,8 @@ class SpecialPasswordReset extends FormSpecialPage {
                        return array( $error );
                }
 
-               if( count( $users ) == 0 ) {
-                       if( $method == 'email' ) {
+               if ( count( $users ) == 0 ) {
+                       if ( $method == 'email' ) {
                                // Don't reveal whether or not an email address is in use
                                return true;
                        } else {
@@ -262,7 +262,7 @@ class SpecialPasswordReset extends FormSpecialPage {
 
                $this->result = $firstUser->sendMail( $title->escaped(), $this->email->text() );
 
-               if( isset( $data['Capture'] ) && $data['Capture'] ) {
+               if ( isset( $data['Capture'] ) && $data['Capture'] ) {
                        // Save the user, will be used if an error occurs when sending the email
                        $this->firstUser = $firstUser;
                } else {
@@ -272,7 +272,7 @@ class SpecialPasswordReset extends FormSpecialPage {
 
                if ( $this->result->isGood() ) {
                        return true;
-               } elseif( isset( $data['Capture'] ) && $data['Capture'] ) {
+               } elseif ( isset( $data['Capture'] ) && $data['Capture'] ) {
                        // The email didn't send, but maybe they knew that and that's why they captured it
                        return true;
                } else {
@@ -283,10 +283,10 @@ class SpecialPasswordReset extends FormSpecialPage {
        }
 
        public function onSuccess() {
-               if( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ) {
+               if ( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ) {
                        // @todo: Logging
 
-                       if( $this->result->isGood() ) {
+                       if ( $this->result->isGood() ) {
                                $this->getOutput()->addWikiMsg( 'passwordreset-emailsent-capture' );
                        } else {
                                $this->getOutput()->addWikiMsg( 'passwordreset-emailerror-capture',
index 61ba83b..81797f2 100644 (file)
@@ -60,7 +60,7 @@ class PopularPagesPage extends QueryPage {
                global $wgContLang;
 
                $title = Title::makeTitleSafe( $result->namespace, $result->title );
-               if( !$title ) {
+               if ( !$title ) {
                        return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
                                Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
                }
index 6affa73..35b5e3c 100644 (file)
@@ -62,11 +62,11 @@ class SpecialPrefixindex extends SpecialAllpages {
                );
 
                $showme = '';
-               if( isset( $par ) ) {
+               if ( isset( $par ) ) {
                        $showme = $par;
-               } elseif( $prefix != '' ) {
+               } elseif ( $prefix != '' ) {
                        $showme = $prefix;
-               } elseif( $from != '' && $ns === null ) {
+               } elseif ( $from != '' && $ns === null ) {
                        // For back-compat with Special:Allpages
                        // Don't do this if namespace is passed, so paging works when doing NS views.
                        $showme = $from;
@@ -112,8 +112,8 @@ class SpecialPrefixindex extends SpecialAllpages {
                                Html::namespaceSelector( array(
                                                'selected' => $namespace,
                                        ), array(
-                                               'name'  => 'namespace',
-                                               'id'    => 'namespace',
+                                               'name' => 'namespace',
+                                               'id' => 'namespace',
                                                'class' => 'namespaceselector',
                                ) ) .
                                Xml::checkLabel(
@@ -178,8 +178,8 @@ class SpecialPrefixindex extends SpecialAllpages {
                                $conds,
                                __METHOD__,
                                array(
-                                       'ORDER BY'  => 'page_title',
-                                       'LIMIT'     => $this->maxPerPage + 1,
+                                       'ORDER BY' => 'page_title',
+                                       'LIMIT' => $this->maxPerPage + 1,
                                        'USE INDEX' => 'name_title',
                                )
                        );
@@ -187,12 +187,12 @@ class SpecialPrefixindex extends SpecialAllpages {
                        ### @todo FIXME: Side link to previous
 
                        $n = 0;
-                       if( $res->numRows() > 0 ) {
+                       if ( $res->numRows() > 0 ) {
                                $out = Xml::openElement( 'table', array( 'id' => 'mw-prefixindex-list-table' ) );
 
-                               while( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
+                               while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                        $t = Title::makeTitle( $s->page_namespace, $s->page_title );
-                                       if( $t ) {
+                                       if ( $t ) {
                                                $link = ($s->page_is_redirect ? '<div class="allpagesredirect">' : '' ) .
                                                        Linker::linkKnown(
                                                                $t,
@@ -203,16 +203,16 @@ class SpecialPrefixindex extends SpecialAllpages {
                                        } else {
                                                $link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
                                        }
-                                       if( $n % 3 == 0 ) {
+                                       if ( $n % 3 == 0 ) {
                                                $out .= '<tr>';
                                        }
                                        $out .= "<td>$link</td>";
                                        $n++;
-                                       if( $n % 3 == 0 ) {
+                                       if ( $n % 3 == 0 ) {
                                                $out .= '</tr>';
                                        }
                                }
-                               if( ($n % 3) != 0 ) {
+                               if ( ($n % 3) != 0 ) {
                                        $out .= '</tr>';
                                }
                                $out .= Xml::closeElement( 'table' );
@@ -234,14 +234,14 @@ class SpecialPrefixindex extends SpecialAllpages {
                                        '</td>
                                        <td id="mw-prefixindex-nav-form" class="mw-prefixindex-nav">';
 
-                       if( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
+                       if ( isset( $res ) && $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
                                $query = array(
                                        'from' => $s->page_title,
                                        'prefix' => $prefix,
                                        'hideredirects' => $hideredirects,
                                );
 
-                               if( $namespace || $prefix == '' ) {
+                               if ( $namespace || $prefix == '' ) {
                                        // Keep the namespace even if it's 0 for empty prefixes.
                                        // This tells us we're not just a holdover from old links.
                                        $query['namespace'] = $namespace;
index 979c3ee..3fdaf6b 100644 (file)
@@ -40,7 +40,7 @@ class SpecialProtectedpages extends SpecialPage {
                $this->outputHeader();
 
                // Purge expired entries on one in every 10 queries
-               if( !mt_rand( 0, 10 ) ) {
+               if ( !mt_rand( 0, 10 ) ) {
                        Title::purgeExpiredRestrictions();
                }
 
@@ -57,7 +57,7 @@ class SpecialProtectedpages extends SpecialPage {
 
                $this->getOutput()->addHTML( $this->showOptions( $NS, $type, $level, $sizetype, $size, $indefOnly, $cascadeOnly ) );
 
-               if( $pager->getNumRows() ) {
+               if ( $pager->getNumRows() ) {
                        $this->getOutput()->addHTML(
                                $pager->getNavigationBar() .
                                '<ul>' . $pager->getBody() . '</ul>' .
@@ -78,12 +78,12 @@ class SpecialProtectedpages extends SpecialPage {
 
                static $infinity = null;
 
-               if( is_null( $infinity ) ) {
+               if ( is_null( $infinity ) ) {
                        $infinity = wfGetDB( DB_SLAVE )->getInfinity();
                }
 
                $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
-               if( !$title ) {
+               if ( !$title ) {
                        wfProfileOut( __METHOD__ );
                        return Html::rawElement( 'li', array(),
                                Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
@@ -98,7 +98,7 @@ class SpecialProtectedpages extends SpecialPage {
 
                $description_items[] = $protType;
 
-               if( $row->pr_cascade ) {
+               if ( $row->pr_cascade ) {
                        $description_items[] = $this->msg( 'protect-summary-cascade' )->text();
                }
 
@@ -106,7 +106,7 @@ class SpecialProtectedpages extends SpecialPage {
                $lang = $this->getLanguage();
 
                $expiry = $lang->formatExpiry( $row->pr_expiry, TS_MW );
-               if( $expiry != $infinity ) {
+               if ( $expiry != $infinity ) {
                        $user = $this->getUser();
                        $description_items[] = $this->msg(
                                'protect-expiring-local',
@@ -116,12 +116,12 @@ class SpecialProtectedpages extends SpecialPage {
                        )->escaped();
                }
 
-               if( !is_null( $size = $row->page_len ) ) {
+               if ( !is_null( $size = $row->page_len ) ) {
                        $stxt = $lang->getDirMark() . ' ' . Linker::formatRevisionSize( $size );
                }
 
                # Show a link to the change protection form for allowed users otherwise a link to the protection log
-               if( $this->getUser()->isAllowed( 'protect' ) ) {
+               if ( $this->getUser()->isAllowed( 'protect' ) ) {
                        $changeProtection = Linker::linkKnown(
                                $title,
                                $this->msg( 'protect_change' )->escaped(),
@@ -248,13 +248,13 @@ class SpecialProtectedpages extends SpecialPage {
                $options = array();
 
                // First pass to load the log names
-               foreach( Title::getFilteredRestrictionTypes( true ) as $type ) {
+               foreach ( Title::getFilteredRestrictionTypes( true ) as $type ) {
                        $text = $this->msg( "restriction-$type" )->text();
                        $m[$text] = $type;
                }
 
                // Third pass generates sorted XHTML content
-               foreach( $m as $text => $type ) {
+               foreach ( $m as $text => $type ) {
                        $selected = ($type == $pr_type );
                        $options[] = Xml::option( $text, $type, $selected ) . "\n";
                }
@@ -278,17 +278,17 @@ class SpecialProtectedpages extends SpecialPage {
                $options = array();
 
                // First pass to load the log names
-               foreach( $wgRestrictionLevels as $type ) {
+               foreach ( $wgRestrictionLevels as $type ) {
                        // Messages used can be 'restriction-level-sysop' and 'restriction-level-autoconfirmed'
-                       if( $type != '' && $type != '*' ) {
+                       if ( $type != '' && $type != '*' ) {
                                $text = $this->msg( "restriction-level-$type" )->text();
                                $m[$text] = $type;
                        }
                }
 
                // Third pass generates sorted XHTML content
-               foreach( $m as $text => $type ) {
-                       $selected = ($type == $pr_level );
+               foreach ( $m as $text => $type ) {
+                       $selected = ( $type == $pr_level );
                        $options[] = Xml::option( $text, $type, $selected );
                }
 
@@ -348,23 +348,25 @@ class ProtectedPagesPager extends AlphabeticPager {
                $conds[] = 'page_id=pr_page';
                $conds[] = 'pr_type=' . $this->mDb->addQuotes( $this->type );
 
-               if( $this->sizetype == 'min' ) {
+               if ( $this->sizetype == 'min' ) {
                        $conds[] = 'page_len>=' . $this->size;
-               } elseif( $this->sizetype == 'max' ) {
+               } elseif ( $this->sizetype == 'max' ) {
                        $conds[] = 'page_len<=' . $this->size;
                }
 
-               if( $this->indefonly ) {
+               if ( $this->indefonly ) {
                        $conds[] = "pr_expiry = {$this->mDb->addQuotes( $this->mDb->getInfinity() )} OR pr_expiry IS NULL";
                }
-               if( $this->cascadeonly ) {
+               if ( $this->cascadeonly ) {
                        $conds[] = 'pr_cascade = 1';
                }
 
-               if( $this->level )
+               if ( $this->level ) {
                        $conds[] = 'pr_level=' . $this->mDb->addQuotes( $this->level );
-               if( !is_null( $this->namespace ) )
+               }
+               if ( !is_null( $this->namespace ) ) {
                        $conds[] = 'page_namespace=' . $this->mDb->addQuotes( $this->namespace );
+               }
                return array(
                        'tables' => array( 'page_restrictions', 'page' ),
                        'fields' => array( 'pr_id', 'page_namespace', 'page_title', 'page_len',
index cf2b272..7b916cf 100644 (file)
@@ -77,12 +77,12 @@ class SpecialProtectedtitles extends SpecialPage {
 
                static $infinity = null;
 
-               if( is_null( $infinity ) ) {
+               if ( is_null( $infinity ) ) {
                        $infinity = wfGetDB( DB_SLAVE )->getInfinity();
                }
 
                $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
-               if( !$title ) {
+               if ( !$title ) {
                        wfProfileOut( __METHOD__ );
                        return Html::rawElement( 'li', array(),
                                Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
@@ -99,7 +99,7 @@ class SpecialProtectedtitles extends SpecialPage {
 
                $lang = $this->getLanguage();
                $expiry = strlen( $row->pt_expiry ) ? $lang->formatExpiry( $row->pt_expiry, TS_MW ) : $infinity;
-               if( $expiry != $infinity ) {
+               if ( $expiry != $infinity ) {
                        $user = $this->getUser();
                        $description_items[] = $this->msg(
                                'protect-expiring-local',
@@ -169,18 +169,18 @@ class SpecialProtectedtitles extends SpecialPage {
                $options = array();
 
                // First pass to load the log names
-               foreach( $wgRestrictionLevels as $type ) {
+               foreach ( $wgRestrictionLevels as $type ) {
                        if ( $type != '' && $type != '*' ) {
                                $text = $this->msg( "restriction-level-$type" )->text();
                                $m[$text] = $type;
                        }
                }
                // Is there only one level (aside from "all")?
-               if( count( $m ) <= 2 ) {
+               if ( count( $m ) <= 2 ) {
                        return '';
                }
                // Third pass generates sorted XHTML content
-               foreach( $m as $text => $type ) {
+               foreach ( $m as $text => $type ) {
                        $selected = ($type == $pr_level );
                        $options[] = Xml::option( $text, $type, $selected );
                }
@@ -244,10 +244,12 @@ class ProtectedTitlesPager extends AlphabeticPager {
        function getQueryInfo() {
                $conds = $this->mConds;
                $conds[] = 'pt_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() );
-               if( $this->level )
+               if ( $this->level ) {
                        $conds['pt_create_perm'] = $this->level;
-               if( !is_null( $this->namespace ) )
+               }
+               if ( !is_null( $this->namespace ) ) {
                        $conds[] = 'pt_namespace=' . $this->mDb->addQuotes( $this->namespace );
+               }
                return array(
                        'tables' => 'protected_titles',
                        'fields' => array( 'pt_namespace', 'pt_title', 'pt_create_perm',
index 2b25b78..dc4c1cd 100644 (file)
@@ -42,7 +42,7 @@ class RandomPage extends SpecialPage {
        }
 
        public function setNamespace( $ns ) {
-               if( !$ns || $ns < NS_MAIN ) {
+               if ( !$ns || $ns < NS_MAIN ) {
                        $ns = NS_MAIN;
                }
                $this->namespaces = array( $ns );
@@ -62,7 +62,7 @@ class RandomPage extends SpecialPage {
 
                $title = $this->getRandomTitle();
 
-               if( is_null( $title ) ) {
+               if ( is_null( $title ) ) {
                        $this->setHeaders();
                        $this->getOutput()->addWikiMsg( strtolower( $this->getName() ) . '-nopages',
                                $this->getNsList(), count( $this->namespaces ) );
@@ -83,8 +83,8 @@ class RandomPage extends SpecialPage {
        private function getNsList() {
                global $wgContLang;
                $nsNames = array();
-               foreach( $this->namespaces as $n ) {
-                       if( $n === NS_MAIN ) {
+               foreach ( $this->namespaces as $n ) {
+                       if ( $n === NS_MAIN ) {
                                $nsNames[] = $this->msg( 'blanknamespace' )->plain();
                        } else {
                                $nsNames[] = $wgContLang->getNsText( $n );
@@ -113,11 +113,11 @@ class RandomPage extends SpecialPage {
                 * any more bias than what the page_random scheme
                 * causes anyway.  Trust me, I'm a mathematician. :)
                 */
-               if( !$row ) {
+               if ( !$row ) {
                        $row = $this->selectRandomPageFromDB( "0" );
                }
 
-               if( $row ) {
+               if ( $row ) {
                        return Title::makeTitleSafe( $row->page_namespace, $row->page_title );
                } else {
                        return null;
index 6772cb5..c37f216 100644 (file)
@@ -73,14 +73,14 @@ class SpecialRecentChanges extends IncludableSpecialPage {
        public function setup( $parameters ) {
                $opts = $this->getDefaultOptions();
 
-               foreach( $this->getCustomFilters() as $key => $params ) {
+               foreach ( $this->getCustomFilters() as $key => $params ) {
                        $opts->add( $key, $params['default'] );
                }
 
                $opts->fetchValuesFromRequest( $this->getRequest() );
 
                // Give precedence to subpage syntax
-               if( $parameters !== null ) {
+               if ( $parameters !== null ) {
                        $this->parseParameters( $parameters, $opts );
                }
 
@@ -142,7 +142,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $this->getOutput()->setSquidMaxage( 10 );
                # Check if the client has a cached version
                $lastmod = $this->checkLastModified( $feedFormat );
-               if( $lastmod === false ) {
+               if ( $lastmod === false ) {
                        return;
                }
 
@@ -154,23 +154,23 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                // Fetch results, prepare a batch link existence check query
                $conds = $this->buildMainQueryConds( $opts );
                $rows = $this->doMainQuery( $conds, $opts );
-               if( $rows === false ) {
-                       if( !$this->including() ) {
+               if ( $rows === false ) {
+                       if ( !$this->including() ) {
                                $this->doHeader( $opts );
                        }
                        return;
                }
 
-               if( !$feedFormat ) {
+               if ( !$feedFormat ) {
                        $batch = new LinkBatch;
-                       foreach( $rows as $row ) {
+                       foreach ( $rows as $row ) {
                                $batch->add( NS_USER, $row->rc_user_text );
                                $batch->add( NS_USER_TALK, $row->rc_user_text );
                                $batch->add( $row->rc_namespace, $row->rc_title );
                        }
                        $batch->execute();
                }
-               if( $feedFormat ) {
+               if ( $feedFormat ) {
                        list( $changesFeed, $formatter ) = $this->getFeedObject( $feedFormat );
                        /** @var ChangesFeed $changesFeed */
                        $changesFeed->execute( $formatter, $rows, $lastmod, $opts );
@@ -206,44 +206,44 @@ class SpecialRecentChanges extends IncludableSpecialPage {
         */
        public function parseParameters( $par, FormOptions $opts ) {
                $bits = preg_split( '/\s*,\s*/', trim( $par ) );
-               foreach( $bits as $bit ) {
-                       if( 'hidebots' === $bit ) {
+               foreach ( $bits as $bit ) {
+                       if ( 'hidebots' === $bit ) {
                                $opts['hidebots'] = true;
                        }
-                       if( 'bots' === $bit ) {
+                       if ( 'bots' === $bit ) {
                                $opts['hidebots'] = false;
                        }
-                       if( 'hideminor' === $bit ) {
+                       if ( 'hideminor' === $bit ) {
                                $opts['hideminor'] = true;
                        }
-                       if( 'minor' === $bit ) {
+                       if ( 'minor' === $bit ) {
                                $opts['hideminor'] = false;
                        }
-                       if( 'hideliu' === $bit ) {
+                       if ( 'hideliu' === $bit ) {
                                $opts['hideliu'] = true;
                        }
-                       if( 'hidepatrolled' === $bit ) {
+                       if ( 'hidepatrolled' === $bit ) {
                                $opts['hidepatrolled'] = true;
                        }
-                       if( 'hideanons' === $bit ) {
+                       if ( 'hideanons' === $bit ) {
                                $opts['hideanons'] = true;
                        }
-                       if( 'hidemyself' === $bit ) {
+                       if ( 'hidemyself' === $bit ) {
                                $opts['hidemyself'] = true;
                        }
 
-                       if( is_numeric( $bit ) ) {
+                       if ( is_numeric( $bit ) ) {
                                $opts['limit'] = $bit;
                        }
 
                        $m = array();
-                       if( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
+                       if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
                                $opts['limit'] = $m[1];
                        }
-                       if( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
+                       if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
                                $opts['days'] = $m[1];
                        }
-                       if( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
+                       if ( preg_match( '/^namespace=(\d+)$/', $bit, $m ) ) {
                                $opts['namespace'] = $m[1];
                        }
                }
@@ -260,8 +260,8 @@ class SpecialRecentChanges extends IncludableSpecialPage {
        public function checkLastModified( $feedFormat ) {
                $dbr = wfGetDB( DB_SLAVE );
                $lastmod = $dbr->selectField( 'recentchanges', 'MAX(rc_timestamp)', false, __METHOD__ );
-               if( $feedFormat || !$this->getUser()->useRCPatrol() ) {
-                       if( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
+               if ( $feedFormat || !$this->getUser()->useRCPatrol() ) {
+                       if ( $lastmod && $this->getOutput()->checkLastModified( $lastmod ) ) {
                                # Client cache fresh and headers sent, nothing more to do.
                                return false;
                        }
@@ -282,9 +282,9 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                # It makes no sense to hide both anons and logged-in users
                # Where this occurs, force anons to be shown
                $forcebot = false;
-               if( $opts['hideanons'] && $opts['hideliu'] ) {
+               if ( $opts['hideanons'] && $opts['hideliu'] ) {
                        # Check if the user wants to show bots only
-                       if( $opts['hidebots'] ) {
+                       if ( $opts['hidebots'] ) {
                                $opts['hideanons'] = false;
                        } else {
                                $forcebot = true;
@@ -298,7 +298,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $cutoff = $dbr->timestamp( $cutoff_unixtime );
 
                $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
-               if( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
+               if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
                        $cutoff = $dbr->timestamp( $opts['from'] );
                } else {
                        $opts->reset( 'from' );
@@ -310,27 +310,27 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
                $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
 
-               if( $opts['hideminor'] ) {
+               if ( $opts['hideminor'] ) {
                        $conds['rc_minor'] = 0;
                }
-               if( $opts['hidebots'] ) {
+               if ( $opts['hidebots'] ) {
                        $conds['rc_bot'] = 0;
                }
-               if( $hidePatrol ) {
+               if ( $hidePatrol ) {
                        $conds['rc_patrolled'] = 0;
                }
-               if( $forcebot ) {
+               if ( $forcebot ) {
                        $conds['rc_bot'] = 1;
                }
-               if( $hideLoggedInUsers ) {
+               if ( $hideLoggedInUsers ) {
                        $conds[] = 'rc_user = 0';
                }
-               if( $hideAnonymousUsers ) {
+               if ( $hideAnonymousUsers ) {
                        $conds[] = 'rc_user != 0';
                }
 
-               if( $opts['hidemyself'] ) {
-                       if( $this->getUser()->getId() ) {
+               if ( $opts['hidemyself'] ) {
+                       if ( $this->getUser()->getId() ) {
                                $conds[] = 'rc_user != ' . $dbr->addQuotes( $this->getUser()->getId() );
                        } else {
                                $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $this->getUser()->getName() );
@@ -338,13 +338,13 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                }
 
                # Namespace filtering
-               if( $opts['namespace'] !== '' ) {
+               if ( $opts['namespace'] !== '' ) {
                        $selectedNS = $dbr->addQuotes( $opts['namespace'] );
                        $operator = $opts['invert'] ? '!='  : '=';
                        $boolean = $opts['invert'] ? 'AND' : 'OR';
 
                        # namespace association (bug 2429)
-                       if( !$opts['associated'] ) {
+                       if ( !$opts['associated'] ) {
                                $condition = "rc_namespace $operator $selectedNS";
                        } else {
                                # Also add the associated namespace
@@ -420,7 +420,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                // (b) We want pages in more than one namespace (inverted/associated)
                // (c) There is a tag to filter on (use tag index instead)
                // (d) UNION + sort/limit is not an option for the DBMS
-               if( $namespace === ''
+               if ( $namespace === ''
                        || ( $invert || $associated )
                        || $opts['tagfilter'] != ''
                        || !$dbr->unionSupportsOrderAndLimit() )
@@ -478,7 +478,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                $limit = $opts['limit'];
 
-               if( !$this->including() ) {
+               if ( !$this->including() ) {
                        // Output options box
                        $this->doHeader( $opts );
                }
@@ -491,7 +491,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                        $this->getOutput()->setFeedAppendQuery( false );
                }
 
-               if( $wgAllowCategorizedRecentChanges ) {
+               if ( $wgAllowCategorizedRecentChanges ) {
                        $this->filterByCategories( $rows, $opts );
                }
 
@@ -504,22 +504,22 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $list = ChangesList::newFromContext( $this->getContext() );
 
                $s = $list->beginRecentChangesList();
-               foreach( $rows as $obj ) {
-                       if( $limit == 0 ) {
+               foreach ( $rows as $obj ) {
+                       if ( $limit == 0 ) {
                                break;
                        }
                        $rc = RecentChange::newFromRow( $obj );
                        $rc->counter = $counter++;
                        # Check if the page has been updated since the last visit
-                       if( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
+                       if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
                                $rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
                        } else {
                                $rc->notificationtimestamp = false; // Default
                        }
                        # Check the number of users watching the page
                        $rc->numberofWatchingusers = 0; // Default
-                       if( $showWatcherCount && $obj->rc_namespace >= 0 ) {
-                               if( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
+                       if ( $showWatcherCount && $obj->rc_namespace >= 0 ) {
+                               if ( !isset( $watcherCache[$obj->rc_namespace][$obj->rc_title] ) ) {
                                        $watcherCache[$obj->rc_namespace][$obj->rc_title] =
                                                $dbr->selectField(
                                                        'watchlist',
@@ -594,13 +594,13 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $submit = ' ' . Xml::submitbutton( $this->msg( 'allpagessubmit' )->text() );
 
                $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
-               foreach( $extraOpts as $name => $optionRow ) {
+               foreach ( $extraOpts as $name => $optionRow ) {
                        # Add submit button to the last row only
                        ++$count;
                        $addSubmit = ( $count === $extraOptsCount ) ? $submit : '';
 
                        $out .= Xml::openElement( 'tr' );
-                       if( is_array( $optionRow ) ) {
+                       if ( is_array( $optionRow ) ) {
                                $out .= Xml::tags( 'td', array( 'class' => 'mw-label mw-' . $name . '-label' ), $optionRow[0] );
                                $out .= Xml::tags( 'td', array( 'class' => 'mw-input' ), $optionRow[1] . $addSubmit );
                        } else {
@@ -611,7 +611,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $out .= Xml::closeElement( 'table' );
 
                $unconsumed = $opts->getUnconsumedValues();
-               foreach( $unconsumed as $key => $value ) {
+               foreach ( $unconsumed as $key => $value ) {
                        $out .= Html::hidden( $key, $value );
                }
 
@@ -639,7 +639,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
 
                global $wgAllowCategorizedRecentChanges;
-               if( $wgAllowCategorizedRecentChanges ) {
+               if ( $wgAllowCategorizedRecentChanges ) {
                        $extraOpts['category'] = $this->categoryFilterForm( $opts );
                }
 
@@ -732,15 +732,15 @@ class SpecialRecentChanges extends IncludableSpecialPage {
        function filterByCategories( &$rows, FormOptions $opts ) {
                $categories = array_map( 'trim', explode( '|', $opts['categories'] ) );
 
-               if( !count( $categories ) ) {
+               if ( !count( $categories ) ) {
                        return;
                }
 
                # Filter categories
                $cats = array();
-               foreach( $categories as $cat ) {
+               foreach ( $categories as $cat ) {
                        $cat = trim( $cat );
-                       if( $cat == '' ) {
+                       if ( $cat == '' ) {
                                continue;
                        }
                        $cats[] = $cat;
@@ -750,16 +750,16 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                $articles = array();
                $a2r = array();
                $rowsarr = array();
-               foreach( $rows as $k => $r ) {
+               foreach ( $rows as $k => $r ) {
                        $nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
                        $id = $nt->getArticleID();
-                       if( $id == 0 ) {
+                       if ( $id == 0 ) {
                                continue; # Page might have been deleted...
                        }
-                       if( !in_array( $id, $articles ) ) {
+                       if ( !in_array( $id, $articles ) ) {
                                $articles[] = $id;
                        }
-                       if( !isset( $a2r[$id] ) ) {
+                       if ( !isset( $a2r[$id] ) ) {
                                $a2r[$id] = array();
                        }
                        $a2r[$id][] = $k;
@@ -767,7 +767,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                }
 
                # Shortcut?
-               if( !count( $articles ) || !count( $cats ) ) {
+               if ( !count( $articles ) || !count( $cats ) ) {
                        return;
                }
 
@@ -778,8 +778,8 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                # Filter
                $newrows = array();
-               foreach( $match as $id ) {
-                       foreach( $a2r[$id] as $rev ) {
+               foreach ( $match as $id ) {
+                       foreach ( $a2r[$id] as $rev ) {
                                $k = $rev;
                                $newrows[$k] = $rowsarr[$k];
                        }
@@ -829,13 +829,13 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                $note = '';
                $msg = $this->msg( 'rclegend' );
-               if( !$msg->isDisabled() ) {
+               if ( !$msg->isDisabled() ) {
                        $note .= '<div class="mw-rclegend">' . $msg->parse() . "</div>\n";
                }
 
                $lang = $this->getLanguage();
                $user = $this->getUser();
-               if( $options['from'] ) {
+               if ( $options['from'] ) {
                        $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
                                $lang->userTimeAndDate( $options['from'], $user ),
                                $lang->userDate( $options['from'], $user ),
@@ -852,7 +852,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                // limit links
                $cl = array();
-               foreach( $wgRCLinkLimits as $value ) {
+               foreach ( $wgRCLinkLimits as $value ) {
                        $cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
                                array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
                }
@@ -860,7 +860,7 @@ class SpecialRecentChanges extends IncludableSpecialPage {
 
                // day links, reset 'from' to none
                $dl = array();
-               foreach( $wgRCLinkDays as $value ) {
+               foreach ( $wgRCLinkDays as $value ) {
                        $dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
                                array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
                }
@@ -869,12 +869,12 @@ class SpecialRecentChanges extends IncludableSpecialPage {
                // show/hide links
                $showhide = array( $this->msg( 'show' )->text(), $this->msg( 'hide' )->text() );
                $filters = array(
-                       'hideminor'     => 'rcshowhideminor',
-                       'hidebots'      => 'rcshowhidebots',
-                       'hideanons'     => 'rcshowhideanons',
-                       'hideliu'       => 'rcshowhideliu',
+                       'hideminor' => 'rcshowhideminor',
+                       'hidebots' => 'rcshowhidebots',
+                       'hideanons' => 'rcshowhideanons',
+                       'hideliu' => 'rcshowhideliu',
                        'hidepatrolled' => 'rcshowhidepatr',
-                       'hidemyself'    => 'rcshowhidemine'
+                       'hidemyself' => 'rcshowhidemine'
                );
                foreach ( $this->getCustomFilters() as $key => $params ) {
                        $filters[$key] = $params['msg'];
index bdeb770..062e09d 100644 (file)
@@ -71,7 +71,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                }
                $outputPage = $this->getOutput();
                $title = Title::newFromURL( $target );
-               if( !$title || $title->getInterwiki() != '' ) {
+               if ( !$title || $title->getInterwiki() != '' ) {
                        $outputPage->wrapWikiMsg( "<div class=\"errorbox\">\n$1\n</div><br style=\"clear: both\" />", 'allpagesbadtitle' );
                        return false;
                }
@@ -99,7 +99,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
 
                // left join with watchlist table to highlight watched rows
                $uid = $this->getUser()->getId();
-               if( $uid ) {
+               if ( $uid ) {
                        $tables[] = 'watchlist';
                        $select[] = 'wl_user';
                        $join_conds['watchlist'] = array( 'LEFT JOIN', array(
@@ -126,7 +126,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                        return false;
                }
 
-               if( $ns == NS_CATEGORY && !$showlinkedto ) {
+               if ( $ns == NS_CATEGORY && !$showlinkedto ) {
                        // special handling for categories
                        // XXX: should try to make this less kludgy
                        $link_tables = array( 'categorylinks' );
@@ -135,12 +135,12 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                        // for now, always join on these tables; really should be configurable as in whatlinkshere
                        $link_tables = array( 'pagelinks', 'templatelinks' );
                        // imagelinks only contains links to pages in NS_FILE
-                       if( $ns == NS_FILE || !$showlinkedto ) {
+                       if ( $ns == NS_FILE || !$showlinkedto ) {
                                $link_tables[] = 'imagelinks';
                        }
                }
 
-               if( $id == 0 && !$showlinkedto ) {
+               if ( $id == 0 && !$showlinkedto ) {
                        return false; // nonexistent pages can't link to any pages
                }
 
@@ -149,22 +149,22 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
 
                $subsql = array(); // SELECT statements to combine with UNION
 
-               foreach( $link_tables as $link_table ) {
+               foreach ( $link_tables as $link_table ) {
                        $pfx = $prefix[$link_table];
 
                        // imagelinks and categorylinks tables have no xx_namespace field, and have xx_to instead of xx_title
-                       if( $link_table == 'imagelinks' ) {
+                       if ( $link_table == 'imagelinks' ) {
                                $link_ns = NS_FILE;
-                       } elseif( $link_table == 'categorylinks' ) {
+                       } elseif ( $link_table == 'categorylinks' ) {
                                $link_ns = NS_CATEGORY;
                        } else {
                                $link_ns = 0;
                        }
 
-                       if( $showlinkedto ) {
+                       if ( $showlinkedto ) {
                                // find changes to pages linking to this page
-                               if( $link_ns ) {
-                                       if( $ns != $link_ns ) {
+                               if ( $link_ns ) {
+                                       if ( $ns != $link_ns ) {
                                                continue;
                                        } // should never happen, but check anyway
                                        $subconds = array( "{$pfx}_to" => $dbkey );
@@ -175,7 +175,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                        } else {
                                // find changes to pages linked from this page
                                $subconds = array( "{$pfx}_from" => $id );
-                               if( $link_table == 'imagelinks' || $link_table == 'categorylinks' ) {
+                               if ( $link_table == 'imagelinks' || $link_table == 'categorylinks' ) {
                                        $subconds["rc_namespace"] = $link_ns;
                                        $subjoin = "rc_title = {$pfx}_to";
                                } else {
@@ -183,7 +183,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                                }
                        }
 
-                       if( $dbr->unionSupportsOrderAndLimit() ) {
+                       if ( $dbr->unionSupportsOrderAndLimit() ) {
                                $order = array( 'ORDER BY' => 'rc_timestamp DESC' );
                        } else {
                                $order = array();
@@ -198,16 +198,17 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
                                $join_conds + array( $link_table => array( 'INNER JOIN', $subjoin ) )
                        );
 
-                       if( $dbr->unionSupportsOrderAndLimit() )
+                       if ( $dbr->unionSupportsOrderAndLimit() ) {
                                $query = $dbr->limitResult( $query, $limit );
+                       }
 
                        $subsql[] = $query;
                }
 
-               if( count( $subsql ) == 0 ) {
+               if ( count( $subsql ) == 0 ) {
                        return false; // should never happen
                }
-               if( count( $subsql ) == 1 && $dbr->unionSupportsOrderAndLimit() ) {
+               if ( count( $subsql ) == 1 && $dbr->unionSupportsOrderAndLimit() ) {
                        $sql = $subsql[0];
                } else {
                        // need to resort and relimit after union
@@ -217,7 +218,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
 
                $res = $dbr->query( $sql, __METHOD__ );
 
-               if( $res->numRows() == 0 ) {
+               if ( $res->numRows() == 0 ) {
                        $this->mResultEmpty = true;
                }
 
@@ -260,13 +261,13 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges {
 
        function setTopText( FormOptions $opts ) {
                $target = $this->getTargetTitle();
-               if( $target ) {
+               if ( $target ) {
                        $this->getOutput()->addBacklinkSubtitle( $target );
                }
        }
 
        function setBottomText( FormOptions $opts ) {
-               if( isset( $this->mResultEmpty ) && $this->mResultEmpty ) {
+               if ( isset( $this->mResultEmpty ) && $this->mResultEmpty ) {
                        $this->getOutput()->addWikiMsg( 'recentchangeslinked-noresult' );
                }
        }
index 3a7399a..771132a 100644 (file)
@@ -76,7 +76,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        'list-class'    => 'RevDel_ArchiveList',
                        'permission'    => 'deleterevision',
                ),
-               'oldimage'=> array(
+               'oldimage' => array(
                        'check-label'   => 'revdelete-hide-image',
                        'deletion-bits' => File::DELETED_FILE,
                        'success'               => 'revdelete-success',
@@ -175,7 +175,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                }
 
                # No targets?
-               if( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) {
+               if ( !isset( self::$allowedTypes[$this->typeName] ) || count( $this->ids ) == 0 ) {
                        throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
                }
                $this->typeInfo = self::$allowedTypes[$this->typeName];
@@ -184,14 +184,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                # If we have revisions, get the title from the first one
                # since they should all be from the same page. This allows
                # for more flexibility with page moves...
-               if( $this->typeName == 'revision' ) {
+               if ( $this->typeName == 'revision' ) {
                        $rev = Revision::newFromId( $this->ids[0] );
                        $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj;
                }
 
                $this->otherReason = $request->getVal( 'wpReason' );
                # We need a target page!
-               if( is_null( $this->targetObj ) ) {
+               if ( is_null( $this->targetObj ) ) {
                        $output->addWikiMsg( 'undelete-header' );
                        return;
                }
@@ -204,13 +204,13 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        array( 'revdelete-hide-comment', 'wpHideComment', Revision::DELETED_COMMENT ),
                        array( 'revdelete-hide-user', 'wpHideUser', Revision::DELETED_USER )
                );
-               if( $user->isAllowed( 'suppressrevision' ) ) {
+               if ( $user->isAllowed( 'suppressrevision' ) ) {
                        $this->checks[] = array( 'revdelete-hide-restricted',
                                'wpHideRestricted', Revision::DELETED_RESTRICTED );
                }
 
                # Either submit or create our form
-               if( $this->mIsAllowed && $this->submitClicked ) {
+               if ( $this->mIsAllowed && $this->submitClicked ) {
                        $this->submit( $request );
                } else {
                        $this->showForm();
@@ -223,7 +223,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                LogEventsList::showLogExtract( $output, 'delete',
                        $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                # Show relevant lines from the suppression log
-               if( $user->isAllowed( 'suppressionlog' ) ) {
+               if ( $user->isAllowed( 'suppressionlog' ) ) {
                        $suppressLogPage = new LogPage( 'suppress' );
                        $output->addHTML( "<h2>" . $suppressLogPage->getName()->escaped() . "</h2>\n" );
                        LogEventsList::showLogExtract( $output, 'suppress',
@@ -236,7 +236,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         */
        protected function showConvenienceLinks() {
                # Give a link to the logs/hist for this page
-               if( $this->targetObj ) {
+               if ( $this->targetObj ) {
                        $links = array();
                        $links[] = Linker::linkKnown(
                                SpecialPage::getTitleFor( 'Log' ),
@@ -253,7 +253,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                        array( 'action' => 'history' )
                                );
                                # Link to deleted edits
-                               if( $this->getUser()->isAllowed( 'undelete' ) ) {
+                               if ( $this->getUser()->isAllowed( 'undelete' ) ) {
                                        $undelete = SpecialPage::getTitleFor( 'Undelete' );
                                        $links[] = Linker::linkKnown(
                                                $undelete,
@@ -296,8 +296,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        return;
                }
                $user = $this->getUser();
-               if( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
-                       if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
+               if ( !$oimage->userCan( File::DELETED_FILE, $user ) ) {
+                       if ( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
                                throw new PermissionsError( 'suppressrevision' );
                        } else {
                                throw new PermissionsError( 'deletedtext' );
@@ -370,7 +370,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                for ( $list->reset(); $list->current(); $list->next() ) {
                        $item = $list->current();
                        if ( !$item->canView() ) {
-                               if( !$this->submitClicked ) {
+                               if ( !$this->submitClicked ) {
                                        throw new PermissionsError( 'suppressrevision' );
                                }
                                $UserAllowed = false;
@@ -379,7 +379,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $this->getOutput()->addHTML( $item->getHTML() );
                }
 
-               if( !$numRevisions ) {
+               if ( !$numRevisions ) {
                        throw new ErrorPageError( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
                }
 
@@ -388,10 +388,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->addUsageText();
 
                // Normal sysops can always see what they did, but can't always change it
-               if( !$UserAllowed ) return;
+               if ( !$UserAllowed ) {
+                       return;
+               }
 
                // Show form if the user can submit
-               if( $this->mIsAllowed ) {
+               if ( $this->mIsAllowed ) {
                        $out = Xml::openElement( 'form', array( 'method' => 'post',
                                        'action' => $this->getTitle()->getLocalURL( array( 'action' => 'submit' ) ),
                                        'id' => 'mw-revdel-form-revisions' ) ) .
@@ -432,10 +434,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                } else {
                        $out = '';
                }
-               if( $this->mIsAllowed ) {
+               if ( $this->mIsAllowed ) {
                        $out .= Xml::closeElement( 'form' ) . "\n";
                        // Show link to edit the dropdown reasons
-                       if( $this->getUser()->isAllowed( 'editinterface' ) ) {
+                       if ( $this->getUser()->isAllowed( 'editinterface' ) ) {
                                $title = Title::makeTitle( NS_MEDIAWIKI, 'Revdelete-reason-dropdown' );
                                $link = Linker::link(
                                        $title,
@@ -455,10 +457,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         */
        protected function addUsageText() {
                $this->getOutput()->addWikiMsg( 'revdelete-text' );
-               if( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
+               if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
                        $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
                }
-               if( $this->mIsAllowed ) {
+               if ( $this->mIsAllowed ) {
                        $this->getOutput()->addWikiMsg( 'revdelete-confirm' );
                }
        }
@@ -470,17 +472,18 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $html = '<table>';
                // If there is just one item, use checkboxes
                $list = $this->getList();
-               if( $list->length() == 1 ) {
+               if ( $list->length() == 1 ) {
                        $list->reset();
                        $bitfield = $list->current()->getBits(); // existing field
-                       if( $this->submitClicked ) {
+                       if ( $this->submitClicked ) {
                                $bitfield = $this->extractBitfield( $this->extractBitParams(), $bitfield );
                        }
-                       foreach( $this->checks as $item ) {
+                       foreach ( $this->checks as $item ) {
                                list( $message, $name, $field ) = $item;
                                $innerHTML = Xml::checkLabel( $this->msg( $message )->text(), $name, $name, $bitfield & $field );
-                               if( $field == Revision::DELETED_RESTRICTED )
+                               if ( $field == Revision::DELETED_RESTRICTED ) {
                                        $innerHTML = "<b>$innerHTML</b>";
+                               }
                                $line = Xml::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
                                $html .= "<tr>$line</tr>\n";
                        }
@@ -491,10 +494,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
                        $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-set' )->escaped() . '</th>';
                        $html .= "<th></th></tr>\n";
-                       foreach( $this->checks as $item ) {
+                       foreach ( $this->checks as $item ) {
                                list( $message, $name, $field ) = $item;
                                // If there are several items, use third state by default...
-                               if( $this->submitClicked ) {
+                               if ( $this->submitClicked ) {
                                        $selected = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
                                } else {
                                        $selected = -1; // use existing field
@@ -503,7 +506,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 0, $selected == 0 ) . '</td>';
                                $line .= '<td class="mw-revdel-checkbox">' . Xml::radio( $name, 1, $selected == 1 ) . '</td>';
                                $label = $this->msg( $message )->escaped();
-                               if( $field == Revision::DELETED_RESTRICTED ) {
+                               if ( $field == Revision::DELETED_RESTRICTED ) {
                                        $label = "<b>$label</b>";
                                }
                                $line .= "<td>$label</td>";
@@ -523,21 +526,21 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        protected function submit() {
                # Check edit token on submission
                $token = $this->getRequest()->getVal( 'wpEditToken' );
-               if( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
+               if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
                        $this->getOutput()->addWikiMsg( 'sessionfailure' );
                        return false;
                }
                $bitParams = $this->extractBitParams();
                $listReason = $this->getRequest()->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
                $comment = $listReason;
-               if( $comment != 'other' && $this->otherReason != '' ) {
+               if ( $comment != 'other' && $this->otherReason != '' ) {
                        // Entry from drop down menu + additional comment
                        $comment .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->otherReason;
-               } elseif( $comment == 'other' ) {
+               } elseif ( $comment == 'other' ) {
                        $comment = $this->otherReason;
                }
                # Can the user set this field?
-               if( $bitParams[Revision::DELETED_RESTRICTED] == 1 && !$this->getUser()->isAllowed( 'suppressrevision' ) ) {
+               if ( $bitParams[Revision::DELETED_RESTRICTED] == 1 && !$this->getUser()->isAllowed( 'suppressrevision' ) ) {
                        throw new PermissionsError( 'suppressrevision' );
                }
                # If the save went through, go to success message...
@@ -578,15 +581,15 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         */
        protected function extractBitParams() {
                $bitfield = array();
-               foreach( $this->checks as $item ) {
+               foreach ( $this->checks as $item ) {
                        list( /* message */, $name, $field ) = $item;
                        $val = $this->getRequest()->getInt( $name, 0 /* unchecked */ );
-                       if( $val < -1 || $val > 1 ) {
+                       if ( $val < -1 || $val > 1 ) {
                                $val = -1; // -1 for existing value
                        }
                        $bitfield[$field] = $val;
                }
-               if( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
+               if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
                        $bitfield[Revision::DELETED_RESTRICTED] = 0;
                }
                return $bitfield;
@@ -601,10 +604,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        public static function extractBitfield( $bitPars, $oldfield ) {
                // Build the actual new rev_deleted bitfield
                $newBits = 0;
-               foreach( $bitPars as $const => $val ) {
-                       if( $val == 1 ) {
+               foreach ( $bitPars as $const => $val ) {
+                       if ( $val == 1 ) {
                                $newBits |= $const; // $const is the *_deleted const
-                       } elseif( $val == -1 ) {
+                       } elseif ( $val == -1 ) {
                                $newBits |= ($oldfield & $const); // use existing
                        }
                }
index 644a575..94995db 100644 (file)
@@ -137,7 +137,7 @@ class SpecialSearch extends SpecialPage {
                if ( $profile === null ) {
                        // BC with old request format
                        $profile = 'advanced';
-                       foreach( $profiles as $key => $data ) {
+                       foreach ( $profiles as $key => $data ) {
                                if ( $nslist === $data['namespaces'] && $key !== 'advanced' ) {
                                        $profile = $key;
                                }
@@ -173,7 +173,7 @@ class SpecialSearch extends SpecialPage {
                # Try to go to page as entered.
                $t = Title::newFromText( $term );
                # If the string cannot be used to create a title
-               if( is_null( $t ) ) {
+               if ( is_null( $t ) ) {
                        $this->showResults( $term );
                        return;
                }
@@ -185,19 +185,19 @@ class SpecialSearch extends SpecialPage {
                        return;
                }
 
-               if( !is_null( $t ) ) {
+               if ( !is_null( $t ) ) {
                        $this->getOutput()->redirect( $t->getFullURL() );
                        return;
                }
                # No match, generate an edit URL
                $t = Title::newFromText( $term );
-               if( !is_null( $t ) ) {
+               if ( !is_null( $t ) ) {
                        global $wgGoToEdit;
                        wfRunHooks( 'SpecialSearchNogomatch', array( &$t ) );
                        wfDebugLog( 'nogomatch', $t->getText(), false );
 
                        # If the feature is enabled, go straight to the edit page
-                       if( $wgGoToEdit ) {
+                       if ( $wgGoToEdit ) {
                                $this->getOutput()->redirect( $t->getFullURL( array( 'action' => 'edit' ) ) );
                                return;
                        }
@@ -253,24 +253,24 @@ class SpecialSearch extends SpecialPage {
                $rewritten = $search->replacePrefixes( $term );
 
                $titleMatches = $search->searchTitle( $rewritten );
-               if( !( $titleMatches instanceof SearchResultTooMany ) ) {
+               if ( !( $titleMatches instanceof SearchResultTooMany ) ) {
                        $textMatches = $search->searchText( $rewritten );
                }
 
                $textStatus = null;
-               if( $textMatches instanceof Status ) {
+               if ( $textMatches instanceof Status ) {
                        $textStatus = $textMatches;
                        $textMatches = null;
                }
 
                // did you mean... suggestions
-               if( $textMatches && !$textStatus && $textMatches->hasSuggestion() ) {
+               if ( $textMatches && !$textStatus && $textMatches->hasSuggestion() ) {
                        $st = SpecialPage::getTitleFor( 'Search' );
 
                        # mirror Go/Search behavior of original request ..
                        $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() );
 
-                       if( $this->fulltext != null ) {
+                       if ( $this->fulltext != null ) {
                                $didYouMeanParams['fulltext'] = $this->fulltext;
                        }
 
@@ -281,7 +281,7 @@ class SpecialSearch extends SpecialPage {
 
                        $suggestionSnippet = $textMatches->getSuggestionSnippet();
 
-                       if( $suggestionSnippet == '' ) {
+                       if ( $suggestionSnippet == '' ) {
                                $suggestionSnippet = null;
                        }
 
@@ -323,14 +323,14 @@ class SpecialSearch extends SpecialPage {
                );
 
                // Sometimes the search engine knows there are too many hits
-               if( $titleMatches instanceof SearchResultTooMany ) {
+               if ( $titleMatches instanceof SearchResultTooMany ) {
                        $out->wrapWikiMsg( "==$1==\n", 'toomanymatches' );
                        wfProfileOut( __METHOD__ );
                        return;
                }
 
                $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':';
-               if( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
+               if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
                        $out->addHTML( $this->formHeader( $term, 0, 0 ) );
                        $out->addHtml( $this->getProfileForm( $this->profile, $term ) );
                        $out->addHTML( '</form>' );
@@ -353,10 +353,12 @@ class SpecialSearch extends SpecialPage {
 
                // get total number of results if backend can calculate it
                $totalRes = 0;
-               if( $titleMatches && !is_null( $titleMatches->getTotalHits() ) )
+               if ( $titleMatches && !is_null( $titleMatches->getTotalHits() ) ) {
                        $totalRes += $titleMatches->getTotalHits();
-               if( $textMatches && !is_null( $textMatches->getTotalHits() ) )
+               }
+               if ( $textMatches && !is_null( $textMatches->getTotalHits() ) ) {
                        $totalRes += $textMatches->getTotalHits();
+               }
 
                // show number of results and current offset
                $out->addHTML( $this->formHeader( $term, $num, $totalRes ) );
@@ -366,7 +368,7 @@ class SpecialSearch extends SpecialPage {
                $out->addHtml( "<div class='searchresults'>" );
 
                // prev/next links
-               if( $num || $this->offset ) {
+               if ( $num || $this->offset ) {
                        // Show the create link ahead
                        $this->showCreateLink( $t );
                        $prevnext = $this->getLanguage()->viewPrevNext( $this->getTitle(), $this->offset, $this->limit,
@@ -380,34 +382,34 @@ class SpecialSearch extends SpecialPage {
                }
 
                $out->parserOptions()->setEditSection( false );
-               if( $titleMatches ) {
-                       if( $numTitleMatches > 0 ) {
+               if ( $titleMatches ) {
+                       if ( $numTitleMatches > 0 ) {
                                $out->wrapWikiMsg( "==$1==\n", 'titlematches' );
                                $out->addHTML( $this->showMatches( $titleMatches ) );
                        }
                        $titleMatches->free();
                }
-               if( $textMatches && !$textStatus ) {
+               if ( $textMatches && !$textStatus ) {
                        // output appropriate heading
-                       if( $numTextMatches > 0 && $numTitleMatches > 0 ) {
+                       if ( $numTextMatches > 0 && $numTitleMatches > 0 ) {
                                // if no title matches the heading is redundant
                                $out->wrapWikiMsg( "==$1==\n", 'textmatches' );
-                       } elseif( $totalRes == 0 ) {
+                       } elseif ( $totalRes == 0 ) {
                                # Don't show the 'no text matches' if we received title matches
                                # $out->wrapWikiMsg( "==$1==\n", 'notextmatches' );
                        }
                        // show interwiki results if any
-                       if( $textMatches->hasInterwikiResults() ) {
+                       if ( $textMatches->hasInterwikiResults() ) {
                                $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(), $term ) );
                        }
                        // show results
-                       if( $numTextMatches > 0 ) {
+                       if ( $numTextMatches > 0 ) {
                                $out->addHTML( $this->showMatches( $textMatches ) );
                        }
 
                        $textMatches->free();
                }
-               if( $num === 0 ) {
+               if ( $num === 0 ) {
                        if ( $textStatus ) {
                                $out->addHTML( '<div class="error">' .
                                        htmlspecialchars( $textStatus->getWikiText( 'search-error' ) ) . '</div>' );
@@ -419,7 +421,7 @@ class SpecialSearch extends SpecialPage {
                }
                $out->addHtml( "</div>" );
 
-               if( $num || $this->offset ) {
+               if ( $num || $this->offset ) {
                        $out->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
                }
                wfRunHooks( 'SpecialSearchResultsAppend', array( $this, $out, $term ) );
@@ -433,16 +435,16 @@ class SpecialSearch extends SpecialPage {
                // show direct page/create link if applicable
 
                // Check DBkey !== '' in case of fragment link only.
-               if( is_null( $t ) || $t->getDBkey() === '' ) {
+               if ( is_null( $t ) || $t->getDBkey() === '' ) {
                        // invalid title
                        // preserve the paragraph for margins etc...
                        $this->getOutput()->addHtml( '<p></p>' );
                        return;
                }
 
-               if( $t->isKnown() ) {
+               if ( $t->isKnown() ) {
                        $messageName = 'searchmenu-exists';
-               } elseif( $t->userCan( 'create', $this->getUser() ) ) {
+               } elseif ( $t->userCan( 'create', $this->getUser() ) ) {
                        $messageName = 'searchmenu-new';
                } else {
                        $messageName = 'searchmenu-new-nocreate';
@@ -451,7 +453,7 @@ class SpecialSearch extends SpecialPage {
                wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) );
 
                // Extensions using the hook might still return an empty $messageName
-               if( $messageName ) {
+               if ( $messageName ) {
                        $this->getOutput()->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", $params );
                } else {
                        // preserve the paragraph for margins etc...
@@ -464,9 +466,9 @@ class SpecialSearch extends SpecialPage {
         */
        protected function setupPage( $term ) {
                # Should advanced UI be used?
-               $this->searchAdvanced = ($this->profile === 'advanced');
+               $this->searchAdvanced = ( $this->profile === 'advanced' );
                $out = $this->getOutput();
-               if( strval( $term ) !== '' ) {
+               if ( strval( $term ) !== '' ) {
                        $out->setPageTitle( $this->msg( 'searchresults' ) );
                        $out->setHTMLTitle( $this->msg( 'pagetitle' )->rawParams(
                                $this->msg( 'searchresults-title' )->rawParams( $term )->text()
@@ -485,8 +487,8 @@ class SpecialSearch extends SpecialPage {
         */
        protected function powerSearch( &$request ) {
                $arr = array();
-               foreach( SearchEngine::searchableNamespaces() as $ns => $name ) {
-                       if( $request->getCheck( 'ns' . $ns ) ) {
+               foreach ( SearchEngine::searchableNamespaces() as $ns => $name ) {
+                       if ( $request->getCheck( 'ns' . $ns ) ) {
                                $arr[] = $ns;
                        }
                }
@@ -502,10 +504,10 @@ class SpecialSearch extends SpecialPage {
        protected function powerSearchOptions() {
                $opt = array();
                $opt['redirs'] = $this->searchRedirects ? 1 : 0;
-               if( $this->profile !== 'advanced' ) {
+               if ( $this->profile !== 'advanced' ) {
                        $opt['profile'] = $this->profile;
                } else {
-                       foreach( $this->namespaces as $n ) {
+                       foreach ( $this->namespaces as $n ) {
                                $opt['ns' . $n] = 1;
                        }
                }
@@ -527,12 +529,12 @@ class SpecialSearch extends SpecialPage {
 
                $out = "";
                $infoLine = $matches->getInfo();
-               if( !is_null( $infoLine ) ) {
+               if ( !is_null( $infoLine ) ) {
                        $out .= "\n<!-- {$infoLine} -->\n";
                }
                $out .= "<ul class='mw-search-results'>\n";
                $result = $matches->next();
-               while( $result ) {
+               while ( $result ) {
                        $out .= $this->showHit( $result, $terms );
                        $result = $matches->next();
                }
@@ -555,7 +557,7 @@ class SpecialSearch extends SpecialPage {
        protected function showHit( $result, $terms ) {
                wfProfileIn( __METHOD__ );
 
-               if( $result->isBrokenTitle() ) {
+               if ( $result->isBrokenTitle() ) {
                        wfProfileOut( __METHOD__ );
                        return "<!-- Broken link in search result -->\n";
                }
@@ -564,8 +566,9 @@ class SpecialSearch extends SpecialPage {
 
                $titleSnippet = $result->getTitleSnippet( $terms );
 
-               if( $titleSnippet == '' )
+               if ( $titleSnippet == '' ) {
                        $titleSnippet = null;
+               }
 
                $link_t = clone $t;
 
@@ -580,7 +583,7 @@ class SpecialSearch extends SpecialPage {
                //If page content is not readable, just return the title.
                //This is not quite safe, but better than showing excerpts from non-readable pages
                //Note that hiding the entry entirely would screw up paging.
-               if( !$t->userCan( 'read', $this->getUser() ) ) {
+               if ( !$t->userCan( 'read', $this->getUser() ) ) {
                        wfProfileOut( __METHOD__ );
                        return "<li>{$link}</li>\n";
                }
@@ -588,7 +591,7 @@ class SpecialSearch extends SpecialPage {
                // If the page doesn't *exist*... our search index is out of date.
                // The least confusing at this point is to drop the result.
                // You may get less results, but... oh well. :P
-               if( $result->isMissingRevision() ) {
+               if ( $result->isMissingRevision() ) {
                        wfProfileOut( __METHOD__ );
                        return "<!-- missing page " . htmlspecialchars( $t->getPrefixedText() ) . "-->\n";
                }
@@ -600,9 +603,10 @@ class SpecialSearch extends SpecialPage {
                $sectionText = $result->getSectionSnippet( $terms );
                $redirect = '';
 
-               if( !is_null( $redirectTitle ) ) {
-                       if( $redirectText == '' )
+               if ( !is_null( $redirectTitle ) ) {
+                       if ( $redirectText == '' ) {
                                $redirectText = null;
+                       }
 
                        $redirect = "<span class='searchalttitle'>" .
                                $this->msg( 'search-redirect' )->rawParams(
@@ -612,9 +616,10 @@ class SpecialSearch extends SpecialPage {
 
                $section = '';
 
-               if( !is_null( $sectionTitle ) ) {
-                       if( $sectionText == '' )
+               if ( !is_null( $sectionTitle ) ) {
+                       if ( $sectionText == '' ) {
                                $sectionText = null;
+                       }
 
                        $section = "<span class='searchalttitle'>" .
                                $this->msg( 'search-section' )->rawParams(
@@ -628,7 +633,7 @@ class SpecialSearch extends SpecialPage {
                $lang = $this->getLanguage();
 
                // format score
-               if( is_null( $result->getScore() ) ) {
+               if ( is_null( $result->getScore() ) ) {
                        // Search engine doesn't report scoring info
                        $score = '';
                } else {
@@ -644,7 +649,7 @@ class SpecialSearch extends SpecialPage {
                $size = $this->msg( 'search-result-size', $lang->formatSize( $byteSize ) )
                        ->numParams( $wordCount )->escaped();
 
-               if( $t->getNamespace() == NS_CATEGORY ) {
+               if ( $t->getNamespace() == NS_CATEGORY ) {
                        $cat = Category::newFromTitle( $t );
                        $size = $this->msg( 'search-result-category-size' )
                                ->numParams( $cat->getPageCount(), $cat->getSubcatCount(), $cat->getFileCount() )
@@ -655,7 +660,7 @@ class SpecialSearch extends SpecialPage {
 
                // link to related articles if supported
                $related = '';
-               if( $result->hasRelated() ) {
+               if ( $result->hasRelated() ) {
                        $st = SpecialPage::getTitleFor( 'Search' );
                        $stParams = array_merge(
                                $this->powerSearchOptions(),
@@ -675,11 +680,11 @@ class SpecialSearch extends SpecialPage {
                }
 
                // Include a thumbnail for media files...
-               if( $t->getNamespace() == NS_FILE ) {
+               if ( $t->getNamespace() == NS_FILE ) {
                        $img = wfFindFile( $t );
-                       if( $img ) {
+                       if ( $img ) {
                                $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) );
-                               if( $thumb ) {
+                               if ( $thumb ) {
                                        $desc = $this->msg( 'parentheses' )->rawParams( $img->getShortDesc() )->escaped();
                                        wfProfileOut( __METHOD__ );
                                        // Float doesn't seem to interact well with the bullets.
@@ -740,16 +745,16 @@ class SpecialSearch extends SpecialPage {
                // work out custom project captions
                $customCaptions = array();
                $customLines = explode( "\n", $this->msg( 'search-interwiki-custom' )->text() ); // format per line <iwprefix>:<caption>
-               foreach( $customLines as $line ) {
+               foreach ( $customLines as $line ) {
                        $parts = explode( ":", $line, 2 );
-                       if( count( $parts ) == 2 ) { // validate line
+                       if ( count( $parts ) == 2 ) { // validate line
                                $customCaptions[$parts[0]] = $parts[1];
                        }
                }
 
                $prev = null;
                $result = $matches->next();
-               while( $result ) {
+               while ( $result ) {
                        $out .= $this->showInterwikiHit( $result, $prev, $terms, $query, $customCaptions );
                        $prev = $result->getInterwikiPrefix();
                        $result = $matches->next();
@@ -774,10 +779,10 @@ class SpecialSearch extends SpecialPage {
         *
         * @return string
         */
-       protected function showInterwikiHit( $result, $lastInterwiki, $terms, $query, $customCaptions) {
+       protected function showInterwikiHit( $result, $lastInterwiki, $terms, $query, $customCaptions ) {
                wfProfileIn( __METHOD__ );
 
-               if( $result->isBrokenTitle() ) {
+               if ( $result->isBrokenTitle() ) {
                        wfProfileOut( __METHOD__ );
                        return "<!-- Broken link in search result -->\n";
                }
@@ -786,8 +791,9 @@ class SpecialSearch extends SpecialPage {
 
                $titleSnippet = $result->getTitleSnippet( $terms );
 
-               if( $titleSnippet == '' )
+               if ( $titleSnippet == '' ) {
                        $titleSnippet = null;
+               }
 
                $link = Linker::linkKnown(
                        $t,
@@ -798,9 +804,10 @@ class SpecialSearch extends SpecialPage {
                $redirectTitle = $result->getRedirectTitle();
                $redirectText = $result->getRedirectSnippet( $terms );
                $redirect = '';
-               if( !is_null( $redirectTitle ) ) {
-                       if( $redirectText == '' )
+               if ( !is_null( $redirectTitle ) ) {
+                       if ( $redirectText == '' ) {
                                $redirectText = null;
+                       }
 
                        $redirect = "<span class='searchalttitle'>" .
                                $this->msg( 'search-redirect' )->rawParams(
@@ -810,8 +817,8 @@ class SpecialSearch extends SpecialPage {
 
                $out = "";
                // display project name
-               if( is_null( $lastInterwiki ) || $lastInterwiki != $t->getInterwiki() ) {
-                       if( array_key_exists( $t->getInterwiki(), $customCaptions ) ) {
+               if ( is_null( $lastInterwiki ) || $lastInterwiki != $t->getInterwiki() ) {
+                       if ( array_key_exists( $t->getInterwiki(), $customCaptions ) ) {
                                // captions from 'search-interwiki-custom'
                                $caption = $customCaptions[$t->getInterwiki()];
                        } else {
@@ -870,13 +877,13 @@ class SpecialSearch extends SpecialPage {
        protected function powerSearchBox( $term, $opts ) {
                // Groups namespaces into rows according to subject
                $rows = array();
-               foreach( SearchEngine::searchableNamespaces() as $namespace => $name ) {
+               foreach ( SearchEngine::searchableNamespaces() as $namespace => $name ) {
                        $subject = MWNamespace::getSubject( $namespace );
-                       if( !array_key_exists( $subject, $rows ) ) {
+                       if ( !array_key_exists( $subject, $rows ) ) {
                                $rows[$subject] = "";
                        }
                        $name = str_replace( '_', ' ', $name );
-                       if( $name == '' ) {
+                       if ( $name == '' ) {
                                $name = $this->msg( 'blanknamespace' )->text();
                        }
                        $rows[$subject] .=
@@ -897,12 +904,12 @@ class SpecialSearch extends SpecialPage {
                // Lays out namespaces in multiple floating two-column tables so they'll
                // be arranged nicely while still accommodating different screen widths
                $namespaceTables = '';
-               for( $i = 0; $i < $numRows; $i += 4 ) {
+               for ( $i = 0; $i < $numRows; $i += 4 ) {
                        $namespaceTables .= Xml::openElement(
                                'table',
                                array( 'cellpadding' => 0, 'cellspacing' => 0 )
                        );
-                       for( $j = $i; $j < $i + 4 && $j < $numRows; $j++ ) {
+                       for ( $j = $i; $j < $i + 4 && $j < $numRows; $j++ ) {
                                $namespaceTables .= Xml::tags( 'tr', null, $rows[$j] );
                        }
                        $namespaceTables .= Xml::closeElement( 'table' );
@@ -911,7 +918,7 @@ class SpecialSearch extends SpecialPage {
                $showSections = array( 'namespaceTables' => $namespaceTables );
 
                // Show redirects check only if backend supports it
-               if( $this->getSearchEngine()->supports( 'list-redirects' ) ) {
+               if ( $this->getSearchEngine()->supports( 'list-redirects' ) ) {
                        $showSections['redirects'] =
                                Xml::checkLabel( $this->msg( 'powersearch-redir' )->text(), 'redirs', 'redirs', $this->searchRedirects );
                }
@@ -920,7 +927,7 @@ class SpecialSearch extends SpecialPage {
 
                $hidden = '';
                unset( $opts['redirs'] );
-               foreach( $opts as $key => $value ) {
+               foreach ( $opts as $key => $value ) {
                        $hidden .= Html::hidden( $key, $value );
                }
                // Return final output
@@ -980,8 +987,10 @@ class SpecialSearch extends SpecialPage {
 
                wfRunHooks( 'SpecialSearchProfiles', array( &$profiles ) );
 
-               foreach( $profiles as &$data ) {
-                       if ( !is_array( $data['namespaces'] ) ) continue;
+               foreach ( $profiles as &$data ) {
+                       if ( !is_array( $data['namespaces'] ) ) {
+                               continue;
+                       }
                        sort( $data['namespaces'] );
                }
 
@@ -998,7 +1007,7 @@ class SpecialSearch extends SpecialPage {
                $out = Xml::openElement( 'div', array( 'class' => 'mw-search-formheader' ) );
 
                $bareterm = $term;
-               if( $this->startsWithImage( $term ) ) {
+               if ( $this->startsWithImage( $term ) ) {
                        // Deletes prefixes
                        $bareterm = substr( $term, strpos( $term, ':' ) + 1 );
                }
@@ -1092,7 +1101,7 @@ class SpecialSearch extends SpecialPage {
         */
        protected function makeSearchLink( $term, $namespaces, $label, $tooltip, $params = array() ) {
                $opt = $params;
-               foreach( $namespaces as $n ) {
+               foreach ( $namespaces as $n ) {
                        $opt['ns' . $n] = 1;
                }
                $opt['redirs'] = $this->searchRedirects;
@@ -1125,7 +1134,7 @@ class SpecialSearch extends SpecialPage {
                global $wgContLang;
 
                $p = explode( ':', $term );
-               if( count( $p ) > 1 ) {
+               if ( count( $p ) > 1 ) {
                        return $wgContLang->getNsIndex( $p[0] ) == NS_FILE;
                }
                return false;
@@ -1142,7 +1151,7 @@ class SpecialSearch extends SpecialPage {
                $allkeyword = $this->msg( 'searchall' )->inContentLanguage()->text();
 
                $p = explode( ':', $term );
-               if( count( $p ) > 1 ) {
+               if ( count( $p ) > 1 ) {
                        return $p[0] == $allkeyword;
                }
                return false;
index 3901074..47c89d0 100644 (file)
@@ -53,7 +53,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
 
                $pages = SpecialPageFactory::getUsablePages( $this->getUser() );
 
-               if( !count( $pages ) ) {
+               if ( !count( $pages ) ) {
                        # Yeah, that was pointless. Thanks for coming.
                        return false;
                }
@@ -64,7 +64,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                foreach ( $pages as $page ) {
                        if ( $page->isListed() ) {
                                $group = $page->getFinalGroupName();
-                               if( !isset( $groups[$group] ) ) {
+                               if ( !isset( $groups[$group] ) ) {
                                        $groups[$group] = array();
                                }
                                $groups[$group][$page->getDescription()] = array(
@@ -77,13 +77,13 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
 
                /** Sort */
                if ( $wgSortSpecialPages ) {
-                       foreach( $groups as $group => $sortedPages ) {
+                       foreach ( $groups as $group => $sortedPages ) {
                                ksort( $groups[$group] );
                        }
                }
 
                /** Always move "other" to end */
-               if( array_key_exists( 'other', $groups ) ) {
+               if ( array_key_exists( 'other', $groups ) ) {
                        $other = $groups['other'];
                        unset( $groups['other'] );
                        $groups['other'] = $other;
@@ -110,7 +110,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                                Html::openElement( 'td', array( 'style' => 'width:30%;vertical-align:top' ) ) . "\n" .
                                Html::openElement( 'ul' ) . "\n"
                        );
-                       foreach( $sortedPages as $desc => $specialpage ) {
+                       foreach ( $sortedPages as $desc => $specialpage ) {
                                list( $title, $restricted, $cached ) = $specialpage;
 
                                $pageClasses = array();
@@ -118,7 +118,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
                                        $includesCachedPages = true;
                                        $pageClasses[] = 'mw-specialpagecached';
                                }
-                               if( $restricted ) {
+                               if ( $restricted ) {
                                        $includesRestrictedPages = true;
                                        $pageClasses[] = 'mw-specialpagerestricted';
                                }
@@ -128,7 +128,7 @@ class SpecialSpecialpages extends UnlistedSpecialPage {
 
                                # Split up the larger groups
                                $count++;
-                               if( $total > 3 && $count == $middle ) {
+                               if ( $total > 3 && $count == $middle ) {
                                        $out->addHTML(
                                                Html::closeElement( 'ul' ) . Html::closeElement( 'td' ) .
                                                Html::element( 'td', array( 'style' => 'width:10%' ), '' ) .
index a362fa2..2ec955e 100644 (file)
@@ -53,15 +53,15 @@ class SpecialStatistics extends SpecialPage {
 
                # Staticic - views
                $viewsStats = '';
-               if( !$wgDisableCounters ) {
+               if ( !$wgDisableCounters ) {
                        $viewsStats = $this->getViewsStats();
                }
 
                # Set active user count
-               if( !$wgMiserMode ) {
+               if ( !$wgMiserMode ) {
                        $key = wfMemcKey( 'sitestats', 'activeusers-updated' );
                        // Re-calculate the count if the last tally is old...
-                       if( !$wgMemc->get( $key ) ) {
+                       if ( !$wgMemc->get( $key ) ) {
                                $dbw = wfGetDB( DB_MASTER );
                                SiteStatsUpdate::cacheUpdate( $dbw );
                                $wgMemc->set( $key, '1', 24 * 3600 ); // don't update for 1 day
@@ -84,13 +84,13 @@ class SpecialStatistics extends SpecialPage {
                $text .= $viewsStats;
 
                # Statistic - popular pages
-               if( !$wgDisableCounters && !$wgMiserMode ) {
+               if ( !$wgDisableCounters && !$wgMiserMode ) {
                        $text .= $this->getMostViewedPages();
                }
 
                # Statistic - other
                $extraStats = array();
-               if( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
+               if ( wfRunHooks( 'SpecialStatsAddExtra', array( &$extraStats ) ) ) {
                        $text .= $this->getOtherStats( $extraStats );
                }
 
@@ -115,11 +115,11 @@ class SpecialStatistics extends SpecialPage {
         * @return string table row in HTML format
         */
        private function formatRow( $text, $number, $trExtraParams = array(), $descMsg = '', $descMsgParam = '' ) {
-               if( $descMsg ) {
+               if ( $descMsg ) {
                        $msg = $this->msg( $descMsg, $descMsgParam );
                        if ( $msg->exists() ) {
                                $descriptionText = $this->msg( 'parentheses' )->rawParams( $msg->parse() )->escaped();
-                               $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc'),
+                               $text .= "<br />" . Xml::element( 'small', array( 'class' => 'mw-statistic-desc' ),
                                        " $descriptionText" );
                        }
                }
@@ -181,7 +181,7 @@ class SpecialStatistics extends SpecialPage {
        private function getGroupStats() {
                global $wgGroupPermissions, $wgImplicitGroups;
                $text = '';
-               foreach( $wgGroupPermissions as $group => $permissions ) {
+               foreach ( $wgGroupPermissions as $group => $permissions ) {
                        # Skip generic * and implicit groups
                        if ( in_array( $group, $wgImplicitGroups ) || $group == '*' ) {
                                continue;
@@ -213,7 +213,7 @@ class SpecialStatistics extends SpecialPage {
                        # Add a class when a usergroup contains no members to allow hiding these rows
                        $classZero = '';
                        $countUsers = SiteStats::numberingroup( $groupname );
-                       if( $countUsers == 0 ) {
+                       if ( $countUsers == 0 ) {
                                $classZero = ' statistics-group-zero';
                        }
                        $text .= $this->formatRow( $grouppage . ' ' . $grouplink,
@@ -256,13 +256,13 @@ class SpecialStatistics extends SpecialPage {
                                        'LIMIT' => 10,
                                )
                        );
-                       if( $res->numRows() > 0 ) {
+                       if ( $res->numRows() > 0 ) {
                                $text .= Xml::openElement( 'tr' );
                                $text .= Xml::tags( 'th', array( 'colspan' => '2' ), $this->msg( 'statistics-mostpopular' )->parse() );
                                $text .= Xml::closeElement( 'tr' );
                                foreach ( $res as $row ) {
                                        $title = Title::makeTitleSafe( $row->page_namespace, $row->page_title );
-                                       if( $title instanceof Title ) {
+                                       if ( $title instanceof Title ) {
                                                $text .= $this->formatRow( Linker::link( $title ),
                                                                $this->getLanguage()->formatNum( $row->page_counter ) );
 
@@ -283,8 +283,7 @@ class SpecialStatistics extends SpecialPage {
        private function getOtherStats( array $stats ) {
                $return = '';
 
-               foreach( $stats as $header => $items ) {
-
+               foreach ( $stats as $header => $items ) {
                        // Identify the structure used
                        if ( is_array( $items ) ) {
 
@@ -294,7 +293,7 @@ class SpecialStatistics extends SpecialPage {
                                }
 
                                // Collect all items that belong to the same header
-                               foreach( $items as $key => $value ) {
+                               foreach ( $items as $key => $value ) {
                                        $name = $this->msg( $key )->inContentLanguage()->parse();
                                        $number = htmlspecialchars( $value );
 
index 026b936..d87f263 100644 (file)
@@ -54,7 +54,7 @@ class SpecialTags extends SpecialPage {
                        $html .= $this->doTagRow( $row->ct_tag, $row->hitcount );
                }
 
-               foreach( ChangeTags::listDefinedTags() as $tag ) {
+               foreach ( ChangeTags::listDefinedTags() as $tag ) {
                        $html .= $this->doTagRow( $tag, 0 );
                }
 
index 7b3ae6b..b2b2946 100644 (file)
@@ -56,7 +56,7 @@ class SpecialUnblock extends SpecialPage {
                $form->setSubmitTextMsg( 'ipusubmit' );
                $form->addPreText( $this->msg( 'unblockiptext' )->parseAsBlock() );
 
-               if( $form->show() ) {
+               if ( $form->show() ) {
                        switch( $this->type ) {
                                case Block::TYPE_USER:
                                case Block::TYPE_IP:
@@ -92,14 +92,14 @@ class SpecialUnblock extends SpecialPage {
                        )
                );
 
-               if( $this->block instanceof Block ) {
+               if ( $this->block instanceof Block ) {
                        list( $target, $type ) = $this->block->getTargetAndType();
 
                        # Autoblocks are logged as "autoblock #123 because the IP was recently used by
                        # User:Foo, and we've just got any block, auto or not, that applies to a target
                        # the user has specified.  Someone could be fishing to connect IPs to autoblocks,
                        # so don't show any distinction between unblocked IPs and autoblocked IPs
-                       if( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) {
+                       if ( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) {
                                $fields['Target']['default'] = $this->target;
                                unset( $fields['Name'] );
 
@@ -159,7 +159,7 @@ class SpecialUnblock extends SpecialPage {
                $target = $data['Target'];
                $block = Block::newFromTarget( $data['Target'] );
 
-               if( !$block instanceof Block ) {
+               if ( !$block instanceof Block ) {
                        return array( array( 'ipb_cant_unblock', $target ) );
                }
 
@@ -174,14 +174,14 @@ class SpecialUnblock extends SpecialPage {
                # If the specified IP is a single address, and the block is a range block, don't
                # unblock the whole range.
                list( $target, $type ) = SpecialBlock::getTargetAndType( $target );
-               if( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) {
+               if ( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) {
                        $range = $block->getTarget();
                        return array( array( 'ipb_blocked_as_range', $target, $range ) );
                }
 
                # If the name was hidden and the blocking user cannot hide
                # names, then don't allow any block removals...
-               if( !$performer->isAllowed( 'hideuser' ) && $block->mHideName ) {
+               if ( !$performer->isAllowed( 'hideuser' ) && $block->mHideName ) {
                        return array( 'unblock-hideuser' );
                }
 
@@ -191,7 +191,7 @@ class SpecialUnblock extends SpecialPage {
                }
 
                # Unset _deleted fields as needed
-               if( $block->mHideName ) {
+               if ( $block->mHideName ) {
                        # Something is deeply FUBAR if this is not a User object, but who knows?
                        $id = $block->getTarget() instanceof User
                                ? $block->getTarget()->getID()
index bfcb58f..8bc9e48 100644 (file)
@@ -65,8 +65,9 @@ class UncategorizedPagesPage extends PageQueryPage {
        function getOrderFields() {
                // For some crazy reason ordering by a constant
                // causes a filesort
-               if( $this->requestedNamespace === false && count( MWNamespace::getContentNamespaces() ) > 1 )
+               if ( $this->requestedNamespace === false && count( MWNamespace::getContentNamespaces() ) > 1 ) {
                        return array( 'page_namespace', 'page_title' );
+               }
                return array( 'page_title' );
        }
 
index b665c4b..6fb133a 100644 (file)
@@ -90,7 +90,7 @@ class SpecialUpload extends SpecialPage {
 
                // Guess the desired name from the filename if not provided
                $this->mDesiredDestName = $request->getText( 'wpDestFile' );
-               if( !$this->mDesiredDestName && $request->getFileName( 'wpUploadFile' ) !== null ) {
+               if ( !$this->mDesiredDestName && $request->getFileName( 'wpUploadFile' ) !== null ) {
                        $this->mDesiredDestName = $request->getFileName( 'wpUploadFile' );
                }
                $this->mComment = $request->getText( 'wpUploadDescription' );
@@ -135,19 +135,19 @@ class SpecialUpload extends SpecialPage {
                $this->outputHeader();
 
                # Check uploading enabled
-               if( !UploadBase::isEnabled() ) {
+               if ( !UploadBase::isEnabled() ) {
                        throw new ErrorPageError( 'uploaddisabled', 'uploaddisabledtext' );
                }
 
                # Check permissions
                $user = $this->getUser();
                $permissionRequired = UploadBase::isAllowed( $user );
-               if( $permissionRequired !== true ) {
+               if ( $permissionRequired !== true ) {
                        throw new PermissionsError( $permissionRequired );
                }
 
                # Check blocks
-               if( $user->isBlocked() ) {
+               if ( $user->isBlocked() ) {
                        throw new UserBlockedError( $user->getBlock() );
                }
 
@@ -172,7 +172,7 @@ class SpecialUpload extends SpecialPage {
                        $this->processUpload();
                } else {
                        # Backwards compatibility hook
-                       if( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) {
+                       if ( !wfRunHooks( 'UploadForm:initial', array( &$this ) ) ) {
                                wfDebug( "Hook 'UploadForm:initial' broke output of the upload form" );
                                return;
                        }
@@ -229,7 +229,7 @@ class SpecialUpload extends SpecialPage {
                $form->setTitle( $this->getTitle() );
 
                # Check the token, but only if necessary
-               if(
+               if (
                        !$this->mTokenOk && !$this->mCancelUpload &&
                        ( $this->mUpload && $this->mUploadClicked )
                ) {
@@ -275,7 +275,7 @@ class SpecialUpload extends SpecialPage {
                $title = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName );
                $user = $this->getUser();
                // Show a subtitle link to deleted revisions (to sysops et al only)
-               if( $title instanceof Title ) {
+               if ( $title instanceof Title ) {
                        $count = $title->isDeleted();
                        if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) {
                                $restorelink = Linker::linkKnown(
@@ -333,15 +333,15 @@ class SpecialUpload extends SpecialPage {
 
                $warningHtml = '<h2>' . $this->msg( 'uploadwarning' )->escaped() . "</h2>\n"
                        . '<ul class="warning">';
-               foreach( $warnings as $warning => $args ) {
-                       if( $warning == 'badfilename' ) {
+               foreach ( $warnings as $warning => $args ) {
+                       if ( $warning == 'badfilename' ) {
                                $this->mDesiredDestName = Title::makeTitle( NS_FILE, $args )->getText();
                        }
-                       if( $warning == 'exists' ) {
+                       if ( $warning == 'exists' ) {
                                $msg = "\t<li>" . self::getExistsWarning( $args ) . "</li>\n";
-                       } elseif( $warning == 'duplicate' ) {
+                       } elseif ( $warning == 'duplicate' ) {
                                $msg = self::getDupeWarning( $args );
-                       } elseif( $warning == 'duplicate-archive' ) {
+                       } elseif ( $warning == 'duplicate-archive' ) {
                                $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
                                                Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
                                        . "</li>\n";
@@ -387,12 +387,12 @@ class SpecialUpload extends SpecialPage {
        protected function processUpload() {
                // Fetch the file if required
                $status = $this->mUpload->fetchFile();
-               if( !$status->isOK() ) {
+               if ( !$status->isOK() ) {
                        $this->showUploadError( $this->getOutput()->parse( $status->getWikiText() ) );
                        return;
                }
 
-               if( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) {
+               if ( !wfRunHooks( 'UploadForm:BeforeProcessing', array( &$this ) ) ) {
                        wfDebug( "Hook 'UploadForm:BeforeProcessing' broke processing the file.\n" );
                        // This code path is deprecated. If you want to break upload processing
                        // do so by hooking into the appropriate hooks in UploadBase::verifyUpload
@@ -411,7 +411,7 @@ class SpecialUpload extends SpecialPage {
 
                // Verify permissions for this title
                $permErrors = $this->mUpload->verifyTitlePermissions( $this->getUser() );
-               if( $permErrors !== true ) {
+               if ( $permErrors !== true ) {
                        $code = array_shift( $permErrors[0] );
                        $this->showRecoverableUploadError( $this->msg( $code, $permErrors[0] )->parse() );
                        return;
@@ -420,15 +420,15 @@ class SpecialUpload extends SpecialPage {
                $this->mLocalFile = $this->mUpload->getLocalFile();
 
                // Check warnings if necessary
-               if( !$this->mIgnoreWarning ) {
+               if ( !$this->mIgnoreWarning ) {
                        $warnings = $this->mUpload->checkWarnings();
-                       if( $this->showUploadWarning( $warnings ) ) {
+                       if ( $this->showUploadWarning( $warnings ) ) {
                                return;
                        }
                }
 
                // Get the page text if this is not a reupload
-               if( !$this->mForReUpload ) {
+               if ( !$this->mForReUpload ) {
                        $pageText = self::getInitialPageText( $this->mComment, $this->mLicense,
                                $this->mCopyrightStatus, $this->mCopyrightSource );
                } else {
@@ -463,7 +463,7 @@ class SpecialUpload extends SpecialPage {
                 * Thus, forcing them as content messages makes the upload to produce an int: template
                 * instead of hardcoding it there in the uploader language.
                 */
-               foreach( array( 'license-header', 'filedesc', 'filestatus', 'filesource' ) as $msgName ) {
+               foreach ( array( 'license-header', 'filedesc', 'filestatus', 'filesource' ) as $msgName ) {
                        if ( in_array( $msgName, $wgForceUIMsgAsContentMsg ) ) {
                                $msg[$msgName] = "{{int:$msgName}}";
                        } else {
@@ -505,13 +505,13 @@ class SpecialUpload extends SpecialPage {
         * @return Bool|String
         */
        protected function getWatchCheck() {
-               if( $this->getUser()->getOption( 'watchdefault' ) ) {
+               if ( $this->getUser()->getOption( 'watchdefault' ) ) {
                        // Watch all edits!
                        return true;
                }
 
                $local = wfLocalFile( $this->mDesiredDestName );
-               if( $local && $local->exists() ) {
+               if ( $local && $local->exists() ) {
                        // We're uploading a new version of an existing file.
                        // No creation, so don't watch it if we're not already.
                        return $this->getUser()->isWatched( $local->getTitle() );
@@ -635,10 +635,10 @@ class SpecialUpload extends SpecialPage {
                $filename = $file->getTitle()->getPrefixedText();
                $warning = '';
 
-               if( $exists['warning'] == 'exists' ) {
+               if ( $exists['warning'] == 'exists' ) {
                        // Exact match
                        $warning = wfMessage( 'fileexists', $filename )->parse();
-               } elseif( $exists['warning'] == 'page-exists' ) {
+               } elseif ( $exists['warning'] == 'page-exists' ) {
                        // Page exists but file does not
                        $warning = wfMessage( 'filepageexists', $filename )->parse();
                } elseif ( $exists['warning'] == 'exists-normalized' ) {
@@ -681,7 +681,7 @@ class SpecialUpload extends SpecialPage {
         */
        public static function ajaxGetExistsWarning( $filename ) {
                $file = wfFindFile( $filename );
-               if( !$file ) {
+               if ( !$file ) {
                        // Force local file so we have an object to do further checks against
                        // if there isn't an exact match...
                        $file = wfLocalFile( $filename );
@@ -709,7 +709,7 @@ class SpecialUpload extends SpecialPage {
 
                $gallery = new ImageGallery;
                $gallery->setShowBytes( false );
-               foreach( $dupes as $file ) {
+               foreach ( $dupes as $file ) {
                        $gallery->add( $file->getTitle() );
                }
                return '<li>' .
@@ -889,8 +889,8 @@ class UploadForm extends HTMLForm {
                global $wgCheckFileExtensions, $wgStrictFileExtensions,
                $wgFileExtensions, $wgFileBlacklist;
 
-               if( $wgCheckFileExtensions ) {
-                       if( $wgStrictFileExtensions ) {
+               if ( $wgCheckFileExtensions ) {
+                       if ( $wgStrictFileExtensions ) {
                                # Everything not permitted is banned
                                $extensionsList =
                                        '<div id="mw-upload-permitted">' .
index a8e140d..238d838 100644 (file)
@@ -222,7 +222,7 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                global $wgUploadStashScalerBaseUrl;
                $scalerBaseUrl = $wgUploadStashScalerBaseUrl;
 
-               if( preg_match( '/^\/\//', $scalerBaseUrl ) ) {
+               if ( preg_match( '/^\/\//', $scalerBaseUrl ) ) {
                        // this is apparently a protocol-relative URL, which makes no sense in this context,
                        // since this is used for communication that's internal to the application.
                        // default to http.
index c3a954f..f7e4d0a 100644 (file)
@@ -115,18 +115,18 @@ class LoginForm extends SpecialPage {
                $this->mReturnTo = $request->getVal( 'returnto', '' );
                $this->mReturnToQuery = $request->getVal( 'returntoquery', '' );
 
-               if( $wgEnableEmail ) {
+               if ( $wgEnableEmail ) {
                        $this->mEmail = $request->getText( 'wpEmail' );
                } else {
                        $this->mEmail = '';
                }
-               if( !in_array( 'realname', $wgHiddenPrefs ) ) {
+               if ( !in_array( 'realname', $wgHiddenPrefs ) ) {
                        $this->mRealName = $request->getText( 'wpRealName' );
                } else {
                        $this->mRealName = '';
                }
 
-               if( !$wgAuth->validDomain( $this->mDomain ) ) {
+               if ( !$wgAuth->validDomain( $this->mDomain ) ) {
                        $this->mDomain = $wgAuth->getDomain();
                }
                $wgAuth->setDomain( $this->mDomain );
@@ -135,7 +135,7 @@ class LoginForm extends SpecialPage {
                # 2. Do not return to PasswordReset after a successful password change
                #    but goto Wiki start page (Main_Page) instead ( bug 33997 )
                $returnToTitle = Title::newFromText( $this->mReturnTo );
-               if( is_object( $returnToTitle ) && (
+               if ( is_object( $returnToTitle ) && (
                        $returnToTitle->isSpecial( 'Userlogout' )
                        || $returnToTitle->isSpecial( 'PasswordReset' ) ) ) {
                        $this->mReturnTo = '';
@@ -206,8 +206,8 @@ class LoginForm extends SpecialPage {
                if ( !is_null( $this->mCookieCheck ) ) {
                        $this->onCookieRedirectCheck( $this->mCookieCheck );
                        return;
-               } elseif( $this->mPosted ) {
-                       if( $this->mCreateaccount ) {
+               } elseif ( $this->mPosted ) {
+                       if ( $this->mCreateaccount ) {
                                $this->addNewAccount();
                                return;
                        } elseif ( $this->mCreateaccountMail ) {
@@ -231,7 +231,7 @@ class LoginForm extends SpecialPage {
                }
 
                $status = $this->addNewaccountInternal();
-               if( !$status->isGood() ) {
+               if ( !$status->isGood() ) {
                        $error = $this->getOutput()->parse( $status->getWikiText() );
                        $this->mainLoginForm( $error );
                        return;
@@ -250,7 +250,7 @@ class LoginForm extends SpecialPage {
                $out = $this->getOutput();
                $out->setPageTitle( $this->msg( 'accmailtitle' ) );
 
-               if( !$result->isGood() ) {
+               if ( !$result->isGood() ) {
                        $this->mainLoginForm( $this->msg( 'mailerror', $result->getWikiText() )->text() );
                } else {
                        $out->addWikiMsg( 'accmailtext', $u->getName(), $u->getEmail() );
@@ -267,7 +267,7 @@ class LoginForm extends SpecialPage {
 
                # Create the account and abort if there's a problem doing so
                $status = $this->addNewAccountInternal();
-               if( !$status->isGood() ) {
+               if ( !$status->isGood() ) {
                        $error = $this->getOutput()->parse( $status->getWikiText() );
                        $this->mainLoginForm( $error );
                        return false;
@@ -279,7 +279,7 @@ class LoginForm extends SpecialPage {
                if ( $this->getUser()->isAnon() ) {
                        # If we showed up language selection links, and one was in use, be
                        # smart (and sensible) and save that language as the user's preference
-                       if( $wgLoginLanguageSelector && $this->mLanguage ) {
+                       if ( $wgLoginLanguageSelector && $this->mLanguage ) {
                                $u->setOption( 'language', $this->mLanguage );
                        } else {
 
@@ -296,9 +296,9 @@ class LoginForm extends SpecialPage {
                $out = $this->getOutput();
 
                # Send out an email authentication message if needed
-               if( $wgEmailAuthentication && Sanitizer::validateEmail( $u->getEmail() ) ) {
+               if ( $wgEmailAuthentication && Sanitizer::validateEmail( $u->getEmail() ) ) {
                        $status = $u->sendConfirmationMail();
-                       if( $status->isGood() ) {
+                       if ( $status->isGood() ) {
                                $out->addWikiMsg( 'confirmemail_oncreate' );
                        } else {
                                $out->addWikiText( $status->getWikiText( 'confirmemail_sendfailed' ) );
@@ -311,7 +311,7 @@ class LoginForm extends SpecialPage {
                # If not logged in, assume the new account as the current one and set
                # session cookies then show a "welcome" message or a "need cookies"
                # message as needed
-               if( $this->getUser()->isAnon() ) {
+               if ( $this->getUser()->isAnon() ) {
                        $u->setCookies();
                        $wgUser = $u;
                        // This should set it for OutputPage and the Skin
@@ -320,7 +320,7 @@ class LoginForm extends SpecialPage {
                        $this->getContext()->setUser( $u );
                        wfRunHooks( 'AddNewAccount', array( $u, false ) );
                        $u->addNewUserLogEntry( 'create' );
-                       if( $this->hasSessionCookie() ) {
+                       if ( $this->hasSessionCookie() ) {
                                $this->successfulCreation();
                        } else {
                                $this->cookieRedirectCheck( 'new' );
@@ -347,7 +347,7 @@ class LoginForm extends SpecialPage {
                        $wgMinimalPasswordLength, $wgEmailConfirmToEdit;
 
                // If the user passes an invalid domain, something is fishy
-               if( !$wgAuth->validDomain( $this->mDomain ) ) {
+               if ( !$wgAuth->validDomain( $this->mDomain ) ) {
                        return Status::newFatal( 'wrongpassword' );
                }
 
@@ -356,8 +356,8 @@ class LoginForm extends SpecialPage {
                // cation server before they create an account (otherwise, they can
                // create a local account and login as any domain user). We only need
                // to check this for domains that aren't local.
-               if( 'local' != $this->mDomain && $this->mDomain != '' ) {
-                       if(
+               if ( 'local' != $this->mDomain && $this->mDomain != '' ) {
+                       if (
                                !$wgAuth->canCreateAccounts() &&
                                (
                                        !$wgAuth->userExists( $this->mUsername ) ||
@@ -455,7 +455,7 @@ class LoginForm extends SpecialPage {
                $u->setRealName( $this->mRealName );
 
                $abortError = '';
-               if( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
+               if ( !wfRunHooks( 'AbortNewAccount', array( $u, &$abortError ) ) ) {
                        // Hook point to add extra creation throttles and blocks
                        wfDebug( "LoginForm::addNewAccountInternal: a hook blocked creation\n" );
                        return Status::newFatal( new RawMessage( $abortError ) );
@@ -478,7 +478,7 @@ class LoginForm extends SpecialPage {
                        }
                }
 
-               if( !$wgAuth->addUser( $u, $this->mPassword, $this->mEmail, $this->mRealName ) ) {
+               if ( !$wgAuth->addUser( $u, $this->mPassword, $this->mEmail, $this->mRealName ) ) {
                        return Status::newFatal( 'externaldberror' );
                }
 
@@ -576,7 +576,7 @@ class LoginForm extends SpecialPage {
                }
 
                $u = User::newFromName( $this->mUsername );
-               if( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
+               if ( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
                        return self::ILLEGAL;
                }
 
@@ -594,13 +594,13 @@ class LoginForm extends SpecialPage {
 
                // Give general extensions, such as a captcha, a chance to abort logins
                $abort = self::ABORTED;
-               if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$this->mAbortLoginErrorMsg ) ) ) {
+               if ( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$this->mAbortLoginErrorMsg ) ) ) {
                        return $abort;
                }
 
                global $wgBlockDisablesLogin;
                if ( !$u->checkPassword( $this->mPassword ) ) {
-                       if( $u->checkTemporaryPassword( $this->mPassword ) ) {
+                       if ( $u->checkTemporaryPassword( $this->mPassword ) ) {
                                // The e-mailed temporary password should not be used for actu-
                                // al logins; that's a very sloppy habit, and insecure if an
                                // attacker has a few seconds to click "search" on someone's o-
@@ -617,7 +617,7 @@ class LoginForm extends SpecialPage {
                                // As a side-effect, we can authenticate the user's e-mail ad-
                                // dress if it's not already done, since the temporary password
                                // was sent via e-mail.
-                               if( !$u->isEmailConfirmed() ) {
+                               if ( !$u->isEmailConfirmed() ) {
                                        $u->confirmEmail();
                                        $u->saveSettings();
                                }
@@ -726,7 +726,7 @@ class LoginForm extends SpecialPage {
                }
 
                $abortError = '';
-               if( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) {
+               if ( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) {
                        // Hook point to add extra creation throttles and blocks
                        wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" );
                        $this->mAbortLoginErrorMsg = $abortError;
@@ -752,14 +752,14 @@ class LoginForm extends SpecialPage {
                        case self::SUCCESS:
                                # We've verified now, update the real record
                                $user = $this->getUser();
-                               if( (bool)$this->mRemember != $user->getBoolOption( 'rememberpassword' ) ) {
+                               if ( (bool)$this->mRemember != $user->getBoolOption( 'rememberpassword' ) ) {
                                        $user->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 );
                                        $user->saveSettings();
                                } else {
                                        $user->invalidateCache();
                                }
 
-                               if( $wgSecureLogin && !$this->mStickHTTPS ) {
+                               if ( $wgSecureLogin && !$this->mStickHTTPS ) {
                                        $user->setCookies( null, false );
                                } else {
                                        $user->setCookies();
@@ -771,7 +771,7 @@ class LoginForm extends SpecialPage {
                                $key = wfMemcKey( 'password-throttle', $request->getIP(), md5( $this->mUsername ) );
                                $wgMemc->delete( $key );
 
-                               if( $this->hasSessionCookie() || $this->mSkipCookieCheck ) {
+                               if ( $this->hasSessionCookie() || $this->mSkipCookieCheck ) {
                                        /* Replace the language object to provide user interface in
                                         * correct language immediately on this first page load.
                                         */
@@ -801,7 +801,7 @@ class LoginForm extends SpecialPage {
                                $this->mainLoginForm( $this->msg( 'wrongpassword' )->text() );
                                break;
                        case self::NOT_EXISTS:
-                               if( $this->getUser()->isAllowed( 'createaccount' ) ) {
+                               if ( $this->getUser()->isAllowed( 'createaccount' ) ) {
                                        $this->mainLoginForm( $this->msg( 'nosuchuser',
                                                wfEscapeWikiText( $this->mUsername ) )->parse() );
                                } else {
@@ -860,7 +860,7 @@ class LoginForm extends SpecialPage {
                        return Status::newFatal( 'noemail', $u->getName() );
                }
                $ip = $this->getRequest()->getIP();
-               if( !$ip ) {
+               if ( !$ip ) {
                        return Status::newFatal( 'badipaddress' );
                }
 
@@ -894,7 +894,7 @@ class LoginForm extends SpecialPage {
                $injected_html = '';
                wfRunHooks( 'UserLoginComplete', array( &$currentUser, &$injected_html ) );
 
-               if( $injected_html !== '' ) {
+               if ( $injected_html !== '' ) {
                        $this->displaySuccessfulAction( $this->msg( 'loginsuccesstitle' ),
                                'loginsuccess', $injected_html );
                } else {
@@ -1000,7 +1000,7 @@ class LoginForm extends SpecialPage {
                if ( $wgSecureLogin && !$this->mStickHTTPS ) {
                        $options = array( 'http' );
                        $proto = PROTO_HTTP;
-               } elseif( $wgSecureLogin ) {
+               } elseif ( $wgSecureLogin ) {
                        $options = array( 'https' );
                        $proto = PROTO_HTTPS;
                } else {
@@ -1101,9 +1101,9 @@ class LoginForm extends SpecialPage {
                }
 
                # Don't show a "create account" link if the user can't.
-               if( $this->showCreateOrLoginLink( $user ) ) {
+               if ( $this->showCreateOrLoginLink( $user ) ) {
                        # Pass any language selection on to the mode switch link
-                       if( $wgLoginLanguageSelector && $this->mLanguage ) {
+                       if ( $wgLoginLanguageSelector && $this->mLanguage ) {
                                $linkq .= '&uselang=' . $this->mLanguage;
                        }
                        if ( !$this->mShowVForm ) {
@@ -1170,9 +1170,9 @@ class LoginForm extends SpecialPage {
                }
 
                # Prepare language selection links as needed
-               if( $wgLoginLanguageSelector ) {
+               if ( $wgLoginLanguageSelector ) {
                        $template->set( 'languages', $this->makeLanguageSelector() );
-                       if( $this->mLanguage ) {
+                       if ( $this->mLanguage ) {
                                $template->set( 'uselang', $this->mLanguage );
                        }
                }
@@ -1214,9 +1214,9 @@ class LoginForm extends SpecialPage {
         * @return Boolean
         */
        function showCreateOrLoginLink( &$user ) {
-               if( $this->mType == 'signup' ) {
+               if ( $this->mType == 'signup' ) {
                        return true;
-               } elseif( $user->isAllowed( 'createaccount' ) ) {
+               } elseif ( $user->isAllowed( 'createaccount' ) ) {
                        return true;
                } else {
                        return false;
@@ -1295,7 +1295,7 @@ class LoginForm extends SpecialPage {
         */
        private function renewSessionId() {
                global $wgSecureLogin, $wgCookieSecure;
-               if( $wgSecureLogin && !$this->mStickHTTPS ) {
+               if ( $wgSecureLogin && !$this->mStickHTTPS ) {
                        $wgCookieSecure = false;
                }
 
@@ -1354,10 +1354,10 @@ class LoginForm extends SpecialPage {
         */
        function makeLanguageSelector() {
                $msg = $this->msg( 'loginlanguagelinks' )->inContentLanguage();
-               if( !$msg->isBlank() ) {
+               if ( !$msg->isBlank() ) {
                        $langs = explode( "\n", $msg->text() );
                        $links = array();
-                       foreach( $langs as $lang ) {
+                       foreach ( $langs as $lang ) {
                                $lang = trim( $lang, '* ' );
                                $parts = explode( '|', $lang );
                                if ( count( $parts ) >= 2 ) {
@@ -1380,15 +1380,15 @@ class LoginForm extends SpecialPage {
         * @return string
         */
        function makeLanguageSelectorLink( $text, $lang ) {
-               if( $this->getLanguage()->getCode() == $lang ) {
+               if ( $this->getLanguage()->getCode() == $lang ) {
                        // no link for currently used language
                        return htmlspecialchars( $text );
                }
                $query = array( 'uselang' => $lang );
-               if( $this->mType == 'signup' ) {
+               if ( $this->mType == 'signup' ) {
                        $query['type'] = 'signup';
                }
-               if( $this->mReturnTo !== '' ) {
+               if ( $this->mReturnTo !== '' ) {
                        $query['returnto'] = $this->mReturnTo;
                        $query['returntoquery'] = $this->mReturnToQuery;
                }
index 7501371..b9d6d30 100644 (file)
@@ -80,13 +80,13 @@ class UserrightsPage extends SpecialPage {
                 * (e.g. they don't have the userrights permission), then don't
                 * allow them to use Special:UserRights.
                 */
-               if( $user->isBlocked() && !$user->isAllowed( 'userrights' ) ) {
+               if ( $user->isBlocked() && !$user->isAllowed( 'userrights' ) ) {
                        throw new UserBlockedError( $user->getBlock() );
                }
 
                $request = $this->getRequest();
 
-               if( $par !== null ) {
+               if ( $par !== null ) {
                        $this->mTarget = $par;
                } else {
                        $this->mTarget = $request->getVal( 'user' );
@@ -100,15 +100,16 @@ class UserrightsPage extends SpecialPage {
                         * edit their own groups, automatically set them as the
                         * target.
                         */
-                       if ( !count( $available['add'] ) && !count( $available['remove'] ) )
+                       if ( !count( $available['add'] ) && !count( $available['remove'] ) ) {
                                $this->mTarget = $user->getName();
+                       }
                }
 
                if ( User::getCanonicalName( $this->mTarget ) == $user->getName() ) {
                        $this->isself = true;
                }
 
-               if( !$this->userCanChangeRights( $user, true ) ) {
+               if ( !$this->userCanChangeRights( $user, true ) ) {
                        // @todo FIXME: There may be intermediate groups we can mention.
                        $msg = $user->isAnon() ? 'userrights-nologin' : 'userrights-notallowed';
                        throw new PermissionsError( null, array( array( $msg ) ) );
@@ -127,12 +128,12 @@ class UserrightsPage extends SpecialPage {
                        $this->switchForm();
                }
 
-               if( $request->wasPosted() ) {
+               if ( $request->wasPosted() ) {
                        // save settings
-                       if( $request->getCheck( 'saveusergroups' ) ) {
+                       if ( $request->getCheck( 'saveusergroups' ) ) {
                                $reason = $request->getVal( 'user-reason' );
                                $tok = $request->getVal( 'wpEditToken' );
-                               if( $user->matchEditToken( $tok, $this->mTarget ) ) {
+                               if ( $user->matchEditToken( $tok, $this->mTarget ) ) {
                                        $this->saveUserGroups(
                                                $this->mTarget,
                                                $reason
@@ -145,7 +146,7 @@ class UserrightsPage extends SpecialPage {
                }
 
                // show some more forms
-               if( $this->mTarget !== null ) {
+               if ( $this->mTarget !== null ) {
                        $this->editUserGroupsForm( $this->mTarget );
                }
        }
@@ -164,7 +165,7 @@ class UserrightsPage extends SpecialPage {
         */
        function saveUserGroups( $username, $reason = '' ) {
                $status = $this->fetchUser( $username );
-               if( !$status->isOK() ) {
+               if ( !$status->isOK() ) {
                        $this->getOutput()->addWikiText( $status->getWikiText() );
                        return;
                } else {
@@ -218,15 +219,15 @@ class UserrightsPage extends SpecialPage {
                $newGroups = $oldGroups;
 
                // remove then add groups
-               if( $remove ) {
+               if ( $remove ) {
                        $newGroups = array_diff( $newGroups, $remove );
-                       foreach( $remove as $group ) {
+                       foreach ( $remove as $group ) {
                                $user->removeGroup( $group );
                        }
                }
-               if( $add ) {
+               if ( $add ) {
                        $newGroups = array_merge( $newGroups, $add );
-                       foreach( $add as $group ) {
+                       foreach ( $add as $group ) {
                                $user->addGroup( $group );
                        }
                }
@@ -239,7 +240,7 @@ class UserrightsPage extends SpecialPage {
                wfDebug( 'newGroups: ' . print_r( $newGroups, true ) );
                wfRunHooks( 'UserRights', array( &$user, $add, $remove ) );
 
-               if( $newGroups != $oldGroups ) {
+               if ( $newGroups != $oldGroups ) {
                        $this->addLogEntry( $user, $oldGroups, $newGroups, $reason );
                }
                return array( $add, $remove );
@@ -267,7 +268,7 @@ class UserrightsPage extends SpecialPage {
         */
        function editUserGroupsForm( $username ) {
                $status = $this->fetchUser( $username );
-               if( !$status->isOK() ) {
+               if ( !$status->isOK() ) {
                        $this->getOutput()->addWikiText( $status->getWikiText() );
                        return;
                } else {
@@ -295,57 +296,57 @@ class UserrightsPage extends SpecialPage {
                global $wgUserrightsInterwikiDelimiter;
 
                $parts = explode( $wgUserrightsInterwikiDelimiter, $username );
-               if( count( $parts ) < 2 ) {
+               if ( count( $parts ) < 2 ) {
                        $name = trim( $username );
                        $database = '';
                } else {
                        list( $name, $database ) = array_map( 'trim', $parts );
 
-                       if( $database == wfWikiID() ) {
+                       if ( $database == wfWikiID() ) {
                                $database = '';
                        } else {
-                               if( !$this->getUser()->isAllowed( 'userrights-interwiki' ) ) {
+                               if ( !$this->getUser()->isAllowed( 'userrights-interwiki' ) ) {
                                        return Status::newFatal( 'userrights-no-interwiki' );
                                }
-                               if( !UserRightsProxy::validDatabase( $database ) ) {
+                               if ( !UserRightsProxy::validDatabase( $database ) ) {
                                        return Status::newFatal( 'userrights-nodatabase', $database );
                                }
                        }
                }
 
-               if( $name === '' ) {
+               if ( $name === '' ) {
                        return Status::newFatal( 'nouserspecified' );
                }
 
-               if( $name[0] == '#' ) {
+               if ( $name[0] == '#' ) {
                        // Numeric ID can be specified...
                        // We'll do a lookup for the name internally.
                        $id = intval( substr( $name, 1 ) );
 
-                       if( $database == '' ) {
+                       if ( $database == '' ) {
                                $name = User::whoIs( $id );
                        } else {
                                $name = UserRightsProxy::whoIs( $database, $id );
                        }
 
-                       if( !$name ) {
+                       if ( !$name ) {
                                return Status::newFatal( 'noname' );
                        }
                } else {
                        $name = User::getCanonicalName( $name );
-                       if( $name === false ) {
+                       if ( $name === false ) {
                                // invalid name
                                return Status::newFatal( 'nosuchusershort', $username );
                        }
                }
 
-               if( $database == '' ) {
+               if ( $database == '' ) {
                        $user = User::newFromName( $name );
                } else {
                        $user = UserRightsProxy::newFromName( $database, $name );
                }
 
-               if( !$user || $user->isAnon() ) {
+               if ( !$user || $user->isAnon() ) {
                        return Status::newFatal( 'nosuchusershort', $username );
                }
 
@@ -353,7 +354,7 @@ class UserrightsPage extends SpecialPage {
        }
 
        function makeGroupNameList( $ids ) {
-               if( empty( $ids ) ) {
+               if ( empty( $ids ) ) {
                        return $this->msg( 'rightsnone' )->inContentLanguage()->text();
                } else {
                        return implode( ', ', $ids );
@@ -370,7 +371,7 @@ class UserrightsPage extends SpecialPage {
        function makeGroupNameListForLog( $ids ) {
                wfDeprecated( __METHOD__, '1.21' );
 
-               if( empty( $ids ) ) {
+               if ( empty( $ids ) ) {
                        return '';
                } else {
                        return $this->makeGroupNameList( $ids );
@@ -425,7 +426,7 @@ class UserrightsPage extends SpecialPage {
        protected function showEditUserGroupsForm( $user, $groups ) {
                $list = array();
                $membersList = array();
-               foreach( $groups as $group ) {
+               foreach ( $groups as $group ) {
                        $list[] = self::buildGroupLink( $group );
                        $membersList[] = self::buildGroupMemberLink( $group );
                }
@@ -433,7 +434,7 @@ class UserrightsPage extends SpecialPage {
                $autoList = array();
                $autoMembersList = array();
                if ( $user instanceof User ) {
-                       foreach( Autopromote::getAutopromoteGroups( $user ) as $group ) {
+                       foreach ( Autopromote::getAutopromoteGroups( $user ) as $group ) {
                                $autoList[] = self::buildGroupLink( $group );
                                $autoMembersList[] = self::buildGroupMemberLink( $group );
                        }
@@ -545,7 +546,7 @@ class UserrightsPage extends SpecialPage {
                # more easily manage it.
                $columns = array( 'unchangeable' => array(), 'changeable' => array() );
 
-               foreach( $allgroups as $group ) {
+               foreach ( $allgroups as $group ) {
                        $set = in_array( $group, $usergroups );
                        # Should the checkbox be disabled?
                        $disabled = !(
@@ -562,7 +563,7 @@ class UserrightsPage extends SpecialPage {
                                'irreversible' => $irreversible
                        );
 
-                       if( $disabled ) {
+                       if ( $disabled ) {
                                $columns['unchangeable'][$group] = $checkbox;
                        } else {
                                $columns['changeable'][$group] = $checkbox;
@@ -572,17 +573,19 @@ class UserrightsPage extends SpecialPage {
                # Build the HTML table
                $ret .= Xml::openElement( 'table', array( 'class' => 'mw-userrights-groups' ) ) .
                        "<tr>\n";
-               foreach( $columns as $name => $column ) {
-                       if( $column === array() )
+               foreach ( $columns as $name => $column ) {
+                       if ( $column === array() ) {
                                continue;
+                       }
                        $ret .= Xml::element( 'th', null, $this->msg( 'userrights-' . $name . '-col', count( $column ) )->text() );
                }
                $ret .= "</tr>\n<tr>\n";
-               foreach( $columns as $column ) {
-                       if( $column === array() )
+               foreach ( $columns as $column ) {
+                       if ( $column === array() ) {
                                continue;
+                       }
                        $ret .= "\t<td style='vertical-align:top;'>\n";
-                       foreach( $column as $group => $checkbox ) {
+                       foreach ( $column as $group => $checkbox ) {
                                $attr = $checkbox['disabled'] ? array( 'disabled' => 'disabled' ) : array();
 
                                $member = User::getGroupMember( $group, $user->getName() );
index d375316..b01058a 100644 (file)
@@ -55,7 +55,7 @@ class SpecialVersion extends SpecialPage {
                $out = $this->getOutput();
                $out->allowClickjacking();
 
-               if( $par !== 'Credits' ) {
+               if ( $par !== 'Credits' ) {
                        $text =
                                $this->getMediaWikiCredits() .
                                $this->softwareInformation() .
@@ -159,7 +159,7 @@ class SpecialVersion extends SpecialPage {
                                        <th>" . wfMessage( 'version-software-version' )->text() . "</th>
                                </tr>\n";
 
-               foreach( $software as $name => $version ) {
+               foreach ( $software as $name => $version ) {
                        $out .= "<tr>
                                        <td>" . $name . "</td>
                                        <td dir=\"ltr\">" . $version . "</td>
@@ -218,11 +218,11 @@ class SpecialVersion extends SpecialPage {
                wfProfileIn( __METHOD__ );
 
                $gitVersion = self::getVersionLinkedGit();
-               if( $gitVersion ) {
+               if ( $gitVersion ) {
                        $v = $gitVersion;
                } else {
                        $svnVersion = self::getVersionLinkedSvn();
-                       if( $svnVersion ) {
+                       if ( $svnVersion ) {
                                $v = $svnVersion;
                        } else {
                                $v = $wgVersion; // fallback
@@ -240,7 +240,7 @@ class SpecialVersion extends SpecialPage {
                global $IP;
 
                $info = self::getSvnInfo( $IP );
-               if( !isset( $info['checkout-rev'] ) ) {
+               if ( !isset( $info['checkout-rev'] ) ) {
                        return false;
                }
 
@@ -265,7 +265,7 @@ class SpecialVersion extends SpecialPage {
        private static function getwgVersionLinked() {
                global $wgVersion;
                $versionUrl = "";
-               if( wfRunHooks( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) {
+               if ( wfRunHooks( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) {
                        $versionParts = array();
                        preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts );
                        $versionUrl = "https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]}";
@@ -282,7 +282,7 @@ class SpecialVersion extends SpecialPage {
 
                $gitInfo = new GitInfo( $IP );
                $headSHA1 = $gitInfo->getHeadSHA1();
-               if( !$headSHA1 ) {
+               if ( !$headSHA1 ) {
                        return false;
                }
 
@@ -407,7 +407,7 @@ class SpecialVersion extends SpecialPage {
                }
 
                $fhooks = $wgParser->getFunctionHooks();
-               if( count( $fhooks ) ) {
+               if ( count( $fhooks ) ) {
                        $out .= $this->openExtType( $this->msg( 'version-parser-function-hooks' )->text(), 'parser-function-hooks' );
                        $out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
                }
@@ -452,7 +452,7 @@ class SpecialVersion extends SpecialPage {
         * @return int
         */
        function compare( $a, $b ) {
-               if( $a['name'] === $b['name'] ) {
+               if ( $a['name'] === $b['name'] ) {
                        return 0;
                } else {
                        return $this->getLanguage()->lc( $a['name'] ) > $this->getLanguage()->lc( $b['name'] )
@@ -486,7 +486,7 @@ class SpecialVersion extends SpecialPage {
                                }
                                $gitHeadCommitDate = $gitInfo->getHeadCommitDate();
                                if ( $gitHeadCommitDate ) {
-                                       $vcsText .= "<br/>" .  $wgLang->timeanddate( $gitHeadCommitDate, true );
+                                       $vcsText .= "<br/>" . $wgLang->timeanddate( $gitHeadCommitDate, true );
                                }
                        } else {
                                $svnInfo = self::getSvnInfo( dirname( $extension['path'] ) );
@@ -517,11 +517,11 @@ class SpecialVersion extends SpecialPage {
                # Make description text.
                $description = isset ( $extension['description'] ) ? $extension['description'] : '';
 
-               if( isset ( $extension['descriptionmsg'] ) ) {
+               if ( isset ( $extension['descriptionmsg'] ) ) {
                        # Look for a localized description.
                        $descriptionMsg = $extension['descriptionmsg'];
 
-                       if( is_array( $descriptionMsg ) ) {
+                       if ( is_array( $descriptionMsg ) ) {
                                $descriptionMsgKey = $descriptionMsg[0]; // Get the message key
                                array_shift( $descriptionMsg ); // Shift out the message key to get the parameters only
                                array_map( "htmlspecialchars", $descriptionMsg ); // For sanity
@@ -576,21 +576,22 @@ class SpecialVersion extends SpecialPage {
 
                        $ret .= Xml::closeElement( 'table' );
                        return $ret;
-               } else
+               } else {
                        return '';
+               }
        }
 
        private function openExtType( $text, $name = null ) {
                $opt = array( 'colspan' => 4 );
                $out = '';
 
-               if( $this->firstExtOpened ) {
+               if ( $this->firstExtOpened ) {
                        // Insert a spacing line
                        $out .= '<tr class="sv-space">' . Html::element( 'td', $opt ) . "</tr>\n";
                }
                $this->firstExtOpened = true;
 
-               if( $name ) {
+               if ( $name ) {
                        $opt['id'] = "sv-$name";
                }
 
@@ -617,7 +618,7 @@ class SpecialVersion extends SpecialPage {
         */
        function listAuthors( $authors ) {
                $list = array();
-               foreach( (array)$authors as $item ) {
+               foreach ( (array)$authors as $item ) {
                        if ( $item == '...' ) {
                                $list[] = $this->msg( 'version-poweredby-others' )->text();
                        } elseif ( substr( $item, -5 ) == ' ...]' ) {
@@ -662,16 +663,16 @@ class SpecialVersion extends SpecialPage {
         * @return Mixed
         */
        public static function arrayToString( $list ) {
-               if( is_array( $list ) && count( $list ) == 1 ) {
+               if ( is_array( $list ) && count( $list ) == 1 ) {
                        $list = $list[0];
                }
-               if( is_object( $list ) ) {
+               if ( is_object( $list ) ) {
                        $class = wfMessage( 'parentheses' )->params( get_class( $list ) )->escaped();
                        return $class;
                } elseif ( !is_array( $list ) ) {
                        return $list;
                } else {
-                       if( is_object( $list[0] ) ) {
+                       if ( is_object( $list[0] ) ) {
                                $class = get_class( $list[0] );
                        } else {
                                $class = $list[0];
@@ -700,7 +701,7 @@ class SpecialVersion extends SpecialPage {
                // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
                $entries = $dir . '/.svn/entries';
 
-               if( !file_exists( $entries ) ) {
+               if ( !file_exists( $entries ) ) {
                        return false;
                }
 
@@ -710,9 +711,9 @@ class SpecialVersion extends SpecialPage {
                }
 
                // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)
-               if( preg_match( '/^<\?xml/', $lines[0] ) ) {
+               if ( preg_match( '/^<\?xml/', $lines[0] ) ) {
                        // subversion is release <= 1.3
-                       if( !function_exists( 'simplexml_load_file' ) ) {
+                       if ( !function_exists( 'simplexml_load_file' ) ) {
                                // We could fall back to expat... YUCK
                                return false;
                        }
@@ -722,11 +723,11 @@ class SpecialVersion extends SpecialPage {
                        $xml = simplexml_load_file( $entries );
                        wfRestoreWarnings();
 
-                       if( $xml ) {
-                               foreach( $xml->entry as $entry ) {
-                                       if( $xml->entry[0]['name'] == '' ) {
+                       if ( $xml ) {
+                               foreach ( $xml->entry as $entry ) {
+                                       if ( $xml->entry[0]['name'] == '' ) {
                                                // The directory entry should always have a revision marker.
-                                               if( $entry['revision'] ) {
+                                               if ( $entry['revision'] ) {
                                                        return array( 'checkout-rev' => intval( $entry['revision'] ) );
                                                }
                                        }
index 303df34..ff4313f 100644 (file)
@@ -41,7 +41,7 @@ class SpecialWatchlist extends SpecialPage {
                $output = $this->getOutput();
 
                # Anons don't get a watchlist
-               if( $user->isAnon() ) {
+               if ( $user->isAnon() ) {
                        $output->setPageTitle( $this->msg( 'watchnologin' ) );
                        $output->setRobotPolicy( 'noindex,nofollow' );
                        $llink = Linker::linkKnown(
@@ -74,7 +74,7 @@ class SpecialWatchlist extends SpecialPage {
                $request = $this->getRequest();
 
                $mode = SpecialEditWatchlist::getMode( $request, $par );
-               if( $mode !== false ) {
+               if ( $mode !== false ) {
                        # TODO: localise?
                        switch( $mode ) {
                                case SpecialEditWatchlist::EDIT_CLEAR:
@@ -101,21 +101,21 @@ class SpecialWatchlist extends SpecialPage {
 
                // @TODO: use FormOptions!
                $defaults = array(
-               /* float */ 'days'      => floatval( $user->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */
+               /* float */ 'days' => floatval( $user->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */
                /* bool  */ 'hideMinor' => (int)$user->getBoolOption( 'watchlisthideminor' ),
-               /* bool  */ 'hideBots'  => (int)$user->getBoolOption( 'watchlisthidebots' ),
+               /* bool  */ 'hideBots' => (int)$user->getBoolOption( 'watchlisthidebots' ),
                /* bool  */ 'hideAnons' => (int)$user->getBoolOption( 'watchlisthideanons' ),
-               /* bool  */ 'hideLiu'   => (int)$user->getBoolOption( 'watchlisthideliu' ),
+               /* bool  */ 'hideLiu' => (int)$user->getBoolOption( 'watchlisthideliu' ),
                /* bool  */ 'hidePatrolled' => (int)$user->getBoolOption( 'watchlisthidepatrolled' ),
-               /* bool  */ 'hideOwn'   => (int)$user->getBoolOption( 'watchlisthideown' ),
-               /* bool  */ 'extended'   => (int)$user->getBoolOption( 'extendwatchlist' ),
+               /* bool  */ 'hideOwn' => (int)$user->getBoolOption( 'watchlisthideown' ),
+               /* bool  */ 'extended' => (int)$user->getBoolOption( 'extendwatchlist' ),
                /* ?     */ 'namespace' => '', //means all
-               /* ?     */ 'invert'    => false,
+               /* ?     */ 'invert' => false,
                /* bool  */ 'associated' => false,
                );
                $this->customFilters = array();
                wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
-               foreach( $this->customFilters as $key => $params ) {
+               foreach ( $this->customFilters as $key => $params ) {
                        $defaults[$key] = $params['default'];
                }
 
@@ -130,7 +130,7 @@ class SpecialWatchlist extends SpecialPage {
                $values['hideOwn'] = (int)$request->getBool( 'hideOwn', $defaults['hideOwn'] );
                $values['hidePatrolled'] = (int)$request->getBool( 'hidePatrolled', $defaults['hidePatrolled'] );
                $values['extended'] = (int)$request->getBool( 'extended', $defaults['extended'] );
-               foreach( $this->customFilters as $key => $params ) {
+               foreach ( $this->customFilters as $key => $params ) {
                        $values[$key] = (int)$request->getBool( $key, $defaults[$key] );
                }
 
@@ -159,9 +159,9 @@ class SpecialWatchlist extends SpecialPage {
                $values['invert'] = $invert;
                $values['associated'] = $associated;
 
-               if( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) {
+               if ( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) {
                        $big = 1000; /* The magical big */
-                       if( $nitems > $big ) {
+                       if ( $nitems > $big ) {
                                # Set default cutoff shorter
                                $values['days'] = $defaults['days'] = (12.0 / 24.0); # 12 hours...
                        } else {
@@ -177,7 +177,7 @@ class SpecialWatchlist extends SpecialPage {
                        wfAppendToArrayIfNotDefault( $name, $values[$name], $defaults, $nondefaults );
                }
 
-               if( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
+               if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
                        $request->wasPosted() )
                {
                        $user->clearAllNotifications();
@@ -188,7 +188,7 @@ class SpecialWatchlist extends SpecialPage {
                # Possible where conditions
                $conds = array();
 
-               if( $values['days'] > 0 ) {
+               if ( $values['days'] > 0 ) {
                        $conds[] = 'rc_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( time() - intval( $values['days'] * 86400 ) ) );
                }
 
@@ -201,19 +201,19 @@ class SpecialWatchlist extends SpecialPage {
                # Up estimate of watched items by 15% to compensate for talk pages...
 
                # Toggles
-               if( $values['hideOwn'] ) {
+               if ( $values['hideOwn'] ) {
                        $conds[] = 'rc_user != ' . $user->getId();
                }
-               if( $values['hideBots'] ) {
+               if ( $values['hideBots'] ) {
                        $conds[] = 'rc_bot = 0';
                }
-               if( $values['hideMinor'] ) {
+               if ( $values['hideMinor'] ) {
                        $conds[] = 'rc_minor = 0';
                }
-               if( $values['hideLiu'] ) {
+               if ( $values['hideLiu'] ) {
                        $conds[] = 'rc_user = 0';
                }
-               if( $values['hideAnons'] ) {
+               if ( $values['hideAnons'] ) {
                        $conds[] = 'rc_user != 0';
                }
                if ( $user->useRCPatrol() && $values['hidePatrolled'] ) {
@@ -224,7 +224,7 @@ class SpecialWatchlist extends SpecialPage {
                }
 
                # Toggle watchlist content (all recent edits or just the latest)
-               if( $values['extended'] ) {
+               if ( $values['extended'] ) {
                        $limitWatchlist = $user->getIntOption( 'wllimit' );
                        $usePage = false;
                } else {
@@ -236,7 +236,7 @@ class SpecialWatchlist extends SpecialPage {
 
                # Show a message about slave lag, if applicable
                $lag = wfGetLB()->safeGetLag( $dbr );
-               if( $lag > 0 ) {
+               if ( $lag > 0 ) {
                        $output->showLagWarning( $lag );
                }
 
@@ -246,10 +246,10 @@ class SpecialWatchlist extends SpecialPage {
                # Show watchlist header
                $form .= $this->msg( 'watchlist-details' )->numParams( $nitems )->parse() . "\n";
 
-               if( $user->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist ) {
+               if ( $user->getOption( 'enotifwatchlistpages' ) && $wgEnotifWatchlist ) {
                        $form .= $this->msg( 'wlheader-enotif' )->parseAsBlock() . "\n";
                }
-               if( $wgShowUpdatedMarker ) {
+               if ( $wgShowUpdatedMarker ) {
                        $form .= Xml::openElement( 'form', array( 'method' => 'post',
                                                'action' => $this->getTitle()->getLocalURL(),
                                                'id' => 'mw-watchlist-resetbutton' ) ) . "\n" .
@@ -276,10 +276,10 @@ class SpecialWatchlist extends SpecialPage {
                        ),
                );
                $options = array( 'ORDER BY' => 'rc_timestamp DESC' );
-               if( $wgShowUpdatedMarker ) {
+               if ( $wgShowUpdatedMarker ) {
                        $fields[] = 'wl_notificationtimestamp';
                }
-               if( $limitWatchlist ) {
+               if ( $limitWatchlist ) {
                        $options['LIMIT'] = $limitWatchlist;
                }
 
@@ -302,7 +302,7 @@ class SpecialWatchlist extends SpecialPage {
 
                $lang = $this->getLanguage();
                $wlInfo = '';
-               if( $values['days'] > 0 ) {
+               if ( $values['days'] > 0 ) {
                        $timestamp = wfTimestampNow();
                        $wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $values['days'] * 24 ) )->params(
                                $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
@@ -312,11 +312,11 @@ class SpecialWatchlist extends SpecialPage {
 
                # Spit out some control panel links
                $filters = array(
-                       'hideMinor'     => 'rcshowhideminor',
-                       'hideBots'              => 'rcshowhidebots',
-                       'hideAnons'     => 'rcshowhideanons',
-                       'hideLiu'               => 'rcshowhideliu',
-                       'hideOwn'               => 'rcshowhidemine',
+                       'hideMinor' => 'rcshowhideminor',
+                       'hideBots' => 'rcshowhidebots',
+                       'hideAnons' => 'rcshowhideanons',
+                       'hideLiu' => 'rcshowhideliu',
+                       'hideOwn' => 'rcshowhidemine',
                        'hidePatrolled' => 'rcshowhidepatr'
                );
                foreach ( $this->customFilters as $key => $params ) {
@@ -328,7 +328,7 @@ class SpecialWatchlist extends SpecialPage {
                }
 
                $links = array();
-               foreach( $filters as $name => $msg ) {
+               foreach ( $filters as $name => $msg ) {
                        $links[] = $this->showHideLink( $nondefaults, $msg, $name, $values[$name] );
                }
 
@@ -349,8 +349,8 @@ class SpecialWatchlist extends SpecialPage {
                                'all' => '',
                                'label' => $this->msg( 'namespace' )->text()
                        ), array(
-                               'name'  => 'namespace',
-                               'id'    => 'namespace',
+                               'name' => 'namespace',
+                               'id' => 'namespace',
                                'class' => 'namespaceselector',
                        )
                ) . '&#160;';
@@ -377,7 +377,7 @@ class SpecialWatchlist extends SpecialPage {
                $output->addHTML( $form );
 
                # If there's nothing to show, stop here
-               if( $numRows == 0 ) {
+               if ( $numRows == 0 ) {
                        $output->addWikiMsg( 'watchnochange' );
                        return;
                }
@@ -477,11 +477,11 @@ class SpecialWatchlist extends SpecialPage {
                $hours = array( 1, 2, 6, 12 );
                $days = array( 1, 3, 7 );
                $i = 0;
-               foreach( $hours as $h ) {
+               foreach ( $hours as $h ) {
                        $hours[$i++] = $this->hoursLink( $h, $options );
                }
                $i = 0;
-               foreach( $days as $d ) {
+               foreach ( $days as $d ) {
                        $days[$i++] = $this->daysLink( $d, $options );
                }
                return $this->msg( 'wlshowlast' )->rawParams(
index 57bb7d0..05c7dd5 100644 (file)
@@ -77,7 +77,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                $this->opts = $opts;
 
                $this->target = Title::newFromURL( $opts->getValue( 'target' ) );
-               if( !$this->target ) {
+               if ( !$this->target ) {
                        $out->addHTML( $this->whatlinkshereForm() );
                        return;
                }
@@ -111,7 +111,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                $hidetrans = $this->opts->getValue( 'hidetrans' );
                $hideimages = $target->getNamespace() != NS_FILE || $this->opts->getValue( 'hideimages' );
 
-               $fetchlinks = (!$hidelinks || !$hideredirs);
+               $fetchlinks = ( !$hidelinks || !$hideredirs );
 
                // Make the query
                $plConds = array(
@@ -119,9 +119,9 @@ class SpecialWhatLinksHere extends SpecialPage {
                        'pl_namespace' => $target->getNamespace(),
                        'pl_title' => $target->getDBkey(),
                );
-               if( $hideredirs ) {
+               if ( $hideredirs ) {
                        $plConds['rd_from'] = null;
-               } elseif( $hidelinks ) {
+               } elseif ( $hidelinks ) {
                        $plConds[] = 'rd_from is NOT NULL';
                }
 
@@ -166,7 +166,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                        'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL'
                )));
 
-               if( $fetchlinks ) {
+               if ( $fetchlinks ) {
                        $options['ORDER BY'] = 'pl_from';
                        $plRes = $dbr->select( array( 'pagelinks', 'page', 'redirect' ), $fields,
                                $plConds, __METHOD__, $options,
@@ -174,7 +174,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                        );
                }
 
-               if( !$hidetrans ) {
+               if ( !$hidetrans ) {
                        $options['ORDER BY'] = 'tl_from';
                        $tlRes = $dbr->select( array( 'templatelinks', 'page', 'redirect' ), $fields,
                                $tlConds, __METHOD__, $options,
@@ -182,7 +182,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                        );
                }
 
-               if( !$hideimages ) {
+               if ( !$hideimages ) {
                        $options['ORDER BY'] = 'il_from';
                        $ilRes = $dbr->select( array( 'imagelinks', 'page', 'redirect' ), $fields,
                                $ilConds, __METHOD__, $options,
@@ -190,13 +190,14 @@ class SpecialWhatLinksHere extends SpecialPage {
                        );
                }
 
-               if( ( !$fetchlinks || !$plRes->numRows() ) && ( $hidetrans || !$tlRes->numRows() ) && ( $hideimages || !$ilRes->numRows() ) ) {
+               if ( ( !$fetchlinks || !$plRes->numRows() ) && ( $hidetrans || !$tlRes->numRows() ) && ( $hideimages || !$ilRes->numRows() ) ) {
                        if ( 0 == $level ) {
                                $out->addHTML( $this->whatlinkshereForm() );
 
                                // Show filters only if there are links
-                               if( $hidelinks || $hidetrans || $hideredirs || $hideimages )
+                               if ( $hidelinks || $hidetrans || $hideredirs || $hideimages ) {
                                        $out->addHTML( $this->getFilterPanel() );
+                               }
 
                                $errMsg = is_int( $namespace ) ? 'nolinkshere-ns' : 'nolinkshere';
                                $out->addWikiMsg( $errMsg, $this->target->getPrefixedText() );
@@ -207,21 +208,21 @@ class SpecialWhatLinksHere extends SpecialPage {
                // Read the rows into an array and remove duplicates
                // templatelinks comes second so that the templatelinks row overwrites the
                // pagelinks row, so we get (inclusion) rather than nothing
-               if( $fetchlinks ) {
+               if ( $fetchlinks ) {
                        foreach ( $plRes as $row ) {
                                $row->is_template = 0;
                                $row->is_image = 0;
                                $rows[$row->page_id] = $row;
                        }
                }
-               if( !$hidetrans ) {
+               if ( !$hidetrans ) {
                        foreach ( $tlRes as $row ) {
                                $row->is_template = 1;
                                $row->is_image = 0;
                                $rows[$row->page_id] = $row;
                        }
                }
-               if( !$hideimages ) {
+               if ( !$hideimages ) {
                        foreach ( $ilRes as $row ) {
                                $row->is_template = 0;
                                $row->is_image = 1;
@@ -272,7 +273,7 @@ class SpecialWhatLinksHere extends SpecialPage {
 
                $out->addHTML( $this->listEnd() );
 
-               if( $level == 0 ) {
+               if ( $level == 0 ) {
                        $out->addHTML( $prevnext );
                }
        }
@@ -295,7 +296,7 @@ class SpecialWhatLinksHere extends SpecialPage {
                        }
                }
 
-               if( $row->rd_from ) {
+               if ( $row->rd_from ) {
                        $query = array( 'redirect' => 'no' );
                } else {
                        $query = array();
@@ -311,12 +312,15 @@ class SpecialWhatLinksHere extends SpecialPage {
                // Display properties (redirect or template)
                $propsText = '';
                $props = array();
-               if ( $row->rd_from )
+               if ( $row->rd_from ) {
                        $props[] = $msgcache['isredirect'];
-               if ( $row->is_template )
+               }
+               if ( $row->is_template ) {
                        $props[] = $msgcache['istemplate'];
-               if( $row->is_image )
+               }
+               if ( $row->is_image ) {
                        $props[] = $msgcache['isimage'];
+               }
 
                if ( count( $props ) ) {
                        $propsText = $this->msg( 'parentheses' )->rawParams( implode( $msgcache['semicolon-separator'], $props ) )->escaped();
@@ -337,8 +341,9 @@ class SpecialWhatLinksHere extends SpecialPage {
 
        protected function wlhLink( Title $target, $text ) {
                static $title = null;
-               if ( $title === null )
+               if ( $title === null ) {
                        $title = $this->getTitle();
+               }
 
                return Linker::linkKnown(
                        $title,
@@ -422,8 +427,8 @@ class SpecialWhatLinksHere extends SpecialPage {
                                'all' => '',
                                'label' => $this->msg( 'namespace' )->text()
                        ), array(
-                               'name'  => 'namespace',
-                               'id'    => 'namespace',
+                               'name' => 'namespace',
+                               'id' => 'namespace',
                                'class' => 'namespaceselector',
                        )
                );
@@ -453,12 +458,13 @@ class SpecialWhatLinksHere extends SpecialPage {
 
                $links = array();
                $types = array( 'hidetrans', 'hidelinks', 'hideredirs' );
-               if( $this->target->getNamespace() == NS_FILE )
+               if ( $this->target->getNamespace() == NS_FILE ) {
                        $types[] = 'hideimages';
+               }
 
                // Combined message keys: 'whatlinkshere-hideredirs', 'whatlinkshere-hidetrans', 'whatlinkshere-hidelinks', 'whatlinkshere-hideimages'
                // To be sure they will be found by grep
-               foreach( $types as $type ) {
+               foreach ( $types as $type ) {
                        $chosen = $this->opts->getValue( $type );
                        $msg = $chosen ? $show : $hide;
                        $overrides = array( $type => !$chosen );
index c18c963..9d23499 100644 (file)
@@ -44,7 +44,7 @@ class WithoutInterwikiPage extends PageQueryPage {
                global $wgScript;
 
                # Do not show useless input form if special page is cached
-               if( $this->isCached() ) {
+               if ( $this->isCached() ) {
                        return '';
                }
 
index dff9ada..28b5d79 100644 (file)
@@ -46,12 +46,12 @@ class UsercreateTemplate extends QuickTemplate {
        function execute() {
                if ( $this->data['message'] ) {
 ?>
-       <div class="<?php $this->text('messagetype') ?>box">
+       <div class="<?php $this->text( 'messagetype' ); ?>box">
 <?php
                        if ( $this->data['messagetype'] == 'error' ) {
-                               ?><strong><?php $this->msg( 'loginerror' ) ?></strong><br /><?php
+                               ?><strong><?php $this->msg( 'loginerror' ); ?></strong><br /><?php
                        }
-                       $this->html('message');
+                       $this->html( 'message' );
 ?>
        </div>
        <div class="visualClear"></div>
@@ -62,10 +62,10 @@ class UsercreateTemplate extends QuickTemplate {
 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
 <div id="userlogin">
 
-<form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
-       <h2><?php $this->msg('createaccount') ?></h2>
-       <p id="userloginlink"><?php $this->html('link') ?></p>
-       <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
+<form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text( 'action' ); ?>">
+       <h2><?php $this->msg( 'createaccount' ); ?></h2>
+       <p id="userloginlink"><?php $this->html( 'link' ); ?></p>
+       <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
 <?php
        if ( $this->haveData( 'languages' ) ) {
                ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php
@@ -73,7 +73,7 @@ class UsercreateTemplate extends QuickTemplate {
 ?>
        <table>
                <tr>
-                       <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
+                       <td class="mw-label"><label for='wpName2'><?php $this->msg( 'yourname' ); ?></label></td>
                        <td class="mw-input">
                                <?php
                        echo Html::input( 'wpName', $this->data['name'], 'text', array(
@@ -103,7 +103,7 @@ class UsercreateTemplate extends QuickTemplate {
                        </td>
                </tr>
                <tr class="mw-row-password">
-                       <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
+                       <td class="mw-label"><label for='wpPassword2'><?php $this->msg( 'yourpassword' ); ?></label></td>
                        <td class="mw-input">
 <?php
                        echo Html::input( 'wpPassword', null, 'password', array(
@@ -122,9 +122,9 @@ class UsercreateTemplate extends QuickTemplate {
                }
 ?>
                <tr id="mw-user-domain-section">
-                       <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
+                       <td class="mw-label"><?php $this->msg( 'yourdomainname' ); ?></td>
                        <td class="mw-input">
-                               <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
+                               <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>"
                                        tabindex="4">
                                        <?php echo $doms ?>
                                </select>
@@ -134,7 +134,7 @@ class UsercreateTemplate extends QuickTemplate {
                }
 ?>
                <tr class="mw-row-password">
-                       <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
+                       <td class="mw-label"><label for='wpRetype'><?php $this->msg( 'yourpasswordagain' ); ?></label></td>
                        <td class="mw-input">
                                <?php
                echo Html::input( 'wpRetype', null, 'password', array(
@@ -149,7 +149,7 @@ class UsercreateTemplate extends QuickTemplate {
 <?php
                if ( $this->data['useemail'] ) {
 ?>
-                               <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
+                               <td class="mw-label"><label for='wpEmail'><?php $this->msg( 'youremail' ); ?></label></td>
                                <td class="mw-input">
                                        <?php
                echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
@@ -160,13 +160,13 @@ class UsercreateTemplate extends QuickTemplate {
                ) ); ?>
                                        <div class="prefsectiontip">
                                                <?php  // duplicated in Preferences.php profilePreferences()
-                                                       if( $this->data['emailrequired'] ) {
-                                                               $this->msgWiki('prefs-help-email-required');
+                                                       if ( $this->data['emailrequired'] ) {
+                                                               $this->msgWiki( 'prefs-help-email-required' );
                                                        } else {
-                                                               $this->msgWiki('prefs-help-email');
+                                                               $this->msgWiki( 'prefs-help-email' );
                                                        }
-                                                       if( $this->data['emailothers'] ) {
-                                                               $this->msgWiki('prefs-help-email-others');
+                                                       if ( $this->data['emailothers'] ) {
+                                                               $this->msgWiki( 'prefs-help-email-others' );
                                                        } ?>
                                        </div>
                                </td>
@@ -177,13 +177,13 @@ class UsercreateTemplate extends QuickTemplate {
 ?>
                                </tr>
                                <tr>
-                                       <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
+                                       <td class="mw-label"><label for='wpRealName'><?php $this->msg( 'yourrealname' ); ?></label></td>
                                        <td class="mw-input">
                                                <input type='text' class='loginText' name="wpRealName" id="wpRealName"
                                                        tabindex="7"
-                                                       value="<?php $this->text('realname') ?>" size='20' />
+                                                       value="<?php $this->text( 'realname' ); ?>" size='20' />
                                                <div class="prefsectiontip">
-                                                       <?php $this->msgWiki('prefs-help-realname'); ?>
+                                                       <?php $this->msgWiki( 'prefs-help-realname' ); ?>
                                                </div>
                                        </td>
 <?php
@@ -193,11 +193,11 @@ class UsercreateTemplate extends QuickTemplate {
 ?>
                                </tr>
                                <tr>
-                                       <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td>
+                                       <td class="mw-label"><label for='wpReason'><?php $this->msg( 'createaccountreason' ); ?></label></td>
                                        <td class="mw-input">
                                                <input type='text' class='loginText' name="wpReason" id="wpReason"
                                                        tabindex="8"
-                                                       value="<?php $this->text('reason') ?>" size='20' />
+                                                       value="<?php $this->text( 'reason' ); ?>" size='20' />
                                        </td>
 <?php
                }
@@ -233,13 +233,13 @@ class UsercreateTemplate extends QuickTemplate {
                                if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
                                        ?><td class="mw-label"><label for="<?php
                                        echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
-                                       $this->msgWiki( $inputItem['msg'] ) ?></label><?php
+                                       $this->msgWiki( $inputItem['msg'] ); ?></label><?php
                                } else {
                                        ?><td><?php
                                }
                        ?></td>
                        <td class="mw-input">
-                               <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
+                               <input type="<?php echo htmlspecialchars( $inputItem['type'] ); ?>" name="<?php
                                echo htmlspecialchars( $inputItem['name'] ); ?>"
                                        tabindex="<?php echo $tabIndex++; ?>"
                                        value="<?php
@@ -250,13 +250,14 @@ class UsercreateTemplate extends QuickTemplate {
                                }
                                        ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
                                        <?php
-                               if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
+                               if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) ) {
                                        echo 'checked="checked"';
+                               }
                                        ?> /> <?php
                                        if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
                                                ?>
                                <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
-                                       $this->msgHtml( $inputItem['msg'] ) ?></label><?php
+                                       $this->msgHtml( $inputItem['msg'] ); ?></label><?php
                                        }
                                if ( $inputItem['helptext'] !== false ) {
                                ?>
@@ -276,7 +277,7 @@ class UsercreateTemplate extends QuickTemplate {
                        <td class="mw-submit">
                                <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
                                        tabindex="<?php echo $tabIndex++; ?>"
-                                       value="<?php $this->msg('createaccount') ?>" />
+                                       value="<?php $this->msg( 'createaccount' ); ?>" />
                        </td>
                </tr>
        </table>
index 0b4b8e5..8c937a7 100644 (file)
@@ -33,13 +33,13 @@ class UserloginTemplate extends QuickTemplate {
        function execute() {
                if ( $this->data['message'] ) {
 ?>
-       <div class="<?php $this->text('messagetype') ?>box">
+       <div class="<?php $this->text( 'messagetype' ); ?>box">
                <?php
                if ( $this->data['messagetype'] == 'error' ) {
-                       ?><strong><?php $this->msg( 'loginerror' ) ?></strong><br /><?php
+                       ?><strong><?php $this->msg( 'loginerror' ); ?></strong><br /><?php
                }
                ?>
-               <?php $this->html('message') ?>
+               <?php $this->html( 'message' ); ?>
        </div>
        <div class="visualClear"></div><?php
 
@@ -47,11 +47,11 @@ class UserloginTemplate extends QuickTemplate {
 ?>
 <div id="loginstart"><?php $this->msgWiki( 'loginstart' ); ?></div>
 <div id="userloginForm">
-<form name="userlogin" method="post" action="<?php $this->text('action') ?>">
-       <h2><?php $this->msg('login') ?></h2>
-       <p id="userloginlink"><?php $this->html('link') ?></p>
-       <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
-       <div id="userloginprompt"><?php  $this->msgWiki('loginprompt') ?></div>
+<form name="userlogin" method="post" action="<?php $this->text( 'action' ); ?>">
+       <h2><?php $this->msg( 'login' ); ?></h2>
+       <p id="userloginlink"><?php $this->html( 'link' ); ?></p>
+       <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
+       <div id="userloginprompt"><?php  $this->msgWiki( 'loginprompt' ); ?></div>
 <?php
                if ( $this->haveData( 'languages' ) ) {
                        ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php
@@ -59,7 +59,7 @@ class UserloginTemplate extends QuickTemplate {
 ?>
        <table>
                <tr>
-                       <td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
+                       <td class="mw-label"><label for='wpName1'><?php $this->msg( 'yourname' ); ?></label></td>
                        <td class="mw-input">
                                <?php
                        echo Html::input( 'wpName', $this->data['name'], 'text', array(
@@ -75,7 +75,7 @@ class UserloginTemplate extends QuickTemplate {
                        </td>
                </tr>
                <tr>
-                       <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
+                       <td class="mw-label"><label for='wpPassword1'><?php $this->msg( 'yourpassword' ); ?></label></td>
                        <td class="mw-input">
                                <?php
                        echo Html::input( 'wpPassword', null, 'password', array(
index 2e90c09..a944c0a 100644 (file)
@@ -32,29 +32,29 @@ class UserloginTemplateVForm extends BaseTemplate {
 <div class="mw-ui-container">
        <?php
        // Some extensions including CAPTCHAs add content to header on UserLoginForm hook.
-       $this->html('header');
-       if( $this->haveData( 'languages' ) ) {
+       $this->html( 'header' );
+       if ( $this->haveData( 'languages' ) ) {
        ?>
                <div id="languagelinks">
-                       <p><?php $this->html('languages' ); ?></p>
+                       <p><?php $this->html( 'languages' ); ?></p>
                </div>
        <?php
        }
        ?>
 <div id="userloginForm">
-<form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text('action') ?>">
+<form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
        <?php
 
-       if( $this->data['message'] ) {
+       if ( $this->data['message'] ) {
        ?>
-               <div class="<?php $this->text('messagetype') ?>box">
+               <div class="<?php $this->text( 'messagetype' ); ?>box">
                <?php
                if ( $this->data['messagetype'] == 'error' ) {
                ?>
                        <strong><?php $this->msg( 'loginerror' )?></strong><br />
                <?php
                }
-               $this->html('message')
+               $this->html( 'message' );
                ?>
                </div>
        <?php
@@ -92,7 +92,7 @@ class UserloginTemplateVForm extends BaseTemplate {
                <div>
                        <label for='wpPassword1'>
                        <?php
-                       $this->msg('userlogin-yourpassword');
+                       $this->msg( 'userlogin-yourpassword' );
 
                        if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
                                echo Linker::link(
@@ -122,28 +122,28 @@ class UserloginTemplateVForm extends BaseTemplate {
                        ?>
                </div>
        <?php
-       if( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
+       if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
                $doms = "";
-               foreach( $this->data['domainnames'] as $dom ) {
+               foreach ( $this->data['domainnames'] as $dom ) {
                        $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
                }
        ?>
                <div id="mw-user-domain-section">
-                       <label for='wpDomain' class="pos-above"><?php $this->msg( 'yourdomain' ) ?></label>
-                               <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
+                       <label for='wpDomain' class="pos-above"><?php $this->msg( 'yourdomain' ); ?></label>
+                               <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>"
                                        tabindex="3">
                                        <?php echo $doms ?>
                                </select>
                </div>
        <?php }
 
-       if( $this->haveData( 'extrafields' ) ) {
+       if ( $this->haveData( 'extrafields' ) ) {
                echo $this->data['extrafields'];
        } ?>
 
                <div>
 
-       <?php if( $this->data['canremember'] ) { ?>
+       <?php if ( $this->data['canremember'] ) { ?>
                <label class="mw-ui-checkbox-label">
                        <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
                                <?php if ( $this->data['remember'] ) {
@@ -155,7 +155,7 @@ class UserloginTemplateVForm extends BaseTemplate {
        <?php } ?>
                </div>
 
-       <?php if( $this->data['cansecurelogin'] ) { ?>
+       <?php if ( $this->data['cansecurelogin'] ) { ?>
                <div>
                        <label class="mw-ui-checkbox-label">
                                <input name="wpStickHTTPS" type="checkbox" value="1" id="wpStickHTTPS" tabindex="5"
@@ -177,16 +177,16 @@ class UserloginTemplateVForm extends BaseTemplate {
                        ?>
                </div>
                <div id="mw-userlogin-help">
-                       <?php echo $this->getMsg( 'userlogin-helplink' )->parse() ?>
+                       <?php echo $this->getMsg( 'userlogin-helplink' )->parse(); ?>
                </div>
-               <?php if( $this->haveData( 'createOrLoginHref' ) ) { ?>
+               <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
                        <div id="mw-createaccount-cta">
-                               <h3 id="mw-userloginlink"><?php $this->msg( 'userlogin-noaccount' ) ?><a href="<?php $this->text( 'createOrLoginHref' ) ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button mw-ui-constructive"><?php $this->msg( 'userlogin-joinproject' ) ?></a></h3>
+                               <h3 id="mw-userloginlink"><?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button mw-ui-constructive"><?php $this->msg( 'userlogin-joinproject' ); ?></a></h3>
                        </div>
                <?php } ?>
        <input type="hidden" id="mw-useNew" name="useNew" value="1" />
-<?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
-<?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
+<?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
+<?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
 </form>
 </div>
 </div>
index c98c445..6a31582 100644 (file)
@@ -83,7 +83,7 @@ abstract class UploadBase {
                        self::WINDOWS_NONASCII_FILENAME => 'windows-nonascii-filename',
                        self::FILENAME_TOO_LONG => 'filename-toolong',
                );
-               if( isset( $code_to_status[$error] ) ) {
+               if ( isset( $code_to_status[$error] ) ) {
                        return $code_to_status[$error];
                }
 
@@ -136,7 +136,7 @@ abstract class UploadBase {
        public static function createFromRequest( &$request, $type = null ) {
                $type = $type ? $type : $request->getVal( 'wpSourceType', 'File' );
 
-               if( !$type ) {
+               if ( !$type ) {
                        return null;
                }
 
@@ -149,18 +149,18 @@ abstract class UploadBase {
                if ( is_null( $className ) ) {
                        $className = 'UploadFrom' . $type;
                        wfDebug( __METHOD__ . ": class name: $className\n" );
-                       if( !in_array( $type, self::$uploadHandlers ) ) {
+                       if ( !in_array( $type, self::$uploadHandlers ) ) {
                                return null;
                        }
                }
 
                // Check whether this upload class is enabled
-               if( !call_user_func( array( $className, 'isEnabled' ) ) ) {
+               if ( !call_user_func( array( $className, 'isEnabled' ) ) ) {
                        return null;
                }
 
                // Check whether the request is valid
-               if( !call_user_func( array( $className, 'isValidRequest' ), $request ) ) {
+               if ( !call_user_func( array( $className, 'isValidRequest' ), $request ) ) {
                        return null;
                }
 
@@ -275,7 +275,7 @@ abstract class UploadBase {
                /**
                 * If there was no filename or a zero size given, give up quick.
                 */
-               if( $this->isEmptyFile() ) {
+               if ( $this->isEmptyFile() ) {
                        wfProfileOut( __METHOD__ );
                        return array( 'status' => self::EMPTY_FILE );
                }
@@ -284,7 +284,7 @@ abstract class UploadBase {
                 * Honor $wgMaxUploadSize
                 */
                $maxSize = self::getMaxUploadSize( $this->getSourceType() );
-               if( $this->mFileSize > $maxSize ) {
+               if ( $this->mFileSize > $maxSize ) {
                        wfProfileOut( __METHOD__ );
                        return array(
                                'status' => self::FILE_TOO_LARGE,
@@ -298,7 +298,7 @@ abstract class UploadBase {
                 * probably not accept it.
                 */
                $verification = $this->verifyFile();
-               if( $verification !== true ) {
+               if ( $verification !== true ) {
                        wfProfileOut( __METHOD__ );
                        return array(
                                'status' => self::VERIFICATION_ERROR,
@@ -310,13 +310,13 @@ abstract class UploadBase {
                 * Make sure this file can be created
                 */
                $result = $this->validateName();
-               if( $result !== true ) {
+               if ( $result !== true ) {
                        wfProfileOut( __METHOD__ );
                        return $result;
                }
 
                $error = '';
-               if( !wfRunHooks( 'UploadVerification',
+               if ( !wfRunHooks( 'UploadVerification',
                        array( $this->mDestName, $this->mTempPath, &$error ) ) )
                {
                        wfProfileOut( __METHOD__ );
@@ -335,9 +335,9 @@ abstract class UploadBase {
         **/
        public function validateName() {
                $nt = $this->getTitle();
-               if( is_null( $nt ) ) {
+               if ( is_null( $nt ) ) {
                        $result = array( 'status' => $this->mTitleError );
-                       if( $this->mTitleError == self::ILLEGAL_FILENAME ) {
+                       if ( $this->mTitleError == self::ILLEGAL_FILENAME ) {
                                $result['filtered'] = $this->mFilteredName;
                        }
                        if ( $this->mTitleError == self::FILETYPE_BADTYPE ) {
@@ -421,12 +421,12 @@ abstract class UploadBase {
 
                # check for htmlish code and javascript
                if ( !$wgDisableUploadScriptChecks ) {
-                       if( self::detectScript( $this->mTempPath, $mime, $this->mFinalExtension ) ) {
+                       if ( self::detectScript( $this->mTempPath, $mime, $this->mFinalExtension ) ) {
                                wfProfileOut( __METHOD__ );
                                return array( 'uploadscripted' );
                        }
-                       if( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
-                               if( $this->detectScriptInSvg( $this->mTempPath ) ) {
+                       if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
+                               if ( $this->detectScriptInSvg( $this->mTempPath ) ) {
                                        wfProfileOut( __METHOD__ );
                                        return array( 'uploadscripted' );
                                }
@@ -532,7 +532,7 @@ abstract class UploadBase {
                 * to modify it by uploading a new revision.
                 */
                $nt = $this->getTitle();
-               if( is_null( $nt ) ) {
+               if ( is_null( $nt ) ) {
                        return true;
                }
                $permErrors = $nt->getUserPermissionsErrors( 'edit', $user );
@@ -542,7 +542,7 @@ abstract class UploadBase {
                } else {
                        $permErrorsCreate = array();
                }
-               if( $permErrors || $permErrorsUpload || $permErrorsCreate ) {
+               if ( $permErrors || $permErrorsUpload || $permErrorsCreate ) {
                        $permErrors = array_merge( $permErrors, wfArrayDiff2( $permErrorsUpload, $permErrors ) );
                        $permErrors = array_merge( $permErrors, wfArrayDiff2( $permErrorsCreate, $permErrors ) );
                        return $permErrors;
@@ -579,7 +579,7 @@ abstract class UploadBase {
                $comparableName = str_replace( ' ', '_', $this->mDesiredDestName );
                $comparableName = Title::capitalize( $comparableName, NS_FILE );
 
-               if( $this->mDesiredDestName != $filename && $comparableName != $filename ) {
+               if ( $this->mDesiredDestName != $filename && $comparableName != $filename ) {
                        $warnings['badfilename'] = $filename;
                }
 
@@ -602,7 +602,7 @@ abstract class UploadBase {
                }
 
                $exists = self::getExistsWarning( $localFile );
-               if( $exists !== false ) {
+               if ( $exists !== false ) {
                        $warnings['exists'] = $exists;
                }
 
@@ -612,11 +612,11 @@ abstract class UploadBase {
                $title = $this->getTitle();
                // Remove all matches against self
                foreach ( $dupes as $key => $dupe ) {
-                       if( $title->equals( $dupe->getTitle() ) ) {
+                       if ( $title->equals( $dupe->getTitle() ) ) {
                                unset( $dupes[$key] );
                        }
                }
-               if( $dupes ) {
+               if ( $dupes ) {
                        $warnings['duplicate'] = $dupes;
                }
 
@@ -654,7 +654,7 @@ abstract class UploadBase {
                        $user
                );
 
-               if( $status->isGood() ) {
+               if ( $status->isGood() ) {
                        if ( $watch ) {
                                $user->addWatch( $this->getLocalFile()->getTitle() );
                        }
@@ -701,7 +701,7 @@ abstract class UploadBase {
                $this->mFilteredName = wfStripIllegalFilenameChars( $this->mFilteredName );
                /* Normalize to title form before we do any further processing */
                $nt = Title::makeTitleSafe( NS_FILE, $this->mFilteredName );
-               if( is_null( $nt ) ) {
+               if ( is_null( $nt ) ) {
                        $this->mTitleError = self::ILLEGAL_FILENAME;
                        return $this->mTitle = null;
                }
@@ -713,7 +713,7 @@ abstract class UploadBase {
                 */
                list( $partname, $ext ) = $this->splitExtensions( $this->mFilteredName );
 
-               if( count( $ext ) ) {
+               if ( count( $ext ) ) {
                        $this->mFinalExtension = trim( $ext[count( $ext ) - 1] );
                } else {
                        $this->mFinalExtension = '';
@@ -761,13 +761,13 @@ abstract class UploadBase {
 
                # If there was more than one "extension", reassemble the base
                # filename to prevent bogus complaints about length
-               if( count( $ext ) > 1 ) {
-                       for( $i = 0; $i < count( $ext ) - 1; $i++ ) {
+               if ( count( $ext ) > 1 ) {
+                       for ( $i = 0; $i < count( $ext ) - 1; $i++ ) {
                                $partname .= '.' . $ext[$i];
                        }
                }
 
-               if( strlen( $partname ) < 1 ) {
+               if ( strlen( $partname ) < 1 ) {
                        $this->mTitleError = self::MIN_LENGTH_PARTNAME;
                        return $this->mTitle = null;
                }
@@ -781,7 +781,7 @@ abstract class UploadBase {
         * @return LocalFile|null
         */
        public function getLocalFile() {
-               if( is_null( $this->mLocalFile ) ) {
+               if ( is_null( $this->mLocalFile ) ) {
                        $nt = $this->getTitle();
                        $this->mLocalFile = is_null( $nt ) ? null : wfLocalFile( $nt );
                }
@@ -894,7 +894,7 @@ abstract class UploadBase {
        public static function verifyExtension( $mime, $extension ) {
                $magic = MimeMagic::singleton();
 
-               if ( !$mime || $mime == 'unknown' || $mime == 'unknown/unknown' )
+               if ( !$mime || $mime == 'unknown' || $mime == 'unknown/unknown' ) {
                        if ( !$magic->isRecognizableExtension( $extension ) ) {
                                wfDebug( __METHOD__ . ": passing file with unknown detected mime type; " .
                                        "unrecognized extension '$extension', can't verify\n" );
@@ -904,13 +904,14 @@ abstract class UploadBase {
                                        "recognized extension '$extension', so probably invalid file\n" );
                                return false;
                        }
+               }
 
                $match = $magic->isMatchingExtension( $extension, $mime );
 
                if ( $match === null ) {
                        wfDebug( __METHOD__ . ": no file extension known for mime type $mime, passing file\n" );
                        return true;
-               } elseif( $match === true ) {
+               } elseif ( $match === true ) {
                        wfDebug( __METHOD__ . ": mime type $mime matches extension $extension, passing file\n" );
 
                        #TODO: if it's a bitmap, make sure PHP or ImageMagic resp. can handle it!
@@ -940,7 +941,7 @@ abstract class UploadBase {
                # ugly hack: for text files, always look at the entire file.
                # For binary field, just check the first K.
 
-               if( strpos( $mime, 'text/' ) === 0 ) {
+               if ( strpos( $mime, 'text/' ) === 0 ) {
                        $chunk = file_get_contents( $file );
                } else {
                        $fp = fopen( $file, 'rb' );
@@ -950,21 +951,21 @@ abstract class UploadBase {
 
                $chunk = strtolower( $chunk );
 
-               if( !$chunk ) {
+               if ( !$chunk ) {
                        wfProfileOut( __METHOD__ );
                        return false;
                }
 
                # decode from UTF-16 if needed (could be used for obfuscation).
-               if( substr( $chunk, 0, 2 ) == "\xfe\xff" ) {
+               if ( substr( $chunk, 0, 2 ) == "\xfe\xff" ) {
                        $enc = 'UTF-16BE';
-               } elseif( substr( $chunk, 0, 2 ) == "\xff\xfe" ) {
+               } elseif ( substr( $chunk, 0, 2 ) == "\xff\xfe" ) {
                        $enc = 'UTF-16LE';
                } else {
                        $enc = null;
                }
 
-               if( $enc ) {
+               if ( $enc ) {
                        $chunk = iconv( $enc, "ASCII//IGNORE", $chunk );
                }
 
@@ -1005,12 +1006,12 @@ abstract class UploadBase {
                        '<table'
                );
 
-               if( !$wgAllowTitlesInSVG && $extension !== 'svg' && $mime !== 'image/svg' ) {
+               if ( !$wgAllowTitlesInSVG && $extension !== 'svg' && $mime !== 'image/svg' ) {
                        $tags[] = '<title';
                }
 
-               foreach( $tags as $tag ) {
-                       if( false !== strpos( $chunk, $tag ) ) {
+               foreach ( $tags as $tag ) {
+                       if ( false !== strpos( $chunk, $tag ) ) {
                                wfDebug( __METHOD__ . ": found something that may make it be mistaken for html: $tag\n" );
                                wfProfileOut( __METHOD__ );
                                return true;
@@ -1025,21 +1026,21 @@ abstract class UploadBase {
                $chunk = Sanitizer::decodeCharReferences( $chunk );
 
                # look for script-types
-               if( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) ) {
+               if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) ) {
                        wfDebug( __METHOD__ . ": found script types\n" );
                        wfProfileOut( __METHOD__ );
                        return true;
                }
 
                # look for html-style script-urls
-               if( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
+               if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
                        wfDebug( __METHOD__ . ": found html-style script urls\n" );
                        wfProfileOut( __METHOD__ );
                        return true;
                }
 
                # look for css-style script-urls
-               if( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
+               if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) {
                        wfDebug( __METHOD__ . ": found css-style script urls\n" );
                        wfProfileOut( __METHOD__ );
                        return true;
@@ -1071,77 +1072,77 @@ abstract class UploadBase {
                /*
                 * check for elements that can contain javascript
                 */
-               if( $strippedElement == 'script' ) {
+               if ( $strippedElement == 'script' ) {
                        wfDebug( __METHOD__ . ": Found script element '$element' in uploaded file.\n" );
                        return true;
                }
 
                # e.g., <svg xmlns="http://www.w3.org/2000/svg"> <handler xmlns:ev="http://www.w3.org/2001/xml-events" ev:event="load">alert(1)</handler> </svg>
-               if( $strippedElement == 'handler' ) {
+               if ( $strippedElement == 'handler' ) {
                        wfDebug( __METHOD__ . ": Found scriptable element '$element' in uploaded file.\n" );
                        return true;
                }
 
                # SVG reported in Feb '12 that used xml:stylesheet to generate javascript block
-               if( $strippedElement == 'stylesheet' ) {
+               if ( $strippedElement == 'stylesheet' ) {
                        wfDebug( __METHOD__ . ": Found scriptable element '$element' in uploaded file.\n" );
                        return true;
                }
 
-               foreach( $attribs as $attrib => $value ) {
+               foreach ( $attribs as $attrib => $value ) {
                        $stripped = $this->stripXmlNamespace( $attrib );
                        $value = strtolower( $value );
 
-                       if( substr( $stripped, 0, 2 ) == 'on' ) {
+                       if ( substr( $stripped, 0, 2 ) == 'on' ) {
                                wfDebug( __METHOD__ . ": Found event-handler attribute '$attrib'='$value' in uploaded file.\n" );
                                return true;
                        }
 
                        # href with javascript target
-                       if( $stripped == 'href' && strpos( strtolower( $value ), 'javascript:' ) !== false ) {
+                       if ( $stripped == 'href' && strpos( strtolower( $value ), 'javascript:' ) !== false ) {
                                wfDebug( __METHOD__ . ": Found script in href attribute '$attrib'='$value' in uploaded file.\n" );
                                return true;
                        }
 
                        # href with embedded svg as target
-                       if( $stripped == 'href' && preg_match( '!data:[^,]*image/svg[^,]*,!sim', $value ) ) {
+                       if ( $stripped == 'href' && preg_match( '!data:[^,]*image/svg[^,]*,!sim', $value ) ) {
                                wfDebug( __METHOD__ . ": Found href to embedded svg \"<$strippedElement '$attrib'='$value'...\" in uploaded file.\n" );
                                return true;
                        }
 
                        # href with embedded (text/xml) svg as target
-                       if( $stripped == 'href' && preg_match( '!data:[^,]*text/xml[^,]*,!sim', $value ) ) {
+                       if ( $stripped == 'href' && preg_match( '!data:[^,]*text/xml[^,]*,!sim', $value ) ) {
                                wfDebug( __METHOD__ . ": Found href to embedded svg \"<$strippedElement '$attrib'='$value'...\" in uploaded file.\n" );
                                return true;
                        }
 
                        # use set/animate to add event-handler attribute to parent
-                       if( ( $strippedElement == 'set' || $strippedElement == 'animate' ) && $stripped == 'attributename' && substr( $value, 0, 2 ) == 'on' ) {
+                       if ( ( $strippedElement == 'set' || $strippedElement == 'animate' ) && $stripped == 'attributename' && substr( $value, 0, 2 ) == 'on' ) {
                                wfDebug( __METHOD__ . ": Found svg setting event-handler attribute with \"<$strippedElement $stripped='$value'...\" in uploaded file.\n" );
                                return true;
                        }
 
                        # use set to add href attribute to parent element
-                       if( $strippedElement == 'set' && $stripped == 'attributename' && strpos( $value, 'href' ) !== false ) {
+                       if ( $strippedElement == 'set' && $stripped == 'attributename' && strpos( $value, 'href' ) !== false ) {
                                wfDebug( __METHOD__ . ": Found svg setting href attribute '$value' in uploaded file.\n" );
                                return true;
                        }
 
                        # use set to add a remote / data / script target to an element
-                       if( $strippedElement == 'set' && $stripped == 'to' && preg_match( '!(http|https|data|script):!sim', $value ) ) {
+                       if ( $strippedElement == 'set' && $stripped == 'to' && preg_match( '!(http|https|data|script):!sim', $value ) ) {
                                wfDebug( __METHOD__ . ": Found svg setting attribute to '$value' in uploaded file.\n" );
                                return true;
                        }
 
                        # use handler attribute with remote / data / script
-                       if( $stripped == 'handler' && preg_match( '!(http|https|data|script):!sim', $value ) ) {
+                       if ( $stripped == 'handler' && preg_match( '!(http|https|data|script):!sim', $value ) ) {
                                wfDebug( __METHOD__ . ": Found svg setting handler with remote/data/script '$attrib'='$value' in uploaded file.\n" );
                                return true;
                        }
 
                        # use CSS styles to bring in remote code
                        # catch url("http:..., url('http:..., url(http:..., but not url("#..., url('#..., url(#....
-                       if( $stripped == 'style' && preg_match_all( '!((?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*["\']?\s*[^#]+.*?\))!sim', $value, $matches ) ) {
+                       if ( $stripped == 'style' && preg_match_all( '!((?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*["\']?\s*[^#]+.*?\))!sim', $value, $matches ) ) {
                                foreach ( $matches[1] as $match ) {
                                        if ( !preg_match( '!(?:font|clip-path|fill|filter|marker|marker-end|marker-mid|marker-start|mask|stroke)\s*:\s*url\s*\(\s*(#|\'#|"#)!sim', $match ) ) {
                                                wfDebug( __METHOD__ . ": Found svg setting a style with remote url '$attrib'='$value' in uploaded file.\n" );
@@ -1151,7 +1152,7 @@ abstract class UploadBase {
                        }
 
                        # image filters can pull in url, which could be svg that executes scripts
-                       if( $strippedElement == 'image' && $stripped == 'filter' && preg_match( '!url\s*\(!sim', $value ) ) {
+                       if ( $strippedElement == 'image' && $stripped == 'filter' && preg_match( '!url\s*\(!sim', $value ) ) {
                                wfDebug( __METHOD__ . ": Found image filter with url: \"<$strippedElement $stripped='$value'...\" in uploaded file.\n" );
                                return true;
                        }
@@ -1281,8 +1282,8 @@ abstract class UploadBase {
        private function checkOverwrite( $user ) {
                // First check whether the local file can be overwritten
                $file = $this->getLocalFile();
-               if( $file->exists() ) {
-                       if( !self::userCanReUpload( $user, $file ) ) {
+               if ( $file->exists() ) {
+                       if ( !self::userCanReUpload( $user, $file ) ) {
                                return array( 'fileexists-forbidden', $file->getName() );
                        } else {
                                return true;
@@ -1308,13 +1309,13 @@ abstract class UploadBase {
         * @return Boolean
         */
        public static function userCanReUpload( User $user, $img ) {
-               if( $user->isAllowed( 'reupload' ) ) {
+               if ( $user->isAllowed( 'reupload' ) ) {
                        return true; // non-conditional
                }
-               if( !$user->isAllowed( 'reupload-own' ) ) {
+               if ( !$user->isAllowed( 'reupload-own' ) ) {
                        return false;
                }
-               if( is_string( $img ) ) {
+               if ( is_string( $img ) ) {
                        $img = wfLocalFile( $img );
                }
                if ( !( $img instanceof LocalFile ) ) {
@@ -1336,11 +1337,11 @@ abstract class UploadBase {
         * @return mixed False if the file does not exists, else an array
         */
        public static function getExistsWarning( $file ) {
-               if( $file->exists() ) {
+               if ( $file->exists() ) {
                        return array( 'warning' => 'exists', 'file' => $file );
                }
 
-               if( $file->getTitle()->getArticleID() ) {
+               if ( $file->getTitle()->getArticleID() ) {
                        return array( 'warning' => 'page-exists', 'file' => $file );
                }
 
@@ -1348,7 +1349,7 @@ abstract class UploadBase {
                        return array( 'warning' => 'was-deleted', 'file' => $file );
                }
 
-               if( strpos( $file->getName(), '.' ) == false ) {
+               if ( strpos( $file->getName(), '.' ) == false ) {
                        $partname = $file->getName();
                        $extension = '';
                } else {
@@ -1367,7 +1368,7 @@ abstract class UploadBase {
                        $nt_lc = Title::makeTitle( NS_FILE, "{$partname}.{$normalizedExtension}" );
                        $file_lc = wfLocalFile( $nt_lc );
 
-                       if( $file_lc->exists() ) {
+                       if ( $file_lc->exists() ) {
                                return array(
                                        'warning' => 'exists-normalized',
                                        'file' => $file,
@@ -1391,7 +1392,7 @@ abstract class UploadBase {
                        # Check for filenames like 50px- or 180px-, these are mostly thumbnails
                        $nt_thb = Title::newFromText( substr( $partname, strpos( $partname, '-' ) + 1 ) . '.' . $extension, NS_FILE );
                        $file_thb = wfLocalFile( $nt_thb );
-                       if( $file_thb->exists() ) {
+                       if ( $file_thb->exists() ) {
                                return array(
                                        'warning' => 'thumb',
                                        'file' => $file,
@@ -1407,7 +1408,7 @@ abstract class UploadBase {
                        }
                }
 
-               foreach( self::getFilenamePrefixBlacklist() as $prefix ) {
+               foreach ( self::getFilenamePrefixBlacklist() as $prefix ) {
                        if ( substr( $partname, 0, strlen( $prefix ) ) == $prefix ) {
                                return array(
                                        'warning' => 'bad-prefix',
@@ -1443,9 +1444,9 @@ abstract class UploadBase {
        public static function getFilenamePrefixBlacklist() {
                $blacklist = array();
                $message = wfMessage( 'filename-prefix-blacklist' )->inContentLanguage();
-               if( !$message->isDisabled() ) {
+               if ( !$message->isDisabled() ) {
                        $lines = explode( "\n", $message->plain() );
-                       foreach( $lines as $line ) {
+                       foreach ( $lines as $line ) {
                                // Remove comment lines
                                $comment = substr( trim( $line ), 0, 1 );
                                if ( $comment == '#' || $comment == '' ) {
index 7e07516..37db688 100644 (file)
@@ -41,16 +41,16 @@ class UploadFromChunks extends UploadFromFile {
                // user object. sometimes this won't exist, as when running from cron.
                $this->user = $user;
 
-               if( $repo ) {
+               if ( $repo ) {
                        $this->repo = $repo;
                } else {
                        $this->repo = RepoGroup::singleton()->getLocalRepo();
                }
 
-               if( $stash ) {
+               if ( $stash ) {
                        $this->stash = $stash;
                } else {
-                       if( $user ) {
+                       if ( $user ) {
                                wfDebug( __METHOD__ . " creating new UploadFromChunks instance for " . $user->getId() . "\n" );
                        } else {
                                wfDebug( __METHOD__ . " creating new UploadFromChunks instance with no user\n" );
@@ -112,7 +112,7 @@ class UploadFromChunks extends UploadFromFile {
                // Concatenate all the chunks to mVirtualTempPath
                $fileList = Array();
                // The first chunk is stored at the mVirtualTempPath path so we start on "chunk 1"
-               for( $i = 0; $i <= $this->getChunkIndex(); $i++ ) {
+               for ( $i = 0; $i <= $this->getChunkIndex(); $i++ ) {
                        $fileList[] = $this->getVirtualChunkLocation( $i );
                }
 
@@ -127,7 +127,7 @@ class UploadFromChunks extends UploadFromFile {
                $tStart = microtime( true );
                $status = $this->repo->concatenate( $fileList, $tmpPath, FileRepo::DELETE_SOURCE );
                $tAmount = microtime( true ) - $tStart;
-               if( !$status->isOk() ) {
+               if ( !$status->isOk() ) {
                        return $status;
                }
                wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds.\n" );
@@ -190,7 +190,7 @@ class UploadFromChunks extends UploadFromFile {
                                // Update local chunk index for the current chunk
                                $this->mChunkIndex++;
                                $status = $this->outputChunk( $chunkPath );
-                               if( $status->isGood() ) {
+                               if ( $status->isGood() ) {
                                        // Update local offset:
                                        $this->mOffset = $preAppendOffset + $chunkSize;
                                        // Update chunk table status db
@@ -257,7 +257,7 @@ class UploadFromChunks extends UploadFromFile {
         * @return Integer index of the current chunk
         */
        private function getChunkIndex() {
-               if( $this->mChunkIndex !== null ) {
+               if ( $this->mChunkIndex !== null ) {
                        return $this->mChunkIndex;
                }
                return 0;
@@ -307,7 +307,7 @@ class UploadFromChunks extends UploadFromFile {
        }
 
        private function getChunkFileKey( $index = null ) {
-               if( $index === null ) {
+               if ( $index === null ) {
                        $index = $this->getChunkIndex();
                }
                return $this->mFileKey . '.' . $index;
index ab2a7a3..a00ed32 100644 (file)
@@ -40,7 +40,7 @@ class UploadFromFile extends UploadBase {
        function initializeFromRequest( &$request ) {
                $upload = $request->getUpload( 'wpUploadFile' );
                $desiredDestName = $request->getText( 'wpDestFile' );
-               if( !$desiredDestName ) {
+               if ( !$desiredDestName ) {
                        $desiredDestName = $upload->getName();
                }
 
index fd2416d..9276b53 100644 (file)
@@ -45,16 +45,16 @@ class UploadFromStash extends UploadBase {
                // user object. sometimes this won't exist, as when running from cron.
                $this->user = $user;
 
-               if( $repo ) {
+               if ( $repo ) {
                        $this->repo = $repo;
                } else {
                        $this->repo = RepoGroup::singleton()->getLocalRepo();
                }
 
-               if( $stash ) {
+               if ( $stash ) {
                        $this->stash = $stash;
                } else {
-                       if( $user ) {
+                       if ( $user ) {
                                wfDebug( __METHOD__ . " creating new UploadStash instance for " . $user->getId() . "\n" );
                        } else {
                                wfDebug( __METHOD__ . " creating new UploadStash instance with no user\n" );
index 150e516..c99feef 100644 (file)
@@ -77,7 +77,7 @@ class UploadFromUrl extends UploadBase {
                        return false;
                }
                $valid = false;
-               foreach( $wgCopyUploadsDomains as $domain ) {
+               foreach ( $wgCopyUploadsDomains as $domain ) {
                        // See if the domain for the upload matches this whitelisted domain
                        $whitelistedDomainPieces = explode( '.', $domain );
                        $uploadDomainPieces = explode( '.', $parsedUrl['host'] );
@@ -172,7 +172,7 @@ class UploadFromUrl extends UploadBase {
                        return Status::newFatal( 'http-invalid-url' );
                }
 
-               if( !self::isAllowedHost( $this->mUrl ) ) {
+               if ( !self::isAllowedHost( $this->mUrl ) ) {
                        return Status::newFatal( 'upload-copy-upload-invalid-domain' );
                }
                if ( !$this->mAsync ) {
index a90fecf..1ee4627 100644 (file)
@@ -338,7 +338,7 @@ class UploadStash {
                        __METHOD__
                );
 
-               if( !$row ) {
+               if ( !$row ) {
                        throw new UploadStashNoSuchKeyException( "No such key ($key), cannot remove" );
                }
 
@@ -454,7 +454,7 @@ class UploadStash {
        protected function fetchFileMetadata( $key, $readFromDB = DB_SLAVE ) {
                // populate $fileMetadata[$key]
                $dbr = null;
-               if( $readFromDB === DB_MASTER ) {
+               if ( $readFromDB === DB_MASTER ) {
                        // sometimes reading from the master is necessary, if there's replication lag.
                        $dbr = $this->repo->getMasterDb();
                } else {
index e3b3147..20b8103 100644 (file)
@@ -60,7 +60,7 @@ $specialPageAliases = array(
 $messages = array(
 # User preference toggles
 'tog-underline' => 'Sorrayar enllaces:',
-'tog-justify' => 'Xustificar parágrafos',
+'tog-justify' => 'Xustificar párrafos',
 'tog-hideminor' => 'Anubrir les ediciones menores nos cambeos recientes',
 'tog-hidepatrolled' => 'Anubrir les ediciones vixilaes nos cambeos recientes',
 'tog-newpageshidepatrolled' => 'Anubrir les páxines vixilaes na llista de páxines nueves',
@@ -383,11 +383,11 @@ La postrer consulta a la base de datos que s'intentó foi:
 <blockquote><code>$1</code></blockquote>
 dende la función «<code>$2</code>».
 La base datos dio'l fallu «<samp>$3: $4</samp>».",
-'dberrortextcl' => "Hebo un fallu de sintaxis nuna consulta a la base de datos.
-La postrer consulta de la base de datos que s'intentó foi:
+'dberrortextcl' => "Hebo un error de sintaxis nuna consulta a la base de datos.
+La última consulta a la base de datos que s'intentó foi:
 «$1»
 dende la función «$2».
-La base de datos dio'l fallu «$3: $4».",
+La base de datos devolvió l'error «$3: $4».",
 'laggedslavemode' => "'''Avisu:''' Esta páxina pue que nun tenga actualizaciones recientes.",
 'readonly' => 'Base de datos candada',
 'enterlockreason' => 'Introduz un motivu pal candáu, amestando una estimación de cuándo va tener llugar el descandáu',
@@ -401,7 +401,7 @@ Esto débese davezu a siguir una \"dif\" caducada o un enllaz d'historial a una
 Si esti nun ye'l casu, seique tengas atopao un bug nel software.
 Por favor informa d'esto a un [[Special:ListUsers/sysop|alministrador]], anotando la URL.",
 'missingarticle-rev' => '(núm. revisión: $1)',
-'missingarticle-diff' => '(dif: $1, $2)',
+'missingarticle-diff' => '(Diff: $1, $2)',
 'readonly_lag' => 'La base de datos candóse automáticamente mentes los sirvidores de la base de datos esclava se sincronicen cola maestra',
 'internalerror' => 'Fallu internu',
 'internalerror_info' => 'Fallu internu: $1',
@@ -412,7 +412,7 @@ Por favor informa d'esto a un [[Special:ListUsers/sysop|alministrador]], anotand
 'filedeleteerror' => 'Nun se pudo desaniciar el ficheru «$1».',
 'directorycreateerror' => 'Nun se pudo crear el direutoriu «$1».',
 'filenotfound' => 'Nun se pudo atopar el ficheru «$1».',
-'fileexistserror' => 'Nun se pue escribir nel archivu «$1»: yá esiste',
+'fileexistserror' => 'Nun se pue escribir nel ficheru «$1»: yá esiste',
 'unexpected' => 'Valor inesperáu: «$1»=«$2».',
 'formerror' => 'Fallu: Nun se pudo unviar el formulariu.',
 'badarticleerror' => 'Esta aición nun pue facese nesta páxina.',
@@ -432,7 +432,7 @@ Estos datos nun van refrescase nestos momentos.",
 Función: $1<br />
 Consulta: $2',
 'viewsource' => 'Ver fonte',
-'viewsource-title' => 'Ver la fonte de «$1»',
+'viewsource-title' => 'Ver la fonte de $1',
 'actionthrottled' => 'Aición llendada',
 'actionthrottledtext' => 'Como midida anti-spam, nun se pue repetir esta aición munches vegaes en pocu tiempu, y trespasasti esi llímite.
 Por favor vuelvi intentalo nunos minutos.',
@@ -642,7 +642,7 @@ Tendría d'aniciar sesión y escoyer una contraseña nueva agora. Si esta solici
 Clave provisional: $2",
 'passwordreset-emailsent' => 'Unvióse un corréu electrónicu pa reaniciar la contraseña.',
 'passwordreset-emailsent-capture' => "Unvióse un corréu electrónicu pa reaniciar la contraseña, que s'amuesa abaxo.",
-'passwordreset-emailerror-capture' => "Unvióse un corréu electrónicu pa reaniciar la contraseña, que s'amuesa abaxo, pero falló l'unviu al usuariu: $1",
+'passwordreset-emailerror-capture' => "Unvióse un corréu electrónicu pa reaniciar la contraseña, que s'amuesa abaxo, pero falló l'unviu {{GENDER:$2|al usuariu|a la usuaria}}: $1",
 
 # Special:ChangeEmail
 'changeemail' => 'Camudar la direición de corréu electrónicu',
index 54815c8..16bdb47 100644 (file)
@@ -540,7 +540,7 @@ Dae malingaw na liwaton an saimong [[Special:Preferences|{{SITENAME}} mga kamuya
 'gotaccount' => 'Igwa ka na tabi nin panindog? $1.',
 'gotaccountlink' => 'Maglaog',
 'userlogin-resetlink' => 'Nakalingaw ka sa panlaog mong detalye?',
-'helplogin-url' => 'Tabang:Paglalaog',
+'helplogin-url' => 'Help:Paglalaog',
 'userlogin-helplink' => '[[{{MediaWiki:helplogin-url}}|Tabang sa paglalaog]]',
 'createaccountmail' => 'Gumamit nin sarong random na temporaryong sekretong panlaog asin ipadara ini sa adres kan e-surat na pinaghaya sa ibaba',
 'createaccountreason' => 'Rason:',
@@ -667,7 +667,7 @@ Ika dapat na maglaog asin magpili nin sarong bagong sekretong panlaog ngunyan. K
 Temporaryong sekretong panlaog: $2',
 'passwordreset-emailsent' => 'Sarong e-surat sa pagliliwat kan sekretong panlaog an ipinadara na.',
 'passwordreset-emailsent-capture' => 'Sarong e-surat sa pagliliwat kan sekretong panlaog an ipinadara na, yaon ipinapahiling sa ibaba.',
-'passwordreset-emailerror-capture' => 'Sarong e-surat sa pagliliwat kan sekretong panlaog an pinaghimo na,yaon ipinapahiling sa ibaba, alagad sa pagpapadara kaini sa paragamit nagpalya: $1',
+'passwordreset-emailerror-capture' => 'Sarong e-surat sa pagliliwat kan sekretong panlaog an pinagpuyos na, yaon ipinapahiling sa ibaba, alagad sa pagpapadara kaini sa {{GENDER:$2|paragamit}} nagpalya: $1',
 
 # Special:ChangeEmail
 'changeemail' => 'Ribayan an e-koreong address',
index a4169b4..3243c2a 100644 (file)
@@ -2513,6 +2513,17 @@ $1',
 
 '''সতর্কীকরণ!'''
 কোন জনপ্রিয় পাতার ক্ষেত্রে এই পরিবর্তনটি খুবই আকস্মিক হতে পারে; অগ্রসর হবার আগে এই কাজটির ফলাফল কী হতে পারে, সে ব্যাপারে অনুগ্রহ করে নিশ্চিত হোন।",
+'movepagetext-noredirectfixer' => "নিচের ফর্মটি ব্যবহার করে একটি পাতার শিরোনাম পরিবর্তন করা যাবে, এবং সেই সাথে নতুন শিরোনামে এর সমগ্র ইতিহাস স্থানান্তর করা যাবে।
+পুরনো শিরোনামটি নতুন শিরোনামটির প্রতি একটি পুনর্নির্দেশনা ধারণ করবে।
+[[Special:DoubleRedirects|দ্বি-পুনর্নির্দেশনা]] বা [[Special:BrokenRedirects|অচল পুনর্নির্দেশনাগুলি]] পরীক্ষা করে দেখতে ভুলবেন না।
+সংযোগগুলি যাতে তাদের লক্ষ্যে পৌঁছায়, তা নিশ্চিত করার দায়িত্ব আপনার।
+
+লক্ষ্য করুন যে যদি নতুন শিরোনামে ইতিমধ্যেই একটি পাতা থেকে থাকে, তবে উৎস পাতাটি সেই শিরোনামে স্থানান্তর করা হবে '''না''', যদি না নতুন শিরোনামের পাতাটি খালি থাকে বা একটি পুননির্দেশনা হয় এবং এর কোন অতীত সম্পাদনা ইতিহাস না থাকে। 
+অর্থাৎ আপনি ভুল করে নাম পরিবর্তন করলে সহজেই পুরনো নামে ফেরত যেতে পারবেন, কিন্তু ইতিমধ্যে বিদ্যমান কোন পাতার উপরে লিখতে পারবেন না।
+
+'''সতর্কীকরণ!'''
+কোন জনপ্রিয় পাতার ক্ষেত্রে এই পরিবর্তনটি খুবই আকস্মিক হতে পারে;
+অগ্রসর হবার আগে এই কাজটির ফলাফল কী হতে পারে, সে ব্যাপারে অনুগ্রহ করে নিশ্চিত হোন।",
 'movepagetalktext' => "পাতাটির সাথে সাথে সংশ্লিষ্ট আলোচনা পাতাটিও স্বয়ংক্রিয়ভাবে সরানো হবে '''যদি না:'''
 *খালি নয় এমন একটি আলাপ পাতা নতুন শিরোনামটির অধীনে ইতিমধ্যেই বিদ্যমান থাকে, অথবা
 *আপনি নিচের বাক্সটি থেকে টিক সরিয়ে নিতে পারেন।
index 0c4ecfa..99712bf 100644 (file)
@@ -17,6 +17,7 @@
  * @author Gemmaa
  * @author Grondin
  * @author Iradigalesc
+ * @author Jmarchn
  * @author Jordi Roqué
  * @author Juanpabl
  * @author Kaganer
@@ -329,7 +330,7 @@ $messages = array(
 'about' => 'Quant a',
 'article' => 'Pàgina de contingut',
 'newwindow' => '(obre en una nova finestra)',
-'cancel' => 'Cancel·lar',
+'cancel' => 'Cancel·la',
 'moredotdotdot' => 'Més...',
 'morenotlisted' => 'Més no en la llista...',
 'mypage' => 'Pàgina',
@@ -1251,6 +1252,7 @@ Es pot trobar més informació en el [{{fullurl:{{#Special:Log}}/delete|page={{F
 'powersearch-togglenone' => 'Cap',
 'search-external' => 'Cerca externa',
 'searchdisabled' => 'La cerca dins el projecte {{SITENAME}} està inhabilitada. Mentrestant, podeu cercar a través de Google, però tingueu en compte que la seua base de dades no estarà actualitzada.',
+'search-error' => "S'ha produït un error durant la recerca: $1",
 
 # Preferences page
 'preferences' => 'Preferències',
index 99681ba..0aa0345 100644 (file)
@@ -1343,7 +1343,7 @@ Ujistěte se, že tato změna udrží souvislost a posloupnost verzí v historii
 'mergelogpagetext' => 'Níže je seznam nejnovějších sloučení historie jedné stránky s jinou.',
 
 # Diffs
-'history-title' => '$1: Historie verzí',
+'history-title' => 'Historie verzí stránky „$1“',
 'difference-title' => '$1: Porovnání verzí',
 'difference-title-multipage' => '$1 a $2: Porovnání stránek',
 'difference-multipage' => '(Rozdíly mezi stránkami)',
index c24bf1c..02bef10 100644 (file)
@@ -672,7 +672,7 @@ Dylech fewngofnodi nawr a dewis cyfrinair newydd. Os mai rhywun arall a ofynodd
 Y cyfrinair dros dro: $2",
 'passwordreset-emailsent' => 'Anfonwyd e-bost i ailosod eich cyfrinair atoch.',
 'passwordreset-emailsent-capture' => "Anfonwyd e-bost i ailosod cyfrinair, ac fe'i ddangosir isod.",
-'passwordreset-emailerror-capture' => "Lluniwyd e-bost i ailosod cyfrinair fel ag a welir isod, ond ni lwyddwyd i'w anfon at y defnyddiwr: $1",
+'passwordreset-emailerror-capture' => "Lluniwyd e-bost i ailosod cyfrinair fel ag a welir isod, ond ni lwyddwyd i'w anfon at y {{GENDER:$2|defnyddiwr}}: $1",
 
 # Special:ChangeEmail
 'changeemail' => 'Newid y cyfeiriad e-bost',
index e803c12..fcf0de5 100644 (file)
@@ -1739,7 +1739,7 @@ Dies kann nicht mehr rückgängig gemacht werden.',
 'action-rollback' => 'die Änderungen des letzten Bearbeiters einer bestimmten Seite schnell zurückzusetzen',
 'action-import' => 'Seiten aus einem anderen Wiki zu importieren',
 'action-importupload' => 'Seiten über das Hochladen einer Datei zu importieren',
-'action-patrol' => 'die Bearbeitungen anderer Benutzer zu kontrollieren',
+'action-patrol' => 'Bearbeitungen anderer Benutzer als kontrolliert zu markieren',
 'action-autopatrol' => 'eigene Bearbeitungen als kontrolliert zu markieren',
 'action-unwatchedpages' => 'die Liste der unbeobachteten Seiten einzusehen',
 'action-mergehistory' => 'die Versionengeschichten von Seiten zu vereinen',
index 4e3d6d8..8baae84 100644 (file)
@@ -476,7 +476,7 @@ $messages = array(
 'vector-view-view' => 'Bıwane',
 'vector-view-viewsource' => 'Çımey bıvêne',
 'actions' => 'Kerdışi',
-'namespaces' => 'Cayê namam',
+'namespaces' => 'Cayê namey',
 'variants' => 'Varyanti',
 
 'navigation-heading' => 'Menuya Navigasyoni',
@@ -1430,7 +1430,7 @@ Etıya şıma rê yew kılito raştameo ke şıma şenê bıgurenê/bıxebetnê:
 'timezoneregion-pacific' => 'Okyanuso Pasifik',
 'allowemail' => 'Karberê bini wa bışê mı rê e-posta bırışê.',
 'prefs-searchoptions' => 'Cı geyre',
-'prefs-namespaces' => 'Cayê namam',
+'prefs-namespaces' => 'Cayê namey',
 'defaultns' => 'Eke heni, enê cayanê namey de cı geyre (sae ke):',
 'default' => 'qısur',
 'prefs-files' => 'Dosyey',
@@ -2227,7 +2227,7 @@ hem zi bıewnê [[Special:WantedCategories|kategori yê ke waziyeni]].',
 # Special:LinkSearch
 'linksearch' => 'Gıreyê teberi cı geyrê',
 'linksearch-pat' => 'bıgêr motif:',
-'linksearch-ns' => 'Cayênameyî:',
+'linksearch-ns' => 'Cayê namey:',
 'linksearch-ok' => 'Cı geyre',
 'linksearch-text' => 'Jokeri ê zey "*.wikipedia.org"i benê ke bıgureniyê.
 Tewr senık yew sewiya serêna cayê tesiri lazıma, mesela "*.org".<br />
index bd997aa..d144573 100644 (file)
@@ -930,7 +930,7 @@ ignorar este mensaje y continuar usando tu contraseña anterior.',
 Contraseña temporal: $2',
 'passwordreset-emailsent' => 'Se ha enviado un correo electrónico para el restablecimiento de tu contraseña.',
 'passwordreset-emailsent-capture' => 'Se ha enviado un correo para el restablecimiento de la contraseña, el cual se muestra a continuación.',
-'passwordreset-emailerror-capture' => 'Se generó un correo electrónico de restablecimiento de contraseña, que se muestra a continuación, pero el envío al usuario falló: $1',
+'passwordreset-emailerror-capture' => 'Se generó un correo electrónico de restablecimiento de contraseña, que se muestra a continuación, pero el envío {{GENDER:$2|al usuario|a la usuaria}} falló. $1',
 
 # Special:ChangeEmail
 'changeemail' => 'Cambiar la dirección de correo electrónico',
index e59596f..3227fe3 100644 (file)
@@ -929,7 +929,7 @@ $2
 임시 비밀번호: $2',
 'passwordreset-emailsent' => '비밀번호 재설정 이메일을 보냈습니다.',
 'passwordreset-emailsent-capture' => '비밀번호 재설정 이메일이 발송되었으며, 아래에 나타나 있습니다.',
-'passwordreset-emailerror-capture' => '비밀번호 재설정 이메일이 ë§\8cë\93¤ì\96´ì ¸ ì\95\84ë\9e\98ì\97\90 ë\82\98í\83\80ë\82¬ì§\80ë§\8c ë°\9cì\86¡í\95\98ë\8a\94 ë\8d°ì\97\90ë\8a\94 ì\8b¤í\8c¨í\96\88ì\8aµë\8b\88ë\8b¤: $1',
+'passwordreset-emailerror-capture' => '비밀번호 재설정 이메일이 ì\83\9dì\84±ë\90\98ì\96´ ì\95\84ë\9e\98ì\97\90 í\91\9cì\8b\9cë\90\98ì\96´ ì\9e\88ì§\80ë§\8c, {{GENDER:$2|ì\82¬ì\9a©ì\9e\90}}ì\97\90ê²\8c ë°\9cì\86¡í\95\98ë\8a\94 ë\8d°ì\97\90ë\8a\94 ì\8b¤í\8c¨í\96\88ì\8aµë\8b\88ë\8b¤: $1',
 
 # Special:ChangeEmail
 'changeemail' => '이메일 주소 바꾸기',
index 45aa8d8..dd9d1ae 100644 (file)
@@ -2004,7 +2004,7 @@ Wann ene Metmaacher ußjesöhk es, kritt mer bloß die Dateie, di dä Metmaacher
 'listfiles_user' => 'Metmaacher',
 'listfiles_size' => 'Byte',
 'listfiles_description' => 'Wat en dä Datei dren schtisch',
-'listfiles_count' => 'Versione',
+'listfiles_count' => 'Väsjohne',
 
 # File description page
 'file-anchor-link' => 'Datei',
@@ -3999,7 +3999,7 @@ De könnts Ding Oppassliss ävver och [[Special:EditWatchlist|övver e Fomulaa m
 Dä Shtanndat-Zoot-Schlößel „$1“ övverschriif dä älldere Zoot-Schlößel „$2“.",
 
 # Special:Version
-'version' => 'Version vun de Wiki Soffwär zeije',
+'version' => 'Väsjohn vun de Wiki Soffwär zeije',
 'version-extensions' => 'Installeete Erjänzunge un Zohsätz',
 'version-specialpages' => '{{int:nstab-special}}e',
 'version-parserhooks' => 'De Parser-Hooke',
@@ -4027,7 +4027,7 @@ MediaWiki weed verdeilt met dä Hoffnung, dat et för jet jood es, ävver <span
 Do sullts en [{{SERVER}}{{SCRIPTPATH}}/COPYING Kopie vun dä <i lang="en">GNU General Public License</i>] zosamme met däm Projramm krääje han, un wann nit, schrief aan de: <i lang="en">Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA </i> udder [//www.gnu.org/licenses/old-licenses/gpl-2.0.html liß se em Internet noh].',
 'version-software' => 'Installeete Soffwäer',
 'version-software-product' => 'Produk',
-'version-software-version' => 'Version',
+'version-software-version' => 'Väsjohn',
 'version-entrypoints' => '<i lang="en>URLs</i> för enzeschteije',
 'version-entrypoints-header-entrypoint' => 'Enschteesch',
 'version-entrypoints-header-url' => '<i lang="en">URL</i>',
index ba467b5..99b4249 100644 (file)
@@ -748,7 +748,7 @@ Dir sollt Iech aloggen an een neit Passwuert festleeën. Wann een Aneren déi Uf
 Temporärt Passwuert: $2',
 'passwordreset-emailsent' => "Eng Mail fir d'Passwuert zréckzesetze gouf geschéckt.",
 'passwordreset-emailsent-capture' => "Eng Mail fir d'Passwuert zréckzesetze gouf geschéckt, Dir gesitt se hei drënner.",
-'passwordreset-emailerror-capture' => "Eng Mail fir d'Passwuert zréckzesetze gouf geschéckt, Dir gesitt se hei drënner, awer de Benotzer konnt se net kréien: $1",
+'passwordreset-emailerror-capture' => "Eng Mail fir d'Passwuert zréckzesetze gouf geschéckt, Dir gesitt se hei drënner, awer de {{GENDER:$2|Benotzer}} konnt se net kréien: $1",
 
 # Special:ChangeEmail
 'changeemail' => 'Mailadress änneren',
@@ -2202,6 +2202,7 @@ All weider Ännerungen op dëser Säit an der assoziéierter Diskussiounssäit g
 'enotif_subject_restored' => "D'{{SITENAME}}-Säit $1 gouf vum {{gender:$2|$2}} restauréiert",
 'enotif_subject_changed' => "D'{{SITENAME}}-Säit $1 gouf vum {{gender:$2|$2}} geännert",
 'enotif_body_intro_deleted' => 'D\'{{SITENAME}}-Säit $1 gouf de(n) $PAGEEDITDATE {{gender:$2|vum $2|vun der $2}} geläscht, kuckt $3.',
+'enotif_body_intro_created' => 'D\'{{SITENAME}}-Säit $1 gouf den $PAGEEDITDATE vum $2 {{GENDER:$2|ugeluecht}}, kuckt $3 fir déi aktuell Versioun.',
 'enotif_lastvisited' => 'All Ännerungen op ee Bléck: $1',
 'enotif_lastdiff' => 'Kuckt $1 fir dës Ännerung.',
 'enotif_anon_editor' => 'Anonyme Benotzer $1',
index 2786312..7375533 100644 (file)
@@ -129,15 +129,15 @@ $messages = array(
 'tog-underline' => 'Sottolineâ i collegamenti',
 'tog-justify' => 'Alliniamento di paragrafi giustificòu',
 'tog-hideminor' => 'asconde e modifiche minori inte ùrtime modifiche',
-'tog-hidepatrolled' => 'Ascondi e modifiche verific inte ùrtime modifiche',
-'tog-newpageshidepatrolled' => 'Ascondi e paggine verifiché da-o elenco de paggine ciù reçenti',
-'tog-extendwatchlist' => 'mostrâ tùtte e modifiche a-i òsserve speciali',
+'tog-hidepatrolled' => 'Ascondi e modifiche verificæ inte ùrtime modifiche',
+'tog-newpageshidepatrolled' => "Ascondi e paggine verificæ da  l'elenco de paggine ciù reçenti",
+'tog-extendwatchlist' => "mostra tùtte e modifiche a-i osservæ speciali, non solo l'urtima",
 'tog-usenewrc' => 'Ammuggia pe paggina e modifiche in urtime modifiche e sotta oservaçion (serve o Javascript)',
 'tog-numberheadings' => 'Nùmeraçion aotomàtica di tìtoli de seçión',
-'tog-showtoolbar' => 'Fâ vedde a barra de strumenti de modìffica (con JavaScript)',
-'tog-editondblclick' => 'Modifica e paggine co-o dópio clic (serve Javascrpt)',
+'tog-showtoolbar' => 'Fanni vedde a barra di strumenti de modìffica (serve JavaScript)',
+'tog-editondblclick' => 'Modifica e paggine co-o doggio clic (serve Javascrpt)',
 'tog-editsection' => 'Modifica e seçión co-o colegamento [modifica]',
-'tog-editsectiononrightclick' => 'Modifica e seçión co-o clic destro in sciô tìtolo (serve Javascipt)',
+'tog-editsectiononrightclick' => 'Modifica e seçión co-o clic drito in sciô tìtolo (serve Javascipt)',
 'tog-showtoc' => "Fanni védde l'indiçe pe-e pàgine con ciù de 3 seçioìn",
 'tog-rememberpassword' => "Arregorda a mæ paròlla d'ordine (a-o màscimo pe $1 {{PLURAL:$1|day|days}})",
 'tog-watchcreations' => 'Azonzi e paggine che creo e i file che carrego a-i oservæ speciâli',
@@ -155,11 +155,26 @@ $messages = array(
 'tog-shownumberswatching' => "Mostra o numero di utenti che tegnan d'oeuggio sta pagina",
 'tog-oldsig' => 'Firma attuale:',
 'tog-fancysig' => 'Tratta a firma comme wikitesto (sensa un collegamento aotomatico)',
+'tog-showjumplinks' => 'Attiva i collegamenti d\'accescibilitæ "sata a"',
+'tog-uselivepreview' => "Doeuvia l'anteprimma in diretta (ghe voeu o JavaScript)(sperimentâ)",
+'tog-watchlisthideown' => "Ascondi e mæ modiffiche da-a lista che tegno d'oeuggio",
+'tog-watchlisthidebots' => "Ascondi e modiffiche di bot da-a lista che tegno d'oeuggio",
+'tog-watchlisthideminor' => "Ascondi e modiffiche menoî da-a lista che tegno d'oeuggio",
+'tog-watchlisthideliu' => "Ascondi e modiffiche di utenti intræ da-a lista che tegno d'oeuggio",
+'tog-watchlisthideanons' => "Ascondi e modiffiche di utenti anonnimi da-a lista che tegno d'oeuggio",
+'tog-watchlisthidepatrolled' => "Ascondi e modiffiche za controllæ da-a lista che tegno d'oeuggio",
+'tog-ccmeonemails' => "Mandime 'na coppia de e-mail che mando a-i atri utenti",
+'tog-diffonly' => 'No mostrâ o contegnuo da paggina sotta o confronto tra verscioin',
 'tog-showhiddencats' => 'Fa vedde e categorîe ascose',
+'tog-norollbackdiff' => "Ometti o confronto tra verscioin doppo ch'ho fæto o ripristino",
+'tog-useeditwarning' => "Avertime se lascio 'na paggina de modiffica sens'avei sarvou i cangi",
 
 'underline-always' => 'Sempre',
 'underline-never' => 'Mâi',
 
+# Font style option in Special:Preferences
+'editfont-style' => "Stile do carattere de l'aera de modiffica",
+
 # Dates
 'sunday' => 'Domenega',
 'monday' => 'Lunedì',
@@ -225,15 +240,19 @@ $messages = array(
 'category-article-count' => "{{PLURAL:$2|Questa categoria a contegne solo sta pagina chì.|Questa categoria a contegne {{PLURAL:$1|a pagina indicâ|e $1 pagine indicæ}} chì de sotta , insce 'n totale de $2.}}",
 'category-article-count-limited' => "'Sta categorîa a contegne {{PLURAL:$1|'sta paggina|'ste $1 paggine}}.",
 'category-file-count' => "{{PLURAL:$2|Sta categoria a contegne sôlo sto file.|{{PLURAL:$1|Sto file o l'é|Sti $1 file son}} inte sta categoria, pe in totale de $2.}}",
+'category-file-count-limited' => 'Questa categoria a contegne {{PLURAL:$1|o file indicao|i $1 file indicæ}} chi de sotta.',
 'listingcontinuesabbrev' => 'cont.',
+'index-category' => 'Paggine indiçizzæ',
 'noindex-category' => 'Pàgine sénsa indiçe',
+'broken-file-category' => 'Paggine con di colegamenti a di file che no ghe son',
 
 'about' => 'Informaçioìn',
 'article' => 'Pagina de i contenùi',
 'newwindow' => "(O s'arve inte 'n âtro barcon)",
 'cancel' => 'Scancella',
 'moredotdotdot' => 'De ciû...',
-'mypage' => 'A mea pagina',
+'morenotlisted' => 'Atro...',
+'mypage' => 'Paggina',
 'mytalk' => 'Discuscioin',
 'anontalk' => 'Discuscion pe questo indirisso IP',
 'navigation' => 'Navegaçión',
@@ -241,17 +260,21 @@ $messages = array(
 
 # Cologne Blue skin
 'qbfind' => 'Attrêuva',
+'qbbrowse' => 'Navvega',
 'qbedit' => 'Cangia',
 'qbpageoptions' => "Opsioîn de 'sta paggina",
 'qbmyoptions' => 'E mæ paggine',
 'qbspecialpages' => 'Pagine speçiä',
 'faq' => 'Domande frequenti',
+'faqpage' => 'Project:Domande frequente',
 
 # Vector skin
 'vector-action-addsection' => 'Azónzi discusción',
 'vector-action-delete' => 'Scancella',
 'vector-action-move' => 'Mescia',
 'vector-action-protect' => 'Protezi',
+'vector-action-undelete' => 'Recuppera',
+'vector-action-unprotect' => 'Cangia a proteçion',
 'vector-view-create' => 'Crea',
 'vector-view-edit' => 'Càngia',
 'vector-view-history' => 'Fanni védde a Stöia',
@@ -261,6 +284,7 @@ $messages = array(
 'namespaces' => 'Namespaces',
 'variants' => 'Diferense',
 
+'navigation-heading' => 'Menu de navegaçion',
 'errorpagetitle' => 'Erô',
 'returnto' => 'Torna a $1.',
 'tagline' => 'Da {{SITENAME}}',
@@ -271,6 +295,7 @@ $messages = array(
 'searcharticle' => 'Vanni',
 'history' => 'Stöia da pàgina',
 'history_short' => 'Stöia',
+'updatedmarker' => 'modificâ da-a mæ urtima vixita',
 'printableversion' => 'Verscion da stanpâ',
 'permalink' => 'Ingancio fisso',
 'print' => 'Stampa',
@@ -280,31 +305,45 @@ $messages = array(
 'create-this-page' => "Crea 'sta paggina",
 'delete' => 'Scancella',
 'deletethispage' => "Scassa 'sta paggina",
+'undelete_short' => 'Recuppera {{PLURAL:$1|una revixon|$1 revixoin}}',
 'protect' => 'Protezi',
 'protect_change' => 'cangia',
 'protectthispage' => "Proteze 'sta paggina.",
 'unprotect' => 'Càngia proteçión',
 'unprotectthispage' => 'Càngia a proteçión de sta paggina',
 'newpage' => 'Nêuva pàgina',
-'talkpage' => 'Paggina de discûxon',
+'talkpage' => 'Paggina de discuscion',
 'talkpagelinktext' => 'Ciæti',
 'specialpage' => 'Pagina speçiâ',
 'personaltools' => 'Strùmenti personâli',
+'postcomment' => 'Noeuva seçion',
 'articlepage' => 'Veddi a voxe',
 'talk' => 'Ciæti',
 'views' => 'Vìxite',
 'toolbox' => 'Arneixi',
+'userpage' => 'Veddi a paggina utente',
 'projectpage' => 'Veddi a pagina de o progetto',
+'imagepage' => 'Vizualizza a paggina do file',
+'mediawikipage' => 'Vizualizza o messaggio',
+'templatepage' => 'Vizualizza o modello',
+'viewhelppage' => "Vizualizza a paggina d'agiutto",
+'categorypage' => 'Veddi a paggina da categoria',
 'viewtalkpage' => 'Veddi o ciæto',
 'otherlanguages' => 'In âtre lengóe',
 'redirectedfrom' => '(Rendirissou da $1)',
 'redirectpagesub' => 'Paggina de rindirissamento',
 'lastmodifiedat' => "Sta pagina a l'è stæta cangiâ l'urtima votta a e $2 do $1.",
 'viewcount' => "'Sta paggina a l'è stæta vista {{PLURAL:$1|solo 'na vòtta|$1 vòtte}}.",
-'protectedpage' => 'Paggina protea',
+'protectedpage' => 'Paggina protetta',
 'jumpto' => 'Vanni a:',
 'jumptonavigation' => 'Navegaçión',
 'jumptosearch' => 'çerca',
+'view-pool-error' => "Scuza ma a-o momento i server sono stracarreghi.
+Troppi utenti çercan d' amiâ sta paggina.
+Aspeta quarche menuto primma de çercâ torna d'accede a sta pagina.
+
+$1",
+'pool-errorunknown' => 'Aro sconosciuo',
 
 # All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations).
 'aboutsite' => 'Informaçioìn in sciô {{SITENAME}}',
@@ -328,13 +367,20 @@ $messages = array(
 
 'badaccess' => "No ti g'hæ o permisso",
 'badaccess-group0' => "No ti g'hæ o permisso pe fâ quest'assion.",
-'badaccess-groups' => "L'assion che ti vêu fâ a l'è permissa solo a i ûtenti de ûn di grûppi $1.",
+'badaccess-groups' => "L'assion che ti vêu fâ a l'è permissa solo a i ûtenti {{PLURAL:$2|do gruppo|de un de sti gruppi}}: $1.",
+
+'versionrequired' => 'Ghe voeu a verscion $1 de MediaWiki',
+'versionrequiredtext' => "Pe doeuviâ sta paggina ghe voeu a verscion $1 do software MediaWiki. Amia [[Special:Version|l'appoxita paggina]].",
 
 'ok' => "D'accòrdio",
 'retrievedfrom' => 'Estræto da "$1"',
 'youhavenewmessages' => "Ti gh'æ $1 ($2).",
 'newmessageslink' => 'Nêuvi messaggi',
 'newmessagesdifflink' => 'urtima modiffica',
+'youhavenewmessagesfromusers' => "Ti g'hæ $1 da {{PLURAL:$3|un atro utente|$3 utenti}} ($2).",
+'youhavenewmessagesmanyusers' => "Ti g'hæ $1 da tanti utenti ($2).",
+'newmessageslinkplural' => '{{PLURAL:$1|un noeuvo messaggio|noeuvi messaggi}}',
+'newmessagesdifflinkplural' => '{{PLURAL:$1|urtima modifica|urtime modifiche}}',
 'youhavenewmessagesmulti' => "Ti t'æ neuvi messaggi in scia $1",
 'editsection' => 'Càngia',
 'editold' => 'càngia',
@@ -345,30 +391,45 @@ $messages = array(
 'toc' => 'Indiçe',
 'showtoc' => 'Fâ vedde',
 'hidetoc' => 'Asconde',
+'collapsible-collapse' => 'Comprimmi',
+'collapsible-expand' => 'Espandi',
+'thisisdeleted' => 'Amia o ripristina $1?',
 'viewdeleted' => 'Vedde $1?',
+'restorelink' => '{{PLURAL:$1|una modifica scancelâ|$1 modifiche scancelæ}}',
+'feedlinks' => 'Feed:',
+'feed-invalid' => 'Modalitæ de sottoscriçion do feed non vallida.',
 'site-rss-feed' => 'Feed RSS de $1',
 'site-atom-feed' => 'Feed Atom de $1',
 'page-rss-feed' => 'Feed RSS pe "$1"',
 'page-atom-feed' => 'Feed Atom pe "$1"',
 'red-link-title' => '$1 (ancon da scrîve)',
+'sort-descending' => 'Ordine decrescente',
+'sort-ascending' => 'Ordine crescente',
 
 # Short words for each namespace, by default used in the namespace tab in monobook
 'nstab-main' => 'Pàgina',
 'nstab-user' => 'Utente',
+'nstab-media' => 'File murtimediâ',
 'nstab-special' => 'Pàgina speçiâ',
 'nstab-project' => 'Paggina de servissio',
 'nstab-image' => 'Archivio',
+'nstab-mediawiki' => 'Messaggio',
 'nstab-template' => 'Template',
 'nstab-help' => 'Agiûtto',
 'nstab-category' => 'Categorîa',
 
 # Main script and global functions
-'nosuchactiontext' => "L'URL a no corisponde a 'n comando reconosciûo da-o software MediaWiki",
+'nosuchaction' => 'No se poeu',
+'nosuchactiontext' => "L'açion specificâ inta URL a no l'è vallida.
+O che t'hæ scrito mâ, o che donque l'ea sbaliou o colegamento.
+O magara gh'è 'na cammoa into software doeuviou da {{SITENAME}}.",
+'nosuchspecialpage' => "Sta paggina speciale a no gh'è",
 
 # General errors
 'error' => 'Errô',
 'databaseerror' => 'Errô da a base de i dæti',
 'readonly' => 'Database bloccòu',
+'enterlockreason' => "Scrivi o motivo do blocco, e 'na stimma de quande o saiâ rimosso",
 'missing-article' => "O database o no l'à trovòu o testo di 'na pàgina che ghe saiêiva dovûa êse  co-o nómme de \"\$1\" \$2.
 
 Spésse vòtte questo o sucede quande a vegne riciamâ, da stöia ò dò-u confronto tra revixioìn, in colegaménto a 'na pàgina scancelâ, a in confronto tra revixioìn che no ghe son ciù ò a in confronto tra revixioìn sénsa ciù a stöia.
@@ -387,6 +448,11 @@ Pe favô ti peu segnalâ quello che l'é sucesso a in [[Special:ListUsers/sysop|
 'viewsource' => 'Veddi a fonte',
 'protectedpagetext' => "'Sta paggina a l'è stæta protezûa pe impedîghe a modiffica.",
 'viewsourcetext' => "O l'è poscibbile vedde e copiâ o còddice sorgente de 'sta paggina:",
+'ns-specialprotected' => 'No se pœu modificâ e paggine speciali',
+
+# Virus scanner
+'virus-scanfailed' => 'scansion fallia (codice $1)',
+'virus-unknownscanner' => 'antivirus sconosciuo:',
 
 # Login and logout pages
 'yourname' => 'Nomme',
@@ -398,42 +464,48 @@ Pe favô ti peu segnalâ quello che l'é sucesso a in [[Special:ListUsers/sysop|
 'nav-login-createaccount' => 'Intra / Registrate',
 'loginprompt' => "Pe fâ l'accesso inte {{SITENAME}} ti g'hæ da  abilitâ i cookie.",
 'userlogin' => 'Intra / Registrite',
+'userloginnocreate' => 'Intra',
 'logout' => 'Sciorti',
 'userlogout' => 'Sciorti',
+'notloggedin' => "No t'ê introu",
 'nologin' => "No ti gh'æ ancon in acesso? '''$1'''.",
 'nologinlink' => "Creâ 'n' utensa",
 'createaccount' => "Crea 'n nêuvo account",
 'gotaccount' => "Ti ghe l'æ za 'n' utensa? '''$1'''.",
 'gotaccountlink' => 'Intra',
 'userlogin-resetlink' => "T'æ ascordòu i teu dæti de acesso?",
+'createaccountreason' => 'Raxon:',
 'badretype' => "E paròlle d'ordine che t'hæ scrîo son despægie.",
-'userexists' => "O nomme d'ûtente inserîo o l'è zà in ûso.<br />
-Pe piaxei prêuva a scellie 'n âtro.",
+'userexists' => "O nomme ûtente inserîo o l'è za doeuviao.<br />
+Çernine 'n âtro.",
 'loginerror' => "Errô inte l'accesso",
+'createaccounterror' => "Imposcibbile creâ l'account: $1",
 'noname' => "O nomme d'ûtente o l'è sballiòu.",
 'loginsuccesstitle' => 'Accesso effettuòu',
 'loginsuccess' => "'''O collegamento a-o server de {{SITENAME}} co-o nomme d'ûtente \"\$1\" o l'è attivo.'''",
 'nosuchuser' => 'No gh\'è nisciûn ûtente con quello nomme "$1". Verificâ o nomme inserîo ò creâ \'n nêuvo accesso.',
 'nosuchusershort' => 'No gh\'è nisciûn ûtente con quello nomme "$1". Verificâ o nomme inserîo.',
 'nouserspecified' => "O se deive inserî 'n nomme d'ûtente.",
+'login-userblocked' => "St'utente o l'è bloccou. Accesso negou.",
 'wrongpassword' => "Ti gh'æ scrîo 'na paròlla d'ordine sbaliâ. Tenta torna.",
 'wrongpasswordempty' => "No ti g'hæ scrîo nisciûnn-a paròlla d'ordine. Tenta torna.",
-'passwordtooshort' => "A paròlla d'ordine che ti gh'æ misso a no serve òu a l'é tròppo cûrta.
-A dêve contegnî mìnimo $1 caratteri e esse diverza da-o teu nómme utente.",
+'passwordtooshort' => 'E password devan aveighe aomanco {{PLURAL:$1|1 carattere|$1 caratteri}}.',
+'password-name-match' => "A password a dev'ese despægia da-o nomme utente.",
+'password-login-forbidden' => "L'utilizzo de sto nomme utente e password o l'è stæto proibio.",
 'mailmypassword' => "Invia 'na nêuva paròlla segrétta a-a mæ e-mail",
 'passwordremindertitle' => "Servissio Password Reminder (nêuva paròlla d'ordine temporannia) de {{SITENAME}}",
-'passwordremindertext' => "Quarchedûn (probabilmente ti, con indirisso IP \$1) o g'ha domandòu l'invîo de 'na nêuva paròlla d'ordine pe l'accesso a {{SITENAME}} (\$4).
-A paròlla d'ordine pe l'ûtente \"\$2\" a l'è stæta impostâa a \"\$3\".
-O se conseggia de fâ l'accesso quanto primma e cangiâ a paròlla d'ordine immediatamente.
-Se no ti Ã¨ stæto ti a fâ 'sta domanda, oppûre se ti g'hæ ritrovòu a têu paròlla d'ordine e no ti vêu cangiâla ciû, ti pêu ignorâ 'sto messaggio e andâ avanti Ã»sando a vegia paròlla d'ordine.",
+'passwordremindertext' => "Quarchedûn (probabilmente ti, con indirisso IP \$1) o l'ha domandòu l'invîo de 'na nêuva paròlla d'ordine pe l'accesso a {{SITENAME}} (\$4).
+A paròlla d'ordine pe l'ûtente \"\$2\" a l'è stæta impostâ a \"\$3\".
+Se conseggia de fâ l'accesso quanto primma e cangiâ a paròlla d'ordine immediatamente.
+Se no ti Ãª stæto ti a fâ 'sta domanda, oppûre se ti t'hæ ritrovòu a têu paròlla d'ordine e no ti vêu cangiâla ciû, ti pêu ignorâ 'sto messaggio e andâ avanti deuviando a vegia paròlla d'ordine.",
 'noemail' => 'No gh\'è nisciûn indirisso e-mail registròu pe l\'ûtente "$1".',
 'passwordsent' => "Ûnn-a nêuva paròlla d'ordine a l'è stæta inviâa a l'indirisso e-mail registròu pe l'ûtente \"\$1\".
 Pe piaxei, fa 'n accesso appenn-a ti a ghe reçeivi.",
 'blocked-mailpassword' => "O teu indirisso IP o l'è affirmoö, e pe sta razon o non se peu usâ a funscion de remandâ a pòula segretta.",
 'eauthentsent' => "'N messaggio e-mail de confermassion o l'è stæto inviòu a l'indirisso indicòu.
 Pe abilitâ l'invîo de messaggi e-mail pe quest'accesso, o se deive seguî l'istrûssioîn indicæ, coscì ti confermi che ti t'è o legittimo propietâjo de l'indirisso.",
-'acct_creation_throttle_hit' => 'O ne dispiâxe, ma ti hæ zà creòu $1 accesci. No ti pêu creâne de ciû!',
-'emailauthenticated' => "O teu indirisso de posta elettronega o l'è stæto autenticoö o $1.",
+'acct_creation_throttle_hit' => "Ne dispiâxe, ma t'hæ zà creòu $1 accesci. No ti pêu creâne ciû!",
+'emailauthenticated' => "O teu indirisso de posta elettronica o l'è stæto autenticou o $1.",
 'emailconfirmlink' => 'Conferma o teu indirisso de posta elettronega',
 'accountcreated' => 'Graçie pe esëte registroö!!!',
 'accountcreatedtext' => "Utente $1, ti te guägno l'açeiso!",
index cea3ae5..ccc71a0 100644 (file)
@@ -271,18 +271,18 @@ $messages = array(
 'tog-editsectiononrightclick' => 'ବିଭାଗ ନାମରେ ଡାହାଣ କ୍ଲିକ କରି ବିଭାଗ ସମ୍ପାଦନାକୁ ସଚଳ କରିବେ (ଜାଭାସ୍କ୍ରିପ୍ଟ ଲୋଡ଼ା)',
 'tog-showtoc' => 'ସୂଚୀପତ୍ର ଦେଖାଇବେ (୩ରୁ ଅଧିକ ମୁଖ୍ୟ ନାମ ଥିଲେ)',
 'tog-rememberpassword' => 'ଏହି ବ୍ରାଉଜରରେ (ସବୁଠୁ ଅଧିକ ହେଲେ $1 {{PLURAL:$1|day|ଦିନ}}) ପାଇଁ ମୋ ଲଗଇନ ମନେ ରଖିଥିବେ',
-'tog-watchcreations' => 'ମà­\8b à¬¤à¬¿à¬\86ରି à¬ªà­\83ଷà­\8dଠାସବà­\81à¬\95à­\81 à¬\8fବà¬\82 à¬®à­\8b à¬\85ପଲà­\8bଡà¬\97à­\81ଡିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡନ୍ତୁ',
-'tog-watchdefault' => 'ମà­\81à¬\81 à¬¬à¬¦à¬³à­\87à¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡନ୍ତୁ',
-'tog-watchmoves' => 'ମà­\81à¬\81 à¬\98à­\81à¬\9eà­\8dà¬\9aାà¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡନ୍ତୁ',
-'tog-watchdeletion' => 'ମà­\81à¬\81 à¬²à¬¿à¬­à¬¾à¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡନ୍ତୁ',
-'tog-minordefault' => 'ସବà­\81ଯାà¬\95 à¬¸à¬®à­\8dପାଦନାà¬\95à­\81 à¬\9bାà¬\8fà¬\81 à¬\9fିà¬\95à­\87 ବଦଳ ଭାବରେ ସୂଚିତ କରିବେ',
+'tog-watchcreations' => 'ମà­\8b à¬¤à¬¿à¬\86ରି à¬ªà­\83ଷà­\8dଠାସବà­\81à¬\95à­\81 à¬\8fବà¬\82 à¬®à­\8b à¬\85ପଲà­\8bଡ଼à¬\97à­\81ଡ଼ିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡ଼ନ୍ତୁ',
+'tog-watchdefault' => 'ମà­\81à¬\81 à¬¬à¬¦à¬³à­\87à¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡ଼ିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡ଼ନ୍ତୁ',
+'tog-watchmoves' => 'ମà­\81à¬\81 à¬\98à­\81à¬\9eà­\8dà¬\9aାà¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡ଼ିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡ଼ନ୍ତୁ',
+'tog-watchdeletion' => 'ମà­\81à¬\81 à¬²à¬¿à¬­à¬¾à¬\87ଥିବା à¬ªà­\83ଷà­\8dଠା à¬\8fବà¬\82 à¬«à¬¾à¬\87ଲà¬\97à­\81ଡ଼ିà¬\95à­\81 à¬®à­\8bର à¬¦à­\87à¬\96ଣାତାଲିà¬\95ାରà­\87 à¬¯à­\8bଡ଼ନ୍ତୁ',
+'tog-minordefault' => 'ସବà­\81ଯାà¬\95 à¬¸à¬®à­\8dପାଦନାà¬\95à­\81 à¬\9bାà¬\8fà¬\81 à¬\9bà­\8bà¬\9f ବଦଳ ଭାବରେ ସୂଚିତ କରିବେ',
 'tog-previewontop' => 'ଏଡ଼ିଟ ବାକ୍ସ ଆଗରୁ ଦେଖଣା ଦେଖାଇବେ',
 'tog-previewonfirst' => 'ପ୍ରଥମ ବଦଳର ଦେଖଣା ଦେଖାଇବେ',
 'tog-nocache' => 'ବ୍ରାଉଜର ପୃଷ୍ଠା ସଂରକ୍ଷଣକୁ ଅଚଳ କରିବେ',
-'tog-enotifwatchlistpages' => 'ମୋ ଦେଖଣାତାଲିକାରେ ଥିବା ପୃଷ୍ଠା ବା ଫାଇଲରେ କିଛି ବଦଳ ହେଲେ ମୋତେ ଇ-ମେଲ କରିବେ',
+'tog-enotifwatchlistpages' => 'ମୋ ଦେଖଣାତାଲିକାରେ ଥିବା ପୃଷ୍ଠା ବା ଫାଇଲରେ କିଛି ବଦଳ ହେଲେ ମୋତେ ଇମେଲ କରିବେ',
 'tog-enotifusertalkpages' => 'ମୋର ଆଲୋଚନା ପୃଷ୍ଠାରେ କିଛି ବଦଳ ହେଲେ ମୋତେ ଇ-ମେଲ କରିବେ',
 'tog-enotifminoredits' => 'ପୃଷ୍ଠାରେ ଏବଂ ଫାଇଲଗୁଡିକରେ ଛୋଟ ଛୋଟ ବଦଳ ହେଲେ ବି ମୋତେ ଇ-ମେଲ କରିବେ',
-'tog-enotifrevealaddr' => 'ସୂଚନା ଇ-ମେଲ ରେ ମୋର ଇ-ମେଲ ଠିକଣା ଦେଖାଇବେ',
+'tog-enotifrevealaddr' => 'ସୂଚନା ଇମେଲ ରେ ମୋର ଇମେଲ ଠିକଣା ଦେଖାଇବେ',
 'tog-shownumberswatching' => 'ଦେଖୁଥିବା ବ୍ୟବହାରକାରୀଙ୍କ ସଂଖ୍ୟା ଦେଖାଇବେ',
 'tog-oldsig' => 'ଏବେ ଥିବା ନାମ:',
 'tog-fancysig' => 'ଦସ୍ତଖତକୁ ଉଇକିଟେକ୍ସଟ ଭାବରେ ଗଣିବେ (ଆପେଆପେ ଥିବା ଲିଙ୍କ ବିନା)',
@@ -469,7 +469,7 @@ $messages = array(
 'viewhelppage' => 'ସହଯୋଗ ପୃଷ୍ଠାଗୁଡ଼ିକ ଦେଖନ୍ତୁ',
 'categorypage' => 'ଶ୍ରେଣୀ ପୃଷ୍ଠାଟିକୁ ଦେଖାଇବେ',
 'viewtalkpage' => 'ଆଲୋଚନାଗୁଡ଼ିକୁ ଦେଖନ୍ତୁ',
-'otherlanguages' => 'ଅଲଗା ଭାଷା',
+'otherlanguages' => 'ଅଲଗା ଭାଷାରେ',
 'redirectedfrom' => '($1 ରୁ ଲେଉଟି ଆସିଛି)',
 'redirectpagesub' => 'ଆଉଥରେ ଫେରିବା ପୃଷ୍ଠା',
 'lastmodifiedat' => 'ଏହି ପୃଷ୍ଠାଟି $1 ତାରିଖ $2 ବେଳେ ବଦଳାଯାଇଥିଲା ।',
@@ -670,6 +670,8 @@ $2',
 ନିଜର [[Special:Preferences|{{SITENAME}} ପସନ୍ଦସବୁକୁ]] ବଦଳାଇବାକୁ ଭୁଲିବେ ନାହିଁ ।',
 'yourname' => 'ବ୍ୟବହାରକାରୀଙ୍କ ନାମ:',
 'yourpassword' => 'ପାସୱାର୍ଡ଼',
+'userlogin-yourpassword' => 'ପାସୱାର୍ଡ଼',
+'userlogin-yourpassword-ph' => 'ଆପଣଙ୍କ ପାସୱାର୍ଡ଼ ନିବେଶ କରନ୍ତୁ',
 'yourpasswordagain' => 'ପାସୱାର୍ଡ଼ ଆଉଥରେ:',
 'remembermypassword' => 'ଏହି ବ୍ରାଉଜରରେ (ସବୁଠୁ ଅଧିକ ହେଲେ $1 {{PLURAL:$1|day|ଦିନ}}) ପାଇଁ ମୋ ଲଗଇନ ମନେ ରଖିଥିବେ',
 'securelogin-stick-https' => 'ଲଗ ଇନ କଲାପରେ HTTPS ସହ ଯୋଡ଼ି ହୋଇ ରହନ୍ତୁ',
@@ -684,6 +686,7 @@ $2',
 'logout' => 'ଲଗଆଉଟ',
 'userlogout' => 'ଲଗ ଆଉଟ',
 'notloggedin' => 'ଲଗ‌‌ ଇନ କରିନାହାନ୍ତି',
+'userlogin-noaccount' => 'ଖାତାଟିଏ ନାହିଁ?',
 'nologin' => 'ଖାତାଟିଏ ନାହିଁ? $1।',
 'nologinlink' => 'ନୂଆ ଖାତାଟିଏ ଖୋଲନ୍ତୁ',
 'createaccount' => 'ନୂଆ ଖାତାଟିଏ ଖୋଲନ୍ତୁ',
@@ -740,8 +743,8 @@ continue using your old password.',
 'blocked-mailpassword' => 'ଆପଣଙ୍କ IP ଠିକଣାଟି ସମ୍ପାଦନାରେ ଭାଗ ନେବାରୁ ଅଟକାଯାଇଛି, ତେଣୁ ପାସୱାର୍ଡ଼ ଫେରନ୍ତା କାମ ବ୍ୟବହାର କରି ଅବ୍ୟବହାରକୁ ରୋକିବା ଅନୁମୋଦିତ ନୁହେଁ ।',
 'eauthentsent' => 'ଆପଣଙ୍କ ବଛା ଇ-ମେଲ ଠିକଣାକୁ ଏକ ଥୟ କରିବା ଇ-ମେଲଟିଏ ପଠାଇଦିଆଗଲା ।
 ଖାତାଟି ଆପଣଙ୍କର ବୋଲି ଥୟ କରିବା ନିମନ୍ତେ ଆଉ କେଉଁ ଇ-ମେଲ ଆପଣଙ୍କ ଖାତାକୁ ପଠାହେବା ଆଗରୁ ଆପଣଙ୍କୁ ସେହି ଇ-ମେଲରେ ଥିବା ସୂଚନା ଅନୁସରଣ କରିବାକୁ ପଡ଼ିବ ।',
-'throttled-mailpassword' => 'à¬\97ତ {{PLURAL:$1|à¬\8fà¬\95 à¬\98ଣà­\8dà¬\9fାରà­\87|$1 à¬\98ଣà­\8dà¬\9fାରà­\87}} à¬\86ପଣà¬\99à­\8dà¬\95à­\81 à¬\8fà¬\95 à¬ªà¬¾à¬¸à­±à¬¾à¬°à­\8dଡ଼ à¬®à¬¨à­\87à¬\95ରିବା à¬¸à­\82à¬\9aନାଟିଏ ପଠାଯାଇଛି ।
-à¬\85ବà­\8dà­\9fବହାରà¬\95à­\81 à¬°à­\8bà¬\95ିବା à¬¨à¬¿à¬®à¬¨à­\8dତà­\87, {{PLURAL:$1|à¬\8fà¬\95 à¬\98ଣà­\8dà¬\9fାରà­\87|$1 à¬\98ଣà­\8dà¬\9fାରà­\87}} à¬\95à­\87ବଳ à¬\97à­\8bà¬\9fିà¬\8f à¬ªà¬¾à¬¸à­±à¬¾à¬°à­\8dଡ଼ ହିଁ ପଠାହେବ ।',
+'throttled-mailpassword' => 'à¬\97ତ {{PLURAL:$1|à¬\8fà¬\95 à¬\98ଣà­\8dà¬\9fାରà­\87|$1 à¬\98ଣà­\8dà¬\9fାରà­\87}} à¬\86ପଣà¬\99à­\8dà¬\95à­\81 à¬\8fà¬\95 à¬ªà­\81ନà¬\83ସà­\8dଥାପନ à¬\87ମà­\87ଲଟିଏ ପଠାଯାଇଛି ।
+à¬\85ବà­\8dà­\9fବହାରà¬\95à­\81 à¬°à­\8bà¬\95ିବା à¬¨à¬¿à¬®à¬¨à­\8dତà­\87, {{PLURAL:$1|à¬\8fà¬\95 à¬\98ଣà­\8dà¬\9fାରà­\87|$1 à¬\98ଣà­\8dà¬\9fାରà­\87}} à¬\95à­\87ବଳ à¬\97à­\8bà¬\9fିà¬\8f à¬\87ମà­\87ଲ ହିଁ ପଠାହେବ ।',
 'mailerror' => 'ମେଲ ପଠାଇବାରେ ଭୁଲ : $1',
 'acct_creation_throttle_hit' => 'ଏହି ଉଇକିର ଦେଖଣାହାରୀ ମାନେ ଆପଣଙ୍କ IP ଠିକଣା ବ୍ୟବହାର କରି ବିଗତ ଦିନରେ {{PLURAL:$1|ଖାତାଟିଏ|$1 ଗୋଟି ଖାତା}} ତିଆରି କରିଛନ୍ତି ଯାହା ସେହି ସମୟସୀମା ଭିତରେ ସବୁଠାରୁ ଅଧିକ ଥିଲା ।
 ତେଣୁ, ଏହି IP ଠିକଣାର ଦେଖଣାହାରୀ ଗଣ ଏବେ ଆଉ ଅଧିକ ଖାତା ଖୋଲିପାରିବେ ନାହିଁ ।',
@@ -794,9 +797,10 @@ continue using your old password.',
 
 # Special:PasswordReset
 'passwordreset' => 'ପାସୱାର୍ଡ଼ ପୁନସ୍ଥାପନ କରନ୍ତୁ',
-'passwordreset-text' => 'ନିà¬\9c à¬\96ାତାର à¬¸à¬¬à¬¿à¬¶à­\87ଷ à¬¬à¬¿à¬¬à¬°à¬£à­\80 à¬\8fà¬\95 à¬\87-ମà­\87ଲରà­\87 à¬ªà¬¾à¬\87ବା ପାଇଁ ଏହି ଆବେଦନ ପତ୍ରଟି ପୂରଣ କରନ୍ତୁ ।',
+'passwordreset-text' => 'ନିà¬\9c à¬ªà¬¾à¬¸à­±à¬¾à¬°à­\8dଡ଼à¬\95à­\81 à¬ªà­\81ନà¬\83ସà­\8dଥାପନ à¬\95ରିବା ପାଇଁ ଏହି ଆବେଦନ ପତ୍ରଟି ପୂରଣ କରନ୍ତୁ ।',
 'passwordreset-legend' => 'ପାସୱାର୍ଡ଼ ପୁନସ୍ଥାପନ କରନ୍ତୁ',
 'passwordreset-disabled' => 'ପାସୱାର୍ଡ଼କୁ ପୁରାପୁରି ମୂଳକୁ ଫେରାଇବା ଏହି ଉଇକିରେ ଅଚଳ କରାଯାଇଅଛି ।',
+'passwordreset-emaildisabled' => 'ଏହି ଉଇକିରେ ଇମେଲ ସୁବିଧା ଅଚଳ କରାଯାଇଅଛି ।',
 'passwordreset-pretext' => '{{PLURAL:$1||ତଳେ ଥିବା ତଥ୍ୟସମୂହରୁ କୌଣସି ଗୋଟିଏ ଦିଅନ୍ତୁ}}',
 'passwordreset-username' => 'ବ୍ୟବହାରକାରୀଙ୍କ ନାମ:',
 'passwordreset-domain' => 'ଡୋମେନ:',
@@ -823,8 +827,8 @@ $2
 ଆପଣ ନିଜ ପୁରୁଣା ପାସୱାର୍ଡ଼ଟି ଆଗପରି ବ୍ୟବହାର କରିପାରନ୍ତି ।',
 'passwordreset-emailelement' => 'ଇଉଜର ନାମ: $1
 ଅସ୍ଥାୟୀ ପାସୱାର୍ଡ଼: $2',
-'passwordreset-emailsent' => 'à¬\8fà¬\95 à¬®à¬¨à­\87ପà¬\95ାà¬\87ବା à¬\87-ମେଲ ପଠାଇଦିଆଯାଇଅଛି ।',
-'passwordreset-emailsent-capture' => 'ତଳà­\87 à¬¦à¬¿à¬\86ଯାà¬\87ଥିବା à¬­à¬³à¬¿ à¬®à¬¨à­\87ପà¬\95ାà¬\87ବା à¬\87-ମà­\87ଲà¬\9fିà¬\8f à¬ªà¬ à¬¾à¬¦à¬¿à¬\86à¬\97ଲା ।',
+'passwordreset-emailsent' => 'à¬\8fà¬\95 à¬ªà¬¾à¬¸à­±à¬¾à¬°à­\8dଡ଼ à¬ªà­\81ନà¬\83ସà­\8dଥାପନ à¬\87ମେଲ ପଠାଇଦିଆଯାଇଅଛି ।',
+'passwordreset-emailsent-capture' => 'ତଳà­\87 à¬¦à­\87à¬\96ାଯାà¬\89ଥିବା à¬­à¬³à¬¿, à¬ªà¬¾à¬¸à­±à¬¾à¬°à­\8dଡ଼ à¬ªà­\81ନà¬\83ସà­\8dଥାପନ à¬\87ମà­\87ଲà¬\9fିà¬\8f à¬ªà¬ à¬¾à¬\87ଦିà¬\86ଯାà¬\87à¬\9bି ।',
 'passwordreset-emailerror-capture' => 'ଗୋଟିଏ ମନେପକାଇବା ଇ-ମେଲ ତିଆରି କରାଯାଇଥିଲା, ଯାହାକି ତଳେ ଅଛି, କିନ୍ତୁ ଏହାକୁ ବ୍ୟବହାରକାରୀକୁ ପଠାଇବାରେ ଅସଫଳ ହେଲା :$1',
 
 # Special:ChangeEmail
@@ -2053,6 +2057,8 @@ URLଟି ଠିକ ଅଚିକି କି ନାଁ ଓ ସାଇଟଟି ସ
 ସେସବୁ ଅଧିକ ଉପଯୁକ୍ତ ପ୍ରସଙ୍ଗ ସହ ଯୋଡ଼ାହେବା ଉଚିତ  ।<br />
 [[MediaWiki:Disambiguationspage]] ସହ ଯୋଡ଼ାଥିବା ଛାଞ୍ଚ ବ୍ୟବହାର କରୁଥିଲେ ପୃଷ୍ଠାଟିଏକୁ ବହୁବିକଳ୍ପ ପୃଷ୍ଠା ବୋଲି କୁହାଯାଏ",
 
+'pageswithprop-submit' => 'ଯିବା',
+
 'doubleredirects' => 'ଯୋଡ଼ା ପୁନପ୍ରେରଣ',
 'doubleredirectstext' => 'ଏହି ପୃଷ୍ଠା ବାକି ବହୁବିକଳ୍ପ ପୃଷ୍ଠାମାନଙ୍କ ସହ ଯୋଡ଼ିଥାଏ ।
 ପ୍ରତ୍ୟେକ ଧାଡ଼ିରେ ପ୍ରଥମ ଓ ଶେଷ ପୁନପ୍ରେରଣ ସହ ଯୋଡ଼ିବା ଲିଙ୍କ ରହିଥାଏ, ଆହୁରି ମଧ୍ୟ ଏଥିରେ ଦ୍ଵିତୀୟ ପୁନପ୍ରେରଣର ଲକ୍ଷ ସହ ଯୋଡ଼ିବାର ଲିଙ୍କ ଥାଏ , ଯାହାକି ସାଧାରଣତ "ପ୍ରକୃତ" ଲକ୍ଷ ପୃଷ୍ଠା ହୋଇଥାଏ, ଯାହାକୁ ପ୍ରଥମ ପୁନପ୍ରେରଣ ପୃଷ୍ଠା ଯୋଡ଼ିଥାଏ ।
@@ -3896,6 +3902,8 @@ MediaWiki ଉପଯୋଗୀ ହେବା ଲକ୍ଷରେ ବଣ୍ଟାଯ
 'htmlform-submit' => 'ଦାଖଲକରିବା',
 'htmlform-reset' => 'କରାଯାଇଥିବା ବଦଳ ପଛକୁ ଫେରାଇବେ',
 'htmlform-selectorother-other' => 'ବାକି',
+'htmlform-no' => 'ନାହିଁ',
+'htmlform-yes' => 'ହଁ',
 
 # SQLite database support
 'sqlite-has-fts' => 'ପୁରା ଟେକ୍ସ୍ଟ ଖୋଜା ସହଯୋଗ ସହିତ $1',
index b913ced..40adf4c 100644 (file)
@@ -85,14 +85,14 @@ $messages = array(
 'tog-showhiddencats' => 'Smon-e le categorìe stërmà',
 'tog-noconvertlink' => "Disativé la conversion dij tìtoj ant j'anliure",
 'tog-norollbackdiff' => "Fé nen vëdde le diferense apress d'avèj ripristinà",
-'tog-useeditwarning' => 'Avisme quand che i lasso na pàgina ëd modìfiche con modìfiche nen salvà',
+'tog-useeditwarning' => 'Aviseme quand che i chito na pàgina ëd modìfiche con dle modìfiche nen salvà',
 
 'underline-always' => 'Sempe',
 'underline-never' => 'Mai',
-'underline-default' => 'Stàndard dël navigator',
+'underline-default' => 'Stàndard dël navigator o dël tema',
 
 # Font style option in Special:Preferences
-'editfont-style' => "Stil dël font ëd l'àrea ëd modìfica:",
+'editfont-style' => "Stil dij caràter ëd l'àrea ëd modìfica:",
 'editfont-default' => 'Stàndard dël navigator',
 'editfont-monospace' => 'Font mono-spassià',
 'editfont-sansserif' => 'Font sans-serif',
index 60926e3..b67ec27 100644 (file)
@@ -377,7 +377,7 @@ Ita-nia mudansa la armazenadu seidauk!",
 'currentrevisionlink' => 'Versaun atuál',
 'cur' => 'atuál',
 'next' => 'oinmai',
-'last' => 'ikus',
+'last' => 'molok',
 'page_first' => 'uluk',
 'page_last' => 'ikus',
 'histfirst' => 'sedu liu hotu',
@@ -407,12 +407,14 @@ Ita-nia mudansa la armazenadu seidauk!",
 'nextn' => 'oinmai {{PLURAL:$1|$1}}',
 'shown-title' => 'Hatudu {{PLURAL:$1|rezultadu|rezultadu}} $1 kada pájina',
 'viewprevnext' => 'Haree ($1 {{int:pipe-separator}} $2) ($3)',
+'searchmenu-exists' => "'''Iha pájina ho naran \"[[:\$1]]\".'''",
 'searchmenu-new' => "'''Kria pájina \"[[:\$1]]\" iha wiki ne'e!'''",
 'searchprofile-everything' => 'Hotu',
 'searchprofile-articles-tooltip' => 'Buka iha $1',
 'searchprofile-project-tooltip' => 'Buka iha $1',
 'search-result-size' => '$1 ({{PLURAL:$2|liafuan ida|liafuan $2}})',
 'search-section' => '(seksaun $1)',
+'search-suggest' => 'Parese Ita buka: $1',
 'search-interwiki-caption' => 'Projetu seluseluk sira',
 'searchall' => 'hotu',
 'powersearch' => 'Buka',
@@ -643,7 +645,7 @@ Ita-nia mudansa la armazenadu seidauk!",
 'emailsend' => 'Haruka',
 
 # Watchlist
-'watchlist' => "Ha'u-nia lista hateke",
+'watchlist' => 'Lista hateke',
 'mywatchlist' => 'Lista hateke',
 'removedwatchtext' => 'La hateke pájina "[[:$1]]" ona (haree [[Special:Watchlist|"lista hateke"]]).',
 'watch' => 'Hateke',
@@ -667,6 +669,7 @@ Ita-nia mudansa la armazenadu seidauk!",
 'exblank' => 'pájina mamuk',
 'delete-legend' => 'Halakon',
 'actioncomplete' => 'operasaun remata',
+'actionfailed' => 'Asaun la konsege',
 'deletedtext' => 'Ita foin halakon pájina "$1". Haree $2 ba "operasaun halakon" seluk.',
 'dellogpage' => 'Lista halakon',
 'deletionlog' => 'lista halakon',
@@ -713,7 +716,7 @@ Ita-nia mudansa la armazenadu seidauk!",
 'blanknamespace' => '(Prinsipál)',
 
 # Contributions
-'contributions' => "Kontribuisaun uza-na'in",
+'contributions' => "{{GENDER:$1|Kontribuisaun uza-na'in}}",
 'contributions-title' => 'Kontribuisaun "$1" nian',
 'mycontris' => 'Kontribuisaun',
 'contribsub2' => 'Ba $1 ($2)',
@@ -849,10 +852,7 @@ Ita-nia mudansa la armazenadu seidauk!",
 'siteusers' => "{{PLURAL:$2|uza-na'in|uza-na'in}} {{SITENAME}} nian $1",
 
 # Skin names
-'skinname-standard' => 'Klásiku',
 'skinname-cologneblue' => 'Kolónia azúl',
-'skinname-myskin' => 'MySkin',
-'skinname-chick' => 'Manu',
 
 # Browsing diffs
 'previousdiff' => '←Versaun molok',
index 926cb12..cd5cb6f 100644 (file)
@@ -8,6 +8,7 @@
  * @file
  *
  * @author Altaileopard
+ * @author Matma Rex
  * @author Silvicola
  */
 
@@ -80,10 +81,6 @@ $messages = array(
 'tog-shownumberswatching' => 'Dii andsôôl dr beoobachdâr ôôdsajchn',
 'tog-oldsig' => 'foorschau fon dr agduäln signaduur:',
 'tog-fancysig' => 'Signaduur is dhägsd in wighi-sindhags (alsâ ned audomaadisch â lingg)',
-'tog-externaleditor' => 'Schdandardwäässich an ägsdhärnân eedidhâr neemn (nôr for di sich ausghenn, dâdsuu
-mus mr ufm ajchnen rächnâr was ajrichdn gehnn)',
-'tog-externaldiff' => ' ägsdhärns Brogram dsum ôôdsjachn fon dâ wärsjoons-undârschiid neemn (nôr fir dii sich
-ausghenn, mr mus dâdsuu ufm ajchnen rächnâr was âjrichdn ghenn)',
 'tog-uselivepreview' => 'Schnäl-foorschau benudsn (brauchd JavaScript) (ärschd ân fârsuuch)',
 'tog-forceeditsummary' => 'Sich erinärn lasn, wemmâr ghâ dsusamnfasung gschriiwn had',
 'tog-watchlisthideown' => 'Ajchne bearbajdungn ned in dr beoobachdungs-lischdn uffiirn',
@@ -483,14 +480,6 @@ Hirmid sagsd, das Du den dhägsd '''selbâr gschriim''' hasd, das däär dhägsd
 'search-external' => 'Ägsdärne suach',
 'searchdisabled' => 'Diâ {{SITENAME}}-suâch ist ausgschald. Duu ghâusch so lang mid Google suâchn. Dengg drâu, des was mr dôô fir {{SITENAME}} find, ghâu iwârhoold saj.',
 
-# Quickbar
-'qbsettings' => 'Sajdn-lajsdn',
-'qbsettings-none' => 'Ghane',
-'qbsettings-fixedleft' => 'Lings, feschd',
-'qbsettings-fixedright' => 'Rächds, feschd',
-'qbsettings-floatingleft' => 'Lings, schwääbnd',
-'qbsettings-floatingright' => 'Rächds, schwääbnd',
-
 # Preferences page
 'preferences' => 'ajschdelunga',
 'mypreferences' => 'Maj ajschdelunga',
@@ -654,7 +643,7 @@ S'gajd awâr aa â [[Special:WhatLinksHere/$2|lisdn mid alâ fârwajs]].",
 # Special:ListGroupRights
 'listgrouprights-members' => '(Lisdn fon dâ midgliidâr)',
 
-# E-mail user
+# Email user
 'emailuser' => 'Dem ôôgmeldn â iimejl schign',
 
 # Watchlist
@@ -876,23 +865,9 @@ Bidde gug's mi´m foorschau-gnobf ôô fôrm schbajchan",
 
 # Stylesheets
 'common.css' => '/* CSS hiir beâjflusd ale schelfn */',
-'standard.css' => "/* CSS hiir beâjflusd nôr dii Klassik-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an [[MediaWiki:Common.css]] was ändârn. */",
-'nostalgia.css' => "/* CSS hiir beâjflusd nôr dii Nostalgia-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
 'cologneblue.css' => "/* CSS hiir beâjflusd nôr dii Kölnisch-Blau-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
 'monobook.css' => "/* CSS hiir beâjflusd nôr dii Monobook-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
-'myskin.css' => "/* CSS hiir beâjflusd nôr dii MySkin-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
-'chick.css' => "/* CSS hiir beâjflusd nôr dii Küken-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
-'simple.css' => "/* CSS hiir beâjflusd nôr dii Simple-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
-'modern.css' => "/* CSS hiir beâjflusd nôr dii Modern-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */
-
-/* Dii glôôschrajwung im nawigadsjoonsberajch fârhindârd des: */
-.portlet h5,
-.portlet h6,
-#p-personal ul,
-#p-cactions li a,
-#preftoc a {
-     text-transform: none;
-}",
+'modern.css' => "/* CSS hiir beâjflusd nôr dii Modern-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
 'vector.css' => "/* CSS hiir beâjflusd nôr dii Vector-schelfn. Wen'd ale uf ôômôôl beâjflusn wilsch, muâsch an MediaWiki:Common.css was ändârn. */",
 'print.css' => '/* CSS hiir beâjflusd nôr dii drugausgaawe. */',
 'handheld.css' => '/* CSS hiir beâjflusd nôr dii handgerääde, jee nachdeem, welche schelfn in $wgHandheldStyle âjgeschdeld is. */',
index 39fe8de..c21464d 100644 (file)
@@ -517,7 +517,7 @@ $messages = array(
 
 'navigation-heading' => '导航菜单',
 'errorpagetitle' => '错误',
-'returnto' => '返回$1。',
+'returnto' => '返回$1。',
 'tagline' => '来自{{SITENAME}}',
 'help' => '帮助',
 'search' => '搜索',
@@ -595,8 +595,8 @@ $1',
 'mainpage' => '首页',
 'mainpage-description' => '首页',
 'policy-url' => 'Project:方针',
-'portal' => '社å\8cºä¸\93页',
-'portal-url' => 'Project:社å\8cºä¸\93页',
+'portal' => '社å\8cºä¸»页',
+'portal-url' => 'Project:社å\8cºä¸»页',
 'privacy' => '隐私政策',
 'privacypage' => 'Project:隐私权政策',
 
@@ -894,7 +894,7 @@ $2
 临时密码:$2',
 'passwordreset-emailsent' => '密码重置邮件已发送。',
 'passwordreset-emailsent-capture' => '密码重设电子邮件已发送,并在下面显示。',
-'passwordreset-emailerror-capture' => '生成的密码重设电子邮件如下所示,但发送失败:$1',
+'passwordreset-emailerror-capture' => '重置密码邮件已生成,但是无法向下列用户发送:$1',
 
 # Special:ChangeEmail
 'changeemail' => '更改电子邮件地址',
index b6c2ce5..0714d0a 100644 (file)
@@ -820,7 +820,7 @@ $2
 臨時密碼:$2',
 'passwordreset-emailsent' => '已發送重置密碼電郵。',
 'passwordreset-emailsent-capture' => '重置密碼電子郵件已發送,並在下面顯示。',
-'passwordreset-emailerror-capture' => '生成的重置密碼電子郵件如下所示,但發送失敗:$1',
+'passwordreset-emailerror-capture' => '生成的重置密碼電子郵件如下所示,但發送給{{GENDER:$2|用戶}}失敗:$1',
 
 # Special:ChangeEmail
 'changeemail' => '更改電郵地址',
index 147cd15..e8c851f 100644 (file)
@@ -384,19 +384,22 @@ input.searchButton {
 #p-personal li.active a:hover {
        background-color: transparent;
 }
-/* the icon in front of the user name, single quotes
-in bg url to hide it from iemac */
+/* The icon in front of the username / login link */
 li#pt-userpage,
 li#pt-anonuserpage,
 li#pt-login {
        /* @embed */
        background: url(user.gif) top left no-repeat;
        padding-left: 20px;
-       text-transform: none;
 }
 #p-personal ul {
        text-transform: lowercase;
 }
+/* Don't lowercase username or IP addresses (IPv6) */
+li#pt-userpage,
+li#pt-anonuserpage {
+       text-transform: none;
+}
 #p-personal li.active {
        font-weight: bold;
 }
index 6acc994..dc4267f 100644 (file)
@@ -789,7 +789,6 @@ div#content a.external[href *=".pdf?"], div#content a.external[href *=".PDF?"],
        /* @embed */
        background-image: linear-gradient(transparent, transparent), url(images/user-icon.svg);
        padding-left: 15px !important;
-       text-transform: none;
 }
 
 .redirectText {