You are here

function ad_image_display_ad in Advertisement 5.2

Same name and namespace in other branches
  1. 5 image/ad_image.module \ad_image_display_ad()
  2. 6.3 image/ad_image.module \ad_image_display_ad()
  3. 6 image/ad_image.module \ad_image_display_ad()
  4. 6.2 image/ad_image.module \ad_image_display_ad()
  5. 7 image/ad_image.module \ad_image_display_ad()

Function used to display the selected ad.

1 call to ad_image_display_ad()
ad_image_node_view in image/ad_image.module

File

image/ad_image.module, line 14
Enhances the ad module to support banner ads.

Code

function ad_image_display_ad($ad) {

  // Strip module path from image path if serving images from adserve.php.
  $image_path = preg_replace('&' . drupal_get_path('module', 'ad') . '/&', '', file_create_url($ad->filepath));
  if ($ad->url) {
    $ad_image = "<div class=\"image-advertisement\" id=\"ad-{$ad->aid}\"><a href=\"{$ad->redirect}/@HOSTID___\" title=\"" . htmlentities($ad->tooltip, ENT_QUOTES, 'UTF-8') . '"' . ad_link_attributes() . "><img src=\"{$image_path}\" width=\"{$ad->width}\" height=\"{$ad->height}\" alt=\"" . htmlentities($ad->tooltip, ENT_QUOTES, 'UTF-8') . "\" /></a></div>";
  }
  else {
    $ad_image = "<div class=\"image-advertisement\" id=\"ad-{$ad->aid}\"><img src=\"{$image_path}\" width=\"{$ad->width}\" height=\"{$ad->height}\" alt=\"" . htmlentities($ad->tooltip, ENT_QUOTES, 'UTF-8') . "\" /></div>";
  }
  if (variable_get('ad_filter', 0)) {
    $ad_image = check_markup($ad_image, $ad->format, FALSE);
  }
  return $ad_image;
}