コード例 #1
0
 protected function checkSyntax($file)
 {
     if (empty($this->once[$file])) {
         $this->once[$file] = true;
         $code = file_get_contents($file);
         $code = preg_replace('~\\s+class\\s+(.+?)[\\s\\n\\r\\{]~', ' class $1_check ', $code);
         $return = @eval('?>' . $code);
         if (false === $return && ($error = error_get_last())) {
             $debug = new SyntaxHandler($this->config);
             $debug->triggerErrorHandler($error['type'], $error['message'], $file, $error['line']);
             exit;
         }
     }
     return true;
 }
コード例 #2
0
 /**
  * Executes php code in the template with the given parameters
  * 
  * $param string $block
  *
  * @return string
  */
 protected function execute($block = '')
 {
     if (!$this->tplPhp) {
         return $this->parsing($block);
     }
     $block = $this->includesPhp($block);
     $block = str_ireplace('<?xml', '<xml', $block);
     extract($this->data);
     ob_start();
     $return = @eval('?>' . $block);
     if (false === $return && ($error = error_get_last())) {
         $debug = new SyntaxHandler($this->config);
         $debug->triggerErrorHandler($error['type'], $error['message'], $this->path, $error['line']);
         exit;
     }
     $block = ob_get_clean();
     $block = str_ireplace('<xml', '<?xml', $block);
     return $block;
 }
コード例 #3
0
 /**
  * Разбор шаблона
  *
  * @param string $template
  *
  * @return string
  */
 protected function execute($template)
 {
     if (isset($this->config['abc_debug'])) {
         $content = file_get_contents($template);
         ob_start();
         $return = @eval('?>' . $content);
         ob_end_clean();
         if (false === $return && ($error = error_get_last())) {
             $debug = new SyntaxHandler($this->config);
             $debug->triggerErrorHandler($error['type'], $error['message'], $template, $error['line']);
             exit;
         }
     }
     ob_start();
     extract($this->data);
     include_once $template;
     return ob_get_clean();
 }