[pLog-svn] r1237 - plog/trunk/class/xml/rssparser

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sun Feb 27 23:48:31 GMT 2005


Author: oscar
Date: 2005-02-27 23:48:31 +0000 (Sun, 27 Feb 2005)
New Revision: 1237

Added:
   plog/trunk/class/xml/rssparser/rssenclosure.class.php
Log:
sorry, forgot this file from the last commit.

Added: plog/trunk/class/xml/rssparser/rssenclosure.class.php
===================================================================
--- plog/trunk/class/xml/rssparser/rssenclosure.class.php	2005-02-27 23:48:16 UTC (rev 1236)
+++ plog/trunk/class/xml/rssparser/rssenclosure.class.php	2005-02-27 23:48:31 UTC (rev 1237)
@@ -0,0 +1,70 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/object/object.class.php" );
+	
+	/**
+	 * represents an enclosure from an rss 2.0 feed. This object needs
+	 * the patched version of MagpieRSS which has support for enclosures!!
+	 */
+	class RssEnclosure extends Object
+	{
+		var $_url;
+		var $_mimeType;
+		var $_length;
+	
+		/**
+		 * builds the object based on the results gotten from MagpieRSS
+		 *
+		 * @param enclosure an array as generated by MagpieRSS containing all the necessary
+		 * information from the enclosure
+		 */
+		function RssEnclosure( $enclosure )
+		{
+			$this->_url = $enclosure["url"];
+			$this->_length = $enclosure["length"];
+			$this->_mimeType = $enclosure["type"];
+			
+			// keep also the array, just in case...
+			$this->_enclosure = $enclosure;
+		}
+		
+		/**
+		 * returns the length in bytes of the enclosure
+		 *
+		 * @return the length in bytes
+		 */
+		function getLength()
+		{
+			return( $this->_length );
+		}
+		
+		/**
+		 * alias of the above
+		 * @see getLength()
+		 */
+		function getSize()
+		{
+			return( $this->getLength());
+		}
+		
+		/**
+		 * returns the mime type as specified by the enclosure
+		 *
+		 * @return mime type
+		 */
+		function getMimeType()
+		{
+			return( $this->_mimeType );
+		}
+		
+		/**
+		 * returns the enclosure where the url is located
+		 *
+		 * @return a url
+		 */
+		function getUrl()
+		{
+			return( $this->_url );
+		}
+	}
+?>
\ No newline at end of file




More information about the pLog-svn mailing list