mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-07 03:52:41 +00:00
Fix tag order when closing open tags with TextHelper::truncate()
This commit is contained in:
parent
4e7e06fa9f
commit
acca796d10
2 changed files with 10 additions and 4 deletions
|
@ -129,7 +129,7 @@ Steve/era/distinto/elpepueconeg/20111009elpneglse_4/Tes</a></span></p>
|
|||
Steve Jobs escrita por Walter Isaacson "<strong>Steve Jobs by Walter
|
||||
Isaacson</strong>", aquí os dejamos la dirección de amazon donde
|
||||
podeís adquirirla.</span></p>
|
||||
<p><span style="font-size: medium;"><a>... </p></span></a>';
|
||||
<p><span style="font-size: medium;"><a>... </a></span></p>';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
|
|
|
@ -287,11 +287,17 @@ class TextHelper extends AppHelper {
|
|||
$bits = mb_substr($truncate, $spacepos);
|
||||
preg_match_all('/<\/([a-z]+)>/', $bits, $droppedTags, PREG_SET_ORDER);
|
||||
if (!empty($droppedTags)) {
|
||||
if (!empty($openTags)) {
|
||||
foreach ($droppedTags as $closingTag) {
|
||||
if (!in_array($closingTag[1], $openTags)) {
|
||||
array_unshift($openTags, $closingTag[1]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($droppedTags as $closingTag) {
|
||||
array_push($openTags, $closingTag[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$truncate = mb_substr($truncate, 0, $spacepos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue