You are here

function _imageapi_optimize_info_scan in Image Optimize (or ImageAPI Optimize) 7

Helper function; Scan relevant directories and return info from includes.

1 call to _imageapi_optimize_info_scan()
imageapi_optimize_imageapi_optimize_info in ./imageapi_optimize.imageapi_optimize.inc
Implements hook_imageapi_optimize_info().

File

./imageapi_optimize.imageapi_optimize.inc, line 24
ImageAPI Optimize module integration.

Code

function _imageapi_optimize_info_scan($type) {
  $info = array();

  // Scan relevant directory for includes.
  $files = file_scan_directory(drupal_get_path('module', 'imageapi_optimize') . '/' . $type, '/\\.inc/');
  foreach ($files as $file) {
    include_once $file->uri;

    // Get info from relevant include.
    $function = 'imageapi_optimize_' . $type . '_' . $file->name . '_info';
    if (function_exists($function)) {
      $return = $function();
      if (is_array($return)) {
        $info[$file->name] = $return + array(
          'file' => $file->uri,
        );
      }
    }
  }
  return $info;
}