Changeset 5397

Show
Ignore:
Timestamp:
05/05/07 17:09:45 (1 year ago)
Author:
ryan
Message:

Resurrect wp_parse_args() for 2.2.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.2/wp-includes/functions.php

    r5377 r5397  
    14701470} 
    14711471 
     1472function wp_parse_args( $args, $defaults = '' ) { 
     1473    if ( is_array($args) ) : 
     1474        $r =& $args; 
     1475    else : 
     1476        parse_str( $args, $r ); 
     1477        if ( get_magic_quotes_gpc() ) 
     1478            $r = stripslashes_deep( $r ); 
     1479    endif; 
     1480 
     1481    if ( is_array($defaults) ) : 
     1482        extract($defaults); 
     1483        extract($r); 
     1484        return compact(array_keys($defaults)); // only those options defined in $defaults 
     1485    else : 
     1486        return $r; 
     1487    endif; 
     1488} 
     1489 
    14721490function wp_maybe_load_widgets() { 
    14731491    if ( !function_exists( 'dynamic_sidebar' ) ) {