PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 1.0.7
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v1.0.7
3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 All 122 releases
firebox / Inc / Core / Widgets / FireBoxButton.php

FireBoxButton.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 1.0.7, at Inc/Core/Widgets/FireBoxButton.php

114 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FireBox
4 * @version 1.0.7 Free
5 *
6 * @author FirePlugins <info@fireplugins.com>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2021 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FireBox\Core\Widgets;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 require_once FBOX_PLUGIN_DIR . 'Inc/Framework/Inc/Includes/Abstracts/FPF_Widget.php';
20
21 class FireBoxButton extends \FPF_Widget {
22 public function __construct() {
23 $this->widget_cssclass = '';
24 $this->widget_description = firebox()->_('FB_CHOOSE_BOX_TO_HANDLE');
25 $this->widget_id = 'firebox_add_button_widget';
26 $this->widget_name = firebox()->_('FB_ADD_A_FIREBOX_BUTTON');
27 $this->settings = [
28 'box' => [
29 'type' => 'select',
30 'default' => '',
31 'label' => firebox()->_('FB_SELECT_A_POPUP'),
32 'options' => \FireBox\Core\Helpers\BoxHelper::getAllBoxesParsedByKeyValue()
33 ],
34 'action' => [
35 'type' => 'select',
36 'default' => 'close',
37 'label' => firebox()->_('FB_FIREBOX_ACTION'),
38 'options' => [
39 'open' => firebox()->_('FB_OPEN'),
40 'close' => firebox()->_('FB_CLOSE'),
41 'toggle' => firebox()->_('FB_TOGGLE'),
42 ]
43 ],
44 'button_label' => [
45 'type' => 'text',
46 'default' => firebox()->_('FB_CLOSE'),
47 'label' => firebox()->_('FB_BUTTON_LABEL')
48 ],
49 'button_classes' => [
50 'type' => 'text',
51 'default' => 'button',
52 'label' => firebox()->_('FB_BUTTON_CLASSES')
53 ],
54 'button_link' => [
55 'type' => 'text',
56 'default' => '',
57 'label' => firebox()->_('FB_BUTTON_LINK')
58 ],
59 'prevent_default' => [
60 'type' => 'checkbox',
61 'default' => true,
62 'label' => firebox()->_('FB_METABOX_PREVENTDEFAULT')
63 ],
64 ];
65
66 parent::__construct();
67 }
68
69 /**
70 * Widget Output
71 *
72 * @param array $args
73 * @param array $instance
74 *
75 * @return void
76 */
77 public function widget($args, $instance)
78 {
79 if ($this->get_cached_widget($args))
80 {
81 return;
82 }
83
84 ob_start();
85
86 $box = !empty($instance['box']) ? absint($instance['box']) : '';
87 $action = !empty($instance['action']) ? strval($instance['action']) : '';
88 $button_label = !empty($instance['button_label']) ? strval($instance['button_label']) : '';
89 $button_classes = !empty($instance['button_classes']) ? strval($instance['button_classes']) : '';
90 $button_link = !empty($instance['button_link']) ? $instance['button_link'] : '';
91 $prevent_default = !empty($instance['prevent_default']) ? $instance['prevent_default'] : false;
92
93 if (empty($box) || empty($action) || empty($button_label))
94 {
95 return;
96 }
97
98 $box = ' data-fbox="' . esc_attr($box) . '"';
99 $action = ' data-fbox-cmd="' . esc_attr($action) . '"';
100 $prevent_default = ' data-fbox-prevent="' . ($prevent_default ? '1' : '0') . '"';
101
102 $this->widget_start($args, $instance);
103 ?>
104 <a href="<?php echo esc_url($button_link); ?>"<?php echo wp_kses_data($box . $action . $prevent_default); ?> class="<?php echo esc_attr($button_classes); ?>"><?php echo esc_html($button_label); ?></a>
105 <?php
106 $this->widget_end($args );
107
108 $content = ob_get_clean();
109
110 echo $content; // WPCS: XSS ok.
111
112 $this->cache_widget($args, $content);
113 }
114 }