public function __construct($app)
 {
     ClassLoader::addDirectories(array(base_path() . DIRECTORY_SEPARATOR . 'userfiles' . DIRECTORY_SEPARATOR . 'modules', __DIR__));
     ClassLoader::register();
     spl_autoload_register(array($this, 'autoloadModules'));
     parent::__construct($app);
 }
Esempio n. 2
0
 protected static function bootClasses()
 {
     if (self::$config->get('app.autoload')) {
         $dirs = self::$config->get('app.autoload');
         ClassLoader::register();
         ClassLoader::addDirectories($dirs);
     }
 }
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app['xero'] = $this->app->share(function ($app) {
         ClassLoader::addDirectories(array(__DIR__ . '/PHP-Xero'));
         $config = $this->app['config']['xero'];
         return new PHPXero($config['key'], $config['secret'], $config['publicPath'], $config['privatePath'], $config['format']);
     });
 }
Esempio n. 4
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bindShared('prez.commands.presenter', function ($app) {
         return new PresenterCommand($app['files']);
     });
     $this->commands('prez.commands.presenter');
     ClassLoader::addDirectories([app_path() . '/presenters']);
 }
Esempio n. 5
0
 /**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     $this->app->bind('Illuminate\\Contracts\\Auth\\Registrar', 'App\\Services\\Registrar');
     ClassLoader::addDirectories(array(app_path() . '/commands', app_path() . '/controllers', app_path() . '/models', app_path() . '/services', app_path() . '/services/Validation', app_path() . '/database/seeds'));
     // Autoload all components
     $components = array('posts', 'MediaManager', 'theme_manager');
     foreach ($components as $component) {
         ClassLoader::addDirectories(array(app_path() . '/Components/' . $component, app_path() . '/Components/' . $component . '/controllers', app_path() . '/Components/' . $component . '/controllers/backend', app_path() . '/Components/' . $component . '/database/migrations', app_path() . '/Components/' . $component . '/database/seeds', app_path() . '/Components/' . $component . '/models', app_path() . '/Components/' . $component . '/presenters', app_path() . '/Components/' . $component . '/services', app_path() . '/Components/' . $component . '/validation', app_path() . '/Components/' . $component . '/views'));
     }
 }
Esempio n. 6
0
 /**
  * Bootstrap the application events.
  *
  * @return void
  */
 public function boot()
 {
     // Autoload for widget factory.
     ClassLoader::addDirectories(array(app_path() . '/widgets'));
     $this->package('teepluss/theme');
     // Temp to use in closure.
     $app = $this->app;
     // Add view extension.
     $this->app['view']->addExtension('twig.php', 'twig', function () use($app) {
         return new Engines\TwigEngine($app);
     });
 }
Esempio n. 7
0
 public function register()
 {
     //setup autoloader to save plugins having to do it every time
     ClassLoader::register();
     ClassLoader::addDirectories(array($this->items->path . '/src', $this->items->path . '/src/migrations'));
     //require autoload files - not advised really, plugins should make full use of service providers to add functionality
     if (isset($this->items->autoload->files)) {
         foreach ((array) $this->items->autoload->files as $file) {
             $this->app['files']->requireOnce($this->items->path . '/' . $file);
         }
     }
     //register providers
     foreach ((array) $this->items->providers as $provider) {
         $this->app->register($provider);
     }
 }
Esempio n. 8
0
 public static function bootstrap($errorCallbacks)
 {
     // Only bootstrap once.
     if (static::$bootstrapped) {
         return;
     }
     // Load helper functions.
     require_once __DIR__ . '/../../../illuminate/support/Illuminate/Support/helpers.php';
     // Directories.
     $basePath = str_finish(realpath(__DIR__ . '/..'), '/');
     $controllersDirectory = $basePath . 'Controllers';
     $modelsDirectory = $basePath . 'Models';
     // Register the autoloader and add directories.
     ClassLoader::register();
     ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory));
     // Instantiate the container.
     $app = new Container();
     static::$container = $app;
     // Tell facade about the application instance.
     Facade::setFacadeApplication($app);
     // Register application instance with container
     $app['app'] = $app;
     // Set environment.
     $app['env'] = 'production';
     // Enable HTTP Method Override.
     Request::enableHttpMethodParameterOverride();
     // Create the request.
     $app['request'] = Request::createFromGlobals();
     // Register services.
     with(new EventServiceProvider($app))->register();
     with(new RoutingServiceProvider($app))->register();
     // Register aliases.
     foreach (static::$aliases as $alias => $class) {
         class_alias($class, $alias);
     }
     // Load the routes file if it exists.
     if (file_exists($basePath . 'routes.php')) {
         require_once $basePath . 'routes.php';
     }
     // Dispatch on shutdown.
     register_shutdown_function('Seytar\\Routing\\Router::dispatch', $errorCallbacks);
     // Mark bootstrapped.
     static::$bootstrapped = true;
 }
Esempio n. 9
0
    /**
     * Prüft ob der Global Bereich in der module.json existiert
     * wenn ja, dann wird dieser durchlaufen und alle benötigten
     * Ordner dem ClassLoader hinzugefügt.
     *
     *
     * @param  string $files
     * @param  string $module
     * @return void
     */
    private function registerGlobalNamespace($files, $module)
    {
        $directories = array();

        if(property_exists($files, 'global'))
        {
            foreach ($files->global as $global)
            {
                $directories[] = $this->getPath($module).$global;
            }
            ClassLoader::addDirectories($directories);
        }
    }
Esempio n. 10
0
 /**
  * Autoload
  *
  * Autoloads files and adds specified directories into the
  * global class autoloader.
  *
  * @return void
  */
 protected function autoload()
 {
     $directory = $this->config('directory');
     // Load files
     if ($files = $this->config('autoload.files', false)) {
         foreach ($files as $file) {
             include_once $directory . '/' . $file;
         }
     }
     // Register directories with the ClassLoader
     if ($classmap = $this->config('autoload.classmap', false)) {
         ClassLoader::addDirectories(array_map(function ($dir) use($directory) {
             return $directory . '/' . $dir;
         }, $classmap));
     }
 }