summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorvlakoff <vlakoff@gmail.com>2014-05-20 10:32:44 +0200
committervlakoff <vlakoff@gmail.com>2014-05-20 10:32:44 +0200
commit0f7eba2a0b276e7a23e442b7a9786e04622acbba (patch)
treebeb0b33c41cacd1f2f50af965552335eda2e2fe9 /system
parent2a8560c9c62c16a2f044f37bfd4adf152c191ee5 (diff)
Fix handling of {unwrap} tags in word_wrap() functions
* in Email library: these tags were not removed * in text helper: simplified code
Diffstat (limited to 'system')
-rw-r--r--system/helpers/text_helper.php7
-rw-r--r--system/libraries/Email.php4
2 files changed, 5 insertions, 6 deletions
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 7e15c1934..1d0605ddc 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -430,12 +430,12 @@ if ( ! function_exists('word_wrap'))
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
- if (preg_match_all('|(\{unwrap\}.+?\{/unwrap\})|s', $str, $matches))
+ if (preg_match_all('|\{unwrap\}(.+?)\{/unwrap\}|s', $str, $matches))
{
for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
{
$unwrap[] = $matches[1][$i];
- $str = str_replace($matches[1][$i], '{{unwrapped'.$i.'}}', $str);
+ $str = str_replace($matches[0][$i], '{{unwrapped'.$i.'}}', $str);
}
}
@@ -491,8 +491,7 @@ if ( ! function_exists('word_wrap'))
}
}
- // Remove the unwrap tags and return
- return str_replace(array('{unwrap}', '{/unwrap}'), '', $output);
+ return $output;
}
}
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 2595032c9..fc1bbe1b2 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1173,12 +1173,12 @@ class CI_Email {
// If the current word is surrounded by {unwrap} tags we'll
// strip the entire chunk and replace it with a marker.
$unwrap = array();
- if (preg_match_all('|(\{unwrap\}.+?\{/unwrap\})|s', $str, $matches))
+ if (preg_match_all('|\{unwrap\}(.+?)\{/unwrap\}|s', $str, $matches))
{
for ($i = 0, $c = count($matches[0]); $i < $c; $i++)
{
$unwrap[] = $matches[1][$i];
- $str = str_replace($matches[1][$i], '{{unwrapped'.$i.'}}', $str);
+ $str = str_replace($matches[0][$i], '{{unwrapped'.$i.'}}', $str);
}
}