You are here

function syntaxhighlighter_requirements in Syntax Highlighter 7.2

Same name and namespace in other branches
  1. 8 syntaxhighlighter.install \syntaxhighlighter_requirements()
  2. 6.2 syntaxhighlighter.install \syntaxhighlighter_requirements()
  3. 6 syntaxhighlighter.install \syntaxhighlighter_requirements()
  4. 7 syntaxhighlighter.install \syntaxhighlighter_requirements()

Make sure the user has installed the 'SyntaxHighlighter' library the side effect of this is to rescan the javascript lib location

File

./syntaxhighlighter.install, line 39
Syntax highlighter module installation file.

Code

function syntaxhighlighter_requirements($phase) {
  $requirements = array();
  if ($phase != 'runtime') {
    return $requirements;
  }
  $t = get_t();
  require_once 'syntaxhighlighter.module';

  // lib location may have moved, delete the cached location to force scan again
  variable_del('syntaxhighlighter_lib_location');
  $lib_location = _syntaxhighlighter_get_lib_location();
  $requirements['syntaxhighlighter']['title'] = $t('Syntax Highlighter');
  $requirements['syntaxhighlighter']['value'] = $lib_location ? $t('Installed') : $t('Not installed');

  // Raise warning if the syntaxhighlighter script file is not install
  if (!$lib_location) {
    $requirements['syntaxhighlighter']['severity'] = REQUIREMENT_ERROR;
    $requirements['syntaxhighlighter']['description'] = $t('The required Syntax highlighter javascript library is not installed. See <a href="!link">the Syntaxhighlighter module README.txt file</a> for instructions.', array(
      '!link' => url(drupal_get_path('module', 'syntaxhighlighter') . '/README.txt'),
    ));
  }
  elseif (function_exists('libraries_detect')) {
    $library = libraries_detect('syntaxhighlighter');
    if (!empty($library['version'])) {
      $requirements['syntaxhighlighter']['value'] = $library['version'];
    }
  }
  return $requirements;
}