public
displayVideo
(mixed $url, mixed $view = 0, mixed $ywidth = 0, mixed $yheight = 0)
public function displayVideo($url, $view = 0, $ywidth = 0, $yheight = 0)
{
$o = '';
$app = Factory::getApplication();
if ($view == 0) {
// Category View
$height = $this->params->get('youtube_height_cv', 240);
$width = $this->params->get('youtube_width_cv', 320);
} else {
// Detail View
$height = $this->params->get('youtube_height_dv', 360);
$width = $this->params->get('youtube_width_dv', 480);
}
if ($url != '' && PhocaDownloadUtils::isURLAddress($url)) {
$ssl = strpos($url, 'https');
$yLink = 'http://www.youtube.com/v/';
if ($ssl != false) {
$yLink = 'https://www.youtube.com/v/';
}
$shortUrl = 'http://youtu.be/';
$shortUrl2 = 'https://youtu.be/';
$pos = strpos($url, $shortUrl);
$pos2 = strpos($url, $shortUrl2);
if ($pos !== false) {
$code = str_replace($shortUrl, '', $url);
} else {
if ($pos2 !== false) {
$code = str_replace($shortUrl2, '', $url);
} else {
$codeArray = explode('=', $url);
$code = str_replace($codeArray[0] . '=', '', $url);
}
}
if ((int) $ywidth > 0) {
$width = (int) $ywidth;
}
if ((int) $yheight > 0) {
$height = (int) $yheight;
}
$attr = '';
if ((int) $width > 0) {
$attr .= ' width="' . (int) $width . '"';
}
if ((int) $height > 0) {
$attr .= ' height="' . (int) $height . '"';
}
$o .= '<div class="ph-video-container">';
$o .= '<iframe ' . $attr . ' src="https://www.youtube.com/embed/' . $code . '"></iframe>';
$o .= '</div>';
/*$o .= '<object height="'.(int)$height.'" width="'.(int)$width.'" data="http://www.youtube.com/v/'.$code.'" type="application/x-shockwave-flash">'
.'<param name="movie" value="http://www.youtube.com/v/'.$code.'" />'
.'<param name="allowFullScreen" value="true" />'
.'<param name="allowscriptaccess" value="always" />'
.'<embed src="'.$yLink.$code.'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.(int)$height.'" width="'.(int)$width.'" /></object>';*/
}
return $o;
}