Skip to content

Commit

Permalink
better code organization
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 authored Sep 19, 2018
1 parent d40593f commit 5e00d40
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,24 @@ function __construct( $title ) {
* Register output. The filter won't run if Query Monitor is not
* installed so we don't have to explicity check for it.
*/
add_filter( 'qm/outputter/html', function(array $output, QM_Collectors $collectors) {
include 'QM_Collector_WPBP_Debug_Output.php';
$id = strtolower( str_replace(' ', '_', $this->title ) );
if ( $collector = QM_Collectors::get( $id ) ) {
$output[ $id ] = new QM_Collector_WPBP_Debug_Output( $collector, $this->output, $this->title );
}
return $output;
}, 101, 2 );
add_filter( 'qm/outputter/html', array($this, 'load'), 101, 2 );
}

/**
* Print panel
*
* @param string The HTML code.
* @param object List of QM Collectors.
*
* @return array
*/
function load(array $output, QM_Collectors $collectors) {
include 'QM_Collector_WPBP_Debug_Output.php';
$id = strtolower( str_replace(' ', '_', $this->title ) );
if ( $collector = QM_Collectors::get( $id ) ) {
$output[ $id ] = new QM_Collector_WPBP_Debug_Output( $collector, $this->output, $this->title );
}
return $output;
}

/**
Expand Down

0 comments on commit 5e00d40

Please sign in to comment.