From 2004d4a21cfc14f5eaf1895d387e5fa0c6641e04 Mon Sep 17 00:00:00 2001 From: wpsmort Date: Thu, 30 Jun 2016 16:18:27 -0400 Subject: [PATCH 1/5] Issue #84 Uncommented out all references to api_key --- classes/import-export.php | 8 ++------ classes/locations.php | 2 +- classes/options-general.php | 6 ++---- classes/simplemap.php | 6 +----- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/classes/import-export.php b/classes/import-export.php index b0818e6..7380073 100644 --- a/classes/import-export.php +++ b/classes/import-export.php @@ -524,10 +524,8 @@ public function do_csv_preview() { global $simple_map, $blog_id; $options = $simple_map->get_options(); - /* if ( !isset( $options['api_key'] ) ) $options['api_key'] = ''; - */ extract( $options ); @@ -697,10 +695,8 @@ public function print_page() { global $simple_map; $options = $simple_map->get_options(); - /* if ( !isset( $options['api_key'] ) ) $options['api_key'] = ''; - */ extract( $options ); @@ -810,9 +806,9 @@ public function print_page() { value="'; _e( 'Import CSV File', 'SimpleMap' ); echo '"/>'; - /* if ( '' == $options['api_key'] ) : ?> + if ( '' == $options['api_key'] ) : ?> API key if you need your locaitons geocoded.", 'SimpleMap' ), admin_url( "admin.php?page=simplemap" ) ); ?> - diff --git a/classes/locations.php b/classes/locations.php index 4e56e51..47e3882 100644 --- a/classes/locations.php +++ b/classes/locations.php @@ -633,7 +633,7 @@ function save_post_meta( $post ) { $options = $simple_map->get_options(); $post_object = get_post( $post ); - //$api_key = ( isset( $options['api_key'] ) && !empty( $options['api_key'] ) ) ? $options['api_key'] : ''; + $api_key = ( isset( $options['api_key'] ) && !empty( $options['api_key'] ) ) ? $options['api_key'] : ''; // Grab old data. $location_address = get_post_meta( $post, 'location_address', true ) ?: ' '; diff --git a/classes/options-general.php b/classes/options-general.php index a13823c..7e4edc0 100644 --- a/classes/options-general.php +++ b/classes/options-general.php @@ -68,7 +68,7 @@ function update_options() { $new_options = $options; // Validate POST Options - //$new_options['api_key'] = ( ! empty( $_POST['api_key'] ) ) ? $_POST['api_key'] : ''; + $new_options['api_key'] = ( ! empty( $_POST['api_key'] ) ) ? $_POST['api_key'] : ''; $new_options['map_width'] = ( ! empty( $_POST['map_width'] ) ) ? $_POST['map_width'] : $options['map_width']; $new_options['map_height'] = ( ! empty( $_POST['map_height'] ) ) ? $_POST['map_height'] : $options['map_height']; $new_options['default_lat'] = ( ! empty( $_POST['default_lat'] ) ) ? $_POST['default_lat'] : $options['default_lat']; @@ -401,7 +401,7 @@ function print_page() {
- - */ ?> - jQuery( "#simplemap" ).html( "

General Settings before your maps will work.', 'SimpleMap' ), admin_url( 'admin.php?page=simplemap' ) ); ?>

" ); @@ -1800,7 +1798,7 @@ function get_options() { 'adsense_pub_id' => '', 'adsense_channel_id' => '', 'adsense_max_ads' => 2, - // 'api_key' => '', + 'api_key' => '', 'auto_locate' => '', 'taxonomies' => array( 'sm-category' => $this->get_taxonomy_settings( 'sm-category' ), @@ -2317,10 +2315,8 @@ function show_toolbar( $title = '' ) {
@@ -409,8 +409,6 @@ function print_page() { get_api_link() . '">', ''); ?>

' . __( 'You must enter an API key for your domain.', 'SimpleMap' ).' ' . __( 'Enter a key on the General Options page.', 'SimpleMap' ) . '

'; - */ } /** From 2cd8ded4a570b49cce019a4e961cae1e3b7c7159 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Thu, 30 Jun 2016 16:45:43 -0400 Subject: [PATCH 2/5] show api key in source #84 --- classes/simplemap.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/simplemap.php b/classes/simplemap.php index 696d4d6..d0bde62 100644 --- a/classes/simplemap.php +++ b/classes/simplemap.php @@ -645,9 +645,9 @@ function enqueue_frontend_scripts_styles() { // Scripts. wp_enqueue_script( 'simplemap-master-js', '?' . $mylang . 'simplemap-master-js=1&smpid=' . $post->ID, array( 'jquery' ) ); - // Google API v3 does not need a key. + // Google API v3 now requires an API key. $url_params = array( - 'sensor' => 'false', + 'key' => $options['api_key'], 'v' => '3', 'language' => $options['default_language'], 'region' => $options['default_country'], @@ -671,10 +671,10 @@ function enqueue_backend_scripts_styles() { wp_enqueue_script( 'simplemap-general-options-js', get_home_url() . '/?simplemap-general-options-js', array( 'jquery' ) ); } - // Google API v3 does not need a key. + // Google API v3 not requires and API key. $url_params = array( 'v' => '3', - 'sensor' => 'false', + 'key' => $options['api_key'], 'language' => $options['default_language'], 'region' => $options['default_country'], ); From b2ecf3d24ee577f83a526febd1942f5e00fb2d16 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Thu, 30 Jun 2016 17:00:43 -0400 Subject: [PATCH 3/5] link to api page opens in new tab --- classes/options-general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/options-general.php b/classes/options-general.php index 7e4edc0..ef29bac 100644 --- a/classes/options-general.php +++ b/classes/options-general.php @@ -406,7 +406,7 @@ function print_page() {
- get_api_link() . '">', ''); ?> + get_api_link() . '" target="_blank">', ''); ?> From 14c7450ccf1ac862231dc9e3270a7cd7c3b32d70 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Thu, 30 Jun 2016 17:03:43 -0400 Subject: [PATCH 4/5] new api link --- classes/options-general.php | 2 +- classes/simplemap.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/options-general.php b/classes/options-general.php index ef29bac..33c9305 100644 --- a/classes/options-general.php +++ b/classes/options-general.php @@ -406,7 +406,7 @@ function print_page() {
- get_api_link() . '" target="_blank">', ''); ?> + get_api_link() . '" target="_blank">', ''); ?> diff --git a/classes/simplemap.php b/classes/simplemap.php index d0bde62..2c7d722 100644 --- a/classes/simplemap.php +++ b/classes/simplemap.php @@ -2339,6 +2339,10 @@ function get_search_radii() { * @return string */ function get_api_link() { + + // The old URLs seem to be outdated. Not sure about the international ones. + return 'https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key'; + $lo = str_replace( '_', '-', get_locale() ); $l = substr( $lo, 0, 2 ); switch ( $l ) { From 6cf01921a74d83f6ac804b89a583626942466b43 Mon Sep 17 00:00:00 2001 From: Michael Torbert Date: Thu, 30 Jun 2016 17:11:59 -0400 Subject: [PATCH 5/5] updated readme and version bump --- readme.txt | 9 +++++++-- simplemap.php | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/readme.txt b/readme.txt index 02236f3..348bd5d 100644 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Contributors: hallsofmontezuma, fullthrottledevelopment Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=SimpleMap&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8 Tags: map, maps, store locator, database, locations, stores, Google maps, locator Requires at least: 2.8 -Tested up to: 4.5 -Stable tag: 2.4.9 +Tested up to: 4.5.3 +Stable tag: 2.4.10 SimpleMap is an easy-to-use international store locator plugin that uses Google Maps to display information directly on your WordPress site. @@ -53,6 +53,7 @@ With SimpleMap, you can easily put a store locator on your WordPress site in sec You must have: +* A free Google Maps API key * WordPress 2.8 or later * PHP 5 (or PHP 4 with the SimpleXML extension loaded), DOMDocument class @@ -82,6 +83,10 @@ Please open a ticket on [the SimpleMap project's repo on Github](https://github. == Changelog == += 2.4.10 = + +* Important Update! Google now requires a (free) API key. Update, get an API key, and enter it into your settings. + = 2.4.9 = This release has a lot on under the hood performance improvements, code optimizations, lots of small bugfixes, etc, including: diff --git a/simplemap.php b/simplemap.php index dccc748..9e720b9 100644 --- a/simplemap.php +++ b/simplemap.php @@ -1,7 +1,7 @@