function simpleads_simpleads_ad_impression in SimpleAds 7
Implements hook_simpleads_ad_impression().
File
- ./
simpleads.module, line 511
Code
function simpleads_simpleads_ad_impression($op, $node) {
global $user;
// TRUE means increase/delete impressions using SimpleAds core to control
// clicks, otherwise disable core counter.
$internal = variable_get('simpleads_impressions_internal', TRUE);
if ($op == 'insert' && $internal) {
if (user_access('count ad impressions')) {
if ($user->uid != 1 && !_simpleads_bot_detect()) {
db_insert('simpleads_impressions')
->fields(array(
'nid' => $node->nid,
'timestamp' => REQUEST_TIME,
'ip_address' => ip_address(),
))
->execute();
}
}
}
if ($op == 'delete' && $internal) {
db_delete('simpleads_impressions')
->condition('nid', $node->nid)
->execute();
}
}