diff options
| -rw-r--r-- | file.php | 7 | ||||
| -rw-r--r-- | includes/comments.php | 29 | ||||
| -rw-r--r-- | includes/footer.php | 23 | ||||
| -rw-r--r-- | includes/head.php | 3 | ||||
| -rw-r--r-- | includes/sidebar.php | 2 | ||||
| -rw-r--r-- | includes/toolbar.php | 3 | ||||
| -rw-r--r-- | index.php | 2 | ||||
| -rw-r--r-- | links.php | 17 | ||||
| -rw-r--r-- | page.php | 9 | ||||
| -rw-r--r-- | post.php | 18 | ||||
| -rw-r--r-- | post/post-content.php | 70 | ||||
| -rw-r--r-- | post/post-excerpt.php | 62 | ||||
| -rw-r--r-- | post/post-item.php | 74 |
13 files changed, 259 insertions, 60 deletions
@@ -27,12 +27,7 @@ <?php endif; ?>
<div class="post-header">
- <h2><?php $this->title() ?></h4>
- <span>
- <i class="glyphicon glyphicon-time"></i> <?php $this->date('Y-m-d'); ?> /
- <i class="glyphicon glyphicon-bookmark"></i> <?php $this->category(',', true, '木有分类'); ?> /
- <i class="glyphicon glyphicon-comment"></i> <?php $this->commentsNum('%d'); ?>
- </span>
+ <h1 style="text-align:Center"><?php $this->title() ?></h1>
</div>
<hr />
diff --git a/includes/comments.php b/includes/comments.php index ee6e771..39d1a3f 100644 --- a/includes/comments.php +++ b/includes/comments.php @@ -64,7 +64,15 @@ <!-- 评论开始 -->
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<div id="comments" class="responsesWrapper">
-
+ <?php
+ $parameter = array(
+ 'parentId' => $this->hidden ? 0 : $this->cid,
+ 'parentContent' => $this->row,
+ 'respondId' => $this->respondId,
+ 'commentPage' => $this->request->filter('int')->commentPage,
+ 'allowComment' => $this->allow('comment')
+ );
+ ?>
<?php if($this->allow('comment')): ?>
<div id="<?php $this->respondId(); ?>" class="respond item">
<br />
@@ -93,15 +101,26 @@ </form>
</div>
<?php else: ?>
- <h3><?php _e('评论已关闭'); ?></h3>
+ <div class="item"><h3><?php _e('评论已关闭'); ?></h3></div>
<?php endif; ?>
<?php $this->comments()->to($comments); ?>
<?php if ($comments->have()): ?>
- <div class="comment-list-wrap">
- <?php $comments->listComments(); ?>
+ <!-- 解析评论内容 -->
+ <?php
+
+ ?>
+
+ <br />
+ <div class="item">
+ <h3 style="margin-top:-4px;text-align:center;">- <?php $this->commentsNum('评论列表', '已有 1 条评论', '已有 <span class="num">%d</span> 条评论'); ?> -</h3>
+ <hr style="margin:-10px;margin-top:0;" />
+ <div class="comment-list-wrap">
+ <?php $comments->listComments(); ?>
+ </div>
</div>
- <?php $comments->pageNav('« 前一页', '后一页 »'); ?>
+ <br />
+ <?php $comments->pageNav('«', '»'); ?>
<?php endif; ?>
</div>
\ No newline at end of file diff --git a/includes/footer.php b/includes/footer.php index 9c58b2e..2519bbe 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -1,3 +1,4 @@ +
<!-- 页脚信息 -->
<footer class="footer-info">
<div class="container">
@@ -25,28 +26,20 @@ </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 type="text/javascript" src="<?php $this->options->themeUrl('assets/pjax/jquery.pjax.js'); ?>"></script>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/nprogress.js'); ?>"></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
@@ -62,14 +55,12 @@ $(document).on('pjax:send',
function() {
$('#pjax-container').addClass("pjax-loading");
- $('.spinner').removeClass("unvisible");
- $('.viewport-cover').removeClass("unvisible-cover");
+ NProgress.start();
})
$(document).on('pjax:complete',
function() {
$('#pjax-container').removeClass("pjax-loading");
- $('.spinner').addClass("unvisible");
- $('.viewport-cover').addClass("unvisible-cover");
+ NProgress.done();
if (typeof Prism !== 'undefined') {
Prism.highlightAll(true,null);}
<?php $this->options->pjax_reload(); ?>
diff --git a/includes/head.php b/includes/head.php index 9e5fce7..c99961e 100644 --- a/includes/head.php +++ b/includes/head.php @@ -44,10 +44,11 @@ <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'); ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php $this->options->themeUrl('assets/css/nprogress.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>
+ <script type="text/javascript" src="<?php $this->options->themeUrl('assets/js/bootstrap.min.js'); ?>"></script>
<!-- 部分css -->
<style>
diff --git a/includes/sidebar.php b/includes/sidebar.php index 5e4f0f2..0c07b6f 100644 --- a/includes/sidebar.php +++ b/includes/sidebar.php @@ -89,7 +89,7 @@ <?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>
+ <a href="<?php $tags->permalink(); ?>" title="该标签下有 <?php $tags->count(); ?> 篇文章"><?php $tags->name(); ?></a>
<?php endwhile; ?>
<?php else: ?>
还没有任何标签哦~
diff --git a/includes/toolbar.php b/includes/toolbar.php index 91bddf4..3374e8f 100644 --- a/includes/toolbar.php +++ b/includes/toolbar.php @@ -1,8 +1,5 @@ <!-- 右侧工具栏 -->
<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; ?>
@@ -40,7 +40,7 @@ $this->need('includes/header.php'); <?php endif; ?>
<!-- 文章列表 -->
<?php while($this->next()): ?>
- <?php $this->need('includes/post-item.php'); ?>
+ <?php $this->need('post/post-item.php'); ?>
<?php endwhile; ?>
<div class="pagenav"><?php $this->pageNav('<i class="glyphicon glyphicon-hand-left"></i>', '<i class="glyphicon glyphicon-hand-right"></i>',4, '...'); ?></div>
@@ -22,21 +22,10 @@ $this->need('includes/header.php'); ?> <div class="media-banner" style="background-position:center center;background:url(<?php $this->fields->banner(); ?>);background-repeat:no-repeat;background-size:cover;"></div>
</div>
<?php endif; ?>
-
- <div class="post-header">
- <h2><?php $this->title() ?></h4>
- <span>
- <i class="glyphicon glyphicon-time"></i> <?php $this->date('Y-m-d'); ?> /
- <i class="glyphicon glyphicon-bookmark"></i> <?php $this->category(',', true, '木有分类'); ?> /
- <i class="glyphicon glyphicon-comment"></i> <?php $this->commentsNum('%d'); ?>
- </span>
- </div>
-
+ <h1 style="text-align:Center"><?php $this->title() ?></h1>
<hr />
-
<div class="links-box">
- <h2>友链墙</h2>
- <div class="row">
+ <div class="row" style="margin-top:20px;">
<?php Links_Plugin::output("SHOW_MIX"); ?>
</div>
</div>
@@ -44,7 +33,7 @@ $this->need('includes/header.php'); ?> <hr />
<div class="post-content">
- <?php $this->need('includes/post-content.php'); ?>
+ <?php $this->need('post/post-content.php'); ?>
</div>
</article>
@@ -20,18 +20,13 @@ <?php endif; ?>
<div class="post-header">
- <h2><?php $this->title() ?></h4>
- <span>
- <i class="glyphicon glyphicon-time"></i> <?php $this->date('Y-m-d'); ?> /
- <i class="glyphicon glyphicon-bookmark"></i> <?php $this->category(',', true, '木有分类'); ?> /
- <i class="glyphicon glyphicon-comment"></i> <?php $this->commentsNum('%d'); ?>
- </span>
+ <h1 style="text-align:Center"><?php $this->title() ?></h1>
</div>
<hr />
<div class="post-content page-content">
- <?php $this->need('includes/post-content.php'); ?>
+ <?php $this->need('post/post-content.php'); ?>
</div>
</article>
@@ -20,7 +20,7 @@ <?php endif; ?>
<div class="post-header">
- <h2><?php $this->title() ?></h4>
+ <h2><?php $this->title() ?></h2>
<span>
<i class="glyphicon glyphicon-time"></i> <?php $this->date('Y-m-d'); ?> /
<i class="glyphicon glyphicon-bookmark"></i> <?php $this->category(',', true, '木有分类'); ?> /
@@ -31,14 +31,20 @@ <hr />
<div class="post-content">
- <?php $this->need('includes/post-content.php'); ?>
+ <?php $this->need('post/post-content.php'); ?>
</div>
+
+ <br />
<div class="post-footer">
- <hr />
- <div class="tags-list">
- <?php $this->tags('', true, '没有标签哦~'); ?>
- </div>
+ <hr class="item-hr" />
+ <Span class="social-icon-group" align="right">
+ <a class="social-share icon-google" target="_blank" href="https://plus.google.com/share?url=<?php $this->permalink() ?>" title="分享至Google Plus"><i class="fa fa-google"></i></a>
+ <a class="social-share icon-qzone" target="_blank" href="https://connect.qq.com/widget/shareqq/index.html?url=<?php $this->permalink() ?>&title=<?php $this->title() ?>&summary=<?php $this->excerpt(100); ?>&pics=<?php $this->fields->banner(); ?>" title="分享至QQ好友"><i class="fa fa-qq"></i></a>
+ <a class="social-share icon-weibo" target="_blank" href="http://service.weibo.com/share/share.php?url=<?php $this->permalink() ?>/&appkey=<?php $this->options->title(); ?>/&title=<?php $this->title() ?>&pic=<?php $this->fields->banner(); ?>" title="分享至新浪微博"><i class="fa fa-weibo"></i></a>
+ <a class="social-share icon-twitter" target="_blank" href="https://twitter.com/intent/tweet?text=<?php $this->excerpt(100); ?>&url=<?php $this->permalink() ?>&via=<?php $this->options->SiteUrl(); ?>"><i class="fa fa-twitter" title="分享至Twitter"></i></a>
+ </span>
+ <hr class="item-hr" />
</div>
</article>
diff --git a/post/post-content.php b/post/post-content.php new file mode 100644 index 0000000..a1fdd24 --- /dev/null +++ b/post/post-content.php @@ -0,0 +1,70 @@ +<?php
+ $content = $this->content;
+
+ $content = preg_replace('/<table(.*?)>/s','<table class="table table-striped table-hover">',$content);
+ $content = preg_replace('/<pre><code>/s','<pre><code class="language-html">',$content);
+ $content = preg_replace('/<img(.*?)src="(.*?)"(.*?)alt="(.*?)"(.*?)>/s','<a data-fancybox="gallery" href="${2}" class="gallery-link"><img${1}src="${2}"${3}></a><span class="post-img-alt">${4}</span>',$content);
+
+ //短代码(无参数)
+ $reg = '/\[scode\](.*?)\[\/scode\]/s';
+ $rp = '<div class="tip">${1}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //短代码(有参数)
+ $reg = '/\[scode.*?type="(.*?)"\](.*?)\[\/scode\]/s';
+ $rp = '<div class="tip ${1}">${2}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //font文字排版
+ //无参数时,自动解析为红色
+ $reg = '/\[font\](.*?)\[\/font\]/s';
+ $rg = '<span style="color:red;">${1}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有color参数的font
+ $reg = '/\[font color="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="color:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有bg参数的font
+ $reg = '/\[font bg="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="background-color:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有size参数的font
+ $reg = '/\[font size="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="font-size:${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析只有style参数的font
+ $reg = '/\[font style="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '<span style="${1}">${2}</span>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //滚动文本区域
+ $reg = '/\[stext\](.*?)\[\/stext\]/s';
+ $rp = '<div class="post-stext">${1}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析按钮
+ $reg = '/\[btn url="(.*?)" type="(.*?)" ico="(.*?)"\](.*?)\[\/btn\]/s';
+ $rp = '<a href="${1}" class="btn btn-${2}" target="_blank"><i class="${3}"></i> ${4}</a>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析嵌入块
+ $reg = '/\[well\](.*?)\[\/well\]/s';
+ $rp = '<div class="well">${1}</div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ //解析面板
+ //无参数面板
+ $reg = '/\[panel\](.*?)\[\/panel\]/s';
+ $rp = '<div class="panel panel-default"><Div class="panel-body">${1}</div></div>';
+ $content = preg_replace($reg,$rp,$content);
+ //有标题的面板
+ $reg = '/\[panel title="(.*?)"\](.*?)\[\/panel\]/s';
+ $rp = '<div class="panel panel-default"><div class="panel-heading">${1}</div><Div class="panel-body">${2}</div></div>';
+ $content = preg_replace($reg,$rp,$content);
+
+ echo $content;
+?>
\ No newline at end of file diff --git a/post/post-excerpt.php b/post/post-excerpt.php new file mode 100644 index 0000000..401349f --- /dev/null +++ b/post/post-excerpt.php @@ -0,0 +1,62 @@ +<?php
+ //短代码(无参数)
+ $reg = '/\[scode\](.*?)\[\/scode\]/s';
+ $rp = '${1}';
+ $post_excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //短代码(有参数)
+ $reg = '/\[scode.*?type="(.*?)"\](.*?)\[\/scode\]/s';
+ $rp = '${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //font文字排版
+ //无参数时,自动解析为红色
+ $reg = '/\[font\](.*?)\[\/font\]/s';
+ $rg = '${1}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析只有color参数的font
+ $reg = '/\[font color="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析只有bg参数的font
+ $reg = '/\[font bg="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析只有size参数的font
+ $reg = '/\[font size="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析只有style参数的font
+ $reg = '/\[font style="(.*?)"\](.*?)\[\/font\]/s';
+ $rp = '${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //滚动文本区域
+ $reg = '/\[stext\](.*?)\[\/stext\]/s';
+ $rp = '${1}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析按钮
+ $reg = '/\[btn url="(.*?)" type="(.*?)" ico="(.*?)"\](.*?)\[\/btn\]/s';
+ $rp = '${4}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析嵌入块
+ $reg = '/\[well\](.*?)\[\/well\]/s';
+ $rp = '${1}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+
+ //解析面板
+ //无参数面板
+ $reg = '/\[panel\](.*?)\[\/panel\]/s';
+ $rp = '${1}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+ //有标题的面板
+ $reg = '/\[panel title="(.*?)"\](.*?)\[\/panel\]/s';
+ $rp = '${1} ${2}';
+ $this->excerpt = preg_replace($reg,$rp,$this->excerpt);
+?>
\ No newline at end of file diff --git a/post/post-item.php b/post/post-item.php new file mode 100644 index 0000000..5452f45 --- /dev/null +++ b/post/post-item.php @@ -0,0 +1,74 @@ +<?php if($this->is('post') || $this->fields->type=='1' ): ?>
+<!-- 说说 -->
+ <?php if ($this->is('index')): ?>
+ <div class="post-item item">
+ <div class="post-content saying-content">
+ <h3><?php $this->author() ?>说:</h3>
+ <?php $this->need('post/post-content.php'); ?>
+ </div>
+ <hr />
+ <div class="row 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">
+ <h4 class="saying-title"><a href="<?php $this->permalink() ?>"><?php $this->title(); ?></a></h4>
+ <div class="saying-info"><?php $this->date('F j, Y'); ?></div>
+
+ <a href="<?php $this->permalink() ?>" class="read-more pull-right btn btn-default">前往吐槽</a>
+ </div>
+ </div>
+ </div>
+
+ <br />
+ <?php endif; ?>
+<!-- 小板式文章 -->
+<?php elseif($this->fields->type=='2'): ?>
+ <a href="<?php $this->permalink() ?>" class="post-link">
+ <div class="item post-item">
+ <div class="row">
+ <div style="height:160px;background:url('<?php $this->fields->banner(); ?>');background-repeat:no-repeat;background-size:cover" class="col-md-3 col-xs-5 post-banner-sm"></div>
+ <div class="col-md-9 col-xs-7" style="margin-top:-20px;">
+ <h3><?php $this->sticky(); $this->title() ?></h3>
+ <p class="excerpt">
+ <?php $this->need('post/post-excerpt.php'); ?>
+ <?php echo $this->excerpt(50); ?>
+ <br />
+ </p>
+ <hr class="mobile-none" />
+ <div class="post-info mobile-none"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> | <span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> | <Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
+
+ </div>
+ </div>
+ </div>
+ </a>
+ <br />
+<?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->need('post/post-excerpt.php'); ?>
+ <?php echo $this->excerpt(100); ?>
+ </p>
+
+ <hr />
+
+
+ <div class="post-info"><span class="glyphicon glyphicon-th-large"></span> <?php $this->category(',', true, '木有分类'); ?> | <span class="glyphicon glyphicon-calendar"></span> <?php $this->date('F j, Y'); ?> | <Span class="glyphicon glyphicon-comment"></span> <?php $this->commentsNum('%d Comments'); ?></div>
+ <br />
+ </div>
+ </a>
+<br />
+
+<?php endif; ?>
|
