X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecialpage%2FChangesListSpecialPage.php;h=0966f80954183cd4fd7cff6bcd5b647b59b64fc6;hb=e3bd13db0c285f312e31bb1b7271af4628cca80c;hp=093831648866aca75ef2b6b9da0a99b0294ce7e5;hpb=3064c32d822dbd05306ae2b531159b2a68e81e80;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 0938316488..0966f80954 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -136,6 +136,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @return FormOptions */ public function getDefaultOptions() { + $config = $this->getConfig(); $opts = new FormOptions(); $opts->add( 'hideminor', false ); @@ -144,7 +145,10 @@ abstract class ChangesListSpecialPage extends SpecialPage { $opts->add( 'hideliu', false ); $opts->add( 'hidepatrolled', false ); $opts->add( 'hidemyself', false ); - $opts->add( 'hidecategorization', false ); + + if ( $config->get( 'RCWatchCategoryMembership' ) ) { + $opts->add( 'hidecategorization', false ); + } $opts->add( 'namespace', '', FormOptions::INTNULL ); $opts->add( 'invert', false ); @@ -160,8 +164,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { */ protected function getCustomFilters() { if ( $this->customFilters === null ) { - $this->customFilters = array(); - Hooks::run( 'ChangesListSpecialPageFilters', array( $this, &$this->customFilters ) ); + $this->customFilters = []; + Hooks::run( 'ChangesListSpecialPageFilters', [ $this, &$this->customFilters ] ); } return $this->customFilters; @@ -209,7 +213,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { public function buildMainQueryConds( FormOptions $opts ) { $dbr = $this->getDB(); $user = $this->getUser(); - $conds = array(); + $conds = []; // It makes no sense to hide both anons and logged-in users. When this occurs, try a guess on // what the user meant and either show only bots or force anons to be shown. @@ -250,7 +254,9 @@ abstract class ChangesListSpecialPage extends SpecialPage { $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $user->getName() ); } } - if ( $opts['hidecategorization'] === true ) { + if ( $this->getConfig()->get( 'RCWatchCategoryMembership' ) + && $opts['hidecategorization'] === true + ) { $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE ); } @@ -287,10 +293,10 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @return bool|ResultWrapper Result or false */ public function doMainQuery( $conds, $opts ) { - $tables = array( 'recentchanges' ); + $tables = [ 'recentchanges' ]; $fields = RecentChange::selectFields(); - $query_options = array(); - $join_conds = array(); + $query_options = []; + $join_conds = []; ChangeTags::modifyDisplayQuery( $tables, @@ -324,7 +330,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { ) { return Hooks::run( 'ChangesListSpecialPageQuery', - array( $this->getName(), &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) + [ $this->getName(), &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ] ); } @@ -387,7 +393,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { * * @param FormOptions $opts */ - function setTopText( FormOptions $opts ) { + public function setTopText( FormOptions $opts ) { // nothing by default } @@ -397,7 +403,7 @@ abstract class ChangesListSpecialPage extends SpecialPage { * * @param FormOptions $opts */ - function setBottomText( FormOptions $opts ) { + public function setBottomText( FormOptions $opts ) { // nothing by default } @@ -409,19 +415,17 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @param FormOptions $opts * @return array */ - function getExtraOptions( $opts ) { - return array(); + public function getExtraOptions( $opts ) { + return []; } /** * Return the legend displayed within the fieldset - * @todo This should not be static, then we can drop the parameter - * @todo Not called by anything, should be called by doHeader() * - * @param IContextSource $context The object available as $this in non-static functions * @return string */ - public static function makeLegend( IContextSource $context ) { + public function makeLegend() { + $context = $this->getContext(); $user = $context->getUser(); # The legend showing what the letters and stuff mean $legend = Html::openElement( 'dl' ) . "\n"; @@ -436,21 +440,21 @@ abstract class ChangesListSpecialPage extends SpecialPage { $cssClass = isset( $item['class'] ) ? $item['class'] : $key; $legend .= Html::element( 'dt', - array( 'class' => $cssClass ), $context->msg( $letter )->text() + [ 'class' => $cssClass ], $context->msg( $letter )->text() ) . "\n" . Html::rawElement( 'dd', - array( 'class' => Sanitizer::escapeClass( 'mw-changeslist-legend-' . $key ) ), + [ 'class' => Sanitizer::escapeClass( 'mw-changeslist-legend-' . $key ) ], $context->msg( $label )->parse() ) . "\n"; } # (+-123) $legend .= Html::rawElement( 'dt', - array( 'class' => 'mw-plusminus-pos' ), + [ 'class' => 'mw-plusminus-pos' ], $context->msg( 'recentchanges-legend-plusminus' )->parse() ) . "\n"; $legend .= Html::element( 'dd', - array( 'class' => 'mw-changeslist-legend-plusminus' ), + [ 'class' => 'mw-changeslist-legend-plusminus' ], $context->msg( 'recentchanges-label-plusminus' )->text() ) . "\n"; $legend .= Html::closeElement( 'dl' ) . "\n";