From 6fbbbd17ca500c24d9d8f51c91ddb415949f375d Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 26 Jan 2013 19:32:03 +0100 Subject: [PATCH] fix some spacing Change-Id: Ie7bb35871cc99237f3a655f7db22ca1f0646df5e --- includes/Block.php | 48 +++++++++++++++++----------------- includes/ChangesList.php | 6 ++--- includes/EditPage.php | 8 +++--- includes/Exception.php | 12 ++++----- includes/Export.php | 2 +- includes/ExternalEdit.php | 2 +- includes/ExternalUser.php | 2 +- includes/HistoryBlob.php | 2 +- includes/ImagePage.php | 4 +-- includes/Import.php | 2 +- includes/MagicWord.php | 2 +- includes/Message.php | 6 ++--- includes/Metadata.php | 21 +++++++-------- includes/OutputPage.php | 14 +++++----- includes/PHPVersionError.php | 2 +- includes/Pager.php | 2 +- includes/Preferences.php | 2 +- includes/Sanitizer.php | 4 +-- includes/Setup.php | 6 ++--- includes/SiteConfiguration.php | 10 +++---- includes/SquidPurgeClient.php | 2 +- includes/Title.php | 2 +- includes/User.php | 24 ++++++++--------- includes/WebResponse.php | 2 +- includes/Wiki.php | 4 +-- includes/WikiPage.php | 11 ++++---- includes/Xml.php | 4 +-- 27 files changed, 102 insertions(+), 104 deletions(-) diff --git a/includes/Block.php b/includes/Block.php index b81cf3a32c..fde5f074c2 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -65,7 +65,7 @@ class Block { $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '' ) { - if( $timestamp === 0 ){ + if( $timestamp === 0 ) { $timestamp = wfTimestampNow(); } @@ -206,16 +206,16 @@ class Block { */ public function load( $address = '', $user = 0 ) { wfDeprecated( __METHOD__, '1.18' ); - if( $user ){ + if( $user ) { $username = User::whoIs( $user ); $block = self::newFromTarget( $username, $address ); } else { $block = self::newFromTarget( null, $address ); } - if( $block instanceof Block ){ + if( $block instanceof Block ) { # This is mildly evil, but hey, it's B/C :D - foreach( $block as $variable => $value ){ + foreach( $block as $variable => $value ) { $this->$variable = $value; } return true; @@ -237,7 +237,7 @@ class Block { protected function newLoad( $vagueTarget = null ) { $db = wfGetDB( $this->mFromMaster ? DB_MASTER : DB_SLAVE ); - if( $this->type !== null ){ + if( $this->type !== null ) { $conds = array( 'ipb_address' => array( (string)$this->target ), ); @@ -247,7 +247,7 @@ class Block { # Be aware that the != '' check is explicit, since empty values will be # passed by some callers (bug 29116) - if( $vagueTarget != ''){ + if( $vagueTarget != '' ) { list( $target, $type ) = self::parseTarget( $vagueTarget ); switch( $type ) { case self::TYPE_USER: @@ -285,20 +285,20 @@ class Block { # This is begging for $this = $bestBlock, but that's not allowed in PHP :( $bestBlockPreventsEdit = null; - foreach( $res as $row ){ + foreach( $res as $row ) { $block = self::newFromRow( $row ); # Don't use expired blocks - if( $block->deleteIfExpired() ){ + if( $block->deleteIfExpired() ) { continue; } # Don't use anon only blocks on users - if( $this->type == self::TYPE_USER && !$block->isHardblock() ){ + if( $this->type == self::TYPE_USER && !$block->isHardblock() ) { continue; } - if( $block->getType() == self::TYPE_RANGE ){ + if( $block->getType() == self::TYPE_RANGE ) { # This is the number of bits that are allowed to vary in the block, give # or take some floating point errors $end = wfBaseconvert( $block->getRangeEnd(), 16, 10 ); @@ -313,14 +313,14 @@ class Block { $score = $block->getType(); } - if( $score < $bestBlockScore ){ + if( $score < $bestBlockScore ) { $bestBlockScore = $score; $bestRow = $row; $bestBlockPreventsEdit = $block->prevents( 'edit' ); } } - if( $bestRow !== null ){ + if( $bestRow !== null ) { $this->initFromRow( $bestRow ); $this->prevents( 'edit', $bestBlockPreventsEdit ); return true; @@ -371,9 +371,9 @@ class Block { protected static function getIpFragment( $hex ) { global $wgBlockCIDRLimit; if ( substr( $hex, 0, 3 ) == 'v6-' ) { - return 'v6-' . substr( substr( $hex, 3 ), 0, floor( $wgBlockCIDRLimit['IPv6'] / 4 ) ); + return 'v6-' . substr( substr( $hex, 3 ), 0, floor( $wgBlockCIDRLimit['IPv6'] / 4 ) ); } else { - return substr( $hex, 0, floor( $wgBlockCIDRLimit['IPv4'] / 4 ) ); + return substr( $hex, 0, floor( $wgBlockCIDRLimit['IPv4'] / 4 ) ); } } @@ -511,7 +511,7 @@ class Block { * @return Array */ protected function getDatabaseArray( $db = null ) { - if( !$db ){ + if( !$db ) { $db = wfGetDB( DB_SLAVE ); } $expiry = $db->encodeExpiry( $this->mExpiry ); @@ -592,7 +592,7 @@ class Block { $options['LIMIT'] = 1; $res = $dbr->select( 'recentchanges', array( 'rc_ip' ), $conds, - __METHOD__ , $options ); + __METHOD__, $options ); if ( !$res->numRows() ) { # No results, don't autoblock anything @@ -1050,10 +1050,10 @@ class Block { public static function newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) { list( $target, $type ) = self::parseTarget( $specificTarget ); - if( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ){ + if( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ) { return Block::newFromID( $target ); - } elseif( $target === null && $vagueTarget == '' ){ + } elseif( $target === null && $vagueTarget == '' ) { # We're not going to find anything useful here # Be aware that the == '' check is explicit, since empty values will be # passed by some callers (bug 29116) @@ -1063,11 +1063,11 @@ class Block { $block = new Block(); $block->fromMaster( $fromMaster ); - if( $type !== null ){ + if( $type !== null ) { $block->setTarget( $target ); } - if( $block->newLoad( $vagueTarget ) ){ + if( $block->newLoad( $vagueTarget ) ) { return $block; } } @@ -1085,13 +1085,13 @@ class Block { */ public static function parseTarget( $target ) { # We may have been through this before - if( $target instanceof User ){ - if( IP::isValid( $target->getName() ) ){ + if( $target instanceof User ) { + if( IP::isValid( $target->getName() ) ) { return array( $target, self::TYPE_IP ); } else { return array( $target, self::TYPE_USER ); } - } elseif( $target === null ){ + } elseif( $target === null ) { return array( null, null ); } @@ -1112,7 +1112,7 @@ class Block { # Consider the possibility that this is not a username at all # but actually an old subpage (bug #29797) - if( strpos( $target, '/' ) !== false ){ + if( strpos( $target, '/' ) !== false ) { # An old subpage, drill down to the user behind it $parts = explode( '/', $target ); $target = $parts[0]; diff --git a/includes/ChangesList.php b/includes/ChangesList.php index e98fcac452..85fd8af3d5 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -136,7 +136,7 @@ class ChangesList extends ContextSource { */ protected function recentChangesFlags( $flags, $nothing = ' ' ) { $f = ''; - foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ){ + foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) { $f .= isset( $flags[$flag] ) && $flags[$flag] ? self::flag( $flag ) : $nothing; @@ -378,7 +378,7 @@ class ChangesList extends ContextSource { array( 'class' => 'mw-changeslist-title' ), $params ); - if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) { + if( $this->isDeleted( $rc, Revision::DELETED_TEXT ) ) { $articlelink = '' . $articlelink . ''; } # To allow for boldening pages watched by this user @@ -846,7 +846,7 @@ class EnhancedChangesList extends ChangesList { $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc); } else { # Logs are grouped by type - if( $type == RC_LOG ){ + if( $type == RC_LOG ) { $secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey(); } if( !isset( $this->rc_cache[$secureName] ) ) { diff --git a/includes/EditPage.php b/includes/EditPage.php index ce8077d7f4..5b01ca5482 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1508,7 +1508,7 @@ class EditPage { $this->isConflict = false; wfDebug( __METHOD__ . ": conflict suppressed; new section\n" ); } - } elseif ( $this->section == '' && Revision::userWasLastToEdit( DB_MASTER, $this->mTitle->getArticleID(), + } elseif ( $this->section == '' && Revision::userWasLastToEdit( DB_MASTER, $this->mTitle->getArticleID(), $wgUser->getId(), $this->edittime ) ) { # Suppress edit conflict with self, except for section edits where merging is required. wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" ); @@ -1715,7 +1715,7 @@ class EditPage { * @return bool * @deprecated since 1.21, use mergeChangesIntoContent() instead */ - function mergeChangesInto( &$editText ){ + function mergeChangesInto( &$editText ) { ContentHandler::deprecated( __METHOD__, "1.21" ); $editContent = $this->toEditContent( $editText ); @@ -1740,7 +1740,7 @@ class EditPage { * * @return bool */ - private function mergeChangesIntoContent( &$editContent ){ + private function mergeChangesIntoContent( &$editContent ) { wfProfileIn( __METHOD__ ); $db = wfGetDB( DB_MASTER ); @@ -3454,7 +3454,7 @@ HTML global $wgOut, $wgLang; $this->textbox2 = $this->textbox1; - if( is_array( $match ) ){ + if( is_array( $match ) ) { $match = $wgLang->listToText( $match ); } $wgOut->prepareErrorPage( wfMessage( 'spamprotectiontitle' ) ); diff --git a/includes/Exception.php b/includes/Exception.php index f09e8f8ad5..27ae3380a6 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -329,7 +329,7 @@ class ErrorPageError extends MWException { $this->msg = $msg; $this->params = $params; - if( $msg instanceof Message ){ + if( $msg instanceof Message ) { parent::__construct( $msg ); } else { parent::__construct( wfMessage( $msg )->text() ); @@ -423,7 +423,7 @@ class PermissionsError extends ErrorPageError { * @ingroup Exception */ class ReadOnlyError extends ErrorPageError { - public function __construct(){ + public function __construct() { parent::__construct( 'readonly', 'readonlytext', @@ -439,14 +439,14 @@ class ReadOnlyError extends ErrorPageError { * @ingroup Exception */ class ThrottledError extends ErrorPageError { - public function __construct(){ + public function __construct() { parent::__construct( 'actionthrottled', 'actionthrottledtext' ); } - public function report(){ + public function report() { global $wgOut; $wgOut->setStatusCode( 503 ); parent::report(); @@ -460,7 +460,7 @@ class ThrottledError extends ErrorPageError { * @ingroup Exception */ class UserBlockedError extends ErrorPageError { - public function __construct( Block $block ){ + public function __construct( Block $block ) { global $wgLang, $wgRequest; $blocker = $block->getBlocker(); @@ -560,7 +560,7 @@ class HttpError extends MWException { * @param $content String|Message: content of the message * @param $header String|Message: content of the header (\ and \) */ - public function __construct( $httpCode, $content, $header = null ){ + public function __construct( $httpCode, $content, $header = null ) { parent::__construct( $content ); $this->httpCode = (int)$httpCode; $this->header = $header; diff --git a/includes/Export.php b/includes/Export.php index 16c297ee5c..088a8072a2 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -330,7 +330,7 @@ class WikiExporter { $join['revision'] = array( 'INNER JOIN', 'page_id=rev_page' ); } elseif ( $this->history & WikiExporter::CURRENT ) { # Latest revision dumps... - if ( $this->list_authors && $cond != '' ) { // List authors, if so desired + if ( $this->list_authors && $cond != '' ) { // List authors, if so desired $this->do_list_authors( $cond ); } $join['revision'] = array( 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ); diff --git a/includes/ExternalEdit.php b/includes/ExternalEdit.php index 346832538c..3f73376479 100644 --- a/includes/ExternalEdit.php +++ b/includes/ExternalEdit.php @@ -87,7 +87,7 @@ class ExternalEdit extends ContextSource { 'URL' => $image->getCanonicalURL() ) ); - } else{ + } else { $urls = array(); } } else { diff --git a/includes/ExternalUser.php b/includes/ExternalUser.php index 46565e4e37..82fe196c50 100644 --- a/includes/ExternalUser.php +++ b/includes/ExternalUser.php @@ -294,7 +294,7 @@ abstract class ExternalUser { * a local user. * @return Mixed User if the account is linked, Null otherwise. */ - final public function getLocalUser(){ + final public function getLocalUser() { $dbr = wfGetDB( DB_SLAVE ); $row = $dbr->selectRow( 'external_user', diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 55c2ae5e99..3de148b480 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -430,7 +430,7 @@ class DiffHistoryBlob implements HistoryBlob { * @throws MWException */ function compress() { - if ( !function_exists( 'xdiff_string_rabdiff' ) ){ + if ( !function_exists( 'xdiff_string_rabdiff' ) ) { throw new MWException( "Need xdiff 1.5+ support to write DiffHistoryBlob\n" ); } if ( isset( $this->mDiffs ) ) { diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 49650545d6..a54bd92143 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -382,7 +382,7 @@ class ImagePage extends Article { params( count( $otherSizes ) )->parse() ); } - } elseif ( $width == 0 && $height == 0 ){ + } elseif ( $width == 0 && $height == 0 ) { # Some sort of audio file that doesn't have dimensions # Don't output a no hi res message for such a file $msgsmall = ''; @@ -1166,7 +1166,7 @@ class ImageHistoryList extends ContextSource { protected function getThumbForLine( $file ) { $lang = $this->getLanguage(); $user = $this->getUser(); - if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE,$user ) + if ( $file->allowInlineDisplay() && $file->userCan( File::DELETED_FILE, $user ) && !$file->isDeleted( File::DELETED_FILE ) ) { $params = array( diff --git a/includes/Import.php b/includes/Import.php index bd9ce25cbc..d00002ae4c 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -1650,7 +1650,7 @@ class ImportStreamSource { return Status::newFatal( 'importnofile' ); } if( !empty( $upload['error'] ) ) { - switch($upload['error']){ + switch( $upload['error'] ) { case 1: # The uploaded file exceeds the upload_max_filesize directive in php.ini. return Status::newFatal( 'importuploaderrorsize' ); case 2: # The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form. diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 7cf59e9597..d1f6a0fb88 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -598,7 +598,7 @@ class MagicWord { function replaceMultiple( $magicarr, $subject, &$result ) { $search = array(); $replace = array(); - foreach( $magicarr as $id => $replacement ){ + foreach( $magicarr as $id => $replacement ) { $mw = MagicWord::get( $id ); $search[] = $mw->getRegex(); $replace[] = $replacement; diff --git a/includes/Message.php b/includes/Message.php index 8f10b8b79b..96747c9b5d 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -457,11 +457,11 @@ class Message { if( preg_match( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { $string = $m[1]; } - } elseif( $this->format === 'block-parse' ){ + } elseif( $this->format === 'block-parse' ) { $string = $this->parseText( $string ); - } elseif( $this->format === 'text' ){ + } elseif( $this->format === 'text' ) { $string = $this->transformText( $string ); - } elseif( $this->format === 'escaped' ){ + } elseif( $this->format === 'escaped' ) { $string = $this->transformText( $string ); $string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8', false ); } diff --git a/includes/Metadata.php b/includes/Metadata.php index 8a795ff743..9a4ddca997 100644 --- a/includes/Metadata.php +++ b/includes/Metadata.php @@ -42,7 +42,7 @@ abstract class RdfMetaData { $httpaccept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null; $rdftype = wfNegotiateType( wfAcceptToPrefs( $httpaccept ), wfAcceptToPrefs( self::RDF_TYPE_PREFS ) ); - if( !$rdftype ){ + if( !$rdftype ) { throw new HttpError( 406, wfMessage( 'notacceptable' ) ); } @@ -70,7 +70,7 @@ abstract class RdfMetaData { $lastEditor = User::newFromId( $this->mArticle->getUser() ); $this->person( 'creator', $lastEditor ); - foreach( $this->mArticle->getContributors() as $user ){ + foreach( $this->mArticle->getContributors() as $user ) { $this->person( 'contributor', $user ); } @@ -95,7 +95,7 @@ abstract class RdfMetaData { $nt = Title::newFromText( $page ); } - if( !$nt || $nt->getArticleID() == 0 ){ + if( !$nt || $nt->getArticleID() == 0 ) { $this->element( $name, $str ); } else { $this->page( $name, $nt ); @@ -116,7 +116,7 @@ abstract class RdfMetaData { } protected function person( $name, User $user ) { - if( $user->isAnon() ){ + if( $user->isAnon() ) { $this->element( $name, wfMessage( 'anonymous' )->numParams( 1 )->text() ); } else { $real = $user->getRealName(); @@ -141,11 +141,11 @@ abstract class RdfMetaData { global $wgRightsPage, $wgRightsUrl, $wgRightsText; if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) ) - && ($nt->getArticleID() != 0)) { - $this->page('rights', $nt); - } elseif( $wgRightsUrl ){ - $this->url('rights', $wgRightsUrl); - } elseif( $wgRightsText ){ + && ( $nt->getArticleID() != 0 ) ) { + $this->page( 'rights', $nt ); + } elseif( $wgRightsUrl ) { + $this->url( 'rights', $wgRightsUrl ); + } elseif( $wgRightsText ) { $this->element( 'rights', $wgRightsText ); } } @@ -153,7 +153,7 @@ abstract class RdfMetaData { protected function getTerms( $url ) { global $wgLicenseTerms; - if( $wgLicenseTerms ){ + if( $wgLicenseTerms ) { return $wgLicenseTerms; } else { $known = $this->getKnownLicenses(); @@ -200,4 +200,3 @@ abstract class RdfMetaData { return $knownLicenses; } } - diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 5b0f36c5a1..9c628cb5eb 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -442,7 +442,7 @@ class OutputPage extends ContextSource { protected function filterModules( $modules, $position = null, $type = ResourceLoaderModule::TYPE_COMBINED ) { $resourceLoader = $this->getResourceLoader(); $filteredModules = array(); - foreach( $modules as $val ){ + foreach( $modules as $val ) { $module = $resourceLoader->getModule( $val ); if( $module instanceof ResourceLoaderModule && $module->getOrigin() <= $this->getAllowedModules( $type ) @@ -512,7 +512,7 @@ class OutputPage extends ContextSource { * @return Array of module names */ public function getModuleStyles( $filter = false, $position = null ) { - return $this->getModules( $filter, $position, 'mModuleStyles' ); + return $this->getModules( $filter, $position, 'mModuleStyles' ); } /** @@ -1251,7 +1251,7 @@ class OutputPage extends ContextSource { * @return Int ResourceLoaderModule ORIGIN_ class constant */ public function getAllowedModules( $type ) { - if( $type == ResourceLoaderModule::TYPE_COMBINED ){ + if( $type == ResourceLoaderModule::TYPE_COMBINED ) { return min( array_values( $this->mAllowedModules ) ); } else { return isset( $this->mAllowedModules[$type] ) @@ -2071,7 +2071,7 @@ class OutputPage extends ContextSource { $this->prepareErrorPage( $title ); - if ( $msg instanceof Message ){ + if ( $msg instanceof Message ) { $this->addHTML( $msg->parseAsBlock() ); } else { $this->addWikiMsgArray( $msg, $params ); @@ -2483,7 +2483,7 @@ $templates 'mediawiki.page.startup', 'mediawiki.page.ready', ) ); - if ( $wgIncludeLegacyJavaScript ){ + if ( $wgIncludeLegacyJavaScript ) { $this->addModules( 'mediawiki.legacy.wikibits' ); } @@ -2711,7 +2711,7 @@ $templates } } - if( $group == 'noscript' ){ + if( $group == 'noscript' ) { $links .= Html::rawElement( 'noscript', array(), $link ) . "\n"; } else { $links .= $link . "\n"; @@ -3379,7 +3379,7 @@ $templates if ( $wgUseSiteCss ) { $moduleStyles[] = 'site'; $moduleStyles[] = 'noscript'; - if( $this->getUser()->isLoggedIn() ){ + if( $this->getUser()->isLoggedIn() ) { $moduleStyles[] = 'user.groups'; } } diff --git a/includes/PHPVersionError.php b/includes/PHPVersionError.php index 2aed2afbdb..c60c107826 100644 --- a/includes/PHPVersionError.php +++ b/includes/PHPVersionError.php @@ -37,7 +37,7 @@ * @note Since we can't rely on anything, the minimum PHP versions and MW current * version are hardcoded here */ -function wfPHPVersionError( $type ){ +function wfPHPVersionError( $type ) { $mwVersion = '1.21'; $phpVersion = PHP_VERSION; $message = "MediaWiki $mwVersion requires at least PHP version 5.3.2, you are using PHP $phpVersion."; diff --git a/includes/Pager.php b/includes/Pager.php index 077430d27d..856b1b82e9 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -1160,7 +1160,7 @@ abstract class TablePager extends IndexPager { # The pair is either $index => $limit, in which case the $value # will be numeric, or $limit => $text, in which case the $value # will be a string. - if( is_int( $value ) ){ + if( is_int( $value ) ) { $limit = $value; $text = $this->getLanguage()->formatNum( $limit ); } else { diff --git a/includes/Preferences.php b/includes/Preferences.php index 987839646d..c15c5b5aaf 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1407,7 +1407,7 @@ class Preferences { # via $wgHiddenPrefs, we don't want to destroy that setting in case the preference # is subsequently re-enabled # TODO: maintenance script to actually delete these - foreach( $wgHiddenPrefs as $pref ){ + foreach( $wgHiddenPrefs as $pref ) { # If the user has not set a non-default value here, the default will be returned # and subsequently discarded $formData[$pref] = $user->getOption( $pref, null, true ); diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 0034afefae..9cac30845b 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -431,7 +431,7 @@ class Sanitizer { $extratags = array_flip( $extratags ); $removetags = array_flip( $removetags ); $htmlpairs = array_merge( $extratags, $htmlpairsStatic ); - $htmlelements = array_diff_key( array_merge( $extratags, $htmlelementsStatic ) , $removetags ); + $htmlelements = array_diff_key( array_merge( $extratags, $htmlelementsStatic ), $removetags ); # Remove HTML comments $text = Sanitizer::removeHTMLcomments( $text ); @@ -1039,7 +1039,7 @@ class Sanitizer { $id = str_replace( array_keys( $replace ), array_values( $replace ), $id ); if ( !preg_match( '/^[a-zA-Z]/', $id ) - && !in_array( 'noninitial', $options ) ) { + && !in_array( 'noninitial', $options ) ) { // Initial character must be a letter! $id = "x$id"; } diff --git a/includes/Setup.php b/includes/Setup.php index 2bf2507b0b..53739fb2bd 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -50,9 +50,9 @@ if ( $wgLoadScript === false ) $wgLoadScript = "$wgScriptPath/load$wgScriptExten if ( $wgArticlePath === false ) { if ( $wgUsePathInfo ) { - $wgArticlePath = "$wgScript/$1"; + $wgArticlePath = "$wgScript/$1"; } else { - $wgArticlePath = "$wgScript?title=$1"; + $wgArticlePath = "$wgScript?title=$1"; } } @@ -323,7 +323,7 @@ if ( !$wgEnotifMinorEdits ) { } # $wgDisabledActions is deprecated as of 1.18 -foreach( $wgDisabledActions as $action ){ +foreach( $wgDisabledActions as $action ) { $wgActions[$action] = false; } diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index afe0cc7342..4bbe9e1185 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -360,9 +360,9 @@ class SiteConfiguration { public function extractGlobalSetting( $setting, $wiki, $params ) { $value = $this->getSetting( $setting, $wiki, $params ); if ( !is_null( $value ) ) { - if (substr($setting,0,1) == '+' && is_array($value)) { - $setting = substr($setting,1); - if ( is_array($GLOBALS[$setting]) ) { + if ( substr( $setting, 0, 1 ) == '+' && is_array( $value ) ) { + $setting = substr( $setting, 1 ); + if ( is_array( $GLOBALS[$setting] ) ) { $GLOBALS[$setting] = self::arrayMerge( $GLOBALS[$setting], $value ); } else { $GLOBALS[$setting] = $value; @@ -413,7 +413,7 @@ class SiteConfiguration { return $default; } - foreach( $default as $name => $def ){ + foreach( $default as $name => $def ) { if( !isset( $ret[$name] ) || ( is_array( $default[$name] ) && !is_array( $ret[$name] ) ) ) { $ret[$name] = $default[$name]; } @@ -446,7 +446,7 @@ class SiteConfiguration { $ret['params'] += $params; // Automatically fill that ones if needed - if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ){ + if( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ) { $ret['params']['lang'] = $ret['lang']; } if( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) ) { diff --git a/includes/SquidPurgeClient.php b/includes/SquidPurgeClient.php index 7d75f2ca9a..098fb0b641 100644 --- a/includes/SquidPurgeClient.php +++ b/includes/SquidPurgeClient.php @@ -293,7 +293,7 @@ class SquidPurgeClient { if ( count( $lines ) < 2 ) { return 'done'; } - if ( $this->readState == 'status' ) { + if ( $this->readState == 'status' ) { $this->processStatusLine( $lines[0] ); } else { // header $this->processHeaderLine( $lines[0] ); diff --git a/includes/Title.php b/includes/Title.php index 442bc22922..9de94d8497 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3980,7 +3980,7 @@ class Title { } # Get the article text $rev = Revision::newFromTitle( $nt, false, Revision::READ_LATEST ); - if( !is_object( $rev ) ){ + if( !is_object( $rev ) ) { return false; } $content = $rev->getContent(); diff --git a/includes/User.php b/includes/User.php index 9a60aa980a..3e49cd02db 100644 --- a/includes/User.php +++ b/includes/User.php @@ -547,7 +547,7 @@ class User { * @return Bool */ public static function isIP( $name ) { - return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name) || IP::isIPv6($name); + return preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/', $name ) || IP::isIPv6( $name ); } /** @@ -1569,7 +1569,7 @@ class User { * @param $bFromSlave Bool Whether to check the slave database instead of the master * @return Block|null */ - public function getBlock( $bFromSlave = true ){ + public function getBlock( $bFromSlave = true ) { $this->getBlockedStatus( $bFromSlave ); return $this->mBlock instanceof Block ? $this->mBlock : null; } @@ -2229,7 +2229,7 @@ class User { # set it, and then it was disabled removing their ability to change it). But # we don't want to erase the preferences in the database in case the preference # is re-enabled again. So don't touch $mOptions, just override the returned value - if( in_array( $oname, $wgHiddenPrefs ) && !$ignoreHidden ){ + if( in_array( $oname, $wgHiddenPrefs ) && !$ignoreHidden ) { return self::getDefaultOption( $oname ); } @@ -2255,9 +2255,9 @@ class User { # set it, and then it was disabled removing their ability to change it). But # we don't want to erase the preferences in the database in case the preference # is re-enabled again. So don't touch $mOptions, just override the returned value - foreach( $wgHiddenPrefs as $pref ){ + foreach( $wgHiddenPrefs as $pref ) { $default = self::getDefaultOption( $pref ); - if( $default !== null ){ + if( $default !== null ) { $options[$pref] = $default; } } @@ -2690,8 +2690,8 @@ class User { */ public function isAllowedAny( /*...*/ ) { $permissions = func_get_args(); - foreach( $permissions as $permission ){ - if( $this->isAllowed( $permission ) ){ + foreach( $permissions as $permission ) { + if( $this->isAllowed( $permission ) ) { return true; } } @@ -2705,8 +2705,8 @@ class User { */ public function isAllowedAll( /*...*/ ) { $permissions = func_get_args(); - foreach( $permissions as $permission ){ - if( !$this->isAllowed( $permission ) ){ + foreach( $permissions as $permission ) { + if( !$this->isAllowed( $permission ) ) { return false; } } @@ -2880,7 +2880,7 @@ class User { return; } $id = $this->getId(); - if( $id != 0 ) { + if( $id != 0 ) { $dbw = wfGetDB( DB_MASTER ); $dbw->update( 'watchlist', array( /* SET */ @@ -3265,7 +3265,7 @@ class User { wfDeprecated( __METHOD__, '1.17' ); global $wgUseDynamicDates, $wgRenderHashAppend, $wgLang, $wgContLang; - if( $this->mHash ){ + if( $this->mHash ) { return $this->mHash; } @@ -3306,7 +3306,7 @@ class User { */ public function isBlockedFromCreateAccount() { $this->getBlockedStatus(); - if( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ){ + if( $this->mBlock && $this->mBlock->prevents( 'createaccount' ) ) { return $this->mBlock; } diff --git a/includes/WebResponse.php b/includes/WebResponse.php index e4677380f4..f00e0551d0 100644 --- a/includes/WebResponse.php +++ b/includes/WebResponse.php @@ -159,7 +159,7 @@ class FauxResponse extends WebResponse { * @param $name string * @return string */ - public function getcookie( $name ) { + public function getcookie( $name ) { if ( isset( $this->cookies[$name] ) ) { return $this->cookies[$name]; } diff --git a/includes/Wiki.php b/includes/Wiki.php index 760424199a..21a7d9a027 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -126,7 +126,7 @@ class MediaWiki { * @return Title */ public function getTitle() { - if( $this->context->getTitle() === null ){ + if( $this->context->getTitle() === null ) { $this->context->setTitle( $this->parseTitle() ); } return $this->context->getTitle(); @@ -507,7 +507,7 @@ class MediaWiki { && $request->getMethod() == 'GET' ) { $redirUrl = $request->getFullRequestURL(); - $redirUrl = str_replace( 'http://' , 'https://' , $redirUrl ); + $redirUrl = str_replace( 'http://', 'https://', $redirUrl ); // Setup dummy Title, otherwise OutputPage::redirect will fail $title = Title::newFromText( NS_MAIN, 'REDIR' ); diff --git a/includes/WikiPage.php b/includes/WikiPage.php index e2cd5d988f..49a944bb74 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1139,7 +1139,7 @@ class WikiPage extends Page implements IDBAccessObject { public function doPurge() { global $wgUseSquid; - if( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ){ + if( !wfRunHooks( 'ArticlePurge', array( &$this ) ) ) { return false; } @@ -1948,7 +1948,7 @@ class WikiPage extends Page implements IDBAccessObject { public function prepareTextForEdit( $text, $revid = null, User $user = null ) { ContentHandler::deprecated( __METHOD__, '1.21' ); $content = ContentHandler::makeContent( $text, $this->getTitle() ); - return $this->prepareContentForEdit( $content, $revid , $user ); + return $this->prepareContentForEdit( $content, $revid, $user ); } /** @@ -2151,7 +2151,7 @@ class WikiPage extends Page implements IDBAccessObject { ContentHandler::deprecated( __METHOD__, "1.21" ); $content = ContentHandler::makeContent( $text, $this->getTitle() ); - return $this->doQuickEditContent( $content, $user, $comment , $minor ); + return $this->doQuickEditContent( $content, $user, $comment, $minor ); } /** @@ -2292,8 +2292,8 @@ class WikiPage extends Page implements IDBAccessObject { if ( $encodedExpiry[$action] != 'infinity' ) { $expiryText = wfMessage( 'protect-expiring', - $wgContLang->timeanddate( $expiry[$action], false, false ) , - $wgContLang->date( $expiry[$action], false, false ) , + $wgContLang->timeanddate( $expiry[$action], false, false ), + $wgContLang->date( $expiry[$action], false, false ), $wgContLang->time( $expiry[$action], false, false ) )->inContentLanguage()->text(); } else { @@ -3451,4 +3451,3 @@ class PoolWorkArticleView extends PoolCounterWork { return false; } } - diff --git a/includes/Xml.php b/includes/Xml.php index d5e9189ef1..7c451bbd96 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -369,10 +369,10 @@ class Xml { $a = array( 'for' => $id ); # FIXME avoid copy pasting below: - if( isset( $attribs['class'] ) ){ + if( isset( $attribs['class'] ) ) { $a['class'] = $attribs['class']; } - if( isset( $attribs['title'] ) ){ + if( isset( $attribs['title'] ) ) { $a['title'] = $attribs['title']; } -- 2.20.1