summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author阔落 <45323514+BigCoke233@users.noreply.github.com>2019-03-24 18:02:47 +0800
committerGitHub <noreply@github.com>2019-03-24 18:02:47 +0800
commit4353a0f3f12ca253285e3edf9f2206e526f112ce (patch)
treeefd983701eeba6622028563048927aa848d239e8
parent107e63005d013dd3caea541c921dcf8be415014e (diff)
Add files via upload
-rw-r--r--includes/comments.php44
-rw-r--r--includes/footer.php134
-rw-r--r--includes/head.php126
-rw-r--r--includes/header.php35
-rw-r--r--includes/owo.php78
-rw-r--r--includes/post-item.php58
-rw-r--r--includes/sidebar.php98
-rw-r--r--includes/toolbar.php10
-rw-r--r--plugins/Links/Action.php119
-rw-r--r--plugins/Links/Mysql.sql11
-rw-r--r--plugins/Links/Plugin.php343
-rw-r--r--plugins/Links/SQLite.sql10
-rw-r--r--plugins/Links/Update_Mysql.sql4
-rw-r--r--plugins/Links/Update_SQLite.sql25
-rw-r--r--plugins/Links/manage-links.php144
-rw-r--r--plugins/Links/nopic.jpgbin0 -> 1258 bytes
-rw-r--r--screenshot.pngbin0 -> 64136 bytes
17 files changed, 1239 insertions, 0 deletions
diff --git a/includes/comments.php b/includes/comments.php
new file mode 100644
index 0000000..3facb2a
--- /dev/null
+++ b/includes/comments.php
@@ -0,0 +1,44 @@
+<br />
+<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
+<div id="comments" class="responsesWrapper">
+
+ <?php if($this->allow('comment')): ?>
+ <div id="<?php $this->respondId(); ?>" class="respond item">
+ <br />
+ <form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" class="comment-form row" role="form">
+ <p class="comment-form-comment col-md-12">
+ <textarea rows="8" cols="50" name="text" id="owo-textarea" class="textarea" required ><?php $this->remember('text'); ?></textarea>
+ </p>
+
+ <?php if($this->user->hasLogin()): ?>
+ <p style="margin-left:16px"><?php _e('登录身份: '); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a></p>
+ <?php else: ?>
+ <p class="comment-form-author col-md-4">
+ <input placeholder="留下你的大名" type="text" name="author" id="author" class="text" value="<?php $this->remember('author'); ?>" required />
+ </p>
+ <p class="comment-form-email col-md-4">
+ <input placeholder="输入正确的邮箱地址,会为你保密" type="email" name="mail" id="mail" class="text" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
+ </p>
+ <p class="comment-form-url col-md-4">
+ <input placeholder="http(s)://" type="url" name="url" id="url" class="text" placeholder="<?php _e('http://'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
+ </p>
+ <?php endif; ?>
+ <?php $this->need('includes/owo.php'); ?>
+ <p class="form-submit col-md-12">
+ <button type="submit" class="submit btn btn-info " style="float:right;transition:all 0.5s;"><?php _e('提交评论'); ?></button>
+ </p>
+ </form>
+ </div>
+ <?php else: ?>
+ <h3><?php _e('评论已关闭'); ?></h3>
+ <?php endif; ?>
+
+ <?php $this->comments()->to($comments); ?>
+ <?php if ($comments->have()): ?>
+ <div class="comment-list-wrap">
+ <?php $comments->listComments(); ?>
+ </div>
+ <?php $comments->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
+
+ <?php endif; ?>
+</div> \ No newline at end of file
diff --git a/includes/footer.php b/includes/footer.php
new file mode 100644
index 0000000..34e8cb4
--- /dev/null
+++ b/includes/footer.php
@@ -0,0 +1,134 @@
+ <!-- 页脚信息 -->
+ <footer class="footer-info">
+ <div class="container">
+ <div class="row">
+ <div class="col-md-5">
+ <h3>最新访客</h3>
+ <div class="newest-comment">
+ <?php $this->widget('Widget_Comments_Recent','ignoreAuthor=true')->to($comments); ?>
+ <?php while($comments->next()): ?>
+ <a href="<?php $comments->permalink(); ?>"><?php $comments->gravatar(200); ?></a>
+ <?php endwhile; ?>
+ </div>
+ </div>
+
+ <div class="col-md-7 site-info">
+ <h3>站点信息</h3>
+ <p>小站已萌萌哒运行:<span id="htmer_time"></span>,感谢陪伴</p>
+ <p id="hitokoto">正在玩命获取一言毒鸡汤( ̄(∞) ̄)</p>
+ <p>
+ Powered by <a href="http://typecho.org">Typecho</a> | Theme <a href="https://github.com/BigCoke233/mark">Mark</a> by BigCoke with <i class="fa fa-heart" style="color:red"></i>
+ <br />Copyright &copy; <?php echo date('Y') ?> <A href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
+ </p>
+ </div>
+ </div>
+ </div>
+ </footer>
+
+
+
+ <!-- js -->
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/bootstrap.min.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/nav.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/jquery.fancybox.min.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/owo.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/prism.js'); ?>" data-no-instant></script>
+
+ <script src="https://v1.hitokoto.cn/?encode=js&select=%23hitokoto" defer></script>
+
+ <!-- pjax 动画 -->
+<div class="spinner unvisible">
+ <div class="rect1"></div>
+ <div class="rect2"></div>
+ <div class="rect3"></div>
+ <div class="rect4"></div>
+ <div class="rect5"></div>
+</div>
+<div class="viewport-cover unvisible-cover"></div>
+
+ <?php if($this->options->pjax && $this->options->pjax!=0) :?>
+ <!-- pjax -->
+ <script>
+ //pjax load
+ $(document).pjax(
+ 'body a',
+ '#pjax-container',
+ {
+ timeout:8000,
+ container: '#pjax-container',
+ fragment: '#pjax-container',
+ }
+ );
+ $(document).on('pjax:send',
+ function() {
+ $('#pjax-container').addClass("pjax-loading");
+ $('.spinner').removeClass("unvisible");
+ $('.viewport-cover').removeClass("unvisible-cover");
+ })
+ $(document).on('pjax:complete',
+ function() {
+ $('#pjax-container').removeClass("pjax-loading");
+ $('.spinner').addClass("unvisible");
+ $('.viewport-cover').addClass("unvisible-cover");
+ if (typeof Prism !== 'undefined') {
+ Prism.highlightAll(true,null);}
+ <?php $this->options->pjax_reload(); ?>
+ });
+ </script>
+
+ <?php endif; ?>
+ <script>
+ //prism highlight-code load
+$(document).ready(function(){
+ var doc_pre = $(".post-content pre");
+ doc_pre.each(function(){
+ var class_val = $(this).attr('class');
+ var class_arr = new Array();
+ class_arr = class_val.split(';');
+ class_arr = class_arr['0'].split(':');
+ var lan_class = 'language-'+class_arr['1'];
+ var pre_content = '<code class="'+lan_class+'">'+$(this).html()+'</code>';
+ $(this).html(pre_content);
+ $(this).attr("class",'line-numbers '+lan_class);
+ });
+});
+ //site creat time
+ function secondToDate(second) {
+ if (!second) {
+ return 0;
+ }
+ var time = new Array(0, 0, 0, 0, 0);
+ if (second >= 365 * 24 * 3600) {
+ time[0] = parseInt(second / (365 * 24 * 3600));
+ second %= 365 * 24 * 3600;
+ }
+ if (second >= 24 * 3600) {
+ time[1] = parseInt(second / (24 * 3600));
+ second %= 24 * 3600;
+ }
+ if (second >= 3600) {
+ time[2] = parseInt(second / 3600);
+ second %= 3600;
+ }
+ if (second >= 60) {
+ time[3] = parseInt(second / 60);
+ second %= 60;
+ }
+ if (second > 0) {
+ time[4] = second;
+ }
+ return time;
+ }
+ function setTime() {
+        var create_time = Math.round(new Date(Date.UTC(2018, 11, 01, 0, 0, 6)).getTime() / 1000);
+ var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
+ currentTime = secondToDate((timestamp - create_time));
+ currentTimeHtml = currentTime[0] + '年' + currentTime[1] + '天'
+ + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
+ + '秒';
+ document.getElementById("htmer_time").innerHTML = currentTimeHtml;
+ } setInterval(setTime, 1000);
+ </script>
+
+ </body>
+</html> \ No newline at end of file
diff --git a/includes/head.php b/includes/head.php
new file mode 100644
index 0000000..c0e4b9e
--- /dev/null
+++ b/includes/head.php
@@ -0,0 +1,126 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+ <!-- 头部信息 -->
+ <head>
+ <!-- 页面信息 -->
+ <meta http-equiv="content-type" content="text/html; charset=<?php $this->options->charset(); ?>" />
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+ <?php if ($this->is('index')): ?>
+ <meta name="description" content="<?php $this->options->description(); ?>" />
+ <meta name="keywords" content="<?php $this->options->keywords(); ?>" />
+ <meta name="author" content="<?php $this->options->author(); ?>" />
+ <?php endif; ?>
+ <?php if($this->is('post')||$this->is('page')): ?>
+ <meta name="description" content="<?php $this->excerpt(300); ?>" />
+ <meta name="keywords" content="<?php $this->options->keywords(); ?>,<?php $this->tags(', ', false, 'none'); ?>" />
+ <meta name="author" content="<?php $this->options->author(); ?>" />
+ <meta property="og:image" content="<?php $this->fields->banner(); ?>" />
+ <meta property="og:release_date" content="<?php $this->date('Y-m-j'); ?>" />
+ <meta property="og:title" content="<?php $this->title(); ?>" />
+ <meta property="og:description" content="<?php $this->description(); ?>" />
+ <meta property="og:author" content="<?php $this->author(); ?>" />
+ <?php endif; ?>
+
+ <!-- 定义title -->
+ <title>
+ <?php if($this->_currentPage>1) echo '第 '.$this->_currentPage.' 页 | '; ?>
+ <?php $this->archiveTitle(array(
+ 'category'=>_t('分类 %s 下的文章'),
+ 'search'=>_t('包含关键字 %s 的文章'),
+ 'tag' =>_t('标签 %s 下的文章'),
+ 'author'=>_t('%s 的主页')
+ ), '', ' | '); ?>
+ <?php $this->options->title(); ?>
+ <?php if($this->is('index')||$this->is('front')): ?>
+ <?php endif; ?>
+ </title>
+
+ <!-- css -->
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/bootstrap/bootstrap.min.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/mark.min.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/jquery.fancybox.min.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/font-awesome.min.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/button.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/prism.css'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/owo.min.css'); ?>" />
+
+ <!-- 部分js -->
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/jquery.min.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/pjax/jquery.pjax.js'); ?>"></script>
+
+ <!-- 部分css -->
+ <style>
+ @media screen and (max-width: 600px) {
+ .mobile-none {
+ display:none;
+ }
+ .mobile-block{
+ display:block!important;
+ }
+ #nav{
+ padding:0!important;
+ }
+ .nav-content,.nav-content ul>li{
+ float:left!important
+ }
+ .nav-content{
+ font-size:12px;
+ margin-top:-5px;
+ margin-bottom:-8px;
+ text-align:Center;
+ }
+ .nav-content li{
+ display:inline;
+ }
+ .nav-content i{
+ display:none;
+ }
+ }
+ <?php if($this->options->bg_url && $this->options->bg_url!='') :?>
+ body{
+ background-image:url(<?php $this->options->bg_url() ?>);
+ background-size:cover;
+ background-repeat:no-repeat;
+ background-attachment:fixed;
+ }
+ .item,#nav,.list-group,.list-group li,.pagenav li,.page-navigator li,.comment-body{
+ background:rgba(255,255,255,0.9)!important;
+ }
+ .footer-info{
+ opacity:0.8;
+ }
+ .item{
+ box-shadow:0 0 8px #808080;
+ -webkit-box-shadow:0 0 8px #808080;
+ }
+ <?php endif; ?>
+ </style>
+
+ <!-- 其他头部信息 -->
+ <?php $this->header(); ?>
+
+ <!--
+ ▄ ▄
+ ▌▒█ ▄▀▒▌
+ ▌▒▒▀▄ ▀▒▒▒▐
+ ▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
+ ▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
+ ▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█▒▒▒▒▒▐
+ ▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌
+ ▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
+ ▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌
+ ▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
+ ▌▀▐▄█▄█▌▄▒▀▒▒▒▒▒▒░░░░░░▒▒▒▐
+ ▐▒▀▐▀▐▀▒▒▄▄▒▄▒▒▒ typecho ▒▌
+ ▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒░░░░░░▒▒▒▐
+ ▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
+ ▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐
+ ▀ MARK~ ▒▒▒▒▒▒▒▒▒▒▒▄▒▒▒▒▌
+ ▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
+ ▐▀▒▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
+ ▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀▀
+ --再看,再看就吃掉你!
+ -->
+ </head>
+ <body> \ No newline at end of file
diff --git a/includes/header.php b/includes/header.php
new file mode 100644
index 0000000..f9a06d0
--- /dev/null
+++ b/includes/header.php
@@ -0,0 +1,35 @@
+<header>
+ <div id="top"></div>
+ <!-- 导航栏 -->
+ <nav class="navbar navbar-default navbar-fixed-top" id="nav">
+ <Div class="container-fluid">
+ <div class="nav-logo">
+ <span class="nav-logo-icon">
+ <i class="<?php $this->options->IndexIcon(); ?> mobile-none"></i>
+ </span>
+ <span class="nav-logo-indexname mobile-none">
+ <?php $this->options->IndexName(); ?>
+ </span>
+ </div>
+
+ <div class="nav-content">
+ <ul class="nav navbar-nav">
+ <?php if($this->options->custom_nav && $this->options->custom_nav!='') :?>
+ <?php $this->options->custom_nav() ?>
+ <?php else: ?>
+ <?php $this->widget('Widget_Contents_Page_List')
+ ->parse('<li><a href="{permalink}"><i class="fa fa-paper-plane" aria-hidden="true"></i> {title}</a></li>'); ?>
+ <li><a href="<?php $this->options->SiteUrl(); ?>"><i class="fa fa-home" aria-hidden="true"></i> 首页</a></li>
+ <?php endif; ?>
+ </ul>
+ </div>
+ </div>
+ </nav>
+
+ <br />
+ <br />
+ <br />
+ <br />
+ <br />
+ <!-- 能偷懒不写样式为什么不用br? -->
+</header> \ No newline at end of file
diff --git a/includes/owo.php b/includes/owo.php
new file mode 100644
index 0000000..c03ecc5
--- /dev/null
+++ b/includes/owo.php
@@ -0,0 +1,78 @@
+ <!-- simple owo -->
+ <div class="OwO-logo" onclick="$('#qaq').toggleClass('OwO-open');">
+ <span>(owo)</span>
+ </div>
+ <div id="OwO-container">
+ <div class="OwO" id="qaq">
+ <div class="OwO-body" id="OwO-body">
+ <ul id="OwO-pp" class="OwO-items OwO-items-emoticon OwO-items-show" style="max-height: 197px;">
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>chaiquan.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>chaiquan.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanbugaoxin.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanbugaoxin.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanzaijian.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanzaijian.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanku.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>chaiquanku.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>hehe.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>hehe.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>haha.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>haha.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>tushe.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>tushe.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>taikaixin.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>taikaixin.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xiaoyan.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xiaoyan.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>huaxin.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>huaxin.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xiaoguai.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xiaoguai.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>guai.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>guai.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>wuzuixiao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>wuzuixiao.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>huaji.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>huaji.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>nidongde.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>nidongde.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>bugaoxin.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>bugaoxin.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>nu.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>nu.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>han.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>han.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>heixian.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>heixian.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>lei.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>lei.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>zhenbang.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>zhenbang.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>pen.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>pen.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>jingku.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>jingku.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>yinxian.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>yinxian.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>bishi.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>bishi.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>ku.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>ku.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>a.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>a.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>kuanghan.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>kuanghan.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>what.png');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>what.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>yiwen.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>yiwen.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>suanshuang.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>suanshuang.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>yamiedie.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>yamiedie.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>weiqu.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>weiqu.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>jingya.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>jingya.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>shuijiao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>shuijiao.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xiaoniao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xiaoniao.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>wabi.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>wabi.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>tu.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>tu.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xili.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xili.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xiaohonglian.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xiaohonglian.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>landeli.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>landeli.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>mianqiang.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>mianqiang.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>aixin.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>aixin.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xinsui.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xinsui.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>meigui.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>meigui.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>liwu.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>liwu.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>caihong.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>caihong.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>taiyang.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>taiyang.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xinxinyueliang.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xinxinyueliang.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>qianbi.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>qianbi.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>chabei.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>chabei.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>dangao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>dangao.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>damuzhi.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>damuzhi.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>shengli.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>shengli.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>haha.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>haha.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>OK.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>OK.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>shafa.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>shafa.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>shouzhi.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>shouzhi.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>xiangjiao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>xiangjiao.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>bianbian.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>bianbian.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>yaowan.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>yaowan.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>hlj.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>hlj.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>lazhu.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>lazhu.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>yingyue.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>yingyue.png" /></li>
+ <li class="OwO-item" onclick="Smilies.grin('![owo](<?php $this->options->themeUrl('assets/bq/'); ?>dengpao.png)');"><img src="<?php $this->options->themeUrl('assets/bq/'); ?>dengpao.png" /></li>
+
+ </ul>
+ </div>
+ </div>
+ </div> \ No newline at end of file
diff --git a/includes/post-item.php b/includes/post-item.php
new file mode 100644
index 0000000..60ad412
--- /dev/null
+++ b/includes/post-item.php
@@ -0,0 +1,58 @@
+<?php if($this->is('post') || $this->fields->type=='1' ): ?>
+<!-- 说说 -->
+<?php if ($this->is('index')): ?>
+ <div class="post-item item">
+
+ <div class="row">
+ <div class="saying-info">
+ <div class="col-md-1 col-xs-2 saying-avatar">
+ <?php $this->author->gravatar(50); ?>
+ </div>
+ <div class="col-md-11 col-xs-10 saying-title-info">
+ <h4 class="saying-title"><a href="<?php $this->permalink() ?>" class="post-link"><?php $this->sticky(); $this->title() ?></a></h4>
+ <span><br /><i class="glyphicon glyphicon-send"></i> <?php $this->author() ?> 发布了一条说说:</span>
+ </div>
+ </div>
+ </div>
+ <hr />
+ <div class="post-content saying-content">
+ <?php
+ $content = preg_replace('/<img(.*?)src="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}"><img${1}src="${2}"${3}></a>',$this->content);
+ echo $content
+ ?>
+ </div>
+ <a href="<?php $this->permalink() ?>" class="post-link">
+ <hr />
+ <div class="post-info"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> &nbsp;| &nbsp;<span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> &nbsp;| &nbsp;<Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
+ <br />
+ </a>
+ </div>
+ <br />
+<?php endif; ?>
+<?php else: ?>
+<!-- 文章 -->
+ <a href="<?php $this->permalink() ?>" class="post-link">
+ <div class="item post-item">
+ <?php if ($this->is('index')): ?>
+ <div class="post-banner">
+ <?php if($this->fields->banner && $this->fields->banner!='') :?>
+ <div class="media-banner" style="background-position:center center;background:url(<?php $this->fields->banner(); ?>);background-repeat:no-repeat;background-size:cover;"></div>
+ <?php endif; ?>
+ </div>
+ <?php endif; ?>
+
+
+ <h2 class="index-post-header"><?php $this->sticky(); $this->title() ?></h4>
+ <p class="excerpt">
+ <?php $this->excerpt(100); ?>
+ </p>
+
+ <hr />
+
+ <div class="post-info"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> &nbsp;| &nbsp;<span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> &nbsp;| &nbsp;<Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
+ <br />
+ </div>
+ </a>
+<br />
+
+<?php endif; ?>
diff --git a/includes/sidebar.php b/includes/sidebar.php
new file mode 100644
index 0000000..5e4f0f2
--- /dev/null
+++ b/includes/sidebar.php
@@ -0,0 +1,98 @@
+<aside class="sidebar">
+ <div class="item name-card">
+ <div class="avatar-bg" style="background:url('<?php $this->options->themeUrl('assets/images/avatar-bg.jpg'); ?>')"></div>
+ <a href="<?php $this->options->SiteUrl(); ?>"><img src="<?php $this->options->avatar(); ?>" class="sidebar-avatar"></a>
+ <h3><?php $this->author(); ?></h3>
+
+ <ul class="sidebar-catchme nav nav-pills nav-justified">
+ <?php if($this->options->github && $this->options->github!='') :?>
+ <li><a href="<?php $this->options->github() ?>"><i class="fa fa-github"></i></a></li>
+ <?php endif; ?>
+
+ <?php if($this->options->QQ_num && $this->options->QQ_num!='') :?>
+ <li><a href="http://wpa.qq.com/msgrd?V=1&Uin=<?php $this->options->QQ_num() ?>&Site=ioshenmue&Menu=yes"><i class="fa fa-qq"></i></a></li>
+ <?php endif; ?>
+
+ <?php if($this->options->QQ_group && $this->options->QQ_group!='') :?>
+ <li><a href="<?php $this->options->QQ_group() ?>"><i class="fa fa-comments-o"></i></a></li>
+ <?php endif; ?>
+
+ <?php $this->options->custom_social() ?>
+ </ul>
+ </div>
+
+ <br />
+
+ <Div class="item">
+ <form method="post" action="">
+ <div class="input-group">
+ <input type="text" name="s" class="form-control" placeholder="搜点什么吧~">
+ <span class="input-group-btn">
+ <button class="btn btn-default sumbit" type="sumbit"><i class="fa fa-search"></i></button>
+ </span>
+ </div>
+ </form>
+ </div>
+
+ <br />
+
+ <div class="item aside">
+ <h4><i class="fa fa-send"></i> 博客信息</h4>
+ <hr />
+ <ul class="sidebar-info list-group">
+ <?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>
+ <li class="list-group-item">
+ <i class="fa fa-folder"></i> 分类数量
+ <span class="badge"><?php $stat->categoriesNum() ?></span>
+ </li>
+ <li class="list-group-item">
+ <i class="fa fa-book" aria-hidden="true"></i> 写作数量
+ <span class="badge"><?php echo $stat->publishedPagesNum + $stat->publishedPostsNum; ?></span>
+ </li>
+ <li class="list-group-item">
+ <i class="fa fa-comments-o" aria-hidden="true"></i> 文章评论
+ <span class="badge"><?php $stat->publishedCommentsNum() ?></span>
+ </li>
+ <li class="list-group-item">
+ <i class="fa fa-cloud-upload" aria-hidden="true"></i> 最后更新
+ <span class="badge"><?php echo date('Y-m-d' , $this->modified); ?></span>
+ </li>
+ </ul>
+ </div>
+
+ <br />
+
+ <div class="item aside">
+ <h4><i class="fa fa-bookmark"></i> 便捷分类</h4>
+ <hr />
+ <ul class="sidebar-category list-group">
+ <?php $this->widget('Widget_Metas_Category_List')
+ ->parse('<li class="list-group-item"><a href="{permalink}">{name}</a><span class="badge">{count}</span></li>'); ?>
+ </ul>
+ </div>
+
+ <br />
+
+ <div class="item aside">
+ <h4><i class="fa fa-heart"></i> 全站友链</h4>
+ <hr />
+ <ul class="sidebar-links list-group">
+ <?php Links_Plugin::output("SHOW_TEXT", 0, "index"); ?>
+ </ul>
+ </div>
+
+ <br />
+
+ <div class="item aside tags-list">
+ <h4><i class="fa fa-tags"></i> 热门标签</h4>
+ <hr />
+ <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?>
+ <?php if($tags->have()): ?>
+ <?php while ($tags->next()): ?>
+ <a href="<?php $tags->permalink(); ?>" rel="tag" title="该标签下有 <?php $tags->count(); ?> 篇文章"><?php $tags->name(); ?></a>
+ <?php endwhile; ?>
+ <?php else: ?>
+ 还没有任何标签哦~
+ <?php endif; ?>
+ </div>
+</aside> \ No newline at end of file
diff --git a/includes/toolbar.php b/includes/toolbar.php
new file mode 100644
index 0000000..1f52a4f
--- /dev/null
+++ b/includes/toolbar.php
@@ -0,0 +1,10 @@
+ <!-- 右侧工具栏 -->
+ <Div class="footer-tools mobile-none">
+ <?php if (!$this->is('index')): ?>
+ <a href="<?php $this->options->SiteUrl(); ?>"><i class="fa fa-home"></i></a>
+ <?php endif; ?>
+ <?php if ($this->is('post') || $this->is('page')): ?>
+ <a href="#comments"><i class="fa fa-comments"></i></a>
+ <?php endif; ?>
+ <a href="#top"><i class="fa fa-arrow-up"></i></a>
+ </div> \ No newline at end of file
diff --git a/plugins/Links/Action.php b/plugins/Links/Action.php
new file mode 100644
index 0000000..34e5ec1
--- /dev/null
+++ b/plugins/Links/Action.php
@@ -0,0 +1,119 @@
+<?php
+class Links_Action extends Typecho_Widget implements Widget_Interface_Do
+{
+ private $db;
+ private $options;
+ private $prefix;
+
+ public function insertLink()
+ {
+ if (Links_Plugin::form('insert')->validate()) {
+ $this->response->goBack();
+ }
+ /** 取出数据 */
+ $link = $this->request->from('name', 'url', 'sort', 'image', 'description', 'user');
+ $link['order'] = $this->db->fetchObject($this->db->select(array('MAX(order)' => 'maxOrder'))->from($this->prefix.'links'))->maxOrder + 1;
+
+ /** 插入数据 */
+ $link['lid'] = $this->db->query($this->db->insert($this->prefix.'links')->rows($link));
+
+ /** 设置高亮 */
+ $this->widget('Widget_Notice')->highlight('link-'.$link['lid']);
+
+ /** 提示信息 */
+ $this->widget('Widget_Notice')->set(_t('链接 <a href="%s">%s</a> 已经被增加',
+ $link['url'], $link['name']), NULL, 'success');
+
+ /** 转向原页 */
+ $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl));
+ }
+
+ public function addHannysBlog()
+ {
+ /** 取出数据 */
+ $link = array(
+ 'name' => "Hanny's Blog",
+ 'url' => "http://www.imhan.com",
+ 'description' => "寒泥 - Typecho插件开发者",
+ );
+ $link['order'] = $this->db->fetchObject($this->db->select(array('MAX(order)' => 'maxOrder'))->from($this->prefix.'links'))->maxOrder + 1;
+
+ /** 插入数据 */
+ $link['lid'] = $this->db->query($this->db->insert($this->prefix.'links')->rows($link));
+
+ /** 设置高亮 */
+ $this->widget('Widget_Notice')->highlight('link-'.$link['lid']);
+
+ /** 提示信息 */
+ $this->widget('Widget_Notice')->set(_t('链接 <a href="%s">%s</a> 已经被增加',
+ $link['url'], $link['name']), NULL, 'success');
+
+ /** 转向原页 */
+ $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl));
+ }
+
+ public function updateLink()
+ {
+ if (Links_Plugin::form('update')->validate()) {
+ $this->response->goBack();
+ }
+
+ /** 取出数据 */
+ $link = $this->request->from('lid', 'name', 'sort', 'image', 'url', 'description', 'user');
+
+ /** 更新数据 */
+ $this->db->query($this->db->update($this->prefix.'links')->rows($link)->where('lid = ?', $link['lid']));
+
+ /** 设置高亮 */
+ $this->widget('Widget_Notice')->highlight('link-'.$link['lid']);
+
+ /** 提示信息 */
+ $this->widget('Widget_Notice')->set(_t('链接 <a href="%s">%s</a> 已经被更新',
+ $link['url'], $link['name']), NULL, 'success');
+
+ /** 转向原页 */
+ $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl));
+ }
+
+ public function deleteLink()
+ {
+ $lids = $this->request->filter('int')->getArray('lid');
+ $deleteCount = 0;
+ if ($lids && is_array($lids)) {
+ foreach ($lids as $lid) {
+ if ($this->db->query($this->db->delete($this->prefix.'links')->where('lid = ?', $lid))) {
+ $deleteCount ++;
+ }
+ }
+ }
+ /** 提示信息 */
+ $this->widget('Widget_Notice')->set($deleteCount > 0 ? _t('链接已经删除') : _t('没有链接被删除'), NULL,
+ $deleteCount > 0 ? 'success' : 'notice');
+
+ /** 转向原页 */
+ $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl));
+ }
+
+ public function sortLink()
+ {
+ $links = $this->request->filter('int')->getArray('lid');
+ if ($links && is_array($links)) {
+ foreach ($links as $sort => $lid) {
+ $this->db->query($this->db->update($this->prefix.'links')->rows(array('order' => $sort + 1))->where('lid = ?', $lid));
+ }
+ }
+ }
+
+ public function action()
+ {
+ $this->db = Typecho_Db::get();
+ $this->prefix = $this->db->getPrefix();
+ $this->options = Typecho_Widget::widget('Widget_Options');
+ $this->on($this->request->is('do=insert'))->insertLink();
+ $this->on($this->request->is('do=addhanny'))->addHannysBlog();
+ $this->on($this->request->is('do=update'))->updateLink();
+ $this->on($this->request->is('do=delete'))->deleteLink();
+ $this->on($this->request->is('do=sort'))->sortLink();
+ $this->response->redirect($this->options->adminUrl);
+ }
+}
diff --git a/plugins/Links/Mysql.sql b/plugins/Links/Mysql.sql
new file mode 100644
index 0000000..f0b4a9d
--- /dev/null
+++ b/plugins/Links/Mysql.sql
@@ -0,0 +1,11 @@
+CREATE TABLE `typecho_links` (
+ `lid` int(10) unsigned NOT NULL auto_increment COMMENT 'links表主键',
+ `name` varchar(200) default NULL COMMENT 'links名称',
+ `url` varchar(200) default NULL COMMENT 'links网址',
+ `sort` varchar(200) default NULL COMMENT 'links分类',
+ `image` varchar(200) default NULL COMMENT 'links图片',
+ `description` varchar(200) default NULL COMMENT 'links描述',
+ `user` varchar(200) default NULL COMMENT '自定义',
+ `order` int(10) unsigned default '0' COMMENT 'links排序',
+ PRIMARY KEY (`lid`)
+) ENGINE=MYISAM DEFAULT CHARSET=%charset%;
diff --git a/plugins/Links/Plugin.php b/plugins/Links/Plugin.php
new file mode 100644
index 0000000..6be9154
--- /dev/null
+++ b/plugins/Links/Plugin.php
@@ -0,0 +1,343 @@
+<?php
+/**
+ * 友情链接插件
+ *
+ * @package Links
+ * @author Hanny
+ * @version 1.1.1
+ * @dependence 14.10.10-*
+ * @link http://www.imhan.com
+ *
+ * 历史版本
+ * version 1.1.1 at 2014-12-14
+ * 修改支持Typecho 1.0
+ * 修正Typecho 1.0下不能删除的BUG
+ *
+ * version 1.1.0 at 2013-12-08
+ * 修改支持Typecho 0.9
+
+ * version 1.0.4 at 2010-06-30
+ * 修正数据表的前缀问题
+ * 在Pattern里加上所有的数据表字段
+
+ * version 1.0.3 at 2010-06-20
+ * 修改图片链接的支持方式。
+ * 增加链接分类功能
+ * 增加自定义字段,以便用户自定义扩展
+ * 增加多种链接输出方式。
+ * 增加较详细的帮助文档
+ * 增加在自定义页面引用标签,方便友情链接页面的引用
+ *
+ * version 1.0.2 at 2010-05-16
+ * 增加SQLite支持
+ *
+ * version 1.0.1 at 2009-12-27
+ * 增加显示链接描述
+ * 增加首页链接数量限制功能
+ * 增加图片链接功能
+
+ * version 1.0.0 at 2009-12-12
+ * 实现友情链接的基本功能
+ * 包括: 添加 删除 修改 排序
+ */
+class Links_Plugin implements Typecho_Plugin_Interface
+{
+ /**
+ * 激活插件方法,如果激活失败,直接抛出异常
+ *
+ * @access public
+ * @return void
+ * @throws Typecho_Plugin_Exception
+ */
+ public static function activate()
+ {
+ $info = Links_Plugin::linksInstall();
+ Helper::addPanel(3, 'Links/manage-links.php', '友情链接', '管理友情链接', 'administrator');
+ Helper::addAction('links-edit', 'Links_Action');
+ Typecho_Plugin::factory('Widget_Abstract_Contents')->contentEx = array('Links_Plugin', 'parse');
+ Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Links_Plugin', 'parse');
+ Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Links_Plugin', 'parse');
+ return _t($info);
+ }
+
+ /**
+ * 禁用插件方法,如果禁用失败,直接抛出异常
+ *
+ * @static
+ * @access public
+ * @return void
+ * @throws Typecho_Plugin_Exception
+ */
+ public static function deactivate()
+ {
+ Helper::removeAction('links-edit');
+ Helper::removePanel(3, 'Links/manage-links.php');
+ }
+
+ /**
+ * 获取插件配置面板
+ *
+ * @access public
+ * @param Typecho_Widget_Helper_Form $form 配置面板
+ * @return void
+ */
+ public static function config(Typecho_Widget_Helper_Form $form) {}
+
+ /**
+ * 个人用户的配置面板
+ *
+ * @access public
+ * @param Typecho_Widget_Helper_Form $form
+ * @return void
+ */
+ public static function personalConfig(Typecho_Widget_Helper_Form $form) {}
+
+ public static function linksInstall()
+ {
+ $installDb = Typecho_Db::get();
+ $type = explode('_', $installDb->getAdapterName());
+ $type = array_pop($type);
+ $prefix = $installDb->getPrefix();
+ $scripts = file_get_contents('usr/plugins/Links/'.$type.'.sql');
+ $scripts = str_replace('typecho_', $prefix, $scripts);
+ $scripts = str_replace('%charset%', 'utf8', $scripts);
+ $scripts = explode(';', $scripts);
+ try {
+ foreach ($scripts as $script) {
+ $script = trim($script);
+ if ($script) {
+ $installDb->query($script, Typecho_Db::WRITE);
+ }
+ }
+ return '建立友情链接数据表,插件启用成功';
+ } catch (Typecho_Db_Exception $e) {
+ $code = $e->getCode();
+ if(('Mysql' == $type && 1050 == $code) ||
+ ('SQLite' == $type && ('HY000' == $code || 1 == $code))) {
+ try {
+ $script = 'SELECT `lid`, `name`, `url`, `sort`, `image`, `description`, `user`, `order` from `' . $prefix . 'links`';
+ $installDb->query($script, Typecho_Db::READ);
+ return '检测到友情链接数据表,友情链接插件启用成功';
+ } catch (Typecho_Db_Exception $e) {
+ $code = $e->getCode();
+ if(('Mysql' == $type && 1054 == $code) ||
+ ('SQLite' == $type && ('HY000' == $code || 1 == $code))) {
+ return Links_Plugin::linksUpdate($installDb, $type, $prefix);
+ }
+ throw new Typecho_Plugin_Exception('数据表检测失败,友情链接插件启用失败。错误号:'.$code);
+ }
+ } else {
+ throw new Typecho_Plugin_Exception('数据表建立失败,友情链接插件启用失败。错误号:'.$code);
+ }
+ }
+ }
+
+ public static function linksUpdate($installDb, $type, $prefix)
+ {
+ $scripts = file_get_contents('usr/plugins/Links/Update_'.$type.'.sql');
+ $scripts = str_replace('typecho_', $prefix, $scripts);
+ $scripts = str_replace('%charset%', 'utf8', $scripts);
+ $scripts = explode(';', $scripts);
+ try {
+ foreach ($scripts as $script) {
+ $script = trim($script);
+ if ($script) {
+ $installDb->query($script, Typecho_Db::WRITE);
+ }
+ }
+ return '检测到旧版本友情链接数据表,升级成功';
+ } catch (Typecho_Db_Exception $e) {
+ $code = $e->getCode();
+ if(('Mysql' == $type && 1060 == $code) ) {
+ return '友情链接数据表已经存在,插件启用成功';
+ }
+ throw new Typecho_Plugin_Exception('友情链接插件启用失败。错误号:'.$code);
+ }
+ }
+
+ public static function form($action = NULL)
+ {
+ /** 构建表格 */
+ $options = Typecho_Widget::widget('Widget_Options');
+ $form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/links-edit', $options->index),
+ Typecho_Widget_Helper_Form::POST_METHOD);
+
+ /** 链接名称 */
+ $name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('链接名称*'));
+ $form->addInput($name);
+
+ /** 链接地址 */
+ $url = new Typecho_Widget_Helper_Form_Element_Text('url', NULL, "http://", _t('链接地址*'));
+ $form->addInput($url);
+
+ /** 链接分类 */
+ $sort = new Typecho_Widget_Helper_Form_Element_Text('sort', NULL, NULL, _t('链接分类'), _t('建议以英文字母开头,只包含字母与数字'));
+ $form->addInput($sort);
+
+ /** 链接图片 */
+ $image = new Typecho_Widget_Helper_Form_Element_Text('image', NULL, NULL, _t('链接图片'), _t('需要以http://开头,留空表示没有链接图片'));
+ $form->addInput($image);
+
+ /** 链接描述 */
+ $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, NULL, _t('链接描述'));
+ $form->addInput($description);
+
+ /** 自定义数据 */
+ $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('自定义数据'), _t('该项用于用户自定义数据扩展'));
+ $form->addInput($user);
+
+ /** 链接动作 */
+ $do = new Typecho_Widget_Helper_Form_Element_Hidden('do');
+ $form->addInput($do);
+
+ /** 链接主键 */
+ $lid = new Typecho_Widget_Helper_Form_Element_Hidden('lid');
+ $form->addInput($lid);
+
+ /** 提交按钮 */
+ $submit = new Typecho_Widget_Helper_Form_Element_Submit();
+ $submit->input->setAttribute('class', 'btn primary');
+ $form->addItem($submit);
+ $request = Typecho_Request::getInstance();
+
+ if (isset($request->lid) && 'insert' != $action) {
+ /** 更新模式 */
+ $db = Typecho_Db::get();
+ $prefix = $db->getPrefix();
+ $link = $db->fetchRow($db->select()->from($prefix.'links')->where('lid = ?', $request->lid));
+ if (!$link) {
+ throw new Typecho_Widget_Exception(_t('链接不存在'), 404);
+ }
+
+ $name->value($link['name']);
+ $url->value($link['url']);
+ $sort->value($link['sort']);
+ $image->value($link['image']);
+ $description->value($link['description']);
+ $user->value($link['user']);
+ $do->value('update');
+ $lid->value($link['lid']);
+ $submit->value(_t('编辑链接'));
+ $_action = 'update';
+ } else {
+ $do->value('insert');
+ $submit->value(_t('增加链接'));
+ $_action = 'insert';
+ }
+
+ if (empty($action)) {
+ $action = $_action;
+ }
+
+ /** 给表单增加规则 */
+ if ('insert' == $action || 'update' == $action) {
+ $name->addRule('required', _t('必须填写链接名称'));
+ $url->addRule('required', _t('必须填写链接地址'));
+ $url->addRule('url', _t('不是一个合法的链接地址'));
+ $image->addRule('url', _t('不是一个合法的图片地址'));
+ }
+ if ('update' == $action) {
+ $lid->addRule('required', _t('链接主键不存在'));
+ $lid->addRule(array(new Links_Plugin, 'LinkExists'), _t('链接不存在'));
+ }
+ return $form;
+ }
+
+ public static function LinkExists($lid)
+ {
+ $db = Typecho_Db::get();
+ $prefix = $db->getPrefix();
+ $link = $db->fetchRow($db->select()->from($prefix.'links')->where('lid = ?', $lid)->limit(1));
+ return $link ? true : false;
+ }
+
+ /**
+ * 控制输出格式
+ */
+ public static function output_str($pattern=NULL, $links_num=0, $sort=NULL)
+ {
+ $options = Typecho_Widget::widget('Widget_Options');
+ if (!isset($options->plugins['activated']['Links'])) {
+ return '友情链接插件未激活';
+ }
+ if (!isset($pattern) || $pattern == "" || $pattern == NULL || $pattern == "SHOW_TEXT") {
+ $pattern = "<li><a href=\"{url}\" title=\"{title}\" target=\"_blank\">{name}</a></li>\n";
+ } else if ($pattern == "SHOW_IMG") {
+ $pattern = "<li><a href=\"{url}\" title=\"{title}\" target=\"_blank\"><img src=\"{image}\" alt=\"{name}\" /></a></li>\n";
+ } else if ($pattern == "SHOW_MIX") {
+ $pattern = "
+ <a href=\"{url}\" target=\"_blank\" title=\"{title}\" class=\"links-link\">
+ <div class=\"col-md-3 col-xs-6\">
+ <div class=\"links-item\">
+ <div class=\"links-img\" style=\"background:url('{image}');width: 100%;padding-top: 100%;background-repeat: no-repeat;background-size: cover;\"></div>
+ <div class=\"links-title\">
+ <h4>{name}</h4>
+ </div>
+ </div>
+ </div>
+ </a>";
+ }
+ $db = Typecho_Db::get();
+ $prefix = $db->getPrefix();
+ $options = Typecho_Widget::widget('Widget_Options');
+ $nopic_url = Typecho_Common::url('/usr/plugins/Links/nopic.jpg', $options->siteUrl);
+ $sql = $db->select()->from($prefix.'links');
+ if (!isset($sort) || $sort == "") {
+ $sort = NULL;
+ }
+ if ($sort) {
+ $sql = $sql->where('sort=?', $sort);
+ }
+ $sql = $sql->order($prefix.'links.order', Typecho_Db::SORT_ASC);
+ $links_num = intval($links_num);
+ if ($links_num > 0) {
+ $sql = $sql->limit($links_num);
+ }
+ $links = $db->fetchAll($sql);
+ $str = "";
+ foreach ($links as $link) {
+ if ($link['image'] == NULL) {
+ $link['image'] = $nopic_url;
+ }
+ $str .= str_replace(
+ array('{lid}', '{name}', '{url}', '{sort}', '{title}', '{description}', '{image}', '{user}'),
+ array($link['lid'], $link['name'], $link['url'], $link['sort'], $link['description'], $link['description'], $link['image'], $link['user']),
+ $pattern
+ );
+ }
+ return $str;
+ }
+
+ //输出
+ public static function output($pattern=NULL, $links_num=0, $sort=NULL)
+ {
+ echo Links_Plugin::output_str($pattern, $links_num, $sort);
+ }
+
+ /**
+ * 解析
+ *
+ * @access public
+ * @param array $matches 解析值
+ * @return string
+ */
+ public static function parseCallback($matches)
+ {
+ $db = Typecho_Db::get();
+ $pattern = $matches[3];
+ $links_num = $matches[1];
+ $sort = $matches[2];
+ return Links_Plugin::output_str($pattern, $links_num, $sort);
+ }
+
+ public static function parse($text, $widget, $lastResult)
+ {
+ $text = empty($lastResult) ? $text : $lastResult;
+
+ if ($widget instanceof Widget_Archive || $widget instanceof Widget_Abstract_Comments) {
+ return preg_replace_callback("/<links\s*(\d*)\s*(\w*)>\s*(.*?)\s*<\/links>/is", array('Links_Plugin', 'parseCallback'), $text);
+ } else {
+ return $text;
+ }
+ }
+}
diff --git a/plugins/Links/SQLite.sql b/plugins/Links/SQLite.sql
new file mode 100644
index 0000000..cbdfa64
--- /dev/null
+++ b/plugins/Links/SQLite.sql
@@ -0,0 +1,10 @@
+CREATE TABLE `typecho_links` (
+ `lid` INTEGER NOT NULL PRIMARY KEY,
+ `name` varchar(200) default NULL,
+ `url` varchar(200) default NULL,
+ `sort` varchar(200) default NULL,
+ `image` varchar(200) default NULL,
+ `description` varchar(200) default NULL,
+ `user` varchar(200) default NULL,
+ `order` int(10) default '0'
+);
diff --git a/plugins/Links/Update_Mysql.sql b/plugins/Links/Update_Mysql.sql
new file mode 100644
index 0000000..fe9452a
--- /dev/null
+++ b/plugins/Links/Update_Mysql.sql
@@ -0,0 +1,4 @@
+ALTER TABLE `typecho_links`
+ADD `sort` varchar( 200 ) default NULL COMMENT 'links分类' AFTER `url`,
+ADD `image` varchar( 200 ) default NULL COMMENT 'links图片' AFTER `sort`,
+ADD `user` varchar( 200 ) default NULL COMMENT '自定义' AFTER `description`; \ No newline at end of file
diff --git a/plugins/Links/Update_SQLite.sql b/plugins/Links/Update_SQLite.sql
new file mode 100644
index 0000000..6bced38
--- /dev/null
+++ b/plugins/Links/Update_SQLite.sql
@@ -0,0 +1,25 @@
+CREATE TABLE `typecho_links_upgrade` (
+ `lid` INTEGER NOT NULL PRIMARY KEY,
+ `name` varchar(200) default NULL,
+ `url` varchar(200) default NULL,
+ `sort` varchar(200) default NULL,
+ `image` varchar(200) default NULL,
+ `description` varchar(200) default NULL,
+ `user` varchar(200) default NULL,
+ `order` int(10) default '0'
+);
+INSERT INTO `typecho_links_upgrade` (`lid`, `name`, `url`, `sort`, `image`, `description`, `user`, `order`)
+SELECT `lid`, `name`, `url`, NULL, NULL, `description`, NULL, `order` FROM `typecho_links`;
+DROP TABLE `typecho_links`;
+CREATE TABLE `typecho_links` (
+ `lid` INTEGER NOT NULL PRIMARY KEY,
+ `name` varchar(200) default NULL,
+ `url` varchar(200) default NULL,
+ `sort` varchar(200) default NULL,
+ `image` varchar(200) default NULL,
+ `description` varchar(200) default NULL,
+ `user` varchar(200) default NULL,
+ `order` int(10) default '0'
+);
+INSERT INTO `typecho_links` SELECT * FROM `typecho_links_upgrade`;
+DROP TABLE `typecho_links_upgrade`;
diff --git a/plugins/Links/manage-links.php b/plugins/Links/manage-links.php
new file mode 100644
index 0000000..93c9b9f
--- /dev/null
+++ b/plugins/Links/manage-links.php
@@ -0,0 +1,144 @@
+<?php
+include 'common.php';
+include 'header.php';
+include 'menu.php';
+?>
+
+
+<div class="main">
+ <div class="body container">
+ <?php include 'page-title.php'; ?>
+ <div class="row typecho-page-main manage-metas">
+ <div class="col-mb-12">
+ <ul class="typecho-option-tabs clearfix">
+ <li class="current"><a href="<?php $options->adminUrl('extending.php?panel=Links%2Fmanage-links.php'); ?>"><?php _e('友情链接'); ?></a></li>
+ <li><a href=<?php $options->index('/action/links-edit?do=addhanny'); ?> title="如果你喜欢,可以点击快速添加寒泥的博客。"><?php _e('添加寒泥'); ?></a></li>
+ <li><a href="http://www.imhan.com/archives/typecho-links/" title="查看友情链接使用帮助" target="_blank"><?php _e('帮助'); ?></a></li>
+ </ul>
+ </div>
+
+ <div class="col-mb-12 col-tb-8" role="main">
+ <?php
+ $prefix = $db->getPrefix();
+ $links = $db->fetchAll($db->select()->from($prefix.'links')->order($prefix.'links.order', Typecho_Db::SORT_ASC));
+ ?>
+ <form method="post" name="manage_categories" class="operate-form">
+ <div class="typecho-list-operate clearfix">
+ <div class="operate">
+ <label><i class="sr-only"><?php _e('全选'); ?></i><input type="checkbox" class="typecho-table-select-all" /></label>
+ <div class="btn-group btn-drop">
+ <button class="btn dropdown-toggle btn-s" type="button"><i class="sr-only"><?php _e('操作'); ?></i><?php _e('选中项'); ?> <i class="i-caret-down"></i></button>
+ <ul class="dropdown-menu">
+ <li><a lang="<?php _e('你确认要删除这些链接吗?'); ?>" href="<?php $options->index('/action/links-edit?do=delete'); ?>"><?php _e('删除'); ?></a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
+ <div class="typecho-table-wrap">
+ <table class="typecho-list-table">
+ <colgroup>
+ <col width="20"/>
+ <col width="25%"/>
+ <col width=""/>
+ <col width="15%"/>
+ <col width="10%"/>
+ </colgroup>
+ <thead>
+ <tr>
+ <th> </th>
+ <th><?php _e('链接名称'); ?></th>
+ <th><?php _e('链接地址'); ?></th>
+ <th><?php _e('分类'); ?></th>
+ <th><?php _e('图片'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php if(!empty($links)): $alt = 0;?>
+ <?php foreach ($links as $link): ?>
+ <tr id="lid-<?php echo $link['lid']; ?>">
+ <td><input type="checkbox" value="<?php echo $link['lid']; ?>" name="lid[]"/></td>
+ <td><a href="<?php echo $request->makeUriByRequest('lid=' . $link['lid']); ?>" title="点击编辑"><?php echo $link['name']; ?></a>
+ <td><?php echo $link['url']; ?></td>
+ <td><?php echo $link['sort']; ?></td>
+ <td><?php
+ if ($link['image']) {
+ echo '<a href="'.$link['image'].'" title="点击放大" target="_blank"><img class="avatar" src="'.$link['image'].'" alt="'.$link['name'].'" width="32" height="32"/></a>';
+ } else {
+ $options = Typecho_Widget::widget('Widget_Options');
+ $nopic_url = Typecho_Common::url('/usr/plugins/Links/nopic.jpg', $options->siteUrl);
+ echo '<img class="avatar" src="'.$nopic_url.'" alt="NOPIC" width="32" height="32"/>';
+ }
+ ?></td>
+ </tr>
+ <?php endforeach; ?>
+ <?php else: ?>
+ <tr>
+ <td colspan="5"><h6 class="typecho-list-table-title"><?php _e('没有任何链接'); ?></h6></td>
+ </tr>
+ <?php endif; ?>
+ </tbody>
+ </table>
+ </div>
+ </form>
+ </div>
+ <div class="col-mb-12 col-tb-4" role="form">
+ <?php Links_Plugin::form()->render(); ?>
+ </div>
+ </div>
+ </div>
+</div>
+
+<?php
+include 'copyright.php';
+include 'common-js.php';
+?>
+
+<script type="text/javascript">
+(function () {
+ $(document).ready(function () {
+ var table = $('.typecho-list-table').tableDnD({
+ onDrop : function () {
+ var ids = [];
+
+ $('input[type=checkbox]', table).each(function () {
+ ids.push($(this).val());
+ });
+
+ $.post('<?php $options->index('/action/links-edit?do=sort'); ?>',
+ $.param({lid : ids}));
+
+ $('tr', table).each(function (i) {
+ if (i % 2) {
+ $(this).addClass('even');
+ } else {
+ $(this).removeClass('even');
+ }
+ });
+ }
+ });
+
+ table.tableSelectable({
+ checkEl : 'input[type=checkbox]',
+ rowEl : 'tr',
+ selectAllEl : '.typecho-table-select-all',
+ actionEl : '.dropdown-menu a'
+ });
+
+ $('.btn-drop').dropdownMenu({
+ btnEl : '.dropdown-toggle',
+ menuEl : '.dropdown-menu'
+ });
+
+ $('.dropdown-menu button.merge').click(function () {
+ var btn = $(this);
+ btn.parents('form').attr('action', btn.attr('rel')).submit();
+ });
+
+ <?php if (isset($request->lid)): ?>
+ $('.typecho-mini-panel').effect('highlight', '#AACB36');
+ <?php endif; ?>
+ });
+})();
+</script>
+<?php include 'footer.php'; ?>
diff --git a/plugins/Links/nopic.jpg b/plugins/Links/nopic.jpg
new file mode 100644
index 0000000..7a79748
--- /dev/null
+++ b/plugins/Links/nopic.jpg
Binary files differ
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..caba237
--- /dev/null
+++ b/screenshot.png
Binary files differ