From af8d7a180219d02c401af7cfafd9ffc92364a857 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 10 Jan 2008 03:58:14 +0000 Subject: [PATCH] #2003: Don't close img and br tags on HTMLText.Summary git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47836 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/fieldtypes/HTMLText.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/model/fieldtypes/HTMLText.php b/core/model/fieldtypes/HTMLText.php index 93f089366..80483fb3f 100755 --- a/core/model/fieldtypes/HTMLText.php +++ b/core/model/fieldtypes/HTMLText.php @@ -55,13 +55,17 @@ class HTMLText extends Text { $summary .= $parts[$pIndex++] . ' '; } - + // Tags that shouldn't be closed + $noClose = array("br", "img"); // make sure that the summary is well formed XHTML by closing tags while( $openTag = array_pop( $tagStack ) ) { preg_match( '/^<(\w+)\s+/', $openTag, $tagName ); - if(sizeof($tagName) > 0) - $summary .= ""; + if(sizeof($tagName) > 0) { + if(!in_array($tagName[1], $noClose)) { + $summary .= ""; + } + } } return $summary;