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 / button.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
button.php
361 lines
1 <?php
2 /**
3 * Button 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 auxin_get_button_master_array( $master_array ) {
14
15 $master_array['aux_button'] = array(
16 'name' => __("Button", 'auxin-elements' ),
17 'auxin_output_callback' => 'auxin_widget_button_callback',
18 'base' => 'aux_button',
19 'description' => __('It adds a button element.', 'auxin-elements' ),
20 'class' => 'aux-widget-button',
21 'show_settings_on_create' => true,
22 'weight' => 1,
23 'is_widget' => false,
24 'is_shortcode' => true,
25 'is_so' => true,
26 'is_vc' => true,
27 'category' => THEME_NAME,
28 'group' => '',
29 'admin_enqueue_js' => '',
30 'admin_enqueue_css' => '',
31 'front_enqueue_js' => '',
32 'front_enqueue_css' => '',
33 'icon' => 'aux-element aux-pb-icons-button',
34 'custom_markup' => '',
35 'js_view' => '',
36 'html_template' => '',
37 'deprecated' => '',
38 'content_element' => '',
39 'as_parent' => '',
40 'as_child' => '',
41 'params' => array(
42 array(
43 'heading' => __('Button label','auxin-elements' ),
44 'description' => __('The label of button.','auxin-elements' ),
45 'param_name' => 'label',
46 'type' => 'textfield',
47 'value' => __('Button', 'auxin-elements'),
48 'holder' => 'textfield',
49 'class' => 'label',
50 'admin_label' => false,
51 'dependency' => '',
52 'weight' => '',
53 'group' => '' ,
54 'edit_field_class' => ''
55 ),
56 array(
57 'heading' => __('Button size','auxin-elements' ),
58 'description' => '',
59 'param_name' => 'size',
60 'type' => 'dropdown',
61 'def_value' => 'medium',
62 'value' => array(
63 'exlarge' => __('Exlarge', 'auxin-elements' ),
64 'large' => __('Large' , 'auxin-elements' ),
65 'medium' => __('Medium' , 'auxin-elements' ),
66 'small' => __('Small' , 'auxin-elements' ),
67 'tiny' => __('Tiny' , 'auxin-elements' )
68 ),
69 'holder' => '',
70 'class' => 'round',
71 'admin_label' => true,
72 'dependency' => '',
73 'weight' => '',
74 'group' => '' ,
75 'edit_field_class' => ''
76 ),
77 array(
78 'heading' => __('Button shape','auxin-elements' ),
79 'description' => '',
80 'param_name' => 'border',
81 'type' => 'aux_visual_select',
82 'value' => '',
83 'class' => 'border',
84 'admin_label' => false,
85 'dependency' => '',
86 'weight' => '',
87 'group' => 'Appearance' ,
88 'edit_field_class' => '',
89 'choices' => array(
90 '' => array(
91 'label' => __('Box', 'auxin-elements' ),
92 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
93 ),
94 'round' => array(
95 'label' => __('Round', 'auxin-elements' ),
96 'image' => AUXIN_URL . 'images/visual-select/button-curved.svg'
97 ),
98 'curve' => array(
99 'label' => __('Curve', 'auxin-elements' ),
100 'image' => AUXIN_URL . 'images/visual-select/button-rounded.svg'
101 )
102 )
103 ),
104 array(
105 'heading' => __('Button style','auxin-elements' ),
106 'description' => '',
107 'param_name' => 'style',
108 'type' => 'aux_visual_select',
109 'value' => '',
110 'class' => 'style',
111 'admin_label' => false,
112 'dependency' => '',
113 'weight' => '',
114 'group' => 'Appearance' ,
115 'edit_field_class' => '',
116 'choices' => array(
117 '' => array(
118 'label' => __('Normal', 'auxin-elements' ),
119 'image' => AUXIN_URL . 'images/visual-select/button-normal.svg'
120 ),
121 '3d' => array(
122 'label' => __('3D', 'auxin-elements' ),
123 'image' => AUXIN_URL . 'images/visual-select/button-3d.svg'
124 ),
125 'outline' => array(
126 'label' => __('Outline', 'auxin-elements' ),
127 'image' => AUXIN_URL . 'images/visual-select/button-outline.svg'
128 )
129 )
130 ),
131 array(
132 'heading' => __('Uppercase label','auxin-elements' ),
133 'description' => '',
134 'param_name' => 'uppercase',
135 'type' => 'aux_switch',
136 'value' => '1',
137 'class' => 'uppercase',
138 'admin_label' => false,
139 'dependency' => '',
140 'weight' => '',
141 'group' => '' ,
142 'edit_field_class' => ''
143 ),
144 array(
145 'heading' => __('Darken the label','auxin-elements' ),
146 'description' => __('Darken label of button.','auxin-elements' ),
147 'param_name' => 'dark',
148 'type' => 'aux_switch',
149 'value' => '0',
150 'class' => 'dark',
151 'admin_label' => false,
152 'dependency' => '',
153 'weight' => '',
154 'group' => '' ,
155 'edit_field_class' => ''
156 ),
157 array(
158 'heading' => __('Icon for button','auxin-elements' ),
159 'description' => '',
160 'param_name' => 'icon',
161 'type' => 'aux_iconpicker',
162 'value' => '',
163 'class' => 'icon-name',
164 'admin_label' => false,
165 'dependency' => '',
166 'weight' => '',
167 'group' => '' ,
168 'edit_field_class' => ''
169 ),
170 array(
171 'heading' => __('Icon alignment','auxin-elements' ),
172 'description' => '',
173 'param_name' => 'icon_align',
174 'type' => 'aux_visual_select',
175 'def_value' => 'default',
176 'choices' => array(
177 // default template
178 'default' => array(
179 'label' => __('Default' , 'auxin-elements'),
180 'image' => AUXELS_ADMIN_URL . '/assets/images/button.png'
181 ),
182 'left' => array(
183 'label' => __('Left' , 'auxin-elements'),
184 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button2.webm webm'
185 ),
186 'right' => array(
187 'label' => __('Right' , 'auxin-elements'),
188 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button1.webm webm'
189 ),
190 'over' => array(
191 'label' => __('Over', 'auxin-elements'),
192 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button5.webm webm'
193 ),
194 'left-animate' => array(
195 'label' => __('Animate from Left', 'auxin-elements'),
196 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button4.webm webm'
197 ),
198 'right-animate' => array(
199 'label' => __('Animate from Righ', 'auxin-elements'),
200 'video_src' => AUXELS_ADMIN_URL . '/assets/images/preview/Button3.webm webm'
201 ),
202 ),
203 'holder' => '',
204 'class' => 'icon-align',
205 'admin_label' => false,
206 'dependency' => '',
207 'weight' => '',
208 'group' => '' ,
209 'edit_field_class' => ''
210 ),
211 array(
212 'heading' => __('Color of button','auxin-elements' ),
213 'description' => '',
214 'param_name' => 'color_name',
215 'type' => 'aux_visual_select',
216 'value' => 'carmine-pink',
217 'choices' => auxin_get_famous_colors_list(),
218 'holder' => '',
219 'class' => 'color',
220 'admin_label' => false,
221 'dependency' => '',
222 'weight' => '',
223 'group' => 'Appearance' ,
224 'edit_field_class' => ''
225 ),
226 array(
227 'heading' => __('Button Link','auxin-elements' ),
228 'description' => '',
229 'param_name' => 'link',
230 'type' => 'textfield',
231 'value' => '',
232 'holder' => '',
233 'class' => 'link',
234 'admin_label' => false,
235 'dependency' => '',
236 'weight' => '',
237 'group' => '' ,
238 'edit_field_class' => ''
239 ),
240 array(
241 'heading' => __('Open link in','auxin-elements' ),
242 'description' => '',
243 'param_name' => 'target',
244 'type' => 'dropdown',
245 'def_value' => '_self',
246 'value' => array(
247 '_self' => __('Current page' , 'auxin-elements' ),
248 '_blank' => __('New page', 'auxin-elements' )
249 ),
250 'holder' => '',
251 'class' => 'target',
252 'admin_label' => false,
253 'dependency' => '',
254 'weight' => '',
255 'group' => '' ,
256 'edit_field_class' => ''
257 ),
258 array(
259 'heading' => __('Extra class name','auxin-elements'),
260 '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'),
261 'param_name' => 'extra_classes',
262 'type' => 'textfield',
263 'value' => '',
264 'holder' => '',
265 'class' => 'extra_classes',
266 'admin_label' => false,
267 'dependency' => '',
268 'weight' => '',
269 'group' => '' ,
270 'edit_field_class' => ''
271 )
272 )
273 );
274
275 return $master_array;
276 }
277
278 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_button_master_array', 10, 1 );
279
280
281 function auxin_widget_button_callback( $atts = array(), $shortcode_content = null ){
282
283 // Defining default attributes
284 $default_atts = array(
285 'label' => '',
286 'size' => 'medium',
287 'border' => '',
288 'style' => '',
289 'uppercase' => '1',
290 'dark' => '0',
291 'icon' => '',
292 'icon_align' => 'default',
293 'color_name' => 'carmine-pink',
294 'link' => '',
295 'target' => '_self',
296
297 'extra_classes' => '', // custom css class names for this element
298 'custom_el_id' => '',
299 'base_class' => 'aux-widget-button'
300 );
301
302 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
303 extract( $result['parsed_atts'] );
304
305
306 // --------------------------------------------
307 $btn_css_classes = array( 'aux-button' );
308 $btn_css_classes[] = 'aux-' . $size; // size
309 $btn_css_classes[] = 'aux-' . $color_name; // appearance
310
311 if( $border ){
312 $btn_css_classes[] = 'aux-' . $border; // border form
313 }
314 if( $style ){
315 $btn_css_classes[] = 'aux-' . $style; // appearance
316 }
317 if( auxin_is_true( $uppercase ) ){
318 $btn_css_classes[] = 'aux-uppercase'; // text form
319 }
320 if( auxin_is_true( $dark ) ){
321 $btn_css_classes[] = 'aux-dark-text'; // text color
322 }
323 if( $icon_align !== "default" ){
324 $btn_css_classes[] = 'aux-icon-' . $icon_align; // icon align
325 }
326
327 if( ! empty( $extra_classes ) ) {
328 $btn_css_classes[] = $extra_classes;
329 }
330
331 // get escaped class attributes
332 $button_class_attr = auxin_make_html_class_attribute( $btn_css_classes );
333
334 $label = empty( $label ) ? $shortcode_content : $label;
335 $label = empty( $label ) ? __( "Button", 'auxin-elements' ) : $label;
336
337 $btn_content = '<span class="aux-overlay"></span>';
338 $btn_label = '<span class="aux-text">'. auxin_do_cleanup_shortcode( $label ) .'</span>';
339 $btn_icon = $icon ? '<span class="aux-icon '. esc_attr($icon) .'"></span>' : '';
340
341 // if icon is aligned on left
342 if( false !== strpos( $icon_align, 'left') ){
343 $btn_content .= $btn_icon . $btn_label;
344 } else {
345 $btn_content .= $btn_label. $btn_icon;
346 }
347
348 $btn_tag = empty( $link ) ? 'button' : 'a';
349 $btn_href = empty( $link ) ? '' : ' href="'. esc_url( $link ) .'" target="'. esc_attr( $target ) .'" ';
350
351 $output = '';
352
353 // widget custom output -----------------------
354
355 $output .= "<$btn_tag $btn_href $button_class_attr>";
356 $output .= $btn_content;
357 $output .= "</$btn_tag>";
358
359 return $output;
360 }
361