mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
"Fixing Controller::output; to allow access to the content in Contorller::afterFilter();"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6554 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a2db4e69b3
commit
57918f4199
4 changed files with 22 additions and 15 deletions
|
@ -267,7 +267,7 @@ class Dispatcher extends Object {
|
|||
}
|
||||
}
|
||||
$controller->afterFilter();
|
||||
return $controller->output;
|
||||
e($controller->output);
|
||||
}
|
||||
/**
|
||||
* Starts up a controller (by calling its beforeFilter methods and
|
||||
|
|
|
@ -710,7 +710,8 @@ class Controller extends Object {
|
|||
}
|
||||
|
||||
$this->autoRender = false;
|
||||
return $this->__viewClass->render($action, $layout, $file);
|
||||
$this->output .= $this->__viewClass->render($action, $layout, $file);
|
||||
return $this->output;
|
||||
}
|
||||
/**
|
||||
* Gets the referring URL of this request
|
||||
|
|
|
@ -191,7 +191,16 @@ class Scaffold extends Object {
|
|||
$this->controller->view = 'scaffold';
|
||||
}
|
||||
$this->__scaffold($params);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs the content of a scaffold method passing it through the Controller::afterFilter()
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function _output() {
|
||||
$this->controller->afterFilter();
|
||||
e($this->controller->output);
|
||||
}
|
||||
/**
|
||||
* Renders a view action of scaffolded model.
|
||||
*
|
||||
|
@ -215,6 +224,7 @@ class Scaffold extends Object {
|
|||
$this->controller->data = $this->ScaffoldModel->read();
|
||||
$this->controller->set(Inflector::variable($this->controller->modelClass), $this->controller->data);
|
||||
$this->controller->render($this->action, $this->layout);
|
||||
$this->_output();
|
||||
} elseif ($this->controller->_scaffoldError('view') === false) {
|
||||
return $this->__scaffoldError();
|
||||
}
|
||||
|
@ -231,6 +241,7 @@ class Scaffold extends Object {
|
|||
$this->ScaffoldModel->recursive = 0;
|
||||
$this->controller->set(Inflector::variable($this->controller->name), $this->controller->paginate());
|
||||
$this->controller->render($this->action, $this->layout);
|
||||
$this->_output();
|
||||
} elseif ($this->controller->_scaffoldError('index') === false) {
|
||||
return $this->__scaffoldError();
|
||||
}
|
||||
|
@ -244,6 +255,7 @@ class Scaffold extends Object {
|
|||
*/
|
||||
function __scaffoldForm($action = 'edit') {
|
||||
$this->controller->render($action, $this->layout);
|
||||
$this->_output();
|
||||
}
|
||||
/**
|
||||
* Saves or updates the scaffolded model.
|
||||
|
@ -368,6 +380,7 @@ class Scaffold extends Object {
|
|||
*/
|
||||
function __scaffoldError() {
|
||||
return $this->controller->render('error', $this->layout);
|
||||
$this->_output();
|
||||
}
|
||||
/**
|
||||
* When methods are now present in a controller
|
||||
|
@ -383,8 +396,8 @@ class Scaffold extends Object {
|
|||
*/
|
||||
function __scaffold($params) {
|
||||
$db = &ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
|
||||
$admin = Configure::read('Routing.admin');
|
||||
|
||||
$admin = Configure::read('Routing.admin');
|
||||
if (isset($db)) {
|
||||
if (empty($this->scaffoldActions)) {
|
||||
$this->scaffoldActions = array('index', 'list', 'view', 'add', 'create', 'edit', 'update', 'delete');
|
||||
|
@ -455,7 +468,7 @@ class Scaffold extends Object {
|
|||
}
|
||||
/**
|
||||
* Scaffold View.
|
||||
*
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.controller
|
||||
*/
|
||||
|
|
|
@ -350,14 +350,13 @@ class View extends Object {
|
|||
$out = str_replace($replace, '', $out);
|
||||
}
|
||||
}
|
||||
|
||||
print $out;
|
||||
$this->hasRendered = true;
|
||||
|
||||
} else {
|
||||
$out = $this->_render($viewFileName, $this->viewVars);
|
||||
trigger_error(sprintf(__("Error in view %s, got: <blockquote>%s</blockquote>", true), $viewFileName, $out), E_USER_ERROR);
|
||||
}
|
||||
return true;
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
* Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.
|
||||
|
@ -600,13 +599,7 @@ class View extends Object {
|
|||
function error($code, $name, $message) {
|
||||
header ("HTTP/1.1 {$code} {$name}");
|
||||
print ($this->_render(
|
||||
$this->_getLayoutFileName('error'),
|
||||
array(
|
||||
'code' => $code,
|
||||
'name' => $name,
|
||||
'message' => $message
|
||||
)
|
||||
));
|
||||
$this->_getLayoutFileName('error'), array('code' => $code, 'name' => $name, 'message' => $message)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue