Location: PHPKode > projects > RSS Framework for PHP > src/classes/mediaRSS/mediarssabstract.php
<?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
 */

/**
 * MediaRSSAbstract is an abstract class
 *
 * MediaRSSAbstract is an abstract class that contains attributes and methods
 * that can be found in MediaRSS and MediaContent. MediaRSS elements can appear
 * either within an item element of an RSS feed or within a MediaContent element
 * that is within an item element. Having the same attributes and methods in two
 * classes that to a large extent share the elements is cumbersome to maintain
 * on the program side. This abstract class serves the purpose to reduce
 * possible maintanenace time.
 *
 * @package rssFramework/mediaRSS
 * @author Gordon Oheim (hide@address.com)
 * @link http://tools.search.yahoo.com/mrss/
 * @see mediacontent
 * @see mediapeople
 * @see mediathumbnail
 * @see mediarss
 */ 
 class mediarssabstract extends xmlbaseclass {
 
  	/**
 	 * Specifies the role individuals played.
 	 * 
 	 * Examples include: producer, artist, news anchor, cast member, etc. It is
 	 * an optional attribute.
 	 * 
 	 * @var mediapeople[]
 	 * @see mediapeople
 	 * @access private
 	 * @see set_mediapeople()
 	 * @see get_mediapeople()
 	 */
  	var $mediapeople;
  	
  	/**
 	 * A taxonomy that gives an indication of the type of media content.
 	 *
 	 * The media:category element, when combined with the media:people element
 	 * provide a rich and flexible way to describe media content.
 	 * media:category was chosen to be consistent with existing RSS 2.0
 	 * category element.
 	 * 
 	 * @var string[]
 	 * @access private
 	 * @see set_mediacategory()
 	 * @see get_mediacategory()
 	 */
  	var $mediacategory;

  	/**
 	 * An image used as the representative image for the media object.
 	 * 
 	 * Allows a particular image to be used as the representative image for the
 	 * media object.
 	 * 
 	 * @var mediathumbnail
 	 * @see mediathumbnail
 	 * @see image
 	 * @access private
 	 * @see set_mediathumbnail()
 	 * @see get_mediathumbnail()
 	 */
  	var $mediathumbnail;
  	
  	/**
 	 * Specifies the text for a media object
 	 * 
 	 * Allows  the inclusion of a text transcript, closed captioning, or lyrics
 	 * of the media content.
 	 * 
 	 * @var string[]
 	 * @access private
 	 * @see set_mediatext()
 	 * @see get_mediatext()
 	 */
  	var $mediatext;

  	/**
  	 * Adds a mediapeople object to mediapeople
  	 * 
  	 * This function adds a new mediapeople object to the $mediapeople array. If
  	 * an array is passed instead of an object, the function will pass each
  	 * element in the array to itself. Each element in the array must be a
  	 * mediapeople object, otherwise the function will die with an error.
  	 * 
  	 * @param metapeople $people
  	 * @see metapeople
  	 * @see get_mediapeople()
  	 * @see remove_mediapeople()
  	 * @access public
  	 */
	function set_mediapeople($people) {
		if (is_array($people)) {
			foreach($people as $object) {
				$this->set_mediapeople($object);
			}
		}
		elseif (is_a($people, "mediapeople")) {
			$this->mediapeople[] = $people;
		} else {
			die("FATAL ERROR: added param must be of type mediapeople or array of mediapeople objects");
		}
	}
  	
  	/**
  	 * Adds a mediacategory string to mediapeople
  	 * 
  	 * This function adds a new mediacategory stringto the $mediacategory array.
  	 * If an array is passed instead of a string, the function will pass each
  	 * element in the array to itself. Each element in the array must be a
  	 * string, otherwise the function will die with an error.
  	 * 
  	 * @param string $taxonomy
  	 * @see $mediacategory
  	 * @see get_mediacategory()
  	 * @see remove_mediacategory()
  	 * @access public
  	 */
	function set_mediacategory($taxonomy) {
		if (is_array($taxonomy)) {
			foreach($taxonomy as $string) {
				$this->set_mediacategory($string);
			}
		}
		elseif (is_string($taxonomy)) {
			$this->mediacategory[] = $taxonomy;
		} else {
			die("FATAL ERROR: added param is not a string.");
		}
	}

  	/**
  	 * Adds a mediatext string to mediatext
  	 * 
  	 * This function adds a new mediatext string to the $mediatext array. If an
  	 * array is passed instead of a string, the function will pass each element
  	 * in the array to itself. Each element in the array must be a string,
  	 * otherwise the function will die with an error.
  	 * 
  	 * @param string $mediatext
  	 * @see $mediatext
  	 * @see get_mediatext()
  	 * @see remove_mediatext()
  	 * @access public
  	 */
	function set_mediatext($mediatext) {
		if (is_array($mediatext)) {
			foreach($mediatext as $string) {
				$this->set_mediatext($string);
			}
		}
		elseif (is_string($mediatext)) {
			$this->mediatext[] = $mediatext;
		} else {
			die("FATAL ERROR: added param is not a string.");
		}
	}
	
	/**
	 * Adds a mediathumbnail object to mediathumbnail
	 * 
	 * This function sets the mediathumbnail attribute with a mediathumbnail
	 * object.
	 * 
	 * @param mediathumbnail $mediathumbnail
  	 * @see $mediathumbnail
  	 * @see get_mediathumbnail()
  	 * @access public
  	 */
  	 function set_mediathumbnail($thumb) {
  	 	if (is_a($thumb, "mediathumbnail")) {
  	 		$this->mediathumbnail = $thumb;
  	 	}
  	 	else {
  	 		die("FATAL ERROR: added param is not an object of type mediathumbnail");
  	 	}
  	 }

	/**
	 * Returns the value of the attribute mediacategory
	 * 
	 * @return string[]
	 * @access public
	 * @see set_mediacategory()
	 * @see remove_mediacategory()
	 */
	function get_mediacategory() {
		return $this->mediacategory;
	}

	/**
	 * Returns the value of the attribute mediapeople
	 * 
	 * @return mediapeople[]
	 * @access public
	 * @see set_mediapeople()
	 * @see remove_mediapeople()
	 */
	function get_mediapeople() {
		return $this->mediapeople;
	}

	/**
	 * Returns the value of the attribute mediatext
	 * 
	 * @return string[]
	 * @access public
	 * @see set_mediatext()
	 * @see remove_mediatext()
	 */
	function get_mediatext() {
		return $this->mediatext;
	}

	/**
	 * Returns the value of the attribute mediathumbnail
	 * 
	 * @return mediathumbnail
	 * @access public
	 * @see set_mediathumbnail()
	 */
	function get_mediathumbnail() {
		return $this->mediathumbnail;
	}

	/**
	 * Removes mediatext string from the mediatext array.
	 * 
	 * This function removes the item object located at the specified index by
	 * the param and reindexes the array. The function will return true on
	 * success. This class is a wrapper for the function remove_from_array().
	 * Note: As of this writing there are no shorts in PHP. Use integer instead.
	 * 
	 * @access public
	 * @param short $index
	 * @return bool
	 * @see get_mediatext()
	 * @see set_mediatext()
	 * @see remove_from_array();
	 * @see $mediatext
	 */	
	function remove_mediatext($index) {
		return $this->remove_from_array($this->mediatext, $index);	
	}

	/**
	 * Removes category string from the mediacategory array.
	 * 
	 * This function removes the item object located at the specified index by
	 * the param and reindexes the array. The function will return true on
	 * success. This class is a wrapper for the function remove_from_array().
	 * Note: As of this writing there are no shorts in PHP. Use integer instead.
	 * 
	 * @access public
	 * @param short $index
	 * @return bool
	 * @see get_mediacategory()
	 * @see set_mediacategory()
	 * @see remove_from_array();
	 * @see $mediacategory
	 */	
	function remove_mediacategory($index) {
		return $this->remove_from_array($this->mediacategory, $index);	
	}
	
	/**
	 * Removes people objects from the mediapeople array.
	 * 
	 * This function removes the item object located at the specified index by
	 * the param and reindexes the array. The function will return true on
	 * success. This class is a wrapper for the function remove_from_array().
	 * Note: As of this writing there are no shorts in PHP. Use integer instead.
	 * 
	 * @access public
	 * @param short $index
	 * @return bool
	 * @see get_mediapeople()
	 * @see set_mediapeople()
	 * @see remove_from_array();
	 * @see $mediapeople
	 */	
	function remove_mediapeople($index) {
		return $this->remove_from_array($this->mediapeople, $index);	
	}
}
?>
Return current item: RSS Framework for PHP