/** * @author Inez Korczynski <*****@*****.**> */ private function getWikiaFooterLinks() { wfProfileIn( __METHOD__ ); global $wgCityId; $catId = WikiFactoryHub::getInstance()->getCategoryId( $wgCityId ); $message_key = 'shared-Oasis-footer-wikia-links'; $nodes = array(); if ( !isset( $catId ) || null == ( $lines = getMessageAsArray( $message_key . '-' . $catId ) ) ) { if ( null == ( $lines = getMessageAsArray( $message_key ) ) ) { wfProfileOut( __METHOD__ ); return $nodes; } } foreach( $lines as $line ) { $depth = strrpos( $line, '*' ); if( $depth === 0 ) { $nodes[] = parseItem( $line ); } } wfProfileOut( __METHOD__ ); return $nodes; }
private function getGlobalFooterLinks() { global $wgCityId, $wgContLang, $wgLang, $wgMemc; wfProfileIn(__METHOD__); $verticalId = WikiFactoryHub::getInstance()->getVerticalId($wgCityId); $memcKey = wfSharedMemcKey(self::MEMC_KEY_GLOBAL_FOOTER_LINKS, $wgContLang->getCode(), $wgLang->getCode(), $verticalId, self::MEMC_KEY_GLOBAL_FOOTER_VERSION); $globalFooterLinks = $wgMemc->get($memcKey); if (!empty($globalFooterLinks)) { wfProfileOut(__METHOD__); return $globalFooterLinks; } if (is_null($globalFooterLinks = getMessageAsArray(self::MESSAGE_KEY_GLOBAL_FOOTER_LINKS . '-' . $verticalId))) { if (is_null($globalFooterLinks = getMessageAsArray(self::MESSAGE_KEY_GLOBAL_FOOTER_LINKS))) { wfProfileOut(__METHOD__); WikiaLogger::instance()->error("Global Footer's links not found in messages", ['exception' => new Exception()]); return []; } } $parsedLinks = []; foreach ($globalFooterLinks as $link) { $link = trim($link); if (strpos($link, '*') === 0) { $parsedLink = parseItem($link); if (strpos($parsedLink['text'], 'LICENSE') !== false || $parsedLink['text'] == 'GFDL') { $parsedLink['isLicense'] = true; } else { $parsedLink['isLicense'] = false; } $parsedLinks[] = $parsedLink; } } $wgMemc->set($memcKey, $parsedLinks, self::MEMC_EXPIRY); wfProfileOut(__METHOD__); return $parsedLinks; }