public static function getLiftiumOptionsScript()
 {
     wfProfileIn(__METHOD__);
     global $wgDBname, $wgTitle, $wgLang, $wgDartCustomKeyValues, $wgCityId;
     // See Liftium.js for documentation on options
     $options = array();
     $options['pubid'] = 999;
     $options['baseUrl'] = '/__varnish_liftium/';
     $options['kv_wgDBname'] = $wgDBname;
     if (is_object($wgTitle)) {
         $options['kv_article_id'] = $wgTitle->getArticleID();
         $options['kv_wpage'] = $wgTitle->getPartialURL();
     }
     $hub = WikiFactoryHub::getInstance();
     $options['kv_Hub'] = $hub->getCategoryName($wgCityId);
     $options['kv_skin'] = RequestContext::getMain()->getSkin()->getSkinName();
     $options['kv_user_lang'] = $wgLang->getCode();
     $options['kv_cont_lang'] = $GLOBALS['wgLanguageCode'];
     $options['kv_isMainPage'] = WikiaPageType::isMainPage();
     $options['kv_page_type'] = WikiaPageType::getPageType();
     $options['geoUrl'] = "http://geoiplookup.wikia.com/";
     if (!empty($wgDartCustomKeyValues)) {
         $options['kv_dart'] = $wgDartCustomKeyValues;
     }
     $options['kv_domain'] = $_SERVER['HTTP_HOST'];
     $options['hasMoreCalls'] = true;
     $options['isCalledAfterOnload'] = true;
     $options['maxLoadDelay'] = 6000;
     $js = "LiftiumOptions = " . json_encode($options) . ";\n";
     $out = "\n<!-- Liftium options -->\n";
     $out .= Html::inlineScript($js) . "\n";
     wfProfileOut(__METHOD__);
     return $out;
 }
 public function searchIndex()
 {
     global $wgRequest, $wgSitename, $wgUser;
     $lang = $this->helper->getLangForSearchResults();
     $centralUrl = $this->helper->getCentralUrlFromGlobalTitle($lang);
     $globalSearchUrl = $this->helper->getGlobalSearchUrl($centralUrl);
     $localSearchUrl = SpecialPage::getTitleFor('Search')->getFullUrl();
     $fulltext = $wgUser->getGlobalPreference('enableGoSearch') ? 0 : 'Search';
     $query = $wgRequest->getVal('search', $wgRequest->getVal('query', ''));
     $localSearchPlaceholder = html_entity_decode(wfMessage('global-navigation-local-search-placeholder', $wgSitename)->parse());
     if (WikiaPageType::isCorporatePage() && !WikiaPageType::isWikiaHub()) {
         $this->response->setVal('disableLocalSearchOptions', true);
         $this->response->setVal('defaultSearchPlaceholder', wfMessage('global-navigation-global-search')->escaped());
         $this->response->setVal('defaultSearchUrl', $globalSearchUrl);
     } else {
         $this->response->setVal('globalSearchUrl', $globalSearchUrl);
         $this->response->setVal('localSearchUrl', $localSearchUrl);
         $this->response->setVal('localSearchPlaceholder', $localSearchPlaceholder);
         $this->response->setVal('defaultSearchPlaceholder', $localSearchPlaceholder);
         $this->response->setVal('defaultSearchUrl', $localSearchUrl);
     }
     $this->response->setVal('fulltext', $fulltext);
     $this->response->setVal('query', $query);
     $this->response->setVal('lang', $lang);
 }
Пример #3
0
 /**
  * Check if the page is sitemap page
  * @param Title $title
  * @return bool
  */
 public function isSitemapPage($title)
 {
     if (WikiaPageType::isCorporatePage() && $title->getDBkey() == self::SITEMAP_PAGE) {
         return true;
     }
     return false;
 }
Пример #4
0
 private function getTag()
 {
     $dbname = F::app()->wg->DBname;
     $t = F::app()->wg->Title;
     $title = $t->getText();
     if ($dbname == 'dehauptseite') {
         if (Wikia::isMainPage()) {
             return 'RC_WIKIA_HOME';
         }
         if (strpos($title, 'Mobil') === 0) {
             return 'RC_WIKIA_MOBIL';
         }
         if (in_array($title, array('Videospiele', 'Entertainment', 'Lifestyle'))) {
             return 'RC_WIKIA_START';
         }
         if (WikiaPageType::getPageType() == 'search') {
             return 'RC_WIKIA_SEARCH';
         }
         return 'RC_WIKIA_SVCE';
     }
     if ($dbname == 'de') {
         if ($t->getNamespace() == NS_FORUM) {
             return 'RC_WIKIA_PIN';
         }
         return 'RC_WIKIA_COMMUNITY';
     }
     if (HubService::getComscoreCategory(F::app()->wg->CityId)->cat_name == 'Entertainment') {
         return 'RC_WIKIA_UGCENT';
     }
     return 'RC_WIKIA_UGC';
 }
 public function executeIndex()
 {
     OasisController::addBodyClass('wikinav2');
     $themeSettings = new ThemeSettings();
     $settings = $themeSettings->getSettings();
     $this->wordmarkText = $settings["wordmark-text"];
     $this->wordmarkType = $settings["wordmark-type"];
     $this->wordmarkSize = $settings["wordmark-font-size"];
     $this->wordmarkFont = $settings["wordmark-font"];
     if ($this->wordmarkType == "graphic") {
         wfProfileIn(__METHOD__ . 'graphicWordmarkV2');
         $this->wordmarkUrl = $themeSettings->getWordmarkUrl();
         $imageTitle = Title::newFromText($themeSettings::WordmarkImageName, NS_IMAGE);
         if ($imageTitle instanceof Title) {
             $attributes = array();
             $file = wfFindFile($imageTitle);
             if ($file instanceof File) {
                 $attributes[] = 'width="' . $file->width . '"';
                 $attributes[] = 'height="' . $file->height . '"';
                 if (!empty($attributes)) {
                     $this->wordmarkStyle = ' ' . implode(' ', $attributes) . ' ';
                 }
             }
         }
         wfProfileOut(__METHOD__ . 'graphicWordmarkV2');
     }
     $this->mainPageURL = Title::newMainPage()->getLocalURL();
     $this->displaySearch = !empty($this->wg->EnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this, $this->wg->Title);
     $this->setVal('displayHeader', !$this->wg->HideNavigationHeaders);
     $this->displayHeaderButtons = !WikiaPageType::isWikiaHubMain();
 }
Пример #6
0
 public function executeIndex()
 {
     $this->setVal('specialSearchUrl', SpecialPage::getTitleFor('Search')->getFullUrl());
     $this->searchterm = $this->wg->request->getVal('search');
     if (!isset($this->searchterm)) {
         $this->searchterm = $this->request->getVal('search');
     }
     $this->noautocomplete = $this->wg->request->getVal('noautocomplete');
     if (!isset($this->noautocomplete)) {
         $this->noautocomplete = $this->request->getVal('noautocomplete');
     }
     $searchParams = [];
     if (!$this->request->getVal('nonamespaces', false)) {
         $namespaces = $this->getNamespaceFromRequest();
         foreach ($namespaces as $namespaceInt) {
             $searchParams['ns' . $namespaceInt] = 1;
         }
     }
     if ($this->wg->CityId == Wikia\Search\QueryService\Select\Dismax\Video::VIDEO_WIKI_ID) {
         $searchParams['filters[]'] = 'is_video';
         // this is required to hide images
         $searchParams['rank'] = 'default';
         // this is required to keep urls consistent between search and non-search pages
     }
     $this->searchParams = $searchParams;
     $this->fulltext = $this->wg->User->getGlobalPreference('enableGoSearch') ? 0 : 'Search';
     $this->placeholder = WikiaPageType::isWikiaHub() ? wfMessage('wikiahubs-search-placeholder')->text() : wfMessage('Tooltip-search', $this->wg->Sitename)->text();
     $this->isCrossWikiaSearch = $this->wg->request->getCheck('crossWikiaSearch');
     $this->searchFormId = $this->request->getVal('searchFormId');
 }
Пример #7
0
 public static function onWikiaMobileAssetsPackages(array &$jsHeadPackages, array &$jsBodyPackages, array &$scssPackages)
 {
     //this hook is fired only by the WikiaMobile skin, no need to check for what skin is being used
     if (F::app()->wg->EnableWikiaHubsExt && WikiaPageType::isWikiaHub()) {
         $scssPackages[] = 'wikiahubs_scss_wikiamobile';
     }
     return true;
 }
 /**
  * Check if for current page the ads can be displayed or not
  * We only want ads on regular article pages plug a few
  * special pages. The logic lays here.
  *
  * @return bool
  */
 public static function areAdsShowableOnPage()
 {
     $wg = F::app()->wg;
     $runAds = $wg->Out->isArticle() || WikiaPageType::isSearch() || WikiaPageType::isForum() || WikiaPageType::isWikiaHub();
     // Can be re-enabled after AdDriver2.js is implemented:
     // || $wg->Title->isSpecial('Leaderboard');
     return $runAds;
 }
Пример #9
0
/**
 * @param array $vars JS variables to be added at the top of the page
 * @param array $scripts JS scripts to add to the top of the page
 * @return bool return true - it's a hook
 */
function wfJSVariablesTopScripts(array &$vars, &$scripts)
{
    $wg = F::app()->wg;
    $title = $wg->Title;
    $out = $wg->Out;
    // ads need it
    $vars['wgAfterContentAndJS'] = array();
    if (is_array($wg->WikiFactoryTags)) {
        $vars['wgWikiFactoryTagIds'] = array_keys($wg->WikiFactoryTags);
        $vars['wgWikiFactoryTagNames'] = array_values($wg->WikiFactoryTags);
    }
    $vars['wgCdnRootUrl'] = $wg->CdnRootUrl;
    $vars['wgCdnApiUrl'] = $wg->CdnApiUrl;
    // analytics needs it (from here till the end of the function)
    $vars['wgDBname'] = $wg->DBname;
    $vars['wgCityId'] = $wg->CityId;
    // c&p from OutputPage::getJSVars with an old 1.16 name
    $vars['wgContentLanguage'] = $title->getPageLanguage()->getCode();
    // c&p from OutputPage::getJSVars, it's needed earlier
    $user = $wg->User;
    /** @var $user User */
    if ($user->isAnon()) {
        $vars['wgUserName'] = null;
    } else {
        $vars['wgUserName'] = $user->getName();
        /*
         * Remove when SOC-217 ABTest is finished
         */
        $vars['wgNotConfirmedEmail'] = $user->getGlobalAttribute(UserLoginSpecialController::NOT_CONFIRMED_LOGIN_OPTION_NAME);
        /*
         * End remove
         */
    }
    if ($out->isArticle()) {
        $vars['wgArticleId'] = $out->getWikiPage()->getId();
    }
    $vars['wgCategories'] = $out->getCategories();
    $vars['wgPageName'] = $title->getPrefixedDBKey();
    $vars['wikiaPageType'] = WikiaPageType::getPageType();
    $vars['wikiaPageIsCorporate'] = WikiaPageType::isCorporatePage();
    $vars['wgArticleType'] = WikiaPageType::getArticleType();
    // missing in 1.19
    $skin = RequestContext::getMain()->getSkin();
    $vars['skin'] = $skin->getSkinName();
    // for Google Analytics
    $vars['_gaq'] = array();
    $vars['wgIsGASpecialWiki'] = $wg->IsGASpecialWiki;
    // PER-58: moved wgStyleVersion to <head>
    $vars['wgStyleVersion'] = (string) $wg->StyleVersion;
    $wg->NoExternals = $wg->Request->getBool('noexternals', $wg->NoExternals);
    if (!empty($wg->NoExternals)) {
        $vars["wgNoExternals"] = $wg->NoExternals;
    }
    $vars['wgTransactionContext'] = Transaction::getAttributes();
    $scripts .= Html::inlineScript("var wgNow = new Date();") . "\n";
    return true;
}
Пример #10
0
 public static function onSkinAfterBottomScripts($skin, &$text)
 {
     if (WikiaPageType::isMainPage()) {
         $scripts = AssetsManager::getInstance()->getURL('njord_js');
         foreach ($scripts as $script) {
             $text .= Html::linkedScript($script);
         }
     }
     return true;
 }
 /**
  * Register monetization-related scripts on the top of the page
  * @param array $jsAssetGroups
  * @return true
  */
 public static function onOasisSkinAssetGroupsBlocking(&$jsAssetGroups)
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     $script = 'monetization_module_top_script_js';
     if (!WikiaPageType::isCorporatePage() && $app->wg->User->isAnon() && $app->checkSkin('oasis') && !in_array($script, $jsAssetGroups)) {
         $jsAssetGroups[] = $script;
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 /**
  * Show the Module only on File pages, Article pages, and Main pages
  * @return boolean
  */
 public static function canShowModule()
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     $status = false;
     $showableNameSpaces = array_merge($app->wg->ContentNamespaces, [NS_FILE]);
     if (!WikiaPageType::isCorporatePage() && $app->wg->Title->exists() && !$app->wg->Title->isMainPage() && in_array($app->wg->Title->getNamespace(), $showableNameSpaces) && in_array($app->wg->request->getVal('action'), ['view', null]) && $app->wg->request->getVal('diff') === null && $app->wg->User->isAnon() && $app->checkSkin('oasis')) {
         $status = true;
     }
     wfProfileOut(__METHOD__);
     return $status;
 }
 /**
  * Get page type for the current page (ad-wise).
  * Take into account type of the page and user status.
  * Return one of the PAGE_TYPE_* constants
  *
  * @return string
  */
 public function getPageType()
 {
     $title = null;
     if (WikiaPageType::isActionPage() || $this->wg->Request->getBool('noexternals', $this->wg->NoExternals) || $this->wg->Request->getBool('noads', false) || $this->wg->ShowAds === false || $this->wg->EnableAdEngineExt === false || !$this->app->checkSkin(['oasis', 'wikiamobile', 'venus'])) {
         $pageLevel = self::PAGE_TYPE_NO_ADS;
         return $pageLevel;
     }
     $runAds = WikiaPageType::isFilePage() || WikiaPageType::isForum() || WikiaPageType::isSearch() || WikiaPageType::isWikiaHub();
     if (!$runAds) {
         if ($this->wg->Title) {
             $title = $this->wg->Title;
             $namespace = $title->getNamespace();
             $runAds = in_array($namespace, $this->wg->ContentNamespaces) || isset($this->wg->ExtraNamespaces[$namespace]) || BodyController::isBlogListing() || BodyController::isBlogPost() || defined('NS_WIKIA_PLAYQUIZ') && $title->inNamespace(NS_WIKIA_PLAYQUIZ) || defined('NS_CATEGORY') && $namespace == NS_CATEGORY || defined('NS_PROJECT') && $namespace == NS_PROJECT || $title->isSpecial('Leaderboard') || $title->isSpecial('Maps') || $title->isSpecial('Newimages') || $title->isSpecial('Videos');
         }
     }
     if (!$runAds) {
         $pageLevel = self::PAGE_TYPE_NO_ADS;
         return $pageLevel;
     }
     $user = $this->wg->User;
     if (!$user->isLoggedIn() || $user->getGlobalPreference('showAds')) {
         // Only leaderboard, medrec and invisible on corporate sites for anonymous users
         if (WikiaPageType::isCorporatePage()) {
             $pageLevel = self::PAGE_TYPE_CORPORATE;
             return $pageLevel;
         }
         if (WikiaPageType::isSearch()) {
             $pageLevel = self::PAGE_TYPE_SEARCH;
             return $pageLevel;
         }
         if ($title && $title->isSpecial('Maps')) {
             $pageLevel = self::PAGE_TYPE_MAPS;
             return $pageLevel;
         }
         // All ads everywhere else
         $pageLevel = self::PAGE_TYPE_ALL_ADS;
         return $pageLevel;
     }
     // Logged in users get some ads on the main pages (except on the corporate sites)
     if (!WikiaPageType::isCorporatePage() && WikiaPageType::isMainPage()) {
         $pageLevel = self::PAGE_TYPE_HOMEPAGE_LOGGED;
         return $pageLevel;
     }
     // Override ad level for a (set of) specific page(s)
     // Use case: sponsor ads on a landing page targeted to Wikia editors (=logged in)
     if ($title && !empty($this->wg->PagesWithNoAdsForLoggedInUsersOverriden) && in_array($title->getDBkey(), $this->wg->PagesWithNoAdsForLoggedInUsersOverriden)) {
         $pageLevel = self::PAGE_TYPE_CORPORATE;
         return $pageLevel;
     }
     // And no other ads
     $pageLevel = self::PAGE_TYPE_NO_ADS;
     return $pageLevel;
 }
Пример #14
0
 public function getSetupHtml()
 {
     static $called = false;
     if ($called) {
         return false;
     }
     $called = true;
     global $wgDBname, $wgLang, $wgTitle, $wgAthenaDevHosts;
     if (!empty($_GET['athena_dev_hosts']) || !empty($wgAthenaDevHosts)) {
         $base = "http://athena.dev.wikia-inc.com/";
         $version = mt_rand();
         $out = "<script type=\"text/javascript\">var athena_dev_hosts = 1;</script>";
     } else {
         $base = "/__varnish_athena/";
         $version = "1";
         $out = '';
     }
     $out .= '<script type="text/javascript" src="' . $base . 'athena/Athena.js?' . $version . '"></script>' . "\n";
     if (!empty($_GET['athena_dev_hosts'])) {
     }
     // Page vars are variables that you want available in javascript for serving ads
     $pageVars = array();
     $pageVars['wgDBname'] = $wgDBname;
     $pageVars['hostname'] = getenv('HTTP_HOST');
     $pageVars['request'] = getenv('SCRIPT_URL');
     if (is_object($wgTitle)) {
         $pageVars['article_id'] = $wgTitle->getArticleID();
     }
     $pageVars['isMainPage'] = WikiaPageType::isMainPage();
     $cat = AdEngine::getCachedCategory();
     $pageVars['hub'] = $cat['name'];
     $pageVars['skin'] = RequestContext::getMain()->getSkin()->getSkinName();
     $pageVars['user_lang'] = $wgLang->getCode();
     $pageVars['cont_lang'] = $GLOBALS['wgLanguageCode'];
     $out .= '<script type="text/javascript">' . "\n";
     foreach ($pageVars as $name => $value) {
         // Type juggling
         if ($value === true) {
             $value = "true";
             // As a string
         } else {
             if ($value === false) {
                 $value = "";
             }
         }
         $out .= 'Athena.setPageVar("' . addslashes($name) . '", "' . addslashes($value) . '");' . "\n";
     }
     $out .= 'Athena.setPageVar( "browser", Athena.getBrowser() );' . "\n";
     // Pull the configs
     $out .= 'Athena.pullConfig();';
     $out .= '</script>';
     return $out;
 }
 public function index()
 {
     if (WikiaPageType::isCorporatePage()) {
         return false;
     }
     $categoryLinks = $this->request->getVal('categoryLinks', '');
     //$catlinks are always returned even empty
     if (strpos($categoryLinks, ' catlinks-allhidden\'></div>') !== false) {
         $categoryLinks = '';
     }
     $this->response->setVal('categoryLinks', $categoryLinks);
 }
 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();
     }
 }
 public function getContext(Title $title, $skinName)
 {
     $wrapper = new GlobalStateWrapper(['wgTitle' => $title]);
     $wg = F::app()->wg;
     return $wrapper->wrap(function () use($title, $wg, $skinName) {
         $wikiFactoryHub = WikiFactoryHub::getInstance();
         $hubService = new HubService();
         $adPageTypeService = new AdEngine2PageTypeService();
         $wikiaPageType = new WikiaPageType();
         $sevenOneMediaCombinedUrl = null;
         if (!empty($wg->AdDriverUseSevenOneMedia)) {
             // TODO: implicitly gets the skin from the context!
             $sevenOneMediaCombinedUrl = ResourceLoader::makeCustomURL($wg->Out, ['wikia.ext.adengine.sevenonemedia'], 'scripts');
         }
         $monetizationServiceAds = null;
         if (!empty($wg->AdDriverUseMonetizationService) && !empty($wg->EnableMonetizationModuleExt)) {
             $monetizationServiceAds = F::app()->sendRequest('MonetizationModule', 'index')->getData()['data'];
         }
         $langCode = $title->getPageLanguage()->getCode();
         return ['opts' => $this->filterOutEmptyItems(['adsInContent' => $wg->EnableAdsInContent, 'delayBtf' => $wg->AdDriverDelayBelowTheFold, 'enableAdsInMaps' => $wg->AdDriverEnableAdsInMaps, 'pageType' => $adPageTypeService->getPageType(), 'paidAssetDropConfig' => $wg->PaidAssetDropConfig, 'showAds' => $adPageTypeService->areAdsShowableOnPage(), 'trackSlotState' => $wg->AdDriverTrackState, 'usePostScribe' => $wg->Request->getBool('usepostscribe', false)]), 'targeting' => $this->filterOutEmptyItems(['enablePageCategories' => array_search($langCode, $wg->AdPageLevelCategoryLangs) !== false, 'pageArticleId' => $title->getArticleId(), 'pageIsArticle' => !!$title->getArticleId(), 'pageIsHub' => $wikiaPageType->isWikiaHub(), 'pageName' => $title->getPrefixedDBKey(), 'pageType' => $wikiaPageType->getPageType(), 'sevenOneMediaSub2Site' => $wg->AdDriverSevenOneMediaOverrideSub2Site, 'skin' => $skinName, 'wikiCategory' => $wikiFactoryHub->getCategoryShort($wg->CityId), 'wikiCustomKeyValues' => $wg->DartCustomKeyValues, 'wikiDbName' => $wg->DBname, 'wikiDirectedAtChildren' => $wg->WikiDirectedAtChildrenByFounder || $wg->WikiDirectedAtChildrenByStaff, 'wikiIsCorporate' => $wikiaPageType->isCorporatePage(), 'wikiIsTop1000' => $wg->AdDriverWikiIsTop1000, 'wikiLanguage' => $langCode, 'wikiVertical' => $hubService->getCategoryInfoForCity($wg->CityId)->cat_name]), 'providers' => $this->filterOutEmptyItems(['monetizationService' => $wg->AdDriverUseMonetizationService, 'monetizationServiceAds' => $monetizationServiceAds, 'sevenOneMedia' => $wg->AdDriverUseSevenOneMedia, 'sevenOneMediaCombinedUrl' => $sevenOneMediaCombinedUrl, 'taboola' => $wg->AdDriverUseTaboola]), 'slots' => $this->filterOutEmptyItems(['exitstitial' => $wg->EnableOutboundScreenExt, 'exitstitialRedirectDelay' => $wg->OutboundScreenRedirectDelay, 'invisibleHighImpact' => $wg->AdDriverEnableInvisibleHighImpactSlot]), 'forcedProvider' => $wg->AdDriverForcedProvider];
     });
 }
Пример #18
0
 public function executeTop()
 {
     if (WikiaPageType::isWikiaHub()) {
         $leaderboardName = 'HUB_TOP_LEADERBOARD';
     } elseif ($this->wg->EnableWikiaHomePageExt) {
         $leaderboardName = 'CORP_TOP_LEADERBOARD';
     } elseif (WikiaPageType::isMainPage()) {
         $leaderboardName = 'HOME_TOP_LEADERBOARD';
     } else {
         $leaderboardName = 'TOP_LEADERBOARD';
     }
     $this->leaderboardName = $leaderboardName;
 }
 private function getLogoLink()
 {
     $verticalShortName = $this->getVerticalShortName();
     if (WikiaPageType::isWikiaHomePage() || $verticalShortName === null) {
         global $wgLang;
         $link = (new WikiaLogoHelper())->getCentralUrlForLang($wgLang->getCode());
     } else {
         /* possible message keys: global-footer-vertical-tv-link, global-footer-vertical-comics-link,
         			global-footer-vertical-movies-link, global-footer-vertical-music-link, global-footer-vertical-books-link,
         			global-footer-vertical-games-link, global-footer-vertical-lifestyle-link */
         $link = wfMessage('global-footer-vertical-' . $verticalShortName . '-link')->plain();
     }
     return $link;
 }
Пример #20
0
function wfWikiAnswersActionDropdown(&$moduleObject, &$params)
{
    global $wgTitle;
    $answerObj = Answer::newFromTitle($wgTitle);
    if (WikiaPageType::isMainPage()) {
        $moduleObject->action = null;
    } elseif ($answerObj->isQuestion() && !$answerObj->isArticleAnswered()) {
        if (isset($moduleObject->dropdown['move'])) {
            $moduleObject->action = $moduleObject->dropdown['move'];
            $moduleObject->actionName = 'move';
            unset($moduleObject->dropdown['move']);
        }
    }
    return true;
}
Пример #21
0
 private function setBodyModules()
 {
     $this->globalNavigation = $this->getGlobalNavigation();
     $this->localNavigation = $this->getLocalNavigation();
     $this->categorySelect = $this->getCategorySelect();
     $this->notifications = $this->app->renderView('BannerNotifications', 'Confirmation');
     if ($this->isUserLoggedIn) {
         $this->recentWikiActivity = $this->getRecentWikiActivity();
     }
     if (WikiaPageType::isArticlePage()) {
         $this->articleNav = $this->getArticleNavigation();
         $this->setVal('header', $this->app->renderView('Venus', 'header'));
         Wikia::addAssetsToOutput('article_scss');
     }
 }
Пример #22
0
 /**
  * Business-logic for determining if the javascript should be at the bottom of the page (it usually should be
  * at the bottom for performance reasons, but there are some exceptions for engineering reasons).
  *
  * TODO: make sure JavaScripts can be always loaded on bottom
  *
  * Note: NS_FILE pages need JS at top because AnyClips relies on jQuery.
  */
 public static function JsAtBottom()
 {
     global $wgTitle;
     // decide where JS should be placed (only add JS at the top for non-search Special and edit pages)
     if (WikiaPageType::isSearch() || WikiaPageType::isForum()) {
         // Remove this whole condition when AdDriver2.js is fully implemented and deployed
         $jsAtBottom = true;
         // Liftium.js (part of AssetsManager) must be loaded after LiftiumOptions variable is set in page source
     } elseif ($wgTitle->getNamespace() == NS_SPECIAL || BodyController::isEditPage()) {
         $jsAtBottom = false;
     } else {
         $jsAtBottom = true;
     }
     return $jsAtBottom;
 }
Пример #23
0
 /**
  * @group Slow
  * @slowExecutionTime 0.08448 ms
  * @covers WikiaSearchController::isCorporateWiki
  */
 public function testIsCorporatePage()
 {
     $this->mockGlobalVariable('wgEnableWikiaHomePageExt', false);
     $this->mockGlobalVariable('wgEnableWikiaHubsV3Ext', false);
     $this->assertFalse(WikiaPageType::isCorporatePage());
     $this->mockGlobalVariable('wgEnableWikiaHomePageExt', null);
     $this->mockGlobalVariable('wgEnableWikiaHubsV3Ext', null);
     $this->assertFalse(WikiaPageType::isCorporatePage());
     $this->mockGlobalVariable('wgEnableWikiaHomePageExt', true);
     $this->mockGlobalVariable('wgEnableWikiaHubsV3Ext', false);
     $this->assertTrue(WikiaPageType::isCorporatePage());
     $this->mockGlobalVariable('wgEnableWikiaHomePageExt', false);
     $this->mockGlobalVariable('wgEnableWikiaHubsV3Ext', true);
     $this->assertTrue(WikiaPageType::isCorporatePage());
     $this->mockGlobalVariable('wgEnableWikiaHomePageExt', false);
     $this->mockGlobalVariable('wgEnableWikiaHubsV3Ext', true);
     $this->assertTrue(WikiaPageType::isCorporatePage());
 }
Пример #24
0
 /**
  * Get canonical vertical name for given cityId.
  * For Lifestyle and Gaming return their names.
  * For corporate pages return false - we don't want to track traffic from there in Comscore
  * For rest of values return Entertainment.
  * @param $cityId
  * @return Boolean|String
  */
 public static function getVerticalNameForComscore($cityId)
 {
     $verticalId = WikiFactoryHub::getInstance()->getVerticalId($cityId);
     switch ($verticalId) {
         case WikiFactoryHub::VERTICAL_ID_VIDEO_GAMES:
             return 'gaming';
         case WikiFactoryHub::VERTICAL_ID_LIFESTYLE:
             return 'lifestyle';
         case WikiFactoryHub::VERTICAL_ID_OTHER:
             if (WikiaPageType::isCorporatePage()) {
                 return false;
             } else {
                 return 'lifestyle';
             }
         default:
             return 'entertainment';
     }
 }
Пример #25
0
 /**
  * @param Title $title
  * @param Page $article
  *
  * @return true because it's a hook
  */
 public static function onArticleFromTitle(&$title, &$article)
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     if (WikiaPageType::isWikiaHubMain() || $title->isSubpageOf(Title::newMainPage())) {
         $model = new WikiaHubsV3HooksModel();
         $dbKeyName = $title->getDBKey();
         $dbKeyNameSplit = explode('/', $dbKeyName);
         $hubTimestamp = $model->getTimestampFromSplitDbKey($dbKeyNameSplit);
         $app->wg->SuppressRail = true;
         $app->wg->SuppressFooter = true;
         if (!$app->wg->request->wasPosted()) {
             // don't change article object while saving data
             $article = new WikiaHubsV3Article($title, $hubTimestamp);
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
	public function executeIndex() {
		global $wgOut, $wgTitle, $wgSitename, $wgUser, $wgEnableBlog, $wgEnableCorporatePageExt, $wgEnableInfoBoxTest, $wgEnableWikiAnswers, $wgRequest, $wgMaximizeArticleAreaArticleIds;

		$this->isMainPage = WikiaPageType::isMainPage();

		// Replaces ContentDisplayModule->index()
		$this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext'];

		// this hook allows adding extra HTML just after <body> opening tag
		// append your content to $html variable instead of echoing
		// (taken from Monaco skin)
		wfRunHooks('GetHTMLAfterBody', array ($wgUser->getSkin(), &$this->afterBodyHtml));

		$this->headerModuleAction = 'Index';
		$this->headerModuleParams = array ('showSearchBox' => false);

		$this->headerModuleName = 'CampfireHeader';

	}
Пример #27
0
 private function getTag()
 {
     $dbname = F::app()->wg->DBname;
     $t = F::app()->wg->Title;
     $title = $t->getText();
     if (WikiaPageType::isWikiaHub()) {
         return 'RC_WIKIA_START';
     }
     if ($dbname == 'dehauptseite') {
         if (Wikia::isMainPage()) {
             return 'RC_WIKIA_HOME';
         }
         if (strpos($title, 'Mobil') === 0) {
             return 'RC_WIKIA_MOBIL';
         }
         if (WikiaPageType::getPageType() == 'search') {
             return 'RC_WIKIA_SEARCH';
         }
         return 'RC_WIKIA_SVCE';
     }
     if ($dbname == 'de') {
         if ($t->getNamespace() == NS_FORUM) {
             return 'RC_WIKIA_PIN';
         }
         return 'RC_WIKIA_COMMUNITY';
     }
     if (strpos(F::app()->wg->DartCustomKeyValues, 'anime') !== false) {
         return 'RC_WIKIA_UGCANIME';
     }
     $cat_name = HubService::getCategoryInfoForCurrentPage()->cat_name;
     if ($cat_name == 'Entertainment') {
         return 'RC_WIKIA_UGCENT';
     }
     if ($cat_name == 'Gaming') {
         return 'RC_WIKIA_UGCGAMES';
     }
     if ($cat_name == 'Lifestyle') {
         return 'RC_WIKIA_UGCLIFESTYLE';
     }
     return 'RC_WIKIA_UGC';
 }
Пример #28
0
<?php

if (!empty($wg->EnableMonetizationModuleExt)) {
    if (!empty($wg->AdDriverUseMonetizationService)) {
        echo $app->renderView('Ad', 'Index', ['slotName' => 'MON_ABOVE_TITLE']);
    } else {
        if (!empty($monetizationModules[MonetizationModuleHelper::SLOT_TYPE_ABOVE_TITLE])) {
            echo $monetizationModules[MonetizationModuleHelper::SLOT_TYPE_ABOVE_TITLE];
        }
    }
}
$runNjord = !empty($wg->EnableNjordExt) && WikiaPageType::isMainPage();
if ($runNjord) {
    // edit button with actions dropdown
    if (!empty($action)) {
        echo F::app()->renderView('MenuButton', 'Index', array('action' => $action, 'image' => $actionImage, 'dropdown' => $dropdown, 'name' => $actionName));
    }
} else {
    ?>
	<!-- @TODO CONCF-189 everything inside this if should be removed when social buttons are live -->
	<?php 
    if (empty($wg->EnablePageShareExt)) {
        ?>
		<header id="WikiaPageHeader" class="WikiaPageHeader">
			<h1><?php 
        echo !empty($displaytitle) ? $title : htmlspecialchars($title);
        ?>
</h1>

			<?php 
        // edit button with actions dropdown
Пример #29
0
 /**
  * Called instead of executeIndex when the CorporatePage extension is enabled.
  */
 public function executeCorporate()
 {
     global $wgTitle, $wgOut, $wgUser, $wgSuppressNamespacePrefix;
     wfProfileIn(__METHOD__);
     $this->canAct = $wgUser->isAllowed('edit');
     if ($this->canAct) {
         $this->prepareActionButton();
         // dropdown actions
         $this->dropdown = $this->getDropdownActions();
     }
     // page namespace
     $ns = $wgTitle->getNamespace();
     // default title "settings" (RT #145371), don't touch special pages
     if ($ns == NS_FORUM) {
         $this->title = $wgTitle->getText();
         $this->displaytitle = false;
         // we don't want htmlspecialchars for SpecialPages (BugId:6012)
     } else {
         if ($ns == NS_SPECIAL) {
             $this->displaytitle = true;
         } else {
             if ($ns != NS_SPECIAL) {
                 $this->displaytitle = true;
                 $this->title = $wgOut->getPageTitle();
             }
         }
     }
     // remove namespaces prefix from title
     $namespaces = array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE);
     if (in_array($ns, array_merge($namespaces, $wgSuppressNamespacePrefix))) {
         $this->title = $wgTitle->getText();
         $this->displaytitle = false;
     }
     if (WikiaPageType::isMainPage()) {
         $this->title = '';
         $this->subtitle = '';
     }
     wfProfileOut(__METHOD__);
 }
Пример #30
0
    public static function getLiftiumOptionsScript()
    {
        wfProfileIn(__METHOD__);
        global $wgDBname, $wgTitle, $wgLang;
        // See Liftium.js for documentation on options
        $options = array();
        $options['pubid'] = 999;
        $options['baseUrl'] = '/__varnish_liftium/';
        $options['kv_wgDBname'] = $wgDBname;
        if (is_object($wgTitle)) {
            $options['kv_article_id'] = $wgTitle->getArticleID();
            $options['kv_wpage'] = $wgTitle->getPartialURL();
        }
        $cat = AdEngine::getCachedCategory();
        $options['kv_Hub'] = $cat['name'];
        $options['kv_skin'] = RequestContext::getMain()->getSkin()->getSkinName();
        $options['kv_user_lang'] = $wgLang->getCode();
        $options['kv_cont_lang'] = $GLOBALS['wgLanguageCode'];
        $options['kv_isMainPage'] = WikiaPageType::isMainPage();
        $options['kv_page_type'] = WikiaPageType::getPageType();
        $options['geoUrl'] = "http://geoiplookup.wikia.com/";
        if (!empty($wgDartCustomKeyValues)) {
            $options['kv_dart'] = $wgDartCustomKeyValues;
        }
        $options['kv_domain'] = $_SERVER['HTTP_HOST'];
        $js = "LiftiumOptions = " . json_encode($options) . ";\n";
        if (WikiaPageType::isSearch() || !$wgTitle->getNamespace() == NS_SPECIAL && !BodyController::isEditPage()) {
            $js .= <<<EOT
\t\t\t\tif ( !window.wgLoadAdDriverOnLiftiumInit && ( !window.Wikia.AbTest || !Wikia.AbTest.inTreatmentGroup( "AD_LOAD_TIMING", "ONLOAD" ) ) ) {
\t\t\t\t\tLiftiumOptions['hasMoreCalls'] = true;
\t\t\t\t\tLiftiumOptions['isCalledAfterOnload'] = true;
\t\t\t\t\tLiftiumOptions['maxLoadDelay'] = 6000;
\t\t\t\t}
\t\t\t\telse {
\t\t\t\t\tLiftiumOptions['autoInit'] = false;
\t\t\t\t}
EOT;
        } else {
            $js .= <<<EOT
\t\t\t\tLiftiumOptions['hasMoreCalls'] = true;
\t\t\t\tLiftiumOptions['isCalledAfterOnload'] = true;
\t\t\t\tLiftiumOptions['maxLoadDelay'] = 6000;
EOT;
        }
        $js = AssetsManagerBaseBuilder::minifyJs($js);
        $out = "\n<!-- Liftium options -->\n";
        $out .= Html::inlineScript($js) . "\n";
        wfProfileOut(__METHOD__);
        return $out;
    }