public function run() { $this->content = file_get_contents($this->view->tplFile); //获得模板内容 $this->loadParseTags(); //加载标签库 及解析标签 $this->replaceGlobalFunc(); //解析全局函数{U:'index'} $this->compile(); //解析全局内容 $this->parseTokey(); //解析POST令牌Token $this->replaceConst(); //将所有常量替换 如把__APP__进行替换 $this->replaceLiteral(); //将Literal内容替换 $this->content = '<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?>' . $this->content; if (!is_dir(APP_COMPILE_PATH)) { Dir::create(APP_COMPILE_PATH); copy(HDPHP_TPL_PATH . 'index.html', APP_COMPILE_PATH . 'index.html'); } //创建编译目录 is_dir(dirname($this->view->compileFile)) or Dir::create(dirname($this->view->compileFile)); file_put_contents($this->view->compileFile, $this->content); //创建安全文件 $safeFile = dirname($this->view->compileFile) . "/index.html"; is_file($safeFile) or Dir::safeFile(dirname($safeFile)); }
public function run() { $this->content = file_get_contents($this->view->tplFile); $this->loadParseTags(); $this->replaceGlobalFunc(); $this->compile(); $this->parseTokey(); $this->replaceConst(); $this->content = '<?php if(!defined("HDPHP_PATH"))exit;C("DEBUG_SHOW",false);?>' . $this->content; if (!is_dir(COMPILE_PATH)) { Dir::create(COMPILE_PATH); copy(HDPHP_TPL_PATH . 'index.html', COMPILE_PATH . 'index.html'); } file_put_contents($this->view->compileFile, $this->content); $safeFile = dirname($this->view->compileFile) . "/index.html"; is_file($safeFile) or Dir::safeFile(dirname($safeFile)); }
public function run(&$view = null) { /** * HdView对象 */ $this->view = $view; /** * 模板内容 */ $this->content = file_get_contents($this->view->tplFile); /** * 获得不解析内容 */ $this->getNoParseContent(); /** * 加载标签类 * 标签由系统标签与用户扩展标签构成 */ $this->parseTag(); /** * 解析变量 */ $this->parseVar(); /** * 将所有常量替换 如把__APP__进行替换 */ $this->parseUrlConst(); /** * 将不解析内容还原 */ $this->replaceNoParseContent(); /** * 编译内容 */ $this->content = "<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>\n" . $this->content; /** * 创建编译目录与安全文件 */ Dir::create(dirname($this->view->compileFile)); Dir::safeFile(dirname($this->view->compileFile)); /** * 储存编译文件 */ file_put_contents($this->view->compileFile, $this->content); }