Cyclone3 Skin

TOM::Text

From Cyclone3 Wiki

Text conversions and transformation tools.

Contents

xml_to_plain()

Removes all tags, leaving only plain text.

Syntax:

$plaintext=TOM::Text::xml_to_plain($xmlstring);

plain_logical()

Transform plain text string into compact output by removing unnecessary newlines and hyphenation.

Syntax:

$cleantext=TOM::Text::plain_logical($string);

USmoney()

(description unavailable)

Syntax:

(syntax unavailable)

bytes()

Returns given byte count value converted to kB (when byte count is larger than 1024 bytes), MB (1024*1024) or GB (1024*1024*1024) with 2 decimal places. When used with -noconvert swith, the output only divides thousands and adds 'B' at the end

Syntax:

$bytesstring=TOM::Text::bytes($bytecount[, {'-notconvert': 1});

Examples

TOM::Text::bytes(13156); #returns 12,85kB
TOM::Text::bytes(11243156); #returns 10,72MB
TOM::Text::bytes(11243156887); #returns 10,47GB
TOM::Text::bytes(23156887, {'-noconvert': 1}); #returns 23 156 887B

CDATA()

Wraps given string into CDATA tags. Useful for creating valid XML tag content.

Syntax:

$wrappedtext=TOM::Text::CDATA($text);

Examples

TOM::Text::CDATA('some text'); #returns <![CDATA[some text]]>

html2jsvalue()

Escapes given string to valid JavaScript string.

Syntax:

$wrappedtext=TOM::Text::html2jsvalue($text);

Examples

TOM::Text::html2jsvalue('this is "some text"'); #returns this is "\\"some text\\""

wordwrap()

(no description)

Syntax:

$wrappedtext=TOM::Text::wordwrap($text);

decode_URLS()

Decodes hashed Cyclone3 URL.

Syntax:

$decodedurl=TOM::Text::decodeURLS($hashedurl);

html_clean()

Cleans up HTML, removes non-standard attributes, and transforms incorrect tags.

Syntax:

$cleanhtml=TOM::Text::html_clean($htmlstring);