当前位置: 首页>>代码示例>>PHP>>正文


PHP _adRenderBuildFileUrl函数代码示例

本文整理汇总了PHP中_adRenderBuildFileUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP _adRenderBuildFileUrl函数的具体用法?PHP _adRenderBuildFileUrl怎么用?PHP _adRenderBuildFileUrl使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_adRenderBuildFileUrl函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _adRenderFlash

function _adRenderFlash(&$aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $richMedia = true, $loc = '', $referer = '', $context = array())
{
    $conf = $GLOBALS['_MAX']['CONF'];
    $prepend = !empty($aBanner['prepend']) ? $aBanner['prepend'] : '';
    $append = !empty($aBanner['append']) ? $aBanner['append'] : '';
    $width = !empty($aBanner['width']) ? $aBanner['width'] : 0;
    $height = !empty($aBanner['height']) ? $aBanner['height'] : 0;
    $pluginVersion = !empty($aBanner['pluginversion']) ? _adRenderGetRealPluginVersion($aBanner['pluginversion']) : '4';
    $logURL = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&');
    if (!empty($aBanner['alt_filename']) || !empty($aBanner['alt_imageurl'])) {
        $altImageAdCode = _adRenderImage($aBanner, $zoneId, $source, $ct0, false, $logClick, false, true, true, $loc, $referer, $context, false);
        $fallBackLogURL = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&', true);
    } else {
        $alt = !empty($aBanner['alt']) ? htmlspecialchars($aBanner['alt'], ENT_QUOTES) : '';
        $altImageAdCode = "<img src='" . _adRenderBuildImageUrlPrefix() . '/1x1.gif' . "' alt='" . $alt . "' title='" . $alt . "' border='0' />";
        if ($zoneId) {
            $fallBackLogURL = _adRenderBuildLogURL(array('ad_id' => 0, 'placement_id' => 0), $zoneId, $source, $loc, $referer, '&', true);
        } else {
            $fallBackLogURL = false;
        }
    }
    $clickUrl = _adRenderBuildClickUrl($aBanner, $zoneId, $source, $ct0, $logClick);
    if (!empty($clickUrl)) {
        $status = _adRenderBuildStatusCode($aBanner);
        $target = !empty($aBanner['target']) ? $aBanner['target'] : '_blank';
        $swfParams = array('clickTARGET' => $target, 'clickTAG' => $clickUrl);
        $clickTag = "<a href='{$clickUrl}' target='{$target}'{$status}>";
        $clickTagEnd = '</a>';
    } else {
        $swfParams = array();
        $clickTag = '';
        $clickTagEnd = '';
    }
    if (!empty($aBanner['parameters'])) {
        $aAdParams = unserialize($aBanner['parameters']);
        if (isset($aAdParams['swf']) && is_array($aAdParams['swf'])) {
            $swfParams = array();
            $aBannerSwf = $aBanner;
            $aBannerSwf['noClickTag'] = true;
            foreach ($aAdParams['swf'] as $iKey => $aSwf) {
                $aBannerSwf['url'] = $aSwf['link'];
                $swfParams["alink{$iKey}"] = _adRenderBuildClickUrl($aBannerSwf, $zoneId, $source, $ct0, $logClick);
                $swfParams["atar{$iKey}"] = $aSwf['tar'];
            }
        }
    }
    $fileUrl = _adRenderBuildFileUrl($aBanner, false);
    $id = 'rv_swf_{random}';
    $swfId = !empty($aBanner['alt']) ? $aBanner['alt'] : 'Advertisement';
    $swfId = 'id-' . preg_replace('/[a-z0-1]+/', '', strtolower($swfId));
    $code = "\n<div id='{$id}' style='display: inline;'>{$altImageAdCode}</div>\n<script type='text/javascript'><!--/" . "/ <![CDATA[\n    var ox_swf = new FlashObject('{$fileUrl}', '{$swfId}', '{$width}', '{$height}', '{$pluginVersion}');\n";
    foreach ($swfParams as $key => $value) {
        $code .= "    ox_swf.addVariable('{$key}', '" . preg_replace('#%7B(.*?)%7D#', '{$1}', urlencode($value)) . "');\n";
    }
    if (!empty($aBanner['transparent'])) {
        $code .= "    ox_swf.addParam('wmode','transparent');\n";
    } else {
        $code .= "    ox_swf.addParam('wmode','opaque');\n";
    }
    $code .= "    ox_swf.addParam('allowScriptAccess','always');\n";
    if ($logView && $conf['logging']['adImpressions']) {
        $code .= "    ox_swf.write('{$id}', " . json_encode($logURL) . ", " . json_encode($fallBackLogURL) . ");\n";
    } else {
        $code .= "    ox_swf.write('{$id}');\n";
    }
    $code .= "/" . "/ ]]> --></script>";
    if ($fallBackLogURL) {
        $code .= '<noscript>' . _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer, $fallBackLogURL) . '</noscript>';
    }
    $bannerText = $withText && !empty($aBanner['bannertext']) ? "<br />{$clickTag}{$aBanner['bannertext']}{$clickTagEnd}" : '';
    return $prepend . $code . $bannerText . $append;
}
开发者ID:hawodi,项目名称:revive-adserver,代码行数:72,代码来源:al.php

示例2: test_adRenderBuildFileUrl

 /**
  * Test1: external image with no params and not using alt image
  * Test2: local image with no params and not using alt image
  * Test3: local image with no params and using alt image
  * Test4: local image with params and not using alt image
  *
  * build a file URL
  *
  */
 function test_adRenderBuildFileUrl()
 {
     $this->sendMessage('test_adRenderBuildFileUrl');
     // Test1
     $aBanner = array('filename' => 'myfile.jpg', 'alt_filename' => 'myaltfile.jpg', 'imageurl' => 'http://www.somewhere.com/myimageurl.jpg', 'type' => 'url', 'contenttype' => '');
     $useAlt = false;
     $params = '';
     $ret = _adRenderBuildFileUrl($aBanner, $useAlt, $params);
     $this->assertEqual($ret, 'http://www.somewhere.com/myimageurl.jpg');
     // Test2
     $aBanner['type'] = 'web';
     $useAlt = false;
     $params = '';
     $GLOBALS['_MAX']['CONF']['webpath']['images'] = 'www.max.net/www/images';
     $ret = _adRenderBuildFileUrl($aBanner, $useAlt, $params);
     $this->assertEqual($ret, 'http://www.max.net/www/images/myfile.jpg');
     // Test3
     $useAlt = true;
     $params = '';
     $ret = _adRenderBuildFileUrl($aBanner, $useAlt, $params);
     $this->assertEqual($ret, 'http://www.max.net/www/images/myaltfile.jpg');
     // Test4
     $useAlt = false;
     $params = 'a=1&b=2';
     $ret = _adRenderBuildFileUrl($aBanner, $useAlt, $params);
     $this->assertEqual($ret, 'http://www.max.net/www/images/myfile.jpg?a=1&b=2');
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:36,代码来源:adRender.del.test.php

示例3: array

        }
    }
    $aResponse = array('html' => $banner['html'], 'context' => MAX_commonPackContext($banner['context']));
    foreach ($banner['aRow']['aSearch'] as $index => $value) {
        $key = substr($value, 1, strlen($value) - 2);
        $aResponse[$key] = $banner['aRow']['aReplace'][$index];
    }
    // Remove duplicated fields from the aRow
    unset($banner['aRow']['aSearch'], $banner['aRow']['aReplace'], $banner['aRow']['bannerContent']);
    // Add fields from aRow to the response (assuming they don't exist already)
    foreach ($banner['aRow'] as $key => $value) {
        if (!in_array($key, array_keys($aResponse))) {
            $aResponse[$key] = $value;
        }
    }
    $aResponse['creativeUrl'] = _adRenderBuildFileUrl($banner['aRow']);
    $aBanners[] = $aResponse;
}
$outputXml = "<?xml version='1.0' encoding='{$charset}' ?" . ">\n";
if ($useMultipleZones) {
    $outputXml .= "<ads>\n";
    foreach ($aBanners as $aBanner) {
        $outputXml .= "<ad version=\"1.0\">\n";
        buildXmlTree($aBanner, $outputXml);
        $outputXml .= "</ad>\n";
    }
    $outputXml .= "</ads>";
} elseif (count($aBanners) > 0) {
    $outputXml .= "<ad version=\"1.0\">\n";
    buildXmlTree($aBanners[0], $outputXml);
    $outputXml .= "</ad>\n";
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:ax.php

示例4: _adRenderFlash

function _adRenderFlash(&$aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $richMedia = true, $loc = '', $referer = '', $context = array())
{
    $conf = $GLOBALS['_MAX']['CONF'];
    $prepend = !empty($aBanner['prepend']) ? $aBanner['prepend'] : '';
    $append = !empty($aBanner['append']) ? $aBanner['append'] : '';
    $width = !empty($aBanner['width']) ? $aBanner['width'] : 0;
    $height = !empty($aBanner['height']) ? $aBanner['height'] : 0;
    $pluginVersion = !empty($aBanner['pluginversion']) ? $aBanner['pluginversion'] : '4';
    // $imageUrlPrefix = ($_SERVER['SERVER_PORT'] == $conf['openads']['sslPort']) ? $conf['type_web_ssl_url'] : $conf['type_web_url'];
    if (!empty($aBanner['alt_filename']) || !empty($aBanner['alt_imageurl'])) {
        $altImageAdCode = _adRenderImage($aBanner, $zoneId, $source, $ct0, false, $logClick, false, true, true, $loc, $referer, false);
        $fallBackLogURL = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&', true);
    } else {
        $altImageAdCode = "<img src='" . _adRenderBuildImageUrlPrefix() . '/1x1.gif' . "' alt='" . $aBanner['alt'] . "' title='" . $aBanner['alt'] . "' border='0' />";
        $fallBackLogURL = false;
    }
    // Create the anchor tag..
    $clickUrl = _adRenderBuildClickUrl($aBanner, $zoneId, $source, $ct0, $logClick);
    if (!empty($clickUrl)) {
        // There is a link
        $status = _adRenderBuildStatusCode($aBanner);
        $target = !empty($aBanner['target']) ? $aBanner['target'] : '_blank';
        $swfParams = array('clickTARGET' => $target, 'clickTAG' => $clickUrl);
        $clickTag = "<a href='{$clickUrl}' target='{$target}'{$status}>";
        $clickTagEnd = '</a>';
    } else {
        $swfParams = array();
        $clickTag = '';
        $clickTagEnd = '';
    }
    if (!empty($aBanner['parameters'])) {
        $aAdParams = unserialize($aBanner['parameters']);
        if (isset($aAdParams['swf']) && is_array($aAdParams['swf'])) {
            // Converted SWF file, use paramters content
            $swfParams = array();
            $aBannerSwf = $aBanner;
            // Set the flag to let _adRenderBuildClickUrl know that we're not using clickTAG
            $aBannerSwf['noClickTag'] = true;
            foreach ($aAdParams['swf'] as $iKey => $aSwf) {
                $aBannerSwf['url'] = $aSwf['link'];
                $swfParams["alink{$iKey}"] = _adRenderBuildClickUrl($aBannerSwf, $zoneId, $source, $ct0, $logClick);
                $swfParams["atar{$iKey}"] = $aSwf['tar'];
            }
        }
    }
    $fileUrl = _adRenderBuildFileUrl($aBanner, false);
    $rnd = md5(microtime());
    $swfId = !empty($aBanner['alt']) ? $aBanner['alt'] : 'Advertisement';
    $code = "\n<div id='ox_{$rnd}' style='display: inline;'>{$altImageAdCode}</div>\n<script type='text/javascript'><!--/" . "/ <![CDATA[\nvar ox_swf = new FlashObject('{$fileUrl}', '{$swfId}', '{$width}', '{$height}', '{$pluginVersion}');\n";
    foreach ($swfParams as $key => $value) {
        // URL encode the value, but leave any Openads "magic macros" unescaped to allow substitution
        $code .= "    ox_swf.addVariable('{$key}', '" . preg_replace('#%7B(.*?)%7D#', '{$1}', urlencode($value)) . "');\n";
    }
    if (!empty($aBanner['transparent'])) {
        $code .= "\n   ox_swf.addParam('wmode','transparent');";
    }
    $code .= "\nox_swf.addParam('allowScriptAccess','always');\nox_swf.write('ox_{$rnd}');\n";
    if ($logView && $conf['logging']['adImpressions']) {
        // Only render the log beacon if the user has the minumum required flash player version
        $code .= "    if (ox_swf.installedVer.versionIsValid(ox_swf.getAttribute('version'))) { document.write(\"" . _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer) . "\"); }";
        // Otherwise log a fallback impression (if there is a fallback creative configured)
        if ($fallBackLogURL) {
            $code .= ' else { document.write("' . _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer, $fallBackLogURL) . '"); }';
        }
    }
    $code .= "\n/" . "/ ]]> --></script>";
    if ($fallBackLogURL) {
        $code .= '<noscript>' . _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer, $fallBackLogURL) . '</noscript>';
    }
    $bannerText = $withText && !empty($aBanner['bannertext']) ? "<br />{$clickTag}{$aBanner['bannertext']}{$clickTagEnd}" : '';
    return $prepend . $code . $bannerText . $append;
}
开发者ID:villos,项目名称:tree_admin,代码行数:72,代码来源:alocal.php

示例5: foreach

 if (!empty($componentParams) && is_array($componentParams)) {
     foreach ($componentParams as $params) {
         if (!empty($params) && is_array($params)) {
             foreach ($params as $key => $value) {
                 $cookie[$key] = $value;
             }
         }
     }
 }
 if (isset($row['aSearch']) && isset($row['aReplace'])) {
     $cookie[$conf['var']['dest']] = str_replace($row['aSearch'], $row['aReplace'], $row['url']);
 }
 // if there is a fallback defined for this banner, we try and use it
 $creativeURL = '';
 if (!empty($row['contenttype']) && $row['contenttype'] == 'swf') {
     $filenameUseAltIfAvailable = _adRenderBuildFileUrl($row['aRow'], true);
     if (!empty($filenameUseAltIfAvailable)) {
         // this impression is a fallback impression (can be used in the logImpression hook)
         $_REQUEST[$GLOBALS['_MAX']['CONF']['var']['fallBack']] = '1';
         $creativeURL = $filenameUseAltIfAvailable;
     }
 }
 if (empty($creativeURL)) {
     // otherwise this is an Image banner and we serve the banner normally
     $creativeURL = $row['html'];
 }
 // The call to view_raw() above will have tried to log the impression via a beacon,
 // but this type of ad doesn't work with beacons, so the impression must
 // be logged here
 if ($conf['logging']['adImpressions']) {
     MAX_Delivery_log_logAdImpression($row['bannerid'], $zoneid);
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:avw.php


注:本文中的_adRenderBuildFileUrl函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。