' . sprintf( __( 'WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。',
+ $notices[] = '
' . sprintf( __( 'WP-China-Yes 插件需要 PHP 7.0.0 或更高版本,当前版本为 %s,插件已自动禁用。',
'wp-china-yes' ),
PHP_VERSION ) . '
';
}
@@ -70,7 +79,6 @@ class Plugin {
$notices[] = '
' . __( '检测到不兼容的插件 Kill 429,已自动禁用!', 'wp-china-yes' ) . '
';
-
}
// 代理服务器检测
if ( defined( 'WP_PROXY_HOST' ) || defined( 'WP_PROXY_PORT' ) ) {
diff --git a/Service/Base.php b/Service/Base.php
index 238172e..5938a15 100644
--- a/Service/Base.php
+++ b/Service/Base.php
@@ -12,21 +12,15 @@ defined( 'ABSPATH' ) || exit;
class Base {
public function __construct() {
- /**
- * 插件列表页中所有插件增加「参与翻译」链接
- */
- add_filter( sprintf( '%splugin_action_links', is_multisite() ? 'network_admin_' : '' ), function ( $links, $plugin = '' ) {
- $links[] = '
参与翻译';
- $links[] = '
去广告';
-
- return $links;
- }, 10, 2 );
-
// 加速服务
new Super();
// 监控服务
new Monitor();
// 更新服务
new Update();
+ if ( is_admin() ) {
+ // 设置服务
+ new Setting();
+ }
}
}
diff --git a/Service/Monitor.php b/Service/Monitor.php
index e59aab6..73fb085 100644
--- a/Service/Monitor.php
+++ b/Service/Monitor.php
@@ -17,40 +17,44 @@ class Monitor {
public function __construct() {
$this->settings = get_settings();
+ wp_clear_scheduled_hook( 'wp_china_yes_maybe_check_store' ); // TODO 下个版本移除
+ wp_clear_scheduled_hook( 'wp_china_yes_maybe_check_cravatar' ); // TODO 下个版本移除
+ wp_clear_scheduled_hook( 'wp_china_yes_maybe_check_admincdn' ); // TODO 下个版本移除
if ( $this->settings['monitor'] ) {
- return;
+ // 站点网络下只在主站运行
+ if ( is_main_site() ) {
+ add_action( 'init', [ $this, 'init' ] );
+ add_action( 'wp_china_yes_monitor_hook', [
+ $this,
+ 'run_monitor'
+ ] );
+ }
+ } else {
+ wp_clear_scheduled_hook( 'wp_china_yes_monitor' );
}
-
- add_action( 'init', [ $this, 'init' ] );
- add_action( 'wp_china_yes_maybe_check_store', [
- $this,
- 'maybe_check_store'
- ] );
- add_action( 'wp_china_yes_maybe_check_cravatar', [
- $this,
- 'maybe_check_cravatar'
- ] );
- add_action( 'wp_china_yes_maybe_check_admincdn', [
- $this,
- 'maybe_check_admincdn'
- ] );
}
/**
* 初始化
*/
public function init() {
- // 检查应用市场可用性
- if ( ! wp_next_scheduled( 'wp_china_yes_maybe_check_store' ) && $this->settings['store'] != 'off' ) {
- wp_schedule_event( time(), 'hourly', 'wp_china_yes_maybe_check_store' );
+ if ( ! wp_next_scheduled( 'wp_china_yes_monitor' ) ) {
+ wp_schedule_event( time(), 'hourly', 'wp_china_yes_monitor_hook' );
}
- // 检查初认头像可用性
- if ( ! wp_next_scheduled( 'wp_china_yes_maybe_check_cravatar' ) && $this->settings['cravatar'] != 'off' ) {
- wp_schedule_event( time(), 'hourly', 'wp_china_yes_maybe_check_cravatar' );
+ }
+
+ /**
+ * 运行监控
+ */
+ public function run_monitor() {
+ if ( $this->settings['store'] != 'off' ) {
+ $this->maybe_check_store();
}
- // 检查萌芽加速可用性
- if ( ! wp_next_scheduled( 'wp_china_yes_maybe_check_admincdn' ) && ! empty( $this->settings['admincdn'] ) ) {
- wp_schedule_event( time(), 'hourly', 'wp_china_yes_maybe_check_admincdn' );
+ if ( $this->settings['cravatar'] != 'off' ) {
+ $this->maybe_check_cravatar();
+ }
+ if ( ! empty( $this->settings['admincdn'] ) ) {
+ $this->maybe_check_admincdn();
}
}
@@ -105,7 +109,7 @@ class Monitor {
public function maybe_check_admincdn() {
// 后台加速
if ( in_array( 'admin', $this->settings['admincdn'] ) ) {
- $response = wp_remote_get( 'https://wpstatic.admincdn.com/6.4.3/wp-includes/js/wp-sanitize.min.js' );
+ $response = wp_remote_get( 'https://wpstatic.admincdn.com/6.7/wp-includes/js/wp-sanitize.min.js' );
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 ) {
$this->settings['admincdn'] = array_values( array_diff( $this->settings['admincdn'], [ 'admin' ] ) );
$this->update_settings();
@@ -161,7 +165,7 @@ class Monitor {
if ( is_multisite() ) {
update_site_option( 'wp_china_yes', $this->settings );
} else {
- update_option( 'wp_china_yes', $this->settings );
+ update_option( 'wp_china_yes', $this->settings, true );
}
}
}
diff --git a/Service/Super.php b/Service/Super.php
index 73c5832..c0e10d0 100644
--- a/Service/Super.php
+++ b/Service/Super.php
@@ -54,10 +54,10 @@ HTML;
支持论坛
|
翻译平台
- |
-
文章投稿
|
-
自选新闻源
+
文章投稿
+ |
+
自选新闻源
HTML;
diff --git a/composer.lock b/composer.lock
index 6066563..55fa2ae 100644
--- a/composer.lock
+++ b/composer.lock
@@ -8,16 +8,16 @@
"packages": [
{
"name": "yahnis-elsts/plugin-update-checker",
- "version": "v5.4",
+ "version": "v5.5",
"source": {
"type": "git",
"url": "https://github.com/YahnisElsts/plugin-update-checker.git",
- "reference": "e8e53e6d98e37fa7c895c93417f52e3775494715"
+ "reference": "845d65da93bcff31649ede00d9d73b1beadbb7f0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/e8e53e6d98e37fa7c895c93417f52e3775494715",
- "reference": "e8e53e6d98e37fa7c895c93417f52e3775494715",
+ "url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/845d65da93bcff31649ede00d9d73b1beadbb7f0",
+ "reference": "845d65da93bcff31649ede00d9d73b1beadbb7f0",
"shasum": ""
},
"require": {
@@ -27,7 +27,7 @@
"type": "library",
"autoload": {
"files": [
- "load-v5p4.php"
+ "load-v5p5.php"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -52,9 +52,9 @@
],
"support": {
"issues": "https://github.com/YahnisElsts/plugin-update-checker/issues",
- "source": "https://github.com/YahnisElsts/plugin-update-checker/tree/v5.4"
+ "source": "https://github.com/YahnisElsts/plugin-update-checker/tree/v5.5"
},
- "time": "2024-02-24T09:56:49+00:00"
+ "time": "2024-10-16T14:25:00+00:00"
}
],
"packages-dev": [],
diff --git a/framework/classes/admin-options.class.php b/framework/classes/admin-options.class.php
index 9c250aa..3a9cb9d 100644
--- a/framework/classes/admin-options.class.php
+++ b/framework/classes/admin-options.class.php
@@ -346,7 +346,7 @@ if ( ! class_exists( 'WP_CHINA_YES_Options' ) ) {
} else if ( $this->args['database'] === 'network' ) {
update_site_option( $this->unique, $data );
} else {
- update_option( $this->unique, $data );
+ update_option( $this->unique, $data, true );
}
do_action( "wp_china_yes_{$this->unique}_saved", $data, $this );
diff --git a/framework/functions/actions.php b/framework/functions/actions.php
index b18ed96..f22a70e 100644
--- a/framework/functions/actions.php
+++ b/framework/functions/actions.php
@@ -115,7 +115,7 @@ if ( ! function_exists( 'wp_china_yes_import_ajax' ) ) {
}
// Success
- update_option( $unique, $data );
+ update_option( $unique, $data, true );
wp_send_json_success();
diff --git a/wp-china-yes.php b/wp-china-yes.php
index 278cb81..7db8452 100644
--- a/wp-china-yes.php
+++ b/wp-china-yes.php
@@ -4,7 +4,7 @@
* Description: 文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽,生生不息。
* Author: 文派开源
* Author URI: https://wp-china-yes.com
- * Version: 3.7.0
+ * Version: 3.7.1
* License: GPLv3 or later
* Text Domain: wp-china-yes
* Domain Path: /languages
From adb8efd3207ddbac5366f35a51f93d548e591322 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Tue, 19 Nov 2024 18:12:56 +0800
Subject: [PATCH 18/36] =?UTF-8?q?feat:=20=E6=8F=90=E5=8D=87=E7=89=88?=
=?UTF-8?q?=E6=9C=AC=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Service/Monitor.php | 4 ++--
wp-china-yes.php | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Service/Monitor.php b/Service/Monitor.php
index 73fb085..efb8c63 100644
--- a/Service/Monitor.php
+++ b/Service/Monitor.php
@@ -24,7 +24,7 @@ class Monitor {
// 站点网络下只在主站运行
if ( is_main_site() ) {
add_action( 'init', [ $this, 'init' ] );
- add_action( 'wp_china_yes_monitor_hook', [
+ add_action( 'wp_china_yes_monitor', [
$this,
'run_monitor'
] );
@@ -39,7 +39,7 @@ class Monitor {
*/
public function init() {
if ( ! wp_next_scheduled( 'wp_china_yes_monitor' ) ) {
- wp_schedule_event( time(), 'hourly', 'wp_china_yes_monitor_hook' );
+ wp_schedule_event( time(), 'hourly', 'wp_china_yes_monitor' );
}
}
diff --git a/wp-china-yes.php b/wp-china-yes.php
index 7db8452..1cdd69e 100644
--- a/wp-china-yes.php
+++ b/wp-china-yes.php
@@ -19,7 +19,7 @@ namespace WenPai\ChinaYes;
defined( 'ABSPATH' ) || exit;
-define( 'CHINA_YES_VERSION', '3.7.0' );
+define( 'CHINA_YES_VERSION', '3.7.1' );
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 ) );
From 435ffd698025356ead759a2aee4fc16c4efab0b2 Mon Sep 17 00:00:00 2001
From: devhaozi
Date: Tue, 19 Nov 2024 10:19:27 +0000
Subject: [PATCH 19/36] docs: Update CHANGELOG
---
CHANGELOG.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d10811..d8c5dfa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,13 @@
All notable changes to `WP-China-Yes` will be documented in this file.
+## v3.7.1 - 2024-11-19
+
+1. 性能优化
+2. 修复监控无法关闭的问题
+
+**Full Changelog**: https://github.com/WenPai-org/wp-china-yes/compare/v3.6.5...v3.7.1
+
## v3.6.5 - 2024-08-23
1. 优化 CLI 判断
From 25fdf04fcc342851622f8065ed46ce1a3da09a5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Sun, 8 Dec 2024 02:50:27 +0800
Subject: [PATCH 20/36] feat: check hook before clear
---
Service/Monitor.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Service/Monitor.php b/Service/Monitor.php
index efb8c63..b2be08e 100644
--- a/Service/Monitor.php
+++ b/Service/Monitor.php
@@ -30,7 +30,9 @@ class Monitor {
] );
}
} else {
- wp_clear_scheduled_hook( 'wp_china_yes_monitor' );
+ if ( wp_get_scheduled_event( 'wp_china_yes_monitor' ) ) {
+ wp_clear_scheduled_hook( 'wp_china_yes_monitor' );
+ }
}
}
From a500ff9b6de5953c6d48171bfcf2cc7262af91b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Thu, 12 Dec 2024 23:58:22 +0800
Subject: [PATCH 21/36] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8fa5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Service/Setting.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/Service/Setting.php b/Service/Setting.php
index 80d7fc7..39903d9 100644
--- a/Service/Setting.php
+++ b/Service/Setting.php
@@ -19,7 +19,6 @@ class Setting {
public function __construct() {
$this->settings = get_settings();
add_filter( 'wp_china_yes_enqueue_assets', '__return_true' );
- add_filter( 'wp_china_yes_fa4', '__return_true' );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', [ $this, 'admin_menu' ] );
self::admin_init();
From f2a89c42daa9dd41265486e2d0c16ce3bebc734d Mon Sep 17 00:00:00 2001
From: feng
Date: Sat, 21 Dec 2024 12:06:40 +0800
Subject: [PATCH 22/36] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=96=B0=20UI=20?=
=?UTF-8?q?=E5=8F=8A=E5=9F=9F=E5=90=8D=E6=9B=BF=E6=8D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
更新域名wp-china-yes.com 到 wpcy.com
---
Service/Setting.php | 182 +++++++++--------
assets/css/fonts.css | 0
assets/css/setting.css | 336 ++++++++++++++++++++++++++++---
assets/images/website-banner.jpg | Bin 0 -> 29467 bytes
wp-china-yes.php | 6 +-
5 files changed, 407 insertions(+), 117 deletions(-)
mode change 100644 => 100755 Service/Setting.php
mode change 100644 => 100755 assets/css/fonts.css
mode change 100644 => 100755 assets/css/setting.css
create mode 100755 assets/images/website-banner.jpg
mode change 100644 => 100755 wp-china-yes.php
diff --git a/Service/Setting.php b/Service/Setting.php
old mode 100644
new mode 100755
index 39903d9..376bbc6
--- a/Service/Setting.php
+++ b/Service/Setting.php
@@ -19,6 +19,7 @@ class Setting {
public function __construct() {
$this->settings = get_settings();
add_filter( 'wp_china_yes_enqueue_assets', '__return_true' );
+ add_filter( 'wp_china_yes_fa4', '__return_true' );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', [ $this, 'admin_menu' ] );
self::admin_init();
@@ -46,9 +47,23 @@ class Setting {
'database' => is_multisite() ? 'network' : '',
] );
+ WP_CHINA_YES::createSection( $this->prefix, [
+ 'title' => '欢迎使用',
+ 'icon' => 'icon icon-home-1',
+ 'fields' => [
+ [
+ 'type' => 'content',
+ 'content' =>
+ << 原生体验
文派叶子🍃(WP-China-Yes)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。

特色功能
* 100% 兼容 WP 程序及发行分支版本,更多优秀插件待您体验。
网站加速
优化加速插件多如牛毛,为何文派叶子如此与众不同?
进一步了解 ↗ 翻译推送
高质量翻译中文本地化翻译由文派开源官方提供,欢迎参与改进。
本地化改进 ↗ 加入我们
关注文派茶馆 WPTEA.com 公众号以及订阅我们的时事通讯即可接收独家内容、提示和更新。
+HTML,
+ ]
+ ],
+ ] );
+
WP_CHINA_YES::createSection( $this->prefix, [
'title' => '加速设置',
- 'icon' => 'fa fa-rocket',
+ 'icon' => 'icon icon-flash-1',
'fields' => [
[
'id' => 'store',
@@ -62,7 +77,7 @@ class Setting {
],
'default' => 'wenpai',
'subtitle' => '是否启用市场加速',
- 'desc' => __( '