本文整理汇总了PHP中MAX_commonDeriveSource函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_commonDeriveSource函数的具体用法?PHP MAX_commonDeriveSource怎么用?PHP MAX_commonDeriveSource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAX_commonDeriveSource函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_MAX_commonDeriveSource
/**
* Test1: return urldecoded/decrypted string
* Test2: return urldecoded string
*
* This function takes the "source" value and normalises it
* and encrypts it if necessary
*
* @param string The value from the source parameter
* @return string Encrypted source
*/
function test_MAX_commonDeriveSource()
{
$str = "http://www.somewhere.com/index.php?a=this is a file&b=43589uhhjkh";
// Test1: obfuscate (encrypt) and return
$source = urlencode($str);
$GLOBALS['_MAX']['CONF']['delivery']['obfuscate'] = 1;
$expect = '{obfs:220208208212266277277205205205278209213215223205220223210223278225213215277219214224223204278212220212261227263208220219209292219209292227292222219216223286226263272273271268267207220220218217220}';
$return = MAX_commonDeriveSource($source);
$this->assertEqual($return, $expect);
// Test2: urldecode and return
$source = urlencode($str);
$GLOBALS['_MAX']['CONF']['delivery']['obfuscate'] = 0;
$expect = $str;
$return = MAX_commonDeriveSource($source);
$this->assertEqual($return, $expect);
}
示例2: MAX_commonInitVariables
function MAX_commonInitVariables()
{
MAX_commonRegisterGlobalsArray(array('context', 'source', 'target', 'withText', 'withtext', 'ct0', 'what', 'loc', 'referer', 'zoneid', 'campaignid', 'bannerid', 'clientid', 'charset'));
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
if (isset($withText) && !isset($withtext)) {
$withtext = $withText;
}
$withtext = isset($withtext) && is_numeric($withtext) ? $withtext : 0;
$ct0 = isset($ct0) ? $ct0 : '';
$context = isset($context) ? $context : array();
$target = isset($target) && !empty($target) && !strpos($target, chr(32)) ? $target : '';
$charset = isset($charset) && !empty($charset) && !strpos($charset, chr(32)) ? $charset : 'UTF-8';
$bannerid = isset($bannerid) && is_numeric($bannerid) ? $bannerid : '';
$campaignid = isset($campaignid) && is_numeric($campaignid) ? $campaignid : '';
$clientid = isset($clientid) && is_numeric($clientid) ? $clientid : '';
$zoneid = isset($zoneid) && is_numeric($zoneid) ? $zoneid : '';
if (!isset($what)) {
if (!empty($bannerid)) {
$what = 'bannerid:' . $bannerid;
} elseif (!empty($campaignid)) {
$what = 'campaignid:' . $campaignid;
} elseif (!empty($zoneid)) {
$what = 'zone:' . $zoneid;
} else {
$what = '';
}
} elseif (preg_match('/^([a-z]+):(\\d+)$/', $what, $matches)) {
switch ($matches[1]) {
case 'zoneid':
case 'zone':
$zoneid = $matches[2];
break;
case 'bannerid':
$bannerid = $matches[2];
break;
case 'campaignid':
$campaignid = $matches[2];
break;
case 'clientid':
$clientid = $matches[2];
break;
}
}
if (!isset($clientid)) {
$clientid = '';
}
if (empty($campaignid)) {
$campaignid = $clientid;
}
$source = MAX_commonDeriveSource($source);
if (!empty($loc)) {
$loc = stripslashes($loc);
} elseif (!empty($_SERVER['HTTP_REFERER'])) {
$loc = $_SERVER['HTTP_REFERER'];
} else {
$loc = '';
}
if (!empty($referer)) {
$_SERVER['HTTP_REFERER'] = stripslashes($referer);
} else {
if (isset($_SERVER['HTTP_REFERER'])) {
unset($_SERVER['HTTP_REFERER']);
}
}
$GLOBALS['_MAX']['COOKIE']['LIMITATIONS']['arrCappingCookieNames'] = array($GLOBALS['_MAX']['CONF']['var']['blockAd'], $GLOBALS['_MAX']['CONF']['var']['capAd'], $GLOBALS['_MAX']['CONF']['var']['sessionCapAd'], $GLOBALS['_MAX']['CONF']['var']['blockCampaign'], $GLOBALS['_MAX']['CONF']['var']['capCampaign'], $GLOBALS['_MAX']['CONF']['var']['sessionCapCampaign'], $GLOBALS['_MAX']['CONF']['var']['blockZone'], $GLOBALS['_MAX']['CONF']['var']['capZone'], $GLOBALS['_MAX']['CONF']['var']['sessionCapZone'], $GLOBALS['_MAX']['CONF']['var']['lastClick'], $GLOBALS['_MAX']['CONF']['var']['lastView'], $GLOBALS['_MAX']['CONF']['var']['blockLoggingClick']);
if (strtolower($charset) == 'unicode') {
$charset = 'utf-8';
}
}
示例3: MAX_commonSetNoCacheHeaders
// Require the initialisation file
require_once '../../init-delivery.php';
// Required files
require_once MAX_PATH . '/lib/max/Delivery/adSelect.php';
require_once MAX_PATH . '/lib/max/Delivery/flash.php';
require_once MAX_PATH . '/lib/max/Delivery/javascript.php';
MAX_commonSetNoCacheHeaders();
/*-------------------------------------------------------*/
/* Register input variables */
/*-------------------------------------------------------*/
MAX_commonRegisterGlobalsArray(array('zones', 'source', 'block', 'blockcampaign', 'exclude', 'mmm_fo', 'q', 'nz'));
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
// Derive the source parameter
$source = MAX_commonDeriveSource($source);
$spc_output = 'var ' . $conf['var']['prefix'] . 'output = new Array(); ' . "\n";
if (!empty($zones)) {
$zones = explode('|', $zones);
foreach ($zones as $thisZone) {
if (empty($thisZone)) {
continue;
}
// nz is set when "named zones" are being used, this allows a zone to be selected more than once
if (!empty($nz)) {
list($zonename, $thisZoneid) = explode('=', $thisZone);
$varname = $zonename;
} else {
$thisZoneid = $varname = $thisZone;
}
// Clear deiveryData between iterations