?> <!doctype html> <head> <meta charset="utf-8"> <title><?php _e('Debug This', 'debug-this'); ?> </title> <?php wp_head(); ?> </head> <body> <div class='debug-this'> <a href="/<?php echo Debug_This::get_escape_url(); ?> " class="escape"><span class="dashicons dashicons-dismiss"></span></a> <div class='debug'> %DEBUG% </div> <?php wp_footer(); ?> </div> </body> </html> <?php $html = ob_get_contents(); ob_get_clean(); #Render debug_this action buffer
public function wp_debug() { if (defined('WP_DEBUG') && WP_DEBUG === true && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG === true) { $path = WP_CONTENT_DIR . '/debug.log'; $debug = ''; if (file_exists($path) && is_writeable($path)) { add_debug_header_link(Debug_This::get_current_debug_url() . '&clear-debug-log=true', __('Reset log file', 'debug-this')); if (isset($_GET['clear-debug-log'])) { if (file_put_contents($path, '') === 0) { $debug .= __('Debug log was successfully cleared.', 'debug-this'); } else { $debug .= __('Debug log could not be reset. Please try again', 'debug-this'); } } $debug .= file_get_contents($path); if (!$debug) { $debug .= __('Looking good! No notices were logged.', 'debug-this'); } } elseif (touch($path)) { $debug = __('Looking good! No notices were logged.', 'debug-this'); } else { $debug = __('Could not open debug.log. Please make sure your wp-content folder is writeable by the web server user.', 'debug-this'); } return $debug; } else { $debug = __("Please add the following to wp-config.php to use this mode.\ndefine('WP_DEBUG', true);\ndefine('WP_DEBUG_LOG', true);\ndefine('WP_DEBUG_DISPLAY', false);", 'debug-this'); return $debug; } }
protected function is_debug() { if (isset($_GET[self::$query_var])) { self::$mode = $_GET[self::$query_var] ? $_GET[self::$query_var] : apply_filters('debug_this_default_mode', $this->default_mode); return true; } }
public function template_include_filter($template) { self::$template_included = $template; return $template; }