SimplePie: PHP-based RSS and Atom feed handling
 
  • Overview
  • Demo
  • Blog
  • Download
  • Documentation
  • API Docs
  • Support
  • Issue Tracker
  • FAQ
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • SimplePie
    • API
    • Caching
    • HTTP
    • Parsing

Classes

  • SimplePie
  • SimplePie_Author
  • SimplePie_Caption
  • SimplePie_Category
  • SimplePie_Copyright
  • SimplePie_Core
  • SimplePie_Credit
  • SimplePie_Enclosure
  • SimplePie_Item
  • SimplePie_Rating
  • SimplePie_Restriction
  • SimplePie_Source

Class SimplePie_Enclosure

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

Used by SimplePie_Item::get_enclosure() and SimplePie_Item::get_enclosures()

This class can be overloaded with SimplePie::set_enclosure_class()

Package: SimplePie\API
Copyright: 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
License: BSD License
Author: Ryan Parman
Author: Geoffrey Sneddon
Author: Ryan McCue
Located at SimplePie/Enclosure.php
Methods summary
public
# __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 )

Constructor, used to input the data

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

Uses

idna_convert If available, this will convert an IDN
public string
# __toString( )

String-ified version

Returns

string
public string|null
# get_bitrate( )

Get the bitrate

Returns

string|null
public SimplePie_Caption|null
# get_caption( integer $key = 0 )

Get a single caption

Parameters

$key
integer

Returns

SimplePie_Caption|null
public array|null
# get_captions( )

Get all captions

Returns

array|null
Array of SimplePie_Caption objects
public SimplePie_Category|null
# get_category( integer $key = 0 )

Get a single category

Parameters

$key
integer

Returns

SimplePie_Category|null
public array|null
# get_categories( )

Get all categories

Returns

array|null
Array of SimplePie_Category objects
public integer|null
# get_channels( )

Get the number of audio channels

Returns

integer|null
public SimplePie_Copyright|null
# get_copyright( )

Get the copyright information

Returns

SimplePie_Copyright|null
public SimplePie_Credit|null
# get_credit( integer $key = 0 )

Get a single credit

Parameters

$key
integer

Returns

SimplePie_Credit|null
public array|null
# get_credits( )

Get all credits

Returns

array|null
Array of SimplePie_Credit objects
public string|null
# get_description( )

Get the description of the enclosure

Returns

string|null
public string|integer|null
# get_duration( string $convert = false )

Get the duration of the enclosure

Parameters

$convert
string
Convert seconds into hh:mm:ss

Returns

string|integer|null
'hh:mm:ss' string if $convert was specified, otherwise integer (or null if none found)
public string
# get_expression( )

Get the expression

Returns

string
Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full'
public string|null
# get_extension( )

Get the file extension

Returns

string|null
public string|null
# get_framerate( )

Get the framerate (in frames-per-second)

Returns

string|null
public string|null
# get_handler( )

Get the preferred handler

Returns

string|null
One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'
public string|null
# get_hash( integer $key = 0 )

Get a single hash

Parameters

$key
integer

Returns

string|null
Hash as per media:hash, prefixed with "$algo:"

Link

http://www.rssboard.org/media-rss#media-hash
public array|null
# get_hashes( )

Get all credits

Returns

array|null
Array of strings, see SimplePie_Enclosure::get_hash()
public string|null
# get_height( )

Get the height

Returns

string|null
public string|null
# get_language( )

Get the language

Returns

string|null
Language code as per RFC 3066

Link

http://tools.ietf.org/html/rfc3066
public string|null
# get_keyword( integer $key = 0 )

Get a single keyword

Parameters

$key
integer

Returns

string|null
public array|null
# get_keywords( )

Get all keywords

Returns

array|null
Array of strings
public float
# get_length( )

Get length

Returns

float
Length in bytes
public string|null
# get_link( )

Get the URL

Returns

string|null
public string|null
# get_medium( )

Get the medium

Returns

string|null
Should be one of 'image', 'audio', 'video', 'document', 'executable'

Link

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

Get the player URL

Typically the same as get_permalink()

Returns

string|null
Player URL
public SimplePie_Rating|null
# get_rating( integer $key = 0 )

Get a single rating

Parameters

$key
integer

Returns

SimplePie_Rating|null
public array|null
# get_ratings( )

Get all ratings

Returns

array|null
Array of SimplePie_Rating objects
public SimplePie_Restriction|null
# get_restriction( integer $key = 0 )

Get a single restriction

Parameters

$key
integer

Returns

SimplePie_Restriction|null
public array|null
# get_restrictions( )

Get all restrictions

Returns

array|null
Array of SimplePie_Restriction objects
public string|null
# get_sampling_rate( )

Get the sampling rate (in kHz)

Returns

string|null
public float|null
# get_size( )

Get the file size (in MiB)

Returns

float|null
File size in mebibytes (1048 bytes)
public string|null
# get_thumbnail( integer $key = 0 )

Get a single thumbnail

Parameters

$key
integer

Returns

string|null
Thumbnail URL
public array|null
# get_thumbnails( )

Get all thumbnails

Returns

array|null
Array of thumbnail URLs
public string|null
# get_title( )

Get the title

Returns

string|null
public string|null
# get_type( )

Get mimetype of the enclosure

Returns

string|null
MIME type

See

SimplePie_Enclosure::get_real_type()
public string|null
# get_width( )

Get the width

Returns

string|null
public string
# native_embed( array|string $options = '' )

Embed the enclosure using <embed>

Deprecated

Use the second parameter to SimplePie_Enclosure::embed() instead

Parameters

$options
array|string
See first paramter to SimplePie_Enclosure::embed()

Returns

string
HTML string to output
public string
# embed( array|string $options = '', boolean $native = false )

Embed the enclosure using Javascript

$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.

Parameters

$options
array|string
Comma-separated key:value list, or array
$native
boolean
Use <embed>

Returns

string
HTML string to output
public string
# get_real_type( boolean $find_handler = false )

Get the real media type

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

Parameters

$find_handler
boolean
Internal use only, use SimplePie_Enclosure::get_handler() instead

Returns

string
MIME type

See

SimplePie_Enclosure::get_type()
Properties summary
public string $bitrate
#

See

SimplePie_Enclosure::get_bitrate()
public array $captions
#

See

SimplePie_Enclosure::get_captions()
public array $categories
#

See

SimplePie_Enclosure::get_categories()
public integer $channels
#

See

SimplePie_Enclosure::get_channels()
public SimplePie_Copyright $copyright
#

See

SimplePie_Enclosure::get_copyright()
public array $credits
#

See

SimplePie_Enclosure::get_credits()
public string $description
#

See

SimplePie_Enclosure::get_description()
public integer $duration
#

See

SimplePie_Enclosure::get_duration()
public string $expression
#

See

SimplePie_Enclosure::get_expression()
public string $framerate
#

See

SimplePie_Enclosure::get_framerate()
public string $handler
#

See

SimplePie_Enclosure::get_handler()
public array $hashes
#

See

SimplePie_Enclosure::get_hashes()
public string $height
#

See

SimplePie_Enclosure::get_height()
public null $javascript
#

Deprecated

public array $keywords
#

See

SimplePie_Enclosure::get_keywords()
public string $lang
#

See

SimplePie_Enclosure::get_language()
public string $length
#

See

SimplePie_Enclosure::get_length()
public string $link
#

See

SimplePie_Enclosure::get_link()
public string $medium
#

See

SimplePie_Enclosure::get_medium()
public string $player
#

See

SimplePie_Enclosure::get_player()
public array $ratings
#

See

SimplePie_Enclosure::get_ratings()
public array $restrictions
#

See

SimplePie_Enclosure::get_restrictions()
public string $samplingrate
#

See

SimplePie_Enclosure::get_sampling_rate()
public array $thumbnails
#

See

SimplePie_Enclosure::get_thumbnails()
public string $title
#

See

SimplePie_Enclosure::get_title()
public string $type
#

See

SimplePie_Enclosure::get_type()
public string $width
#

See

SimplePie_Enclosure::get_width()

Show some love! Wishlists for Geoffrey, Ryan P., and Ryan M.

SimplePie is © 2004–2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue and contributors. Licensed under the BSD License. Hosted thanks to Matt Mullenweg, API documentation generated by ApiGen 2.6.1. Variation on the Feed Icon by Wolfgang Bartelme.