framework/web/helpers/CJavaScript.php
public static function quote($js,$forUrl=false)
	{
		$js = (string)$js;

		Yii::import('system.vendors.zend-escaper.Escaper');
		$escaper=new Escaper(Yii::app()->charset);
		if($forUrl)
			return $escaper->escapeUrl($js);
		else
			return $escaper->escapeJs($js);
	}
public static function quote($js,$forUrl=false)
	{
		$js = (string)$js;

		Yii::import('system.vendors.zend-escaper.Escaper');
		$escaper=new Escaper(Yii::app()->charset);
		if($forUrl)
			return $escaper->escapeUrl($js);
		else
			return $escaper->escapeJs($js);
	}
public static function quote ( $ js , $ forUrl = false ) { $ js = ( string ) $ js ; Yii :: import ( 'system.vendors.zend-escaper.Escaper' ) ; $ escaper = new Escaper ( Yii :: app ( ) -> charset ) ; if ( $ forUrl ) return $ escaper -> escapeUrl ( $ js ) ; else return $ escaper -> escapeJs ( $ js ) ; }
Quotes a javascript string.
After processing, the string can be safely enclosed within a pair of
quotation marks and serve as a javascript string.
@param string $js string to be quoted
@param boolean $forUrl whether this string is used as a URL
@return string the quoted string
Quotes a javascript string . After processing the string can be safely enclosed within a pair of quotation marks and serve as a javascript string .