[ Index ] |
PHP Cross Reference of DokuWiki |
[Source view] [Print] [Project Stats]
All output and handler function needed for the media management popup
Author: | Andreas Gohr |
License: | GPL 2 (http://www.gnu.org/licenses/gpl.html) |
File Size: | 2239 lines (65 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
media_filesinuse($data, $id) X-Ref |
Lists pages which currently use a media file selected for deletion References uses the same visual as search results and share their CSS tags except pagenames won't be links. param: array $data param: string $id author: Matthias Grimm <matthiasgrimm@users.sourceforge.net> |
media_metasave($id, $auth, $data) X-Ref |
Handles the saving of image meta data param: string $id media id param: int $auth permission level param: array $data return: false|string author: Andreas Gohr <andi@splitbrain.org> author: Kate Arzamastseva <pshns@ukr.net> |
media_isexternal($id) X-Ref |
check if a media is external source param: string $id the media ID or URL return: bool author: Gerrit Uitslag <klapinklapin@gmail.com> |
media_ispublic($id) X-Ref |
Check if a media item is public (eg, external URL or readable by @ALL) param: string $id the media ID or URL return: bool author: Andreas Gohr <andi@splitbrain.org> |
media_metaform($id, $auth) X-Ref |
Display the form to edit image meta data param: string $id media id param: int $auth permission level return: bool author: Andreas Gohr <andi@splitbrain.org> author: Kate Arzamastseva <pshns@ukr.net> |
media_inuse($id) X-Ref |
Convenience function to check if a media file is still in use param: string $id media id return: array|bool author: Michael Klier <chi@chimeric.de> |
media_delete($id, $auth) X-Ref |
Handles media file deletions If configured, checks for media references before deletion param: string $id media id param: int $auth no longer used return: int One of: 0, author: Andreas Gohr <andi@splitbrain.org> |
media_upload_xhr($ns, $auth) X-Ref |
Handle file uploads via XMLHttpRequest param: string $ns target namespace param: int $auth current auth check result return: false|string false on error, id of the new file on success |
media_upload($ns, $auth, $file = false) X-Ref |
Handles media file uploads param: string $ns target namespace param: int $auth current auth check result param: bool|array $file $_FILES member, $_FILES['upload'] if false return: false|string false on error, id of the new file on success author: Andreas Gohr <andi@splitbrain.org> author: Michael Klier <chi@chimeric.de> |
copy_uploaded_file($from, $to) X-Ref |
An alternative to move_uploaded_file that copies Using copy, makes sure any setgid bits on the media directory are honored param: string $from param: string $to see: move_uploaded_file() return: bool |
media_save($file, $id, $ow, $auth, $move) X-Ref |
This generates an action event and delegates to _media_upload_action(). Action plugins are allowed to pre/postprocess the uploaded file. (The triggered event is preventable.) Event data: $data[0] fn_tmp: the temporary file name (read from $_FILES) $data[1] fn: the file name of the uploaded file $data[2] id: the future directory id of the uploaded file $data[3] imime: the mimetype of the uploaded file $data[4] overwrite: if an existing file is going to be overwritten $data[5] move: name of function that performs move/copy/.. param: array $file param: string $id media id param: bool $ow overwrite? param: int $auth permission level param: string $move name of functions that performs move/copy/.. return: false|array|string triggers: MEDIA_UPLOAD_FINISH |
_media_upload_action($data) X-Ref |
Callback adapter for media_upload_finish() triggered by MEDIA_UPLOAD_FINISH param: array $data event data return: false|array|string author: Michael Klier <chi@chimeric.de> |
media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'move_uploaded_file') X-Ref |
Saves an uploaded media file param: string $fn_tmp param: string $fn param: string $id media id param: string $imime mime type param: bool $overwrite overwrite existing? param: string $move function name return: array|string author: Andreas Gohr <andi@splitbrain.org> author: Michael Klier <chi@chimeric.de> author: Kate Arzamastseva <pshns@ukr.net> |
media_saveOldRevision($id) X-Ref |
Moves the current version of media file to the media_attic directory param: string $id return: int - revision date author: Kate Arzamastseva <pshns@ukr.net> |
media_contentcheck($file, $mime) X-Ref |
This function checks if the uploaded content is really what the mimetype says it is. We also do spam checking for text types here. We need to do this stuff because we can not rely on the browser to do this check correctly. Yes, IE is broken as usual. param: string $file path to file param: string $mime mimetype return: int author: Andreas Gohr <andi@splitbrain.org> link: http://www.splitbrain.org/blog/2007-02/12-internet_explorer_facilitates_cross_site_scripting |
media_notify($id, $file, $mime, $old_rev = false, $current_rev = false) X-Ref |
Send a notify mail on uploads param: string $id media id param: string $file path to file param: string $mime mime type param: bool|int $old_rev revision timestamp or false author: Andreas Gohr <andi@splitbrain.org> |
media_filelist($ns, $auth = null, $jump = '', $fullscreenview = false, $sort = false) X-Ref |
List all files in a given Media namespace param: string $ns namespace param: null|int $auth permission level param: string $jump id param: bool $fullscreenview param: bool|string $sort sorting order, false skips sorting |
media_tabs_files($selected_tab = '') X-Ref |
Prints tabs for files list actions param: string $selected_tab - opened tab author: Kate Arzamastseva <pshns@ukr.net> author: Adrian Lang <mail@adrianlang.de> |
media_tabs_details($image, $selected_tab = '') X-Ref |
Prints tabs for files details actions param: string $image filename of the current image param: string $selected_tab opened tab author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_files_options() X-Ref |
Prints options for the tab that displays a list of all files author: Kate Arzamastseva <pshns@ukr.net> |
_media_get_sort_type() X-Ref |
Returns type of sorting for the list of files in media manager return: string - sort type author: Kate Arzamastseva <pshns@ukr.net> |
_media_get_list_type() X-Ref |
Returns type of listing for the list of files in media manager return: string - list type author: Kate Arzamastseva <pshns@ukr.net> |
_media_get_display_param($param, $values) X-Ref |
Get display parameters param: string $param name of parameter param: array $values allowed values, where default value has index key 'default' return: string the parameter value |
media_tab_files($ns, $auth = null, $jump = '') X-Ref |
Prints tab that displays a list of all files param: string $ns param: null|int $auth permission level param: string $jump item id author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_upload($ns, $auth = null, $jump = '') X-Ref |
Prints tab that displays uploading form param: string $ns param: null|int $auth permission level param: string $jump item id author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_search($ns, $auth = null) X-Ref |
Prints tab that displays search form param: string $ns param: null|int $auth permission level author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_view($image, $ns, $auth = null, $rev = '') X-Ref |
Prints tab that displays mediafile details param: string $image media id param: string $ns param: null|int $auth permission level param: string|int $rev revision timestamp or empty string author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_edit($image, $ns, $auth = null) X-Ref |
Prints tab that displays form for editing mediafile metadata param: string $image media id param: string $ns param: null|int $auth permission level author: Kate Arzamastseva <pshns@ukr.net> |
media_tab_history($image, $ns, $auth = null) X-Ref |
Prints tab that displays mediafile revisions param: string $image media id param: string $ns param: null|int $auth permission level author: Kate Arzamastseva <pshns@ukr.net> |
media_preview($image, $auth, $rev = '', $meta = false) X-Ref |
Prints mediafile details param: string $image media id param: int $auth permission level param: int|string $rev revision timestamp or empty string param: JpegMeta|bool $meta author: Kate Arzamastseva <pshns@ukr.net> |
media_preview_buttons($image, $auth, $rev = '') X-Ref |
Prints mediafile action buttons param: string $image media id param: int $auth permission level param: int|string $rev revision timestamp, or empty string author: Kate Arzamastseva <pshns@ukr.net> |
media_image_preview_size($image, $rev, $meta = false, $size = 500) X-Ref |
Returns image width and height for mediamanager preview panel param: string $image param: int|string $rev param: JpegMeta|bool $meta param: int $size return: array author: Kate Arzamastseva <pshns@ukr.net> |
media_getTag($tags, $meta = false, $alt = '') X-Ref |
Returns the requested EXIF/IPTC tag from the image meta param: array $tags array with tags, first existing is returned param: JpegMeta $meta param: string $alt alternative value return: string author: Kate Arzamastseva <pshns@ukr.net> |
media_file_tags($meta) X-Ref |
Returns mediafile tags param: JpegMeta $meta return: array list of tags of the mediafile author: Kate Arzamastseva <pshns@ukr.net> |
media_details($image, $auth, $rev = '', $meta = false) X-Ref |
Prints mediafile tags param: string $image image id param: int $auth permission level param: string|int $rev revision timestamp, or empty string param: bool|JpegMeta $meta image object, or create one if false author: Kate Arzamastseva <pshns@ukr.net> |
media_diff($image, $ns, $auth, $fromajax = false) X-Ref |
Shows difference between two revisions of file param: string $image image id param: string $ns param: int $auth permission level param: bool $fromajax author: Kate Arzamastseva <pshns@ukr.net> |
_media_file_diff($data) X-Ref |
Callback for media file diff param: array $data event data |
media_file_diff($image, $l_rev, $r_rev, $ns, $auth, $fromajax) X-Ref |
Shows difference between two revisions of image param: string $image param: string|int $l_rev revision timestamp, or empty string param: string|int $r_rev revision timestamp, or empty string param: string $ns param: int $auth permission level param: bool $fromajax author: Kate Arzamastseva <pshns@ukr.net> |
media_image_diff($image, $l_rev, $r_rev, $l_size, $r_size, $type) X-Ref |
Prints two images side by side and slider param: string $image image id param: int $l_rev revision timestamp, or empty string param: int $r_rev revision timestamp, or empty string param: array $l_size array with width and height param: array $r_size array with width and height param: string $type author: Kate Arzamastseva <pshns@ukr.net> |
media_restore($image, $rev, $auth) X-Ref |
Restores an old revision of a media file param: string $image media id param: int $rev revision timestamp or empty string param: int $auth return: string - file's id author: Kate Arzamastseva <pshns@ukr.net> |
media_searchlist($query, $ns, $auth = null, $fullscreen = false, $sort = 'natural') X-Ref |
List all files found by the search request param: string $query param: string $ns param: null|int $auth param: bool $fullscreen param: string $sort triggers: MEDIA_SEARCH author: Tobias Sarnowski <sarnowski@cosmocode.de> author: Andreas Gohr <gohr@cosmocode.de> author: Kate Arzamastseva <pshns@ukr.net> |
media_printicon($filename, $size = '') X-Ref |
Display a media icon param: string $filename media id param: string $size the size subfolder, if not specified 16x16 is used return: string html |
media_managerURL($params = false, $amp = '&', $abs = false, $params_array = false) X-Ref |
Build link based on the current, adding/rewriting parameters param: array|bool $params param: string $amp separator param: bool $abs absolute url? param: bool $params_array return the parmeters array? return: string|array - link or link parameters author: Kate Arzamastseva <pshns@ukr.net> |
media_uploadform($ns, $auth, $fullscreen = false) X-Ref |
Print the media upload form if permissions are correct param: string $ns param: int $auth permission level param: bool $fullscreen author: Andreas Gohr <andi@splitbrain.org> author: Kate Arzamastseva <pshns@ukr.net> |
media_getuploadsize() X-Ref |
Returns the size uploaded files may have This uses a conservative approach using the lowest number found in any of the limiting ini settings returns: int size in bytes |
media_searchform($ns, $query = '', $fullscreen = false) X-Ref |
Print the search field form param: string $ns param: string $query param: bool $fullscreen author: Tobias Sarnowski <sarnowski@cosmocode.de> author: Kate Arzamastseva <pshns@ukr.net> |
media_nstree($ns) X-Ref |
Build a tree outline of available media namespaces param: string $ns author: Andreas Gohr <andi@splitbrain.org> |
media_nstree_item($item) X-Ref |
Userfunction for html_buildlist Prints a media namespace tree item param: array $item return: string html author: Andreas Gohr <andi@splitbrain.org> |
media_nstree_li($item) X-Ref |
Userfunction for html_buildlist Prints a media namespace tree item opener param: array $item return: string html author: Andreas Gohr <andi@splitbrain.org> |
media_mod_image($file, $ext, $w, $h = 0, $crop = false) X-Ref |
Resizes or crop the given image to the given size param: string $file filename, path to file param: string $ext extension param: int $w desired width param: int $h desired height param: bool $crop should a center crop be used? return: string path to resized or original size if failed author: Andreas Gohr <andi@splitbrain.org> |
media_resize_image($file, $ext, $w, $h = 0) X-Ref |
Resizes the given image to the given size param: string $file filename, path to file param: string $ext extension param: int $w desired width param: int $h desired height return: string path to resized or original size if failed author: Andreas Gohr <andi@splitbrain.org> |
media_crop_image($file, $ext, $w, $h = 0) X-Ref |
Center crops the given image to the wanted size param: string $file filename, path to file param: string $ext extension param: int $w desired width param: int $h desired height return: string path to resized or original size if failed author: Andreas Gohr <andi@splitbrain.org> |
media_get_token($id, $w, $h) X-Ref |
Calculate a token to be used to verify fetch requests for resized or cropped images have been internally generated - and prevent external DDOS attacks via fetch param: string $id id of the image param: int $w resize/crop width param: int $h resize/crop height return: string token or empty string if no token required author: Christopher Smith <chris@jalakai.co.uk> |
media_get_from_URL($url, $ext, $cache) X-Ref |
Download a remote file and return local filename returns false if download fails. Uses cached file if available and wanted param: string $url param: string $ext extension param: int $cache cachetime in seconds return: false|string path to cached file author: Andreas Gohr <andi@splitbrain.org> author: Pavel Vitis <Pavel.Vitis@seznam.cz> |
media_image_download($url, $file) X-Ref |
Download image files param: string $url param: string $file path to file in which to put the downloaded content return: bool author: Andreas Gohr <andi@splitbrain.org> |
media_resize_imageIM($ext, $from, $from_w, $from_h, $to, $to_w, $to_h) X-Ref |
resize images using external ImageMagick convert program param: string $ext extension param: string $from filename path to file param: int $from_w original width param: int $from_h original height param: string $to path to resized file param: int $to_w desired width param: int $to_h desired height return: bool author: Pavel Vitis <Pavel.Vitis@seznam.cz> author: Andreas Gohr <andi@splitbrain.org> |
media_crop_imageIM($ext, $from, $from_w, $from_h, $to, $to_w, $to_h, $ofs_x, $ofs_y) X-Ref |
crop images using external ImageMagick convert program param: string $ext extension param: string $from filename path to file param: int $from_w original width param: int $from_h original height param: string $to path to resized file param: int $to_w desired width param: int $to_h desired height param: int $ofs_x offset of crop centre param: int $ofs_y offset of crop centre return: bool author: Andreas Gohr <andi@splitbrain.org> |
media_resize_imageGD($ext, $from, $from_w, $from_h, $to, $to_w, $to_h, $ofs_x = 0, $ofs_y = 0) X-Ref |
resize or crop images using PHP's libGD support param: string $ext extension param: string $from filename path to file param: int $from_w original width param: int $from_h original height param: string $to path to resized file param: int $to_w desired width param: int $to_h desired height param: int $ofs_x offset of crop centre param: int $ofs_y offset of crop centre return: bool author: Andreas Gohr <andi@splitbrain.org> author: Sebastian Wienecke <s_wienecke@web.de> |
media_alternativefiles($src, $exts) X-Ref |
Return other media files with the same base name but different extensions. param: string $src - ID of media file param: string[] $exts - alternative extensions to find other files for return: array - array(mime type => file ID) author: Anika Henke <anika@selfthinker.org> |
media_supportedav($mime, $type = null) X-Ref |
Check if video/audio is supported to be embedded. param: string $mime - mimetype of media file param: string $type - type of media files to check ('video', 'audio', or null for all) return: boolean author: Anika Henke <anika@selfthinker.org> |
media_trackfiles($src) X-Ref |
Return track media files with the same base name but extensions that indicate kind and lang. ie for foo.webm search foo.sub.lang.vtt, foo.cap.lang.vtt... param: string $src - ID of media file return: array - array(mediaID => array( kind, srclang )) author: Schplurtz le Déboulonné <Schplurtz@laposte.net> |