PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.3.2
Shortcodes and extra features for Phlox theme v1.3.2
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 9 years ago accordion-api.php 9 years ago accordion.php 9 years ago attachment-url.php 9 years ago audio.php 9 years ago before-after.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 facebook.php 9 years ago flickr.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 popular-posts-widget.php 9 years ago quote.php 9 years ago recent-posts-grid-carousel.php 9 years ago recent-posts-land-style.php 9 years ago recent-posts-masonry.php 9 years ago recent-posts-tiles.php 9 years ago recent-posts-timeline.php 9 years ago recent-posts-widget.php 9 years ago recent-posts.php 9 years ago related-posts.php 9 years ago sample-element.php 9 years ago search.php 9 years ago slider.php 9 years ago socials-list.php 9 years ago tabs-api.php 9 years ago tabs.php 9 years ago text.php 9 years ago touch-slider.php 9 years ago video.php 9 years ago
button.php
332 lines
1 <?php
2 /**
3 * Button element
4 *
5 *
6 * @package auxin-elements
7 * @license LICENSE.txt
8 * @author
9 * @link https://bitbucket.org/averta/
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' => true,
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' => 'dropdown',
70 'class' => 'round',
71 'admin_label' => true,
72 'dependency' => '',
73 'weight' => '',
74 'group' => '' ,
75 'edit_field_class' => ''
76 ),
77
78 array(
79 'heading' => __('Button shape style','auxin-elements' ),
80 'description' => '',
81 'param_name' => 'border',
82 'type' => 'aux_visual_select',
83 'value' => '',
84 'holder' => 'dropdown',
85 'class' => 'border',
86 'admin_label' => true,
87 'dependency' => '',
88 'weight' => '',
89 'group' => 'Style' ,
90 'edit_field_class' => '',
91 'choices' => array(
92 '' => array(
93 'label' => __('Box', 'auxin-elements' ),
94 'image' => AUX_URL . 'images/visual-select/button-normal.svg'
95 ),
96 'round' => array(
97 'label' => __('Round', 'auxin-elements' ),
98 'image' => AUX_URL . 'images/visual-select/button-curved.svg'
99 ),
100 'curve' => array(
101 'label' => __('Curve', 'auxin-elements' ),
102 'image' => AUX_URL . 'images/visual-select/button-rounded.svg'
103 )
104 )
105 ),
106
107 array(
108 'heading' => __('Button style','auxin-elements' ),
109 'description' => '',
110 'param_name' => 'style',
111 'type' => 'aux_visual_select',
112 'value' => '',
113 'holder' => 'dropdown',
114 'class' => 'style',
115 'admin_label' => true,
116 'dependency' => '',
117 'weight' => '',
118 'group' => 'Style' ,
119 'edit_field_class' => '',
120 'choices' => array(
121 '' => array(
122 'label' => __('Normal', 'auxin-elements' ),
123 'image' => AUX_URL . 'images/visual-select/button-normal.svg'
124 ),
125 '3d' => array(
126 'label' => __('3D', 'auxin-elements' ),
127 'image' => AUX_URL . 'images/visual-select/button-3d.svg'
128 ),
129 'outline' => array(
130 'label' => __('Outline', 'auxin-elements' ),
131 'image' => AUX_URL . 'images/visual-select/button-outline.svg'
132 )
133 )
134 ),
135
136 array(
137 'heading' => __('Uppercase label','auxin-elements' ),
138 'description' => '',
139 'param_name' => 'uppercase',
140 'type' => 'aux_switch',
141 'def_value' => '',
142 'value' => '1',
143 'holder' => 'dropdown',
144 'class' => 'showheader',
145 'admin_label' => true,
146 'dependency' => '',
147 'weight' => '',
148 'group' => '' ,
149 'edit_field_class' => ''
150 ),
151 array(
152 'heading' => __('Darken the label','auxin-elements' ),
153 'description' => __('Darken label of button while mouse over it.','auxin-elements' ),
154 'param_name' => 'dark',
155 'type' => 'aux_switch',
156 'def_value' => '',
157 'value' => '0',
158 'holder' => 'dropdown',
159 'class' => 'showheader',
160 'admin_label' => true,
161 'dependency' => '',
162 'weight' => '',
163 'group' => '' ,
164 'edit_field_class' => ''
165 ),
166
167 array(
168 'heading' => __('Icon for button','auxin-elements' ),
169 'description' => '',
170 'param_name' => 'icon',
171 'type' => 'iconpicker',
172 'def_value' => '',
173 'value' => '',
174 'holder' => 'icon',
175 'class' => 'icon-name',
176 'admin_label' => true,
177 'dependency' => '',
178 'weight' => '',
179 'group' => '' ,
180 'edit_field_class' => ''
181 ),
182 array(
183 'heading' => __('Icon alignment','auxin-elements' ),
184 'description' => '',
185 'param_name' => 'icon_align',
186 'type' => 'dropdown',
187 'def_value' => '',
188 'value' => array(
189 '' => __('Default' , 'auxin-elements' ),
190 'left' => __('Left' , 'auxin-elements' ),
191 'right' => __('Right' , 'auxin-elements' ),
192 'over' => __('Over' , 'auxin-elements' ),
193 'left-animate' => __('Animate from Left' , 'auxin-elements' ),
194 'right-animate' => __('Animate from Right' , 'auxin-elements' )
195 ),
196 'holder' => 'dropdown',
197 'class' => 'icon-align',
198 'admin_label' => true,
199 'dependency' => '',
200 'weight' => '',
201 'group' => '' ,
202 'edit_field_class' => ''
203 ),
204 array(
205 'heading' => __('Color of button','auxin-elements' ),
206 'description' => '',
207 'param_name' => 'color_name',
208 'type' => 'aux_visual_select',
209 'def_value' => 'carmine-pink',
210 'choices' => auxin_get_famous_colors_list(),
211 'holder' => '',
212 'class' => 'color',
213 'admin_label' => true,
214 'dependency' => '',
215 'weight' => '',
216 'group' => '' ,
217 'edit_field_class' => ''
218 ),
219 array(
220 'heading' => __('Link','auxin-elements' ),
221 'description' => __('If you want to link your button.', 'auxin-elements' ),
222 'param_name' => 'link',
223 'type' => 'textfield',
224 'value' => '',
225 'def_value' => '',
226 'holder' => 'textfield',
227 'class' => 'link',
228 'admin_label' => true,
229 'dependency' => '',
230 'weight' => '',
231 'group' => '' ,
232 'edit_field_class' => ''
233 ),
234 array(
235 'heading' => __('Open link in','auxin-elements' ),
236 'description' => '',
237 'param_name' => 'target',
238 'type' => 'dropdown',
239 'def_value' => '_self',
240 'value' => array(
241 '_self' => __('Current page' , 'auxin-elements' ),
242 '_blank' => __('New page', 'auxin-elements' )
243 ),
244 'holder' => 'dropdown',
245 'class' => 'target',
246 'admin_label' => true,
247 'dependency' => '',
248 'weight' => '',
249 'group' => '' ,
250 'edit_field_class' => ''
251 )
252 )
253 );
254
255 return $master_array;
256 }
257
258 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_button_master_array', 10, 1 );
259
260
261 function auxin_widget_button_callback( $atts, $shortcode_content = null ){
262
263 // Defining default attributes
264 $default_atts = array(
265 'label' => 'Button',
266 'size' => 'medium',
267 'border' => '',
268 'style' => '',
269 'uppercase' => '1',
270 'dark' => '0',
271 'icon' => '',
272 'icon_align' => '',
273 'color_name' => 'carmine-pink',
274 'link' => '',
275 'target' => '_self',
276
277 'extra_classes' => '',
278 'custom_el_id' => '',
279 'base_class' => 'aux-widget-button'
280 );
281
282 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
283 extract( $result['parsed_atts'] );
284
285 // --------------------------------------------
286 $btn_css_classes = array( 'aux-button' );
287 $btn_css_classes[] = 'aux-' . $size; // size
288 $btn_css_classes[] = 'aux-' . $border; // border form
289 $btn_css_classes[] = 'aux-' . $style; // appearance
290 $btn_css_classes[] = 'aux-' . $color_name; // appearance
291
292
293 if( auxin_is_true( $uppercase ) ){
294 $btn_css_classes[] = 'aux-uppercase'; // text form
295 }
296 if( auxin_is_true( $dark ) ){
297 $btn_css_classes[] = 'aux-dark-text'; // text color
298 }
299 if( $icon_align ){
300 $btn_css_classes[] = 'aux-icon-' . $icon_align; // icon align
301 }
302
303 $button_class_attr = auxin_make_html_class_attribute( $btn_css_classes );
304
305 $label = empty( $label ) ? $shortcode_content : $label;
306
307 $btn_content = '<span class="aux-overlay"></span>';
308 $btn_label = '<span class="aux-text">'. auxin_do_cleanup_shortcode( $label ) .'</span>';
309 $btn_icon = $icon ? '<span class="aux-icon '. esc_attr($icon) .'"></span>' : '';
310
311 // if icon is aligned on left
312 if( false !== strpos( $icon_align, 'left') ){
313 $btn_content .= $btn_icon . $btn_label;
314 } else {
315 $btn_content .= $btn_label. $btn_icon;
316 }
317
318 $btn_tag = empty( $link ) ? 'button' : 'a';
319 $btn_href = empty( $link ) ? '' : ' href="'. $link .'" target="'. $target .'" ';
320
321
322 $output = '';
323
324 // widget custom output -----------------------
325
326 $output .= "<$btn_tag $btn_href $button_class_attr>";
327 $output .= $btn_content;
328 $output .= "</$btn_tag>";
329
330 return $output;
331 }
332