aboutsummaryrefslogtreecommitdiff
path: root/lib/videolist.php
blob: 45253a9e397d932d52c5238559c34319b501b74c (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
<?php

define('VIDEOLIST_SUPPORTED_PLATFORMS', 'youtube, vimeo, metacafe, bliptv', 'gisstv');

foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
	include(elgg_get_plugins_path()."videolist/lib/$videotype.php");
}

function videolist_parseurl($url){
	foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
		if (is_callable("videolist_parseurl_$videotype")){
			if ($parsed = call_user_func("videolist_parseurl_$videotype", $url)) {
				return $parsed;
			}
		}
	}
	return array();
}

function videolist_get_data($parsed) {
	$videotype = $parsed['videotype'];
	$video_id = $parsed['video_id'];
	
	if(is_callable("videolist_get_data_$videotype")){
		return array_merge($parsed, call_user_func("videolist_get_data_$videotype", $parsed));
	} else {
		return $parsed;
	}
}