registerNamespace() public static method

Registers the namespace and directory with the autoloader.
public static registerNamespace ( string $namespace, string $directory )
$namespace string
$directory string
Exemplo n.º 1
0
 /**
  * Registers the plugins autoload paths with the autoloader.
  */
 public function registerWithAutoloader()
 {
     // Register namespace with autoloader
     $vendorDir = __DIR__ . '/../../vendor';
     foreach ($this->autoload as $namespace => $directory) {
         Traq::registerNamespace($namespace, $vendorDir . "/{$this->directory}/{$directory}");
     }
 }
Exemplo n.º 2
0
 /**
  * Install plugin.
  */
 public function installAction()
 {
     $info = Registry::infoFor(Request::$query['plugin']);
     $vendorDir = __DIR__ . '/../../../vendor';
     // Register autoload paths
     foreach ($info['autoload'] as $namespace => $directory) {
         Traq::registerNamespace($namespace, $vendorDir . "/{$info['directory']}/{$directory}");
     }
     if (class_exists($info['main'])) {
         $info['main']::__install();
         $info['main']::__enable();
         (new Plugin($info))->save();
     }
     return $this->redirectTo('admin_plugins');
 }