public function getAd($slotname, $slot, $params = null)
 {
     $cwtagid = self::getCwtagid($slot);
     if (empty($cwtagid)) {
         $NullAd = new AdProviderNull("cwtagid must be supplied", true);
         return $NullAd->getAd($slotname, $slot);
     }
     $out = "<!-- " . __CLASS__ . " slot: {$slotname} -->";
     $dim = AdEngine::getHeightWidthFromSize($slot['size']);
     $url = "http://tag.contextweb.com/TagPublish/getjs.aspx?action=VIEWAD&cwrun=200&cwadformat=" . $slot['size'] . "&cwpid=" . $this->cwpid . "&cwwidth=" . $dim['width'] . "&cwheight=" . $dim['height'] . "&cwpnet=1&cwtagid=" . urlencode($cwtagid);
     $out .= '<script type="text/javascript" src="' . $url . '"></script>';
     return $out;
 }
Example #2
0
 public static function getInstance()
 {
     if (self::$instance == false) {
         self::$instance = new AdProviderNull('');
     }
     return self::$instance;
 }
Example #3
0
    public function getAd($slotname, $slot, $params = null)
    {
        wfProfileIn(__METHOD__);
        global $wgEnableAdsLazyLoad, $wgAdslotsLazyLoad, $wgEnableOpenXSPC;
        $zoneId = $this->getZoneId($slotname);
        if (empty($zoneId)) {
            $nullAd = new AdProviderNull("Invalid slotname, no zoneid for {$slotname} in " . __CLASS__);
            wfProfileOut(__METHOD__);
            return $nullAd->getAd($slotname, $slot);
        }
        if (!empty(self::$adSlotInLazyLoadGroup[$slotname])) {
            wfProfileOut(__METHOD__);
            return;
        }
        $adtag = '';
        $adtag .= <<<EOT
<script type='text/javascript'>
\twgAfterContentAndJS.push(function() {
EOT;
        $adtag .= $this->getAdUrlScripts(array($slotname), array($zoneId), $params);
        if ($wgEnableOpenXSPC || !empty($wgEnableAdsLazyLoad) && !empty($wgAdslotsLazyLoad[$slotname]) && !empty($this->enable_lazyload)) {
            $functionName = AdEngine::fillElemFunctionPrefix . $slotname;
            $fill_elem_script = $this->getFillElemFunctionDefinition($functionName, array($slotname));
            $adtag .= <<<EOT
\t{$fill_elem_script}
EOT;
            if (empty($wgEnableAdsLazyLoad) || empty($wgAdslotsLazyLoad[$slotname]) || empty($this->enable_lazyload)) {
                // setTimeout makees it much more likely that the OpenX SPC will have completed by the time
                // the call to display the ad is made
                $adtag .= <<<EOT
\tsetTimeout({$functionName}, 1000);
EOT;
            }
        } else {
            $adtag .= <<<EOT
\tdocument.write('<scr'+'ipt type="text/javascript" src="'+base_url_{$slotname}+'"></scr'+'ipt>');
EOT;
        }
        $adtag .= <<<EOT
\t});
</script>
EOT;
        wfProfileOut(__METHOD__);
        return $adtag;
    }
    public function getAd($slotname, $slot, $params = null)
    {
        $kadid = $this->getKadid($slotname);
        if (empty($kadid)) {
            $NullAd = new AdProviderNull("This slotname not available for AdProviderPubMatic", true);
            return $NullAd->getAd($slotname, $slot);
        }
        $dim = AdEngine::getHeightWidthFromSize($slot['size']);
        $out = "<!-- " . __CLASS__ . " slot: {$slotname} -->";
        $out .= '<script type="text/javascript">
			var pubId="' . addslashes($this->pubId) . '";
			var siteId="' . addslashes($this->siteId) . '";
			var kadId="' . addslashes($kadid) . '";
			var kadwidth="' . addslashes($dim['width']) . '";
			var kadheight="' . addslashes($dim['height']) . '";
			var kadtype=1;' . '</script>' . "\n" . '<script type="text/javascript" src="http://ads.pubmatic.com/AdServer/js/showad.js"></script>';
        return $out;
    }