public static function getInstance() { if (self::$instance == false) { $h = AdEngine::getCachedCategory(); // ***************** Athena has been replaced by Liftium return self::$instance = new AdProviderLiftium(); } return self::$instance; }
/** * Register ad-related vars on top * * @param array $vars * * @return bool */ public function onWikiaSkinTopScripts(&$vars, &$scripts) { wfProfileIn(__METHOD__); $wg = $this->app->wg; // AdEngine2.js $vars['adslots2'] = array(); $vars['wgLoadAdsInHead'] = !empty($wg->LoadAdsInHead); $vars['wgAdsShowableOnPage'] = self::areAdsShowableOnPage(); $vars['wgShowAds'] = $wg->ShowAds; // TODO remove later, legacy addriver for adsinhead=1 $vars['adDriverLastDARTCallNoAds'] = array(); // WikiaDartHelper.js if (!empty($wg->DartCustomKeyValues)) { $vars['wgDartCustomKeyValues'] = $wg->DartCustomKeyValues; } $cat = AdEngine::getCachedCategory(); $vars["cityShort"] = $cat['short']; wfProfileOut(__METHOD__); return true; }
protected static function getUrlScript($base_url, $slotname = '', $zone_id = '', $affiliate_id = '', $params = null) { wfProfileIn(__METHOD__); $cat = AdEngine::getCachedCategory(); $additional_params = ""; if (!empty($params) && is_array($params)) { foreach ($params as $key => $val) { $additional_params .= "&" . urlencode($key) . "=" . urlencode($val); } } $adUrlScript = <<<EOT \tbase_url = AdProviderOpenX.getUrl("{$base_url}", "{$slotname}", "{$zone_id}", "{$affiliate_id}", "{$cat['short']}", "{$additional_params}"); EOT; wfProfileOut(__METHOD__); return $adUrlScript; }
public static function getLiftiumOptionsScript() { wfProfileIn(__METHOD__); global $wgDBname, $wgTitle, $wgLang; // See Liftium.js for documentation on options $options = array(); $options['pubid'] = 999; $options['baseUrl'] = '/__varnish_liftium/'; $options['kv_wgDBname'] = $wgDBname; if (is_object($wgTitle)) { $options['kv_article_id'] = $wgTitle->getArticleID(); $options['kv_wpage'] = $wgTitle->getPartialURL(); } $cat = AdEngine::getCachedCategory(); $options['kv_Hub'] = $cat['name']; $options['kv_skin'] = RequestContext::getMain()->getSkin()->getSkinName(); $options['kv_user_lang'] = $wgLang->getCode(); $options['kv_cont_lang'] = $GLOBALS['wgLanguageCode']; $options['kv_isMainPage'] = WikiaPageType::isMainPage(); $options['kv_page_type'] = WikiaPageType::getPageType(); $options['geoUrl'] = "http://geoiplookup.wikia.com/"; if (!empty($wgDartCustomKeyValues)) { $options['kv_dart'] = $wgDartCustomKeyValues; } $options['kv_domain'] = $_SERVER['HTTP_HOST']; $js = "LiftiumOptions = " . json_encode($options) . ";\n"; if (WikiaPageType::isSearch() || !$wgTitle->getNamespace() == NS_SPECIAL && !BodyController::isEditPage()) { $js .= <<<EOT \t\t\t\tif ( !window.wgLoadAdDriverOnLiftiumInit && ( !window.Wikia.AbTest || !Wikia.AbTest.inTreatmentGroup( "AD_LOAD_TIMING", "ONLOAD" ) ) ) { \t\t\t\t\tLiftiumOptions['hasMoreCalls'] = true; \t\t\t\t\tLiftiumOptions['isCalledAfterOnload'] = true; \t\t\t\t\tLiftiumOptions['maxLoadDelay'] = 6000; \t\t\t\t} \t\t\t\telse { \t\t\t\t\tLiftiumOptions['autoInit'] = false; \t\t\t\t} EOT; } else { $js .= <<<EOT \t\t\t\tLiftiumOptions['hasMoreCalls'] = true; \t\t\t\tLiftiumOptions['isCalledAfterOnload'] = true; \t\t\t\tLiftiumOptions['maxLoadDelay'] = 6000; EOT; } $js = AssetsManagerBaseBuilder::minifyJs($js); $out = "\n<!-- Liftium options -->\n"; $out .= Html::inlineScript($js) . "\n"; wfProfileOut(__METHOD__); return $out; }
private function getHub() { $cat = AdEngine::getCachedCategory(); return $cat['short']; }
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 getSetupHtml($params = null) { static $called = false; if ($called) { return false; } $called = true; wfProfileIn(__METHOD__); global $wgDBname, $wgLang, $wgTitle, $wgLiftiumDevHosts, $wgDevelEnvironment; global $wgDartCustomKeyValues, $wgLoadAdDriverOnLiftiumInit; // See Liftium.js for documentation on options $options = array(); $options['pubid'] = 999; $options['baseUrl'] = '/__varnish_liftium/'; $options['kv_wgDBname'] = $wgDBname; if (is_object($wgTitle)) { $options['kv_article_id'] = $wgTitle->getArticleID(); $options['kv_wpage'] = $wgTitle->getPartialURL(); } $cat = AdEngine::getCachedCategory(); $options['kv_Hub'] = $cat['name']; $options['kv_skin'] = RequestContext::getMain()->getSkin()->getSkinName(); $options['kv_user_lang'] = $wgLang->getCode(); $options['kv_cont_lang'] = $GLOBALS['wgLanguageCode']; $options['kv_isMainPage'] = WikiaPageType::isMainPage(); $options['kv_page_type'] = WikiaPageType::getPageType(); $options['geoUrl'] = "http://geoiplookup.wikia.com/"; if (!empty($wgDartCustomKeyValues)) { $options['kv_dart'] = $wgDartCustomKeyValues; } $options['kv_domain'] = $_SERVER['HTTP_HOST']; if (!empty($params)) { if (isset($params['isCalledAfterOnload'])) { $options['isCalledAfterOnload'] = $params['isCalledAfterOnload']; } if (isset($params['hasMoreCalls'])) { $options['hasMoreCalls'] = $params['hasMoreCalls']; } if (isset($params['maxLoadDelay'])) { $options['maxLoadDelay'] = $params['maxLoadDelay']; } } // LiftiumOptions as json $out = '<script type="text/javascript">' . "\n"; $out .= "LiftiumOptions = " . json_encode($options) . ";\n"; $out .= '</script>'; // Call the script global $wgDevelEnvironment; if (!empty($_GET['liftium_dev_hosts']) || !empty($wgLiftiumDevHosts)) { $base = "http://nick.dev.liftium.com/"; $version = '?' . mt_rand(); $out .= "<script type=\"text/javascript\">var liftium_dev_hosts = 1;</script>"; } else { if ($wgDevelEnvironment) { $base = "http://liftium.wikia.com/"; $version = '?' . mt_rand(); } else { $base = "/__varnish_liftium/"; $version = ""; } } if ($options['kv_skin'] != 'oasis') { foreach (AssetsManager::getInstance()->getGroupCommonURL('liftium_ads_js') as $src) { $out .= '<script type="text/javascript" src="' . htmlspecialchars($src) . '"></script>' . "\n"; } } wfProfileOut(__METHOD__); return $out; }
/** * 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); }