mirror of
https://github.com/smarty-php/smarty.git
synced 2025-12-14 09:38:26 +01:00
- update for PHP 5.4 compatibility
- reformat source to PSR-2 standard
This commit is contained in:
@@ -15,12 +15,14 @@
|
||||
* @return array sequence of unicodes
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_mb_to_unicode($string, $encoding=null) {
|
||||
function smarty_mb_to_unicode($string, $encoding=null)
|
||||
{
|
||||
if ($encoding) {
|
||||
$expanded = mb_convert_encoding($string, "UTF-32BE", $encoding);
|
||||
} else {
|
||||
$expanded = mb_convert_encoding($string, "UTF-32BE");
|
||||
}
|
||||
|
||||
return unpack("N*", $expanded);
|
||||
}
|
||||
|
||||
@@ -33,16 +35,16 @@ function smarty_mb_to_unicode($string, $encoding=null) {
|
||||
* @return string unicode as character sequence in given $encoding
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
function smarty_mb_from_unicode($unicode, $encoding=null) {
|
||||
function smarty_mb_from_unicode($unicode, $encoding=null)
|
||||
{
|
||||
$t = '';
|
||||
if (!$encoding) {
|
||||
$encoding = mb_internal_encoding();
|
||||
}
|
||||
foreach((array) $unicode as $utf32be) {
|
||||
foreach ((array) $unicode as $utf32be) {
|
||||
$character = pack("N*", $utf32be);
|
||||
$t .= mb_convert_encoding($character, $encoding, "UTF-32BE");
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user