PHP 클래스 Prado\Web\Javascripts\TJavaScript

TJavaScript is a utility class containing commonly-used javascript-related functions.
부터: 3.0
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

공개 메소드들

메소드 설명
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

비공개 메소드들

메소드 설명
checkJsonError ( )
convertToUtf8 ( string | array | mixed &$value, string $sourceEncoding ) Encodes an string or the content of an array to UTF8

메소드 상세

JSMin() 공개 정적인 메소드

This method is based on Douglas Crockford's JSMin.
public static JSMin ( $code ) : minimized
리턴 minimized version of the code

encode() 공개 정적인 메소드

Example: $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.
부터: 3.1.5
public static encode ( $value, $toMap = true, $encodeEmptyStrings = false ) : string
리턴 string the encoded string

isFunction() 공개 정적인 메소드

Deprecated, use {@link isJsLiteral} instead
public static isFunction ( $js )

isJsLiteral() 공개 정적인 메소드

public static isJsLiteral ( $js ) : boolean
리턴 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}

jsonDecode() 공개 정적인 메소드

This method invokes json_decode to perform the decoding.
public static jsonDecode ( $value, $assoc = false, $depth = 512 ) : mixed
리턴 mixed decoded variable

jsonEncode() 공개 정적인 메소드

This method invokes json_encode to perform the encoding.
public static jsonEncode ( $value, $options ) : string
리턴 string encoded string

quoteFunction() 공개 정적인 메소드

Deprecated, use {@link quoteJsLiteral} instead
public static quoteFunction ( $js )

quoteJsLiteral() 공개 정적인 메소드

public static quoteJsLiteral ( $js ) : Marks
리턴 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}

quoteString() 공개 정적인 메소드

After processing, the string is safely enclosed within a pair of quotation marks and can serve as a javascript string.
public static quoteString ( $js ) : string
리턴 string the quoted string

renderScriptBlock() 공개 정적인 메소드

Renders javascript block
public static renderScriptBlock ( $script ) : string
리턴 string rendering result

renderScriptBlocks() 공개 정적인 메소드

Renders a list of javascript blocks
public static renderScriptBlocks ( $scripts ) : string
리턴 string rendering result

renderScriptBlocksCallback() 공개 정적인 메소드

Renders a list of javascript code
public static renderScriptBlocksCallback ( $scripts ) : string
리턴 string rendering result

renderScriptFile() 공개 정적인 메소드

Renders a javascript file
public static renderScriptFile ( $file ) : string
리턴 string rendering result

renderScriptFiles() 공개 정적인 메소드

Renders a list of javascript files
public static renderScriptFiles ( $files ) : string
리턴 string rendering result