Keep the frag at the end. Props mdawaffe. fixes #3078

git-svn-id: http://svn.automattic.com/wordpress/trunk@4123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-08-30 01:02:45 +00:00
parent 11e556e7e6
commit bad9c9f18d
1 changed files with 6 additions and 1 deletions

View File

@ -606,6 +606,11 @@ function add_query_arg() {
$uri = @func_get_arg(2);
}
if ( $frag = strstr($uri, '#') )
$uri = substr($uri, 0, -strlen($frag));
else
$frag = '';
if ( preg_match('|^https?://|i', $uri, $matches) ) {
$protocol = $matches[0];
$uri = substr($uri, strlen($protocol));
@ -645,7 +650,7 @@ function add_query_arg() {
$ret .= "$k=$v";
}
}
$ret = $protocol . $base . $ret;
$ret = $protocol . $base . $ret . $frag;
if ( get_magic_quotes_gpc() )
$ret = stripslashes($ret); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str
return trim($ret, '?');