wp-wechat-admin.php 9.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<?php 

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}
function minapper_admin_menu()
{
   
    $swipe_count=50;
    $selected_nav_count=50; 
    $selected_shops_count=10;
    $config_submenu = array(

        'type'              => 'menu',                          // Required, menu or metabox
        'id'                => 'minapper_expand_settings_page',              // Required, meta box id, unique per page, to save: get_option( id )
        'parent'            => 'weixinapp_slug',                   // Parent page of plugin menu (default Settings [options-general.php])
        'submenu'           => true,                            // Required for submenu
        'title'             => '扩展设置',                       // The title of the options page and the name in admin menu
        'capability'        => 'manage_options',                // The capability needed to view the page
        'plugin_basename'   =>  plugin_basename(plugin_dir_path(__DIR__) . REST_API_TO_MINIPROGRAM_PLUGIN_NAME. '.php'),
        'tabbed'            => true,
        'multilang'         => false,                        // To turn of multilang, default on.
        'icon'              => plugins_url(REST_API_TO_MINIPROGRAM_PLUGIN_NAME.'/images/icon16.png')

    );   

    $fields[] = array(
        'name'   => 'swipe_options',
        'title'  => '首页轮播图',
        'icon'   => 'fa fa-home',
        'fields' => array(

            array(
                'type'    => 'group',
                'id'      => 'swipe_nav',
                'title'   => '跳转设置',
                'options' => array(
                    'repeater'          => true,
                    'accordion'         => true,                  
                    'button_title'      => '添加',
                    'group_title'       => '自定义跳转',
                    'limit'             => $swipe_count,
                    'sortable'          => true,
                    'closed'            => true,
                    
                ),             

                'fields'  => array(    
                    
                    array(
                        'id'             => 'type',
                        'type'           => 'select',
                        'title'          => '跳转类型',
                        'options'        => array(
                            'apppage'          => '跳转到小程序内页面',
                            'miniapp'     => '跳转其他小程序',
                            'webpage'   => '跳转到网页'
                        ),                      
                        'default'     => 'apppage',                             // optional 
                        'class'       => 'chosen',                          // optional 
                       
                    ),               
                    array(
                        'id'      => 'appid',
                        'type'    => 'text',
                        'title'   => 'appid',
                        'after'       => '跳转其他小程序时需填写',   // optional   
                        'attributes' => array(
                            'data-title' => 'title',
                            'placeholder' => '请输入小程序appid'
                        )
                    ),                    
                    array(
                        'id'    => 'image',
                        'type'  => 'image',
                        'title' => '图片',
                    ),
                     array(
                        'id'      => 'path',
                        'type'    => 'text',
                        'title'   => '小程序路径',
                        'after'       => '跳转小程序时需填写。
                        <br/>跳转本小程序的页面路径请以<font color=red>"/pages"</font>开头。
                        <br/>跳转其他小程序的页面路径一般以<font color=red>"pages"</font>开头。
J
jianbo 已提交
85
                        <br/>跳转直播间<font color=red>"plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=11"</font>开头。room_id换成直播间的房间号',   // optional   
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
                        'attributes' => array(
                            'data-title' => 'title',
                            'placeholder' => '请输入小程序页面路径'
                        )
                        ),
                   
                    array(
                        'id'      => 'url',
                        'type'    => 'text',
                        'title'   => 'url地址',
                        'after'       => '跳转到网页需填写',   // optional   
                        'attributes' => array(
                            'data-title' => 'title',
                            'placeholder' => '请输入链接'
                        )
                    ),
ijianbo's avatar
ijianbo 已提交
102 103 104 105 106 107
                    array(
                        'id'    => 'enable',
                        'type'  => 'checkbox',
                        'title' => '是否启用',
                        //'label' => '是否启用?'
                    ),
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
                    array(
                        'id'      => 'title',
                        'type'    => 'text',
                        'title'   => '标题',                       
                        'attributes' => array(
                            'data-title' => 'title',
                            'placeholder' =>'请输入标题',
                        ),
                    )
                )

            )

        )
    );

    $fields[] = array(
        'name'   => 'selected_options',
        'title'  => '精选栏目设置',
        'icon'   => 'fa fa-home',
        'fields' => array(

        array(
            'type'    => 'group',
            'id'      => 'selected_nav',
            'title'   => '精选栏目',
            'options' => array(
                'repeater'          => true,
                'accordion'         => true,                  
                'button_title'      => '添加',
                'group_title'       => '栏目设置',
                'limit'             => $selected_nav_count,
                'sortable'          => true,
                'closed'            => true,
                
            ),             

            'fields'  => array(    
                
                array(
                    'id'             => 'type',
                    'type'           => 'select',
                    'title'          => '跳转类型',
                    'options'        => array(
                        'apppage'          => '跳转到小程序内页面',
                        'miniapp'     => '跳转其他小程序',
                        'webpage'   => '跳转到网页'
                    ),                      
                    'default'     => 'apppage',                             // optional 
                    'class'       => 'chosen',                          // optional 
                   
                ),               
                array(
                    'id'      => 'appid',
                    'type'    => 'text',
                    'title'   => 'appid',
J
jianbo 已提交
164
                    'after'       => '跳转小程序时需填写',   // optional   
165 166 167 168 169 170 171 172 173 174 175 176 177 178
                    'attributes' => array(
                        'data-title' => 'title',
                        'placeholder' => '请输入小程序appid'
                    )
                ),                    
                array(
                    'id'    => 'image',
                    'type'  => 'image',
                    'title' => '图片',
                ),
                 array(
                    'id'      => 'path',
                    'type'    => 'text',
                    'title'   => '小程序路径',
J
jianbo 已提交
179
                    'after'       => '跳转小程序时需填写。
J
jianbo 已提交
180 181
                        <br/>跳转本小程序的页面路径请以<font color=red>"/pages"</font>开头。
                        <br/>跳转其他小程序的页面路径一般以<font color=red>"pages"</font>开头。
J
jianbo 已提交
182 183 184 185
                        <br/>跳转直播间<font color=red>"plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=11"</font>开头。room_id换成直播间的房间号',   // optional   
                    'attributes' => array(
                        'data-title' => 'title',
                        'placeholder' => '请输入小程序页面路径'
186 187 188 189 190 191 192 193 194 195 196 197 198
                    )
                    ),
               
                array(
                    'id'      => 'url',
                    'type'    => 'text',
                    'title'   => 'url地址',
                    'after'       => '跳转到网页需填写',   // optional   
                    'attributes' => array(
                        'data-title' => 'title',
                        'placeholder' => '请输入链接'
                    )
                ),
ijianbo's avatar
ijianbo 已提交
199 200 201 202 203 204
                array(
                    'id'    => 'enable',
                    'type'  => 'checkbox',
                    'title' => '是否启用',
                    //'label' => '是否启用?'
                ),
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
                array(
                    'id'      => 'title',
                    'type'    => 'text',
                    'title'   => '标题',                       
                    'attributes' => array(
                        'data-title' => 'title',
                        'placeholder' =>'请输入标题',
                    ),
                )
            )

        )
        

        )
    );
   


    

   $options_panel = new Exopite_Simple_Options_Framework($config_submenu, $fields );
   //$options_panel = new Exopite_Simple_Options_Framework($license_submenu, $fields );
   
   //add_submenu_page('minapper_plus_settings_page', "授权激活", "授权激活", "administrator", 'minapper_license_slug', 'minapper_license_page');
   

}