コード例 #1
0
ファイル: engine.php プロジェクト: alopix/aoxPages
 public function build($template, $compiled, $force = false)
 {
     /*
     Builds $template and writes the resulting compiled script to $compiled.
     
     		Returns true if the template was built, false if the compiled
     template was already up-to-date.
     */
     $this->template = $template;
     $this->compiled = $compiled;
     if (!file_exists($this->template)) {
         throw new OutlineException("OutlineEngine::build(): template not found: " . $this->template);
     }
     if ($force || !file_exists($this->compiled) || filemtime($this->template) > @filemtime($this->compiled)) {
         if (!@constant("OUTLINE_COMPILER")) {
             if (@constant("OUTLINE_DEBUG")) {
                 OutlineDebug("loading OutlineCompiler");
             }
             require OUTLINE_CLASS_PATH . "/compiler.php";
         }
         if (@constant("OUTLINE_DEBUG")) {
             OutlineDebug("compiling template '{$template}' to '{$compiled}'");
         }
         try {
             $compiler = new OutlineCompiler($this);
             @mkdir(dirname($compiled), OUTLINE_DIR_MODE, true);
             OutlineUtil::write_file($compiled, $compiler->compile(file_get_contents($template)));
             $compiler->__destruct();
             unset($compiler);
         } catch (OutlineCompilerException $e) {
             throw new OutlineException("error compiling template '{$template}', line " . $e->getLineNum() . " - " . $e->getMessage());
         }
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: compiler.php プロジェクト: alopix/aoxPages
 public function __construct($message, OutlineCompiler &$compiler)
 {
     parent::__construct($message, -1);
     $this->linenum = $compiler->getLineNum();
 }