eZ Publish  [4.0]
ezmimetype.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZMimeType class
00004 //
00005 // Created on: <15-Aug-2002 12:44:57 sp>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezmimetype.php
00032 */
00033 
00034 /*!
00035   \class eZMimeType ezmimetype.php
00036   \ingroup eZUtils
00037   \brief Detection and management of MIME types.
00038 
00039   The MIME type structure is an array with the following items:
00040   - name     - The name of MIME type, eg. image/jpeg
00041   - suffixes - An array with possible suffixes for the filename, the first entry can be used as when creating filenames of the type.
00042                If no known suffixes exists this value is \a false
00043   - prefixes - An array with possible prefixes for the filename, the first entry can be used as when creating filenames of the type.
00044                If no known prefixes exists this value is \a false
00045   - is_valid - Boolean which tells whether this MIME type is valid or not, usually this is set to \c false if no
00046                match for the file was found in which case the name will also be application/octet-stream
00047   - url      - The original url or file supplied to the matching system, can be \c false if buffer matching was used.
00048   - filename - Just the filename part of the url
00049   - dirpath  - The directory path part of the url
00050   - basename - The basename of the filename without suffix or prefix
00051   - suffix   - The suffix of the file or \c false if none
00052   - prefix   - The prefix of the file or \c false if none
00053 
00054 */
00055 
00056 class eZMimeType
00057 {
00058     /*!
00059      Constructor
00060     */
00061     function eZMimeType()
00062     {
00063         $this->SuffixList = array();
00064         $this->PrefixList = array();
00065         $this->MIMEList = array();
00066 
00067         foreach ( $this->QuickMIMETypes as $quickMIMEType )
00068         {
00069             $mimeEntry =& $this->MIMEList[$quickMIMEType[1]];
00070             if ( !isset( $mimeEntry ) )
00071                 $mimeEntry = array( 'suffixes' => array(),
00072                                     'prefixes' => false );
00073             $mimeEntry['suffixes'][] = $quickMIMEType[0];
00074         }
00075 
00076         eZMimeType::prepareSuffixList( $this->SuffixList, $this->MIMEList );
00077         eZMimeType::preparePrefixList( $this->PrefixList, $this->MIMEList );
00078     }
00079 
00080     /*!
00081      \static
00082      \return the default MIME-Type, this is used for all files that are not recognized.
00083     */
00084     static function defaultMimeType()
00085     {
00086         return array( 'name' => 'application/octet-stream',
00087                       'url' => false,
00088                       'filename' => false,
00089                       'dirpath' => false,
00090                       'basename' => false,
00091                       'suffix' => false,
00092                       'prefix' => false,
00093                       'suffixes' => false,
00094                       'prefixes' => false,
00095                       'is_valid' => true );
00096     }
00097 
00098     /*!
00099      \static
00100      \return the defaultMimeType if \a $returnDefault is \c true, otherwise returns \c false.
00101     */
00102     static function defaultValue( $url, $returnDefault )
00103     {
00104         if ( $returnDefault )
00105         {
00106             $mime = eZMimeType::defaultMimeType();
00107             $mime['url'] = $url;
00108             $suffixPos = strpos( $url, '.' );
00109 
00110             if ( $suffixPos !== false )
00111             {
00112                 $mime['suffix'] = substr( $url, $suffixPos + 1 );
00113                 $mime['dirpath'] = dirname( $url );
00114                 $mime['basename'] = basename( $url, '.' . $mime['suffix'] );
00115                 $mime['filename'] = $mime['basename'] . '.' . $mime['suffix'];
00116             }
00117             else
00118             {
00119                 $mime['basename'] = $url;
00120                 $mime['suffix'] = false;
00121             }
00122             $mime['is_valid'] = false;
00123             return $mime;
00124         }
00125         else
00126             return false;
00127     }
00128 
00129     /*!
00130      Changes the MIME type attribute for the MIME info structure \a $mimeInfo to \a $mimetype,
00131      and recreates all the affected fields.
00132     */
00133     static function changeMIMEType( &$mimeInfo, $mimetype )
00134     {
00135         $mimeInfo['name'] = $mimetype;
00136         $newMimeInfo = eZMimeType::findByName( $mimetype );
00137         $mimeInfo['suffixes'] = $newMimeInfo['suffixes'];
00138         $mimeInfo['prefixes'] = $newMimeInfo['prefixes'];
00139         $mimeInfo['suffix'] = $newMimeInfo['suffix'];
00140         $mimeInfo['prefix'] = $newMimeInfo['prefix'];
00141         $filename = $mimeInfo['filename'];
00142         $dotPosition = strrpos( $filename, '.' );
00143         $basename = $filename;
00144         if ( $dotPosition !== false )
00145             $basename = substr( $filename, 0, $dotPosition );
00146         $mimeInfo['filename'] = $basename . '.' . $mimeInfo['suffix'];
00147         if ( $mimeInfo['dirpath'] )
00148             $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
00149         else
00150             $mimeInfo['url'] = $mimeInfo['filename'];
00151     }
00152 
00153     /*!
00154      Changes the basename attribute for the MIME info structure \a $mimeInfo to \a $basename,
00155      and recreates all the affected fields.
00156     */
00157     static function changeBasename( &$mimeInfo, $basename )
00158     {
00159         $mimeInfo['basename'] = $basename;
00160         $mimeInfo['filename'] = $basename . '.' . $mimeInfo['suffix'];
00161         if ( $mimeInfo['dirpath'] )
00162             $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
00163         else
00164             $mimeInfo['url'] = $mimeInfo['filename'];
00165     }
00166 
00167     /*!
00168      Changes the basename attribute for the MIME info structure \a $mimeInfo to \a $basename,
00169      and recreates all the affected fields.
00170     */
00171     static function changeDirectoryPath( &$mimeInfo, $dirpath )
00172     {
00173         $mimeInfo['dirpath'] = $dirpath;
00174         if ( $mimeInfo['dirpath'] )
00175             $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
00176         else
00177             $mimeInfo['url'] = $mimeInfo['filename'];
00178     }
00179 
00180     /*!
00181      Changes the basename attribute for the MIME info structure \a $mimeInfo to \a $basename,
00182      and recreates all the affected fields.
00183     */
00184     static function changeFileData( &$mimeInfo, $dirpath = false, $basename = false, $suffix = false, $filename = false )
00185     {
00186         if ( $basename !== false )
00187             $mimeInfo['basename'] = $basename;
00188         if ( $suffix !== false )
00189             $mimeInfo['suffix'] = $suffix;
00190         if ( $filename !== false )
00191         {
00192             $mimeInfo['filename'] = $filename;
00193         }
00194         else
00195         {
00196             $mimeInfo['filename'] = $mimeInfo['basename'];
00197             $mimeInfo['filename'] .= '.' . $mimeInfo['suffix'];
00198         }
00199         if ( $dirpath !== false )
00200             $mimeInfo['dirpath'] = $dirpath;
00201 
00202         if ( $mimeInfo['dirpath'] )
00203             $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
00204         else
00205             $mimeInfo['url'] = $mimeInfo['filename'];
00206     }
00207 
00208     /*!
00209      \return the MIME structure for the MIME type \a $mimeName.
00210      If \a $returnDefault is set to \c true then it will always return a MIME structure,
00211      if not it will return \c false if none were found.
00212     */
00213     static function findByName( $mimeName, $returnDefault = true )
00214     {
00215         $instance = eZMimeType::instance();
00216         $mimeList =& $instance->MIMEList;
00217         if ( isset( $mimeList[$mimeName] ) )
00218         {
00219             $mime = $mimeList[$mimeName];
00220             $mime['name'] = $mimeName;
00221             $mime['url'] = false;
00222             $mime['filename'] = false;
00223             $mime['dirpath'] = false;
00224             $mime['basename'] = false;
00225             $mime['suffix'] = false;
00226             if ( isset( $mime['suffixes'][0] ) )
00227                 $mime['suffix'] = $mime['suffixes'][0];
00228             $mime['prefix'] = false;
00229             if ( isset( $mime['prefixes'][0] ) )
00230                 $mime['prefix'] = $mime['prefixes'][0];
00231             $mime['is_valid'] = true;
00232             return $mime;
00233         }
00234         return eZMimeType::defaultValue( false, $returnDefault );
00235     }
00236 
00237     /*!
00238      \static
00239      Finds the MIME type for the url \a $url by examining the url itself (not the content) and returns it.
00240      If \a $returnDefault is set to \c true then it will always return a MIME structure,
00241      if not it will return \c false if none were found.
00242     */
00243     static function findByURL( $url, $returnDefault = true )
00244     {
00245         $instance = eZMimeType::instance();
00246 
00247         $file = $url;
00248         $dirPosition = strrpos( $url, '/' );
00249         if ( $dirPosition !== false )
00250             $file = substr( $url, $dirPosition + 1 );
00251         $suffixPosition = strrpos( $file, '.' );
00252         $suffix = false;
00253         $prefix = false;
00254         $mimeName = false;
00255         if ( $suffixPosition !== false )
00256         {
00257             $suffix = strtolower( substr( $file, $suffixPosition + 1 ) );
00258             if ( $suffix )
00259             {
00260                 $subURL = substr( $file, 0, $suffixPosition );
00261                 $suffixList =& $instance->SuffixList;
00262                 if ( array_key_exists( $suffix, $suffixList ) )
00263                 {
00264                     $mimeName = $suffixList[$suffix];
00265                 }
00266             }
00267             if ( !$mimeName )
00268             {
00269                 $prefixPosition = strpos( $file, '.' );
00270                 if ( $prefixPosition !== false )
00271                 {
00272                     $prefix = strtolower( substr( $file, 0, $prefixPosition ) );
00273                 }
00274                 if ( $prefix )
00275                 {
00276                     $subURL = substr( $file, $suffixPosition + 1 );
00277                     $prefixList =& $instance->PrefixList;
00278                     if ( array_key_exists( $prefix, $prefixList ) )
00279                     {
00280                         $mimeName = $prefixList[$prefix];
00281                     }
00282                 }
00283             }
00284             if ( $mimeName )
00285             {
00286                 $mimeList =& $instance->MIMEList;
00287                 if ( array_key_exists( $mimeName, $mimeList ) )
00288                 {
00289                     $lastDirPosition = strrpos( $url, '/' );
00290                     $filename = $url;
00291                     $dirpath = false;
00292                     if ( $lastDirPosition !== false )
00293                     {
00294                         $filename = substr( $url, $lastDirPosition + 1 );
00295                         $dirpath = substr( $url, 0, $lastDirPosition );
00296                     }
00297                     $lastDirPosition = strrpos( $subURL, '/' );
00298                     $basename = $subURL;
00299                     if ( $lastDirPosition !== false )
00300                         $basename = substr( $subURL, $lastDirPosition + 1 );
00301                     $mime = $mimeList[$mimeName];
00302                     $mime['name'] = $mimeName;
00303                     $mime['url'] = $url;
00304                     $mime['filename'] = $filename;
00305                     $mime['dirpath'] = $dirpath;
00306                     $mime['basename'] = $basename;
00307                     $mime['suffix'] = $suffix;
00308                     $mime['prefix'] = $prefix;
00309                     $mime['is_valid'] = true;
00310                     return $mime;
00311                 }
00312             }
00313         }
00314         return eZMimeType::defaultValue( $url, $returnDefault );
00315     }
00316 
00317     /*!
00318      \static
00319      Finds the MIME type for the url \a $url by examining the contents of the url and returns it.
00320      If \a $returnDefault is set to \c true then it will always return a MIME structure,
00321      if not it will return \c false if none were found.
00322      \note Currently it only calls findByURL()
00323     */
00324     static function findByFileContents( $url, $returnDefault = true )
00325     {
00326         return eZMimeType::findByURL( $url, $returnDefault );
00327     }
00328 
00329     /*!
00330      \static
00331      Finds the MIME type for the buffer \a $buffer by examining the contents and returns it.
00332      If \a $returnDefault is set to \c true then it will always return a MIME structure,
00333      if not it will return \c false if none were found.
00334      \param $length If specified it will limit how far the \a $buffer is examined
00335      \param $offset If specified it will set the starting point for the \a $buffer examination
00336      \param $url If specified the url will be used for MIME determination if buffer examination gives no results.
00337      \note Currently it only calls findByURL()
00338     */
00339     static function findByBuffer( $buffer, $length = false, $offset = false, $url = false, $returnDefault = true )
00340     {
00341         return eZMimeType::findByURL( $url, $returnDefault );
00342     }
00343 
00344     /*!
00345      \static
00346      \return the unique instance of the eZMimeType class.
00347     */
00348     static function instance()
00349     {
00350         $instance =& $GLOBALS['eZMIMETypeInstance'];
00351         if ( !isset( $instance ) )
00352         {
00353             $instance = new eZMimeType();
00354         }
00355         return $instance;
00356     }
00357 
00358     /*!
00359      \deprecated
00360      \static
00361      \return the MIME-Type name for the file \a $file.
00362     */
00363     static function mimeTypeFor( $path, $file )
00364     {
00365         eZDebug::writeWarning( 'eZMimeType::mimeTypeFor() is deprecated, use eZMimeType::findByURL() instead',
00366                                'DEPRECATED FUNCTION eZMimeType::mimeTypeFor' );
00367         $url = $path;
00368         if ( $url )
00369             $url .= '/' . $file;
00370         else
00371             $url = $file;
00372         $match = eZMimeType::findByURL( $url, false );
00373         if ( $match )
00374             return $match['name'];
00375         else
00376             return false;
00377     }
00378 
00379     /*!
00380      \private
00381      Goes trough the mime list and creates a reference to the mime entry using the primary suffix.
00382     */
00383     static function prepareSuffixList( &$suffixList, $mimeList )
00384     {
00385         foreach ( $mimeList as $mimeName => $mimeData )
00386         {
00387             if ( is_array( $mimeData['suffixes'] ) )
00388             {
00389                 foreach ( $mimeData['suffixes'] as $suffix )
00390                 {
00391                     if ( !isset( $suffixList[$suffix] ) )
00392                         $suffixList[$suffix] = $mimeName;
00393                 }
00394             }
00395         }
00396     }
00397 
00398     /*!
00399      \private
00400      Goes trough the mime list and creates a reference to the mime entry using the primary prefix.
00401     */
00402     static function preparePrefixList( &$prefixList, $mimeList )
00403     {
00404         foreach ( $mimeList as $mimeName => $mimeData )
00405         {
00406             if ( is_array( $mimeData['prefixes'] ) )
00407             {
00408                 foreach ( $mimeData['prefixes'] as $prefix )
00409                 {
00410                     if ( !isset( $prefixList[$prefix] ) )
00411                         $prefixList[$prefix] = $mimeName;
00412                 }
00413             }
00414         }
00415     }
00416 
00417     /// \privatesection
00418 
00419     /// An associative array which maps from suffix name to MIME type name.
00420     public $SuffixList;
00421     /// An associative array which maps from prefix name to MIME type name.
00422     public $PrefixList;
00423     /// An associative array which maps MIME type name to MIME structure.
00424     public $MIMEList;
00425 
00426     public $QuickContentMatch = array(
00427         array( array( 0, 'string', 'GIF87a', 'image/gif' ),
00428                array( 0, 'string', 'GIF89a', 'image/gif' ) )
00429         );
00430 
00431     /// A list of suffixes and their MIME types, this is used to quickly initialize the system.
00432     /// Should be removed to a .ini file or other external file
00433     public $QuickMIMETypes = array(
00434         array( 'ezpkg', 'application/x-ezpublish-package' ),
00435         array( 'ez', 'application/andrew-inset' ),
00436         array( 'hqx', 'application/mac-binhex40' ),
00437         array( 'cpt', 'application/mac-compactpro' ),
00438         array( 'doc', 'application/msword' ),
00439         array( 'bin', 'application/octet-stream' ),
00440         array( 'dms', 'application/octet-stream' ),
00441         array( 'lha', 'application/octet-stream' ),
00442         array( 'lzh', 'application/octet-stream' ),
00443         array( 'exe', 'application/octet-stream' ),
00444         array( 'class', 'application/octet-stream' ),
00445         array( 'oda', 'application/oda' ),
00446         array( 'pdf', 'application/pdf' ),
00447         array( 'ps', 'application/postscript' ),
00448         array( 'eps', 'application/postscript' ),
00449         array( 'ai', 'application/postscript' ),
00450         array( 'rtf', 'application/rtf' ),
00451         array( 'sgml', 'application/sgml' ),
00452         array( 'ppt', 'application/vnd.ms-powerpoint' ),
00453         array( 'xls', 'application/vnd.ms-excel' ),
00454         array( 'slc', 'application/vnd.wap.slc' ),
00455         array( 'sic', 'application/vnd.wap.sic' ),
00456         array( 'wmlc', 'application/vnd.wap.wmlc' ),
00457         array( 'wmlsc', 'application/vnd.wap.wmlscriptc' ),
00458         array( 'dmg', 'application/x-apple-diskimage' ),
00459         array( 'bcpio', 'application/x-bcpio' ),
00460         array( 'bz2', 'application/x-bzip2' ),
00461         array( 'vcd', 'application/x-cdlink' ),
00462         array( 'pgn', 'application/x-chess-pgn' ),
00463         array( 'cpio', 'application/x-cpio' ),
00464         array( 'csh', 'application/x-csh' ),
00465         array( 'dcr', 'application/x-director' ),
00466         array( 'dir', 'application/x-director' ),
00467         array( 'dxr', 'application/x-director' ),
00468         array( 'dvi', 'application/x-dvi' ),
00469         array( 'spl', 'application/x-futuresplash' ),
00470         array( 'gtar', 'application/x-gtar' ),
00471         array( 'gz', 'application/x-gzip' ),
00472         array( 'tgz', 'application/x-gzip' ),
00473         array( 'hdf', 'application/x-hdf' ),
00474         array( 'js', 'application/x-javascript' ),
00475         array( 'kwd', 'application/x-kword' ),
00476         array( 'kwt', 'application/x-kword' ),
00477         array( 'ksp', 'application/x-kspread' ),
00478         array( 'kpr', 'application/x-kpresenter' ),
00479         array( 'kpt', 'application/x-kpresenter' ),
00480         array( 'chrt', 'application/x-kchart' ),
00481         array( 'kil', 'application/x-killustrator' ),
00482         array( 'skp', 'application/x-koan' ),
00483         array( 'skd', 'application/x-koan' ),
00484         array( 'skt', 'application/x-koan' ),
00485         array( 'skm', 'application/x-koan' ),
00486         array( 'latex', 'application/x-latex' ),
00487         array( 'nc', 'application/x-netcdf' ),
00488         array( 'cdf', 'application/x-netcdf' ),
00489         array( 'rpm', 'application/x-rpm' ),
00490         array( 'sh', 'application/x-sh' ),
00491         array( 'shar', 'application/x-shar' ),
00492         array( 'swf', 'application/x-shockwave-flash' ),
00493         array( 'sit', 'application/x-stuffit' ),
00494         array( 'sv4cpio', 'application/x-sv4cpio' ),
00495         array( 'sv4crc', 'application/x-sv4crc' ),
00496         array( 'tar', 'application/x-tar' ),
00497         array( 'tcl', 'application/x-tcl' ),
00498         array( 'tex', 'application/x-tex' ),
00499         array( 'texinfo', 'application/x-texinfo' ),
00500         array( 'texi', 'application/x-texinfo' ),
00501         array( 't', 'application/x-troff' ),
00502         array( 'tr', 'application/x-troff' ),
00503         array( 'roff', 'application/x-troff' ),
00504         array( 'man', 'application/x-troff-man' ),
00505         array( 'me', 'application/x-troff-me' ),
00506         array( 'ms', 'application/x-troff-ms' ),
00507         array( 'ustar', 'application/x-ustar' ),
00508         array( 'src', 'application/x-wais-source' ),
00509         array( 'zip', 'application/zip' ),
00510         array( 'mid', 'audio/midi' ),
00511         array( 'midi', 'audio/midi' ),
00512         array( 'kar', 'audio/midi' ),
00513         array( 'mpga', 'audio/mpeg' ),
00514         array( 'mp2', 'audio/mpeg' ),
00515         array( 'mp3', 'audio/mpeg' ),
00516         array( 'ra', 'audio/x-realaudio' ),
00517         array( 'pdb', 'chemical/x-pdb' ),
00518         array( 'xyz', 'chemical/x-pdb' ),
00519         array( 'gif', 'image/gif' ),
00520         array( 'ief', 'image/ief' ),
00521         array( 'jpg', 'image/jpeg' ),
00522         array( 'jpeg', 'image/jpeg' ),
00523         array( 'jpe', 'image/jpeg' ),
00524         array( 'png', 'image/png' ),
00525         array( 'tif', 'image/tiff' ),
00526         array( 'tiff', 'image/tiff' ),
00527         array( 'pcx', 'image/x-pcx' ),
00528 
00529         // XML media types as defined in RFC 3023
00530         array( 'xml', 'text/xml' ),
00531         array( 'svg', 'image/svg+xml' ),
00532         array( 'svgz', 'image/svg+xml' ),
00533         array( 'ent', 'application/xml-external-parsed-entity' ),
00534         array( 'dtd', 'application/xml-dtd' ),
00535         array( 'mod', 'application/xml-dtd' ),
00536         array( 'xsl', 'application/xslt+xml' ),
00537         array( 'xslt', 'application/xslt+xml' ),
00538         array( 'rdf', 'application/rdf+xml' ),
00539         array( 'mml', 'application/mathml+xml' ),
00540 
00541         array( 'wbmp', 'image/vnd.wap.wbmp' ),
00542         array( 'ras', 'image/x-cmu-raster' ),
00543         array( 'pnm', 'image/x-portable-anymap' ),
00544         array( 'pbm', 'image/x-portable-bitmap' ),
00545         array( 'pgm', 'image/x-portable-graymap' ),
00546         array( 'ppm', 'image/x-portable-pixmap' ),
00547         array( 'rgb', 'image/x-rgb' ),
00548         array( 'xbm', 'image/x-xbitmap' ),
00549         array( 'xpm', 'image/x-xpixmap' ),
00550         array( 'xwd', 'image/x-xwindowdump' ),
00551         array( 'bmp', 'image/bmp' ),
00552         array( 'pict', 'image/x-pict' ),
00553         array( 'pct', 'image/x-pict' ),
00554         array( 'tga', 'image/tga' ),
00555         array( 'xcf', 'image/x-xcf-gimp' ),
00556         array( 'psd', 'application/x-photoshop' ),
00557         array( 'igs', 'model/iges' ),
00558         array( 'iges', 'model/iges' ),
00559         array( 'msh', 'model/mesh' ),
00560         array( 'mesh', 'model/mesh' ),
00561         array( 'silo', 'model/mesh' ),
00562         array( 'wrl', 'model/vrml' ),
00563         array( 'vrml', 'model/vrml' ),
00564         array( 'css', 'text/css' ),
00565         array( 'txt', 'text/plain' ),
00566         array( 'asc', 'text/plain' ),
00567         array( 'rtx', 'text/richtext' ),
00568         array( 'rtf', 'text/rtf' ),
00569         array( 'sgml', 'text/sgml' ),
00570         array( 'sgm', 'text/sgml' ),
00571         array( 'tsv', 'text/tab-separated-values' ),
00572         array( 'sl', 'text/vnd.wap.sl' ),
00573         array( 'si', 'text/vnd.wap.si' ),
00574         array( 'wml', 'text/vnd.wap.wml' ),
00575         array( 'wmls', 'text/vnd.wap.wmlscript' ),
00576         array( 'etx', 'text/x-setext' ),
00577         array( 'mpeg', 'video/mpeg' ),
00578         array( 'mpg', 'video/mpeg' ),
00579         array( 'mpe', 'video/mpeg' ),
00580         array( 'mov', 'video/quicktime' ),
00581         array( 'qt', 'video/quicktime' ),
00582         array( 'avi', 'video/x-msvideo' ),
00583         array( 'movie', 'video/x-sgi-movie' ),
00584         array( 'ice', 'x-conference/x-cooltalk' ),
00585         array( 'rmm', 'audio/x-pn-realaudio' ),
00586         array( 'ram', 'audio/x-pn-realaudio' ),
00587         array( 'ra', 'audio/vnd.rn-realaudio' ),
00588         array( 'smi', 'application/smil' ),
00589         array( 'smil', 'application/smil' ),
00590         array( 'rt', 'text/vnd.rn-realtext' ),
00591         array( 'rv', 'video/vnd.rn-realvideo' ),
00592         array( 'rf', 'image/vnd.rn-realflash' ),
00593         array( 'swf', 'image/vnd.rn-realflash' ),
00594         array( 'rf', 'application/x-shockwave-flash2-preview' ),
00595         array( 'swf', 'application/x-shockwave-flash2-preview' ),
00596         array( 'flv', 'video/x-flv' ),
00597         array( 'sdp', 'application/sdp' ),
00598         array( 'sdp', 'application/x-sdp' ),
00599         array( 'rm', 'application/vnd.rn-realmedia' ),
00600         array( 'rp', 'image/vnd.rn-realpix' ),
00601         array( 'wav', 'audio/wav' ),
00602         array( 'wav', 'audio/x-wav' ),
00603         array( 'wav', 'audio/x-pn-wav' ),
00604         array( 'wav', 'audio/x-pn-windows-acm' ),
00605         array( 'au', 'audio/basic' ),
00606         array( 'au', 'audio/x-pn-au' ),
00607         array( 'aiff', 'audio/aiff' ),
00608         array( 'af', 'audio/aiff' ),
00609         array( 'aiff', 'audio/x-aiff' ),
00610         array( 'af', 'audio/x-aiff' ),
00611         array( 'aiff', 'audio/x-pn-aiff' ),
00612         array( 'af', 'audio/x-pn-aiff' ),
00613         array( 'html', 'text/html' ),
00614         array( 'htm', 'text/html' ),
00615         array( 'sxw', 'application/vnd.sun.xml.writer' ),
00616         array( 'sxc', 'application/vnd.sun.xml.calc' ),
00617         array( 'sxi', 'application/vnd.sun.xml.impress' ),
00618         array( 'odt', 'application/vnd.oasis.opendocument.text' ),
00619         array( 'ods', 'application/vnd.oasis.opendocument.spreadsheet' ),
00620         array( 'odp', 'application/vnd.oasis.opendocument.presentation' ),
00621         array( 'odg', 'application/vnd.oasis.opendocument.graphics' ),
00622         array( 'odc', 'application/vnd.oasis.opendocument.chart' ),
00623         array( 'odf', 'application/vnd.oasis.opendocument.formula' ),
00624         array( 'odb', 'application/vnd.oasis.opendocument.database' ),
00625         array( 'odi', 'application/vnd.oasis.opendocument.image' ),
00626         array( 'odm', 'application/vnd.oasis.opendocument.text-master' ),
00627         array( 'ott', 'application/vnd.oasis.opendocument.text-template' ),
00628         array( 'ots', 'application/vnd.oasis.opendocument.spreadsheet-template' ),
00629         array( 'otp', 'application/vnd.oasis.opendocument.presentation-template' ),
00630         array( 'otg', 'application/vnd.oasis.opendocument.graphics-template' ),
00631         array( 'asf', 'video/x-ms-asf' ),
00632         array( 'wmv', 'video/x-ms-wmv' ),
00633         array( 'docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ),
00634         array( 'xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ),
00635         array( 'pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation' ),
00636         array( 'mp4', 'video/mp4' ),
00637         array( '3gp', 'video/3gpp'),
00638         array( '3gp', 'audio/3gpp')
00639         );
00640 }
00641 ?>