Commit 60abeb0d by Qiang Xue

Renamed view to getView().

parent 4ef19b2e
...@@ -82,7 +82,7 @@ class FragmentCache extends Widget ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment