function execute($par)
 {
     global $wgOut, $wgCityId, $wgSuppressWikiHeader, $wgSuppressPageHeader, $wgShowMyToolsOnly, $wgExtensionsPath, $wgBlankImgUrl, $wgJsMimeType, $wgTitle, $wgUser, $wgRequest;
     wfProfileIn(__METHOD__);
     // redirect to www.wikia.com
     if ($wgCityId == 177) {
         $destServer = WikiFactory::getVarValueByName('wgServer', $this->destCityId);
         $destArticlePath = WikiFactory::getVarValueByName('wgArticlePath', $this->destCityId);
         $wgOut->redirect($destServer . str_replace('$1', 'Special:LandingPage', $destArticlePath));
         return;
     }
     $this->setHeaders();
     $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/LandingPage/css/LandingPage.scss'));
     // hide wiki and page header
     $wgSuppressWikiHeader = true;
     $wgSuppressPageHeader = true;
     // only shown "My Tools" on floating toolbar
     $wgShowMyToolsOnly = true;
     // parse language links (RT #71622)
     $languageLinks = array();
     $parsedMsg = wfStringToArray(wfMsg('landingpage-language-links'), '*', 10);
     foreach ($parsedMsg as $item) {
         if ($item != '') {
             list($text, $lang) = explode('|', $item);
             $languageLinks[] = array('text' => $text, 'href' => $wgTitle->getLocalUrl("uselang={$lang}"));
         }
     }
     // fetching the landingpage sites
     $landingPageLinks = CorporatePageHelper::parseMsgImg('landingpage-sites', false, false);
     // render HTML
     $template = new EasyTemplate(dirname(__FILE__) . '/templates');
     $template->set_vars(array('imagesPath' => $wgExtensionsPath . '/wikia/LandingPage/images/', 'languageLinks' => $languageLinks, 'wgBlankImgUrl' => $wgBlankImgUrl, 'wgTitle' => $wgTitle, 'landingPageLinks' => $landingPageLinks, 'landingPageSearch' => F::app()->getView("SearchController", "Index", array("placeholder" => "Search Wikia", "fulltext" => "0", "wgBlankImgUrl" => $wgBlankImgUrl, "wgTitle" => $wgTitle))));
     $wgOut->addHTML($template->render('main'));
     wfProfileOut(__METHOD__);
 }
 public function prepareData()
 {
     global $wgTitle, $wgUser, $wgCont;
     $pars = array();
     $pars['slider'] = array();
     $lang = AutoHubsPagesHelper::getLangForHub($wgTitle);
     $data = AutoHubsPagesData::newFromTagTitle($wgTitle);
     $tagname = AutoHubsPagesHelper::getHubNameFromTitle($wgTitle);
     $vars = AutoHubsPagesHelper::getHubsFeedsVariable($tagname);
     $isManager = $wgUser->isAllowed('corporatepagemanager');
     $datafeeds = new WikiaStatsAutoHubsConsumerDB(DB_SLAVE);
     $tag_id = AutoHubsPagesHelper::getHubIdFromTitle($wgTitle);
     $tag_name = AutoHubsPagesHelper::getHubNameFromTitle($wgTitle);
     $pars['tagname'] = $tag_name;
     $pars['title'] = $wgTitle;
     $pars['var_feeds'] = $vars[$tag_name];
     $pars['is_manager'] = $isManager;
     $pars['tag_id'] = $tag_id;
     if ($isManager) {
         $temp = $datafeeds->getTopWikis($tag_id, $lang, 30, true, true);
         $pars['topWikis1'] = $temp['value'];
     } else {
         $temp = $datafeeds->getTopWikis($tag_id, $lang, 10, false);
         $pars['topWikis1'] = $temp['value'];
     }
     $temp = $datafeeds->getTopUsers($tag_id, $lang, 5);
     $pars['topEditors'] = $temp['value'];
     if ($isManager) {
         $temp = $datafeeds->getTopBlogs($tag_id, $lang, 9, 3, true, true);
     } else {
         $temp = $datafeeds->getTopBlogs($tag_id, $lang, 3, 1);
     }
     $pars['topBlogs'] = $temp['value'];
     if ($isManager) {
         $temp = $datafeeds->getTopArticles($tag_id, $lang, 15, 3, true, true, true);
     } else {
         $temp = $datafeeds->getTopArticles($tag_id, $lang, 5, 1, false, false, true);
     }
     $pars['hotSpots'] = $temp['value'];
     $pars['slider'] = CorporatePageHelper::parseMsgImg('hub-' . $tag_name . '-slider', true);
     $pars['wikia_whats_up'] = wfMsgExt("corporatepage-wikia-whats-up", array("parsemag"));
     return $pars;
 }
	function testParser3() {
		global $wgMessageCache;
		$test_msg =
			'*http://test1A.wikia.com|test1A|test1AX|img1|img2
			 *http://test2A.wikia.com|test2A|test2AX|img1|img2
			 *http://test3A.wikia.com|test3A|test3AX|img1|img2';

		$wgMessageCache->addMessage('corporate-page-test-paresr1' , $test_msg );
		$array = CorporatePageHelper::parseMsgImg('corporate-page-test-paresr1',true);
		$this->assertEquals('test2A', $array[1]['title']);
		$this->assertEquals('http://test1A.wikia.com', $array[0]['href'] );
	}
 public function executeSlider()
 {
     global $wgOut, $wgTitle, $wgParser;
     if (BodyController::isHubPage()) {
         $this->slider_class = "small";
         $tag_name = AutoHubsPagesHelper::getHubNameFromTitle($wgTitle);
         // Beware: the true/false at the end is important, it actually changes the return format slightly
         $this->slider = CorporatePageHelper::parseMsgImg('hub-' . $tag_name . '-slider', false);
         // render slider's HTML using WikiaPhotoGallery (BugId:8478)
         $slider = new WikiaPhotoGallery();
         $slider->setParser($wgParser);
         $wgParser->startExternalParse($wgTitle, new ParserOptions(), Parser::OT_HTML);
         $slider->parseParams(array('type' => 'slider', 'orientation' => 'bottom'));
         // add images
         $sliderWikitext = '';
         foreach ($this->slider as $image) {
             // ElmoControlRoom.jpg|Label|link=http://wikia.com|linktext=Link text
             // if parsgMsgImg has a thumbnail or the 2nd param=true (and right now it is not) then the return vals move around
             if (isset($image['param'])) {
                 // no thumbnail in msg
                 $sliderWikitext .= "{$image['param']}|{$image['title']}|link={$image['href']}|linktext={$image['imagetitle']}\n";
             } else {
                 // has thumbnail in msg
                 $sliderWikitext .= "{$image['imagetitle']}|{$image['title']}|link={$image['href']}|linktext={$image['desc']}\n";
             }
         }
         // set the content and parse it
         $slider->setText($sliderWikitext);
         $slider->parse();
         // render it
         $this->sliderHtml = $slider->toHTML();
     }
     if (WikiaPageType::isMainPage()) {
         $this->isMainPage = true;
         $this->slider_class = "big";
         $this->slider = CorporatePageHelper::parseMsgImg('corporatepage-slider', true);
     } else {
         $this->isMainPage = false;
     }
 }