PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.3.14
Shortcodes and extra features for Phlox theme v1.3.14
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 8 years ago accordion.php 8 years ago attachment-url.php 8 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 9 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 8 years ago related-posts.php 8 years ago sample-element.php 8 years ago search.php 8 years ago slider.php 8 years ago socials-list.php 8 years ago tabs-api.php 8 years ago tabs.php 8 years ago text.php 8 years ago touch-slider.php 8 years ago video.php 8 years ago
button.php
341 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' => __("[Phlox] 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' => 'auxin-element auxin-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',
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 style','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 while mouse over it.','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' => 'dropdown',
175 'def_value' => 'default',
176 'value' => array(
177 'default' => __('Default' , 'auxin-elements' ),
178 'left' => __('Left' , 'auxin-elements' ),
179 'right' => __('Right' , 'auxin-elements' ),
180 'over' => __('Over' , 'auxin-elements' ),
181 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
182 'right-animate' => __('Animate from Right' , 'auxin-elements' )
183 ),
184 'holder' => '',
185 'class' => 'icon-align',
186 'admin_label' => false,
187 'dependency' => '',
188 'weight' => '',
189 'group' => '' ,
190 'edit_field_class' => ''
191 ),
192 array(
193 'heading' => __('Color of button','auxin-elements' ),
194 'description' => '',
195 'param_name' => 'color_name',
196 'type' => 'aux_visual_select',
197 'value' => 'carmine-pink',
198 'choices' => auxin_get_famous_colors_list(),
199 'holder' => '',
200 'class' => 'color',
201 'admin_label' => false,
202 'dependency' => '',
203 'weight' => '',
204 'group' => 'Appearance' ,
205 'edit_field_class' => ''
206 ),
207 array(
208 'heading' => __('Link','auxin-elements' ),
209 'description' => __('If you want to link your button.', 'auxin-elements' ),
210 'param_name' => 'link',
211 'type' => 'textfield',
212 'value' => '',
213 'holder' => '',
214 'class' => 'link',
215 'admin_label' => false,
216 'dependency' => '',
217 'weight' => '',
218 'group' => '' ,
219 'edit_field_class' => ''
220 ),
221 array(
222 'heading' => __('Open link in','auxin-elements' ),
223 'description' => '',
224 'param_name' => 'target',
225 'type' => 'dropdown',
226 'def_value' => '_self',
227 'value' => array(
228 '_self' => __('Current page' , 'auxin-elements' ),
229 '_blank' => __('New page', 'auxin-elements' )
230 ),
231 'holder' => '',
232 'class' => 'target',
233 'admin_label' => false,
234 'dependency' => '',
235 'weight' => '',
236 'group' => '' ,
237 'edit_field_class' => ''
238 ),
239 array(
240 'heading' => __('Extra class name','auxin-elements'),
241 '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'),
242 'param_name' => 'extra_classes',
243 'type' => 'textfield',
244 'value' => '',
245 'holder' => '',
246 'class' => 'extra_classes',
247 'admin_label' => false,
248 'dependency' => '',
249 'weight' => '',
250 'group' => '' ,
251 'edit_field_class' => ''
252 )
253 )
254 );
255
256 return $master_array;
257 }
258
259 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_button_master_array', 10, 1 );
260
261
262 function auxin_widget_button_callback( $atts, $shortcode_content = null ){
263
264 // Defining default attributes
265 $default_atts = array(
266 'label' => 'Button',
267 'size' => 'medium',
268 'border' => '',
269 'style' => '',
270 'uppercase' => '1',
271 'dark' => '0',
272 'icon' => '',
273 'icon_align' => 'default',
274 'color_name' => 'carmine-pink',
275 'link' => '',
276 'target' => '_self',
277
278 'extra_classes' => '', // custom css class names for this element
279 'custom_el_id' => '',
280 'base_class' => 'aux-widget-button'
281 );
282
283 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
284 extract( $result['parsed_atts'] );
285
286
287
288
289 // --------------------------------------------
290 $btn_css_classes = array( 'aux-button' );
291 $btn_css_classes[] = 'aux-' . $size; // size
292 $btn_css_classes[] = 'aux-' . $border; // border form
293 $btn_css_classes[] = 'aux-' . $style; // appearance
294 $btn_css_classes[] = 'aux-' . $color_name; // appearance
295
296
297 if( auxin_is_true( $uppercase ) ){
298 $btn_css_classes[] = 'aux-uppercase'; // text form
299 }
300 if( auxin_is_true( $dark ) ){
301 $btn_css_classes[] = 'aux-dark-text'; // text color
302 }
303 if( $icon_align !== "default" ){
304 $btn_css_classes[] = 'aux-icon-' . $icon_align; // icon align
305 }
306
307 if( ! empty( $extra_classes ) ) {
308 $btn_css_classes[] = $extra_classes;
309 }
310
311 $button_class_attr = auxin_make_html_class_attribute( $btn_css_classes );
312
313
314 $label = empty( $label ) ? $shortcode_content : $label;
315
316 $btn_content = '<span class="aux-overlay"></span>';
317 $btn_label = '<span class="aux-text">'. auxin_do_cleanup_shortcode( $label ) .'</span>';
318 $btn_icon = $icon ? '<span class="aux-icon '. esc_attr($icon) .'"></span>' : '';
319
320 // if icon is aligned on left
321 if( false !== strpos( $icon_align, 'left') ){
322 $btn_content .= $btn_icon . $btn_label;
323 } else {
324 $btn_content .= $btn_label. $btn_icon;
325 }
326
327 $btn_tag = empty( $link ) ? 'button' : 'a';
328 $btn_href = empty( $link ) ? '' : ' href="'. $link .'" target="'. $target .'" ';
329
330
331 $output = '';
332
333 // widget custom output -----------------------
334
335 $output .= "<$btn_tag $btn_href $button_class_attr>";
336 $output .= $btn_content;
337 $output .= "</$btn_tag>";
338
339 return $output;
340 }
341