From: Bartosz DziewoƄski Date: Fri, 28 Feb 2014 18:29:11 +0000 (+0100) Subject: SpecialRecentchanges: Don't use nonexistent messages for filter selector X-Git-Tag: 1.31.0-rc.0~16778^2 X-Git-Url: https://git.cyclocoop.org/%2C?a=commitdiff_plain;h=772059e915cc3e91e6fe3c11eb878e5101178bfa;p=lhc%2Fweb%2Fwiklou.git SpecialRecentchanges: Don't use nonexistent messages for filter selector Extensions can defined additional filters, but don't need to define the corresponding messages. If they don't exist, just fall back to 'show' and 'hide'. This also fixes the double-escaping of selector link contents and adds missing entries to the list of messages used here. Follow-up to Ibbfc3cd0. Bug: 58449 Change-Id: Id323e3b7daced1e7b6b1e1add4e9e1bf7df05e4e --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index ed290191fa..f5a5206bcf 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -722,12 +722,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage { 'hidemyself' => 'rcshowhidemine' ); - // The following messages are also used as the link text itself: - // rcshowhideminor-show, rcshowhideminor-hide, - // rcshowhidebots-show, rcshowhideminor-hide, - // rcshowhideanons-show, rcshowhideanons-hide, - // rcshowhidepatr-show, rcshowhidepatr-hide, - // rcshowhidemine-show, rcshowhidemine-hide. $showhide = array( 'show', 'hide' ); foreach ( $this->getCustomFilters() as $key => $params ) { @@ -740,7 +734,18 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $links = array(); foreach ( $filters as $key => $msg ) { - $link = $this->makeOptionsLink( $this->msg( $msg . '-' . $showhide[1 - $options[$key]] ), + // The following messages are used here: + // rcshowhideminor-show, rcshowhideminor-hide, rcshowhidebots-show, rcshowhidebots-hide, + // rcshowhideanons-show, rcshowhideanons-hide, rcshowhideliu-show, rcshowhideliu-hide, + // rcshowhidepatr-show, rcshowhidepatr-hide, rcshowhidemine-show, rcshowhidemine-hide. + $linkMessage = $this->msg( $msg . '-' . $showhide[1 - $options[$key]] ); + // Extensions can define additional filters, but don't need to define the corresponding + // messages. If they don't exist, just fall back to 'show' and 'hide'. + if ( !$linkMessage->exists() ) { + $linkMessage = $this->msg( $showhide[1 - $options[$key]] ); + } + + $link = $this->makeOptionsLink( $linkMessage->text(), array( $key => 1 - $options[$key] ), $nondefaults ); $links[] = $this->msg( $msg )->rawParams( $link )->escaped(); }