mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
#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
This commit is contained in:
parent
ef682e54c8
commit
af8d7a1802
@ -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 .= "</{$tagName[1]}>";
|
||||
if(sizeof($tagName) > 0) {
|
||||
if(!in_array($tagName[1], $noClose)) {
|
||||
$summary .= "</{$tagName[1]}>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $summary;
|
||||
|
Loading…
x
Reference in New Issue
Block a user