Class \Prado\Web\Javascripts\TJavaScript
TJavaScript class.
TJavaScript is a utility class containing commonly-used javascript-related functions.
Class hierarchy
Author: Wei Zhuo<weizhuo[at]gmail[dot]com>Since: 3.0
public
static
|
encode(mixed $value[, bool $toMap = true ][, bool $encodeEmptyStrings = false ]) : string
Encodes a PHP variable into javascript representation.
Example:
For higher complexity data structures use jsonEncode and jsonDecode to serialize and unserialize. |
public
static
|
|
public
static
|
JSMin(string $code) : string
Minimize the size of a javascript script.
This method is based on Douglas Crockford's JSMin. |
public
static
|
jsonDecode(string $value[, bool $assoc = false ][, int $depth = 512 ]) : mixed
Decodes a javascript string into PHP variable.
This method invokes json_decode to perform the decoding. |
public
static
|
jsonEncode(mixed $value[, mixed $options = 0 ]) : string
Encodes a PHP variable into javascript string.
This method invokes json_encode to perform the encoding. |
public
static
|
|
public
static
|
quoteString(string $js) : string
Quotes a javascript string.
After processing, the string is safely enclosed within a pair of quotation marks and can serve as a javascript string. |
public
static
|
|
public
static
|
|
public
static
|
renderScriptBlocksCallback(array<string|int, mixed> $scripts) : string
Renders a list of javascript code
|
public
static
|
|
public
static
|
|
private
static
|
convertToUtf8(array<string|int, mixed>|mixed|string &$value, string $sourceEncoding) : mixed
Encodes an string or the content of an array to UTF8
|
|