summaryrefslogtreecommitdiff
path: root/lib/smarty3/plugins/modifier.regex_replace.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/smarty3/plugins/modifier.regex_replace.php')
-rw-r--r--lib/smarty3/plugins/modifier.regex_replace.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/smarty3/plugins/modifier.regex_replace.php b/lib/smarty3/plugins/modifier.regex_replace.php
index 85f41fd..7eb5506 100644
--- a/lib/smarty3/plugins/modifier.regex_replace.php
+++ b/lib/smarty3/plugins/modifier.regex_replace.php
@@ -5,16 +5,15 @@
* @package Smarty
* @subpackage PluginsModifier
*/
-
/**
* Smarty regex_replace modifier plugin
- * Type: modifier<br>
- * Name: regex_replace<br>
+ * Type: modifier
+ * Name: regex_replace
* Purpose: regular expression search/replace
*
- * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
* regex_replace (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Monte Ohrt <monte at ohrt dot com>
*
* @param string $string input string
* @param string|array $search regular expression(s) to search for
@@ -23,7 +22,7 @@
*
* @return string
*/
-function smarty_modifier_regex_replace($string, $search, $replace, $limit = - 1)
+function smarty_modifier_regex_replace($string, $search, $replace, $limit = -1)
{
if (is_array($search)) {
foreach ($search as $idx => $s) {
@@ -32,7 +31,6 @@ function smarty_modifier_regex_replace($string, $search, $replace, $limit = - 1)
} else {
$search = _smarty_regex_replace_check($search);
}
-
return preg_replace($search, $replace, $string, $limit);
}
@@ -51,8 +49,7 @@ function _smarty_regex_replace_check($search)
}
// remove eval-modifier from $search
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[ 1 ], 'e') !== false)) {
- $search = substr($search, 0, - strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]);
+ $search = substr($search, 0, -strlen($match[ 1 ])) . preg_replace('![e\s]+!', '', $match[ 1 ]);
}
-
return $search;
}