/** * 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; }
/** * 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() { $wikiId = $this->request->getVal('wikiId', 0); $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; } $this->imagesSlider = $this->sendRequest('WikiaMediaCarouselController', 'renderSlider', array('data' => $images)); }