From 8d58741b88a0b3dec79d6e9366cffe7e15e109d2 Mon Sep 17 00:00:00 2001 From: danpros Date: Sun, 3 Mar 2024 18:33:33 +0700 Subject: [PATCH] Rename to scan_images() Rename for more meaningful --- system/admin/admin.php | 5 +++-- system/includes/functions.php | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/system/admin/admin.php b/system/admin/admin.php index dabc20a..4237632 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -1627,15 +1627,16 @@ function reorder_subpages($subpages = null) rebuilt_cache(); } +// Return image gallery in pager. // Return image gallery in pager. function image_gallery($images, $page = 1, $perpage = 0) { if (empty($images)) { - $images = get_gallery(); + $images = scan_images(); } - $pagination = has_pagination(count($images), $perpage, $page); $tmp = ''; $images = array_slice($images, ($page - 1) * $perpage, $perpage); + $pagination = has_pagination(count($images), $perpage, $page); $tmp .= '
'; foreach ($images as $index => $v) { $tmp .= '
'; diff --git a/system/includes/functions.php b/system/includes/functions.php index edaefbd..8750c40 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -222,19 +222,19 @@ function get_zip_files() } // Get images in content/images folder -function get_gallery() { - static $_gallery = array(); - if (empty($_gallery)) { +function scan_images() { + static $_images = array(); + if (empty($_images)) { $tmp = array(); $tmp = glob('content/images/*', GLOB_NOSORT); if (is_array($tmp)) { foreach ($tmp as $file) { - $_gallery[] = pathinfo($file); + $_images[] = pathinfo($file); } } - usort($_gallery, "sortfile_d"); + usort($_images, "sortfile_d"); } - return $_gallery; + return $_images; } // usort function. Sort by filename.