/** * Returns a callback that binds the data with the template * * @param *string $template the template string * * @return function The template binding handler */ public function compile($template) { $name = md5($template); if (isset(self::$callbacks[$name])) { return self::$callbacks[$name]; } $file = $this->cache . '/' . $this->prefix . $name . '.php'; if (is_dir($this->cache) && file_exists($file)) { $callback = (include $file); } else { $code = Compiler::i($this, $template)->compile(); if (is_dir($this->cache)) { file_put_contents($file, $code); } //called like: function($data) {}; $callback = @eval('?>' . $code); //$this->checkEval($code); } self::$callbacks[$name] = $callback; return $callback; }