PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.7.0
Shortcodes and extra features for Phlox theme v1.7.0
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 8 years ago accordion-api.php 9 years ago accordion.php 8 years ago attachment-url.php 9 years ago audio.php 8 years ago before-after.php 8 years ago button.php 8 years ago code.php 8 years ago contact-box.php 8 years ago contact-form.php 8 years ago divider.php 8 years ago dropcap.php 8 years ago facebook.php 8 years ago flickr.php 8 years ago gallery.php 8 years ago gmap.php 8 years ago highlight.php 8 years ago image.php 8 years ago instagram-feed.php 8 years ago latest-items.php 8 years ago latest-posts-slider.php 8 years ago popular-posts-widget.php 8 years ago quote.php 8 years ago recent-posts-grid-carousel.php 8 years ago recent-posts-land-style.php 8 years ago recent-posts-masonry.php 8 years ago recent-posts-tiles.php 8 years ago recent-posts-timeline.php 8 years ago recent-posts-widget.php 8 years ago recent-posts.php 9 years ago related-posts.php 8 years ago sample-element.php 8 years ago search.php 8 years ago slider.php 9 years ago socials-list.php 8 years ago staff.php 8 years ago tabs-api.php 9 years ago tabs.php 8 years ago testimonial.php 8 years ago testomonial.php 8 years ago text.php 8 years ago touch-slider.php 8 years ago video.php 8 years ago
gmap.php
303 lines
1 <?php
2 /**
3 * Google Map element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author
9 * @link http://averta.net/phlox/
10 * @copyright (c) 2010-2017
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' => __('Navigation control','auxin-elements' ),
140 'description' => __('Show navigation control on map.','auxin-elements' ),
141 'param_name' => 'show_mapcontrols',
142 'type' => 'aux_switch',
143 'def_value' => '',
144 'value' => '1',
145 'holder' => '',
146 'class' => 'show_mapcontrols',
147 'admin_label' => false,
148 'dependency' => '',
149 'weight' => '',
150 'group' => '' ,
151 'edit_field_class' => ''
152 ),
153 array(
154 'heading' => __('Zoom','auxin-elements' ),
155 'description' => '',
156 'param_name' => 'zoom',
157 'type' => 'textfield',
158 'value' => '4',
159 'holder' => '',
160 'class' => 'zoom',
161 'admin_label' => false,
162 'dependency' => '',
163 'weight' => '',
164 'group' => '' ,
165 'edit_field_class' => ''
166 ),
167 array(
168 'heading' => __('Zoom with mouse wheel','auxin-elements' ),
169 'description' => '',
170 'param_name' => 'zoom_wheel',
171 'type' => 'aux_switch',
172 'value' => '0',
173 'holder' => '',
174 'class' => 'zoom_wheel',
175 'admin_label' => false,
176 'dependency' => '',
177 'weight' => '',
178 'group' => '' ,
179 'edit_field_class' => ''
180 ),
181 array(
182 'heading' => __('Extra class name','auxin-elements' ),
183 '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' ),
184 'param_name' => 'extra_classes',
185 'type' => 'textfield',
186 'value' => '',
187 'holder' => '',
188 'class' => 'extra_classes',
189 'admin_label' => false,
190 'dependency' => '',
191 'weight' => '',
192 'group' => '' ,
193 'edit_field_class' => ''
194 )
195 )
196 );
197
198
199 return $master_array;
200 }
201
202 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_gmap_master_array', 10, 1 );
203
204
205 /**
206 * The front-end output of this element is returned by the following function
207 *
208 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
209 * @param string $shortcode_content The shorcode content
210 * @return string The output of element markup
211 */
212 function auxin_widget_gmaps_callback( $atts, $shortcode_content = null ){
213
214
215 // Defining default attributes
216 $default_atts = array(
217 'title' => '', // header title
218 'type' => 'ROADMAP',
219 'style' => '',
220 'height' => 700,
221 'latitude' => 40.7,
222 'longitude' => -74,
223 'marker_info' => '', // popup conetent
224 'show_mapcontrols' => 1,
225 'zoom' => 10,
226 'zoom_wheel' => 0,
227
228 'extra_classes' => '', // custom css class names for this element
229 'custom_el_id' => '', // custom id attribute for this element
230 'base_class' => 'aux-widget-gmaps' // base class name for container
231 );
232
233 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
234 extract( $result['parsed_atts'] );
235
236 // widget header ------------------------------
237 echo $result['widget_header'];
238 echo $result['widget_title'];
239
240 $mapid = uniqid("aux-map");
241
242 if ( empty( $style ) ) {
243 $style = auxin_get_gmap_style();
244 } elseif ( base64_decode( $style, true ) === false) {
245 } else {
246 $style = rawurldecode( base64_decode( strip_tags( $style ) ) );
247 }
248
249 ob_start();
250 ?>
251
252 <div class="aux-col-wrapper aux-no-gutter">
253 <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>
254
255 <script>
256 jQuery( function($) {
257 if(typeof GMaps != "function" || typeof google === "undefined"){
258 console.info( "Please add google map API key in theme options. https://developers.google.com/maps/documentation/javascript/" );
259 return;
260 }
261 var map = new GMaps({
262 el: "#<?php echo esc_attr( $mapid ); ?>",
263 lat: <?php echo esc_attr( $latitude ); ?>,
264 lng: <?php echo esc_attr( $longitude ); ?>,
265 zoom: <?php echo esc_attr( $zoom ); ?>,
266 scrollwheel: <?php echo esc_attr( $zoom_wheel ); ?>,
267 <?php if( $type == "SATELLITE" ){ ?>
268 mapTypeId: google.maps.MapTypeId.SATELLITE,
269 <?php } else { ?>
270 mapTypeId: google.maps.MapTypeId.ROADMAP,
271 <?php } if ( $show_mapcontrols == false ) { ?>
272 disableDefaultUI: true,
273 <?php } ?>
274 panControl : true
275 });
276
277 <?php if( $type == "ROADMAP" ){ ?>
278 map.addStyle({
279 styledMapName:"Auxin custom style map",
280 styles: <?php echo $style; ?>,
281 mapTypeId: "aux_map_style"
282 });
283
284 map.setStyle("aux_map_style");
285 <?php } ?>
286 map.addMarker({
287 <?php if ( ! empty( $marker_info ) ) { ?>
288 infoWindow: { content: "<?php echo esc_html( $marker_info ); ?>" },
289 <?php } ?>
290 lat: <?php echo esc_attr( $latitude ); ?>,
291 lng: <?php echo esc_attr( $longitude ); ?>
292 });
293 });
294
295 </script>
296
297 </div><!-- aux-col-wrapper -->
298
299 <?php
300 echo $result['widget_footer'];
301 return ob_get_clean();
302 }
303