参与翻译'; $links[] = '去广告'; return $links; }, 10, 2 ); } /** * 插件兼容性检测函数 */ public static function check() { $notices = []; if ( version_compare( PHP_VERSION, '7.0.0', '<' ) ) { deactivate_plugins( 'wp-china-yes/wp-china-yes.php' ); $notices[] = '

' . sprintf( __( 'WP-China-Yes 插件需要 PHP 7.0.0 或更高版本,当前版本为 %s,插件已自动禁用。', 'wp-china-yes' ), PHP_VERSION ) . '

'; } if ( is_plugin_active( 'wp-china-no/wp-china-no.php' ) ) { deactivate_plugins( 'wp-china-no/wp-china-no.php' ); $notices[] = '

' . __( '检测到旧版插件 WP-China-No,已自动禁用!', 'wp-china-yes' ) . '

'; } if ( is_plugin_active( 'wp-china-plus/wp-china-plus.php' ) ) { deactivate_plugins( 'wp-china-plus/wp-china-plus.php' ); $notices[] = '

' . __( '检测到不兼容的插件 WP-China-Plus,已自动禁用!', 'wp-china-yes' ) . '

'; } if ( is_plugin_active( 'kill-429/kill-429.php' ) ) { deactivate_plugins( 'kill-429/kill-429.php' ); $notices[] = '

' . __( '检测到不兼容的插件 Kill 429,已自动禁用!', 'wp-china-yes' ) . '

'; } // 代理服务器检测 if ( defined( 'WP_PROXY_HOST' ) || defined( 'WP_PROXY_PORT' ) ) { $notices[] = '

' . __( '检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工作!', 'wp-china-yes' ) . '

'; } set_transient( 'wp-china-yes-admin-notices', $notices, 10 ); } /** * 输出管理后台提示信息 */ public function admin_notices() { $notices = get_transient( 'wp-china-yes-admin-notices' ); if ( $notices ) { foreach ( $notices as $notice ) { echo $notice; } delete_transient( 'wp-china-yes-admin-notices' ); } } }