public function __construct($config, $type)
 {
     if (is_string($config)) {
         $config = (require $config);
     }
     if (isset($config['app_path'])) {
         $this->setBasePath($config['app_path']);
         Base::setAppPath($config['app_path']);
         Loader::setPathOfAlias('app', Base::getAppPath());
         Loader::setPathOfAlias('public', dirname($_SERVER['SCRIPT_FILENAME']));
         unset($config['app_path']);
     } else {
         throw new Exception('Application: missing application\'s config "app_path"');
     }
     if (!isset($config['namespace'])) {
         throw new Exception('Application: missng config "namespace"');
     }
     Loader::addNamespace($config['namespace'], dirname(Base::getAppPath()));
     $this->setAppNamespace($config['namespace']);
     if (isset($config['import'])) {
         $this->_import($config['import']);
         unset($config['import']);
     }
     $this->_type = $type;
     $this->preInit();
     $this->configuration($config);
     $this->_init();
     $this->afterInit();
     /**
      * @TODO removed since version 1.0.2, application custom error handler
      */
     //        set_error_handler(array($this,'handleError'),error_reporting());
 }
示例#2
0
 public function __construct($name, $path)
 {
     parent::__construct($name, $path);
     $this->time = time();
     $this->setViewPath(ConfigHandler::get('view_path'));
     if (ConfigHandler::has('template')) {
         $this->setTemplate(ConfigHandler::get('template'));
     }
     Loader::setPathOfAlias('template', $this->_viewPath . DIRECTORY_SEPARATOR . $this->_template);
 }
示例#3
0
<?php

use Flywheel\Loader;
define('ROOT_PATH', dirname(__FILE__));
define('GLOBAL_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'global');
define('LIBRARY_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'library');
define('RUNTIME_PATH', ROOT_PATH . DIRECTORY_SEPARATOR . 'runtime');
define('PUBLIC_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'public');
define('MEDIA_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'media');
define('EXTENSION_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'extension');
define('FRONTEND_DIR', ROOT_PATH . DIRECTORY_SEPARATOR . 'apps/Frontend');
require_once ROOT_PATH . '/vendor/autoload.php';
//add namespace before register
Loader::addNamespace('Toxotes', LIBRARY_PATH);
Loader::register();
Loader::setPathOfAlias('root', ROOT_PATH);
Loader::setPathOfAlias('global', GLOBAL_PATH);
Loader::setPathOfAlias('library', LIBRARY_PATH);
Loader::setPathOfAlias('extension', EXTENSION_DIR);
Loader::import('global.include.*');
set_error_handler(array('Toxotes\\ErrorHandler', 'errorHandling'));
set_exception_handler(array('Toxotes\\ErrorHandler', 'exceptionHandling'));