You are here

function feeds_imagegrabber_include_library in Feeds Image Grabber 6

Same name and namespace in other branches
  1. 7 feeds_imagegrabber.module \feeds_imagegrabber_include_library()

Includes a required library file.

Parameters

$file: The filename to load from.

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

2 calls to feeds_imagegrabber_include_library()
feeds_imagegrabber_feeds_set_target in ./feeds_imagegrabber.module
Implementation of hook_feeds_set_target().
feeds_imagegrabber_requirements in ./feeds_imagegrabber.install
Implementation of hook_requirements().

File

./feeds_imagegrabber.module, line 970
Grabs image for each feed-item from their respective web pages and stores it in an image field. Requires Feeds module.

Code

function feeds_imagegrabber_include_library($file, $library) {
  if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/{$file}")) {
    require_once libraries_get_path($library) . "/{$file}";
    return TRUE;
  }
  else {
    $paths = array(
      drupal_get_path('module', 'feeds_imagegrabber'),
      drupal_get_path('module', 'feeds_imagegrabber') . "/libraries",
      'sites/all/libraries',
      'sites/all/libraries/feeds_imagegrabber',
      'sites/all/libraries/absoluteurl',
      'sites/all/libraries/AbsoluteUrl',
    );
    foreach ($paths as $library_path) {
      $path = $library_path . "/{$file}";
      if (file_exists($path)) {
        require_once $path;
        return TRUE;
      }
    }
  }
  return FALSE;
}