cvs: pear /XML_RSS RSS.php

From: Date: Wed, 25 May 2005 16:38:52 +0000
Subject: cvs: pear /XML_RSS RSS.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32121@lists.php.net to get a copy of this message
mj Wed May 25 12:38:52 2005 EDT Modified files: /pear/XML_RSS RSS.php Log: * Added support for the enclosure tag. Bug: #3871 http://cvs.php.net/diff.php/pear/XML_RSS/RSS.php?r1=1.24&r2=1.25&ty=u Index: pear/XML_RSS/RSS.php diff -u pear/XML_RSS/RSS.php:1.24 pear/XML_RSS/RSS.php:1.25 --- pear/XML_RSS/RSS.php:1.24 Fri Nov 5 12:09:33 2004 +++ pear/XML_RSS/RSS.php Wed May 25 12:38:52 2005 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: RSS.php,v 1.24 2004/11/05 17:09:33 mj Exp $ +// $Id: RSS.php,v 1.25 2005/05/25 16:38:52 mj Exp $ // require_once 'XML/Parser.php'; @@ -30,7 +30,7 @@ * website of the RSS working group (http://www.purl.org/rss/). * * @author Martin Jansen <mj@php.net> -* @version $Revision: 1.24 $ +* @version $Revision: 1.25 $ * @access public */ class XML_RSS extends XML_Parser @@ -85,6 +85,11 @@ /** * @var array */ + var $attribs; + + /** + * @var array + */ var $parentTags = array('CHANNEL', 'ITEM', 'IMAGE', 'TEXTINPUT'); /** @@ -100,7 +105,8 @@ * @var array */ var $itemTags = array('TITLE', 'LINK', 'DESCRIPTION', 'PUBDATE', 'AUTHOR', 'CATEGORY', - 'COMMENTS', 'ENCLOSURE', 'GUID', 'PUBDATE', 'SOURCE'); + 'COMMENTS', 'ENCLOSURE', 'GUID', 'PUBDATE', 'SOURCE', + 'CONTENT:ENCODED', 'ENCLOSURE'); /** * @var array @@ -184,6 +190,10 @@ array_push($this->insideTagStack, $element); break; + case 'ENCLOSURE' : + $this->attribs = $attribs; + break; + default: $this->activeTag = $element; } @@ -234,6 +244,15 @@ $this->textinput = ''; } + if ($element == 'ENCLOSURE') { + if (!isset($this->item['enclosures'])) { + $this->item['enclosures'] = array(); + } + + $this->item['enclosures'][] = array_change_key_case($this->attribs, CASE_LOWER); + $this->attribs = array(); + } + $this->activeTag = ''; }

« previous php.pear.cvs (#32121) next »