示例#1
0
 protected function blackList($html)
 {
     if (!$this->config['sandbox'] || !static::$black_list) {
         return true;
     }
     if (empty($this->config['black_list_preg'])) {
         $this->config['black_list_preg'] = '#[\\W\\s]*' . implode('[\\W\\s]*|[\\W\\s]*', static::$black_list) . '[\\W\\s]*#';
     }
     // check if the function is in the black list (or not in white list)
     if (preg_match($this->config['black_list_preg'], $html, $match)) {
         // find the line of the error
         $line = 0;
         $rows = explode("\n", $this->templateInfo['code']);
         while (!strpos($rows[$line], $html) && $line + 1 < count($rows)) {
             $line++;
         }
         // stop the execution of the script
         $e = new SyntaxException('Syntax ' . $match[0] . ' not allowed in template: ' . $this->templateInfo['template_filepath'] . ' at line ' . $line);
         throw $e->templateFile($this->templateInfo['template_filepath'])->tag($match[0])->templateLine($line);
         return false;
     }
 }
示例#2
0
 /**
  * @param string $variableLabel
  */
 public function __construct($variableLabel)
 {
     $this->variableLabel = $variableLabel;
     $message = sprintf($this->template, $variableLabel);
     parent::__construct($message);
 }