mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Cleaning up and finishing code formatting changes in View class.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7854 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
16eebce7f7
commit
fde0d21053
1 changed files with 40 additions and 37 deletions
|
@ -386,7 +386,12 @@ class View extends Object {
|
||||||
if ($out !== false) {
|
if ($out !== false) {
|
||||||
if ($layout && $this->autoLayout) {
|
if ($layout && $this->autoLayout) {
|
||||||
$out = $this->renderLayout($out, $layout);
|
$out = $this->renderLayout($out, $layout);
|
||||||
if (isset($this->loaded['cache']) && (($this->cacheAction != false)) && (Configure::read('Cache.check') === true)) {
|
$isCached = (
|
||||||
|
isset($this->loaded['cache']) &&
|
||||||
|
(($this->cacheAction != false)) && (Configure::read('Cache.check') === true)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($isCached) {
|
||||||
$replace = array('<cake:nocache>', '</cake:nocache>');
|
$replace = array('<cake:nocache>', '</cake:nocache>');
|
||||||
$out = str_replace($replace, '', $out);
|
$out = str_replace($replace, '', $out);
|
||||||
}
|
}
|
||||||
|
@ -394,7 +399,8 @@ class View extends Object {
|
||||||
$this->hasRendered = true;
|
$this->hasRendered = true;
|
||||||
} else {
|
} else {
|
||||||
$out = $this->_render($viewFileName, $this->viewVars);
|
$out = $this->_render($viewFileName, $this->viewVars);
|
||||||
trigger_error(sprintf(__("Error in view %s, got: <blockquote>%s</blockquote>", true), $viewFileName, $out), E_USER_ERROR);
|
$msg = __("Error in view %s, got: <blockquote>%s</blockquote>", true);
|
||||||
|
trigger_error(sprintf($msg, $viewFileName, $out), E_USER_ERROR);
|
||||||
}
|
}
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
@ -424,14 +430,12 @@ class View extends Object {
|
||||||
} else {
|
} else {
|
||||||
$pageTitle = Inflector::humanize($this->viewPath);
|
$pageTitle = Inflector::humanize($this->viewPath);
|
||||||
}
|
}
|
||||||
$data_for_layout = array_merge($this->viewVars,
|
$data_for_layout = array_merge($this->viewVars, array(
|
||||||
array(
|
|
||||||
'title_for_layout' => $pageTitle,
|
'title_for_layout' => $pageTitle,
|
||||||
'content_for_layout' => $content_for_layout,
|
'content_for_layout' => $content_for_layout,
|
||||||
'scripts_for_layout' => join("\n\t", $this->__scripts),
|
'scripts_for_layout' => join("\n\t", $this->__scripts),
|
||||||
'cakeDebug' => $debug
|
'cakeDebug' => $debug
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
if (empty($this->loaded) && !empty($this->helpers)) {
|
if (empty($this->loaded) && !empty($this->helpers)) {
|
||||||
$loadHelpers = true;
|
$loadHelpers = true;
|
||||||
|
@ -460,14 +464,8 @@ class View extends Object {
|
||||||
|
|
||||||
if ($this->output === false) {
|
if ($this->output === false) {
|
||||||
$this->output = $this->_render($layoutFileName, $data_for_layout);
|
$this->output = $this->_render($layoutFileName, $data_for_layout);
|
||||||
|
$msg = __("Error in layout %s, got: <blockquote>%s</blockquote>", true);
|
||||||
trigger_error(
|
trigger_error(sprintf($msg, $layoutFileName, $this->output), E_USER_ERROR);
|
||||||
sprintf(
|
|
||||||
__("Error in layout %s, got: <blockquote>%s</blockquote>", true),
|
|
||||||
$layoutFileName, $this->output
|
|
||||||
),
|
|
||||||
E_USER_ERROR
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,8 +506,7 @@ class View extends Object {
|
||||||
if ($this->layout === 'xml') {
|
if ($this->layout === 'xml') {
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
}
|
}
|
||||||
$out = str_replace('<!--cachetime:'.$match['1'].'-->', '', $out);
|
echo str_replace('<!--cachetime:' . $match['1'] . '-->', '', $out);
|
||||||
echo $out;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -681,8 +678,12 @@ class View extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out = ob_get_clean();
|
$out = ob_get_clean();
|
||||||
|
$caching = (
|
||||||
|
isset($this->loaded['cache']) &&
|
||||||
|
(($this->cacheAction != false)) && (Configure::read('Cache.check') === true)
|
||||||
|
);
|
||||||
|
|
||||||
if (isset($this->loaded['cache']) && (($this->cacheAction != false)) && (Configure::read('Cache.check') === true)) {
|
if ($caching) {
|
||||||
if (is_a($this->loaded['cache'], 'CacheHelper')) {
|
if (is_a($this->loaded['cache'], 'CacheHelper')) {
|
||||||
$cache =& $this->loaded['cache'];
|
$cache =& $this->loaded['cache'];
|
||||||
$cache->base = $this->base;
|
$cache->base = $this->base;
|
||||||
|
@ -750,7 +751,9 @@ class View extends Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$loaded[$helper] =& new $helperCn($options);
|
$loaded[$helper] =& new $helperCn($options);
|
||||||
$vars = array('base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin');
|
$vars = array(
|
||||||
|
'base', 'webroot', 'here', 'params', 'action', 'data', 'themeWeb', 'plugin'
|
||||||
|
);
|
||||||
$c = count($vars);
|
$c = count($vars);
|
||||||
|
|
||||||
for ($j = 0; $j < $c; $j++) {
|
for ($j = 0; $j < $c; $j++) {
|
||||||
|
@ -883,7 +886,6 @@ class View extends Object {
|
||||||
));
|
));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return all possible paths to find view files in order
|
* Return all possible paths to find view files in order
|
||||||
|
@ -926,4 +928,5 @@ class View extends Object {
|
||||||
return $this->element($name, $params, $loadHelpers);
|
return $this->element($name, $params, $loadHelpers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue