function hasmemcache($mem) { global $wecha_id, $point; //从memcache服务器获取数据 $data = $mem->get(realpath("..") . $wecha_id); //判断memcache是否有数据 if (!$data) { require 'db.php'; include '../wall/biaoqing.php'; $sql = "SELECT * FROM `weixin_shake_toshake` WHERE wecha_id='{$wecha_id}'"; $query1 = mysql_query($sql, $link) or die(mysql_error()); $q = mysql_fetch_assoc($query1); if ($q) { $q['phone'] = pack('H*', $q['phone']); $q['phone'] = emoji_unified_to_html(emoji_softbank_to_unified($q['phone'])); $mem->set(realpath("..") . $q['wecha_id'], $q, MEMCACHE_COMPRESSED, 3600); } } $data = $mem->get(realpath("..") . $wecha_id); $start = realpath("..") . "UPDATE `weixin_wall_config` SET `isopen` = "; $key2 = substr(md5($start), 10, 8); $ispen = $mem->get($key2); if ($data) { $data['point'] = $point; $mem->set(realpath("..") . $wecha_id, $data, MEMCACHE_COMPRESSED, 3600); } else { $ispen = 3; } if (empty($ispen)) { $ispen = 1; } echo $ispen; $mem->close(); //关闭memcache连接 }
function __construct() { global $_W; $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'MicroMessenger') === true) { $openid = $_W['fans']['from_user']; if (empty($openid)) { $this->pub_fans = o2::getOuser(); if (empty($this->pub_fans['openid'])) { message('获取信息失败,请确保是认证服务号或者借用授权的AppId和AppSecret正确'); } $fans = pdo_fetch('SELECT * FROM' . tablename('fans') . " WHERE weid = :weid AND from_user = :from_user", array(':weid' => $_W['weid'], ':from_user' => $this->pub_fans['openid'])); $user = array('nickname' => emoji_unified_to_html($this->pub_fans['nickname']), 'gender' => $this->pub_fans['sex'], 'residecity' => $this->pub_fans['city'], 'resideprovince' => $this->pub_fans['province'], 'nationality' => $this->pub_fans['country'], 'avatar' => $this->pub_fans['headimgurl']); if (empty($fans)) { $user['createtime'] = TIMESTAMP; $user['weid'] = $_W['weid']; $user['from_user'] = $this->pub_fans['openid']; pdo_insert('fans', $user); } else { pdo_update('fans', $user, array('weid' => $_W['weid'], 'from_user' => $this->pub_fans['openid'])); } } else { $this->pub_fans = o2::getFans($openid); } } //print_r($this->pub_fans); //exit(); }
public function auth3($code) { $result = $this->get_access_token($code); if (!isset($result->errcode)) { $this->access_token = $result->access_token; $this->expires_in = $result->expires_in; $this->refresh_token = $result->refresh_token; $this->openid = $result->openid; $userInfo = $this->getUserInfo(); // 改变头像的分辨率 $userInfo->headimgurl = substr($userInfo->headimgurl, 0, strlen($userInfo->headimgurl) - 1) . '/96'; // 改变emoji表情编码 $userInfo->nickname = emoji_softbank_to_unified($userInfo->nickname); $userInfo->nickname_html = emoji_unified_to_html($userInfo->nickname); Session::put('userInfo', $userInfo); if ($userInfo->openid == 'oTIXKt2z1AAxHMxi8MHDaYP4GkzU') { return Redirect::to('http://wechat.100steps.net/healing2014/test/vote'); } else { // echo '治愈系工地施工中~'; return Redirect::to('http://wechat.100steps.net/healing2014/test/vote'); } } else { echo 'Invalid code!'; } }
function emoji_c($body) { $emoji_android = array("", "", "", "⛅", "", "", "", "❄", "", "", "", "", "", "⌚", "⌛", "✉", "", "", "", "", "", "", "✒", "✏", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); $emoji_ios = array("☺", "⭐", "☀", "⛅", "☁", "⚡", "☔", "❄", "⛄", "❤", "☝", "✌", "☎", "⌚", "⌛", "✉", "✂", "🀄", "⚽", "⚾", "⛳", "☕", "✒", "✏", "⛪", "⛺", "⛲", "⛵", "⛲", "✈", "⚠", "⛽", "♨", "⬆", "⬇", "⬅", "➡", "↗", "↖", "↘", "↙", "◀", "▶", "🈯", "🈚", "🅿", "♿", "㊙", "㊙", "✳", "✴", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "⭕", "〽", "♠", "♥", "♣", "♦"); $body = str_replace($emoji_android, $emoji_ios, $body); $body = str_replace($emoji_native, $emoji_bytes, $body); return emoji_unified_to_html($body); }
function printMessage($string) { $array = explode(" ", $string); $text = ""; foreach ($array as $word) { $text .= emoji_unified_to_html($word) . ' '; } return $text; }
private function Emojify($data) { $data = emoji_docomo_to_unified($data); # DoCoMo devices $data = emoji_kddi_to_unified($data); # KDDI & Au devices $data = emoji_softbank_to_unified($data); # Softbank & (iPhone) Apple devices $data = emoji_google_to_unified($data); # Google Android devices return emoji_unified_to_html($data); }
public static function removeEmoji($data) { require_once Application::getInstance()->getBasePath() . '/php-emoji/emoji.php'; $data = emoji_docomo_to_unified($data); # DoCoMo devices $data = emoji_kddi_to_unified($data); # KDDI & Au devices $data = emoji_softbank_to_unified($data); # Softbank & pre-iOS6 Apple devices $data = emoji_google_to_unified($data); # Google Android devices $data = emoji_unified_to_html($data); $data = preg_replace('/[^а-яa-z0-9 _\\-\\+\\&\\.\\,\\!@#\\$\\n\\t<>=\\/"\\(\\)\\*:]/ui', '', $data); return $data; }
function hasmemcache($mem) { global $wecha_id, $point; $sql = 'SELECT * FROM `weixin_shake_toshake`'; $memsql = realpath("..") . 'SELECT * FROM `weixin_shake_toshake`'; $key = substr(md5($memsql), 10, 8); //从memcache服务器获取数据 $data = $mem->get($key); //判断memcache是否有数据 if (!$data) { require 'db.php'; include '../wall/biaoqing.php'; $query1 = mysql_query($sql, $link) or die(mysql_error()); $i = 1; while ($q = mysql_fetch_assoc($query1)) { $q['phone'] = pack('H*', $q['phone']); $q['phone'] = emoji_unified_to_html(emoji_softbank_to_unified($q['phone'])); $data[$i] = $q; $mem->set('shakeu' . $q['wecha_id'], $i, MEMCACHE_COMPRESSED, 3600); $i++; } //向memcache服务器存储数据,还要设置失效时间(单位为秒) $mem->set($key, $data, MEMCACHE_COMPRESSED, 3600); } $start = realpath("..") . "UPDATE `weixin_wall_config` SET `isopen` = "; $key2 = substr(md5($start), 10, 8); $ispen = $mem->get($key2); $id = $mem->get(realpath("..") . 'shakeu' . $wecha_id); if ($id) { $data = $mem->get($key); if ($wecha_id == 'oNsvDt8r_t_Wxn0e6crbFuSPutXY') { $data[$id]['point'] = $point * 1.3; } else { $data[$id]['point'] = $point; } $mem->set($key, $data, MEMCACHE_COMPRESSED, 3600); } else { $ispen = 3; } if (empty($ispen)) { $ispen = 1; } echo $ispen; $mem->close(); //关闭memcache连接 }
function lurushake($wecha_id) { $sql_flg = "SELECT * FROM `weixin_flag` WHERE `openid` = '{$wecha_id}'"; $query_num = mysql_query($sql_flg); $q = mysql_fetch_row($query_num); $nicheng = $q[4]; $avatar = $q[5]; //实例化一个memcache对象 if (!empty($_SERVER['HTTP_APPNAME'])) { @($mem = memcache_init()); } else { if (class_exists("Memcache")) { @($mem = new Memcache()); @$mem->connect('localhost', '11211'); } } if (!empty($mem)) { include '../wall/biaoqing.php'; $shakeu = $mem->get(realpath("..") . 'shakeu' . $wecha_id); if (empty($shakeu)) { $memsql = realpath("..") . 'SELECT * FROM `weixin_shake_toshake`'; $key = substr(md5($memsql), 10, 8); //从memcache服务器获取数据 $data = $mem->get($key); $arrnum = count($data) + 1; $mem->set(realpath("..") . 'shakeu' . $wecha_id, $arrnum, MEMCACHE_COMPRESSED, 3600); $cachenick = pack('H*', $nicheng); $cachenick = emoji_unified_to_html(emoji_softbank_to_unified($cachenick)); $addarr = array('id' => 'new', 'phone' => $cachenick, 'wecha_id' => $wecha_id, 'point' => 0, 'avatar' => $avatar); array_push($data, $addarr); $mem->set($key, $data, MEMCACHE_COMPRESSED, 3600); } } $sql_shake = "replace `weixin_shake_toshake` (`wecha_id`,`phone`,`point`,`avatar`) VALUES ('{$wecha_id}','{$nicheng}','0','{$avatar}')"; mysql_query($sql_shake); $xuanze = "SELECT * FROM `weixin_flag` WHERE `openid` = '{$wecha_id}'"; $chaxun = mysql_query($xuanze) or die(mysql_error()); $q = mysql_fetch_array($chaxun); if ($q[nickname] == '') { return 1; } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>EMoji HTML Test</title> <link href="emoji.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="1"> <tr> <th>Unified</th> <th>Name</th> <th>Unified Text</th> <th>HTML</th> </tr> <?php foreach (array(0x2600, 0x1f493, 0x1f502) as $unified) { $bytes = "Hello " . emoji_utf8_bytes($unified) . " World"; echo "<tr>\n"; echo "<td>" . sprintf('U+%04X', $unified) . "</td>\n"; echo "<td>" . HtmlSpecialChars(emoji_get_name($unified)) . "</td>\n"; echo "<td>{$bytes}</td>\n"; echo "<td>" . emoji_unified_to_html($bytes) . "</td>\n"; echo "</tr>\n"; } ?> </table> </body> </html>
<?php foreach ($communicatee_ids as $communicatee_id) { $communicatee = \app\models\Muser::findOne(['id' => $communicatee_id]); ?> <li class="table-view-cell media"> <a data-ignore="push" class="navigate-right" href="<?php echo \yii\helpers\Url::to(['wechat-messaging', 'gh_id' => $wx_user->gh_id, 'openid' => $wx_user->openid, 'reciever_id' => $communicatee_id, 'backwards' => true]); ?> "> <img class="media-object pull-left" src="<?php echo $communicatee->headImgUrl; ?> " style="width:48px;"> <div class="media-body"> <?php echo emoji_unified_to_html(emoji_softbank_to_unified($communicatee->nickname)); ?> </div> </a> </li> <?php } ?> </ul> </div> </div> <!-- ######################BEGIN OF FOOTER###################### --> <div class="bar bar-tab">
if ($vote_cnt > 20) { break; } $friend = \app\models\MUser::findOne(['openid' => $tp_friend->vote_openid]); ?> <li class="table-view-cell media"> <img class="media-object pull-left" src="<?php echo $friend->headImgUrl; ?> " width="64" height="64"> <div class="media-body"> <!--粉丝昵称--> <?php echo emoji_unified_to_html(emoji_softbank_to_unified($friend->nickname)); ?> <p> 拆红包时间:<?php echo $tp_friend->vote_time; ?> </p> </div> </li> <?php } ?> </ul>
public function googleToHtml($sentence) { return emoji_unified_to_html(emoji_google_to_unified($sentence)); }
?> " alt="Emojis" height="18" width="19"></a> </div> <button class="btn btn-secondary" type="submit">Send</button> </form> <span id="bytes">0</span> bytes (<span id="transactions">1</span> transactions) <!-- Emojis --> <div id="emojisTable" class="emojisContainer"> <button type="button" class="close" aria-label="Close"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <div class="p-tr-25"> <?php foreach ($GLOBALS['emoji_maps']['names'] as $code => $text) { echo emoji_unified_to_html($code); } ?> </div> </div> </div> </div> </div> <?php require_once TEMPLATES_PATH . "/footer.php"; ?> <script> // Update the number of bytes when writting a new char $('#message').keyup(function(){ var bytes = getByteLen($('#message').val());
$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"); is(emoji_get_name(utf8_bytes(0x36) . utf8_bytes(0x20e3)), 'KEYCAP 6', "name U+36 U+20E3"); # # below here are the test helper functions # function is($got, $expected, $name)
$sp = "{call sys_get_loglist()}"; $rs = sp_execute($sp, null); // foreach ($rs as $row) { ?> <tr> <td><?php echo $row["logid"]; ?> </td> <td><?php echo $row["occdt"]; ?> </td> <td><?php echo emoji_unified_to_html($row["detail"]); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <div class="fc"></div> </div> <script src="js/jquery-1.11.1.min.js"></script> <script src="plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<?php /**This page wil return a json encoded list of instagram pictures containing username, profilepicture, text and the image (in standard resolution). Unless the user is blocked **/ require_once 'emoji/emoji.php'; require_once 'configuration.php'; require_once 'getBlocked.php'; $json = file_get_contents('https://api.instagram.com/v1/tags/' . $hashtag . '/media/recent?client_id=' . $instagram_client_id); $obj = json_decode($json, true); foreach ($obj['data'] as $instagram) { if (!isBlocked($instagram['user']['username'])) { $instagramList[] = array("user" => $instagram['user']['username'], "profile_picture" => $instagram['user']['profile_picture'], "text" => emoji_unified_to_html($instagram['caption']['text']), "image" => $instagram['images']['standard_resolution']['url']); if (sizeof($instagramList) == $maxAmount) { break; } } } echo json_encode($instagramList);
<div class="mqingshi-author-form"> <?php $form = ActiveForm::begin(); ?> <!-- <//?= $form->field($model, 'gh_id')->textInput(['maxlength' => 255]) ?> <//?= $form->field($model, 'author_openid')->textInput(['maxlength' => 255]) ?> --> <?php echo "<img width=48 src=" . $model->user->headimgurl . ">"; echo emoji_unified_to_html(emoji_softbank_to_unified($model->user->nickname)) . "<br>"; echo $model->create_time; ?> <!-- <//?= $form->field($model, 'p1')->textInput(['maxlength' => 64]) ?> <//?= $form->field($model, 'p2')->textInput(['maxlength' => 64]) ?> <//?= $form->field($model, 'p3')->textInput(['maxlength' => 64]) ?> --> <?php echo "<h2>情诗内容</h2><hr>"; echo "<h3>" . $model->p1 . "</h3>"; echo "<h3>" . $model->p2 . "</h3>";
function usemysql() { global $judge; require 'db.php'; include '../wall/biaoqing.php'; $judge = $_POST['judge']; $sql1 = "SELECT * FROM `weixin_shake_toshake` order by point desc"; $query1 = mysql_query($sql1, $link) or die(mysql_error()); while ($q = mysql_fetch_assoc($query1)) { $q['phone'] = pack('H*', $q['phone']); $q = emoji_unified_to_html(emoji_softbank_to_unified($q)); $arr_one[] = $q; } //var_dump( $arr_one[0]['phone']); if ($judge == 1) { $json_string = json_encode($arr_one); echo $json_string; } else { if ($judge == 2) { $num = count($arr_one); echo $num; } else { if ($judge == 3) { $start = "UPDATE `weixin_wall_config` SET `isopen` = '2'"; $query1 = mysql_query($start, $link) or die(mysql_error()); } else { if ($judge == 4) { $start = "UPDATE `weixin_wall_config` SET `isopen` = '1'"; $query1 = mysql_query($start, $link) or die(mysql_error()); } } } } }
private function packageInfo($o) { global $_W; if ($o['limit'] == 1) { $myname = '某人(' . substr($o['openid'], -4) . ")"; } else { $myname = $o['nickname']; } $islike = pdo_fetch('SELECT * FROM' . tablename($this->table_commentslike) . " WHERE uniacid = :uniacid AND openid = :openid AND swnoId = :swnoId", array(':uniacid' => $_W['uniacid'], ':openid' => $_W['fans']['from_user'], ':swnoId' => $o['id'])); $islike = $islike ? true : false; $likesum = pdo_fetchcolumn('SELECT COUNT(*) FROM' . tablename($this->table_commentslike) . " WHERE uniacid = :uniacid AND swnoId = :swnoId", array(':uniacid' => $_W['uniacid'], ':swnoId' => $o['id'])); $likesum = $likesum ? $likesum : null; $replysum = pdo_fetchcolumn('SELECT COUNT(*) AS sum FROM' . tablename($this->table_comments) . " WHERE uniacid = :uniacid AND parentid = :parentid", array(':uniacid' => $_W['uniacid'], ':parentid' => $o['id'])); $replysum = $replysum ? $replysum : 0; return array('swnoId' => $o['id'], 'toUser' => emoji_unified_to_html($o['toUser']), 'userId' => $o['openid'], 'userName' => $o['nickname'], 'fromUserName' => $o['nickname'], 'univId' => 0, 'univName' => $myname, 'content' => emoji_unified_to_html($o['content']), 'limit' => $o['limit'], 'nowColor' => $o['nowColor'], 'statusCode' => 0, 'swnoScore' => 0, 'createTime' => $o['createtime'], 'lastUpdTime' => $o['createtime'], 'praiseNum' => $likesum, 'commentNum' => $replysum, 'stickie' => 0, 'praised' => $islike, 'uniacid' => $o['uniacid']); }
<?php include '../models/utils/emoji.php'; ?> <div class="mhd201509t4-form"> <?php $form = ActiveForm::begin(); ?> <?php echo "<img width=81 src=" . $model->user->headimgurl . ">"; echo "<h3>" . emoji_unified_to_html(emoji_softbank_to_unified($model->user->nickname)) . "</h3><br>"; ?> <?php echo "<h3>捐献积分: " . $model->score . "</h3>"; echo "<h3>手机号码: " . $model->mobile . "</h3>"; echo "<h3>捐献时间: " . $model->create_time . "</h3>"; ?> <!-- <//?= $form->field($model, 'gh_id')->textInput(['maxlength' => 255]) ?> <//?= $form->field($model, 'openid')->textInput(['maxlength' => 255]) ?>
<br> <br> </div><!-- end of content --> <div class="bar bar-standard bar-footer"> <div class="content" style="font-size: 10px;color:#ccc;"> <center> <span><img style='width:18px;' src="<?php echo $wx_user->headimgurl; ?> "/> </span> <span><?php echo emoji_unified_to_html(emoji_softbank_to_unified($wx_user->nickname)); ?> </span> <span><?php echo $wx_user->getBindMobileNumbersStr(); ?> </span> <br> <span><?php echo $client->title_abbrev; ?> ©<?php echo date('Y'); ?> </span>
include_once '../../config.php'; //连接数据库 include '../biaoqing.php'; $action = $_GET['action']; if ($action == "reset") { $sqll = "update weixin_flag set status=2 where status=1"; $queryy = mysql_query($sqll); if ($queryy) { echo '2'; } } else { if ($action == "ready") { $data = mysql_query("select * from weixin_flag where (status=2 or status=3) and fakeid>0"); while ($row1 = mysql_fetch_array($data)) { $row1['nickname'] = pack('H*', $row1['nickname']); $row1 = emoji_unified_to_html(emoji_softbank_to_unified($row1)); $arr[] = array('id' => $row1['id'], 'avatar' => $row1['avatar'], 'nickname' => $row1['nickname']); } echo json_encode($arr); } else { if ($action == "ok") { //标识中奖号码 $id = $_POST['id']; $sql = "update weixin_flag set status=1,cjstatu=0 where id={$id}"; $query = mysql_query($sql); if ($xuanzezu[10]) { $query2 = mysql_query("select * from weixin_flag where id = {$id}"); $row2 = mysql_fetch_array($query2); include "../../moni/cj.php"; $contant = '恭喜恭喜!您已中奖,请按照主持人的提示,到指定地点领取您的奖品!您的获奖验证码是:【' . $row2['fakeid'] . '】'; sendmassage($token, $row2['fakeid'], $contant, $cookie, $cookies);
foreach ($claimed_giftboxes as $claimed_giftbox) { ?> <li class="table-view-cell media"> <a data-ignore='push' class="navigate-right" href="<?php echo Url::to(['yaoyiyao', 'giftbox_id' => $claimed_giftbox->id, 'gh_id' => $observer->gh_id, 'openid' => $observer->openid]); ?> "> <img class="media-object pull-left" src="<?php echo $claimed_giftbox->claimer->headImgUrl; ?> " width="64" height="64"> <div class="media-body"> <!--粉丝昵称--> <?php echo emoji_unified_to_html(emoji_softbank_to_unified($claimed_giftbox->claimer->nickname)); ?> <p> 抢礼盒时间:<?php echo date('Y-m-d H:i:s', $claimed_giftbox->claiming_time); ?> </p> </div> </a> </li> <?php } ?> </ul> </div>
</h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <!-- <p> <//?= Html::a('Create Mhd201509t4', ['create'], ['class' => 'btn btn-success']) ?> </p> --> <p> <?php echo Html::a('下载 <i class="glyphicon glyphicon-arrow-down"></i>', U::current(['download' => 1]), ['class' => 'btn btn-success', 'data-pjax' => '0']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['label' => '微信昵称', 'format' => 'html', 'value' => function ($model, $key, $index, $column) { $user = $model->user; return empty($user) ? '' : "<img width=48 src=" . $model->user->headimgurl . "><br>" . emoji_unified_to_html(emoji_softbank_to_unified($user->nickname)); }, 'filter' => false, 'headerOptions' => array('style' => 'width:90px;')], 'mobile', 'score', 'create_time', ['attribute' => 'status', 'label' => '状态', 'value' => function ($model, $key, $index, $column) { return MHd201509t4::gethd201509t4StatusOption($model->status); }, 'filter' => MHd201509t4::gethd201509t4StatusOption(), 'headerOptions' => array('style' => 'width:120px;')], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}', 'buttons' => ['update' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']); }]]]]); ?> </div>
function BK_emoji_decode($text) { return emoji_unified_to_html(emoji_softbank_to_unified($text)); }
if ($maxid <= $num) { if ($xuanzezu[22]) { for (; $q[0] == '';) { $conut = rand(1, $num - 1); $sql1 = "SELECT * FROM `weixin_wall` where `num` = '{$conut}' limit 1 "; $query1 = mysql_query($sql1, $link); $q = mysql_fetch_row($query1); $q[3] = $lastid; } } break; } } } $q[5] = pack('H*', $q[5]); $q = emoji_unified_to_html(emoji_softbank_to_unified($q)); $id = $q[0]; $fakeid = $q[2]; $num = $q[3]; $content = $q[4]; $content = biaoqing($content); $nickname = $q[5]; $avatar = $q[6]; $ret = $q[7]; $image = $q[9]; if ($q[3]) { @($msg = array(data => array(array("id" => $id, "fakeid" => $fakeid, "num" => $num, "content" => $content, "nickname" => $nickname, "avatar" => $avatar, "image" => $image)), ret => 1)); echo $msg = json_encode($msg); } if (!$q[3]) { @($msg = array(data => array(), ret => 0));
protected function getTwitterFeed($displayId = 0, $isPreview = true) { if (!extension_loaded('curl')) { trigger_error(__('cURL extension is required for Twitter')); return false; } // Do we need to add a geoCode? $geoCode = ''; $distance = $this->GetOption('tweetDistance'); if ($distance != 0) { // Use the display ID or the default. if ($displayId != 0) { // Look up the lat/long $display = new Display(); $display->displayId = $displayId; $display->Load(); $defaultLat = $display->latitude; $defaultLong = $display->longitude; } else { $defaultLat = Config::GetSetting('DEFAULT_LAT'); $defaultLong = Config::GetSetting('DEFAULT_LONG'); } // Built the geoCode string. $geoCode = implode(',', array($defaultLat, $defaultLong, $distance)) . 'mi'; } // Connect to twitter and get the twitter feed. $key = md5($this->GetOption('searchTerm') . $this->GetOption('resultType') . $this->GetOption('tweetCount', 15) . $geoCode); if (!Cache::has($key) || Cache::get($key) == '') { Debug::Audit('Querying API for ' . $this->GetOption('searchTerm')); // We need to search for it if (!($token = $this->getToken())) { return false; } // We have the token, make a tweet if (!($data = $this->searchApi($token, $this->GetOption('searchTerm'), $this->GetOption('resultType'), $geoCode, $this->GetOption('tweetCount', 15)))) { return false; } // Cache it Cache::put($key, $data, $this->GetSetting('cachePeriod')); } else { Debug::Audit('Served from Cache'); $data = Cache::get($key); } Debug::Audit(var_export(json_encode($data), true)); // Get the template $template = $this->GetRawNode('template'); // Parse the text template $matches = ''; preg_match_all('/\\[.*?\\]/', $template, $matches); // Build an array to return $return = array(); // Media Object to get profile images $media = new Media(); $layout = new Layout(); // Expiry time for any media that is downloaded $expires = time() + $this->GetSetting('cachePeriodImages') * 60 * 60; // Remove URL setting $removeUrls = $this->GetOption('removeUrls', 1); // If we have nothing to show, display a no tweets message. if (count($data->statuses) <= 0) { // Create ourselves an empty tweet so that the rest of the code can continue as normal $user = new stdClass(); $user->name = ''; $user->screen_name = ''; $user->profile_image_url = ''; $tweet = new stdClass(); $tweet->text = $this->GetOption('noTweetsMessage', __('There are no tweets to display')); $tweet->created_at = date("Y-m-d H:i:s"); $tweet->user = $user; // Append to our statuses $data->statuses[] = $tweet; } // This should return the formatted items. foreach ($data->statuses as $tweet) { // Substitute for all matches in the template $rowString = $template; foreach ($matches[0] as $sub) { // Always clear the stored template replacement $replace = ''; // Maybe make this more generic? switch ($sub) { case '[Tweet]': // Get the tweet text to operate on $tweetText = $tweet->text; // Replace URLs with their display_url before removal if (isset($tweet->entities->urls)) { foreach ($tweet->entities->urls as $url) { $tweetText = str_replace($url->url, $url->display_url, $tweetText); } } // Handle URL removal if requested if ($removeUrls == 1) { $tweetText = preg_replace("((https?|ftp|gopher|telnet|file|notes|ms-help):((\\/\\/)|(\\\\))+[\\w\\d:#\\@%\\/;\$()~_?\\+-=\\\\.&]*)", '', $tweetText); } $replace = emoji_unified_to_html($tweetText); break; case '[User]': $replace = $tweet->user->name; break; case '[ScreenName]': $replace = $tweet->user->screen_name; break; case '[Date]': $replace = date($this->GetOption('dateFormat', Config::GetSetting('DATE_FORMAT')), DateManager::getDateFromGregorianString($tweet->created_at)); break; case '[ProfileImage]': // Grab the profile image if ($tweet->user->profile_image_url != '') { $file = $media->addModuleFileFromUrl($tweet->user->profile_image_url, 'twitter_' . $tweet->user->id, $expires); // Tag this layout with this file $layout->AddLk($this->layoutid, 'module', $file['mediaId']); $replace = $isPreview ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $file['mediaId'] . '" />' : '<img src="' . $file['storedAs'] . '" />'; } break; case '[Photo]': // See if there are any photos associated with this tweet. if (isset($tweet->entities->media) && count($tweet->entities->media) > 0) { // Only take the first one $photoUrl = $tweet->entities->media[0]->media_url; if ($photoUrl != '') { $file = $media->addModuleFileFromUrl($photoUrl, 'twitter_photo_' . $tweet->user->id . '_' . $tweet->entities->media[0]->id_str, $expires); $replace = $isPreview ? '<img src="index.php?p=module&mod=image&q=Exec&method=GetResource&mediaid=' . $file['mediaId'] . '" />' : '<img src="' . $file['storedAs'] . '" />'; // Tag this layout with this file $layout->AddLk($this->layoutid, 'module', $file['mediaId']); } } break; default: $replace = ''; } $rowString = str_replace($sub, $replace, $rowString); } // Substitute the replacement we have found (it might be '') $return[] = $rowString; } // Return the data array return $return; }