Smart.Framework Logo

final class \SmartGetFileSystem
{ } ->

Class: SmartGetFileSystem - provides the File System Get/Scan functions.
This class requires the use of RELATIVE PATHS to force using correct path access in a web environment application.
Relative paths must be relative to the web application folder as folder: `some-folder/` or file: `some-folder/my-file.txt`.
Absolute paths are denied by internal checks as they are NOT SAFE in a Web Application from the security point of view ...
Also the backward path access like `../some-file-or-folder` is denied from the above exposed reasons.
Files and Folders must contain ONLY safe characters as: `[a-z] [A-Z] [0-9] _ - . @ #` ; folders can also contain slashes `/` (as path separators); no spaces are allowed in paths !!


class Methods

public function __construct ( bool $list_files_and_dirs = false, bool $allow_protected_paths = false ) {} @ 
public function get_storage ( string $dir_name, bool $recurring = true, bool $include_dot_files = false, string $search_pattern = "" ) {} -> ARRAY
public function search_files ( bool $recurring, string $dir_name, bool $include_dot_files, string $search_pattern, int $limit_search_files, string $search_prevent_file = "", string $search_prevent_override = "" ) {} -> 

class Properties


class Constants


Sample code: PHP

<?php

// Get Storage example:
 
$filesys = new SmartGetFileSystem(true);
 
$data $filesys->get_storage('my_dir/my_subdir');
 
print_r($data);

 
// Search for Files example:
 
$obj = new SmartGetFileSystem();
 
$arr $obj->search_files(true'uploads/'false'.svg'100);
 
print_r($arr);

// #end php code


documentation generated on: 2023-10-19 23:15:49 +0000


Smart.Framework © 2009-2023 unix-world.org