/**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('Third Party Comment' => '', 'SSL Backup Comment' => '', 'Comment' => $this->translate("\n  * This tag only shows image banners. There is no width or height in\n  * these banners, so if you want these tags to allocate space for the\n  * ad before it shows, you will need to add this information to the\n  * <img> tag."));
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     $buffer .= $mi->backupImage;
     return $buffer;
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('Cache Buster Comment' => '', 'Third Party Comment' => '', 'SSL Delivery Comment' => '', 'SSL Backup Comment' => '', 'Comment' => '');
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $name = PRODUCT_NAME;
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     // Deal with windows style paths
     $path = MAX_PATH;
     $path = str_replace('\\', '/', $path);
     if (empty($mi->clientid)) {
         $mi->clientid = 0;
     }
     if (empty($mi->zoneid)) {
         $mi->zoneid = 0;
     }
     if (empty($mi->campaignid)) {
         $mi->campaignid = 0;
     }
     if (empty($mi->bannerid)) {
         $mi->bannerid = 0;
     }
     $buffer = "<" . "?php\n  //" . $buffer;
     $buffer .= !empty($mi->comments) ? "  // The MAX_PATH below should point to the base of your {$name} installation\n" : '';
     $buffer .= "  define('MAX_PATH', '" . MAX_PATH . "');\n";
     $buffer .= "  if (@include_once(MAX_PATH . '/www/delivery" . (preg_match('#_dev\\/?$#', $conf['webpath']['delivery']) ? '_dev' : '') . "/{$conf['file']['local']}')) {\n";
     $buffer .= "    if (!isset(\$" . "phpAds_context)) {\n      \$" . "phpAds_context = array();\n    }\n";
     if (!empty($mi->comments)) {
         $buffer .= "    // function view_local(\$what, \$zoneid=0, \$campaignid=0, \$bannerid=0, \$target='', \$source='', \$withtext='', \$context='', \$charset='')\n";
     }
     $buffer .= "    \$" . "phpAds_raw = view_local('{$mi->what}', {$mi->zoneid}, {$mi->campaignid}, {$mi->bannerid}, '{$mi->target}', '{$mi->source}', '{$mi->withtext}', \$phpAds_context, '{$mi->charset}');\n";
     if (isset($mi->block) && $mi->block == '1') {
         $buffer .= "    \$" . "phpAds_context[] = array('!=' => 'bannerid:'.\$" . "phpAds_raw['bannerid']);\n";
     }
     if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') {
         $buffer .= "    \$" . "phpAds_context[] = array('!=' => 'campaignid:'.\$" . "phpAds_raw['campaignid']);\n";
     }
     $buffer .= "  }\n";
     $buffer .= isset($mi->raw) && $mi->raw == '1' ? "  // " . $this->translate("Assign the \$phpAds_raw['html'] variable to your template") . "\n  // " : '  ';
     $buffer .= "echo \$" . "phpAds_raw['html'];\n";
     $buffer .= "?" . ">\n";
     return $buffer;
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('Third Party Comment' => '', 'SSL Delivery Comment' => '', 'Comment' => '');
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     if (!empty($mi->uniqueid) && $mi->extra['delivery'] != MAX_ZoneEmail) {
         $mi->parameters[] = "n=" . $mi->uniqueid;
     }
     $buffer .= "<a href='";
     if (!empty($mi->thirdpartytrack)) {
         $buffer .= $mi->macros['clickurl'];
     }
     $buffer .= MAX_commonConstructDeliveryUrl($conf['file']['click']);
     $mi->clickParams = array();
     // Only need the banner id for direct selection not zone
     if (empty($mi->extra['delivery']) || $mi->extra['delivery'] != MAX_ZoneEmail) {
         //$buffer .= "?bannerid=" . $mi->bannerid;
         $mi->clickParams[] = 'bannerid=' . $mi->bannerid;
     }
     if (isset($mi->zoneid) && $mi->zoneid != '') {
         //$buffer .= "&zoneid=".$mi->zoneid;
         $mi->clickParams[] = 'zoneid=' . $mi->zoneid;
     }
     if (count($mi->clickParams) > 0) {
         $buffer .= '?' . implode('&amp;', $mi->clickParams);
     }
     $buffer .= "'";
     if (isset($mi->target) && $mi->target != '') {
         $buffer .= " target='" . $mi->target . "'";
     } else {
         $buffer .= " target='_blank'";
     }
     $buffer .= "><img src='" . MAX_commonConstructDeliveryUrl($conf['file']['view']);
     // Without cookies, passing in the click URL to view is not possible
     unset($mi->parameters['ct0']);
     if (sizeof($mi->parameters) > 0) {
         $buffer .= "?" . implode("&amp;", $mi->parameters);
     }
     $buffer .= "' border='0' alt='' /></a>\n";
     return $buffer;
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('Cache Buster Comment' => '', 'Third Party Comment' => '', 'SSL Delivery Comment' => '', 'SSL Backup Comment' => '', 'Comment' => '');
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     if (!isset($mi->clientid) || $mi->clientid == '') {
         $mi->clientid = 0;
     }
     if (empty($mi->campaignid)) {
         $mi->campaignid = 0;
     }
     if ($mi->xmlrpcproto) {
         $mi->params = parse_url(MAX_commonConstructSecureDeliveryUrl($conf['file']['xmlrpc']));
     } else {
         $mi->params = parse_url(MAX_commonConstructDeliveryUrl($conf['file']['xmlrpc']));
     }
     if (!$mi->xmlrpctimeout) {
         $mi->timeout = 15;
     } else {
         $mi->timeout = $mi->xmlrpctimeout;
     }
     switch ($mi->hostlanguage) {
         case 'php':
         default:
             if (!isset($mi->what) or $mi->what == "") {
                 // Need to generate the waht variable here
                 if (isset($mi->zoneid) and $mi->zoneid != "") {
                     $mi->what = "zone:" . $mi->zoneid;
                 } elseif (isset($mi->bannerid) and $mi->bannerid != "") {
                     $mi->what = "bannerid:" . $mi->bannerid;
                 }
             }
             if (!isset($mi->campaignid)) {
                 $mi->campaignid = 0;
             }
             $buffer .= "<" . "?php\n /* " . str_replace(array("\n", '/*', '*/'), array('', '', ''), $mi->buffer);
             if (!isset($mi->comments) || $mi->comments == "1") {
                 $buffer .= "\n  *";
                 $buffer .= $this->translate("\n  * As the PHP script below tries to set cookies, it must be called\n  * before any output is sent to the user's browser. Once the script\n  * has finished running, the HTML code needed to display the ad is\n  * stored in the \$adArray array (so that multiple ads can be obtained\n  * by using mulitple tags). Once all ads have been obtained, and all\n  * cookies set, then you can send output to the user's browser, and\n  * print out the contents of \$adArray where appropriate.\n  *\n  * Example code for printing from \$adArray is at the end of the tag -\n  * you will need to remove this before using the tag in production.\n  * Remember to ensure that the PEAR::XML-RPC package is installed\n  * and available to this script, and to copy over the\n  * lib/xmlrpc/php/openads-xmlrpc.inc.php library file. You may need to\n  * alter the 'include_path' value immediately below.\n  */");
                 $buffer .= "\n\n";
             } else {
                 $buffer .= "  */\n";
             }
             $buffer .= '    //ini_set(\'include_path\', \'.:/usr/local/lib\');' . "\n";
             $buffer .= '    require \'openads-xmlrpc.inc.php\';' . "\n\n";
             $buffer .= '    if (!isset($OA_context)) $OA_context = array();' . "\n\n";
             $buffer .= '    $oaXmlRpc = new OA_XmlRpc(\'' . $mi->params['host'] . '\', \'' . $mi->params['path'] . '\'';
             if (isset($mi->params['port'])) {
                 $buffer .= ', ' . $mi->params['port'] . '';
             } else {
                 $buffer .= $mi->xmlrpcproto ? ', 443' : ', 80';
             }
             if ($mi->xmlrpcproto) {
                 $buffer .= ', true';
             } else {
                 $buffer .= ', false';
             }
             $buffer .= ', ' . $mi->timeout . ');' . "\n";
             if (!empty($mi->comments)) {
                 $buffer .= "\n    //view(\$what='', \$campaignid=0, \$target='', \$source='', \$withText=false, \$context=array(), \$charset='')\n";
             }
             $buffer .= "    \$adArray = \$oaXmlRpc->view('{$mi->what}', {$mi->campaignid}, '{$mi->target}', '{$mi->source}', {$mi->withtext}, \$OA_context, '{$mi->charset}');\n";
             if (isset($mi->block) && $mi->block == '1') {
                 $buffer .= '    $OA_context[] = array(\'!=\' => \'bannerid:\'.$adArray[\'bannerid\']);' . "\n";
             }
             if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') {
                 $buffer .= '    $OA_context[] = array(\'!=\' => \'campaignid:\'.$adArray[\'campaignid\']);' . "\n";
             }
             $buffer .= "\n";
             $buffer .= '    echo $adArray[\'html\'];' . "\n";
             $buffer .= "?" . ">\n";
             break;
     }
     return $buffer;
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $conf = $GLOBALS['_MAX']['CONF'];
     $aComments = array('Cache Buster Comment' => $this->translate("\n  * Replace all instances of {random} with\n  * a generated random number (or timestamp).\n  *"), 'Third Party Comment' => $this->translate("\n  * Don't forget to replace the '{clickurl}' text with\n  * the click tracking URL if this ad is to be delivered through a 3rd\n  * party (non-Max) adserver.\n  *"), 'SSL Delivery Comment' => $this->translate("\n  * This tag has been generated for use on a non-SSL page. If this tag\n  * is to be placed on an SSL page, change the\n  *   'http://%s/...'\n  * to\n  *   'https://%s/...'\n  *", array($conf['webpath']['delivery'], $conf['webpath']['deliverySSL'])), 'SSL Backup Comment' => '');
     if (isset($GLOBALS['layerstyle']) && ($GLOBALS['layerstyle'] == 'geocities' || $GLOBALS['layerstyle'] == 'simple')) {
         $aComments['Comment'] = $this->translate("\n  *------------------------------------------------------------*\n  * This interstitial invocation code requires the images from:\n  * /www/images/layerstyles/%s/...\n  * To be accessible via: http(s)://%s/layerstyles/%s/...\n  *------------------------------------------------------------*", array($GLOBALS['layerstyle'], $conf['webpath']['images'], $GLOBALS['layerstyle']));
     } else {
         $aComments['Comment'] = '';
     }
     parent::prepareCommonInvocationData($aComments);
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     if (empty($mi->layerstyle)) {
         $mi->layerstyle = PLUGINS_INVOCATIONS_TAGS_ADLAYER_DEFAULT_LAYERSTYLE;
     }
     $invocation = $this->getInvocationLayer($mi->layerstyle);
     if ($invocation !== false) {
         $buffer .= $invocation->generateLayerCode($this->maxInvocation) . "\n";
         return $buffer;
     } else {
         return false;
     }
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('Third Party Comment' => $this->translate("\n  -- Don't forget to replace the 'Insert_Clicktrack_URL_Here' text with\n  -- the click tracking URL if this ad is to be delivered through a 3rd\n  -- party (non-Max) adserver.\n  --\n  -- Don't forget to replace the 'Insert_Random_Number_Here' text with\n  -- a cache-buster random number each time you deliver the tag through\n  -- a 3rd party (non-Max) adserver.\n  --"), 'Comment' => $this->translate("\n  -- This tag has been generated for use on a non-SSL page. If this tag\n  -- is to be placed on an SSL page, change all instances of\n  --   'http://%s/...'\n  -- to\n  --   'https://%s/...'\n  --", array($conf['webpath']['delivery'], $conf['webpath']['deliverySSL'])));
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     if (isset($mi->popunder) && $mi->popunder == '1') {
         $mi->parameters['popunder'] = "popunder=1";
     }
     if (isset($mi->left) && $mi->left != '' && $mi->left != '-') {
         $mi->parameters['left'] = "left=" . $mi->left;
     }
     if (isset($mi->top) && $mi->top != '' && $mi->top != '-') {
         $mi->parameters['top'] = "top=" . $mi->top;
     }
     if (isset($mi->timeout) && $mi->timeout != '' && $mi->timeout != '-') {
         $mi->parameters['timeout'] = "timeout=" . $mi->timeout;
     }
     if (isset($mi->toolbars) && $mi->toolbars == '1') {
         $mi->parameters['toolbars'] = "toolbars=1";
     }
     if (isset($mi->location) && $mi->location == '1') {
         $mi->parameters['location'] = "location=1";
     }
     if (isset($mi->menubar) && $mi->menubar == '1') {
         $mi->parameters['menubar'] = "menubar=1";
     }
     if (isset($mi->status) && $mi->status == '1') {
         $mi->parameters['status'] = "status=1";
     }
     if (isset($mi->resizable) && $mi->resizable == '1') {
         $mi->parameters['resizable'] = "resizable=1";
     }
     if (isset($mi->scrollbars) && $mi->scrollbars == '1') {
         $mi->parameters['scrollbars'] = "scrollbars=1";
     }
     if (isset($mi->delay_type)) {
         if ($mi->delay_type == 'seconds' && isset($mi->delay) && $mi->delay != '' && $mi->delay != '-') {
             $mi->parameters['delay'] = "delay=" . $mi->delay;
         } elseif ($mi->delay_type == 'exit') {
             $mi->parameters['delay'] = "delay=exit";
         }
     }
     $buffer .= "<script type='text/javascript' src='" . MAX_commonConstructDeliveryUrl($conf['file']['popup']);
     $buffer .= "?n=" . $mi->uniqueid;
     if (sizeof($mi->parameters) > 0) {
         $buffer .= "&" . implode("&", $mi->parameters);
     }
     $buffer .= "'></script>\n";
     return $buffer;
 }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments = array('SSL Delivery Comment' => '', 'Comment' => $this->translate("\n  * This noscript section of this tag only shows image banners. There\n  * is no width or height in these banners, so if you want these tags to\n  * allocate space for the ad before it shows, you will need to add this\n  * information to the <img> tag.\n  *\n  * If you do not want to deal with the intricities of the noscript\n  * section, delete the tag (from <noscript>... to </noscript>). On\n  * average, the noscript tag is called from less than 1% of internet\n  * users."));
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     if (isset($mi->withtext) && $mi->withtext != '0') {
         $mi->parameters['withtext'] = "withtext=1";
     }
     if (isset($mi->block) && $mi->block == '1') {
         $mi->parameters['block'] = "block=1";
     }
     if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') {
         $mi->parameters['blockcampaign'] = "blockcampaign=1";
     }
     if (!empty($mi->campaignid)) {
         $mi->parameters['campaignid'] = "campaignid=" . $mi->campaignid;
     }
     // The cachebuster for JS tags is auto-generated
     unset($mi->parameters['cb']);
     $buffer .= "<script type='text/javascript'><!--//<![CDATA[\n";
     // Support for 3rd party server clicktracking
     if (!empty($mi->thirdpartytrack)) {
         // Don't pass this in as a parameter... it is dealt with seperatly
         unset($mi->parameters['ct0']);
         $buffer .= "   document.MAX_ct0 = unescape('{$mi->macros['clickurl']}');\n\n";
     }
     $buffer .= "   var m3_u = (location.protocol=='https:'?'https:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['js'], true) . "':'http:" . MAX_commonConstructPartialDeliveryUrl($conf['file']['js']) . "');\n";
     $buffer .= "   var m3_r = Math.floor(Math.random()*99999999999);\n";
     $buffer .= "   if (!document.MAX_used) document.MAX_used = ',';\n";
     // Removed the non-XHTML compliant "language='JavaScript'
     $buffer .= "   document.write (\"<scr\"+\"ipt type='text/javascript' src='\"+m3_u);\n";
     if (count($mi->parameters) > 0) {
         $buffer .= "   document.write (\"?" . implode("&amp;", $mi->parameters) . "\");\n";
     }
     $buffer .= "   document.write ('&amp;cb=' + m3_r);\n";
     // Don't pass in exclude unless necessary
     $buffer .= "   if (document.MAX_used != ',') document.write (\"&amp;exclude=\" + document.MAX_used);\n";
     if (empty($mi->charset)) {
         $buffer .= "   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));\n";
     } else {
         $buffer .= "   document.write ('&amp;charset=" . $mi->charset . "');\n";
     }
     $buffer .= "   document.write (\"&amp;loc=\" + escape(window.location));\n";
     $buffer .= "   if (document.referrer) document.write (\"&amp;referer=\" + escape(document.referrer));\n";
     $buffer .= "   if (document.context) document.write (\"&context=\" + escape(document.context));\n";
     // Only pass in the 3rd party click URL if it is required and (probably) a valid URL (i.e. not a macro like '%c')
     if (!empty($mi->thirdpartytrack)) {
         $buffer .= "   if ((typeof(document.MAX_ct0) != 'undefined') && (document.MAX_ct0.substring(0,4) == 'http')) {\n";
         $buffer .= "       document.write (\"&amp;ct0=\" + escape(document.MAX_ct0));\n   }\n";
     }
     // Pass in if the FlashObject - Inline code has already been passed in
     $buffer .= "   if (document.mmm_fo) document.write (\"&amp;mmm_fo=1\");\n";
     $buffer .= "   document.write (\"'><\\/scr\"+\"ipt>\");\n";
     $buffer .= "//]]>--></script>";
     if ($mi->extra['delivery'] != phpAds_ZoneText) {
         $buffer .= "<noscript>{$mi->backupImage}</noscript>\n";
     }
     return $buffer;
 }
    /**
     * Return invocation code for this plugin (codetype)
     *
     * @return string
     */
    function generateInvocationCode()
    {
        $aComments = array('SSL Backup Comment' => "", 'SSL Delivery Comment' => "", 'Comment' => "");
        parent::prepareCommonInvocationData($aComments);
        $conf = $GLOBALS['_MAX']['CONF'];
        $mi =& $this->maxInvocation;
        $buffer = $mi->buffer;
        if (isset($mi->block) && $mi->block == '1') {
            $mi->parameters['block'] = "block=1";
        }
        if (isset($mi->blockcampaign) && $mi->blockcampaign == '1') {
            $mi->parameters['blockcampaign'] = "blockcampaign=1";
        }
        // The cachebuster for async tags isn't needed
        unset($mi->parameters['cb']);
        // Add ID
        $mi->parameters['id'] = 'id=' . md5("{$conf['webpath']['delivery']}*{$conf['webpath']['deliverySSL']}");
        // Remap as tag attributes with data-revive prefix
        $mi->parameters = array_map(function ($v) use($conf) {
            return preg_replace('#^(.*)=(.*)$#', 'data-' . $conf['var']['product'] . '-$1="$2"', $v);
        }, $mi->parameters);
        $buffer .= '<ins ' . join(' ', $mi->parameters) . '></ins>' . PHP_EOL;
        if ($conf['webpath']['delivery'] == $conf['webpath']['deliverySSL']) {
            // Yes, we can use the short version!
            $buffer .= '<script async src="' . MAX_commonConstructPartialDeliveryUrl($conf['file']['asyncjs']) . '"></script>';
        } else {
            // Bummer, we need the longer variant
            $url = array(MAX_commonConstructDeliveryUrl($conf['file']['asyncjs']), MAX_commonConstructSecureDeliveryUrl($conf['file']['asyncjs']));
            $buffer .= <<<EOF
<script>
(function () {
  var d = document, s = d.createElement('script'), p = d.location.protocol,
      i = d.getElementsByTagName('ins'), j = i[i.length-1];
  try {
    s.src = p === 'http:' ? '{$url[0]}' :
      '{$url[1]}';
    s.async = true; j.appendChild(s);
  } catch (e) {}
})();
</script>
EOF;
        }
        return $buffer;
    }
 /**
  * Return invocation code for this plugin (codetype)
  *
  * @return string
  */
 function generateInvocationCode()
 {
     $aComments['Comment'] = $this->translate("\n  * If iFrames are not supported by the viewer's browser, then this\n  * tag only shows image banners. There is no width or height in these\n  * banners, so if you want these tags to allocate space for the ad\n  * before it shows, you will need to add this information to the <img>\n  * tag.");
     parent::prepareCommonInvocationData($aComments);
     $conf = $GLOBALS['_MAX']['CONF'];
     $mi =& $this->maxInvocation;
     $buffer = $mi->buffer;
     $uniqueid = 'a' . substr(md5(uniqid('', 1)), 0, 7);
     if (!isset($mi->iframetracking) || $mi->iframetracking == 1) {
         // Add n as first parameter
         array_unshift($mi->parameters, "{$conf['var']['n']}={$uniqueid}");
     }
     if (isset($mi->refresh) && $mi->refresh != '') {
         if (is_array($mi->parameters)) {
             $mi->parameters = array('refresh' => "refresh=" . $mi->refresh) + $mi->parameters;
         } else {
             $mi->parameters['refresh'] = "refresh=" . $mi->refresh;
         }
     }
     if (isset($mi->resize) && $mi->resize == '1') {
         if (is_array($mi->parameters)) {
             $mi->parameters = array('resize' => "resize=1") + $mi->parameters;
         } else {
             $mi->parameters['resize'] = "resize=1";
         }
     }
     if (empty($mi->frame_width)) {
         $mi->frame_width = $mi->width;
     }
     if (empty($mi->frame_height)) {
         $mi->frame_height = $mi->height;
     }
     $buffer .= "<iframe id='{$uniqueid}' name='{$uniqueid}' src='" . MAX_commonConstructDeliveryUrl($conf['file']['frame']);
     if (sizeof($mi->parameters) > 0) {
         $buffer .= "?" . implode("&amp;", $mi->parameters);
     }
     $buffer .= "' frameborder='0' scrolling='no'";
     if (isset($mi->frame_width) && $mi->frame_width != '' && $mi->frame_width != '-1') {
         $buffer .= " width='" . $mi->frame_width . "'";
     }
     if (isset($mi->frame_height) && $mi->frame_height != '' && $mi->frame_height != '-1') {
         $buffer .= " height='" . $mi->frame_height . "'";
     }
     if (isset($mi->transparent) && $mi->transparent == '1') {
         $buffer .= " allowtransparency='true'";
     }
     $buffer .= ">";
     if (isset($mi->refresh) && $mi->refresh != '') {
         unset($mi->parameters['refresh']);
     }
     if (isset($mi->resize) && $mi->resize == '1') {
         unset($mi->parameters['resize']);
     }
     if (isset($mi->ilayer) && $mi->ilayer == 1 && isset($mi->frame_width) && $mi->frame_width != '' && $mi->frame_width != '-1' && isset($mi->frame_height) && $mi->frame_height != '' && $mi->frame_height != '-1') {
         $buffer .= "<script type='text/javascript'>\n";
         $buffer .= "<!--// <![CDATA[\n";
         $buffer .= "   document.write (\"<nolayer>\");\n";
         $buffer .= "   document.write (\"{$mi->backupImage}\");\n";
         $buffer .= "   document.write (\"</nolayer>\");\n";
         $buffer .= "   document.write (\"<ilayer id='layer" . $uniqueid . "' visibility='hidden' width='" . $mi->frame_width . "' height='" . $mi->frame_height . "'></ilayer>\");\n";
         $buffer .= "// ]]> -->\n";
         $buffer .= "</script>";
         $buffer .= "<noscript>\n  <a href='" . MAX_commonConstructDeliveryUrl($conf['file']['click']);
         $buffer .= "?n=" . $uniqueid;
         $buffer .= "'";
         if (isset($mi->target) && $mi->target != '') {
             $buffer .= " target='{$mi->target}'";
         }
         $buffer .= ">\n  <img src='" . MAX_commonConstructDeliveryUrl($conf['file']['view']);
         if (sizeof($mi->parameters) > 0) {
             $buffer .= "?" . implode("&", $mi->parameters);
         }
         $buffer .= "' border='0' alt='' /></a></noscript>";
     } else {
         $buffer .= $mi->backupImage;
     }
     $buffer .= "</iframe>\n";
     if (isset($mi->target) && $mi->target != '') {
         $mi->parameters['target'] = "target=" . urlencode($mi->target);
     }
     if (isset($mi->ilayer) && $mi->ilayer == 1 && isset($mi->frame_width) && $mi->frame_width != '' && $mi->frame_width != '-1' && isset($mi->frame_height) && $mi->frame_height != '' && $mi->frame_height != '-1') {
         // Do no rewrite target frames
         $mi->parameters['rewrite'] = 'rewrite=0';
         $buffer .= "\n\n";
         $buffer .= "<!-- " . $this->translate("Placement Comment") . " -->\n";
         $buffer .= "<layer src='" . MAX_commonConstructDeliveryUrl($conf['file']['frame']);
         $buffer .= "?n=" . $uniqueid;
         if (sizeof($mi->parameters) > 0) {
             $buffer .= "&" . implode("&", $mi->parameters);
         }
         $buffer .= "' width='" . $mi->frame_width . "' height='" . $mi->frame_height . "' visibility='hidden' onload=\"moveToAbsolute(layer" . $uniqueid . ".pageX,layer" . $uniqueid . ".pageY);clip.width=" . $mi->frame_width . ";clip.height=" . $mi->frame_height . ";visibility='show';\"></layer>";
     }
     if (!isset($mi->iframetracking) || $mi->iframetracking != 0) {
         $buffer .= "<script type='text/javascript' src='" . MAX_commonConstructDeliveryUrl($conf['file']['google']) . "'></script>";
     }
     return $buffer;
 }