Input
in
Table of Contents
Methods
- clean() : string
- Parse and clean a string. We mainly use this for a title of an item, which does not allow any HTML. It can also be used to shorten a string bassed on the numerical value passed by the 2nd argument.
- extractHashtag() : string
- example: data in: ['hashtag', 'nowayhome'] data out: #hashtag#nowayhome.
- extractResourceTopic() : array<string|int, string>
- Use for parsing array of tags where each tag may use a comma to separate tags example: data in: ['hashtag, nowayhome', 'homecoming, farfromhome'] data out: ['hashtag', 'nowayhome', 'homecoming', 'farfromhome'].
- prepare() : string
- Prepare text strings. Used to prepare all data that can contain HTML. Not only does it protect against harmful HTML and CSS, it also has support for BBCode conversion.
Methods
clean()
Parse and clean a string. We mainly use this for a title of an item, which does not allow any HTML. It can also be used to shorten a string bassed on the numerical value passed by the 2nd argument.
public
clean([string|null $string = null ][, bool $removeTags = false ][, bool $encode = true ]) : string
Parameters
- $string : string|null = null
-
$string Text to parse.
- $removeTags : bool = false
-
(Optional) Should remove html tags or not
- $encode : bool = true
Tags
Return values
string —Returns the new parsed string.
extractHashtag()
example: data in: ['hashtag', 'nowayhome'] data out: #hashtag#nowayhome.
public
extractHashtag(array<string|int, string> $hashTags[, bool $allowSpace = false ]) : string
Parameters
- $hashTags : array<string|int, string>
- $allowSpace : bool = false
Tags
Return values
stringextractResourceTopic()
Use for parsing array of tags where each tag may use a comma to separate tags example: data in: ['hashtag, nowayhome', 'homecoming, farfromhome'] data out: ['hashtag', 'nowayhome', 'homecoming', 'farfromhome'].
public
extractResourceTopic([array<string|int, string> $tags = [] ]) : array<string|int, string>
Parameters
- $tags : array<string|int, string> = []
Return values
array<string|int, string>prepare()
Prepare text strings. Used to prepare all data that can contain HTML. Not only does it protect against harmful HTML and CSS, it also has support for BBCode conversion.
public
prepare([string|null $string = null ]) : string
Parameters
- $string : string|null = null
-
- Text to parse.
Return values
string —Parsed string.