Class TJavaScriptLiteral

Description

TJavaScriptLiteral class that encloses string literals that are not supposed to be escaped by TJavaScript::encode()

Since Prado 3.2 all the data that gets sent clientside inside a javascript statement is encoded by default to avoid any kind of injection. Sometimes there's the need to bypass this encoding and send raw javascript code. To ensure that a string doesn't get encoded by TJavaScript::encode(), construct a new TJavaScriptLiteral:

  1.  // a javascript test string
  2.  $js="alert('hello')";
  3.  // the string in $raw will not be encoded when sent clientside inside a javascript block
  4.  $raw=new TJavaScriptLiteral($js);
  5.  // shortened form
  6.  $raw=_js($js);

  • version: $Id: TComponent.php 3123 2012-03-26 10:10:51Z ctrlaltca@gmail.com $
  • since: prado 3.2

Located in /TComponent.php (line 1003)


	
			
Direct descendents
Class Description
TJavaScriptString TJavaScriptString class is an internal class that marks strings that will be forcibly encoded when rendered inside a javascript block
Variable Summary
mixed $_s
Method Summary
TJavaScriptLiteral __construct ( $s)
void __toString ()
Variables
mixed $_s (line 1005)
  • access: protected
Methods
Constructor __construct (line 1007)
  • access: public
TJavaScriptLiteral __construct ( $s)
  • $s
toJavaScriptLiteral (line 1017)
  • access: public
void toJavaScriptLiteral ()

Redefined in descendants as:
__toString (line 1012)
  • access: public
void __toString ()

Documentation generated on Mon, 25 Jun 2012 14:37:37 +0200 by phpDocumentor 1.4.3