Пример #1
0
 /**
  * Parse the template.
  */
 protected function parse()
 {
     // not yet parsed
     if (!$this->parsed) {
         // while developing, you might want to know about the undefined indexes
         $errorReporting = $this->debug ? 'E_ALL | E_STRICT' : 0;
         $displayErrors = $this->debug ? 'On' : 'Off';
         // add to the list of parsed files
         $this->files[] = $this->getCompileName($this->template);
         // map modifiers
         $this->modifiers = SpoonTemplateModifiers::getModifiers();
         // set content
         $this->content = SpoonFile::getContent($this->template);
         // strip php code
         $this->content = $this->stripCode($this->content);
         // strip comments
         $this->content = $this->stripComments($this->content);
         // prepare iterations
         $this->content = $this->prepareIterations($this->content);
         // parse iterations
         $this->content = $this->parseIterations($this->content);
         // parse variables
         $this->content = $this->parseVariables($this->content);
         // parse options
         $this->content = $this->parseOptions($this->content);
         // includes
         $this->content = $this->parseIncludes($this->content);
         // parse cache tags
         $this->content = $this->parseCache($this->content);
         // parse forms
         $this->content = $this->parseForms($this->content);
         // replace variables
         $this->content = $this->replaceVariables($this->content);
         // add error_reporting setting
         $this->content = '<?php error_reporting(' . $errorReporting . '); ini_set(\'display_errors\', \'' . $displayErrors . '\'); ?>' . "\n" . $this->content;
         // parsed
         $this->parsed = true;
     }
 }
Пример #2
0
 public function testClearModifiers()
 {
     SpoonTemplateModifiers::clearModifiers();
     $this->assertEquals(array(), SpoonTemplateModifiers::getModifiers());
 }