Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
Enclosure Class Reference

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

Public Member Functions

 __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.
 
 __toString ()
 String-ified version.
 
 embed ($options='', $native=false)
 Embed the enclosure using Javascript.
 
 get_bitrate ()
 Get the bitrate.
 
 get_caption ($key=0)
 Get a single caption.
 
 get_captions ()
 Get all captions.
 
 get_categories ()
 Get all categories.
 
 get_category ($key=0)
 Get a single category.
 
 get_channels ()
 Get the number of audio channels.
 
 get_copyright ()
 Get the copyright information.
 
 get_credit ($key=0)
 Get a single credit.
 
 get_credits ()
 Get all credits.
 
 get_description ()
 Get the description of the enclosure.
 
 get_duration ($convert=false)
 Get the duration of the enclosure.
 
 get_expression ()
 Get the expression.
 
 get_extension ()
 Get the file extension.
 
 get_framerate ()
 Get the framerate (in frames-per-second)
 
 get_handler ()
 Get the preferred handler.
 
 get_hash ($key=0)
 Get a single hash.
 
 get_hashes ()
 Get all credits.
 
 get_height ()
 Get the height.
 
 get_keyword ($key=0)
 Get a single keyword.
 
 get_keywords ()
 Get all keywords.
 
 get_language ()
 Get the language.
 
 get_length ()
 Get length.
 
 get_link ()
 Get the URL.
 
 get_medium ()
 Get the medium.
 
 get_player ()
 Get the player URL.
 
 get_rating ($key=0)
 Get a single rating.
 
 get_ratings ()
 Get all ratings.
 
 get_restriction ($key=0)
 Get a single restriction.
 
 get_restrictions ()
 Get all restrictions.
 
 get_sampling_rate ()
 Get the sampling rate (in kHz)
 
 get_size ()
 Get the file size (in MiB)
 
 get_thumbnail ($key=0)
 Get a single thumbnail.
 
 get_thumbnails ()
 Get all thumbnails.
 
 get_title ()
 Get the title.
 
 get_type ()
 Get mimetype of the enclosure.
 
 get_width ()
 Get the width.
 
 native_embed ($options='')
 Embed the enclosure using <embed>
 

Public Attributes

string $bitrate
 
array $captions
 
array $categories
 
int $channels
 
SimplePie Copyright $copyright
 
array $credits
 
string $description
 
int $duration
 
string $expression
 
string $framerate
 
string $handler
 
array $hashes
 
string $height
 
null $javascript
 
array $keywords
 
string $lang
 
string $length
 
string $link
 
string $medium
 
string $player
 
array $ratings
 
array $restrictions
 
string $samplingrate
 
array $thumbnails
 
string $title
 
string $type
 
string $width
 

Detailed Description

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

Used by {

See also
SimplePie\Item\get_enclosure()} and {
SimplePie\Itemget_enclosures()}

This class can be overloaded with {

See also
SimplePie\SimplePie\set_enclosure_class()}

@subpackage API

Constructor & Destructor Documentation

◆ __construct()

Enclosure::__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

Member Function Documentation

◆ __toString()

Enclosure::__toString ( )

String-ified version.

Return values
string

◆ embed()

Enclosure::embed ( $options = '',
$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 it's 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
array | string$optionsComma-separated key:value list, or array
bool$nativeUse <embed>
Return values
stringHTML string to output

◆ get_bitrate()

Enclosure::get_bitrate ( )

Get the bitrate.

Return values
string|null

◆ get_caption()

Enclosure::get_caption ( $key = 0)

Get a single caption.

Parameters
int$key
Return values
SimplePie\Caption|null

◆ get_captions()

Enclosure::get_captions ( )

Get all captions.

Return values
array|nullArray of {
See also
SimplePie\Caption} objects

◆ get_categories()

Enclosure::get_categories ( )

Get all categories.

Return values
array|nullArray of {
See also
SimplePie\Category} objects

◆ get_category()

Enclosure::get_category ( $key = 0)

Get a single category.

Parameters
int$key
Return values
SimplePie\Category|null

◆ get_channels()

Enclosure::get_channels ( )

Get the number of audio channels.

Return values
int|null

◆ get_copyright()

Enclosure::get_copyright ( )

Get the copyright information.

Return values
SimplePie\Copyright|null

◆ get_credit()

Enclosure::get_credit ( $key = 0)

Get a single credit.

Parameters
int$key
Return values
SimplePie\Credit|null

◆ get_credits()

Enclosure::get_credits ( )

Get all credits.

Return values
array|nullArray of {
See also
SimplePie\Credit} objects

◆ get_description()

Enclosure::get_description ( )

Get the description of the enclosure.

Return values
string|null

◆ get_duration()

Enclosure::get_duration ( $convert = false)

Get the duration of the enclosure.

Parameters
bool$convertConvert seconds into hh:mm:ss
Return values
string|int|null'hh:mm:ss' string if $convert was specified, otherwise integer (or null if none found)

◆ get_expression()

Enclosure::get_expression ( )

Get the expression.

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

◆ get_extension()

Enclosure::get_extension ( )

Get the file extension.

Return values
string|null

◆ get_framerate()

Enclosure::get_framerate ( )

Get the framerate (in frames-per-second)

Return values
string|null

◆ get_handler()

Enclosure::get_handler ( )

Get the preferred handler.

Return values
string|nullOne of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'

◆ get_hash()

Enclosure::get_hash ( $key = 0)

Get a single hash.

@externalurl http://www.rssboard.org/media-rss#media-hash

Parameters
int$key
Return values
string|nullHash as per media:hash, prefixed with "$algo:"

◆ get_hashes()

Enclosure::get_hashes ( )

Get all credits.

Return values
array|nullArray of strings, see {
See also
get_hash()}

◆ get_height()

Enclosure::get_height ( )

Get the height.

Return values
string|null

◆ get_keyword()

Enclosure::get_keyword ( $key = 0)

Get a single keyword.

Parameters
int$key
Return values
string|null

◆ get_keywords()

Enclosure::get_keywords ( )

Get all keywords.

Return values
array|nullArray of strings

◆ get_language()

Enclosure::get_language ( )

Get the language.

@externalurl http://tools.ietf.org/html/rfc3066

Return values
string|nullLanguage code as per RFC 3066

◆ get_length()

Enclosure::get_length ( )

Get length.

Return values
floatLength in bytes

◆ get_link()

Enclosure::get_link ( )

Get the URL.

Return values
string|null

◆ get_medium()

Enclosure::get_medium ( )

Get the medium.

@externalurl http://www.rssboard.org/media-rss#media-content

Return values
string|nullShould be one of 'image', 'audio', 'video', 'document', 'executable'

◆ get_player()

Enclosure::get_player ( )

Get the player URL.

Typically the same as {

See also
get_permalink()}
Return values
string|nullPlayer URL

◆ get_rating()

Enclosure::get_rating ( $key = 0)

Get a single rating.

Parameters
int$key
Return values
SimplePie\Rating|null

◆ get_ratings()

Enclosure::get_ratings ( )

Get all ratings.

Return values
array|nullArray of {
See also
SimplePie\Rating} objects

◆ get_restriction()

Enclosure::get_restriction ( $key = 0)

Get a single restriction.

Parameters
int$key
Return values
SimplePie\Restriction|null

◆ get_restrictions()

Enclosure::get_restrictions ( )

Get all restrictions.

Return values
array|nullArray of {
See also
SimplePie\Restriction} objects

◆ get_sampling_rate()

Enclosure::get_sampling_rate ( )

Get the sampling rate (in kHz)

Return values
string|null

◆ get_size()

Enclosure::get_size ( )

Get the file size (in MiB)

Return values
float|nullFile size in mebibytes (1048 bytes)

◆ get_thumbnail()

Enclosure::get_thumbnail ( $key = 0)

Get a single thumbnail.

Parameters
int$key
Return values
string|nullThumbnail URL

◆ get_thumbnails()

Enclosure::get_thumbnails ( )

Get all thumbnails.

Return values
array|nullArray of thumbnail URLs

◆ get_title()

Enclosure::get_title ( )

Get the title.

Return values
string|null

◆ get_type()

Enclosure::get_type ( )

Get mimetype of the enclosure.

See also
get_real_type()
Return values
string|nullMIME type

◆ get_width()

Enclosure::get_width ( )

Get the width.

Return values
string|null

◆ native_embed()

Enclosure::native_embed ( $options = '')

Embed the enclosure using <embed>

Deprecated
Use the second parameter to {
See also
embed} instead
Parameters
array | string$optionsSee first parameter to {
See also
embed}
Return values
stringHTML string to output

Member Data Documentation

◆ $bitrate

string Enclosure::$bitrate
See also
get_bitrate()

◆ $captions

array Enclosure::$captions
See also
get_captions()

◆ $categories

array Enclosure::$categories

◆ $channels

int Enclosure::$channels
See also
get_channels()

◆ $copyright

SimplePie Copyright Enclosure::$copyright
See also
get_copyright()

◆ $credits

array Enclosure::$credits
See also
get_credits()

◆ $description

string Enclosure::$description

◆ $duration

int Enclosure::$duration
See also
get_duration()

◆ $expression

string Enclosure::$expression

◆ $framerate

string Enclosure::$framerate
See also
get_framerate()

◆ $handler

string Enclosure::$handler
See also
get_handler()

◆ $hashes

array Enclosure::$hashes
See also
get_hashes()

◆ $height

string Enclosure::$height
See also
get_height()

◆ $javascript

null Enclosure::$javascript

◆ $keywords

array Enclosure::$keywords
See also
get_keywords()

◆ $lang

string Enclosure::$lang
See also
get_language()

◆ $length

string Enclosure::$length
See also
get_length()

◆ $link

string Enclosure::$link
See also
get_link()

◆ $medium

string Enclosure::$medium
See also
get_medium()

◆ $player

string Enclosure::$player
See also
get_player()

◆ $ratings

array Enclosure::$ratings
See also
get_ratings()

◆ $restrictions

array Enclosure::$restrictions

◆ $samplingrate

string Enclosure::$samplingrate

◆ $thumbnails

array Enclosure::$thumbnails

◆ $title

string Enclosure::$title
See also
get_title()

◆ $type

string Enclosure::$type
See also
get_type()

◆ $width

string Enclosure::$width
See also
get_width()

The documentation for this class was generated from the following file: