コード例 #1
0
ファイル: moonlake.php プロジェクト: bmario/moonlake
 /**
  * This methode initializes the framework.
  * Until now this means setting up the autoload stack.
  */
 public static function init()
 {
     // init exception handling
     include_once 'library/moonlake/application/application.php';
     // if we get until here, we can now use Application::exceptionHandler()!
     // starting output buffering, so we can clear output if there is an
     // exception
     ob_start();
     try {
         // init autoload
         include_once 'library/moonlake/autoload/autoload.php';
         Moonlake_Autoload_Autoload::initAutoload();
         // <-- maybe doing some more init in here :)
         // --> init end
     } catch (Exception $e) {
         // cleaning any previous output
         ob_clean();
         // call exception handler, so we get nice output
         echo Moonlake_Application_Application::exceptionHandler($e);
     }
 }
コード例 #2
0
ファイル: autoload.php プロジェクト: bmario/moonlake
 /**
  * This method initializes the autoloader stack
  * Therefore it registers every autoloader, which is given in
  * config/autoload.config.php.
  */
 public static function initAutoload()
 {
     // register tha whole autoload stack
     spl_autoload_register(array('Moonlake_Autoload_Autoload', 'loadClass'), true);
     // registers the autoloader loader
     Moonlake_Autoload_Autoload::registerLoader(new Autoloader_Loader());
     // load config
     include_once 'library/moonlake/config/config.php';
     $alcfg = new Moonlake_Config_Config('autoload');
     foreach ($alcfg->returnAll() as $loader) {
         try {
             $autoloader = new $loader();
         } catch (Moonlake_Exception_Autoloader $e) {
             throw new Moonlake_Exception_Autoloader("Could not register a particular autoloader class. Probably there is an mistake related to '{$e->classname}' in the configuration in 'config/autoload.php'. The loader is expected in the file {$e->classpath}.", $e->classname, $e->classpath);
         }
         Moonlake_Autoload_Autoload::registerLoader($autoloader);
     }
 }