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(); } /** * 动态获取设置页面的 URL * * @return string */ private function get_settings_page_url() { if ( is_multisite() ) { return network_admin_url( 'settings.php?page=wp-china-yes' ); } return admin_url( 'options-general.php?page=wp-china-yes' ); } /** * 挂载设置项 */ public function admin_init() { WP_CHINA_YES::createOptions( $this->prefix, [ 'framework_title' => sprintf( '%s v%s', $this->settings['custom_name'], CHINA_YES_VERSION ), 'menu_hidden' => $this->settings['hide'], 'menu_title' => $this->settings['custom_name'], 'menu_slug' => 'wp-china-yes', 'menu_type' => 'submenu', 'menu_parent' => is_multisite() ? 'settings.php' : 'options-general.php', 'show_bar_menu' => false, 'show_sub_menu' => false, 'show_search' => false, 'show_reset_section' => false, 'footer_text' => sprintf( '%s 设置', $this->settings['custom_name'] ), 'theme' => 'light', 'enqueue_webfont' => false, 'async_webfont' => true, 'database' => is_multisite() ? 'network' : '', ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '欢迎使用', 'icon' => 'icon icon-home-1', 'fields' => [ [ 'type' => 'content', 'content' => <<

原生体验

文派叶子🍃(WP-China-Yes)是一款不可多得的 WordPress 系统底层优化和生态基础设施软件。

网站加速

优化加速插件多如牛毛,为何文派叶子如此与众不同?

进一步了解 ↗

翻译推送

高质量翻译中文本地化翻译由文派开源官方提供,欢迎参与改进。

本地化改进 ↗

广告屏蔽

呈现清爽整洁的网站后台,清除侵入式后台广告、无用信息。

获取广告规则 ↗

加入我们

关注文派茶馆 WPTEA.com 公众号以及订阅我们的时事通讯即可接收独家内容、提示和更新。

HTML, ] ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '加速设置', 'icon' => 'icon icon-flash-1', 'fields' => [ [ 'id' => 'store', 'type' => 'radio', 'title' => __( '应用市场', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'wenpai' => '文派开源', 'proxy' => '官方镜像', 'off' => '不启用' ], 'default' => 'wenpai', 'subtitle' => '是否启用市场加速', 'desc' => __( '文派开源(WenPai.org)中国境内自建托管仓库,同时集成文派翻译平台。官方加速源(WPMirror)直接从 .org 反代至大陆分发;可参考源站说明。', 'wp-china-yes' ), ], [ 'id' => 'admincdn', 'type' => 'checkbox', 'title' => __( '萌芽加速', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'googlefonts' => 'Google 字体', 'googleajax' => 'Google 前端库', 'cdnjs' => 'CDNJS 前端库', 'jsdelivr' => 'jsDelivr 前端库', 'bootstrapcdn' => 'Bootstrap 前端库' ], 'default' => [ 'admin' => 'admin', ], 'subtitle' => '是否启用萌芽加速', 'desc' => __( '萌芽加速(adminCDN)将 WordPress 插件依赖的静态文件切换为公共资源,解决卡顿、加载慢等问题。您可按需启用加速项目,更多细节控制和功能,请查看推荐设置。', 'wp-china-yes' ), ], [ 'id' => 'admincdn', 'type' => 'checkbox', 'title' => __( '文件加速', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'admin' => '后台加速', 'frontend' => '前台加速', ], 'default' => [ 'admin' => 'admin', ], 'subtitle' => '是否启用文件加速', 'desc' => __( '专为 WordPress 系统内置依赖的静态资源进行加速,加快网站访问速度,如遇异常请停用对应选项。', 'wp-china-yes' ), ], [ 'id' => 'cravatar', 'type' => 'radio', 'title' => __( '初认头像', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'cn' => '默认线路', 'global' => '国际线路', 'weavatar' => '备用源(WeAvatar.com)', 'off' => '不启用' ], 'default' => 'cn', 'subtitle' => '是否启用头像加速', 'desc' => __( '初认头像(Cravatar)Gravatar 在中国的完美替代方案,您可以在 Cravatar.com 上传头像,更多选项请安装 WPAavatar 插件。可自选加速线路。', 'wp-china-yes' ), ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '文风字体', 'icon' => 'icon icon-text', 'fields' => [ [ 'id' => 'windfonts', 'type' => 'radio', 'title' => __( '文风字体', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'on' => '全局启用', 'frontend' => '前台启用', 'optimize' => '本机字体', 'off' => '不启用', ], 'default' => 'off', 'subtitle' => '是否启用文风字体定制', 'desc' => __( '文风字体(Windfonts)为您的网站增添无限活力。专为中文网页设计,旨在提升用户阅读体验和视觉享受。新手使用请先查看字体使用说明。', 'wp-china-yes' ), ], [ 'id' => 'windfonts_typography', 'type' => 'checkbox', 'title' => __( '排印优化', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'corner' => '直角括号', 'space' => '文本空格', 'punctuation' => '标点显示', 'indent' => '段首缩进', 'align' => '两端对齐', ], 'default' => '', 'subtitle' => '是否启用排印优化', 'desc' => __( '文风字体排印优化可提升中文网页的视觉美感,适用于正式内容的网站。', 'wp-china-yes' ), 'dependency' => [ 'windfonts', 'any', 'on,frontend,optimize', ], ], [ 'id' => 'windfonts_list', 'type' => 'group', 'title' => '字体列表', 'subtitle' => '使用的文风字体列表', 'desc' => '支持添加多个文风字体,并配置应用元素、字体权重大小', 'button_title' => '添加字体', 'accordion_title_number' => true, 'dependency' => [ 'windfonts', 'any', 'on,frontend', ], 'fields' => [ [ 'id' => 'family', 'type' => 'text', 'title' => __( '字体家族', 'wp-china-yes' ), 'subtitle' => '字体家族名称', 'desc' => __( '填入从文风字体获取的字体家族名称', 'wp-china-yes' ), 'default' => 'wenfeng-syhtcjk', ], [ 'id' => 'css', 'type' => 'text', 'title' => __( '字体链接', 'wp-china-yes' ), 'subtitle' => '字体 CSS 链接', 'desc' => __( '填入从文风字体获取的字体 CSS 链接', 'wp-china-yes' ), 'default' => 'https://cn.windfonts.com/wenfeng/fonts/syhtcjk/regular/web/index.css', 'validate' => 'csf_validate_url', ], [ 'id' => 'weight', 'type' => 'number', 'title' => __( '字体字重', 'wp-china-yes' ), 'subtitle' => '字体字重大小', 'desc' => __( '设置字体权重大小(字体粗细)', 'wp-china-yes' ), 'default' => 400, 'attributes' => [ 'min' => 100, 'max' => 1000, 'step' => 10, ], 'validate' => 'csf_validate_numeric', ], [ 'id' => 'style', 'type' => 'select', 'title' => __( '字体样式', 'wp-china-yes' ), 'subtitle' => '字体样式选择', 'options' => [ 'normal' => '正常', 'italic' => '斜体', 'oblique' => '倾斜', ], 'desc' => __( '设置字体样式(正常、斜体、倾斜)', 'wp-china-yes' ), ], [ 'id' => 'selector', 'type' => 'textarea', 'title' => __( '字体应用', 'wp-china-yes' ), 'subtitle' => '字体应用元素', 'desc' => __( '设置字体应用的元素(CSS 选择器)', 'wp-china-yes' ), 'default' => 'a:not([class]),p,h1,h2,h3,h4,h5,h6,ul,ol,li,button,blockquote,pre,code,table,th,td,label,b,i:not([class]),em,small,strong,sub,sup,ins,del,mark,abbr,dfn,span:not([class])', 'sanitize' => false, ], [ 'id' => 'enable', 'type' => 'switcher', 'title' => __( '启用字体', 'wp-china-yes' ), 'subtitle' => '是否启用该字体', 'default' => true, ], ], ], [ 'type' => 'content', 'content' => '默认字体适配规则跟随插件更新,插件更新后可删除字体重新添加以获取最新适配规则', ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '广告屏蔽', 'icon' => 'icon icon-eye-slash', 'fields' => [ [ 'id' => 'adblock', 'type' => 'radio', 'title' => __( '广告屏蔽', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'on' => '启用', 'off' => '不启用', ], 'default' => 'off', 'subtitle' => '是否启用后台广告屏蔽', 'desc' => __( '文派叶子🍃(WPCY)独家特色功能,让您拥有清爽整洁的 WordPress 后台,清除各类常用插件侵入式后台广告、通知及无用信息,拿回后台控制权。', 'wp-china-yes' ), ], [ 'id' => 'adblock_rule', 'type' => 'group', 'title' => '规则列表', 'subtitle' => '使用的广告屏蔽规则列表', 'desc' => __( '支持添加多条广告屏蔽规则', 'wp-china-yes' ), 'button_title' => '添加规则', 'accordion_title_number' => true, 'dependency' => [ 'adblock', 'any', 'on', ], 'fields' => [ [ 'id' => 'name', 'type' => 'text', 'title' => __( '规则名称', 'wp-china-yes' ), 'subtitle' => '自定义规则名称', 'desc' => __( '自定义规则名称,方便识别', 'wp-china-yes' ), 'default' => '默认规则', ], [ 'id' => 'selector', 'type' => 'textarea', 'title' => __( '应用元素', 'wp-china-yes' ), 'subtitle' => '规则应用元素', 'desc' => __( '设置规则应用的广告元素(CSS 选择器)', 'wp-china-yes' ), 'default' => '.wpseo_content_wrapper #sidebar-container, .yoast_premium_upsell, #wpseo-local-seo-upsell, .yoast-settings-section-upsell, #rank_math_review_plugin_notice, #bwp-get-social, .bwp-button-paypal, #bwp-sidebar-right, .tjcc-custom-css #postbox-container-1, .settings_page_wpcustomtaxfilterinadmin #postbox-container-1, #duplicate-post-notice #newsletter-subscribe-form, div[id^="dnh-wrm"], .notice-info.dst-notice, #googleanalytics_terms_notice, .fw-brz-dismiss, div.elementor-message[data-notice_id="elementor_dev_promote"], .notice-success.wpcf7r-notice, .dc-text__block.disable__comment__alert, #ws_sidebar_pro_ad, .pa-new-feature-notice, #redux-connect-message, .frash-notice-email, .frash-notice-rate, #smush-box-pro-features, #wp-smush-bulk-smush-upsell-row, #easy-updates-manager-dashnotice, #metaslider-optin-notice, #extendifysdk_announcement, .ml-discount-ad, .mo-admin-notice, .post-smtp-donation, div[data-dismissible="notice-owa-sale-forever"], .neve-notice-upsell, #pagelayer_promo, #simple-custom-post-order-epsilon-review-notice, .sfsi_new_prmium_follw, div.fs-slug-the-events-calendar[data-id="connect_account"], .tribe-notice-event-tickets-install, div.notice[data-notice="webp-converter-for-media"], .webpLoader__popup.webpPopup, .put-dismiss-notice, .wp-mail-smtp-review-notice, #wp-mail-smtp-pro-banner, body div.promotion.fs-notice, .analytify-review-thumbnail, .analytify-review-notice, .jitm-banner.is-upgrade-premium, div[data-name*="wbcr_factory_notice_adverts"], .sui-subscription-notice, #sui-cross-sell-footer, .sui-cross-sell-modules, .forminator-rating-notice, .sui-dashboard-upsell-upsell, .anwp-post-grid__rate, .cff-settings-cta, .cff-header-upgrade-notice, .cff_notice.cff_review_notice_step_1, .cff_get_pro_highlight, .aal-install-elementor, #ws_sidebar_pro_ad, .bold-timeline-lite-feedback-notice-wrapper, #elementskit-lite-go-pro-noti2ce, #elementskit-lite-_plugin_rating_msg_used_in_day, .yarpp-review-notice, #prli_review_notice, #webdados_invoicexpress_nag, #vc_license-activation-notice, .villatheme-dashboard.updated, #njt-FileBird-review, .notice[data-dismissible="pro_release_notice"], #thwvsf_review_request_notice, .wpdeveloper-review-notice, div[data-notice_type="tinvwl-user-review"], div[data-notice_type="tinvwl-user-premium"], #sg-backup-review-wrapper, .notice-wpmet-jhanda-getgenie-cross-promo, .notice-getgenie-go-pro-noti2ce, .notice-wpmet-jhanda-Summer2023, .thwcfd-review-wrapper, .woo-permalink-manager-banner, div.notice.bundle-notice, div.notice[data-dismissible="notice-owa-upgrade-forever"], .wpsm-acc-r-review-notice, .wpsm_ac_h_i, .edac-review-notice, .notice-iworks-rate, #monterinsights-admin-menu-tooltip, .monsterinsights-floating-bar, #monterinsights-admin-menu-tooltip, .exactmetrics-floating-bar, #metform-unsupported-metform-pro-version, .lwptocRate, .wpsm-tabs-b-review-notice, .quadlayers_woocommerce-direct-checkout_notice_delay, .iworks-rate-notice, #metform-_plugin_rating_msg_used_in_day, [id^="wpmet-jhanda-"], #wpmet-stories, #ti-optml-notice-helper, .menu-icon-dashboard-notice, .catch-bells-admin-notice, .wpdt-bundles-notice, .td-admin-web-services, .cf-plugin-popup, .wpzinc-review-media-library-organizer, .oxi-image-notice', 'sanitize' => false, ], [ 'id' => 'enable', 'type' => 'switcher', 'title' => __( '启用规则', 'wp-china-yes' ), 'subtitle' => '是否启用该规则', 'default' => true, ], ], ], [ 'type' => 'content', 'content' => '默认规则跟随插件更新,插件更新后可删除规则重新添加以获取更多最新屏蔽规则,出现异常,请尝试先停用规则排查原因。', ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '飞行模式', 'icon' => 'icon icon-airplane', 'fields' => [ [ 'id' => 'plane', 'type' => 'radio', 'title' => __( '飞行模式', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'on' => '启用', 'off' => '不启用', ], 'default' => 'off', 'subtitle' => '是否启用飞行模式', 'desc' => __( '飞行模式可屏蔽 WordPress 插件主题在中国无法访问的 API 请求,加速网站前后台访问。注:部分外部请求为产品更新检测,若已屏蔽请定期检测。', 'wp-china-yes' ), ], [ 'id' => 'plane_rule', 'type' => 'group', 'title' => '规则列表', 'subtitle' => '飞行模式使用的 URL 屏蔽规则列表', 'desc' => __( '支持添加多条 URL 屏蔽规则', 'wp-china-yes' ), 'button_title' => '添加规则', 'accordion_title_number' => true, 'dependency' => [ 'plane', 'any', 'on', ], 'fields' => [ [ 'id' => 'name', 'type' => 'text', 'title' => __( '规则名称', 'wp-china-yes' ), 'subtitle' => '自定义规则名称', 'desc' => __( '自定义规则名称,方便识别', 'wp-china-yes' ), 'default' => '未命名规则', ], [ 'id' => 'url', 'type' => 'textarea', 'title' => __( 'URL', 'wp-china-yes' ), 'subtitle' => 'URL', 'desc' => __( '填入需要屏蔽的 URL 链接,一行一条,注意不要串行', 'wp-china-yes' ), 'default' => '', 'placeholder' => 'example.com', 'sanitize' => false, ], [ 'id' => 'enable', 'type' => 'switcher', 'title' => __( '启用规则', 'wp-china-yes' ), 'subtitle' => '是否启用该规则', 'default' => true, ], ], ] ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '脉云维护', 'icon' => 'icon icon-story', 'fields' => [ [ 'id' => 'monitor', 'type' => 'switcher', 'default' => true, 'title' => '节点监控', 'subtitle' => '自动监控加速节点可用性', 'desc' => __( '脉云维护(MainCloud)支持自动监控各加速节点可用性,当节点不可用时自动切换至可用节点或关闭加速,以保证您的网站正常访问', 'wp-china-yes' ), ], [ 'id' => 'memory', 'type' => 'switcher', 'default' => true, 'title' => '系统监控', 'subtitle' => '自动监控站点系统运行状态', 'desc' => __( '支持在管理后台页脚中显示系统运行状态,包括内存使用、CPU负载、MySQL版本、调试状态等信息', 'wp-china-yes' ), ], [ 'id' => 'memory_display', 'type' => 'checkbox', 'title' => __( '显示参数', 'wp-china-yes' ), 'inline' => true, 'options' => [ 'memory_usage' => '内存使用量', 'wp_limit' => 'WP内存限制', 'server_ip' => '服务器IP', 'hostname' => '主机名', 'os_info' => '操作系统', 'php_info' => 'PHP信息', 'cpu_usage' => 'CPU使用率', 'debug_status' => '调试状态', 'mysql_version'=> 'MySQL版本' ], 'default' => [ 'memory_usage', 'wp_limit', 'server_ip', 'os_info', 'php_info', 'cpu_usage', 'debug_status', 'mysql_version' ], 'subtitle' => '选择页脚要显示的信息', 'desc' => __( '为网站维护人员提供参考依据,无需登录服务器即可查看相关信息参数','wp-china-yes' ), 'dependency' => ['memory', '==', 'true'], ], [ 'type' => 'content', 'content' => '启用隐藏设置前请务必的保存或收藏当前设置页面 URL,否则您将无法再次进入插件设置页面', ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '品牌白标', 'icon' => 'icon icon-password-check', 'fields' => [ [ 'id' => 'custom_name', 'type' => 'text', 'title' => '品牌白标', 'subtitle' => '自定义插件显示品牌名', 'desc' => __( '专为 WordPress 建站服务商和代理机构提供的自定义品牌 OEM 功能,输入您的品牌词启用后生效', 'wp-china-yes' ), 'default' => "WP-China-Yes", ], [ 'type' => 'content', 'content' => '启用隐藏设置前请务必的保存或收藏当前设置页面 URL,否则您将无法再次进入插件设置页面', ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '其他设置', 'icon' => 'icon icon-setting', 'fields' => [ [ 'id' => 'hide', 'type' => 'switcher', 'default' => false, 'title' => '隐藏设置', 'subtitle' => '隐藏插件设置入口', 'desc' => __( '如果您不希望让客户知道本站启用了文派叶子🍃(WP-China-Yes)插件及服务,可开启此选项', 'wp-china-yes' ), ], ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '建站套件', 'icon' => 'icon icon-mouse', 'fields' => [ [ 'type' => 'content', 'content' => <<

开源建站

文派寻鹿🦌(WP Deer)建站套件是由文派科技官方提供的企业建站产品集合,代码均为 100% GPL 开源,无任何加密隐藏。

SEO 优化技巧

WPXYZ.com ↗

网站政策合规

WPICP.com ↗

软件开发工具

WPSDK.com ↗
HTML, ] ], ] ); WP_CHINA_YES::createSection( $this->prefix, [ 'title' => '关于插件', 'icon' => 'icon icon-info-circle', 'fields' => [ [ 'type' => 'content', 'content' => <<

项目简介

文派(WordPress)中国本土化项目始于 2019 年,由 文派叶子🍃(WPCY) 插件开启,其前身为 WP-China-Yes。

2023 年 5 月,文派科技完成对该项目的收购,并对其进行了全面的品牌重塑。

赞助支持

特别感谢以下企业品牌对文派项目提供的资金资源支持。早期伙伴未来有机会共享文派生态资源,期待社会各界参与。

开发 & 贡献者

100% 开源代码,诚邀您一起参与文派 (WordPress) 软件国产化进程,打造属于自己的开源自助建站程序。

HTML, ] ], ] ); } /** * 加载后台资源 */ 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 ); } /** * 挂载设置页面 */ public function admin_menu() { // 自定义名称 add_filter( 'all_plugins', function ( $plugins ) { if ( isset( $plugins['wp-china-yes/wp-china-yes.php'] ) ) { $plugins['wp-china-yes/wp-china-yes.php']['Name'] = $this->settings['custom_name']; } return $plugins; } ); // 插件页设置 add_filter( 'plugin_action_links', function ( $links, $file ) { if ( 'wp-china-yes/wp-china-yes.php' !== $file ) { return $links; } $settings_link = '' . esc_html__( '设置', 'wp-china-yes' ) . ''; array_unshift( $links, $settings_link ); return $links; }, 10, 2 ); } }