Example #1
0
 public function renderHtml()
 {
     XenForo_Application::set('view', $this);
     $bbCodeBase = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Base', array('view' => $this));
     $commentBbCode = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view', $this));
     $bbCodeParser = XenForo_BbCode_Parser::create($bbCodeBase);
     $commentBbCodeParser = XenForo_BbCode_Parser::create($commentBbCode);
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'team_post', 'contentIdKey' => 'post_id');
     $this->_params['team']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['team']['about'], $bbCodeParser);
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
     foreach ($this->_params['posts'] as &$post) {
         if (!$post['comments']) {
             continue;
         }
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($post['comments'], $commentBbCodeParser, array());
     }
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['stickyPosts'], $bbCodeParser, $bbCodeOptions);
     foreach ($this->_params['stickyPosts'] as &$post) {
         if (!$post['comments']) {
             continue;
         }
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($post['comments'], $commentBbCodeParser, array());
     }
     unset($post);
     $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate($this, 'message', '', array('json' => array('buttonConfig' => $this->_params['customEditor']), 'height' => '60px'));
 }
Example #2
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'post', 'contentIdKey' => 'post_id', 'showSignature' => XenForo_Visitor::getInstance()->get('content_show_signature'), 'states' => array());
     $this->_params['comment']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['comment'], $bbCodeParser, $bbCodeOptions);
     return array('comment' => $this->createTemplateObject('BRCR_post_comment', $this->_params));
 }
Example #3
0
 public static function preSnippet(array &$message, XenForo_BbCode_Parser $parser, array $options = array())
 {
     $options = array_merge(array('previewBreakBbCode' => 'prbreak', 'messageKey' => 'message'), $options);
     $previewFound = false;
     $tagOpen = '';
     $tagClose = '';
     if (!empty($options['previewBreakBbCode'])) {
         $textRef =& $message[$options['messageKey']];
         $tagOpen = '[' . $options['previewBreakBbCode'] . ']';
         $posOpen = stripos($textRef, $tagOpen);
         if ($posOpen !== false) {
             $tagClose = '[/' . $options['previewBreakBbCode'] . ']';
             $posClose = stripos($textRef, $tagClose, $posOpen);
             if ($posClose !== false) {
                 $previewFound = true;
                 $previewTextOffset = $posOpen + strlen($tagOpen);
                 $previewTextLength = $posClose - $posOpen - strlen($tagOpen);
                 if ($previewTextLength > 0) {
                     $textRef = substr($textRef, $previewTextOffset, $previewTextLength);
                 } else {
                     $textRef = substr($textRef, 0, $posOpen);
                 }
             }
         }
     }
     $messageHtml = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($message, $parser, $options);
     if ($previewFound) {
         $messageHtml = sprintf('%s%s%s', $tagOpen, $messageHtml, $tagClose);
     }
     return $messageHtml;
 }
Example #4
0
 public static function bbCodeWrapMessages(array &$messages, XenForo_BbCode_Parser $parser, array $options = array())
 {
     $options += array('showSignature' => XenForo_Visitor::getInstance()->get('content_show_signature'), 'states' => array());
     foreach ($messages as &$message) {
         $message['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($message, $parser, $options);
     }
 }
Example #5
0
 public function renderHtml()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewImages']));
     $this->_params['showLimitedNotice'] = $this->_params['isLimited'];
     $this->_params['update']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['update'], $bbCodeParser, $bbCodeOptions);
 }
Example #6
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['comment'], $bbCodeParser, array());
     $output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Example #7
0
 public function renderJson()
 {
     $output = array();
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
     $viewParams = $this->_params;
     unset($viewParams['posts']);
     foreach ($this->_params['posts'] as &$post) {
         $viewParams['post'] = $post;
         $template = $this->createTemplateObject('post', $viewParams);
         $output['posts'][] = $template->render();
     }
     if (XenForo_Application::getOptions()->sonnb_LiveThread_reserveOrder) {
         $lastPost = reset($this->_params['posts']);
     } else {
         $lastPost = end($this->_params['posts']);
     }
     $template = $this->createTemplateObject('', $viewParams);
     $viewOutput = $template->render();
     $output['css'] = $template->getRequiredExternals('css');
     $output['js'] = $template->getRequiredExternals('js');
     $output['lastDate'] = $lastPost['post_date'];
     $output['reserveOrder'] = isset($viewParams['reserveOrder']) ? $viewParams['reserveOrder'] : false;
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Example #8
0
 public function renderHtml()
 {
     XenForo_Application::set('view', $this);
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewImages']), 'showSignature' => false);
     $this->_params['update']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['update'], $bbCodeParser, $bbCodeOptions);
 }
Example #9
0
 public function renderHtml()
 {
     $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getQuickReplyEditor($this, 'message', $this->_params['post']['message'], array('json' => array('buttonConfig' => $this->_params['customEditor'])));
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'team_post', 'contentIdKey' => 'post_id');
     $this->_params['post']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['post'], $bbCodeParser, $bbCodeOptions);
 }
Example #10
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view' => $this)));
     //$this->_params['comment']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['comment']['message'], $bbCodeParser);
     $this->_params['comment']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['comment'], $bbCodeParser, array());
     return array('comment' => $this->createTemplateObject('Team_post_comment', $this->_params));
 }
Example #11
0
 public function renderHtml()
 {
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['messages'], $bbCodeParser);
     if (!empty($this->_params['canReplyConversation'])) {
         $this->_params['qrEditor'] = XenForo_ViewPublic_Helper_Editor::getQuickReplyEditor($this, 'message');
     }
 }
Example #12
0
 public function renderHtml()
 {
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
     if (!empty($this->_params['canQuickReply'])) {
         $this->_params['qrEditor'] = XenForo_ViewPublic_Helper_Editor::getQuickReplyEditor($this, 'message');
     }
 }
Example #13
0
 public function renderHtml()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['messages'], $bbCodeParser, $bbCodeOptions);
     if (!empty($this->_params['canReplyConversation'])) {
         $draft = isset($this->_params['conversation']['draft_message']) ? $this->_params['conversation']['draft_message'] : '';
         $this->_params['qrEditor'] = XenForo_ViewPublic_Helper_Editor::getQuickReplyEditor($this, 'message', $draft, array('extraClass' => 'NoAutoComplete', 'autoSaveUrl' => XenForo_Link::buildPublicLink('conversations/save-draft', $this->_params['conversation']), 'json' => array('placeholder' => 'reply_placeholder')));
     }
 }
Example #14
0
 public function renderHtml()
 {
     parent::renderHtml();
     $userProfileModel = XenForo_Model::create('XenForo_Model_UserProfile');
     $this->_params['user']['about'] = $userProfileModel->getAndMergeAttachmentsIntoAbout($this->_params['user']['about'], $this->_params['user']['user_id']);
     if (!empty($this->_params['user']['about']['attachments'])) {
         $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
         $bbCodeOptions = array('states' => array('viewAttachments' => true));
         $this->_params['user']['aboutHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['user']['about'], $bbCodeParser, $bbCodeOptions);
     }
 }
Example #15
0
 public function renderHtml()
 {
     /* Get the post we need to parse the content */
     $post = $this->_params['post'];
     /* Create the parser to parse the bbcodes */
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     /* Parse options */
     $bbCodeOptions = array('states' => array('viewAttachments' => true));
     /* parse the post message and merge into the post data */
     $this->_params['post']['messageParsed'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($post, $bbCodeParser, $bbCodeOptions);
 }
Example #16
0
 public function renderHtml()
 {
     parent::renderHtml();
     foreach ($this->_params['posts'] as &$message) {
         if (!empty($message['BRCR_comments'])) {
             $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
             $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'post', 'contentIdKey' => 'post_id');
             XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($message['BRCR_comments'], $bbCodeParser, $bbCodeOptions);
         }
     }
 }
 public function renderHtml()
 {
     parent::renderHtml();
     $visitor = XenForo_Visitor::getInstance();
     $userModel = XenForo_Model::create('XenForo_Model_User');
     $parentFieldLocks = $userModel->getParentFieldLocks();
     if (isset($parentFieldLocks['signature'])) {
         $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
         $signature['message'] = $visitor['signature'] . "\n";
         $this->_params['signatureEditor'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($signature, $bbCodeParser);
     }
 }
Example #18
0
 public function renderJson()
 {
     $options = XenForo_Application::get('options');
     $formatter = XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_Tenori', array('view' => $this));
     switch ($options->dark_taigachat_bbcode) {
         case 'Full':
             $formatter->displayableTags = true;
             break;
         case 'Basic':
         default:
             $formatter->displayableTags = array('img', 'url', 'email', 'b', 'u', 'i', 's', 'color');
             break;
         case 'None':
             $formatter->displayableTags = array('url', 'email');
             break;
     }
     $formatter->getTagsAgain();
     $parser = new XenForo_BbCode_Parser($formatter);
     if ($options->dark_taigachat_imagemode == 'Link') {
         foreach ($this->_params['taigachat']['messages'] as &$message) {
             $message['message'] = str_ireplace(array("[img]", "[/img]"), array("[url]", "[/url]"), $message['message']);
         }
     }
     $maxid = $this->_params['taigachat']['lastrefresh'];
     foreach ($this->_params['taigachat']['messages'] as &$message) {
         if ($options->dark_taigachat_bbcode == 'Full') {
             $message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
         } else {
             // We don't want to parse youtube etc. urls if [media] is disabled
             $autoLinkParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_BbCode_AutoLink', false));
             $message['message'] = $autoLinkParser->render($message['message']);
         }
         if ($message['id'] > $maxid) {
             $maxid = $message['id'];
         }
     }
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['taigachat']['messages'], $parser);
     if ($options->dark_taigachat_direction) {
         $this->_params['taigachat']['messages'] = array_reverse($this->_params['taigachat']['messages']);
     }
     $template = $this->createTemplateObject($this->_templateName, $this->_params);
     $template->setParams($this->_params);
     $rendered = $template->render();
     $rendered = preg_replace('/\\s+<\\/(.*?)>\\s+</si', ' </$1> <', $rendered);
     $rendered = preg_replace('/\\s+<(.*?)([ >])/si', ' <$1$2', $rendered);
     //$rendered = str_replace(array("\r", "\n", "\t"), "", $rendered);
     $derp = XenForo_ViewRenderer_Json::jsonEncodeForOutput(array("templateHtml" => $rendered, "reverse" => $options->dark_taigachat_direction, "lastrefresh" => $maxid));
     $extraHeaders = XenForo_Application::gzipContentIfSupported($derp);
     foreach ($extraHeaders as $extraHeader) {
         header("{$extraHeader['0']}: {$extraHeader['1']}", $extraHeader[2]);
     }
     return $derp;
 }
Example #19
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view' => $this)));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['comments'], $bbCodeParser, array());
     $comments = array();
     if ($this->_params['post']['first_comment_date'] < $this->_params['firstCommentShown']['comment_date']) {
         $comments[] = $this->createTemplateObject('Team_post_comments_before', $this->_params);
     }
     foreach ($this->_params['comments'] as $comment) {
         $comments[] = $this->createTemplateObject('Team_post_comment', array('comment' => $comment) + $this->_params);
     }
     return array('comments' => $comments);
 }
Example #20
0
 public static function getHtml(&$message)
 {
     static $bbCodeParser = false;
     if ($bbCodeParser === false) {
         $formatter = XenForo_BbCode_Formatter_Base::create('Base');
         if (XenForo_Application::$versionId >= 1020000) {
             $bbCodeParser = XenForo_BbCode_Parser::create($formatter);
         } else {
             $bbCodeParser = new XenForo_BbCode_Parser($formatter);
         }
     }
     return XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($message, $bbCodeParser);
 }
Example #21
0
 public static function helperPreparePostDataForDisplay($posts)
 {
     $bbCodeFormatter = XenForo_BbCode_Formatter_Base::create('Base');
     $bbCodeParser = new XenForo_BbCode_Parser($bbCodeFormatter);
     $bbCodeOptions = array('states' => array('viewAttachments' => true));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($posts, $bbCodeParser, $bbCodeOptions);
     foreach ($posts as &$message) {
         $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text'));
         $message['messageText'] = $bbCodeParser->render(str_ireplace('\\n', ' ', $message['message']));
         $message['messageText'] = str_ireplace("\n", " ", $message['messageText']);
     }
     return $posts;
 }
Example #22
0
 public function renderJson()
 {
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['posts'], $bbCodeParser, $bbCodeOptions);
     $output = array('messagesTemplateHtml' => array());
     foreach ($this->_params['posts'] as $postId => $post) {
         $output['messagesTemplateHtml']["#post-{$postId}"] = $this->createTemplateObject('post', array_merge($this->_params, array('post' => $post)))->render();
     }
     $template = $this->createTemplateObject('', array());
     $output['css'] = $template->getRequiredExternals('css');
     $output['js'] = $template->getRequiredExternals('js');
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Example #23
0
 public function renderHtml()
 {
     XenForo_Application::set('view', $this);
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'team_event', 'contentIdKey' => 'event_id');
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $event =& $this->_params['event'];
     $event['message'] = $event['event_description'];
     unset($event['event_description']);
     $event['descriptionHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($event, $bbCodeParser, $bbCodeOptions);
     $commentBbCode = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view' => $this)));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['comments'], $commentBbCode, array());
     // Simple comment form
     $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate($this, 'message', '', array('extraClass' => 'NoAutoComplete', 'json' => array('buttonConfig' => $this->_params['configButtons'])));
 }
Example #24
0
 public function renderJson()
 {
     $comments = array();
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']), 'contentType' => 'post', 'contentIdKey' => 'post_id', 'showSignature' => XenForo_Visitor::getInstance()->get('content_show_signature'), 'states' => array());
     if ($this->_params['firstDate'] < $this->_params['firstCommentShown']['post_date']) {
         $comments[] = $this->createTemplateObject('BRCR_post_comments_before', $this->_params);
     }
     foreach ($this->_params['comments'] as $comment) {
         $comment['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($comment, $bbCodeParser, $bbCodeOptions);
         $comment['BRCR_first_comment'] = array('post_date' => $this->_params['firstDate']);
         $comments[] = $this->createTemplateObject('BRCR_post_comment', array('comment' => $comment) + $this->_params);
     }
     return array('comments' => $comments);
 }
Example #25
0
 public function renderJson()
 {
     $bbCodeBase = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Base', array('view' => $this));
     $commentBbCode = XenForo_BbCode_Formatter_Base::create('Nobita_Teams_BbCode_Formatter_Comment', array('view', $this));
     $bbCodeParser = XenForo_BbCode_Parser::create($bbCodeBase);
     $commentBbCodeParser = XenForo_BbCode_Parser::create($commentBbCode);
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewAttachments']));
     $this->_params['post']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['post'], $bbCodeParser, $bbCodeOptions);
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['post']['comments'], $commentBbCodeParser, array());
     $output = array('messagesTemplateHtml' => array());
     $post = $this->_params['post'];
     $output['messagesTemplateHtml']["#post-{$post['post_id']}"] = $this->createTemplateObject('Team_post', array_merge($this->_params, array('post' => $post)))->render();
     $template = $this->createTemplateObject('', array());
     $output['css'] = $template->getRequiredExternals('css');
     $output['js'] = $template->getRequiredExternals('js');
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
 }
Example #26
0
 public static function prepareMessage($item, XenForo_BbCode_Parser $bbCodeParser, array $bbCodeOptions, XenForo_View $view)
 {
     $message = $item['data']['message'];
     if ($bbCodeOptions['states']['viewAttachments']) {
         $string = preg_replace('#\\[(quoteee)[^\\]]*\\].*\\[/\\1\\]#siU', ' ', $message);
     } else {
         $string = preg_replace('#\\[(attach|quote)[^\\]]*\\].*\\[/\\1\\]#siU', ' ', $message);
     }
     $formatter = XenForo_BbCode_Formatter_Base::create('ImageCount');
     $parser = XenForo_BbCode_Parser::create($formatter);
     $parser->render($string);
     if (isset($item['data']['attachments'])) {
         $item['attachments'] = $item['data']['attachments'];
     }
     $item['mediaCount'] = $formatter->getMediaCount();
     $item['message'] = XenForo_Helper_String::wholeWordTrim($string, SimplePortal_Static::option('charlimit'));
     $item['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($item, $bbCodeParser, $bbCodeOptions);
     if (strpos($item['messageHtml'], SimplePortal_Static::PORTAL_PREVIEW_ENDSTRING)) {
         $item['messageHtml'] = strstr($item['messageHtml'], SimplePortal_Static::PORTAL_PREVIEW_ENDSTRING, true);
     }
     return $item;
 }
 public function renderHtml()
 {
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['messages'], $bbCodeParser);
 }
Example #28
0
 public static function processMessagesForView(&$params, &$view)
 {
     $options = XenForo_Application::get('options');
     $formatter = XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_Tenori', array('view' => $view));
     switch ($options->dark_taigachat_bbcode) {
         case 'Full':
             $formatter->displayableTags = true;
             break;
         case 'Basic':
         default:
             $formatter->displayableTags = array('img', 'url', 'email', 'b', 'u', 'i', 's', 'color');
             break;
         case 'None':
             $formatter->displayableTags = array('url', 'email');
             break;
     }
     $formatter->getTagsAgain();
     $parser = new XenForo_BbCode_Parser($formatter);
     if ($options->dark_taigachat_imagemode == 'Link') {
         foreach ($params['taigachat']['messages'] as &$message) {
             $message['message'] = str_ireplace(array("[img]", "[/img]"), array("[url]", "[/url]"), $message['message']);
         }
     }
     $maxid = $params['taigachat']['lastrefresh'];
     foreach ($params['taigachat']['messages'] as &$message) {
         if ($options->dark_taigachat_bbcode == 'Full') {
             $message['message'] = XenForo_Helper_String::autoLinkBbCode($message['message']);
         } else {
             // We don't want to parse youtube etc. urls if [media] is disabled
             $autoLinkParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Dark_TaigaChat_BbCode_Formatter_BbCode_AutoLink', false));
             $message['message'] = $autoLinkParser->render($message['message']);
         }
         if ($message['id'] > $maxid) {
             $maxid = $message['id'];
         }
         if (substr($message['message'], 0, 3) == '/me') {
             $message['message'] = substr($message['message'], 4);
             $message['me'] = true;
         }
     }
     if ($options->dark_taigachat_smilies) {
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($params['taigachat']['messages'], $parser);
     } else {
         XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($params['taigachat']['messages'], $parser, array("states" => array("stopSmilies" => true)));
     }
     if ($options->dark_taigachat_direction) {
         $params['taigachat']['messages'] = array_reverse($params['taigachat']['messages']);
     }
     return $maxid;
 }
 protected function _prepareThreads(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject, array &$threads)
 {
     $core = WidgetFramework_Core::getInstance();
     $layoutNeedPost = $renderTemplateObject->getParam('layoutNeedPost');
     /** @var WidgetFramework_XenForo_Model_Thread $threadModel */
     $threadModel = $core->getModelFromCache('XenForo_Model_Thread');
     /** @var XenForo_Model_Node $nodeModel */
     $nodeModel = $core->getModelFromCache('XenForo_Model_Node');
     /** @var XenForo_Model_Forum $forumModel */
     $forumModel = $core->getModelFromCache('XenForo_Model_Forum');
     /** @var XenForo_Model_User $userModel */
     $userModel = $core->getModelFromCache('XenForo_Model_User');
     /** @var XenForo_Model_Post $postModel */
     $postModel = $core->getModelFromCache('XenForo_Model_Post');
     $nodePermissions = $nodeModel->getNodePermissionsForPermissionCombination(empty($widget['options']['as_guest']) ? null : 1);
     $viewObj = self::getViewObject($params, $renderTemplateObject);
     if ($layoutNeedPost and !empty($viewObj)) {
         $bbCodeFormatter = XenForo_BbCode_Formatter_Base::create('Base', array('view' => $viewObj));
         if (XenForo_Application::$versionId < 1020000) {
             // XenForo 1.1.x
             $bbCodeParser = new XenForo_BbCode_Parser($bbCodeFormatter);
         } else {
             // XenForo 1.2.x
             $bbCodeParser = XenForo_BbCode_Parser::create($bbCodeFormatter);
         }
         $bbCodeOptions = array('states' => array(), 'contentType' => 'post', 'contentIdKey' => 'post_id');
         $postsWithAttachment = array();
         foreach (array_keys($threads) as $threadId) {
             $threadRef =& $threads[$threadId];
             if (empty($threadRef['attach_count'])) {
                 continue;
             }
             if (!empty($threadRef['fetched_last_post'])) {
                 $postsWithAttachment[$threadRef['last_post_id']] = array('post_id' => $threadRef['last_post_id'], 'thread_id' => $threadId, 'attach_count' => $threadRef['attach_count']);
             } else {
                 $postsWithAttachment[$threadRef['first_post_id']] = array('post_id' => $threadRef['first_post_id'], 'thread_id' => $threadId, 'attach_count' => $threadRef['attach_count']);
             }
         }
         if (!empty($postsWithAttachment)) {
             $postsWithAttachment = $postModel->getAndMergeAttachmentsIntoPosts($postsWithAttachment);
             foreach ($postsWithAttachment as $postWithAttachment) {
                 if (empty($postWithAttachment['attachments'])) {
                     continue;
                 }
                 if (empty($threads[$postWithAttachment['thread_id']])) {
                     continue;
                 }
                 $threadRef =& $threads[$postWithAttachment['thread_id']];
                 $threadRef['attachments'] = $postWithAttachment['attachments'];
             }
         }
     }
     $threadForumIds = array();
     foreach ($threads as $thread) {
         $threadForumIds[] = $thread['node_id'];
     }
     $threadForums = $forumModel->getForumsByIds($threadForumIds);
     $viewingUser = empty($widget['options']['as_guest']) ? null : $userModel->getVisitingGuestUser();
     foreach (array_keys($threads) as $threadId) {
         $threadRef =& $threads[$threadId];
         if (empty($nodePermissions[$threadRef['node_id']])) {
             unset($threads[$threadId]);
             continue;
         }
         $threadPermissionsRef =& $nodePermissions[$threadRef['node_id']];
         if (empty($threadForums[$threadRef['node_id']])) {
             unset($threads[$threadId]);
             continue;
         }
         $threadForumRef =& $threadForums[$threadRef['node_id']];
         if ($threadModel->isRedirect($threadRef)) {
             unset($threads[$threadId]);
             continue;
         }
         if (!$threadModel->canViewThread($threadRef, $threadForumRef, $null, $threadPermissionsRef, $viewingUser)) {
             unset($threads[$threadId]);
             continue;
         }
         if (!empty($bbCodeParser) and !empty($bbCodeOptions)) {
             $threadBbCodeOptions = $bbCodeOptions;
             $threadBbCodeOptions['states']['viewAttachments'] = $threadModel->canViewAttachmentsInThread($threadRef, $threadForumRef, $null, $threadPermissionsRef, $viewingUser);
             $threadRef['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($threadRef, $bbCodeParser, $threadBbCodeOptions);
         }
         $threadRef = $threadModel->WidgetFramework_prepareThreadForRendererThreads($threadRef, $threadForumRef, $threadPermissionsRef, $viewingUser);
     }
 }
Example #30
0
 public function renderHtml()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $bbCodeOptions = array('states' => array('viewAttachments' => $this->_params['canViewImages']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['updates'], $bbCodeParser, $bbCodeOptions);
 }