一套方便的库,用于WordPress开发。

v1.0.8 2024-09-07 17:33 UTC

This package is auto-updated.

Last update: 2024-09-07 17:35:31 UTC


README

本包包含许多对Webilia插件非常有价值的工具。即使你不是Webilia开发者,也可以将其用于自己的项目;然而,请注意,在这种情况下我们不提供支持。

安装

要将此包包含到您的项目中,请运行以下Composer命令。

composer require webilia/wp

许可服务器

您可以使用Webilia许可服务器轻松地激活、停用和验证许可证代码。请参考下面的示例代码以获取指导。

use Webilia\WP\Plugin\Licensing;

// Webilia Licensing Server
$licensing = new Licensing(
    'lsdaddbok_purchase_code', // Key name for get_option function
    'lsdaddbok_activation_id', // Key name for get_option function
    'listdom-booking/listdom-booking.php', // Plugin (Add-on) Basename
    'https://api.webilia.com/licensing' // URL of Licensing Server
);

// Activation
[$status, $message, $activation_id] = $licensing->activate('sample-license-key');

// Deactivation
if($licensing->deactivate('sample-license-key'))
{
    // Do something
}

// Validation
if($licensing->isValid())
{
    // Do something
    // Perhaps run the add-on
}

更新服务器

要使用Webilia更新服务器,将以下代码集成到您的项目中。

use Webilia\WP\Plugin\Licensing;
use Webilia\WP\Plugin\Update;

// Webilia Licensing Server
$licensing = new Licensing(
    'lsdaddbok_purchase_code', // Key name for get_option function
    'lsdaddbok_activation_id', // Key name for get_option function
    'listdom-booking/listdom-booking.php', // Plugin (Add-on) Basename
    'https://api.webilia.com/licensing' // URL of Licensing Server
);

// Webilia Update Server
new Update(
    '2.1.0', // Current Plugin Version
    'listdom-booking/listdom-booking.php', // Plugin (Add-on) Basename
    $licensing, // Licensing Server is required if you want to validate the license key before update
    '3.3.0', // Core version: in this case we're sending the listdom version since booking is an add-on for the Listdom 
    'https://api.webilia.com/update' // URL of Update Server
);