[ Index ]
 

Code source de CakePHP 1.1.13.4450

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

title

Body

[fermer]

/cake/libs/view/helpers/ -> javascript.php (sommaire)

Javascript Helper class file. PHP versions 4 and 5

Copyright: Copyright 2005-2007, Cake Software Foundation, Inc.
License: http://www.opensource.org/licenses/mit-license.php The MIT License
Version: $Revision: 4409 $
Poids: 317 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

JavascriptHelper:: (11 méthodes):
  codeBlock()
  link()
  linkOut()
  escapeScript()
  escapeString()
  event()
  cacheEvents()
  writeEvents()
  includeScript()
  object()
  afterRender()


Classe: JavascriptHelper  - X-Ref

Javascript Helper class for easy use of JavaScript.

JavascriptHelper encloses all methods needed while working with JavaScript.

codeBlock($script, $allowCache = true)   X-Ref
Returns a JavaScript script tag.

param: string $script The JavaScript to be wrapped in SCRIPT tags.
param: boolean $allowCache Allows the script to be cached if non-event caching is active
return: string The full SCRIPT element, with the JavaScript inside it.

link($url)   X-Ref
Returns a JavaScript include tag (SCRIPT element)

param: string $url URL to JavaScript file.
return: string

linkOut($url)   X-Ref
Returns a JavaScript include tag for an externally-hosted script

param: string $url URL to JavaScript file.
return: string

escapeScript($script)   X-Ref
Escape carriage returns and single and double quotes for JavaScript segments.

param: string $script string that might have javascript elements
return: string escaped string

escapeString($string)   X-Ref
Escape a string to be JavaScript friendly.

List of escaped ellements:
+ "\r\n" => '\n'
+ "\r" => '\n'
+ "\n" => '\n'
+ '"' => '\"'
+ "'" => "\\'"

param: string $script String that needs to get escaped.
return: string Escaped string.

event($object, $event, $observer = null, $useCapture = false)   X-Ref
Attach an event to an element. Used with the Prototype library.

param: string $object Object to be observed
param: string $event event to observe
param: string $observer function to call
param: boolean $useCapture default true
return: boolean true on success

cacheEvents($file = false, $all = false)   X-Ref
Cache JavaScript events created with event()

param: boolean $file If true, code will be written to a file
param: boolean $all If true, all code written with JavascriptHelper will be sent to a file
return: void

writeEvents()   X-Ref
Write cached JavaScript events

return: string

includeScript($script = "")   X-Ref
Includes the Prototype Javascript library (and anything else) inside a single script tag.

Note: The recommended approach is to copy the contents of
javascripts into your application's
public/javascripts/ directory, and use @see javascriptIncludeTag() to
create remote script links.

param: string $script name of script to include
return: string script with all javascript in/javascripts folder

object($data = array()   X-Ref
Generates a JavaScript object in JavaScript Object Notation (JSON)
from an array

param: array $data Data to be converted
param: boolean $block Wraps return value in a <script/> block if true
param: string $prefix Prepends the string to the returned data
param: string $postfix Appends the string to the returned data
param: array $stringKeys A list of array keys to be treated as a string
param: boolean $quoteKeys If false, treats $stringKey as a list of keys *not* to be quoted
param: string $q The type of quote to use
return: string A JSON code block

afterRender()   X-Ref
AfterRender callback.  Writes any cached events to the view, or to a temp file.

return: void



Généré le : Sun Feb 25 19:27:47 2007 par Balluche grâce à PHPXref 0.7