mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-03 02:48:45 +08:00
fix: 市场加速导致 Beta 测试插件失效的问题
This commit is contained in:
parent
597c0943d5
commit
2223b022b7
6 changed files with 200 additions and 170 deletions
|
@ -38,7 +38,7 @@ class Plugin {
|
|||
* 插件加载时执行
|
||||
*/
|
||||
public function plugins_loaded() {
|
||||
load_plugin_textdomain( 'wp-china-yes', false, plugin_dir_path( PLUGIN_FILE ) . 'languages' );
|
||||
load_plugin_textdomain( 'wp-china-yes', false, CHINA_YES_PLUGIN_PATH . 'languages' );
|
||||
add_action( 'admin_notices', [ $this, 'admin_notices' ] );
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ class Setting {
|
|||
public function __construct() {
|
||||
$this->setting_api = new API();
|
||||
add_action( 'admin_init', [ $this, 'admin_init' ] );
|
||||
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_assets' ] );
|
||||
add_action( is_multisite() ? 'network_admin_menu' : 'admin_menu', [ $this, 'admin_menu' ] );
|
||||
}
|
||||
|
||||
|
@ -108,6 +109,16 @@ class Setting {
|
|||
$this->setting_api->admin_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载后台资源
|
||||
*/
|
||||
public function enqueue_admin_assets( $hook_suffix ) {
|
||||
if ( strpos( $hook_suffix, 'wp-china-yes' ) === false ) {
|
||||
return;
|
||||
}
|
||||
wp_enqueue_style( 'wpcy-admin', CHINA_YES_PLUGIN_URL . 'assets/css/setting.css', [], CHINA_YES_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* 挂载设置页面
|
||||
*/
|
||||
|
@ -139,174 +150,69 @@ class Setting {
|
|||
* 设置页面模版
|
||||
*/
|
||||
public function setting_page() {
|
||||
echo '<div class="wpcy-settings-header">
|
||||
<div class="wpcy-settings-title-section"><h1>文派叶子🍃(WP-China-Yes)</h1></div>';
|
||||
echo '<h3>将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。</h3><h4>100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。</h4></div>';
|
||||
echo <<<HTML
|
||||
<style>
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", sans-serif, -apple-system, "Noto Sans", "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Source Han Sans CN", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
|
||||
}
|
||||
#wpcontent, #wpfooter {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
.left-column, .right-column {
|
||||
width: 100%;
|
||||
}
|
||||
.right-column {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
.card {
|
||||
background-color: #fff;
|
||||
padding: 10%;
|
||||
border-radius: 10px;
|
||||
text-transform: none;
|
||||
border: 0px solid #c3c4c7;
|
||||
font-size: 14px;
|
||||
line-height: 2;
|
||||
box-shadow: 0 0.375rem 1.5rem 0 rgba(141, 153, 165, 0.13);
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
margin-top: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
}
|
||||
.card a, .left-column a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.card-body, .card-footer {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.card-footer a.button.button-primary {
|
||||
padding: 1% 5%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.form-table th {
|
||||
width: 120px;
|
||||
padding: 5% 0;
|
||||
}
|
||||
.form-table td {
|
||||
padding: 5% 0;
|
||||
}
|
||||
.wpcy-settings-header {
|
||||
padding-top: 20px;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.wpcy-settings-title-section {
|
||||
padding: 1% 0;
|
||||
}
|
||||
.wpcy-settings-title-section h3 {
|
||||
font-size: large;
|
||||
}
|
||||
.wpcy-settings-title-section h4 {
|
||||
font-size: large;
|
||||
font-weight: 400;
|
||||
}
|
||||
.wpcy-settings-footer p {
|
||||
font-size: x-small;
|
||||
line-height: 2;
|
||||
}
|
||||
.sponsor-logos {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sponsor-logos img {
|
||||
width: 26%;
|
||||
margin-bottom: 30px;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px){
|
||||
.auto-fold #wpcontent {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.container {
|
||||
flex-wrap: nowrap;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.left-column {
|
||||
width: 70%;
|
||||
}
|
||||
.right-column {
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="settings-header">
|
||||
<div class="settings-title-section">
|
||||
<h1>文派叶子🍃(WP-China-Yes)</h1>
|
||||
</div>
|
||||
<h3>将您的 WordPress 接入本土生态体系,这将为您提供一个更贴近中国人使用习惯的 WordPress。</h3>
|
||||
<h4>100% 开源代码,一起参与文派(WordPress)软件国产化进程,打造属于您自己的开源自助建站程序。</h4>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="left-column">
|
||||
<div class="left-column">
|
||||
HTML;
|
||||
$this->setting_api->show_navigation();
|
||||
$this->setting_api->show_forms();
|
||||
|
||||
echo <<<HTML
|
||||
<div class="wpcy-settings-footer">
|
||||
<p><strong>提示:</strong>插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。</p>
|
||||
<p><strong>帮助:</strong>您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,<a href="https://wp-china-yes.com/contact" target="_blank">查看联系方式</a>。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right-column">
|
||||
<div class="card">
|
||||
<h3>项目简介</h3>
|
||||
<div class="card-body">
|
||||
文派叶子 🍃(WP-China-Yes)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。项目起源于 2019 年,专为解决困扰了中国互联网数十年的特色问题而存在。此为文派开源(WenPai.org)的一部分。
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/" target="_blank">了解更多</a>
|
||||
</div>
|
||||
<div class="settings-footer">
|
||||
<p><strong>提示:</strong>插件会定期检查节点可用性,并在节点不可用时自动切换至可用节点,以保证您的网站正常访问。如您发现设置项被自动切换,可在此页面重新设置。</p>
|
||||
<p><strong>帮助:</strong>您可以随时在此处调整个性化设置以便适应不同的业务场景,萌新请保持默认即可。此项目的发展离不开您的支持和建议,<a href="https://wp-china-yes.com/contact" target="_blank">查看联系方式</a>。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>赞助商</h3>
|
||||
<div class="card-body sponsor-logos">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/feibisi-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/shujue-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/upyun-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/wenpai-logo@2X.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/wpsaas-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/lingding-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/weixiaoduo-logo-2020.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/modiqi-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/kekechong-logo-1.png">
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/about/sponsor" target="_blank">成为赞助商</a>
|
||||
</div>
|
||||
<div class="right-column">
|
||||
<div class="card">
|
||||
<h3>项目简介</h3>
|
||||
<div class="card-body">
|
||||
文派叶子 🍃(WP-China-Yes)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。项目起源于 2019 年,专为解决困扰了中国互联网数十年的特色问题而存在。此为文派开源(WenPai.org)的一部分。
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/" target="_blank">了解更多</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>赞助商</h3>
|
||||
<div class="card-body sponsor-logos">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/feibisi-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/shujue-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/upyun-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/wenpai-logo@2X.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/wpsaas-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/lingding-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/weixiaoduo-logo-2020.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/modiqi-logo.png">
|
||||
<img src="https://wp-china-yes.com/wp-content/uploads/2023/08/kekechong-logo-1.png">
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/about/sponsor" target="_blank">成为赞助商</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>建站套件</h3>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
<li><a href="https://wenpai.org/plugins/wpicp-license" target="_blank">WPICP License 备案号管理器</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpavatar/" target="_blank">WPAvatar 文派头像</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpsite-shortcode/" target="_blank">WPSite Shortcode 网站简码</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpfanyi-import/" target="_blank">WPfanyi Import 翻译导入器</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/products" target="_blank">一键安装</a>
|
||||
<a class="button button-primary" href="https://wp-china-yes.com" target="_blank">功能请求</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<h3>建站套件</h3>
|
||||
<div class="card-body">
|
||||
<ul>
|
||||
<li><a href="https://wenpai.org/plugins/wpicp-license" target="_blank">WPICP License 备案号管理器</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpavatar/" target="_blank">WPAvatar 文派头像</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpsite-shortcode/" target="_blank">WPSite Shortcode 网站简码</a></li>
|
||||
<li><a href="https://wenpai.org/plugins/wpfanyi-import/" target="_blank">WPfanyi Import 翻译导入器</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<a class="button button-primary" href="https://wp-china-yes.com/products" target="_blank">一键安装</a>
|
||||
<a class="button button-primary" href="https://wp-china-yes.com" target="_blank">功能请求</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
|
|
|
@ -217,8 +217,10 @@ class Super {
|
|||
* WordPress.Org 替换
|
||||
*/
|
||||
public function filter_wordpress_org( $preempt, $args, $url ) {
|
||||
if ( ( ! strpos( $url, 'api.wordpress.org' ) && ! strpos( $url,
|
||||
'downloads.wordpress.org' ) ) ) {
|
||||
if ( $preempt || isset( $args['_wp_china_yes'] ) ) {
|
||||
return $preempt;
|
||||
}
|
||||
if ( ( ! strpos( $url, 'api.wordpress.org' ) && ! strpos( $url, 'downloads.wordpress.org' ) ) ) {
|
||||
return $preempt;
|
||||
}
|
||||
|
||||
|
@ -240,6 +242,8 @@ class Super {
|
|||
$url = str_replace( 'https://', 'http://', $url );
|
||||
}
|
||||
|
||||
$args['_wp_china_yes'] = true;
|
||||
|
||||
return wp_remote_request( $url, $args );
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace WenPai\ChinaYes\Service;
|
|||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
|
||||
use const WenPai\ChinaYes\PLUGIN_FILE;
|
||||
|
||||
/**
|
||||
* Class Update
|
||||
|
@ -17,7 +16,7 @@ class Update {
|
|||
public function __construct() {
|
||||
PucFactory::buildUpdateChecker(
|
||||
'https://api.wenpai.org/china-yes/version-check',
|
||||
PLUGIN_FILE,
|
||||
CHINA_YES_PLUGIN_FILE,
|
||||
'wp-china-yes'
|
||||
);
|
||||
}
|
||||
|
|
120
assets/css/setting.css
Normal file
120
assets/css/setting.css
Normal file
|
@ -0,0 +1,120 @@
|
|||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
font-family: "Source Han Sans SC", "Noto Sans CJK SC", "Source Han Sans CN", "Noto Sans SC", "Source Han Sans TC", "Noto Sans CJK TC", sans-serif, -apple-system, "Noto Sans", "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", "Source Han Sans CN", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif;
|
||||
}
|
||||
|
||||
#wpcontent, #wpfooter {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.notice {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.left-column, .right-column {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.right-column {
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #fff;
|
||||
padding: 10%;
|
||||
border-radius: 10px;
|
||||
text-transform: none;
|
||||
border: 0px solid #c3c4c7;
|
||||
font-size: 14px;
|
||||
line-height: 2;
|
||||
box-shadow: 0 0.375rem 1.5rem 0 rgba(141, 153, 165, 0.13);
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
margin-top: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.card a, .left-column a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.card-body, .card-footer {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.card-footer a.button.button-primary {
|
||||
padding: 1% 5%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
width: 120px;
|
||||
padding: 5% 0;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
padding: 5% 0;
|
||||
}
|
||||
|
||||
.settings-header {
|
||||
padding-top: 20px;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.settings-title-section {
|
||||
padding: 1% 0;
|
||||
}
|
||||
|
||||
.settings-footer p {
|
||||
font-size: 12px;
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
.sponsor-logos {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sponsor-logos img {
|
||||
width: 26%;
|
||||
margin-bottom: 30px;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
.auto-fold #wpcontent {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.container {
|
||||
flex-wrap: nowrap;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.left-column {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.right-column {
|
||||
width: 30%;
|
||||
}
|
||||
}
|
|
@ -19,15 +19,16 @@ namespace WenPai\ChinaYes;
|
|||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
const VERSION = '3.6.1';
|
||||
const PLUGIN_FILE = __FILE__;
|
||||
const PLUGIN_DIR = __DIR__;
|
||||
define( 'CHINA_YES_VERSION', '3.6.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 ) );
|
||||
|
||||
require_once( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' );
|
||||
require_once( plugin_dir_path( CHINA_YES_PLUGIN_FILE ) . 'vendor/autoload.php' );
|
||||
|
||||
// 注册插件激活钩子
|
||||
register_activation_hook( PLUGIN_FILE, [ Plugin::class, 'activate' ] );
|
||||
register_activation_hook( CHINA_YES_PLUGIN_FILE, [ Plugin::class, 'activate' ] );
|
||||
// 注册插件删除钩子
|
||||
register_uninstall_hook( PLUGIN_FILE, [ Plugin::class, 'uninstall' ] );
|
||||
register_uninstall_hook( CHINA_YES_PLUGIN_FILE, [ Plugin::class, 'uninstall' ] );
|
||||
|
||||
new Plugin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue