PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.3.14
Shortcodes and extra features for Phlox theme v1.3.14
2.17.22 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 / contact-box.php
auxin-elements / includes / elements Last commit date
about-widget.php 9 years ago accordion-api.php 9 years ago accordion.php 9 years ago attachment-url.php 9 years ago audio.php 9 years ago before-after.php 9 years ago button.php 9 years ago code.php 9 years ago contact-box.php 9 years ago contact-form.php 9 years ago divider.php 9 years ago dropcap.php 9 years ago facebook.php 9 years ago flickr.php 9 years ago gallery.php 9 years ago gmap.php 9 years ago highlight.php 9 years ago image.php 9 years ago instagram-feed.php 9 years ago latest-items.php 10 years ago latest-posts-slider.php 9 years ago popular-posts-widget.php 9 years ago quote.php 9 years ago recent-posts-grid-carousel.php 9 years ago recent-posts-land-style.php 9 years ago recent-posts-masonry.php 9 years ago recent-posts-tiles.php 9 years ago recent-posts-timeline.php 9 years ago recent-posts-widget.php 9 years ago recent-posts.php 9 years ago related-posts.php 9 years ago sample-element.php 9 years ago search.php 9 years ago slider.php 9 years ago socials-list.php 9 years ago tabs-api.php 9 years ago tabs.php 9 years ago text.php 9 years ago touch-slider.php 9 years ago video.php 9 years ago
contact-box.php
464 lines
1 <?php
2 /**
3 * Contact box 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
13 function get_auxin_contact_box( $master_array ) {
14
15 $master_array['aux_contact_box'] = array(
16 'name' => __("[Phlox] Contact Box", 'auxin-elements' ),
17 'auxin_output_callback' => 'auxin_widget_contact_box',
18 'base' => 'aux_contact_box',
19 'description' => __('It adds a contact box element.', 'auxin-elements'),
20 'class' => 'aux-widget-contact-box',
21 'show_settings_on_create' => true,
22 'weight' => 1,
23 'category' => THEME_NAME,
24 'group' => '',
25 'admin_enqueue_js' => '',
26 'admin_enqueue_css' => '',
27 'front_enqueue_js' => '',
28 'front_enqueue_css' => '',
29 'icon' => 'auxin-element auxin-message-box',
30 'custom_markup' => '',
31 'js_view' => '',
32 'html_template' => '',
33 'deprecated' => '',
34 'content_element' => '',
35 'as_parent' => '',
36 'as_child' => '',
37 'params' => array(
38 array(
39 'heading' => __('Title','auxin-elements'),
40 'description' => __('Contact box title, leave it empty if you don`t need title.', 'auxin-elements'),
41 'param_name' => 'title',
42 'type' => 'textfield',
43 'value' => '',
44 'holder' => 'textfield',
45 'class' => 'id',
46 'admin_label' => false,
47 'dependency' => '',
48 'weight' => '',
49 'group' => '' ,
50 'edit_field_class' => ''
51 ),
52 array(
53 'heading' => __('Email','auxin-elements'),
54 'description' => __('Contact box email address.', 'auxin-elements'),
55 'param_name' => 'email',
56 'type' => 'textfield',
57 'value' => '',
58 'holder' => '',
59 'class' => 'title',
60 'admin_label' => false,
61 'dependency' => '',
62 'weight' => '',
63 'group' => '' ,
64 'edit_field_class' => ''
65 ),
66 array(
67 'heading' => __('Telephone','auxin-elements'),
68 'description' => __('Contact box phone number.', 'auxin-elements'),
69 'param_name' => 'telephone',
70 'type' => 'textfield',
71 'value' => '',
72 'holder' => '',
73 'class' => 'telephone',
74 'admin_label' => false,
75 'weight' => '',
76 'group' => '',
77 'edit_field_class' => ''
78 ),
79 array(
80 'heading' => __('Address','auxin-elements'),
81 'description' => __('Contact box address.', 'auxin-elements'),
82 'param_name' => 'address',
83 'type' => 'textfield',
84 'value' => '',
85 'holder' => '',
86 'class' => '',
87 'admin_label' => false,
88 'weight' => '',
89 'group' => '',
90 'edit_field_class' => ''
91 ),
92 array(
93 'heading' => __('Show socials','auxin-elements'),
94 'description' => __('Show socials below the info.','auxin-elements'),
95 'param_name' => 'show_socials',
96 'type' => 'aux_switch',
97 'def_value' => '',
98 'value' => '1',
99 'holder' => '',
100 'class' => 'show_socials',
101 'admin_label' => false,
102 'dependency' => '',
103 'weight' => '',
104 'group' => '' ,
105 'edit_field_class' => ''
106 ),
107 array(
108 'heading' => __('Show map','auxin-elements'),
109 'description' => __('Show map above the info.','auxin-elements'),
110 'param_name' => 'show_map',
111 'type' => 'aux_switch',
112 'def_value' => '',
113 'value' => '1',
114 'holder' => '',
115 'class' => 'show_map',
116 'admin_label' => false,
117 'dependency' => '',
118 'weight' => '',
119 'group' => '' ,
120 'edit_field_class' => ''
121 ),
122 array(
123 'heading' => __('Map position','auxin-elements'),
124 'description' => __('Whether to show map above the contact details or below them.', 'auxin-elements'),
125 'param_name' => 'map_position',
126 'type' => 'dropdown',
127 'value' => array(
128 'down' => __('Below the contact details.', 'auxin-elements' ),
129 'up' => __('Above the contact details.', 'auxin-elements' )
130 ),
131 'def_value' => 'down',
132 'holder' => '',
133 'class' => 'map_position',
134 'admin_label' => false,
135 'dependency' => array(
136 'element' => 'show_map',
137 'value' => '1'
138 ),
139 'weight' => '',
140 'group' => 'Map Options',
141 'edit_field_class' => ''
142 ),
143 array(
144 'heading' => __('Map height','auxin-elements'),
145 'description' => __('Height of the map in pixels.', 'auxin-elements'),
146 'param_name' => 'height',
147 'type' => 'textfield',
148 'value' => '160',
149 'def_value' => '160',
150 'holder' => '',
151 'class' => 'height',
152 'admin_label' => false,
153 'dependency' => array(
154 'element' => 'show_map',
155 'value' => '1'
156 ),
157 'weight' => '',
158 'group' => 'Map Options',
159 'edit_field_class' => ''
160 ),
161 array(
162 'heading' => __('Latitude','auxin-elements'),
163 'description' => __('Latitude location over the map.', 'auxin-elements'),
164 'param_name' => 'latitude',
165 'type' => 'textfield',
166 'value' => '40.7',
167 'holder' => '',
168 'class' => '',
169 'admin_label' => false,
170 'dependency' => array(
171 'element' => 'show_map',
172 'value' => '1'
173 ),
174 'weight' => '',
175 'group' => 'Map Options',
176 'edit_field_class' => ''
177 ),
178 array(
179 'heading' => __('Longitude','auxin-elements'),
180 'description' => __('Longitude location over the map.', 'auxin-elements'),
181 'param_name' => 'longitude',
182 'type' => 'textfield',
183 'value' => '-74',
184 'holder' => '',
185 'class' => '',
186 'admin_label' => false,
187 'dependency' => array(
188 'element' => 'show_map',
189 'value' => '1'
190 ),
191 'weight' => '',
192 'group' => 'Map Options',
193 'edit_field_class' => ''
194 ),
195 array(
196 'heading' => __('Map type','auxin-elements'),
197 'param_name' => 'type',
198 'type' => 'dropdown',
199 'def_value' => 'ROADMAP',
200 'value' => array( 'ROADMAP' => __('ROADMAP', 'auxin-elements'), 'SATELLITE' => __('SATELLITE', 'auxin-elements') ),
201 'holder' => '',
202 'class' => 'type',
203 'dependency' => array(
204 'element' => 'show_map',
205 'value' => '1'
206 ),
207 'admin_label' => false,
208 'weight' => '',
209 'group' => 'Map Options',
210 'edit_field_class' => ''
211 ),
212 array(
213 'heading' => __('Map style','auxin-elements'),
214 'description' => __('This feild allows you to customize the presentation of the standard Google base maps. You can find many preset styles in ', 'auxin-elements') .
215 '<a href="https://snazzymaps.com/" target="_blank">' . __('this website.', 'auxin-elements') . '</a>' ,
216 'param_name' => 'style',
217 'type' => 'textarea_raw_html',
218 'def_value' => '',
219 'value' => '',
220 'holder' => '',
221 'class' => 'style',
222 'admin_label' => false,
223 'dependency' => array(
224 // array(
225 'element' => 'show_map',
226 'value' => '1'
227 // ),
228 // @TODO: this kind of dependency is not working we should fix it later
229 // array(
230 // 'element' => 'type',
231 // 'value' => 'ROADMAP'
232 // ),
233 // 'relation'=> 'and'
234 ),
235 'weight' => '',
236 'group' => 'Map Options',
237 'edit_field_class' => ''
238 ),
239 array(
240 'heading' => __('Marker info','auxin-elements'),
241 'description' => __('Marker popup text, leave it empty if you don\'t need it.', 'auxin-elements'),
242 'param_name' => 'marker_info',
243 'type' => 'textfield',
244 'value' => '',
245 'def_value' => '',
246 'holder' => '',
247 'class' => 'marker_info',
248 'admin_label' => false,
249 'dependency' => array(
250 'element' => 'show_map',
251 'value' => '1'
252 ),
253 'weight' => '',
254 'group' => 'Map Options',
255 'edit_field_class' => ''
256 ),
257 array(
258 'heading' => __('Navigation control','auxin-elements'),
259 'description' => __('Show nacigation control on map.','auxin-elements'),
260 'param_name' => 'show_mapcontrols',
261 'type' => 'aux_switch',
262 'def_value' => '',
263 'value' => '0',
264 'holder' => '',
265 'class' => 'show_mapcontrols',
266 'admin_label' => false,
267 'dependency' => array(
268 'element' => 'show_map',
269 'value' => '1'
270 ),
271 'weight' => '',
272 'group' => 'Map Options',
273 'edit_field_class' => ''
274 ),
275 array(
276 'heading' => __('Zoom','auxin-elements'),
277 'description' => __('The initial resolution at which to display the map, between 1 to 20.', 'auxin-elements'),
278 'param_name' => 'zoom',
279 'type' => 'textfield',
280 'value' => '10',
281 'holder' => '',
282 'class' => '',
283 'admin_label' => false,
284 'dependency' => array(
285 'element' => 'show_map',
286 'value' => '1'
287 ),
288 'weight' => '',
289 'group' => 'Map Options',
290 'edit_field_class' => ''
291 ),
292 array(
293 'heading' => __('Zoom with mouse wheel','auxin-elements'),
294 'description' => '',
295 'param_name' => 'zoom_wheel',
296 'type' => 'aux_switch',
297 'def_value' => '',
298 'value' => '0',
299 'holder' => '',
300 'class' => 'zoom_wheel',
301 'admin_label' => false,
302 'dependency' => array(
303 'element' => 'show_map',
304 'value' => '1'
305 ),
306 'weight' => '',
307 'group' => 'Map Options',
308 'edit_field_class' => ''
309 ),
310 array(
311 'heading' => __('Extra class name','auxin-elements'),
312 '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'),
313 'param_name' => 'extra_classes',
314 'type' => 'textfield',
315 'value' => '',
316 'def_value' => '',
317 'holder' => '',
318 'class' => 'extra_classes',
319 'admin_label' => false,
320 'dependency' => '',
321 'weight' => '',
322 'group' => '' ,
323 'edit_field_class' => ''
324 )
325 )
326 );
327
328 return $master_array;
329 }
330
331 add_filter( 'auxin_master_array_shortcodes', 'get_auxin_contact_box', 10, 1 );
332
333 /**
334 * The front-end output of this element is returned by the following function
335 *
336 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
337 * @param string $shortcode_content The shorcode content
338 * @return string The output of element markup
339 */
340 function auxin_widget_contact_box( $atts, $shortcode_content = null ){
341
342 // Defining default attributes
343 $default_atts = array(
344 'title' => '', // header title
345 'style' => '',
346 'show_map' => '1',
347 'map_position' => 'down',
348 'show_socials' => '1',
349 'email' => '',
350 'telephone' => '',
351 'address' => '',
352 'type' => 'ROADMAP',
353 'zoom' => '10',
354 'zoom_wheel' => '0',
355 'marker_info' => '',
356 'show_mapcontrols' => '0',
357 'latitude' => 40.7,
358 'longitude' => -74,
359 'height' => 160,
360
361 'extra_classes' => '', // custom css class names for this element
362 'custom_el_id' => '',
363 'base_class' => 'aux-widget-contact-box' // base class name for container
364 );
365
366 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
367 extract( $result['parsed_atts'] );
368
369 ob_start();
370
371 // widget header ------------------------------
372 echo $result['widget_header'];
373 echo $result['widget_title'];
374
375 $contact_info = '<div class="aux-contact-details"><ul>';
376 if( ! empty( $telephone ) ){
377 $contact_info .= '<li class="phone"><i class="auxicon-phone-classic-on"></i><span class="info-text">'. esc_html( $telephone ) .'</span></li>';
378 }
379 if( ! empty( $email ) ){
380 $contact_info .= '<li class="email"><i class="auxicon-mail-3"></i><span class="info-text">'. antispambot( $email ) .'</span></li>';
381 }
382 if( ! empty( $address ) ){
383 $contact_info .= '<li class="address"><i class="auxicon-map-pin-streamline"></i><span class="info-text">'. esc_html( $address ) .'</span></li>';
384 }
385 $contact_info .= '</ul>';
386 if( $show_socials ) {
387 $contact_info .= auxin_get_the_socials();
388 }
389 $contact_info .= '</div>';
390
391 // Print the contact info above the map if the position option is set to 'up'
392 if( 'down' !== $map_position ){
393 echo $contact_info;
394 }
395
396 if( auxin_is_true( $show_map ) ) {
397 $mapid = uniqid("aux-map");
398 $marker_title = '';
399
400 if ( empty( $style ) ) {
401 $style = auxin_get_gmap_style();
402 } elseif ( base64_decode( $style, true ) === false) {
403
404 } else {
405 $style = rawurldecode( base64_decode( strip_tags( $style ) ) );
406 }
407
408 ?>
409 <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>
410
411 <script>
412 jQuery( function($) {
413 if(typeof GMaps != "function" || typeof google === "undefined"){
414 console.info( "Please add google map API key in theme options. https://developers.google.com/maps/documentation/javascript/" );
415 return;
416 }
417 var map = new GMaps({
418 el: "#<?php echo esc_attr( $mapid ); ?>",
419 lat: <?php echo esc_attr( $latitude ); ?>,
420 lng: <?php echo esc_attr( $longitude ); ?>,
421 zoom: <?php echo esc_attr( $zoom ); ?>,
422 scrollwheel: <?php echo esc_attr( $zoom_wheel ); ?>,
423 <?php if( $type == "SATELLITE" ){ ?>
424 mapTypeId: google.maps.MapTypeId.SATELLITE,
425 <?php } else { ?>
426 mapTypeId: google.maps.MapTypeId.ROADMAP,
427 <?php } if ( $show_mapcontrols == false ) { ?>
428 disableDefaultUI: true,
429 <?php } ?>
430 panControl : true
431 });
432
433 <?php if( $type == "ROADMAP" ){ ?>
434 map.addStyle({
435 styledMapName:"Auxin custom style map",
436 styles: <?php echo $style; ?>,
437 mapTypeId: "aux_map_style"
438 });
439
440 map.setStyle("aux_map_style");
441 <?php } ?>
442 map.addMarker({
443 <?php if ( ! empty( $marker_info ) ) { ?>
444 infoWindow: { content: "<?php echo esc_html( $marker_info ); ?>" },
445 <?php } ?>
446 lat: <?php echo esc_attr( $latitude ); ?>,
447 lng: <?php echo esc_attr( $longitude ); ?>
448 });
449 });
450
451 </script>
452 <?php
453 }
454
455 if( 'down' === $map_position ){
456 echo $contact_info;
457 }
458
459 // widget footer ------------------------------
460 echo $result['widget_footer'];
461
462 return ob_get_clean();
463 }
464