esc_js alternative

This commit is contained in:
Mike Jolley 2012-10-17 16:42:57 +01:00
parent 98b21a4a44
commit 9ec5090356
1 changed files with 8 additions and 2 deletions

View File

@ -1756,7 +1756,7 @@ class Woocommerce {
* @return void
*/
function add_inline_js( $code ) {
$this->_inline_js .= esc_js( "\n" . $code . "\n" );
$this->_inline_js .= "\n" . $code . "\n";
}
/**
@ -1769,7 +1769,13 @@ class Woocommerce {
if ( $this->_inline_js ) {
echo "<!-- WooCommerce JavaScript-->\n<script type=\"text/javascript\">\njQuery(document).ready(function($) {";
// Sanitize
$this->_inline_js = wp_check_invalid_utf8( $this->_inline_js );
$this->_inline_js = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes( $this->_inline_js ) );
$this->_inline_js = str_replace( "\r", '', $this->_inline_js );
// Output
echo $this->_inline_js;
echo "});\n</script>\n";