芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/store.kwesioben.com/app/Traits/AddonHelper.php
$full_data['name'], 'software_id' => $full_data['software_id'], 'is_published' => $full_data['is_published'], ]; } return $array; } public function get_addon_admin_routes(): array { $dir = 'Modules'; $directories = self::getDirectories($dir); $addons = []; foreach ($directories as $directory) { $sub_dirs = self::getDirectories('Modules/' . $directory); if (in_array('Addon', $sub_dirs)) { $addons[] = 'Modules/' . $directory; } } $full_data = []; foreach ($addons as $item) { $info = include($item . '/Addon/info.php'); if ($info['is_published']){ $full_data[] = include($item . '/Addon/admin_routes.php'); } } return $full_data; } public function get_payment_publish_status(): array { $dir = 'Modules'; // Update the directory path to Modules/Gateways $directories = self::getDirectories($dir); // dd($directories); $addons = []; foreach ($directories as $directory) { $sub_dirs = self::getDirectories($dir . '/' . $directory); // Use $dir instead of 'Modules/' if($directory == 'Gateways'){ if (in_array('Addon', $sub_dirs)) { $addons[] = $dir . '/' . $directory; // Use $dir instead of 'Modules/' } } } $array = []; foreach ($addons as $item) { $full_data = include($item . '/Addon/info.php'); $array[] = [ 'is_published' => $full_data['is_published'], ]; } return $array; } function getDirectories(string $path): array { $module_dir = base_path('Modules'); try { if (!File::exists($module_dir)) { File::makeDirectory($module_dir); File::chmod($module_dir, 0777); } } catch (\Exception $e) { } $directories = []; $items = scandir(base_path($path)); foreach ($items as $item) { if ($item == '..' || $item == '.') continue; if (is_dir($path . '/' . $item)) $directories[] = $item; } return $directories; } }