You are here

function _syntaxhighlighter_scan_lib_location in Syntax Highlighter 7.2

Same name and namespace in other branches
  1. 6.2 syntaxhighlighter.module \_syntaxhighlighter_scan_lib_location()
  2. 6 syntaxhighlighter.module \_syntaxhighlighter_scan_lib_location()
  3. 7 syntaxhighlighter.module \_syntaxhighlighter_scan_lib_location()

Locate the syntaxhighlighter js library. The library must be placed in a directory named "syntaxhighlighter" in one of the following locations: 1) standard library paths provided by the "libraries" module (if installed) 2) the syntaxhighlighter module 3) sites/all/libraries/syntaxhighlighter 4) sites/[sitename]/libraries/syntaxhighlighter 5) under the install profile libraries directory

Return value

the file location of the js lib or NULL if not found

1 call to _syntaxhighlighter_scan_lib_location()
_syntaxhighlighter_get_lib_location in ./syntaxhighlighter.module

File

./syntaxhighlighter.module, line 377
Syntax highlight code using the Syntaxhighlighter javascript library. See http://alexgorbatchev.com/wiki/SyntaxHighlighter

Code

function _syntaxhighlighter_scan_lib_location() {
  $directories = array();
  if (module_exists('libraries')) {
    $directories[] = libraries_get_path('syntaxhighlighter');
  }
  $directories[] = drupal_get_path('module', 'syntaxhighlighter') . "/syntaxhighlighter";
  $directories[] = 'sites/all/libraries/syntaxhighlighter';

  // Mult-site specific location.
  $directories[] = conf_path() . '/libraries/syntaxhighlighter';

  // When this function is called during Drupal's initial installation process,
  // the name of the profile that is about to be installed is stored in the
  // global $profile variable. At all other times, the regular system variable
  // contains the name of the current profile, and we can call variable_get()
  // to determine the profile.
  global $profile;
  if (!isset($profile)) {
    $profile = variable_get('install_profile', 'default');
  }
  $directories[] = "profiles/{$profile}/libraries/syntaxhighlighter";
  foreach ($directories as $d) {
    if (is_file($d . "/scripts/shCore.js")) {
      return $d;
    }
  }
  return NULL;
}