Hi! Just wanted to share a patch to fix vimeo new videos URL. Originally Giri expected vimeo URLs like this https://vimeo.com/VIDEO_ID_NUMBER/ But somehow vimeo now adds a hash at the end of their videos like this https://vimeo.com/VIDEO_ID_NUMBER/ALNUM_HASH so if you set the video URL like https://vimeo.com/VIDEO_ID_NUMBER/ALNUM_HASH (as vimeo generates now) the video is not displayed in the lesson in frontend.
Here's the patch to fix this
`
Subject: [PATCH] Cargar correctamente los url de vimeo
Cargar correctamente los url de vimeo
Cargar correctamente los url de vimeo
Index: components/com_guru/helpers/videos/vimeo.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/components/com_guru/helpers/videos/vimeo.php b/components/com_guru/helpers/videos/vimeo.php
--- a/components/com_guru/helpers/videos/vimeo.php (revision 72a6ea1bfa1142886f944fda72f45fb961dc4a95)
+++ b/components/com_guru/helpers/videos/vimeo.php (revision 6fefd0e19d36bef19931da72ca4ebc9ee5de2837)
@@ -92,15 +92,29 @@
$pattern = '/vimeo.com\/(hd#)?(channels\/[a-zA-Z0-9]#)?(\d)/';
preg_match($pattern, $this->url, $match);
if(!empty($match[3]))
{
return $match[3];
}
else
{
return !empty( $match[2] ) ? $match[2] : null;
}
if(!empty($match[3]))
{
return $match[3];
}
else
{
return !empty( $match[2] ) ? $match[2] : null;
}
}
/**
* Extract Vimeo video hash from the video url submitted by the user
*
* @access public
* @param video url
* @returns videohash
*/
public function getHash()
{
$pattern = '#vimeo.com/\d+/([a-zA-Z0-9]+)#';
preg_match($pattern, $this->url, $match);
+return isset($match[1]) ? '&h=' . $match[1] : '';
}/**
@@ -203,13 +217,15 @@
$videoId = $this->videoId;
}$videoHash = $this->getHash();
+
$embedCode = '
<iframe
width="'.$videoWidth.'"
height="'.$videoHeight.'"
class="youtube-player"
type="text/html"src="'.CVideosHelper::getIURL('http://player.vimeo.com/video/' . $videoId ).'"
src="'.CVideosHelper::getIURL('https://player.vimeo.com/video/' . $videoId . $videoHash ).'"
frameborder="0"
webkitAllowFullScreen mozallowfullscreen
allowFullScreen
`