友链页面初版

This commit is contained in:
Skywt2003 2021-08-13 16:20:03 +08:00
parent bd95789569
commit 8af5a5bb3b
3 changed files with 48 additions and 2 deletions

View File

@ -67,4 +67,8 @@ code, pre {
.flex-footer {
display: block;
}
.friend {
height: 80px;
}

35
friends.php Normal file
View File

@ -0,0 +1,35 @@
<?php
/**
* Sky 友情链接
*
* @package custom
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('header.php');
if ($this->options->friendAvatar == 'icon') $avatarUrl = 'https://www.google.cn/s2/favicons?domain={url}';
else $avatarUrl = '{image}';
?>
<div class="col mt-5" id="main" role="main">
<article>
<h1 class="font-weight-bold post-title">友情链接</h1>
<div class="row">
<?php
Links_Plugin::output($pattern='
<div class="col-12 col-sm-6 col-md-4 pt-2 pb-2">
<a class="friend btn btn-secondary btn-lg text-left w-100" role="button" href="{url}" target="_blank">
<img class="avatar position-absolute" src="'.$avatarUrl.'" alt="{name}"">
<div class="position-relative text-capitalize text-truncate ml-6">
<span class="font-weight-900">{name}</span> <br>
<span class="text-gray">{description}</span>
</div>
</a>
</div>
', $links_num=0, $sort='friends'); ?>
</div>
</article>
</div>
<?php $this->need('footer.php');
?>

View File

@ -4,8 +4,8 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
define('__TYPECHO_GRAVATAR_PREFIX__', 'https://cdn.v2ex.com/gravatar/');
function themeConfig($form) {
echo $siteUrl;
echo '<h2>Sky 主题设置</h2>';
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点 LOGO 地址'), _t('在这里填入一个图片 URL 地址, 以在网站标题前加上一个 LOGO'));
$form->addInput($logoUrl);
@ -27,6 +27,13 @@ function themeConfig($form) {
),
'disable', _t('是否显示旧文提示'), _t('启用则会在一年前发布的文章页面显示“这是一篇旧文”'));
$form->addInput($oldPosts);
$friendAvatar = new Typecho_Widget_Helper_Form_Element_Radio('friendAvatar',
array('icon' => _t('网站 icon'),
'img' => _t('自定义图片'),
),
'icon', _t('友链页面的头像来源'), _t('前者自动使用对方网站 icon 作为头像,后者需要在 links 插件中自行设置图片作为头像'));
$form->addInput($friendAvatar);
}
function themeFields($layout) {