- 新增 client/ 目录,包含 Bridge 客户端四个模块: - class-site-health.php: 每日站点健康上报(含 WooCommerce 扩展数据) - class-site-identity.php: 站点 UUID 唯一标识 - class-fallback.php: 多级降级策略(Bridge → WordPress.org → 缓存) - wenpai-bridge-client.php: 引导加载器 - Plugin.php 新增 init_bridge_client() 方法,受 bridge 设置开关控制 - 版本号升级至 3.9.0 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>
74 lines
2.8 KiB
PHP
Executable file
74 lines
2.8 KiB
PHP
Executable file
<?php
|
||
/**
|
||
* Plugin Name: WPCY.COM
|
||
* Description: 文派叶子 🍃(WPCY.COM)是中国 WordPress 生态基础设施软件,犹如落叶新芽,生生不息。
|
||
* Author: 文派开源
|
||
* Author URI: https://wpcy.com
|
||
* Version: 3.9.0
|
||
* License: GPLv3 or later
|
||
* Text Domain: wp-china-yes
|
||
* Domain Path: /languages
|
||
* Network: True
|
||
* Requires at least: 4.9
|
||
* Tested up to: 9.9.9
|
||
* Requires PHP: 7.4.0
|
||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||
*/
|
||
|
||
namespace WenPai\ChinaYes;
|
||
|
||
defined( 'ABSPATH' ) || exit;
|
||
|
||
define( 'CHINA_YES_VERSION', '3.9.0' );
|
||
define( 'CHINA_YES_PLUGIN_FILE', __FILE__ );
|
||
define( 'CHINA_YES_PLUGIN_URL', plugin_dir_url( CHINA_YES_PLUGIN_FILE ) );
|
||
define( 'CHINA_YES_PLUGIN_PATH', plugin_dir_path( CHINA_YES_PLUGIN_FILE ) );
|
||
|
||
if (file_exists(CHINA_YES_PLUGIN_PATH . 'vendor/autoload.php')) {
|
||
$settings = is_multisite() ? get_site_option('wp_china_yes') : get_option('wp_china_yes');
|
||
|
||
if (!empty($settings)) {
|
||
if (!defined('WP_MEMORY_LIMIT') && !empty($settings['wp_memory_limit'])) {
|
||
define('WP_MEMORY_LIMIT', $settings['wp_memory_limit']);
|
||
@ini_set('memory_limit', $settings['wp_memory_limit']);
|
||
}
|
||
if (!defined('WP_MAX_MEMORY_LIMIT') && !empty($settings['wp_max_memory_limit'])) {
|
||
define('WP_MAX_MEMORY_LIMIT', $settings['wp_max_memory_limit']);
|
||
}
|
||
if (!defined('WP_POST_REVISIONS') && isset($settings['wp_post_revisions'])) {
|
||
define('WP_POST_REVISIONS', intval($settings['wp_post_revisions']));
|
||
}
|
||
if (!defined('AUTOSAVE_INTERVAL') && !empty($settings['autosave_interval'])) {
|
||
define('AUTOSAVE_INTERVAL', intval($settings['autosave_interval']));
|
||
}
|
||
if (!defined('EMPTY_TRASH_DAYS') && isset($settings['empty_trash_days'])) {
|
||
define('EMPTY_TRASH_DAYS', intval($settings['empty_trash_days']));
|
||
}
|
||
}
|
||
|
||
require_once(CHINA_YES_PLUGIN_PATH . 'vendor/autoload.php');
|
||
|
||
// 初始化翻译管理器
|
||
require_once(CHINA_YES_PLUGIN_PATH . 'Service/TranslationManager.php');
|
||
require_once(CHINA_YES_PLUGIN_PATH . 'Service/LazyTranslation.php');
|
||
\WenPai\ChinaYes\Service\TranslationManager::getInstance();
|
||
|
||
// 包含测试文件(仅在开发环境)
|
||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||
require_once(CHINA_YES_PLUGIN_PATH . 'test-translation.php');
|
||
}
|
||
|
||
} else {
|
||
add_action('admin_notices', function() {
|
||
echo '<div class="notice notice-error"><p>WPCY.COM: Composer autoloader not found. Please run "composer install".</p></div>';
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 注册插件激活钩子
|
||
register_activation_hook( CHINA_YES_PLUGIN_FILE, [ Plugin::class, 'activate' ] );
|
||
// 注册插件删除钩子
|
||
register_uninstall_hook( CHINA_YES_PLUGIN_FILE, [ Plugin::class, 'uninstall' ] );
|
||
|
||
|
||
new Plugin();
|