Révision e4c061ad
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/ctools/includes/plugins.inc | ||
---|---|---|
214 | 214 |
function ctools_get_plugins($module, $type, $id = NULL) { |
215 | 215 |
// Store local caches of plugins and plugin info so we don't have to do full |
216 | 216 |
// lookups everytime. |
217 |
$plugins = &drupal_static('ctools_plugins', array()); |
|
217 |
static $drupal_static_fast; |
|
218 |
if (!isset($drupal_static_fast)) { |
|
219 |
$drupal_static_fast['plugins'] = &drupal_static('ctools_plugins', array()); |
|
220 |
} |
|
221 |
$plugins = &$drupal_static_fast['plugins']; |
|
222 |
|
|
218 | 223 |
$info = ctools_plugin_get_plugin_type_info(); |
219 | 224 |
|
220 | 225 |
// Bail out noisily if an invalid module/type combination is requested. |
... | ... | |
423 | 428 |
// store static of plugin arrays for reference because they can't be reincluded. |
424 | 429 |
static $plugin_arrays = array(); |
425 | 430 |
|
426 |
// If we're being asked for all plugins of a type, skip any caching |
|
427 |
// we may have done because this is an admin task and it's ok to |
|
428 |
// spend the extra time. |
|
429 |
if (!isset($filename)) { |
|
430 |
$all_files[$info['module']][$info['type']] = NULL; |
|
431 |
} |
|
432 |
|
|
433 | 431 |
if (!isset($all_files[$info['module']][$info['type']])) { |
434 |
// If a filename was set, we will try to load our list of files from |
|
435 |
// cache. This is considered normal operation and we try to reduce |
|
436 |
// the time spent finding files. |
|
437 |
if (isset($filename)) { |
|
438 |
$cache = cache_get("ctools_plugin_files:$info[module]:$info[type]"); |
|
439 |
if ($cache) { |
|
440 |
$all_files[$info['module']][$info['type']] = $cache->data; |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
if (!isset($all_files[$info['module']][$info['type']])) { |
|
432 |
$cache = cache_get("ctools_plugin_files:$info[module]:$info[type]"); |
|
433 |
if ($cache) { |
|
434 |
$all_files[$info['module']][$info['type']] = $cache->data; |
|
435 |
} |
|
436 |
// Do not attempt any file scan even if the cached entry was empty. |
|
437 |
// A NULL entry here would mean the plugin just does not exists, and we |
|
438 |
// cannot afford to run file scan on production sites normal run. |
|
439 |
elseif (!isset($all_files[$info['module']][$info['type']])) { |
|
445 | 440 |
$all_files[$info['module']][$info['type']] = array(); |
446 | 441 |
// Load all our plugins. |
447 | 442 |
$directories = ctools_plugin_get_directories($info); |
... | ... | |
683 | 678 |
if (!function_exists($function)) { |
684 | 679 |
return NULL; |
685 | 680 |
} |
686 |
$result = $function(); |
|
681 |
$result = $function($info);
|
|
687 | 682 |
if (!isset($result) || !is_array($result)) { |
688 | 683 |
return NULL; |
689 | 684 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules