\TEXT

Text helper.

Contains utilities to format and escapee text.

Summary

Methods
Properties
Constants
format_date()
close_tags()
cut_text()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

format_date()

format_date(string  $str_date, string  $time = true) : string

Turns a date string into a human readable string on the specified language. Only works for spanish, basque and english.

Parameters

string $str_date

Date string ('yyyy-mm-dd' or 'yyyy-mm-dd HH:MM:SS')

string $time

Append the time at the end.

Returns

string —

Formatted date string.

close_tags()

close_tags(  $html) : string

Closes all the opened HTML tags in a given string.

Parameters

$html

Returns

string —

HTML with closed tags.

cut_text()

cut_text(string  $text, integer  $length, string  $link_text = "", string  $link = "") : string

Text shortener.

Given a string, it trims in the proximity of the desired string, up to the next white character. If indicated, it will append a link to the full text.

Parameters

string $text

The text to shorten.

integer $length

The desired length.

string $link_text

Text for the link. Optional.

string $link

URI of the link.

Returns

string —

Shortened text.