wp-china-yes/wp-china-yes.php
WenPai Dev 13d1d99487 feat: 集成文派云桥客户端 v2.1
- 新增 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>
2026-02-15 09:31:19 +00:00

74 lines
2.8 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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();