Helper to do common string operations, such as word wrap and censoring.
| package | XenForo_Helper |
|---|
autoLinkBbCode(string $string) : string
Output will be original BB code input with [url] or [email] tags inserted where ncessary.
stringBB code string
stringautoLinkPlainText(string $string, boolean $htmlEncoded) : string
This text should generally already be HTML escaped, because it can't be done after the linking.
string
booleanDenotes whether the text is already encoded; if false, the URL will be encoded before being put into the link
stringText with links addedbbCodeStrip(string $string, boolean $stripQuote) : string
string
booleanIf true, contents from within quote tags are stripped
stringbuildCensorArray(array $words, string $censorString) : array
arrayList of words (from option format)
stringString to replace each character with if no replacement map
arrayPossible keys: exact, any with key-value search/replace pairscensorString(string $string, array $words, string | null $censorString) : string
string
arraynullWords to censor. Null to use option value.
stringnullString to censor each character with. Null to use option value.
stringcensorStringTemplateHelper(string $string, string $censorString) : string
string
string
stringgetLinkClassTarget(string $url) : array
string
array[class, target, type (internal/external)]highlightSearchTerm(string $string, string $term, string $emClass) : string
..
stringHaystack
stringNeedle
stringClass with which to style the wrapping
stringHTMLprepareAutoLinkedUrl(string $url) : array
stringURL that may have trailing characters or missing scheme
arrayKeys: url, linkText, suffixTextstripQuotes(string $string, integer $allowedDepth, boolean $censorResults) : string
string
integer-1 for unlimited depth
boolean
stringQuotes strippedwholeWordTrim(string $string, integer $maxLength, integer $offset, string $elipses) : string
string
integerMax length of returned string, excluding elipsis
integerOffset from string start - will add leading elipsis
stringElipses string (default: '...')
stringwholeWordTrimAroundSearchTerm($string, $maxLength, $term) : string
If the term is not found, the snippet is taken from the string start.
stringwordWrapString(string $string, integer $breakLength) : string
string
integerNumber of characters before break; if null, use option
string_autoLinkPlainTextCallback(array $match) : string
array
string__construct()
Use statically.
$_alptHtmlEncoded : boolean
Only used to pass to callback.
$_censorCache : array | null