Example #1
0
 /**
  * SPL Autoload
  *
  * @param string $class_name The class to load
  */
 public static function autoload($class_name)
 {
     $libraryPath = self::LIBRARY_DIR;
     $filePath = str_replace("_", DIRECTORY_SEPARATOR, $class_name) . ".php";
     if (file_exists($libraryPath . $filePath)) {
         require_once $libraryPath . $filePath;
         return;
     }
     $baseDir = Zend_Registry::get("baseDir");
     $file = $baseDir . "/application/" . str_replace("_", DIRECTORY_SEPARATOR, $class_name) . ".php";
     if (file_exists($file)) {
         require_once $file;
     } else {
         ob_start();
         var_dump(debug_backtrace());
         $back = ob_get_clean();
         Gecko_Utils::Error("Attempted to Load a un-existant class ({$class_name})\n{$back}", "Internal Server Error");
     }
 }
Example #2
0
 /**
  * Main Entry point, this function should be called from the
  * boot file to begin the application
  *
  * @access public static
  * @return void
  **/
 public function dispatch()
 {
     try {
         $this->setup();
         $this->run();
         $this->shutdown();
     } catch (Zend_Log_Exception $zle) {
         echo "[INIT ERROR] ";
         echo $zle->getMessage();
     } catch (Exception $e) {
         if (self::$DEBUG) {
             Gecko_Utils::Error($e->getMessage() . "<br />Trace: " . $e->getTraceAsString(), "Uncaught Exception", $e->getMessage() . "\nTrace\n" . $e->getTraceAsString());
         } else {
             Gecko_Log::getInstance()->log($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString(), Zend_Log::DEBUG);
             Gecko_Utils::Error("Internal Server Error", "Internal Server Error");
         }
     }
 }