From 6c278b6d7eb3c4516888e25a21101ad7508f48cd Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sun, 24 Mar 2013 11:01:51 +0100 Subject: [PATCH] fix some spacing * Removed spaces around array index * Removed double spaces or added spaces to begin or end of function calls, method signature, conditions or foreachs * Added braces to one-line ifs * Changed multi line conditions to one line conditions * Realigned some arrays Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3 --- includes/ArrayUtils.php | 2 +- includes/Cdb_PHP.php | 2 +- includes/ChangesFeed.php | 2 +- includes/ChangesList.php | 2 +- includes/Collation.php | 4 +- includes/Defines.php | 4 +- includes/Exception.php | 7 +- includes/Export.php | 5 +- includes/GlobalFunctions.php | 2 +- includes/HTMLForm.php | 2 +- includes/Hooks.php | 2 +- includes/HttpFunctions.php | 23 ++++--- includes/ImagePage.php | 2 +- includes/Import.php | 2 +- includes/LinksUpdate.php | 2 +- includes/MWFunction.php | 2 +- includes/MimeMagic.php | 14 ++-- includes/Namespace.php | 4 +- includes/OutputPage.php | 2 +- includes/Revision.php | 8 +-- includes/RevisionList.php | 3 +- includes/Sanitizer.php | 45 +++++++------ includes/SeleniumWebSettings.php | 4 +- includes/Setup.php | 2 +- includes/SiteConfiguration.php | 2 +- includes/Skin.php | 2 +- includes/Timestamp.php | 2 +- includes/Title.php | 2 +- includes/User.php | 8 +-- includes/UserArray.php | 2 +- includes/WebRequest.php | 8 +-- includes/WikiMap.php | 3 +- includes/WikiPage.php | 6 +- includes/Xml.php | 6 +- includes/api/ApiBase.php | 2 +- includes/api/ApiImageRotate.php | 10 +-- includes/api/ApiMain.php | 4 +- includes/api/ApiPageSet.php | 2 +- includes/api/ApiQueryAllCategories.php | 2 +- includes/api/ApiQueryBacklinks.php | 8 +-- includes/api/ApiQueryBlocks.php | 2 +- includes/api/ApiQuerySiteinfo.php | 2 +- includes/cache/SquidUpdate.php | 2 +- includes/content/ContentHandler.php | 8 +-- includes/db/Database.php | 16 ++--- includes/db/DatabaseMssql.php | 14 ++-- includes/db/DatabaseOracle.php | 10 +-- includes/db/LBFactory.php | 2 +- includes/diff/DairikiDiff.php | 2 +- .../filebackend/FileBackendMultiWrite.php | 2 +- includes/filerepo/file/File.php | 4 +- includes/filerepo/file/ForeignAPIFile.php | 4 +- includes/installer/DatabaseInstaller.php | 3 +- includes/installer/DatabaseUpdater.php | 2 +- includes/installer/Installer.php | 10 +-- includes/installer/LocalSettingsGenerator.php | 2 +- includes/installer/MysqlInstaller.php | 3 +- includes/installer/OracleInstaller.php | 3 +- includes/installer/PostgresInstaller.php | 6 +- includes/installer/PostgresUpdater.php | 2 +- includes/installer/WebInstaller.php | 14 ++-- includes/installer/WebInstallerPage.php | 8 +-- includes/media/BMP.php | 4 +- includes/media/Bitmap.php | 6 +- includes/media/DjVuImage.php | 2 +- includes/media/ExifBitmap.php | 6 +- includes/media/FormatMetadata.php | 4 +- includes/media/ImageHandler.php | 2 +- includes/media/Jpeg.php | 18 +++--- includes/media/MediaHandler.php | 2 +- includes/media/PNGMetadataExtractor.php | 18 +++--- includes/media/SVGMetadataExtractor.php | 6 +- includes/media/XMP.php | 6 +- includes/media/XMPValidate.php | 2 +- includes/objectcache/MemcachedClient.php | 12 ++-- includes/parser/DateFormatter.php | 2 +- includes/parser/LinkHolderArray.php | 3 +- includes/parser/Parser.php | 6 +- includes/parser/Preprocessor_DOM.php | 16 ++--- includes/parser/Preprocessor_Hash.php | 4 +- includes/profiler/Profiler.php | 2 +- includes/profiler/ProfilerSimpleUDP.php | 2 +- .../ResourceLoaderLanguageDataModule.php | 2 +- includes/revisiondelete/RevisionDelete.php | 3 +- .../RevisionDeleteAbstracts.php | 2 +- includes/revisiondelete/RevisionDeleter.php | 2 +- includes/search/SearchMySQL.php | 4 +- includes/search/SearchOracle.php | 64 ++++++++++--------- includes/search/SearchPostgres.php | 22 +++---- includes/search/SearchSqlite.php | 4 +- includes/search/SearchUpdate.php | 2 +- includes/site/MediaWikiSite.php | 2 +- includes/specials/SpecialAllpages.php | 2 +- includes/specials/SpecialBlock.php | 2 +- includes/specials/SpecialCategories.php | 3 +- includes/specials/SpecialContributions.php | 2 +- includes/specials/SpecialEmailuser.php | 4 +- includes/specials/SpecialJavaScriptTest.php | 2 +- includes/specials/SpecialProtectedpages.php | 9 +-- includes/specials/SpecialProtectedtitles.php | 5 +- .../specials/SpecialRecentchangeslinked.php | 4 +- includes/specials/SpecialRevisiondelete.php | 2 +- includes/specials/SpecialSearch.php | 6 +- includes/specials/SpecialUndelete.php | 7 +- includes/specials/SpecialWatchlist.php | 2 +- includes/specials/SpecialWhatlinkshere.php | 9 ++- includes/templates/NoLocalSettings.php | 2 +- includes/upload/UploadBase.php | 25 ++++---- includes/upload/UploadFromChunks.php | 2 +- 109 files changed, 324 insertions(+), 331 deletions(-) diff --git a/includes/ArrayUtils.php b/includes/ArrayUtils.php index 0b74f06a00..985271f709 100644 --- a/includes/ArrayUtils.php +++ b/includes/ArrayUtils.php @@ -39,7 +39,7 @@ class ArrayUtils { * * @return bool|int|string */ - public static function pickRandom( $weights ){ + public static function pickRandom( $weights ) { if ( !is_array( $weights ) || count( $weights ) == 0 ) { return false; } diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php index 71b55f876e..e16397b327 100644 --- a/includes/Cdb_PHP.php +++ b/includes/Cdb_PHP.php @@ -411,7 +411,7 @@ class CdbWriter_PHP extends CdbWriter { // Calculate the number of items that will be in each hashtable $counts = array_fill( 0, 256, 0 ); foreach ( $this->hplist as $item ) { - ++ $counts[ 255 & $item['h'] ]; + ++ $counts[255 & $item['h']]; } // Fill in $starts with the *end* indexes diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index 476de5bd9d..ac6d3326d7 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -146,7 +146,7 @@ class ChangesFeed { $feedLastmodUnix = wfTimestamp( TS_UNIX, $feedLastmod ); $lastmodUnix = wfTimestamp( TS_UNIX, $lastmod ); - if( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix) { + if( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix ) { wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" ); if ( $feedLastmodUnix < $lastmodUnix ) { $wgOut->setLastModified( $feedLastmod ); // bug 21916 diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 8461001e9b..0c4d69e691 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -936,7 +936,7 @@ class EnhancedChangesList extends ChangesList { krsort( $userlinks ); asort( $userlinks ); $users = array(); - foreach( $userlinks as $userlink => $count) { + foreach( $userlinks as $userlink => $count ) { $text = $userlink; $text .= $this->getLanguage()->getDirMark(); if( $count > 1 ) { diff --git a/includes/Collation.php b/includes/Collation.php index 3f0fa7bdbb..107e8f98ee 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -364,8 +364,8 @@ class IcuCollation extends Collation { // Append additional characters $letters = array_merge( $letters, self::$tailoringFirstLetters[$this->locale] ); // Remove unnecessary ones, if any - if ( isset( self::$tailoringFirstLetters[ '-' . $this->locale ] ) ) { - $letters = array_diff( $letters, self::$tailoringFirstLetters[ '-' . $this->locale ] ); + if ( isset( self::$tailoringFirstLetters['-' . $this->locale] ) ) { + $letters = array_diff( $letters, self::$tailoringFirstLetters['-' . $this->locale] ); } } else { $letters = wfGetPrecompiledData( "first-letters-{$this->locale}.ser" ); diff --git a/includes/Defines.php b/includes/Defines.php index c4a8633515..28847db474 100644 --- a/includes/Defines.php +++ b/includes/Defines.php @@ -197,8 +197,8 @@ define( 'EDIT_AUTOSUMMARY', 64 ); define( 'LIST_COMMA', 0 ); define( 'LIST_AND', 1 ); define( 'LIST_SET', 2 ); -define( 'LIST_NAMES', 3); -define( 'LIST_OR', 4); +define( 'LIST_NAMES', 3 ); +define( 'LIST_OR', 4 ); /**@}*/ /** diff --git a/includes/Exception.php b/includes/Exception.php index 0bd7a2a733..7d9f63d9d1 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -75,11 +75,11 @@ class MWException extends Exception { return null; // Just silently ignore } - if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[ $name ] ) ) { + if ( !array_key_exists( $name, $wgExceptionHooks ) || !is_array( $wgExceptionHooks[$name] ) ) { return null; } - $hooks = $wgExceptionHooks[ $name ]; + $hooks = $wgExceptionHooks[$name]; $callargs = array_merge( array( $this ), $args ); foreach ( $hooks as $hook ) { @@ -130,8 +130,7 @@ class MWException extends Exception { '

Backtrace:

' . nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . "

\n"; } else { - return - "
" . + return "
" . '[' . $this->getLogId() . '] ' . gmdate( 'Y-m-d H:i:s' ) . ": Fatal exception of type " . get_class( $this ) . "
\n" . diff --git a/includes/Export.php b/includes/Export.php index d8cc024224..8df7dcb39c 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -563,8 +563,9 @@ class XmlDumpWriter { foreach ( $wgContLang->getFormattedNamespaces() as $ns => $title ) { $spaces .= ' ' . Xml::element( 'namespace', - array( 'key' => $ns, - 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive', + array( + 'key' => $ns, + 'case' => MWNamespace::isCapitalized( $ns ) ? 'first-letter' : 'case-sensitive', ), $title ) . "\n"; } $spaces .= " "; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e1e12344a9..0b291ecbb5 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3338,7 +3338,7 @@ function wfCheckEntropy() { */ function wfFixSessionID() { // If the cookie or session id is already set we already have a session and should abort - if ( isset( $_COOKIE[ session_name() ] ) || session_id() ) { + if ( isset( $_COOKIE[session_name()] ) || session_id() ) { return; } diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 686397390f..4a527bbe29 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -256,7 +256,7 @@ class HTMLForm extends ContextSource { */ public function setDisplayFormat( $format ) { if ( !in_array( $format, $this->availableDisplayFormats ) ) { - throw new MWException ( 'Display format must be one of ' . print_r( $this->availableDisplayFormats, true ) ); + throw new MWException( 'Display format must be one of ' . print_r( $this->availableDisplayFormats, true ) ); } $this->displayFormat = $format; return $this; diff --git a/includes/Hooks.php b/includes/Hooks.php index 8cc7acea46..e3ffb19f85 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -190,7 +190,7 @@ class Hooks { } } elseif ( is_string( $hook[0] ) ) { $func = $hook[0]; - if ( count( $hook ) > 1) { + if ( count( $hook ) > 1 ) { $data = $hook[1]; $have_data = true; } diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 9e280dbba8..4730a973fe 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -563,8 +563,8 @@ class MWHttpRequest { $this->parseHeader(); } - if ( isset( $this->respHeaders[strtolower ( $header ) ] ) ) { - $v = $this->respHeaders[strtolower ( $header ) ]; + if ( isset( $this->respHeaders[strtolower( $header )] ) ) { + $v = $this->respHeaders[strtolower( $header )]; return $v[count( $v ) - 1]; } @@ -646,17 +646,17 @@ class MWHttpRequest { $headers = $this->getResponseHeaders(); //return full url (fix for incorrect but handled relative location) - if ( isset( $headers[ 'location' ] ) ) { - $locations = $headers[ 'location' ]; + if ( isset( $headers['location'] ) ) { + $locations = $headers['location']; $domain = ''; $foundRelativeURI = false; $countLocations = count( $locations ); for ( $i = $countLocations - 1; $i >= 0; $i-- ) { - $url = parse_url( $locations[ $i ] ); + $url = parse_url( $locations[$i] ); if ( isset( $url['host'] ) ) { - $domain = $url[ 'scheme' ] . '://' . $url[ 'host' ]; + $domain = $url['scheme'] . '://' . $url['host']; break; //found correct URI (with host) } else { $foundRelativeURI = true; @@ -665,15 +665,15 @@ class MWHttpRequest { if ( $foundRelativeURI ) { if ( $domain ) { - return $domain . $locations[ $countLocations - 1 ]; + return $domain . $locations[$countLocations - 1]; } else { $url = parse_url( $this->url ); - if ( isset($url[ 'host' ]) ) { - return $url[ 'scheme' ] . '://' . $url[ 'host' ] . $locations[ $countLocations - 1 ]; + if ( isset( $url['host'] ) ) { + return $url['scheme'] . '://' . $url['host'] . $locations[$countLocations - 1]; } } } else { - return $locations[ $countLocations - 1 ]; + return $locations[$countLocations - 1]; } } @@ -938,8 +938,7 @@ class PhpHttpRequest extends MWHttpRequest { // If everything went OK, or we received some error code // get the response body content. - if ( $this->status->isOK() - || (int)$this->respStatus >= 300) { + if ( $this->status->isOK() || (int)$this->respStatus >= 300 ) { while ( !feof( $fh ) ) { $buf = fread( $fh, 8192 ); diff --git a/includes/ImagePage.php b/includes/ImagePage.php index b3a485aac1..aba9ab5613 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -719,7 +719,7 @@ EOT $limit = 100; $out = $this->getContext()->getOutput(); - $res = $this->queryImageLinks( $this->getTitle()->getDbKey(), $limit + 1); + $res = $this->queryImageLinks( $this->getTitle()->getDbKey(), $limit + 1 ); $rows = array(); $redirects = array(); foreach ( $res as $row ) { diff --git a/includes/Import.php b/includes/Import.php index fee636f54d..f33704392c 100644 --- a/includes/Import.php +++ b/includes/Import.php @@ -47,7 +47,7 @@ class WikiImporter { stream_wrapper_register( 'uploadsource', 'UploadSourceAdapter' ); $id = UploadSourceAdapter::registerSource( $source ); - if (defined( 'LIBXML_PARSEHUGE' ) ) { + if ( defined( 'LIBXML_PARSEHUGE' ) ) { $this->reader->open( "uploadsource://$id", null, LIBXML_PARSEHUGE ); } else { $this->reader->open( "uploadsource://$id" ); diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index d99ae22d47..f79b423054 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -847,7 +847,7 @@ class LinksDeletionUpdate extends SqlDataUpdate { $res = $this->mDb->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__ ); foreach ( $res as $row ) { - $cats [] = $row->cl_to; + $cats[] = $row->cl_to; } $this->mPage->updateCategoryCounts( array(), $cats ); diff --git a/includes/MWFunction.php b/includes/MWFunction.php index 36fcc30bc5..240a6d38a8 100644 --- a/includes/MWFunction.php +++ b/includes/MWFunction.php @@ -32,7 +32,7 @@ class MWFunction { if ( strpos( $callback, '::' ) !== false ) { // PHP 5.1 cannot use call_user_func( 'Class::Method' ) // It can only handle only call_user_func( array( 'Class', 'Method' ) ) - $callback = explode( '::', $callback, 2); + $callback = explode( '::', $callback, 2 ); } } diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index edabd54c20..759253098b 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -432,7 +432,7 @@ class MimeMagic { $ext = explode( ' ', $ext ); $extension = strtolower( $extension ); - return in_array( $extension, $ext ); + return in_array( $extension, $ext ); } /** @@ -689,11 +689,11 @@ class MimeMagic { $script_type = null; # detect by shebang - if ( substr( $head, 0, 2) == "#!" ) { + if ( substr( $head, 0, 2 ) == "#!" ) { $script_type = "ASCII"; - } elseif ( substr( $head, 0, 5) == "\xef\xbb\xbf#!" ) { + } elseif ( substr( $head, 0, 5 ) == "\xef\xbb\xbf#!" ) { $script_type = "UTF-8"; - } elseif ( substr( $head, 0, 7) == "\xfe\xff\x00#\x00!" ) { + } elseif ( substr( $head, 0, 7 ) == "\xfe\xff\x00#\x00!" ) { $script_type = "UTF-16BE"; } elseif ( substr( $head, 0, 7 ) == "\xff\xfe#\x00!" ) { $script_type = "UTF-16LE"; @@ -804,7 +804,7 @@ class MimeMagic { * These mime's are stored in the database, where we don't really want * x-opc+zip, because we use it only for internal purposes */ - if ( $this->isMatchingExtension( $ext, $mime) ) { + if ( $this->isMatchingExtension( $ext, $mime ) ) { /* A known file extension for an OPC file, * find the proper mime type for that file extension */ @@ -817,10 +817,10 @@ class MimeMagic { } 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 ) ) ) { - if ( substr( $header, 512, 4) == "\xEC\xA5\xC1\x00" ) { + if ( substr( $header, 512, 4 ) == "\xEC\xA5\xC1\x00" ) { $mime = "application/msword"; } - switch( substr( $header, 512, 6) ) { + switch( substr( $header, 512, 6 ) ) { case "\xEC\xA5\xC1\x00\x0E\x00": case "\xEC\xA5\xC1\x00\x1C\x00": case "\xEC\xA5\xC1\x00\x43\x00": diff --git a/includes/Namespace.php b/includes/Namespace.php index fccfbedb4e..8001b415ae 100644 --- a/includes/Namespace.php +++ b/includes/Namespace.php @@ -387,9 +387,9 @@ class MWNamespace { if ( in_array( $index, self::$alwaysCapitalizedNamespaces ) ) { return true; } - if ( isset( $wgCapitalLinkOverrides[ $index ] ) ) { + if ( isset( $wgCapitalLinkOverrides[$index] ) ) { // $wgCapitalLinkOverrides is explicitly set - return $wgCapitalLinkOverrides[ $index ]; + return $wgCapitalLinkOverrides[$index]; } // Default to the global setting return $wgCapitalLinks; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1e0c396a27..905b005521 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -1401,7 +1401,7 @@ class OutputPage extends ContextSource { * @param $timestamp Mixed: string, or null * @return Mixed: previous value */ - public function setRevisionTimestamp( $timestamp) { + public function setRevisionTimestamp( $timestamp ) { return wfSetVar( $this->mRevisionTimestamp, $timestamp ); } diff --git a/includes/Revision.php b/includes/Revision.php index 2b34984b09..18cd94e5af 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1340,8 +1340,8 @@ class Revision implements IDBAccessObject { $defaultModel = ContentHandler::getDefaultModelFor( $title ); $defaultFormat = ContentHandler::getForModelID( $defaultModel )->getDefaultFormat(); - $row[ 'rev_content_model' ] = ( $model === $defaultModel ) ? null : $model; - $row[ 'rev_content_format' ] = ( $format === $defaultFormat ) ? null : $format; + $row['rev_content_model'] = ( $model === $defaultModel ) ? null : $model; + $row['rev_content_format'] = ( $format === $defaultFormat ) ? null : $format; } $dbw->insert( 'revision', $row, __METHOD__ ); @@ -1517,8 +1517,8 @@ class Revision implements IDBAccessObject { ); if ( $wgContentHandlerUseDB ) { - $row[ 'content_model' ] = $current->rev_content_model; - $row[ 'content_format' ] = $current->rev_content_format; + $row['content_model'] = $current->rev_content_model; + $row['content_format'] = $current->rev_content_format; } $revision = new Revision( $row ); diff --git a/includes/RevisionList.php b/includes/RevisionList.php index d87c540fb3..666df96d0d 100644 --- a/includes/RevisionList.php +++ b/includes/RevisionList.php @@ -352,8 +352,7 @@ class RevisionItem extends RevisionItemBase { if ( $this->isDeleted() && !$this->canViewContent() ) { return $this->context->msg( 'diff' )->escaped(); } else { - return - Linker::link( + return Linker::link( $this->list->title, $this->context->msg( 'diff' )->escaped(), array(), diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 2dff081d04..3acb7409c0 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -507,7 +507,7 @@ class Sanitizer { !in_array( 'table', $tagstack ) ) { $badtag = true; } elseif ( in_array( $t, $tagstack ) && - !isset( $htmlnest [$t ] ) ) { + !isset( $htmlnest[$t] ) ) { $badtag = true; # Is it a self closed htmlpair ? (bug 5487) } elseif ( $brace == '/>' && @@ -555,12 +555,14 @@ class Sanitizer { continue; } } - $text .= '<' . str_replace( '>', '>', $x); + $text .= '<' . str_replace( '>', '>', $x ); } # Close off any remaining tags - while ( is_array( $tagstack ) && ($t = array_pop( $tagstack )) ) { + while ( is_array( $tagstack ) && ( $t = array_pop( $tagstack ) ) ) { $text .= "\n"; - if ( $t == 'table' ) { $tagstack = array_pop( $tablestack ); } + if ( $t == 'table' ) { + $tagstack = array_pop( $tablestack ); + } } } else { # this might be possible using tidy itself @@ -585,7 +587,7 @@ class Sanitizer { continue; } } - $text .= '<' . str_replace( '>', '>', $x); + $text .= '<' . str_replace( '>', '>', $x ); } } wfProfileOut( __METHOD__ ); @@ -723,7 +725,7 @@ class Sanitizer { } # Allow any attribute beginning with "data-", if in HTML5 mode - if ( !($wgHtml5 && preg_match( '/^data-/i', $attribute )) && !isset( $whitelist[$attribute] ) ) { + if ( !( $wgHtml5 && preg_match( '/^data-/i', $attribute ) ) && !isset( $whitelist[$attribute] ) ) { continue; } @@ -1357,9 +1359,9 @@ class Sanitizer { if( $matches[1] != '' ) { return Sanitizer::decodeEntity( $matches[1] ); } elseif( $matches[2] != '' ) { - return Sanitizer::decodeChar( intval( $matches[2] ) ); + return Sanitizer::decodeChar( intval( $matches[2] ) ); } elseif( $matches[3] != '' ) { - return Sanitizer::decodeChar( hexdec( $matches[3] ) ); + return Sanitizer::decodeChar( hexdec( $matches[3] ) ); } # Last case should be an ampersand by itself return $matches[0]; @@ -1443,30 +1445,31 @@ class Sanitizer { if ( $wgAllowRdfaAttributes ) { #RDFa attributes as specified in section 9 of http://www.w3.org/TR/2008/REC-rdfa-syntax-20081014 $common = array_merge( $common, array( - 'about', 'property', 'resource', 'datatype', 'typeof', + 'about', 'property', 'resource', 'datatype', 'typeof', ) ); } if ( $wgHtml5 && $wgAllowMicrodataAttributes ) { # add HTML5 microdata tags as specified by http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#the-microdata-model $common = array_merge( $common, array( - 'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype' + 'itemid', 'itemprop', 'itemref', 'itemscope', 'itemtype' ) ); } $block = array_merge( $common, array( 'align' ) ); $tablealign = array( 'align', 'char', 'charoff', 'valign' ); - $tablecell = array( 'abbr', - 'axis', - 'headers', - 'scope', - 'rowspan', - 'colspan', - 'nowrap', # deprecated - 'width', # deprecated - 'height', # deprecated - 'bgcolor' # deprecated - ); + $tablecell = array( + 'abbr', + 'axis', + 'headers', + 'scope', + 'rowspan', + 'colspan', + 'nowrap', # deprecated + 'width', # deprecated + 'height', # deprecated + 'bgcolor', # deprecated + ); # Numbers refer to sections in HTML 4.01 standard describing the element. # See: http://www.w3.org/TR/html4/ diff --git a/includes/SeleniumWebSettings.php b/includes/SeleniumWebSettings.php index 7715484eb5..26c2df54a4 100644 --- a/includes/SeleniumWebSettings.php +++ b/includes/SeleniumWebSettings.php @@ -67,7 +67,7 @@ if ( isset( $_GET['setupTestSuite'] ) ) { $testGlobalConfigs = array(); // an array containing all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test $callback = $wgSeleniumTestConfigs[$setupTestSuiteName]; - call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles)); + call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles ) ); if ( isset( $testResourceFiles['images'] ) ) { $testImageZip = $testResourceFiles['images']; @@ -112,7 +112,7 @@ if ( isset( $_COOKIE[$cookieName] ) ) { $testGlobalConfigs = array(); // an array containing all the global configs needed for this test $testResourceFiles = array(); // an array containing all the resource files needed for this test $callback = $wgSeleniumTestConfigs[$testSuiteName]; - call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles)); + call_user_func_array( $callback, array( &$testIncludes, &$testGlobalConfigs, &$testResourceFiles ) ); if ( isset( $testResourceFiles['db'] ) ) { $testResourceName = getTestResourceNameFromTestSuiteName( $testSuiteName ); diff --git a/includes/Setup.php b/includes/Setup.php index e87b200f54..a602b79423 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -426,7 +426,7 @@ wfMemoryLimit(); * that happens whenever you use a date function without the timezone being * explicitly set. Inspired by phpMyAdmin's treatment of the problem. */ -if ( is_null( $wgLocaltimezone) ) { +if ( is_null( $wgLocaltimezone ) ) { wfSuppressWarnings(); $wgLocaltimezone = date_default_timezone_get(); wfRestoreWarnings(); diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index bbc14a12d2..2d250dfbea 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -228,7 +228,7 @@ class SiteConfiguration { $retval = $thisSetting[$suffix]; } break; - } elseif ( array_key_exists( "+$suffix", $thisSetting ) && is_array($thisSetting["+$suffix"]) ) { + } elseif ( array_key_exists( "+$suffix", $thisSetting ) && is_array( $thisSetting["+$suffix"] ) ) { if ( !isset( $retval ) ) { $retval = array(); } diff --git a/includes/Skin.php b/includes/Skin.php index 0cc1086c7a..a34afb68c5 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1252,7 +1252,7 @@ abstract class Skin extends ContextSource { } global $wgExternalLinkTarget; - if ( $wgExternalLinkTarget) { + if ( $wgExternalLinkTarget ) { $extraAttribs['target'] = $wgExternalLinkTarget; } } else { diff --git a/includes/Timestamp.php b/includes/Timestamp.php index 1cf99a7913..7dbfabff94 100644 --- a/includes/Timestamp.php +++ b/includes/Timestamp.php @@ -141,7 +141,7 @@ class MWTimestamp { try { $final = new DateTime( $strtime, new DateTimeZone( 'GMT' ) ); - } catch(Exception $e) { + } catch( Exception $e ) { throw new TimestampException( __METHOD__ . ' Invalid timestamp format.' ); } diff --git a/includes/Title.php b/includes/Title.php index 974ea9120f..80be529611 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -993,7 +993,7 @@ class Title { */ public function getSkinFromCssJsSubpage() { $subpage = explode( '/', $this->mTextform ); - $subpage = $subpage[ count( $subpage ) - 1 ]; + $subpage = $subpage[count( $subpage ) - 1]; $lastdot = strrpos( $subpage, '.' ); if ( $lastdot === false ) return $subpage; # Never happens: only called for names ending in '.css' or '.js' diff --git a/includes/User.php b/includes/User.php index 6b7348a8fb..0e63704cd9 100644 --- a/includes/User.php +++ b/includes/User.php @@ -710,7 +710,7 @@ class User { return 'passwordtooshort'; } elseif ( $wgContLang->lc( $password ) == $wgContLang->lc( $this->mName ) ) { return 'password-name-match'; - } elseif ( isset( $blockedLogins[ $this->getName() ] ) && $password == $blockedLogins[ $this->getName() ] ) { + } elseif ( isset( $blockedLogins[$this->getName()] ) && $password == $blockedLogins[$this->getName()] ) { return 'password-login-forbidden'; } else { //it seems weird returning true here, but this is because of the @@ -1521,7 +1521,7 @@ class User { // Set the user limit key if ( $userLimit !== false ) { wfDebug( __METHOD__ . ": effective user limit: $userLimit\n" ); - $keys[ wfMemcKey( 'limiter', $action, 'user', $id ) ] = $userLimit; + $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $userLimit; } $triggered = false; @@ -4018,7 +4018,7 @@ class User { } // Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility - if( empty( $wgGroupsAddToSelf['user']) || $wgGroupsAddToSelf['user'] !== true ) { + if( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) { foreach( $wgGroupsAddToSelf as $key => $value ) { if( is_int( $key ) ) { $wgGroupsAddToSelf['user'][] = $value; @@ -4026,7 +4026,7 @@ class User { } } - if( empty( $wgGroupsRemoveFromSelf['user']) || $wgGroupsRemoveFromSelf['user'] !== true ) { + if( empty( $wgGroupsRemoveFromSelf['user'] ) || $wgGroupsRemoveFromSelf['user'] !== true ) { foreach( $wgGroupsRemoveFromSelf as $key => $value ) { if( is_int( $key ) ) { $wgGroupsRemoveFromSelf['user'][] = $value; diff --git a/includes/UserArray.php b/includes/UserArray.php index 3b8f5c1077..1f55ef3552 100644 --- a/includes/UserArray.php +++ b/includes/UserArray.php @@ -44,7 +44,7 @@ abstract class UserArray implements Iterator { $ids = array_map( 'intval', (array)$ids ); // paranoia if ( !$ids ) { // Database::select() doesn't like empty arrays - return new ArrayIterator(array()); + return new ArrayIterator( array() ); } $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->select( 'user', '*', array( 'user_id' => $ids ), diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 98007ef8e1..15da246c96 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -224,7 +224,7 @@ class WebRequest { } $matches = self::getPathInfo( 'title' ); - foreach( $matches as $key => $val) { + foreach( $matches as $key => $val ) { $this->data[$key] = $_GET[$key] = $_REQUEST[$key] = $val; } } @@ -603,7 +603,7 @@ class WebRequest { * @return Boolean */ public function checkSessionCookie() { - return isset( $_COOKIE[ session_name() ] ); + return isset( $_COOKIE[session_name()] ); } /** @@ -844,7 +844,7 @@ class WebRequest { if ( function_exists( 'apache_request_headers' ) ) { foreach ( apache_request_headers() as $tempName => $tempValue ) { - $this->headers[ strtoupper( $tempName ) ] = $tempValue; + $this->headers[strtoupper( $tempName )] = $tempValue; } } else { foreach ( $_SERVER as $name => $value ) { @@ -1103,7 +1103,7 @@ HTML; $curIP = IP::canonicalize( $curIP ); if ( wfIsTrustedProxy( $curIP ) ) { if ( isset( $ipchain[$i + 1] ) ) { - if ( $wgUsePrivateIPs || IP::isPublic( $ipchain[$i + 1 ] ) ) { + if ( $wgUsePrivateIPs || IP::isPublic( $ipchain[$i + 1] ) ) { $ip = $ipchain[$i + 1]; } } diff --git a/includes/WikiMap.php b/includes/WikiMap.php index b04a784229..4697b12789 100644 --- a/includes/WikiMap.php +++ b/includes/WikiMap.php @@ -218,8 +218,7 @@ class WikiReference { * @return String: URL */ public function getFullUrl( $page ) { - return - $this->mServer . + return $this->mServer . $this->getLocalUrl( $page ); } } diff --git a/includes/WikiPage.php b/includes/WikiPage.php index 8d9d7407c8..f4d2e238a5 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1274,7 +1274,7 @@ class WikiPage implements Page, IDBAccessObject { ); if ( $wgContentHandlerUseDB ) { - $row[ 'page_content_model' ] = $revision->getContentModel(); + $row['page_content_model'] = $revision->getContentModel(); } $dbw->update( 'page', @@ -2591,8 +2591,8 @@ class WikiPage implements Page, IDBAccessObject { ); if ( $wgContentHandlerUseDB ) { - $row[ 'ar_content_model' ] = 'rev_content_model'; - $row[ 'ar_content_format' ] = 'rev_content_format'; + $row['ar_content_model'] = 'rev_content_model'; + $row['ar_content_format'] = 'rev_content_format'; } $dbw->insertSelect( 'archive', array( 'page', 'revision' ), diff --git a/includes/Xml.php b/includes/Xml.php index ee19dee906..8697962627 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -493,17 +493,17 @@ class Xml { $options = self::option( $other, 'other', $selected === 'other' ); - foreach ( explode( "\n", $list ) as $option) { + foreach ( explode( "\n", $list ) as $option ) { $value = trim( $option ); if ( $value == '' ) { continue; - } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) { + } 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' ); $options .= self::openElement( 'optgroup', array( 'label' => $value ) ); $optgroup = true; - } elseif ( substr( $value, 0, 2) == '**' ) { + } elseif ( substr( $value, 0, 2 ) == '**' ) { // groupmember $value = trim( substr( $value, 2 ) ); $options .= self::option( $value, $value, $selected === $value ); diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index d2d50ae2f9..741e908351 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1535,7 +1535,7 @@ abstract class ApiBase extends ContextSource { public function getWatchlistUser( $params ) { if ( !is_null( $params['owner'] ) && !is_null( $params['token'] ) ) { $user = User::newFromName( $params['owner'], false ); - if ( !($user && $user->getId()) ) { + if ( !( $user && $user->getId() ) ) { $this->dieUsage( 'Specified user does not exist', 'bad_wlowner' ); } $token = $user->getOption( 'watchlisttoken' ); diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index b2d7582530..e261f38a07 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -56,7 +56,7 @@ class ApiImageRotate extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - $rotation = $params[ 'rotation' ]; + $rotation = $params['rotation']; $user = $this->getUser(); $pageSet = $this->getPageSet(); @@ -111,12 +111,12 @@ class ApiImageRotate extends ApiBase { continue; } $ext = strtolower( pathinfo( "$srcPath", PATHINFO_EXTENSION ) ); - $tmpFile = TempFSFile::factory( 'rotate_', $ext); + $tmpFile = TempFSFile::factory( 'rotate_', $ext ); $dstPath = $tmpFile->getPath(); $err = $handler->rotate( $file, array( "srcPath" => $srcPath, "dstPath" => $dstPath, - "rotation"=> $rotation + "rotation" => $rotation ) ); if ( !$err ) { $comment = wfMessage( 'rotate-comment' )->numParams( $rotation )->text(); @@ -157,8 +157,8 @@ class ApiImageRotate extends ApiBase { */ protected function checkPermissions( $user, $title ) { $permissionErrors = array_merge( - $title->getUserPermissionsErrors( 'edit' , $user ), - $title->getUserPermissionsErrors( 'upload' , $user ) + $title->getUserPermissionsErrors( 'edit', $user ), + $title->getUserPermissionsErrors( 'upload', $user ) ); if ( $permissionErrors ) { diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 80bca2f6ac..a6813e324f 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -83,7 +83,7 @@ class ApiMain extends ApiBase { 'import' => 'ApiImport', 'userrights' => 'ApiUserrights', 'options' => 'ApiOptions', - 'imagerotate' =>'ApiImageRotate', + 'imagerotate' => 'ApiImageRotate', ); /** @@ -418,7 +418,7 @@ class ApiMain extends ApiBase { } // Log the request whether or not there was an error - $this->logRequest( microtime( true ) - $t); + $this->logRequest( microtime( true ) - $t ); // Send cache headers after any code which might generate an error, to // avoid sending public cache headers for errors. diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 074efe4b62..c76e22b935 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -595,7 +595,7 @@ class ApiPageSet extends ApiBase { } foreach ( $this->mRequestedPageFields as $fieldName => &$fieldValues ) { - $fieldValues[$pageId] = $row-> $fieldName; + $fieldValues[$pageId] = $row->$fieldName; } } diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index 496a0eb8d4..952c2dcb65 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -76,7 +76,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { if ( $dir == 'newer' ) { $this->addWhereRange( 'cat_pages', 'newer', $min, $max ); } else { - $this->addWhereRange( 'cat_pages', 'older', $max, $min); + $this->addWhereRange( 'cat_pages', 'older', $max, $min ); } if ( isset( $params['prefix'] ) ) { diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index 3ef6b84075..689980844b 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -294,9 +294,9 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { // We've reached the one extra which shows that there are additional pages to be had. Stop here... // We need to keep the parent page of this redir in if ( $this->hasNS ) { - $parentID = $this->pageMap[$row-> { $this->bl_ns } ][$row-> { $this->bl_title } ]; + $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}]; } else { - $parentID = $this->pageMap[NS_FILE][$row-> { $this->bl_title } ]; + $parentID = $this->pageMap[NS_FILE][$row->{$this->bl_title}]; } $this->continueStr = $this->getContinueRedirStr( $parentID, $row->page_id ); break; @@ -377,8 +377,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { if ( $row->page_is_redirect ) { $a['redirect'] = ''; } - $ns = $this->hasNS ? $row-> { $this->bl_ns } : NS_FILE; - $parentID = $this->pageMap[$ns][$row-> { $this->bl_title } ]; + $ns = $this->hasNS ? $row->{$this->bl_ns} : NS_FILE; + $parentID = $this->pageMap[$ns][$row->{$this->bl_title}]; // Put all the results in an array first $this->resultArr[$parentID]['redirlinks'][] = $a; $this->getResult()->setIndexedTagName( $this->resultArr[$parentID]['redirlinks'], $this->bl_code ); diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index d9be9f28b0..ba904525ab 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -63,7 +63,7 @@ class ApiQueryBlocks extends ApiQueryBase { $this->addTables( 'ipblocks' ); $this->addFields( 'ipb_auto' ); - $this->addFieldsIf ( 'ipb_id', $fld_id ); + $this->addFieldsIf( 'ipb_id', $fld_id ); $this->addFieldsIf( array( 'ipb_address', 'ipb_user' ), $fld_user || $fld_userid ); $this->addFieldsIf( 'ipb_by_text', $fld_by ); $this->addFieldsIf( 'ipb_by', $fld_byid ); diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 810e1d6b8e..1488b2d1da 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -675,7 +675,7 @@ class ApiQuerySiteinfo extends ApiQueryBase { ' variables - Returns a list of variable IDs', ' protocols - Returns a list of protocols that are allowed in external links.', ), - 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', + 'filteriw' => 'Return only local or only nonlocal entries of the interwiki map', 'showalldb' => 'List all database servers, not just the one lagging the most', 'numberingroup' => 'Lists the number of users in user groups', 'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)', diff --git a/includes/cache/SquidUpdate.php b/includes/cache/SquidUpdate.php index 39bf4c9f50..69f0bf7e4c 100644 --- a/includes/cache/SquidUpdate.php +++ b/includes/cache/SquidUpdate.php @@ -219,7 +219,7 @@ class SquidUpdate { // implementation exists, so adapt to Squid $htcpPacket = pack( 'nxxnCxNxxa*n', $htcpLen, $htcpDataLen, $htcpOpCLR, - $htcpTransID, $htcpSpecifier, 2); + $htcpTransID, $htcpSpecifier, 2 ); // Send out wfDebug( "Purging URL $url via HTCP\n" ); diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 9c201955b3..9c5ebcdad6 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -1086,8 +1086,8 @@ abstract class ContentHandler { $contentObjects[$k] = $v; $v = $v->serialize(); - $contentTexts[ $k ] = $v; - $args[ $k ] = $v; + $contentTexts[$k] = $v; + $args[$k] = $v; } } @@ -1098,7 +1098,7 @@ abstract class ContentHandler { foreach ( $contentTexts as $k => $orig ) { /* @var Content $content */ - $modified = $args[ $k ]; + $modified = $args[$k]; $content = $contentObjects[$k]; if ( $modified !== $orig ) { @@ -1106,7 +1106,7 @@ abstract class ContentHandler { $content = $content->getContentHandler()->unserializeContent( $modified ); } - $args[ $k ] = $content; + $args[$k] = $content; } return $ok; diff --git a/includes/db/Database.php b/includes/db/Database.php index 5ad196db7d..d0b877fddc 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1582,19 +1582,19 @@ abstract class DatabaseBase implements DatabaseType { static function generalizeSQL( $sql ) { # This does the same as the regexp below would do, but in such a way # as to avoid crashing php on some large strings. - # $sql = preg_replace ( "/'([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\"/", "'X'", $sql); + # $sql = preg_replace( "/'([^\\\\']|\\\\.)*'|\"([^\\\\\"]|\\\\.)*\"/", "'X'", $sql ); - $sql = str_replace ( "\\\\", '', $sql ); - $sql = str_replace ( "\\'", '', $sql ); - $sql = str_replace ( "\\\"", '', $sql ); - $sql = preg_replace ( "/'.*'/s", "'X'", $sql ); - $sql = preg_replace ( '/".*"/s', "'X'", $sql ); + $sql = str_replace( "\\\\", '', $sql ); + $sql = str_replace( "\\'", '', $sql ); + $sql = str_replace( "\\\"", '', $sql ); + $sql = preg_replace( "/'.*'/s", "'X'", $sql ); + $sql = preg_replace( '/".*"/s', "'X'", $sql ); # All newlines, tabs, etc replaced by single space - $sql = preg_replace ( '/\s+/', ' ', $sql ); + $sql = preg_replace( '/\s+/', ' ', $sql ); # All numbers => N - $sql = preg_replace ( '/-?[0-9]+/s', 'N', $sql ); + $sql = preg_replace( '/-?[0-9]+/s', 'N', $sql ); return $sql; } diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index 575f629df0..dde3af51e3 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -148,7 +148,7 @@ class DatabaseMssql extends DatabaseBase { } // MSSQL doesn't have EXTRACT(epoch FROM XXX) - if ( preg_match('#\bEXTRACT\s*?\(\s*?EPOCH\s+FROM\b#i', $sql, $matches ) ) { + if ( preg_match( '#\bEXTRACT\s*?\(\s*?EPOCH\s+FROM\b#i', $sql, $matches ) ) { // This is same as UNIX_TIMESTAMP, we need to calc # of seconds from 1970 $sql = str_replace( $matches[0], "DATEDIFF(s,CONVERT(datetime,'1/1/1970'),", $sql ); } @@ -202,9 +202,9 @@ class DatabaseMssql extends DatabaseBase { $retErrors = sqlsrv_errors( SQLSRV_ERR_ALL ); if ( $retErrors != null ) { foreach ( $retErrors as $arrError ) { - $strRet .= "SQLState: " . $arrError[ 'SQLSTATE'] . "\n"; - $strRet .= "Error Code: " . $arrError[ 'code'] . "\n"; - $strRet .= "Message: " . $arrError[ 'message'] . "\n"; + $strRet .= "SQLState: " . $arrError['SQLSTATE'] . "\n"; + $strRet .= "Error Code: " . $arrError['code'] . "\n"; + $strRet .= "Message: " . $arrError['message'] . "\n"; } } else { $strRet = "No errors found"; @@ -429,9 +429,9 @@ class DatabaseMssql extends DatabaseBase { // if we have an identity column if( $identity ) { // iterate through - foreach ($a as $k => $v ) { + foreach ( $a as $k => $v ) { if ( $k == $identity ) { - if( !is_null($v) ) { + if( !is_null( $v ) ) { // there is a value being passed to us, we need to turn on and off inserted identity $sqlPre = "SET IDENTITY_INSERT $table ON;"; $sqlPost = ";SET IDENTITY_INSERT $table OFF;"; @@ -501,7 +501,7 @@ class DatabaseMssql extends DatabaseBase { } elseif ( $ret != null ) { // remember number of rows affected $this->mAffectedRows = sqlsrv_rows_affected( $ret ); - if ( !is_null($identity) ) { + if ( !is_null( $identity ) ) { // then we want to get the identity column value we were assigned and save it off $row = sqlsrv_fetch_object( $ret ); $this->mInsertId = $row->$identity; diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 7db032fdbd..e59ca957a2 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -206,7 +206,7 @@ class DatabaseOracle extends DatabaseBase { } function __destruct() { - if ($this->mOpened) { + if ( $this->mOpened ) { wfSuppressWarnings(); $this->close(); wfRestoreWarnings(); @@ -791,7 +791,7 @@ class DatabaseOracle extends DatabaseBase { $endArray[] = strtoupper( $prefix . 'PAGE' ); $endArray[] = strtoupper( $prefix . 'IMAGE' ); $fixedOrderTabs = $endArray; - while ( ($row = $result->fetchRow()) !== false ) { + while ( ( $row = $result->fetchRow() ) !== false ) { if ( !in_array( $row['table_name'], $fixedOrderTabs ) ) $endArray[] = $row['table_name']; } @@ -1125,12 +1125,12 @@ class DatabaseOracle extends DatabaseBase { $conds2 = array(); foreach ( $conds as $col => $val ) { if ( is_array( $val ) ) { - $conds2[$col] = $this->wrapConditionsForWhere ( $table, $val, $col ); + $conds2[$col] = $this->wrapConditionsForWhere( $table, $val, $col ); } else { if ( is_numeric( $col ) && $parentCol != null ) { - $this->wrapFieldForWhere ( $table, $parentCol, $val ); + $this->wrapFieldForWhere( $table, $parentCol, $val ); } else { - $this->wrapFieldForWhere ( $table, $col, $val ); + $this->wrapFieldForWhere( $table, $col, $val ); } $conds2[$col] = $val; } diff --git a/includes/db/LBFactory.php b/includes/db/LBFactory.php index d469e867cf..85e7775dbd 100644 --- a/includes/db/LBFactory.php +++ b/includes/db/LBFactory.php @@ -201,7 +201,7 @@ class LBFactory_Simple extends LBFactory { $flags |= DBO_COMPRESS; } - $servers = array(array( + $servers = array( array( 'host' => $wgDBserver, 'user' => $wgDBuser, 'password' => $wgDBpassword, diff --git a/includes/diff/DairikiDiff.php b/includes/diff/DairikiDiff.php index 1a26d0cd01..f9cb6560af 100644 --- a/includes/diff/DairikiDiff.php +++ b/includes/diff/DairikiDiff.php @@ -508,7 +508,7 @@ class _DiffEngine { reset( $seps ); $pt1 = $seps[0]; while ( $pt2 = next( $seps ) ) { - $this->_compareseq ( $pt1[0], $pt2[0], $pt1[1], $pt2[1] ); + $this->_compareseq( $pt1[0], $pt2[0], $pt1[1], $pt2[1] ); $pt1 = $pt2; } } diff --git a/includes/filebackend/FileBackendMultiWrite.php b/includes/filebackend/FileBackendMultiWrite.php index 939315d178..17b060c371 100644 --- a/includes/filebackend/FileBackendMultiWrite.php +++ b/includes/filebackend/FileBackendMultiWrite.php @@ -457,7 +457,7 @@ class FileBackendMultiWrite extends FileBackend { * @return bool Path container should have dir changes pushed to all backends */ protected function replicateContainerDirChanges( $path ) { - list( , $shortCont, ) = self::splitStoragePath( $path ); + list( , $shortCont, ) = self::splitStoragePath( $path ); return !in_array( $shortCont, $this->noPushDirConts ); } diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index cecd0aee43..5eff954f9d 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -518,7 +518,7 @@ abstract class File { * @param $version integer version number. * @return Array containing metadata, or what was passed to it on fail (unserializing if not array) */ - public function convertMetadataVersion($metadata, $version) { + public function convertMetadataVersion( $metadata, $version ) { $handler = $this->getHandler(); if ( !is_array( $metadata ) ) { // Just to make the return type consistent @@ -681,7 +681,7 @@ abstract class File { if ( $mime === "unknown/unknown" ) { return false; #unknown type, not trusted } - if ( in_array( $mime, $wgTrustedMediaFormats) ) { + if ( in_array( $mime, $wgTrustedMediaFormats ) ) { return true; } diff --git a/includes/filerepo/file/ForeignAPIFile.php b/includes/filerepo/file/ForeignAPIFile.php index a96c1f3fab..4cc63080d7 100644 --- a/includes/filerepo/file/ForeignAPIFile.php +++ b/includes/filerepo/file/ForeignAPIFile.php @@ -67,7 +67,7 @@ class ForeignAPIFile extends File { ? count( $data['query']['redirects'] ) - 1 : -1; if( $lastRedirect >= 0 ) { - $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to']); + $newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to'] ); $img = new self( $newtitle, $repo, $info, true ); if( $img ) { $img->redirectedFrom( $title->getDBkey() ); @@ -166,7 +166,7 @@ class ForeignAPIFile extends File { } $ret = array(); foreach( $metadata as $meta ) { - $ret[ $meta['name'] ] = self::parseMetadata( $meta['value'] ); + $ret[$meta['name']] = self::parseMetadata( $meta['value'] ); } return $ret; } diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 8231e7fb85..cd14e4e46f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -510,8 +510,7 @@ abstract class DatabaseInstaller { * @return String */ public function getInstallUserBox() { - return - Html::openElement( 'fieldset' ) . + return Html::openElement( 'fieldset' ) . Html::element( 'legend', array(), wfMessage( 'config-db-install-account' )->text() ) . $this->getTextBox( '_InstallUser', 'config-db-username', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-username' ) ) . $this->getPasswordBox( '_InstallPassword', 'config-db-password', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-install-password' ) ) . diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index b88ae614af..94164eb555 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -302,7 +302,7 @@ abstract class DatabaseUpdater { * @param string $fieldName The field to be modified * @param string $sqlPath The path to the SQL change path */ - public function modifyExtensionField( $tableName, $fieldName, $sqlPath) { + public function modifyExtensionField( $tableName, $fieldName, $sqlPath ) { $this->extensionUpdates[] = array( 'modifyField', $tableName, $fieldName, $sqlPath, true ); } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 8aee15c817..daac558a70 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -997,7 +997,7 @@ abstract class Installer { } # Try the current value of LANG. - if ( isset( $candidatesByLocale[ getenv( 'LANG' ) ] ) ) { + if ( isset( $candidatesByLocale[getenv( 'LANG' )] ) ) { $this->setVar( 'wgShellLocale', getenv( 'LANG' ) ); return true; } @@ -1408,10 +1408,10 @@ abstract class Installer { // then adding any callbacks that wanted to attach after a given step foreach( $coreInstallSteps as $step ) { $this->installSteps[] = $step; - if( isset( $this->extraInstallSteps[ $step['name'] ] ) ) { + if( isset( $this->extraInstallSteps[$step['name']] ) ) { $this->installSteps = array_merge( $this->installSteps, - $this->extraInstallSteps[ $step['name'] ] + $this->extraInstallSteps[$step['name']] ); } } @@ -1598,7 +1598,7 @@ abstract class Installer { $status = Status::newGood(); try { $page = WikiPage::factory( Title::newMainPage() ); - $content = new WikitextContent ( + $content = new WikitextContent( wfMessage( 'mainpagetext' )->inContentLanguage()->text() . "\n\n" . wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text() ); @@ -1608,7 +1608,7 @@ abstract class Installer { EDIT_NEW, false, User::newFromName( 'MediaWiki default' ) ); - } catch (MWException $e) { + } catch ( MWException $e ) { //using raw, because $wgShowExceptionDetails can not be set yet $status->fatal( 'config-install-mainpage-failed', $e->getMessage() ); } diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 7cb37791bd..aa7fc97363 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -227,7 +227,7 @@ class LocalSettingsGenerator { case 'db': case 'memcached': case 'accel': - $cacheType = 'CACHE_' . strtoupper( $this->values['wgMainCacheType']); + $cacheType = 'CACHE_' . strtoupper( $this->values['wgMainCacheType'] ); break; case 'none': default: diff --git a/includes/installer/MysqlInstaller.php b/includes/installer/MysqlInstaller.php index 06821f8246..72514f2350 100644 --- a/includes/installer/MysqlInstaller.php +++ b/includes/installer/MysqlInstaller.php @@ -86,8 +86,7 @@ class MysqlInstaller extends DatabaseInstaller { * @return string */ public function getConnectForm() { - return - $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . + return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . Html::openElement( 'fieldset' ) . Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-name-help' ) ) . diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index e85388907c..632015f572 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -59,8 +59,7 @@ class OracleInstaller extends DatabaseInstaller { if ( $this->getVar( 'wgDBserver' ) == 'localhost' ) { $this->parent->setVar( 'wgDBserver', '' ); } - return - $this->getTextBox( 'wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox( 'config-db-host-oracle-help' ) ) . + return $this->getTextBox( 'wgDBserver', 'config-db-host-oracle', array(), $this->parent->getHelpBox( 'config-db-host-oracle-help' ) ) . Html::openElement( 'fieldset' ) . Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . $this->getTextBox( 'wgDBprefix', 'config-db-prefix' ) . diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 4e5ae8cfc2..e7ae8d5897 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -56,8 +56,7 @@ class PostgresInstaller extends DatabaseInstaller { } function getConnectForm() { - return - $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . + return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) . $this->getTextBox( 'wgDBport', 'config-db-port' ) . Html::openElement( 'fieldset' ) . Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) . @@ -137,7 +136,8 @@ class PostgresInstaller extends DatabaseInstaller { $this->getVar( 'wgDBserver' ), $user, $password, - $dbName); + $dbName + ); $status->value = $db; } catch ( DBConnectionError $e ) { $status->fatal( 'config-connection-error', $e->getMessage() ); diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 0a4b5e65d7..17285c543a 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -613,7 +613,7 @@ END; } } - protected function changeNullableField( $table, $field, $null) { + protected function changeNullableField( $table, $field, $null ) { $fi = $this->db->fieldInfo( $table, $field ); if ( is_null( $fi ) ) { $this->output( "...ERROR: expected column $table.$field to exist\n" ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 35d649b2fd..ac66cd9971 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -353,7 +353,7 @@ class WebInstaller extends Installer { public function getFingerprint() { // Get the base URL of the installation $url = $this->request->getFullRequestURL(); - if ( preg_match( '!^(.*\?)!', $url, $m) ) { + if ( preg_match( '!^(.*\?)!', $url, $m ) ) { // Trim query string $url = $m[1]; } @@ -724,8 +724,7 @@ class WebInstaller extends Installer { $attributes['for'] = $forId; } - return - "
\n" . + return "
\n" . "
\n" . Xml::tags( 'label', $attributes, @@ -767,8 +766,7 @@ class WebInstaller extends Installer { if ( !isset( $params['help'] ) ) { $params['help'] = ""; } - return - $this->label( + return $this->label( $params['label'], $params['controlName'], Xml::input( @@ -814,8 +812,7 @@ class WebInstaller extends Installer { if ( !isset( $params['help'] ) ) { $params['help'] = ""; } - return - $this->label( + return $this->label( $params['label'], $params['controlName'], Xml::textarea( @@ -898,8 +895,7 @@ class WebInstaller extends Installer { $labelText = $this->parse( wfMessage( $params['label'] )->text() ); } - return - "
\n" . + return "
\n" . $params['help'] . "