You are here

function _ai_manual_insertion in Content Injector (formerly AdSense Injector) 7.3

Same name and namespace in other branches
  1. 6.3 adsense_injector.module \_ai_manual_insertion()

Perform manual insertions, if any.

Parameters

unknown_type $node The node to process.:

Return value

true if we performed manual insertions, false otherwise.

1 call to _ai_manual_insertion()
adsense_injector_node_view in ./adsense_injector.module
Implements hook_node_view().

File

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

Code

function _ai_manual_insertion(&$node) {

  //
  // Check for manual insertion marker(s)
  $text = $node->content['body'][0]['#markup'];
  $at = strpos($text, ADSENSE_INJECTOR_MANUAL_INSERTION_TAG);
  if (!($at === FALSE)) {
    $insertion = _ai_get_insertion_text_for('inline');

    // TODO: Grab item id from found tag.
    $insertion = _adsense_injector_process_tags($insertion);
    $node->content['body'][0]['#markup'] = _ai_insert_text_at($text, $at, $insertion);

    //
    // Now do auto insertions but skip the 'inline' insertion.
    adsense_injector_process_body($text, $node, array(
      'inline',
    ));
    return true;
  }
  return false;
}