PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.5.13
Shortcodes and extra features for Phlox theme v2.5.13
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 6 years ago accordion-widget.php 6 years ago accordion.php 6 years ago attachment-url.php 6 years ago audio.php 6 years ago before-after.php 6 years ago button.php 6 years ago code.php 6 years ago contact-box.php 6 years ago contact-form.php 6 years ago custom-list.php 6 years ago divider.php 6 years ago dropcap.php 6 years ago facebook.php 6 years ago flickr.php 6 years ago gallery.php 6 years ago general-element-fields.php 6 years ago gmap.php 6 years ago highlight.php 6 years ago image.php 6 years ago instagram-feed.php 6 years ago latest-items.php 8 years ago latest-posts-slider.php 6 years ago popular-posts-widget.php 6 years ago quote.php 6 years ago recent-posts-grid-carousel.php 6 years ago recent-posts-land-style.php 6 years ago recent-posts-masonry.php 6 years ago recent-posts-tiles-carousel.php 6 years ago recent-posts-tiles.php 6 years ago recent-posts-timeline.php 6 years ago recent-posts-widget.php 6 years ago recent-products.php 6 years ago related-posts.php 8 years ago sample-element.php 6 years ago search.php 6 years ago socials-list.php 6 years ago staff.php 6 years ago tab-widget.php 6 years ago tabs.php 6 years ago testimonial.php 6 years ago text.php 6 years ago touch-slider.php 6 years ago video.php 6 years ago
gmap.php
340 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-2020 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 $result['widget_header'];
256 echo $result['widget_title'];
257
258 $mapid = uniqid("aux-map");
259
260 if ( class_exists('WeDevs_Dokan') ) {
261
262 if ( dokan_is_store_page() ) {
263 $store_info = dokan_get_store_info( get_query_var( 'author' ) );
264 $map_location = isset( $store_info['location'] ) ? esc_attr( $store_info['location'] ): '';
265 $latitude = isset( $locations[0] ) ? $locations[0] : $latitude;
266 $longitude = isset( $locations[1] ) ? $locations[1] : $longitude;
267 }
268
269 }
270
271
272 if ( empty( $style ) ) {
273 $style = auxin_get_gmap_style();
274 } elseif ( base64_decode( $style, true ) === false) {
275 } else {
276 $style = rawurldecode( base64_decode( strip_tags( $style ) ) );
277 }
278
279 $zoom_wheel = auxin_is_true( $zoom_wheel ) ? 'true' : 'false';
280
281 ?>
282
283 <div class="aux-col-wrapper aux-no-gutter">
284 <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>
285
286 <script>
287 jQuery( function($) {
288 if(typeof GMaps != "function" || typeof google === "undefined"){
289 console.info( "Please add google map API key in theme options. https://developers.google.com/maps/documentation/javascript/" );
290 return;
291 }
292 var map = new GMaps({
293 el: "#<?php echo esc_attr( $mapid ); ?>",
294 lat: <?php echo esc_attr( $latitude ); ?>,
295 lng: <?php echo esc_attr( $longitude ); ?>,
296 zoom: <?php echo esc_attr( $zoom ); ?>,
297 scrollwheel: <?php echo esc_attr( $zoom_wheel ) ;?>,
298 <?php if( $type == "SATELLITE" ){ ?>
299 mapTypeId: google.maps.MapTypeId.SATELLITE,
300 <?php } else { ?>
301 mapTypeId: google.maps.MapTypeId.ROADMAP,
302 <?php } if ( $show_mapcontrols == false ) { ?>
303 disableDefaultUI: true,
304 <?php } ?>
305 panControl : true
306 });
307
308 <?php if( $type == "ROADMAP" ){ ?>
309 map.addStyle({
310 styledMapName:"Auxin custom style map",
311 styles: <?php echo $style; ?>,
312 mapTypeId: "aux_map_style"
313 });
314
315 map.setStyle("aux_map_style");
316 <?php } ?>
317 map.addMarker({
318 <?php if ( ! empty( $marker_info ) ) { ?>
319 infoWindow: { content: "<?php echo esc_html( $marker_info ); ?>" },
320 <?php } ?>
321 lat : <?php echo esc_attr( $latitude ); ?>,
322 lng : <?php echo esc_attr( $longitude ); ?>,
323 <?php if ( ! empty( $attach_id ) ) { ?>
324 icon: "<?php echo esc_attr( auxin_get_attachment_url( $attach_id, 'full' ) ); ?>"
325 <?php } ?>
326
327 });
328 });
329
330 </script>
331
332 </div><!-- aux-col-wrapper -->
333
334 <?php
335 // widget footer ------------------------------
336 echo $result['widget_footer'];
337
338 return ob_get_clean();
339 }
340