*/ class Quote extends CodeDefinition { /** * Constructor. */ public function __construct() { parent::__construct(); $this->setTagName("quote"); $this->setUseOption(true); $this->setParseContent(true); } /** * Compiles the user bbcode to HTML * * @param ElementNode $el The JBBCode element node. * * @return string The compiled HTML. */ public function asHtml(ElementNode $el) { global $currentUser; $attr = $el->getAttribute()['quote']; if (substr($attr, 0, 1) === '#') { $postId = substr($attr, 1); $post = new Post($postId); $forum = new Forum($post->forum); if ($post->id !== 0 && $forum->permission(ForumPerms::VIEW, $currentUser->id)) { $postLink = Router::route('forums.post', $post->id); $content = "
" . "" . "{$post->poster->username} wrote
" . "
{$post->parsed}
"; return $content; } } $content = ""; foreach ($el->getChildren() as $child) { $content .= $child->getAsHTML(); } return "
{$attr} wrote
{$content}
"; } }