diff --git a/cache/installedVersion.json b/cache/installedVersion.json
index 4bec5dd..53efec0 100644
--- a/cache/installedVersion.json
+++ b/cache/installedVersion.json
@@ -1,4 +1,4 @@
{
"id": 782014,
- "tag_name": "v2.6.9"
+ "tag_name": "v2.7.0"
}
diff --git a/config/config.ini.example b/config/config.ini.example
index 5e1130b..d3d8f0f 100644
--- a/config/config.ini.example
+++ b/config/config.ini.example
@@ -67,6 +67,7 @@ tag.perpage = "10"
archive.perpage = "10"
search.perpage = "10"
profile.perpage = "10"
+type.perpage = "10"
json.count = "10"
; Category info
@@ -87,6 +88,9 @@ author.info = "true"
; Teaser type: set "trimmed" or "full".
teaser.type = "trimmed"
+; Read more link text for "full" teaser type
+read.more = "Read more"
+
; Teaser character count
teaser.char = "200"
@@ -116,6 +120,7 @@ sitemap.priority.archiveDay = "0.5"
sitemap.priority.archiveMonth = "0.5"
sitemap.priority.archiveYear = "0.5"
sitemap.priority.author = "0.5"
+sitemap.priority.type = "0.5"
; Also install pre-release
prerelease = "false"
@@ -133,7 +138,7 @@ generation.time = "false"
cache.timestamp = "false"
; Set the theme here
-views.root = "themes/blog"
+views.root = "themes/twentysixteen"
; Framework config. No need to edit.
views.layout = "layout"
diff --git a/system/admin/admin.php b/system/admin/admin.php
index ebc888a..c97c5fe 100644
--- a/system/admin/admin.php
+++ b/system/admin/admin.php
@@ -136,7 +136,7 @@ function add_content($title, $tag, $url, $content, $user, $description = null, $
save_tag_i18n($post_tag, $post_tagmd);
rebuilt_cache('all');
- clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename, $category);
+ clear_post_cache($post_date, $post_tag, $post_url, $dir . $filename, $category, $type);
if (empty($draft)) {
$redirect = site_url() . 'admin/mine';
@@ -281,7 +281,7 @@ function edit_content($title, $tag, $url, $content, $oldfile, $destination = nul
save_tag_i18n($post_tag, $post_tagmd);
rebuilt_cache('all');
- clear_post_cache($dt, $post_tag, $post_url, $newfile, $category);
+ clear_post_cache($dt, $post_tag, $post_url, $newfile, $category, $type);
if ($destination == 'post') {
if(!empty($revertPost)) {
$drafturl = site_url() . 'admin/draft';
@@ -553,8 +553,9 @@ function delete_post($file, $destination)
// Get cache file
$arr = explode('_', $file);
$replaced = substr($arr[0], 0, strrpos($arr[0], '/')) . '/';
+ $str = explode('/', $replaced);
$dt = str_replace($replaced, '', $arr[0]);
- clear_post_cache($dt, $arr[1], str_replace('.md', '', $arr[2]), $file, $arr[count($str) - 3]);
+ clear_post_cache($dt, $arr[1], str_replace('.md', '', $arr[2]), $file, $str[count($str) - 3], $str[count($str) - 2]);
if (!empty($deleted_content)) {
unlink($deleted_content);
@@ -802,7 +803,7 @@ function get_backup_files()
}
}
-function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category)
+function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category, $type)
{
$b = str_replace('/', '#', site_path() . '/');
$c = explode(',', $post_tag);
@@ -880,6 +881,15 @@ function clear_post_cache($post_date, $post_tag, $post_url, $filename, $category
foreach (glob('cache/page/' . $b . 'category#' . $category . '~*.cache', GLOB_NOSORT) as $file) {
unlink($file);
}
+
+ // Delete type
+ $tp = 'cache/page/' . $b . 'type#' . $type . '.cache';
+ if (file_exists($tp)) {
+ unlink($tp);
+ }
+ foreach (glob('cache/page/' . $b . 'type#' . $type . '~*.cache', GLOB_NOSORT) as $file) {
+ unlink($file);
+ }
// Get cache post author
$arr = explode('_', $filename);
diff --git a/system/htmly.php b/system/htmly.php
index 44ec00c..4c65b00 100644
--- a/system/htmly.php
+++ b/system/htmly.php
@@ -1524,6 +1524,75 @@ post('/category/:category/delete', function () {
}
});
+// Show the type page
+get('/type/:type', function ($type) {
+
+ if (isset($_GET['search'])) {
+ $search = $_GET['search'];
+ $url = site_url() . 'search/' . remove_accent($search);
+ header("Location: $url");
+ }
+
+ if (!login()) {
+ file_cache($_SERVER['REQUEST_URI']);
+ }
+
+ $page = from($_GET, 'page');
+ $page = $page ? (int)$page : 1;
+ $perpage = config('type.perpage');
+
+ if (empty($perpage)) {
+ $perpage = 10;
+ }
+
+ $posts = get_type($type, $page, $perpage);
+
+ $total = get_typecount($type);
+
+ $ttype = new stdClass;
+ $ttype->title = $type;
+
+ if (empty($posts) || $page < 1) {
+ // a non-existing page
+ not_found();
+ }
+
+ $vroot = rtrim(config('views.root'), '/');
+
+ $lt = $vroot . '/layout--type--'. strtolower($type) .'.html.php';
+ $ls = $vroot . '/layout--type.html.php';
+ if (file_exists($lt)) {
+ $layout = 'layout--type--' . strtolower($type);
+ } else if (file_exists($ls)) {
+ $layout = 'layout--type';
+ } else {
+ $layout = '';
+ }
+
+ $pv = $vroot . '/main--type--'. strtolower($type) .'.html.php';
+ $ps = $vroot . '/main--type.html.php';
+ if (file_exists($pv)) {
+ $pview = 'main--type--' . strtolower($type);
+ } else if (file_exists($ps)) {
+ $pview = 'main--type';
+ } else {
+ $pview = 'main';
+ }
+
+ render($pview, array(
+ 'title' => 'Posts with type: ' . ucfirst($type) . ' - ' . blog_title(),
+ 'description' => 'All posts with type: ' . ucfirst($type) . ' on ' . blog_title() . '.',
+ 'canonical' => site_url() . 'type/' . strtolower($type),
+ 'page' => $page,
+ 'posts' => $posts,
+ 'type' => $ttype,
+ 'bodyclass' => 'intype',
+ 'breadcrumb' => '' . config('breadcrumb.home') . ' » ' . ucfirst($type),
+ 'pagination' => has_pagination($total, $perpage, $page),
+ 'is_type' => true,
+ ), $layout);
+});
+
// Show the tag page
get('/tag/:tag', function ($tag) {
@@ -2144,7 +2213,7 @@ get('/:static', function ($static) {
header("Location: $url");
}
- if ($static === 'sitemap.xml' || $static === 'sitemap.base.xml' || $static === 'sitemap.post.xml' || $static === 'sitemap.static.xml' || $static === 'sitemap.tag.xml' || $static === 'sitemap.archive.xml' || $static === 'sitemap.author.xml' || $static === 'sitemap.category.xml') {
+ if ($static === 'sitemap.xml' || $static === 'sitemap.base.xml' || $static === 'sitemap.post.xml' || $static === 'sitemap.static.xml' || $static === 'sitemap.tag.xml' || $static === 'sitemap.archive.xml' || $static === 'sitemap.author.xml' || $static === 'sitemap.category.xml' || $static === 'sitemap.type.xml') {
header('Content-Type: text/xml');
@@ -2164,6 +2233,8 @@ get('/:static', function ($static) {
generate_sitemap('author');
} elseif ($static === 'sitemap.category.xml') {
generate_sitemap('category');
+ } elseif ($static === 'sitemap.type.xml') {
+ generate_sitemap('type');
}
die;
diff --git a/system/includes/functions.php b/system/includes/functions.php
index e32c379..cb0ffe3 100644
--- a/system/includes/functions.php
+++ b/system/includes/functions.php
@@ -342,9 +342,14 @@ function get_posts($posts, $page = 1, $perpage = 0)
$post->tag = implode(' ', $url);
$post->tagb = implode(' » ', $bc);
-
+
$post->related = rtrim($arr[1], ',');
-
+
+ $more = explode('', $content);
+ if (isset($more['1'])) {
+ $content = $more['0'] . '
' . "\n\n" . '' . $more['1'];
+ }
+
// Get the contents and convert it to HTML
$post->body = MarkdownExtra::defaultTransform(remove_html_comments($content));
@@ -549,6 +554,71 @@ function default_category()
return $tmp[] = $desc;
}
+// Return category list
+
+function category_list() {
+
+ $arr = get_category_info(null);
+ $cat = array();
+ $list = array();
+
+ foreach ($arr as $a) {
+ $cat[] = array($a->md, $a->title);
+ }
+ array_push($cat, array('uncategorized', 'Uncategorized'));
+ asort($cat);
+
+ echo '