You are here

function theme_contentoptimizer_analysis_section_msg in Content Optimizer 6

1 call to theme_contentoptimizer_analysis_section_msg()
contentoptimizer_analyze_js in ./contentoptimizer.module

File

./contentoptimizer.module, line 367
Analyzes node content for search engine optimization recommendations

Code

function theme_contentoptimizer_analysis_section_msg($data, $keyword, $content = '') {
  $content = htmlentities($content);
  if (strlen($content) > 100) {
    $content = substr($content, 0, 100) . '...';
  }
  $msg .= '<div class="contentoptimizer_analysis">' . "\n";
  $msg .= '<div class="' . ($data['recommendations'] ? "warning" : "status") . '">' . "\n";
  $msg .= '<h3>' . t('Content optimizer analysis') . ($data['section_label'] ? " (" . $data['section_label'] . ")" : "") . "</h3>\n";
  $msg .= '<pre>' . $content . "</pre>\n";
  $msg .= t('chars') . " = " . $data['char_count'];
  $msg .= ", " . t('words') . " = " . $data['word_count'];
  if ($keyword) {
    $msg .= ", " . t('frequency') . " = " . $data['keyword_count'];
    $msg .= ", " . t('density') . " = " . number_format($data['keyword_density'], 1) . "%";
    $msg .= ", " . t('prominence') . " = " . number_format($data['keyword_prominence'], 1) . "%";
  }
  if ($data['msg_pre_recs']) {
    $msg .= "<br />\n" . $data['msg_pre_recs'];
  }
  if (!$data['recommendations']) {
    $data['recommendations'][] = t('Optimized');
  }
  $msg .= "\n<ul>\n";
  foreach ($data['recommendations'] as $rec) {
    $msg .= "<li>{$rec}</li>\n";
  }
  $msg .= "</ul>\n";
  if ($data['msg_post_recs']) {
    $msg .= "<br />\n" . $data['msg_post_recs'];
  }
  $msg .= '<input class="form-submit" type="button" onclick="contentoptimizer_analyze(); return (false);" value="' . t('Analyze Content') . '"/>';
  $msg .= "</div>\n";
  $msg .= "</div>\n";
  return $msg;
}