Beispiel #1
0
 /**
  * Initialize system environment and APIs
  *
  * Tasks:
  *
  *  1. Instantiate host handler and load host data
  *  2. Load engine general config data which applicable to all applications
  *  3. Load persist handler with persist config data from general config
  *  4. Instantiate autoloader with config data from general config
  *  5. Instantiate application engine with application config data
  */
 public static function init()
 {
     // Set start time
     static::$start = microtime(true);
     // Initialize Host
     $config = array('host' => array('path' => array('lib' => constant('PI_PATH_LIB'))));
     if (constant('PI_PATH_HOST')) {
         $config['file'] = constant('PI_PATH_HOST');
     }
     static::host($config);
     // Register autoloader, host, persist and autoloader
     $paths = static::host()->get('path');
     $options = array('top' => array('Pi' => static::path('lib') . '/Pi', 'Zend' => static::path('lib') . '/Zend'), 'namespace' => array(), 'class_map' => array(), 'module_path' => static::path('module'), 'custom_path' => !empty($paths['custom']) ? $paths['custom'] . '/module' : static::path('usr') . '/custom/module', 'include_path' => !empty($paths['vendor']) ? $paths['vendor'] : static::path('lib') . '/vendor');
     static::autoloader($options);
     // Load debugger and filter
     Debug::load();
     Filter::load();
     // Load engine global config
     $engineConfig = static::config()->load('engine.php');
     if (isset($engineConfig['config'])) {
         static::config()->set($engineConfig['config']);
     }
     // Initialize Persist handler
     $persistConfig = empty($engineConfig['persist']) ? array() : $engineConfig['persist'];
     static::persist($persistConfig);
     // Set persist handler for class/file map
     if (static::persist()->isValid()) {
         static::autoloader()->setPersist(static::persist());
     }
     // Register shutdown functions
     register_shutdown_function(__CLASS__ . '::shutdown');
 }
Beispiel #2
0
 /**
  * Dump data with var_dump()
  *
  * @param mixed $data
  * @return string
  */
 function vd($data)
 {
     return Debug::dump($data, true, 1);
 }