diff --git a/readme.txt b/readme.txt index 7f7e9aa..759eb91 100644 --- a/readme.txt +++ b/readme.txt @@ -53,6 +53,19 @@ Each time you display a map, the address specified is used to generate a unique The maps are cached for 3 months. Caches are automatically cleared (for individual maps) when you change the address in the short code. +6. Can I change the zoom level? + +Yes, simple add `zoom="12"` to the short code. + +`[pw_map address="New York City" zoom="12"]` + +7. Can I change the map type ? + +Yes, simple add `zoom="12"` to the short code. + +`[pw_map address="New York City" type="SATELLITE"]` + + == Installation == 1. Activate the plugin @@ -88,4 +101,4 @@ The maps are cached for 3 months. Caches are automatically cleared (for individu = 1.0 = -* First release! \ No newline at end of file +* First release! diff --git a/simple-google-map-short-code.php b/simple-google-map-short-code.php index 8fd0210..572de9c 100644 --- a/simple-google-map-short-code.php +++ b/simple-google-map-short-code.php @@ -3,12 +3,29 @@ Plugin Name: Simple Google Maps Short Code Plugin URL: http://pippinsplugins.com/simple-google-maps-short-code Description: Adds a simple Google Maps short code -Version: 1.1.2 +Version: 1.3.1 Author: Pippin Williamson Author URI: http://pippinsplugins.com Contributors: mordauk */ +/** + * Loads the plugin textdomain + * + * @access private + * @since 1.2 + * @return void +*/ +function pw_map_textdomain() { + + // Set filter for plugin's languages directory + $lang_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages/'; + $lang_dir = apply_filters( 'pw_map_languages_directory', $lang_dir ); + + // Load the translations + load_plugin_textdomain( 'simple-google-maps-short-code', false, $lang_dir ); +} +add_action( 'init', 'pw_map_textdomain' ); /** * Displays the map @@ -17,7 +34,6 @@ * @since 1.0 * @return void */ - function pw_map_shortcode( $atts ) { $atts = shortcode_atts( @@ -27,14 +43,18 @@ function pw_map_shortcode( $atts ) { 'height' => '400px', 'enablescrollwheel' => 'true', 'zoom' => 15, - 'disablecontrols' => 'false' + 'disablecontrols' => 'false', + 'type' => 'ROADMAP', // or SATELLITE + 'key' => '' ), $atts ); $address = $atts['address']; - if( $address ) if( $address && wp_script_is( 'google-maps-api', 'registered' ) ) : + wp_enqueue_script( 'google-maps-api', '//maps.google.com/maps/api/js?sensor=false&callback=initMap&key=' . sanitize_text_field( $atts['key'] ) ); + + if( $address ) : wp_print_scripts( 'google-maps-api' ); @@ -47,7 +67,7 @@ function pw_map_shortcode( $atts ) { ob_start(); ?>
-