function _select_channel_id in Advertisement 6.2
Same name and namespace in other branches
- 6.3 channel/ad_channel.inc \_select_channel_id()
- 7 channel/ad_channel.inc \_select_channel_id()
Randomly select a valid channel id from an array channel ids
Parameters
array, valid array.:
1 call to _select_channel_id()
- ad_channel_cache_filter in channel/
ad_channel.inc - Filter advertisements not in an appropriate channel, from cache.
File
- channel/
ad_channel.inc, line 198 - Ad Channel include file.
Code
function _select_channel_id($choices) {
$selected = 0;
if (is_array($choices)) {
$available = sizeof($choices);
_debug_echo("ad_channel_cache: randomly selecting from {$available} indexes.");
$selected = $available > 1 ? $choices[mt_rand(0, $available - 1)] : $choices[0];
_debug_echo("ad_channel_cache: randomly selected channel {$selected}.");
}
return $selected;
}