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
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
### Added
|
### Added
|
||||||
- call backtraces to SQL records
|
- call backtraces to SQL records
|
||||||
- new format of hook events
|
- new format of hook events
|
||||||
|
= sidebar tracking
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- required PHP version to 7.1
|
- required PHP version to 7.1
|
||||||
|
|||||||
@@ -18,12 +18,16 @@ class Core_Events implements Hook_Event_Config_Interface {
|
|||||||
[ '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' ],
|
||||||
|
[ 'Query Setup', 'core', 'wp_loaded', 'template_redirect', PHP_INT_MAX, -1 ],
|
||||||
|
[ 'Template Loader', 'theme', 'template_redirect', 'template_include' ],
|
||||||
[ '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', '' ],
|
[ 'Admin Print Scripts', 'core', 'admin_enqueue_scripts', 'admin_print_scripts' ],
|
||||||
[ 'Head Hook', 'theme', 'wp_head' ],
|
[ 'Head Hook', 'theme', 'wp_head' ],
|
||||||
[ 'Main Loop', 'theme', 'loop_start', 'loop_end' ],
|
[ '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 ) {
|
if ( '' !== $start ) {
|
||||||
add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) {
|
add_action( $start, function ( $input = null ) use ( $collector, $event, $category ) {
|
||||||
|
|
||||||
|
if ( 'Sidebar' === $event ) {
|
||||||
|
$event = $input;
|
||||||
|
}
|
||||||
|
|
||||||
$collector->start( $event, $category );
|
$collector->start( $event, $category );
|
||||||
|
|
||||||
return $input;
|
return $input;
|
||||||
@@ -95,6 +100,11 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
|||||||
|
|
||||||
if ( '' !== $stop ) {
|
if ( '' !== $stop ) {
|
||||||
add_action( $stop, function ( $input = null ) use ( $collector, $event ) {
|
add_action( $stop, function ( $input = null ) use ( $collector, $event ) {
|
||||||
|
|
||||||
|
if ( 'Sidebar' === $event ) {
|
||||||
|
$event = $input;
|
||||||
|
}
|
||||||
|
|
||||||
$collector->stop( $event );
|
$collector->stop( $event );
|
||||||
|
|
||||||
return $input;
|
return $input;
|
||||||
@@ -161,6 +171,7 @@ class Hook_Record_Collector extends Stopwatch_Record_Collector {
|
|||||||
public function get_records(): array {
|
public function get_records(): array {
|
||||||
|
|
||||||
$this->stop( 'Toolbar' );
|
$this->stop( 'Toolbar' );
|
||||||
|
$this->stop( 'Footer Hook' );
|
||||||
|
|
||||||
return parent::get_records();
|
return parent::get_records();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user