/** * 构造函数 * * @param string $class_name 类名 */ public function __construct($class_name) { parent::__construct(); try { $context = KISS_Framework_Context::getInstance(); $context->mClassName = $this->_checkClass($class_name); $filter = KISS_Class::getClassConstant($context->mClassName, 'FILTERS'); $this->mFilters = $filter == '' ? array() : explode(',', $filter); $context->mFilters = $this->mFilters; $context->mCacheTime = intval(KISS_Class::getClassConstant($context->mClassName, 'CACHE_TIME')); } catch (Exception $error) { $page = new KISS_Page(); $page->showMessage($error->getMessage()); } }
/** * 构造函数 * * @param string $class_name 类名 */ public function __construct($class_name) { parent::__construct(); try { $context = KISS_Framework_Context::getInstance(); $context->mClassName = $class_name; $filter = KISS_Class::getClassConstant($context->mClassName, 'FILTERS'); $filters = $filter == '' ? array() : explode(',', $filter); } catch (Exception $error) { $page = new KISS_Page(); $page->showMessage($error->getMessage()); } while (count($filters) > 0) { $filter = array_shift($filters); $filter = new $filter(); $filter->doPreProcessing($context, $this); } }
/** * 框架入口函数 * * @return void */ public function serve() { try { new KISS_Controller(); } catch (Exception $e) { var_dump($e); $page = new KISS_Page(); $page->showMessage($e->getMessage()); } }
/** * 程序逻辑入口点 * * @return void */ function run() { $this->clear_all_assign(); if (count($this->mGET) > 0) { foreach ($this->mGET as $key => $value) { if (in_array($key, $this->mReserve)) { $this->assign($key, $value); } } } $this->beforeRunAction(); if (!empty($this->mActionFunctions[$this->mAction]['before'])) { call_user_func_array(array($this, $this->mActionFunctions[$this->mAction]['before']), array()); } try { call_user_func_array(array($this, '_' . $this->mAction), array()); } catch (Exception $error) { $page = new KISS_Page(); $page->showMessage($error->getMessage()); } if (method_exists($this, 'afterRunAction')) { $this->afterRunAction(); } $this->assignUrl(); $this->assign("_table", $this->mTableName); $this->display($this->mTemplateFile); }