You are here

function colorbox_get_path in Colorbox 7

Same name and namespace in other branches
  1. 6 colorbox.module \colorbox_get_path()

Return the path to the Colorbox plugin.

3 calls to colorbox_get_path()
colorbox_admin_settings in ./colorbox.admin.inc
General configuration form for controlling the colorbox behaviour.
colorbox_get_js in ./colorbox.module
Return the JS filename for Colorbox plugin.
colorbox_requirements in ./colorbox.install
Implements hook_requirements().

File

./colorbox.module, line 315
A light-weight, customizable lightbox plugin for jQuery 1.3

Code

function colorbox_get_path() {
  static $library_path = NULL;

  // Try to locate the library path in any possible setup.
  if ($library_path == NULL) {

    // First check the default location.
    $path = variable_get('colorbox_path', COLORBOX_PATH);
    if (is_dir($path . '/colorbox')) {
      $library_path = $path;
    }
    elseif ($library_path == NULL && module_exists('libraries')) {
      if ($path = libraries_get_path('colorbox')) {
        $library_path = $path;
        variable_set('colorbox_path', $library_path);
      }
    }
    elseif ($library_path == NULL && file_exists(dirname(__FILE__) . '/../libraries/libraries.module')) {
      require_once dirname(__FILE__) . '/../libraries/libraries.module';
      if ($path = libraries_get_path('colorbox')) {
        $library_path = $path;
        variable_set('colorbox_path', $library_path);
      }
    }
    elseif ($library_path == NULL) {
      $library_path = COLORBOX_PATH;
    }
  }
  return $library_path;
}