本文整理汇总了PHP中MAX_commonInitVariables函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_commonInitVariables函数的具体用法?PHP MAX_commonInitVariables怎么用?PHP MAX_commonInitVariables使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAX_commonInitVariables函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* This setUp method is being used to install a package which contains (at the moment only one)
* test (Dummy) plugins which are then used by the test scripts to test the extension point integrations.
*
*/
function setUp()
{
//install the package of test (dummy) plugins for testing the extension points
unset($GLOBALS['_MAX']['CONF']['plugins']['openXTests']);
unset($GLOBALS['_MAX']['CONF']['pluginGroupComponents']['Dummy']);
TestEnv::installPluginPackage('openXTests');
MAX_commonInitVariables();
$this->tmpCookie = $_COOKIE;
$_COOKIE = array();
}
示例2: OA_cacheGetPublisherZones
function OA_cacheGetPublisherZones($affiliateid, $cached = true)
{
$sName = OA_Delivery_Cache_getName(__FUNCTION__, $affiliateid);
if (!$cached || ($output = OA_Delivery_Cache_fetch($sName)) === false) {
MAX_Dal_Delivery_Include();
$output = OA_Dal_Delivery_getPublisherZones($affiliateid);
$output = OA_Delivery_Cache_store_return($sName, $output);
}
return $output;
}
OX_Delivery_logMessage('starting delivery script: ' . basename($_SERVER['REQUEST_URI']), 7);
if (!empty($_REQUEST[$conf['var']['trace']])) {
OX_Delivery_logMessage('trace enabled: ' . $_REQUEST[$conf['var']['trace']], 7);
}
MAX_remotehostSetInfo();
MAX_commonInitVariables();
MAX_cookieLoad();
MAX_cookieUnpackCapping();
if (empty($GLOBALS['_OA']['invocationType']) || $GLOBALS['_OA']['invocationType'] != 'xmlrpc') {
OX_Delivery_Common_hook('postInit');
}
function MAX_javascriptToHTML($string, $varName, $output = true, $localScope = true)
{
$jsLines = array();
$search[] = "\\";
$replace[] = "\\\\";
$search[] = "\r";
$replace[] = '';
$search[] = '"';
$replace[] = '\\"';
$search[] = "'";
示例3: test_MAX_commonInitVariables
function test_MAX_commonInitVariables()
{
// Test 1 : common defaults
$GLOBALS['_MAX']['CONF']['delivery']['obfuscate'] = 1;
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
MAX_commonInitVariables();
$this->assertEqual($context, array(), '$context');
$this->assertEqual($source, '{obfs:}', '$source');
// only if conf->obfuscate
$this->assertEqual($target, '', '$target');
$this->assertEqual($withText, '', '$withText');
$this->assertEqual($withtext, '', '$withtext');
$this->assertEqual($withtext, $withText, '$withtext/$withText');
$this->assertEqual($ct0, '', '$ct0');
$this->assertEqual($what, '', '$what');
$this->assertTrue(in_array($loc, array(stripslashes($loc), $_SERVER['HTTP_REFERER'], '')));
$this->assertEqual($referer, null, '$referer');
$this->assertEqual($zoneid, null, '$zoneid');
$this->assertEqual($campaignid, null, '$campaignid');
$this->assertEqual($bannerid, null, '$bannerid');
$GLOBALS['_MAX']['CONF']['delivery']['obfuscate'] = 0;
// Test 2 : non-numeric id fields should be emptied
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$zoneid = '1 and (select * from users)';
$campaignid = '1 and (select * from users)';
$bannerid = '1 and (select * from users)';
$clientid = '1 and (select * from users)';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['zoneid'], '');
$this->assertEqual($GLOBALS['campaignid'], '');
$this->assertEqual($GLOBALS['clientid'], '');
$this->assertEqual($GLOBALS['bannerid'], '');
$this->assertEqual($GLOBALS['what'], '');
// Test 3 : "what" field should get value from id field
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$bannerid = '456';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['what'], 'bannerid:456');
// Test 4 : id fields should get value from "what" field
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$what = 'bannerid:456';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['what'], 'bannerid:456');
$this->assertEqual($GLOBALS['bannerid'], '456');
// Test 5 : bad what field should leave empty what and id field
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$what = 'bannerid:1 and (select * from users)';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['what'], 'bannerid:1 and (select * from users)');
$this->assertEqual($GLOBALS['bannerid'], '');
// Test 6 : target and charset fields should contain no whitespace
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$target = '';
$charset = '';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['target'], '');
$this->assertEqual($GLOBALS['charset'], 'UTF-8');
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$target = 'select * from users';
$charset = 'select * from users';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['target'], '');
$this->assertEqual($GLOBALS['charset'], 'UTF-8');
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$target = '_self';
$charset = 'LATIN-1';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['target'], '_self');
$this->assertEqual($GLOBALS['charset'], 'LATIN-1');
// Test 7 : withtext and withText fields (numeric 0 or 1)
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$withText = 1;
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['withText'], 1);
$this->assertEqual($GLOBALS['withtext'], 1);
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$withtext = 1;
MAX_commonInitVariables();
$this->assertFalse(isset($GLOBALS['withText']));
$this->assertEqual($GLOBALS['withtext'], 1);
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
$withtext = 'select * from users';
MAX_commonInitVariables();
$this->assertEqual($GLOBALS['withtext'], 0);
// Test 8 : URLs...
$this->_unsetMAXGlobals();
global $context, $source, $target, $withText, $withtext, $ct0, $what, $loc, $referer, $zoneid, $campaignid, $bannerid, $clientid, $charset;
//$ct0 = '';
//$loc = '';
//.........这里部分代码省略.........
示例4: test_MAX_cookieFlush
function test_MAX_cookieFlush()
{
$conf =& $GLOBALS['_MAX']['CONF'];
// The cookieFluch function requires variables which are initialised in common.php
MAX_commonInitVariables();
// Test that a very long cookie is truncated to below the 2048 character limit.
$_COOKIE[$conf['var']['blockAd']] = array();
for ($i = 0; $i < 1000; $i++) {
$_COOKIE[$conf['var']['blockAd']][$i] = time();
}
$_COOKIE['_' . $conf['var']['blockAd']][$i++] = time();
MAX_cookieFlush();
$this->assertTrue(strlen($_COOKIE[$conf['var']['blockAd']]) < 2048);
}
示例5: _init_delivery
/**
* execute bits of init_delivery.php that we need
*/
function _init_delivery()
{
// initialises vars, increments capping cookies, sets time
//require '../init-delivery.php';
// Set common delivery parameters in the global scope
MAX_commonInitVariables();
// tweak the time set in MAX_commonInitVariables
$GLOBALS['_MAX']['NOW'] = $this->_getDateTimestamp();
// Unpack the packed capping cookies
MAX_cookieUnpackCapping();
/**
before REAL ad selection and beacon logging starts
cookies will be read and cap val incremented
simulation will not be able to read them
so need to manually manipulate them
discard the _MAX cookies
normally done in UnpackCapping func by *unsetting* the cookie
**/
foreach ($_COOKIE as $k => $v) {
if (substr($k, 0, 1) == '_') {
unset($_COOKIE[$k]);
}
}
// clear the cookie cache
//var_dump($GLOBALS['_MAX']['COOKIE']['CACHE']);
$GLOBALS['_MAX']['COOKIE']['CACHE'] = '';
}