CJavaScriptExpression

Package system.web.helpers
Inheritance class CJavaScriptExpression
Since 1.1.11
Source Code framework/web/helpers/CJavaScriptExpression.php
CJavaScriptExpression represents a JavaScript expression that does not need escaping. It can be passed to CJavaScript::encode() and the code will stay as is.

Public Properties

Property Type Description Defined By
code string the javascript expression wrapped by this object CJavaScriptExpression

Public Methods

Method Description Defined By
__construct() CJavaScriptExpression
__toString() String magic method CJavaScriptExpression

Property Details

code property

public string $code;

the javascript expression wrapped by this object

Method Details

__construct() method

public void __construct(string $code)
$code string a javascript expression that is to be wrapped by this object
Source Code: framework/web/helpers/CJavaScriptExpression.php#30 (show)
public function __construct($code)
{
    if(!
is_string($code))
        throw new 
CException('Value passed to CJavaScriptExpression should be a string.');
    if(
strpos($code'js:')===0)
        
$code=substr($code,3);
    
$this->code=$code;
}

__toString() method

public string __toString()
{return} string the javascript expression wrapped by this object
Source Code: framework/web/helpers/CJavaScriptExpression.php#43 (show)
public function __toString()
{
    return 
$this->code;
}

String magic method

© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc/api/1.1/CJavaScriptExpression