-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
inreach-mapshare.php
120 lines (103 loc) · 3.05 KB
/
inreach-mapshare.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/*
Plugin Name: inReach MapShare
Plugin URI: https://github.com/morehawes/inreach-mapshare
Description: Display inReach MapShare data on your WordPress site. Visit the <a href="options-general.php?page=inreach-mapshare-settings">Settings</a> page to create and customise Shortcodes.
Version: 2.0.1
Text Domain: inreach-mapshare
Author: Joe Hawes
Author URI: https://www.morehawes.ca/
*/
spl_autoload_register(function ($class_name) {
$file_name = substr($class_name, strripos($class_name, '_') + 1);
$file_name .= '.php';
switch (true) {
//App
case strpos($class_name, 'InMap_') === 0:
require 'src/php/' . $file_name;
break;
}
});
add_action('init', function () {
$plugin_slug = 'inreach-mapshare';
$plugin_name = 'inReach MapShare';
//Icon URLs
$message_icon = InMap_Helper::asset_url('img/message.svg', $plugin_slug);
$tracking_icon = InMap_Helper::asset_url('img/location-gps.svg', $plugin_slug);
$config = [
'plugin_slug' => $plugin_slug,
'plugin_text_domain' => $plugin_slug,
'plugin_name' => $plugin_name,
'plugin_name_short' => $plugin_name,
'plugin_version' => '2.0.1',
'settings_id' => 'inmap_settings',
'settings_default_tab' => 'inmap-settings-tab-mapshare',
'site_url' => 'https://github.com/morehawes/inreach-mapshare/',
'github_url' => 'https://github.com/morehawes/inreach-mapshare/',
'plugin_shortcode' => $plugin_slug,
'plugin_about' => '
<p class="inmap-lead">' . sprintf(__('Display your live <a href="%s">MapShare</a> data with a simple Shortcode.', InMap_Config::get_item('plugin_text_domain')), 'https://support.garmin.com/?faq=p2lncMOzqh71P06VifrQE7') . '</p>
<p>' . sprintf(__('Enable and configure MapShare in the <a href="%s">Social</a> tab of your Garmin Explore Account.', InMap_Config::get_item('plugin_text_domain')), 'https://explore.garmin.com/Social') . '</p>
',
//KML
'kml_data_include' => [
'Id',
'Time UTC',
'Time',
// 'Name',
// 'Map Display Name',
// 'Device Type',
// 'IMEI',
// 'Incident Id',
'Latitude',
'Longitude',
'Elevation',
'Velocity',
// 'Course',
'Valid GPS Fix',
// 'In Emergency',
'Text',
'Event',
// 'Device Identifier',
// 'SpatialRefSystem'
],
//Shortcode
'shortcode' => [
'build' => [],
],
//MapShare
'mapshare' => [
'defaults' => [
'mapshare_date_start' => '2020-10-02T16:20',
],
],
//Appearance
'appearance' => [
'map' => [
'basemap_url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'basemap_attribution' => '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
'detail_expanded' => '1',
],
'colours' => [
'tracking_colour' => '#e524ab',
'route_colour' => '#e29809',
],
'icons' => [
'message_icon' => $message_icon,
'tracking_icon' => $tracking_icon,
],
],
// Advanced
'advanced' => [
'request' => [
'cache_minutes' => '15',
],
'response' => [
'precision' => '3',
],
],
];
InMap_Config::init($config);
new InMap_Admin;
new InMap_Front;
});