summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_text.class8
1 files changed, 4 insertions, 4 deletions
diff --git a/it_text.class b/it_text.class
index 3264169..edfdd43 100644
--- a/it_text.class
+++ b/it_text.class
@@ -218,11 +218,9 @@ function set($label, $text = null, $language = null)
*/
function transmogrify($text, $values = null)
{
- foreach (preg_split('/{([\w.]+)}/', $text, -1, PREG_SPLIT_DELIM_CAPTURE) as $idx => $part)
+ foreach (preg_split('/{([\w.]+)}/', $text, -1, PREG_SPLIT_DELIM_CAPTURE) as $i => $part)
{
- if ($idx % 2 == 0) # even offsets are between delimiters
- $result .= $part;
- else
+ if ($i % 2) # odd offsets are delimiters, i.e. braces to be replaced
{
$value = $values ? $values : $GLOBALS;
foreach (explode(".", $part) as $key)
@@ -235,6 +233,8 @@ function transmogrify($text, $values = null)
$result .= $value;
}
+ else
+ $result .= $part;
}
return $result;