Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
这个主题的第一个版本
  • Loading branch information
Dreamer-Paul committed Oct 19, 2018
0 parents commit b7def73
Show file tree
Hide file tree
Showing 19 changed files with 2,569 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### 1. 该问题的重现步骤是什么?

### 2. 正常情况下应该是什么结果,你看到的呢?

### 3. 服务器的运行环境是?

- 操作系统版本:
- Apache/Nginx 版本:
- PHP 版本:
- 主题版本:
- 浏览器版本:

[//]: # (如有图片请附上截图)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (C) 2018 Dreamer-Paul

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Fantasy
一个优美梦幻的动漫风 Typecho 博客主题。基于动漫 “Slow Start” 官网的设计风格编写而成。

## 使用方法
1. Star 本项目
2. Clone 本项目
3. 上传本主题,并放置在 `usr/themes/` 目录下
4. 登录你的 Typecho 后台,并进行安装即可食用~

## 项目故事
详见我的博文:[Fantasy 动漫风主题](https://paugram.com/coding/fantasy-theme.html)

## 开源协议
本项目采用 MIT 开源协议进行授权,并在其基础上须保留原作者的版权注释(包括但不限于 CSS、JS 等文件),当然能在页尾写上主题地址就是最好的啦~

原创不易!如果喜欢本项目,请 Star 它以示对我的支持~

同时欢迎前往 [我的博客](https://paugram.com/about.html#donate) 为我提供赞助,谢谢您!

## 使用的开源项目
- [Kico Style](https://github.com/Dreamer-Paul/Kico-Style)
- [Font Awesome](https://github.com/FortAwesome/Font-Awesome)
35 changes: 35 additions & 0 deletions archive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

if (!defined('__TYPECHO_ROOT_DIR__')) exit;

$this->need('header.php');

?>
<main>
<div class="wrap min">
<section class="board">
<div class="post-head">
<h3><?php $this->archiveTitle(array(
'category' => _t('“%s”'),
'search' => _t('“%s”的搜索结果'),
'tag' => _t('含标签“%s”的文章'),
'author' => _t('“%s”发布的文章')
), '', ''); ?></h3>
<?php if ($this->is('category')) : ?><p><?php echo $this->getDescription(); ?></p><?php endif; ?>
</div>
<?php if ($this->have()): ?>
<?php while($this->next()): ?>
<div class="post-item">
<time class="date"><?php $this->date(); ?></time>
<h3 class="title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></h3>
</div>
<?php endwhile; ?>
<?php else: ?>
<p>没有找到结果 (QWQ)</p>
<?php endif; ?>
</section>
<?php $this->pageNav('', ''); ?>
</div>
</main>

<?php $this->need('footer.php'); ?>
67 changes: 67 additions & 0 deletions comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php function threadedComments($comments, $options) {
$commentClass = '';
if ($comments->authorId) {
if ($comments->authorId == $comments->ownerId) {
$commentClass .= ' comment-by-author';
} else {
$commentClass .= ' comment-by-user';
}
}

$commentLevelClass = $comments->levels > 0 ? ' comment-child' : ' comment-parent';
?>

<div class="comment-item" id="<?php $comments->theId(); ?>">
<?php $comments->gravatar('150', 'wavatar'); ?>
<div class="content">
<div class="comment-meta">
<span class="comment-author"><?php $comments->author(); ?></span>
<time class="comment-time"><?php $comments->date(); ?></time>
<span class="comment-reply"><?php $comments->reply(); ?></span>
</div>
<?php $comments->content(); ?>
</div>
<?php if ($comments->children) { ?>
<div class="comment-children">
<?php $comments->threadedComments($options); ?>
</div>
<?php } ?>
</div>
<?php } ?>

<?php if($this->allow('comment')): ?>
<section class="board">
<h3>参与讨论</h3>
<?php $this->comments()->to($comments); ?>
<div id="<?php $this->respondId(); ?>">
<form class="comment-form" id="<?php $this->respondId(); ?>" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
<div class="cancel-reply"><?php $comments->cancelReply(); ?></div>
<figure class="comment-avatar">
<?php if($this->user->hasLogin()): ?>
<img src="<?php echo Typecho_Common::gravatarUrl($this->user->mail, 150, 'X', 'mm', true) ?>"/>
<?php else: ?>
<img src="<?php $this->options->themeUrl('static/img/avatar.jpg'); ?>"/>
<?php endif; ?>
</figure>
<fieldset>
<textarea rows="2" name="text" placeholder="说下感想吧!" required><?php $this->remember('text'); ?></textarea>
<?php if(!$this->user->hasLogin()): ?>
<input type="text" name="author" placeholder="昵称 *:" value="<?php $this->remember('author'); ?>" required="">
<input type="email" name="mail" placeholder="电邮 *:" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?>>
<input type="url" name="url" placeholder="http://" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?>>
<?php else: ?>
<p class="logined"><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>,欢迎回来!不是你?<a href="<?php $this->options->logoutUrl(); ?>" title="登出">登出</a></p>
<?php endif; ?>
<button class="btn submit" type="submit"></button>
</fieldset>
</form>
</div>
<?php if ($comments->have()): ?>
<?php $comments->listComments(array('before' => '<div class="comment-list">', 'after' => '</div>')); ?>
<?php $comments->pageNav('', ''); ?>
<?php else: ?>
<p class="no-comment">还没有评论呢!</p>
<?php endif; ?>
<?php endif; ?>
</section>
41 changes: 41 additions & 0 deletions footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
</main>
<footer>
<section class="foot-widget">
<div class="wrap min">
<div class="row">
<div class="col-m-4">
<h3>最新文章:</h3>
<ul>
<?php $this -> widget('Widget_Contents_Post_Recent', 'pageSize=6') -> parse('<li><a href="{permalink}" target="_blank">{title}</a></li>'); ?>
</ul>
</div>
<div class="col-m-4">
<h3>时光机:</h3>
<ul>
<?php $this -> widget('Widget_Contents_Post_Date', 'type=month&format=Y 年 m 月&limit=6') -> parse('<li><a href="{permalink}" rel="nofollow" target="_blank">{date}</a></li>'); ?>
</ul>
</div>
<div class="col-m-4">
<h3>最近评论:</h3>
<ul>
<?php $this -> widget('Widget_Comments_Recent', 'pageSize=6') -> to($comments); ?>
<?php while($comments -> next()): ?>
<li><?php $comments -> author(false); ?>: <a href="<?php $comments -> permalink(); ?>" rel="nofollow" target="_blank"><?php $comments -> excerpt(10, '...'); ?></a></li>
<?php endwhile; ?>
</ul>
</div>
</div>
</div>
</section>
<section class="foot-copyright">
<p>&copy; <?php echo date('Y') ?> <a href="<?php $this -> options -> siteUrl() ?>"><?php $this->options->title(); ?></a>. All Rights Reserved. Theme By <a href="https://github.com/Dreamer-Paul/Fantasy" target="_blank" rel="nofollow">Fantasy</a>.</p>
</section>
</footer>

<script src="<?php $this->options->themeUrl('static/kico.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('static/fantasy.js'); ?>"></script>
<?php $this -> options -> custom_script() ?>
<?php $this -> footer() ?>

</body>
</html>
55 changes: 55 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;

function themeConfig($form) {

// 插件信息与更新检测
function paul_update($name, $version){
echo "<style>.paul-info{text-align:center; margin:1em 0;} .paul-info > *{margin:0 0 1rem} .buttons a{background:#467b96; color:#fff; border-radius:4px; padding:.5em .75em; display:inline-block}</style>";
echo "<div class='paul-info'>";
echo "<h2>Fantasy 主题 (".$version.")</h2>";
echo "<p>By: <a href='https://github.com/Dreamer-Paul'>Dreamer-Paul</a></p>";
echo "<p class='buttons'><a href='https://paugram.com/coding/fantasy-theme.html'>项目介绍</a>
<a href='https://github.com/Dreamer-Paul/Fantasy/releases'>更新日志</a></p>";

$update = file_get_contents("https://api.paugram.com/update/?name=".$name."&current=".$version."&site=".$_SERVER['HTTP_HOST']);
$update = json_decode($update, true);

if(isset($update['text'])){echo "<p>".$update['text']."</p>"; };
if(isset($update['message'])){echo "<p>".$update['message']."</p>"; };

echo "</div>";
}
paul_update("Fantasy", "1.0");

// 自定义站点图标
$favicon = new Typecho_Widget_Helper_Form_Element_Text('favicon', NULL, NULL, _t('站点图标'), _t('在这里填入一张 png 图片地址(<a>192x192px</a>),不填则使用默认图标'));
$form->addInput($favicon);

// 自定义社交链接
$home_social = new Typecho_Widget_Helper_Form_Element_Textarea('home_social', NULL, NULL, _t('自定义社交链接'), _t('在这里填入你的自定义社交链接,不填则不输出。(格式请看<a href="https://github.com/Dreamer-Paul/Single/releases/tag/1.1" target="_blank">帮助信息</a>)'));
$form->addInput($home_social);

// 自定义样式表
$custom_css = new Typecho_Widget_Helper_Form_Element_Textarea('custom_css', NULL, NULL, _t('自定义样式表'), _t('在这里填入你的自定义样式表,不填则不输出。'));
$form->addInput($custom_css);

// 自定义统计代码
$custom_script = new Typecho_Widget_Helper_Form_Element_Textarea('custom_script', NULL, NULL, _t('统计代码'), _t('在这里填入你的统计代码,不填则不输出。需要 <a>&lt;script&gt;</a> 标签。'));
$form->addInput($custom_script);
}

function themeInit($archive){

// AJAX 头像
if(isset($_GET['action']) && $_GET['action'] == 'gravatar' && $_GET['email']){
$host = 'https://secure.gravatar.com/avatar/';
$email = strtolower($_GET['email']);
$hash = md5($email);

$reply = $host . $hash . '?d=robohash';

header("location: $reply");
die();
}
}
55 changes: 55 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="zh-cmn-hans">
<head>
<meta charset="UTF-8">
<title><?php $this->archiveTitle(array(
'category' => _t('%s'),
'search' => _t('含关键词 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
), '', ' - '); $this->options->title(); ?></title>
<?php if ($this->options->favicon): ?>
<link rel="icon" href="<?php $this->options->favicon() ?>" sizes="192x192"/>
<?php else: ?>
<link rel="icon" href="<?php $this->options->themeUrl('static/img/icon.png'); ?>" sizes="192x192"/>
<?php endif; ?>
<link href="<?php $this->options->themeUrl('static/kico.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="<?php $this->options->themeUrl('static/fantasy.css'); ?>" rel="stylesheet" type="text/css"/>
<link href="https://cdn.jsdelivr.net/gh/FortAwesome/Font-Awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1"/>
<?php $this->header('pingback=&xmlrpc=&wlw='); ?>
<?php if ($this->options->custom_css): ?>
<style><?php $this->options->custom_css() ?></style>
<?php endif; ?>
</head>
<body>
<aside>
<nav class="side-nav">
<a href="<?php $this->options->siteUrl() ?>">首页</a>
<?php $this->widget('Widget_Contents_Page_List')->parse('<a href="{permalink}">{title}</a>'); ?>
</nav>
<nav class="side-action">
<div class="search-btn"></div>
</nav>
<div class="side-window">
<div class="side-wrap">
<form class="search-form" method="post">
<input type="text" name="s" placeholder="搜索什么?">
</form>
<div class="side-category color-bar">
<?php $this->widget('Widget_Metas_Category_List')->parse('<a href="{permalink}">{name}</a>'); ?>
</div>
</div>
</div>
</aside>
<header>
<div class="toggle"></div>
<div class="wrap min">
<h1 class="headline"><span><?php $this->options->title() ?></span></h1>
<?php if ($this->options->home_social): ?>
<div class="head-social">
<?php $this->options->home_social() ?>
</div>
<?php endif; ?>
</div>
</header>
31 changes: 31 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* 一个优美梦幻的动漫风 Typecho 博客主题。
*
* @package Fantasy Theme
* @author Dreamer-Paul
* @version 1.0
* @link https://paugram.com
*/

if (!defined('__TYPECHO_ROOT_DIR__')) exit;

$this->need('header.php');

?>
<main>
<div class="wrap min">
<section class="board">
<?php while($this->next()): ?>
<div class="post-item">
<time class="date"><?php $this->date(); ?></time>
<h3 class="title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></h3>
</div>
<?php endwhile; ?>
</section>
<?php $this->pageNav('', ''); ?>
</div>
</main>

<?php $this->need('footer.php'); ?>
29 changes: 29 additions & 0 deletions page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

if (!defined('__TYPECHO_ROOT_DIR__')) exit;

$this->need('header.php');

?>
<main>
<div class="wrap min">
<section class="board">
<div class="post-title">
<h2><?php $this->title() ?></h2>
<?php if($this->authorId == $this->user->uid): ?>
<div class="post-meta">
<time class="date"><?php $this->date(); ?></time>
<span class="comments"><?php $this->commentsNum('%d 条评论'); ?></span>
<span class="edit"><a href="<?php $this->options->adminUrl(); ?>write-page.php?cid=<?php echo $this->cid;?>" target="_blank">编辑</a></span>
</div>
<?php endif; ?>
</div>
<article class="post-content">
<?php $this->content(); ?>
</article>
</section>
<?php $this->need('comments.php'); ?>
</div>
</main>

<?php $this->need('footer.php'); ?>
Loading

0 comments on commit b7def73

Please sign in to comment.