nowa-panda/plugins/pandaGadzety/utils/load-file.php

23 lines
771 B
PHP
Raw Permalink Normal View History

2025-07-07 07:51:16 +00:00
<?php
namespace Foxstudio\Plugins\Template\Utils;
function mapAndIncludeFiles($folderPath)
{
$files = scandir($folderPath);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
if (is_file($folderPath . $file)) {
// Check if the file is a PHP file
if (pathinfo($folderPath . $file, PATHINFO_EXTENSION) == 'php') {
// Include the PHP file
echo $folderPath . $file;
include_once $folderPath . $file;
}
} elseif (is_dir($folderPath . $file)) {
// Recursively call mapAndIncludeFiles for subdirectories
mapAndIncludeFiles($folderPath . $file . '/');
}
}
}
}