Méthode | 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 |
Méthode | 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 | ||
Résultat | 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 | ||
Résultat | 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 | ||
Résultat | mixed | decoded variable |
public static jsonEncode ( $value, $options ) : string | ||
Résultat | string | encoded string |
public static quoteFunction ( $js ) |
public static quoteJsLiteral ( $js ) : Marks | ||
Résultat | 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 | ||
Résultat | string | the quoted string |
public static renderScriptBlock ( $script ) : string | ||
Résultat | string | rendering result |
public static renderScriptBlocks ( $scripts ) : string | ||
Résultat | string | rendering result |
public static renderScriptBlocksCallback ( $scripts ) : string | ||
Résultat | string | rendering result |
public static renderScriptFile ( $file ) : string | ||
Résultat | string | rendering result |
public static renderScriptFiles ( $files ) : string | ||
Résultat | string | rendering result |