/**
  * 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;
 }
 /**
  * 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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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;
    }
Exemplo n.º 5
0
 public function getRailModuleList()
 {
     wfProfileIn(__METHOD__);
     global $wgTitle, $wgUser, $wgEnableAchievementsExt, $wgContentNamespaces, $wgExtraNamespaces, $wgExtraNamespacesLocal, $wgEnableWikiAnswers, $wgEnableHuluVideoPanel, $wgEnableWallEngine, $wgRequest, $wgEnableForumExt;
     $namespace = $wgTitle->getNamespace();
     $subjectNamespace = MWNamespace::getSubject($namespace);
     $railModuleList = array();
     $latestActivityKey = $wgUser->isAnon() ? 1250 : 1300;
     $huluVideoPanelKey = $wgUser->isAnon() ? 1390 : 1280;
     // Forum Extension
     if ($wgEnableForumExt && ForumHelper::isForum()) {
         $railModuleList = array(1202 => array('Forum', 'forumRelatedThreads', null), 1201 => array('Forum', 'forumActivityModule', null), 1490 => array('Ad', 'Index', ['slotName' => 'TOP_RIGHT_BOXAD']));
         // Include additional modules from other extensions (like chat)
         wfRunHooks('GetRailModuleList', array(&$railModuleList));
         wfProfileOut(__METHOD__);
         return $railModuleList;
     }
     if ($namespace == NS_SPECIAL) {
         if (WikiaPageType::isSearch()) {
             if (empty($this->wg->EnableWikiaHomePageExt)) {
                 $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null));
                 $railModuleList[1450] = array('PagesOnWiki', 'Index', null);
                 if (empty($wgEnableWikiAnswers)) {
                     if ($wgEnableHuluVideoPanel) {
                         $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
                     }
                 }
             }
         } else {
             if ($wgTitle->isSpecial('Leaderboard')) {
                 $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null), 1290 => array('LatestEarnedBadges', 'Index', null));
             } else {
                 if ($wgTitle->isSpecial('WikiActivity')) {
                     $railModuleList = array(1102 => array('HotSpots', 'Index', null), 1101 => array('CommunityCorner', 'Index', null));
                     $railModuleList[1450] = array('PagesOnWiki', 'Index', null);
                 } else {
                     if ($wgTitle->isSpecial('Following') || $wgTitle->isSpecial('Contributions')) {
                         // intentional nothing here
                     } else {
                         if ($wgTitle->isSpecial('ThemeDesignerPreview')) {
                             $railModuleList = array($latestActivityKey => array('LatestActivity', 'Index', null));
                             $railModuleList[1450] = array('PagesOnWiki', 'Index', null);
                             if (empty($wgEnableWikiAnswers)) {
                                 if ($wgEnableHuluVideoPanel) {
                                     $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
                                 }
                             }
                         } else {
                             // don't show any module for MW core special pages
                             $railModuleList = array();
                             wfRunHooks('GetRailModuleSpecialPageList', array(&$railModuleList));
                             wfProfileOut(__METHOD__);
                             return $railModuleList;
                         }
                     }
                 }
             }
         }
     }
     // Content, category and forum namespaces.  FB:1280 Added file,video,mw,template
     if ($wgTitle->isSubpage() && $wgTitle->getNamespace() == NS_USER || in_array($subjectNamespace, array(NS_CATEGORY, NS_CATEGORY_TALK, NS_FORUM, NS_PROJECT, NS_FILE, NS_MEDIAWIKI, NS_TEMPLATE, NS_HELP)) || in_array($subjectNamespace, $wgContentNamespaces) || array_key_exists($subjectNamespace, $wgExtraNamespaces)) {
         // add any content page related rail modules here
         $railModuleList[$latestActivityKey] = array('LatestActivity', 'Index', null);
         $railModuleList[1450] = array('PagesOnWiki', 'Index', null);
         if (empty($wgEnableWikiAnswers)) {
             if ($wgEnableHuluVideoPanel) {
                 $railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
             }
         }
     }
     // User page namespaces
     if (in_array($wgTitle->getNamespace(), self::getUserPagesNamespaces())) {
         $page_owner = User::newFromName($wgTitle->getText());
         if ($page_owner) {
             if (!$page_owner->getGlobalPreference('hidefollowedpages')) {
                 $railModuleList[1101] = array('FollowedPages', 'Index', null);
             }
             if ($wgEnableAchievementsExt) {
                 $railModuleList[1102] = array('Achievements', 'Index', null);
             }
         }
     }
     if (self::isBlogPost() || self::isBlogListing()) {
         $railModuleList[1250] = array('PopularBlogPosts', 'Index', null);
     }
     //  No rail on main page or edit page for oasis skin
     // except &action=history of wall
     if (!empty($wgEnableWallEngine)) {
         $isEditPage = !WallHelper::isWallNamespace($namespace) && BodyController::isEditPage() || $wgRequest->getVal('diff');
     } else {
         $isEditPage = BodyController::isEditPage();
     }
     if ($isEditPage || WikiaPageType::isMainPage()) {
         $modules = array();
         wfRunHooks('GetEditPageRailModuleList', array(&$modules));
         wfProfileOut(__METHOD__);
         return $modules;
     }
     // No modules on Custom namespaces, unless they are in the ContentNamespaces list, those get the content rail
     if (is_array($wgExtraNamespacesLocal) && array_key_exists($subjectNamespace, $wgExtraNamespacesLocal) && !in_array($subjectNamespace, $wgContentNamespaces)) {
         wfProfileOut(__METHOD__);
         return array();
     }
     // If the entire page is non readable due to permissions, don't display the rail either RT#75600
     if (!$wgTitle->userCan('read')) {
         wfProfileOut(__METHOD__);
         return array();
     }
     $railModuleList[1440] = array('Ad', 'Index', ['slotName' => 'TOP_RIGHT_BOXAD']);
     $railModuleList[1100] = array('Ad', 'Index', ['slotName' => 'LEFT_SKYSCRAPER_2']);
     unset($railModuleList[1450]);
     wfRunHooks('GetRailModuleList', array(&$railModuleList));
     wfProfileOut(__METHOD__);
     return $railModuleList;
 }
Exemplo n.º 6
0
	function getTopAdCode(){
	        echo AdEngine::getInstance()->getSetupHtml();

		global $wgOut, $wgEnableIframeAds, $wgEnableTandemAds, $wgEnableFAST_HOME2;
		$topAdCode = '';
		if ($wgOut->isArticle()){
			if (WikiaPageType::isMainPage()){
				$topAdCode .= AdEngine::getInstance()->getPlaceHolderIframe('HOME_TOP_LEADERBOARD');
				if ($wgEnableFAST_HOME2) {
					$topAdCode .= AdEngine::getInstance()->getPlaceHolderIframe('HOME_TOP_RIGHT_BOXAD');
				}
			} else if ( WikiaPageType::isContentPage()){
				$topAdCode = AdEngine::getInstance()->getPlaceHolderIframe('TOP_LEADERBOARD');
			}
		} elseif (WikiaPageType::isSearch()) {
			$topAdCode .= AdEngine::getInstance()->getPlaceHolderIframe('TOP_LEADERBOARD');
			$topAdCode .= AdEngine::getInstance()->getPlaceHolderIframe('TOP_RIGHT_BOXAD');
		}
		return $topAdCode;
	}
Exemplo n.º 7
0
	private function configure() {
		global $wgTitle, $wgContentNamespaces, $wgEnableFAST_HOME2, $wgEnableCorporatePageExt, $wgExtraNamespaces;

		self::$config = array();

		if (!AdEngine2Controller::areAdsShowableOnPage()) {
			return;
		}

		if(WikiaPageType::isWikiaHub() && AdEngine::isAdsEnabledOnWikiaHub()) {
			self::$config['HOME_TOP_LEADERBOARD'] = true;
			self::$config['TOP_BUTTON'] = true;
			return;
		}
		// Ads on corporate hub pages only
		elseif($wgEnableCorporatePageExt) {
			if (BodyController::isHubPage()) {
				self::$config['CORP_TOP_LEADERBOARD'] = true;
				self::$config['CORP_TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			}
			elseif (WikiaPageType::isSearch()) {
				if (!empty($this->wg->EnableWikiaSearchAds)) {
					// no regular ads if search ads are enabled
				} else {
					self::$config['TOP_LEADERBOARD'] = true;
					self::$config['TOP_RIGHT_BOXAD'] = true;
					self::$config['TOP_BUTTON'] = true;				
				}
			}
			return;
		}

		$namespace = $wgTitle->getNamespace();

		if(WikiaPageType::isMainPage()) {
			// main page
			self::$config['HOME_TOP_LEADERBOARD'] = true;
			self::$config['INVISIBLE_1'] = true;
			self::$config['INVISIBLE_2'] = true;
			self::$config['PREFOOTER_LEFT_BOXAD'] = true;
			self::$config['PREFOOTER_RIGHT_BOXAD'] = true;
			self::$config['HOME_INVISIBLE_TOP'] = false;	// skins used to be served from this slot, but are now served from TOP_LEADERBOARD with option dcopt=ist
			if($wgEnableFAST_HOME2) {
				self::$config['HOME_TOP_RIGHT_BOXAD'] = true;
				self::$config['TEST_HOME_TOP_RIGHT_BOXAD'] = true;
			}
			self::$config['HOME_TOP_RIGHT_BUTTON'] = true;
			self::$config['TOP_BUTTON'] = true;
		} else {
			if(in_array($namespace, $wgContentNamespaces)) {
				// content page
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TEST_TOP_RIGHT_BOXAD'] = true;
				self::$config['MIDDLE_RIGHT_BOXAD'] = true;
				self::$config['INVISIBLE_1'] = true;
				self::$config['INVISIBLE_2'] = true;
				self::$config['LEFT_SKYSCRAPER_2'] = true;
				self::$config['LEFT_SKYSCRAPER_3'] = true;
				self::$config['PREFOOTER_LEFT_BOXAD'] = true;
				self::$config['PREFOOTER_RIGHT_BOXAD'] = true;
				self::$config['INVISIBLE_TOP'] = false;	// skins used to be served from this slot, but are now served from TOP_LEADERBOARD with option dcopt=ist
				self::$config['TOP_RIGHT_BUTTON'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if($namespace == NS_FILE) {
				// file/image page
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if(WikiaPageType::isForum()) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
				self::$config['LEFT_SKYSCRAPER_3'] = true;
				self::$config['PREFOOTER_LEFT_BOXAD'] = true;
				self::$config['PREFOOTER_RIGHT_BOXAD'] = true;
			} else if (WikiaPageType::isSearch()) {
				// search results page
				if (empty($this->wg->EnableWikiaSearchAds)) {
					// regular ads if search ads are disabled
					self::$config['TOP_LEADERBOARD'] = true;
					self::$config['TOP_RIGHT_BOXAD'] = true;
					self::$config['TEST_TOP_RIGHT_BOXAD'] = true;
					self::$config['TOP_BUTTON'] = true;
					self::$config['LEFT_SKYSCRAPER_2'] = true;
					self::$config['LEFT_SKYSCRAPER_3'] = true;
					self::$config['PREFOOTER_LEFT_BOXAD'] = true;
					self::$config['PREFOOTER_RIGHT_BOXAD'] = true;
				}
			} else if($namespace == NS_SPECIAL) {
				if($wgTitle->isSpecial('Leaderboard')) {
					self::$config['TOP_LEADERBOARD'] = true;
					self::$config['TOP_RIGHT_BOXAD'] = true;					
					self::$config['TOP_BUTTON'] = true;
				} else if($wgTitle->isSpecial('Videos')) {
					self::$config['TOP_LEADERBOARD'] = true;
				}
			} else if($namespace == NS_CATEGORY) {
				// category page
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TEST_TOP_RIGHT_BOXAD'] = true;
				self::$config['MIDDLE_RIGHT_BOXAD'] = true;
				self::$config['LEFT_SKYSCRAPER_2'] = true;
				self::$config['PREFOOTER_LEFT_BOXAD'] = true;
				self::$config['PREFOOTER_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if($namespace == NS_PROJECT) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if($namespace == NS_FORUM) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if( BodyController::isBlogListing() ) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if( BodyController::isBlogPost() ) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_RIGHT_BOXAD'] = true;
				self::$config['TEST_TOP_RIGHT_BOXAD'] = true;
				self::$config['TOP_BUTTON'] = true;
			} else if (array_key_exists($namespace, $wgExtraNamespaces)) {
				self::$config['TOP_LEADERBOARD'] = true;
				self::$config['TOP_BUTTON'] = true;
			}
		}
	}
Exemplo n.º 8
0
	public function getRailModuleList() {
		wfProfileIn(__METHOD__);
		global $wgTitle, $wgUser, $wgEnableAchievementsExt, $wgContentNamespaces,
			$wgExtraNamespaces, $wgExtraNamespacesLocal,
			$wgEnableCorporatePageExt,
			$wgEnableWikiAnswers,
			$wgSalesTitles, $wgEnableHuluVideoPanel,
			$wgEnableGamingCalendarExt, $wgEnableWallEngine, $wgRequest;

		$namespace = $wgTitle->getNamespace();
		$subjectNamespace = MWNamespace::getSubject($namespace);

		$railModuleList = array();

		$latestPhotosKey = $wgUser->isAnon() ? 1300 : 1250;
		$latestActivityKey = $wgUser->isAnon() ? 1250 : 1300;
		$huluVideoPanelKey = $wgUser->isAnon() ? 1390 : 1280;

		// Forum Extension
		if (WikiaPageType::isForum()) {
			$railModuleList = array (
				1500 => array('Search', 'Index', null),
				1002 => array('Forum', 'forumRelatedThreads', null),
				1001 => array('Forum', 'forumActivityModule', null),
				1000 => array('Forum', 'forumParticipationModule', null),
				1490 => array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD')),
			);
			return $railModuleList;
		}

		if($namespace == NS_SPECIAL) {
			if (WikiaPageType::isSearch()) {
				if (empty($this->wg->EnableWikiaHomePageExt)) {
					$railModuleList = array(
						$latestActivityKey => array('LatestActivity', 'Index', null),
					);

					$railModuleList[1450] = array('PagesOnWiki', 'Index', null);

					if( empty( $wgEnableWikiAnswers ) ) {
						$railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null);
						if ($wgEnableHuluVideoPanel) {
							$railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
						}
					}
				} elseif ($wgEnableCorporatePageExt) {
					$railModuleList = array(
						1490 => array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD'))
					);
					wfProfileOut(__METHOD__);
					return $railModuleList;
				}
			} else if ($wgTitle->isSpecial('Leaderboard')) {
				$railModuleList = array (
					1500 => array('Search', 'Index', null),
					$latestActivityKey => array('LatestActivity', 'Index', null),
					1290 => array('LatestEarnedBadges', 'Index', null)
				);
			} else if ($wgTitle->isSpecial('WikiActivity')) {
				$railModuleList = array (
					1500 => array('Search', 'Index', null),
					1102 => array('HotSpots', 'Index', null),
					1101 => array('CommunityCorner', 'Index', null),
				);
				$railModuleList[1450] = array('PagesOnWiki', 'Index', null);
			} else if ($wgTitle->isSpecial('Following') || $wgTitle->isSpecial('Contributions') ) {
				// intentional nothing here
			} else if ($wgTitle->isSpecial('ThemeDesignerPreview') ) {
				$railModuleList = array (
					1500 => array('Search', 'Index', null),
					$latestActivityKey => array('LatestActivity', 'Index', null),
				);

				$railModuleList[1450] = array('PagesOnWiki', 'Index', null);

				if( empty( $wgEnableWikiAnswers ) ) {
					$railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null);
					if ($wgEnableHuluVideoPanel) {
						$railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
					}
				}
			} else if( $wgTitle->isSpecial('PageLayoutBuilderForm') ) {
				$railModuleList = array (
					1501 => array('Search', 'Index', null),
					1500 => array('PageLayoutBuilderForm', 'Index', null)
				);
			} else {
				// don't show any module for MW core special pages
				$railModuleList = array();
				wfRunHooks( 'GetRailModuleSpecialPageList', array( &$railModuleList ) );
				wfProfileOut(__METHOD__);
				return $railModuleList;
			}
		} else if ( !self::showUserPagesHeader() ) {
			// ProfilePagesV3 renders its own search box.
			// If this page is not a page with the UserPagesHeader on version 3, show search (majority case)
			$railModuleList = array (
				1500 => array('Search', 'Index', null),
			);
		}

		// Content, category and forum namespaces.  FB:1280 Added file,video,mw,template
		if(	$wgTitle->isSubpage() && $wgTitle->getNamespace() == NS_USER ||
			in_array($subjectNamespace, array (NS_CATEGORY, NS_CATEGORY_TALK, NS_FORUM, NS_PROJECT, NS_FILE, NS_VIDEO, NS_MEDIAWIKI, NS_TEMPLATE, NS_HELP)) ||
			in_array($subjectNamespace, $wgContentNamespaces) ||
			array_key_exists( $subjectNamespace, $wgExtraNamespaces ) ) {
			// add any content page related rail modules here

			$railModuleList[$latestActivityKey] = array('LatestActivity', 'Index', null);
			$railModuleList[1450] = array('PagesOnWiki', 'Index', null);

			if( empty( $wgEnableWikiAnswers ) ) {
				$railModuleList[$latestPhotosKey] = array('LatestPhotos', 'Index', null);
				if ($wgEnableHuluVideoPanel) {
					$railModuleList[$huluVideoPanelKey] = array('HuluVideoPanel', 'Index', null);
				}
			}
		}

		// User page namespaces
		if( in_array($wgTitle->getNamespace(), self::getUserPagesNamespaces() ) ) {
			$page_owner = User::newFromName($wgTitle->getText());

			if($page_owner) {
				if( !$page_owner->getOption('hidefollowedpages') ) {
					$railModuleList[1101] = array('FollowedPages', 'Index', null);
				}

				if($wgEnableAchievementsExt && !(($wgUser->getId() == $page_owner->getId()) && $page_owner->getOption('hidepersonalachievements'))){
					$railModuleList[1102] = array('Achievements', 'Index', null);
				}
			}
		}

		if (self::isBlogPost() || self::isBlogListing()) {
			$railModuleList[1500] = array('Search', 'Index', null);
			$railModuleList[1250] = array('PopularBlogPosts', 'Index', null);
		}

		// A/B testing leftovers, leave for now because we will do another one
		$useTestBoxad = false;

		// Special case rail modules for Corporate Skin
		if ($wgEnableCorporatePageExt) {
			$railModuleList = array (
				1500 => array('Search', 'Index', null),
			);
			// No rail on main page or edit page for corporate skin
			if ( BodyController::isEditPage() || WikiaPageType::isMainPage() ) {
				$railModuleList = array();
			}
			else if (self::isHubPage()) {
				if ($useTestBoxad) {
					$railModuleList[1490] = array('Ad', 'Index', array('slotname' => 'TEST_TOP_RIGHT_BOXAD'));
				}
				else {
					$railModuleList[1490] = array('Ad', 'Index', array('slotname' => 'CORP_TOP_RIGHT_BOXAD'));
				}
				$railModuleList[1480] = array('CorporateSite', 'HotSpots', null);
			//	$railModuleList[1470] = array('CorporateSite', 'PopularHubPosts', null);  // temp disabled - data not updating
				$railModuleList[1460] = array('CorporateSite', 'TopHubUsers', null);
			} else if ( is_array( $wgSalesTitles ) && in_array( $wgTitle->getText(), $wgSalesTitles ) ){
				$railModuleList[1470] = array('CorporateSite', 'SalesSupport', null);
			} else { // content pages
				$railModuleList[1470] = array('CorporateSite', 'PopularStaffPosts', null);
			}
			wfProfileOut(__METHOD__);
			return $railModuleList;
		}

		//  No rail on main page or edit page for oasis skin
		// except &action=history of wall
		if( !empty($wgEnableWallEngine) ) {
			$isEditPage = !WallHelper::isWallNamespace($namespace) && BodyController::isEditPage() || $wgRequest->getVal('diff');
		} else {
			$isEditPage = BodyController::isEditPage();
		}

		if ( $isEditPage || WikiaPageType::isMainPage() ) {
			$modules = array();
			wfRunHooks( 'GetEditPageRailModuleList', array( &$modules ) );
			wfProfileOut(__METHOD__);
			return $modules;
		}
		// No modules on Custom namespaces, unless they are in the ContentNamespaces list, those get the content rail
		if (is_array($wgExtraNamespacesLocal) && array_key_exists($subjectNamespace, $wgExtraNamespacesLocal) && !in_array($subjectNamespace, $wgContentNamespaces)) {
			wfProfileOut(__METHOD__);
			return array();
		}
		// If the entire page is non readable due to permissions, don't display the rail either RT#75600
		if (!$wgTitle->userCan( 'read' )) {
			wfProfileOut(__METHOD__);
			return array();
		}

		if ($useTestBoxad) {
			$railModuleList[1440] = array('Ad', 'Index', array('slotname' => 'TEST_TOP_RIGHT_BOXAD'));
		}
		else {
			$railModuleList[1440] = array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BOXAD'));
		}
		$railModuleList[1291] = array('Ad', 'Index', array('slotname' => 'MIDDLE_RIGHT_BOXAD'));
		$railModuleList[1100] = array('Ad', 'Index', array('slotname' => 'LEFT_SKYSCRAPER_2'));

		/**
		 * Michał Roszka <*****@*****.**>
		 *
		 * SSW Gaming Calendar
		 *
		 * This is most likely going to be replaced with something similar to:
		 *
		 * $railModuleList[1260] = array( 'Ad', 'Index', array( 'slotname' => 'GAMING_CALENDAR_RAIL' ) );
		 */
		if ( !empty( $wgEnableGamingCalendarExt ) ) {
			$railModuleList[1430] = array( 'GamingCalendarRail', 'Index', array( ) );
		}
		else {
			$railModuleList[1430] = array('Ad', 'Index', array('slotname' => 'TOP_RIGHT_BUTTON'));
		}

		// WikiNav v2 - begin
		// TODO: remove once it's enabled sitewide
		global $wgOasisNavV2;
		if (!empty($wgOasisNavV2)) {
			// remove PagesOnWiki module
			unset($railModuleList[1450]);
		}
		// WikiNav v2 - end

		wfRunHooks( 'GetRailModuleList', array( &$railModuleList ) );

		wfProfileOut(__METHOD__);

		return $railModuleList;
	}
Exemplo n.º 9
0
 /**
  * Check if the current page should be rendered using Venus
  *
  * @param Title $title
  * @return bool
  */
 public static function showVenusSkin(Title $title)
 {
     global $wgEnableVenusSkin, $wgEnableVenusSpecialSearch, $wgEnableVenusArticle, $wgRequest;
     $wrapper = new GlobalStateWrapper(['wgTitle' => $title]);
     $isSearch = false;
     $isArticlePage = false;
     $wrapper->wrap(function () use(&$isSearch, &$isArticlePage) {
         $isSearch = WikiaPageType::isSearch();
         $isArticlePage = WikiaPageType::isArticlePage();
     });
     $action = $wgRequest->getVal('action');
     $diff = $wgRequest->getVal('diff');
     $isSpecialSearch = $isSearch && $wgEnableVenusSpecialSearch;
     $isSpecialVenusTest = $title->isSpecialPage() && $title->getText() == 'VenusTest';
     $isVenusArticle = $isArticlePage && $wgEnableVenusArticle && (empty($action) || $action == 'view') && empty($diff);
     return $wgEnableVenusSkin && ($isSpecialSearch || $isSpecialVenusTest || $isVenusArticle);
 }
Exemplo n.º 10
0
 function getZone2()
 {
     if ($this->isMainPage) {
         return 'home';
     } elseif (WikiaPageType::isSearch()) {
         return 'search';
     } else {
         return 'article';
     }
 }
Exemplo n.º 11
0
<?php
echo '<div class="WikiaTopAds'.$topAdsExtraClasses.'" id="WikiaTopAds">';
echo '<div class="WikiaTopAdsInner">';

if (WikiaPageType::isWikiaHub()) {
	echo F::app()->renderView('Ad', 'Index', array('slotname' => 'HOME_TOP_LEADERBOARD'));
}
elseif ($wg->EnableCorporatePageExt) {
	if (WikiaPageType::isSearch()) {
		echo F::app()->renderView('Ad', 'Index', array('slotname' => 'TOP_LEADERBOARD'));
	}
	else {
		echo F::app()->renderView('Ad', 'Index', array('slotname' => 'CORP_TOP_LEADERBOARD'));
	}
} else {
	if (in_array('leaderboard', $wg->ABTests)) {
		// no leaderboard ads
	} else {
		echo F::app()->renderView('Ad', 'Index', array('slotname' => 'TOP_LEADERBOARD'));
		echo F::app()->renderView('Ad', 'Index', array('slotname' => 'HOME_TOP_LEADERBOARD'));
	}
}
if ($wg->EnableTopButton) {
	echo F::app()->renderView('Ad', 'Index', array('slotname' => 'TOP_BUTTON'));
}

echo '</div>';
echo '</div>';
?>