mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-30 22:48:19 +08:00
Renamed view to getView().
This commit is contained in:
@@ -82,7 +82,7 @@ class FragmentCache extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getCachedContent() === false) {
|
if ($this->getCachedContent() === false) {
|
||||||
$this->view->cacheStack[] = $this;
|
$this->getView()->cacheStack[] = $this;
|
||||||
ob_start();
|
ob_start();
|
||||||
ob_implicit_flush(false);
|
ob_implicit_flush(false);
|
||||||
}
|
}
|
||||||
@@ -100,14 +100,14 @@ class FragmentCache extends Widget
|
|||||||
echo $content;
|
echo $content;
|
||||||
} elseif ($this->cache instanceof Cache) {
|
} elseif ($this->cache instanceof Cache) {
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
array_pop($this->view->cacheStack);
|
array_pop($this->getView()->cacheStack);
|
||||||
if (is_array($this->dependency)) {
|
if (is_array($this->dependency)) {
|
||||||
$this->dependency = Yii::createObject($this->dependency);
|
$this->dependency = Yii::createObject($this->dependency);
|
||||||
}
|
}
|
||||||
$data = array($content, $this->dynamicPlaceholders);
|
$data = array($content, $this->dynamicPlaceholders);
|
||||||
$this->cache->set($this->calculateKey(), $data, $this->duration, $this->dependency);
|
$this->cache->set($this->calculateKey(), $data, $this->duration, $this->dependency);
|
||||||
|
|
||||||
if (empty($this->view->cacheStack) && !empty($this->dynamicPlaceholders)) {
|
if (empty($this->getView()->cacheStack) && !empty($this->dynamicPlaceholders)) {
|
||||||
$content = $this->updateDynamicContent($content, $this->dynamicPlaceholders);
|
$content = $this->updateDynamicContent($content, $this->dynamicPlaceholders);
|
||||||
}
|
}
|
||||||
echo $content;
|
echo $content;
|
||||||
@@ -133,12 +133,12 @@ class FragmentCache extends Widget
|
|||||||
if (is_array($data) && count($data) === 2) {
|
if (is_array($data) && count($data) === 2) {
|
||||||
list ($content, $placeholders) = $data;
|
list ($content, $placeholders) = $data;
|
||||||
if (is_array($placeholders) && count($placeholders) > 0) {
|
if (is_array($placeholders) && count($placeholders) > 0) {
|
||||||
if (empty($this->view->cacheStack)) {
|
if (empty($this->getView()->cacheStack)) {
|
||||||
// outermost cache: replace placeholder with dynamic content
|
// outermost cache: replace placeholder with dynamic content
|
||||||
$content = $this->updateDynamicContent($content, $placeholders);
|
$content = $this->updateDynamicContent($content, $placeholders);
|
||||||
}
|
}
|
||||||
foreach ($placeholders as $name => $statements) {
|
foreach ($placeholders as $name => $statements) {
|
||||||
$this->view->addDynamicPlaceholder($name, $statements);
|
$this->getView()->addDynamicPlaceholder($name, $statements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_content = $content;
|
$this->_content = $content;
|
||||||
@@ -151,7 +151,7 @@ class FragmentCache extends Widget
|
|||||||
protected function updateDynamicContent($content, $placeholders)
|
protected function updateDynamicContent($content, $placeholders)
|
||||||
{
|
{
|
||||||
foreach ($placeholders as $name => $statements) {
|
foreach ($placeholders as $name => $statements) {
|
||||||
$placeholders[$name] = $this->view->evaluateDynamicContent($statements);
|
$placeholders[$name] = $this->getView()->evaluateDynamicContent($statements);
|
||||||
}
|
}
|
||||||
return strtr($content, $placeholders);
|
return strtr($content, $placeholders);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user