Exemple #1
0
 public function html()
 {
     /* js chains */
     if ($this->getOption('closeTag', TRUE) == TRUE) {
         foreach ($this->jsChain as $code) {
             jQuery::chain($this, $code);
         }
         $this->jsChain = array();
     }
     $tagIndent = (int) $this->getOption('tag.indent', 0);
     $indent = max((int) $this->getOption('indent', 0), (int) $this->getOption('content.indent', 0));
     if ($this->tag == 'textarea' || $this->tag == 'pre') {
         $indent = $tagIndent = 0;
     }
     $html = '<' . HTML::esc($this->tag) . $this->htmlAttributes();
     if ($this->getOption('selfClosing', FALSE)) {
         /* self closing element ohne inhalt */
         $html .= ' />' . ($this->getOption('br.selfClosing', FALSE) ? "\n" : NULL);
     } elseif ($this->getOption('onlyOpen', FALSE)) {
         /* nur open-tag schließen, kein content, kein schließendes tag */
         $html .= '>' . ($this->getOption('br.onlyOpen', FALSE) ? "\n" : NULL);
     } else {
         /* open-tag schließen, content, schließendes tag */
         $html .= '>' . ($this->getOption('br.openTag', FALSE) ? "\n" : NULL) . ($this->getOption('br.beforeContent', FALSE) ? "\n" : NULL) . ($indent > 0 ? S::indent($this->htmlContent(), $indent) : $this->htmlContent()) . ($this->getOption('br.afterContent', FALSE) ? "\n" : NULL);
         if ($this->getOption('closeTag', TRUE)) {
             $html .= '</' . HTML::esc($this->tag) . '>' . ($this->getOption('br.closeTag', FALSE) ? "\n" : NULL);
         }
     }
     if ($tagIndent > 0) {
         $html = S::indent($html, $tagIndent, "\n");
     } else {
         $html;
     }
     if (isset($this->template)) {
         $contentsArray = array_merge($this->convertContent(), $this->convertTemplateContent());
         $contentsArray['self'] = $html;
         $html = str_replace(array_map(create_function('$a', 'return "%".$a."%"; '), array_keys($contentsArray)), array_values($contentsArray), $this->template);
     }
     return $html;
 }