You are here

function contentanalysis_checklist_analyzer in Content Analysis 8

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

Generates checklist analyzer

Parameters

$context: A context formatted array

$analysis: contentanalysis formatted analysis array

Return value

mixed

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

File

./contentanalysis.module, line 1062

Code

function contentanalysis_checklist_analyzer($context, $analysis) {
  $analysis['content'][] = contentanalysis_format_content(t('The content analysis module enables a suite of analyzers to help you develop better, more optimized content. <br /><br /> List of available analyzer modules:'), -5);
  $modules = array(
    array(
      'name' => t('Content optimizer'),
      'module' => 'contentoptimizer',
      'description' => t('Quick search engine optimization (SEO) analysis to assure your content follows basic SEO guidelines.'),
      'recommended' => TRUE,
      'link' => 'http://www.drupal.org/project/contentoptimizer',
    ),
    array(
      'name' => t('Insight'),
      'module' => 'insight',
      'description' => t('Provides a suite of advanced content analyzers in a single API. Features content scoring, SEO analysis, keyword extraction, optimization recommendations.'),
      'recommended' => TRUE,
      'link' => 'http://www.drupal.org/project/insight',
    ),
    array(
      'name' => t('Readability'),
      'module' => 'readability',
      'description' => t('Grades content for readability using five popular automated readability standards.'),
      'recommended' => TRUE,
      'link' => 'http://www.drupal.org/project/readability',
    ),
    array(
      'name' => t('Alchemy'),
      'module' => 'alchemy',
      'description' => t('Extracts keywords, concepts and entities from content using the Alchemy service.'),
      'recommended' => TRUE,
      'link' => 'http://www.drupal.org/project/alchemy',
    ),
    array(
      'name' => t('Keyword research'),
      'module' => 'kwresearch',
      'description' => t('Provides search popularity and other statistics for researching keyword phrases.'),
      'recommended' => TRUE,
      'link' => 'http://www.drupal.org/project/kwresearch',
    ),
  );
  foreach ($modules as $module) {
    $status = 'status';
    $msg_vars = array(
      '@module_name' => $module['name'],
      '!enabled_status' => '',
    );
    if (module_exists($module['module'])) {
      $msg_vars['!enabled_status'] = t('enabled');
      $link = FALSE;
      if ($module['recommended']) {
        $status = 'pass';
      }
    }
    else {
      $msg_vars['!enabled_status'] = t('not enabled');
      $link = l(t('Click here to download.'), $module['link'], array(
        'target' => '_drupalorg',
      ));
      if ($module['recommended']) {
        $status = 'warning';
      }
    }
    $msg = t('<strong>@module_name</strong> is !enabled_status.', $msg_vars);
    if ($link) {
      $msg .= ' ' . $link;
    }
    $analysis['messages'][] = contentanalysis_format_message($msg, $status);
    $analysis['messages'][] = contentanalysis_format_message($module['description'], 'status');
  }
  return $analysis;
}