public function assets() { return [function () { $renderer = $this->debugBar->getJavascriptRenderer(); $renderer->setOpenHandlerUrl('/open.php'); $this->debugBar->sendDataInHeaders(true); return $renderer->renderHead() . $renderer->render(); }]; }
public function register() { $this->container->add('bundle.service.debug_bar', function () { $debugBar = new StandardDebugBar(); $sqlLogger = $this->container->get('db_connection')->getConfiguration()->getSQLLogger(); $debugBar->addCollector(new DoctrineCollector($sqlLogger)); $view = $this->container->get('service.view.view'); if (defined('ENVIRONMENT') && ENVIRONMENT === 'development') { $view->loadExtension(new DebugBarExtension($debugBar)); } return $debugBar; }); }
public function __invoke(ContainerInterface $container = null) { $debugBar = new StandardDebugBar(); if ($container !== null) { $config = $container->has('config') ? $container->get('config') : []; $collectors = isset($config['phpmiddleware']['phpdebugbar']['collectors']) ? $config['phpmiddleware']['phpdebugbar']['collectors'] : []; foreach ($collectors as $collectorName) { $collector = $container->get($collectorName); $debugBar->addCollector($collector); } if (isset($config['phpmiddleware']['phpdebugbar']['storage']) && is_string($config['phpmiddleware']['phpdebugbar']['storage'])) { $storage = $container->get($config['phpmiddleware']['phpdebugbar']['storage']); $debugBar->setStorage($config['phpmiddleware']['phpdebugbar']['storage']); } } return $debugBar; }
/** * @param string $autoloadPath */ public function initAjaxDebuger($autoloadPath) { $uploadDir = $this->getUploadDir(); $this->initOpenHandler($uploadDir['path'], $autoloadPath); $this->setStorage($uploadDir['path']); $this->debugBar->getJavascriptRenderer()->setOpenHandlerUrl($uploadDir['url'] . '/open.php'); $this->debugBar->sendDataInHeaders(true); }
/** * Use the register method to register items with the container via the * protected $this->container property or the `getContainer` method * from the ContainerAwareTrait. */ public function register() { $this->container->share(DebugBar::class, function () { $debugbar = new StandardDebugBar(); $debugbar->addCollector(new QueryCollector()); // Bind QueryCollector to current connection /* @var StandardDebugbar $debugbar */ $connection = $this->container->get(Manager::class)->connection(); $connection->listen(function ($query, $bindings, $time) use($debugbar, $connection) { $collector = $debugbar->getCollector('queries'); $collector->addQuery((string) $query, $bindings, $time, $connection); }); return $debugbar; }); $this->container->share(JavascriptRenderer::class, function () { return $this->container->get(DebugBar::class)->getJavascriptRenderer(); }); }
public function render($menuContent, $pageContent, $extKey) { $mainConfig = Config::load('app'); if ($mainConfig['mode'] === 'development') { $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar->getJavascriptRenderer(); $debugbarHead = $debugbarRenderer->renderHead(); $debugbarFoot = $debugbarRenderer->render(); } else { $debugbarHead = ''; $debugbarFoot = ''; } $templates = new Twig_Loader_Filesystem(APP . 'design/themes' . DS . $mainConfig['theme'] . DS . 'templates/ext'); $skeletons = new Twig_Loader_Filesystem(APP . 'design/skeletons/' . $mainConfig['skeleton']); $twigTemplate = new Twig_Environment($templates); $twigSkeleton = new Twig_Environment($skeletons); $skeleton = $twigSkeleton->loadTemplate($mainConfig['skeleton'] . '.twig'); $renderedPage = $twigTemplate->render($extKey . '.twig', ['debugbarHead' => $debugbarHead, 'debugbarFoot' => $debugbarFoot, 'menuContent' => $menuContent, 'pageContent' => $pageContent, 'skeleton' => $skeleton]); return $renderedPage; }
/** * Sets up Php Debug Bar * @throws \DebugBar\DebugBarException */ private function setDebugging() { // check debug $this->load->config('php_debug_bar', true, true); $debugConfig = $this->config->item('php_debug_bar'); $this->twig->addGlobal('debug', $debugConfig['init_debug_bar']); $this->debuggerEnabled = $debugConfig['init_debug_bar']; if ($debugConfig['init_debug_bar']) { $this->load->helper('url'); $this->debugBar = new \DebugBar\StandardDebugBar(); $this->twig->addGlobal('debugger', $this->debugBar->getJavascriptRenderer()->setBaseUrl(base_url() . 'debug/')); // attach doctrine hook if ($debugConfig['doctrine_hook']) { $stack = $this->doctrine->getDebugStack(); if ($stack) { $this->debugBar->addCollector(new DebugBar\Bridge\DoctrineCollector($stack)); } } } }
/** * Registers services on the given container. * * This method should only be used to configure services and parameters. * It should not get services. * * @param \Pimple $mainContainer An Container instance */ public function register(\Pimple $mainContainer) { $container = new \Pimple(); $container['collector.cache'] = $mainContainer->share(function () { return new CacheDataCollector(); }); $container['collector.db'] = $mainContainer->share(function () { return new DatabaseDataCollector(); }); $container['collector.route'] = $mainContainer->share(function () { return new RouteDataCollector(); }); $container['collector.config'] = $mainContainer->share(function () use($mainContainer) { return new ConfigDataCollector($mainContainer['config']); }); $container['bar'] = $mainContainer->share(function () use($mainContainer, $container) { $bar = new StandardDebugBar(); // Defaults collectors $bar->addCollector($container['collector.config']); $bar->addCollector($container['collector.cache']); $bar->addCollector($container['collector.db']); $bar->addCollector($container['collector.route']); return $bar; }); $container['renderer'] = $mainContainer->share(function () use($container) { return $container['bar']->getJavascriptRenderer(); }); $mainContainer['debug'] = $container; }
function __construct() { global $debugbar; $debugbar = new StandardDebugBar(); return; if (is_admin()) { add_action('admin_head', function () use($debugbar) { $this->debugbarRenderer = $debugbar->getJavascriptRenderer(get_template_directory_uri() . '/vendor/maximebf/debugbar/src/DebugBar/Resources'); echo $this->debugbarRenderer->renderHead(); }); add_action('admin_footer', function () { $this->debugbarRenderer->setOpenHandlerUrl(get_bloginfo('template_url') . '/app/helpers/open.php'); echo $this->debugbarRenderer->render(); }); } else { add_action('wp_head', function () use($debugbar) { $this->debugbarRenderer = $debugbar->getJavascriptRenderer(get_template_directory_uri() . '/vendor/maximebf/debugbar/src/DebugBar/Resources'); echo $this->debugbarRenderer->renderHead(); }); add_action('wp_footer', function () { echo $this->debugbarRenderer->render(); }); } }
public function route($uri = false) { if (!$uri) { if (empty($_SERVER['REDIRECT_URL'])) { if (stristr($_SERVER['REQUEST_URI'], '?') !== false) { $uri = stristr($_SERVER['REQUEST_URI'], '?', true); } else { $uri = $_SERVER['REQUEST_URI']; } } else { $uri = $_SERVER['REDIRECT_URL']; } } $context = new RequestContext($uri); $locator = new FileLocator(array(dirname(__FILE__) . '/../conf')); $router = new Router(new PhpFileLoader($locator), 'routes.php', array('cache_dir' => null), $context); if (!$uri) { $uri = $this->httpRequest->getPathInfo(); } $this->route = $router->match($uri); $this->controller = new $this->route['class']($this); if (DEBUG_BAR) { $this->debugbar->addCollector(new ConfigCollector($this->config)); $debugbarRenderer = $this->debugbar->getJavascriptRenderer(); $this->debugbar["messages"]->addMessage("Debug Bar enabled"); $this->controller->setData('debugbarRenderer', $debugbarRenderer); } //set action to index is its not set if (empty($this->route['action'])) { $this->route['action'] = $this->route['_route'] == '/' ? "index" : $this->route['_route']; } $action = $this->route['action']; if (!method_exists($this->controller, $action)) { throw new Exception('Method Not found'); } $this->controller->{$action}(); }
public function inject(ContainerInterface $container) { if (!$container->getParameter('debug')) { return; } $container[$this->name . '.session_collector'] = function () { return new SessionCollector(); }; $container[$this->name . '.timeline_collector'] = function () { return new TimelineCollector(); }; $container[$this->name . '.event_collector'] = function () { return new EventCollector(); }; $container[$this->name . '.monolog_collector'] = function (ContainerInterface $container) { return new MonologCollector($container->getLogger()); }; $container[$this->name . '.doctrine_collector'] = function (ContainerInterface $container) { $debugStack = new DebugStack(); $container['doctrine.logger']->addLogger($debugStack); return new DoctrineCollector($debugStack); }; $container[$this->name . '.debug_bar'] = function ($container) { $debugBar = new StandardDebugBar(); $debugBar->addCollector($container[$this->name . '.session_collector']); $debugBar->addCollector($container[$this->name . '.doctrine_collector']); $debugBar->addCollector($container[$this->name . '.event_collector']); $debugBar->addCollector($container[$this->name . '.monolog_collector']); return $debugBar; }; $container[$this->name . '.response_listener'] = new DebugBarResponseListener(); $container[$this->name . '.assets_listener'] = new AssetsPublishEventListener(); $container->getEventDispatcher()->addListener(KernelEvent::RESPONSE, array($container[$this->name . '.response_listener'], 'listen')); $container->getEventDispatcher()->addListener(FrameworkConsoleEvent::ASSETS_PUBLISH, array($container[$this->name . '.assets_listener'], 'listen')); //timeline collector binds to many events at once $container->getEventDispatcher()->addSubscriber($container[$this->name . '.timeline_collector']); }
public function __construct() { parent::__construct(); }
use DebugBar\StandardDebugBar; //include all class objects $folder = $includesDir . "/classes"; $files = scandir($folder); foreach ($files as $filename) { if ($filename != "." && $filename != "..") { if (strpos($filename, '.php') !== false) { require $folder . "/" . $filename; } } } if (DISPLAY_DEBUG) { ini_set("display_errors", 1); ini_set("log_errors", true); error_reporting(E_WARNING && E_ERROR); $debugbar = new StandardDebugBar(); $debugbar->addCollector(new \DebugBar\DataCollector\MessagesCollector('database')); $debugbarRenderer = $debugbar->getJavascriptRenderer(); //Initialize a global $db object (and include the logger) once to lighten memory usage $db = new Database($debugbar); } else { ini_set("display_errors", 0); ini_set("log_errors", true); error_reporting(0); //Initialize a global $db object once to lighten memory usage $db = new Database(); } //include all helper functions $folder = $includesDir . "/helpers"; $files = scandir($folder); foreach ($files as $filename) {
/** * Sends the data through the HTTP headers * * @return $this */ public function sendDataInHeaders() { $this->debugbar->sendDataInHeaders(); return $this; }
/** * Allows name/value pair arrays (or nested) to be logged * @param array $config The config file to track */ public function addConfigCollector($config) { $this->debugbar->addCollector(new ConfigCollector($config)); }
public function getRenderer() { $this->renderer = $this->debugBar->getJavascriptRenderer("/debugbar"); return $this->renderer; }
/** * @param $debug_stack * @throws \DebugBar\DebugBarException */ public function loadDoctrineDebugger($debug_stack) { $this->debugBar->addCollector(new DoctrineCollector($debug_stack)); }
<?php require 'vendor/autoload.php'; $templatesPath = dirname(__FILE__) . '/templates'; $config = ['debug' => true, 'mode' => 'development', 'view' => new \Slim\Views\Twig(), 'templates.path' => $templatesPath]; $app = new \Slim\Slim($config); $view = $app->view(); /** Whoops errors **/ $app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware()); /* -- */ /** Debug Bar **/ use DebugBar\StandardDebugBar; $debugbar = new StandardDebugBar(); $debugbar->addCollector(new DebugBar\Bridge\SlimCollector($app)); $loader = new Twig_Loader_Filesystem('.'); $env = new DebugBar\Bridge\Twig\TraceableTwigEnvironment(new Twig_Environment($loader)); $debugbar->addCollector(new DebugBar\Bridge\Twig\TwigCollector($env)); $debugbarRenderer = $debugbar->getJavascriptRenderer(); $view->appendData(['debugbarRenderer' => $debugbarRenderer]); /* -- */ $view->parserOptions['debug'] = true; $view->parserExtensions = array(new \Slim\Views\TwigExtension(), new \Twig_Extension_Debug()); /*$app->get('/', function() use($app) { $app->render('index.twig'); });*/ $app->get('/', function () use($app) { $em = new \App\EntityManager('news'); $news = $em->findAll(); $app->render('index.twig', compact('news')); })->name('home'); /** Inject variable into twig **/
<?php use DebugBar\StandardDebugBar; if (ENVIRONMENT == 'development') { $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar->getJavascriptRenderer(); } ?> <!DOCTYPE html> <html lang="<?php echo LANGUAGE_CODE; ?> "> <head> <?php if (ENVIRONMENT == 'development') { echo $debugbarRenderer->renderHead(); } ?> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $page_title . ' - ' . SITETITLE; ?> </title> <meta name="description" content="<?php echo $meta_aciklama; ?> kapıda ödeme avantajı, hızlı kargo ve 365 gün iade avantajıyla ideal.com.tr'de uygun fiyatlarla satışta!"> <meta name="keywords" content="ideal sanal market,ideal sanal market,ideal.com.tr,<?php
<?php include __DIR__ . '/../tests/bootstrap.php'; // for stack data session_start(); use DebugBar\StandardDebugBar; $debugbar = new StandardDebugBar(); $debugbarRenderer = $debugbar->getJavascriptRenderer()->setBaseUrl('../src/DebugBar/Resources')->setEnableJqueryNoConflict(false); // // create a writable profiles folder in the demo directory to uncomment the following lines // // $debugbar->setStorage(new DebugBar\Storage\FileStorage(__DIR__ . '/profiles')); // $debugbar->setStorage(new DebugBar\Storage\RedisStorage(new Predis\Client())); // $debugbarRenderer->setOpenHandlerUrl('open.php'); function render_demo_page(Closure $callback = null) { global $debugbarRenderer; ?> <html> <head> <?php echo $debugbarRenderer->renderHead(); ?> <script type="text/javascript"> $(function() { $('.ajax').click(function() { var container = $(this).parent().html('...'); $.get(this.href, function(data) { container.html(data); }); return false;