move charset/App.encoding into CakeResponse

This commit is contained in:
euromark 2012-09-27 20:28:19 +02:00
parent 76d21c6d56
commit b47e3a7d92
9 changed files with 11 additions and 10 deletions

View file

@ -94,4 +94,4 @@ if (!empty($failed)) {
App::uses('Dispatcher', 'Routing'); App::uses('Dispatcher', 'Routing');
$Dispatcher = new Dispatcher(); $Dispatcher = new Dispatcher();
$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding')))); $Dispatcher->dispatch(new CakeRequest(), new CakeResponse());

View file

@ -98,5 +98,5 @@ App::uses('Dispatcher', 'Routing');
$Dispatcher = new Dispatcher(); $Dispatcher = new Dispatcher();
$Dispatcher->dispatch( $Dispatcher->dispatch(
new CakeRequest(), new CakeRequest(),
new CakeResponse(array('charset' => Configure::read('App.encoding'))) new CakeResponse()
); );

View file

@ -177,7 +177,7 @@ class CookieComponent extends Component {
if ($controller && isset($controller->response)) { if ($controller && isset($controller->response)) {
$this->_response = $controller->response; $this->_response = $controller->response;
} else { } else {
$this->_response = new CakeResponse(array('charset' => Configure::read('App.encoding'))); $this->_response = new CakeResponse();
} }
} }

View file

@ -146,7 +146,7 @@ class ExceptionRenderer {
if (!$request = Router::getRequest(true)) { if (!$request = Router::getRequest(true)) {
$request = new CakeRequest(); $request = new CakeRequest();
} }
$response = new CakeResponse(array('charset' => Configure::read('App.encoding'))); $response = new CakeResponse();
if (method_exists($exception, 'responseHeader')) { if (method_exists($exception, 'responseHeader')) {
$response->header($exception->responseHeader()); $response->header($exception->responseHeader());

View file

@ -384,9 +384,10 @@ class CakeResponse {
if (isset($options['type'])) { if (isset($options['type'])) {
$this->type($options['type']); $this->type($options['type']);
} }
if (isset($options['charset'])) { if (!isset($options['charset'])) {
$this->charset($options['charset']); $options['charset'] = Configure::read('App.encoding');
} }
$this->charset($options['charset']);
} }
/** /**

View file

@ -7,7 +7,7 @@ class TestAppsExceptionRenderer extends ExceptionRenderer {
if (!$request = Router::getRequest(true)) { if (!$request = Router::getRequest(true)) {
$request = new CakeRequest(); $request = new CakeRequest();
} }
$response = new CakeResponse(array('charset' => Configure::read('App.encoding'))); $response = new CakeResponse();
try { try {
$controller = new TestAppsErrorController($request, $response); $controller = new TestAppsErrorController($request, $response);
$controller->layout = 'banana'; $controller->layout = 'banana';

View file

@ -302,7 +302,7 @@ class CacheHelper extends AppHelper {
$file .= ' $file .= '
$request = unserialize(base64_decode(\'' . base64_encode(serialize($this->request)) . '\')); $request = unserialize(base64_decode(\'' . base64_encode(serialize($this->request)) . '\'));
$response = new CakeResponse(array("charset" => Configure::read("App.encoding"))); $response = new CakeResponse();
$controller = new ' . $this->_View->name . 'Controller($request, $response); $controller = new ' . $this->_View->name . 'Controller($request, $response);
$controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\'; $controller->plugin = $this->plugin = \'' . $this->_View->plugin . '\';
$controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\')); $controller->helpers = $this->helpers = unserialize(base64_decode(\'' . base64_encode(serialize($this->_View->helpers)) . '\'));

View file

@ -160,7 +160,7 @@ class HtmlHelper extends AppHelper {
if (is_object($this->_View->response)) { if (is_object($this->_View->response)) {
$this->response = $this->_View->response; $this->response = $this->_View->response;
} else { } else {
$this->response = new CakeResponse(array('charset' => Configure::read('App.encoding'))); $this->response = new CakeResponse();
} }
if (!empty($settings['configFile'])) { if (!empty($settings['configFile'])) {
$this->loadConfig($settings['configFile']); $this->loadConfig($settings['configFile']);

View file

@ -330,7 +330,7 @@ class View extends Object {
if (is_object($controller) && isset($controller->response)) { if (is_object($controller) && isset($controller->response)) {
$this->response = $controller->response; $this->response = $controller->response;
} else { } else {
$this->response = new CakeResponse(array('charset' => Configure::read('App.encoding'))); $this->response = new CakeResponse();
} }
$this->Helpers = new HelperCollection($this); $this->Helpers = new HelperCollection($this);
$this->Blocks = new ViewBlock(); $this->Blocks = new ViewBlock();