Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // :3
- class Dark_TaigaChat_BbCode_Formatter_Tenori extends XenForo_BbCode_Formatter_Base
- {
- /**
- * List of tags which should be displayed
- *
- * @var boolean|array True=all, false=none, array=display these
- */
- public $displayableTags = true;
- public function getTagsAgain(){
- $this->_tags = null;
- $this->_tags = $this->getTags();
- $this->preLoadData();
- }
- public function getTags()
- {
- if ($this->_tags !== null)
- {
- return $this->_tags;
- }
- $tags = parent::getTags();
- foreach ($tags AS $tagName => &$tag)
- {
- if ($this->displayableTags === false || (is_array($this->displayableTags) && !in_array($tagName, $this->displayableTags)))
- {
- unset($tags[$tagName]);
- }
- }
- return $tags;
- }
- protected static $_taggedUsers = array();
- /**
- *
- * @see XenForo_BbCode_Formatter_Base::renderTagUser()
- */
- public function renderTagUser(array $tag, array $rendererStates)
- {
- $content = $this->renderSubTree($tag['children'], $rendererStates);
- if ($content === '') {
- return '';
- }
- $userId = intval($tag['option']);
- if (!$userId) {
- return $content;
- }
- $link = XenForo_Link::buildPublicLink('full:members', array(
- 'user_id' => $userId
- ));
- $username = $this->stringifyTree($tag['children']);
- if (empty(self::$_taggedUsers[$userId])) {
- $userModel = XenForo_Model::create('XenForo_Model_User');
- $user = $userModel->getUserById($userId, array());
- self::$_taggedUsers[$userId] = $user;
- } else {
- $user = self::$_taggedUsers[$userId];
- }
- $content = '<span class="style' . $user['display_style_group_id'] . '">' . $content . '</span>';
- return $this->_wrapInHtml(
- '<a href="' . htmlspecialchars($link) . '" class="username" data-user="' . $userId . ', ' .
- htmlspecialchars($username) . '">', '</a>', $content);
- } /* END renderTagUser */
- }
Add Comment
Please, Sign In to add comment