diff --git a/wire/core/MarkupFieldtype.php b/wire/core/MarkupFieldtype.php index 23c85b3b..664c4648 100644 --- a/wire/core/MarkupFieldtype.php +++ b/wire/core/MarkupFieldtype.php @@ -127,7 +127,8 @@ class MarkupFieldtype extends WireData implements Module { } return $this->arrayToString($a, false); } else { - $value = $value->explode($property, array('getMethod' => 'getFormatted')); + $getMethod = strpos($property, '}') ? 'getText' : 'getFormatted'; + $value = $value->explode($property, array('getMethod' => $getMethod)); } $valid = true; diff --git a/wire/core/Sanitizer.php b/wire/core/Sanitizer.php index ed18f593..a0554af6 100644 --- a/wire/core/Sanitizer.php +++ b/wire/core/Sanitizer.php @@ -1970,13 +1970,19 @@ class Sanitizer extends Wire { if(strpos($value, '<') !== false) { // tag replacements before strip_tags() - $regex = - '!<(?:' . - '/?(?:ul|ol|p|h\d|div)(?:>|\s[^><]*)' . - '|' . - '(?:br[\s/]*)' . - ')>!is'; - $value = preg_replace($regex, $newline, $value); + if(stripos($value, '') || stripos($value, '')) { + $regex = '!<(?:/?(?:ul|ol)(?:>|\s[^><]*))>!i'; + $value = preg_replace($regex, '', $value); + } + if(stripos($value, '
') || stripos($value, '')) { + $regex = + '!<(?:' . + '/?(?:p|h\d|div)(?:>|\s[^><]*)' . + '|' . + '(?:br[\s/]*)' . + ')>!is'; + $value = preg_replace($regex, $newline, $value); + } if(stripos($value, '')) { $value = preg_replace('!\s*