Base class for defining the formatting used by the BB code parser.
This class implements HTML formatting.
| package | XenForo_BbCode |
|---|
__construct()
| inherited_from | \XenForo_BbCode_Formatter_Base::__construct() |
|---|
addMediaSites(array $sites)
| inherited_from | \XenForo_BbCode_Formatter_Base::addMediaSites() |
|---|
array
addSmilies(array $smilies)
| inherited_from | \XenForo_BbCode_Formatter_Base::addSmilies() |
|---|
arrayList of smilies with data from the DB (smilie_id, smilieText [array], image_url)
create(string $class, array | false $options) : \XenForo_BbCode_Formatter_Base
| inherited_from | \XenForo_BbCode_Formatter_Base::create() |
|---|
stringName of the class. If empty, uses this class; if doesn't contain an underscore, assumes a partial name
arrayfalseSet of options to configure formatter; defaults to pulling as necessary; if false, doesn't look in registry etc
filterFinalOutput(string $output) : string
string
stringfilterString(string $string, array $rendererStates) : string
A string is simply the text between tags. This function is responsible for things like word wrap and smilies and output escaping.
string
arrayList of states the renderer may be in
stringFiltered/escaped stringgetTags() : array
arraygetTextSize(string $inputSize) : string | false
| inherited_from | \XenForo_BbCode_Formatter_Base::getTextSize() |
|---|
string
stringfalse
parseValidatePlainIfNoOption(array $tagInfo, string | null $tagOption) : array | boolean
Useful for tags like url/email, where the address may be in the body of the tag.
| inherited_from | \XenForo_BbCode_Formatter_Base::parseValidatePlainIfNoOption() |
|---|
arrayInfo about the tag we're parsing.
stringnullAny option passed into the tag
arraybooleanTrue if tag is ok as is, array to change states, false to reject tagparseValidateTagCode(array $tagInfo, string | null $tagOption) : array | boolean
Users must explicitly opt in to allow BB codes to be used within.
| inherited_from | \XenForo_BbCode_Formatter_Base::parseValidateTagCode() |
|---|
arrayInfo about the tag we're parsing.
stringnullAny option passed into the tag
arraybooleanTrue if tag is ok as is, array to change states, false to reject tagpreLoadData()
| inherited_from | \XenForo_BbCode_Formatter_Base::preLoadData() |
|---|
preLoadTemplates(\XenForo_View $view)
renderInvalidTag(array $tag, array $rendererStates) : string
This tag is simply displayed in its original form.
| inherited_from | \XenForo_BbCode_Formatter_Base::renderInvalidTag() |
|---|
arrayTag data from tree
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
stringRendered versionrenderString(string $string, array $rendererStates, integer $trimLeadingLines) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderString() |
|---|
string
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
integerBy reference. Number of leading lines to strip off next element.
stringRendered stringrenderSubTree(array $tree, array $rendererStates) : string
This does not reset the rendering states, meaning it is ok for recursive calls.
| inherited_from | \XenForo_BbCode_Formatter_Base::renderSubTree() |
|---|
arrayTree from {@link parse()}
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
stringOutput textrenderTag(array $element, array $rendererStates, integer $trimLeadingLines) : string
This tag may be valid or invalid.
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTag() |
|---|
arrayTag element.
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
integerBy reference. Number of leading lines to strip from next element. May be modified by tag.
stringRendered tag.renderTagAlign(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagAlign() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagAttach(array $tag, array $rendererStates)
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagAttach() |
|---|
renderTagCode(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagCode() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagEmail(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagEmail() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagHtml(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagHtml() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagImage(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagImage() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagIndent(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagIndent() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagList(array $tag, array $rendererStates) : string
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagMedia(array $tag, array $rendererStates) : string
Media tags embed rich media (usually videos). To embed a video, the source must be known.
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagMedia() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagPhp(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagPhp() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagQuote(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagQuote() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagSize(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagSize() |
|---|
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagUndisplayable(array $tag, array $rendererStates)
renderTagUnparsed(array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTagUnparsed() |
|---|
arrayTag data from tree
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
stringRendered versionrenderTagUrl(array $tag, array $rendererStates) : string
arrayInformation about the tag reference; keys: tag, option, children
arrayRenderer states to push down
stringRendered tagrenderTagWithState(array $tag, array $rendererStates)
renderTree(array $tree, array $extraStates) : string
Note that this initializes the default states, so it is likely not the correct function to call for child tags.
arrayTree from {@link parse()}.
arrayA list of extra states to push into the formatter
stringOutput textrenderTreeElement(array | string $element, array $rendererStates, integer $trimLeadingLines) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderTreeElement() |
|---|
arraystringTree element
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
integerBy reference. Number of leading lines to strip off next element.
stringRendered element.renderValidTag(array $tagInfo, array $tag, array $rendererStates) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::renderValidTag() |
|---|
arrayInformation about how to parse the tag
arrayTag data from tree
arrayRenderer states to push down. Except in specific cases, cannot be pushed up.
stringRendered versionreplaceSmiliesInText(string $text, mixed $escapeCallback) : string
This method also escapes the output before the smilies are ultimately replaced. This is necessary to prevent the rich output from being escaped.
| inherited_from | \XenForo_BbCode_Formatter_Base::replaceSmiliesInText() |
|---|
stringText to replace in
mixedCallback for escaping. If empty, no escaping is done.
stringsetView(\XenForo_View $view) : \unknown_type
| inherited_from | \XenForo_BbCode_Formatter_Base::setView() |
|---|
\XenForo_View
\unknown_typestringifyTree(array $tree) : string
This can be useful for functions that can only take plain text children.
Note that this output is not escaped in anyway!
| inherited_from | \XenForo_BbCode_Formatter_Base::stringifyTree() |
|---|
arrayTree or sub-tree to stringify
stringTree as a string (like the original input)trimLeadingLines(string $string, integer $amount) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::trimLeadingLines() |
|---|
string
integer
string_appendListElement(array $elements, string $appendString)
| inherited_from | \XenForo_BbCode_Formatter_Base::_appendListElement() |
|---|
arrayBy reference. List of existing elements.
stringString to append (if not empty)
_getBlockStateHtml(array $blockStyles)
_getInlineStateHtml(array $inlineStyles)
_getMediaSiteHtmlFromCallback(string $mediaKey, array $site) : string | boolean
| inherited_from | \XenForo_BbCode_Formatter_Base::_getMediaSiteHtmlFromCallback() |
|---|
string
arrayInformation about the site to render this media
stringbooleanReturns false if callback is invalid_getStateStyling(array $states)
_getTagRule(string $tagName) : array | false
| inherited_from | \XenForo_BbCode_Formatter_Base::_getTagRule() |
|---|
string
arrayfalse
_getValidUrl(string $url) : string | false
False is returned if not possible.
| inherited_from | \XenForo_BbCode_Formatter_Base::_getValidUrl() |
|---|
stringURL to validate
stringfalse
_prepareSmilieUrl(string $smilieUrl) : string
Fetches the result from cache if possible.
| inherited_from | \XenForo_BbCode_Formatter_Base::_prepareSmilieUrl() |
|---|
string
string_prepareSmilieUrlInternal(string $smilieUrl) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::_prepareSmilieUrlInternal() |
|---|
string
string_processSmilieSpriteTemplate(array $smilie) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::_processSmilieSpriteTemplate() |
|---|
array
string_processSmilieTemplate(array $smilie) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::_processSmilieTemplate() |
|---|
array
string_renderListOutput(string $listType, array $elements) : string
stringType of list (ol or ul)
arrayList of elements in the list. These are already rendered.
string_renderTagQuoteFallback(string $name, string $content) : string
| inherited_from | \XenForo_BbCode_Formatter_Base::_renderTagQuoteFallback() |
|---|
stringName of quoted user
stringQuoted text
string$_ignoredUsers : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_ignoredUsers |
|---|
$_imageTemplate : string
Will be passed the following params: 1 URL 2 Additional CSS classes
$_mediaSites : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_mediaSites |
|---|
$_smiliePaths : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_smiliePaths |
|---|
$_smilieReverse : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_smilieReverse |
|---|
$_smilieSpriteTemplate : string
Will be passed the following params: 1 Smilie ID 2 Smilie text 3 Smilie title
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_smilieSpriteTemplate |
|---|
$_smilieTemplate : string
Will be passed the following params: 1 Image URL 2 Smilie text 3 Smilie title
$_smilieTranslate : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_smilieTranslate |
|---|
$_smilieUrlCache : array
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_smilieUrlCache |
|---|
$_stateMap
$_textDirection : string
| inherited_from | \XenForo_BbCode_Formatter_Base::$$_textDirection |
|---|
$_undisplayableTags