Better preservation of query string when using add_query_arg(). Props in self- and Andy-flavored varieties. fixes #3308
git-svn-id: http://svn.automattic.com/wordpress/trunk@4435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c93dcc13d3
commit
9b0c765df6
|
@ -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