Version Description
- Custom field deprecated.
- The point's information is saved in the database.
- Points based on coordinates included.
Download this release
Release Info
Developer | alaingg |
Plugin | Google Map Shortcode |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.2.3 to 3.0
- google-map-shortcode.php +143 -66
- include/class.gmshc_point.php +4 -3
- include/class.gmshc_post_points.php +17 -41
- include/functions.php +239 -78
- js/gmshc-admin.js +34 -22
- readme.txt +27 -7
- styles/gmshc-admin-styles.css +24 -5
google-map-shortcode.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Google Map Shortcode
|
4 |
Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
5 |
-
Description: Include Google Maps in your blogs with just one click.
|
6 |
-
Version:
|
7 |
Author: Alain Gonzalez
|
8 |
Author URI: http://web-argument.com/
|
9 |
*/
|
@@ -26,7 +26,7 @@ Author URI: http://web-argument.com/
|
|
26 |
|
27 |
define('GMSC_PLUGIN_DIR', WP_PLUGIN_DIR."/".dirname(plugin_basename(__FILE__)));
|
28 |
define('GMSC_PLUGIN_URL', WP_PLUGIN_URL."/".dirname(plugin_basename(__FILE__)));
|
29 |
-
define('GMSHC_VERSION_CURRENT','
|
30 |
define('GMSHC_VERSION_CHECK','2.2');
|
31 |
|
32 |
require(GMSC_PLUGIN_DIR."/include/functions.php");
|
@@ -190,27 +190,26 @@ function gmshc_sc($atts) {
|
|
190 |
'focus_type' => $focus_type,
|
191 |
'canvas' => ''
|
192 |
), $atts);
|
193 |
-
extract($final_atts);
|
194 |
|
195 |
$map_points = array();
|
196 |
|
197 |
// When address is set
|
198 |
-
if (!empty($address)) {
|
199 |
-
|
200 |
//create single point object id = -1
|
201 |
$new_point = new GMSHC_Point();
|
202 |
-
if($new_point -> create_point(
|
203 |
|
204 |
// When id is set
|
205 |
} else if (!empty($id)) {
|
|
|
206 |
$post_points = new GMSHC_Post_Map();
|
207 |
-
$post_points -> create_post_map($id);
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
|
212 |
$categories = split (",",$cat);
|
213 |
-
$j = 0;
|
214 |
|
215 |
$post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1));
|
216 |
foreach ($post_obj as $post_item) {
|
@@ -218,6 +217,7 @@ function gmshc_sc($atts) {
|
|
218 |
$post_points = new GMSHC_Post_Map();
|
219 |
|
220 |
$post_points -> create_post_map($post_item->ID);
|
|
|
221 |
if ($post_points->points_number >0) {
|
222 |
foreach ($post_points->points as $point) {
|
223 |
array_push($map_points,$point);
|
@@ -230,18 +230,19 @@ function gmshc_sc($atts) {
|
|
230 |
//create points for the current post_id
|
231 |
$post_points = new GMSHC_Post_Map();
|
232 |
$post_points -> create_post_map($post->ID);
|
|
|
233 |
$map_points = $post_points->points;
|
234 |
|
235 |
}
|
236 |
-
|
237 |
//Map Point array filled
|
238 |
if ( count($map_points) > 0 ) {
|
239 |
-
|
240 |
//Generate Map form points
|
241 |
$output = gmshc_generate_map($map_points, $final_atts);
|
242 |
} else {
|
243 |
$output = __("There is not points to locate on the map","google-map-sc");
|
244 |
-
}
|
245 |
|
246 |
return $output;
|
247 |
}
|
@@ -270,14 +271,32 @@ function gmshc_tab_handle() {
|
|
270 |
}
|
271 |
|
272 |
function gmshc_tab_process(){
|
273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
$options = get_gmshc_options();
|
275 |
|
276 |
$post_id = $_REQUEST["post_id"];
|
277 |
$custom_fieds = get_post_custom($post_id);
|
278 |
|
279 |
$address = isset($_REQUEST['new_address'])? gmshc_clean_string($_REQUEST['new_address']) : "";
|
280 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
$title = isset($_REQUEST['new_title'])? gmshc_clean_string($_REQUEST['new_title']) : get_the_title($post_id);
|
282 |
$description = isset($_REQUEST['new_description'])? gmshc_clean_string($_REQUEST['new_description']) : "";
|
283 |
$icon = isset($_REQUEST['default_icon'])?stripslashes($_REQUEST['default_icon']) : "";
|
@@ -298,27 +317,31 @@ function gmshc_tab_process(){
|
|
298 |
$focus = isset($_REQUEST['focus']) ? $_REQUEST['focus'] : $options['focus'];
|
299 |
$focus_type = isset($_REQUEST['focus_type']) ? $_REQUEST['focus_type'] : $options['focus_type'];
|
300 |
|
|
|
301 |
$address_list = isset($_REQUEST['addr']) ? gmshc_stripslashes_deep($_REQUEST['addr']) : "";
|
302 |
$title_list = isset($_REQUEST['title']) ? gmshc_stripslashes_deep($_REQUEST['title']) : "";
|
303 |
$desc_list = isset($_REQUEST['desc']) ? gmshc_stripslashes_deep($_REQUEST['desc']) : "";
|
304 |
$ltlg_list = isset($_REQUEST['ltlg']) ? $_REQUEST['ltlg'] : "";
|
305 |
-
$icon_list = isset($_REQUEST['icon']) ?
|
306 |
-
$thumb_list = isset($_REQUEST['thumb'])?
|
307 |
-
|
308 |
-
$post_points = new GMSHC_Post_Map();
|
309 |
-
$post_points -> create_post_map($post_id);
|
310 |
|
|
|
|
|
|
|
311 |
if (!empty($add_point)) {
|
312 |
$new_point = new GMSHC_Point();
|
313 |
-
if($new_point -> create_point($address
|
314 |
-
$post_points -> add_point($new_point)
|
|
|
|
|
|
|
315 |
}
|
316 |
else
|
317 |
echo "<div class='error'><p>".__("The Address can't be located.","google-map-sc")."</p></div>";
|
318 |
}
|
319 |
|
320 |
else if (!empty($update_point)) {
|
321 |
-
if ( $post_points ->
|
322 |
echo "<div class='updated'><p>".__("The Point was updated.","google-map-sc")."</p></div>";
|
323 |
else echo "<div class='error'><p>".__("The Points can't be updated.","google-map-sc")."</p></div>";
|
324 |
}
|
@@ -330,11 +353,12 @@ function gmshc_tab_process(){
|
|
330 |
|
331 |
?>
|
332 |
|
|
|
|
|
333 |
<script type="text/javascript" src="<?php echo GMSC_PLUGIN_URL ?>/js/gmshc-admin.js"></script>
|
334 |
-
<?php gmshc_head() ?>
|
335 |
-
<link href="<?php echo GMSC_PLUGIN_URL ?>/styles/gmshc-admin-styles.css" rel="stylesheet" type="text/css"/>
|
336 |
|
337 |
-
|
|
|
338 |
|
339 |
<div style="width:620px; margin:10px auto">
|
340 |
|
@@ -354,32 +378,58 @@ function gmshc_tab_process(){
|
|
354 |
<tr>
|
355 |
<td colspan="2">
|
356 |
<h3 class="gmshc_editor"><?php _e("Add New Point","google-map-sc"); ?></h3>
|
|
|
357 |
</td>
|
358 |
-
</tr>
|
359 |
<tr>
|
360 |
<td align="right" valign="top">
|
361 |
-
<strong><?php _e("
|
362 |
</td>
|
363 |
<td valign="top">
|
364 |
-
<
|
365 |
</td>
|
366 |
-
</tr>
|
367 |
<tr>
|
368 |
<td align="right" valign="top">
|
369 |
-
<strong><?php _e("
|
370 |
</td>
|
371 |
<td valign="top">
|
372 |
-
<
|
373 |
</td>
|
374 |
-
</tr>
|
375 |
<tr>
|
376 |
<td align="right" valign="top">
|
377 |
-
<strong><?php _e("
|
378 |
</td>
|
379 |
<td valign="top">
|
380 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
</td>
|
382 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
<tr>
|
384 |
<td align="right" valign="top" colspan="2">
|
385 |
<?php gmshc_deploy_icons() ?>
|
@@ -407,8 +457,9 @@ function gmshc_tab_process(){
|
|
407 |
<strong><?php _e("Thumbnail: ","google-map-sc"); ?></strong><?php _e("If you want to attach an image to the point you need to upload it first to the post gallery","google-map-sc"); ?>
|
408 |
</div>
|
409 |
<?php } ?>
|
410 |
-
<p align="left"><a class="button" href = "?post_id=<?php echo $post_id ?>&type=image" title="Upload Images"><?php _e("Upload Images","google-map-sc") ?></a></p>
|
411 |
-
|
|
|
412 |
</tr>
|
413 |
<?php if ($post_points->points_number > 0) { ?>
|
414 |
<tr>
|
@@ -425,11 +476,11 @@ function gmshc_tab_process(){
|
|
425 |
<td valign="top"><input name="height" type="text" id="height" size="10" value = "<?php echo $height ?>" /></td>
|
426 |
</tr>
|
427 |
<tr>
|
428 |
-
<td align="right"
|
429 |
<td><input name="margin" id="margin" type="text" size="6" value="<?php echo $margin ?>" /></td>
|
430 |
</tr>
|
431 |
<tr>
|
432 |
-
<td align="right"
|
433 |
<td>
|
434 |
<input name="align" type="radio" id="aleft" value="left" <?php echo ($align == "left" ? "checked = 'checked'" : "") ?> /> <?php _e("left","google-map-sc") ?>
|
435 |
<input name="align" type="radio" id="acenter" value="center" <?php echo ($align == "center" ? "checked = 'checked'" : "") ?> /> <?php _e("center","google-map-sc") ?>
|
@@ -460,13 +511,12 @@ function gmshc_tab_process(){
|
|
460 |
<td>
|
461 |
<select name="focus" id="focus">
|
462 |
<option value="0" <?php if ($focus == 0) echo "selected" ?>><?php _e("None","google-map-sc") ?></option>
|
463 |
-
<?php if ($post_points->points_number > 1) { ?>
|
464 |
-
<option value="all" <?php if ($focus == "all") echo "selected" ?>><?php _e("All","google-map-sc") ?></option>
|
465 |
-
<?php } ?>
|
466 |
<?php for ($i = 1; $i <= $post_points->points_number; $i ++){ ?>
|
467 |
-
<?php $
|
468 |
-
<option value="<?php echo $number ?>" <?php if ($focus == $number) echo "selected" ?>><?php echo $number ?></option>
|
469 |
<?php } ?>
|
|
|
|
|
|
|
470 |
</select>
|
471 |
<em><?php _e("Select the point to be focused after loading the map","google-map-sc") ?></em>
|
472 |
</td>
|
@@ -483,17 +533,23 @@ function gmshc_tab_process(){
|
|
483 |
<?php } ?>
|
484 |
</table>
|
485 |
|
486 |
-
|
487 |
-
<?php if ($post_points->points_number > 0) { ?>
|
488 |
-
<input class="button-primary" value="<?php _e("Add Point","google-map-sc") ?>" name="add_point" type="submit">
|
489 |
-
<input class="button-primary insert_map" value="<?php _e("Insert Map","google-map-sc"); ?>" type="button" \>
|
490 |
-
<?php echo $post_points->points_number.__(" Points Added","google-map-sc") ?>
|
491 |
-
<?php } ?>
|
492 |
|
493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
494 |
|
495 |
<?php
|
496 |
if ( count($post_points -> points) > 0 ){
|
|
|
497 |
?>
|
498 |
|
499 |
<table class="widefat" cellspacing="0">
|
@@ -513,30 +569,31 @@ function gmshc_tab_process(){
|
|
513 |
foreach ($post_points->points as $point ) {
|
514 |
?>
|
515 |
<tr>
|
516 |
-
<td><?php echo ($
|
517 |
<td>
|
518 |
<img src="<?php echo $point->icon ?>" atl="<?php _e("Icon","google-map-sc") ?>" />
|
519 |
<input name="icon[]" type="hidden" id="icon_<?php echo $i ?>" size="30" value = "<?php echo $point->icon ?>"/>
|
|
|
520 |
</td>
|
521 |
<td>
|
522 |
<div class="gmshc_thumb gmshc_selected">
|
523 |
<?php if ($point->thumbnail != "") { ?>
|
524 |
<img src="<?php echo $point->thumbnail ?>" atl="<?php _e("Thumbnail","google-map-sc") ?>" width = "40" height="40" />
|
525 |
-
<input name="thumb[]" type="hidden" id="thumb_<?php echo $i ?>" size="30" value = "<?php echo $point->thumbnail ?>"/>
|
526 |
<?php } ?>
|
527 |
</div>
|
528 |
</td>
|
529 |
<td>
|
530 |
-
<input name="title[]" type="text" id="title_<?php echo $i ?>" size="
|
531 |
<textarea name="desc[]" cols="30" rows="2" id="desc_<?php echo $i ?>"><?php echo $point->description ?></textarea>
|
532 |
</td>
|
533 |
<td>
|
|
|
534 |
<input name="ltlg[]" type="hidden" id="ltlg_<?php echo $i ?>" size="30" value = "<?php echo $point->ltlg ?>"/>
|
535 |
-
<
|
536 |
-
<
|
537 |
-
<div>
|
538 |
<input class="button" value="<?php _e("Update","google-map-sc"); ?>" name="update" type="submit">
|
539 |
-
<a href="?post_id=<?php echo $post_id ?>&tab=gmshc&delp=<?php echo $
|
540 |
</div>
|
541 |
</td>
|
542 |
</tr>
|
@@ -547,17 +604,37 @@ function gmshc_tab_process(){
|
|
547 |
</tbody>
|
548 |
</table>
|
549 |
|
550 |
-
<p><input class="button-primary insert_map" value="<?php _e("Insert Map","google-map-sc"); ?>" type="button" \>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
</div>
|
552 |
-
|
553 |
-
|
|
|
|
|
554 |
</div>
|
555 |
<br />
|
556 |
<?php } ?>
|
557 |
</form>
|
558 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
559 |
|
560 |
-
<?php
|
561 |
}
|
562 |
|
563 |
/**
|
@@ -619,7 +696,7 @@ function gmshc_options_page() {
|
|
619 |
$newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
|
620 |
$newoptions['icons'] = $options['icons'];
|
621 |
|
622 |
-
$newoptions['version'] =
|
623 |
|
624 |
if ( $options != $newoptions ) {
|
625 |
$options = $newoptions;
|
2 |
/*
|
3 |
Plugin Name: Google Map Shortcode
|
4 |
Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
5 |
+
Description: Include Google Maps in your blogs with just one click.
|
6 |
+
Version: 3.0
|
7 |
Author: Alain Gonzalez
|
8 |
Author URI: http://web-argument.com/
|
9 |
*/
|
26 |
|
27 |
define('GMSC_PLUGIN_DIR', WP_PLUGIN_DIR."/".dirname(plugin_basename(__FILE__)));
|
28 |
define('GMSC_PLUGIN_URL', WP_PLUGIN_URL."/".dirname(plugin_basename(__FILE__)));
|
29 |
+
define('GMSHC_VERSION_CURRENT','3.0');
|
30 |
define('GMSHC_VERSION_CHECK','2.2');
|
31 |
|
32 |
require(GMSC_PLUGIN_DIR."/include/functions.php");
|
190 |
'focus_type' => $focus_type,
|
191 |
'canvas' => ''
|
192 |
), $atts);
|
193 |
+
extract($final_atts);
|
194 |
|
195 |
$map_points = array();
|
196 |
|
197 |
// When address is set
|
198 |
+
if (!empty($address)) {
|
|
|
199 |
//create single point object id = -1
|
200 |
$new_point = new GMSHC_Point();
|
201 |
+
if($new_point -> create_point("",$address,"",$title,$description,$icon,$thumbnail,-1,true)) $map_points[0]=$new_point;
|
202 |
|
203 |
// When id is set
|
204 |
} else if (!empty($id)) {
|
205 |
+
|
206 |
$post_points = new GMSHC_Post_Map();
|
207 |
+
$post_points -> create_post_map($id);
|
208 |
+
$map_points = $post_points -> load_points();
|
209 |
+
|
210 |
+
} else if ($cat != '') {
|
211 |
|
212 |
$categories = split (",",$cat);
|
|
|
213 |
|
214 |
$post_obj = get_posts(array('category__in'=>$categories,'numberposts'=>-1));
|
215 |
foreach ($post_obj as $post_item) {
|
217 |
$post_points = new GMSHC_Post_Map();
|
218 |
|
219 |
$post_points -> create_post_map($post_item->ID);
|
220 |
+
$post_points -> load_points();
|
221 |
if ($post_points->points_number >0) {
|
222 |
foreach ($post_points->points as $point) {
|
223 |
array_push($map_points,$point);
|
230 |
//create points for the current post_id
|
231 |
$post_points = new GMSHC_Post_Map();
|
232 |
$post_points -> create_post_map($post->ID);
|
233 |
+
$post_points -> load_points();
|
234 |
$map_points = $post_points->points;
|
235 |
|
236 |
}
|
237 |
+
|
238 |
//Map Point array filled
|
239 |
if ( count($map_points) > 0 ) {
|
240 |
+
|
241 |
//Generate Map form points
|
242 |
$output = gmshc_generate_map($map_points, $final_atts);
|
243 |
} else {
|
244 |
$output = __("There is not points to locate on the map","google-map-sc");
|
245 |
+
}
|
246 |
|
247 |
return $output;
|
248 |
}
|
271 |
}
|
272 |
|
273 |
function gmshc_tab_process(){
|
274 |
+
|
275 |
+
gmshc_head();
|
276 |
+
|
277 |
+
if(!isset($_REQUEST['map'])) {
|
278 |
+
|
279 |
+
media_upload_header();
|
280 |
+
|
281 |
$options = get_gmshc_options();
|
282 |
|
283 |
$post_id = $_REQUEST["post_id"];
|
284 |
$custom_fieds = get_post_custom($post_id);
|
285 |
|
286 |
$address = isset($_REQUEST['new_address'])? gmshc_clean_string($_REQUEST['new_address']) : "";
|
287 |
+
$latitude = isset($_REQUEST['latitude'])? gmshc_clean_string($_REQUEST['latitude']) : "";
|
288 |
+
$longitude = isset($_REQUEST['longitude'])? gmshc_clean_string($_REQUEST['longitude']) : "";
|
289 |
+
$verify = isset($_REQUEST['verify'])? true : false;
|
290 |
+
$verify_point = true;
|
291 |
+
|
292 |
+
if ($latitude != "" && $longitude != "") {
|
293 |
+
$ltlg = $latitude.",".$longitude;
|
294 |
+
if ($verify) $verify_point = true;
|
295 |
+
else $verify_point = false;
|
296 |
+
}
|
297 |
+
else $ltlg = "";
|
298 |
+
|
299 |
+
|
300 |
$title = isset($_REQUEST['new_title'])? gmshc_clean_string($_REQUEST['new_title']) : get_the_title($post_id);
|
301 |
$description = isset($_REQUEST['new_description'])? gmshc_clean_string($_REQUEST['new_description']) : "";
|
302 |
$icon = isset($_REQUEST['default_icon'])?stripslashes($_REQUEST['default_icon']) : "";
|
317 |
$focus = isset($_REQUEST['focus']) ? $_REQUEST['focus'] : $options['focus'];
|
318 |
$focus_type = isset($_REQUEST['focus_type']) ? $_REQUEST['focus_type'] : $options['focus_type'];
|
319 |
|
320 |
+
$id_list = isset($_REQUEST['pid']) ? $_REQUEST['pid'] : "";
|
321 |
$address_list = isset($_REQUEST['addr']) ? gmshc_stripslashes_deep($_REQUEST['addr']) : "";
|
322 |
$title_list = isset($_REQUEST['title']) ? gmshc_stripslashes_deep($_REQUEST['title']) : "";
|
323 |
$desc_list = isset($_REQUEST['desc']) ? gmshc_stripslashes_deep($_REQUEST['desc']) : "";
|
324 |
$ltlg_list = isset($_REQUEST['ltlg']) ? $_REQUEST['ltlg'] : "";
|
325 |
+
$icon_list = isset($_REQUEST['icon']) ? $_REQUEST['icon'] : "";
|
326 |
+
$thumb_list = isset($_REQUEST['thumb'])? $_REQUEST['thumb'] : "";
|
|
|
|
|
|
|
327 |
|
328 |
+
$post_points = new GMSHC_Post_Map();
|
329 |
+
$post_points -> create_post_map($post_id);
|
330 |
+
|
331 |
if (!empty($add_point)) {
|
332 |
$new_point = new GMSHC_Point();
|
333 |
+
if($new_point -> create_point($ltlg,$address,$ltlg,$title,$description,$icon,$selected_thumbnail,$post_id,$verify_point)){
|
334 |
+
if($post_points -> add_point($new_point))
|
335 |
+
echo "<div class='updated'><p>".__("The Point was added.","google-map-sc")."</p></div>";
|
336 |
+
else
|
337 |
+
echo "<div class='error'><p>".__("The point can't be saved or already exist.","google-map-sc")."</p></div>";
|
338 |
}
|
339 |
else
|
340 |
echo "<div class='error'><p>".__("The Address can't be located.","google-map-sc")."</p></div>";
|
341 |
}
|
342 |
|
343 |
else if (!empty($update_point)) {
|
344 |
+
if ( $post_points -> update_point($id_list,$address_list,$ltlg_list,$title_list,$desc_list,$icon_list,$thumb_list))
|
345 |
echo "<div class='updated'><p>".__("The Point was updated.","google-map-sc")."</p></div>";
|
346 |
else echo "<div class='error'><p>".__("The Points can't be updated.","google-map-sc")."</p></div>";
|
347 |
}
|
353 |
|
354 |
?>
|
355 |
|
356 |
+
<?php $post_points -> load_points(); ?>
|
357 |
+
|
358 |
<script type="text/javascript" src="<?php echo GMSC_PLUGIN_URL ?>/js/gmshc-admin.js"></script>
|
|
|
|
|
359 |
|
360 |
+
<link href="<?php echo GMSC_PLUGIN_URL ?>/styles/gmshc-admin-styles.css" rel="stylesheet" type="text/css"/>
|
361 |
+
|
362 |
|
363 |
<div style="width:620px; margin:10px auto">
|
364 |
|
378 |
<tr>
|
379 |
<td colspan="2">
|
380 |
<h3 class="gmshc_editor"><?php _e("Add New Point","google-map-sc"); ?></h3>
|
381 |
+
<p><?php _e("Points can be added using Address or Lat/Long.","google-map-sc"); ?></p>
|
382 |
</td>
|
383 |
+
</tr>
|
384 |
<tr>
|
385 |
<td align="right" valign="top">
|
386 |
+
<strong><?php _e("Full Address","google-map-sc"); ?></strong>
|
387 |
</td>
|
388 |
<td valign="top">
|
389 |
+
<textarea name="new_address" cols="32" rows="2" id="new_address"></textarea>
|
390 |
</td>
|
391 |
+
</tr>
|
392 |
<tr>
|
393 |
<td align="right" valign="top">
|
394 |
+
<strong><?php _e("Latitude ","google-map-sc"); ?></strong>
|
395 |
</td>
|
396 |
<td valign="top">
|
397 |
+
<input name="latitude" size="35" id="latitude" />
|
398 |
</td>
|
399 |
+
</tr>
|
400 |
<tr>
|
401 |
<td align="right" valign="top">
|
402 |
+
<strong><?php _e("Longitude","google-map-sc"); ?></strong>
|
403 |
</td>
|
404 |
<td valign="top">
|
405 |
+
<input name="longitude" size="35" id="longitude" />
|
406 |
+
</td>
|
407 |
+
</tr>
|
408 |
+
<tr>
|
409 |
+
<td align="right" valign="top">
|
410 |
+
<input type="checkbox" value="1" name="verify" />
|
411 |
+
</td>
|
412 |
+
<td valign="top">
|
413 |
+
<?php _e("Verify this latitude and longitude using Geocoding. This could overwrite the point address.","google-map-sc"); ?>
|
414 |
+
</td>
|
415 |
+
</tr>
|
416 |
+
<tr>
|
417 |
+
<td align="right" valign="top">
|
418 |
+
<strong><?php _e("Title","google-map-sc"); ?></strong>
|
419 |
+
</td>
|
420 |
+
<td valign="top">
|
421 |
+
<input name="new_title" size="54" id="new_title" value="<?php echo $title ?>" />
|
422 |
</td>
|
423 |
</tr>
|
424 |
+
<tr>
|
425 |
+
<td align="right" valign="top">
|
426 |
+
<strong><?php _e("Description","google-map-sc"); ?></strong>
|
427 |
+
</td>
|
428 |
+
<td valign="top">
|
429 |
+
<textarea name="new_description" cols="47" rows="2" id="new_description"></textarea>
|
430 |
+
</td>
|
431 |
+
</tr>
|
432 |
+
|
433 |
<tr>
|
434 |
<td align="right" valign="top" colspan="2">
|
435 |
<?php gmshc_deploy_icons() ?>
|
457 |
<strong><?php _e("Thumbnail: ","google-map-sc"); ?></strong><?php _e("If you want to attach an image to the point you need to upload it first to the post gallery","google-map-sc"); ?>
|
458 |
</div>
|
459 |
<?php } ?>
|
460 |
+
<p align="left"><a class="button" href = "?post_id=<?php echo $post_id ?>&type=image" title="Upload Images"><?php _e("Upload Images","google-map-sc") ?></a></p>
|
461 |
+
<p class="endbox"><input class="button-primary" value="<?php _e("Add Point","google-map-sc") ?>" name="add_point" type="submit"></p>
|
462 |
+
</td>
|
463 |
</tr>
|
464 |
<?php if ($post_points->points_number > 0) { ?>
|
465 |
<tr>
|
476 |
<td valign="top"><input name="height" type="text" id="height" size="10" value = "<?php echo $height ?>" /></td>
|
477 |
</tr>
|
478 |
<tr>
|
479 |
+
<td align="right"><?php _e("Margin","google-map-sc") ?></td>
|
480 |
<td><input name="margin" id="margin" type="text" size="6" value="<?php echo $margin ?>" /></td>
|
481 |
</tr>
|
482 |
<tr>
|
483 |
+
<td align="right"><?php _e("Align","google-map-sc") ?></td>
|
484 |
<td>
|
485 |
<input name="align" type="radio" id="aleft" value="left" <?php echo ($align == "left" ? "checked = 'checked'" : "") ?> /> <?php _e("left","google-map-sc") ?>
|
486 |
<input name="align" type="radio" id="acenter" value="center" <?php echo ($align == "center" ? "checked = 'checked'" : "") ?> /> <?php _e("center","google-map-sc") ?>
|
511 |
<td>
|
512 |
<select name="focus" id="focus">
|
513 |
<option value="0" <?php if ($focus == 0) echo "selected" ?>><?php _e("None","google-map-sc") ?></option>
|
|
|
|
|
|
|
514 |
<?php for ($i = 1; $i <= $post_points->points_number; $i ++){ ?>
|
515 |
+
<option value="<?php echo $i ?>" <?php if ($focus == $i) echo "selected" ?>><?php echo $i ?></option>
|
|
|
516 |
<?php } ?>
|
517 |
+
<?php if ($post_points->points_number > 1) { ?>
|
518 |
+
<option value="all" <?php if ($focus == "all") echo "selected" ?>><?php _e("All","google-map-sc") ?></option>
|
519 |
+
<?php } ?>
|
520 |
</select>
|
521 |
<em><?php _e("Select the point to be focused after loading the map","google-map-sc") ?></em>
|
522 |
</td>
|
533 |
<?php } ?>
|
534 |
</table>
|
535 |
|
536 |
+
<?php if ($post_points->points_number > 0) { ?>
|
|
|
|
|
|
|
|
|
|
|
537 |
|
538 |
+
<p class="endbox"><input class="button-primary insert_map" value="<?php _e("Insert Map","google-map-sc"); ?>" type="button" \>
|
539 |
+
<a class="button gmshc_show" href="#gmshc_map" show="<?php _e("Show Map","google-map-sc") ?>" hide="<?php _e("Hide Map","google-map-sc") ?>">
|
540 |
+
<?php _e("Show Map","google-map-sc") ?>
|
541 |
+
</a>
|
542 |
+
<a class="button gmshc_refresh" href="#gmshc_map">
|
543 |
+
<?php _e("Refresh Map","google-map-sc") ?>
|
544 |
+
</a>
|
545 |
+
</p>
|
546 |
+
|
547 |
+
<p><?php echo $post_points->points_number." ".__("Points Added","google-map-sc") ?></p>
|
548 |
+
<?php } ?>
|
549 |
|
550 |
<?php
|
551 |
if ( count($post_points -> points) > 0 ){
|
552 |
+
rsort($post_points -> points);
|
553 |
?>
|
554 |
|
555 |
<table class="widefat" cellspacing="0">
|
569 |
foreach ($post_points->points as $point ) {
|
570 |
?>
|
571 |
<tr>
|
572 |
+
<td><?php echo ($post_points->points_number - $i) ?></td>
|
573 |
<td>
|
574 |
<img src="<?php echo $point->icon ?>" atl="<?php _e("Icon","google-map-sc") ?>" />
|
575 |
<input name="icon[]" type="hidden" id="icon_<?php echo $i ?>" size="30" value = "<?php echo $point->icon ?>"/>
|
576 |
+
<input name="pid[]" type="hidden" id="id_<?php echo $i ?>" size="30" value = "<?php echo $point->id ?>"/>
|
577 |
</td>
|
578 |
<td>
|
579 |
<div class="gmshc_thumb gmshc_selected">
|
580 |
<?php if ($point->thumbnail != "") { ?>
|
581 |
<img src="<?php echo $point->thumbnail ?>" atl="<?php _e("Thumbnail","google-map-sc") ?>" width = "40" height="40" />
|
582 |
+
<input name="thumb[]" type="hidden" id="thumb_<?php echo $i ?>" size="30" value = "<?php echo $point->thumbnail ?>"/>
|
583 |
<?php } ?>
|
584 |
</div>
|
585 |
</td>
|
586 |
<td>
|
587 |
+
<input name="title[]" type="text" id="title_<?php echo $i ?>" size="33" value = "<?php echo $point->title ?>"/>
|
588 |
<textarea name="desc[]" cols="30" rows="2" id="desc_<?php echo $i ?>"><?php echo $point->description ?></textarea>
|
589 |
</td>
|
590 |
<td>
|
591 |
+
<textarea name="addr[]" cols="30" rows="2" id="addr_<?php echo $i ?>"><?php echo $point->address ?></textarea>
|
592 |
<input name="ltlg[]" type="hidden" id="ltlg_<?php echo $i ?>" size="30" value = "<?php echo $point->ltlg ?>"/>
|
593 |
+
<p><?php echo $point->ltlg ?></p>
|
594 |
+
<div>
|
|
|
595 |
<input class="button" value="<?php _e("Update","google-map-sc"); ?>" name="update" type="submit">
|
596 |
+
<a href="?post_id=<?php echo $post_id ?>&tab=gmshc&delp=<?php echo $point->id ?>" class="delete_point" onclick="if(confirm('<?php _e("You will not be able to roll back deletion. Are you sure?","google-map-sc") ?>')) return true; else return false"><?php _e("Delete","google-map-sc"); ?></a>
|
597 |
</div>
|
598 |
</td>
|
599 |
</tr>
|
604 |
</tbody>
|
605 |
</table>
|
606 |
|
607 |
+
<p><input class="button-primary insert_map" value="<?php _e("Insert Map","google-map-sc"); ?>" type="button" \>
|
608 |
+
<a class="button gmshc_show" href="#gmshc_map" show="<?php _e("Show Map","google-map-sc") ?>" hide="<?php _e("Hide Map","google-map-sc") ?>">
|
609 |
+
<?php _e("Show Map","google-map-sc") ?>
|
610 |
+
</a>
|
611 |
+
<a class="button gmshc_refresh" href="#gmshc_map">
|
612 |
+
<?php _e("Refresh Map","google-map-sc") ?>
|
613 |
+
</a>
|
614 |
+
</p>
|
615 |
</div>
|
616 |
+
|
617 |
+
<div id="gmshc_map" style="height:0px; overflow:hidden;" tabindex="100">
|
618 |
+
<input type="hidden" id="iframe_url" value="?post_id=<?php echo $post_id ?>&tab=gmshc&" />
|
619 |
+
<iframe id = "iframe_sc" src="" width="600" height="420" scrolling="no" />
|
620 |
</div>
|
621 |
<br />
|
622 |
<?php } ?>
|
623 |
</form>
|
624 |
+
<?php } else {
|
625 |
+
|
626 |
+
$map_attr = array("post_id","type","zoom","focus","focus_type");
|
627 |
+
|
628 |
+
$shc_attr = "";
|
629 |
+
|
630 |
+
foreach($map_attr as $attr) {
|
631 |
+
if (isset($_REQUEST[$attr])) $shc_attr .= " ".(($attr=="post_id")?"id":$attr)."=".$_REQUEST[$attr];
|
632 |
+
}
|
633 |
+
|
634 |
+
echo do_shortcode("[google-map-sc width=600 height=420 align=center margin=0".$shc_attr."]");
|
635 |
+
|
636 |
+
}
|
637 |
|
|
|
638 |
}
|
639 |
|
640 |
/**
|
696 |
$newoptions['default_icon'] = isset($_POST['default_icon'])?$_POST['default_icon']:$options['default_icon'];
|
697 |
$newoptions['icons'] = $options['icons'];
|
698 |
|
699 |
+
$newoptions['version'] = GMSHC_VERSION_CURRENT;
|
700 |
|
701 |
if ( $options != $newoptions ) {
|
702 |
$options = $newoptions;
|
include/class.gmshc_point.php
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version: 2.
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
8 |
|
9 |
class GMSHC_Point {
|
10 |
|
|
|
11 |
var $address;
|
12 |
var $ltlg;
|
13 |
var $title;
|
@@ -16,9 +17,8 @@ class GMSHC_Point {
|
|
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) {
|
23 |
$temp_point = gmshc_point($address,$ltlg);
|
24 |
if(!$temp_point) {
|
@@ -32,6 +32,7 @@ class GMSHC_Point {
|
|
32 |
$temp_address = $address;
|
33 |
$temp_ltlg = $ltlg;
|
34 |
}
|
|
|
35 |
$this->address = $temp_address;
|
36 |
$this->ltlg = $temp_ltlg;
|
37 |
$this->title = $title;
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 2.3
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
8 |
|
9 |
class GMSHC_Point {
|
10 |
|
11 |
+
var $id;
|
12 |
var $address;
|
13 |
var $ltlg;
|
14 |
var $title;
|
17 |
var $thumbnail;
|
18 |
var $post_id;
|
19 |
|
20 |
+
function create_point($id,$address,$ltlg,$title,$description,$icon,$thumbnail,$post_id,$check = false){
|
21 |
|
|
|
22 |
if ($check) {
|
23 |
$temp_point = gmshc_point($address,$ltlg);
|
24 |
if(!$temp_point) {
|
32 |
$temp_address = $address;
|
33 |
$temp_ltlg = $ltlg;
|
34 |
}
|
35 |
+
$this->id = $id;
|
36 |
$this->address = $temp_address;
|
37 |
$this->ltlg = $temp_ltlg;
|
38 |
$this->title = $title;
|
include/class.gmshc_post_points.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version:
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
@@ -10,59 +10,35 @@ class GMSHC_Post_Map
|
|
10 |
{
|
11 |
var $post_id;
|
12 |
var $points = array();
|
13 |
-
var $post_data;
|
14 |
var $points_number;
|
15 |
|
16 |
-
function create_post_map($
|
17 |
-
$this->post_id = $
|
18 |
-
$this->load_data();
|
19 |
}
|
20 |
|
21 |
-
function add_point($
|
22 |
-
|
23 |
-
$saved = gmshc_save_points($this->post_id,$this -> points);
|
24 |
-
if($saved) {
|
25 |
-
$this->load_data();
|
26 |
-
}
|
27 |
-
return $saved;
|
28 |
}
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
unset($this->points[$point_id]);
|
34 |
-
$saved = gmshc_save_points($this->post_id,$this->points);
|
35 |
-
if($saved) {
|
36 |
-
$this->load_data();
|
37 |
-
}
|
38 |
-
return $saved;
|
39 |
}
|
40 |
|
41 |
-
function
|
42 |
-
|
43 |
-
|
44 |
-
foreach ($address_list as $id => $address){
|
45 |
$new_point = new GMSHC_Point();
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
else return false;
|
50 |
}
|
51 |
-
|
52 |
-
|
53 |
-
$saved = gmshc_save_points($this->post_id,$new_points_array);
|
54 |
-
if($saved) {
|
55 |
-
$this->load_data();
|
56 |
-
}
|
57 |
-
return $saved;
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
function
|
63 |
$this->points = gmshc_get_points($this->post_id);
|
64 |
$this->points_number = count($this->points);
|
65 |
-
|
66 |
}
|
67 |
|
68 |
}
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 3.0
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
10 |
{
|
11 |
var $post_id;
|
12 |
var $points = array();
|
|
|
13 |
var $points_number;
|
14 |
|
15 |
+
function create_post_map($post_id) {
|
16 |
+
$this->post_id = $post_id;
|
|
|
17 |
}
|
18 |
|
19 |
+
function add_point($point){
|
20 |
+
return gmshc_insert_db_point($point);
|
|
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
+
function delete_point($id){
|
24 |
+
return gmshc_delete_db_point($id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
|
27 |
+
function update_point($id_list,$address_list,$ltlg_list,$title_list,$desc_list,$icon_list,$thumb_list){
|
28 |
+
$i = 0;
|
29 |
+
foreach($id_list as $id){
|
|
|
30 |
$new_point = new GMSHC_Point();
|
31 |
+
$new_point -> create_point($id,$address_list[$i],$ltlg_list[$i],$title_list[$i],$desc_list[$i],$icon_list[$i],$thumb_list[$i],$this->post_id);
|
32 |
+
if (!gmshc_update_db_point($new_point)) return false;
|
33 |
+
$i ++;
|
|
|
34 |
}
|
35 |
+
return true;
|
36 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
function load_points(){
|
39 |
$this->points = gmshc_get_points($this->post_id);
|
40 |
$this->points_number = count($this->points);
|
41 |
+
return $this->points;
|
42 |
}
|
43 |
|
44 |
}
|
include/functions.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
-
* Version:
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
@@ -11,7 +11,7 @@
|
|
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 |
|
@@ -25,26 +25,33 @@ function gmshc_generate_map($map_points, $atts) {
|
|
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 ++;
|
@@ -92,19 +99,23 @@ function gmshc_get_windowhtml(&$point) {
|
|
92 |
|
93 |
$windowhtml = "";
|
94 |
$output = apply_filters('gmshc_get_windowhtml',$windowhtml,$point);
|
95 |
-
|
96 |
if ( $output != '' )
|
97 |
return $output;
|
98 |
-
|
99 |
$options = get_gmshc_options();
|
100 |
$windowhtml_frame = $options['windowhtml'];
|
101 |
|
102 |
$open_map_url = "http://maps.google.com/?q=".urlencode($point->address);
|
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($point->post_id);
|
|
|
108 |
$point_description = ($point->description != "") ? $point->description : $point_excerpt;
|
109 |
$point_address = $point->address;
|
110 |
|
@@ -193,10 +204,12 @@ function gmshc_get_excerpt($post_id) { // Fakes an excerpt if needed
|
|
193 |
$content = $content_post->post_content;
|
194 |
|
195 |
if ( '' != $content ) {
|
196 |
-
|
197 |
$content = strip_shortcodes( $content );
|
198 |
|
199 |
-
|
|
|
|
|
200 |
$content = str_replace(']]>', ']]>', $content);
|
201 |
$content = strip_tags($content);
|
202 |
$excerpt_length = 10;
|
@@ -237,7 +250,8 @@ function gmshc_deploy_icons(){
|
|
237 |
}
|
238 |
?>
|
239 |
<div class="gmshc_label">
|
240 |
-
<?php _e("Select the marker by clicking on the images","google-map-sc"); ?>
|
|
|
241 |
<div id="gmshc_icon_cont">
|
242 |
<input type="hidden" name="default_icon" value="<?php echo $default_icon ?>" id="default_icon" />
|
243 |
<?php foreach ($icons_array as $icon){ ?>
|
@@ -246,7 +260,8 @@ function gmshc_deploy_icons(){
|
|
246 |
</div>
|
247 |
<?php } ?>
|
248 |
</div>
|
249 |
-
<div id="icon_credit"><span><?php _e("Powered by","google-map-sc"); ?></span><a href="http://mapicons.nicolasmollet.com" target="_blank"><img src="<?php echo GMSC_PLUGIN_URL ?>/images/miclogo-88x31.gif" /></a
|
|
|
250 |
<?php
|
251 |
}
|
252 |
|
@@ -255,7 +270,8 @@ function gmshc_deploy_icons(){
|
|
255 |
* Get post points form the post custom field 'google-map-sc'
|
256 |
*/
|
257 |
function gmshc_get_points($post_id) {
|
258 |
-
|
|
|
259 |
$post_data = get_post_meta($post_id,'google-map-sc',true);
|
260 |
$post_points = array();
|
261 |
if($post_data != ""){
|
@@ -263,53 +279,60 @@ function gmshc_get_points($post_id) {
|
|
263 |
if(is_array($points)){
|
264 |
foreach($points as $point){
|
265 |
$point_obj = new GMSHC_Point();
|
266 |
-
if ($point_obj -> create_point(
|
267 |
-
|
268 |
}
|
269 |
}
|
270 |
|
271 |
-
}
|
272 |
|
273 |
-
/** checking for old custom fields **/
|
274 |
$post_data_address = get_post_meta($post_id,'google-map-sc-address');
|
275 |
|
|
|
|
|
|
|
|
|
|
|
276 |
|
277 |
-
if (count($post_data_address) > 0) {
|
278 |
-
$options = get_gmshc_options();
|
279 |
-
$default_icon = $options['default_icon'];
|
280 |
-
$post_title = get_the_title($post_id);
|
281 |
foreach ($post_data_address as $point_address){
|
282 |
-
$
|
283 |
-
if ($
|
284 |
-
|
285 |
-
array_push($post_points,$point_obj);
|
286 |
}
|
287 |
}
|
288 |
-
if (count($post_points) > 0)
|
289 |
-
gmshc_save_points($post_id,$post_points);
|
290 |
}
|
291 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
292 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
-
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
function gmshc_save_points($post_id,$points) {
|
303 |
-
$post_data = get_post_meta($post_id,'google-map-sc',true);
|
304 |
|
305 |
-
$new_post_data = json_encode($points);
|
306 |
|
307 |
-
if ($post_data == "null") {
|
308 |
-
delete_post_meta($post_id, 'google-map-sc');
|
309 |
-
return add_post_meta($post_id, 'google-map-sc', $new_post_data, true);
|
310 |
-
}
|
311 |
-
else return update_post_meta($post_id,'google-map-sc',$new_post_data, $post_data);
|
312 |
-
|
313 |
}
|
314 |
|
315 |
|
@@ -325,13 +348,15 @@ function gmshc_point($address,$ltlg){
|
|
325 |
$response = false;
|
326 |
|
327 |
if (!empty($ltlg)) {
|
|
|
328 |
$query = $ltlg;
|
329 |
$type = "latlng";
|
|
|
330 |
} else if (!empty($address)) {
|
331 |
|
332 |
$find = array("\n","\r"," ");
|
333 |
$replace = array("","","+");
|
334 |
-
$address = str_replace(
|
335 |
|
336 |
$query = $address;
|
337 |
$type = "address";
|
@@ -339,49 +364,185 @@ function gmshc_point($address,$ltlg){
|
|
339 |
|
340 |
else return false;
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
-
|
361 |
-
|
362 |
-
$answ_arr = json_decode($json_answ,true);
|
363 |
|
364 |
-
|
365 |
-
$formatted_address = gmshc_clean_string($answ_arr["results"]["0"]["formatted_address"]);
|
366 |
-
|
367 |
-
$point = $answ_arr["results"]["0"]["geometry"]["location"]["lat"].",".$answ_arr["results"]["0"]["geometry"]["location"]["lng"];
|
368 |
-
|
369 |
-
if (!empty($point) && !empty($formatted_address)){
|
370 |
|
371 |
-
$response = array('point'=>$point,'address'=>$formatted_address);
|
372 |
-
|
373 |
-
}
|
374 |
-
|
375 |
-
return $response;
|
376 |
-
|
377 |
-
} else {
|
378 |
-
return false;
|
379 |
}
|
380 |
|
|
|
|
|
|
|
|
|
|
|
|
|
381 |
}
|
382 |
|
383 |
function gmshc_clean_string($str){
|
384 |
return htmlentities(html_entity_decode(stripslashes($str),ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8");
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
?>
|
1 |
<?php
|
2 |
/**
|
3 |
* Google Map Shortcode
|
4 |
+
* Version: 3.0
|
5 |
* Author: Alain Gonzalez
|
6 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
7 |
*/
|
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 |
|
25 |
break;
|
26 |
case "center" :
|
27 |
$output .= 'clear:both; overflow:hidden; margin:'.$margin.'px auto;"';
|
28 |
+
break;
|
29 |
+
default:
|
30 |
+
$output .= 'clear:both; overflow:hidden; margin:'.$margin.'px auto;"';
|
31 |
+
break;
|
32 |
}
|
33 |
|
34 |
$output .= "></div>";
|
35 |
+
|
36 |
$output .= "<script type=\"text/javascript\">\n";
|
37 |
$output .= "var map_points_".$canvas." = new Array();\n";
|
38 |
|
39 |
$i = 0;
|
40 |
+
|
41 |
+
foreach ($map_points as $point){
|
42 |
|
43 |
$post_categories = wp_get_post_categories( $point->post_id );
|
44 |
+
$terms = implode(",",$post_categories);
|
45 |
|
46 |
list($lat,$lng) = explode(",",$point->ltlg);
|
47 |
+
|
48 |
$output .= "map_points_".$canvas."[".$i."] = \n";
|
49 |
$output .= "{\"address\":\"".$point->address."\",\n";
|
50 |
$output .= "\"lat\":\"".$lat."\",\n";
|
51 |
$output .= "\"lng\":\"".$lng."\",\n";
|
52 |
+
|
53 |
$output .= "\"info\":\"".gmshc_get_windowhtml($point)."\",\n";
|
54 |
+
|
55 |
$output .= "\"cat\":\"".$terms."\",\n";
|
56 |
$output .= "\"icon\":\"".$point->icon."\"};\n";
|
57 |
$i ++;
|
99 |
|
100 |
$windowhtml = "";
|
101 |
$output = apply_filters('gmshc_get_windowhtml',$windowhtml,$point);
|
102 |
+
|
103 |
if ( $output != '' )
|
104 |
return $output;
|
105 |
+
|
106 |
$options = get_gmshc_options();
|
107 |
$windowhtml_frame = $options['windowhtml'];
|
108 |
|
109 |
$open_map_url = "http://maps.google.com/?q=".urlencode($point->address);
|
110 |
$point_title = $point->title;
|
111 |
+
|
112 |
if (($point->post_id) > 0) $point_link = get_permalink($point->post_id);
|
113 |
else $point_link = "";
|
114 |
+
|
115 |
$point_img_url = ($point->thumbnail != "")? $point->thumbnail : gmshc_post_img($point->post_id);
|
116 |
+
|
117 |
$point_excerpt = gmshc_get_excerpt($point->post_id);
|
118 |
+
|
119 |
$point_description = ($point->description != "") ? $point->description : $point_excerpt;
|
120 |
$point_address = $point->address;
|
121 |
|
204 |
$content = $content_post->post_content;
|
205 |
|
206 |
if ( '' != $content ) {
|
207 |
+
|
208 |
$content = strip_shortcodes( $content );
|
209 |
|
210 |
+
//$content = apply_filters('the_content', $content);
|
211 |
+
//wp_die("--");
|
212 |
+
|
213 |
$content = str_replace(']]>', ']]>', $content);
|
214 |
$content = strip_tags($content);
|
215 |
$excerpt_length = 10;
|
250 |
}
|
251 |
?>
|
252 |
<div class="gmshc_label">
|
253 |
+
<?php _e("Select the marker by clicking on the images","google-map-sc"); ?>
|
254 |
+
</div>
|
255 |
<div id="gmshc_icon_cont">
|
256 |
<input type="hidden" name="default_icon" value="<?php echo $default_icon ?>" id="default_icon" />
|
257 |
<?php foreach ($icons_array as $icon){ ?>
|
260 |
</div>
|
261 |
<?php } ?>
|
262 |
</div>
|
263 |
+
<div id="icon_credit"><span><?php _e("Powered by","google-map-sc"); ?></span><a href="http://mapicons.nicolasmollet.com" target="_blank"><img src="<?php echo GMSC_PLUGIN_URL ?>/images/miclogo-88x31.gif" /></a>
|
264 |
+
</div>
|
265 |
<?php
|
266 |
}
|
267 |
|
270 |
* Get post points form the post custom field 'google-map-sc'
|
271 |
*/
|
272 |
function gmshc_get_points($post_id) {
|
273 |
+
|
274 |
+
// check for old custom google-map-sc
|
275 |
$post_data = get_post_meta($post_id,'google-map-sc',true);
|
276 |
$post_points = array();
|
277 |
if($post_data != ""){
|
279 |
if(is_array($points)){
|
280 |
foreach($points as $point){
|
281 |
$point_obj = new GMSHC_Point();
|
282 |
+
if ($point_obj -> create_point("",$point['address'],$point['ltlg'],$point['title'],$point['description'],$point['icon'],$point['thumbnail'],$post_id))
|
283 |
+
gmshc_insert_db_point($point_obj);
|
284 |
}
|
285 |
}
|
286 |
|
287 |
+
}
|
288 |
|
289 |
+
/** checking for old custom fields google-map-sc-address **/
|
290 |
$post_data_address = get_post_meta($post_id,'google-map-sc-address');
|
291 |
|
292 |
+
$options = get_gmshc_options();
|
293 |
+
$default_icon = $options['default_icon'];
|
294 |
+
$post_title = get_the_title($post_id);
|
295 |
+
|
296 |
+
if (count($post_data_address) > 0) {
|
297 |
|
|
|
|
|
|
|
|
|
298 |
foreach ($post_data_address as $point_address){
|
299 |
+
$point_obj_address = new GMSHC_Point();
|
300 |
+
if ($point_obj_address -> create_point("",gmshc_clean_string($point_address),"",$post_title,"",$default_icon,"",$post_id,true)){
|
301 |
+
gmshc_insert_db_point($point_obj_address);
|
|
|
302 |
}
|
303 |
}
|
|
|
|
|
304 |
}
|
305 |
|
306 |
+
/** checking for old custom fields google-map-sc-latlng **/
|
307 |
+
$post_data_ltlg = get_post_meta($post_id,'google-map-sc-latlng');
|
308 |
+
|
309 |
+
if (count($post_data_ltlg) > 0) {
|
310 |
+
|
311 |
+
foreach ($post_data_ltlg as $point_ltlg){
|
312 |
+
$point_obj_ltlg = new GMSHC_Point();
|
313 |
+
if ($point_obj_ltlg -> create_point("","",$point_ltlg,$post_title,"",$default_icon,"",$post_id)){
|
314 |
+
gmshc_insert_db_point($point_obj_ltlg);
|
315 |
+
}
|
316 |
+
}
|
317 |
}
|
318 |
+
|
319 |
+
$db_points = gmshc_get_bd_points($post_id);
|
320 |
+
|
321 |
+
if (count($db_points)>0){
|
322 |
+
|
323 |
+
foreach ($db_points as $point){
|
324 |
+
$point_obj = new GMSHC_Point();
|
325 |
|
326 |
+
if ($point_obj -> create_point($point['id'],$point['address'],$point['ltlg'],$point['title'],$point['description'],$point['icon'],$point['thumbnail'],$post_id)){
|
327 |
|
328 |
+
array_push($post_points,$point_obj);
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
return $post_points;
|
|
|
|
|
334 |
|
|
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
}
|
337 |
|
338 |
|
348 |
$response = false;
|
349 |
|
350 |
if (!empty($ltlg)) {
|
351 |
+
|
352 |
$query = $ltlg;
|
353 |
$type = "latlng";
|
354 |
+
|
355 |
} else if (!empty($address)) {
|
356 |
|
357 |
$find = array("\n","\r"," ");
|
358 |
$replace = array("","","+");
|
359 |
+
$address = str_replace($find,$replace, $address);
|
360 |
|
361 |
$query = $address;
|
362 |
$type = "address";
|
364 |
|
365 |
else return false;
|
366 |
|
367 |
+
$options = get_gmshc_options();
|
368 |
+
$api_url = "http://maps.googleapis.com/maps/api/geocode/json?".$type."=".urlencode($query)."&sensor=false&language=".$options['language'];
|
369 |
+
|
370 |
+
$json_answ = @file_get_contents($api_url);
|
371 |
+
|
372 |
+
if (empty($json_answ)) {
|
373 |
+
if(function_exists('curl_init')){
|
374 |
+
$ch = curl_init();
|
375 |
+
curl_setopt ($ch, CURLOPT_URL, $api_url);
|
376 |
+
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
|
377 |
+
$json_answ = curl_exec($ch);
|
378 |
+
curl_close($ch);
|
379 |
+
} else {
|
380 |
+
echo "<div class='error'><p>".__("The Point can't be added, <strong>php_curl.dll</strong> is not installed on your server and <strong>allow_url_fopen</strong> is disabled.")."</p></div>";
|
381 |
+
return false;
|
382 |
+
}
|
383 |
+
}
|
384 |
+
|
385 |
+
|
386 |
+
|
387 |
+
$answ_arr = json_decode($json_answ,true);
|
388 |
+
|
389 |
+
if (isset($answ_arr["status"]) && $answ_arr["status"] == "OK"){
|
390 |
+
$formatted_address = gmshc_clean_string($answ_arr["results"]["0"]["formatted_address"]);
|
391 |
+
|
392 |
+
$point = $answ_arr["results"]["0"]["geometry"]["location"]["lat"].",".$answ_arr["results"]["0"]["geometry"]["location"]["lng"];
|
393 |
|
394 |
+
if (!empty($point) && !empty($formatted_address)){
|
|
|
|
|
395 |
|
396 |
+
$response = array('point'=>$point,'address'=>$formatted_address);
|
|
|
|
|
|
|
|
|
|
|
397 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
}
|
399 |
|
400 |
+
return $response;
|
401 |
+
|
402 |
+
} else {
|
403 |
+
return false;
|
404 |
+
}
|
405 |
+
|
406 |
}
|
407 |
|
408 |
function gmshc_clean_string($str){
|
409 |
return htmlentities(html_entity_decode(stripslashes($str),ENT_QUOTES,"UTF-8"),ENT_QUOTES,"UTF-8");
|
410 |
}
|
411 |
|
412 |
+
/**
|
413 |
+
* Save the json data into the post custom field 'google-map-sc' - deprecated after 2.2.3
|
414 |
+
*/
|
415 |
+
|
416 |
+
function gmshc_insert_db_point($point){
|
417 |
+
|
418 |
+
global $wpdb;
|
419 |
+
|
420 |
+
$table_name = $wpdb->prefix . "gmshc";
|
421 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
422 |
+
return false;
|
423 |
+
|
424 |
+
} else {
|
425 |
+
|
426 |
+
// Checking if point exist
|
427 |
+
$sql = "SELECT * FROM `". $table_name ."` WHERE ltlg = '".$wpdb->escape($point->ltlg)."' AND post_id = '".$point->post_id."';";
|
428 |
+
|
429 |
+
$ltlg_check = $wpdb->get_row($sql, ARRAY_N);
|
430 |
+
|
431 |
+
if (count($ltlg_check) > 0) {
|
432 |
+
return false;
|
433 |
+
}
|
434 |
+
else {
|
435 |
+
|
436 |
+
$insert = "INSERT INTO `" . $table_name .
|
437 |
+
"` (
|
438 |
+
`address`,
|
439 |
+
`ltlg`,
|
440 |
+
`post_id`,
|
441 |
+
`time`,
|
442 |
+
`title`,
|
443 |
+
`description`,
|
444 |
+
`icon`,
|
445 |
+
`thumbnail`
|
446 |
+
) " .
|
447 |
+
"VALUES (
|
448 |
+
'" .$wpdb->escape($point->address). "',
|
449 |
+
'" .$wpdb->escape($point->ltlg) . "',
|
450 |
+
'" .$wpdb->escape($point->post_id) . "',
|
451 |
+
'" .current_time('mysql'). "',
|
452 |
+
'" .$wpdb->escape($point->title) . "',
|
453 |
+
'" .$wpdb->escape($point->description). "',
|
454 |
+
'" .$wpdb->escape($point->icon). "',
|
455 |
+
'" .$wpdb->escape($point->thumbnail) . "'
|
456 |
+
);";
|
457 |
+
|
458 |
+
$results = $wpdb->query( $insert );
|
459 |
+
if ($results == 1) return true;
|
460 |
+
else return false;
|
461 |
+
}
|
462 |
+
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
function gmshc_update_db_point($point){
|
467 |
+
|
468 |
+
global $wpdb;
|
469 |
+
|
470 |
+
$table_name = $wpdb->prefix . "gmshc";
|
471 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
472 |
+
return false;
|
473 |
+
|
474 |
+
} else {
|
475 |
+
|
476 |
+
$update = "UPDATE `". $table_name ."` SET
|
477 |
+
address = '" .$wpdb->escape($point->address). "',
|
478 |
+
ltlg = '" .$wpdb->escape($point->ltlg) . "',
|
479 |
+
post_id = '" .$wpdb->escape($point->post_id) . "',
|
480 |
+
time = '" .current_time('mysql'). "',
|
481 |
+
title = '" .$wpdb->escape($point->title) . "',
|
482 |
+
description = '" .$wpdb->escape($point->description). "',
|
483 |
+
icon = '" .$wpdb->escape($point->icon). "',
|
484 |
+
thumbnail = '" .$wpdb->escape($point->thumbnail) . "'
|
485 |
+
WHERE id = '".$point->id."';";
|
486 |
+
|
487 |
+
$results = $wpdb->query( $update );
|
488 |
+
if ($results == 1) return true;
|
489 |
+
else return false;
|
490 |
+
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
function gmshc_delete_db_point($id){
|
495 |
+
|
496 |
+
global $wpdb;
|
497 |
+
|
498 |
+
$table_name = $wpdb->prefix . "gmshc";
|
499 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
500 |
+
return false;
|
501 |
+
|
502 |
+
} else {
|
503 |
+
|
504 |
+
$delete = "DELETE FROM `". $table_name ."` WHERE id = '".$id."';";
|
505 |
+
$results = $wpdb->query( $delete );
|
506 |
+
if ($results == 1) return true;
|
507 |
+
else return false;
|
508 |
+
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
function gmshc_get_bd_points($post_id) {
|
513 |
+
|
514 |
+
global $wpdb;
|
515 |
+
|
516 |
+
$table_name = $wpdb->prefix . "gmshc";
|
517 |
+
|
518 |
+
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
519 |
+
|
520 |
+
if ( defined( 'DB_CHARSET' ) ) $charset = DB_CHARSET;
|
521 |
+
else $charset = 'utf8';
|
522 |
+
|
523 |
+
$sql = "CREATE TABLE " . $table_name . " (
|
524 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
525 |
+
post_id mediumint(9) NOT NULL,
|
526 |
+
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
527 |
+
address VARCHAR(200) DEFAULT '' NOT NULL,
|
528 |
+
ltlg VARCHAR(55) DEFAULT '' NOT NULL,
|
529 |
+
title text NOT NULL,
|
530 |
+
description text NOT NULL,
|
531 |
+
icon text NOT NULL,
|
532 |
+
thumbnail text NOT NULL,
|
533 |
+
UNIQUE KEY id (id)
|
534 |
+
) COLLATE utf8_general_ci CHARACTER SET ".$charset.";";
|
535 |
+
|
536 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
537 |
+
dbDelta($sql);
|
538 |
+
|
539 |
+
} else {
|
540 |
+
|
541 |
+
$sql = "SELECT * FROM ". $table_name ." WHERE post_id = ".$post_id;
|
542 |
+
return $wpdb->get_results($sql,ARRAY_A);
|
543 |
+
|
544 |
+
}
|
545 |
+
|
546 |
+
}
|
547 |
+
|
548 |
?>
|
js/gmshc-admin.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* Google Map Shortcode
|
3 |
-
* Version:
|
4 |
* Author: Alain Gonzalez
|
5 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
6 |
*/
|
@@ -24,17 +24,25 @@
|
|
24 |
parent.tb_remove();
|
25 |
});
|
26 |
|
27 |
-
$("
|
28 |
var mapDiv = $("#gmshc_map");
|
29 |
-
var
|
|
|
30 |
if (mapDiv.height() >1) {
|
31 |
-
mapDiv.height("
|
32 |
mapBtn.text(mapBtn.attr("show"));
|
|
|
|
|
33 |
} else {
|
34 |
mapDiv.height("440");
|
35 |
-
mapBtn.text(mapBtn.attr("hide"));
|
|
|
|
|
36 |
}
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
$("#windowhtml").change(function(){
|
40 |
$("#gmshc_html_previews").html($(this).val());
|
@@ -43,10 +51,15 @@
|
|
43 |
var winHtml = $("#windowhtml").val();
|
44 |
|
45 |
$("#windowhtml").val($.trim(winHtml));
|
46 |
-
|
47 |
-
gmshc_update_editor_custom_field();
|
48 |
|
49 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
function gmshc_switchImg(obj) {
|
52 |
var iconSrc = obj.children("img").attr("src");
|
@@ -60,7 +73,7 @@
|
|
60 |
|
61 |
var str = gmshc_generate_sc();
|
62 |
var win = window.dialogArguments || opener || parent || top;
|
63 |
-
win.send_to_editor(str);
|
64 |
|
65 |
}
|
66 |
|
@@ -95,32 +108,32 @@
|
|
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;
|
122 |
-
var gmshcDivPostCustomStuff = jQueryParent("#postcustom input:[value=google-map-sc]").parents("tr");
|
123 |
-
if (gmshcDivPostCustomStuff.length > 0) jQueryParent("textarea",gmshcDivPostCustomStuff).val(mapData);
|
124 |
}
|
125 |
|
126 |
function gmshc_delete_point(id,msg){
|
@@ -136,8 +149,7 @@
|
|
136 |
return false;
|
137 |
}
|
138 |
}
|
139 |
-
|
140 |
-
|
141 |
|
142 |
})(jQuery);
|
143 |
|
1 |
/**
|
2 |
* Google Map Shortcode
|
3 |
+
* Version: 3.0
|
4 |
* Author: Alain Gonzalez
|
5 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
6 |
*/
|
24 |
parent.tb_remove();
|
25 |
});
|
26 |
|
27 |
+
$(".gmshc_show").click(function(){
|
28 |
var mapDiv = $("#gmshc_map");
|
29 |
+
var refreshMap = $(".gmshc_refresh");
|
30 |
+
var mapBtn = $(".gmshc_show");
|
31 |
if (mapDiv.height() >1) {
|
32 |
+
mapDiv.height("0");
|
33 |
mapBtn.text(mapBtn.attr("show"));
|
34 |
+
refreshMap.hide();
|
35 |
+
$("#iframe_sc").hide();
|
36 |
} else {
|
37 |
mapDiv.height("440");
|
38 |
+
mapBtn.text(mapBtn.attr("hide"));
|
39 |
+
refreshMap.show();
|
40 |
+
deploy_map();
|
41 |
}
|
42 |
+
return false;
|
43 |
+
});
|
44 |
+
|
45 |
+
$(".gmshc_refresh").click(deploy_map);
|
46 |
|
47 |
$("#windowhtml").change(function(){
|
48 |
$("#gmshc_html_previews").html($(this).val());
|
51 |
var winHtml = $("#windowhtml").val();
|
52 |
|
53 |
$("#windowhtml").val($.trim(winHtml));
|
|
|
|
|
54 |
|
55 |
});
|
56 |
+
|
57 |
+
function deploy_map(){
|
58 |
+
urlP = gmshc_generate_sc();
|
59 |
+
var iframeUrl = $("#iframe_url").val()+"map=true&"+urlP[1];
|
60 |
+
$("#iframe_sc").show().attr("src",iframeUrl);
|
61 |
+
$("#gmshc_map").focus();
|
62 |
+
}
|
63 |
|
64 |
function gmshc_switchImg(obj) {
|
65 |
var iconSrc = obj.children("img").attr("src");
|
73 |
|
74 |
var str = gmshc_generate_sc();
|
75 |
var win = window.dialogArguments || opener || parent || top;
|
76 |
+
win.send_to_editor(str[0]);
|
77 |
|
78 |
}
|
79 |
|
108 |
var defaultFocusType= $("#default_focus_type").val();
|
109 |
|
110 |
str = "[google-map-sc";
|
111 |
+
urlP = "";
|
112 |
if (width != defaultWidth)
|
113 |
str += " width=\""+width+"\"";
|
114 |
+
urlP += "width="+width+"&";
|
115 |
if (height != defaultHeight)
|
116 |
str += " height=\""+height+"\"";
|
117 |
+
urlP += "height="+height+"&";
|
118 |
if (margin != defaultMargin)
|
119 |
+
str += " margin=\""+margin+"\"";
|
120 |
if (align != defaultAlign)
|
121 |
str += " align=\""+align+"\"";
|
122 |
if (zoom != defaultZoom)
|
123 |
str += " zoom=\""+zoom+"\"";
|
124 |
+
urlP += "zoom="+zoom+"&";
|
125 |
if(type != defaultType)
|
126 |
+
str += " type=\""+type+"\"";
|
127 |
+
urlP += "type="+type+"&";
|
128 |
if(focusPoint != defaultFocusPoint)
|
129 |
str += " focus=\""+focusPoint+"\"";
|
130 |
+
urlP += "focus="+focusPoint+"&";
|
131 |
if(focusType != defaultFocusType)
|
132 |
+
str += " focus_type=\""+focusType+"\"";
|
133 |
+
urlP += "focus_type="+focusType;
|
134 |
str +="]";
|
135 |
|
136 |
+
return [str,urlP];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
|
139 |
function gmshc_delete_point(id,msg){
|
149 |
return false;
|
150 |
}
|
151 |
}
|
152 |
+
|
|
|
153 |
|
154 |
})(jQuery);
|
155 |
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=suppo
|
|
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:
|
8 |
|
9 |
Real Friendly integration of Google Map instances into your blogs. The plugin allows to display multiple maps on your pages.
|
10 |
== Description ==
|
@@ -14,13 +14,14 @@ This plugin allows you to include instances of Google Map in your blogs with a s
|
|
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.
|
@@ -48,9 +49,22 @@ Please contact me [alaingoga at gmail] in order to include your language within
|
|
48 |
|
49 |
Yes, the plugin includes some markers images powered by [Maps Icons Collection](http://mapicons.nicolasmollet.com) but you can upload your own icon.
|
50 |
|
51 |
-
= The plugin allows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
Yes, you can use different laguages address.
|
54 |
|
55 |
== Screenshots ==
|
56 |
|
@@ -62,6 +76,11 @@ Yes, you can use different laguages address.
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
= 2.2.3 =
|
66 |
* French language added.
|
67 |
* Special characters bugs fixed.
|
@@ -116,8 +135,9 @@ Yes, you can use different laguages address.
|
|
116 |
|
117 |
= 1.0.0 =
|
118 |
* Initial release.
|
|
|
119 |
|
120 |
== Upgrade Notice ==
|
121 |
|
122 |
-
=
|
123 |
-
Upgrade is recommended to
|
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: 3.0
|
8 |
|
9 |
Real Friendly integration of Google Map instances into your blogs. The plugin allows to display multiple maps on your pages.
|
10 |
== Description ==
|
14 |
|
15 |
Special Features:
|
16 |
|
17 |
+
* The plugin can handle large number of map points.
|
18 |
+
* Points can be added using address or coordinates.
|
19 |
+
* Addresses in different languages allowed.
|
20 |
* The Editor button allows to include points and maps.
|
21 |
* Custom markers allowed.
|
22 |
* Based on Google Maps Javascript API Version 3.
|
23 |
* Faster and more applicable to mobile devices.
|
|
|
24 |
* Maps in multiple languages.
|
|
|
25 |
* Points under post categories can be included.
|
26 |
* Allows to insert maps into the content and theme files.
|
27 |
* The window box opened display part of the content of your posts like: post title, thumbnails, excerpt or a custom title description and thumbnail.
|
49 |
|
50 |
Yes, the plugin includes some markers images powered by [Maps Icons Collection](http://mapicons.nicolasmollet.com) but you can upload your own icon.
|
51 |
|
52 |
+
= The plugin allows using address in other languages? =
|
53 |
+
|
54 |
+
Yes, you can use addresses in different languages.
|
55 |
+
|
56 |
+
= The custom fields are needed? =
|
57 |
+
|
58 |
+
No, the custom fields are not needed, and it is recommended to delete them after importing the address to the database.
|
59 |
+
|
60 |
+
= The custom fields are needed? =
|
61 |
+
|
62 |
+
No, the custom fields are not needed, and it is recommended to delete them after importing the address to the database.
|
63 |
+
|
64 |
+
= How to use my old custom fields addresses and coordinates? =
|
65 |
+
|
66 |
+
When the map is deployed or when the Google Map Shortcode Editor panel is open in the post. The addresses/coordinates attached to the post using custom fields are imported to the database.
|
67 |
|
|
|
68 |
|
69 |
== Screenshots ==
|
70 |
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 3.0 =
|
80 |
+
* Custom field deprecated.
|
81 |
+
* The point's information is saved in the database.
|
82 |
+
* Points based on coordinates included.
|
83 |
+
|
84 |
= 2.2.3 =
|
85 |
* French language added.
|
86 |
* Special characters bugs fixed.
|
135 |
|
136 |
= 1.0.0 =
|
137 |
* Initial release.
|
138 |
+
|
139 |
|
140 |
== Upgrade Notice ==
|
141 |
|
142 |
+
= 3.0 =
|
143 |
+
Upgrade is recommended to handle large number of points and use addresses in other languages. From this version the custom fields are not needed to be used, all the data will be saved on the database.
|
styles/gmshc-admin-styles.css
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/**
|
2 |
* Google Map Shortcode
|
3 |
-
* Version:
|
4 |
* Author: Alain Gonzalez
|
5 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
6 |
*/
|
@@ -80,18 +80,20 @@ h3.gmshc_editor{
|
|
80 |
|
81 |
body#media-upload ul#sidemenu {
|
82 |
font-weight: normal;
|
83 |
-
margin: 0
|
84 |
left: 0;
|
85 |
bottom: -1px;
|
86 |
float: none;
|
87 |
overflow: hidden;
|
|
|
88 |
}
|
89 |
|
90 |
#icon_credit {
|
91 |
clear: both;
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
}
|
96 |
|
97 |
#icon_credit span{
|
@@ -100,3 +102,20 @@ body#media-upload ul#sidemenu {
|
|
100 |
font-style: italic;
|
101 |
padding: 12px 5px 0;
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* Google Map Shortcode
|
3 |
+
* Version: 3.0
|
4 |
* Author: Alain Gonzalez
|
5 |
* Plugin URI: http://web-argument.com/google-map-shortcode-wordpress-plugin/
|
6 |
*/
|
80 |
|
81 |
body#media-upload ul#sidemenu {
|
82 |
font-weight: normal;
|
83 |
+
margin: 0;
|
84 |
left: 0;
|
85 |
bottom: -1px;
|
86 |
float: none;
|
87 |
overflow: hidden;
|
88 |
+
padding:0;
|
89 |
}
|
90 |
|
91 |
#icon_credit {
|
92 |
clear: both;
|
93 |
+
margin-left: 417px;
|
94 |
+
padding-top: 3px;
|
95 |
+
width: 167px;
|
96 |
+
float: left;
|
97 |
}
|
98 |
|
99 |
#icon_credit span{
|
102 |
font-style: italic;
|
103 |
padding: 12px 5px 0;
|
104 |
}
|
105 |
+
|
106 |
+
#iframe_sc{
|
107 |
+
margin: 0 auto;
|
108 |
+
overflow: hidden;
|
109 |
+
clear: both;
|
110 |
+
display: block;
|
111 |
+
}
|
112 |
+
|
113 |
+
.gmshc_refresh{
|
114 |
+
display:none;
|
115 |
+
}
|
116 |
+
|
117 |
+
.endbox {
|
118 |
+
border-bottom:solid #999 1px;
|
119 |
+
padding-bottom:10px;
|
120 |
+
text-align:left;
|
121 |
+
}
|