Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 committed Aug 10, 2018
1 parent fc06c59 commit 5a143d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
4 changes: 3 additions & 1 deletion QM_Collector_WPBP_Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

}
32 changes: 19 additions & 13 deletions QM_Collector_WPBP_Debug_Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ public function __construct( QM_Collector $collector, $output, $title ) {
* Outputs data in the footer
*/
public function output() {
echo '<div class="qm" id="' . esc_attr($this->collector->id()) . '">';
echo '<table cellspacing="0"><tbody>';
foreach ( $this->output as &$single ) {
echo "<tr><td>" . $single . "</td></tr>";
if ( is_array( $this->output ) ) {
echo '<div class="qm" id="' . esc_attr($this->collector->id()) . '">';
echo '<table cellspacing="0"><tbody>';
foreach ( $this->output as &$single ) {
echo "<tr><td>" . $single . "</td></tr>";
}
echo '</tbody></table>';
echo '</div>';
}
echo '</tbody></table>';
echo '</div>';
}

/**
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down

0 comments on commit 5a143d6

Please sign in to comment.