Пример #1
0
 /**
  * Compile the tag data and return result
  *
  * @throws Exception\InjectNameNotSpecified
  *
  * @return string Compiled result of the tag wrapper
  */
 public function compile()
 {
     $php = '';
     if (!($injectAreaName = $this->parameter->get('name'))) {
         throw new Exception\InjectNameNotSpecified();
     }
     $wrapper = explode('(CODE)', $this->data, 2);
     $wrapperBefore = isset($wrapper[0]) ? $wrapper[0] : '';
     $wrapperAfter = isset($wrapper[1]) ? $wrapper[1] : '';
     if (isset($this->pool['Injected'][$injectAreaName]) && !empty($this->pool['Injected'][$injectAreaName])) {
         foreach ($this->pool['Injected'][$injectAreaName] as $injected) {
             $compiler = Compiler::compile($this->pool, $injected);
             $compiled = $compiler->result();
             $data = $compiler->getData();
             // Call this after `result` method
             $php .= $wrapperBefore . $compiled . $wrapperAfter;
             $this->dataContainer->importDefineBlock($data);
             $this->dataContainer->importMutex($data);
         }
     } elseif (isset($this->middles['empty'])) {
         foreach ($this->middles['empty'] as $empty) {
             $php .= $empty;
         }
     }
     return $php;
 }
Пример #2
0
 /**
  * Compile the tag data and return result
  *
  * @throws Exception\LanguageCodeNotFound
  *
  * @return string Compiled result of the tag wrapper
  */
 public function compile()
 {
     if (!isset($this->pool['LanguageMap'][$this->langCode])) {
         throw new Exception\LanguageCodeNotFound($this->langCode);
     }
     $compiler = Compiler::compile($this->pool, $this->pool['LanguageMap'][$this->langCode]);
     $compiled = $compiler->result();
     $data = $compiler->getData();
     // Call this after `result` method
     $this->dataContainer->importDefineBlock($data);
     $this->dataContainer->importMutex($data);
     return $compiled;
 }
Пример #3
0
 /**
  * Compile the tag data and return result
  *
  * @throws Exception\TemplateNameNotSpecified
  * @throws Exception\TemplateNotFound
  *
  * @return string Compiled result of the tag wrapper
  */
 public function compile()
 {
     $sets = $this->getSetTo($this->mainParameter);
     if (!($templateName = $this->mainParameter->get('name'))) {
         throw new Exception\TemplateNameNotSpecified();
     }
     if (!isset($this->pool['File']['Tpl'][$templateName]['default'])) {
         throw new Exception\TemplateNotFound($templateName);
     }
     $templateContent = str_replace(array_keys($sets), array_values($sets), file_get_contents($this->pool['File']['Tpl'][$templateName]['default']));
     $compiler = Compiler::compile($this->pool, $templateContent);
     $subTemplate = $compiler->result();
     $subData = $compiler->getData();
     $this->dataContainer->importMutex($subData);
     $this->dataContainer->importDefineBlock($subData);
     return $subTemplate;
 }