Compare commits
5 Commits
92c66e4ed9
...
5e3604da33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e3604da33 | ||
|
|
aec6690c9e | ||
|
|
3e7490531d | ||
|
|
c7243f31a0 | ||
|
|
2e1f496eea |
@@ -120,8 +120,9 @@ class Controller extends BaseController
|
||||
. 'X-User-Agent: ' . request()->server('HTTP_USER_AGENT') . "\r\n"
|
||||
]
|
||||
];
|
||||
|
||||
return json_decode(file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions)));
|
||||
//\dump($http_response_header);
|
||||
$result = @file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions));
|
||||
return $result ? json_decode($result) : null;
|
||||
}
|
||||
|
||||
protected function checkAPI($url)
|
||||
|
||||
@@ -16,28 +16,34 @@ class NewsController extends Controller
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
parent::registerView($request, 'nieuws', $id);
|
||||
$apiResult = $this->API('nieuws/bericht/' . $id);
|
||||
parent::registerView($request, 'nieuws', $id);
|
||||
$preview = "";
|
||||
if(request()->get('preview', null) != null) {
|
||||
$preview = "?preview=" . request()->get('preview');
|
||||
}
|
||||
$apiResult = $this->API('nieuws/bericht/' . $id . $preview);
|
||||
$newsItem = new \Model\NewsItem($apiResult->news);
|
||||
|
||||
switch ($apiResult->version) {
|
||||
case 1:
|
||||
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
|
||||
return view('newsitem', ['news' => $newsItem, 'metadata' => $newsItem->metadata]);
|
||||
break;
|
||||
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
|
||||
|
||||
case 2:
|
||||
case 2:
|
||||
if(isset($apiResult->source->article)) {
|
||||
$source = $apiResult->source->article;
|
||||
$newsItem->published = self::TimestampToDateTime($source->created);
|
||||
$newsItem->edited = self::TimestampToDateTime($source->updated);
|
||||
$newsItem->author = $source->author;
|
||||
$newsItem->images = null; // Images will be embedded
|
||||
$newsItem->video = null; // Videos will be embedded
|
||||
$newsItem->content = $source->blocks;
|
||||
$newsItem->content = $source->blocks;
|
||||
} elseif(isset($apiResult->source->blocks)) {
|
||||
$newsItem->content = $apiResult->source->blocks;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return view('newsitem', array_merge($this->getSidebareData(), ['news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
|
||||
return view('newsitem', array_merge($this->getSidebareData(), ['type' => $apiResult->type, 'news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ class RadioController extends Controller
|
||||
|
||||
public function program($id)
|
||||
{
|
||||
$apiResult = $this->API('programma/details/' . (int)$id);
|
||||
$apiResult = $this->API('programma/details/' . (int)$id);
|
||||
if($apiResult == null) {
|
||||
return abort(404);
|
||||
}
|
||||
return view('radioprogram', ['program' => new \Model\Program($apiResult)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,10 @@
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if(is_array($news->content))
|
||||
@include('partial/nh_story', ['content' => $news->content])
|
||||
@if($type == "nhnieuws")
|
||||
@include('partial/nh_story', ['content' => $news->content])
|
||||
@elseif($type == "artikel")
|
||||
@include('partial/block_story', ['content' => $news->content])
|
||||
@else
|
||||
<div class="text">
|
||||
<p>{!!$news->content!!}</p>
|
||||
|
||||
161
resources/views/partial/block_story.blade.php
Normal file
161
resources/views/partial/block_story.blade.php
Normal file
@@ -0,0 +1,161 @@
|
||||
@foreach($content as $block)
|
||||
@if($block->type == "headerRichA")
|
||||
@php($block->data->image->url = isset($block->data->image->crops)
|
||||
? $block->data->image->crops->{'16:9'}->{'1600'}
|
||||
: $block->data->image->crop)
|
||||
<a href="{{$block->data->image->url}}" class="post_image page_margin_top prettyPhoto" rel="prettyPhoto"
|
||||
title="{{$block->data->image->title}}">
|
||||
<img src="{{$block->data->image->url}}" alt="{{$block->data->image->title}}">
|
||||
</a>
|
||||
<div class="sentence margin_top_10">
|
||||
<span class="text">{{$block->data->image->title}}</span>
|
||||
@if($block->data->image->author)
|
||||
<span class="author">{{$block->data->image->author}}</span>
|
||||
@endif
|
||||
</div>
|
||||
@elseif($block->type == "paragraph")
|
||||
<div class="text">{!!$block->data->text!!}</div>
|
||||
@elseif($block->type == "intro")
|
||||
<h3 class="excerpt">{!!strip_tags($block->data->text)!!}</h3>
|
||||
@elseif($block->type == "info")
|
||||
@if(strpos($block->data->text, "Meer nieuws uit 't Gooi?") === false)
|
||||
<div class="info" style="background-color: {{$block->data->color}};">{!!($block->data->text)!!}</div>
|
||||
@endif
|
||||
@elseif($block->type == "quote")
|
||||
<blockquote>
|
||||
{!!$block->data->text!!}
|
||||
<div class="author">{{$block->data->caption}}</div>
|
||||
</blockquote>
|
||||
@elseif($block->type == "image")
|
||||
<?php
|
||||
if(isset($block->data->image->imageWide))
|
||||
$image = $block->data->image->imageWide;
|
||||
else if(isset($block->data->image->crop))
|
||||
$image = $block->data->image->crop;
|
||||
else if(isset($block->data->image->crops) && isset($block->data->image->crops->{'16:9'}))
|
||||
foreach($block->data->image->crops->{'16:9'} as $image) break;
|
||||
else if(isset($block->data->image->imageHigh))
|
||||
$image = $block->data->image->imageHigh;
|
||||
else $image = null;
|
||||
?>
|
||||
@if($image)
|
||||
<a class="post_image page_margin_top prettyPhoto" rel="prettyPhoto" href="{{$image}}"
|
||||
title="{{$block->data->image->title}} © {{$block->data->image->author}}">
|
||||
<img src="{{$image}}" class="attachment-small-slider-thumb size-small-slider-thumb wp-post-image"
|
||||
alt="{{$block->data->image->title}}" title="" style="display: block;">
|
||||
</a>
|
||||
<div class="sentence">
|
||||
<?php
|
||||
$sentence = [];
|
||||
if (isset($block->data->image->caption) && $block->data->image->caption) {
|
||||
$sentence[] = '<span class="text">' . $block->data->image->caption . '</span>';
|
||||
} elseif (isset($block->data->image->title) && $block->data->image->title) {
|
||||
$sentence[] = '<span class="text">' . $block->data->image->title . '</span>';
|
||||
}
|
||||
if (isset($block->data->image->author) && $block->data->image->author) {
|
||||
$sentence[] = '<span class="author">' . $block->data->image->author . '</span>';
|
||||
}
|
||||
$sentence = join('<span class="separator">|</span>', $sentence);
|
||||
?>
|
||||
{!!$sentence!!}
|
||||
</div>
|
||||
@endif
|
||||
@elseif($block->type == "video" || $block->type == "headerVideo")
|
||||
@include('widgets/mediaplayer')
|
||||
<?php
|
||||
$attr = '';
|
||||
if (isset($block->data->video->images[0]->imageMedia) && $block->data->video->images[0]->imageMedia) {
|
||||
$attr = ' poster="' . $block->data->video->images[0]->imageMedia . '"';
|
||||
}
|
||||
?>
|
||||
<video controls{!!$attr!!}>
|
||||
@foreach($block->data->video->streams as $stream)
|
||||
<source src="{!!$stream->stream_url!!}" type="application/x-mpegurl" />
|
||||
@endforeach
|
||||
</video>
|
||||
<div class="sentence">
|
||||
<span class="author">{{$block->data->video->author}}</span>
|
||||
</div>
|
||||
@elseif($block->type == "carousel")
|
||||
<div class="horizontal_carousel_container gallery">
|
||||
<ul class="horizontal_carousel visible-5 autoplay-1 scroll-1 navigation-1 easing-easeInOutQuint duration-750">
|
||||
@foreach($block->data->items as $image)
|
||||
<?php
|
||||
if(isset($image->image->imageWide))
|
||||
$img = $image->image->imageWide;
|
||||
else if(isset($block->data->image->crop))
|
||||
$image = $block->data->image->crop;
|
||||
else if(isset($image->image->crops) && isset($image->image->crops->{'16:9'}))
|
||||
foreach($image->image->crops->{'16:9'} as $img) break;
|
||||
else if(isset($image->image->imageHigh))
|
||||
$img = $image->image->imageHigh;
|
||||
else $img = null;
|
||||
?>
|
||||
@if($img)
|
||||
<li>
|
||||
<a href="{{$img}}" class="post_image prettyPhoto" rel="prettyPhoto[gallery]"
|
||||
title="{{$image->image->title}} © {{$image->image->author}}">
|
||||
<img src="{{$img}}" alt="{{$image->image->title}}" title="{{$image->image->title}}">
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@elseif($block->type == "oembed")
|
||||
<div class="oembed" data-url="{{$block->data->url}}">{!!$block->data->html!!}</div>
|
||||
@elseif($block->type == "podcast" && $block->data->id == $news->podcast?->id)
|
||||
@include('widgets/podcastplayer', ['podcast' => $news->podcast])
|
||||
<? $news->podcast = null; // Avoid adding the player again ?>
|
||||
@elseif($block->type == 'article' && count($block->data->articles) && $block->data->articles[0]->published)
|
||||
<div class="block">
|
||||
<h4 class="box_header"><span>{{ $block->data->title }}</span></h4>
|
||||
<div class="box full-width">
|
||||
<ul id="items-more-news" class="blog">
|
||||
@foreach($block->data->articles as $article)
|
||||
<? if(!isset($article->published)) continue;
|
||||
$article->published = new \DateTime($article->published); ?>
|
||||
<li class="post">
|
||||
<div class="row">
|
||||
@if($article->image)
|
||||
<div class="col-4">
|
||||
<a href="{{ route('nieuws.detail', ['id' => $article->id, 'title' => $article->slug]) }}"
|
||||
title="{{ $article->title }}">
|
||||
<img src="{{ $article->image[0] == '/' ? '' : '/' }}{{ $article->image }}" alt="{{ $article->image_title }}">
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
<div class="col-8">
|
||||
<h2 class="post_title"><a class="clipText clipText-3"
|
||||
href="{{ route('nieuws.detail', ['id' => $article->id, 'title' => $article->slug]) }}"
|
||||
title="{!! $article->title !!}">{!! $article->title !!}</a></h2>
|
||||
<span class="post_date" title="Vandaag om 09:30">
|
||||
<i class="fa-regular fa-clock"></i>
|
||||
{{Formatter::relativeDate($article->published)}} om {{$article->published->format('H:i')}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@elseif($block->type == 'iframe')
|
||||
<iframe src="{{ $block->data->url }}" class="article-iframe" id="{{ $id = uniqid('iframe_') }}"></iframe>
|
||||
<style>
|
||||
@if(isset($block->data->ratio))
|
||||
#{{ $id }}.article-iframe {
|
||||
aspect-ratio: {{ str_replace(":", "/", $block->data->ratio) }};
|
||||
}
|
||||
@endif
|
||||
|
||||
@if(isset($block->data->ratioMobile))
|
||||
@media (max-width: 768px) {
|
||||
#{{ $id }}.article-iframe {
|
||||
aspect-ratio: {{ str_replace(":", "/", $block->data->ratioMobile) }};
|
||||
}
|
||||
}
|
||||
@endif
|
||||
</style>
|
||||
@endif
|
||||
@endforeach
|
||||
Reference in New Issue
Block a user