function weixin_robot_get_user($weixin_openid = '', $from = '') { if (!$weixin_openid) { $weixin_openid = weixin_robot_get_user_openid(); } if (!$weixin_openid) { return false; } if (strlen($weixin_openid) < 28) { return false; } $weixin_user = wp_cache_get($weixin_openid, 'weixin_user'); if ($weixin_user === false) { global $wpdb; $weixin_user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->weixin_users} WHERE openid=%s", $weixin_openid), ARRAY_A); if ($weixin_user) { if (weixin_robot_get_setting('weixin_advanced_api') && current_time('timestamp') - $weixin_user['last_update'] > 86400 * 30) { $weixin_user = weixin_robot_get_remote_user($weixin_openid); if ($weixin_user) { $wpdb->update($wpdb->weixin_users, $weixin_user, array('openid' => $weixin_openid)); wp_cache_set($weixin_openid, $weixin_user, 'weixin_user', 3600); } else { return false; } } } else { if ($from == 'local') { return false; } else { if (weixin_robot_get_setting('weixin_advanced_api')) { if ($from == '') { $weixin_user = weixin_robot_get_remote_user($weixin_openid); } } else { $weixin_user = array('openid' => trim($weixin_openid)); } if (isset($weixin_user['openid'])) { $wpdb->insert($wpdb->weixin_users, $weixin_user); $weixin_user = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->weixin_users} WHERE openid=%s", $weixin_openid), ARRAY_A); wp_cache_set($weixin_openid, $weixin_user, 'weixin_user', 3600); } } } } return $weixin_user; }
function weixin_robot_get_custom_reply_types() { $types = array('text' => '文本回复', 'img' => '图文回复', 'function' => '函数回复'); if (weixin_robot_get_setting('weixin_3rd_url') && weixin_robot_get_setting('weixin_3rd_token')) { $types['3rd'] = '第三方平台'; } $types = apply_filters('weixin_custom_reply_types', $types); return $types; }
?> 分</li> <li>发送文章给好友: <?php echo weixin_robot_get_setting('weixin_SendAppMessage_credit'); ?> 分</li> <li>分享文章到朋友圈: <?php echo weixin_robot_get_setting('weixin_ShareTimeline_credit'); ?> 分</li> <li>分享文章到腾讯微博: <?php echo weixin_robot_get_setting('weixin_ShareWeibo_credit'); ?> 分</li> <li>每天最多: <?php echo weixin_robot_get_setting('weixin_day_credit_limit'); ?> 分</li> </ul> <?php } else { ?> <p><strong>你现在共有 <?php echo weixin_robot_get_credit($weixin_openid); ?> 积分</strong>:</p> <ul class="buttons"> <li><a href="<?php echo home_url('?weixin_user&profile&credit_rule=1'); ?> " class=button>查看积分规则</a></li>
function weixin_robot_credit_share_action_callback() { check_ajax_referer("weixin_share"); $weixin_openid = $_POST['weixin_openid']; if ($weixin_openid == false) { exit; } $share_type = $_POST['share_type']; $post_id = $_POST['post_id']; if ($weixin_openid && $share_type && $post_id) { if ($share_type == 'SendAppMessage') { $credit_change = weixin_robot_get_setting('weixin_SendAppMessage_credit'); $share_message = '发送文章给朋友'; } elseif ($share_type == 'ShareTimeline') { $credit_change = weixin_robot_get_setting('weixin_ShareTimeline_credit'); $share_message = '分享文章到朋友圈'; } elseif ($share_type == 'ShareWeibo') { $credit_change = weixin_robot_get_setting('weixin_ShareWeibo_credit'); $share_message = '分享文章到腾讯微博'; } elseif ($share_type == 'ShareFB') { $credit_change = weixin_robot_get_setting('weixin_SendAppMessage_credit'); $share_message = '分享文章到Facebook'; } global $wpdb; if ($wpdb->query($wpdb->prepare("SELECT * FROM {$wpdb->weixin_credits} WHERE weixin_openid=%s AND type=%s AND post_id=%d", $weixin_openid, $share_type, $post_id))) { $share_message = '你已经执行过该操作了'; } else { $credit_change = weixin_robot_add_credit(array('type' => $share_type, 'weixin_openid' => $weixin_openid, 'post_id' => $post_id, 'credit_change' => $credit_change, 'note' => $share_message)); if ($credit_change == 0) { $share_message = '你当日加分已经超过' . weixin_robot_get_setting('weixin_day_credit_limit') . '分了。'; } else { $share_message = $share_message . ',获取 ' . $credit_change . ' 积分!'; } } echo $share_message; } exit; }
function weixin_robot_get_access_token() { if (weixin_robot_get_setting('weixin_app_id') && weixin_robot_get_setting('weixin_app_secret')) { $weixin_robot_access_token = get_transient('weixin_robot_access_token'); if ($weixin_robot_access_token === false) { $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . weixin_robot_get_setting('weixin_app_id') . '&secret=' . weixin_robot_get_setting('weixin_app_secret'); $weixin_robot_access_token = wp_remote_get($url, array('sslverify' => false)); if (is_wp_error($weixin_robot_access_token)) { echo $weixin_robot_access_token->get_error_code() . ':' . $weixin_robot_access_token->get_error_message(); exit; } $weixin_robot_access_token = json_decode($weixin_robot_access_token['body'], true); if (isset($weixin_robot_access_token['access_token'])) { set_transient('weixin_robot_access_token', $weixin_robot_access_token['access_token'], $weixin_robot_access_token['expires_in']); return $weixin_robot_access_token['access_token']; } else { //print_r($weixin_robot_get_access_token); exit; } } else { return $weixin_robot_access_token; } } }
function weixin_robot_credit_list() { global $plugin_page, $succeed_msg, $plugin_page; global $wpdb; $current_page = isset($_GET['paged']) ? $_GET['paged'] : 1; $number_per_page = 50; $start_count = ($current_page - 1) * $number_per_page; $limit = 'LIMIT ' . $start_count . ',' . $number_per_page; $where = ''; if (isset($_GET['openid'])) { $where = "AND wct.weixin_openid = '{$_GET['openid']}'"; } $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->weixin_credits} as wct LEFT JOIN {$wpdb->weixin_users} wut ON wct.weixin_openid = wut.openid WHERE wut.subscribe = '1' {$where} ORDER BY wct.id DESC {$limit}"; $weixin_robot_credits = $wpdb->get_results($sql); $total_count = $wpdb->get_var("SELECT FOUND_ROWS();"); ?> <?php if ($weixin_robot_credits) { ?> <form action="<?php echo admin_url('admin.php?page=' . $plugin_page); ?> " method="POST"> <table class="widefat" cellspacing="0"> <thead> <tr> <th>微信 OpenID</th> <th<?php if (weixin_robot_get_setting('weixin_advanced_api')) { echo ' colspan="2"'; } ?> >用户</th> <th>积分</th> <th>变动</th> <th>积分类型</th> <th>时间</th> <th>备注</th> </tr> </thead> <tbody> <?php $alternate = ''; ?> <?php foreach ($weixin_robot_credits as $weixin_robot_credit) { $alternate = $alternate ? '' : 'alternate'; ?> <tr class="<?php echo $alternate; ?> "> <td><a href="<?php echo admin_url('admin.php?page=' . $plugin_page . '&openid=' . $weixin_robot_credit->weixin_openid); ?> "><?php echo $weixin_robot_credit->weixin_openid; ?> </a></td> <?php if (weixin_robot_get_setting('weixin_advanced_api')) { ?> <?php if ($weixin_robot_credit->subscribe) { ?> <td> <?php $weixin_user_avatar = ''; if (!empty($weixin_robot_credit->headimgurl)) { $weixin_user_avatar = $weixin_robot_credit->headimgurl; ?> <img src="<?php echo $weixin_user_avatar; ?> " width="32" /> <?php } ?> </td> <td><?php echo $weixin_robot_credit->nickname; ?> </td> <?php } else { ?> <td colspan="2"><span style="color:red">*取消关注*</td> <?php } ?> <?php } elseif ($weixin_robot_credit->name) { ?> <td><?php echo $weixin_robot_credit->name; ?> </td> <?php } else { ?> <td></td> <?php } ?> <td><?php echo $weixin_robot_credit->credit; ?> </td> <td><?php echo $weixin_robot_credit->credit_change; ?> </td> <td><?php echo $weixin_robot_credit->type; ?> <?php if ($weixin_robot_credit->operator_id) { $operator_user = get_userdata($weixin_robot_credit->operator_id); echo '<br />操作人:' . $operator_user->display_name; } ?> </td> <td><?php echo $weixin_robot_credit->time; ?> </td> <td><?php echo $weixin_robot_credit->note; ?> </td> </tr> <?php } ?> </tbody> </table> </form> <?php wpjam_admin_pagenavi($total_count, $number_per_page); ?> <?php } else { ?> <p>还没有积分历史记录</p> <?php } }
private function checkSignature() { $signature = isset($_GET["signature"]) ? $_GET["signature"] : ''; $timestamp = isset($_GET["timestamp"]) ? $_GET["timestamp"] : ''; $nonce = isset($_GET["nonce"]) ? $_GET["nonce"] : ''; $weixin_token = weixin_robot_get_setting('weixin_token'); if (isset($_GET['debug'])) { echo 'WEIXIN_TOKEN:' . $weixin_token . "\n"; } $tmpArr = array($weixin_token, $timestamp, $nonce); //sort($tmpArr); sort($tmpArr, SORT_STRING); $tmpStr = implode($tmpArr); $tmpStr = sha1($tmpStr); if ($tmpStr == $signature) { return true; } else { return false; } }
function weixin_robot_post_custom_menus($message, $weixin_robot_custom_menus) { if (weixin_robot_get_setting('weixin_app_id') && weixin_robot_get_setting('weixin_app_secret')) { $weixin_robot_access_token = weixin_robot_get_access_token(); if ($weixin_robot_access_token) { //$url = 'http://wpjam.net/api/weixin.php?action=create_menu&access_token='.$weixin_robot_access_token.'&domain='.wpjam_net_get_domain(); $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $weixin_robot_access_token; $request = weixin_robot_create_buttons_request($weixin_robot_custom_menus); $result = weixin_robot_post_custom_menus_core($url, urldecode(json_encode($request))); $message = $message ? $message . '<br />' : $message; return $message . '微信:' . $result; } } return $message; }
function weixin_robot_messages_page() { ?> <div class="wrap"> <h2>最新消息</h2> <p>下面是你公众号上最新的消息,你可以直接删除(WordPress 本地删除,公众号后台不受影响)!</p> <?php global $wpdb, $plugin_page; if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!wp_verify_nonce($_POST['weixin_robot_send_user_nonce'], 'weixin_robot')) { ob_clean(); wp_die('非法操作'); } $weixin_openid = stripslashes(trim($_POST['weixin_openid'])); $reply_id = stripslashes(trim($_POST['reply_id'])); $reply_type = stripslashes(trim($_POST['reply_type'])); $content = stripslashes(trim($_POST['content'])); if ($weixin_openid && $message_id && $content) { $data = array('MsgType' => 'manual', 'FromUserName' => $weixin_openid, 'CreateTime' => current_time('timestamp') - get_option('gmt_offset') * 3600, 'Content' => $content); $insert_id = $wpdb->insert($wpdb->weixin_messages, $data); $wpdb->update($wpdb->weixin_messages, array('Response' => $wpdb->insert_id), array('id' => $reply_id)); $succeed_msg = weixin_rebot_sent_user($weixin_openid, $content, $reply_type); } } $response_types = weixin_robot_get_response_types(); $types = weixin_robot_stats_get_types(); unset($types['subscribe']); unset($types['unsubscribe']); $types['manual'] = '需要人工回复'; $type = weixin_robot_stats_get_type(); if (!$type) { $type = 'total'; } $Response = isset($_REQUEST['Response']) ? $_REQUEST['Response'] : ''; if (isset($_GET['delete']) && isset($_GET['id']) && $_GET['id']) { $wpdb->query("DELETE FROM {$wpdb->weixin_messages} WHERE id = {$_GET['id']}"); } $current_page = isset($_GET['paged']) ? $_GET['paged'] : 1; $number_per_page = 100; $start_count = ($current_page - 1) * $number_per_page; $limit = 'LIMIT ' . $start_count . ',' . $number_per_page; if ($type == 'total') { $where = ''; } elseif ($type == 'manual') { $where = "AND Response in('not-found','too-long')"; } else { $where = "AND MsgType = '{$type}'"; } if (isset($_GET['openid'])) { $where = "AND FromUserName = '******'openid']}'"; } $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM {$wpdb->weixin_messages} WHERE 1=1 {$where} AND MsgType != 'manual' AND Event!= 'subscribe' AND Event != 'unsubscribe' ORDER BY CreateTime DESC " . $limit; $weixin_messages = $wpdb->get_results($sql); $total_count = $wpdb->get_var("SELECT FOUND_ROWS();"); ?> <?php if (!empty($succeed_msg)) { ?> <div class="updated"> <p><?php echo $succeed_msg; ?> </p> </div> <?php } ?> <ul class="subsubsub"> <?php foreach ($types as $key => $value) { ?> <li class="<?php echo $key; ?> "><a href="<?php echo admin_url('admin.php?page=' . $plugin_page . '&type=' . $key); ?> " <?php if ($type == $key) { ?> class="current"<?php } ?> ><?php echo $value; ?> </a> |</li> <?php } ?> <?php /* <li class="not-found"><a href="<?php echo admin_url('admin.php?page='.$plugin_page.'&Response=not-found')?>" <?php if($Response == 'need-manual') {?> class="current"<?php } ?>>需要回复</a></li>*/ ?> </ul> <table class="widefat" cellspacing="0"> <thead> <tr> <?php if (weixin_robot_get_setting('weixin_advanced_api') && strpos($wpdb->weixin_messages, 'weixin')) { ?> <th colspan="2">用户</th> <?php } else { ?> <th>用户</th> <?php } ?> <th style="min-width:200px;width:40%;">内容</th> <th>类型</th> <th>回复类型</th> <th>操作</th> </tr> </thead> <tbody> <?php $alternate = ''; foreach ($weixin_messages as $weixin_message) { $MsgType = $weixin_message->MsgType; $alternate = $alternate ? '' : 'alternate'; $weixin_openid = $weixin_message->FromUserName; ?> <tr id="<?php echo $weixin_message->id; ?> " class="<?php echo $alternate; ?> "> <?php if (weixin_robot_get_setting('weixin_advanced_api') && strpos($wpdb->weixin_messages, 'weixin')) { ?> <?php $weixin_user = weixin_robot_get_user($weixin_openid); ?> <?php if ($weixin_user['subscribe']) { ?> <td> <?php $weixin_user_avatar = ''; if (!empty($weixin_user['headimgurl'])) { $weixin_user_avatar = $weixin_user['headimgurl']; ?> <a href="<?php echo admin_url('admin.php?page=' . $plugin_page . '&openid=' . $weixin_openid); ?> "><img src="<?php echo $weixin_user_avatar; ?> " width="32" /></a> <?php } ?> </td> <td> <?php echo $weixin_user['nickname']; ?> (<?php if ($weixin_user['sex'] == 1) { echo '男'; } elseif ($weixin_user['sex'] == 2) { echo '女'; } else { echo "未知"; } ?> )<br /> <?php echo $weixin_user['country'] . ' ' . $weixin_user['province'] . ' ' . $weixin_user['city']; ?> <br /> </td> <?php } else { ?> <td colspan="2"> <span style="color:red;">*已经取消关注</span> </td> <?php } ?> <?php } else { ?> <td><?php echo $weixin_openid; ?> </td> <?php } ?> <td class="content"> <?php if ($MsgType == 'text') { echo $weixin_message->Content; } elseif ($MsgType == 'link') { echo '<a href="' . $weixin_message->Url . '" target="_blank">' . $weixin_message->Title . '</a>'; } elseif ($MsgType == 'image') { echo '<a href="' . $weixin_message->PicUrl . '" target="_blank" title="' . $weixin_message->MediaId . '"><img src="' . $weixin_message->PicUrl . '" alt="' . $weixin_message->MediaId . '" width="100px;"></a>'; if (isset($_GET['debug'])) { echo '<br />MediaId:' . $weixin_message->MediaId; } } elseif ($MsgType == 'location') { echo '<a href="http://ditu.google.cn/maps?q=' . urlencode($weixin_message->label) . '&ll=' . $weixin_message->Location_X . ',' . $weixin_message->Location_Y . '&source=embed" target="_blank">' . $weixin_message->label . '</a>'; } elseif ($MsgType == 'event') { echo '[' . $weixin_message->Event . '] ' . $weixin_message->EventKey; } elseif ($MsgType == 'voice') { if ($weixin_message->Recognition) { echo '语音识别成:'; echo $weixin_message->Recognition; } else { echo '未识别'; } if (isset($_GET['debug'])) { echo '<br />MediaId:' . $weixin_message->MediaId; } } else { echo $MsgType; echo '该类型的内容无法显示,请直接访问微信公众号后台进行操作!'; } if (is_numeric($weixin_message->Response)) { $weixin_reply_message = weixin_robot_get_message($weixin_message->Response); echo '<br /><span style="background-color:yellow; padding:2px; ">人工回复:' . $weixin_reply_message->Content . '</span>'; } ?> </td> <td><?php echo $types[$MsgType]; ?> <br /><?php echo date('Y-m-d H:i:s', $weixin_message->CreateTime + get_option('gmt_offset') * 3600); ?> </td> <td> <?php if (is_numeric($weixin_message->Response)) { echo '人工回复'; } elseif (isset($response_types[$weixin_message->Response])) { echo $response_types[$weixin_message->Response]; } ?> </td> <td class="action"> <?php if (weixin_robot_get_setting('weixin_advanced_api') && strpos($wpdb->weixin_messages, 'weixin') && current_time('timestamp') - $weixin_message->CreateTime < (48 + get_option('gmt_offset')) * 3600) { ?> <?php if (is_numeric($weixin_message->Response)) { ?> <span>已经回复</span> <?php } elseif ($weixin_user['subscribe']) { ?> <span class="reply"><a href="javascript:;" onclick="reply_to_weixin('<?php echo $weixin_openid; ?> ', '<?php echo $weixin_message->id; ?> ')">回复</a></span> <?php } ?> <?php } else { ?> <span class="delete"><a href="<?php echo admin_url('admin.php?page=weixin-robot-messages&delete&id=' . $weixin_message->id); ?> ">删除</a></span> <?php } ?> </td> </tr> <?php } ?> <?php if (weixin_robot_get_setting('weixin_advanced_api') && strpos($wpdb->weixin_messages, 'weixin')) { ?> <tr id="reply_form" style="display:none;" > <td colspan="2"> </td> <td colspan="4"> <form action="<?php echo admin_url('admin.php?page=' . $plugin_page); ?> " method="POST"> <p> <textarea name="content" id="content" rows="5" class="large-text code"></textarea> </p> <p> <select name="reply_type" id="reply_type" > <option value="text">文本回复</option> <option value="img">图文回复</option> </select> </p> <input type="hidden" name="weixin_openid" id="weixin_openid" value="" /> <input type="hidden" name="reply_id" id="reply_id" value="" /> <?php wp_nonce_field('weixin_robot', 'weixin_robot_send_user_nonce'); ?> <p><input type="submit" name="submit" id="submit" class="button button-primary" value="回复用户" style="float:right; margin-right:20px;"></p> </form> </td> </tr> <?php } ?> </tbody> </table> <?php wpjam_admin_pagenavi($total_count, $number_per_page); ?> <?php if (weixin_robot_get_setting('weixin_advanced_api') && strpos($wpdb->weixin_messages, 'weixin')) { ?> <script type="text/javascript"> function reply_to_weixin(weixin_openid, id){ jQuery('input#weixin_openid')[0].value = weixin_openid; jQuery('input#reply_id')[0].value = id; jQuery('tr#'+id).after(jQuery('#reply_form')); jQuery('tr#reply_form').show(); } jQuery(function(){ jQuery('form').submit(function( event ) { var reply_id = jQuery('input#reply_id')[0].value; var reply_type = jQuery('select#reply_type')[0].value; var weixin_openid = jQuery('input#weixin_openid')[0].value; var reply_content = jQuery('textarea#content')[0].value; if(jQuery('textarea#content')[0].value != ''){ jQuery.ajax({ type: 'post', url: '<?php echo admin_url('admin-ajax.php'); ?> ', data: { action: 'weixin_reply', weixin_openid: weixin_openid, reply_id: reply_id, reply_type: reply_type, content: reply_content, _ajax_nonce: '<?php echo wp_create_nonce('weixin_robot_ajax_nonce'); ?> ' }, success: function(html){ reply_content = jQuery('tr#'+reply_id+' td.content').html()+'<br /><span style="background-color:yellow; padding:2px; ">人工回复:'+reply_content+'</span>'; jQuery('tr#'+reply_id+' td.content').html(reply_content); jQuery('tr#'+reply_id+' td.action').html('已经回复'); jQuery('textarea#content')[0].value = ''; jQuery('tr#reply_form').hide(); } }); }else{ alert('回复的内容不能为空'); jQuery('textarea#content').focus(); } event.preventDefault(); }); }); </script> <?php wpjam_confim_delete_script(); ?> <?php } }
if (weixin_robot_get_setting('weixin_credit')) { include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-credit.php'; // 微信积分系统 } if (is_admin()) { include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-options.php'; // 后台选项 include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-custom-reply.php'; // 自定义回复 include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-custom-menu.php'; // 自定义菜单 if (weixin_robot_get_setting('weixin_disable_stats') == false) { include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-stats.php'; // 数据统计分析 } if (weixin_robot_get_setting('weixin_advanced_api')) { include WEIXIN_ROBOT_PLUGIN_DIR . '/weixin-robot-qrcode.php'; // 带参数二维码 } } $weixin_extend_dir = WEIXIN_ROBOT_PLUGIN_DIR . '/extends'; if (is_dir($weixin_extend_dir)) { if ($weixin_extend_handle = opendir($weixin_extend_dir)) { while (($weixin_extend_file = readdir($weixin_extend_handle)) !== false) { if ($weixin_extend_file != "." && $weixin_extend_file != ".." && is_file($weixin_extend_dir . '/' . $weixin_extend_file)) { if (pathinfo($weixin_extend_file, PATHINFO_EXTENSION) == 'php') { include $weixin_extend_dir . '/' . $weixin_extend_file; } } } closedir($weixin_extend_handle);
function weixin_robot_qrcode_page() { global $wpdb, $id, $succeed_msg; $wpdb->show_errors(); if (isset($_GET['delete']) && isset($_GET['id']) && $_GET['id']) { $wpdb->query("DELETE FROM {$wpdb->weixin_qrcodes} WHERE id = {$_GET['id']}"); } if (isset($_GET['edit']) && isset($_GET['id'])) { $id = (int) $_GET['id']; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!wp_verify_nonce($_POST['weixin_robot_qrcode_nonce'], 'weixin_robot')) { ob_clean(); wp_die('非法操作'); } $scene = stripslashes(trim($_POST['scene'])); $name = stripslashes(trim($_POST['name'])); $type = stripslashes(trim($_POST['type'])); $expire = stripslashes(trim($_POST['expire'])); if (weixin_robot_get_setting('weixin_app_id') && weixin_robot_get_setting('weixin_app_secret')) { if (weixin_robot_create_qrcode($scene, $name, $type, $expire)) { if (empty($id)) { $succeed_msg = '添加成功'; } else { $succeed_msg = '修改成功'; } } } } ?> <div class="wrap"> <h2>带参数的二维码 <a href="<?php echo admin_url('admin.php?page=weixin-robot-stats2&tab=qrcode-stats'); ?> " class="add-new-h2">使用统计</a></h2> <?php if (!empty($succeed_msg)) { ?> <div class="updated"> <p><?php echo $succeed_msg; ?> </p> </div> <?php } ?> <?php if (!empty($err_msg)) { ?> <div class="error" style="color:red;"> <p>错误:<?php echo $err_msg; ?> </p> </div> <?php } ?> <?php weixin_robot_qrcode_list(); ?> <?php weixin_robot_qrcode_add(); ?> <?php wpjam_confim_delete_script(); ?> </div> <?php }
function weixin_robot_enqueue_scripts() { global $post; $img = apply_filters('weixin_share_img', get_post_weixin_thumb($post, array(120, 120))); $link = apply_filters('weixin_share_url', get_permalink()); $title = apply_filters('weixin_share_title', get_the_title()); $desc = apply_filters('weixin_share_desc', get_post_excerpt($post)); $weixin_openid = weixin_robot_get_user_openid(); wp_enqueue_script('jquery'); wp_enqueue_script('weixin', WEIXIN_ROBOT_PLUGIN_URL . '/static/weixin-share.js', array('jquery')); wp_localize_script('weixin', 'weixin_data', array('appid' => '', 'fakeid' => '', 'img' => $img, 'link' => $link, 'title' => $title, 'desc' => $desc, 'credit' => $is_IIS ? 0 : weixin_robot_get_setting('weixin_credit'), 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('weixin_share'), 'post_id' => get_the_ID(), 'weixin_openid' => $weixin_openid, 'notify' => weixin_robot_get_setting('weixin_share_notify'))); }