Moodle  2.2.1
http://www.collinsharper.com
Zend_Validate_File_MimeType Class Reference
Inheritance diagram for Zend_Validate_File_MimeType:
Collaboration diagram for Zend_Validate_File_MimeType:

Public Member Functions

 __construct ($mimetype)
 getMagicFile ()
 setMagicFile ($file)
 getHeaderCheck ()
 enableHeaderCheck ($headerCheck=true)
 getMimeType ($asArray=false)
 setMimeType ($mimetype)
 addMimeType ($mimetype)
 isValid ($value, $file=null)

Data Fields

const FALSE_TYPE = 'fileMimeTypeFalse'
const NOT_DETECTED = 'fileMimeTypeNotDetected'
const NOT_READABLE = 'fileMimeTypeNotReadable'

Protected Member Functions

 _throw ($file, $errorType)

Protected Attributes

 $_messageTemplates
 $_messageVariables
 $_type
 $_mimetype
 $_magicfile
 $_finfo
 $_magicFiles
 $_headerCheck = false

Detailed Description

Definition at line 35 of file MimeType.php.


Constructor & Destructor Documentation

__construct ( mimetype)

Sets validator options

Mimetype to accept

Parameters:
string | array$mimetypeMimeType
Returns:
void

Reimplemented in Zend_Validate_File_IsCompressed, and Zend_Validate_File_IsImage.

Definition at line 120 of file MimeType.php.

Here is the call graph for this function:


Member Function Documentation

_throw ( file,
errorType 
) [protected]

Throws an error of the given type

Parameters:
string$file
string$errorType
Returns:
false

Reimplemented in Zend_Validate_File_IsImage, and Zend_Validate_File_IsCompressed.

Definition at line 386 of file MimeType.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addMimeType ( mimetype)

Adds the mimetypes

Parameters:
string | array$mimetypeThe mimetypes to add for validation
Returns:
Zend_Validate_File_Extension Provides a fluent interface

Definition at line 271 of file MimeType.php.

Here is the call graph for this function:

Here is the caller graph for this function:

enableHeaderCheck ( headerCheck = true)

Defines if the http header should be used Note that this is unsave and therefor the default value is false

Parameters:
boolean$checkHeader
Returns:
Zend_Validate_File_MimeType Provides fluid interface

Definition at line 229 of file MimeType.php.

Here is the caller graph for this function:

Returns the Header Check option

Returns:
boolean

Definition at line 217 of file MimeType.php.

Returns the actual set magicfile

Returns:
string

Definition at line 149 of file MimeType.php.

Here is the call graph for this function:

Here is the caller graph for this function:

getMimeType ( asArray = false)

Returns the set mimetypes

Parameters:
boolean$asArrayReturns the values as array, when false an concated string is returned
Returns:
string|array

Definition at line 241 of file MimeType.php.

Here is the caller graph for this function:

isValid ( value,
file = null 
)

Defined by Zend_Validate_Interface

Returns true if the mimetype of the file matches the given ones. Also parts of mimetypes can be checked. If you give for example "image" all image mime types will be accepted like "image/gif", "image/jpeg" and so on.

Parameters:
string$valueReal file to check for mimetype
array$fileFile data from Zend_File_Transfer
Returns:
boolean

Reimplemented in Zend_Validate_File_ExcludeMimeType.

Definition at line 317 of file MimeType.php.

Here is the call graph for this function:

setMagicFile ( file)

Sets the magicfile to use if null, the MAGIC constant from php is used if the MAGIC file is errorous, no file will be set

Parameters:
string$file
Exceptions:
Zend_Validate_ExceptionWhen finfo can not read the magicfile
Returns:
Zend_Validate_File_MimeType Provides fluid interface

Definition at line 186 of file MimeType.php.

Here is the caller graph for this function:

setMimeType ( mimetype)

Sets the mimetypes

Parameters:
string | array$mimetypeThe mimetypes to validate
Returns:
Zend_Validate_File_Extension Provides a fluent interface

Definition at line 258 of file MimeType.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$_finfo [protected]

Definition at line 87 of file MimeType.php.

$_headerCheck = false [protected]

Definition at line 110 of file MimeType.php.

$_magicfile [protected]

Definition at line 80 of file MimeType.php.

$_magicFiles [protected]
Initial value:
 array(
        '/usr/share/misc/magic',
        '/usr/share/misc/magic.mime',
        '/usr/share/misc/magic.mgc',
        '/usr/share/mime/magic',
        '/usr/share/mime/magic.mime',
        '/usr/share/mime/magic.mgc',
        '/usr/share/file/magic',
        '/usr/share/file/magic.mime',
        '/usr/share/file/magic.mgc',
    )

Definition at line 93 of file MimeType.php.

$_messageTemplates [protected]
Initial value:
 array(
        self::FALSE_TYPE   => "File '%value%' has a false mimetype of '%type%'",
        self::NOT_DETECTED => "The mimetype of file '%value%' could not be detected",
        self::NOT_READABLE => "File '%value%' can not be read",
    )

Reimplemented from Zend_Validate_Abstract.

Reimplemented in Zend_Validate_File_IsCompressed, and Zend_Validate_File_IsImage.

Definition at line 48 of file MimeType.php.

$_messageVariables [protected]
Initial value:
 array(
        'type' => '_type'
    )

Reimplemented from Zend_Validate_Abstract.

Definition at line 57 of file MimeType.php.

$_mimetype [protected]

Definition at line 73 of file MimeType.php.

$_type [protected]

Definition at line 64 of file MimeType.php.

const FALSE_TYPE = 'fileMimeTypeFalse'

#@+ Error type constants

Reimplemented in Zend_Validate_File_IsCompressed, Zend_Validate_File_IsImage, and Zend_Validate_File_ExcludeMimeType.

Definition at line 40 of file MimeType.php.

const NOT_DETECTED = 'fileMimeTypeNotDetected'
const NOT_READABLE = 'fileMimeTypeNotReadable'

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations