A free, self-hostable news aggregator…
Add a content action parameter to work with CSS selector (#3453)
Alexis Degrugillierfe1fba9828ad
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.phpindex 7435f70b2..1cff6ff56 100644--- a/app/Controllers/subscriptionController.php+++ b/app/Controllers/subscriptionController.php@@ -125,6 +125,8 @@ class FreshRSS_subscription_Controller extends Minz_ActionController {}$feed->_attributes('curl_params', empty($opts) ? null : $opts);+ $feed->_attributes('content_action', Minz_Request::param('content_action', 'replace'));+if (FreshRSS_Auth::hasAccess('admin')) {$feed->_attributes('ssl_verify', Minz_Request::paramTernary('ssl_verify'));$timeout = intval(Minz_Request::param('timeout', 0));diff --git a/app/Models/Entry.php b/app/Models/Entry.phpindex 784576455..13c32b7a6 100644--- a/app/Models/Entry.php+++ b/app/Models/Entry.php@@ -446,8 +446,20 @@ class FreshRSS_Entry extends Minz_Model {$feed->pathEntries(),$feed->attributes());- if ($fullContent != '') {- $this->content = $fullContent;+ if ('' !== $fullContent) {+ switch ($feed->attributes('content_action')) {+ case 'prepend':+ $this->content = $fullContent . $this->content();+ break;+ case 'append':+ $this->content = $this->content() . $fullContent;+ break;+ case 'replace':+ default:+ $this->content = $fullContent;+ break;+ }+return true;}} catch (Exception $e) {diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.phpindex c0926ebba..9e933f60d 100644--- a/app/i18n/cz/sub.php+++ b/app/i18n/cz/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Přihlašovací jméno',),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Stáhne zkrácenou verzi RSS kanálů (pozor, náročnější na čas!)',diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.phpindex 99373d2c5..2e21a8f2c 100644--- a/app/i18n/de/sub.php+++ b/app/i18n/de/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP-Nutzername',),'clear_cache' => 'Nicht cachen (für defekte Feeds)',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Verwende Cookies beim Herunterladen des Feed-Inhalts mit CSS-Filtern','css_cookie_help' => 'Beispiel: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>','css_help' => 'Ruft bei gekürzten RSS-Feeds den vollständigen Artikelinhalt ab (Achtung, benötigt mehr Zeit!)',diff --git a/app/i18n/en-us/sub.php b/app/i18n/en-us/sub.phpindex 644da1c62..0aa3f7f4c 100644--- a/app/i18n/en-us/sub.php+++ b/app/i18n/en-us/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP username',),'clear_cache' => 'Always clear cache',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content',+ 'append' => 'Add after existing content',+ 'prepend' => 'Add before existing content',+ 'replace' => 'Replace existing content',+ ),'css_cookie' => 'Use Cookies when fetching the article content','css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>','css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.phpindex 590ad0a63..2335addf6 100644--- a/app/i18n/en/sub.php+++ b/app/i18n/en/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP username',),'clear_cache' => 'Always clear cache',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content',+ 'append' => 'Add after existing content',+ 'prepend' => 'Add before existing content',+ 'replace' => 'Replace existing content',+ ),'css_cookie' => 'Use Cookies when fetching the article content','css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>','css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)',diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.phpindex e89e70184..32376be75 100755--- a/app/i18n/es/sub.php+++ b/app/i18n/es/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Nombre de usuario HTTP',),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Recibir fuentes RSS truncadas (aviso, ¡necesita más tiempo!)',diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.phpindex 18d35ed54..495c4c086 100644--- a/app/i18n/fr/sub.php+++ b/app/i18n/fr/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Identifiant HTTP',),'clear_cache' => 'Toujours vider le cache',+ 'content_action' => array(+ '_' => 'Action à effectuer pour la réception du contenu des articles',+ 'append' => 'Ajouter après le contenu existant',+ 'prepend' => 'Ajouter avant le contenu existant',+ 'replace' => 'Remplacer le contenu existant',+ ),'css_cookie' => 'Utiliser des cookies pour la réception du contenu des articles','css_cookie_help' => 'Exemple : <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>','css_help' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)',diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.phpindex 33c511a11..3bb576952 100644--- a/app/i18n/he/sub.php+++ b/app/i18n/he/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP שם משתמש',),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'קבלת הזנות RSS קטומות (זהירות, לוקח זמן רב יותר!)',diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.phpindex c22c912e6..9c2fd1b08 100644--- a/app/i18n/it/sub.php+++ b/app/i18n/it/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP username', // TODO - Translation),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'In caso di RSS feeds troncati (attenzione, richiede molto tempo!)',diff --git a/app/i18n/kr/sub.php b/app/i18n/kr/sub.phpindex 4a6023630..a953808d7 100644--- a/app/i18n/kr/sub.php+++ b/app/i18n/kr/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP 사용자 이름',),'clear_cache' => '항상 캐시 지우기',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => '글의 일부가 포함된 RSS 피드를 가져옵니다 (주의, 시간이 좀 더 걸립니다!)',diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.phpindex 88ee4c98b..0eea491d9 100644--- a/app/i18n/nl/sub.php+++ b/app/i18n/nl/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP gebruikers naam',),'clear_cache' => 'Cache altijd leegmaken',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Haalt onvolledige RSS-feeds op (attentie, heeft meer tijd nodig!)',diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.phpindex 39cf09a7e..9b70bdac2 100644--- a/app/i18n/oc/sub.php+++ b/app/i18n/oc/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Identificant HTTP',),'clear_cache' => 'Totjorn escafar lo cache',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Permet de recuperar los fluxes troncats (atencion, demanda mai de temps !)',diff --git a/app/i18n/pl/sub.php b/app/i18n/pl/sub.phpindex b6dab5203..b1e93f1e8 100644--- a/app/i18n/pl/sub.php+++ b/app/i18n/pl/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Użytkownik HTTP',),'clear_cache' => 'Zawsze czyść pamięć podręczną',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Pozwala na ograniczenie zawartości kanałów (uwaga, wymaga więcej czasu!)',diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.phpindex 25fef4a94..2fd0138ed 100644--- a/app/i18n/pt-br/sub.php+++ b/app/i18n/pt-br/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Usuário HTTP',),'clear_cache' => 'Sempre limpar o cache',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Retorna RSS feeds truncados (atenção, requer mais tempo!)',diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.phpindex 8f4a8f0ca..cd18f56de 100644--- a/app/i18n/ru/sub.php+++ b/app/i18n/ru/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP username', // TODO - Translation),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Retrieves truncated RSS feeds (caution, requires more time!)', // TODO - Translationdiff --git a/app/i18n/sk/sub.php b/app/i18n/sk/sub.phpindex 5c97ef174..b60d16400 100644--- a/app/i18n/sk/sub.php+++ b/app/i18n/sk/sub.php@@ -33,6 +33,12 @@ return array('username' => 'Používateľské meno pre HTTP',),'clear_cache' => 'Vždy vymazať vyrovnávaciu pamäť',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Stiahnuť skrátenú verziu RSS kanála (pozor, vyžaduje viac času!)',diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.phpindex 5f07de552..83ea31fb2 100644--- a/app/i18n/tr/sub.php+++ b/app/i18n/tr/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP kullanıcı adı',),'clear_cache' => 'Always clear cache', // TODO - Translation+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => 'Dikkat, daha çok zaman gerekir!',diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.phpindex 0fdc9cbca..29160bf88 100644--- a/app/i18n/zh-cn/sub.php+++ b/app/i18n/zh-cn/sub.php@@ -33,6 +33,12 @@ return array('username' => 'HTTP 用户名',),'clear_cache' => '总是清除缓存',+ 'content_action' => array(+ '_' => 'Content action when fetching the article content', // TODO - Translation+ 'append' => 'Add after existing content', // TODO - Translation+ 'prepend' => 'Add before existing content', // TODO - Translation+ 'replace' => 'Replace existing content', // TODO - Translation+ ),'css_cookie' => 'Use Cookies when fetching the article content', // TODO - Translation'css_cookie_help' => 'Example: <kbd>foo=bar; gdpr_consent=true; cookie=value</kbd>', // TODO - Translation'css_help' => '用于获取全文(注意,这将耗费更多时间!)',diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtmlindex 184d78114..361f94ab8 100644--- a/app/views/helpers/feed/update.phtml+++ b/app/views/helpers/feed/update.phtml@@ -299,6 +299,17 @@</div></div>+ <div class="form-group">+ <label class="group-name" for="content_action"><?= _t('sub.feed.content_action') ?></label>+ <div class="group-controls">+ <select name="content_action" id="content_action">+ <option value="replace"<?= 'replace' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.replace') ?></option>+ <option value="prepend"<?= 'prepend' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.prepend') ?></option>+ <option value="append"<?= 'append' === $this->feed->attributes('content_action') ? ' selected="selected"' : '' ?>><?= _t('sub.feed.content_action.append') ?></option>+ </select>+ </div>+ </div>+<div class="form-group"><label class="group-name" for="path_entries"><?= _t('sub.feed.proxy') ?></label><div class="group-controls">diff --git a/cli/i18n/ignore/en-us.php b/cli/i18n/ignore/en-us.phpindex 889d90e8c..fad9a4aaa 100644--- a/cli/i18n/ignore/en-us.php+++ b/cli/i18n/ignore/en-us.php@@ -712,6 +712,10 @@ return array('sub.feed.auth.password','sub.feed.auth.username','sub.feed.clear_cache',+ 'sub.feed.content_action._',+ 'sub.feed.content_action.append',+ 'sub.feed.content_action.prepend',+ 'sub.feed.content_action.replace','sub.feed.css_cookie','sub.feed.css_cookie_help','sub.feed.css_help',