Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * This Preloads the default libraries into the class. There should be
  * very few of these, as they will normally get instantiated when
  * they're asked for the first time.
  * Currently this is only "Config".
  *
  * @return void
  * @access public
  */
 public function __construct(&$conf = null)
 {
     if (empty($conf)) {
         global $amp_conf;
         if (empty($amp_conf)) {
             throw new Exception("conf was empty!");
         }
         $conf = $amp_conf;
     }
     //TODO: load this another way
     global $astman;
     $libraries = $this->listDefaultLibraries();
     self::$conf = $conf;
     // Ensure the local object is available
     // but ensure this BEFORE we preload for any classes outside the scope of BMO
     self::$obj = $this;
     $oldIncludePath = get_include_path();
     set_include_path(__DIR__ . ":" . get_include_path());
     foreach ($libraries as $lib) {
         if (class_exists($lib)) {
             throw new Exception("Somehow, the class {$lib} already exists. Are you trying to 'new' something?");
         } else {
             include "{$lib}.class.php";
         }
         $class = '\\FreePBX\\' . $lib;
         $this->{$lib} = new $class($this);
     }
     set_include_path($oldIncludePath);
     $this->astman = $astman;
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * This Preloads the default libraries into the class. There should be
  * very few of these, as they will normally get instantiated when
  * they're asked for the first time.
  * Currently this is only "Config".
  *
  * @return void
  * @access public
  */
 public function __construct(&$conf = null)
 {
     //TODO: load this another way
     global $astman;
     $libraries = $this->listDefaultLibraries();
     self::$conf = $conf;
     $oldIncludePath = get_include_path();
     set_include_path(__DIR__ . ":" . get_include_path());
     foreach ($libraries as $lib) {
         if (class_exists($lib)) {
             throw new Exception("Somehow, the class {$lib} already exists. Are you trying to 'new' something?");
         } else {
             include "{$lib}.class.php";
         }
         $this->{$lib} = new $lib($this);
     }
     set_include_path($oldIncludePath);
     $this->astman = $astman;
     // Ensure the local object is available
     self::$obj = $this;
 }