From 1044b0b8df49d306c577b81a9ad77a230fe3f68a Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 3 Feb 2013 21:05:24 +0100 Subject: [PATCH] fix some spacing Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6 --- includes/ArrayUtils.php | 4 +- includes/Article.php | 4 +- includes/AutoLoader.php | 2 +- includes/Block.php | 2 +- includes/Category.php | 34 +++++++------- includes/Categoryfinder.php | 2 +- includes/Cdb.php | 4 +- includes/Cdb_PHP.php | 14 +++--- includes/ChangeTags.php | 4 +- includes/ChangesFeed.php | 2 +- includes/ChangesList.php | 54 +++++++++++----------- includes/Cookie.php | 6 +-- includes/DefaultSettings.php | 6 +-- includes/DeprecatedGlobal.php | 2 +- includes/EditPage.php | 43 +++++++++-------- includes/Exception.php | 4 +- includes/Export.php | 32 ++++++------- includes/ExternalUser.php | 2 +- includes/FakeTitle.php | 6 +-- includes/Feed.php | 6 +-- includes/FeedUtils.php | 4 +- includes/FileDeleteForm.php | 8 ++-- includes/GlobalFunctions.php | 12 ++--- includes/HTMLForm.php | 10 ++-- includes/HistoryBlob.php | 10 ++-- includes/Html.php | 7 ++- includes/HttpFunctions.php | 8 ++-- includes/ImagePage.php | 10 ++-- includes/Import.php | 40 ++++++++-------- includes/LinkFilter.php | 4 +- includes/Linker.php | 33 +++++++------- includes/LinksUpdate.php | 46 +++++++++---------- includes/MagicWord.php | 16 +++---- includes/Message.php | 8 ++-- includes/Metadata.php | 32 ++++++------- includes/MimeMagic.php | 81 ++++++++++++++++----------------- includes/Namespace.php | 6 +-- includes/OutputPage.php | 16 +++---- includes/Pager.php | 2 +- includes/PathRouter.php | 2 +- includes/Preferences.php | 2 +- includes/PrefixSearch.php | 2 +- includes/ProtectionForm.php | 26 +++++------ includes/ProxyTools.php | 2 +- includes/RecentChange.php | 2 +- includes/Revision.php | 40 +++++++++------- includes/Sanitizer.php | 20 ++++---- includes/Setup.php | 10 ++-- includes/SiteConfiguration.php | 10 ++-- includes/Skin.php | 12 ++--- includes/SkinLegacy.php | 12 ++--- includes/SkinTemplate.php | 6 +-- includes/SpecialPage.php | 2 +- includes/SpecialPageFactory.php | 2 +- includes/SquidPurgeClient.php | 8 ++-- includes/Status.php | 8 ++-- includes/StringUtils.php | 6 +-- includes/StubObject.php | 2 +- includes/Title.php | 2 +- includes/User.php | 12 ++--- includes/UserMailer.php | 22 ++++----- includes/WatchedItem.php | 28 ++++++------ includes/WebRequest.php | 8 ++-- includes/WebResponse.php | 2 +- includes/WebStart.php | 4 +- includes/WikiFilePage.php | 2 +- includes/WikiPage.php | 6 +-- includes/Xml.php | 16 +++---- includes/ZipDirectoryReader.php | 14 +++--- 69 files changed, 441 insertions(+), 435 deletions(-) diff --git a/includes/ArrayUtils.php b/includes/ArrayUtils.php index 8d1884b49c..d1b72a02b7 100644 --- a/includes/ArrayUtils.php +++ b/includes/ArrayUtils.php @@ -13,11 +13,11 @@ class ArrayUtils { * since the function call overhead dominates. So there's not much * justification for breaking compatibility with installations * compiled with ./configure --disable-hash. - * + * * @param $array The array to sort * @param $key The string key * @param $separator A separator used to delimit the array elements and the - * key. This can be chosen to provide backwards compatibility with + * key. This can be chosen to provide backwards compatibility with * various consistent hash implementations that existed before this * function was introduced. */ diff --git a/includes/Article.php b/includes/Article.php index 10cbac7055..75008cefcd 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1122,7 +1122,7 @@ class Article extends Page { # Show delete and move logs LogEventsList::showLogExtract( $outputPage, array( 'delete', 'move' ), $this->getTitle(), '', - array( 'lim' => 10, + array( 'lim' => 10, 'conds' => array( "log_action != 'revision'" ), 'showIfEmpty' => false, 'msgKey' => array( 'moveddeleted-notice' ) ) @@ -1483,7 +1483,7 @@ class Article extends Page { $reason = $this->generateReason( $hasHistory ); } catch ( MWException $e ) { # if a page is horribly broken, we still want to be able to delete it. so be lenient about errors here. - wfDebug("Error while building auto delete summary: $e"); + wfDebug( "Error while building auto delete summary: $e" ); $reason = ''; } } diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 8a886e9fe4..1ee8da70d7 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -1081,7 +1081,7 @@ $wgAutoloadLocalClasses = array( 'wikiStatsOutput' => 'maintenance/language/StatOutputs.php', # maintenance/term - 'AnsiTermColorer' => 'maintenance/term/MWTerm.php', + 'AnsiTermColorer' => 'maintenance/term/MWTerm.php', 'DummyTermColorer' => 'maintenance/term/MWTerm.php', # mw-config diff --git a/includes/Block.php b/includes/Block.php index fde5f074c2..1d1e2c06bb 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -465,7 +465,7 @@ class Block { Block::purgeExpired(); $row = $this->getDatabaseArray(); - $row['ipb_id'] = $dbw->nextSequenceValue("ipblocks_ipb_id_seq"); + $row['ipb_id'] = $dbw->nextSequenceValue( "ipblocks_ipb_id_seq" ); $dbw->insert( 'ipblocks', diff --git a/includes/Category.php b/includes/Category.php index b9c9609c5b..53e44d710c 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -75,11 +75,11 @@ class Category { # Okay, there were no contents. Nothing to initialize. if ( $this->mTitle ) { # If there is a title object but no record in the category table, treat this as an empty category - $this->mID = false; - $this->mName = $this->mTitle->getDBkey(); - $this->mPages = 0; + $this->mID = false; + $this->mName = $this->mTitle->getDBkey(); + $this->mPages = 0; $this->mSubcats = 0; - $this->mFiles = 0; + $this->mFiles = 0; return true; } else { @@ -87,11 +87,11 @@ class Category { } } - $this->mID = $row->cat_id; - $this->mName = $row->cat_title; - $this->mPages = $row->cat_pages; + $this->mID = $row->cat_id; + $this->mName = $row->cat_title; + $this->mPages = $row->cat_pages; $this->mSubcats = $row->cat_subcats; - $this->mFiles = $row->cat_files; + $this->mFiles = $row->cat_files; # (bug 13683) If the count is negative, then 1) it's obviously wrong # and should not be kept, and 2) we *probably* don't have to scan many @@ -179,16 +179,16 @@ class Category { $cat->mName = $title->getDBkey(); # if we have a title object, fetch the category name from there } - $cat->mID = false; + $cat->mID = false; $cat->mSubcats = 0; - $cat->mPages = 0; - $cat->mFiles = 0; + $cat->mPages = 0; + $cat->mFiles = 0; } else { - $cat->mName = $row->cat_title; - $cat->mID = $row->cat_id; + $cat->mName = $row->cat_title; + $cat->mID = $row->cat_id; $cat->mSubcats = $row->cat_subcats; - $cat->mPages = $row->cat_pages; - $cat->mFiles = $row->cat_files; + $cat->mPages = $row->cat_pages; + $cat->mFiles = $row->cat_files; } return $cat; @@ -350,9 +350,9 @@ class Category { wfProfileOut( __METHOD__ ); # Now we should update our local counts. - $this->mPages = $result->pages; + $this->mPages = $result->pages; $this->mSubcats = $result->subcats; - $this->mFiles = $result->files; + $this->mFiles = $result->files; return $ret; } diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php index 589950ff28..cb67aa82b7 100644 --- a/includes/Categoryfinder.php +++ b/includes/Categoryfinder.php @@ -211,7 +211,7 @@ class Categoryfinder { $res = $this->dbr->select( /* FROM */ 'page', /* SELECT */ array( 'page_id', 'page_title' ), - /* WHERE */ array( 'page_namespace' => NS_CATEGORY , 'page_title' => $layer ), + /* WHERE */ array( 'page_namespace' => NS_CATEGORY, 'page_title' => $layer ), __METHOD__ . '-2' ); foreach ( $res as $o ) { diff --git a/includes/Cdb.php b/includes/Cdb.php index 960e76a86f..1c4587a2ec 100644 --- a/includes/Cdb.php +++ b/includes/Cdb.php @@ -133,7 +133,7 @@ class CdbReader_DBA { } function close() { - if( isset($this->handle) ) { + if( isset( $this->handle ) ) { dba_close( $this->handle ); } unset( $this->handle ); @@ -165,7 +165,7 @@ class CdbWriter_DBA { } function close() { - if( isset($this->handle) ) { + if( isset( $this->handle ) ) { dba_close( $this->handle ); } if ( wfIsWindows() ) { diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php index f58e07e1d5..71b55f876e 100644 --- a/includes/Cdb_PHP.php +++ b/includes/Cdb_PHP.php @@ -332,10 +332,10 @@ 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) ) { + if ( wfIsWindows() && file_exists( $this->realFileName ) ) { unlink( $this->realFileName ); } if ( !rename( $this->tmpFileName, $this->realFileName ) ) { @@ -351,7 +351,7 @@ class CdbWriter_PHP extends CdbWriter { protected function write( $buf ) { $len = fwrite( $this->handle, $buf ); if ( $len !== strlen( $buf ) ) { - $this->throwException( 'Error writing to CDB file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Error writing to CDB file "' . $this->tmpFileName . '".' ); } } @@ -363,7 +363,7 @@ class CdbWriter_PHP extends CdbWriter { $newpos = $this->pos + $len; if ( $newpos > 0x7fffffff ) { $this->throwException( - 'A value in the CDB file "'.$this->tmpFileName.'" is too large.' ); + 'A value in the CDB file "' . $this->tmpFileName . '" is too large.' ); } $this->pos = $newpos; } @@ -392,10 +392,10 @@ class CdbWriter_PHP extends CdbWriter { */ protected function addbegin( $keylen, $datalen ) { if ( $keylen > 0x7fffffff ) { - $this->throwException( 'Key length too long in file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Key length too long in file "' . $this->tmpFileName . '".' ); } if ( $datalen > 0x7fffffff ) { - $this->throwException( 'Data length too long in file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Data length too long in file "' . $this->tmpFileName . '".' ); } $buf = pack( 'VV', $keylen, $datalen ); $this->write( $buf ); @@ -470,7 +470,7 @@ class CdbWriter_PHP extends CdbWriter { // Write the pointer array at the start of the file rewind( $this->handle ); if ( ftell( $this->handle ) != 0 ) { - $this->throwException( 'Error rewinding to start of file "'.$this->tmpFileName.'".' ); + $this->throwException( 'Error rewinding to start of file "' . $this->tmpFileName . '".' ); } $this->write( $final ); } diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php index 18f425ae5c..1dd9b595bb 100644 --- a/includes/ChangeTags.php +++ b/includes/ChangeTags.php @@ -169,7 +169,7 @@ class ChangeTags { * * @throws MWException When unable to determine appropriate JOIN condition for tagging */ - static function modifyDisplayQuery( &$tables, &$fields, &$conds, + static function modifyDisplayQuery( &$tables, &$fields, &$conds, &$join_conds, &$options, $filter_tag = false ) { global $wgRequest, $wgUseTagFilter; @@ -221,7 +221,7 @@ class ChangeTags { * - if $fullForm is false: Array with * - if $fullForm is true: String, html fragment */ - public static function buildTagFilterSelector( $selected='', $fullForm = false, Title $title = null ) { + public static function buildTagFilterSelector( $selected = '', $fullForm = false, Title $title = null ) { global $wgUseTagFilter; if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) { diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index ee4c2d647d..ae30272110 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -135,7 +135,7 @@ class ChangesFeed { $feedLastmod = $messageMemc->get( $timekey ); 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 * since it was rendered. This keeps a swarm of requests diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 85fd8af3d5..a9b9c3140e 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -30,7 +30,7 @@ */ class RCCacheEntry extends RecentChange { var $secureName, $link; - var $curlink , $difflink, $lastlink, $usertalklink, $versionlink; + var $curlink, $difflink, $lastlink, $usertalklink, $versionlink; var $userlink, $timestamp, $watched; /** @@ -217,7 +217,7 @@ class ChangesList extends ContextSource { $lang = $context->getLanguage(); $code = $lang->getCode(); static $fastCharDiff = array(); - if ( !isset($fastCharDiff[$code]) ) { + if ( !isset( $fastCharDiff[$code] ) ) { $fastCharDiff[$code] = $wgMiserMode || $context->msg( 'rc-change-size' )->plain() === '$1'; } @@ -328,7 +328,7 @@ class ChangesList extends ContextSource { } else { $query = array( 'curid' => $rc->mAttribs['rc_cur_id'], - 'diff' => $rc->mAttribs['rc_this_oldid'], + 'diff' => $rc->mAttribs['rc_this_oldid'], 'oldid' => $rc->mAttribs['rc_last_oldid'] ); @@ -387,7 +387,7 @@ class ChangesList extends ContextSource { $articlelink .= $this->getLanguage()->getDirMark(); wfRunHooks( 'ChangesListInsertArticleLink', - array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) ); + array( &$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched ) ); $s .= " $articlelink"; } @@ -534,14 +534,14 @@ class ChangesList extends ContextSource { $page = $rc->getTitle(); /** Check for rollback and edit permissions, disallow special pages, and only * show a link on the top-most revision */ - if ( $this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] ) + if ( $this->getUser()->isAllowed( 'rollback' ) && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] ) { $rev = new Revision( array( - 'title' => $page, - 'id' => $rc->mAttribs['rc_this_oldid'], - 'user' => $rc->mAttribs['rc_user'], + 'title' => $page, + 'id' => $rc->mAttribs['rc_this_oldid'], + 'user' => $rc->mAttribs['rc_user'], 'user_text' => $rc->mAttribs['rc_user_text'], - 'deleted' => $rc->mAttribs['rc_deleted'] + 'deleted' => $rc->mAttribs['rc_deleted'] ) ); $s .= ' '.Linker::generateRollback( $rev, $this->getContext() ); } @@ -554,10 +554,10 @@ 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' ); + list( $tagSummary, $newClasses ) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' ); $classes = array_merge( $classes, $newClasses ); $s .= ' ' . $tagSummary; } @@ -679,7 +679,7 @@ class OldChangesList extends ChangesList { } if( $this->watchlist ) { - $classes[] = Sanitizer::escapeClass( 'watchlist-'.$rc->mAttribs['rc_namespace'].'-'.$rc->mAttribs['rc_title'] ); + $classes[] = Sanitizer::escapeClass( 'watchlist-' . $rc->mAttribs['rc_namespace'] . '-' . $rc->mAttribs['rc_title'] ); } if ( !wfRunHooks( 'OldChangesListRecentChangesLine', array( &$this, &$s, $rc, &$classes ) ) ) { @@ -688,7 +688,7 @@ class OldChangesList extends ChangesList { } wfProfileOut( __METHOD__ ); - return "$dateheader
  • ".$s."
  • \n"; + return "$dateheader
  • " . $s . "
  • \n"; } } @@ -822,7 +822,7 @@ class EnhancedChangesList extends ChangesList { $lastLink = $this->message['last']; } else { $lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'], - array(), $curIdEq + array('diff' => $thisOldid, 'oldid' => $lastOldid) + $rcIdQuery ); + array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) + $rcIdQuery ); } # Make user links @@ -834,7 +834,7 @@ class EnhancedChangesList extends ChangesList { } $rc->lastlink = $lastLink; - $rc->curlink = $curLink; + $rc->curlink = $curLink; $rc->difflink = $diffLink; # Put accumulated information into the cache, for later display @@ -843,7 +843,7 @@ class EnhancedChangesList extends ChangesList { $secureName = $title->getPrefixedDBkey(); 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); + $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc ); } else { # Logs are grouped by type if( $type == RC_LOG ) { @@ -964,7 +964,7 @@ class EnhancedChangesList extends ChangesList { ) ); # Timestamp - $r .= ' '.$block[0]->timestamp.' '; + $r .= ' ' . $block[0]->timestamp . ' '; # Article link if( $namehidden ) { @@ -979,7 +979,7 @@ class EnhancedChangesList extends ChangesList { $queryParams['curid'] = $curId; # Changes message - $n = count($block); + $n = count( $block ); static $nchanges = array(); if ( !isset( $nchanges[$n] ) ) { $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped(); @@ -1034,7 +1034,7 @@ class EnhancedChangesList extends ChangesList { # Character difference (does not apply if only log items) if( $wgRCShowChangedSize && !$allLogs ) { $last = 0; - $first = count($block) - 1; + $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 ) { $last++; @@ -1053,7 +1053,7 @@ class EnhancedChangesList extends ChangesList { } $r .= $users; - $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers); + $r .= $this->numberofWatchingusers( $block[0]->numberofWatchingusers ); # Sub-entries foreach( $block as $rcObj ) { @@ -1081,7 +1081,7 @@ class EnhancedChangesList extends ChangesList { $link = $rcObj->timestamp; # Revision link } elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) { - $link = ''.$rcObj->timestamp.' '; + $link = '' . $rcObj->timestamp . ' '; } else { if ( $rcObj->unpatrolled && $type == RC_NEW) { $params['rcid'] = $rcObj->mAttribs['rc_id']; @@ -1094,7 +1094,7 @@ class EnhancedChangesList extends ChangesList { $params ); if( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) { - $link = ''.$link.' '; + $link = '' . $link . ' '; } } $r .= $link . ''; @@ -1144,7 +1144,7 @@ class EnhancedChangesList extends ChangesList { * @param $title String: text * @return String: HTML "" tag */ - protected function arrow( $dir, $alt='', $title='' ) { + protected function arrow( $dir, $alt = '', $title = '' ) { global $wgStylePath; $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' ); $encAlt = htmlspecialchars( $alt ); @@ -1218,7 +1218,7 @@ class EnhancedChangesList extends ChangesList { 'bot' => $rcObj->mAttribs['rc_bot'], ) ); } - $r .= ' '.$rcObj->timestamp.' '; + $r .= ' ' . $rcObj->timestamp . ' '; # Article or log link if( $logType ) { $logPage = new LogPage( $logType ); @@ -1250,7 +1250,7 @@ class EnhancedChangesList extends ChangesList { if ( $type == RC_LOG ) { $r .= $this->insertLogEntry( $rcObj ); } else { - $r .= ' '.$rcObj->userlink . $rcObj->usertalklink; + $r .= ' ' . $rcObj->userlink . $rcObj->usertalklink; $r .= $this->insertComment( $rcObj ); $this->insertRollback( $r, $rcObj ); } @@ -1258,7 +1258,7 @@ class EnhancedChangesList extends ChangesList { # Tags $this->insertTags( $r, $rcObj, $classes ); # Show how many people are watching this if enabled - $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers); + $r .= $this->numberofWatchingusers( $rcObj->numberofWatchingusers ); $r .= "\n"; @@ -1291,7 +1291,7 @@ class EnhancedChangesList extends ChangesList { wfProfileOut( __METHOD__ ); - return '
    '.$blockOut.'
    '; + return '
    ' . $blockOut . '
    '; } /** diff --git a/includes/Cookie.php b/includes/Cookie.php index 48216f0d87..a6eb79a5a5 100644 --- a/includes/Cookie.php +++ b/includes/Cookie.php @@ -113,7 +113,7 @@ class Cookie { } // Don't allow cookies for "co.uk" or "gov.uk", etc, but allow "supermarket.uk" - if ( strrpos( $domain, "." ) - strlen( $domain ) == -3 ) { + if ( strrpos( $domain, "." ) - strlen( $domain ) == -3 ) { if ( ( count( $dc ) == 2 && strlen( $dc[0] ) <= 2 ) || ( count( $dc ) == 3 && strlen( $dc[0] ) == "" && strlen( $dc[1] ) <= 2 ) ) { return false; @@ -165,8 +165,8 @@ class Cookie { protected function canServeDomain( $domain ) { if ( $domain == $this->domain || ( strlen( $domain ) > strlen( $this->domain ) - && substr( $this->domain, 0, 1 ) == '.' - && substr_compare( $domain, $this->domain, -strlen( $this->domain ), + && substr( $this->domain, 0, 1 ) == '.' + && substr_compare( $domain, $this->domain, -strlen( $this->domain ), strlen( $this->domain ), true ) == 0 ) ) { return true; } diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 0f49843b20..ca6505cb73 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -911,7 +911,7 @@ $wgMaxAnimatedGifArea = 1.25e7; * $wgTiffThumbnailType = array( 'jpg', 'image/jpeg' ); * @endcode */ - $wgTiffThumbnailType = false; +$wgTiffThumbnailType = false; /** * If rendered thumbnail files are older than this timestamp, they @@ -5058,8 +5058,8 @@ $wgUpgradeKey = false; * @since 1.20 */ $wgGitRepositoryViewers = array( - 'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H', - 'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H', + 'https://gerrit.wikimedia.org/r/p/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H', + 'ssh://(?:[a-z0-9_]+@)?gerrit.wikimedia.org:29418/(.*)' => 'https://gerrit.wikimedia.org/r/gitweb?p=$1;h=%H', ); /** @} */ # End of maintenance } diff --git a/includes/DeprecatedGlobal.php b/includes/DeprecatedGlobal.php index 4d7b968987..d48bd0b0ca 100644 --- a/includes/DeprecatedGlobal.php +++ b/includes/DeprecatedGlobal.php @@ -27,7 +27,7 @@ */ class DeprecatedGlobal extends StubObject { - // The m's are to stay consistent with parent class. + // The m's are to stay consistent with parent class. protected $mRealValue, $mVersion; function __construct( $name, $realValue, $version = false ) { diff --git a/includes/EditPage.php b/includes/EditPage.php index 5b01ca5482..80c091e9b2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -546,8 +546,8 @@ class EditPage { // Standard preference behaviour return true; } elseif ( !$this->mTitle->exists() && - isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) && - $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) + isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) && + $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) { // Categories are special return true; @@ -2888,21 +2888,24 @@ HTML $dbr = wfGetDB( DB_SLAVE ); $data = $dbr->selectRow( array( 'logging', 'user' ), - array( 'log_type', - 'log_action', - 'log_timestamp', - 'log_user', - 'log_namespace', - 'log_title', - 'log_comment', - 'log_params', - 'log_deleted', - 'user_name' ), - array( 'log_namespace' => $this->mTitle->getNamespace(), - 'log_title' => $this->mTitle->getDBkey(), - 'log_type' => 'delete', - 'log_action' => 'delete', - 'user_id=log_user' ), + array( + 'log_type', + 'log_action', + 'log_timestamp', + 'log_user', + 'log_namespace', + 'log_title', + 'log_comment', + 'log_params', + 'log_deleted', + 'user_name' + ), array( + 'log_namespace' => $this->mTitle->getNamespace(), + 'log_title' => $this->mTitle->getDBkey(), + 'log_type' => 'delete', + 'log_action' => 'delete', + 'user_id=log_user' + ), __METHOD__, array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ) ); @@ -2972,7 +2975,7 @@ HTML $parserOptions = $this->mArticle->makeParserOptions( $this->mArticle->getContext() ); $parserOptions->setEditSection( false ); $parserOptions->setIsPreview( true ); - $parserOptions->setIsSectionPreview( !is_null($this->section) && $this->section !== '' ); + $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' ); # don't parse non-wikitext pages, show message about preview if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { @@ -2995,7 +2998,7 @@ HTML # Used messages to make sure grep find them: # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview if( $level && $format ) { - $note = "
    " . wfMessage( "{$level}{$format}preview" )->text() . "
    "; + $note = "
    " . wfMessage( "{$level}{$format}preview" )->text() . "
    "; } } @@ -3031,7 +3034,7 @@ HTML } } } catch ( MWContentSerializationException $ex ) { - $m = wfMessage('content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() ); + $m = wfMessage( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() ); $note .= "\n\n" . $m->parse(); $previewHTML = ''; } diff --git a/includes/Exception.php b/includes/Exception.php index 4cb946cb71..81d1a9ba42 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -262,7 +262,7 @@ class MWException extends Exception { if ( defined( 'MW_API' ) ) { // Unhandled API exception, we can't be sure that format printer is alive header( 'MediaWiki-API-Error: internal_api_error_' . get_class( $this ) ); - wfHttpError(500, 'Internal Server Error', $this->getText() ); + wfHttpError( 500, 'Internal Server Error', $this->getText() ); } elseif ( self::isCommandLine() ) { MWExceptionHandler::printError( $this->getText() ); } else { @@ -536,7 +536,7 @@ class UserNotLoggedIn extends ErrorPageError { */ public function __construct( $reasonMsg = 'exception-nologin-text', - $titleMsg = 'exception-nologin', + $titleMsg = 'exception-nologin', $params = null ) { parent::__construct( $titleMsg, $reasonMsg, $params ); diff --git a/includes/Export.php b/includes/Export.php index 088a8072a2..8893c6ccd3 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -87,10 +87,10 @@ class WikiExporter { $buffer = WikiExporter::BUFFER, $text = WikiExporter::TEXT ) { $this->db = $db; $this->history = $history; - $this->buffer = $buffer; - $this->writer = new XmlDumpWriter(); - $this->sink = new DumpOutput(); - $this->text = $text; + $this->buffer = $buffer; + $this->writer = new XmlDumpWriter(); + $this->sink = new DumpOutput(); + $this->text = $text; } /** @@ -226,7 +226,7 @@ class WikiExporter { foreach ( $res as $row ) { $this->author_list .= "" . "" . - htmlentities( $row->rev_user_text ) . + htmlentities( $row->rev_user_text ) . "" . "" . $row->rev_user . @@ -634,7 +634,7 @@ class XmlDumpWriter { function writeRevision( $row ) { wfProfileIn( __METHOD__ ); - $out = " \n"; + $out = " \n"; $out .= " " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n"; if( isset( $row->rev_parent_id ) && $row->rev_parent_id ) { $out .= " " . Xml::element( 'parentid', null, strval( $row->rev_parent_id ) ) . "\n"; @@ -674,12 +674,12 @@ class XmlDumpWriter { } if ( isset( $row->rev_sha1 ) && $row->rev_sha1 && !( $row->rev_deleted & Revision::DELETED_TEXT ) ) { - $out .= " " . Xml::element('sha1', null, strval( $row->rev_sha1 ) ) . "\n"; + $out .= " " . Xml::element( 'sha1', null, strval( $row->rev_sha1 ) ) . "\n"; } else { $out .= " \n"; } - if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) { + if ( isset( $row->rev_content_model ) && !is_null( $row->rev_content_model ) ) { $content_model = strval( $row->rev_content_model ); } else { // probably using $wgContentHandlerUseDB = false; @@ -688,7 +688,7 @@ class XmlDumpWriter { $content_model = ContentHandler::getDefaultModelFor( $title ); } - $out .= " " . Xml::element('model', null, strval( $content_model ) ) . "\n"; + $out .= " " . Xml::element( 'model', null, strval( $content_model ) ) . "\n"; if ( isset( $row->rev_content_format ) && !is_null( $row->rev_content_format ) ) { $content_format = strval( $row->rev_content_format ); @@ -699,7 +699,7 @@ class XmlDumpWriter { $content_format = $content_handler->getDefaultFormat(); } - $out .= " " . Xml::element('format', null, strval( $content_format ) ) . "\n"; + $out .= " " . Xml::element( 'format', null, strval( $content_format ) ) . "\n"; wfRunHooks( 'XmlDumpWriterWriteRevision', array( &$this, &$out, $row, $text ) ); @@ -720,7 +720,7 @@ class XmlDumpWriter { function writeLogItem( $row ) { wfProfileIn( __METHOD__ ); - $out = " \n"; + $out = " \n"; $out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n"; $out .= $this->writeTimestamp( $row->log_timestamp, " " ); @@ -1009,7 +1009,7 @@ class DumpFileOutput extends DumpOutput { * @throws MWException */ function renameOrException( $newname ) { - if (! rename( $this->filename, $newname ) ) { + if ( !rename( $this->filename, $newname ) ) { throw new MWException( __METHOD__ . ": rename of file {$this->filename} to $newname failed\n" ); } } @@ -1072,7 +1072,7 @@ class DumpPipeOutput extends DumpFileOutput { */ function __construct( $command, $file = null ) { if ( !is_null( $file ) ) { - $command .= " > " . wfEscapeShellArg( $file ); + $command .= " > " . wfEscapeShellArg( $file ); } $this->startCommand( $command ); @@ -1128,7 +1128,7 @@ class DumpPipeOutput extends DumpFileOutput { $this->renameOrException( $newname ); if ( $open ) { $command = $this->command; - $command .= " > " . wfEscapeShellArg( $this->filename ); + $command .= " > " . wfEscapeShellArg( $this->filename ); $this->startCommand( $command ); } } @@ -1361,7 +1361,7 @@ class DumpNamespaceFilter extends DumpFilter { "NS_PROJECT_TALK" => NS_PROJECT_TALK, "NS_FILE" => NS_FILE, "NS_FILE_TALK" => NS_FILE_TALK, - "NS_IMAGE" => NS_IMAGE, // NS_IMAGE is an alias for NS_FILE + "NS_IMAGE" => NS_IMAGE, // NS_IMAGE is an alias for NS_FILE "NS_IMAGE_TALK" => NS_IMAGE_TALK, "NS_MEDIAWIKI" => NS_MEDIAWIKI, "NS_MEDIAWIKI_TALK" => NS_MEDIAWIKI_TALK, @@ -1529,7 +1529,7 @@ class DumpMultiWriter { function getFilenames() { $filenames = array(); for ( $i = 0; $i < $this->count; $i++ ) { - $filenames[] = $this->sinks[$i]->getFilenames(); + $filenames[] = $this->sinks[$i]->getFilenames(); } return $filenames; } diff --git a/includes/ExternalUser.php b/includes/ExternalUser.php index 82fe196c50..8cf9c84fa3 100644 --- a/includes/ExternalUser.php +++ b/includes/ExternalUser.php @@ -285,7 +285,7 @@ abstract class ExternalUser { $dbw->replace( 'external_user', array( 'eu_local_id', 'eu_external_id' ), array( 'eu_local_id' => $id, - 'eu_external_id' => $this->getId() ), + 'eu_external_id' => $this->getId() ), __METHOD__ ); } diff --git a/includes/FakeTitle.php b/includes/FakeTitle.php index 60f7600de1..efa213fbe5 100644 --- a/includes/FakeTitle.php +++ b/includes/FakeTitle.php @@ -114,9 +114,9 @@ class FakeTitle extends Title { function getParentCategories() { $this->error(); } function getParentCategoryTree( $children = array() ) { $this->error(); } function pageCond() { $this->error(); } - function getPreviousRevisionID( $revId, $flags=0 ) { $this->error(); } - function getNextRevisionID( $revId, $flags=0 ) { $this->error(); } - function getFirstRevision( $flags=0 ) { $this->error(); } + function getPreviousRevisionID( $revId, $flags = 0 ) { $this->error(); } + function getNextRevisionID( $revId, $flags = 0 ) { $this->error(); } + function getFirstRevision( $flags = 0 ) { $this->error(); } function isNewPage() { $this->error(); } function getEarliestRevTime( $flags = 0 ) { $this->error(); } function countRevisionsBetween( $old, $new ) { $this->error(); } diff --git a/includes/Feed.php b/includes/Feed.php index f9dbf5ba71..8e000ae61e 100644 --- a/includes/Feed.php +++ b/includes/Feed.php @@ -243,9 +243,9 @@ abstract class ChannelFeed extends FeedItem { */ function contentType() { 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'); + $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'); } /** diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 82c6e4a0ea..66f627513d 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -39,7 +39,7 @@ class FeedUtils { public static function checkPurge( $timekey, $key ) { global $wgRequest, $wgUser, $messageMemc; $purge = $wgRequest->getVal( 'action' ) === 'purge'; - if ( $purge && $wgUser->isAllowed('purge') ) { + if ( $purge && $wgUser->isAllowed( 'purge' ) ) { $messageMemc->delete( $timekey ); $messageMemc->delete( $key ); } @@ -102,7 +102,7 @@ class FeedUtils { * @param $actiontext String: text of the action; in case of log event * @return String */ - public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext='' ) { + public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext = '' ) { global $wgFeedDiffCutoff, $wgLang; wfProfileIn( __METHOD__ ); diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index e2fcd9cb15..48073f72c8 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -80,13 +80,13 @@ class FileDeleteForm { $this->oldimage = $wgRequest->getText( 'oldimage', false ); $token = $wgRequest->getText( 'wpEditToken' ); # Flag to hide all contents of the archived revisions - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('suppressrevision'); + $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' ); 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; @@ -344,7 +344,7 @@ class FileDeleteForm { * * @return bool */ - public static function isValidOldSpec($oldimage) { + public static function isValidOldSpec( $oldimage ) { return strlen( $oldimage ) >= 16 && strpos( $oldimage, '/' ) === false && strpos( $oldimage, '\\' ) === false; @@ -360,7 +360,7 @@ class FileDeleteForm { * @param $oldimage File * @return bool */ - public static function haveDeletableFile(&$file, &$oldfile, $oldimage) { + public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) { return $oldimage ? $oldfile && $oldfile->exists() && $oldfile->isLocal() : $file && $file->exists() && $file->isLocal(); diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 2292e31563..1ff9ac7b40 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -50,7 +50,7 @@ if ( !function_exists( 'mb_substr' ) ) { * @codeCoverageIgnore * @return string */ - function mb_substr( $str, $start, $count='end' ) { + function mb_substr( $str, $start, $count = 'end' ) { return Fallback::mb_substr( $str, $start, $count ); } @@ -392,7 +392,7 @@ function wfArrayToCgi( $array1, $array2 = null, $prefix = '' ) { $cgi = ''; foreach ( $array1 as $key => $value ) { - if ( !is_null($value) && $value !== false ) { + if ( !is_null( $value ) && $value !== false ) { if ( $cgi != '' ) { $cgi .= '&'; } @@ -2449,7 +2449,7 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) { $timestamp = new MWTimestamp( $ts ); return $timestamp->getTimestamp( $outputtype ); } catch( TimestampException $e ) { - wfDebug("wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts\n"); + wfDebug( "wfTimestamp() fed bogus time value: TYPE=$outputtype; VALUE=$ts\n" ); return false; } } @@ -2824,7 +2824,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $limits = array $cmd = $envcmd . $cmd; if ( php_uname( 's' ) == 'Linux' ) { - $time = intval ( isset($limits['time']) ? $limits['time'] : $wgMaxShellTime ); + $time = intval ( isset( $limits['time'] ) ? $limits['time'] : $wgMaxShellTime ); if ( isset( $limits['walltime'] ) ) { $wallTime = intval( $limits['walltime'] ); } elseif ( isset( $limits['time'] ) ) { @@ -2832,8 +2832,8 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $limits = array } else { $wallTime = intval( $wgMaxShellWallClockTime ); } - $mem = intval ( isset($limits['memory']) ? $limits['memory'] : $wgMaxShellMemory ); - $filesize = intval ( isset($limits['filesize']) ? $limits['filesize'] : $wgMaxShellFileSize ); + $mem = intval ( isset( $limits['memory'] ) ? $limits['memory'] : $wgMaxShellMemory ); + $filesize = intval ( isset( $limits['filesize'] ) ? $limits['filesize'] : $wgMaxShellFileSize ); if ( $time > 0 || $mem > 0 || $filesize > 0 || $wallTime > 0 ) { $cmd = '/bin/bash ' . escapeshellarg( "$IP/bin/ulimit5.sh" ) . diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 952022f4bb..86eb38dda1 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -639,9 +639,9 @@ class HTMLForm extends ContextSource { : 'application/x-www-form-urlencoded'; # Attributes $attribs = array( - 'action' => $this->mAction === false ? $this->getTitle()->getFullURL() : $this->mAction, - 'method' => $this->mMethod, - 'class' => 'visualClear', + 'action' => $this->mAction === false ? $this->getTitle()->getFullURL() : $this->mAction, + 'method' => $this->mMethod, + 'class' => 'visualClear', 'enctype' => $encType, ); if ( !empty( $this->mId ) ) { @@ -712,8 +712,8 @@ class HTMLForm extends ContextSource { foreach ( $this->mButtons as $button ) { $attrs = array( - 'type' => 'submit', - 'name' => $button['name'], + 'type' => 'submit', + 'name' => $button['name'], 'value' => $button['value'] ); diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 3de148b480..597417328b 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -247,7 +247,7 @@ class HistoryBlobStub { if ( !isset( $parts[1] ) || $parts[1] == '' ) { return false; } - $row->old_text = ExternalStore::fetchFromUrl($url); + $row->old_text = ExternalStore::fetchFromUrl( $url ); } if( !in_array( 'object', $flags ) ) { @@ -395,7 +395,7 @@ class DiffHistoryBlob implements HistoryBlob { */ function addItem( $text ) { if ( $this->mFrozen ) { - throw new MWException( __METHOD__.": Cannot add more items after sleep/wakeup" ); + throw new MWException( __METHOD__ . ": Cannot add more items after sleep/wakeup" ); } $this->mItems[] = $text; @@ -535,11 +535,11 @@ class DiffHistoryBlob implements HistoryBlob { # Check the checksum if hash/mhash is available $ofp = $this->xdiffAdler32( $base ); if ( $ofp !== false && $ofp !== substr( $diff, 0, 4 ) ) { - wfDebug( __METHOD__. ": incorrect base checksum\n" ); + wfDebug( __METHOD__ . ": incorrect base checksum\n" ); return false; } if ( $header['csize'] != strlen( $base ) ) { - wfDebug( __METHOD__. ": incorrect base length\n" ); + wfDebug( __METHOD__ . ": incorrect base length\n" ); return false; } @@ -568,7 +568,7 @@ class DiffHistoryBlob implements HistoryBlob { $out .= substr( $base, $x['off'], $x['csize'] ); break; default: - wfDebug( __METHOD__.": invalid op\n" ); + wfDebug( __METHOD__ . ": invalid op\n" ); return false; } } diff --git a/includes/Html.php b/includes/Html.php index 14456e4bee..cc9b54b8d5 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -465,8 +465,7 @@ class Html { $key = strtolower( $key ); // Here we're blacklisting some HTML5-only attributes... - if ( !$wgHtml5 && in_array( $key, self::$HTMLFiveOnlyAttribs ) - ) { + if ( !$wgHtml5 && in_array( $key, self::$HTMLFiveOnlyAttribs ) ) { continue; } @@ -738,7 +737,7 @@ class Html { } } - if (substr($value, 0, 1) == "\n") { + if ( substr( $value, 0, 1 ) == "\n" ) { // Workaround for bug 12130: browsers eat the initial newline // assuming that it's just for show, but they do keep the later // newlines, which we may want to preserve during editing. @@ -930,7 +929,7 @@ class Html { $icon = $wgStylePath.'/common/images/'.$icon; } - $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class") ); + $s = Html::openElement( 'div', array( 'class' => "mw-infobox $class") ); $s .= Html::openElement( 'div', array( 'class' => 'mw-infobox-left' ) ). Html::element( 'img', diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 337beb4435..9e9f0dae0b 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -244,7 +244,7 @@ class MWHttpRequest { } $members = array( "postData", "proxy", "noProxy", "sslVerifyHost", "caInfo", - "method", "followRedirects", "maxRedirects", "sslVerifyCert", "callback" ); + "method", "followRedirects", "maxRedirects", "sslVerifyCert", "callback" ); foreach ( $members as $o ) { if ( isset( $options[$o] ) ) { @@ -284,7 +284,7 @@ class MWHttpRequest { Http::$httpEngine = function_exists( 'curl_init' ) ? 'curl' : 'php'; } elseif ( Http::$httpEngine == 'curl' && !function_exists( 'curl_init' ) ) { throw new MWException( __METHOD__ . ': curl (http://php.net/curl) is not installed, but' . - ' Http::$httpEngine is set to "curl"' ); + ' Http::$httpEngine is set to "curl"' ); } switch( Http::$httpEngine ) { @@ -646,12 +646,12 @@ class MWHttpRequest { $locations = $headers[ 'location' ]; $domain = ''; $foundRelativeURI = false; - $countLocations = count($locations); + $countLocations = count( $locations ); for ( $i = $countLocations - 1; $i >= 0; $i-- ) { $url = parse_url( $locations[ $i ] ); - if ( isset($url[ 'host' ]) ) { + if ( isset( $url['host'] ) ) { $domain = $url[ 'scheme' ] . '://' . $url[ 'host' ]; break; //found correct URI (with host) } else { diff --git a/includes/ImagePage.php b/includes/ImagePage.php index a54bd92143..2a3e8e8a27 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -156,7 +156,7 @@ class ImagePage extends Article { $pageLang = $this->getTitle()->getPageViewLanguage(); $out->addHTML( Xml::openElement( 'div', array( 'id' => 'mw-imagepage-content', 'lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(), - 'class' => 'mw-content-'.$pageLang->getDir() ) ) ); + 'class' => 'mw-content-' . $pageLang->getDir() ) ) ); parent::view(); @@ -538,7 +538,7 @@ EOT array( 'delete', 'move' ), $this->getTitle()->getPrefixedText(), '', - array( 'lim' => 10, + array( 'lim' => 10, 'conds' => array( "log_action != 'revision'" ), 'showIfEmpty' => false, 'msgKey' => array( 'moveddeleted-notice' ) @@ -630,7 +630,7 @@ EOT return $uploadTitle->getFullURL( array( 'wpDestFile' => $this->mPage->getFile()->getName(), 'wpForReUpload' => 1 - ) ); + ) ); } /** @@ -1044,9 +1044,9 @@ class ImageHistoryList extends ContextSource { } else { list( $ts, ) = explode( '!', $img, 2 ); $query = array( - 'type' => 'oldimage', + 'type' => 'oldimage', 'target' => $this->title->getPrefixedText(), - 'ids' => $ts, + 'ids' => $ts, ); $del = Linker::revDeleteLink( $query, $file->isDeleted( File::DELETED_RESTRICTED ), $canHide ); diff --git a/includes/Import.php b/includes/Import.php index d00002ae4c..cc642e4501 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -400,7 +400,7 @@ class WikiImporter { /** Left in for debugging */ private function dumpElement() { static $lookup = null; - if (!$lookup) { + if ( !$lookup ) { $xmlReaderConstants = array( "NONE", "ELEMENT", @@ -473,7 +473,7 @@ class WikiImporter { $skip = true; } - if ($skip) { + if ( $skip ) { $keepReading = $this->reader->next(); $skip = false; $this->debug( "Skip" ); @@ -897,7 +897,7 @@ class UploadSourceAdapter { * @return bool */ function stream_open( $path, $mode, $options, &$opened_path ) { - $url = parse_url($path); + $url = parse_url( $path ); $id = $url['host']; if ( !isset( self::$sourceRegistrations[$id] ) ) { @@ -918,22 +918,22 @@ class UploadSourceAdapter { $leave = false; while ( !$leave && !$this->mSource->atEnd() && - strlen($this->mBuffer) < $count ) { + strlen( $this->mBuffer ) < $count ) { $read = $this->mSource->readChunk(); - if ( !strlen($read) ) { + if ( !strlen( $read ) ) { $leave = true; } $this->mBuffer .= $read; } - if ( strlen($this->mBuffer) ) { + if ( strlen( $this->mBuffer ) ) { $return = substr( $this->mBuffer, 0, $count ); $this->mBuffer = substr( $this->mBuffer, $count ); } - $this->mPosition += strlen($return); + $this->mPosition += strlen( $return ); return $return; } @@ -1390,7 +1390,7 @@ class WikiRevision { array( 'rev_page' => $pageId, 'rev_timestamp' => $dbw->timestamp( $this->timestamp ), 'rev_user_text' => $userText, - 'rev_comment' => $this->getComment() ), + 'rev_comment' => $this->getComment() ), __METHOD__ ); if( $prior ) { @@ -1405,15 +1405,15 @@ class WikiRevision { # @todo FIXME: Use original rev_id optionally (better for backups) # Insert the row $revision = new Revision( array( - 'title' => $this->title, - 'page' => $pageId, - 'content_model' => $this->getModel(), + 'title' => $this->title, + 'page' => $pageId, + 'content_model' => $this->getModel(), 'content_format' => $this->getFormat(), - 'text' => $this->getContent()->serialize( $this->getFormat() ), //XXX: just set 'content' => $this->getContent()? - 'comment' => $this->getComment(), - 'user' => $userId, - 'user_text' => $userText, - 'timestamp' => $this->timestamp, + 'text' => $this->getContent()->serialize( $this->getFormat() ), //XXX: just set 'content' => $this->getContent()? + 'comment' => $this->getComment(), + 'user' => $userId, + 'user_text' => $userText, + 'timestamp' => $this->timestamp, 'minor_edit' => $this->minor, ) ); $revision->insertOn( $dbw ); @@ -1442,13 +1442,13 @@ class WikiRevision { // @todo FIXME: Use original log ID (better for backups) $prior = $dbw->selectField( 'logging', '1', array( 'log_type' => $this->getType(), - 'log_action' => $this->getAction(), + 'log_action' => $this->getAction(), 'log_timestamp' => $dbw->timestamp( $this->timestamp ), 'log_namespace' => $this->getTitle()->getNamespace(), - 'log_title' => $this->getTitle()->getDBkey(), - 'log_comment' => $this->getComment(), + 'log_title' => $this->getTitle()->getDBkey(), + 'log_comment' => $this->getComment(), #'log_user_text' => $this->user_text, - 'log_params' => $this->params ), + 'log_params' => $this->params ), __METHOD__ ); // @todo FIXME: This could fail slightly for multiple matches :P diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index c2f6b1ebee..28379c77c4 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -89,7 +89,7 @@ class LinkFilter { * @param $prot String: protocol * @return Array to be passed to DatabaseBase::buildLike() or false on error */ - public static function makeLikeArray( $filterEntry , $prot = 'http://' ) { + public static function makeLikeArray( $filterEntry, $prot = 'http://' ) { $db = wfGetDB( DB_MASTER ); if ( substr( $filterEntry, 0, 2 ) == '*.' ) { $subdomains = true; @@ -118,7 +118,7 @@ class LinkFilter { } // Reverse the labels in the hostname, convert to lower case // For emails reverse domainpart only - if ( $prot == 'mailto:' && strpos($host, '@') ) { + if ( $prot == 'mailto:' && strpos( $host, '@' ) ) { // complete email adress $mailparts = explode( '@', $host ); $domainpart = strtolower( implode( '.', array_reverse( explode( '.', $mailparts[1] ) ) ) ); diff --git a/includes/Linker.php b/includes/Linker.php index bc0bb7777e..455539832c 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -33,7 +33,7 @@ class Linker { * Flags for userToolLinks() */ const TOOL_LINKS_NOBLOCK = 1; - const TOOL_LINKS_EMAIL = 2; + const TOOL_LINKS_EMAIL = 2; /** * Get the appropriate HTML attributes to add to the "a" element of an ex- @@ -600,9 +600,9 @@ class Linker { $prefix = $postfix = ''; if ( 'center' == $fp['align'] ) { - $prefix = '
    '; + $prefix = '
    '; $postfix = '
    '; - $fp['align'] = 'none'; + $fp['align'] = 'none'; } if ( $file && !isset( $hp['width'] ) ) { if ( isset( $hp['height'] ) && $file->isVectorized() ) { @@ -724,7 +724,7 @@ class Linker { $extLinkAttrs = $parser->getExternalLinkAttribs( $frameParams['link-url'] ); foreach ( $extLinkAttrs as $name => $val ) { // Currently could include 'rel' and 'target' - $mtoParams['parser-extlink-'.$name] = $val; + $mtoParams['parser-extlink-' . $name] = $val; } } } elseif ( isset( $frameParams['link-title'] ) && $frameParams['link-title'] !== '' ) { @@ -751,7 +751,7 @@ class Linker { * @return mixed */ public static function makeThumbLinkObj( Title $title, $file, $label = '', $alt, - $align = 'right', $params = array(), $framed = false , $manualthumb = "" ) + $align = 'right', $params = array(), $framed = false, $manualthumb = "" ) { $frameParams = array( 'alt' => $alt, @@ -1028,7 +1028,7 @@ class Linker { $key = strtolower( $name ); } - return self::linkKnown( SpecialPage::getTitleFor( $name ) , wfMessage( $key )->text() ); + return self::linkKnown( SpecialPage::getTitleFor( $name ), wfMessage( $key )->text() ); } /** @@ -1672,11 +1672,10 @@ class Linker { $lang = wfGetLangObj( $lang ); $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped(); - return - '
    ' - . '

    ' . $title . "

    \n" - . $toc - . "\n
    \n"; + return '
    ' + . '

    ' . $title . "

    \n" + . $toc + . "\n
    \n"; } /** @@ -2075,7 +2074,7 @@ class Linker { # Compatibility: formerly some tooltips had [alt-.] hardcoded $tooltip = preg_replace( "/ ?\[alt-.\]$/", '', $tooltip ); # Message equal to '-' means suppress it. - if ( $tooltip == '-' ) { + if ( $tooltip == '-' ) { $tooltip = false; } } @@ -2157,17 +2156,17 @@ class Linker { // RevDelete links using revision ID are stable across // page deletion and undeletion; use when possible. $query = array( - 'type' => 'revision', + 'type' => 'revision', 'target' => $title->getPrefixedDBkey(), - 'ids' => $rev->getId() + 'ids' => $rev->getId() ); } else { // Older deleted entries didn't save a revision ID. // We have to refer to these by timestamp, ick! $query = array( - 'type' => 'archive', + 'type' => 'archive', 'target' => $title->getPrefixedDBkey(), - 'ids' => $rev->getTimestamp() + 'ids' => $rev->getTimestamp() ); } return Linker::revDeleteLink( $query, @@ -2287,7 +2286,7 @@ class Linker { * @return string the a-element */ static function makeKnownLinkObj( - $title, $text = '', $query = '', $trail = '', $prefix = '' , $aprops = '', $style = '' + $title, $text = '', $query = '', $trail = '', $prefix = '', $aprops = '', $style = '' ) { wfDeprecated( __METHOD__, '1.21' ); diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index cfd7413a6e..83883b5290 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -213,14 +213,14 @@ class LinksUpdate extends SqlDataUpdate { $existing = $this->getExistingImages(); $imageUpdates = array_diff_key( $existing, $this->mImages ) + array_diff_key( $this->mImages, $existing ); - $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' ); - $this->dumbTableUpdate( 'imagelinks', $this->getImageInsertions(), 'il_from' ); + $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' ); + $this->dumbTableUpdate( 'imagelinks', $this->getImageInsertions(), 'il_from' ); $this->dumbTableUpdate( 'categorylinks', $this->getCategoryInsertions(), 'cl_from' ); $this->dumbTableUpdate( 'templatelinks', $this->getTemplateInsertions(), 'tl_from' ); $this->dumbTableUpdate( 'externallinks', $this->getExternalInsertions(), 'el_from' ); - $this->dumbTableUpdate( 'langlinks', $this->getInterlangInsertions(),'ll_from' ); - $this->dumbTableUpdate( 'iwlinks', $this->getInterwikiInsertions(),'iwl_from' ); - $this->dumbTableUpdate( 'page_props', $this->getPropertyInsertions(), 'pp_page' ); + $this->dumbTableUpdate( 'langlinks', $this->getInterlangInsertions(), 'll_from' ); + $this->dumbTableUpdate( 'iwlinks', $this->getInterwikiInsertions(), 'iwl_from' ); + $this->dumbTableUpdate( 'page_props', $this->getPropertyInsertions(), 'pp_page' ); # Update the cache of all the category pages and image description # pages which were changed, and fix the category table count @@ -291,7 +291,7 @@ class LinksUpdate extends SqlDataUpdate { $this->mDb->delete( $table, array( $fromField => $this->mId ), __METHOD__ ); if ( count( $insertions ) ) { # The link array was constructed without FOR UPDATE, so there may - # be collisions. This may cause minor link table inconsistencies, + # be collisions. This may cause minor link table inconsistencies, # which is better than crippling the site with lock contention. $this->mDb->insert( $table, $insertions, __METHOD__, array( 'IGNORE' ) ); } @@ -360,9 +360,9 @@ class LinksUpdate extends SqlDataUpdate { : $dbkeys; foreach ( $diffs as $dbk => $id ) { $arr[] = array( - 'pl_from' => $this->mId, + 'pl_from' => $this->mId, 'pl_namespace' => $ns, - 'pl_title' => $dbk + 'pl_title' => $dbk ); } } @@ -380,9 +380,9 @@ class LinksUpdate extends SqlDataUpdate { $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys; foreach ( $diffs as $dbk => $id ) { $arr[] = array( - 'tl_from' => $this->mId, + 'tl_from' => $this->mId, 'tl_namespace' => $ns, - 'tl_title' => $dbk + 'tl_title' => $dbk ); } } @@ -401,7 +401,7 @@ class LinksUpdate extends SqlDataUpdate { foreach( $diffs as $iname => $dummy ) { $arr[] = array( 'il_from' => $this->mId, - 'il_to' => $iname + 'il_to' => $iname ); } return $arr; @@ -418,9 +418,9 @@ class LinksUpdate extends SqlDataUpdate { foreach( $diffs as $url => $dummy ) { foreach( wfMakeUrlIndexes( $url ) as $index ) { $arr[] = array( - 'el_from' => $this->mId, - 'el_to' => $url, - 'el_index' => $index, + 'el_from' => $this->mId, + 'el_to' => $url, + 'el_index' => $index, ); } } @@ -459,8 +459,8 @@ class LinksUpdate extends SqlDataUpdate { $this->mTitle->getCategorySortkey( $prefix ) ); $arr[] = array( - 'cl_from' => $this->mId, - 'cl_to' => $name, + 'cl_from' => $this->mId, + 'cl_to' => $name, 'cl_sortkey' => $sortkey, 'cl_timestamp' => $this->mDb->timestamp(), 'cl_sortkey_prefix' => $prefix, @@ -483,8 +483,8 @@ class LinksUpdate extends SqlDataUpdate { $arr = array(); foreach( $diffs as $lang => $title ) { $arr[] = array( - 'll_from' => $this->mId, - 'll_lang' => $lang, + 'll_from' => $this->mId, + 'll_lang' => $lang, 'll_title' => $title ); } @@ -501,9 +501,9 @@ class LinksUpdate extends SqlDataUpdate { $arr = array(); foreach ( $diffs as $name => $value ) { $arr[] = array( - 'pp_page' => $this->mId, - 'pp_propname' => $name, - 'pp_value' => $value, + 'pp_page' => $this->mId, + 'pp_propname' => $name, + 'pp_value' => $value, ); } return $arr; @@ -521,9 +521,9 @@ class LinksUpdate extends SqlDataUpdate { $diffs = isset( $existing[$prefix] ) ? array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys; foreach ( $diffs as $dbk => $id ) { $arr[] = array( - 'iwl_from' => $this->mId, + 'iwl_from' => $this->mId, 'iwl_prefix' => $prefix, - 'iwl_title' => $dbk + 'iwl_title' => $dbk ); } } diff --git a/includes/MagicWord.php b/includes/MagicWord.php index d1f6a0fb88..257a46daea 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -217,7 +217,7 @@ class MagicWord { /**#@-*/ - function __construct($id = 0, $syn = array(), $cs = false) { + function __construct( $id = 0, $syn = array(), $cs = false ) { $this->mId = $id; $this->mSynonyms = (array)$syn; $this->mCaseSensitive = $cs; @@ -367,7 +367,7 @@ class MagicWord { * @return string */ function getRegex() { - if ($this->mRegex == '' ) { + if ( $this->mRegex == '' ) { $this->initRegex(); } return $this->mRegex; @@ -393,7 +393,7 @@ class MagicWord { * @return string */ function getRegexStart() { - if ($this->mRegex == '' ) { + if ( $this->mRegex == '' ) { $this->initRegex(); } return $this->mRegexStart; @@ -405,7 +405,7 @@ class MagicWord { * @return string */ function getBaseRegex() { - if ($this->mRegex == '') { + if ( $this->mRegex == '' ) { $this->initRegex(); } return $this->mBaseRegex; @@ -454,9 +454,9 @@ class MagicWord { # blank elements and re-sort the indices. # See also bug 6526 - $matches = array_values(array_filter($matches)); + $matches = array_values( array_filter( $matches ) ); - if ( count($matches) == 1 ) { + if ( count( $matches ) == 1 ) { return $matches[0]; } else { return $matches[1]; @@ -618,7 +618,7 @@ class MagicWord { function addToArray( &$array, $value ) { global $wgContLang; foreach ( $this->mSynonyms as $syn ) { - $array[$wgContLang->lc($syn)] = $value; + $array[$wgContLang->lc( $syn )] = $value; } } @@ -812,7 +812,7 @@ class MagicWordArray { return array( $magicName, $paramValue ); } // This shouldn't happen either - throw new MWException( __METHOD__.': parameter not found' ); + throw new MWException( __METHOD__ . ': parameter not found' ); } /** diff --git a/includes/Message.php b/includes/Message.php index 5ea0277869..8d8cdeeb70 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -252,9 +252,9 @@ class Message { public static function newFallbackSequence( /*...*/ ) { $keys = func_get_args(); if ( func_num_args() == 1 ) { - if ( is_array($keys[0]) ) { + if ( is_array( $keys[0] ) ) { // Allow an array to be passed as the first argument instead - $keys = array_values($keys[0]); + $keys = array_values( $keys[0] ); } else { // Optimize a single string to not need special fallback handling $keys = $keys[0]; @@ -431,7 +431,7 @@ class Message { $string = $this->fetchMessage(); if ( $string === false ) { - $key = htmlspecialchars( is_array( $this->key ) ? $this->key[0] : $this->key ); + $key = htmlspecialchars( is_array( $this->key ) ? $this->key[0] : $this->key ); if ( $this->format === 'plain' ) { return '<' . $key . '>'; } @@ -474,7 +474,7 @@ class Message { /** * Magic method implementation of the above (for PHP >= 5.2.0), so we can do, eg: - * $foo = Message::get($key); + * $foo = Message::get( $key ); * $string = "$foo"; * @since 1.18 * @return String diff --git a/includes/Metadata.php b/includes/Metadata.php index 9a4ddca997..0b8014a7b4 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -82,10 +82,10 @@ abstract class RdfMetaData { print "\t\t{$value}\n"; } - protected function date($timestamp) { - return substr($timestamp, 0, 4) . '-' - . substr($timestamp, 4, 2) . '-' - . substr($timestamp, 6, 2); + protected function date( $timestamp ) { + return substr( $timestamp, 0, 4 ) . '-' + . substr( $timestamp, 4, 2 ) . '-' + . substr( $timestamp, 6, 2 ); } protected function pageOrString( $name, $page, $str ) { @@ -110,7 +110,7 @@ abstract class RdfMetaData { $this->url( $name, $title->getFullUrl() ); } - protected function url($name, $url) { + protected function url( $name, $url ) { $url = htmlspecialchars( $url ); print "\t\t\n"; } @@ -166,23 +166,23 @@ abstract class RdfMetaData { } protected function getKnownLicenses() { - $ccLicenses = array('by', 'by-nd', 'by-nd-nc', 'by-nc', - 'by-nc-sa', 'by-sa'); - $ccVersions = array('1.0', '2.0'); + $ccLicenses = array( 'by', 'by-nd', 'by-nd-nc', 'by-nc', + 'by-nc-sa', 'by-sa' ); + $ccVersions = array( '1.0', '2.0' ); $knownLicenses = array(); - foreach ($ccVersions as $version) { - foreach ($ccLicenses as $license) { - if( $version == '2.0' && substr( $license, 0, 2) != 'by' ) { + foreach ( $ccVersions as $version ) { + foreach ( $ccLicenses as $license ) { + if( $version == '2.0' && substr( $license, 0, 2 ) != 'by' ) { # 2.0 dropped the non-attribs licenses continue; } $lurl = "http://creativecommons.org/licenses/{$license}/{$version}/"; - $knownLicenses[$lurl] = explode('-', $license); + $knownLicenses[$lurl] = explode( '-', $license ); $knownLicenses[$lurl][] = 're'; $knownLicenses[$lurl][] = 'di'; $knownLicenses[$lurl][] = 'no'; - if (!in_array('nd', $knownLicenses[$lurl])) { + if ( !in_array( 'nd', $knownLicenses[$lurl] ) ) { $knownLicenses[$lurl][] = 'de'; } } @@ -191,11 +191,11 @@ abstract class RdfMetaData { /* Handle the GPL and LGPL, too. */ $knownLicenses['http://creativecommons.org/licenses/GPL/2.0/'] = - array('de', 're', 'di', 'no', 'sa', 'sc'); + array( 'de', 're', 'di', 'no', 'sa', 'sc' ); $knownLicenses['http://creativecommons.org/licenses/LGPL/2.1/'] = - array('de', 're', 'di', 'no', 'sa', 'sc'); + array( 'de', 're', 'di', 'no', 'sa', 'sc' ); $knownLicenses['http://www.gnu.org/copyleft/fdl.html'] = - array('de', 're', 'di', 'no', 'sa', 'sc'); + array( 'de', 're', 'di', 'no', 'sa', 'sc' ); return $knownLicenses; } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index b2611c2e00..108ba1dbbc 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -197,14 +197,14 @@ class MimeMagic { if ( $wgMimeTypeFile ) { if ( is_file( $wgMimeTypeFile ) and is_readable( $wgMimeTypeFile ) ) { - wfDebug( __METHOD__.": loading mime types from $wgMimeTypeFile\n" ); + wfDebug( __METHOD__ . ": loading mime types from $wgMimeTypeFile\n" ); $types .= "\n"; $types .= file_get_contents( $wgMimeTypeFile ); } else { - wfDebug( __METHOD__.": can't load mime types from $wgMimeTypeFile\n" ); + wfDebug( __METHOD__ . ": can't load mime types from $wgMimeTypeFile\n" ); } } else { - wfDebug( __METHOD__.": no mime types file defined, using build-ins only.\n" ); + wfDebug( __METHOD__ . ": no mime types file defined, using build-ins only.\n" ); } $types = str_replace( array( "\r\n", "\n\r", "\n\n", "\r\r", "\r" ), "\n", $types ); @@ -213,7 +213,7 @@ class MimeMagic { $this->mMimeToExt = array(); $this->mToMime = array(); - $lines = explode( "\n",$types ); + $lines = explode( "\n", $types ); foreach ( $lines as $s ) { $s = trim( $s ); if ( empty( $s ) ) { @@ -231,7 +231,7 @@ class MimeMagic { } $mime = substr( $s, 0, $i ); - $ext = trim( substr($s, $i+1 ) ); + $ext = trim( substr( $s, $i+1 ) ); if ( empty( $ext ) ) { continue; @@ -272,17 +272,17 @@ class MimeMagic { if ( $wgMimeInfoFile ) { if ( is_file( $wgMimeInfoFile ) and is_readable( $wgMimeInfoFile ) ) { - wfDebug( __METHOD__.": loading mime info from $wgMimeInfoFile\n" ); + wfDebug( __METHOD__ . ": loading mime info from $wgMimeInfoFile\n" ); $info .= "\n"; $info .= file_get_contents( $wgMimeInfoFile ); } else { - wfDebug(__METHOD__.": can't load mime info from $wgMimeInfoFile\n"); + wfDebug( __METHOD__ . ": can't load mime info from $wgMimeInfoFile\n" ); } } else { - wfDebug(__METHOD__.": no mime info file defined, using build-ins only.\n"); + wfDebug( __METHOD__ . ": no mime info file defined, using build-ins only.\n" ); } - $info = str_replace( array( "\r\n", "\n\r", "\n\n", "\r\r", "\r" ), "\n", $info); + $info = str_replace( array( "\r\n", "\n\r", "\n\n", "\r\r", "\r" ), "\n", $info ); $info = str_replace( "\t", " ", $info ); $this->mMimeTypeAliases = array(); @@ -332,7 +332,7 @@ class MimeMagic { if ( count( $m ) > 1 ) { $main = $m[0]; - for ( $i=1; $imMimeTypeAliases[$mime] = $main; } @@ -511,7 +511,7 @@ class MimeMagic { public function improveTypeFromExtension( $mime, $ext ) { if ( $mime === 'unknown/unknown' ) { if ( $this->isRecognizableExtension( $ext ) ) { - wfDebug( __METHOD__. ': refusing to guess mime type for .' . + wfDebug( __METHOD__ . ': refusing to guess mime type for .' . "$ext file, we should have recognized it\n" ); } else { // Not something we can detect, so simply @@ -525,7 +525,7 @@ class MimeMagic { // find the proper mime type for that file extension $mime = $this->guessTypesForExtension( $ext ); } else { - wfDebug( __METHOD__. ": refusing to guess better type for $mime file, " . + wfDebug( __METHOD__ . ": refusing to guess better type for $mime file, " . ".$ext is not a known OPC extension.\n" ); $mime = 'application/zip'; } @@ -535,7 +535,7 @@ class MimeMagic { $mime = $this->mMimeTypeAliases[$mime]; } - wfDebug(__METHOD__.": improved mime type for .$ext: $mime\n"); + wfDebug( __METHOD__ . ": improved mime type for .$ext: $mime\n" ); return $mime; } @@ -555,14 +555,14 @@ class MimeMagic { */ public function guessMimeType( $file, $ext = true ) { if ( $ext ) { // TODO: make $ext default to false. Or better, remove it. - wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. " . + wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. " . "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); } $mime = $this->doGuessMimeType( $file, $ext ); if( !$mime ) { - wfDebug( __METHOD__.": internal type detection failed for $file (.$ext)...\n" ); + wfDebug( __METHOD__ . ": internal type detection failed for $file (.$ext)...\n" ); $mime = $this->detectMimeType( $file, $ext ); } @@ -570,7 +570,7 @@ class MimeMagic { $mime = $this->mMimeTypeAliases[$mime]; } - wfDebug(__METHOD__.": guessed mime type of $file: $mime\n"); + wfDebug( __METHOD__ . ": guessed mime type of $file: $mime\n" ); return $mime; } @@ -629,7 +629,7 @@ class MimeMagic { $doctype = strpos( $head, "\x42\x82" ); if ( $doctype ) { // Next byte is datasize, then data (sizes larger than 1 byte are very stupid muxers) - $data = substr($head, $doctype+3, 8); + $data = substr( $head, $doctype+3, 8 ); if ( strncmp( $data, "matroska", 8 ) == 0 ) { wfDebug( __METHOD__ . ": recognized file as video/x-matroska\n" ); return "video/x-matroska"; @@ -661,12 +661,11 @@ class MimeMagic { * strings like "detectZipType( $head, $tail, $ext ); } @@ -737,14 +736,14 @@ class MimeMagic { if( $gis && isset( $gis['mime'] ) ) { $mime = $gis['mime']; - wfDebug( __METHOD__.": getimagesize detected $file as $mime\n" ); + wfDebug( __METHOD__ . ": getimagesize detected $file as $mime\n" ); return $mime; } // Also test DjVu $deja = new DjVuImage( $file ); if( $deja->isValid() ) { - wfDebug( __METHOD__.": detected $file as image/vnd.djvu\n" ); + wfDebug( __METHOD__ . ": detected $file as image/vnd.djvu\n" ); return 'image/vnd.djvu'; } @@ -766,7 +765,7 @@ class MimeMagic { */ function detectZipType( $header, $tail = null, $ext = false ) { if( $ext ) { # TODO: remove $ext param - wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. " . + wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. " . "Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); } @@ -797,7 +796,7 @@ class MimeMagic { if ( preg_match( $opendocRegex, substr( $header, 30 ), $matches ) ) { $mime = $matches[1]; - wfDebug( __METHOD__.": detected $mime from ZIP archive\n" ); + wfDebug( __METHOD__ . ": detected $mime from ZIP archive\n" ); } elseif ( preg_match( $openxmlRegex, substr( $header, 30 ) ) ) { $mime = "application/x-opc+zip"; # TODO: remove the block below, as soon as improveTypeFromExtension is used everywhere @@ -814,7 +813,7 @@ class MimeMagic { $mime = "application/zip"; } } - wfDebug( __METHOD__.": detected an Open Packaging Conventions archive: $mime\n" ); + wfDebug( __METHOD__ . ": detected an Open Packaging Conventions archive: $mime\n" ); } elseif ( substr( $header, 0, 8 ) == "\xd0\xcf\x11\xe0\xa1\xb1\x1a\xe1" && ($headerpos = strpos( $tail, "PK\x03\x04" ) ) !== false && preg_match( $openxmlRegex, substr( $tail, $headerpos + 30 ) ) ) { @@ -843,9 +842,9 @@ class MimeMagic { break; } - wfDebug( __METHOD__.": detected a MS Office document with OPC trailer\n"); + wfDebug( __METHOD__ . ": detected a MS Office document with OPC trailer\n" ); } else { - wfDebug( __METHOD__.": unable to identify type of ZIP archive\n" ); + wfDebug( __METHOD__ . ": unable to identify type of ZIP archive\n" ); } return $mime; } @@ -872,7 +871,7 @@ class MimeMagic { global $wgMimeDetectorCommand; if ( $ext ) { # TODO: make $ext default to false. Or better, remove it. - wfDebug( __METHOD__.": WARNING: use of the \$ext parameter is deprecated. Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); + wfDebug( __METHOD__ . ": WARNING: use of the \$ext parameter is deprecated. Use improveTypeFromExtension(\$mime, \$ext) instead.\n" ); } $m = null; @@ -898,7 +897,7 @@ class MimeMagic { $m = finfo_file( $mime_magic_resource, $file ); finfo_close( $mime_magic_resource ); } else { - wfDebug( __METHOD__.": finfo_open failed on ".FILEINFO_MIME."!\n" ); + wfDebug( __METHOD__ . ": finfo_open failed on ".FILEINFO_MIME."!\n" ); } } elseif ( function_exists( "mime_content_type" ) ) { @@ -911,9 +910,9 @@ class MimeMagic { # Also note that this has been DEPRECATED in favor of the fileinfo extension by PECL, see above. # see http://www.php.net/manual/en/ref.mime-magic.php for details. - $m = mime_content_type($file); + $m = mime_content_type( $file ); } else { - wfDebug( __METHOD__.": no magic mime detector found!\n" ); + wfDebug( __METHOD__ . ": no magic mime detector found!\n" ); } if ( $m ) { @@ -925,7 +924,7 @@ class MimeMagic { if ( strpos( $m, 'unknown' ) !== false ) { $m = null; } else { - wfDebug( __METHOD__.": magic mime type of $file: $m\n" ); + wfDebug( __METHOD__ . ": magic mime type of $file: $m\n" ); return $m; } } @@ -937,11 +936,11 @@ class MimeMagic { } if ( $ext ) { if( $this->isRecognizableExtension( $ext ) ) { - wfDebug( __METHOD__. ": refusing to guess mime type for .$ext file, we should have recognized it\n" ); + wfDebug( __METHOD__ . ": refusing to guess mime type for .$ext file, we should have recognized it\n" ); } else { $m = $this->guessTypesForExtension( $ext ); if ( $m ) { - wfDebug( __METHOD__.": extension mime type of $file: $m\n" ); + wfDebug( __METHOD__ . ": extension mime type of $file: $m\n" ); return $m; } } @@ -1066,7 +1065,7 @@ class MimeMagic { foreach ( $m as $mime ) { foreach ( $this->mMediaTypes as $type => $codes ) { - if ( in_array($mime, $codes, true ) ) { + if ( in_array( $mime, $codes, true ) ) { return $type; } } diff --git a/includes/Namespace.php b/includes/Namespace.php index 46af0029a2..e35bf073fa 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -67,7 +67,7 @@ class MWNamespace { public static function isMovable( $index ) { global $wgAllowImageMoving; - $result = !( $index < NS_MAIN || ( $index == NS_FILE && !$wgAllowImageMoving ) || $index == NS_CATEGORY ); + $result = !( $index < NS_MAIN || ( $index == NS_FILE && !$wgAllowImageMoving ) || $index == NS_CATEGORY ); /** * @since 1.20 @@ -290,9 +290,9 @@ class MWNamespace { * @param $index Int: namespace index * @return bool */ - public static function canTalk( $index ) { + public static function canTalk( $index ) { return $index >= NS_MAIN; - } + } /** * Does this namespace contain content, for the purposes of calculating diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 968acf6d41..89d7c0bc3b 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1275,7 +1275,7 @@ class OutputPage extends ContextSource { * @param $level Int ResourceLoaderModule class constant */ public function reduceAllowedModules( $type, $level ) { - $this->mAllowedModules[$type] = min( $this->getAllowedModules($type), $level ); + $this->mAllowedModules[$type] = min( $this->getAllowedModules( $type ), $level ); } /** @@ -1873,7 +1873,7 @@ class OutputPage extends ContextSource { wfDebug( __METHOD__ . ": proxy caching with ESI; {$this->mLastModified} **\n", false ); # start with a shorter timeout for initial testing # header( 'Surrogate-Control: max-age=2678400+2678400, content="ESI/1.0"'); - $response->header( 'Surrogate-Control: max-age='.$wgSquidMaxage.'+'.$this->mSquidMaxage.', content="ESI/1.0"'); + $response->header( 'Surrogate-Control: max-age=' . $wgSquidMaxage . '+' . $this->mSquidMaxage . ', content="ESI/1.0"'); $response->header( 'Cache-Control: s-maxage=0, must-revalidate, max-age=0' ); } else { # We'll purge the proxy cache for anons explicitly, but require end user agents @@ -1883,7 +1883,7 @@ class OutputPage extends ContextSource { wfDebug( __METHOD__ . ": local proxy caching; {$this->mLastModified} **\n", false ); # start with a shorter timeout for initial testing # header( "Cache-Control: s-maxage=2678400, must-revalidate, max-age=0" ); - $response->header( 'Cache-Control: s-maxage='.$this->mSquidMaxage.', must-revalidate, max-age=0' ); + $response->header( 'Cache-Control: s-maxage=' . $this->mSquidMaxage . ', must-revalidate, max-age=0' ); } } else { # We do want clients to cache if they can, but they *must* check for updates @@ -1892,7 +1892,7 @@ class OutputPage extends ContextSource { $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' ); $response->header( "Cache-Control: private, must-revalidate, max-age=0" ); } - if($this->mLastModified) { + if( $this->mLastModified ) { $response->header( "Last-Modified: {$this->mLastModified}" ); } } else { @@ -2272,7 +2272,7 @@ class OutputPage extends ContextSource { $pageLang = $this->getTitle()->getPageLanguage(); $params = array( - 'id' => 'wpTextbox1', + 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $this->getUser()->getOption( 'cols' ), 'rows' => $this->getUser()->getOption( 'rows' ), @@ -3066,7 +3066,7 @@ $templates 'http-equiv' => 'Content-Type', 'content' => "$wgMimeType; charset=UTF-8" ) ); - $tags['meta-content-style-type'] = Html::element( 'meta', array( // bug 15835 + $tags['meta-content-style-type'] = Html::element( 'meta', array( // bug 15835 'http-equiv' => 'Content-Style-Type', 'content' => 'text/css' ) ); @@ -3095,7 +3095,7 @@ $templates ); $tags['meta-keywords'] = Html::element( 'meta', array( 'name' => 'keywords', - 'content' => preg_replace( + 'content' => preg_replace( array_keys( $strip ), array_values( $strip ), implode( ',', $this->mKeywords ) @@ -3629,7 +3629,7 @@ $templates '1.20' ); } - } else { + } else { $args = array(); $name = $spec; } diff --git a/includes/Pager.php b/includes/Pager.php index 856b1b82e9..9e937e4f81 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -866,7 +866,7 @@ abstract class ReverseChronologicalPager extends IndexPager { if ( $this->mMonth ) { $month = $this->mMonth + 1; // For December, we want January 1 of the next year - if ($month > 12) { + if ( $month > 12 ) { $month = 1; $year++; } diff --git a/includes/PathRouter.php b/includes/PathRouter.php index 2dbc7ec0d8..3be504a785 100644 --- a/includes/PathRouter.php +++ b/includes/PathRouter.php @@ -293,7 +293,7 @@ class PathRouter { foreach ( $m as $matchKey => $matchValue ) { if ( preg_match( '/^par\d+$/u', $matchKey ) ) { $n = intval( substr( $matchKey, 3 ) ); - $data['$'.$n] = rawurldecode( $matchValue ); + $data['$' . $n] = rawurldecode( $matchValue ); } } // If present give our $data array a $key as well diff --git a/includes/Preferences.php b/includes/Preferences.php index c15c5b5aaf..1e4f85f807 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -891,7 +891,7 @@ class Preferences { 'max' => $watchlistdaysMax, 'section' => 'watchlist/displaywatchlist', 'help' => $context->msg( 'prefs-watchlist-days-max' )->numParams( - $watchlistdaysMax )->text(), + $watchlistdaysMax )->text(), 'label-message' => 'prefs-watchlist-days', ); $defaultPreferences['wllimit'] = array( diff --git a/includes/PrefixSearch.php b/includes/PrefixSearch.php index 5d4b35c14c..7df6a50374 100644 --- a/includes/PrefixSearch.php +++ b/includes/PrefixSearch.php @@ -45,7 +45,7 @@ class PrefixSearch { // Find a Title which is not an interwiki and is in NS_MAIN $title = Title::newFromText( $search ); if( $title && $title->getInterwiki() == '' ) { - $ns = array($title->getNamespace()); + $ns = array( $title->getNamespace() ); if( $ns[0] == NS_MAIN ) { $ns = $namespaces; // no explicit prefix, use default namespaces } diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index fe871b9bd8..17e43728d5 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -139,7 +139,7 @@ class ProtectionForm { if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) ) continue; } else { - if( !$wgUser->isAllowed($val) ) + if( !$wgUser->isAllowed( $val ) ) continue; } $this->mRestrictions[$action] = $val; @@ -228,14 +228,14 @@ class ProtectionForm { } list( $cascadeSources, /* $restrictions */ ) = $this->mTitle->getCascadeProtectionSources(); - if ( $cascadeSources && count($cascadeSources) > 0 ) { + if ( $cascadeSources && count( $cascadeSources ) > 0 ) { $titles = ''; foreach ( $cascadeSources as $title ) { $titles .= '* [[:' . $title->getPrefixedText() . "]]\n"; } - $wgOut->wrapWikiMsg( "
    \n$1\n" . $titles . "
    ", array( 'protect-cascadeon', count($cascadeSources) ) ); + $wgOut->wrapWikiMsg( "
    \n$1\n" . $titles . "
    ", array( 'protect-cascadeon', count( $cascadeSources ) ) ); } # Show an appropriate message if the user isn't allowed or able to change @@ -284,7 +284,7 @@ class ProtectionForm { $expiry = array(); 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' ) ); @@ -300,7 +300,7 @@ 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') && + if ( $this->mCascade && ($edit_restriction != 'protect') && !User::groupHasPermission( $edit_restriction, 'protect' ) ) $this->mCascade = false; @@ -412,14 +412,14 @@ class ProtectionForm { wfMessage( 'protect-othertime-op' )->text(), "othertime" ) . "\n"; - foreach( explode(',', $scExpiryOptions) as $option ) { - if ( strpos($option, ":") === false ) { + foreach( explode( ',', $scExpiryOptions ) as $option ) { + if ( strpos( $option, ":" ) === false ) { $show = $value = $option; } else { - list($show, $value) = explode(":", $option); + list( $show, $value ) = explode( ":", $option ); } - $show = htmlspecialchars($show); - $value = htmlspecialchars($value); + $show = htmlspecialchars( $show ); + $value = htmlspecialchars( $value ); $expiryFormOptions .= Xml::option( $show, $value, $this->mExpirySelection[$action] === $value ) . "\n"; } # Add expiry dropdown @@ -458,7 +458,7 @@ class ProtectionForm { ""; } # Give extensions a chance to add items to the form - wfRunHooks( 'ProtectionForm::buildForm', array($this->mArticle,&$out) ); + wfRunHooks( 'ProtectionForm::buildForm', array( $this->mArticle, &$out ) ); $out .= Xml::closeElement( 'tbody' ) . Xml::closeElement( 'table' ); @@ -569,7 +569,7 @@ class ProtectionForm { if( !$wgUser->isAllowedAny( 'protect', 'editprotected' ) && !$this->disabled ) continue; } else { - if( !$wgUser->isAllowed($key) && !$this->disabled ) + if( !$wgUser->isAllowed( $key ) && !$this->disabled ) continue; } $levels[] = $key; @@ -644,6 +644,6 @@ class ProtectionForm { $out->addHTML( Xml::element( 'h2', null, $protectLogPage->getName()->text() ) ); LogEventsList::showLogExtract( $out, 'protect', $this->mTitle ); # Let extensions add other relevant log extracts - wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) ); + wfRunHooks( 'ProtectionForm::showLogExtract', array( $this->mArticle, $out ) ); } } diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 349789fecb..1a147b1508 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -109,7 +109,7 @@ function wfProxyCheck() { if ( !$skip ) { $title = SpecialPage::getTitleFor( 'Blockme' ); $iphash = md5( $ip . $wgProxyKey ); - $url = wfExpandUrl( $title->getFullURL( 'ip='.$iphash ), PROTO_HTTP ); + $url = wfExpandUrl( $title->getFullURL( 'ip=' . $iphash ), PROTO_HTTP ); foreach ( $wgProxyPorts as $port ) { $params = implode( ' ', array( diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 56df21e2f5..047042697c 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -800,7 +800,7 @@ class RecentChange { # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003, # no colour (\003) switches back to the term default $fullString = "$titleString\0034 $flag\00310 " . - "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n"; + "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n"; return $fullString; } diff --git a/includes/Revision.php b/includes/Revision.php index 5f62e4d56f..4bdce87eab 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -254,9 +254,11 @@ class Revision implements IDBAccessObject { $matchId = 'page_latest'; } return self::loadFromConds( $db, - array( "rev_id=$matchId", - 'page_namespace' => $title->getNamespace(), - 'page_title' => $title->getDBkey() ) + array( + "rev_id=$matchId", + 'page_namespace' => $title->getNamespace(), + 'page_title' => $title->getDBkey() + ) ); } @@ -272,9 +274,11 @@ class Revision implements IDBAccessObject { */ public static function loadFromTimestamp( $db, $title, $timestamp ) { return self::loadFromConds( $db, - array( 'rev_timestamp' => $db->timestamp( $timestamp ), - 'page_namespace' => $title->getNamespace(), - 'page_title' => $title->getDBkey() ) + array( + 'rev_timestamp' => $db->timestamp( $timestamp ), + 'page_namespace' => $title->getNamespace(), + 'page_title' => $title->getDBkey() + ) ); } @@ -330,9 +334,11 @@ class Revision implements IDBAccessObject { public static function fetchRevision( $title ) { return self::fetchFromConds( wfGetDB( DB_SLAVE ), - array( 'rev_id=page_latest', - 'page_namespace' => $title->getNamespace(), - 'page_title' => $title->getDBkey() ) + array( + 'rev_id=page_latest', + 'page_namespace' => $title->getNamespace(), + 'page_title' => $title->getDBkey() + ) ); } @@ -496,7 +502,7 @@ class Revision implements IDBAccessObject { if ( !isset( $row->rev_parent_id ) ) { $this->mParentId = null; } else { - $this->mParentId = intval( $row->rev_parent_id ); + $this->mParentId = intval( $row->rev_parent_id ); } if ( !isset( $row->rev_len ) ) { @@ -532,7 +538,7 @@ class Revision implements IDBAccessObject { } // Lazy extraction... - $this->mText = null; + $this->mText = null; if( isset( $row->old_text ) ) { $this->mTextRow = $row; } else { @@ -557,8 +563,8 @@ class Revision implements IDBAccessObject { if ( !empty( $row['content'] ) ) { //@todo: when is that set? test with external store setup! check out insertOn() [dk] if ( !empty( $row['text_id'] ) ) { - throw new MWException( "Text already stored in external store (id {$row['text_id']}), " - . "can't serialize content object" ); + throw new MWException( "Text already stored in external store (id {$row['text_id']}), " . + "can't serialize content object" ); } $row['content_model'] = $row['content']->getModel(); @@ -615,12 +621,12 @@ class Revision implements IDBAccessObject { } elseif ( $this->mTitle->getArticleID() !== $this->mPage ) { // Got different page IDs. This may be legit (e.g. during undeletion), // but it seems worth mentioning it in the log. - wfDebug( "Page ID " . $this->mPage . " mismatches the ID " - . $this->mTitle->getArticleID() . " provided by the Title object." ); + wfDebug( "Page ID " . $this->mPage . " mismatches the ID " . + $this->mTitle->getArticleID() . " provided by the Title object." ); } } - $this->mCurrent = false; + $this->mCurrent = false; // If we still have no length, see it we have the text to figure it out if ( !$this->mSize ) { @@ -718,7 +724,7 @@ class Revision implements IDBAccessObject { array( 'page', 'revision' ), self::selectPageFields(), array( 'page_id=rev_page', - 'rev_id' => $this->mId ), + 'rev_id' => $this->mId ), __METHOD__ ); if ( $row ) { $this->mTitle = Title::newFromRow( $row ); diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 9cac30845b..cf6c10610f 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -381,7 +381,7 @@ class Sanitizer { 'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's', 'strike', 'strong', 'tt', 'var', 'div', 'center', 'blockquote', 'ol', 'ul', 'dl', 'table', 'caption', 'pre', - 'ruby', 'rt' , 'rb' , 'rp', 'p', 'span', 'abbr', 'dfn', + 'ruby', 'rt', 'rb', 'rp', 'p', 'span', 'abbr', 'dfn', 'kbd', 'samp' ); if ( $wgHtml5 ) { @@ -604,9 +604,9 @@ class Sanitizer { */ static function removeHTMLcomments( $text ) { wfProfileIn( __METHOD__ ); - while (($start = strpos($text, '', $start + 4); - if ($end === false) { + while ( ($start = strpos( $text, '', $start + 4 ); + if ( $end === false ) { # Unterminated comment; bail out break; } @@ -615,22 +615,22 @@ class Sanitizer { # Trim space and newline if the comment is both # preceded and followed by a newline - $spaceStart = max($start - 1, 0); + $spaceStart = max( $start - 1, 0 ); $spaceLen = $end - $spaceStart; - while (substr($text, $spaceStart, 1) === ' ' && $spaceStart > 0) { + while ( substr( $text, $spaceStart, 1 ) === ' ' && $spaceStart > 0 ) { $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") { + 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. - $text = substr_replace($text, "\n", $spaceStart, $spaceLen + 1); + $text = substr_replace( $text, "\n", $spaceStart, $spaceLen + 1 ); } else { # Remove just the comment. - $text = substr_replace($text, '', $start, $end - $start); + $text = substr_replace( $text, '', $start, $end - $start ); } } wfProfileOut( __METHOD__ ); diff --git a/includes/Setup.php b/includes/Setup.php index 53739fb2bd..273d75bca9 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -56,13 +56,13 @@ if ( $wgArticlePath === false ) { } } -if ( !empty($wgActionPaths) && !isset($wgActionPaths['view']) ) { +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 ( !empty($wgActionPaths) && !isset($wgActionPaths['view']) ) { +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 ; @@ -353,9 +353,9 @@ if ( $wgAjaxUploadDestCheck ) { if ( $wgNewUserLog ) { # Add a new log type - $wgLogTypes[] = 'newusers'; - $wgLogNames['newusers'] = 'newuserlogpage'; - $wgLogHeaders['newusers'] = 'newuserlogpagetext'; + $wgLogTypes[] = 'newusers'; + $wgLogNames['newusers'] = 'newuserlogpage'; + $wgLogHeaders['newusers'] = 'newuserlogpagetext'; $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter'; $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter'; $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter'; diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 4bbe9e1185..7e96d45e42 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -83,7 +83,7 @@ * $conf->settings = array( * 'wgMergeSetting' = array( * # Value that will be shared among all wikis: - * 'default' => array( NS_USER => true ), + * 'default' => array( NS_USER => true ), * * # Leading '+' means merging the array of value with the defaults * '+beta' => array( NS_HELP => true ), @@ -205,7 +205,7 @@ class SiteConfiguration { $retval = $thisSetting[$tag]; } break 2; - } elseif( array_key_exists( "+$tag", $thisSetting ) && is_array($thisSetting["+$tag"]) ) { + } elseif( array_key_exists( "+$tag", $thisSetting ) && is_array( $thisSetting["+$tag"] ) ) { if( !isset( $retval ) ) { $retval = array(); } @@ -216,7 +216,7 @@ class SiteConfiguration { $suffix = $params['suffix']; if( !is_null( $suffix ) ) { if( array_key_exists( $suffix, $thisSetting ) ) { - if ( isset($retval) && is_array($retval) && is_array($thisSetting[$suffix]) ) { + if ( isset( $retval ) && is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) { $retval = self::arrayMerge( $retval, $thisSetting[$suffix] ); } else { $retval = $thisSetting[$suffix]; @@ -509,9 +509,9 @@ class SiteConfiguration { $out = $array1; 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) ) { + 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) ) { + } elseif ( !isset( $out[$key] ) || !$out[$key] && !is_numeric( $key ) ) { // Values that evaluate to true given precedence, for the primary purpose of merging permissions arrays. $out[$key] = $value; } elseif ( is_numeric( $key ) ) { diff --git a/includes/Skin.php b/includes/Skin.php index 4889863710..723ede4d04 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -262,7 +262,7 @@ abstract class Skin extends ContextSource { * @return Title */ public function getRelevantTitle() { - if ( isset($this->mRelevantTitle) ) { + if ( isset( $this->mRelevantTitle ) ) { return $this->mRelevantTitle; } return $this->getTitle(); @@ -286,7 +286,7 @@ abstract class Skin extends ContextSource { * @return User */ public function getRelevantUser() { - if ( isset($this->mRelevantUser) ) { + if ( isset( $this->mRelevantUser ) ) { return $this->mRelevantUser; } $title = $this->getRelevantTitle(); @@ -435,7 +435,7 @@ abstract class Skin extends ContextSource { $colon = $this->msg( 'colon-separator' )->escaped(); if ( !empty( $allCats['normal'] ) ) { - $t = $embed . implode( "{$pop}{$embed}" , $allCats['normal'] ) . $pop; + $t = $embed . implode( "{$pop}{$embed}", $allCats['normal'] ) . $pop; $msg = $this->msg( 'pagecategories' )->numParams( count( $allCats['normal'] ) )->escaped(); $linkPage = wfMessage( 'pagecategorieslink' )->inContentLanguage()->text(); @@ -456,7 +456,7 @@ abstract class Skin extends ContextSource { $s .= "
    " . $this->msg( 'hidden-categories' )->numParams( count( $allCats['hidden'] ) )->escaped() . - $colon . '
      ' . $embed . implode( "{$pop}{$embed}" , $allCats['hidden'] ) . $pop . '
    ' . + $colon . '
      ' . $embed . implode( "{$pop}{$embed}", $allCats['hidden'] ) . $pop . '
    ' . '
    '; } @@ -499,7 +499,7 @@ abstract class Skin extends ContextSource { # add our current element to the list $eltitle = Title::newFromText( $element ); - $return .= Linker::link( $eltitle, htmlspecialchars( $eltitle->getText() ) ); + $return .= Linker::link( $eltitle, htmlspecialchars( $eltitle->getText() ) ); } return $return; @@ -860,7 +860,7 @@ abstract class Skin extends ContextSource { if ( is_string( $icon ) ) { $html = $icon; } else { // Assuming array - $url = isset($icon["url"]) ? $icon["url"] : null; + $url = isset( $icon["url"] ) ? $icon["url"] : null; unset( $icon["url"] ); if ( isset( $icon["src"] ) && $withImage === 'withImage' ) { $html = Html::element( 'img', $icon ); // do this the lazy way, just pass icon data as an attribute array diff --git a/includes/SkinLegacy.php b/includes/SkinLegacy.php index 8642eca6f4..c1c7219d51 100644 --- a/includes/SkinLegacy.php +++ b/includes/SkinLegacy.php @@ -120,7 +120,7 @@ class LegacyTemplate extends BaseTemplate { } $s .= "\n
    \n
    \n" . - "\n\n"; + "
    \n\n"; if ( $this->getSkin()->qbSetting() == 0 ) { $s .= "
    \n" . @@ -179,10 +179,10 @@ class LegacyTemplate extends BaseTemplate { $search = $wgRequest->getText( 'search' ); $s = '
    \n" - . '\n" - . ''; + . $this->getSkin()->escapeSearchLink() . "\">\n" + . '\n" + . ''; if ( $wgUseTwoButtonsSearchForm ) { $s .= ' \n"; @@ -263,7 +263,7 @@ class LegacyTemplate extends BaseTemplate { } $s = $wgLang->pipeList( array( $s, - '' . htmlspecialchars( $varname ) . '' + '' . htmlspecialchars( $varname ) . '' ) ); } } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index a673a652c9..86972ee9e2 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -219,7 +219,7 @@ class SkinTemplate extends Skin { if ( $subpagestr !== '' ) { $subpagestr = '' . $subpagestr . ''; } - $tpl->set( 'subtitle', $subpagestr . $out->getSubtitle() ); + $tpl->set( 'subtitle', $subpagestr . $out->getSubtitle() ); $undelete = $this->getUndeleteLink(); if ( $undelete === '' ) { @@ -403,7 +403,7 @@ class SkinTemplate extends Skin { $pageLang = $title->getPageViewLanguage(); $realBodyAttribs['lang'] = $pageLang->getHtmlCode(); $realBodyAttribs['dir'] = $pageLang->getDir(); - $realBodyAttribs['class'] = 'mw-content-'.$pageLang->getDir(); + $realBodyAttribs['class'] = 'mw-content-' . $pageLang->getDir(); } $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext ); @@ -1051,7 +1051,7 @@ class SkinTemplate extends Skin { } // Equiv to SkinTemplateContentActions - wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); + wfRunHooks( 'SkinTemplateNavigation::Universal', array( &$this, &$content_navigation ) ); // Setup xml ids and tooltip info foreach ( $content_navigation as $section => &$links ) { diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 338b50de4b..3b3a5ee1cd 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -1278,7 +1278,7 @@ class SpecialMytalk extends RedirectSpecialArticle { */ class SpecialMycontributions extends RedirectSpecialPage { function __construct() { - parent::__construct( 'Mycontributions' ); + parent::__construct( 'Mycontributions' ); $this->mAllowedRedirectParams = array( 'limit', 'namespace', 'tagfilter', 'offset', 'dir', 'year', 'month', 'feed' ); } diff --git a/includes/SpecialPageFactory.php b/includes/SpecialPageFactory.php index fd5d52ce89..add7efcb5a 100644 --- a/includes/SpecialPageFactory.php +++ b/includes/SpecialPageFactory.php @@ -95,7 +95,7 @@ class SpecialPageFactory { 'Preferences' => 'SpecialPreferences', 'Contributions' => 'SpecialContributions', 'Listgrouprights' => 'SpecialListGroupRights', - 'Listusers' => 'SpecialListUsers' , + 'Listusers' => 'SpecialListUsers', 'Listadmins' => 'SpecialListAdmins', 'Listbots' => 'SpecialListBots', 'Activeusers' => 'SpecialActiveUsers', diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index 098fb0b641..f5fd195085 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -318,7 +318,7 @@ class SquidPurgeClient { return 'done'; } default: - throw new MWException( __METHOD__.': unexpected state' ); + throw new MWException( __METHOD__ . ': unexpected state' ); } } @@ -373,7 +373,7 @@ class SquidPurgeClient { * @param $msg string */ protected function log( $msg ) { - wfDebugLog( 'squid', __CLASS__." ($this->host): $msg\n" ); + wfDebugLog( 'squid', __CLASS__ . " ($this->host): $msg\n" ); } } @@ -429,14 +429,14 @@ class SquidPurgeClientPool { $numReady = socket_select( $readSockets, $writeSockets, $exceptSockets, $timeout ); wfRestoreWarnings(); if ( $numReady === false ) { - wfDebugLog( 'squid', __METHOD__.': Error in stream_select: ' . + wfDebugLog( 'squid', __METHOD__ . ': Error in stream_select: ' . socket_strerror( socket_last_error() ) . "\n" ); break; } // Check for timeout, use 1% tolerance since we aimed at having socket_select() // exit at precisely the overall timeout if ( microtime( true ) - $startTime > $this->timeout * 0.99 ) { - wfDebugLog( 'squid', __CLASS__.": timeout ({$this->timeout}s)\n" ); + wfDebugLog( 'squid', __CLASS__ . ": timeout ({$this->timeout}s)\n" ); break; } elseif ( !$numReady ) { continue; diff --git a/includes/Status.php b/includes/Status.php index 2553f54074..4298aee984 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -176,10 +176,10 @@ class Status { if ( count( $this->errors ) == 0 ) { if ( $this->ok ) { $this->fatal( 'internalerror_info', - __METHOD__." called for a good result, this is incorrect\n" ); + __METHOD__ . " called for a good result, this is incorrect\n" ); } else { $this->fatal( 'internalerror_info', - __METHOD__.": Invalid result object: no error text but not OK\n" ); + __METHOD__ . ": Invalid result object: no error text but not OK\n" ); } } if ( count( $this->errors ) == 1 ) { @@ -190,7 +190,7 @@ class Status { $s = wfMessage( $longContext, "* $s\n" )->plain(); } } else { - $s = '* '. implode("\n* ", + $s = '* '. implode( "\n* ", $this->getErrorMessageArray( $this->errors ) ) . "\n"; if ( $longContext ) { $s = wfMessage( $longContext, $s )->plain(); @@ -216,7 +216,7 @@ class Status { $msg = $error['message']; } elseif ( isset( $error['message'] ) && isset( $error['params'] ) ) { $msg = wfMessage( $error['message'], - array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) ); + array_map( 'wfEscapeWikiText', $this->cleanParams( $error['params'] ) ) ); } else { $msgName = array_shift( $error ); $msg = wfMessage( $msgName, diff --git a/includes/StringUtils.php b/includes/StringUtils.php index 54a85dc0ba..6647de41b1 100644 --- a/includes/StringUtils.php +++ b/includes/StringUtils.php @@ -135,12 +135,12 @@ class StringUtils { $m = array(); while ( $inputPos < strlen( $subject ) && - preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) ) + preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) ) { $tokenOffset = $m[0][1]; if ( $m[1][0] != '' ) { if ( $foundStart && - $strcmp( $endDelim, substr( $subject, $tokenOffset, $endLength ) ) == 0 ) + $strcmp( $endDelim, substr( $subject, $tokenOffset, $endLength ) ) == 0 ) { # An end match is present at the same location $tokenType = 'end'; @@ -432,7 +432,7 @@ class ReplacementArray { * @param $from string */ function removePair( $from ) { - unset($this->data[$from]); + unset( $this->data[$from] ); $this->fss = false; } diff --git a/includes/StubObject.php b/includes/StubObject.php index cc0adb743d..8a1e758190 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -118,7 +118,7 @@ class StubObject { } if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) { - $fname = __METHOD__.'-'.$this->mGlobal; + $fname = __METHOD__ . '-' . $this->mGlobal; wfProfileIn( $fname ); $caller = wfGetCaller( $level ); if ( ++$recursionLevel > 2 ) { diff --git a/includes/Title.php b/includes/Title.php index 42715552f3..6aa4cd2521 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -1849,7 +1849,7 @@ class Title { $ns = $this->mNamespace == NS_MAIN ? wfMessage( 'nstab-main' )->text() : $this->getNsText(); $errors[] = $this->mNamespace == NS_MEDIAWIKI ? - array( 'protectedinterface' ) : array( 'namespaceprotected', $ns ); + array( 'protectedinterface' ) : array( 'namespaceprotected', $ns ); } return $errors; diff --git a/includes/User.php b/includes/User.php index 3e49cd02db..309d755b61 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1451,7 +1451,7 @@ class User { // But this is a crappy hack and should die. return false; } - return !$this->isAllowed('noratelimit'); + return !$this->isAllowed( 'noratelimit' ); } /** @@ -2284,7 +2284,7 @@ class User { * @return Int User's current value for the option * @see getOption() */ - public function getIntOption( $oname, $defaultOverride=0 ) { + public function getIntOption( $oname, $defaultOverride = 0 ) { $val = $this->getOption( $oname ); if( $val == '' ) { $val = $defaultOverride; @@ -2620,7 +2620,7 @@ class User { if( $this->getId() ) { $dbw->insert( 'user_groups', array( - 'ug_user' => $this->getID(), + 'ug_user' => $this->getID(), 'ug_group' => $group, ), __METHOD__, @@ -2645,13 +2645,13 @@ class User { $dbw = wfGetDB( DB_MASTER ); $dbw->delete( 'user_groups', array( - 'ug_user' => $this->getID(), + 'ug_user' => $this->getID(), 'ug_group' => $group, ), __METHOD__ ); // Remember that the user was in this group $dbw->insert( 'user_former_groups', array( - 'ufg_user' => $this->getID(), + 'ufg_user' => $this->getID(), 'ufg_group' => $group, ), __METHOD__, @@ -4058,7 +4058,7 @@ class User { $groups = array_merge_recursive( $groups, $this->changeableByGroup( $addergroup ) ); - $groups['add'] = array_unique( $groups['add'] ); + $groups['add'] = array_unique( $groups['add'] ); $groups['remove'] = array_unique( $groups['remove'] ); $groups['add-self'] = array_unique( $groups['add-self'] ); $groups['remove-self'] = array_unique( $groups['remove-self'] ); diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 324e7ced9b..7d11342ce1 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -136,10 +136,10 @@ class UserMailer { global $wgSMTP, $wgServer; $msgid = uniqid( wfWikiID() . ".", true ); /* true required for cygwin */ - if ( is_array($wgSMTP) && isset($wgSMTP['IDHost']) && $wgSMTP['IDHost'] ) { + if ( is_array( $wgSMTP ) && isset( $wgSMTP['IDHost'] ) && $wgSMTP['IDHost'] ) { $domain = $wgSMTP['IDHost']; } else { - $url = wfParseUrl($wgServer); + $url = wfParseUrl( $wgServer ); $domain = $url['host']; } return "<$msgid@$domain>"; @@ -340,7 +340,7 @@ class UserMailer { # # PHP mail() # - if( count($to) > 1 ) { + if( count( $to ) > 1 ) { $headers['To'] = 'undisclosed-recipients:;'; } $headers = self::arrayToHeaderString( $headers, $endl ); @@ -517,9 +517,9 @@ class EmailNotification { array( /* SET */ 'wl_notificationtimestamp' => $dbw->timestamp( $timestamp ) ), array( /* WHERE */ - 'wl_user' => $watchers, + 'wl_user' => $watchers, 'wl_namespace' => $title->getNamespace(), - 'wl_title' => $title->getDBkey(), + 'wl_title' => $title->getDBkey(), ), $fname ); $dbw->commit( $fname ); @@ -710,16 +710,16 @@ class EmailNotification { if ( !$wgEnotifImpersonal ) { // For personal mail, also show a link to the diff of all changes // since last visited. - $keys['$NEWPAGE'] .= "\n\n" . wfMessage( 'enotif_lastvisited', + $keys['$NEWPAGE'] .= "\n\n" . wfMessage( 'enotif_lastvisited', $this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid ) ) ->inContentLanguage()->text(); } - $keys['$OLDID'] = $this->oldid; + $keys['$OLDID'] = $this->oldid; // @deprecated Remove in MediaWiki 1.23. $keys['$CHANGEDORCREATED'] = wfMessage( 'changed' )->inContentLanguage()->text(); } else { # clear $OLDID placeholder in the message template - $keys['$OLDID'] = ''; + $keys['$OLDID'] = ''; $keys['$NEWPAGE'] = ''; // @deprecated Remove in MediaWiki 1.23. $keys['$CHANGEDORCREATED'] = wfMessage( 'created' )->inContentLanguage()->text(); @@ -771,13 +771,13 @@ class EmailNotification { { $editorAddress = new MailAddress( $this->editor ); if ( $wgEnotifFromEditor ) { - $this->from = $editorAddress; + $this->from = $editorAddress; } else { - $this->from = $adminAddress; + $this->from = $adminAddress; $this->replyto = $editorAddress; } } else { - $this->from = $adminAddress; + $this->from = $adminAddress; $this->replyto = new MailAddress( $wgNoReplyAddress ); } } diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index ffdc285481..240ebc7d08 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -162,22 +162,22 @@ class WatchedItem { // if there's already an entry for this page $dbw = wfGetDB( DB_MASTER ); $dbw->insert( 'watchlist', - array( - 'wl_user' => $this->getUserId(), - 'wl_namespace' => MWNamespace::getSubject($this->getTitleNs()), - 'wl_title' => $this->getTitleDBkey(), - 'wl_notificationtimestamp' => null - ), __METHOD__, 'IGNORE' ); + array( + 'wl_user' => $this->getUserId(), + 'wl_namespace' => MWNamespace::getSubject( $this->getTitleNs() ), + 'wl_title' => $this->getTitleDBkey(), + 'wl_notificationtimestamp' => null + ), __METHOD__, 'IGNORE' ); // Every single watched page needs now to be listed in watchlist; // namespace:page and namespace_talk:page need separate entries: $dbw->insert( 'watchlist', - array( - 'wl_user' => $this->getUserId(), - 'wl_namespace' => MWNamespace::getTalk($this->getTitleNs()), - 'wl_title' => $this->getTitleDBkey(), - 'wl_notificationtimestamp' => null - ), __METHOD__, 'IGNORE' ); + array( + 'wl_user' => $this->getUserId(), + 'wl_namespace' => MWNamespace::getTalk( $this->getTitleNs() ), + 'wl_title' => $this->getTitleDBkey(), + 'wl_notificationtimestamp' => null + ), __METHOD__, 'IGNORE' ); $this->watched = true; @@ -197,7 +197,7 @@ class WatchedItem { $dbw->delete( 'watchlist', array( 'wl_user' => $this->getUserId(), - 'wl_namespace' => MWNamespace::getSubject($this->getTitleNs()), + 'wl_namespace' => MWNamespace::getSubject( $this->getTitleNs() ), 'wl_title' => $this->getTitleDBkey(), ), __METHOD__ ); @@ -212,7 +212,7 @@ class WatchedItem { $dbw->delete( 'watchlist', array( 'wl_user' => $this->getUserId(), - 'wl_namespace' => MWNamespace::getTalk($this->getTitleNs()), + 'wl_namespace' => MWNamespace::getTalk( $this->getTitleNs() ), 'wl_title' => $this->getTitleDBkey(), ), __METHOD__ ); diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 594226bb70..4cc28c3d85 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -565,9 +565,9 @@ class WebRequest { * * @return Array */ - public function getQueryValues() { + public function getQueryValues() { return $_GET; - } + } /** * Get the HTTP method used for this request. @@ -619,7 +619,7 @@ class WebRequest { global $wgCookiePrefix; $prefix = $wgCookiePrefix; } - return $this->getGPCVal( $_COOKIE, $prefix . $key , $default ); + return $this->getGPCVal( $_COOKIE, $prefix . $key, $default ); } /** @@ -849,7 +849,7 @@ class WebRequest { } else { foreach ( $_SERVER as $name => $value ) { if ( substr( $name, 0, 5 ) === 'HTTP_' ) { - $name = str_replace( '_', '-', substr( $name, 5 ) ); + $name = str_replace( '_', '-', substr( $name, 5 ) ); $this->headers[$name] = $value; } elseif ( $name === 'CONTENT_LENGTH' ) { $this->headers['CONTENT-LENGTH'] = $value; diff --git a/includes/WebResponse.php b/includes/WebResponse.php index f00e0551d0..37dbef48c7 100644 --- a/includes/WebResponse.php +++ b/includes/WebResponse.php @@ -52,7 +52,7 @@ class WebResponse { */ public function setcookie( $name, $value, $expire = 0, $prefix = null, $domain = null, $forceSecure = null ) { global $wgCookiePath, $wgCookiePrefix, $wgCookieDomain; - global $wgCookieSecure,$wgCookieExpiration, $wgCookieHttpOnly; + global $wgCookieSecure, $wgCookieExpiration, $wgCookieHttpOnly; if ( $expire == 0 ) { $expire = time() + $wgCookieExpiration; } diff --git a/includes/WebStart.php b/includes/WebStart.php index f209097956..28cc9493ad 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -62,7 +62,7 @@ if ( ini_get( 'register_globals' ) ) { # points and when $wgOut gets disabled or overridden. header( 'X-Content-Type-Options: nosniff' ); -$wgRequestTime = microtime(true); +$wgRequestTime = microtime( true ); # getrusage() does not exist on the Microsoft Windows platforms, catching this if ( function_exists ( 'getrusage' ) ) { $wgRUstart = getrusage(); @@ -123,7 +123,7 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) { MWFunction::call( MW_CONFIG_CALLBACK ); } else { if ( !defined( 'MW_CONFIG_FILE' ) ) { - define('MW_CONFIG_FILE', MWInit::interpretedPath( 'LocalSettings.php' ) ); + define( 'MW_CONFIG_FILE', MWInit::interpretedPath( 'LocalSettings.php' ) ); } # LocalSettings.php is the per site customization file. If it does not exist diff --git a/includes/WikiFilePage.php b/includes/WikiFilePage.php index 0114cce902..fa23072282 100644 --- a/includes/WikiFilePage.php +++ b/includes/WikiFilePage.php @@ -42,7 +42,7 @@ class WikiFilePage extends WikiPage { public function getActionOverrides() { $overrides = parent::getActionOverrides(); - $overrides[ 'revert' ] = 'RevertFileAction'; + $overrides['revert'] = 'RevertFileAction'; return $overrides; } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index fbe0820c26..57007eb7c3 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -3034,10 +3034,10 @@ class WikiPage extends Page implements IDBAccessObject { $removeFields = array( 'cat_pages = cat_pages - 1' ); if ( $ns == NS_CATEGORY ) { - $addFields[] = 'cat_subcats = cat_subcats + 1'; + $addFields[] = 'cat_subcats = cat_subcats + 1'; $removeFields[] = 'cat_subcats = cat_subcats - 1'; } elseif ( $ns == NS_FILE ) { - $addFields[] = 'cat_files = cat_files + 1'; + $addFields[] = 'cat_files = cat_files + 1'; $removeFields[] = 'cat_files = cat_files - 1'; } @@ -3315,7 +3315,7 @@ class PoolWorkArticleView extends PoolCounterWork { * @param $content Content|String: content to parse or null to load it; may also be given as a wikitext string, for BC */ function __construct( Page $page, ParserOptions $parserOptions, $revid, $useParserCache, $content = null ) { - if ( is_string($content) ) { // BC: old style call + if ( is_string( $content ) ) { // BC: old style call $modelId = $page->getRevision()->getContentModel(); $format = $page->getRevision()->getContentFormat(); $content = ContentHandler::makeContent( $content, $page->getTitle(), $modelId, $format ); diff --git a/includes/Xml.php b/includes/Xml.php index 7c451bbd96..59d422209f 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -192,7 +192,7 @@ class Xml { } elseif( $encMonth ) { $thisMonth = intval( gmdate( 'n' ) ); $thisYear = intval( gmdate( 'Y' ) ); - if( intval($encMonth) > $thisMonth ) { + if( intval( $encMonth ) > $thisMonth ) { $thisYear--; } $encYear = $thisYear; @@ -500,7 +500,7 @@ 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,13 +509,13 @@ 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(); @@ -636,10 +636,10 @@ class Xml { } elseif ( is_null( $value ) ) { $s = 'null'; } elseif ( is_int( $value ) || is_float( $value ) ) { - $s = strval($value); + $s = strval( $value ); } elseif ( is_array( $value ) && // Make sure it's not associative. - array_keys($value) === range( 0, count($value) - 1 ) || - count($value) == 0 + array_keys( $value ) === range( 0, count( $value ) - 1 ) || + count( $value ) == 0 ) { $s = '['; foreach ( $value as $elt ) { @@ -764,7 +764,7 @@ class Xml { 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() ); + $form .= Xml::tags( 'td', array( 'class' => 'mw-label'), wfMessage( $labelmsg )->parse() ); $form .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) ) . $input . Xml::closeElement( 'td' ); $form .= Xml::closeElement( 'tr' ); } diff --git a/includes/ZipDirectoryReader.php b/includes/ZipDirectoryReader.php index ccdf2bb110..fc36b1f7bb 100644 --- a/includes/ZipDirectoryReader.php +++ b/includes/ZipDirectoryReader.php @@ -181,7 +181,7 @@ class ZipDirectoryReader { * Throw an error, and log a debug message */ function error( $code, $debugMessage ) { - wfDebug( __CLASS__.": Fatal error: $debugMessage\n" ); + wfDebug( __CLASS__ . ": Fatal error: $debugMessage\n" ); throw new ZipDirectoryReaderError( $code ); } @@ -220,7 +220,7 @@ class ZipDirectoryReader { if ( $structSize + $this->eocdr['file comment length'] != strlen( $block ) - $sigPos ) { $this->error( 'zip-bad', 'trailing bytes after the end of the file comment' ); } - if ( $this->eocdr['disk'] !== 0 + if ( $this->eocdr['disk'] !== 0 || $this->eocdr['CD start disk'] !== 0 ) { $this->error( 'zip-unsupported', 'more than one disk (in EOCDR)' ); @@ -262,7 +262,7 @@ class ZipDirectoryReader { * may replace the regular "end of central directory record" in ZIP64 files. */ function readZip64EndOfCentralDirectoryRecord() { - if ( $this->eocdr64Locator['eocdr64 start disk'] != 0 + if ( $this->eocdr64Locator['eocdr64 start disk'] != 0 || $this->eocdr64Locator['number of disks'] != 0 ) { $this->error( 'zip-unsupported', 'more than one disk (in EOCDR64 locator)' ); @@ -286,7 +286,7 @@ class ZipDirectoryReader { if ( $data['signature'] !== "PK\x06\x06" ) { $this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory record' ); } - if ( $data['disk'] !== 0 + if ( $data['disk'] !== 0 || $data['CD start disk'] !== 0 ) { $this->error( 'zip-unsupported', 'more than one disk (in EOCDR64)' ); @@ -327,7 +327,7 @@ class ZipDirectoryReader { $offset = $this->eocdr['CD offset']; $numEntries = $this->eocdr['CD entries total']; $endPos = $this->eocdr['position']; - if ( $size == 0xffffffff + if ( $size == 0xffffffff || $offset == 0xffffffff || $numEntries == 0xffff ) { @@ -395,7 +395,7 @@ class ZipDirectoryReader { $data += $this->unpack( $block, $variableInfo, $pos ); $pos += $this->getStructSize( $variableInfo ); - if ( $this->zip64 && ( + if ( $this->zip64 && ( $data['compressed size'] == 0xffffffff || $data['uncompressed size'] == 0xffffffff || $data['local header offset'] == 0xffffffff ) ) @@ -618,7 +618,7 @@ class ZipDirectoryReader { $pos += $fieldSize; break; default: - throw new MWException( __METHOD__.": invalid type \"$typeName\"" ); + throw new MWException( __METHOD__ . ": invalid type \"$typeName\"" ); } } else { // Unsigned little-endian integer -- 2.20.1