You are here

function feeds_imagegrabber_include_library in Feeds Image Grabber 7

Same name and namespace in other branches
  1. 6 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.

1 call to feeds_imagegrabber_include_library()
feeds_imagegrabber_feeds_set_target in ./feeds_imagegrabber.module
Callback for mapping. Here is where the actual mapping happens.

File

./feeds_imagegrabber.module, line 682
Grabs images for items imported using the feeds module.

Code

function feeds_imagegrabber_include_library($file, $library) {
  if (module_exists('libraries') && file_exists(libraries_get_path($library) . "/{$file}")) {
    require_once DRUPAL_ROOT . '/' . 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 DRUPAL_ROOT . '/' . $path;
        return TRUE;
      }
    }
  }
  return FALSE;
}