Code Modernisation: Simplify some logic in apply_filters()
.
Props jrf. See #47678. git-svn-id: https://develop.svn.wordpress.org/trunk@46146 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
802c23e059
commit
209666d332
@ -181,12 +181,11 @@ function has_filter( $tag, $function_to_check = false ) {
|
|||||||
function apply_filters( $tag, $value ) {
|
function apply_filters( $tag, $value ) {
|
||||||
global $wp_filter, $wp_current_filter;
|
global $wp_filter, $wp_current_filter;
|
||||||
|
|
||||||
$args = array();
|
$args = func_get_args();
|
||||||
|
|
||||||
// Do 'all' actions first.
|
// Do 'all' actions first.
|
||||||
if ( isset( $wp_filter['all'] ) ) {
|
if ( isset( $wp_filter['all'] ) ) {
|
||||||
$wp_current_filter[] = $tag;
|
$wp_current_filter[] = $tag;
|
||||||
$args = func_get_args();
|
|
||||||
_wp_call_all_hook( $args );
|
_wp_call_all_hook( $args );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,11 +200,7 @@ function apply_filters( $tag, $value ) {
|
|||||||
$wp_current_filter[] = $tag;
|
$wp_current_filter[] = $tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $args ) ) {
|
// Don't pass the tag name to WP_Hook.
|
||||||
$args = func_get_args();
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't pass the tag name to WP_Hook
|
|
||||||
array_shift( $args );
|
array_shift( $args );
|
||||||
|
|
||||||
$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
|
$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
|
||||||
|
Loading…
Reference in New Issue
Block a user