You are here

function contentanalysis_parse_context_page in Content Analysis 6

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

Normalizes context data inputed as a complete xHTML document

Parameters

$the_context: Initialized context formated array

Return value

A normalized context array

1 call to contentanalysis_parse_context_page()
contentanalysis_parse_context in ./contentanalysis.module
Inspects context to select a normalizing context parser

File

./contentanalysis.module, line 826

Code

function contentanalysis_parse_context_page($context) {

  //print "contentanalysis_parse_context_page($context)";

  //print_r($context);
  if (!$context['page']) {
    return $context;
  }
  $count = preg_match('/<title>(.+?)<\\/title>/isx', $context['page'], $match);
  $context['page_title'] = $match[1];

  //$count = preg_match('/(<meta name="keywords" content="(.*)" \/>)/i', $context['page'] ,$match);  // value in $match [2]
  $count = preg_match("|<meta[^>]*keywords[^>]*content=\"([^>]+)\"[^>]*>|Ui", $context['page'], $match);
  $context['meta_keywords'] = $match[1];

  //$count = preg_match('/(<meta name=\"description\" content="(.*)" \/>)/i', $context['page'], $match); // value in $match [2]
  $count = preg_match("|<meta[^>]*description[^>]*content=\"([^>]+)\"[^>]*>|Ui", $context['page'], $match);
  $context['meta_description'] = $match[1];
  $count = preg_match('/(<body.*>)(.+?)(<\\/body>)/ismU', $context['page'], $match);
  $context['body'] = $match[2];
  $context['body_notags'] = strip_tags($context['body']);
  return $context;
}