eZ Publish  [4.2]
eZMimeType Class Reference

Detection and management of MIME types. More...

List of all members.

Public Member Functions

 eZMimeType ()

Static Public Member Functions

static changeBasename (&$mimeInfo, $basename)
static changeDirectoryPath (&$mimeInfo, $dirpath)
static changeFileData (&$mimeInfo, $dirpath=false, $basename=false, $suffix=false, $filename=false)
static changeMIMEType (&$mimeInfo, $mimetype)
static defaultMimeType ()
static defaultValue ($url, $returnDefault)
static findByBuffer ($buffer, $length=false, $offset=false, $url=false, $returnDefault=true)
static findByFileContents ($url, $returnDefault=true)
static findByName ($mimeName, $returnDefault=true)
static findByURL ($url, $returnDefault=true)
static instance ()
 Returns a shared instance of the eZMimeType class.
static mimeTypeFor ($path, $file)

Public Attributes

 $MIMEList
 An associative array which maps MIME type name to MIME structure.
 $PrefixList
 An associative array which maps from prefix name to MIME type name.
 $QuickContentMatch
 $QuickMIMETypes = array()
 A list of suffixes and their MIME types, this is used to quickly initialize the system.
 $SuffixList
 An associative array which maps from suffix name to MIME type name.

Static Private Member Functions

static preparePrefixList (&$prefixList, $mimeList)
static prepareSuffixList (&$suffixList, $mimeList)

Detailed Description

Detection and management of MIME types.

The MIME type structure is an array with the following items:

  • name - The name of MIME type, eg. image/jpeg
  • suffixes - An array with possible suffixes for the filename, the first entry can be used as when creating filenames of the type. If no known suffixes exists this value is false
  • prefixes - An array with possible prefixes for the filename, the first entry can be used as when creating filenames of the type. If no known prefixes exists this value is false
  • is_valid - Boolean which tells whether this MIME type is valid or not, usually this is set to false if no match for the file was found in which case the name will also be application/octet-stream
  • url - The original url or file supplied to the matching system, can be false if buffer matching was used.
  • filename - Just the filename part of the url
  • dirpath - The directory path part of the url
  • basename - The basename of the filename without suffix or prefix
  • suffix - The suffix of the file or false if none
  • prefix - The prefix of the file or false if none

Definition at line 56 of file ezmimetype.php.


Member Function Documentation

static eZMimeType::changeBasename ( &$  mimeInfo,
basename 
) [static]

Changes the basename attribute for the MIME info structure $mimeInfo to $basename, and recreates all the affected fields.

Definition at line 167 of file ezmimetype.php.

Referenced by eZImageManager\createImageAlias().

static eZMimeType::changeDirectoryPath ( &$  mimeInfo,
dirpath 
) [static]

Changes the basename attribute for the MIME info structure $mimeInfo to $basename, and recreates all the affected fields.

Definition at line 181 of file ezmimetype.php.

Referenced by eZStylePackageCreator\commitCSSFile(), eZImageManager\convert(), eZImageAliasHandler\initializeFromFile(), eZImageAliasHandler\initializeFromHTTPFile(), eZStylePackageCreator\validateImageFiles(), and eZPackageCreationHandler\validatePackageThumbnail().

static eZMimeType::changeFileData ( &$  mimeInfo,
dirpath = false,
basename = false,
suffix = false,
filename = false 
) [static]

Changes the basename attribute for the MIME info structure $mimeInfo to $basename, and recreates all the affected fields.

Definition at line 194 of file ezmimetype.php.

Referenced by eZImageManager\convert(), and eZImageAliasHandler\updateAliasPath().

static eZMimeType::changeMIMEType ( &$  mimeInfo,
mimetype 
) [static]

Changes the MIME type attribute for the MIME info structure $mimeInfo to $mimetype, and recreates all the affected fields.

Definition at line 143 of file ezmimetype.php.

Referenced by eZImageManager\convert(), and eZImageManager\imageAliasInfo().

static eZMimeType::defaultMimeType ( ) [static]
Returns:
the default MIME-Type, this is used for all files that are not recognized.

Definition at line 94 of file ezmimetype.php.

Referenced by defaultValue().

static eZMimeType::defaultValue ( url,
returnDefault 
) [static]
Returns:
the defaultMimeType if $returnDefault is true, otherwise returns false.

Definition at line 112 of file ezmimetype.php.

Referenced by findByName(), and findByURL().

eZMimeType::eZMimeType ( )

Constructor

Definition at line 61 of file ezmimetype.php.

Referenced by instance().

static eZMimeType::findByBuffer ( buffer,
length = false,
offset = false,
url = false,
returnDefault = true 
) [static]

Finds the MIME type for the buffer $buffer by examining the contents and returns it. If $returnDefault is set to true then it will always return a MIME structure, if not it will return false if none were found.

Parameters:
$lengthIf specified it will limit how far the $buffer is examined
$offsetIf specified it will set the starting point for the $buffer examination
$urlIf specified the url will be used for MIME determination if buffer examination gives no results.
Note:
Currently it only calls findByURL()

Definition at line 349 of file ezmimetype.php.

static eZMimeType::findByName ( mimeName,
returnDefault = true 
) [static]
Returns:
the MIME structure for the MIME type $mimeName. If $returnDefault is set to true then it will always return a MIME structure, if not it will return false if none were found.

Definition at line 223 of file ezmimetype.php.

Referenced by changeMIMEType(), eZWebDAVContentServer\fetchNodeInfo(), eZWebDAVContentBackend\fetchNodeInfo(), eZImageAliasHandler\initializeFromHTTPFile(), and eZImageHandler\outputMIMEType().

static eZMimeType::findByURL ( url,
returnDefault = true 
) [static]

Finds the MIME type for the url $url by examining the url itself (not the content) and returns it. If $returnDefault is set to true then it will always return a MIME structure, if not it will return false if none were found.

Definition at line 253 of file ezmimetype.php.

Referenced by eZPDFTable\callImage(), eZFile\download(), eZHTTPFile\fetch(), eZWebDAVContentServer\fetchNodeInfo(), eZWebDAVContentBackend\fetchNodeInfo(), findByBuffer(), findByFileContents(), getFileInfo(), eZImageAliasHandler\initializeFromHTTPFile(), mimeTypeFor(), eZWebDAVServer\outputSendDataToClient(), eZWebDAVContentServer\putContentData(), eZImageAliasHandler\recreateDOMTree(), eZTemplateImageOperator\storeImage(), and eZImageType\validateObjectAttributeHTTPInput().

static eZMimeType::instance ( ) [static]

Returns a shared instance of the eZMimeType class.

Returns:
eZMimeType

Definition at line 359 of file ezmimetype.php.

Referenced by eZMimeType(), findByName(), and findByURL().

static eZMimeType::mimeTypeFor ( path,
file 
) [static]
Deprecated:
Returns:
the MIME-Type name for the file $file.

Definition at line 374 of file ezmimetype.php.

static eZMimeType::preparePrefixList ( &$  prefixList,
mimeList 
) [static, private]

Goes trough the mime list and creates a reference to the mime entry using the primary prefix.

Definition at line 413 of file ezmimetype.php.

Referenced by eZMimeType().

static eZMimeType::prepareSuffixList ( &$  suffixList,
mimeList 
) [static, private]

Goes trough the mime list and creates a reference to the mime entry using the primary suffix.

Definition at line 394 of file ezmimetype.php.

Referenced by eZMimeType().


Member Data Documentation

eZMimeType::$MIMEList

An associative array which maps MIME type name to MIME structure.

Definition at line 435 of file ezmimetype.php.

eZMimeType::$PrefixList

An associative array which maps from prefix name to MIME type name.

Definition at line 433 of file ezmimetype.php.

eZMimeType::$QuickContentMatch
Initial value:
 array(
        array( array( 0, 'string', 'GIF87a', 'image/gif' ),
               array( 0, 'string', 'GIF89a', 'image/gif' ) )
        )

Definition at line 437 of file ezmimetype.php.

eZMimeType::$QuickMIMETypes = array()

A list of suffixes and their MIME types, this is used to quickly initialize the system.

Definition at line 443 of file ezmimetype.php.

eZMimeType::$SuffixList

An associative array which maps from suffix name to MIME type name.

Definition at line 431 of file ezmimetype.php.


The documentation for this class was generated from the following file: