Flexible Map - Version 1.12.0

Version Description

added support for Google Maps API key, required since 2016-06-22 for new websites

=

Download this release

Release Info

Developer webaware
Plugin Icon 128x128 Flexible Map
Version 1.12.0
Comparing to
See all releases

Code changes from version 1.11.0 to 1.12.0

changelog.md CHANGED
@@ -2,6 +2,10 @@
2
 
3
  ## Changelog
4
 
 
 
 
 
5
  ### 1.11.0, 2016-06-05
6
 
7
  * fixed: monitor changes to invisible containers, not just non-displayed containers (thanks, [zetoun17](https://profiles.wordpress.org/zetoun17/)!)
2
 
3
  ## Changelog
4
 
5
+ ### 1.12.0, 2016-06-27
6
+
7
+ * added: support for [Google Maps API key](https://developers.google.com/maps/documentation/javascript/), required [since 2016-06-22 for new websites](http://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html).
8
+
9
  ### 1.11.0, 2016-06-05
10
 
11
  * fixed: monitor changes to invisible containers, not just non-displayed containers (thanks, [zetoun17](https://profiles.wordpress.org/zetoun17/)!)
flexible-map.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://flexible-map.webaware.net.au/
5
  Description: Embed Google Maps shortcodes in pages and posts, either by centre coordinates or street address, or by URL to a Google Earth KML file. <a href="http://flexible-map.webaware.net.au/manual/getting-started/">Get started</a> with a simple shortcode. See the <a href="http://flexible-map.webaware.net.au/manual/attribute-reference/">complete attribute reference</a> for more details.
6
- Version: 1.11.0
7
  Author: WebAware
8
  Author URI: http://webaware.com.au/
9
  Text Domain: wp-flexible-map
@@ -36,7 +36,8 @@ if (!defined('ABSPATH')) {
36
  define('FLXMAP_PLUGIN_FILE', __FILE__);
37
  define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
38
  define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
39
- define('FLXMAP_PLUGIN_VERSION', '1.11.0');
 
40
 
41
  // shortcode tags
42
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
3
  Plugin Name: Flexible Map
4
  Plugin URI: http://flexible-map.webaware.net.au/
5
  Description: Embed Google Maps shortcodes in pages and posts, either by centre coordinates or street address, or by URL to a Google Earth KML file. <a href="http://flexible-map.webaware.net.au/manual/getting-started/">Get started</a> with a simple shortcode. See the <a href="http://flexible-map.webaware.net.au/manual/attribute-reference/">complete attribute reference</a> for more details.
6
+ Version: 1.12.0
7
  Author: WebAware
8
  Author URI: http://webaware.com.au/
9
  Text Domain: wp-flexible-map
36
  define('FLXMAP_PLUGIN_FILE', __FILE__);
37
  define('FLXMAP_PLUGIN_ROOT', dirname(__FILE__) . '/');
38
  define('FLXMAP_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
39
+ define('FLXMAP_PLUGIN_OPTIONS', 'flexible_map');
40
+ define('FLXMAP_PLUGIN_VERSION', '1.12.0');
41
 
42
  // shortcode tags
43
  define('FLXMAP_PLUGIN_TAG_MAP', 'flexiblemap');
includes/class.FlxMapAdmin.php CHANGED
@@ -14,6 +14,8 @@ class FlxMapAdmin {
14
  */
15
  public function __construct() {
16
  add_action('admin_init', array($this, 'adminInit'));
 
 
17
  add_filter('plugins_update_check_locales', array($this, 'updateCheckLocales'));
18
  }
19
 
@@ -22,12 +24,49 @@ class FlxMapAdmin {
22
  */
23
  public function adminInit() {
24
  if (current_user_can('manage_options')) {
25
- add_filter('plugin_row_meta', array($this, 'addPluginDetailsLinks'), 10, 2);
26
  }
 
 
 
27
  }
28
 
29
  /**
30
- * action hook for adding plugin details links
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  */
32
  public function addPluginDetailsLinks($links, $file) {
33
  // add settings link
@@ -42,6 +81,18 @@ class FlxMapAdmin {
42
  return $links;
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  /**
46
  * inject wanted translation locales for plugins, so that we can get up-to-date translations from translate.wordpress.org
47
  * @param array $locales
14
  */
15
  public function __construct() {
16
  add_action('admin_init', array($this, 'adminInit'));
17
+ add_action('admin_menu', array($this, 'adminMenu'));
18
+ add_filter('plugin_row_meta', array($this, 'addPluginDetailsLinks'), 10, 2);
19
  add_filter('plugins_update_check_locales', array($this, 'updateCheckLocales'));
20
  }
21
 
24
  */
25
  public function adminInit() {
26
  if (current_user_can('manage_options')) {
27
+ add_action('plugin_action_links_' . FLXMAP_PLUGIN_NAME, array($this, 'addPluginActionLinks'));
28
  }
29
+
30
+ add_settings_section(FLXMAP_PLUGIN_OPTIONS, false, false, FLXMAP_PLUGIN_OPTIONS);
31
+ register_setting(FLXMAP_PLUGIN_OPTIONS, FLXMAP_PLUGIN_OPTIONS, array($this, 'settingsValidate'));
32
  }
33
 
34
  /**
35
+ * admin menu items
36
+ */
37
+ public function adminMenu() {
38
+ $label = __('Flexible Map', 'wp-flexible-map');
39
+ add_options_page($label, $label, 'manage_options', 'flexible-map', array($this, 'settingsPage'));
40
+ }
41
+
42
+ /**
43
+ * settings admin
44
+ */
45
+ public function settingsPage() {
46
+ $options = get_option(FLXMAP_PLUGIN_OPTIONS, array());
47
+
48
+ $options = wp_parse_args($options, array(
49
+ 'apiKey' => '',
50
+ ));
51
+
52
+ require FLXMAP_PLUGIN_ROOT . 'views/settings-form.php';
53
+ }
54
+
55
+ /**
56
+ * validate settings on save
57
+ * @param array $input
58
+ * @return array
59
+ */
60
+ public function settingsValidate($input) {
61
+ $output = array();
62
+
63
+ $output['apiKey'] = trim(strip_tags($input['apiKey']));
64
+
65
+ return $output;
66
+ }
67
+
68
+ /**
69
+ * add plugin details links
70
  */
71
  public function addPluginDetailsLinks($links, $file) {
72
  // add settings link
81
  return $links;
82
  }
83
 
84
+ /**
85
+ * add plugin action links
86
+ */
87
+ public function addPluginActionLinks($links) {
88
+ // add settings link
89
+ $url = admin_url('options-general.php?page=flexible-map');
90
+ $settings_link = sprintf('<a href="%s">%s</a>', $url, _x('Settings', 'plugin details links', 'wp-flexible-map'));
91
+ array_unshift($links, $settings_link);
92
+
93
+ return $links;
94
+ }
95
+
96
  /**
97
  * inject wanted translation locales for plugins, so that we can get up-to-date translations from translate.wordpress.org
98
  * @param array $locales
includes/class.FlxMapPlugin.php CHANGED
@@ -83,8 +83,14 @@ class FlxMapPlugin {
83
  * register and enqueue any scripts and styles we require
84
  */
85
  public function enqueueScripts() {
86
- // allow others to override the Google Maps API URL
87
- $args = apply_filters('flexmap_google_maps_api_args', array('v' => '3.24'));
 
 
 
 
 
 
88
  $apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, 'https://maps.google.com/maps/api/js'));
89
  if (!empty($apiURL)) {
90
  wp_register_script('google-maps', $apiURL, false, null, true);
83
  * register and enqueue any scripts and styles we require
84
  */
85
  public function enqueueScripts() {
86
+ $options = get_option(FLXMAP_PLUGIN_OPTIONS, array());
87
+
88
+ $args = array('v' => '3.24');
89
+ if (!empty($options['apiKey'])) {
90
+ $args['key'] = $options['apiKey'];
91
+ }
92
+ $args = apply_filters('flexmap_google_maps_api_args', $args);
93
+
94
  $apiURL = apply_filters('flexmap_google_maps_api_url', add_query_arg($args, 'https://maps.google.com/maps/api/js'));
95
  if (!empty($apiURL)) {
96
  wp_register_script('google-maps', $apiURL, false, null, true);
readme.txt CHANGED
@@ -5,9 +5,9 @@ Plugin URI: http://flexible-map.webaware.net.au/
5
  Author URI: http://webaware.com.au/
6
  Donate link: http://shop.webaware.com.au/donations/?donation_for=Flexible+Map
7
  Tags: google, map, maps, google maps, shortcode, google maps shortcode, kml
8
- Requires at least: 3.2.1
9
- Tested up to: 4.5.2
10
- Stable tag: 1.11.0
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -23,7 +23,6 @@ Flexible Map allows you to add Google Maps to your WordPress website with simple
23
  * by centre coordinates
24
  * by street address
25
  * by URL to a Google Earth KML file
26
- * no special Google Maps key is required -- uses the latest stable Google Maps API
27
  * simple shortcode for adding maps to pages/posts
28
  * PHP function `flexmap_show_map()` for theme and plugin developers
29
  * supports multiple maps on a page/post
@@ -68,7 +67,8 @@ The initial translations for all other languages were made using Google Translat
68
 
69
  1. Upload this plugin to your /wp-content/plugins/ directory.
70
  2. Activate the plugin through the 'Plugins' menu in WordPress.
71
- 3. Add the shortcode `[flexiblemap]` to your pages / posts to embed maps
 
72
 
73
  There are two ways to load maps with this plugin:
74
 
@@ -169,11 +169,19 @@ For more information and examples, see [the reference website](http://flexible-m
169
 
170
  == Frequently Asked Questions ==
171
 
 
 
 
 
172
  = Where are the settings? =
173
 
174
- There are none! You just need to add some attributes to your shortcode telling the map what to do.
 
 
 
 
175
 
176
- Of course, in WordPress there is a plugin for everything :) so if you *want* settings, please install the [Flexible Map Options plugin](https://wordpress.org/plugins/wp-flexible-map-options/). That plugin lets you set some defaults so that if you use the same attributes over and over, you can put them all in one place.
177
 
178
  = Can I add multiple markers to a map? =
179
 
@@ -304,17 +312,22 @@ Either turn off CloudFlare Rocketscript :) or install the [Flxmap No Rocketscrip
304
  2. `[flexiblemap address="116 Beaumont Street Hamilton NSW Australia" title="Raj's Corner" description="SWMBO's favourite Indian diner" width="100%" height="400px" directions="true"]`
305
  3. `[flexiblemap src="http://webaware.com.au/maps/example-toronto.kml" width="100%" height="400px" maptype="satellite"]`
306
  4. `[flexiblemap center="-34.916721,138.828878" width="100%" height="400px" title="Adelaide Hills" directions="true" showdirections="true" directionsfrom="Adelaide" region="au"]`
 
307
 
308
  == Upgrade Notice ==
309
 
310
- = 1.11.0 =
311
 
312
- use localisation from translate.wordpress.org in preference to local plugin copy; bump version of Google Maps API to 3.24
313
 
314
  == Changelog ==
315
 
316
  The full changelog can be found [on GitHub](https://github.com/webaware/flexible-map/blob/master/changelog.md). Recent entries:
317
 
 
 
 
 
318
  ### 1.11.0, 2016-06-05
319
 
320
  * fixed: monitor changes to invisible containers, not just non-displayed containers (thanks, [zetoun17](https://profiles.wordpress.org/zetoun17/)!)
@@ -323,4 +336,3 @@ The full changelog can be found [on GitHub](https://github.com/webaware/flexible
323
  * changed: use localisation from [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/wp-flexible-map) in preference to local plugin copy
324
  * changed: translations updated from translate.wordpress.org
325
  * changed: bump version of Google Maps API to 3.24
326
-
5
  Author URI: http://webaware.com.au/
6
  Donate link: http://shop.webaware.com.au/donations/?donation_for=Flexible+Map
7
  Tags: google, map, maps, google maps, shortcode, google maps shortcode, kml
8
+ Requires at least: 4.0
9
+ Tested up to: 4.6
10
+ Stable tag: 1.12.0
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
23
  * by centre coordinates
24
  * by street address
25
  * by URL to a Google Earth KML file
 
26
  * simple shortcode for adding maps to pages/posts
27
  * PHP function `flexmap_show_map()` for theme and plugin developers
28
  * supports multiple maps on a page/post
67
 
68
  1. Upload this plugin to your /wp-content/plugins/ directory.
69
  2. Activate the plugin through the 'Plugins' menu in WordPress.
70
+ 3. Get an [API Key from Google](https://developers.google.com/maps/documentation/javascript/) and add it to Settings > Flexible Map
71
+ 4. Add the shortcode `[flexiblemap]` to your pages / posts to embed maps
72
 
73
  There are two ways to load maps with this plugin:
74
 
169
 
170
  == Frequently Asked Questions ==
171
 
172
+ = Do I need an API key? =
173
+
174
+ All websites using Google Maps for the first time need an API key. Websites that were using Google Maps before 2016-06-22 are permitted to keep using Google Maps without a key -- for now, at least. Read [this Google blog post](http://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html) for more information.
175
+
176
  = Where are the settings? =
177
 
178
+ You can set your [API key](https://developers.google.com/maps/documentation/javascript/) in the WordPress admin:
179
+
180
+ Settings > Flexible Map
181
+
182
+ For everything else, just add some attributes to your shortcode telling the map what to do.
183
 
184
+ Of course, in WordPress there is a plugin for everything :) so if you *want* more settings, please install the [Flexible Map Options plugin](https://wordpress.org/plugins/wp-flexible-map-options/). That plugin lets you set some defaults so that if you use the same attributes over and over, you can put them all in one place.
185
 
186
  = Can I add multiple markers to a map? =
187
 
312
  2. `[flexiblemap address="116 Beaumont Street Hamilton NSW Australia" title="Raj's Corner" description="SWMBO's favourite Indian diner" width="100%" height="400px" directions="true"]`
313
  3. `[flexiblemap src="http://webaware.com.au/maps/example-toronto.kml" width="100%" height="400px" maptype="satellite"]`
314
  4. `[flexiblemap center="-34.916721,138.828878" width="100%" height="400px" title="Adelaide Hills" directions="true" showdirections="true" directionsfrom="Adelaide" region="au"]`
315
+ 5. Setting screen with API key field
316
 
317
  == Upgrade Notice ==
318
 
319
+ = 1.12.0 =
320
 
321
+ added support for Google Maps API key, required since 2016-06-22 for new websites
322
 
323
  == Changelog ==
324
 
325
  The full changelog can be found [on GitHub](https://github.com/webaware/flexible-map/blob/master/changelog.md). Recent entries:
326
 
327
+ ### 1.12.0, 2016-06-27
328
+
329
+ * added: support for [Google Maps API key](https://developers.google.com/maps/documentation/javascript/), required [since 2016-06-22 for new websites](http://googlegeodevelopers.blogspot.com.au/2016/06/building-for-scale-updates-to-google.html).
330
+
331
  ### 1.11.0, 2016-06-05
332
 
333
  * fixed: monitor changes to invisible containers, not just non-displayed containers (thanks, [zetoun17](https://profiles.wordpress.org/zetoun17/)!)
336
  * changed: use localisation from [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/wp-flexible-map) in preference to local plugin copy
337
  * changed: translations updated from translate.wordpress.org
338
  * changed: bump version of Google Maps API to 3.24
 
views/settings-form.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // settings form
3
+
4
+ if (!defined('ABSPATH')) {
5
+ exit;
6
+ }
7
+ ?>
8
+
9
+ <div class="wrap">
10
+ <h2><?php esc_html_e('Flexible Map', 'wp-flexible-map'); ?></h2>
11
+
12
+ <form action="<?php echo admin_url('options.php'); ?>" method="POST">
13
+ <?php settings_fields(FLXMAP_PLUGIN_OPTIONS); ?>
14
+
15
+ <table class="form-table">
16
+
17
+ <tr valign="top">
18
+ <th scope="row"><?php echo esc_html_x('API key', 'settings', 'wp-flexible-map'); ?></th>
19
+ <td>
20
+ <input type="text" class="regular-text" name="flexible_map[apiKey]" value="<?php echo esc_attr($options['apiKey']); ?>" />
21
+ <br />
22
+ <em><?php printf(wp_kses_data(_x('Get your API key from the <a target="_blank" href="%s">Google Maps API website</a>.', 'settings', 'wp-flexible-map')), 'https://developers.google.com/maps/documentation/javascript/'); ?></em>
23
+ </td>
24
+ </tr>
25
+
26
+ </table>
27
+
28
+ <?php submit_button(); ?>
29
+ </form>
30
+ </div>