本文整理汇总了PHP中XenForo_BbCode_Parser类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_BbCode_Parser类的具体用法?PHP XenForo_BbCode_Parser怎么用?PHP XenForo_BbCode_Parser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_BbCode_Parser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHtml
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: renderHtml
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: actionGetSubscriptions
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: renderJson
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: helperPreparePostDataForDisplay
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: renderRss
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: processMessagesForView
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: renderHtml
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: renderHtml
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: renderHtml
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: renderHtml
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: renderGalleryComment
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: renderJson
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: renderHtml
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: renderJson
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));
}