Improve filter

This commit is contained in:
danpros 2024-01-27 00:06:56 +07:00
commit 27da6f193b
4 changed files with 21 additions and 9 deletions

View file

@ -51,8 +51,14 @@ function get_static_subpages($static = null)
if ($static != null) {
$stringLen = strlen($static);
return array_filter($_sub_page, function ($sub_page) use ($static, $stringLen) {
$x = explode("/", $sub_page['dirname']);
if (strpos($x[2], $static) !== false) {
$x = str_replace('content/static/', '', $sub_page['dirname']);
$y = explode('.', $x);
if (isset($y[1])) {
$z = $y[1];
} else {
$z = $x;
}
if ($z == $static) {
return true;
}
return false;
@ -125,8 +131,14 @@ function get_draft_subpages($static = null)
if ($static != null) {
$stringLen = strlen($static);
return array_filter($_draftSubpage, function ($sub_page) use ($static, $stringLen) {
$x = explode("/", $sub_page['dirname']);
if (strpos($x[2], $static) !== false) {
$x = str_replace('content/static/', '', $sub_page['dirname']);
$y = explode('.', $x);
if (isset($y[1])) {
$z = $y[1];
} else {
$z = $x;
}
if ($z == $static) {
return true;
}
return false;