Exemplo n.º 1
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);
 }
Exemplo n.º 2
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'));
 }
Exemplo n.º 3
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');
     }
 }
Exemplo n.º 4
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');
     }
 }
Exemplo n.º 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['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')));
     }
 }
Exemplo n.º 6
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);
         }
     }
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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'])));
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
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);
 }
Exemplo n.º 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['canViewImages']));
     XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($this->_params['updates'], $bbCodeParser, $bbCodeOptions);
 }
Exemplo n.º 14
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);
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
0
 public function renderHtml()
 {
     $response = parent::renderHtml();
     if (empty($this->_params['layout1'])) {
         return $response;
     }
     $this->_params['layout2'] = empty($this->_params['layout2']) ? false : $this->_params['layout2'];
     $this->_params['layout3'] = empty($this->_params['layout3']) ? false : $this->_params['layout3'];
     $this->_params['cookie'] = empty($this->_params['cookie']) ? false : $this->_params['cookie'];
     $this->_params['category'] = empty($this->_params['category']) ? false : $this->_params['category'];
     $isPortal = empty($this->_params['isPortal']) ? false : true;
     $isArticle = empty($this->_params['isArticle']) ? false : true;
     $blocksModel = XenForo_Model::create('EWRporta_Model_Blocks');
     $blocks = $blocksModel->getBlocks($this->_params['cookie'], $this->_params['layout1'], $this->_params['layout2'], $this->_params['layout3']);
     if (empty($blocks)) {
         return $response;
     }
     if ($isArticle && !empty($this->_params['thread']['first_post_id'])) {
         $this->_params['posts'][$this->_params['thread']['first_post_id']]['attachments'] = false;
         $this->_params['posts'][$this->_params['thread']['first_post_id']]['signature'] = false;
     }
     $cachesModel = XenForo_Model::create('EWRporta_Model_Caches');
     $caches = $cachesModel->getCaches();
     $optionsModel = XenForo_Model::create('EWRporta_Model_Options');
     $options = $optionsModel->getOptions();
     $visitor = XenForo_Visitor::getInstance();
     $_blocks = array('top-left' => array(), 'top-right' => array(), 'mid-left' => array(), 'mid-right' => array(), 'btm-left' => array(), 'btm-right' => array(), 'sidebar' => array());
     foreach ($blocks as $block) {
         if ($block['position'] == 'disabled') {
             continue;
         }
         if (!$isPortal && ($block['position'] == 'mid-left' || $block['position'] == 'mid-right')) {
             continue;
         }
         if (!empty($block['groups'])) {
             $groups = explode(',', $block['groups']);
             $member = false;
             foreach ($groups as $group) {
                 if ($visitor->isMemberOf($group)) {
                     $member = true;
                     break;
                 }
             }
             if ($block['display'] == 'hide' && $member) {
                 continue;
             }
             if ($block['display'] == 'show' && !$member) {
                 continue;
             }
         }
         $block['layout'] = $this->_params['layout1'];
         $block['category'] = $this->_params['category'];
         $block['caches'] = !empty($caches[$block['block_id']]) ? $caches[$block['block_id']] : false;
         $block['options'] = !empty($options[$block['block_id']]) ? $options[$block['block_id']] : false;
         $page = $isPortal ? $this->_params['page'] : false;
         $params = $blocksModel->getBlockParams($block, $page);
         if (!empty($params[$block['block_id']]) && $params[$block['block_id']] == 'killModule') {
             continue;
         }
         if (!empty($params['option']['parseBB'])) {
             $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
             $bbCodeOptions = array('states' => array('viewAttachments' => true));
             XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($params[$block['block_id']], $bbCodeParser, $bbCodeOptions);
         }
         if (!empty($params['option']['parseText'])) {
             foreach ($params[$block['block_id']] 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']);
             }
         }
         $object = $this->createTemplateObject('EWRblock_' . $block['block_id'], $params);
         switch ($block['position']) {
             case 'top-left':
                 $_blocks['top-left'][] = $object;
                 break;
             case 'top-right':
                 $_blocks['top-right'][] = $object;
                 break;
             case 'mid-left':
                 $_blocks['mid-left'][] = $object;
                 break;
             case 'mid-right':
                 $_blocks['mid-right'][] = $object;
                 break;
             case 'btm-left':
                 $_blocks['btm-left'][] = $object;
                 break;
             case 'btm-right':
                 $_blocks['btm-right'][] = $object;
                 break;
             case 'sidebar':
                 $_blocks['sidebar'][] = $object;
                 break;
         }
     }
     $this->_params['blocks'] = $_blocks;
     return $response;
 }