X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialRecentchanges.php;h=de773800acc9456c3d1f4f8e7323091a9c99965c;hb=9ee6461287f5d2d6fae719ec62ae6465e0a3809d;hp=f030231e77bbf2e7d0f12e3cd0848a9ca07e30d2;hpb=9c7640c2439f606863d02864c2327816aa2e08b4;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php
index f030231e77..de773800ac 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -72,7 +72,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
$user = $this->getUser();
- $config = $this->getConfig();
$opts->add( 'days', $user->getIntOption( 'rcdays' ) );
$opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
@@ -84,10 +83,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$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 );
@@ -104,7 +100,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
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;
@@ -151,7 +147,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$opts['limit'] = $bit;
}
- $m = array();
+ $m = [];
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
$opts['limit'] = $m[1];
}
@@ -207,27 +203,27 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$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(
@@ -249,15 +245,15 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
// 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
@@ -277,7 +273,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
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'
);
}
@@ -320,7 +316,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$showWatcherCount = $this->getConfig()->get( 'RCShowWatchingUsers' )
&& $this->getUser()->getOption( 'shownumberswatching' );
- $watcherCache = array();
+ $watcherCache = [];
$dbr = $this->getDB();
@@ -351,10 +347,10 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$dbr->selectField(
'watchlist',
'COUNT(*)',
- array(
+ [
'wl_namespace' => $obj->rc_namespace,
'wl_title' => $obj->rc_title,
- ),
+ ],
__METHOD__ . '-watchers'
);
}
@@ -370,7 +366,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$rclistOutput .= $list->endRecentChangesList();
if ( $rows->numRows() === 0 ) {
- $this->getOutput()->addHtml(
+ $this->getOutput()->addHTML(
'
' .
$this->msg( 'recentchanges-noresult' )->parse() .
'
'
@@ -395,7 +391,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$defaults = $opts->getAllValues();
$nondefaults = $opts->getChangedValues();
- $panel = array();
+ $panel = [];
$panel[] = $this->makeLegend();
$panel[] = $this->optionsPanel( $defaults, $nondefaults, $numRows );
$panel[] = '
';
@@ -403,9 +399,9 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$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;
@@ -415,18 +411,18 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
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
);
}
@@ -441,7 +437,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$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 );
@@ -449,7 +445,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
Xml::fieldset(
$this->msg( 'recentchanges-legend' )->text(),
$panelString,
- array( 'class' => 'rcoptions' )
+ [ 'class' => 'rcoptions' ]
)
);
@@ -468,7 +464,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
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,
@@ -484,11 +480,11 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
* @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' ) ) {
@@ -502,7 +498,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
// 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;
@@ -539,22 +535,22 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
*/
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" ];
}
/**
@@ -570,7 +566,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$input .= ' ' . Xml::checkLabel( $this->msg( 'rc_categories_any' )->text(),
'categories_any', 'mw-categories_any', $opts['categories_any'] );
- return array( $label, $input );
+ return [ $label, $input ];
}
/**
@@ -587,7 +583,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
}
# Filter categories
- $cats = array();
+ $cats = [];
foreach ( $categories as $cat ) {
$cat = trim( $cat );
if ( $cat == '' ) {
@@ -597,9 +593,9 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
}
# 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();
@@ -610,7 +606,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$articles[] = $id;
}
if ( !isset( $a2r[$id] ) ) {
- $a2r[$id] = array();
+ $a2r[$id] = [];
}
$a2r[$id][] = $k;
$rowsarr[$k] = $r;
@@ -627,7 +623,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$match = $catFind->run();
# Filter
- $newrows = array();
+ $newrows = [];
foreach ( $match as $id ) {
foreach ( $a2r[$id] as $rev ) {
$k = $rev;
@@ -663,7 +659,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$text = '' . $text . '';
}
- return Linker::linkKnown( $this->getPageTitle(), $text, array(), $params );
+ return Linker::linkKnown( $this->getPageTitle(), $text, [], $params );
}
/**
@@ -710,36 +706,36 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$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'];
@@ -749,7 +745,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
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,
@@ -764,7 +760,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
}
$link = $this->makeOptionsLink( $linkMessage->text(),
- array( $key => 1 - $options[$key] ), $nondefaults );
+ [ $key => 1 - $options[$key] ], $nondefaults );
$links[] = ""
. $this->msg( $msg )->rawParams( $link )->escaped() . '';
}
@@ -781,7 +777,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
$rclistfrom = '' . $this->makeOptionsLink(
$this->msg( 'rclistfrom' )->rawParams( $now, $timenow, $datenow )->parse(),
- array( 'from' => $timestamp ),
+ [ 'from' => $timestamp ],
$nondefaults
) . '';