You are here

function contentanalysis_parse_context in Content Analysis 6

Same name and namespace in other branches
  1. 8 contentanalysis.module \contentanalysis_parse_context()
  2. 7 contentanalysis.module \contentanalysis_parse_context()

Inspects context to select a normalizing context parser

Parameters

$the_context: Initialized contentalaysis context formated array

Return value

A normalized context array

1 call to contentanalysis_parse_context()
contentanalysis_do_analysis in ./contentanalysis.module
Provides analysis on context passed in

File

./contentanalysis.module, line 596

Code

function contentanalysis_parse_context($the_context) {
  $context = contentanalysis_get_default_context();
  if (is_array($the_context)) {
    $context = array_merge($context, $the_context);
  }

  // select which parser to use
  if ($context['source'] == 'node-edit-form') {
    return contentanalysis_parse_context_node_edit($context);
  }
  elseif ($context['nid'] > 0) {

    // analysis by nid
    return contentanalysis_parse_context_node_load($context);
  }
  elseif ($context['body']) {

    // analysis by direct text input
    $context['body_notags'] = strip_tags($context['body']);
  }
  elseif ($context['page']) {

    // analysis by url
    return contentanalysis_parse_context_page($context);
  }
  return $context;
}