/** * Render Panel */ public function render() { ?> <style type="text/css"> #galahad-tracer h2 { float: none; border: none; text-align: left; padding: 0; } #galahad-tracer h3 { margin-left: 15px; font-size: 1.7em; font-weight: bold; } #galahad-tracer table { max-width: 100%; margin-bottom: 1em; margin-left: 30px; } #galahad-tracer table, #galahad-tracer th, #galahad-tracer td { border: 1px solid #ccc; border-collapse: collapse; } #galahad-tracer th { background: #eee; } #galahad-tracer th, #galahad-tracer td { padding: 5px; } #galahad-tracer .functions { white-space: nowrap; overflow: auto; } </style> <div id="galahad-tracer"> <?php $data = Galahad_Query_Tracer::instance()->getData(); if (!empty($data)) { $this->_renderData(); } else { _e('No queries caused by plugins.'); } ?> </div> <?php }
/** * Faux-Singleton Accessor * Use this method to get a consistent instance of the class * * @return Galahad_Query_Tracer */ public static function instance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
Copyright 2011 Chris Morrell <http://cmorrell.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Define plugin's path for later use define('GALAHAD_QUERY_TRACER_PATH', untrailingslashit(dirname(__FILE__))); // TODO: Check that Debug Bar is installed // Load Tracer & instatiate require_once GALAHAD_QUERY_TRACER_PATH . '/Tracer.php'; Galahad_Query_Tracer::instance(); // Add panel to Debug Bar add_filter('debug_bar_panels', 'galahad_query_tracer_register'); function galahad_query_tracer_register($panels) { require_once GALAHAD_QUERY_TRACER_PATH . '/Panel.php'; $panels[] = new Galahad_Query_Tracer_Panel(); return $panels; }