added CJavaScriptExpression while keeping BC

This commit is contained in:
Alexander Makarov
2012-07-27 01:54:19 +04:00
parent c1ac363f76
commit ada1cedc7d
20 changed files with 177 additions and 65 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
* CJavaScriptExpression class file.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 2012 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CJavaScriptExpression represents a JavaScript expression that does not need escaping.
* It can be passed to {@link CJavaScript::encode()} and the code will stay as is
* no matter if $safe set to true or not.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @package system.web.helpers
* @since 1.1.11
*/
class CJavaScriptExpression
{
public $code;
/**
* @param $code
*/
public function __construct($code)
{
$this->code=$code;
}
/**
* String magic method
* @return string the DB expression
*/
public function __toString()
{
return $this->code;
}
}