本文整理汇总了PHP中XenForo_BbCode_Formatter_Base类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_BbCode_Formatter_Base类的具体用法?PHP XenForo_BbCode_Formatter_Base怎么用?PHP XenForo_BbCode_Formatter_Base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_BbCode_Formatter_Base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quoteVerse
public static function quoteVerse(array $tag, array $rendererStates, XenForo_BbCode_Formatter_Base $formatter)
{
$option = explode(',', $tag['option']);
$xenOptions = XenForo_Application::get('options');
$verse = '';
$version = null;
if (count($option) > 1) {
$verse = $option[0];
$version = strtoupper($option[1]);
} elseif ($option[0]) {
if (preg_match('#^[A-z]+$#', $tag['option'])) {
$verse = '';
$version = strtoupper($tag['option']);
} else {
$verse = $tag['option'];
$version = strtoupper($xenOptions->th_bible_defaultBible);
}
}
if (!$verse && count($tag['children']) == 1 && is_string($tag['children'][0])) {
$bibleId = $version ? strtolower($version) : null;
/* @var $verseModel ThemeHouse_Bible_Model_Verse */
$verseModel = XenForo_Model::create('ThemeHouse_Bible_Model_Verse');
$verseText = $verseModel->getVerseFromText($tag['children'][0], $bibleId, true);
if ($verseText) {
$verse = $tag['children'][0];
$version = strtoupper($bibleId);
$tag['children'] = $verseText;
}
}
$link = '';
$params = array('bible_id' => strtolower($version));
if (in_array(strtolower($version), $xenOptions->th_bible_bbCodeBibles)) {
if (preg_match('#^(.*)\\s+([0-9\\-:]+)$#', $verse, $matches)) {
$urlPortion = strtolower(XenForo_Link::getTitleForUrl($matches[1], true));
$link = XenForo_Link::buildPublicLink('bible/' . $urlPortion . '/' . $matches[2] . '/', null, $params);
/* @var $bibleModel ThemeHouse_Bible_Model_Bible */
$bibleModel = XenForo_Model::create('ThemeHouse_Bible_Model_Bible');
$titlePhraseName = $bibleModel->getBibleTitlePhraseName(strtolower($version));
$bibleTitle = new XenForo_Phrase($titlePhraseName);
$bibleTitle->setPhraseNameOnInvalid(false);
if ((string) $bibleTitle) {
$version = $bibleTitle;
}
} else {
$urlPortion = strtolower(XenForo_Link::getTitleForUrl($verse, true));
$link = XenForo_Link::buildPublicLink('bible/' . $urlPortion . '/', null, $params);
}
} else {
$link = '';
}
$content = $formatter->renderSubTree($tag['children'], $rendererStates);
$view = $formatter->getView();
if ($view) {
$template = $view->createTemplateObject('th_bb_code_verse_bible', array('content' => $content, 'verse' => $verse, 'version' => $version, 'link' => $link));
$content = $template->render();
return trim($content);
}
return $content;
}
示例2: actionList
public function actionList()
{
$viewParams = array();
$taigamodel = $this->_getTaigaChatModel();
$options = XenForo_Application::get('options');
$visitor = XenForo_Visitor::getInstance();
$sidebar = false;
if (!$taigamodel->canViewMessages()) {
//throw $this->getErrorOrNoPermissionResponseException('dark_no_permission_view_message');
return $this->responseView('Dark_TaigaChat_ViewPublic_TaigaChat_List_Blank', 'dark_taigachat_blank');
}
if ($this->_input->inRequest('sidebar') && $this->_input->filterSingle('sidebar', XenForo_Input::UINT)) {
$sidebar = true;
}
$query = array("page" => 1, "perPage" => $sidebar ? $options->dark_taigachat_sidebarperpage : $options->dark_taigachat_fullperpage, "lastRefresh" => $this->_input->filterSingle('lastrefresh', XenForo_Input::UINT));
$messages = $taigamodel->getMessages($this->_input->filterSingle('room', XenForo_Input::UINT), $query);
$messageIds = $taigamodel->getMessageIds($this->_input->filterSingle('room', XenForo_Input::UINT), $query);
foreach ($messages as &$message) {
if ($taigamodel->canModifyMessage($message)) {
$message['canModify'] = true;
}
}
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base'));
$motd = new XenForo_BbCode_TextWrapper($options->dark_taigachat_motd, $bbCodeParser);
if (!$this->_input->filterSingle('fake', XenForo_Input::UINT)) {
$taigamodel->updateActivity($visitor['user_id']);
}
$onlineUsersTaiga = array();
if ($options->dark_taigachat_sidebar) {
$onlineUsersTaiga = $taigamodel->getActivityUserList($visitor->toArray());
}
$viewParams = array('taigachat' => array("messages" => $messages, "sidebar" => $sidebar, "messageIds" => $messageIds, "editside" => $options->dark_taigachat_editside, "timedisplay" => $options->dark_taigachat_timedisplay, "miniavatar" => $options->dark_taigachat_miniavatar, "lastrefresh" => $this->_input->filterSingle('lastrefresh', XenForo_Input::UINT), "numInChat" => $taigamodel->getActivityUserCount(), "motd" => $motd, 'online' => $onlineUsersTaiga, "route" => $options->dark_taigachat_route, "canBan" => $taigamodel->canBanFromShoutbox()));
return $this->responseView('Dark_TaigaChat_ViewPublic_TaigaChat_List', 'dark_taigachat_list', $viewParams);
}
示例3: 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);
}
示例4: renderJson
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);
}
示例5: renderTagMedio
public function renderTagMedio(array $tag, array $rendererStates)
{
$text = $this->renderSubTree($tag['children'], $rendererStates);
$topt = $tag['option'];
if ($media = XenForo_Model::create('EWRmedio_Model_Media')->getMediaByID($text, false)) {
if ($this->_view) {
if ($topt == 'full') {
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base'));
$media['media_description'] = new XenForo_BbCode_TextWrapper($media['media_description'], $bbCodeParser);
$keywords = explode(",", $media['media_keywords']);
foreach ($keywords as &$keyword) {
$keyword = trim($keyword);
$keyword = '<a href="' . XenForo_Link::buildPublicLink('media/keyword', array('keyword_text' => $keyword)) . '">' . $keyword . '</a>';
}
$media['media_keywords'] = implode(", ", $keywords);
$template = $this->_view->createTemplateObject('EWRmedio_BBcode_Full', array('media' => $media));
} else {
$viewParams = array('media' => $media);
if ($topt == 'left' || $topt == 'right') {
$viewParams['float'] = $topt;
}
$template = $this->_view->createTemplateObject('EWRmedio_BBcode', $viewParams);
}
return $template->render();
}
return '<a href="' . XenForo_Link::buildPublicLink('media', $media) . '">' . $media['media_title'] . '</a>';
} else {
return '[medio]' . $text . '[/medio]';
}
}
示例6: getTags
/**
* Gets the list of valid BB code tags. This removes most behaviors.
*
* @see XenForo_BbCode_Formatter_Base::getTags()
*/
public function getTags()
{
if ($this->_tags !== null) {
return $this->_tags;
}
if (is_array($this->_generalTagCallback) && $this->_generalTagCallback[0] == '$this') {
$this->_generalTagCallback[0] = $this;
}
$tags = parent::getTags();
foreach ($tags as $tagName => &$tag) {
unset($tag['replace'], $tag['callback'], $tag['trimLeadingLinesAfter']);
if (!empty($this->_overrideCallbacks[$tagName])) {
$override = $this->_overrideCallbacks[$tagName];
if (is_array($override) && $override[0] == '$this') {
$override[0] = $this;
}
$tag['callback'] = $override;
} else {
if ($this->_generalTagCallback) {
$tag['callback'] = $this->_generalTagCallback;
}
}
}
return $tags;
}
示例7: 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);
}
示例8: 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' => '');
}
}
}
}
示例9: 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);
}
示例10: renderHtml
public function renderHtml()
{
$options = XenForo_Application::get('options');
$parserModel = XenForo_Model::create('EWRcarta_Model_Parser');
if ($this->_params['page']['page_type'] == 'phpfile') {
$this->_params['page'] = $parserModel->parsePagePHP($this->_params['page']);
} else {
$cacheModel = XenForo_Model::create('EWRcarta_Model_Cache');
$cache = $cacheModel->getCache($this->_params['page']);
if ($this->_params['page']['page_date'] >= $cache['cache_date'] || strtotime($options->EWRcarta_cache, $cache['cache_date']) < XenForo_Application::$time) {
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$bbCodeOptions = array('viewAttachments' => true, 'stopLineBreakConversion' => $this->_params['page']['page_type'] == 'html' ? true : false, 'attachments' => $this->_params['page']['attachments']);
$this->_params['page']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['page']['page_content'], $bbCodeParser, $bbCodeOptions);
$this->_params['page']['HTML'] = (string) $this->_params['page']['HTML'];
if ($this->_params['page']['page_type'] == 'html') {
$this->_params['page']['HTML'] = htmlspecialchars_decode($this->_params['page']['HTML']);
}
$this->_params['page'] = $parserModel->parseContents($this->_params['page']);
$this->_params['page'] = $parserModel->parseTemplates($this->_params['page']);
$this->_params['page'] = $parserModel->parseAutolinks($this->_params['page']);
$dw = XenForo_DataWriter::create('EWRcarta_DataWriter_Cache', XenForo_DataWriter::ERROR_SILENT);
if ($cache) {
$dw->setExistingData($cache);
}
$dw->bulkSet(array('page_id' => $this->_params['page']['page_id'], 'cache_content' => $this->_params['page']['HTML']));
$dw->save();
} else {
$this->_params['page']['HTML'] = $cache['cache_content'];
$this->_params['page']['cache'] = $cache['cache_date'];
}
}
}
示例11: 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']);
}
示例12: 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']);
}
}
}
}
示例13: renderHtml
public function renderHtml()
{
$parserModel = XenForo_Model::create('EWRcarta_Model_Parser');
if ($this->_params['history']['history_type'] == 'phpfile') {
$this->_params['history']['page_content'] = $this->_params['history']['history_content'];
$this->_params['history'] = $parserModel->parsePagePHP($this->_params['history']);
} else {
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$bbCodeOptions = array('stopLineBreakConversion' => $this->_params['history']['history_type'] == 'html' ? true : false);
$this->_params['history']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['history']['history_content'], $bbCodeParser, $bbCodeOptions);
$this->_params['history']['HTML'] = (string) $this->_params['history']['HTML'];
if ($this->_params['history']['history_type'] == 'html') {
$this->_params['history']['HTML'] = htmlspecialchars_decode($this->_params['history']['HTML']);
}
if ($this->_params['history']['history_type'] == 'bbcode') {
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$this->_params['history']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['history']['history_content'], $bbCodeParser);
$this->_params['history']['HTML'] = (string) $this->_params['history']['HTML'];
} else {
$this->_params['history']['HTML'] = $this->_params['history']['history_content'];
}
$this->_params['history'] = $parserModel->parseContents($this->_params['history']);
$this->_params['history'] = $parserModel->parseTemplates($this->_params['history']);
$this->_params['history'] = $parserModel->parseAutolinks($this->_params['history']);
}
}
示例14: renderHtml
public function renderHtml()
{
if (!empty($this->_params['item']['listing_description'])) {
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$this->_params['item']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['item']['listing_description'], $bbCodeParser);
}
}
示例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));
}