Make replacement strings backref safe without using \${1} so as to preserve php <= 4.2 compatible. Props mdawaffe. fixes #2774

git-svn-id: https://develop.svn.wordpress.org/trunk@3855 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-06-08 03:17:01 +00:00
parent 1041498585
commit eae22f445e
2 changed files with 14 additions and 13 deletions

View File

@@ -521,10 +521,11 @@ function format_to_post($content) {
function zeroise($number,$threshold) { // function to add leading zeros when necessary
return sprintf('%0'.$threshold.'s', $number);
}
}
function backslashit($string) {
$string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
$string = preg_replace('/([a-z])/i', '\\\\\1', $string);
return $string;
}