/** * BeforePageDisplay hook * * Adds the modules to the page * * @param OutputPage $out output page * @param Skin $skin current skin */ public static function beforePageDisplay($out, $skin) { if ($skin instanceof SkinSkinzam) { $out->addModules(array('jquery.scrollto', 'jquery.backstretch', 'ext.skinzam.global', 'ext.languageSelector')); // Add modules for enabled features foreach (self::$features as $name => $feature) { if (isset($feature['modules']) && self::isEnabled($name)) { $out->addModules($feature['modules']); } } } return true; }
/** * BeforePageDisplay hook * * Add the modules to the page * * @param $out OutputPage output page * @param $skin Skin current skin * * @return true */ public static function onBeforePageDisplay(OutputPage $out, $skin) { //Add modules: $out->addModuleStyles('ext.wr.ShareBar'); $out->addModules('ext.wr.ShareBar.js'); return true; }
public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin) { $title = $output->getTitle(); // Disallow commenting on pages without article id if ($title->getArticleID() == 0) { return true; } if ($title->isSpecialPage()) { return true; } // These could be explicitly allowed in later version if (!$title->canTalk()) { return true; } if ($title->isTalkPage()) { return true; } if ($title->isMainPage()) { return true; } // Do not display when printing if ($output->isPrintable()) { return true; } // Disable if not viewing if ($skin->getRequest()->getVal('action', 'view') != 'view') { return true; } // Blacklist several namespace if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) { return true; } $output->addModules('ext.pagerating'); return true; }
public static function onOutputPageBeforeHTML(OutputPage &$out, &$text) { global $wgEnableRecommendationsExt; if (!empty($wgEnableRecommendationsExt) && F::app()->checkSkin('venus')) { $out->addModules('ext.wikia.recommendations'); } return true; }
/** * * @param OutputPage $oOutputPage * @param SkinTemplate $oSkinTemplate * @return boolean */ public function onBeforePageDisplay($oOutputPage, $oSkinTemplate) { if (!SpecialPage::getTitleFor('RSSFeeder')->equals($this->getTitle())) { return true; } $oOutputPage->addModules('ext.bluespice.rssStandards'); return true; }
/** * BeforePageDisplay hook * Adds the modules to the page * * @param $out OutputPage output page * @param $skin Skin current skin * * @return bool */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { global $wgSurveyGizmoBeaconID, $wgSurveyGizmoBeaconUrl; if (!empty($wgSurveyGizmoBeaconID) && !empty($wgSurveyGizmoBeaconUrl)) { $out->addModules('ext.surveyGizmo'); } return true; }
/** * Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed. * @param OutputPage $oOutputPage * @param Skin $oSkin * @return bool */ public function onBeforePageDisplay(&$oOutputPage, &$oSkin) { if (BsConfig::get('MW::BlueSpiceProjectFeedbackHelper::Active') == false) { return true; } $oOutputPage->addModules('ext.bluespice.blueSpiceprojectfeedbackhelper'); return true; }
/** * Add JS module to the output * @param \OutputPage $out An output object passed from a hook * @return bool */ public static function onBeforePageDisplay(\OutputPage $out) { // use resource loader for i18n messages in JS $out->addModules('ext.cookiePolicyMessages'); // use AssetsManager for script loading to avoid race conditions (SOC-528) \Wikia::addAssetsToOutput('cookie_policy_js'); return true; }
/** * Adds module * @param OutputPage $out * @param SkinTemplate $skin * @return boolean */ public static function onBeforePageDisplay(&$out, &$skin) { if (!$out->getTitle()->equals($out->getUser()->getUserPage())) { return true; } $out->addModules("ext.bluespice.avatars.js"); return true; }
/** * Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed. * @param OutputPage $oOutputPage * @param Skin $oSkin * @return bool */ public function onBeforePageDisplay(&$oOutputPage, &$oSkin) { if (!SpecialPage::getTitleFor('Preferences')->equals($oOutputPage->getTitle())) { return true; } $oOutputPage->addModules('ext.bluespice.userpreferences'); return true; }
public function initPage(OutputPage $out) { global $wgLocalStylePath; $this->skinname = 'cbptranscription'; $this->stylename = 'CbpTranscription'; $this->template = 'CbpTranscriptionTemplate'; $out->addModules('skins.cbptranscription'); parent::initPage($out); }
function hookOutputPageBeforeHTML(OutputPage &$out, &$text) { if ($out->getTitle()->getNamespace() == 6) { //6 is the File Namespace $out->includeJQuery(); $out->addModules('ext.SemanticImageAnnotator'); } return true; }
/** * Add welcome module to the load queue of all pages */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { global $wgExampleEnableWelcome; if ($wgExampleEnableWelcome) { $out->addModules('ext.Example.welcome.init'); } // Always return true, indicating that parser initialization should // continue normally. return true; }
/** * Adds VisualEditor JS to the output. * * This is attached to the MediaWiki 'BeforePageDisplay' hook. * * @param OutputPage $output * @param Skin $skin * @return boolean */ public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin) { // Wikia change if (self::isAvailable($skin)) { $output->addModules(array('ext.visualEditor.wikia.viewPageTarget.init')); } //$output->addModules( array( 'ext.visualEditor.viewPageTarget.init' ) ); //$output->addModuleStyles( array( 'ext.visualEditor.viewPageTarget.noscript' ) ); return true; }
/** * This function adds additional modules containing CSS before the page is displayed */ public function onBeforePageDisplay(OutputPage &$out, Skin &$ski) { $title_object = $out->getTitle(); $page_title = $title_object->getPrefixedURL(); if ($page_title === 'Special:UserPage' || $page_title === 'Special:AllCollections' || $page_title === 'Special:SingleManuscriptPages' || $page_title === 'Special:AllCollations' || $page_title === 'Special:RecentManuscriptPages' || $page_title === 'Special:AllStylometricAnalysis') { $out->addModuleStyles(array('ext.userpagecss', 'ext.manuscriptdeskbasecss')); $out->addModules("ext.javascriptloaderdots"); } return true; }
static function addModules(OutputPage $out) { if (self::$options['add_modules'] === false) { return true; } foreach (self::$modules as $module) { $out->addModules($module); } return true; }
/** * Parser hook registering the GUI module only in edit pages. * * @param EditPage $editPage * @param OutputPage $output * @return bool */ public static function onEditPage($editPage, $output) { global $wgTemplateDataUseGUI; if ($wgTemplateDataUseGUI) { if ($output->getTitle()->getNamespace() === NS_TEMPLATE) { $output->addModules('ext.templateDataGenerator.editPage'); } } return true; }
/** * * @param OutputPage $oOutputPage * @param Skin $oSkin * @return boolean - always true */ public function onBeforePageDisplay(&$oOutputPage, &$oSkin) { if (!in_array($oOutputPage->getRequest()->getVal('action', 'view'), array('edit', 'submit'))) { return true; } $oOutputPage->addModules('bluespice.insertLink.interWikiLinks'); //TODO implement ow $oOutputPage->addJsConfigVars('BSInterWikiPrefixes', $this->getInterWikiLinkPrefixes()); return true; }
/** * BeofrePageDislpay hook. Load additional modules containing CSS before the page is displayed */ public function onBeforePageDisplay(OutputPage &$out, Skin &$ski) { $page_title_with_namespace = $out->getTitle()->getPrefixedURL(); if ($page_title_with_namespace === 'Special:HelperScripts') { $css_modules = array('ext.manuscriptdeskbasecss'); $javascript_modules = array('ext.javascriptloader'); $out->addModuleStyles($css_modules); $out->addModules($javascript_modules); } return true; }
/** * Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed. * @param OutputPage $oOutputPage * @param Skin $oSkin * @return bool */ public function onBeforePageDisplay(&$oOutputPage, &$oSkin) { if (BsExtensionManager::isContextActive('MW::SaferEdit') === false) { return true; } $oOutputPage->addModules('ext.bluespice.saferedit.general'); if (BsExtensionManager::isContextActive('MW::SaferEditEditMode') === false) { return true; } $oOutputPage->addModules('ext.bluespice.saferedit.editmode'); return true; }
public function initPage(OutputPage $out) { $baseURL = $GLOBALS['egBootyBaseURL']; //add the css modules separately to prevent a FOUC $out->addModuleStyles('bootstrap.css'); $out->addModuleStyles('skin.booty.css'); $out->addModuleStyles('font-awesome'); //since we're using theb mediawiki generated head element, we have to add the viewport meta tag //so the layout scaled properly to mobile devices $out->addMeta('viewport', 'width=device-width'); //,initial-width=1,maximum-width=1' ); /* Until ResourceLoader can correctly parse multiple urls in a single font-family webfont files have to be defined in the head to prevent it screwing things up */ $out->addInlineStyle("@font-face {\n\t\t font-family: 'Glyphicons Halflings';\n\t\t src: url('{$baseURL}/bootstrap-3.0.3/fonts/glyphicons-halflings-regular.eot');\n\t\t src: url('{$baseURL}/bootstrap-3.0.3/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('{$baseURL}/bootstrap-3.0.3/fonts/glyphicons-halflings-regular.woff') format('woff'), url('{$baseURL}/bootstrap-3.0.3/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('{$baseURL}/bootstrap-3.0.3/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');\n\t\t}"); $out->addInlineStyle("@font-face {\n\t\t font-family: 'FontAwesome';\n\t\t src: url('{$baseURL}/font-awesome-4.0.3/fonts/fontawesome-webfont.eot?v=4.0.3');\n\t\t src: url('{$baseURL}/font-awesome-4.0.3/fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('{$baseURL}/font-awesome-4.0.3/fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('{$baseURL}/font-awesome-4.0.3/fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('{$baseURL}/font-awesome-4.0.3/fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');\n\t\t font-weight: normal;\n\t\t font-style: normal;\n\t\t}"); //js items will be appended after page load $out->addModules('bootstrap.js'); $out->addModules('skin.booty.js'); $out->addHeadItem('meta-viewport', '<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'); parent::initPage($out); }
/** * Adds resources to ResourceLoader * @param OutputPage $out * @param Skin $skin * @return boolean Always true to keep hook running */ public function onBeforePageDisplay(&$out, &$skin) { $out->addModules('ext.bluespice.contextmenu'); //We check if the current user can send Mails trough the wiki //TODO: Maybe move to BSF? $mEMailPermissioErrors = SpecialEmailUser::getPermissionsError($this->getUser(), $this->getUser()->getEditToken()); $bUserCanSendMail = false; if ($mEMailPermissioErrors === null) { $bUserCanSendMail = true; } $out->addJsConfigVars('bsUserCanSendMail', $bUserCanSendMail); return true; }
/** * Handler for the BeforePageDisplay hook, injects special behaviour * for PropertySuggestions in the EntitySuggester (if page is in EntityNamespace) * * * @param OutputPage $out * @param Skin $skin * @return bool */ public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { if ($out->getRequest()->getCheck('nosuggestions')) { return true; } $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()->getEntityNamespaceLookup(); $itemNamespace = $entityNamespaceLookup->getEntityNamespace(CONTENT_MODEL_WIKIBASE_ITEM); if ($out->getTitle()->getNamespace() !== $itemNamespace) { return true; } $out->addModules('ext.PropertySuggester.EntitySelector'); return true; }
public static function onBeforePageDisplay(\OutputPage $out, \Skin $skin) { $helper = new FlagsHelper(); /* Assets for flags view */ if ($helper->shouldDisplayFlags() || $out->getTitle()->isSpecial('Flags')) { \Wikia::addAssetsToOutput('flags_view_scss'); } /* Assets for flags edit form */ if ($helper->areFlagsEditable()) { \Wikia::addAssetsToOutput('flags_editform_js'); $out->addModules('ext.wikia.Flags.EditFormMessages'); } return true; }
/** * Adds VisualEditor JS to the output. * * This is attached to the MediaWiki 'BeforePageDisplay' hook. * * @param OutputPage $output * @param Skin $skin * @return boolean */ public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin) { $output->addModules(array('ext.visualEditor.desktopArticleTarget.init', 'ext.visualEditor.targetLoader')); $output->addModuleStyles(array('ext.visualEditor.desktopArticleTarget.noscript')); // add scroll offset js variable to output $veConfig = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor'); $skinsToolbarScrollOffset = $veConfig->get('VisualEditorSkinToolbarScrollOffset'); $toolbarScrollOffset = 0; $skinName = $skin->getSkinName(); if (isset($skinsToolbarScrollOffset[$skinName])) { $toolbarScrollOffset = $skinsToolbarScrollOffset[$skinName]; } $output->addJsConfigVars('wgVisualEditorToolbarScrollOffset', $toolbarScrollOffset); return true; }
public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin) { $title = $output->getTitle(); // Disallow commenting on pages without article id if ($title->getArticleID() == 0) { return true; } if ($title->isSpecialPage()) { return true; } // These could be explicitly allowed in later version if (!$title->canTalk()) { return true; } if ($title->isTalkPage()) { return true; } // No commenting on main page if ($title->isMainPage()) { return true; } // Do not display when printing if ($output->isPrintable()) { return true; } // Disable if not viewing if ($skin->getRequest()->getVal('action', 'view') != 'view') { return true; } // Blacklist several namespace if (in_array($title->getNamespace(), self::getFilteredNamespace())) { return true; } if ($output->getUser()->isAllowed('commentadmin-restricted')) { $output->addJsConfigVars(array('commentadmin' => '')); } global $wgFlowThreadConfig; $config = array('Avatar' => $wgFlowThreadConfig['Avatar'], 'AnonymousAvatar' => $wgFlowThreadConfig['AnonymousAvatar']); if (\FlowThread\Post::canPost($output->getUser())) { $output->addJsConfigVars(array('canpost' => '')); } else { $config['CantPostNotice'] = wfMessage('flowthread-ui-cantpost')->toString(); } global $wgFlowThreadConfig; $output->addJsConfigVars(array('wgFlowThreadConfig' => $config)); $output->addModules('ext.flowthread'); return true; }
public static function injectCss(OutputPage $out, $text) { global $wgTranslatePageTranslationULS; $title = $out->getTitle(); $isSource = TranslatablePage::isSourcePage($title); $isTranslation = TranslatablePage::isTranslationPage($title); if ($isSource || $isTranslation) { $out->addModuleStyles('ext.translate'); if ($wgTranslatePageTranslationULS) { $out->addModules('ext.translate.pagetranslation.uls'); } // Per bug T63331 $type = $isSource ? 'source' : 'translation'; $out->addJsConfigVars('wgTranslatePageTranslation', $type); } return true; }
/** * Add "x email-confirmed open account requests" notice * @param $notice * @return bool */ public static function confirmAccountsNotice(OutputPage &$out, Skin &$skin) { global $wgConfirmAccountNotice; $context = $out->getContext(); if (!$wgConfirmAccountNotice || !$context->getUser()->isAllowed('confirmaccount')) { return true; } # Only show on some special pages $title = $context->getTitle(); if (!$title->isSpecial('Recentchanges') && !$title->isSpecial('Watchlist')) { return true; } $count = ConfirmAccount::getOpenEmailConfirmedCount('*'); if ($count > 0) { $out->prependHtml('<div id="mw-confirmaccount-msg" class="plainlinks mw-confirmaccount-bar">' . $out->parse(wfMsgExt('confirmaccount-newrequests', 'parsemag', $count), false) . '</div>'); $out->addModules('ext.confirmAccount'); // CSS } return true; }
public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin) { // Enable only if the user has turned it on in Beta Preferences, or BetaFeatures is not installed. // Will only be loaded if PageImages & TextExtracts extensions are installed. $registry = ExtensionRegistry::getInstance(); if (!$registry->isLoaded('TextExtracts') || !class_exists('ApiQueryPageImages')) { $logger = LoggerFactory::getInstance('popups'); $logger->error('Popups requires the PageImages and TextExtracts extensions.'); return true; } if (self::getConfig()->get('PopupsBetaFeature') === true) { if (!class_exists('BetaFeatures')) { $logger = LoggerFactory::getInstance('popups'); $logger->error('PopupsMode cannot be used as a beta feature unless ' . 'the BetaFeatures extension is present.'); return true; } if (!BetaFeatures::isFeatureEnabled($skin->getUser(), 'popups')) { return true; } } $out->addModules(array('ext.popups', 'schema.Popups')); return true; }
/** * BeforePageDisplay hook * * Adds the modules to the page * * @param OutputPage $out output page * @param Skin $skin current skin * @return Boolean always true (unless we are very self-centered and want the resource loader to work just for us, what a waste it would be) */ public static function beforePageDisplay($out, $skin) { $out->addModules('ext.widgetsFramework.css'); return true; }