You are here

public static function Frx::drivers in Forena Reports 7.5

Loads all of the include files that

2 calls to Frx::drivers()
DataManager::load_provider in src/DataManager.php
Load the data provider class based on the class name.
Frx::getDriver in ./Frx.inc
Factory method to return instance object

File

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

Class

Frx

Code

public static function drivers($parent = '') {
  static $drivers = '';
  if (!$drivers) {
    $drivers = 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 (isset($p['file'])) {
              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)) {
              $drivers[] = $p;
            }
            else {
              $drivers[$key] = $p;
            }
          }
        }
      }
    }
    foreach ($drivers as $p) {
      if (isset($p['file'])) {
        include_once trim($p['file'], '/');
      }
    }
  }

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