Location: PHPKode > projects > RSS Framework for PHP > src/classes/mediaRSS/mediarss.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
 */
	require_once("mediarssabstract.php");
	require_once("mediacontent.php");
	require_once("mediapeople.php");
	require_once("mediathumbnail.php");

/**
 * MediaRSS is a module extension for the rssFramework.
 * 
 * MediaRSS is meant as a substitute for the enclosure objects, although
 * both elements can coexist. It adds richer markup possibilities for media
 * objects syndicated via RSS feeds. The mediaRSS class will not show up in the
 * RSS feed. It is a container class required by the framework. It is somewhat
 * like a Document Node for MediaRSS Elements. It is invisble, but it denotes
 * that elements in here are MediaRSS Elements.
 *
 * @package rssFramework/mediaRSS
 * @author Gordon Oheim (hide@address.com)
 * @link http://tools.search.yahoo.com/mrss/
 * @see mediacategory
 * @see mediacontent
 * @see mediapeople
 * @see mediathumbnail
 */ 
class mediaRSS extends mediarssabstract {
  	
  	/**
  	 * Object for organizing media content
  	 * 
  	 * Denotes a number of objects, that contain the primary metadata entries
  	 * needed to index and organize media content.
 	 * 
 	 * @var mediacontent[]
 	 * @see mediacontent
 	 * @access private
 	 * @see set_mediacontent()
 	 * @see get_mediacontent()
 	 */
  	var $mediacontent;
  	
  	/**
  	 * Creates a new object for mediaRSS element.
  	 * 
  	 * The constructor requires no params. It will set namespace, prefix and
  	 * docs for the mediaRSS module.
  	 * 
  	 * @access public
  	 * @see module
  	 */
  	function mediaRSS() {
  		$this->namespace = "http://tools.search.yahoo.com/mrss/";
  		$this->prefix = "media";
  	}

  	/**
  	 * Adds a mediacontent object to mediaconent
  	 * 
  	 * This function adds a new mediacontent object to the $mediacontent 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
  	 * mediacontent object, otherwise the function will die with an error.
  	 * 
  	 * @param metacontent $content
  	 * @see metacontent
  	 * @see get_mediacontent()
  	 * @see remove_mediacontent()
  	 * @access public
  	 */
	function set_mediacontent($content) {
		if (is_array($content)) {
			foreach($content as $object) {
				$this->set_mediacontent($object);
			}
		}
		elseif (is_a($content, "mediacontent")) {
			$this->mediacontent[] = $content;
		} else {
			die("FATAL ERROR: added param must be of type mediacontent or array of mediacontent objects");
		}
	}

	/**
	 * Returns the value of the attribute mediacontent
	 * 
	 * @return mediacontent[]
	 * @access public
	 * @see set_mediacontent()
	 * @see remove_mediacontent()
	 */
	function get_mediacontent() {
		return $this->mediacontent;
	}
	
	/**
	 * 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_mediacontent()
	 * @see set_mediacontent()
	 * @see remove_from_array();
	 * @see $mediacontent
	 */	
	function remove_mediacontent($index) {
		return $this->remove_from_array($this->mediacontent, $index);	
	}
}
Return current item: RSS Framework for PHP