Changeset 4094
- Timestamp:
- Sep 18, 2007, 11:51:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OpenPNE/branches/work/tsubasa/prj_cmd/setup/script/option-convert_ktai_emoji.php
r4028 r4094 108 108 if ($input_dir !== false && $output_dir !== false) { 109 109 while (($file = readdir($input_dir)) !== false) { 110 // var_dump($file);111 110 if (array_pop(explode('.', $file)) == 'gif') { 112 $code = hexdec('0x' . basename($file, '.gif')); 113 if ((0xF741 <= $code) && ($code <= 0xF77E) || 114 (0xF780 <= $code) && ($code <= 0xF79B) || 115 (0xF7A1 <= $code) && ($code <= 0xF7F3) || 116 (0xF941 <= $code) && ($code <= 0xF97E) || 117 (0xF980 <= $code) && ($code <= 0xF99B) || 118 (0xF9A1 <= $code) && ($code <= 0xF9ED) || 119 (0xFB41 <= $code) && ($coce <= 0xFB7E) || 120 (0xFB80 <= $code) && ($code <= 0xFB8D) || 121 (0xFBA1 <= $code) && ($code <= 0xFBD7)) { 122 $emoji_bin = pack("C*" , $code >> 8 , $code % 256);//±±ªìêêΨ¯[; 123 } 124 $emoji_num = str_replace('%', '', emoji_escape_sb($emoji_bin)); 125 if (!empty($emoji_num)){ 111 $emoji_num = get_s_emoji_number(basename($file,'.gif')); 112 if ($emoji_num != 0){ 126 113 $input_emoji = $input_path . $file; 127 $output_emoji = $output_path . $emoji_num . '.gif';114 $output_emoji = $output_path . 's' . $emoji_num . '.gif'; 128 115 copy($input_emoji,$output_emoji); 129 116 } … … 132 119 } 133 120 } 121 function get_s_emoji_number($file_basename) 122 { 123 $pattern_g = "/G[0-9a-z]+/"; 124 $pattern_e = "/E[0-9a-z]+/"; 125 $pattern_f = "/F[0-9a-z]+/"; 126 $pattern_o = "/O[0-9a-z]+/"; 127 $pattern_p = "/P[0-9a-z]+/"; 128 $pattern_q = "/Q[0-9a-z]+/"; 129 130 $emoji_num = 0; 131 132 $pattern_num = "/[0-9a-z]+/"; 133 preg_match($pattern_num,$file_basename,$result); 134 135 if (preg_match($pattern_g,$file_basename)) { 136 $group = hexdec($result[0]) - 32; 137 }else if (preg_match($pattern_e,$file_basename)) { 138 $group = hexdec($result[0]) + 100 - 32; 139 }else if (preg_match($pattern_f,$file_basename)) { 140 $group = hexdec($result[0]) + 200 - 32; 141 }else if (preg_match($pattern_o,$file_basename)) { 142 $group = hexdec($result[0]) + 300 - 32; 143 }else if (preg_match($pattern_p,$file_basename)) { 144 $group = hexdec($result[0]) + 400 - 32; 145 }else if (preg_match($pattern_q,$file_basename)) { 146 $group = hexdec($result[0]) + 500 - 32; 147 } 148 149 return $group; 150 151 } 134 152 ?>
Note: See TracChangeset
for help on using the changeset viewer.