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
3 changed files with 13 additions and 14 deletions

View File

@@ -437,8 +437,8 @@ QUERY
$authors[] = $author->name;
}
$item->author = implode(', ', $authors);
} else if(isset($block->text)) {
$text .= '<div class="' . $block->type . '">' . $block->text . '</div>';
} 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) {

View File

@@ -15,7 +15,6 @@ class CalendarEvent extends Model {
public $keywords;
public $url;
public $metadata;
public $tags;
public function __construct($data, $images = null, $podcast = null) {
parent::__construct($data);

View File

@@ -19,12 +19,11 @@ class NewsItem extends Model {
public $category;
public $theme;
public $region;
public $tags;
public $podcast;
public $images;
public $video;
public $url;
public $metadata;
@@ -80,11 +79,6 @@ class NewsItem extends Model {
}
}
if(isset($data->tags)) {
foreach($data->tags as $tag) {
$this->theme = new \Model\NewsRegion($tag->titel, $tag->slug);
}
}
$images = ($images != null) ? $images
: (isset($data->images) ? $data->images : null);