forked from kaltura/mwEmbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmwEmbedStartup.php
33 lines (30 loc) · 1.08 KB
/
mwEmbedStartup.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
<?php
/**
* Kaltura entry point to resource loader framework
*/
// Set the request variables:
$_GET['modules'] = 'startup';
$_GET['only'] = 'scripts';
// NOTE this won't work so well with symbolic links
$loaderPath = 'load.php';
if( is_file( $loaderPath ) ){
chdir( dirname( $loaderPath ) );
include_once( $loaderPath );
} else {
print "if( console && console.log ){ console.log( 'Error can't find load.php' ) }";
}
// Bootstrap some js code to make the "loader" work in stand alone mode
// Note this has to be wrapped in a document.write to run after other document.writes
$pageStartupScript = Html::inlineScript(
ResourceLoader::makeLoaderConditionalScript(
Xml::encodeJsCall( 'mw.loader.go', array() )
)
);
echo Xml::encodeJsCall( 'document.write', array( $pageStartupScript ) );
// Load the core mw.MwEmbedSupport library
$pageMwEmbedScript = Html::inlineScript(
ResourceLoader::makeLoaderConditionalScript(
Xml::encodeJsCall( 'mw.loader.load', array( 'mw.MwEmbedSupport' ) )
)
);
echo Xml::encodeJsCall( 'document.write', array( $pageMwEmbedScript ) );