public function output() { $data = $this->collector->get_data(); ?> <div class="qm" id="<?php echo esc_attr($this->collector->id()); ?> "> <table cellspacing="0"> <thead> <tr> <td colspan="3"><?php echo esc_html($this->collector->name()); ?> </td> </tr> <tr> <th scope="col">Variable</th> <th scope="col">Type</th> <th scope="col">Value</th> </tr> </thead> <tbody> <?php QMCV_IO::echo_debug(true); ?> </tbody> </table> </div> <?php }
function trigger_all() { QMCV_IO::trigger_hooks(); if (class_exists('QueryMonitor') && Check_Variables_Options::get_query_monitor() === true) { // Set Query Monitor Collector include_once QMCV_CLASS_DIR . 'query_monitor/collector.php'; QMCV_Collector_Variable_Checking::initialize(); } }
static function echo_debug($query_monitor = false) { $hide = Check_Variables_Options::get_hide() && !$query_monitor ? ' hidden' : ''; foreach (self::$message as $key => $message) { $title = $message['type']; switch ($message['type']) { case 'object': case 'array': self::$message_sandbox = array(); self::$message_stack = explode(PHP_EOL, $message['message']); $title = self::$message_stack[0]; unset(self::$message_stack[0]); unset(self::$message_stack[1]); self::txt2structure(self::$message_stack, self::$message_sandbox); $message_key = $message['key']; $html_value = sprintf('<dl data-id="%s">', $key); ob_start(); self::structure2html(self::$message_sandbox); $html_value .= ob_get_contents(); ob_end_clean(); $html_value .= '</dl>'; self::structure2json(self::$message_sandbox, self::$json_sandbox); $json = str_replace("'", "\\'", json_encode(self::$json_sandbox)); break; case 'boolean': case 'NULL': $message['message'] = $message['type'] == "boolean" ? $message['message'] ? 'true' : 'false' : "NULL"; default: $html_value = sprintf('<div class="QMCV_value" data-id="%s">%s</div>', $key, $message['message']); $jskey = str_replace("\"", "'", $message['key']); $jskey = str_replace("'", "\\'", $jskey); $json = sprintf('{"%s":"%s"}', $jskey, $message['message']); break; } # HTML if (Check_Variables_Options::get_footer()) { printf('<div class="QMCV_IO %s">', $hide); printf('<h3 data-id="%s">%s <span>%s</span></h3>', $key, $message['key'], $title); printf('<div class="file">%s <span>( Line %s )</span></div>', $message['file'], $message['line']); echo $html_value; echo '</div>'; } // Query Monitor if ($query_monitor) { printf('<tr>'); printf('<td><strong>%s</strong><br /><span class="file">%s::<span>%s</span></span></td>', $message['key'], $message['file'], $message['line']); printf('<td>%s</td>', $message['type']); printf('<td><pre>%s</pre></td>', $message['message']); printf('</tr>'); } # JS Console if (Check_Variables_Options::get_console() && !$query_monitor) { ?> <script type="text/javascript"> QMCV_Data = '<?php echo $json; ?> '; QMCV_Data = JSON.parse( QMCV_Data ); console.log( QMCV_Data ); </script> <?php } } }