static function ToJavascript($string, $htmlEncode = true)
        {    
            if ($htmlEncode)
            {
                $string = self::ToHtml($string);
            }
            return '\'' . addcslashes($string, "'\r\n\\") . '\'';
        }
static function ToJavascript($string, $htmlEncode = true)
        {    
            if ($htmlEncode)
            {
                $string = self::ToHtml($string);
            }
            return '\'' . addcslashes($string, "'\r\n\\") . '\'';
        }
static function ToJavascript ( $ string , $ htmlEncode = true ) { if ( $ htmlEncode ) { $ string = self :: ToHtml ( $ string ) ; } return '\'' . addcslashes ( $ string , "'\r\n\\" ) . '\'' ; }
Creates a single quoted string that can be put into javascript variables.
@param string $string The input string
@param boolean $htmlEncode True if string shall be html encoded, first
@return string
Creates a single quoted string that can be put into javascript variables .