Bitrix API

TextHelper

Table of Contents

Constants

SANITIZE_BB_CODE_WHITE_LIST  = [ 'b', //bold 'i', //italic 'u', //underlined 's', //strike 'list', //ul and ol, '\*', //* - list item 'user', //mention 'img', 'disk file id', 'url', ]

Methods

cleanTextByType()  : string
convertBbCodeToHtml()  : string
convertHtmlToBbCode()  : mixed
convertHtmlToText()  : string
onTextParserBeforeTags()  : mixed
removeParagraphs()  : string
sanitizeBbCode()  : string
Removes bb tags that are not allowed. The main criteria for whitelisting specific tags it's whether they are supported by mobile app, since it's usually a bottleneck.
sanitizeHtml()  : mixed

Constants

SANITIZE_BB_CODE_WHITE_LIST

public mixed SANITIZE_BB_CODE_WHITE_LIST = [ 'b', //bold 'i', //italic 'u', //underlined 's', //strike 'list', //ul and ol, '\*', //* - list item 'user', //mention 'img', 'disk file id', 'url', ]

Methods

cleanTextByType()

public final static cleanTextByType(string|null $text[, int $contentType = CCrmContentType::PlainText ]) : string
Parameters
$text : string|null
$contentType : int = CCrmContentType::PlainText
Return values
string

convertBbCodeToHtml()

public static convertBbCodeToHtml(mixed $bb[, mixed $useTypography = false ]) : string
Parameters
$bb : mixed
$useTypography : mixed = false
Return values
string

convertHtmlToBbCode()

public static convertHtmlToBbCode(mixed $html) : mixed
Parameters
$html : mixed

convertHtmlToText()

public final static convertHtmlToText(string $html[, bool $saveBreaks = false ]) : string
Parameters
$html : string
$saveBreaks : bool = false
Return values
string

onTextParserBeforeTags()

public static onTextParserBeforeTags(mixed &$text, mixed &$textParser) : mixed
Parameters
$text : mixed
$textParser : mixed

removeParagraphs()

public final static removeParagraphs(string $bbcode) : string
Parameters
$bbcode : string
Return values
string

sanitizeBbCode()

Removes bb tags that are not allowed. The main criteria for whitelisting specific tags it's whether they are supported by mobile app, since it's usually a bottleneck.

public final static sanitizeBbCode(mixed $bb[, array<string|int, mixed> $excludeFromWhitelist = [] ][, array<string|int, mixed> $extraWhiteList = [] ]) : string
Parameters
$bb : mixed
  • string with bb content
$excludeFromWhitelist : array<string|int, mixed> = []
  • tags that are additionally removed from the input string
$extraWhiteList : array<string|int, mixed> = []
Return values
string

sanitizeHtml()

public static sanitizeHtml(mixed $html) : mixed
Parameters
$html : mixed

        
On this page

Search results