[buddypress-trac] [BuddyPress] #3797: Refactor database methods to accept array-style arguments
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Mon Dec 5 20:06:20 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 | Keywords: needs-patch
--------------------------+----------------------------
Right now, most of our database methods take a long list of arguments, eg
{{{function get( $max = false, $page = 1, $per_page = 25, $sort = 'DESC',
$search_terms = false, $filter = false, $display_comments = false,
$show_hidden = false, $exclude = false, $in = false, $spam = 'ham_only' )
{}}}
This is hard to read, and makes developing and troubleshooting more
troublesome than it ought to be. Accordingly, where possible, these
methods should be refactored so that if an array is passed as the first
argument, the rest of the arguments are ignored and we parse the passed
array with a set of defaults using wp_parse_args().
The same is true of some of the template class constructors
(BP_Activity_Template::__construct(), etc).
We probably should *not* formally deprecate the old way of passing
arguments, as WP's _deprecated_argument() will essentially break any
plugin that makes direct calls to these classes.
Patches - even partial patches! - are welcome. Easy props!
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3797>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list