A free, self-hostable news aggregator…
OPML export/import for cssFullContentConditions (#7082)
Alexandre Alapetiteab9a4e292cab
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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)', // TODOdiff --git a/app/i18n/en-us/sub.php b/app/i18n/en-us/sub.phpindex 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)', // IGNOREdiff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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)', // TODOdiff --git a/app/i18n/hu/sub.php b/app/i18n/hu/sub.phpindex 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.phpindex 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)', // TODOdiff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phtmlindex 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.phtmlindex c73987e50..6275d5486 100644--- a/app/views/helpers/feed/update.phtml+++ b/app/views/helpers/feed/update.phtml@@ -662,11 +662,11 @@</div><div class="form-group">- <label class="group-name" for="path_entries_condition"><?= _t('sub.feed.path_entries_condition') ?></label>+ <label class="group-name" for="path_entries_conditions"><?= _t('sub.feed.path_entries_conditions') ?></label><div class="group-controls">- <textarea class="w100" id="path_entries_condition" name="path_entries_condition"+ <textarea class="w100" id="path_entries_conditions" name="path_entries_conditions"rows="3" cols="64" spellcheck="false" placeholder="<?= _t('gen.short.blank_to_disable') ?>"><?php- foreach ($this->feed->attributeArray('path_entries_condition') ?? [] as $condition) {+ foreach ($this->feed->attributeArray('path_entries_conditions') ?? [] as $condition) {if (is_string($condition)) {echo htmlspecialchars($condition, ENT_NOQUOTES, 'UTF-8'), PHP_EOL;}diff --git a/docs/en/developers/OPML.md b/docs/en/developers/OPML.mdindex 811350ec7..c6b42f108 100644--- a/docs/en/developers/OPML.md+++ b/docs/en/developers/OPML.md@@ -91,8 +91,9 @@ A number of [cURL options](https://curl.se/libcurl/c/curl_easy_setopt.html) are* `frss:cssFullContent`: [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to enable the download and extraction of the matching HTML section of each articles’ Web address.* Example: `div.main, .summary`-* `frss:cssFullContentFilter`: [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to remove the matching HTML elements from the full content retrieved by `frss:cssFullContent`.+* `frss:cssContentFilter`: [CSS Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to remove the matching HTML elements from the article content or from the full content retrieved by `frss:cssFullContent`.* Example: `.footer, .aside`+. `frss:cssFullContentConditions`: List (separated by a new line) of search queries to trigger a full content retrieval as defined by `frss:cssFullContent`.* `frss:filtersActionRead`: List (separated by a new line) of search queries to automatically mark a new article as read.### Dynamic OPML (reading lists)diff --git a/docs/i18n/freshrss.fr.po b/docs/i18n/freshrss.fr.poindex ccfba8d9c..a9a8c8d57 100644--- a/docs/i18n/freshrss.fr.po+++ b/docs/i18n/freshrss.fr.po@@ -5215,7 +5215,7 @@ msgstr ""#. type: Bullet: '* '#: en/./developers/OPML.md:54msgid ""-"`frss:cssFullContentFilter`: [CSS Selector](https://developer.mozilla.org/en-"+"`frss:cssContentFilter`: [CSS Selector](https://developer.mozilla.org/en-""US/docs/Web/CSS/CSS_Selectors) to remove the matching HTML elements from the ""full content retrieved by `frss:cssFullContent`."msgstr ""diff --git a/docs/i18n/templates/freshrss.pot b/docs/i18n/templates/freshrss.potindex c09c26593..d53a6eee5 100644--- a/docs/i18n/templates/freshrss.pot+++ b/docs/i18n/templates/freshrss.pot@@ -4866,7 +4866,7 @@ msgstr ""#: en/./developers/OPML.md:54#, markdown-textmsgid ""-"`frss:cssFullContentFilter`: [CSS "+"`frss:cssContentFilter`: [CSS ""Selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) to ""remove the matching HTML elements from the full content retrieved by ""`frss:cssFullContent`."