Browse Source

Rename function

Far more easier to remember
pull/674/head
danpros 1 year ago
parent
commit
d8d114f9de
6 changed files with 28 additions and 28 deletions
  1. +4
    -4
      system/admin/admin.php
  2. +1
    -1
      system/admin/views/edit-page.html.php
  3. +2
    -2
      system/admin/views/static-pages.html.php
  4. +2
    -2
      system/admin/views/user-draft.html.php
  5. +16
    -16
      system/htmly.php
  6. +3
    -3
      system/includes/functions.php

+ 4
- 4
system/admin/admin.php View File

@ -1214,8 +1214,8 @@ function rename_category_folder($new_name, $old_file)
} }
// Return static page.
function find_draft_pages($static = null)
// Return draft static page.
function find_draft_page($static = null)
{ {
$posts = get_draft_pages(); $posts = get_draft_pages();
@ -1264,8 +1264,8 @@ function find_draft_pages($static = null)
return $tmp; return $tmp;
} }
// Return static page.
function find_draft_subpages($static = null, $sub_static = null)
// Return draft static subpage.
function find_draft_subpage($static = null, $sub_static = null)
{ {
$posts = get_draft_subpages(); $posts = get_draft_subpages();


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

@ -118,7 +118,7 @@ $images = get_gallery();
<input type="submit" name="submit" class="btn btn-primary submit" value="<?php echo i18n('Save_category');?>"/> <input type="submit" name="submit" class="btn btn-primary submit" value="<?php echo i18n('Save_category');?>"/>
<?php } else {?> <?php } else {?>
<input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/> <input type="hidden" name="oldfile" class="text" value="<?php echo $url ?>"/>
<?php $count = count(get_static_sub_post($oldmd)); ?>
<?php $count = count(find_subpage($oldmd)); ?>
<?php if (stripos($dir . '/', '/draft/') !== false) { ?> <?php if (stripos($dir . '/', '/draft/') !== false) { ?>
<input type="submit" name="publishdraft" class="btn btn-primary submit" value="<?php echo i18n('Publish_draft');?>"/> <input type="submit" name="updatedraft" class="btn btn-primary draft" value="<?php echo i18n('Update_draft');?>"/> <?php if ($count == 0 && $type != 'is_page'):?><a class="btn btn-danger" href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a><?php endif;?> <input type="submit" name="publishdraft" class="btn btn-primary submit" value="<?php echo i18n('Publish_draft');?>"/> <input type="submit" name="updatedraft" class="btn btn-primary draft" value="<?php echo i18n('Update_draft');?>"/> <?php if ($count == 0 && $type != 'is_page'):?><a class="btn btn-danger" href="<?php echo $delete ?>"><?php echo i18n('Delete');?></a><?php endif;?>


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

@ -4,7 +4,7 @@
<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>
<?php if (isset($_SESSION[config("site.url")]['user'])):?> <?php if (isset($_SESSION[config("site.url")]['user'])):?>
<?php $posts = get_static_post();
<?php $posts = find_page();
if (!empty($posts)): ?> if (!empty($posts)): ?>
<table class="table post-list"> <table class="table post-list">
<tr class="head"> <tr class="head">
@ -25,7 +25,7 @@
<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 ($count == 0):?><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><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 ($count == 0):?><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> <table>
<?php $subPages = get_static_sub_post($p->md);
<?php $subPages = find_subpage($p->md);
foreach ($subPages as $sp):?> foreach ($subPages as $sp):?>
<div class="row"> <div class="row">


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

@ -55,7 +55,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(get_static_sub_post($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>
@ -77,7 +77,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 = get_static_post($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>


+ 16
- 16
system/htmly.php View File

@ -938,9 +938,9 @@ get('/admin/draft', function () {
$posts = get_draft($name, $page, $perpage); $posts = get_draft($name, $page, $perpage);
$draftPages = find_draft_pages();
$draftPages = find_draft_page();
$draftSubpages = find_draft_subpages();
$draftSubpages = find_draft_subpage();
$total = get_draftcount($name); $total = get_draftcount($name);
@ -2864,7 +2864,7 @@ get('/:static', function ($static) {
} }
} }
$post = get_static_post($static);
$post = find_page($static);
if (array_key_exists('prev', $post)) { if (array_key_exists('prev', $post)) {
$prev = $post['prev']; $prev = $post['prev'];
@ -2933,7 +2933,7 @@ get('/:static/add', function ($static) {
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$post = get_static_post($static);
$post = find_page($static);
if (!$post) { if (!$post) {
not_found(); not_found();
@ -3007,10 +3007,10 @@ get('/:static/edit', function ($static) {
if (login()) { if (login()) {
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$post = get_static_post($static);
$post = find_page($static);
if (!$post) { if (!$post) {
$post = find_draft_pages($static);
$post = find_draft_page($static);
if (!$post) { if (!$post) {
not_found(); not_found();
} else { } else {
@ -3096,10 +3096,10 @@ get('/:static/delete', function ($static) {
if (login()) { if (login()) {
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$post = get_static_post($static);
$post = find_page($static);
if (!$post) { if (!$post) {
$post = find_draft_pages($static);
$post = find_draft_page($static);
if (!$post) { if (!$post) {
not_found(); not_found();
} else { } else {
@ -3151,11 +3151,11 @@ get('/:static/:sub', function ($static, $sub) {
header("location: $redir", TRUE, 301); header("location: $redir", TRUE, 301);
} }
$parent_post = get_static_post($static);
$parent_post = find_page($static);
if (!$parent_post) { if (!$parent_post) {
not_found(); not_found();
} }
$post = get_static_sub_post($static, $sub);
$post = find_subpage($static, $sub);
if (array_key_exists('prev', $post)) { if (array_key_exists('prev', $post)) {
$prev = $post['prev']; $prev = $post['prev'];
@ -3228,7 +3228,7 @@ get('/:static/:sub/edit', function ($static, $sub) {
if (login()) { if (login()) {
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$post = get_static_post($static);
$post = find_page($static);
if (!$post) { if (!$post) {
not_found(); not_found();
@ -3236,10 +3236,10 @@ get('/:static/:sub/edit', function ($static, $sub) {
$post = $post['current']; $post = $post['current'];
$page = get_static_sub_post($static, $sub);
$page = find_subpage($static, $sub);
if (!$page) { if (!$page) {
$page = find_draft_subpages($static, $sub);
$page = find_draft_subpage($static, $sub);
if (!$page) { if (!$page) {
not_found(); not_found();
} else { } else {
@ -3330,7 +3330,7 @@ get('/:static/:sub/delete', function ($static, $sub) {
if (login()) { if (login()) {
config('views.root', 'system/admin/views'); config('views.root', 'system/admin/views');
$post = get_static_post($static);
$post = find_page($static);
if (!$post) { if (!$post) {
not_found(); not_found();
@ -3338,10 +3338,10 @@ get('/:static/:sub/delete', function ($static, $sub) {
$post = $post['current']; $post = $post['current'];
$page = get_static_sub_post($static, $sub);
$page = find_subpage($static, $sub);
if (!$page) { if (!$page) {
$page = find_draft_subpages($static, $sub);
$page = find_draft_subpage($static, $sub);
if (!$page) { if (!$page) {
not_found(); not_found();
} else { } else {


+ 3
- 3
system/includes/functions.php View File

@ -1083,7 +1083,7 @@ function default_profile($name)
} }
// Return static page. // Return static page.
function get_static_post($static = null)
function find_page($static = null)
{ {
$pages = get_static_pages(); $pages = get_static_pages();
@ -1165,8 +1165,8 @@ function get_static_post($static = null)
return $tmp; return $tmp;
} }
// Return static page.
function get_static_sub_post($static, $sub_static = null)
// Return static subpage.
function find_subpage($static, $sub_static = null)
{ {
$sub_pages = array_values(get_static_subpages($static)); $sub_pages = array_values(get_static_subpages($static));


Loading…
Cancel
Save