MetaFox

Output
in package
implements Output

Table of Contents

Interfaces

Output

Constants

HASHTAG_LINK  = '<a href="%s">%s</a>'
HASHTAG_REGEX  = '(#[^\\s!@#$%^&*()=\\-+.\\/,\\[{\\]};:\'"?><]+)'
PARSE_URL_IGNORE_TAGS  = 'head|link|a|script|style|code|pre|select|textarea|button'
TEXT_NEW_LINE_REGEX  = '@<(\\/p|br)>@'
TOPIC_REGEX  = '(##[^!@#$%^&*()=\\-+.\\/,\\[{\\]};:\'"?><]+[^\\r\\n\\t\\f\\v]+)'
URL_POPULAR_DOMAIN_REGEX  = '@\\w+\\.(com|gov|vn|net)$@'
URL_REGEX  = '@(http(s)?)?(:\\/\\/)?(([a-zA-Z0-9]+)([-\\w]*\\.)*([-\\w]+\\.[a-zA-Z]{1,})([\\w=%]+\\S*)+)@'

Methods

buildHashtagLink()  : string
cleanScriptTag()  : string
cleanStyleTag()  : string
getDescription()  : string
Get short description from a string.
getHashtags()  : array<string|int, string>
handleNewLineTag()  : string
isAllowHtml()  : bool
limit()  : string
Shorten the provided string to the specified limitation, including the length of the delimiter.
linkify()  : string
maskedEmail()  : string|null
parse()  : string
Text we need to parse, usually text added via a <textarea>.
parseUrl()  : string
isValidLink()  : bool

Constants

public mixed HASHTAG_LINK = '<a href="%s">%s</a>'

HASHTAG_REGEX

public mixed HASHTAG_REGEX = '(#[^\\s!@#$%^&*()=\\-+.\\/,\\[{\\]};:\'"?><]+)'

PARSE_URL_IGNORE_TAGS

public mixed PARSE_URL_IGNORE_TAGS = 'head|link|a|script|style|code|pre|select|textarea|button'

TEXT_NEW_LINE_REGEX

public mixed TEXT_NEW_LINE_REGEX = '@<(\\/p|br)>@'

TOPIC_REGEX

public mixed TOPIC_REGEX = '(##[^!@#$%^&*()=\\-+.\\/,\\[{\\]};:\'"?><]+[^\\r\\n\\t\\f\\v]+)'
public mixed URL_POPULAR_DOMAIN_REGEX = '@\\w+\\.(com|gov|vn|net)$@'

URL_REGEX

public mixed URL_REGEX = '@(http(s)?)?(:\\/\\/)?(([a-zA-Z0-9]+)([-\\w]*\\.)*([-\\w]+\\.[a-zA-Z]{1,})([\\w=%]+\\S*)+)@'

Methods

public buildHashtagLink(string|null $string, string $uri[, string|null $templateRegex = null ]) : string
Parameters
$string : string|null
$uri : string
$templateRegex : string|null = null
Return values
string

cleanScriptTag()

public cleanScriptTag(string|null $string) : string
Parameters
$string : string|null
Return values
string

cleanStyleTag()

public cleanStyleTag(string|null $string) : string
Parameters
$string : string|null
Return values
string

getDescription()

Get short description from a string.

public getDescription(string|null $string[, int $limit = MetaFoxConstant::CHARACTER_LIMIT ][, string $end = '...' ]) : string
Parameters
$string : string|null
$limit : int = MetaFoxConstant::CHARACTER_LIMIT
$end : string = '...'
Tags
inerhitDoc
Return values
string

getHashtags()

public getHashtags(string|null $text[, bool $allowSpace = false ]) : array<string|int, string>
Parameters
$text : string|null
$allowSpace : bool = false
Tags
inerhitDoc
SuppressWarnings

(PHPMD.BooleanArgumentFlag)

Return values
array<string|int, string>

handleNewLineTag()

public handleNewLineTag(string $string) : string
Parameters
$string : string
Return values
string

isAllowHtml()

public isAllowHtml() : bool
Return values
bool

limit()

Shorten the provided string to the specified limitation, including the length of the delimiter.

public limit(string|null $string[, int $limit = MetaFoxConstant::CHARACTER_LIMIT ][, string $delimiter = '...' ]) : string
Parameters
$string : string|null

$string the string we need to limit

$limit : int = MetaFoxConstant::CHARACTER_LIMIT

the maximum number of characters allowed

$delimiter : string = '...'
Tags
inerhitDoc
Return values
string

linkify()

public linkify(string|null $string) : string
Parameters
$string : string|null
Tags
todo:

should move to a parse_link service?

Return values
string

maskedEmail()

public maskedEmail(string|null $email[, int $left = 3 ]) : string|null
Parameters
$email : string|null
$left : int = 3
Return values
string|null

parse()

Text we need to parse, usually text added via a <textarea>.

public parse(string|null $string) : string
Parameters
$string : string|null

$string the string we need to parse

Return values
string

parseUrl()

public parseUrl(string|null $string[, array<string, mixed> $options = [] ]) : string
Parameters
$string : string|null

$string

$options : array<string, mixed> = []
Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string
private isValidLink(string $string) : bool
Parameters
$string : string
Tags
Todo:

Should be extend to support a list of all active link?

Return values
bool

        
On this page

Search results