Example #1
0
 /**
  * Debug helper to print the tag tree in HTML format.
  *
  * @param XenForo_Html_Tag $tag Current/root tag
  * @param string $prefix Prefix for each line
  */
 public function printTags(XenForo_Html_Tag $tag, $prefix = '')
 {
     echo $prefix . 'Tag: ' . $tag->tagName() . ' ' . json_encode($tag->attributes()) . "<br />\n";
     $childPrefix = "{$prefix}&nbsp; &nbsp; ";
     foreach ($tag->children() as $child) {
         if ($child instanceof XenForo_Html_Tag) {
             $this->printTags($child, $childPrefix);
         } else {
             echo $childPrefix . "'" . htmlspecialchars($child) . "'<br />\n";
         }
     }
 }
Example #2
0
 /**
  * Handles heading tags.
  *
  * @param string $text Child text of the tag
  * @param XenForo_Html_Tag $tag HTML tag triggering call
  *
  * @return string
  */
 public function handleTagH($text, XenForo_Html_Tag $tag)
 {
     switch ($tag->tagName()) {
         case 'h1':
             $size = 6;
             break;
         case 'h2':
             $size = 5;
             break;
         case 'h3':
             $size = 4;
             break;
         case 'h4':
             $size = 3;
             break;
         default:
             $size = false;
     }
     $text = '[B]' . $text . '[/B]';
     if ($size) {
         $text = '[SIZE=' . $size . ']' . $text . '[/SIZE]';
     }
     return $text . "\n";
 }