[WebProfilerBundle] added the bundle

This commit is contained in:
Fabien Potencier 2010-08-29 12:37:12 +02:00
parent 84c383d729
commit 4e57899374
53 changed files with 1213 additions and 1 deletions

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASxJREFUeNrsV00KhCAYzaGDzLZbONcIghadoDZtiqJNbVq0Ctq06xjNCTrDnKMfGoVpsFBRqNz4QD7NR77vmZ8E1nU1VOJhKIYWoAUoF2CSAwBAf9E6L3JAHn1ADrquu6Qo2LYNWAJ2DizLYjiOg8lnO9HTnKAKwGjbFl7hhOu6/G9gnud/9DzvFieYAjDquoa3noJpmqhRuQDf99+8l5RlCWV40gKKouBuhSyPKWAcR2qMooibWZZlUIYn7UAcx0KZifKkHcjznJpZGIa7BVk8Fl/YgSAIoEhGLJ6wA4iQ3H0Md9dxVVXpUcCxDcPwQRHg9utLzR+TMmmqUCVMyIpIwrKs5/ac7IvOc7dgQ9M0KUvApZXwCHQ7YieSk9fcvQ/oHxMtQAtQLeArwABN1BHcHlpLnQAAAABJRU5ErkJggg==" />
<span style="color: <?php echo $data->getQueryCount() < 10 ? '#000' : '#d22' ?>"><?php echo $data->getQueryCount() ?></span><span style="margin: 0; padding: 0; color: #aaa">|</span><?php echo sprintf('%0.2f', $data->getTime()) ?> ms

View File

@ -0,0 +1,4 @@
<div class="count"><?php echo sprintf('%0.0f', $data->getTime()) ?> ms</div>
<div class="count"><?php echo $data->getQueryCount() ?></div>
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/db.png') ?>" />
Doctrine

View File

@ -0,0 +1,19 @@
<h2>Queries</h2>
<?php if (0 == $data->getQueryCount()): ?>
<em>No queries.</em>
<?php else: ?>
<ul class="alt">
<?php foreach ($data->getQueries() as $i => $query): ?>
<li class="<?php echo $i % 2 ? 'odd' : 'even' ?>">
<div>
<code><?php echo $query['sql'] ?></code>
</div>
<small>
<?php //echo $query['params'] ?>
<strong>Time</strong>: <?php echo sprintf('%0.2f', $query['executionMS']) ?> ms
</small>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASxJREFUeNrsV00KhCAYzaGDzLZbONcIghadoDZtiqJNbVq0Ctq06xjNCTrDnKMfGoVpsFBRqNz4QD7NR77vmZ8E1nU1VOJhKIYWoAUoF2CSAwBAf9E6L3JAHn1ADrquu6Qo2LYNWAJ2DizLYjiOg8lnO9HTnKAKwGjbFl7hhOu6/G9gnud/9DzvFieYAjDquoa3noJpmqhRuQDf99+8l5RlCWV40gKKouBuhSyPKWAcR2qMooibWZZlUIYn7UAcx0KZifKkHcjznJpZGIa7BVk8Fl/YgSAIoEhGLJ6wA4iQ3H0Md9dxVVXpUcCxDcPwQRHg9utLzR+TMmmqUCVMyIpIwrKs5/ac7IvOc7dgQ9M0KUvApZXwCHQ7YieSk9fcvQ/oHxMtQAtQLeArwABN1BHcHlpLnQAAAABJRU5ErkJggg==" />
<span style="color: <?php echo $data->getQueryCount() < 10 ? '#000' : '#d22' ?>"><?php echo $data->getQueryCount() ?></span>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/db.png') ?>" />
Doctrine MongoDB

View File

@ -5,7 +5,7 @@
<div class="sf-exceptionreset">
<div id="message">
<div style="float: left; margin-right: 20px">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg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v8GNfJ490F8N5ko9G4IpVKRQi/eQx9V1FRccdgMHhLSkrMFxFYX1//YXl5+crKysoHhA/C8R2/3x9eWloqx16hhAiMjY1JUPnpc32ysbHxS1VV1c21tbXd+fn5P0tLSwOwRopEIhETmUAgELTb7b7V1VVJbW1tTllZWTbkviosLKzUaDR5tFppT09PIFEL8EZHRx+iqfN6va79/f2j3NzcfCSkiM+g7wUpF0VRkYQkk8lEWq1WpVar5YyOLRT0L6Go0bX39va+Enev8wiQMjQ0dAtVvcvlMqlUKiWXFI81HqxZQPPL/v7+WSYVJ0pAQz4MIF+YbLVaH6SkpIi5EAiHw6cDAwNash4QAhT22kooCnJycr4Qi8VCePIZztmDFJt8fHwcmfN4PFuHh4cbCDktzKu5KMSLi4u7Q6HQawKBgB8MBkn4GBIi0NzcrGfacDCf0+l0ZGZmFpL+9va2GwrDIOIuKio6d3dsHEIkmbKzs3Wc8wDM50T1UkRAJLLjSPIxFplDjGt2d3dVGRkZCmbsHB1Uenr6b6gZAk4ueeAfCamlpWXuCkqsHMzqRiT8gUjZwSWUhWi4hqNTkLnNzU3H3NxcM5o/Rb8HuKRictPdrays/BBKJeRrY4ELyHFwcPAY/nFMatJn5nBkauSKO0RH1K2ZsAVEMN+9mpqal+GIFCLAj6/7l8M5HI77cNA9pg8e6QUFBTdoZ/0VRK5BP39hYWENCc2EdjghH+jq6hJA2AAiQnKW8IPP4VPvIxGlRcvBMnk+ny8MEkfY/DKI5tGX0BMQnoWOT0lar6ure5VEAicfaG9vn0DzXaCVPLOAN4BvouWQ44MwvQemp+CcstTU1Eu4P0i+eBP4FmgkrzryWJmcnFRyzoSktLa2Rj8qZzFnYXnk2iBzi+lPT0/zLnJCTg8S2iIku+nPEX9Ayzy7/wK876IRBgzAJ8DTqPGn9JiBlvl7Deuj98W/4f+ewF8CDADfMn9DHK75mAAAAABJRU5ErkJggg==" />
</div>
<div style="float: left; width: 600px">
<h1><?php echo $view->get('code')->formatFileFromText(str_replace("\n", '<br />', htmlspecialchars($exception->getMessage(), ENT_QUOTES, $view->getCharset()))) ?></h1>

View File

@ -0,0 +1,44 @@
<?php
namespace Symfony\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\OutputEscaper\SafeDecorator;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* ExceptionController.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ExceptionController extends ContainerAware
{
/**
* Converts an Exception to a Response.
*
* @param \Exception $exception An Exception instance
*
* @throws \InvalidArgumentException When the exception template does not exist
*/
public function showAction(FlattenException $exception, $format)
{
return $this->container->get('templating')->renderResponse(
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error'),
array(
'exception' => new SafeDecorator($exception),
'logger' => null,
'currentContent' => '',
'embedded' => true,
)
);
}
}

View File

@ -0,0 +1,317 @@
<?php
namespace Symfony\Bundle\WebProfilerBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\OutputEscaper\SafeDecorator;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* ProfilerController.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class ProfilerController extends ContainerAware
{
/**
* Renders the main profiler page for the given token.
*
* @param string $token The profiler token
*
* @return Response A Response instance
*/
public function indexAction($token)
{
$this->container->get('profiler')->disable();
$profiler = $this->container->get('profiler')->loadFromToken($token);
if ($profiler->isEmpty()) {
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound', array(
'token' => $token,
));
} else {
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:index', array(
'token' => $token,
'profiler' => new SafeDecorator($profiler),
'collector' => $profiler->getCollector('request'),
'template' => $this->getTemplate($profiler, '_panel', 'request'),
'panel' => 'request',
));
}
}
/**
* Exports data for a given token.
*
* @param string $token The profiler token
*
* @return Response A Response instance
*/
public function exportAction($token)
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$profiler = $profiler->loadFromToken($token);
if ($profiler->isEmpty()) {
throw new NotFoundHttpException(sprintf('Token "%s" does not exist.', $token));
}
$response = $this->container->get('response');
$response->setContent($profiler->export());
$response->headers->set('Content-Type', 'text/plain');
$response->headers->set('Content-Disposition', 'attachment; filename= '.$token.'.txt');
return $response;
}
/**
* Purges all tokens.
*
* @return Response A Response instance
*/
public function purgeAction()
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$profiler->purge();
$response = $this->container->get('response');
$response->setRedirect($this->container->get('router')->generate('_profiler', array('token' => '-')));
return $response;
}
/**
* Imports token data.
*
* @return Response A Response instance
*/
public function importAction()
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$file = $this->container->get('request')->files->get('file');
if (!$file || 0 !== $file['error']) {
throw new \RuntimeException('Problem uploading the data.');
}
$token = $profiler->import(file_get_contents($file['tmp_name']));
if (false === $token) {
throw new \RuntimeException('Problem uploading the data (token already exists).');
}
$response = $this->container->get('response');
$response->setRedirect($this->container->get('router')->generate('_profiler', array('token' => $token)));
return $response;
}
/**
* Renders the Web Debug Toolbar.
*
* @param string $token The profiler token
* @param string $position The toolbar position (bottom, normal, or null -- automatically guessed)
*
* @return Response A Response instance
*/
public function toolbarAction($token = null, $position = null)
{
$profiler = $this->container->get('profiler');
if (null !== $token) {
$profiler = $profiler->loadFromToken($token);
if ($profiler->isEmpty()) {
return $this->container->get('response');
}
}
if (null === $position) {
$position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute';
}
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar', array(
'position' => $position,
'profiler' => new SafeDecorator($profiler),
'templates' => $this->getTemplates($profiler, '_bar'),
));
}
/**
* Renders a profiler panel for the given token.
*
* @param string $token The profiler token
*
* @return Response A Response instance
*/
public function panelAction($token, $panel)
{
$this->container->get('profiler')->disable();
$profiler = $this->container->get('profiler')->loadFromToken($token);
if (!$profiler->hasCollector($panel)) {
throw new NotFoundHttpException(sprintf('Panel "%s" is not registered.', $panel));
}
if ($profiler->isEmpty()) {
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound', array(
'token' => $token,
));
} else {
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:panel', array(
'token' => $token,
'profiler' => new SafeDecorator($profiler),
'collector' => new SafeDecorator($profiler->getCollector($panel)),
'template' => $this->getTemplate($profiler, '_panel', $panel),
'panel' => $panel,
));
}
}
/**
* Renders the profiler menu for the given token.
*
* @param string $token The profiler token
* @param string $panel The current panel
*
* @return Response A Response instance
*/
public function listAction($token, $panel)
{
$profiler = $this->container->get('profiler')->loadFromToken($token);
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:menu', array(
'token' => $token,
'profiler' => new SafeDecorator($profiler),
'templates' => $this->getTemplates($profiler, '_menu'),
'panel' => $panel,
));
}
/**
* Renders the profiler search bar.
*
* @return Response A Response instance
*/
public function menuAction($token)
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$session = $this->container->get('request')->getSession();
$ip = $session->get('_profiler_search_ip');
$url = $session->get('_profiler_search_url');
$limit = $session->get('_profiler_search_limit');
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search', array(
'token' => $token,
'profiler' => new SafeDecorator($profiler),
'tokens' => $profiler->find($ip, $url, 10),
'ip' => $ip,
'url' => $url,
'limit' => $limit,
));
}
/**
* Search results.
*
* @return Response A Response instance
*/
public function searchResultsAction($token)
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$session = $this->container->get('request')->getSession();
$ip = $session->get('_profiler_search_ip');
$url = $session->get('_profiler_search_url');
$limit = $session->get('_profiler_search_limit');
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results', array(
'token' => $token,
'profiler' => new SafeDecorator($this->container->get('profiler')->loadFromToken($token)),
'tokens' => $profiler->find($ip, $url, 10),
'ip' => $ip,
'url' => $url,
'limit' => $limit,
'panel' => null,
));
}
/**
* Narrow the search bar.
*
* @return Response A Response instance
*/
public function searchAction()
{
$profiler = $this->container->get('profiler');
$profiler->disable();
$request = $this->container->get('request');
if ($token = $request->query->get('token')) {
$response = $this->container->get('response');
$response->setRedirect($this->container->get('router')->generate('_profiler', array('token' => $token)));
return $response;
}
$session = $request->getSession();
$session->set('_profiler_search_ip', $ip = preg_replace('/[^\d\.]/', '', $request->query->get('ip')));
$session->set('_profiler_search_url', $url = $request->query->get('url'));
$session->set('_profiler_search_limit', $limit = $request->query->get('limit'));
$profiler = $this->container->get('profiler');
$profiler->disable();
$tokens = $profiler->find($ip, $url, $limit);
$response = $this->container->get('response');
$response->setRedirect($this->container->get('router')->generate('_profiler_search_results', array('token' => $tokens[0]['token'])));
return $response;
}
protected function getTemplates($profiler, $suffix)
{
$templates = array();
foreach ($this->container->getParameter('data_collector.templates') as $name => $template) {
if ($profiler->hasCollector($name)) {
if (!$this->container->get('templating')->exists($template.$suffix)) {
continue;
}
$templates[$name] = $template.$suffix;
}
}
return $templates;
}
protected function getTemplate($profiler, $suffix, $panel)
{
$templates = $this->getTemplates($profiler, $suffix);
if (!isset($templates[$panel])) {
throw new NotFoundHttpException(sprintf('Panel "%s" is not registered.', $panel));
}
return $templates[$panel];
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Symfony\Bundle\WebProfilerBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Resource\FileResource;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* WebProfilerExtension.
*
* Usage:
*
* <webprofiler:config
* toolbar="true"
* intercept-redirects="true"
* />
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class WebProfilerExtension extends Extension
{
/**
* Loads the web profiler configuration.
*
* @param array $config An array of configuration settings
* @param ContainerBuilder $container A ContainerBuilder instance
*/
public function configLoad($config, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
if (isset($config['toolbar'])) {
if ($config['toolbar']) {
if (!$container->hasDefinition('debug.toolbar')) {
$loader = new XmlFileLoader($container, __DIR__.'/../Resources/config');
$loader->load('toolbar.xml');
$loader->load('web_profiler.xml');
}
} elseif ($container->hasDefinition('debug.toolbar')) {
$container->getDefinition('debug.toolbar')->clearTags();
}
}
if (isset($config['intercept-redirects'])) {
$container->setParameter('debug.toolbar.intercept_redirects', (Boolean) $config['intercept-redirects']);
} elseif (isset($config['intercept_redirects'])) {
$container->setParameter('debug.toolbar.intercept_redirects', (Boolean) $config['intercept_redirects']);
}
}
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
*/
public function getXsdValidationBasePath()
{
return __DIR__.'/../Resources/config/schema';
}
public function getNamespace()
{
return 'http://www.symfony-project.org/schema/dic/webprofiler';
}
public function getAlias()
{
return 'webprofiler';
}
}

View File

@ -0,0 +1,6 @@
Icons License
=============
Glyphish icons (http://glyphish.com/) created by Joseph Wain
(http://www.penandthink.com/) are shared under a Creative Commons Attribution
license (http://creativecommons.org/licenses/by/3.0/us/).

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://www.symfony-project.org/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
<route id="_profiler_search" pattern="/search">
<default key="_controller">WebProfilerBundle:Profiler:search</default>
</route>
<route id="_profiler_purge" pattern="/purge">
<default key="_controller">WebProfilerBundle:Profiler:purge</default>
</route>
<route id="_profiler_import" pattern="/import">
<default key="_controller">WebProfilerBundle:Profiler:import</default>
</route>
<route id="_profiler_export" pattern="/export/:token.txt">
<default key="_controller">WebProfilerBundle:Profiler:export</default>
</route>
<route id="_profiler_search_results" pattern="/:token/search/results">
<default key="_controller">WebProfilerBundle:Profiler:searchResults</default>
</route>
<route id="_profiler" pattern="/:token">
<default key="_controller">WebProfilerBundle:Profiler:index</default>
</route>
<route id="_profiler_panel" pattern="/:token/:panel">
<default key="_controller">WebProfilerBundle:Profiler:panel</default>
</route>
</routes>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://www.symfony-project.org/schema/dic/webprofiler"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.symfony-project.org/schema/dic/webprofiler"
elementFormDefault="qualified">
<xsd:element name="config" type="config" />
<xsd:complexType name="config">
<xsd:attribute name="toolbar" type="xsd:boolean" />
<xsd:attribute name="intercept-redirects" type="xsd:boolean" />
</xsd:complexType>
</xsd:schema>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="debug.toolbar.class">Symfony\Bundle\WebProfilerBundle\WebDebugToolbarListener</parameter>
<parameter key="debug.toolbar.intercept_redirects">false</parameter>
</parameters>
<services>
<service id="debug.toolbar" class="%debug.toolbar.class%">
<tag name="kernel.listener" priority="128" />
<argument type="service" id="controller_resolver" />
<argument>%debug.toolbar.intercept_redirects%</argument>
</service>
</services>
</container>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="data_collector.templates" type="collection">
<parameter key="config">WebProfilerBundle:Profiler:config</parameter>
<parameter key="request">WebProfilerBundle:Profiler:request</parameter>
<parameter key="exception">WebProfilerBundle:Profiler:exception</parameter>
<parameter key="events">WebProfilerBundle:Profiler:events</parameter>
<parameter key="logger">WebProfilerBundle:Profiler:logger</parameter>
<parameter key="timer">WebProfilerBundle:Profiler:timer</parameter>
<parameter key="memory">WebProfilerBundle:Profiler:memory</parameter>
<parameter key="db">DoctrineBundle:Profiler:db</parameter>
<parameter key="mongodb">DoctrineMongoDBBundle:Profiler:mongodb</parameter>
</parameter>
</parameters>
</container>

View File

@ -0,0 +1,203 @@
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.1.2
build: 56
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
.clearfix:after {
content: "\0020";
display: block;
height: 0;
clear: both;
visibility: hidden;
overflow: hidden;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}
html {
background: #fff;
}
body {
font: 11px Verdana, Arial, sans-serif;
color: #222;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
a {
color: #222;
}
abbr {
border-bottom: 1px dotted #000000;
cursor: help;
}
h1 {
font-size: 190%;
letter-spacing: -0.03em;
}
h1 img {
margin: 0 5px 0 0;
height: 32px;
}
h2 {
font-size: 180%;
letter-spacing: -0.02em;
padding: 10px 0;
}
h3 {
font-size: 160%;
letter-spacing: -0.02em;
padding: 10px 0;
}
img {
vertical-align: middle;
}
.header {
padding: 10px;
background: #333;
color: #fff;
}
.header div {
margin-left: 45px;
}
.menu, td.menu {
width: 240px;
}
.content {
padding: 15px;
padding-left: 35px;
padding-top: 15px;
}
.search, .import {
background: #efefef;
color: #333;
}
.search h3, .import h3 {
padding: 4px 10px;
background-image: -moz-linear-gradient(-90deg, #ededed, #a3a2a2);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ededed), to(#a3a2a2));
font-size: 115%;
}
.search form, .import form {
padding: 10px;
}
.search input, .import input {
float: left;
margin-bottom: 7px;
}
.search input.submit, .import input.submit {
float: right;
}
.search label {
float: left;
width: 50px;
}
th, td {
padding: 5px;
border: 1px solid #b4b4b4;
}
th {
font-weight: bold;
background: #edf3fe;
}
pre {
overflow: auto;
}
table {
width: 100%;
}
.menu ul {
background: #dde4eb;
font-size: 130%;
padding: 15px 0;
}
.menu li {
padding: 5px 10px;
}
.menu li.selected {
background: #0065bd;
color: #fff;
background-image: -moz-linear-gradient(-90deg, #5fa3e0, #0065bd);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#5fa3e0), to(#0065bd));
}
.menu li a {
color: #000;
text-decoration: none;
}
.menu li.selected a {
color: #fff;
}
.count {
font-family: monospace;
font-weight: bold;
padding: 4px;
margin-left: 5px;
margin-top: 5px;
font-size: 80%;
float: right;
background-color: #9cc2e8;
color: #fff;
-moz-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px;
}
.sf-toolbarreset {
border-top: 0;
}
ul.alt li {
padding: 5px 7px;
}
ul.alt li.even {
background: #edf3fe;
}
ul.alt li.error {
background-color: #f66;
}
td.main, td.menu {
text-align: left;
margin: 0;
padding: 0;
border: 0;
vertical-align: top;
}

View File

@ -0,0 +1,23 @@
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.1.2
build: 56
*/
.sf-toolbarreset html{color:#000;background:#FFF;}.sf-toolbarreset body,.sf-toolbarreset div,.sf-toolbarreset dl,.sf-toolbarreset dt,.sf-toolbarreset dd,.sf-toolbarreset ul,.sf-toolbarreset ol,.sf-toolbarreset li,.sf-toolbarreset h1,.sf-toolbarreset h2,.sf-toolbarreset h3,.sf-toolbarreset h4,.sf-toolbarreset h5,.sf-toolbarreset h6,.sf-toolbarreset pre,.sf-toolbarreset code,.sf-toolbarreset form,.sf-toolbarreset fieldset,.sf-toolbarreset legend,.sf-toolbarreset input,.sf-toolbarreset textarea,.sf-toolbarreset p,.sf-toolbarreset blockquote,.sf-toolbarreset th,.sf-toolbarreset td{margin:0;padding:0;}.sf-toolbarreset table{border-collapse:collapse;border-spacing:0;}.sf-toolbarreset fieldset,.sf-toolbarreset img{border:0;}.sf-toolbarreset address,.sf-toolbarreset caption,.sf-toolbarreset cite,.sf-toolbarreset code,.sf-toolbarreset dfn,.sf-toolbarreset em,.sf-toolbarreset strong,.sf-toolbarreset th,.sf-toolbarreset var{font-style:normal;font-weight:normal;}.sf-toolbarreset li{list-style:none;}.sf-toolbarreset caption,.sf-toolbarreset th{text-align:left;}.sf-toolbarreset h1,.sf-toolbarreset h2,.sf-toolbarreset h3,.sf-toolbarreset h4,.sf-toolbarreset h5,.sf-toolbarreset h6{font-size:100%;font-weight:normal;}.sf-toolbarreset q:before,.sf-toolbarreset q:after{content:'';}.sf-toolbarreset abbr,.sf-toolbarreset acronym{border:0;font-variant:normal;}.sf-toolbarreset sup{vertical-align:text-top;}.sf-toolbarreset sub{vertical-align:text-bottom;}.sf-toolbarreset input,.sf-toolbarreset textarea,.sf-toolbarreset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-toolbarreset input,.sf-toolbarreset textarea,.sf-toolbarreset select{*font-size:100%;}.sf-toolbarreset legend{color:#000;}
.sf-toolbarreset {
background: #cbcbcb;
background-image: -moz-linear-gradient(-90deg, #e8e8e8, #cbcbcb);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e8e8e8), to(#cbcbcb));
bottom: 0px;
left:0;
z-index: 6000000;
width: 100%;
border-top: 1px solid #bbb;
padding: 5px 0;
margin: 0;
font: 11px Verdana, Arial, sans-serif;
color: #000;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

View File

@ -0,0 +1,18 @@
<div class="import clearfix">
<h3>
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/import.png') ?>" />
Admin
</h3>
<form action="<?php echo $view->get('router')->generate('_profiler_import') ?>" method="post" enctype="multipart/form-data">
<div style="margin-bottom: 10px">
&raquo;&nbsp;<a href="<?php echo $view->get('router')->generate('_profiler_purge', array('token' => $token)) ?>">Purge</a>
</div>
<div style="margin-bottom: 10px">
&raquo;&nbsp;<a href="<?php echo $view->get('router')->generate('_profiler_export', array('token' => $token)) ?>">Export</a>
</div>
&raquo;&nbsp;<label for="file">Import</label><br />
<input type="file" name="file" id="file" /><br />
<input class="submit" type="submit" value="upload" />
</form>
</div>

View File

@ -0,0 +1,12 @@
<table>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<?php foreach ($bag->keys() as $key): ?>
<tr>
<th><?php echo $key ?></th>
<td><?php echo $bag->get($key) ?></td>
</tr>
<?php endforeach; ?>
</table>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php $view->get('slots')->output('title', 'Profiler') ?></title>
<?php echo $view->get('stylesheets') ?>
<?php echo $view->get('javascripts') ?>
<link href="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/css/profiler.css') ?>" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?php $view->get('slots')->output('_content') ?>
</body>
</html>

View File

@ -0,0 +1,8 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle" alt="Symfony" src="data:image/png;base64,R0lGODlhOwARAMQdAIZ1X9rVz0owD/Lx78K6r2JML3pnT+bj37asn6qej1Y+H+jk4JKDb0oxEJOEcId2YGJMMPTy8KufkLetoJ+RgNvW0M7Iv56Rf25aP8/JwG5aQP///z4jAP///wAAAAAAACH5BAEAAB0ALAAAAAA7ABEAAAX/YLc8WmmeaKqu7OosYsPNdG3fuCDgfM81C4dvyAsEiEgORZNMGjaI5rBEEzAugBmWBshiOICtAbu7QL+Ky8UwExQw6i8HTqPPqJzCYMMPCDYWNBYWBRsHfIaIgWYbWIiAHAF7iAkcZjSXd0wchwQYCBZ/gTODHAQbngEbARincBsYGAMDAK2NAKsGBodpG5i+mjMGewg7HJCki7AcT18YG1e+DBtZMweBjTO4r780eHmqAQXHoxylZs7Lz2q+6IIDxxczz6/GmRzfBQKnAxgWG+MiKUuXjh0zVDMKEYg3DxYueRwSAMO3SSKBfwMEPBtA4NDAOeoaZQp3alk2kBgEVJDk421TgX+AAu5SZClkwUwCEPA5wIYhSg4KYO5pieRZFClIrcELNkTAHgVJkUqEyOGBBCRdoiItUInGhAgQtIpNoqGD2Qxo06pdy7at27dvK5gNAQA7" />
<?php echo $data->getSymfonyVersion() ?>
<img style="margin: 0 5px 0 10px; vertical-align: middle" alt="PHP" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAARCAYAAAC8XK78AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABfdJREFUeNqMVWlsFGUYfubas+y2hZZlWxahFlBKQbSg/ECUhCgQIsqRcMQfgHJoJAgRMcQ/KP5CJHgkCMQoERLBCyGIUGsIQlIOW44etGV7sle7x8zszOzMrO+MBU1AwiTfzux3vO/zPu/zvh+Tz+fxoKcr3DeMYZgpkqROSibl8fGENDqZzAbSolIoy5o7m81BVjRFltVkRlIihq50cIzSxDJKA/LKpb17P4g8yD5zPwB1Zy55fT7PC3nwC/qT6qxIVArQQDKlIqebMM08fD4fWJZFKpWiE3ds5GHZM3SNhgQ9l4xp2WitnI0dzcqpE98dPZR+IICvDpzkCgu9yw2D3xhJaNW3IzLkrA7dMMFxDDlkyAeDggIB8eh5yFIGleNmIzGgwVoaNAnG/mZtQKapQZGjGOhvborevr4rnogeqK+v1+4BsOvj7ys8HvfulMjOifdr0HUGgiDYxigFdmSmadjvEcN5bN0yF8FgCKvX7iMWcjRv2MN2zQr2Gdzlhc6bOaQG2nD92vHTbTevvNnd3XvDWuOtn23vH3zc4/L+FEsaFZqmw+EQUOARkcmEYZgmWcjTnAvFRWXIKl7097dBU3UMKwmQ0SZYW/yFpZQePznXIIsd0HI6HTPpP4fColKwXAmNx1AzLTBLVff/Smy+RKm8yG/ctH+ow+k6lJaECkotbWLg8bhwpf4gjh37Fh63CzzPQhRllJQGsWbdDnRHe2HtbfirHu1tjVCyKpwuL5YuexvFwwL4fM8Ge93tckJRFQqAx7z5y1A1aQkyeR9mPL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eN08iZRlLNWzg31+cNyp4HzeFrE1DEOBJEapejqUrq7Gi92dN47E47eP0JXd+VDX8V0gq7eTr/w46m7TSKDVLMtXspwQYhlq7GC8Fg6TLiCTapucypomxRR5oEsUE62ZTH9jOp24kJGkptaWVuP/fPwtwAAItQDxq4a1ggAAAABJRU5ErkJggg==" />
<?php echo $data->getPhpVersion() ?><span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: <?php echo $data->hasXDebug() ? '#3a3' : '#a33' ?>">xdebug</span><span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: <?php echo $data->hasAccelerator() ? '#3a3' : '#a33' ?>">accel</span>
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXtJREFUeNpi/P//P8NAAsZRB6A7gJGRMQFIxdPIvoVA+xYgC7Cgq4iPj693d3dXoIXtO3fuBJm7AG8ILF26lKZxEh0dzYg3BP79+0fXNDD4HPD371+MhAqlsUUNuXIkOWDAQ4C+Dvjz5w8KPzc3F1wmTJ48mT4F0cSJE8ECN27c2IBNg4aGRgAlaSA/P5+RqBBQUVG5gM0BQPkAYnxWUlICDrmenh7yoqCiosIBRHd0dDhC+fuhfLwG3r59GxxyycnJYIdev34dzFdVVQ0gKgpaW1v/U5jVGnC4DSxeXV3NSLVcUF9fDw7mxsZGZDEHqJgjlL8fXQ3eEKirqyMYAvfu3cOaQJWUlAgm0KamJkaSsiE2ICcnR1ECpdgB3d3d4GAuLS11hPL3Q/mUlwNFRUWUJkK8cn19fdRLhHQpiqdNmwZO6VlZWRiayZUjKQSsra0bcIUMuXJ400BqaipNm2SzZ88e5GlgMLQJQWVmPY3saxztmo06AB0ABBgA4G/dmZ3TlQ8AAAAASUVORK5CYII=" />
<?php echo $data->getAppName() ?><span style="margin: 0; padding: 0; color: #aaa">|</span><?php echo $data->getEnv() ?><span style="margin: 0; padding: 0; color: #aaa">|</span><?php echo $data->isDebug() ? 'debug' : 'no-debug' ?><span style="margin: 0; padding: 0; color: #aaa">|</span><?php if ($url = $data->getUrl()): ?><a style="color: #000" href="<?php echo $url ?>"><?php echo $data->getToken() ?></a><?php else: ?><?php echo $data->getToken() ?><?php endif; ?>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/events.png') ?>" />
Events

View File

@ -0,0 +1,33 @@
<h2>Called Events</h2>
<table>
<tr>
<th>Event</th>
<th>Caller</th>
<th>Listener</th>
</tr>
<?php foreach ($data->getCalledEvents() as $event): ?>
<tr>
<td><code><?php echo $event['event'] ?></code></td>
<td><code><?php echo $view->get('code')->abbrClass($event['caller']) ?></code></td>
<td><code><?php echo $view->get('code')->abbrMethod($event['listener']) ?>()</code></td>
</tr>
<?php endforeach; ?>
</table>
<?php if ($events = $data->getNotCalledEvents()): ?>
<h2>Not Called Events</h2>
<table>
<tr>
<th>Event</th>
<th>Listener</th>
</tr>
<?php foreach ($events as $event): ?>
<tr>
<td><code><?php echo $event['event'] ?></code></td>
<td><code><?php echo $view->get('code')->abbrMethod($event['listener']) ?>()</code></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>

View File

@ -0,0 +1,5 @@
<?php if ($data->hasException()): ?>
<div class="count"><?php echo $data->hasException() ?></div>
<?php endif; ?>
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/exception.png') ?>" />
Exception

View File

@ -0,0 +1,10 @@
<?php $view->get('stylesheets')->add('bundles/framework/css/exception.css') ?>
<h2>Exception</h2>
<?php if (!$data->hasException()): ?>
<em>No exception was thrown and uncaught during the request.</em>
<?php return; ?>
<?php endif; ?>
<?php echo $view->get('actions')->render('WebProfilerBundle:Exception:show', array('exception' => $data->getException(), 'format' => 'html')) ?>

View File

@ -0,0 +1,3 @@
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
<?php echo $view->render($template, array('data' => $collector)) ?>

View File

@ -0,0 +1,23 @@
<?php $view->extend('WebProfilerBundle:Profiler:base') ?>
<div class="header">
<h1>
<img alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/profiler.png') ?>" />
Symfony Profiler
</h1>
<div>
<em><?php echo $profiler->getUrl() ?></em> by <em><?php echo $profiler->getIp() ?></em> at <em><?php echo date('r', $profiler->getTime()) ?></em>
</div>
</div>
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:toolbar', array('token' => $token, 'position' => 'normal')) ?>
<table>
<tr><td class="menu">
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:list', array('token' => $token, 'panel' => $panel)) ?>
</td><td class="main">
<div class="content">
<?php $view->get('slots')->output('_content') ?>
</div>
</td></tr>
</table>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAApBJREFUeNrsl19oUlEcx+91dp24hgMXhmvYZokaC5Uon+ollk/14JMIw8c9zpfwJeglqMfoVXQw9KknAyNFfagRyNaiB7Mw3VDxz9iG/xH/9D10HSJxJ9oSyh98OOd47u+c7/2ec/AeutPpUOMMHjXm4HN10jTdrc6Ax+AOOATvwWe2PDO4XKY5O38JUIjF4uc2m023vLwsa7Va+XQ6Hdne3m56vV4BK+QD2HO73dn+Mcxm80gCHqhUKvvGxsYNhmEyHo/nVbvdvryysiJUKpW3hEKhtlwuf4pEIgfBYJBJJpMVIoQI2traIiVlsViGF2A0GqMmk+lqvV5/HQqFnAsLC/cFAsFSLpc7TKVSBfzekEqlfIPBcAUu3YZgXjab/er3+8vhcHgKQ/wgYjDH26EEbG5udjBR0eVyxWZnZ79ptdoThULRgohOtVoVgZlisdiOx+P7tVqtgZSGTqebxjMGPHMN7uz7fL5LQDWUAKfTedqZSCSOo9HoUSwWK2KyI41GE1Wr1VWJRMI0m80LlUrlYqlUYrA/8ohjtBvr6+tkf7yxWq30UKcAG+60vri4OEdYXV2l8OaN3d3d64FA4LhQKNTn5+e/6PX6A7lcPiWTyaYzmcxN7BUa+c9GOoa9AnoD9jJk3QmkDVeWdnZ28rC6bLfbLXDkBVf+yAL6A2suIbA538nb/1UB/QEB1L8hAGs5lIDuxIPkTxyYODBZgokD5yKgmzf5L/gTAqwo7oJHQHweAjgvJg6Hw4XBrGAOaMFTsEcm4ILMLRKJ0mzbxXn3OOtesLa29rsuObgHHrJlrzs0jt8TPp//DvWP+LDl/CznD2pnXySBi4XqE0PxeLyXyDsZZLno//5yOnYBPwUYACFn5hv7UNkXAAAAAElFTkSuQmCC" />
<span><?php echo $data->countErrors() ?></span>

View File

@ -0,0 +1,3 @@
<div class="count"><?php echo $data->countErrors() ?></div>
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/logger.png') ?>" />
Logs

View File

@ -0,0 +1,14 @@
<h2>Logs</h2>
<?php if ($data->getLogs()): ?>
<ul class="alt">
<?php foreach ($data->getLogs() as $i => $log): ?>
<li class="<?php echo $i % 2 ? 'odd' : 'even' ?><?php if ('ERR' === $log['priorityName']): ?> error<?php endif; ?>">
<?php echo $log['priorityName'] ?>:
<?php echo preg_replace('/("|\')(.*?)\\1/', '$1<em>$2</em>$1', $log['message']) ?>
</li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<em>No logs available.</em>
<?php endif; ?>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVZJREFUeNrsl82qRVAUx7mdB5AkZmbKxMjEyHkMZXDuk9zOkyjJ/D7Bva9gQhQRJUkewNdl19bpDnyc42wTq7SyWNvP+u+VBe/7HjvSPrCD7QS4zF3Ecfzn4fS6ce0pd9hn16cALMtSXni5Vbn4XBcMFcBM0wQ3aJr2C+NDbE01YN7sMy5Lq3RdB7xhGMr/2Nv3wGht2wL/OdhD+LaUp+v6vgCqqn6NnmEYe83CMG83AEVRuNE7joMWoGka4F3X/d6iLczbDSDLMhHGaJq2kQPIsszBmOd56AF83z9WgjzPgQQURdmHAEiSBCQIggAtQF3XwIdhuEkCmLdbBYqimLqAJEn0m1AUxakLoihCDxDH8bFdUJYlkIAgiGO6QBAEIEGSJGgB4EclTdNNEuz+NayqStwCwLLsvgA8z3PvqMDiWD6MX/dxBHvyuL80lJ5/RicACvsTYABfiPlU6mFY2gAAAABJRU5ErkJggg==" />
<?php echo sprintf('%.0f', $data->getMemory() / 1024) ?> KB

View File

@ -0,0 +1,15 @@
<ul>
<?php foreach ($templates as $name => $template): ?>
<li
<?php if ($name == $panel): ?>class="selected"<?php endif; ?>
>
<a href="<?php echo $view->get('router')->generate('_profiler_panel', array('token' => $token, 'panel' => $name)) ?>">
<?php echo $view->render($template, array('data' => $profiler->getCollector($name))) ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:menu', array('token' => $token)) ?>
<?php echo $view->render('WebProfilerBundle:Profiler:admin', array('token' => $token)) ?>

View File

@ -0,0 +1,15 @@
<?php $view->extend('WebProfilerBundle:Profiler:base') ?>
<div class="header">
<h1>
<img alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/profiler.png') ?>" />
Symfony Profiler
</h1>
<div>
Token "<?php echo $token ?>" does not exist.
</div>
</div>
<div id="menu">
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:menu', array('token' => $token)) ?>
</div>

View File

@ -0,0 +1,3 @@
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
<?php echo $view->render($template, array('data' => $collector)) ?>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABJ5JREFUeNrEV1tIo0cUTuJqFH9iTBSjyUq8BVtLV2tLdV/6IiIFwe1LxQuu4mVBiwYfrCiI4KUv4oNdVKS64KX0qQUfKoKwT7WlTatS2sVdbXBXjVhtDPEetd9JZ2TWXExsiwOH/8y5zZmZM+ecX35xcSG7zSEXHZDL5dfJ9wMyGb4AMN9k0dfW9OOARDA1NWXjhI2NjZcJCQkGhr8CfpfzSkpKdPg4Ie8UjYDu1wGFDycltVr92GAwTMJAKinQ9/T0NIxwAsJFHsmSDnCJywRyvXd8Ld7W1vYRvuF9fX1flJaWLptMpkxJklTn5+f/CAEH7UvwFtLT003Nzc337Xb7UXd3twy0+vHxceeNYiAvL8+Un5//Y1xcnIpoR0dHLjKs0+kkbwZsNpuTHMVwb2Zra8sxOzv7Xnl5+TLNKyoqgouBsbExI2iLwFU3DDAHdO8BtdK8srIyuBiAghXH/MHh4eHJ2dmZzAssMPDgkQ7pArdy2nXDaxBWV1c7d3Z2yJhMgG8ASYAsBkmMdilDOqQr0oINQnrnMgTVGzExMRLfwfHx8YxSqXxwRZaO+AF434JXQATSge7ntbW1v9N8cHDQHFQQtrS0/EXfqKiocAJBLonfqZdhBPzBJ3t7e0cEhCcmJkY3NDT4jYHXTkCv16s5zne/u7u7o9ForH42YWUyWvY8wwlEGwHHgLfAOjk5UTY2Nup8BKSMeCTjix9UDLhcrqfMkbSQkBA94dHR0RKOsg28T7wZIB7JgM83sQ7d5/+qGPX29lLB+YXTV1dX/xwZGRkC+hg8d21obW2l3F9fU1PzKDk5OUawmcUKlYzJ3agYpZrNZotWq1WJTkxPT7/Y3t7+leaxsbFvFRYWpoqL4xk6+vv7s7u6ul5wWnt7e9AO6IxG41fI5/fDwsI8agUWced4OOeRmhELrsnJye+sVuvHnZ2d7pPq6OgI/BWw3K2Jj4/PUSgUd/i9igPPU2Lx4hnR0CkuLs7Z3NzUgG8LJAY8HMBT3ICHzxBMbwu5fVVoRK6OBcgk89qB7zOyQS+gp6dHbF4CS8VQslM+xw6WAA6W27MInE6ngz8vhrvpTN5BOhaL5UPYcJFMWlraGIHY4ATckqG+q1mWu/QeCeclEo6B4a+A3xVsZS4uLm7Pz8/30GR/f/832PiMcPQUn0ZGRr7J6PVY0xlwT9jU1HSJowv6PjQ09H2G/wA8R5RdWlrSI4AXsXslHHSmpKTQU5WtrKzY4KyE/HCMAL03Nze37q8jkl3NjkKQPcJczXD71UyXkZGxf3BwcKxSqbSAy2IGp9yOgOcgmWvLsZ/0TH3AUwYePcHAwMDXaFYVAu0JA/eceCQTVFteV1cXVEPEEbRmFrR17w4PD8uKiop+Ap7NeUNDQ/KAryCQpsLbwHHrsXgLx33ZufYEqqqqAl50dHRUKigosOB/wUTztbU1GytYOvYvsTwzM5MtvoL/9ARyc3Oj0AtouQ7+FXSiDeKRDP3A/C8OIOnsY3frVJJxmj+D9JCxnoD+TkREhFsmqCsoKysL9vp5V2XnQTkxMSGHHTXD7T6r4a3/Hd/G+FuAAQDV6k9Ni4q8owAAAABJRU5ErkJggg==" />
<?php if ($data->getRoute()): ?><?php echo $data->getRoute() ?><?php else: ?><span style="color: #a33">NONE</span><?php endif; ?><span style="margin: 0; padding: 0; color: #aaa">|</span><?php echo $data->getFormat() ?><span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: <?php echo 200 == $data->getStatusCode() ? '#3a3' : '#a33' ?>"><?php echo $data->getStatusCode() ?></span><span style="margin: 0; padding: 0; color: #aaa">|</span><?php echo $data->getContentType() ?>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/request.png') ?>" />
Request

View File

@ -0,0 +1,39 @@
<h2>Request GET Parameters</h2>
<?php if (count($data->getRequestQuery()->all())): ?>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestQuery())) ?>
<?php else: ?>
<em>No GET parameters</em>
<?php endif; ?>
<h2>Request POST Parameters</h2>
<?php if (count($data->getRequestRequest()->all())): ?>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestRequest())) ?>
<?php else: ?>
<em>No POST parameters</em>
<?php endif; ?>
<h2>Request Cookies</h2>
<?php if (count($data->getRequestCookies()->all())): ?>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestCookies())) ?>
<?php else: ?>
<em>No cookies</em>
<?php endif; ?>
<h2>Requests Headers</h2>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestHeaders())) ?>
<h2>Requests Server Parameters</h2>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestServer())) ?>
<h2>Response Headers</h2>
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getResponseHeaders())) ?>
<h2>Response Session Attributes</h2>
<?php //echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getSessionAttributes())) ?>

View File

@ -0,0 +1,20 @@
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
<h2>Search Results</h2>
<table>
<tr>
<th>Token</th>
<th>IP</th>
<th>URL</th>
<th>Time</th>
</tr>
<?php foreach ($tokens as $elements): ?>
<tr>
<td><a href="<?php echo $view->get('router')->generate('_profiler', array('token' => $elements['token'])) ?>"><?php echo $elements['token'] ?></a></td>
<td><?php echo $elements['ip'] ?></td>
<td><?php echo $elements['url'] ?></td>
<td><?php echo date('r', $elements['time']) ?></td>
</tr>
<?php endforeach; ?>
</table>

View File

@ -0,0 +1,24 @@
<div class="search clearfix">
<h3>
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" alt="" src="<?php echo $view->get('assets')->getUrl('bundles/webprofiler/images/search.png') ?>" />
Search
</h3>
<form action="<?php echo $view->get('router')->generate('_profiler_search') ?>" method="get">
<label for="ip">IP</label>
<input type="text" name="ip" id="ip" value="<?php echo $ip ?>" />
<div class="clearfix"></div>
<label for="url">URL</label>
<input type="text" name="url" id="url" value="<?php echo $url ?>" />
<div class="clearfix"></div>
<label for="token">Token</label>
<input type="text" name="token" id="token" />
<div class="clearfix"></div>
<label for="limit">Limit</label>
<select name="limit">
<?php foreach (array(10, 50, 100) as $l): ?>
<option<?php echo $l == $limit ? ' selected="selected"' : '' ?>><?php echo $l ?></option>
<?php endforeach; ?>
</select>
<input class="submit" type="submit" value="update" /><br />
</form>
</div>

View File

@ -0,0 +1,2 @@
<img style="margin: 0 7px 0 10px; vertical-align: middle; height: 24px" alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA6BJREFUeNrkV19IU1EY38bUIaFGCpsMJyJt4DZ1DMk1UINYELEVA8FFOX0xZVRP+WCU9OSDOnFjrJjTh8SXyN725qI/TyEjFCFFJ4T2YKjDif/t98W9tNa9d3cZ+tCBj/Odc7/fd373O+d897vS4+NjyVk2meSMm5xrUiqVisFOpY2bMgG4oi3lnEwhMD4+zusvHcZl1NLSIkhAnon10dHR6W+BSALSlChIT4VAa2trDTobhHrl6OgoO0/n4RskBnmF+QVm/hy6QQiN+zjfItMZGBkZkbS1tSmhPqqtrW20Wq3KioqKosLCQkUqZnNzc2dxcXEjEol8nZ+ff48pv1qtruvs7Ayurq5uDQ8Pe7FWX9YE0KylpaW9IGHSaDRFYsK6vLy8MTExsaDVagscDsdFmpubm/vS39+vzZaA1WKxBJqbm3V5eXnsdsUhk5A3aTA7xAEp57mCnzs6OqqzOQNKLD7ocrn0NDg4OEiA2BOoXtagq6vrZy7w+/2UA6KQh5AHWKwXtgWsHbbgsUql8mV1BsrKykIej+cOvTlsaPEG5pBx5YL0W1ADzFuWRDAYfDk7O3ubay2+VFzpdDpvydH29vaSuAkNh4eHMYhEpMQIQ1ga22y268zNEUfAaDR6ELIihJ32rgd9jPQsJcZgJeQL23lPdB4wm803iPnu7u53bIH3BInOCx898HFBp9NdFR2BkpISFTFPJBIRvjfs7u6+lKLX8dmxPsinaAL5+fkKisDS0lKUb5+xTc9Z3WAwvOCzY32QT9FbQIzZNMzq6c1utxvYZ0g2Rj47IR8ZCRBzIbCYlsmHjA9EggSiF7hqV3j03yTVh+gIJJPJdZzc80ql8poA+ymB6uhXOmV84Dasi44AjN8RY4A1AwMDToEoNDHC+Zyw5IP0/f39KdEEFArFIIHQK+rr658ODQ1V8iwSZeSPZ4QhLPmgcW5u7jPRBHw+XxRp9CMBq6qqtPgchzBXKTYVky1hCEtj8oW5WLZluQth25LJZHLkcgvSaSgQCDgzLU42ZEsYwpIP8sVb1wnVA+3t7fR9f006HB3MzMzEp6enP2FIFc+HNNhlqh9MJpNZr9eX5+TksAf8ZigUmvzrstztdjtgM8Z+Wre3t3dWVlbWUPWspWJQLRUj7MVsxmM+4XfD4fDkSctyclANcBh9Ix0q1IRqEoEilooTNzDxf1UVx5k/H/qm3yciHKVXnFl4jOlFNel//3N65gR+CDAAEVUmgT66oXEAAAAASUVORK5CYII=" />
<?php echo sprintf('%.0f', $data->getTime() * 1000) ?> ms

View File

@ -0,0 +1,30 @@
<?php $view->get('stylesheets')->add('bundles/webprofiler/css/toolbar.css') ?>
<!-- START of Symfony 2 Web Debug Toolbar -->
<?php if ('normal' !== $position): ?>
<div style="clear: both; height: 40px;"></div>
<?php endif; ?>
<div
class="sf-toolbarreset"
<?php if ('normal' !== $position): ?>
style="position: <?php echo $position ?>;
background: #cbcbcb;
background-image: -moz-linear-gradient(-90deg, #e8e8e8, #cbcbcb);
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e8e8e8), to(#cbcbcb));
bottom: 0px;
left:0;
z-index: 6000000;
width: 100%;
border-top: 1px solid #bbb;
padding: 5px;
margin: 0;
font: 11px Verdana, Arial, sans-serif;
color: #000;
"
<?php endif; ?>
>
<?php foreach ($templates as $name => $template): ?>
<?php echo $view->render($template, array('data' => $profiler->getCollector($name))) ?>
<?php endforeach; ?>
</div>
<!-- END of Symfony 2 Web Debug Toolbar -->

View File

@ -0,0 +1,97 @@
<?php
namespace Symfony\Bundle\WebProfilerBundle;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* WebDebugToolbarListener injects the Web Debug Toolbar.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class WebDebugToolbarListener
{
protected $resolver;
protected $interceptRedirects;
public function __construct(ControllerResolver $resolver, $interceptRedirects = false)
{
$this->resolver = $resolver;
$this->interceptRedirects = $interceptRedirects;
}
/**
* Registers a core.response listener.
*
* @param EventDispatcher $dispatcher An EventDispatcher instance
* @param integer $priority The priority
*/
public function register(EventDispatcher $dispatcher, $priority = 0)
{
$dispatcher->connect('core.response', array($this, 'handle'), $priority);
}
public function handle(Event $event, Response $response)
{
if (HttpKernelInterface::MASTER_REQUEST !== $event->getParameter('request_type')) {
return $response;
}
if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects) {
$r = new Response();
$r->setContent(
sprintf('<html><head></head><body><h1>This Request redirects to<br /><a href="%s">%s</a>.</h1></body></html>',
$response->headers->get('location'), $response->headers->get('location'))
);
$r->headers->set('X-Debug-Token', $response->headers->get('X-Debug-Token'));
$response = $r;
}
$request = $event->getParameter('request');
if (!$response->headers->has('X-Debug-Token')
|| '3' === substr($response->getStatusCode(), 0, 1)
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
|| 'html' !== $request->getRequestFormat()
|| $request->isXmlHttpRequest()
) {
return $response;
}
$response->setContent($this->injectToolbar($request, $response));
return $response;
}
/**
* Injects the web debug toolbar into a given HTML string.
*
* @param string $content The HTML content
*
* @return Response A Response instance
*/
protected function injectToolbar(Request $request, Response $response)
{
$toolbar = "\n".str_replace("\n", '', $this->resolver->render('WebProfilerBundle:Profiler:toolbar'))."\n";
$content = str_ireplace('</body>', $toolbar.'</body>', $response->getContent(), $count);
if (!$count) {
$content .= $toolbar;
}
return $content;
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Symfony\Bundle\WebProfilerBundle;
use Symfony\Framework\Bundle\Bundle;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Bundle.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class WebProfilerBundle extends Bundle
{
}