Dotclear 2.24
|
Public Member Functions | |
__construct (string $type='') | |
chdir (?string $dir) | |
addFileHandler (string $type, string $event, $function) | |
breadCrumb (string $href, string $last='') | |
setFileSort (string $type='name') | |
getFSDir () | |
getDir ($type=null) | |
getFile (int $id) | |
searchMedia (string $query) | |
getPostMedia (int $post_id, $media_id=null, $link_type=null) | |
rebuild (string $pwd='') | |
makeDir (?string $directory) | |
removeDir (?string $directory) | |
createFile (string $name, ?string $title=null, bool $private=false, $dt=null, bool $force=true) | |
updateFile (fileItem $file, fileItem $newFile) | |
uploadFile (string $tmp, string $name, bool $overwrite=false, ?string $title=null, bool $private=false) | |
uploadBits (string $name, string $bits) | |
removeFile (?string $name) | |
getDBDirs () | |
inflateZipFile (fileItem $f, bool $create_dir=true) | |
getZipContent (fileItem $f) | |
mediaFireRecreateEvent (fileItem $f) | |
imageThumbCreate (?cursor $cur, string $f, bool $force=true) | |
imageThumbRemove (string $f) | |
![]() | |
__construct (?string $root, ?string $root_url='') | |
chdir (?string $dir) | |
getPwd () | |
writable () | |
addExclusion ($list) | |
inFiles (string $file) | |
getDir () | |
getRootDirs () | |
uploadFile (string $tmp, string $dest, bool $overwrite=false) | |
uploadBits (string $name, string $bits) | |
makeDir (?string $name) | |
moveFile (?string $src_path, ?string $dst_path) | |
removeItem (?string $name) | |
removeFile (?string $file) | |
removeDir (?string $directory) | |
Static Public Member Functions | |
static | audioPlayer (string $type, string $url, ?string $player=null, $args=null, bool $fallback=false, bool $preload=true) |
static | videoPlayer (string $type, string $url, ?string $player=null, $args=null, bool $fallback=false, bool $preload=true) |
static | mp3player (string $url, ?string $player=null, $args=null, bool $fallback=false, bool $preload=true) |
static | flvplayer (string $url, ?string $player=null, $args=null) |
Data Fields | |
const | MEDIA_TABLE_NAME = 'media' |
$thumb_tp = '%s/.%s_%s.jpg' | |
$thumb_tp_alpha = '%s/.%s_%s.png' | |
$thumb_tp_webp = '%s/.%s_%s.webp' | |
$thumb_sizes | |
$icon_img = 'images/media/%s.svg' | |
![]() | |
$root | |
$root_url | |
$dir | |
Protected Member Functions | |
callFileHandler (string $type, string $event,... $args) | |
fileRecord (dcRecord $rs) | |
sortFileHandler (?fileItem $a, ?fileItem $b) | |
rebuildDB (?string $pwd) | |
imageThumbUpdate (fileItem $file, fileItem $newFile) | |
imageMetaCreate (cursor $cur, string $f, int $id) | |
![]() | |
isExclude (string $path) | |
isFileExclude (string $file) | |
inJail (string $path) | |
sortHandler (fileItem $a, fileItem $b) | |
Protected Attributes | |
$con | |
$table | |
$type | |
$file_sort = 'name-asc' | |
$path | |
$relpwd | |
$file_handler = [] | |
$postmedia | |
![]() | |
$pwd | |
$exclude_list = [] | |
$exclude_pattern = '' | |
__construct | ( | string | $type = '' | ) |
Constructs a new instance.
string | $type | The media type filter |
Exception |
References filemanager\$root, filemanager\$root_url, $type, filemanager\addExclusion(), addFileHandler(), dcCore\app(), chdir(), path\clean(), and MEDIA_TABLE_NAME.
chdir | ( | ?string | $dir | ) |
Changes working directory.
string | $dir | The directory name |
Reimplemented from filemanager.
References filemanager\$dir.
Referenced by __construct(), and rebuild().
addFileHandler | ( | string | $type, |
string | $event, | ||
$function | |||
) |
Adds a new file handler for a given media type and event.
Available events are:
string | $type | The media type |
string | $event | The event |
callable | array | $function | The callback |
References $type.
Referenced by __construct().
|
protected |
Call filehandler depending on media type and event
string | $type | The type |
string | $event | The event |
mixed | ...$args The arguments |
References $type.
Referenced by createFile(), getDir(), mediaFireRecreateEvent(), removeFile(), and updateFile().
breadCrumb | ( | string | $href, |
string | $last = '' |
||
) |
Returns HTML breadCrumb for media manager navigation.
string | $href | The URL pattern |
string | $last | The last item pattern |
References filemanager\$pwd.
|
protected |
Get media file information from recordset
dcRecord | $rs | The recordset |
References dcCore\app(), path\info(), dcRecord\isEmpty(), filemanager\isFileExclude(), dcAuth\PERMISSION_MEDIA_ADMIN, and dt\str().
Referenced by getDir(), getFile(), getPostMedia(), and searchMedia().
setFileSort | ( | string | $type = 'name' | ) |
getFSDir | ( | ) |
Gets current working directory content (using filesystem).
getDir | ( | $type = null | ) |
Gets current working directory content.
mixed | $type | The media type filter |
Exception |
References filemanager\$dir, $type, dcCore\app(), callFileHandler(), createFile(), fileRecord(), getFile(), files\getMimeType(), filemanager\inFiles(), dcAuth\PERMISSION_MEDIA, and dcAuth\PERMISSION_MEDIA_ADMIN.
getFile | ( | int | $id | ) |
Gets file by its id. Returns a filteItem object.
int | $id | The file identifier |
References dcCore\app(), fileRecord(), and dcAuth\PERMISSION_MEDIA_ADMIN.
Referenced by getDir().
searchMedia | ( | string | $query | ) |
Search into media db (only).
string | $query | The search query |
References dcCore\app(), fileRecord(), and dcAuth\PERMISSION_MEDIA_ADMIN.
getPostMedia | ( | int | $post_id, |
$media_id = null , |
|||
$link_type = null |
|||
) |
Returns media items attached to a blog post. Result is an array containing fileItems objects.
int | $post_id | The post identifier |
mixed | $media_id | The media identifier(s) |
mixed | $link_type | The link type(s) |
References $path, and fileRecord().
rebuild | ( | string | $pwd = '' | ) |
Rebuilds database items collection. Optional $pwd parameter is the path where to start rebuild.
string | $pwd | The directory to rebuild |
Exception |
References filemanager\$dir, filemanager\$pwd, dcCore\app(), chdir(), createFile(), rebuild(), and rebuildDB().
Referenced by rebuild().
|
protected |
Rebuilds database items collection. Optional $pwd parameter is the path where to start rebuild else its the current directory
string | $pwd | The directory to rebuild |
Exception |
References filemanager\$pwd.
Referenced by rebuild().
makeDir | ( | ?string | $directory | ) |
Makes a dir.
string | $directory | the directory to create |
Reimplemented from filemanager.
References dcCore\app(), and files\tidyFileName().
removeDir | ( | ?string | $directory | ) |
Remove a dir.
Removes a directory which is relative to working directory.
string | $directory | Directory to remove |
Reimplemented from filemanager.
References dcCore\app().
createFile | ( | string | $name, |
?string | $title = null , |
||
bool | $private = false , |
||
$dt = null , |
|||
bool | $force = true |
||
) |
Creates or updates a file in database. Returns new media ID or false if file does not exist.
string | $name | The file name (relative to working directory) |
string | $title | The file title |
bool | $private | File is private |
mixed | $dt | File date |
bool | $force | The force flag |
Exception |
References dcCore\app(), callFileHandler(), path\clean(), files\getMimeType(), dcAuth\PERMISSION_MEDIA, dcAuth\PERMISSION_MEDIA_ADMIN, and dt\strftime().
Referenced by getDir(), rebuild(), uploadBits(), and uploadFile().
Updates a file in database.
Exception |
References dcCore\app(), callFileHandler(), if, filemanager\isFileExclude(), filemanager\moveFile(), dcAuth\PERMISSION_MEDIA, dcAuth\PERMISSION_MEDIA_ADMIN, and files\tidyFileName().
uploadFile | ( | string | $tmp, |
string | $name, | ||
bool | $overwrite = false , |
||
?string | $title = null , |
||
bool | $private = false |
||
) |
Uploads a file.
string | $tmp | The full path of temporary uploaded file |
string | $name | The file name (relative to working directory)me |
bool | $overwrite | File should be overwrite |
string | $title | The file title (should be string|null) |
bool | $private | File is private |
Exception |
References dcCore\app(), createFile(), dcAuth\PERMISSION_MEDIA, dcAuth\PERMISSION_MEDIA_ADMIN, and files\tidyFileName().
uploadBits | ( | string | $name, |
string | $bits | ||
) |
Creates a file from binary content.
string | $name | The file name (relative to working directory) |
string | $bits | The binary file contentits |
Exception |
Reimplemented from filemanager.
References dcCore\app(), createFile(), dcAuth\PERMISSION_MEDIA, dcAuth\PERMISSION_MEDIA_ADMIN, and files\tidyFileName().
removeFile | ( | ?string | $name | ) |
Removes a file.
string | $name | filename |
Exception |
Reimplemented from filemanager.
References dcCore\app(), callFileHandler(), path\clean(), files\getMimeType(), dcAuth\PERMISSION_MEDIA, and dcAuth\PERMISSION_MEDIA_ADMIN.
getDBDirs | ( | ) |
Root directories
Returns an array of directory under $root
directory.
@uses fileItem
References filemanager\$dir.
Extract zip file in current location.
Exception |
References text\deaccent().
getZipContent | ( | fileItem | $f | ) |
mediaFireRecreateEvent | ( | fileItem | $f | ) |
Calls file handlers registered for recreate event.
References callFileHandler(), and files\getMimeType().
Create image thumbnails
cursor | $cur | The cursor |
string | $f | Image filename |
bool | $force | Force creation |
References imageThumbRemove(), and path\info().
imageThumbRemove | ( | string | $f | ) |
Remove image thumbnails
string | $f | Image filename |
References path\info().
Referenced by imageThumbCreate().
|
protected |
Create image meta
cursor | $cur | The cursor |
string | $f | Image filename |
int | $id | The media identifier |
References dcCore\app(), dt\getTimeOffset(), imageMeta\readMeta(), and dt\str().
|
static |
Returns HTML code for audio player (HTML5)
string | $type | The audio mime type |
string | $url | The audio URL to play |
string | $player | The player URL |
mixed | $args | The player arguments |
bool | $fallback | The fallback |
bool | $preload | Add preload="auto" attribute if true, else preload="none" |
Referenced by adminMediaList\mediaLine(), and mp3player().
|
static |
Returns HTML code for video player (HTML5)
string | $type | The video mime type |
string | $url | The video URL to play |
string | $player | The player URL |
mixed | $args | The player arguments |
bool | $fallback | The fallback (not more used) |
bool | $preload | Add preload="auto" attribute if true, else preload="none" |
References $type.
|
static |
Returns HTML code for MP3 player (HTML5)
string | $url | The audio URL to play |
string | $player | The player URL |
mixed | $args | The player arguments |
bool | $fallback | The fallback (not more used) |
bool | $preload | Add preload="auto" attribute if true, else preload="none" |
References audioPlayer().
|
static |
Returns HTML code for FLV player
string | $url | The url |
string | $player | The player |
mixed | $args | The arguments |
const MEDIA_TABLE_NAME = 'media' |
Referenced by __construct(), and dcPostMedia\getPostMedia().
|
protected |
|
protected |
|
protected |
Referenced by __construct(), addFileHandler(), callFileHandler(), getDir(), setFileSort(), and videoPlayer().
|
protected |
|
protected |
Referenced by getPostMedia().
|
protected |
|
protected |
|
protected |
$thumb_tp = '%s/.%s_%s.jpg' |
$thumb_tp_alpha = '%s/.%s_%s.png' |
$thumb_tp_webp = '%s/.%s_%s.webp' |
$thumb_sizes |
$icon_img = 'images/media/%s.svg' |