PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.1
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.1
3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 2.8.17 2.8.18 All 259 releases
wpfunnels / includes / core / widgets / bricks / NextStep.php

NextStep.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.1, at includes/core/widgets/bricks/NextStep.php

641 lines 19.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Namespace for the NextStep class.
4 * This class is part of the WPFunnels\Widgets\Bricks namespace.
5 */
6 namespace WPFunnels\Widgets\Bricks;
7
8 require_once get_template_directory() . '/includes/elements/base.php';
9
10 use \Bricks\Element;
11 use WPFunnels\Wpfnl_functions;
12
13 if (! defined('ABSPATH')) {
14 exit;
15 } // Exit if accessed directly
16
17 /**
18 * Class NextStep
19 *
20 * Represents a NextStep element in the WP Funnels plugin.
21 * This class extends the Element class.
22 *
23 * @package WPFunnels\Widgets\Bricks
24 */
25 class NextStep extends Element {
26
27 // Element properties
28 public $category = 'wpfunnels'; // Use predefined element category 'general'
29 public $name = 'wpfnl_next_step'; // Make sure to prefix your elements
30 public $icon = 'fa-solid fa-cart-shopping'; // Themify icon font class
31 public $scripts = []; // Script(s) run when element is rendered on frontend or updated in builder
32 public $tag = 'button';
33
34
35 /**
36 * Return localised element label
37 *
38 * @return string
39 * @since 3.1.0
40 */
41 public function get_label()
42 {
43 return esc_html__('Next Step', 'wpfnl');
44 }
45
46 /**
47 * Get WordPress user roles for display condition control.
48 *
49 * @return array
50 * @since 3.1.0
51 */
52 protected function get_wp_user_roles()
53 {
54 $roles = [ 'none' => esc_html__( 'None', 'wpfnl' ) ];
55
56 if ( ! function_exists( 'get_editable_roles' ) ) {
57 require_once ABSPATH . 'wp-admin/includes/user.php';
58 }
59
60 foreach ( get_editable_roles() as $role_key => $role_info ) {
61 $roles[ $role_key ] = $role_info['name'];
62 }
63
64 return $roles;
65 }
66
67
68 /**
69 * Set builder controls
70 *
71 * @since 3.1.0
72 */
73 public function set_controls() {
74 $this->controls['button_type_selector'] = [
75 'tab' => 'content',
76 'label' => esc_html__( 'Select Button Type', 'wpfnl' ),
77 'type' => 'select',
78 'options' => [
79 'checkout' => 'Next Step',
80 'url-path' => 'Go To URL Path',
81 'another-funnel' => 'Another Funnel',
82 ],
83 'inline' => false,
84 'placeholder' => esc_html__( 'Select Type', 'wpfnl' ),
85 'default' => '',
86 ];
87
88 $this->controls['url_path_field'] = [
89 'tab' => 'content',
90 'label' => esc_html__( 'URL Path', 'wpfnl' ),
91 'type' => 'link',
92 'pasteStyles' => false,
93 'placeholder' => esc_html__( 'http://yoursite.com', 'wpfnl' ),
94 'required' => [ 'button_type_selector', '=', 'url-path' ],
95 ];
96
97 $this->controls['another_funnel_field'] = [
98 'tab' => 'content',
99 'label' => esc_html__( 'Choose Funnel', 'wpfnl' ),
100 'type' => 'select',
101 'options' => Wpfnl_functions::get_funnel_list(),
102 'inline' => false,
103 'placeholder' => esc_html__( 'Select a Funnel', 'wpfnl' ),
104 'default' => '',
105 'required' => [ 'button_type_selector', '=', 'another-funnel' ],
106 ];
107
108
109 $this->controls['buttonTypeSeparator'] = [
110 'type' => 'separator',
111 ];
112
113 //---text---
114 $this->controls['text'] = [
115 'label' => esc_html__( 'Button Title', 'wpfnl' ),
116 'type' => 'text',
117 'default' => esc_html__( 'Next Step', 'wpfnl' ),
118 'placeholder' => esc_html__( 'Next Step', 'wpfnl' ),
119 ];
120
121 // Subtitle
122 $this->controls['subtitleSeparator'] = [
123 'type' => 'separator',
124 'label' => esc_html__( 'Subtitle', 'wpfnl' ),
125 ];
126
127 $this->controls['enable_subtitle'] = [
128 'tab' => 'content',
129 'label' => esc_html__( 'Enable Subtitle', 'wpfnl' ),
130 'type' => 'checkbox',
131 'default' => false,
132 ];
133
134 $this->controls['subtitle_text'] = [
135 'tab' => 'content',
136 'label' => esc_html__( 'Subtitle Text', 'wpfnl' ),
137 'type' => 'text',
138 'default' => esc_html__( 'Click to continue', 'wpfnl' ),
139 'placeholder' => esc_html__( 'Enter subtitle text', 'wpfnl' ),
140 'required' => [ 'enable_subtitle', '=', true ],
141 ];
142
143 $this->controls['subtitleTypography'] = [
144 'tab' => 'content',
145 'label' => esc_html__( 'Subtitle Typography', 'wpfnl' ),
146 'type' => 'typography',
147 'css' => [
148 [
149 'property' => 'font',
150 'selector' => '.wpfnl-button-subtitle',
151 ],
152 ],
153 'exclude' => [ 'text-align', 'text-decoration', 'line-height' ],
154 'required' => [ 'enable_subtitle', '=', true ],
155 ];
156
157 $this->controls['subtitleSpacing'] = [
158 'tab' => 'content',
159 'label' => esc_html__( 'Subtitle Spacing Top', 'wpfnl' ),
160 'type' => 'number',
161 'units' => true,
162 'css' => [
163 [
164 'property' => 'margin-top',
165 'selector' => '.wpfnl-button-subtitle',
166 ],
167 ],
168 'default' => '2px',
169 'required' => [ 'enable_subtitle', '=', true ],
170 ];
171
172 $this->controls['size'] = [
173 'label' => esc_html__( 'Size', 'wpfnl' ),
174 'type' => 'select',
175 'options' => $this->control_options['buttonSizes'],
176 'inline' => true,
177 'reset' => true,
178 'placeholder' => esc_html__( 'Default', 'wpfnl' ),
179 ];
180
181 $this->controls['style'] = [
182 'label' => esc_html__( 'Style', 'wpfnl' ),
183 'type' => 'select',
184 'options' => $this->control_options['styles'],
185 'inline' => true,
186 'reset' => true,
187 'default' => 'primary',
188 'placeholder' => esc_html__( 'None', 'wpfnl' ),
189 ];
190
191 $this->controls['circle'] = [
192 'label' => esc_html__( 'Circle', 'wpfnl' ),
193 'type' => 'checkbox',
194 'reset' => true,
195 ];
196
197 $this->controls['outline'] = [
198 'label' => esc_html__( 'Outline', 'wpfnl' ),
199 'type' => 'checkbox',
200 'reset' => true,
201 ];
202
203 // Icon
204 $this->controls['iconSeparator'] = [
205 'label' => esc_html__( 'Icon', 'wpfnl' ),
206 'type' => 'separator',
207 ];
208
209 $this->controls['icon'] = [
210 'label' => esc_html__( 'Icon', 'wpfnl' ),
211 'type' => 'icon',
212 ];
213
214 $this->controls['iconTypography'] = [
215 'label' => esc_html__( 'Typography', 'bricks' ),
216 'type' => 'typography',
217 'css' => [
218 [
219 'property' => 'font',
220 'selector' => 'i',
221 ],
222 ],
223 'exclude' => [
224 'font-family',
225 'font-weight',
226 'font-style',
227 'text-align',
228 'text-decoration',
229 'text-transform',
230 'line-height',
231 'letter-spacing',
232 ],
233 'required' => [ 'icon.icon', '!=', '' ],
234 ];
235
236 $this->controls['iconPosition'] = [
237 'label' => esc_html__( 'Position', 'wpfnl' ),
238 'type' => 'select',
239 'options' => $this->control_options['iconPosition'],
240 'inline' => true,
241 'placeholder' => esc_html__( 'Right', 'wpfnl' ),
242 'required' => [ 'icon', '!=', '' ],
243 ];
244
245 // Responsive Display
246 $this->controls['responsiveSeparator'] = [
247 'label' => esc_html__( 'Responsive Display', 'wpfnl' ),
248 'type' => 'separator',
249 ];
250
251 $this->controls['hide_on_desktop'] = [
252 'tab' => 'content',
253 'label' => esc_html__( 'Hide on Desktop (≥ 1200px)', 'wpfnl' ),
254 'type' => 'checkbox',
255 'default' => false,
256 'description' => esc_html__( 'Hide button on desktop devices (window width >= 1200px)', 'wpfnl' ),
257 ];
258
259 $this->controls['hide_on_tablet'] = [
260 'tab' => 'content',
261 'label' => esc_html__( 'Hide on Tablet (768px – 1199px)', 'wpfnl' ),
262 'type' => 'checkbox',
263 'default' => false,
264 'description' => esc_html__( 'Hide button on tablet devices (window width 768px - 1199px)', 'wpfnl' ),
265 ];
266
267 $this->controls['hide_on_mobile'] = [
268 'tab' => 'content',
269 'label' => esc_html__( 'Hide on Mobile (≤ 767px)', 'wpfnl' ),
270 'type' => 'checkbox',
271 'default' => false,
272 'description' => esc_html__( 'Hide button on mobile devices (window width <= 767px)', 'wpfnl' ),
273 ];
274
275 // Display Conditions
276 $this->controls['displayConditionSeparator'] = [
277 'label' => esc_html__( 'Display Conditions', 'wpfnl' ),
278 'type' => 'separator',
279 ];
280
281 $this->controls['display_condition_type'] = [
282 'tab' => 'content',
283 'label' => esc_html__( 'Display Condition', 'wpfnl' ),
284 'type' => 'select',
285 'options' => [
286 'none' => esc_html__( 'None', 'wpfnl' ),
287 'user_state' => esc_html__( 'User State', 'wpfnl' ),
288 'user_role' => esc_html__( 'User Role', 'wpfnl' ),
289 'browser' => esc_html__( 'Browser', 'wpfnl' ),
290 'operating_system' => esc_html__( 'Operating System', 'wpfnl' ),
291 'day' => esc_html__( 'Day', 'wpfnl' ),
292 ],
293 'inline' => false,
294 'default' => 'none',
295 ];
296
297 // User State
298 $this->controls['hide_from_logged_in'] = [
299 'tab' => 'content',
300 'label' => esc_html__( 'Hide From Logged In User', 'wpfnl' ),
301 'type' => 'checkbox',
302 'default' => false,
303 'required' => [ 'display_condition_type', '=', 'user_state' ],
304 ];
305
306 $this->controls['hide_from_logged_out'] = [
307 'tab' => 'content',
308 'label' => esc_html__( 'Hide From Logged Out User', 'wpfnl' ),
309 'type' => 'checkbox',
310 'default' => false,
311 'required' => [ 'display_condition_type', '=', 'user_state' ],
312 ];
313
314 // User Role
315 $this->controls['hide_for_user_role'] = [
316 'tab' => 'content',
317 'label' => esc_html__( 'Hide For User Role', 'wpfnl' ),
318 'type' => 'select',
319 'options' => $this->get_wp_user_roles(),
320 'default' => 'none',
321 'required' => [ 'display_condition_type', '=', 'user_role' ],
322 ];
323
324 // Browser
325 $this->controls['hide_on_browser'] = [
326 'tab' => 'content',
327 'label' => esc_html__( 'Hide On Browser', 'wpfnl' ),
328 'type' => 'select',
329 'options' => [
330 'none' => esc_html__( 'None', 'wpfnl' ),
331 'mozilla' => esc_html__( 'Mozilla Firefox', 'wpfnl' ),
332 'chrome' => esc_html__( 'Google Chrome', 'wpfnl' ),
333 'opera_mini' => esc_html__( 'Opera Mini', 'wpfnl' ),
334 'safari' => esc_html__( 'Safari', 'wpfnl' ),
335 'edge' => esc_html__( 'Microsoft Edge', 'wpfnl' ),
336 ],
337 'default' => 'none',
338 'required' => [ 'display_condition_type', '=', 'browser' ],
339 ];
340
341 // Operating System
342 $this->controls['hide_on_os'] = [
343 'tab' => 'content',
344 'label' => esc_html__( 'Hide On Operating System', 'wpfnl' ),
345 'type' => 'select',
346 'options' => [
347 'none' => esc_html__( 'None', 'wpfnl' ),
348 'ios' => esc_html__( 'iOS', 'wpfnl' ),
349 'android' => esc_html__( 'Android', 'wpfnl' ),
350 'windows' => esc_html__( 'Windows', 'wpfnl' ),
351 'macos' => esc_html__( 'MacOS', 'wpfnl' ),
352 'linux' => esc_html__( 'Linux', 'wpfnl' ),
353 'sunos' => esc_html__( 'SunOS', 'wpfnl' ),
354 'openbsd' => esc_html__( 'OpenBSD', 'wpfnl' ),
355 ],
356 'default' => 'none',
357 'required' => [ 'display_condition_type', '=', 'operating_system' ],
358 ];
359
360 // Day
361 $this->controls['disable_on_days'] = [
362 'tab' => 'content',
363 'label' => esc_html__( 'Select Days You Want To Disable', 'wpfnl' ),
364 'type' => 'select',
365 'multiple' => true,
366 'options' => [
367 'monday' => esc_html__( 'Monday', 'wpfnl' ),
368 'tuesday' => esc_html__( 'Tuesday', 'wpfnl' ),
369 'wednesday' => esc_html__( 'Wednesday', 'wpfnl' ),
370 'thursday' => esc_html__( 'Thursday', 'wpfnl' ),
371 'friday' => esc_html__( 'Friday', 'wpfnl' ),
372 'saturday' => esc_html__( 'Saturday', 'wpfnl' ),
373 'sunday' => esc_html__( 'Sunday', 'wpfnl' ),
374 ],
375 'default' => [],
376 'required' => [ 'display_condition_type', '=', 'day' ],
377 ];
378
379 // Animation
380 $this->controls['animationSeparator'] = [
381 'label' => esc_html__( 'Animation', 'wpfnl' ),
382 'type' => 'separator',
383 ];
384
385 $this->controls['entrance_animation'] = [
386 'tab' => 'content',
387 'label' => esc_html__( 'Entrance Animation', 'wpfnl' ),
388 'type' => 'select',
389 'options' => [
390 '' => esc_html__( 'None', 'wpfnl' ),
391 'fadeIn' => esc_html__( 'Fade In', 'wpfnl' ),
392 'fadeInUp' => esc_html__( 'Fade In Up', 'wpfnl' ),
393 'fadeInDown' => esc_html__( 'Fade In Down', 'wpfnl' ),
394 'fadeInLeft' => esc_html__( 'Fade In Left', 'wpfnl' ),
395 'fadeInRight'=> esc_html__( 'Fade In Right', 'wpfnl' ),
396 'zoomIn' => esc_html__( 'Zoom In', 'wpfnl' ),
397 'zoomInUp' => esc_html__( 'Zoom In Up', 'wpfnl' ),
398 'bounceIn' => esc_html__( 'Bounce In', 'wpfnl' ),
399 'bounceInUp' => esc_html__( 'Bounce In Up', 'wpfnl' ),
400 'slideInUp' => esc_html__( 'Slide In Up', 'wpfnl' ),
401 'slideInLeft'=> esc_html__( 'Slide In Left', 'wpfnl' ),
402 'slideInRight'=> esc_html__( 'Slide In Right', 'wpfnl' ),
403 'flipInX' => esc_html__( 'Flip In X', 'wpfnl' ),
404 'flipInY' => esc_html__( 'Flip In Y', 'wpfnl' ),
405 'pulse' => esc_html__( 'Pulse', 'wpfnl' ),
406 'tada' => esc_html__( 'Tada', 'wpfnl' ),
407 'wobble' => esc_html__( 'Wobble', 'wpfnl' ),
408 ],
409 'inline' => false,
410 'placeholder' => esc_html__( 'None', 'wpfnl' ),
411 'default' => '',
412 'description' => esc_html__( 'Animation plays when the button enters the viewport on the live page.', 'wpfnl' ),
413 ];
414
415 // $this->controls['iconGap'] = [
416 // 'label' => esc_html__( 'Gap', 'wpfnl' ),
417 // 'type' => 'number',
418 // 'units' => true,
419 // 'css' => [
420 // [
421 // 'property' => 'gap',
422 // ],
423 // ],
424 // 'required' => [ 'icon', '!=', '' ],
425 // ];
426
427 // $this->controls['iconSpace'] = [
428 // 'label' => esc_html__( 'Space between', 'wpfnl' ),
429 // 'type' => 'checkbox',
430 // 'css' => [
431 // [
432 // 'property' => 'justify-content',
433 // 'value' => 'space-between',
434 // ],
435 // ],
436 // 'required' => [ 'icon', '!=', '' ],
437 // ];
438 }
439
440
441 /**
442 * Render the widget output on the frontend.
443 *
444 * Written in PHP and used to generate the final HTML.
445 *
446 * @since 3.1.0
447 *
448 * @access public
449 */
450 public function render() {
451 $settings = $this->settings;
452
453 // ---- Display Conditions ----------------------------------------
454 $display_condition = ! empty( $settings['display_condition_type'] ) ? $settings['display_condition_type'] : 'none';
455
456 if ( $display_condition === 'user_state' ) {
457 $hide_logged_in = ! empty( $settings['hide_from_logged_in'] );
458 $hide_logged_out = ! empty( $settings['hide_from_logged_out'] );
459
460 if ( $hide_logged_in && is_user_logged_in() ) {
461 return;
462 }
463 if ( $hide_logged_out && ! is_user_logged_in() ) {
464 return;
465 }
466
467 } elseif ( $display_condition === 'user_role' ) {
468 $hide_for_user_role = ! empty( $settings['hide_for_user_role'] ) ? $settings['hide_for_user_role'] : 'none';
469
470 if ( $hide_for_user_role !== 'none' && is_user_logged_in() ) {
471 $user = wp_get_current_user();
472 if ( in_array( $hide_for_user_role, $user->roles ) ) {
473 return;
474 }
475 }
476
477 } elseif ( $display_condition === 'day' ) {
478 $disable_on_days = ! empty( $settings['disable_on_days'] ) ? $settings['disable_on_days'] : [];
479
480 if ( ! empty( $disable_on_days ) && is_array( $disable_on_days ) ) {
481 $current_day = strtolower( date( 'l' ) ); // e.g., 'monday'
482 if ( in_array( $current_day, $disable_on_days ) ) {
483 return;
484 }
485 }
486
487 } elseif ( $display_condition === 'browser' ) {
488 $hide_on_browser = ! empty( $settings['hide_on_browser'] ) ? $settings['hide_on_browser'] : 'none';
489
490 if ( $hide_on_browser !== 'none' ) {
491 $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
492 $current_browser = '';
493
494 if ( strpos( $user_agent, 'edg' ) !== false ) {
495 $current_browser = 'edge';
496 } elseif ( strpos( $user_agent, 'opr' ) !== false || strpos( $user_agent, 'opera' ) !== false ) {
497 $current_browser = 'opera_mini';
498 } elseif ( strpos( $user_agent, 'chrome' ) !== false ) {
499 $current_browser = 'chrome';
500 } elseif ( strpos( $user_agent, 'safari' ) !== false ) {
501 $current_browser = 'safari';
502 } elseif ( strpos( $user_agent, 'firefox' ) !== false ) {
503 $current_browser = 'mozilla';
504 }
505
506 if ( $current_browser === $hide_on_browser ) {
507 return;
508 }
509 }
510
511 } elseif ( $display_condition === 'operating_system' ) {
512 $hide_on_os = ! empty( $settings['hide_on_os'] ) ? $settings['hide_on_os'] : 'none';
513
514 if ( $hide_on_os !== 'none' ) {
515 $user_agent = isset( $_SERVER['HTTP_USER_AGENT'] ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
516 $current_os = '';
517
518 if ( strpos( $user_agent, 'windows' ) !== false || strpos( $user_agent, 'win32' ) !== false || strpos( $user_agent, 'win64' ) !== false ) {
519 $current_os = 'windows';
520 } elseif ( strpos( $user_agent, 'macintosh' ) !== false || strpos( $user_agent, 'mac os x' ) !== false ) {
521 $current_os = 'macos';
522 } elseif ( strpos( $user_agent, 'linux' ) !== false && strpos( $user_agent, 'android' ) === false ) {
523 $current_os = 'linux';
524 } elseif ( strpos( $user_agent, 'android' ) !== false ) {
525 $current_os = 'android';
526 } elseif ( strpos( $user_agent, 'iphone' ) !== false || strpos( $user_agent, 'ipad' ) !== false || strpos( $user_agent, 'ipod' ) !== false ) {
527 $current_os = 'ios';
528 } elseif ( strpos( $user_agent, 'sunos' ) !== false ) {
529 $current_os = 'sunos';
530 } elseif ( strpos( $user_agent, 'openbsd' ) !== false ) {
531 $current_os = 'openbsd';
532 }
533
534 if ( $current_os === $hide_on_os ) {
535 return;
536 }
537 }
538 }
539 // ---- End Display Conditions ------------------------------------
540
541 $animation = ! empty( $settings['entrance_animation'] ) ? $settings['entrance_animation'] : '';
542 $animation_class = $animation ? ' wpfnl-animation ' . esc_attr( $animation ) : '';
543
544 $is_bricks_editor = isset( $_GET['bricks'] ) && 'run' === $_GET['bricks'];
545 $active_editor_class = '';
546 if ( $is_bricks_editor ) {
547 $bricks_editor_class = 'bricks-editor-active';
548 }else {
549 $bricks_editor_class = '';
550 }
551
552 $this->set_attribute( '_root', 'class', 'bricks-button '.$animation_class.'' );
553
554 if ( ! empty( $settings['size'] ) ) {
555 $this->set_attribute( '_root', 'class', $settings['size'] );
556 }
557
558 if ( ! empty( $settings['style'] ) ) {
559 // Outline
560 if ( isset( $settings['outline'] ) ) {
561 $this->set_attribute( '_root', 'class', 'outline' );
562 $this->set_attribute( '_root', 'class', "bricks-color-{$settings['style']}" );
563 }
564
565 // Fill (= default)
566 else {
567 $this->set_attribute( '_root', 'class', "bricks-background-{$settings['style']}" );
568 }
569 }
570
571 // Button circle
572 if ( isset( $settings['circle'] ) ) {
573 $this->set_attribute( '_root', 'class', 'circle' );
574 }
575
576 if ( isset( $settings['block'] ) ) {
577 $this->set_attribute( '_root', 'class', 'block' );
578 }
579
580
581 $icon = ! empty( $settings['icon'] ) ? self::render_icon( $settings['icon'] ) : false;
582 $icon_position = ! empty( $settings['iconPosition'] ) ? $settings['iconPosition'] : 'right';
583
584 $enable_subtitle = ! empty( $settings['enable_subtitle'] );
585 $subtitle_text = ! empty( $settings['subtitle_text'] ) ? $settings['subtitle_text'] : '';
586
587 // Responsive display classes
588 $responsive_classes = '';
589 if ( ! empty( $settings['hide_on_desktop'] ) ) {
590 $responsive_classes .= ' wpfnl-hide-desktop';
591 }
592 if ( ! empty( $settings['hide_on_tablet'] ) ) {
593 $responsive_classes .= ' wpfnl-hide-tablet';
594 }
595 if ( ! empty( $settings['hide_on_mobile'] ) ) {
596 $responsive_classes .= ' wpfnl-hide-mobile';
597 }
598
599 $output .= "<a href='#' class='wpfnl-next-step-button".' '.$responsive_classes.' '.$bricks_editor_class. ( $enable_subtitle && $subtitle_text ? ' wpfnl-has-subtitle' : '' ) . "' id='wpfunnels_next_step_controller' role='button'><span {$this->render_attributes( '_root' )} >";
600
601 if ( $enable_subtitle && $subtitle_text ) {
602 $output .= "<span class='icon-wrapper'>";
603 if ( $icon && $icon_position === 'left' ) {
604 $output .= $icon;
605 }
606
607 if ( ! empty( $settings['text'] ) ) {
608 $output .= trim( $settings['text'] );
609 }
610
611 if ( $icon && $icon_position === 'right' ) {
612 $output .= $icon;
613 }
614 $output .= "</span>";
615 $output .= '<small class="wpfnl-button-subtitle">' . esc_html( $subtitle_text ) . '</small>';
616
617 }else {
618 if ( $icon && $icon_position === 'left' ) {
619 $output .= $icon;
620 }
621
622 if ( ! empty( $settings['text'] ) ) {
623 $output .= trim( $settings['text'] );
624 }
625
626 if ( $icon && $icon_position === 'right' ) {
627 $output .= $icon;
628 }
629 }
630
631 $output .= "</span>";
632
633 $output .= "</a>";
634
635 echo $output;
636 }
637
638
639
640 }
641