varunsridharan/vsp-framework

简单轻量级的WP插件框架

0.8.9.8 2021-03-26 05:00 UTC

This package is auto-updated.

Last update: 2024-08-30 01:23:19 UTC


README

简单轻量级的WP插件框架

安装

安装此扩展的首选方法是通过Composer

要安装VSP_Framework库,只需

$ composer require varunsridharan/vsp-framework

之前的命令只会安装必要的文件,如果您想下载整个源代码,可以使用

$ composer require varunsridharan/vsp-framework --prefer-source

您也可以使用Git 克隆完整仓库

$ git clone https://github.com/varunsridharan/vsp-framework.git

或者 手动安装

下载VSP_Framework.zip:

$ wget https://github.com/varunsridharan/vsp-framework/archive/master.zip

用法

require __DIR__ . '/vsp-framework/vsp-init.php

包含的库/框架

{
    "require" : {
        "wpbp/pointerplus"                      : "dev-master",
        "varunsridharan/wpallimport_rapidaddon" : "dev-master",
        "varunsridharan/wp-ajaxer"              : "^1.0",
        "varunsridharan/wp-endpoint"            : "^1.0",
        "varunsridharan/wp-post"                : "^1.0",
        "varunsridharan/wp-review-me"           : "^1.0",
        "varunsridharan/wp-transient-api"       : "^1.0",
        "varunsridharan/php-autoloader"         : "^1.0",
        "varunsridharan/wp-db-table"            : "dev-master",
        "a5hleyrich/wp-background-processing"   : "^1.0.1"
    }
}

配置

$config = array();

插件模块。

/**
 * Plugin's Addon Module Configuration.
 * Config Options
 * array(
 *    'base_path'               => '',
 *    'base_url'                => '',
 *    'addon_listing_tab_name'  => 'addons',
 *    'addon_listing_tab_title' => 'Addons',
 *    'addon_listing_tab_icon'  => 'fa fa-plus',
 *    'file_headers'            => array(),
 *    'show_category_count'     => true,
 * )
 */
$config['addons'] = true;

设置 / WPOnion 模块

/**
 * Settings Page Configuration.
 * Below arguments are related to WPOnion.
 * please refer https://github.com/wponion/wponion | https://docs.wponion.com for options informations.
 * basic required ars
 * array(
 *    'option_name' => '',
 *    'theme' => 'modern', #modern|fresh|your-theme
 * )
 *
 */
$config['settings_page'] = array(
    'option_name'     => 'vsp_sample_settings',
    'theme'           => 'modern',
    'menu'            => array(
        'menu_title' => __( 'VSP Sample' ),
        'page_title' => __( 'VSP Sample Plugin' ),
        'submenu'    => true,
    ),
    'framework_title' => __( 'Settings Page' ),
);

系统工具模块

/**
 * Config for system tools.
 * Possible Values : true / false / array()
 * array(
 *    'system_tools_menu' => true, # true/false/array of values
 *    'menu'              => true, # true/false
 *    'system_status'     => true, #true/false/array of values
 *    'logging'           => true, #true/false/array of values
 * )
 *
 * system_status /logging / system_tool_menu array data can be like below
 * array(
 *    'name' => '',
 *    'title' => '',
 *    'icon'=>''
 * )
 * The above array is related to WPOnion Page Argument.
 *
 * $config['system_tools'] = true;
 * $config['system_tools'] = false;
 * $config['system_tools'] = array(
 *    'menu' => array(
 *        'title' => __( 'Sys Tools' ),
 *    ),
 * );
 *
 */
$config['system_tools'] = true;

WP Review Me 模块

/**
 * Custom Lib To popup a alert after x number of days to ask for plugin review.
 * please refer https://github.com/varunsridharan/wp-review-me for options informations.
 */
$config['VS_WP_Review_Me'] = true;

日志模块

/**
 * Config to enable logging option.
 * if set to true. then it create a custom logger instance and saves it.
 */
$config['logging'] = true;

自动加载模块

/**
 * Config To enable Autoloader PHP Lib
 *
 * @uses \Varunsridharan\PHP\Autoloader https://github.com/varunsridharan/php-autoloader
 *
 * array(
 *    'namespace' => 'somename',
 *    'basepath' => __DIR__.'/includes/',
 *    'remaps' => array(),
 *    'prepend'=> false,
 * )
 */
$config['autoloader'] = array(
    'namespace' => '\MyPlugin\Admin',
    'basepath'  => __DIR__ . '/includes/admin/',
);