Commit a01499d5 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4226 (Anomalous whitespace may throw off Comcode list tag)

parent 31799ec4
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -784,19 +784,19 @@ function _do_tags_comcode($tag, $attributes, $embed, $comcode_dangerous, $pass_i
                $tag = in_array($type, array('circle', 'disc', 'square')) ? 'ul' : 'ol';
                $temp_tpl->attach('<' . $tag . ' style="list-style-type: ' . $type . '">');
                foreach ($parts as $i => $part) {
                    if (($i == 0) && (str_replace(array('&nbsp;', '<br />', ' '), array('', '', ''), trim($part)) == '')) {
                    if (($i == 0) && (cms_trim($part, true) == '')) {
                        continue;
                    }
                    $temp_tpl->attach('<li>' . cms_preg_replace_safe('#\<br /\>(\&nbsp;|\s)*$#D', '', cms_preg_replace_safe('#^\<br /\>(\&nbsp;|\s)*#D', '', $part)) . '</li>');
                    $temp_tpl->attach('<li>' . cms_trim($part, true) . '</li>');
                }
                $temp_tpl->attach('</' . $tag . '>');
            } else {
                $temp_tpl->attach('<ul>');
                foreach ($parts as $i => $part) {
                    if (($i == 0) && (str_replace(array('&nbsp;', '<br />', ' '), array('', '', ''), trim($part)) == '')) {
                    if (($i == 0) && (cms($part, true) == '')) {
                        continue;
                    }
                    $temp_tpl->attach('<li>' . cms_preg_replace_safe('#\<br /\>(\&nbsp;|\s)*$#D', '', cms_preg_replace_safe('#^\<br /\>(\&nbsp;|\s)*#D', '', $part)) . '</li>');
                    $temp_tpl->attach('<li>' . cms_trim($part, true) . '</li>');
                }
                $temp_tpl->attach('</ul>');
            }