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


PHP _getAdRenderFunction函数代码示例

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


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

示例1: MAX_adRender

function MAX_adRender(&$aBanner, $zoneId = 0, $source = '', $target = '', $ct0 = '', $withText = false, $charset = '', $logClick = true, $logView = true, $richMedia = true, $loc = '', $referer = '', &$context = array())
{
    $conf = $GLOBALS['_MAX']['CONF'];
    if (empty($target)) {
        $target = !empty($aBanner['target']) ? $aBanner['target'] : '_blank';
    }
    $target = htmlspecialchars($target, ENT_QUOTES);
    $source = htmlspecialchars($source, ENT_QUOTES);
    $aBanner['bannerContent'] = "";
    OX_Delivery_Common_hook('preAdRender', array(&$aBanner, &$zoneId, &$source, &$ct0, &$withText, &$logClick, &$logView, null, &$richMedia, &$loc, &$referer));
    $functionName = _getAdRenderFunction($aBanner, $richMedia);
    $code = OX_Delivery_Common_hook('adRender', array(&$aBanner, &$zoneId, &$source, &$ct0, &$withText, &$logClick, &$logView, null, &$richMedia, &$loc, &$referer), $functionName);
    list($usec, $sec) = explode(' ', microtime());
    $time = (double) $usec + (double) $sec;
    $random = MAX_getRandomNumber();
    global $cookie_random;
    $cookie_random = $random;
    $clickUrl = _adRenderBuildClickUrl($aBanner, $zoneId, $source, $ct0, $logClick, true);
    $urlPrefix = substr(MAX_commonGetDeliveryUrl(), 0, -1);
    $code = str_replace('{clickurl}', $clickUrl, $code);
    if (strpos($code, '{logurl}') !== false) {
        $logUrl = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&');
        $code = str_replace('{logurl}', $logUrl, $code);
    }
    if (strpos($code, '{logurl_enc}') !== false) {
        $logUrl_enc = urlencode(_adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&'));
        $code = str_replace('{logurl_enc}', $logUrl_enc, $code);
    }
    if (strpos($code, '{clickurlparams}')) {
        $maxparams = _adRenderBuildParams($aBanner, $zoneId, $source, urlencode($ct0), $logClick, true);
        $code = str_replace('{clickurlparams}', $maxparams, $code);
    }
    $search = array('{timestamp}', '{random}', '{target}', '{url_prefix}', '{bannerid}', '{zoneid}', '{source}', '{pageurl}', '{width}', '{height}', '{websiteid}', '{campaignid}', '{advertiserid}', '{referer}');
    $locReplace = isset($GLOBALS['loc']) ? $GLOBALS['loc'] : '';
    $websiteid = !empty($aBanner['affiliate_id']) ? $aBanner['affiliate_id'] : '0';
    $replace = array($time, $random, $target, $urlPrefix, $aBanner['ad_id'], $zoneId, $source, urlencode($locReplace), $aBanner['width'], $aBanner['height'], $websiteid, $aBanner['campaign_id'], $aBanner['client_id'], $referer);
    preg_match_all('#{(.*?)(_enc)?}#', $code, $macros);
    for ($i = 0; $i < count($macros[1]); $i++) {
        if (!in_array($macros[0][$i], $search) && isset($_REQUEST[$macros[1][$i]])) {
            $search[] = $macros[0][$i];
            $replace[] = !empty($macros[2][$i]) ? urlencode(stripslashes($_REQUEST[$macros[1][$i]])) : htmlspecialchars(stripslashes($_REQUEST[$macros[1][$i]]), ENT_QUOTES);
        }
    }
    $componentParams = OX_Delivery_Common_hook('addUrlParams', array($aBanner));
    if (!empty($componentParams) && is_array($componentParams)) {
        foreach ($componentParams as $params) {
            if (!empty($params) && is_array($params)) {
                foreach ($params as $key => $value) {
                    $search[] = '{' . $key . '}';
                    $replace[] = urlencode($value);
                }
            }
        }
    }
    $code = str_replace($search, $replace, $code);
    $clickUrl = str_replace($search, $replace, $clickUrl);
    $aBanner['clickUrl'] = $clickUrl;
    if (strpos($code, '{clickurl_enc}') !== false) {
        $code = str_replace('{clickurl_enc}', urlencode($clickUrl), $code);
    }
    $logUrl = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&');
    $logUrl = str_replace($search, $replace, $logUrl);
    $aBanner['logUrl'] = $logUrl;
    $aBanner['aSearch'] = $search;
    $aBanner['aReplace'] = $replace;
    OX_Delivery_Common_hook('postAdRender', array(&$code, $aBanner, &$context));
    return MAX_commonConvertEncoding($code, $charset);
}
开发者ID:hawodi,项目名称:revive-adserver,代码行数:68,代码来源:al.php

示例2: MAX_adRender

function MAX_adRender(&$aBanner, $zoneId = 0, $source = '', $target = '', $ct0 = '', $withText = false, $charset = '', $logClick = true, $logView = true, $richMedia = true, $loc = '', $referer = '', $context = array())
{
    $conf = $GLOBALS['_MAX']['CONF'];
    // Sanitize these user-inputted variables before passing to the _adRenderX calls
    if (empty($target)) {
        $target = !empty($aBanner['target']) ? $aBanner['target'] : '_blank';
    }
    $target = htmlspecialchars($target, ENT_QUOTES);
    $source = htmlspecialchars($source, ENT_QUOTES);
    $aBanner['bannerContent'] = "";
    // Pre adRender hook
    OX_Delivery_Common_hook('preAdRender', array(&$aBanner, &$zoneId, &$source, &$ct0, &$withText, &$logClick, &$logView, null, &$richMedia, &$loc, &$referer));
    $functionName = _getAdRenderFunction($aBanner, $richMedia);
    $code = OX_Delivery_Common_hook('adRender', array(&$aBanner, &$zoneId, &$source, &$ct0, &$withText, &$logClick, &$logView, null, &$richMedia, &$loc, &$referer), $functionName);
    // Transform any code
    // Get a timestamp
    list($usec, $sec) = explode(' ', microtime());
    $time = (double) $usec + (double) $sec;
    // Get a random number
    $random = substr(md5(uniqid($time, true)), 0, 10);
    global $cookie_random;
    // Temporary fix to get doubleclick tracking working (Bug # 88)
    $cookie_random = $random;
    // Get the click URL
    $clickUrl = _adRenderBuildClickUrl($aBanner, $zoneId, $source, $ct0, $logClick, true);
    // Get URL prefix, stripping the traling slash
    $urlPrefix = substr(MAX_commonGetDeliveryUrl(), 0, -1);
    $code = str_replace('{clickurl}', $clickUrl, $code);
    // This step needs to be done separately because {clickurl} can contain {random}...
    if (strpos($code, '{logurl}') !== false) {
        $logUrl = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&');
        $code = str_replace('{logurl}', $logUrl, $code);
        // This step needs to be done separately because {logurl} does contain {random}...
    }
    if (strpos($code, '{logurl_enc}') !== false) {
        $logUrl_enc = urlencode(_adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&'));
        $code = str_replace('{logurl_enc}', $logUrl_enc, $code);
        // This step needs to be done separately because {logurl} does contain {random}...
    }
    if (strpos($code, '{clickurlparams}')) {
        $maxparams = _adRenderBuildParams($aBanner, $zoneId, $source, urlencode($ct0), $logClick, true);
        $code = str_replace('{clickurlparams}', $maxparams, $code);
        // This step needs to be done separately because {clickurlparams} does contain {random}...
    }
    $search = array('{timestamp}', '{random}', '{target}', '{url_prefix}', '{bannerid}', '{zoneid}', '{source}', '{pageurl}', '{width}', '{height}', '{websiteid}', '{campaignid}', '{advertiserid}', '{referer}');
    $locReplace = isset($GLOBALS['loc']) ? $GLOBALS['loc'] : '';
    $websiteid = !empty($aBanner['affiliate_id']) ? $aBanner['affiliate_id'] : '0';
    $replace = array($time, $random, $target, $urlPrefix, $aBanner['ad_id'], $zoneId, $source, urlencode($locReplace), $aBanner['width'], $aBanner['height'], $websiteid, $aBanner['campaign_id'], $aBanner['client_id'], $referer);
    preg_match_all('#{(.*?)(_enc)?}#', $code, $macros);
    for ($i = 0; $i < count($macros[1]); $i++) {
        if (!in_array($macros[0][$i], $search) && isset($_REQUEST[$macros[1][$i]])) {
            $search[] = $macros[0][$i];
            $replace[] = !empty($macros[2][$i]) ? urlencode(stripslashes($_REQUEST[$macros[1][$i]])) : stripslashes($_REQUEST[$macros[1][$i]]);
        }
    }
    // addUrlParams hook for plugins to add key=value pairs to the log/click URLs
    $componentParams = OX_Delivery_Common_hook('addUrlParams', array($aBanner));
    if (!empty($componentParams) && is_array($componentParams)) {
        foreach ($componentParams as $params) {
            if (!empty($params) && is_array($params)) {
                foreach ($params as $key => $value) {
                    $search[] = '{' . $key . '}';
                    $replace[] = urlencode($value);
                }
            }
        }
    }
    $code = str_replace($search, $replace, $code);
    $clickUrl = str_replace($search, $replace, $clickUrl);
    $aBanner['clickUrl'] = $clickUrl;
    $logUrl = _adRenderBuildLogURL($aBanner, $zoneId, $source, $loc, $referer, '&');
    $logUrl = str_replace($search, $replace, $logUrl);
    $aBanner['logUrl'] = $logUrl;
    // Pass over the search / replace patterns
    $aBanner['aSearch'] = $search;
    $aBanner['aReplace'] = $replace;
    // post adRender hook
    OX_Delivery_Common_hook('postAdRender', array(&$code, $aBanner));
    //    return $code;
    return MAX_commonConvertEncoding($code, $charset);
}
开发者ID:villos,项目名称:tree_admin,代码行数:81,代码来源:alocal.php


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