You are here

function _ai_noinject in Content Injector (formerly AdSense Injector) 6.3

Same name and namespace in other branches
  1. 7.3 adsense_injector.module \_ai_noinject()

Determine whether there are any reasons not to inject ads.

Parameters

unknown_type $node The node to process.:

Return value

true if we should skip injection on this node.

1 call to _ai_noinject()
adsense_injector_nodeapi in ./adsense_injector.module
Implementation of hook_nodeapi().

File

./adsense_injector.module, line 215
Inject adsense ads into node content automatically.

Code

function _ai_noinject($node) {

  // Bail if node has 'ai_noinject' tag in first N characters.
  // TODO: make these regexp, configurable in admin.
  $front = substr($node->body, 0, variable_get('adsense_injector_front_maxlen', 512));
  $skip = !(strpos($front, ADSENSE_INJECTOR_NOINJECT) === FALSE);

  /// Bail if we find [adsense: tags in body.
  if (!$skip) {
    $skip = !(strpos($node->body, ADSENSE_INJECTOR_ADSENSE_TAG_PREFIX) == FALSE);
  }
  return $skip;
}