@@ -40,6 +40,9 @@ |
||
40 | 40 | return mb_convert_encoding('&#' . intval($u) . ';', 'UTF-8', 'HTML-ENTITIES'); |
41 | 41 | } |
42 | 42 | |
43 | + /** |
|
44 | + * @param string $data |
|
45 | + */ |
|
43 | 46 | static private function uniChrCode($data) { |
44 | 47 | list(, $ord) = unpack('N', mb_convert_encoding($data, 'UCS-4BE', 'UTF-8')); |
45 | 48 | return $ord; |
@@ -46,7 +46,9 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | static public function textWithEmoji($data) { |
49 | - if($data=="") return false; |
|
49 | + if($data=="") { |
|
50 | + return false; |
|
51 | + } |
|
50 | 52 | |
51 | 53 | $data = LaravelEmoji::covertEmojiToName($data); |
52 | 54 | $data = LaravelEmoji::covertNameToEmoji($data); |
@@ -72,8 +74,7 @@ discard block |
||
72 | 74 | $CPString .= ' imgFront'. strtolower(dechex(0x10000 + (($haut - 0xD800) << 10) + ($charCode - 0xDC00))) . 'imgBack '; |
73 | 75 | $haut = 0; |
74 | 76 | continue; |
75 | - } |
|
76 | - else { |
|
77 | + } else { |
|
77 | 78 | $CPString .= 'Error2' . strtolower(dechex($haut)) . '!'; |
78 | 79 | $haut = 0; |
79 | 80 | } |
@@ -81,12 +82,10 @@ discard block |
||
81 | 82 | |
82 | 83 | if (0xD800 <= $charCode && $charCode <= 0xDBFF) { |
83 | 84 | $haut = $charCode; |
84 | - } |
|
85 | - else { |
|
85 | + } else { |
|
86 | 86 | $CPString .= ' imgFront'. strtolower(dechex($charCode)) . 'imgBack '; |
87 | 87 | } |
88 | - } |
|
89 | - else { |
|
88 | + } else { |
|
90 | 89 | $CPString .= LaravelEmoji::uniChr($charCode); |
91 | 90 | } |
92 | 91 | } |
@@ -8,9 +8,9 @@ |
||
8 | 8 | |
9 | 9 | static public function covertEmojiToName($data) { |
10 | 10 | $data = emoji_docomo_to_unified($data); # DoCoMo devices |
11 | - $data = emoji_kddi_to_unified($data); # KDDI & Au devices |
|
12 | - $data = emoji_softbank_to_unified($data); # Softbank & (iPhone) Apple devices |
|
13 | - $data = emoji_google_to_unified($data); # Google Android devices |
|
11 | + $data = emoji_kddi_to_unified($data); # KDDI & Au devices |
|
12 | + $data = emoji_softbank_to_unified($data); # Softbank & (iPhone) Apple devices |
|
13 | + $data = emoji_google_to_unified($data); # Google Android devices |
|
14 | 14 | $data = emoji_unified_to_name($data); |
15 | 15 | $data = emoji_unified_to_key($data); |
16 | 16 | return $data; |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | class LaravelEmoji extends Controller { |
8 | 8 | |
9 | 9 | static public function covertEmojiToName($data) { |
10 | - $data = emoji_docomo_to_unified($data); # DoCoMo devices |
|
11 | - $data = emoji_kddi_to_unified($data); # KDDI & Au devices |
|
10 | + $data = emoji_docomo_to_unified($data); # DoCoMo devices |
|
11 | + $data = emoji_kddi_to_unified($data); # KDDI & Au devices |
|
12 | 12 | $data = emoji_softbank_to_unified($data); # Softbank & (iPhone) Apple devices |
13 | - $data = emoji_google_to_unified($data); # Google Android devices |
|
13 | + $data = emoji_google_to_unified($data); # Google Android devices |
|
14 | 14 | $data = emoji_unified_to_name($data); |
15 | 15 | $data = emoji_unified_to_key($data); |
16 | 16 | return $data; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | static public function textWithEmoji($data) { |
49 | - if($data=="") return false; |
|
49 | + if ($data == "") return false; |
|
50 | 50 | |
51 | 51 | $data = LaravelEmoji::covertEmojiToName($data); |
52 | 52 | $data = LaravelEmoji::covertNameToEmoji($data); |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | $n = 0; |
57 | 57 | |
58 | 58 | $strLen = mb_strlen($data, 'UTF-8'); |
59 | - for($i=0; $i<$strLen; $i++) { |
|
59 | + for ($i = 0; $i < $strLen; $i++) { |
|
60 | 60 | $char = mb_substr($data, $i, 1, 'UTF-8'); |
61 | 61 | $charCode = LaravelEmoji::uniChrCode($char); |
62 | 62 | |
63 | - if($charCode>1000) { |
|
63 | + if ($charCode > 1000) { |
|
64 | 64 | |
65 | 65 | if ($haut != 0) { |
66 | - if (0xDC00 <= $charCode&& $charCode<= 0xDFFF) { |
|
67 | - $CPString .= ' imgFront'. strtolower(dechex(0x10000 + (($haut - 0xD800) << 10) + ($charCode - 0xDC00))) . 'imgBack '; |
|
66 | + if (0xDC00 <= $charCode && $charCode <= 0xDFFF) { |
|
67 | + $CPString .= ' imgFront' . strtolower(dechex(0x10000 + (($haut - 0xD800) << 10) + ($charCode - 0xDC00))) . 'imgBack '; |
|
68 | 68 | $haut = 0; |
69 | 69 | continue; |
70 | 70 | } |
71 | 71 | else { |
72 | - $CPString .= 'Error2' . strtolower(dechex($haut)) . '!'; |
|
72 | + $CPString .= 'Error2' . strtolower(dechex($haut)) . '!'; |
|
73 | 73 | $haut = 0; |
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - if (0xD800 <= $charCode && $charCode <= 0xDBFF) { |
|
77 | + if (0xD800 <= $charCode && $charCode <= 0xDBFF) { |
|
78 | 78 | $haut = $charCode; |
79 | 79 | } |
80 | 80 | else { |
81 | - $CPString .= ' imgFront'. strtolower(dechex($charCode)) . 'imgBack '; |
|
81 | + $CPString .= ' imgFront' . strtolower(dechex($charCode)) . 'imgBack '; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | else { |
@@ -6,23 +6,23 @@ |
||
6 | 6 | |
7 | 7 | class LaravelEmojiServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the application services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
9 | + /** |
|
10 | + * Bootstrap the application services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | 16 | // |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - /** |
|
20 | - * Register the application services. |
|
21 | - * |
|
22 | - * @return void |
|
23 | - */ |
|
24 | - public function register() |
|
25 | - { |
|
26 | - // |
|
27 | - } |
|
19 | + /** |
|
20 | + * Register the application services. |
|
21 | + * |
|
22 | + * @return void |
|
23 | + */ |
|
24 | + public function register() |
|
25 | + { |
|
26 | + // |
|
27 | + } |
|
28 | 28 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | # WARNING: |
5 | 5 | # This code is auto-generated. Do not modify it manually. |
6 | 6 | # |
7 | - $GLOBALS['emoji_maps'] = array( |
|
7 | + $GLOBALS['emoji_maps'] = array( |
|
8 | 8 | 'name_to_unified' => array( |
9 | 9 | '[BLACK SUN WITH RAYS]'=> "\xe2\x98\x80", |
10 | 10 | '[CLOUD]'=> "\xe2\x98\x81", |
@@ -3509,24 +3509,24 @@ discard block |
||
3509 | 3509 | # functions to convert incoming data into the unified format |
3510 | 3510 | # |
3511 | 3511 | |
3512 | - function emoji_docomo_to_unified( $text){ return emoji_convert($text, 'docomo_to_unified'); } |
|
3513 | - function emoji_kddi_to_unified( $text){ return emoji_convert($text, 'kddi_to_unified'); } |
|
3514 | - function emoji_softbank_to_unified( $text){ return emoji_convert($text, 'softbank_to_unified'); } |
|
3515 | - function emoji_google_to_unified( $text){ return emoji_convert($text, 'google_to_unified'); } |
|
3512 | + function emoji_docomo_to_unified($text) { return emoji_convert($text, 'docomo_to_unified'); } |
|
3513 | + function emoji_kddi_to_unified($text) { return emoji_convert($text, 'kddi_to_unified'); } |
|
3514 | + function emoji_softbank_to_unified($text) { return emoji_convert($text, 'softbank_to_unified'); } |
|
3515 | + function emoji_google_to_unified($text) { return emoji_convert($text, 'google_to_unified'); } |
|
3516 | 3516 | |
3517 | 3517 | |
3518 | 3518 | # |
3519 | 3519 | # functions to convert unified data into an outgoing format |
3520 | 3520 | # |
3521 | 3521 | |
3522 | - function emoji_unified_to_docomo( $text){ return emoji_convert($text, 'unified_to_docomo'); } |
|
3523 | - function emoji_unified_to_kddi( $text){ return emoji_convert($text, 'unified_to_kddi'); } |
|
3524 | - function emoji_unified_to_softbank( $text){ return emoji_convert($text, 'unified_to_softbank'); } |
|
3525 | - function emoji_unified_to_google( $text){ return emoji_convert($text, 'unified_to_google'); } |
|
3526 | - function emoji_unified_to_html( $text){ return emoji_convert($text, 'unified_to_html'); } |
|
3527 | - function emoji_html_to_unified( $text){ return emoji_convert($text, 'html_to_unified');} |
|
3528 | - function emoji_unified_to_name($text) {return emoji_convert($text, 'unified_to_name'); } |
|
3529 | - function emoji_name_to_unified($text) {return emoji_convert($text, 'name_to_unified');} |
|
3522 | + function emoji_unified_to_docomo($text) { return emoji_convert($text, 'unified_to_docomo'); } |
|
3523 | + function emoji_unified_to_kddi($text) { return emoji_convert($text, 'unified_to_kddi'); } |
|
3524 | + function emoji_unified_to_softbank($text) { return emoji_convert($text, 'unified_to_softbank'); } |
|
3525 | + function emoji_unified_to_google($text) { return emoji_convert($text, 'unified_to_google'); } |
|
3526 | + function emoji_unified_to_html($text) { return emoji_convert($text, 'unified_to_html'); } |
|
3527 | + function emoji_html_to_unified($text) { return emoji_convert($text, 'html_to_unified'); } |
|
3528 | + function emoji_unified_to_name($text) {return emoji_convert($text, 'unified_to_name'); } |
|
3529 | + function emoji_name_to_unified($text) {return emoji_convert($text, 'name_to_unified'); } |
|
3530 | 3530 | function emoji_name_to_empty($text) { |
3531 | 3531 | return str_replace(array_keys($GLOBALS['emoji_maps']['name_to_unified']), '', $text); |
3532 | 3532 | } |
@@ -3535,11 +3535,11 @@ discard block |
||
3535 | 3535 | } |
3536 | 3536 | |
3537 | 3537 | |
3538 | - function emoji_convert($text, $map){ |
|
3538 | + function emoji_convert($text, $map) { |
|
3539 | 3539 | return str_replace(array_keys($GLOBALS['emoji_maps'][$map]), $GLOBALS['emoji_maps'][$map], $text); |
3540 | 3540 | } |
3541 | 3541 | |
3542 | - function emoji_get_name($unified_cp){ |
|
3542 | + function emoji_get_name($unified_cp) { |
|
3543 | 3543 | return $GLOBALS['emoji_maps']['names'][$unified_cp] ? $GLOBALS['emoji_maps']['names'][$unified_cp] : '?'; |
3544 | 3544 | } |
3545 | 3545 |