-
Notifications
You must be signed in to change notification settings - Fork 1
/
inreach-mapshare.php
121 lines (102 loc) · 3.13 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
121
<?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: 1.3
Text Domain: inreach-mapshare
Author: Joe Hawes
Author URI: https://www.morehawes.co.uk/
*/
//Joe App
spl_autoload_register(function($class_name) {
$file_name = substr($class_name, strripos($class_name, '_')+1);
$file_name .= '.php';
switch(true) {
//Joe Build
case strpos($class_name, 'Joe_v') === 0 :
require 'Joe/' . $file_name;
break;
//Joe Development
case strpos($class_name, 'Joe_') === 0 :
require 'Joe/inc/' . $file_name;
break;
//App
case strpos($class_name, 'InMap_') === 0 :
require 'App/' . $file_name;
break;
}
});
add_action('init', function() {
$plugin_slug = 'inreach-mapshare';
$plugin_name = 'inReach MapShare';
$colour_primary = '#e524ab';
//Icon URLs
$message_icon = Joe_Helper::asset_url('img/message.svg', $plugin_slug);
$tracking_icon = Joe_Helper::asset_url('img/location-gps.svg', $plugin_slug);
$config = [
'plugin_slug' => $plugin_slug,
'plugin_text_domain' => $plugin_slug,
'plugin_name' => $plugin_name,
'plugin_version' => '1.3',
'settings_id' => 'inmap_settings',
'settings_default_tab' => 'joe-settings-tab-mapshare',
'site_url' => 'https://github.com/morehawes/inreach-mapshare/',
// 'directory_url' => 'https://wordpress.org/plugins/' . $plugin_slug . '/',
'github_url' => 'https://github.com/morehawes/inreach-mapshare/',
'plugin_shortcode' => $plugin_slug,
'plugin_about' => '
<p class="joe-lead">' . sprintf(__('Display your live <a href="%s">MapShare</a> data with a simple Shortcode.', Joe_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.', Joe_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'
],
'colours' => [
'tracking_colour' => $colour_primary,
],
'icons' => [
'message_icon' => $message_icon,
'tracking_icon' => $tracking_icon
]
]
];
Joe_Config::init($config);
new InMap_Admin;
new InMap_Front;
});