
The USS Enterprise
// 1 START: Front-end Render (safe guards + shortcode + stats footer + pagination + one-level whitelist + grouped + jump menu + colors) if (!defined('ABSPATH')) { exit; } /** ABS→URL mapper (works when folder is under ABSPATH or DOCUMENT_ROOT). */ if (!function_exists('gmm_temp_abs_to_url')) { function gmm_temp_abs_to_url($abs) { $abs = wp_normalize_path($abs); $root = wp_normalize_path(ABSPATH); if (strpos($abs, $root) === 0 && function_exists('home_url')) { $rel = ltrim(substr($abs, strlen($root)), '/'); return home_url('/' . $rel); } if (!empty($_SERVER['DOCUMENT_ROOT'])) { $doc = wp_normalize_path($_SERVER['DOCUMENT_ROOT']); if (strpos($abs, $doc) === 0 && function_exists('home_url')) { $rel = ltrim(substr($abs, strlen($doc)), '/'); return home_url('/' . $rel); } } return ''; } } if (!function_exists('gmm_temp_build_gallery_html')) { function gmm_temp_build_gallery_html($post_id) { $t0 = microtime(true); $abs_dir = (string) get_post_meta($post_id, 'gmm_path', true); if (!$abs_dir) { return ''; } $abs_dir = wp_normalize_path($abs_dir); if (!is_dir($abs_dir)) { return '
Folder not found.
'; } // One-level whitelist: only immediate subfolders listed here $whitelist = ['animated','transparent','docs','images','video','audio','icons','textures','overlays','music','memes']; // Allowed extensions $img_ext = ['jpg','jpeg','png','webp','gif']; $other_ext = ['mp4','mov','m4v','mp3','ogg','pdf','zip']; // Exclusions (case-insensitive compare) $skip_file_names = ['index.php','index.html','thumbs.db','.ds_store']; $items = []; $top = @scandir($abs_dir); if (is_array($top)) { foreach ($top as $f) { if ($f === '.' || $f === '..' || $f[0] === '.') { continue; } $p = wp_normalize_path($abs_dir . '/' . $f); if (is_link($p)) { continue; } // never follow symlinks if (!is_dir($p)) { continue; } $group = strtolower($f); if (!in_array($group, $whitelist, true)) { continue; } // Only files directly inside this whitelisted subfolder (NOT deeper) $sub = @scandir($p); if (!is_array($sub)) { continue; } foreach ($sub as $s) { if ($s === '.' || $s === '..' || $s[0] === '.') { continue; } $pp = wp_normalize_path($p . '/' . $s); if (is_link($pp) || !is_file($pp)) { continue; } $bn_l = strtolower($s); if (in_array($bn_l, $skip_file_names, true)) { continue; } $ext = strtolower(pathinfo($pp, PATHINFO_EXTENSION)); if ($ext === 'json') { continue; } // hard exclude .json $url = gmm_temp_abs_to_url($pp); if (!$url) { continue; } if (in_array($ext, $img_ext, true)) { $items[] = ['type'=>'image','url'=>$url,'name'=>$s,'rel'=>$f.'/'.$s,'group'=>$group]; } elseif (in_array($ext, $other_ext, true)) { $items[] = ['type'=>'other','url'=>$url,'name'=>$s,'rel'=>$f.'/'.$s,'group'=>$group]; } } } } if (!$items) { return 'No media found in the immediate whitelisted subfolders.
'; } // Group counts $group_counts = []; foreach ($items as $it) { $group_counts[$it['group']] = ($group_counts[$it['group']] ?? 0) + 1; } // Sort by group then file name usort($items, function($a, $b) { $x = strnatcasecmp($a['group'], $b['group']); return $x !== 0 ? $x : strnatcasecmp($a['name'], $b['name']); }); // Pagination $per_page = function_exists('gmm_temp_get_per_page') ? gmm_temp_get_per_page(48) : 48; $page = isset($_GET['gmm_page']) ? max(1, (int) $_GET['gmm_page']) : 1; $total = count($items); $pages = max(1, (int) ceil($total / $per_page)); if ($page > $pages) { $page = $pages; } $offset = ($page - 1) * $per_page; $page_items = array_slice($items, $offset, $per_page); // Colors per group (used via CSS var --gmm-accent) $group_colors = [ 'images' => '#1e88e5', 'video' => '#e53935', 'audio' => '#8e24aa', 'docs' => '#00897b', 'animated' => '#fb8c00', 'transparent' => '#546e7a', 'icons' => '#5e35b1', 'textures' => '#6d4c41', 'overlays' => '#3949ab', 'music' => '#7b1fa2', 'memes' => '#d81b60', ]; // Minimal CSS (scoped) $css = ''; // Jump Menu (present groups + counts) $html = $css; $present_groups = array_keys($group_counts); natcasesort($present_groups); if (!empty($present_groups)) { $html .= 'bbpress
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/web/site/public_html/wp-includes/functions.php on line 6121
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpmudev
domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init
action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/web/site/public_html/wp-includes/functions.php on line 6121
Warning: Cannot modify header information - headers already sent by (output started at /var/web/site/public_html/wp-content/plugins/gmm-temp-posts/core/render.php:1) in /var/web/site/public_html/wp-content/plugins/advanced-iframe/advanced-iframe.php on line 392
Warning: Cannot modify header information - headers already sent by (output started at /var/web/site/public_html/wp-content/plugins/gmm-temp-posts/core/render.php:1) in /var/web/site/public_html/wp-content/plugins/paid-memberships-pro/adminpages/reports/logins.php on line 458
Warning: session_start(): Session cannot be started after headers have already been sent in /var/web/site/public_html/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/masonry_entries/masonry_entries.php on line 112
Warning: session_start(): Session cannot be started after headers have already been sent in /var/web/site/public_html/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/portfolio/portfolio.php on line 65
Deprecated: Function bp_get_group_permalink is deprecated since version 12.0.0! Use bp_get_group_url() instead. in /var/web/site/public_html/wp-includes/functions.php on line 6121