diff --git a/lib/XRay/Formats/Mf2.php b/lib/XRay/Formats/Mf2.php index fa3e42a..7c41e22 100644 --- a/lib/XRay/Formats/Mf2.php +++ b/lib/XRay/Formats/Mf2.php @@ -527,30 +527,9 @@ class Mf2 extends Format { self::collectArrayURLValues(['photo','video','audio','syndication'], $item, $data, $refs, $http); // If there is a description, always return the plaintext description, and return HTML description if it's different - $textDescription = null; - $htmlDescription = null; - if(array_key_exists('description', $item['properties'])) { - $description = $item['properties']['description'][0]; - if(is_string($description)) { - $textDescription = $description; - } elseif(!is_string($description) && is_array($description) && array_key_exists('value', $description)) { - if(array_key_exists('html', $description)) { - $htmlDescription = trim(self::sanitizeHTML($description['html'])); - $textDescription = trim(str_replace(" ","\r",strip_tags($htmlDescription))); - $textDescription = trim(str_replace(" ","\r",$description['value'])); - } else { - $textDescription = trim($description['value']); - } - } - } - - if($textDescription) { - $data['description'] = [ - 'text' => $textDescription - ]; - if($htmlDescription && $textDescription != $htmlDescription) { - $data['description']['html'] = $htmlDescription; - } + $description = self::parseHTMLValue('description', $item); + if($description) { + $data['description'] = $description; } $response = [