From 6b2922e9a1763cebe726c356f1cb87e796ba19a2 Mon Sep 17 00:00:00 2001 From: danpros Date: Sat, 6 Jan 2024 11:32:22 +0700 Subject: [PATCH] Missing views var for page/subpage --- system/admin/admin.php | 8 +++++++- system/includes/functions.php | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/system/admin/admin.php b/system/admin/admin.php index 2d8024a..eef9074 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -1327,6 +1327,8 @@ function find_draft_page($static = null) if (config('views.counter') == 'true') { $post->views = get_views($post->file); + } else { + $post->views = null; } $post->description = get_content_tag("d", $content, get_description($post->body)); @@ -1382,7 +1384,11 @@ 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)); - $post->views = get_views($post->file); + if (config('views.counter') == 'true') { + $post->views = get_views($post->file); + } else { + $post->views = null; + } $post->description = get_content_tag("d", $content, get_description($post->body)); diff --git a/system/includes/functions.php b/system/includes/functions.php index 0420492..dd9f403 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -562,6 +562,8 @@ function get_pages($pages, $page = 1, $perpage = 0) if (config('views.counter') == 'true') { $post->views = get_views($post->file); + } else { + $post->views = null; } $post->description = get_content_tag("d", $content, get_description($post->body)); @@ -613,7 +615,11 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0) // Get the contents and convert it to HTML $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); - $post->views = get_views($post->file); + if (config('views.counter') == 'true') { + $post->views = get_views($post->file); + } else { + $post->views = null; + } $post->description = get_content_tag("d", $content, get_description($post->body)); @@ -705,6 +711,8 @@ function find_page($static = null) if (config('views.counter') == 'true') { $post->views = get_views($post->file); + } else { + $post->views = null; } $post->description = get_content_tag("d", $content, get_description($post->body)); @@ -789,7 +797,11 @@ function find_subpage($static, $sub_static = null) // Get the contents and convert it to HTML $post->body = MarkdownExtra::defaultTransform(remove_html_comments($content)); - $post->views = get_views($post->file); + if (config('views.counter') == 'true') { + $post->views = get_views($post->file); + } else { + $post->views = null; + } $post->description = get_content_tag("d", $content, get_description($post->body));