CakeErrorController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Error Handling Controller
  4. *
  5. * Controller used by ErrorHandler to render error views.
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  10. * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package Cake.Controller
  18. * @since CakePHP(tm) v 2.0
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. class CakeErrorController extends AppController {
  22. /**
  23. * Controller name
  24. *
  25. * @var string
  26. */
  27. public $name = 'CakeError';
  28. /**
  29. * Uses Property
  30. *
  31. * @var array
  32. */
  33. public $uses = array();
  34. /**
  35. * __construct
  36. *
  37. * @param CakeRequest $request
  38. * @param CakeResponse $response
  39. */
  40. public function __construct($request = null, $response = null) {
  41. parent::__construct($request, $response);
  42. if (count(Router::extensions())) {
  43. $this->components[] = 'RequestHandler';
  44. }
  45. $this->constructClasses();
  46. $this->Components->trigger('initialize', array(&$this));
  47. $this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
  48. if (isset($this->RequestHandler)) {
  49. $this->RequestHandler->startup($this);
  50. }
  51. }
  52. /**
  53. * Escapes the viewVars.
  54. *
  55. * @return void
  56. */
  57. public function beforeRender() {
  58. parent::beforeRender();
  59. foreach ($this->viewVars as $key => $value) {
  60. if (!is_object($value)){
  61. $this->viewVars[$key] = h($value);
  62. }
  63. }
  64. }
  65. }