Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Nov 21, 2024
2 parents 7de9bba + 2363095 commit 18a0146
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# [Pronamic Google Maps](http://www.happywp.com/plugins/pronamic-google-maps/)

> [!IMPORTANT]
> The "Pronamic Google Maps" plugin is no longer being maintained and developed. An alternative is the Google Map field in the Advanced Custom Fields plugin.
This plugin makes it easy to add Google Maps to your WordPress post, pages or other custom post types.

## Shortcode `googlemaps` `googlemapsmashup`
Expand Down
7 changes: 5 additions & 2 deletions classes/Pronamic/Google/Maps/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@ public function __construct() {

}

public function geocode_address( $address, $sensor = false ) {
public function geocode_address( $address, $deprecated = false ) {
$result = null;

$key = get_option( 'pronamic_google_maps_key' );
$key = empty( $key ) ? false : $key;

// URL
$url = sprintf(
self::API_END_POINT . '%s/%s?%s',
'geocode',
self::OUTPUT_JSON,
_http_build_query( array(
'address' => $address,
'sensor' => $sensor ? 'true' : 'false',
'key' => $key,
) )
);

Expand Down
10 changes: 7 additions & 3 deletions classes/Pronamic/Google/Maps/Maps.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ public static function register_scripts() {
'google-maps',
add_query_arg(
array(
'sensor' => 'false',
'key' => $key,
'key' => $key,
),
'https://maps.googleapis.com/maps/api/js'
),
Expand Down Expand Up @@ -312,6 +311,8 @@ public static function get_meta_data( $post_id = null ) {
public static function get_static_map_url( Pronamic_Google_Maps_Info $info ) {
$url = 'https://maps.google.com/maps/api/staticmap?';

$key = get_option( 'pronamic_google_maps_key' );

$width = Pronamic_Google_Maps_Size::parse( $info->width );
$height = Pronamic_Google_Maps_Size::parse( $info->height );

Expand All @@ -320,7 +321,6 @@ public static function get_static_map_url( Pronamic_Google_Maps_Info $info ) {
$parameters['zoom'] = $info->mapOptions->zoom;
$parameters['size'] = $width->get_pixels( self::$defaultWidth ) . 'x' . $height->get_pixels( self::$defaultHeight );
$parameters['maptype'] = $info->mapOptions->mapTypeId;
$parameters['sensor'] = 'false';

$markers = '';
if ( null !== $info->color ) {
Expand All @@ -339,6 +339,10 @@ public static function get_static_map_url( Pronamic_Google_Maps_Info $info ) {

$parameters['markers'] = $markers;

if ( ! empty( $key ) ) {
$parameters['key'] = $key;
}

$url .= http_build_query( $parameters, '', '&' );

return $url;
Expand Down
1 change: 0 additions & 1 deletion classes/Pronamic/Google/Maps/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public static function bootstrap() {

// Settings
$other_params_array = array(
'sensor' => 'false',
);

$other_params_array = apply_filters( 'pronamic_google_maps_load_other_params_array', $other_params_array );
Expand Down

0 comments on commit 18a0146

Please sign in to comment.