/** * @param OutputPage $out * @param string &$html * * @return bool */ public function doOutputPageBeforeHTML(OutputPage $out, &$html) { $placeholders = $out->getProperty('wikibase-view-chunks'); if (!empty($placeholders)) { $injector = new TextInjector($placeholders); $expander = $this->getEntityViewPlaceholderExpander($out); $html = $injector->inject($html, array($expander, 'getHtmlForPlaceholder')); $out->addJsConfigVars('wbUserSpecifiedLanguages', array_values(array_intersect($this->userLanguageLookup->getUserSpecifiedLanguages($out->getUser()), $this->termsLanguages->getLanguages()))); } }
/** * Returns a list of languages desired by the user in addition to the current interface language. * * @see UserLanguageLookup * * @return string[] */ public function getExtraUserLanguages() { if ($this->extraLanguages === null) { if ($this->user->isAnon()) { // no extra languages for anon user $this->extraLanguages = array(); } else { // ignore current interface language $skip = array($this->uiLanguage->getCode()); $langs = array_diff($this->userLanguageLookup->getAllUserLanguages($this->user), $skip); // Make sure we only report actual term languages $this->extraLanguages = array_intersect($langs, $this->termsLanguages->getLanguages()); } } return $this->extraLanguages; }