summaryrefslogtreecommitdiff
path: root/it_text.class
diff options
context:
space:
mode:
authorChristian Schneider2011-09-14 15:45:39 +0000
committerChristian Schneider2011-09-14 15:45:39 +0000
commit7e38669f2aa8f10819551ea90e0c9a7ac4970072 (patch)
tree3c269ba5f5ded3e26bec425cf10ef5d027f9eb7b /it_text.class
parenteeb26db00c41f8aae3c96404a898cd2ae4a317ee (diff)
downloaditools-7e38669f2aa8f10819551ea90e0c9a7ac4970072.tar.gz
itools-7e38669f2aa8f10819551ea90e0c9a7ac4970072.tar.bz2
itools-7e38669f2aa8f10819551ea90e0c9a7ac4970072.zip
ITools-stylify transmogrify code
Diffstat (limited to 'it_text.class')
-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;