Skip to content

Commit

Permalink
✨ 增加不显示站长IP归属地及运营商支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Dec 4, 2022
1 parent b4264b8 commit e2d5f83
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 61 deletions.
26 changes: 13 additions & 13 deletions assets/dist/style/libs.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/dist/style/style.min.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion assets/style/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,6 @@ a:hover {
}

.comment-os {
margin-top: 10px;
font-size: 12px;

img {
Expand Down
36 changes: 18 additions & 18 deletions inc/fun/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,25 @@ class="hide-info animated bounceIn c-sub-a t-sm ml-1 comment-reply"
<p class="c-sub mt-1"><i class="fa fa-warning mr-1"></i>您的评论正在等待审核!</p>
<?php endif; ?>

<?php if (pk_is_checked('comment_show_ua', true) || pkmp_is_checked('comment_show_ip', true)): ?>
<div class="comment-os c-sub">
<?php
if (pk_is_checked('comment_show_ua', true)):
$commentUserAgent = parse_user_agent($comment->comment_agent);
$commentOsIcon = pk_get_comment_ua_os_icon($commentUserAgent['platform']);
$commentBrowserIcon = pk_get_comment_ua_os_icon($commentUserAgent['browser']);
echo "<span title='${commentUserAgent['platform']}'><i class='$commentOsIcon'></i>&nbsp;<span>${commentUserAgent['platform']}&nbsp;</span></span>";
echo "<span title='${commentUserAgent['browser']} ${commentUserAgent['version']}'><i class='$commentBrowserIcon'></i>&nbsp;<span>${commentUserAgent['browser']}</span></span>";
endif;
?>
<?php
if (pk_is_checked('comment_show_ip', true)):
<div class="comment-os c-sub">
<?php
if (pk_is_checked('comment_show_ua', true)):
$commentUserAgent = parse_user_agent($comment->comment_agent);
$commentOsIcon = pk_get_comment_ua_os_icon($commentUserAgent['platform']);
$commentBrowserIcon = pk_get_comment_ua_os_icon($commentUserAgent['browser']);
echo "<span class='mt10' title='${commentUserAgent['platform']}'><i class='$commentOsIcon'></i>&nbsp;<span>${commentUserAgent['platform']}&nbsp;</span></span>";
echo "<span class='mt10' title='${commentUserAgent['browser']} ${commentUserAgent['version']}'><i class='$commentBrowserIcon'></i>&nbsp;<span>${commentUserAgent['browser']}</span></span>";
endif;
?>
<?php
if (pk_is_checked('comment_show_ip', true)) {
if (!pk_is_checked('comment_dont_show_owner_ip') || (pk_is_checked('comment_dont_show_owner_ip') && $comment->user_id != 1)) {
$ip = pk_get_ip_region_str($comment->comment_author_IP);
echo "<span title='IP'><i class='fa-solid fa-location-dot'></i>&nbsp;$ip</span>";
endif;
?>
</div>
<?php endif; ?>
echo "<span class='mt10' title='IP'><i class='fa-solid fa-location-dot'></i>&nbsp;$ip</span>";
}
}
?>
</div>
</div>
<div class="comment-box-reply d-none" id="comment-box-<?php comment_ID() ?>"></div>
</div>
Expand Down
70 changes: 42 additions & 28 deletions inc/setting/options/OptionBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,34 +76,48 @@ function get_fields(): array
'sdt' => 'false',
],
[
'id' => 'comment_level',
'label' => '显示评论等级',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_mail_notify',
'label' => '评论回复邮件通知',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_has_at',
'label' => '评论内容显示@',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_show_ua',
'label' => '评论显示系统及浏览器信息',
'type' => 'switch',
'sdt' => true,
],
[
'id' => 'comment_show_ip',
'label' => '评论显示IP归属地及运营商',
'type' => 'switch',
'sdt' => true,
'id' => '-',
'type' => 'panel',
'open' => true,
'label' => '评论相关',
'children' => [
[
'id' => 'comment_level',
'label' => '显示评论等级',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_mail_notify',
'label' => '评论回复邮件通知',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_has_at',
'label' => '评论内容显示@',
'type' => 'switch',
'sdt' => 'false',
],
[
'id' => 'comment_show_ua',
'label' => '评论显示系统及浏览器信息',
'type' => 'switch',
'sdt' => true,
],
[
'id' => 'comment_show_ip',
'label' => '评论显示IP归属地及运营商',
'type' => 'switch',
'sdt' => true,
],
[
'id' => 'comment_dont_show_owner_ip',
'label' => '不显示站长IP归属地及运营商',
'type' => 'switch',
'sdt' => false,
],
]
],
[
'id' => 'post_poster_open',
Expand Down

0 comments on commit e2d5f83

Please sign in to comment.