From ab9a4e292cab48c94e6bac818f3256f6e131c041 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 10 Dec 2024 14:57:25 +0100 Subject: OPML export/import for cssFullContentConditions (#7082) Follow-up of https://github.com/FreshRSS/FreshRSS/commit/33fd07f6f26310d4806077cc87bcdf9b8b940e35, which should have been a PR. --- app/Controllers/subscriptionController.php | 2 +- app/Models/Entry.php | 4 ++-- app/Services/ImportService.php | 11 +++++++++-- app/i18n/cs/sub.php | 2 +- app/i18n/de/sub.php | 2 +- app/i18n/el/sub.php | 2 +- app/i18n/en-us/sub.php | 2 +- app/i18n/en/sub.php | 2 +- app/i18n/es/sub.php | 2 +- app/i18n/fa/sub.php | 2 +- app/i18n/fi/sub.php | 2 +- app/i18n/fr/sub.php | 2 +- app/i18n/he/sub.php | 2 +- app/i18n/hu/sub.php | 2 +- app/i18n/id/sub.php | 2 +- app/i18n/it/sub.php | 2 +- app/i18n/ja/sub.php | 2 +- app/i18n/ko/sub.php | 2 +- app/i18n/lv/sub.php | 2 +- app/i18n/nl/sub.php | 2 +- app/i18n/oc/sub.php | 2 +- app/i18n/pl/sub.php | 2 +- app/i18n/pt-br/sub.php | 2 +- app/i18n/ru/sub.php | 2 +- app/i18n/sk/sub.php | 2 +- app/i18n/tr/sub.php | 2 +- app/i18n/zh-cn/sub.php | 2 +- app/i18n/zh-tw/sub.php | 2 +- app/views/helpers/export/opml.phtml | 13 ++++++++++++- app/views/helpers/feed/update.phtml | 6 +++--- 30 files changed, 52 insertions(+), 34 deletions(-) (limited to 'app') diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 048eeef2e..73680d9eb 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -299,7 +299,7 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { } } - $feed->_attribute('path_entries_condition', Minz_Request::paramTextToArray('path_entries_condition', plaintext: true)); + $feed->_attribute('path_entries_conditions', Minz_Request::paramTextToArray('path_entries_conditions', plaintext: true)); $feed->_attribute('path_entries_filter', Minz_Request::paramString('path_entries_filter', true)); $values = [ diff --git a/app/Models/Entry.php b/app/Models/Entry.php index adb208276..e742912ad 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -814,9 +814,9 @@ HTML; if ($url === '' || $feed === null || $feed->pathEntries() === '') { return ''; } - if (!empty($feed->attributeArray('path_entries_condition'))) { + if (!empty($feed->attributeArray('path_entries_conditions'))) { $found = false; - foreach ($feed->attributeArray('path_entries_condition') as $condition) { + foreach ($feed->attributeArray('path_entries_conditions') as $condition) { if (!is_string($condition) || trim($condition) === '') { continue; } diff --git a/app/Services/ImportService.php b/app/Services/ImportService.php index 51ab106ca..b1cd7855a 100644 --- a/app/Services/ImportService.php +++ b/app/Services/ImportService.php @@ -180,8 +180,15 @@ class FreshRSS_Import_Service { $feed->_pathEntries(Minz_Helper::htmlspecialchars_utf8($feed_elt['frss:cssFullContent'])); } - if (isset($feed_elt['frss:cssFullContentFilter'])) { - $feed->_attribute('path_entries_filter', $feed_elt['frss:cssFullContentFilter']); + if (isset($feed_elt['frss:cssFullContentConditions'])) { + $feed->_attribute( + 'path_entries_conditions', + preg_split('/\R/u', $feed_elt['frss:cssFullContentConditions']) ?: [] + ); + } + + if (isset($feed_elt['frss:cssContentFilter']) || isset($feed_elt['frss:cssFullContentFilter'])) { + $feed->_attribute('path_entries_filter', $feed_elt['frss:cssContentFilter'] ?? $feed_elt['frss:cssFullContentFilter']); } if (isset($feed_elt['frss:filtersActionRead'])) { diff --git a/app/i18n/cs/sub.php b/app/i18n/cs/sub.php index a977fcf23..6f8d1a069 100644 --- a/app/i18n/cs/sub.php +++ b/app/i18n/cs/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Nejsou vybrány žádné kanály.', 'number_entries' => '%d článků', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Viditelnost', 'archived' => 'Nezobrazovat (archivováno)', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index 63d44181d..73d6022d2 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Kein Feed ausgewählt.', 'number_entries' => '%d Artikel', 'open_feed' => 'Feed %s öffnen', - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Sichtbarkeit', 'archived' => 'Nicht anzeigen (archiviert)', diff --git a/app/i18n/el/sub.php b/app/i18n/el/sub.php index ebd3f94c5..8ad25cae9 100644 --- a/app/i18n/el/sub.php +++ b/app/i18n/el/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'No feed selected.', // TODO 'number_entries' => '%d articles', // TODO 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibility', // TODO 'archived' => 'Do not show (archived)', // TODO diff --git a/app/i18n/en-us/sub.php b/app/i18n/en-us/sub.php index 0f9c5948b..416926fea 100644 --- a/app/i18n/en-us/sub.php +++ b/app/i18n/en-us/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'No feed selected.', // IGNORE 'number_entries' => '%d articles', // IGNORE 'open_feed' => 'Open feed %s', // IGNORE - 'path_entries_condition' => 'Condition for content retrieval', // IGNORE + 'path_entries_conditions' => 'Conditions for content retrieval', // IGNORE 'priority' => array( '_' => 'Visibility', // IGNORE 'archived' => 'Do not show (archived)', // IGNORE diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index eb9a85780..a075f10d0 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'No feed selected.', 'number_entries' => '%d articles', 'open_feed' => 'Open feed %s', - 'path_entries_condition' => 'Condition for content retrieval', + 'path_entries_conditions' => 'Conditions for content retrieval', 'priority' => array( '_' => 'Visibility', 'archived' => 'Do not show (archived)', diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php index c14f7730e..34ba85c78 100644 --- a/app/i18n/es/sub.php +++ b/app/i18n/es/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'No hay fuentes seleccionadas.', 'number_entries' => '%d artículos', 'open_feed' => 'Fuente abierta %s', - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibilidad', 'archived' => 'No mostrar (archivado)', diff --git a/app/i18n/fa/sub.php b/app/i18n/fa/sub.php index 0b4df39a9..f5b5b13b9 100644 --- a/app/i18n/fa/sub.php +++ b/app/i18n/fa/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => ' هیچ خوراکی انتخاب نشده است.', 'number_entries' => ' %d مقاله', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => ' دید', 'archived' => ' نشان داده نشود (بایگانی شده)', diff --git a/app/i18n/fi/sub.php b/app/i18n/fi/sub.php index 21dce88ba..177d9e0ca 100644 --- a/app/i18n/fi/sub.php +++ b/app/i18n/fi/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Syötettä ei ole valittu.', 'number_entries' => '%d artikkelia', 'open_feed' => 'Avaa syöte %s', - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Näkyvyys', 'archived' => 'Älä näytä (arkistoitu)', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index 3509e82fc..a3e6d32d3 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Aucun flux sélectionné.', 'number_entries' => '%d articles', // IGNORE 'open_feed' => 'Ouvrir le flux %s', - 'path_entries_condition' => 'Condition pour la récupération de contenu', + 'path_entries_conditions' => 'Conditions pour la récupération de contenu', 'priority' => array( '_' => 'Visibilité', 'archived' => 'Ne pas afficher (archivé)', diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php index 180fc6a0c..0d187c416 100644 --- a/app/i18n/he/sub.php +++ b/app/i18n/he/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'אף הזנה לא נבחרה.', 'number_entries' => '%d מאמרים', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibility', // TODO 'archived' => 'Do not show (archived)', // TODO diff --git a/app/i18n/hu/sub.php b/app/i18n/hu/sub.php index d13abe9b5..49f23f408 100644 --- a/app/i18n/hu/sub.php +++ b/app/i18n/hu/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Nincsen hírforrás kiválasztva.', 'number_entries' => '%d cikkek', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Láthatóság', 'archived' => 'Ne jelenjen meg (archivált)', diff --git a/app/i18n/id/sub.php b/app/i18n/id/sub.php index bb0a24fc0..b0b1a3c65 100644 --- a/app/i18n/id/sub.php +++ b/app/i18n/id/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'No feed selected.', // TODO 'number_entries' => '%d articles', // TODO 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibility', // TODO 'archived' => 'Do not show (archived)', // TODO diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php index 0ee8af3ba..1134b32df 100644 --- a/app/i18n/it/sub.php +++ b/app/i18n/it/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Nessun feed selezionato.', 'number_entries' => '%d articoli', 'open_feed' => 'Aprire il feed %s', - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibilità', 'archived' => 'Non mostrare (archiviato)', diff --git a/app/i18n/ja/sub.php b/app/i18n/ja/sub.php index 5a13934c9..052b8db2a 100644 --- a/app/i18n/ja/sub.php +++ b/app/i18n/ja/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'どのフィードも選択されていません', 'number_entries' => '%d 記事数', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => '表示する場所', 'archived' => '非表示にする(アーカイブ)', diff --git a/app/i18n/ko/sub.php b/app/i18n/ko/sub.php index bf8054ade..c5a783899 100644 --- a/app/i18n/ko/sub.php +++ b/app/i18n/ko/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => '선택된 피드가 없습니다.', 'number_entries' => '%d 개의 글', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => '표시', 'archived' => '표시하지 않음 (보관됨)', diff --git a/app/i18n/lv/sub.php b/app/i18n/lv/sub.php index bfeca7135..b708a235f 100644 --- a/app/i18n/lv/sub.php +++ b/app/i18n/lv/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Barotne nav izvēlēta.', 'number_entries' => '%d raksti', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Prioritāte', 'archived' => 'Nerādīt (arhivēts)', diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php index 639d628de..5fcc1fae2 100644 --- a/app/i18n/nl/sub.php +++ b/app/i18n/nl/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Geen feed geselecteerd.', 'number_entries' => '%d artikelen', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Zichtbaarheid', 'archived' => 'Niet weergeven (gearchiveerd)', diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.php index f4d33a83d..8a6ea4364 100644 --- a/app/i18n/oc/sub.php +++ b/app/i18n/oc/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Cap de flux pas seleccionat.', 'number_entries' => '%d articles', // IGNORE 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibilitat', 'archived' => 'Mostrar pas (archivat)', diff --git a/app/i18n/pl/sub.php b/app/i18n/pl/sub.php index 53875b8c8..6079cba5c 100644 --- a/app/i18n/pl/sub.php +++ b/app/i18n/pl/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Brak kanałów.', 'number_entries' => '%d wiadomości', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Widoczność', 'archived' => 'Nie pokazuj (zarchiwizowany)', diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php index 1d13a8d42..12ed38c64 100644 --- a/app/i18n/pt-br/sub.php +++ b/app/i18n/pt-br/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Nenhum feed selecionado.', 'number_entries' => '%d artigos', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Visibilidade', 'archived' => 'Não exibir (arquivado)', diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php index 21ed3a66d..5924b1a80 100644 --- a/app/i18n/ru/sub.php +++ b/app/i18n/ru/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Ленты не выбраны.', 'number_entries' => '%d статей', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Видимость', 'archived' => 'Не показывать (архивировано)', diff --git a/app/i18n/sk/sub.php b/app/i18n/sk/sub.php index 2bbb9d5fe..0efcb9cfd 100644 --- a/app/i18n/sk/sub.php +++ b/app/i18n/sk/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Nevybrali ste kanál.', 'number_entries' => 'Počet článkov: %d', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Viditeľnosť', 'archived' => 'Nezobrazovať (archivované)', diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php index 8822e43fe..7e7de6845 100644 --- a/app/i18n/tr/sub.php +++ b/app/i18n/tr/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => 'Hiçbir akış seçilmedi.', 'number_entries' => '%d makale', 'open_feed' => '%s akışını aç', - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => 'Görünürlük', 'archived' => 'Gösterme (arşivlenmiş)', diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php index ca27d722c..1517595ea 100644 --- a/app/i18n/zh-cn/sub.php +++ b/app/i18n/zh-cn/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => '未选择订阅源', 'number_entries' => '%d 篇文章', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => '可见性', 'archived' => '不显示(归档)', diff --git a/app/i18n/zh-tw/sub.php b/app/i18n/zh-tw/sub.php index 15f9a41eb..e4be46b17 100644 --- a/app/i18n/zh-tw/sub.php +++ b/app/i18n/zh-tw/sub.php @@ -202,7 +202,7 @@ return array( 'no_selected' => '未選擇訂閱源', 'number_entries' => '%d 篇文章', 'open_feed' => 'Open feed %s', // TODO - 'path_entries_condition' => 'Condition for content retrieval', // TODO + 'path_entries_conditions' => 'Conditions for content retrieval', // TODO 'priority' => array( '_' => '可見性', 'archived' => '不顯示(歸檔)', diff --git a/app/views/helpers/export/opml.phtml b/app/views/helpers/export/opml.phtml index eecfc5d23..c37d8c7c4 100644 --- a/app/views/helpers/export/opml.phtml +++ b/app/views/helpers/export/opml.phtml @@ -82,8 +82,19 @@ function feedsToOutlines(array $feeds, bool $excludeMutedFeeds = false): array { $outline['frss:cssFullContent'] = htmlspecialchars_decode($feed->pathEntries(), ENT_QUOTES); } + if (!empty($feed->attributeArray('path_entries_conditions'))) { + $conditions = ''; + foreach ($feed->attributeArray('path_entries_conditions') as $condition) { + if (is_string($condition)) { + $conditions .= $condition . "\n"; + } + } + $conditions = trim($conditions); + $outline['frss:cssFullContentConditions'] = $conditions; + } + if ($feed->attributeString('path_entries_filter') != '') { - $outline['frss:cssFullContentFilter'] = $feed->attributeString('path_entries_filter'); + $outline['frss:cssContentFilter'] = $feed->attributeString('path_entries_filter'); } $curl_params = $feed->attributeArray('curl_params'); diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index c73987e50..6275d5486 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -662,11 +662,11 @@
- +
-