Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #87 from semperfiwebdesign/development
Browse files Browse the repository at this point in the history
Development to master for 2.4.10
  • Loading branch information
michaeltorbert authored Jun 30, 2016
2 parents 4a648f4 + 82dc061 commit 0d133a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
8 changes: 2 additions & 6 deletions classes/import-export.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -810,9 +806,9 @@ public function print_page() {
value="';
_e( 'Import CSV File', 'SimpleMap' );
echo '"/>';
/* if ( '' == $options['api_key'] ) : ?>
if ( '' == $options['api_key'] ) : ?>
<?php printf( __( "Warning: You still need to enter an <a href='%s'>API key</a> if you need your locaitons geocoded.", 'SimpleMap' ), admin_url( "admin.php?page=simplemap" ) ); ?>
<?php endif; */
<?php endif;

echo '</form>
Expand Down
2 changes: 1 addition & 1 deletion classes/locations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ?: ' ';
Expand Down
8 changes: 3 additions & 5 deletions classes/options-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -401,16 +401,14 @@ function print_page() {

<div class="table">
<table class="form-table">
<?php /*

<tr valign="top">
<td width="150"><label for="api_key"><?php _e( 'Google Maps API Key', 'SimpleMap' ); ?></label></td>
<td>
<input type="text" name="api_key" id="api_key" size="50" value="<?php echo esc_attr( $api_key ); ?>" /><br />
<small><em><?php printf( __( '%s Click here%s to sign up for a Google Maps API key for your domain.', 'SimpleMap' ), '<a href="' . $simple_map->get_api_link() . '">', '</a>'); ?></em></small>
<small><em><?php printf( __( '%s Click here%s to sign up for a free Google Maps API key for your domain.', 'SimpleMap' ), '<a href="' . $simple_map->get_api_link() . '" target="_blank">', '</a>'); ?></em></small>
</td>
</tr>
*/ ?>

<tr valign="top">

<?php
Expand Down
18 changes: 9 additions & 9 deletions classes/simplemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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'],
);
Expand Down Expand Up @@ -792,13 +792,11 @@ function load_simplemap( lat, lng, aspid, ascid, asma, shortcode_zoom_level, map
zoom_level = shortcode_zoom_level;
autoload = shortcode_autoload;
<?php
/*
if ( '' == $options['api_key'] ) {
?>
jQuery( "#simplemap" ).html( "<p style='padding:10px;'><?php printf( __( 'You must enter an API Key in <a href=\"%s\">General Settings</a> before your maps will work.', 'SimpleMap' ), admin_url( 'admin.php?page=simplemap' ) ); ?></p>" );
<?php
}
*/

do_action( 'sm-load-simplemap-js-top' );
?>
Expand Down Expand Up @@ -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' ),
Expand Down Expand Up @@ -2317,10 +2315,8 @@ function show_toolbar( $title = '' ) {
</table>

<?php
/*
if ( !isset( $options['api_key'] ) || $options['api_key'] == '' )
echo '<div class="error"><p>' . __( 'You must enter an API key for your domain.', 'SimpleMap' ).' <a href="' . admin_url( 'admin.php?page=simplemap' ) . '">' . __( 'Enter a key on the General Options page.', 'SimpleMap' ) . '</a></p></div>';
*/
}

/**
Expand All @@ -2343,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 ) {
Expand Down
9 changes: 7 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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&currency_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.

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions simplemap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: SimpleMap
Version: 2.4.9
Version: 2.4.10
Plugin URI: http://simplemap-plugin.com/
Author: Michael Torbert
Author URI: http://fullthrottledevelopment.com/
Expand All @@ -18,7 +18,7 @@
#### CONSTANTS ####

// Plugin Version Number
define( 'SIMPLEMAP_VERSION', '2.4.9' );
define( 'SIMPLEMAP_VERSION', '2.4.10' );

if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
define( 'WP_PLUGIN_DIR', ABSPATH . 'wp-content/plugins' );
Expand Down

0 comments on commit 0d133a4

Please sign in to comment.