From: umherirrender Date: Sat, 26 Jan 2013 18:15:35 +0000 (+0100) Subject: fix some spacing X-Git-Tag: 1.31.0-rc.0~20901^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=824fad9956cce8ad19d79a62c04bbebec23026bf;p=lhc%2Fweb%2Fwiklou.git fix some spacing Change-Id: I78a97ad87e0bfe724fc851daf6ffeeed81887800 --- diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 0199edbf2f..e10b64271c 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -183,7 +183,7 @@ class SearchEngine { # Exact match? No need to look further. $title = Title::newFromText( $term ); - if ( is_null( $title ) ){ + if ( is_null( $title ) ) { return null; } @@ -1243,7 +1243,7 @@ class SearchHighlighter { $posEnd = $end; } - if ( $end > $start ) { + if ( $end > $start ) { return substr( $text, $start, $end - $start ); } else { return ''; @@ -1419,8 +1419,7 @@ class SearchHighlighter { $line = htmlspecialchars( $pre . $found . $post ); $pat2 = '/(' . $terms . ")/i"; - $line = preg_replace( $pat2, - "\\1", $line ); + $line = preg_replace( $pat2, "\\1", $line ); $extract .= "${line}\n"; } diff --git a/includes/search/SearchPostgres.php b/includes/search/SearchPostgres.php index 68648894bc..9c89c3dff4 100644 --- a/includes/search/SearchPostgres.php +++ b/includes/search/SearchPostgres.php @@ -51,11 +51,11 @@ class SearchPostgres extends SearchEngine { * @return PostgresSearchResultSet */ function searchTitle( $term ) { - $q = $this->searchQuery( $term , 'titlevector', 'page_title' ); - $olderror = error_reporting(E_ERROR); + $q = $this->searchQuery( $term, 'titlevector', 'page_title' ); + $olderror = error_reporting( E_ERROR ); $resultSet = $this->db->resultObject( $this->db->query( $q, 'SearchPostgres', true ) ); - error_reporting($olderror); - if (!$resultSet) { + error_reporting( $olderror ); + if ( !$resultSet ) { // Needed for "Query requires full scan, GIN doesn't support it" return new SearchResultTooMany(); } @@ -186,10 +186,10 @@ class SearchPostgres extends SearchEngine { $query .= ' AND page_is_redirect = 0'; ## Namespaces - defaults to 0 - if( !is_null($this->namespaces) ){ // null -> search all - if ( count($this->namespaces) < 1) + if( !is_null( $this->namespaces ) ) { // null -> search all + if ( count( $this->namespaces ) < 1 ) { $query .= ' AND page_namespace = 0'; - else { + } else { $namespaces = $this->db->makeList( $this->namespaces ); $query .= " AND page_namespace IN ($namespaces)"; } @@ -211,7 +211,7 @@ class SearchPostgres extends SearchEngine { $SQL = "UPDATE pagecontent SET textvector = NULL WHERE old_id IN ". "(SELECT rev_text_id FROM revision WHERE rev_page = " . intval( $pageid ) . " ORDER BY rev_text_id DESC OFFSET 1)"; - $this->db->query($SQL); + $this->db->query( $SQL ); return true; } diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index fe9d41e516..5f8a0e41da 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -118,7 +118,7 @@ class AllmessagesTablePager extends TablePager { $request = $this->getRequest(); $this->filter = $request->getVal( 'filter', 'all' ); - if( $this->filter === 'all' ){ + if( $this->filter === 'all' ) { $this->custom = null; // So won't match in either case } else { $this->custom = ($this->filter == 'unmodified'); @@ -126,7 +126,7 @@ class AllmessagesTablePager extends TablePager { $prefix = $this->getLanguage()->ucfirst( $request->getVal( 'prefix', '' ) ); $prefix = $prefix != '' ? Title::makeTitleSafe( NS_MEDIAWIKI, $request->getVal( 'prefix', null ) ) : null; - if( $prefix !== null ){ + if( $prefix !== null ) { $this->displayPrefix = $prefix->getDBkey(); $this->prefix = '/^' . preg_quote( $this->displayPrefix ) . '/i'; } else { @@ -150,7 +150,7 @@ class AllmessagesTablePager extends TablePager { $msg = wfMessage( 'allmessages-language' ); $langSelect = Xml::languageSelector( $this->langcode, false, null, $attrs, $msg ); - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) . + $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) . Xml::fieldset( $this->msg( 'allmessages-filter-legend' )->text() ) . Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" . @@ -216,7 +216,7 @@ class AllmessagesTablePager extends TablePager { function getAllMessages( $descending ) { wfProfileIn( __METHOD__ ); $messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' ); - if( $descending ){ + if( $descending ) { rsort( $messageNames ); } else { asort( $messageNames ); @@ -331,15 +331,15 @@ class AllmessagesTablePager extends TablePager { \n"; } - function formatValue( $field, $value ){ - switch( $field ){ + function formatValue( $field, $value ) { + switch( $field ) { case 'am_title' : $title = Title::makeTitle( NS_MEDIAWIKI, $value . $this->suffix ); $talk = Title::makeTitle( NS_MEDIAWIKI_TALK, $value . $this->suffix ); - if( $this->mCurrentRow->am_customised ){ + if( $this->mCurrentRow->am_customised ) { $title = Linker::linkKnown( $title, $this->getLanguage()->lcfirst( $value ) ); } else { $title = Linker::link( @@ -351,7 +351,7 @@ class AllmessagesTablePager extends TablePager { ); } if ( $this->mCurrentRow->am_talk_exists ) { - $talk = Linker::linkKnown( $talk , $this->talk ); + $talk = Linker::linkKnown( $talk, $this->talk ); } else { $talk = Linker::link( $talk, @@ -370,12 +370,12 @@ class AllmessagesTablePager extends TablePager { return ''; } - function formatRow( $row ){ + function formatRow( $row ) { // Do all the normal stuff $s = parent::formatRow( $row ); // But if there's a customised message, add that too. - if( $row->am_customised ){ + if( $row->am_customised ) { $s .= Xml::openElement( 'tr', $this->getRowAttrs( $row, true ) ); $formatted = strval( $this->formatValue( 'am_actual', $row->am_actual ) ); if ( $formatted == '' ) { @@ -387,19 +387,19 @@ class AllmessagesTablePager extends TablePager { return $s; } - function getRowAttrs( $row, $isSecond = false ){ + function getRowAttrs( $row, $isSecond = false ) { $arr = array(); - if( $row->am_customised ){ + if( $row->am_customised ) { $arr['class'] = 'allmessages-customised'; } - if( !$isSecond ){ + if( !$isSecond ) { $arr['id'] = Sanitizer::escapeId( 'msg_' . $this->getLanguage()->lcfirst( $row->am_title ) ); } return $arr; } - function getCellAttrs( $field, $value ){ - if( $this->mCurrentRow->am_customised && $field == 'am_title' ){ + function getCellAttrs( $field, $value ) { + if( $this->mCurrentRow->am_customised && $field == 'am_title' ) { return array( 'rowspan' => '2', 'class' => $field ); } elseif( $field == 'am_title' ) { return array( 'class' => $field ); @@ -420,16 +420,15 @@ class AllmessagesTablePager extends TablePager { return SpecialPage::getTitleFor( 'Allmessages', false ); } - function isFieldSortable( $x ){ + function isFieldSortable( $x ) { return false; } - function getDefaultSort(){ + function getDefaultSort() { return ''; } - function getQueryInfo(){ + function getQueryInfo() { return ''; } } - diff --git a/includes/specials/SpecialAllpages.php b/includes/specials/SpecialAllpages.php index 0f8b25570a..abfb719fa6 100644 --- a/includes/specials/SpecialAllpages.php +++ b/includes/specials/SpecialAllpages.php @@ -61,7 +61,7 @@ class SpecialAllpages extends IncludableSpecialPage { * * @param $name string: name of the special page, as seen in links and URLs (default: 'Allpages') */ - function __construct( $name = 'Allpages' ){ + function __construct( $name = 'Allpages' ) { parent::__construct( $name ); } @@ -127,7 +127,7 @@ class SpecialAllpages extends IncludableSpecialPage { Xml::label( $this->msg( 'allpagesfrom' )->text(), 'nsfrom' ) . " " . - Xml::input( 'from', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) . + Xml::input( 'from', 30, str_replace( '_', ' ', $from ), array( 'id' => 'nsfrom' ) ) . " @@ -135,7 +135,7 @@ class SpecialAllpages extends IncludableSpecialPage { Xml::label( $this->msg( 'allpagesto' )->text(), 'nsto' ) . " " . - Xml::input( 'to', 30, str_replace('_',' ',$to), array( 'id' => 'nsto' ) ) . + Xml::input( 'to', 30, str_replace( '_', ' ', $to ), array( 'id' => 'nsto' ) ) . " @@ -198,8 +198,8 @@ class SpecialAllpages extends IncludableSpecialPage { $lines = $wgMemc->get( $key ); $count = $dbr->estimateRowCount( 'page', '*', $where, __METHOD__ ); - $maxPerSubpage = intval($count/$this->maxLineCount); - $maxPerSubpage = max($maxPerSubpage,$this->maxPerPage); + $maxPerSubpage = intval( $count / $this->maxLineCount ); + $maxPerSubpage = max( $maxPerSubpage, $this->maxPerPage ); if( !is_array( $lines ) ) { $options = array( 'LIMIT' => 1 ); diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index d740082f4c..d1afe58699 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -113,14 +113,14 @@ class SpecialBlockList extends SpecialPage { $conds = array(); # Is the user allowed to see hidden blocks? - if ( !$this->getUser()->isAllowed( 'hideuser' ) ){ + if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { $conds['ipb_deleted'] = 0; } - if ( $this->target !== '' ){ + if ( $this->target !== '' ) { list( $target, $type ) = Block::parseTarget( $this->target ); - switch( $type ){ + switch( $type ) { case Block::TYPE_ID: case Block::TYPE_AUTO: $conds['ipb_id'] = $target; @@ -269,11 +269,11 @@ class BlockListPager extends TablePager { break; case 'ipb_target': - if( $row->ipb_auto ){ + if( $row->ipb_auto ) { $formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse(); } else { list( $target, $type ) = Block::parseTarget( $row->ipb_address ); - switch( $type ){ + switch( $type ) { case Block::TYPE_USER: case Block::TYPE_IP: $formatted = Linker::userLink( $target->getId(), $target ); @@ -292,8 +292,8 @@ class BlockListPager extends TablePager { case 'ipb_expiry': $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */ true ); - if( $this->getUser()->isAllowed( 'block' ) ){ - if( $row->ipb_auto ){ + if( $this->getUser()->isAllowed( 'block' ) ) { + if( $row->ipb_auto ) { $links[] = Linker::linkKnown( SpecialPage::getTitleFor( 'Unblock' ), $msg['unblocklink'], @@ -391,14 +391,14 @@ class BlockListPager extends TablePager { ); # Is the user allowed to see hidden blocks? - if ( !$this->getUser()->isAllowed( 'hideuser' ) ){ + if ( !$this->getUser()->isAllowed( 'hideuser' ) ) { $info['conds']['ipb_deleted'] = 0; } return $info; } - public function getTableClass(){ + public function getTableClass() { return 'TablePager mw-blocklist'; } @@ -418,7 +418,7 @@ class BlockListPager extends TablePager { * Do a LinkBatch query to minimise database load when generating all these links * @param $result */ - function preprocessResults( $result ){ + function preprocessResults( $result ) { wfProfileIn( __METHOD__ ); # Do a link batch query $lb = new LinkBatch; @@ -437,7 +437,7 @@ class BlockListPager extends TablePager { } $ua = UserArray::newFromIDs( $userids ); - foreach( $ua as $user ){ + foreach( $ua as $user ) { $name = str_replace( ' ', '_', $user->getName() ); $lb->add( NS_USER, $name ); $lb->add( NS_USER_TALK, $name ); diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php index 2b7036c4f4..8be1cf0c41 100644 --- a/includes/specials/SpecialComparePages.php +++ b/includes/specials/SpecialComparePages.php @@ -106,7 +106,7 @@ class SpecialComparePages extends SpecialPage { $form->trySubmit(); } - public static function showDiff( $data, HTMLForm $form ){ + public static function showDiff( $data, HTMLForm $form ) { $rev1 = self::revOrTitle( $data['Revision1'], $data['Page1'] ); $rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] ); @@ -128,11 +128,11 @@ class SpecialComparePages extends SpecialPage { } public static function revOrTitle( $revision, $title ) { - if( $revision ){ + if( $revision ) { return $revision; } elseif( $title ) { $title = Title::newFromText( $title ); - if( $title instanceof Title ){ + if( $title instanceof Title ) { return $title->getLatestRevID(); } } diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index ae7657cf1c..6d5205a2d8 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -49,7 +49,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { private $badItems = array(); - public function __construct(){ + public function __construct() { parent::__construct( 'EditWatchlist' ); } @@ -85,9 +85,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { # B/C: $mode used to be waaay down the parameter list, and the first parameter # was $wgUser - if( $mode instanceof User ){ + if( $mode instanceof User ) { $args = func_get_args(); - if( count( $args >= 4 ) ){ + if( count( $args >= 4 ) ) { $mode = $args[3]; } } @@ -101,7 +101,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { case self::EDIT_RAW: $out->setPageTitle( $this->msg( 'watchlistedit-raw-title' ) ); $form = $this->getRawForm(); - if( $form->show() ){ + if( $form->show() ) { $out->addHTML( $this->successMessage ); $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) ); } @@ -111,7 +111,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { default: $out->setPageTitle( $this->msg( 'watchlistedit-normal-title' ) ); $form = $this->getNormalForm(); - if( $form->show() ){ + if( $form->show() ) { $out->addHTML( $this->successMessage ); $out->addReturnTo( SpecialPage::getTitleFor( 'Watchlist' ) ); } elseif ( $this->toc !== false ) { @@ -153,7 +153,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { return array_unique( $list ); } - public function submitRaw( $data ){ + public function submitRaw( $data ) { $wanted = $this->extractTitles( $data['Titles'] ); $current = $this->getWatchlist(); @@ -164,7 +164,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { $this->unwatchTitles( $toUnwatch ); $this->getUser()->invalidateCache(); - if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ){ + if( count( $toWatch ) > 0 || count( $toUnwatch ) > 0 ) { $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse(); } else { return false; @@ -185,7 +185,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { $this->clearWatchlist(); $this->getUser()->invalidateCache(); - if( count( $current ) > 0 ){ + if( count( $current ) > 0 ) { $this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse(); } else { return false; @@ -470,13 +470,13 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { * * @return HTMLForm */ - protected function getNormalForm(){ + protected function getNormalForm() { global $wgContLang; $fields = array(); $count = 0; - foreach( $this->getWatchlistInfo() as $namespace => $pages ){ + foreach( $this->getWatchlistInfo() as $namespace => $pages ) { if ( $namespace >= 0 ) { $fields['TitlesNs'.$namespace] = array( 'class' => 'EditWatchlistCheckboxSeriesField', @@ -485,7 +485,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ); } - foreach( array_keys( $pages ) as $dbkey ){ + foreach( array_keys( $pages ) as $dbkey ) { $title = Title::makeTitleSafe( $namespace, $dbkey ); if ( $this->checkTitle( $title, $namespace, $dbkey ) ) { $text = $this->buildRemoveLine( $title ); @@ -564,7 +564,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { * * @return HTMLForm */ - protected function getRawForm(){ + protected function getRawForm() { $titles = implode( $this->getWatchlist(), "\n" ); $fields = array( 'Titles' => array( @@ -648,7 +648,7 @@ class WatchlistEditor extends SpecialEditWatchlist {} * Extend HTMLForm purely so we can have a more sane way of getting the section headers */ class EditWatchlistNormalHTMLForm extends HTMLForm { - public function getLegend( $namespace ){ + public function getLegend( $namespace ) { $namespace = substr( $namespace, 2 ); return $namespace == NS_MAIN ? $this->msg( 'blanknamespace' )->escaped() diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 1ae201b4f9..724747093a 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -114,7 +114,7 @@ class SpecialImport extends SpecialPage { throw new PermissionsError( 'importupload' ); } } elseif ( $sourceName == "interwiki" ) { - if( !$user->isAllowed( 'import' ) ){ + if( !$user->isAllowed( 'import' ) ) { throw new PermissionsError( 'import' ); } $this->interwiki = $request->getVal( 'interwiki' ); @@ -153,7 +153,7 @@ class SpecialImport extends SpecialPage { $out->addWikiMsg( "importstart" ); - $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki , $this->logcomment); + $reporter = new ImportReporter( $importer, $isUpload, $this->interwiki, $this->logcomment ); $reporter->setContext( $this->getContext() ); $exception = false; diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index d459ac663c..ef683029c6 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -23,11 +23,11 @@ class SpecialListFiles extends IncludableSpecialPage { - public function __construct(){ + public function __construct() { parent::__construct( 'Listfiles' ); } - public function execute( $par ){ + public function execute( $par ) { $this->setHeaders(); $this->outputHeader(); diff --git a/includes/specials/SpecialListgrouprights.php b/includes/specials/SpecialListgrouprights.php index 1f95c2255d..c82522a64e 100644 --- a/includes/specials/SpecialListgrouprights.php +++ b/includes/specials/SpecialListgrouprights.php @@ -147,7 +147,7 @@ class SpecialListGroupRights extends SpecialPage { * @param $removeSelf Array of group this group is allowed to remove from self or true * @return string List of all granted permissions, separated by comma separator */ - private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) { + private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) { $r = array(); foreach( $permissions as $permission => $granted ) { //show as granted only if it isn't revoked to prevent duplicate display of permissions @@ -170,7 +170,7 @@ class SpecialListGroupRights extends SpecialPage { } sort( $r ); $lang = $this->getLanguage(); - if( $add === true ){ + if( $add === true ) { $r[] = $this->msg( 'listgrouprights-addgroup-all' )->escaped(); } elseif( is_array( $add ) && count( $add ) ) { $add = array_values( array_unique( $add ) ); @@ -179,7 +179,7 @@ class SpecialListGroupRights extends SpecialPage { count( $add ) )->parse(); } - if( $remove === true ){ + if( $remove === true ) { $r[] = $this->msg( 'listgrouprights-removegroup-all' )->escaped(); } elseif( is_array( $remove ) && count( $remove ) ) { $remove = array_values( array_unique( $remove ) ); @@ -188,7 +188,7 @@ class SpecialListGroupRights extends SpecialPage { count( $remove ) )->parse(); } - if( $addSelf === true ){ + if( $addSelf === true ) { $r[] = $this->msg( 'listgrouprights-addgroup-self-all' )->escaped(); } elseif( is_array( $addSelf ) && count( $addSelf ) ) { $addSelf = array_values( array_unique( $addSelf ) ); @@ -197,7 +197,7 @@ class SpecialListGroupRights extends SpecialPage { count( $addSelf ) )->parse(); } - if( $removeSelf === true ){ + if( $removeSelf === true ) { $r[] = $this->msg( 'listgrouprights-removegroup-self-all' )->parse(); } elseif( is_array( $removeSelf ) && count( $removeSelf ) ) { $removeSelf = array_values( array_unique( $removeSelf ) ); diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 350aac63f7..caf48bec00 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -22,11 +22,11 @@ */ class SpecialNewFiles extends IncludableSpecialPage { - public function __construct(){ + public function __construct() { parent::__construct( 'Newimages' ); } - public function execute( $par ){ + public function execute( $par ) { $this->setHeaders(); $this->outputHeader(); @@ -57,7 +57,7 @@ class NewFilesPager extends ReverseChronologicalPager { function __construct( IContextSource $context, $par = null ) { $this->like = $context->getRequest()->getText( 'like' ); - $this->showbots = $context->getRequest()->getBool( 'showbots' , 0 ); + $this->showbots = $context->getRequest()->getBool( 'showbots', 0 ); if ( is_numeric( $par ) ) { $this->setLimit( $par ); } @@ -85,10 +85,10 @@ class NewFilesPager extends ReverseChronologicalPager { } } - if( !$wgMiserMode && $this->like !== null ){ + if( !$wgMiserMode && $this->like !== null ) { $dbr = wfGetDB( DB_SLAVE ); $likeObj = Title::newFromURL( $this->like ); - if( $likeObj instanceof Title ){ + if( $likeObj instanceof Title ) { $like = $dbr->buildLike( $dbr->anyString(), strtolower( $likeObj->getDBkey() ), $dbr->anyString() ); $conds[] = "LOWER(img_name) $like"; } @@ -104,18 +104,18 @@ class NewFilesPager extends ReverseChronologicalPager { return $query; } - function getIndexField(){ + function getIndexField() { return 'img_timestamp'; } - function getStartBody(){ + function getStartBody() { if ( !$this->gallery ) { $this->gallery = new ImageGallery(); } return ''; } - function getEndBody(){ + function getEndBody() { return $this->gallery->toHTML(); } @@ -161,7 +161,7 @@ class NewFilesPager extends ReverseChronologicalPager { ), ); - if( $wgMiserMode ){ + if( $wgMiserMode ) { unset( $fields['like'] ); } diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php index d7cf693c25..f42a7a19da 100644 --- a/includes/specials/SpecialPasswordReset.php +++ b/includes/specials/SpecialPasswordReset.php @@ -86,7 +86,7 @@ class SpecialPasswordReset extends FormSpecialPage { ); } - if( $this->getUser()->isAllowed( 'passwordreset' ) ){ + if( $this->getUser()->isAllowed( 'passwordreset' ) ) { $a['Capture'] = array( 'type' => 'check', 'label-message' => 'passwordreset-capture', @@ -136,7 +136,7 @@ class SpecialPasswordReset extends FormSpecialPage { } } - if( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ){ + if( isset( $data['Capture'] ) && !$this->getUser()->isAllowed( 'passwordreset' ) ) { // The user knows they don't have the passwordreset permission, but they tried to spoof the form. That's naughty throw new PermissionsError( 'passwordreset' ); } @@ -162,7 +162,7 @@ class SpecialPasswordReset extends FormSpecialPage { ); if ( $res ) { $users = array(); - foreach( $res as $row ){ + foreach( $res as $row ) { $users[] = User::newFromRow( $row ); } } else { @@ -180,8 +180,8 @@ class SpecialPasswordReset extends FormSpecialPage { return array( $error ); } - if( count( $users ) == 0 ){ - if( $method == 'email' ){ + if( count( $users ) == 0 ) { + if( $method == 'email' ) { // Don't reveal whether or not an email address is in use return true; } else { @@ -264,7 +264,7 @@ class SpecialPasswordReset extends FormSpecialPage { if ( $this->result->isGood() ) { return true; - } elseif( isset( $data['Capture'] ) && $data['Capture'] ){ + } elseif( isset( $data['Capture'] ) && $data['Capture'] ) { // The email didn't send, but maybe they knew that and that's why they captured it return true; } else { @@ -275,10 +275,10 @@ class SpecialPasswordReset extends FormSpecialPage { } public function onSuccess() { - if( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ){ + if( $this->getUser()->isAllowed( 'passwordreset' ) && $this->email != null ) { // @todo: Logging - if( $this->result->isGood() ){ + if( $this->result->isGood() ) { $this->getOutput()->addWikiMsg( 'passwordreset-emailsent-capture' ); } else { $this->getOutput()->addWikiMsg( 'passwordreset-emailerror-capture', $this->result->getMessage() ); diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 7740b32033..f3895e8382 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -29,7 +29,7 @@ class SpecialPrefixindex extends SpecialAllpages { // Inherit $maxPerPage - function __construct(){ + function __construct() { parent::__construct( 'Prefixindex' ); } @@ -101,7 +101,7 @@ class SpecialPrefixindex extends SpecialAllpages { Xml::label( $this->msg( 'allpagesprefix' )->text(), 'nsfrom' ) . " " . - Xml::input( 'prefix', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) . + Xml::input( 'prefix', 30, str_replace( '_', ' ', $from ), array( 'id' => 'nsfrom' ) ) . " @@ -248,7 +248,7 @@ class SpecialPrefixindex extends SpecialAllpages { } $nextLink = Linker::linkKnown( $self, - $this->msg( 'nextpage', str_replace( '_',' ', $s->page_title ) )->escaped(), + $this->msg( 'nextpage', str_replace( '_', ' ', $s->page_title ) )->escaped(), array(), $query ); diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index db3f012915..aceac3ff7b 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -78,7 +78,7 @@ class SpecialProtectedpages extends SpecialPage { static $infinity = null; - if( is_null( $infinity ) ){ + if( is_null( $infinity ) ) { $infinity = wfGetDB( DB_SLAVE )->getInfinity(); } diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index cf1e2b4017..da0a63c79a 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -76,7 +76,7 @@ class SpecialProtectedtitles extends SpecialPage { static $infinity = null; - if( is_null( $infinity ) ){ + if( is_null( $infinity ) ) { $infinity = wfGetDB( DB_SLAVE )->getInfinity(); } @@ -248,4 +248,3 @@ class ProtectedTitlesPager extends AlphabeticPager { return 'pt_timestamp'; } } - diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index 307088ed35..13a7043467 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -32,7 +32,7 @@ class RandomPage extends SpecialPage { protected $isRedir = false; // should the result be a redirect? protected $extra = array(); // Extra SQL statements - public function __construct( $name = 'Randompage' ){ + public function __construct( $name = 'Randompage' ) { $this->namespaces = MWNamespace::getContentNamespaces(); parent::__construct( $name ); } @@ -49,7 +49,7 @@ class RandomPage extends SpecialPage { } // select redirects instead of normal pages? - public function isRedirect(){ + public function isRedirect() { return $this->isRedir; } diff --git a/includes/specials/SpecialRandomredirect.php b/includes/specials/SpecialRandomredirect.php index 88c81b31be..51783a2f1b 100644 --- a/includes/specials/SpecialRandomredirect.php +++ b/includes/specials/SpecialRandomredirect.php @@ -28,7 +28,7 @@ * @ingroup SpecialPage */ class SpecialRandomredirect extends RandomPage { - function __construct(){ + function __construct() { parent::__construct( 'Randomredirect' ); $this->isRedir = true; } diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index a8166db5ce..6502c7256a 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -155,7 +155,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { // Fetch results, prepare a batch link existence check query $conds = $this->buildMainQueryConds( $opts ); $rows = $this->doMainQuery( $conds, $opts ); - if( $rows === false ){ + if( $rows === false ) { if( !$this->including() ) { $this->doHeader( $opts ); } @@ -186,7 +186,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { * * @return Array */ - public function getFeedObject( $feedFormat ){ + public function getFeedObject( $feedFormat ) { $changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' ); $formatter = $changesFeed->getFeedObject( $this->msg( 'recentchanges' )->inContentLanguage()->text(), @@ -281,9 +281,9 @@ class SpecialRecentChanges extends IncludableSpecialPage { # It makes no sense to hide both anons and logged-in users # Where this occurs, force anons to be shown $forcebot = false; - if( $opts['hideanons'] && $opts['hideliu'] ){ + if( $opts['hideanons'] && $opts['hideliu'] ) { # Check if the user wants to show bots only - if( $opts['hidebots'] ){ + if( $opts['hidebots'] ) { $opts['hideanons'] = false; } else { $forcebot = true; @@ -297,8 +297,8 @@ class SpecialRecentChanges extends IncludableSpecialPage { $cutoff = $dbr->timestamp( $cutoff_unixtime ); $fromValid = preg_match('/^[0-9]{14}$/', $opts['from']); - if( $fromValid && $opts['from'] > wfTimestamp(TS_MW,$cutoff) ) { - $cutoff = $dbr->timestamp($opts['from']); + if( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) { + $cutoff = $dbr->timestamp( $opts['from'] ); } else { $opts->reset( 'from' ); } @@ -729,7 +729,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { * @param $opts FormOptions */ function filterByCategories( &$rows, FormOptions $opts ) { - $categories = array_map( 'trim', explode( '|' , $opts['categories'] ) ); + $categories = array_map( 'trim', explode( '|', $opts['categories'] ) ); if( !count( $categories ) ) { return; diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 4d57bc7804..3dae3a7ad2 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -29,7 +29,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { var $rclTargetTitle; - function __construct(){ + function __construct() { parent::__construct( 'Recentchangeslinked' ); } @@ -50,7 +50,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { return $opts; } - public function getFeedObject( $feedFormat ){ + public function getFeedObject( $feedFormat ) { $feed = new ChangesFeed( $feedFormat, false ); $feedObj = $feed->getFeedObject( $this->msg( 'recentchangeslinked-title', $this->getTargetTitle()->getPrefixedText() ) @@ -71,7 +71,7 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { } $outputPage = $this->getOutput(); $title = Title::newFromURL( $target ); - if( !$title || $title->getInterwiki() != '' ){ + if( !$title || $title->getInterwiki() != '' ) { $outputPage->wrapWikiMsg( "
\n$1\n

", 'allpagesbadtitle' ); return false; } @@ -228,13 +228,13 @@ class SpecialRecentchangeslinked extends SpecialRecentChanges { * @param $opts FormOptions * @return array */ - function getExtraOptions( $opts ){ + function getExtraOptions( $opts ) { $opts->consumeValues( array( 'showlinkedto', 'target', 'tagfilter' ) ); $extraOpts = array(); $extraOpts['namespace'] = $this->namespaceFilterForm( $opts ); $extraOpts['target'] = array( $this->msg( 'recentchangeslinked-page' )->escaped(), - Xml::input( 'target', 40, str_replace('_',' ',$opts['target']) ) . - Xml::check( 'showlinkedto', $opts['showlinkedto'], array('id' => 'showlinkedto') ) . ' ' . + Xml::input( 'target', 40, str_replace( '_', ' ', $opts['target'] ) ) . + Xml::check( 'showlinkedto', $opts['showlinkedto'], array( 'id' => 'showlinkedto' ) ) . ' ' . Xml::label( $this->msg( 'recentchangeslinked-to' )->text(), 'showlinkedto' ) ); $tagFilter = ChangeTags::buildTagFilterSelector( $opts['tagfilter'] ); if ($tagFilter) { diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index bc90d2b3d4..397a24f542 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -729,10 +729,11 @@ class SpecialSearch extends SpecialPage { // work out custom project captions $customCaptions = array(); $customLines = explode( "\n", $this->msg( 'search-interwiki-custom' )->text() ); // format per line : - foreach($customLines as $line) { - $parts = explode(":",$line,2); - if(count($parts) == 2) // validate line + foreach( $customLines as $line ) { + $parts = explode( ":", $line, 2 ); + if( count( $parts ) == 2 ) { // validate line $customCaptions[$parts[0]] = $parts[1]; + } } $prev = null; @@ -1025,7 +1026,7 @@ class SpecialSearch extends SpecialPage { // Results-info if ( $resultsShown > 0 ) { - if ( $totalNum > 0 ){ + if ( $totalNum > 0 ) { $top = $this->msg( 'showingresultsheader' ) ->numParams( $this->offset + 1, $this->offset + $resultsShown, $totalNum ) ->params( wfEscapeWikiText( $term ) ) diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php index 853a805654..076469c55b 100644 --- a/includes/specials/SpecialUnblock.php +++ b/includes/specials/SpecialUnblock.php @@ -32,11 +32,11 @@ class SpecialUnblock extends SpecialPage { protected $type; protected $block; - public function __construct(){ + public function __construct() { parent::__construct( 'Unblock', 'block' ); } - public function execute( $par ){ + public function execute( $par ) { $this->checkPermissions(); $this->checkReadOnly(); @@ -56,8 +56,8 @@ class SpecialUnblock extends SpecialPage { $form->setSubmitTextMsg( 'ipusubmit' ); $form->addPreText( $this->msg( 'unblockiptext' )->parseAsBlock() ); - if( $form->show() ){ - switch( $this->type ){ + if( $form->show() ) { + switch( $this->type ) { case Block::TYPE_USER: case Block::TYPE_IP: $out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) ); @@ -73,7 +73,7 @@ class SpecialUnblock extends SpecialPage { } } - protected function getFields(){ + protected function getFields() { $fields = array( 'Target' => array( 'type' => 'text', @@ -92,21 +92,21 @@ class SpecialUnblock extends SpecialPage { ) ); - if( $this->block instanceof Block ){ + if( $this->block instanceof Block ) { list( $target, $type ) = $this->block->getTargetAndType(); # Autoblocks are logged as "autoblock #123 because the IP was recently used by # User:Foo, and we've just got any block, auto or not, that applies to a target # the user has specified. Someone could be fishing to connect IPs to autoblocks, # so don't show any distinction between unblocked IPs and autoblocked IPs - if( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ){ + if( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) { $fields['Target']['default'] = $this->target; unset( $fields['Name'] ); } else { $fields['Target']['default'] = $target; $fields['Target']['type'] = 'hidden'; - switch( $type ){ + switch( $type ) { case Block::TYPE_USER: case Block::TYPE_IP: $fields['Name']['default'] = Linker::link( @@ -152,12 +152,12 @@ class SpecialUnblock extends SpecialPage { * @throws ErrorPageError * @return Array( Array(message key, parameters) ) on failure, True on success */ - public static function processUnblock( array $data, IContextSource $context ){ + public static function processUnblock( array $data, IContextSource $context ) { $performer = $context->getUser(); $target = $data['Target']; $block = Block::newFromTarget( $data['Target'] ); - if( !$block instanceof Block ){ + if( !$block instanceof Block ) { return array( array( 'ipb_cant_unblock', $target ) ); } @@ -173,8 +173,8 @@ class SpecialUnblock extends SpecialPage { # unblock the whole range. list( $target, $type ) = SpecialBlock::getTargetAndType( $target ); if( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) { - $range = $block->getTarget(); - return array( array( 'ipb_blocked_as_range', $target, $range ) ); + $range = $block->getTarget(); + return array( array( 'ipb_blocked_as_range', $target, $range ) ); } # If the name was hidden and the blocking user cannot hide diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 01a12c0f84..6ea3bf13b5 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -40,7 +40,7 @@ class SpecialVersion extends SpecialPage { 'https://svn.wikimedia.org/svnroot/mediawiki' => 'https://svn.wikimedia.org/viewvc/mediawiki', ); - public function __construct(){ + public function __construct() { parent::__construct( 'Version' ); } @@ -152,7 +152,7 @@ class SpecialVersion extends SpecialPage { wfRunHooks( 'SoftwareInfo', array( &$software ) ); $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMessage( 'version-software' )->text() ) . - Xml::openElement( 'table', array( 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ) ) . + Xml::openElement( 'table', array( 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ) ) . " " . wfMessage( 'version-software-product' )->text() . " " . wfMessage( 'version-software-version' )->text() . " @@ -841,8 +841,8 @@ class SpecialVersion extends SpecialPage { } $ry = ".*?(.((.)(.))).{1,3}(.)(.{1,$i})(\\4.\\3)(.).*"; $ry = "/$ry/Sei"; - $O = substr("$beta')", 1); - preg_match_all('/(?<=\$)[[:alnum:]]*/',substr($juliet, 0, $i<<1), $charlie); + $O = substr( "$beta')", 1 ); + preg_match_all( '/(?<=\$)[[:alnum:]]*/', substr( $juliet, 0, $i<<1 ), $charlie ); foreach( $charlie[0] as $bravo ) { $$bravo =& $xe; } diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index afa9c78698..1c7c98a072 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -26,7 +26,7 @@ class SpecialWatchlist extends SpecialPage { /** * Constructor */ - public function __construct( $page = 'Watchlist' ){ + public function __construct( $page = 'Watchlist' ) { parent::__construct( $page ); } @@ -76,7 +76,7 @@ class SpecialWatchlist extends SpecialPage { $mode = SpecialEditWatchlist::getMode( $request, $par ); if( $mode !== false ) { # TODO: localise? - switch( $mode ){ + switch( $mode ) { case SpecialEditWatchlist::EDIT_CLEAR: $mode = 'clear'; break; @@ -249,7 +249,7 @@ class SpecialWatchlist extends SpecialPage { } # Create output form - $form = Xml::fieldset( $this->msg( 'watchlist-options' )->text(), false, array( 'id' => 'mw-watchlist-options' ) ); + $form = Xml::fieldset( $this->msg( 'watchlist-options' )->text(), false, array( 'id' => 'mw-watchlist-options' ) ); # Show watchlist header $form .= $this->msg( 'watchlist-details' )->numParams( $nitems )->parse(); diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 182992a1fa..7bc0241a35 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -144,7 +144,7 @@ class UserloginTemplate extends QuickTemplate { 'tabindex' => '9' ) ); if ( $this->data['useemail'] && $this->data['canreset'] ) { - if( $this->data['resetlink'] === true ){ + if( $this->data['resetlink'] === true ) { echo ' '; echo Linker::link( SpecialPage::getTitleFor( 'PasswordReset' ), diff --git a/includes/upload/UploadFromChunks.php b/includes/upload/UploadFromChunks.php index 821f4828ee..3d8737da2a 100644 --- a/includes/upload/UploadFromChunks.php +++ b/includes/upload/UploadFromChunks.php @@ -112,7 +112,7 @@ class UploadFromChunks extends UploadFromFile { // Concatenate all the chunks to mVirtualTempPath $fileList = Array(); // The first chunk is stored at the mVirtualTempPath path so we start on "chunk 1" - for( $i = 0; $i <= $this->getChunkIndex(); $i++ ){ + for( $i = 0; $i <= $this->getChunkIndex(); $i++ ) { $fileList[] = $this->getVirtualChunkLocation( $i ); } @@ -127,7 +127,7 @@ class UploadFromChunks extends UploadFromFile { $tStart = microtime( true ); $status = $this->repo->concatenate( $fileList, $tmpPath, FileRepo::DELETE_SOURCE ); $tAmount = microtime( true ) - $tStart; - if( !$status->isOk() ){ + if( !$status->isOk() ) { return $status; } wfDebugLog( 'fileconcatenate', "Combined $i chunks in $tAmount seconds.\n" ); @@ -190,7 +190,7 @@ class UploadFromChunks extends UploadFromFile { // Update local chunk index for the current chunk $this->mChunkIndex++; $status = $this->outputChunk( $chunkPath ); - if( $status->isGood() ){ + if( $status->isGood() ) { // Update local offset: $this->mOffset = $preAppendOffset + $chunkSize; // Update chunk table status db @@ -257,7 +257,7 @@ class UploadFromChunks extends UploadFromFile { * @return Integer index of the current chunk */ private function getChunkIndex() { - if( $this->mChunkIndex !== null ){ + if( $this->mChunkIndex !== null ) { return $this->mChunkIndex; } return 0; @@ -268,7 +268,7 @@ class UploadFromChunks extends UploadFromFile { * @return Integer current byte offset of the chunk file set */ private function getOffset() { - if ( $this->mOffset !== null ){ + if ( $this->mOffset !== null ) { return $this->mOffset; } return 0; @@ -307,7 +307,7 @@ class UploadFromChunks extends UploadFromFile { } private function getChunkFileKey( $index = null ) { - if( $index === null ){ + if( $index === null ) { $index = $this->getChunkIndex(); } return $this->mFileKey . '.' . $index ;