You are here

function _imageapi_optimize_get_methods in Image Optimize (or ImageAPI Optimize) 7

Same name and namespace in other branches
  1. 6 imageapi_optimize.module \_imageapi_optimize_get_methods()

Gets all implemented methods by ImageAPI and contrib modules.

This function takes a dozens of miliseconds CPU times.

1 call to _imageapi_optimize_get_methods()
imageapi_optimize_init in ./imageapi_optimize.module
Implements hook_init().
1 string reference to '_imageapi_optimize_get_methods'
image_imageapi_optimize_settings in ./imageapi_optimize.module
Settings form callback for the image toolkit.

File

./imageapi_optimize.module, line 332
Image optimize functionalities.

Code

function _imageapi_optimize_get_methods() {

  // The list of toolkits might not loaded yet. We call this function to get
  // toolkits in separate .inc files eventually included.
  image_get_available_toolkits();
  $funcs = get_defined_functions();
  $methods = array();
  $prefix = 'image_' . variable_get('imageapi_optimize_toolkit', '') . '_';
  foreach ($funcs['user'] as $func) {
    if (strpos($func, $prefix) === 0) {
      $method = substr($func, strlen($prefix));
      if (!in_array($method, array(
        'load',
        'save',
        'settings',
      ))) {
        $methods[] = $method;
      }
    }
  }
  cache_set('imageapi_optimize:methods', $methods);
  watchdog('imageapi', 'Refresh ImageAPI methods');
  return $methods;
}