Esempio n. 1
0
/**
 * @param string $first_chunk
 * @return bool
 */
function wfAdProviderDARTFirstChunkForHubs(&$first_chunk)
{
    global $wgTitle;
    if (!AutoHubsPagesHelper::isHubsPage($wgTitle)) {
        return true;
    }
    $first_chunk = 'wka.' . AutoHubsPagesHelper::getSiteForHub($wgTitle) . '/_' . AutoHubsPagesHelper::getHubNameFromTitle($wgTitle) . '/hub';
    return true;
}
 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;
 }
 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;
     }
 }