diff --git a/api/app/Http/Controllers/NewsController.php b/api/app/Http/Controllers/NewsController.php index 685c061..ee9abdf 100644 --- a/api/app/Http/Controllers/NewsController.php +++ b/api/app/Http/Controllers/NewsController.php @@ -437,8 +437,8 @@ QUERY $authors[] = $author->name; } $item->author = implode(', ', $authors); - } else if(isset($block->text)) { - $text .= '
' . $block->text . '
'; + } else if(isset($block->text) && $block->type != 'info') { + $text .= strip_tags($block->text); } } } else { @@ -446,19 +446,25 @@ QUERY } } $result[] = [ - 'title' => $item->title, + 'title' => $this->nlpo_convert_utf8($item->title), 'url' => 'https://nhgooi.nl/' . $item->url, - 'text' => $text, + 'text' => $this->nlpo_convert_utf8($text), 'date' => $item->published->format('Y-m-d\TH:i:s.z\Z'), 'art_id' => $item->id, 'author' => $item->author, - 'excerpt' => strip_tags($item->content), + 'excerpt' => $this->nlpo_convert_utf8(strip_tags($item->content)), 'categories' => $tags, 'tags' => $tags, 'comment_count' => 0 ]; } - return response()->json($result); + header('Content-Type: application/json; charset=utf-8'); + return json_encode($result, JSON_UNESCAPED_UNICODE); + } + + private function nlpo_convert_utf8($str) { + $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8'); + return $str; } private function itemFromCategory($category, $id) {