You are here

public static function Frx::plugins in Forena Reports 7.3

Same name and namespace in other branches
  1. 7.4 Frx.inc \Frx::plugins()

Loads all of the include files that

2 calls to Frx::plugins()
Frx::PluginInstance in ./Frx.inc
Factory method to return instance object
FrxRepoMan::load_provider in ./FrxRepoMan.inc
Load the data provider class based on the class name.

File

./Frx.inc, line 277
Frx.incL General Forena Reporting Class

Class

Frx

Code

public static function plugins($parent = '') {
  static $plugins = '';
  if (!$plugins) {
    $plugins = array();
    foreach (module_list() as $module) {
      $function = $module . '_forena_plugins';
      if (function_exists($function)) {
        $returned_plugins = $function();
        if ($returned_plugins) {
          foreach ((array) $returned_plugins as $key => $p) {
            $p['module'] = $module;
            if (@$p['path']) {
              $p['file'] = rtrim($p['path'], '/') . '/' . $p['file'];
            }
            else {
              $p['file'] = drupal_get_path('module', $p['module']) . '/' . $p['file'];
            }
            if (is_int($key)) {
              $plugins[] = $p;
            }
            else {
              $plugins[$key] = $p;
            }
          }
        }
      }
    }
    foreach ($plugins as $p) {
      if ($p['file']) {
        include_once trim($p['file'], '/');
      }
    }
  }

  // Return the plugins if a parent was requested.
  $ret_plugins = array();
  if ($parent) {
    foreach ($plugins as $key => $p) {
      if (@$p[parent] == $parent) {
        $ret_plugins[$key] = $p;
      }
    }
  }
  return $ret_plugins;
}