Browse Source

Improve filter

pull/674/head
danpros 1 year ago
parent
commit
27da6f193b
4 changed files with 21 additions and 9 deletions
  1. +1
    -1
      system/admin/views/static-pages.html.php
  2. +2
    -2
      system/admin/views/static-subpages.html.php
  3. +2
    -2
      system/admin/views/user-draft.html.php
  4. +16
    -4
      system/includes/functions.php

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

@ -55,7 +55,7 @@ $(function() {
<span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span> <span><a target="_blank" href="<?php echo $sp->url;?>"><?php echo $sp->title;?></a></span>
</div> </div>
<div class="col-sm"> <div class="col-sm">
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $sp->parent;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $sp->parent;?>"><?php echo i18n('Delete');?></a></span>
<span><a class="btn btn-primary btn-xs" href="<?php echo $sp->url;?>/edit?destination=admin/pages/<?php echo $sp->parentSlug;?>"><?php echo i18n('Edit');?></a> <a class="btn btn-danger btn-xs" href="<?php echo $sp->url;?>/delete?destination=admin/pages/<?php echo $sp->parentSlug;?>"><?php echo i18n('Delete');?></a></span>
</div> </div>
</div> </div>
<?php endforeach;?> <?php endforeach;?>


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

@ -1,5 +1,5 @@
<?php if (!defined('HTMLY')) die('HTMLy'); ?> <?php if (!defined('HTMLY')) die('HTMLy'); ?>
<ul class="nav nav-pills">
<ul class="nav nav-tabs">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" aria-current="page" href="<?php echo $static->url;?>"><?php echo i18n('View');?></a> <a class="nav-link" aria-current="page" href="<?php echo $static->url;?>"><?php echo i18n('View');?></a>
</li> </li>
@ -8,7 +8,7 @@
</li> </li>
</ul> </ul>
<br> <br>
<div class="callout callout-info">
<div>
<h2 class="post-index"><?php echo $static->title ?></h2> <h2 class="post-index"><?php echo $static->title ?></h2>
<div><?php echo $static->description;?></div> <div><?php echo $static->description;?></div>
</div> </div>


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

@ -59,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->slug)); ?>
<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>
@ -81,7 +81,7 @@
<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->parentSlug);?>
<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>


+ 16
- 4
system/includes/functions.php View File

@ -51,8 +51,14 @@ function get_static_subpages($static = null)
if ($static != null) { if ($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']);
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 true;
} }
return false; return false;
@ -125,8 +131,14 @@ function get_draft_subpages($static = null)
if ($static != null) { if ($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']);
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 true;
} }
return false; return false;


Loading…
Cancel
Save