diff options
| author | 2012-10-23 18:29:43 +0200 | |
|---|---|---|
| committer | 2012-10-23 18:29:43 +0200 | |
| commit | fca236dc6d6ff6e09182c560f3566904cbc7a70a (patch) | |
| tree | 850bfab52359702dad2a9eccd03f01b5c68c9bcb /lib | |
| parent | 9a95cb844e80512205c519da69ec373e046b7f52 (diff) | |
affichage par catégories + meilleur exportation opml
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lib_rss.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php index c695b64b7..74a86558c 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -69,16 +69,23 @@ function sortReverseEntriesByDate ($entry1, $entry2) { return $entry1->date (true) - $entry2->date (true); } -function opml_export ($feeds) { - // TODO gérer les catégories - $txt = '<outline text="default">' . "\n"; +function get_domain ($url) { + return parse_url($url, PHP_URL_HOST); +} + +function opml_export ($cats) { + $txt = ''; - foreach ($feeds as $feed) { - $txt .= "\t" . '<outline text="' . $feed->name () . '" type="rss" xmlUrl="' . $feed->url () . '" htmlUrl="' . $feed->website () . '" />' . "\n"; + foreach ($cats as $cat) { + $txt .= '<outline text="' . $cat['name'] . '">' . "\n"; + + foreach ($cat['feeds'] as $feed) { + $txt .= "\t" . '<outline text="' . $feed->name () . '" type="rss" xmlUrl="' . $feed->url () . '" htmlUrl="' . $feed->website () . '" />' . "\n"; + } + + $txt .= '</outline>' . "\n"; } - $txt .= '</outline>' . "\n"; - return $txt; } |
