MapPress Easy Google Maps - Version 2.57.3

Version Description

  • Fixed: notice in multisite admin
  • Fixed: add missing textdomains
Download this release

Release Info

Developer chrisvrichardson
Plugin Icon 128x128 MapPress Easy Google Maps
Version 2.57.3
Comparing to
See all releases

Code changes from version 2.57.2 to 2.57.3

languages/mappress-google-maps-for-wordpress.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the MapPress Maps for WordPress plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: MapPress Maps for WordPress 2.57.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2020-12-16T15:12:38+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
 
@@ -202,10 +202,12 @@ msgstr ""
202
 
203
  #: mappress_map.php:85
204
  #: mappress_settings.php:321
 
205
  msgid "MapPress"
206
  msgstr ""
207
 
208
  #: mappress_map.php:94
 
209
  #: templates_admin/mce.php:30
210
  #: templates_admin/mce.php:80
211
  #: templates_admin/mce.php:86
@@ -213,10 +215,12 @@ msgid "Untitled"
213
  msgstr ""
214
 
215
  #: mappress_map.php:95
 
216
  msgid "Copy of %s"
217
  msgstr ""
218
 
219
  #: mappress_map.php:199
 
220
  msgid "Map not found"
221
  msgstr ""
222
 
2
  # This file is distributed under the same license as the MapPress Maps for WordPress plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: MapPress Maps for WordPress 2.57.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/mappress-google-maps-for-wordpress\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2020-12-17T16:35:51+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
 
202
 
203
  #: mappress_map.php:85
204
  #: mappress_settings.php:321
205
+ #: templates/mappress_map.php:85
206
  msgid "MapPress"
207
  msgstr ""
208
 
209
  #: mappress_map.php:94
210
+ #: templates/mappress_map.php:94
211
  #: templates_admin/mce.php:30
212
  #: templates_admin/mce.php:80
213
  #: templates_admin/mce.php:86
215
  msgstr ""
216
 
217
  #: mappress_map.php:95
218
+ #: templates/mappress_map.php:95
219
  msgid "Copy of %s"
220
  msgstr ""
221
 
222
  #: mappress_map.php:199
223
+ #: templates/mappress_map.php:199
224
  msgid "Map not found"
225
  msgstr ""
226
 
mappress.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: MapPress Maps for WordPress
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
- Version: 2.57.2
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
@@ -37,7 +37,7 @@ if (is_dir(dirname( __FILE__ ) . '/pro')) {
37
  }
38
 
39
  class Mappress {
40
- const VERSION = '2.57.2';
41
 
42
  static
43
  $baseurl,
@@ -168,8 +168,8 @@ class Mappress {
168
  // Settings
169
  $settings = (self::$pro) ? new Mappress_Pro_Settings() : new Mappress_Settings();
170
  self::$pages[] = add_menu_page('MapPress', 'MapPress', 'manage_options', 'mappress', array(&$settings, 'options_page'), 'dashicons-location');
171
- self::$pages[] = add_submenu_page('mappress', __('Settings'), __('Settings'), 'manage_options', 'mappress', array(&$settings, 'options_page'));
172
- self::$pages[] = add_submenu_page('mappress', __('Map Library'), __('Map Library'), 'manage_options', 'mappress_maps', array(__CLASS__, 'map_library'));
173
  }
174
 
175
  static function admin_notices() {
@@ -180,12 +180,12 @@ class Mappress {
180
 
181
  // Non-dismissible notices
182
  if (!$exists) {
183
- printf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this."));
184
  return;
185
  }
186
 
187
  if (self::$options->engine != 'leaflet' && !self::get_api_keys()->browser)
188
- printf($error, sprintf("%s. %s <a href='%s'>%s</a>.", __("A Google Maps API key is required"), __("Please update your"), admin_url('admin.php?page=mappress'), __('MapPress Settings')));
189
 
190
  // Dismissibles
191
  if (is_super_admin()) {
@@ -263,7 +263,7 @@ class Mappress {
263
  }
264
 
265
  static function current_screen($screen) {
266
- if ($screen && $screen->id == self::$pages[0] && !self::$pro) {
267
  $first_time = get_option('mappress_review');
268
  if (!$first_time) {
269
  update_option('mappress_review', time());
@@ -277,13 +277,13 @@ class Mappress {
277
  if (count($ids) < 3)
278
  return;
279
 
280
- $review_link = sprintf("<a class='button button-primary mapp-dismiss' href='https://wordpress.org/support/view/plugin-reviews/mappress-google-maps-for-wordpress?filter=5' target='_blank'>%s</a>", __('OK, you deserve it!'));
281
- $no_link = sprintf("<a class='button mapp-dismiss' href='#'>%s</a>", __('Nope, maybe later'));
282
- $help_link = sprintf("<a class='mapp-dismiss' href='https://mappresspro.com/chris-contact' target='_blank'>%s</a>", __('I neeed some help'));
283
  $body = "<div class='mapp-review'>";
284
- $body .= "<h3>" . __("Please Help Spread the Word") . "</h3>";
285
- $body .= "<p>" . __("If you're enjoying MapPress, would you mind taking a moment to write a brief review? It would mean the world to me!") . "</p>";
286
- $body .= "<p>" . __("If you have any issues or suggestions, please let me know. I'll be happy to help!") . "</p>";
287
  $body .= "<p>" . "~ Chris Richardson" . "</p>";
288
  $body .= "<div class='mapp-review-options'>" . $review_link . $no_link . $help_link . "</div>";
289
  $body .= "</div>";
@@ -399,11 +399,11 @@ class Mappress {
399
 
400
  static function get_support_links() {
401
  $html = "<div class='mapp-support'>";
402
- $html .= __('Version') . ' ';
403
  $html .= self::$version;
404
- $html .= " | <a target='_blank' href='https://mappresspro.com/mappress/mappress-documentation'>" . __('Help') . "</a>";
405
  if (!self::$pro)
406
- $html .= "<a class='button button-primary' href='https://mappresspro.com/mappress' target='_blank'>" . __('Upgrade to MapPress Pro') . "</a>";
407
  $html .= "</div>";
408
  echo $html;
409
  }
@@ -470,22 +470,22 @@ class Mappress {
470
 
471
  // Missing license
472
  if (self::$pro && !trim(self::$options->license) && (!is_multisite() || (is_super_admin() && is_main_site())))
473
- self::$notices['nolicense'] = array('warning', __('Please enter your MapPress license key to enable plugin updates'));
474
 
475
  // WP minimum version
476
  if (self::VERSION >= '2.55' && version_compare(get_bloginfo('version'),'5.3', '<') )
477
- self::$notices['255_min_version'] = array('error', __('MapPress Gutenberg blocks require WordPress 5.3 or the latest Gutenberg Plugin. Please update if using the block editor.'));
478
 
479
  // New features
480
  if ($current_version && $current_version < '2.55' and self::VERSION >= '2.55')
481
- self::$notices['255_whats_new'] = array('info', sprintf(__('MapPress has many new features! Please take a moment to learn %s.'), '<a target="_blank" href="https://mappresspro.com/whats-new">' . __("what's new") . '</a>'));
482
 
483
  // New MCE editor
484
  if ($current_version && $current_version < '2.57') {
485
  $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'mappress_dismissed', true ) ) );
486
  if (!in_array('257_new_editor', $dismissed)) {
487
- $header = sprintf("<h3>%s</h3>", __("The MapPress map editor has moved!"));
488
- $content = sprintf("<p>%s</p>", __('Use this button to open the new popup editor where you can easily create, edit and insert maps.'));
489
  self::$pointers['257_new_editor'] = $header . $content;
490
  }
491
  }
@@ -531,16 +531,16 @@ class Mappress {
531
  global $post;
532
 
533
  $l10n = array(
534
- 'delete_prompt' => __('Are you sure you want to delete?'),
535
- 'delete_map_prompt' => __('Permanently delete this map from the map library?'),
536
- 'kml_error' => __('Error reading KML file'),
537
- 'layer' => __('URL for KML file'),
538
- 'loading' => "<span class='mapp-spinner'></span>" . __('Loading'),
539
- 'need_classic' => __('Please select a classic editor block to insert into.'),
540
- 'no_geolocate' => __('Unable to get your location'),
541
- 'no_results' => __('No results'),
542
- 'save' => __('Save changes?'),
543
- 'shape' => __('Shape')
544
  );
545
 
546
  // Globals
@@ -569,7 +569,7 @@ class Mappress {
569
  $providers = array(
570
  'mapbox' => array(
571
  'accessToken' => self::get_api_keys()->mapbox,
572
- 'attribution' => "<a href='https://www.mapbox.com/about/maps/' target='_blank'>&copy; Mapbox &copy; OpenStreetMap</a> <a class='mapbox-improve-map' href='https://www.mapbox.com/map-feedback/' target='_blank'>" . __('Improve this map') . "</a>",
573
  'fresh' => true, // Fresh = true in order to provide updated studio styles
574
  'url' => "https://api.mapbox.com/styles/v1/{user}/{id}/tiles/256/{z}/{x}/{y}{r}?access_token={accessToken}&fresh={fresh}",
575
  'zoomOffset' => 0
@@ -585,12 +585,12 @@ class Mappress {
585
  $baselayers = array();
586
  if (self::get_api_keys()->mapbox) {
587
  $baselayers = array(
588
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'streets-v10', 'name' => 'streets', 'label' => __('Streets')),
589
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'outdoors-v10', 'name' => 'outdoors', 'label' => __('Outdoors')),
590
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'light-v9', 'name' => 'light', 'label' => __('Light')),
591
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'dark-v9', 'name' => 'dark', 'label' => __('Dark')),
592
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'satellite-v9', 'name' => 'satellite', 'label' => __('Satellite')),
593
- array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'satellite-streets-v10', 'name' => 'satellite-streets', 'label' => __('Satellite Streets'))
594
  );
595
 
596
  // Mapbox studio styles - extract user/id from url
@@ -604,7 +604,7 @@ class Mappress {
604
  }
605
  } else {
606
  $baselayers = array(
607
- array('provider' => 'osm', 'id' => 'osm', 'name' => 'osm', 'label' => __('Streets'))
608
  );
609
  }
610
  $l10n['options']['baseLayers'] = $baselayers;
@@ -698,7 +698,7 @@ class Mappress {
698
  }
699
 
700
  static function plugin_action_links($links, $file) {
701
- $settings_link = "<a href='" . admin_url("admin.php?page=mappress") . "'>" . __('Settings') . "</a>";
702
  array_unshift( $links, $settings_link );
703
  return $links;
704
  }
@@ -928,7 +928,7 @@ class Mappress {
928
  }
929
 
930
  static function wp_head() {
931
- echo "\r\n<!-- MapPress Easy Google Maps " . __('Version') . ':' . self::$version . " (http://www.mappresspro.com/mappress) -->\r\n";
932
  echo "<script type='text/javascript'>mapp = window.mapp || {}; mapp.data = [];</script>\r\n";
933
  }
934
  }
4
  Plugin URI: https://www.mappresspro.com/mappress
5
  Author URI: https://www.mappresspro.com/chris-contact
6
  Description: MapPress makes it easy to add Google and Leaflet Maps to WordPress
7
+ Version: 2.57.3
8
  Author: Chris Richardson
9
  Text Domain: mappress-google-maps-for-wordpress
10
  Thanks to all the translators and to Matthias Stasiak for his wonderful icons (http://code.google.com/p/google-maps-icons/)
37
  }
38
 
39
  class Mappress {
40
+ const VERSION = '2.57.3';
41
 
42
  static
43
  $baseurl,
168
  // Settings
169
  $settings = (self::$pro) ? new Mappress_Pro_Settings() : new Mappress_Settings();
170
  self::$pages[] = add_menu_page('MapPress', 'MapPress', 'manage_options', 'mappress', array(&$settings, 'options_page'), 'dashicons-location');
171
+ self::$pages[] = add_submenu_page('mappress', __('Settings', 'mappress-google-maps-for-wordpress'), __('Settings', 'mappress-google-maps-for-wordpress'), 'manage_options', 'mappress', array(&$settings, 'options_page'));
172
+ self::$pages[] = add_submenu_page('mappress', __('Map Library', 'mappress-google-maps-for-wordpress'), __('Map Library', 'mappress-google-maps-for-wordpress'), 'manage_options', 'mappress_maps', array(__CLASS__, 'map_library'));
173
  }
174
 
175
  static function admin_notices() {
180
 
181
  // Non-dismissible notices
182
  if (!$exists) {
183
+ printf($error, __("MapPress database tables are missing. Please deactivate the plugin and activate it again to fix this.", 'mappress-google-maps-for-wordpress'));
184
  return;
185
  }
186
 
187
  if (self::$options->engine != 'leaflet' && !self::get_api_keys()->browser)
188
+ printf($error, sprintf("%s. %s <a href='%s'>%s</a>.", __("A Google Maps API key is required", 'mappress-google-maps-for-wordpress'), __("Please update your", 'mappress-google-maps-for-wordpress'), admin_url('admin.php?page=mappress'), __('MapPress Settings', 'mappress-google-maps-for-wordpress')));
189
 
190
  // Dismissibles
191
  if (is_super_admin()) {
263
  }
264
 
265
  static function current_screen($screen) {
266
+ if ($screen && self::$pages && $screen->id == self::$pages[0] && !self::$pro) {
267
  $first_time = get_option('mappress_review');
268
  if (!$first_time) {
269
  update_option('mappress_review', time());
277
  if (count($ids) < 3)
278
  return;
279
 
280
+ $review_link = sprintf("<a class='button button-primary mapp-dismiss' href='https://wordpress.org/support/view/plugin-reviews/mappress-google-maps-for-wordpress?filter=5' target='_blank'>%s</a>", __('OK, you deserve it!', 'mappress-google-maps-for-wordpress'));
281
+ $no_link = sprintf("<a class='button mapp-dismiss' href='#'>%s</a>", __('Nope, maybe later', 'mappress-google-maps-for-wordpress'));
282
+ $help_link = sprintf("<a class='mapp-dismiss' href='https://mappresspro.com/chris-contact' target='_blank'>%s</a>", __('I neeed some help', 'mappress-google-maps-for-wordpress'));
283
  $body = "<div class='mapp-review'>";
284
+ $body .= "<h3>" . __("Please Help Spread the Word", 'mappress-google-maps-for-wordpress') . "</h3>";
285
+ $body .= "<p>" . __("If you're enjoying MapPress, would you mind taking a moment to write a brief review? It would mean the world to me!", 'mappress-google-maps-for-wordpress') . "</p>";
286
+ $body .= "<p>" . __("If you have any issues or suggestions, please let me know. I'll be happy to help!", 'mappress-google-maps-for-wordpress') . "</p>";
287
  $body .= "<p>" . "~ Chris Richardson" . "</p>";
288
  $body .= "<div class='mapp-review-options'>" . $review_link . $no_link . $help_link . "</div>";
289
  $body .= "</div>";
399
 
400
  static function get_support_links() {
401
  $html = "<div class='mapp-support'>";
402
+ $html .= __('Version', 'mappress-google-maps-for-wordpress') . ' ';
403
  $html .= self::$version;
404
+ $html .= " | <a target='_blank' href='https://mappresspro.com/mappress/mappress-documentation'>" . __('Help', 'mappress-google-maps-for-wordpress') . "</a>";
405
  if (!self::$pro)
406
+ $html .= "<a class='button button-primary' href='https://mappresspro.com/mappress' target='_blank'>" . __('Upgrade to MapPress Pro', 'mappress-google-maps-for-wordpress') . "</a>";
407
  $html .= "</div>";
408
  echo $html;
409
  }
470
 
471
  // Missing license
472
  if (self::$pro && !trim(self::$options->license) && (!is_multisite() || (is_super_admin() && is_main_site())))
473
+ self::$notices['nolicense'] = array('warning', __('Please enter your MapPress license key to enable plugin updates', 'mappress-google-maps-for-wordpress'));
474
 
475
  // WP minimum version
476
  if (self::VERSION >= '2.55' && version_compare(get_bloginfo('version'),'5.3', '<') )
477
+ self::$notices['255_min_version'] = array('error', __('MapPress Gutenberg blocks require WordPress 5.3 or the latest Gutenberg Plugin. Please update if using the block editor.', 'mappress-google-maps-for-wordpress'));
478
 
479
  // New features
480
  if ($current_version && $current_version < '2.55' and self::VERSION >= '2.55')
481
+ self::$notices['255_whats_new'] = array('info', sprintf(__('MapPress has many new features! Please take a moment to learn %s.', 'mappress-google-maps-for-wordpress'), '<a target="_blank" href="https://mappresspro.com/whats-new">' . __("what's new", 'mappress-google-maps-for-wordpress') . '</a>'));
482
 
483
  // New MCE editor
484
  if ($current_version && $current_version < '2.57') {
485
  $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'mappress_dismissed', true ) ) );
486
  if (!in_array('257_new_editor', $dismissed)) {
487
+ $header = sprintf("<h3>%s</h3>", __("The MapPress map editor has moved!", 'mappress-google-maps-for-wordpress'));
488
+ $content = sprintf("<p>%s</p>", __('Use this button to open the new popup editor where you can easily create, edit and insert maps.', 'mappress-google-maps-for-wordpress'));
489
  self::$pointers['257_new_editor'] = $header . $content;
490
  }
491
  }
531
  global $post;
532
 
533
  $l10n = array(
534
+ 'delete_prompt' => __('Are you sure you want to delete?', 'mappress-google-maps-for-wordpress'),
535
+ 'delete_map_prompt' => __('Permanently delete this map from the map library?', 'mappress-google-maps-for-wordpress'),
536
+ 'kml_error' => __('Error reading KML file', 'mappress-google-maps-for-wordpress'),
537
+ 'layer' => __('URL for KML file', 'mappress-google-maps-for-wordpress'),
538
+ 'loading' => "<span class='mapp-spinner'></span>" . __('Loading', 'mappress-google-maps-for-wordpress'),
539
+ 'need_classic' => __('Please select a classic editor block to insert into.', 'mappress-google-maps-for-wordpress'),
540
+ 'no_geolocate' => __('Unable to get your location', 'mappress-google-maps-for-wordpress'),
541
+ 'no_results' => __('No results', 'mappress-google-maps-for-wordpress'),
542
+ 'save' => __('Save changes?', 'mappress-google-maps-for-wordpress'),
543
+ 'shape' => __('Shape', 'mappress-google-maps-for-wordpress')
544
  );
545
 
546
  // Globals
569
  $providers = array(
570
  'mapbox' => array(
571
  'accessToken' => self::get_api_keys()->mapbox,
572
+ 'attribution' => "<a href='https://www.mapbox.com/about/maps/' target='_blank'>&copy; Mapbox &copy; OpenStreetMap</a> <a class='mapbox-improve-map' href='https://www.mapbox.com/map-feedback/' target='_blank'>" . __('Improve this map', 'mappress-google-maps-for-wordpress') . "</a>",
573
  'fresh' => true, // Fresh = true in order to provide updated studio styles
574
  'url' => "https://api.mapbox.com/styles/v1/{user}/{id}/tiles/256/{z}/{x}/{y}{r}?access_token={accessToken}&fresh={fresh}",
575
  'zoomOffset' => 0
585
  $baselayers = array();
586
  if (self::get_api_keys()->mapbox) {
587
  $baselayers = array(
588
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'streets-v10', 'name' => 'streets', 'label' => __('Streets', 'mappress-google-maps-for-wordpress')),
589
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'outdoors-v10', 'name' => 'outdoors', 'label' => __('Outdoors', 'mappress-google-maps-for-wordpress')),
590
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'light-v9', 'name' => 'light', 'label' => __('Light', 'mappress-google-maps-for-wordpress')),
591
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'dark-v9', 'name' => 'dark', 'label' => __('Dark', 'mappress-google-maps-for-wordpress')),
592
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'satellite-v9', 'name' => 'satellite', 'label' => __('Satellite', 'mappress-google-maps-for-wordpress')),
593
+ array('provider' => 'mapbox', 'user' => 'mapbox', 'id' => 'satellite-streets-v10', 'name' => 'satellite-streets', 'label' => __('Satellite Streets', 'mappress-google-maps-for-wordpress'))
594
  );
595
 
596
  // Mapbox studio styles - extract user/id from url
604
  }
605
  } else {
606
  $baselayers = array(
607
+ array('provider' => 'osm', 'id' => 'osm', 'name' => 'osm', 'label' => __('Streets', 'mappress-google-maps-for-wordpress'))
608
  );
609
  }
610
  $l10n['options']['baseLayers'] = $baselayers;
698
  }
699
 
700
  static function plugin_action_links($links, $file) {
701
+ $settings_link = "<a href='" . admin_url("admin.php?page=mappress") . "'>" . __('Settings', 'mappress-google-maps-for-wordpress') . "</a>";
702
  array_unshift( $links, $settings_link );
703
  return $links;
704
  }
928
  }
929
 
930
  static function wp_head() {
931
+ echo "\r\n<!-- MapPress Easy Google Maps " . __('Version', 'mappress-google-maps-for-wordpress') . ':' . self::$version . " (http://www.mappresspro.com/mappress) -->\r\n";
932
  echo "<script type='text/javascript'>mapp = window.mapp || {}; mapp.data = [];</script>\r\n";
933
  }
934
  }
mappress_controls.php CHANGED
@@ -90,7 +90,7 @@ class Mappress_Controls {
90
  }
91
  $html .= "</tbody>";
92
  $html .= "</table>";
93
- $html .= "<button type='button' class='button' data-mapp-action='add'>" . __('Add') . "</button>";
94
  $html .= Mappress::script_template($template);
95
  $html .= "</div>";
96
  return $html;
@@ -99,7 +99,7 @@ class Mappress_Controls {
99
  static function grid_row($row, $sortable) {
100
  if ($sortable)
101
  array_unshift($row, '<span class="mapp-handle dashicons dashicons-menu"></span>');
102
- $row[] = "<span data-mapp-action='remove' class='mapp-close' title='" . __('Delete') . "'></span>";
103
  return self::table_row($row);
104
  }
105
 
90
  }
91
  $html .= "</tbody>";
92
  $html .= "</table>";
93
+ $html .= "<button type='button' class='button' data-mapp-action='add'>" . __('Add', 'mappress-google-maps-for-wordpress') . "</button>";
94
  $html .= Mappress::script_template($template);
95
  $html .= "</div>";
96
  return $html;
99
  static function grid_row($row, $sortable) {
100
  if ($sortable)
101
  array_unshift($row, '<span class="mapp-handle dashicons dashicons-menu"></span>');
102
+ $row[] = "<span data-mapp-action='remove' class='mapp-close' title='" . __('Delete', 'mappress-google-maps-for-wordpress') . "'></span>";
103
  return self::table_row($row);
104
  }
105
 
mappress_map.php CHANGED
@@ -82,7 +82,7 @@ class Mappress_Map extends Mappress_Obj {
82
  static function media_buttons($editor_id) {
83
  if ($editor_id == 'content') {
84
  echo '<button type="button" class="button mapp-media-button">';
85
- echo '<span class="wp-media-buttons-icon dashicons dashicons-location"></span> ' . __('MapPress') . '</button>';
86
  }
87
  }
88
 
@@ -91,8 +91,8 @@ class Mappress_Map extends Mappress_Obj {
91
  if (!$map)
92
  return null;
93
 
94
- $title = ($map->title) ? $map->title : __('Untitled');
95
- $map->title = sprintf(__('Copy of %s'), $title);
96
 
97
  $map->postid = $postid;
98
  $map->mapid = null;
@@ -196,7 +196,7 @@ class Mappress_Map extends Mappress_Obj {
196
  $mapid = (isset($_GET['mapid'])) ? $_GET['mapid'] : null;
197
  $map = ($mapid) ? self::get($mapid) : null;
198
  if (!$map)
199
- Mappress::ajax_response(sprintf(__('Map not found'), $mapid));
200
  else
201
  Mappress::ajax_response('OK', $map);
202
  }
82
  static function media_buttons($editor_id) {
83
  if ($editor_id == 'content') {
84
  echo '<button type="button" class="button mapp-media-button">';
85
+ echo '<span class="wp-media-buttons-icon dashicons dashicons-location"></span> ' . __('MapPress', 'mappress-google-maps-for-wordpress') . '</button>';
86
  }
87
  }
88
 
91
  if (!$map)
92
  return null;
93
 
94
+ $title = ($map->title) ? $map->title : __('Untitled', 'mappress-google-maps-for-wordpress');
95
+ $map->title = sprintf(__('Copy of %s', 'mappress-google-maps-for-wordpress'), $title);
96
 
97
  $map->postid = $postid;
98
  $map->mapid = null;
196
  $mapid = (isset($_GET['mapid'])) ? $_GET['mapid'] : null;
197
  $map = ($mapid) ? self::get($mapid) : null;
198
  if (!$map)
199
+ Mappress::ajax_response(sprintf(__('Map not found', 'mappress-google-maps-for-wordpress'), $mapid));
200
  else
201
  Mappress::ajax_response('OK', $map);
202
  }
mappress_settings.php CHANGED
@@ -83,52 +83,52 @@ class Mappress_Settings {
83
  function admin_init() {
84
  register_setting('mappress', self::$basename, array($this, 'validate'));
85
 
86
- $this->add_section('demo', __('Sample Map'));
87
 
88
- $this->add_section('basic', __('Basic Settings'));
89
- $this->add_field('engine', __('Mapping API'), 'basic');
90
 
91
  if ($this->options->engine == 'google')
92
- $this->add_field('apiKey', __('Google API key'), 'basic');
93
 
94
  if ($this->options->engine == 'leaflet')
95
- $this->add_field('mapbox', __('Mapbox access token'), 'basic');
96
 
97
  // License: single blogs, or main blog on multisite
98
  if (Mappress::$pro && (!is_multisite() || (is_super_admin() && is_main_site())) )
99
- $this->add_section('license', __('License'));
100
 
101
- $this->add_section('maps', __('Map Settings'));
102
- $this->add_field('postTypes', __('Post types'), 'maps');
103
- $this->add_field('autodisplay', __('Automatic display'), 'maps');
104
- $this->add_field('alignment', __('Map alignment'), 'maps');
105
- $this->add_field('directions', __('Directions'), 'maps');
106
  // TBD $this->add_field('mapOptions', __('Map options'), 'maps');
107
 
108
- $this->add_section('pois', __('POI Settings'));
109
- $this->add_field('poiZoom', __('Default zoom'), 'pois');
110
- $this->add_field('initialOpenInfo', __('Open first POI'), 'pois');
111
 
112
  if (Mappress::$pro) {
113
- $this->add_section('mashups', __('Mashups'));
114
- $this->add_section('icons', __('Icons'));
115
- $this->add_section('styles', __('Styled Maps'));
116
- $this->add_section('geocoding', __('Geocoding'));
117
- $this->add_section('templates', __('Templates'));
118
  }
119
 
120
- $this->add_section('l10n', __('Localization'));
121
- $this->add_field('language', __('Search language'), 'l10n');
122
- $this->add_field('country', __('Search country'), 'l10n');
123
- $this->add_field('directionsServer', __('Directions server'), 'l10n');
124
 
125
- $this->add_section('misc', __('Miscellaneous'));
126
- $this->add_field('sizes', __('Map sizes'), 'misc');
127
- $this->add_field('footer', __('Scripts'), 'misc');
128
  $this->add_field('wpml', 'WPML', 'misc');
129
 
130
  if ($this->options->engine != 'leaflet')
131
- $this->add_field('deregister', __('Compatiblity'), 'misc');
132
  }
133
 
134
  function add_section($section, $title) {
@@ -172,10 +172,10 @@ class Mappress_Settings {
172
 
173
  function set_alignment($name) {
174
  $alignments = array(
175
- '' => __('Default'),
176
- 'center' => __('Center'),
177
- 'left' => __('Left'),
178
- 'right' => __('Right')
179
  );
180
  echo Mappress_Controls::radios($name, $alignments, $this->options->alignment);
181
  }
@@ -187,29 +187,29 @@ class Mappress_Settings {
187
 
188
  function set_autodisplay($name) {
189
  $autos = array(
190
- '' => __('None'),
191
- 'top' => __('Top of post'),
192
- 'bottom' => __('Bottom of post')
193
  );
194
  echo Mappress_Controls::radios($name, $autos, $this->options->autodisplay);
195
  }
196
 
197
  function set_country($name) {
198
  $url = 'https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements';
199
- $link = sprintf('<a style="vertical-align:text-bottom" target="_blank" href="%s">%s</a>', $url, __("(list)"));
200
  $codes = array('', 'AF' ,'AX' ,'AL' ,'DZ' ,'AS' ,'AD' ,'AO' ,'AI' ,'AQ' ,'AG' ,'AR' ,'AM' ,'AW' ,'AU' ,'AT' ,'AZ' ,'BS' ,'BH' ,'BD' ,'BB' ,'BY' ,'BE' ,'BZ' ,'BJ' ,'BM' ,'BT' ,'BO' ,'BQ' ,'BA' ,'BW' ,'BV' ,'BR' ,'IO' ,'VG' ,'BN' ,'BG' ,'BF' ,'BI' ,'KH' ,'CM' ,'CA' ,'CV' ,'KY' ,'CF' ,'TD' ,'CL' ,'CN' ,'CX' ,'CC' ,'CO' ,'KM' ,'CK' ,'CR' ,'HR' ,'CU' ,'CW' ,'CY' ,'CZ' ,'CD' ,'DK' ,'DJ' ,'DM' ,'DO' ,'EC' ,'EG' ,'SV' ,'GQ' ,'ER' ,'EE' ,'ET' ,'FK' ,'FO' ,'FJ' ,'FI' ,'FR' ,'GF' ,'PF' ,'TF' ,'GA' ,'GM' ,'GE' ,'DE' ,'GH' ,'GI' ,'GR' ,'GL' ,'GD' ,'GP' ,'GU' ,'GT' ,'GG' ,'GN' ,'GW' ,'GY' ,'HT' ,'HM' ,'HN' ,'HK' ,'HU' ,'IS' ,'IN' ,'ID' ,'IR' ,'IQ' ,'IE' ,'IM' ,'IL' ,'IT' ,'CI' ,'JM' ,'JP' ,'JE' ,'JO' ,'KZ' ,'KE' ,'KI' ,'XK' ,'KW' ,'KG' ,'LA' ,'LV' ,'LB' ,'LS' ,'LR' ,'LY' ,'LI' ,'LT' ,'LU' ,'MO' ,'MK' ,'MG' ,'MW' ,'MY' ,'MV' ,'ML' ,'MT' ,'MH' ,'MQ' ,'MR' ,'MU' ,'YT' ,'MX' ,'FM' ,'MD' ,'MC' ,'MN' ,'ME' ,'MS' ,'MA' ,'MZ' ,'MM' ,'NA' ,'NR' ,'NP' ,'NL' ,'AN' ,'NC' ,'NZ' ,'NI' ,'NE' ,'NG' ,'NU' ,'NF' ,'KP' ,'MP' ,'NO' ,'OM' ,'PK' ,'PW' ,'PS' ,'PA' ,'PG' ,'PY' ,'PE' ,'PH' ,'PN' ,'PL' ,'PT' ,'PR' ,'QA' ,'CG' ,'RE' ,'RO' ,'RU' ,'RW' ,'BL' ,'SH' ,'KN' ,'LC' ,'MF' ,'PM' ,'VC' ,'WS' ,'SM' ,'ST' ,'SA' ,'SN' ,'RS' ,'SC' ,'SL' ,'SG' ,'SX' ,'SK' ,'SI' ,'SB' ,'SO' ,'ZA' ,'GS' ,'KR' ,'SS' ,'ES' ,'LK' ,'SD' ,'SR' ,'SJ' ,'SZ' ,'SE' ,'CH' ,'SY' ,'TW' ,'TJ' ,'TZ' ,'TH' ,'TL' ,'TG' ,'TK' ,'TO' ,'TT' ,'TN' ,'TR' ,'TM' ,'TC' ,'TV' ,'VI' ,'UG' ,'UA' ,'AE' ,'GB' ,'US' ,'UM' ,'UY' ,'UZ' ,'VU' ,'VA' ,'VE' ,'VN' ,'WF' ,'EH' ,'YE' ,'ZM' ,'ZW');
201
  sort($codes);
202
  $codes = array_combine($codes, $codes);
203
  echo Mappress_Controls::select($name, $codes, $this->options->country);
204
- echo ' ' . __("Country code for searches") . ' ' . $link;
205
  }
206
 
207
  function set_deregister($name) {
208
- echo Mappress_Controls::checkmark($name, $this->options->deregister, __('Prevent other plugins/themes from loading the Google Maps API'));
209
  }
210
 
211
  function set_directions($name) {
212
- $directions_types = array('google' => __('Google'), 'inline' => __('Inline'));
213
  echo Mappress_Controls::radios($name, $directions_types, $this->options->directions);
214
  }
215
 
@@ -218,49 +218,49 @@ class Mappress_Settings {
218
  }
219
 
220
  function set_engine($name) {
221
- $engines = array('leaflet' => __('Leaflet'), 'google' => __('Google'));
222
  echo Mappress_Controls::radios($name, $engines, $this->options->engine);
223
- echo Mappress_Controls::help(__('Leaflet is free and requires no API key. Google requires an API key and has strict usage limits.'), '#toc-picking-a-mapping-api');
224
  }
225
 
226
  function set_footer($name) {
227
  // Disable if jetpack infinite scroll is used
228
  if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' )) {
229
- echo Mappress_Controls::checkmark($name, false, __('Output scripts in footer'), array('disabled' => true));
230
- printf("<br/><i>%s</i>", __('Disabled because Jetpack Infinite Scroll is active'));
231
  } else {
232
- echo Mappress_Controls::checkmark($name, $this->options->footer, __('Output scripts in footer'));
233
- printf("<br/><i>(%s)</i>", __('disable if maps are output using AJAX'));
234
  }
235
  }
236
 
237
  function set_initial_open_info($name) {
238
- echo Mappress_Controls::checkmark($name, $this->options->initialOpenInfo, __('Open first POI'));
239
  }
240
 
241
  function set_language($name) {
242
  $url = ($this->options->engine == 'leaflet') ? 'https://en.wikipedia.org/wiki/ISO_639-1' : 'http://code.google.com/apis/maps/faq.html#languagesupport';
243
- $lang_link = sprintf('<a style="vertical-align:text-bottom" target="_blank" href="%s">%s</a>', $url, __("(list)"));
244
- $langs = array('' => __('Default'), 'ab' => 'Abkhazian', 'aa' => 'Afar', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'bm' => 'Bambara', 'ba' => 'Bashkir', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari languages', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan, Valencian', 'km' => 'Central Khmer', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'ny' => 'Chichewa, Chewa, Nyanja', 'zh' => 'Chinese', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi, Dhivehi, Maldivian', 'nl' => 'Dutch, Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijian', 'fi' => 'Finnish', 'fr' => 'French', 'ff' => 'Fulah', 'gd' => 'Gaelic, Scottish Gaelic', 'gl' => 'Galician', 'lg' => 'Ganda', 'ka' => 'Georgian', 'de' => 'German', 'ki' => 'Gikuyu, Kikuyu', 'el' => 'Greek (Modern)', 'kl' => 'Greenlandic, Kalaallisut', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian, Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'io' => 'Ido', 'ig' => 'Igbo', 'id' => 'Indonesian', 'iu' => 'Inuktitut', 'ik' => 'Inupiaq', 'ga' => 'Irish', 'it' => 'Italian', 'ja' => 'Japanese', 'jv' => 'Javanese', 'kn' => 'Kannada', 'kr' => 'Kanuri', 'ks' => 'Kashmiri', 'kk' => 'Kazakh', 'rw' => 'Kinyarwanda', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kwanyama, Kuanyama', 'ku' => 'Kurdish', 'ky' => 'Kyrgyz', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'lb' => 'Letzeburgesch, Luxembourgish', 'li' => 'Limburgish, Limburgan, Limburger', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lu' => 'Luba-Katanga', 'mk' => 'Macedonian', 'mg' => 'Malagasy', 'ms' => 'Malay', 'ml' => 'Malayalam', 'mt' => 'Maltese', 'gv' => 'Manx', 'mi' => 'Maori', 'mr' => 'Marathi', 'mh' => 'Marshallese', 'ro' => 'Moldovan, Moldavian, Romanian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo, Navaho', 'nd' => 'Northern Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'se' => 'Northern Sami', 'no' => 'Norwegian', 'nb' => 'Norwegian Bokmål', 'nn' => 'Norwegian Nynorsk', 'ii' => 'Nuosu, Sichuan Yi', 'oc' => 'Occitan (post 1500)', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian, Ossetic', 'pi' => 'Pali', 'pa' => 'Panjabi, Punjabi', 'ps' => 'Pashto, Pushto', 'fa' => 'Persian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'qu' => 'Quechua', 'rm' => 'Romansh', 'rn' => 'Rundi', 'ru' => 'Russian', 'sm' => 'Samoan', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sc' => 'Sardinian', 'sr' => 'Serbian', 'sn' => 'Shona', 'sd' => 'Sindhi', 'si' => 'Sinhala, Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'nr' => 'South Ndebele', 'es' => 'Spanish, Castilian', 'su' => 'Sundanese', 'sw' => 'Swahili', 'ss' => 'Swati', 'sv' => 'Swedish', 'tl' => 'Tagalog', 'ty' => 'Tahitian', 'tg' => 'Tajik', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'ts' => 'Tsonga', 'tn' => 'Tswana', 'tr' => 'Turkish', 'tk' => 'Turkmen', 'tw' => 'Twi', 'ug' => 'Uighur, Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volap_k', 'wa' => 'Walloon', 'cy' => 'Welsh', 'fy' => 'Western Frisian', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang, Chuang', 'zu' => 'Zulu');
245
  echo Mappress_Controls::select($name, $langs, $this->options->language);
246
- echo ' ' . __('Language for searches and Google map controls') . ' ' . $lang_link;
247
  }
248
 
249
  function set_mapbox($name) {
250
- echo Mappress_Controls::input($name, $this->options->mapbox, array('size' => '50', 'placeholder' => __('Enter token to use Mapbox map tiles')));
251
  echo Mappress_Controls::help('', 'https://www.mapbox.com/help/define-access-token/');
252
  }
253
 
254
  function set_map_options($name) {
255
  $labels = array(
256
  'google' => array(
257
- 'mapTypeControl' => __('Map type control'),
258
- 'streetViewControl' => __("Street view control"),
259
- 'zoomControl' => __('Zoom control')
260
  ),
261
  'leaflet' => array(
262
- 'mapTypeControl' => __('Map type control'),
263
- 'zoomControl' => __('Zoom control')
264
  )
265
  );
266
 
@@ -275,7 +275,7 @@ class Mappress_Settings {
275
  function set_poi_zoom($name) {
276
  $zooms = array_combine(range(1, 17), range(1,17));
277
  echo Mappress_Controls::select($name, $zooms, (int) $this->options->poiZoom);
278
- echo __("Default zoom when displaying a single POI");
279
  }
280
 
281
  function set_post_types($name) {
@@ -288,7 +288,7 @@ class Mappress_Settings {
288
  $poi = new Mappress_Poi(array(
289
  'address' => 'San Francisco, CA',
290
  "title" => "MapPress",
291
- "body" => __("Easy Google Maps"),
292
  "point" => array('lat' => 37.774095, 'lng' => -122.418731)
293
  ));
294
  $pois = array($poi);
@@ -296,7 +296,7 @@ class Mappress_Settings {
296
  echo "<table class='form-table'><tr><td>" . $map->display() . "</td></tr></table>";
297
  }
298
  function set_sizes($name) {
299
- $headers = array(__('Width (px, %, vh, vw)'), __('Height (px, %, vh, vw)'), __('Default size'));
300
  $rows = array();
301
 
302
  foreach($this->options->sizes as $i => $size) {
@@ -311,28 +311,28 @@ class Mappress_Settings {
311
  }
312
 
313
  function set_wpml($name) {
314
- echo Mappress_Controls::checkmark($name, $this->options->wpml, __("Copy maps when overwriting a translation"));
315
  echo Mappress_Controls::help(null, 'https://mappresspro.com/mappress-documentation#wpml');
316
  }
317
 
318
  function options_page() {
319
  ?>
320
  <div class="wrap mapp-settings-screen">
321
- <h1><?php _e('MapPress'); ?></h1>
322
  <?php echo Mappress::get_support_links(); ?>
323
  <form action="options.php" method="post">
324
  <?php // Force default submit button ?>
325
  <div class='mapp-settings-hidden-toolbar'>
326
- <input name='save' type='submit' class='button button-primary' value='<?php _e("Save Changes"); ?>' />
327
- <input name='reset_defaults' type='submit' class='button' value='<?php _e("Reset Defaults"); ?>' />
328
  </div>
329
 
330
  <?php settings_fields('mappress'); ?>
331
  <?php do_settings_sections('mappress'); ?>
332
 
333
  <div class='mapp-settings-toolbar'>
334
- <input name='save' type='submit' class='button button-primary' value='<?php _e("Save Changes"); ?>' />
335
- <input name='reset_defaults' type='submit' class='button' value='<?php _e("Reset Defaults"); ?>' />
336
  </div>
337
  </form>
338
  </div>
83
  function admin_init() {
84
  register_setting('mappress', self::$basename, array($this, 'validate'));
85
 
86
+ $this->add_section('demo', __('Sample Map', 'mappress-google-maps-for-wordpress'));
87
 
88
+ $this->add_section('basic', __('Basic Settings', 'mappress-google-maps-for-wordpress'));
89
+ $this->add_field('engine', __('Mapping API', 'mappress-google-maps-for-wordpress'), 'basic');
90
 
91
  if ($this->options->engine == 'google')
92
+ $this->add_field('apiKey', __('Google API key', 'mappress-google-maps-for-wordpress'), 'basic');
93
 
94
  if ($this->options->engine == 'leaflet')
95
+ $this->add_field('mapbox', __('Mapbox access token', 'mappress-google-maps-for-wordpress'), 'basic');
96
 
97
  // License: single blogs, or main blog on multisite
98
  if (Mappress::$pro && (!is_multisite() || (is_super_admin() && is_main_site())) )
99
+ $this->add_section('license', __('License', 'mappress-google-maps-for-wordpress'));
100
 
101
+ $this->add_section('maps', __('Map Settings', 'mappress-google-maps-for-wordpress'));
102
+ $this->add_field('postTypes', __('Post types', 'mappress-google-maps-for-wordpress'), 'maps');
103
+ $this->add_field('autodisplay', __('Automatic display', 'mappress-google-maps-for-wordpress'), 'maps');
104
+ $this->add_field('alignment', __('Map alignment', 'mappress-google-maps-for-wordpress'), 'maps');
105
+ $this->add_field('directions', __('Directions', 'mappress-google-maps-for-wordpress'), 'maps');
106
  // TBD $this->add_field('mapOptions', __('Map options'), 'maps');
107
 
108
+ $this->add_section('pois', __('POI Settings', 'mappress-google-maps-for-wordpress'));
109
+ $this->add_field('poiZoom', __('Default zoom', 'mappress-google-maps-for-wordpress'), 'pois');
110
+ $this->add_field('initialOpenInfo', __('Open first POI', 'mappress-google-maps-for-wordpress'), 'pois');
111
 
112
  if (Mappress::$pro) {
113
+ $this->add_section('mashups', __('Mashups', 'mappress-google-maps-for-wordpress'));
114
+ $this->add_section('icons', __('Icons', 'mappress-google-maps-for-wordpress'));
115
+ $this->add_section('styles', __('Styled Maps', 'mappress-google-maps-for-wordpress'));
116
+ $this->add_section('geocoding', __('Geocoding', 'mappress-google-maps-for-wordpress'));
117
+ $this->add_section('templates', __('Templates', 'mappress-google-maps-for-wordpress'));
118
  }
119
 
120
+ $this->add_section('l10n', __('Localization', 'mappress-google-maps-for-wordpress'));
121
+ $this->add_field('language', __('Search language', 'mappress-google-maps-for-wordpress'), 'l10n');
122
+ $this->add_field('country', __('Search country', 'mappress-google-maps-for-wordpress'), 'l10n');
123
+ $this->add_field('directionsServer', __('Directions server', 'mappress-google-maps-for-wordpress'), 'l10n');
124
 
125
+ $this->add_section('misc', __('Miscellaneous', 'mappress-google-maps-for-wordpress'));
126
+ $this->add_field('sizes', __('Map sizes', 'mappress-google-maps-for-wordpress'), 'misc');
127
+ $this->add_field('footer', __('Scripts', 'mappress-google-maps-for-wordpress'), 'misc');
128
  $this->add_field('wpml', 'WPML', 'misc');
129
 
130
  if ($this->options->engine != 'leaflet')
131
+ $this->add_field('deregister', __('Compatiblity', 'mappress-google-maps-for-wordpress'), 'misc');
132
  }
133
 
134
  function add_section($section, $title) {
172
 
173
  function set_alignment($name) {
174
  $alignments = array(
175
+ '' => __('Default', 'mappress-google-maps-for-wordpress'),
176
+ 'center' => __('Center', 'mappress-google-maps-for-wordpress'),
177
+ 'left' => __('Left', 'mappress-google-maps-for-wordpress'),
178
+ 'right' => __('Right', 'mappress-google-maps-for-wordpress')
179
  );
180
  echo Mappress_Controls::radios($name, $alignments, $this->options->alignment);
181
  }
187
 
188
  function set_autodisplay($name) {
189
  $autos = array(
190
+ '' => __('None', 'mappress-google-maps-for-wordpress'),
191
+ 'top' => __('Top of post', 'mappress-google-maps-for-wordpress'),
192
+ 'bottom' => __('Bottom of post', 'mappress-google-maps-for-wordpress')
193
  );
194
  echo Mappress_Controls::radios($name, $autos, $this->options->autodisplay);
195
  }
196
 
197
  function set_country($name) {
198
  $url = 'https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements';
199
+ $link = sprintf('<a style="vertical-align:text-bottom" target="_blank" href="%s">%s</a>', $url, __("(list)", 'mappress-google-maps-for-wordpress'));
200
  $codes = array('', 'AF' ,'AX' ,'AL' ,'DZ' ,'AS' ,'AD' ,'AO' ,'AI' ,'AQ' ,'AG' ,'AR' ,'AM' ,'AW' ,'AU' ,'AT' ,'AZ' ,'BS' ,'BH' ,'BD' ,'BB' ,'BY' ,'BE' ,'BZ' ,'BJ' ,'BM' ,'BT' ,'BO' ,'BQ' ,'BA' ,'BW' ,'BV' ,'BR' ,'IO' ,'VG' ,'BN' ,'BG' ,'BF' ,'BI' ,'KH' ,'CM' ,'CA' ,'CV' ,'KY' ,'CF' ,'TD' ,'CL' ,'CN' ,'CX' ,'CC' ,'CO' ,'KM' ,'CK' ,'CR' ,'HR' ,'CU' ,'CW' ,'CY' ,'CZ' ,'CD' ,'DK' ,'DJ' ,'DM' ,'DO' ,'EC' ,'EG' ,'SV' ,'GQ' ,'ER' ,'EE' ,'ET' ,'FK' ,'FO' ,'FJ' ,'FI' ,'FR' ,'GF' ,'PF' ,'TF' ,'GA' ,'GM' ,'GE' ,'DE' ,'GH' ,'GI' ,'GR' ,'GL' ,'GD' ,'GP' ,'GU' ,'GT' ,'GG' ,'GN' ,'GW' ,'GY' ,'HT' ,'HM' ,'HN' ,'HK' ,'HU' ,'IS' ,'IN' ,'ID' ,'IR' ,'IQ' ,'IE' ,'IM' ,'IL' ,'IT' ,'CI' ,'JM' ,'JP' ,'JE' ,'JO' ,'KZ' ,'KE' ,'KI' ,'XK' ,'KW' ,'KG' ,'LA' ,'LV' ,'LB' ,'LS' ,'LR' ,'LY' ,'LI' ,'LT' ,'LU' ,'MO' ,'MK' ,'MG' ,'MW' ,'MY' ,'MV' ,'ML' ,'MT' ,'MH' ,'MQ' ,'MR' ,'MU' ,'YT' ,'MX' ,'FM' ,'MD' ,'MC' ,'MN' ,'ME' ,'MS' ,'MA' ,'MZ' ,'MM' ,'NA' ,'NR' ,'NP' ,'NL' ,'AN' ,'NC' ,'NZ' ,'NI' ,'NE' ,'NG' ,'NU' ,'NF' ,'KP' ,'MP' ,'NO' ,'OM' ,'PK' ,'PW' ,'PS' ,'PA' ,'PG' ,'PY' ,'PE' ,'PH' ,'PN' ,'PL' ,'PT' ,'PR' ,'QA' ,'CG' ,'RE' ,'RO' ,'RU' ,'RW' ,'BL' ,'SH' ,'KN' ,'LC' ,'MF' ,'PM' ,'VC' ,'WS' ,'SM' ,'ST' ,'SA' ,'SN' ,'RS' ,'SC' ,'SL' ,'SG' ,'SX' ,'SK' ,'SI' ,'SB' ,'SO' ,'ZA' ,'GS' ,'KR' ,'SS' ,'ES' ,'LK' ,'SD' ,'SR' ,'SJ' ,'SZ' ,'SE' ,'CH' ,'SY' ,'TW' ,'TJ' ,'TZ' ,'TH' ,'TL' ,'TG' ,'TK' ,'TO' ,'TT' ,'TN' ,'TR' ,'TM' ,'TC' ,'TV' ,'VI' ,'UG' ,'UA' ,'AE' ,'GB' ,'US' ,'UM' ,'UY' ,'UZ' ,'VU' ,'VA' ,'VE' ,'VN' ,'WF' ,'EH' ,'YE' ,'ZM' ,'ZW');
201
  sort($codes);
202
  $codes = array_combine($codes, $codes);
203
  echo Mappress_Controls::select($name, $codes, $this->options->country);
204
+ echo ' ' . __("Country code for searches", 'mappress-google-maps-for-wordpress') . ' ' . $link;
205
  }
206
 
207
  function set_deregister($name) {
208
+ echo Mappress_Controls::checkmark($name, $this->options->deregister, __('Prevent other plugins/themes from loading the Google Maps API', 'mappress-google-maps-for-wordpress'));
209
  }
210
 
211
  function set_directions($name) {
212
+ $directions_types = array('google' => __('Google', 'mappress-google-maps-for-wordpress'), 'inline' => __('Inline', 'mappress-google-maps-for-wordpress'));
213
  echo Mappress_Controls::radios($name, $directions_types, $this->options->directions);
214
  }
215
 
218
  }
219
 
220
  function set_engine($name) {
221
+ $engines = array('leaflet' => __('Leaflet', 'mappress-google-maps-for-wordpress'), 'google' => __('Google', 'mappress-google-maps-for-wordpress'));
222
  echo Mappress_Controls::radios($name, $engines, $this->options->engine);
223
+ echo Mappress_Controls::help(__('Leaflet is free and requires no API key. Google requires an API key and has strict usage limits.', 'mappress-google-maps-for-wordpress'), '#toc-picking-a-mapping-api');
224
  }
225
 
226
  function set_footer($name) {
227
  // Disable if jetpack infinite scroll is used
228
  if (class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'infinite-scroll' )) {
229
+ echo Mappress_Controls::checkmark($name, false, __('Output scripts in footer', 'mappress-google-maps-for-wordpress'), array('disabled' => true));
230
+ printf("<br/><i>%s</i>", __('Disabled because Jetpack Infinite Scroll is active', 'mappress-google-maps-for-wordpress'));
231
  } else {
232
+ echo Mappress_Controls::checkmark($name, $this->options->footer, __('Output scripts in footer', 'mappress-google-maps-for-wordpress'));
233
+ printf("<br/><i>(%s)</i>", __('disable if maps are output using AJAX', 'mappress-google-maps-for-wordpress'));
234
  }
235
  }
236
 
237
  function set_initial_open_info($name) {
238
+ echo Mappress_Controls::checkmark($name, $this->options->initialOpenInfo, __('Open first POI', 'mappress-google-maps-for-wordpress'));
239
  }
240
 
241
  function set_language($name) {
242
  $url = ($this->options->engine == 'leaflet') ? 'https://en.wikipedia.org/wiki/ISO_639-1' : 'http://code.google.com/apis/maps/faq.html#languagesupport';
243
+ $lang_link = sprintf('<a style="vertical-align:text-bottom" target="_blank" href="%s">%s</a>', $url, __("(list)", 'mappress-google-maps-for-wordpress'));
244
+ $langs = array('' => __('Default', 'mappress-google-maps-for-wordpress'), 'ab' => 'Abkhazian', 'aa' => 'Afar', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'bm' => 'Bambara', 'ba' => 'Bashkir', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali', 'bh' => 'Bihari languages', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan, Valencian', 'km' => 'Central Khmer', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'ny' => 'Chichewa, Chewa, Nyanja', 'zh' => 'Chinese', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree', 'hr' => 'Croatian', 'cs' => 'Czech', 'da' => 'Danish', 'dv' => 'Divehi, Dhivehi, Maldivian', 'nl' => 'Dutch, Flemish', 'dz' => 'Dzongkha', 'en' => 'English', 'eo' => 'Esperanto', 'et' => 'Estonian', 'ee' => 'Ewe', 'fo' => 'Faroese', 'fj' => 'Fijian', 'fi' => 'Finnish', 'fr' => 'French', 'ff' => 'Fulah', 'gd' => 'Gaelic, Scottish Gaelic', 'gl' => 'Galician', 'lg' => 'Ganda', 'ka' => 'Georgian', 'de' => 'German', 'ki' => 'Gikuyu, Kikuyu', 'el' => 'Greek (Modern)', 'kl' => 'Greenlandic, Kalaallisut', 'gn' => 'Guarani', 'gu' => 'Gujarati', 'ht' => 'Haitian, Haitian Creole', 'ha' => 'Hausa', 'he' => 'Hebrew', 'hz' => 'Herero', 'hi' => 'Hindi', 'ho' => 'Hiri Motu', 'hu' => 'Hungarian', 'is' => 'Icelandic', 'io' => 'Ido', 'ig' => 'Igbo', 'id' => 'Indonesian', 'iu' => 'Inuktitut', 'ik' => 'Inupiaq', 'ga' => 'Irish', 'it' => 'Italian', 'ja' => 'Japanese', 'jv' => 'Javanese', 'kn' => 'Kannada', 'kr' => 'Kanuri', 'ks' => 'Kashmiri', 'kk' => 'Kazakh', 'rw' => 'Kinyarwanda', 'kv' => 'Komi', 'kg' => 'Kongo', 'ko' => 'Korean', 'kj' => 'Kwanyama, Kuanyama', 'ku' => 'Kurdish', 'ky' => 'Kyrgyz', 'lo' => 'Lao', 'la' => 'Latin', 'lv' => 'Latvian', 'lb' => 'Letzeburgesch, Luxembourgish', 'li' => 'Limburgish, Limburgan, Limburger', 'ln' => 'Lingala', 'lt' => 'Lithuanian', 'lu' => 'Luba-Katanga', 'mk' => 'Macedonian', 'mg' => 'Malagasy', 'ms' => 'Malay', 'ml' => 'Malayalam', 'mt' => 'Maltese', 'gv' => 'Manx', 'mi' => 'Maori', 'mr' => 'Marathi', 'mh' => 'Marshallese', 'ro' => 'Moldovan, Moldavian, Romanian', 'mn' => 'Mongolian', 'na' => 'Nauru', 'nv' => 'Navajo, Navaho', 'nd' => 'Northern Ndebele', 'ng' => 'Ndonga', 'ne' => 'Nepali', 'se' => 'Northern Sami', 'no' => 'Norwegian', 'nb' => 'Norwegian Bokmål', 'nn' => 'Norwegian Nynorsk', 'ii' => 'Nuosu, Sichuan Yi', 'oc' => 'Occitan (post 1500)', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian, Ossetic', 'pi' => 'Pali', 'pa' => 'Panjabi, Punjabi', 'ps' => 'Pashto, Pushto', 'fa' => 'Persian', 'pl' => 'Polish', 'pt' => 'Portuguese', 'qu' => 'Quechua', 'rm' => 'Romansh', 'rn' => 'Rundi', 'ru' => 'Russian', 'sm' => 'Samoan', 'sg' => 'Sango', 'sa' => 'Sanskrit', 'sc' => 'Sardinian', 'sr' => 'Serbian', 'sn' => 'Shona', 'sd' => 'Sindhi', 'si' => 'Sinhala, Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'nr' => 'South Ndebele', 'es' => 'Spanish, Castilian', 'su' => 'Sundanese', 'sw' => 'Swahili', 'ss' => 'Swati', 'sv' => 'Swedish', 'tl' => 'Tagalog', 'ty' => 'Tahitian', 'tg' => 'Tajik', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'ts' => 'Tsonga', 'tn' => 'Tswana', 'tr' => 'Turkish', 'tk' => 'Turkmen', 'tw' => 'Twi', 'ug' => 'Uighur, Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek', 've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volap_k', 'wa' => 'Walloon', 'cy' => 'Welsh', 'fy' => 'Western Frisian', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang, Chuang', 'zu' => 'Zulu');
245
  echo Mappress_Controls::select($name, $langs, $this->options->language);
246
+ echo ' ' . __('Language for searches and Google map controls', 'mappress-google-maps-for-wordpress') . ' ' . $lang_link;
247
  }
248
 
249
  function set_mapbox($name) {
250
+ echo Mappress_Controls::input($name, $this->options->mapbox, array('size' => '50', 'placeholder' => __('Enter token to use Mapbox map tiles', 'mappress-google-maps-for-wordpress')));
251
  echo Mappress_Controls::help('', 'https://www.mapbox.com/help/define-access-token/');
252
  }
253
 
254
  function set_map_options($name) {
255
  $labels = array(
256
  'google' => array(
257
+ 'mapTypeControl' => __('Map type control', 'mappress-google-maps-for-wordpress'),
258
+ 'streetViewControl' => __("Street view control", 'mappress-google-maps-for-wordpress'),
259
+ 'zoomControl' => __('Zoom control', 'mappress-google-maps-for-wordpress')
260
  ),
261
  'leaflet' => array(
262
+ 'mapTypeControl' => __('Map type control', 'mappress-google-maps-for-wordpress'),
263
+ 'zoomControl' => __('Zoom control', 'mappress-google-maps-for-wordpress')
264
  )
265
  );
266
 
275
  function set_poi_zoom($name) {
276
  $zooms = array_combine(range(1, 17), range(1,17));
277
  echo Mappress_Controls::select($name, $zooms, (int) $this->options->poiZoom);
278
+ echo __("Default zoom when displaying a single POI", 'mappress-google-maps-for-wordpress');
279
  }
280
 
281
  function set_post_types($name) {
288
  $poi = new Mappress_Poi(array(
289
  'address' => 'San Francisco, CA',
290
  "title" => "MapPress",
291
+ "body" => __("Easy Google Maps", 'mappress-google-maps-for-wordpress'),
292
  "point" => array('lat' => 37.774095, 'lng' => -122.418731)
293
  ));
294
  $pois = array($poi);
296
  echo "<table class='form-table'><tr><td>" . $map->display() . "</td></tr></table>";
297
  }
298
  function set_sizes($name) {
299
+ $headers = array(__('Width (px, %, vh, vw)', 'mappress-google-maps-for-wordpress'), __('Height (px, %, vh, vw)', 'mappress-google-maps-for-wordpress'), __('Default size', 'mappress-google-maps-for-wordpress'));
300
  $rows = array();
301
 
302
  foreach($this->options->sizes as $i => $size) {
311
  }
312
 
313
  function set_wpml($name) {
314
+ echo Mappress_Controls::checkmark($name, $this->options->wpml, __("Copy maps when overwriting a translation", 'mappress-google-maps-for-wordpress'));
315
  echo Mappress_Controls::help(null, 'https://mappresspro.com/mappress-documentation#wpml');
316
  }
317
 
318
  function options_page() {
319
  ?>
320
  <div class="wrap mapp-settings-screen">
321
+ <h1><?php _e('MapPress', 'mappress-google-maps-for-wordpress'); ?></h1>
322
  <?php echo Mappress::get_support_links(); ?>
323
  <form action="options.php" method="post">
324
  <?php // Force default submit button ?>
325
  <div class='mapp-settings-hidden-toolbar'>
326
+ <input name='save' type='submit' class='button button-primary' value='<?php _e("Save Changes", 'mappress-google-maps-for-wordpress'); ?>' />
327
+ <input name='reset_defaults' type='submit' class='button' value='<?php _e("Reset Defaults", 'mappress-google-maps-for-wordpress'); ?>' />
328
  </div>
329
 
330
  <?php settings_fields('mappress'); ?>
331
  <?php do_settings_sections('mappress'); ?>
332
 
333
  <div class='mapp-settings-toolbar'>
334
+ <input name='save' type='submit' class='button button-primary' value='<?php _e("Save Changes", 'mappress-google-maps-for-wordpress'); ?>' />
335
+ <input name='reset_defaults' type='submit' class='button' value='<?php _e("Reset Defaults", 'mappress-google-maps-for-wordpress'); ?>' />
336
  </div>
337
  </form>
338
  </div>
mappress_template.php CHANGED
@@ -31,13 +31,13 @@ class Mappress_Template extends Mappress_Obj {
31
  add_action('admin_print_footer_scripts', array(__CLASS__, 'print_footer_templates'), -10);
32
 
33
  self::$tokens = array(
34
- 'address' => __('Address'),
35
- 'body' => __('Body'),
36
- 'icon' => __('Icon'),
37
- 'thumbnail' => __('Thumbnail'),
38
- 'title' => __('Title'),
39
- 'url' => __('Url'),
40
- 'custom' => __('Custom Field')
41
  );
42
  }
43
 
31
  add_action('admin_print_footer_scripts', array(__CLASS__, 'print_footer_templates'), -10);
32
 
33
  self::$tokens = array(
34
+ 'address' => __('Address', 'mappress-google-maps-for-wordpress'),
35
+ 'body' => __('Body', 'mappress-google-maps-for-wordpress'),
36
+ 'icon' => __('Icon', 'mappress-google-maps-for-wordpress'),
37
+ 'thumbnail' => __('Thumbnail', 'mappress-google-maps-for-wordpress'),
38
+ 'title' => __('Title', 'mappress-google-maps-for-wordpress'),
39
+ 'url' => __('Url', 'mappress-google-maps-for-wordpress'),
40
+ 'custom' => __('Custom Field', 'mappress-google-maps-for-wordpress')
41
  );
42
  }
43
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: maps, map, google maps, leaflet maps, leaflet map plugin, map plugin, dire
5
  Requires at least: 5.3
6
  Requires PHP: 5.6
7
  Tested up to: 5.6
8
- Stable tag: 2.57.2
9
 
10
  == Description ==
11
  MapPress adds beautiful interfactive Google and Leaflet maps to WordPress.
@@ -74,6 +74,10 @@ Please see the plugin documentation pages:
74
 
75
  == Changelog ==
76
 
 
 
 
 
77
  = 2.57.2 =
78
  * Fixed: remove extra translation json file
79
 
5
  Requires at least: 5.3
6
  Requires PHP: 5.6
7
  Tested up to: 5.6
8
+ Stable tag: 2.57.3
9
 
10
  == Description ==
11
  MapPress adds beautiful interfactive Google and Leaflet maps to WordPress.
74
 
75
  == Changelog ==
76
 
77
+ = 2.57.3 =
78
+ * Fixed: notice in multisite admin
79
+ * Fixed: add missing textdomains
80
+
81
  = 2.57.2 =
82
  * Fixed: remove extra translation json file
83
 
templates/map-directions.php CHANGED
@@ -2,7 +2,7 @@
2
  <div class='mapp-directions'>
3
  <span class='mapp-close' data-mapp-action='dir-cancel'></span>
4
  <div>
5
- <input class='mapp-dir-saddr' tabindex='1' placeholder='<?php _e("My location");?>' />
6
  <span data-mapp-action='dir-swap' class='mapp-dir-arrows'></span>
7
  </div>
8
 
@@ -11,7 +11,7 @@
11
  </div>
12
 
13
  <div class='mapp-dir-toolbar'>
14
- <span class='mapp-button-submit' data-mapp-action='dir-get'><?php _e('Get Directions'); ?></span>
15
  <span class='mapp-spinner'></span>
16
  </div>
17
  <div class='mapp-dir-renderer'></div>
2
  <div class='mapp-directions'>
3
  <span class='mapp-close' data-mapp-action='dir-cancel'></span>
4
  <div>
5
+ <input class='mapp-dir-saddr' tabindex='1' placeholder='<?php _e("My location", 'mappress-google-maps-for-wordpress');?>' />
6
  <span data-mapp-action='dir-swap' class='mapp-dir-arrows'></span>
7
  </div>
8
 
11
  </div>
12
 
13
  <div class='mapp-dir-toolbar'>
14
+ <span class='mapp-button-submit' data-mapp-action='dir-get'><?php _e('Get Directions', 'mappress-google-maps-for-wordpress'); ?></span>
15
  <span class='mapp-spinner'></span>
16
  </div>
17
  <div class='mapp-dir-renderer'></div>
templates/map-filters.php CHANGED
@@ -9,8 +9,8 @@
9
  </div>
10
  </div>
11
  <div class='mapp-filters-toolbar'>
12
- <span class='mapp-button-submit mapp-filters-done' data-mapp-action='filters-toggle'><?php _e('Done');?></span>
13
- <span class='mapp-button mapp-filters-reset' data-mapp-action='filters-reset'><?php _e('Reset');?></span>
14
  </div>
15
  </div>
16
  <# } #>
9
  </div>
10
  </div>
11
  <div class='mapp-filters-toolbar'>
12
+ <span class='mapp-button-submit mapp-filters-done' data-mapp-action='filters-toggle'><?php _e('Done', 'mappress-google-maps-for-wordpress');?></span>
13
+ <span class='mapp-button mapp-filters-reset' data-mapp-action='filters-reset'><?php _e('Reset', 'mappress-google-maps-for-wordpress');?></span>
14
  </div>
15
  </div>
16
  <# } #>
templates/map-loop.php CHANGED
@@ -1,6 +1,6 @@
1
  <# if (map.query) { #>
2
  <div class="mapp-list-header">
3
- {{{count}}} <?php _e("Results"); ?>
4
  </div>
5
  <# } #>
6
 
1
  <# if (map.query) { #>
2
  <div class="mapp-list-header">
3
+ {{{count}}} <?php _e("Results", 'mappress-google-maps-for-wordpress'); ?>
4
  </div>
5
  <# } #>
6
 
templates/map-popup.php CHANGED
@@ -1,3 +1,3 @@
1
  <div class='mapp-title'>{{{poi.title}}}</div>
2
  <div class='mapp-body'>{{{poi.body}}}</div>
3
- <div class='mapp-links'><a href='#' data-mapp-action='dir'><?php _e('Directions'); ?></a><div>
1
  <div class='mapp-title'>{{{poi.title}}}</div>
2
  <div class='mapp-body'>{{{poi.body}}}</div>
3
+ <div class='mapp-links'><a href='#' data-mapp-action='dir'><?php _e('Directions', 'mappress-google-maps-for-wordpress'); ?></a><div>
templates/map.php CHANGED
@@ -48,14 +48,14 @@
48
  <div class='mapp-header'>
49
  <# if (search) { #>
50
  <div class='mapp-search'>
51
- <input class='mapp-places' type='text' placeholder='<?php _e('Search'); ?>'/>
52
  <# if (mappl10n.options.ssl) { #>
53
- <div class='mapp-geolocate' data-mapp-action='geolocate' title='<?php _e('Your Location');?>'></div>
54
  <# } #>
55
  </div>
56
  <# } #>
57
  <# if (filter) { #>
58
- <div class='mapp-caret mapp-header-button mapp-filters-toggle' data-mapp-action='filters-toggle'><?php _e('Filter');?></div>
59
  <# } #>
60
  </div>
61
  <# } #>
@@ -64,14 +64,14 @@
64
  <script type='text/template' id='mapp-tmpl-map-menu'>
65
  <# if (!map.editable) { #>
66
  <div class='mapp-controls'>
67
- <div class='mapp-menu-toggle' data-mapp-action='menu-toggle' title='<?php _e('Menu');?>'></div>
68
  <div class='mapp-menu'>
69
- <div class='mapp-menu-item' data-mapp-action='center'><?php _e('Center map');?></div>
70
  <?php if (Mappress::$options->engine != 'leaflet') { ?>
71
  <div class='mapp-menu-separator'></div>
72
- <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='traffic'><?php _e('Traffic');?></div>
73
- <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='bicycling'><?php _e('Bicycling');?></div>
74
- <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='transit'><?php _e('Transit');?></div>
75
  <?php } ?>
76
  </div>
77
  </div>
@@ -81,8 +81,8 @@
81
  <script type='text/template' id='mapp-tmpl-map-footer'>
82
  <# if ( (map.poiList || mappl10n.options.poiList) && map.layout != 'inline') { #>
83
  <div class='mapp-footer'>
84
- <div class='mapp-view-list' data-mapp-action='view-list'><?php _e('Show List'); ?></div>
85
- <div class='mapp-view-map' data-mapp-action='view-map'><?php _e('Show Map'); ?></div>
86
  </div>
87
  <# } #>
88
  </script>
48
  <div class='mapp-header'>
49
  <# if (search) { #>
50
  <div class='mapp-search'>
51
+ <input class='mapp-places' type='text' placeholder='<?php _e('Search', 'mappress-google-maps-for-wordpress'); ?>'/>
52
  <# if (mappl10n.options.ssl) { #>
53
+ <div class='mapp-geolocate' data-mapp-action='geolocate' title='<?php _e('Your Location', 'mappress-google-maps-for-wordpress');?>'></div>
54
  <# } #>
55
  </div>
56
  <# } #>
57
  <# if (filter) { #>
58
+ <div class='mapp-caret mapp-header-button mapp-filters-toggle' data-mapp-action='filters-toggle'><?php _e('Filter', 'mappress-google-maps-for-wordpress');?></div>
59
  <# } #>
60
  </div>
61
  <# } #>
64
  <script type='text/template' id='mapp-tmpl-map-menu'>
65
  <# if (!map.editable) { #>
66
  <div class='mapp-controls'>
67
+ <div class='mapp-menu-toggle' data-mapp-action='menu-toggle' title='<?php _e('Menu', 'mappress-google-maps-for-wordpress');?>'></div>
68
  <div class='mapp-menu'>
69
+ <div class='mapp-menu-item' data-mapp-action='center'><?php _e('Center map', 'mappress-google-maps-for-wordpress');?></div>
70
  <?php if (Mappress::$options->engine != 'leaflet') { ?>
71
  <div class='mapp-menu-separator'></div>
72
+ <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='traffic'><?php _e('Traffic', 'mappress-google-maps-for-wordpress');?></div>
73
+ <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='bicycling'><?php _e('Bicycling', 'mappress-google-maps-for-wordpress');?></div>
74
+ <div class='mapp-menu-item' data-mapp-action='layer' data-mapp-layer='transit'><?php _e('Transit', 'mappress-google-maps-for-wordpress');?></div>
75
  <?php } ?>
76
  </div>
77
  </div>
81
  <script type='text/template' id='mapp-tmpl-map-footer'>
82
  <# if ( (map.poiList || mappl10n.options.poiList) && map.layout != 'inline') { #>
83
  <div class='mapp-footer'>
84
+ <div class='mapp-view-list' data-mapp-action='view-list'><?php _e('Show List', 'mappress-google-maps-for-wordpress'); ?></div>
85
+ <div class='mapp-view-map' data-mapp-action='view-map'><?php _e('Show Map', 'mappress-google-maps-for-wordpress'); ?></div>
86
  </div>
87
  <# } #>
88
  </script>
templates/mappress_map.php ADDED
@@ -0,0 +1,491 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Mappress_Map extends Mappress_Obj {
3
+ var $alignment,
4
+ $center,
5
+ $classname,
6
+ $editable,
7
+ $embed,
8
+ $height,
9
+ $hideEmpty,
10
+ $initialOpenDirections,
11
+ $initialOpenInfo,
12
+ $layers,
13
+ $layout,
14
+ $mapid,
15
+ $mapTypeId,
16
+ $metaKey,
17
+ $mapOpts,
18
+ $name,
19
+ $poiList,
20
+ $postid,
21
+ $query,
22
+ $title,
23
+ $width,
24
+ $zoom
25
+ ;
26
+
27
+ var $pois = array();
28
+
29
+ function __sleep() {
30
+ return array('mapid', 'center', 'height', 'mapTypeId', 'metaKey', 'pois', 'title', 'width', 'zoom');
31
+ }
32
+
33
+ function __construct($atts = null) {
34
+ $this->update($atts);
35
+
36
+ // Convert POIs from arrays to objects if needed
37
+ foreach((array)$this->pois as $index => $poi) {
38
+ if (is_array($poi))
39
+ $this->pois[$index] = new Mappress_Poi($poi);
40
+ }
41
+ }
42
+
43
+ static function register() {
44
+ global $wpdb;
45
+
46
+ add_action('deleted_post', array(__CLASS__, 'delete_post_map'));
47
+
48
+ add_action('wp_ajax_mapp_delete', array(__CLASS__, 'ajax_delete'));
49
+ add_action('wp_ajax_mapp_duplicate', array(__CLASS__, 'ajax_duplicate'));
50
+ add_action('wp_ajax_mapp_find', array(__CLASS__, 'ajax_find'));
51
+ add_action('wp_ajax_mapp_get', array(__CLASS__, 'ajax_get'));
52
+ add_action('wp_ajax_mapp_save', array(__CLASS__, 'ajax_save'));
53
+
54
+ add_action('media_buttons', array(__CLASS__, 'media_buttons'));
55
+
56
+ // Tables
57
+ $maps_table = $wpdb->prefix . 'mappress_maps';
58
+ $posts_table = $wpdb->prefix . 'mappress_posts';
59
+
60
+ $wpdb->show_errors(true);
61
+
62
+ $exists = $wpdb->get_var("show tables like '$maps_table'");
63
+ if (!$exists) {
64
+ $result = $wpdb->query ("CREATE TABLE $maps_table (
65
+ mapid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
66
+ obj LONGTEXT)
67
+ CHARACTER SET utf8;");
68
+ }
69
+
70
+ $exists = $wpdb->get_var("show tables like '$posts_table'");
71
+ if (!$exists) {
72
+ $result = $wpdb->query ("CREATE TABLE $posts_table (
73
+ postid INT,
74
+ mapid INT,
75
+ PRIMARY KEY (postid, mapid) )
76
+ CHARACTER SET utf8;");
77
+ }
78
+
79
+ $wpdb->show_errors(false);
80
+ }
81
+
82
+ static function media_buttons($editor_id) {
83
+ if ($editor_id == 'content') {
84
+ echo '<button type="button" class="button mapp-media-button">';
85
+ echo '<span class="wp-media-buttons-icon dashicons dashicons-location"></span> ' . __('MapPress', 'mappress-google-maps-for-wordpress') . '</button>';
86
+ }
87
+ }
88
+
89
+ static function duplicate($mapid, $postid) {
90
+ $map = self::get($mapid);
91
+ if (!$map)
92
+ return null;
93
+
94
+ $title = ($map->title) ? $map->title : __('Untitled', 'mappress-google-maps-for-wordpress');
95
+ $map->title = sprintf(__('Copy of %s', 'mappress-google-maps-for-wordpress'), $title);
96
+
97
+ $map->postid = $postid;
98
+ $map->mapid = null;
99
+ $map->metaKey = null; // Map is no longer automatic
100
+
101
+ $result = $map->save();
102
+ if (!$result)
103
+ return null;
104
+
105
+ return $map;
106
+ }
107
+
108
+ static function ajax_duplicate() {
109
+ check_ajax_referer('mappress', 'nonce');
110
+
111
+ if (!current_user_can('edit_posts'))
112
+ Mappress::ajax_response('Not authorized');
113
+
114
+ ob_start();
115
+
116
+ $mapid = (isset($_POST['mapid'])) ? $_POST['mapid'] : null;
117
+ $postid = (isset($_POST['postid'])) ? $_POST['postid'] : null;
118
+
119
+ if (!$mapid)
120
+ Mappress::ajax_response('Internal error, your data has not been saved!');
121
+
122
+ $map = self::duplicate($mapid, $postid);
123
+ if ($map)
124
+ Mappress::ajax_response('OK', $map);
125
+ else
126
+ Mappress::ajax_response('Internal error when copying');
127
+ }
128
+
129
+ static function find($args) {
130
+ global $wpdb;
131
+
132
+ $maps_table = $wpdb->prefix . 'mappress_maps';
133
+ $posts_table = $wpdb->prefix . 'mappress_posts';
134
+
135
+ $sql = "SELECT SQL_CALC_FOUND_ROWS $maps_table.mapid, $maps_table.obj, $posts_table.postid, $wpdb->posts.post_status, $wpdb->posts.post_title "
136
+ . " FROM $maps_table "
137
+ . " INNER JOIN $posts_table ON ($posts_table.mapid = $maps_table.mapid)"
138
+ . " LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID = $posts_table.postid)"
139
+ ;
140
+ $results = $wpdb->get_results($sql);
141
+
142
+ $items = array();
143
+ foreach($results as $result) {
144
+
145
+ // Only check if map is attached to a post (postid > 0)
146
+ if ($result->postid) {
147
+ if (!current_user_can('edit_post', $result->postid))
148
+ continue;
149
+ if (in_array($result->post_status, array('trash', 'auto-draft', 'inherit')))
150
+ continue;
151
+ }
152
+
153
+ $mapdata = unserialize($result->obj);
154
+ $items[] = array(
155
+ 'mapid' => $result->mapid,
156
+ 'map_title' => $mapdata->title,
157
+ 'postid' => $result->postid,
158
+ 'post_title' => $result->post_title
159
+ );
160
+ }
161
+
162
+ return $items;
163
+ }
164
+
165
+ static function ajax_find() {
166
+ check_ajax_referer('mappress', 'nonce');
167
+ if (!current_user_can('edit_posts'))
168
+ Mappress::ajax_response('Not authorized');
169
+ Mappress::ajax_response('OK', self::find($_GET));
170
+ }
171
+
172
+ /**
173
+ * Get a map. Output is 'raw' or 'object'
174
+ */
175
+ static function get($mapid) {
176
+ global $wpdb;
177
+ $maps_table = $wpdb->prefix . 'mappress_maps';
178
+ $posts_table = $wpdb->prefix . 'mappress_posts';
179
+
180
+ $sql = "SELECT $posts_table.postid, $maps_table.mapid, $maps_table.obj FROM $posts_table INNER JOIN $maps_table ON ($maps_table.mapid = $posts_table.mapid) WHERE $maps_table.mapid = %d";
181
+ $result = $wpdb->get_row($wpdb->prepare($sql, $mapid));
182
+
183
+ if (!$result)
184
+ return false;
185
+
186
+ // Read the map data and construct a new map from it
187
+ $mapdata = unserialize($result->obj);
188
+ $mapdata->postid = $result->postid;
189
+ $mapdata->mapid = $result->mapid;
190
+ return new Mappress_Map($mapdata);
191
+ }
192
+
193
+ static function ajax_get() {
194
+ check_ajax_referer('mappress', 'nonce');
195
+ ob_start();
196
+ $mapid = (isset($_GET['mapid'])) ? $_GET['mapid'] : null;
197
+ $map = ($mapid) ? self::get($mapid) : null;
198
+ if (!$map)
199
+ Mappress::ajax_response(sprintf(__('Map not found', 'mappress-google-maps-for-wordpress'), $mapid));
200
+ else
201
+ Mappress::ajax_response('OK', $map);
202
+ }
203
+
204
+ /**
205
+ * Get list of mapids for a post or all maps
206
+ *
207
+ * @return array of mapids | empty array
208
+ *
209
+ */
210
+ static function get_list($postid = null, $output = 'objects') {
211
+ global $wpdb;
212
+ $posts_table = $wpdb->prefix . 'mappress_posts';
213
+
214
+ $where = ($postid) ? $wpdb->prepare("WHERE postid = %d", $postid) : '';
215
+
216
+ $mapids = $wpdb->get_col("SELECT mapid FROM $posts_table $where");
217
+ if (!$mapids)
218
+ return array();
219
+
220
+ if ($output == 'ids') {
221
+ return $mapids;
222
+ } else {
223
+ $maps = array();
224
+ foreach($mapids as $mapid) {
225
+ $map = Mappress_Map::get($mapid);
226
+ if ($map)
227
+ $maps[] = $map;
228
+ }
229
+ return $maps;
230
+ }
231
+ }
232
+
233
+ function save() {
234
+ global $wpdb;
235
+ $maps_table = $wpdb->prefix . 'mappress_maps';
236
+ $posts_table = $wpdb->prefix . 'mappress_posts';
237
+
238
+ // Apply wpautop to POI bodies
239
+ foreach($this->pois as &$poi)
240
+ $poi->body = wpautop($poi->body);
241
+
242
+ $map = serialize($this);
243
+
244
+ // Update map
245
+ if (!$this->mapid) {
246
+ // If no ID then autonumber
247
+ $result = $wpdb->query($wpdb->prepare("INSERT INTO $maps_table (obj) VALUES(%s)", $map));
248
+ $this->mapid = $wpdb->get_var("SELECT LAST_INSERT_ID()");
249
+ } else {
250
+ // Id provided, so insert or update
251
+ $result = $wpdb->query($wpdb->prepare("INSERT INTO $maps_table (mapid, obj) VALUES(%d, '%s') ON DUPLICATE KEY UPDATE obj = %s", $this->mapid, $map, $map));
252
+ }
253
+
254
+ if ($result === false || !$this->mapid)
255
+ return false;
256
+
257
+ // Update posts
258
+ $result = $wpdb->query($wpdb->prepare("INSERT INTO $posts_table (postid, mapid) VALUES(%d, %d) ON DUPLICATE KEY UPDATE postid = %d, mapid = %d", $this->postid, $this->mapid,
259
+ $this->postid, $this->mapid));
260
+
261
+ if ($result === false)
262
+ return false;
263
+
264
+ $wpdb->query("COMMIT");
265
+ return true;
266
+ }
267
+
268
+ static function ajax_save() {
269
+ check_ajax_referer('mappress', 'nonce');
270
+
271
+ if (!current_user_can('edit_posts'))
272
+ Mappress::ajax_response('Not authorized');
273
+
274
+ ob_start();
275
+ $mapdata = (isset($_POST['mapdata'])) ? json_decode(stripslashes($_POST['mapdata']), true) : null;
276
+
277
+ if (!$mapdata)
278
+ Mappress::ajax_response('Internal error, your data has not been saved!');
279
+
280
+ $map = new Mappress_Map($mapdata);
281
+ $result = $map->save();
282
+
283
+ if (!$result)
284
+ Mappress::ajax_response('Internal error, your data has not been saved!');
285
+
286
+ do_action('mappress_map_save', $map); // Use for your own developments
287
+
288
+ // Return saved mapid
289
+ Mappress::ajax_response('OK', $map);
290
+ }
291
+
292
+ /**
293
+ * Delete a map and all of its post assignments
294
+ *
295
+ * @param mixed $mapid
296
+ */
297
+ static function delete($mapid) {
298
+ global $wpdb;
299
+ $maps_table = $wpdb->prefix . 'mappress_maps';
300
+ $posts_table = $wpdb->prefix . 'mappress_posts';
301
+
302
+ // Delete from posts table
303
+ $result = $wpdb->query($wpdb->prepare("DELETE FROM $posts_table WHERE mapid = %d", $mapid));
304
+ if ($result === false)
305
+ return false;
306
+
307
+ $result = $wpdb->query($wpdb->prepare("DELETE FROM $maps_table WHERE mapid = %d", $mapid));
308
+ if ($result === false)
309
+ return false;
310
+
311
+ $wpdb->query("COMMIT");
312
+ return true;
313
+ }
314
+
315
+ static function ajax_delete() {
316
+ check_ajax_referer('mappress', 'nonce');
317
+
318
+ if (!current_user_can('edit_posts'))
319
+ Mappress::ajax_response('Not authorized');
320
+
321
+ ob_start();
322
+ $mapid = (isset($_POST['mapid'])) ? $_POST['mapid'] : null;
323
+ $result = Mappress_Map::delete($mapid);
324
+
325
+ if (!$result)
326
+ Mappress::ajax_response("Internal error when deleting map ID '$mapid'!");
327
+
328
+ do_action('mappress_map_delete', $mapid); // Use for your own developments
329
+ Mappress::ajax_response('OK');
330
+ }
331
+
332
+ /**
333
+ * Delete a map assignment(s) for a post
334
+ * If $mapid is null, then ALL maps will be removed from the post
335
+ * Maps are not deleted, only the post_table entry is removed
336
+ *
337
+ * @param int $mapid Map to remove
338
+ * @param int $postid Post to remove from
339
+ * @return TRUE if map has been removed, FALSE if map wasn't assigned to the post
340
+ */
341
+ static function delete_post_map($postid, $mapid=null) {
342
+ global $wpdb;
343
+ $posts_table = $wpdb->prefix . 'mappress_posts';
344
+
345
+ if (!$postid)
346
+ return true;
347
+
348
+ if ($mapid)
349
+ $results = $wpdb->query($wpdb->prepare("DELETE FROM $posts_table WHERE postid = %d AND mapid = %d", $postid, $mapid));
350
+ else
351
+ $results = $wpdb->query($wpdb->prepare("DELETE FROM $posts_table WHERE postid = %d", $postid));
352
+
353
+ $wpdb->query("COMMIT");
354
+
355
+ if ($results === false)
356
+ return false;
357
+
358
+ return true;
359
+ }
360
+
361
+ /**
362
+ * Display a map
363
+ *
364
+ * @param mixed $atts - override attributes. Attributes applied from options -> map -> $atts
365
+ */
366
+ function display($atts = null) {
367
+ static $div = 0;
368
+
369
+ $this->update($atts);
370
+
371
+ // Assign a map name, if none was provided. Uniqid is used for for ajax to prevent repeating ids
372
+ if (empty($this->name)) {
373
+ $this->name = (defined('DOING_AJAX') && DOING_AJAX) ? "mapp" . uniqid() : "mapp$div";
374
+ $div++;
375
+ }
376
+
377
+ // Prepare POIs for maps
378
+ if (empty($this->query))
379
+ $this->prepare();
380
+
381
+ // Last chance to alter map before display
382
+ do_action('mappress_map_display', $this);
383
+
384
+ // Empty container to prevent pop-ins
385
+ $id = $this->name . '-layout';
386
+ $html = "<div class='mapp-layout' id='$id'></div>";
387
+
388
+ // Dynamically enqueue scripts
389
+ Mappress::scripts_enqueue();
390
+ $script = "mapp.data.push( " . json_encode($this) . " ); \r\nif (typeof mapp.load != 'undefined') { mapp.load(); };";
391
+
392
+ // Use inline scripts for XHTML and some themes which match tags (incorrectly) in the content
393
+ if (function_exists('wp_add_inline_script') && Mappress::$options->footer && (!defined('DOING_AJAX') || !DOING_AJAX))
394
+ wp_add_inline_script('mappress', "//<![CDATA[\r\n" . $script . "\r\n//]]>");
395
+ else
396
+ $html .= Mappress::script($script);
397
+
398
+ return $html;
399
+ }
400
+
401
+ /**
402
+ * Prepare map for output
403
+ *
404
+ */
405
+ function prepare() {
406
+ global $post;
407
+
408
+ // Sort the pois
409
+ if (Mappress::$options->sort && !isset($this->query['orderby']))
410
+ $this->sort_pois();
411
+
412
+ // Set properties (mashups and maps)
413
+ foreach($this->pois as $poi) {
414
+ if ($poi->postid)
415
+ $postid = $poi->postid;
416
+ else
417
+ $postid = ($post) ? $post->ID : null;
418
+ $poi->props = apply_filters('mappress_poi_props', $poi->props, $postid, $poi);
419
+
420
+ // Process oembeds
421
+ // $poi->body = $wp_embed->autoembed($poi->body);
422
+ }
423
+
424
+ // Autoicons
425
+ $this->autoicons();
426
+ }
427
+
428
+ /**
429
+ * Autoicons
430
+ */
431
+ function autoicons() {
432
+ global $post;
433
+
434
+ // Only 1 rule allowed
435
+ $rule = (object) wp_parse_args(Mappress::$options->autoicons, array('key' => null, 'values' => array()));
436
+
437
+ foreach($rule->values as $value => $iconid) {
438
+ // Get all post IDs that match the current key & value
439
+ if ($rule->key == 'post_type') {
440
+ $wpq = new WP_Query(array('post_type' => $value, 'fields' => 'ids', 'posts_per_page' => -1));
441
+ $postids = $wpq->posts;
442
+ } else {
443
+ $term = get_term_by('slug', $value, $rule->key);
444
+ if (!is_object($term))
445
+ continue;
446
+
447
+ $objects = get_objects_in_term($term->term_id, $rule->key);
448
+ if (!is_array($objects))
449
+ continue;
450
+
451
+ $postids = array_keys(array_flip($objects));
452
+ }
453
+
454
+ // Check each post ID to see if it's in the map's POIs, if so set iconid
455
+ $current_post = ($post) ? $post->ID : null;
456
+ foreach($this->pois as &$poi) {
457
+ $postid = ($poi->postid) ? $poi->postid : $current_post;
458
+ if (in_array($postid, $postids))
459
+ $poi->iconid = $iconid;
460
+ }
461
+ }
462
+
463
+ // Filter
464
+ foreach($this->pois as &$poi)
465
+ $poi->iconid = apply_filters('mappress_poi_iconid', $poi->iconid, $poi);
466
+ }
467
+
468
+ /**
469
+ * Default action to sort the map
470
+ *
471
+ * @param mixed $map
472
+ */
473
+ function sort_pois() {
474
+ usort($this->pois, array(__CLASS__, 'compare_title'));
475
+ do_action('mappress_sort_pois', $this);
476
+ }
477
+
478
+ /**
479
+ * Compare two POIs by title
480
+ * HTML tags are stripped - until URL is separated from title this is the only way to
481
+ * sort titles with HTML
482
+ *
483
+ * @param mixed $a
484
+ * @param mixed $b
485
+ * @return mixed
486
+ */
487
+ static function compare_title($a, $b) {
488
+ return strcasecmp(strip_tags($a->title), strip_tags($b->title));
489
+ }
490
+ }
491
+ ?>
templates/mashup-popup.php CHANGED
@@ -3,4 +3,4 @@
3
  <a href='{{{poi.url}}}' target='_blank'>{{{poi.thumbnail}}}</a>
4
  {{{poi.body}}}
5
  </div>
6
- <div class='mapp-links'><a href='#' data-mapp-action='dir'><?php _e('Directions'); ?></a><div>
3
  <a href='{{{poi.url}}}' target='_blank'>{{{poi.thumbnail}}}</a>
4
  {{{poi.body}}}
5
  </div>
6
+ <div class='mapp-links'><a href='#' data-mapp-action='dir'><?php _e('Directions', 'mappress-google-maps-for-wordpress'); ?></a><div>
templates_admin/editor.php CHANGED
@@ -31,9 +31,9 @@
31
  <# } #>
32
 
33
  <div class='mapp-poi-editor-tabs'>
34
- <a class='mapp-poi-visual'><?php _e('Visual'); ?></a> | <a class='mapp-poi-html'><?php _e('HTML');?></a>
35
  </div>
36
- <a href='#' class='insert-media add_media' data-editor='mapp-poi-body'><?php _e('Add Media');?></a>
37
  </div>
38
  </div>
39
 
@@ -42,8 +42,8 @@
42
  </div>
43
 
44
  <div class='mapp-poi-toolbar'>
45
- <button data-mapp-poi='save' class='button button-primary'><?php _e('Save'); ?></button>
46
- <button data-mapp-poi='cancel' class='button'><?php _e('Cancel'); ?></button>
47
- <a href='#' data-mapp-poi='remove'><?php _e('Delete');?></a>
48
  </div>
49
  </script>
31
  <# } #>
32
 
33
  <div class='mapp-poi-editor-tabs'>
34
+ <a class='mapp-poi-visual'><?php _e('Visual', 'mappress-google-maps-for-wordpress'); ?></a> | <a class='mapp-poi-html'><?php _e('HTML', 'mappress-google-maps-for-wordpress');?></a>
35
  </div>
36
+ <a href='#' class='insert-media add_media' data-editor='mapp-poi-body'><?php _e('Add Media', 'mappress-google-maps-for-wordpress');?></a>
37
  </div>
38
  </div>
39
 
42
  </div>
43
 
44
  <div class='mapp-poi-toolbar'>
45
+ <button data-mapp-poi='save' class='button button-primary'><?php _e('Save', 'mappress-google-maps-for-wordpress'); ?></button>
46
+ <button data-mapp-poi='cancel' class='button'><?php _e('Cancel', 'mappress-google-maps-for-wordpress'); ?></button>
47
+ <a href='#' data-mapp-poi='remove'><?php _e('Delete', 'mappress-google-maps-for-wordpress');?></a>
48
  </div>
49
  </script>
templates_admin/mce.php CHANGED
@@ -3,36 +3,36 @@
3
  <div class='mapp-mce-list-panel mapp-open'>
4
  <div class='mapp-mce-header'>
5
  <div class='mapp-mce-header-left'>
6
- <h1><?php _e('Select a map');?></h1>
7
- <input data-mapp-mce='add' class='button' type='button' value='<?php esc_attr_e('Add New')?>' />
8
  </div>
9
  <?php echo Mappress::get_support_links(); ?>
10
  </div>
11
  <div class='mapp-mce-filter-block'>
12
  <div class='mapp-mce-search-block'>
13
- <?php _e('Search'); ?>
14
- <input type='text' size="15" class='mapp-mce-search' placeholder='<?php _e('post title');?>'>
15
  <span class='spinner'></span>
16
  </div>
17
  <div class='mapp-mce-types-block'>
18
- <label><input type='radio' name='mapp-mce-list-type' checked value='post'><?php _e('Attached to this post');?></label>
19
- <label><input type='radio' name='mapp-mce-list-type' value='all'><?php _e('All maps');?></label>
20
  </div>
21
  </div>
22
  <div class='mapp-mce-list'></div>
23
  <div class='mapp-mce-toolbar'>
24
- <input data-mapp-mce='close' class='button' type='button' value='<?php esc_attr_e('Close'); ?>' />
25
  </div>
26
  </div>
27
 
28
  <div class='mapp-mce-edit-panel'>
29
  <div class='mapp-mce-header'>
30
- <input class='mapp-mce-title' type='text' placeholder='<?php _e('Untitled');?>' />
31
  <?php echo Mappress::get_support_links(); ?>
32
  </div>
33
  <div class='mapp-mce-settings'>
34
  <div class='mapp-mce-setting'>
35
- <div class='mapp-mce-label'><?php _e('Size');?></div>
36
  <div class='mapp-mce-sizes'>
37
  <?php
38
  $sizes = array();
@@ -46,17 +46,17 @@
46
  </div>
47
  </div>
48
  <div class='mapp-mce-setting'>
49
- <div class='mapp-mce-label'><?php _e('Map ID');?></div>
50
  <div class='mapp-mce-mapid'></div>
51
  </div>
52
  </div>
53
  <div class='mapp-edit'></div>
54
  <div class='mapp-mce-toolbar'>
55
- <input data-mapp-mce='save' class='button button-primary' type='button' value='<?php esc_attr_e('Save'); ?>' />
56
- <input data-mapp-mce='cancel' class='button' type='button' value='<?php esc_attr_e('Cancel'); ?>' />
57
  <label class='mapp-mce-viewport-block'>
58
  <input type='checkbox' class='mapp-mce-viewport'>
59
- <?php _e('Save center / zoom');?>
60
  </label>
61
  </div>
62
  </div>
@@ -65,46 +65,46 @@
65
 
66
  <script type='text/template' id='mapp-tmpl-mce-list'>
67
  <div class='mapp-mce-list-header'>
68
- <div class='mapp-mce-col-map-title'><?php _e('Map title');?></div>
69
- <div class='mapp-mce-col-mapid'><?php _e('Map ID');?></div>
70
  <# if (type == 'all') { #>
71
- <div class='mapp-mce-col-post-title'><?php _e('Attached to');?></div>
72
  <# } #>
73
- <div class='mapp-mce-col-actions'><?php _e('Action');?></div>
74
  </div>
75
  <div class='mapp-mce-items'>
76
  <# _.forEach(items, function(item, i) { #>
77
  <# var className = (item.mapid == selected) ? 'mapp-mce-item mapp-selected' : 'mapp-mce-item'; #>
78
  <div class='{{className}}' data-mapp-mce-list='edit' data-mapp-mapid='{{ item.mapid }}'>
79
  <div class='mapp-mce-col-map-title'>
80
- <# if (item.map_title) { #>{{ item.map_title }}<# } else { #><?php _e('Untitled');?><# } #>
81
  </div>
82
 
83
  <div class='mapp-mce-col-mapid'>{{item.mapid}}</div>
84
 
85
  <# if (type == 'all') {
86
- var postTitle = (item.post_title) ? item.post_title : '<?php _e('Untitled');?>';
87
- postTitle = (item.postid == mappl10n.options.postid) ? '<?php _e('Current post');?>' : postTitle;
88
  var link = '';
89
  if (item.postid > 0) {
90
  link = (item.postid == mappl10n.options.postid) ? postTitle : '<a href="' + mappl10n.options.editurl + '?post=' + item.postid + '&action=edit" target="_blank">' + postTitle + '</a>';
91
  } else {
92
- link = '<?php _e('Unattached');?>';
93
  }
94
  #>
95
  <div class='mapp-mce-col-post-title'>{{{link}}}</div>
96
  <# } #>
97
 
98
  <div class='mapp-mce-col-actions'>
99
- <a href='#' data-mapp-mce-list='insert'><?php _e('Insert into post');?></a> |&nbsp;
100
- <a href='#' data-mapp-mce-list='remove'><?php _e('Delete');?></a>
101
  </div>
102
  </div>
103
  <# }); #>
104
  </div>
105
  <div class='mapp-mce-list-footer'>
106
  <# if (items.length == 0) { #>
107
- <?php _e('No maps found');?>
108
  <# } #>
109
  </div>
110
  </div>
3
  <div class='mapp-mce-list-panel mapp-open'>
4
  <div class='mapp-mce-header'>
5
  <div class='mapp-mce-header-left'>
6
+ <h1><?php _e('Select a map', 'mappress-google-maps-for-wordpress');?></h1>
7
+ <input data-mapp-mce='add' class='button' type='button' value='<?php esc_attr_e('Add New', 'mappress-google-maps-for-wordpress')?>' />
8
  </div>
9
  <?php echo Mappress::get_support_links(); ?>
10
  </div>
11
  <div class='mapp-mce-filter-block'>
12
  <div class='mapp-mce-search-block'>
13
+ <?php _e('Search', 'mappress-google-maps-for-wordpress'); ?>
14
+ <input type='text' size="15" class='mapp-mce-search' placeholder='<?php _e('post title', 'mappress-google-maps-for-wordpress');?>'>
15
  <span class='spinner'></span>
16
  </div>
17
  <div class='mapp-mce-types-block'>
18
+ <label><input type='radio' name='mapp-mce-list-type' checked value='post'><?php _e('Attached to this post', 'mappress-google-maps-for-wordpress');?></label>
19
+ <label><input type='radio' name='mapp-mce-list-type' value='all'><?php _e('All maps', 'mappress-google-maps-for-wordpress');?></label>
20
  </div>
21
  </div>
22
  <div class='mapp-mce-list'></div>
23
  <div class='mapp-mce-toolbar'>
24
+ <input data-mapp-mce='close' class='button' type='button' value='<?php esc_attr_e('Close', 'mappress-google-maps-for-wordpress'); ?>' />
25
  </div>
26
  </div>
27
 
28
  <div class='mapp-mce-edit-panel'>
29
  <div class='mapp-mce-header'>
30
+ <input class='mapp-mce-title' type='text' placeholder='<?php _e('Untitled', 'mappress-google-maps-for-wordpress');?>' />
31
  <?php echo Mappress::get_support_links(); ?>
32
  </div>
33
  <div class='mapp-mce-settings'>
34
  <div class='mapp-mce-setting'>
35
+ <div class='mapp-mce-label'><?php _e('Size', 'mappress-google-maps-for-wordpress');?></div>
36
  <div class='mapp-mce-sizes'>
37
  <?php
38
  $sizes = array();
46
  </div>
47
  </div>
48
  <div class='mapp-mce-setting'>
49
+ <div class='mapp-mce-label'><?php _e('Map ID', 'mappress-google-maps-for-wordpress');?></div>
50
  <div class='mapp-mce-mapid'></div>
51
  </div>
52
  </div>
53
  <div class='mapp-edit'></div>
54
  <div class='mapp-mce-toolbar'>
55
+ <input data-mapp-mce='save' class='button button-primary' type='button' value='<?php esc_attr_e('Save', 'mappress-google-maps-for-wordpress'); ?>' />
56
+ <input data-mapp-mce='cancel' class='button' type='button' value='<?php esc_attr_e('Cancel', 'mappress-google-maps-for-wordpress'); ?>' />
57
  <label class='mapp-mce-viewport-block'>
58
  <input type='checkbox' class='mapp-mce-viewport'>
59
+ <?php _e('Save center / zoom', 'mappress-google-maps-for-wordpress');?>
60
  </label>
61
  </div>
62
  </div>
65
 
66
  <script type='text/template' id='mapp-tmpl-mce-list'>
67
  <div class='mapp-mce-list-header'>
68
+ <div class='mapp-mce-col-map-title'><?php _e('Map title', 'mappress-google-maps-for-wordpress');?></div>
69
+ <div class='mapp-mce-col-mapid'><?php _e('Map ID', 'mappress-google-maps-for-wordpress');?></div>
70
  <# if (type == 'all') { #>
71
+ <div class='mapp-mce-col-post-title'><?php _e('Attached to', 'mappress-google-maps-for-wordpress');?></div>
72
  <# } #>
73
+ <div class='mapp-mce-col-actions'><?php _e('Action', 'mappress-google-maps-for-wordpress');?></div>
74
  </div>
75
  <div class='mapp-mce-items'>
76
  <# _.forEach(items, function(item, i) { #>
77
  <# var className = (item.mapid == selected) ? 'mapp-mce-item mapp-selected' : 'mapp-mce-item'; #>
78
  <div class='{{className}}' data-mapp-mce-list='edit' data-mapp-mapid='{{ item.mapid }}'>
79
  <div class='mapp-mce-col-map-title'>
80
+ <# if (item.map_title) { #>{{ item.map_title }}<# } else { #><?php _e('Untitled', 'mappress-google-maps-for-wordpress');?><# } #>
81
  </div>
82
 
83
  <div class='mapp-mce-col-mapid'>{{item.mapid}}</div>
84
 
85
  <# if (type == 'all') {
86
+ var postTitle = (item.post_title) ? item.post_title : '<?php _e('Untitled', 'mappress-google-maps-for-wordpress');?>';
87
+ postTitle = (item.postid == mappl10n.options.postid) ? '<?php _e('Current post', 'mappress-google-maps-for-wordpress');?>' : postTitle;
88
  var link = '';
89
  if (item.postid > 0) {
90
  link = (item.postid == mappl10n.options.postid) ? postTitle : '<a href="' + mappl10n.options.editurl + '?post=' + item.postid + '&action=edit" target="_blank">' + postTitle + '</a>';
91
  } else {
92
+ link = '<?php _e('Unattached', 'mappress-google-maps-for-wordpress');?>';
93
  }
94
  #>
95
  <div class='mapp-mce-col-post-title'>{{{link}}}</div>
96
  <# } #>
97
 
98
  <div class='mapp-mce-col-actions'>
99
+ <a href='#' data-mapp-mce-list='insert'><?php _e('Insert into post', 'mappress-google-maps-for-wordpress');?></a> |&nbsp;
100
+ <a href='#' data-mapp-mce-list='remove'><?php _e('Delete', 'mappress-google-maps-for-wordpress');?></a>
101
  </div>
102
  </div>
103
  <# }); #>
104
  </div>
105
  <div class='mapp-mce-list-footer'>
106
  <# if (items.length == 0) { #>
107
+ <?php _e('No maps found', 'mappress-google-maps-for-wordpress');?>
108
  <# } #>
109
  </div>
110
  </div>
templates_admin/widgets.php CHANGED
@@ -4,13 +4,13 @@
4
  <# _.each(colors, function(color, i) { #>
5
  <span data-mapp-color='{{color}}' class='mapp-color' style='background-color: {{color}}' tabindex='0'></span>
6
  <# }); #>
7
- <?php _e('Opacity'); ?>
8
  <select class='mapp-opacity'>
9
  <# for (var i = 100; i >= 0; i -= 10) { #>
10
  <option value='{{i}}'>{{i}}</option>
11
  <# } #>
12
  </select>
13
- <?php _e('Weight'); ?>
14
  <select class='mapp-weight'>
15
  <# for (var i = 1; i <= 20; i++) { #>
16
  <option value='{{i}}'>{{i}}</option>
@@ -25,7 +25,7 @@
25
  <ul class='mapp-icon-editor-list'>
26
  <# if (!mappl10n.options.userIcons.length) { #>
27
  <h2 class='mapp-icon-editor-msg'>
28
- <?php _e('No custom icons have been added yet.');?>
29
  </h2>
30
  <# } #>
31
  <# _.each(mappl10n.options.userIcons, function(icon, i) { #>
@@ -39,7 +39,7 @@
39
  </div>
40
  <div class='mapp-icon-editor-toolbar'>
41
  <input type='file' multiple name='mapp-icon-files' class='mapp-icon-files'>
42
- <button data-mapp-action='add' class='button mapp-icon-add'><?php _e('Add');?></button>
43
  </div>
44
  </div>
45
  </script>
@@ -56,7 +56,7 @@
56
  <# }); #>
57
  </div>
58
  <div class='mapp-iconpicker-toolbar'>
59
- <input class='button' data-mapp-iconid='' type='button' value='<?php _e('Use default icon');?>'>
60
  </div>
61
  </div>
62
  </div>
@@ -64,18 +64,18 @@
64
 
65
  <script type='text/html' id='mapp-tmpl-tp-master'>
66
  <div class='mapp-tp-editor'>
67
- <?php echo Mappress_Controls::select('', array('map-popup' => __('Map popup'), 'map-item' => __('Map list item'), 'mashup-popup' => __('Mashup popup'), 'mashup-item' => __('Mashup list item')), 'map-tmpl-poi', array('class' => 'mapp-tp-select')); ?>
68
- <?php echo Mappress_Controls::button('', __('Edit'), array('class' => 'button button-primary', 'data-mapp-action' => 'edit')); ?>
69
  </div>
70
  </script>
71
 
72
  <script type='text/html' id='mapp-tmpl-tp-detail'>
73
  <div class='mapp-tp-detail'>
74
- <div class='mapp-tp-name'>{{ model.name }} <# if (!model.exists) { #>(<?php _e('New');?>)<# } else { #>(<?php _e('Custom');?>)<# } #></div>
75
  <div class='mapp-tp-path'>{{ model.path }}</div>
76
  <div class='mapp-tabs'>
77
- <div class='mapp-tab-label mapp-active' class='mapp-active'><?php _e('Editor');?></div>
78
- <div class='mapp-tab-label'><?php _e('Default');?></div>
79
  <div class='mapp-tab mapp-tab-content mapp-active'>
80
  <# _.each(tokens, function (token, i) { #>
81
  <code data-mapp-action='insert' data-mapp-insert='{{{i}}}' title='{{{i}}}'>{{{token}}}</code>
@@ -88,10 +88,10 @@
88
  </div>
89
  </div>
90
  <div class='mapp-tp-toolbar'>
91
- <input type='button' class='button button-primary' data-mapp-action='save' value='<?php _e('Save');?>'>
92
- <input type='button' class='button' data-mapp-action='cancel' value='<?php _e('Cancel');?>'>
93
  <# if (model.exists) { #>
94
- <a href='#' data-mapp-action='destroy'><?php _e('Delete');?></a>
95
  <# } #>
96
  </div>
97
  </div>
4
  <# _.each(colors, function(color, i) { #>
5
  <span data-mapp-color='{{color}}' class='mapp-color' style='background-color: {{color}}' tabindex='0'></span>
6
  <# }); #>
7
+ <?php _e('Opacity', 'mappress-google-maps-for-wordpress'); ?>
8
  <select class='mapp-opacity'>
9
  <# for (var i = 100; i >= 0; i -= 10) { #>
10
  <option value='{{i}}'>{{i}}</option>
11
  <# } #>
12
  </select>
13
+ <?php _e('Weight', 'mappress-google-maps-for-wordpress'); ?>
14
  <select class='mapp-weight'>
15
  <# for (var i = 1; i <= 20; i++) { #>
16
  <option value='{{i}}'>{{i}}</option>
25
  <ul class='mapp-icon-editor-list'>
26
  <# if (!mappl10n.options.userIcons.length) { #>
27
  <h2 class='mapp-icon-editor-msg'>
28
+ <?php _e('No custom icons have been added yet.', 'mappress-google-maps-for-wordpress');?>
29
  </h2>
30
  <# } #>
31
  <# _.each(mappl10n.options.userIcons, function(icon, i) { #>
39
  </div>
40
  <div class='mapp-icon-editor-toolbar'>
41
  <input type='file' multiple name='mapp-icon-files' class='mapp-icon-files'>
42
+ <button data-mapp-action='add' class='button mapp-icon-add'><?php _e('Add', 'mappress-google-maps-for-wordpress');?></button>
43
  </div>
44
  </div>
45
  </script>
56
  <# }); #>
57
  </div>
58
  <div class='mapp-iconpicker-toolbar'>
59
+ <input class='button' data-mapp-iconid='' type='button' value='<?php _e('Use default icon', 'mappress-google-maps-for-wordpress');?>'>
60
  </div>
61
  </div>
62
  </div>
64
 
65
  <script type='text/html' id='mapp-tmpl-tp-master'>
66
  <div class='mapp-tp-editor'>
67
+ <?php echo Mappress_Controls::select('', array('map-popup' => __('Map popup', 'mappress-google-maps-for-wordpress'), 'map-item' => __('Map list item', 'mappress-google-maps-for-wordpress'), 'mashup-popup' => __('Mashup popup', 'mappress-google-maps-for-wordpress'), 'mashup-item' => __('Mashup list item', 'mappress-google-maps-for-wordpress')), 'map-tmpl-poi', array('class' => 'mapp-tp-select')); ?>
68
+ <?php echo Mappress_Controls::button('', __('Edit', 'mappress-google-maps-for-wordpress'), array('class' => 'button button-primary', 'data-mapp-action' => 'edit')); ?>
69
  </div>
70
  </script>
71
 
72
  <script type='text/html' id='mapp-tmpl-tp-detail'>
73
  <div class='mapp-tp-detail'>
74
+ <div class='mapp-tp-name'>{{ model.name }} <# if (!model.exists) { #>(<?php _e('New', 'mappress-google-maps-for-wordpress');?>)<# } else { #>(<?php _e('Custom', 'mappress-google-maps-for-wordpress');?>)<# } #></div>
75
  <div class='mapp-tp-path'>{{ model.path }}</div>
76
  <div class='mapp-tabs'>
77
+ <div class='mapp-tab-label mapp-active' class='mapp-active'><?php _e('Editor', 'mappress-google-maps-for-wordpress');?></div>
78
+ <div class='mapp-tab-label'><?php _e('Default', 'mappress-google-maps-for-wordpress');?></div>
79
  <div class='mapp-tab mapp-tab-content mapp-active'>
80
  <# _.each(tokens, function (token, i) { #>
81
  <code data-mapp-action='insert' data-mapp-insert='{{{i}}}' title='{{{i}}}'>{{{token}}}</code>
88
  </div>
89
  </div>
90
  <div class='mapp-tp-toolbar'>
91
+ <input type='button' class='button button-primary' data-mapp-action='save' value='<?php _e('Save', 'mappress-google-maps-for-wordpress');?>'>
92
+ <input type='button' class='button' data-mapp-action='cancel' value='<?php _e('Cancel', 'mappress-google-maps-for-wordpress');?>'>
93
  <# if (model.exists) { #>
94
+ <a href='#' data-mapp-action='destroy'><?php _e('Delete', 'mappress-google-maps-for-wordpress');?></a>
95
  <# } #>
96
  </div>
97
  </div>