Better preservation of query string when using add_query_arg(). Props in self- and Andy-flavored varieties. fixes #3308
git-svn-id: https://develop.svn.wordpress.org/trunk@4435 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8636ae5d98
commit
3567fff3db
@ -667,10 +667,13 @@ function add_query_arg() {
|
||||
}
|
||||
|
||||
foreach($qs as $k => $v) {
|
||||
if ( $v != '' ) {
|
||||
if ( $v !== FALSE ) {
|
||||
if ( $ret != '' )
|
||||
$ret .= '&';
|
||||
$ret .= "$k=$v";
|
||||
if ( empty($v) && !preg_match('|[?&]' . preg_quote($k, '|') . '=|', $query) )
|
||||
$ret .= $k;
|
||||
else
|
||||
$ret .= "$k=$v";
|
||||
}
|
||||
}
|
||||
$ret = $protocol . $base . $ret . $frag;
|
||||
@ -692,10 +695,10 @@ remove_query_arg(removekeyarray, [oldquery_or_uri])
|
||||
function remove_query_arg($key, $query='') {
|
||||
if ( is_array($key) ) { // removing multiple keys
|
||||
foreach ( (array) $key as $k )
|
||||
$query = add_query_arg($k, '', $query);
|
||||
$query = add_query_arg($k, FALSE, $query);
|
||||
return $query;
|
||||
}
|
||||
return add_query_arg($key, '', $query);
|
||||
return add_query_arg($key, FALSE, $query);
|
||||
}
|
||||
|
||||
function add_magic_quotes($array) {
|
||||
|
Loading…
Reference in New Issue
Block a user