You are here

function feeds_library_exists in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.module \feeds_library_exists()
  2. 6 feeds.module \feeds_library_exists()
  3. 7 feeds.module \feeds_library_exists()

Checks whether a library is present.

Parameters

string $file: The filename to load from.

string $library: The name of the library. If libraries module is installed, feeds_library_exists() will look for libraries with this name managed by libraries module.

Return value

bool True if the library exists. False otherwise.

Related topics

1 call to feeds_library_exists()
feeds_simplepie_exists in ./feeds.module
Checks whether simplepie exists.

File

./feeds.module, line 1385
Feeds - basic API functions and hook implementations.

Code

function feeds_library_exists($file, $library) {
  $path = module_exists('libraries') ? libraries_get_path($library) : FALSE;
  if ($path && is_file($path . '/' . $file)) {
    return TRUE;
  }
  elseif (is_file(DRUPAL_ROOT . "/sites/all/libraries/{$library}/{$file}")) {
    return TRUE;
  }
  elseif (is_file(DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/{$file}")) {
    return TRUE;
  }
  elseif ($library_dir = variable_get('feeds_library_dir', FALSE)) {
    if (is_file("{$library_dir}/{$library}/{$file}")) {
      return TRUE;
    }
  }
  return FALSE;
}