From: Michael J. Rubinsky Date: Sat, 11 Sep 2010 15:04:56 +0000 (-0400) Subject: Allow embedding template tags within tags. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f728e1d7c7eae42bb58587d14e6369c746d896e2;p=horde.git Allow embedding template tags within tags. Need to eval() the gettext string independently so we don't get embedded blocks inside the _() function call. We really need to deprecate Horde/Template... --- diff --git a/framework/Template/lib/Horde/Template.php b/framework/Template/lib/Horde/Template.php index abb616901..b07829ec3 100644 --- a/framework/Template/lib/Horde/Template.php +++ b/framework/Template/lib/Horde/Template.php @@ -314,8 +314,13 @@ class Horde_Template if (preg_match_all("/(.+?)<\/gettext>/s", $this->_template, $matches, PREG_SET_ORDER)) { $replace = array(); foreach ($matches as $val) { - $replace[$val[0]] = ''; + // eval gettext independently so we can embed tempate tags + $code = 'echo _(\'' . str_replace("'", "\\'", $val[1]) . '\');'; + ob_start(); + eval($code); + $replace[$val[0]] = ob_get_clean(); } + $this->_doReplace($replace); } }