From 9efcb29ab08f0832587316f34c5385fea1b839d7 Mon Sep 17 00:00:00 2001
From: jrfnl <jrfnl@users.noreply.github.com>
Date: Mon, 16 Sep 2019 05:00:01 +0200
Subject: [PATCH] Simplify do_action() / remove PHP 4 code
---
src/wp-includes/plugin.php | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/wp-includes/plugin.php b/src/wp-includes/plugin.php
index 3e021bbdd8..1f6cacd5b4 100644
|
a
|
b
|
function do_action( $tag, $arg = '' ) { |
| 448 | 448 | ++$wp_actions[ $tag ]; |
| 449 | 449 | } |
| 450 | 450 | |
| | 451 | $all_args = func_get_args(); |
| | 452 | |
| 451 | 453 | // Do 'all' actions first |
| 452 | 454 | if ( isset( $wp_filter['all'] ) ) { |
| 453 | 455 | $wp_current_filter[] = $tag; |
| 454 | | $all_args = func_get_args(); |
| 455 | 456 | _wp_call_all_hook( $all_args ); |
| 456 | 457 | } |
| 457 | 458 | |
| … |
… |
function do_action( $tag, $arg = '' ) { |
| 466 | 467 | $wp_current_filter[] = $tag; |
| 467 | 468 | } |
| 468 | 469 | |
| 469 | | $args = array(); |
| 470 | | if ( is_array( $arg ) && 1 == count( $arg ) && isset( $arg[0] ) && is_object( $arg[0] ) ) { // array(&$this) |
| 471 | | $args[] =& $arg[0]; |
| 472 | | } else { |
| 473 | | $args[] = $arg; |
| 474 | | } |
| 475 | | for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) { |
| 476 | | $args[] = func_get_arg( $a ); |
| | 470 | $args = $all_args; |
| | 471 | array_shift( $args ); |
| | 472 | |
| | 473 | if ( empty( $args ) ) { |
| | 474 | $args = array( '' ); |
| 477 | 475 | } |
| 478 | 476 | |
| 479 | 477 | $wp_filter[ $tag ]->do_action( $args ); |