Resurrect wp_parse_args() for 2.2.

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-05-05 17:09:45 +00:00
parent c973ad1d0e
commit 2240947c82
1 changed files with 18 additions and 0 deletions

View File

@ -1469,6 +1469,24 @@ function smilies_init() {
} }
} }
function wp_parse_args( $args, $defaults = '' ) {
if ( is_array($args) ) :
$r =& $args;
else :
parse_str( $args, $r );
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 :
return $r;
endif;
}
function wp_maybe_load_widgets() { function wp_maybe_load_widgets() {
if ( !function_exists( 'dynamic_sidebar' ) ) { if ( !function_exists( 'dynamic_sidebar' ) ) {
require_once ABSPATH . WPINC . '/widgets.php'; require_once ABSPATH . WPINC . '/widgets.php';