function feeds_include_library in Feeds 8.2
Same name and namespace in other branches
- 6 feeds.module \feeds_include_library()
- 7.2 feeds.module \feeds_include_library()
- 7 feeds.module \feeds_include_library()
Includes a library file.
Parameters
$file: The filename to load from.
$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.
Related topics
9 calls to feeds_include_library()
- CommonSyndicationParserTest::setUp in lib/
Drupal/ feeds/ Tests/ CommonSyndicationParserTest.php - Sets up a Drupal site for running functional and integration tests.
- FeedsCSVParser::parse in lib/
Drupal/ feeds/ Plugin/ feeds/ parser/ FeedsCSVParser.php - Implements FeedsParser::parse().
- FeedsEnclosure::getContent in lib/
Drupal/ feeds/ FeedsEnclosure.php - FeedsHTTPFetcher::clear in lib/
Drupal/ feeds/ Plugin/ feeds/ fetcher/ FeedsHTTPFetcher.php - Clear caches.
- FeedsHTTPFetcher::sourceFormValidate in lib/
Drupal/ feeds/ Plugin/ feeds/ fetcher/ FeedsHTTPFetcher.php - Override parent::sourceFormValidate().
File
- ./
feeds.module, line 924 - Feeds - basic API functions and hook implementations.
Code
function feeds_include_library($file, $library) {
static $included = array();
static $ignore_deprecated = array(
'simplepie',
);
if (!isset($included[$file])) {
// Disable deprecated warning for libraries known for throwing them
if (in_array($library, $ignore_deprecated)) {
$level = error_reporting();
// We can safely use E_DEPRECATED since Drupal 7 requires PHP 5.3+
error_reporting($level ^ E_DEPRECATED ^ E_STRICT);
}
$library_dir = variable_get('feeds_library_dir', FALSE);
$feeds_library_path = DRUPAL_ROOT . '/' . drupal_get_path('module', 'feeds') . "/libraries/{$file}";
// Try first whether libraries module is present and load the file from
// there. If this fails, require the library from the local path.
if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/{$file}")) {
require libraries_get_path($library) . "/{$file}";
$included[$file] = TRUE;
}
elseif ($library_dir && file_exists("{$library_dir}/{$library}/{$file}")) {
require "{$library_dir}/{$library}/{$file}";
$included[$file] = TRUE;
}
elseif (file_exists($feeds_library_path)) {
// @todo: Throws "Deprecated function: Assigning the return value of new
// by reference is deprecated."
require $feeds_library_path;
$included[$file] = TRUE;
}
// Restore error reporting level
if (isset($level)) {
error_reporting($level);
}
}
if (isset($included[$file])) {
return TRUE;
}
return FALSE;
}