diff options
author | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2018-10-18 02:40:38 +0200 |
commit | eab8a101e7a3fcbb41e01a574985e06c5a3775de (patch) | |
tree | 60f201da5984b0c3638d10da02bba42b61aa3177 /lib/smarty3/sysplugins/smarty_internal_runtime_capture.php | |
parent | 7f38be342c1495aeca418286c15c25c18ac9e142 (diff) |
Updating Smarty
Diffstat (limited to 'lib/smarty3/sysplugins/smarty_internal_runtime_capture.php')
-rw-r--r-- | lib/smarty3/sysplugins/smarty_internal_runtime_capture.php | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/lib/smarty3/sysplugins/smarty_internal_runtime_capture.php b/lib/smarty3/sysplugins/smarty_internal_runtime_capture.php index 69f1ce0..c9dca83 100644 --- a/lib/smarty3/sysplugins/smarty_internal_runtime_capture.php +++ b/lib/smarty3/sysplugins/smarty_internal_runtime_capture.php @@ -64,8 +64,12 @@ class Smarty_Internal_Runtime_Capture if (!$this->isRegistered) { $this->register($_template); } - $this->captureStack[] = array($buffer, $assign, $append); - $this->captureCount ++; + $this->captureStack[] = array( + $buffer, + $assign, + $append + ); + $this->captureCount++; ob_start(); } @@ -76,8 +80,14 @@ class Smarty_Internal_Runtime_Capture */ private function register(Smarty_Internal_Template $_template) { - $_template->startRenderCallbacks[] = array($this, 'startRender'); - $_template->endRenderCallbacks[] = array($this, 'endRender'); + $_template->startRenderCallbacks[] = array( + $this, + 'startRender' + ); + $_template->endRenderCallbacks[] = array( + $this, + 'endRender' + ); $this->startRender($_template); $this->isRegistered = true; } @@ -104,7 +114,7 @@ class Smarty_Internal_Runtime_Capture { if ($this->captureCount) { list($buffer, $assign, $append) = array_pop($this->captureStack); - $this->captureCount --; + $this->captureCount--; if (isset($assign)) { $_template->assign($assign, ob_get_contents()); } @@ -126,20 +136,24 @@ class Smarty_Internal_Runtime_Capture */ public function error(Smarty_Internal_Template $_template) { - throw new SmartyException("Not matching {capture}{/capture} in \"{$_template->template_resource}\""); + throw new SmartyException("Not matching {capture}{/capture} in '{$_template->template_resource}'"); } /** - * Return content of named capture buffer + * Return content of named capture buffer by key or as array * * @param \Smarty_Internal_Template $_template - * @param $name + * @param string|null $name * - * @return null + * @return string|string[]|null */ - public function getBuffer(Smarty_Internal_Template $_template, $name) + public function getBuffer(Smarty_Internal_Template $_template, $name = null) { - return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null; + if (isset($name)) { + return isset($this->namedBuffer[ $name ]) ? $this->namedBuffer[ $name ] : null; + } else { + return $this->namedBuffer; + } } /** @@ -157,5 +171,4 @@ class Smarty_Internal_Runtime_Capture $this->captureCount = array_pop($this->countStack); } } - -}
\ No newline at end of file +} |