public static function onSkinAfterBottomScripts(Skin $skin, &$text) { global $wgWRGoogleSearchEnableSitelinksSearch, $wgWRGoogleSearchCSEID; if (!$wgWRGoogleSearchEnableSitelinksSearch || empty($wgWRGoogleSearchCSEID) || !$skin->getTitle()->isMainPage()) { return true; } $mainPageUrl = Title::newFromText(wfMessage('mainpage')->plain())->getFullURL(); $searchUrl = SpecialPage::getTitleFor('WRGoogleSearch')->getFullURL(); $sitelinksSearch = <<<HTML \t<script type="application/ld+json"> \t\t{ \t\t\t"@context": "http://schema.org", \t \t\t"@type": "WebSite", \t\t\t"url": "{$mainPageUrl}", \t\t\t"potentialAction": { \t\t\t\t"@type": "SearchAction", \t\t\t "target": "{$searchUrl}?q={search_term_string}", \t\t\t "query-input": "required name=search_term_string" \t \t\t} \t\t} \t</script> HTML; $text .= $sitelinksSearch; return true; }
/** * @param Skin $skin * @param string $text * @return bool */ public static function hookAnalyticsInsideHead(OutputPage &$out, Skin &$skin, &$text = '') { global $wgGoogleAnalyticsAccount, $wgGoogleAnalyticsAnonymizeIP, $wgGoogleAnalyticsOtherCode, $wgGoogleAnalyticsIgnoreNsIDs, $wgGoogleAnalyticsIgnorePages, $wgGoogleAnalyticsIgnoreSpecials; if ($skin->getUser()->isAllowed('noanalytics')) { $text .= "<!-- Web analytics code inclusion is disabled for this user. -->\r\n"; return true; } if (count(array_filter($wgGoogleAnalyticsIgnoreSpecials, function ($v) use($skin) { return $skin->getTitle()->isSpecial($v); })) > 0 || in_array($skin->getTitle()->getNamespace(), $wgGoogleAnalyticsIgnoreNsIDs, true) || in_array($skin->getTitle()->getPrefixedText(), $wgGoogleAnalyticsIgnorePages, true)) { $text .= "<!-- Web analytics code inclusion is disabled for this page. -->\r\n"; return true; } $appended = false; if ($wgGoogleAnalyticsAccount !== '') { $text .= <<<EOD <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', ' EOD . $wgGoogleAnalyticsAccount . <<<EOD ', 'auto'); EOD . ($wgGoogleAnalyticsAnonymizeIP ? " ga('set', 'anonymizeIp', true);\r\n" : "") . <<<EOD ga('send', 'pageview'); </script> EOD; $appended = true; } if ($wgGoogleAnalyticsOtherCode !== '') { $text .= $wgGoogleAnalyticsOtherCode . "\r\n"; $appended = true; } if (!$appended) { $text .= "<!-- No web analytics configured. -->\r\n"; } $out->addHeadItem("analytics script", $text); return true; }
public static function fnSetOutput(OutputPage &$out, Skin &$skin) { global $wpdBundle; $page_path = explode('/', $skin->getTitle()); for ($pp = 1; count($page_path) >= $pp; $pp++) { $path_part = implode('/', array_slice($page_path, 0, $pp)); self::$menuhtml .= '<li data-comment="Not removing underscore here"><a href="' . $wpdBundle['root_uri'] . str_replace(' ', '_', $path_part) . '">' . str_replace('_', ' ', $page_path[$pp - 1]) . '</a></li>'; } return true; }
public static function onSkinAfterBottomScripts(Skin $skin, &$text) { $title = $skin->getTitle(); if (TemplateDraftHelper::allowedForTitle($title)) { $scripts = AssetsManager::getInstance()->getURL('template_draft'); foreach ($scripts as $script) { $text .= Html::linkedScript($script); } } return true; }
/** * @param OutputPage $oOut * @param Skin $oSkin * @return boolean */ public function onBeforePageDisplay(&$oOut, &$oSkin) { $oTitle = $oSkin->getTitle(); $aNamespaces = MWNamespace::getCanonicalNamespaces(); $iCurrentNs = $oTitle->getNamespace(); if ($oTitle->isTalkPage()) { $iCurrentNs--; } if (!isset($aNamespaces[$iCurrentNs])) { return true; } $oStyleSheetTitle = Title::newFromText($aNamespaces[$iCurrentNs] . '_css', NS_MEDIAWIKI); if ($oStyleSheetTitle->exists()) { $oOut->addStyle($oStyleSheetTitle->getLocalUrl(array('action' => 'raw', 'ctype' => 'text/css'))); } return true; }
/** * BeforePageDisplay hook handler * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay * * @param OutputPage $out * @param Skin $sk * @return bool */ public static function onBeforePageDisplay(&$out, &$sk) { global $wgWPBSkinBlacklist, $wgWPBEnableDefaultBanner; $context = MobileContext::singleton(); $config = $context->getMFConfig(); $mfEnableXAnalyticsLogging = $config->get('MFEnableXAnalyticsLogging'); $mfAppPackageId = $config->get('MFAppPackageId'); $mfAppScheme = $config->get('MFAppScheme'); $mfNoIndexPages = $config->get('MFNoindexPages'); $mfMobileUrlTemplate = $context->getMobileUrlTemplate(); $tabletSize = $config->get('MFDeviceWidthTablet'); // show banners using WikidataPageBanner, if installed and all pre-conditions fulfilled if (ExtensionRegistry::getInstance()->isLoaded('WikidataPageBanner') && $context->isBetaGroupMember()) { // turn default banners on $wgWPBEnableDefaultBanner = true; // Turn on the banner experiment $needle = array_search('minerva', $wgWPBSkinBlacklist); if ($needle !== false) { unset($wgWPBSkinBlacklist[$needle]); } } $title = $sk->getTitle(); $request = $context->getRequest(); // Migrate prefixed disableImages cookie to unprefixed cookie. if (isset($_COOKIE[$config->get('CookiePrefix') . 'disableImages'])) { if ((bool) $request->getCookie('disableImages')) { $context->setDisableImagesCookie(true); } $request->response()->clearCookie('disableImages'); } # Add deep link to a mobile app specified by $wgMFAppScheme if ($mfAppPackageId !== false && $title->isContentPage() && $request->getRawQueryString() === '') { $fullUrl = $title->getFullURL(); $mobileUrl = $context->getMobileUrl($fullUrl); $path = preg_replace("/^([a-z]+:)?(\\/)*/", '', $mobileUrl, 1); $scheme = 'http'; if ($mfAppScheme !== false) { $scheme = $mfAppScheme; } else { $protocol = $request->getProtocol(); if ($protocol != '') { $scheme = $protocol; } } $hreflink = 'android-app://' . $mfAppPackageId . '/' . $scheme . '/' . $path; $out->addLink(array('rel' => 'alternate', 'href' => $hreflink)); } // an canonical/alternate link is only useful, if the mobile and desktop URL are different // and $wgMFNoindexPages needs to be true if ($mfMobileUrlTemplate && $mfNoIndexPages) { if (!$context->shouldDisplayMobileView()) { // add alternate link to desktop sites - bug T91183 $desktopUrl = $title->getFullUrl(); $link = array('rel' => 'alternate', 'media' => 'only screen and (max-width: ' . $tabletSize . 'px)', 'href' => $context->getMobileUrl($desktopUrl)); } else { // add canonical link to mobile pages, instead of noindex - bug T91183 $link = array('rel' => 'canonical', 'href' => $title->getFullUrl()); } $out->addLink($link); } // Set X-Analytics HTTP response header if necessary if ($context->shouldDisplayMobileView()) { $analyticsHeader = $mfEnableXAnalyticsLogging ? $context->getXAnalyticsHeader() : false; if ($analyticsHeader) { $resp = $out->getRequest()->response(); $resp->header($analyticsHeader); } // in mobile view: always add vary header $out->addVaryHeader('Cookie'); // Allow modifications in mobile only mode Hooks::run('BeforePageDisplayMobile', array(&$out, &$sk)); } return true; }
/** * Modify an array of tab links to include flagged revs UI elements * @param string $type ('flat' for SkinTemplateTabs, 'nav' for SkinTemplateNavigation) */ public function setViewTabs(Skin $skin, array &$views, $type) { $this->load(); if (!FlaggedRevs::inReviewNamespace($this->article->getTitle())) { return true; // short-circuit for non-reviewable pages } # Hack for bug 16734 (some actions update and view all at once) if ($this->pageWriteOpRequested() && wfGetDB(DB_MASTER)->doneWrites()) { # Tabs need to reflect the new stable version so users actually # see the results of their action (i.e. "delete"/"rollback") $this->article->loadPageData('fromdbmaster'); } $srev = $this->article->getStableRev(); if (!$srev) { return true; // No stable revision exists } $synced = $this->article->stableVersionIsSynced(); $pendingEdits = !$synced && $this->article->isStableShownByDefault(); // Set the edit tab names as needed... if ($pendingEdits) { if (isset($views['edit'])) { $views['edit']['text'] = wfMsg('revreview-edit'); if ($this->showingStable()) { // bug 31489; direct user to current $views['edit']['href'] = $skin->getTitle()->getFullURL('action=edit'); } } if (isset($views['viewsource'])) { $views['viewsource']['text'] = wfMsg('revreview-source'); if ($this->showingStable()) { // bug 31489; direct user to current $views['viewsource']['href'] = $skin->getTitle()->getFullURL('action=edit'); } } } # Add "pending changes" tab if the page is not synced if (!$synced) { $this->addDraftTab($views, $srev, $type); } return true; }
/** * Prepares the footer for the skins serving the desktop and mobile sites. * @param Skin $skin * @param QuickTemplate $tpl */ public static function prepareFooter($skin, $tpl) { $title = $skin->getTitle(); $req = $skin->getRequest(); $ctx = MobileContext::singleton(); // Certain pages might be blacklisted and not have a mobile equivalent. if (!$ctx->isBlacklistedPage()) { if ($ctx->shouldDisplayMobileView()) { MobileFrontendSkinHooks::mobileFooter($skin, $tpl, $ctx, $title, $req); } else { MobileFrontendSkinHooks::desktopFooter($skin, $tpl, $ctx, $title, $req); } } }
/** * BeforePageDisplay hook handler * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay * * @param OutputPage $out * @param Skin $sk * @return bool */ public static function onBeforePageDisplay(&$out, &$sk) { $context = MobileContext::singleton(); $config = $context->getMFConfig(); $mfEnableXAnalyticsLogging = $config->get('MFEnableXAnalyticsLogging'); $mfAppPackageId = $config->get('MFAppPackageId'); $mfAppScheme = $config->get('MFAppScheme'); $mfNoIndexPages = $config->get('MFNoindexPages'); $mfMobileUrlTemplate = $context->getMobileUrlTemplate(); $tabletSize = $config->get('MFDeviceWidthTablet'); $title = $sk->getTitle(); $request = $context->getRequest(); # Add deep link to a mobile app specified by $wgMFAppScheme if ($mfAppPackageId !== false && $title->isContentPage() && $request->getRawQueryString() === '') { $fullUrl = $title->getFullURL(); $mobileUrl = $context->getMobileUrl($fullUrl); $path = preg_replace("/^([a-z]+:)?(\\/)*/", '', $mobileUrl, 1); $scheme = 'http'; if ($mfAppScheme !== false) { $scheme = $mfAppScheme; } else { $protocol = $request->getProtocol(); if ($protocol != '') { $scheme = $protocol; } } $hreflink = 'android-app://' . $mfAppPackageId . '/' . $scheme . '/' . $path; $out->addLink(array('rel' => 'alternate', 'href' => $hreflink)); } // an canonical/alternate link is only useful, if the mobile and desktop URL are different // and $wgMFNoindexPages needs to be true if ($mfMobileUrlTemplate && $mfNoIndexPages) { if (!$context->shouldDisplayMobileView()) { // add alternate link to desktop sites - bug T91183 $desktopUrl = $title->getFullUrl(); $link = array('rel' => 'alternate', 'media' => 'only screen and (max-width: ' . $tabletSize . 'px)', 'href' => $context->getMobileUrl($desktopUrl)); } else { // add canonical link to mobile pages, instead of noindex - bug T91183 $link = array('rel' => 'canonical', 'href' => $title->getFullUrl()); } $out->addLink($link); } // Set X-Analytics HTTP response header if necessary if ($context->shouldDisplayMobileView()) { $analyticsHeader = $mfEnableXAnalyticsLogging ? $context->getXAnalyticsHeader() : false; if ($analyticsHeader) { $resp = $out->getRequest()->response(); $resp->header($analyticsHeader); } // in mobile view: always add vary header $out->addVaryHeader('Cookie'); } return true; }
/** * Adds the task-based tabs on Special:Translate and few other special pages. * Hook: SkinTemplateNavigation::SpecialPage * @since 2012-02-10 */ static function tabify(Skin $skin, array &$tabs) { $title = $skin->getTitle(); list($alias, $sub) = SpecialPageFactory::resolveAlias($title->getText()); $pagesInGroup = array('Translate', 'LanguageStats', 'MessageGroupStats'); if (!in_array($alias, $pagesInGroup, true)) { return true; } $skin->getOutput()->addModuleStyles('ext.translate.tabgroup'); // Extract subpage syntax, otherwise the values are not passed forward $params = array(); if (trim($sub) !== '') { if ($alias === 'Translate' || $alias === 'MessageGroupStats') { $params['group'] = $sub; } elseif ($alias === 'LanguageStats') { // Breaks if additional parameters besides language are code provided $params['language'] = $sub; } } $request = $skin->getRequest(); // However, query string params take precedence $params['language'] = $request->getVal('language'); $params['group'] = $request->getVal('group'); $taction = $request->getVal('taction', 'translate'); $translate = SpecialPage::getTitleFor('Translate'); $languagestats = SpecialPage::getTitleFor('LanguageStats'); $messagegroupstats = SpecialPage::getTitleFor('MessageGroupStats'); // Clear the special page tab that might be there already $tabs['namespaces'] = array(); $tabs['namespaces']['translate'] = array('text' => wfMessage('translate-taction-translate')->text(), 'href' => $translate->getLocalUrl($params), 'class' => 'tux-tab'); if ($alias === 'Translate' && $taction === 'translate') { $tabs['namespaces']['translate']['class'] .= ' selected'; } if (!self::isBeta($request)) { $tabs['namespaces']['proofread'] = array('text' => wfMessage('translate-taction-proofread')->text(), 'href' => $translate->getLocalUrl(array('taction' => 'proofread') + $params), 'class' => 'tux-tab'); if ($alias === 'Translate' && $taction === 'proofread') { $tabs['namespaces']['proofread']['class'] .= ' selected'; } } $tabs['views']['lstats'] = array('text' => wfMessage('translate-taction-lstats')->text(), 'href' => $languagestats->getLocalUrl($params), 'class' => 'tux-tab'); if ($alias === 'LanguageStats') { $tabs['views']['lstats']['class'] .= ' selected'; } $tabs['views']['mstats'] = array('text' => wfMessage('translate-taction-mstats')->text(), 'href' => $messagegroupstats->getLocalUrl($params), 'class' => 'tux-tab'); if ($alias === 'MessageGroupStats') { $tabs['views']['mstats']['class'] .= ' selected'; } // Kind of hackish, but works for now global $wgTranslateTasks; foreach (array_keys($wgTranslateTasks) as $taskname) { if (!preg_match('/^export-/', $taskname)) { continue; } $tabs['views']['export'] = array('text' => wfMessage('translate-taction-export')->text(), 'href' => $translate->getLocalUrl(array('taction' => 'export') + $params), 'class' => 'tux-tab'); if ($alias === 'Translate' && $taction === 'export') { $tabs['views']['export']['class'] .= ' selected'; } // We only need the tab to apper once ;) break; } return true; }
/** * Converts the edit tab (if exists) for translation pages to translate tab. * Hook: SkinTemplateNavigation * @since 2013.06 */ static function translateTab(Skin $skin, array &$tabs) { $title = $skin->getTitle(); $handle = new MessageHandle($title); $code = $handle->getCode(); $page = TranslatablePage::isTranslationPage($title); if (!$page) { return true; } // The source language has a subpage too, but cannot be translated if ($page->getSourceLanguageCode() === $code) { return true; } if (isset($tabs['views']['edit'])) { $tabs['views']['edit']['text'] = $skin->msg('tpt-tab-translate')->text(); $tabs['views']['edit']['href'] = $page->getTranslationUrl($code); } return true; }
/** * Adds Promoter specific navigation tabs to the UI. * Implementation of SkinTemplateNavigation::SpecialPage hook. * * @param Skin $skin Reference to the Skin object * @param array $tabs Any current skin tabs * * @return boolean */ public static function addNavigationTabs(Skin $skin, array &$tabs) { global $wgPromoterTabifyPages; $title = $skin->getTitle(); list($alias, $sub) = SpecialPageFactory::resolveAlias($title->getText()); if (!array_key_exists($alias, $wgPromoterTabifyPages)) { return true; } // Clear the special page tab that's there already //$tabs['namespaces'] = array(); // Now add our own foreach ($wgPromoterTabifyPages as $page => $keys) { $tabs[$keys['type']][$page] = array('text' => wfMessage($keys['message']), 'href' => SpecialPage::getTitleFor($page)->getFullURL(), 'class' => $alias === $page ? 'selected' : ''); } return true; }
/** * Adds the task-based tabs on Special:Translate and few other special pages. * Hook: SkinTemplateNavigation::SpecialPage * @since 2012-05-14 */ static function tabify(Skin $skin, array &$tabs) { $title = $skin->getTitle(); list($alias, ) = SpecialPageFactory::resolveAlias($title->getText()); $pagesInGroup = array('ManageMessageGroups' => 'namespaces', 'AggregateGroups' => 'namespaces', 'SupportedLanguages' => 'views', 'TranslationStats' => 'views'); if (!isset($pagesInGroup[$alias])) { return true; } $skin->getOutput()->addModuleStyles('ext.translate.tabgroup'); $tabs['namespaces'] = array(); foreach ($pagesInGroup as $spName => $section) { $spClass = SpecialPageFactory::getPage($spName); if ($spClass === null) { continue; // Page explicitly disabled } $spTitle = $spClass->getPageTitle(); $tabs[$section][strtolower($spName)] = array('text' => $spClass->getDescription(), 'href' => $spTitle->getLocalUrl(), 'class' => $alias === $spName ? 'selected' : ''); } return true; }
/** * * @param OutputPage $oOutputPage * @param Skin $oSkin */ public function onBeforePageDisplay(&$oOutputPage, &$oSkin) { if (!$oSkin->getTitle()->equals(SpecialPage::getTitleFor('AdminDashboard')) && !$oSkin->getTitle()->equals(SpecialPage::getTitleFor('WikiAdmin')) && !$oSkin->getTitle()->equals(SpecialPage::getTitleFor('UserDashboard'))) { return true; } $oOutputPage->addModules('ext.bluespice.statisticsPortlets'); return true; }
/** * Template filter callback for MonoBook skin. * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. * * @access private */ function execute() { //uncomment for a quick data dump, since there's no documentation I can find that covers this... //echo '<pre>'; print_r($this->data); exit; global $wgLang; $this->skin = $this->data['skin']; // Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings(); // Build additional attributes for navigation urls //$nav = $this->skin->buildNavigationUrls(); $nav = $this->data['content_navigation']; if ($wgVectorUseIconWatch) { $mode = $this->skin->getTitle()->userIsWatching() ? 'unwatch' : 'watch'; if (isset($nav['actions'][$mode])) { $nav['views'][$mode] = $nav['actions'][$mode]; $nav['views'][$mode]['class'] = rtrim('icon ' . $nav['views'][$mode]['class'], ' '); $nav['views'][$mode]['primary'] = true; unset($nav['actions'][$mode]); } } $xmlID = ''; foreach ($nav as $section => $links) { foreach ($links as $key => $link) { if ($section == 'views' && !(isset($link['primary']) && $link['primary'])) { $link['class'] = rtrim('collapsible ' . $link['class'], ' '); } $xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID; $nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId($xmlID) . '"'; if ($link['class']) { $nav[$section][$key]['attributes'] .= ' class="' . htmlspecialchars($link['class']) . '"'; unset($nav[$section][$key]['class']); } if (isset($link['tooltiponly']) && $link['tooltiponly']) { $nav[$section][$key]['key'] = Linker::tooltip($xmlID); } else { $nav[$section][$key]['key'] = Xml::expandAttributes(Linker::tooltipAndAccesskeyAttribs($xmlID)); } } } $this->data['namespace_urls'] = $nav['namespaces']; $this->data['view_urls'] = $nav['views']; $this->data['action_urls'] = $nav['actions']; $this->data['variant_urls'] = $nav['variants']; foreach ($this->data['content_navigation']['namespaces'] as $ns) { if ($ns['class'] == 'selected') { $current_context = $ns['context']; } } //print_r($this->data['content_navigation']); exit; // Reverse horizontally rendered navigation elements /*if ( $wgLang->isRTL() ) { $this->data['view_urls'] = array_reverse( $this->data['view_urls'] ); $this->data['namespace_urls'] = array_reverse( $this->data['namespace_urls'] ); $this->data['personal_urls'] = array_reverse( $this->data['personal_urls'] ); }*/ require_once realpath(__DIR__ . '/../../../library') . '/Masthead.php'; $masthead = new PracticalPlants_Masthead(array('active_tab' => 'wiki')); ?> <!DOCTYPE html> <!-- <?php /*print_r($this->content); print_r($_GET); /*print_r($this->data);*/ ?> --> <html lang="en" dir="ltr" class="client-nojs"> <head> <title><?php echo $this->data['pagetitle']; ?> </title> <meta charset="UTF-8" /> <?php echo $this->data['headlinks']; ?> <?php echo $this->data['csslinks']; ?> <?php echo $this->data['pagecss']; ?> <?php echo $this->data['usercss']; ?> <?php echo $this->data['jsvarurl']; ?> <?php echo $this->data['headscripts']; ?> </head> <body class="<?php echo $this->data['pageclass']; ?> "> <div id="page-wrapper"> <?php $masthead->output(); ?> <?php if ($this->data['sitenotice']) { ?> <div id="siteNotice"><?php $this->html('sitenotice'); ?> </div><?php } ?> <article id="main-entry" class="wiki-entry"> <?php if (isset($this->content['article state'])) { ?> <?php echo $this->content['article state'][0]; ?> <?php } ?> <?php $header_class = ''; if (isset($this->content['article image'])) { $header_class .= 'with-image'; } if (isset($this->content['icon bar'])) { $header_class .= ' with-iconbar'; } ?> <header id="page-header" class="<?php echo $header_class; ?> "> <div class="width-constraint"> <div id="header-content"> <h1 id="article-title"><?php $this->html('title'); if (isset($this->content['common name'])) { echo '<div id="common-name">' . $this->content['common name'][0] . '</div>'; } ?> </h1> <?php if (isset($this->content['article summary'])) { ?> <div id="article-summary"><?php echo '<p>' . implode('</p><p>', $this->content['article summary']) . '</p>'; ?> </div><?php } ?> <div id="article-image-container"><?php if (isset($this->content['article image'])) { ?> <div id="article-image"><?php echo implode('', $this->content['article image']); ?> </div><?php } ?> </div> </div> </div> <?php if (isset($this->content['header'])) { echo implode('', $this->content['header']); } ?> <?php if (isset($this->content['icon bar'])) { echo implode('', $this->content['icon bar']); } ?> <?php if (isset($this->content['use flags'])) { echo implode('', $this->content['use flags']); } ?> <a id="beta-banner" href="/wiki/PracticalPlants:Beta"></a> </header> <div class="width-constraint"> <aside id="sidebar"> <div id="page-buttons"> <?php /*foreach($this->data['view_urls'] as $type => $link): if(strpos($link['attributes'],'selected')) continue; switch($type): case 'view': ?> <a href="#" class="btn btn-large btn-success btn-block" id="sidebar-save-page-button"><i class="icon-ok icon-white"></i> Save Changes</a> <a href="<?php echo htmlspecialchars( $link['href'] ) ?>" class="btn btn-large btn-block"<?php echo $link['attributes'] ?> <?php echo $link['key'] ?>><i class="icon-arrow-left"></i> Return without Saving</a> <?php break; case 'form_edit': ?> <a href="<?php echo htmlspecialchars( $link['href'] ) ?>" class="btn btn-large btn-success btn-block"<?php echo $link['attributes'] ?>> <?php echo $link['key'] ?><i class="icon-pencil icon-white"></i> Edit This Page</a> <?php break; case 'edit': ?> <a href="<?php echo htmlspecialchars( $link['href'] ) ?>" class="btn btn-large btn-block"<?php echo $link['attributes'] ?> <?php echo $link['key'] ?>><i class="icon-edit"></i> Edit Source</a> <?php break; case 'history': ?> <a href="<?php echo htmlspecialchars( $link['href'] ) ?>" class="btn btn-small"<?php echo $link['attributes'] ?> <?php echo $link['key'] ?>><i class="icon-time"></i> History</a> <?php break; endswitch; endforeach; */ ?> <?php $action = isset($_GET['action']) ? $_GET['action'] : ''; //echo substr( $this->data->thispage, 0, 16); if ($action === '' && isset($_GET['title'])) { if (substr($_GET['title'], 0, 16) == 'Special:FormEdit') { $action = 'formedit'; } } //View button (displayed on edit/history screens) if ($action === 'edit' || $action === 'formedit' || $action === 'submit') { $label = 'Save Changes'; //if we're currently on a talk page, and we're currently adding as DiscussionThreading item if ($current_context === self::NS_CONTEXT_TALK && isset($this->data['content_navigation']['views']['addsection']) && $this->data['content_navigation']['views']['addsection']['class'] == 'selected') { $label = 'Save Note'; } ?> <a href="#" class="btn btn-large btn-success btn-block" id="sidebar-save-button"><i class="icon-ok icon-white"></i> <?php echo $label; ?> </a> <?php } ?> <?php //View button (displayed on edit/history screens) if (isset($this->data['view_urls']['view']) && !strpos($this->data['view_urls']['view']['attributes'], 'selected')) { $link = $this->data['view_urls']['view']; ?> <?php if ($action === 'submit') { ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large btn-danger btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-arrow-left icon-white"></i> Discard Changes & Return</a> <?php } elseif ($current_context === self::NS_CONTEXT_TALK) { ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-arrow-left"></i> View Notes</a> <?php } else { ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-arrow-left"></i> View Page</a> <?php } ?> <?php } ?> <?php //form edit button if (isset($this->data['view_urls']['form_edit']) && !strpos($this->data['view_urls']['form_edit']['attributes'], 'selected')) { $link = $this->data['view_urls']['form_edit']; ?> <?php if ($action === 'submit') { ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large btn-danger btn-block"<?php echo $link['attributes']; ?> > <?php echo $link['key']; ?> <i class="icon-pencil icon-white"></i> Discard Changes & Edit</a> <?php } else { ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large btn-success btn-block"<?php echo $link['attributes']; ?> > <?php echo $link['key']; ?> <i class="icon-pencil icon-white"></i> Edit This Page</a> <?php } ?> <?php } ?> <?php //edit source button if (isset($this->data['view_urls']['edit']) && !strpos($this->data['view_urls']['edit']['attributes'], 'selected')) { //if we're on a talk page and DiscussionThreading is on, and the addsection nav is not currently selected, show an "Add Note" button as the primary button if ($current_context === self::NS_CONTEXT_TALK && isset($this->data['content_navigation']['views']['addsection'])) { $is_primary = false; if ($this->data['content_navigation']['views']['addsection']['class'] !== 'selected') { ?> <a href="<?php echo htmlspecialchars($this->data['content_navigation']['views']['addsection']['href']); ?> " class="btn btn-large btn-success btn-block"<?php echo $link['attributes']; ?> > <?php echo $link['key']; ?> <i class="icon-plus-sign icon-white"></i> Add A Note</a> <?php } //otherwise if this view has a form edit button, this button should be white, else green } else { $is_primary = isset($this->data['view_urls']['form_edit']) ? false : true; ?> <?php } $link = $this->data['view_urls']['edit']; ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-large <?php if ($is_primary) { ?> btn-success <?php } ?> btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-edit<?php if ($is_primary) { ?> icon-white<?php } ?> "></i> Edit Source</a> <?php } ?> <?php //view notes / view content button to switch between Content and Talk namespaces if (isset($this->data['namespace_urls']) && !empty($this->data['namespace_urls']) && count($this->data['namespace_urls']) > 1) { $content_ns = array_shift($this->data['namespace_urls']); $talk_ns = array_shift($this->data['namespace_urls']); if (strpos($content_ns['attributes'], 'selected')) { ?> <a href="<?php echo htmlspecialchars($talk_ns['href']); ?> " class="btn btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-book"></i> View Page Notes</a> <?php } else { ?> <a href="<?php echo htmlspecialchars($content_ns['href']); ?> " class="btn btn-block"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-arrow-left"></i> View Page Content</a> <?php } ?> <?php } ?> <?php //history button if (isset($this->data['view_urls']['history']) && !strpos($this->data['view_urls']['history']['attributes'], 'selected')) { $link = $this->data['view_urls']['history']; ?> <a href="<?php echo htmlspecialchars($link['href']); ?> " class="btn btn-small"<?php echo $link['attributes']; ?> <?php echo $link['key']; ?> ><i class="icon-time"></i> History</a> <?php } ?> <?php if (!empty($this->data['action_urls'])) { ?> <div class="dropdown" id="article-actions-dropdown"> <a id="article-actions-menu" class="btn btn-small dropdown-toggle" data-toggle="dropdown"><i class="icon-file"></i> <?php $this->msg('actions'); ?> <b class="caret"></b></a> <ul<?php $this->html('userlangattributes'); ?> class="dropdown-menu pull-right"> <?php foreach ($this->data['action_urls'] as $link) { ?> <li<?php echo $link['attributes']; ?> ><a href="<?php echo htmlspecialchars($link['href']); ?> " <?php echo $link['key']; ?> ><?php echo htmlspecialchars($link['text']); ?> </a></li> <?php } ?> </ul> </div> <?php } ?> <div class="dropdown" id="article-toolbox-dropdown" <?php echo Linker::tooltip('p-tb'); ?> > <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" <?php $this->html('userlangattributes'); ?> > <i class="icon-wrench"></i> <b class="caret"></b> <?php /*$msgObj = wfMessage( 'toolbox' ); echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : 'toolbox' );*/ ?> </a> <ul class="dropdown-menu pull-right"> <?php foreach ($this->getToolbox() as $key => $val) { ?> <?php echo $this->makeListItem($key, $val); ?> <?php } if (isset($hook)) { wfRunHooks('SkinTemplateToolboxEnd', array(&$this, true)); } ?> </ul> </div> </div> <div id="toc-container"> <?php if (isset($this->content['toc'])) { echo $this->content['toc'][0]; } ?> </div> </aside> <div id="after-header"></div> <div class="article-content"> <?php if ($this->data['undelete']) { ?> <div id="contentSub2"><?php $this->html('undelete'); ?> </div> <?php } if ($this->data['newtalk']) { ?> <div class="usermessage"><?php $this->html('newtalk'); ?> </div> <?php } /*if($this->data['showjumplinks']) { ?> <div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div> <?php } */ ?> <a id="top"></a> <!-- start content --> <?php $this->html('bodytext'); ?> <?php if ($this->data['catlinks']) { $this->html('catlinks'); } ?> <!-- end content --> <?php if ($this->data['dataAfterContent']) { $this->html('dataAfterContent'); } ?> <div class="visualClear"></div> </div> </div><!--/width-constraint--> </article> <nav id="menubar"<?php $this->html('userlangattributes'); ?> class="masthead-submenu navbar"> <ul class="nav"> <li><a href="/wiki/"><i class="icon-home icon-white"></i> Home</a></li> <li><a href="/wiki/Search"><i class="icon-search icon-white"></i> Advanced Search</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-user icon-white"></i> Your Pages <b class="caret"></b></a> <ul class="dropdown-menu"<?php $this->html('userlangattributes'); ?> > <?php $usertools = $this->getPersonalTools(); //print_r($usertools);exit; //remove signup and login links if (isset($usertools['anonlogin'])) { unset($usertools['anonlogin']); } if (isset($usertools['logout'])) { unset($usertools['logout']); } foreach ($usertools as $key => $item) { ?> <?php echo $this->makeListItem($key, $item); ?> <?php } ?> </ul> </li> <li><a href="/wiki/Help:Contents"><i class="icon-question-sign icon-white"></i> Help</a></li> </ul> <ul class="nav pull-right"> <li id="search-nav"> <i class="icon-search icon-white"></i> <form action="/w/index.php" id="searchform"> <input type="hidden" name="title" value="Special:Search"> <input name="search" title="Search All Plants" accesskey="f" id="plant-search" placeholder="Enter a plant name or search term..." class="search-field"> <input type="submit" name="go" value="Go" title="Go to a page with this exact name if exists" id="searchGoButton" class="searchButton"> <input type="submit" name="fulltext" value="Search" title="Search the pages for this text" id="mw-searchButton" class="searchButton"> </form> </li> </ul> </nav><!-- end of the left (by default at least) column --> </div><!--/width-constraint--> <div class="clear"></div> <?php $links = $this->getFooterLinks(); $info = '<ul>'; foreach ($links['info'] as $link) { $info .= '<li>' . $this->data[$link] . '</li>'; } $info .= '</ul>'; $masthead->footer(array(array('id' => 'mw-footer-info', 'title' => "Page Info", 'content' => $info))); ?> </div> <?php $this->printTrail(); include realpath(__DIR__ . '/../../../library') . '/google-analytics.html'; echo Html::closeElement('body'); echo Html::closeElement('html'); wfRestoreWarnings(); }
public static function onSkinAfterBottomScripts(Skin $skin, &$text = '') { global $wgGoogleUniversalAnalyticsOtherCode; if ($wgGoogleUniversalAnalyticsOtherCode === null || $skin->getUser()->isAllowed('noanalytics') || self::isIgnoredPage($skin->getTitle())) { return true; } $text .= $wgGoogleUniversalAnalyticsOtherCode . PHP_EOL; return true; }
/** * Removes protection tab for message namespaces - not useful. * Hook: SkinTemplateTabs */ public static function tabs( Skin $skin, &$tabs ) { $handle = new MessageHandle( $skin->getTitle() ); if ( $handle->isMessageNamespace() ) { unset( $tabs['protect'] ); } return true; }
/** * Interact with the mobile skin's default modules on Flow enabled pages * * @param Skin $skin * @param array $modules * @return bool */ public static function onSkinMinervaDefaultModules(Skin $skin, array &$modules) { // Disable toggling on occupied talk pages in mobile $title = $skin->getTitle(); if (self::$occupationController->isTalkpageOccupied($title)) { $modules['toggling'] = array(); } // Turn off default mobile talk overlay for these pages if ($title->canTalk()) { $talkPage = $title->getTalkPage(); if (self::$occupationController->isTalkpageOccupied($talkPage)) { // TODO: Insert lightweight JavaScript that opens flow via ajax $modules['talk'] = array(); } } return true; }