├── _config.yml ├── img ├── a4.png ├── a5.png ├── a6.png ├── a7.png ├── arrow.png ├── sj │ ├── 1.jpg │ └── 2.jpg ├── sj2 │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── 5.jpg │ ├── 6.jpg │ ├── 7.jpg │ ├── 8.jpg │ ├── 9.jpg │ ├── 10.jpg │ ├── 11.jpg │ ├── 12.jpg │ ├── 13.jpg │ ├── 14.jpg │ └── 15.jpg ├── white.gif ├── avatar.jpeg ├── newyear.png ├── close-note.gif └── shortcode │ ├── yes.png │ ├── info.png │ ├── noway.png │ ├── warning.png │ └── checklist.png ├── screenshot.png ├── fonts ├── iconfont.eot ├── iconfont.ttf ├── iconfont.woff ├── sourcesanspro │ ├── sourcesanspro.woff │ ├── sourcesanspro-bold.woff │ └── sourcesanspro-light.woff └── iconfont.svg ├── 插件 ├── Links │ ├── nopic.jpg │ ├── Update_Mysql.sql │ ├── SQLite.sql │ ├── Mysql.sql │ ├── Update_SQLite.sql │ ├── Action.php │ ├── manage-links.php │ └── Plugin.php └── 安装插件必读.md ├── js ├── prbug.min.js ├── player.min.js ├── script.min.js ├── jquery.lazyload.min.js ├── main.min.js ├── OwO.json ├── OwO.min.js └── toc.min.js ├── README.md ├── page.php ├── guestbook.php ├── files.php ├── 404.php ├── index.php ├── links.php ├── archive.php ├── post.php ├── say.php ├── booklist.php ├── cross.php ├── sidebar.php ├── comments.php ├── footer.php ├── aside.php ├── header.php └── headnav.php /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /img/a4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/a4.png -------------------------------------------------------------------------------- /img/a5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/a5.png -------------------------------------------------------------------------------- /img/a6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/a6.png -------------------------------------------------------------------------------- /img/a7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/a7.png -------------------------------------------------------------------------------- /img/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/arrow.png -------------------------------------------------------------------------------- /img/sj/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj/1.jpg -------------------------------------------------------------------------------- /img/sj/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj/2.jpg -------------------------------------------------------------------------------- /img/sj2/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/1.jpg -------------------------------------------------------------------------------- /img/sj2/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/2.jpg -------------------------------------------------------------------------------- /img/sj2/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/3.jpg -------------------------------------------------------------------------------- /img/sj2/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/4.jpg -------------------------------------------------------------------------------- /img/sj2/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/5.jpg -------------------------------------------------------------------------------- /img/sj2/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/6.jpg -------------------------------------------------------------------------------- /img/sj2/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/7.jpg -------------------------------------------------------------------------------- /img/sj2/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/8.jpg -------------------------------------------------------------------------------- /img/sj2/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/9.jpg -------------------------------------------------------------------------------- /img/white.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/white.gif -------------------------------------------------------------------------------- /img/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/avatar.jpeg -------------------------------------------------------------------------------- /img/newyear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/newyear.png -------------------------------------------------------------------------------- /img/sj2/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/10.jpg -------------------------------------------------------------------------------- /img/sj2/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/11.jpg -------------------------------------------------------------------------------- /img/sj2/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/12.jpg -------------------------------------------------------------------------------- /img/sj2/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/13.jpg -------------------------------------------------------------------------------- /img/sj2/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/14.jpg -------------------------------------------------------------------------------- /img/sj2/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/sj2/15.jpg -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/screenshot.png -------------------------------------------------------------------------------- /fonts/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/iconfont.eot -------------------------------------------------------------------------------- /fonts/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/iconfont.ttf -------------------------------------------------------------------------------- /img/close-note.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/close-note.gif -------------------------------------------------------------------------------- /插件/Links/nopic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/插件/Links/nopic.jpg -------------------------------------------------------------------------------- /fonts/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/iconfont.woff -------------------------------------------------------------------------------- /img/shortcode/yes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/shortcode/yes.png -------------------------------------------------------------------------------- /img/shortcode/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/shortcode/info.png -------------------------------------------------------------------------------- /img/shortcode/noway.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/shortcode/noway.png -------------------------------------------------------------------------------- /img/shortcode/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/shortcode/warning.png -------------------------------------------------------------------------------- /img/shortcode/checklist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/img/shortcode/checklist.png -------------------------------------------------------------------------------- /fonts/sourcesanspro/sourcesanspro.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/sourcesanspro/sourcesanspro.woff -------------------------------------------------------------------------------- /fonts/sourcesanspro/sourcesanspro-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/sourcesanspro/sourcesanspro-bold.woff -------------------------------------------------------------------------------- /fonts/sourcesanspro/sourcesanspro-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/fonts/sourcesanspro/sourcesanspro-light.woff -------------------------------------------------------------------------------- /插件/安装插件必读.md: -------------------------------------------------------------------------------- 1 | V 2.1.0 版本以上只需要安装`Links` 一个插件 2 | 3 | 4 | 安装插件只需要把对应的插件文件夹复制到`/usr/plugins`目录下面! 5 | 6 | 安装插件只需要把对应的插件文件夹复制到`/usr/plugins`目录下面!! 7 | 8 | 安装插件只需要把对应的插件文件夹复制到`/usr/plugins`目录下面!!! 9 | -------------------------------------------------------------------------------- /js/prbug.min.js: -------------------------------------------------------------------------------- 1 | var ody=document.getElementById('ydmc'); 2 | if (yaudio.paused) { 3 | ody.className = 'iconfont icon-player'; 4 | } else { 5 | ody.className = 'iconfont icon-music icon-spin-music'; 6 | } -------------------------------------------------------------------------------- /插件/Links/Update_Mysql.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `typecho_links` 2 | ADD `sort` varchar( 200 ) default NULL COMMENT 'links分类' AFTER `url`, 3 | ADD `image` varchar( 200 ) default NULL COMMENT 'links图片' AFTER `sort`, 4 | ADD `user` varchar( 200 ) default NULL COMMENT '自定义' AFTER `description`; -------------------------------------------------------------------------------- /插件/Links/SQLite.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `typecho_links` ( 2 | `lid` INTEGER NOT NULL PRIMARY KEY, 3 | `name` varchar(200) default NULL, 4 | `url` varchar(200) default NULL, 5 | `sort` varchar(200) default NULL, 6 | `image` varchar(200) default NULL, 7 | `description` varchar(200) default NULL, 8 | `user` varchar(200) default NULL, 9 | `order` int(10) default '0' 10 | ); 11 | -------------------------------------------------------------------------------- /插件/Links/Mysql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `typecho_links` ( 2 | `lid` int(10) unsigned NOT NULL auto_increment COMMENT 'links表主键', 3 | `name` varchar(200) default NULL COMMENT 'links名称', 4 | `url` varchar(200) default NULL COMMENT 'links网址', 5 | `sort` varchar(200) default NULL COMMENT 'links分类', 6 | `image` varchar(200) default NULL COMMENT 'links图片', 7 | `description` varchar(200) default NULL COMMENT 'links描述', 8 | `user` varchar(200) default NULL COMMENT '自定义', 9 | `order` int(10) unsigned default '0' COMMENT 'links排序', 10 | PRIMARY KEY (`lid`) 11 | ) ENGINE=MYISAM DEFAULT CHARSET=%charset%; 12 | -------------------------------------------------------------------------------- /js/player.min.js: -------------------------------------------------------------------------------- 1 | function playbtu(){ 2 | var oyd = document.getElementById('ydmc'); 3 | if (yaudio.paused) { 4 | yaudio.play(); 5 | oyd.className = 'iconfont icon-music icon-spin-music'; 6 | } else { 7 | yaudio.pause(); 8 | oyd.className = 'iconfont icon-player'; 9 | } 10 | } 11 | function next() { 12 | var oyd=document.getElementById('ydmc'); 13 | if (a == musicArr.length - 1) { 14 | a = 0 15 | } else { 16 | a = a + 1 17 | } 18 | var sj = musicArr[a]; 19 | yaudio.src = sj.mp3; 20 | yaudio.ti = sj.title; 21 | yaudio.art = sj.artist; 22 | yaudio.play(); 23 | oyd.className = 'iconfont icon-music icon-spin-music'; 24 | } 25 | 26 | yaudio.addEventListener('ended', 27 | function() { 28 | next(); 29 | }, 30 | false); -------------------------------------------------------------------------------- /插件/Links/Update_SQLite.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `typecho_links_upgrade` ( 2 | `lid` INTEGER NOT NULL PRIMARY KEY, 3 | `name` varchar(200) default NULL, 4 | `url` varchar(200) default NULL, 5 | `sort` varchar(200) default NULL, 6 | `image` varchar(200) default NULL, 7 | `description` varchar(200) default NULL, 8 | `user` varchar(200) default NULL, 9 | `order` int(10) default '0' 10 | ); 11 | INSERT INTO `typecho_links_upgrade` (`lid`, `name`, `url`, `sort`, `image`, `description`, `user`, `order`) 12 | SELECT `lid`, `name`, `url`, NULL, NULL, `description`, NULL, `order` FROM `typecho_links`; 13 | DROP TABLE `typecho_links`; 14 | CREATE TABLE `typecho_links` ( 15 | `lid` INTEGER NOT NULL PRIMARY KEY, 16 | `name` varchar(200) default NULL, 17 | `url` varchar(200) default NULL, 18 | `sort` varchar(200) default NULL, 19 | `image` varchar(200) default NULL, 20 | `description` varchar(200) default NULL, 21 | `user` varchar(200) default NULL, 22 | `order` int(10) default '0' 23 | ); 24 | INSERT INTO `typecho_links` SELECT * FROM `typecho_links_upgrade`; 25 | DROP TABLE `typecho_links_upgrade`; 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![author](https://img.shields.io/badge/author-Hewro-blue.svg?style=flat-square)](http://www.ihewro.xyz) 2 | [![author](https://img.shields.io/badge/author-idealclover-blue.svg?style=flat-square)](http://www.ihewro.xyz) 3 | [![GitHub issues](https://img.shields.io/github/issues/idealclover/typecho-theme-openHandsome.svg?style=flat-square)](https://github.com/idealclover/typecho-theme-openHandsome/issues) 4 | [![GitHub forks](https://img.shields.io/github/forks/idealclover/typecho-theme-openHandsome.svg?style=flat-square)](https://github.com/idealclover/typecho-theme-openHandsome/network) 5 | [![GitHub stars](https://img.shields.io/github/stars/idealclover/typecho-theme-openHandsome.svg?style=flat-square)](https://github.com/idealclover/typecho-theme-openHandsome/stargazers) 6 | [![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square)](https://raw.githubusercontent.com/idealclover/typecho-theme-openHandsome/master/LICENSE) 7 | 8 | # openHandsome 9 | 10 | > 如少年般,迎风而立 11 | > 12 | > 迎风而立是不可能迎风而立的,这辈子都不可能迎风而立的 13 | 14 | [在线预览 Preview ](https://www.ihewro.com/archives/489/) | [使用文档](https://www.ihewro.com/archives/519/) 15 | 16 | ![handsome](https://ws1.sinaimg.cn/large/005HTDcGgy1fwcvikuxkcj30rs0hwq6v.jpg) 17 | 18 | ## 贡献 Contributing 19 | 20 | 欢迎各种形式的贡献,包括但不限于优化,添加功能,文档 & 代码的改进,问题和 bugs 的报告。期待您的`Pull Request`。 21 | 22 | All kinds of contributions (enhancements, new features, documentation & code improvements, issues & bugs reporting) are welcome. 23 | 24 | ## 许可证 License 25 | 26 | 所有代码根据[GPL-3.0协议](https://github.com/idealclover/typecho-theme-openHandsome/blob/master/LICENSE)。换句话说,你可以使用或者修改代码,但是你不能用于商业目的。 27 | 28 | All code licensed under the [GPL-3.0 License](https://github.com/idealclover/typecho-theme-openHandsome/blob/master/LICENSE). In other words you can use or modify the code freely but you can not use it for business purposes. 29 | -------------------------------------------------------------------------------- /js/script.min.js: -------------------------------------------------------------------------------- 1 | /*! handsome 2017-03-29 */ 2 | "use strict";function getKey(){13==event.keyCode&&$("#soux").get(0).click()}function gotoTop(a,b){a=a||.1,b=b||10;var c=0,d=0,e=0,f=0,g=0,h=0;document.documentElement&&(c=document.documentElement.scrollLeft||0,d=document.documentElement.scrollTop||0),document.body&&(e=document.body.scrollLeft||0,f=document.body.scrollTop||0);var g=window.scrollX||0,h=window.scrollY||0,i=Math.max(c,Math.max(e,g)),j=Math.max(d,Math.max(f,h)),k=1+a;if(window.scrollTo(Math.floor(i/k),Math.floor(j/k)),i>0||j>0){var l="gotoTop("+a+", "+b+")";window.setTimeout(l,b)}}$(".off-screen-toggle").click(function(){$("#aside").toggleClass("off-screen")}),$(document).ready(function(){var a=document.getElementById("comment");$("#image-insert").bind("click",function(){var b=prompt("请输入图片地址","http://");b&&(a.value+='')}),$("#submit").click(function(){var a=$("#author").val(),b=$("#mail").val();return""==$("#comment").val()?(toastr.info("请填写内容"),$("#comment").focus(),!1):""==a?(toastr.info("请填写昵称"),$("#author").focus(),!1):""==b?(toastr.info("请填写邮箱"),$("#mail").focus(),!1):($("#submit").addClass("active"),$("#spin").addClass("show inline"),void $("#comment_form").submit())}),$("#login-submit").click(function(){var a=$("#navbar-login-user").val(),b=$("#navbar-login-password").val();return""==a?(toastr.info("请填写用户名"),$("#navbar-login-user").focus(),!1):""==b?(toastr.info("请填写密码"),$("#navbar-login-password").focus(),!1):($("#login-submit").addClass("active"),void $("#spin-login").addClass("show inline"))}),$('[data-toggle="tooltip"]').tooltip()});var bb=$("#soux").attr("href");$("#soux").attr("href",""),$("#keyword").bind("input propertychange",function(){var a=$("input[name=s]").val();$("#soux").attr("href",bb+a)}),$(document).ready(function(){$("#post-content img").each(function(){var a=$(this),b=(a.attr("title"),a.parent("a"));b.size()<1&&(b=a.wrap('').parent("a")),b.addClass("light-link")}),$(".wrapper-lg").lightGallery({selector:".light-link",mousewheel:!0})}),console.log("\n %c handsome v2.1 %c by友人C\n\n","color:#444;background:#eee;padding:5px 0;","color:#eee;background:#444;padding:5px 0;"); -------------------------------------------------------------------------------- /page.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); ?> 3 | 4 | 5 | need('aside.php'); ?> 6 | 7 | 8 | 9 |
10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 |

title() ?> 18 | user->hasLogin()):?> 19 | 20 | 21 |

22 |
23 |
24 | 28 | 29 |
30 |
31 | 32 | options->indexsetup) && in_array('NoRandomPic-post', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 33 | 34 | 35 | 36 | 37 |
38 |
39 | 40 |
41 |
42 |
43 |
44 | 45 | need('comments.php') ?> 46 |
47 |
48 | 49 | need('sidebar.php')?> 50 | 51 |
52 |
53 |
54 | 55 | 56 | 57 | 58 | need('footer.php'); ?> 59 | -------------------------------------------------------------------------------- /guestbook.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | need('header.php'); ?> 10 | 11 | 12 | need('aside.php'); ?> 13 | 14 | 15 | 16 |
17 | 18 |
19 |
20 | 21 |
22 | 23 |
24 |

title() ?> 25 | user->hasLogin()):?> 26 | 27 | 28 |

29 |
30 |
31 | 35 | 36 |
37 |
38 | 39 | options->indexsetup) && in_array('NoRandomPic-post', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 40 | 41 | 42 | 43 | 44 |
45 |
46 |
    47 | 48 |
49 |
50 |
51 | 52 |
53 |
54 |
55 |
56 | 57 | need('comments.php') ?> 58 |
59 |
60 | 61 | need('sidebar.php')?> 62 | 63 |
64 |
65 |
66 | 67 | 68 | 69 | 70 | need('footer.php'); ?> 71 | -------------------------------------------------------------------------------- /files.php: -------------------------------------------------------------------------------- 1 | need('header.php'); 9 | ?> 10 | 11 | 12 | need('aside.php'); ?> 13 | 14 | 15 | 16 |
17 |
18 | 19 |
20 | 21 |
22 |
23 |

文章归档

24 | 25 |
26 |
    27 | publishedPostsNum)->to($archives); 30 | $color = array("light","info","dark","success","black","warning","primary","danger"); 31 | $year=0; $mon=0; $i=0; $j=0; 32 | $output = ''; 33 | $x=0; 34 | while($archives->next()){ 35 | $year_tmp = date('Y',$archives->created); 36 | $mon_tmp = date('m',$archives->created); 37 | $y=$year; $m=$mon; 38 | if ($year > $year_tmp || $mon > $mon_tmp) { 39 | $output .= ''; 40 | } 41 | if ($year != $year_tmp || $mon != $mon_tmp) { 42 | $year = $year_tmp; 43 | $mon = $mon_tmp; 44 | $x++; 45 | if($x>8) $x=1; 46 | $colorsec = $color[$x]; 47 | $output .= '
  • '.date('Y年m月',$archives->created).'

  • ';//输出月份 50 | } 51 | $output .= '
  • '.date('d日',$archives->created).'

    '. $archives->title .'

  • '; //输出文章 58 | } 59 | $output .= ''; 60 | echo $output; 61 | ?> 62 |
  • 63 |
    开始
  • 64 |
65 |
66 | 67 |
68 |
69 | 70 | 71 | 72 | need('footer.php'); ?> 73 | -------------------------------------------------------------------------------- /js/jquery.lazyload.min.js: -------------------------------------------------------------------------------- 1 | /*! Lazy Load 1.9.7 - MIT license - Copyright 2010-2015 Mika Tuupola */ 2 | !function(a,b,c,d){var e=a(b);a.fn.lazyload=function(f){function g(){var b=0;i.each(function(){var c=a(this);if(!j.skip_invisible||c.is(":visible"))if(a.abovethetop(this,j)||a.leftofbegin(this,j));else if(a.belowthefold(this,j)||a.rightoffold(this,j)){if(++b>j.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!1,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); -------------------------------------------------------------------------------- /404.php: -------------------------------------------------------------------------------- 1 | 2 | siteUrl, '/').'/', $options->rootUrl.'/', $options->themeUrl, 1),'/')); 5 | ?> 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | <?php $this->archiveTitle(array( 15 | 'category' => _t('分类 %s 下的文章'), 16 | 'search' => _t('包含关键字 %s 的文章'), 17 | 'tag' => _t('标签 %s 下的文章'), 18 | 'author' => _t('%s 发布的文章') 19 | ), '', ' - '); ?><?php $this->options->title(); ?> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | header(); ?> 38 | 39 | 40 | 41 |
42 | 43 | 44 |
45 |
46 |

404

47 |
48 | 62 |
63 |

64 | options->Indexwords(); ?>
©
65 |

66 |
67 |
68 | 69 | 70 |
71 | 72 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | need('header.php'); 13 | ?> 14 | 15 | 16 | need('aside.php'); ?> 17 | 18 | 19 | 20 |
21 |
22 | 23 |
24 | 25 |
26 |
27 |
28 |
29 |

options->IndexName(); ?>

30 | options->Indexwords(); ?> 31 |
32 |
33 | 34 |
35 | next()): ?> 36 |
37 | 38 | options->indexsetup) && in_array('NoRandomPic-index', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 39 | 40 | 41 | 42 | 43 |
44 | 45 |

title() ?>

46 | options->indexsetup) && in_array('NoSummary-index', $this->options->indexsetup)): ?> 47 | 48 |

49 | excerpt(200, '...'); //200就是摘要的字数,...是后缀; ?> 50 |

51 | 52 |
53 |
54 | author(); ?> 55 | options->langis == '0'): ?>date('F j, Y'); ?>options->langis == '1'): ?>date('Y 年 m 月 d 日'); ?>options->langis == '2'): ?>date('Y 年 m 月 d 日'); ?> 56 | commentsNum(_t(' 暂无评论'), _t(' 1 条评论'), _t(' %d 条评论')); ?> 57 |
58 |
59 |
60 | 61 | 62 |
63 | 64 | 65 | 68 | 72 |
73 |
74 | 75 | need('sidebar.php') ?> 76 |
77 |
78 |
79 | 80 | 81 | 82 | need('footer.php'); ?> 83 | 84 | -------------------------------------------------------------------------------- /links.php: -------------------------------------------------------------------------------- 1 | need('header.php'); 9 | ?> 10 | 24 | 25 | 26 | need('aside.php'); ?> 27 | 28 | 29 | 30 |
31 |
32 | 33 | 34 |
35 |
36 |
37 | 38 |

友情链接

39 |
40 | 41 | 49 |
50 |
51 | 52 |
53 | 54 |
55 |
56 |

本博信息

57 |
58 |
59 | content(); ?> 60 | 61 | need('comments.php') ?> 62 |
63 |
64 | 65 | 80 | 81 | 84 | 85 | 88 | 89 | 90 |
91 | 92 |
93 |
94 | 95 | 96 |
97 |
98 | 99 | 100 | 101 | need('footer.php'); ?> 102 | 103 | 104 | -------------------------------------------------------------------------------- /archive.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); ?> 3 | 4 | 5 | need('aside.php'); ?> 6 | 7 | 8 | 9 |
10 |
11 | 12 |
13 | 14 |
15 |
16 |
17 |
18 |

archiveTitle(array( 19 | 'category' => _t('分类 %s 下的文章'), 20 | 'search' => _t('包含关键字 %s 的文章'), 21 | 'tag' => _t('标签 %s 下的文章'), 22 | 'author' => _t('%s 发布的文章') 23 | ), '', ''); ?>

24 |
25 |
26 | 27 | 36 | have()): ?> 37 | 38 |
39 | next()): ?> 40 |
41 | 42 | options->indexsetup) && in_array('NoRandomPic-index', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 43 | 44 | 45 | 46 | 47 |
48 |

title() ?>

49 | options->indexsetup) && in_array('NoSummary-index', $this->options->indexsetup)): ?> 50 | 51 |

52 | excerpt(200, '...'); //200就是摘要的字数,...是后缀; ?> 53 |

54 | 55 |
56 |
57 | author(); ?> 58 | options->langis == '0'): ?>date('F j, Y'); ?>options->langis == '1'): ?>date('Y 年 m 月 d 日'); ?>options->langis == '2'): ?>date('Y 年 m 月 d 日'); ?> 59 | commentsNum(_t(' 暂无评论'), _t(' 1 条评论'), _t(' %d 条评论')); ?> 60 |
61 |
62 |
63 | 64 | 65 |
66 | 67 |

没有找到搜索结果,请尝试更换关键词。

68 | 69 | 70 | 71 | 74 | 78 |
79 |
80 | 81 | need('sidebar.php') ?> 82 |
83 |
84 |
85 | 86 | 87 | 88 | need('footer.php'); ?> 89 | -------------------------------------------------------------------------------- /post.php: -------------------------------------------------------------------------------- 1 | 2 | need('header.php'); ?> 3 | 4 | 5 | need('aside.php'); ?> 6 | 7 | 8 | 9 |
10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 |

title() ?> 18 | user->hasLogin()):?> 19 | 20 | 21 |

22 | 23 | 35 |
36 |
37 | 42 | 43 |
44 |
45 | 46 | options->indexsetup) && in_array('NoRandomPic-post', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 47 | 48 | 49 | 50 | 51 |
52 |
53 | 54 |
55 |
56 |
57 |
58 | 59 | 64 | 65 | need('comments.php') ?> 66 |
67 |
68 | 69 | need('sidebar.php')?> 70 | 71 |
72 |
73 |
74 | 75 | 76 | 77 | 78 | need('footer.php'); ?> 79 | -------------------------------------------------------------------------------- /插件/Links/Action.php: -------------------------------------------------------------------------------- 1 | validate()) { 11 | $this->response->goBack(); 12 | } 13 | /** 取出数据 */ 14 | $link = $this->request->from('name', 'url', 'sort', 'image', 'description', 'user'); 15 | $link['order'] = $this->db->fetchObject($this->db->select(array('MAX(order)' => 'maxOrder'))->from($this->prefix.'links'))->maxOrder + 1; 16 | 17 | /** 插入数据 */ 18 | $link['lid'] = $this->db->query($this->db->insert($this->prefix.'links')->rows($link)); 19 | 20 | /** 设置高亮 */ 21 | $this->widget('Widget_Notice')->highlight('link-'.$link['lid']); 22 | 23 | /** 提示信息 */ 24 | $this->widget('Widget_Notice')->set(_t('链接 %s 已经被增加', 25 | $link['url'], $link['name']), NULL, 'success'); 26 | 27 | /** 转向原页 */ 28 | $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl)); 29 | } 30 | 31 | public function addHannysBlog() 32 | { 33 | /** 取出数据 */ 34 | $link = array( 35 | 'name' => "Hanny's Blog", 36 | 'url' => "http://www.imhan.com", 37 | 'description' => "寒泥 - Typecho插件开发者", 38 | ); 39 | $link['order'] = $this->db->fetchObject($this->db->select(array('MAX(order)' => 'maxOrder'))->from($this->prefix.'links'))->maxOrder + 1; 40 | 41 | /** 插入数据 */ 42 | $link['lid'] = $this->db->query($this->db->insert($this->prefix.'links')->rows($link)); 43 | 44 | /** 设置高亮 */ 45 | $this->widget('Widget_Notice')->highlight('link-'.$link['lid']); 46 | 47 | /** 提示信息 */ 48 | $this->widget('Widget_Notice')->set(_t('链接 %s 已经被增加', 49 | $link['url'], $link['name']), NULL, 'success'); 50 | 51 | /** 转向原页 */ 52 | $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl)); 53 | } 54 | 55 | public function updateLink() 56 | { 57 | if (Links_Plugin::form('update')->validate()) { 58 | $this->response->goBack(); 59 | } 60 | 61 | /** 取出数据 */ 62 | $link = $this->request->from('lid', 'name', 'sort', 'image', 'url', 'description', 'user'); 63 | 64 | /** 更新数据 */ 65 | $this->db->query($this->db->update($this->prefix.'links')->rows($link)->where('lid = ?', $link['lid'])); 66 | 67 | /** 设置高亮 */ 68 | $this->widget('Widget_Notice')->highlight('link-'.$link['lid']); 69 | 70 | /** 提示信息 */ 71 | $this->widget('Widget_Notice')->set(_t('链接 %s 已经被更新', 72 | $link['url'], $link['name']), NULL, 'success'); 73 | 74 | /** 转向原页 */ 75 | $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl)); 76 | } 77 | 78 | public function deleteLink() 79 | { 80 | $lids = $this->request->filter('int')->getArray('lid'); 81 | $deleteCount = 0; 82 | if ($lids && is_array($lids)) { 83 | foreach ($lids as $lid) { 84 | if ($this->db->query($this->db->delete($this->prefix.'links')->where('lid = ?', $lid))) { 85 | $deleteCount ++; 86 | } 87 | } 88 | } 89 | /** 提示信息 */ 90 | $this->widget('Widget_Notice')->set($deleteCount > 0 ? _t('链接已经删除') : _t('没有链接被删除'), NULL, 91 | $deleteCount > 0 ? 'success' : 'notice'); 92 | 93 | /** 转向原页 */ 94 | $this->response->redirect(Typecho_Common::url('extending.php?panel=Links%2Fmanage-links.php', $this->options->adminUrl)); 95 | } 96 | 97 | public function sortLink() 98 | { 99 | $links = $this->request->filter('int')->getArray('lid'); 100 | if ($links && is_array($links)) { 101 | foreach ($links as $sort => $lid) { 102 | $this->db->query($this->db->update($this->prefix.'links')->rows(array('order' => $sort + 1))->where('lid = ?', $lid)); 103 | } 104 | } 105 | } 106 | 107 | public function action() 108 | { 109 | $this->db = Typecho_Db::get(); 110 | $this->prefix = $this->db->getPrefix(); 111 | $this->options = Typecho_Widget::widget('Widget_Options'); 112 | $this->on($this->request->is('do=insert'))->insertLink(); 113 | $this->on($this->request->is('do=addhanny'))->addHannysBlog(); 114 | $this->on($this->request->is('do=update'))->updateLink(); 115 | $this->on($this->request->is('do=delete'))->deleteLink(); 116 | $this->on($this->request->is('do=sort'))->sortLink(); 117 | $this->response->redirect($this->options->adminUrl); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /js/main.min.js: -------------------------------------------------------------------------------- 1 | /*! handsome 2017-03-29 */ 2 | +function(a){a(function(){a(document).on("click","[ui-nav] a",function(b){var c,d=a(b.target);d.is("a")||(d=d.closest("a")),c=d.parent().siblings(".active"),c&&c.toggleClass("active").find("> ul:visible").slideUp(200),d.parent().hasClass("active")&&d.next().slideUp(200)||d.next().slideDown(200),d.parent().toggleClass("active"),d.next().is("ul")&&b.preventDefault()})})}(jQuery),function(a){a(function(){a(document).on("click","[ui-toggle-class]",function(b){b.preventDefault();var c=a(b.target);c.attr("ui-toggle-class")||(c=c.closest("[ui-toggle-class]"));var d=c.attr("ui-toggle-class").split(","),e=c.attr("target")&&c.attr("target").split(",")||Array(c),f=0;a.each(d,function(b,c){a(e[e.length&&f]).toggleClass(d[b]),f++}),c.toggleClass("active")})})}(jQuery),function(a){a(function(){(!!navigator.userAgent.match(/MSIE/i)||!!navigator.userAgent.match(/Trident.*rv:11\./))&&a("html").addClass("ie");var b=window.navigator.userAgent||window.navigator.vendor||window.opera;/iPhone|iPod|iPad|Silk|Android|BlackBerry|Opera Mini|IEMobile/.test(b)&&a("html").addClass("smart")})}(jQuery),function(a){a(["jquery"],function(a){return function(){function b(a,b,c){return o({type:v.error,iconClass:p().iconClasses.error,message:a,optionsOverride:c,title:b})}function c(b,c){return b||(b=p()),r=a("#"+b.containerId),r.length?r:(c&&(r=l(b)),r)}function d(a,b,c){return o({type:v.info,iconClass:p().iconClasses.info,message:a,optionsOverride:c,title:b})}function e(a){s=a}function f(a,b,c){return o({type:v.success,iconClass:p().iconClasses.success,message:a,optionsOverride:c,title:b})}function g(a,b,c){return o({type:v.warning,iconClass:p().iconClasses.warning,message:a,optionsOverride:c,title:b})}function h(a,b){var d=p();r||c(d),k(a,d,b)||j(d)}function i(b){var d=p();return r||c(d),b&&0===a(":focus",b).length?void q(b):void(r.children().length&&r.remove())}function j(b){for(var c=r.children(),d=c.length-1;d>=0;d--)k(a(c[d]),b)}function k(b,c,d){var e=!(!d||!d.force)&&d.force;return!(!b||!e&&0!==a(":focus",b).length||(b[c.hideMethod]({duration:c.hideDuration,easing:c.hideEasing,complete:function(){q(b)}}),0))}function l(b){return r=a("
").attr("id",b.containerId).addClass(b.positionClass),r.appendTo(a(b.target)),r}function m(){return{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1}}function n(a){s&&s(a)}function o(b){function d(a){return null==a&&(a=""),a.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function e(){var a="";switch(b.iconClass){case"toast-success":case"toast-info":a="polite";break;default:a="assertive"}z.attr("aria-live",a)}function f(){b.iconClass&&z.addClass(w.toastClass).addClass(x)}function g(){w.newestOnTop?r.prepend(z):r.append(z)}function h(){if(b.title){var a=b.title;w.escapeHtml&&(a=d(b.title)),A.append(a).addClass(w.titleClass),z.append(A)}}function i(){if(b.message){var a=b.message;w.escapeHtml&&(a=d(b.message)),B.append(a).addClass(w.messageClass),z.append(B)}}function j(){w.closeButton&&(D.addClass(w.closeClass).attr("role","button"),z.prepend(D))}function k(){w.progressBar&&(C.addClass(w.progressClass),z.prepend(C))}function l(){w.rtl&&z.addClass("rtl")}function m(b){var c=b&&w.closeMethod!==!1?w.closeMethod:w.hideMethod,d=b&&w.closeDuration!==!1?w.closeDuration:w.hideDuration,e=b&&w.closeEasing!==!1?w.closeEasing:w.hideEasing;if(!a(":focus",z).length||b)return clearTimeout(E.intervalId),z[c]({duration:d,easing:e,complete:function(){q(z),clearTimeout(y),w.onHidden&&"hidden"!==F.state&&w.onHidden(),F.state="hidden",F.endTime=new Date,n(F)}})}function o(){(w.timeOut>0||w.extendedTimeOut>0)&&(y=setTimeout(m,w.extendedTimeOut),E.maxHideTime=parseFloat(w.extendedTimeOut),E.hideEta=(new Date).getTime()+E.maxHideTime)}function s(){clearTimeout(y),E.hideEta=0,z.stop(!0,!0)[w.showMethod]({duration:w.showDuration,easing:w.showEasing})}function v(){var a=(E.hideEta-(new Date).getTime())/E.maxHideTime*100;C.width(a+"%")}var w=p(),x=b.iconClass||w.iconClass;if(void 0!==b.optionsOverride&&(w=a.extend(w,b.optionsOverride),x=b.optionsOverride.iconClass||x),!function(a,b){if(a.preventDuplicates){if(b.message===t)return!0;t=b.message}return!1}(w,b)){u++,r=c(w,!0);var y=null,z=a("
"),A=a("
"),B=a("
"),C=a("
"),D=a(w.closeHtml),E={intervalId:null,hideEta:null,maxHideTime:null},F={toastId:u,state:"visible",startTime:new Date,options:w,map:b};return function(){f(),h(),i(),j(),k(),l(),g(),e()}(),function(){z.hide(),z[w.showMethod]({duration:w.showDuration,easing:w.showEasing,complete:w.onShown}),w.timeOut>0&&(y=setTimeout(m,w.timeOut),E.maxHideTime=parseFloat(w.timeOut),E.hideEta=(new Date).getTime()+E.maxHideTime,w.progressBar&&(E.intervalId=setInterval(v,10)))}(),function(){w.closeOnHover&&z.hover(s,o),!w.onclick&&w.tapToDismiss&&z.click(m),w.closeButton&&D&&D.click(function(a){a.stopPropagation?a.stopPropagation():void 0!==a.cancelBubble&&a.cancelBubble!==!0&&(a.cancelBubble=!0),w.onCloseClick&&w.onCloseClick(a),m(!0)}),w.onclick&&z.click(function(a){w.onclick(a),m()})}(),n(F),w.debug&&console&&console.log(F),z}}function p(){return a.extend({},m(),w.options)}function q(a){r||(r=c()),a.is(":visible")||(a.remove(),a=null,0===r.children().length&&(r.remove(),t=void 0))}var r,s,t,u=0,v={error:"error",info:"info",success:"success",warning:"warning"},w={clear:h,remove:i,error:b,getContainer:c,info:d,options:{},subscribe:e,success:f,version:"2.1.3",warning:g};return w}()})}("function"==typeof define&&define.amd?define:function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("jquery")):window.toastr=b(window.jQuery)}); -------------------------------------------------------------------------------- /js/OwO.json: -------------------------------------------------------------------------------- 1 | { 2 | "颜文字": { 3 | "type": "emoticon", 4 | "container": [ 5 | { 6 | "icon": "OωO", 7 | "text": "Author: DIYgod" 8 | }, 9 | { 10 | "icon": "|´・ω・)ノ", 11 | "text": "Hi" 12 | }, 13 | { 14 | "icon": "ヾ(≧∇≦*)ゝ", 15 | "text": "开心" 16 | }, 17 | { 18 | "icon": "(☆ω☆)", 19 | "text": "星星眼" 20 | }, 21 | { 22 | "icon": "(╯‵□′)╯︵┴─┴", 23 | "text": "掀桌" 24 | }, 25 | { 26 | "icon": " ̄﹃ ̄", 27 | "text": "流口水" 28 | }, 29 | { 30 | "icon": "(/ω\)", 31 | "text": "捂脸" 32 | }, 33 | { 34 | "icon": "∠( ᐛ 」∠)_", 35 | "text": "给跪" 36 | }, 37 | { 38 | "icon": "(๑•̀ㅁ•́ฅ)", 39 | "text": "Hi" 40 | }, 41 | { 42 | "icon": "→_→", 43 | "text": "斜眼" 44 | }, 45 | { 46 | "icon": "୧(๑•̀⌄•́๑)૭", 47 | "text": "加油" 48 | }, 49 | { 50 | "icon": "٩(ˊᗜˋ*)و", 51 | "text": "有木有WiFi" 52 | }, 53 | { 54 | "icon": "(ノ°ο°)ノ", 55 | "text": "前方高能预警" 56 | }, 57 | { 58 | "icon": "(´இ皿இ`)", 59 | "text": "我从未见过如此厚颜无耻之人" 60 | }, 61 | { 62 | "icon": "⌇●﹏●⌇", 63 | "text": "吓死宝宝惹" 64 | }, 65 | { 66 | "icon": "(ฅ´ω`ฅ)", 67 | "text": "已阅留爪" 68 | }, 69 | { 70 | "icon": "(╯°A°)╯︵○○○", 71 | "text": "去吧大师球" 72 | }, 73 | { 74 | "icon": "φ( ̄∇ ̄o)", 75 | "text": "太萌惹" 76 | }, 77 | { 78 | "icon": "ヾ(´・ ・`。)ノ\"", 79 | "text": "咦咦咦" 80 | }, 81 | { 82 | "icon": "( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃", 83 | "text": "气呼呼" 84 | }, 85 | { 86 | "icon": "(ó﹏ò。)", 87 | "text": "我受到了惊吓" 88 | }, 89 | { 90 | "icon": "Σ(っ °Д °;)っ", 91 | "text": "什么鬼" 92 | }, 93 | { 94 | "icon": "( ,,´・ω・)ノ\"(´っω・`。)", 95 | "text": "摸摸头" 96 | }, 97 | { 98 | "icon": "╮(╯▽╰)╭ ", 99 | "text": "无奈" 100 | }, 101 | { 102 | "icon": "o(*////▽////*)q ", 103 | "text": "脸红" 104 | }, 105 | { 106 | "icon": ">﹏<", 107 | "text": "" 108 | }, 109 | { 110 | "icon": "( ๑´•ω•) \"(ㆆᴗㆆ)", 111 | "text": "" 112 | }, 113 | { 114 | "icon": "(。•ˇ‸ˇ•。)", 115 | "text": "" 116 | } 117 | ] 118 | }, 119 | "斗图": { 120 | "type": "image", 121 | "container": [ 122 | { 123 | "icon": "", 124 | "text": "face1" 125 | }, 126 | { 127 | "icon": "", 128 | "text": "face2" 129 | }, 130 | { 131 | "icon": "", 132 | "text": "face3" 133 | }, 134 | { 135 | "icon": "", 136 | "text": "face4" 137 | }, 138 | { 139 | "icon": "", 140 | "text": "face5" 141 | }, 142 | { 143 | "icon": "", 144 | "text": "face6" 145 | }, 146 | { 147 | "icon": "", 148 | "text": "face7" 149 | }, 150 | { 151 | "icon": "", 152 | "text": "face8" 153 | }, 154 | { 155 | "icon": "", 156 | "text": "face9" 157 | }, 158 | { 159 | "icon": "", 160 | "text": "face10" 161 | }, 162 | { 163 | "icon": "", 164 | "text": "face11" 165 | }, 166 | { 167 | "icon": "", 168 | "text": "face12" 169 | } 170 | ] 171 | } 172 | } -------------------------------------------------------------------------------- /js/OwO.min.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | (() => { 3 | class OwO { 4 | constructor(option) { 5 | const defaultOption = { 6 | logo: 'OwO表情', 7 | container: document.getElementsByClassName('OwO')[0], 8 | target: document.getElementsByTagName('textarea')[0], 9 | position: 'down', 10 | width: '100%', 11 | maxHeight: '235px', 12 | api: 'https://api.anotherhome.net/OwO/OwO.json' 13 | }; 14 | for (let defaultKey in defaultOption) { 15 | if (defaultOption.hasOwnProperty(defaultKey) && !option.hasOwnProperty(defaultKey)) { 16 | option[defaultKey] = defaultOption[defaultKey]; 17 | } 18 | } 19 | this.container = option.container; 20 | this.target = option.target; 21 | if (option.position === 'up') { 22 | this.container.classList.add('OwO-up'); 23 | } 24 | 25 | const xhr = new XMLHttpRequest(); 26 | xhr.onreadystatechange = () => { 27 | if (xhr.readyState === 4) { 28 | if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) { 29 | this.odata = JSON.parse(xhr.responseText); 30 | this.init(option); 31 | } 32 | else { 33 | console.log('OwO data request was unsuccessful: ' + xhr.status); 34 | } 35 | } 36 | }; 37 | xhr.open('get', option.api, true); 38 | xhr.send(null); 39 | } 40 | 41 | init(option) { 42 | this.area = option.target; 43 | this.packages = Object.keys(this.odata); 44 | 45 | // fill in HTML 46 | let html = ` 47 | 48 |
OwO表情
`; 49 | 50 | for (let i = 0; i < this.packages.length; i++) { 51 | 52 | html += ` 53 |
    `; 54 | 55 | let opackage = this.odata[this.packages[i]].container; 56 | for (let i = 0; i < opackage.length; i++) { 57 | 58 | html += ` 59 |
  • ${opackage[i].icon}
  • `; 60 | 61 | } 62 | 63 | html += ` 64 |
`; 65 | } 66 | 67 | html += ` 68 |
69 |
    `; 70 | 71 | for (let i = 0; i < this.packages.length; i++) { 72 | 73 | html += ` 74 |
  • ${this.packages[i]}
  • ` 75 | 76 | } 77 | 78 | html += ` 79 |
80 |
81 |
82 | `; 83 | this.container.innerHTML = html; 84 | 85 | // bind event 86 | this.logo = this.container.getElementsByClassName('OwO-logo')[0]; 87 | this.logo.addEventListener('click', () => { 88 | this.toggle(); 89 | }); 90 | 91 | this.container.getElementsByClassName('OwO-body')[0].addEventListener('click', (e)=> { 92 | let target = null; 93 | if (e.target.classList.contains('OwO-item')) { 94 | target = e.target; 95 | } 96 | else if (e.target.parentNode.classList.contains('OwO-item')) { 97 | target = e.target.parentNode; 98 | } 99 | if (target) { 100 | const cursorPos = this.area.selectionEnd; 101 | let areaValue = this.area.value; 102 | this.area.value = areaValue.slice(0, cursorPos) + target.innerHTML + areaValue.slice(cursorPos); 103 | this.area.focus(); 104 | this.toggle(); 105 | } 106 | }); 107 | 108 | this.packagesEle = this.container.getElementsByClassName('OwO-packages')[0]; 109 | for (let i = 0; i < this.packagesEle.children.length; i++) { 110 | ((index) =>{ 111 | this.packagesEle.children[i].addEventListener('click', () => { 112 | this.tab(index); 113 | }); 114 | })(i); 115 | } 116 | 117 | this.tab(0); 118 | } 119 | 120 | toggle() { 121 | if (this.container.classList.contains('OwO-open')) { 122 | this.container.classList.remove('OwO-open'); 123 | } 124 | else { 125 | this.container.classList.add('OwO-open'); 126 | } 127 | } 128 | 129 | tab(index) { 130 | const itemsShow = this.container.getElementsByClassName('OwO-items-show')[0]; 131 | if (itemsShow) { 132 | itemsShow.classList.remove('OwO-items-show'); 133 | } 134 | this.container.getElementsByClassName('OwO-items')[index].classList.add('OwO-items-show'); 135 | 136 | const packageActive = this.container.getElementsByClassName('OwO-package-active')[0]; 137 | if (packageActive) { 138 | packageActive.classList.remove('OwO-package-active'); 139 | } 140 | this.packagesEle.getElementsByTagName('li')[index].classList.add('OwO-package-active'); 141 | } 142 | } 143 | if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { 144 | module.exports = OwO; 145 | } 146 | else { 147 | window.OwO = OwO; 148 | } 149 | })(); -------------------------------------------------------------------------------- /say.php: -------------------------------------------------------------------------------- 1 | options->CDNURL; 3 | $GLOBALS['timechoice'] = $this->options->langis; 4 | function threadedComments($comments, $options) { 5 | $commentClass = ''; 6 | if ($comments->authorId) { 7 | if ($comments->authorId == $comments->ownerId) { 8 | $commentClass .= ' comment-by-author'; //如果是文章作者的评论添加 .comment-by-author 样式 9 | } else { 10 | $commentClass .= ' comment-by-user'; //如果是评论作者的添加 .comment-by-user 样式 11 | } 12 | } 13 | $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级 14 | ?> 15 | 16 | 17 |
27 | commentsAvatarRating; 33 | $hash = md5(strtolower($comments->mail)); 34 | $avatar = $host . $url . $hash . '?s=' . $size . '&r=' . $rating . '&d='; 35 | ?> 36 | 37 | 38 | 39 | 40 | 41 |
42 |
43 | author(); ?> 44 | 45 | date("F jS, Y \a\t h:i a"); ?>date('Y 年 m 月 d 日 h 时 i 分 A'); ?>date('Y 年 m 月 d 日 h 时 i 分 A'); ?> 46 | 47 |
48 |
49 |
content(); ?>
50 |
51 |
52 | 53 | 54 |
55 | 56 | 57 |
58 | 59 | allow('comment')): ?> 60 | 61 | user->hasLogin()): ?> 62 |
63 | 64 |
65 |
66 | 67 | 68 | 69 | 80 |
81 |
82 |
83 | 84 | 85 | 86 | 87 |

此处评论已关闭

88 | 89 | comments()->to($comments); ?> 90 | have()): ?> 91 |
92 | 93 | 94 | listComments(); ?> 95 |
96 | 99 | 105 | 106 |
107 |
    108 |
    109 | 110 | 111 | 112 | 113 | 114 |
    115 |
    116 | user->screenName(); ?> 117 | options->langis() == '0'): ?>options->timezone - idate("Z"))); ?>options->langis == '1'): ?>options->timezone - idate("Z"))); ?>options->langis == '2'): ?>options->timezone - idate("Z"))); ?> 118 |
    119 |
    120 |

    欢迎你来到「时光机」栏目。在这里你可以记录你的日常和心情。而且,首页的“闲言碎语”栏目会显示最新的三条动态哦!这是默认的第一条说说,当你发布第一条说说的时候,该条动态会自动消失。

    121 |
    122 |
    123 |
    124 |
125 |
126 | 127 | 128 |
-------------------------------------------------------------------------------- /booklist.php: -------------------------------------------------------------------------------- 1 | 8 | 9 | need('header.php'); ?> 10 | 11 | 12 | need('aside.php'); ?> 13 | 14 | 15 | fields->doubanID; //这里修改为你的豆瓣ID (ps:并非昵称) 17 | $url = "https://api.douban.com/v2/book/user/$userID/collections?count=100"; //最多取100条数据 18 | $res=json_decode(file_get_contents($url),true); //读取api得到json 19 | $res = $res['collections']; 20 | foreach($res as $v){ 21 | //已经读过的书 22 | if($v['status']=="read"){ 23 | $book_name=$v['book']['title']; 24 | $book_img = $v['book']['images']['medium']; 25 | $book_url = $v['book']['alt']; 26 | $readlist[] = array("name"=>$book_name,"img"=>$book_img,"url"=>$book_url); 27 | }elseif($v['status']=="reading"){ 28 | //正在读的书 29 | $book_name=$v['book']['title']; 30 | $book_img = $v['book']['images']['medium']; 31 | $book_url = $v['book']['alt']; 32 | $readinglist[] = array("name"=>$book_name,"img"=>$book_img,"url"=>$book_url); 33 | }elseif($v['status']=="wish"){ 34 | //想读的书 35 | $book_name=$v['book']['title']; 36 | $book_img = $v['book']['images']['medium']; 37 | $book_url = $v['book']['alt']; 38 | $wishlist[] = array("name"=>$book_name,"img"=>$book_img,"url"=>$book_url); 39 | } 40 | } 41 | ?> 42 | 43 |
44 | 45 |
46 |
47 | 48 |
49 | 50 |
51 |

title() ?> 52 | user->hasLogin()):?> 53 | 54 | 55 |

56 |
57 |
58 | 62 | 63 |
64 |
65 | 66 | options->indexsetup) && in_array('NoRandomPic-post', $this->options->indexsetup)) || $this->fields->thumb == "no"): ?> 67 | 68 | 69 | 70 | 71 |
72 |
73 |
74 |

我的书单

75 |
76 |

正在读的书

77 |
    78 | 79 |
  • 80 |
    81 |
    82 |

    83 |
  • 84 | 85 |
86 |
87 |
88 |

已读的书

89 |
    90 | 91 |
  • 92 |
    93 |
    94 |

    95 |
  • 96 | 97 |
98 |
99 |
100 |

想读的书

101 |
    102 | 103 |
  • 104 |
    105 |
    106 |

    107 |
  • 108 | 109 |
110 |
111 |
112 | 113 |
114 |
115 |
116 |
117 | 118 | need('comments.php') ?> 119 |
120 |
121 | 122 | need('sidebar.php')?> 123 | 124 |
125 |
126 |
127 | 128 | 142 | 143 | 144 | need('footer.php'); ?> 145 | -------------------------------------------------------------------------------- /cross.php: -------------------------------------------------------------------------------- 1 | need('header.php'); 9 | ?> 10 | 11 | 12 | need('aside.php'); ?> 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 |
25 |
26 | 27 | 28 | 29 |
30 |
31 | options->BlogName() ?> 32 | options->BlogJob() ?> 33 |
34 |

35 | options->socialtwitter): ?> 36 | 37 | 38 | options->socialfacebook): ?> 39 | 40 | 41 | options->socialgooglepluse): ?> 42 | 43 | 44 |

45 | options->socialgithub): ?> 46 | Follow 47 | 48 |
49 |
50 | 67 |
68 |
69 |
70 | 75 |
76 | need('say.php') ?> 77 |
78 |
79 |
80 |
81 |
82 |

options->langis == '0'): ?>Contact informationoptions->langis == '1'): ?>联系方式options->langis == '2'): ?>聯繫方式

83 |
    84 |
  • 85 | 86 | 87 | 88 | 89 |
    90 | 91 | options->socialemail): ?>options->socialemail() ?>外观设置——输入email地址 92 |
    93 |
  • 94 |
  • 95 | 96 | 97 | 98 | 99 |
    100 | 101 | options->socialqq): ?>options->socialqq() ?>外观设置——输入QQ号码 102 |
    103 |
  • 104 |
  • 105 | 106 | 107 | 108 | 109 |
    110 | 111 | options->socialweibo): ?>options->socialweibo() ?>外观设置——输入微博ID 112 |
    113 |
  • 114 |
  • 115 | 116 | 117 | 118 | 119 |
    120 | 121 | options->socialmusic): ?>options->socialmusic() ?>外观设置——输入网易云音乐ID 122 |
    123 |
  • 124 |
125 |
126 |
127 |

options->langis == '0'): ?>About meoptions->langis == '1'): ?>关于我options->langis == '2'): ?>關於我

128 |
    129 |
  • 130 |

    options->about() ?>

    131 | 132 |
  • 133 |
134 |
135 |
136 |
137 |
138 | 139 | 140 |
141 |
142 | 143 | 144 | 145 | need('footer.php'); ?> 146 | -------------------------------------------------------------------------------- /插件/Links/manage-links.php: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 |
9 |
10 | 11 |
12 | 19 | 20 |
21 | getPrefix(); 23 | $links = $db->fetchAll($db->select()->from($prefix.'links')->order($prefix.'links.order', Typecho_Db::SORT_ASC)); 24 | ?> 25 |
26 |
27 |
28 | 29 |
30 | 31 | 34 |
35 |
36 |
37 | 38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 63 | 64 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 |
62 | '.$link['name'].''; 74 | } else { 75 | $options = Typecho_Widget::widget('Widget_Options'); 76 | $nopic_url = Typecho_Common::url('/usr/plugins/Links/nopic.jpg', $options->siteUrl); 77 | echo 'NOPIC'; 78 | } 79 | ?>
89 |
90 |
91 |
92 |
93 | render(); ?> 94 |
95 |
96 |
97 |
98 | 99 | 103 | 104 | 151 | 152 | -------------------------------------------------------------------------------- /sidebar.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /comments.php: -------------------------------------------------------------------------------- 1 | options->CDNURL; 3 | $GLOBALS['timechoice'] = $this->options->langis; 4 | $GLOBALS['imgdelay'] = $this->options->themeUrl.'/img/white.gif'; 5 | $GLOBALS['isimgdelay'] = !empty($this->options->indexsetup) && in_array('lazyloadimg', $this->options->indexsetup); 6 | function threadedComments($comments, $options) { 7 | $commentClass = ''; 8 | if ($comments->authorId) { 9 | if ($comments->authorId == $comments->ownerId) { 10 | $commentClass .= ' comment-by-author'; //如果是文章作者的评论添加 .comment-by-author 样式 11 | } else { 12 | $commentClass .= ' comment-by-user'; //如果是评论作者的添加 .comment-by-user 样式 13 | } 14 | } 15 | $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级 16 | $depth = $comments->levels +1; //添加的一句 17 | if ($comments->url) { 18 | $author = '' . $comments->author . ''; 19 | } else { 20 | $author = $comments->author; 21 | } 22 | ?> 23 | 24 | 25 | 27 |
  • 42 |
    43 | commentsAvatarRating; 49 | $hash = md5(strtolower($comments->mail)); 50 | $avatar = $host . $url . $hash . '?s=' . $size . '&r=' . $rating . '&d='; 51 | ?> 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 | 62 | 63 | 64 | 68 |
    69 | 70 |
    71 | coid)?>content(); ?> 72 |
    73 | 74 |
    75 | reply(); ?> 76 |
    77 |
    78 | 79 |
    80 | 81 | children) { ?> 82 |
    83 | threadedComments($options); ?> 84 |
    85 | 86 |
  • 87 | 88 | 89 | 90 |
    91 | comments()->to($comments); ?> 92 | have()): ?> 93 |

    commentsNum(_t(' 暂无评论'), _t(' 1 条评论'), _t(' %d 条评论')); ?>

    94 | listComments(); ?> 95 | 98 | 105 | 106 | 107 | 108 | allow('comment')): ?> 109 |
    110 | 111 |

    发表评论 112 | 113 | cancelReply(); ?> 114 | 115 |

    116 |
    117 |
    118 | 120 | 121 |
    122 |
    123 | 124 | user->hasLogin()): ?> 125 |

    欢迎 user->screenName(); ?> 归来! 退出»

    126 | 127 | remember('author',true) != "" && $this->remember('mail',true) != "") : ?> 128 |

    欢迎 remember('author'); ?> 归来!

    129 |
    163 | 164 |

    此处评论已关闭

    165 | 166 |
    167 | -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
    4 | options->BottomleftInfo(); ?> 8 | © Copyright. 9 |
    10 |
    11 |
    12 | 13 | footer(); ?> 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 83 | 84 | 85 | 86 | is('single') & !($this->is('page','cross'))): ?> 87 | allow('comment')): ?> 88 | 147 | 148 | 162 | 163 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | options->indexsetup) && in_array('lazyloadimg', $this->options->indexsetup)): ?> 191 | 192 | 198 | 199 | 200 | 201 | 202 | options->indexsetup) && in_array('musicplayer', $this->options->indexsetup)): ?> 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | -------------------------------------------------------------------------------- /插件/Links/Plugin.php: -------------------------------------------------------------------------------- 1 | contentEx = array('Links_Plugin', 'parse'); 58 | Typecho_Plugin::factory('Widget_Abstract_Contents')->excerptEx = array('Links_Plugin', 'parse'); 59 | Typecho_Plugin::factory('Widget_Abstract_Comments')->contentEx = array('Links_Plugin', 'parse'); 60 | return _t($info); 61 | } 62 | 63 | /** 64 | * 禁用插件方法,如果禁用失败,直接抛出异常 65 | * 66 | * @static 67 | * @access public 68 | * @return void 69 | * @throws Typecho_Plugin_Exception 70 | */ 71 | public static function deactivate() 72 | { 73 | Helper::removeAction('links-edit'); 74 | Helper::removePanel(3, 'Links/manage-links.php'); 75 | } 76 | 77 | /** 78 | * 获取插件配置面板 79 | * 80 | * @access public 81 | * @param Typecho_Widget_Helper_Form $form 配置面板 82 | * @return void 83 | */ 84 | public static function config(Typecho_Widget_Helper_Form $form) {} 85 | 86 | /** 87 | * 个人用户的配置面板 88 | * 89 | * @access public 90 | * @param Typecho_Widget_Helper_Form $form 91 | * @return void 92 | */ 93 | public static function personalConfig(Typecho_Widget_Helper_Form $form) {} 94 | 95 | public static function linksInstall() 96 | { 97 | $installDb = Typecho_Db::get(); 98 | $type = explode('_', $installDb->getAdapterName()); 99 | $type = array_pop($type); 100 | $prefix = $installDb->getPrefix(); 101 | $scripts = file_get_contents('usr/plugins/Links/'.$type.'.sql'); 102 | $scripts = str_replace('typecho_', $prefix, $scripts); 103 | $scripts = str_replace('%charset%', 'utf8', $scripts); 104 | $scripts = explode(';', $scripts); 105 | try { 106 | foreach ($scripts as $script) { 107 | $script = trim($script); 108 | if ($script) { 109 | $installDb->query($script, Typecho_Db::WRITE); 110 | } 111 | } 112 | return '建立友情链接数据表,插件启用成功'; 113 | } catch (Typecho_Db_Exception $e) { 114 | $code = $e->getCode(); 115 | if(('Mysql' == $type && 1050 == $code) || 116 | ('SQLite' == $type && ('HY000' == $code || 1 == $code))) { 117 | try { 118 | $script = 'SELECT `lid`, `name`, `url`, `sort`, `image`, `description`, `user`, `order` from `' . $prefix . 'links`'; 119 | $installDb->query($script, Typecho_Db::READ); 120 | return '检测到友情链接数据表,友情链接插件启用成功'; 121 | } catch (Typecho_Db_Exception $e) { 122 | $code = $e->getCode(); 123 | if(('Mysql' == $type && 1054 == $code) || 124 | ('SQLite' == $type && ('HY000' == $code || 1 == $code))) { 125 | return Links_Plugin::linksUpdate($installDb, $type, $prefix); 126 | } 127 | throw new Typecho_Plugin_Exception('数据表检测失败,友情链接插件启用失败。错误号:'.$code); 128 | } 129 | } else { 130 | throw new Typecho_Plugin_Exception('数据表建立失败,友情链接插件启用失败。错误号:'.$code); 131 | } 132 | } 133 | } 134 | 135 | public static function linksUpdate($installDb, $type, $prefix) 136 | { 137 | $scripts = file_get_contents('usr/plugins/Links/Update_'.$type.'.sql'); 138 | $scripts = str_replace('typecho_', $prefix, $scripts); 139 | $scripts = str_replace('%charset%', 'utf8', $scripts); 140 | $scripts = explode(';', $scripts); 141 | try { 142 | foreach ($scripts as $script) { 143 | $script = trim($script); 144 | if ($script) { 145 | $installDb->query($script, Typecho_Db::WRITE); 146 | } 147 | } 148 | return '检测到旧版本友情链接数据表,升级成功'; 149 | } catch (Typecho_Db_Exception $e) { 150 | $code = $e->getCode(); 151 | if(('Mysql' == $type && 1060 == $code) ) { 152 | return '友情链接数据表已经存在,插件启用成功'; 153 | } 154 | throw new Typecho_Plugin_Exception('友情链接插件启用失败。错误号:'.$code); 155 | } 156 | } 157 | 158 | public static function form($action = NULL) 159 | { 160 | /** 构建表格 */ 161 | $options = Typecho_Widget::widget('Widget_Options'); 162 | $form = new Typecho_Widget_Helper_Form(Typecho_Common::url('/action/links-edit', $options->index), 163 | Typecho_Widget_Helper_Form::POST_METHOD); 164 | 165 | /** 链接名称 */ 166 | $name = new Typecho_Widget_Helper_Form_Element_Text('name', NULL, NULL, _t('链接名称*')); 167 | $form->addInput($name); 168 | 169 | /** 链接地址 */ 170 | $url = new Typecho_Widget_Helper_Form_Element_Text('url', NULL, "http://", _t('链接地址*')); 171 | $form->addInput($url); 172 | 173 | /** 链接分类 */ 174 | $sort = new Typecho_Widget_Helper_Form_Element_Text('sort', NULL, NULL, _t('链接分类'), _t('建议以英文字母开头,只包含字母与数字')); 175 | $form->addInput($sort); 176 | 177 | /** 链接图片 */ 178 | $image = new Typecho_Widget_Helper_Form_Element_Text('image', NULL, NULL, _t('链接图片'), _t('需要以http://开头,留空表示没有链接图片')); 179 | $form->addInput($image); 180 | 181 | /** 链接描述 */ 182 | $description = new Typecho_Widget_Helper_Form_Element_Textarea('description', NULL, NULL, _t('链接描述')); 183 | $form->addInput($description); 184 | 185 | /** 自定义数据 */ 186 | $user = new Typecho_Widget_Helper_Form_Element_Text('user', NULL, NULL, _t('自定义数据'), _t('该项用于用户自定义数据扩展')); 187 | 188 | $form->addInput($user); 189 | 190 | /** 链接动作 */ 191 | $do = new Typecho_Widget_Helper_Form_Element_Hidden('do'); 192 | $form->addInput($do); 193 | 194 | /** 链接主键 */ 195 | $lid = new Typecho_Widget_Helper_Form_Element_Hidden('lid'); 196 | $form->addInput($lid); 197 | 198 | /** 提交按钮 */ 199 | $submit = new Typecho_Widget_Helper_Form_Element_Submit(); 200 | $submit->input->setAttribute('class', 'btn primary'); 201 | $form->addItem($submit); 202 | $request = Typecho_Request::getInstance(); 203 | 204 | if (isset($request->lid) && 'insert' != $action) { 205 | /** 更新模式 */ 206 | $db = Typecho_Db::get(); 207 | $prefix = $db->getPrefix(); 208 | $link = $db->fetchRow($db->select()->from($prefix.'links')->where('lid = ?', $request->lid)); 209 | if (!$link) { 210 | throw new Typecho_Widget_Exception(_t('链接不存在'), 404); 211 | } 212 | 213 | $name->value($link['name']); 214 | $url->value($link['url']); 215 | $sort->value($link['sort']); 216 | $image->value($link['image']); 217 | $description->value($link['description']); 218 | $user->value($link['user']); 219 | $do->value('update'); 220 | $lid->value($link['lid']); 221 | $submit->value(_t('编辑链接')); 222 | $_action = 'update'; 223 | 224 | 225 | } else { 226 | $do->value('insert'); 227 | $submit->value(_t('增加链接')); 228 | $_action = 'insert'; 229 | } 230 | 231 | if (empty($action)) { 232 | $action = $_action; 233 | } 234 | 235 | /** 给表单增加规则 */ 236 | if ('insert' == $action || 'update' == $action) { 237 | $name->addRule('required', _t('必须填写链接名称')); 238 | $url->addRule('required', _t('必须填写链接地址')); 239 | $url->addRule('url', _t('不是一个合法的链接地址')); 240 | $image->addRule('url', _t('不是一个合法的图片地址')); 241 | } 242 | if ('update' == $action) { 243 | $lid->addRule('required', _t('链接主键不存在')); 244 | $lid->addRule(array(new Links_Plugin, 'LinkExists'), _t('链接不存在')); 245 | } 246 | return $form; 247 | } 248 | 249 | public static function LinkExists($lid) 250 | { 251 | $db = Typecho_Db::get(); 252 | $prefix = $db->getPrefix(); 253 | $link = $db->fetchRow($db->select()->from($prefix.'links')->where('lid = ?', $lid)->limit(1)); 254 | return $link ? true : false; 255 | } 256 | 257 | /** 258 | * 控制输出格式 259 | */ 260 | public static function output_str($pattern=NULL, $links_num=0, $sort=NULL) 261 | { 262 | $options = Typecho_Widget::widget('Widget_Options'); 263 | if (!isset($options->plugins['activated']['Links'])) { 264 | return '友情链接插件未激活'; 265 | } 266 | if (!isset($pattern) || $pattern == "" || $pattern == NULL || $pattern == "SHOW_TEXT") { 267 | $pattern = "
  • {name}
  • \n"; 268 | } else if ($pattern == "SHOW_IMG") { 269 | $pattern = "
  • \"{name}\"
  • \n"; 270 | } else if ($pattern == "SHOW_MIX") { 271 | $pattern = "
  • \"{name}\"{name}
  • \n"; 272 | } 273 | $db = Typecho_Db::get(); 274 | $prefix = $db->getPrefix(); 275 | $options = Typecho_Widget::widget('Widget_Options'); 276 | $nopic_url = Typecho_Common::url('/usr/plugins/Links/nopic.jpg', $options->siteUrl); 277 | $sql = $db->select()->from($prefix.'links'); 278 | if (!isset($sort) || $sort == "") { 279 | $sort = NULL; 280 | } 281 | if ($sort) { 282 | $sql = $sql->where('sort=?', $sort); 283 | } 284 | $sql = $sql->order($prefix.'links.order', Typecho_Db::SORT_ASC); 285 | $links_num = intval($links_num); 286 | if ($links_num > 0) { 287 | $sql = $sql->limit($links_num); 288 | } 289 | $links = $db->fetchAll($sql); 290 | $str = ""; 291 | 292 | 293 | $host = 'https://secure.gravatar.com';//自定义头像CDN服务器 294 | $url = '/avatar/';//自定义头像目录,一般保持默认即可 295 | $size = '80';//自定义头像大小 296 | foreach ($links as $link) { 297 | $hash = md5(strtolower($link['user'])); 298 | $link['user'] = $host . $url . $hash . '?s=' . $size . '&d='; 299 | if ($link['image'] == NULL) { 300 | $link['image'] = $nopic_url; 301 | } 302 | 303 | $str .= str_replace( 304 | array('{lid}', '{name}', '{url}', '{sort}', '{title}', '{description}', '{image}', '{user}'), 305 | array($link['lid'], $link['name'], $link['url'], $link['sort'], $link['description'], $link['description'], $link['image'], $link['user']), 306 | $pattern 307 | ); 308 | 309 | } 310 | return $str; 311 | } 312 | 313 | //输出 314 | public static function output($pattern=NULL, $links_num=0, $sort=NULL) 315 | { 316 | echo Links_Plugin::output_str($pattern, $links_num, $sort); 317 | } 318 | 319 | /** 320 | * 解析 321 | * 322 | * @access public 323 | * @param array $matches 解析值 324 | * @return string 325 | */ 326 | public static function parseCallback($matches) 327 | { 328 | $db = Typecho_Db::get(); 329 | $pattern = $matches[3]; 330 | $links_num = $matches[1]; 331 | $sort = $matches[2]; 332 | return Links_Plugin::output_str($pattern, $links_num, $sort); 333 | } 334 | 335 | public static function parse($text, $widget, $lastResult) 336 | { 337 | $text = empty($lastResult) ? $text : $lastResult; 338 | 339 | if ($widget instanceof Widget_Archive || $widget instanceof Widget_Abstract_Comments) { 340 | return preg_replace_callback("/\s*(.*?)\s*<\/links>/is", array('Links_Plugin', 'parseCallback'), $text); 341 | } else { 342 | return $text; 343 | } 344 | } 345 | } 346 | -------------------------------------------------------------------------------- /aside.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | options->themetype =='0' ) : ?> 4 |