public static
displayVideo
(mixed $videoCode, mixed $view = 0, mixed $ywidth = 0, mixed $yheight = 0)
public static function displayVideo($videoCode, $view = 0, $ywidth = 0, $yheight = 0)
{
$o = '';
if ($videoCode != '' && PhocaGalleryUtils::isURLAddress($videoCode)) {
$pos1 = strpos($videoCode, 'https');
if ($pos1 !== false) {
$shortvideoCode = 'https://youtu.be/';
} else {
$shortvideoCode = 'http://youtu.be/';
}
$pos = strpos($videoCode, $shortvideoCode);
if ($pos !== false) {
$code = str_replace($shortvideoCode, '', $videoCode);
} else {
$codeArray = explode('=', $videoCode);
$code = str_replace($codeArray[0] . '=', '', $videoCode);
}
$youtubeheight = PhocaGallerySettings::getAdvancedSettings('youtubeheight');
$youtubewidth = PhocaGallerySettings::getAdvancedSettings('youtubewidth');
if ((int) $ywidth > 0) {
$youtubewidth = (int) $ywidth;
}
if ((int) $yheight > 0) {
$youtubeheight = (int) $yheight;
}
/*$o .= '<object height="'.(int)$youtubeheight.'" width="'.(int)$youtubewidth.'">'
.'<param name="movie" value="http://www.youtube.com/v/'.$code.'"></param>'
.'<param name="allowFullScreen" value="true"></param>'
.'<param name="allowscriptaccess" value="always"></param>'
.'<embed src="http://www.youtube.com/v/'.$code.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.(int)$youtubeheight.'" width="'.(int)$youtubewidth.'"></embed></object>';*/
$o .= '<iframe height="' . (int) $youtubeheight . '" width="' . (int) $youtubewidth . '" src="//www.youtube.com/embed/' . $code . '" frameborder="0" allowfullscreen></iframe>';
}
if ($o != '') {
return $o;
}
return $videoCode;
}