* @license MIT License * @version 2020.09.21 */ function getrobots() { $site_url = parse_url(site_url()); $path = (!empty($site_url['path'])) ? $site_url['path'] : ''; $robots = "User-agent: *\n\n"; $robots .= "Disallow: $path/wp-admin/\n"; $robots .= "Disallow: $path/wp-includes/\n"; $robots .= "Disallow: $path/wp-content/plugins/\n"; $robots .= "Disallow: $path/wp-content/themes/\n"; return $robots; } /** * 图片字段的默认值(后台预填用)。 * * ── 为什么不直接调 yang_image_default() ────────────────────── * 本文件由 optionsframework_init() 在 init 钩子上 require, * 而 yang_image_default() 来自 inc/theme-option-defaults.php。 * 正常时序下后者先加载,但**加载顺序被打乱时**(子主题、外部脚本 * 直接 include 本文件、插件在更早的钩子里触发本函数), * 直接调用就会 Fatal —— 后台整个白屏,比"少一个预填值"严重得多。 * * 这里先用 function_exists() 探一下,缺了就返回空串: * 后台退化成没有预填默认值,但页面能打开、能保存、能干活。 * 降级必须降到"还能用",不能降到"打不开"。 */ if (!function_exists('yang_options_default_img')) { function yang_options_default_img($id) { return function_exists('yang_image_default') ? yang_image_default($id) : ''; } } /** * 哀悼相关辅助函数的安全访问 * * 同样的道理:yang_mourning_presets() / yang_mourning_status_text() / * yang_mourning_extra_raw() 都在 inc/theme-mourning.php 里,由 * functions.php 按顺序 require。只要有人(子主题、迁移脚本、别的插件) * 在 theme-mourning.php 之前触发了 kratos_options(),这里就会 Fatal, * 整个后台白屏,且报错指向本文件,很难联想到是加载顺序问题。 * * 降级策略:缺函数时按"没有纪念日 / 没有状态说明"降级 —— * 后台那几个控件会变空,但页面能打开、能保存、能继续用。 */ if (!function_exists('yang_opt_mourning_presets')) { function yang_opt_mourning_presets() { return function_exists('yang_mourning_presets') ? yang_mourning_presets() : array(); } } if (!function_exists('yang_opt_mourning_status')) { function yang_opt_mourning_status() { return function_exists('yang_mourning_status_text') ? yang_mourning_status_text() : ''; } } if (!function_exists('yang_opt_mourning_extra_raw')) { function yang_opt_mourning_extra_raw() { return function_exists('yang_mourning_extra_raw') ? yang_mourning_extra_raw() : ''; } } /** * 今年清明的月日,给后台说明文字用(如「4 月 5 日」) * * 换算不出来(超出年份表范围)时返回一句明确的说明, * **不要**退化成「4 月 4 日」—— 那正是用户要求删掉的近似值。 */ if (!function_exists('yang_opt_qingming_label')) { function yang_opt_qingming_label() { if (!function_exists('yang_qingming_md')) { return __('换算不可用', 'kratos'); } $md = yang_qingming_md(); if ($md === null) { return sprintf( __('今年(%s 年)超出可换算范围,清明不会自动生效', 'kratos'), current_time('Y') ); } list($mo, $da) = explode('-', $md); return sprintf(__('%d 月 %d 日', 'kratos'), (int) $mo, (int) $da); } } /** * 自定义 CSS 的默认值(来自 inc/theme-custom-code.php) * * 同样是加载顺序问题:这个函数在 theme-custom-code.php 里, * 而 kratos_options() 可能被更早触发。缺了就返回空串, * 后台的「自定义 CSS」框是空的,但能打开、能填、能保存。 * * 3.2.29 起该默认值恒为空:原来的那批规则(段落缩进、h2 蓝条、列表缩进) * 已并入主题公共样式 assets/css/site.css,配置项只留给站长做临时覆盖。 */ if (!function_exists('yang_opt_default_custom_css')) { function yang_opt_default_custom_css() { return function_exists('yang_default_custom_css') ? yang_default_custom_css() : ''; } } function kratos_options() { $sitename = get_bloginfo('name'); $imagepath = ASSET_PATH . '/assets/img/options/'; $seorobots = 'robots.txt'; $seoreading = '' . __('设置-阅读-对搜索引擎的可见性', 'kratos') . ''; $top_array = array( 'banner' => __( '图片导航', 'kratos' ), 'color' => __( '颜色导航', 'kratos' ), ); $options = array(); /* ══════════════════════════════════════════════════════════ * 一、全站配置 —— 影响每一个页面的东西 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('全站配置', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('图片 Logo', 'kratos'), 'desc' => __('不选择图片则显示文字标题', 'kratos'), 'id' => 'g_logo', 'type' => 'upload', /* 有意不设 std:这里空着时显示站点名称文字,比塞一张通用占位 logo 好看。其它图片字段见 inc/theme-option-defaults.php。 */ ); $options[] = array( 'name' => __('Favicon 图片', 'kratos'), 'desc' => __('浏览器收藏夹和地址栏中显示的图标。留空则自动使用主题自带的默认图标,不会出现空白。', 'kratos'), 'id' => 'g_icon', /* 有意不写 std。 * * std 里存的是**绝对 URL**,一旦用户保存表单就会被写进数据库。 * 数据库里躺着一个写死的主题目录地址是隐患:主题目录改名、 * 换 CDN、或站点迁移域名之后,那条记录就指向不存在的文件, * 页面上是破图,而用户在后台看到的仍是"已设置",很难自己发现。 * * 所以默认值一律由运行时提供(yang_option_image()),库里保持空。 * 这样默认图地址永远由当前请求现算,改目录也不用改数据。 */ 'type' => 'upload', ); $options[] = array( 'name' => __('背景颜色', 'kratos'), 'desc' => __('全站页面的背景颜色,需填写十六进制颜色码', 'kratos'), 'id' => 'g_background', 'std' => '#f5f5f5', 'type' => 'color', ); $options[] = array( 'name' => __('Chrome 导航栏颜色', 'kratos'), 'desc' => __('Chrome 移动端浏览器地址栏的颜色', 'kratos'), 'id' => 'g_chrome', 'std' => '#282a2c', 'type' => 'color', ); $options[] = array( 'name' => __('404 页面图片', 'kratos'), 'desc' => __('访客打开不存在的地址时显示的配图', 'kratos'), 'id' => 'g_404', 'std' => yang_options_default_img('g_404'), 'type' => 'upload', ); $options[] = array( 'name' => __('前台管理员导航', 'kratos'), 'desc' => __('登录管理员后,页面顶部显示 WordPress 管理工具条', 'kratos'), 'std' => '1', 'id' => 'g_adminbar', 'type' => 'checkbox', ); $options[] = array( 'name' => __('CSS 动画库', 'kratos'), 'desc' => __('开启 animate.css 效果。会增加一个约 60KB 的样式文件,不需要就别开。', 'kratos'), 'std' => '0', 'id' => 'g_animate', 'type' => 'checkbox', ); $options[] = array( 'name' => __('Gravatar 加速', 'kratos'), 'desc' => __('把评论头像的请求转发到国内可访问的镜像,改善加载速度', 'kratos'), 'std' => '0', 'id' => 'g_gravatar', 'type' => 'checkbox', ); $options[] = array( 'name' => __('禁止生成缩略图', 'kratos'), 'desc' => __('上传图片时不再额外生成多种尺寸的副本,节省磁盘空间', 'kratos'), 'id' => 'g_removeimgsize', 'std' => '0', 'type' => 'checkbox', ); $options[] = array( 'name' => __('Gutenberg 编辑器', 'kratos'), 'desc' => __('开启 WordPress 区块编辑器。关闭则使用经典编辑器。', 'kratos'), 'std' => '0', 'id' => 'g_gutenberg', 'type' => 'checkbox', ); /* ══════════════════════════════════════════════════════════ * 二、顶部导航 —— 页头那一条 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('顶部导航', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __( '顶部样式', 'kratos' ), 'desc' => __('请选择顶部样式(图片导航或颜色导航)', 'kratos'), 'id' => 'top_select', 'std' => 'banner', 'type' => 'select', 'options' => $top_array ); $options[] = array( 'name' => __('图片导航背景', 'kratos'), 'desc' => __('顶部样式选「图片导航」时使用。留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'top_img', 'std' => yang_options_default_img('top_img'), 'class' => 'hidden', 'type' => 'upload', ); $options[] = array( 'name' => __('颜色导航背景', 'kratos'), 'desc' => __('顶部样式选「颜色导航」时使用', 'kratos'), 'id' => 'top_color', 'std' => '#24292e', 'class' => 'hidden', 'type' => 'color', ); $options[] = array( 'name' => __('副标题', 'kratos'), 'desc' => __('显示在站点标题旁边的一句短话', 'kratos'), 'id' => 'top_title', 'std' => 'Kratos', 'class' => 'hidden', 'type' => 'text', ); $options[] = array( 'name' => __('标题描述', 'kratos'), 'std' => __('一款专注于用户阅读体验的响应式博客主题', 'kratos'), 'id' => 'top_describe', 'class' => 'hidden', 'type' => 'text', ); /* ══════════════════════════════════════════════════════════ * 三、首页配置 —— 只管首页列表长什么样 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('首页配置', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('特色图片', 'kratos'), 'desc' => __('在首页文章列表的每篇标题上方显示一张配图', 'kratos'), 'std' => '1', 'id' => 'g_thumbnail', 'type' => 'checkbox', ); $options[] = array( 'name' => __('默认特色图', 'kratos'), 'desc' => __('文章既没有正文图片、也没有设置特色图时,用这张顶上。留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'g_postthumbnail', 'class' => 'hidden', 'std' => yang_options_default_img('g_postthumbnail'), 'type' => 'upload', ); $options[] = array( 'name' => __('无内容图片', 'kratos'), 'desc' => __('搜索不到结果、或分类下还没有文章时显示的插画。留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'g_nothing', 'std' => yang_options_default_img('g_nothing'), 'type' => 'upload', ); /* ══════════════════════════════════════════════════════════ * 四、文章配置 —— 打开单篇文章才看得到的东西 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('文章配置', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('页面布局', 'kratos'), 'desc' => __('文章页面是否显示侧边栏。仅在文章详情页生效。', 'kratos'), 'id' => "g_article_widgets", 'std' => "two_side", 'type' => "images", 'options' => array( 'one_side' => $imagepath . 'col-12.png', 'two_side' => $imagepath . 'col-8.png') ); $options[] = array( 'name' => __('文章打赏', 'kratos'), 'desc' => __('在文章底部显示打赏按钮,点开是收款二维码', 'kratos'), 'id' => 'g_donate', 'type' => 'checkbox', ); $options[] = array( 'name' => __('支付宝收款码', 'kratos'), 'desc' => __('留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'g_donate_alipay', 'std' => yang_options_default_img('g_donate_alipay'), 'type' => 'upload', 'class' => 'hidden', ); $options[] = array( 'name' => __('微信收款码', 'kratos'), 'desc' => __('留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'g_donate_wechat', 'std' => yang_options_default_img('g_donate_wechat'), 'type' => 'upload', 'class' => 'hidden', ); /* ══════════════════════════════════════════════════════════ * 五、自动目录 —— 把长文切成能跳的章节 * * 与「文章配置」分开成独立标签页,是刻意的:目录的选项有六项, * 塞进文章配置里会把「页面布局 / 打赏」这些一眼要看到的东西挤下去。 * * ⚠️ 这里的 std 必须与 inc/theme-toc.php 的 yang_toc_defaults() 一致。 * 前者只服务「后台预填」和「恢复默认」,运行时一律走 * kratos_option($id, 默认值) —— 两处不一致会出现 * 「页面照 A 渲染、后台框里显示 B」的错位,而且极难发现。 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('自动目录', 'kratos'), 'type' => 'heading', ); /* ── 分组标题:正文里的那一份 ────────────────────────────── * * 用 info 类型而不是 heading:heading 会另起一个标签页 * (framework 里 `case "heading"` 会 $counter++ 并新建 * #options-group-N),info 只渲染成一行

+ 说明文字, * 既不进标签页菜单,也不生成表单字段(见 * class-options-interface.php 的 :24 / :59 / :91)。 * * 加这两条小标题的原因:浮动目录和正文目录是两件互不相干的事, * 但原来的选项排成一长列,「添加方式」「自动插入位置」跟在 * 「浮动显示」后面,看着像是两种目录共用的设置,容易让人以为 * 浮动目录也分手动/自动。 */ $options[] = array( 'name' => __('正文里的目录', 'kratos'), 'desc' => __('下面这几项只影响正文流里那一份目录 —— 它跟着文章一起排版,会占正文位置。', 'kratos'), 'id' => 'toc_group_inline', 'type' => 'info', ); $options[] = array( 'name' => __('在正文中显示', 'kratos'), 'desc' => __('勾选后,在文章正文里插一份目录。
它和下面的「浮动显示」互不影响:两个都勾就同时出现两份(正文一份、边上浮一份),只勾一个就只出现一种。', 'kratos'), 'id' => 'toc_inline', 'std' => '1', 'type' => 'checkbox', ); $options[] = array( 'name' => __('正文中的对齐', 'kratos'), 'desc' => __('正文里那份目录在文章内容区域内靠左还是靠右。这里不是「浮到页面边上」—— 目录仍然在正文流里,上下文的文字会绕开它,只是整体贴向一侧。
只在勾选「在正文中显示」时才有意义。', 'kratos'), 'id' => 'toc_inline_align', 'std' => 'left', 'type' => 'select', 'options' => array( 'left' => __('靠左', 'kratos'), 'right' => __('靠右', 'kratos'), ), ); $options[] = array( 'name' => __('添加方式', 'kratos'), 'desc' => __('手动:不自动加,只有正文里手写了 [TOC] 的地方才显示(老文章的行为,升级后不会突然多出目录)。
自动:由主题自己在「自动插入位置」处加一份,不用改任何文章。
本项只管正文里的那一份;浮动目录不受它影响(浮动目录没有地方写 [TOC],勾了就一直在)。', 'kratos'), 'id' => 'toc_mode', 'std' => 'manual', 'type' => 'select', 'options' => array( 'manual' => __('手动(只在写 [TOC] 的地方显示)', 'kratos'), 'auto' => __('自动添加', 'kratos'), ), ); $options[] = array( 'name' => __('自动插入位置', 'kratos'), 'desc' => __('只在「添加方式 = 自动」且勾选了「在正文中显示」时起作用;手动方式下插入点由你自己写的 [TOC] 决定。
第一个标题之前取正文里最先出现的 h1 或 h2 —— 文章大标题在正文之外,不会被算进去;一个 h1/h2 都没有时退回插在文章开头。', 'kratos'), 'id' => 'toc_anchor', 'std' => 'first', 'type' => 'select', 'options' => array( 'start' => __('文章开头', 'kratos'), 'first' => __('第一个标题之前(H1 / H2)', 'kratos'), 'end' => __('文章结尾', 'kratos'), ), ); $options[] = array( 'name' => __('浮动目录', 'kratos'), 'desc' => __('下面两项只影响浮在页面边上那一份 —— 它不占正文位置,和正文里的目录互不相干。', 'kratos'), 'id' => 'toc_group_float', 'type' => 'info', ); $options[] = array( 'name' => __('浮动显示', 'kratos'), 'desc' => __('勾选后,目录变成贴在页面边缘的浮动面板,点边上的小标签滑出,不占正文位置。窄屏(手机)上是从边缘滑出的抽屉,不会挤占正文。
与「在正文中显示」互相独立,可以同时勾选。它没有手动/自动之分:勾了就一直在,不勾就不出现。', 'kratos'), 'id' => 'toc_float', 'std' => '', 'type' => 'checkbox', ); $options[] = array( 'name' => __('浮动方向', 'kratos'), 'desc' => __('浮动面板贴页面左边还是右边。只在勾选「浮动显示」时才有意义。', 'kratos'), 'id' => 'toc_float_side', 'std' => 'left', 'type' => 'select', 'options' => array( 'left' => __('页面左侧', 'kratos'), 'right' => __('页面右侧', 'kratos'), ), ); $options[] = array( 'name' => __('两份目录共用的设置', 'kratos'), 'desc' => __('下面几项对正文里和浮动的那一份同时生效。', 'kratos'), 'id' => 'toc_group_common', 'type' => 'info', ); $options[] = array( 'name' => __('默认状态', 'kratos'), 'desc' => __('默认显示:进来就能看到全部条目。默认隐藏:先只露出标题栏(或侧边的标签),读者自己点开。较长或标题很多的文章建议默认隐藏,否则目录会占掉一屏。
注:这里只管「默认长什么样」,读者点开后仍然可以正常使用;正文里手写的 [TOC] 也可以用 open="0" 单独指定。', 'kratos'), 'id' => 'toc_default', 'std' => 'show', 'type' => 'select', 'options' => array( 'show' => __('默认显示', 'kratos'), 'hide' => __('默认隐藏', 'kratos'), ), ); $options[] = array( 'name' => __('目录标题', 'kratos'), 'desc' => __('显示在目录顶部的那行字。留空则用「目录」。', 'kratos'), 'id' => 'toc_title', 'std' => __('目录', 'kratos'), 'type' => 'text', ); $options[] = array( 'name' => __('收录标题级别', 'kratos'), 'desc' => __('勾选要进目录的标题级别。正文里的 h1 是作者自己写的章节标题(文章大标题在正文之外,不会被收进来),所以要用 h1 分章的文章也建议勾上 h1。
h4 以下通常是细节,勾上会让目录变得很长。', 'kratos'), 'id' => 'toc_levels', 'std' => array('1' => 1, '2' => 1, '3' => 1, '4' => 0), 'type' => 'multicheck', 'options' => array( '1' => array('name' => 'H1', 'note' => __('一级标题', 'kratos')), '2' => array('name' => 'H2', 'note' => __('二级标题', 'kratos')), '3' => array('name' => 'H3', 'note' => __('三级标题', 'kratos')), '4' => array('name' => 'H4', 'note' => __('四级标题', 'kratos')), ), ); $options[] = array( 'name' => __('显示序号', 'kratos'), 'desc' => __('在条目前面加 1 / 1.1 / 1.1.1 这样的序号。', 'kratos'), 'id' => 'toc_numbering', 'std' => '0', 'type' => 'checkbox', ); /* ══════════════════════════════════════════════════════════ * 六、站长信息 —— 文章页页脚那张名片 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('站长信息', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('个人头像', 'kratos'), 'desc' => __('显示在文章底部作者名片里。留空则自动使用主题自带的默认头像。', 'kratos'), 'id' => 'a_gravatar', 'std' => yang_options_default_img('a_gravatar'), 'type' => 'upload', ); $options[] = array( 'name' => __('个人昵称', 'kratos'), 'id' => 'a_nickname', 'std' => 'Kratos', 'type' => 'text', ); $options[] = array( 'name' => __('个人简介', 'kratos'), 'std' => __('保持饥渴的专注,追求最佳的品质', 'kratos'), 'id' => 'a_about', 'type' => 'textarea', ); /* ══════════════════════════════════════════════════════════ * 七、页脚配置 —— 页面最底下那几行 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('页脚配置', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('版权信息', 'kratos'), 'desc' => __('页脚显示的那行版权声明。留空则自动用「COPYRIGHT © 当前年份 站点名称 版权所有」。', 'kratos'), 'id' => 's_copyright', /* 有意不写 std:std 里写死的年份过一年就变成旧年份, 而且一旦保存就永久留在库里。改由 footer.php 每次现算。 */ 'type' => 'textarea', ); $options[] = array( 'name' => __('是否显示国旗', 'kratos'), 'desc' => __('在页脚显示一面国旗', 'kratos'), 'std' => '0', 'id' => 'g_flag', 'type' => 'checkbox', ); $options[] = array( 'name' => __('国旗图片', 'kratos'), 'desc' => __('留空则自动使用主题自带的默认国旗。', 'kratos'), 'id' => 'g_flag_url', /* 不写 std —— 理由同 g_icon:默认值由运行时给,库里不存绝对地址。 */ 'type' => 'upload', ); $options[] = array( 'name' => __('工信部备案信息', 'kratos'), 'id' => 's_icp', 'placeholder' => __('例如:京ICP证xxxxxx号', 'kratos'), 'type' => 'text', ); $options[] = array( 'name' => __('公安网备案信息', 'kratos'), 'id' => 's_gov', 'placeholder' => __('例如:京公网安备 xxxxxxxxxxxx号', 'kratos'), 'type' => 'text', ); $options[] = array( 'name' => __('公安网备案链接', 'kratos'), 'id' => 's_gov_link', 'placeholder' => __('例如:http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=xxxxx', 'kratos'), 'type' => 'text', ); /* ══════════════════════════════════════════════════════════ * 八、哀悼模式 —— 整站级功能,与首页无关 * * 这一组原来错放在「首页配置」下面。它影响的是整站配色 * (首页、文章页、说明页都变黑白),放首页下面会让人以为 * 只改首页,而且想找它的人第一反应不会去点「首页配置」。 * 单独成组,名字直说它是什么。 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('哀悼模式', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('手动常开', 'kratos'), 'desc' => __('勾上就一直黑白,与日期无关。这是老的开关,日常建议用下面的「按纪念日自动哀悼」。', 'kratos'), 'id' => 'g_rip', 'type' => 'checkbox', ); $options[] = array( 'name' => __('按纪念日自动哀悼', 'kratos'), 'desc' => __('勾选后,只有在下表勾选的那些日期才会自动黑白,其余日子正常显示。日期按站点时区判断,只比对月和日,每年循环。', 'kratos'), 'id' => 'g_rip_auto', 'type' => 'checkbox', ); // 把内置清单转成 multicheck 需要的格式 $rip_legal = array(); $rip_custom = array(); foreach (yang_opt_mourning_presets() as $key => $info) { /* 键有两种:静态日期(`09-03`)和动态日期(`qingming`)。 动态日期的键是内部标识,不能直接摆在用户面前 —— 所以看 key_label,没有就回退到键本身(静态日期就是 MM-DD, 显示出来正好是用户认得的日期)。 */ $label = isset($info['key_label']) ? $info['key_label'] : $key; $entry = array( 'name' => $label . ' ' . $info['name'], 'note' => $info['note'], ); if (isset($info['group']) && $info['group'] === 'legal') { $rip_legal[$key] = $entry; } else { $rip_custom[$key] = $entry; } } $rip_default = array(); foreach (yang_opt_mourning_presets() as $key => $info) { $rip_default[$key] = !empty($info['default']) ? 1 : 0; } $options[] = array( 'name' => __('纪念日清单', 'kratos'), 'desc' => sprintf( __('勾选需要自动黑白的日期。默认一个都不勾,请按自己的意愿挑选。前三个是法定纪念日,后面几个是民间通行做法。日期按站点时区判断,只比对月和日,每年循环。
清明节是节气,日期每年浮动(4 月 4~6 日之间),已脱离固定日期、按天文历逐年换算 —— 今年是 %s。', 'kratos'), esc_html(yang_opt_qingming_label()) ), 'id' => 'g_rip_days', 'std' => $rip_default, 'type' => 'multicheck', 'options' => array_merge($rip_legal, $rip_custom), ); $options[] = array( 'name' => __('附加日期', 'kratos'), 'desc' => sprintf( __('清单里没有的日期填这里。
%1$s 表示每年循环(如 05-12);%2$s 表示只在当年生效(如 2020-04-04,用于历次全国哀悼日这类一次性事件)。
多个日期用空格或逗号分隔。当前填的是 %3$s。', 'kratos'), 'MM-DD', 'YYYY-MM-DD', esc_html(yang_opt_mourning_extra_raw() === '' ? __('(空)', 'kratos') : yang_opt_mourning_extra_raw()) ), 'id' => 'g_rip_extra', 'type' => 'text', ); $options[] = array( 'name' => __('说明页路径', 'kratos'), 'desc' => sprintf( /* 注意:desc 会过 wp_kses($allowedtags),那是 WordPress 的默认白名单, 只放行 a/abbr/b/br/em/i/strong 等,**不放行 ** —— 写 会被静默剥掉,页面上只剩裸文字。所以这里用 强调。 */ __('变黑白时,页面顶部会出现一条提示,点进去是一个说明页面(彩色),讲清楚为什么变黑白、哪几天会变。
这里可以改那个页面的路径。留空默认 memory,即 %s
注意:不要和已有文章或页面的路径重名。', 'kratos'), esc_url(home_url('/memory/')) ), 'id' => 'g_rip_page_slug', 'std' => 'memory', 'type' => 'text', ); $options[] = array( 'desc' => yang_opt_mourning_status(), 'type' => 'info', ); /* ══════════════════════════════════════════════════════════ * 九、收录与统计 —— 给搜索引擎看的 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('收录与统计', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('分享图片', 'kratos'), 'desc' => __('搜索引擎或者社交工具分享首页时抓取的图片。留空则自动使用主题自带的默认图片。', 'kratos'), 'id' => 'seo_shareimg', 'std' => yang_options_default_img('seo_shareimg'), 'type' => 'upload', ); $options[] = array( 'name' => __('关键词', 'kratos'), 'desc' => __('每个关键词之间需要用「英文逗号」分割', 'kratos'), 'id' => 'seo_keywords', 'type' => 'text', ); $options[] = array( 'name' => __('站点描述', 'kratos'), 'id' => 'seo_description', 'type' => 'textarea', ); $options[] = array( 'name' => __('统计代码', 'kratos'), 'desc' => __('填在页脚的统计脚本(如站点访问量统计)。注意:输入 HTML/JS 代码时请注意辨别代码安全!', 'kratos'), 'id' => 'seo_statistical', 'type' => 'textarea', ); $options[] = array( 'name' => __('robots.txt 内容', 'kratos'), 'desc' => __('- 需要 ', 'kratos') . $seoreading . __(' 是开启的状态,下面的配置才会生效', 'kratos'), 'type' => 'info', ); $options[] = array( 'desc' => __('- 如果网站根目录下已经有 robots.txt 文件,下面的配置不会生效', 'kratos'), 'type' => 'info', ); $options[] = array( 'desc' => __('- 点击 ', 'kratos') . $seorobots . __(' 查看配置是否生效,如果网站开启了 CDN,可能需要刷新缓存才会生效', 'kratos'), 'type' => 'info', ); $options[] = array( 'id' => 'seo_robots', 'std' => getrobots(), 'type' => 'textarea', ); /* ══════════════════════════════════════════════════════════ * 十、邮件通知 —— SMTP 与评论提醒 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('邮件通知', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('SMTP 服务', 'kratos'), 'desc' => __('用第三方邮箱发信。不开启时走服务器本地发信,很多主机上会被判定为垃圾邮件。', 'kratos'), 'id' => 'm_smtp', 'type' => 'checkbox', ); $options[] = array( 'name' => __('邮件服务器', 'kratos'), 'desc' => __('填写发件服务器地址', 'kratos'), 'id' => 'm_host', 'class' => 'hidden', 'type' => 'text', ); $options[] = array( 'name' => __('服务器端口', 'kratos'), 'desc' => __('填写发件服务器端口', 'kratos'), 'id' => 'm_port', 'class' => 'hidden', 'type' => 'text', ); $options[] = array( 'name' => __('授权方式', 'kratos'), 'desc' => __('填写登录鉴权的方式,ssl 或 tls', 'kratos'), 'id' => 'm_sec', 'class' => 'hidden', 'type' => 'text', ); $options[] = array( 'name' => __('邮箱帐号', 'kratos'), 'desc' => __('填写邮箱账号', 'kratos'), 'id' => 'm_username', 'class' => 'hidden', 'type' => 'text', ); $options[] = array( 'name' => __('邮箱密码', 'kratos'), 'desc' => __('填写邮箱密码或授权码', 'kratos'), 'id' => 'm_passwd', 'class' => 'hidden', 'type' => 'password', ); $options[] = array( 'id' => 'm_sendmail', 'class' => 'hidden', 'type' => 'sendmail', ); /* ── 评论提醒的开关 ────────────────────────────────────── * * ⚠️ 这三个开关原先**只有代码在读取、后台没有界面**: * `m_comment_notify` —— 有人回复时通知被回复者 * `m_comment_approved_notify` —— 评论通过审核时通知评论者 * `m_keep_core_notify` —— 保留 WordPress 自带的作者通知 * 也就是说用户无法关掉它们,只能改代码。 * 静态契约检查(`_static_315.php`)会报「模板读取的选项都有界面」失败, * 那一项正是靠这个抓出来的。 * * 默认值取 true 与代码里的 `kratos_option('m_comment_notify', true)` 一致: * 评论提醒默认开着(这是博客的基本礼貌),想关的人自己能关。 */ $options[] = array( 'name' => __('有人回复时发邮件通知', 'kratos'), 'desc' => __('评论收到回复时,给被回复的人发一封提醒。需要先在下面配好发信方式,否则发不出去。', 'kratos'), 'id' => 'm_comment_notify', 'std' => true, 'type' => 'checkbox', ); $options[] = array( 'name' => __('评论通过审核时通知评论者', 'kratos'), 'desc' => __('评论从「待审核」变为「已通过」时,告诉评论者他的评论已显示。适合开了先审后发的站点。', 'kratos'), 'id' => 'm_comment_approved_notify', 'std' => true, 'type' => 'checkbox', ); $options[] = array( 'name' => __('保留 WordPress 自带的作者通知', 'kratos'), 'desc' => __('主题在装了评论插件时会关掉 WordPress 自带的「有新评论通知站长」,避免和插件重复发信。只有当插件在场时勾这一项才有意义;插件不在场时主题一定会保留自带通知,不会让你收不到信。', 'kratos'), 'id' => 'm_keep_core_notify', 'std' => false, 'type' => 'checkbox', ); /* ══════════════════════════════════════════════════════════ * 十一、自定义代码 —— 兜底用,放最后 * * 3.2.29 起这两项默认都为空:站点自己的通用样式 * (段落缩进、h2 蓝条、列表缩进)已并入 assets/css/site.css, * 跟着主题走、升级不丢,也不再需要在这里重复一份。 * ══════════════════════════════════════════════════════════ */ $options[] = array( 'name' => __('自定义代码', 'kratos'), 'type' => 'heading', ); $options[] = array( 'name' => __('自定义 CSS', 'kratos'), 'desc' => __('附加样式,排在主题公共样式之后加载,用于临时覆盖。站点通用样式已并入主题的 assets/css/site.css,这里留空即可。保存后立即生效,随主题升级保留。', 'kratos'), 'id' => 'g_custom_css', 'std' => yang_opt_default_custom_css(), 'type' => 'code', 'settings' => array('rows' => 14), ); $options[] = array( 'name' => __('自定义 JS', 'kratos'), 'desc' => __('附加脚本,在页面底部加载,不需要写 <script> 标签。', 'kratos'), 'id' => 'g_custom_js', 'std' => '', 'type' => 'code', 'settings' => array('rows' => 14), ); return $options; }