options->sidebarBlock) && in_array('ShowSearch', $this->options->sidebarBlock)): ?>
文章搜索
getPrefix(); // 1. 获取uid=1的用户信息 $user = $db->fetchRow($db->select()->from('table.users')->where('uid = ?', 1)); $email = $user['mail']; $nickname = $user['screenName']; // 获取用户设置的 Gravatar 镜像 $cnavatar = Helper::options()->cnavatar ? Helper::options()->cnavatar : 'https://cravatar.cn/avatar/'; $hash = md5($email); $avatar = rtrim($cnavatar, '/') . '/' . $hash . '?s=80&d=identicon'; // 2. 获取用户总数 $userCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.users'))->num; // 3. 获取文章总数(只统计 type='post' 且 status='publish') $postCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.contents')->where('type = ?', 'post')->where('status = ?', 'publish'))->num; // 4. 获取评论总数 $commentCount = $db->fetchObject($db->select(array('COUNT(*)' => 'num'))->from('table.comments'))->num; // 5. 获取文章浏览总量(累加所有文章的 views 字段) $totalViews = $db->fetchObject( $db->select(array('SUM(views)' => 'viewsum'))->from('table.contents')->where('type = ?', 'post') )->viewsum; if ($totalViews === null) $totalViews = 0; ?> options->sidebarBlock) && in_array('ShowAdmin', $this->options->sidebarBlock)): ?>
' class='lazy avatar' data-src='' >
options->description(); ?>
用户数
文章数
评论数
阅读量
options->sidebarBlock) && in_array('ShowRecentPosts', $this->options->sidebarBlock)): ?>
最新文章
parse('

{title}

'); ?>
options->sidebarBlock) && in_array('ShowHotPosts', $this->options->sidebarBlock)): ?> select( 'table.contents.cid', 'table.contents.title', 'table.contents.slug', 'table.contents.created', 'table.contents.authorId', 'table.contents.type', 'table.contents.status', 'table.contents.commentsNum' ) ->from('table.contents') ->where('table.contents.type = ?', 'post') ->where('table.contents.status = ?', 'publish') ->where('table.contents.password IS NULL') ->order('table.contents.commentsNum', Typecho_Db::SORT_DESC) ->limit(5); try { $hotPosts = $db->fetchAll($select); } catch (Exception $e) { $hotPosts = []; } ?>
热门文章
filter($post); if (empty($post['title']) || empty($post['slug'])) { continue; // 跳过无效数据 } $post['title'] = htmlspecialchars($post['title']); $post['slug'] = htmlspecialchars($post['slug']); if (empty($post['permalink'])) { $post['permalink'] = Typecho_Common::url($post['slug'], $this->options->index); } } catch (Exception $e) { continue; } ?>

options->sidebarBlock) && in_array('ShowRecentComments', $this->options->sidebarBlock)): ?> true // 这里添加参数来排除作者/管理员评论 )); ?>
最新评论
to($comments); ?> next()): ?>
gravatar('40', ''); ?> author(false); ?> excerpt(35, '...'); ?>
options->sidebarBlock) && in_array('ShowTags', $this->options->sidebarBlock)): ?> have()): // 定义可用的颜色类数组 $colors = ['bg-primary', 'bg-secondary', 'bg-success', 'bg-danger', 'bg-warning', 'bg-info', 'bg-transparent', 'bg-gradient']; ?>
标签云
next()): ?> name(); ?>