/** * Monetization Module * @responseParam array data - list of modules */ public function index() { wfProfileIn(__METHOD__); if (!MonetizationModuleHelper::canShowModule()) { $this->data = ''; wfProfileOut(__METHOD__); return true; } if (empty($this->wg->OasisBreakpoints)) { $this->response->addAsset('monetization_module_css_no_breakpoints'); } else { $this->response->addAsset('monetization_module_css'); } $this->response->addAsset('monetization_module_js'); $helper = new MonetizationModuleHelper(); $params = ['s_id' => $this->wg->CityId, 'max' => MonetizationModuleHelper::calculateNumberOfAds($this->wg->Title->mLength), 'vertical' => $helper->getWikiVertical(), 'cache' => $helper->getCacheVersion()]; $mcachePurge = $this->wg->request->getVal('mcache', false); if ($mcachePurge) { $params['mcache'] = $mcachePurge; } $this->data = $helper->getMonetizationUnits($params); // check if the article page is blocked if (!empty($this->data['blocked_pages']) && in_array($this->wg->title->getArticleID(), $this->data['blocked_pages'])) { $this->data = ''; } wfProfileOut(__METHOD__); }
public function executeIndex() { global $wgOut, $wgTitle, $wgEnableInfoBoxTest, $wgMaximizeArticleAreaArticleIds, $wgEnableAdminDashboardExt, $wgEnableWikiaHomePageExt; wfProfileIn(__METHOD__); // set up global vars if (is_array($wgMaximizeArticleAreaArticleIds) && in_array($wgTitle->getArticleId(), $wgMaximizeArticleAreaArticleIds)) { $this->wg->SuppressRail = true; $this->wg->SuppressPageHeader = true; } // Double-click to edit $this->body_ondblclick = ''; // FIXME handling moved to OutputPage::addDefaultModules() // InfoBox - Testing $this->wg->EnableInfoBoxTest = $wgEnableInfoBoxTest; // Replaces ContentDisplayModule->index() $this->bodytext = $this->app->getSkinTemplateObj()->data['bodytext']; $this->railModuleList = $this->getRailModuleList(); // this hook allows adding extra HTML just after <body> opening tag // append your content to $html variable instead of echoing // (taken from Monaco skin) $skin = RequestContext::getMain()->getSkin(); $afterBodyHtml = ''; wfRunHooks('GetHTMLAfterBody', array($skin, &$afterBodyHtml)); $this->afterBodyHtml = $afterBodyHtml; // this hook is needed for SMW's factbox $afterContentHookText = ''; wfRunHooks('SkinAfterContent', array(&$afterContentHookText)); $this->afterContentHookText = $afterContentHookText; $this->headerModuleAction = 'Index'; $this->headerModuleParams = array('showSearchBox' => false); // show user pages header on this page? if (self::showUserPagesHeader()) { $this->headerModuleName = 'UserPagesHeader'; // is this page a blog post? if (self::isBlogPost()) { $this->headerModuleAction = 'BlogPost'; } else { if (self::isBlogListing()) { $this->headerModuleAction = 'BlogListing'; } } // show corporate header on this page? } else { if (WikiaPageType::isCorporatePage() || WikiaPageType::isWikiaHub()) { $this->headerModuleName = 'PageHeader'; if (self::isEditPage()) { $this->headerModuleAction = 'EditPage'; } else { $this->headerModuleAction = 'Corporate'; } if (WikiaPageType::isWikiaHubMain()) { $this->headerModuleAction = 'Hubs'; } elseif (WikiaPageType::isMainPage()) { $this->wg->SuppressFooter = true; $this->wg->SuppressArticleCategories = true; $this->wg->SuppressPageHeader = true; $this->wg->SuppressWikiHeader = true; $this->wg->SuppressSlider = true; } } else { $this->headerModuleName = 'PageHeader'; if (self::isEditPage()) { $this->headerModuleAction = 'EditPage'; } } } // Display Control Center Header on certain special pages if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) { $this->headerModuleName = null; $this->wgSuppressAds = true; $this->displayAdminDashboard = true; $this->displayAdminDashboardChromedArticle = $wgTitle->getText() != SpecialPage::getTitleFor('AdminDashboard')->getText(); } else { $this->displayAdminDashboard = false; $this->displayAdminDashboardChromedArticle = false; } $this->railModulesExist = true; // use one column layout for pages with no right rail modules if (count($this->railModuleList) == 0 || !empty($this->wg->SuppressRail)) { // Special:AdminDashboard doesn't need this class, but pages chromed with it do if (!$this->displayAdminDashboard || $this->displayAdminDashboardChromedArticle) { OasisController::addBodyClass('oasis-one-column'); } $this->headerModuleParams = array('showSearchBox' => true); $this->railModulesExist = false; } // determine if WikiaGridLayout needs to be enabled $this->isGridLayoutEnabled = self::isGridLayoutEnabled(); if ($this->isGridLayoutEnabled) { OasisController::addBodyClass('wikia-grid'); } if ($this->isOasisBreakpoints()) { OasisController::addBodyClass('oasis-breakpoints'); } //@TODO remove this check after deprecating responsive (July 2015) if ($this->isResponsiveLayoutEnabled()) { OasisController::addBodyClass('oasis-responsive'); } // if we are on a special search page, pull in the css file and don't render a header if ($wgTitle && $wgTitle->isSpecial('Search') && !$this->wg->WikiaSearchIsDefault) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL("skins/oasis/css/modules/SpecialSearch.scss")); $this->headerModuleName = null; } // Inter-wiki search if ($wgTitle && ($wgTitle->isSpecial('WikiaSearch') || $wgTitle->isSpecial('Search') && $this->wg->WikiaSearchIsDefault)) { $this->headerModuleName = null; } // load CSS for Special:Preferences if (!empty($wgTitle) && $wgTitle->isSpecial('Preferences')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialPreferences.scss')); } // load CSS for Special:Upload if (!empty($wgTitle) && $wgTitle->isSpecial('Upload')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialUpload.scss')); } // load CSS for Special:MultipleUpload if (!empty($wgTitle) && $wgTitle->isSpecial('MultipleUpload')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialMultipleUpload.scss')); } // load CSS for Special:Allpages if (!empty($wgTitle) && $wgTitle->isSpecial('Allpages')) { $wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('skins/oasis/css/modules/SpecialAllpages.scss')); } // Forum Extension if (!empty($this->wg->EnableForumExt) && ForumHelper::isForum()) { $this->wg->SuppressPageHeader = true; } // MonetizationModule Extension if (!empty($this->wg->EnableMonetizationModuleExt)) { if (empty($this->wg->AdDriverUseMonetizationService)) { $this->monetizationModules = $this->sendRequest('MonetizationModule', 'index')->getData()['data']; $this->headerModuleParams['monetizationModules'] = $this->monetizationModules; } else { $this->monetizationModules = [MonetizationModuleHelper::SLOT_TYPE_IN_CONTENT => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_IN_CONTENT']), MonetizationModuleHelper::SLOT_TYPE_BELOW_CATEGORY => $this->app->renderView('Ad', 'Index', ['slotName' => 'MON_BELOW_CATEGORY'])]; } $this->bodytext = MonetizationModuleHelper::insertIncontentUnit($this->bodytext, $this->monetizationModules); } $namespace = $wgTitle->getNamespace(); // extra logic for subpages (RT #74091) if (!empty($this->subtitle)) { switch ($namespace) { // for user subpages add link to theirs talk pages case NS_USER: $talkPage = $wgTitle->getTalkPage(); // get number of revisions for talk page $service = new PageStatsService($wgTitle->getArticleId()); $comments = $service->getCommentsCount(); // render comments bubble $bubble = F::app()->renderView('CommentsLikes', 'Index', array('comments' => $comments, 'bubble' => true)); $this->subtitle .= ' | '; $this->subtitle .= $bubble; $this->subtitle .= Wikia::link($talkPage); break; case NS_USER_TALK: $subjectPage = $wgTitle->getSubjectPage(); $this->subtitle .= ' | '; $this->subtitle .= Wikia::link($subjectPage); break; } } // bugid-70243: optionally hide navigation h1s for SEO $this->setVal('displayHeader', !$this->wg->HideNavigationHeaders); wfProfileOut(__METHOD__); }