CakeErrorController.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. /**
  22. * Error Handling Controller
  23. *
  24. * Controller used by ErrorHandler to render error views.
  25. *
  26. * @package Cake.Controller
  27. */
  28. class CakeErrorController extends AppController {
  29. /**
  30. * Controller name
  31. *
  32. * @var string
  33. */
  34. public $name = 'CakeError';
  35. /**
  36. * Uses Property
  37. *
  38. * @var array
  39. */
  40. public $uses = array();
  41. /**
  42. * __construct
  43. *
  44. * @param CakeRequest $request
  45. * @param CakeResponse $response
  46. */
  47. public function __construct($request = null, $response = null) {
  48. parent::__construct($request, $response);
  49. if (count(Router::extensions())) {
  50. $this->components[] = 'RequestHandler';
  51. }
  52. $this->constructClasses();
  53. $this->Components->trigger('initialize', array(&$this));
  54. $this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
  55. if (isset($this->RequestHandler)) {
  56. $this->RequestHandler->startup($this);
  57. }
  58. }
  59. /**
  60. * Escapes the viewVars.
  61. *
  62. * @return void
  63. */
  64. public function beforeRender() {
  65. parent::beforeRender();
  66. foreach ($this->viewVars as $key => $value) {
  67. if (!is_object($value)) {
  68. $this->viewVars[$key] = h($value);
  69. }
  70. }
  71. }
  72. }