Browse Source

Improve pages/subpages

Allow to reorder the pages and subpages position. Added doks theme
pull/674/head
danpros 1 year ago
parent
commit
8d142b7f37
46 changed files with 4860 additions and 94 deletions
  1. +92
    -8
      system/admin/admin.php
  2. +1
    -1
      system/admin/views/add-content.html.php
  3. +9
    -5
      system/admin/views/categories.html.php
  4. +6
    -2
      system/admin/views/category-list.html.php
  5. +1
    -1
      system/admin/views/edit-content.html.php
  6. +9
    -3
      system/admin/views/edit-page.html.php
  7. +1
    -0
      system/admin/views/layout.html.php
  8. +1
    -0
      system/admin/views/menu.html.php
  9. +4
    -0
      system/admin/views/popular-posts.html.php
  10. +4
    -0
      system/admin/views/posts-list.html.php
  11. +4
    -0
      system/admin/views/scheduled.html.php
  12. +50
    -34
      system/admin/views/static-pages.html.php
  13. +57
    -0
      system/admin/views/static-subpages.html.php
  14. +8
    -4
      system/admin/views/user-draft.html.php
  15. +4
    -0
      system/admin/views/user-posts.html.php
  16. +85
    -4
      system/htmly.php
  17. +1
    -1
      system/includes/dispatch.php
  18. +71
    -28
      system/includes/functions.php
  19. +10
    -3
      system/resources/js/jquery-ui.min.js
  20. +10
    -0
      themes/doks/404-search.html.php
  21. +10
    -0
      themes/doks/404.html.php
  22. +21
    -0
      themes/doks/LICENSE.txt
  23. +16
    -0
      themes/doks/README.md
  24. +3535
    -0
      themes/doks/css/style.css
  25. BIN
      themes/doks/fonts/jost/jost-v4-latin-500.woff
  26. BIN
      themes/doks/fonts/jost/jost-v4-latin-500.woff2
  27. BIN
      themes/doks/fonts/jost/jost-v4-latin-500italic.woff
  28. BIN
      themes/doks/fonts/jost/jost-v4-latin-500italic.woff2
  29. BIN
      themes/doks/fonts/jost/jost-v4-latin-700.woff
  30. BIN
      themes/doks/fonts/jost/jost-v4-latin-700.woff2
  31. BIN
      themes/doks/fonts/jost/jost-v4-latin-700italic.woff
  32. BIN
      themes/doks/fonts/jost/jost-v4-latin-700italic.woff2
  33. BIN
      themes/doks/fonts/jost/jost-v4-latin-italic.woff
  34. BIN
      themes/doks/fonts/jost/jost-v4-latin-italic.woff2
  35. BIN
      themes/doks/fonts/jost/jost-v4-latin-regular.woff
  36. BIN
      themes/doks/fonts/jost/jost-v4-latin-regular.woff2
  37. BIN
      themes/doks/img/soundcloud.jpg
  38. +11
    -0
      themes/doks/js/main.js
  39. +72
    -0
      themes/doks/js/toc.js
  40. +103
    -0
      themes/doks/layout--static.html.php
  41. +135
    -0
      themes/doks/layout.html.php
  42. +147
    -0
      themes/doks/main.html.php
  43. +9
    -0
      themes/doks/no-posts.html.php
  44. +110
    -0
      themes/doks/post.html.php
  45. +95
    -0
      themes/doks/profile.html.php
  46. +168
    -0
      themes/doks/static.html.php

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

@ -550,6 +550,8 @@ function add_page($title, $url, $content, $draft, $description = null)
function add_sub_page($title, $url, $content, $static, $draft, $description = null) function add_sub_page($title, $url, $content, $static, $draft, $description = null)
{ {
$post = find_page($static);
$static = pathinfo($post['current']->md, PATHINFO_FILENAME);
$post_title = safe_html($title); $post_title = safe_html($title);
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url))); $post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$description = safe_html($description); $description = safe_html($description);
@ -604,10 +606,17 @@ function add_sub_page($title, $url, $content, $static, $draft, $description = nu
function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft, $destination = null, $description = null, $static = null) function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft, $destination = null, $description = null, $static = null)
{ {
$dir = pathinfo($oldfile, PATHINFO_DIRNAME); $dir = pathinfo($oldfile, PATHINFO_DIRNAME);
$fn = explode('.', pathinfo($oldfile, PATHINFO_FILENAME));
if (isset($fn[1])) {
$num = $fn[0] . '.';
} else {
$num = null;
}
$views = array(); $views = array();
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
$post_title = safe_html($title); $post_title = safe_html($title);
$post_url = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$pUrl = strtolower(preg_replace(array('/[^a-zA-Z0-9 \-\p{L}]/u', '/[ -]+/', '/^-|-$/'), array('', '-', ''), remove_accent($url)));
$post_url = $num . $pUrl;
$description = safe_html($description); $description = safe_html($description);
if ($description !== null) { if ($description !== null) {
if (!empty($description)) { if (!empty($description)) {
@ -663,10 +672,16 @@ function edit_page($title, $url, $content, $oldfile, $revertPage, $publishDraft,
} }
} }
$cl = explode('.', $post_url);
if (isset($cl[1])) {
$pu = $cl[1];
} else {
$pu = $post_url;
}
if (!empty($static)) { if (!empty($static)) {
$posturl = site_url() . $static .'/'. $post_url;
$posturl = site_url() . $static .'/'. $pu;
} else { } else {
$posturl = site_url() . $post_url;
$posturl = site_url() . $pu;
} }
rebuilt_cache('all'); rebuilt_cache('all');
@ -957,14 +972,20 @@ function find_draft_page($static = null)
$post = new stdClass; $post = new stdClass;
// The static page URL // The static page URL
$url= $v['filename'];
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$url = $fn[1];
} else {
$url= $v['filename'];
}
$post->url = site_url() . $url; $post->url = site_url() . $url;
$post->file = $v['dirname'] . '/' . $v['basename']; $post->file = $v['dirname'] . '/' . $v['basename'];
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
$post->md = $url;
$post->md = $v['basename'];
$post->slug = $url; $post->slug = $url;
$post->parent = null; $post->parent = null;
@ -1010,8 +1031,14 @@ function find_draft_subpage($static = null, $sub_static = null)
$post = new stdClass; $post = new stdClass;
// The static file
$url= $v['filename'];
// The static page URL
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$url = $fn[1];
} else {
$url= $v['filename'];
}
if (is_null($static)) { if (is_null($static)) {
$parent = str_replace('content/static/', '', dirname($v['dirname'])); $parent = str_replace('content/static/', '', dirname($v['dirname']));
@ -1025,7 +1052,7 @@ function find_draft_subpage($static = null, $sub_static = null)
$post->file = $v['dirname'] . '/' . $v['basename']; $post->file = $v['dirname'] . '/' . $v['basename'];
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
$post->md = $url;
$post->md = $v['basename'];
$post->slug = $url; $post->slug = $url;
// Get the contents and convert it to HTML // Get the contents and convert it to HTML
@ -1463,3 +1490,60 @@ function rename_category_folder($new_name, $old_file)
} }
} }
// reorder the static page
function reorder_pages($pages = null)
{
$i = 1;
$arr = array();
$dir = 'content/static/';
foreach ($pages as $p) {
$fn = pathinfo($p, PATHINFO_FILENAME);
$num = str_pad($i, 2, 0, STR_PAD_LEFT);
$arr = explode('.' , $fn);
if (isset($arr[1])) {
rename ($dir . $p, $dir . $num . '.' . $arr[1] . '.md');
if (is_dir($dir . $fn)) {
rename($dir . $fn, $dir . $num . '.' . $arr[1]);
}
} else {
rename($dir . $p, $dir . $num . '.' . $fn . '.md');
if (is_dir($dir . $fn)) {
rename($dir . $fn, $dir . $num . '.' . $fn);
}
}
$i++;
}
rebuilt_cache();
}
// reorder the subpage
function reorder_subpages($subpages = null)
{
$i = 1;
$arr = array();
$dir = 'content/static/';
foreach ($subpages as $sp) {
$dn = $dir . pathinfo($sp, PATHINFO_DIRNAME) . '/';
$fn = pathinfo($sp, PATHINFO_FILENAME);
$num = str_pad($i, 2, 0, STR_PAD_LEFT);
$arr = explode('.' , $fn);
if (isset($arr[1])) {
rename ($dir . $sp, $dn . $num . '.' . $arr[1] . '.md');
} else {
rename($dir . $sp, $dn . $num . '.' . $fn . '.md');
}
$i++;
}
rebuilt_cache();
}

+ 1
- 1
system/admin/views/add-content.html.php View File

@ -98,7 +98,7 @@ $( function() {
<label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label> <label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label>
<select id="pCategory" class="form-control" name="category"> <select id="pCategory" class="form-control" name="category">
<?php foreach ($desc as $d):?> <?php foreach ($desc as $d):?>
<option value="<?php echo $d->md;?>"><?php echo $d->title;?></option>
<option value="<?php echo $d->slug;?>"><?php echo $d->title;?></option>
<?php endforeach;?> <?php endforeach;?>
</select> </select>
<br> <br>


+ 9
- 5
system/admin/views/categories.html.php View File

@ -7,20 +7,24 @@ $desc = get_category_info(null);
<a class="btn btn-primary " href="<?php echo site_url();?>add/category"><?php echo i18n('Add_category');?></a> <a class="btn btn-primary " href="<?php echo site_url();?>add/category"><?php echo i18n('Add_category');?></a>
<br><br> <br><br>
<table class="table category-list"> <table class="table category-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Name');?></th> <th><?php echo i18n('Name');?></th>
<th><?php echo i18n('Description');?></th> <th><?php echo i18n('Description');?></th>
<th><?php echo i18n('Contents');?></th> <th><?php echo i18n('Contents');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($desc as $d):?> <?php foreach ($desc as $d):?>
<tr> <tr>
<td><a href="<?php echo site_url();?>admin/categories/<?php echo $d->md;?>"><?php echo $d->title;?></a></td>
<td><a href="<?php echo site_url();?>admin/categories/<?php echo $d->slug;?>"><?php echo $d->title;?></a></td>
<td><?php echo $d->body;?></td> <td><?php echo $d->body;?></td>
<td><?php $total = get_draftcount($d->md) + $d->count + get_scheduledcount($d->md); echo $total?></td>
<?php if($d->md !== 'uncategorized'):?>
<td><a class="btn btn-primary btn-xs" href="<?php echo $d->url;?>/edit?destination=admin/categories"><?php echo i18n('Edit');?></a> <?php if ($d->count == 0 && get_draftcount($d->md) == 0 && get_scheduledcount($d->md) == 0){echo '<a class="btn btn-danger btn-xs" href="' . $d->url . '/delete?destination=admin/categories">' . i18n('Delete') . '</a>';}?></td>
<?php endif;?>
<td><?php $total = get_draftcount($d->slug) + $d->count + get_scheduledcount($d->slug); echo $total?></td>
<?php if($d->slug !== 'uncategorized'):?>
<td><a class="btn btn-primary btn-xs" href="<?php echo $d->url;?>/edit?destination=admin/categories"><?php echo i18n('Edit');?></a> <?php if ($d->count == 0 && get_draftcount($d->slug) == 0 && get_scheduledcount($d->slug) == 0){echo '<a class="btn btn-danger btn-xs" href="' . $d->url . '/delete?destination=admin/categories">' . i18n('Delete') . '</a>';}?></td>
<?php endif;?>
</tr> </tr>
<?php endforeach;?> <?php endforeach;?>
</tbody>
</table> </table>

+ 6
- 2
system/admin/views/category-list.html.php View File

@ -6,18 +6,21 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Published');?></th> <th><?php echo i18n('Published');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<tr> <tr>
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td> <td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
<td><?php echo format_date($p->date) ?></td> <td><?php echo format_date($p->date) ?></td>
<?php if ($category->url !== site_url() . 'category/uncategorized') {?> <?php if ($category->url !== site_url() . 'category/uncategorized') {?>
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/<?php echo $category->md;?>"><?php echo i18n('Edit');?></a> <a
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/<?php echo $category->md;?>"><?php echo i18n('Delete');?></a></td>
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/<?php echo $category->slug;?>"><?php echo i18n('Edit');?></a> <a
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/<?php echo $category->slug;?>"><?php echo i18n('Delete');?></a></td>
<?php } else {?> <?php } else {?>
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/uncategorized"><?php echo i18n('Edit');?></a> <a <td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/categories/uncategorized"><?php echo i18n('Edit');?></a> <a
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/uncategorized"><?php echo i18n('Delete');?></a></td> class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/categories/uncategorized"><?php echo i18n('Delete');?></a></td>
@ -25,6 +28,7 @@
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?> <?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
<br> <br>


+ 1
- 1
system/admin/views/edit-content.html.php View File

@ -143,7 +143,7 @@ $( function() {
<label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label> <label for="pCategory"><?php echo i18n('Category');?> <span class="required">*</span></label>
<select id="pCategory" class="form-control" name="category"> <select id="pCategory" class="form-control" name="category">
<?php foreach ($desc as $d):?> <?php foreach ($desc as $d):?>
<option value="<?php echo $d->md;?>" <?php if($category === $d->md) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
<option value="<?php echo $d->slug;?>" <?php if($category === $d->slug) { echo 'selected="selected"';} ?>><?php echo $d->title;?></option>
<?php endforeach;?> <?php endforeach;?>
</select> </select>
<br> <br>


+ 9
- 3
system/admin/views/edit-page.html.php View File

@ -34,8 +34,8 @@ if ($type == 'is_frontpage') {
$oldtitle = $p->title; $oldtitle = $p->title;
$olddescription = $p->description; $olddescription = $p->description;
$oldcontent = $p->body; $oldcontent = $p->body;
$oldmd = $p->md;
$url = 'content/data/category/'. $p->md . '.md';
$oldmd = $p->slug;
$url = 'content/data/category/'. $p->slug . '.md';
} else { } else {
if (isset($p->file)) { if (isset($p->file)) {
@ -55,7 +55,13 @@ if ($type == 'is_frontpage') {
} }
$dir = pathinfo($url, PATHINFO_DIRNAME); $dir = pathinfo($url, PATHINFO_DIRNAME);
$oldurl = pathinfo($url, PATHINFO_BASENAME); $oldurl = pathinfo($url, PATHINFO_BASENAME);
$oldmd = pathinfo($url, PATHINFO_FILENAME);
$fn = explode('.', pathinfo($url, PATHINFO_FILENAME));
if (isset($fn[1])) {
$oldmd = $fn[1];
} else {
$oldmd = pathinfo($url, PATHINFO_FILENAME);
}
if (isset($p->url)) { if (isset($p->url)) {
$delete = $p->url . '/delete?destination=' . $destination; $delete = $p->url . '/delete?destination=' . $destination;


+ 1
- 0
system/admin/views/layout.html.php View File

@ -10,6 +10,7 @@
<link href="<?php echo site_url() ?>system/resources/css/adminlte.min.css" rel="stylesheet"> <link href="<?php echo site_url() ?>system/resources/css/adminlte.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script> <script src="<?php echo site_url() ?>system/resources/js/jquery.min.js"></script>
<script src="<?php echo site_url() ?>system/resources/js/jquery-ui.min.js"></script>
</head> </head>
<?php if (login()) { ?> <?php if (login()) { ?>
<body class="hold-transition sidebar-mini"> <body class="hold-transition sidebar-mini">


+ 1
- 0
system/admin/views/menu.html.php View File

@ -107,6 +107,7 @@ function parseMenu($menu) {
data: {'json': js}, data: {'json': js},
success: function (response) { success: function (response) {
alert(response.message); alert(response.message);
location.reload();
}, },
}); });
}); });


+ 4
- 0
system/admin/views/popular-posts.html.php View File

@ -5,6 +5,7 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?> <th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
@ -14,6 +15,8 @@
<th><?php echo i18n('Tags');?></th> <th><?php echo i18n('Tags');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<?php if (strpos($p->file, '/scheduled/') == false && strpos($p->file, '/draft/') == false) { ?> <?php if (strpos($p->file, '/scheduled/') == false && strpos($p->file, '/draft/') == false) { ?>
<tr> <tr>
@ -29,6 +32,7 @@
</tr> </tr>
<?php } ?> <?php } ?>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php } else { <?php } else {
echo i18n('No_posts_found') . '!'; echo i18n('No_posts_found') . '!';

+ 4
- 0
system/admin/views/posts-list.html.php View File

@ -5,6 +5,7 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?> <th><?php echo i18n('Published');?></th><?php if (config("views.counter") == "true"): ?>
@ -14,6 +15,8 @@
<th><?php echo i18n('Tags');?></th> <th><?php echo i18n('Tags');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<tr> <tr>
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td> <td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
@ -27,6 +30,7 @@
class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/posts"><?php echo i18n('Delete');?></a></td> class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/posts"><?php echo i18n('Delete');?></a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?> <?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
<br> <br>


+ 4
- 0
system/admin/views/scheduled.html.php View File

@ -5,6 +5,7 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Publish');?></th> <th><?php echo i18n('Publish');?></th>
@ -12,6 +13,8 @@
<th><?php echo i18n('Tags');?></th> <th><?php echo i18n('Tags');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<tr> <tr>
<td><?php echo $p->title ?></td> <td><?php echo $p->title ?></td>
@ -21,6 +24,7 @@
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/scheduled"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/scheduled"><?php echo i18n('Delete');?></a></td> <td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/scheduled"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/scheduled"><?php echo i18n('Delete');?></a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?> <?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
<br> <br>


+ 50
- 34
system/admin/views/static-pages.html.php View File

@ -3,52 +3,68 @@
<br> <br>
<a class="btn btn-primary right" href="<?php echo site_url();?>add/page"><?php echo i18n('Add_new_page');?></a> <a class="btn btn-primary right" href="<?php echo site_url();?>add/page"><?php echo i18n('Add_new_page');?></a>
<br><br> <br><br>
<script>
$(function() {
var order;
$( "tbody" ).sortable({update: function(e, ui) {
order = $(this).sortable('toArray');
$("#saveButton").css({"display": "block"});
}});
$("#saveButton").click(function(){
$.ajax({
type: 'POST',
url: '<?php echo site_url();?>admin/pages',
dataType: 'json',
data: {'json': order},
success: function (response) {
alert(response.message);
location.reload();
},
});
});
});
</script>
<?php if (isset($_SESSION[site_url()]['user'])):?> <?php if (isset($_SESSION[site_url()]['user'])):?>
<?php $posts = find_page(); <?php $posts = find_page();
if (!empty($posts)): ?> if (!empty($posts)): ?>
<table class="table post-list">
<tr class="head">
<table class="table post-list" id="sortable">
<thead>
<tr class="head" id="head">
<th><?php echo i18n('Title');?> </th> <th><?php echo i18n('Title');?> </th>
<?php if (config("views.counter") == "true"):?>
<th><?php echo i18n('Views');?></th>
<?php endif;?>
<th><?php echo i18n('Description');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
<th>Subpages</th> <th>Subpages</th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p):?> <?php foreach ($posts as $p):?>
<?php $dd = find_subpage($p->md); ?>
<?php $dr = find_draft_subpage($p->md);?>
<tr>
<td><a target="_blank" href="<?php echo $p->url;?>"><?php echo $p->title;?></a></td>
<?php if (config("views.counter") == "true"):?>
<td><i class="nav-icon fa fa-line-chart"></i> <?php echo $p->views;?></td>
<?php endif;?>
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/add?destination=admin/pages"><?php echo i18n('Add_sub');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <?php if (empty($dd) && empty($dr)):?><a class="btn btn-danger btn-xs" href="<?php echo $p->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a><?php endif;?></td>
<?php $dd = find_subpage($p->slug); ?>
<?php $dr = find_draft_subpage($p->slug);?>
<tr id="<?php echo $p->md;?>" class="sort-item" style="cursor:move;">
<td><a href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>"><?php echo $p->title;?></a></td>
<td><?php echo shorten($p->description, '50');?>...</td>
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/add?destination=admin/pages/<?php echo $p->slug;?>"><?php echo i18n('Add_sub');?></a> <a class="btn btn-primary btn-xs" href="<?php echo $p->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <?php if (empty($dd) && empty($dr)):?><a class="btn btn-danger btn-xs" href="<?php echo $p->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a><?php endif;?></td>
<td> <td>
<table>
<?php $subPages = find_subpage($p->md);
foreach ($subPages as $sp):?>
<div class="row">
<div class="col-6 col-md-4">
<span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
</div>
<div class="col-6 col-md-4">
<?php if (config("views.counter") == "true"):?>
<span><i class="nav-icon fa fa-line-chart"></i> <?php echo $sp->views;?></span>
<?php endif;?></div>
<div class="col-6 col-md-4">
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a></span>
</div>
</div>
<?php endforeach;?>
</table>
<div><a class="btn btn-primary btn-xs" href="<?php echo site_url();?>admin/pages/<?php echo $p->slug;?>">Manage subpages</a></div><hr>
<?php foreach ($dd as $sp):?>
<div class="row">
<div class="col-sm">
<span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
</div>
<div class="col-sm">
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages"><?php echo i18n('Delete');?></a></span>
</div>
</div>
<?php endforeach;?>
</td> </td>
</tr> </tr>
<?php endforeach;?> <?php endforeach;?>
</tbody>
</table> </table>
<br>
<button class="btn btn-primary" style="display:none" id="saveButton">Save page order</button>
<?php endif;?> <?php endif;?>
<?php endif;?> <?php endif;?>

+ 57
- 0
system/admin/views/static-subpages.html.php View File

@ -0,0 +1,57 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<a href="<?php echo $static->url;?>/edit?destination=admin/pages"><?php echo i18n('Edit');?></a>
<h2 class="post-index"><?php echo $static->title ?></h2>
<div><?php echo $static->description;?></div>
<br>
<a class="btn btn-primary right" href="<?php echo $static->url;?>/add?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Add_sub');?></a>
<br><br>
<script>
$(function() {
var order;
$( "tbody" ).sortable({update: function(e, ui) {
order = $(this).sortable('toArray');
$("#saveButton").css({"display": "block"});
}});
$("#saveButton").click(function(){
$.ajax({
type: 'POST',
url: '<?php echo site_url();?>admin/pages/<?php echo $static->slug;?>',
dataType: 'json',
data: {'json': order},
success: function (response) {
alert(response.message);
location.reload();
},
});
});
});
</script>
<?php $posts = find_subpage($p->slug);?>
<?php if (!empty($posts)) { ?>
<table class="table post-list">
<thead>
<tr class="head">
<th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Description');?></th>
<th><?php echo i18n('Operations');?></th>
</tr>
</thead>
<tbody>
<?php foreach ($posts as $sp): ?>
<tr id="<?php echo $sp->parent;?>/<?php echo $sp->md;?>" style="cursor:move;">
<td><a href="<?php echo $sp->url ?>"><?php echo $sp->title ?></a></td>
<td><?php echo $sp->description;?></td>
<td> <span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $static->slug;?>"><?php echo i18n('Delete');?></a></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<br>
<button class="btn btn-primary" style="display:none" id="saveButton">Save page order</button>
<?php } else {
echo i18n('No_posts_found') . '!';
} ?>

+ 8
- 4
system/admin/views/user-draft.html.php View File

@ -5,6 +5,7 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Created');?></th> <th><?php echo i18n('Created');?></th>
@ -12,6 +13,8 @@
<th><?php echo i18n('Tags');?></th> <th><?php echo i18n('Tags');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<tr> <tr>
<td><?php echo $p->title ?></td> <td><?php echo $p->title ?></td>
@ -21,6 +24,7 @@
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td> <td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?> <?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
<br> <br>
@ -55,7 +59,7 @@
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
<?php foreach ($draftPages as $d): ?> <?php foreach ($draftPages as $d): ?>
<?php $count = count(find_subpage($d->md)); ?>
<?php $count = count(find_subpage($d->md)); ?>
<tr> <tr>
<td><?php echo $d->title ?></td> <td><?php echo $d->title ?></td>
<td><?php echo format_date($d->lastMod) ?></td> <td><?php echo format_date($d->lastMod) ?></td>
@ -74,15 +78,15 @@
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Created');?></th> <th><?php echo i18n('Created');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
<th><?php echo i18n('Static_pages');?></th>
<th><?php echo i18n('Static_pages');?></th>
</tr> </tr>
<?php foreach ($draftSubpages as $sp): ?> <?php foreach ($draftSubpages as $sp): ?>
<?php $parent = find_page($sp->parent);?>
<?php $parent = find_page($sp->parent);?>
<tr> <tr>
<td><?php echo $sp->title ?></td> <td><?php echo $sp->title ?></td>
<td><?php echo format_date($sp->lastMod) ?></td> <td><?php echo format_date($sp->lastMod) ?></td>
<td><a class="btn btn-primary btn-xs" href="<?php echo $sp->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td> <td><a class="btn btn-primary btn-xs" href="<?php echo $sp->url ?>/edit?destination=admin/draft"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url ?>/delete?destination=admin/draft"><?php echo i18n('Delete');?></a></td>
<td><a href="<?php echo $parent['current']->url;?>"><?php echo $parent['current']->title;?></a></td>
<td><a href="<?php echo $parent['current']->url;?>"><?php echo $parent['current']->title;?></a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>

+ 4
- 0
system/admin/views/user-posts.html.php View File

@ -5,6 +5,7 @@
<br><br> <br><br>
<?php if (!empty($posts)) { ?> <?php if (!empty($posts)) { ?>
<table class="table post-list"> <table class="table post-list">
<thead>
<tr class="head"> <tr class="head">
<th><?php echo i18n('Title');?></th> <th><?php echo i18n('Title');?></th>
<th><?php echo i18n('Published');?></th> <th><?php echo i18n('Published');?></th>
@ -15,6 +16,8 @@
<th><?php echo i18n('Tags');?></th> <th><?php echo i18n('Tags');?></th>
<th><?php echo i18n('Operations');?></th> <th><?php echo i18n('Operations');?></th>
</tr> </tr>
</thead>
<tbody>
<?php foreach ($posts as $p): ?> <?php foreach ($posts as $p): ?>
<tr> <tr>
<td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td> <td><a target="_blank" href="<?php echo $p->url ?>"><?php echo $p->title ?></a></td>
@ -27,6 +30,7 @@
<td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/mine"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/mine"><?php echo i18n('Delete');?></a></td> <td><a class="btn btn-primary btn-xs" href="<?php echo $p->url ?>/edit?destination=admin/mine"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $p->url ?>/delete?destination=admin/mine"><?php echo i18n('Delete');?></a></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody>
</table> </table>
<?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?> <?php if (!empty($pagination['prev']) || !empty($pagination['next'])): ?>
<br> <br>


+ 85
- 4
system/htmly.php View File

@ -1122,6 +1122,87 @@ get('/admin/pages', function () {
die; die;
}); });
post('/admin/pages', function () {
if (login()) {
$json = from($_REQUEST, 'json');
reorder_pages($json);
echo json_encode(array(
'message' => 'Page order saved successfully!',
));
}
});
// Show admin/pages
get('/admin/pages/:static', function ($static)
{
$user = $_SESSION[site_url()]['user'];
$role = user('role', $user);
if (login()) {
config('views.root', 'system/admin/views');
if ($role === 'admin') {
$post = find_page($static);
if (!$post) {
not_found();
}
if (array_key_exists('prev', $post)) {
$prev = $post['prev'];
} else {
$prev = array();
}
if (array_key_exists('next', $post)) {
$next = $post['next'];
} else {
$next = array();
}
$post = $post['current'];
render('static-subpages', array(
'title' => $post->title . ' - ' . blog_title(),
'description' => $post->description,
'canonical' => $post->url,
'bodyclass' => 'in-page ' . strtolower($static),
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; ' . '<a href="'. site_url() .'admin/pages">Pages</a> &#187; ' . $post->title,
'p' => $post,
'static' => $post,
'type' => 'staticSubpage',
'prev' => static_prev($prev),
'next' => static_next($next),
'is_page' => true
));
} else {
render('denied', array(
'title' => 'Pages - ' . blog_title(),
'description' => strip_tags(blog_description()),
'canonical' => site_url(),
'type' => 'is_admin-pages',
'is_admin' => true,
'bodyclass' => 'denied',
'breadcrumb' => '',
));
}
} else {
$login = site_url() . 'login';
}
});
post('/admin/pages/:static', function ($static) {
if (login()) {
$json = from($_REQUEST, 'json');
reorder_subpages($json);
echo json_encode(array(
'message' => 'Page order saved successfully!',
));
}
});
// Show import page // Show import page
get('/admin/import', function () { get('/admin/import', function () {
if (login()) { if (login()) {
@ -2969,7 +3050,7 @@ get('/:static', function ($static) {
if (!$post) { if (!$post) {
not_found(); not_found();
} }
if (array_key_exists('prev', $post)) { if (array_key_exists('prev', $post)) {
$prev = $post['prev']; $prev = $post['prev'];
} else { } else {
@ -3048,7 +3129,7 @@ get('/:static/add', function ($static) {
'type' => 'is_page', 'type' => 'is_page',
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'add-page', 'bodyclass' => 'add-page',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . $post->url . '">' . $post->title . '</a> &#187; ' . i18n('Add_new_page')
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . site_url() . 'admin/pages/' . $post->slug . '">' . $post->title . '</a> &#187; ' . i18n('Add_new_page')
)); ));
} else { } else {
$login = site_url() . 'login'; $login = site_url() . 'login';
@ -3355,7 +3436,7 @@ get('/:static/:sub/edit', function ($static, $sub) {
'canonical' => site_url(), 'canonical' => site_url(),
'bodyclass' => 'edit-page', 'bodyclass' => 'edit-page',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . $post->url . '">' . $post->title . '</a> &#187; ' . $page->title,
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . site_url() . 'admin/pages/' . $post->slug . '">' . $post->title . '</a> &#187; ' . $page->title,
'p' => $page, 'p' => $page,
'static' => $page, 'static' => $page,
'type' => 'subPage', 'type' => 'subPage',
@ -3457,7 +3538,7 @@ get('/:static/:sub/delete', function ($static, $sub) {
'canonical' => site_url(), 'canonical' => site_url(),
'bodyclass' => 'delete-page', 'bodyclass' => 'delete-page',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . $post->url . '">' . $post->title . '</a> &#187; ' . $page->title,
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; <a href="' . site_url() . 'admin/pages/' . $post->slug . '">' . $post->title . '</a> &#187; ' . $page->title,
'p' => $page, 'p' => $page,
'static' => $page, 'static' => $page,
'type' => 'subPage', 'type' => 'subPage',


+ 1
- 1
system/includes/dispatch.php View File

@ -380,7 +380,7 @@ function render($view, $locals = null, $layout = null)
if (($view_root = config('views.root')) == null) if (($view_root = config('views.root')) == null)
error(500, "[views.root] is not set"); error(500, "[views.root] is not set");
$fnc = "{$view_root}/functions.php"; $fnc = "{$view_root}/functions.php";
ob_start(); ob_start();


+ 71
- 28
system/includes/functions.php View File

@ -52,7 +52,7 @@ function get_static_subpages($static = null)
$stringLen = strlen($static); $stringLen = strlen($static);
return array_filter($_sub_page, function ($sub_page) use ($static, $stringLen) { return array_filter($_sub_page, function ($sub_page) use ($static, $stringLen) {
$x = explode("/", $sub_page['dirname']); $x = explode("/", $sub_page['dirname']);
if ($x[2] == $static) {
if (strpos($x[2], $static) !== false) {
return true; return true;
} }
return false; return false;
@ -126,7 +126,7 @@ function get_draft_subpages($static = null)
$stringLen = strlen($static); $stringLen = strlen($static);
return array_filter($_draftSubpage, function ($sub_page) use ($static, $stringLen) { return array_filter($_draftSubpage, function ($sub_page) use ($static, $stringLen) {
$x = explode("/", $sub_page['dirname']); $x = explode("/", $sub_page['dirname']);
if ($x[2] == $static) {
if (strpos($x[2], $static) !== false) {
return true; return true;
} }
return false; return false;
@ -544,14 +544,20 @@ function get_pages($pages, $page = 1, $perpage = 0)
$post = new stdClass; $post = new stdClass;
// The static page URL // The static page URL
$url= $v['filename'];
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$url = $fn[1];
} else {
$url= $v['filename'];
}
$post->url = site_url() . $url; $post->url = site_url() . $url;
$post->file = $v['dirname'] . '/' . $v['basename']; $post->file = $v['dirname'] . '/' . $v['basename'];
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
$post->md = $url;
$post->md = $v['basename'];
$post->slug = $url; $post->slug = $url;
$post->parent = null; $post->parent = null;
@ -597,18 +603,32 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
$post = new stdClass; $post = new stdClass;
$static = str_replace(dirname($v['dirname']) . '/', '', $v['dirname']);
$fd = str_replace(dirname($v['dirname']) . '/', '', $v['dirname']);
$st = explode('.', $fd);
if (isset($st[1])) {
$static = $st[1];
} else {
$static = $fd;
}
// The static page URL // The static page URL
$url= $v['filename'];
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$url = $fn[1];
} else {
$url= $v['filename'];
}
$post->url = site_url() . $static . "/" . $url; $post->url = site_url() . $static . "/" . $url;
$post->file = $v['dirname'] . '/' . $v['basename']; $post->file = $v['dirname'] . '/' . $v['basename'];
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file))); $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
$post->md = $url;
$post->md = $v['basename'];
$post->slug = $url; $post->slug = $url;
$post->parent = $static;
$post->parent = $fd;
// Get the contents and convert it to HTML // Get the contents and convert it to HTML
$content = file_get_contents($post->file); $content = file_get_contents($post->file);
@ -877,7 +897,7 @@ function read_category_info($category)
$desc->url = site_url() . 'category/' . $url; $desc->url = site_url() . 'category/' . $url;
$desc->md = $url;
$desc->md = $v['basename'];
$desc->slug = $url; $desc->slug = $url;
@ -914,16 +934,16 @@ function default_category($category = null)
$desc->url = site_url() . 'category/uncategorized'; $desc->url = site_url() . 'category/uncategorized';
$desc->slug = 'uncategorized'; $desc->slug = 'uncategorized';
$desc->body = '<p>' . i18n('Uncategorized_comment') . '</p>'; $desc->body = '<p>' . i18n('Uncategorized_comment') . '</p>';
$desc->md = 'uncategorized';
$desc->md = 'uncategorized.md';
$desc->description = i18n('Uncategorized_comment'); $desc->description = i18n('Uncategorized_comment');
$desc->file = ''; $desc->file = '';
$desc->count = get_categorycount($desc->md);
$desc->count = get_categorycount($desc->slug);
} else { } else {
$desc->title = $category; $desc->title = $category;
$desc->url = site_url() . 'category/' . $category; $desc->url = site_url() . 'category/' . $category;
$desc->slug = $category; $desc->slug = $category;
$desc->body = '<p>' . i18n('All_blog_posts') . ': ' . $category . '</p>'; $desc->body = '<p>' . i18n('All_blog_posts') . ': ' . $category . '</p>';
$desc->md = $category;
$desc->md = $category . '.md';
$desc->description = i18n('All_blog_posts') . ': ' . $category; $desc->description = i18n('All_blog_posts') . ': ' . $category;
$desc->file = ''; $desc->file = '';
$desc->count = get_categorycount($category); $desc->count = get_categorycount($category);
@ -950,7 +970,7 @@ function category_list($custom = null) {
} else { } else {
$arr = get_category_info(null); $arr = get_category_info(null);
foreach ($arr as $i => $a) { foreach ($arr as $i => $a) {
$cat[] = array($a->md, $a->title, $a->count, $a->description);
$cat[] = array($a->slug, $a->title, $a->count, $a->description);
} }
$tmp = serialize($cat); $tmp = serialize($cat);
@ -2447,7 +2467,7 @@ function get_title_from_file($v)
} }
// Auto generate menu from static page // Auto generate menu from static page
function get_menu($custom)
function get_menu($custom = null, $auto = null)
{ {
$posts = get_static_pages(); $posts = get_static_pages();
$req = $_SERVER['REQUEST_URI']; $req = $_SERVER['REQUEST_URI'];
@ -2457,17 +2477,20 @@ function get_menu($custom)
asort($posts); asort($posts);
echo '<ul class="nav ' . $custom . '">'; echo '<ul class="nav ' . $custom . '">';
if ($req == site_path() . '/' || stripos($req, site_path() . '/?page') !== false) {
echo '<li class="item first active"><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></li>';
} else {
echo '<li class="item first"><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></li>';
}
if (config('blog.enable') == 'true' ) {
if ($req == site_path() . '/blog' || stripos($req, site_path() . '/blog?page') !== false) {
echo '<li class="item active"><a href="' . site_url() . 'blog">' . 'Blog' . '</a></li>';
if (is_null($auto)) {
if ($req == site_path() . '/' || stripos($req, site_path() . '/?page') !== false) {
echo '<li class="item first active"><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></li>';
} else { } else {
echo '<li class="item"><a href="' . site_url() . 'blog">' . 'Blog' . '</a></li>';
echo '<li class="item first"><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></li>';
}
if (config('blog.enable') == 'true' ) {
if ($req == site_path() . '/blog' || stripos($req, site_path() . '/blog?page') !== false) {
echo '<li class="item active"><a href="' . site_url() . 'blog">' . 'Blog' . '</a></li>';
} else {
echo '<li class="item"><a href="' . site_url() . 'blog">' . 'Blog' . '</a></li>';
}
} }
} }
@ -2484,7 +2507,15 @@ function get_menu($custom)
$i++; $i++;
// Filename string // Filename string
$filename= $v['filename'];
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$filename= $fn[1];
} else {
$filename= $v['filename'];
}
$url = site_url() . $filename; $url = site_url() . $filename;
$parent_file = $v['dirname'] . '/' . $v['basename']; $parent_file = $v['dirname'] . '/' . $v['basename'];
@ -2514,7 +2545,13 @@ function get_menu($custom)
$classSub .= " last"; $classSub .= " last";
} }
$baseSub= $sp['filename'];
$bs = explode('.', $sp['filename']);
if (isset($bs[1])) {
$baseSub = $bs[1];
} else {
$baseSub= $sp['filename'];
}
$child_file = $sp['dirname'] . '/' . $sp['basename']; $child_file = $sp['dirname'] . '/' . $sp['basename'];
if ($req == site_path() . "/" . $filename . "/" . $baseSub) { if ($req == site_path() . "/" . $filename . "/" . $baseSub) {
$classSub .= ' active'; $classSub .= ' active';
@ -2721,9 +2758,15 @@ function sitemap_page_path()
foreach ($posts as $index => $v) { foreach ($posts as $index => $v) {
$post = new stdClass; $post = new stdClass;
$fn = explode('.', $v['filename']);
if (isset($fn[1])) {
$filename = $fn[1];
} else {
$filename= $v['filename'];
}
// Filename
$filename= $v['filename'];
$file = $v['dirname'] . '/' . $v['basename']; $file = $v['dirname'] . '/' . $v['basename'];
$post->url = site_url() . $filename; $post->url = site_url() . $filename;
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($file))); $post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($file)));


+ 10
- 3
system/resources/js/jquery-ui.min.js
File diff suppressed because it is too large
View File


+ 10
- 0
themes/doks/404-search.html.php View File

@ -0,0 +1,10 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<article>
<div class="blog-header">
<h1>Search results not found!</h1>
</div>
<div class="content-body">
<p>Please search again, or would you like to visit our <a href="<?php echo site_url() ?>">homepage</a> instead?</p>
<?php echo search() ?>
</div>
</article>

+ 10
- 0
themes/doks/404.html.php View File

@ -0,0 +1,10 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<article>
<div class="blog-header">
<h1>This page doesn't exist!</h1>
</div>
<div class="content-body">
<p>Please search to find what you're looking for or visit our <a href="<?php echo site_url() ?>">homepage</a> instead.</p>
<?php echo search() ?>
</div>
</article>

+ 21
- 0
themes/doks/LICENSE.txt View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Hyas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

+ 16
- 0
themes/doks/README.md View File

@ -0,0 +1,16 @@
# HTMLy Doks
Documentation theme by getdoks.org ported to HTMLy
## Installations
- Upload and extract the zip file into themes directory.
- Activate it from HTMLy panel.
## Doks landing page
Go to `admin/config/reading` and choose `Front page displays` as `Static page`.
## License
See the LICENSE.txt

+ 3535
- 0
themes/doks/css/style.css
File diff suppressed because it is too large
View File


BIN
themes/doks/fonts/jost/jost-v4-latin-500.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-500.woff2 View File


BIN
themes/doks/fonts/jost/jost-v4-latin-500italic.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-500italic.woff2 View File


BIN
themes/doks/fonts/jost/jost-v4-latin-700.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-700.woff2 View File


BIN
themes/doks/fonts/jost/jost-v4-latin-700italic.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-700italic.woff2 View File


BIN
themes/doks/fonts/jost/jost-v4-latin-italic.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-italic.woff2 View File


BIN
themes/doks/fonts/jost/jost-v4-latin-regular.woff View File


BIN
themes/doks/fonts/jost/jost-v4-latin-regular.woff2 View File


BIN
themes/doks/img/soundcloud.jpg View File

Before After
Width: 600  |  Height: 338  |  Size: 29 KiB

+ 11
- 0
themes/doks/js/main.js View File

@ -0,0 +1,11 @@
(function () {
document.getElementById("mode").addEventListener("click", () => {
document.body.classList.toggle("dark");
localStorage.setItem("theme", document.body.classList.contains("dark") ? "dark" : "light");
});
if (localStorage.getItem("theme") === "dark") {
document.body.classList.add("dark");
}
})();

+ 72
- 0
themes/doks/js/toc.js View File

@ -0,0 +1,72 @@
/*jslint
white: true,
browser: true,
vars: true
*/
/**
* Generates a table of contents for your document based on the headings
* present. Anchors are injected into the document and the
* entries in the table of contents are linked to them. The table of
* contents will be generated inside of the first element with the id `toc`.
* @param {HTMLDOMDocument} documentRef Optional A reference to the document
* object. Defaults to `document`.
* @author Matthew Christopher Kastor-Inare III
* @version 20130726
* @example
* // call this after the page has loaded
* htmlTableOfContents();
*/
/**
* Modified by @danpros
* select only in #content
* using the heading title as the slug IDs
* insert the anchor inside the heading
* fix browser not scrolling to the hash
*/
function htmlTableOfContents (documentRef) {
var documentRef = documentRef || document;
var toc = documentRef.getElementById('toc');
var headings = [].slice.call(documentRef.body.querySelectorAll('#content h1, #content h2, #content h3, #content h4, #content h5, #content h6'));
headings.forEach(function (heading, index) {
heading.setAttribute('id', 'toc-' + heading.textContent.replace(/\s+/g, '-').toLowerCase());
var anchor = documentRef.createElement('a');
anchor.setAttribute('href', '#toc-' + heading.textContent.replace(/\s+/g, '-').toLowerCase());
anchor.setAttribute('class', 'anchor');
anchor.setAttribute('aria-hidden', 'true');
anchor.textContent = '#';
var link = documentRef.createElement('a');
link.setAttribute('href', '#toc-' + heading.textContent.replace(/\s+/g, '-').toLowerCase());
link.textContent = heading.textContent;
var div = documentRef.createElement('div');
div.setAttribute('class', heading.tagName.toLowerCase() + '-toc');
heading.appendChild(anchor);
div.appendChild(link);
toc.appendChild(div);
});
if (window.location.hash) {
var hash = window.location.hash;
scrollToHash(hash);
}
}
// fix browser not scrolling to the hash
function scrollToHash (hash) {
setTimeout(function() {
hashtag = hash;
location.hash = '';
location.hash = hashtag;
}, 300);
}
try {
module.exports = htmlTableOfContents;
} catch (e) {
// module.exports is not defined
}

+ 103
- 0
themes/doks/layout--static.html.php View File

@ -0,0 +1,103 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<!DOCTYPE html>
<html lang="<?php echo blog_language();?>">
<head>
<?php echo head_contents();?>
<title><?php echo $title;?></title>
<meta name="description" content="<?php echo $description; ?>"/>
<link rel="canonical" href="<?php echo $canonical; ?>" />
<link rel="preload" as="font" href="<?php echo theme_path();?>fonts/jost/jost-v4-latin-regular.woff2" type="font/woff2" crossorigin>
<link rel="preload" as="font" href="<?php echo theme_path();?>fonts/jost/jost-v4-latin-700.woff2" type="font/woff2" crossorigin>
<link rel="stylesheet" href="<?php echo theme_path();?>css/style.css">
<meta name="theme-color" content="#fff">
</head>
<body class="docs single" onload="htmlTableOfContents();">
<div class="header-bar fixed-top"></div>
<?php if (facebook()) { echo facebook(); } ?>
<?php if (login()) { toolbar(); } ?>
<header class="navbar fixed-top navbar-expand-md navbar-light">
<div class="container">
<input class="menu-btn order-0" type="checkbox" id="menu-btn">
<label class="menu-icon d-md-none" for="menu-btn"><span class="navicon"></span></label>
<a class="navbar-brand order-1 order-md-0 me-auto" href="<?php echo site_url();?>">
<?php echo blog_title();?>
</a>
<button id="mode" class="btn btn-link order-2 order-md-4" type="button" aria-label="Toggle mode">
<span class="toggle-dark"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></span>
<span class="toggle-light"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg></span>
</button>
<ul class="navbar-nav social-nav order-3 order-md-5">
<?php if(!empty(config('social.github'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.github');?>"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg><span class="ms-2 visually-hidden">GitHub</span></a>
</li>
<?php endif;?>
<?php if(!empty(config('social.twitter'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.twitter');?>"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9.0 01-3.14 1.53 4.48 4.48.0 00-7.86 3v1A10.66 10.66.0 013 4s-4 9 5 13a11.64 11.64.0 01-7 2c9 5 20 0 20-11.5a4.5 4.5.0 00-.08-.83A7.72 7.72.0 0023 3z"></path></svg><span class="ms-2 visually-hidden">Twitter</span></a>
</li>
<?php endif;?>
<?php if(!empty(config('social.facebook'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.facebook');?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-facebook" viewBox="0 0 18 18"><path d="M16 8.049c0-4.446-3.582-8.05-8-8.05C3.58 0-.002 3.603-.002 8.05c0 4.017 2.926 7.347 6.75 7.951v-5.625h-2.03V8.05H6.75V6.275c0-2.017 1.195-3.131 3.022-3.131.876 0 1.791.157 1.791.157v1.98h-1.009c-.993 0-1.303.621-1.303 1.258v1.51h2.218l-.354 2.326H9.25V16c3.824-.604 6.75-3.934 6.75-7.951"/></svg><span class="ms-2 visually-hidden">Twitter</span></a>
</li>
<?php endif;?>
</ul>
<div class="collapse navbar-collapse order-4 order-md-1 top-menu">
<?php
// just to make sure only print the content from custom menu
$filename = "content/data/menu.json";
if (file_exists($filename)) {
$json = json_decode(file_get_contents('content/data/menu.json', true));
$menus = json_decode($json);
if (!empty($menus)) {
echo menu();
}
} ?>
</div>
</div>
</header>
<div class="wrap container" role="document">
<div class="content">
<div class="row flex-xl-nowrap">
<div class="col-lg-5 col-xl-4 docs-bar">
<input class="menu-btn order-0 float-right" type="checkbox" id="menu-btn2">
<label class="menu-icon float-right" for="menu-btn2"><span class="navicon"></span></label>
<div class="docs-sidebar">
<nav class="docs-links" aria-label="Main navigation">
<?php echo get_menu('list-unstyled collapsible-sidebar', false);?>
</nav>
</div>
</div>
<?php echo content();?>
</div>
</div>
</div>
<footer class="footer text-muted">
<div class="container">
<div class="row">
<div class="col-lg-8 order-last order-lg-first">
<ul class="list-inline">
<li class="list-inline-item"><?php echo copyright();?></li>
</ul>
</div>
<div class="col-lg-8 order-last order-lg-last text-lg-end">
<ul class="list-inline">
<li class="list-inline-item">Design by <a href="https://getdoks.org/" target="_blank" rel="nofollow">Doks</a></li>
</ul>
</div>
</div>
</div>
</footer>
<script src="<?php echo theme_path();?>js/toc.js"></script>
<script src="<?php echo theme_path();?>js/main.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
</body>
</html>

+ 135
- 0
themes/doks/layout.html.php View File

@ -0,0 +1,135 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<!DOCTYPE html>
<html lang="<?php echo blog_language();?>">
<head>
<?php echo head_contents();?>
<title><?php echo $title;?></title>
<meta name="description" content="<?php echo $description; ?>"/>
<link rel="canonical" href="<?php echo $canonical; ?>" />
<link rel="preload" as="font" href="<?php echo theme_path();?>fonts/jost/jost-v4-latin-regular.woff2" type="font/woff2" crossorigin>
<link rel="preload" as="font" href="<?php echo theme_path();?>fonts/jost/jost-v4-latin-700.woff2" type="font/woff2" crossorigin>
<link rel="stylesheet" href="<?php echo theme_path();?>css/style.css">
<meta name="theme-color" content="#fff">
</head>
<body class="blog list">
<div class="header-bar fixed-top"></div>
<?php if (facebook()) { echo facebook(); } ?>
<?php if (login()) { toolbar(); } ?>
<header class="navbar fixed-top navbar-expand-md navbar-light">
<div class="container">
<input class="menu-btn order-0" type="checkbox" id="menu-btn">
<label class="menu-icon d-md-none" for="menu-btn"><span class="navicon"></span></label>
<a class="navbar-brand order-1 order-md-0 me-auto" href="<?php echo site_url();?>">
<?php echo blog_title();?>
</a>
<button id="mode" class="btn btn-link order-2 order-md-4" type="button" aria-label="Toggle mode">
<span class="toggle-dark"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-moon"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg></span>
<span class="toggle-light"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-sun"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg></span>
</button>
<ul class="navbar-nav social-nav order-3 order-md-5">
<?php if(!empty(config('social.github'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.github');?>"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg><span class="ms-2 visually-hidden">GitHub</span></a>
</li>
<?php endif;?>
<?php if(!empty(config('social.twitter'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.twitter');?>"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-twitter"><path d="M23 3a10.9 10.9.0 01-3.14 1.53 4.48 4.48.0 00-7.86 3v1A10.66 10.66.0 013 4s-4 9 5 13a11.64 11.64.0 01-7 2c9 5 20 0 20-11.5a4.5 4.5.0 00-.08-.83A7.72 7.72.0 0023 3z"></path></svg><span class="ms-2 visually-hidden">Twitter</span></a>
</li>
<?php endif;?>
<?php if(!empty(config('social.facebook'))):?>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="nofollow" href="<?php echo config('social.facebook');?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-facebook" viewBox="0 0 18 18"><path d="M16 8.049c0-4.446-3.582-8.05-8-8.05C3.58 0-.002 3.603-.002 8.05c0 4.017 2.926 7.347 6.75 7.951v-5.625h-2.03V8.05H6.75V6.275c0-2.017 1.195-3.131 3.022-3.131.876 0 1.791.157 1.791.157v1.98h-1.009c-.993 0-1.303.621-1.303 1.258v1.51h2.218l-.354 2.326H9.25V16c3.824-.604 6.75-3.934 6.75-7.951"/></svg><span class="ms-2 visually-hidden">Twitter</span></a>
</li>
<?php endif;?>
</ul>
<div class="collapse navbar-collapse order-4 order-md-1 top-menu">
<?php
// just to make sure only print the content from custom menu
$filename = "content/data/menu.json";
if (file_exists($filename)) {
$json = json_decode(file_get_contents('content/data/menu.json', true));
$menus = json_decode($json);
if (!empty($menus)) {
echo menu();
}
} ?>
</div>
</div>
</header>
<?php if(config('static.frontpage') == 'true' && isset($is_front)) {
$pages = find_page();
$front = get_frontpage(); ?>
<div class="wrap container" role="document">
<div class="content">
<section class="section container-fluid mt-n3 pb-3">
<div class="row justify-content-center">
<div class="col-lg-12 text-center">
<h1 class="mt-0"><?php echo $front->title;?></h1>
<?php if(login()):?><small><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828.0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg> <a href="<?php echo $front->url;?>/edit?destination=front">Edit</a></small><?php endif;?>
</div>
<div class="col-lg-9 col-xl-8 text-center">
<div class="lead"><?php echo $front->body;?></div>
<?php if (!empty($pages[0])):?><a class="btn btn-primary btn-lg px-4 mb-2" href="<?php echo $pages[0]->url;?>" role="button">Get Started</a><?php endif;?>
</div>
</div>
</section>
</div>
</div>
<div class="d-flex justify-content-start"><div class="bg-dots"></div></div>
<section class="section section-sm">
<div class="container">
<div class="row justify-content-center text-center">
<?php foreach ($pages as $pg):?>
<div class="col-lg-5">
<h2 class="h4"><a href="<?php echo $pg->url;?>"><?php echo $pg->title;?></a></h2>
<p><?php echo $pg->description;?></p>
</div>
<?php endforeach;?>
</div>
</div>
</section>
<?php } else {?>
<div class="wrap container" role="document">
<div class="content">
<div class="row justify-content-center">
<div class="col-md-12 col-lg-10 col-xl-9">
<?php echo content();?>
</div>
</div>
</div>
</div>
<?php }?>
<section class="section section-sm container-fluid"><div class="row justify-content-center text-center"><div class="col-lg-9"></div></div></section>
<footer class="footer text-muted">
<div class="container">
<div class="row">
<div class="col-lg-8 order-last order-lg-first">
<ul class="list-inline">
<li class="list-inline-item"><?php echo copyright();?></li>
</ul>
</div>
<div class="col-lg-8 order-last order-lg-last text-lg-end">
<ul class="list-inline">
<li class="list-inline-item">Design by <a href="https://getdoks.org/" target="_blank" rel="nofollow">Doks</a></li>
</ul>
</div>
</div>
</div>
</footer>
<script src="<?php echo theme_path();?>js/main.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
</body>
</html>

+ 147
- 0
themes/doks/main.html.php View File

@ -0,0 +1,147 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<?php if (isset($is_category)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $category->title;?></h1>
</div>
<div class="col-md-12 text-center">
<div class="lead"><?php echo $category->body;?></div>
</div>
</div>
<?php endif;?>
<?php if (isset($is_tag)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $tag->title;?></h1>
</div>
</div>
<?php endif;?>
<?php if (isset($is_archive)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $archive->title;?></h1>
</div>
</div>
<?php endif;?>
<?php if (isset($is_search)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $search->title;?></h1>
</div>
</div>
<?php endif;?>
<?php if (isset($is_type)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $type->title;?></h1>
</div>
</div>
<?php endif;?>
<?php if (isset($is_blog)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0">Blog</h1>
</div>
</div>
<?php endif;?>
<?php if (isset($is_front)):?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo blog_title();?></h1>
</div>
<div class="col-md-12 text-center">
<div class="lead"><?php echo blog_description();?></div>
</div>
</div>
<?php endif;?>
<?php foreach ($posts as $post):?>
<?php $img = get_image($post->body);?>
<article>
<div class="card-list">
<div class="card">
<?php if (!empty($post->image)) {?>
<img src="<?php echo $post->image;?>" width="100%">
<?php } elseif (!empty($post->video)) {?>
<img src="//img.youtube.com/vi/<?php echo get_video_id($post->video);?>/sddefault.jpg" width="100%">
<?php } elseif (!empty($post->audio)) {?>
<img src="<?php echo theme_path();?>img/soundcloud.jpg" width="100%">
<?php } elseif (!empty($img)) {?>
<img src="<?php echo $img;?>" width="100%">
<?php } ?>
<?php if(!empty($post->quote)):?>
<div class="quote">
<blockquote class="quote"><?php echo $post->quote ?></blockquote>
</div>
<?php endif;?>
<div class="card-body">
<?php if(!empty($post->link)) { ?>
<h2 class="h3">
<a class="stretched-link text-body" href="<?php echo $post->link;?>" target="_blank"><?php echo $post->title;?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16"><path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/><path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/></svg>
</a>
</h2>
<?php } else {?>
<h2 class="h3"><a class="stretched-link text-body" href="<?php echo $post->url;?>"><?php echo $post->title;?></a></h2>
<?php } ?>
<div class="content-body">
<?php echo $post->description;?>
</div>
<p>
<small>
<?php echo i18n('posted_on');?> <?php echo format_date($post->date);?>
<?php echo i18n('by');?>
<a class="position-relative" href="<?php echo $post->authorUrl;?>">
<?php echo $post->authorName;?>
</a>
<span class="mx-2"></span>
<strong>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentcolor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 12a9 9 0 1018 0A9 9 0 003 12"></path><path d="M12 7v5l3 3"></path></svg>
<?php echo $post->readTime;?> min
</strong>
</small>
</p>
</div>
</div>
</div>
</article>
<?php endforeach;?>
<?php if (!empty($pagination['next']) || !empty($pagination['prev'])): ?>
<div class="docs-navigation d-flex justify-content-between">
<?php if (!empty($pagination['prev'])): ?>
<a href="?page=<?php echo $page - 1 ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('Newer');?>
</div>
</div>
</a>
<?php endif;?>
<?php if (!empty($pagination['next'])): ?>
<a class="ms-auto" href="?page=<?php echo $page + 1 ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('Older');?>
</div>
</div>
</a>
<?php endif;?>
</div>
<?php endif;?>

+ 9
- 0
themes/doks/no-posts.html.php View File

@ -0,0 +1,9 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<article>
<div class="blog-header">
<h1>No posts found!</h1>
</div>
<div class="content-body">
<p>Create a blog post or set the frontpage display to static page to remove this message.</p>
</div>
</article>

+ 110
- 0
themes/doks/post.html.php View File

@ -0,0 +1,110 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<article>
<div class="blog-header">
<?php if(!empty($post->link)) { ?>
<h1>
<a href="<?php echo $post->link;?>" target="_blank"><?php echo $post->title;?>
<svg xmlns="http://www.w3.org/2000/svg" height="28" width="28" fill="currentColor" class="icon icon-tabler bi bi-link" viewBox="0 0 16 16"><path d="M6.354 5.5H4a3 3 0 0 0 0 6h3a3 3 0 0 0 2.83-4H9q-.13 0-.25.031A2 2 0 0 1 7 10.5H4a2 2 0 1 1 0-4h1.535c.218-.376.495-.714.82-1z"/><path d="M9 5.5a3 3 0 0 0-2.83 4h1.098A2 2 0 0 1 9 6.5h3a2 2 0 1 1 0 4h-1.535a4 4 0 0 1-.82 1H12a3 3 0 1 0 0-6z"/></svg>
</a>
</h1>
<?php } else {?>
<h1><?php echo $post->title;?></h1>
<?php } ?>
<p>
<small>
<?php echo i18n('posted_on');?> <?php echo format_date($post->date);?>
<?php echo i18n('by');?>
<a class="stretched-link position-relative" href="<?php echo $post->authorUrl;?>"><?php echo $post->authorName;?></a>
<span class="mx-2"></span>
<strong>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentcolor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 12a9 9 0 1018 0A9 9 0 003 12"></path><path d="M12 7v5l3 3"></path></svg>
<?php echo $post->readTime;?> min
</strong>
<?php if (login()) { echo ' <span class="mx-2">—</span> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828.0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg> <span class="edit-post"><a href="'. $post->url .'/edit?destination=post">' . i18n('Edit') . '</a></span>'; } ?>
</small>
</p>
</div>
<div class="content-media">
<?php if(!empty($post->image)):?>
<img src="<?php echo $post->image;?>"/>
<?php endif;?>
<?php if(!empty($post->video)):?>
<iframe width="100%" height="315px" class="embed-responsive-item" src="https://www.youtube.com/embed/<?php echo get_video_id($post->video); ?>" frameborder="0" allowfullscreen></iframe>
<?php endif;?>
<?php if(!empty($post->audio)):?>
<iframe width="100%" height="200px" class="embed-responsive-item" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<?php echo $post->audio;?>&amp;auto_play=false&amp;visual=true"></iframe>
<?php endif;?>
<?php if(!empty($post->quote)):?>
<div class="quote"><blockquote class="quote"><?php echo $post->quote ?></blockquote></div>
<?php endif;?>
</div>
<div class="content-body" id="content">
<?php echo $post->body;?>
<p class="post-footer">
<small>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="icon bi bi-folder" viewBox="0 0 18 18"><path d="M.54 3.87.5 3a2 2 0 0 1 2-2h3.672a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 9.828 3h3.982a2 2 0 0 1 1.992 2.181l-.637 7A2 2 0 0 1 13.174 14H2.826a2 2 0 0 1-1.991-1.819l-.637-7a2 2 0 0 1 .342-1.31zM2.19 4a1 1 0 0 0-.996 1.09l.637 7a1 1 0 0 0 .995.91h10.348a1 1 0 0 0 .995-.91l.637-7A1 1 0 0 0 13.81 4zm4.69-1.707A1 1 0 0 0 6.172 2H2.5a1 1 0 0 0-1 .981l.006.139q.323-.119.684-.12h5.396z"/></svg>
<span class="cat-meta"><?php echo $post->category;?></span>
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" class="bi bi-tag" viewBox="0 0 18 18"><path d="M6 4.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m-1 0a.5.5 0 1 0-1 0 .5.5 0 0 0 1 0"/><path d="M2 1h4.586a1 1 0 0 1 .707.293l7 7a1 1 0 0 1 0 1.414l-4.586 4.586a1 1 0 0 1-1.414 0l-7-7A1 1 0 0 1 1 6.586V2a1 1 0 0 1 1-1m0 5.586 7 7L13.586 9l-7-7H2z"/></svg>
<span class="tag-meta"><?php echo $post->tag;?></span>
</small>
</p>
</div>
<div class="related docs-navigation">
<small>
<strong><?php echo i18n("Related_posts");?></strong>
<?php echo get_related($post->related);?>
</small>
</div>
</article>
<?php if (disqus()): ?>
<?php echo disqus($post->title, $post->url) ?>
<?php endif; ?>
<?php if (facebook() || disqus()): ?>
<div class="comments-area" id="comments">
<?php if (facebook()): ?>
<div class="fb-comments" data-href="<?php echo $post->url ?>" data-numposts="<?php echo config('fb.num') ?>" data-colorscheme="<?php echo config('fb.color') ?>"></div>
<?php endif; ?>
<?php if (disqus()): ?>
<div id="disqus_thread"></div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if (!empty($next) || !empty($prev)): ?>
<div class="docs-navigation d-flex justify-content-between">
<?php if (!empty($next)): ?>
<a href="<?php echo($next['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('next_post');?>
</div>
</div>
</a>
<?php endif;?>
<?php if (!empty($prev)): ?>
<a class="ms-auto" href="<?php echo($prev['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('prev_post');?>
</div>
</div>
</a>
<?php endif;?>
</div>
<?php endif;?>

+ 95
- 0
themes/doks/profile.html.php View File

@ -0,0 +1,95 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<div class="row justify-content-center" style="padding-top: 4rem;">
<div class="col-md-12 text-center">
<h1 class="mt-0"><?php echo $author->name;?></h1>
</div>
<div class="col-md-12 text-center">
<div class="lead"><?php echo $author->about;?></div>
</div>
</div>
<?php if (!empty($posts)):?>
<?php foreach ($posts as $post):?>
<?php $img = get_image($post->body);?>
<article>
<div class="card-list">
<div class="card">
<?php if (!empty($post->image)) {?>
<img src="<?php echo $post->image;?>" width="100%">
<?php } elseif (!empty($post->video)) {?>
<img src="//img.youtube.com/vi/<?php echo get_video_id($post->video);?>/sddefault.jpg" width="100%">
<?php } elseif (!empty($post->audio)) {?>
<img src="<?php echo theme_path();?>img/soundcloud.jpg" width="100%">
<?php } elseif (!empty($img)) {?>
<img src="<?php echo $img;?>" width="100%">
<?php } ?>
<?php if(!empty($post->quote)):?>
<div class="quote">
<blockquote class="quote"><?php echo $post->quote ?></blockquote>
</div>
<?php endif;?>
<div class="card-body">
<?php if(!empty($post->link)) { ?>
<h2 class="h3">
<a class="stretched-link text-body" href="<?php echo $post->link;?>" target="_blank"><?php echo $post->title;?>
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16"><path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1 1 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4 4 0 0 1-.128-1.287z"/><path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/></svg>
</a>
</h2>
<?php } else {?>
<h2 class="h3"><a class="stretched-link text-body" href="<?php echo $post->url;?>"><?php echo $post->title;?></a></h2>
<?php } ?>
<div class="content-body">
<?php echo $post->description;?>
</div>
<p>
<small>
<?php echo i18n('posted_on');?> <?php echo format_date($post->date);?>
<?php echo i18n('by');?>
<a class="position-relative" href="<?php echo $post->authorUrl;?>">
<?php echo $post->authorName;?>
</a>
<span class="mx-2"></span>
<strong>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentcolor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 12a9 9 0 1018 0A9 9 0 003 12"></path><path d="M12 7v5l3 3"></path></svg>
<?php echo $post->readTime;?> min
</strong>
</small>
</p>
</div>
</div>
</div>
</article>
<?php endforeach;?>
<?php endif;?>
<?php if (!empty($pagination['next']) || !empty($pagination['prev'])): ?>
<div class="docs-navigation d-flex justify-content-between">
<?php if (!empty($pagination['prev'])): ?>
<a href="?page=<?php echo $page - 1 ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('Newer');?>
</div>
</div>
</a>
<?php endif;?>
<?php if (!empty($pagination['next'])): ?>
<a class="ms-auto" href="?page=<?php echo $page + 1 ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo i18n('Older');?>
</div>
</div>
</a>
<?php endif;?>
</div>
<?php endif;?>

+ 168
- 0
themes/doks/static.html.php View File

@ -0,0 +1,168 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?>
<nav class="docs-toc d-none d-xl-block col-xl-3" aria-label="Secondary navigation">
<div class="page-links">
<p class="h3">On this page</p>
<nav id="toc"></nav>
<p class="link-to-top"><a href="#main-top-link"><span aria-hidden="true">↑︎</span> Back to top</a></p>
</div>
</nav>
<main class="docs-content col-lg-11 col-xl-9" id="main-top-link">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<?php echo $breadcrumb ?>
</ol>
</nav>
<?php if (login()):?>
<div class="edit-page"><a href="<?php echo $static->url;?>/edit?destination=post"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828.0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg><?php echo i18n('Edit');?></a></div>
<?php endif;?>
<h1><?php echo $static->title;?></h1>
<div id="content">
<?php echo $static->body;?>
<?php if (isset($is_page)):?>
<div class="subpages">
<?php $subpages = find_subpage($static->slug);?>
<?php if (!empty($subpages)):?>
<div class="card-list">
<h2 class="h4">Sub <?php echo i18n('pages');?></h2>
<?php foreach ($subpages as $sp):?>
<div class="card my-3">
<div class="card-body">
<a class="stretched-link" href="<?php echo $sp->url;?>"><?php echo $sp->title;?> →</a>
<br><small><?php echo $sp->description;?></small>
</div>
</div>
<?php endforeach;?>
</div>
<?php endif;?>
</div>
<?php endif;?>
<?php if (isset($is_subpage)):?>
<?php $pages = find_page($static->parent); ?>
<?php endif;?>
</div>
<div class="docs-navigation d-flex justify-content-between">
<?php if (isset($is_page)):?>
<?php if (!empty($next)): ?>
<?php $nextSub = find_subpage($next['slug']); $last = end($nextSub);?>
<?php if (!empty($nextSub)) { ?>
<a class="me-auto" href="<?php echo($last->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($last->title); ?>
</div>
</div>
</a>
<?php } else { ?>
<a class="me-auto" href="<?php echo($next['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($next['title']); ?>
</div>
</div>
</a>
<?php } ?>
<?php endif;?>
<?php endif;?>
<?php if (isset($is_subpage)):?>
<?php if (!empty($next)) { ?>
<a class="me-auto" href="<?php echo($next['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($next['title']); ?>
</div>
</div>
</a>
<?php } else { ?>
<?php if (!empty($pages['next'])): ?>
<?php $nextSub = find_subpage($pages['next']->slug); $last = end($nextSub);?>
<?php if (!empty($nextSub)) { ?>
<a class="me-auto" href="<?php echo($last->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($last->title); ?>
</div>
</div>
</a>
<?php } else { ?>
<a class="me-auto" href="<?php echo($pages['next']->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($pages['next']->title); ?>
</div>
</div>
</a>
<?php } ?>
<?php endif;?>
<?php }?>
<?php endif;?>
<?php if (isset($is_subpage)):?>
<a href="<?php echo($pages['current']->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
Back to <?php echo($pages['current']->title); ?>
</div>
</div>
</a>
<?php endif;?>
<?php if (isset($is_page)):?>
<?php if (!empty($subpages[0])) { ?>
<a class="ms-auto" href="<?php echo($subpages[0]->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($subpages[0]->title); ?>
</div>
</div>
</a>
<?php } else { ?>
<?php if (!empty($prev)): ?>
<a class="ms-auto" href="<?php echo($prev['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($prev['title']); ?>
</div>
</div>
</a>
<?php endif;?>
<?php }?>
<?php endif;?>
<?php if (isset($is_subpage)):?>
<?php if (!empty($prev)) { ?>
<a class="ms-auto" href="<?php echo($prev['url']); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($prev['title']); ?>
</div>
</div>
</a>
<?php } else { ?>
<?php if (!empty($pages['prev'])): ?>
<a class="ms-auto" href="<?php echo($pages['prev']->url); ?>">
<div class="card my-1">
<div class="card-body py-2">
<?php echo($pages['prev']->title); ?>
</div>
</div>
</a>
<?php endif;?>
<?php }?>
<?php endif;?>
</div>
</main>

Loading…
Cancel
Save