MIME_Type
[ class tree: MIME_Type ] [ index: MIME_Type ] [ all elements ]

Class: MIME_Type

Source Location: /MIME_Type-1.2.0/MIME/Type.php

Class Overview


Class for working with MIME types


Author(s):

Version:

  • 1.2.0

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 36]
Class for working with MIME types


[ Top ]


Class Variables

$media =  ''

[line 43]

The MIME media type

Type:   string


[ Top ]

$parameters = array()

[line 57]

Optional MIME parameters

Type:   array


[ Top ]

$subType =  ''

[line 50]

The MIME media sub-type

Type:   string


[ Top ]

$validMediaTypes = array(
        'text',
        'image',
        'audio',
        'video',
        'application',
        'multipart',
        'message'
    )

[line 66]

List of valid media types.

A media type is the string in front of the slash. The media type of "text/xml" would be "text".


Type:   array


[ Top ]



Method Detail

MIME_Type (Constructor)   [line 88]

void MIME_Type( [string $type = false])

Constructor.

If $type is set, if will be parsed and the appropriate class vars set. If not, you get an empty class. This is useful, but not quite as useful as parsing a type.


Parameters:

string   $type   —  MIME type

[ Top ]

addParameter   [line 380]

void addParameter( string $name, string $value, [string $comment = false])

Add a parameter to this type

Parameters:

string   $name   —  Attribute name
string   $value   —  Attribute value
string   $comment   —  Comment for this parameter

[ Top ]

autoDetect   [line 423]

string autoDetect( string $file, [bool $params = false])

Autodetect a file's MIME-type

This function may be called staticly.

  • Return: MIME-type on success, PEAR_Error otherwise
  • Since: 1.0.0beta1

Parameters:

string   $file   —  Path to the file to get the type of
bool   $params   —  Append MIME parameters if true

[ Top ]

get   [line 272]

string get( )

Create a textual MIME type from object values

This function performs the opposite function of parse().

  • Return: MIME type string

[ Top ]

getMedia   [line 239]

string getMedia( string $type)

Get a MIME type's media
  • Return: media

Parameters:

string   $type   —  MIME type to get media of

[ Top ]

getParameters   [line 143]

array getParameters( string $type)

Get a MIME type's parameters
  • Return: parameters

Parameters:

string   $type   —  MIME type to get parameters of

[ Top ]

getSubType   [line 254]

string getSubType( string $type)

Get a MIME type's subtype
  • Return: subtype, null if invalid mime type

Parameters:

string   $type   —  MIME type to get subtype of

[ Top ]

hasParameters   [line 126]

boolean hasParameters( string $type)

Does this type have any parameters?
  • Return: true if $type has parameters, false otherwise

Parameters:

string   $type   —  MIME type to check

[ Top ]

isExperimental   [line 295]

boolean isExperimental( string $type)

Is this type experimental?
  • Return: true if $type is experimental, false otherwise

Parameters:

string   $type   —  MIME type to check

[ Top ]

isVendor   [line 315]

boolean isVendor( string $type)

Is this a vendor MIME type?
  • Return: true if $type is a vendor type, false otherwise

Parameters:

string   $type   —  MIME type to check

[ Top ]

isWildcard   [line 332]

boolean isWildcard( string $type)

Is this a wildcard type?
  • Return: true if $type is a wildcard, false otherwise

Parameters:

string   $type   —  MIME type to check

[ Top ]

parse   [line 103]

void parse( string $type)

Parse a mime-type and set the class variables.

Parameters:

string   $type   —  MIME type to parse

[ Top ]

removeParameter   [line 398]

void removeParameter( string $name)

Remove a parameter from this type

Parameters:

string   $name   —  Parameter name

[ Top ]

stripComments   [line 180]

string stripComments( string $string, string &$comment)

Removes comments from a media type, subtype or parameter.
  • Return: String without comments

Parameters:

string   $string   —  String to strip comments from
string   &$comment   —  Comment is stored in there.

[ Top ]

stripParameters   [line 162]

string stripParameters( string $type)

Strip parameters from a MIME type string.
  • Return: MIME type with parameters removed

Parameters:

string   $type   —  MIME type string

[ Top ]

wildcardMatch   [line 353]

boolean wildcardMatch( string $card, string $type)

Perform a wildcard match on a MIME type

Example: MIME_Type::wildcardMatch('image/*', 'image/png')

  • Return: true if there was a match, false otherwise

Parameters:

string   $card   —  Wildcard to check against
string   $type   —  MIME type to check

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:28:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.