本文整理汇总了PHP中MAX_cacheGetZoneLinkedAdInfos函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_cacheGetZoneLinkedAdInfos函数的具体用法?PHP MAX_cacheGetZoneLinkedAdInfos怎么用?PHP MAX_cacheGetZoneLinkedAdInfos使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MAX_cacheGetZoneLinkedAdInfos函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: _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;
}