コード例 #1
0
ファイル: MediaView.php プロジェクト: Sywooch/forums
 public function renderHtml()
 {
     $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['media']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['media']['media_description'], $bbCodeParser);
     $bbCodeStripper = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text'));
     $this->_params['media']['TEXT'] = $bbCodeStripper->render($this->_params['media']['media_description']);
 }
コード例 #2
0
ファイル: Preview.php プロジェクト: hahuunguyen/DTUI_201105
 public function renderHtml()
 {
     $previewLength = XenForo_Application::get('options')->discussionPreviewLength;
     if ($previewLength && !empty($this->_params['post'])) {
         $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
         $parser = new XenForo_BbCode_Parser($formatter);
         $this->_params['post']['messageParsed'] = $parser->render($this->_params['post']['message']);
     }
 }
コード例 #3
0
ファイル: Subscriptions.php プロジェクト: Sywooch/forums
 public function actionGetSubscriptions()
 {
     $page = max($this->_input->filterSingle('page', XenForo_Input::UINT), 1);
     $perpage = $this->_input->filterSingle('perpage', XenForo_Input::UINT);
     if (!$perpage) {
         $perpage = XenForo_Application::get('options')->discussionsPerPage;
     }
     $previewtype = $this->_input->filterSingle('previewtype', XenForo_Input::UINT);
     if (!$previewtype) {
         $previewtype = 2;
     }
     $visitor = XenForo_Visitor::getInstance();
     $watch_model = $this->_getThreadWatchModel();
     $threads = $watch_model->getThreadsWatchedByUser($visitor['user_id'], false, array('join' => XenForo_Model_Thread::FETCH_FORUM | XenForo_Model_Thread::FETCH_USER, 'readUserId' => $visitor['user_id'], 'page' => $page, 'perPage' => $perpage, 'postCountUserId' => $visitor['user_id'], 'permissionCombinationId' => $visitor['permission_combination_id']));
     $threads = $watch_model->unserializePermissionsInList($threads, 'node_permission_cache');
     $threads = $watch_model->getViewableThreadsFromList($threads);
     $threads = $this->_prepareWatchedThreads($threads);
     $total = $watch_model->countThreadsWatchedByUser($visitor['user_id']);
     $this->canonicalizePageNumber($page, $perpage, $total, 'watched/threads/all');
     $thread_data = array();
     $thread_model = $this->_getThreadModel();
     $post_model = $this->getModelFromCache('XenForo_Model_Post');
     $preview_length = XenForo_Application::get('options')->discussionPreviewLength;
     $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
     $parser = new XenForo_BbCode_Parser($formatter);
     foreach ($threads as &$thread) {
         $out = array('thread_id' => $thread['thread_id'], 'forum_title' => prepare_utf8_string($thread['node_title']), 'new_posts' => $thread['isNew'], 'forum_id' => $thread['node_id'], 'total_posts' => $thread['reply_count'] + 1, 'thread_title' => prepare_utf8_string(strip_tags($thread['title'])), 'post_lastposttime' => prepare_utf8_string(XenForo_Locale::dateTime($thread['last_post_date'], 'absolute')));
         if ($previewtype == 1) {
             $out += array('post_username' => prepare_utf8_string(strip_tags($thread['username'])), 'post_userid' => $thread['user_id']);
         } else {
             $out += array('post_username' => prepare_utf8_string(strip_tags($thread['last_post_username'])), 'post_userid' => $thread['last_post_user_id']);
         }
         $post = $post_model->getPostById($thread[$previewtype == 1 ? 'first_post_id' : 'last_post_id'], array('join' => XenForo_Model_Post::FETCH_USER));
         $avatarurl = process_avatarurl(XenForo_Template_Helper_Core::getAvatarUrl($post, 'm'));
         if (strpos($avatarurl, '/xenforo/avatars/avatar_') !== false) {
             $avatarurl = '';
         }
         if ($avatarurl != '') {
             $out['avatarurl'] = $avatarurl;
         }
         $preview = '';
         if ($preview_length) {
             $preview = $parser->render($post['message']);
         }
         if ($preview != '') {
             $out['thread_preview'] = prepare_utf8_string(html_entity_decode($preview));
         }
         if ($thread['discussion_type'] == 'poll') {
             $out['poll'] = true;
         }
         $thread_data[] = $out;
     }
     $out = array('threads' => $thread_data, 'total_threads' => $total);
     return $out;
 }
コード例 #4
0
ファイル: List.php プロジェクト: Sywooch/forums
 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;
 }
コード例 #5
0
ファイル: Post.php プロジェクト: Sywooch/forums
 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;
 }
コード例 #6
0
ファイル: List.php プロジェクト: Sywooch/forums
 public function renderRss()
 {
     $xenOptions = XenForo_Application::getOptions();
     if ($xenOptions->sonnbXG_enableRSS) {
         $title = new XenForo_Phrase('sonnb_xengallery');
         $title = $title->render();
         $description = new XenForo_Phrase('sonnb_xengallery_short_description', array('title' => $xenOptions->boardTitle));
         $description = $description->render();
         $buggyXmlNamespace = defined('LIBXML_DOTTED_VERSION') && LIBXML_DOTTED_VERSION == '2.6.24';
         $feed = new Zend_Feed_Writer_Feed();
         $feed->setEncoding('utf-8');
         $feed->setTitle($title);
         $feed->setDescription($description);
         $feed->setLink(XenForo_Link::buildPublicLink('canonical:gallery'));
         if (!$buggyXmlNamespace) {
             $feed->setFeedLink(XenForo_Link::buildPublicLink('canonical:gallery/index.rss'), 'rss');
         }
         $feed->setDateModified(XenForo_Application::$time);
         $feed->setLastBuildDate(XenForo_Application::$time);
         $feed->setGenerator($title);
         $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text', array('view' => $this));
         $parser = new XenForo_BbCode_Parser($formatter);
         foreach ($this->_params['albums'] as $album) {
             $albumDescription = $parser->render($album['description']);
             $entry = $feed->createEntry();
             if (!empty($album['contents'])) {
                 $albumDescription .= '<br /><br />';
                 foreach ($album['contents'] as $content) {
                     $albumDescription .= '<a href="' . XenForo_Link::buildPublicLink('canonical:gallery/' . $content['content_type'] . 's', $content) . '"><img src="' . XenForo_Link::convertUriToAbsoluteUri($content['thumbnailUrl'], true) . '" /></a>';
                 }
             }
             if ($albumDescription) {
                 $entry->setDescription($albumDescription);
             }
             $entry->setTitle($album['title'] ? $album['title'] : $album['title'] . ' ');
             $entry->setLink(XenForo_Link::buildPublicLink('canonical:gallery/albums', $album));
             $entry->setDateCreated(new Zend_Date($album['album_date'], Zend_Date::TIMESTAMP));
             $entry->setDateModified(new Zend_Date($album['album_updated_date'], Zend_Date::TIMESTAMP));
             if (!$buggyXmlNamespace) {
                 $entry->addAuthor(array('name' => $album['username'], 'uri' => XenForo_Link::buildPublicLink('canonical:gallery/authors', $album)));
                 if ($album['comment_count']) {
                     $entry->setCommentCount($album['comment_count']);
                     $entry->setCommentLink(XenForo_Link::buildPublicLink('canonical:gallery/albums', $album) . '#album-' . $album['album_id']);
                 }
             }
             $feed->addEntry($entry);
         }
         return $feed->export('rss');
     }
 }
コード例 #7
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']);
         }
     }
     $maxUpdate = $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['last_update'] > $maxUpdate) {
             $maxUpdate = $message['last_update'];
         }
         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 max($maxUpdate, XenForo_Application::getSimpleCacheData('taigachat_lastUpdate'));
 }
コード例 #8
0
ファイル: Extra.php プロジェクト: Sywooch/forums
 public function renderHtml()
 {
     XenForo_Application::set('view', $this);
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['team']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['team']['about'], $bbCodeParser);
     foreach ($this->_params['customFieldsGrouped'] as $id => &$fields) {
         if (empty($fields['fieldChoices'])) {
             // hard remove if custom fields did not have any values
             // @link https://nobita.me/threads/227/
             unset($this->_params['customFieldsGrouped'][$id]);
             continue;
         }
         foreach ($fields as &$field) {
             if ($field['field_type'] == 'bbcode') {
                 $field['fieldValueHtml'] = new XenForo_BbCode_TextWrapper($field['field_value'], $bbCodeParser);
             } else {
                 $field['fieldValueHtml'] = Nobita_Teams_ViewPublic_Helper_Team::getTeamFieldValueHtml($this->_params['team'], $field, $field['field_value']);
             }
         }
     }
     unset($fields, $field);
     foreach ($this->_params['parentTabsGrouped'] as &$fields) {
         foreach ($fields as &$field) {
             if ($field['field_type'] == 'bbcode') {
                 $field['fieldValueHtml'] = new XenForo_BbCode_TextWrapper($field['field_value'], $bbCodeParser);
             } else {
                 $field['fieldValueHtml'] = Nobita_Teams_ViewPublic_Helper_Team::getTeamFieldValueHtml($this->_params['team'], $field, $field['field_value']);
             }
         }
     }
 }
コード例 #9
0
 public function renderHtml()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $fields =& $this->_params['fields'];
     foreach ($fields as $fieldId => &$field) {
         if ($field['field_type'] == 'wysiwyg') {
             $field['editor'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate($this, 'fields[' . $field['field_id'] . '][editor]', $field['default_value'], array('editorId' => $fieldId . '_editor'));
         }
         if ($field['field_type'] == 'rating') {
             $field['fieldChoices'] = array();
             for ($i = 1; $i <= XenForo_Application::getOptions()->lpsfRatingMax; $i++) {
                 $field['fieldChoices'][] = $i;
             }
         }
         // render the pre text
         if ($field['pre_text'] != '') {
             $field['pre_text'] = new XenForo_BbCode_TextWrapper($field['pre_text'], $bbCodeParser);
         }
         // render the post text
         if ($field['post_text'] != '') {
             $field['post_text'] = new XenForo_BbCode_TextWrapper($field['post_text'], $bbCodeParser);
         }
         // datetime default_value editor
         if (array_key_exists('field_type', $field) && $field['field_type'] == 'datetime') {
             $temp = explode(' ', $field['default_value']);
             if (count($temp) == 2) {
                 $field['default_value'] = array('date' => $temp[0], 'time' => $temp[1]);
             } else {
                 $field['default_value'] = array('date' => '', 'time' => '');
             }
         }
     }
 }
コード例 #10
0
ファイル: Preview.php プロジェクト: namgiangle90/tokyobaito
 public function renderHtml()
 {
     XenForo_Template_Helper_Core::setThreadPrefixes($this->_params['prefixes']);
     // don't pass a view to this, because the templates don't exist in the admin
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base'));
     $this->_params['entry']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['entry']['message'], $bbCodeParser);
 }
コード例 #11
0
ファイル: Wall.php プロジェクト: Sywooch/forums
 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'));
 }
コード例 #12
0
ファイル: Helper.php プロジェクト: Sywooch/forums
 public static function renderGalleryComment(XenForo_BbCode_Parser $parser, &$message)
 {
     if (XenForo_Application::getOptions()->sonnbXG_extraBbcode) {
         self::$_tags = array_merge(self::$_tags, array('img', 'media'));
     }
     $message = preg_replace(array('/(\\[url\\]\\[url\\])/i', '/(\\[\\/url\\]\\[\\/url\\])/i'), array('[url]', '[/url]'), $message);
     $message = XenForo_Helper_String::censorString($message);
     $message = self::linkTaggedPlainText($message);
     $tags = $parser->parse($message);
     if (!empty($tags)) {
         $tags = self::_processTags($tags);
     }
     $extraStates = array('stopLineBreakConversion' => 1);
     $message = new XenForo_BbCode_TextWrapper($tags, $parser, $extraStates);
     return $message;
 }
コード例 #13
0
ファイル: Comment.php プロジェクト: Sywooch/forums
 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);
 }
コード例 #14
0
ファイル: Description.php プロジェクト: Sywooch/forums
 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);
 }
コード例 #15
0
ファイル: Comment.php プロジェクト: darkearl/projectT122015
 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));
 }
コード例 #16
0
ファイル: ViewAjax.php プロジェクト: Sywooch/forums
 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);
 }
コード例 #17
0
ファイル: Comment.php プロジェクト: Sywooch/forums
 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));
 }
コード例 #18
0
ファイル: Post.php プロジェクト: Sywooch/forums
 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);
 }
コード例 #19
0
ファイル: Post.php プロジェクト: ThemeHouse-XF/ImageRestrict
 protected function _processImageRestrictionLinks()
 {
     $users = $this->get('imagerestriction_users');
     if (!is_array($users)) {
         $users = @unserialize($users);
     }
     if (empty($users)) {
         $users = array();
     }
     if (!empty($users)) {
         $message = $this->get('message');
         $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('ThemeHouse_ImageRestrict_BbCode_Formatter_Reverse', array('smilies' => array(), 'bbCode' => array())));
         $message = $bbCodeParser->render($message, array('attachment_hash' => $this->getExtraData(XenForo_DataWriter_DiscussionMessage::DATA_ATTACHMENT_HASH), 'post_id' => $this->get('post_id'), 'stopLineBreakConversion' => true));
         $this->set('message', $message);
         $this->_updateImageRestrictionMask = true;
     }
 }
コード例 #20
0
ファイル: DLE.php プロジェクト: dautushenka/dle-xenforo
 /**
  * @return XenForo_BbCode_Parser
  */
 protected function _getXenParser()
 {
     static $parse = null;
     if (!$parse) {
         $parse = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base'));
     }
     return $parse;
 }
コード例 #21
0
 public function renderHtml()
 {
     $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Base', array('view' => $this));
     $parser = XenForo_BbCode_Parser::create($formatter);
     foreach ($this->_params['posts'] as $postId => $post) {
         $this->_params['posts'][$postId]['messageParsed'] = $parser->render($post['message']);
     }
 }
コード例 #22
0
ファイル: Tooltip.php プロジェクト: ThemeHouse-XF/Biblea
 public function renderHtml()
 {
     if (!empty($this->_params['verse'])) {
         $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Base');
         $parser = XenForo_BbCode_Parser::create($formatter);
         $this->_params['verseParsed'] = $parser->render($this->_params['verse']);
     }
 }
コード例 #23
0
ファイル: Post.php プロジェクト: ThemeHouse-XF/ForumEmailNot
 protected function _parseMessageForNotification(array $post)
 {
     $bbCodeParserText = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Text'));
     $post['messageText'] = new XenForo_BbCode_TextWrapper($post['message'], $bbCodeParserText);
     $bbCodeParserHtml = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('HtmlEmail'));
     $post['messageHtml'] = new XenForo_BbCode_TextWrapper($post['message'], $bbCodeParserHtml);
     return $post;
 }
コード例 #24
0
ファイル: View.php プロジェクト: VoDongMy/xenforo-laravel5.1
 public function renderHtml()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['user']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['user']['about'], $bbCodeParser);
     $this->_params['user']['signatureHtml'] = new XenForo_BbCode_TextWrapper($this->_params['user']['signature'], $bbCodeParser, array('lightBox' => false));
     foreach ($this->_params['customFieldsGrouped'] as &$fields) {
         $fields = XenForo_ViewPublic_Helper_User::addUserFieldsValueHtml($this, $fields);
     }
 }
コード例 #25
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['comment']['message'], $bbCodeParser);
     $this->_params['comment']['message'] = $this->_params['comment']['messageHtml'];
     // sanity check in case template not updated
     $this->_params['comment']['comment_state'] = 'visible';
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('xengallery_comment', $this->_params), 'commentId' => $this->_params['comment']['comment_id']));
 }
コード例 #26
0
    /**
     * Renders the text.
     *
     * @return string
     */
    public function __toString()
    {
        try {
            if (XenForo_Application::getOptions()->cacheBbCodeTree && !empty($this->_cache['contentType']) && !empty($this->_cache['contentId'])) {
                $tree = null;
                if (!empty($this->_cache['cache']) && !empty($this->_cache['cacheVersion']) && $this->_cache['cacheVersion'] == XenForo_Application::getOptions()->bbCodeCacheVersion) {
                    if (is_array($this->_cache['cache'])) {
                        $tree = $this->_cache['cache'];
                    } else {
                        $tree = @unserialize($this->_cache['cache']);
                    }
                }
                if (!$tree) {
                    try {
                        // need to update
                        $tree = $this->_parser->parse($this->_text);
                        $this->_cache['cache'] = $tree;
                        $this->_cache['cacheVersion'] = XenForo_Application::getOptions()->bbCodeCacheVersion;
                        $uniqueId = $this->_cache['contentType'] . '-' . $this->_cache['contentId'];
                        if (empty(self::$_cacheWritten[$uniqueId])) {
                            XenForo_Application::getDb()->query('
								INSERT INTO xf_bb_code_parse_cache
									(content_type, content_id, parse_tree, cache_version, cache_date)
								VALUES (?, ?, ?, ?, ?)
								ON DUPLICATE KEY UPDATE parse_tree = VALUES(parse_tree),
									cache_version = VALUES(cache_version),
									cache_date = VALUES(cache_date)
							', array($this->_cache['contentType'], $this->_cache['contentId'], serialize($tree), $this->_cache['cacheVersion'], XenForo_Application::$time));
                            self::$_cacheWritten[$uniqueId] = true;
                        }
                    } catch (Exception $e) {
                        return $this->_parser->render($this->_text, $this->_extraStates);
                    }
                }
                return $this->_parser->render($tree, $this->_extraStates);
            } else {
                return $this->_parser->render($this->_text, $this->_extraStates);
            }
        } catch (Exception $e) {
            XenForo_Error::logException($e, false, "BB code to string error:");
            return '';
        }
    }
コード例 #27
0
ファイル: View.php プロジェクト: ThemeHouse-XF/Biblea
 public function renderHtml()
 {
     if (!empty($this->_params['posts'])) {
         foreach ($this->_params['posts'] as &$post) {
             $formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_Text');
             $parser = XenForo_BbCode_Parser::create($formatter);
             $post['messageParsed'] = $parser->render($post['message']);
         }
     }
 }
コード例 #28
0
ファイル: View.php プロジェクト: VoDongMy/xenforo-laravel5.1
 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')));
     }
 }
コード例 #29
0
 public function renderJson()
 {
     $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
     $this->_params['comment']['messageHtml'] = new XenForo_BbCode_TextWrapper($this->_params['comment']['message'], $bbCodeParser);
     $this->_params['comment']['message'] = $this->_params['comment']['messageHtml'];
     // sanity check in case template not update
     $params = $this->_params;
     $params['comment'] = XenForo_Model::create('XenGallery_Model_Comment')->prepareComments($params['comment']);
     return XenForo_ViewRenderer_Json::jsonEncodeForOutput(array('templateHtml' => $this->createTemplateObject('xengallery_comment', $params), 'commentId' => $this->_params['comment']['comment_id'], 'date' => XenForo_Application::$time));
 }
コード例 #30
0
 public function renderRaw()
 {
     if ($this->_params['media']['media_type'] == 'video_embed') {
         $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
         $html = new XenForo_BbCode_TextWrapper($this->_params['media']['media_tag'], $bbCodeParser);
         $this->_params['videoHtml'] = $html;
     }
     $this->_params['jQuerySource'] = XenForo_Dependencies_Public::getJquerySource();
     $template = $this->createTemplateObject($this->_templateName, $this->_params);
     return $template;
 }