You are here

function _prod_check_page_title in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_check.module \_prod_check_page_title()

File

./prod_check.module, line 1824

Code

function _prod_check_page_title($caller = 'internal') {
  if (module_exists('metatag')) {
    return;
  }
  $check = array();
  $error = FALSE;
  $pager = variable_get('page_title_pager_pattern', '');
  $value_nok = $msg_nok = '';
  $title_ok = 'settings';
  $text_ok = 'Check the !link to verify if they are as you expect.';
  $title = 'Page titles';
  $path = 'admin/config/search/page-title';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  if (!module_exists('page_title')) {
    $error = TRUE;
    $value_nok = t('Disabled');
    $msg_nok = t('You have not enabled the !link (or equivalent) module. This module can help out with problems such as pages with paging being marked as duplicate content by search engines.', prod_check_link_array($title, 'http://drupal.org/project/page_title'));
  }
  elseif (empty($pager)) {
    $error = TRUE;
    $value_nok = t('Not properly configured.');
    $msg_nok = t('You have not !link You should really do this if you want proper Google Indexing.', prod_check_link_array('set a pager suffix', $path));
  }
  $check['prod_check_page_title'] = array(
    '#title' => t($title),
    '#state' => !$error,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
    '#value_ok' => t('Enabled'),
    '#value_nok' => $value_nok,
    '#description_ok' => prod_check_ok_title($title_ok, $path, $text_ok),
    '#description_nok' => $msg_nok,
    '#nagios_key' => 'PTIT',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}