function ad_cache_file_validate in Advertisement 5.2
Same name and namespace in other branches
- 6.3 cache/file/ad_cache_file.inc \ad_cache_file_validate()
- 6.2 cache/file/ad_cache_file.inc \ad_cache_file_validate()
- 7 cache/file/ad_cache_file.inc \ad_cache_file_validate()
Validate advertisement ids, filtering those that shouldn't be displayed.
File
- cache/
file/ ad_cache_file.inc, line 115 - A plug in for the ad.module, providing a file cache mechanism for improved performance when displaying ads.
Code
function ad_cache_file_validate($aids, $displayed, $hostid) {
$valid = array();
if (is_array($aids)) {
$cache = ad_cache_file_cache();
foreach ($aids as $aid) {
// Only include aids that are in our cache, others are not valid in our
// context. Also, don't display the same ad twice.
if (isset($cache['ad'][$aid]) && !in_array($aid, $displayed)) {
$valid[] = $aid;
}
}
}
if (adserve_variable('debug')) {
$count = sizeof($valid);
_debug_echo("File cache: found {$count} valid advertisements.");
}
return $valid;
}