wpbridge/wpbridge.php
wenpai e9d28817fe style: phpcbf 自动格式化 — 全量 WPCS 3.x 规范对齐
74 文件 14,082 处自动修复:空格→Tab 缩进、括号间距、
函数声明空格、前置自增、尾逗号等纯格式化改动。
零逻辑变更,php -l + token 级对比验证通过。

新增 phpcs.xml.dist / phpstan.neon.dist 项目配置。

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

73 lines
1.7 KiB
PHP

<?php
/**
* Plugin Name: WPBridge
* Plugin URI: https://wenpai.org/plugins/wpbridge
* Description: 自定义源桥接器 - 让用户完全控制 WordPress 的外部连接
* Version: 1.2.2
* Author: WenPai.org
* Author URI: https://wenpai.org
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wpbridge
* Domain Path: /languages
* Requires at least: 5.9
* Requires PHP: 7.4
* Update URI: https://updates.wenpai.net
*
* @package WPBridge
*/
namespace WPBridge;
// 防止直接访问
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// 插件常量
define( 'WPBRIDGE_VERSION', '1.2.2' );
define( 'WPBRIDGE_FILE', __FILE__ );
define( 'WPBRIDGE_PATH', plugin_dir_path( __FILE__ ) );
define( 'WPBRIDGE_URL', plugin_dir_url( __FILE__ ) );
define( 'WPBRIDGE_BASENAME', plugin_basename( __FILE__ ) );
// 加载自动加载器
require_once WPBRIDGE_PATH . 'includes/Core/Loader.php';
// 初始化插件
function wpbridge_init() {
return Core\Plugin::get_instance();
}
// 激活钩子
register_activation_hook(
__FILE__,
function () {
Core\Plugin::activate();
// 调度后台更新任务
$settings = new Core\Settings();
$updater = new Performance\BackgroundUpdater( $settings );
$updater->schedule_update();
}
);
// 停用钩子
register_deactivation_hook(
__FILE__,
function () {
Core\Plugin::deactivate();
}
);
// WenPai 自更新检查器
require_once WPBRIDGE_PATH . 'includes/class-wenpai-updater.php';
new \WenPai_Updater( WPBRIDGE_BASENAME, WPBRIDGE_VERSION );
// 启动插件
add_action( 'plugins_loaded', __NAMESPACE__ . '\\wpbridge_init' );
// 注册 WP-CLI 命令
if ( defined( 'WP_CLI' ) && WP_CLI ) {
\WP_CLI::add_command( 'bridge', CLI\BridgeCommand::class );
}