changed templating name notation
Old notation: bundle:section:name.format:renderer (where both format and renderer are optional) New notation: bundle:section:name.format.renderer (where only format is optional) Valid new template names: Blog:Post:index.php, Blog:Post:index.xml.php The new notation is more explicit and put all templating engines on the same level (there is no more the concept of a "default" templating engine). Even if the notation changed, the semantic has not. So, the logical template name for the above examples is still 'index'. So, if you use a database loader for instance, the template name is 'index' and everything else are options. Upgrading current applications can be easily done by appending .php to each existing template name reference (in both controllers and templates), and changing :twig to .twig for Twig templates (for twig templates, you should also add .twig within templates themselves when referencing another Twig templates).
This commit is contained in:
parent
4ac65cebcf
commit
a6dc10c31a
@ -28,6 +28,6 @@ class DefaultController extends ContainerAware
|
|||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
return $this->container->get('templating')->renderResponse('FrameworkBundle:Default:index');
|
return $this->container->get('templating')->renderResponse('FrameworkBundle:Default:index.php');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class ExceptionController extends ContainerAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->container->get('templating')->renderResponse(
|
$response = $this->container->get('templating')->renderResponse(
|
||||||
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error'),
|
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception.php' : 'error.php'),
|
||||||
array(
|
array(
|
||||||
'exception' => new SafeDecorator($exception),
|
'exception' => new SafeDecorator($exception),
|
||||||
'logger' => $logger,
|
'logger' => $logger,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php if (!$embedded): ?>
|
<?php if (!$embedded): ?>
|
||||||
<?php $view->extend('FrameworkBundle:Exception:layout') ?>
|
<?php $view->extend('FrameworkBundle:Exception:layout.php') ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="sf-exceptionreset">
|
<div class="sf-exceptionreset">
|
||||||
@ -27,10 +27,10 @@
|
|||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:traces', array('exception' => $exception, 'position' => 0, 'count' => $previousCount)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:traces.php', array('exception' => $exception, 'position' => 0, 'count' => $previousCount)) ?>
|
||||||
|
|
||||||
<?php foreach ($exception->getPreviouses() as $i => $previous): ?>
|
<?php foreach ($exception->getPreviouses() as $i => $previous): ?>
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:traces', array('exception' => $previous, 'position' => $i + 1, 'count' => $previousCount)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:traces.php', array('exception' => $previous, 'position' => $i + 1, 'count' => $previousCount)) ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
||||||
<?php if (null !== $logger): ?>
|
<?php if (null !== $logger): ?>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div id="logs" style="display: none">
|
<div id="logs" style="display: none">
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:logs', array('logs' => $logger->getLogs())) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:logs.php', array('logs' => $logger->getLogs())) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?php echo sprintf('<?xml version="1.0" encoding="%s" ?>', $view->getCharset())."\n" ?>
|
<?php echo sprintf('<?xml version="1.0" encoding="%s" ?>', $view->getCharset())."\n" ?>
|
||||||
<error code="<?php echo $exception->getStatusCode() ?>" message="<?php echo $exception->getStatusText() ?>">
|
<error code="<?php echo $exception->getStatusCode() ?>" message="<?php echo $exception->getStatusText() ?>">
|
||||||
<exception class="<?php echo $exception->getClass() ?>" message="<?php echo $exception->getMessage() ?>">
|
<exception class="<?php echo $exception->getClass() ?>" message="<?php echo $exception->getMessage() ?>">
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:traces', array('exception' => $exception, 'position' => 0, 'count' => ($previousCount = count($exception->getPreviouses())))) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:traces.php', array('exception' => $exception, 'position' => 0, 'count' => ($previousCount = count($exception->getPreviouses())))) ?>
|
||||||
</exception>
|
</exception>
|
||||||
<?php if ($previousCount): ?>
|
<?php if ($previousCount): ?>
|
||||||
<?php foreach ($exception->getPreviouses() as $i => $previous): ?>
|
<?php foreach ($exception->getPreviouses() as $i => $previous): ?>
|
||||||
<exception class="<?php echo $previous->getClass() ?>" message="<?php echo $previous->getMessage() ?>">
|
<exception class="<?php echo $previous->getClass() ?>" message="<?php echo $previous->getMessage() ?>">
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:traces', array('exception' => $previous, 'position' => $i + 1, 'count' => $previousCount)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:traces.php', array('exception' => $previous, 'position' => $i + 1, 'count' => $previousCount)) ?>
|
||||||
</exception>
|
</exception>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
body { font: 11px Verdana, Arial, sans-serif; color: #333 }
|
body { font: 11px Verdana, Arial, sans-serif; color: #333 }
|
||||||
.sf-exceptionreset, .sf-exceptionreset .block, .sf-exceptionreset #message { margin: auto }
|
.sf-exceptionreset, .sf-exceptionreset .block, .sf-exceptionreset #message { margin: auto }
|
||||||
|
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:styles') ?>
|
<?php echo $view->render('FrameworkBundle:Exception:styles.php') ?>
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<ol class="traces" id="traces_<?php echo $position ?>" style="display: <?php echo 0 === $position ? 'block' : 'none' ?>">
|
<ol class="traces" id="traces_<?php echo $position ?>" style="display: <?php echo 0 === $position ? 'block' : 'none' ?>">
|
||||||
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
||||||
<li>
|
<li>
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:trace', array('prefix' => $position, 'i' => $i, 'trace' => $trace)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:trace.php', array('prefix' => $position, 'i' => $i, 'trace' => $trace)) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php if (count($exception->getTrace())): ?>
|
<?php if (count($exception->getTrace())): ?>
|
||||||
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:trace.txt.php', array('i' => $i, 'trace' => $trace)) ?>
|
||||||
|
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<traces>
|
<traces>
|
||||||
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
<?php foreach ($exception->getTrace() as $i => $trace): ?>
|
||||||
<trace>
|
<trace>
|
||||||
<?php echo $view->render('FrameworkBundle:Exception:trace.txt', array('i' => $i, 'trace' => $trace)) ?>
|
<?php echo $view->render('FrameworkBundle:Exception:trace.txt.php', array('i' => $i, 'trace' => $trace)) ?>
|
||||||
|
|
||||||
</trace>
|
</trace>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
@ -37,7 +37,7 @@ class Engine extends BaseEngine
|
|||||||
* @param array $renderers An array of renderer instances
|
* @param array $renderers An array of renderer instances
|
||||||
* @param mixed $escaper The escaper to use (or false to disable escaping)
|
* @param mixed $escaper The escaper to use (or false to disable escaping)
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container, LoaderInterface $loader, array $renderers = array(), $escaper)
|
public function __construct(ContainerInterface $container, LoaderInterface $loader, array $renderers = array(), $escaper = false)
|
||||||
{
|
{
|
||||||
$this->level = 0;
|
$this->level = 0;
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
@ -136,18 +136,17 @@ class Engine extends BaseEngine
|
|||||||
return $parameters;
|
return $parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bundle:controller:action(.format)(:renderer)
|
// parses template names following the following pattern:
|
||||||
|
// bundle:controller:action(.format)(.renderer)
|
||||||
public function splitTemplateName($name, array $defaults = array())
|
public function splitTemplateName($name, array $defaults = array())
|
||||||
{
|
{
|
||||||
$parts = explode(':', $name, 4);
|
$parts = explode(':', $name);
|
||||||
|
if (3 !== count($parts)) {
|
||||||
if (sizeof($parts) < 3) {
|
|
||||||
throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid.', $name));
|
throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid.', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array_replace(
|
$options = array_replace(
|
||||||
array(
|
array(
|
||||||
'renderer' => 'php',
|
|
||||||
'format' => '',
|
'format' => '',
|
||||||
),
|
),
|
||||||
$defaults,
|
$defaults,
|
||||||
@ -157,18 +156,20 @@ class Engine extends BaseEngine
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (false !== $pos = strpos($parts[2], '.')) {
|
$elements = explode('.', $parts[2]);
|
||||||
$options['format'] = substr($parts[2], $pos);
|
if (3 === count($elements)) {
|
||||||
$parts[2] = substr($parts[2], 0, $pos);
|
$parts[2] = $elements[0];
|
||||||
} else {
|
$options['format'] = $elements[1];
|
||||||
$format = $this->container->getRequestService()->getRequestFormat();
|
$options['renderer'] = $elements[2];
|
||||||
|
} elseif (2 === count($elements)) {
|
||||||
|
$parts[2] = $elements[0];
|
||||||
|
$options['renderer'] = $elements[1];
|
||||||
|
$format = $this->container->get('request')->getRequestFormat();
|
||||||
if (null !== $format && 'html' !== $format) {
|
if (null !== $format && 'html' !== $format) {
|
||||||
$options['format'] = '.'.$format;
|
$options['format'] = '.'.$format;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid.', $name));
|
||||||
if (isset($parts[3]) && $parts[3]) {
|
|
||||||
$options['renderer'] = $parts[3];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($parts[2], $options);
|
return array($parts[2], $options);
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Symfony package.
|
||||||
|
*
|
||||||
|
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Templating\Engine;
|
||||||
|
|
||||||
|
class EngineTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider getSplitTemplateNameTests
|
||||||
|
*/
|
||||||
|
public function testSplitTemplateName($name, $parameters)
|
||||||
|
{
|
||||||
|
$engine = new Engine($this->getContainerMock(), $this->getLoaderMock());
|
||||||
|
|
||||||
|
$this->assertEquals($parameters, $engine->splitTemplateName($name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSplitTemplateNameTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('BlogBundle:Post:index.php', array('index', array('bundle' => 'BlogBundle', 'controller' => 'Post', 'renderer' => 'php', 'format' => ''))),
|
||||||
|
array('BlogBundle:Post:index.twig', array('index', array('bundle' => 'BlogBundle', 'controller' => 'Post', 'renderer' => 'twig', 'format' => ''))),
|
||||||
|
array('BlogBundle:Post:index.xml.php', array('index', array('bundle' => 'BlogBundle', 'controller' => 'Post', 'renderer' => 'php', 'format' => 'xml'))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getSplitTemplateNameInvalidTests
|
||||||
|
* @expectedException \InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testSplitTemplateNameInvalid($name)
|
||||||
|
{
|
||||||
|
$engine = new Engine($this->getContainerMock(), $this->getLoaderMock());
|
||||||
|
|
||||||
|
$engine->splitTemplateName($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSplitTemplateNameInvalidTests()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('BlogBundle:Post:index'),
|
||||||
|
array('BlogBundle:Post'),
|
||||||
|
array('BlogBundle:Post:foo:bar'),
|
||||||
|
array('BlogBundle:Post:index.foo.bar.foobar'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getContainerMock()
|
||||||
|
{
|
||||||
|
$request = $this->getMock('Symfony\Component\HttpFoundation\Request');
|
||||||
|
$request
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getRequestFormat')
|
||||||
|
->will($this->returnValue('html'))
|
||||||
|
;
|
||||||
|
|
||||||
|
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
|
||||||
|
$container
|
||||||
|
->expects($this->exactly(2))
|
||||||
|
->method('findTaggedServiceIds')
|
||||||
|
->will($this->returnValue(array()))
|
||||||
|
;
|
||||||
|
$container
|
||||||
|
->expects($this->any())
|
||||||
|
->method('get')
|
||||||
|
->will($this->returnValue($request))
|
||||||
|
;
|
||||||
|
|
||||||
|
return $container;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getLoaderMock()
|
||||||
|
{
|
||||||
|
return $this->getMock('Symfony\Component\Templating\Loader\LoaderInterface');
|
||||||
|
}
|
||||||
|
}
|
@ -41,7 +41,7 @@ class Loader implements \Twig_LoaderInterface
|
|||||||
return $name->getContent();
|
return $name->getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
list($name, $options) = $this->engine->splitTemplateName($name, array('renderer' => 'twig'));
|
list($name, $options) = $this->engine->splitTemplateName($name);
|
||||||
|
|
||||||
$template = $this->engine->getLoader()->load($name, $options);
|
$template = $this->engine->getLoader()->load($name, $options);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ class Loader implements \Twig_LoaderInterface
|
|||||||
return (string) $name;
|
return (string) $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($name, $options) = $this->engine->splitTemplateName($name, array('renderer' => 'twig'));
|
list($name, $options) = $this->engine->splitTemplateName($name);
|
||||||
|
|
||||||
return $name.'_'.serialize($options);
|
return $name.'_'.serialize($options);
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ class Loader implements \Twig_LoaderInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($name, $options) = $this->engine->splitTemplateName($name, array('renderer' => 'twig'));
|
list($name, $options) = $this->engine->splitTemplateName($name);
|
||||||
|
|
||||||
return $this->engine->getLoader()->isFresh($name, $options, $time);
|
return $this->engine->getLoader()->isFresh($name, $options, $time);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ class ExceptionController extends ContainerAware
|
|||||||
public function showAction(FlattenException $exception, $format)
|
public function showAction(FlattenException $exception, $format)
|
||||||
{
|
{
|
||||||
return $this->container->get('templating')->renderResponse(
|
return $this->container->get('templating')->renderResponse(
|
||||||
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error'),
|
'FrameworkBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception.php' : 'error.php'),
|
||||||
array(
|
array(
|
||||||
'exception' => new SafeDecorator($exception),
|
'exception' => new SafeDecorator($exception),
|
||||||
'logger' => null,
|
'logger' => null,
|
||||||
|
@ -37,11 +37,11 @@ class ProfilerController extends ContainerAware
|
|||||||
$profiler = $this->container->get('profiler')->loadFromToken($token);
|
$profiler = $this->container->get('profiler')->loadFromToken($token);
|
||||||
|
|
||||||
if ($profiler->isEmpty()) {
|
if ($profiler->isEmpty()) {
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:index', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:index.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => new SafeDecorator($profiler),
|
'profiler' => new SafeDecorator($profiler),
|
||||||
'collector' => $profiler->get('request'),
|
'collector' => $profiler->get('request'),
|
||||||
@ -145,7 +145,7 @@ class ProfilerController extends ContainerAware
|
|||||||
$position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute';
|
$position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.php', array(
|
||||||
'position' => $position,
|
'position' => $position,
|
||||||
'profiler' => new SafeDecorator($profiler),
|
'profiler' => new SafeDecorator($profiler),
|
||||||
'templates' => $this->getTemplates($profiler, '_bar'),
|
'templates' => $this->getTemplates($profiler, '_bar'),
|
||||||
@ -169,11 +169,11 @@ class ProfilerController extends ContainerAware
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($profiler->isEmpty()) {
|
if ($profiler->isEmpty()) {
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:notfound.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:panel', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:panel.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => new SafeDecorator($profiler),
|
'profiler' => new SafeDecorator($profiler),
|
||||||
'collector' => new SafeDecorator($profiler->get($panel)),
|
'collector' => new SafeDecorator($profiler->get($panel)),
|
||||||
@ -195,7 +195,7 @@ class ProfilerController extends ContainerAware
|
|||||||
{
|
{
|
||||||
$profiler = $this->container->get('profiler')->loadFromToken($token);
|
$profiler = $this->container->get('profiler')->loadFromToken($token);
|
||||||
|
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:menu', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:menu.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => new SafeDecorator($profiler),
|
'profiler' => new SafeDecorator($profiler),
|
||||||
'templates' => $this->getTemplates($profiler, '_menu'),
|
'templates' => $this->getTemplates($profiler, '_menu'),
|
||||||
@ -218,7 +218,7 @@ class ProfilerController extends ContainerAware
|
|||||||
$url = $session->get('_profiler_search_url');
|
$url = $session->get('_profiler_search_url');
|
||||||
$limit = $session->get('_profiler_search_limit');
|
$limit = $session->get('_profiler_search_limit');
|
||||||
|
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => new SafeDecorator($profiler),
|
'profiler' => new SafeDecorator($profiler),
|
||||||
'tokens' => $profiler->find($ip, $url, 10),
|
'tokens' => $profiler->find($ip, $url, 10),
|
||||||
@ -243,7 +243,7 @@ class ProfilerController extends ContainerAware
|
|||||||
$url = $session->get('_profiler_search_url');
|
$url = $session->get('_profiler_search_url');
|
||||||
$limit = $session->get('_profiler_search_limit');
|
$limit = $session->get('_profiler_search_limit');
|
||||||
|
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results.php', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => new SafeDecorator($this->container->get('profiler')->loadFromToken($token)),
|
'profiler' => new SafeDecorator($this->container->get('profiler')->loadFromToken($token)),
|
||||||
'tokens' => $profiler->find($ip, $url, 10),
|
'tokens' => $profiler->find($ip, $url, 10),
|
||||||
@ -293,11 +293,12 @@ class ProfilerController extends ContainerAware
|
|||||||
$templates = array();
|
$templates = array();
|
||||||
foreach ($this->container->getParameter('data_collector.templates') as $name => $template) {
|
foreach ($this->container->getParameter('data_collector.templates') as $name => $template) {
|
||||||
if ($profiler->has($name)) {
|
if ($profiler->has($name)) {
|
||||||
if (!$this->container->get('templating')->exists($template.$suffix)) {
|
$tpl = preg_replace('/\.(.+?)$/', $suffix.'.$1', $template);
|
||||||
|
if (!$this->container->get('templating')->exists($tpl)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$templates[$name] = $template.$suffix;
|
$templates[$name] = $tpl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
|
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter key="data_collector.templates" type="collection">
|
<parameter key="data_collector.templates" type="collection">
|
||||||
<parameter key="config">WebProfilerBundle:Profiler:config</parameter>
|
<parameter key="config">WebProfilerBundle:Profiler:config.php</parameter>
|
||||||
<parameter key="request">WebProfilerBundle:Profiler:request</parameter>
|
<parameter key="request">WebProfilerBundle:Profiler:request.php</parameter>
|
||||||
<parameter key="exception">WebProfilerBundle:Profiler:exception</parameter>
|
<parameter key="exception">WebProfilerBundle:Profiler:exception.php</parameter>
|
||||||
<parameter key="events">WebProfilerBundle:Profiler:events</parameter>
|
<parameter key="events">WebProfilerBundle:Profiler:events.php</parameter>
|
||||||
<parameter key="logger">WebProfilerBundle:Profiler:logger</parameter>
|
<parameter key="logger">WebProfilerBundle:Profiler:logger.php</parameter>
|
||||||
<parameter key="timer">WebProfilerBundle:Profiler:timer</parameter>
|
<parameter key="timer">WebProfilerBundle:Profiler:timer.php</parameter>
|
||||||
<parameter key="memory">WebProfilerBundle:Profiler:memory</parameter>
|
<parameter key="memory">WebProfilerBundle:Profiler:memory.php</parameter>
|
||||||
<parameter key="db">DoctrineBundle:Profiler:db</parameter>
|
<parameter key="db">DoctrineBundle:Profiler:db.php</parameter>
|
||||||
<parameter key="mongodb">DoctrineMongoDBBundle:Profiler:mongodb</parameter>
|
<parameter key="mongodb">DoctrineMongoDBBundle:Profiler:mongodb.php</parameter>
|
||||||
</parameter>
|
</parameter>
|
||||||
</parameters>
|
</parameters>
|
||||||
</container>
|
</container>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
|
<?php $view->extend('WebProfilerBundle:Profiler:layout.php') ?>
|
||||||
|
|
||||||
<?php echo $view->render($template, array('data' => $collector)) ?>
|
<?php echo $view->render($template, array('data' => $collector)) ?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php $view->extend('WebProfilerBundle:Profiler:base') ?>
|
<?php $view->extend('WebProfilerBundle:Profiler:base.php') ?>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>
|
<h1>
|
||||||
|
@ -12,4 +12,4 @@
|
|||||||
|
|
||||||
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:menu', array('token' => $token)) ?>
|
<?php echo $view->get('actions')->render('WebProfilerBundle:Profiler:menu', array('token' => $token)) ?>
|
||||||
|
|
||||||
<?php echo $view->render('WebProfilerBundle:Profiler:admin', array('token' => $token)) ?>
|
<?php echo $view->render('WebProfilerBundle:Profiler:admin.php', array('token' => $token)) ?>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php $view->extend('WebProfilerBundle:Profiler:base') ?>
|
<?php $view->extend('WebProfilerBundle:Profiler:base.php') ?>
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>
|
<h1>
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
|
<?php $view->extend('WebProfilerBundle:Profiler:layout.php') ?>
|
||||||
|
|
||||||
<?php echo $view->render($template, array('data' => $collector)) ?>
|
<?php echo $view->render($template, array('data' => $collector)) ?>
|
||||||
|
@ -17,22 +17,22 @@
|
|||||||
<h2>Request Cookies</h2>
|
<h2>Request Cookies</h2>
|
||||||
|
|
||||||
<?php if (count($data->getRequestCookies()->all())): ?>
|
<?php if (count($data->getRequestCookies()->all())): ?>
|
||||||
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestCookies())) ?>
|
<?php echo $view->render('WebProfilerBundle:Profiler:bag.php', array('bag' => $data->getRequestCookies())) ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<em>No cookies</em>
|
<em>No cookies</em>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<h2>Requests Headers</h2>
|
<h2>Requests Headers</h2>
|
||||||
|
|
||||||
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestHeaders())) ?>
|
<?php echo $view->render('WebProfilerBundle:Profiler:bag.php', array('bag' => $data->getRequestHeaders())) ?>
|
||||||
|
|
||||||
<h2>Requests Server Parameters</h2>
|
<h2>Requests Server Parameters</h2>
|
||||||
|
|
||||||
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getRequestServer())) ?>
|
<?php echo $view->render('WebProfilerBundle:Profiler:bag.php', array('bag' => $data->getRequestServer())) ?>
|
||||||
|
|
||||||
<h2>Response Headers</h2>
|
<h2>Response Headers</h2>
|
||||||
|
|
||||||
<?php echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getResponseHeaders())) ?>
|
<?php echo $view->render('WebProfilerBundle:Profiler:bag.php', array('bag' => $data->getResponseHeaders())) ?>
|
||||||
|
|
||||||
<h2>Response Session Attributes</h2>
|
<h2>Response Session Attributes</h2>
|
||||||
|
|
||||||
@ -59,5 +59,3 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<?php //echo $view->render('WebProfilerBundle:Profiler:bag', array('bag' => $data->getSessionAttributes())) ?>
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php $view->extend('WebProfilerBundle:Profiler:layout') ?>
|
<?php $view->extend('WebProfilerBundle:Profiler:layout.php') ?>
|
||||||
|
|
||||||
<h2>Search Results</h2>
|
<h2>Search Results</h2>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user