function feeds_include_library in Feeds 7.2
Same name and namespace in other branches
- 8.2 feeds.module \feeds_include_library()
- 6 feeds.module \feeds_include_library()
- 7 feeds.module \feeds_include_library()
Includes a library file.
Parameters
string $file: The filename to load from.
string $library: The name of the library. If libraries module is installed, feeds_include_library() will look for libraries with this name managed by libraries module.
Return value
bool True if the requested library was found and included with success. False otherwise.
Related topics
14 calls to feeds_include_library()
- CommonSyndicationParserTestCase::setUp in tests/
common_syndication_parser.test - Sets up a Drupal site for running functional and integration tests.
- FeedsCSVParser::parse in plugins/
FeedsCSVParser.inc - Implements FeedsParser::parse().
- FeedsEnclosure::getContent in plugins/
FeedsParser.inc - Downloads the content from the file URL.
- FeedsFileHTTPTestCase::testHttpRequestUsingFileCache in tests/
feeds_fetcher_http.test - Tests if the result of a http request can be cached on the file system.
- FeedsFileHTTPTestCase::testNoRefetchOnSameRequest in tests/
feeds_fetcher_http.test - Tests that the source isn't fetched twice during the same request.
File
- ./
feeds.module, line 1335 - Feeds - basic API functions and hook implementations.
Code
function feeds_include_library($file, $library) {
static $included = array();
$key = $library . '/' . $file;
if (!isset($included[$key])) {
$included[$key] = FALSE;
$library_dir = variable_get('feeds_library_dir', FALSE);
$feeds_library_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/{$file}";
$libraries_path = module_exists('libraries') ? libraries_get_path($library) : FALSE;
// Try first whether libraries module is present and load the file from
// there. If this fails, require the library from the local path.
if ($libraries_path && is_file("{$libraries_path}/{$file}")) {
require "{$libraries_path}/{$file}";
$included[$key] = TRUE;
}
elseif (is_file(DRUPAL_ROOT . '/sites/all/libraries/' . $key)) {
require DRUPAL_ROOT . '/sites/all/libraries/' . $key;
$included[$key] = TRUE;
}
elseif ($library_dir && is_file($library_dir . '/' . $key)) {
require $library_dir . '/' . $key;
$included[$key] = TRUE;
}
elseif (is_file($feeds_library_path)) {
// @todo: Throws "Deprecated function: Assigning the return value of new
// by reference is deprecated."
require $feeds_library_path;
$included[$key] = TRUE;
}
}
return $included[$key];
}