/**
  * Action to display an ad (or not)
  */
 public function ad()
 {
     $this->includeLabel = $this->request->getVal('includeLabel');
     $this->onLoad = $this->request->getVal('onLoad');
     $this->pageTypes = $this->request->getVal('pageTypes');
     $this->slotName = $this->request->getVal('slotName');
     $this->showAd = AdEngine2Service::shouldShowAd($this->pageTypes);
 }
 public function getSetupHtml($params = array())
 {
     static $called = false;
     $code = '';
     if (!$called) {
         $called = true;
         if (F::app()->wg->EnableDynamicYield && F::app()->wg->ShowAds && AdEngine2Service::areAdsShowableOnPage()) {
             $code = self::$code;
         }
     }
     return $code;
 }
 public static function isEnabled()
 {
     global $wgEnableAmazonMatch, $wgEnableAmazonMatchOld, $wgEnableAdEngineExt, $wgShowAds, $wgAdDriverUseSevenOneMedia;
     return ($wgEnableAmazonMatch || $wgEnableAmazonMatchOld) && $wgEnableAdEngineExt && $wgShowAds && AdEngine2Service::areAdsShowableOnPage() && !$wgAdDriverUseSevenOneMedia;
 }
 public function shouldShowAds()
 {
     return $this->wg->EnableAdEngineExt && AdEngine2Service::areAdsShowableOnPage();
 }
 public static function isEnabled()
 {
     global $wgEnableAdEngineExt, $wgShowAds, $wgAdDriverUseSevenOneMedia;
     return $wgEnableAdEngineExt && $wgShowAds && AdEngine2Service::areAdsShowableOnPage() && self::getRtpCountries() && self::getRtpConfig() && !$wgAdDriverUseSevenOneMedia;
 }
Example #6
0
 private function loadJs()
 {
     global $wgJsMimeType, $wgUser, $wgDevelEnvironment, $wgEnableAdEngineExt, $wgAllInOne;
     wfProfileIn(__METHOD__);
     $this->jsAtBottom = self::JsAtBottom();
     // load AbTesting files, anything that's so mandatory that we're willing to make a blocking request to load it.
     $this->globalBlockingScripts = '';
     $jsReferences = array();
     $jsAssetGroups = array('oasis_blocking');
     wfRunHooks('OasisSkinAssetGroupsBlocking', array(&$jsAssetGroups));
     $blockingScripts = $this->assetsManager->getURL($jsAssetGroups);
     foreach ($blockingScripts as $blockingFile) {
         $this->globalBlockingScripts .= "<script type=\"{$wgJsMimeType}\" src=\"{$blockingFile}\"></script>";
     }
     // move JS files added to OutputPage to list of files to be loaded
     $scripts = RequestContext::getMain()->getSkin()->getScripts();
     foreach ($scripts as $s) {
         //add inline scripts to jsFiles and move non-inline to the queue
         if (!empty($s['url'])) {
             // FIXME: quick hack to load MW core JavaScript at the top of the page - really, please fix me!
             // @author macbre
             if (strpos($s['url'], 'load.php') !== false) {
                 $this->globalVariablesScript = $s['tag'] . $this->globalVariablesScript;
             } else {
                 $url = $s['url'];
                 if ($wgAllInOne) {
                     $url = $this->minifySingleAsset($url);
                 }
                 $jsReferences[] = $url;
             }
         } else {
             $this->jsFiles .= $s['tag'];
         }
     }
     $isLoggedIn = $wgUser->isLoggedIn();
     $assetGroups = ['oasis_shared_core_js', 'oasis_shared_js'];
     if ($isLoggedIn) {
         $assetGroups[] = 'oasis_user_js';
     } else {
         $assetGroups[] = 'oasis_anon_js';
     }
     $jsLoader = '';
     wfRunHooks('OasisSkinAssetGroups', array(&$assetGroups));
     // add groups queued via OasisController::addSkinAssetGroup
     $assetGroups = array_merge($assetGroups, self::$skinAssetGroups);
     $assets = $this->assetsManager->getURL($assetGroups);
     // jQueryless version - appears only to be used by the ad-experiment at the moment.
     // disabled - not needed atm (and skipped in wsl-version anyway)
     // $assets[] = $this->assetsManager->getURL( $isLoggedIn ? 'oasis_nojquery_shared_js_user' : 'oasis_nojquery_shared_js_anon' );
     // add $jsReferences
     $assets = array_merge($assets, $jsReferences);
     // generate direct script tags
     foreach ($assets as $url) {
         $url = htmlspecialchars($url);
         $jsLoader .= "<script src=\"{$url}\"></script>\n";
     }
     $tpl = $this->app->getSkinTemplateObj();
     // $tpl->set( 'headscripts', $out->getHeadScripts() . $out->getHeadItems() );
     // FIXME: we need to remove head items - i.e. <meta> tags
     $remove = $this->wg->out->getHeadItemsArray();
     $remove[] = $this->topScripts;
     array_walk($remove, 'trim');
     $headScripts = str_replace($remove, '', $tpl->data['headscripts']);
     $this->jsFiles = $headScripts . $jsLoader . $this->jsFiles;
     // experiment: squeeze calls to mw.loader.load() to make fewer HTTP requests
     if ($this->jsAtBottom) {
         $jsFiles = $this->jsFiles;
         $bottomScripts = $this->bottomScripts;
         $this->squeezeMediawikiLoad($jsFiles, $bottomScripts);
         $this->bottomScripts = $bottomScripts;
         $this->jsFiles = $jsFiles;
     }
     if ($wgEnableAdEngineExt && AdEngine2Service::shouldLoadLiftium()) {
         $this->jsFiles = AdEngine2Controller::getLiftiumOptionsScript() . $this->jsFiles;
     }
     wfProfileOut(__METHOD__);
 }
 public static function onVenusAssetsPackages(array &$jsHeadGroups, array &$jsBodyGroups, array &$cssGroups)
 {
     $jsHeadGroups[] = self::ASSET_GROUP_ADENGINE_TRACKING;
     $jsHeadGroups[] = self::ASSET_GROUP_ADENGINE_DESKTOP;
     $jsHeadGroups[] = self::ASSET_GROUP_VENUS_ADS;
     if (AnalyticsProviderRubiconRTP::isEnabled()) {
         $jsHeadGroups[] = self::ASSET_GROUP_ADENGINE_RUBICON_RTP;
     }
     if (AnalyticsProviderAmazonMatch::isEnabled()) {
         $jsHeadGroups[] = self::ASSET_GROUP_ADENGINE_AMAZON_MATCH;
     }
     if (AdEngine2Service::shouldLoadLiftium()) {
         $jsBodyGroups[] = self::ASSET_GROUP_LIFTIUM;
     }
     return true;
 }