From dbd0b590e99e6250b71141e47c080bce05af4887 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 17 Apr 2013 16:52:47 +0200 Subject: [PATCH] else if -> elseif Also fixed some spacing while at it Added some braces for one line statements Change-Id: Iebfa2b17091509daabc76248121c7763e2295d20 --- includes/EditPage.php | 34 ++-- includes/GlobalFunctions.php | 204 +++++++++++---------- includes/OutputPage.php | 132 ++++++------- includes/Title.php | 80 ++++---- includes/content/ContentHandler.php | 2 +- includes/db/DatabaseSqlite.php | 16 +- includes/diff/DifferenceEngine.php | 19 +- includes/installer/DatabaseUpdater.php | 26 +-- includes/resourceloader/ResourceLoader.php | 6 +- maintenance/backup.inc | 27 +-- maintenance/createAndPromote.php | 8 +- maintenance/language/languages.inc | 28 +-- maintenance/populateRevisionLength.php | 2 +- maintenance/populateRevisionSha1.php | 6 +- maintenance/update.php | 20 +- 15 files changed, 320 insertions(+), 290 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 6718442b2f..ae35f3e7e1 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -898,7 +898,9 @@ class EditPage { $orig = $this->getOriginalContent(); $content = $orig ? $orig->getSection( $this->section ) : null; - if ( !$content ) $content = $def_content; + if ( !$content ) { + $content = $def_content; + } } else { $undoafter = $wgRequest->getInt( 'undoafter' ); $undo = $wgRequest->getInt( 'undo' ); @@ -986,7 +988,9 @@ class EditPage { } $revision = $this->mArticle->getRevisionFetched(); if ( $revision === null ) { - if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel(); + if ( !$this->contentModel ) { + $this->contentModel = $this->getTitle()->getContentModel(); + } $handler = ContentHandler::getForModelID( $this->contentModel ); return $handler->makeEmptyContent(); @@ -1008,7 +1012,9 @@ class EditPage { $content = $rev ? $rev->getContent( Revision::RAW ) : null; if ( $content === false || $content === null ) { - if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel(); + if ( !$this->contentModel ) { + $this->contentModel = $this->getTitle()->getContentModel(); + } $handler = ContentHandler::getForModelID( $this->contentModel ); return $handler->makeEmptyContent(); @@ -1934,14 +1940,14 @@ class EditPage { if ( $namespace == NS_MEDIAWIKI ) { # Show a warning if editing an interface message $wgOut->wrapWikiMsg( "
\n$1\n
", 'editinginterface' ); - } else if( $namespace == NS_FILE ) { + } elseif ( $namespace == NS_FILE ) { # Show a hint to shared repo $file = wfFindFile( $this->mTitle ); - if( $file && !$file->isLocal() ) { + if ( $file && !$file->isLocal() ) { $descUrl = $file->getDescriptionUrl(); # there must be a description url to show a hint to shared repo - if( $descUrl ) { - if( !$this->mTitle->exists() ) { + if ( $descUrl ) { + if ( !$this->mTitle->exists() ) { $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'sharedupload-desc-create', $file->getRepo()->getDisplayName(), $descUrl ) ); @@ -2167,7 +2173,7 @@ class EditPage { } # When the summary is hidden, also hide them on preview/show changes - if( $this->nosummary ) { + if ( $this->nosummary ) { $wgOut->addHTML( Html::hidden( 'nosummary', true ) ); } @@ -2708,9 +2714,9 @@ HTML $oldtitlemsg = 'currentrev'; # if message does not exist, show diff against the preloaded default - if( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) { + if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !$this->mTitle->exists() ) { $oldtext = $this->mTitle->getDefaultMessageText(); - if( $oldtext !== false ) { + if ( $oldtext !== false ) { $oldtitlemsg = 'defaultmessagetext'; $oldContent = $this->toEditContent( $oldtext ); } else { @@ -3034,9 +3040,9 @@ HTML # don't parse non-wikitext pages, show message about preview if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { - if( $this->mTitle->isCssJsSubpage() ) { + if ( $this->mTitle->isCssJsSubpage() ) { $level = 'user'; - } elseif( $this->mTitle->isCssOrJsPage() ) { + } elseif ( $this->mTitle->isCssOrJsPage() ) { $level = 'site'; } else { $level = false; @@ -3052,7 +3058,7 @@ HTML # Used messages to make sure grep find them: # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview - if( $level && $format ) { + if ( $level && $format ) { $note = "
" . wfMessage( "{$level}{$format}preview" )->text() . "
"; } } @@ -3512,7 +3518,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/GlobalFunctions.php b/includes/GlobalFunctions.php index 0075bf5c6b..458ab548df 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -35,7 +35,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { * PHP extensions may be included here. */ -if( !function_exists( 'iconv' ) ) { +if ( !function_exists( 'iconv' ) ) { /** * @codeCoverageIgnore * @return string @@ -73,7 +73,7 @@ if ( !function_exists( 'mb_strlen' ) ) { } } -if( !function_exists( 'mb_strpos' ) ) { +if ( !function_exists( 'mb_strpos' ) ) { /** * @codeCoverageIgnore * @return int @@ -84,7 +84,7 @@ if( !function_exists( 'mb_strpos' ) ) { } -if( !function_exists( 'mb_strrpos' ) ) { +if ( !function_exists( 'mb_strrpos' ) ) { /** * @codeCoverageIgnore * @return int @@ -138,7 +138,7 @@ function wfArrayDiff2_cmp( $a, $b ) { } else { reset( $a ); reset( $b ); - while( ( list( , $valueA ) = each( $a ) ) && ( list( , $valueB ) = each( $b ) ) ) { + while ( ( list( , $valueA ) = each( $a ) ) && ( list( , $valueB ) = each( $b ) ) ) { $cmp = strcmp( $valueA, $valueB ); if ( $cmp !== 0 ) { return $cmp; @@ -262,7 +262,7 @@ function wfArrayInsertAfter( array $array, array $insert, $after ) { */ function wfObjectToArray( $objOrArray, $recursive = true ) { $array = array(); - if( is_object( $objOrArray ) ) { + if ( is_object( $objOrArray ) ) { $objOrArray = get_object_vars( $objOrArray ); } foreach ( $objOrArray as $key => $value ) { @@ -480,8 +480,8 @@ function wfAppendQuery( $url, $query ) { if ( is_array( $query ) ) { $query = wfArrayToCgi( $query ); } - if( $query != '' ) { - if( false === strpos( $url, '?' ) ) { + if ( $query != '' ) { + if ( false === strpos( $url, '?' ) ) { $url .= '?'; } else { $url .= '&'; @@ -1011,7 +1011,7 @@ function wfDebugTimer() { */ function wfDebugMem( $exact = false ) { $mem = memory_get_usage(); - if( !$exact ) { + if ( !$exact ) { $mem = floor( $mem / 1024 ) . ' kilobytes'; } else { $mem .= ' bytes'; @@ -1031,7 +1031,7 @@ function wfDebugMem( $exact = false ) { function wfDebugLog( $logGroup, $text, $public = true ) { global $wgDebugLogGroups; $text = trim( $text ) . "\n"; - if( isset( $wgDebugLogGroups[$logGroup] ) ) { + if ( isset( $wgDebugLogGroups[$logGroup] ) ) { $time = wfTimestamp( TS_DB ); $wiki = wfWikiID(); $host = wfHostname(); @@ -1310,27 +1310,27 @@ function wfReadOnlyReason() { function wfGetLangObj( $langcode = false ) { # Identify which language to get or create a language object for. # Using is_object here due to Stub objects. - if( is_object( $langcode ) ) { + if ( is_object( $langcode ) ) { # Great, we already have the object (hopefully)! return $langcode; } global $wgContLang, $wgLanguageCode; - if( $langcode === true || $langcode === $wgLanguageCode ) { + if ( $langcode === true || $langcode === $wgLanguageCode ) { # $langcode is the language code of the wikis content language object. # or it is a boolean and value is true return $wgContLang; } global $wgLang; - if( $langcode === false || $langcode === $wgLang->getCode() ) { + if ( $langcode === false || $langcode === $wgLang->getCode() ) { # $langcode is the language code of user language object. # or it was a boolean and value is false return $wgLang; } $validCodes = array_keys( Language::fetchLanguageNames() ); - if( in_array( $langcode, $validCodes ) ) { + if ( in_array( $langcode, $validCodes ) ) { # $langcode corresponds to a valid language. return Language::factory( $langcode ); } @@ -1463,7 +1463,7 @@ function wfMsgForContent( $key ) { $args = func_get_args(); array_shift( $args ); $forcontent = true; - if( is_array( $wgForceUIMsgAsContentMsg ) && + if ( is_array( $wgForceUIMsgAsContentMsg ) && in_array( $key, $wgForceUIMsgAsContentMsg ) ) { $forcontent = false; @@ -1486,7 +1486,7 @@ function wfMsgForContentNoTrans( $key ) { $args = func_get_args(); array_shift( $args ); $forcontent = true; - if( is_array( $wgForceUIMsgAsContentMsg ) && + if ( is_array( $wgForceUIMsgAsContentMsg ) && in_array( $key, $wgForceUIMsgAsContentMsg ) ) { $forcontent = false; @@ -1535,7 +1535,7 @@ function wfMsgGetKey( $key, $useDB = true, $langCode = false, $transform = true $cache = MessageCache::singleton(); $message = $cache->get( $key, $useDB, $langCode ); - if( $message === false ) { + if ( $message === false ) { $message = '<' . htmlspecialchars( $key ) . '>'; } elseif ( $transform ) { $message = $cache->transform( $message ); @@ -1562,7 +1562,7 @@ function wfMsgReplaceArgs( $message, $args ) { $args = array_values( $args[0] ); } $replacementKeys = array(); - foreach( $args as $n => $param ) { + foreach ( $args as $n => $param ) { $replacementKeys['$' . ( $n + 1 )] = $param; } $message = strtr( $message, $replacementKeys ); @@ -1646,11 +1646,11 @@ function wfMsgExt( $key, $options ) { array_shift( $args ); $options = (array)$options; - foreach( $options as $arrayKey => $option ) { - if( !preg_match( '/^[0-9]+|language$/', $arrayKey ) ) { + foreach ( $options as $arrayKey => $option ) { + if ( !preg_match( '/^[0-9]+|language$/', $arrayKey ) ) { # An unknown index, neither numeric nor "language" wfWarn( "wfMsgExt called with incorrect parameter key $arrayKey", 1, E_USER_WARNING ); - } elseif( preg_match( '/^[0-9]+$/', $arrayKey ) && !in_array( $option, + } elseif ( preg_match( '/^[0-9]+$/', $arrayKey ) && !in_array( $option, array( 'parse', 'parseinline', 'escape', 'escapenoentities', 'replaceafter', 'parsemag', 'content' ) ) ) { # A numeric index with unknown value @@ -1658,11 +1658,11 @@ function wfMsgExt( $key, $options ) { } } - if( in_array( 'content', $options, true ) ) { + if ( in_array( 'content', $options, true ) ) { $forContent = true; $langCode = true; $langCodeObj = null; - } elseif( array_key_exists( 'language', $options ) ) { + } elseif ( array_key_exists( 'language', $options ) ) { $forContent = false; $langCode = wfGetLangObj( $options['language'] ); $langCodeObj = $langCode; @@ -1674,13 +1674,13 @@ function wfMsgExt( $key, $options ) { $string = wfMsgGetKey( $key, /*DB*/true, $langCode, /*Transform*/false ); - if( !in_array( 'replaceafter', $options, true ) ) { + if ( !in_array( 'replaceafter', $options, true ) ) { $string = wfMsgReplaceArgs( $string, $args ); } $messageCache = MessageCache::singleton(); $parseInline = in_array( 'parseinline', $options, true ); - if( in_array( 'parse', $options, true ) || $parseInline ) { + if ( in_array( 'parse', $options, true ) || $parseInline ) { $string = $messageCache->parse( $string, null, true, !$forContent, $langCodeObj ); if ( $string instanceof ParserOutput ) { $string = $string->getText(); @@ -1688,7 +1688,7 @@ function wfMsgExt( $key, $options ) { if ( $parseInline ) { $m = array(); - if( preg_match( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { + if ( preg_match( '/^

(.*)\n?<\/p>\n?$/sU', $string, $m ) ) { $string = $m[1]; } } @@ -1703,7 +1703,7 @@ function wfMsgExt( $key, $options ) { $string = Sanitizer::escapeHtmlAllowEntities( $string ); } - if( in_array( 'replaceafter', $options, true ) ) { + if ( in_array( 'replaceafter', $options, true ) ) { $string = wfMsgReplaceArgs( $string, $args ); } @@ -1750,7 +1750,7 @@ function wfHostname() { # Hostname overriding global $wgOverrideHostname; - if( $wgOverrideHostname !== false ) { + if ( $wgOverrideHostname !== false ) { # Set static and skip any detection $host = $wgOverrideHostname; return $host; @@ -1762,7 +1762,7 @@ function wfHostname() { } else { $uname = false; } - if( is_array( $uname ) && isset( $uname['nodename'] ) ) { + if ( is_array( $uname ) && isset( $uname['nodename'] ) ) { $host = $uname['nodename']; } elseif ( getenv( 'COMPUTERNAME' ) ) { # Windows computer name @@ -1809,7 +1809,7 @@ function wfReportTime() { function wfDebugBacktrace( $limit = 0 ) { static $disabled = null; - if( extension_loaded( 'Zend Optimizer' ) ) { + if ( extension_loaded( 'Zend Optimizer' ) ) { wfDebug( "Zend Optimizer detected; skipping debug_backtrace for safety.\n" ); return array(); } @@ -1849,14 +1849,14 @@ function wfBacktrace() { $msg = "