From fa403733954f809286936d2ad3e39d3ab5395c26 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Nov 2010 15:54:30 +0300 Subject: use dom to generate linebreaks after images in articles --- functions.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 126ad27c6..f94da9525 100644 --- a/functions.php +++ b/functions.php @@ -3751,8 +3751,18 @@ rewrite_relative_url($site_url, $entry->getAttribute('src'))); } - if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW', $owner)) { - $entry->setAttribute("target", "_blank"); + if (strtolower($entry->nodeName) == "a") { + if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW', $owner)) { + $entry->setAttribute("target", "_blank"); + } + } + + if (strtolower($entry->nodeName) == "img") { + $br = $doc->createElement("br"); + + if ($entry->parentNode->nextSibling) + $entry->parentNode->insertBefore($br, $entry->nextSibling); + } } -- cgit v1.2.3