PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 3.0.3
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v3.0.3
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 / UIDashboard.class.php

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

179 lines 6.1 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 UIDashboard extends UIPage
14 {
15 /**
16 * Constructor for the class.
17 *
18 * @param TemplateHandler $templateHandler The template handler object.
19 * @param string $domain The text domain for translations.
20 *
21 * @return void
22 */
23 public function __construct(TemplateHandler $templateHandler, string $domain)
24 {
25 parent::__construct($templateHandler, $domain, 'f12-cf7-doubleoptin', __('Dashboard','double-opt-in'), 0);
26
27 }
28
29 public function getSettings($settings)
30 {
31 return $settings;
32 }
33
34 protected function onSave($settings)
35 {
36 return $settings;
37 }
38
39 /**
40 * Maybe delete an given entry.
41 */
42 private function maybeDelete()
43 {
44 if (isset($_GET['option']) && $_GET['option'] == 'delete' && isset($_GET['hash']) && !empty($_GET['hash']) && current_user_can('manage_options')) {
45 $hash = esc_attr($_GET['hash']);
46
47 $CleanUp = new CleanUp();
48
49 if ($CleanUp->deleteByHash($hash)) {
50 wp_redirect('admin.php?page=f12-cf7-doubleoptin&status=deleted');
51 wp_die();
52 } else {
53 wp_redirect('admin.php?page=f12-cf7-doubleoptin&status=error');
54 wp_die();
55 }
56
57 } else if (isset($_GET['status'])) {
58
59 $status = $_GET['status'];
60 if ($status == 'deleted') {
61 Messages::getInstance()->add(__('The given DOI has been removed.', 'double-opt-in'), 'success');
62 }
63 if ($status == 'error') {
64 Messages::getInstance()->add(__('Couldn\'t delete the DOI, please try again later.', 'double-opt-in'), 'error');
65 }
66 }
67 }
68
69 public function theContent($slug, $page, $settings)
70 {
71 // Check if there is a call to delete an specific entry
72 $this->maybeDelete();
73
74 // Render the optins
75 $this->renderLatestOptIns($slug, $page);
76 }
77
78 private function renderLatestOptins($slug, $page)
79 {
80 $atts = array(
81 'perPage' => 10,
82 'page' => 1,
83 'order' => 'DESC',
84 'keyword' => ''
85 );
86
87 if(isset($_GET['perPage'])){
88 $atts['perPage'] = (int)$_GET['perPage'];
89 }
90
91 if (isset($_GET['pageNum'])) {
92 $atts['page'] = (int)$_GET['pageNum'];
93 }
94
95 if(isset($_GET['keyword'])){
96 $atts['keyword'] = sanitize_text_field($_GET['keyword']);
97 }
98
99 if(isset($_GET['cf_form_id'])){
100 $atts['cf_form_id'] = (int)$_GET['cf_form_id'];
101 }
102
103 $numberOfPages = 0;
104 $listOfOptIns = OptIn::get_list($atts, $numberOfPages);
105
106 /*
107 * Render the Template
108 */
109 ?>
110 <h1><?php _e('Latest Opt-ins', 'double-opt-in'); ?></h1>
111 <?php
112
113 $this->TemplateHandler->renderTemplate('list-optins', array(
114 'domain' => $this->domain,
115 'listOfOptIns' => $listOfOptIns,
116 'numberOfPages' => $numberOfPages,
117 'currentPage' => $atts['page'],
118 'slug' => $slug
119 ));
120 }
121
122 public function theSidebar($slug, $page)
123 {
124 ?>
125 <div class="box">
126 <h2>
127 <?php _e('Hint:', 'double-opt-in'); ?>
128 </h2>
129 <p>
130 <?php _e("In the table on the left side, you'll find an list containing all Opt-Ins and the required information from your customers. Click on the hash to open aditional informations about the form and the user data. All unconfirmed opt-ins will be deleted after 7 days.", 'double-opt-in'); ?>
131 </p>
132 </div>
133 <div class="box">
134 <h2>
135 <?php _e('Hooks:', 'double-opt-in'); ?>
136 </h2>
137 <p>
138 <?php _e("You can use the following hooks to adjust the Opt-In to your requirements.", 'double-opt-in'); ?>
139 </p>
140 <p>
141 <strong><?php _e("An Opt-in link has been called which is already confirmed or has been deleted.", 'double-opt-in'); ?></strong>
142 </p>
143 <div class="option">
144 <div class="input">
145 <p>
146 add_action('f12_cf7_doubleoptin_already_confirmed', $hash, $OptIn)
147 <br>
148 </p>
149 </div>
150 </div>
151
152 <p>
153 <strong><?php _e("An Opt-in link has been called but not yet updated the database.", 'double-opt-in'); ?></strong>
154 </p>
155 <div class="option">
156 <div class="input">
157 <p>
158 add_action('f12_cf7_doubleoptin_before_confirm', $hash, $OptIn)
159 <br>
160 </p>
161 </div>
162 </div>
163
164 <p>
165 <strong><?php _e("An Opt-in link has been called and the database has been updated already.", 'double-opt-in'); ?></strong>
166 </p>
167 <div class="option">
168 <div class="input">
169 <p>
170 add_action('f12_cf7_doubleoptin_after_confirm', $hash, $OptIn)
171 </p>
172 </div>
173 </div>
174
175 </div>
176 <?php
177 }
178 }
179 }