aboutsummaryrefslogtreecommitdiff
path: root/lib/videolist.php
blob: 2dfc7d8fc4bba0f0866a6d823539ed28c2905634 (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;
	}
}