# Exact match? No need to look further.
$title = Title::newFromText( $term );
- if ( is_null( $title ) ){
+ if ( is_null( $title ) ) {
return null;
}
$posEnd = $end;
}
- if ( $end > $start ) {
+ if ( $end > $start ) {
return substr( $text, $start, $end - $start );
} else {
return '';
$line = htmlspecialchars( $pre . $found . $post );
$pat2 = '/(' . $terms . ")/i";
- $line = preg_replace( $pat2,
- "<span class='searchmatch'>\\1</span>", $line );
+ $line = preg_replace( $pat2, "<span class='searchmatch'>\\1</span>", $line );
$extract .= "${line}\n";
}
* @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();
}
$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)";
}
$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;
}
$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');
$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 {
$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" .
function getAllMessages( $descending ) {
wfProfileIn( __METHOD__ );
$messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' );
- if( $descending ){
+ if( $descending ) {
rsort( $messageNames );
} else {
asort( $messageNames );
</tr></thead><tbody>\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(
);
}
if ( $this->mCurrentRow->am_talk_exists ) {
- $talk = Linker::linkKnown( $talk , $this->talk );
+ $talk = Linker::linkKnown( $talk, $this->talk );
} else {
$talk = Linker::link(
$talk,
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 == '' ) {
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 );
return SpecialPage::getTitleFor( 'Allmessages', false );
}
- function isFieldSortable( $x ){
+ function isFieldSortable( $x ) {
return false;
}
- function getDefaultSort(){
+ function getDefaultSort() {
return '';
}
- function getQueryInfo(){
+ function getQueryInfo() {
return '';
}
}
-
*
* @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 );
}
Xml::label( $this->msg( 'allpagesfrom' )->text(), 'nsfrom' ) .
" </td>
<td class='mw-input'>" .
- Xml::input( 'from', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) .
+ Xml::input( 'from', 30, str_replace( '_', ' ', $from ), array( 'id' => 'nsfrom' ) ) .
" </td>
</tr>
<tr>
Xml::label( $this->msg( 'allpagesto' )->text(), 'nsto' ) .
" </td>
<td class='mw-input'>" .
- Xml::input( 'to', 30, str_replace('_',' ',$to), array( 'id' => 'nsto' ) ) .
+ Xml::input( 'to', 30, str_replace( '_', ' ', $to ), array( 'id' => 'nsto' ) ) .
" </td>
</tr>
<tr>
$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 );
$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;
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 );
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'],
);
# 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';
}
* 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;
}
$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 );
$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'] );
}
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();
}
}
private $badItems = array();
- public function __construct(){
+ public function __construct() {
parent::__construct( 'EditWatchlist' );
}
# 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];
}
}
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' ) );
}
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 ) {
return array_unique( $list );
}
- public function submitRaw( $data ){
+ public function submitRaw( $data ) {
$wanted = $this->extractTitles( $data['Titles'] );
$current = $this->getWatchlist();
$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;
$this->clearWatchlist();
$this->getUser()->invalidateCache();
- if( count( $current ) > 0 ){
+ if( count( $current ) > 0 ) {
$this->successMessage = $this->msg( 'watchlistedit-raw-done' )->parse();
} else {
return false;
*
* @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',
);
}
- 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 );
*
* @return HTMLForm
*/
- protected function getRawForm(){
+ protected function getRawForm() {
$titles = implode( $this->getWatchlist(), "\n" );
$fields = array(
'Titles' => array(
* 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()
throw new PermissionsError( 'importupload' );
}
} elseif ( $sourceName == "interwiki" ) {
- if( !$user->isAllowed( 'import' ) ){
+ if( !$user->isAllowed( 'import' ) ) {
throw new PermissionsError( 'import' );
}
$this->interwiki = $request->getVal( 'interwiki' );
$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;
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();
* @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
}
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 ) );
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 ) );
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 ) );
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 ) );
*/
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();
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 );
}
}
}
- 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";
}
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();
}
),
);
- if( $wgMiserMode ){
+ if( $wgMiserMode ) {
unset( $fields['like'] );
}
);
}
- if( $this->getUser()->isAllowed( 'passwordreset' ) ){
+ if( $this->getUser()->isAllowed( 'passwordreset' ) ) {
$a['Capture'] = array(
'type' => 'check',
'label-message' => 'passwordreset-capture',
}
}
- 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' );
}
);
if ( $res ) {
$users = array();
- foreach( $res as $row ){
+ foreach( $res as $row ) {
$users[] = User::newFromRow( $row );
}
} else {
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 {
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 {
}
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() );
class SpecialPrefixindex extends SpecialAllpages {
// Inherit $maxPerPage
- function __construct(){
+ function __construct() {
parent::__construct( 'Prefixindex' );
}
Xml::label( $this->msg( 'allpagesprefix' )->text(), 'nsfrom' ) .
"</td>
<td class='mw-input'>" .
- Xml::input( 'prefix', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) .
+ Xml::input( 'prefix', 30, str_replace( '_', ' ', $from ), array( 'id' => 'nsfrom' ) ) .
"</td>
</tr>
<tr>
}
$nextLink = Linker::linkKnown(
$self,
- $this->msg( 'nextpage', str_replace( '_',' ', $s->page_title ) )->escaped(),
+ $this->msg( 'nextpage', str_replace( '_', ' ', $s->page_title ) )->escaped(),
array(),
$query
);
static $infinity = null;
- if( is_null( $infinity ) ){
+ if( is_null( $infinity ) ) {
$infinity = wfGetDB( DB_SLAVE )->getInfinity();
}
static $infinity = null;
- if( is_null( $infinity ) ){
+ if( is_null( $infinity ) ) {
$infinity = wfGetDB( DB_SLAVE )->getInfinity();
}
return 'pt_timestamp';
}
}
-
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 );
}
}
// select redirects instead of normal pages?
- public function isRedirect(){
+ public function isRedirect() {
return $this->isRedir;
}
* @ingroup SpecialPage
*/
class SpecialRandomredirect extends RandomPage {
- function __construct(){
+ function __construct() {
parent::__construct( 'Randomredirect' );
$this->isRedir = true;
}
// 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 );
}
*
* @return Array
*/
- public function getFeedObject( $feedFormat ){
+ public function getFeedObject( $feedFormat ) {
$changesFeed = new ChangesFeed( $feedFormat, 'rcfeed' );
$formatter = $changesFeed->getFeedObject(
$this->msg( 'recentchanges' )->inContentLanguage()->text(),
# 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;
$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' );
}
* @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;
class SpecialRecentchangeslinked extends SpecialRecentChanges {
var $rclTargetTitle;
- function __construct(){
+ function __construct() {
parent::__construct( 'Recentchangeslinked' );
}
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() )
}
$outputPage = $this->getOutput();
$title = Title::newFromURL( $target );
- if( !$title || $title->getInterwiki() != '' ){
+ if( !$title || $title->getInterwiki() != '' ) {
$outputPage->wrapWikiMsg( "<div class=\"errorbox\">\n$1\n</div><br style=\"clear: both\" />", 'allpagesbadtitle' );
return false;
}
* @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) {
// work out custom project captions
$customCaptions = array();
$customLines = explode( "\n", $this->msg( 'search-interwiki-custom' )->text() ); // format per line <iwprefix>:<caption>
- 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;
// 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 ) )
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();
$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 ) );
}
}
- protected function getFields(){
+ protected function getFields() {
$fields = array(
'Target' => array(
'type' => 'text',
)
);
- 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(
* @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 ) );
}
# 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
'https://svn.wikimedia.org/svnroot/mediawiki' => 'https://svn.wikimedia.org/viewvc/mediawiki',
);
- public function __construct(){
+ public function __construct() {
parent::__construct( 'Version' );
}
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' ) ) .
"<tr>
<th>" . wfMessage( 'version-software-product' )->text() . "</th>
<th>" . wfMessage( 'version-software-version' )->text() . "</th>
}
$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;
}
/**
* Constructor
*/
- public function __construct( $page = 'Watchlist' ){
+ public function __construct( $page = 'Watchlist' ) {
parent::__construct( $page );
}
$mode = SpecialEditWatchlist::getMode( $request, $par );
if( $mode !== false ) {
# TODO: localise?
- switch( $mode ){
+ switch( $mode ) {
case SpecialEditWatchlist::EDIT_CLEAR:
$mode = 'clear';
break;
}
# 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();
'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' ),
// 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 );
}
$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" );
// 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
* @return Integer index of the current chunk
*/
private function getChunkIndex() {
- if( $this->mChunkIndex !== null ){
+ if( $this->mChunkIndex !== null ) {
return $this->mChunkIndex;
}
return 0;
* @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;
}
private function getChunkFileKey( $index = null ) {
- if( $index === null ){
+ if( $index === null ) {
$index = $this->getChunkIndex();
}
return $this->mFileKey . '.' . $index ;