Method | Description | |
---|---|---|
JSMin ( $code ) : minimized | Minimize the size of a javascript script. | |
encode ( $value, $toMap = true, $encodeEmptyStrings = false ) : string | Encodes a PHP variable into javascript representation. | |
isFunction ( $js ) | Deprecated, use {@link isJsLiteral} instead | |
isJsLiteral ( $js ) : boolean | ||
jsonDecode ( $value, $assoc = false, $depth = 512 ) : mixed | Decodes a javascript string into PHP variable. | |
jsonEncode ( $value, $options ) : string | Encodes a PHP variable into javascript string. | |
quoteFunction ( $js ) | Deprecated, use {@link quoteJsLiteral} instead | |
quoteJsLiteral ( $js ) : Marks | ||
quoteString ( $js ) : string | Quotes a javascript string. | |
renderScriptBlock ( $script ) : string | Renders javascript block | |
renderScriptBlocks ( $scripts ) : string | Renders a list of javascript blocks | |
renderScriptBlocksCallback ( $scripts ) : string | Renders a list of javascript code | |
renderScriptFile ( $file ) : string | Renders a javascript file | |
renderScriptFiles ( $files ) : string | Renders a list of javascript files |
Method | Description | |
---|---|---|
checkJsonError ( ) | ||
convertToUtf8 ( string | array | mixed &$value, string $sourceEncoding ) | Encodes an string or the content of an array to UTF8 |
public static JSMin ( $code ) : minimized | ||
return | minimized | version of the code |
$options['onLoading'] = "doit";
$options['onComplete'] = "more";
echo TJavaScript::encode($options);
expects the following javascript code
{'onLoading':'doit','onComplete':'more'}
For higher complexity data structures use {@link jsonEncode} and {@link jsonDecode}
to serialize and unserialize. public static isFunction ( $js ) |
public static isJsLiteral ( $js ) : boolean | ||
return | boolean | true if the parameter is marked as a javascript function, i.e. if it's considered as a raw javascript function that is not supposed to be encoded by {@link encode} |
public static jsonDecode ( $value, $assoc = false, $depth = 512 ) : mixed | ||
return | mixed | decoded variable |
public static jsonEncode ( $value, $options ) : string | ||
return | string | encoded string |
public static quoteFunction ( $js ) |
public static quoteJsLiteral ( $js ) : Marks | ||
return | Marks | a string as a javascript function. Once marke, the string is considered as a raw javascript function that is not supposed to be encoded by {@link encode} |
public static quoteString ( $js ) : string | ||
return | string | the quoted string |
public static renderScriptBlock ( $script ) : string | ||
return | string | rendering result |
public static renderScriptBlocks ( $scripts ) : string | ||
return | string | rendering result |
public static renderScriptBlocksCallback ( $scripts ) : string | ||
return | string | rendering result |
public static renderScriptFile ( $file ) : string | ||
return | string | rendering result |
public static renderScriptFiles ( $files ) : string | ||
return | string | rendering result |