class Html (View source)

Methods

static string
trimText(string $str, int $desiredLength, bool $hellip = true, int $cutOffCap = 3)

Trim text to a given length.

static string
decorateTT(string $str)

Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a element.

static bool
isURL(string $str)

Check if a given string looks like it could be a URL, with or without the protocol.

static string
addScheme(string $url, string $scheme = 'http://')

Add 'http://' to a link, if it has no protocol already.

static string
providerLink(array $providedby)

Create 'provider' link, as used in the footer, to link to either an email address or website URL.

static string
makeAbsoluteLink(string $link)

No description

Details

static string trimText(string $str, int $desiredLength, bool $hellip = true, int $cutOffCap = 3)

Trim text to a given length.

Parameters

string $str String to trim
int $desiredLength Target string length
bool $hellip Add dots when the string is too long
int $cutOffCap Maximum difference between string length when removing words

Return Value

string Trimmed string

static string decorateTT(string $str)

Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a element.

Parameters

string $str Input string. Treated as plain text.

Return Value

string The resulting HTML

static bool isURL(string $str)

Check if a given string looks like it could be a URL, with or without the protocol.

Parameters

string $str

Return Value

bool

See also

https://mathiasbynens.be/demo/url-regex

static string addScheme(string $url, string $scheme = 'http://')

Add 'http://' to a link, if it has no protocol already.

Parameters

string $url
string $scheme

Return Value

string

Create 'provider' link, as used in the footer, to link to either an email address or website URL.

Parameters

array $providedby

Return Value

string

Parameters

string $link

Return Value

string