Google Map Shortcode - Version 2.0

Version Description

  • Custom marker added.
    • Google Map Javascript v3 integrated.
    • Editor button added.
    • Ready for translation.
    • Maps in different languages allows.
Download this release

Release Info

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

Code changes from version 1.1 to 2.0

google-map-sc-style.css DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * Google Map Shortcode
3
- * Version: 1.1
4
- * Author: Alain Gonzalez
5
- * Author URI: http://web-argument.com/
6
- */
7
-
8
- .gm_info_cont{
9
- width:250px;
10
- height:200px;
11
- padding-right:10px;
12
- }
13
-
14
- .gm_info_title{
15
- margin:0;
16
- font-weight:bold;
17
- }
18
-
19
- .gm_info_address{
20
- font-size:10px;
21
- text-align:left;
22
- font-weight:bold;
23
- }
24
-
25
- .gm_info_img{
26
- width:100px;
27
- padding-right:15px
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
google-map-sc-v3.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Google Map Shortcode
3
+ * Version: 2.0
4
+ * Author: Alain Gonzalez
5
+ * Author URI: http://web-argument.com/
6
+ */
7
+
8
+ function gmshc_render(id,GMpointsArray,zoom) {
9
+
10
+ var myOptions = {
11
+ zoom: zoom,
12
+ center: new google.maps.LatLng(GMpointsArray[0].point.lat,GMpointsArray[0].point.long),
13
+ mapTypeId: google.maps.MapTypeId.ROADMAP
14
+ }
15
+ var map = new google.maps.Map(document.getElementById(id),myOptions);
16
+
17
+ gmshc_placing(map,GMpointsArray);
18
+
19
+ }
20
+
21
+ function gmshc_placing (map, locations){
22
+
23
+ var infowindow;
24
+
25
+ for (var i = 0; i < locations.length; i++){
26
+
27
+ var location = locations[i];
28
+
29
+ var marker = new google.maps.Marker({
30
+ position: new google.maps.LatLng(location.point.lat, location.point.long),
31
+ map: map,
32
+ icon: new google.maps.MarkerImage(location.icon),
33
+ title:location.address
34
+ });
35
+
36
+
37
+ gmshc_addListener(map, marker, location.info);
38
+
39
+ }
40
+ }
41
+
42
+
43
+ function gmshc_addListener(map, marker, info){
44
+
45
+ var infowindow = new google.maps.InfoWindow({
46
+ maxWidth:340,
47
+ content: info
48
+ });
49
+
50
+ google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); });
51
+
52
+ }
53
+
54
+ function addLoadEvent(func) {
55
+ var oldonload = window.onload;
56
+ if (typeof window.onload != 'function') {
57
+ window.onload = func;
58
+ }
59
+ else {
60
+ window.onload = function() {
61
+ oldonload();
62
+ func();
63
+ }
64
+ }
65
+ }
google-map-sc.js DELETED
@@ -1,89 +0,0 @@
1
- /**
2
- * Google Map Shortcode
3
- * Version: 1.1
4
- * Author: Alain Gonzalez
5
- * Author URI: http://web-argument.com/
6
- */
7
-
8
- function gmshc_render(id,GMpointsArray,zoom) {
9
-
10
- var map = new GMap2(document.getElementById(id));
11
-
12
-
13
- var customUI = map.getDefaultUI();
14
-
15
- // Remove MapType.G_HYBRID_MAP
16
- customUI.maptypes.hybrid = false;
17
-
18
- map.setUI(customUI);
19
-
20
-
21
- this.findPoint = findPoint;
22
- this.placing = placing;
23
-
24
-
25
-
26
- for (var i = 0; i <= GMpointsArray.length - 1; i++){
27
-
28
- this.placing(GMpointsArray[i]);
29
-
30
- }
31
-
32
- function placing (single, showinfo){
33
-
34
- var latlng = new GLatLng(single.point.lat,single.point.long);
35
- map.setCenter(latlng, zoom);
36
- var marker = new GMarker(latlng);
37
- map.addOverlay(marker);
38
-
39
- if(showinfo){
40
-
41
- map.openInfoWindowHtml(latlng, single.info);
42
-
43
- }
44
- if (single.info != null){
45
- GEvent.addListener(marker, "click", function() {
46
-
47
- map.openInfoWindowHtml(latlng, single.info);
48
-
49
- });
50
- }
51
-
52
- }
53
-
54
-
55
- function findPoint(which) {
56
-
57
- this.placing(GMpointsArray[which], true);
58
-
59
- }
60
-
61
- }
62
-
63
- function addLoadEvent(func) {
64
- var oldonload = window.onload;
65
- if (typeof window.onload != 'function') {
66
- window.onload = func;
67
- }
68
- else {
69
- window.onload = function() {
70
- oldonload();
71
- func();
72
- }
73
- }
74
- }
75
-
76
-
77
- function addEvent(elm, evType, fn, useCapture) {
78
- if (elm.addEventListener) {
79
- elm.addEventListener(evType, fn, useCapture);
80
- return true;
81
- }
82
- else if (elm.attachEvent) {
83
- var r = elm.attachEvent('on' + evType, fn);
84
- return r;
85
- }
86
- else {
87
- elm['on' + evType] = fn;
88
- }
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
google-map-shortcode.php CHANGED
@@ -1,15 +1,55 @@
1
  <?php
2
  /*
3
  Plugin Name: Google Map Shortcode
4
- Plugin URI: http://web-argument.com/google-map-shortcode-version-11/
5
- Description: Include Google Map in your blog displaying your post address using differents parameters.
6
- Version: 1.1
7
  Author: Alain Gonzalez
8
  Author URI: http://web-argument.com/
9
  */
10
 
 
 
 
11
 
12
- // to find latitud longitud http://www.batchgeocode.com/lookup/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
  /**
@@ -17,39 +57,301 @@ Author URI: http://web-argument.com/
17
  */
18
  function gmshc_head() {
19
 
20
- $options = get_option('gmshc_op');
21
- $gmshc_key = $options['gmshc_key'];
22
-
23
- $wpchkt_header = "\n<!-- Google Map Shortcode -->\n";
24
- $wpchkt_header .= "<script src=\"http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=".$gmshc_key."\" type=\"text/javascript\"></script>\n";
25
- $wpchkt_header .= "<script type=\"text/javascript\" src=\"".get_bloginfo('url')."/wp-content/plugins/google-map-shortcode/google-map-sc.js\"></script>\n";
26
- $wpchkt_header .= "<link href=\"".get_bloginfo('url')."/wp-content/plugins/google-map-shortcode/google-map-sc-style.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
27
- $wpchkt_header .= "\n<!-- Google Map Shortcode-->\n";
28
-
29
- print($wpchkt_header);
 
 
 
 
 
30
 
31
  }
32
 
33
  add_action('wp_head', 'gmshc_head');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  /**
37
  * Default Open Window Html
38
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- $defaul_gmshc_windowhtml = "<div class='gm_info_cont'>\n";
41
- $defaul_gmshc_windowhtml .= "<p class='gm_info_title'><a class='title' href='%link%'>%title%</a></p>\n";
42
- $defaul_gmshc_windowhtml .= "<p class='gm_info_address'>%address%</p>\n";
43
- $defaul_gmshc_windowhtml .= "<table border='0' cellspacing='0' cellpadding='5' height='80'>\n";
44
- $defaul_gmshc_windowhtml .= "<tr>\n";
45
- $defaul_gmshc_windowhtml .= "<td valign='top' align='left'><a href='%link%'><img src='%thubnail%' class='gm_info_img' /></a></td>\n";
46
- $defaul_gmshc_windowhtml .= "<td valign='top' align='left'>\n";
47
- $defaul_gmshc_windowhtml .= "%excerpt%\n";
48
- $defaul_gmshc_windowhtml .= "<p><a href='%link%'>more &raquo;</a></p>\n";
49
- $defaul_gmshc_windowhtml .= "</td>\n";
50
- $defaul_gmshc_windowhtml .= "</tr>\n";
51
- $defaul_gmshc_windowhtml .= "</table>\n";
52
- $defaul_gmshc_windowhtml .= "</div>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  /**
55
  * The Sortcode
@@ -59,139 +361,192 @@ add_shortcode('google-map-sc', 'gmshc_sc');
59
 
60
  function gmshc_sc($atts) {
61
 
62
- global $post;
63
-
64
- $address_meta = get_post_meta(get_the_ID(), 'google-map-sc-address');
65
- $point_meta = get_post_meta(get_the_ID(), 'google-map-sc-latlng');
66
 
67
- $the_address = $address_meta[0];
68
- $point = $point_meta[0];
69
- $the_item = '';
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  extract(shortcode_atts(array(
72
  'address' => '',
73
  'id' => '',
74
  'cat' => '',
75
- 'number' => '',
76
- 'zoom' => '10',
77
- 'width' => '400',
78
- 'height' => '400',
79
- 'external_links' => false
 
80
  ), $atts));
81
 
82
 
 
83
  if (!empty($address)) {
84
 
85
- $the_item = gmshc_fill_items('',$address, '');
86
- if (!empty($the_item)) $gm_item[0] = $the_item;
87
-
88
-
89
- }
90
-
91
- else if (
92
-
93
- (
94
-
95
- (!empty($id)) || (!empty($point)) || (!empty($the_address))
 
 
96
 
97
- )
 
 
 
 
 
 
 
 
 
98
 
99
- & (empty($cat))
100
- & (empty($number))
101
- & (!($external_links))
102
-
103
- )
104
 
105
- {
106
-
107
- if (empty($id)) $id = $post->ID;
108
 
109
- $gm_item = gmshc_items($id,'', '');
 
110
 
111
- }
 
 
112
 
113
- else {
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
- $gm_item = gmshc_items('',$number, $cat);
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  }
120
 
 
 
 
 
121
  $canvas = "canvas_".wp_generate_password(4, false);
122
 
123
 
124
  $i = 0;
125
 
126
 
127
- if (!empty($gm_item )){
128
-
129
- $output ='<div id="'.$canvas.'" style="width:'.$width.'px; height:'.$height.'px" class="google-map-sc-canvas"></div>';
130
  $output .= "<script type=\"text/javascript\">\n";
131
 
132
  $output .= "var map_".$canvas.";\n";
133
  $output .= "var map_points_".$canvas." = new Array();\n";
134
 
135
- foreach ($gm_item as $item){
136
 
137
- global $defaul_gmshc_windowhtml;
138
-
139
  $options = get_option('gmshc_op');
140
- $gmshc_windowhtml = $options['gmshc_windowhtml'];
141
 
142
- if (empty($gmshc_windowhtml)) $gmshc_windowhtml = $defaul_gmshc_windowhtml;
143
 
144
- $find = array("\r","\n","\\","\"","%title%","%link%","%thubnail%", "%excerpt%","%address%");
145
- $replace = array("","","","'",$item['title'],$item['link'],$item['img'],$item['excerpt'],$item['address']);
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
- $info = str_replace( $find,$replace, $gmshc_windowhtml);
148
 
 
149
 
150
- list($lat, $long) = split(",",$item['point']);
151
-
152
-
153
- if ( (empty($item['title'])) & (empty($item['link'])) & (empty($item['img'])) & (empty($item['excerpt'])) & (empty($item['address'])) )
154
-
155
- $output .= "map_points_".$canvas."[".$i."] = {'point':{'lat':\"".$lat."\",'long':\"".$long."\"}};\n";
156
-
157
- else
158
-
159
- $output .= "map_points_".$canvas."[".$i."] = {'point':{'lat':\"".$lat."\",'long':\"".$long."\"},'info':\"".$info."\"};\n";
160
-
161
- if ($external_links){
162
-
163
- $external_links_items .= "<li><a href='#' onclick='map_".$canvas.".findPoint(".$i."); return false'>".$item['title']."</a></li>";
164
- }
165
 
 
 
 
 
166
  $i ++;
167
  }
168
 
169
  $output .= "addLoadEvent(function(){\n";
170
- $output .= "map_".$canvas." = new gmshc_render(\"".$canvas."\",map_points_".$canvas.", ".$zoom.");\n";
171
  $output .= "});\n";
172
- $output .= "addEvent(window,'unload',GUnload,false);\n";
173
  $output .= "</script>\n";
174
 
175
- if ($external_links){
176
-
177
- $output .= "<div class='map_links'>";
178
- $output .= "<ul>";
179
- $output .= $external_links_items;
180
- $output .= "</ul>";
181
- $output .= "</div";
182
-
183
- }
184
 
185
- }
186
 
187
-
188
 
189
- return $output;
 
 
 
190
 
191
  }
192
 
193
 
194
  function gmshc_get_excerpt($text) { // Fakes an excerpt if needed
 
195
  if ( '' != $text ) {
196
 
197
  $text = strip_shortcodes( $text );
@@ -212,187 +567,83 @@ function gmshc_get_excerpt($text) { // Fakes an excerpt if needed
212
 
213
 
214
 
215
- /**
216
- * Get the items
217
- */
218
-
219
-
220
- function gmshc_items($id,$number, $categories){
221
-
222
- $i = 0;
223
- $the_item = '';
224
-
225
- //to avoid exceed the google request limit
226
- if (empty($number)) $number = 100;
227
-
228
- if (!empty($id)) {
229
- $my_query = get_posts(array('include'=>$id));
230
- $number = 1;
231
- }
232
-
233
-
234
-
235
- else if (empty($categories)){
236
-
237
- $my_query = get_posts(array('numberposts'=>-1));
238
- }
239
-
240
- else {
241
-
242
- $cat = split (",",$categories);
243
-
244
- $my_query = get_posts(array('category__in'=>$cat,'numberposts'=>-1));
245
-
246
- }
247
-
248
- foreach ($my_query as $post) {
249
-
250
- if ($i == $number) break;
251
-
252
- $address_meta = get_post_meta($post -> ID, 'google-map-sc-address');
253
- $point_meta = get_post_meta($post -> ID, 'google-map-sc-latlng');
254
-
255
-
256
- if ($number > 1){
257
-
258
- $address = $address_meta[0];
259
- $point = $point_meta[0];
260
-
261
- $the_item = gmshc_fill_items($post,$address,$point);
262
-
263
- if (!empty($the_item)) {
264
- $item[$i] = $the_item;
265
- $i ++;
266
- }
267
 
 
268
 
269
- } else {
270
-
271
- if (count($address_meta) > 1) {
272
-
273
- $j = 0;
274
-
275
- foreach ($address_meta as $address) {
276
-
277
- $the_item = gmshc_fill_items('',$address,'');
278
-
279
- if (!empty($the_item)) {
280
- $item[$j] = $the_item;
281
- $j ++;
282
- }
283
- }
284
- $i ++;
285
-
286
-
287
- } else if (count($point_meta) > 1) {
288
-
289
- $j = 0;
290
-
291
- foreach ($point_meta as $point) {
292
-
293
- $the_item = gmshc_fill_items('','',$point);
294
-
295
- if (!empty($the_item)) {
296
- $item[$j] = $the_item;
297
- $j ++;
298
- }
299
-
300
- }
301
- $i ++;
302
-
303
-
304
- } else {
305
-
306
- $address = $address_meta[0];
307
- $point = $point_meta[0];
308
-
309
- $the_item = gmshc_fill_items($post,$address,$point);
310
- if (!empty($the_item)) {
311
- $item[0] = $the_item;
312
- }
313
-
314
- }
315
-
316
- }
317
-
318
-
319
- }
320
-
321
- return $item;
322
-
323
- }
324
-
325
-
326
-
327
- function gmshc_fill_items($post,$address, $point){
328
-
329
- if ((empty($point)) & (!empty($address))){
330
-
331
- $response = gmshc_point($address);
332
-
333
- $point = $response['point'];
334
- $address = $response['address'];
335
 
336
- if (!empty($point)) {
337
- if (!empty($post)){
338
- update_post_meta($post -> ID, 'google-map-sc-latlng', $point);
339
- update_post_meta($post -> ID, 'google-map-sc-address', $address);
340
- }
341
- }
 
342
 
343
- }
344
-
345
- if (!empty($point)) {
346
-
347
  if (!empty($post)){
 
348
  $the_image = gmshc_post_thumb($post -> ID);
349
  $the_title = $post -> post_title;
350
- $the_link = $post -> guid;
351
 
352
  $find = array("\"", "[", "]", "\n","\r");
353
  $replace = array("'","","","","");
354
 
355
-
356
- $the_excerpt = str_replace( $find,$replace, gmshc_get_excerpt($post -> post_content));
357
 
358
- $item = array("point"=>$point,"img" => $the_image,"title" => $the_title,"link" => $the_link, "excerpt" => $the_excerpt, "address" => $address);
 
 
 
 
 
 
 
 
359
 
360
 
361
  } else {
362
 
363
- $item = array("point"=>$point);
364
 
365
  }
366
 
367
- return $item;
368
-
369
- }
370
-
371
  }
372
 
 
373
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
 
375
- /**
376
- * Get the thumbnail
377
- */
378
- function gmshc_post_thumb($the_parent){
379
 
380
- $attachments = get_children( array(
381
- 'post_parent' => $the_parent,
382
- 'post_type' => 'attachment',
383
- 'post_mime_type' => 'image',
384
- 'order' => 'DESC',
385
- 'numberposts' => 1) );
386
-
387
- if($attachments == true) :
388
- foreach($attachments as $id => $attachment) :
389
- $img = wp_get_attachment_image_src($id, 'thumbnail');
390
- endforeach;
391
- endif;
392
-
393
- return $img[0];
394
 
395
- }
396
 
397
 
398
  /**
@@ -402,236 +653,390 @@ $attachments = get_children( array(
402
  add_action('admin_menu', 'gmshc_set');
403
 
404
  function gmshc_set() {
405
- add_options_page('Google Map Shortcode', 'Google Map Shortcode', 10, 'google-map-shortcode', 'gmshc_options_page');
406
  }
407
 
408
  function gmshc_options_page() {
409
 
410
- global $defaul_gmshc_windowhtml;
411
-
412
- $options = get_option('gmshc_op');
 
413
 
 
 
 
 
 
 
 
414
 
415
  if(isset($_POST['Submit'])){
416
-
417
- ?>
418
- <script type="text/javascript">
419
- var KillAlerts = true;
420
- var realAlert = alert;
421
- var alert = new Function('a', 'if(!KillAlerts){realAlert(a)}');
422
- </script>
423
-
424
- <script src="http://maps.google.com/maps?file=api&v=2.105&key=<?php echo $_POST['gmshc_key'] ?>" type="text/javascript"></script>
425
-
426
-
427
- <script type="text/javascript">
428
- KillAlerts = false;
429
-
430
- if (GBrowserIsCompatible()) {
431
- document.write("<div class='updated'><p><strong><?php _e('Options saved.', 'mt_trans_domain' ); ?></strong></p></div>");
432
 
433
- <?php
434
- $newoptions['gmshc_key'] = $_POST['gmshc_key'];
435
- $newoptions['gmshc_windowhtml'] = $_POST['gmshc_windowhtml'];
436
-
437
- if ( $options != $newoptions ) {
438
- $options = $newoptions;
439
- update_option('gmshc_op', $options);
440
- }
441
-
442
- //Adding Meta Key
443
- $meta_key = get_post_meta(1, 'google-map-sc-address');
444
- $meta_key2 = get_post_meta(1, 'google-map-sc-latlng');
445
 
446
- if(empty($meta_key) || (empty($meta_key2))) {
447
 
448
- add_post_meta(1, 'google-map-sc-address', '');
449
- add_post_meta(1, 'google-map-sc-latlng', '');
 
 
 
 
 
450
 
451
- }
452
- ?>
453
-
454
- } else {
455
- if (G_INCOMPAT) {
456
- document.write("<div class='error'><p><strong><?php _e('Error: Bad Google API Key.', 'mt_trans_domain' ); ?></strong></p></div>");
457
- <?php
458
- $newoptions['gmshc_key'] = "";
459
- ?>
460
- } else {
461
- alert("Incompatible browser");
462
- }
463
- }
464
- </script>
465
-
466
- <?php
 
 
467
 
468
-
469
- }
 
470
 
471
  if(isset($_POST['Use_Default'])){
472
-
473
 
 
 
474
 
475
- $newoptions['gmshc_key'] = $_POST['gmshc_key'];
476
- $newoptions['gmshc_windowhtml'] = $defaul_gmshc_windowhtml;
 
477
 
 
 
 
478
 
479
- if ( $options != $newoptions ) {
480
- $options = $newoptions;
481
- update_option('gmshc_op', $options);
 
 
 
 
 
482
  }
483
 
484
-
485
- }
486
-
487
- $gmshc_key = $options['gmshc_key'];
488
- $gmshc_windowhtml = $options['gmshc_windowhtml'];
489
- ?>
490
-
491
-
492
- <div class="wrap">
493
-
494
- <form method="post" name="options" target="_self">
495
-
496
- <h2>Google Map Shortcode Settings</h2>
497
-
498
- <h3>Enter your Google Map Api Key. You can get it <a href="http://code.google.com/apis/maps/signup.html" target="_blank">here</a></h3>
499
-
500
- <p><input name="gmshc_key" type="text" value="<?php echo $gmshc_key ?>" size="105"/>
501
-
502
- <p class="submit">
503
- <input type="submit" name="Submit" value="Update" class="button-primary" />
504
- </p>
505
-
506
- <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Open Window Html</h3>
507
-
508
- <p>This is the html inside of the Map Info Window opened after clicking on the markers, you can include the following tags.</p>
509
-
510
- <table width="80%%" border="0" cellspacing="10" cellpadding="0">
511
- <tr>
512
- <td width="150" align="right"><strong>%title%</strong></td>
513
- <td>The title of your post</td>
514
- </tr>
515
- <tr>
516
- <td align="right"><strong>%link%</strong></td>
517
- <td>The link to your post</td>
518
- </tr>
519
- <tr>
520
- <td align="right"><strong>%thubnail%</strong></td>
521
- <td>The thubnail of the last image attached to your post</td>
522
- </tr>
523
- <tr>
524
- <td align="right"><strong>%excerpt%</strong></td>
525
- <td>The excerpt of your post</td>
526
- </tr>
527
- <tr>
528
- <td align="right"><strong>%address%</strong></td>
529
- <td>The address of this point in the map</td>
530
- </tr>
531
- </table>
532
- <br />
533
-
534
-
535
- <textarea name="gmshc_windowhtml" cols="110" rows="12" id="gmshc_windowhtml">
536
- <?php
537
- if (empty($gmshc_windowhtml)) echo $defaul_gmshc_windowhtml;
538
- else echo str_replace("\\", "",$gmshc_windowhtml);
539
 
540
- ?>
541
- </textarea>
542
-
543
- <p align="right" style="width:800px; padding:0">
544
- <input type="submit" name="Use_Default" value="Restore Default"/>
545
- </p>
546
-
547
- <p class="submit">
548
- <input type="submit" name="Submit" value="Update" class="button-primary" />
549
- </p>
550
-
551
- <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Use</h3>
552
- <p>You can include a Google Map Shortcode everywhere</p>
553
-
554
- <p>In your post using: <strong>[google-map-sc option = "option value"]</strong></p>
555
- <p>In your theme files using: <strong> < ?php echo do_shortcode [google-map-sc option = "option value"] ? ></strong></p>
556
-
557
- <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Options</h3>
558
-
559
- <table width="80%%" border="0" cellspacing="10" cellpadding="0">
560
- <tr>
561
- <td width="150"><div align="right"><strong>address</strong></div></td>
562
- <td>Specific address</td>
563
- </tr>
564
- <tr>
565
- <td><div align="right"><strong>id</strong></div></td>
566
- <td>Specific post ID</td>
567
- </tr>
568
- <tr>
569
- <td><div align="right"><strong>cat</strong></div></td>
570
- <td>Include post under this categories. (category number separated by comma)</td>
571
- </tr>
572
- <tr>
573
- <td><div align="right"><strong>number</strong></div></td>
574
- <td>Number of points/post on your map (Default 10)</td>
575
- </tr>
576
- <tr>
577
- <td><div align="right"><strong>zoom</strong></div></td>
578
- <td>Inicial zoom (Default 10)</td>
579
- </tr>
580
- <tr>
581
- <td><div align="right"><strong>width</strong></div></td>
582
- <td>Width of your map</td>
583
- </tr>
584
- <tr>
585
- <td><div align="right"><strong>height</strong></div></td>
586
- <td>Height of your map</td>
587
- </tr>
588
- <tr>
589
- <td><div align="right"><strong>external_links</strong></div></td>
590
- <td>Include the links to the map points outside of the map</td>
591
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
592
 
593
- </table>
594
-
595
-
596
- <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Feedback</h3>
597
-
598
- <p>For more details and examples visite the <a href="http://web-argument.com/google-map-shortcode/">Plugin Page</a>. All the comments are welcome.</p>
599
-
600
-
601
- <p class="submit">
602
- <input type="submit" name="Submit" value="Update" class="button-primary" />
603
- </p>
604
- </form>
605
- </div>
606
 
607
  <?php }
608
 
 
609
 
610
- function gmshc_point ($address){
611
-
612
-
613
- $find = array("\n","\r"," ");
614
- $replace = array("","","+");
615
-
616
- $address = str_replace( $find,$replace, $address);
617
-
618
- $url = 'http://maps.google.com/maps/geo?q='.$address.'&key='.$gmshc_key.'&sensor=false&output=xml&oe=utf8';
619
 
620
-
621
- $response = gmshc_xml2array($url);
 
 
 
 
 
 
 
622
 
623
- $coordinates = $response['kml']['Response']['Placemark']['Point']['coordinates'];
624
- $address = $response['kml']['Response']['Placemark']['address'];
625
 
626
- if (!empty($coordinates)) {
627
 
628
- $point_array = split(",",$coordinates);
629
 
630
- $point = $point_array[1].",".$point_array[0];
 
 
 
 
 
 
 
 
 
 
 
 
 
631
 
632
- $response = array('point'=>$point,'address'=>$address);
633
 
634
- return $response;
635
 
636
  }
637
 
1
  <?php
2
  /*
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.0
7
  Author: Alain Gonzalez
8
  Author URI: http://web-argument.com/
9
  */
10
 
11
+ define('GMSC_PLUGIN_DIR', WP_PLUGIN_DIR."/".dirname(plugin_basename(__FILE__)));
12
+ define('GMSC_PLUGIN_URL', WP_PLUGIN_URL."/".dirname(plugin_basename(__FILE__)));
13
+ define('GMSHC_VERSION','2.0');
14
 
15
+ /**
16
+ * Default Options
17
+ */
18
+ function get_gmshc_options ($default = false){
19
+
20
+ $gmshc_default = array(
21
+ 'zoom' => '10',
22
+ 'width' => '400',
23
+ 'height' => '400',
24
+ 'number' => 50,
25
+ 'language' => 'en',
26
+ 'windowhtml' => gmshc_defaul_windowhtml(),
27
+ 'icon' => '',
28
+ 'use_icon' => 'default',
29
+ 'default_icon' => 'marker.png',
30
+ 'custom_icon' => '',
31
+ 'version' => GMSHC_VERSION
32
+ );
33
+
34
+
35
+ if ($default) {
36
+ update_option('gmshc_op', $gmshc_default);
37
+ return $gmshc_default;
38
+ }
39
+
40
+ $options = get_option('gmshc_op');
41
+ if (isset($options)){
42
+ if (isset($options['version'])) {
43
+ $chk_version = version_compare(GMSHC_VERSION,$options['version']);
44
+ if ($chk_version == 0) return $options;
45
+ else if ($chk_version > 0) $options = $gmshc_default;
46
+ } else {
47
+ $options = $gmshc_default;
48
+ }
49
+ }
50
+ update_option('gmshc_op', $options);
51
+ return $options;
52
+ }
53
 
54
 
55
  /**
57
  */
58
  function gmshc_head() {
59
 
60
+ $options = get_gmshc_options();
61
+ $language = $options['language'];
62
+ $key = get_option('gmshc_key');
63
+
64
+ $gmshc_header = "\n<!-- Google Map Shortcode Version ".GMSHC_VERSION."-->\n";
65
+ $gmshc_header .= "<script src=\"http://maps.google.com/maps/api/js?sensor=false";
66
+ if(isset($key))
67
+ $gmshc_header .= "&key=".$key;
68
+ if(isset($language))
69
+ $gmshc_header .= "&language=".$language;
70
+ $gmshc_header .="\" type=\"text/javascript\"></script>\n";
71
+ $gmshc_header .= "<script type=\"text/javascript\" src=\"".GMSC_PLUGIN_URL."/google-map-sc-v3.js\"></script>\n";
72
+ $gmshc_header .= "<!-- /Google Map Shortcode Version ".GMSHC_VERSION."-->\n";
73
+
74
+ print($gmshc_header);
75
 
76
  }
77
 
78
  add_action('wp_head', 'gmshc_head');
79
+
80
+
81
+ /**
82
+ * Google Map SC Editor Button
83
+ */
84
+
85
+ add_action('media_buttons', 'gmshc_media_buttons', 20);
86
+ function gmshc_media_buttons($admin = true)
87
+ {
88
+ global $post_ID, $temp_ID;
89
+
90
+ $media_upload_iframe_src = get_option('siteurl').'/wp-admin/media-upload.php?post_id=$uploading_iframe_ID';
91
+
92
+ $iframe_title = __('Google Map Shortcode');
93
+
94
+ echo "<a class=\"thickbox\" href=\"media-upload.php?post_id={$post_ID}&amp;tab=gmshc&amp;TB_iframe=true&amp;height=500&amp;width=680\" title=\"$iframe_title\"><img src=\"".GMSC_PLUGIN_URL."/images/marker.png\" alt=\"$iframe_title\" /></a>";
95
+
96
+ }
97
+
98
+ add_action('media_upload_gmshc', 'gmshc_tab_handle');
99
+ function gmshc_tab_handle() {
100
+ return wp_iframe('gmshc_tab_process');
101
+ }
102
+
103
+ function gmshc_tab_process(){
104
+
105
+ $options = get_gmshc_options();
106
+
107
+ $post_id = $_REQUEST["post_id"];
108
+ $custum_fieds = get_post_custom($post_id);
109
+ $points_addr = isset($custum_fieds['google-map-sc-address'])?$custum_fieds['google-map-sc-address'] : array();
110
+ $points_ltlg = isset($custum_fieds['google-map-sc-latlng'])?$custum_fieds['google-map-sc-latlng'] : array();
111
+ $add_point = isset($_REQUEST['add_point']) ? $_REQUEST['add_point'] : '';
112
+ $del_point = isset($_REQUEST['delp']) ? $_REQUEST['delp'] : '';
113
+ $update_point = isset($_REQUEST['update']) ? $_REQUEST['update'] : '';
114
+ $width = isset($_REQUEST['width']) ? $_REQUEST['width'] : $options['width'];
115
+ $height = isset($_REQUEST['height']) ? $_REQUEST['height'] : $options['height'];
116
+ $zoom = isset($_REQUEST['zoom']) ? $_REQUEST['zoom'] : $options['zoom'];
117
+
118
+ if (!empty($add_point)) {
119
+
120
+ if (isset($_REQUEST['full_address'])){
121
+ if ($gmshc_point = gmshc_point ($_REQUEST['full_address'],"")) {
122
+
123
+ add_post_meta($post_id , "google-map-sc-address", $gmshc_point['address'], false);
124
+ add_post_meta($post_id , "google-map-sc-latlng", $gmshc_point['point'], false);
125
+
126
+ } else {
127
+
128
+ echo "<div class='error'><p>".__("The Address can't be located.")."</p></div>";
129
+
130
+ }
131
+ }
132
+
133
+ }
134
+
135
+ if ($del_point != '') {
136
+
137
+ foreach ($points_addr as $id => $single_addr) {
138
+
139
+ if ($del_point == $id) delete_post_meta($post_id, "google-map-sc-address", $single_addr);
140
+
141
+ }
142
+
143
+ foreach ($points_ltlg as $id => $single_ltlg) {
144
+ if ($del_point == $id) delete_post_meta($post_id, "google-map-sc-latlng", $single_ltlg);
145
+
146
+ }
147
+
148
+ echo "<div class='updated'><p>".__("The Point was deleted.")."</p></div>";
149
+
150
+ }
151
+
152
+ if (!empty($update_point)) {
153
+
154
+ $posted_addr = $_REQUEST['addr'];
155
+ $posted_ltlg = $_REQUEST['ltlg'];
156
+
157
+ for ($j = 0; $j < count($posted_ltlg); $j++ ) {
158
+
159
+ update_post_meta($post_id, "google-map-sc-address", $posted_addr[$j], $points_addr[$j]);
160
+
161
+ update_post_meta($post_id, "google-map-sc-latlng", $posted_ltlg[$j], $points_ltlg[$j]);
162
+
163
+ }
164
+
165
+ echo "<div class='updated'><p>".__("The Point was updated.")."</p></div>";
166
+ }
167
+
168
+ $custum_fieds = get_post_custom($post_id);
169
+ $points_addr = isset($custum_fieds['google-map-sc-address'])?$custum_fieds['google-map-sc-address'] : array();
170
+ $points_ltlg = isset($custum_fieds['google-map-sc-latlng'])?$custum_fieds['google-map-sc-latlng'] : array();
171
 
172
+ ?>
173
+ <div style="width:620px; margin:10px auto">
174
+
175
+ <form action="#" method="post">
176
+
177
+ <table width="620" border="0" cellspacing="10" cellpadding="10">
178
+ <tr>
179
+ <td colspan="2">
180
+ <h3><?php _e("Map Dimensions"); ?></h3>
181
+ </td>
182
+ </tr>
183
+ <tr>
184
+ <td align="right"><?php _e("Width"); ?></td>
185
+ <td valign="top"><input name="width" type="text" id="width" size="10" value = "<?php echo $width ?>"/></td>
186
+ </tr>
187
+ <tr>
188
+ <td align="right"><?php _e("Height"); ?></td>
189
+ <td valign="top"><input name="height" type="text" id="height" size="10" value = "<?php echo $height ?>" /></td>
190
+ </tr>
191
+ <tr>
192
+ <td align="right"><?php _e("Zoom"); ?></td>
193
+ <td valign="top"><input name="zoom" type="text" id="zoom" size="10" value = "<?php echo $zoom ?>" /></td>
194
+ </tr>
195
+ <tr>
196
+ <td colspan="2">
197
+ <h3><?php _e("Add New Point"); ?></h3>
198
+ </td>
199
+ </tr>
200
+ <tr>
201
+ <td align="right" valign="top">
202
+ <?php _e("Full Address"); ?>
203
+ </td>
204
+ <td valign="top">
205
+ <textarea name="full_address" cols="50" rows="4" id="full_address"></textarea>
206
+ </td>
207
+ </tr>
208
+ </table>
209
+
210
+ <p><input class="button" value="<?php _e("Add Point") ?>" name="add_point" type="submit"></p>
211
+
212
+ <?php
213
+ if (count($points_addr) > 0 || count($points_ltlg) > 0 ){
214
+ ?>
215
+
216
+ <table class="widefat" cellspacing="0">
217
+ <thead>
218
+ <tr>
219
+ <th><?php _e("Address"); ?></th>
220
+ <th><?php _e("Latitude/Longitude"); ?></th>
221
+ </tr>
222
+ </thead>
223
+ <tbody class="media-item-info">
224
+ <?php
225
+ $i = 0;
226
+ while ($i < count($points_addr) || $i < count($points_ltlg)) {
227
+ if (!isset( $points_ltlg[$i]) ){
228
+ $this_ltlg = gmshc_point ($points_addr[$i],"");
229
+ $points_ltlg[$i] = $this_ltlg['point'];
230
+ update_post_meta($post_id, "google-map-sc-latlng", $points_ltlg[$i], "");
231
+ }
232
+ if (!isset( $points_addr[$i]) ){
233
+ $this_addr = gmshc_point ("",$points_ltlg[$i]);
234
+ $points_addr[$i] = $this_addr['address'];
235
+ update_post_meta($post_id, "google-map-sc-address", $points_addr[$i], "");
236
+ }
237
+ ?>
238
+ <tr>
239
+ <td>
240
+ <textarea name="addr[]" cols="30" rows="3" id="addr_<?php echo $i ?>"><?php echo $points_addr[$i] ?></textarea>
241
+ </td>
242
+ <td>
243
+ <input name="ltlg[]" type="text" id="ltlg_<?php echo $i ?>" size="30" value = "<?php echo $points_ltlg[$i] ?>"/>
244
+ <div style="padding:15px 0;">
245
+ <input class="button" value="<?php _e("Update"); ?>" name="update" type="submit">
246
+ <a href="" class="thickbox" onclick="delete_point(<?php echo $i ?>); return false"><?php _e("Delete"); ?></a>
247
+ </div>
248
+ </td>
249
+ </tr>
250
+ <?php
251
+ $i ++;
252
+ }
253
+ ?>
254
+ </tbody>
255
+ </table>
256
+
257
+ <p><input class="button-primary" value="<?php _e("Insert Map"); ?>" type="button" onclick="add_map(); return false;"></p>
258
+
259
+ <?php } ?>
260
+ </form>
261
+ </div>
262
+
263
+
264
+ <script type="text/javascript">
265
+
266
+ function add_map (){
267
+ var width = jQuery("#width").val();
268
+ var height = jQuery("#height").val();
269
+ var zoom = jQuery("#zoom").val();
270
+
271
+ str = "[google-map-sc";
272
+ if (width != '')
273
+ str += " width="+width;
274
+ if (height != '')
275
+ str += " height="+height;
276
+ if (zoom != '')
277
+ str += " zoom="+zoom;
278
+ str +="]";
279
+
280
+ if (parent.tinyMCE){
281
+ parent.tinyMCE.activeEditor.setContent(parent.tinyMCE.activeEditor.getContent() + str);
282
+ }else{
283
+ parent.document.getElementById("content").value = parent.document.getElementById("content").value + "\r\n" +str;
284
+ }
285
+ }
286
+
287
+ function delete_point(id){
288
+ var answer = confirm ('<?php _e("You will not be able to roll back deletion. Are you sure?"); ?>');
289
+ if (answer) {
290
+ var width = jQuery("#width").val();
291
+ var height = jQuery("#height").val();
292
+ var zoom = jQuery("#zoom").val();
293
+
294
+ var url = "?post_id=<?php echo $post_id ?>&tab=gmshc&delp="+id+"&width="+width+"&height="+height+"&zoom="+zoom;
295
+ window.location = url;
296
+ } else {
297
+ return false;
298
+ }
299
+ }
300
+
301
+ </script>
302
+
303
+ <?php
304
+ }
305
+
306
 
307
  /**
308
  * Default Open Window Html
309
  */
310
+ function gmshc_defaul_windowhtml(){
311
+
312
+ $defaul_gmshc_windowhtml = "<div style='margin:0; padding:0px; height:110px; width:310px; overflow:hidden'>\n";
313
+ $defaul_gmshc_windowhtml .= "<div style='float:left; width:200px'>\n";
314
+ $defaul_gmshc_windowhtml .= "<a class='title' href='%link%' style='clear:both; display:block'>%title%</a>\n";
315
+ $defaul_gmshc_windowhtml .= "<div style='font-size:11px; clear:both'><strong>%address%</strong></div>\n";
316
+ $defaul_gmshc_windowhtml .= "<div style='font-size:11px; clear:both; line-height:16px'>%excerpt%</div>\n";
317
+ $defaul_gmshc_windowhtml .= "<a href='%link%' style='font-size:11px; float:left; display:block'>more &raquo;</a>\n";
318
+ $defaul_gmshc_windowhtml .= "<img src='".GMSC_PLUGIN_URL."/images/open.jpg\' style='float: right; margin-right:5px'/> \n";
319
+ $defaul_gmshc_windowhtml .= "<a href='%open_map%' target='_blank' style='font-size:11px; float: right; display:block;'>Open Map</a>\n";
320
+ $defaul_gmshc_windowhtml .= "</div>\n";
321
+ $defaul_gmshc_windowhtml .= "<img src='%thubnail%' style='float:left; margin:8px 0 0 8px; width:90px; height:90px'/>\n";
322
+ $defaul_gmshc_windowhtml .= "</div>\n";
323
+
324
+ return $defaul_gmshc_windowhtml;
325
+
326
+ }
327
 
328
+
329
+ /**
330
+ * Get the thumbnail
331
+ */
332
+ function gmshc_post_thumb($the_parent){
333
+
334
+ if( function_exists('has_post_thumbnail') && has_post_thumbnail($the_parent)) {
335
+ $thumbnail_id = get_post_thumbnail_id( $the_parent );
336
+ if(!empty($thumbnail_id))
337
+ $img = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail' );
338
+ } else {
339
+ $attachments = get_children( array(
340
+ 'post_parent' => $the_parent,
341
+ 'post_type' => 'attachment',
342
+ 'post_mime_type' => 'image',
343
+ 'orderby' => 'menu_order',
344
+ 'order' => 'ASC',
345
+ 'numberposts' => 1) );
346
+ if($attachments == true) :
347
+ foreach($attachments as $id => $attachment) :
348
+ $img = wp_get_attachment_image_src($id, 'thumbnail');
349
+ endforeach;
350
+ endif;
351
+ }
352
+ if (isset($img[0])) return $img[0];
353
+
354
+ }
355
 
356
  /**
357
  * The Sortcode
361
 
362
  function gmshc_sc($atts) {
363
 
364
+ global $post;
365
+ $options = get_gmshc_options();
 
 
366
 
367
+ $width = $options['width'];
368
+ $height = $options['height'];
369
+ $zoom = $options['zoom'];
370
+ $number = $options['number'];
371
+ $icon = $options['icon'];
372
+ $language = $options['language'];
373
+
374
+ // First Point in the post
375
+ $address_meta = get_post_meta($post -> ID, 'google-map-sc-address');
376
+ $point_meta = get_post_meta($post -> ID, 'google-map-sc-latlng');
377
+
378
+ $the_address = isset($address_meta[0]) ? $address_meta[0] : '';
379
+ $point = isset($point_meta[0]) ? $point_meta[0] : '';
380
+ $the_items = array();
381
 
382
  extract(shortcode_atts(array(
383
  'address' => '',
384
  'id' => '',
385
  'cat' => '',
386
+ 'number' => $number,
387
+ 'zoom' => $zoom,
388
+ 'width' => $width,
389
+ 'height' => $height,
390
+ 'icon' => $icon,
391
+ 'language' => $language
392
  ), $atts));
393
 
394
 
395
+ // When address is set
396
  if (!empty($address)) {
397
 
398
+ if( $item = gmshc_fill_item('','',$address) ) {
399
+ $the_items[0] = $item;
400
+ } else {
401
+ return __("The Address can't be located.");
402
+ }
403
+ // When id is set
404
+ } else if (!empty($id)) {
405
+
406
+ $post_obj = get_posts(array('include'=>$id,'numberposts'=>1));
407
+
408
+ if(isset($post_obj)) {
409
+
410
+ if ($post_points = gmshc_retrive_point($post_obj[0])){
411
 
412
+ for ($i = 0; $i < count($post_points); $i++) {
413
+
414
+ if ($i == $number) break;
415
+
416
+ if($item = gmshc_fill_item($post_obj[0], $post_points[$i]['point'],$post_points[$i]['address'])) {
417
+ $the_items[$i] = $item;
418
+ }
419
+
420
+
421
+ }
422
 
423
+ }
 
 
 
 
424
 
425
+ }
426
+
427
+ } else if ($cat != '') {
428
 
429
+ $categories = split (",",$cat);
430
+ $j = 0;
431
 
432
+ $post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1));
433
+
434
+ foreach ($post_obj as $post_item) {
435
 
 
436
 
437
+ if ($j < $number) {
438
+
439
+ if ($post_points = gmshc_retrive_point($post_item)){
440
+
441
+ for ($i = 0; $i < count($post_points); $i++) {
442
+
443
+ if ($i == $number) break;
444
+
445
+ if($item = gmshc_fill_item($post_item, $post_points[$i]['point'],$post_points[$i]['address'])) {
446
+ $the_items[$j] = $item;
447
+ $j++;
448
+ }
449
+
450
+ }
451
+
452
+ }
453
+
454
+
455
+
456
+ }
457
+
458
+ }
459
+
460
 
461
+ } else {
462
 
463
+ if ($post_points = gmshc_retrive_point($post)){
464
+
465
+ for ($i = 0; $i < count($post_points); $i++) {
466
+
467
+ if ($i == $number) break;
468
+
469
+ if( $item = gmshc_fill_item($post, $post_points[$i]['point'],$post_points[$i]['address']) ) {
470
+ $the_items[$i] = $item;
471
+ }
472
+
473
+ }
474
+
475
+ }
476
 
477
  }
478
 
479
+
480
+ if ( count($the_items) > 0 ) {
481
+
482
+
483
  $canvas = "canvas_".wp_generate_password(4, false);
484
 
485
 
486
  $i = 0;
487
 
488
 
489
+ $output ='<div id="'.$canvas.'" class = "gmsc" style="width:'.$width.'px; height:'.$height.'px; margin:10px auto"></div>';
 
 
490
  $output .= "<script type=\"text/javascript\">\n";
491
 
492
  $output .= "var map_".$canvas.";\n";
493
  $output .= "var map_points_".$canvas." = new Array();\n";
494
 
495
+ foreach ($the_items as $single_point){
496
 
 
 
497
  $options = get_option('gmshc_op');
498
+ $windowhtml = $options['windowhtml'];
499
 
500
+ list($lat, $long) = split(",",$single_point['point']);
501
 
502
+ if (isset($single_point['address'])) {
503
+
504
+ if (empty($windowhtml)) $windowhtml = gmshc_defaul_windowhtml();
505
+
506
+ $open_map = "http://maps.google.com/?q=".str_replace(" ","%20",$single_point['address']);
507
+ $point_title = isset($single_point['title'])?$single_point['title']:"";
508
+ $point_link = isset($single_point['link'])?$single_point['link']:"";
509
+ $point_img = isset($single_point['img'])?$single_point['img']:"";
510
+ $point_excerpt = isset($single_point['excerpt'])?$single_point['excerpt']:"";
511
+
512
+
513
+ $find = array("\f","\v","\t","\r","\n","\\","\"","%title%","%link%","%thubnail%", "%excerpt%","%address%","%open_map%");
514
+ $replace = array("","","","","","","'",$point_title,$point_link,$point_img,$point_excerpt,$single_point['address'],$open_map);
515
+
516
+ $info = str_replace( $find,$replace, $windowhtml);
517
 
518
+ //open map
519
 
520
+ $output .= "map_points_".$canvas."[".$i."] = {\"address\":\"".$single_point['address']."\",\"point\":{\"lat\":\"".$lat."\",\"long\":\"".$long."\"},\"info\":\"".$info."\",\"icon\":\"".$icon."\"};\n";
521
 
522
+ } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
523
 
524
+ $output .= "map_points_".$canvas."[".$i."] = {\"address\":\"".$single_point['address']."\",\"point\":{\"lat\":\"".$lat."\",\"long\":\"".$long."\"},\"icon\":\"".$icon."\"};\n";
525
+
526
+ }
527
+
528
  $i ++;
529
  }
530
 
531
  $output .= "addLoadEvent(function(){\n";
532
+ $output .= "gmshc_render(\"".$canvas."\",map_points_".$canvas.", ".$zoom.");\n";
533
  $output .= "});\n";
 
534
  $output .= "</script>\n";
535
 
 
 
 
 
 
 
 
 
 
536
 
537
+ return $output;
538
 
 
539
 
540
+ }
541
+
542
+ else return __("There is not points to locate on the map");
543
+
544
 
545
  }
546
 
547
 
548
  function gmshc_get_excerpt($text) { // Fakes an excerpt if needed
549
+
550
  if ( '' != $text ) {
551
 
552
  $text = strip_shortcodes( $text );
567
 
568
 
569
 
570
+ function gmshc_fill_item($post,$point,$address){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
 
572
+ if (empty($point) && empty($address)) return false;
573
 
574
+ if (empty($point) && !empty($address)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
 
576
+ if ($the_point = gmshc_point($address,"")) {
577
+ $address = $the_point['address'];
578
+ $point = $the_point['point'];
579
+ } else {
580
+ return false;
581
+ }
582
+ }
583
 
 
 
 
 
584
  if (!empty($post)){
585
+
586
  $the_image = gmshc_post_thumb($post -> ID);
587
  $the_title = $post -> post_title;
588
+ $the_link = get_permalink($post -> ID);
589
 
590
  $find = array("\"", "[", "]", "\n","\r");
591
  $replace = array("'","","","","");
592
 
593
+ $the_excerpt = str_replace( $find,$replace, gmshc_get_excerpt($post -> post_content));
 
594
 
595
+ if (!empty($address)) {
596
+
597
+ $item = array("point"=>$point,"address" => $address,"img" => $the_image,"title" => $the_title,"link" => $the_link, "excerpt" => $the_excerpt);
598
+
599
+ } else {
600
+
601
+ $item = array("point"=>$point,"img" => $the_image,"title" => $the_title,"link" => $the_link, "excerpt" => $the_excerpt);
602
+
603
+ }
604
 
605
 
606
  } else {
607
 
608
+ $item = array("point"=>$point,"address" => $address);
609
 
610
  }
611
 
612
+ return $item;
 
 
 
613
  }
614
 
615
+ function gmshc_retrive_point($post) {
616
 
617
+ $post_points = array();
618
+ $custum_fieds = get_post_custom($post->ID);
619
+ $points_addr = isset($custum_fieds['google-map-sc-address'])?$custum_fieds['google-map-sc-address'] : array();
620
+ $points_ltlg = isset($custum_fieds['google-map-sc-latlng'])?$custum_fieds['google-map-sc-latlng'] : array();
621
+
622
+ $num_addr = count($points_addr);
623
+ $num_ltlg = count($points_ltlg );
624
+
625
+ if ($num_ltlg > 0 && $num_ltlg==$num_addr){
626
+
627
+ for ($i = 0; $i < $num_ltlg; $i ++){
628
+ $post_points[$i] = array('point'=>$points_ltlg[$i],'address'=>$points_addr[$i]);
629
+ }
630
+
631
+ } else {
632
+
633
+ for ($i = 0; $i < $num_ltlg; $i ++){
634
+ if($point = gmshc_point ('',$points_ltlg[$i])){
635
+ $address = $point['address'];
636
+ $post_points[$i] = array('point'=>$points_ltlg[$i],'address'=>$address);
637
+ }
638
+ }
639
+
640
+ }
641
 
 
 
 
 
642
 
643
+ if(count($post_points) > 0) return $post_points;
644
+ else return false;
 
 
 
 
 
 
 
 
 
 
 
 
645
 
646
+ }
647
 
648
 
649
  /**
653
  add_action('admin_menu', 'gmshc_set');
654
 
655
  function gmshc_set() {
656
+ add_options_page('Google Map Shortcode', 'Google Map Shortcode', 'administrator', 'google-map-shortcode', 'gmshc_options_page');
657
  }
658
 
659
  function gmshc_options_page() {
660
 
661
+ $options = get_gmshc_options();
662
+ $gmshc_key = get_option('gmshc_key');
663
+ $icon_path = GMSC_PLUGIN_URL.'/images/icons/';
664
+ $icon_dir = GMSC_PLUGIN_DIR.'/images/icons/';
665
 
666
+ ?>
667
+
668
+ <div class="wrap">
669
+
670
+ <h2><?php _e("Google Map Shortcode Settings") ?></h2>
671
+
672
+ <?php
673
 
674
  if(isset($_POST['Submit'])){
675
+
676
+ if ($_POST['use_icon'] == "custom" && $_POST['custom_icon'] == "") {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
677
 
678
+ echo "<div class='error'><p>".__("Please upload a custom icon.")."</p></div>";
 
 
 
 
 
 
 
 
 
 
 
679
 
680
+ } else {
681
 
682
+ $new_gmshc_key = $_POST['gmshc_key'];
683
+ $newoptions['width'] = $_POST['width'];
684
+ $newoptions['height'] = $_POST['height'];
685
+ $newoptions['zoom'] = $_POST['zoom'];
686
+ $newoptions['number'] = $_POST['number'];
687
+ $newoptions['language'] = $_POST['language'];
688
+ $newoptions['windowhtml'] = $_POST['windowhtml'];
689
 
690
+ $newoptions['use_icon'] = $_POST['use_icon'];
691
+ $newoptions['default_icon'] = $_POST['default_icon'];
692
+ $newoptions['custom_icon'] = $_POST['custom_icon'];
693
+
694
+ if ($_POST['use_icon'] == 'default')
695
+ $newoptions['icon'] = $icon_path .$_POST['default_icon'];
696
+ else $newoptions['icon'] = $_POST['custom_icon'];
697
+
698
+ $newoptions['version'] = GMSHC_VERSION;
699
+
700
+ if ( $options != $newoptions ) {
701
+ $options = $newoptions;
702
+ update_option('gmshc_op', $options);
703
+ }
704
+ if ( $gmshc_key != $new_gmshc_key ) {
705
+ $gmshc_key = $new_gmshc_key;
706
+ update_option('gmshc_key', $options);
707
+ }
708
 
709
+ }
710
+
711
+ }
712
 
713
  if(isset($_POST['Use_Default'])){
 
714
 
715
+ $options['windowhtml'] = gmshc_defaul_windowhtml();
716
+ update_option('gmshc_op', $options);
717
 
718
+ }
719
+
720
+ if(isset($_POST['upload']) && isset($_FILES) ){
721
 
722
+ $filename = $_FILES["datafile"]["name"];
723
+
724
+ $upload = wp_upload_bits($filename, NULL, file_get_contents($_FILES["datafile"]["tmp_name"]));
725
 
726
+ if ( ! empty($upload['error']) ) {
727
+ $errorString = sprintf(__('Could not write file %1$s (%2$s)'), $filename, $upload['error']);
728
+ echo "<div class='error'><p><strong>".$errorString."</strong></p></div>";
729
+ } else {
730
+
731
+ $options['custom_icon'] = $upload['url'];
732
+ update_option('gmshc_op', $options);
733
+
734
  }
735
 
736
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
 
738
+ $width = isset ($_POST['width'])? $_POST['width']: $options['width'];
739
+ $height = isset ($_POST['height'])? $_POST['height'] : $options['height'];
740
+ $zoom = isset ($_POST['zoom'])? $_POST['zoom']: $options['zoom'];
741
+ $number = isset ($_POST['number'])? $_POST['number']: $options['number'];
742
+ $language = isset ($_POST['language'])? $_POST['language']: $options['language'];
743
+ $windowhtml = $options['windowhtml'];
744
+ $icon = $options['width'];
745
+ $use_icon = isset ($_POST['use_icon'])? $_POST['use_icon']: $options['use_icon'];
746
+ $default_icon = isset ($_POST['default_icon'])? $_POST['default_icon']: $options['default_icon'];
747
+ $custom_icon = $options['custom_icon'];
748
+
749
+ ?>
750
+
751
+ <form method="POST" name="options" target="_self" enctype="multipart/form-data">
752
+
753
+ <h3><?php _e("Maps Parameters") ?></h3>
754
+
755
+ <p><?php _e("The shortcode attributes overwrite these options.") ?></p>
756
+
757
+ <?php
758
+
759
+ $icons_array = array();
760
+ if ($handle = opendir($icon_dir)) {
761
+ $i = 0;
762
+ while (false !== ($file = readdir($handle))) {
763
+
764
+ $file_type = wp_check_filetype($file);
765
+
766
+ $file_ext = $file_type['ext'];
767
+
768
+ if ($file != "." && $file != ".." && ($file_ext == 'gif' || $file_ext == 'jpg' || $file_ext == 'png') ) {
769
+ $icons_array[$i] = $file;
770
+ $i ++;
771
+ }
772
+ }
773
+ }
774
+
775
+ ?>
776
+
777
+ <table width="80%%" border="0" cellspacing="10" cellpadding="0">
778
+ <tr>
779
+ <td colspan="2"><strong><?php _e("Dimensions") ?></strong></td>
780
+ </tr>
781
+ <tr>
782
+ <td width="150" align="right" height="40"><?php _e("Width") ?></td>
783
+ <td><input name="width" type="text" size="6" value="<?php echo $width ?>" /></td>
784
+ </tr>
785
+ <tr>
786
+ <td align="right"><?php _e("Height") ?></td>
787
+ <td><input name="height" type="text" size="6" value="<?php echo $height ?>" /></td>
788
+ </tr>
789
+ <tr>
790
+ <td align="right"><?php _e("Zoom") ?></td>
791
+ <td><input name="zoom" type="text" size="6" value="<?php echo $zoom ?>" /></td>
792
+ </tr>
793
+ <tr>
794
+ <td align="right"><?php _e("Maximum number of point in a single map") ?></td>
795
+ <td><input name="number" type="text" size="6" value="<?php echo $number ?>" /></td>
796
+ </tr>
797
+ <tr>
798
+ <td colspan="2"><strong><?php _e("Select Icon") ?></strong></td>
799
+ </tr>
800
+ <tr>
801
+ <td width="150" align="right" height="40">
802
+ <input name="use_icon" type="radio" value="default" style="margin-right:10px;" <?php echo ($use_icon == "default" ? "checked=\"checked\"" : "") ?>/><?php _e("Use default icons") ?>
803
+ </td>
804
+ <td>
805
+ <div style="width:30px; height:30px; float:left; margin:0 15px">
806
+ <img src="<?php echo $icon_path.$default_icon ?>" alt="icon" id="icon_img" />
807
+ </div>
808
+ <select name="default_icon" id = "default_icon">
809
+ <?php foreach ($icons_array as $icon){ ?>
810
+ <option value="<?php echo $icon ?>" <?php echo ($icon == $default_icon ? "selected" : "") ?>><?php echo $icon ?></option>
811
+ <?php } ?>
812
+ </select>
813
+
814
+ </td>
815
+ </tr>
816
+ <tr>
817
+ <td align="right" valign="top"><input name="use_icon" type="radio" value="custom" style="margin-right:10px;" <?php echo ($use_icon == "custom" ? "checked=\"checked\"" : "") ?> /><?php _e("Use custom icons") ?>
818
+ </td>
819
+ <td>
820
+ <div style="width:30px; height:30px; float:left; margin:0 15px">
821
+ <?php if ($custom_icon != "") { ?>
822
+ <img src="<?php echo $custom_icon ?>" alt="icon" id="icon_img" />
823
+ <?php } ?>
824
+ </div>
825
+ <?php _e("Please specify a file:") ?><br />
826
+ <input type="file" name="datafile" size="40" />
827
+ <p>
828
+ <input type="submit" name="upload" value="Upload" class="button" style="margin-left:50px" />
829
+ </p>
830
+ <input name="custom_icon" type="hidden" size="18" value="<?php echo $custom_icon ?>" />
831
+ </td>
832
+ </tr>
833
+ <tr>
834
+ <td colspan="2"><strong><?php _e("Language") ?></strong></td>
835
+ </tr>
836
+ <tr>
837
+ <td align="right" valign="top"><?php _e("Select") ?>
838
+ </td>
839
+ <td>
840
+ <?php
841
+ $lang_array = array(
842
+ "zh" => __("Chinese"),
843
+ "nl" => __("Dutch"),
844
+ "en" => __("English"),
845
+ "fr" => __("French"),
846
+ "de" => __("German"),
847
+ "it" => __("Italian"),
848
+ "pl" => __("Polish"),
849
+ "ja" => __("Japanese"),
850
+ "es" => __("Spanish"),
851
+ "ca" => __("Catalan"),
852
+ "gl" => __("Galego"),
853
+ "eu" => __("Euskara")
854
+
855
+ );
856
+ ?>
857
+ <select name="language" id="language">
858
+ <?php foreach($lang_array as $lg => $lg_name){ ?>
859
+ <option value="<?php echo $lg ?>" <?php echo ($lg == $language ? "selected" : "") ?> ><?php echo $lg_name ?></option>
860
+ <?php } ?>
861
+ </select>
862
+ </td>
863
+ </tr>
864
+ </table>
865
+
866
+ <p class="submit">
867
+ <input type="submit" name="Submit" value="Update" class="button-primary" />
868
+ </p>
869
+
870
+ <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Info Windows") ?></h3>
871
+
872
+ <p><?php _e("This is the html inside of the Map Info Window opened after clicking on the markers, you can include the following tags.") ?></p>
873
+
874
+ <table width="80%%" border="0" cellspacing="10" cellpadding="0">
875
+ <tr>
876
+ <td width="150" align="right"><strong>%title%</strong></td>
877
+ <td><?php _e("The title of your post") ?></td>
878
+ </tr>
879
+ <tr>
880
+ <td align="right"><strong>%link%</strong></td>
881
+ <td><?php _e("The link to your post") ?></td>
882
+ </tr>
883
+ <tr>
884
+ <td align="right"><strong>%thubnail%</strong></td>
885
+ <td><?php _e("The thubnail of the last image attached to your post") ?></td>
886
+ </tr>
887
+ <tr>
888
+ <td align="right"><strong>%excerpt%</strong></td>
889
+ <td><?php _e("The excerpt of your post") ?></td>
890
+ </tr>
891
+ <tr>
892
+ <td align="right"><strong>%address%</strong></td>
893
+ <td><?php _e("The address of this point in the map") ?></td>
894
+ </tr>
895
+ <tr>
896
+ <td align="right"><strong>%open_map%</strong></td>
897
+ <td><?php _e("Open this point on Google Map") ?></td>
898
+ </tr>
899
+ </table>
900
+ <br />
901
+
902
+ <textarea name="windowhtml" cols="110" rows="12" id="windowhtml">
903
+ <?php
904
+ if (empty($windowhtml)) echo gmshc_defaul_windowhtml();
905
+ else echo str_replace("\\", "",$windowhtml);
906
+ ?>
907
+ </textarea>
908
+
909
+ <p align="right" style="width:800px; padding:0">
910
+ <input type="submit" name="Use_Default" value="Restore Default"/>
911
+ </p>
912
+
913
+ <p class="submit">
914
+ <input type="submit" name="Submit" value="Update" class="button-primary" />
915
+ </p>
916
+
917
+ <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Google Map Api Key") ?></h3>
918
+
919
+ <p><?php _e("Enter your Google Map Api Key. You can get it <a href='http://code.google.com/apis/maps/signup.html' target='_blank'>here</a>. This is not required. Google Maps JavaScript API V3 no longer needs API keys!") ?></p>
920
+ <p><input name="gmshc_key" type="text" value="<?php echo $gmshc_key ?>" size="105"/>
921
+
922
+ <p class="submit">
923
+ <input type="submit" name="Submit" value="Update" class="button-primary" />
924
+ </p>
925
+
926
+ <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Use</h3>
927
+ <p>You can include a Google Map Shortcode everywhere</p>
928
+
929
+ <p>In your post using: <strong>[google-map-sc option = "option value"]</strong></p>
930
+ <p>In your theme files using: <strong> < ?php echo do_shortcode [google-map-sc option = "option value"] ? ></strong></p>
931
+
932
+ <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Options</h3>
933
+
934
+ <table width="80%%" border="0" cellspacing="10" cellpadding="0">
935
+ <tr>
936
+ <td width="150"><div align="right"><strong>address</strong></div></td>
937
+ <td>Specific address</td>
938
+ </tr>
939
+ <tr>
940
+ <td><div align="right"><strong>id</strong></div></td>
941
+ <td>Specific post ID</td>
942
+ </tr>
943
+ <tr>
944
+ <td><div align="right"><strong>cat</strong></div></td>
945
+ <td>Include post under this categories. (category number separated by comma)</td>
946
+ </tr>
947
+ <tr>
948
+ <td><div align="right"><strong>number</strong></div></td>
949
+ <td>Number of points/post on your map (Default 10)</td>
950
+ </tr>
951
+ <tr>
952
+ <td><div align="right"><strong>zoom</strong></div></td>
953
+ <td>Inicial zoom (Default 10)</td>
954
+ </tr>
955
+ <tr>
956
+ <td><div align="right"><strong>width</strong></div></td>
957
+ <td>Width of your map</td>
958
+ </tr>
959
+ <tr>
960
+ <td><div align="right"><strong>height</strong></div></td>
961
+ <td>Height of your map</td>
962
+ </tr>
963
+ </table>
964
+
965
+ <h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;">Feedback</h3>
966
+
967
+ <p>For more details and examples visite the <a href="http://web-argument.com/2011/05/04/google-map-shortcode-2-0-total-solution/">Plugin Page</a>. All the comments are welcome.</p>
968
+
969
+
970
+ <p class="submit">
971
+ <input type="submit" name="Submit" value="Update" class="button-primary" />
972
+ </p>
973
+ </form>
974
+ </div>
975
+
976
+ <script type="text/javascript">
977
+
978
+ (function ($) {
979
+
980
+ $(document).ready(function(){
981
+
982
+ $("#default_icon").click(function(){
983
+ switchImg(this);
984
+ });
985
+
986
+ var iconSelect = "";
987
+ function switchImg (obj) {
988
+ var iconName = $(obj).val();
989
+ var imgUrl = '<?php echo $icon_path ?>'+iconName;
990
+ $("#icon_img").attr('src',imgUrl);
991
+ }
992
 
993
+ });
994
+
995
+ })(jQuery);
996
+
997
+ </script>
 
 
 
 
 
 
 
 
998
 
999
  <?php }
1000
 
1001
+ function gmshc_point ($address,$ltlg){
1002
 
1003
+ if (!empty($ltlg)) $query = $ltlg;
1004
+ else if (!empty($address)) {
 
 
 
 
 
 
 
1005
 
1006
+ $find = array("\n","\r"," ");
1007
+ $replace = array("","","+");
1008
+ $address = str_replace( $find,$replace, $address);
1009
+
1010
+ $query = $address;
1011
+ }
1012
+ else return false;
1013
+
1014
+ $gmshc_key = get_option('gmshc_key');
1015
 
1016
+ $url = 'http://maps.google.com/maps/geo?q='.$query.'&key='.$gmshc_key.'&sensor=false&output=xml&oe=utf8';
 
1017
 
1018
+ $response = gmshc_xml2array($url);
1019
 
1020
+ if (isset($response['kml']['Response']['Placemark']['Point'])) {
1021
 
1022
+ $coordinates = $response['kml']['Response']['Placemark']['Point']['coordinates'];
1023
+ $address = $response['kml']['Response']['Placemark']['address'];
1024
+
1025
+ if (!empty($coordinates)) {
1026
+
1027
+ $point_array = split(",",$coordinates);
1028
+
1029
+ $point = $point_array[1].",".$point_array[0];
1030
+
1031
+ $response = array('point'=>$point,'address'=>$address);
1032
+
1033
+ return $response;
1034
+
1035
+ }
1036
 
1037
+ } else {
1038
 
1039
+ return false;
1040
 
1041
  }
1042
 
images/Thumbs.db ADDED
Binary file
images/icons/Thumbs.db ADDED
Binary file
images/icons/animals.png ADDED
Binary file
images/icons/audio.png ADDED
Binary file
images/icons/blue-pushpin.png ADDED
Binary file
images/icons/bookstore.png ADDED
Binary file
images/icons/bus.png ADDED
Binary file
images/icons/chapel.png ADDED
Binary file
images/icons/cycling.png ADDED
Binary file
images/icons/dogpark.png ADDED
Binary file
images/icons/family.png ADDED
Binary file
images/icons/flowers.png ADDED
Binary file
images/icons/friends.png ADDED
Binary file
images/icons/girlfriend.png ADDED
Binary file
images/icons/hiking-tourism.png ADDED
Binary file
images/icons/home.png ADDED
Binary file
images/icons/library.png ADDED
Binary file
images/icons/marker.png ADDED
Binary file
images/icons/olympicsite.png ADDED
Binary file
images/icons/photo.png ADDED
Binary file
images/icons/shoppingmall.png ADDED
Binary file
images/icons/supermarket.png ADDED
Binary file
images/icons/university.png ADDED
Binary file
images/icons/webcam.png ADDED
Binary file
images/marker.png ADDED
Binary file
images/open.jpg ADDED
Binary file
readme.txt CHANGED
@@ -1,52 +1,67 @@
1
  === Google Map Shortcode ===
2
  Contributors: Alaingg
3
- Donate link: http://web-argument.com/google-map-shortcode-version-11/
4
- Tags: google map, shortcode, map, categories, widget, post map, point, marker, list, location
5
  Requires at least: 2.5
6
- Tested up to: 2.8
7
- Stable tag: 1.1
8
 
9
- Friendly integration of Google Map instances in your blogs. Allows to display multiples map on your pages. Insert points on maps using a custon field.
10
 
11
  == Description ==
12
 
13
- This plugin allows you to include instances of Google Map in your blogs using the shortcode API. You can insert maps everywhere: in your theme files, posts and pages. The use of a custom field allows you to insert posts/pages on your maps as points.
14
 
15
  Special Features:
16
 
17
- * Allows to include more than one google map instance on your pages.
18
- * You can use the shortcode on your post, pages and theme files.
 
 
 
 
 
 
 
 
19
  * When you click on a point in the map the window box opened shows part of the content of your posts (post title, thumbnails, excerpt)
20
  * You can customize the html of the info window box on your maps
21
- * One custom field defines the address of a post
22
- * The shortcode allows different options to customize your maps like: inicial zoom, width, height, under categories, show external links, post ID, number of points, specific address
23
 
24
- For more details and examples visit the <a href="http://web-argument.com/google-map-shortcode-version-11/">plugin page</a>.
25
 
26
  == Installation ==
27
 
28
  1. Upload 'Google Map Short Code' folder to the '/wp-content/plugins/' directory.
29
- 2. Activate the plugin through the Plugins menu in WordPress.
30
- 3. Go to the Google Map Shortcode Options page under settings and Insert your Google Api Key.
 
31
 
32
 
33
  == Screenshots ==
34
 
35
- 1. Google Map Shortcode
36
- 2. Settings
37
  3. Custom Field
38
- 4. Shortcode example
39
- 5. Custom Html por window box
40
 
41
 
42
  == Changelog ==
43
-
44
- = 1.0.0 =
45
- * Inicial release.
46
 
 
 
 
 
 
 
 
47
  = 1.1 =
48
  * Loops related bugs fixed.
49
  * More than 10 points allows per page fixed.
50
  * New custom field included in order to cache the Latitude and Longitude and avoid extra Google Geocoder requests.
51
  * More than one point per post fixed.
 
 
 
52
 
1
  === Google Map Shortcode ===
2
  Contributors: Alaingg
3
+ Donate link: http://web-argument.com/google-map-shortcode-2-0-total-solution/
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.1.2
7
+ Stable tag: 2.0
8
 
9
+ Friendly integration of Google Map instances into your blogs. Allows to display multiples map on your pages. Insert points on 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 to insert address and map to your posts/pages with a single click.
14
 
15
  Special Features:
16
 
17
+ * Editor button added, to include easily the points to the map.
18
+ * Custom markers allows.
19
+ * Open Google Map in new window - included to the html windows.
20
+ * Post ID include as shortcode parameter.
21
+ * Map in multiple languages allows.
22
+ * API key not required.
23
+ * Multiples points in a single map.
24
+ * Multiples maps in a single page.
25
+ * Adding posts in the mas under categories.
26
+ * Inserting maps everywhere.
27
  * When you click on a point in the map the window box opened shows part of the content of your posts (post title, thumbnails, excerpt)
28
  * You can customize the html of the info window box on your maps
29
+ * The shortcode allows different options to customize your maps like: inicial zoom, width, height, under categories, post ID, number of points, specific address, icon
 
30
 
31
+ For more details and examples visit the <a href="http://web-argument.com/google-map-shortcode-2-0-total-solution/">plugin page</a>.
32
 
33
  == Installation ==
34
 
35
  1. Upload 'Google Map Short Code' folder to the '/wp-content/plugins/' directory.
36
+ 2. Activate the plugin through the 'Plugins' menu in WordPress.
37
+ 3. Go to the Google Map Shortcode Options page under settings and save your prefered options.
38
+ 4. Using the Google Map editor panel button insert the address or latitude/longitude.
39
 
40
 
41
  == Screenshots ==
42
 
43
+ 1. Custom Marker
44
+ 2. Editor Button
45
  3. Custom Field
46
+ 4. Custom Html por window box
47
+ 5. Shortcode example
48
 
49
 
50
  == Changelog ==
 
 
 
51
 
52
+ = 2.0 =
53
+ * Custom marker added.
54
+ * Google Map Javascript v3 integrated.
55
+ * Editor button added.
56
+ * Ready for translation.
57
+ * Maps in different languages allows.
58
+
59
  = 1.1 =
60
  * Loops related bugs fixed.
61
  * More than 10 points allows per page fixed.
62
  * New custom field included in order to cache the Latitude and Longitude and avoid extra Google Geocoder requests.
63
  * More than one point per post fixed.
64
+
65
+ = 1.0.0 =
66
+ * Inicial release.
67
 
screenshot-1.jpg CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file
screenshot-4.jpg CHANGED
Binary file