aboutsummaryrefslogtreecommitdiff
path: root/lib/videolist.php
blob: ae244184725c82ac51c182c626d8812809f95cf6 (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
<?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");
}

/**
 * @param string $url
 * @return array
 */
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();
}

/**
 * @param array $parsed
 * @return array
 */
function videolist_get_data($parsed) {
	$videotype = $parsed['videotype'];

	if(is_callable("videolist_get_data_$videotype")){
		return array_merge($parsed, call_user_func("videolist_get_data_$videotype", $parsed));
	} else {
		return $parsed;
	}
}