10 defined(
'JPATH_PLATFORM') or die;
26 protected $entryElementName =
'item';
44 protected function handleCategory(
JFeed $feed, SimpleXMLElement $el)
47 $domain = (string) $el[
'domain'];
48 $category = (string) $el;
63 protected function handleCloud(
JFeed $feed, SimpleXMLElement $el)
65 $cloud =
new stdClass;
66 $cloud->domain = (string) $el[
'domain'];
67 $cloud->port = (string) $el[
'port'];
68 $cloud->path = (string) $el[
'path'];
69 $cloud->protocol = (string) $el[
'protocol'];
70 $cloud->registerProcedure = (string) $el[
'registerProcedure'];
72 $feed->cloud = $cloud;
85 protected function handleCopyright(
JFeed $feed, SimpleXMLElement $el)
87 $feed->copyright = (string) $el;
100 protected function handleDescription(
JFeed $feed, SimpleXMLElement $el)
102 $feed->description = (string) $el;
115 protected function handleGenerator(
JFeed $feed, SimpleXMLElement $el)
117 $feed->generator = (string) $el;
130 protected function handleImage(
JFeed $feed, SimpleXMLElement $el)
142 $image->link = (string) $el->link;
143 $image->description = (
string) $el->description;
144 $image->height = (string) $el->height;
145 $image->width = (
string) $el->width;
147 $feed->image = $image;
160 protected function handleLanguage(
JFeed $feed, SimpleXMLElement $el)
162 $feed->language = (string) $el;
175 protected function handleLastBuildDate(
JFeed $feed, SimpleXMLElement $el)
177 $feed->updatedDate = (string) $el;
190 protected function handleLink(
JFeed $feed, SimpleXMLElement $el)
193 $link->uri = (string) $el[
'href'];
207 protected function handleManagingEditor(
JFeed $feed, SimpleXMLElement $el)
209 $feed->author = $this->processPerson((
string) $el);
222 protected function handleSkipDays(
JFeed $feed, SimpleXMLElement $el)
228 foreach ($el->day as $day)
230 $days[] = (string) $day;
233 $feed->skipDays = $days;
246 protected function handleSkipHours(
JFeed $feed, SimpleXMLElement $el)
252 foreach ($el->hour as $hour)
254 $hours[] = (int) $hour;
257 $feed->skipHours = $hours;
270 protected function handlePubDate(
JFeed $feed, SimpleXMLElement $el)
272 $feed->publishedDate = (string) $el;
285 protected function handleTitle(
JFeed $feed, SimpleXMLElement $el)
287 $feed->title = (string) $el;
300 protected function handleTtl(
JFeed $feed, SimpleXMLElement $el)
302 $feed->ttl = (integer) $el;
315 protected function handleWebmaster(
JFeed $feed, SimpleXMLElement $el)
319 $tmp = explode(
' ', $tmp, 2);
326 $name = trim($tmp[1],
' ()');
329 $email = trim($tmp[0]);
342 protected function initialise()
345 $this->version = $this->stream->getAttribute(
'version');
348 $this->moveToNextElement(
'channel');
349 $this->moveToNextElement();
362 protected function processFeedEntry(
JFeedEntry $entry, SimpleXMLElement $el)
364 $entry->uri = (string) $el->link;
365 $entry->title = (
string) $el->title;
366 $entry->publishedDate = (string) $el->pubDate;
367 $entry->updatedDate = (
string) $el->pubDate;
368 $entry->content = (string) $el->description;
369 $entry->guid = (
string) $el->guid;
370 $entry->comments = (string) $el->comments;
373 $author = (
string) $el->author;
377 $entry->author = $this->processPerson($author);
381 foreach ($el->category as $category)
383 $entry->
addCategory((
string) $category, (
string) $category[
'domain']);
387 foreach ($el->enclosure as $enclosure)
390 (
string) $enclosure[
'url'],
392 (
string) $enclosure[
'type'],
395 (
int) $enclosure[
'length']
411 protected function processPerson($data)
417 $data = explode(
' ', $data, 2);
421 $person->name = trim($data[1],
' ()');
425 $person->email = trim($data[0]);