/** * @return null */ private function getLocalizedMediaNsString() { $this->wf->profileIn(__METHOD__); if (self::$mediaNsString === null) { $translatedNs = array(); //get all the possible variations of the File namespace //and the translation in the wiki's language foreach (array(NS_FILE, NS_IMAGE, NS_VIDEO) as $ns) { $translatedNs[] = $this->wg->ContLang->getNsText($ns); foreach ($this->wg->NamespaceAliases as $alias => $nsAlias) { if ($nsAlias == $ns) { $translatedNs[] = $alias; } } } self::$mediaNsString = implode('|', array_unique($translatedNs)); } $this->wf->profileOut(__METHOD__); return self::$mediaNsString; }
/** * @return null */ private static function getLocalizedMediaNsString() { global $wgContLang, $wgNamespaceAliases; wfProfileIn(__METHOD__); if (self::$mediaNsString === null) { $translatedNs = array(); //get all the possible variations of the File namespace //and the translation in the wiki's language $translatedNs[] = $wgContLang->getNsText(NS_FILE); foreach ($wgNamespaceAliases as $alias => $nsAlias) { if ($nsAlias == NS_FILE) { $translatedNs[] = $alias; } } self::$mediaNsString = implode('|', array_unique($translatedNs)); } wfProfileOut(__METHOD__); return self::$mediaNsString; }