PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.1.4
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.1.4
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Helpers / global / utf8.php

utf8.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.1.4, at back/Helpers/global/utf8.php

59 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function acym_utf8Encode($string)
4 {
5 if (function_exists('mb_convert_encoding')) {
6 return mb_convert_encoding($string, 'UTF-8', 'ISO-8859-1');
7 } else {
8 $string .= $string;
9 $len = strlen($string);
10
11 for ($i = $len >> 1, $j = 0 ; $i < $len ; ++$i, ++$j) {
12 if ($string[$i] < "\x80") {
13 $string[$j] = $string[$i];
14 } elseif ($string[$i] < "\xC0") {
15 $string[$j] = "\xC2";
16 $string[++$j] = $string[$i];
17 } else {
18 $string[$j] = "\xC3";
19 $string[++$j] = chr(ord($string[$i]) - 64);
20 }
21 }
22
23 return substr($string, 0, $j);
24 }
25 }
26
27 function acym_utf8Decode($string)
28 {
29 if (function_exists('mb_convert_encoding')) {
30 return mb_convert_encoding($string, 'ISO-8859-1', 'UTF-8');
31 } else {
32 $newString = (string)$string;
33 $len = strlen($newString);
34
35 for ($i = 0, $j = 0 ; $i < $len ; ++$i, ++$j) {
36 switch ($newString[$i] & "\xF0") {
37 case "\xC0":
38 case "\xD0":
39 $c = (ord($newString[$i] & "\x1F") << 6) | ord($newString[++$i] & "\x3F");
40 $newString[$j] = $c < 256 ? chr($c) : '?';
41 break;
42
43 case "\xF0":
44 ++$i;
45
46 case "\xE0":
47 $newString[$j] = '?';
48 $i += 2;
49 break;
50
51 default:
52 $newString[$j] = $newString[$i];
53 }
54 }
55
56 return substr($newString, 0, $j);
57 }
58 }
59