PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elements / gmap.php
auxin-elements / includes / elements Last commit date
about-widget.php 1 year ago accordion-widget.php 1 year ago accordion.php 1 year ago attachment-url.php 1 year ago audio.php 1 year ago before-after.php 1 year ago button.php 1 year ago code.php 1 year ago contact-box.php 1 year ago contact-form.php 1 year ago custom-list.php 6 months ago divider.php 1 year ago dropcap.php 1 year ago facebook.php 1 year ago flickr.php 1 year ago gallery.php 1 year ago gmap.php 1 year ago highlight.php 1 year ago image.php 1 year ago instagram-feed.php 1 year ago latest-posts-slider.php 1 year ago popular-posts-widget.php 1 year ago products-grid.php 1 year ago quote.php 1 year ago recent-posts-grid-carousel.php 1 year ago recent-posts-land-style.php 1 year ago recent-posts-masonry.php 1 year ago recent-posts-tiles-carousel.php 1 year ago recent-posts-tiles.php 1 year ago recent-posts-timeline.php 1 year ago recent-posts-widget.php 1 year ago recent-products.php 1 year ago related-posts.php 8 years ago sample-element.php 1 year ago search.php 1 year ago socials-list.php 1 year ago staff.php 1 year ago tab-widget.php 1 year ago tabs.php 1 year ago testimonial.php 1 year ago text.php 1 year ago touch-slider.php 1 year ago video.php 1 year ago
gmap.php
330 lines
1 <?php
2 /**
3 * Google Map element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2025 averta
11 */
12 function auxin_get_gmap_master_array( $master_array ) {
13
14 $master_array['aux_gmaps'] = array(
15 'name' => __('Map ', 'auxin-elements' ),
16 'auxin_output_callback' => 'auxin_widget_gmaps_callback',
17 'base' => 'aux_gmaps',
18 'description' => __('Google map block', 'auxin-elements' ),
19 'class' => 'aux-widget-gmaps',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'category' => THEME_NAME,
23 'group' => '',
24 'admin_enqueue_js' => '',
25 'admin_enqueue_css' => '',
26 'front_enqueue_js' => '',
27 'front_enqueue_css' => '',
28 'icon' => 'aux-element aux-pb-icons-google-maps',
29 'custom_markup' => '',
30 'js_view' => '',
31 'html_template' => '',
32 'deprecated' => '',
33 'content_element' => '',
34 'as_parent' => '',
35 'as_child' => '',
36 'params' => array(
37 array(
38 'heading' => __('Title','auxin-elements' ),
39 'description' => __('Map title, leave it empty if you don`t need title.', 'auxin-elements'),
40 'param_name' => 'title',
41 'type' => 'textfield',
42 'value' => '',
43 'holder' => 'textfield',
44 'class' => 'title',
45 'admin_label' => false,
46 'dependency' => '',
47 'weight' => '',
48 'group' => '' ,
49 'edit_field_class' => ''
50 ),
51 array(
52 'heading' => __('Height','auxin-elements' ),
53 'description' => '',
54 'param_name' => 'height',
55 'type' => 'textfield',
56 'value' => '700',
57 'holder' => '',
58 'class' => 'height',
59 'admin_label' => false,
60 'dependency' => '',
61 'weight' => '',
62 'group' => '' ,
63 'edit_field_class' => ''
64 ),
65 array(
66 'heading' => __('Latitude','auxin-elements' ),
67 'description' => __('Latitude location over the map.','auxin-elements' ),
68 'param_name' => 'latitude',
69 'type' => 'textfield',
70 'value' => '52',
71 'holder' => '',
72 'class' => 'latitude',
73 'admin_label' => false,
74 'dependency' => '',
75 'weight' => '',
76 'group' => '' ,
77 'edit_field_class' => ''
78 ),
79 array(
80 'heading' => __('Longitude','auxin-elements' ),
81 'description' => __('Longitude location over the map.','auxin-elements' ),
82 'param_name' => 'longitude',
83 'type' => 'textfield',
84 'value' => '14',
85 'holder' => '',
86 'class' => 'longitude',
87 'admin_label' => false,
88 'dependency' => '',
89 'weight' => '',
90 'group' => '' ,
91 'edit_field_class' => ''
92 ),
93 array(
94 'heading' => __('Map type','auxin-elements' ),
95 'description' => '',
96 'param_name' => 'type',
97 'type' => 'dropdown',
98 'def_value' => 'ROADMAP',
99 'value' => array( 'ROADMAP' => __('ROADMAP', 'auxin-elements' ), 'SATELLITE' => __('SATELLITE', 'auxin-elements' ) ),
100 'holder' => '',
101 'class' => 'type',
102 'admin_label' => false,
103 'dependency' => '',
104 'weight' => '',
105 'group' => '' ,
106 'edit_field_class' => ''
107 ),
108 array(
109 'heading' => __('Map style','auxin-elements' ),
110 'description' => __('This feild allow you to customize the presentation of the standard Google base maps. You can find many preset styles in ', 'auxin-elements' ) .
111 '<a href="https://snazzymaps.com/" target="_blank">' . __('this website.', 'auxin-elements' ) . '</a>' ,
112 'param_name' => 'style',
113 'type' => 'textarea_raw_html',
114 'def_value' => '',
115 'value' => '',
116 'holder' => '',
117 'class' => 'style',
118 'admin_label' => false,
119 'dependency' => array(
120 'element' => 'type',
121 'value' => 'ROADMAP'
122 )
123 ),
124 array(
125 'heading' => __('Marker info','auxin-elements' ),
126 'description' => __('Marker popup text, leave it empty if you don\'t need it.', 'auxin-elements' ),
127 'param_name' => 'marker_info',
128 'type' => 'textfield',
129 'value' => '',
130 'holder' => '',
131 'class' => 'marker_info',
132 'admin_label' => false,
133 'dependency' => '',
134 'weight' => '',
135 'group' => '' ,
136 'edit_field_class' => ''
137 ),
138 array(
139 'heading' => __('Marker Icon','auxin-elements' ),
140 'description' => __('Pick a small icon for gmaps marker.', 'auxin-elements' ),
141 'param_name' => 'attach_id',
142 'type' => 'attach_image',
143 'value' => '',
144 'def_value' => '',
145 'holder' => '',
146 'class' => 'attach_id',
147 'admin_label' => true,
148 'dependency' => '',
149 'weight' => '',
150 'group' => '' ,
151 'edit_field_class' => ''
152 ),
153 array(
154 'heading' => __('Navigation control','auxin-elements' ),
155 'description' => __('Show navigation control on map.','auxin-elements' ),
156 'param_name' => 'show_mapcontrols',
157 'type' => 'aux_switch',
158 'def_value' => '',
159 'value' => '1',
160 'holder' => '',
161 'class' => 'show_mapcontrols',
162 'admin_label' => false,
163 'dependency' => '',
164 'weight' => '',
165 'group' => '' ,
166 'edit_field_class' => ''
167 ),
168 array(
169 'heading' => __('Zoom','auxin-elements' ),
170 'description' => '',
171 'param_name' => 'zoom',
172 'type' => 'textfield',
173 'value' => '4',
174 'holder' => '',
175 'class' => 'zoom',
176 'admin_label' => false,
177 'dependency' => '',
178 'weight' => '',
179 'group' => '' ,
180 'edit_field_class' => ''
181 ),
182 array(
183 'heading' => __('Zoom with mouse wheel','auxin-elements' ),
184 'description' => '',
185 'param_name' => 'zoom_wheel',
186 'type' => 'aux_switch',
187 'value' => '0',
188 'holder' => '',
189 'class' => 'zoom_wheel',
190 'admin_label' => false,
191 'dependency' => '',
192 'weight' => '',
193 'group' => '' ,
194 'edit_field_class' => ''
195 ),
196 array(
197 'heading' => __('Extra class name','auxin-elements' ),
198 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ),
199 'param_name' => 'extra_classes',
200 'type' => 'textfield',
201 'value' => '',
202 'holder' => '',
203 'class' => 'extra_classes',
204 'admin_label' => false,
205 'dependency' => '',
206 'weight' => '',
207 'group' => '' ,
208 'edit_field_class' => ''
209 )
210 )
211 );
212
213
214 return $master_array;
215 }
216
217 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_gmap_master_array', 10, 1 );
218
219
220 /**
221 * The front-end output of this element is returned by the following function
222 *
223 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
224 * @param string $shortcode_content The shorcode content
225 * @return string The output of element markup
226 */
227 function auxin_widget_gmaps_callback( $atts, $shortcode_content = null ){
228
229
230 // Defining default attributes
231 $default_atts = array(
232 'title' => '', // header title
233 'type' => 'ROADMAP',
234 'style' => '',
235 'height' => 700,
236 'latitude' => 40.7,
237 'longitude' => -74,
238 'attach_id' => '', // popup conetent
239 'marker_info' => '', // popup conetent
240 'show_mapcontrols' => 1,
241 'zoom' => 10,
242 'zoom_wheel' => 0,
243
244 'extra_classes' => '', // custom css class names for this element
245 'custom_el_id' => '', // custom id attribute for this element
246 'base_class' => 'aux-widget-gmaps' // base class name for container
247 );
248
249 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
250 extract( $result['parsed_atts'] );
251
252 ob_start();
253
254 // widget header ------------------------------
255 echo wp_kses_post( $result['widget_header'] );
256 echo wp_kses_post( $result['widget_title'] );
257
258 $mapid = uniqid("aux-map");
259
260 if( is_array( $style ) ){
261 $style = wp_json_encode( $style );
262 } elseif ( empty( $style ) ) {
263 $style = auxin_get_gmap_style();
264 } elseif ( base64_decode( $style, true ) === false) {
265 } else {
266 $style = rawurldecode( base64_decode( wp_strip_all_tags( $style ) ) );
267 }
268
269 $zoom_wheel = auxin_is_true( $zoom_wheel ) ? 'true' : 'false';
270
271 ?>
272
273 <div class="aux-col-wrapper aux-no-gutter">
274 <div id="<?php echo esc_attr( $mapid ); ?>" class="aux-map-wrapper <?php echo esc_attr( $extra_classes ); ?>" style="height:<?php echo esc_attr( $height ); ?>px" ></div>
275
276 <script>
277 jQuery( function($) {
278 if(typeof GMaps != "function" || typeof google === "undefined"){
279 console.info( "Please add google map API key in theme options. https://developers.google.com/maps/documentation/javascript/" );
280 return;
281 }
282 var map = new GMaps({
283 el: "#<?php echo esc_js( esc_attr( $mapid ) ); ?>",
284 lat: <?php echo floatval( $latitude ); ?>,
285 lng: <?php echo floatval( $longitude ); ?>,
286 zoom: <?php echo floatval( $zoom ); ?>,
287 scrollwheel: <?php echo floatval( $zoom_wheel ) ;?>,
288 <?php if( $type == "SATELLITE" ){ ?>
289 mapTypeId: google.maps.MapTypeId.SATELLITE,
290 <?php } else { ?>
291 mapTypeId: google.maps.MapTypeId.ROADMAP,
292 <?php } if ( $show_mapcontrols == false ) { ?>
293 disableDefaultUI: true,
294 <?php } ?>
295 panControl : true
296 });
297
298 <?php if( $type == "ROADMAP" ){ ?>
299 map.addStyle({
300 styledMapName:"Auxin custom style map",
301 styles: <?php echo ( auxin_is_json( $style ) ? $style : auxin_get_gmap_style() ); ?>,
302 mapTypeId: "aux_map_style"
303 });
304
305 map.setStyle("aux_map_style");
306 <?php } ?>
307 map.addMarker({
308 <?php if ( ! empty( $marker_info ) ) { ?>
309 infoWindow: { content: "<?php echo esc_js( esc_html( $marker_info ) ); ?>" },
310 <?php } ?>
311 lat : <?php echo floatval( $latitude ); ?>,
312 lng : <?php echo floatval( $longitude ); ?>,
313 <?php if ( ! empty( $attach_id ) ) { ?>
314 icon: "<?php echo esc_js( esc_url( auxin_get_attachment_url( $attach_id, 'full' ) ) ); ?>"
315 <?php } ?>
316
317 });
318 });
319
320 </script>
321
322 </div><!-- aux-col-wrapper -->
323
324 <?php
325 // widget footer ------------------------------
326 echo wp_kses_post( $result['widget_footer'] );
327
328 return ob_get_clean();
329 }
330