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


PHP MAX_cacheGetTrackerVariables函数代码示例

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


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

示例1: MAX_trackerbuildJSVariablesScript

/**
 * This function builds the JavaScript to track variables for a tracker-impression via JavaScript
 *
 * @todo Ask Matteo what the $trackerJsCode is for
 *
 * @param int $trackerid                The ID of the tracker
 * @param array $conversionInfo         An array of the information from the tracker impression
 * @param unknown_type $trackerJsCode   Unknown
 *
 * @return string   The JavaScript to pick up the variables from the page, and pass them in to the
 *                  conversionvars script
 */
function MAX_trackerbuildJSVariablesScript($trackerid, $conversionInfo, $trackerJsCode = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    $buffer = '';
    $url = MAX_commonGetDeliveryUrl($conf['file']['conversionvars']);
    $tracker = MAX_cacheGetTracker($trackerid);
    $variables = MAX_cacheGetTrackerVariables($trackerid);
    $variableQuerystring = '';
    if (empty($trackerJsCode)) {
        $trackerJsCode = md5(uniqid('', true));
    } else {
        // Appended tracker - set method to default
        $tracker['variablemethod'] = 'default';
    }
    if (!empty($variables)) {
        if ($tracker['variablemethod'] == 'dom') {
            $buffer .= "\n    function MAX_extractTextDom(o)\n    {\n        var txt = '';\n\n        if (o.nodeType == 3) {\n            txt = o.data;\n        } else {\n            for (var i = 0; i < o.childNodes.length; i++) {\n                txt += MAX_extractTextDom(o.childNodes[i]);\n            }\n        }\n\n        return txt;\n    }\n\n    function MAX_TrackVarDom(id, v)\n    {\n        if (max_trv[id][v]) { return; }\n        var o = document.getElementById(v);\n        if (o) {\n            max_trv[id][v] = escape(o.tagName == 'INPUT' ? o.value : MAX_extractTextDom(o));\n        }\n    }";
            $funcName = 'MAX_TrackVarDom';
        } elseif ($tracker['variablemethod'] == 'default') {
            $buffer .= "\n    function MAX_TrackVarDefault(id, v)\n    {\n        if (max_trv[id][v]) { return; }\n        if (typeof(window[v]) == undefined) { return; }\n        max_trv[id][v] = window[v];\n    }";
            $funcName = 'MAX_TrackVarDefault';
        } else {
            $buffer .= "\n    function MAX_TrackVarJs(id, v, c)\n    {\n        if (max_trv[id][v]) { return; }\n        if (typeof(window[v]) == undefined) { return; }\n        if (typeof(c) != 'undefined') {\n            eval(c);\n        }\n        max_trv[id][v] = window[v];\n    }";
            $funcName = 'MAX_TrackVarJs';
        }
        $buffer .= "\n    if (!max_trv) { var max_trv = new Array(); }\n    if (!max_trv['{$trackerJsCode}']) { max_trv['{$trackerJsCode}'] = new Array(); }";
        foreach ($variables as $key => $variable) {
            $variableQuerystring .= "&{$variable['name']}=\"+max_trv['{$trackerJsCode}']['{$variable['name']}']+\"";
            if ($tracker['variablemethod'] == 'custom') {
                $buffer .= "\n    {$funcName}('{$trackerJsCode}', '{$variable['name']}', '" . addcslashes($variable['variablecode'], "'") . "');";
            } else {
                $buffer .= "\n    {$funcName}('{$trackerJsCode}', '{$variable['name']}');";
            }
        }
        if (!empty($variableQuerystring)) {
            $buffer .= "\n    document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\");\n    document.write (\"{$url}?trackerid={$trackerid}&server_conv_id={$conversionInfo['server_conv_id']}&server_raw_ip={$conversionInfo['server_raw_ip']}{$variableQuerystring}'\");";
            $buffer .= "\n\tdocument.write (\"><\\/scr\"+\"ipt>\");";
        }
    }
    if (!empty($tracker['appendcode'])) {
        // Add the correct "inherit" parameter if a OpenX trackercode was found
        $tracker['appendcode'] = preg_replace('/("\\?trackerid=\\d+&amp;inherit)=1/', '$1=' . $trackerJsCode, $tracker['appendcode']);
        $jscode = MAX_javascriptToHTML($tracker['appendcode'], "MAX_{$trackerid}_appendcode");
        // Replace template style variables
        $jscode = preg_replace("/\\{m3_trackervariable:(.+?)\\}/", "\"+max_trv['{$trackerJsCode}']['\$1']+\"", $jscode);
        $buffer .= "\n" . preg_replace('/^/m', "\t", $jscode) . "\n";
    }
    if (empty($buffer)) {
        $buffer = "document.write(\"\");";
    }
    return $buffer;
}
开发者ID:villos,项目名称:tree_admin,代码行数:64,代码来源:tracker.php

示例2: isset

<?php

/*
+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
// Require the initialisation file
require_once '../../init-delivery.php';
// Required files
require_once MAX_PATH . '/lib/max/Delivery/cache.php';
// Register input variables
if (!empty($_GET['trackerid'])) {
    $trackerId = $_GET['trackerid'];
    $serverConvId = isset($_GET['server_conv_id']) ? $_GET['server_conv_id'] : null;
    $serverRawIp = isset($_GET['server_raw_ip']) ? $_GET['server_raw_ip'] : null;
    $aVariables = MAX_cacheGetTrackerVariables($trackerId);
    MAX_Delivery_log_logVariableValues($aVariables, $trackerId, $serverConvId, $serverRawIp);
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:23,代码来源:tv.php

示例3: test_invalidateTrackerCache

 /**
  * Method tests invalidateTrackerCache method
  */
 function test_invalidateTrackerCache()
 {
     $cachedTrackerData = MAX_cacheGetTracker($this->_aIds['tracker'][0]);
     $cachedTrackerVariablesData = MAX_cacheGetTrackerVariables($this->_aIds['tracker'][0]);
     // Do some changes in tracker
     $doTracker = OA_Dal::factoryDO('trackers');
     $doTracker->get($this->_aIds['trackers'][0]);
     $doTracker->description = 'new description';
     $doTracker->update();
     // Add new variable to the tracker
     $doVariables = OA_Dal::factoryDO('variables');
     $doVariables->trackerid = $this->_aIds['trackers'][0];
     DataGenerator::generateOne($doVariables);
     // Expect no changes in cache
     $this->assertEqual(MAX_cacheGetTracker($this->_aIds['tracker'][0]), $cachedTrackerData);
     $this->assertEqual(MAX_cacheGetTrackerVariables($this->_aIds['tracker'][0]), $cachedTrackerVariablesData);
     $this->oDeliveryCacheManager->invalidateTrackerCache($this->_aIds['trackers'][0]);
     // Now expect changes in cache
     $this->assertNotEqual(MAX_cacheGetTracker($this->_aIds['trackers'][0]), $cachedTrackerData);
     $this->assertNotEqual(MAX_cacheGetTrackerVariables($this->_aIds['trackers'][0]), $cachedTrackerVariablesData);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:24,代码来源:DeliveryCacheManager.mol.test.php

示例4: _createTestCacheFiles

 /**
  * Creates all possible delivert cache files
  *
  * @param array $aIds array of DB Ids returned by _createTestData
  * @see _createTestData
  */
 function _createTestCacheFiles($aIds)
 {
     // Create cache files not related to DB Objects
     MAX_cacheGetAccountTZs();
     MAX_cacheCheckIfMaintenanceShouldRun();
     MAX_cacheGetGoogleJavaScript();
     // Create cache files for banners and images
     foreach ($aIds['banners'] as $bannerId) {
         MAX_cacheGetAd($bannerId);
     }
     foreach ($aIds['images'] as $filename) {
         MAX_cacheGetCreative($filename);
     }
     // Create cache files for zones
     foreach ($aIds['zones'] as $zoneId) {
         MAX_cacheGetZoneLinkedAds($zoneId);
         MAX_cacheGetZoneInfo($zoneId);
     }
     // Create cache files for websites
     foreach ($aIds['affiliates'] as $affiliateid) {
         OA_cacheGetPublisherZones($affiliateid);
     }
     // Create cache files for trackers
     foreach ($aIds['trackers'] as $trackerid) {
         MAX_cacheGetTracker($trackerid);
         MAX_cacheGetTrackerVariables($trackerid);
     }
     // Create cache files for channels
     foreach ($aIds['channel'] as $channelid) {
         MAX_cacheGetChannelLimitations($channelid);
     }
     // cache files for direct-selection are not created
     // due to problems with invalidating MAX_cacheGetLinkedAds
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:40,代码来源:DeliveryCacheUnitTestCase.php

示例5: MAX_commonSetNoCacheHeaders

require_once MAX_PATH . '/lib/max/Delivery/cache.php';
require_once MAX_PATH . '/lib/max/Delivery/javascript.php';
require_once MAX_PATH . '/lib/max/Delivery/tracker.php';
// No Caching
MAX_commonSetNoCacheHeaders();
//Register any script specific input variables
MAX_commonRegisterGlobalsArray(array('trackerid'));
if (empty($trackerid)) {
    $trackerid = 0;
}
// Log the tracker impression
if ($conf['logging']['trackerImpressions']) {
    $aConversion = MAX_trackerCheckForValidAction($trackerid);
    if (!empty($aConversion)) {
        $aConversionInfo = MAX_Delivery_log_logConversion($trackerid, $aConversion);
        foreach ($aConversionInfo as $pluginId => $aData) {
            $serverConvId = $serverRawIp = null;
            if (isset($aData['server_conv_id'])) {
                $serverConvId = $aData['server_conv_id'];
            }
            if (isset($aData['server_raw_ip'])) {
                $serverRawIp = $aData['server_raw_ip'];
            }
            // Log tracker impression variable values
            MAX_Delivery_log_logVariableValues(MAX_cacheGetTrackerVariables($trackerid), $trackerid, $serverConvId, $serverRawIp, $pluginId);
        }
    }
}
MAX_cookieFlush();
// Send a 1 x 1 gif
MAX_commonDisplay1x1();
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:ti.php

示例6: test_invalidateGetTrackerVariablesCache

 /**
  * Method tests invalidateGetTrackerVariablesCache method
  */
 function test_invalidateGetTrackerVariablesCache()
 {
     $aIds = $this->_createTestData();
     $this->_createTestCacheFiles($aIds);
     $cachedData = MAX_cacheGetTrackerVariables($aIds['tracker'][0]);
     // Add new variable to the tracker
     $doVariables = OA_Dal::factoryDO('variables');
     $doVariables->trackerid = $aIds['trackers'][0];
     DataGenerator::generateOne($doVariables);
     // Expect no changes in cache
     $this->assertEqual(MAX_cacheGetTrackerVariables($aIds['tracker'][0]), $cachedData);
     $this->oDeliveryCacheCommon->invalidateGetTrackerVariablesCache($aIds['trackers'][0]);
     // Now expect changes in cache
     $this->assertNotEqual(MAX_cacheGetTrackerVariables($aIds['trackers'][0]), $cachedData);
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:18,代码来源:DeliveryCacheCommon.mol.test.php


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