Skip to content

Commit 8111460

Browse files
author
Miika Arponen
committed
Fixed a bug regarding multiple instances of same helper at same page load
1 parent 64adba2 commit 8111460

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

plugin.php

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: DustPress Debugger
44
* Plugin URI: https://github.com/devgeniem/dustpress-debugger
55
* Description: Provides handy ajaxified debugger tool for DustPress based themes.
6-
* Version: 1.1.3
6+
* Version: 1.1.4
77
* Author: Geniem Oy / Miika Arponen & Ville Siltala
88
* Author URI: http://www.geniem.com
99
*/
@@ -51,9 +51,6 @@ public static function init() {
5151

5252
// Register DustPress core helper hooks
5353
add_filter( 'dustpress/menu/data', array( __CLASS__, "gather_menu_helper_data") );
54-
55-
// Register DustPress comments helper data
56-
add_filter( 'dustpress/comments/data', array( __CLASS__, "gather_comments_helper_data") );
5754
}
5855
}
5956

@@ -134,12 +131,6 @@ public static function gather_menu_helper_data( $data ) {
134131
return $data;
135132
}
136133

137-
public static function gather_comments_helper_data( $data ) {
138-
self::set_debugger_data( 'Comments', $data );
139-
140-
return $data;
141-
}
142-
143134
/**
144135
* Gathers debug data from other sources than DustPress core.
145136
*/
@@ -149,20 +140,16 @@ public static function set_debugger_data( $key, $data ) {
149140
} else {
150141
$debug_data_block_name = dustpress()->get_setting( "debug_data_block_name" );
151142

152-
$model_data = [];
153-
154-
if ( ! isset( $model_data[ $debug_data_block_name ] ) ) {
155-
$model_data[ $debug_data_block_name ] = [];
143+
if ( ! isset( self::$data[ $debug_data_block_name ] ) ) {
144+
self::$data[ $debug_data_block_name ] = [];
156145
}
157146

158-
if ( ! isset( $model_data[ $debug_data_block_name ][ $key ] ) ) {
159-
$model_data[ $debug_data_block_name ][ $key ] = [];
147+
if ( ! isset( self::$data[ $debug_data_block_name ][ $key ] ) ) {
148+
self::$data[ $debug_data_block_name ][ $key ] = [];
160149
}
161150

162-
$model_data[ $debug_data_block_name ][ $key ][] = $data;
151+
self::$data[ $debug_data_block_name ][ $key ][] = $data;
163152
}
164-
165-
self::$data = array_merge( self::$data, $model_data );
166153
}
167154
}
168155

0 commit comments

Comments
 (0)