feat: add comment location option

now you can choose whether to enable comment location in the comment
fields, besides, Comment become a new group in Sakura Options
issue #237
pull/239/head
Spirit 2020-08-04 23:42:53 +08:00
parent a0d8f8a6cf
commit fad1d9f30f
8 changed files with 1895 additions and 2004 deletions

View File

@ -424,7 +424,7 @@ if (!function_exists('akina_comment_format')) {
</div>
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));?>
<div class="right">
<div class="info"><time datetime="<?php comment_date('Y-m-d');?>"><?php echo poi_time_since(strtotime($comment->comment_date_gmt), true); //comment_date(get_option('date_format')); ?></time><?php echo siren_get_useragent($comment->comment_agent); ?><?php echo mobile_get_useragent_icon($comment->comment_agent); ?>&nbsp;<?php _e('Location', 'sakura'); /*来自*/?>: <?php echo convertip(get_comment_author_ip()); ?>
<div class="info"><time datetime="<?php comment_date('Y-m-d');?>"><?php echo poi_time_since(strtotime($comment->comment_date_gmt), true); //comment_date(get_option('date_format')); ?></time><?php echo siren_get_useragent($comment->comment_agent); ?><?php echo mobile_get_useragent_icon($comment->comment_agent); ?>&nbsp;<?php if(akina_option('open_location')){ _e('Location', 'sakura'); /*来自*/?>: <?php echo convertip(get_comment_author_ip());} ?>
<?php if (current_user_can('manage_options') and (wp_is_mobile() == false)) {
$comment_ID = $comment->comment_ID;
$i_private = get_comment_meta($comment_ID, '_private', true);

View File

@ -8,7 +8,7 @@ body {
.nav-tab-wrapper {
position: relative;
max-width: 860px;
max-width: 930px;
margin: auto !important;
}
@ -37,7 +37,7 @@ body {
.nav-tab {
background: none;
border:none;
padding: 10px 20px;
padding: 10px 15px;
font-weight: 300;
font-size: 15px;
color: darkgoldenrod;
@ -74,17 +74,23 @@ a#options-group-4-tab:before {
a#options-group-5-tab:before {
font-family: "dashicons";
content: "\f110";
content: "\f101";
float: left;
}
a#options-group-6-tab:before {
font-family: "dashicons";
content: "\f110";
float: left;
}
a#options-group-7-tab:before {
font-family: "dashicons";
content: "\f325";
float: left;
}
a#options-group-7-tab:before {
a#options-group-8-tab:before {
font-family: "dashicons";
content: "\f487";
float: left;

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -734,6 +734,139 @@ function optionsframework_options()
'std' => '',
'type' => 'text');
//评论区
$options[] = array(
'name' => __('Comment field', 'sakura'), /*评论区*/
'type' => 'heading');
$options[] = array(
'name' => __('Gravatar avatar proxy', 'sakura'),
'desc' => __('A front-ed proxy for Gravatar, eg. gravatar.2heng.xin/avatar . Leave it blank if you do not need.', 'sakura'),
'id' => 'gravatar_proxy',
'std' => "gravatar.2heng.xin/avatar",
'type' => "text");
$options[] = array(
'name' => __('Comment image upload API', 'sakura'), /*评论图片上传接口*/
'id' => 'img_upload_api',
'std' => "imgur",
'type' => "radio",
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(
'name' => __('Imgur Client ID', 'sakura'),
'desc' => __('Register your application <a href="https://api.imgur.com/oauth2/addclient">here</a>, note we only need the Client ID here.', 'sakura'),
'id' => 'imgur_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('SM.MS Secret Token', 'sakura'),
'desc' => __('Register your application <a href="https://sm.ms/home/apitoken">here</a>.', 'sakura'),
'id' => 'smms_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto API v1 key', 'sakura'),
'desc' => __('Get your API key here: ' . akina_option('cheverto_url') . '/dashboard/settings/api', 'sakura'),
'id' => 'chevereto_api_key',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto URL', 'sakura'),
'desc' => __('Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto.com', 'sakura'),
'id' => 'cheverto_url',
'std' => 'https://your.cherverto.com',
'type' => 'text');
$options[] = array(
'name' => __('Comment images proxy', 'sakura'),
'desc' => __('A front-ed proxy for the uploaded images. Leave it blank if you do not need.', 'sakura'),
'id' => 'cmt_image_proxy',
'std' => 'https://images.weserv.nl/?url=',
'type' => 'text');
$options[] = array(
'name' => __('Imgur upload proxy', 'sakura'),
'desc' => __('A back-ed proxy to upload images. You may set a self hosted proxy with Nginx, following my <a href="https://2heng.xin/2018/06/06/javascript-upload-images-with-imgur-api/">turtal</a>. This feature is mainly for Chinese who cannot access to Imgur due to the GFW. The default and official setting is 【<a href="https://api.imgur.com/3/image/">https://api.imgur.com/3/image/</a>】', 'sakura'),
'id' => 'imgur_upload_image_proxy',
'std' => 'https://api.imgur.com/3/image/',
'type' => 'text');
$options[] = array(
'name' => __('Comments reply notification', 'sakura'), /*邮件回复通知*/
'desc' => __('WordPress will use email to notify users when their comments receive a reply by default. Tick this item allows users to set their own comments reply notification', 'sakura'), /*WordPress默认会使用邮件通知用户评论收到回复开启此项允许用户设置自己的评论收到回复时是否使用邮件通知*/
'id' => 'mail_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Administrator comment notification', 'sakura'), /*邮件回复通知管理员*/
'desc' => __('Whether to use email notification when the administrator\'s comments receive a reply', 'sakura'), /*当管理员评论收到回复时是否使用邮件通知*/
'id' => 'admin_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable private comment', 'sakura'), /*允许私密评论*/
'desc' => __('Allow users to set their own comments to be invisible to others', 'sakura'), /*允许用户设置自己的评论对其他人不可见*/
'id' => 'open_private_message',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Human verification', 'sakura'), /*机器人验证*/
'desc' => __('Enable human verification', 'sakura'), /*开启机器人验证*/
'id' => 'norobot',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('QQ avatar link encryption', 'sakura'), /*QQ头像链接加密*/
'desc' => __('Do not display the user\'s qq avatar links directly.', 'sakura'), /*不直接暴露用户qq头像链接*/
'id' => 'qq_avatar_link',
'std' => "off",
'type' => "select",
'options' => array(
'off' => __('Off (default)', 'sakura'), /*关闭(默认)*/
'type_1' => __('use redirect (general security)', 'sakura'), /*使用 重定向(安全性一般)'*/
'type_2' => __('fetch data at backend (high security)', 'sakura'), /*后端获取数据(安全性高)*/
'type_3' => __('fetch data at backend (high securityslow)', 'sakura'), /*后端获取数据(安全性高, 慢)*/
));
$options[] = array(
'name' => __('Comment UA infomation', 'sakura'), /*评论UA信息*/
'desc' => __('Check to enable, display the user\'s browser, operating system information', 'sakura'), /*勾选开启,显示用户的浏览器,操作系统信息*/
'id' => 'open_useragent',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Comment location infomation', 'sakura'), /*评论位置信息*/
'desc' => __('Check to enable, display the user\'s location info', 'sakura'), /*勾选开启,显示用户的位置信息*/
'id' => 'open_location',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable disqus', 'sakura'), /*开启多说插件支持*/
'desc' => __('Enable disqus for comment', 'sakura'), /*多说已经凉了*/
'id' => 'general_disqus_plugin_support',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Time Zone adjustment', 'sakura'), /*时区调整*/
'desc' => __('If the comment has a time difference problem adjust here, fill in an integer, the calculation method: actual_time = display_error_time - the_integer_you_entered (unit: hour)', 'sakura'), /*如果评论出现时差问题在这里调整,填入一个整数,计算方法:实际时间=显示错误的时间-你输入的整数(单位:小时)*/
'id' => 'time_zone_fix',
'std' => '0',
'type' => 'text');
//后台配置
$options[] = array(
'name' => __('Dashboard configuration', 'sakura'), /*后台配置*/
@ -1034,66 +1167,6 @@ function optionsframework_options()
'type_4' => __('23k Views (chinese)', 'sakura'), /*23k 次访问(中式)*/
));
$options[] = array(
'name' => __('Gravatar avatar proxy', 'sakura'),
'desc' => __('A front-ed proxy for Gravatar, eg. gravatar.2heng.xin/avatar . Leave it blank if you do not need.', 'sakura'),
'id' => 'gravatar_proxy',
'std' => "gravatar.2heng.xin/avatar",
'type' => "text");
$options[] = array(
'name' => __('Comment image upload API', 'sakura'), /*评论图片上传接口*/
'id' => 'img_upload_api',
'std' => "imgur",
'type' => "radio",
'options' => array(
'imgur' => __('Imgur (https://imgur.com)', 'sakura'),
'smms' => __('SM.MS (https://sm.ms)', 'sakura'),
'chevereto' => __('Chevereto (https://chevereto.com)', 'sakura'),
));
$options[] = array(
'name' => __('Imgur Client ID', 'sakura'),
'desc' => __('Register your application <a href="https://api.imgur.com/oauth2/addclient">here</a>, note we only need the Client ID here.', 'sakura'),
'id' => 'imgur_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('SM.MS Secret Token', 'sakura'),
'desc' => __('Register your application <a href="https://sm.ms/home/apitoken">here</a>.', 'sakura'),
'id' => 'smms_client_id',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto API v1 key', 'sakura'),
'desc' => __('Get your API key here: ' . akina_option('cheverto_url') . '/dashboard/settings/api', 'sakura'),
'id' => 'chevereto_api_key',
'std' => '',
'type' => 'text');
$options[] = array(
'name' => __('Chevereto URL', 'sakura'),
'desc' => __('Your Chevereto homepage url, no slash in the end, eg. https://your.cherverto.com', 'sakura'),
'id' => 'cheverto_url',
'std' => 'https://your.cherverto.com',
'type' => 'text');
$options[] = array(
'name' => __('Comment images proxy', 'sakura'),
'desc' => __('A front-ed proxy for the uploaded images. Leave it blank if you do not need.', 'sakura'),
'id' => 'cmt_image_proxy',
'std' => 'https://images.weserv.nl/?url=',
'type' => 'text');
$options[] = array(
'name' => __('Imgur upload proxy', 'sakura'),
'desc' => __('A back-ed proxy to upload images. You may set a self hosted proxy with Nginx, following my <a href="https://2heng.xin/2018/06/06/javascript-upload-images-with-imgur-api/">turtal</a>. This feature is mainly for Chinese who cannot access to Imgur due to the GFW. The default and official setting is 【<a href="https://api.imgur.com/3/image/">https://api.imgur.com/3/image/</a>】', 'sakura'),
'id' => 'imgur_upload_image_proxy',
'std' => 'https://api.imgur.com/3/image/',
'type' => 'text');
$options[] = array(
'name' => __('Enable live search', 'sakura'), /*启用实时搜索*/
'desc' => __('Real-time search in the foreground, call the Rest API to update the cache every hour, you can manually set the cache time in api.php', 'sakura'), /*前台实现实时搜索,调用 Rest API 每小时更新一次缓存,可在 functions.php 里手动设置缓存时间*/
@ -1143,67 +1216,5 @@ function optionsframework_options()
'std' => 'bibi',
'type' => 'text');
$options[] = array(
'name' => __('Comments reply notification', 'sakura'), /*邮件回复通知*/
'desc' => __('WordPress will use email to notify users when their comments receive a reply by default. Tick this item allows users to set their own comments reply notification', 'sakura'), /*WordPress默认会使用邮件通知用户评论收到回复开启此项允许用户设置自己的评论收到回复时是否使用邮件通知*/
'id' => 'mail_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Administrator comment notification', 'sakura'), /*邮件回复通知管理员*/
'desc' => __('Whether to use email notification when the administrator\'s comments receive a reply', 'sakura'), /*当管理员评论收到回复时是否使用邮件通知*/
'id' => 'admin_notify',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable private comment', 'sakura'), /*允许私密评论*/
'desc' => __('Allow users to set their own comments to be invisible to others', 'sakura'), /*允许用户设置自己的评论对其他人不可见*/
'id' => 'open_private_message',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Human verification', 'sakura'), /*机器人验证*/
'desc' => __('Enable human verification', 'sakura'), /*开启机器人验证*/
'id' => 'norobot',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('QQ avatar link encryption', 'sakura'), /*QQ头像链接加密*/
'desc' => __('Do not display the user\'s qq avatar links directly.', 'sakura'), /*不直接暴露用户qq头像链接*/
'id' => 'qq_avatar_link',
'std' => "off",
'type' => "select",
'options' => array(
'off' => __('Off (default)', 'sakura'), /*关闭(默认)*/
'type_1' => __('use redirect (general security)', 'sakura'), /*使用 重定向(安全性一般)'*/
'type_2' => __('fetch data at backend (high security)', 'sakura'), /*后端获取数据(安全性高)*/
'type_3' => __('fetch data at backend (high securityslow)', 'sakura'), /*后端获取数据(安全性高, 慢)*/
));
$options[] = array(
'name' => __('Comment UA infomation', 'sakura'), /*评论UA信息*/
'desc' => __('Check to enable, display the user\'s browser, operating system information', 'sakura'), /*勾选开启,显示用户的浏览器,操作系统信息*/
'id' => 'open_useragent',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Enable disqus', 'sakura'), /*开启多说插件支持*/
'desc' => __('Enable disqus for comment', 'sakura'), /*多说已经凉了*/
'id' => 'general_disqus_plugin_support',
'std' => '0',
'type' => 'checkbox');
$options[] = array(
'name' => __('Time Zone adjustment', 'sakura'), /*时区调整*/
'desc' => __('If the comment has a time difference problem adjust here, fill in an integer, the calculation method: actual_time = display_error_time - the_integer_you_entered (unit: hour)', 'sakura'), /*如果评论出现时差问题在这里调整,填入一个整数,计算方法:实际时间=显示错误的时间-你输入的整数(单位:小时)*/
'id' => 'time_zone_fix',
'std' => '0',
'type' => 'text');
return $options;
}