You are here

function insight_contentanalysis_autoanalyze in Insight 7

5 calls to insight_contentanalysis_autoanalyze()
insight_autoanalyze_node_operation in ./insight.reports.inc
insight_contentanalysis_autoanalyze_batch in ./insight.module
insight_contentanalysis_autoanalyze_nodes in ./insight.module
insight_node_insert in ./insight.module
Implementation of hook_node_insert();
insight_node_update in ./insight.module
Implementation of hook_node_update();

File

./insight.module, line 547

Code

function insight_contentanalysis_autoanalyze($node) {
  $analysis = array();
  $context = contentanalysis_get_default_context();

  //$context['form_id'] = 'contentanalysis_analyze_js';
  if (is_object($node)) {
    $nid = $node->nid;
  }
  elseif (is_numeric($node)) {
    $nid = $node;
    $node = node_load($nid);
  }
  $context['inputs']['nid'] = $nid;
  $context['source'] = 'insight_auto';
  $context['nid'] = $context['inputs']['nid'];
  $context['node'] = $node;
  $active = variable_get('insight_contentanalysis_autorun_analyzers', array());

  // load analyzers using hook_contentanalysis_analyzers
  $analyzer_defs = contentanalysis_analyzer_info();

  //dsm($analyzer_defs);

  // enable modules to alter analyzers
  $analyzers = array();
  foreach ($active as $name => $enabled) {
    if ($enabled) {
      $analyzers[$name] = $analyzer_defs[$name];
    }
  }
  drupal_alter('contentanalysis_analyzers', $analyzers);
  $analysis = contentanalysis_do_analysis($context, $analyzers);
  $analysis = contentanalysis_build_analysis_content($analysis);
  return '';
}