diff --git a/system/includes/functions.php b/system/includes/functions.php index 808a070..b2fde80 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -53,7 +53,7 @@ function get_static_pages() } // Get static page path. Unsorted. -function get_static_sub_pages($static = null) +function get_static_sub_pages() { static $_sub_page = array(); @@ -64,16 +64,7 @@ function get_static_sub_pages($static = null) } $_sub_page = unserialize(file_get_contents($url)); } - if ($static != null) { - $stringLen = strlen($static); - return array_filter($_sub_page, function ($sub_page) use ($static, $stringLen) { - $x = explode("/", $sub_page); - if ($x[count($x) - 2] == $static) { - return true; - } - return false; - }); - } + return $_sub_page; } @@ -979,14 +970,14 @@ function get_static_post($static) // Return static page. function get_static_sub_post($static, $sub_static) { - $posts = get_static_sub_pages($static); + $posts = get_static_sub_pages(); $tmp = array(); if (!empty($posts)) { - foreach ($posts as $index => $v) { - if (stripos($v, $sub_static . '.md') !== false) { + foreach ($posts as $index => $v) { + if (stripos($v, $sub_static . '.md') !== false && stripos($v, $static) !== false) { $post = new stdClass; @@ -995,6 +986,7 @@ function get_static_sub_post($static, $sub_static) // The static page URL $url = str_replace($replaced, '', $v); + $post->url = site_url() . $static . "/" . str_replace('.md', '', $url); $post->file = $v; @@ -2347,7 +2339,7 @@ function get_menu($custom) $active = ''; } - $subPages = get_static_sub_pages(str_replace('.md', '', $base)); + $subPages = get_static_sub_pages(); if (!empty($subPages)) { asort($subPages); echo '