本文整理汇总了PHP中_adRenderImageBeacon函数的典型用法代码示例。如果您正苦于以下问题:PHP _adRenderImageBeacon函数的具体用法?PHP _adRenderImageBeacon怎么用?PHP _adRenderImageBeacon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_adRenderImageBeacon函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Plugin_BannerTypeText_oxMarkedText_oxMarkedTextComponent_delivery_adRender
function Plugin_BannerTypeText_oxMarkedText_oxMarkedTextComponent_delivery_adRender(&$aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $loc, $referer)
{
$conf = $GLOBALS['_MAX']['CONF'];
$pluginConf = $GLOBALS['conf']['oxMarkedText'];
$linkStyle1 = $pluginConf['link1Style'];
$linkStyle2 = $pluginConf['link2Style'];
$prepend = !empty($aBanner['prepend']) ? $aBanner['prepend'] : '';
$append = !empty($aBanner['append']) ? $aBanner['append'] : '';
$aBanner['bannerContent'] = $aBanner['bannertext'];
$find = array('[[', '[', ']]', ']');
$clickUrl = _adRenderBuildClickUrl($aBanner, $zoneId, $source, $ct0, $logClick);
if (!empty($clickUrl)) {
$status = _adRenderBuildStatusCode($aBanner);
$target = !empty($aBanner['target']) ? $aBanner['target'] : '_blank';
$clickTag1 = "<a href='{$clickUrl}' {$linkStyle1} target='{$target}'{$status}>";
$clickTag2 = "<a href='{$clickUrl}' {$linkStyle2} target='{$target}'{$status}>";
$clickTagEnd = '</a>';
} else {
$clickTag1 = '';
$clickTag2 = '';
$clickTagEnd = '';
}
$replace = array($clickTag2, $clickTag1, $clickTagEnd, $clickTagEnd);
$bannerText = str_replace($find, $replace, $aBanner['bannertext']);
$beaconTag = $logView && $conf['logging']['adImpressions'] ? _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer) : '';
return $prepend . $bannerText . $beaconTag . $append;
}
示例2: Plugin_BannerTypeHTML_terraTemplateHtml_terraTemplateHtmlComponent_delivery
/**
*
* @package OpenXPlugin
* @subpackage Plugins_BannerTypes
* @author Monique Szpak <monique.szpak@openx.org>
*
* @param array $aBanner The ad-array for the ad to render code for
* @param int $zoneId The zone ID of the zone used to select this ad (if zone-selected)
* @param string $source The "source" parameter passed into the adcall
* @param string $ct0 The 3rd party click tracking URL to redirect to after logging
* @param int $withText Should "text below banner" be appended to the generated code
* @param bookean $logClick Should this click be logged (clicks in admin should not be logged)
* @param boolean $logView Should this view be logged (views in admin should not be logged
* also - 3rd party callback logging should not be logged at view time)
* @param boolean $useAlt Should the backup file be used for this code
* @param boolean $richMedia Does this invocation method allow for serving 3rd party/html ads
* @param string $loc The "current page" URL
* @param string $referer The "referring page" URL
*
* @return string The HTML to display this ad
*/
function Plugin_BannerTypeHTML_terraTemplateHtml_terraTemplateHtmlComponent_delivery(&$aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $richMedia = true, $loc, $referer)
{
$conf = $GLOBALS['_MAX']['CONF'];
$prepend = !empty($aBanner['prepend']) ? $aBanner['prepend'] : '';
$append = !empty($aBanner['append']) ? $aBanner['append'] : '';
$code = !empty($aBanner['htmlcache']) ? $aBanner['htmlcache'] : '';
$aBanner['bannerContent'] = $aBanner['htmltemplate'];
// Parse PHP code
if ($conf['delivery']['execPhp']) {
if (preg_match("#(\\<\\?php(.*)\\?\\>)#isU", $code, $parser_regs)) {
// Extract PHP script
$parser_php = $parser_regs[2];
$parser_result = '';
// Replace output function
$parser_php = preg_replace("#echo([^;]*);#i", '$parser_result .=\\1;', $parser_php);
$parser_php = preg_replace("#print([^;]*);#i", '$parser_result .=\\1;', $parser_php);
$parser_php = preg_replace("#printf([^;]*);#i", '$parser_result .= sprintf\\1;', $parser_php);
// Split the PHP script into lines
$parser_lines = explode(";", $parser_php);
for ($parser_i = 0; $parser_i < sizeof($parser_lines); $parser_i++) {
if (trim($parser_lines[$parser_i]) != '') {
eval(trim($parser_lines[$parser_i]) . ';');
}
}
// Replace the script with the result
$code = str_replace($parser_regs[1], $parser_result, $code);
}
}
// Get the text below the banner
$bannerText = !empty($aBanner['bannertext']) ? "{$clickTag}{$aBanner['bannertext']}{$clickTagEnd}" : '';
// Get the image beacon...
if (strpos($code, '{logurl}') === false && strpos($code, '{logurl_enc}') === false) {
$beaconTag = $logView && $conf['logging']['adImpressions'] ? _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer) : '';
} else {
$beaconTag = '';
}
return $prepend . $code . $bannerText . $beaconTag . $append;
}
开发者ID:karen-mikaela,项目名称:my-bannerTypeHtml-revive,代码行数:59,代码来源:terraTemplateHtmlComponent.delivery.php
示例3: Plugin_BannerTypeText_delivery_adRender
/**
*
* @package OpenXPlugin
* @subpackage Plugins_BannerTypes
* @abstract
*
* This function generates the code to show a "text" ad
*
* @param array $aBanner The ad-array for the ad to render code for
* @param int $zoneId The zone ID of the zone used to select this ad (if zone-selected)
* @param string $source The "source" parameter passed into the adcall
* @param string $ct0 The 3rd party click tracking URL to redirect to after logging
* @param int $withText Should "text below banner" be appended to the generated code
* @param bookean $logClick Should this click be logged (clicks in admin should not be logged)
* @param boolean $logView Should this view be logged (views in admin should not be logged
* also - 3rd party callback logging should not be logged at view time)
* @param boolean $useAlt Should the backup file be used for this code
* @param boolean $richMedia Does this invocation method allow for serving 3rd party/html ads
* @param string $loc The "current page" URL
* @param string $referer The "referring page" URL
*
* @return string The HTML to display this ad
*/
function Plugin_BannerTypeText_delivery_adRender(&$aBanner, $zoneId = 0, $source = '', $ct0 = '', $withText = false, $logClick = true, $logView = true, $useAlt = false, $richMedia = true, $loc, $referer)
{
$conf = $GLOBALS['_MAX']['CONF'];
$prepend = !empty($aBanner['prepend']) ? $aBanner['prepend'] : '';
$append = !empty($aBanner['append']) ? $aBanner['append'] : '';
$aBanner['bannerContent'] = $aBanner['bannertext'];
// 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';
$clickTag = "<a href='{$clickUrl}' target='{$target}'{$status}>";
$clickTagEnd = '</a>';
} else {
$clickTag = '';
$clickTagEnd = '';
}
// Get the text below the banner
$bannerText = !empty($aBanner['bannertext']) ? "{$clickTag}{$aBanner['bannertext']}{$clickTagEnd}" : '';
// Get the image beacon...
$beaconTag = $logView && $conf['logging']['adImpressions'] ? _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer) : '';
return $prepend . $bannerText . $beaconTag . $append;
}
示例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']) ? _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;
}
示例5: test_adRenderImageBeacon
/**
* @todo more test cases
* referer
* loc
* zoneid
* capping info
*
* render an image beacon
*
*/
function test_adRenderImageBeacon()
{
$this->sendMessage('test_adRenderImageBeacon');
require_once MAX_PATH . '/lib/max/Delivery/common.php';
require_once MAX_PATH . '/lib/max/Delivery/tests/data/test_adRenderImageBeacon.php';
$return = _adRenderImageBeacon($aBanner, $zoneId, $source, $loc, $referer);
// break known structure into array of individual elements
$i = preg_match_all('/' . $aPattern['struct'] . '/U', $return, $aMatch);
$this->assertTrue($i, 'structure');
}
示例6: _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;
}