function ad_adnotifyapi in Advertisement 5.2
Same name and namespace in other branches
- 5 ad.module \ad_adnotifyapi()
- 6 ad.module \ad_adnotifyapi()
Implement ad notify api _hook.
File
- ./
ad.module, line 2096 - An advertising system for Drupal powered websites.
Code
function ad_adnotifyapi($op, $arg1 = NULL, $arg2 = NULL) {
switch ($op) {
// Make the following events available for notification.
case 'register':
return array(
'-expired' => t('Email @when before the advertisement will expire.'),
'expired' => t('Email @when after the advertisement is expired.'),
'-active' => t('Email @when before the advertisement will be activated (if scheduled).'),
'active' => t('Email @when after the advertisement is activated.'),
'click' => t('Email @when after the advertisement is clicked.'),
'approved' => t('Email @when after the advertisement is approved.'),
'denied' => t('Email @when after the advertisement is denied.'),
);
break;
case '-expired':
$node = node_load($arg1->aid);
if (isset($node->autoexpire) && $node->autoexpire) {
if (time() + $arg1->delay >= $node->autoexpire && $arg1->sent + $arg1->delay < $node->autoexpire) {
return array(
'-expired' => 1,
);
}
}
break;
case '-active':
$node = node_load($arg1->aid);
if (isset($node->autoactivate) && $node->autoactivate) {
if (time() + $arg1->delay >= $node->autoactivate && $arg1->sent + $arg1->delay < $node->autoactivate) {
return array(
'-active' => 1,
);
}
}
break;
case 'mail_text':
switch ($arg1) {
case 'expired':
return array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" that was being displayed on the %sitename website has expired.\n\n Your advertisement was viewed %global_views times and clicked %global_clicks times since it was activated on %activated_large.\n\n You can view additional statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case '-expired':
return array(
'subject' => t('[%sitename ad] expiration notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" that is being displayed on the %sitename website will expire on %autoexpire_large.\n\n Your advertisement has been viewed %today_views times and clicked %today_clicks times today. It was viewed %yesterday_views times and clicked %yesterday_clicks times yesterday. It has been viewed %global_views times and clicked %global_clicks times since it was activated on %activated_large.\n\n You can view additional statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case 'active':
return array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" is now actively being displayed on the %sitename website.\n\n Your advertisement has been viewed %global_views times and clicked %global_clicks times since it was activated on %activated_large.\n\n You can view additional statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case '-active':
return array(
'subject' => t('[%sitename ad] activation notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" will be actively displayed on the %sitename website on %autoactivate_large.\n\n You can view statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case 'click':
return array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" on the %sitename website has been clicked.\n\n Your advertisement has been viewed %today_views times and clicked %today_clicks times today. It was viewed %yesterday_views times and clicked %yesterday_clicks times yesterday. It has been viewed %global_views times and clicked %global_clicks times since it was activated on %activated_large.\n\n You will receive this %frequency You can view additional statistics about this advertisement or update this notification at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case 'approved':
return array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" on the %sitename website has been approved.\n\n You can view statistics about this advertisement at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
case 'denied':
return array(
'subject' => t('[%sitename ad] %event notification'),
'body' => t("Hello %owner_name,\n\n This is an automatically generated notification to inform you that your advertisement \"%title\" on the %sitename website has been denied and will not be displayed.\n\n You can view statistics about this advertisement at the following url:\n %url\n\nRegards,\n The %sitename Team\n\n-\n%siteurl"),
);
}
break;
}
}