aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/export/opml.phtml
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2022-05-12 22:15:10 +0200
committerGravatar GitHub <noreply@github.com> 2022-05-12 22:15:10 +0200
commit4a87206f2898665e99953590536cedc6c5505f05 (patch)
tree398f53769048460071194d398c61c7e847f22d7e /app/views/helpers/export/opml.phtml
parent9d1930d9adb4f56ae12209d3d01f4a1ed1af8503 (diff)
OPML export/import of some proprietary FreshRSS attributes (#4342)
* OPML export/import of some proprietary FreshRSS attributes #fix https://github.com/FreshRSS/FreshRSS/issues/4077 And one of the TODOs of https://github.com/FreshRSS/FreshRSS/pull/4220 XPath options, CSS Selector, and action filters * Bump library patch version * OPML namespace + documentation * Add example
Diffstat (limited to 'app/views/helpers/export/opml.phtml')
-rw-r--r--app/views/helpers/export/opml.phtml32
1 files changed, 29 insertions, 3 deletions
diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml
index 971dc1445..458ea0e58 100644
--- a/app/views/helpers/export/opml.phtml
+++ b/app/views/helpers/export/opml.phtml
@@ -15,14 +15,40 @@ foreach ($this->categories as $key => $cat) {
'@outlines' => array()
);
+ /** @var FreshRSS_Feed $feed */
foreach ($cat['feeds'] as $feed) {
- $opml_array['body'][$key]['@outlines'][] = array(
+ $outline = [
'text' => htmlspecialchars_decode($feed->name(), ENT_QUOTES),
- 'type' => 'rss',
+ 'type' => FreshRSS_Export_Service::TYPE_RSS_ATOM,
'xmlUrl' => htmlspecialchars_decode($feed->url(), ENT_QUOTES),
'htmlUrl' => htmlspecialchars_decode($feed->website(), ENT_QUOTES),
'description' => htmlspecialchars_decode($feed->description(), ENT_QUOTES),
- );
+ ];
+ if ($feed->kind() === FreshRSS_Feed::KIND_HTML_XPATH) {
+ $outline['type'] = FreshRSS_Export_Service::TYPE_HTML_XPATH;
+ /** @var array<string,string> */
+ $xPathSettings = $feed->attributes('xpath');
+ $outline['frss:xPathItem'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['item'] ?? null];
+ $outline['frss:xPathItemTitle'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemTitle'] ?? null];
+ $outline['frss:xPathItemContent'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemContent'] ?? null];
+ $outline['frss:xPathItemUri'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemUri'] ?? null];
+ $outline['frss:xPathItemAuthor'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemAuthor'] ?? null];
+ $outline['frss:xPathItemTimestamp'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemTimestamp'] ?? null];
+ $outline['frss:xPathItemThumbnail'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemThumbnail'] ?? null];
+ $outline['frss:xPathItemCategories'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $xPathSettings['itemCategories'] ?? null];
+ }
+ if (!empty($feed->filtersAction('read'))) {
+ $filters = '';
+ foreach ($feed->filtersAction('read') as $filterRead) {
+ $filters .= $filterRead->getRawInput() . "\n";
+ }
+ $filters = trim($filters);
+ $outline['frss:filtersActionRead'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $filters];
+ }
+ if ($feed->pathEntries() != '') {
+ $outline['frss:cssFullContent'] = ['namespace' => FreshRSS_Export_Service::FRSS_NAMESPACE, 'value' => $feed->pathEntries()];
+ }
+ $opml_array['body'][$key]['@outlines'][] = $outline;
}
}