PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 2.15
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v2.15
5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 3.0.70 3.0.71 3.0.72 All 35 releases
double-opt-in / ui / UISettings.class.php

UISettings.class.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 2.15, at ui/UISettings.class.php

166 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace forge12\contactform7\CF7DoubleOptIn {
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 /**
9 * Class UIDashboard
10 *
11 * @package forge12\contactform7\CF7DoubleOptIn
12 */
13 class UISettings extends UIPageForm
14 {
15 public function __construct($domain)
16 {
17 parent::__construct($domain, 'settings', 'Settings');
18 }
19
20 /**
21 * Render the license subpage content
22 */
23 protected function theContent($slug, $page, $settings)
24 {
25 $deleteOptionItems = array(
26 0 => 'never',
27 );
28
29 for($i = 1; $i < 31; $i++){
30 $deleteOptionItems[$i] = $i;
31 }
32
33 $deleteOptionPeriod = array(
34 'months' => 'months',
35 'days' => 'days',
36 'years' => 'years'
37 )
38
39 ?>
40 <h2>
41 <?php _e('Settings', 'double-opt-in'); ?>
42 </h2>
43
44 <div class="option">
45 <div class="label">
46 <label for="delete"><?php _e('Delete Opt-Ins', 'double-opt-in'); ?></label>
47 </div>
48 <div class="input">
49 <select id="delete" name="delete">
50 <?php
51 foreach ($deleteOptionItems as $month => $label):
52 ?>
53 <option value="<?php esc_attr_e($month); ?>" <?php echo $month == $settings['delete'] ? ' selected="selected" ' : ''; ?> >
54 <?php _e($label, 'double-opt-in'); ?>
55 </option>
56 <?php endforeach; ?>
57 </select>
58
59 <select id="delete_period" name="delete_period">
60 <?php
61 foreach ($deleteOptionPeriod as $key => $value):
62 ?>
63 <option value="<?php esc_attr_e($key); ?>" <?php echo $key == $settings['delete_period'] ? ' selected="selected" ' : ''; ?> >
64 <?php _e($value, 'double-opt-in'); ?>
65 </option>
66 <?php endforeach; ?>
67 </select>
68
69 <p>
70 <?php _e('Select the period of time after which all data will be deleted automatically. As for the european GDPR it is recommend to use the smallest period of time as possible.', 'double-opt-in'); ?>
71 </p>
72 </div>
73 </div>
74
75 <div class="option">
76 <div class="label">
77 <label for="delete_unconfirmed"><?php _e('Delete unconfirmed Opt-Ins', 'double-opt-in'); ?></label>
78 </div>
79 <div class="input">
80 <select id="delete_unconfirmed" name="delete_unconfirmed">
81 <?php
82 foreach ($deleteOptionItems as $month => $label):
83 ?>
84 <option value="<?php esc_attr_e($month); ?>" <?php echo $month == $settings['delete_unconfirmed'] ? ' selected="selected" ' : ''; ?> >
85 <?php _e($label, 'double-opt-in'); ?>
86 </option>
87 <?php endforeach; ?>
88 </select>
89
90 <select id="delete_unconfirmed_period" name="delete_unconfirmed_period">
91 <?php
92 foreach ($deleteOptionPeriod as $key => $value):
93 ?>
94 <option value="<?php esc_attr_e($key); ?>" <?php echo $key == $settings['delete_unconfirmed_period'] ? ' selected="selected" ' : ''; ?> >
95 <?php _e($value, 'double-opt-in'); ?>
96 </option>
97 <?php endforeach; ?>
98 </select>
99 <p>
100 <?php _e('Select the period of time after which all unconfirmed data will be deleted automatically. As for the european GDPR it is recommend to use the smallest period of time as possible.', 'double-opt-in'); ?>
101 </p>
102 </div>
103 </div>
104
105 <div class="option">
106 <div class="label">
107 <label for="support"><?php _e('Support Forge12 Double Opt-in: ', 'double-opt-in'); ?></label>
108 </div>
109 <div class="input">
110 <input type="hidden" class="toggle" name="support"
111 value="<?php esc_attr_e($settings['support']); ?>"
112 data-before="<?php _e('On', 'double-opt-in'); ?>"
113 data-after="<?php _e('Off', 'double-opt-in'); ?>"/>
114
115 <p>
116 <?php _e('The Footer will contain a noscript referral to support Forge12 Double Opt-in.', 'double-opt-in'); ?>
117 </p>
118 </div>
119 </div>
120
121 <?php
122 }
123
124 protected function theSidebar($slug, $page)
125 {
126 if ($page != 'settings') {
127 return;
128 }
129 ?>
130 <div class="box">
131 <h2>
132 <?php _e('Hint:', 'double-opt-in'); ?>
133 </h2>
134 <p>
135 <?php _e("In the table on the left side, you'll find an list global settings. They will affect all forms using the double opt-in.", 'double-opt-in'); ?>
136 </p>
137 </div>
138 <?php
139 }
140
141 public function getSettings($settings)
142 {
143 $settings = array_merge($settings, array(
144 'support' => 1,
145 'delete' => 0,
146 'delete_unconfirmed' => 7,
147 'delete_period' => 'months',
148 'delete_unconfirmed_period' => 'months'
149 )
150 );
151
152 return $settings;
153 }
154
155 protected function onSave($settings)
156 {
157 $settings['delete'] = (int)$_POST['delete'];
158 $settings['delete_unconfirmed'] = (int)$_POST['delete_unconfirmed'];
159 $settings['support'] = (int)$_POST['support'];
160 $settings['delete_period'] = sanitize_text_field($_POST['delete_period']);
161 $settings['delete_unconfirmed_period'] = sanitize_text_field($_POST['delete_unconfirmed_period']);
162
163 return $settings;
164 }
165 }
166 }