diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 5c5c2a5849..7149c0aeb7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1490,21 +1490,24 @@ function smilies_init() { } function wp_parse_args( $args, $defaults = '' ) { - if ( is_array($args) ) : + if ( is_array( $args ) ) { $r =& $args; - else : + } else { parse_str( $args, $r ); - if ( get_magic_quotes_gpc() ) + if ( get_magic_quotes_gpc() ) { $r = stripslashes_deep( $r ); - endif; - - if ( is_array($defaults) ) : - extract($defaults); - extract($r); - return compact(array_keys($defaults)); // only those options defined in $defaults - else : + } + } + + if ( is_array( $defaults ) ) { + extract( $defaults ); + extract( $r ); + // Note: this only returns the variables that were in $defaults + // to begin with. All other variables are discarded. + return compact( array_keys( $defaults ) ); + } else { return $r; - endif; + } } function wp_maybe_load_widgets() {