PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.0.2
Shortcodes and extra features for Phlox theme v1.0.2
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 9 years ago accordion.php 9 years ago attachment-url.php 9 years ago audio.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 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 9 years ago latest-posts-slider.php 9 years ago quote.php 9 years ago recent-posts-widget.php 9 years ago recent-posts.php 9 years ago sample-element.php 9 years ago search.php 9 years ago socials-list.php 9 years ago tabs.php 9 years ago text.php 9 years ago video.php 9 years ago
image.php
334 lines
1 <?php
2 /**
3 * Image element
4 *
5 *
6 * @package auxin-elements
7 * @license LICENSE.txt
8 * @author
9 * @link https://bitbucket.org/averta/
10 * @copyright (c) 2010-2016
11 */
12 function auxin_get_image_master_array( $master_array ) {
13
14 $master_array['aux_image'] = array(
15 'name' => __("[Phlox] 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' => 'auxin-element auxin-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 'param_name' => 'title',
43 'type' => 'textfield',
44 'value' => '',
45 'def_value' => '',
46 'holder' => 'textfield',
47 'class' => 'id',
48 'heading' => __('Title','auxin-elements' ),
49 'description' => '',
50 'admin_label' => true,
51 'dependency' => '',
52 'weight' => '',
53 'group' => '' ,
54 'edit_field_class' => ''
55 ),
56 array(
57 'param_name' => 'attach_id',
58 'type' => 'attach_image',
59 'value' => '',
60 'def_value' => '',
61 'holder' => 'textfield',
62 'class' => 'attach_id',
63 'heading' => __('Image','auxin-elements' ),
64 'description' => '',
65 'admin_label' => true,
66 'dependency' => '',
67 'weight' => '',
68 'group' => '' ,
69 'edit_field_class' => ''
70 ),
71 array(
72 'param_name' => 'attach_id_hover',
73 'type' => 'attach_image',
74 'value' => '',
75 'def_value' => '',
76 'holder' => 'textfield',
77 'class' => 'attach_id_hover',
78 'heading' => __('Image Hover','auxin-elements' ),
79 'description' => '',
80 'admin_label' => true,
81 'dependency' => '',
82 'weight' => '',
83 'group' => '' ,
84 'edit_field_class' => ''
85 ),
86
87 array(
88 'param_name' => 'width',
89 'type' => 'textfield',
90 'value' => '',
91 'def_value' => '',
92 'holder' => 'textfield',
93 'class' => 'width',
94 'heading' => __('Width','auxin-elements' ),
95 'description' => '',
96 'admin_label' => true,
97 'dependency' => '',
98 'weight' => '',
99 'group' => '' ,
100 'edit_field_class' => ''
101 ),
102 array(
103 'param_name' => 'height',
104 'type' => 'textfield',
105 'value' => '',
106 'def_value' => '',
107 'holder' => 'textfield',
108 'class' => 'height',
109 'heading' => __('Height','auxin-elements' ),
110 'description' => '',
111 'admin_label' => true,
112 'dependency' => '',
113 'weight' => '',
114 'group' => '' ,
115 'edit_field_class' => ''
116 ),
117 array(
118 'param_name' => 'align',
119 'type' => 'dropdown',
120 'def_value' => 'left',
121 'value' => array(
122 'alignleft' => __('Left' , 'auxin-elements' ),
123 'alignright' => __('Right' , 'auxin-elements' ),
124 'alignnone' => __('None' , 'auxin-elements' )
125 ),
126 'holder' => 'dropdown',
127 'heading' => __('Alignment','auxin-elements' ),
128 'description' => __('Image alignment in content.', 'auxin-elements' ),
129 'admin_label' => true,
130 'dependency' => '',
131 'weight' => '',
132 'group' => '' ,
133 'edit_field_class' => ''
134 ),
135 array(
136 'param_name' => 'icon',
137 'type' => 'dropdown',
138 'def_value' => 'plus',
139 'value' => array(
140 '' => __('None', 'auxin-elements' ),
141 'plus' => __('Plus', 'auxin-elements' )
142
143 ),
144 'holder' => 'dropdown',
145 'class' => 'icon',
146 'heading' => __('Iconic Button','auxin-elements' ),
147 'description' => '',
148 'admin_label' => true,
149 'dependency' => '',
150 'weight' => '',
151 'group' => '' ,
152 'edit_field_class' => ''
153 ),
154 array(
155 'param_name' => 'lightbox',
156 'type' => 'aux_switch',
157 'value' => '0',
158 'holder' => 'dropdown',
159 'class' => 'lightbox',
160 'heading' => __('Open large image in lightbox','auxin-elements' ),
161 'description' => '',
162 'admin_label' => true,
163 'dependency' => '',
164 'weight' => '',
165 'group' => '' ,
166 'edit_field_class' => ''
167 ),
168
169 array(
170 'param_name' => 'link',
171 'type' => 'textfield',
172 'value' => '',
173 'def_value' => '',
174 'holder' => 'textfield',
175 'class' => 'link',
176 'heading' => __('Link URL','auxin-elements' ),
177 'description' => '',
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 'param_name' => 'target',
189 'type' => 'dropdown',
190 'def_value' => 'curve',
191 'value' => array(
192 '_self' => __('Self' , 'auxin-elements' ) ,
193 '_blank' => __('Blank' , 'auxin-elements' )
194 ),
195 'holder' => 'dropdown',
196 'class' => 'target',
197 'heading' => __('Target','auxin-elements' ),
198 'description' => __('Open in new page or this page.','auxin-elements' ),
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 'param_name' => 'extra_classes',
210 'type' => 'textfield',
211 'value' => '',
212 'def_value' => '',
213 'holder' => 'textfield',
214 'class' => 'extra_classes',
215 'heading' => __('Extra class name','auxin-elements' ),
216 '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' ),
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' => 'alignleft',
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
262 global $aux_content_width;
263
264 $width = ! empty( $width ) && is_numeric( $width ) ? $width : $aux_content_width;
265 $height = ! empty( $height) && is_numeric( $height) ? $height: $aux_content_width * 0.75;
266
267 if( ! empty( $attach_id ) && is_numeric( $attach_id ) ) {
268 $image_primary = auxin_get_the_resized_attachment( $attach_id, $width, $height, true );
269 $image_primary_full_src = auxin_get_the_resized_attachment_src( $attach_id, 3000, 3000 * 0.75 );
270 }
271
272 if( ! empty( $attach_id_hover ) && is_numeric( $attach_id_hover ) ) {
273 $image_secondary = auxin_get_the_resized_attachment( $attach_id_hover, $width, $height, true );
274 }
275
276 $anchor_link = auxin_is_true( $lightbox ) ? $image_primary_full_src : esc_attr( $link );
277 $anchor_class = auxin_is_true( $lightbox ) ? 'aux-lightbox-btn' : '';
278 $target = ($target == 'target="_self"')? : 'target="_blank"';
279
280 // hover effect
281 $hover_class = '';
282 if ( !empty($anchor_link) ) {
283 $hover_class = 'aux-active-hover-effect';
284 }
285
286 // add alignment class on main element
287 $result['widget_header'] = str_replace( $base_class, $base_class.' aux-'.$align, $result['widget_header'] );
288
289 ob_start();
290
291 // widget header ------------------------------
292 echo $result['widget_header'];
293 echo $result['widget_title'];
294
295 // widget output -----------------------
296 ?>
297 <div class="aux-media-hint-frame">
298 <div class="aux-media-frame aux-media-image aux-lightbox-frame <?php echo $hover_class; ?>" >
299
300 <?php if( !empty($anchor_link) ) { ?>
301 <a class="<?php echo $anchor_class; ?>" href="<?php echo $anchor_link; ?>" <?php echo $target; ?> >
302 <?php } ?>
303
304 <?php if( 'plus' == $icon ) { ?>
305 <span class="aux-plus"></span>
306 <span class="aux-plus-bg"></span>
307 <?php } ?>
308
309 <?php if ( !empty( $image_secondary ) ) { ?>
310 <div class="aux-image-holder aux-image-has-secondary">
311 <?php echo $image_primary; ?>
312 <?php echo $image_secondary; ?>
313 </div>
314 <?php } else { ?>
315 <div class="aux-image-holder">
316 <?php echo $image_primary; ?>
317 </div>
318 <?php } ?>
319
320 <?php if( !empty($anchor_link) ) { ?>
321 </a>
322 <?php } ?>
323
324 </div>
325 </div>
326
327 <?php
328
329 // widget footer ------------------------------
330 echo $result['widget_footer'];
331
332 return ob_get_clean();
333 }
334