wp_parse_str() from mdawaffe. see #4467
git-svn-id: http://svn.automattic.com/wordpress/trunk@5709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9d3d20f063
commit
aac03a2066
|
@ -1188,4 +1188,11 @@ function sanitize_option($option, $value) { // Remember to call stripslashes!
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function wp_parse_str( $string, &$array ) {
|
||||||
|
parse_str( $string, $array );
|
||||||
|
if ( get_magic_quotes_gpc() )
|
||||||
|
$array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str
|
||||||
|
$array = apply_filters( 'wp_parse_str', $array );
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -604,9 +604,7 @@ function add_query_arg() {
|
||||||
$query = $uri;
|
$query = $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_str($query, $qs);
|
wp_parse_str($query, $qs);
|
||||||
if ( get_magic_quotes_gpc() )
|
|
||||||
$qs = stripslashes_deep($qs); // parse_str() adds slashes if magicquotes is on. See: http://php.net/parse_str
|
|
||||||
$qs = urlencode_deep($qs);
|
$qs = urlencode_deep($qs);
|
||||||
if ( is_array(func_get_arg(0)) ) {
|
if ( is_array(func_get_arg(0)) ) {
|
||||||
$kayvees = func_get_arg(0);
|
$kayvees = func_get_arg(0);
|
||||||
|
@ -1288,20 +1286,15 @@ function smilies_init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_parse_args( $args, $defaults = '' ) {
|
function wp_parse_args( $args, $defaults = '' ) {
|
||||||
if ( is_array( $args ) ) {
|
if ( is_array( $args ) )
|
||||||
$r =& $args;
|
$r =& $args;
|
||||||
} else {
|
else
|
||||||
parse_str( $args, $r );
|
wp_parse_str( $args, $r );
|
||||||
if ( get_magic_quotes_gpc() ) {
|
|
||||||
$r = stripslashes_deep( $r );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( is_array( $defaults ) ) {
|
if ( is_array( $defaults ) )
|
||||||
return array_merge( $defaults, $r );
|
return array_merge( $defaults, $r );
|
||||||
} else {
|
else
|
||||||
return $r;
|
return $r;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_maybe_load_widgets() {
|
function wp_maybe_load_widgets() {
|
||||||
|
|
|
@ -968,27 +968,24 @@ function language_attributes() {
|
||||||
echo $output;
|
echo $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function paginate_links( $arg = '' ) {
|
function paginate_links( $args = '' ) {
|
||||||
if ( is_array($arg) )
|
$defaults = array(
|
||||||
$a = &$arg;
|
'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
|
||||||
else
|
'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
|
||||||
parse_str($arg, $a);
|
'total' => 1,
|
||||||
|
'current' => 0,
|
||||||
|
'show_all' => false,
|
||||||
|
'prev_next' => true,
|
||||||
|
'prev_text' => __('« Previous'),
|
||||||
|
'next_text' => __('Next »'),
|
||||||
|
'end_size' => 1, // How many numbers on either end including the end
|
||||||
|
'mid_size' => 2, // How many numbers to either side of current not including current
|
||||||
|
'type' => 'plain',
|
||||||
|
'add_args' => false // array of query args to aadd
|
||||||
|
);
|
||||||
|
|
||||||
// Defaults
|
$args = wp_parse_args( $args, $defaults );
|
||||||
$base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
|
extract($args, EXTR_SKIP);
|
||||||
$format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number
|
|
||||||
$total = 1;
|
|
||||||
$current = 0;
|
|
||||||
$show_all = false;
|
|
||||||
$prev_next = true;
|
|
||||||
$prev_text = __('« Previous');
|
|
||||||
$next_text = __('Next »');
|
|
||||||
$end_size = 1; // How many numbers on either end including the end
|
|
||||||
$mid_size = 2; // How many numbers to either side of current not including current
|
|
||||||
$type = 'plain';
|
|
||||||
$add_args = false; // array of query args to aadd
|
|
||||||
|
|
||||||
extract($a);
|
|
||||||
|
|
||||||
// Who knows what else people pass in $args
|
// Who knows what else people pass in $args
|
||||||
$total = (int) $total;
|
$total = (int) $total;
|
||||||
|
|
Loading…
Reference in New Issue