FileBrowser
extends BasicBrowser
in package
File browser with additional functions
Table of Contents
Properties
- $baseDir : string
- $body : string|null
- $ignoreItems : array<string|int, string>
- $mark : string
- $mode : string
- $bookmarks : array<string, string>
- $css : array<string, mixed>
- $dirExist : bool
- $dirs : array<string|int, array<string, mixed>>
- $displayMode : string
- $dynamicTag : string|null
- $error : string|null
- $files : array<string|int, array<string, mixed>>
- $filter : array<string, string>|null
- $filters : array<string, array<string, string>>
- $nav : AdminNavigation
- $openDir : string
- $parentDir : string|null
- $previews : bool
- $rights : array<string, bool>
- $scripts : array<string, mixed>
- $title : string
Methods
- __construct() : mixed
- addCss() : void
- Add CSS
- addScript() : void
- Add javascript
- convert() : array<string, array<string, string>>
- Reformat additional file information
- denyPath() : string|null
- Checks if given path has allowed access and does not contain ../
- getAlert() : string
- Get bootstrap like alert
- getCSS() : array<string, mixed>
- Get CSS
- getError() : string|null
- Get last error
- getScript() : array<string, mixed>
- Get javascript
- getShortTitle() : string
- Get page title without page name
- loadContent() : void
- Loads the contents of an open directory with additional information
- renderActionBar() : void
- Prints the top action bar of the browser
- renderContent() : void
- Prints content of the browser
- setFilters() : void
- Sets allowed filters for files to display
- getFunctions() : string
- Returns allowed action for selected file/directory
- getLinkView() : string
- Returns url to file based on MIME type
- getParentDir() : string|null
- Returns parent directory
- getPath() : string
- Returns full path to inserted directory
- getTitle() : string
- Get page title
- isMime() : bool
- Check if file can be shown based on its mime
- loadParams() : void
- Load browser settings
- renderDir() : void
- Prints files
- renderUploadBox() : void
- Prints dropbox element for file upload
Properties
$baseDir
public
static string
$baseDir
= './'
$body
public
string|null
$body
= null
$ignoreItems
public
static array<string|int, string>
$ignoreItems
= ['.', '..']
$mark
public
static string
$mark
= 'path'
$mode
public
static string
$mode
= 'mode'
$bookmarks
protected
array<string, string>
$bookmarks
= []
$css
protected
array<string, mixed>
$css
= []
$dirExist
protected
bool
$dirExist
= false
$dirs
protected
array<string|int, array<string, mixed>>
$dirs
= []
$displayMode
protected
string
$displayMode
= "detail"
$dynamicTag
protected
string|null
$dynamicTag
= null
$error
protected
string|null
$error
= null
$files
protected
array<string|int, array<string, mixed>>
$files
= []
$filter
protected
array<string, string>|null
$filter
= null
$filters
protected
array<string, array<string, string>>
$filters
= []
$nav
protected
AdminNavigation
$nav
$openDir
protected
string
$openDir
= ''
$parentDir
protected
string|null
$parentDir
= null
$previews
protected
bool
$previews
= false
$rights
protected
array<string, bool>
$rights
= []
$scripts
protected
array<string, mixed>
$scripts
= []
$title
protected
string
$title
= ''
Methods
__construct()
public
__construct(AdminNavigation $nav, array<string|int, mixed> $rights[, array<string|int, mixed> $access = [] ][, array<string|int, mixed> $bookmarks = [] ][, string $defaultDir = '' ]) : mixed
Parameters
- $nav : AdminNavigation
- $rights : array<string|int, mixed>
- $access : array<string|int, mixed> = []
- $bookmarks : array<string|int, mixed> = []
- $defaultDir : string = ''
addCss()
Add CSS
public
final addCss(string $type, string $value[, string $media = 'all' ]) : void
Parameters
- $type : string
-
FILE,CODE
- $value : string
-
depends on type
- $media : string = 'all'
-
css media type
addScript()
Add javascript
public
final addScript(string $type, array<string, mixed>|string|null $value) : void
Parameters
- $type : string
-
FILE,READY,GLOBAL,ARRAY
- $value : array<string, mixed>|string|null
-
depends on type
convert()
Reformat additional file information
public
convert(array<string, array<string, string>> $array) : array<string, array<string, string>>
Parameters
- $array : array<string, array<string, string>>
Return values
array<string, array<string, string>>denyPath()
Checks if given path has allowed access and does not contain ../
public
static denyPath(string $openDir[, array<string, array<string|int, string>> $access = [] ]) : string|null
Parameters
- $openDir : string
- $access : array<string, array<string|int, string>> = []
Return values
string|nullgetAlert()
Get bootstrap like alert
public
static getAlert(string $text[, string $type = 'danger' ]) : string
Parameters
- $text : string
- $type : string = 'danger'
-
alert type
Return values
stringgetCSS()
Get CSS
public
final getCSS() : array<string, mixed>
Return values
array<string, mixed>getError()
Get last error
public
getError() : string|null
Return values
string|nullgetScript()
Get javascript
public
final getScript() : array<string, mixed>
Return values
array<string, mixed>getShortTitle()
Get page title without page name
public
getShortTitle() : string
Return values
stringloadContent()
Loads the contents of an open directory with additional information
public
loadContent() : void
renderActionBar()
Prints the top action bar of the browser
public
renderActionBar() : void
renderContent()
Prints content of the browser
public
renderContent() : void
setFilters()
Sets allowed filters for files to display
public
setFilters(array<string, mixed> $filters[, string|null $default = null ]) : void
Parameters
- $filters : array<string, mixed>
- $default : string|null = null
getFunctions()
Returns allowed action for selected file/directory
protected
getFunctions(string $name[, bool $dir = false ]) : string
Parameters
- $name : string
- $dir : bool = false
Return values
stringgetLinkView()
Returns url to file based on MIME type
protected
getLinkView(string $htmlPath, array<string, string> $file) : string
Parameters
- $htmlPath : string
- $file : array<string, string>
Return values
stringgetParentDir()
Returns parent directory
protected
getParentDir(string $openDir, array<string, mixed> $access) : string|null
Parameters
- $openDir : string
- $access : array<string, mixed>
Return values
string|nullgetPath()
Returns full path to inserted directory
protected
getPath(string $dir) : string
Parameters
- $dir : string
Return values
stringgetTitle()
Get page title
protected
getTitle([string $split = ' - ' ]) : string
Parameters
- $split : string = ' - '
Return values
stringisMime()
Check if file can be shown based on its mime
protected
isMime(string $mime, array<string, string>|null $filter) : bool
Parameters
- $mime : string
- $filter : array<string, string>|null
Return values
boolloadParams()
Load browser settings
protected
loadParams() : void
renderDir()
Prints files
protected
renderDir() : void
renderUploadBox()
Prints dropbox element for file upload
protected
renderUploadBox() : void