本文整理汇总了PHP中OA_Dal_Delivery_getCreative函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_getCreative函数的具体用法?PHP OA_Dal_Delivery_getCreative怎么用?PHP OA_Dal_Delivery_getCreative使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_getCreative函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _testImageServe
function _testImageServe($timeZone)
{
OA_setTimeZone($timeZone);
$fileName = 'tz_test.gif';
$doImages = OA_Dal::factoryDO('images');
$doImages->filename = $fileName;
$doImages->contents = '';
$this->assertTrue(DataGenerator::generateOne($doImages));
$now = time();
$this->assertTrue($timeZone == 'UTC' || date('Z', $now), 'Time zone not correctly set');
// Simulate delivery
OA_setTimeZoneUTC();
$aCreative = OA_Dal_Delivery_getCreative($fileName);
$this->assertTrue($aCreative);
// Serve with no If-Modified-Since header
unset($GLOBALS['_HEADERS']);
unset($_SERVER['HTTP_IF_MODIFIED_SINCE']);
MAX_imageServe($aCreative, $fileName, 'gif');
if ($this->assertEqual(count($GLOBALS['_HEADERS']), 2, 'Mismatching headers with ' . $timeZone)) {
$this->assertPattern('/^Last-Modified: /i', $GLOBALS['_HEADERS'][0]);
$this->assertPattern('/^Content-Type: /i', $GLOBALS['_HEADERS'][1]);
}
// 1-day old If-Modified-Since header
unset($GLOBALS['_HEADERS']);
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = gmdate('D, d M Y H:i:s', $now - 86400) . ' GMT';
MAX_imageServe($aCreative, $fileName, 'gif');
if ($this->assertEqual(count($GLOBALS['_HEADERS']), 2, 'Mismatching headers with ' . $timeZone)) {
$this->assertPattern('/^Last-Modified: /i', $GLOBALS['_HEADERS'][0]);
$this->assertPattern('/^Content-Type: /i', $GLOBALS['_HEADERS'][1]);
}
// 1-day future If-Modified-Since header
unset($GLOBALS['_HEADERS']);
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = gmdate('D, d M Y H:i:s', $now + 86400) . ' GMT';
MAX_imageServe($aCreative, $fileName, 'gif');
if ($this->assertEqual(count($GLOBALS['_HEADERS']), 1, 'Mismatching headers with ' . $timeZone)) {
$this->assertPattern('/^HTTP\\/1.0 304/i', $GLOBALS['_HEADERS'][0]);
}
// 1 minute ago If-Modified-Since header
unset($GLOBALS['_HEADERS']);
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = gmdate('D, d M Y H:i:s', $now - 60) . ' GMT';
MAX_imageServe($aCreative, $fileName, 'gif');
if ($this->assertEqual(count($GLOBALS['_HEADERS']), 2, 'Mismatching headers with ' . $timeZone)) {
$this->assertPattern('/^Last-Modified: /i', $GLOBALS['_HEADERS'][0]);
$this->assertPattern('/^Content-Type: /i', $GLOBALS['_HEADERS'][1]);
}
// 1 minute in future If-Modified-Since header
unset($GLOBALS['_HEADERS']);
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = gmdate('D, d M Y H:i:s', $now + 60) . ' GMT';
MAX_imageServe($aCreative, $fileName, 'gif');
if ($this->assertEqual(count($GLOBALS['_HEADERS']), 1, 'Mismatching headers with ' . $timeZone)) {
$this->assertPattern('/^HTTP\\/1.0 304/i', $GLOBALS['_HEADERS'][0]);
}
}
示例2: MAX_cacheGetCreative
function MAX_cacheGetCreative($filename, $cached = true)
{
$sName = OA_Delivery_Cache_getName(__FUNCTION__, $filename);
if (!$cached || ($aCreative = OA_Delivery_Cache_fetch($sName)) === false) {
MAX_Dal_Delivery_Include();
$aCreative = OA_Dal_Delivery_getCreative($filename);
$aCreative['contents'] = addslashes(serialize($aCreative['contents']));
$aCreative = OA_Delivery_Cache_store_return($sName, $aCreative);
}
$aCreative['contents'] = unserialize(stripslashes($aCreative['contents']));
return $aCreative;
}