PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.9.17
Shortcodes and extra features for Phlox theme v2.9.17
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 / image.php
auxin-elements / includes / elements Last commit date
about-widget.php 4 years ago accordion-widget.php 4 years ago accordion.php 4 years ago attachment-url.php 4 years ago audio.php 4 years ago before-after.php 4 years ago button.php 4 years ago code.php 4 years ago contact-box.php 4 years ago contact-form.php 4 years ago custom-list.php 4 years ago divider.php 4 years ago dropcap.php 4 years ago facebook.php 4 years ago flickr.php 4 years ago gallery.php 4 years ago general-element-fields.php 4 years ago gmap.php 4 years ago highlight.php 4 years ago image.php 4 years ago instagram-feed.php 4 years ago latest-items.php 4 years ago latest-posts-slider.php 4 years ago popular-posts-widget.php 4 years ago products-grid.php 4 years ago quote.php 4 years ago recent-posts-grid-carousel.php 4 years ago recent-posts-land-style.php 4 years ago recent-posts-masonry.php 4 years ago recent-posts-tiles-carousel.php 4 years ago recent-posts-tiles.php 4 years ago recent-posts-timeline.php 4 years ago recent-posts-widget.php 4 years ago recent-products.php 4 years ago related-posts.php 8 years ago sample-element.php 4 years ago search.php 4 years ago socials-list.php 4 years ago staff.php 4 years ago tab-widget.php 4 years ago tabs.php 4 years ago testimonial.php 4 years ago text.php 4 years ago touch-slider.php 4 years ago video.php 4 years ago
image.php
581 lines
1 <?php
2 /**
3 * Image element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2022 averta
11 */
12 function auxin_get_image_master_array( $master_array ) {
13
14 $master_array['aux_image'] = array(
15 'name' => __("Image", 'auxin-elements' ),
16 'auxin_output_callback' => 'auxin_widget_image_callback',
17 'base' => 'aux_image',
18 'description' => __('Image with lightbox option', 'auxin-elements' ),
19 'class' => 'aux-widget-image',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'is_widget' => true,
23 'is_shortcode' => true,
24 'is_vc' => true,
25 'category' => THEME_NAME,
26 'group' => '',
27 'admin_enqueue_js' => '',
28 'admin_enqueue_css' => '',
29 'front_enqueue_js' => '',
30 'front_enqueue_css' => '',
31 'icon' => 'aux-element aux-pb-icons-image',
32 'custom_markup' => '',
33 'js_view' => '',
34 'html_template' => '',
35 'deprecated' => '',
36 'content_element' => '',
37 'as_parent' => '',
38 'as_child' => '',
39 'params' => array(
40 array(
41 'heading' => __('Title','auxin-elements' ),
42 'description' => __('Image title, leave it empty if you don`t need title.', 'auxin-elements'),
43 'param_name' => 'title',
44 'type' => 'textfield',
45 'value' => '',
46 'def_value' => '',
47 'holder' => 'textfield',
48 'class' => 'id',
49 'admin_label' => true,
50 'dependency' => '',
51 'weight' => '',
52 'group' => '' ,
53 'edit_field_class' => ''
54 ),
55 array(
56 'heading' => __('Image','auxin-elements' ),
57 'description' => '',
58 'param_name' => 'attach_id',
59 'type' => 'attach_image',
60 'value' => '',
61 'def_value' => '',
62 'holder' => 'textfield',
63 'class' => 'attach_id',
64 'admin_label' => true,
65 'dependency' => '',
66 'weight' => '',
67 'group' => '' ,
68 'edit_field_class' => ''
69 ),
70 array(
71 'heading' => __('Image hover','auxin-elements' ),
72 'description' => '',
73 'param_name' => 'attach_id_hover',
74 'type' => 'attach_image',
75 'value' => '',
76 'def_value' => '',
77 'holder' => 'textfield',
78 'class' => 'attach_id_hover',
79 'admin_label' => true,
80 'dependency' => '',
81 'weight' => '',
82 'group' => '' ,
83 'edit_field_class' => ''
84 ),
85 array(
86 'heading' => __('Size','auxin-elements' ),
87 'description' => __('Choose a pre-defined or custom image size.', 'auxin-elements' ),
88 'param_name' => 'size',
89 'type' => 'dropdown',
90 'def_value' => 'medium_large',
91 'value' => array(
92 'full' => __('Original' , 'auxin-elements' ),
93 'large' => sprintf( __('Large (%sx%s)' , 'auxin-elements' ), get_option('large_size_w'), get_option('large_size_h')),
94 'medium_large' => sprintf( __('Medium Large (%sx%s)' , 'auxin-elements' ), get_option('medium_large_size_w'), get_option('medium_large_size_h', '-')),
95 'medium' => sprintf( __('Medium (%sx%s)' , 'auxin-elements' ), get_option('medium_size_w'), get_option('medium_size_h')),
96 'thumbnail' => sprintf( __('Thumbnail (%sx%s)' , 'auxin-elements' ), get_option('thumbnail_size_w'), get_option('thumbnail_size_h')),
97 'custom' => __('Custom' , 'auxin-elements' )
98 ),
99 'holder' => '',
100 'admin_label' => true,
101 'dependency' => '',
102 'weight' => '',
103 'group' => '' ,
104 'edit_field_class' => ''
105 ),
106
107 array(
108 'heading' => __('Width','auxin-elements' ),
109 'description' => '',
110 'param_name' => 'width',
111 'type' => 'textfield',
112 'value' => '',
113 'def_value' => '',
114 'holder' => 'textfield',
115 'class' => 'width',
116 'admin_label' => true,
117 'dependency' => array(
118 'element' => 'size',
119 'value' => array('custom')
120 ),
121 'weight' => '',
122 'group' => '' ,
123 'edit_field_class' => ''
124 ),
125 array(
126 'heading' => __('Height','auxin-elements' ),
127 'description' => '',
128 'param_name' => 'height',
129 'type' => 'textfield',
130 'value' => '',
131 'def_value' => '',
132 'holder' => 'textfield',
133 'class' => 'height',
134 'admin_label' => true,
135 'dependency' => array(
136 'element' => 'size',
137 'value' => array('custom')
138 ),
139 'weight' => '',
140 'group' => '' ,
141 'edit_field_class' => ''
142 ),
143 array(
144 'heading' => __('Alignment','auxin-elements' ),
145 'description' => __('Image alignment in content.', 'auxin-elements' ),
146 'param_name' => 'align',
147 'type' => 'dropdown',
148 'def_value' => 'alignnone',
149 'value' => array(
150 'alignleft' => __('Left' , 'auxin-elements' ),
151 'alignright' => __('Right' , 'auxin-elements' ),
152 'alignnone' => __('None' , 'auxin-elements' )
153 ),
154 'holder' => '',
155 'admin_label' => true,
156 'dependency' => '',
157 'weight' => '',
158 'group' => '' ,
159 'edit_field_class' => ''
160 ),
161 array(
162 'heading' => __('Iconic button','auxin-elements' ),
163 'description' => '',
164 'param_name' => 'icon',
165 'type' => 'dropdown',
166 'def_value' => 'plus',
167 'value' => array(
168 'none' => __('None', 'auxin-elements' ),
169 'plus' => __('Plus', 'auxin-elements' )
170
171 ),
172 'holder' => '',
173 'class' => 'icon',
174 'admin_label' => true,
175 'dependency' => '',
176 'weight' => '',
177 'group' => '' ,
178 'edit_field_class' => ''
179 ),
180 array(
181 'heading' => __('Open large image in lightbox','auxin-elements' ),
182 'description' => '',
183 'param_name' => 'lightbox',
184 'type' => 'aux_switch',
185 'value' => '0',
186 'holder' => '',
187 'class' => 'lightbox',
188 'admin_label' => true,
189 'dependency' => '',
190 'weight' => '',
191 'group' => '' ,
192 'edit_field_class' => ''
193 ),
194 array(
195 'heading' => __('Preload the image','auxin-elements' ),
196 'description' => '',
197 'param_name' => 'preloadable',
198 'type' => 'aux_switch',
199 'value' => '0',
200 'holder' => '',
201 'class' => 'preloadable',
202 'admin_label' => true,
203 'dependency' => '',
204 'weight' => '',
205 'group' => '' ,
206 'edit_field_class' => ''
207 ),
208 array(
209 'heading' => __('Preview preloading','auxin-elements' ),
210 'description' => '',
211 'param_name' => 'preload_preview',
212 'type' => 'aux_switch',
213 'value' => '0',
214 'holder' => '',
215 'class' => 'preload_preview',
216 'admin_label' => true,
217 'dependency' => '',
218 'weight' => '',
219 'group' => '' ,
220 'edit_field_class' => ''
221 ),
222 array(
223 'heading' => __('Link URL','auxin-elements' ),
224 'description' => '',
225 'param_name' => 'link',
226 'type' => 'textfield',
227 'value' => '',
228 'def_value' => '',
229 'holder' => 'textfield',
230 'class' => 'link',
231 'admin_label' => true,
232 'dependency' => array(
233 'element' => 'lightbox',
234 'value' => array('0', 'false')
235 ),
236 'weight' => '',
237 'group' => '' ,
238 'edit_field_class' => ''
239 ),
240 array(
241 'heading' => __('Target','auxin-elements' ),
242 'description' => __('Open in new page or this page.','auxin-elements' ),
243 'param_name' => 'target',
244 'type' => 'dropdown',
245 'def_value' => '_self',
246 'value' => array(
247 '_self' => __('Self' , 'auxin-elements' ) ,
248 '_blank' => __('Blank' , 'auxin-elements' )
249 ),
250 'holder' => '',
251 'class' => 'target',
252 'admin_label' => true,
253 'dependency' => array(
254 'element' => 'lightbox',
255 'value' => array('0', 'false')
256 ),
257 'weight' => '',
258 'group' => '' ,
259 'edit_field_class' => ''
260 ),
261 array(
262 'heading' => __( 'Tilt Effect','auxin-elements' ),
263 'description' => __( 'Adds tilt effect to the image.', 'auxin-elements' ),
264 'param_name' => 'tilt',
265 'type' => 'aux_switch',
266 'holder' => '',
267 'class' => 'tilt',
268 'admin_label' => true,
269 'weight' => '',
270 'group' => __( 'Effects', 'auxin-elements' ),
271 'edit_field_class' => ''
272 ),
273 array(
274 'heading' => __( 'Colorized Shadow', 'auxin-elements' ),
275 'description' => __( 'Adds colorized shadow to the image. Note: This feature is not available when image hover is active.', 'auxin-elements' ),
276 'param_name' => 'colorized_shadow',
277 'type' => 'aux_switch',
278 'holder' => '',
279 'class' => 'colorized_shadow',
280 'admin_label' => true,
281 'weight' => '',
282 'group' => __( 'Effects', 'auxin-elements' ),
283 'edit_field_class' => ''
284 ),
285
286 array(
287 'heading' => __('Diplay Ribbon','auxin-elements' ),
288 'description' => '',
289 'param_name' => 'display_ribbon',
290 'type' => 'aux_switch',
291 'value' => '0',
292 'holder' => '',
293 'class' => 'display_ribbon',
294 'admin_label' => true,
295 'dependency' => '',
296 'weight' => '',
297 'group' => '' ,
298 'edit_field_class' => ''
299 ),
300 array(
301 'heading' => __('Text','auxin-elements'),
302 'param_name' => 'ribbon_text',
303 'type' => 'textfield',
304 'value' => '',
305 'def_value' => '',
306 'holder' => 'textfield',
307 'class' => 'ribbon_text',
308 'description' => '',
309 'admin_label' => false,
310 'dependency' => array(
311 'element' => 'display_ribbon',
312 'value' => "1",
313 ),
314 'weight' => '',
315 'group' => '' ,
316 'edit_field_class' => ''
317 ),
318 array(
319 'heading' => __('Ribbon Style','auxin-elements' ),
320 'param_name' => 'ribbon_style',
321 'type' => 'dropdown',
322 'def_value' => 'simple',
323 'value' => array(
324 'simple' => __('Simple' , 'auxin-elements' ) ,
325 'corner' => __('Corner' , 'auxin-elements' ),
326 'cross' => __('Cross' , 'auxin-elements' )
327 ),
328 'holder' => '',
329 'class' => 'ribbon_style',
330 'admin_label' => true,
331 'dependency' => array(
332 'element' => 'display_ribbon',
333 'value' => "1",
334 ),
335 'weight' => '',
336 'group' => '' ,
337 'edit_field_class' => ''
338 ),
339 array(
340 'heading' => __('Ribbon Position','auxin-elements' ),
341 'param_name' => 'ribbon_position',
342 'type' => 'dropdown',
343 'def_value' => 'top-right',
344 'value' => array(
345 'top-left' => __('Top Left' , 'auxin-elements' ) ,
346 'top-right' => __('Top Right' , 'auxin-elements' ),
347 'bottom-left' => __('Bottom Left' , 'auxin-elements' ),
348 'bottom-right' => __('Bottom Right' , 'auxin-elements' ),
349 ),
350 'holder' => '',
351 'class' => 'ribbon_position',
352 'admin_label' => true,
353 'dependency' => array(
354 'element' => 'display_ribbon',
355 'value' => "1",
356 ),
357 'weight' => '',
358 'group' => '' ,
359 'edit_field_class' => ''
360 ),
361
362 array(
363 'heading' => __('Extra class name','auxin-elements' ),
364 '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' ),
365 'param_name' => 'extra_classes',
366 'type' => 'textfield',
367 'value' => '',
368 'def_value' => '',
369 'holder' => 'textfield',
370 'class' => 'extra_classes',
371 'admin_label' => true,
372 'dependency' => '',
373 'weight' => '',
374 'group' => '' ,
375 'edit_field_class' => ''
376 )
377
378 )
379 );
380
381 return $master_array;
382 }
383
384 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_image_master_array', 10, 1 );
385
386 // This is the widget call back in fact the front end out put of this widget comes from this function
387 function auxin_widget_image_callback( $atts, $shortcode_content = null ){
388
389 // Defining default attributes
390 $default_atts = array(
391 'title' => '', // header title
392 'add_content' => false,
393 'content_title' => '',
394 'content_subtitle' => '',
395 'tilt' => false,
396 'colorized_shadow' => false,
397 'attach_id' => '', // attachment id for main image
398 'attach_id_hover' => '', // attachment id for hover image
399 'link' => '', // link on image
400 'target' => '_self', // link target
401 'nofollow' => '', // link nofollow
402 'alt' => '', // alternative text
403 'size' => 'medium_large', // image size
404 'width' => '', // final width of image
405 'height' => '', // final height of image
406 'align' => 'alignnone',
407 'icon' => 'plus', // icon type. plus, zoom, none
408 'lightbox' => 'no', // open in lightbox or not
409 'preloadable' => '0',
410 'preload_preview' => '0',
411 'preload_bgcolor' => '',
412
413 'image_html' => '',
414
415 'display_ribbon' => '1',
416 'ribbon_style' => 'simple',
417 'ribbon_position' => 'top-right',
418 'ribbon_text' => '',
419
420 'extra_classes' => '', // custom css class names for this element
421 'custom_el_id' => '', // custom id attribute for this element
422 'base_class' => 'aux-widget-image' // base class name for container
423 );
424
425 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
426 extract( $result['parsed_atts'] );
427
428 $image_primary = '';
429 $image_primary_full = '';
430 $image_secondary = '';
431 $lightbox_attrs = '';
432 $image_classes = "aux-attachment aux-featured-image aux-attachment-id-$attach_id";
433 $frame_classes = '';
434
435 if( empty( $size ) ){
436 $size = 'medium_large';
437 }
438 if( 'custom' == $size ){
439 $size = array( 'width' => $width, 'height' => $height );
440 }
441
442 if ( $add_content ) {
443 $frame_classes .= 'aux-image-box-widget-bg-cover';
444 }
445
446 if ( auxin_is_true( $tilt ) ) {
447 $frame_classes .= ' aux-tilt-box';
448 }
449
450 if ( auxin_is_true( $colorized_shadow ) && empty( $attach_id_hover ) ) {
451 $image_classes .= ' aux-img-dynamic-dropshadow';
452 }
453
454 //$elementor_lightbox = auxin_is_true( get_option( 'elementor_global_image_lightbox', false ) ) ? true : false;
455
456 if( ! empty( $attach_id ) && is_numeric( $attach_id ) ) {
457 $image_primary = auxin_get_the_responsive_attachment( $attach_id,
458 array(
459 'quality' => 100,
460 'preloadable' => auxin_is_true( $preloadable ),
461 'preload_preview' => $preload_preview,
462 'preload_bgcolor' => $preload_bgcolor,
463 'size' => $size,
464 'crop' => true,
465 'add_hw' => true,
466 'upscale' => false,
467 'original_src' => 'full' === $size ? true : false,
468 'attr' => array( 'class' => $image_classes )
469 )
470 );
471 $image_primary_full_src = auxin_get_attachment_url( $attach_id, 'full' );
472 $image_primary_meta = wp_get_attachment_metadata( $attach_id );
473
474 $lightbox_attrs = 'data-elementor-open-lightbox="no" ';
475
476 // While SVG images don't have dimension, this check is required
477 if( ! empty( $image_primary_meta['width'] ) ){
478 $lightbox_attrs .= 'data-original-width="' . $image_primary_meta['width'] . '" ';
479 }
480 if( ! empty( $image_primary_meta['height'] ) ){
481 $lightbox_attrs .= 'data-original-height="' . $image_primary_meta['height'] . '" ';
482 }
483 $lightbox_attrs .= 'data-caption="' . auxin_attachment_caption( $attach_id ) . '"';
484
485 } elseif( ! empty( $image_html ) ) {
486 $image_primary = $image_html;
487 }
488
489 if( ! empty( $attach_id_hover ) && is_numeric( $attach_id_hover ) ) {
490 $image_secondary = auxin_get_the_responsive_attachment( $attach_id_hover,
491 array(
492 'quality' => 100,
493 'preloadable' => auxin_is_true( $preloadable ),
494 'preload_preview' => $preload_preview,
495 'preload_bgcolor' => $preload_bgcolor,
496 'size' => $size,
497 'crop' => true,
498 'add_hw' => true,
499 'upscale' => false
500 )
501 );
502 }
503
504 $anchor_link = auxin_is_true( $lightbox ) ? $image_primary_full_src : esc_url( $link );
505 $anchor_class = auxin_is_true( $lightbox ) ? 'aux-lightbox-btn' : '';
506 $frame_classes .= auxin_is_true( $lightbox ) ? ' aux-media-frame aux-lightbox-frame' : '';
507 $target = $target !== '_blank' ? 'target="_self"' : 'target="_blank"';
508 $nofollow = auxin_is_true ( $nofollow ) ? ' rel="nofollow"' : '';
509
510 // hover effect
511 $hover_class = '';
512 if ( !empty($anchor_link) ) {
513 $hover_class = 'aux-hover-active';
514 }
515
516 $overflow_class = '';
517 if( $ribbon_style === 'corner' ) {
518 $overflow_class = ' aux-hidden-overflow';
519 }
520
521 // add alignment class on main element
522 $result['widget_header'] = str_replace( $base_class, $base_class.' aux-'.$align, $result['widget_header'] );
523
524 ob_start();
525
526 // widget header ------------------------------
527 echo wp_kses_post( $result['widget_header'] );
528 echo wp_kses_post( $result['widget_title'] );
529
530 // widget output -----------------------
531 ?>
532
533 <div class="aux-media-hint-frame ">
534 <div class="aux-media-image <?php echo esc_attr( $hover_class ); echo esc_attr( $frame_classes ); echo esc_attr( $overflow_class ); ?>" >
535 <?php if( !empty($anchor_link) ) { ?>
536 <a class="<?php echo esc_attr( $anchor_class ); ?>" href="<?php echo esc_url( $anchor_link ); ?>" <?php echo wp_kses_post( $lightbox_attrs ) . ' ' . wp_kses_post( $target ) . ' ' . wp_kses_post( $nofollow ); ?> >
537 <?php } ?>
538
539 <?php if ( auxin_is_true( $display_ribbon ) && ! empty( $ribbon_text ) ) { ?>
540 <div class="aux-ribbon-wrapper aux-<?php echo esc_attr( $ribbon_style );?>-ribbon <?php echo esc_attr( $ribbon_position );?>">
541 <span><?php echo esc_html( $ribbon_text );?></span>
542 </div>
543 <?php } ?>
544
545
546 <?php if( 'plus' == $icon && empty( $image_secondary ) ) { ?>
547 <div class='aux-hover-scale-circle-plus'>
548 <span class='aux-symbol-plus'></span>
549 <span class='aux-symbol-circle'></span>
550 </div>
551 <?php } ?>
552
553 <?php if ( !empty( $image_secondary ) ) { ?>
554 <div class="aux-image-holder aux-image-has-secondary">
555 <?php echo auxin_kses( $image_primary ); ?>
556 <?php echo auxin_kses( $image_secondary ); ?>
557 </div>
558 <?php } else {
559 if ( auxin_is_true( $lightbox ) ) { ?>
560 <div class="aux-frame-mask aux-frame-darken">
561 <?php echo auxin_kses( $image_primary ); ?>
562 </div>
563 <?php } else {
564 echo auxin_kses( $image_primary );
565 } ?>
566 <?php } ?>
567
568 <?php if( ! empty( $anchor_link ) ) { ?>
569 </a>
570 <?php } ?>
571 </div>
572 </div>
573
574 <?php
575
576 // widget footer ------------------------------
577 echo wp_kses_post( $result['widget_footer'] );
578
579 return ob_get_clean();
580 }
581