Browse Source

Cleaning up

pull/695/head
danpros 1 year ago
parent
commit
5464f2c1f8
2 changed files with 40 additions and 32 deletions
  1. +37
    -30
      system/includes/functions.php
  2. +3
    -2
      themes/doks/css/style.css

+ 37
- 30
system/includes/functions.php View File

@ -518,6 +518,11 @@ function get_posts($posts, $page = 1, $perpage = 0)
// 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));
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$toc = explode('<!--toc-->', $post->body); $toc = explode('<!--toc-->', $post->body);
if (isset($toc['1'])) { if (isset($toc['1'])) {
@ -540,11 +545,6 @@ function get_posts($posts, $page = 1, $perpage = 0)
$post->views = null; $post->views = null;
} }
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$tmp[] = $post; $tmp[] = $post;
} }
@ -592,6 +592,11 @@ function get_pages($pages, $page = 1, $perpage = 0)
// 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));
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$toc = explode('<!--toc-->', $post->body); $toc = explode('<!--toc-->', $post->body);
if (isset($toc['1'])) { if (isset($toc['1'])) {
@ -609,11 +614,6 @@ function get_pages($pages, $page = 1, $perpage = 0)
$post->views = null; $post->views = null;
} }
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$tmp[] = $post; $tmp[] = $post;
} }
@ -672,6 +672,12 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
// 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));
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$toc = explode('<!--toc-->', $post->body); $toc = explode('<!--toc-->', $post->body);
if (isset($toc['1'])) { if (isset($toc['1'])) {
@ -689,11 +695,6 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
$post->views = null; $post->views = null;
} }
$post->description = get_content_tag("d", $content, get_description($post->body));
$word_count = str_word_count(strip_tags($post->body));
$post->readTime = ceil($word_count / 200);
$tmp[] = $post; $tmp[] = $post;
} }
@ -959,14 +960,14 @@ function read_category_info($category)
// Get the contents and convert it to HTML // Get the contents and convert it to HTML
$desc->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); $desc->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
$desc->description = get_content_tag("d", $content, get_description($desc->body));
$toc = explode('<!--toc-->', $desc->body); $toc = explode('<!--toc-->', $desc->body);
if (isset($toc['1'])) { if (isset($toc['1'])) {
$desc->body = insert_toc('taxonomy-' . $desc->slug, $toc['0'], $toc['1']); $desc->body = insert_toc('taxonomy-' . $desc->slug, $toc['0'], $toc['1']);
} }
$desc->description = get_content_tag("d", $content, get_description($desc->body));
$tmp[] = $desc; $tmp[] = $desc;
} }
} }
@ -1191,6 +1192,8 @@ function get_author($name)
// Get the contents and convert it to HTML // Get the contents and convert it to HTML
$author->about = MarkdownExtra::defaultTransform(remove_html_comments($content)); $author->about = MarkdownExtra::defaultTransform(remove_html_comments($content));
$author->description = strip_tags($author->about);
$toc = explode('<!--toc-->', $author->about); $toc = explode('<!--toc-->', $author->about);
if (isset($toc['1'])) { if (isset($toc['1'])) {
@ -1201,8 +1204,6 @@ function get_author($name)
$author->title = $author->name; $author->title = $author->name;
$author->description = strip_tags($author->about);
$tmp[] = $author; $tmp[] = $author;
} }
} }
@ -1242,10 +1243,18 @@ function get_frontpage()
if (file_exists($filename)) { if (file_exists($filename)) {
$content = file_get_contents($filename); $content = file_get_contents($filename);
$front->file = $filename;
$front->title = get_content_tag('t', $content, 'Welcome'); $front->title = get_content_tag('t', $content, 'Welcome');
$front->url = site_url() . 'front'; $front->url = site_url() . 'front';
$front->slug = 'front';
$front->parent = null;
$front->parentSlug = null;
// Get the contents and convert it to HTML // Get the contents and convert it to HTML
$front->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); $front->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
$front->description = get_content_tag("d", $content, get_description($front->body));
$word_count = str_word_count(strip_tags($front->body));
$front->readTime = ceil($word_count / 200);
$front->views = null;
$toc = explode('<!--toc-->', $front->body); $toc = explode('<!--toc-->', $front->body);
if (isset($toc['1'])) { if (isset($toc['1'])) {
$front->body = insert_toc('page-front', $toc['0'], $toc['1']); $front->body = insert_toc('page-front', $toc['0'], $toc['1']);
@ -1254,6 +1263,14 @@ function get_frontpage()
$front->title = 'Welcome'; $front->title = 'Welcome';
$front->url = site_url() . 'front'; $front->url = site_url() . 'front';
$front->body = 'Welcome to our website.'; $front->body = 'Welcome to our website.';
$front->file = null;
$front->slug = 'front';
$front->parent = null;
$front->parentSlug = null;
$front->description = $front->body;
$word_count = str_word_count(strip_tags($front->body));
$front->readTime = ceil($word_count / 200);
$front->views = null;
} }
return $front; return $front;
@ -2502,7 +2519,6 @@ EOF;
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);} function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('js', new Date());
gtag('config', '{$gtag}'); gtag('config', '{$gtag}');
</script> </script>
EOF; EOF;
@ -2868,15 +2884,7 @@ function generate_rss($posts, $data = null)
foreach ($posts as $p) { foreach ($posts as $p) {
$img = get_image($p->body); $img = get_image($p->body);
if (!empty($rssLength)) { if (!empty($rssLength)) {
if (strlen(strip_tags($p->body)) < config('rss.char')) {
$string = preg_replace('/\s\s+/', ' ', strip_tags($p->body));
$body = $string . '...';
} else {
$string = preg_replace('/\s\s+/', ' ', strip_tags($p->body));
$string = substr($string, 0, config('rss.char'));
$string = substr($string, 0, strrpos($string, ' '));
$body = $string . '...';
}
$body = shorten($p->body, $rssLength);
} else { } else {
$body = $p->body; $body = $p->body;
} }
@ -3630,7 +3638,6 @@ function insert_toc($id, $part_1 = null, $part_2 = null)
document.getElementById('toc-wrapper.{$id}').parentNode.classList.add('{$id}'); document.getElementById('toc-wrapper.{$id}').parentNode.classList.add('{$id}');
generateTOC('.{$id}'); generateTOC('.{$id}');
} }
}); });
</script> </script>
EOF; EOF;


+ 3
- 2
themes/doks/css/style.css View File

@ -3558,10 +3558,11 @@ body.dark .docs-bar .menu-icon .navicon::before, body.dark .docs-bar .menu-icon
} }
.social-logo a { .social-logo a {
padding: 0.5625em 0.25rem 0.5rem 0.125rem;
padding: 0.40em 0.25rem 0.5rem 0.125rem;
line-height:1; line-height:1;
height:24px; height:24px;
color: #1d2d35; color: #1d2d35;
margin-right: 0.5rem!important;
} }
body.dark .social-logo a { body.dark .social-logo a {
@ -3571,4 +3572,4 @@ body.dark .social-logo a {
body.dark .social-logo a:hover, .dark .toc-wrapper a:hover { body.dark .social-logo a:hover, .dark .toc-wrapper a:hover {
color: #8ed6fb; color: #8ed6fb;
text-decoration:none; text-decoration:none;
}
}

Loading…
Cancel
Save