Skip to content

Commit

Permalink
Remove get_common_panel()
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Sep 14, 2023
1 parent 1b8726d commit e146f01
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion classes/EP_Debug_Bar_ElasticPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion classes/QueryLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public function admin_enqueue_scripts() {
return;
}

get_common_panel()->enqueue_scripts_styles();
( new CommonPanel() )->enqueue_scripts_styles();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/QueryMonitorOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
}
Expand Down
18 changes: 1 addition & 17 deletions debug-bar-elasticpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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' ) );
Expand Down

0 comments on commit e146f01

Please sign in to comment.