function execute()
 {
     global $wgOut, $wgUser, $wgRequest, $wgExtensionsPath, $wgOutboundScreenConfig, $wgCityId, $wgEnableOutboundScreenExt;
     $url = $wgRequest->getText('u');
     $noAutoRedirect = $wgRequest->getText('noredirect') == 1 ? true : false;
     $loggedIn = $wgUser->isLoggedIn();
     if (trim($url) == "") {
         // Nowhere to go.  Display an appropriate explanation (nowhere to go).
         $wgOut->addWikiText(wfMsg('outbound-screen-already-logged-in-no-link'));
     } else {
         if ($wgOutboundScreenConfig['anonsOnly'] == true && $loggedIn || empty($wgEnableOutboundScreenExt)) {
             $wgOut->redirect(htmlspecialchars_decode($url));
             return true;
         } else {
             // output only template content
             $wgOut->setArticleBodyOnly(true);
             // render template
             $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
             // Need to have the skinname correct before calling Athena.
             $skin = RequestContext::getMain()->getSkin();
             $skinName = get_class($skin);
             // this may not be set yet (and needs to be before setupUserCss in order for the right CSS$
             if ($skin->getSkinName() == '') {
                 $skin->skinname = strtolower(substr($skinName, 4));
             }
             $adSlots = array('INVISIBLE' => AdEngine::getInstance()->getAd('EXIT_STITIAL_INVISIBLE', array('ghostwriter' => true)), 'BOXAD_1' => AdEngine::getInstance()->getAd('EXIT_STITIAL_BOXAD_1', array('ghostwriter' => true)), 'BOXAD_2' => AdEngine::getInstance()->getAd('EXIT_STITIAL_BOXAD_2', array('ghostwriter' => true)));
             $oTmpl->set_vars(array('adSlots' => $adSlots));
             switch ($this->adLayoutMode) {
                 case 'V1':
                     $adTemplate = 'adLayoutV1';
                     break;
                 case 'V2':
                     $adTemplate = 'adLayoutV2';
                     break;
                 case 'V3':
                     $adTemplate = 'adLayoutV3';
                     break;
                 case 'V4':
                     $adTemplate = 'adLayoutV4';
                     break;
                 case 'V5':
                     $adTemplate = 'adLayoutV5';
                     break;
                 case 'CLASSIC':
                 default:
                     $adTemplate = 'adLayoutClassic';
             }
             $athenaInitStuff = AdProviderAthena::getInstance()->getSetupHtml();
             $adCode = $oTmpl->render($adTemplate);
             $loginMsg = wfMsgExt('outbound-screen-login-text', array('parseinline', 'content'));
             $pageBarMsg = wfMsg('outbound-screen-you-are-leaving');
             $oTmpl->set_vars(array('adCode' => $adCode, 'athenaInitStuff' => $athenaInitStuff, 'loginMsg' => $loginMsg, 'pageBarMsg' => $pageBarMsg, 'pageType' => 'exitPage', 'redirectDelay' => $noAutoRedirect ? 0 : $this->redirectDelay, 'skip' => wfMsg('interstitial-skip-ad'), 'url' => htmlspecialchars_decode($url)));
             // just output content of template
             $wgOut->clearHTML();
             $wgOut->addHTML($oTmpl->render('page'));
         }
     }
 }
 function execute($par)
 {
     global $wgRequest, $wgOut;
     global $wgAdsInterstitialsEnabled;
     global $wgUser;
     $url = trim($wgRequest->getVal('u'));
     $noAutoRedirect = $wgRequest->getText('noredirect') == 1 ? true : false;
     if ($wgAdsInterstitialsEnabled && !$wgUser->isLoggedIn()) {
         $COOKIE_KEY = "IntPgCounter";
         $pageCounter = isset($_COOKIE[$COOKIE_KEY]) ? $_COOKIE[$COOKIE_KEY] : 0;
         // By incrementing the count even for interstitials, we can know when to avoid repeated interstitials for tabbed-browsing.
         // In the calculations for when to display the interstitial, however, this is not considered a "page" (we add 1 to wgAdsInterstitialsPagesBetweenAds to accomplish this).
         global $wgCookiePath, $wgCookieDomain;
         setcookie($COOKIE_KEY, $pageCounter + 1, 0, $wgCookiePath, $wgCookieDomain);
         // If the user shouldn't be seeing an interstitial on this pv, then assume that we are only here because of the user opening many tabs and just redirect to destination right away.
         global $wgAdsInterstitialsPagesBeforeFirstAd;
         global $wgAdsInterstitialsPagesBetweenAds;
         $numToSkip = 2;
         // skip the interstitial and the page it was blocking as candidates
         if ($url != "" && !($wgAdsInterstitialsPagesBeforeFirstAd == $pageCounter - 1 || $pageCounter > $wgAdsInterstitialsPagesBeforeFirstAd && ($pageCounter - $wgAdsInterstitialsPagesBeforeFirstAd - 1) % ($wgAdsInterstitialsPagesBetweenAds + $numToSkip) == 0)) {
             return $this->redirectTo($url);
         }
         $redirectDelay = empty($wgAdsInterstitialsDurationInSeconds) ? INTERSTITIAL_DEFAULT_DURATION_IN_SECONDS : $wgAdsInterstitialsDurationInSeconds;
         // Set up the CSS
         $wgOut->setArticleBodyOnly(true);
         $skin = RequestContext::getMain()->getSkin();
         $skinName = get_class($skin);
         // this may not be set yet (and needs to be before setupUserCss in order for the right CSS file to be included)
         if ($skin->getSkinName() == '') {
             $skin->skinname = substr($skinName, 4);
         }
         if ($skinName == 'SkinMonaco') {
             $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
             $adSlots = array('INVISIBLE' => ' ', 'BOXAD_1' => AdEngine::getInstance()->getAd('SPECIAL_INTERSTITIAL_BOXAD_1'), 'BOXAD_2' => ' ');
             $oTmpl->set_vars(array('adSlots' => $adSlots));
             $adTemplate = 'adLayoutClassic';
             $athenaInitStuff = AdProviderAthena::getInstance()->getSetupHtml();
             $adCode = $oTmpl->render($adTemplate);
             $oTmpl->set_vars(array('adCode' => $adCode, 'athenaInitStuff' => $athenaInitStuff, 'pageType' => 'interstitial', 'redirectDelay' => $noAutoRedirect ? 0 : $this->redirectDelay, 'skip' => wfMsg('interstitial-skip-ad'), 'url' => $url));
             $wgOut->clearHTML();
             $wgOut->addHTML($oTmpl->render('page'));
         } else {
             return $this->redirectTo($url);
         }
     } else {
         if ($url == "") {
             // Nowhere to go.  Display an appropriate explanation (either wgAdsInterstitialsEnabled is false or the user is logged in).
             if ($wgUser->isLoggedIn()) {
                 $wgOut->addWikiText(wfMsg('interstitial-already-logged-in-no-link') . wfMsg('interstitial-link-away'));
             } else {
                 $wgOut->addWikiText(wfMsg('interstitial-disabled-no-link') . wfMsg('interstitial-link-away'));
             }
         } else {
             // Since interstitials aren't enabled or the user is logged in, just redirect to the destination URL immediately.
             return $this->redirectTo($url);
         }
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 public function getProviderFromId($provider_id)
 {
     switch (strtolower($this->providers[$provider_id])) {
         case 'dart':
             return AdProviderDART::getInstance();
         case 'openx':
             return AdProviderOpenX::getInstance();
         case 'google':
             return AdProviderGoogle::getInstance();
         case 'gam':
             return AdProviderGAM::getInstance();
         case 'pubmatic':
             return AdProviderPubMatic::getInstance();
         case 'athena':
             return AdProviderAthena::getInstance();
         case 'contextweb':
             return AdProviderContextWeb::getInstance();
         case 'dartmobile':
             return AdProviderDARTMobile::getInstance();
         case 'liftium':
             return AdProviderLiftium::getInstance();
         case 'addriver':
             return AdProviderAdDriver::getInstance();
         case 'liftdna':
             return AdProviderLiftDNA::getInstance();
         case 'dartgp':
             return AdProviderDARTGP::getInstance();
         case 'adengine2':
             return AdProviderAdEngine2::getInstance();
         case 'gamepro':
             return AdProviderGamePro::getInstance();
         case 'null':
             return new AdProviderNull('Slot disabled in WF', false);
         default:
             return new AdProviderNull('Unrecognized provider id', true);
     }
 }