feat: add switches for gutenberg editor

pull/155/head
Seaton Jiang 2020-02-23 17:31:57 +08:00
parent f5482c46c4
commit 0bf8149d12
3 changed files with 114 additions and 96 deletions

View File

@ -3,7 +3,7 @@
* 文章相关函数 * 文章相关函数
* @author Seaton Jiang <seaton@vtrois.com> * @author Seaton Jiang <seaton@vtrois.com>
* @license MIT License * @license MIT License
* @version 2020.02.15 * @version 2020.02.23
*/ */
// 文章链接添加 target 和 rel // 文章链接添加 target 和 rel
@ -365,13 +365,15 @@ function get_wpsmiliestrans()
return $output; return $output;
} }
// 禁用 Gutenberg 编辑器 if (!kratos_option('g_gutenberg',false)) {
add_filter('use_block_editor_for_post', '__return_false'); // 禁用 Gutenberg 编辑器
remove_action('wp_enqueue_scripts', 'wp_common_block_scripts_and_styles'); add_filter('use_block_editor_for_post', '__return_false');
remove_action('wp_enqueue_scripts', 'wp_common_block_scripts_and_styles');
// 删除前端的block library的css资源 // 删除前端的block library的css资源
add_action('wp_enqueue_scripts', 'remove_block_library_css', 100); add_action('wp_enqueue_scripts', 'remove_block_library_css', 100);
function remove_block_library_css() function remove_block_library_css()
{ {
wp_dequeue_style('wp-block-library'); wp_dequeue_style('wp-block-library');
} }
}

View File

@ -81,6 +81,14 @@ function kratos_options()
'type' => 'checkbox', 'type' => 'checkbox',
); );
$options[] = array(
'name' => __('Gutenberg 编辑器', 'kratos'),
'desc' => __('开启 Gutenberg 编辑器', 'kratos'),
'std' => '0',
'id' => 'g_gutenberg',
'type' => 'checkbox',
);
$options[] = array( $options[] = array(
'name' => __('Gravatar 加速', 'kratos'), 'name' => __('Gravatar 加速', 'kratos'),
'desc' => __('开启 Gravatar 头像加速', 'kratos'), 'desc' => __('开启 Gravatar 头像加速', 'kratos'),

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: Kratos\n" "Project-Id-Version: Kratos\n"
"POT-Creation-Date: 2020-02-23 16:57+0800\n" "POT-Creation-Date: 2020-02-23 17:30+0800\n"
"PO-Revision-Date: 2020-02-14 23:32+0800\n" "PO-Revision-Date: 2020-02-14 23:32+0800\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -66,7 +66,7 @@ msgstr ""
msgid "搜点什么呢?" msgid "搜点什么呢?"
msgstr "" msgstr ""
#: header.php:73 inc/theme-options.php:356 #: header.php:73 inc/theme-options.php:364
msgid "一款专注于用户阅读体验的响应式博客主题" msgid "一款专注于用户阅读体验的响应式博客主题"
msgstr "" msgstr ""
@ -322,339 +322,347 @@ msgid "开启静态资源加速CSS、JS、Font"
msgstr "" msgstr ""
#: inc/theme-options.php:85 #: inc/theme-options.php:85
msgid "Gravatar 加速" msgid "Gutenberg 编辑器"
msgstr "" msgstr ""
#: inc/theme-options.php:86 #: inc/theme-options.php:86
msgid "开启 Gravatar 头像加速" msgid "开启 Gutenberg 编辑器"
msgstr "" msgstr ""
#: inc/theme-options.php:93 #: inc/theme-options.php:93
msgid "导航栏颜色" msgid "Gravatar 加速"
msgstr "" msgstr ""
#: inc/theme-options.php:94 #: inc/theme-options.php:94
msgid "Chrome 移动端浏览器导航栏的颜色" msgid "开启 Gravatar 头像加速"
msgstr "" msgstr ""
#: inc/theme-options.php:101 inc/theme-options.php:243 #: inc/theme-options.php:101
msgid "微信二维码" msgid "导航栏颜色"
msgstr "" msgstr ""
#: inc/theme-options.php:102 #: inc/theme-options.php:102
msgid "Chrome 移动端浏览器导航栏的颜色"
msgstr ""
#: inc/theme-options.php:109 inc/theme-options.php:251
msgid "微信二维码"
msgstr ""
#: inc/theme-options.php:110
msgid "开启页面右下角浮动微信二维码" msgid "开启页面右下角浮动微信二维码"
msgstr "" msgstr ""
#: inc/theme-options.php:116 #: inc/theme-options.php:124
msgid "404 页面图片" msgid "404 页面图片"
msgstr "" msgstr ""
#: inc/theme-options.php:123 #: inc/theme-options.php:131
msgid "收录配置" msgid "收录配置"
msgstr "" msgstr ""
#: inc/theme-options.php:128 #: inc/theme-options.php:136
msgid "分享图片" msgid "分享图片"
msgstr "" msgstr ""
#: inc/theme-options.php:129 #: inc/theme-options.php:137
msgid "搜索引擎或者社交工具分享首页时抓取的图片" msgid "搜索引擎或者社交工具分享首页时抓取的图片"
msgstr "" msgstr ""
#: inc/theme-options.php:136 #: inc/theme-options.php:144
msgid "关键词" msgid "关键词"
msgstr "" msgstr ""
#: inc/theme-options.php:137 #: inc/theme-options.php:145
msgid "每个关键词之间需要用「英文逗号」分割" msgid "每个关键词之间需要用「英文逗号」分割"
msgstr "" msgstr ""
#: inc/theme-options.php:143 #: inc/theme-options.php:151
msgid "站点描述" msgid "站点描述"
msgstr "" msgstr ""
#: inc/theme-options.php:149 #: inc/theme-options.php:157
msgid "统计代码" msgid "统计代码"
msgstr "" msgstr ""
#: inc/theme-options.php:150 #: inc/theme-options.php:158
msgid "注意:输入 HTML/JS 代码时请注意辨别代码安全!" msgid "注意:输入 HTML/JS 代码时请注意辨别代码安全!"
msgstr "" msgstr ""
#: inc/theme-options.php:156 #: inc/theme-options.php:164
msgid "robots.txt 配置" msgid "robots.txt 配置"
msgstr "" msgstr ""
#: inc/theme-options.php:157 #: inc/theme-options.php:165
msgid "- 需要 " msgid "- 需要 "
msgstr "" msgstr ""
#: inc/theme-options.php:157 #: inc/theme-options.php:165
msgid " 是开启的状态,下面的配置才会生效" msgid " 是开启的状态,下面的配置才会生效"
msgstr "" msgstr ""
#: inc/theme-options.php:162 #: inc/theme-options.php:170
msgid "- 如果网站根目录下已经有 robots.txt 文件,下面的配置不会生效" msgid "- 如果网站根目录下已经有 robots.txt 文件,下面的配置不会生效"
msgstr "" msgstr ""
#: inc/theme-options.php:167 #: inc/theme-options.php:175
msgid "- 点击 " msgid "- 点击 "
msgstr "" msgstr ""
#: inc/theme-options.php:167 #: inc/theme-options.php:175
msgid " 查看配置是否生效,如果网站开启了 CDN可能需要刷新缓存才会生效" msgid " 查看配置是否生效,如果网站开启了 CDN可能需要刷新缓存才会生效"
msgstr "" msgstr ""
#: inc/theme-options.php:178 #: inc/theme-options.php:186
msgid "首页配置" msgid "首页配置"
msgstr "" msgstr ""
#: inc/theme-options.php:183 #: inc/theme-options.php:191
msgid "哀悼功能" msgid "哀悼功能"
msgstr "" msgstr ""
#: inc/theme-options.php:184 #: inc/theme-options.php:192
msgid "开启站点首页黑白功能用于R.I.P." msgid "开启站点首页黑白功能用于R.I.P."
msgstr "" msgstr ""
#: inc/theme-options.php:190 #: inc/theme-options.php:198
msgid "默认特色图" msgid "默认特色图"
msgstr "" msgstr ""
#: inc/theme-options.php:191 #: inc/theme-options.php:199
msgid "当文章中没有图片并且没有设置特色图时在首页显示" msgid "当文章中没有图片并且没有设置特色图时在首页显示"
msgstr "" msgstr ""
#: inc/theme-options.php:198 #: inc/theme-options.php:206
msgid "无内容图片" msgid "无内容图片"
msgstr "" msgstr ""
#: inc/theme-options.php:199 #: inc/theme-options.php:207
msgid "当搜索不到文章或文章分类中没有文章时显示" msgid "当搜索不到文章或文章分类中没有文章时显示"
msgstr "" msgstr ""
#: inc/theme-options.php:206 #: inc/theme-options.php:214
msgid "文章配置" msgid "文章配置"
msgstr "" msgstr ""
#: inc/theme-options.php:211 #: inc/theme-options.php:219
msgid "知识共享协议" msgid "知识共享协议"
msgstr "" msgstr ""
#: inc/theme-options.php:212 #: inc/theme-options.php:220
msgid "选择文章的知识共享协议" msgid "选择文章的知识共享协议"
msgstr "" msgstr ""
#: inc/theme-options.php:220 #: inc/theme-options.php:228
msgid "网易云音乐" msgid "网易云音乐"
msgstr "" msgstr ""
#: inc/theme-options.php:221 #: inc/theme-options.php:229
msgid "开启网易云音乐自动播放" msgid "开启网易云音乐自动播放"
msgstr "" msgstr ""
#: inc/theme-options.php:227 #: inc/theme-options.php:235
msgid "文章打赏" msgid "文章打赏"
msgstr "" msgstr ""
#: inc/theme-options.php:228 #: inc/theme-options.php:236
msgid "开启文章页面打赏功能" msgid "开启文章页面打赏功能"
msgstr "" msgstr ""
#: inc/theme-options.php:234 #: inc/theme-options.php:242
msgid "支付宝二维码" msgid "支付宝二维码"
msgstr "" msgstr ""
#: inc/theme-options.php:252 #: inc/theme-options.php:260
msgid "站长配置" msgid "站长配置"
msgstr "" msgstr ""
#: inc/theme-options.php:257 #: inc/theme-options.php:265
msgid "个人头像" msgid "个人头像"
msgstr "" msgstr ""
#: inc/theme-options.php:264 #: inc/theme-options.php:272
msgid "个人昵称" msgid "个人昵称"
msgstr "" msgstr ""
#: inc/theme-options.php:271 inc/theme-widgets.php:140 #: inc/theme-options.php:279 inc/theme-widgets.php:140
msgid "个人简介" msgid "个人简介"
msgstr "" msgstr ""
#: inc/theme-options.php:272 inc/theme-widgets.php:157 #: inc/theme-options.php:280 inc/theme-widgets.php:157
#: pages/page-toolbar.php:13 #: pages/page-toolbar.php:13
msgid "保持饥渴的专注,追求最佳的品质" msgid "保持饥渴的专注,追求最佳的品质"
msgstr "" msgstr ""
#: inc/theme-options.php:278 #: inc/theme-options.php:286
msgid "邮件配置" msgid "邮件配置"
msgstr "" msgstr ""
#: inc/theme-options.php:283 #: inc/theme-options.php:291
msgid "SMTP 服务" msgid "SMTP 服务"
msgstr "" msgstr ""
#: inc/theme-options.php:284 #: inc/theme-options.php:292
msgid "开启 SMTP 服务功能" msgid "开启 SMTP 服务功能"
msgstr "" msgstr ""
#: inc/theme-options.php:290 #: inc/theme-options.php:298
msgid "邮件服务器" msgid "邮件服务器"
msgstr "" msgstr ""
#: inc/theme-options.php:291 #: inc/theme-options.php:299
msgid "填写发件服务器地址" msgid "填写发件服务器地址"
msgstr "" msgstr ""
#: inc/theme-options.php:298 #: inc/theme-options.php:306
msgid "服务器端口" msgid "服务器端口"
msgstr "" msgstr ""
#: inc/theme-options.php:299 #: inc/theme-options.php:307
msgid "填写发件服务器端口" msgid "填写发件服务器端口"
msgstr "" msgstr ""
#: inc/theme-options.php:306 #: inc/theme-options.php:314
msgid "授权方式" msgid "授权方式"
msgstr "" msgstr ""
#: inc/theme-options.php:307 #: inc/theme-options.php:315
msgid "填写登录鉴权的方式" msgid "填写登录鉴权的方式"
msgstr "" msgstr ""
#: inc/theme-options.php:314 #: inc/theme-options.php:322
msgid "邮箱帐号" msgid "邮箱帐号"
msgstr "" msgstr ""
#: inc/theme-options.php:315 #: inc/theme-options.php:323
msgid "填写邮箱账号" msgid "填写邮箱账号"
msgstr "" msgstr ""
#: inc/theme-options.php:322 #: inc/theme-options.php:330
msgid "邮箱密码" msgid "邮箱密码"
msgstr "" msgstr ""
#: inc/theme-options.php:323 #: inc/theme-options.php:331
msgid "填写邮箱密码" msgid "填写邮箱密码"
msgstr "" msgstr ""
#: inc/theme-options.php:336 #: inc/theme-options.php:344
msgid "顶部配置" msgid "顶部配置"
msgstr "" msgstr ""
#: inc/theme-options.php:341 #: inc/theme-options.php:349
msgid "顶部图片" msgid "顶部图片"
msgstr "" msgstr ""
#: inc/theme-options.php:348 #: inc/theme-options.php:356
msgid "副标题" msgid "副标题"
msgstr "" msgstr ""
#: inc/theme-options.php:355 #: inc/theme-options.php:363
msgid "标题描述" msgid "标题描述"
msgstr "" msgstr ""
#: inc/theme-options.php:362 #: inc/theme-options.php:370
msgid "页脚配置" msgid "页脚配置"
msgstr "" msgstr ""
#: inc/theme-options.php:367 #: inc/theme-options.php:375
msgid "选择需要开启的社交图标" msgid "选择需要开启的社交图标"
msgstr "" msgstr ""
#: inc/theme-options.php:368 #: inc/theme-options.php:376
msgid "国内平台" msgid "国内平台"
msgstr "" msgstr ""
#: inc/theme-options.php:373 #: inc/theme-options.php:381
msgid "新浪微博" msgid "新浪微博"
msgstr "" msgstr ""
#: inc/theme-options.php:386 #: inc/theme-options.php:394
msgid "哔哩哔哩" msgid "哔哩哔哩"
msgstr "" msgstr ""
#: inc/theme-options.php:399 #: inc/theme-options.php:407
msgid "CODING" msgid "CODING"
msgstr "" msgstr ""
#: inc/theme-options.php:412 #: inc/theme-options.php:420
msgid "码云 Gitee" msgid "码云 Gitee"
msgstr "" msgstr ""
#: inc/theme-options.php:425 #: inc/theme-options.php:433
msgid "海外平台" msgid "海外平台"
msgstr "" msgstr ""
#: inc/theme-options.php:430 #: inc/theme-options.php:438
msgid "Twitter" msgid "Twitter"
msgstr "" msgstr ""
#: inc/theme-options.php:443 #: inc/theme-options.php:451
msgid "Telegram" msgid "Telegram"
msgstr "" msgstr ""
#: inc/theme-options.php:456 #: inc/theme-options.php:464
msgid "LinkedIn" msgid "LinkedIn"
msgstr "" msgstr ""
#: inc/theme-options.php:469 #: inc/theme-options.php:477
msgid "YouTube" msgid "YouTube"
msgstr "" msgstr ""
#: inc/theme-options.php:482 #: inc/theme-options.php:490
msgid "Github" msgid "Github"
msgstr "" msgstr ""
#: inc/theme-options.php:495 #: inc/theme-options.php:503
msgid "Stack Overflow" msgid "Stack Overflow"
msgstr "" msgstr ""
#: inc/theme-options.php:508 #: inc/theme-options.php:516
msgid "其他" msgid "其他"
msgstr "" msgstr ""
#: inc/theme-options.php:513 #: inc/theme-options.php:521
msgid "电子邮箱" msgid "电子邮箱"
msgstr "" msgstr ""
#: inc/theme-options.php:526 #: inc/theme-options.php:534
msgid "工信部备案信息" msgid "工信部备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:533 #: inc/theme-options.php:541
msgid "公安网备案信息" msgid "公安网备案信息"
msgstr "" msgstr ""
#: inc/theme-options.php:540 #: inc/theme-options.php:548
msgid "公安网备案连接" msgid "公安网备案连接"
msgstr "" msgstr ""
#: inc/theme-options.php:547 #: inc/theme-options.php:555
msgid "版权信息" msgid "版权信息"
msgstr "" msgstr ""
#: inc/theme-options.php:554 #: inc/theme-options.php:562
msgid "广告配置" msgid "广告配置"
msgstr "" msgstr ""
#: inc/theme-options.php:559 #: inc/theme-options.php:567
msgid "文章页面广告" msgid "文章页面广告"
msgstr "" msgstr ""
#: inc/theme-options.php:560 #: inc/theme-options.php:568
msgid "开启顶部广告" msgid "开启顶部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:573 inc/theme-options.php:593 #: inc/theme-options.php:581 inc/theme-options.php:601
msgid "选填广告连接,如果不填则只显示图片" msgid "选填广告连接,如果不填则只显示图片"
msgstr "" msgstr ""
#: inc/theme-options.php:580 #: inc/theme-options.php:588
msgid "开启底部广告" msgid "开启底部广告"
msgstr "" msgstr ""
#: inc/theme-options.php:600 #: inc/theme-options.php:608
msgid "关于主题" msgid "关于主题"
msgstr "" msgstr ""