本文整理汇总了PHP中XenForo_BbCode_Formatter_Base::getView方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_BbCode_Formatter_Base::getView方法的具体用法?PHP XenForo_BbCode_Formatter_Base::getView怎么用?PHP XenForo_BbCode_Formatter_Base::getView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_BbCode_Formatter_Base
的用法示例。
在下文中一共展示了XenForo_BbCode_Formatter_Base::getView方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: tagGallery
public static function tagGallery(array $tag, array $rendererStates, XenForo_BbCode_Formatter_Base $formatter)
{
if ($formatter instanceof XenForo_BbCode_Formatter_Text) {
return '[GALLERY]';
}
$options = XenForo_Application::getOptions();
$bbCodeOption = $options->xengalleryGalleryBbCode;
if (!$tag['option'] || !$bbCodeOption) {
return $formatter->renderTagUnparsed($tag, $rendererStates);
}
$parts = explode(',', $tag['option']);
foreach ($parts as &$part) {
$part = trim($part);
$part = str_replace(' ', '', $part);
}
$type = $formatter->filterString(array_shift($parts), array_merge($rendererStates, array('stopSmilies' => true, 'stopLineBreakConversion' => true)));
$type = strtolower($type);
$id = array_shift($parts);
$viewParams = array('type' => $type, 'id' => intval($id), 'uniqueId' => uniqid('GalleryPanes'), 'text' => isset($tag['children'][0]) ? $tag['children'][0] : '');
if ($type == 'album') {
$viewParams['link'] = XenForo_Link::buildPublicLink('xengallery/albums', array('album_id' => $id));
} else {
$viewParams['link'] = XenForo_Link::buildPublicLink('xengallery', array('media_id' => $id));
}
if ($formatter instanceof XenForo_BbCode_Formatter_HtmlEmail) {
return '<table cellpadding="0" cellspacing="0" border="0" width="100%"' . ' style="background-color: #F0F7FC; border: 1px solid #A5CAE4; border-radius: 5px; margin: 5px 0; padding: 5px; font-size: 11px; text-align: center">' . '<tr><td><a href="' . htmlspecialchars($viewParams['link']) . '">' . htmlspecialchars($viewParams['text']) . '</a></td></tr></table>';
}
if ($bbCodeOption == 'media') {
$viewParams['text'] = '';
$viewParams['link'] = '';
}
$viewParams['bbCodeOption'] = $bbCodeOption;
$view = $formatter->getView();
if ($view) {
$template = $view->createTemplateObject('xengallery_bb_code_tag_gallery', $viewParams);
$template->addRequiredExternal('js', 'js/xengallery/gallery_bb_code.js');
return $template->render();
} else {
$fallbackHtml = '
<div class="GalleryLazyLoad galleryContainer %s %s-%d" data-type="%s" data-id="%d"></div>' . '<a href="%s"><span class="galleryText">%s</span></a>';
return sprintf($fallbackHtml, $viewParams['type'], $viewParams['type'], $viewParams['id'], $viewParams['type'], $viewParams['id'], $viewParams['link'], $viewParams['type']);
}
}