设置已保存
- WP中国本土化社区的使命是帮助WordPress在中国建立起良好的本土生态环境,以求推进行业整体发展,做大市场蛋糕。 ' . sprintf( __( 'WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。',
+ 'wp-china-yes' ),
+ PHP_VERSION ) . ' ' . __( '检测到旧版插件 WP-China-No,已自动禁用!', 'wp-china-yes' ) . ' ' . __( '检测到不兼容的插件 WP-China-Plus,已自动禁用!', 'wp-china-yes' ) . ' ' . __( '检测到不兼容的插件 Kill 429,已自动禁用!', 'wp-china-yes' ) . ' ' . __( '检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工作!',
+ 'wp-china-yes' ) . ' 提示:此处选项设置并不与任何文派插件及独立功能扩展冲突,可放心安装启用。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。
- 官方应用市场加速镜像:直接从官方反代并在大陆分发,除了增加对 WP-China-Yes 插件的更新支持外未做任何更改
-
- LitePress 应用市场:该接口处于开发阶段,目前提供了与 LitePress
- 翻译平台 的整合(注意,你可能在使用此接口时遇到未知 BUG,希望能帮忙 反馈)
- 设置已保存
- LitePress社区的使命是帮助WordPress在中国建立起良好的本土生态环境,以求推进行业整体发展,做大市场蛋糕。
-
- 提示:此处选项设置并不与任何文派插件及独立功能扩展冲突,可放心安装启用。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可重新设置或关闭自动监控功能。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。 提示:插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可重新设置或关闭自动监控功能。 帮助:您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,查看联系方式。
+ LitePress社区的使命是帮助WordPress在中国建立起良好的本土生态环境,以求推进行业整体发展,做大市场蛋糕。
特别感谢知更鸟、薇晓朵团队、AppNode在项目萌芽期给予的帮助。
From d01723c7373f9b026547ab3d3a306a7e4c794d8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=99=E9=94=A1=E6=BA=90?=
-[0]: https://wp-china.org
+[0]: https://litepress.cn
-[1]: https://github.com/wp-china/wp-china-yes/releases
+[1]: https://github.com/litepress/wp-china-yes/releases
[2]: http://你的域名/wp-admin/plugin-install.php
-[3]: https://translate.wp-china.org
+[3]: https://litepress.cn/translate/
-[4]: https://github.com/wp-china/wp-china-yes/issues
+[4]: https://github.com/litepress/wp-china-yes/issues
-[5]: https://wp-china.org/forums
+[5]: https://litepress.cn/forums
From e1a6083779cf2d54737ba7f13cca92716aa6e281 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Fri, 8 Mar 2024 20:36:09 +0800
Subject: [PATCH 05/54] =?UTF-8?q?refactor:=20=E5=85=A8=E5=B1=80=E9=87=8D?=
=?UTF-8?q?=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/ISSUE_TEMPLATE/bug_report.yml | 101 +++++
.github/ISSUE_TEMPLATE/config.yml | 5 +
.github/ISSUE_TEMPLATE/feature_request.yml | 55 +++
.github/workflows/update-changelog.yml | 31 ++
.gitignore | 1 +
CHANGELOG.md | 4 +
Plugin.php | 98 +++++
Service/Base.php | 29 ++
Service/Setting.php | 267 +++++++++++++
Service/Super.php | 324 ++++++++++++++++
Service/Update.php | 24 ++
composer.json | 24 ++
composer.lock | 113 ++++++
license | 2 +-
readme.md | 71 ++--
wp-china-yes.php | 416 ++-------------------
16 files changed, 1127 insertions(+), 438 deletions(-)
create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml
create mode 100644 .github/ISSUE_TEMPLATE/config.yml
create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml
create mode 100644 .github/workflows/update-changelog.yml
create mode 100644 .gitignore
create mode 100644 CHANGELOG.md
create mode 100644 Plugin.php
create mode 100644 Service/Base.php
create mode 100644 Service/Setting.php
create mode 100644 Service/Super.php
create mode 100644 Service/Update.php
create mode 100644 composer.json
create mode 100644 composer.lock
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 0000000..1d278bc
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,101 @@
+name: 报告问题 (Bug Report)
+description: 创建一个报告以帮助我们改进 (Create a report to help us improve)
+title: "[Bug Report]: "
+labels: ["bug"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ **请仅使用 简体中文 或 英文 进行填写**
+ **Please only use Simplified Chinese or English to fill in**
+ - type: checkboxes
+ id: checks
+ attributes:
+ label: 在提问之前 (Before asking)
+ description: |
+ 提问之前,先回答几个小问题。
+ Before asking questions, answer a few quick questions.
+ options:
+ - label: 我已经搜索了现有的 Issues 和 Discussions (I've searched the existing Issues and Discussions)
+ required: true
+ - label: 我已经阅读了 README 中除版本记录以外的所有内容 (I've read everything in the README except the version notes)
+ required: true
+ - label: 我在提问题之前至少花费了 5 分钟来思考和准备 (I spend at least 5 minutes thinking and preparing before asking a question)
+ required: true
+ - label: 这个问题出现在最新版的 WP-China-Yes 上 (This question appears on the latest version of WP-China-Yes)
+ required: false
+ - label: 我使用过旧版的 WP-China-Yes 并且没有出现这个问题 (I've used an older version of WP-China-Yes and didn't have this problem)
+ required: false
+ - label: 这个问题出现了至少 3 次 (This question has occurred at least 3 times)
+ required: false
+ - type: textarea
+ id: describe
+ attributes:
+ label: 描述问题 (Describe the problem)
+ description: |
+ 简明概要地描述你遇到的问题。
+ Briefly describe the problem you are having.
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: 预期行为 (Expected behavior)
+ description: |
+ 简明概要地描述你期望发生的事情。
+ Briefly describe what you expect to happen.
+ validations:
+ required: true
+ - type: textarea
+ id: reproduce
+ attributes:
+ label: 如何复现 (How to reproduce)
+ description: |
+ 重现该问题的详细步骤。
+ Detailed steps to reproduce the problem.
+ value: |
+ 1. 安装 WP-China-Yes
+ 2. 设置 '...'
+ 3. 点击 '...'
+ 4. 出现问题
+ validations:
+ required: false
+ - type: textarea
+ id: logs
+ attributes:
+ label: 相关日志 (Related logs)
+ description: |
+ 请复制并粘贴任何相关的日志输出。
+ Please copy and paste any relevant log output.
+ 可以把文件拖入这个区域以添加日志文件。
+ Files can be dragged into this area to add log files.
+ 日志文件可通过开启 WordPress 的调试模式获取。
+ Log files can be accessed by enabling WordPress debug mode.
+ render: Text
+ validations:
+ required: false
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: 截图 (Screenshots)
+ description: |
+ 如果有,添加屏幕截图可帮助更快定位你的问题。
+ If so, adding screenshots can help locate your issue faster.
+ 可以复制图片后在此区域内粘贴以添加图片。
+ Pictures can be copied and pasted in this area to add pictures.
+ 如有必要,使用马赛克遮盖敏感信息。
+ Use a mosaic to obscure sensitive information if necessary.
+ validations:
+ required: false
+ - type: textarea
+ id: others
+ attributes:
+ label: 还有别的吗 (Anything else)
+ description: |
+ 运行环境?浏览器?WordPress 版本?相关的配置?链接?参考资料?
+ Environment? Browser? WordPress version? Related configuration? Link? References?
+ 任何能让我们对你所遇到的问题有更多了解的东西。
+ Anything that can give us more insight into the problem you're having.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 0000000..c117656
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,5 @@
+blank_issues_enabled: false
+contact_links:
+ - name: 讨论、问答和非项目问题 (Discussions, questions, and non-project issues)
+ url: https://jq.qq.com/?_wv=1027&k=I1oJKSTH
+ about: 其他不明之处,请移步我们的QQ群 12370907 (For other unclear things, please move to our qq group 12370907)
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 0000000..5e9619d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,55 @@
+name: 功能请求 (Feature request)
+description: 为这个项目提出一个想法 (Suggest an idea for this project)
+title: "[Feature Request]: "
+labels: ["enhancement"]
+
+body:
+ - type: markdown
+ attributes:
+ value: |
+ **请仅使用 简体中文 或 英文 进行填写**
+ **Please only use Simplified Chinese or English to fill in**
+ - type: checkboxes
+ attributes:
+ label: 在提问之前 (Before asking)
+ description: |
+ 提问之前,先回答几个小问题。
+ Before asking questions, answer a few quick questions.
+ options:
+ - label: 我已经搜索了全部 Issues 和 Commits (I have searched all Issues and Commits)
+ required: true
+ - label: 它们当中没有我将要提交的新功能 (None of them have new feature that I'm going to submit)
+ required: true
+ - type: textarea
+ id: feature
+ attributes:
+ label: 描述功能 (Describe feature)
+ description: |
+ 简明概要地描述你的新功能,以及它将解决什么问题。
+ Briefly describe your new feature and what problem it will solve.
+ validations:
+ required: true
+ - type: textarea
+ id: workflow
+ attributes:
+ label: 工作流程 (Workflow)
+ description: |
+ 请向我们提供有关该功能的实现流程。
+ Please provide us with the implementation flow for this feature.
+ value: |
+ 1. 新建文件 ....
+ 2. 添加函数 ....
+ 3. ...
+ validations:
+ required: true
+ - type: textarea
+ id: others
+ attributes:
+ label: 还有别的吗 (Anything else)
+ description: |
+ 运行环境?浏览器?WordPress 版本?相关的配置?链接?参考资料?
+ Environment? Browser? WordPress version? Related configuration? Link? References?
+ 任何能让我们对该功能的实现有更多帮助的东西。
+ Anything that can help us more with the implementation of this feature.
+ validations:
+ required: false
diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml
new file mode 100644
index 0000000..07e3c7d
--- /dev/null
+++ b/.github/workflows/update-changelog.yml
@@ -0,0 +1,31 @@
+name: "Update Changelog"
+
+on:
+ release:
+ types: [released]
+
+jobs:
+ update:
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ ref: main
+
+ - name: Update Changelog
+ uses: stefanzweifel/changelog-updater-action@v1
+ with:
+ latest-version: ${{ github.event.release.tag_name }}
+ release-notes: ${{ github.event.release.body }}
+
+ - name: Commit updated CHANGELOG
+ uses: stefanzweifel/git-auto-commit-action@v5
+ with:
+ branch: main
+ commit_message: "docs: Update CHANGELOG"
+ file_pattern: CHANGELOG.md
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5657f6e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+vendor
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9d8a8f3
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,4 @@
+# Changelog
+
+All notable changes to `WP-China-Yes` will be documented in this file.
+
diff --git a/Plugin.php b/Plugin.php
new file mode 100644
index 0000000..1d3f726
--- /dev/null
+++ b/Plugin.php
@@ -0,0 +1,98 @@
+
WP-China-Yes
';
+ echo '将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
';
+ echo <<
+ .container {
+ display: flex;
+ flex-wrap: wrap;
+ width: 100%;
+ }
+ .left-column, .right-column {
+ width: 100%;
+ }
+ .left-column {
+ background-color: #f0f0f0;
+ }
+ .right-column {
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ }
+ .card {
+ background-color: #fff;
+ padding: 20px;
+ box-shadow: 0 1px 3px rgba(0,0,0,0.13);
+ border-radius: 4px;
+ }
+ .card h3 {
+ margin-top: 0;
+ }
+ .card a {
+ text-decoration: none;
+ }
+ .card-body, .card-footer {
+ margin: 10px 0;
+ }
+
+ .sponsor-logos {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ }
+
+ .sponsor-logos img {
+ width: 30%;
+ margin-bottom: 12px;
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ height: fit-content;
+ }
+
+ @media (min-width: 768px) {
+ .container {
+ flex-wrap: nowrap;
+ }
+ .left-column {
+ width: 70%;
+ }
+ .right-column {
+ width: 30%;
+ }
+ }
+
+项目简介
+ 赞助商
+
+
+
+
+
+
+
+
+
+
建站套件
+
+
+
-
-
-[0]: https://litepress.cn
-
-[1]: https://github.com/litepress/wp-china-yes/releases
-
-[2]: http://你的域名/wp-admin/plugin-install.php
-
-[3]: https://litepress.cn/translate/
-
-[4]: https://github.com/litepress/wp-china-yes/issues
-
-[5]: https://litepress.cn/forums
+
+
+
+
+
+
+
+
+
diff --git a/wp-china-yes.php b/wp-china-yes.php
index bb73864..3752e6d 100644
--- a/wp-china-yes.php
+++ b/wp-china-yes.php
@@ -1,407 +1,33 @@
page_url = network_admin_url( is_multisite() ? 'settings.php?page=wp-china-yes' : 'options-general.php?page=wp-china-yes' );
- }
+require_once( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' );
- public function init() {
- if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
- /**
- * 插件列表项目中增加设置项
- */
- add_filter( sprintf( '%splugin_action_links_%s', is_multisite() ? 'network_admin_' : '', plugin_basename( __FILE__ ) ), function ( $links ) {
- return array_merge(
- [ sprintf( '%s', $this->page_url, '设置' ) ],
- $links
- );
- } );
+// 注册插件激活钩子
+register_activation_hook( PLUGIN_FILE, [ Plugin::class, 'activate' ] );
+// 注册插件删除钩子
+register_uninstall_hook( PLUGIN_FILE, [ Plugin::class, 'uninstall' ] );
-
- /**
- * 插件列表页中所有插件增加“翻译校准”链接
- */
- // if (get_option('wpapi') == 1) {
- add_filter( sprintf( '%splugin_action_links', is_multisite() ? 'network_admin_' : '' ), function ( $links, $plugin = '' ) {
- $links[] = '参与翻译';
-
- return $links;
- }, 10, 2 );
- //}
-
-
- /**
- * 初始化设置项
- */
- update_option( "wpapi", get_option( 'wpapi' ) ?: '2' );
- update_option( "super_admin", get_option( 'super_admin' ) ?: '2' );
- 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' );
-
-
- /**
- * 禁用插件时删除配置
- */
- register_deactivation_hook( __FILE__, function () {
- delete_option( "wpapi" );
- delete_option( "super_admin" );
- delete_option( "super_gravatar" );
- delete_option( "super_googlefonts" );
- delete_option( "super_googleajax" );
- } );
-
-
- /**
- * 菜单注册
- */
- add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', function () {
- add_submenu_page(
- is_multisite() ? 'settings.php' : 'options-general.php',
- 'WP-China-Yes',
- 'WP-China-Yes',
- is_multisite() ? 'manage_network_options' : 'manage_options',
- 'wp-china-yes',
- [ $this, 'options_page_html' ]
- );
- } );
-
-
- /**
- * 将WordPress核心所依赖的静态文件访问链接替换为公共资源节点
- */
- if (
- get_option( 'super_admin' ) != 2 &&
- ! stristr( $GLOBALS['wp_version'], 'alpha' ) &&
- ! stristr( $GLOBALS['wp_version'], 'beta' ) &&
- ! stristr( $GLOBALS['wp_version'], 'RC' ) &&
- ! isset( $GLOBALS['lp_version'] )
- ) {
- $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' ) );
- }
- }
-
-
- if ( is_admin() || wp_doing_cron() ) {
- add_action( 'admin_init', function () {
- /**
- * wpapi用以标记用户所选的仓库api,数值说明:1 使用LitePress的API,2 只是经代理加速的api.wordpress.org原版API
- */
- register_setting( 'wpcy', 'wpapi' );
-
- /**
- * super_admin用以标记用户是否启用管理后台加速功能
- */
- register_setting( 'wpcy', 'super_admin' );
-
- /**
- * super_gravatar用以标记用户是否启用Cravatar头像功能
- */
- register_setting( 'wpcy', 'super_gravatar' );
-
- /**
- * super_googlefonts用以标记用户是否启用谷歌字体加速功能
- */
- register_setting( 'wpcy', 'super_googlefonts' );
-
- add_settings_section(
- 'wpcy_section_main',
- '将你的WordPress接入本土生态体系中,这将为你提供一个更贴近中国人使用习惯的WordPress',
- '',
- 'wpcy'
- );
-
- add_settings_field(
- 'wpcy_field_select_wpapi',
- '选择应用市场',
- [ $this, 'field_wpapi_cb' ],
- 'wpcy',
- 'wpcy_section_main'
- );
-
- add_settings_field(
- 'wpcy_field_select_super_admin',
- '加速管理后台',
- [ $this, 'field_super_admin_cb' ],
- 'wpcy',
- 'wpcy_section_main'
- );
-
- add_settings_field(
- 'wpcy_field_select_super_gravatar',
- '使用 Cravatar 头像',
- [ $this, 'field_super_gravatar_cb' ],
- 'wpcy',
- 'wpcy_section_main'
- );
-
- add_settings_field(
- 'wpcy_field_select_super_googlefonts',
- '加速谷歌字体',
- [ $this, 'field_super_googlefonts_cb' ],
- 'wpcy',
- 'wpcy_section_main'
- );
-
- add_settings_field(
- 'wpcy_field_select_super_googleajax',
- '加速谷歌前端公共库',
- [ $this, 'field_super_googleajax_cb' ],
- 'wpcy',
- 'wpcy_section_main'
- );
-
- } );
-
- /**
- * 替换api.wordpress.org和downloads.wordpress.org为WP-China.org维护的大陆加速节点
- * URL替换代码来自于我爱水煮鱼(http://blog.wpjam.com/)开发的WPJAM Basic插件
- */
- add_filter( 'pre_http_request', function ( $preempt, $r, $url ) {
- if ( ( ! stristr( $url, 'api.wordpress.org' ) && ! stristr( $url, 'downloads.wordpress.org' ) ) || get_option( 'wpapi' ) == 3 ) {
- return $preempt;
- }
- if ( get_option( 'wpapi' ) == 1 ) {
- $url = str_replace( 'api.wordpress.org', 'api.litepress.cn', $url );
- $url = str_replace( 'downloads.wordpress.org', 'd.w.org.ibadboy.net', $url );
- } else {
- $url = str_replace( 'api.wordpress.org', 'api.w.org.ibadboy.net', $url );
- $url = str_replace( 'downloads.wordpress.org', 'd.w.org.ibadboy.net', $url );
- }
-
- $curl_version = '1.0.0';
- if ( function_exists( 'curl_version' ) ) {
- $curl_version_array = curl_version();
- if ( is_array( $curl_version_array ) && key_exists( 'version', $curl_version_array ) ) {
- $curl_version = $curl_version_array['version'];
- }
- }
-
- // 如果CURL版本小于7.15.0,说明不支持SNI,无法通过HTTPS访问又拍云的节点,故而改用HTTP
- if ( version_compare( $curl_version, '7.15.0', '<' ) ) {
- $url = str_replace( 'https://', 'http://', $url );
- }
-
- return wp_remote_request( $url, $r );
- }, 999999, 3 );
- }
-
-
- if ( ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
- /**
- * 替换谷歌字体为 LitePress 维护的加速节点
- */
- if ( get_option( 'super_googlefonts' ) != 2 ) {
- $this->page_str_replace( 'str_replace', [
- 'fonts.googleapis.com',
- 'googlefonts.wp-china-yes.net'
- ], get_option( 'super_googlefonts' ) );
- }
-
- /**
- * 替换谷歌前端公共库为 LitePress 维护的加速节点
- */
- if ( get_option( 'super_googleajax' ) != 2 ) {
- $this->page_str_replace( 'str_replace', [
- 'ajax.googleapis.com',
- 'googleajax.wp-china-yes.net'
- ], get_option( 'super_googleajax' ) );
- }
-
- }
-
- /**
- * 替换Gravatar头像为Cravatar头像
- */
- if ( get_option( 'super_gravatar' ) == 1 ) {
- if ( ! function_exists( 'get_cravatar_url' ) ) {
- /**
- * 替换Gravatar头像为Cravatar头像
- *
- * Cravatar是Gravatar在中国的完美替代方案,你可以在https://cravatar.cn更新你的头像
- */
- function get_cravatar_url( $url ) {
- $sources = array(
- 'www.gravatar.com',
- '0.gravatar.com',
- '1.gravatar.com',
- '2.gravatar.com',
- 'secure.gravatar.com',
- 'cn.gravatar.com',
- 'gravatar.com',
- );
-
- return str_replace( $sources, 'cravatar.cn', $url );
- }
-
- /**
- * 替换WordPress讨论设置中的默认LOGO名称
- */
- function set_defaults_for_cravatar( $avatar_defaults ) {
- $avatar_defaults['gravatar_default'] = 'Cravatar 标志';
-
- return $avatar_defaults;
- }
-
- /**
- * 替换个人资料卡中的头像上传地址
- */
- function set_user_profile_picture_for_cravatar() {
- return '您可以在 Cravatar 修改您的资料图片';
- }
-
- add_filter( 'user_profile_picture_description', 'set_user_profile_picture_for_cravatar' );
- add_filter( 'avatar_defaults', 'set_defaults_for_cravatar', 1 );
- add_filter( 'um_user_avatar_url_filter', 'get_cravatar_url', 1 );
- add_filter( 'bp_gravatar_url', 'get_cravatar_url', 1 );
- add_filter( 'get_avatar_url', 'get_cravatar_url', 1 );
- }
- }
- }
-
- public function field_wpapi_cb() {
- $wpapi = get_option( 'wpapi' );
- ?>
-
-
-
-
- 特别感谢知更鸟、薇晓朵团队、AppNode在项目萌芽期给予的帮助。
- 项目所需服务器资源由硅云和又拍云提供。
- 赞助商
建站套件
WP-China-Yes
';
- echo '将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
';
+ echo '文派叶子🍃(WP-China-Yes)
将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
文派叶子🍃(WP-China-Yes)
将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
文派叶子🍃(WP-China-Yes)
+ 将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
+ 100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
+项目简介
- 赞助商
-
-
-
-
-
-
-
-
-
-
项目简介
+ 赞助商
+
+
+
+
+
+
+
+
+
+
建站套件
+
+
+ 建站套件
-
-
- 文派叶子🍃(WP-China-Yes)
+ 文派叶子🍃(WP-China-Yes)
将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
diff --git a/Service/Super.php b/Service/Super.php
index d3b0ee4..d103155 100644
--- a/Service/Super.php
+++ b/Service/Super.php
@@ -225,11 +225,11 @@ class Super {
}
if ( $this->settings['store'] == 'wenpai' ) {
- $url = str_replace( 'api.wordpress.org', 'api.wenpai.org', $url );
+ $url = str_replace( 'api.wordpress.org', 'api.wenpai.net', $url );
} else {
- $url = str_replace( 'api.wordpress.org', 'wpa.cdn.haozi.net', $url );
+ $url = str_replace( 'api.wordpress.org', 'api.wpmirror.com', $url );
}
- $url = str_replace( 'downloads.wordpress.org', 'wpd.cdn.haozi.net', $url );
+ $url = str_replace( 'downloads.wordpress.org', 'downloads.wenpai.net', $url );
$curl_version = '1.0.0';
if ( function_exists( 'curl_version' ) ) {
diff --git a/Service/Update.php b/Service/Update.php
index daccdd7..e102b82 100644
--- a/Service/Update.php
+++ b/Service/Update.php
@@ -15,7 +15,7 @@ class Update {
public function __construct() {
PucFactory::buildUpdateChecker(
- 'https://api.wenpai.org/china-yes/version-check',
+ 'https://api.wenpai.net/china-yes/version-check',
CHINA_YES_PLUGIN_FILE,
'wp-china-yes'
);
From 7d38bc7adc8abfb7592856e9b5bdd66c8698ed9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=96=87=E6=B4=BE=E5=A4=87=E6=A1=88?=
<130886204+modiqi@users.noreply.github.com>
Date: Sat, 9 Mar 2024 15:57:44 +0800
Subject: [PATCH 12/54] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20UI=20=E6=A0=B7?=
=?UTF-8?q?=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
调整字体大小
---
Service/Setting.php | 2 +-
assets/css/setting.css | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Service/Setting.php b/Service/Setting.php
index 588d1bb..aed8de9 100644
--- a/Service/Setting.php
+++ b/Service/Setting.php
@@ -68,7 +68,7 @@ class Setting {
[
'name' => 'cravatar',
'label' => __( '初认头像', 'wp-china-yes' ),
- 'desc' => __( '初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 https://cravatar.com 上传头像,更多选项请安装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 WordPress)',
+ 'desc' => __( '初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请安装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 WordPress)',
'wp-china-yes' ),
'type' => 'radio',
'default' => 'cn',
diff --git a/assets/css/setting.css b/assets/css/setting.css
index de2b0e5..5a1bfdb 100644
--- a/assets/css/setting.css
+++ b/assets/css/setting.css
@@ -5,7 +5,9 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
#wpcontent, #wpfooter {
background-color: #ffffff;
}
-
+#wpbody-content {
+ padding-bottom: 10%;
+}
.notice {
background-color: #f5f5f5;
}
@@ -72,6 +74,10 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
margin: 0 auto;
line-height: 1.5;
}
+.settings-header .update-messages h2, .update-php h2, h4 {
+ font-size: 15px;
+ font-weight: 400;
+}
.settings-title-section {
padding: 1% 0;
From 2c86b5c546acb16a1398dec3b3b24211af118f42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Sat, 9 Mar 2024 18:23:41 +0800
Subject: [PATCH 13/54] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=B5=8B?=
=?UTF-8?q?=E8=AF=95=20URL=20=E5=8F=8A=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Service/Monitor.php | 4 ++--
assets/css/setting.css | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/Service/Monitor.php b/Service/Monitor.php
index d80b9f3..c244f9b 100644
--- a/Service/Monitor.php
+++ b/Service/Monitor.php
@@ -127,7 +127,7 @@ class Monitor {
}
// Google 前端公共库
if ( ! empty( $this->settings['admincdn']['googleajax'] ) ) {
- $response = wp_remote_get( 'https://googleajax.admincdn.com/ajax/libs/jquery/3.5.1/jquery.min.js' );
+ $response = wp_remote_get( 'https://googleajax.admincdn.com/ajax/libs/jquery/3.7.1/jquery.slim.min.js' );
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 ) {
unset( $this->settings['admincdn']['googleajax'] );
$this->update_settings();
@@ -135,7 +135,7 @@ class Monitor {
}
// CDNJS 前端公共库
if ( ! empty( $this->settings['admincdn']['cdnjs'] ) ) {
- $response = wp_remote_get( 'https://cdnjs.admincdn.com/jquery/3.5.1/jquery.min.js' );
+ $response = wp_remote_get( 'https://cdnjs.admincdn.com/jquery/3.7.1/jquery.slim.min.js' );
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 ) {
unset( $this->settings['admincdn']['cdnjs'] );
$this->update_settings();
diff --git a/assets/css/setting.css b/assets/css/setting.css
index 5a1bfdb..99975fb 100644
--- a/assets/css/setting.css
+++ b/assets/css/setting.css
@@ -5,9 +5,11 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
#wpcontent, #wpfooter {
background-color: #ffffff;
}
+
#wpbody-content {
padding-bottom: 10%;
}
+
.notice {
background-color: #f5f5f5;
}
@@ -74,6 +76,7 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
margin: 0 auto;
line-height: 1.5;
}
+
.settings-header .update-messages h2, .update-php h2, h4 {
font-size: 15px;
font-weight: 400;
@@ -123,4 +126,4 @@ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockq
.right-column {
width: 30%;
}
-}
\ No newline at end of file
+}
From c947537af6b687b090456227539a080fbaa26ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=80=97=E5=AD=90?=
Date: Sat, 9 Mar 2024 19:36:59 +0800
Subject: [PATCH 14/54] =?UTF-8?q?feat:=20=E5=8F=91=E5=B8=83=20v3.6.2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
wp-china-yes.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/wp-china-yes.php b/wp-china-yes.php
index 54094cc..fe0b3e5 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.6.1
+ * Version: 3.6.2
* License: GPLv3 or later
* Text Domain: wp-china-yes
* Domain Path: /languages
@@ -19,7 +19,7 @@ namespace WenPai\ChinaYes;
defined( 'ABSPATH' ) || exit;
-define( 'CHINA_YES_VERSION', '3.6.1' );
+define( 'CHINA_YES_VERSION', '3.6.2' );
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 ce026464632dc0565dc938b5404daf873b398815 Mon Sep 17 00:00:00 2001
From: devhaozi
+
+
+
+
+
+
+
+
+
+
+HTML,
+ ],
+ [
+ 'type' => 'subheading',
+ 'content' => '开发者 & 贡献者',
+ ],
+ [
+ 'type' => 'content',
+ 'content' =>
+ <<孙锡源 |
+耗子 |
+Yulinn |
+赵丰 |
+jialong Dong |
+TigerKK |
+xianyu125 |
+ElliotHughes |
+诗语 |
+莫蒂奇 |
+薇晓朵
+HTML,
+ ]
+ ],
+ ] );
}
/**
@@ -137,15 +398,6 @@ class Setting {
* 挂载设置页面
*/
public function admin_menu() {
- // 后台设置
- add_submenu_page(
- is_multisite() ? 'settings.php' : 'options-general.php',
- esc_html__( 'WP-China-Yes', 'wp-china-yes' ),
- esc_html__( 'WP-China-Yes', 'wp-china-yes' ),
- is_multisite() ? 'manage_network_options' : 'manage_options',
- 'wp-china-yes',
- [ $this, 'setting_page' ]
- );
// 插件页设置
add_filter( 'plugin_action_links', function ( $links, $file ) {
if ( 'wp-china-yes/wp-china-yes.php' !== $file ) {
@@ -159,76 +411,4 @@ class Setting {
return $links;
}, 10, 2 );
}
-
- /**
- * 设置页面模版
- */
- public function setting_page() {
- echo <<
-
文派叶子🍃(WP-China-Yes)
- 将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。
- 100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。
-
-项目简介
- 赞助商
-
-
-
-
-
-
-
-
-
-
建站套件
-
-
-
' . sprintf( __( 'WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。', + $notices[] = '
' . sprintf( __( 'WP-China-Yes 插件需要 PHP 7.0.0 或更高版本,当前版本为 %s,插件已自动禁用。', 'wp-china-yes' ), PHP_VERSION ) . '
' . __( '检测到不兼容的插件 Kill 429,已自动禁用!', 'wp-china-yes' ) . '
5n
zv^`og$WLg1xT430^$rKri<*HipeXlN!mX}~$Q5Y0 ywe~qPF#y
z&+j-cP;cPOqZz>tA6IFXggw=?q+S`${u;kfrh8R1wH}W3 Ftt!29
zJO@0|9`S@agim}6j)1!B3N{3F9N*?mFmR!yiXtN#A-2c<_;q{C*Ua3zLQx9^fB8$a
z%1|;s9LDu6zZCCN_vX8mzS-khllPAZjyyXbE3+C&Y=ZeJ!iBz6!H~H+xq12 %s =446-?1#-HiznqaiG4Y5
z?;H$Q)2wR%zKSgc+juKq(;}|dwF2+qD0BX(rd~PIX;a!d4%8Qi@k&VlOd7^g?*4pN
z^6={ ^Ed(y<2t}eKTT|}M>Yl7H9Ltz^xZXT1(gbW4j6I|
zaw&*p1@VNk<>yG~W9I9>{W43&_t4GJ9sZ`mCtCr??w8z|<=ZYu$B}7G5UlYoZPIM;
z6bRL^)Vv(tr5L7v1TR57N1%bg7dy1V%;IA+`_9mlnVM4%{fY`b+=3SG2A=Qma$vBy
zRf8t*ZO14_x;M0OM>wVmJ}k?%@9DK2l7lohu=@JJzyAzEUhSWez|^gtr4J
zYSwO?T^pNr4HB}bXTC}W92kXFOv^lt7!jaoOVp;pEh`wexGv%E)%vbYcR$n3-D_i?
zeU`3^6Td&7b0>0sy+GViLkO!+RigoR28Y)@@EpTms(t6rS>!51skdn|j1_`Hbu0@EVJ*k%VRh*mchsQ0i4bPop(y9^Ypk
zy2G0WOvp*P!&q?VEop$7(I&?^;o!a*_2>_~lD_iId67>&KNup9&K!0cIV>#^jth0w
z{xeJ}vsY?oeLd=rB1&u$?&QT3a#oVZ_GZbN(0Y3hIgIF3L#Ig}u_mDxDk{wJxop`%
zI1
-
-
-
-
-
-
-
-
+
+
From 33e05459654bb2ae731d1b2f8a086f24ec503255 Mon Sep 17 00:00:00 2001
From: feng
+
From 9ea04f6ac47c7692871035abd8929d22dcb01cb7 Mon Sep 17 00:00:00 2001
From: feng
+
## 简介
-文派叶子 🍃(WP-China-Yes)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。项目起源于 2019 年,专为解决困扰了中国互联网数十年的特色问题而存在。此为文派开源(WenPai.org)的一部分。
+文派叶子 🍃(WPCY)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。项目起源于 2019 年,专为解决困扰了中国互联网数十年的特色问题而存在。此为文派开源(WenPai.org)的一部分。
## 功能
@@ -16,6 +19,14 @@
- [x] 优化 谷歌字体 加载速度
- [x] 优化 谷歌前端库 加载速度
- [x] 优化 CDNJS 加载速度
+- [x] 优化 Jsdelivr 加载速度
+- [x] 集成 WPMirror 镜像更新源
+- [x] 集成 Windfonts 中文网页 Webfonts [文风字体](https://windfonts.com)
+- [x] 集成 adminCDN 前端公共库[文风字体](https://windfonts.com)
+- [x] 启用 飞行模式 可屏蔽外部 API 请求
+- [x] 启用 节点监控 可自动切换加速节点
+- [x] 启用 品牌白标 可自定义 OEM 插件品牌
+
## 安装
@@ -33,5 +44,4 @@
## 赞助商
-
-
+
From 7e08f3392336d5cd01c26a3af15627bc040d6657 Mon Sep 17 00:00:00 2001
From: feng
## 简介
-
文派叶子 🍃(WPCY)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。项目起源于 2019 年,专为解决困扰了中国互联网数十年的特色问题而存在。此为文派开源(WenPai.org)的一部分。
## 功能
@@ -22,7 +23,7 @@
- [x] 优化 Jsdelivr 加载速度
- [x] 集成 WPMirror 镜像更新源
- [x] 集成 Windfonts 中文网页 Webfonts [文风字体](https://windfonts.com)
-- [x] 集成 adminCDN 前端公共库[文风字体](https://windfonts.com)
+- [x] 集成 adminCDN 前端公共库[萌芽加速](https://admincdn.com)
- [x] 启用 飞行模式 可屏蔽外部 API 请求
- [x] 启用 节点监控 可自动切换加速节点
- [x] 启用 品牌白标 可自定义 OEM 插件品牌
From 8d3a71414d1fc4a8c5983a8fa29ab66539a4a5c2 Mon Sep 17 00:00:00 2001
From: feng
%s
x>{vM{-B`2k2gPW0mGPg
zjYsC6CiJ{JCo^IlatgGJfi?lfS5W(Zk7$`C|Kwgx^yJchVV3&$h%|Bj8u4W3dW3Xq
zry6TU{R?gg5)l1u32)pfHhT`1`OzjI`ZKNcm$+WfOnH+MGj|@$HH=1fAV&;PJ>h1A
z^@4BdaPj4336+KR&FmS1V^5T0g!SKqP(U`{jKn
d{R`f8z7VXu(ouW>&J-cj#I#J~oFCkuMxj
z^%FRkt}@g`>Cuaqimv?YZxs^PP4Q3CKkQ5`%Kil~xZ@Dt?n&it4fQwghc&yFns}9G
zV##>B1+uO8ShS~kMkQf>d21XinUDChZNLx9lD|9~d!6mxaq^gD!$6=pZcX9N=*(23
zANvii?Ji2lJ?65d^#j|o`J>Mt`8$OU;`kgFr@cF~$!O(u##q!;G0j!WLP0d#WfJsj
z6Dv6|R^8^{8(zKO+g}u)9FOGak0iOo*tdy=mpHj%6DhCV(k;d6Bt=iJnZf$LaAJ4V
zfWWAHHEBfyigXUd3Q>#yUq|LblCbW;?3B#Iz2~Z}#N*3y-~Ez-iz->6&m=hs0bwuV
zjtDE^{WZ2&{r%iLIPfb3(cIa{ebYnshd(rM*aO1r5FMzsxPQEjIS5I>v_wZL^9|uDpda?JsA8f?@
zDG7fRe4L|<->MW8|Jt=f@%+Q4z|YEK{f_<}(kKJ}kAB@O$F}dOmCv_wB7eSS7y4gZ
z71B|C_9MzW5Xlb2TndF%X03SeQClXM#qzY+C~}#V8synD>8BQ--7xWxP#~^spSZ)*
zlS5DdFX!+638}M;D=!0IoO0ZGss0yG_2Q6@Tl-HMCMotM