|
static | getDocType ($doc) |
| Returns a human-readable type name for a document, based on the file extension of the supplied file name. More...
|
|
static | getDocSize ($doc) |
| Returns the file size in Kb for a document. More...
|
|
static | getDocIcon ($doc) |
|
static | getIcon ($file) |
| Retrieves a graphic icon appropriate for the given file. More...
|
|
static | getMIMEType ($filename) |
|
Definition at line 113 of file document_handler.inc.
◆ DocumentHandler()
DocumentHandler::DocumentHandler |
( |
| ) |
|
◆ getDocIcon()
static DocumentHandler::getDocIcon |
( |
|
$doc | ) |
|
|
static |
Definition at line 189 of file document_handler.inc.
192 $n = strtolower($doc);
193 $extension = substr($n, strrpos($n,
"."));
195 if (!$icon) $icon =
"/fakoli/images/file_icon.png";
◆ getDocMimeType()
DocumentHandler::getDocMimeType |
( |
|
$name | ) |
|
Replaces getMimeType because name conflicts with getMIMEType.
- Parameters
-
Definition at line 178 of file document_handler.inc.
182 $n = strtolower($name);
183 $extension = substr($n, strrpos($n,
"."));
185 if (!$type) $type=
"application/octet-stream";
◆ getDocSize()
static DocumentHandler::getDocSize |
( |
|
$doc | ) |
|
|
static |
Returns the file size in Kb for a document.
- Parameters
-
string | $doc | the (local) URL of the document
|
Definition at line 147 of file document_handler.inc.
155 $doc_file = str_replace($config[
"uploadurl"], $config[
"uploaddir"], $doc_file);
159 if (file_exists($doc_file))
161 $doc_size = (int)(filesize($doc_file)/1024);
◆ getDocType()
static DocumentHandler::getDocType |
( |
|
$doc | ) |
|
|
static |
Returns a human-readable type name for a document, based on the file extension of the supplied file name.
- Parameters
-
string | $doc | the filename of the document |
Definition at line 126 of file document_handler.inc.
130 $d = strtolower($doc);
132 $ext = substr($d, strrpos($d,
"."));
136 if (!$doc_type) $doc_type =
"Unknown";
$doc_extensions
Mapping of common file extensions to human-readable document type.
◆ getIcon()
static DocumentHandler::getIcon |
( |
|
$file | ) |
|
|
static |
Retrieves a graphic icon appropriate for the given file.
- Parameters
-
$file | the name of the file |
- Returns
- string URL of the graphic icon for the file
Definition at line 204 of file document_handler.inc.
207 global $auto_form_defaults;
209 $ext = substr($file, strrpos($file,
"."));
211 trace(
"getIcon($file) $ext $icon", 3);
218 return $auto_form_defaults[
"componentPath"].$icon;
trace($msg, $lvl=3, $callStack=null)
Send output to the trace log.
◆ getMIMEType()
static DocumentHandler::getMIMEType |
( |
|
$filename | ) |
|
|
static |
Definition at line 221 of file document_handler.inc.
225 'txt' =>
'text/plain',
226 'htm' =>
'text/html',
227 'html' =>
'text/html',
229 'js' =>
'application/javascript',
230 'json' =>
'application/json',
231 'xml' =>
'application/xml',
232 'swf' =>
'application/x-shockwave-flash',
233 'flv' =>
'video/x-flv',
236 'png' =>
'image/png',
237 'jpe' =>
'image/jpeg',
238 'jpeg' =>
'image/jpeg',
239 'jpg' =>
'image/jpeg',
240 'gif' =>
'image/gif',
241 'bmp' =>
'image/bmp',
242 'ico' =>
'image/vnd.microsoft.icon',
243 'tiff' =>
'image/tiff',
244 'tif' =>
'image/tiff',
245 'svg' =>
'image/svg+xml',
246 'svgz' =>
'image/svg+xml',
249 'zip' =>
'application/zip',
250 'rar' =>
'application/x-rar-compressed',
251 'exe' =>
'application/x-msdownload',
252 'msi' =>
'application/x-msdownload',
253 'cab' =>
'application/vnd.ms-cab-compressed',
256 'mp3' =>
'audio/mpeg',
257 'qt' =>
'video/quicktime',
258 'mov' =>
'video/quicktime',
259 'mp4' =>
'video/mp4',
260 'm4a' =>
'audio/m4a',
263 'pdf' =>
'application/pdf',
264 'psd' =>
'image/vnd.adobe.photoshop',
265 'ai' =>
'application/postscript',
266 'eps' =>
'application/postscript',
267 'ps' =>
'application/postscript',
270 'doc' =>
'application/msword',
271 'rtf' =>
'application/rtf',
272 'xls' =>
'application/vnd.ms-excel',
273 'ppt' =>
'application/vnd.ms-powerpoint',
276 'odt' =>
'application/vnd.oasis.opendocument.text',
277 'ods' =>
'application/vnd.oasis.opendocument.spreadsheet',
280 $ext = strtolower(array_pop(explode(
'.',$filename)));
282 if (array_key_exists($ext, $mime_types))
284 return $mime_types[$ext];
286 elseif (function_exists(
'finfo_open'))
288 $finfo = finfo_open(FILEINFO_MIME);
289 $mimetype = finfo_file($finfo, $filename);
The documentation for this class was generated from the following file: