-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathiframe.php
More file actions
89 lines (81 loc) · 2.19 KB
/
iframe.php
File metadata and controls
89 lines (81 loc) · 2.19 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
class IFrameFormat implements Format {
public $title = 'Embed';
public $mime = 'text/html';
public $display_only = true;
public function export( $data ) {
global $scodeid, $base_path;
$version = '1.2.0';
$endpoint = $base_path.'/';
$codeid = isset($scodeid) ? $scodeid : '';
$code = json_encode(array_to_mapbbcode($data));
$title = isset($data['title']) && strlen(trim($data['title'])) > 0 ?
'<div id="title">'.htmlspecialchars($data['title']).'</div>' : '';
$html = <<<HTMLE
<!DOCTYPE html>
<html>
<head>
<title>$title</title>
<meta charset="utf-8">
<link rel="stylesheet" href="//cdn.jsdelivr.net/mapbbcode/$version/leaflet.css" />
<script src="//cdn.jsdelivr.net/mapbbcode/$version/leaflet.js"></script>
<script src="//cdn.jsdelivr.net/mapbbcode/$version/mapbbcode.js"></script>
<style>
html, body, #map { margin: 0; height: 100%; }
#title {
position: absolute;
width: 500px;
min-width: 300px;
margin: 0 auto;
left: 0; right: 0;
top: 10px;
padding: 6px;
border-radius: 6px;
background-color: white;
opacity: 0.9;
text-align: center;
font-family: Arial, sans-serif;
}
</style>
</head>
<body onload="init();">
<div id="map"></div>
$title
<script>
function init() {
var code = $code;
var map = new window.MapBBCode({
fullFromStart: true,
fullViewHeight: 0
});
var c = map.show('map', code);
c.map.addControl(L.functionButtons([{
content: window.MapBBCode.buttonsImage,
bgPos: [52, 0],
href: '$endpoint$codeid',
alt: '↷',
title: map.strings.outerTitle
}], { position: 'topright' }));
if( L.ExportControl && '$codeid' ) {
c.map.addControl(new L.ExportControl({
name: map.strings.exportName,
title: map.strings.exportTitle,
filter: map.options.exportTypes.split(','),
endpoint: '$endpoint',
codeid: '$codeid'
}));
}
}
</script>
</body>
</html>
HTMLE;
return $html;
}
public function test( $header ) {
return false;
}
public function import( $file ) {
}
}
$formats['iframe'] = new IFrameFormat();