|
|
@ -98,17 +98,18 @@ class FragmentCache extends Widget |
|
|
|
* Content displayed before this method call and after [[init()]] |
|
|
|
* Content displayed before this method call and after [[init()]] |
|
|
|
* will be captured and saved in cache. |
|
|
|
* will be captured and saved in cache. |
|
|
|
* This method does nothing if valid content is already found in cache. |
|
|
|
* This method does nothing if valid content is already found in cache. |
|
|
|
|
|
|
|
* @return string the result of widget execution to be outputted. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public function run() |
|
|
|
public function run() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (($content = $this->getCachedContent()) !== false) { |
|
|
|
if (($content = $this->getCachedContent()) !== false) { |
|
|
|
echo $content; |
|
|
|
return $content; |
|
|
|
} elseif ($this->cache instanceof Cache) { |
|
|
|
} elseif ($this->cache instanceof Cache) { |
|
|
|
array_pop($this->getView()->cacheStack); |
|
|
|
array_pop($this->getView()->cacheStack); |
|
|
|
|
|
|
|
|
|
|
|
$content = ob_get_clean(); |
|
|
|
$content = ob_get_clean(); |
|
|
|
if ($content === false || $content === '') { |
|
|
|
if ($content === false || $content === '') { |
|
|
|
return; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
} |
|
|
|
if (is_array($this->dependency)) { |
|
|
|
if (is_array($this->dependency)) { |
|
|
|
$this->dependency = Yii::createObject($this->dependency); |
|
|
|
$this->dependency = Yii::createObject($this->dependency); |
|
|
@ -119,8 +120,9 @@ class FragmentCache extends Widget |
|
|
|
if (empty($this->getView()->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; |
|
|
|
return $content; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|