You are here

public static function Frx::PluginInstance in Forena Reports 7.4

Same name and namespace in other branches
  1. 7.3 Frx.inc \Frx::PluginInstance()

Factory method to return instance object

Parameters

unknown_type $parent:

unknown_type $key:

Return value

object

1 call to Frx::PluginInstance()
Frx::Context in ./Frx.inc
Factory object to get the context based on a name. IF the context doesn't exist we assume the default data context (FrxData).

File

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

Class

Frx

Code

public static function PluginInstance($parent, $key) {
  static $objects = '';
  $o = NULL;
  if (!$objects) {
    $objects = array();
  }
  $plugins = Frx::plugins($parent);
  if (isset($plugins[$key])) {
    $class = @$plugins[$key]['class'];
    if (!isset($objects[$class])) {
      if (class_exists($class)) {
        $objects[$class] = new $class();
      }
    }
    $o = $objects[$class];
  }
  return $o;
}