Fix for preg /e automatically adding slashes under some magic_quotes setting. BLAH.
Fix to not double escape values we're putting into the DB. This is an old, old bug from b2. git-svn-id: http://svn.automattic.com/wordpress/trunk@1021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6589bd70fd
commit
3f69cb1566
|
@ -70,7 +70,7 @@ function wpautop($pee, $br = 1) {
|
||||||
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
||||||
$pee = preg_replace('!(</?(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
|
$pee = preg_replace('!(</?(?:table|thead|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
|
||||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
|
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
|
||||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " '$1' . clean_pre('$2') . '</pre>' ", $pee);
|
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . clean_pre('$2') . '</pre>' ", $pee);
|
||||||
$pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee);
|
$pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee);
|
||||||
|
|
||||||
return $pee;
|
return $pee;
|
||||||
|
@ -224,6 +224,7 @@ function autobrize($content) {
|
||||||
$content = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content);
|
$content = preg_replace("/(\015\012)|(\015)|(\012)/", "<br />\n", $content);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unautobrize($content) {
|
function unautobrize($content) {
|
||||||
$content = preg_replace("/<br>\n/", "\n", $content); //for PHP versions before 4.0.5
|
$content = preg_replace("/<br>\n/", "\n", $content); //for PHP versions before 4.0.5
|
||||||
$content = preg_replace("/<br \/>\n/", "\n", $content);
|
$content = preg_replace("/<br \/>\n/", "\n", $content);
|
||||||
|
@ -232,16 +233,15 @@ function unautobrize($content) {
|
||||||
|
|
||||||
|
|
||||||
function format_to_edit($content) {
|
function format_to_edit($content) {
|
||||||
global $autobr;
|
|
||||||
$content = stripslashes($content);
|
$content = stripslashes($content);
|
||||||
if ($autobr) { $content = unautobrize($content); }
|
|
||||||
$content = htmlspecialchars($content);
|
$content = htmlspecialchars($content);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function format_to_post($content) {
|
function format_to_post($content) {
|
||||||
global $post_autobr,$comment_autobr;
|
global $wpdb;
|
||||||
$content = addslashes($content);
|
$content = stripslashes(stripslashes($content));
|
||||||
if ($post_autobr || $comment_autobr) { $content = autobrize($content); }
|
$content = $wpdb->escape($content);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue