Browse Source

Renamed view to getView().

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
60abeb0d8f
  1. 12
      framework/yii/widgets/FragmentCache.php

12
framework/yii/widgets/FragmentCache.php

@ -82,7 +82,7 @@ class FragmentCache extends Widget
}
if ($this->getCachedContent() === false) {
$this->view->cacheStack[] = $this;
$this->getView()->cacheStack[] = $this;
ob_start();
ob_implicit_flush(false);
}
@ -100,14 +100,14 @@ class FragmentCache extends Widget
echo $content;
} elseif ($this->cache instanceof Cache) {
$content = ob_get_clean();
array_pop($this->view->cacheStack);
array_pop($this->getView()->cacheStack);
if (is_array($this->dependency)) {
$this->dependency = Yii::createObject($this->dependency);
}
$data = array($content, $this->dynamicPlaceholders);
$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);
}
echo $content;
@ -133,12 +133,12 @@ class FragmentCache extends Widget
if (is_array($data) && count($data) === 2) {
list ($content, $placeholders) = $data;
if (is_array($placeholders) && count($placeholders) > 0) {
if (empty($this->view->cacheStack)) {
if (empty($this->getView()->cacheStack)) {
// outermost cache: replace placeholder with dynamic content
$content = $this->updateDynamicContent($content, $placeholders);
}
foreach ($placeholders as $name => $statements) {
$this->view->addDynamicPlaceholder($name, $statements);
$this->getView()->addDynamicPlaceholder($name, $statements);
}
}
$this->_content = $content;
@ -151,7 +151,7 @@ class FragmentCache extends Widget
protected function updateDynamicContent($content, $placeholders)
{
foreach ($placeholders as $name => $statements) {
$placeholders[$name] = $this->view->evaluateDynamicContent($statements);
$placeholders[$name] = $this->getView()->evaluateDynamicContent($statements);
}
return strtr($content, $placeholders);
}

Loading…
Cancel
Save