Handles everything related to enclosures (including Media RSS and iTunes RSS)

package SimplePie
subpackage API

 Methods

Constructor, used to input the data

__construct($link = null, $type = null, $length = null, $javascript = null, $bitrate = null, $captions = null, $categories = null, $channels = null, $copyright = null, $credits = null, $description = null, $duration = null, $expression = null, $framerate = null, $hashes = null, $height = null, $keywords = null, $lang = null, $medium = null, $player = null, $ratings = null, $restrictions = null, $samplingrate = null, $thumbnails = null, $title = null, $width = null

For documentation on all the parameters, see the corresponding properties and their accessors

uses If available, this will convert an IDN

Parameters

$link

$type

$length

$javascript

$bitrate

$captions

$categories

$channels

$copyright

$credits

$description

$duration

$expression

$framerate

$hashes

$height

$keywords

$lang

$medium

$player

$ratings

$restrictions

$samplingrate

$thumbnails

$title

$width

String-ified version

__toString() : string

Returns

string

Embed the enclosure using Javascript

embed(array|string $options = '', boolean $native = false) : string

$options is an array or comma-separated key:value string, with the following properties:

  • alt (string): Alternate content for when an end-user does not have the appropriate handler installed or when a file type is unsupported. Can be any text or HTML. Defaults to blank.
  • altclass (string): If a file type is unsupported, the end-user will see the alt text (above) linked directly to the content. That link will have this value as its class name. Defaults to blank.
  • audio (string): This is an image that should be used as a placeholder for audio files before they're loaded (QuickTime-only). Can be any relative or absolute URL. Defaults to blank.
  • bgcolor (string): The background color for the media, if not already transparent. Defaults to #ffffff.
  • height (integer): The height of the embedded media. Accepts any numeric pixel value (such as 360) or auto. Defaults to auto, and it is recommended that you use this default.
  • loop (boolean): Do you want the media to loop when its done? Defaults to false.
  • mediaplayer (string): The location of the included mediaplayer.swf file. This allows for the playback of Flash Video (.flv) files, and is the default handler for non-Odeo MP3's. Defaults to blank.
  • video (string): This is an image that should be used as a placeholder for video files before they're loaded (QuickTime-only). Can be any relative or absolute URL. Defaults to blank.
  • width (integer): The width of the embedded media. Accepts any numeric pixel value (such as 480) or auto. Defaults to auto, and it is recommended that you use this default.
  • widescreen (boolean): Is the enclosure widescreen or standard? This applies only to video enclosures, and will automatically resize the content appropriately. Defaults to false, implying 4:3 mode.

Note: Non-widescreen (4:3) mode with width and height set to auto will default to 480x360 video resolution. Widescreen (16:9) mode with width and height set to auto will default to 480x270 video resolution.

todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.

Parameters

$options

arraystring

Comma-separated key:value list, or array

$native

boolean

Use

Returns

stringHTML string to output

Get the bitrate

get_bitrate() : string | null

Returns

stringnull

Get a single caption

get_caption(integer $key = 0) : \SimplePie_Caption | null

Parameters

$key

integer

Returns

\SimplePie_Captionnull

Get all captions

get_captions() : array | null

Returns

arraynullArray of {@see SimplePie_Caption} objects

Get all categories

get_categories() : array | null

Returns

arraynullArray of {@see SimplePie_Category} objects

Get a single category

get_category(integer $key = 0) : \SimplePie_Category | null

Parameters

$key

integer

Returns

\SimplePie_Categorynull

Get the number of audio channels

get_channels() : integer | null

Returns

integernull

Get a single credit

get_credit(integer $key = 0) : \SimplePie_Credit | null

Parameters

$key

integer

Returns

\SimplePie_Creditnull

Get all credits

get_credits() : array | null

Returns

arraynullArray of {@see SimplePie_Credit} objects

Get the description of the enclosure

get_description() : string | null

Returns

stringnull

Get the duration of the enclosure

get_duration(string $convert = false) : string | integer | null

Parameters

$convert

string

Convert seconds into hh:mm:ss

Returns

stringintegernull'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)

Get the expression

get_expression() : string

Returns

stringProbably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full'

Get the file extension

get_extension() : string | null

Returns

stringnull

Get the framerate (in frames-per-second)

get_framerate() : string | null

Returns

stringnull

Get the preferred handler

get_handler() : string | null

Returns

stringnullOne of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'

Get a single hash

get_hash(integer $key = 0) : string | null
link http://www.rssboard.org/media-rss#media-hash

Parameters

$key

integer

Returns

stringnullHash as per `media:hash`, prefixed with "$algo:"

Get all credits

get_hashes() : array | null

Returns

arraynullArray of strings, see {@see get_hash()}

Get the height

get_height() : string | null

Returns

stringnull

Get a single keyword

get_keyword(integer $key = 0) : string | null

Parameters

$key

integer

Returns

stringnull

Get all keywords

get_keywords() : array | null

Returns

arraynullArray of strings

Get the language

get_language() : string | null
link http://tools.ietf.org/html/rfc3066

Returns

stringnullLanguage code as per RFC 3066

Get length

get_length() : float

Returns

floatLength in bytes

Get the medium

get_medium() : string | null
link http://www.rssboard.org/media-rss#media-content

Returns

stringnullShould be one of 'image', 'audio', 'video', 'document', 'executable'

Get the player URL

get_player() : string | null

Typically the same as \get_permalink()

Returns

stringnullPlayer URL

Get a single rating

get_rating(integer $key = 0) : \SimplePie_Rating | null

Parameters

$key

integer

Returns

\SimplePie_Ratingnull

Get all ratings

get_ratings() : array | null

Returns

arraynullArray of {@see SimplePie_Rating} objects

Get the real media type

get_real_type(boolean $find_handler = false) : string

Often, feeds lie to us, necessitating a bit of deeper inspection. This converts types to their canonical representations based on the file extension

see

Parameters

$find_handler

boolean

Internal use only, use {@see get_handler()} instead

Returns

stringMIME type

Get a single restriction

get_restriction(integer $key = 0) : \SimplePie_Restriction | null

Parameters

$key

integer

Returns

\SimplePie_Restrictionnull

Get all restrictions

get_restrictions() : array | null

Returns

arraynullArray of {@see SimplePie_Restriction} objects

Get the sampling rate (in kHz)

get_sampling_rate() : string | null

Returns

stringnull

Get the file size (in MiB)

get_size() : float | null

Returns

floatnullFile size in mebibytes (1048 bytes)

Get a single thumbnail

get_thumbnail(integer $key = 0) : string | null

Parameters

$key

integer

Returns

stringnullThumbnail URL

Get all thumbnails

get_thumbnails() : array | null

Returns

arraynullArray of thumbnail URLs

Get the title

get_title() : string | null

Returns

stringnull

Get mimetype of the enclosure

get_type() : string | null
see

Returns

stringnullMIME type

Get the width

get_width() : string | null

Returns

stringnull

Embed the enclosure using `<embed>`

native_embed(array|string $options = '') : string
deprecated Use the second parameter to {@see embed} instead

Parameters

$options

arraystring

See first paramter to {@see embed}

Returns

stringHTML string to output

 Properties

 

$bitrate

$bitrate : string

Default

see
 

$captions

$captions : array

Default

see
 

$categories

$categories : array

Default

see
 

$channels

$channels : integer

Default

see
   

$credits

$credits : array

Default

see
 

$description

$description : string

Default

see
 

$duration

$duration : integer

Default

see
 

$expression

$expression : string

Default

see
 

$framerate

$framerate : string

Default

see
 

$handler

$handler : string

Default

see
 

$hashes

$hashes : array

Default

see
 

$height

$height : string

Default

see
 

$javascript

$javascript : null

Default

deprecated
 

$keywords

$keywords : array

Default

see
 

$lang

$lang : string

Default

see
 

$length

$length : string

Default

see
   

$medium

$medium : string

Default

see
 

$player

$player : string

Default

see
 

$ratings

$ratings : array

Default

see
 

$restrictions

$restrictions : array

Default

see
 

$samplingrate

$samplingrate : string

Default

see
 

$thumbnails

$thumbnails : array

Default

see
 

$title

$title : string

Default

see
 

$type

$type : string

Default

see
 

$width

$width : string

Default

see