public function executeIndex() { wfProfileIn(__METHOD__); global $wgLang, $wgOut; $themeSettings = new ThemeSettings(); // current settings $this->themeSettings = $themeSettings->getSettings(); // application theme settings (not user settable) $this->applicationThemeSettings = SassUtil::getApplicationThemeSettings(); // recent versions $themeHistory = array_reverse($themeSettings->getHistory()); // format time (for edits older than 30 days - show timestamp) foreach ($themeHistory as &$entry) { $diff = time() - strtotime($entry['timestamp']); if ($diff < 30 * 86400) { $entry['timeago'] = wfTimeFormatAgo($entry['timestamp']); } else { $entry['timeago'] = $wgLang->date($entry['timestamp']); } } $this->themeHistory = $themeHistory; // URL user should be redirected to when settings are saved if (isset($_SERVER['HTTP_REFERER'])) { $this->returnTo = $_SERVER['HTTP_REFERER']; } else { $this->returnTo = $this->wg->Script; } // load Google Analytics code $this->analytics = AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW); $wgOut->getResourceLoader()->getModule('mediawiki'); $ret = implode("\n", array($wgOut->getHeadLinks(null, true), $wgOut->buildCssLinks(), $wgOut->getHeadScripts(), $wgOut->getHeadItems())); $this->globalVariablesScript = $ret; wfProfileOut(__METHOD__); }
public function index() { $this->checkGameAllowed(); //AppCache disabled for now, it generates more problems than expected //$this->response->setVal( 'appCacheManifestPath', self::CACHE_MANIFEST_PATH . "&cb={$this->wg->CacheBuster}" );//$this->wg->StyleVersion //Minimize the output size, we don't need all the global variables being exported in MW $jsMsg = F::build('JSMessages'); $jsMsg->enqueuePackage(self::JS_MESSAGES_PACKAGE, JSMessages::INLINE); $jsVars = array('wgCacheBuster' => $this->wg->CacheBuster, 'wgMessages' => $jsMsg->getPackages(array(self::JS_MESSAGES_PACKAGE))); //getting WikiaTracker global JS vars F::build('WikiaTrackerController')->onMakeGlobalVariablesScript($jsVars); $this->response->setVal('globalVariablesScript', Skin::makeVariablesScript($jsVars)); $this->response->setVal('scripts', AssetsManager::getInstance()->getGroupCommonURL('photopop')); $this->response->setVal('dataMain', $this->wg->ExtensionsPath . '/wikia/PhotoPop/shared/lib/main'); $this->response->setVal('cssLink', AssetsManager::getInstance()->getOneCommonURL("extensions/wikia/PhotoPop/shared/css/homescreen.css")); $this->response->setVal('trackingCode', AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW)); }
public function index() { global $wgUser, $wgCityId; $this->contents = $this->skinTemplateObj->data['bodytext']; $this->isUserLoggedIn = $wgUser->isLoggedIn(); $this->setBodyModules(); $this->setAds(); $this->setBodyClasses(); $this->setHeadItems(); $this->setAssets(); $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); $this->response->setTemplateEngine(WikiaResponse::TEMPLATE_ENGINE_MUSTACHE); }
<html> <head> <script> var wgIsMainpage=true; </script> <?php $wgDBname = "muppet"; $wgCityId = "831"; ini_set('display_errors', true); require_once 'AnalyticsEngine.php'; echo AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW); ?> </head> <body> Hi </body> </html>
function execute() { wfProfileIn( __METHOD__ ); global $wgContLang, $wgAllInOne, $wgArticle, $wgUser, $wgLogo, $wgStylePath, $wgStyleVersion, $wgRequest, $wgTitle, $wgSitename, $wgEnableFAST_HOME2, $wgExtensionsPath, $wgAllInOne, $wgContentNamespaces, $wgEnableRecipesTweaksExt, $wgBlankImgUrl; $skin = $wgUser->getSkin(); $namespace = $wgTitle->getNamespace(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php foreach($this->data['xhtmlnamespaces'] as $tag => $ns) { ?>xmlns:<?php echo "{$tag}=\"{$ns}\" "; } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>"> <?php wfProfileIn( __METHOD__ . '-head'); ?> <head> <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" /> <!-- Skin = <?php echo basename(__FILE__) ?> --> <?php $this->html('headlinks') ?> <title><?php $this->text('pagetitle') ?></title> <?php print Skin::makeGlobalVariablesScript( $this->data ); ?> <?php $allinone = $wgAllInOne; // Getting the extension CSS in a similar way to Oasis (whole skin should ideally be ported to Oasis soon). // Remove the media="print CSS from the normal array and add it to another so that it can be loaded asynchronously at the bottom of the page. global $wgOut; $printStyles = array(); $tmpOut = new OutputPage(); $tmpOut->styles = $wgOut->styles; foreach($tmpOut->styles as $style => $options) { if (isset($options['media']) && $options['media'] == 'print') { unset($tmpOut->styles[$style]); $printStyles[$style] = $options; } } // render CSS <link> tags $csslinks = $tmpOut->buildCssLinks(); // Extension css print $csslinks; // Site-CSS. global $wgUser, $wgStylePath, $wgJsMimeType; $srcs = AssetsManager::getInstance()->getGroupLocalURL($wgUser->isLoggedIn() ? 'site_user_css' : 'site_anon_css'); $srcs[] = $wgStylePath."/lyricsminimal/article.css"; // Probably ghetto. This whole skin needs to just be rewritten as Oasis modifications anyway though. foreach($srcs as $src) { echo '<link rel="stylesheet" href="'. htmlspecialchars( $src ) .'">'; } // Javascript (Oasis Style). $jsFiles = ''; $srcs = AssetsManager::getInstance()->getGroupCommonURL('oasis_shared_js'); $srcs = array_merge($srcs, AssetsManager::getInstance()->getGroupCommonURL('oasis_extensions_js')); $srcs = array_merge($srcs, AssetsManager::getInstance()->getGroupLocalURL($wgUser->isLoggedIn() ? 'oasis_user_js' : 'oasis_anon_js')); foreach($srcs as $src) { $jsFiles .= "<script type=\"$wgJsMimeType\" src=\"$src\"></script>"; } print $jsFiles; if($wgRequest->getVal('action') != '' || $namespace == NS_SPECIAL) { $this->html('WikiaScriptLoader'); $this->html('JSloader'); $this->html('headscripts'); } $this->printAdditionalHead(); ?> </head> <?php wfProfileOut( __METHOD__ . '-head'); ?> <?php wfProfileIn( __METHOD__ . '-body'); ?> <?php if (WikiaPageType::isMainPage()){ $isMainpage = ' mainpage'; } else { $isMainpage = null; } $action = $wgRequest->getVal('action'); if (in_array($action, array('edit', 'history', 'diff', 'delete', 'protect', 'unprotect', 'submit'))) { $body_css_action = 'action_' . $action; } else if (empty($action) || in_array($action, array('view', 'purge'))) { $body_css_action = 'action_view'; } else { $body_css_action = ''; } if(!isset($this->extraBodyClasses)){ // For extra classes to put on the body tag. This allows overriding sub-skins to create selectors specific to their sub-skin (such as custom answers). $this->extraBodyClasses = array(); } ?> <body<?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?> class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?><?php if(!empty($this->data['printable']) ) { ?> printable<?php } ?><?php if (!$wgUser->isLoggedIn()) { ?> loggedout<?php } ?> color2 wikiaSkinMonaco wikiaSkinLyricsMinimal<?=$isMainpage?> <?= $body_css_action ?><?php print " ".implode($this->extraBodyClasses, " "); ?>" id="body"> <?php // Sometimes we need an ad delivered at the very top of the page (like for a skin) // This sucks to have a blocking call at the top of the page, but they promised // to only do it if they needed. Only use DART or Google (fast Ad Providers with good infrastructure) global $wgOut; if (WikiaPageType::isMainPage()){ echo '<script type="text/javascript" src="/extensions/wikia/AdEngine/AdEngine.js"></script>' . "\n"; echo AdEngine::getInstance()->getAd('HOME_INVISIBLE_TOP'); } else if ($wgOut->isArticle() && WikiaPageType::isContentPage()){ echo '<script type="text/javascript" src="/extensions/wikia/AdEngine/AdEngine.js"></script>' . "\n"; echo AdEngine::getInstance()->getAd('INVISIBLE_TOP'); } ?> <?php // this hook allows adding extra HTML just after <body> opening tag // append your content to $html variable instead of echoing $html = ''; wfRunHooks('GetHTMLAfterBody', array ($this, &$html)); echo $html; // NOTE: Removed wikia_header and user links. ?> <!-- PAGE --> <?php wfProfileIn( __METHOD__ . '-page'); ?> <div class="monaco_shrinkwrap" id="monaco_shrinkwrap_main"> <?php wfRunHooks('MonacoBeforeWikiaPage', array($this)); ?> <div id="wikia_page"> <?php wfRunHooks('MonacoBeforePageBar', array($this)); if(empty($wgEnableRecipesTweaksExt) || !RecipesTweaks::isHeaderStripeShown()) { echo AdEngine::getInstance()->getSetupHtml(); ?> <div class='lyricsMinimalTop clearfix'> <div id="wiki_logo" style="background-image: url(<?= $wgLogo ?>);"><a href="<?= htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" accesskey="z"><?= $wgSitename ?></a></div> <!-- // TODO: Place REAL leaderboard ad here. --> <!-- <div id="lyricsMinimalTop_leader"><img src="http://www.iab.net/media/image/728X90.gif"/></div> --> </div> <?php // NOTE: Removed page-bar page_bar here. ?> <!-- ARTICLE --> <?php } wfProfileIn( __METHOD__ . '-article'); ?> <div id="article" <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>> <a name="top" id="top"></a> <?php wfRunHooks('MonacoAfterArticle', array($this)); // recipes: not needed? global $wgSupressSiteNotice, $wgEnableCommunityMessagesExt; if ( empty( $wgEnableCommunityMessagesExt ) && empty( $wgSupressSiteNotice ) && $this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?> <?php global $wgSupressPageTitle; if( empty( $wgSupressPageTitle ) ){ $this->printFirstHeading(); } if ($wgRequest->getVal('action') == 'edit') { //echo '<br /><a href="#" id="editTipsLink" onclick="editTips(); return false;">Show Editing Tips</a>'; } ?> <div id="bodyContent"> <h3 id="siteSub"><?php $this->msg('tagline') ?></h3> <div id="contentSub"><?php $this->html('subtitle') ?></div> <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?> <?php if($this->data['newtalk'] ) { ?><div class="usermessage noprint"><?php $this->html('newtalk') ?></div><?php } ?> <?php if(!empty($skin->newuemsg)) { echo $skin->newuemsg; } ?> <?php echo $this->getTopAdCode(); ?> <!-- start content --> <?php // Display content $this->printContent(); $this->printCategories(); ?> <!-- end content --> <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?> <div class="visualClear"></div> </div> <!--google_ad_section_end--> <!--contextual_targeting_end--> </div> <!-- /ARTICLE --> <?php // NOTE: Removed article footer. wfProfileOut( __METHOD__ . '-article'); ?> </div> <!-- /PAGE --> <!-- Begin Analytics --> <?php // Note, these were placed above the Ad calls intentionally because ad code screws with analytics echo AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW); echo AnalyticsEngine::track('GA_Urchin', 'hub', AdEngine::getCachedCategory()); global $wgCityId; echo AnalyticsEngine::track('GA_Urchin', 'onewiki', array($wgCityId)); echo AnalyticsEngine::track('GA_Urchin', 'pagetime', array('lean_monaco')); if (43339 == $wgCityId) echo AnalyticsEngine::track("GA_Urchin", "lyrics"); ?> <!-- End Analytics --> <?php wfProfileOut( __METHOD__ . '-page'); ?> <noscript><link rel="stylesheet" type="text/css" href="<?= $wgStylePath ?>/monaco/css/noscript.css?<?= $wgStyleVersion ?>" /></noscript> <?php if(!($wgRequest->getVal('action') != '' || $namespace == NS_SPECIAL)) { $this->html('WikiaScriptLoader'); $this->html('JSloader'); $this->html('headscripts'); } echo '<script type="text/javascript">/*<![CDATA[*/for(var i=0;i<wgAfterContentAndJS.length;i++){wgAfterContentAndJS[i]();}/*]]>*/</script>' . "\n"; if (array_key_exists("TOP_RIGHT_BOXAD", AdEngine::getInstance()->getPlaceholders())){ // Reset elements with a "clear:none" to "clear:right" when the box ad is displayed // Fixes pages like this: http://en.dcdatabaseproject.com/Fang_Zhifu_(New_Earth) echo '<script type="text/javascript">AdEngine.resetCssClear("right");</script>' . "\n"; } // NOTE: Removed wikia_footer. // NOTE: Removed WIDGETS (sidebar stuff) here. // curse like cobranding $this->printCustomFooter(); ?> <?php /* Put two "invisible" ad slots here. These are for loading ads that just load javascript, but it isn't positioned at any particular part of a page, such as a slider or a interstitial */ if ($wgOut->isArticle() && WikiaPageType::isContentPage()){ echo AdEngine::getInstance()->getAd('INVISIBLE_1'); } echo AdEngine::getInstance()->getDelayedIframeLoadingCode(); if ($wgOut->isArticle() && WikiaPageType::isContentPage()){ echo AdEngine::getInstance()->getAd('INVISIBLE_2'); } echo '</div>'; // Quant serve moved *after* the ads because it depends on Athena/Provider values. // macbre: RT #25697 - hide Quantcast Tags on edit pages if ( in_array($wgRequest->getVal('action'), array('edit', 'submit')) ) { echo '<!-- QuantServe and comscore hidden on edit page -->'; } else { echo AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW); echo AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW); echo AnalyticsEngine::track('Exelate', AnalyticsEngine::EVENT_PAGEVIEW); } $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ wfRunHooks('SpecialFooter'); ?> <div id="positioned_elements" class="reset"></div> <?php $this->html('reporttime'); wfProfileOut( __METHOD__ . '-body'); ?> </body> </html> <?php wfProfileOut( __METHOD__ ); } // end execute()
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)) { $this->displayAdminDashboard = true; } else { $this->displayAdminDashboard = false; } wfProfileOut(__METHOD__); }
public function index() { $this->wf->profileIn(__METHOD__); $jsHeadPackages = array('wikiamobile_js_head'); $jsBodyPackages = array(); $scssPackages = array(); $cssLinks = ''; $jsBodyFiles = ''; $jsHeadFiles = ''; $styles = null; $scripts = null; $assetsManager = F::build('AssetsManager', array(), 'getInstance'); $advert = ''; F::build('JSMessages')->enqueuePackage('WkMbl', JSMessages::INLINE); $jsBodyPackages[] = 'wikiamobile_js_body_full'; $scssPackages[] = 'wikiamobile_scss'; $styles = $this->skin->getStyles(); $scripts = $this->skin->getScripts(); //show ads only for anon users if ($this->wg->user->isAnon()) { $jsBodyPackages[] = 'wikiamobile_js_ads'; $advert = $this->app->renderView('WikiaMobileAdService', 'index'); } $nav = $this->app->renderView('WikiaMobileNavigationService', 'index'); $pageContent = $this->app->renderView('WikiaMobileBodyService', 'index', array('bodyText' => $this->templateObject->get('bodytext'), 'categoryLinks' => $this->templateObject->get('catlinks'))); $footer = $this->app->renderView('WikiaMobileFooterService', 'index'); //let extensions manipulate the asset packages (e.g. ArticleComments, //this is done to cut down the number or requests) $this->app->runHook('WikiaMobileAssetsPackages', array(&$jsHeadPackages, &$jsBodyPackages, &$scssPackages)); if (is_array($scssPackages)) { //force main SCSS as first to make overriding it possible foreach ($assetsManager->getURL($scssPackages) as $s) { //packages/assets are enqueued via an hook, let's make sure we should actually let them through if ($assetsManager->checkAssetUrlForSkin($s, $this->skin)) { //W3C standard says type attribute and quotes (for single non-URI values) not needed, let's save on output size $cssLinks .= "<link rel=stylesheet href=\"" . $s . "\"/>"; } } } if (is_array($styles)) { foreach ($styles as $s) { //safe URL's as getStyles performs all the required checks //W3C standard says type attribute and quotes (for single non-URI values) not needed, let's save on output size $cssLinks .= "<link rel=stylesheet href=\"{$s['url']}\"/>"; //this is a strict skin, getStyles returns only elements with a set URL } } if (is_array($jsHeadPackages)) { //core JS in the head section, definitely safe foreach ($assetsManager->getURL($jsHeadPackages) as $src) { //HTML5 standard, no type attribute required == smaller output $jsHeadFiles .= "<script src=\"{$src}\"></script>"; } } if (is_array($jsBodyPackages)) { foreach ($assetsManager->getURL($jsBodyPackages) as $s) { //packages/assets are enqueued via an hook, let's make sure we should actually let them through if ($assetsManager->checkAssetUrlForSkin($s, $this->skin)) { //HTML5 standard, no type attribute required == smaller output $jsBodyFiles .= "<script src=\"{$s}\"></script>"; } } } if (is_array($scripts)) { foreach ($scripts as $s) { //safe URL's as getScripts performs all the required checks //HTML5 standard, no type attribute required == smaller output $jsBodyFiles .= "<script src=\"{$s['url']}\"></script>"; } } //Bottom Scripts //do not run this hook, all the functionalities hooking in this don't take into account the pecularity of the mobile skin //$this->wf->RunHooks( 'SkinAfterBottomScripts', array ( $this->wg->User->getSkin(), &$bottomscripts ) ); //AppCache will be disabled for the first several releases //$this->appCacheManifestPath = ( $this->wg->DevelEnvironment && !$this->wg->Request->getBool( 'appcache' ) ) ? null : self::CACHE_MANIFEST_PATH . "&{$this->wg->StyleVersion}"; $this->response->setVal('jsHeadFiles', $jsHeadFiles); $this->response->setVal('topScripts', $this->skin->getTopScripts()); $this->response->setVal('allowRobots', !$this->wg->DevelEnvironment); $this->response->setVal('cssLinks', $cssLinks); $this->response->setVal('mimeType', $this->templateObject->get('mimetype')); $this->response->setVal('charSet', $this->templateObject->get('charset')); $this->response->setVal('headItems', $this->skin->getHeadItems()); $this->response->setVal('languageCode', $this->templateObject->get('lang')); $this->response->setVal('languageDirection', $this->templateObject->get('dir')); $this->response->setVal('headLinks', $this->wg->Out->getHeadLinks()); $this->response->setVal('pageTitle', $this->wg->Out->getHTMLTitle()); $this->response->setVal('bodyClasses', array('wkMobile', $this->templateObject->get('pageclass'))); $this->response->setVal('jsBodyFiles', $jsBodyFiles); $this->response->setVal('advertisement', $advert); $this->response->setVal('wikiaNavigation', $nav); $this->response->setVal('pageContent', $pageContent); $this->response->setVal('wikiaFooter', $footer); //global variables //from Output class //and from ResourceLoaderStartUpModule $res = new ResourceVariablesGetter(); $vars = array_diff_key($this->wg->Out->getJSVars() + $res->get(), array_flip($this->wg->WikiaMobileExcludeJSGlobals)); $this->response->setVal('globalVariablesScript', WikiaSkin::makeInlineVariablesScript($vars)); //tracking $trackingCode = ''; if (!in_array($this->wg->Request->getVal('action'), array('edit', 'submit'))) { $trackingCode .= AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW, array(), array('extraLabels' => array('mobilebrowser'))) . AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW); } //Stats for Gracenote reporting if ($this->wg->cityId == self::LYRICSWIKI_ID) { $trackingCode .= AnalyticsEngine::track('GA_Urchin', 'lyrics'); } $trackingCode .= AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW) . AnalyticsEngine::track('GA_Urchin', 'onewiki', array($this->wg->cityId)) . AnalyticsEngine::track('GA_Urchin', 'pagetime', array('wikiamobile')) . AnalyticsEngine::track('GA_Urchin', 'varnish-stat') . AnalyticsEngine::track('GAS', 'usertiming'); $this->response->setVal('trackingCode', $trackingCode); $this->wf->profileOut(__METHOD__); }
function writeRealJSON($result) { header('Content-type: text/javascript; charset=UTF-8'); /** * Add Comscore reporting (BugzId:33112), * unfortunately we can't repackage the app ATM, * this is hacky but we need to get that reporting now. * * @TODO remove when we'll get to v2 of the app * @author Jakub Olek */ $comscoreTag = str_replace("\n", '', AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW)); if (!empty($result['lyrics'])) { $result['lyrics'] = str_replace(self::COMSCORE_TAG_PLACEHOLDER, $comscoreTag, $result['lyrics']); } // TODO: Use this once we are on PHP 5.3 or greater. //print json_encode($result, JSON_HEX_APOS); // TODO: Do we even need this? It might actually work already. //$result = self::replaceApostrophes($result); $json = json_encode($result); // Support for jsonp callbacks (using the 'callback' parameter just like core MediaWiki API). global $wgRequest; $callback = $wgRequest->getVal('callback'); if ($callback == "?") { // there is a widespread convention of wrapping in an anonymous function when "?" is passed as the callback name. print "({$json})"; } else { if (!empty($callback)) { print $callback . "({$json})"; } else { print $json; } } }
private function handleTracking() { wfProfileIn(__METHOD__); $trackingCode = ''; if (!in_array($this->wg->Request->getVal('action'), ['edit', 'submit'])) { $trackingCode .= AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW, ['extraLabels' => ['Category.MobileWeb.WikiaMobile']]) . AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW) . AnalyticsEngine::track('BlueKai', AnalyticsEngine::EVENT_PAGEVIEW) . AnalyticsEngine::track('Datonics', AnalyticsEngine::EVENT_PAGEVIEW); } //Stats for Gracenote reporting $trackingCode .= AnalyticsEngine::track('GoogleUA', 'usertiming'); $this->response->setVal('trackingCode', $trackingCode); wfProfileOut(__METHOD__); }
/** * Return tracking code */ private function getAnalyticsCode() { global $wgCityId; return AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW); }
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()
<html> <head> <script> var wgIsMainpage=true; </script> <?php $wgDBname = "muppet"; $wgCityId = "831"; ini_set('display_errors', true); require_once 'AnalyticsEngine.php'; echo AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW); echo AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW); ?> </head> <body> Hi </body> <?php echo AnalyticsEngine::track('GA_Urchin', 'dbname', array($wgDBname)); echo AnalyticsEngine::track('GA_Urchin', 'main_page'); echo AnalyticsEngine::track('GA_Urchin', 'onewiki', array($wgCityId)); ?> </html>
protected function afterContentHook () { global $wgCityId, $wgRightsUrl; $data = ''; // Comscore $data .= AnalyticsEngine::track('Comscore', AnalyticsEngine::EVENT_PAGEVIEW); // Quantcast $data .= AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW, array(), array('extraLabels'=>array('mobileapp'))); // load Google Analytics code $data .= AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW); // onewiki GA $data .= AnalyticsEngine::track('GA_Urchin', 'onewiki', array($wgCityId)); return $data; }
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)); } } // Reset (this ensures no duplication in CSS links) $this->cssLinks = ''; $this->cssPrintLinks = ''; foreach ( $skin->getStyles() as $s ) { if ( !empty($s['url']) ) { $tag = $s['tag']; if ( !empty( $wgAllInOne ) ) { $url = $this->minifySingleAsset($s['url']); if ($url !== $s['url']) { $tag = str_replace($s['url'],$url,$tag); } } // Print styles will be loaded separately at the bottom of the page if ( stripos($tag, 'media="print"') !== false ) { $this->cssPrintLinks .= $tag; } else { $this->cssLinks .= $tag; } } else { $this->cssLinks .= $s['tag']; } } $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 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 TODO NEF no browser height tracking code anymore, remove //$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'browser-height'); // record which varnish this page was served by $this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'varnish-stat'); // TODO NEF not used, remove //$this->googleAnalytics .= AnalyticsEngine::track('GA_Urchin', 'noads'); // TODO NEF we dont do AB this way anymore, remove //$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->ivw = AnalyticsEngine::track('IVW', AnalyticsEngine::EVENT_PAGEVIEW); } $this->mainSassFile = 'skins/oasis/css/oasis.scss'; if (!empty($wgEnableAdminDashboardExt) && AdminDashboardLogic::displayAdminDashboard($this->app, $wgTitle)) { $this->displayAdminDashboard = true; } else { $this->displayAdminDashboard = false; } wfProfileOut(__METHOD__); }
/** * Return tracking code */ private function getAnalyticsCode() { global $wgCityId; return AnalyticsEngine::track('GA_Urchin', AnalyticsEngine::EVENT_PAGEVIEW) . AnalyticsEngine::track('GA_Urchin', 'hub', AdEngine::getCachedCategory()) . AnalyticsEngine::track('GA_Urchin', 'onewiki', array($wgCityId)) . AnalyticsEngine::track('QuantServe', AnalyticsEngine::EVENT_PAGEVIEW); }