Example #1
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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
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 #10
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);
 }
 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 #12
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 #13
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 #14
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 #15
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 #16
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;
 }
 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);
     }
 }