Browse Source

Cleaning up

pull/698/head
danpros 1 year ago
parent
commit
dd0e16acf3
10 changed files with 48 additions and 31 deletions
  1. +8
    -4
      system/admin/admin.php
  2. +20
    -12
      system/includes/functions.php
  3. +5
    -3
      themes/blog/main.html.php
  4. +2
    -1
      themes/clean/main.html.php
  5. +2
    -2
      themes/doks/main.html.php
  6. +3
    -3
      themes/doks/profile.html.php
  7. +2
    -2
      themes/logs/main.html.php
  8. +2
    -2
      themes/readable/main.html.php
  9. +2
    -1
      themes/twentyfifteen/main.html.php
  10. +2
    -1
      themes/twentysixteen/main.html.php

+ 8
- 4
system/admin/admin.php View File

@ -1010,7 +1010,9 @@ function find_draft_page($static = null)
$tmp = array(); $tmp = array();
if (config('views.counter') == 'true') {
$counter = config('views.counter');
if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
$views = json_decode(file_get_contents($viewsFile), true); $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 // Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); $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); $post->views = get_views('page_' . $post->slug, $post->file, $views);
} else { } else {
$post->views = null; $post->views = null;
@ -1078,7 +1080,9 @@ function find_draft_subpage($static = null, $sub_static = null)
$tmp = array(); $tmp = array();
if (config('views.counter') == 'true') {
$counter = config('views.counter');
if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
$views = json_decode(file_get_contents($viewsFile), true); $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 // Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); $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); $post->views = get_views('subpage_' . $post->parentSlug .'.'. $post->slug, $post->file, $views);
} else { } else {
$post->views = null; $post->views = null;


+ 20
- 12
system/includes/functions.php View File

@ -394,8 +394,12 @@ function get_posts($posts, $page = 1, $perpage = 0)
$posts = array_slice($posts, ($page - 1) * $perpage, $perpage); $posts = array_slice($posts, ($page - 1) * $perpage, $perpage);
$cList = category_list(true); $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"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
$views = json_decode(file_get_contents($viewsFile), true); $views = json_decode(file_get_contents($viewsFile), true);
@ -535,18 +539,17 @@ function get_posts($posts, $page = 1, $perpage = 0)
if (isset($toc['1'])) { if (isset($toc['1'])) {
$post->body = insert_toc('post-' . $post->date, $toc['0'], $toc['1']); $post->body = insert_toc('post-' . $post->date, $toc['0'], $toc['1']);
} else { } else {
$auto = config('toc.automatic');
if ($auto === 'true') { if ($auto === 'true') {
$post->body = automatic_toc($post->body, 'post-' . $post->date); $post->body = automatic_toc($post->body, 'post-' . $post->date);
} }
} }
// Convert image tags to figures // 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 ); $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); $post->views = get_views('post_' . $post->slug, $post->file, $views);
} else { } else {
$post->views = null; $post->views = null;
@ -565,8 +568,11 @@ function get_pages($pages, $page = 1, $perpage = 0)
} }
$tmp = array(); $tmp = array();
$auto = config('toc.automatic');
$counter = config('views.counter');
if (config('views.counter') == 'true') {
if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
$views = json_decode(file_get_contents($viewsFile), true); $views = json_decode(file_get_contents($viewsFile), true);
@ -616,13 +622,12 @@ function get_pages($pages, $page = 1, $perpage = 0)
if (isset($toc['1'])) { if (isset($toc['1'])) {
$post->body = insert_toc('page-' . $post->slug, $toc['0'], $toc['1']); $post->body = insert_toc('page-' . $post->slug, $toc['0'], $toc['1']);
} else { } else {
$auto = config('toc.automatic');
if ($auto === 'true') { if ($auto === 'true') {
$post->body = automatic_toc($post->body, 'page-' . $post->slug); $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); $post->views = get_views('page_' . $post->slug, $post->file, $views);
} else { } else {
$post->views = null; $post->views = null;
@ -642,8 +647,11 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
} }
$tmp = array(); $tmp = array();
$auto = config('toc.automatic');
$counter = config('views.counter');
if (config('views.counter') == 'true') {
if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
$views = json_decode(file_get_contents($viewsFile), true); $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'])) { if (isset($toc['1'])) {
$post->body = insert_toc('subpage-' . $post->slug, $toc['0'], $toc['1']); $post->body = insert_toc('subpage-' . $post->slug, $toc['0'], $toc['1']);
} else { } else {
$auto = config('toc.automatic');
if ($auto === 'true') { if ($auto === 'true') {
$post->body = automatic_toc($post->body, 'subpage-' . $post->slug); $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); $post->views = get_views('subpage_' . $post->parentSlug .'.'. $post->slug, $post->file, $views);
} else { } else {
$post->views = null; $post->views = null;
@ -2210,6 +2217,7 @@ function get_teaser($string, $url = null, $char = null)
{ {
$teaserType = config('teaser.type'); $teaserType = config('teaser.type');
$more = config('read.more'); $more = config('read.more');
$behave = config('teaser.behave');
if(empty($more)) { if(empty($more)) {
$more = 'Read more'; $more = 'Read more';
@ -2231,7 +2239,7 @@ function get_teaser($string, $url = null, $char = null)
return $string; return $string;
} }
} else { } else {
if (config('teaser.behave') === 'check') {
if ($behave === 'check') {
$readMore = explode('<!--more-->', $string); $readMore = explode('<!--more-->', $string);
if (isset($readMore['1'])) { if (isset($readMore['1'])) {
$string = shorten($readMore[0]); $string = shorten($readMore[0]);


+ 5
- 3
themes/blog/main.html.php View File

@ -17,6 +17,7 @@
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<section class="post section" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"> <section class="post section" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="section-inner"> <div class="section-inner">
@ -61,11 +62,12 @@
</p> </p>
</div> </div>
<div class="desc text-left post-<?php echo $p->date;?>" itemprop="articleBody"> <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><!--//desc-->
<div style="position:relative;"> <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;?> <?php endif;?>
<span class="share pull-right"> <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> <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>


+ 2
- 1
themes/clean/main.html.php View File

@ -10,6 +10,7 @@
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"> <div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="main"> <div class="main">
@ -52,7 +53,7 @@
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody"> <div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody">
<?php echo get_thumbnail($p->body) ?> <?php echo get_thumbnail($p->body) ?>
<?php echo get_teaser($p->body, $p->url) ?> <?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> </div>
</div> </div>


+ 2
- 2
themes/doks/main.html.php View File

@ -61,7 +61,7 @@
</div> </div>
</div> </div>
<?php endif;?> <?php endif;?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $post):?> <?php foreach ($posts as $post):?>
<?php $img = get_image($post->body);?> <?php $img = get_image($post->body);?>
<article> <article>
@ -101,7 +101,7 @@
<div class="content-body"> <div class="content-body">
<?php echo get_teaser($post->body, $post->url); ?> <?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> </div>
<p> <p>


+ 3
- 3
themes/doks/profile.html.php View File

@ -7,7 +7,7 @@
<div class="lead"><?php echo $author->about;?></div> <div class="lead"><?php echo $author->about;?></div>
</div> </div>
</div> </div>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php if (!empty($posts)):?> <?php if (!empty($posts)):?>
<?php foreach ($posts as $post):?> <?php foreach ($posts as $post):?>
<?php $img = get_image($post->body);?> <?php $img = get_image($post->body);?>
@ -17,7 +17,7 @@
<?php if (!empty($post->image)) {?> <?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> <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> <a href="<?php echo $post->url;?>"><img alt="<?php echo $post->title;?>" src="<?php echo $img;?>" width="100%"></a>
<?php } ?> <?php } ?>
@ -48,7 +48,7 @@
<div class="content-body"> <div class="content-body">
<?php echo get_teaser($post->body, $post->url); ?> <?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> </div>
<p> <p>


+ 2
- 2
themes/logs/main.html.php View File

@ -10,6 +10,7 @@
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"> <div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="main"> <div class="main">
@ -50,9 +51,8 @@
</div> </div>
<?php } ?> <?php } ?>
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody"> <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 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> </div>
</div> </div>


+ 2
- 2
themes/readable/main.html.php View File

@ -10,6 +10,7 @@
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"> <div class="post" itemprop="blogPost" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
<div class="main"> <div class="main">
@ -50,9 +51,8 @@
</div> </div>
<?php } ?> <?php } ?>
<div class="teaser-body post-<?php echo $p->date;?>" itemprop="articleBody"> <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 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> </div>
</div> </div>


+ 2
- 1
themes/twentyfifteen/main.html.php View File

@ -30,6 +30,7 @@
<h1 class="page-title">Type: <?php echo ucfirst($type->title);?></h1> <h1 class="page-title">Type: <?php echo ucfirst($type->title);?></h1>
</header> </header>
<?php endif;?> <?php endif;?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p): ?> <?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;?>"> <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)):?> <?php if (!empty($p->image)):?>
@ -63,7 +64,7 @@
<?php } ?> <?php } ?>
<div class="entry-content post-<?php echo $p->date;?>"> <div class="entry-content post-<?php echo $p->date;?>">
<?php echo get_teaser($p->body, $p->url); ?> <?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>
<footer class="entry-footer"> <footer class="entry-footer">
<span class="posted-on"> <span class="posted-on">


+ 2
- 1
themes/twentysixteen/main.html.php View File

@ -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> <span class="social-navigation feed-link"><a href="<?php echo $type->url;?>/feed"><span class="screen-reader-text">RSS</span></a></span>
</header> </header>
<?php endif;?> <?php endif;?>
<?php $teaserType = config('teaser.type'); $readMore = config('read.more');?>
<?php foreach ($posts as $p):?> <?php foreach ($posts as $p):?>
<article class="post <?php if ($p->type == 'post') {echo 'format-standard';} else { echo 'format-' . $p->type;} ?> hentry single"> <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;?>&amp;auto_play=false&amp;visual=true"></iframe></span> <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;?>&amp;auto_play=false&amp;visual=true"></iframe></span>
<?php endif; ?> <?php endif; ?>
<?php echo get_teaser($p->body, $p->url);?> <?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> </div>
</div> </div>


Loading…
Cancel
Save