You are here

function skinr_load_plugins in Skinr 7.2

Includes Skinr plugin files for an extension, if any.

Parameters

$extension: The API information for an extension, as returned by skinr_implements_api().

2 calls to skinr_load_plugins()
skinr_get_group_info in ./skinr.module
Retrieves all skin groups registered by modules and themes.
skinr_get_skin_info in ./skinr.module
Retrieves all skins registered by modules and themes.

File

./skinr.module, line 562
Handles core Skinr functionality.

Code

function skinr_load_plugins($extension) {
  static $loaded = array();

  // If plugins have already been loaded for this extension, return them.
  if (isset($loaded[$extension['name']])) {
    return $loaded[$extension['name']];
  }
  $loaded[$extension['name']] = array();

  // If the extension defines a plugin directory, scan its plugins.
  if (isset($extension['directory'])) {
    $dir = DRUPAL_ROOT . '/' . $extension['path'] . '/' . $extension['directory'];
    $mask = '@^' . DRUPAL_PHP_FUNCTION_PATTERN . '\\.inc$@';
    $loaded[$extension['name']] = file_scan_directory($dir, $mask, array(
      'key' => 'name',
      'recurse' => TRUE,
      'min_depth' => 1,
      'callback' => 'skinr_include_once',
    ));
  }
  return $loaded[$extension['name']];
}