Version Description
- Map type added.
- Marker animation option added.
- Focus option added.
- Maps marging and aligment added.
- Performance improved.
- More map languages included
Download this release
Release Info
Developer | alaingg |
Plugin | Google Map Shortcode |
Version | 2.2 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.2
- google-map-shortcode.php +468 -245
- images/icons/apple.png +0 -0
- images/icons/bar.png +0 -0
- images/icons/beautifulview.png +0 -0
- images/icons/castle-2.png +0 -0
- images/icons/chicken.png +0 -0
- images/icons/cinema.png +0 -0
- images/icons/coffee.png +0 -0
- images/icons/cruiseship.png +0 -0
- images/icons/deer.png +0 -0
- images/icons/dogs_leash.png +0 -0
- images/icons/field.png +0 -0
- images/icons/hiking.png +0 -0
- images/icons/hotel_0star.png +0 -0
- images/icons/iceskating.png +0 -0
- images/icons/information.png +0 -0
- images/icons/jazzclub.png +0 -0
- images/icons/love_date.png +0 -0
- images/icons/notvisited.png +0 -0
- images/icons/nursery.png +0 -0
- images/icons/peace.png +0 -0
- images/icons/pin.png +0 -0
- images/icons/playground.png +0 -0
- images/icons/snowy.png +0 -0
- images/icons/sunny.png +0 -0
- images/icons/teahouse.png +0 -0
- images/icons/temple-2.png +0 -0
- images/icons/watermill.png +0 -0
- images/icons/yoga.png +0 -0
- images/icons/zoo.png +0 -0
- images/icons/zoom.png +0 -0
- include/class.gmshc_point.php +2 -2
- include/class.gmshc_post_points.php +4 -2
- include/functions.php +67 -35
- js/gmshc-admin.js +65 -18
- js/gmshc-render.js +0 -65
- js/gmshc.2.2.js +277 -0
- readme.txt +35 -26
- styles/gmshc-admin-styles.css +12 -5
google-map-shortcode.php
CHANGED
@@ -3,14 +3,15 @@
|
|
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.
|
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('
|
|
|
14 |
|
15 |
require(GMSC_PLUGIN_DIR."/include/functions.php");
|
16 |
require(GMSC_PLUGIN_DIR."/include/class.gmshc_point.php");
|
@@ -25,12 +26,19 @@ function get_gmshc_options ($default = false){
|
|
25 |
$gmshc_default = array(
|
26 |
'zoom' => '10',
|
27 |
'width' => '450',
|
28 |
-
'height' => '450',
|
|
|
|
|
29 |
'language' => 'en',
|
30 |
'windowhtml' => gmshc_defaul_windowhtml(),
|
31 |
'icons' => array(),
|
32 |
'default_icon' => GMSC_PLUGIN_URL.'/images/icons/marker.png',
|
33 |
-
'
|
|
|
|
|
|
|
|
|
|
|
34 |
);
|
35 |
|
36 |
|
@@ -41,7 +49,7 @@ function get_gmshc_options ($default = false){
|
|
41 |
|
42 |
$options = get_option('gmshc_op');
|
43 |
if (isset($options)){
|
44 |
-
if (isset($options['version'])) {
|
45 |
$chk_version = version_compare(GMSHC_VERSION_CHECK,$options['version']);
|
46 |
if ($chk_version == 0) return $options;
|
47 |
else if ($chk_version > 0) $options = $gmshc_default;
|
@@ -66,8 +74,8 @@ function gmshc_head() {
|
|
66 |
$gmshc_header .= "<script src=\"http://maps.google.com/maps/api/js?sensor=false";
|
67 |
if(isset($language))
|
68 |
$gmshc_header .= "&language=".$language;
|
69 |
-
$gmshc_header .="\" type=\"text/javascript\"></script>\n";
|
70 |
-
$gmshc_header .= "<script type=\"text/javascript\" src=\"".GMSC_PLUGIN_URL."/js/gmshc
|
71 |
$gmshc_header .= "\n<!-- /Google Map Shortcode Version ".$options['version']."-->\n";
|
72 |
|
73 |
print($gmshc_header);
|
@@ -76,6 +84,153 @@ function gmshc_head() {
|
|
76 |
|
77 |
add_action('wp_head', 'gmshc_head');
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
/**
|
80 |
* Google Map SC Editor Button
|
81 |
*/
|
@@ -115,9 +270,17 @@ function gmshc_tab_process(){
|
|
115 |
$add_point = isset($_REQUEST['add_point']) ? $_REQUEST['add_point'] : '';
|
116 |
$del_point = isset($_REQUEST['delp']) ? $_REQUEST['delp'] : '';
|
117 |
$update_point = isset($_REQUEST['update']) ? $_REQUEST['update'] : '';
|
|
|
118 |
$width = isset($_REQUEST['width']) ? $_REQUEST['width'] : $options['width'];
|
119 |
$height = isset($_REQUEST['height']) ? $_REQUEST['height'] : $options['height'];
|
120 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
$address_list = isset($_REQUEST['addr']) ? gmshc_stripslashes_deep($_REQUEST['addr']) : "";
|
123 |
$title_list = isset($_REQUEST['title']) ? gmshc_stripslashes_deep($_REQUEST['title']) : "";
|
@@ -131,7 +294,7 @@ function gmshc_tab_process(){
|
|
131 |
|
132 |
if (!empty($add_point)) {
|
133 |
$new_point = new GMSHC_Point();
|
134 |
-
if($new_point -> create_point($address,"",$title,$description,$icon,$selected_thumbnail,$post_id)){
|
135 |
$post_points -> add_point($new_point);
|
136 |
}
|
137 |
else
|
@@ -157,30 +320,23 @@ function gmshc_tab_process(){
|
|
157 |
<link href="<?php echo GMSC_PLUGIN_URL ?>/styles/gmshc-admin-styles.css" rel="stylesheet" type="text/css"/>
|
158 |
|
159 |
<div style="width:620px; margin:10px auto">
|
|
|
|
|
160 |
|
161 |
<form action="#" method="post">
|
162 |
-
<
|
163 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
<tr>
|
165 |
<td colspan="2">
|
166 |
-
<h3><?php _e("
|
167 |
-
</td>
|
168 |
-
</tr>
|
169 |
-
<tr>
|
170 |
-
<td align="right"><?php _e("Width"); ?></td>
|
171 |
-
<td valign="top"><input name="width" type="text" id="width" size="10" value = "<?php echo $width ?>"/></td>
|
172 |
-
</tr>
|
173 |
-
<tr>
|
174 |
-
<td align="right"><?php _e("Height"); ?></td>
|
175 |
-
<td valign="top"><input name="height" type="text" id="height" size="10" value = "<?php echo $height ?>" /></td>
|
176 |
-
</tr>
|
177 |
-
<tr>
|
178 |
-
<td align="right"><?php _e("Zoom"); ?></td>
|
179 |
-
<td valign="top"><input name="zoom" type="text" id="zoom" size="10" value = "<?php echo $zoom ?>" /></td>
|
180 |
-
</tr>
|
181 |
-
<tr>
|
182 |
-
<td colspan="2">
|
183 |
-
<h3><?php _e("Add New Point"); ?></h3>
|
184 |
</td>
|
185 |
</tr>
|
186 |
<tr>
|
@@ -219,7 +375,7 @@ function gmshc_tab_process(){
|
|
219 |
if (count($thumbnail_list) > 0) {
|
220 |
?>
|
221 |
<div class="gmshc_label">
|
222 |
-
|
223 |
</div>
|
224 |
<div id="gmshc_thumb_cont">
|
225 |
<input type="hidden" name="selected_thumbnail" value="<?php echo $default_icon ?>" id="selected_thumbnail" />
|
@@ -236,10 +392,88 @@ function gmshc_tab_process(){
|
|
236 |
<?php } ?>
|
237 |
<p align="left"><a class="button" href = "?post_id=<?php echo $post_id ?>&type=image" title="Upload Images"><?php _e("Upload Images") ?></a></p>
|
238 |
</td>
|
239 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
</table>
|
241 |
|
242 |
-
<p
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
|
244 |
<?php
|
245 |
if ( count($post_points -> points) > 0 ){
|
@@ -294,10 +528,10 @@ function gmshc_tab_process(){
|
|
294 |
</tbody>
|
295 |
</table>
|
296 |
|
297 |
-
<p><input class="button-primary" value="<?php _e("Insert Map"); ?>" type="button"
|
298 |
</div>
|
299 |
<div id="gmshc_map" style="height:1px; overflow:hidden;">
|
300 |
-
<?php echo do_shortcode("[google-map-sc id=".$post_id." width=600 height=420]"); ?>
|
301 |
</div>
|
302 |
<br />
|
303 |
<?php } ?>
|
@@ -307,136 +541,6 @@ function gmshc_tab_process(){
|
|
307 |
<?php
|
308 |
}
|
309 |
|
310 |
-
/**
|
311 |
-
* Default Open Window Html
|
312 |
-
*
|
313 |
-
* Allows a plugin to replace the html that would otherwise be returned. The
|
314 |
-
* filter is 'gmshc_get_windowhtml' and passes the point.
|
315 |
-
|
316 |
-
* add_filter('gmshc_defaul_windowhtml','default_html',1,2);
|
317 |
-
*
|
318 |
-
* function default_html($windowhtml,$point){
|
319 |
-
* return "this is the address".$point->address;
|
320 |
-
* }
|
321 |
-
*/
|
322 |
-
function gmshc_defaul_windowhtml(){
|
323 |
-
|
324 |
-
$defaul_gmshc_windowhtml = "";
|
325 |
-
$output = apply_filters('gmshc_defaul_windowhtml',$defaul_gmshc_windowhtml);
|
326 |
-
|
327 |
-
if ( $output != '' )
|
328 |
-
return $output;
|
329 |
-
|
330 |
-
$defaul_gmshc_windowhtml = "<div style='margin:0; padding:0px; height:125px; width:%width%; overflow:hidden; font-size:11px; clear:both; line-height:13px;'>\n";
|
331 |
-
$defaul_gmshc_windowhtml .= "<div style='float:left; width:200px'>\n";
|
332 |
-
$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";
|
333 |
-
$defaul_gmshc_windowhtml .= "<div><strong style='font-size:9px'>%address%</strong></div>\n";
|
334 |
-
$defaul_gmshc_windowhtml .= "<div style='font-size:10px'>%description%</div>\n";
|
335 |
-
$defaul_gmshc_windowhtml .= "<a href='%link%' style='font-size:11px; float:left; display:block'>more »</a>\n";
|
336 |
-
$defaul_gmshc_windowhtml .= "<img src='".GMSC_PLUGIN_URL."/images/open.jpg' style='float: right; margin-right:5px'/> \n";
|
337 |
-
$defaul_gmshc_windowhtml .= "<a href='%open_map%' target='_blank' style='font-size:11px; float: right; display:block;'>Open Map</a>\n";
|
338 |
-
$defaul_gmshc_windowhtml .= "</div>\n";
|
339 |
-
$defaul_gmshc_windowhtml .= "<div style='float:left'>%thubnail%</div>\n";
|
340 |
-
$defaul_gmshc_windowhtml .= "</div>\n";
|
341 |
-
|
342 |
-
return $defaul_gmshc_windowhtml;
|
343 |
-
|
344 |
-
}
|
345 |
-
|
346 |
-
/**
|
347 |
-
* The Sortcode
|
348 |
-
*/
|
349 |
-
|
350 |
-
add_shortcode('google-map-sc', 'gmshc_sc');
|
351 |
-
|
352 |
-
function gmshc_sc($atts) {
|
353 |
-
|
354 |
-
global $post;
|
355 |
-
$options = get_gmshc_options();
|
356 |
-
|
357 |
-
$width = $options['width'];
|
358 |
-
$height = $options['height'];
|
359 |
-
$zoom = $options['zoom'];
|
360 |
-
$icon = $options['default_icon'];
|
361 |
-
$language = $options['language'];
|
362 |
-
|
363 |
-
// First Point in the post
|
364 |
-
$address_meta = get_post_meta($post -> ID, 'google-map-sc-address');
|
365 |
-
$point_meta = get_post_meta($post -> ID, 'google-map-sc-latlng');
|
366 |
-
|
367 |
-
$the_address = isset($address_meta[0]) ? $address_meta[0] : '';
|
368 |
-
$point = isset($point_meta[0]) ? $point_meta[0] : '';
|
369 |
-
$the_items = array();
|
370 |
-
|
371 |
-
extract(shortcode_atts(array(
|
372 |
-
'address' => '',
|
373 |
-
'title' =>'',
|
374 |
-
'description' => '',
|
375 |
-
'icon' => $icon,
|
376 |
-
'thumbnail' => '',
|
377 |
-
'id' => '',
|
378 |
-
'cat' => '',
|
379 |
-
'zoom' => $zoom,
|
380 |
-
'width' => $width,
|
381 |
-
'height' => $height,
|
382 |
-
'language' => $language
|
383 |
-
), $atts));
|
384 |
-
|
385 |
-
$map_points = array();
|
386 |
-
|
387 |
-
// When address is set
|
388 |
-
if (!empty($address)) {
|
389 |
-
|
390 |
-
//create single point object id = -1
|
391 |
-
$new_point = new GMSHC_Point();
|
392 |
-
if($new_point -> create_point($address,"",$title,$description,$icon,$thumbnail,-1)) $map_points[0]=$new_point;
|
393 |
-
|
394 |
-
// When id is set
|
395 |
-
} else if (!empty($id)) {
|
396 |
-
$post_points = new GMSHC_Post_Map();
|
397 |
-
$post_points -> create_post_map($id);
|
398 |
-
if (count($post_points -> points) > 0) $map_points = $post_points->points;
|
399 |
-
|
400 |
-
} else if ($cat != '') {
|
401 |
-
|
402 |
-
$categories = split (",",$cat);
|
403 |
-
$j = 0;
|
404 |
-
|
405 |
-
$post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1));
|
406 |
-
foreach ($post_obj as $post_item) {
|
407 |
-
//create points object by cat
|
408 |
-
$post_points = new GMSHC_Post_Map();
|
409 |
-
$post_points -> create_post_map($post_item->ID);
|
410 |
-
if (count($post_points->points) >0) {
|
411 |
-
foreach ($post_points->points as $point) {
|
412 |
-
if (count($post_points -> points) > 0) array_push($map_points,$point);
|
413 |
-
}
|
414 |
-
}
|
415 |
-
}
|
416 |
-
|
417 |
-
} else {
|
418 |
-
|
419 |
-
//create points for the current post_id
|
420 |
-
|
421 |
-
$post_points = new GMSHC_Post_Map();
|
422 |
-
$post_points -> create_post_map($post->ID);
|
423 |
-
$map_points = $post_points->points;
|
424 |
-
|
425 |
-
}
|
426 |
-
|
427 |
-
//Map Point array filled
|
428 |
-
|
429 |
-
if ( count($map_points) > 0 ) {
|
430 |
-
|
431 |
-
//Generate Map form points, width, height, zoom
|
432 |
-
|
433 |
-
return gmshc_generate_map($map_points, $width, $height, $zoom);
|
434 |
-
}
|
435 |
-
else return __("There is not points to locate on the map");
|
436 |
-
}
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
/**
|
441 |
* Settings
|
442 |
*/
|
@@ -471,6 +575,8 @@ function gmshc_options_page() {
|
|
471 |
<div class="wrap">
|
472 |
|
473 |
<h2><?php _e("Google Map Shortcode Settings") ?></h2>
|
|
|
|
|
474 |
|
475 |
<?php
|
476 |
|
@@ -478,19 +584,28 @@ function gmshc_options_page() {
|
|
478 |
|
479 |
$newoptions['width'] = isset($_POST['width'])?$_POST['width']:$options['width'];
|
480 |
$newoptions['height'] = isset($_POST['height'])?$_POST['height']:$options['height'];
|
|
|
|
|
|
|
481 |
$newoptions['zoom'] = isset($_POST['zoom'])?$_POST['zoom']:$options['zoom'];
|
482 |
$newoptions['language'] = isset($_POST['language'])?$_POST['language']:$options['language'];
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
$newoptions['windowhtml'] = isset($_POST['windowhtml'])? $_POST['windowhtml']:$options['windowhtml'];
|
484 |
|
485 |
$newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
|
486 |
$newoptions['icons'] = $options['icons'];
|
487 |
|
488 |
-
$newoptions['version'] =
|
489 |
-
|
490 |
if ( $options != $newoptions ) {
|
491 |
$options = $newoptions;
|
492 |
update_option('gmshc_op', $options);
|
493 |
-
}
|
494 |
|
495 |
}
|
496 |
|
@@ -499,8 +614,8 @@ function gmshc_options_page() {
|
|
499 |
$options['windowhtml'] = gmshc_defaul_windowhtml();
|
500 |
update_option('gmshc_op', $options);
|
501 |
|
502 |
-
}
|
503 |
-
|
504 |
$upload_icons = $options['icons'];
|
505 |
|
506 |
if(isset($_POST['upload'])) {
|
@@ -526,72 +641,129 @@ function gmshc_options_page() {
|
|
526 |
|
527 |
$width = $options['width'];
|
528 |
$height = $options['height'];
|
|
|
|
|
|
|
529 |
$zoom = $options['zoom'];
|
530 |
$language = $options['language'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
$windowhtml = $options['windowhtml'];
|
532 |
$default_icon = $options['default_icon'];
|
533 |
-
|
534 |
?>
|
535 |
|
536 |
<form method="POST" name="options" target="_self" enctype="multipart/form-data">
|
537 |
|
538 |
-
<h3><?php _e("Maps
|
539 |
|
540 |
-
<p><?php _e("The shortcode attributes
|
541 |
|
542 |
-
<table width="80
|
543 |
<tr>
|
544 |
-
<td
|
545 |
-
</tr>
|
546 |
-
<tr>
|
547 |
-
<td width="60" align="right" height="40"><?php _e("Width") ?></td>
|
548 |
<td><input name="width" type="text" size="6" value="<?php echo $width ?>" /></td>
|
549 |
</tr>
|
550 |
<tr>
|
551 |
-
<td align="right"><?php _e("Height") ?></td>
|
552 |
<td><input name="height" type="text" size="6" value="<?php echo $height ?>" /></td>
|
553 |
</tr>
|
554 |
<tr>
|
555 |
-
<td align="right"><?php _e("
|
556 |
-
<td><input name="
|
557 |
</tr>
|
558 |
<tr>
|
559 |
-
<td
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
</td>
|
567 |
-
</tr>
|
568 |
<tr>
|
569 |
-
<td align="
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
|
|
|
|
|
|
574 |
<tr>
|
575 |
-
<td
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
<tr>
|
578 |
-
<td align="right" valign="top"><?php _e("Select")
|
579 |
-
</td>
|
580 |
<td>
|
581 |
<?php
|
582 |
$lang_array = array(
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
|
596 |
);
|
597 |
?>
|
@@ -601,7 +773,47 @@ function gmshc_options_page() {
|
|
601 |
<?php } ?>
|
602 |
</select>
|
603 |
</td>
|
604 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
605 |
</table>
|
606 |
|
607 |
<p class="submit">
|
@@ -610,50 +822,53 @@ function gmshc_options_page() {
|
|
610 |
|
611 |
<h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Info Windows") ?></h3>
|
612 |
|
613 |
-
<p><?php _e("This is the html
|
614 |
|
615 |
<div id="gmshc_html">
|
616 |
-
<textarea name="windowhtml" cols="50" rows="12" id="windowhtml">
|
617 |
-
<?php
|
618 |
-
if (empty($windowhtml)) echo gmshc_defaul_windowhtml();
|
619 |
-
else {
|
620 |
-
echo str_replace("\\", "",$windowhtml);
|
621 |
-
}
|
622 |
-
?>
|
623 |
-
</textarea>
|
624 |
<div id="gmshc_previews">
|
625 |
-
<strong><?php _e("Previews") ?></strong>
|
626 |
<div id="gmshc_html_previews">
|
627 |
<?php echo gmshc_defaul_windowhtml(); ?>
|
628 |
</div>
|
629 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
630 |
</div>
|
631 |
|
632 |
-
<p><?php _e("
|
633 |
-
<table width="80
|
634 |
<tr>
|
635 |
<td width="60" align="right"><strong>%title%</strong></td>
|
636 |
-
<td><?php _e("
|
637 |
</tr>
|
638 |
<tr>
|
639 |
<td align="right"><strong>%link%</strong></td>
|
640 |
-
<td><?php _e("
|
641 |
</tr>
|
642 |
<tr>
|
643 |
<td align="right"><strong>%thubnail%</strong></td>
|
644 |
-
<td><?php _e("
|
645 |
</tr>
|
646 |
<tr>
|
647 |
<td align="right"><strong>%description%</strong></td>
|
648 |
-
<td><?php _e("
|
649 |
</tr>
|
650 |
<tr>
|
651 |
<td align="right"><strong>%excerpt%</strong></td>
|
652 |
-
<td><?php _e("
|
653 |
</tr>
|
654 |
<tr>
|
655 |
<td align="right"><strong>%address%</strong></td>
|
656 |
-
<td><?php _e("The address of this point
|
657 |
</tr>
|
658 |
<tr>
|
659 |
<td align="right"><strong>%open_map%</strong></td>
|
@@ -666,26 +881,13 @@ function gmshc_options_page() {
|
|
666 |
</table>
|
667 |
|
668 |
|
669 |
-
<p class="submit">
|
670 |
-
<input type="submit" name="Submit" value="Update" class="button-primary" /><input type="submit" name="Use_Default" value="<?php _e("Restore Default Html") ?>"/>
|
671 |
-
</p>
|
672 |
-
|
673 |
-
<h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("How to Use") ?></h3>
|
674 |
-
<p><?php _e("You can include a Google Map Shortcode everywhere") ?></p>
|
675 |
-
|
676 |
-
<p><?php _e("In your post using: ") ?><strong>[google-map-sc option = "option value"]</strong></p>
|
677 |
-
<p><?php _e("In your theme files using: ") ?><strong> echo do_shortcode ('[google-map-sc option = "option value"]') </strong></p>
|
678 |
-
|
679 |
-
|
680 |
-
<h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Feedback") ?></h3>
|
681 |
-
|
682 |
-
<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>
|
683 |
-
|
684 |
-
|
685 |
<p class="submit">
|
686 |
<input type="submit" name="Submit" value="Update" class="button-primary" /><input type="submit" name="Restore_Default" value="<?php _e("Restore Default") ?>" class="button" />
|
687 |
</p>
|
688 |
</form>
|
|
|
|
|
|
|
689 |
</div>
|
690 |
|
691 |
|
@@ -701,5 +903,26 @@ return array_merge($tabs, $newtab);
|
|
701 |
|
702 |
add_filter('media_upload_tabs', 'gmshc_media_menu');
|
703 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
704 |
|
705 |
?>
|
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.2
|
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_CURRENT','2.2');
|
14 |
+
define('GMSHC_VERSION_CHECK','2.2');
|
15 |
|
16 |
require(GMSC_PLUGIN_DIR."/include/functions.php");
|
17 |
require(GMSC_PLUGIN_DIR."/include/class.gmshc_point.php");
|
26 |
$gmshc_default = array(
|
27 |
'zoom' => '10',
|
28 |
'width' => '450',
|
29 |
+
'height' => '450',
|
30 |
+
'margin' => '10',
|
31 |
+
'align' => 'center',
|
32 |
'language' => 'en',
|
33 |
'windowhtml' => gmshc_defaul_windowhtml(),
|
34 |
'icons' => array(),
|
35 |
'default_icon' => GMSC_PLUGIN_URL.'/images/icons/marker.png',
|
36 |
+
'interval' => 5000,
|
37 |
+
'focus' => '0',
|
38 |
+
'type' => 'ROADMAP',
|
39 |
+
'animate' => true,
|
40 |
+
'focus_type' => 'open',
|
41 |
+
'version' => GMSHC_VERSION_CURRENT
|
42 |
);
|
43 |
|
44 |
|
49 |
|
50 |
$options = get_option('gmshc_op');
|
51 |
if (isset($options)){
|
52 |
+
if (isset($options['version'])) {
|
53 |
$chk_version = version_compare(GMSHC_VERSION_CHECK,$options['version']);
|
54 |
if ($chk_version == 0) return $options;
|
55 |
else if ($chk_version > 0) $options = $gmshc_default;
|
74 |
$gmshc_header .= "<script src=\"http://maps.google.com/maps/api/js?sensor=false";
|
75 |
if(isset($language))
|
76 |
$gmshc_header .= "&language=".$language;
|
77 |
+
$gmshc_header .="\" type=\"text/javascript\"></script>\n";
|
78 |
+
$gmshc_header .= "<script type=\"text/javascript\" src=\"".GMSC_PLUGIN_URL."/js/gmshc.2.2.js\"></script>\n";
|
79 |
$gmshc_header .= "\n<!-- /Google Map Shortcode Version ".$options['version']."-->\n";
|
80 |
|
81 |
print($gmshc_header);
|
84 |
|
85 |
add_action('wp_head', 'gmshc_head');
|
86 |
|
87 |
+
/**
|
88 |
+
* Default Open Window Html
|
89 |
+
*
|
90 |
+
* Allows a plugin to replace the html that would otherwise be returned. The
|
91 |
+
* filter is 'gmshc_get_windowhtml' and passes the point.
|
92 |
+
|
93 |
+
* add_filter('gmshc_defaul_windowhtml','default_html',1,2);
|
94 |
+
*
|
95 |
+
* function default_html($windowhtml,$point){
|
96 |
+
* return "this is the address".$point->address;
|
97 |
+
* }
|
98 |
+
*/
|
99 |
+
function gmshc_defaul_windowhtml(){
|
100 |
+
|
101 |
+
$defaul_gmshc_windowhtml = "";
|
102 |
+
$output = apply_filters('gmshc_defaul_windowhtml',$defaul_gmshc_windowhtml);
|
103 |
+
|
104 |
+
if ( $output != '' )
|
105 |
+
return $output;
|
106 |
+
|
107 |
+
$defaul_gmshc_windowhtml = "<div style='margin:0; padding:0px; height:125px; width:%width%; overflow:hidden; font-size:11px; clear:both; line-height:13px;'>\n";
|
108 |
+
$defaul_gmshc_windowhtml .= "<div style='float:left; width:200px'>\n";
|
109 |
+
$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";
|
110 |
+
$defaul_gmshc_windowhtml .= "<div><strong style='font-size:9px'>%address%</strong></div>\n";
|
111 |
+
$defaul_gmshc_windowhtml .= "<div style='font-size:10px'>%description%</div>\n";
|
112 |
+
$defaul_gmshc_windowhtml .= "<a href='%link%' style='font-size:11px; float:left; display:block'>more »</a>\n";
|
113 |
+
$defaul_gmshc_windowhtml .= "<img src='".GMSC_PLUGIN_URL."/images/open.jpg' style='float: right; margin-right:5px'/> \n";
|
114 |
+
$defaul_gmshc_windowhtml .= "<a href='%open_map%' target='_blank' style='font-size:11px; float: right; display:block;'>Open Map</a>\n";
|
115 |
+
$defaul_gmshc_windowhtml .= "</div>\n";
|
116 |
+
$defaul_gmshc_windowhtml .= "<div style='float:left'><a title='%link%' href='%link%'>%thubnail%</div></a>\n";
|
117 |
+
$defaul_gmshc_windowhtml .= "</div>\n";
|
118 |
+
|
119 |
+
return $defaul_gmshc_windowhtml;
|
120 |
+
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* The Sortcode
|
125 |
+
*
|
126 |
+
*/
|
127 |
+
add_shortcode('google-map-sc', 'gmshc_sc');
|
128 |
+
|
129 |
+
function gmshc_sc($atts) {
|
130 |
+
|
131 |
+
global $post;
|
132 |
+
$options = get_gmshc_options();
|
133 |
+
|
134 |
+
$width = $options['width'];
|
135 |
+
$height = $options['height'];
|
136 |
+
$margin = $options['margin'];
|
137 |
+
$align = $options['align'];
|
138 |
+
|
139 |
+
$zoom = $options['zoom'];
|
140 |
+
$icon = $options['default_icon'];
|
141 |
+
$language = $options['language'];
|
142 |
+
$type = $options['type'];
|
143 |
+
$interval = $options['interval'];
|
144 |
+
$focus = $options['focus'];
|
145 |
+
$animate = $options['animate'];
|
146 |
+
$focus_type = $options['focus_type'];
|
147 |
+
|
148 |
+
// First Point in the post
|
149 |
+
$address_meta = get_post_meta($post -> ID, 'google-map-sc-address');
|
150 |
+
$point_meta = get_post_meta($post -> ID, 'google-map-sc-latlng');
|
151 |
+
|
152 |
+
$the_address = isset($address_meta[0]) ? $address_meta[0] : '';
|
153 |
+
$point = isset($point_meta[0]) ? $point_meta[0] : '';
|
154 |
+
$the_items = array();
|
155 |
+
|
156 |
+
$final_atts = shortcode_atts(array(
|
157 |
+
'address' => '',
|
158 |
+
'title' =>'',
|
159 |
+
'description' => '',
|
160 |
+
'icon' => $icon,
|
161 |
+
'thumbnail' => '',
|
162 |
+
'id' => '',
|
163 |
+
'cat' => '',
|
164 |
+
'zoom' => $zoom,
|
165 |
+
'width' => $width,
|
166 |
+
'height' => $height,
|
167 |
+
'margin' => $margin,
|
168 |
+
'align' => $align,
|
169 |
+
'language' => $language,
|
170 |
+
'type' => $type,
|
171 |
+
'interval' => $interval,
|
172 |
+
'focus' => $focus,
|
173 |
+
'animate' => $animate,
|
174 |
+
'focus_type' => $focus_type,
|
175 |
+
'canvas' => ''
|
176 |
+
), $atts);
|
177 |
+
extract($final_atts);
|
178 |
+
|
179 |
+
$map_points = array();
|
180 |
+
|
181 |
+
// When address is set
|
182 |
+
if (!empty($address)) {
|
183 |
+
|
184 |
+
//create single point object id = -1
|
185 |
+
$new_point = new GMSHC_Point();
|
186 |
+
if($new_point -> create_point($address,"",$title,$description,$icon,$thumbnail,-1,true)) $map_points[0]=$new_point;
|
187 |
+
|
188 |
+
// When id is set
|
189 |
+
} else if (!empty($id)) {
|
190 |
+
$post_points = new GMSHC_Post_Map();
|
191 |
+
$post_points -> create_post_map($id);
|
192 |
+
if ($post_points->points_number > 0) $map_points = $post_points->points;
|
193 |
+
|
194 |
+
} else if ($cat != '') {
|
195 |
+
|
196 |
+
$categories = split (",",$cat);
|
197 |
+
$j = 0;
|
198 |
+
|
199 |
+
$post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1));
|
200 |
+
foreach ($post_obj as $post_item) {
|
201 |
+
//create points object by cat
|
202 |
+
$post_points = new GMSHC_Post_Map();
|
203 |
+
|
204 |
+
$post_points -> create_post_map($post_item->ID);
|
205 |
+
if ($post_points->points_number >0) {
|
206 |
+
foreach ($post_points->points as $point) {
|
207 |
+
array_push($map_points,$point);
|
208 |
+
}
|
209 |
+
}
|
210 |
+
}
|
211 |
+
|
212 |
+
} else {
|
213 |
+
|
214 |
+
//create points for the current post_id
|
215 |
+
$post_points = new GMSHC_Post_Map();
|
216 |
+
$post_points -> create_post_map($post->ID);
|
217 |
+
$map_points = $post_points->points;
|
218 |
+
|
219 |
+
}
|
220 |
+
|
221 |
+
//Map Point array filled
|
222 |
+
if ( count($map_points) > 0 ) {
|
223 |
+
|
224 |
+
//Generate Map form points
|
225 |
+
$output = gmshc_generate_map($map_points, $final_atts);
|
226 |
+
} else {
|
227 |
+
$output = __("There is not points to locate on the map");
|
228 |
+
}
|
229 |
+
|
230 |
+
return $output;
|
231 |
+
}
|
232 |
+
|
233 |
+
|
234 |
/**
|
235 |
* Google Map SC Editor Button
|
236 |
*/
|
270 |
$add_point = isset($_REQUEST['add_point']) ? $_REQUEST['add_point'] : '';
|
271 |
$del_point = isset($_REQUEST['delp']) ? $_REQUEST['delp'] : '';
|
272 |
$update_point = isset($_REQUEST['update']) ? $_REQUEST['update'] : '';
|
273 |
+
|
274 |
$width = isset($_REQUEST['width']) ? $_REQUEST['width'] : $options['width'];
|
275 |
$height = isset($_REQUEST['height']) ? $_REQUEST['height'] : $options['height'];
|
276 |
+
$margin = isset($_REQUEST['margin']) ? $_REQUEST['margin'] : $options['margin'];
|
277 |
+
$align = isset($_REQUEST['align']) ? $_REQUEST['align'] : $options['align'];
|
278 |
+
|
279 |
+
$zoom = isset($_REQUEST['zoom']) ? $_REQUEST['zoom'] : $options['zoom'];
|
280 |
+
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : $options['type'];
|
281 |
+
|
282 |
+
$focus = isset($_REQUEST['focus']) ? $_REQUEST['focus'] : $options['focus'];
|
283 |
+
$focus_type = isset($_REQUEST['focus_type']) ? $_REQUEST['focus_type'] : $options['focus_type'];
|
284 |
|
285 |
$address_list = isset($_REQUEST['addr']) ? gmshc_stripslashes_deep($_REQUEST['addr']) : "";
|
286 |
$title_list = isset($_REQUEST['title']) ? gmshc_stripslashes_deep($_REQUEST['title']) : "";
|
294 |
|
295 |
if (!empty($add_point)) {
|
296 |
$new_point = new GMSHC_Point();
|
297 |
+
if($new_point -> create_point($address,"",$title,$description,$icon,$selected_thumbnail,$post_id,true)){
|
298 |
$post_points -> add_point($new_point);
|
299 |
}
|
300 |
else
|
320 |
<link href="<?php echo GMSC_PLUGIN_URL ?>/styles/gmshc-admin-styles.css" rel="stylesheet" type="text/css"/>
|
321 |
|
322 |
<div style="width:620px; margin:10px auto">
|
323 |
+
|
324 |
+
<?php echo gmshc_plugin_menu(); ?>
|
325 |
|
326 |
<form action="#" method="post">
|
327 |
+
<input id="default_width" type="hidden" value="<?php echo $width ?>"/>
|
328 |
+
<input id="default_height" type="hidden" value="<?php echo $height ?>"/>
|
329 |
+
<input id="default_margin" type="hidden" value="<?php echo $margin ?>"/>
|
330 |
+
<input id="default_align" type="hidden" value="<?php echo $align ?>"/>
|
331 |
+
<input id="default_zoom" type="hidden" value="<?php echo $zoom ?>"/>
|
332 |
+
<input id="default_focus" type="hidden" value="<?php echo $focus ?>"/>
|
333 |
+
<input id="default_focus_type" type="hidden" value="<?php echo $focus_type ?>"/>
|
334 |
+
<input id="default_type" type="hidden" value="<?php echo $type ?>"/>
|
335 |
+
|
336 |
+
<table width="620" border="0" cellspacing="5" cellpadding="5">
|
337 |
<tr>
|
338 |
<td colspan="2">
|
339 |
+
<h3 class="gmshc_editor"><?php _e("Add New Point"); ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
</td>
|
341 |
</tr>
|
342 |
<tr>
|
375 |
if (count($thumbnail_list) > 0) {
|
376 |
?>
|
377 |
<div class="gmshc_label">
|
378 |
+
<?php _e("Select the thumbnail by clicking on the images"); ?>
|
379 |
</div>
|
380 |
<div id="gmshc_thumb_cont">
|
381 |
<input type="hidden" name="selected_thumbnail" value="<?php echo $default_icon ?>" id="selected_thumbnail" />
|
392 |
<?php } ?>
|
393 |
<p align="left"><a class="button" href = "?post_id=<?php echo $post_id ?>&type=image" title="Upload Images"><?php _e("Upload Images") ?></a></p>
|
394 |
</td>
|
395 |
+
</tr>
|
396 |
+
<?php if ($post_points->points_number > 0) { ?>
|
397 |
+
<tr>
|
398 |
+
<td colspan="2">
|
399 |
+
<h3 class="gmshc_editor"><?php _e("Map Configuration"); ?></h3>
|
400 |
+
</td>
|
401 |
+
</tr>
|
402 |
+
<tr>
|
403 |
+
<td align="right"><?php _e("Width"); ?></td>
|
404 |
+
<td valign="top"><input name="width" type="text" id="width" size="10" value = "<?php echo $width ?>"/></td>
|
405 |
+
</tr>
|
406 |
+
<tr>
|
407 |
+
<td align="right"><?php _e("Height"); ?></td>
|
408 |
+
<td valign="top"><input name="height" type="text" id="height" size="10" value = "<?php echo $height ?>" /></td>
|
409 |
+
</tr>
|
410 |
+
<tr>
|
411 |
+
<td align="right"><strong><?php _e("Margin") ?></strong></td>
|
412 |
+
<td><input name="margin" id="margin" type="text" size="6" value="<?php echo $margin ?>" /></td>
|
413 |
+
</tr>
|
414 |
+
<tr>
|
415 |
+
<td align="right"><strong><?php _e("Align") ?></strong></td>
|
416 |
+
<td>
|
417 |
+
<input name="align" type="radio" id="aleft" value="left" <?php echo ($align == "left" ? "checked = 'checked'" : "") ?> /> <?php _e("left") ?>
|
418 |
+
<input name="align" type="radio" id="acenter" value="center" <?php echo ($align == "center" ? "checked = 'checked'" : "") ?> /> <?php _e("center") ?>
|
419 |
+
<input name="align" type="radio" id="aright" value="right" <?php echo ($align == "right" ? "checked = 'checked'" : "") ?> /> <?php _e("right") ?>
|
420 |
+
</tr>
|
421 |
+
<tr>
|
422 |
+
<td align="right"><?php _e("Zoom") ?></td>
|
423 |
+
<td>
|
424 |
+
<select name="zoom" id="zoom">
|
425 |
+
<?php for ($i = 0; $i <= 20; $i ++){ ?>
|
426 |
+
<option value="<?php echo $i ?>" <?php echo ($i == $zoom ? "selected" : "") ?> ><?php echo $i ?></option>
|
427 |
+
<?php } ?>
|
428 |
+
</select>
|
429 |
+
</tr>
|
430 |
+
<tr>
|
431 |
+
<td align="right"><?php _e("Maps Type") ?></td>
|
432 |
+
<td>
|
433 |
+
<select name="type" id="type">
|
434 |
+
<option value="ROADMAP" <?php if ($type == "ROADMAP") echo "selected" ?>><?php _e("ROADMAP - Displays a normal street map") ?></option>
|
435 |
+
<option value="SATELLITE" <?php if ($type == "SATELLITE") echo "selected" ?>><?php _e("SATELLITE - Displays satellite images") ?></option>
|
436 |
+
<option value="TERRAIN" <?php if ($type == "TERRAIN") echo "selected" ?>><?php _e("TERRAIN - Displays maps with physical features such as terrain and vegetation") ?></option>
|
437 |
+
<option value="HYBRID" <?php if ($type == "HYBRID") echo "selected" ?>><?php _e("HYBRID - Displays a transparent layer of major streets on satellite images") ?></option>
|
438 |
+
</select>
|
439 |
+
</td>
|
440 |
+
</tr>
|
441 |
+
<tr>
|
442 |
+
<td align="right"><?php _e("Focus") ?></td>
|
443 |
+
<td>
|
444 |
+
<select name="focus" id="focus">
|
445 |
+
<option value="0" <?php if ($focus == 0) echo "selected" ?>><?php _e("None") ?></option>
|
446 |
+
<?php if ($post_points->points_number > 1) { ?>
|
447 |
+
<option value="all" <?php if ($focus == "all") echo "selected" ?>><?php _e("All") ?></option>
|
448 |
+
<?php } ?>
|
449 |
+
<?php for ($i = 1; $i <= $post_points->points_number; $i ++){ ?>
|
450 |
+
<?php $number = $i; ?>
|
451 |
+
<option value="<?php echo $number ?>" <?php if ($focus == $number) echo "selected" ?>><?php echo $number ?></option>
|
452 |
+
<?php } ?>
|
453 |
+
</select>
|
454 |
+
<em><?php _e("Select the point to be focused after loading the map") ?></em>
|
455 |
+
</td>
|
456 |
+
</tr>
|
457 |
+
<tr>
|
458 |
+
<td align="right" valign="top"><?php _e("Focus Type") ?></td>
|
459 |
+
<td>
|
460 |
+
<select name="focus_type" id="focus_type">
|
461 |
+
<option value="open" <?php echo ($focus_type == "open" ? "selected" : "") ?> ><?php _e("Open Markers") ?></option>
|
462 |
+
<option value="center" <?php echo ($focus_type == "center" ? "selected" : "") ?> ><?php _e("Center Markers") ?></option>
|
463 |
+
</select>
|
464 |
+
</td>
|
465 |
+
</tr>
|
466 |
+
<?php } ?>
|
467 |
</table>
|
468 |
|
469 |
+
<p>
|
470 |
+
<input class="button-primary" value="<?php _e("Add Point") ?>" name="add_point" type="submit">
|
471 |
+
<?php if ($post_points->points_number > 0) { ?>
|
472 |
+
<input class="button-primary insert_map" value="<?php _e('Insert Map'); ?>" type="button" \>
|
473 |
+
<?php echo $post_points->points_number.__(" Points Added") ?>
|
474 |
+
<?php } ?>
|
475 |
+
|
476 |
+
</p>
|
477 |
|
478 |
<?php
|
479 |
if ( count($post_points -> points) > 0 ){
|
528 |
</tbody>
|
529 |
</table>
|
530 |
|
531 |
+
<p><input class="button-primary insert_map" value="<?php _e("Insert Map"); ?>" type="button" \> <a class="button" href="#gmshc_map" id="gmshc_show" show="<?php _e("Show Map") ?>" hide="<?php _e("Hide Map") ?>"><?php _e("Show Map") ?></a></p>
|
532 |
</div>
|
533 |
<div id="gmshc_map" style="height:1px; overflow:hidden;">
|
534 |
+
<?php echo do_shortcode("[google-map-sc id=".$post_id." width=600 height=420 type=".$type." focus=".$focus."]"); ?>
|
535 |
</div>
|
536 |
<br />
|
537 |
<?php } ?>
|
541 |
<?php
|
542 |
}
|
543 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
/**
|
545 |
* Settings
|
546 |
*/
|
575 |
<div class="wrap">
|
576 |
|
577 |
<h2><?php _e("Google Map Shortcode Settings") ?></h2>
|
578 |
+
|
579 |
+
<?php echo gmshc_plugin_menu(); ?>
|
580 |
|
581 |
<?php
|
582 |
|
584 |
|
585 |
$newoptions['width'] = isset($_POST['width'])?$_POST['width']:$options['width'];
|
586 |
$newoptions['height'] = isset($_POST['height'])?$_POST['height']:$options['height'];
|
587 |
+
$newoptions['margin'] = isset($_POST['margin'])?$_POST['margin']:$options['margin'];
|
588 |
+
$newoptions['align'] = isset($_POST['align'])?$_POST['align']:$options['align'];
|
589 |
+
|
590 |
$newoptions['zoom'] = isset($_POST['zoom'])?$_POST['zoom']:$options['zoom'];
|
591 |
$newoptions['language'] = isset($_POST['language'])?$_POST['language']:$options['language'];
|
592 |
+
$newoptions['type'] = isset($_POST['type'])?$_POST['type']:$options['type'];
|
593 |
+
$newoptions['interval'] = isset($_POST['interval'])?$_POST['interval']:$options['interval'];
|
594 |
+
$newoptions['focus'] = isset($_POST['focus'])?$_POST['focus']:"0";
|
595 |
+
$newoptions['animate'] = isset($_POST['animate'])?$_POST['animate']:false;
|
596 |
+
$newoptions['focus_type'] = isset($_POST['focus_type'])?$_POST['focus_type']:"open";
|
597 |
+
|
598 |
$newoptions['windowhtml'] = isset($_POST['windowhtml'])? $_POST['windowhtml']:$options['windowhtml'];
|
599 |
|
600 |
$newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
|
601 |
$newoptions['icons'] = $options['icons'];
|
602 |
|
603 |
+
$newoptions['version'] = $options['version'];
|
604 |
+
|
605 |
if ( $options != $newoptions ) {
|
606 |
$options = $newoptions;
|
607 |
update_option('gmshc_op', $options);
|
608 |
+
}
|
609 |
|
610 |
}
|
611 |
|
614 |
$options['windowhtml'] = gmshc_defaul_windowhtml();
|
615 |
update_option('gmshc_op', $options);
|
616 |
|
617 |
+
}
|
618 |
+
|
619 |
$upload_icons = $options['icons'];
|
620 |
|
621 |
if(isset($_POST['upload'])) {
|
641 |
|
642 |
$width = $options['width'];
|
643 |
$height = $options['height'];
|
644 |
+
$margin = $options['margin'];
|
645 |
+
$align = $options['align'];
|
646 |
+
|
647 |
$zoom = $options['zoom'];
|
648 |
$language = $options['language'];
|
649 |
+
$type = $options['type'];
|
650 |
+
|
651 |
+
$interval = $options['interval'];
|
652 |
+
$focus = $options['focus'];
|
653 |
+
$animate = $options['animate'];
|
654 |
+
$focus_type = $options['focus_type'];
|
655 |
+
|
656 |
$windowhtml = $options['windowhtml'];
|
657 |
$default_icon = $options['default_icon'];
|
658 |
+
|
659 |
?>
|
660 |
|
661 |
<form method="POST" name="options" target="_self" enctype="multipart/form-data">
|
662 |
|
663 |
+
<h3><?php _e("Maps Default Configuration") ?></h3>
|
664 |
|
665 |
+
<p><?php _e("The shortcode attributes overwrites these options.") ?></p>
|
666 |
|
667 |
+
<table width="80%" border="0" cellspacing="10" cellpadding="0">
|
668 |
<tr>
|
669 |
+
<td width="200" align="right" height="40"><strong><?php _e("Width") ?></strong></td>
|
|
|
|
|
|
|
670 |
<td><input name="width" type="text" size="6" value="<?php echo $width ?>" /></td>
|
671 |
</tr>
|
672 |
<tr>
|
673 |
+
<td align="right"><strong><?php _e("Height") ?></strong></td>
|
674 |
<td><input name="height" type="text" size="6" value="<?php echo $height ?>" /></td>
|
675 |
</tr>
|
676 |
<tr>
|
677 |
+
<td align="right"><strong><?php _e("Margin") ?></strong></td>
|
678 |
+
<td><input name="margin" type="text" size="6" value="<?php echo $margin ?>" /></td>
|
679 |
</tr>
|
680 |
<tr>
|
681 |
+
<td align="right"><strong><?php _e("Align") ?></strong></td>
|
682 |
+
<td>
|
683 |
+
<input name="align" type="radio" value="left" <?php echo ($align == "left" ? "checked = 'checked'" : "") ?> /> <?php _e("left") ?>
|
684 |
+
<input name="align" type="radio" value="center" <?php echo ($align == "center" ? "checked = 'checked'" : "") ?> /> <?php _e("center") ?>
|
685 |
+
<input name="align" type="radio" value="right" <?php echo ($align == "right" ? "checked = 'checked'" : "") ?> /> <?php _e("right") ?>
|
686 |
+
</tr>
|
|
|
|
|
|
|
687 |
<tr>
|
688 |
+
<td align="right"><strong><?php _e("Zoom") ?></strong></td>
|
689 |
+
<td>
|
690 |
+
<select name="zoom" id="zoom">
|
691 |
+
<?php for ($i = 0; $i <= 20; $i ++){ ?>
|
692 |
+
<option value="<?php echo $i ?>" <?php echo ($i == $zoom ? "selected" : "") ?> ><?php echo $i ?></option>
|
693 |
+
<?php } ?>
|
694 |
+
</select>
|
695 |
+
</tr>
|
696 |
<tr>
|
697 |
+
<td align="right"><strong><?php _e("Maps Default Type") ?></strong></td>
|
698 |
+
<td>
|
699 |
+
<select name="type">
|
700 |
+
<option value="ROADMAP" <?php if ($type == "ROADMAP") echo "selected" ?>><?php _e("ROADMAP - Displays a normal street map") ?></option>
|
701 |
+
<option value="SATELLITE" <?php if ($type == "SATELLITE") echo "selected" ?>><?php _e("SATELLITE - Displays satellite images") ?></option>
|
702 |
+
<option value="TERRAIN" <?php if ($type == "TERRAIN") echo "selected" ?>><?php _e("TERRAIN - Displays maps with physical features such as terrain and vegetation") ?></option>
|
703 |
+
<option value="HYBRID" <?php if ($type == "HYBRID") echo "selected" ?>><?php _e("HYBRID - Displays a transparent layer of major streets on satellite images") ?></option>
|
704 |
+
</select>
|
705 |
+
</td>
|
706 |
+
</tr>
|
707 |
<tr>
|
708 |
+
<td align="right" valign="top"><strong><?php _e("Select Language") ?></strong></td>
|
|
|
709 |
<td>
|
710 |
<?php
|
711 |
$lang_array = array(
|
712 |
+
"ar"=>__("ARABIC"),
|
713 |
+
"eu"=>__("BASQUE"),
|
714 |
+
"bg"=>__("BULGARIAN"),
|
715 |
+
"bn"=>__("BENGALI"),
|
716 |
+
"ca"=>__("CATALAN"),
|
717 |
+
"cs"=>__("CZECH"),
|
718 |
+
"da"=>__("DANISH"),
|
719 |
+
"de"=>__("GERMAN"),
|
720 |
+
"el"=>__("GREEK"),
|
721 |
+
"en"=>__("ENGLISH"),
|
722 |
+
"en-AU"=>__("ENGLISH (AUSTRALIAN)"),
|
723 |
+
"en-GB"=>__("ENGLISH (GREAT BRITAIN)"),
|
724 |
+
"es"=>__("SPANISH"),
|
725 |
+
"eu"=>__("BASQUE"),
|
726 |
+
"fa"=>__("FARSI"),
|
727 |
+
"fi"=>__("FINNISH"),
|
728 |
+
"fil"=>__("FILIPINO"),
|
729 |
+
"fr"=>__("FRENCH"),
|
730 |
+
"gl"=>__("GALICIAN"),
|
731 |
+
"gu"=>__("GUJARATI"),
|
732 |
+
"hi"=>__("HINDI"),
|
733 |
+
"hr"=>__("CROATIAN"),
|
734 |
+
"hu"=>__("HUNGARIAN"),
|
735 |
+
"id"=>__("INDONESIAN"),
|
736 |
+
"it"=>__("ITALIAN"),
|
737 |
+
"iw"=>__("HEBREW"),
|
738 |
+
"ja"=>__("JAPANESE"),
|
739 |
+
"kn"=>__("KANNADA"),
|
740 |
+
"ko"=>__("KOREAN"),
|
741 |
+
"lt"=>__("LITHUANIAN"),
|
742 |
+
"lv"=>__("LATVIAN"),
|
743 |
+
"ml"=>__("MALAYALAM"),
|
744 |
+
"mr"=>__("MARATHI"),
|
745 |
+
"nl"=>__("DUTCH"),
|
746 |
+
"no"=>__("NORWEGIAN"),
|
747 |
+
"or"=>__("ORIYA"),
|
748 |
+
"pl"=>__("POLISH"),
|
749 |
+
"pt"=>__("PORTUGUESE"),
|
750 |
+
"pt-BR"=>__("PORTUGUESE (BRAZIL)"),
|
751 |
+
"pt-PT"=>__("PORTUGUESE (PORTUGAL)"),
|
752 |
+
"ro"=>__("ROMANIAN"),
|
753 |
+
"ru"=>__("RUSSIAN"),
|
754 |
+
"sk"=>__("SLOVAK"),
|
755 |
+
"sl"=>__("SLOVENIAN"),
|
756 |
+
"sr"=>__("SERBIAN"),
|
757 |
+
"sv"=>__("SWEDISH"),
|
758 |
+
"tl"=>__("TAGALOG"),
|
759 |
+
"ta"=>__("TAMIL"),
|
760 |
+
"te"=>__("TELUGU"),
|
761 |
+
"th"=>__("THAI"),
|
762 |
+
"tr"=>__("TURKISH"),
|
763 |
+
"uk"=>__("UKRAINIAN"),
|
764 |
+
"vi"=>__("VIETNAMESE"),
|
765 |
+
"zh-CN"=>__("CHINESE (SIMPLIFIED)"),
|
766 |
+
"zh-TW"=>__("CHINESE (TRADITIONAL)")
|
767 |
|
768 |
);
|
769 |
?>
|
773 |
<?php } ?>
|
774 |
</select>
|
775 |
</td>
|
776 |
+
</tr>
|
777 |
+
<tr>
|
778 |
+
<td align="right" valign="top"><strong><?php _e("Circle") ?></strong></td>
|
779 |
+
|
780 |
+
<td><input name="focus" type="checkbox" value="all" <?php if ($focus == "all") echo "checked = \"checked\"" ?> /> <?php _e(" Check if you want to focus all the map's points automatically with an interval of <br /><br />") ?><input name="interval" type="text" size="6" value="<?php echo $interval ?>" /> <?php _e("milliseconds.") ?></td>
|
781 |
+
</tr>
|
782 |
+
<tr>
|
783 |
+
<td align="right" valign="top"> <strong><?php _e("Focus Type") ?></strong></td>
|
784 |
+
<td>
|
785 |
+
<select name="focus_type" id="focus_type">
|
786 |
+
<option value="open" <?php echo ($focus_type == "open" ? "selected" : "") ?> ><?php _e("Open Markers") ?></option>
|
787 |
+
<option value="center" <?php echo ($focus_type == "center" ? "selected" : "") ?> ><?php _e("Center Markers") ?></option>
|
788 |
+
</select>
|
789 |
+
</td>
|
790 |
+
</tr>
|
791 |
+
<tr>
|
792 |
+
<td align="right" valign="top"> <strong><?php _e("Animation") ?></strong></td>
|
793 |
+
<td><input name="animate" type="checkbox" value="true" <?php if ($animate) echo "checked = \"checked\"" ?> /> <?php _e(" Check if you want to animate the markes.") ?></td>
|
794 |
+
</tr>
|
795 |
+
</table>
|
796 |
+
|
797 |
+
<p class="submit">
|
798 |
+
<input type="submit" name="Submit" value="Update" class="button-primary" />
|
799 |
+
</p>
|
800 |
+
|
801 |
+
<h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Markers") ?></h3>
|
802 |
+
|
803 |
+
<table width="80%" border="0" cellspacing="10" cellpadding="0">
|
804 |
+
<tr>
|
805 |
+
<td align="right" valign="top" colspan="2">
|
806 |
+
|
807 |
+
<?php gmshc_deploy_icons(); ?>
|
808 |
+
|
809 |
+
</td>
|
810 |
+
</tr>
|
811 |
+
<tr>
|
812 |
+
<td align="left" valign="top" colspan="2">
|
813 |
+
<?php _e("To include new icons just specify the file location:") ?><br />
|
814 |
+
<input type="file" name="datafile" size="40" /> <input type="submit" name="upload" value="Upload" class="button" />
|
815 |
+
</td>
|
816 |
+
</tr>
|
817 |
</table>
|
818 |
|
819 |
<p class="submit">
|
822 |
|
823 |
<h3 style="padding-top:30px; margin-top:30px; border-top:1px solid #CCCCCC;"><?php _e("Info Windows") ?></h3>
|
824 |
|
825 |
+
<p><?php _e("This is the html of the Info Window opened from the markers.") ?></p>
|
826 |
|
827 |
<div id="gmshc_html">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
828 |
<div id="gmshc_previews">
|
829 |
+
<p><strong><?php _e("Previews") ?></strong></p>
|
830 |
<div id="gmshc_html_previews">
|
831 |
<?php echo gmshc_defaul_windowhtml(); ?>
|
832 |
</div>
|
833 |
</div>
|
834 |
+
<div id="gmshc_html_cont">
|
835 |
+
<p><strong><?php _e("Custom Html") ?></strong></p>
|
836 |
+
<textarea name="windowhtml" cols="60" rows="12" id="windowhtml">
|
837 |
+
<?php
|
838 |
+
if (empty($windowhtml)) echo gmshc_defaul_windowhtml();
|
839 |
+
else {
|
840 |
+
echo str_replace("\\", "",$windowhtml);
|
841 |
+
}
|
842 |
+
?>
|
843 |
+
</textarea>
|
844 |
+
</div>
|
845 |
</div>
|
846 |
|
847 |
+
<p><?php _e("The following tags can be used.") ?></p>
|
848 |
+
<table width="80%" border="0" cellspacing="10" cellpadding="0">
|
849 |
<tr>
|
850 |
<td width="60" align="right"><strong>%title%</strong></td>
|
851 |
+
<td><?php _e("Custom title of the point") ?></td>
|
852 |
</tr>
|
853 |
<tr>
|
854 |
<td align="right"><strong>%link%</strong></td>
|
855 |
+
<td><?php _e("Permanet Link of the post where the point is attached") ?></td>
|
856 |
</tr>
|
857 |
<tr>
|
858 |
<td align="right"><strong>%thubnail%</strong></td>
|
859 |
+
<td><?php _e("Thubnail attached to the point") ?></td>
|
860 |
</tr>
|
861 |
<tr>
|
862 |
<td align="right"><strong>%description%</strong></td>
|
863 |
+
<td><?php _e("Description of the point") ?></td>
|
864 |
</tr>
|
865 |
<tr>
|
866 |
<td align="right"><strong>%excerpt%</strong></td>
|
867 |
+
<td><?php _e("Excerpt of the post where the point is attached") ?></td>
|
868 |
</tr>
|
869 |
<tr>
|
870 |
<td align="right"><strong>%address%</strong></td>
|
871 |
+
<td><?php _e("The address of this point") ?></td>
|
872 |
</tr>
|
873 |
<tr>
|
874 |
<td align="right"><strong>%open_map%</strong></td>
|
881 |
</table>
|
882 |
|
883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
<p class="submit">
|
885 |
<input type="submit" name="Submit" value="Update" class="button-primary" /><input type="submit" name="Restore_Default" value="<?php _e("Restore Default") ?>" class="button" />
|
886 |
</p>
|
887 |
</form>
|
888 |
+
|
889 |
+
<?php echo gmshc_plugin_menu(); ?>
|
890 |
+
|
891 |
</div>
|
892 |
|
893 |
|
903 |
|
904 |
add_filter('media_upload_tabs', 'gmshc_media_menu');
|
905 |
|
906 |
+
function gmshc_plugin_menu(){
|
907 |
+
|
908 |
+
$links_arr = array(
|
909 |
+
array("text"=>__("Plugin Page"),"url"=>"http://web-argument.com/google-map-shortcode-wordpress-plugin/"),
|
910 |
+
array("text"=>__("How To Use"),"url"=>"http://web-argument.com/google-map-shortcode-how-to-use/"),
|
911 |
+
array("text"=>__("Shortcode Reference"),"url"=>"http://web-argument.com/google-map-shortcode-reference/"),
|
912 |
+
array("text"=>__("Examples"),"url"=>"http://web-argument.com/google-map-shortcode-wordpress-plugin/#examples"),
|
913 |
+
array("text"=>__("Donate"),"url"=>"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=support%40web%2dargument%2ecom&lc=US&item_name=Web%2dArgument%2ecom¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted")
|
914 |
+
);
|
915 |
+
|
916 |
+
$output = "<p align='center' style='font-size:14px;'>";
|
917 |
+
|
918 |
+
foreach ($links_arr as $link){
|
919 |
+
$output .= "<a href=".$link['url']." target='_blank'>".$link['text']."</a> ";
|
920 |
+
}
|
921 |
+
|
922 |
+
$output .= "</p>";
|
923 |
+
|
924 |
+
return $output;
|
925 |
+
|
926 |
+
}
|
927 |
|
928 |
?>
|
images/icons/apple.png
ADDED
Binary file
|
images/icons/bar.png
ADDED
Binary file
|
images/icons/beautifulview.png
ADDED
Binary file
|
images/icons/castle-2.png
ADDED
Binary file
|
images/icons/chicken.png
ADDED
Binary file
|
images/icons/cinema.png
ADDED
Binary file
|
images/icons/coffee.png
ADDED
Binary file
|
images/icons/cruiseship.png
ADDED
Binary file
|
images/icons/deer.png
ADDED
Binary file
|
images/icons/dogs_leash.png
ADDED
Binary file
|
images/icons/field.png
ADDED
Binary file
|
images/icons/hiking.png
ADDED
Binary file
|
images/icons/hotel_0star.png
ADDED
Binary file
|
images/icons/iceskating.png
ADDED
Binary file
|
images/icons/information.png
ADDED
Binary file
|
images/icons/jazzclub.png
ADDED
Binary file
|
images/icons/love_date.png
ADDED
Binary file
|
images/icons/notvisited.png
ADDED
Binary file
|
images/icons/nursery.png
ADDED
Binary file
|
images/icons/peace.png
ADDED
Binary file
|
images/icons/pin.png
ADDED
Binary file
|
images/icons/playground.png
ADDED
Binary file
|
images/icons/snowy.png
ADDED
Binary file
|
images/icons/sunny.png
ADDED
Binary file
|
images/icons/teahouse.png
ADDED
Binary file
|
images/icons/temple-2.png
ADDED
Binary file
|
images/icons/watermill.png
ADDED
Binary file
|
images/icons/yoga.png
ADDED
Binary file
|
images/icons/zoo.png
ADDED
Binary file
|
images/icons/zoom.png
ADDED
Binary file
|
include/class.gmshc_point.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version: 2.
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
@@ -16,7 +16,7 @@ class GMSHC_Point {
|
|
16 |
var $thumbnail;
|
17 |
var $post_id;
|
18 |
|
19 |
-
function create_point($address,$ltlg,$title,$description,$icon,$thumbnail,$post_id,$check =
|
20 |
|
21 |
if(empty($address)) return false;
|
22 |
if ($check) {
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 2.2
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
16 |
var $thumbnail;
|
17 |
var $post_id;
|
18 |
|
19 |
+
function create_point($address,$ltlg,$title,$description,$icon,$thumbnail,$post_id,$check = false){
|
20 |
|
21 |
if(empty($address)) return false;
|
22 |
if ($check) {
|
include/class.gmshc_post_points.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version: 2.
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
@@ -11,6 +11,7 @@ class GMSHC_Post_Map
|
|
11 |
var $post_id;
|
12 |
var $points = array();
|
13 |
var $post_data;
|
|
|
14 |
|
15 |
function create_post_map($id) {
|
16 |
$this->post_id = $id;
|
@@ -42,7 +43,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,$ltlg_list[$id],$title_list[$id],$desc_list[$id],$icon_list[$id],$thumb_list[$id],$this->post_id
|
46 |
array_push($new_points_array,$new_point);
|
47 |
}
|
48 |
else return false;
|
@@ -60,6 +61,7 @@ class GMSHC_Post_Map
|
|
60 |
|
61 |
function load_data(){
|
62 |
$this->points = gmshc_get_points($this->post_id);
|
|
|
63 |
$this->post_data = get_post_meta($this->post_id,'google-map-sc',true);
|
64 |
}
|
65 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 2.2
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
11 |
var $post_id;
|
12 |
var $points = array();
|
13 |
var $post_data;
|
14 |
+
var $points_number;
|
15 |
|
16 |
function create_post_map($id) {
|
17 |
$this->post_id = $id;
|
43 |
$point = array();
|
44 |
foreach ($address_list as $id => $address){
|
45 |
$new_point = new GMSHC_Point();
|
46 |
+
if($new_point->create_point($address,$ltlg_list[$id],$title_list[$id],$desc_list[$id],$icon_list[$id],$thumb_list[$id],$this->post_id)) {
|
47 |
array_push($new_points_array,$new_point);
|
48 |
}
|
49 |
else return false;
|
61 |
|
62 |
function load_data(){
|
63 |
$this->points = gmshc_get_points($this->post_id);
|
64 |
+
$this->points_number = count($this->points);
|
65 |
$this->post_data = get_post_meta($this->post_id,'google-map-sc',true);
|
66 |
}
|
67 |
|
include/functions.php
CHANGED
@@ -1,40 +1,84 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version: 2.
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
$
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
$output .= "<script type=\"text/javascript\">\n";
|
15 |
-
|
16 |
-
$output .= "var map_".$canvas.";\n";
|
17 |
$output .= "var map_points_".$canvas." = new Array();\n";
|
18 |
|
19 |
$i = 0;
|
20 |
|
21 |
-
foreach ($map_points as $point){
|
|
|
|
|
|
|
22 |
|
23 |
-
list($lat,$
|
24 |
$output .= "map_points_".$canvas."[".$i."] = \n";
|
25 |
$output .= "{\"address\":\"".$point->address."\",\n";
|
26 |
$output .= "\"lat\":\"".$lat."\",\n";
|
27 |
-
$output .= "\"
|
28 |
$output .= "\"info\":\"".gmshc_get_windowhtml($point)."\",\n";
|
|
|
29 |
$output .= "\"icon\":\"".$point->icon."\"};\n";
|
30 |
$i ++;
|
31 |
|
32 |
}
|
33 |
-
|
34 |
-
$output .= "
|
35 |
-
$output .= "
|
36 |
-
$output .= "
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
return $output;
|
39 |
}
|
40 |
|
@@ -42,14 +86,6 @@ function gmshc_generate_map($map_points, $width, $height, $zoom) {
|
|
42 |
/**
|
43 |
* Get the html info
|
44 |
*
|
45 |
-
* Allows a plugin to replace the html that would otherwise be returned. The
|
46 |
-
* filter is 'gmshc_get_windowhtml' and passes the point.
|
47 |
-
|
48 |
-
* add_filter('gmshc_get_windowhtml','default_html',1,2);
|
49 |
-
*
|
50 |
-
* function default_html($windowhtml,$point){
|
51 |
-
* return "this is the address".$point->address;
|
52 |
-
* }
|
53 |
*/
|
54 |
|
55 |
function gmshc_get_windowhtml(&$point) {
|
@@ -67,7 +103,7 @@ function gmshc_get_windowhtml(&$point) {
|
|
67 |
$point_title = $point->title;
|
68 |
if (($point->post_id) > 0) $point_link = get_permalink($point->post_id);
|
69 |
else $point_link = "";
|
70 |
-
$point_img_url = ($point->thumbnail != "")? $point->thumbnail :
|
71 |
$point_excerpt = gmshc_get_excerpt($post_id);
|
72 |
$point_description = ($point->description != "") ? $point->description : $point_excerpt;
|
73 |
$point_address = $point->address;
|
@@ -119,21 +155,18 @@ function gmshc_all_post_thumb($the_parent){
|
|
119 |
endforeach;
|
120 |
endif;
|
121 |
|
122 |
-
return $images_url;
|
123 |
-
|
124 |
}
|
125 |
|
126 |
-
|
127 |
-
|
128 |
/**
|
129 |
* Get the thumbnail from post
|
130 |
*/
|
131 |
-
function
|
132 |
|
133 |
if( function_exists('has_post_thumbnail') && has_post_thumbnail($the_parent)) {
|
134 |
$thumbnail_id = get_post_thumbnail_id( $the_parent );
|
135 |
if(!empty($thumbnail_id))
|
136 |
-
$img = wp_get_attachment_image_src( $thumbnail_id,
|
137 |
} else {
|
138 |
$attachments = get_children( array(
|
139 |
'post_parent' => $the_parent,
|
@@ -144,12 +177,11 @@ function gmshc_post_thumb($the_parent){
|
|
144 |
'numberposts' => 1) );
|
145 |
if($attachments == true) :
|
146 |
foreach($attachments as $id => $attachment) :
|
147 |
-
$img = wp_get_attachment_image_src($id,
|
148 |
endforeach;
|
149 |
endif;
|
150 |
}
|
151 |
-
if (isset($img[0])) return $img[0];
|
152 |
-
|
153 |
}
|
154 |
|
155 |
/**
|
@@ -204,8 +236,8 @@ function gmshc_deploy_icons(){
|
|
204 |
}
|
205 |
}
|
206 |
?>
|
207 |
-
|
208 |
-
|
209 |
</div>
|
210 |
<div id="gmshc_icon_cont">
|
211 |
<input type="hidden" name="default_icon" value="<?php echo $default_icon ?>" id="default_icon" />
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 2.2
|
5 |
* Author: Alain Gonzalez
|
6 |
* Author URI: http://web-argument.com/
|
7 |
*/
|
8 |
|
9 |
+
/**
|
10 |
+
* Generating Map
|
11 |
+
*
|
12 |
+
*/
|
13 |
+
function gmshc_generate_map($map_points, $atts) {
|
14 |
|
15 |
+
extract($atts);
|
16 |
+
if ($canvas == "") $canvas = "canvas_".wp_generate_password(4, false);
|
17 |
+
|
18 |
+
$output ='<div id="'.$canvas.'" class = "gmsc" style="width:'.$width.'px; height:'.$height.'px; ';
|
19 |
+
switch ($align) {
|
20 |
+
case "left" :
|
21 |
+
$output .= 'float:left; margin:'.$margin.'px;"';
|
22 |
+
break;
|
23 |
+
case "right" :
|
24 |
+
$output .= 'float:right; margin:'.$margin.'px;"';
|
25 |
+
break;
|
26 |
+
case "center" :
|
27 |
+
$output .= 'clear:both; overflow:hidden; margin:'.$margin.'px auto;"';
|
28 |
+
break;
|
29 |
+
}
|
30 |
+
|
31 |
+
$output .= "></div>";
|
32 |
$output .= "<script type=\"text/javascript\">\n";
|
|
|
|
|
33 |
$output .= "var map_points_".$canvas." = new Array();\n";
|
34 |
|
35 |
$i = 0;
|
36 |
|
37 |
+
foreach ($map_points as $point){
|
38 |
+
|
39 |
+
$post_categories = wp_get_post_categories( $point->post_id );
|
40 |
+
$terms = implode(",",$post_categories);
|
41 |
|
42 |
+
list($lat,$lng) = explode(",",$point->ltlg);
|
43 |
$output .= "map_points_".$canvas."[".$i."] = \n";
|
44 |
$output .= "{\"address\":\"".$point->address."\",\n";
|
45 |
$output .= "\"lat\":\"".$lat."\",\n";
|
46 |
+
$output .= "\"lng\":\"".$lng."\",\n";
|
47 |
$output .= "\"info\":\"".gmshc_get_windowhtml($point)."\",\n";
|
48 |
+
$output .= "\"cat\":\"".$terms."\",\n";
|
49 |
$output .= "\"icon\":\"".$point->icon."\"};\n";
|
50 |
$i ++;
|
51 |
|
52 |
}
|
53 |
+
|
54 |
+
$output .= "var options_".$canvas." = {\n";
|
55 |
+
$output .= "'zoom':".$zoom.",\n";
|
56 |
+
$output .= "'markers':map_points_".$canvas.",\n";
|
57 |
+
$output .= "'mapContainer':'".$canvas."',\n";
|
58 |
+
$output .= "'focusType':'".$focus_type."',\n";
|
59 |
+
$output .= "'type':'".$type."',\n";
|
60 |
+
|
61 |
+
switch ($focus) {
|
62 |
+
case "all" :
|
63 |
+
$output .= "'circle':true,\n";
|
64 |
+
break;
|
65 |
+
case "0" :
|
66 |
+
break;
|
67 |
+
default:
|
68 |
+
$output .= "'focusPoint':".($focus-1).",\n";
|
69 |
+
}
|
70 |
+
|
71 |
+
$output .= "'animateMarkers':".$animate.",\n";
|
72 |
+
$output .= "'interval':'".$interval."'\n";
|
73 |
+
$output .= "};\n";
|
74 |
+
|
75 |
+
$output .= "var map_".$canvas." = new gmshc.Map(options_".$canvas.");\n";
|
76 |
+
$output .= "var trigger_".$canvas." = function(){map_".$canvas.".init()};\n";
|
77 |
+
$output .= "gmshc.addLoadEvent(trigger_".$canvas.");\n";
|
78 |
+
$output .= "</script>\n";
|
79 |
+
|
80 |
+
$output = apply_filters('gmshc_generate_map',$output,$map_points,$atts);
|
81 |
+
|
82 |
return $output;
|
83 |
}
|
84 |
|
86 |
/**
|
87 |
* Get the html info
|
88 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
*/
|
90 |
|
91 |
function gmshc_get_windowhtml(&$point) {
|
103 |
$point_title = $point->title;
|
104 |
if (($point->post_id) > 0) $point_link = get_permalink($point->post_id);
|
105 |
else $point_link = "";
|
106 |
+
$point_img_url = ($point->thumbnail != "")? $point->thumbnail : gmshc_post_img($point->post_id);
|
107 |
$point_excerpt = gmshc_get_excerpt($post_id);
|
108 |
$point_description = ($point->description != "") ? $point->description : $point_excerpt;
|
109 |
$point_address = $point->address;
|
155 |
endforeach;
|
156 |
endif;
|
157 |
|
158 |
+
return $images_url;
|
|
|
159 |
}
|
160 |
|
|
|
|
|
161 |
/**
|
162 |
* Get the thumbnail from post
|
163 |
*/
|
164 |
+
function gmshc_post_img($the_parent,$size = 'thumbnail'){
|
165 |
|
166 |
if( function_exists('has_post_thumbnail') && has_post_thumbnail($the_parent)) {
|
167 |
$thumbnail_id = get_post_thumbnail_id( $the_parent );
|
168 |
if(!empty($thumbnail_id))
|
169 |
+
$img = wp_get_attachment_image_src( $thumbnail_id, $size );
|
170 |
} else {
|
171 |
$attachments = get_children( array(
|
172 |
'post_parent' => $the_parent,
|
177 |
'numberposts' => 1) );
|
178 |
if($attachments == true) :
|
179 |
foreach($attachments as $id => $attachment) :
|
180 |
+
$img = wp_get_attachment_image_src($id, $size);
|
181 |
endforeach;
|
182 |
endif;
|
183 |
}
|
184 |
+
if (isset($img[0])) return $img[0];
|
|
|
185 |
}
|
186 |
|
187 |
/**
|
236 |
}
|
237 |
}
|
238 |
?>
|
239 |
+
<div class="gmshc_label">
|
240 |
+
<?php _e("Select the marker by clicking on the images"); ?>
|
241 |
</div>
|
242 |
<div id="gmshc_icon_cont">
|
243 |
<input type="hidden" name="default_icon" value="<?php echo $default_icon ?>" id="default_icon" />
|
js/gmshc-admin.js
CHANGED
@@ -19,11 +19,9 @@
|
|
19 |
$(this).css({"border":"solid #ffffff 1px"})
|
20 |
});
|
21 |
|
22 |
-
$("
|
23 |
-
|
24 |
gmshc_add_map();
|
25 |
-
parent.tb_remove();
|
26 |
-
|
27 |
});
|
28 |
|
29 |
$("#gmshc_show").click(function(){
|
@@ -36,7 +34,15 @@
|
|
36 |
mapDiv.height("440");
|
37 |
mapBtn.text(mapBtn.attr("hide"));
|
38 |
}
|
39 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
gmshc_update_editor_custom_field();
|
42 |
|
@@ -51,24 +57,65 @@
|
|
51 |
}
|
52 |
|
53 |
function gmshc_add_map(){
|
54 |
-
|
55 |
-
|
56 |
-
var zoom = $("#zoom").val();
|
57 |
-
|
58 |
-
str = "[google-map-sc";
|
59 |
-
if (width != '')
|
60 |
-
str += " width="+width;
|
61 |
-
if (height != '')
|
62 |
-
str += " height="+height;
|
63 |
-
if (zoom != '')
|
64 |
-
str += " zoom="+zoom;
|
65 |
-
str +="]";
|
66 |
-
|
67 |
var win = window.dialogArguments || opener || parent || top;
|
68 |
win.send_to_editor(str);
|
69 |
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
function gmshc_update_editor_custom_field(){
|
73 |
var mapData = $("#post_data").val();
|
74 |
jQueryParent = parent.jQuery;
|
19 |
$(this).css({"border":"solid #ffffff 1px"})
|
20 |
});
|
21 |
|
22 |
+
$(".insert_map").click(function(){
|
|
|
23 |
gmshc_add_map();
|
24 |
+
parent.tb_remove();
|
|
|
25 |
});
|
26 |
|
27 |
$("#gmshc_show").click(function(){
|
34 |
mapDiv.height("440");
|
35 |
mapBtn.text(mapBtn.attr("hide"));
|
36 |
}
|
37 |
+
});
|
38 |
+
|
39 |
+
$("#windowhtml").change(function(){
|
40 |
+
$("#gmshc_html_previews").html($(this).val());
|
41 |
+
});
|
42 |
+
|
43 |
+
var winHtml = $("#windowhtml").val();
|
44 |
+
|
45 |
+
$("#windowhtml").val($.trim(winHtml));
|
46 |
|
47 |
gmshc_update_editor_custom_field();
|
48 |
|
57 |
}
|
58 |
|
59 |
function gmshc_add_map(){
|
60 |
+
|
61 |
+
var str = gmshc_generate_sc();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
var win = window.dialogArguments || opener || parent || top;
|
63 |
win.send_to_editor(str);
|
64 |
|
65 |
}
|
66 |
|
67 |
+
function gmshc_generate_sc(){
|
68 |
+
|
69 |
+
var width = $("#width").val();
|
70 |
+
var defaultWidth = $("#default_width").val();
|
71 |
+
|
72 |
+
var height = $("#height").val();
|
73 |
+
var defaultHeight = $("#default_height").val();
|
74 |
+
|
75 |
+
var margin = $("#margin").val();
|
76 |
+
var defaultMargin = $("#default_margin").val();
|
77 |
+
|
78 |
+
var align = "";
|
79 |
+
if($("#aleft").is(':checked')) align = "left";
|
80 |
+
else if($("#acenter").is(':checked')) align = "center";
|
81 |
+
else if ($("#aright").is(':checked')) align = "right";
|
82 |
+
|
83 |
+
var defaultAlign = $("#default_align").val();
|
84 |
+
|
85 |
+
var zoom = $("#zoom").val();
|
86 |
+
var defaultZoom = $("#default_zoom").val();
|
87 |
+
|
88 |
+
var type = $("#type").val();
|
89 |
+
var defaultType = $("#default_type").val();
|
90 |
+
|
91 |
+
var focusPoint = $("#focus").val();
|
92 |
+
var defaultFocusPoint = $("#default_focus").val();
|
93 |
+
|
94 |
+
var focusType = $("#focus_type").val();
|
95 |
+
var defaultFocusType= $("#default_focus_type").val();
|
96 |
+
|
97 |
+
str = "[google-map-sc";
|
98 |
+
if (width != defaultWidth)
|
99 |
+
str += " width=\""+width+"\"";
|
100 |
+
if (height != defaultHeight)
|
101 |
+
str += " height=\""+height+"\"";
|
102 |
+
if (margin != defaultMargin)
|
103 |
+
str += " margin=\""+margin+"\"";
|
104 |
+
if (align != defaultAlign)
|
105 |
+
str += " align=\""+align+"\"";
|
106 |
+
if (zoom != defaultZoom)
|
107 |
+
str += " zoom=\""+zoom+"\"";
|
108 |
+
if(type != defaultType)
|
109 |
+
str += " type=\""+type+"\"";
|
110 |
+
if(focusPoint != defaultFocusPoint)
|
111 |
+
str += " focus=\""+focusPoint+"\"";
|
112 |
+
if(focusType != defaultFocusType)
|
113 |
+
str += " focus_type=\""+focusType+"\"";
|
114 |
+
str +="]";
|
115 |
+
|
116 |
+
return str;
|
117 |
+
}
|
118 |
+
|
119 |
function gmshc_update_editor_custom_field(){
|
120 |
var mapData = $("#post_data").val();
|
121 |
jQueryParent = parent.jQuery;
|
js/gmshc-render.js
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Google Map Shortcode
|
3 |
-
* Version: 2.1
|
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].lat,GMpointsArray[0].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.lat, location.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 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/gmshc.2.2.js
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Google Map Shortcode
|
3 |
+
* Version: 2.2
|
4 |
+
* Author: Alain Gonzalez
|
5 |
+
* Author URI: http://web-argument.com/
|
6 |
+
*/
|
7 |
+
|
8 |
+
var gmshc = {};
|
9 |
+
|
10 |
+
(function(){
|
11 |
+
|
12 |
+
gmshc.Map = function(settings){
|
13 |
+
|
14 |
+
this.markers = settings.markers;
|
15 |
+
this.mapContainer = document.getElementById(settings.mapContainer);
|
16 |
+
this.zoom = (typeof settings.zoom != "undefined")? settings.zoom : 10;
|
17 |
+
this.type = (typeof settings.type != "undefined")? settings.type : "ROADMAP";
|
18 |
+
this.circle = (typeof settings.circle != "undefined")? settings.circle : false;
|
19 |
+
this.interval = (typeof settings.interval != "undefined")? settings.interval : 4000;
|
20 |
+
this.afterTilesLoadedCallback = (typeof settings.afterTilesLoadedCallback != "undefined")? settings.afterTilesLoadedCallback : null;
|
21 |
+
this.focusPoint = (typeof settings.focusPoint != "undefined")? settings.focusPoint : null;
|
22 |
+
this.focusType = (typeof settings.focusType != "undefined")? settings.focusType : "open"; //center
|
23 |
+
this.animateMarkers = (typeof settings.animateMarkers != "undefined")? settings.animateMarkers : true;
|
24 |
+
this.afterOpenCallback = (typeof settings.afterOpenCallback != "undefined")? settings.afterOpenCallback : null;
|
25 |
+
this.afterCircle = (typeof settings.afterCircle != "undefined")? settings.afterCircle : null;
|
26 |
+
|
27 |
+
this.map = null;
|
28 |
+
this.markersObj = [];
|
29 |
+
this.infowindowObj = [];
|
30 |
+
this.intervalId = null;
|
31 |
+
this.openItem = 0;
|
32 |
+
this.openWindow = null;
|
33 |
+
this.pointsNumber = this.markers.length;
|
34 |
+
this.userInfoWindowOpen = false;
|
35 |
+
this.disableMap = false;
|
36 |
+
|
37 |
+
};
|
38 |
+
|
39 |
+
gmshc.Map.prototype.init = function() {
|
40 |
+
|
41 |
+
var firstLat = this.markers[0].lat;
|
42 |
+
var firstLong = this.markers[0].lng;
|
43 |
+
var firstLatLng = new google.maps.LatLng(firstLat, firstLong);
|
44 |
+
|
45 |
+
this.map = new google.maps.Map(this.mapContainer, {
|
46 |
+
zoom: this.zoom,
|
47 |
+
center: firstLatLng,
|
48 |
+
mapTypeId: google.maps.MapTypeId[this.type]
|
49 |
+
});
|
50 |
+
|
51 |
+
var map = this.map;
|
52 |
+
var avgLat = 0;
|
53 |
+
var avgLng = 0;
|
54 |
+
|
55 |
+
if(this.afterTilesLoadedCallback != null) {
|
56 |
+
google.maps.event.addListener(map, 'tilesloaded', this.afterTilesLoadedCallback);
|
57 |
+
}
|
58 |
+
|
59 |
+
for (var i = 0; i < this.pointsNumber; i++){
|
60 |
+
|
61 |
+
var location = this.markers[i];
|
62 |
+
var animate = (this.animateMarkers)? google.maps.Animation.DROP : null;
|
63 |
+
var marker = new google.maps.Marker({
|
64 |
+
position: new google.maps.LatLng(location.lat, location.lng),
|
65 |
+
map: map,
|
66 |
+
icon: new google.maps.MarkerImage(location.icon),
|
67 |
+
animation: animate,
|
68 |
+
title:location.address
|
69 |
+
});
|
70 |
+
|
71 |
+
marker.cat = location.cat;
|
72 |
+
this.markersObj.push(marker);
|
73 |
+
|
74 |
+
var infowindow = new google.maps.InfoWindow({
|
75 |
+
maxWidth:340,
|
76 |
+
content: location.info
|
77 |
+
});
|
78 |
+
this.infowindowObj.push(marker);
|
79 |
+
|
80 |
+
var closure_1 = this.Bind(this.openInfoWindow(infowindow, marker));
|
81 |
+
google.maps.event.addListener(marker, 'click', closure_1);
|
82 |
+
|
83 |
+
var closure_3 = this.Bind(this.MarkerMouseOverHandler(marker));
|
84 |
+
google.maps.event.addListener(marker, 'mouseover', closure_3);
|
85 |
+
|
86 |
+
var closure_5 = this.Bind(this.MarkerMouseOutHandler(marker));
|
87 |
+
google.maps.event.addListener(marker, 'mouseout', closure_5);
|
88 |
+
|
89 |
+
var closure_6 = this.Bind(this.MapMouseOverHandler());
|
90 |
+
google.maps.event.addListener(map,'mouseover',closure_6);
|
91 |
+
|
92 |
+
var closure_7 = this.Bind(this.MapMouseOutHandler());
|
93 |
+
google.maps.event.addListener(map,'mouseout',closure_7);
|
94 |
+
|
95 |
+
// Sum up all lat/lng to calculate center all points.
|
96 |
+
avgLat += Number(location.lat);
|
97 |
+
avgLng += Number(location.lng);
|
98 |
+
}
|
99 |
+
|
100 |
+
// Center map.
|
101 |
+
this.map.setCenter(new google.maps.LatLng(
|
102 |
+
avgLat / this.pointsNumber, avgLng / this.pointsNumber));
|
103 |
+
|
104 |
+
if(this.circle) this.Play();
|
105 |
+
if(this.focusPoint != null) {
|
106 |
+
if (this.focusType == "center") this.Center(this.focusPoint);
|
107 |
+
else this.Open(this.focusPoint);
|
108 |
+
}
|
109 |
+
|
110 |
+
};
|
111 |
+
|
112 |
+
gmshc.Map.prototype.openInfoWindow = function(infoWindow, marker) {
|
113 |
+
return function() {
|
114 |
+
if (this.openWindow != null) {
|
115 |
+
this.openWindow.close();
|
116 |
+
this.userInfoWindowOpen = false;
|
117 |
+
}
|
118 |
+
if (typeof user == "undefined") user = false;
|
119 |
+
|
120 |
+
this.openWindow = infoWindow;
|
121 |
+
infoWindow.open(this.map, marker);
|
122 |
+
var closure_4 = this.Bind(this.CloseInfoWindow(infoWindow));
|
123 |
+
google.maps.event.addListener(infoWindow, 'closeclick', closure_4);
|
124 |
+
this.userInfoWindowOpen = true;
|
125 |
+
if(this.afterOpenCallback != null) this.afterOpenCallback(marker);
|
126 |
+
};
|
127 |
+
};
|
128 |
+
|
129 |
+
gmshc.Map.prototype.CloseInfoWindow = function(infoWindow) {
|
130 |
+
return function() {
|
131 |
+
this.userInfoWindowOpen = false;
|
132 |
+
this.disableMap = false;
|
133 |
+
}
|
134 |
+
};
|
135 |
+
|
136 |
+
gmshc.Map.prototype.Rotate = function(){
|
137 |
+
var visibles = this.Visibles();
|
138 |
+
if (!visibles) {
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
if (this.disableMap) return;
|
142 |
+
if (this.openItem >= this.markersObj.length) this.openItem = 0;
|
143 |
+
if (this.markersObj[this.openItem].getVisible()){
|
144 |
+
if (this.focusType == "center"){
|
145 |
+
if (this.userInfoWindowOpen) return;
|
146 |
+
var location = this.markers[this.openItem];
|
147 |
+
this.map.setCenter(new google.maps.LatLng(location.lat, location.lng));
|
148 |
+
if (this.animateMarkers) {
|
149 |
+
this.StopAllAnimations();
|
150 |
+
this.ToggleAnimation(this.markersObj[this.openItem],"BOUNCE");
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
google.maps.event.trigger(this.markersObj[this.openItem],'click');
|
154 |
+
}
|
155 |
+
if(this.afterCircle != null) this.afterCircle(this.markersObj[this.openItem], this.openItem);
|
156 |
+
this.openItem ++;
|
157 |
+
} else {
|
158 |
+
this.openItem ++;
|
159 |
+
this.Rotate();
|
160 |
+
}
|
161 |
+
|
162 |
+
return;
|
163 |
+
};
|
164 |
+
|
165 |
+
gmshc.Map.prototype.Visibles = function(){
|
166 |
+
for (var i = 0; i < this.markersObj.length; i++){
|
167 |
+
if (this.markersObj[i].getVisible()) return true;
|
168 |
+
}
|
169 |
+
};
|
170 |
+
|
171 |
+
gmshc.Map.prototype.ToggleAnimation = function(marker,type) {
|
172 |
+
marker.setAnimation(google.maps.Animation[type]);
|
173 |
+
};
|
174 |
+
|
175 |
+
gmshc.Map.prototype.StopAllAnimations = function(){
|
176 |
+
for (var i = 0; i < this.markersObj.length; i++){
|
177 |
+
this.markersObj[i].setAnimation(null);
|
178 |
+
}
|
179 |
+
};
|
180 |
+
|
181 |
+
gmshc.Map.prototype.Play = function(){
|
182 |
+
if (!this.circle) this.circle = true;
|
183 |
+
if ( this.pointsNumber > 1 ) {
|
184 |
+
var closure_2 = this.Bind(this.Rotate);
|
185 |
+
this.intervalId = setInterval(closure_2, this.interval);
|
186 |
+
} else {
|
187 |
+
this.Open(0);
|
188 |
+
}
|
189 |
+
};
|
190 |
+
|
191 |
+
gmshc.Map.prototype.Stop = function(){
|
192 |
+
if (this.circle) this.circle = false;
|
193 |
+
clearInterval(this.intervalId);
|
194 |
+
};
|
195 |
+
|
196 |
+
gmshc.Map.prototype.Open = function(point){
|
197 |
+
if (this.disableMap) return;
|
198 |
+
if (this.markersObj[point].getVisible())
|
199 |
+
google.maps.event.trigger(this.markersObj[point],'click');
|
200 |
+
};
|
201 |
+
|
202 |
+
gmshc.Map.prototype.Center = function(point){
|
203 |
+
if (this.disableMap) return;
|
204 |
+
if (this.markersObj[point].getVisible()) {
|
205 |
+
if(this.openWindow != null) this.openWindow.close();
|
206 |
+
var location = this.markers[point];
|
207 |
+
this.map.setCenter(new google.maps.LatLng(location.lat, location.lng));
|
208 |
+
if (this.animateMarkers != null) {
|
209 |
+
this.StopAllAnimations();
|
210 |
+
this.ToggleAnimation(this.markersObj[point],"BOUNCE");
|
211 |
+
}
|
212 |
+
}
|
213 |
+
};
|
214 |
+
|
215 |
+
gmshc.Map.prototype.ShowMarkers = function(cat,display){
|
216 |
+
if(this.openWindow != null) this.openWindow.close();
|
217 |
+
for (var i = 0; i < this.pointsNumber; i++){
|
218 |
+
var catList = this.markersObj[i].cat;
|
219 |
+
var catArray = catList.split(",");
|
220 |
+
for (var j = 0; j < catArray.length; j++){
|
221 |
+
if (Number(catArray[j]) == cat)
|
222 |
+
this.markersObj[i].setVisible(display);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
};
|
226 |
+
|
227 |
+
gmshc.Map.prototype.MarkerMouseOverHandler = function(marker) {
|
228 |
+
return function() {
|
229 |
+
this.disableMap = true;
|
230 |
+
if (marker.getAnimation() != null) {
|
231 |
+
marker.setAnimation(null);
|
232 |
+
}
|
233 |
+
}
|
234 |
+
};
|
235 |
+
|
236 |
+
gmshc.Map.prototype.MarkerMouseOutHandler = function(marker) {
|
237 |
+
return function() {
|
238 |
+
if (!this.userInfoWindowOpen) this.disableMap = false;
|
239 |
+
}
|
240 |
+
};
|
241 |
+
|
242 |
+
|
243 |
+
gmshc.Map.prototype.MapMouseOverHandler = function(){
|
244 |
+
return function(){
|
245 |
+
this.disableMap = true;
|
246 |
+
}
|
247 |
+
}
|
248 |
+
|
249 |
+
gmshc.Map.prototype.MapMouseOutHandler = function(){
|
250 |
+
return function(){
|
251 |
+
this.disableMap = false;
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
gmshc.Map.prototype.Bind = function( Method ){
|
256 |
+
var _this = this;
|
257 |
+
return(
|
258 |
+
function(){
|
259 |
+
return( Method.apply( _this, arguments ) );
|
260 |
+
}
|
261 |
+
);
|
262 |
+
};
|
263 |
+
|
264 |
+
gmshc.addLoadEvent = function(func) {
|
265 |
+
var oldonload = window.onload;
|
266 |
+
if (typeof window.onload != 'function') {
|
267 |
+
window.onload = func;
|
268 |
+
}
|
269 |
+
else {
|
270 |
+
window.onload = function() {
|
271 |
+
oldonload();
|
272 |
+
func();
|
273 |
+
}
|
274 |
+
}
|
275 |
+
};
|
276 |
+
|
277 |
+
})();
|
readme.txt
CHANGED
@@ -1,45 +1,38 @@
|
|
1 |
=== Google Map Shortcode ===
|
2 |
-
Contributors:
|
3 |
-
Donate link:
|
4 |
-
Tags: google
|
5 |
Requires at least: 2.5
|
6 |
Tested up to: 3.2.1
|
7 |
-
Stable tag: 2.
|
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
|
22 |
-
*
|
23 |
-
*
|
24 |
-
*
|
25 |
-
*
|
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
|
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 |
|
34 |
== Installation ==
|
35 |
|
36 |
-
1. Upload 'Google Map
|
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
|
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>
|
43 |
|
44 |
== Screenshots ==
|
45 |
|
@@ -51,6 +44,14 @@ Visit <a href="http://web-argument.com/2011/07/20/google-map-shortcode-how-to-us
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
= 2.1.2 =
|
55 |
* Preview map added on the map editor panel.
|
56 |
|
@@ -83,6 +84,14 @@ Visit <a href="http://web-argument.com/2011/07/20/google-map-shortcode-how-to-us
|
|
83 |
* New custom field included in order to cache the Latitude and Longitude and avoid extra Google Geocoder requests.
|
84 |
* More than one point per post fixed.
|
85 |
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
1 |
=== Google Map Shortcode ===
|
2 |
+
Contributors: alaingg
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=support%40web%2dargument%2ecom&lc=US&item_name=Web%2dArgument%2ecom¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
|
4 |
+
Tags: google maps, shortcode, map, maps, categories, widget, post map, point, marker, list, location, address, images, geocoder, google maps, animation
|
5 |
Requires at least: 2.5
|
6 |
Tested up to: 3.2.1
|
7 |
+
Stable tag: 2.2
|
|
|
|
|
8 |
|
9 |
+
Real Friendly integration of Google Map instances into your blogs. The plugin allows to display multiple maps on your pages.
|
10 |
== Description ==
|
|
|
11 |
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.
|
12 |
|
13 |
+
[Plugin Page](http://web-argument.com/google-map-shortcode-wordpress-plugin/) | [Shortcode References](http://web-argument.com/google-map-shortcode-reference/) | [How To Use](http://web-argument.com/google-map-shortcode-how-to-use/) | [Examples](http://web-argument.com/google-map-shortcode-wordpress-plugin/#examples)
|
14 |
+
|
15 |
Special Features:
|
16 |
|
17 |
+
* The 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.
|
22 |
+
* Maps in multiple languages.
|
23 |
+
* Allows to deploy multiples maps in a single page.
|
24 |
+
* Points under post categories can be included.
|
25 |
+
* Allows to insert maps into the content and theme files.
|
|
|
|
|
26 |
* The window box opened display part of the content of your posts like: post title, thumbnails, excerpt or a custom title description and thumbnail.
|
27 |
* You can customize the html of the info window box on the settings.
|
28 |
+
* The plugin is based on Wordpress shortcode and allows many options like: initial zoom, width, height, categories, post ID, specific address, marker and thumbnail.
|
|
|
|
|
29 |
|
30 |
== Installation ==
|
31 |
|
32 |
+
1. Upload 'Google Map Shortcode' folder to the '/wp-content/plugins/' directory.
|
33 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
34 |
+
3. Go to the Google Map Shortcode Options page under settings and save your preferred options.
|
35 |
+
4. Using the Google Map editor button insert the address and add the map into your posts/pages.
|
|
|
|
|
|
|
36 |
|
37 |
== Screenshots ==
|
38 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 2.2 =
|
48 |
+
* Map type added.
|
49 |
+
* Marker animation option added.
|
50 |
+
* Focus option added.
|
51 |
+
* Maps marging and aligment added.
|
52 |
+
* Performance improved.
|
53 |
+
* More map languages included
|
54 |
+
|
55 |
= 2.1.2 =
|
56 |
* Preview map added on the map editor panel.
|
57 |
|
84 |
* New custom field included in order to cache the Latitude and Longitude and avoid extra Google Geocoder requests.
|
85 |
* More than one point per post fixed.
|
86 |
|
87 |
+
= 1.0.0 =
|
88 |
+
* Initial release.
|
89 |
+
|
90 |
+
== Upgrade Notice ==
|
91 |
|
92 |
+
= 2.2 =
|
93 |
+
This new version includes markers focus and animations and improves the performance.
|
94 |
+
__Note:__ Before upgrade save the custom HTML info because the new version will overwrite it.
|
95 |
+
|
96 |
+
== How to use ==
|
97 |
+
Visit the [How To Use](http://web-argument.com/google-map-shortcode-how-to-use/) section.
|
styles/gmshc-admin-styles.css
CHANGED
@@ -6,11 +6,12 @@
|
|
6 |
*/
|
7 |
|
8 |
#gmshc_icon_cont {
|
9 |
-
width:
|
10 |
-
height:
|
11 |
float:left;
|
12 |
-
overflow:auto;
|
13 |
-
padding:
|
|
|
14 |
}
|
15 |
|
16 |
#gmshc_thumb_cont {
|
@@ -56,8 +57,9 @@
|
|
56 |
overflow:hidden;
|
57 |
}
|
58 |
|
59 |
-
#
|
60 |
float:left;
|
|
|
61 |
}
|
62 |
|
63 |
#gmshc_previews {
|
@@ -69,4 +71,9 @@
|
|
69 |
#gmshc_html_previews {
|
70 |
border:solid 1px #CCC;
|
71 |
padding:10px;
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
6 |
*/
|
7 |
|
8 |
#gmshc_icon_cont {
|
9 |
+
width:578px;
|
10 |
+
height:126px;
|
11 |
float:left;
|
12 |
+
overflow-y:auto;
|
13 |
+
padding:2px;
|
14 |
+
border:solid #CCC 1px;
|
15 |
}
|
16 |
|
17 |
#gmshc_thumb_cont {
|
57 |
overflow:hidden;
|
58 |
}
|
59 |
|
60 |
+
#gmshc_html_cont{
|
61 |
float:left;
|
62 |
+
margin-left:20px;
|
63 |
}
|
64 |
|
65 |
#gmshc_previews {
|
71 |
#gmshc_html_previews {
|
72 |
border:solid 1px #CCC;
|
73 |
padding:10px;
|
74 |
+
}
|
75 |
+
|
76 |
+
h3.gmshc_editor{
|
77 |
+
padding:5px;
|
78 |
+
margin:0;
|
79 |
}
|