Beispiel #1
0
 public function asHtml(\Extension\bbcode\JBBCode\ElementNode $el)
 {
     $content = "";
     foreach ($el->getChildren() as $child) {
         $content .= $child->getAsBBCode();
     }
     $att = $el->getAttribute();
     $tag = trim(htmlspecialchars($content));
     if ($att == 'h1') {
         self::$tree[] = array(1, $content, $tag);
         return "<h1 id=\"{$tag}\">" . $content . "</h1>";
     } else {
         if ($att == 'h2') {
             self::$tree[] = array(2, $content, $tag);
             return "<h2 id=\"{$tag}\">" . $content . "</h2>";
         } else {
             if ($att == 'h3') {
                 self::$tree[] = array(3, $content, $tag);
                 return "<h3 id=\"{$tag}\">" . $content . "</h2>";
             } else {
                 if ($att == 'h4') {
                     self::$tree[] = array(4, $content, $tag);
                     return "<h4 id=\"{$tag}\">" . $content . "</h4>";
                 } else {
                     if ($att == 'h5') {
                         self::$tree[] = array(5, $content, $tag);
                         return "<h4 id=\"{$tag}\">" . $content . "</h5>";
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 public function asHtml(\Extension\bbcode\JBBCode\ElementNode $el)
 {
     $content = "";
     foreach ($el->getChildren() as $child) {
         $content .= $child->getAsHTML();
     }
     $att = $el->getAttribute();
     $contents = explode($att, $content);
     $content = '<li><strong>' . $contents[0] . ' : </strong>';
     for ($i = 1; $i < sizeof($contents); $i++) {
         $content .= $contents[$i] . ':';
     }
     $content = substr($content, 0, strlen($content) - 1);
     return $content . '</li>';
 }