[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.mime_magic.inc.php (sommaire)

(pas de description)

Poids: 850 lignes (44 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

mime_magic:: (9 méthodes):
  mime_magic()
  ext2mime()
  filename2mime()
  filename2mine()
  mime2ext()
  analyze_file()
  analyze_data()
  get_mime_ext_map()
  get_mime_magic_file()


Classe: mime_magic  - X-Ref

mime_magic()   X-Ref
Constructor

Load the map values into the instance arrays
author: skwashd

ext2mime($ext)   X-Ref
Attempt to convert a file extension to a MIME type

This is the simplest MIME type guessing function - rough but fast.
If the MIME type is not found then 'application/octet-stream'
is returned.

param: string $ext  The file extension to be mapped to a MIME type.
return: string  The MIME type of the file extension.

filename2mime($filename)   X-Ref
Attempt to convert a filename to a MIME type, based on the
global and application specific config files.

Unlike ext2mime, this function will return
'application/octet-stream' for any unknown or empty extension

author: skwashd - changed it to make it work with file.tar.gz etc
param: string $filename  The filename to be mapped to a MIME type.
return: string  The MIME type of the filename.

filename2mine($filename)   X-Ref
Pas de description

mime2ext($type)   X-Ref
Attempt to convert a MIME type to a file extension, based
on the global Horde and application specific config files.

If we cannot map the type to a file extension, we return false.

param: string $type  The MIME type to be mapped to a file extension.
return: string  The file extension of the MIME type.

analyze_file($path)   X-Ref
Uses variants of the UNIX "file" command to attempt to determine the
MIME type of an unknown file.

param: string $filename The filename (including full path) to the file to analyze.
return: string  The MIME type of the file.  Returns false if either

analyze_data($data)   X-Ref
Instead of using an existing file a chunk of data is used for
testing.  Best to handle the file creation here, to make sure
it is secure and it is properly cleaned up.  Really just
a temp file creation and clean up method wrapper for analyze_file()

author: skwashd
param: string $data the data to analyze
param: string MIME type false for none.

get_mime_ext_map()   X-Ref
Get an array containing a mapping of common file extensions to
MIME types.

Original array taken from http://horde.org

author: skwashd
return: array of extenstion to mime mappings

get_mime_magic_file()   X-Ref
Get the mime magic mapping file - last resort test

Note Taken from horde.org - no copyright notice attached

author: skwashd - converted to a function
return: array mime magic data



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7