Skip to content
Snippets Groups Projects
Commit cbc6a1a5 authored by Kevin von Spiczak's avatar Kevin von Spiczak
Browse files

[BUGFIX] fix Invalid argument supplied for foreach()

parent ba36f365
No related branches found
No related tags found
No related merge requests found
......@@ -54,16 +54,18 @@ class VimeoController extends ActionController {
return;
}
foreach ($response['items'] as &$item) {
/*
* Check if link is of the form "https://vimeo.com/123456789", not "https://vimeo.com/username/videoname".
* Just checks if the end of `link` is the same as `videoId`, and if not, it replaces `link`.
* This is needed as a workaround so that glightbox can detect the video as a vimeo video correctly in the frontend.
*/
$endOfLink = substr($item['link'], -strlen($item['videoId']));
if (!((int) $endOfLink === $item['videoId'])) {
$item['link'] = strstr($item['link'], '.com/', true) . '.com/' . $item['videoId'];
if (is_array($response['items'])) {
foreach ($response['items'] as &$item) {
/*
* Check if link is of the form "https://vimeo.com/123456789", not "https://vimeo.com/username/videoname".
* Just checks if the end of `link` is the same as `videoId`, and if not, it replaces `link`.
* This is needed as a workaround so that glightbox can detect the video as a vimeo video correctly in the frontend.
*/
$endOfLink = substr($item['link'], -strlen($item['videoId']));
if (!((int) $endOfLink === $item['videoId'])) {
$item['link'] = strstr($item['link'], '.com/', TRUE) . '.com/' . $item['videoId'];
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment