/** * Inserts the necessary HTML to start the left column * * @param string $input Input between the <sample> and </sample> tags, or null if the tag is "closed", i.e. <sample /> * @param array $args Tag arguments, which are entered like HTML tag attributes; this is an associative array indexed by attribute name. * @param array $parser The parent parser (a Parser object); more advanced extensions use this to obtain the contextual Title, parse wiki text, expand braces, register link relationships and dependencies, etc. */ function wfMainPageTag_lcs($input, $args, $parser) { global $wfMainPageTag_rcs_called, $wfMainPageTag_lcs_called, $wgMainPageTag_count; $wfMainPageTag_lcs_called = true; $wgMainPageTag_count++; $isOasis = F::app()->checkSkin('oasis'); $isGridLayoutEnabled = $isOasis && BodyController::isGridLayoutEnabled(); $isResponsiveLayoutEnabled = $isOasis && BodyController::isResponsiveLayoutEnabled(); $areBreakpointsLayoutEnabled = $isOasis && BodyController::isOasisBreakpoints(); $gutter = isset($args['gutter']) ? str_replace('px', '', $args['gutter']) : 10; $html = '<div class="main-page-tag-lcs '; if ($isGridLayoutEnabled) { $html .= 'grid-4 alpha '; } if ($wfMainPageTag_rcs_called) { $html .= 'main-page-tag-lcs-collapsed"'; if (!$isResponsiveLayoutEnabled && !$areBreakpointsLayoutEnabled) { $html .= ' style="padding-right: ' . $gutter . 'px"'; } $html .= '><div class="lcs-container">'; } else { $gutter += 300; $html .= 'main-page-tag-lcs-exploded" '; if ($isGridLayoutEnabled || $isResponsiveLayoutEnabled || $areBreakpointsLayoutEnabled) { $html .= '><div class="lcs-container">'; } else { $html .= 'style="margin-right: -' . $gutter . 'px; "><div class="lcs-container" style="margin-right: ' . $gutter . 'px;">'; } } return $html; }
public function executeIndex($params) { wfProfileIn(__METHOD__); $this->railModuleList = isset($params['railModuleList']) ? $params['railModuleList'] : null; $this->isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); wfProfileOut(__METHOD__); }
public function executeIndex($params) { wfProfileIn(__METHOD__); $railModules = isset($params['railModuleList']) ? $params['railModuleList'] : []; $this->railModuleList = $this->filterModules($railModules, self::FILTER_NON_LAZY_MODULES); $this->isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); $this->isAside = $this->wg->RailInAside; $this->loadLazyRail = $railModules > $this->railModuleList; wfProfileOut(__METHOD__); }
public function __construct($ownerUser = null) { global $wgUser, $wgTitle; if (!isset($ownerUser)) { $ownerUser = User::newFromName(UserPagesHeaderController::getUserName($wgTitle, BodyController::getUserPagesNamespaces())); } $this->ownerUser = $ownerUser; $this->viewerUser = $wgUser; $this->owner = new AchUser($this->ownerUser); $this->viewer = new AchUser($this->viewerUser); }
/** * 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; }
/** * 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; }
public function onBeforePageDisplay(OutputPage $out, $skin) { wfProfileIn(__METHOD__); // don't load it on edit pages (perf improvement) if (F::app()->checkSkin('oasis', $skin) && !BodyController::isEditPage()) { $assetsManager = F::build('AssetsManager', array(), 'getInstance'); $scssPackage = 'relatedvideos_scss'; $jsPackage = 'relatedvideos_js'; foreach ($assetsManager->getURL($scssPackage) as $url) { $out->addStyle($url); } foreach ($assetsManager->getURL($jsPackage) as $url) { $out->addScript("<script src=\"{$url}\"></script>"); } } wfProfileOut(__METHOD__); return true; }
/** * Returns a set of sass parameters set by the webapp that should not be saved to wiki themesettings * For example, skin width is an webapp, application, setting. It is not user controllable. * Rationale: User-set theme settings and skin logic should be kept separate. * User-set theme settings should be saved. * Non-settable settings should be driven programmatically. */ public static function getApplicationThemeSettings() { if (class_exists('BodyController') && BodyController::isOasisBreakpoints()) { $params = ['widthType' => 0]; if (BodyController::isOasisTypography()) { $params['oasisTypography'] = 1; } return $params; } else { $params = []; global $wgOasisGrid; if ($wgOasisGrid) { $params['widthType'] = 3; } // Should be last so it can override wgOasisGrid if (class_exists('BodyController') && BodyController::isResponsiveLayoutEnabled()) { $params['widthType'] = 2; } return $params; } }
public function getHTML() { wfProfileIn(__METHOD__); global $wgTitle, $wgUser; //fix #10881, get correct username from user namespace subpages $this->mUserOwner = F::build('User', array(UserPagesHeaderController::getUserName($wgTitle, BodyController::getUserPagesNamespaces())), 'newFromName'); if (in_array(strtolower(RequestContext::getMain()->getSkin()->getSkinName()), array('oasis')) && $this->mUserOwner && AchAwardingService::canEarnBadges($this->mUserOwner) && $this->mUserOwner->isLoggedIn() && !($wgUser->getId() == $this->mUserOwner->getId() && $wgUser->getOption('hidepersonalachievements'))) { $this->mUserViewer = $wgUser; if ($this->mUserViewer->isLoggedIn() && $this->mUserViewer->getId() != $this->mUserOwner->getId()) { $this->loadViewerBadges(); $this->loadViewerCounters(); } $this->loadOwnerBadges(); $this->loadOwnerCounters(); $this->prepareChallenges(); $tmplData = array(); $tmplData['ownerBadges'] = $this->mOwnerBadgesSimple; $tmplData['challengesBadges'] = $this->mChallengesBadges; $tmplData['title_no'] = wfMsg('achievements-profile-title-no', $this->mUserOwner->getName()); $tmplData['title'] = wfMsgExt('achievements-profile-title', array('parsemag'), $this->mUserOwner->getName(), count($this->mOwnerBadgesSimple)); $tmplData['title_challenges'] = wfMsg('achievements-profile-title-challenges', $this->mUserOwner->getName()); $tmplData['leaderboard_url'] = Skin::makeSpecialUrl("Leaderboard"); if (count($this->mOwnerBadgesExtended) > 0) { $rankingService = new AchRankingService(); $tmplData['user_rank'] = $rankingService->getUserRankingPosition($this->mUserOwner); } if ($this->mUserViewer->isAllowed('editinterface')) { $tmplData['customize_url'] = Skin::makeSpecialUrl("AchievementsCustomize"); } $template = new EasyTemplate(dirname(__FILE__) . '/../templates'); $template->set_vars($tmplData); $out = $template->render('ProfileBox'); } else { $out = ''; } wfProfileOut(__METHOD__); return $out; }
?> <?php echo $headItems; ?> </head> <body class="<?php echo implode(' ', $bodyClasses); ?> "<?php echo $itemType; ?> > <?php if (BodyController::isResponsiveLayoutEnabled() || BodyController::isOasisBreakpoints()) { ?> <div class="background-image-gradient"></div> <?php } ?> <?php echo $comScore; echo $quantServe; echo $googleAnalytics; echo $amazonMatch; echo $dynamicYield; echo $ivw2; echo $rubiconRtp; ?>
/** * Render default page header (with edit dropdown, history dropdown, ...) * * @param: array $params * key: showSearchBox (default: false) */ public function executeIndex($params) { global $wgTitle, $wgArticle, $wgOut, $wgUser, $wgContLang, $wgSupressPageTitle, $wgSupressPageSubtitle, $wgSuppressNamespacePrefix, $wgEnableWallExt; wfProfileIn(__METHOD__); $this->isUserLoggedIn = $wgUser->isLoggedIn(); // check for video add button permissions $this->showAddVideoBtn = $wgUser->isAllowed('videoupload'); // page namespace $ns = $wgTitle->getNamespace(); /** start of wikia changes @author nAndy */ $this->isWallEnabled = !empty($wgEnableWallExt) && $ns == NS_USER_WALL; /** end of wikia changes */ // currently used skin $skin = RequestContext::getMain()->getSkin(); // action button (edit / view soruce) and dropdown for it $this->prepareActionButton(); // dropdown actions $this->dropdown = $this->getDropdownActions(); /** start of wikia changes @author nAndy */ $response = $this->getResponse(); if ($response instanceof WikiaResponse) { wfRunHooks('PageHeaderIndexAfterActionButtonPrepared', array($response, $ns, $skin)); /** @author Jakub */ $this->extraButtons = array(); wfRunHooks('PageHeaderIndexExtraButtons', array($response)); } else { // it happened on TimQ's devbox that $response was probably null fb#28747 WikiaLogger::instance()->error('Response not an instance of WikiaResponse', ['ex' => new Exception()]); } /** end of wikia changes */ // for not existing pages page header is a bit different $this->pageExists = !empty($wgTitle) && $wgTitle->exists(); // default title "settings" (RT #145371), don't touch special pages if ($ns != NS_SPECIAL) { $this->displaytitle = true; $this->title = $wgOut->getPageTitle(); } else { // on special pages titles are already properly encoded (BugId:5983) $this->displaytitle = true; } // perform namespace and special page check // use service to get data $service = PageStatsService::newFromTitle($wgTitle); // comments - moved here to display comments even on deleted/non-existant pages $this->comments = $service->getCommentsCount(); if ($this->pageExists) { // mainpage? if (WikiaPageType::isMainPage()) { $this->isMainPage = true; } // number of pages on this wiki $this->tallyMsg = wfMessage('oasis-total-articles-mainpage', SiteStats::articles())->parse(); } // 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; } // talk pages if ($wgTitle->isTalkPage()) { // remove comments & FB like button $this->comments = false; // Talk: <page name without namespace prefix> $this->displaytitle = true; $this->title = Xml::element('strong', array(), $wgContLang->getNsText(NS_TALK) . ':'); $this->title .= htmlspecialchars($wgTitle->getText()); // back to subject article link switch ($ns) { case NS_TEMPLATE_TALK: $msgKey = 'oasis-page-header-back-to-template'; break; case NS_MEDIAWIKI_TALK: $msgKey = 'oasis-page-header-back-to-mediawiki'; break; case NS_CATEGORY_TALK: $msgKey = 'oasis-page-header-back-to-category'; break; case NS_FILE_TALK: $msgKey = 'oasis-page-header-back-to-file'; break; default: $msgKey = 'oasis-page-header-back-to-article'; } $this->pageTalkSubject = Wikia::link($wgTitle->getSubjectPage(), wfMsg($msgKey), array('accesskey' => 'c')); } // forum namespace if ($ns == NS_FORUM) { // remove comments button $this->comments = false; // remove namespace prefix $this->title = $wgTitle->getText(); $this->displaytitle = false; } // mainpage if (WikiaPageType::isMainPage()) { // change page title to just "Home" $this->title = wfMsg('oasis-home'); } // render page type info switch ($ns) { case NS_MEDIAWIKI: $this->pageType = wfMsg('oasis-page-header-subtitle-mediawiki'); break; case NS_TEMPLATE: $this->pageType = wfMsg('oasis-page-header-subtitle-template'); break; case NS_SPECIAL: $this->pageType = wfMsg('oasis-page-header-subtitle-special'); // remove comments button (fix FB#3404 - Marooned) $this->comments = false; if ($wgTitle->isSpecial('Newimages')) { $this->isNewFiles = true; } if ($wgTitle->isSpecial('Videos')) { $this->isSpecialVideos = true; $mediaService = new MediaQueryService(); $this->tallyMsg = wfMessage('specialvideos-wiki-videos-tally', $mediaService->getTotalVideos())->parse(); } if ($wgTitle->isSpecial('LicensedVideoSwap')) { $this->pageType = ""; } break; case NS_CATEGORY: $this->pageType = wfMsg('oasis-page-header-subtitle-category'); break; case NS_FORUM: $this->pageType = wfMsg('oasis-page-header-subtitle-forum'); break; } // render subpage info $this->pageSubject = $skin->subPageSubtitle(); if (in_array($wgTitle->getNamespace(), BodyController::getUserPagesNamespaces())) { $title = explode(':', $this->title, 2); // User:Foo/World_Of_Warcraft:_Residers_in_Shadows (BAC-494) if (count($title) >= 2 && $wgTitle->getNsText() == str_replace(' ', '_', $title[0])) { // in case of error page (showErrorPage) $title is just a string (cannot explode it) $this->title = $title[1]; } } // render MW subtitle (contains old revision data) $this->subtitle = $wgOut->getSubtitle(); // render redirect info (redirected from) if (!empty($wgArticle->mRedirectedFrom)) { $this->pageRedirect = trim($this->subtitle, '()'); $this->subtitle = ''; } // render redirect page (redirect to) if ($wgTitle->isRedirect()) { $this->pageType = $this->subtitle; $this->subtitle = ''; } if (!empty($wgSupressPageTitle)) { $this->title = ''; $this->subtitle = ''; } if (!empty($wgSupressPageSubtitle)) { $this->subtitle = ''; $this->pageSubtitle = ''; } else { // render pageType, pageSubject and pageSubtitle as one message $subtitle = array_filter(array($this->pageType, $this->pageTalkSubject, $this->pageSubject, $this->pageRedirect)); /* * support for language variants * this adds links which automatically convert the content to that variant * * @author tor@wikia-inc.com * @author macbre@wikia-inc.com */ $variants = $this->skinTemplate->get('content_navigation')['variants']; if (!empty($variants)) { foreach ($variants as $variant) { $subtitle[] = Xml::element('a', array('href' => $variant['href'], 'rel' => 'nofollow', 'id' => $variant['id']), $variant['text']); } } $pipe = wfMsg('pipe-separator'); $this->pageSubtitle = implode(" {$pipe} ", $subtitle); } // force AjaxLogin popup for "Add a page" button (moved from the template) $this->loginClass = !empty($this->wg->DisableAnonymousEditing) ? ' require-login' : ''; // render monetization module if (!empty($params['monetizationModules'])) { $this->monetizationModules = $params['monetizationModules']; } wfProfileOut(__METHOD__); }
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; }
/** * Sets values for the view to work with during index method. * @param Wikia\Search\Config $searchConfig */ protected function setResponseValuesFromConfig(Wikia\Search\Config $searchConfig) { global $wgLanguageCode; $response = $this->getResponse(); $format = $response->getFormat(); if ($format == 'json' || $format == 'jsonp') { $results = $searchConfig->getResults(); if ($results) { $response->setData($results->toArray(explode(',', $this->getVal('jsonfields', 'title,url,pageid')))); } else { $response->setData([]); } return; } if (!$searchConfig->getInterWiki()) { $this->setVal('advancedSearchBox', $this->sendSelfRequest('advancedBox', array('config' => $searchConfig))); } $isGridLayoutEnabled = BodyController::isGridLayoutEnabled(); $tabsArgs = array('config' => $searchConfig, 'by_category' => $this->getVal('by_category', false), 'filters' => $this->getVal('filters', array())); $isMonobook = $this->app->checkSkin('monobook'); $this->setVal('results', $searchConfig->getResults()); $this->setVal('resultsFound', $searchConfig->getResultsFound()); $this->setVal('resultsFoundTruncated', $searchConfig->getTruncatedResultsNum(true)); $this->setVal('isOneResultsPageOnly', $searchConfig->getNumPages() < 2); $this->setVal('pagesCount', $searchConfig->getNumPages()); $this->setVal('currentPage', $searchConfig->getPage()); $this->setVal('paginationLinks', $this->sendSelfRequest('pagination', $tabsArgs)); $this->setVal('tabs', $this->sendSelfRequest('tabs', $tabsArgs)); $this->setVal('query', $searchConfig->getQuery()->getQueryForHtml()); $this->setVal('resultsPerPage', $searchConfig->getLimit()); $this->setVal('specialSearchUrl', $this->wg->Title->getFullUrl()); $this->setVal('isInterWiki', $searchConfig->getInterWiki()); $this->setVal('namespaces', $searchConfig->getNamespaces()); $this->setVal('hub', $searchConfig->getHub()); $this->setVal('hasArticleMatch', $searchConfig->hasArticleMatch()); $this->setVal('isMonobook', $isMonobook); $this->setVal('isCorporateWiki', $this->isCorporateWiki()); $this->setVal('wgExtensionsPath', $this->wg->ExtensionsPath); $this->setVal('isGridLayoutEnabled', $isGridLayoutEnabled); $this->setVal('shownResultsBegin', $this->resultsPerPage * $this->currentPage - $this->resultsPerPage + 1); if ($this->isCorporateWiki()) { $resultsLang = $searchConfig->getLanguageCode(); if ($resultsLang != $this->app->wg->ContLang->getCode()) { $this->setVal('resultsLang', $resultsLang); } } if ($this->currentPage == $this->pagesCount) { $this->setVal('shownResultsEnd', $this->resultsFound); } else { $this->setVal('shownResultsEnd', $this->resultsPerPage * $this->currentPage); } $sanitizedQuery = $searchConfig->getQuery()->getSanitizedQuery(); if (strlen($sanitizedQuery) > 0 && in_array(0, $searchConfig->getNamespaces()) && !in_array(6, $searchConfig->getNamespaces())) { $combinedMediaResult = $this->sendSelfRequest('combinedMediaSearch', array('q' => $sanitizedQuery, 'videoOnly' => true))->getData(); if (isset($combinedMediaResult) && sizeof($combinedMediaResult['items']) == 4) { $this->setVal('mediaData', $combinedMediaResult); } } else { $this->setVal('mediaData', []); } if ($this->wg->OnWikiSearchIncludesWikiMatch && $searchConfig->hasWikiMatch()) { $this->registerWikiMatch($searchConfig); } $topWikiArticlesHtml = ''; if (!$searchConfig->getInterWiki() && $wgLanguageCode == 'en' && !$isMonobook) { $dbname = $this->wg->DBName; $cacheKey = wfMemcKey(__CLASS__, 'WikiaSearch', 'topWikiArticles', $this->wg->CityId, static::TOP_ARTICLES_CACHE, $isGridLayoutEnabled); $topWikiArticlesHtml = WikiaDataAccess::cache($cacheKey, 86400 * 5, function () { return $this->app->renderView('WikiaSearchController', 'topWikiArticles'); }); } $this->setVal('topWikiArticles', $topWikiArticlesHtml); }
private function loadJs() { global $wgTitle, $wgOut, $wgJsMimeType, $wgUser; wfProfileIn(__METHOD__); // decide where JS should be placed (only add JS at the top for special and edit pages) if ($wgTitle->getNamespace() == NS_SPECIAL || BodyController::isEditPage()) { $this->jsAtBottom = false; } else { $this->jsAtBottom = true; } //store AssetsManager output and reset jsFiles $jsAssets = $this->jsFiles; $this->jsFiles = ''; // load WikiaScriptLoader $this->wikiaScriptLoader = ''; $wslFiles = AssetsManager::getInstance()->getGroupCommonURL( 'wsl' ); foreach($wslFiles as $wslFile) { $this->wikiaScriptLoader .= "<script type=\"$wgJsMimeType\" src=\"$wslFile\"></script>"; } // get JS files from <script> tags returned by AssetsManager // TODO: get AssetsManager package (and other JS files to be loaded) here preg_match_all("/src=\"([^\"]+)/", $jsAssets, $matches, PREG_SET_ORDER); foreach($matches as $scriptSrc) { $jsReferences[] = str_replace('&', '&', $scriptSrc[1]);; } // move JS files added to OutputPage to list of files to be loaded using WSL $scripts = $wgUser->getSkin()->getScripts(); foreach ( $scripts as $s ) { //add inline scripts to jsFiles and move non-inline to WSL queue if ( !empty( $s['url'] ) ) { $jsReferences[] = $s['url']; } else { $this->jsFiles .= $s['tag']; } } // add user JS (if User:XXX/wikia.js page exists) // copied from Skin::getHeadScripts if($wgUser->isLoggedIn()){ wfProfileIn(__METHOD__ . '::checkForEmptyUserJS'); $userJS = $wgUser->getUserPage()->getPrefixedText() . '/wikia.js'; $userJStitle = Title::newFromText( $userJS ); if ( $userJStitle->exists() ) { global $wgSquidMaxage; $siteargs = array( 'action' => 'raw', 'maxage' => $wgSquidMaxage, ); $userJS = Skin::makeUrl( $userJS, wfArrayToCGI( $siteargs ) ); $jsReferences[] = Skin::makeUrl( $userJS, wfArrayToCGI( $siteargs ) );; } wfProfileOut(__METHOD__ . '::checkForEmptyUserJS'); } // generate code to load JS files $jsReferences = json_encode($jsReferences); $jsLoader = "<script type=\"text/javascript\">/*<![CDATA[*/ (function(){ wsl.loadScript({$jsReferences}); })(); /*]]>*/</script>"; // use loader script instead of separate JS files $this->jsFiles = $jsLoader . $this->jsFiles; wfProfileOut(__METHOD__); }
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; } }
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; } } }
/** * Render header for blog post */ public function executeBlogPost() { wfProfileIn(__METHOD__); global $wgTitle, $wgLang, $wgOut; // remove User_blog:xxx from title $titleParts = explode('/', $wgTitle->getText()); array_shift($titleParts); $this->title = implode('/', $titleParts); // get user name to display in header $this->userName = self::getUserName($wgTitle, BodyController::getUserPagesNamespaces()); // render avatar (48x48) $this->avatar = AvatarService::renderAvatar($this->userName, 48); // link to user page $this->userPage = AvatarService::getUrl($this->userName); // user stats (edit points, account creation date) $this->stats = $this->getStats($this->userName); // commments / likes / date of first edit if (!empty($wgTitle) && $wgTitle->exists()) { $service = new PageStatsService($wgTitle->getArticleId()); $this->editTimestamp = $wgLang->date($service->getFirstRevisionTimestamp()); $this->comments = $service->getCommentsCount(); $this->likes = true; } $actionMenu = array(); // edit button / dropdown if (isset($this->content_actions['edit'])) { $actionMenu['action'] = $this->content_actions['edit']; } // dropdown actions $actions = array('move', 'protect', 'unprotect', 'delete', 'undelete', 'history'); foreach($actions as $action) { if (isset($this->content_actions[$action])) { $actionMenu['dropdown'][$action] = $this->content_actions[$action]; } } $this->actionMenu = $actionMenu; // load CSS for .WikiaUserPagesHeader (BugId:9212, 10246) $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/core/UserPagesHeader.scss")); wfProfileOut(__METHOD__); }
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; }
/** * add resources needed by chat * as chat entry points or links can appear on any page, * we really need them everywhere */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { global $wgExtensionsPath, $wgTitle, $wgResourceBasePath; wfProfileIn(__METHOD__); $sp = array('Contributions', 'Log', 'Recentchanges'); foreach ($sp as $value) { if ($wgTitle->isSpecial($value)) { // For Chat2 (doesn't exist in Chat(1)) $srcs = F::build('AssetsManager', array(), 'getInstance')->getGroupCommonURL('chat_ban_js', array()); foreach ($srcs as $val) { $out->addScript('<script src="' . $val . '"></script>'); } F::build('JSMessages')->enqueuePackage('ChatBanModal', JSMessages::EXTERNAL); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatModal.scss')); break; } } // don't load ChatEntryPoint on edit pages (perf optimization) if (F::app()->checkSkin('oasis') && !BodyController::isEditPage()) { // TODO: move these to asset manager when we release chat globally $out->addScriptFile($wgResourceBasePath . '/resources/wikia/libraries/bootstrap/popover.js'); $out->addScriptFile($wgExtensionsPath . '/wikia/Chat2/js/ChatEntryPoint.js'); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('resources/wikia/libraries/bootstrap/popover.scss')); $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatEntryPoint.scss')); } wfProfileOut(__METHOD__); return true; }
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; }
<?php include "classes/controller/IController.php"; include "classes/controller/NavigationController.php"; include "classes/controller/HeaderController.php"; include "classes/controller/BodyController.php"; include "classes/view/View.php"; include "classes/model/Artist.php"; include "classes/model/Category.php"; include "classes/model/Museum.php"; include "classes/model/Owner.php"; include "classes/model/Picture.php"; include "classes/model/SearchData.php"; include "classes/model/DisplayPicture.php"; include "classes/model/ComparisonPicture.php"; include "includes/DbManager.php"; session_start(); $request = array_merge($_GET, $_POST, $_FILES); $headerController = new HeaderController($request); $navigationController = new NavigationController($request); $bodyController = new BodyController($request); echo $headerController->display(); echo $navigationController->display(); echo $bodyController->display();
/** * Render header for blog post */ public function executeBlogPost() { wfProfileIn(__METHOD__); global $wgTitle, $wgLang, $wgOut; // remove User_blog:xxx from title $titleParts = explode('/', $wgTitle->getText()); array_shift($titleParts); $this->title = implode('/', $titleParts); // get user name to display in header $this->userName = self::getUserName($wgTitle, BodyController::getUserPagesNamespaces()); // render avatar (48x48) $this->avatar = AvatarService::renderAvatar($this->userName, 48); // link to user page $this->userPage = AvatarService::getUrl($this->userName); if ($this->wg->EnableBlogArticles) { // link to user blog page $this->userBlogPage = AvatarService::getUrl($this->userName, NS_BLOG_ARTICLE); // user blog page message $this->userBlogPageMessage = wfMessage('user-blog-url-link', $this->userName)->inContentLanguage()->parse(); } if (!empty($this->wg->EnableGoogleAuthorInfo) && !empty($this->wg->GoogleAuthorLinks) && array_key_exists($this->userName, $this->wg->GoogleAuthorLinks)) { $this->googleAuthorLink = $this->wg->GoogleAuthorLinks[$this->userName] . '?rel=author'; } if ($this->app->wg->Request->getVal('action') == 'history' || $this->app->wg->Request->getCheck('diff')) { $this->navLinks = Wikia::link($this->app->wg->title, wfMsg('oasis-page-header-back-to-article'), array(), array(), 'known'); } // user stats (edit points, account creation date) $this->stats = $this->getStats($this->userName); // commments / likes / date of first edit if (!empty($wgTitle) && $wgTitle->exists()) { $service = new PageStatsService($wgTitle->getArticleId()); $this->editTimestamp = $wgLang->date($service->getFirstRevisionTimestamp()); $this->comments = $service->getCommentsCount(); } $actionMenu = array(); $dropdownActions = array('move', 'protect', 'unprotect', 'delete', 'undelete', 'history'); // edit button / dropdown if (isset($this->content_actions['ve-edit'])) { // new visual editor is enabled $actionMenu['action'] = $this->content_actions['ve-edit']; // add classic editor link to the possible dropdown options array_unshift($dropdownActions, 'edit'); } else { if (isset($this->content_actions['edit'])) { $actionMenu['action'] = $this->content_actions['edit']; } } foreach ($dropdownActions as $action) { if (isset($this->content_actions[$action])) { $actionMenu['dropdown'][$action] = $this->content_actions[$action]; } } $this->actionMenu = $actionMenu; // load CSS for .WikiaUserPagesHeader (BugId:9212, 10246) $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/core/UserPagesHeader.scss")); wfProfileOut(__METHOD__); }
/** * 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 (defined('NS_VIDEO')) { $namespaces[] = NS_VIDEO; } if ( in_array($ns, array_merge( $namespaces, $wgSuppressNamespacePrefix ) ) ) { $this->title = $wgTitle->getText(); $this->displaytitle = false; } if (WikiaPageType::isMainPage()) { $this->title = ''; $this->subtitle = ''; } else if (BodyController::isHubPage()) { $this->title = wfMsg('hub-header', $wgTitle); } wfProfileOut( __METHOD__ ); }