This commit is contained in:
浪子 2025-07-07 13:47:59 +08:00
parent c7efd5abd6
commit 58b2e80883
4 changed files with 13 additions and 34 deletions

View File

@ -184,7 +184,6 @@
$deviceInfo = getBrowsersInfo($comments->agent);
$icons = getDeviceIcon($deviceInfo);
?>
<?php if (!empty($comments->options->showdevice) && $comments->options->showdevice == '1'): ?>
<!-- 系统信息 -->
<span class="mt10" title="<?php echo $deviceInfo['system'] . ' ' . $deviceInfo['systemVersion']; ?>">
<?php echo $icons['system']; ?>&nbsp;
@ -194,8 +193,6 @@
: '未知系统';
?>
</span>
<?php endif; ?>
<?php if (!empty($comments->options->showbrowsers) && $comments->options->showbrowsers == '1'): ?>
<!-- 浏览器信息 -->
<span class="mt10" title="<?php echo $deviceInfo['browser'] . ' ' . $deviceInfo['version']; ?>">
<?php echo $icons['browser']; ?>&nbsp;
@ -205,14 +202,11 @@
: '未知浏览器';
?>
</span>
<?php endif; ?>
<?php if (!empty($comments->options->showipregion) && $comments->options->showipregion == '1'): ?>
<!-- IP 地理位置 -->
<?php if($comments->ip): ?>
<span class="mt10" title="IP">
<i class="fa-solid fa-location-dot"></i>&nbsp;<?php echo get_ip_region($comments->ip); ?>
</span>
<?php endif; ?>
<?php endif; ?>
</div>
</div>

View File

@ -39,18 +39,6 @@ function themeConfig($form)
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('社交分享显示'), _t('选择"是"在文章页面显示社交分享。需要搭配插件使用,默认关闭'));
$form->addInput($social);
$showipregion = new Typecho_Widget_Helper_Form_Element_Radio('showipregion',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示IP归属地'), _t('选择"是"在评论显示IP归属地。默认开启'));
$form->addInput($showipregion);
$showbrowsers = new Typecho_Widget_Helper_Form_Element_Radio('showbrowsers',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示浏览器信息'), _t('选择"是"在评论显示浏览器信息。默认开启'));
$form->addInput($showbrowsers);
$showdevice = new Typecho_Widget_Helper_Form_Element_Radio('showdevice',
array('0'=> _t('否'), '1'=> _t('是')),
'0', _t('是否显示设备信息'), _t('选择"是"在评论显示设备信息。默认开启'));
$form->addInput($showdevice);
$gonggao = new Typecho_Widget_Helper_Form_Element_Textarea('gonggao', NULL, NULL, _t('站点公告'), _t('支持HTML'));
$form->addInput($gonggao);
$adlisttop = new Typecho_Widget_Helper_Form_Element_Textarea('adlisttop', NULL, NULL, _t('文章列表上方广告位'), _t('支持HTML'));

View File

@ -4,7 +4,7 @@
*
* @package Typecho Pouck Theme
* @author 老孙博客
* @version 1.1.3
* @version 1.1.4
* @link http://www.imsun.org
*/

View File

@ -138,21 +138,18 @@ if ($totalViews === null) $totalViews = 0;
<div class="mt20">
<?php foreach ($hotPosts as $post): ?>
<?php
// Typecho 1.3.0 兼容处理
$widget = $this->widget('Widget_Archive@post_' . $post['cid'], 'type=post');
// 更可靠的获取文章链接方式
$widget = Typecho_Widget::widget('Widget_Contents_Post_Recent');
$permalink = '';
try {
$widget->setArchiveProperty('cid', $post['cid']);
$widget->setArchiveProperty('title', $post['title']);
$widget->setArchiveProperty('slug', $post['slug']);
$widget->setArchiveProperty('created', $post['created']);
$widget->setArchiveProperty('authorId', $post['authorId']);
$widget->setArchiveProperty('type', $post['type']);
$widget->setArchiveProperty('status', $post['status']);
$widget->setArchiveProperty('commentsNum', $post['commentsNum']);
// 生成正确链接
$permalink = $widget->archiveUrl;
// 方法1使用Typecho的Router类
$permalink = Typecho_Router::url('post', $post, $this->options->index);
// 方法2或者使用辅助函数如果方法1不行
if (empty($permalink)) {
$widget->push($post);
$permalink = $widget->permalink;
$widget->pop();
}
if (empty($post['title']) || empty($permalink)) {
continue;
}
@ -177,7 +174,7 @@ if ($totalViews === null) $totalViews = 0;
<?php endif; ?>
<!-- 最近评论 -->
<?php if (!empty($this->options->sidebarBlock) && in_array('ShowRecentComments', $this->options->sidebarBlock)): ?>
<?php
<?php
// 设置参数来排除管理员评论
$comments = \Widget\Comments\Recent::alloc(array(
'ignoreAuthor' => true // 这里添加参数来排除作者/管理员评论