Adjusted ignoring edge of hook event to empty string.
This commit is contained in:
1 parent
c23531e890
commit
78cbb85de8
2 files changed
+7
-7
No files matched your search
@@ -14,13 +14,13 @@ class Core_Events implements Hook_Event_Config_Interface {
|
|||||||
public function get_events(): array {
|
public function get_events(): array {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
[ 'Plugins Load', 'plugin', null, 'plugins_loaded', - 1, - 2 ],
|
[ 'Plugins Load', 'plugin', '', 'plugins_loaded', - 1, - 2 ],
|
||||||
[ 'Plugins Loaded Hook', 'plugin', 'plugins_loaded' ],
|
[ 'Plugins Loaded Hook', 'plugin', 'plugins_loaded' ],
|
||||||
[ 'Themes Load', 'theme', 'setup_theme', 'after_setup_theme' ],
|
[ 'Themes Load', 'theme', 'setup_theme', 'after_setup_theme' ],
|
||||||
[ 'Core Init', 'core', 'init', 'wp_loaded' ],
|
[ 'Core Init', 'core', 'init', 'wp_loaded' ],
|
||||||
[ 'Admin Init', 'core', 'admin_init' ],
|
[ 'Admin Init', 'core', 'admin_init' ],
|
||||||
[ 'Admin Menu', 'core', '_admin_menu', 'admin_menu' ],
|
[ 'Admin Menu', 'core', '_admin_menu', 'admin_menu' ],
|
||||||
[ 'Toolbar', 'core', 'admin_bar_menu', null ],
|
[ 'Toolbar', 'core', 'admin_bar_menu', '' ],
|
||||||
[ 'Main Loop', 'theme', 'loop_start', 'loop_end' ],
|
[ 'Main Loop', 'theme', 'loop_start', 'loop_end' ],
|
||||||
[ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ],
|
[ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -66,15 +66,15 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
|||||||
*
|
*
|
||||||
* @param string $event Hook event name.
|
* @param string $event Hook event name.
|
||||||
* @param string $category Hook event category.
|
* @param string $category Hook event category.
|
||||||
* @param string|null $start Start hook name. Pass null to ignore.
|
* @param string $start Start hook name. Pass empty string to ignore.
|
||||||
* @param string|null $stop Stop hook name (defaults to start name).
|
* @param string|null $stop Stop hook name (defaults to start name). Pass empty string to ignore.
|
||||||
* @param int $start_priority Start hook priority (defaults to -1).
|
* @param int $start_priority Start hook priority (defaults to -1).
|
||||||
* @param int $stop_priority Stop hook priority (defaults to max int).
|
* @param int $stop_priority Stop hook priority (defaults to max int).
|
||||||
*/
|
*/
|
||||||
private function add_event(
|
private function add_event(
|
||||||
string $event,
|
string $event,
|
||||||
string $category,
|
string $category,
|
||||||
?string $start = null,
|
string $start,
|
||||||
?string $stop = null,
|
?string $stop = null,
|
||||||
int $start_priority = - 1,
|
int $start_priority = - 1,
|
||||||
int $stop_priority = PHP_INT_MAX
|
int $stop_priority = PHP_INT_MAX
|
||||||
@@ -85,7 +85,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
|||||||
|
|
||||||
$collector = $this;
|
$collector = $this;
|
||||||
|
|
||||||
if ( null !== $start ) {
|
if ( '' !== $start ) {
|
||||||
add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) {
|
add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) {
|
||||||
$collector->start( $event, $category );
|
$collector->start( $event, $category );
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
|||||||
}, $start_priority );
|
}, $start_priority );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( null !== $stop ) {
|
if ( '' !== $stop ) {
|
||||||
add_action( $stop, function ( $input = null ) use ( $collector, $event ) {
|
add_action( $stop, function ( $input = null ) use ( $collector, $event ) {
|
||||||
$collector->stop( $event );
|
$collector->stop( $event );
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user