本文整理汇总了PHP中Wikia::isMainPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Wikia::isMainPage方法的具体用法?PHP Wikia::isMainPage怎么用?PHP Wikia::isMainPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wikia
的用法示例。
在下文中一共展示了Wikia::isMainPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTag
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';
}
示例2: section
/**
* @desc Related pages are lazy-loaded on article pages for mobile, oasis and monobook. However, there are extensions
* dependent on this method where related pages module isn't lazy-loaded such as: FilePage (FilePageController.class.php)
*/
public function section()
{
global $wgTitle, $wgContentNamespaces, $wgRequest, $wgMemc;
// request params
$altTitle = $this->request->getVal('altTitle', null);
$relatedPages = RelatedPages::getInstance();
$anyNs = $this->request->getVal('anyNS', false);
$title = empty($altTitle) ? $wgTitle : $altTitle;
$articleid = $title->getArticleId();
if (!$anyNs) {
$ignoreNS = !empty($wgTitle) && in_array($wgTitle->getNamespace(), $wgContentNamespaces);
} else {
$ignoreNS = false;
}
$this->skipRendering = Wikia::isMainPage() || $ignoreNS || count($relatedPages->getCategories($articleid)) == 0 || $wgRequest->getVal('action', 'view') != 'view' || $relatedPages->isRendered();
if (!$this->skipRendering) {
$mKey = wfMemcKey('mOasisRelatedPages', $articleid, self::MEMC_KEY_VER);
$this->pages = $wgMemc->get($mKey);
$this->srcAttrName = $this->app->checkSkin('monobook') ? 'src' : 'data-src';
if (empty($this->pages)) {
$this->pages = $relatedPages->get($articleid);
if (count($this->pages) > 0) {
$wgMemc->set($mKey, $this->pages, 3 * 3600);
} else {
$this->skipRendering = true;
}
}
}
$this->mobileSkin = false;
$this->relatedPagesHeading = wfMessage('wikiarelatedpages-heading')->plain();
}
示例3: getCarusel
public function getCarusel()
{
if ($this->app->checkSkin('wikiamobile') || Wikia::isMainPage() || !$this->app->wg->title instanceof Title || !$this->app->wg->title->exists()) {
return false;
}
$rvs = new RelatedVideosService();
$videos = $rvs->getRVforArticleId($this->app->wg->title->getArticleId());
$this->linkToSeeMore = !empty($this->app->wg->EnableSpecialVideosExt) ? SpecialPage::getTitleFor("Videos")->escapeLocalUrl() : Title::newFromText(WikiaVideoPage::getVideosCategory())->getFullUrl();
$this->videos = $videos;
$mediaService = F::build('MediaQueryService');
/** @var $mediaService MediaQueryService */
$this->totalVideos = $this->wg->Lang->formatNum($mediaService->getTotalVideos());
}
示例4: executeIndex
public function executeIndex()
{
global $wgTitle, $wgContentNamespaces, $wgRequest, $wgMemc, $wgRelatedPagesAddAfterSection;
$relatedPages = RelatedPages::getInstance();
$categories = $this->request->getVal('categories');
if (!is_null($categories)) {
$relatedPages->setCategories($categories);
}
// check for mainpage
if (Wikia::isMainPage()) {
$this->skipRendering = true;
}
// check for content namespaces
if (!empty($wgTitle) && !in_array($wgTitle->getNamespace(), $wgContentNamespaces)) {
$this->skipRendering = true;
}
// check if we have any categories
if (count($relatedPages->getCategories()) == 0) {
$this->skipRendering = true;
}
// check action
if ($wgRequest->getVal('action', 'view') != 'view') {
$this->skipRendering = true;
}
// skip, if module was already rendered
if ($relatedPages->isRendered()) {
$this->skipRendering = true;
}
if (!$this->skipRendering) {
$mKey = wfMemcKey('mOasisRelatedPages', $wgTitle->getArticleId());
$this->pages = $wgMemc->get($mKey);
$this->srcAttrName = $this->app->checkSkin('monobook') ? 'src' : 'data-src';
if (empty($this->pages)) {
$this->pages = $relatedPages->get($wgTitle->getArticleId());
if (count($this->pages) > 0) {
$wgMemc->set($mKey, $this->pages, 3 * 3600);
} else {
$this->skipRendering = true;
}
}
// RT #84264
if (!empty($wgRelatedPagesAddAfterSection) && is_numeric($wgRelatedPagesAddAfterSection)) {
$this->addAfterSection = intval($wgRelatedPagesAddAfterSection);
}
}
if ($this->app->checkSkin('wikiamobile')) {
$this->overrideTemplate('WikiaMobileIndex');
}
}
示例5: getCarusel
public function getCarusel()
{
if (Wikia::isMainPage() || !$this->app->wg->Title instanceof Title || !$this->app->wg->Title->exists()) {
return false;
}
$data = $this->getVal('data', null);
$videos = array();
if (!empty($data)) {
foreach ($data as $hubVideoData) {
$videoTitleTxt = $hubVideoData['videoTitleText'];
$videoUsername = $hubVideoData['username'];
$memcKey = $this->getMemcHubsVideoKey($videoTitleTxt, $videoUsername);
$videoData = $this->getMemcHubsVideoData($memcKey);
if (empty($videoData)) {
Wikia::log(__METHOD__, 'Not from cache');
$videoTitle = Title::newFromText($videoTitleTxt, NS_VIDEO);
if ($videoTitle instanceof Title) {
$videoArticleId = $videoTitle->getArticleID();
$result = F::app()->sendRequest('RelatedVideos', 'getVideoData', array('width' => 160, 'title' => $videoTitle, 'articleId' => $videoArticleId))->getData();
$result['data']['external'] = 0;
$result['data']['wiki'] = stripos($hubVideoData['wikiUrl'], 'http://') === false && stripos($hubVideoData['wikiUrl'], 'https://') === false ? 'http://' . $hubVideoData['wikiUrl'] : $hubVideoData['wikiUrl'];
//overwrite owner's data (on Hub page we display name of user who suggested the video)
if (isset($result['data']['owner']) && $result['data']['owner'] !== $videoUsername) {
$userSuggested = F::build('User', array($videoUsername), 'newFromName');
if ($userSuggested instanceof User) {
$userPage = $userSuggested->getUserPage();
$result['data']['owner'] = Xml::element('a', array('href' => $userPage->getFullUrl(), 'class' => 'added-by', 'data-owner' => $userSuggested->getName(), 'title' => $userPage->getText()), $userSuggested->getName());
$result['data']['ownerUrl'] = $userPage->getFullUrl();
}
}
if (!isset($result['data']['error']) && !empty($result['data'])) {
$videoData = $result['data'];
$this->setMemcHubsVideoData($memcKey, $videoData);
$videos[] = $videoData;
}
}
} else {
$videos[] = $videoData;
}
}
}
$this->setVal('videos', $videos);
}
示例6: getTag
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';
}
示例7: executeEditPage
/**
* Render header for edit page
*/
public function executeEditPage()
{
global $wgTitle, $wgRequest, $wgSuppressToolbar, $wgShowMyToolsOnly, $wgEnableWallExt;
wfProfileIn(__METHOD__);
// special handling for special pages (CreateBlogPost, CreatePage)
$ns = $wgTitle->getNamespace();
if ($ns == NS_SPECIAL) {
wfProfileOut(__METHOD__);
return;
}
// detect section edit
$isSectionEdit = is_numeric($wgRequest->getVal('section'));
// show proper message in the header
$action = $wgRequest->getVal('action', 'view');
$isPreview = $wgRequest->getCheck('wpPreview') || $wgRequest->getCheck('wpLivePreview');
$isShowChanges = $wgRequest->getCheck('wpDiff');
$isDiff = !is_null($wgRequest->getVal('diff'));
// RT #69931
$isEdit = in_array($action, array('edit', 'submit'));
$isHistory = $action == 'history';
/** start of wikia changes @author nAndy */
$this->isHistory = $isHistory;
$this->isUserTalkArchiveModeEnabled = !empty($wgEnableWallExt) && $ns == NS_USER_TALK;
/** end of wikia changes */
// add editor's right rail when not editing main page
if (!Wikia::isMainPage()) {
OasisController::addBodyClass('editor-rail');
}
// hide floating toolbar when on edit page / in preview mode / show changes
if ($isEdit || $isPreview) {
$wgSuppressToolbar = true;
}
// choose header message
if ($isPreview) {
$titleMsg = 'oasis-page-header-preview';
} else {
if ($isShowChanges) {
$titleMsg = 'oasis-page-header-changes';
} else {
if ($isDiff) {
$titleMsg = 'oasis-page-header-diff';
} else {
if ($isSectionEdit) {
$titleMsg = 'oasis-page-header-editing-section';
} else {
if ($isHistory) {
$titleMsg = 'oasis-page-header-history';
} else {
$titleMsg = 'oasis-page-header-editing';
}
}
}
}
}
$this->displaytitle = true;
$this->title = wfMsg($titleMsg, htmlspecialchars($wgTitle->getPrefixedText()));
// back to article link
if (!$isPreview && !$isShowChanges) {
$this->subtitle = Wikia::link($wgTitle, wfMsg('oasis-page-header-back-to-article'), array('accesskey' => 'c'), array(), 'known');
}
// add edit button
if ($isDiff || $isHistory && !$this->isUserTalkArchiveModeEnabled) {
$this->prepareActionButton();
// show only "My Tools" dropdown on toolbar
$wgShowMyToolsOnly = true;
}
// render edit dropdown / commments chicklet on history pages
if ($isHistory) {
// FB#1137 - re-add missing log and undelete links
$logPage = SpecialPage::getTitleFor('Log');
$this->subtitle .= ' | ' . Wikia::link($logPage, wfMsgHtml('viewpagelogs'), array(), array('page' => $wgTitle->getPrefixedText()), array('known', 'noclasses'));
// FIXME: Skin is now an abstract class (MW1.19)
// (wladek) created non-abstract FakeSkin class, is it the correct solution?
$sk = new FakeSkin();
$sk->setRelevantTitle($wgTitle);
$undeleteLink = $sk->getUndeleteLink();
if (!empty($undeleteLink)) {
$this->subtitle .= ' | ' . $undeleteLink;
}
// dropdown actions
$this->dropdown = $this->getDropdownActions();
// use service to get data
$service = new PageStatsService($wgTitle->getArticleId());
// comments
$this->comments = $service->getCommentsCount();
}
wfRunHooks('PageHeaderEditPage', array(&$this, $ns, $isPreview, $isShowChanges, $isDiff, $isEdit, $isHistory));
wfProfileOut(__METHOD__);
}
示例8: onOutputPageBeforeHTML
/**
* Display Related Discussion (Forum posts) in bottom of article
* @param OutputPage $out
* @param string $text article HTML
* @return bool: true because it is a hook
*/
public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
{
$app = F::app();
$title = $out->getTitle();
if ($out->isArticle() && $title->exists() && $title->getNamespace() == NS_MAIN && !Wikia::isMainPage() && $out->getRequest()->getVal('diff') === null && $out->getRequest()->getVal('action') !== 'render' && !$app->checkSkin('wikiamobile', $out->getSkin())) {
// VOLDEV-46: Omit zero-state, only render if there are related forum threads
$messages = RelatedForumDiscussionController::getData($title->getArticleId());
unset($messages['lastupdate']);
if (!empty($messages)) {
$text .= $app->renderView('RelatedForumDiscussionController', 'index', array('messages' => $messages));
}
}
return true;
}
示例9: executeIndex
public function executeIndex($params)
{
global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgCityId, $wgEnableAdminDashboardExt, $wgAllInOne, $wgOasisThemeSettings;
wfProfileIn(__METHOD__);
//Add Smart banner for My Wikia App
//See: https://wikia-inc.atlassian.net/browse/MOB-167
$wgOut->addHeadItem('My Wikia Smart Banner', '<meta name="apple-itunes-app" content="app-id=623705389">');
/* set the grid if passed in, otherwise, respect the default */
$grid = $wgRequest->getVal('wikiagrid', '');
if ('1' === $grid) {
$this->wg->OasisGrid = true;
} else {
if ('0' === $grid) {
$this->wg->OasisGrid = false;
}
}
/* end grid or full width */
$jsPackages = array();
$scssPackages = array();
$this->app->runHook('WikiaAssetsPackages', array(&$wgOut, &$jsPackages, &$scssPackages));
$this->isUserLoggedIn = $wgUser->isLoggedIn();
// TODO: move to CreateNewWiki extension - this code should use a hook
$wikiWelcome = $wgRequest->getVal('wiki-welcome');
if (!empty($wikiWelcome)) {
$wgOut->addStyle($this->assetsManager->getSassCommonURL('extensions/wikia/CreateNewWiki/css/WikiWelcome.scss'));
$wgOut->addScript('<script src="' . $this->wg->ExtensionsPath . '/wikia/CreateNewWiki/js/WikiWelcome.js"></script>');
}
if (RenderContentOnlyHelper::isRenderContentOnlyEnabled()) {
$this->body = F::app()->renderView('BodyContentOnly', 'Index');
} else {
// macbre: let extensions modify content of the page (e.g. EditPageLayout)
wfProfileIn(__METHOD__ . ' - renderBody');
$this->body = !empty($params['body']) ? $params['body'] : F::app()->renderView('Body', 'Index');
wfProfileOut(__METHOD__ . ' - renderBody');
}
// get microdata for body tag
$this->itemType = self::getItemType();
$skin = RequestContext::getMain()->getSkin();
/* @var $skin WikiaSkin */
// this is bad but some extensions could have added some scripts to bottom queue
// todo: make it not run twice during each request
$this->bottomScripts = $skin->bottomScripts();
// generate list of CSS classes for <body> tag
$bodyClasses = array('mediawiki', $this->dir, $this->pageClass);
$bodyClasses = array_merge($bodyClasses, self::$extraBodyClasses);
$bodyClasses[] = $this->skinNameClass;
if (Wikia::isMainPage()) {
$bodyClasses[] = 'mainpage';
}
wfProfileIn(__METHOD__ . ' - skin Operations');
// add skin theme name
if (!empty($skin->themename)) {
$bodyClasses[] = "oasis-{$skin->themename}";
}
// mark dark themes
if (SassUtil::isThemeDark()) {
$bodyClasses[] = 'oasis-dark-theme';
}
/**
* Login status based CSS class
*/
$bodyClasses[] = $skin->getUserLoginStatusClass();
// sets background settings by adding classes to <body>
$bodyClasses = array_merge($bodyClasses, $this->getOasisBackgroundClasses($wgOasisThemeSettings));
$this->bodyClasses = $bodyClasses;
if (is_array($scssPackages)) {
foreach ($scssPackages as $package) {
$wgOut->addStyle($this->assetsManager->getSassCommonURL('extensions/' . $package));
}
}
// Reset (this ensures no duplication in CSS links)
$sassFiles = ['skins/oasis/css/oasis.scss'];
$this->cssLinks = $skin->getStylesWithCombinedSASS($sassFiles);
// $sassFiles will be updated by getStylesWithCombinedSASS method will all extracted and concatenated SASS files
$this->bottomScripts .= Html::inlineScript("var wgSassLoadedScss = " . json_encode($sassFiles) . ";");
$this->headLinks = $wgOut->getHeadLinks();
$this->headItems = $skin->getHeadItems();
$this->pageTitle = htmlspecialchars($this->pageTitle);
$this->displayTitle = htmlspecialchars($this->displayTitle);
$this->mimeType = htmlspecialchars($this->mimeType);
$this->charset = htmlspecialchars($this->charset);
wfProfileOut(__METHOD__ . ' - skin Operations');
$this->topScripts = $wgOut->topScripts;
if (is_array($jsPackages)) {
foreach ($jsPackages as $package) {
$wgOut->addScriptFile($this->wg->ExtensionsPath . '/' . $package);
}
}
// setup loading of JS/CSS
$this->loadJs();
// macbre: RT #25697 - hide Comscore & QuantServe tags on edit pages
if (!in_array($wgRequest->getVal('action'), array('edit', 'submit'))) {
$this->comScore = AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW);
$this->quantServe = AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW);
$this->amazonMatch = AnalyticsEngine::track('AmazonMatch', AnalyticsEngine::EVENT_PAGEVIEW);
$this->rubiconRtp = AnalyticsEngine::track('RubiconRTP', AnalyticsEngine::EVENT_PAGEVIEW);
$this->dynamicYield = AnalyticsEngine::track('DynamicYield', AnalyticsEngine::EVENT_PAGEVIEW);
$this->ivw2 = AnalyticsEngine::track('IVW2', AnalyticsEngine::EVENT_PAGEVIEW);
}
if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) {
//.........这里部分代码省略.........
示例10: onOutputPageBeforeHTML
/**
* @param OutputPage $out
* @param $text
*
* Add needed messages to page and add JS assets
*
* @return bool
*/
public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
{
$app = F::app();
$wg = $app->wg;
$request = $app->wg->Request;
$title = $wg->Title;
$am = AssetsManager::getInstance();
$relatedPagesGroupName = 'relatedpages_js';
if ($out->isArticle() && $request->getVal('action', 'view') == 'view') {
JSMessages::enqueuePackage('RelatedPages', JSMessages::INLINE);
if (!(Wikia::isMainPage() || !empty($title) && !in_array($title->getNamespace(), $wg->ContentNamespaces)) && !$app->checkSkin('wikiamobile') && $am->checkIfGroupForSkin($relatedPagesGroupName, $out->getSkin())) {
if ($app->checkSkin('oasis')) {
OasisController::addSkinAssetGroup($relatedPagesGroupName);
} else {
$scripts = $am->getURL($relatedPagesGroupName);
foreach ($scripts as $script) {
$wg->Out->addScript("<script src='{$script}'></script>");
}
}
}
}
return true;
}
示例11: isCorporateMainPageNonAnon
protected function isCorporateMainPageNonAnon()
{
return WikiaPageType::isCorporatePage() && Wikia::isMainPage() && !F::app()->wg->User->isAnon();
}
示例12: wfMakeGlobalVariablesScript
/**
* @param array $vars JS variables to be added at the bottom of the page
* @param OutputPage $out
* @return bool return true - it's a hook
*/
function wfMakeGlobalVariablesScript(array &$vars, OutputPage $out)
{
wfProfileIn(__METHOD__);
global $wgMemc, $wgEnableAjaxLogin, $wgPrivateTracker, $wgExtensionsPath, $wgArticle, $wgStyleVersion, $wgSitename, $wgDisableAnonymousEditing, $wgGroupPermissions, $wgBlankImgUrl, $wgCookieDomain, $wgCookiePath, $wgResourceBasePath;
$skin = $out->getSkin();
$title = $out->getTitle();
// MW1.19 - ResourceLoaderStartUpModule class adds more variables
$cats = wfGetBreadCrumb();
$idx = count($cats) - 2;
if (isset($cats[$idx])) {
$vars['wgCatId'] = $cats[$idx]['id'];
$vars['wgParentCatId'] = $cats[$idx]['parentId'];
} else {
$vars['wgCatId'] = 0;
$vars['wgParentCatId'] = 0;
}
$skinName = get_class($skin);
if (is_array($wgEnableAjaxLogin) && in_array($skinName, $wgEnableAjaxLogin)) {
$vars['wgEnableAjaxLogin'] = true;
}
$vars['wgBlankImgUrl'] = $wgBlankImgUrl;
if (!empty($wgPrivateTracker)) {
$vars['wgPrivateTracker'] = true;
}
// TODO: load it on-demand using JSMessages
if ($vars['wgIsArticle'] == false && !empty($vars['wgEnableAjaxLogin'])) {
$vars['ajaxLogin1'] = wfMsg('ajaxLogin1');
$vars['ajaxLogin2'] = wfMsg('ajaxLogin2');
}
// TODO: use wgMainPageTitle instead?
$vars['wgMainpage'] = wfMsgForContent('mainpage');
if (Wikia::isMainPage()) {
$vars['wgIsMainpage'] = true;
}
if (Wikia::isContentNamespace()) {
$vars['wgIsContentNamespace'] = true;
}
$vars['wgStyleVersion'] = isset($wgStyleVersion) ? $wgStyleVersion : '';
// TODO: is this one really needed?
if (isset($skin->themename)) {
$vars['themename'] = $skin->themename;
}
$vars['wgExtensionsPath'] = $wgExtensionsPath;
$vars['wgResourceBasePath'] = $wgResourceBasePath;
$vars['wgSitename'] = $wgSitename;
// Set the JavaScript variable which is used by AJAX request to make data caching possible - Inez
$vars['wgMWrevId'] = $wgMemc->get(wfMemcKey('wgMWrevId'));
// macbre: get revision ID of current article
if (($title->isContentPage() || $title->isTalkPage()) && !is_null($wgArticle)) {
$vars['wgRevisionId'] = !empty($wgArticle->mRevision) ? $wgArticle->mRevision->getId() : intval($wgArticle->mLatest);
}
// is anon editing disabled?
if ($wgDisableAnonymousEditing || $wgGroupPermissions['user']['edit'] === false) {
$vars['wgDisableAnonymousEditing'] = true;
}
// moved from Interstitial.php
$vars['wgCookieDomain'] = $wgCookieDomain;
$vars['wgCookiePath'] = $wgCookiePath;
wfProfileOut(__METHOD__);
return true;
}
示例13: executeIndex
public function executeIndex($params) {
global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgCityId, $wgAllInOne, $wgContLang, $wgJsMimeType;
$allInOne = $wgAllInOne;
// macbre: let extensions modify content of the page (e.g. EditPageLayout)
$this->body = !empty($params['body']) ? $params['body'] : F::app()->renderView('CampfireBody', 'Index');
// generate list of CSS classes for <body> tag
$this->bodyClasses = array('mediawiki', $this->dir, $this->pageclass);
$this->bodyClasses = array_merge($this->bodyClasses, self::$extraBodyClasses);
$this->bodyClasses[] = $this->skinnameclass;
if(Wikia::isMainPage()) {
$this->bodyClasses[] = 'mainpage';
}
// add skin theme name
$skin = $wgUser->getSkin();
if(!empty($skin->themename)) {
$this->bodyClasses[] = "oasis-{$skin->themename}";
}
$this->setupJavaScript();
$this->printStyles = array();
// render CSS <link> tags
$this->headlinks = $wgOut->getHeadLinks();
$this->pagetitle = htmlspecialchars( $this->pagetitle );
$this->displaytitle = htmlspecialchars( $this->displaytitle );
$this->mimetype = htmlspecialchars( $this->mimetype );
$this->charset = htmlspecialchars( $this->charset );
$this->globalVariablesScript = Skin::makeGlobalVariablesScript($this->app->getSkinTemplateObj()->data);
// printable CSS (to be added at the bottom of the page)
// If this is an anon article view, use the combined version of the print files.
if($allInOne){
// Create the combined URL.
global $parserMemc, $wgStyleVersion;
$cb = $parserMemc->get(wfMemcKey('wgMWrevId'));
global $wgDevelEnvironment;
if(empty($wgDevelEnvironment)){
$prefix = "__wikia_combined/";
} else {
global $wgWikiaCombinedPrefix;
$prefix = $wgWikiaCombinedPrefix;
}
// no print styles
$this->printStyles = array();
}
$this->printableCss = $this->renderPrintCSS(); // The HTML for the CSS links (whether async or not).
// setup loading of JS/CSS using WSL (WikiaScriptLoader)
$this->loadJs();
// FIXME: create separate module for stats stuff?
// load Google Analytics code
$this->googleAnalytics = AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW);
// onewiki GA
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'onewiki', array($wgCityId));
// track page load time
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'pagetime', array('oasis'));
// track browser height
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'browser-height');
// record which varnish this page was served by
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'varnish-stat');
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'noads');
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'abtest');
// Add important Gracenote analytics for reporting needed for licensing on LyricWiki.
if (43339 == $wgCityId){
$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'lyrics');
}
// macbre: RT #25697 - hide Comscore & QuantServe tags on edit pages
if(!in_array($wgRequest->getVal('action'), array('edit', 'submit'))) {
$this->comScore = AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW);
$this->quantServe = AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW);
}
$this->mainsassfile = 'skins/campfire/css/campfire.scss';
} // end executeIndex()
示例14: executeIndex
public function executeIndex($params) {
global $wgOut, $wgUser, $wgTitle, $wgRequest, $wgCityId, $wgEnableAdminDashboardExt, $wgAllInOne;
wfProfileIn(__METHOD__);
/* set the grid or full width if passed in, otherwise, respect the default */
$grid = $wgRequest->getVal('wikiagrid', '');
$fullhead = $wgRequest->getVal('wikiafullheader', '');
if ( '1' === $grid ) {
$this->wg->OasisGrid = true;
} else if ( '0' === $grid ) {
$this->wg->OasisGrid = false;
}
if ( '1' === $fullhead ) {
$this->wg->GlobalHeaderFullWidth = true;
} else if ( '0' === $fullhead ) {
$this->wg->GlobalHeaderFullWidth = false;
}
/* end grid or full width */
$jsPackages = array();
$scssPackages = array();
$this->app->runHook(
'WikiaAssetsPackages',
array(
&$wgOut,
&$jsPackages,
&$scssPackages
)
);
$this->isUserLoggedIn = $wgUser->isLoggedIn();
// TODO: move to CreateNewWiki extension - this code should use a hook
$wikiWelcome = $wgRequest->getVal('wiki-welcome');
if(!empty($wikiWelcome)) {
$wgOut->addStyle( $this->assetsManager->getSassCommonURL( 'extensions/wikia/CreateNewWiki/css/WikiWelcome.scss' ) );
$wgOut->addScript( '<script src="' . $this->wg->ExtensionsPath . '/wikia/CreateNewWiki/js/WikiWelcome.js"></script>' );
}
$renderContentOnly = false;
if (!empty($this->wg->EnableRenderContentOnlyExt)) {
if(renderContentOnly::isRenderContentOnlyEnabled()) {
$renderContentOnly = true;
}
}
if($renderContentOnly) {
$this->body = F::app()->renderView('BodyContentOnly', 'Index');
} else {
// macbre: let extensions modify content of the page (e.g. EditPageLayout)
wfProfileIn(__METHOD__ . ' - renderBody');
$this->body = !empty($params['body']) ? $params['body'] : F::app()->renderView('Body', 'Index');
wfProfileOut(__METHOD__ . ' - renderBody');
}
// get microdata for body tag
$this->itemType = self::getItemType();
$skin = RequestContext::getMain()->getSkin(); /* @var $skin WikiaSkin */
// this is bad but some extensions could have added some scripts to bottom queue
// todo: make it not run twice during each request
$this->bottomScripts = $skin->bottomScripts();
// generate list of CSS classes for <body> tag
$bodyClasses = array('mediawiki', $this->dir, $this->pageClass);
$bodyClasses = array_merge($bodyClasses, self::$extraBodyClasses);
$bodyClasses[] = $this->skinNameClass;
if(Wikia::isMainPage()) {
$bodyClasses[] = 'mainpage';
}
wfProfileIn(__METHOD__ . ' - skin Operations');
// add skin theme name
if(!empty($skin->themename)) {
$bodyClasses[] = "oasis-{$skin->themename}";
}
// mark dark themes
if (SassUtil::isThemeDark()) {
$bodyClasses[] = 'oasis-dark-theme';
}
// support for oasis split skin
if (!empty($this->wg->GlobalHeaderFullWidth)) {
$bodyClasses[] = 'oasis-split-skin';
}
$this->bodyClasses = $bodyClasses;
if (is_array($scssPackages)) {
foreach ($scssPackages as $package) {
$wgOut->addStyle($this->assetsManager->getSassCommonURL('extensions/'.$package));
}
}
//.........这里部分代码省略.........
示例15: isCorporateMainPageNonAnon
protected function isCorporateMainPageNonAnon()
{
return HubService::isCorporatePage(F::app()->wg->cityId) && Wikia::isMainPage() && !F::app()->wg->User->isAnon();
}