mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 15:17:42 +02:00
js_escape improvements from Alexander Concha. Catches ' ' ' ' ' ' ' etc. for 2.0.x
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@5736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ac5691b028
commit
585d7513a8
@ -1067,7 +1067,7 @@ function clean_url( $url, $protocols = null ) {
|
|||||||
// Escape single quotes, specialchar double quotes, and fix line endings.
|
// Escape single quotes, specialchar double quotes, and fix line endings.
|
||||||
function js_escape($text) {
|
function js_escape($text) {
|
||||||
$safe_text = wp_specialchars($text, 'double');
|
$safe_text = wp_specialchars($text, 'double');
|
||||||
$safe_text = str_replace(''', "'", $safe_text);
|
$safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text));
|
||||||
$safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text));
|
$safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text));
|
||||||
return apply_filters('js_escape', $safe_text, $text);
|
return apply_filters('js_escape', $safe_text, $text);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user