Class Convert

Library of conversion functions, implemented as static methods.

The methods are all of the form (format)2(format), where the format is one
of
raw: A UTF8 string attr: A UTF8 string suitable for inclusion in an HTML
attribute js: A UTF8 string suitable for inclusion in a double-quoted javascript
string.
array: A PHP associative array json: JavaScript object notation
html: HTML source suitable for use in a page or email text: Plain-text content,
suitable for display to a user as-is, or insertion in a plaintext email.

Objects of type ViewableData can have an "escaping type", which
determines if they are automatically escaped before output by SSViewer.

Parameters

Used by

There are no real specifications on correctly encoding mailto-links, but this
seems to be compatible with most of the user-agents. Does nearly the same as
rawurlencode(). Please only encode the values, not the whole url, e.g.
"mailto:test@test.com?subject=" . Convert::raw2mailto($subject)

There are no real specifications on correctly encoding mailto-links, but this
seems to be compatible with most of the user-agents. Does nearly the same as
rawurlencode(). Please only encode the values, not the whole url, e.g.
"mailto:test@test.com?subject=" . Convert::raw2mailto($subject)

Parameters

$data

$data string

Returns

stringstring

See

Magic methods summary

Comments

Comment policy: Please use comments for tips and corrections about the described
functionality. Comments are moderated, we reserve the right to remove comments that are inappropriate or are no longer relevant.
Use the Silverstripe Forum to ask questions.