示例#1
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     $output = preg_match('/^<!DOCTYPE\\s.*>$/', trim($this->doctype->render())) ? trim($this->doctype->render()) . PHP_EOL : '<!DOCTYPE html>' . PHP_EOL;
     preg_match('/<html.*?>/', $this->html->render(), $result);
     $output .= isset($result[0]) ? $result[0] . PHP_EOL : '<html>' . PHP_EOL;
     $output .= substr($this->head->render(), 0, -7);
     $favicon = $this->favicon->render();
     if (!empty($favicon)) {
         $output .= $favicon . PHP_EOL;
     }
     if ($this->styleSheet->length()) {
         $output .= $this->styleSheet->render('html') . PHP_EOL;
     }
     if ($this->javaScript->length()) {
         $tmp = call_user_func($this->scriptOutput, $this->javaScript, $this->translations);
         if (!empty($tmp)) {
             $output .= $tmp . PHP_EOL;
         }
     }
     if (!$this->script->isEmpty()) {
         $output .= '<script type="text/javascript">' . $this->script->render() . '</script>' . PHP_EOL;
     }
     $output .= $this->customHeadCode;
     $output .= '</head>' . PHP_EOL;
     $bodyEndPos = strrpos($this->body, "</body>");
     if ($bodyEndPos !== false) {
         $output .= substr($this->body, 0, $bodyEndPos);
         $output .= $this->customBottomCode . '</body>';
     } else {
         $output .= $this->body;
     }
     $output .= '</html>';
     return $output;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 public function render()
 {
     return $this->transText($this->body->render());
 }
示例#3
0
 /**
  * Only code of prolog.
  *
  * @return string
  */
 protected function prologRender()
 {
     return preg_match('/^<\\?xml\\s.*\\?>$/', trim($this->prolog->render())) ? trim(str_replace("{{ encoding }}", preg_replace('/[^A-Z0-9_\\/\\.-]/i', '', $this->encoding->render()), $this->prolog->render())) . PHP_EOL : '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
 }