[buddypress-trac] [BuddyPress] #3797: Refactor database methods to accept array-style arguments

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Wed Dec 7 13:31:56 UTC 2011


#3797: Refactor database methods to accept array-style arguments
--------------------------+-----------------------------
 Reporter:  boonebgorges  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Core          |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+-----------------------------

Comment (by boonebgorges):

 You're right. I was just looking at some places in WP where they used
 _deprecated_argument() *and* broke backward compatibility. My
 misunderstanding.

 So, my thought is something like this:
 {{{
 if ( count( func_get_args() ) > 1 ) {
         foreach( func_get_args() as $arg_key => $arg ) {
                 if ( 0 != $arg_key ) {
                         _deprecated_argument( $arg, __( 'Arguments should
 be passed as an array.', 'buddypress' ), '1.6' );
                 }
         }
 } else {
         $args = func_get_arg( 0 );
         $defaults = array( ... );
         $r = wp_parse_args( $args, defaults );
         extract( $r );
 }
 }}}

 Seem right?

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3797#comment:2>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list