Skip to content

Instantly share code, notes, and snippets.

@RaymondBenc
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaymondBenc/65d072b7de56ef3b2c4c to your computer and use it in GitHub Desktop.
Save RaymondBenc/65d072b7de56ef3b2c4c to your computer and use it in GitHub Desktop.
YouTube Device Support fix for PHPfox v3
# file: /module/video/include/service/grab.class.php
# Look for:
if (strpos($sUrl, 'youtube') || (preg_match('/http:\/\/youtu\.be\/(.*)/i', $sUrl, $aMatches) && isset($aMatches[1])))
{
$this->_aRegex = false;
$this->_aSites = $this->_aSiteCache;
if (isset($aMatches) && $aMatches[1])
{
$sUrl = 'http://www.youtube.com/watch?v=' . $aMatches[1];
}
}
# Replace with:
if (strpos($sUrl, 'youtube') || (preg_match('/(http|https):\/\/youtu\.be\/(.*)/i', $sUrl, $aMatches) && isset($aMatches[2])))
{
// $this->_aRegex = false;
$this->_aSites = $this->_aSiteCache;
if (isset($aMatches) && $aMatches[2])
{
$sUrl = 'http://www.youtube.com/watch?v=' . $aMatches[2];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment