blob: c212f6841ba78c23d414a99cb1d5451392d62357 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
/**
* ECML Youtube support
*
* @package ECML
*/
$src = (isset($vars['src'])) ? $vars['src'] : FALSE;
$width = (isset($vars['width'])) ? $vars['width'] : 480;
$height = (isset($vars['height'])) ? $vars['height'] : 385;
// need to extract the video id.
// the src arg can take a full url or an id.
// assume if no youtube.com that it's an id.
if (strpos($src, 'youtube.com') === FALSE) {
$vid = $src;
} else {
// grab the v param
if ($parts = parse_url($src)) {
if (isset($parts['query'])) {
parse_str($parts['query'], $query_arr);
$vid = (isset($query_arr['v'])) ? $query_arr['v'] : FALSE;
}
}
}
if ($vid) {
$movie_url = "http://www.youtube.com/v/$vid";
echo "
<object width=\"$width\" height=\"$height\">
<param name=\"movie\" value=\"$movie_url\"></param>
<param name=\"allowFullScreen\" value=\"true\"></param>
<param name=\"allowscriptaccess\" value=\"always\"></param>
<embed src=\"$movie_url\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed>
</object>
";
}
|