示例#1
0
 /**
  * Print html formated error message
  * @param int|arrray $a_code
  * @param string $a_message
  * @param int $a_line
  * @param string $a_file
  * @param array $a_backtrace
  * @return null
  */
 public function showError($a_code, $a_message = null, $a_line = null, $a_file = null, $a_backtrace = null)
 {
     if (is_array($a_code) && func_num_args() == 1) {
         return $this->showError(isset($a_code['code']) ? $a_code['code'] : null, isset($a_code['message']) ? $a_code['message'] : null, isset($a_code['line']) ? $a_code['line'] : null, isset($a_code['file']) ? $a_code['file'] : null, isset($a_code['backtrace']) ? $a_code['backtrace'] : null);
     } else {
         if ($a_code instanceof Exception) {
             return $this->showError($a_code->getCode(), $a_code->getMessage(), $a_code->getLine(), $a_code->getFile(), $a_code->getTrace());
         } else {
             if ($a_code instanceof ZError) {
                 return $this->showError($a_code->getCode(), $a_code->getMessage(), 0, 0, $a_code->getTrace());
             }
         }
     }
     $c = new ZDummyController($this, 'DummyController');
     $c->render(Zoombi::fromFrameworkDir('Views' . Zoombi::DS . 'view_error.php'), array('code' => $a_code, 'message' => $a_message, 'line' => $a_line, 'file' => $a_file, 'backtrace' => $a_backtrace));
     unset($c);
 }
示例#2
0
 /**
  * Load from library
  * @param string $a_path
  * @return bool True if load success else return false
  */
 public static final function library($a_path)
 {
     $i = ZLoader::getInstance();
     if (key_exists($a_path, $i->m_library)) {
         return true;
     }
     $i->m_library[$a_path] = true;
     $exp_path = explode('.', $a_path);
     $classname = array_pop($exp_path);
     $i->emit(new ZEvent($i, 'onLibrary', $classname));
     if ($exp_path[0] == 'zoombi') {
         array_shift($exp_path);
         $new_path = array();
         foreach ($exp_path as $p) {
             array_push($new_path, ucwords($p));
         }
         $exp_path = $new_path;
         $new_path = is_array($exp_path) ? implode(Zoombi::DS, $exp_path) : $exp_path;
         $filename = Zoombi::fromFrameworkDir($new_path . Zoombi::DS . strtolower($classname) . '.php');
         $code = null;
         if (file_exists($filename)) {
             $code = (include_once $filename);
         }
         if ($code != -1) {
             $i->emit(new ZEvent($i, 'onLibrarySucess', $classname));
             return true;
         }
     } else {
         $new_path = implode(Zoombi::DS, $exp_path);
         $filename = Zoombi::fromFrameworkDir($new_path . Zoombi::DS . $classname . '.php');
         $code = $this->loadFile($filename);
         if ($code) {
             if (class_exists($classname)) {
                 $i->emit(new ZEvent($i, 'onLibrarySucess', $classname));
             }
             return true;
         }
     }
     $i->emit(new ZEvent($i, 'onLibraryFailed', $classname));
     return false;
 }
示例#3
0
 public function getDebug()
 {
     $d = new ZDummyController(Zoombi::getApplication(), '__dummy_ctl__');
     $o = $d->render(Zoombi::fromFrameworkDir('Views/view_route_debug.php'), array('route' => &$this), true);
     unset($d);
     return $o;
 }
示例#4
0
 /**
  * Constructor
  */
 protected function __construct()
 {
     $this->m_dispatcher = new Zoombi_Dispatcher();
     self::$defaults = new Zoombi_Config(Zoombi::fromFrameworkDir('defaults.php'));
 }
示例#5
0
 public function _exception_handler(Exception &$e)
 {
     $c = new ZDummyController($this);
     $c->render(Zoombi::fromFrameworkDir('Views' . Zoombi::DS . 'view_exception.php'), array('code' => $e->getCode(), 'message' => $e->getMessage(), 'backtrace' => $e->getTrace(), 'line' => $e->getLine(), 'file' => $e->getFile()));
     unset($c);
 }