mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 12:06:22 +05:30
Cleaning up
This commit is contained in:
parent
0fba77f175
commit
dd0e16acf3
10 changed files with 48 additions and 31 deletions
|
|
@ -1010,7 +1010,9 @@ function find_draft_page($static = null)
|
|||
|
||||
$tmp = array();
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
$counter = config('views.counter');
|
||||
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
|
|
@ -1052,7 +1054,7 @@ function find_draft_page($static = null)
|
|||
// Get the contents and convert it to HTML
|
||||
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$post->views = get_views('page_' . $post->slug, $post->file, $views);
|
||||
} else {
|
||||
$post->views = null;
|
||||
|
|
@ -1078,7 +1080,9 @@ function find_draft_subpage($static = null, $sub_static = null)
|
|||
|
||||
$tmp = array();
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
$counter = config('views.counter');
|
||||
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
|
|
@ -1129,7 +1133,7 @@ function find_draft_subpage($static = null, $sub_static = null)
|
|||
// Get the contents and convert it to HTML
|
||||
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$post->views = get_views('subpage_' . $post->parentSlug .'.'. $post->slug, $post->file, $views);
|
||||
} else {
|
||||
$post->views = null;
|
||||
|
|
|
|||
|
|
@ -394,8 +394,12 @@ function get_posts($posts, $page = 1, $perpage = 0)
|
|||
$posts = array_slice($posts, ($page - 1) * $perpage, $perpage);
|
||||
|
||||
$cList = category_list(true);
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
|
||||
$auto = config('toc.automatic');
|
||||
$counter = config('views.counter');
|
||||
$caption = config('fig.captions');
|
||||
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
|
|
@ -535,18 +539,17 @@ function get_posts($posts, $page = 1, $perpage = 0)
|
|||
if (isset($toc['1'])) {
|
||||
$post->body = insert_toc('post-' . $post->date, $toc['0'], $toc['1']);
|
||||
} else {
|
||||
$auto = config('toc.automatic');
|
||||
if ($auto === 'true') {
|
||||
$post->body = automatic_toc($post->body, 'post-' . $post->date);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert image tags to figures
|
||||
if (config('fig.captions') == 'true') {
|
||||
if ($caption == 'true') {
|
||||
$post->body = preg_replace( '/<p>(<img .*?alt="(.*?)"\s*\/>)<\/p>/', '<figure>$1<figcaption>$2</figcaption></figure>', $post->body );
|
||||
}
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$post->views = get_views('post_' . $post->slug, $post->file, $views);
|
||||
} else {
|
||||
$post->views = null;
|
||||
|
|
@ -565,8 +568,11 @@ function get_pages($pages, $page = 1, $perpage = 0)
|
|||
}
|
||||
|
||||
$tmp = array();
|
||||
|
||||
$auto = config('toc.automatic');
|
||||
$counter = config('views.counter');
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
|
|
@ -616,13 +622,12 @@ function get_pages($pages, $page = 1, $perpage = 0)
|
|||
if (isset($toc['1'])) {
|
||||
$post->body = insert_toc('page-' . $post->slug, $toc['0'], $toc['1']);
|
||||
} else {
|
||||
$auto = config('toc.automatic');
|
||||
if ($auto === 'true') {
|
||||
$post->body = automatic_toc($post->body, 'page-' . $post->slug);
|
||||
}
|
||||
}
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$post->views = get_views('page_' . $post->slug, $post->file, $views);
|
||||
} else {
|
||||
$post->views = null;
|
||||
|
|
@ -642,8 +647,11 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
|
|||
}
|
||||
|
||||
$tmp = array();
|
||||
|
||||
$auto = config('toc.automatic');
|
||||
$counter = config('views.counter');
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$viewsFile = "content/data/views.json";
|
||||
if (file_exists($viewsFile)) {
|
||||
$views = json_decode(file_get_contents($viewsFile), true);
|
||||
|
|
@ -703,13 +711,12 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
|
|||
if (isset($toc['1'])) {
|
||||
$post->body = insert_toc('subpage-' . $post->slug, $toc['0'], $toc['1']);
|
||||
} else {
|
||||
$auto = config('toc.automatic');
|
||||
if ($auto === 'true') {
|
||||
$post->body = automatic_toc($post->body, 'subpage-' . $post->slug);
|
||||
}
|
||||
}
|
||||
|
||||
if (config('views.counter') == 'true') {
|
||||
if ($counter == 'true') {
|
||||
$post->views = get_views('subpage_' . $post->parentSlug .'.'. $post->slug, $post->file, $views);
|
||||
} else {
|
||||
$post->views = null;
|
||||
|
|
@ -2210,6 +2217,7 @@ function get_teaser($string, $url = null, $char = null)
|
|||
{
|
||||
$teaserType = config('teaser.type');
|
||||
$more = config('read.more');
|
||||
$behave = config('teaser.behave');
|
||||
|
||||
if(empty($more)) {
|
||||
$more = 'Read more';
|
||||
|
|
@ -2231,7 +2239,7 @@ function get_teaser($string, $url = null, $char = null)
|
|||
return $string;
|
||||
}
|
||||
} else {
|
||||
if (config('teaser.behave') === 'check') {
|
||||
if ($behave === 'check') {
|
||||
$readMore = explode('<!--more-->', $string);
|
||||
if (isset($readMore['1'])) {
|
||||
$string = shorten($readMore[0]);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<section class="post section" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="section-inner">
|
||||
|
|
@ -61,11 +62,12 @@
|
|||
</p>
|
||||
</div>
|
||||
<div class="desc text-left post-<?php echo $p->date;?>" itemprop="articleBody">
|
||||
<?php echo get_teaser($p->body, $p->url) ?>
|
||||
<?php echo get_teaser($p->body, $p->url);?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...]<?php endif;?>
|
||||
</div><!--//desc-->
|
||||
<div style="position:relative;">
|
||||
<?php if (config('teaser.type') === 'trimmed'):?>
|
||||
<span class="more"><a class="btn btn-cta-secondary" href="<?php echo $p->url;?>"><?php echo config('read.more'); ?></a></span>
|
||||
<?php if ($teaserType === 'trimmed'):?>
|
||||
<span class="more"><a class="btn btn-cta-secondary" href="<?php echo $p->url;?>"><?php echo $readMore; ?></a></span>
|
||||
<?php endif;?>
|
||||
<span class="share pull-right">
|
||||
<a target="_blank" class="first" href="https://www.facebook.com/sharer.php?u=<?php echo $p->url ?>&t=<?php echo $p->title ?>"><i class="fa fa-facebook"></i></a>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
|
|
@ -52,7 +53,7 @@
|
|||
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body) ?>
|
||||
<?php echo get_teaser($p->body, $p->url) ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a href="<?php echo $p->url;?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a href="<?php echo $p->url;?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $post):?>
|
||||
<?php $img = get_image($post->body);?>
|
||||
<article>
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
|
||||
<div class="content-body">
|
||||
<?php echo get_teaser($post->body, $post->url); ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a class="more-link" href="<?php echo $post->url; ?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a class="more-link" href="<?php echo $post->url; ?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="lead"><?php echo $author->about;?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php if (!empty($posts)):?>
|
||||
<?php foreach ($posts as $post):?>
|
||||
<?php $img = get_image($post->body);?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<?php if (!empty($post->image)) {?>
|
||||
<a href="<?php echo $post->url;?>"><img alt="<?php echo $post->title;?>" src="<?php echo $post->image;?>" width="100%"></a>
|
||||
<?php } elseif (!empty($img) && config('teaser.type') === 'trimmed') {?>
|
||||
<?php } elseif (!empty($img) && $teaserType === 'trimmed') {?>
|
||||
<a href="<?php echo $post->url;?>"><img alt="<?php echo $post->title;?>" src="<?php echo $img;?>" width="100%"></a>
|
||||
<?php } ?>
|
||||
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
<div class="content-body">
|
||||
<?php echo get_teaser($post->body, $post->url); ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a class="more-link" href="<?php echo $post->url; ?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a class="more-link" href="<?php echo $post->url; ?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
|
|
@ -50,9 +51,8 @@
|
|||
</div>
|
||||
<?php } ?>
|
||||
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body) ?>
|
||||
<?php echo get_teaser($p->body, $p->url) ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a href="<?php echo $p->url;?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a href="<?php echo $p->url;?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
|
||||
<div class="main">
|
||||
|
|
@ -50,9 +51,8 @@
|
|||
</div>
|
||||
<?php } ?>
|
||||
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody">
|
||||
<?php echo get_thumbnail($p->body) ?>
|
||||
<?php echo get_teaser($p->body, $p->url) ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a href="<?php echo $p->url;?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a href="<?php echo $p->url;?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<h1 class="page-title">Type: <?php echo ucfirst($type->title);?></h1>
|
||||
</header>
|
||||
<?php endif;?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p): ?>
|
||||
<article class="post type-post hentry <?php if (!empty($p->image) || !empty ($p->audio) || !empty ($p->video)):?>has-post-thumbnail<?php endif;?>">
|
||||
<?php if (!empty($p->image)):?>
|
||||
|
|
@ -63,7 +64,7 @@
|
|||
<?php } ?>
|
||||
<div class="entry-content post-<?php echo $p->date;?>">
|
||||
<?php echo get_teaser($p->body, $p->url); ?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a class="more-link" href="<?php echo $p->url; ?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a class="more-link" href="<?php echo $p->url; ?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
<footer class="entry-footer">
|
||||
<span class="posted-on">
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<span class="social-navigation feed-link"><a href="<?php echo $type->url;?>/feed"><span class="screen-reader-text">RSS</span></a></span>
|
||||
</header>
|
||||
<?php endif;?>
|
||||
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
|
||||
<?php foreach ($posts as $p):?>
|
||||
<article class="post <?php if ($p->type == 'post') {echo 'format-standard';} else { echo 'format-' . $p->type;} ?> hentry single">
|
||||
|
||||
|
|
@ -59,7 +60,7 @@
|
|||
<span class="embed-soundcloud"><iframe width="100%" height="200px" class="embed-responsive-item" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $p->audio;?>&auto_play=false&visual=true"></iframe></span>
|
||||
<?php endif; ?>
|
||||
<?php echo get_teaser($p->body, $p->url);?>
|
||||
<?php if (config('teaser.type') === 'trimmed'):?><a class="more-link" href="<?php echo $p->url; ?>"><?php echo config('read.more'); ?></a><?php endif;?>
|
||||
<?php if ($teaserType === 'trimmed'):?>[...] <a class="more-link" href="<?php echo $p->url; ?>"><?php echo $readMore; ?></a><?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue