WP Google Map - Version 1.0.3

Version Description

  • Self api key adding option added
Download this release

Release Info

Developer milonfci
Plugin Icon 128x128 WP Google Map
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.2 to 1.0.3

includes/gmap.php CHANGED
@@ -1,6 +1,19 @@
1
  <?php
2
  if (!defined('ABSPATH')) exit;
3
  if (isset($_GET['page'])) {
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  $wpgmap_page = esc_html($_GET['page']);
5
  $wpgmap_tag = '';
6
  if (isset($_GET['tag'])) {
@@ -19,24 +32,33 @@ if (isset($_GET['page'])) {
19
  class="media-menu-item">All Maps</a>
20
  </li>
21
  <li class="<?php echo $wpgmap_tag == 'new' ? 'active' : ''; ?>">
22
- <a href="<?php echo esc_url(admin_url().'admin.php?page=wpgmapembed&tag=new'); ?>" data-id="wp-gmap-new"
 
23
  class="media-menu-item">Create New Map</a>
24
  </li>
25
- <li class="<?php echo $wpgmap_tag == 'new' ? 'active' : ''; ?>">
26
- <a target="_blank" href="https://youtu.be/XofXPEJfi8s" data-id="wp-gmap-new"
27
- class="media-menu-item">Need Help ?</a>
 
 
 
28
  </li>
29
  <span class="spinner" style="margin-right: 20px !important;float:right"></span>
30
  </ul>
31
 
32
  <div id="wp-gmap-tabs">
 
 
 
 
 
33
  <!---------------------------new map tab-------------->
34
  <?php
35
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == '') {
36
  ?>
37
  <div class="wp-gmap-tab-content active" id="wp-gmap-all">
38
  <?php
39
- require_once (plugin_dir_path(__FILE__) . '/wpgmap_list.php');
40
  ?>
41
  </div>
42
  <?php
@@ -49,7 +71,7 @@ if (isset($_GET['page'])) {
49
  id="wp-gmap-new">
50
  <?php
51
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'new') {
52
- require_once (plugin_dir_path(__FILE__) . '/wpgmap_create.php');
53
  }
54
  ?>
55
  </div>
@@ -61,7 +83,19 @@ if (isset($_GET['page'])) {
61
  id="wp-gmap-edit">
62
  <?php
63
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'edit') {
64
- require_once (plugin_dir_path(__FILE__) . '/wpgmap_edit.php');
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
  ?>
67
  </div>
1
  <?php
2
  if (!defined('ABSPATH')) exit;
3
  if (isset($_GET['page'])) {
4
+
5
+ if(isset($_POST['wpgmapembed_key'])){
6
+ $api_key = $_POST['wpgmapembed_key'];
7
+ if($api_key!=''){
8
+ if(get_option( 'wpgmap_api_key' ) !== false){
9
+ update_option( 'wpgmap_api_key', $api_key, '', 'yes' );
10
+ }else{
11
+ add_option( 'wpgmap_api_key', $api_key, '', 'yes' );
12
+ }
13
+
14
+ }
15
+ }
16
+
17
  $wpgmap_page = esc_html($_GET['page']);
18
  $wpgmap_tag = '';
19
  if (isset($_GET['tag'])) {
32
  class="media-menu-item">All Maps</a>
33
  </li>
34
  <li class="<?php echo $wpgmap_tag == 'new' ? 'active' : ''; ?>">
35
+ <a href="<?php echo esc_url(admin_url() . 'admin.php?page=wpgmapembed&tag=new'); ?>"
36
+ data-id="wp-gmap-new"
37
  class="media-menu-item">Create New Map</a>
38
  </li>
39
+ <li class="<?php echo $wpgmap_tag == 'settings' ? 'active' : ''; ?>">
40
+ <a href="<?php echo esc_url(admin_url() . 'admin.php?page=wpgmapembed&tag=settings'); ?>" data-id="wp-gmap-settings"
41
+ class="media-menu-item">Settings</a>
42
+ </li>
43
+ <li>
44
+ <a target="_blank" href="https://youtu.be/XofXPEJfi8s" class="media-menu-item">Need Help ?</a>
45
  </li>
46
  <span class="spinner" style="margin-right: 20px !important;float:right"></span>
47
  </ul>
48
 
49
  <div id="wp-gmap-tabs">
50
+ <?php
51
+ if(get_option( 'wpgmap_api_key' ) == false){
52
+ require_once(plugin_dir_path(__FILE__) . '/wpgmap_settings.php');
53
+ }
54
+ ?>
55
  <!---------------------------new map tab-------------->
56
  <?php
57
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == '') {
58
  ?>
59
  <div class="wp-gmap-tab-content active" id="wp-gmap-all">
60
  <?php
61
+ require_once(plugin_dir_path(__FILE__) . '/wpgmap_list.php');
62
  ?>
63
  </div>
64
  <?php
71
  id="wp-gmap-new">
72
  <?php
73
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'new') {
74
+ require_once(plugin_dir_path(__FILE__) . '/wpgmap_create.php');
75
  }
76
  ?>
77
  </div>
83
  id="wp-gmap-edit">
84
  <?php
85
  if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'edit') {
86
+ require_once(plugin_dir_path(__FILE__) . '/wpgmap_edit.php');
87
+ }
88
+ ?>
89
+ </div>
90
+
91
+ <!---------------------------Plugin Settings-------------->
92
+
93
+ <div
94
+ class="wp-gmap-tab-content <?php echo ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'settings') ? 'active' : ''; ?>"
95
+ id="wp-gmap-settings">
96
+ <?php
97
+ if ($wpgmap_page == 'wpgmapembed' && $wpgmap_tag == 'settings') {
98
+ require_once(plugin_dir_path(__FILE__) . '/wpgmap_settings.php');
99
  }
100
  ?>
101
  </div>
includes/wpgmap_settings.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+ <div data-columns="8">
5
+ <!-- to save api key-->
6
+ <div class="wpgmapembed_get_api_key">
7
+ <div class="error">
8
+ <p style="font-size:17px;"><strong>Notice: The plugin requires following API key.</strong></p>
9
+ <form method="post" action="<?php echo admin_url(); ?>admin.php?page=wpgmapembed">
10
+ <p>Enter API Key <input type="text" name="wpgmapembed_key"
11
+ value="<?php echo esc_html(get_option('wpgmap_api_key')); ?>" size="45">
12
+ <button class="wd-btn wd-btn-primary button media-button button-primary">Save</button>
13
+
14
+ <a target="_blank"
15
+ href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend&amp;keyType=CLIENT_SIDE&amp;reusekey=true"
16
+ class="button media-button button-default button-large">GET FREE API KEY</a>
17
+ </p>
18
+ </form>
19
+
20
+ </div>
21
+ </div>
22
+
23
+ </div>
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: http://www.srmilon.com/
4
  Tags: Google Map Embed, Google Map, gmap, google map embed, wp map, wp map embed, map embed, best google maps, best maps, bing maps, cross browser, custom google map, custom google maps, map direction, easy map, geo, geocoder, gmaps, google earth, google map plugin, google map shortcode, google map widget, google maps v3, googlemaps, gprs, gps, gpx, kml, latitude, Longitude, location, loaction by address, map, map directions, map markers, map plugin, map shortcode, map styles, maps google, post map, map point, polygons, roads, routes, store locator, street view, wp google map, contact page map, google map wordpress, google maps wordpress, google maps for wordpress, simple google map, simple google map plugin, wp google maps,maps
5
  Requires at least: 2.9
6
  Tested up to: 4.6.1
7
- Version: 1.0.2
8
- Stable tag: 1.0.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -89,3 +89,11 @@ Go to =Appearence=->=Widget= then you will see a widget named "Google Map SRM".
89
  = 1.0.1 =
90
 
91
  * Updated screenshots with FAQ to make easier.
 
 
 
 
 
 
 
 
4
  Tags: Google Map Embed, Google Map, gmap, google map embed, wp map, wp map embed, map embed, best google maps, best maps, bing maps, cross browser, custom google map, custom google maps, map direction, easy map, geo, geocoder, gmaps, google earth, google map plugin, google map shortcode, google map widget, google maps v3, googlemaps, gprs, gps, gpx, kml, latitude, Longitude, location, loaction by address, map, map directions, map markers, map plugin, map shortcode, map styles, maps google, post map, map point, polygons, roads, routes, store locator, street view, wp google map, contact page map, google map wordpress, google maps wordpress, google maps for wordpress, simple google map, simple google map plugin, wp google maps,maps
5
  Requires at least: 2.9
6
  Tested up to: 4.6.1
7
+ Version: 1.0.3
8
+ Stable tag: 1.0.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
89
  = 1.0.1 =
90
 
91
  * Updated screenshots with FAQ to make easier.
92
+
93
+ = 1.0.2 =
94
+
95
+ * Bug fixes with adding helpful video embedding
96
+
97
+ = 1.0.3 =
98
+
99
+ * Self api key adding option added
srm_gmap_embed.php CHANGED
@@ -5,23 +5,27 @@
5
  Description: The plugin will help to google map Embed in post and pages also in sidebar with widget.
6
  Author: SRMILON
7
  Author URI: http://www.srmilon.com
8
- Version: 1.0.2
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
12
 
13
- if (!class_exists('srm_gmap_embed_main')):
14
 
15
  class srm_gmap_embed_main
16
  {
17
 
18
  private $plugin_name = 'Google Map SRM';
 
 
19
 
20
  /**
21
  * constructor function
22
  */
23
  function __construct()
24
  {
 
 
25
  add_action('wp_enqueue_scripts', array($this, 'gmap_enqueue_scripts'));
26
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_gmap_scripts'));
27
  add_action('admin_menu', array($this, 'gmap_create_menu'));
@@ -33,20 +37,25 @@ if (!class_exists('srm_gmap_embed_main')):
33
  add_action('wp_ajax_wpgmapembed_remove_wpgmap', array($this, 'remove_wpgmapembed_data'));
34
  }
35
 
 
 
 
 
 
36
  /**
37
  * To enqueue scripts for front-end
38
  */
39
  public function gmap_enqueue_scripts()
40
  {
41
  //including map library
42
- wp_enqueue_script('srm_gmap_api', 'http://maps.googleapis.com/maps/api/js?key=AIzaSyBcVcz5OZ6eNBi5d7CFYHIdtsEI5BQlm68&libraries=places', array('jquery'));
43
  }
44
 
45
  function enqueue_admin_gmap_scripts()
46
  {
47
  global $pagenow;
48
  if ($pagenow == 'post.php' || $pagenow == 'post-new.php' || @$_GET['page'] == 'wpgmapembed') {
49
- wp_enqueue_script('wp-gmap-api', 'https://maps.google.com/maps/api/js?key=AIzaSyBcVcz5OZ6eNBi5d7CFYHIdtsEI5BQlm68&libraries=places', array('jquery'), '20161019', true);
50
  wp_enqueue_script('wp-gmap-custom-js', plugins_url('assets/js/custom.js', __FILE__), array('wp-gmap-api'), '20161019', false);
51
  wp_enqueue_style('wp-gmap-embed-css', plugins_url('assets/css/wp-gmap-style.css', __FILE__));
52
  }
@@ -290,7 +299,7 @@ if (!class_exists('srm_gmap_embed_main')):
290
 
291
  }
292
 
293
- endif;
294
  new srm_gmap_embed_main();
295
  // including requird files
296
  require_once plugin_dir_path(__FILE__) . '/includes/widget.php';
5
  Description: The plugin will help to google map Embed in post and pages also in sidebar with widget.
6
  Author: SRMILON
7
  Author URI: http://www.srmilon.com
8
+ Version: 1.0.3
9
  */
10
 
11
  if ( ! defined( 'ABSPATH' ) ) exit;
12
 
13
+ if (!class_exists('srm_gmap_embed_main')){
14
 
15
  class srm_gmap_embed_main
16
  {
17
 
18
  private $plugin_name = 'Google Map SRM';
19
+ public $wpgmap_api_key = 'AIzaSyBcVcz5OZ6eNBi5d7CFYHIdtsEI5BQlm68';
20
+
21
 
22
  /**
23
  * constructor function
24
  */
25
  function __construct()
26
  {
27
+ $this->wpgmap_api_key = get_option('wpgmap_api_key');
28
+ // echo get_option('wpgmap_api_key');exit;
29
  add_action('wp_enqueue_scripts', array($this, 'gmap_enqueue_scripts'));
30
  add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_gmap_scripts'));
31
  add_action('admin_menu', array($this, 'gmap_create_menu'));
37
  add_action('wp_ajax_wpgmapembed_remove_wpgmap', array($this, 'remove_wpgmapembed_data'));
38
  }
39
 
40
+ /**
41
+ * To set options values
42
+ */
43
+
44
+
45
  /**
46
  * To enqueue scripts for front-end
47
  */
48
  public function gmap_enqueue_scripts()
49
  {
50
  //including map library
51
+ wp_enqueue_script('srm_gmap_api', 'http://maps.googleapis.com/maps/api/js?key='.$this->wpgmap_api_key.'&libraries=places', array('jquery'));
52
  }
53
 
54
  function enqueue_admin_gmap_scripts()
55
  {
56
  global $pagenow;
57
  if ($pagenow == 'post.php' || $pagenow == 'post-new.php' || @$_GET['page'] == 'wpgmapembed') {
58
+ wp_enqueue_script('wp-gmap-api', 'https://maps.google.com/maps/api/js?key='.$this->wpgmap_api_key.'&libraries=places', array('jquery'), '20161019', true);
59
  wp_enqueue_script('wp-gmap-custom-js', plugins_url('assets/js/custom.js', __FILE__), array('wp-gmap-api'), '20161019', false);
60
  wp_enqueue_style('wp-gmap-embed-css', plugins_url('assets/css/wp-gmap-style.css', __FILE__));
61
  }
299
 
300
  }
301
 
302
+ }
303
  new srm_gmap_embed_main();
304
  // including requird files
305
  require_once plugin_dir_path(__FILE__) . '/includes/widget.php';