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