[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 /** 12 * 13 * @package symfony 14 * @subpackage filter 15 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 16 * @version SVN: $Id: sfWebDebugFilter.class.php 3244 2007-01-12 14:46:11Z fabien $ 17 */ 18 class sfWebDebugFilter extends sfFilter 19 { 20 /** 21 * Executes this filter. 22 * 23 * @param sfFilterChain A sfFilterChain instance 24 */ 25 public function execute($filterChain) 26 { 27 // execute this filter only once 28 if ($this->isFirstCall()) 29 { 30 // register sfWebDebug assets 31 sfWebDebug::getInstance()->registerAssets(); 32 } 33 34 // execute next filter 35 $filterChain->execute(); 36 37 $context = $this->getContext(); 38 $response = $context->getResponse(); 39 $controller = $context->getController(); 40 41 // don't add debug toolbar: 42 // * for XHR requests 43 // * if 304 44 // * if not rendering to the client 45 // * if HTTP headers only 46 if ( 47 $this->getContext()->getRequest()->isXmlHttpRequest() || 48 strpos($response->getContentType(), 'html') === false || 49 $response->getStatusCode() == 304 || 50 $controller->getRenderMode() != sfView::RENDER_CLIENT || 51 $response->isHeaderOnly() 52 ) 53 { 54 return; 55 } 56 57 $content = $response->getContent(); 58 $webDebug = sfWebDebug::getInstance()->getResults(); 59 60 // add web debug information to response content 61 $newContent = str_ireplace('</body>', $webDebug.'</body>', $content); 62 if ($content == $newContent) 63 { 64 $newContent .= $webDebug; 65 } 66 67 $response->setContent($newContent); 68 } 69 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |