From 5a143d69d96a2180b295a31bdd95209ae1f2b233 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Fri, 10 Aug 2018 13:13:29 +0200 Subject: [PATCH] fixes --- QM_Collector_WPBP_Debug.php | 4 +++- QM_Collector_WPBP_Debug_Output.php | 32 ++++++++++++++++++------------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/QM_Collector_WPBP_Debug.php b/QM_Collector_WPBP_Debug.php index 2a2a547..8c10a68 100644 --- a/QM_Collector_WPBP_Debug.php +++ b/QM_Collector_WPBP_Debug.php @@ -15,7 +15,9 @@ public function name() { } public function process() { - $this->data['log'] = $this->parent->output; + if ( is_array( $this->parent->output ) ) { + $this->data['log'] = $this->parent->output; + } } } diff --git a/QM_Collector_WPBP_Debug_Output.php b/QM_Collector_WPBP_Debug_Output.php index 2bc230e..e1dab8a 100644 --- a/QM_Collector_WPBP_Debug_Output.php +++ b/QM_Collector_WPBP_Debug_Output.php @@ -15,13 +15,15 @@ public function __construct( QM_Collector $collector, $output, $title ) { * Outputs data in the footer */ public function output() { - echo '
'; - echo ''; - foreach ( $this->output as &$single ) { - echo ""; + if ( is_array( $this->output ) ) { + echo '
'; + echo '
" . $single . "
'; + foreach ( $this->output as &$single ) { + echo ""; + } + echo '
" . $single . "
'; + echo '
'; } - echo ''; - echo ''; } /** @@ -33,7 +35,9 @@ public function output() { */ public function admin_title( array $title ) { $data = $this->collector->get_data(); - $title[] = $this->title . ' (' . count( $data['log'] ) . ')'; + if ( is_array( $data['log'] ) ) { + $title[] = $this->title . ' (' . count( $data['log'] ) . ')'; + } return $title; } @@ -48,12 +52,14 @@ public function admin_class( array $class ) { } public function admin_menu( array $menu ) { - $data = $this->collector->get_data(); - $menu[] = $this->menu( array( - 'id' => $this->id, - 'href' => '#qm-' . str_replace( '_', '-', $this->id), - 'title' => $this->title . ' (' . count( $data['log'] ) . ')' - )); + if ( is_array( $data['log'] ) ) { + $data = $this->collector->get_data(); + $menu[] = $this->menu( array( + 'id' => $this->id, + 'href' => '#qm-' . str_replace( '_', '-', $this->id), + 'title' => $this->title . ' (' . count( $data['log'] ) . ')' + )); + } return $menu; }