@andreearadacina21 I disabled the FEEDZY_ALLOW_UNSAFE_HTML define and tried your code as suggested, with minor modifications. To identify the filter, I added “(unfiltered)” or “(filtered)” to the output:
function kdefd_summary_input( $description, $content, $feedURL ) {
//If you want to use the item content as the description. If not, then remove this line
//If feed don't have content meta, $content is already equal to $description
$description = $content;
if (strpos($feedURL, "my-trusted-feed-domain.de") !== false) {
$description = $description . " (unfiltered)";
} else {
//Remove the item HTML tags (as in the default hook) if not in the above list
$description = trim( strip_tags( $description ) ) . " (filtered) ";
}
//Remove hellip (as in the default hook)
//Keep in mind that it will be added later in the plugin render
$description = trim( chop( $description, '[…]' ) );
return $description;
}
In the source feed, there is a CDATA description section containing some HTML tags:
<item>
<guid>https://www.example.com/5540093</guid>
<link>https://www.example.com/5540093</link>
<pubDate>Wed, 21 Jun 2023 14:16:46 +0200</pubDate>
<title><![CDATA[ My Title as CDATA ]]></title>
<description><![CDATA[K?ln (ots) -
SOME LONG TEXT ....
<div class="pp-image" data-src="https://example.com/story_big/20bdf4d9-c4f2-4bf3-be90-3a766f048dd8/Foto1.jpg" data-caption="Foto 1">
<span class="pp-caption">Foto 1</span><br><img src="https://example.com/story_big/20bdf4d9-c4f2-4bf3-be90-3a766f048dd8/Foto1.jpg" alt="Foto 1"/></div>
<div class="pp-image" data-src="https://example.com/story_big/f3e2b762-4387-4d87-877e-7ecb8246db2a/Foto2.jpg" data-caption="Foto 2">
<span class="pp-caption">Foto 2</span><br><img src="https://example.com/story_big/f3e2b762-4387-4d87-877e-7ecb8246db2a/Foto2.jpg" alt="Foto 2"/></div>
<div class="pp-source">Quelle:<a >https://www.example.com/5540093</a></div>
]]></description></item>
In the Map-Content section, I configured the [#item_description] placeholder for the import into posts.
The resulting post contains the “(unfiltered)” text, so the filter is indeed executed. However, the <img src… tags are missing, only the <a href…> tags are there. :
Output in the Post:
<div class="pp-image"><span class="pp-caption">Foto 1</span></div>
<div class="pp-image"><span class="pp-caption">Foto 2</span></div>
<div class="pp-source">Quelle:<a href="valid-URL" rel="noopener">....</a></div>
(unfiltered)
So far, the only way to keep the <img src seems to be the FEEDZY_ALLOW_UNSAFE_HTML define …
Regards
Ulrich
-
This reply was modified 1 year, 4 months ago by ulicgn.
-
This reply was modified 1 year, 4 months ago by ulicgn.