[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/Javascripts/ -> TJavaScript.php (sommaire)

TJavaScript class file

Author: Wei Zhuo
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TJavaScript.php 1397 2006-09-07 07:55:53Z wei $
Poids: 211 lignes (6 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

TJavaScript:: (10 méthodes):
  renderScriptFiles()
  renderScriptFile()
  renderScriptBlocks()
  renderScriptBlock()
  quoteString()
  quoteFunction()
  isFunction()
  encode()
  jsonEncode()
  jsonDecode()


Classe: TJavaScript  - X-Ref

TJavaScript class.

TJavaScript is a utility class containing commonly-used javascript-related
functions.

renderScriptFiles($files)   X-Ref
Renders a list of javascript files

param: array URLs to the javascript files
return: string rendering result

renderScriptFile($file)   X-Ref
Renders a javascript file

param: string URL to the javascript file
return: string rendering result

renderScriptBlocks($scripts)   X-Ref
Renders a list of javascript blocks

param: array javascript blocks
return: string rendering result

renderScriptBlock($script)   X-Ref
Renders javascript block

param: string javascript block
return: string rendering result

quoteString($js,$forUrl=false)   X-Ref
Quotes a javascript string.
After processing, the string can be safely enclosed within a pair of
quotation marks and serve as a javascript string.

param: string string to be quoted
param: boolean whether this string is used as a URL
return: string the quoted string

quoteFunction($js)   X-Ref

return: string considers the string as raw javascript function code

isFunction($js)   X-Ref

return: boolean true if string is raw javascript function code, i.e., if

encode($value,$toMap=true)   X-Ref
Encodes a PHP variable into javascript representation.

Example:
<code>
$options['onLoading'] = "doit";
$options['onComplete'] = "more";
echo TJavaScript::encode($options);
//expects the following javascript code
// {'onLoading':'doit','onComplete':'more'}
</code>

For higher complexity data structures use {@link jsonEncode} and {@link jsonDecode}
to serialize and unserialize.

Note: strings begining with <tt>javascript:</tt> will be considered as
raw javascript code and no encoding of that string will be enforced.

param: mixed PHP variable to be encoded
param: boolean whether the output is a map or a list.
return: string the encoded string

jsonEncode($value)   X-Ref
Encodes a PHP variable into javascript string.
This method invokes {@TJSON} utility class to perform the encoding.

param: mixed variable to be encoded
return: string encoded string

jsonDecode($value)   X-Ref
Decodes a javascript string into PHP variable.
This method invokes {@TJSON} utility class to perform the decoding.

param: string string to be decoded
return: mixed decoded variable



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7