ideologix / dlm-wp-simple-checker
为不希望通过数字许可管理器和我们的包 dlm-wp-updater 提供WordPress插件更新的用户制作的简单许可证检查器。
dev-master
2024-03-14 09:56 UTC
Requires
- ideologix/dlm-php: ^1.0
This package is auto-updated.
Last update: 2024-09-14 11:00:09 UTC
README
WordPress简单许可证检查器,利用数字许可管理器的 REST API。
本包受 TheWebSolver/tws-license-manager-client 启发。
注意:此许可证检查器是独立的,不应与 ideologix/dlm-wp-updater 一起使用,后者适用于更高级的使用。
要求
- WordPress 4.0+
- 数字许可管理器,PRO版可选但推荐。
安装
PHP包可以通过Composer导入
composer require ideologix/dlm-wp-simple-checker
集成
以下示例说明如何在PRO/高级插件中使用库。
- 首先,在插件根目录中使用
composer
安装包。 - 在插件根目录中创建
init.php
(或按您希望的名称命名)文件,如下所示
if ( ! defined( 'ABSPATH' ) ) { die; // Prevent direct access. } /** * Require Digital License Manager simple license activation API. */ require_once dirname( __FILE__ ) . '/path/to/vendor/autoload.php'; if ( ! class_exists( 'YourPrefix_License_Checker' ) ) { class YourPrefix_License_Checker extends \IdeoLogix\DigitalLicenseManagerSimpleChecker\Main { } } /** * Returns the DLMs simple license checker instance * @return YourPrefix_License_Checker */ if ( ! function_exists( 'yourprefix_license_checker' ) ) { function yourprefix_license_checker() { static $checker; if ( ! $checker ) { $checker = new \Maspik_CFAS_License_Checker( [ 'name' => 'YourPrefix - Plugin', 'logo' => trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/logo.png', 'prefix' => 'yourprefix_', 'context' => 'plugin', 'public_path' => trailingslashit( dirname( __FILE__ ) ) . 'vendor/ideologix/dlm-wp-simple-checker/public/', // You can override this and set your own path if you want to customzie the views and the assets. 'public_url' => trailingslashit( plugin_dir_url( __FILE__ ) ) . 'vendor/ideologix/dlm-wp-simple-checker/public/', // You can override this and set your own path if you want to customzie the views and the assets. 'consumer_key' => 'ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1', 'consumer_secret' => 'cs_1eef46aeae9ef30571491672fd14b9cfcaf50856', 'api_url' => 'http://digital-license-manager-enabled-site.com/wp-json/dlm/v1/', 'menu' => [ 'page_title' => 'License Activation', 'menu_title' => 'License Activation', 'parent_slug' => 'your-plugin-settings', 'capaibility' => 'manage_options', ] ] ); } return $checker; } } /** * Initialize it! */ yourprefix_license_checker(); /** * @NOTES * * --- ADVANCED USAGE --- * * 1. To check if license is active * if(yourprefix_license_checker()->license()->isLicenseValid())... * 2. To activate the current license * yourprefix_license_checker()->license()->activate('License-key-goes-here') * 3. To deactivate the current license * yourprefix_license_checker()->license()->deactivate() * 4. To remove the license completely (disables if not disabled) * yourprefix_license_checker()->license()->deleteData() */
许可证
This is part of the "Digital License Manager" WordPress plugin.
https://darkog.com/p/digital-license-manager/
Copyright (C) 2020-2024 Darko Gjorgjijoski. All Rights Reserved.
Copyright (C) 2020-2024 IDEOLOGIX MEDIA DOOEL. All Rights Reserved.
Digital License Manager is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
Digital License Manager program is distributed in the hope that it
will be useful,but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License v3
along with this program;
If not, see: https://gnu.ac.cn/licenses/gpl-3.0.en.html
Code written, maintained by Darko Gjorgjijoski (https://darkog.com)