From b3a302481d7627099c9d39e13ed964329fcb645c Mon Sep 17 00:00:00 2001 From: matthes Date: Wed, 25 Jul 2018 12:52:00 +0200 Subject: [PATCH] added {section} sections {/section} --- src/TextTemplate.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/TextTemplate.php b/src/TextTemplate.php index e901d09..1f44269 100644 --- a/src/TextTemplate.php +++ b/src/TextTemplate.php @@ -71,11 +71,13 @@ public function __construct ($text="") { * * @param $enableSectionMode */ - public function setSectionCallback(callable $sectionCallback) + public function setSectionCallback($sectionCallback) { + $this->sectionCallback = $sectionCallback; } + /** * Set the default Filter * @@ -499,7 +501,7 @@ private function _runSection(&$context, $content, $cmdParam, $softFail) } - private function _parseFunctionParameters (string $cmdParam, &$context, $softFail) + private function _parseFunctionParameters ($cmdParam, &$context, $softFail) { $paramArr = []; $cmdParamRest = preg_replace_callback('/(?[a-z0-9_]+)\s*=\s*(?((\"|\')(.*?)\4)|[a-z0-9\.\_]+)/i', function ($matches) use(&$paramArr, &$context, $softFail) { @@ -614,6 +616,10 @@ public function loadTemplate ($template) { return $this; } + public function setTemplate($text) + { + $this->mTemplateText = $text; + } /** * Parse Tokens in Text (Search for $(name.subname.subname)) of