mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 20:46:26 +05:30
Improve filter
This commit is contained in:
parent
2101bcda76
commit
27da6f193b
4 changed files with 21 additions and 9 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue