wpbridge/includes/Commercial/Vendors/VendorInterface.php
feibisi 39b30af242 feat(commercial): add vendor system for third-party GPL plugin sources
- Add VendorInterface, AbstractVendor, VendorManager for vendor abstraction
- Add WooCommerceVendor for WooCommerce API Manager integration
- Add BridgeManager with hybrid mode (official + vendor + custom sources)
- Add GPLValidator for GPL compliance checking
- Add LicenseProxy for license key management
- Add VendorAdmin with AJAX handlers for vendor CRUD operations
- Add vendors.php admin tab with stats, vendor list, custom plugins
- Add vendor management CSS styles and JS module
- Update main.php to include vendors tab

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-15 08:39:37 +08:00

112 lines
2.4 KiB
PHP

<?php
/**
* 供应商接口
*
* 定义第三方 GPL 插件供应商的标准接口
*
* @package WPBridge
* @since 0.9.7
*/
declare(strict_types=1);
namespace WPBridge\Commercial\Vendors;
// 防止直接访问
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* VendorInterface 接口
*/
interface VendorInterface {
/**
* 获取供应商唯一标识
*
* @return string
*/
public function get_id(): string;
/**
* 获取供应商信息
*
* @return array {
* @type string $id 供应商 ID
* @type string $name 供应商名称
* @type string $url 供应商网站
* @type string $api_type API 类型 (wc_am, edd, custom)
* @type bool $requires_key 是否需要 API Key
* }
*/
public function get_info(): array;
/**
* 检查供应商是否可用
*
* @return bool
*/
public function is_available(): bool;
/**
* 获取可用插件列表
*
* @param int $page 页码
* @param int $limit 每页数量
* @return array {
* @type array[] $plugins 插件列表
* @type int $total 总数
* @type int $pages 总页数
* }
*/
public function get_plugins( int $page = 1, int $limit = 100 ): array;
/**
* 搜索插件
*
* @param string $keyword 关键词
* @return array
*/
public function search_plugins( string $keyword ): array;
/**
* 获取插件详情
*
* @param string $slug 插件 slug
* @return array|null
*/
public function get_plugin( string $slug ): ?array;
/**
* 检查插件更新
*
* @param string $slug 插件 slug
* @param string $current_version 当前版本
* @return array|null {
* @type string $version 最新版本
* @type string $download_url 下载链接
* @type string $changelog 更新日志
* @type string $tested 测试的 WP 版本
* @type string $requires 最低 WP 版本
* @type string $requires_php 最低 PHP 版本
* }
*/
public function check_update( string $slug, string $current_version ): ?array;
/**
* 获取下载链接
*
* @param string $slug 插件 slug
* @param string $version 版本号(可选,默认最新)
* @return string|null
*/
public function get_download_url( string $slug, string $version = '' ): ?string;
/**
* 验证供应商授权
*
* @return bool
*/
public function verify_credentials(): bool;
}