You are here

simpleads.module in SimpleAds 7

Same filename and directory in other branches
  1. 8 simpleads.module
  2. 7.2 simpleads.module

File

simpleads.module
View source
<?php

/**
 * @file
 * SimpleAds module.
 */
include "includes/simpleads.theme.inc";
include "includes/simpleads.helper.inc";
include "includes/simpleads.filter.inc";
include "includes/simpleads.integration.inc";

/**
 * Implements hook_node_info().
 */
function simpleads_node_info() {
  $t = get_t();
  return array(
    'simpleads' => array(
      'title_label' => $t('Advertisement Title'),
      'name' => $t('Simple Ad'),
      'base' => 'simpleads',
      'description' => $t('Advertisement'),
    ),
  );
}

/**
 * Implements hook_form().
 */
function simpleads_form($node, $form_state) {
  return node_content_form($node, $form_state);
}

/**
 * Implements hook_menu().
 */
function simpleads_menu() {
  $items = array();
  $items['simpleads/load/%/%'] = array(
    'title' => 'Display Ads',
    'page callback' => '_simpleads_show_ads',
    'page arguments' => array(
      2,
      3,
    ),
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['admin/content/simpleads/%simpleadsid/stat'] = array(
    'title' => 'Ad Statistics',
    'page callback' => '_simpleads_stat_tab',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      'access ad statistics',
    ),
    'weight' => 15,
    'type' => MENU_LOCAL_TASK,
    'file' => 'simpleads.stat.inc',
  );
  $items['node/%simpleadsid/stat'] = array(
    'title' => 'Ad Statistics',
    'page callback' => '_simpleads_stat_tab',
    'page arguments' => array(
      1,
    ),
    'access callback' => '_simpleads_node_stat_tab',
    'weight' => 15,
    'type' => MENU_LOCAL_TASK,
    'file' => 'simpleads.stat.inc',
  );
  $items['admin/content/simpleads'] = array(
    'title' => 'Ads List',
    'page callback' => '_simpleads_listing',
    'access arguments' => array(
      'access ad statistics',
    ),
    'weight' => 15,
    'type' => MENU_LOCAL_TASK,
    'file' => 'simpleads.stat.inc',
  );
  $items['admin/content/simpleads/create_ad'] = array(
    'title' => 'Create new Ad',
    'page callback' => '_simpleads_new_add',
    'access callback' => '_simpleads_access_callback',
    'weight' => 15,
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/content/simpleads/create_ad_group'] = array(
    'title' => 'Create new Ad Group',
    'page callback' => '_simpleads_new_group_add',
    'access callback' => '_simpleads_access_callback',
    'weight' => 15,
    'type' => MENU_LOCAL_ACTION,
  );
  $items['simpleads/redirect/%'] = array(
    'title' => 'Redirect Ads',
    'page callback' => '_simpleads_redirect',
    'page arguments' => array(
      2,
    ),
    'access arguments' => array(
      'access content',
    ),
    'type' => MENU_CALLBACK,
  );
  $items['simpleads/dashboard/%'] = array(
    'title' => 'SimpleAds Filter',
    'description' => 'Filter Dashboard',
    'page callback' => '_simpleads_filter_dashboard_page',
    'access arguments' => array(
      'administer nodes',
    ),
    'type' => MENU_CALLBACK,
    'page arguments' => array(
      2,
    ),
    'theme callback' => '_simpleads_filter_dashboard_theme',
  );
  return $items;
}

/**
 * Implements hook_admin_paths().
 */
function simpleads_admin_paths() {
  if (variable_get('node_admin_theme')) {
    $paths = array(
      'node/*/stat' => TRUE,
    );
    return $paths;
  }
}

/**
 * Implements hook_permission().
 */
function simpleads_permission() {
  return array(
    'access ad statistics' => array(
      'title' => t('Access ad statistics'),
    ),
    'access ad node' => array(
      'title' => t('Access ad node'),
      'description' => t('Please use this permission to allow editors access ad node'),
    ),
    'count ad impressions' => array(
      'title' => t('Count ad impressions'),
    ),
    'count ad clicks' => array(
      'title' => t('Count ad clicks'),
    ),
  );
}

/**
 * Implements hook_node_access().
 */
function simpleads_node_access($node, $op, $account) {
  if (isset($node->type) && $node->type == 'simpleads' && $op == 'view' && !user_access('access ad node', $account)) {
    return NODE_ACCESS_DENY;
  }
}

/**
 * Implements hook_node_presave().
 */
function simpleads_node_presave($node) {
  if ($node->type == 'simpleads') {
    $start_time = 0;
    $end_time = 0;
    if (isset($node->field_ad_start_date[$node->language]) && !empty($node->field_ad_start_date[$node->language][0]['value'])) {
      $start_time = $node->field_ad_start_date[$node->language][0]['value'];
    }
    if (isset($node->field_ad_end_date[$node->language]) && !empty($node->field_ad_end_date[$node->language][0]['value'])) {
      $end_time = $node->field_ad_end_date[$node->language][0]['value'];
    }
    $start_time = strtotime($start_time);
    $end_time = strtotime($end_time);
    if ($start_time != 0) {
      $node->field_ad_start_date[$node->language][0]['value'] = format_date($start_time, 'custom', 'm/d/Y h:i a');
    }
    if ($end_time != 0) {
      $node->field_ad_end_date[$node->language][0]['value'] = format_date($end_time, 'custom', 'm/d/Y h:i a');
    }
    _simpleads_activate_deactive_ad($node, 'presave');
  }
}

/**
 * Implements hook_node_delete().
 */
function simpleads_node_delete($node) {
  _simpleads_delete_click($node);
  _simpleads_delete_impression($node);
  _simpleads_delete_aggregated($node);
}

/**
 * Implements hook_taxonomy_term_insert().
 */
function simpleads_taxonomy_term_insert($term) {
  if ($term->vocabulary_machine_name == 'ad_groups') {
    $ad_group_name = $term->name;
    $tid = $term->tid;
    $block_delta = $term->vocabulary_machine_name . '_' . $tid;
    $settings = array(
      'ads_limit' => 1,
      'ads_width' => '',
      'ads_height' => '',
      'block_info' => $ad_group_name,
      'block_subject' => t('Advertisement'),
      'block_delta' => $block_delta,
      'ads_page' => '',
      'ads_order' => 0,
    );
    db_insert('simpleads_blocks')
      ->fields(array(
      'tid' => $tid,
      'settings' => serialize($settings),
    ))
      ->execute();
  }
}

/**
 * Implements hook_taxonomy_term_delete().
 */
function simpleads_taxonomy_term_delete($term) {
  db_delete('simpleads_blocks')
    ->condition('tid', $term->tid)
    ->execute();
}

/**
 * Implements hook_block_info().
 */
function simpleads_block_info() {
  $blocks = array();
  $result = db_select('simpleads_blocks', 'sb')
    ->fields('sb')
    ->execute();
  foreach ($result as $block) {
    $data = unserialize($block->settings);
    $blocks[$data['block_delta']] = array(
      'info' => t('Advertisement Block: @name', array(
        '@name' => $data['block_info'],
      )),
      'cache' => DRUPAL_NO_CACHE,
    );
  }
  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function simpleads_block_view($delta = '') {
  $blocks = array();
  $result = db_select('simpleads_blocks', 'sb')
    ->fields('sb')
    ->execute();
  foreach ($result as $block) {
    $data = unserialize($block->settings);
    if ($data['block_delta'] == $delta) {
      $blocks = array(
        'subject' => check_plain($data['block_subject']),
        'content' => theme('simpleads_block', array(
          'tid' => $block->tid,
          'ads_limit' => $data['ads_limit'],
          'ads_page' => $data['ads_page'],
          'ads_width' => $data['ads_width'],
          'ads_height' => $data['ads_height'],
        )),
      );
    }
  }
  return $blocks;
}

/**
 * Implements hook_block_configure().
 */
function simpleads_block_configure($delta = '') {
  $form = array();
  $max_ads = variable_get('simpleads_max_ads_per_block', 25);
  $options = array();
  for ($i = 1; $i <= $max_ads; $i++) {
    $options[$i] = $i;
  }
  $result = db_select('simpleads_blocks', 'sb')
    ->fields('sb')
    ->execute();
  foreach ($result as $block) {
    $data = unserialize($block->settings);
    if ($data['block_delta'] == $delta) {
      $form['ads_limit'] = array(
        '#type' => 'select',
        '#title' => t('Number of ads to display'),
        '#default_value' => $data['ads_limit'],
        '#options' => $options,
      );
      $form['ads_page'] = array(
        '#type' => 'textfield',
        '#title' => t('Advertise page'),
        '#default_value' => check_plain($data['ads_page']),
      );
      $form['ads_width'] = array(
        '#type' => 'textfield',
        '#title' => t('Ad width'),
        '#default_value' => check_plain($data['ads_width']),
      );
      $form['ads_height'] = array(
        '#type' => 'textfield',
        '#title' => t('Ad height'),
        '#default_value' => check_plain($data['ads_height']),
      );
      $order_options = array();
      $order_options_all = module_invoke_all('simpleads_order_info');
      if (count($order_options_all) > 0) {
        foreach ($order_options_all as $delta => $name) {
          $order_options[$delta] = check_plain($name);
        }
      }
      $form['ads_order'] = array(
        '#type' => 'select',
        '#title' => t('Ads order'),
        '#default_value' => isset($data['ads_order']) ? $data['ads_order'] : 'random',
        '#options' => $order_options,
      );
      $effects = _simpleads_rotation_effects();
      $form['ads_rotation_type'] = array(
        '#type' => 'select',
        '#title' => t('Ads auto rotation type'),
        '#default_value' => isset($data['ads_rotation_type']) ? $data['ads_rotation_type'] : 0,
        '#options' => $effects,
        '#prefix' => '<div id="ads_rotation_settings">',
      );
      $form['ads_rotation_delay'] = array(
        '#type' => 'textfield',
        '#title' => t('Ad rotation delay'),
        '#default_value' => isset($data['ads_rotation_delay']) ? check_plain($data['ads_rotation_delay']) : 10,
        '#description' => t('Delay value is in seconds'),
        '#suffix' => '</div>',
      );
    }
  }
  return $form;
}

/**
 * Implements hook_block_save().
 */
function simpleads_block_save($delta = '', $edit = array()) {
  $blocks = db_select('simpleads_blocks', 'sb')
    ->fields('sb')
    ->execute();
  foreach ($blocks as $block) {
    $data = unserialize($block->settings);
    if ($data['block_delta'] == $delta) {
      $data['ads_limit'] = $edit['ads_limit'];
      $data['ads_page'] = $edit['ads_page'];
      $data['ads_width'] = $edit['ads_width'];
      $data['ads_height'] = $edit['ads_height'];
      $data['ads_order'] = $edit['ads_order'];
      $data['ads_rotation_type'] = $edit['ads_rotation_type'];
      $data['ads_rotation_delay'] = $edit['ads_rotation_delay'];
      db_update('simpleads_blocks')
        ->fields(array(
        'settings' => serialize($data),
      ))
        ->condition('tid', $block->tid)
        ->execute();
    }
  }
}

/**
 * Menu access callback.
 */
function _simpleads_access_callback() {
  global $user;
  if (user_access('access ad node') || user_access('administer nodes') && user_access('bypass node access')) {
    return TRUE;
  }
}

/**
 * Menu callback.
 * Callback for AJAX call.
 *
 * @param int $tid
 *   Term ID (Ad group ID)
 *
 * @param int $limit
 *   Number of Ads to retreive.
 *
 * @return string
 *   rendered HTML template.
 */
function _simpleads_show_ads($tid, $limit) {
  drupal_page_is_cacheable(FALSE);
  if (is_numeric($tid)) {
    $nodes = _simpleads_load_ads($tid, $limit);
    print _simpleads_render_ajax_template($nodes, $tid, $limit);
  }
  exit;
}

/**
 * Menu callback.
 * Redirect Ads.
 * If user is Admin -> redirect to Ad edit page, otherwise redirect to target URL.
 */
function _simpleads_redirect($nid) {
  global $user;
  drupal_page_is_cacheable(FALSE);
  if (is_numeric($nid)) {
    $node = node_load($nid);
    $url = "";
    $default_message = t("You have been redirected here because you have permission to edit ads.\n      Please log out from the site or open the site in different browser if you wish to test that the ad redirection is correct.");
    $message = variable_get('simpleads_redirect_message', $default_message);
    $show_message = variable_get('simpleads_redirect_message_show', TRUE);
    $delta = variable_get('simpleads_redirect_delta', 'default');
    if (isset($node->field_ad_url[$node->language]) && !empty($node->field_ad_url[$node->language][0]['value'])) {
      $url = $node->field_ad_url[$node->language][0]['value'];
      if (user_access('administer nodes') || user_access('access ad node')) {
        if ($show_message) {
          drupal_set_message(filter_xss($message), 'warning');
        }
        drupal_goto('node/' . $node->nid);
      }
      else {
        _simpleads_save_click($node);
        $url = _simpleads_validate_url($url);
        module_invoke_all('simpleads_redirect', $url, $delta);
      }
    }
    else {
      return t('URL Address is not specified');
    }
  }
  return ' ';
}

/**
 * Menu callback.
 * Redirect to SimpleAds node creation page.
 */
function _simpleads_new_add() {
  drupal_goto('node/add/simpleads', array(
    'query' => array(
      'destination' => 'admin/content/simpleads',
    ),
  ));
}

/**
 * Menu callback.
 * Redirect to add new Ad Group taxonomy term page.
 */
function _simpleads_new_group_add() {
  drupal_goto('admin/structure/taxonomy/ad_groups/add', array(
    'query' => array(
      'destination' => 'admin/content/simpleads',
    ),
  ));
}

/**
 * Implements hook_simpleads_redirect().
 */
function simpleads_simpleads_redirect($url, $delta) {
  if ($delta == 'default') {
    header("Location: " . $url, TRUE, 301);
  }
}

/**
 * Implements hook_form_alter().
 */
function simpleads_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'simpleads_node_form') {

    // Hide fields. See simpleads.helper.inc file
    $fields_to_hide = variable_get('simpleads_form_alter', array());
    if (count($fields_to_hide)) {
      foreach ($fields_to_hide as $field) {
        unset($form[$field]);
      }
    }
  }
}

/**
 * Implements hook_simpleads_ad_click().
 */
function simpleads_simpleads_ad_click($op, $node) {

  // TRUE means increase/delete impressions using SimpleAds core to control
  // impressions, otherwise disable core counter.
  $internal = variable_get('simpleads_clicks_internal', TRUE);
  if ($op == 'insert' && $internal) {
    if (user_access('count ad clicks') && !_simpleads_bot_detect()) {
      db_insert('simpleads_clicks')
        ->fields(array(
        'nid' => $node->nid,
        'timestamp' => REQUEST_TIME,
        'ip_address' => ip_address(),
      ))
        ->execute();
    }
  }
  if ($op == 'delete' && $internal) {
    db_delete('simpleads_clicks')
      ->condition('nid', $node->nid)
      ->execute();
  }
}

/**
 * Implements hook_simpleads_ad_impression().
 */
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();
  }
}

/**
 * Implements hook_simpleads_stats_info().
 */
function simpleads_simpleads_stats_info($node, $op) {
  $activity = t('Active');
  if (isset($node->field_ad_status[$node->language])) {
    if ($node->field_ad_status[$node->language][0]['value'] == 1) {
      $activity = t('Active');
    }
    else {
      $activity = t('Inactive');
    }
  }
  if ($op == 'list') {
    $ad_title = l($node->title, 'admin/content/simpleads/' . $node->nid . '/stat', array(
      'html' => FALSE,
    ));
    return array(
      $ad_title,
    );
  }
  if ($op == 'ad_group') {
    $term_name = "";
    if (isset($node->field_ad_category[$node->language]) && !empty($node->field_ad_category[$node->language][0]['tid'])) {
      $term = taxonomy_term_load($node->field_ad_category[$node->language][0]['tid']);
      $term_name = $term->name;
    }
    elseif (isset($node->field_ad_category[LANGUAGE_NONE]) && !empty($node->field_ad_category[LANGUAGE_NONE][0]['tid'])) {
      $term = taxonomy_term_load($node->field_ad_category[LANGUAGE_NONE][0]['tid']);
      $term_name = $term->name;
    }
    $ad_group = !empty($term_name) ? $term_name : '';
    return array(
      $ad_group,
    );
  }
  if ($op == 'ad_status') {
    return array(
      _simpleads_statuses($node),
    );
  }
  if ($op == 'ad_activity') {
    return array(
      $activity,
    );
  }
  if ($op == 'ad_status_detail') {
    $days_left_str = "";
    $days_left = _simpleads_date_diff($node);
    if ($days_left && $days_left > 0) {
      $days_left_str = ', ' . format_plural($days_left, '1 day left.', '@count days left.');
    }

    // Domain module information (if available).
    $domain_module = "";
    if (module_exists('domain')) {
      if (isset($node->subdomains) && count($node->subdomains)) {
        $domain_module = t('Published on !list', array(
          '!list' => join(", ", $node->subdomains),
        ));
      }
    }
    return array(
      _simpleads_statuses($node) . ' (' . $activity . ')' . $days_left_str,
      $domain_module,
    );
  }
  if ($op == 'ad_operations') {
    $operations = array();
    $operations[] = l(t('Statistics'), 'admin/content/simpleads/' . $node->nid . '/stat') . ' &nbsp;&nbsp; ' . l(t('Edit'), 'node/' . $node->nid . '/edit', array(
      'query' => array(
        'destination' => 'admin/content/simpleads',
      ),
    )) . ' &nbsp;&nbsp; ' . l(t('Delete'), 'node/' . $node->nid . '/delete', array(
      'query' => array(
        'destination' => 'admin/content/simpleads',
      ),
    ));
    return $operations;
  }
}

/**
 * Implements hook_simpleads_order_info().
 */
function simpleads_simpleads_order_info() {
  $delta = array();
  $delta['random'] = t('Random');
  $delta['order_created_desc'] = t('Order by created date DESC');
  $delta['order_modified_desc'] = t('Order by modifed date DESC');
  $delta['order_title_asc'] = t('Order by node title ASC');

  // Nodequeue module integration
  if (module_exists('nodequeue')) {
    $qids = nodequeue_get_qids('simpleads');
    foreach ($qids as $row) {
      $nq = db_select('nodequeue_queue', 'nq')
        ->fields('nq', array(
        'qid',
        'name',
        'title',
      ))
        ->condition('nq.qid', $row->qid)
        ->execute()
        ->fetchObject();
      $delta['nqueue_' . $nq->qid] = t('Nodequeue: @name', array(
        '@name' => $nq->title,
      ));
    }
  }
  return $delta;
}

/**
 * Implements hook_simpleads_order().
 */
function simpleads_simpleads_order($delta, $term_ids, $limit) {
  $query = db_select('node', 'n');
  $query
    ->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
  $query
    ->join('field_data_field_ad_status', 'f', 'n.nid = f.entity_id');
  $query
    ->fields('n', array(
    'nid',
  ));
  $query
    ->condition('n.type', 'simpleads');
  $query
    ->condition('f.entity_type', 'node');
  $query
    ->condition('f.field_ad_status_value', 1);
  $query
    ->condition('ti.tid', $term_ids, 'IN');
  $query
    ->condition('n.status', 1);
  $query
    ->range(0, $limit);
  $query
    ->addTag('node_access');

  // Random order.
  if ($delta == 'random') {
    $query
      ->orderRandom();
    return $query
      ->execute();
  }

  // Order by created date.
  if ($delta == 'order_created_desc') {
    $query
      ->orderBy('n.created', 'DESC');
    return $query
      ->execute();
  }

  // Order by modified date.
  if ($delta == 'order_modified_desc') {
    $query
      ->orderBy('n.changed', 'DESC');
    return $query
      ->execute();
  }

  // Order by title
  if ($delta == 'order_title_asc') {
    $query
      ->orderBy('n.title', 'ASC');
    return $query
      ->execute();
  }

  // Nodequeue module integration
  if (module_exists('nodequeue')) {
    $qids = nodequeue_get_qids('simpleads');
    foreach ($qids as $row) {
      if ($delta == 'nqueue_' . $row->qid) {
        $query = db_select('nodequeue_nodes', 'nn');
        $query
          ->fields('nn', array(
          'nid',
        ));
        $query
          ->condition('nn.qid', $row->qid);
        $query
          ->orderBy('nn.position', 'DESC');
        $query
          ->addTag('node_access');
        return $query
          ->execute();
      }
    }
  }
}

/**
 * Implements hook_cron().
 */
function simpleads_cron() {
  $ads = db_select('node', 'n')
    ->fields('n')
    ->condition('n.type', 'simpleads')
    ->execute();
  foreach ($ads as $ad) {
    $node = node_load($ad->nid);
    _simpleads_activate_deactive_ad($node);
  }
  $timestamp = variable_get('simpleads_last_aggregation_time', 0);
  if (date('m-d-Y', $timestamp) != date('m-d-Y', REQUEST_TIME)) {
    $result = db_query("SELECT\n        FROM_UNIXTIME(s.timestamp, '%Y%m%d') AS date,\n        s.nid, COUNT(*) AS all_count,\n        COUNT(DISTINCT s.ip_address) AS unique_count\n      FROM {simpleads_impressions} s\n      WHERE FROM_UNIXTIME(s.timestamp, '%Y%m%d') != FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y%m%d')\n      GROUP BY date, s.nid");
    $nids = array();
    foreach ($result as $row) {
      db_merge('simpleads_stats')
        ->key(array(
        'nid' => $row->nid,
        'date' => $row->date,
      ))
        ->fields(array(
        'nid' => $row->nid,
        'date' => $row->date,
        'clicks' => 0,
        'clicks_unique' => 0,
        'impressions' => $row->all_count,
        'impressions_unique' => $row->unique_count,
      ))
        ->execute();
      if (!in_array($row->nid, $nids)) {
        $nids[] = $row->nid;
      }
    }
    $result = db_query("SELECT\n        FROM_UNIXTIME(s.timestamp, '%Y%m%d') as date,\n        s.nid,\n        COUNT(*) as all_count,\n        COUNT(DISTINCT s.ip_address) as unique_count\n      FROM {simpleads_clicks} s\n      WHERE FROM_UNIXTIME(s.timestamp, '%Y%m%d') != FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y%m%d')\n      GROUP BY date, s.nid");
    foreach ($result as $row) {
      db_update('simpleads_stats')
        ->fields(array(
        'clicks' => $row->all_count,
        'clicks_unique' => $row->unique_count,
      ))
        ->condition('date', $row->date)
        ->condition('nid', $row->nid)
        ->execute();
      if (!in_array($row->nid, $nids)) {
        $nids[] = $row->nid;
      }
    }
    if (count($nids)) {
      db_query("DELETE FROM {simpleads_impressions}\n        WHERE nid IN (" . join(', ', $nids) . ")\n          AND FROM_UNIXTIME(timestamp, '%Y%m%d') != FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y%m%d')");
      db_query("DELETE FROM {simpleads_clicks}\n        WHERE nid IN (" . join(', ', $nids) . ")\n          AND FROM_UNIXTIME(timestamp, '%Y%m%d') != FROM_UNIXTIME(UNIX_TIMESTAMP(), '%Y%m%d')");
    }
    variable_set('simpleads_last_aggregation_time', REQUEST_TIME);
  }
}

Functions

Namesort descending Description
simpleads_admin_paths Implements hook_admin_paths().
simpleads_block_configure Implements hook_block_configure().
simpleads_block_info Implements hook_block_info().
simpleads_block_save Implements hook_block_save().
simpleads_block_view Implements hook_block_view().
simpleads_cron Implements hook_cron().
simpleads_form Implements hook_form().
simpleads_form_alter Implements hook_form_alter().
simpleads_menu Implements hook_menu().
simpleads_node_access Implements hook_node_access().
simpleads_node_delete Implements hook_node_delete().
simpleads_node_info Implements hook_node_info().
simpleads_node_presave Implements hook_node_presave().
simpleads_permission Implements hook_permission().
simpleads_simpleads_ad_click Implements hook_simpleads_ad_click().
simpleads_simpleads_ad_impression Implements hook_simpleads_ad_impression().
simpleads_simpleads_order Implements hook_simpleads_order().
simpleads_simpleads_order_info Implements hook_simpleads_order_info().
simpleads_simpleads_redirect Implements hook_simpleads_redirect().
simpleads_simpleads_stats_info Implements hook_simpleads_stats_info().
simpleads_taxonomy_term_delete Implements hook_taxonomy_term_delete().
simpleads_taxonomy_term_insert Implements hook_taxonomy_term_insert().
_simpleads_access_callback Menu access callback.
_simpleads_new_add Menu callback. Redirect to SimpleAds node creation page.
_simpleads_new_group_add Menu callback. Redirect to add new Ad Group taxonomy term page.
_simpleads_redirect Menu callback. Redirect Ads. If user is Admin -> redirect to Ad edit page, otherwise redirect to target URL.
_simpleads_show_ads Menu callback. Callback for AJAX call.