Improvements to untrailingslashit() and trailingslashit(). props Jamie Talbot. fixes #3899

git-svn-id: http://svn.automattic.com/wordpress/trunk@5021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-03-10 08:32:57 +00:00
parent de23b425c3
commit 98e4d11c00
1 changed files with 2 additions and 4 deletions

View File

@ -563,13 +563,11 @@ function backslashit($string) {
}
function trailingslashit($string) {
if ( '/' != substr($string, -1))
$string .= '/';
return $string;
return untrailingslashit($string) . '/';
}
function untrailingslashit($string) {
return preg_replace('|/+$|', '', $string);
return rtrim($string, '/');
}
function addslashes_gpc($gpc) {