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


PHP OA_Dal_Delivery_getCreative函数代码示例

本文整理汇总了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]);
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:53,代码来源:DeliveryDB_Image.dal.test.php

示例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;
}
开发者ID:JackyKit,项目名称:revive-adserver,代码行数:12,代码来源:ti.php


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