home/wwgoat/public_html/blog/wp-includes/SimplePie/src/Enclosure.php 0000644 00000100400 14720703701 0021605 0 ustar 00 bitrate = $bitrate;
$this->captions = $captions;
$this->categories = $categories;
$this->channels = $channels;
$this->copyright = $copyright;
$this->credits = $credits;
$this->description = $description;
$this->duration = $duration;
$this->expression = $expression;
$this->framerate = $framerate;
$this->hashes = $hashes;
$this->height = $height;
$this->keywords = $keywords;
$this->lang = $lang;
$this->length = $length;
$this->link = $link;
$this->medium = $medium;
$this->player = $player;
$this->ratings = $ratings;
$this->restrictions = $restrictions;
$this->samplingrate = $samplingrate;
$this->thumbnails = $thumbnails;
$this->title = $title;
$this->type = $type;
$this->width = $width;
if (class_exists('idna_convert')) {
$idn = new \idna_convert();
$parsed = \SimplePie\Misc::parse_url($link);
$this->link = \SimplePie\Misc::compress_parse_url($parsed['scheme'], $idn->encode($parsed['authority']), $parsed['path'], $parsed['query'], $parsed['fragment']);
}
$this->handler = $this->get_handler(); // Needs to load last
}
/**
* String-ified version
*
* @return string
*/
public function __toString()
{
// There is no $this->data here
return md5(serialize($this));
}
/**
* Get the bitrate
*
* @return string|null
*/
public function get_bitrate()
{
if ($this->bitrate !== null) {
return $this->bitrate;
}
return null;
}
/**
* Get a single caption
*
* @param int $key
* @return \SimplePie\Caption|null
*/
public function get_caption($key = 0)
{
$captions = $this->get_captions();
if (isset($captions[$key])) {
return $captions[$key];
}
return null;
}
/**
* Get all captions
*
* @return array|null Array of {@see \SimplePie\Caption} objects
*/
public function get_captions()
{
if ($this->captions !== null) {
return $this->captions;
}
return null;
}
/**
* Get a single category
*
* @param int $key
* @return \SimplePie\Category|null
*/
public function get_category($key = 0)
{
$categories = $this->get_categories();
if (isset($categories[$key])) {
return $categories[$key];
}
return null;
}
/**
* Get all categories
*
* @return array|null Array of {@see \SimplePie\Category} objects
*/
public function get_categories()
{
if ($this->categories !== null) {
return $this->categories;
}
return null;
}
/**
* Get the number of audio channels
*
* @return int|null
*/
public function get_channels()
{
if ($this->channels !== null) {
return $this->channels;
}
return null;
}
/**
* Get the copyright information
*
* @return \SimplePie\Copyright|null
*/
public function get_copyright()
{
if ($this->copyright !== null) {
return $this->copyright;
}
return null;
}
/**
* Get a single credit
*
* @param int $key
* @return \SimplePie\Credit|null
*/
public function get_credit($key = 0)
{
$credits = $this->get_credits();
if (isset($credits[$key])) {
return $credits[$key];
}
return null;
}
/**
* Get all credits
*
* @return array|null Array of {@see \SimplePie\Credit} objects
*/
public function get_credits()
{
if ($this->credits !== null) {
return $this->credits;
}
return null;
}
/**
* Get the description of the enclosure
*
* @return string|null
*/
public function get_description()
{
if ($this->description !== null) {
return $this->description;
}
return null;
}
/**
* Get the duration of the enclosure
*
* @param bool $convert Convert seconds into hh:mm:ss
* @return string|int|null 'hh:mm:ss' string if `$convert` was specified, otherwise integer (or null if none found)
*/
public function get_duration($convert = false)
{
if ($this->duration !== null) {
if ($convert) {
$time = \SimplePie\Misc::time_hms($this->duration);
return $time;
}
return $this->duration;
}
return null;
}
/**
* Get the expression
*
* @return string Probably one of 'sample', 'full', 'nonstop', 'clip'. Defaults to 'full'
*/
public function get_expression()
{
if ($this->expression !== null) {
return $this->expression;
}
return 'full';
}
/**
* Get the file extension
*
* @return string|null
*/
public function get_extension()
{
if ($this->link !== null) {
$url = \SimplePie\Misc::parse_url($this->link);
if ($url['path'] !== '') {
return pathinfo($url['path'], PATHINFO_EXTENSION);
}
}
return null;
}
/**
* Get the framerate (in frames-per-second)
*
* @return string|null
*/
public function get_framerate()
{
if ($this->framerate !== null) {
return $this->framerate;
}
return null;
}
/**
* Get the preferred handler
*
* @return string|null One of 'flash', 'fmedia', 'quicktime', 'wmedia', 'mp3'
*/
public function get_handler()
{
return $this->get_real_type(true);
}
/**
* Get a single hash
*
* @link http://www.rssboard.org/media-rss#media-hash
* @param int $key
* @return string|null Hash as per `media:hash`, prefixed with "$algo:"
*/
public function get_hash($key = 0)
{
$hashes = $this->get_hashes();
if (isset($hashes[$key])) {
return $hashes[$key];
}
return null;
}
/**
* Get all credits
*
* @return array|null Array of strings, see {@see get_hash()}
*/
public function get_hashes()
{
if ($this->hashes !== null) {
return $this->hashes;
}
return null;
}
/**
* Get the height
*
* @return string|null
*/
public function get_height()
{
if ($this->height !== null) {
return $this->height;
}
return null;
}
/**
* Get the language
*
* @link http://tools.ietf.org/html/rfc3066
* @return string|null Language code as per RFC 3066
*/
public function get_language()
{
if ($this->lang !== null) {
return $this->lang;
}
return null;
}
/**
* Get a single keyword
*
* @param int $key
* @return string|null
*/
public function get_keyword($key = 0)
{
$keywords = $this->get_keywords();
if (isset($keywords[$key])) {
return $keywords[$key];
}
return null;
}
/**
* Get all keywords
*
* @return array|null Array of strings
*/
public function get_keywords()
{
if ($this->keywords !== null) {
return $this->keywords;
}
return null;
}
/**
* Get length
*
* @return float Length in bytes
*/
public function get_length()
{
if ($this->length !== null) {
return $this->length;
}
return null;
}
/**
* Get the URL
*
* @return string|null
*/
public function get_link()
{
if ($this->link !== null) {
return $this->link;
}
return null;
}
/**
* Get the medium
*
* @link http://www.rssboard.org/media-rss#media-content
* @return string|null Should be one of 'image', 'audio', 'video', 'document', 'executable'
*/
public function get_medium()
{
if ($this->medium !== null) {
return $this->medium;
}
return null;
}
/**
* Get the player URL
*
* Typically the same as {@see get_permalink()}
* @return string|null Player URL
*/
public function get_player()
{
if ($this->player !== null) {
return $this->player;
}
return null;
}
/**
* Get a single rating
*
* @param int $key
* @return \SimplePie\Rating|null
*/
public function get_rating($key = 0)
{
$ratings = $this->get_ratings();
if (isset($ratings[$key])) {
return $ratings[$key];
}
return null;
}
/**
* Get all ratings
*
* @return array|null Array of {@see \SimplePie\Rating} objects
*/
public function get_ratings()
{
if ($this->ratings !== null) {
return $this->ratings;
}
return null;
}
/**
* Get a single restriction
*
* @param int $key
* @return \SimplePie\Restriction|null
*/
public function get_restriction($key = 0)
{
$restrictions = $this->get_restrictions();
if (isset($restrictions[$key])) {
return $restrictions[$key];
}
return null;
}
/**
* Get all restrictions
*
* @return array|null Array of {@see \SimplePie\Restriction} objects
*/
public function get_restrictions()
{
if ($this->restrictions !== null) {
return $this->restrictions;
}
return null;
}
/**
* Get the sampling rate (in kHz)
*
* @return string|null
*/
public function get_sampling_rate()
{
if ($this->samplingrate !== null) {
return $this->samplingrate;
}
return null;
}
/**
* Get the file size (in MiB)
*
* @return float|null File size in mebibytes (1048 bytes)
*/
public function get_size()
{
$length = $this->get_length();
if ($length !== null) {
return round($length / 1048576, 2);
}
return null;
}
/**
* Get a single thumbnail
*
* @param int $key
* @return string|null Thumbnail URL
*/
public function get_thumbnail($key = 0)
{
$thumbnails = $this->get_thumbnails();
if (isset($thumbnails[$key])) {
return $thumbnails[$key];
}
return null;
}
/**
* Get all thumbnails
*
* @return array|null Array of thumbnail URLs
*/
public function get_thumbnails()
{
if ($this->thumbnails !== null) {
return $this->thumbnails;
}
return null;
}
/**
* Get the title
*
* @return string|null
*/
public function get_title()
{
if ($this->title !== null) {
return $this->title;
}
return null;
}
/**
* Get mimetype of the enclosure
*
* @see get_real_type()
* @return string|null MIME type
*/
public function get_type()
{
if ($this->type !== null) {
return $this->type;
}
return null;
}
/**
* Get the width
*
* @return string|null
*/
public function get_width()
{
if ($this->width !== null) {
return $this->width;
}
return null;
}
/**
* Embed the enclosure using `