From 047f519adf55cb01a94315c2d66ea5b6dc50c23d Mon Sep 17 00:00:00 2001 From: Joe Hawes Date: Tue, 16 Apr 2024 15:14:09 -0700 Subject: [PATCH] Re-build 1.3 --- build/App/Admin.php | 8 +-- build/App/Front.php | 4 +- build/App/Inreach.php | 78 +++++++++++++------------- build/App/Settings.php | 92 +++++++++++++++---------------- build/App/Shortcode.php | 74 ++++++++++++------------- build/Joe/Admin.php | 26 ++++----- build/Joe/Assets.php | 26 ++++----- build/Joe/Cache.php | 14 ++--- build/Joe/Class.php | 2 +- build/Joe/Config.php | 8 +-- build/Joe/Front.php | 2 +- build/Joe/HTTP.php | 8 +-- build/Joe/Helper.php | 92 +++++++++++++++---------------- build/Joe/Input.php | 60 ++++++++++---------- build/Joe/Log.php | 14 ++--- build/Joe/Settings.php | 76 ++++++++++++------------- build/Joe/Shortcode.php | 4 +- build/assets/js/shortcode.js | 20 ++++++- build/assets/js/shortcode.min.js | 2 +- build/inreach-mapshare.php | 10 ++-- inreach-mapshare.zip | Bin 187857 -> 188070 bytes 21 files changed, 317 insertions(+), 303 deletions(-) diff --git a/build/App/Admin.php b/build/App/Admin.php index 7ba5b6a..21627ec 100644 --- a/build/App/Admin.php +++ b/build/App/Admin.php @@ -1,6 +1,6 @@ ' . esc_html__('Settings', Joe_v1_2_Config::get_item('plugin_text_domain')) . '' + '' . esc_html__('Settings', Joe_v1_3_Config::get_item('plugin_text_domain')) . '' ); return array_merge($links_before, $links, $links_after); @@ -32,6 +32,6 @@ function load_assets() { parent::load_assets(); //Joe CSS -// Joe_v1_2_Assets::css_enqueue(Joe_v1_2_Helper::asset_url('css/admin.min.css')); +// Joe_v1_3_Assets::css_enqueue(Joe_v1_3_Helper::asset_url('css/admin.min.css')); } } \ No newline at end of file diff --git a/build/App/Front.php b/build/App/Front.php index a8bc06c..4c4cb24 100644 --- a/build/App/Front.php +++ b/build/App/Front.php @@ -1,6 +1,6 @@ ' . "\n"; + echo '' . "\n"; } } \ No newline at end of file diff --git a/build/App/Inreach.php b/build/App/Inreach.php index db219af..16bc02e 100644 --- a/build/App/Inreach.php +++ b/build/App/Inreach.php @@ -1,6 +1,6 @@ cache_id) { //Cached response ** GET STALE! - $this->cache_response = Joe_v1_2_Cache::get_item($this->cache_id, true); + $this->cache_response = Joe_v1_3_Cache::get_item($this->cache_id, true); //Fresh if($this->cache_response && $this->cache_response['status'] == 'fresh') { - Joe_v1_2_Log::add(__('Response retrieved from Cache.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'info', 'cache_fresh'); + Joe_v1_3_Log::add(__('Response retrieved from Cache.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'info', 'cache_fresh'); $this->response_string = $this->cache_response['value']; //Nothing fresh... @@ -90,26 +90,26 @@ function execute_request() { $this->response_string = $response_string; //Insert into cache - Joe_v1_2_Cache::set_item($this->cache_id, $response_string); + Joe_v1_3_Cache::set_item($this->cache_id, $response_string); - Joe_v1_2_Log::add(__('Garmin provided a valid KML response, which has been added to Cache.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'info', 'response_cached'); + Joe_v1_3_Log::add(__('Garmin provided a valid KML response, which has been added to Cache.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'info', 'response_cached'); } else { - Joe_v1_2_Log::add(__('Received invalid KML response from Garmin. Check your MapShare Settings', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'invalid_kml'); + Joe_v1_3_Log::add(__('Received invalid KML response from Garmin. Check your MapShare Settings', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'invalid_kml'); } //Invalid identifier } else { - Joe_v1_2_Log::add(__('Garmin does not recognise this MapShare Identifier.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'identifier'); + Joe_v1_3_Log::add(__('Garmin does not recognise this MapShare Identifier.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'identifier'); } break; //Fail case $response_code == '401' : - Joe_v1_2_Log::add(__('There was a problem with your MapShare Password.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'error_password'); + Joe_v1_3_Log::add(__('There was a problem with your MapShare Password.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'error_password'); break; //Other default : - Joe_v1_2_Log::add(sprintf(__('Garmin returned a %s error.', Joe_v1_2_Config::get_item('plugin_text_domain')), $response_code), 'error', 'error_' . $response_code); + Joe_v1_3_Log::add(sprintf(__('Garmin returned a %s error.', Joe_v1_3_Config::get_item('plugin_text_domain')), $response_code), 'error', 'error_' . $response_code); break; } @@ -121,13 +121,13 @@ function execute_request() { if(! $this->response_string) { //Check for stale cache if($this->cache_response && $this->cache_response['status'] == 'stale') { - Joe_v1_2_Log::add(sprintf(__('Unable to get updated KML from Garmin. Last update: %s minutes ago.', Joe_v1_2_Config::get_item('plugin_text_domain')), round($this->cache_response['minutes'])), 'warning', 'cache_stale'); + Joe_v1_3_Log::add(sprintf(__('Unable to get updated KML from Garmin. Last update: %s minutes ago.', Joe_v1_3_Config::get_item('plugin_text_domain')), round($this->cache_response['minutes'])), 'warning', 'cache_stale'); //Better than nothing $this->response_string = $this->cache_response['value']; //No cache either } else { - Joe_v1_2_Log::add(__('Garmin provided an empty response. Check your MapShare Settings.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'empty_response'); + Joe_v1_3_Log::add(__('Garmin provided an empty response. Check your MapShare Settings.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'empty_response'); } } } @@ -138,18 +138,18 @@ function setup_request() { //Required if(! $url_identifier) { - Joe_v1_2_Log::add(__('No MapShare identifier provided.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'missing_identifier'); + Joe_v1_3_Log::add(__('No MapShare identifier provided.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'missing_identifier'); return false; //Load Demo } elseif($url_identifier == 'demo') { - $demo_kml = file_get_contents(Joe_v1_2_Helper::asset_url('geo/demo.kml')); + $demo_kml = file_get_contents(Joe_v1_3_Helper::asset_url('geo/demo.kml')); if($demo_kml) { $this->response_string = $demo_kml; - Joe_v1_2_Log::add(__('Demo mode enabled!', Joe_v1_2_Config::get_item('plugin_text_domain')), 'info', 'do_demo'); + Joe_v1_3_Log::add(__('Demo mode enabled!', Joe_v1_3_Config::get_item('plugin_text_domain')), 'info', 'do_demo'); } else { - Joe_v1_2_Log::add(__('Unable to read Demo KML.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'warning', 'demo_kml_unreadable'); + Joe_v1_3_Log::add(__('Unable to read Demo KML.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'warning', 'demo_kml_unreadable'); } return true; @@ -157,7 +157,7 @@ function setup_request() { //Password warning if($this->get_parameter('mapshare_password')) { - Joe_v1_2_Log::add(sprintf(__('Remember that you are responsible for protecting access if needed!', Joe_v1_2_Config::get_item('plugin_text_domain')), ' href=\"https://wordpress.org/support/article/using-password-protection/\"'), 'warning', 'password_set'); + Joe_v1_3_Log::add(sprintf(__('Remember that you are responsible for protecting access if needed!', Joe_v1_3_Config::get_item('plugin_text_domain')), ' href=\"https://wordpress.org/support/article/using-password-protection/\"'), 'warning', 'password_set'); } //Start building the request @@ -175,7 +175,7 @@ function setup_request() { //Open-ended request warning if($data_start && ! $data_end) { - Joe_v1_2_Log::add(__('Be careful when creating Shortcodes with no end date. All future MapShare data will be displayed!', Joe_v1_2_Config::get_item('plugin_text_domain')), 'warning', 'no_end_date'); + Joe_v1_3_Log::add(__('Be careful when creating Shortcodes with no end date. All future MapShare data will be displayed!', Joe_v1_3_Config::get_item('plugin_text_domain')), 'warning', 'no_end_date'); } //Append data @@ -187,7 +187,7 @@ function setup_request() { //Determine cache ID $this->cache_id = md5(json_encode($this->get_parameters())); - Joe_v1_2_Log::add($this->request_string, 'info', 'request_ready'); + Joe_v1_3_Log::add($this->request_string, 'info', 'request_ready'); return true; } @@ -207,14 +207,14 @@ function process_kml() { $this->get_point_count(); if($this->point_count) { - $point_text = ($this->point_count == 1) ? __('Point', Joe_v1_2_Config::get_item('plugin_text_domain')) : __('Points', Joe_v1_2_Config::get_item('plugin_text_domain')); + $point_text = ($this->point_count == 1) ? __('Point', Joe_v1_3_Config::get_item('plugin_text_domain')) : __('Points', Joe_v1_3_Config::get_item('plugin_text_domain')); - Joe_v1_2_Log::add(__('The KML response contains ' . $this->point_count . ' ' . $point_text . '.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'info', 'has_points'); + Joe_v1_3_Log::add(__('The KML response contains ' . $this->point_count . ' ' . $point_text . '.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'info', 'has_points'); } else { - Joe_v1_2_Log::add(__('The KML response contains no Points.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'no_points'); + Joe_v1_3_Log::add(__('The KML response contains no Points.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'no_points'); } } else { - Joe_v1_2_Log::add(__('The KML response is invalid.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'empty_kml'); + Joe_v1_3_Log::add(__('The KML response is invalid.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'empty_kml'); } } @@ -245,12 +245,12 @@ function build_geojson() { $class_append = []; //Demo! - if(! Joe_v1_2_Log::has('do_demo')) { - $time_ago = Joe_v1_2_Helper::time_ago(strtotime($Placemark->TimeStamp->when)); + if(! Joe_v1_3_Log::has('do_demo')) { + $time_ago = Joe_v1_3_Helper::time_ago(strtotime($Placemark->TimeStamp->when)); } else { $class_append[] = 'inmap-demo'; - $time_ago = Joe_v1_2_Helper::time_ago(strtotime($Placemark->TimeStamp->when), strtotime('5/21/2022 11:04:30 PM')); + $time_ago = Joe_v1_3_Helper::time_ago(strtotime($Placemark->TimeStamp->when), strtotime('5/21/2022 11:04:30 PM')); } //Coordinates @@ -274,7 +274,7 @@ function build_geojson() { $key = (string)$Placemark->ExtendedData->Data[$j]->attributes()->name; //Must be a key we are interested in - if(in_array($key, Joe_v1_2_Config::get_item('kml_data_include'))) { + if(in_array($key, Joe_v1_3_Config::get_item('kml_data_include'))) { $value = (string)$Placemark->ExtendedData->Data[$j]->value; //By Key @@ -304,9 +304,9 @@ function build_geojson() { } //Demo Time - if(Joe_v1_2_Log::has('do_demo')) { - $key = esc_attr__('Demo', Joe_v1_2_Config::get_item('plugin_text_domain')); - $extended_data[$key] = esc_attr__('This is a demo!', Joe_v1_2_Config::get_item('plugin_text_domain')); + if(Joe_v1_3_Log::has('do_demo')) { + $key = esc_attr__('Demo', Joe_v1_3_Config::get_item('plugin_text_domain')); + $extended_data[$key] = esc_attr__('This is a demo!', Joe_v1_3_Config::get_item('plugin_text_domain')); } //Title @@ -324,10 +324,10 @@ function build_geojson() { //**Only** if($this->point_count === 1) { $class_append[] = 'inmap-last inmap-active inmap-only'; - $Feature['properties']['title'] = '[' . __('Latest', Joe_v1_2_Config::get_item('plugin_text_domain')) . ']'; + $Feature['properties']['title'] = '[' . __('Latest', Joe_v1_3_Config::get_item('plugin_text_domain')) . ']'; //First } else { - $Feature['properties']['title'] = '[' . __('First', Joe_v1_2_Config::get_item('plugin_text_domain')) . ']'; + $Feature['properties']['title'] = '[' . __('First', Joe_v1_3_Config::get_item('plugin_text_domain')) . ']'; } //Most recent @@ -341,7 +341,7 @@ function build_geojson() { $class_append[] = 'inmap-last inmap-active'; //Most recent - $Feature['properties']['title'] = '[' . __('Latest', Joe_v1_2_Config::get_item('plugin_text_domain')) . ']'; + $Feature['properties']['title'] = '[' . __('Latest', Joe_v1_3_Config::get_item('plugin_text_domain')) . ']'; $Feature['properties']['title'] .= $time_ago; } @@ -393,9 +393,9 @@ function build_geojson() { //We have data if(sizeof($extended_data)) { - $description .= Joe_v1_2_Helper::assoc_array_table($extended_data); + $description .= Joe_v1_3_Helper::assoc_array_table($extended_data); - $description .= '
' . __('More detail', Joe_v1_2_Config::get_item('plugin_text_domain')) . ' +
'; + $description .= '
' . __('More detail', Joe_v1_3_Config::get_item('plugin_text_domain')) . ' +
'; } $description .= ''; @@ -429,7 +429,7 @@ function build_geojson() { //Style $Feature['properties']['style']['weight'] = 2; - $Feature['properties']['style']['color'] = Joe_v1_2_Config::get_setting('appearance', 'colours', 'tracking_colour'); + $Feature['properties']['style']['color'] = Joe_v1_3_Config::get_setting('appearance', 'colours', 'tracking_colour'); $this->FeatureCollection['features'][] = $Feature; } @@ -438,7 +438,7 @@ function build_geojson() { $this->FeatureCollection['features'] = array_reverse($this->FeatureCollection['features']); //No points in KML } else { - Joe_v1_2_Log::add(__('The KML response contains no Points.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'error', 'no_points'); + Joe_v1_3_Log::add(__('The KML response contains no Points.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'error', 'no_points'); } } diff --git a/build/App/Settings.php b/build/App/Settings.php index 7e2c4f9..65b9fbd 100644 --- a/build/App/Settings.php +++ b/build/App/Settings.php @@ -1,6 +1,6 @@ do_shortcode(); $this->settings_nav = [ - 'joe-settings-tab-shortcode' => '-- ' . esc_html__('Shortcodes', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'joe-settings-tab-appearance' => '-- ' . esc_html__('Appearance', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'joe-settings-tab-joe' => '-- ' . esc_html__('Advanced', Joe_v1_2_Config::get_item('plugin_text_domain')) + 'joe-settings-tab-shortcode' => '-- ' . esc_html__('Shortcodes', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'joe-settings-tab-appearance' => '-- ' . esc_html__('Appearance', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'joe-settings-tab-joe' => '-- ' . esc_html__('Advanced', Joe_v1_3_Config::get_item('plugin_text_domain')) ]; //Switch tabs - if(Joe_v1_2_Config::get_setting('mapshare', 'defaults', 'mapshare_identifier')) { - Joe_v1_2_Config::set_item('settings_default_tab', 'joe-settings-tab-shortcode'); + if(Joe_v1_3_Config::get_setting('mapshare', 'defaults', 'mapshare_identifier')) { + Joe_v1_3_Config::set_item('settings_default_tab', 'joe-settings-tab-shortcode'); } //Text @@ -33,13 +33,13 @@ public function __construct() { $this->tabs['shortcode'] = [ 'sections' => [ 'build' => [ - 'title' => esc_html__('Shortcodes', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('Shortcodes', Joe_v1_3_Config::get_item('plugin_text_domain')), 'fields' => [ 'mapshare_identifier' => [ 'required' => 'demo', 'id' => 'mapshare_identifier', - 'title' => esc_html__('MapShare Identifier', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_attr__('This is found in the Social tab of your Garmin Explore acount.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('MapShare Identifier', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_attr__('This is found in the Social tab of your Garmin Explore acount.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://explore.garmin.com/Social', 'prepend' => 'share.garmin.com/', //Remove all non-alphanemeric @@ -48,20 +48,20 @@ public function __construct() { ] ], 'mapshare_password' => [ - 'title' => esc_html__('MapShare Password', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_attr__('It is recommended that you protect your MapShare page from public access by setting a password. This plugin requires that password request your MapShare data, ***HOWEVER*** it does not protect it from public access.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('MapShare Password', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_attr__('It is recommended that you protect your MapShare page from public access by setting a password. This plugin requires that password request your MapShare data, ***HOWEVER*** it does not protect it from public access.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://explore.garmin.com/Social' ], 'mapshare_date_start' => [ 'type' => 'datetime-local', - 'title' => esc_html__('Start Date', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_html__('Display data starting from this date and time (UTC time yyyy-mm-ddThh:mm, e.g. 2022-12-31T00:00). Leave both Start and End date/time blank to only display your most recent MapShare location.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('Start Date', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_html__('Display data starting from this date and time (UTC time yyyy-mm-ddThh:mm, e.g. 2022-12-31T00:00). Leave both Start and End date/time blank to only display your most recent MapShare location.', Joe_v1_3_Config::get_item('plugin_text_domain')), ], 'mapshare_date_end' => [ 'id' => 'mapshare_date_end', 'type' => 'datetime-local', - 'title' => esc_html__('End Date', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_html__('Strongly recommended! Display data until this date and time (UTC time yyyy-mm-ddThh:mm, e.g. 2022-12-31T23:59). Be careful when creating Shortcodes with no end date, all future MapShare data will be displayed!', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('End Date', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_html__('Strongly recommended! Display data until this date and time (UTC time yyyy-mm-ddThh:mm, e.g. 2022-12-31T23:59). Be careful when creating Shortcodes with no end date, all future MapShare data will be displayed!', Joe_v1_3_Config::get_item('plugin_text_domain')), ] ] ] @@ -72,18 +72,18 @@ public function __construct() { $this->tabs['appearance'] = [ 'sections' => [ 'map' => [ - 'title' => esc_html__('Map', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('Map', Joe_v1_3_Config::get_item('plugin_text_domain')), 'fields' => [ 'basemap_url' => [ - 'required' => Joe_v1_2_Config::get_fallback('appearance', 'map', 'basemap_url'), - 'title' => esc_html__('Basemap URL', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_html__('The URL to a "slippy map" tile service, this needs to contain the characters {z},{x} and {y}. OpenStreetMap is used by default.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'required' => Joe_v1_3_Config::get_fallback('appearance', 'map', 'basemap_url'), + 'title' => esc_html__('Basemap URL', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_html__('The URL to a "slippy map" tile service, this needs to contain the characters {z},{x} and {y}. OpenStreetMap is used by default.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://leaflet-extras.github.io/leaflet-providers/preview/' ], 'basemap_attribution' => [ - 'required' => Joe_v1_2_Config::get_fallback('appearance', 'map', 'basemap_attribution'), - 'title' => esc_html__('Basemap Attribution', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_html__('Mapping services often have the requirement that attribution is displayed by the map. Text and HTML links are supported.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'required' => Joe_v1_3_Config::get_fallback('appearance', 'map', 'basemap_attribution'), + 'title' => esc_html__('Basemap Attribution', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_html__('Mapping services often have the requirement that attribution is displayed by the map. Text and HTML links are supported.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'input_processing' => array( 'encode_special' ), @@ -94,31 +94,31 @@ public function __construct() { ] ], 'colours' => [ - 'title' => esc_html__('Colours', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('Colours', Joe_v1_3_Config::get_item('plugin_text_domain')), 'fields' => [ 'tracking_colour' => [ 'type' => 'text', 'class' => 'color joe-colour-picker', - 'required' => Joe_v1_2_Config::get_fallback('appearance', 'colours', 'tracking_colour'), - 'title' => esc_html__('Tracking Colour', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_attr__('This is the primary colour used. Customise further by adding custom CSS rules.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'required' => Joe_v1_3_Config::get_fallback('appearance', 'colours', 'tracking_colour'), + 'title' => esc_html__('Tracking Colour', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_attr__('This is the primary colour used. Customise further by adding custom CSS rules.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://wordpress.org/support/article/css/#custom-css-in-wordpress' ] ] ], 'icons' => [ - 'title' => esc_html__('Icons', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'title' => esc_html__('Icons', Joe_v1_3_Config::get_item('plugin_text_domain')), 'fields' => [ 'tracking_icon' => [ - 'required' => Joe_v1_2_Config::get_fallback('appearance', 'icons', 'tracking_icon'), - 'title' => esc_html__('Tracking Icon', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_attr__('The URL to a SVG image file to use as an icon for tracking points.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'required' => Joe_v1_3_Config::get_fallback('appearance', 'icons', 'tracking_icon'), + 'title' => esc_html__('Tracking Icon', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_attr__('The URL to a SVG image file to use as an icon for tracking points.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://www.svgrepo.com/vectors/location/' ], 'message_icon' => [ - 'required' => Joe_v1_2_Config::get_fallback('appearance', 'icons', 'message_icon'), - 'title' => esc_html__('Message Icon', Joe_v1_2_Config::get_item('plugin_text_domain')), - 'tip' => esc_attr__('The URL to a SVG image file to use as an icon for message points.', Joe_v1_2_Config::get_item('plugin_text_domain')), + 'required' => Joe_v1_3_Config::get_fallback('appearance', 'icons', 'message_icon'), + 'title' => esc_html__('Message Icon', Joe_v1_3_Config::get_item('plugin_text_domain')), + 'tip' => esc_attr__('The URL to a SVG image file to use as an icon for message points.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'tip_link' => 'https://www.svgrepo.com/vectors/envelope/' ] ] @@ -128,21 +128,21 @@ public function __construct() { } function do_shortcode() { - Joe_v1_2_Log::reset(); - Joe_v1_2_Log::set_output_type('notice'); + Joe_v1_3_Log::reset(); + Joe_v1_3_Log::set_output_type('notice'); $this->shortcode = '['; - $this->shortcode .= Joe_v1_2_Config::get_item('plugin_shortcode'); + $this->shortcode .= Joe_v1_3_Config::get_item('plugin_shortcode'); foreach([ 'mapshare_identifier', 'mapshare_password', 'mapshare_date_start', 'mapshare_date_end' ] as $key) { - $value = Joe_v1_2_Config::get_setting('shortcode', 'build', $key); + $value = Joe_v1_3_Config::get_setting('shortcode', 'build', $key); if(! empty($value)) { - $this->shortcode .= ' ' . $key . '="' . Joe_v1_2_Config::get_setting('shortcode', 'build', $key) . '"'; + $this->shortcode .= ' ' . $key . '="' . Joe_v1_3_Config::get_setting('shortcode', 'build', $key) . '"'; } } $this->shortcode .= ']'; @@ -150,18 +150,18 @@ function do_shortcode() { //Execute Shortcode (and Garmin request) $this->shortcode_output = do_shortcode($this->shortcode); - if(Joe_v1_2_Log::has('do_demo')) { - $this->shortcode = '[' . Joe_v1_2_Config::get_item('plugin_shortcode') . ' mapshare_identifier="demo"]'; + if(Joe_v1_3_Log::has('do_demo')) { + $this->shortcode = '[' . Joe_v1_3_Config::get_item('plugin_shortcode') . ' mapshare_identifier="demo"]'; } - Joe_v1_2_Log::render(); + Joe_v1_3_Log::render(); } function joe_admin_after_form($out) { //Success - if(! Joe_v1_2_Log::in_error()) { + if(! Joe_v1_3_Log::in_error()) { //Shortcode output - $out .= '

' . __('Add wherever Shortcodes are supported.', Joe_v1_2_Config::get_item('plugin_text_domain')) . '

'; + $out .= '

' . __('Add wherever Shortcodes are supported.', Joe_v1_3_Config::get_item('plugin_text_domain')) . '

'; $out .= '
' . $this->shortcode . '
'; //Actual output @@ -173,10 +173,10 @@ function joe_admin_after_form($out) { function joe_admin_before_form($out) { //Demo - if(Joe_v1_2_Log::has('do_demo')) { - $out .= '

' . sprintf(__('Configure MapShare in the Social tab of your Garmin Explore Account.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'https://explore.garmin.com/Social') . '

'; + if(Joe_v1_3_Log::has('do_demo')) { + $out .= '

' . sprintf(__('Configure MapShare in the Social tab of your Garmin Explore Account.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'https://explore.garmin.com/Social') . '

'; - $out .= '

' . sprintf(__('Important! Even if you have a MapShare password set, this plugin simply uses it to request your data; it does not protect it from being viewed. You are responsible for protecting access if needed.', Joe_v1_2_Config::get_item('plugin_text_domain')), 'https://wordpress.org/support/article/using-password-protection/') . '

'; + $out .= '

' . sprintf(__('Important! Even if you have a MapShare password set, this plugin simply uses it to request your data; it does not protect it from being viewed. You are responsible for protecting access if needed.', Joe_v1_3_Config::get_item('plugin_text_domain')), 'https://wordpress.org/support/article/using-password-protection/') . '

'; } return $out; diff --git a/build/App/Shortcode.php b/build/App/Shortcode.php index c8f030d..6ff7cf3 100644 --- a/build/App/Shortcode.php +++ b/build/App/Shortcode.php @@ -1,6 +1,6 @@ ").attr({ - "href" : "' . Joe_v1_2_Helper::plugin_url('assets/css/leaflet.min.css') . '", + "href" : "' . Joe_v1_3_Helper::plugin_url('assets/css/leaflet.min.css') . '", "rel" : "stylesheet", "id" : "inmap_leaflet_css", "type" : "text/css", @@ -83,7 +83,7 @@ function load_assets() { .append( jQuery("' . "\n"; - echo '' . "\n\n"; + echo '' . "\n\n"; } static function enqueue_styles() { @@ -157,9 +157,9 @@ static function enqueue_styles() { } } - $id = Joe_v1_2_Helper::slug_prefix($count); + $id = Joe_v1_3_Helper::slug_prefix($count); - wp_register_style($id, $url, $deps, Joe_v1_2_Config::get_version()); + wp_register_style($id, $url, $deps, Joe_v1_3_Config::get_version()); wp_enqueue_style($id); $count++; @@ -185,13 +185,13 @@ static function enqueue_scripts() { } //Don't cache when debugging - if(Joe_v1_2_Helper::do_debug()) { + if(Joe_v1_3_Helper::do_debug()) { $enqueue['url'] = add_query_arg('no_cache', rand(0,99999999), $enqueue['url']); } //ID if(! isset($enqueue['id']) || ! $enqueue['id']) { - $enqueue['id'] = Joe_v1_2_Helper::slug_prefix($count); + $enqueue['id'] = Joe_v1_3_Helper::slug_prefix($count); } //Deps @@ -205,7 +205,7 @@ static function enqueue_scripts() { } //Register - wp_register_script($enqueue['id'], $enqueue['url'], $enqueue['deps'], Joe_v1_2_Config::get_version(), $enqueue['in_footer']); + wp_register_script($enqueue['id'], $enqueue['url'], $enqueue['deps'], Joe_v1_3_Config::get_version(), $enqueue['in_footer']); //Localize if(isset($enqueue['data']) && sizeof($enqueue['data'])) { @@ -219,4 +219,4 @@ static function enqueue_scripts() { } } } -Joe_v1_2_Assets::init(); \ No newline at end of file +Joe_v1_3_Assets::init(); \ No newline at end of file diff --git a/build/Joe/Cache.php b/build/Joe/Cache.php index f2177d5..c656715 100644 --- a/build/Joe/Cache.php +++ b/build/Joe/Cache.php @@ -1,20 +1,20 @@ options WHERE option_name LIKE '%s' - ", '_transient_%' . Joe_v1_2_Helper::slug_prefix($cache_id, '_', false) + ", '_transient_%' . Joe_v1_3_Helper::slug_prefix($cache_id, '_', false) ) , ARRAY_A); @@ -32,9 +32,9 @@ static function get_item($cache_id, $check_stale = false) { if(sizeof($results) == 2) { //Get our values foreach($results as $result) { - if($result['option_name'] == '_transient_timeout_' . Joe_v1_2_Helper::slug_prefix($cache_id, '_', false)) { + if($result['option_name'] == '_transient_timeout_' . Joe_v1_3_Helper::slug_prefix($cache_id, '_', false)) { $timeout = $result['option_value']; - } elseif($result['option_name'] == '_transient_' . Joe_v1_2_Helper::slug_prefix($cache_id, '_', false)) { + } elseif($result['option_name'] == '_transient_' . Joe_v1_3_Helper::slug_prefix($cache_id, '_', false)) { $value = $result['option_value']; } } diff --git a/build/Joe/Class.php b/build/Joe/Class.php index 3937af9..31190e9 100644 --- a/build/Joe/Class.php +++ b/build/Joe/Class.php @@ -1,6 +1,6 @@ ' . "\n"; + $out = '
' . "\n"; - $out .= '

' . Joe_v1_2_Config::get_item('plugin_name') . '

' . "\n"; + $out .= '

' . Joe_v1_3_Config::get_item('plugin_name') . '

' . "\n"; - $out .= Joe_v1_2_Config::get_item('plugin_about'); + $out .= Joe_v1_3_Config::get_item('plugin_about'); - $out .= '
' . "\n"; - $out .= '
' . "\n"; + $out .= '
' . "\n"; + $out .= '
' . "\n"; $out .= ' Joe\'s mug' . "\n"; - $out .= '

' . sprintf(__('Hi, I\'m Joe', Joe_v1_2_Config::get_item('plugin_text_domain')), 'https://www.morehawes.co.uk/') . '

' . "\n"; + $out .= '

' . sprintf(__('Hi, I\'m Joe', Joe_v1_3_Config::get_item('plugin_text_domain')), 'https://www.morehawes.co.uk/') . '

' . "\n"; - $out .= '

' . __('This software is open source and maintained voluntarily, please help by contributing however you can.', Joe_v1_2_Config::get_item('plugin_text_domain')) . '

' . "\n"; - $out .= '

' . __('Each question, suggestion, bug report, review, translation and pull request is greatly appreciated.', Joe_v1_2_Config::get_item('plugin_text_domain')) . '

' . "\n"; + $out .= '

' . __('This software is open source and maintained voluntarily, please help by contributing however you can.', Joe_v1_3_Config::get_item('plugin_text_domain')) . '

' . "\n"; + $out .= '

' . __('Each question, suggestion, bug report, review, translation and pull request is greatly appreciated.', Joe_v1_3_Config::get_item('plugin_text_domain')) . '

' . "\n"; $out .= '
    ' . "\n"; //WP.org Directory Link - if(Joe_v1_2_Config::get_item('directory_url') && $directory_url = parse_url(Joe_v1_2_Config::get_item('directory_url'))) { + if(Joe_v1_3_Config::get_item('directory_url') && $directory_url = parse_url(Joe_v1_3_Config::get_item('directory_url'))) { if(isset($directory_url['host']) && ! empty($directory_url['host'])) { - $out .= '
  • ' . $directory_url['host'] . '
  • ' . "\n"; + $out .= '
  • ' . $directory_url['host'] . '
  • ' . "\n"; } } //GitHub Repo Link - if($github_url = parse_url(Joe_v1_2_Config::get_item('github_url'))) { + if($github_url = parse_url(Joe_v1_3_Config::get_item('github_url'))) { if(isset($github_url['host']) && ! empty($github_url['host'])) { - $out .= '
  • ' . $github_url['host'] . '
  • ' . "\n"; + $out .= '
  • ' . $github_url['host'] . '
  • ' . "\n"; } } $out .= '
' . "\n"; - $out .= ' v' . Joe_v1_2_Config::get_item('plugin_version') . '' . "\n"; + $out .= ' v' . Joe_v1_3_Config::get_item('plugin_version') . '' . "\n"; $out .= '
' . "\n"; $out .= '
' . "\n"; $out .= '
' . "\n"; @@ -105,7 +105,7 @@ static public function do_debug() { return (defined('WP_DEBUG') && WP_DEBUG == true) || - (Joe_v1_2_Config::get_setting('joe', 'debug', 'enabled') == 1) + (Joe_v1_3_Config::get_setting('joe', 'debug', 'enabled') == 1) ; } @@ -165,7 +165,7 @@ public static function convert_values_to_single_value($array_in) { //Multiple values } else { //Single value, use that - $array_out[$key] = implode(Joe_v1_2_Config::get_item('multi_value_seperator'), $value); + $array_out[$key] = implode(Joe_v1_3_Config::get_item('multi_value_seperator'), $value); } } @@ -178,7 +178,7 @@ public static function convert_single_value_to_array($value_in) { $array_out = array(); foreach($value_in as $key => $value) { - $multi = explode(Joe_v1_2_Config::get_item('multi_value_seperator'), $value); + $multi = explode(Joe_v1_3_Config::get_item('multi_value_seperator'), $value); $count = 0; foreach($multi as $m) { @@ -191,7 +191,7 @@ public static function convert_single_value_to_array($value_in) { return $array_out; //String } else { - return explode(Joe_v1_2_Config::get_item('multi_value_seperator'), $value_in); + return explode(Joe_v1_3_Config::get_item('multi_value_seperator'), $value_in); } } @@ -206,11 +206,11 @@ static public function get_section_repeatable_count($section_data) { } public static function css_prefix($text = '') { - return Joe_v1_2_Config::get_item('css_prefix') . $text; + return Joe_v1_3_Config::get_item('css_prefix') . $text; } public static function slug_prefix($text = '', $sep = '_', $hyphen = true) { - $out = Joe_v1_2_Config::get_item('plugin_slug') . $sep . $text; + $out = Joe_v1_3_Config::get_item('plugin_slug') . $sep . $text; if(! $hyphen) { $out = str_replace('-', '_', $out); @@ -272,7 +272,7 @@ static public function flatten_meta($data_in) { static public function repeatable_setting_option_array($tab, $section, $key) { $options_array = array(); - $values = Joe_v1_2_Config::get_item($tab, $section, true); + $values = Joe_v1_3_Config::get_item($tab, $section, true); if(! is_array($values)) { return null; @@ -282,7 +282,7 @@ static public function repeatable_setting_option_array($tab, $section, $key) { //If exists if(array_key_exists($key, $s)) { //Add as option - $options_array[Joe_v1_2_Helper::make_key($s[$key])] = $s[$key]; + $options_array[Joe_v1_3_Helper::make_key($s[$key])] = $s[$key]; } } @@ -294,10 +294,10 @@ public static function assoc_array_table($assoc_array) { return false; } - $table = ''; + $table = '
'; foreach($assoc_array as $key => $value) { - $table .= ''; + $table .= ''; $table .= ''; $table .= ''; $table .= ''; @@ -310,23 +310,23 @@ public static function assoc_array_table($assoc_array) { static function time_ago($time = '0', $comparison = false) { $periods_singular = [ - __('Second', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Minute', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Hour', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Day', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Week', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Month', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Year', Joe_v1_2_Config::get_item('plugin_text_domain')) + __('Second', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Minute', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Hour', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Day', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Week', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Month', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Year', Joe_v1_3_Config::get_item('plugin_text_domain')) ]; $periods_plural = [ - __('Seconds', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Minutes', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Hours', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Days', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Weeks', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Months', Joe_v1_2_Config::get_item('plugin_text_domain')), - __('Years', Joe_v1_2_Config::get_item('plugin_text_domain')) + __('Seconds', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Minutes', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Hours', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Days', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Weeks', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Months', Joe_v1_3_Config::get_item('plugin_text_domain')), + __('Years', Joe_v1_3_Config::get_item('plugin_text_domain')) ]; $lengths = array("60","60","24","7","4.35","12", "365"); @@ -338,7 +338,7 @@ static function time_ago($time = '0', $comparison = false) { $difference = $now - $time; } - $tense = __('ago', Joe_v1_2_Config::get_item('plugin_text_domain')); + $tense = __('ago', Joe_v1_3_Config::get_item('plugin_text_domain')); for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; diff --git a/build/Joe/Input.php b/build/Joe/Input.php index 6dfae7e..d77e5c7 100644 --- a/build/Joe/Input.php +++ b/build/Joe/Input.php @@ -1,6 +1,6 @@ esc_attr__('Yes', Joe_v1_2_Config::get_item('plugin_text_domain')), - '0' => esc_attr__('No', Joe_v1_2_Config::get_item('plugin_text_domain')) + '1' => esc_attr__('Yes', Joe_v1_3_Config::get_item('plugin_text_domain')), + '0' => esc_attr__('No', Joe_v1_3_Config::get_item('plugin_text_domain')) ); } } @@ -46,13 +46,13 @@ static public function create_field($field, $set_value = null, $show_label = tru $add_class .= ' ' . $field['id'] . '-container'; //Container - $out .= '
' . "\n"; + $out .= '
' . "\n"; //Label if($show_label && isset($field['title'])) { - $out .= ' ' . "\n"; + $out .= ' ' . "\n"; } - $out .= '
' . "\n"; + $out .= '
' . "\n"; //Prepend? if(array_key_exists('prepend', $field)) { @@ -80,7 +80,7 @@ static public function create_field($field, $set_value = null, $show_label = tru $field['tip'] = ''; } - $field['tip'] .= __('Leave blank to restore the default.', Joe_v1_2_Config::get_item('plugin_text_domain')); + $field['tip'] .= __('Leave blank to restore the default.', Joe_v1_3_Config::get_item('plugin_text_domain')); } } @@ -93,9 +93,9 @@ static public function create_field($field, $set_value = null, $show_label = tru $out .= ' ' . "\n"; + $out .= ' ' . "\n"; + $out .= '
' . $key . '' . $value . '