Subversion Repositories Applications.papyrus

Rev

Rev 1527 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1527 Rev 2150
1
<?php
1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
 
3
 
4
/**
4
/**
5
 * Key gateway class for XML_Feed_Parser package
5
 * Key gateway class for XML_Feed_Parser package
6
 *
6
 *
7
 * PHP versions 5
7
 * PHP versions 5
8
 *
8
 *
9
 * LICENSE: This source file is subject to version 3.0 of the PHP license
9
 * LICENSE: This source file is subject to version 3.0 of the PHP license
10
 * that is available through the world-wide-web at the following URI:
10
 * that is available through the world-wide-web at the following URI:
11
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
11
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
12
 * the PHP License and are unable to obtain it through the web, please
12
 * the PHP License and are unable to obtain it through the web, please
13
 * send a note to license@php.net so we can mail you a copy immediately.
13
 * send a note to license@php.net so we can mail you a copy immediately.
14
 *
14
 *
15
 * @category   XML
15
 * @category   XML
16
 * @package    XML_Feed_Parser
16
 * @package    XML_Feed_Parser
17
 * @author     James Stewart <james@jystewart.net>
17
 * @author     James Stewart <james@jystewart.net>
18
 * @copyright  2005 James Stewart <james@jystewart.net>
18
 * @copyright  2005 James Stewart <james@jystewart.net>
19
 * @license    http://www.gnu.org/copyleft/lesser.html  GNU LGPL
19
 * @license    http://www.gnu.org/copyleft/lesser.html  GNU LGPL
20
 * @version    CVS: $Id: Parser.php,v 1.2 2007-07-25 15:05:34 jp_milcent Exp $
20
 * @version    CVS: $Id: Parser.php,v 1.2 2007-07-25 15:05:34 jp_milcent Exp $
21
 * @link       http://pear.php.net/package/XML_Feed_Parser/
21
 * @link       http://pear.php.net/package/XML_Feed_Parser/
22
 */
22
 */
23
 
23
 
24
/**
24
/**
25
 * XML_Feed_Parser_Type is an abstract class required by all of our
25
 * XML_Feed_Parser_Type is an abstract class required by all of our
26
 * feed types. It makes sense to load it here to keep the other files
26
 * feed types. It makes sense to load it here to keep the other files
27
 * clean.
27
 * clean.
28
 */
28
 */
29
require_once 'XML/Feed/Parser/Type.php';
29
require_once 'XML/Feed/Parser/Type.php';
30
 
30
 
31
/**
31
/**
32
 * We will throw exceptions when errors occur.
32
 * We will throw exceptions when errors occur.
33
 */
33
 */
34
require_once 'XML/Feed/Parser/Exception.php';
34
require_once 'XML/Feed/Parser/Exception.php';
35
 
35
 
36
/**
36
/**
37
 * This is the core of the XML_Feed_Parser package. It identifies feed types 
37
 * This is the core of the XML_Feed_Parser package. It identifies feed types 
38
 * and abstracts access to them. It is an iterator, allowing for easy access 
38
 * and abstracts access to them. It is an iterator, allowing for easy access 
39
 * to the entire feed.
39
 * to the entire feed.
40
 *
40
 *
41
 * @author  James Stewart <james@jystewart.net>
41
 * @author  James Stewart <james@jystewart.net>
42
 * @version Release: 1.0.2
42
 * @version Release: 1.0.2
43
 * @package XML_Feed_Parser
43
 * @package XML_Feed_Parser
44
 */
44
 */
45
class XML_Feed_Parser implements Iterator
45
class XML_Feed_Parser implements Iterator
46
{
46
{
47
    /**
47
    /**
48
     * This is where we hold the feed object 
48
     * This is where we hold the feed object 
49
     * @var Object
49
     * @var Object
50
     */
50
     */
51
    private $feed;
51
    private $feed;
52
 
52
 
53
    /**
53
    /**
54
     * To allow for extensions, we make a public reference to the feed model 
54
     * To allow for extensions, we make a public reference to the feed model 
55
     * @var DOMDocument
55
     * @var DOMDocument
56
     */
56
     */
57
    public $model;
57
    public $model;
58
    
58
    
59
    /**
59
    /**
60
     * A map between entry ID and offset
60
     * A map between entry ID and offset
61
     * @var array
61
     * @var array
62
     */
62
     */
63
    protected $idMappings = array();
63
    protected $idMappings = array();
64
 
64
 
65
    /**
65
    /**
66
     * A storage space for Namespace URIs.
66
     * A storage space for Namespace URIs.
67
     * @var array
67
     * @var array
68
     */
68
     */
69
    private $feedNamespaces = array(
69
    private $feedNamespaces = array(
70
        'rss2' => array(
70
        'rss2' => array(
71
            'http://backend.userland.com/rss',
71
            'http://backend.userland.com/rss',
72
            'http://backend.userland.com/rss2',
72
            'http://backend.userland.com/rss2',
73
            'http://blogs.law.harvard.edu/tech/rss'));
73
            'http://blogs.law.harvard.edu/tech/rss'));
74
    /**
74
    /**
75
     * Detects feed types and instantiate appropriate objects.
75
     * Detects feed types and instantiate appropriate objects.
76
     *
76
     *
77
     * Our constructor takes care of detecting feed types and instantiating
77
     * Our constructor takes care of detecting feed types and instantiating
78
     * appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0
78
     * appropriate classes. For now we're going to treat Atom 0.3 as Atom 1.0
79
     * but raise a warning. I do not intend to introduce full support for 
79
     * but raise a warning. I do not intend to introduce full support for 
80
     * Atom 0.3 as it has been deprecated, but others are welcome to.
80
     * Atom 0.3 as it has been deprecated, but others are welcome to.
81
     *
81
     *
82
     * @param    string    $feed    XML serialization of the feed
82
     * @param    string    $feed    XML serialization of the feed
83
     * @param    bool    $strict    Whether or not to validate the feed
83
     * @param    bool    $strict    Whether or not to validate the feed
84
     * @param    bool    $suppressWarnings Trigger errors for deprecated feed types?
84
     * @param    bool    $suppressWarnings Trigger errors for deprecated feed types?
85
     * @param    bool    $tidy    Whether or not to try and use the tidy library on input
85
     * @param    bool    $tidy    Whether or not to try and use the tidy library on input
86
     */
86
     */
87
    function __construct($feed, $strict = false, $suppressWarnings = false, $tidy = false)
87
    function __construct($feed, $strict = false, $suppressWarnings = false, $tidy = false)
88
    {
88
    {
89
        $this->model = new DOMDocument;
89
        $this->model = new DOMDocument;
90
        if (! $this->model->loadXML($feed)) {
90
        if (! $this->model->loadXML($feed)) {
91
            if (extension_loaded('tidy') && $tidy) {
91
            if (extension_loaded('tidy') && $tidy) {
92
                $tidy = new tidy;
92
                $tidy = new tidy;
93
                $tidy->parseString($feed, 
93
                $tidy->parseString($feed, 
94
                    array('input-xml' => true, 'output-xml' => true));
94
                    array('input-xml' => true, 'output-xml' => true));
95
                $tidy->cleanRepair();
95
                $tidy->cleanRepair();
96
                if (! $this->model->loadXML((string) $tidy)) {
96
                if (! $this->model->loadXML((string) $tidy)) {
97
                    throw new XML_Feed_Parser_Exception('Invalid input: this is not ' .
97
                    throw new XML_Feed_Parser_Exception('Invalid input: this is not ' .
98
                        'valid XML');
98
                        'valid XML');
99
                }
99
                }
100
            } else {
100
            } else {
101
                throw new XML_Feed_Parser_Exception('Invalid input: this is not valid XML');
101
                throw new XML_Feed_Parser_Exception('Invalid input: this is not valid XML');
102
            }
102
            }
103
 
103
 
104
        }
104
        }
-
 
105
 
105
 
106
 
106
        /* detect feed type */
107
        /* detect feed type */
107
        $doc_element = $this->model->documentElement;
108
        $doc_element = $this->model->documentElement;
108
        $error = false;
109
        $error = false;
109
 
-
 
110
        switch (true) {
110
        switch (true) {
111
            case ($doc_element->namespaceURI == 'http://www.w3.org/2005/Atom'):
111
            case ($doc_element->namespaceURI == 'http://www.w3.org/2005/Atom'):
112
                require_once 'XML/Feed/Parser/Atom.php';
112
                require_once 'XML/Feed/Parser/Atom.php';
113
                require_once 'XML/Feed/Parser/AtomElement.php';
113
                require_once 'XML/Feed/Parser/AtomElement.php';
114
                $class = 'XML_Feed_Parser_Atom';
114
                $class = 'XML_Feed_Parser_Atom';
115
                break;
115
                break;
116
            case ($doc_element->namespaceURI == 'http://purl.org/atom/ns#'):
116
            case ($doc_element->namespaceURI == 'http://purl.org/atom/ns#'):
117
                require_once 'XML/Feed/Parser/Atom.php';
117
                require_once 'XML/Feed/Parser/Atom.php';
118
                require_once 'XML/Feed/Parser/AtomElement.php';
118
                require_once 'XML/Feed/Parser/AtomElement.php';
119
                $class = 'XML_Feed_Parser_Atom';
119
                $class = 'XML_Feed_Parser_Atom';
120
                $error = 'Atom 0.3 deprecated, using 1.0 parser which won\'t provide ' .
120
                $error = 'Atom 0.3 deprecated, using 1.0 parser which won\'t provide ' .
121
                    'all options';
121
                    'all options';
122
                break;
122
                break;
123
            case ($doc_element->namespaceURI == 'http://purl.org/rss/1.0/' || 
123
            case ($doc_element->namespaceURI == 'http://purl.org/rss/1.0/' || 
124
                ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1 
124
                ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1 
125
                && $doc_element->childNodes->item(1)->namespaceURI == 
125
                && $doc_element->childNodes->item(1)->namespaceURI == 
126
                'http://purl.org/rss/1.0/')):
126
                'http://purl.org/rss/1.0/')):
127
                require_once 'XML/Feed/Parser/RSS1.php';
127
                require_once 'XML/Feed/Parser/RSS1.php';
128
                require_once 'XML/Feed/Parser/RSS1Element.php';
128
                require_once 'XML/Feed/Parser/RSS1Element.php';
129
                $class = 'XML_Feed_Parser_RSS1';
129
                $class = 'XML_Feed_Parser_RSS1';
130
                break;
130
                break;
131
            case ($doc_element->namespaceURI == 'http://purl.org/rss/1.1/' || 
131
            case ($doc_element->namespaceURI == 'http://purl.org/rss/1.1/' || 
132
                ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1 
132
                ($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1 
133
                && $doc_element->childNodes->item(1)->namespaceURI == 
133
                && $doc_element->childNodes->item(1)->namespaceURI == 
134
                'http://purl.org/rss/1.1/')):
134
                'http://purl.org/rss/1.1/')):
135
                require_once 'XML/Feed/Parser/RSS11.php';
135
                require_once 'XML/Feed/Parser/RSS11.php';
136
                require_once 'XML/Feed/Parser/RSS11Element.php';
136
                require_once 'XML/Feed/Parser/RSS11Element.php';
137
                $class = 'XML_Feed_Parser_RSS11';
137
                $class = 'XML_Feed_Parser_RSS11';
138
                break;
138
                break;
139
            case (($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
139
            case (($doc_element->hasChildNodes() && $doc_element->childNodes->length > 1
140
                && $doc_element->childNodes->item(1)->namespaceURI == 
140
                && $doc_element->childNodes->item(1)->namespaceURI == 
141
                'http://my.netscape.com/rdf/simple/0.9/') || 
141
                'http://my.netscape.com/rdf/simple/0.9/') || 
142
                $doc_element->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/'):
142
                $doc_element->namespaceURI == 'http://my.netscape.com/rdf/simple/0.9/'):
143
                require_once 'XML/Feed/Parser/RSS09.php';
143
                require_once 'XML/Feed/Parser/RSS09.php';
144
                require_once 'XML/Feed/Parser/RSS09Element.php';
144
                require_once 'XML/Feed/Parser/RSS09Element.php';
145
                $class = 'XML_Feed_Parser_RSS09';
145
                $class = 'XML_Feed_Parser_RSS09';
146
                break;
146
                break;
147
            case ($doc_element->tagName == 'rss' and
147
            case ($doc_element->tagName == 'rss' and
148
                $doc_element->hasAttribute('version') && 
148
                $doc_element->hasAttribute('version') && 
149
                $doc_element->getAttribute('version') == 0.91):
149
                $doc_element->getAttribute('version') == 0.91):
150
                $error = 'RSS 0.91 has been superceded by RSS2.0. Using RSS2.0 parser.';
150
                $error = 'RSS 0.91 has been superceded by RSS2.0. Using RSS2.0 parser.';
151
                require_once 'XML/Feed/Parser/RSS2.php';
151
                require_once 'XML/Feed/Parser/RSS2.php';
152
                require_once 'XML/Feed/Parser/RSS2Element.php';
152
                require_once 'XML/Feed/Parser/RSS2Element.php';
153
                $class = 'XML_Feed_Parser_RSS2';
153
                $class = 'XML_Feed_Parser_RSS2';
154
                break;
154
                break;
155
            case ($doc_element->tagName == 'rss' and
155
            case ($doc_element->tagName == 'rss' and
156
                $doc_element->hasAttribute('version') && 
156
                $doc_element->hasAttribute('version') && 
157
                $doc_element->getAttribute('version') == 0.92):
157
                $doc_element->getAttribute('version') == 0.92):
158
                $error = 'RSS 0.92 has been superceded by RSS2.0. Using RSS2.0 parser.';
158
                $error = 'RSS 0.92 has been superceded by RSS2.0. Using RSS2.0 parser.';
159
                require_once 'XML/Feed/Parser/RSS2.php';
159
                require_once 'XML/Feed/Parser/RSS2.php';
160
                require_once 'XML/Feed/Parser/RSS2Element.php';
160
                require_once 'XML/Feed/Parser/RSS2Element.php';
161
                $class = 'XML_Feed_Parser_RSS2';
161
                $class = 'XML_Feed_Parser_RSS2';
162
                break;
162
                break;
163
            case (in_array($doc_element->namespaceURI, $this->feedNamespaces['rss2'])
163
            case (in_array($doc_element->namespaceURI, $this->feedNamespaces['rss2'])
164
                || $doc_element->tagName == 'rss'):
164
                || $doc_element->tagName == 'rss'):
165
                if (! $doc_element->hasAttribute('version') || 
165
                if (! $doc_element->hasAttribute('version') || 
166
                    $doc_element->getAttribute('version') != 2) {
166
                    $doc_element->getAttribute('version') != 2) {
167
                    $error = 'RSS version not specified. Parsing as RSS2.0';
167
                    $error = 'RSS version not specified. Parsing as RSS2.0';
168
                }
168
                }
169
                require_once 'XML/Feed/Parser/RSS2.php';
169
                require_once 'XML/Feed/Parser/RSS2.php';
170
                require_once 'XML/Feed/Parser/RSS2Element.php';
170
                require_once 'XML/Feed/Parser/RSS2Element.php';
171
                $class = 'XML_Feed_Parser_RSS2';
171
                $class = 'XML_Feed_Parser_RSS2';
172
                break;
172
                break;
173
            default:
173
            default:
174
                throw new XML_Feed_Parser_Exception('Feed type unknown');
174
                throw new XML_Feed_Parser_Exception('Feed type unknown');
175
                break;
175
                break;
176
        }
176
        }
177
 
177
 
178
        if (! $suppressWarnings && ! empty($error)) {
178
        if (! $suppressWarnings && ! empty($error)) {
179
            trigger_error($error, E_USER_WARNING);
179
            trigger_error($error, E_USER_WARNING);
180
        }
180
        }
181
 
181
 
182
        /* Instantiate feed object */
182
        /* Instantiate feed object */
183
        $this->feed = new $class($this->model, $strict);
183
        $this->feed = new $class($this->model, $strict);
184
    }
184
    }
185
 
185
 
186
    /**
186
    /**
187
     * Proxy to allow feed element names to be used as method names
187
     * Proxy to allow feed element names to be used as method names
188
     *
188
     *
189
     * For top-level feed elements we will provide access using methods or 
189
     * For top-level feed elements we will provide access using methods or 
190
     * attributes. This function simply passes on a request to the appropriate 
190
     * attributes. This function simply passes on a request to the appropriate 
191
     * feed type object.
191
     * feed type object.
192
     *
192
     *
193
     * @param   string  $call - the method being called
193
     * @param   string  $call - the method being called
194
     * @param   array   $attributes
194
     * @param   array   $attributes
195
     */
195
     */
196
    function __call($call, $attributes)
196
    function __call($call, $attributes)
197
    {
197
    {
198
        $attributes = array_pad($attributes, 5, false);
198
        $attributes = array_pad($attributes, 5, false);
199
        list($a, $b, $c, $d, $e) = $attributes;
199
        list($a, $b, $c, $d, $e) = $attributes;
200
        return $this->feed->$call($a, $b, $c, $d, $e);
200
        return $this->feed->$call($a, $b, $c, $d, $e);
201
    }
201
    }
202
 
202
 
203
    /**
203
    /**
204
     * Proxy to allow feed element names to be used as attribute names
204
     * Proxy to allow feed element names to be used as attribute names
205
     *
205
     *
206
     * To allow variable-like access to feed-level data we use this
206
     * To allow variable-like access to feed-level data we use this
207
     * method. It simply passes along to __call() which in turn passes
207
     * method. It simply passes along to __call() which in turn passes
208
     * along to the relevant object.
208
     * along to the relevant object.
209
     *
209
     *
210
     * @param   string  $val - the name of the variable required
210
     * @param   string  $val - the name of the variable required
211
     */
211
     */
212
    function __get($val)
212
    function __get($val)
213
    {
213
    {
214
        return $this->feed->$val;
214
        return $this->feed->$val;
215
    }
215
    }
216
 
216
 
217
    /**
217
    /**
218
     * Provides iteration functionality.
218
     * Provides iteration functionality.
219
     *
219
     *
220
     * Of course we must be able to iterate... This function simply increases
220
     * Of course we must be able to iterate... This function simply increases
221
     * our internal counter.
221
     * our internal counter.
222
     */
222
     */
223
    function next()
223
    function next()
224
    {
224
    {
225
        if (isset($this->current_item) && 
225
        if (isset($this->current_item) && 
226
            $this->current_item <= $this->feed->numberEntries - 1) {
226
            $this->current_item <= $this->feed->numberEntries - 1) {
227
            ++$this->current_item;
227
            ++$this->current_item;
228
        } else if (! isset($this->current_item)) {
228
        } else if (! isset($this->current_item)) {
229
            $this->current_item = 0;
229
            $this->current_item = 0;
230
        } else {
230
        } else {
231
            return false;
231
            return false;
232
        }
232
        }
233
    }
233
    }
234
 
234
 
235
    /**
235
    /**
236
     * Return XML_Feed_Type object for current element
236
     * Return XML_Feed_Type object for current element
237
     *
237
     *
238
     * @return    XML_Feed_Parser_Type Object
238
     * @return    XML_Feed_Parser_Type Object
239
     */
239
     */
240
    function current()
240
    function current()
241
    {
241
    {
242
        return $this->getEntryByOffset($this->current_item);
242
        return $this->getEntryByOffset($this->current_item);
243
    }
243
    }
244
 
244
 
245
    /**
245
    /**
246
     * For iteration -- returns the key for the current stage in the array.
246
     * For iteration -- returns the key for the current stage in the array.
247
     *
247
     *
248
     * @return    int
248
     * @return    int
249
     */    
249
     */    
250
    function key()
250
    function key()
251
    {
251
    {
252
        return $this->current_item;
252
        return $this->current_item;
253
    }
253
    }
254
 
254
 
255
    /**
255
    /**
256
     * For iteration -- tells whether we have reached the 
256
     * For iteration -- tells whether we have reached the 
257
     * end.
257
     * end.
258
     *
258
     *
259
     * @return    bool
259
     * @return    bool
260
     */
260
     */
261
    function valid()
261
    function valid()
262
    {
262
    {
263
        return $this->current_item < $this->feed->numberEntries;
263
        return $this->current_item < $this->feed->numberEntries;
264
    }
264
    }
265
 
265
 
266
    /**
266
    /**
267
     * For iteration -- resets the internal counter to the beginning.
267
     * For iteration -- resets the internal counter to the beginning.
268
     */
268
     */
269
    function rewind()
269
    function rewind()
270
    {
270
    {
271
        $this->current_item = 0;
271
        $this->current_item = 0;
272
    }
272
    }
273
 
273
 
274
    /**
274
    /**
275
     * Provides access to entries by ID if one is specified in the source feed.
275
     * Provides access to entries by ID if one is specified in the source feed.
276
     *
276
     *
277
     * As well as allowing the items to be iterated over we want to allow
277
     * As well as allowing the items to be iterated over we want to allow
278
     * users to be able to access a specific entry. This is one of two ways of
278
     * users to be able to access a specific entry. This is one of two ways of
279
     * doing that, the other being by offset. This method can be quite slow
279
     * doing that, the other being by offset. This method can be quite slow
280
     * if dealing with a large feed that hasn't yet been processed as it
280
     * if dealing with a large feed that hasn't yet been processed as it
281
     * instantiates objects for every entry until it finds the one needed.
281
     * instantiates objects for every entry until it finds the one needed.
282
     *
282
     *
283
     * @param    string    $id  Valid ID for the given feed format
283
     * @param    string    $id  Valid ID for the given feed format
284
     * @return    XML_Feed_Parser_Type|false
284
     * @return    XML_Feed_Parser_Type|false
285
     */            
285
     */            
286
    function getEntryById($id)
286
    function getEntryById($id)
287
    {
287
    {
288
        if (isset($this->idMappings[$id])) {
288
        if (isset($this->idMappings[$id])) {
289
            return $this->getEntryByOffset($this->idMappings[$id]);
289
            return $this->getEntryByOffset($this->idMappings[$id]);
290
        }
290
        }
291
 
291
 
292
        /* 
292
        /* 
293
         * Since we have not yet encountered that ID, let's go through all the
293
         * Since we have not yet encountered that ID, let's go through all the
294
         * remaining entries in order till we find it.
294
         * remaining entries in order till we find it.
295
         * This is a fairly slow implementation, but it should work.
295
         * This is a fairly slow implementation, but it should work.
296
         */
296
         */
297
        return $this->feed->getEntryById($id);
297
        return $this->feed->getEntryById($id);
298
    }
298
    }
299
 
299
 
300
    /**
300
    /**
301
     * Retrieve entry by numeric offset, starting from zero.
301
     * Retrieve entry by numeric offset, starting from zero.
302
     *
302
     *
303
     * As well as allowing the items to be iterated over we want to allow
303
     * As well as allowing the items to be iterated over we want to allow
304
     * users to be able to access a specific entry. This is one of two ways of
304
     * users to be able to access a specific entry. This is one of two ways of
305
     * doing that, the other being by ID.
305
     * doing that, the other being by ID.
306
     *
306
     *
307
     * @param    int    $offset The position of the entry within the feed, starting from 0
307
     * @param    int    $offset The position of the entry within the feed, starting from 0
308
     * @return    XML_Feed_Parser_Type|false
308
     * @return    XML_Feed_Parser_Type|false
309
     */
309
     */
310
    function getEntryByOffset($offset)
310
    function getEntryByOffset($offset)
311
    {
311
    {
312
        if ($offset < $this->feed->numberEntries) {
312
        if ($offset < $this->feed->numberEntries) {
313
            if (isset($this->feed->entries[$offset])) {
313
            if (isset($this->feed->entries[$offset])) {
314
                return $this->feed->entries[$offset];
314
                return $this->feed->entries[$offset];
315
            } else {
315
            } else {
316
                try {
316
                try {
317
                    $this->feed->getEntryByOffset($offset);
317
                    $this->feed->getEntryByOffset($offset);
318
                } catch (Exception $e) {
318
                } catch (Exception $e) {
319
                    return false;
319
                    return false;
320
                }
320
                }
321
                $id = $this->feed->entries[$offset]->getID();
321
                $id = $this->feed->entries[$offset]->getID();
322
                $this->idMappings[$id] = $offset;
322
                $this->idMappings[$id] = $offset;
323
                return $this->feed->entries[$offset];
323
                return $this->feed->entries[$offset];
324
            }
324
            }
325
        } else {
325
        } else {
326
            return false;
326
            return false;
327
        }
327
        }
328
    }
328
    }
329
 
329
 
330
    /**
330
    /**
331
     * Retrieve version details from feed type class.
331
     * Retrieve version details from feed type class.
332
     *
332
     *
333
     * @return void
333
     * @return void
334
     * @author James Stewart
334
     * @author James Stewart
335
     */
335
     */
336
    function version()
336
    function version()
337
    {
337
    {
338
        return $this->feed->version;
338
        return $this->feed->version;
339
    }
339
    }
340
    
340
    
341
    /**
341
    /**
342
     * Returns a string representation of the feed.
342
     * Returns a string representation of the feed.
343
     * 
343
     * 
344
     * @return String
344
     * @return String
345
     **/
345
     **/
346
    function __toString()
346
    function __toString()
347
    {
347
    {
348
        return $this->feed->__toString();
348
        return $this->feed->__toString();
349
    }
349
    }
350
}
350
}
351
?>
-
 
352
351
?>
-
 
352