You are here

protected function crumbs_PluginSystem_PluginInfo::get_includePluginFiles in Crumbs, the Breadcrumbs suite 7.2

Include files in the /plugin/ folder. We use the cache mechanic to make sure this happens exactly once.

Return value

bool

See also

crumbs_PluginSystem_PluginInfo::$includePluginFiles

File

lib/PluginSystem/PluginInfo.php, line 450

Class

crumbs_PluginSystem_PluginInfo
Info about available plugins and their weights.

Code

protected function get_includePluginFiles() {
  $dir = drupal_get_path('module', 'crumbs') . '/plugins';
  $files = array();
  foreach (scandir($dir) as $candidate) {
    if (preg_match('/^crumbs\\.(.+)\\.inc$/', $candidate, $m)) {
      if (module_exists($m[1])) {
        $files[$m[1]] = $dir . '/' . $candidate;
      }
    }
  }

  // Organic groups is a special case,
  // because 7.x-2.x behaves different from 7.x-1.x.
  if (1 && isset($files['og']) && !function_exists('og_get_group')) {

    // We are using the og-7.x-1.x branch.
    $files['og'] = $dir . '/crumbs.og.2.inc';
  }

  // Since the directory order may be anything, sort alphabetically.
  ksort($files);
  foreach ($files as $file) {
    require_once $file;
  }
  return TRUE;
}