[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/ -> filelib.php (summary)

(no description)

File Size: 1103 lines (47 kb)
Included or required: 7 times
Referenced: 1 time
Includes or requires: 0 files

Defines 16 functions

  get_file_url()
  download_file_content()
  get_mimetypes_array()
  mimeinfo()
  mimeinfo_from_type()
  mimeinfo_from_icon()
  get_mimetype_description()
  send_temp_file()
  send_temp_file_finished()
  send_file()
  get_records_csv()
  put_records_csv()
  fulldelete()
  readfile_chunked()
  byteserving_send_file()
  file_modify_html_header()

Functions
Functions that are not part of a class:

get_file_url($path, $options=null, $type='coursefile')   X-Ref
No description

download_file_content($url, $headers=null, $postdata=null, $fullresponse=false, $timeout=300, $connecttimeout=20, $skipcertverify=false)   X-Ref
Fetches content of file from Internet (using proxy if defined). Uses cURL extension if present.
Due to security concerns only downloads from http(s) sources are supported.

param: string $url file url starting with http(s)://
param: array $headers http headers, null if none. If set, should be an
param: array $postdata array means use POST request with given parameters
param: bool $fullresponse return headers, responses, etc in a similar way snoopy does
param: int $timeout timeout for complete download process including all file transfer
param: int $connecttimeout timeout for connection to server; this is the timeout that
param: bool $skipcertverify If true, the peer's SSL certificate will not be checked. Only use this when already in a trusted location.
return: mixed false if request failed or content of the file as string if ok.

get_mimetypes_array()   X-Ref

return: List of information about file types based on extensions.

mimeinfo($element, $filename)   X-Ref
Obtains information about a filetype based on its extension. Will
use a default if no information is present about that particular
extension.

param: string $element Desired information (usually 'icon'
param: string $filename Filename we're looking up
return: string Requested piece of information from array

mimeinfo_from_type($element, $mimetype)   X-Ref
Obtains information about a filetype based on the MIME type rather than
the other way around.

param: string $element Desired information (usually 'icon')
param: string $mimetype MIME type we're looking up
return: string Requested piece of information from array

mimeinfo_from_icon($element, $icon)   X-Ref
Get information about a filetype based on the icon file.

param: string $element Desired information (usually 'icon')
param: string $icon Icon file path.
return: string Requested piece of information from array

get_mimetype_description($mimetype,$capitalise=false)   X-Ref
Obtains descriptions for file types (e.g. 'Microsoft Word document') from the
mimetypes.php language file.

param: string $mimetype MIME type (can be obtained using the mimeinfo function)
param: bool $capitalise If true, capitalises first character of result
return: string Text description

send_temp_file($path, $filename, $pathisstring=false)   X-Ref
Handles the sending of temporary file to user, download is forced.
File is deleted after abort or succesful sending.

param: string $path path to file, preferably from moodledata/temp/something; or content of file itself
param: string $filename proposed file name when saving file
param: bool $path is content of file

send_temp_file_finished($path)   X-Ref
Internal callnack function used by send_temp_file()


send_file($path, $filename, $lifetime = 'default' , $filter=0, $pathisstring=false, $forcedownload=false, $mimetype='')   X-Ref
Handles the sending of file data to the user's browser, including support for
byteranges etc.

param: string $path Path of file on disk (including real filename), or actual content of file as string
param: string $filename Filename to send
param: int $lifetime Number of seconds before the file should expire from caches (default 24 hours)
param: int $filter 0 (default)=no filtering, 1=all files, 2=html files only
param: bool $pathisstring If true (default false), $path is the content to send and not the pathname
param: bool $forcedownload If true (default false), forces download of file rather than view in browser/plugin
param: string $mimetype Include to specify the MIME type; leave blank to have it guess the type from $filename

get_records_csv($file, $table)   X-Ref
No description

put_records_csv($file, $records, $table = NULL)   X-Ref
No description

fulldelete($location)   X-Ref
Recursively delete the file or folder with path $location. That is,
if it is a file delete it. If it is a folder, delete all its content
then delete it. If $location does not exist to start, that is not
considered an error.

param: $location the path to remove.

readfile_chunked($filename, $retbytes=true)   X-Ref
Improves memory consumptions and works around buggy readfile() in PHP 5.0.4 (2MB readfile limit).


byteserving_send_file($filename, $mimetype, $ranges)   X-Ref
Send requested byterange of file.


file_modify_html_header($text)   X-Ref
add includes (js and css) into uploaded files
before returning them, useful for themes and utf.js includes

param: string text - text to search and replace
return: string - text with added head includes



Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7