aboutsummaryrefslogtreecommitdiffstats
path: root/include/smarty/libs/plugins/shared.mb_str_replace.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-10 14:02:22 +0100
committerplegall <plg@piwigo.org>2015-12-10 14:02:22 +0100
commitfa10e0945ecd45bfe78a2c8fb015a43092b4944b (patch)
tree19cf59c08877e43325efbe9a2584114011a25522 /include/smarty/libs/plugins/shared.mb_str_replace.php
parent16f6a54fa719cc79ff942e4bb8139d7ca09ed997 (diff)
bug #385 update to smarty-3.1.28-dev (from Github)
Diffstat (limited to 'include/smarty/libs/plugins/shared.mb_str_replace.php')
-rw-r--r--include/smarty/libs/plugins/shared.mb_str_replace.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/include/smarty/libs/plugins/shared.mb_str_replace.php b/include/smarty/libs/plugins/shared.mb_str_replace.php
index ecafeb74a..a5682ed30 100644
--- a/include/smarty/libs/plugins/shared.mb_str_replace.php
+++ b/include/smarty/libs/plugins/shared.mb_str_replace.php
@@ -2,7 +2,7 @@
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
if (!function_exists('smarty_mb_str_replace')) {
@@ -10,14 +10,15 @@ if (!function_exists('smarty_mb_str_replace')) {
/**
* Multibyte string replace
*
- * @param string $search the string to be searched
- * @param string $replace the replacement string
- * @param string $subject the source string
- * @param int &$count number of matches found
+ * @param string $search the string to be searched
+ * @param string $replace the replacement string
+ * @param string $subject the source string
+ * @param int &$count number of matches found
+ *
* @return string replaced string
* @author Rodney Rehm
*/
- function smarty_mb_str_replace($search, $replace, $subject, &$count=0)
+ function smarty_mb_str_replace($search, $replace, $subject, &$count = 0)
{
if (!is_array($search) && is_array($replace)) {
return false;
@@ -25,7 +26,7 @@ if (!function_exists('smarty_mb_str_replace')) {
if (is_array($subject)) {
// call mb_replace for each single string in $subject
foreach ($subject as &$string) {
- $string = &smarty_mb_str_replace($search, $replace, $string, $c);
+ $string = & smarty_mb_str_replace($search, $replace, $string, $c);
$count += $c;
}
} elseif (is_array($search)) {
@@ -36,7 +37,7 @@ if (!function_exists('smarty_mb_str_replace')) {
}
} else {
$n = max(count($search), count($replace));
- while ($n--) {
+ while ($n --) {
$subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);
$count += $c;
next($search);
@@ -48,8 +49,7 @@ if (!function_exists('smarty_mb_str_replace')) {
$count = count($parts) - 1;
$subject = implode($replace, $parts);
}
+
return $subject;
}
-
}
-?> \ No newline at end of file