From baa486cff93f4bf4c17de80ace616004f13f5d44 Mon Sep 17 00:00:00 2001 From: sunxiyuan Date: Wed, 7 Oct 2020 10:37:33 +0800 Subject: [PATCH 001/104] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=86=97=E4=BD=99=E6=9D=A1=E4=BB=B6=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-china-yes.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/wp-china-yes.php b/wp-china-yes.php index ceaec97..d884cea 100644 --- a/wp-china-yes.php +++ b/wp-china-yes.php @@ -35,12 +35,10 @@ class WP_CHINA_YES { /** * 初始化设置项 */ - if (empty(get_option('wpapi')) || empty(get_option('super_admin')) || empty(get_option('super_gravatar')) || empty(get_option('super_googlefonts'))) { - update_option("wpapi", get_option('wpapi') ?: '2'); - update_option("super_admin", get_option('super_admin') ?: '1'); - update_option("super_gravatar", get_option('super_gravatar') ?: '1'); - update_option("super_googlefonts", get_option('super_googlefonts') ?: '2'); - } + update_option("wpapi", get_option('wpapi') ?: '2'); + update_option("super_admin", get_option('super_admin') ?: '1'); + update_option("super_gravatar", get_option('super_gravatar') ?: '1'); + update_option("super_googlefonts", get_option('super_googlefonts') ?: '2'); /** From 2958937f09bfc60e41ef00e8e432a81e8222d68e Mon Sep 17 00:00:00 2001 From: sunxiyuan Date: Wed, 7 Oct 2020 10:42:15 +0800 Subject: [PATCH 002/104] =?UTF-8?q?=E7=89=B9=E6=80=A7=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=B0=B7=E6=AD=8C=E5=89=8D=E7=AB=AF=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E5=BA=93=E5=8A=A0=E9=80=9F=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-china-yes.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/wp-china-yes.php b/wp-china-yes.php index d884cea..500fc2e 100644 --- a/wp-china-yes.php +++ b/wp-china-yes.php @@ -39,6 +39,7 @@ class WP_CHINA_YES { update_option("super_admin", get_option('super_admin') ?: '1'); update_option("super_gravatar", get_option('super_gravatar') ?: '1'); update_option("super_googlefonts", get_option('super_googlefonts') ?: '2'); + update_option("super_googleajax", get_option('super_googleajax') ?: '2'); /** @@ -140,6 +141,14 @@ class WP_CHINA_YES { 'wpcy', 'wpcy_section_main' ); + + add_settings_field( + 'wpcy_field_select_super_googleajax', + '加速谷歌前端公共库', + [$this, 'field_super_googleajax_cb'], + 'wpcy', + 'wpcy_section_main' + ); }); /** @@ -191,6 +200,17 @@ class WP_CHINA_YES { }); }); } + + /** + * 替换谷歌前端公共库为WP-China.org维护的大陆加速节点 + */ + if (get_option('super_googleajax') == 1) { + add_action('init', function () { + ob_start(function ($buffer) { + return str_replace('ajax.googleapis.com', 'googleajax.wp-china-yes.net', $buffer); + }); + }); + } } } @@ -260,12 +280,28 @@ class WP_CHINA_YES { + + +

+ 请只在主题包含谷歌前端公共库的情况下才启用该选项,以免造成不必要的性能损失 +

+

设置已保存

'; } From 0ee8c8a937109536f48d533dd3fe142d860ae400 Mon Sep 17 00:00:00 2001 From: sunxiyuan Date: Wed, 7 Oct 2020 10:42:25 +0800 Subject: [PATCH 003/104] =?UTF-8?q?=E7=89=B9=E6=80=A7=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7=E5=88=B03.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-china-yes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-china-yes.php b/wp-china-yes.php index 500fc2e..78224d1 100644 --- a/wp-china-yes.php +++ b/wp-china-yes.php @@ -4,7 +4,7 @@ * Description: 将你的WordPress接入本土生态体系中,这将为你提供一个更贴近中国人使用习惯的WordPress * Author: WP中国本土化社区 * Author URI:https://wp-china.org/ - * Version: 3.1.3 + * Version: 3.2.0 * Network: True * License: GPLv3 or later * License URI: http://www.gnu.org/licenses/gpl-3.0.html From c52ed2afaac99e8c12b3315258345d5c639725b0 Mon Sep 17 00:00:00 2001 From: sunxiyuan Date: Wed, 7 Oct 2020 12:06:06 +0800 Subject: [PATCH 004/104] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E4=B8=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-china-yes.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/wp-china-yes.php b/wp-china-yes.php index 78224d1..5c63905 100644 --- a/wp-china-yes.php +++ b/wp-china-yes.php @@ -72,11 +72,10 @@ class WP_CHINA_YES { * 将WordPress核心所依赖的静态文件访问链接替换为公共资源节点 */ if (get_option('super_admin') == 1) { - add_action('init', function () { - ob_start(function ($buffer) { - return preg_replace('~' . home_url('/') . '(wp-admin|wp-includes)/(css|js)/~', sprintf('https://a2.wp-china-yes.net/WordPress@%s/$1/$2/', $GLOBALS['wp_version']), $buffer); - }); - }); + $this->page_str_replace('preg_replace', [ + '~' . home_url('/') . '(wp-admin|wp-includes)/(css|js)/~', + sprintf('https://a2.wp-china-yes.net/WordPress@%s/$1/$2/', $GLOBALS['wp_version']) + ]); } } @@ -194,22 +193,14 @@ class WP_CHINA_YES { * 替换谷歌字体为WP-China.org维护的大陆加速节点 */ if (get_option('super_googlefonts') == 1) { - add_action('init', function () { - ob_start(function ($buffer) { - return str_replace('fonts.googleapis.com', 'googlefonts.wp-china-yes.net', $buffer); - }); - }); + $this->page_str_replace('str_replace', ['fonts.googleapis.com', 'googlefonts.wp-china-yes.net']); } /** * 替换谷歌前端公共库为WP-China.org维护的大陆加速节点 */ if (get_option('super_googleajax') == 1) { - add_action('init', function () { - ob_start(function ($buffer) { - return str_replace('ajax.googleapis.com', 'googleajax.wp-china-yes.net', $buffer); - }); - }); + $this->page_str_replace('str_replace', ['ajax.googleapis.com', 'googleajax.wp-china-yes.net']); } } } @@ -328,4 +319,13 @@ class WP_CHINA_YES {

Date: Wed, 7 Oct 2020 12:21:11 +0800 Subject: [PATCH 005/104] =?UTF-8?q?=E7=89=B9=E6=80=A7=EF=BC=9A=E7=BB=86?= =?UTF-8?q?=E5=8C=96=E5=90=8E=E5=8F=B0=E6=8E=A7=E5=88=B6=E7=9A=84=E9=A2=97?= =?UTF-8?q?=E7=B2=92=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-china-yes.php | 63 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/wp-china-yes.php b/wp-china-yes.php index 5c63905..03e8acc 100644 --- a/wp-china-yes.php +++ b/wp-china-yes.php @@ -71,11 +71,11 @@ class WP_CHINA_YES { /** * 将WordPress核心所依赖的静态文件访问链接替换为公共资源节点 */ - if (get_option('super_admin') == 1) { + if (get_option('super_admin') != 2) { $this->page_str_replace('preg_replace', [ '~' . home_url('/') . '(wp-admin|wp-includes)/(css|js)/~', sprintf('https://a2.wp-china-yes.net/WordPress@%s/$1/$2/', $GLOBALS['wp_version']) - ]); + ], get_option('super_admin')); } } @@ -192,15 +192,15 @@ class WP_CHINA_YES { /** * 替换谷歌字体为WP-China.org维护的大陆加速节点 */ - if (get_option('super_googlefonts') == 1) { - $this->page_str_replace('str_replace', ['fonts.googleapis.com', 'googlefonts.wp-china-yes.net']); + if (get_option('super_googlefonts') != 2) { + $this->page_str_replace('str_replace', ['fonts.googleapis.com', 'googlefonts.wp-china-yes.net'], get_option('super_googlefonts')); } /** * 替换谷歌前端公共库为WP-China.org维护的大陆加速节点 */ - if (get_option('super_googleajax') == 1) { - $this->page_str_replace('str_replace', ['ajax.googleapis.com', 'googleajax.wp-china-yes.net']); + if (get_option('super_googleajax') != 2) { + $this->page_str_replace('str_replace', ['ajax.googleapis.com', 'googleajax.wp-china-yes.net'], get_option('super_googleajax')); } } } @@ -245,7 +245,13 @@ class WP_CHINA_YES { $super_gravatar = get_option('super_gravatar'); ?> + +