| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class sfRss201rev2Feed extends sfRssFeed |
|---|
| 21 |
{ |
|---|
| 22 |
protected function getFeedElements() |
|---|
| 23 |
{ |
|---|
| 24 |
$xml = array(); |
|---|
| 25 |
foreach ($this->getItems() as $item) |
|---|
| 26 |
{ |
|---|
| 27 |
$xml[] = '<item>'; |
|---|
| 28 |
$xml[] = ' <title>'.htmlspecialchars($this->getItemFeedTitle($item)).'</title>'; |
|---|
| 29 |
if ($this->getItemFeedDescription($item)) |
|---|
| 30 |
{ |
|---|
| 31 |
$xml[] = ' <description>'.htmlspecialchars($this->getItemFeedDescription($item)).'</description>'; |
|---|
| 32 |
} |
|---|
| 33 |
$xml[] = ' <link>'.$this->getItemFeedLink($item).'</link>'; |
|---|
| 34 |
if ($this->getItemFeedUniqueId($item)) |
|---|
| 35 |
{ |
|---|
| 36 |
$xml[] = ' <guid>'.$this->getItemFeedUniqueId($item).'</guid>'; |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
if ($this->getItemFeedAuthorEmail($item) && $this->getItemFeedAuthorName($item)) |
|---|
| 41 |
{ |
|---|
| 42 |
$xml[] = sprintf(' <author>%s (%s)</author>', $this->getItemFeedAuthorEmail($item), $this->getItemFeedAuthorName($item)); |
|---|
| 43 |
} |
|---|
| 44 |
if ($this->getItemFeedPubdate($item)) |
|---|
| 45 |
{ |
|---|
| 46 |
$xml[] = ' <pubDate>'.date('r', $this->getItemFeedPubdate($item)).'</pubDate>'; |
|---|
| 47 |
} |
|---|
| 48 |
if ($this->getItemFeedComments($item)) |
|---|
| 49 |
{ |
|---|
| 50 |
$xml[] = ' <comments>'.htmlspecialchars($this->getItemFeedComments($item)).'</comments>'; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
if ((method_exists($item, 'getFeedEnclosure')) && ($enclosure = $item->getFeedEnclosure())) |
|---|
| 55 |
{ |
|---|
| 56 |
$enclosure_attributes = sprintf('url="%s" length="%s" type="%s"', $enclosure->getUrl(), $enclosure->getLength(), $enclosure->getMimeType()); |
|---|
| 57 |
$xml[] = ' <enclosure '.$enclosure_attributes.'></enclosure>'; |
|---|
| 58 |
} |
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
foreach ($this->getItemFeedCategories($item) as $category) |
|---|
| 62 |
{ |
|---|
| 63 |
$xml[] = ' <category>'.$category.'</category>'; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
$xml[] = '</item>'; |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
return $xml; |
|---|
| 70 |
} |
|---|
| 71 |
|
|---|
| 72 |
protected function getVersion() |
|---|
| 73 |
{ |
|---|
| 74 |
return '2.0'; |
|---|
| 75 |
} |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
?> |
|---|