http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72348
Revision: 72348
Author: reedy
Date: 2010-09-04 03:43:33 +0000 (Sat, 04 Sep 2010)
Log Message:
-----------
Braces and spaces
Modified Paths:
--------------
trunk/phase3/includes/Html.php
trunk/phase3/includes/WatchlistEditor.php
trunk/phase3/includes/WebRequest.php
trunk/phase3/includes/WikiMap.php
trunk/phase3/includes/Xml.php
trunk/phase3/includes/ZhClient.php
Modified: trunk/phase3/includes/Html.php
===================================================================
--- trunk/phase3/includes/Html.php 2010-09-04 03:10:49 UTC (rev 72347)
+++ trunk/phase3/includes/Html.php 2010-09-04 03:43:33 UTC (rev 72348)
@@ -571,10 +571,12 @@
global $wgHtml5;
$attribs['name'] = $name;
if ( !$wgHtml5 ) {
- if ( !isset( $attribs['cols'] ) )
+ if ( !isset( $attribs['cols'] ) ) {
$attribs['cols'] = "";
- if ( !isset( $attribs['rows'] ) )
+ }
+ if ( !isset( $attribs['rows'] ) ) {
$attribs['rows'] = "";
+ }
}
return self::element( 'textarea', $attribs, $value );
}
@@ -610,7 +612,9 @@
}
}
$html = Html::openElement( 'html', $attribs );
- if ( $html ) $html .= "\n";
+ if ( $html ) {
+ $html .= "\n";
+ }
$ret .= $html;
return $ret;
}
@@ -623,12 +627,12 @@
*/
public static function isXmlMimeType( $mimetype ) {
switch ( $mimetype ) {
- case 'text/xml':
- case 'application/xhtml+xml':
- case 'application/xml':
- return true;
- default:
- return false;
+ case 'text/xml':
+ case 'application/xhtml+xml':
+ case 'application/xml':
+ return true;
+ default:
+ return false;
}
}
}
Modified: trunk/phase3/includes/WatchlistEditor.php
===================================================================
--- trunk/phase3/includes/WatchlistEditor.php 2010-09-04 03:10:49 UTC (rev
72347)
+++ trunk/phase3/includes/WatchlistEditor.php 2010-09-04 03:43:33 UTC (rev
72348)
@@ -100,15 +100,17 @@
$titles = array();
if( !is_array( $list ) ) {
$list = explode( "\n", trim( $list ) );
- if( !is_array( $list ) )
+ if( !is_array( $list ) ) {
return array();
+ }
}
foreach( $list as $text ) {
$text = trim( $text );
if( strlen( $text ) > 0 ) {
$title = Title::newFromText( $text );
- if( $title instanceof Title &&
$title->isWatchable() )
+ if( $title instanceof Title &&
$title->isWatchable() ) {
$titles[] = $title->getPrefixedText();
+ }
}
}
return array_unique( $titles );
@@ -129,8 +131,9 @@
// Do a batch existence check
$batch = new LinkBatch();
foreach( $titles as $title ) {
- if( !$title instanceof Title )
+ if( !$title instanceof Title ) {
$title = Title::newFromText( $title );
+ }
if( $title instanceof Title ) {
$batch->addObj( $title );
$batch->addObj( $title->getTalkPage() );
@@ -140,8 +143,9 @@
// Print out the list
$output->addHTML( "<ul>\n" );
foreach( $titles as $title ) {
- if( !$title instanceof Title )
+ if( !$title instanceof Title ) {
$title = Title::newFromText( $title );
+ }
if( $title instanceof Title ) {
$output->addHTML( "<li>" . $skin->link( $title )
. ' (' . $skin->link( $title->getTalkPage(),
$talk ) . ")</li>\n" );
@@ -221,8 +225,9 @@
$cache->addBadLinkObj( $title );
}
// Ignore non-talk
- if( !$title->isTalkPage() )
+ if( !$title->isTalkPage() ) {
$titles[$row->wl_namespace][$row->wl_title] = $row->page_is_redirect;
+ }
}
}
}
@@ -270,8 +275,9 @@
$dbw = wfGetDB( DB_MASTER );
$rows = array();
foreach( $titles as $title ) {
- if( !$title instanceof Title )
+ if( !$title instanceof Title ) {
$title = Title::newFromText( $title );
+ }
if( $title instanceof Title ) {
$rows[] = array(
'wl_user' => $user->getId(),
@@ -302,8 +308,9 @@
private function unwatchTitles( $titles, $user ) {
$dbw = wfGetDB( DB_MASTER );
foreach( $titles as $title ) {
- if( !$title instanceof Title )
+ if( !$title instanceof Title ) {
$title = Title::newFromText( $title );
+ }
if( $title instanceof Title ) {
$dbw->delete(
'watchlist',
@@ -410,8 +417,9 @@
global $wgLang;
$link = $skin->link( $title );
- if( $redirect )
+ if( $redirect ) {
$link = '<span class="watchlistredir">' . $link .
'</span>';
+ }
$tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml(
'talkpagelinktext' ) );
if( $title->exists() ) {
$tools[] = $skin->link(
@@ -459,8 +467,9 @@
$form .= Xml::openElement( 'textarea', array( 'id' => 'titles',
'name' => 'titles',
'rows' => $wgUser->getIntOption( 'rows' ), 'cols' =>
$wgUser->getIntOption( 'cols' ) ) );
$titles = $this->getWatchlist( $user );
- foreach( $titles as $title )
+ foreach( $titles as $title ) {
$form .= htmlspecialchars( $title ) . "\n";
+ }
$form .= '</textarea>';
$form .= '<p>' . Xml::submitButton( wfMsg(
'watchlistedit-raw-submit' ) ) . '</p>';
$form .= '</fieldset></form>';
Modified: trunk/phase3/includes/WebRequest.php
===================================================================
--- trunk/phase3/includes/WebRequest.php 2010-09-04 03:10:49 UTC (rev
72347)
+++ trunk/phase3/includes/WebRequest.php 2010-09-04 03:43:33 UTC (rev
72348)
@@ -563,15 +563,23 @@
global $wgUser;
$limit = $this->getInt( 'limit', 0 );
- if( $limit < 0 ) $limit = 0;
+ if( $limit < 0 ) {
+ $limit = 0;
+ }
if( ( $limit == 0 ) && ( $optionname != '' ) ) {
$limit = (int)$wgUser->getOption( $optionname );
}
- if( $limit <= 0 ) $limit = $deflimit;
- if( $limit > 5000 ) $limit = 5000; # We have *some* limits...
+ if( $limit <= 0 ) {
+ $limit = $deflimit;
+ }
+ if( $limit > 5000 ) {
+ $limit = 5000; # We have *some* limits...
+ }
$offset = $this->getInt( 'offset', 0 );
- if( $offset < 0 ) $offset = 0;
+ if( $offset < 0 ) {
+ $offset = 0;
+ }
return array( $limit, $offset );
}
@@ -686,8 +694,9 @@
* @return Mixed
*/
public function getSessionData( $key ) {
- if( !isset( $_SESSION[$key] ) )
+ if( !isset( $_SESSION[$key] ) ) {
return null;
+ }
return $_SESSION[$key];
}
@@ -939,13 +948,15 @@
global $wgTitle;
$basequery = '';
foreach( $this->data as $var => $val ) {
- if ( $var == 'title' )
+ if ( $var == 'title' ) {
continue;
- if ( is_array( $val ) )
+ }
+ if ( is_array( $val ) ) {
/* This will happen given a request like
*
http://en.wikipedia.org/w/index.php?title[]=Special:Userlogin&returnto[]=Main_Page
*/
continue;
+ }
$basequery .= '&' . urlencode( $var ) . '=' .
urlencode( $val );
}
$basequery .= '&' . $query;
Modified: trunk/phase3/includes/WikiMap.php
===================================================================
--- trunk/phase3/includes/WikiMap.php 2010-09-04 03:10:49 UTC (rev 72347)
+++ trunk/phase3/includes/WikiMap.php 2010-09-04 03:43:33 UTC (rev 72348)
@@ -68,12 +68,14 @@
global $wgUser;
$sk = $wgUser->getSkin();
- if ( !$text )
+ if ( !$text ) {
$text = $page;
+ }
$url = self::getForeignURL( $wikiID, $page );
- if ( $url === false )
+ if ( $url === false ) {
return false;
+ }
return $sk->makeExternalLink( $url, $text );
}
@@ -88,8 +90,9 @@
public static function getForeignURL( $wikiID, $page ) {
$wiki = WikiMap::getWiki( $wikiID );
- if ( $wiki )
+ if ( $wiki ) {
return $wiki->getUrl( $page );
+ }
return false;
}
Modified: trunk/phase3/includes/Xml.php
===================================================================
--- trunk/phase3/includes/Xml.php 2010-09-04 03:10:49 UTC (rev 72347)
+++ trunk/phase3/includes/Xml.php 2010-09-04 03:43:33 UTC (rev 72348)
@@ -46,8 +46,9 @@
if( is_null( $attribs ) ) {
return null;
} elseif( is_array( $attribs ) ) {
- foreach( $attribs as $name => $val )
+ foreach( $attribs as $name => $val ) {
$out .= " {$name}=\"" .
Sanitizer::encodeAttribute( $val ) . '"';
+ }
return $out;
} else {
throw new MWException( 'Expected attribute array, got
something else in ' . __METHOD__ );
@@ -133,10 +134,12 @@
if( !is_null( $all ) )
$namespaces = array( $all => wfMsg( 'namespacesall' ) )
+ $namespaces;
foreach( $namespaces as $index => $name ) {
- if( $index < NS_MAIN )
+ if( $index < NS_MAIN ) {
continue;
- if( $index === 0 )
+ }
+ if( $index === 0 ) {
$name = wfMsg( 'blanknamespace' );
+ }
$options[] = self::option( $name, $index, $index ===
$selected );
}
@@ -749,9 +752,15 @@
protected $attributes = array();
public function __construct( $name = false, $id = false, $default =
false ) {
- if ( $name ) $this->setAttribute( 'name', $name );
- if ( $id ) $this->setAttribute( 'id', $id );
- if ( $default !== false ) $this->default = $default;
+ if ( $name ) {
+ $this->setAttribute( 'name', $name );
+ }
+ if ( $id ) {
+ $this->setAttribute( 'id', $id );
+ }
+ if ( $default !== false ) {
+ $this->default = $default;
+ }
}
public function setDefault( $default ) {
Modified: trunk/phase3/includes/ZhClient.php
===================================================================
--- trunk/phase3/includes/ZhClient.php 2010-09-04 03:10:49 UTC (rev 72347)
+++ trunk/phase3/includes/ZhClient.php 2010-09-04 03:43:33 UTC (rev 72348)
@@ -35,7 +35,7 @@
$errno = $errstr = '';
$this->mFP = fsockopen($this->mHost, $this->mPort, $errno,
$errstr, 30);
wfRestoreWarnings();
- if(!$this->mFP) {
+ if ( !$this->mFP ) {
return false;
}
return true;
@@ -47,8 +47,9 @@
* @access private
*/
function query($request) {
- if(!$this->mConnected)
+ if ( !$this->mConnected ) {
return false;
+ }
fwrite($this->mFP, $request);
@@ -68,8 +69,9 @@
$data .= $str;
}
//data should be of length $len. otherwise something is wrong
- if(strlen($data) != $len)
+ if ( strlen($data) != $len ) {
return false;
+ }
return $data;
}
@@ -84,8 +86,9 @@
$len = strlen($text);
$q = "CONV $tolang $len\n$text";
$result = $this->query($q);
- if(!$result)
+ if ( !$result ) {
$result = $text;
+ }
return $result;
}
@@ -99,8 +102,9 @@
$len = strlen($text);
$q = "CONV ALL $len\n$text";
$result = $this->query($q);
- if(!$result)
+ if ( !$result ) {
return false;
+ }
list($infoline, $data) = explode('|', $result, 2);
$info = explode(";", $infoline);
$ret = array();
@@ -122,7 +126,7 @@
$len = strlen($text);
$q = "SEG $len\n$text";
$result = $this->query($q);
- if(!$result) {// fallback to character based segmentation
+ if ( !$result ) {// fallback to character based segmentation
$result = $this->segment($text);
}
return $result;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs