<?php error_reporting(E_ALL);
/**
* This file is part of the Dynamic Networks RSS Framework for PHP
*
* @author Gordon Oheim (hide@address.com)
* @copyright Copyright 2005, Dynamic Networks
* @link http://www.dynamicnetworks.de
* @license http://creativecommons.org/licenses/GPL/2.0/ GNU General Public License
* @filesource
* @version 1.0.0
*/
/**
* A class representing a media:content object
*
* Mediacontent is a sub-element of item. It contains 10 attributes, most of
* which are optional. This is the main object of the Media RSS module.
*
* @package rssFramework
* @author Gordon Oheim (hide@address.com)
* @link http://tools.search.yahoo.com/mrss/
* @see mediarss
* @see mediacategory
* @see mediapeople
* @see mediathumbnail
*/
class mediacontent extends mediarssabstract {
/**
* Specifies the direct url to the media object.
*
* This is an optional attribute. If a url is not included, a playerUrl
* must be specified.
*
* @var url
* @access private
*/
var $url;
/**
* The number of bytes of the media object
*
* This is an optional attribute.
*
* @var long
* @access private
*/
var $fileSize;
/**
* The standard MIME type of the object.
*
* This is an optional attribute.
*
* @var string
* @access private
*/
var $type;
/**
* The url of the media player console.
*
* This is an optional attribute. If playerUrl is not included,
* mediacontent::url must be specified.
*
* @var url
* @access private
*/
var $playerUrl;
/**
* The height of the window that the playerUrl should be opened in.
*
* This is an optional attribute.
*
* @var integer
* @access private
*/
var $playerHeight;
/**
* The width of the window that the playerUrl should be opened in.
*
* This is an optional attribute.
*
* @var integer
* @access private
*/
var $playerWidth;
/**
* Determines if this is the default object
*
* Determines if this is the default object that should be used for this
* element. This is an optional attribute.
*
* @var bool
* @access private
*/
var $isDefault;
/**
* Specifies the direct url to the media object.
*
* Determines if the object is a sample or the full version of the object
* enclosed. The value for this is either "sample" or "full". This is an
* optional attribute.
*
* @var string
* @access private
*/
var $expression;
/**
* Kilobits per second rate of media
*
* This is an optional attribute.
*
* @var integer
* @access private
*/
var $bitrate;
/**
* The number of seconds the media plays for audio and video.
*
* This is an optional attribute.
*
* @var integer
* @access private
*/
var $duration;
/**
* creates a new mediacontent object
*/
function mediacontent() {
// empty
}
/**
* Sets the bitrate attribute.
*
* @param integer $bitrate
* @see $bitrate
* @see get_bitrate()
* @access public
*/
function set_bitrate($bitrate) {
if(is_int($bitrate)) {
$this->bitrate = $bitrate;
}
else {
die("FATAL ERROR: added param is not an integer.");
}
}
/**
* Sets the duration attribute.
*
* @param integer $seconds
* @see $duration
* @see get_duration()
* @access public
*/
function set_duration($seconds) {
if(is_int($seconds)) {
$this->duration = $seconds;
}
else {
die("FATAL ERROR: added param is not an integer.");
}
}
/**
* Sets the expression attribute.
*
* This function takes only two arguments: sample or full.
*
* @param string $expression
* @see $expression
* @see get_expression()
* @access public
*/
function set_expression($expression) {
if (!strcasecmp($expression, "sample") || !strcasecmp($expression, "full")) {
$this->expression = $expression;
}
else {
die('FATAL ERROR: added param must be either "sample" or "full".');
}
}
/**
* Sets the fileSize attribute.
*
* @param integer $bytes
* @see $fileSize
* @see get_fileSize()
* @access public
*/
function set_fileSize($bytes) {
if(is_int($bytes)) {
$this->fileSize = $bytes;
}
else {
die("FATAL ERROR: added param is not an integer.");
}
}
/**
* Sets the isDefault attribute.
*
* @param bool $isDefault
* @see $isDefault
* @see get_is_Default()
* @access public
*/
function set_isDefault($isDefault) {
if(is_bool($isDefault)) {
$this->isDefault = $isDefault;
}
else {
die("FATAL ERROR: added param is not a boolean.");
}
}
/**
* Sets the playerHeight attribute.
*
* @param integer $playerHeight
* @see $playerHeight
* @see get_playerHeight()
* @access public
*/
function set_playerHeight($playerHeight) {
if(is_int($playerHeight)) {
$this->playerHeight = $playerHeight;
}
else {
die("FATAL ERROR: added param is not an integer.");
}
}
/**
* Sets the playerWidth attribute.
*
* @param integer $playerWidth
* @see $playerWidth
* @see get_playerWidth()
* @access public
*/
function set_playerWidth($playerWidth) {
if(is_int($playerWidth)) {
$this->playerWidth = $playerWidth;
}
else {
die("FATAL ERROR: added param is not an integer.");
}
}
/**
* Sets the type attribute.
*
* @param string $mime
* @see $type
* @see get_type()
* @access public
*/
function set_type($mime) {
if(is_string($mime)) {
$this->type = $mime;
}
else {
die("FATAL ERROR: added param is not a string.");
}
}
/**
* Sets the url attribute.
*
* @param url $url
* @see $url
* @see url
* @see get_url()
* @access public
*/
function set_url($url) {
if(is_a($url, "url")) {
$this->url = $url;
}
else {
die("FATAL ERROR: added param is not an object of type url.");
}
}
/**
* Returns the bitrate attribute
*
* @return integer
* @see $bitrate
* @see set_bitrate()
*/
function get_bitrate() {
return $this->bitrate;
}
/**
* Returns the duration attribute
*
* @return integer
* @see $duration
* @see set_duration()
*/
function get_duration() {
return $this->duration;
}
/**
* Returns the expression attribute
*
* @return string
* @see $expression
* @see set_expression()
*/
function get_expression() {
return $this->expression;
}
/**
* Returns the fileSize attribute
*
* @return integer
* @see $fileSize
* @see set_fileSize()
*/
function get_fileSize() {
return $this->fileSize;
}
/**
* Returns the isDefault attribute
*
* @return bool
* @see $isDefault
* @see set_isDefault()
*/
function get_isDefault() {
return $this->isDefault;
}
/**
* Returns the playerHeight attribute
*
* @return integer
* @see $playerHeight
* @see set_playerHeight()
*/
function get_playerHeight() {
return $this->playerHeight;
}
/**
* Returns the playerWidth attribute
*
* @return integer
* @see $playerWidth
* @see set_playerWidth()
*/
function get_playerWidth() {
return $this->playerWidth;
}
/**
* Returns the type attribute
*
* @return string
* @see $type
* @see set_type()
*/
function get_type() {
return $this->type;
}
/**
* Returns the url attribute
*
* @return url
* @see $url
* @see set_url()
*/
function get_url() {
return $this->url;
}
}
?>