src/Library/Helper/Html.php
public static function javascriptProtect($str = '', $protect_quotes = false)
    {
        $str = preg_replace('/\s\s+/', ' ', $str);
        $str = htmlentities($str);
        if (true===$protect_quotes) {
            $str = str_replace("'", "\'", $str);
            $str = str_replace('"', '\"', $str);
        }
        return $str;
    }
public static function javascriptProtect($str = '', $protect_quotes = false)
    {
        $str = preg_replace('/\s\s+/', ' ', $str);
        $str = htmlentities($str);
        if (true===$protect_quotes) {
            $str = str_replace("'", "\'", $str);
            $str = str_replace('"', '\"', $str);
        }
        return $str;
    }
public static function javascriptProtect ( $ str = '' , $ protect_quotes = false ) { $ str = preg_replace ( '/\s\s+/' , ' ' , $ str ) ; $ str = htmlentities ( $ str ) ; if ( true === $ protect_quotes ) { $ str = str_replace ( "'" , "\'" , $ str ) ; $ str = str_replace ( '"' , '\"' , $ str ) ; } return $ str ; }
Build an HTML string to use in javascripts attributes or functions

@param   string  $str The HTML string to protect
@param   bool    $protect_quotes Protect all quotes (simple and double) with a slash
@return  string  The HTML string ready for javascript insertion
Build an HTML string to use in javascripts attributes or functions