Using $this->getContext()->getLanguage() instead now. In SpecialAllpages::showline
the global is still being used and a comment added. It could be argued about whether
the content language or the user language should be used in that place.
Also added some missing documentation to Language::getNamespaces.
Change-Id: If511e2d9edb0f0092f3ca0ceadabd7fdb72f6c06
* @param string $par becomes "FOO" when called like Special:Allpages/FOO (default NULL)
*/
function execute( $par ) {
* @param string $par becomes "FOO" when called like Special:Allpages/FOO (default NULL)
*/
function execute( $par ) {
$request = $this->getRequest();
$out = $this->getOutput();
$request = $this->getRequest();
$out = $this->getOutput();
$namespace = $request->getInt( 'namespace' );
$hideredirects = $request->getBool( 'hideredirects', false );
$namespace = $request->getInt( 'namespace' );
$hideredirects = $request->getBool( 'hideredirects', false );
- $namespaces = $wgContLang->getNamespaces();
+ $namespaces = $this->getContext()->getLanguage()->getNamespaces();
$out->setPageTitle(
( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) ?
$out->setPageTitle(
( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) ?
* @return string
*/
function showline( $inpoint, $outpoint, $namespace = NS_MAIN, $hideRedirects = false ) {
* @return string
*/
function showline( $inpoint, $outpoint, $namespace = NS_MAIN, $hideRedirects = false ) {
+ // Use content language since page titles are considered to use content language
global $wgContLang;
$inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
$outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
global $wgContLang;
$inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
$outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
* @param bool $hideredirects dont show redirects (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $from = false, $to = false, $hideredirects = false ) {
* @param bool $hideredirects dont show redirects (default FALSE)
*/
function showChunk( $namespace = NS_MAIN, $from = false, $to = false, $hideredirects = false ) {
$output = $this->getOutput();
$fromList = $this->getNamespaceKeyAndText( $namespace, $from );
$toList = $this->getNamespaceKeyAndText( $namespace, $to );
$output = $this->getOutput();
$fromList = $this->getNamespaceKeyAndText( $namespace, $from );
$toList = $this->getNamespaceKeyAndText( $namespace, $to );
- $namespaces = $wgContLang->getNamespaces();
+ $namespaces = $this->getContext()->getLanguage()->getNamespaces();
$n = 0;
if ( !$fromList || !$toList ) {
$n = 0;
if ( !$fromList || !$toList ) {
+ * Returns an array of localised namespaces indexed by their numbers. If the namespace is not
+ * available in localised form, it will be included in English.
+ *
* @return array
*/
public function getNamespaces() {
* @return array
*/
public function getNamespaces() {