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


PHP MAX_cacheGetZoneInfo函数代码示例

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


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

示例1: _adSelectZone

function _adSelectZone($zoneId, $context = array(), $source = '', $richMedia = true)
{
    if ($zoneId === 0) {
        return false;
    }
    global $g_append, $g_prepend;
    while (!in_array($zoneId, $GLOBALS['_MAX']['followedChain'])) {
        $GLOBALS['_MAX']['followedChain'][] = $zoneId;
        $appendedThisZone = false;
        $aZoneInfo = MAX_cacheGetZoneInfo($zoneId);
        if (empty($aZoneInfo)) {
            return false;
        }
        if ($zoneId != 0 && MAX_limitationsIsZoneForbidden($zoneId, $aZoneInfo)) {
            $zoneId = _getNextZone($zoneId, $aZoneInfo);
            continue;
        }
        $aZoneLinkedAdInfos = MAX_cacheGetZoneLinkedAdInfos($zoneId);
        if (is_array($aZoneInfo)) {
            if (isset($aZoneInfo['forceappend']) && $aZoneInfo['forceappend'] == 't') {
                $g_prepend .= $aZoneInfo['prepend'];
                $g_append = $aZoneInfo['append'] . $g_append;
                $appendedThisZone = true;
            }
            $aZoneLinkedAdInfos += $aZoneInfo;
            $aLinkedAd = _adSelectCommon($aZoneLinkedAdInfos, $context, $source, $richMedia);
            if (is_array($aLinkedAd)) {
                $aLinkedAd['zoneid'] = $zoneId;
                $aLinkedAd['bannerid'] = $aLinkedAd['ad_id'];
                $aLinkedAd['storagetype'] = $aLinkedAd['type'];
                $aLinkedAd['campaignid'] = $aLinkedAd['placement_id'];
                $aLinkedAd['zone_companion'] = $aZoneLinkedAdInfos['zone_companion'];
                $aLinkedAd['block_zone'] = @$aZoneInfo['block_zone'];
                $aLinkedAd['cap_zone'] = @$aZoneInfo['cap_zone'];
                $aLinkedAd['session_cap_zone'] = @$aZoneInfo['session_cap_zone'];
                $aLinkedAd['affiliate_id'] = @$aZoneInfo['publisher_id'];
                if (!$appendedThisZone) {
                    $aLinkedAd['append'] .= @$aZoneInfo['append'] . $g_append;
                    $aLinkedAd['prepend'] = $g_prepend . @$aZoneInfo['prepend'] . $aLinkedAd['prepend'];
                } else {
                    $aLinkedAd['append'] .= $g_append;
                    $aLinkedAd['prepend'] = $g_prepend . $aLinkedAd['prepend'];
                }
                return $aLinkedAd;
            }
            $zoneId = _getNextZone($zoneId, $aZoneInfo);
        }
    }
    if (!empty($aZoneInfo['default_banner_image_url'])) {
        return array('default' => true, 'default_banner_image_url' => $aZoneInfo['default_banner_image_url'], 'default_banner_destination_url' => $aZoneInfo['default_banner_destination_url']);
    }
    return false;
}
开发者ID:hawodi,项目名称:revive-adserver,代码行数:53,代码来源:al.php

示例2: MAX_commonSendContentTypeHeader

| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/
// 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/cache.php';
MAX_commonSendContentTypeHeader('text/html');
//Register any script specific input variables
MAX_commonRegisterGlobalsArray(array('timeout'));
$timeout = !empty($timeout) ? $timeout : 0;
if ($zoneid > 0) {
    // Get the zone from cache
    $aZone = MAX_cacheGetZoneInfo($zoneid);
} else {
    // Direct selection, or problem with admin DB
    $aZone = array();
    $aZone['zoneid'] = $zoneid;
    $aZone['append'] = '';
    $aZone['prepend'] = '';
}
// Get the banner from cache
$aBanner = MAX_cacheGetAd($bannerid);
$prepend = !empty($aZone['prepend']) ? $aZone['prepend'] : '';
$html = MAX_adRender($aBanner, $zoneid, $source, $target, $ct0, $withtext);
$append = !empty($aZone['append']) ? $aZone['append'] : '';
$title = !empty($aBanner['alt']) ? $aBanner['alt'] : 'Advertisement';
echo "\n<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>\n<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>\n<head>\n<title>{$title}</title>";
if ($timeout > 0) {
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:ac.php

示例3: test_invalidateZoneCache

 /**
  * Method tests invalidateZoneCache method
  *
  */
 function test_invalidateZoneCache()
 {
     $cachedZoneInfoData = MAX_cacheGetZoneInfo($this->_aIds['zones'][0]);
     $cachedZoneLinkedAdsData = MAX_cacheGetZoneLinkedAds($this->_aIds['zones'][0]);
     $cachedPublisherZonesData = OA_cacheGetPublisherZones($this->_aIds['affiliates'][0]);
     // Change zonename
     $doZone = OA_Dal::factoryDO('zones');
     $doZone->get($this->_aIds['zones']);
     $doZone->zonename = 'new name';
     $doZone->update();
     // Expect no changes in cache
     $this->assertEqual(MAX_cacheGetZoneInfo($this->_aIds['zones'][0]), $cachedZoneInfoData);
     $this->assertEqual(MAX_cacheGetZoneLinkedAds($this->_aIds['zones'][0]), $cachedZoneLinkedAdsData);
     $this->assertEqual(OA_cacheGetPublisherZones($this->_aIds['affiliates'][0]), $cachedPublisherZonesData);
     $this->oDeliveryCacheManager->invalidateZoneCache($this->_aIds['zones'][0]);
     // Now expect changes in cache
     $this->assertNotEqual(MAX_cacheGetZoneInfo($this->_aIds['zones'][0]), $cachedZoneInfoData);
     $this->assertNotEqual(MAX_cacheGetZoneLinkedAds($this->_aIds['zones'][0]), $cachedZoneLinkedAdsData);
     $this->assertNotEqual(OA_cacheGetPublisherZones($this->_aIds['affiliates'][0]), $cachedPublisherZonesData);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:24,代码来源:DeliveryCacheManager.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: test_invalidateGetZoneInfoCache

 /**
  * Method tests invalidateGetZoneInfoCache method
  */
 function test_invalidateGetZoneInfoCache()
 {
     $aIds = $this->_createTestData();
     $this->_createTestCacheFiles($aIds);
     $cachedData = MAX_cacheGetZoneInfo($aIds['zones'][0]);
     // Change zone
     $doZone = OA_Dal::factoryDO('zones');
     $doZone->get($aIds['zones'][0]);
     $doZone->zonename = 'new name';
     $doZone->update();
     // Expect no changes in cache
     $this->assertEqual(MAX_cacheGetZoneInfo($aIds['zones'][0]), $cachedData);
     $this->oDeliveryCacheCommon->invalidateGetZoneInfoCache($aIds['zones'][0]);
     // Now expect changes in cache
     $cachedData2 = MAX_cacheGetZoneInfo($aIds['zones'][0]);
     $this->assertNotEqual($cachedData2, $cachedData);
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:20,代码来源:DeliveryCacheCommon.mol.test.php

示例6: _adSelectZone

/**
 * This function selects an ad selected from a specific zone
 *
 * @param int     $zoneId       The ID of the zone to select an ad from
 * @param array   $context      The context of this ad selection
 *                              - used for companion positioning
 *                              - and excluding banner/campaigns from this ad-call
 * @param string  $source       The "source" parameter passed into the adcall
 * @param boolean $richMedia    Does this invocation method allow for serving 3rd party/html ads
 *
 * @return array|false          Returns an ad-array (see page DocBlock) or false if no ad found
 */
function _adSelectZone($zoneId, $context = array(), $source = '', $richMedia = true)
{
    // ZoneID zero is used for direct selected adRequests only
    if ($zoneId === 0) {
        return false;
    }
    global $g_append, $g_prepend;
    while (!in_array($zoneId, $GLOBALS['_MAX']['followedChain'])) {
        $GLOBALS['_MAX']['followedChain'][] = $zoneId;
        $appendedThisZone = false;
        // first get zone info
        $aZoneInfo = MAX_cacheGetZoneInfo($zoneId);
        if (empty($aZoneInfo)) {
            // the zone does not exist, sorry!
            return false;
        }
        //check zone level limitations
        if ($zoneId != 0 && MAX_limitationsIsZoneForbidden($zoneId, $aZoneInfo)) {
            $zoneId = _getNextZone($zoneId, $aZoneInfo);
            continue;
        }
        // Get all ads which are linked to the zone
        $aZoneLinkedAdInfos = MAX_cacheGetZoneLinkedAdInfos($zoneId);
        if (is_array($aZoneInfo)) {
            if (isset($aZoneInfo['forceappend']) && $aZoneInfo['forceappend'] == 't') {
                $g_prepend .= $aZoneInfo['prepend'];
                $g_append = $aZoneInfo['append'] . $g_append;
                $appendedThisZone = true;
            }
            // merge zone info and banner info
            $aZoneLinkedAdInfos += $aZoneInfo;
            $aLinkedAd = _adSelectCommon($aZoneLinkedAdInfos, $context, $source, $richMedia);
            if (is_array($aLinkedAd)) {
                $aLinkedAd['zoneid'] = $zoneId;
                $aLinkedAd['bannerid'] = $aLinkedAd['ad_id'];
                $aLinkedAd['storagetype'] = $aLinkedAd['type'];
                $aLinkedAd['campaignid'] = $aLinkedAd['placement_id'];
                $aLinkedAd['zone_companion'] = $aZoneLinkedAdInfos['zone_companion'];
                $aLinkedAd['block_zone'] = @$aZoneInfo['block_zone'];
                $aLinkedAd['cap_zone'] = @$aZoneInfo['cap_zone'];
                $aLinkedAd['session_cap_zone'] = @$aZoneInfo['session_cap_zone'];
                $aLinkedAd['affiliate_id'] = @$aZoneInfo['publisher_id'];
                if (!$appendedThisZone) {
                    $aLinkedAd['append'] .= @$aZoneInfo['append'] . $g_append;
                    $aLinkedAd['prepend'] = $g_prepend . @$aZoneInfo['prepend'] . $aLinkedAd['prepend'];
                } else {
                    $aLinkedAd['append'] .= $g_append;
                    $aLinkedAd['prepend'] = $g_prepend . $aLinkedAd['prepend'];
                }
                return $aLinkedAd;
            }
            $zoneId = _getNextZone($zoneId, $aZoneInfo);
        }
    }
    if (!empty($aZoneInfo['default_banner_image_url'])) {
        return array('default' => true, 'default_banner_image_url' => $aZoneInfo['default_banner_image_url'], 'default_banner_destination_url' => $aZoneInfo['default_banner_destination_url']);
    }
    return false;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:71,代码来源:adSelect.php


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