Overview

Packages

  • None
  • WxRobot
    • Admin
    • Cmd
    • CoreFunctions
    • Exends
    • Install
    • Table
    • Uninstall
    • WxSDK

Classes

  • ErrorCode
  • PKCS7Encoder
  • Prpcrypt
  • SHA1
  • Weixin_BaseCore
  • WeiXin_SDK
  • Weixin_Template
  • WXBizMsgCrypt
  • WxRobot_Admin
  • WxRobot_Admin_Menu_Extends
  • WxRobot_Admin_Menu_Instro
  • WxRobot_Admin_Menu_Menu
  • WxRobot_Admin_Menu_Records
  • WxRobot_Admin_Menu_Reply
  • WxRobot_Admin_Menu_Setting
  • WxRobot_Admin_Menu_Statistics
  • WxRobot_Cmd
  • WxRobot_Cmd_Event
  • WxRobot_Cmd_Event_User
  • WxRobot_Cmd_Text
  • WxRobot_Extends
  • WxRobot_Install
  • WxRobot_Robot
  • WxRobot_SDK
  • WxRobot_Table_Extends
  • WxRobot_Table_Menu
  • WxRobot_Table_Records
  • WxRobot_Table_Reply
  • WxRobot_Uninstall
  • WxRobot_Wp
  • XMLParse

Functions

  • wx_admin_log
  • wx_is_xml
  • wx_notice_msg
  • wx_parse_xml
  • wx_random_big_pic
  • wx_random_small_pic
  • wx_request_array
  • wx_request_decode
  • wx_request_is_encode
  • wx_request_xml
  • wx_send_encode
  • Overview
  • Package
  • Class
  1: <?php
  2: /**
  3:  * WxRobot Admin
  4:  * 
  5:  * WP微信机器人后台菜单 - 扩展功能
  6:  *
  7:  * @author      midoks
  8:  * @category    Admin
  9:  * @package     WxRobot/Admin
 10:  * @since       5.3.0
 11:  */
 12: 
 13: if ( ! defined( 'ABSPATH' ) ) {
 14:     exit;
 15: }
 16: 
 17: /**
 18:  *  WxRobot_Admin_Menu_Extends 后台扩展功能调用
 19:  */
 20: class WxRobot_Admin_Menu_Extends{
 21:     /**
 22:      * 初始化钩子和过滤器
 23:      *
 24:      * @return void
 25:      */
 26:     public function init(){ 
 27:     }
 28: 
 29:     /**
 30:      * 初始化菜单
 31:      *
 32:      * @return void
 33:      */
 34:     public function menu(){
 35:         add_submenu_page('weixin-robot',
 36:             'weixin-robot', 
 37:             '微信机器人扩展',
 38:             'manage_options',
 39:             'weixin-robot-extends',
 40:             array($this, 'weixin_robot_extends'));
 41:     }
 42: 
 43:     /**
 44:      * 扩展提交处理
 45:      *
 46:      * @return void
 47:      */
 48:     public function extends_post(){
 49: 
 50:         if(isset($_GET['file']) && isset($_GET['type'])){
 51:             $ext_file = trim($_GET['file']);
 52:             $ext_type = trim($_GET['type']);
 53:             if('del'==$ext_type){
 54:                 WxRobot_Table_Extends::instance()->uninstall($ext_file);        
 55:                 WxRobot_Table_Extends::instance()->delete_extends_name($ext_file);
 56:                 wx_notice_msg('卸载成功!!!');
 57:             }else if(in_array($ext_type, array('all', 'subscribe', 'text', 'location', 'image', 'link', 'video','voice', 'menu'))){
 58: 
 59:                 if(!WxRobot_Table_Extends::instance()->select_extends_name($ext_file)){
 60:                     WxRobot_Table_Extends::instance()->install($ext_file);
 61:                     WxRobot_Table_Extends::instance()->insert_extends($ext_file , $ext_type, '1');
 62:                     wx_notice_msg('安装成功!!!');
 63:                 }else{
 64:                     wx_notice_msg('已经安装成功!!!');
 65:                 }
 66:             }
 67:         }
 68:     }
 69: 
 70:     /**
 71:      *  微信扩展功能页
 72:      *
 73:      *  @return void
 74:      */
 75:     public function weixin_robot_extends(){
 76:         
 77:         $this->extends_post();
 78: 
 79:         $list = WxRobot_Table_Extends::instance()->get_all_plugins();
 80:         echo '<div class="wrap"><h2>微信机器人扩展</h2>';
 81: 
 82:         $url = $_SERVER['REQUEST_URI'];
 83:         $r_url = str_replace(strstr($url, '&'), '', $url);
 84:         $thisPageUrl = 'http://'.$_SERVER['HTTP_HOST'].$r_url;
 85: 
 86:         echo '<table class="wp-list-table widefat plugins" cellspacing="0">';
 87: 
 88:         echo '<tr>';
 89:         echo '<th scope="col" id="name" class="manage-column column-name" style="">插件</th>';
 90:         echo '<th scope="col" id="description" class="manage-column column-description" style="">图像描述</th>';
 91:         echo '</tr>';
 92:         
 93:         if(isset($list['abspath']) && !empty($list['abspath'])){
 94:             foreach($list['abspath'] as $k=>$v){
 95:                 $pinfo = $list['info'][$k];
 96:             
 97:                 if(WxRobot_Table_Extends::instance()->select_extends_name($list['path'][$k])){
 98:                     echo "<tr><td class=\"plugin-title\"><strong>{$pinfo['extend_name']}</strong>",
 99:                         '<div class="row-actions-visible"><span class="0"><a href="',$thisPageUrl.'&file='.$list['path'][$k].'&type=del',
100:                         '">已启用</a></span></div></td>';
101:                 }else{
102:                     echo "<tr><td class=\"plugin-title\"><strong>{$pinfo['extend_name']}</strong>",
103:                         '<div class="row-actions-visible"><span class="0"><a href="',$thisPageUrl.'&file='.$list['path'][$k].'&type='.$list['type'][$k],
104:                         '">未启用</a></span></div></td>';
105:                 }
106: 
107:                 echo '<td class="column-description desc"><div class="plugin-description"><p>',
108:                     $pinfo['description'],'</p></div><div class="active second plugin-version-author-uri">',
109:                     $pinfo['version'],'版本 | 作者为 ',
110:                     $pinfo['author'],' | ','事件类型:', $list['type'][$k],' | ','<a href="#" title="',
111:                     $list['path'][$k],'" style="color:#000;">插件地址</a> | ',
112:                     '联系邮箱:',$pinfo['email'],' | ',
113:                     '<a href="',$pinfo['extend_url'],'" title="访问插件主页" target="_blank">访问插件主页</a></div></td>';
114:                 echo '</tr>';
115:             }
116:         }
117:         echo '</table></div>';
118:         do_action('weixin_midoks_push');
119:     }
120:     
121: }
122: 
123: ?>
124: 
API documentation generated by ApiGen