-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.php
43 lines (39 loc) · 2.14 KB
/
base.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
43
<?php
function sendContentType() {
header('Pragma: no-cache');
header('Cache-Control: no-cache');
header('Content-Style-Type: text/css');
$uagent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strstr($uagent, 'firefox') || strstr($uagent, 'chrome')) {
header('Content-Type: application/xhtml+xml; charset=UTF-8');
} else {
header('Content-Type: application/vnd.hbbtv.xhtml+xml; charset=UTF-8');
}
}
function videoObject($left=0, $top=0, $width=1280, $height=720) {
// Always return <img> tag instead of <object type="video/broadcast">
// Because HbbTV App Framework doesn't support broadcast related element.
global $ROOTDIR;
return '<img id="video" style="position: absolute; left: '.$left.'px; top: '.$top.'px; width: '.$width.'px; height: '.$height.'px;" src="'.$ROOTDIR.'/video.jpg" />';
}
function appmgrObject() {
if ($_REQUEST['demo']) return '';
return '<object id="appmgr" type="application/oipfApplicationManager" style="position: absolute; left: 0px; top: 0px; width: 0px; height: 0px;"></object><object id="oipfcfg" type="application/oipfConfiguration" style="position: absolute; left: 0px; top: 0px; width: 0px; height: 0px;"></object>';
}
function openDocument($title='MIT-xperts HbbTV testsuite', $allscripts=1, $addheaders='') {
global $ROOTDIR;
echo '<?xml version="1.0" encoding="utf-8" ?>'."\n";
echo '<!DOCTYPE html PUBLIC "-//HbbTV//1.1.1//EN" "http://www.hbbtv.org/dtd/HbbTV-1.1.1.dtd">'."\n";
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
echo "<head>\n";
echo "<title>$title</title>\n".$addheaders;
echo "<meta http-equiv=\"content-type\" content=\"Content-Type: application/vnd.hbbtv.xhtml+xml; charset=UTF-8\" />\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$ROOTDIR/base.css\" />\n";
echo "<script type=\"text/javascript\" src=\"$ROOTDIR/settings.js\"></script>\n";
echo "<script type=\"text/javascript\" src=\"$ROOTDIR/releaseinfo.js\"></script>\n";
if ($allscripts) {
echo "<script type=\"text/javascript\" src=\"$ROOTDIR/keycodes.js\"></script>\n";
echo "<script type=\"text/javascript\" src=\"$ROOTDIR/base.js\"></script>\n";
}
}
?>