addInput($accentColor); // 社交链接设置 $socialTwitter = new Typecho\Widget\Helper\Form\Element\Text( 'socialTwitter', null, '', _t('Twitter 链接'), _t('您的 Twitter 个人资料链接') ); $form->addInput($socialTwitter); $socialFacebook = new Typecho\Widget\Helper\Form\Element\Text( 'socialFacebook', null, '', _t('Facebook 链接'), _t('您的 Facebook 个人资料链接') ); $form->addInput($socialFacebook); $socialGitHub = new Typecho\Widget\Helper\Form\Element\Text( 'socialGitHub', null, '', _t('Github 链接'), _t('您的 Github 个人资料链接') ); $form->addInput($socialGitHub); } /** * 输出自定义CSS */ function outputCustomCSS() { $options = Helper::options(); $accentColor = $options->accentColor ? $options->accentColor : '#121212'; echo ''; } /** * 添加自定义CSS到头部 */ function themeInit($archive) { // 输出自定义CSS if ($archive->is('index') || $archive->is('archive') || $archive->is('single')) { outputCustomCSS(); } } /** * 获取文章类 */ function getPostClass($post) { $classes = array(); // 检查是否有缩略图 if ($post->attachment && $post->attachment->isImage) { $classes[] = 'has-thumbnail'; } else { $classes[] = 'missing-thumbnail'; } // 检查是否有标题 if (empty($post->title)) { $classes[] = 'no-title'; } return implode(' ', $classes); } /** * 获取 body 类 */ function getBodyClass($archive) { $options = Helper::options(); $classes = array(); // 白色背景 if ($options->accentColor == '#ffffff') { $classes[] = 'white-bg'; } return implode(' ', $classes); } /** * 获取归档类型 */ function getArchiveType($archive) { if ($archive->is('category')) { return _t('分类'); } elseif ($archive->is('tag')) { return _t('标签'); } elseif ($archive->is('author')) { return _t('作者'); } elseif ($archive->is('date') && $archive->is('year')) { return _t('年'); } elseif ($archive->is('date') && $archive->is('month')) { return _t('月'); } elseif ($archive->is('date') && $archive->is('day')) { return _t('日'); } elseif ($archive->is('search')) { return _t('搜索结果'); } elseif ($archive->is('index') && $options->homeTitle) { return _t('简介'); } else { return _t('归档'); } } /** * 获取归档标题 */ function getArchiveTitle($archive) { $options = Helper::options(); if ($archive->is('category')) { return $archive->category; } elseif ($archive->is('tag')) { return '#' . $archive->tag; } elseif ($archive->is('author')) { return $archive->author->screenName; } elseif ($archive->is('date') && $archive->is('year')) { return $archive->year; } elseif ($archive->is('date') && $archive->is('month')) { return $archive->year . ' ' . $archive->month; } elseif ($archive->is('date') && $archive->is('day')) { return $archive->year . '-' . $archive->month . '-' . $archive->day; } elseif ($archive->is('search')) { return '"' . $archive->getKeywords() . '"'; } elseif ($archive->is('index') && $options->homeTitle) { return $options->homeTitle; } else { return _t('归档'); } } /** * 获取归档描述 */ function getArchiveDescription($archive) { if ($archive->is('search')) { $count = $archive->have(); if ($count) { return sprintf(_t('我们找到 %s 符合您的搜索请求。'), $count . ' ' . _t('个结果')); } else { return sprintf(_t('我们没有找到关于 "%s" 的搜索结果。'), $archive->getKeywords()); } } return $archive->description; } /** * 自定义评论列表 */ function threadedComments($comments, $options) { $commentClass = ''; $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; if ($comments->url) { $author = '' . $comments->author . ''; } else { $author = $comments->author; } // 评论作者为文章作者 $byPostAuthor = ''; if ($comments->authorId == $comments->ownerId) { $byPostAuthor = ' (' . _t('本文作者') . ')'; } ?>
date(); ?> reply(_t('回复')); ?>
content(); ?>
status): ?>

children) { ?>
threadedComments($options); ?>
header = 'addJsFeatures'; Typecho\Plugin::factory('Widget_Archive')->header = 'outputCustomCSS'; /** * 自定义评论回调函数 */ function themeCommentList($comment, $options) { $commentClass = ''; if ($comment->authorId) { if ($comment->authorId == $comment->ownerId) { $commentClass .= ' comment-by-author'; } else { $commentClass .= ' comment-by-user'; } } $commentLevelClass = $comment->levels > 0 ? ' comment-child' : ' comment-parent'; $depth = $comment->levels + 1; if ($depth > 4) { $depth = 4; } $commentLevelClass .= ' comment-level-' . $depth; ?>
gravatar('40', ''); ?> author(); ?>
content(); ?>
reply(_t('回复')); ?>
children) { ?>
threadedComments($options); ?>