diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Json/Expr.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Json/Expr.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,80 @@ + + * $foo = array( + * 'integer' =>9, + * 'string' =>'test string', + * 'function' => Zend_Json_Expr( + * 'function(){ window.alert("javascript function encoded by Zend_Json") }' + * ), + * ); + * + * Zend_Json::encode($foo, false, array('enableJsonExprFinder' => true)); + * // it will returns json encoded string: + * // {"integer":9,"string":"test string","function":function(){window.alert("javascript function encoded by Zend_Json")}} + * + * + * @category Zend + * @package Zend_Json + * @subpackage Expr + * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Json_Expr +{ + /** + * Storage for javascript expression. + * + * @var string + */ + protected $_expression; + + /** + * Constructor + * + * @param string $expression the expression to hold. + * @return void + */ + public function __construct($expression) + { + $this->_expression = (string) $expression; + } + + /** + * Cast to string + * + * @return string holded javascript expression. + */ + public function __toString() + { + return $this->_expression; + } +}