diff --git a/Service/Super.php b/Service/Super.php index 1597550..38518cf 100644 --- a/Service/Super.php +++ b/Service/Super.php @@ -159,15 +159,10 @@ class Super { * 前台静态加速 */ if ( ! empty( $this->settings['admincdn']['frontend'] ) ) { - add_action( 'template_redirect', function () { - ob_start( function ( $content ) { - $regex = '#(?<=[(\"\'])(?:' . quotemeta( home_url() ) . ')?/(?:((?:wp-content|wp-includes)[^\"\')]+\.(css|js)[^\"\')]+))(?=[\"\')])#'; - - return preg_replace_callback( $regex, function ( $asset ) { - return 'https://public.admincdn.com/' . $asset[0]; - }, $content ); - } ); - } ); + $this->page_str_replace( 'preg_replace', [ + '#(?<=[(\"\'])(?:' . quotemeta( home_url() ) . ')?/(?:((?:wp-content|wp-includes)[^\"\')]+\.(css|js)[^\"\')]+))(?=[\"\')])#', + 'https://public.admincdn.com/$0' + ] ); } /** @@ -309,7 +304,11 @@ class Super { * WordPress 讨论设置中的默认 LOGO 名称替换 */ public function set_defaults_for_cravatar( $avatar_defaults ) { - $avatar_defaults['gravatar_default'] = '初认头像'; + if ( $this->settings['cravatar'] == 'weavatar' ) { + $avatar_defaults['gravatar_default'] = 'WeAvatar'; + } else { + $avatar_defaults['gravatar_default'] = '初认头像'; + } return $avatar_defaults; } @@ -318,7 +317,11 @@ class Super { * 个人资料卡中的头像上传地址替换 */ public function set_user_profile_picture_for_cravatar() { - return '您可以在初认头像修改您的资料图片'; + if ( $this->settings['cravatar'] == 'weavatar' ) { + return '您可以在 WeAvatar 修改您的资料图片'; + } else { + return '您可以在初认头像修改您的资料图片'; + } } /** @@ -328,12 +331,16 @@ class Super { * @param $param array 传递给字符串替换函数的参数 */ private function page_str_replace( $replace_func, $param ) { - add_action( 'init', function () use ( $replace_func, $param ) { + // CLI 下返回,防止影响缓冲区 + if ( class_exists( 'WP_CLI' ) ) { + return; + } + add_action( 'template_redirect', function () use ( $replace_func, $param ) { ob_start( function ( $buffer ) use ( $replace_func, $param ) { $param[] = $buffer; return call_user_func_array( $replace_func, $param ); } ); - }, 999999 ); + }, PHP_INT_MAX ); } } diff --git a/languages/wp-china-yes-en_US.mo b/languages/wp-china-yes-en_US.mo new file mode 100644 index 0000000..4c31d56 Binary files /dev/null and b/languages/wp-china-yes-en_US.mo differ diff --git a/languages/wp-china-yes-en_US.po b/languages/wp-china-yes-en_US.po new file mode 100644 index 0000000..9e7e54b --- /dev/null +++ b/languages/wp-china-yes-en_US.po @@ -0,0 +1,171 @@ +msgid "" +msgstr "" +"Project-Id-Version: WP-China-Yes\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-23 03:41+0000\n" +"PO-Revision-Date: 2024-08-23 12:21+0800\n" +"Last-Translator: \n" +"Language-Team: English (United States)\n" +"Language: en_US\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Poedit 3.4.4\n" +"X-Loco-Version: 2.6.11; wp-6.6\n" +"X-Domain: wp-china-yes\n" + +#: Service/Setting.php:54 +msgid "" +"萌芽加速(adminCDN)" +"将 WordPress 依赖的静态文件切换为公共资源,加快网站访问速度。您可按需启用需要" +"加速的项目,更多细节控制和功能,请关注 adminCDN 项目。" +msgstr "" +"adminCDN switches " +"the static files that WordPress relies on to public resources to speed up " +"website access. You can enable the projects that need to be accelerated as " +"needed. For more detailed control and functions, please pay attention to the " +"adminCDN project." + +#: Service/Setting.php:72 +msgid "" +"初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请安" +"装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 " +"WordPress)" +msgstr "" +"Cravatar is a " +"perfect alternative to Gravatar in China. You can upload your avatar on " +"Cravatar.com. For more options, please install the WPAavatar plugin. (Any " +"developer can integrate this service into their own products, not limited to " +"WordPress)" + +#: Service/Setting.php:86 +msgid "" +"文风字体(Windfonts)为您的网页渲染中文字体并对主题、插件内的字体进行加速;优化模式可优化浏览器" +"字体调用。" +msgstr "" +"Windfonts renders " +"Chinese fonts for your web pages and accelerates fonts in themes and plug-" +"ins; the optimization mode can optimize browser font calls." + +#: Service/Setting.php:109 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)支持自动监控各加速节点可用性,当节点不可用时自动切换至可用节点" +"或关闭加速,以保证您的网站正常访问。" +msgstr "" +"WP-China-Yes 🍃 " +"(文派叶子) supports automatic monitoring of the availability of each " +"acceleration node. When a node is unavailable, it automatically switches to " +"an available node or turns off acceleration to ensure normal access to your " +"website." + +#: Service/Setting.php:98 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)独家特色功能,让您拥有清爽整洁的 WordPress 后台,清除各类常用" +"插件侵入式后台广告、通知及无用信息;启用后若存在异常拦截,请切换为手动模式," +"查看可优化插件列表。" +msgstr "" +"WP-China-Yes 🍃 " +"(文派叶子) unique features allow you to have a clean and tidy WordPress " +"backend, removing all kinds of intrusive backend ads, notifications and " +"useless information from commonly used plugins; if there is abnormal " +"interception after enabling, please switch to manual mode and check the list of optimizable " +"plugins." + +#: Service/Setting.php:41 +msgid "" +"官方加速源(WPMirror)直接从 .org 反代至大陆分发;文派开源(WenPai.org)中国境内自建托管仓库,同时集成文" +"派翻译平台。" +msgstr "" +"The official " +"acceleration source (WPMirror) is directly reverse-generated from .org " +"to the mainland for distribution; WenPai.org Open Source has its own hosting warehouse " +"in China and is integrated with the WenPai translation platform." + +#. Author URI of the plugin +msgid "https://wp-china-yes.com" +msgstr "https://wp-china-yes.com" + +#. Name of the plugin +#: Service/Setting.php:143 Service/Setting.php:144 +msgid "WP-China-Yes" +msgstr "WP-China-Yes" + +#: Plugin.php:52 +#, php-format +msgid "" +"WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。" +msgstr "" +"The WP-China-Yes plugin requires PHP 5.6.0 or higher. The current version is " +"%s and the plugin has been automatically disabled." + +#: Service/Setting.php:71 +msgid "初认头像" +msgstr "Cravatar" + +#: Service/Setting.php:97 +msgid "广告拦截" +msgstr "Ad Blocker" + +#: Service/Setting.php:40 +msgid "应用市场" +msgstr "App Market" + +#. Description of the plugin +msgid "" +"文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽," +"生生不息。" +msgstr "" +"WP-China-Yes 🍃 (文派叶子) is the infrastructure software for the Chinese " +"WordPress ecosystem, just like fallen leaves sprouting new leaves, it is " +"everlasting." + +#. Author of the plugin +msgid "文派开源" +msgstr "WenPai.org" + +#: Service/Setting.php:85 +msgid "文风字体" +msgstr "Windfonts" + +#: Plugin.php:71 +msgid "检测到不兼容的插件 Kill 429,已自动禁用!" +msgstr "Incompatible plugin Kill 429 detected, automatically disabled!" + +#: Plugin.php:65 +msgid "检测到不兼容的插件 WP-China-Plus,已自动禁用!" +msgstr "Incompatible plugin WP-China-Plus detected and automatically disabled!" + +#: Plugin.php:78 +msgid "" +"检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工作!" +msgstr "" +"A proxy server has been detected in the WordPress configuration file. This " +"may cause the plugin to not work properly!" + +#: Plugin.php:59 +msgid "检测到旧版插件 WP-China-No,已自动禁用!" +msgstr "" +"An old version of the plugin WP-China-No has been detected and automatically " +"disabled!" + +#: Service/Setting.php:108 +msgid "自动监控" +msgstr "Automatic Monitor" + +#: Service/Setting.php:53 +msgid "萌芽加速" +msgstr "adminCDN" + +#: Service/Setting.php:32 Service/Setting.php:155 +msgid "设置" +msgstr "Setting" diff --git a/languages/wp-china-yes-zh_CN.mo b/languages/wp-china-yes-zh_CN.mo new file mode 100644 index 0000000..b277433 Binary files /dev/null and b/languages/wp-china-yes-zh_CN.mo differ diff --git a/languages/wp-china-yes-zh_CN.po b/languages/wp-china-yes-zh_CN.po new file mode 100644 index 0000000..08cf984 --- /dev/null +++ b/languages/wp-china-yes-zh_CN.po @@ -0,0 +1,160 @@ +msgid "" +msgstr "" +"Project-Id-Version: WP-China-Yes\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-23 03:41+0000\n" +"PO-Revision-Date: 2024-08-23 12:20+0800\n" +"Last-Translator: \n" +"Language-Team: 简体中文\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.4.4\n" +"X-Loco-Version: 2.6.10; wp-6.6\n" +"X-Domain: wp-china-yes\n" + +#: Service/Setting.php:54 +msgid "" +"萌芽加速(adminCDN)" +"将 WordPress 依赖的静态文件切换为公共资源,加快网站访问速度。您可按需启用需" +"要加速的项目,更多细节控制和功能,请关注 adminCDN 项目。" +msgstr "" +"萌芽加速(adminCDN)" +"将 WordPress 依赖的静态文件切换为公共资源,加快网站访问速度。您可按需启用需" +"要加速的项目,更多细节控制和功能,请关注 adminCDN 项目。" + +#: Service/Setting.php:72 +msgid "" +"初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请" +"安装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 " +"WordPress)" +msgstr "" +"初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请" +"安装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 " +"WordPress)" + +#: Service/Setting.php:86 +msgid "" +"文风字体(Windfonts)为您的网页渲染中文字体并对主题、插件内的字体进行加速;优化模式可优化浏览器" +"字体调用。" +msgstr "" +"文风字体(Windfonts)为您的网页渲染中文字体并对主题、插件内的字体进行加速;优化模式可优化浏览器" +"字体调用。" + +#: Service/Setting.php:109 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)支持自动监控各加速节点可用性,当节点不可用时自动切换至可用节" +"点或关闭加速,以保证您的网站正常访问。" +msgstr "" +"文派叶子🍃(WP-" +"China-Yes)支持自动监控各加速节点可用性,当节点不可用时自动切换至可用节" +"点或关闭加速,以保证您的网站正常访问。" + +#: Service/Setting.php:98 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)独家特色功能,让您拥有清爽整洁的 WordPress 后台,清除各类常用" +"插件侵入式后台广告、通知及无用信息;启用后若存在异常拦截,请切换为手动模式," +"查看可优化插件列表。" +msgstr "" +"文派叶子🍃(WP-" +"China-Yes)独家特色功能,让您拥有清爽整洁的 WordPress 后台,清除各类常用" +"插件侵入式后台广告、通知及无用信息;启用后若存在异常拦截,请切换为手动模式," +"查看可优化插件列表。" + +#: Service/Setting.php:41 +msgid "" +"官方加速源(WPMirror)直接从 .org 反代至大陆分发;文派开源(WenPai.org)中国境内自建托管仓库,同时集成文" +"派翻译平台。" +msgstr "" +"官方加速源(WPMirror)直接从 .org 反代至大陆分发;文派开源(WenPai.org)中国境内自建托管仓库,同时集成文" +"派翻译平台。" + +#. Author URI of the plugin +msgid "https://wp-china-yes.com" +msgstr "https://wp-china-yes.com" + +#. Name of the plugin +#: Service/Setting.php:143 Service/Setting.php:144 +msgid "WP-China-Yes" +msgstr "WP-China-Yes" + +#: Plugin.php:52 +#, php-format +msgid "" +"WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。" +msgstr "" +"WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。" + +#: Service/Setting.php:71 +msgid "初认头像" +msgstr "初认头像" + +#: Service/Setting.php:97 +msgid "广告拦截" +msgstr "广告拦截" + +#: Service/Setting.php:40 +msgid "应用市场" +msgstr "应用市场" + +#. Description of the plugin +msgid "" +"文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽," +"生生不息。" +msgstr "" +"文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽," +"生生不息。" + +#. Author of the plugin +msgid "文派开源" +msgstr "文派开源" + +#: Service/Setting.php:85 +msgid "文风字体" +msgstr "文风字体" + +#: Plugin.php:71 +msgid "检测到不兼容的插件 Kill 429,已自动禁用!" +msgstr "检测到不兼容的插件 Kill 429,已自动禁用!" + +#: Plugin.php:65 +msgid "检测到不兼容的插件 WP-China-Plus,已自动禁用!" +msgstr "检测到不兼容的插件 WP-China-Plus,已自动禁用!" + +#: Plugin.php:78 +msgid "" +"检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工" +"作!" +msgstr "" +"检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工" +"作!" + +#: Plugin.php:59 +msgid "检测到旧版插件 WP-China-No,已自动禁用!" +msgstr "检测到旧版插件 WP-China-No,已自动禁用!" + +#: Service/Setting.php:108 +msgid "自动监控" +msgstr "自动监控" + +#: Service/Setting.php:53 +msgid "萌芽加速" +msgstr "萌芽加速" + +#: Service/Setting.php:32 Service/Setting.php:155 +msgid "设置" +msgstr "设置" diff --git a/languages/wp-china-yes-zh_TW.mo b/languages/wp-china-yes-zh_TW.mo new file mode 100644 index 0000000..69ac10c Binary files /dev/null and b/languages/wp-china-yes-zh_TW.mo differ diff --git a/languages/wp-china-yes-zh_TW.po b/languages/wp-china-yes-zh_TW.po new file mode 100644 index 0000000..25396be --- /dev/null +++ b/languages/wp-china-yes-zh_TW.po @@ -0,0 +1,160 @@ +msgid "" +msgstr "" +"Project-Id-Version: WP-China-Yes\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-08-23 03:41+0000\n" +"PO-Revision-Date: 2024-08-23 12:19+0800\n" +"Last-Translator: \n" +"Language-Team: 繁體中文\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.4.4\n" +"X-Loco-Version: 2.6.11; wp-6.6\n" +"X-Domain: wp-china-yes\n" + +#: Service/Setting.php:54 +msgid "" +"萌芽加速(adminCDN)" +"将 WordPress 依赖的静态文件切换为公共资源,加快网站访问速度。您可按需启用需" +"要加速的项目,更多细节控制和功能,请关注 adminCDN 项目。" +msgstr "" +"萌芽加速(adminCDN)" +"將 WordPress 依賴的靜態檔案切換為公共資源,加快網站訪問速度。您可按需啟用需" +"要加速的專案,更多細節控制和功能,請關注 adminCDN 專案。" + +#: Service/Setting.php:72 +msgid "" +"初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请" +"安装 WPAavatar 插件。(任何开发者均可在自己的产品中集成该服务,不局限于 " +"WordPress)" +msgstr "" +"初認頭像(Cravatar)Gravatar 在中國的完美替代方案,您可以在 Cravatar.com 上傳頭像,更多選項請" +"安裝 WPAavatar 外掛。(任何開發者均可在自己的產品中整合該服務,不侷限於 " +"WordPress)" + +#: Service/Setting.php:86 +msgid "" +"文风字体(Windfonts)为您的网页渲染中文字体并对主题、插件内的字体进行加速;优化模式可优化浏览器" +"字体调用。" +msgstr "" +"文風字型(Windfonts)為您的網頁渲染中文字型並對主題、外掛內的字型進行加速;最佳化模式可最佳化瀏" +"覽器字型呼叫。" + +#: Service/Setting.php:109 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)支持自动监控各加速节点可用性,当节点不可用时自动切换至可用节" +"点或关闭加速,以保证您的网站正常访问。" +msgstr "" +"文派葉子🍃(WP-" +"China-Yes)支援自動監控各加速節點可用性,當節點不可用時自動切換至可用節" +"點或關閉加速,以保證您的網站正常訪問。" + +#: Service/Setting.php:98 +msgid "" +"文派叶子🍃(WP-" +"China-Yes)独家特色功能,让您拥有清爽整洁的 WordPress 后台,清除各类常用" +"插件侵入式后台广告、通知及无用信息;启用后若存在异常拦截,请切换为手动模式," +"查看可优化插件列表。" +msgstr "" +"文派葉子🍃(WP-" +"China-Yes)獨家特色功能,讓您擁有清爽整潔的 WordPress 後臺,清除各類常用" +"外掛侵入式後臺廣告、通知及無用資訊;啟用後若存在異常攔截,請切換為手動模式," +"檢視可最佳化外掛列表" +"。" + +#: Service/Setting.php:41 +msgid "" +"官方加速源(WPMirror)直接从 .org 反代至大陆分发;文派开源(WenPai.org)中国境内自建托管仓库,同时集成文" +"派翻译平台。" +msgstr "" +"官方加速源(WPMirror)直接從 .org 反代至大陸分發;文派開源(WenPai.org)中國境內自建託管倉庫,同時整合文" +"派翻譯平臺。" + +#. Author URI of the plugin +msgid "https://wp-china-yes.com" +msgstr "https://wp-china-yes.com" + +#. Name of the plugin +#: Service/Setting.php:143 Service/Setting.php:144 +msgid "WP-China-Yes" +msgstr "文派葉子" + +#: Plugin.php:52 +#, php-format +msgid "" +"WP-China-Yes 插件需要 PHP 5.6.0 或更高版本,当前版本为 %s,插件已自动禁用。" +msgstr "" +"WP-China-Yes 外掛程式需要PHP 5.6.0 或更高版本,目前版本為%s,外掛程式已自動" +"停用。" + +#: Service/Setting.php:71 +msgid "初认头像" +msgstr "初認頭像" + +#: Service/Setting.php:97 +msgid "广告拦截" +msgstr "廣告攔截" + +#: Service/Setting.php:40 +msgid "应用市场" +msgstr "應用市場" + +#. Description of the plugin +msgid "" +"文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽," +"生生不息。" +msgstr "" +"文派葉子 🍃(WP-China-Yes)是中國 WordPress 生態基礎設施軟體,猶如落葉新芽," +"生生不息。" + +#. Author of the plugin +msgid "文派开源" +msgstr "文派開源" + +#: Service/Setting.php:85 +msgid "文风字体" +msgstr "文風字體" + +#: Plugin.php:71 +msgid "检测到不兼容的插件 Kill 429,已自动禁用!" +msgstr "偵測到不相容的插件Kill 429,已自動停用!" + +#: Plugin.php:65 +msgid "检测到不兼容的插件 WP-China-Plus,已自动禁用!" +msgstr "偵測到不相容的外掛程式WP-China-Plus,已自動停用!" + +#: Plugin.php:78 +msgid "" +"检测到已在 WordPress 配置文件中设置代理服务器,这可能会导致插件无法正常工" +"作!" +msgstr "" +"偵測到已在WordPress 設定檔中設定代理伺服器,這可能會導致外掛無法正常運作!" + +#: Plugin.php:59 +msgid "检测到旧版插件 WP-China-No,已自动禁用!" +msgstr "偵測到舊版外掛程式WP-China-No,已自動停用!" + +#: Service/Setting.php:108 +msgid "自动监控" +msgstr "自動監控" + +#: Service/Setting.php:53 +msgid "萌芽加速" +msgstr "萌芽加速" + +#: Service/Setting.php:32 Service/Setting.php:155 +msgid "设置" +msgstr "設定" diff --git a/wp-china-yes.php b/wp-china-yes.php index 51a627d..be3c2fe 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.3 + * Version: 3.6.4 * 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.3' ); +define( 'CHINA_YES_VERSION', '3.6.4' ); 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 ) );