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


PHP MAX_cacheGetTracker函数代码示例

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


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

示例3: test_invalidateGetTrackerCache

 /**
  * Method tests invalidateGetTrackerCache method
  */
 function test_invalidateGetTrackerCache()
 {
     $aIds = $this->_createTestData();
     $this->_createTestCacheFiles($aIds);
     $cachedData = MAX_cacheGetTracker($aIds['tracker'][0]);
     // Do some changes in tracker
     $doTracker = OA_Dal::factoryDO('trackers');
     $doTracker->get($aIds['trackers'][0]);
     $doTracker->description = 'new description';
     $doTracker->update();
     // Expect no changes in cache
     $this->assertEqual(MAX_cacheGetTracker($aIds['tracker'][0]), $cachedData);
     $this->oDeliveryCacheCommon->invalidateGetTrackerCache($aIds['trackers'][0]);
     // Now expect changes in cache
     $this->assertNotEqual(MAX_cacheGetTracker($aIds['trackers'][0]), $cachedData);
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:19,代码来源:DeliveryCacheCommon.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_cookieFlush

        }
        $logVars = true;
    }
}
MAX_cookieFlush();
// Write the code for tracking the variable values, and any
// additional appended tracker code
if ($logVars) {
    // The $logVars variable contains the code for tracking
    // the variable values (if required by the tracker), and
    // also the code for appending any additional tracker code
    // IF there was a conversion
    echo "{$variablesScript}";
} else {
    if ($append == true) {
        // As $logVars was empty, this could mean that there are
        // no variable values to track and there is no additional
        // appended code required; but it could also mean that
        // although there is additional appended code required, there
        // was no conversion recorded. As the $append variable
        // is true, double check to see if there is any additional
        // appended tracker code, and if so, send it
        $aTracker = MAX_cacheGetTracker($trackerid);
        if (!empty($aTracker['appendcode'])) {
            $appendScript = MAX_javascriptToHTML($aTracker['appendcode'], "MAX_{$trackerid}_appendcode", true);
            echo $appendScript;
        }
    }
}
// Post tracker render hook
OX_Delivery_Common_hook('postTrackerRender', array(&$aConversion, &$aConversionInfo, &$trackerid, &$inherit));
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:tjs.php


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