otgs/installer

自动安装和更新WPML和Toolset依赖

3.1.7 2024-05-15 12:47 UTC

This package is auto-updated.

Last update: 2024-09-23 08:09:31 UTC


README

OTGS WP Installer是一个库,允许您安装和升级OnTheGoSystems开发的插件和主题。

安装

首先,使用Composer将OTGS WP Installer作为依赖项添加

composer require otgs/installer

确保您的引导文件正在加载composer自动加载器

require_once 'vendor/autoload.php';

然后,加载OTGS WP Installer引导。在添加plugins_loaded动作之前

include 'vendor/otgs/installer/loader.php';

可选地,您可以指定参数以配置在插件 -> 安装新插件下显示专用UI或加载特定仓库。默认情况下,将加载在repositories.xml中配置的所有仓库

WP_Installer_Setup( $wp_installer_instance,  
    array(
        'plugins_install_tab'   => '1',   // optional, default value: 0
        'repositories_include'  => array( 'wpml' ) // optional, default to empty (show all)
    )
); 

init之后,配置显示OTGS WP Installer UI,如下例所示

WP_Installer_Show_Products( 
    array( 
        'template'         => 'compact', //required
        'product_name'     => 'WPML', 
        'box_title'        => 'Multilingual Avada', 
        'name'             => 'Avada', //name of theme/plugin
        'box_description'  => 'Avada theme is fully compatible with WPML - the WordPress Multilingual plugin. WPML lets 
                                      you add languages to your existing sites and includes advanced translation management.', 
        'repository'       => 'wpml', // required
        'package'          => 'multilingual-cms', // required
        'product'          => 'multilingual-cms' // required
    ) 
);
  • template有两个选项可用:默认和紧凑。默认与在插件 -> 安装新插件页面上的GUI相同,而紧凑是一个更小的版本,可以适应不同的已存在屏幕
  • repository只能显示来自特定仓库的特定产品包的一个产品
  • package只能显示来自特定仓库的特定产品包的一个产品
  • product只能显示来自特定仓库的特定产品包的一个产品