forked from kaltura/mwEmbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
services.php
executable file
·42 lines (39 loc) · 1.16 KB
/
services.php
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
40
41
42
<?php
header("Access-Control-Allow-Origin: *");
/**
* Provides and entry point for javascript services .
*
* Will eventually replace all the entry points
*
* TODO make this into a real api entry point.
*
* TODO adopt an api framework
*/
// Include configuration: ( will include LocalSettings.php, and all the extension hooks )
require( dirname( __FILE__ ) . '/includes/DefaultSettings.php' );
// Check for custom resource ps config file:
if( isset( $wgKalturaPSHtml5SettingsPath ) && is_file( $wgKalturaPSHtml5SettingsPath ) ){
require_once( $wgKalturaPSHtml5SettingsPath );
}
$mwEmbedApi = new mwEmbedApi();
$mwEmbedApi->handleRequest();
// Dispatch on extension entry points
class mwEmbedApi{
function handleRequest(){
global $wgMwEmbedApiServices;
$serviceName = $this->getUrlParam( 'service' );
if( isset( $wgMwEmbedApiServices[ $serviceName ] ) ){
$service = new $wgMwEmbedApiServices[$serviceName ];
$service->run();
}
}
/**
* Parse the url request
* TODO actual url request handling
*/
function getUrlParam( $param ){
if( isset( $_REQUEST[ $param ] ) ){
return $_REQUEST[ $param ];
}
}
}