public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
$user = $this->getUser();
- $config = $this->getConfig();
$opts->add( 'days', $user->getIntOption( 'rcdays' ) );
$opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
$opts->add( 'hideliu', false );
$opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) );
$opts->add( 'hidemyself', false );
-
- if ( $config->get( 'RCWatchCategoryMembership' ) ) {
- $opts->add( 'hidecategorization', $user->getBoolOption( 'hidecategorization' ) );
- }
+ $opts->add( 'hidecategorization', $user->getBoolOption( 'hidecategorization' ) );
$opts->add( 'categories', '' );
$opts->add( 'categories_any', false );
protected function getCustomFilters() {
if ( $this->customFilters === null ) {
$this->customFilters = parent::getCustomFilters();
- Hooks::run( 'SpecialRecentChangesFilters', array( $this, &$this->customFilters ), '1.23' );
+ Hooks::run( 'SpecialRecentChangesFilters', [ $this, &$this->customFilters ], '1.23' );
}
return $this->customFilters;
$opts['limit'] = $bit;
}
- $m = array();
+ $m = [];
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
$opts['limit'] = $m[1];
}
$dbr = $this->getDB();
$user = $this->getUser();
- $tables = array( 'recentchanges' );
+ $tables = [ 'recentchanges' ];
$fields = RecentChange::selectFields();
- $query_options = array();
- $join_conds = array();
+ $query_options = [];
+ $join_conds = [];
// JOIN on watchlist for users
if ( $user->getId() && $user->isAllowed( 'viewmywatchlist' ) ) {
$tables[] = 'watchlist';
$fields[] = 'wl_user';
$fields[] = 'wl_notificationtimestamp';
- $join_conds['watchlist'] = array( 'LEFT JOIN', array(
+ $join_conds['watchlist'] = [ 'LEFT JOIN', [
'wl_user' => $user->getId(),
'wl_title=rc_title',
'wl_namespace=rc_namespace'
- ) );
+ ] ];
}
if ( $user->isAllowed( 'rollback' ) ) {
$tables[] = 'page';
$fields[] = 'page_latest';
- $join_conds['page'] = array( 'LEFT JOIN', 'rc_cur_id=page_id' );
+ $join_conds['page'] = [ 'LEFT JOIN', 'rc_cur_id=page_id' ];
}
ChangeTags::modifyDisplayQuery(
// they so desire, override the ORDER BY / LIMIT condition(s); prior to
// MediaWiki 1.26 this used to use the plus operator instead, which meant
// that extensions weren't able to change these conditions
- $query_options = array_merge( array(
+ $query_options = array_merge( [
'ORDER BY' => 'rc_timestamp DESC',
- 'LIMIT' => $opts['limit'] ), $query_options );
+ 'LIMIT' => $opts['limit'] ], $query_options );
$rows = $dbr->select(
$tables,
$fields,
// rc_new is not an ENUM, but adding a redundant rc_new IN (0,1) gives mysql enough
// knowledge to use an index merge if it wants (it may use some other index though).
- $conds + array( 'rc_new' => array( 0, 1 ) ),
+ $conds + [ 'rc_new' => [ 0, 1 ] ],
__METHOD__,
$query_options,
$join_conds
return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts )
&& Hooks::run(
'SpecialRecentChangesQuery',
- array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ),
+ [ &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ],
'1.23'
);
}
$showWatcherCount = $this->getConfig()->get( 'RCShowWatchingUsers' )
&& $this->getUser()->getOption( 'shownumberswatching' );
- $watcherCache = array();
+ $watcherCache = [];
$dbr = $this->getDB();
$dbr->selectField(
'watchlist',
'COUNT(*)',
- array(
+ [
'wl_namespace' => $obj->rc_namespace,
'wl_title' => $obj->rc_title,
- ),
+ ],
__METHOD__ . '-watchers'
);
}
$rclistOutput .= $list->endRecentChangesList();
if ( $rows->numRows() === 0 ) {
- $this->getOutput()->addHtml(
+ $this->getOutput()->addHTML(
'<div class="mw-changeslist-empty">' .
$this->msg( 'recentchanges-noresult' )->parse() .
'</div>'
$defaults = $opts->getAllValues();
$nondefaults = $opts->getChangedValues();
- $panel = array();
- $panel[] = self::makeLegend( $this->getContext() );
+ $panel = [];
+ $panel[] = $this->makeLegend();
$panel[] = $this->optionsPanel( $defaults, $nondefaults, $numRows );
$panel[] = '<hr />';
$extraOpts = $this->getExtraOptions( $opts );
$extraOptsCount = count( $extraOpts );
$count = 0;
- $submit = ' ' . Xml::submitbutton( $this->msg( 'recentchanges-submit' )->text() );
+ $submit = ' ' . Xml::submitButton( $this->msg( 'recentchanges-submit' )->text() );
- $out = Xml::openElement( 'table', array( 'class' => 'mw-recentchanges-table' ) );
+ $out = Xml::openElement( 'table', [ 'class' => 'mw-recentchanges-table' ] );
foreach ( $extraOpts as $name => $optionRow ) {
# Add submit button to the last row only
++$count;
if ( is_array( $optionRow ) ) {
$out .= Xml::tags(
'td',
- array( 'class' => 'mw-label mw-' . $name . '-label' ),
+ [ 'class' => 'mw-label mw-' . $name . '-label' ],
$optionRow[0]
);
$out .= Xml::tags(
'td',
- array( 'class' => 'mw-input' ),
+ [ 'class' => 'mw-input' ],
$optionRow[1] . $addSubmit
);
} else {
$out .= Xml::tags(
'td',
- array( 'class' => 'mw-input', 'colspan' => 2 ),
+ [ 'class' => 'mw-input', 'colspan' => 2 ],
$optionRow . $addSubmit
);
}
$t = $this->getPageTitle();
$out .= Html::hidden( 'title', $t->getPrefixedText() );
- $form = Xml::tags( 'form', array( 'action' => wfScript() ), $out );
+ $form = Xml::tags( 'form', [ 'action' => wfScript() ], $out );
$panel[] = $form;
$panelString = implode( "\n", $panel );
Xml::fieldset(
$this->msg( 'recentchanges-legend' )->text(),
$panelString,
- array( 'class' => 'rcoptions' )
+ [ 'class' => 'rcoptions' ]
)
);
if ( !$message->isDisabled() ) {
$this->getOutput()->addWikiText(
Html::rawElement( 'div',
- array( 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ),
+ [ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
"\n" . $message->plain() . "\n"
),
/* $lineStart */ true,
* @return array
*/
function getExtraOptions( $opts ) {
- $opts->consumeValues( array(
+ $opts->consumeValues( [
'namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'
- ) );
+ ] );
- $extraOpts = array();
+ $extraOpts = [];
$extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
if ( $this->getConfig()->get( 'AllowCategorizedRecentChanges' ) ) {
// Don't fire the hook for subclasses. (Or should we?)
if ( $this->getName() === 'Recentchanges' ) {
- Hooks::run( 'SpecialRecentChangesPanel', array( &$extraOpts, $opts ) );
+ Hooks::run( 'SpecialRecentChangesPanel', [ &$extraOpts, $opts ] );
}
return $extraOpts;
*/
protected function namespaceFilterForm( FormOptions $opts ) {
$nsSelect = Html::namespaceSelector(
- array( 'selected' => $opts['namespace'], 'all' => '' ),
- array( 'name' => 'namespace', 'id' => 'namespace' )
+ [ 'selected' => $opts['namespace'], 'all' => '' ],
+ [ 'name' => 'namespace', 'id' => 'namespace' ]
);
$nsLabel = Xml::label( $this->msg( 'namespace' )->text(), 'namespace' );
$invert = Xml::checkLabel(
$this->msg( 'invert' )->text(), 'invert', 'nsinvert',
$opts['invert'],
- array( 'title' => $this->msg( 'tooltip-invert' )->text() )
+ [ 'title' => $this->msg( 'tooltip-invert' )->text() ]
);
$associated = Xml::checkLabel(
$this->msg( 'namespace_association' )->text(), 'associated', 'nsassociated',
$opts['associated'],
- array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
+ [ 'title' => $this->msg( 'tooltip-namespace_association' )->text() ]
);
- return array( $nsLabel, "$nsSelect $invert $associated" );
+ return [ $nsLabel, "$nsSelect $invert $associated" ];
}
/**
$input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
'categories_any', 'mw-categories_any', $opts['categories_any'] );
- return array( $label, $input );
+ return [ $label, $input ];
}
/**
}
# Filter categories
- $cats = array();
+ $cats = [];
foreach ( $categories as $cat ) {
$cat = trim( $cat );
if ( $cat == '' ) {
}
# Filter articles
- $articles = array();
- $a2r = array();
- $rowsarr = array();
+ $articles = [];
+ $a2r = [];
+ $rowsarr = [];
foreach ( $rows as $k => $r ) {
$nt = Title::makeTitle( $r->rc_namespace, $r->rc_title );
$id = $nt->getArticleID();
$articles[] = $id;
}
if ( !isset( $a2r[$id] ) ) {
- $a2r[$id] = array();
+ $a2r[$id] = [];
}
$a2r[$id][] = $k;
$rowsarr[$k] = $r;
$match = $catFind->run();
# Filter
- $newrows = array();
+ $newrows = [];
foreach ( $match as $id ) {
foreach ( $a2r[$id] as $rev ) {
$k = $rev;
$text = '<strong>' . $text . '</strong>';
}
- return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
+ return Linker::linkKnown( $this->getPageTitle(), $text, [], $params );
}
/**
$linkDays = array_unique( $linkDays );
// limit links
- $cl = array();
+ $cl = [];
foreach ( $linkLimits as $value ) {
$cl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
- array( 'limit' => $value ), $nondefaults, $value == $options['limit'] );
+ [ 'limit' => $value ], $nondefaults, $value == $options['limit'] );
}
$cl = $lang->pipeList( $cl );
// day links, reset 'from' to none
- $dl = array();
+ $dl = [];
foreach ( $linkDays as $value ) {
$dl[] = $this->makeOptionsLink( $lang->formatNum( $value ),
- array( 'days' => $value, 'from' => '' ), $nondefaults, $value == $options['days'] );
+ [ 'days' => $value, 'from' => '' ], $nondefaults, $value == $options['days'] );
}
$dl = $lang->pipeList( $dl );
// show/hide links
- $filters = array(
+ $filters = [
'hideminor' => 'rcshowhideminor',
'hidebots' => 'rcshowhidebots',
'hideanons' => 'rcshowhideanons',
'hideliu' => 'rcshowhideliu',
'hidepatrolled' => 'rcshowhidepatr',
'hidemyself' => 'rcshowhidemine'
- );
+ ];
if ( $config->get( 'RCWatchCategoryMembership' ) ) {
$filters['hidecategorization'] = 'rcshowhidecategorization';
}
- $showhide = array( 'show', 'hide' );
+ $showhide = [ 'show', 'hide' ];
foreach ( $this->getCustomFilters() as $key => $params ) {
$filters[$key] = $params['msg'];
unset( $filters['hidepatrolled'] );
}
- $links = array();
+ $links = [];
foreach ( $filters as $key => $msg ) {
// The following messages are used here:
// rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide,
}
$link = $this->makeOptionsLink( $linkMessage->text(),
- array( $key => 1 - $options[$key] ), $nondefaults );
+ [ $key => 1 - $options[$key] ], $nondefaults );
$links[] = "<span class=\"$msg rcshowhideoption\">"
. $this->msg( $msg )->rawParams( $link )->escaped() . '</span>';
}
$rclistfrom = '<span class="rclistfrom">' . $this->makeOptionsLink(
$this->msg( 'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
- array( 'from' => $timestamp ),
+ [ 'from' => $timestamp ],
$nondefaults
) . '</span>';