/** * 显示内容 * @param string $template 模板名 * @param string $content 内容 */ public function display($template = '', $content = '') { if (empty($template)) { if (empty($content)) { $this->parseView($this->parseViewFile(__ACTION__)); } else { setCharset(); echo $content; } } else { $this->parseView($this->parseViewFile($template)); } }
/** * 框架初始化 */ public static function start() { register_shutdown_function('Lite::fatalError'); set_error_handler('Lite::appError'); set_exception_handler('Lite::appException'); spl_autoload_register('Lite::autoload'); require COMMON_PATH . 'function.php'; setCharset(); if (version_compare(PHP_VERSION, '5.4.0', '<')) { @ini_set('magic_quotes_runtime', 0); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc() ? true : false); } else { define('MAGIC_QUOTES_GPC', false); } self::loadConfig(); date_default_timezone_set(C('DEFAULT_TIMEZONE')); $app = new App(); $app->init(); }
function setHead($title = '', $extra = '', $charset = '') { echo '<head> ' . setCharset() . ' ' . setTitle($title) . ' ' . setRss() . ' <style type="text/css" media="all"> @import "css/defaults.css"; @import "css/messages.css"; </style> <!-- Begin the rounding blurb and use RUZEE --> <script type="text/javascript" src="js/sb.js"></script> <script type="text/javascript"> var border = RUZEE.ShadedBorder.create({ corner:10, shadow:16, border:1 }); var minicontainer = RUZEE.ShadedBorder.create({ corner:7, shadow:0, border:1 }); </script>'; echo !empty($extra) ? "\t" . $extra . "\n" : "\n"; echo "</head>\n"; #[TODO] Create a good favicon <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" /> }
function makeRequest($request, $useAlt = false) { $refererURI = isset($_SESSION['lastOutBoundURI']) ? $_SESSION['lastOutBoundURI'] : "http://" . $this->mainURL; $request = $useAlt ? "http://" . $this->altURL . $request : "http://" . $this->mainURL . $request; // get data require_once "inc/classes/SimpleHTTP.php"; $http = SimpleHTTP::getInstance(); //utf-8 prefered $http->charset = $this->cfg['_CHARSET']; $http->method = $this->method; $http->postquery = $this->postquery; $this->htmlPage = $http->instance_getData($request, $refererURI); $this->htmlPage = setCharset($this->htmlPage, $http->charset); $this->lastRequest = $request; // return return $http->state == SIMPLEHTTP_STATE_OK; }