From bfd61d3f85d9b2554a016e4c2f711a1285ff8818 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 19 Mar 2013 22:41:10 +0400 Subject: rework STRIP_IMAGES to remove embedding; add per-feed control over embedded images (bump schema) --- include/functions.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index affd4d4dc..1feedcbf0 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,6 +1,6 @@ ]+>/is', '', $res); - } - if (strpos($res, "href=") === false) $res = rewrite_urls($res); @@ -2605,6 +2603,23 @@ $entry->setAttribute('src', $src); } + + if ($entry->nodeName == 'img') { + if (get_pref($link, "STRIP_IMAGES", $owner) || $force_remove_images) { + + $p = $doc->createElement('p'); + + $a = $doc->createElement('a'); + $a->setAttribute('href', $entry->getAttribute('src')); + + $a->appendChild(new DOMText($entry->getAttribute('src'))); + $a->setAttribute('target', '_blank'); + + $p->appendChild($a); + + $entry->parentNode->replaceChild($p, $entry); + } + } } if (strtolower($entry->nodeName) == "a") { -- cgit v1.2.3