From: Antoine Musso Date: Wed, 24 Jul 2013 10:08:52 +0000 (+0200) Subject: SpecialPrefixindex formatting methods are now protected X-Git-Tag: 1.31.0-rc.0~18775^2~1 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=1dad021840bf936b0e130ddda3459d11f0ad8421;p=lhc%2Fweb%2Fwiklou.git SpecialPrefixindex formatting methods are now protected namespacePrefixForm() and showPrefixChunk() accepted additional arguments to slightly alter the form such as hiding redirects. The argument has been removed in favor of class property just like stripprefix introduced earlier and the method have been made protected since there is no point in calling them out of the special page scope. Change-Id: I55728fd2634f8a935a033052dcce3c7247cb1aa3 --- diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index f0490d4920..1f2b94f648 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -421,6 +421,9 @@ changes to languages because of Bugzilla reports. responsibility of classes implementing the RCFeedFormatter and RCFeedEngine interfaces to implement the formatting and delivery for recent change notifications. +* SpecialPrefixindex methods namespacePrefixForm() and showPrefixChunk() have + been made protected. They were accepting form variance arguments, this is now + using properties in the SpecialPrefixindex class. == Compatibility == diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index f2efd0f4a2..c4c5c997e6 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -34,6 +34,8 @@ class SpecialPrefixindex extends SpecialAllpages { */ protected $stripPrefix = false; + protected $hideRedirects = false; + // Inherit $maxPerPage function __construct() { @@ -59,7 +61,7 @@ class SpecialPrefixindex extends SpecialAllpages { $prefix = $request->getVal( 'prefix', '' ); $ns = $request->getIntOrNull( 'namespace' ); $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN). - $hideredirects = $request->getBool( 'hideredirects', false ); + $this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects ); $this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix ); $namespaces = $wgContLang->getNamespaces(); @@ -82,9 +84,9 @@ class SpecialPrefixindex extends SpecialAllpages { // Bug 27864: if transcluded, show all pages instead of the form. if ( $this->including() || $showme != '' || $ns !== null ) { - $this->showPrefixChunk( $namespace, $showme, $from, $hideredirects ); + $this->showPrefixChunk( $namespace, $showme, $from ); } else { - $out->addHTML( $this->namespacePrefixForm( $namespace, null, $hideredirects ) ); + $out->addHTML( $this->namespacePrefixForm( $namespace, null ) ); } } @@ -92,10 +94,9 @@ class SpecialPrefixindex extends SpecialAllpages { * HTML for the top form * @param $namespace Integer: a namespace constant (default NS_MAIN). * @param string $from dbKey we are starting listing at. - * @param bool $hideredirects hide redirects (default FALSE) * @return string */ - function namespacePrefixForm( $namespace = NS_MAIN, $from = '', $hideredirects = false ) { + protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { global $wgScript; $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); @@ -128,7 +129,7 @@ class SpecialPrefixindex extends SpecialAllpages { $this->msg( 'allpages-hide-redirects' )->text(), 'hideredirects', 'hideredirects', - $hideredirects + $this->hideRedirects ) . ' ' . Xml::checkLabel( $this->msg( 'prefixindex-strip' )->text(), @@ -151,9 +152,8 @@ class SpecialPrefixindex extends SpecialAllpages { * @param $namespace Integer, default NS_MAIN * @param $prefix String * @param string $from list all pages from this name (default FALSE) - * @param bool $hideredirects hide redirects (default FALSE) */ - function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null, $hideredirects = false ) { + protected function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) { global $wgContLang; if ( $from === null ) { @@ -184,7 +184,7 @@ class SpecialPrefixindex extends SpecialAllpages { 'page_title >= ' . $dbr->addQuotes( $fromKey ), ); - if ( $hideredirects ) { + if ( $this->hideRedirects ) { $conds['page_is_redirect'] = 0; } @@ -247,7 +247,7 @@ class SpecialPrefixindex extends SpecialAllpages { if ( $this->including() ) { $out2 = ''; } else { - $nsForm = $this->namespacePrefixForm( $namespace, $prefix, $hideredirects ); + $nsForm = $this->namespacePrefixForm( $namespace, $prefix ); $self = $this->getTitle(); $out2 = Xml::openElement( 'table', array( 'id' => 'mw-prefixindex-nav-table' ) ) . ' @@ -262,7 +262,7 @@ class SpecialPrefixindex extends SpecialAllpages { $query = array( 'from' => $s->page_title, 'prefix' => $prefix, - 'hideredirects' => $hideredirects, + 'hideredirects' => $this->hideRedirects, ); if ( $namespace || $prefix == '' ) {