-package-
[ class tree: -package- ] [ index: -package- ] [ all elements ]

Class: MIME_Type

Source Location: /MIME_Type-1.0.0beta3/Type.php

Class Overview


Class for working with MIME types


Author(s):

Version:

  • @version@

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 33]
Class for working with MIME types


[ Top ]


Class Variables

$media =  ''

[line 39]

The MIME media type

Type:   string


[ Top ]

$parameters = array()

[line 53]

Optional MIME parameters

Type:   array


[ Top ]

$subType =  ''

[line 46]

The MIME media sub-type

Type:   string


[ Top ]

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

[line 60]

List of valid media types

Type:   array


[ Top ]



Method Detail

MIME_Type (Constructor)   [line 81]

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 296]

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 329]

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 196]

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 167]

string getMedia( $type $type)

Get a MIME type's media
  • Return: media

Parameters:

$type   $type   —  string MIME type to get media of

[ Top ]

getParameters   [line 132]

array getParameters( $type $type)

Get a MIME type's parameters
  • Return: parameters

Parameters:

$type   $type   —  string MIME type to get parameters of

[ Top ]

getSubType   [line 181]

string getSubType( $type $type)

Get a MIME type's subtype
  • Return: subtype

Parameters:

$type   $type   —  string MIME type to get subtype of

[ Top ]

hasParameters   [line 116]

boolean hasParameters( $type $type)

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

Parameters:

$type   $type   —  string MIME type to check

[ Top ]

isExperimental   [line 217]

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 235]

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 251]

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 95]

void parse( $type $type)

Parse a mime-type

Parameters:

$type   $type   —  string MIME type to parse

[ Top ]

removeParameter   [line 312]

void removeParameter( string $name)

Remove a parameter from this type

Parameters:

string   $name   —  Parameter name

[ Top ]

stripParameters   [line 150]

string stripParameters( string $type)

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

Parameters:

string   $type   —  MIME type string

[ Top ]

wildcardMatch   [line 270]

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 13:54:21 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.