You are here

function ad_cache_file_display_ad in Advertisement 5.2

Same name and namespace in other branches
  1. 6.3 cache/file/ad_cache_file.inc \ad_cache_file_display_ad()
  2. 6.2 cache/file/ad_cache_file.inc \ad_cache_file_display_ad()
  3. 7 cache/file/ad_cache_file.inc \ad_cache_file_display_ad()

Display a given advertisement.

File

cache/file/ad_cache_file.inc, line 137
A plug in for the ad.module, providing a file cache mechanism for improved performance when displaying ads.

Code

function ad_cache_file_display_ad($id) {
  $cache = ad_cache_file_cache();
  $hostid = adserve_variable('hostid') ? adserve_variable('hostid') : 'none';
  if ($hostid != 'none' && !isset($cache['hostid'][$hostid])) {
    _debug_echo("File cache: invalid hostid: '{$hostid}'.");
    $output = 'You do not have permission to display ads.';
  }
  else {
    if (is_array($cache) && is_array($cache['ad']) && is_array($cache['ad'][$id])) {
      return $cache['ad'][$id]['display'];
    }
  }
}