Compare commits

1 Commits

Author SHA1 Message Date
NH Gooi
abc9914827 NLPO API endpoint zonder HTML encoding 2024-07-12 11:42:01 +02:00

View File

@@ -437,8 +437,8 @@ QUERY
$authors[] = $author->name; $authors[] = $author->name;
} }
$item->author = implode(', ', $authors); $item->author = implode(', ', $authors);
} else if(isset($block->text)) { } else if(isset($block->text) && $block->type != 'info') {
$text .= '<div class="' . $block->type . '">' . $block->text . '</div>'; $text .= strip_tags($block->text);
} }
} }
} else { } else {
@@ -446,19 +446,25 @@ QUERY
} }
} }
$result[] = [ $result[] = [
'title' => $item->title, 'title' => $this->nlpo_convert_utf8($item->title),
'url' => 'https://nhgooi.nl/' . $item->url, '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'), 'date' => $item->published->format('Y-m-d\TH:i:s.z\Z'),
'art_id' => $item->id, 'art_id' => $item->id,
'author' => $item->author, 'author' => $item->author,
'excerpt' => strip_tags($item->content), 'excerpt' => $this->nlpo_convert_utf8(strip_tags($item->content)),
'categories' => $tags, 'categories' => $tags,
'tags' => $tags, 'tags' => $tags,
'comment_count' => 0 '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) { private function itemFromCategory($category, $id) {