#7335 closed enhancement (wontfix)
Anonymize BP Core Dependency functions file.
Reported by: | tw2113 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Core | Keywords: | close |
Cc: |
Description
When JJJ first wrote up the bp-core-dependency.php file, he left a note at the top regarding utilizing PHP 5.3's anonymous function capabilities for the file.
This ticket is meant to help move that to a reality. We will need to keep in mind anyone who may be calling the functions directly, and help them out the best we can.
Attachments (3)
Change History (17)
This ticket was mentioned in Slack in #buddypress by tw2113. View the logs.
8 years ago
#4
@
8 years ago
The bp_allowed_themes()
function is an odd one, in that it's present, and not hooked into anything, and doesn't appear to be used in core anywhere.
Updated diff pending, once I have a chance to review changes.
#5
@
8 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 2.8
Added a more complete anonymized actions/filters patch, as well as a patch that deprecates all the old functions.
Left bp_allowed_themes() alone like noted earlier.
#6
@
8 years ago
- Keywords 2nd-opinion added
Looks good but it makes these files much longer and adds functions in a file that was originally designed to not really have (m)any functions in. The priorities are also a little harder to read this way. Would be interested in opinions from other people.
Maybe assign anonymous functions to variables and use those to replace the add_action lines, keeping them short and tidy. Maybe this is just me over-reacting to a niggle.
#8
@
8 years ago
For an example highlighting one of Paul's thoughts above, the variable storage would look like this:
<?php $bp_ready = function() { /** * Fires on the 'wp' hook, which runs after BP is set up and the page is about to render. * * @since 1.6.0 */ do_action( 'bp_ready' ); }; ... add_action( 'wp', $bp_ready, 10 );
#9
@
8 years ago
What is the benefit of switching to anonymous functions, especially if we're keeping the old ones around?
#10
@
8 years ago
Yeah, I do not see much of a point to moving to anonymous functions here. Unless there is a gigantic performance boost!
Also, it's harder to backtrace anonymous functions.
#11
@
8 years ago
It was pretty much just a response to the note from JJJ in the file. If you'd prefer not proceed with this one and wontfix, no hard feelings.
Add deprecated function notices to functions in the BP Core Dependency declarations.