From: Jack Phoenix Date: Sat, 19 Feb 2011 02:07:10 +0000 (+0000) Subject: add braces + some other coding style tweaks X-Git-Tag: 1.31.0-rc.0~31907 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=aca38f55640db99babefc8f7dcb2a0b464ae71e5;p=lhc%2Fweb%2Fwiklou.git add braces + some other coding style tweaks --- diff --git a/includes/specials/SpecialNewpages.php b/includes/specials/SpecialNewpages.php index 62d7765214..52c281ecdb 100644 --- a/includes/specials/SpecialNewpages.php +++ b/includes/specials/SpecialNewpages.php @@ -73,27 +73,36 @@ class SpecialNewpages extends IncludableSpecialPage { global $wgLang; $bits = preg_split( '/\s*,\s*/', trim( $par ) ); foreach ( $bits as $bit ) { - if ( 'shownav' == $bit ) + if ( 'shownav' == $bit ) { $this->showNavigation = true; - if ( 'hideliu' === $bit ) + } + if ( 'hideliu' === $bit ) { $this->opts->setValue( 'hideliu', true ); - if ( 'hidepatrolled' == $bit ) + } + if ( 'hidepatrolled' == $bit ) { $this->opts->setValue( 'hidepatrolled', true ); - if ( 'hidebots' == $bit ) + } + if ( 'hidebots' == $bit ) { $this->opts->setValue( 'hidebots', true ); - if ( 'showredirs' == $bit ) + } + if ( 'showredirs' == $bit ) { $this->opts->setValue( 'hideredirs', false ); - if ( is_numeric( $bit ) ) + } + if ( is_numeric( $bit ) ) { $this->opts->setValue( 'limit', intval( $bit ) ); + } $m = array(); - if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) - $this->opts->setValue( 'limit', intval($m[1]) ); + if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) { + $this->opts->setValue( 'limit', intval( $m[1] ) ); + } // PG offsets not just digits! - if ( preg_match( '/^offset=([^=]+)$/', $bit, $m ) ) - $this->opts->setValue( 'offset', intval($m[1]) ); - if ( preg_match( '/^username=(.*)$/', $bit, $m ) ) + if ( preg_match( '/^offset=([^=]+)$/', $bit, $m ) ) { + $this->opts->setValue( 'offset', intval( $m[1] ) ); + } + if ( preg_match( '/^username=(.*)$/', $bit, $m ) ) { $this->opts->setValue( 'username', $m[1] ); + } if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) { $ns = $wgLang->getNsIndex( $m[1] ); if( $ns !== false ) { @@ -135,7 +144,9 @@ class SpecialNewpages extends IncludableSpecialPage { if( $pager->getNumRows() ) { $navigation = ''; - if ( $this->showNavigation ) $navigation = $pager->getNavigationBar(); + if ( $this->showNavigation ) { + $navigation = $pager->getNavigationBar(); + } $wgOut->addHTML( $navigation . $pager->getBody() . $navigation ); } else { $wgOut->addWikiMsg( 'specialpage-empty' ); @@ -157,22 +168,24 @@ class SpecialNewpages extends IncludableSpecialPage { ); // Disable some if needed - # FIXME: throws E_NOTICEs if not set; and doesn't obey hooks etc - if ( $wgGroupPermissions['*']['createpage'] !== true ) - unset($filters['hideliu']); + # FIXME: throws E_NOTICEs if not set; and doesn't obey hooks etc. + if ( $wgGroupPermissions['*']['createpage'] !== true ) { + unset( $filters['hideliu'] ); + } - if ( !$wgUser->useNPPatrol() ) - unset($filters['hidepatrolled']); + if ( !$wgUser->useNPPatrol() ) { + unset( $filters['hidepatrolled'] ); + } $links = array(); $changed = $this->opts->getChangedValues(); - unset($changed['offset']); // Reset offset if query type changes + unset( $changed['offset'] ); // Reset offset if query type changes $self = $this->getTitle(); foreach ( $filters as $key => $msg ) { - $onoff = 1 - $this->opts->getValue($key); + $onoff = 1 - $this->opts->getValue( $key ); $link = $this->skin->link( $self, $showhide[$onoff], array(), - array( $key => $onoff ) + $changed + array( $key => $onoff ) + $changed ); $links[$key] = wfMsgHtml( $msg, $link ); } @@ -201,8 +214,9 @@ class SpecialNewpages extends IncludableSpecialPage { $hidden = implode( "\n", $hidden ); $tagFilter = ChangeTags::buildTagFilterSelector( $tagFilterVal ); - if ($tagFilter) + if ( $tagFilter ) { list( $tagFilterLabel, $tagFilterSelector ) = $tagFilter; + } $form = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . @@ -224,7 +238,7 @@ class SpecialNewpages extends IncludableSpecialPage { $tagFilterSelector . " " ) : '' ) . - ($wgEnableNewpagesUserFilter ? + ( $wgEnableNewpagesUserFilter ? " " . Xml::label( wfMsg( 'newpages-username' ), 'mw-np-username' ) . @@ -232,7 +246,7 @@ class SpecialNewpages extends IncludableSpecialPage { " . Xml::input( 'username', 30, $userText, array( 'id' => 'mw-np-username' ) ) . " - " : "" ) . + " : '' ) . " " . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . @@ -278,8 +292,9 @@ class SpecialNewpages extends IncludableSpecialPage { $query = array( 'redirect' => 'no' ); - if( $this->patrollable( $result ) ) + if( $this->patrollable( $result ) ) { $query['rcid'] = $result->rc_id; + } $plink = $this->skin->linkKnown( $title, @@ -321,7 +336,7 @@ class SpecialNewpages extends IncludableSpecialPage { $tagDisplay = ''; } - $css = count($classes) ? ' class="'.implode( " ", $classes).'"' : ''; + $css = count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : ''; return "{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay}\n"; } @@ -358,7 +373,8 @@ class SpecialNewpages extends IncludableSpecialPage { $feed = new $wgFeedClasses[$type]( $this->feedTitle(), wfMsgExt( 'tagline', 'parsemag' ), - $this->getTitle()->getFullUrl() ); + $this->getTitle()->getFullUrl() + ); $pager = new NewPagesPager( $this, $this->opts ); $limit = $this->opts->getValue( 'limit' ); @@ -392,7 +408,8 @@ class SpecialNewpages extends IncludableSpecialPage { $title->getFullURL(), $date, $this->feedItemAuthor( $row ), - $comments); + $comments + ); } else { return null; } @@ -429,8 +446,9 @@ class NewPagesPager extends ReverseChronologicalPager { function getTitle() { static $title = null; - if ( $title === null ) + if ( $title === null ) { $title = $this->mForm->getTitle(); + } return $title; } @@ -473,29 +491,35 @@ class NewPagesPager extends ReverseChronologicalPager { } // Allow changes to the New Pages query - wfRunHooks('SpecialNewpagesConditions', array(&$this, $this->opts, &$conds)); + wfRunHooks( 'SpecialNewpagesConditions', array( &$this, $this->opts, &$conds ) ); $info = array( 'tables' => array( 'recentchanges', 'page' ), - 'fields' => array( 'rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', 'rc_user_text', 'rc_comment', - 'rc_timestamp', 'rc_patrolled', 'rc_id', 'page_len AS length', 'page_latest AS rev_id', 'ts_tags'), + 'fields' => array( + 'rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', + 'rc_user_text', 'rc_comment', 'rc_timestamp', 'rc_patrolled', + 'rc_id', 'page_len AS length', 'page_latest AS rev_id', + 'ts_tags' + ), 'conds' => $conds, - 'options' => array( 'USE INDEX' => array('recentchanges' => $rcIndexes) ), + 'options' => array( 'USE INDEX' => array( 'recentchanges' => $rcIndexes ) ), 'join_conds' => array( - 'page' => array('INNER JOIN', 'page_id=rc_cur_id'), + 'page' => array( 'INNER JOIN', 'page_id=rc_cur_id' ), ), ); - ## Empty array for fields, it'll be set by us anyway. + // Empty array for fields, it'll be set by us anyway. $fields = array(); - ## Modify query for tags - ChangeTags::modifyDisplayQuery( $info['tables'], - $fields, - $info['conds'], - $info['join_conds'], - $info['options'], - $this->opts['tagfilter'] ); + // Modify query for tags + ChangeTags::modifyDisplayQuery( + $info['tables'], + $fields, + $info['conds'], + $info['join_conds'], + $info['options'], + $this->opts['tagfilter'] + ); return $info; } @@ -517,10 +541,10 @@ class NewPagesPager extends ReverseChronologicalPager { $linkBatch->add( $row->rc_namespace, $row->rc_title ); } $linkBatch->execute(); - return "'; } }