Google Map Shortcode - Version 2.1.1

Version Description

  • Google Map Shortcode tab added to the media editor window.
    • Upload Image button added.
    • Cleaning string before saving points fixed.
    • Other bugs fixed.
Download this release

Release Info

Developer alaingg
Plugin Icon wp plugin Google Map Shortcode
Version 2.1.1
Comparing to
See all releases

Code changes from version 2.1 to 2.1.1

google-map-shortcode.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Google Map Shortcode
4
  Plugin URI: http://web-argument.com/google-map-shortcode-2-0-total-solution/
5
  Description: Include Google Map in your blogs with just one click.
6
- Version: 2.1
7
  Author: Alain Gonzalez
8
  Author URI: http://web-argument.com/
9
  */
@@ -30,7 +30,7 @@ function get_gmshc_options ($default = false){
30
  'windowhtml' => gmshc_defaul_windowhtml(),
31
  'icons' => array(),
32
  'default_icon' => GMSC_PLUGIN_URL.'/images/icons/marker.png',
33
- 'version' => '2.1'
34
  );
35
 
36
 
@@ -105,12 +105,12 @@ function gmshc_tab_process(){
105
  $post_id = $_REQUEST["post_id"];
106
  $custom_fieds = get_post_custom($post_id);
107
 
108
- $address = isset($_REQUEST['new_address'])?$_REQUEST['new_address'] : "";
109
  $ltlg = isset($_REQUEST['new_ltlg'])?$_REQUEST['new_ltlg'] : "";
110
- $title = isset($_REQUEST['new_title'])?$_REQUEST['new_title'] : get_the_title($post_id);
111
- $description = isset($_REQUEST['new_description'])?$_REQUEST['new_description'] : "";
112
- $icon = isset($_REQUEST['default_icon'])?$_REQUEST['default_icon'] : "";
113
- $selected_thumbnail = isset($_REQUEST['selected_thumbnail'])?$_REQUEST['selected_thumbnail'] : "";
114
 
115
  $add_point = isset($_REQUEST['add_point']) ? $_REQUEST['add_point'] : '';
116
  $del_point = isset($_REQUEST['delp']) ? $_REQUEST['delp'] : '';
@@ -119,12 +119,12 @@ function gmshc_tab_process(){
119
  $height = isset($_REQUEST['height']) ? $_REQUEST['height'] : $options['height'];
120
  $zoom = isset($_REQUEST['zoom']) ? $_REQUEST['zoom'] : $options['zoom'];
121
 
122
- $address_list = isset($_REQUEST['addr']) ? $_REQUEST['addr'] : "";
123
- $title_list = isset($_REQUEST['title']) ? $_REQUEST['title'] : "";
124
- $desc_list = isset($_REQUEST['desc']) ? $_REQUEST['desc'] : "";
125
  $ltlg_list = isset($_REQUEST['ltlg']) ? $_REQUEST['ltlg'] : "";
126
- $icon_list = isset($_REQUEST['icon']) ? $_REQUEST['icon'] : "";
127
- $thumb_list = isset($_REQUEST['thumb']) ? $_REQUEST['thumb'] : "";
128
 
129
  $post_points = new GMSHC_Post_Map();
130
  $post_points -> create_post_map($post_id);
@@ -140,7 +140,7 @@ function gmshc_tab_process(){
140
 
141
  else if (!empty($update_point)) {
142
 
143
- if ( $post_points -> update_points($address_list,$ltlg_list,$title_list,$desc_list,$icon_list,$thumb_list,$post_id))
144
  echo "<div class='updated'><p>".__("The Point was updated.")."</p></div>";
145
  else echo "<div class='error'><p>".__("The Points can't be updated.")."</p></div>";
146
  }
@@ -232,12 +232,13 @@ function gmshc_tab_process(){
232
  <div class="gmshc_label">
233
  <strong><?php _e("Thumbnail: "); ?></strong><?php _e("If you want to attach an image to the point you need to upload it first to the post gallery"); ?>
234
  </div>
235
- <?php } ?>
 
236
  </td>
237
  </tr>
238
  </table>
239
-
240
- <p><input class="button" value="<?php _e("Add Point") ?>" name="add_point" type="submit"></p>
241
 
242
  <?php
243
  if ( count($post_points -> points) > 0 ){
@@ -293,6 +294,7 @@ function gmshc_tab_process(){
293
  </table>
294
 
295
  <p><input class="button-primary" value="<?php _e("Insert Map"); ?>" type="button" id="insert_map"></p>
 
296
 
297
  <?php } ?>
298
  </form>
@@ -322,7 +324,7 @@ function gmshc_tab_process(){
322
  if ( $output != '' )
323
  return $output;
324
 
325
- $defaul_gmshc_windowhtml = "<div style='margin:0; padding:0px; height:110px; width:%width%; overflow:hidden; font-size:11px; clear:both; line-height:13px;'>\n";
326
  $defaul_gmshc_windowhtml .= "<div style='float:left; width:200px'>\n";
327
  $defaul_gmshc_windowhtml .= "<a class='title' href='%link%' style='clear:both; display:block; font-size:12px; line-height: 18px; font-weight:bold;'>%title%</a>\n";
328
  $defaul_gmshc_windowhtml .= "<div><strong style='font-size:9px'>%address%</strong></div>\n";
@@ -475,7 +477,7 @@ function gmshc_options_page() {
475
  $newoptions['height'] = isset($_POST['height'])?$_POST['height']:$options['height'];
476
  $newoptions['zoom'] = isset($_POST['zoom'])?$_POST['zoom']:$options['zoom'];
477
  $newoptions['language'] = isset($_POST['language'])?$_POST['language']:$options['language'];
478
- $newoptions['windowhtml'] = isset($_POST['windowhtml'])?$_POST['windowhtml']:$options['windowhtml'];
479
 
480
  $newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
481
  $newoptions['icons'] = $options['icons'];
@@ -611,7 +613,9 @@ function gmshc_options_page() {
611
  <textarea name="windowhtml" cols="50" rows="12" id="windowhtml">
612
  <?php
613
  if (empty($windowhtml)) echo gmshc_defaul_windowhtml();
614
- else echo str_replace("\\", "",$windowhtml);
 
 
615
  ?>
616
  </textarea>
617
  <div id="gmshc_previews">
@@ -672,7 +676,7 @@ function gmshc_options_page() {
672
 
673
  <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Feedback") ?></h3>
674
 
675
- <p><?php _e('For more details and examples visite the <a http://web-argument.com/2011/07/18/google-map-shortcode-plugin-version-2-1">Plugin Page</a>. All the comments are welcome.') ?></p>
676
 
677
 
678
  <p class="submit">
@@ -682,4 +686,17 @@ function gmshc_options_page() {
682
  </div>
683
 
684
 
685
- <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: Google Map Shortcode
4
  Plugin URI: http://web-argument.com/google-map-shortcode-2-0-total-solution/
5
  Description: Include Google Map in your blogs with just one click.
6
+ Version: 2.1.1
7
  Author: Alain Gonzalez
8
  Author URI: http://web-argument.com/
9
  */
30
  'windowhtml' => gmshc_defaul_windowhtml(),
31
  'icons' => array(),
32
  'default_icon' => GMSC_PLUGIN_URL.'/images/icons/marker.png',
33
+ 'version' => '2.1.1'
34
  );
35
 
36
 
105
  $post_id = $_REQUEST["post_id"];
106
  $custom_fieds = get_post_custom($post_id);
107
 
108
+ $address = isset($_REQUEST['new_address'])? stripslashes($_REQUEST['new_address']) : "";
109
  $ltlg = isset($_REQUEST['new_ltlg'])?$_REQUEST['new_ltlg'] : "";
110
+ $title = isset($_REQUEST['new_title'])? stripslashes($_REQUEST['new_title']) : get_the_title($post_id);
111
+ $description = isset($_REQUEST['new_description'])? stripslashes($_REQUEST['new_description']) : "";
112
+ $icon = isset($_REQUEST['default_icon'])?stripslashes($_REQUEST['default_icon']) : "";
113
+ $selected_thumbnail = isset($_REQUEST['selected_thumbnail'])? stripslashes($_REQUEST['selected_thumbnail']) : "";
114
 
115
  $add_point = isset($_REQUEST['add_point']) ? $_REQUEST['add_point'] : '';
116
  $del_point = isset($_REQUEST['delp']) ? $_REQUEST['delp'] : '';
119
  $height = isset($_REQUEST['height']) ? $_REQUEST['height'] : $options['height'];
120
  $zoom = isset($_REQUEST['zoom']) ? $_REQUEST['zoom'] : $options['zoom'];
121
 
122
+ $address_list = isset($_REQUEST['addr']) ? gmshc_stripslashes_deep($_REQUEST['addr']) : "";
123
+ $title_list = isset($_REQUEST['title']) ? gmshc_stripslashes_deep($_REQUEST['title']) : "";
124
+ $desc_list = isset($_REQUEST['desc']) ? gmshc_stripslashes_deep($_REQUEST['desc']) : "";
125
  $ltlg_list = isset($_REQUEST['ltlg']) ? $_REQUEST['ltlg'] : "";
126
+ $icon_list = isset($_REQUEST['icon']) ? gmshc_stripslashes_deep($_REQUEST['icon']) : "";
127
+ $thumb_list = isset($_REQUEST['thumb'])? gmshc_stripslashes_deep($_REQUEST['thumb']) : "";
128
 
129
  $post_points = new GMSHC_Post_Map();
130
  $post_points -> create_post_map($post_id);
140
 
141
  else if (!empty($update_point)) {
142
 
143
+ if ( $post_points -> update_points($address_list,$ltlg_list,$title_list,$desc_list,$icon_list,$thumb_list))
144
  echo "<div class='updated'><p>".__("The Point was updated.")."</p></div>";
145
  else echo "<div class='error'><p>".__("The Points can't be updated.")."</p></div>";
146
  }
232
  <div class="gmshc_label">
233
  <strong><?php _e("Thumbnail: "); ?></strong><?php _e("If you want to attach an image to the point you need to upload it first to the post gallery"); ?>
234
  </div>
235
+ <?php } ?>
236
+ <p align="left"><a class="button" href = "?post_id=<?php echo $post_id ?>&type=image" title="Upload Images"><?php _e("Upload Images") ?></a></p>
237
  </td>
238
  </tr>
239
  </table>
240
+
241
+ <p><input class="button-primary" value="<?php _e("Add Point") ?>" name="add_point" type="submit"></p>
242
 
243
  <?php
244
  if ( count($post_points -> points) > 0 ){
294
  </table>
295
 
296
  <p><input class="button-primary" value="<?php _e("Insert Map"); ?>" type="button" id="insert_map"></p>
297
+ <br />
298
 
299
  <?php } ?>
300
  </form>
324
  if ( $output != '' )
325
  return $output;
326
 
327
+ $defaul_gmshc_windowhtml = "<div style='margin:0; padding:0px; height:125px; width:%width%; overflow:hidden; font-size:11px; clear:both; line-height:13px;'>\n";
328
  $defaul_gmshc_windowhtml .= "<div style='float:left; width:200px'>\n";
329
  $defaul_gmshc_windowhtml .= "<a class='title' href='%link%' style='clear:both; display:block; font-size:12px; line-height: 18px; font-weight:bold;'>%title%</a>\n";
330
  $defaul_gmshc_windowhtml .= "<div><strong style='font-size:9px'>%address%</strong></div>\n";
477
  $newoptions['height'] = isset($_POST['height'])?$_POST['height']:$options['height'];
478
  $newoptions['zoom'] = isset($_POST['zoom'])?$_POST['zoom']:$options['zoom'];
479
  $newoptions['language'] = isset($_POST['language'])?$_POST['language']:$options['language'];
480
+ $newoptions['windowhtml'] = isset($_POST['windowhtml'])? $_POST['windowhtml']:$options['windowhtml'];
481
 
482
  $newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
483
  $newoptions['icons'] = $options['icons'];
613
  <textarea name="windowhtml" cols="50" rows="12" id="windowhtml">
614
  <?php
615
  if (empty($windowhtml)) echo gmshc_defaul_windowhtml();
616
+ else {
617
+ echo str_replace("\\", "",$windowhtml);
618
+ }
619
  ?>
620
  </textarea>
621
  <div id="gmshc_previews">
676
 
677
  <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Feedback") ?></h3>
678
 
679
+ <p><?php _e('For more details and examples visite the <a href="http://web-argument.com/2011/07/18/google-map-shortcode-plugin-version-2-1">Plugin Page</a>. All the comments are welcome.') ?></p>
680
 
681
 
682
  <p class="submit">
686
  </div>
687
 
688
 
689
+ <?php }
690
+
691
+ /**
692
+ * Adding media tab
693
+ */
694
+ function gmshc_media_menu($tabs) {
695
+ $newtab = array('gmshc' => __('Google Map Shortcode', 'gmshc'));
696
+ return array_merge($tabs, $newtab);
697
+ }
698
+
699
+ add_filter('media_upload_tabs', 'gmshc_media_menu');
700
+
701
+
702
+ ?>
include/class.gmshc_post_points.php CHANGED
@@ -42,7 +42,7 @@ class GMSHC_Post_Map
42
  $point = array();
43
  foreach ($address_list as $id => $address){
44
  $new_point = new GMSHC_Point();
45
- if($new_point->create_point($address[$id],$ltlg_list[$id],$title_list[$id],$desc_list[$id],$icon_list[$id],$thumb_list[$id],$this->post_id,false)) {
46
  array_push($new_points_array,$new_point);
47
  }
48
  else return false;
42
  $point = array();
43
  foreach ($address_list as $id => $address){
44
  $new_point = new GMSHC_Point();
45
+ if($new_point->create_point($address,$ltlg_list[$id],$title_list[$id],$desc_list[$id],$icon_list[$id],$thumb_list[$id],$this->post_id,false)) {
46
  array_push($new_points_array,$new_point);
47
  }
48
  else return false;
include/functions.php CHANGED
@@ -89,6 +89,15 @@ function gmshc_get_windowhtml(&$point) {
89
 
90
  }
91
 
 
 
 
 
 
 
 
 
 
92
  /**
93
  * Get all the thumbnails from post
94
  */
@@ -216,10 +225,9 @@ function gmshc_deploy_icons(){
216
  function gmshc_get_points($post_id) {
217
 
218
  $post_data = get_post_meta($post_id,'google-map-sc',true);
219
-
220
  $post_points = array();
221
  if($post_data != ""){
222
- $points = json_decode($post_data, true);
223
  if(is_array($points)){
224
  foreach($points as $point){
225
  $point_obj = new GMSHC_Point();
@@ -258,14 +266,16 @@ function gmshc_get_points($post_id) {
258
  * Save the json data into the post custom field 'google-map-sc'
259
  */
260
  function gmshc_save_points($post_id,$points) {
261
-
262
  $post_data = get_post_meta($post_id,'google-map-sc',true);
263
 
264
  $new_post_data = json_encode($points);
265
 
266
- if ($post_data == "null") return add_post_meta($post_id, 'google-map-sc', $new_post_data, true);
 
 
 
267
  else return update_post_meta($post_id,'google-map-sc',$new_post_data, $post_data);
268
-
269
  }
270
 
271
 
89
 
90
  }
91
 
92
+ function gmshc_stripslashes_deep($value)
93
+ {
94
+ $value = is_array($value) ?
95
+ array_map('stripslashes_deep', $value) :
96
+ stripslashes($value);
97
+
98
+ return $value;
99
+ }
100
+
101
  /**
102
  * Get all the thumbnails from post
103
  */
225
  function gmshc_get_points($post_id) {
226
 
227
  $post_data = get_post_meta($post_id,'google-map-sc',true);
 
228
  $post_points = array();
229
  if($post_data != ""){
230
+ $points = json_decode(urldecode($post_data), true);
231
  if(is_array($points)){
232
  foreach($points as $point){
233
  $point_obj = new GMSHC_Point();
266
  * Save the json data into the post custom field 'google-map-sc'
267
  */
268
  function gmshc_save_points($post_id,$points) {
 
269
  $post_data = get_post_meta($post_id,'google-map-sc',true);
270
 
271
  $new_post_data = json_encode($points);
272
 
273
+ if ($post_data == "null") {
274
+ delete_post_meta($post_id, 'google-map-sc');
275
+ return add_post_meta($post_id, 'google-map-sc', $new_post_data, true);
276
+ }
277
  else return update_post_meta($post_id,'google-map-sc',$new_post_data, $post_data);
278
+
279
  }
280
 
281
 
js/gmshc-admin.js CHANGED
@@ -26,10 +26,6 @@
26
 
27
  });
28
 
29
- $("#new_title").click(function(){
30
- $(this).val("");
31
- });
32
-
33
  gmshc_update_editor_custom_field();
34
 
35
  });
26
 
27
  });
28
 
 
 
 
 
29
  gmshc_update_editor_custom_field();
30
 
31
  });
readme.txt CHANGED
@@ -4,31 +4,30 @@ Donate link: http://web-argument.com/2011/07/18/google-map-shortcode-plugin-vers
4
  Tags: google map, shortcode, map, categories, widget, post map, point, marker, list, location, address, images
5
  Requires at least: 2.5
6
  Tested up to: 3.2.1
7
- Stable tag: 2.1
8
 
9
- Friendly integration of Google Map instances into your blogs. Allows displaying multiple maps on your pages. Insert points into maps easily.
10
 
11
  == Description ==
12
 
13
- This plugin allows you to include instances of Google Map in your blogs using shortcodes. You can insert maps everywhere: in your theme files, posts and pages. An editor button allows inserting points and maps into your posts/pages with a single click. The points can include custom title, description, marker and thumbnail.
14
 
15
  Special Features:
16
 
17
- * Editor button added, to include the points to the map easily.
18
  * Custom markers allowed.
19
  * Based on Google Maps Javascript API Version 3.
20
  * Faster and more applicable to mobile devices.
21
  * Open Google Map in new window - included to the html windows.
22
  * Post ID include as shortcode parameter.
23
- * Map in multiple languages allows.
24
- * API key not required.
25
  * Multiples points in a single map.
26
  * Multiples maps in a single page.
27
- * Show post under categories.
28
- * Inserting maps everywhere.
29
- * When you click on a point the window box opened can shows part of the content of your posts (post title, thumbnails and excerpt) or a custom title description and thumbnail.
30
- * You can customize the html of the info window box on your maps.
31
- * The shortcode allows different options to customize your maps like: initial zoom, width, height, under categories, post ID, number of points, specific address, icon and thumbnail.
32
 
33
  For more details and examples visit the <a href="http://web-argument.com/2011/07/18/google-map-shortcode-plugin-version-2-1/">plugin page</a>.
34
 
@@ -37,7 +36,7 @@ For more details and examples visit the <a href="http://web-argument.com/2011/07
37
  1. Upload 'Google Map Short Code' folder to the '/wp-content/plugins/' directory.
38
  2. Activate the plugin through the 'Plugins' menu in WordPress.
39
  3. Go to the Google Map Shortcode Options page under settings and save your prefered options.
40
- 4. Using the Google Map editor button insert the address or latitude/longitude and add the map on your posts/pages.
41
 
42
  == How to use ==
43
  Visit <a href="http://web-argument.com/2011/07/20/google-map-shortcode-how-to-use/">Google Map Shortcode - How to use</a>
@@ -47,9 +46,15 @@ Visit <a href="http://web-argument.com/2011/07/20/google-map-shortcode-how-to-us
47
  1. Custom Marker
48
  2. Google Map Shortcode Button
49
  3. Google Map Shortcode editor panel
50
-
51
 
52
  == Changelog ==
 
 
 
 
 
 
53
 
54
  = 2.1 =
55
  * Allows selecting single point icon, title and description.
4
  Tags: google map, shortcode, map, categories, widget, post map, point, marker, list, location, address, images
5
  Requires at least: 2.5
6
  Tested up to: 3.2.1
7
+ Stable tag: 2.1.1
8
 
9
+ Real Friendly integration of Google Map instances into your blogs. Allows displaying multiple maps on your pages.
10
 
11
  == Description ==
12
 
13
+ This plugin allows you to include instances of Google Map in your blogs with a simple editor button. You can insert maps everywhere: in your theme files, posts and pages. The points can include custom title, description, marker and thumbnail.
14
 
15
  Special Features:
16
 
17
+ * Editor button allows to include points and maps.
18
  * Custom markers allowed.
19
  * Based on Google Maps Javascript API Version 3.
20
  * Faster and more applicable to mobile devices.
21
  * Open Google Map in new window - included to the html windows.
22
  * Post ID include as shortcode parameter.
23
+ * Map in multiple languages.
 
24
  * Multiples points in a single map.
25
  * Multiples maps in a single page.
26
+ * Show post-points under categories.
27
+ * Allows to insert maps everywhere.
28
+ * The window box opened display part of the content of your posts like: post title, thumbnails, excerpt or a custom title description and thumbnail.
29
+ * You can customize the html of the info window box on the settings.
30
+ * The shortcode allows different options to customize your maps like: initial zoom, width, height, categories, post ID, specific address, marker and thumbnail.
31
 
32
  For more details and examples visit the <a href="http://web-argument.com/2011/07/18/google-map-shortcode-plugin-version-2-1/">plugin page</a>.
33
 
36
  1. Upload 'Google Map Short Code' folder to the '/wp-content/plugins/' directory.
37
  2. Activate the plugin through the 'Plugins' menu in WordPress.
38
  3. Go to the Google Map Shortcode Options page under settings and save your prefered options.
39
+ 4. Using the Google Map editor button insert the address and add the map into your posts/pages.
40
 
41
  == How to use ==
42
  Visit <a href="http://web-argument.com/2011/07/20/google-map-shortcode-how-to-use/">Google Map Shortcode - How to use</a>
46
  1. Custom Marker
47
  2. Google Map Shortcode Button
48
  3. Google Map Shortcode editor panel
49
+ 4. Google Map Shortcode Media Tab
50
 
51
  == Changelog ==
52
+
53
+ = 2.1.1 =
54
+ * Google Map Shortcode tab added to the media editor window.
55
+ * Upload Image button added.
56
+ * Cleaning string before saving points fixed.
57
+ * Other bugs fixed.
58
 
59
  = 2.1 =
60
  * Allows selecting single point icon, title and description.
screenshot-4.jpg ADDED
Binary file