You are here

function itoggle_get_path in iToggle 7

Return the path to the iToggle plugin. This was borrowed from the Colorbox module

@link http://drupal.org/project/colorbox

3 calls to itoggle_get_path()
itoggle_form_admin in includes/itoggle.admin.inc
@file iToggle Admin config pages.
itoggle_get_js in includes/itoggle.inc
Return the JS filename for iToggle plugin. This was borrowed from the Colorbox module
itoggle_requirements in ./itoggle.install
Implements hook_requirements(). This was borrowed from the Colorbox module

File

includes/itoggle.inc, line 63
iToggle module include.

Code

function itoggle_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_value('itoggle_path');
    if (is_dir($path . '/itoggle')) {
      $library_path = $path;
    }
    elseif ($library_path == NULL && module_exists('libraries')) {
      if ($path = libraries_get_path('itoggle')) {
        $library_path = $path;
        variable_set('itoggle_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('itoggle')) {
        $library_path = $path;
        variable_set('itoggle_path', $library_path);
      }
    }
    elseif ($library_path == NULL) {
      $library_path = ITOGGLE_PATH;
    }
  }
  return $library_path;
}