diff options
author | Sem <sembrestels@riseup.net> | 2011-11-06 23:28:09 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2011-11-06 23:28:09 +0100 |
commit | 0adeee109cf8d8517f3a890105f5b46459495204 (patch) | |
tree | 6e0cc8ea0bec3bb007b782db17712d46af1e1572 /lib/videolist.php | |
parent | 84de3a9ab57277bbaedb30c5e24070f8a5ad4431 (diff) | |
download | elgg-0adeee109cf8d8517f3a890105f5b46459495204.tar.gz elgg-0adeee109cf8d8517f3a890105f5b46459495204.tar.bz2 |
Watch working for Vimeo and Youtube.
Diffstat (limited to 'lib/videolist.php')
-rw-r--r-- | lib/videolist.php | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/lib/videolist.php b/lib/videolist.php index 18745dfd1..03b6e2760 100644 --- a/lib/videolist.php +++ b/lib/videolist.php @@ -20,7 +20,7 @@ function videolist_parseurl_youtube($url) { return array( 'domain' => $domain, - 'videoid' => $hash, + 'video_id' => $hash, ); } @@ -34,7 +34,7 @@ function videolist_parseurl_vimeo($url) { return array( 'domain' => $domain, - 'videoid' => $hash, + 'video_id' => $hash, ); } @@ -50,7 +50,7 @@ function videolist_parseurl_metacafe($url) { return array( 'domain' => $domain, - 'videoid' => $hash, + 'video_id' => $hash, ); } @@ -71,30 +71,31 @@ function videolist_parseurl($url){ function videolist_get_data($video_parsed_url) { $site = $video_parsed_url['site']; - $videoid = $video_parsed_url['videoid']; + $video_id = $video_parsed_url['video_id']; switch($site){ - case YOUTUBE: return videolist_get_data_youtube($videoid); - case VIMEO: return videolist_get_data_vimeo($videoid); - case METACAFE: return videolist_get_data_metacafe($videoid); + case YOUTUBE: return videolist_get_data_youtube($video_id); + case VIMEO: return videolist_get_data_vimeo($video_id); + case METACAFE: return videolist_get_data_metacafe($video_id); default: return array(); } } -function videolist_get_data_youtube($videoid){ - $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$videoid); +function videolist_get_data_youtube($video_id){ + $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id); $xml = new SimpleXMLElement($buffer); return array( 'title' => sanitize_string($xml->title), 'description' => sanitize_string($xml->content), - 'icon' => "http://img.youtube.com/vi/$videoid/default.jpg", + 'icon' => "http://img.youtube.com/vi/$video_id/default.jpg", + 'video_id' => $video_id, 'videotype' => 'youtube', ); } -function videolist_get_data_vimeo($videoid){ - $buffer = file_get_contents("http://vimeo.com/api/v2/video/$videoid.xml"); +function videolist_get_data_vimeo($video_id){ + $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml"); $xml = new SimpleXMLElement($buffer); $videos = $xml->children(); @@ -104,12 +105,13 @@ function videolist_get_data_vimeo($videoid){ 'title' => sanitize_string($video->title), 'description' => sanitize_string($video->description), 'icon' => sanitize_string($video->thumbnail_medium), + 'video_id' => $video_id, 'videotype' => 'vimeo', ); } -function videolist_get_data_metacafe($videoid){ //FIXME - $buffer = file_get_contents("http://www.metacafe.com/api/item/$videoid"); +function videolist_get_data_metacafe($video_id){ //FIXME + $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id"); $xml = new SimpleXMLElement($buffer); $children = $xml->children(); @@ -121,6 +123,7 @@ function videolist_get_data_metacafe($videoid){ //FIXME 'title' => $channel->title, 'description' => $channel->description, 'icon' => $matches[1], + 'video_id' => $video_id, 'videotype' => 'metacafe', ); } |