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 / image.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
image.php
340 lines
1 <?php
2 /**
3 * Image 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_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' => false,
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
87 array(
88 'heading' => __('Width','auxin-elements' ),
89 'description' => '',
90 'param_name' => 'width',
91 'type' => 'textfield',
92 'value' => '',
93 'def_value' => '',
94 'holder' => 'textfield',
95 'class' => 'width',
96 'admin_label' => true,
97 'dependency' => '',
98 'weight' => '',
99 'group' => '' ,
100 'edit_field_class' => ''
101 ),
102 array(
103 'heading' => __('Height','auxin-elements' ),
104 'description' => '',
105 'param_name' => 'height',
106 'type' => 'textfield',
107 'value' => '',
108 'def_value' => '',
109 'holder' => 'textfield',
110 'class' => 'height',
111 'admin_label' => true,
112 'dependency' => '',
113 'weight' => '',
114 'group' => '' ,
115 'edit_field_class' => ''
116 ),
117 array(
118 'heading' => __('Alignment','auxin-elements' ),
119 'description' => __('Image alignment in content.', 'auxin-elements' ),
120 'param_name' => 'align',
121 'type' => 'dropdown',
122 'def_value' => 'alignnone',
123 'value' => array(
124 'alignleft' => __('Left' , 'auxin-elements' ),
125 'alignright' => __('Right' , 'auxin-elements' ),
126 'alignnone' => __('None' , 'auxin-elements' )
127 ),
128 'holder' => 'dropdown',
129 'admin_label' => true,
130 'dependency' => '',
131 'weight' => '',
132 'group' => '' ,
133 'edit_field_class' => ''
134 ),
135 array(
136 'heading' => __('Iconic button','auxin-elements' ),
137 'description' => '',
138 'param_name' => 'icon',
139 'type' => 'dropdown',
140 'def_value' => 'plus',
141 'value' => array(
142 '' => __('None', 'auxin-elements' ),
143 'plus' => __('Plus', 'auxin-elements' )
144
145 ),
146 'holder' => 'dropdown',
147 'class' => 'icon',
148 'admin_label' => true,
149 'dependency' => '',
150 'weight' => '',
151 'group' => '' ,
152 'edit_field_class' => ''
153 ),
154 array(
155 'heading' => __('Open large image in lightbox','auxin-elements' ),
156 'description' => '',
157 'param_name' => 'lightbox',
158 'type' => 'aux_switch',
159 'value' => '0',
160 'holder' => 'dropdown',
161 'class' => 'lightbox',
162 'admin_label' => true,
163 'dependency' => '',
164 'weight' => '',
165 'group' => '' ,
166 'edit_field_class' => ''
167 ),
168
169 array(
170 'heading' => __('Link URL','auxin-elements' ),
171 'description' => '',
172 'param_name' => 'link',
173 'type' => 'textfield',
174 'value' => '',
175 'def_value' => '',
176 'holder' => 'textfield',
177 'class' => 'link',
178 'admin_label' => true,
179 'dependency' => array(
180 'element' => 'lightbox',
181 'value' => array('0', 'false')
182 ),
183 'weight' => '',
184 'group' => '' ,
185 'edit_field_class' => ''
186 ),
187 array(
188 'heading' => __('Target','auxin-elements' ),
189 'description' => __('Open in new page or this page.','auxin-elements' ),
190 'param_name' => 'target',
191 'type' => 'dropdown',
192 'def_value' => '_self',
193 'value' => array(
194 '_self' => __('Self' , 'auxin-elements' ) ,
195 '_blank' => __('Blank' , 'auxin-elements' )
196 ),
197 'holder' => 'dropdown',
198 'class' => 'target',
199 'admin_label' => true,
200 'dependency' => array(
201 'element' => 'lightbox',
202 'value' => array('0', 'false')
203 ),
204 'weight' => '',
205 'group' => '' ,
206 'edit_field_class' => ''
207 ),
208 array(
209 'heading' => __('Extra class name','auxin-elements' ),
210 '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' ),
211 'param_name' => 'extra_classes',
212 'type' => 'textfield',
213 'value' => '',
214 'def_value' => '',
215 'holder' => 'textfield',
216 'class' => 'extra_classes',
217 'admin_label' => true,
218 'dependency' => '',
219 'weight' => '',
220 'group' => '' ,
221 'edit_field_class' => ''
222 )
223
224 )
225 );
226
227 return $master_array;
228 }
229
230 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_image_master_array', 10, 1 );
231
232 // This is the widget call back in fact the front end out put of this widget comes from this function
233 function auxin_widget_image_callback( $atts, $shortcode_content = null ){
234
235 // Defining default attributes
236 $default_atts = array(
237 'title' => '', // header title
238
239 'attach_id' => '', // attachment id for main image
240 'attach_id_hover' => '', // attachment id for hover image
241 'link' => '', // link on image
242 'target' => '_self', // link target
243 'alt' => '', // alternative text
244 'width' => '', // final width of image
245 'height' => '', // final height of image
246 'align' => 'alignnone',
247 'icon' => 'plus', // icon type. plus, zoom, none
248 'lightbox' => 'no', // open in lightbox or not
249
250 'extra_classes' => '', // custom css class names for this element
251 'custom_el_id' => '', // custom id attribute for this element
252 'base_class' => 'aux-widget-image' // base class name for container
253 );
254
255 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
256 extract( $result['parsed_atts'] );
257
258 $image_primary = '';
259 $image_primary_full = '';
260 $image_secondary = '';
261 $lightbox_attrs = '';
262
263 global $aux_content_width;
264
265 $width = ! empty( $width ) && is_numeric( $width ) ? $width : $aux_content_width;
266 $height = ! empty( $height) && is_numeric( $height) ? $height: $aux_content_width * 0.75;
267
268 if( ! empty( $attach_id ) && is_numeric( $attach_id ) ) {
269 $image_primary = auxin_get_the_resized_attachment( $attach_id, $width, $height, true );
270 $image_primary_full_src = auxin_get_attachment_url( $attach_id, 'full' );
271 $image_primary_meta = wp_get_attachment_metadata( $attach_id );
272 $lightbox_attrs = 'data-original-width="' . $image_primary_meta['width'] . '" data-original-height="' . $image_primary_meta['height'] . '" ' .
273 'data-caption="' . auxin_attachment_caption( $attach_id ) . '"';
274 }
275
276 if( ! empty( $attach_id_hover ) && is_numeric( $attach_id_hover ) ) {
277 $image_secondary = auxin_get_the_resized_attachment( $attach_id_hover, $width, $height, true );
278 }
279
280 $anchor_link = auxin_is_true( $lightbox ) ? $image_primary_full_src : esc_attr( $link );
281 $anchor_class = auxin_is_true( $lightbox ) ? 'aux-lightbox-btn' : '';
282 $target = ($target == 'target="_self"')? : 'target="_blank"';
283
284 // hover effect
285 $hover_class = '';
286 if ( !empty($anchor_link) ) {
287 $hover_class = 'aux-hover-active';
288 }
289
290 // add alignment class on main element
291 $result['widget_header'] = str_replace( $base_class, $base_class.' aux-'.$align, $result['widget_header'] );
292
293 ob_start();
294
295 // widget header ------------------------------
296 echo $result['widget_header'];
297 echo $result['widget_title'];
298
299 // widget output -----------------------
300 ?>
301 <div class="aux-media-hint-frame ">
302 <div class="aux-media-frame aux-media-image aux-lightbox-frame <?php echo $hover_class; ?>" >
303
304 <?php if( !empty($anchor_link) ) { ?>
305 <a class="<?php echo $anchor_class; ?>" href="<?php echo $anchor_link; ?>" <?php echo $lightbox_attrs . ' ' . $target; ?> >
306 <?php } ?>
307
308 <?php if( 'plus' == $icon ) { ?>
309 <div class='aux-hover-scale-circle-plus'>
310 <span class='aux-symbol-plus'></span>
311 <span class='aux-symbol-circle'></span>
312 </div>
313 <?php } ?>
314
315 <?php if ( !empty( $image_secondary ) ) { ?>
316 <div class="aux-image-holder aux-image-has-secondary">
317 <?php echo $image_primary; ?>
318 <?php echo $image_secondary; ?>
319 </div>
320 <?php } else { ?>
321 <div class="aux-frame-mask aux-frame-darken">
322 <?php echo $image_primary; ?>
323 </div>
324 <?php } ?>
325
326 <?php if( !empty($anchor_link) ) { ?>
327 </a>
328 <?php } ?>
329
330 </div>
331 </div>
332
333 <?php
334
335 // widget footer ------------------------------
336 echo $result['widget_footer'];
337
338 return ob_get_clean();
339 }
340