/**
  * Change canonical url if we are displaying WAM subpages
  *
  * @param string $url
  *
  * @return bool
  */
 public static function onWikiaCanonicalHref(&$url)
 {
     wfProfileIn(__METHOD__);
     self::init();
     $title = self::$app->wg->Title;
     if ($title instanceof Title && self::$model->isWAMPage($title) && !self::$model->isWAMFAQPage($title)) {
         $url = self::$model->getWAMMainPageUrl();
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 public function index()
 {
     $this->interlang = WikiaPageType::isCorporatePage();
     $this->response->addAsset('extensions/wikia/CorporateFooter/styles/CorporateFooter.scss');
     $helper = new WikiaHomePageHelper();
     $wikisIncludedInCorporateFooterDropdown = $helper->getWikisIncludedInCorporateFooterDropdown();
     $this->selectedLang = $this->wg->ContLang->getCode();
     $this->dropDownItems = $this->prepareDropdownItems($wikisIncludedInCorporateFooterDropdown, $this->selectedLang);
     if ($this->app->wg->EnableWAMPageExt) {
         $wamModel = new WAMPageModel();
         $this->wamPageUrl = $wamModel->getWAMMainPageUrl();
     }
 }
 /**
  * Get interstitial data.  If format is json, returns data only.  Has template.
  * @requestParam integer wikiId
  * @responseParam array wikiAdminAvatars
  * @responseParam array wikiTopEditorAvatars
  * @responseParam array wikiStats
  * @responseParam array wikiInfo
  */
 public function getInterstitial()
 {
     $this->response->setCacheValidity(WikiaResponse::CACHE_SHORT);
     $wikiId = $this->request->getVal('wikiId', 0);
     $domain = $this->request->getVal('domain', null);
     if ($wikiId == 0 && $domain != null) {
         // This is not guaranteed valid for all domains, but the custom domains in use have aliases set up
         $domain = "{$domain}.wikia.com";
         $wikiId = WikiFactory::DomainToId($domain);
         if ($wikiId == 0) {
             throw new InvalidParameterApiException("domain");
         }
     }
     if ($wikiId == 0) {
         throw new MissingParameterApiException("wikiId or domain");
     }
     $this->wikiAdminAvatars = $this->helper->getWikiAdminAvatars($wikiId);
     $this->wikiTopEditorAvatars = $this->helper->getWikiTopEditorAvatars($wikiId);
     $tempArray = array();
     foreach ($this->helper->getWikiStats($wikiId) as $key => $value) {
         $tempArray[$key] = $this->wg->Lang->formatNum($value);
     }
     $this->wikiStats = $tempArray;
     $this->wikiInfo = $this->helper->getWikiInfoForVisualization($wikiId, $this->wg->contLang->getCode());
     $images = array();
     foreach ($this->wikiInfo['images'] as $image) {
         $images[] = $this->helper->getImageDataForSlider($wikiId, $image);
     }
     if (!empty($images[0])) {
         $this->wikiMainImageUrl = $images[0]['image_url'];
     } else {
         $this->wikiMainImageUrl = $this->wg->blankImgUrl;
     }
     if (!empty($this->app->wg->EnableWAMPageExt)) {
         $wamModel = new WAMPageModel();
         $this->wamUrl = $wamModel->getWAMMainPageUrl();
         $this->wikiWamScore = $this->helper->getWamScore($wikiId);
     }
     $this->imagesSlider = $this->sendRequest('WikiaMediaCarouselController', 'renderSlider', array('data' => $images));
     $wordmarkUrl = '';
     try {
         $title = GlobalTitle::newFromText('Wiki-wordmark.png', NS_FILE, $wikiId);
         if ($title !== null) {
             $file = new GlobalFile($title);
             if ($file !== null) {
                 $wordmarkUrl = $file->getUrl();
             }
         }
     } catch (Exception $e) {
     }
     $this->wordmark = $wordmarkUrl;
 }