Added core events and tracking of distinct sidebars.
This commit is contained in:
1 parent
4166802c89
commit
2cb708f70d
3 files changed
+18
-2
No files matched your search
@@ -18,12 +18,16 @@ class Core_Events implements Hook_Event_Config_Interface {
|
||||
[ 'Plugins Loaded Hook', 'plugin', 'plugins_loaded' ],
|
||||
[ 'Themes Load', 'theme', 'setup_theme', 'after_setup_theme' ],
|
||||
[ 'Core Init', 'core', 'init', 'wp_loaded' ],
|
||||
[ 'Query Setup', 'core', 'wp_loaded', 'template_redirect', PHP_INT_MAX, -1 ],
|
||||
[ 'Template Loader', 'theme', 'template_redirect', 'template_include' ],
|
||||
[ 'Admin Init', 'core', 'admin_init' ],
|
||||
[ 'Admin Menu', 'core', '_admin_menu', 'admin_menu' ],
|
||||
[ 'Toolbar', 'core', 'admin_bar_menu', '' ],
|
||||
[ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ],
|
||||
[ 'Head Hook', 'theme', 'wp_head' ],
|
||||
[ 'Main Loop', 'theme', 'loop_start', 'loop_end' ],
|
||||
[ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ],
|
||||
[ 'Sidebar', 'theme', 'dynamic_sidebar_before', 'dynamic_sidebar_after' ],
|
||||
[ 'Toolbar', 'core', 'admin_bar_menu', '' ],
|
||||
[ 'Footer Hook', 'theme', 'wp_footer', '' ],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,11 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
||||
|
||||
if ( '' !== $start ) {
|
||||
add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) {
|
||||
|
||||
if ( 'Sidebar' === $event ) {
|
||||
$event = $input;
|
||||
}
|
||||
|
||||
$collector->start( $event, $category );
|
||||
|
||||
return $input;
|
||||
@@ -95,6 +100,11 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
||||
|
||||
if ( '' !== $stop ) {
|
||||
add_action( $stop, function ( $input = null ) use ( $collector, $event ) {
|
||||
|
||||
if ( 'Sidebar' === $event ) {
|
||||
$event = $input;
|
||||
}
|
||||
|
||||
$collector->stop( $event );
|
||||
|
||||
return $input;
|
||||
@@ -161,6 +171,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
||||
public function get_records(): array {
|
||||
|
||||
$this->stop( 'Toolbar' );
|
||||
$this->stop( 'Footer Hook' );
|
||||
|
||||
return parent::get_records();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user