forked from logaan/Comprehensive-Google-Map-Plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
shortcode.php
100 lines (82 loc) · 3.36 KB
/
shortcode.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/*
Copyright (C) 2011 Alexander Zagniotov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if ( !function_exists('cgmp_shortcode_googlemap_handler') ):
function cgmp_shortcode_googlemap_handler($attr, $content = null, $code = null) {
if (is_admin() || is_feed()) {
return;
}
$shortcode_attribs = shortcode_atts(array(
'latitude' => 0,
'longitude' => 0,
'zoom' => '7',
'width' => 400,
'height' => 400,
'maptype' => 'ROADMAP',
'maptypecontrol' => 'true',
'pancontrol' => 'true',
'addresscontent' => '',
'zoomcontrol' => 'true',
'scalecontrol' => 'true',
'streetviewcontrol' => 'true',
'scrollwheelcontrol' => 'false',
'showbike' => 'false',
'bubbleautopan' => 'false',
'showtraffic' => 'false',
'showpanoramio' => 'false',
'addmarkerlist' => '',
'kml' => '',
'directionhint' => 'false',
'mapalign' => 'center',
'panoramiouid' => '',
'addmarkermashup' => 'false',
'language' => 'default',
'poweredby' => 'false',
'draggable' => 'true',
'tiltfourtyfive' => 'false',
'addmarkermashupbubble' => 'false'), $attr);
extract($shortcode_attribs);
$id = md5(time().' '.rand());
$addmarkerlist = strip_tags($addmarkerlist);
if ($addmarkermashup == 'true') {
$addmarkerlist = make_marker_geo_mashup();
} else if ($addmarkermashup == 'false') {
$addmarkerlist = update_markerlist_from_legacy_locations($latitude, $longitude, $addresscontent, $addmarkerlist);
$addmarkerlist = htmlspecialchars($addmarkerlist);
}
$bad_entities = array(""", "'");
$addmarkerlist = str_replace($bad_entities, "", $addmarkerlist);
$addmarkerlist = cgmp_parse_wiki_style_links($addmarkerlist);
$map_data_properties = array();
$not_map_data_properties = array("title", "latitude", "longitude", "addresscontent", "addmarkerlist", "showmarker",
"animation", "infobubblecontent", "markerdirections", "locationaddmarkerinput", "bubbletextaddmarkerinput");
foreach ($shortcode_attribs as $key => $value) {
$value = trim($value);
$value = (!isset($value) || empty($value)) ? '' : esc_attr(strip_tags($value));
if (!in_array($key, $not_map_data_properties)) {
$key = str_replace("hidden", "", $key);
$key = str_replace("_", "", $key);
$map_data_properties[$key] = $value;
}
}
$map_data_properties['id'] = $id;
$map_data_properties['markerlist'] = $addmarkerlist;
$map_data_properties['kml'] = cgmp_clean_kml($map_data_properties['kml']);
$map_data_properties['panoramiouid'] = cgmp_clean_panoramiouid($map_data_properties['panoramiouid']);
cgmp_set_google_map_language($language);
cgmp_map_data_injector(json_encode($map_data_properties), $id);
return cgmp_draw_map_placeholder($id, $width, $height, $mapalign, $directionhint, $poweredby);
}
endif;
?>