Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F886163
modifier.replace.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
modifier.replace.php
View Options
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty replace modifier plugin
*
* Type: modifier<br>
* Name: replace<br>
* Purpose: simple search/replace
*
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews
* @param string $
* @param string $
* @param string $
* @return string
*/
function
smarty_modifier_replace
(
$string
,
$search
,
$replace
)
{
if
(!
function_exists
(
"mb_str_replace"
))
{
// simulate the missing PHP mb_str_replace function
function
mb_str_replace
(
$needle
,
$replacement
,
$haystack
)
{
$needle_len
=
mb_strlen
(
$needle
);
$replacement_len
=
mb_strlen
(
$replacement
);
$pos
=
mb_strpos
(
$haystack
,
$needle
,
0
);
while
(
$pos
!==
false
)
{
$haystack
=
mb_substr
(
$haystack
,
0
,
$pos
)
.
$replacement
.
mb_substr
(
$haystack
,
$pos
+
$needle_len
);
$pos
=
mb_strpos
(
$haystack
,
$needle
,
$pos
+
$replacement_len
);
}
return
$haystack
;
}
}
if
(
function_exists
(
'mb_substr'
))
{
return
mb_str_replace
(
$search
,
$replace
,
$string
);
}
else
{
return
str_replace
(
$search
,
$replace
,
$string
);
}
}
?>
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 6, 23:03 (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25245
Default Alt Text
modifier.replace.php (1 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment