Exemplo n.º 1
0
# some emoji (e-82C thru e-837 and others) use 2 codepoints in the
# unified mode, but just one in phone modes. test that it works as
# expected
#
$test_unified = "Hello " . utf8_bytes(0x36) . utf8_bytes(0x20e3);
$test_iphone = "Hello " . utf8_bytes(0xe221);
$test_docomo = "Hello " . utf8_bytes(0xe6e7);
$test_kddi = "Hello " . utf8_bytes(0xe527);
$test_google = "Hello " . utf8_bytes(0xfe833);
$test_html = "Hello <span class=\"emoji emoji3620e3\"></span>";
is(emoji_docomo_to_unified($test_docomo), $test_unified, "DoCoMo -> Unified");
is(emoji_kddi_to_unified($test_kddi), $test_unified, "KDDI -> Unified");
is(emoji_softbank_to_unified($test_iphone), $test_unified, "Softbank -> Unified");
is(emoji_google_to_unified($test_google), $test_unified, "Google -> Unified");
echo "#------------------\n";
is(emoji_unified_to_docomo($test_unified), $test_docomo, "Unified -> DoCoMo");
is(emoji_unified_to_kddi($test_unified), $test_kddi, "Unified -> KDDI");
is(emoji_unified_to_softbank($test_unified), $test_iphone, "Unified -> Softbank");
is(emoji_unified_to_google($test_unified), $test_google, "Unified -> Google");
echo "#------------------\n";
is(emoji_unified_to_html($test_unified), $test_html, "Unified -> HTML");
is(emoji_html_to_unified($test_html), $test_unified, "HTML -> Unified");
echo "#------------------\n";
#
# names are accessed by the unified codepoint (which makes it tricky for 2-codepoint unicode symbols)
#
is(emoji_get_name(utf8_bytes(0x2600)), 'BLACK SUN WITH RAYS', "name U+2600");
is(emoji_get_name(utf8_bytes(0x26ea)), 'CHURCH', "name U+26EA");
is(emoji_get_name(utf8_bytes(0x1f480)), 'SKULL', "name U+1F480");
is(emoji_get_name(utf8_bytes(0x1f450)), 'OPEN HANDS SIGN', "name U+1F450");
is(emoji_get_name(utf8_bytes(0x1f52b)), 'PISTOL', "name U+1F52B");
Exemplo n.º 2
0
//foreach($mgcints as $mgcint){
//	$mgc = substr($content,$mgcint[0], $mgcint[1]);
//	$mgcarr[] = $mgc;
//	$restr .= '**';
//}
//$content = str_replace($mgcarr, $restr, $content);
if (!empty($action)) {
    if ($action == 'p') {
        if (empty($uid)) {
            //判断设备唯一id是否存在
            json('no', '缺少参数', '');
        }
        if ($picnum < 1) {
            //没有发布图片
            if (!empty($content)) {
                $insert = array("content" => emoji_unified_to_docomo($content), "jwd" => $jwd, "pic" => '[]', 'time' => time(), 'is_del' => 1, "umd5" => $user);
                $res = $db->row_insert('gushi', $insert);
                if ($res) {
                    send_txt('*****************************', 'http://180.153.40.16:600/zaina/cron/delgushi.php?id=' . $db->insert_id());
                    json('yes', '发布成功', '');
                }
            } else {
                json('no', '参数不能为空', '');
            }
        } else {
            //有发布的图片信息
            for ($i = 0; $i < $picnum; $i++) {
                //判断是否是从客户端上传的图片
                if (is_uploaded_file($_FILES['pic' . $i]['tmp_name'])) {
                    $file = $_FILES['pic' . $i];
                    $name = $file['name'];