wpbridge/includes/Commercial/Vendors/VendorInterface.php
wenpai 007511a26e feat(ui): 后台全面重设计 — 供应商打通、Tab重构、API简化、诊断合并
供应商更新源打通:
- 新增 VendorHandler 适配器,供应商走标准 SourceResolver 路径
- 供应商激活后自动注册到 SourceRegistry,SourceType 新增 vendor 类型
- 主题接管更新支持(大小写不敏感 slug 匹配)
- 供应商缓存 TTL 优化: 默认 24h,凭据 12h,新增 clear_all_cache()

Tab 重构:
- 项目 Tab 重命名为"更新管理"
- 默认规则 subtab 替换为"更新源" subtab
- 新建 sources-list.php 统一展示预设/供应商/自定义三类源
- 添加更新源改为内联卡片表单(URL+Token,自动识别类型)
- 源连通性测试从诊断页合并到更新源列表(每源测试按钮+批量测试)

API Tab 简化:
- 删除 Bridge Server 配置区,API Tab 纯做服务端管理
- 删除冗余 stats 面板,合并为设置+Keys 两段式布局
- 新增 Hub-Spoke 使用说明,Bridge API URL 自动识别
- API Key 前缀统一为 wpb_

诊断 Tab 砍掉:
- 源测试合入更新源列表,调试日志移到设置 Tab
- 设置页重组: 基本设置 + 维护工具(清缓存/调试) + 导入导出

样式修复:
- Modal 空白问题修复(覆盖全屏遮罩样式冲突)
- wpbridge-mb-4 margin 方向 bug 修复
- 新增 info-box、endpoint-url 等组件样式

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-11 03:22:35 +08:00

119 lines
2.5 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;
/**
* 清除该供应商的所有缓存
*
* @return int 删除条数
*/
public function clear_all_cache(): int;
}