From e146f0148eea339fd7ee25dcbca2df4d5fd559c0 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Thu, 14 Sep 2023 09:30:03 -0300 Subject: [PATCH] Remove get_common_panel() --- classes/EP_Debug_Bar_ElasticPress.php | 2 +- classes/QueryLog.php | 2 +- classes/QueryMonitorOutput.php | 2 +- debug-bar-elasticpress.php | 18 +----------------- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/classes/EP_Debug_Bar_ElasticPress.php b/classes/EP_Debug_Bar_ElasticPress.php index a4dd499..ed0ab2b 100755 --- a/classes/EP_Debug_Bar_ElasticPress.php +++ b/classes/EP_Debug_Bar_ElasticPress.php @@ -37,7 +37,7 @@ class EP_Debug_Bar_ElasticPress extends \Debug_Bar_Panel { public function init() { $this->title( esc_html__( 'ElasticPress', 'debug-bar-elasticpress' ) ); - $this->common_panel = \DebugBarElasticPress\get_common_panel(); + $this->common_panel = new \DebugBarElasticPress\CommonPanel(); $this->common_panel->enqueue_scripts_styles(); } diff --git a/classes/QueryLog.php b/classes/QueryLog.php index 81f2c97..99ca05e 100644 --- a/classes/QueryLog.php +++ b/classes/QueryLog.php @@ -414,7 +414,7 @@ public function admin_enqueue_scripts() { return; } - get_common_panel()->enqueue_scripts_styles(); + ( new CommonPanel() )->enqueue_scripts_styles(); } /** diff --git a/classes/QueryMonitorOutput.php b/classes/QueryMonitorOutput.php index 1d32783..4a211bb 100644 --- a/classes/QueryMonitorOutput.php +++ b/classes/QueryMonitorOutput.php @@ -29,7 +29,7 @@ class QueryMonitorOutput extends \QM_Output_Html { public function __construct( QueryMonitorCollector $collector ) { parent::__construct( $collector ); - $this->common_panel = \DebugBarElasticPress\get_common_panel(); + $this->common_panel = new CommonPanel(); add_filter( 'qm/output/menus', [ $this, 'admin_menu' ] ); } diff --git a/debug-bar-elasticpress.php b/debug-bar-elasticpress.php index 8b1baa4..06a09d8 100755 --- a/debug-bar-elasticpress.php +++ b/debug-bar-elasticpress.php @@ -48,22 +48,6 @@ function( $class ) { } ); -/** - * Get the panel common to both Query Monitor and Debug Bar. - * - * @since 3.1.0 - * @return CommonPanel - */ -function get_common_panel() { - static $common_panel = null; - - if ( ! $common_panel ) { - $common_panel = new CommonPanel(); - } - - return $common_panel; -} - /** * Setup plugin * @@ -83,7 +67,7 @@ function setup() { if ( class_exists( '\QM_Collectors' ) ) { \QM_Collectors::add( new QueryMonitorCollector() ); add_filter( 'qm/outputter/html', $n( 'register_qm_output' ) ); - add_action( 'qm/output/enqueued-assets', [ get_common_panel(), 'enqueue_scripts_styles' ] ); + add_action( 'qm/output/enqueued-assets', [ new CommonPanel(), 'enqueue_scripts_styles' ] ); } else { add_filter( 'debug_bar_panels', $n( 'add_debug_bar_panel' ) ); add_filter( 'debug_bar_statuses', $n( 'add_debug_bar_stati' ) );