Version Description
Release date: January 16th, 2018 * Added 'Contact Form 7' integration. * Added 'WooCommerce' integration. * Added 'WordPress Comments' integration. * Small bugfixes.
Download this release
Release Info
Developer | Van Ons |
Plugin | WP GDPR Compliance |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- Includes/Ajax.php +99 -0
- Includes/Extensions/CF7.php +194 -0
- Includes/Extensions/WC.php +54 -0
- Includes/Extensions/WP.php +52 -0
- Includes/Helpers.php +159 -0
- Includes/Integrations.php +68 -0
- Includes/Pages.php +126 -33
- assets/css/admin.css +168 -43
- assets/js/admin.js +102 -15
- languages/wp-gdpr-compliance-nl_NL.mo +0 -0
- languages/wp-gdpr-compliance-nl_NL.po +128 -24
- readme.txt +10 -3
- wp-gdpr-compliance.php +22 -18
Includes/Ajax.php
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGDPRC\Includes;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class Ajax
|
7 |
+
* @package WPGDPRC\Includes
|
8 |
+
*/
|
9 |
+
class Ajax {
|
10 |
+
/**
|
11 |
+
* Ajax constructor.
|
12 |
+
*/
|
13 |
+
public function __construct() {
|
14 |
+
add_action('wp_ajax_wpgdprc_process_action', array($this, 'processAction'));
|
15 |
+
}
|
16 |
+
|
17 |
+
public function processAction() {
|
18 |
+
check_ajax_referer('wpgdprc', 'security');
|
19 |
+
|
20 |
+
$output = array(
|
21 |
+
'error' => '',
|
22 |
+
'redirect' => false
|
23 |
+
);
|
24 |
+
$data = (isset($_POST['data']) && (is_array($_POST['data']) || is_string($_POST['data']))) ? $_POST['data'] : false;
|
25 |
+
if (is_string($data)) {
|
26 |
+
$data = json_decode(stripslashes($data), true);
|
27 |
+
}
|
28 |
+
$type = (isset($data['type']) && is_string($data['type'])) ? esc_html($data['type']) : false;
|
29 |
+
|
30 |
+
if (!$data) {
|
31 |
+
$output['error'] = __('Missing data.', WP_GDPR_C_SLUG);
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!$type) {
|
35 |
+
$output['error'] = __('Missing type.', WP_GDPR_C_SLUG);
|
36 |
+
}
|
37 |
+
|
38 |
+
if (empty($output['error'])) {
|
39 |
+
switch ($type) {
|
40 |
+
case 'save_setting' :
|
41 |
+
$option = (isset($data['option']) && is_string($data['option'])) ? esc_html($data['option']) : false;
|
42 |
+
$value = (isset($data['value'])) ? self::sanitizeValue($data['value']) : false;
|
43 |
+
$enabled = (isset($data['enabled'])) ? filter_var($data['enabled'], FILTER_VALIDATE_BOOLEAN) : false;
|
44 |
+
$append = (isset($data['append'])) ? filter_var($data['append'], FILTER_VALIDATE_BOOLEAN) : false;
|
45 |
+
|
46 |
+
if (!$option) {
|
47 |
+
$output['error'] = __('Missing option name.', WP_GDPR_C_SLUG);
|
48 |
+
}
|
49 |
+
|
50 |
+
if (!isset($data['value'])) {
|
51 |
+
$output['error'] = __('Missing value.', WP_GDPR_C_SLUG);
|
52 |
+
}
|
53 |
+
|
54 |
+
// Let's do this!
|
55 |
+
if (empty($output['error'])) {
|
56 |
+
if ($append) {
|
57 |
+
$values = (array)get_option($option, array());
|
58 |
+
if ($enabled) {
|
59 |
+
if (!in_array($value, $values)) {
|
60 |
+
$values[] = $value;
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
$index = array_search($value, $values);
|
64 |
+
if ($index !== false) {
|
65 |
+
unset($values[$index]);
|
66 |
+
}
|
67 |
+
}
|
68 |
+
$value = $values;
|
69 |
+
} else {
|
70 |
+
if (isset($data['enabled'])) {
|
71 |
+
$value = $enabled;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
update_option($option, $value);
|
75 |
+
do_action($option, $value);
|
76 |
+
}
|
77 |
+
break;
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
header('Content-type: application/json');
|
82 |
+
echo json_encode($output);
|
83 |
+
die();
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* @param $value
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
private static function sanitizeValue($value) {
|
91 |
+
if (is_numeric($value)) {
|
92 |
+
$value = intval($value);
|
93 |
+
}
|
94 |
+
if (is_string($value)) {
|
95 |
+
$value = esc_html($value);
|
96 |
+
}
|
97 |
+
return $value;
|
98 |
+
}
|
99 |
+
}
|
Includes/Extensions/CF7.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGDPRC\Includes\Extensions;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class CF7
|
7 |
+
* @package WPGDPRC\Includes\Extensions
|
8 |
+
*/
|
9 |
+
class CF7 {
|
10 |
+
const ID = 'contact-form-7';
|
11 |
+
/** @var null */
|
12 |
+
private static $instance = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return CF7
|
16 |
+
*/
|
17 |
+
public static function getInstance() {
|
18 |
+
if (!isset(self::$instance)) {
|
19 |
+
self::$instance = new self();
|
20 |
+
}
|
21 |
+
return self::$instance;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function processIntegration() {
|
25 |
+
$this->addFormTagToForms();
|
26 |
+
$this->removeFormTagFromForms();
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Add [WPGDPRC] string to enabled forms
|
31 |
+
*/
|
32 |
+
public function addFormTagToForms() {
|
33 |
+
foreach ($this->getEnabledForms() as $formId) {
|
34 |
+
$tag = '[wpgdprc "' . $this->getLabelText($formId) . '"]';
|
35 |
+
$output = get_post_meta($formId, '_form', true);
|
36 |
+
preg_match('/(\[wpgdprc?.*\])/', $output, $matches);
|
37 |
+
if (!empty($matches)) {
|
38 |
+
$output = str_replace($matches[0], $tag, $output);
|
39 |
+
} else {
|
40 |
+
$pattern = '/(\[submit?.*\])/';
|
41 |
+
preg_match($pattern, $output, $matches);
|
42 |
+
if (!empty($matches)) {
|
43 |
+
$output = preg_replace($pattern, "$tag\n\n" . $matches[0], $output);
|
44 |
+
} else {
|
45 |
+
$output = $output . "\n\n$tag";
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
update_post_meta($formId, '_form', $output);
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Remove [WPGDPRC] string from disabled forms
|
55 |
+
*/
|
56 |
+
public function removeFormTagFromForms() {
|
57 |
+
foreach (CF7::getInstance()->getForms() as $form) {
|
58 |
+
if (!in_array($form, $this->getEnabledForms())) {
|
59 |
+
$output = get_post_meta($form, '_form', true);
|
60 |
+
$pattern = '/(\n\n\[wpgdprc?.*\])/';
|
61 |
+
preg_match($pattern, $output, $matches);
|
62 |
+
if (!empty($matches)) {
|
63 |
+
$output = preg_replace($pattern, '', $output);
|
64 |
+
update_post_meta($form, '_form', $output);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
*
|
72 |
+
*/
|
73 |
+
public function addFormTagSupport() {
|
74 |
+
wpcf7_add_form_tag(
|
75 |
+
'wpgdprc',
|
76 |
+
array($this, 'addFormTagHandler')
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @param \WPCF7_FormTag $tag
|
82 |
+
* @return string
|
83 |
+
*/
|
84 |
+
public function addFormTagHandler(\WPCF7_FormTag $tag) {
|
85 |
+
$output = '';
|
86 |
+
switch ($tag['type']) {
|
87 |
+
case 'wpgdprc' :
|
88 |
+
$tag->name = 'wpgdprc';
|
89 |
+
$label = (!empty($tag->labels[0])) ? esc_html($tag->labels[0]) : self::getLabelText();
|
90 |
+
$class = wpcf7_form_controls_class($tag->type, 'wpcf7-validates-as-required');
|
91 |
+
$validation_error = wpcf7_get_validation_error($tag->name);
|
92 |
+
if ($validation_error) {
|
93 |
+
$class .= ' wpcf7-not-valid';
|
94 |
+
}
|
95 |
+
$label_first = $tag->has_option('label_first');
|
96 |
+
$atts = wpcf7_format_atts(array(
|
97 |
+
'class' => $tag->get_class_option($class),
|
98 |
+
'id' => $tag->get_id_option(),
|
99 |
+
));
|
100 |
+
$item_atts = wpcf7_format_atts(array(
|
101 |
+
'type' => 'checkbox',
|
102 |
+
'name' => $tag->name,
|
103 |
+
'value' => 1,
|
104 |
+
'tabindex' => $tag->get_option('tabindex', 'signed_int', true),
|
105 |
+
'aria-required' => 'true',
|
106 |
+
'aria-invalid' => ($validation_error) ? 'true' : 'false',
|
107 |
+
));
|
108 |
+
|
109 |
+
if ($label_first) { // put label first, input last
|
110 |
+
$output = sprintf(
|
111 |
+
'<span class="wpcf7-list-item-label">%1$s</span><input %2$s />',
|
112 |
+
esc_html($label),
|
113 |
+
$item_atts
|
114 |
+
);
|
115 |
+
} else {
|
116 |
+
$output = sprintf(
|
117 |
+
'<input %2$s /><span class="wpcf7-list-item-label">%1$s</span>',
|
118 |
+
esc_html($label),
|
119 |
+
$item_atts
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
$output = '<span class="wpcf7-list-item"><label>' . $output . '</label></span>';
|
124 |
+
$output = sprintf(
|
125 |
+
'<span class="wpcf7-form-control-wrap %1$s"><span %2$s>%3$s</span>%4$s</span>',
|
126 |
+
sanitize_html_class($tag->name),
|
127 |
+
$atts,
|
128 |
+
$output,
|
129 |
+
$validation_error
|
130 |
+
);
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
return $output;
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* @param \WPCF7_Validation $result
|
138 |
+
* @param \WPCF7_FormTag $tag
|
139 |
+
* @return \WPCF7_Validation
|
140 |
+
*/
|
141 |
+
public function validateField(\WPCF7_Validation $result, \WPCF7_FormTag $tag) {
|
142 |
+
switch ($tag['type']) {
|
143 |
+
case 'wpgdprc' :
|
144 |
+
$tag->name = 'wpgdprc';
|
145 |
+
$name = $tag->name;
|
146 |
+
$value = (isset($_POST[$name])) ? filter_var($_POST[$name], FILTER_VALIDATE_BOOLEAN) : false;
|
147 |
+
if ($value === false) {
|
148 |
+
$result->invalidate($tag, get_option(WP_GDPR_C_PREFIX . '_advanced_error'));
|
149 |
+
}
|
150 |
+
break;
|
151 |
+
}
|
152 |
+
return $result;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @return array
|
157 |
+
*/
|
158 |
+
public function getForms() {
|
159 |
+
return get_posts(array(
|
160 |
+
'post_type' => 'wpcf7_contact_form',
|
161 |
+
'posts_per_page' => -1,
|
162 |
+
'fields' => 'ids'
|
163 |
+
));
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* @return array
|
168 |
+
*/
|
169 |
+
public function getEnabledForms() {
|
170 |
+
return (array)get_option(WP_GDPR_C_PREFIX . '_integrations_' . self::ID . '_forms', array());
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* @return array
|
175 |
+
*/
|
176 |
+
public function getFormTexts() {
|
177 |
+
return (array)get_option(WP_GDPR_C_PREFIX . '_integrations_' . self::ID . '_form_text', array());
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* @param int $formId
|
182 |
+
* @return string
|
183 |
+
*/
|
184 |
+
public function getLabelText($formId = 0) {
|
185 |
+
$output = __('By using this form you agree with the storage and handling of your data by this website.', WP_GDPR_C_SLUG);
|
186 |
+
if (!empty($formId)) {
|
187 |
+
$texts = $this->getFormTexts();
|
188 |
+
if (!empty($texts[$formId])) {
|
189 |
+
$output = $texts[$formId];
|
190 |
+
}
|
191 |
+
}
|
192 |
+
return $output;
|
193 |
+
}
|
194 |
+
}
|
Includes/Extensions/WC.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGDPRC\Includes\Extensions;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WC
|
7 |
+
* @package WPGDPRC\Includes\Extensions
|
8 |
+
*/
|
9 |
+
class WC {
|
10 |
+
const ID = 'woocommerce';
|
11 |
+
/** @var null */
|
12 |
+
private static $instance = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return WC
|
16 |
+
*/
|
17 |
+
public static function getInstance() {
|
18 |
+
if (!isset(self::$instance)) {
|
19 |
+
self::$instance = new self();
|
20 |
+
}
|
21 |
+
return self::$instance;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param \WC_Checkout $checkout
|
26 |
+
*/
|
27 |
+
public function addField(\WC_Checkout $checkout) {
|
28 |
+
woocommerce_form_field(
|
29 |
+
'wpgdprc',
|
30 |
+
array(
|
31 |
+
'type' => 'checkbox',
|
32 |
+
'class' => array('wpgdprc-checkbox'),
|
33 |
+
'label' => esc_html(self::getLabelText()),
|
34 |
+
'required' => true,
|
35 |
+
),
|
36 |
+
$checkout->get_value('wpgdprc')
|
37 |
+
);
|
38 |
+
}
|
39 |
+
|
40 |
+
public function checkPost() {
|
41 |
+
if (!isset($_POST['wpgdprc'])) {
|
42 |
+
wc_add_notice(sprintf(esc_html(get_option(WP_GDPR_C_PREFIX . '_advanced_error'))), 'error');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return mixed
|
48 |
+
*/
|
49 |
+
public function getLabelText() {
|
50 |
+
$default = __('By using this form you agree with the storage and handling of your data by this website.', WP_GDPR_C_SLUG);
|
51 |
+
$option = get_option(WP_GDPR_C_PREFIX . '_integrations_' . self::ID . '_text');
|
52 |
+
return !empty($option) ? $option : $default;
|
53 |
+
}
|
54 |
+
}
|
Includes/Extensions/WP.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGDPRC\Includes\Extensions;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class WP
|
7 |
+
* @package WPGDPRC\Includes\Extensions
|
8 |
+
*/
|
9 |
+
class WP {
|
10 |
+
const ID = 'wordpress';
|
11 |
+
/** @var null */
|
12 |
+
private static $instance = null;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return WP
|
16 |
+
*/
|
17 |
+
public static function getInstance() {
|
18 |
+
if (!isset(self::$instance)) {
|
19 |
+
self::$instance = new self();
|
20 |
+
}
|
21 |
+
return self::$instance;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param string $field
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public function addField($field = '') {
|
29 |
+
$field .= apply_filters('wpgdprc_wordpress_field', '<p class="wpgdprc-checkbox"><label><input type="checkbox" name="wpgdprc" id="wpgdprc" value="1" />' . esc_html(self::getLabelText()) . ' <abbr class="required" title="required">*</abbr></label></p>', $field);
|
30 |
+
return $field;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @param array $post
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function checkPost($post = array()) {
|
38 |
+
if (!isset($_POST['wpgdprc'])) {
|
39 |
+
wp_die(get_option(WP_GDPR_C_PREFIX . '_advanced_error'));
|
40 |
+
}
|
41 |
+
return $post;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @return mixed
|
46 |
+
*/
|
47 |
+
public function getLabelText() {
|
48 |
+
$default = __('By using this form you agree with the storage and handling of your data by this website.', WP_GDPR_C_SLUG);
|
49 |
+
$option = get_option(WP_GDPR_C_PREFIX . '_integrations_' . self::ID . '_text');
|
50 |
+
return !empty($option) ? $option : $default;
|
51 |
+
}
|
52 |
+
}
|
Includes/Helpers.php
CHANGED
@@ -2,11 +2,21 @@
|
|
2 |
|
3 |
namespace WPGDPRC\Includes;
|
4 |
|
|
|
|
|
|
|
5 |
/**
|
6 |
* Class Helpers
|
7 |
* @package WPGDPRC\Includes
|
8 |
*/
|
9 |
class Helpers {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* @return array
|
12 |
*/
|
@@ -34,4 +44,153 @@ class Helpers {
|
|
34 |
),
|
35 |
);
|
36 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
2 |
|
3 |
namespace WPGDPRC\Includes;
|
4 |
|
5 |
+
use WPGDPRC\Includes\Extensions\CF7;
|
6 |
+
use WPGDPRC\Includes\Extensions\WC;
|
7 |
+
|
8 |
/**
|
9 |
* Class Helpers
|
10 |
* @package WPGDPRC\Includes
|
11 |
*/
|
12 |
class Helpers {
|
13 |
+
/**
|
14 |
+
* @return array
|
15 |
+
*/
|
16 |
+
public static function getPluginData() {
|
17 |
+
return get_plugin_data(WP_GDPR_C_ROOT_FILE);
|
18 |
+
}
|
19 |
+
|
20 |
/**
|
21 |
* @return array
|
22 |
*/
|
44 |
),
|
45 |
);
|
46 |
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param string $plugin
|
50 |
+
* @param string $type
|
51 |
+
* @return bool
|
52 |
+
*/
|
53 |
+
public static function isEnabled($plugin = '', $type = 'integrations') {
|
54 |
+
return filter_var(get_option(WP_GDPR_C_PREFIX . '_' . $type . '_' . $plugin), FILTER_VALIDATE_BOOLEAN);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @param string $plugin
|
59 |
+
* @return string
|
60 |
+
*/
|
61 |
+
public static function getSupportedPluginOptions($plugin = '') {
|
62 |
+
$output = '';
|
63 |
+
switch ($plugin) {
|
64 |
+
case CF7::ID :
|
65 |
+
$optionNameForms = WP_GDPR_C_PREFIX . '_integrations_' . $plugin . '_forms';
|
66 |
+
$optionNameFormText = WP_GDPR_C_PREFIX . '_integrations_' . $plugin . '_form_text';
|
67 |
+
$valueForms = CF7::getInstance()->getEnabledForms();
|
68 |
+
$output .= '<ul class="wpgdprc-checklist-options">';
|
69 |
+
foreach (CF7::getInstance()->getForms() as $form) {
|
70 |
+
$formSettingId = WP_GDPR_C_PREFIX . '_integrations_' . $plugin . '_form_' . $form;
|
71 |
+
$textSettingId = WP_GDPR_C_PREFIX . '_integrations_' . $plugin . '_form_text_' . $form;
|
72 |
+
$text = CF7::getInstance()->getLabelText($form);
|
73 |
+
$output .= '<li>';
|
74 |
+
$output .= '<div class="wpgdprc-checkbox">';
|
75 |
+
$output .= '<input type="checkbox" name="' . $optionNameForms . '[]" id="' . $formSettingId . '" value="' . $form . '" tabindex="1" data-type="save_setting" data-option="' . $optionNameForms . '" data-append="1" ' . checked(true, (in_array($form, $valueForms)), false) . ' />';
|
76 |
+
$output .= '<label for="' . $formSettingId . '"><strong>Form: ' . get_the_title($form) . '</strong></label>';
|
77 |
+
$output .= '<span class="wpgdprc-instructions">' . __('Activate for this form:', WP_GDPR_C_SLUG) . '</span>';
|
78 |
+
$output .= '<div class="wpgdprc-switch" aria-hidden="true">';
|
79 |
+
$output .= '<div class="wpgdprc-switch-label">';
|
80 |
+
$output .= '<div class="wpgdprc-switch-inner"></div>';
|
81 |
+
$output .= '<div class="wpgdprc-switch-switch"></div>';
|
82 |
+
$output .= '</div>';
|
83 |
+
$output .= '</div>';
|
84 |
+
$output .= '</div>';
|
85 |
+
$output .= '<p class="wpgdprc-setting">';
|
86 |
+
$output .= '<label for="' . $textSettingId . '">' . __('Checkbox text', WP_GDPR_C_SLUG) . '</label>';
|
87 |
+
$output .= '<input type="text" name="' . $optionNameFormText . '[' . $form . ']' . '" class="regular-text" id="' . $textSettingId . '" placeholder="' . $text . '" value="' . $text . '" />';
|
88 |
+
$output .= '</p>';
|
89 |
+
$output .= '</li>';
|
90 |
+
}
|
91 |
+
$output .= '</ul>';
|
92 |
+
break;
|
93 |
+
default :
|
94 |
+
$optionName = WP_GDPR_C_PREFIX . '_integrations_' . $plugin . '_text';
|
95 |
+
$text = get_option($optionName);
|
96 |
+
$text = empty($text) ? __('By using this form you agree with the storage and handling of your data by this website.', WP_GDPR_C_SLUG) : $text;
|
97 |
+
$output .= '<ul class="wpgdprc-checklist-options">';
|
98 |
+
$output .= '<li>';
|
99 |
+
$output .= '<p class="wpgdprc-setting">';
|
100 |
+
$output .= '<label for="' . $optionName . '">' . __('Checkbox text', WP_GDPR_C_SLUG) . '</label>';
|
101 |
+
$output .= '<input type="text" name="' . $optionName . '" class="regular-text" id="' . $optionName . '" placeholder="' . $text . '" value="' . $text . '" />';
|
102 |
+
$output .= '</p>';
|
103 |
+
$output .= '</li>';
|
104 |
+
$output .= '</ul>';
|
105 |
+
break;
|
106 |
+
}
|
107 |
+
return $output;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @return array
|
112 |
+
*/
|
113 |
+
public static function getSupportedWordpress() {
|
114 |
+
return array(
|
115 |
+
array(
|
116 |
+
'id' => 'wordpress',
|
117 |
+
'name' => __('WordPress Comments', WP_GDPR_C_SLUG),
|
118 |
+
'description' => 'When activated the GDPR checkbox will be added automatically just above the \'Post Comment\' button.',
|
119 |
+
'text_field' => true,
|
120 |
+
'fields' => false
|
121 |
+
)
|
122 |
+
);
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* @return array
|
127 |
+
*/
|
128 |
+
public static function getSupportedPlugins() {
|
129 |
+
return array(
|
130 |
+
array(
|
131 |
+
'id' => CF7::ID,
|
132 |
+
'file' => 'contact-form-7/wp-contact-form-7.php',
|
133 |
+
'name' => __('Contact Form 7', WP_GDPR_C_SLUG),
|
134 |
+
'description' => __('A GDPR shortcode will be automatically added to every form you activate it for.', WP_GDPR_C_SLUG),
|
135 |
+
'text_field' => false,
|
136 |
+
'fields' => array(
|
137 |
+
'integrations_%id%_forms',
|
138 |
+
'integrations_%id%_form_text'
|
139 |
+
)
|
140 |
+
),
|
141 |
+
array(
|
142 |
+
'id' => WC::ID,
|
143 |
+
'file' => 'woocommerce/woocommerce.php',
|
144 |
+
'name' => __('WooCommerce', WP_GDPR_C_SLUG),
|
145 |
+
'description' => __('The GDPR checkbox will be added automatically at the end of your checkout page.', WP_GDPR_C_SLUG),
|
146 |
+
'text_field' => true,
|
147 |
+
'fields' => false
|
148 |
+
)
|
149 |
+
);
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @return array
|
154 |
+
*/
|
155 |
+
public static function getSupported() {
|
156 |
+
return array_merge(self::getSupportedPlugins(), self::getSupportedWordpress());
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @param array $output
|
161 |
+
* @return array
|
162 |
+
*/
|
163 |
+
public static function getActivatedPlugins($output = array()) {
|
164 |
+
$activePlugins = (!empty(get_option('active_plugins'))) ? get_option('active_plugins') : array();
|
165 |
+
foreach (self::getSupportedPlugins() as $plugin) {
|
166 |
+
if (in_array($plugin['file'], $activePlugins)) {
|
167 |
+
$output[] = $plugin;
|
168 |
+
}
|
169 |
+
}
|
170 |
+
foreach (self::getSupportedWordpress() as $wp) {
|
171 |
+
$output[] = $wp;
|
172 |
+
}
|
173 |
+
return $output;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param array $output
|
178 |
+
* @return array
|
179 |
+
*/
|
180 |
+
public static function getEnabledPlugins($output = array()) {
|
181 |
+
foreach (self::getActivatedPlugins() as $plugin) {
|
182 |
+
if (self::isEnabled($plugin['id'])) {
|
183 |
+
$output[] = $plugin;
|
184 |
+
}
|
185 |
+
}
|
186 |
+
return $output;
|
187 |
+
}
|
188 |
+
|
189 |
+
/**
|
190 |
+
* @param string $option
|
191 |
+
* @return mixed
|
192 |
+
*/
|
193 |
+
public static function getAdvancedOption($option = '') {
|
194 |
+
return get_option(WP_GDPR_C_PREFIX . '_advanced_' . $option);
|
195 |
+
}
|
196 |
}
|
Includes/Integrations.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGDPRC\Includes;
|
4 |
+
|
5 |
+
use WPGDPRC\Includes\Extensions\CF7;
|
6 |
+
use WPGDPRC\Includes\Extensions\WC;
|
7 |
+
use WPGDPRC\Includes\Extensions\WP;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class Integrations
|
11 |
+
* @package WPGDPRC\Includes
|
12 |
+
*/
|
13 |
+
class Integrations {
|
14 |
+
/** @var null */
|
15 |
+
private static $instance = null;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return null|Integrations
|
19 |
+
*/
|
20 |
+
public static function getInstance() {
|
21 |
+
if (!isset(self::$instance)) {
|
22 |
+
self::$instance = new self();
|
23 |
+
}
|
24 |
+
return self::$instance;
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Integrations constructor.
|
29 |
+
*/
|
30 |
+
public function __construct() {
|
31 |
+
foreach (Helpers::getEnabledPlugins() as $plugin) {
|
32 |
+
switch ($plugin['id']) {
|
33 |
+
case CF7::ID :
|
34 |
+
add_action('update_option_' . WP_GDPR_C_PREFIX . '_integrations_' . CF7::ID . '_forms', array(CF7::getInstance(), 'processIntegration'));
|
35 |
+
add_action('update_option_' . WP_GDPR_C_PREFIX . '_integrations_' . CF7::ID . '_form_text', array(CF7::getInstance(), 'processIntegration'));
|
36 |
+
add_action('wpcf7_init', array(CF7::getInstance(), 'addFormTagSupport'));
|
37 |
+
add_filter('wpcf7_validate_wpgdprc', array(CF7::getInstance(), 'validateField'), 10, 2);
|
38 |
+
break;
|
39 |
+
|
40 |
+
case WC::ID :
|
41 |
+
add_action('woocommerce_checkout_process', array(WC::getInstance(), 'checkPost'));
|
42 |
+
add_action('woocommerce_after_order_notes', array(WC::getInstance(), 'addField'));
|
43 |
+
break;
|
44 |
+
|
45 |
+
case WP::ID :
|
46 |
+
add_action('comment_form_field_comment', array(WP::getInstance(), 'addField'));
|
47 |
+
add_filter('preprocess_comment', array(WP::getInstance(), 'checkPost'));
|
48 |
+
break;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
register_setting(WP_GDPR_C_SLUG, WP_GDPR_C_PREFIX . '_advanced_error');
|
52 |
+
}
|
53 |
+
|
54 |
+
public function registerSettings() {
|
55 |
+
foreach (Helpers::getSupported() as $plugin) {
|
56 |
+
register_setting(WP_GDPR_C_SLUG, WP_GDPR_C_PREFIX . '_integrations_' . $plugin['id'], 'intval');
|
57 |
+
if(!empty($plugin['text_field'])) {
|
58 |
+
register_setting(WP_GDPR_C_SLUG, WP_GDPR_C_PREFIX . '_integrations_' . $plugin['id'] . '_text');
|
59 |
+
}
|
60 |
+
if (!empty($plugin['fields'])) {
|
61 |
+
foreach ($plugin['fields'] as $field) {
|
62 |
+
$field = str_replace('%id%', $plugin['id'], $field);
|
63 |
+
register_setting(WP_GDPR_C_SLUG, WP_GDPR_C_PREFIX . '_' . $field);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
Includes/Pages.php
CHANGED
@@ -20,11 +20,18 @@ class Pages {
|
|
20 |
return self::$instance;
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
public function addAdminMenu() {
|
|
|
24 |
add_submenu_page(
|
25 |
'tools.php',
|
26 |
-
|
27 |
-
|
28 |
'manage_options',
|
29 |
'wp_gdpr_compliance',
|
30 |
array($this, 'generatePage')
|
@@ -32,48 +39,134 @@ class Pages {
|
|
32 |
}
|
33 |
|
34 |
public function generatePage() {
|
|
|
|
|
|
|
35 |
?>
|
36 |
<div class="wrap">
|
37 |
<div class="wpgdprc">
|
38 |
-
<h1 class="wpgdprc-title"><i class="fa fa-lock" aria-hidden="true"></i> <?php
|
|
|
|
|
39 |
|
40 |
<p class="wpgdprc-description">
|
41 |
-
This plugin assists website and webshop owners to comply with European privacy regulations (known as GDPR).
|
42 |
-
By May 24th, 2018 your website or shop has to comply to avoid large fines. The regulation can be read here:
|
43 |
-
<a target="_blank" href="//www.eugdpr.org/the-regulation.html"
|
44 |
-
|
45 |
-
|
46 |
-
<
|
47 |
-
<?php
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
<label
|
52 |
-
<
|
53 |
-
|
54 |
-
<div class="wpgdprc-switch-inner"></div>
|
55 |
-
<div class="wpgdprc-switch-switch"></div>
|
56 |
-
</div>
|
57 |
-
</div>
|
58 |
</div>
|
59 |
|
60 |
-
|
61 |
-
<div class="wpgdprc-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</div>
|
64 |
-
<?php endif; ?>
|
65 |
-
</li>
|
66 |
-
<?php endforeach; ?>
|
67 |
-
</ul>
|
68 |
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
</div>
|
76 |
-
|
|
|
|
|
|
|
|
|
77 |
|
78 |
<div class="wpgdprc-background"><?php include(WP_GDPR_C_DIR_SVG . '/inline-waves.svg.php'); ?></div>
|
79 |
</div>
|
20 |
return self::$instance;
|
21 |
}
|
22 |
|
23 |
+
public function registerSettings() {
|
24 |
+
foreach (Helpers::getCheckList() as $id => $check) {
|
25 |
+
register_setting(WP_GDPR_C_SLUG, WP_GDPR_C_PREFIX . '_general_' . $id, 'intval');
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
public function addAdminMenu() {
|
30 |
+
$pluginData = Helpers::getPluginData();
|
31 |
add_submenu_page(
|
32 |
'tools.php',
|
33 |
+
$pluginData['Name'],
|
34 |
+
$pluginData['Name'],
|
35 |
'manage_options',
|
36 |
'wp_gdpr_compliance',
|
37 |
array($this, 'generatePage')
|
39 |
}
|
40 |
|
41 |
public function generatePage() {
|
42 |
+
$pluginData = Helpers::getPluginData();
|
43 |
+
$activatedPlugins = Helpers::getActivatedPlugins();
|
44 |
+
$errorMessage = Helpers::getAdvancedOption('error');
|
45 |
?>
|
46 |
<div class="wrap">
|
47 |
<div class="wpgdprc">
|
48 |
+
<h1 class="wpgdprc-title"><i class="fa fa-lock" aria-hidden="true"></i> <?php echo $pluginData['Name']; ?></h1>
|
49 |
+
|
50 |
+
<?php settings_errors(); ?>
|
51 |
|
52 |
<p class="wpgdprc-description">
|
53 |
+
<?php _e('This plugin assists website and webshop owners to comply with European privacy regulations (known as GDPR).
|
54 |
+
By May 24th, 2018 your website or shop has to comply to avoid large fines. The regulation can be read here:', WP_GDPR_C_SLUG); ?>
|
55 |
+
<a target="_blank" href="//www.eugdpr.org/the-regulation.html"><?php _e('GDPR Key Changes', WP_GDPR_C_SLUG); ?></a>
|
56 |
+
</p>
|
57 |
+
|
58 |
+
<form method="post" action="<?php echo admin_url('options.php'); ?>" novalidate="novalidate">
|
59 |
+
<?php settings_fields(WP_GDPR_C_SLUG); ?>
|
60 |
+
|
61 |
+
<div class="wpgdprc-tabs">
|
62 |
+
<div class="wpgdprc-tabs__navigation cf">
|
63 |
+
<a id="tab-general-label" class="active" href="#tab-general" aria-selected="true" aria-controls="tab-general" tabindex="0" role="tab"><?php _e('General', WP_GDPR_C_SLUG); ?></a>
|
64 |
+
<a id="tab-integrations-label" href="#tab-integrations" aria-controls="tab-integrations" tabindex="-1" role="tab"><?php _e('Integrations', WP_GDPR_C_SLUG); ?></a>
|
65 |
+
<a id="tab-advanced-label" href="#tab-advanced" aria-controls="tab-advanced" tabindex="-1" role="tab"><?php _e('Advanced', WP_GDPR_C_SLUG); ?></a>
|
|
|
|
|
|
|
|
|
66 |
</div>
|
67 |
|
68 |
+
<div class="wpgdprc-tabs__content">
|
69 |
+
<div id="tab-general" class="wpgdprc-tabs__panel active" aria-labelledby="tab-general-label" role="tabpanel">
|
70 |
+
<p><?php _e('Below we ask you what private data you currently collect and provide you with tips to comply.', WP_GDPR_C_SLUG); ?></p>
|
71 |
+
|
72 |
+
<ul class="wpgdprc-list">
|
73 |
+
<?php
|
74 |
+
foreach (Helpers::getCheckList() as $id => $check) :
|
75 |
+
$optionName = WP_GDPR_C_PREFIX . '_general_' . $id;
|
76 |
+
$checked = Helpers::isEnabled($id, 'general');
|
77 |
+
$description = (!empty($check['description'])) ? esc_html($check['description']) : '';
|
78 |
+
?>
|
79 |
+
<li>
|
80 |
+
<div class="wpgdprc-checkbox">
|
81 |
+
<input type="checkbox" name="<?php echo $optionName; ?>" id="<?php echo $id; ?>" value="1" tabindex="1" data-type="save_setting" data-option="<?php echo $optionName; ?>" <?php checked(true, $checked); ?> />
|
82 |
+
<label for="<?php echo $id; ?>"><?php echo $check['label']; ?></label>
|
83 |
+
<div class="wpgdprc-switch wpgdprc-switch--reverse" aria-hidden="true">
|
84 |
+
<div class="wpgdprc-switch-label">
|
85 |
+
<div class="wpgdprc-switch-inner"></div>
|
86 |
+
<div class="wpgdprc-switch-switch"></div>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<?php if (!empty($description)) : ?>
|
92 |
+
<div class="wpgdprc-checklist-description"
|
93 |
+
<?php if (!$checked) : ?>style="display: none;"<?php endif; ?>>
|
94 |
+
<?php echo $description; ?>
|
95 |
+
</div>
|
96 |
+
<?php endif; ?>
|
97 |
+
</li>
|
98 |
+
<?php
|
99 |
+
endforeach;
|
100 |
+
?>
|
101 |
+
</ul>
|
102 |
</div>
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
<div id="tab-integrations" class="wpgdprc-tabs__panel" aria-hidden="true">
|
105 |
+
<?php if (!empty($activatedPlugins)) : ?>
|
106 |
+
<p><?php _e('WP GDPR automatically detects certain plugins that possibly need to comply with GDPR. We currently support: WordPress Comments, WooCommerce, Contact Form 7.', WP_GDPR_C_SLUG) ?></p>
|
107 |
+
|
108 |
+
<ul class="wpgdprc-list">
|
109 |
+
<?php
|
110 |
+
foreach ($activatedPlugins as $key => $plugin) :
|
111 |
+
$optionName = WP_GDPR_C_PREFIX . '_integrations_' . $plugin['id'];
|
112 |
+
$checked = Helpers::isEnabled($plugin['id']);
|
113 |
+
$description = (!empty($plugin['description'])) ? apply_filters('the_content', $plugin['description']) : '';
|
114 |
+
$options = Helpers::getSupportedPluginOptions($plugin['id']);
|
115 |
+
?>
|
116 |
+
<li>
|
117 |
+
<div class="wpgdprc-checkbox">
|
118 |
+
<input type="checkbox" name="<?php echo $optionName; ?>" id="<?php echo $optionName; ?>" value="1" tabindex="1" data-type="save_setting" data-option="<?php echo $optionName; ?>" <?php checked(true, $checked); ?> />
|
119 |
+
<label for="<?php echo $optionName; ?>"><?php echo $plugin['name']; ?></label>
|
120 |
+
<span class="wpgdprc-instructions"><?php _e('Enable compliance:', WP_GDPR_C_SLUG); ?></span>
|
121 |
+
<div class="wpgdprc-switch" aria-hidden="true">
|
122 |
+
<div class="wpgdprc-switch-label">
|
123 |
+
<div class="wpgdprc-switch-inner"></div>
|
124 |
+
<div class="wpgdprc-switch-switch"></div>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
|
129 |
+
<?php if (!empty($description)) : ?>
|
130 |
+
<div class="wpgdprc-checklist-description"
|
131 |
+
<?php if (!$checked) : ?>style="display: none;"<?php endif; ?>>
|
132 |
+
<?php echo $description; ?>
|
133 |
+
<?php echo $options; ?>
|
134 |
+
</div>
|
135 |
+
<?php endif; ?>
|
136 |
+
</li>
|
137 |
+
<?php
|
138 |
+
endforeach;
|
139 |
+
?>
|
140 |
+
</ul>
|
141 |
+
<?php else : ?>
|
142 |
+
<p><strong><?php _e('Couldn\'t find any supported plugins installed.', WP_GDPR_C_SLUG); ?></strong></p>
|
143 |
+
<p><?php _e('The following plugins are supported as of now:', WP_GDPR_C_SLUG); ?></p>
|
144 |
+
<ul class="ul-square">
|
145 |
+
<?php foreach (Helpers::getSupportedPlugins() as $plugin) : ?>
|
146 |
+
<li><?php echo $plugin['name']; ?></li>
|
147 |
+
<?php endforeach; ?>
|
148 |
+
</ul>
|
149 |
+
<p><?php _e('More plugins will be added in the future.', WP_GDPR_C_SLUG); ?></p>
|
150 |
+
<?php endif; ?>
|
151 |
+
</div>
|
152 |
+
<div id="tab-advanced" class="wpgdprc-tabs__panel" aria-hidden="true">
|
153 |
+
<p><?php _e('If the user does not accept the checkbox, this message will appear.', WP_GDPR_C_SLUG); ?></p>
|
154 |
+
<ul class="wpgdprc-list">
|
155 |
+
<li>
|
156 |
+
<p class="wpgdprc-setting">
|
157 |
+
<label for="wpgdprc_advanced_error"><?php _e('Error message', WP_GDPR_C_SLUG); ?></label>
|
158 |
+
<input name="wpgdprc_advanced_error" class="regular-text" id="wpgdprc_advanced_error" placeholder="<?php echo $errorMessage; ?>" value="<?php echo $errorMessage; ?>" type="text" />
|
159 |
+
</p>
|
160 |
+
</li>
|
161 |
+
</ul>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
</div>
|
165 |
+
|
166 |
+
<?php submit_button(); ?>
|
167 |
+
</form>
|
168 |
+
|
169 |
+
<p class="wpgdprc-disclaimer"><?php _e('Disclaimer: The creators of this plugin do not have a legal background. We assist website and webshop owners in being compliant with the General Data Protection Regulation (GDPR) but recommend contacting a law firm for rock solid legal advice.', WP_GDPR_C_SLUG); ?></p>
|
170 |
|
171 |
<div class="wpgdprc-background"><?php include(WP_GDPR_C_DIR_SVG . '/inline-waves.svg.php'); ?></div>
|
172 |
</div>
|
assets/css/admin.css
CHANGED
@@ -1,3 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.tools_page_wp_gdpr_compliance {
|
2 |
background: #FFFFFF;
|
3 |
}
|
@@ -17,8 +30,8 @@
|
|
17 |
-webkit-box-sizing: border-box;
|
18 |
-moz-box-sizing: border-box;
|
19 |
box-sizing: border-box;
|
20 |
-
max-width:
|
21 |
-
font-family: "
|
22 |
font-weight: normal;
|
23 |
font-size: 16px;
|
24 |
line-height: 1.6;
|
@@ -39,6 +52,23 @@
|
|
39 |
color: #4AA94F;
|
40 |
}
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
h1.wpgdprc-title {
|
43 |
font-weight: 700;
|
44 |
font-size: 36px;
|
@@ -49,6 +79,11 @@ h1.wpgdprc-title .fa {
|
|
49 |
color: #4AA94F;
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
p.wpgdprc-disclaimer {
|
53 |
font-size: small;
|
54 |
color: #8A8A8A;
|
@@ -66,15 +101,71 @@ p.wpgdprc-disclaimer {
|
|
66 |
fill: #4AA94F;
|
67 |
}
|
68 |
|
69 |
-
.wpgdprc-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
list-style: none;
|
72 |
}
|
73 |
|
74 |
-
.wpgdprc-
|
75 |
margin-bottom: 0;
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
.wpgdprc-checkbox {
|
@@ -85,20 +176,46 @@ p.wpgdprc-disclaimer {
|
|
85 |
display: none;
|
86 |
}
|
87 |
|
88 |
-
.wpgdprc-checkbox input[type="checkbox"]:checked ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-inner {
|
89 |
margin-left: 0;
|
90 |
}
|
91 |
|
92 |
-
.wpgdprc-checkbox input[type="checkbox"]:checked ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-switch {
|
93 |
right: 1px;
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
.wpgdprc-checkbox label {
|
97 |
display: block;
|
98 |
position: relative;
|
99 |
padding-right: 85px;
|
100 |
user-select: none;
|
101 |
z-index: 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
}
|
103 |
|
104 |
.wpgdprc-switch {
|
@@ -123,7 +240,7 @@ p.wpgdprc-disclaimer {
|
|
123 |
.wpgdprc-switch .wpgdprc-switch-inner {
|
124 |
margin-left: -100%;
|
125 |
width: 200%;
|
126 |
-
transition:
|
127 |
}
|
128 |
|
129 |
.wpgdprc-switch .wpgdprc-switch-inner:before, .wpgdprc-switch .wpgdprc-switch-inner:after {
|
@@ -136,16 +253,20 @@ p.wpgdprc-disclaimer {
|
|
136 |
.wpgdprc-switch .wpgdprc-switch-inner:before {
|
137 |
content: 'YES';
|
138 |
padding-left: 10px;
|
139 |
-
background-color: #
|
140 |
}
|
141 |
|
142 |
.wpgdprc-switch .wpgdprc-switch-inner:after {
|
143 |
content: 'NO';
|
144 |
padding-right: 10px;
|
145 |
-
background-color: #
|
146 |
text-align: right;
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
149 |
.wpgdprc-switch .wpgdprc-switch-switch {
|
150 |
position: absolute;
|
151 |
top: 1px;
|
@@ -161,7 +282,7 @@ p.wpgdprc-disclaimer {
|
|
161 |
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
162 |
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
163 |
box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
164 |
-
transition:
|
165 |
}
|
166 |
|
167 |
.wpgdprc-checklist-description {
|
@@ -169,49 +290,53 @@ p.wpgdprc-disclaimer {
|
|
169 |
color: #8A8A8A;
|
170 |
}
|
171 |
|
172 |
-
.wpgdprc-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
padding: 20px;
|
176 |
-
background: #
|
177 |
-
|
178 |
-
-moz-border-radius: 50%;
|
179 |
-
border-radius: 50%;
|
180 |
-
width: 200px;
|
181 |
-
height: 200px;
|
182 |
-
text-align: center;
|
183 |
-
color: #FFFFFF;
|
184 |
}
|
185 |
|
186 |
-
.wpgdprc-
|
187 |
-
|
188 |
-
vertical-align: middle;
|
189 |
}
|
190 |
|
191 |
-
.wpgdprc-
|
192 |
-
|
193 |
}
|
194 |
|
195 |
-
.wpgdprc-
|
196 |
-
|
197 |
-
|
198 |
}
|
199 |
|
200 |
-
.wpgdprc-
|
201 |
-
|
202 |
}
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
}
|
209 |
|
210 |
-
@media screen and (min-width:
|
211 |
-
.wpgdprc
|
212 |
-
|
213 |
-
top: 30px;
|
214 |
-
right: 30px;
|
215 |
-
margin: 0;
|
216 |
}
|
217 |
}
|
1 |
+
.cf:before, .cf:after {
|
2 |
+
content: " ";
|
3 |
+
display: table;
|
4 |
+
}
|
5 |
+
|
6 |
+
.cf:after {
|
7 |
+
clear: both;
|
8 |
+
}
|
9 |
+
|
10 |
+
.cf {
|
11 |
+
*zoom: 1;
|
12 |
+
}
|
13 |
+
|
14 |
.tools_page_wp_gdpr_compliance {
|
15 |
background: #FFFFFF;
|
16 |
}
|
30 |
-webkit-box-sizing: border-box;
|
31 |
-moz-box-sizing: border-box;
|
32 |
box-sizing: border-box;
|
33 |
+
max-width: 900px;
|
34 |
+
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
|
35 |
font-weight: normal;
|
36 |
font-size: 16px;
|
37 |
line-height: 1.6;
|
52 |
color: #4AA94F;
|
53 |
}
|
54 |
|
55 |
+
.wpgdprc .submit .button.button-primary {
|
56 |
+
height: 38px;
|
57 |
+
background: #4AA94F;
|
58 |
+
border-top-color: #459D49;
|
59 |
+
border-right-color: #419546;
|
60 |
+
border-bottom-color: #419546;
|
61 |
+
border-left-color: #419546;
|
62 |
+
-webkit-box-shadow: none;
|
63 |
+
-moz-box-shadow: none;
|
64 |
+
box-shadow: none;
|
65 |
+
text-shadow: none;
|
66 |
+
vertical-align: top;
|
67 |
+
font-size: inherit;
|
68 |
+
font-weight: bold;
|
69 |
+
line-height: 36px;
|
70 |
+
}
|
71 |
+
|
72 |
h1.wpgdprc-title {
|
73 |
font-weight: 700;
|
74 |
font-size: 36px;
|
79 |
color: #4AA94F;
|
80 |
}
|
81 |
|
82 |
+
p.wpgdprc-description {
|
83 |
+
padding: 10px;
|
84 |
+
background: #F1F1F1;
|
85 |
+
}
|
86 |
+
|
87 |
p.wpgdprc-disclaimer {
|
88 |
font-size: small;
|
89 |
color: #8A8A8A;
|
101 |
fill: #4AA94F;
|
102 |
}
|
103 |
|
104 |
+
.wpgdprc-tabs {
|
105 |
+
position: relative;
|
106 |
+
}
|
107 |
+
|
108 |
+
.wpgdprc-tabs__navigation {
|
109 |
+
border-bottom: 1px solid #dbd6d6;
|
110 |
+
}
|
111 |
+
|
112 |
+
.wpgdprc-tabs__navigation > a {
|
113 |
+
display: block;
|
114 |
+
float: left;
|
115 |
+
margin-bottom: -2px;
|
116 |
+
padding: 12px 16px;
|
117 |
+
background-color: #E9E9E9;
|
118 |
+
border: 1px solid transparent;
|
119 |
+
border-left-color: #F1F1F1;
|
120 |
+
-webkit-box-shadow: none;
|
121 |
+
-moz-box-shadow: none;
|
122 |
+
box-shadow: none;
|
123 |
+
text-decoration: none;
|
124 |
+
font-weight: 500;
|
125 |
+
line-height: 1;
|
126 |
+
color: inherit;
|
127 |
+
}
|
128 |
+
|
129 |
+
.wpgdprc-tabs__navigation > a.active {
|
130 |
+
background-color: #fff;
|
131 |
+
color: #4AA94F;
|
132 |
+
border-top-color: #dbd6d6;
|
133 |
+
border-right-color: #dbd6d6;
|
134 |
+
border-left-color: #dbd6d6;
|
135 |
+
}
|
136 |
+
|
137 |
+
.wpgdprc-tabs__panel {
|
138 |
+
display: none;
|
139 |
+
}
|
140 |
+
|
141 |
+
.wpgdprc-tabs__panel.active {
|
142 |
+
display: block;
|
143 |
+
background-color: #fff;
|
144 |
+
border: 1px solid #dbd6d6;
|
145 |
+
border-top: none;
|
146 |
+
padding: 20px;
|
147 |
+
}
|
148 |
+
|
149 |
+
.wpgdprc-tabs__panel > p:first-child {
|
150 |
+
margin-top: 0;
|
151 |
+
}
|
152 |
+
|
153 |
+
.wpgdprc-list {
|
154 |
+
margin: -20px 0;
|
155 |
list-style: none;
|
156 |
}
|
157 |
|
158 |
+
.wpgdprc-list li {
|
159 |
margin-bottom: 0;
|
160 |
+
}
|
161 |
+
|
162 |
+
.wpgdprc-list > li {
|
163 |
+
padding: 20px 0;
|
164 |
+
border-top: 2px solid #EDEDED;
|
165 |
+
}
|
166 |
+
|
167 |
+
.wpgdprc-list > li:first-child {
|
168 |
+
border-top: none;
|
169 |
}
|
170 |
|
171 |
.wpgdprc-checkbox {
|
176 |
display: none;
|
177 |
}
|
178 |
|
179 |
+
.wpgdprc-checkbox input[type="checkbox"]:checked:not(.processing) ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-inner {
|
180 |
margin-left: 0;
|
181 |
}
|
182 |
|
183 |
+
.wpgdprc-checkbox input[type="checkbox"]:checked:not(.processing) ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-switch {
|
184 |
right: 1px;
|
185 |
}
|
186 |
|
187 |
+
.wpgdprc-checkbox input[type="checkbox"].processing ~ label {
|
188 |
+
pointer-events: none;
|
189 |
+
}
|
190 |
+
|
191 |
+
.wpgdprc-checkbox input[type="checkbox"].processing ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-inner {
|
192 |
+
margin-left: -50%;
|
193 |
+
}
|
194 |
+
|
195 |
+
.wpgdprc-checkbox input[type="checkbox"].processing ~ .wpgdprc-switch .wpgdprc-switch-label .wpgdprc-switch-switch {
|
196 |
+
right: 50%;
|
197 |
+
-webkit-transform: translateX(50%);
|
198 |
+
-moz-transform: translateX(50%);
|
199 |
+
-ms-transform: translateX(50%);
|
200 |
+
-o-transform: translateX(50%);
|
201 |
+
transform: translateX(50%);
|
202 |
+
}
|
203 |
+
|
204 |
.wpgdprc-checkbox label {
|
205 |
display: block;
|
206 |
position: relative;
|
207 |
padding-right: 85px;
|
208 |
user-select: none;
|
209 |
z-index: 1;
|
210 |
+
font-weight: bold;
|
211 |
+
}
|
212 |
+
|
213 |
+
span.wpgdprc-instructions {
|
214 |
+
position: absolute;
|
215 |
+
top: 50%;
|
216 |
+
right: 80px;
|
217 |
+
transform: translateY(-50%);
|
218 |
+
font-size: 12px;
|
219 |
}
|
220 |
|
221 |
.wpgdprc-switch {
|
240 |
.wpgdprc-switch .wpgdprc-switch-inner {
|
241 |
margin-left: -100%;
|
242 |
width: 200%;
|
243 |
+
transition: all 0.15s ease-in-out;
|
244 |
}
|
245 |
|
246 |
.wpgdprc-switch .wpgdprc-switch-inner:before, .wpgdprc-switch .wpgdprc-switch-inner:after {
|
253 |
.wpgdprc-switch .wpgdprc-switch-inner:before {
|
254 |
content: 'YES';
|
255 |
padding-left: 10px;
|
256 |
+
background-color: #4AA94F;
|
257 |
}
|
258 |
|
259 |
.wpgdprc-switch .wpgdprc-switch-inner:after {
|
260 |
content: 'NO';
|
261 |
padding-right: 10px;
|
262 |
+
background-color: #0A0A0A;
|
263 |
text-align: right;
|
264 |
}
|
265 |
|
266 |
+
.wpgdprc-switch--reverse .wpgdprc-switch-inner:before {
|
267 |
+
background-color: #FFAE00;
|
268 |
+
}
|
269 |
+
|
270 |
.wpgdprc-switch .wpgdprc-switch-switch {
|
271 |
position: absolute;
|
272 |
top: 1px;
|
282 |
-webkit-box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
283 |
-moz-box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
284 |
box-shadow: 0 0 3px rgba(0, 0, 0, .3);
|
285 |
+
transition: all 0.15s ease-in-out;
|
286 |
}
|
287 |
|
288 |
.wpgdprc-checklist-description {
|
290 |
color: #8A8A8A;
|
291 |
}
|
292 |
|
293 |
+
.wpgdprc-checklist-description p:first-child {
|
294 |
+
margin-top: 0;
|
295 |
+
}
|
296 |
+
|
297 |
+
.wpgdprc-checklist-description p:last-child {
|
298 |
+
margin-bottom: 0;
|
299 |
+
}
|
300 |
+
|
301 |
+
.wpgdprc-checklist-options li {
|
302 |
+
margin-top: 20px;
|
303 |
padding: 20px;
|
304 |
+
background: #fff;
|
305 |
+
border: 2px solid #f0f0f0;
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
}
|
307 |
|
308 |
+
.wpgdprc-checklist-options li:first-child {
|
309 |
+
margin-top: 0;
|
|
|
310 |
}
|
311 |
|
312 |
+
.wpgdprc-setting {
|
313 |
+
*zoom: 1;
|
314 |
}
|
315 |
|
316 |
+
.wpgdprc-setting:before, .wpgdprc-setting:after {
|
317 |
+
display: table;
|
318 |
+
content: " ";
|
319 |
}
|
320 |
|
321 |
+
.wpgdprc-setting:after {
|
322 |
+
clear: both;
|
323 |
}
|
324 |
|
325 |
+
.wpgdprc-setting input {
|
326 |
+
float: right;
|
327 |
+
max-width: 100%;
|
328 |
+
background-color: #F8F8F8;
|
329 |
+
font-size: 1rem;
|
330 |
+
}
|
331 |
+
|
332 |
+
@media screen and (max-width: 639px) {
|
333 |
+
.wpgdprc-instructions {
|
334 |
+
display: none;
|
335 |
}
|
336 |
}
|
337 |
|
338 |
+
@media screen and (min-width: 768px) {
|
339 |
+
.wpgdprc {
|
340 |
+
font-size: 18px;
|
|
|
|
|
|
|
341 |
}
|
342 |
}
|
assets/js/admin.js
CHANGED
@@ -1,23 +1,110 @@
|
|
1 |
-
(function($, window, document, undefined) {
|
2 |
'use strict';
|
3 |
|
4 |
-
var
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
if (!$wpgdprc.length) {
|
9 |
return;
|
10 |
}
|
11 |
-
|
12 |
-
|
13 |
-
e.preventDefault();
|
14 |
-
var $wpgdprcCheckboxContainer = $(this).closest('.wpgdprc-checkbox'),
|
15 |
-
$wpgdprcChecklistDescription = $wpgdprcCheckboxContainer.next('.wpgdprc-checklist-description');
|
16 |
-
if ($(this).is(':checked')) {
|
17 |
-
$wpgdprcChecklistDescription.stop(true, true).slideDown('fast');
|
18 |
-
} else {
|
19 |
-
$wpgdprcChecklistDescription.stop(true, true).slideUp('fast');
|
20 |
-
}
|
21 |
-
});
|
22 |
});
|
23 |
})(jQuery, window, document);
|
1 |
+
(function ($, window, document, undefined) {
|
2 |
'use strict';
|
3 |
|
4 |
+
var ajaxLoading = false,
|
5 |
+
ajaxURL = wpgdprcData.ajaxURL,
|
6 |
+
ajaxSecurity = wpgdprcData.ajaxSecurity,
|
7 |
+
delay = (function () {
|
8 |
+
var timer = 0;
|
9 |
+
return function (callback, ms) {
|
10 |
+
clearTimeout(timer);
|
11 |
+
timer = setTimeout(callback, ms);
|
12 |
+
};
|
13 |
+
})(),
|
14 |
+
$wpgdprc = $('.wpgdprc'),
|
15 |
+
$wpgdprcCheckbox = $('.wpgdprc-checkbox input[type="checkbox"]', $wpgdprc),
|
16 |
+
$wpgdprcTabs = $('.wpgdprc-tabs'),
|
17 |
+
initCheckboxes = function () {
|
18 |
+
if (!$wpgdprcCheckbox.length) {
|
19 |
+
return;
|
20 |
+
}
|
21 |
+
$wpgdprcCheckbox.on('change', function (e) {
|
22 |
+
e.preventDefault();
|
23 |
+
doProcessAction($(this));
|
24 |
+
});
|
25 |
+
},
|
26 |
+
initTabs = function () {
|
27 |
+
if (!$wpgdprcTabs.length) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
var $wpgdprcTabsNavigation = $('.wpgdprc-tabs__navigation', $wpgdprcTabs),
|
31 |
+
$wpgdprcTabsNavigationItem = $('a', $wpgdprcTabsNavigation),
|
32 |
+
$wpgdprcTabsPanel = $('.wpgdprc-tabs__panel', $wpgdprcTabs);
|
33 |
+
|
34 |
+
$wpgdprcTabsNavigationItem.on('click', function (e) {
|
35 |
+
e.preventDefault();
|
36 |
+
var target = $(this).attr('href'),
|
37 |
+
$target = $(target);
|
38 |
+
if (!$target.length) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
$wpgdprcTabsNavigationItem.removeClass('active').attr('aria-selected', false).attr('tabindex', '-1');
|
42 |
+
$wpgdprcTabsPanel.removeClass('active').attr('aria-hidden', true);
|
43 |
+
$(this).addClass('active').attr('aria-selected', true).attr('tabindex', 0);
|
44 |
+
$target.addClass('active').attr('aria-hidden', false);
|
45 |
+
});
|
46 |
+
},
|
47 |
+
getElementAjaxData = function ($element) {
|
48 |
+
var data = $element.data();
|
49 |
+
if (!data.option) {
|
50 |
+
data.option = $element.attr('name');
|
51 |
+
}
|
52 |
+
if ($element.is('input')) {
|
53 |
+
data.value = $element.val();
|
54 |
+
if ($element.is('input[type="checkbox"]')) {
|
55 |
+
data.enabled = ($element.is(':checked'));
|
56 |
+
}
|
57 |
+
}
|
58 |
+
return data;
|
59 |
+
},
|
60 |
+
doProcessAction = function ($element) {
|
61 |
+
$element.addClass('processing');
|
62 |
+
|
63 |
+
var $wpgdprcCheckboxContainer = $element.closest('.wpgdprc-checkbox'),
|
64 |
+
$wpgdprcChecklistDescription = ($wpgdprcCheckboxContainer.length) ? $wpgdprcCheckboxContainer.next('.wpgdprc-checklist-description') : false;
|
65 |
|
66 |
+
$.ajax({
|
67 |
+
url: ajaxURL,
|
68 |
+
type: 'POST',
|
69 |
+
dataType: 'JSON',
|
70 |
+
data: {
|
71 |
+
action: 'wpgdprc_process_action',
|
72 |
+
security: ajaxSecurity,
|
73 |
+
data: getElementAjaxData($element)
|
74 |
+
},
|
75 |
+
success: function (response) {
|
76 |
+
if (response) {
|
77 |
+
if ($wpgdprcChecklistDescription.length) {
|
78 |
+
if ($element.is(':checked')) {
|
79 |
+
$wpgdprcChecklistDescription.stop(true, true).slideDown('fast');
|
80 |
+
} else {
|
81 |
+
$wpgdprcChecklistDescription.stop(true, true).slideUp('fast');
|
82 |
+
}
|
83 |
+
}
|
84 |
+
|
85 |
+
if (response.error) {
|
86 |
+
$element.addClass('alert');
|
87 |
+
}
|
88 |
+
|
89 |
+
if (response.redirect) {
|
90 |
+
document.location.href = currentPage;
|
91 |
+
}
|
92 |
+
}
|
93 |
+
},
|
94 |
+
complete: function () {
|
95 |
+
$element.removeClass('processing');
|
96 |
+
delay(function () {
|
97 |
+
$element.removeClass('alert');
|
98 |
+
}, 2000);
|
99 |
+
}
|
100 |
+
});
|
101 |
+
};
|
102 |
+
|
103 |
+
$(function () {
|
104 |
if (!$wpgdprc.length) {
|
105 |
return;
|
106 |
}
|
107 |
+
initCheckboxes();
|
108 |
+
initTabs();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
});
|
110 |
})(jQuery, window, document);
|
languages/wp-gdpr-compliance-nl_NL.mo
CHANGED
Binary file
|
languages/wp-gdpr-compliance-nl_NL.po
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP GDPR Compliance\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Van Ons <info@van-ons.nl>\n"
|
8 |
"Language: nl_NL\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Generator: Poedit 2.0.
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
|
@@ -17,11 +17,34 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPathExcluded-0: assets\n"
|
19 |
|
20 |
-
#: Includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
msgid "Do you have a contact form?"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: Includes/Helpers.php:
|
25 |
msgid ""
|
26 |
"Make sure you add a checkbox specifically asking the user of the form if "
|
27 |
"they consent to you storing and using their personal information to get back "
|
@@ -29,11 +52,11 @@ msgid ""
|
|
29 |
"if you will send or share the data with any 3rd-parties and which."
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: Includes/Helpers.php:
|
33 |
msgid "Can visitors comment anywhere on your website?"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: Includes/Helpers.php:
|
37 |
msgid ""
|
38 |
"Make sure you add a checkbox specifically asking the user of the comment "
|
39 |
"section if they consent to storing their message attached to the e-mail "
|
@@ -42,11 +65,11 @@ msgid ""
|
|
42 |
"which."
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: Includes/Helpers.php:
|
46 |
msgid "Is there an order form on your website or webshop present?"
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: Includes/Helpers.php:
|
50 |
msgid ""
|
51 |
"Make sure you add a checkbox specifically asking the user of the form if "
|
52 |
"they consent to you storing and using their personal information to ship the "
|
@@ -56,11 +79,11 @@ msgid ""
|
|
56 |
"which."
|
57 |
msgstr ""
|
58 |
|
59 |
-
#: Includes/Helpers.php:
|
60 |
msgid "Do you provide a forum or message board environment?"
|
61 |
msgstr ""
|
62 |
|
63 |
-
#: Includes/Helpers.php:
|
64 |
msgid ""
|
65 |
"Make sure you add a checkbox specifically asking forum / board users if they "
|
66 |
"consent to you storing and using their personal information and messages. "
|
@@ -68,11 +91,11 @@ msgid ""
|
|
68 |
"share the data with any 3rd-parties and which."
|
69 |
msgstr ""
|
70 |
|
71 |
-
#: Includes/Helpers.php:
|
72 |
msgid "Can visitors chat with your company directly?"
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: Includes/Helpers.php:
|
76 |
msgid ""
|
77 |
"Make sure you add a checkbox specifically asking chat users if they consent "
|
78 |
"to you storing and using their personal information and messages. The "
|
@@ -81,22 +104,103 @@ msgid ""
|
|
81 |
"mention if you will send or share the data with any 3rd-parties and which."
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: Includes/
|
85 |
-
msgid "
|
|
|
|
|
|
|
|
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: Includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
msgid ""
|
90 |
-
"
|
91 |
-
"
|
92 |
-
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: Includes/Pages.php:
|
97 |
-
msgid "
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: Includes/Pages.php:
|
101 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
msgstr ""
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WP GDPR Compliance\n"
|
4 |
+
"POT-Creation-Date: 2018-01-16 12:26+0100\n"
|
5 |
+
"PO-Revision-Date: 2018-01-16 12:26+0100\n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: Van Ons <info@van-ons.nl>\n"
|
8 |
"Language: nl_NL\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 2.0.5\n"
|
13 |
"X-Poedit-Basepath: ..\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"
|
17 |
"X-Poedit-SearchPath-0: .\n"
|
18 |
"X-Poedit-SearchPathExcluded-0: assets\n"
|
19 |
|
20 |
+
#: Includes/Ajax.php:31
|
21 |
+
msgid "Missing data."
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: Includes/Ajax.php:35
|
25 |
+
msgid "Missing type."
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: Includes/Ajax.php:47
|
29 |
+
msgid "Missing option name."
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: Includes/Ajax.php:51
|
33 |
+
msgid "Missing value."
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: Includes/Extensions/CF7.php:185 Includes/Extensions/WC.php:50
|
37 |
+
#: Includes/Extensions/WP.php:48 Includes/Helpers.php:96
|
38 |
+
msgid ""
|
39 |
+
"By using this form you agree with the storage and handling of your data by "
|
40 |
+
"this website."
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: Includes/Helpers.php:26
|
44 |
msgid "Do you have a contact form?"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: Includes/Helpers.php:27
|
48 |
msgid ""
|
49 |
"Make sure you add a checkbox specifically asking the user of the form if "
|
50 |
"they consent to you storing and using their personal information to get back "
|
52 |
"if you will send or share the data with any 3rd-parties and which."
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: Includes/Helpers.php:30
|
56 |
msgid "Can visitors comment anywhere on your website?"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#: Includes/Helpers.php:31
|
60 |
msgid ""
|
61 |
"Make sure you add a checkbox specifically asking the user of the comment "
|
62 |
"section if they consent to storing their message attached to the e-mail "
|
65 |
"which."
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: Includes/Helpers.php:34
|
69 |
msgid "Is there an order form on your website or webshop present?"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: Includes/Helpers.php:35
|
73 |
msgid ""
|
74 |
"Make sure you add a checkbox specifically asking the user of the form if "
|
75 |
"they consent to you storing and using their personal information to ship the "
|
79 |
"which."
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: Includes/Helpers.php:38
|
83 |
msgid "Do you provide a forum or message board environment?"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: Includes/Helpers.php:39
|
87 |
msgid ""
|
88 |
"Make sure you add a checkbox specifically asking forum / board users if they "
|
89 |
"consent to you storing and using their personal information and messages. "
|
91 |
"share the data with any 3rd-parties and which."
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: Includes/Helpers.php:42
|
95 |
msgid "Can visitors chat with your company directly?"
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: Includes/Helpers.php:43
|
99 |
msgid ""
|
100 |
"Make sure you add a checkbox specifically asking chat users if they consent "
|
101 |
"to you storing and using their personal information and messages. The "
|
104 |
"mention if you will send or share the data with any 3rd-parties and which."
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: Includes/Helpers.php:77
|
108 |
+
msgid "Activate for this form:"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: Includes/Helpers.php:86 Includes/Helpers.php:100
|
112 |
+
msgid "Checkbox text"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: Includes/Helpers.php:117
|
116 |
+
msgid "WordPress Comments"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: Includes/Helpers.php:133
|
120 |
+
msgid "Contact Form 7"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: Includes/Helpers.php:134
|
124 |
msgid ""
|
125 |
+
"A GDPR shortcode will be automatically added to every form you activate it "
|
126 |
+
"for."
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: Includes/Helpers.php:144
|
130 |
+
msgid "WooCommerce"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: Includes/Helpers.php:145
|
134 |
+
msgid ""
|
135 |
+
"The GDPR checkbox will be added automatically at the end of your checkout "
|
136 |
+
"page."
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: Includes/Pages.php:53
|
140 |
+
msgid ""
|
141 |
+
"This plugin assists website and webshop owners to comply with European "
|
142 |
+
"privacy regulations (known as GDPR).\n"
|
143 |
+
" By May 24th, 2018 your website or shop has to comply to "
|
144 |
+
"avoid large fines. The regulation can be read here:"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: Includes/Pages.php:55
|
148 |
+
msgid "GDPR Key Changes"
|
149 |
msgstr ""
|
150 |
|
151 |
+
#: Includes/Pages.php:63
|
152 |
+
msgid "General"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: Includes/Pages.php:64
|
156 |
+
msgid "Integrations"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: Includes/Pages.php:65
|
160 |
+
msgid "Advanced"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: Includes/Pages.php:70
|
164 |
+
msgid ""
|
165 |
+
"Below we ask you what private data you currently collect and provide you "
|
166 |
+
"with tips to comply."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: Includes/Pages.php:106
|
170 |
+
msgid ""
|
171 |
+
"WP GDPR automatically detects certain plugins that possibly need to comply "
|
172 |
+
"with GDPR. We currently support: WordPress Comments, WooCommerce, Contact "
|
173 |
+
"Form 7."
|
174 |
+
msgstr ""
|
175 |
+
|
176 |
+
#: Includes/Pages.php:120
|
177 |
+
msgid "Enable compliance:"
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: Includes/Pages.php:142
|
181 |
+
msgid "Couldn't find any supported plugins installed."
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: Includes/Pages.php:143
|
185 |
+
msgid "The following plugins are supported as of now:"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: Includes/Pages.php:149
|
189 |
+
msgid "More plugins will be added in the future."
|
190 |
+
msgstr ""
|
191 |
+
|
192 |
+
#: Includes/Pages.php:153
|
193 |
+
msgid "If the user does not accept the checkbox, this message will appear."
|
194 |
+
msgstr ""
|
195 |
+
|
196 |
+
#: Includes/Pages.php:157
|
197 |
+
msgid "Error message"
|
198 |
+
msgstr ""
|
199 |
+
|
200 |
+
#: Includes/Pages.php:169
|
201 |
+
msgid ""
|
202 |
+
"Disclaimer: The creators of this plugin do not have a legal background. We "
|
203 |
+
"assist website and webshop owners in being compliant with the General Data "
|
204 |
+
"Protection Regulation (GDPR) but recommend contacting a law firm for rock "
|
205 |
+
"solid legal advice."
|
206 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== WP GDPR Compliance ===
|
2 |
-
Contributors: donnyoexman, van-ons
|
3 |
Tags: gdpr, law, regulations, compliance, data, protection, privacy, data protection, eu, avg
|
4 |
Requires at least: 4.5
|
5 |
-
Tested up to: 4.
|
6 |
Requires PHP: 5.2.4
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -26,6 +26,13 @@ This plugin assists website and webshop owners to comply with European privacy r
|
|
26 |
|
27 |
== Changelog ==
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
= 1.0 =
|
30 |
*Release date: November 4th, 2017*
|
31 |
* Initial release.
|
1 |
=== WP GDPR Compliance ===
|
2 |
+
Contributors: donnyoexman, michaelvt, jeffreyvisser, van-ons
|
3 |
Tags: gdpr, law, regulations, compliance, data, protection, privacy, data protection, eu, avg
|
4 |
Requires at least: 4.5
|
5 |
+
Tested up to: 4.9.1
|
6 |
Requires PHP: 5.2.4
|
7 |
+
Stable tag: 1.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
26 |
|
27 |
== Changelog ==
|
28 |
|
29 |
+
= 1.1 =
|
30 |
+
*Release date: January 16th, 2018*
|
31 |
+
* Added 'Contact Form 7' integration.
|
32 |
+
* Added 'WooCommerce' integration.
|
33 |
+
* Added 'WordPress Comments' integration.
|
34 |
+
* Small bugfixes.
|
35 |
+
|
36 |
= 1.0 =
|
37 |
*Release date: November 4th, 2017*
|
38 |
* Initial release.
|
wp-gdpr-compliance.php
CHANGED
@@ -4,8 +4,8 @@
|
|
4 |
Plugin Name: WP GDPR Compliance
|
5 |
Plugin URI: https://www.wpgdprc.com/
|
6 |
Description: This plugin assists website and webshop owners to comply with European privacy regulations (known as GDPR). By May 24th, 2018 your website or shop has to comply to avoid large fines.
|
7 |
-
Version: 1.
|
8 |
-
Author: Donny Oexman, Van Ons
|
9 |
Author URI: https://www.van-ons.nl/
|
10 |
License: GPL2
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -30,24 +30,29 @@ along with this program. If not, see http://www.gnu.org/licenses.
|
|
30 |
|
31 |
namespace WPGDPRC;
|
32 |
|
33 |
-
|
|
|
34 |
use WPGDPRC\Includes\Pages;
|
35 |
|
|
|
36 |
if (!defined('WPINC')) {
|
37 |
die();
|
38 |
}
|
39 |
|
40 |
define('WP_GDPR_C_SLUG', 'wp-gdpr-compliance');
|
41 |
-
define('
|
|
|
|
|
42 |
define('WP_GDPR_C_DIR_JS', WP_GDPR_C_DIR . 'assets/js');
|
43 |
define('WP_GDPR_C_DIR_CSS', WP_GDPR_C_DIR . 'assets/css');
|
44 |
define('WP_GDPR_C_DIR_SVG', WP_GDPR_C_DIR . 'assets/svg');
|
45 |
-
define('WP_GDPR_C_URI', plugin_dir_url(
|
46 |
define('WP_GDPR_C_URI_JS', WP_GDPR_C_URI . 'assets/js');
|
47 |
define('WP_GDPR_C_URI_CSS', WP_GDPR_C_URI . 'assets/css');
|
48 |
define('WP_GDPR_C_URI_SVG', WP_GDPR_C_URI . 'assets/svg');
|
49 |
|
50 |
// Let's do this!
|
|
|
51 |
add_action('plugins_loaded', array(WPGDPRC::getInstance(), 'init'));
|
52 |
|
53 |
/**
|
@@ -70,35 +75,34 @@ class WPGDPRC {
|
|
70 |
|
71 |
public function init() {
|
72 |
load_plugin_textdomain(WP_GDPR_C_SLUG, false, basename(dirname(__FILE__)) . '/languages/');
|
|
|
73 |
add_action('admin_menu', array(Pages::getInstance(), 'addAdminMenu'));
|
74 |
add_action('admin_enqueue_scripts', array($this, 'loadAssets'), 999);
|
75 |
-
add_action('
|
|
|
|
|
76 |
}
|
77 |
|
78 |
public function loadAssets() {
|
79 |
wp_enqueue_style('wpgdprc.css', WP_GDPR_C_URI_CSS . '/admin.css', array(), filemtime(WP_GDPR_C_DIR_CSS . '/admin.css'));
|
80 |
wp_enqueue_style('wpgdprc.fontawesome', WP_GDPR_C_URI_CSS . '/font-awesome.min.css', array(), false);
|
81 |
wp_enqueue_script('wpgdprc.js', WP_GDPR_C_URI_JS . '/admin.js', array(), filemtime(WP_GDPR_C_DIR_JS . '/admin.js'), true);
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<script src="//use.typekit.net/ais6lnh.js"></script>
|
87 |
-
<script>try{Typekit.load({ async: true });}catch(e){}</script>
|
88 |
-
<?php
|
89 |
}
|
90 |
}
|
91 |
|
92 |
-
spl_autoload_register(__NAMESPACE__ . '\\autoload');
|
93 |
-
|
94 |
/**
|
95 |
-
* @param $class
|
96 |
*/
|
97 |
-
function autoload($class) {
|
98 |
if (!strstr($class, 'WPGDPRC')) {
|
99 |
return;
|
100 |
}
|
101 |
$result = str_replace('WPGDPRC\\', '', $class);
|
102 |
$result = str_replace('\\', '/', $result);
|
103 |
require $result . '.php';
|
104 |
-
}
|
|
4 |
Plugin Name: WP GDPR Compliance
|
5 |
Plugin URI: https://www.wpgdprc.com/
|
6 |
Description: This plugin assists website and webshop owners to comply with European privacy regulations (known as GDPR). By May 24th, 2018 your website or shop has to comply to avoid large fines.
|
7 |
+
Version: 1.1
|
8 |
+
Author: Donny Oexman, Michael van Tulder, Jeffrey Visser, Van Ons
|
9 |
Author URI: https://www.van-ons.nl/
|
10 |
License: GPL2
|
11 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
30 |
|
31 |
namespace WPGDPRC;
|
32 |
|
33 |
+
use WPGDPRC\Includes\Ajax;
|
34 |
+
use WPGDPRC\Includes\Integrations;
|
35 |
use WPGDPRC\Includes\Pages;
|
36 |
|
37 |
+
// If this file is called directly, abort.
|
38 |
if (!defined('WPINC')) {
|
39 |
die();
|
40 |
}
|
41 |
|
42 |
define('WP_GDPR_C_SLUG', 'wp-gdpr-compliance');
|
43 |
+
define('WP_GDPR_C_PREFIX', 'wpgdprc');
|
44 |
+
define('WP_GDPR_C_ROOT_FILE', __FILE__);
|
45 |
+
define('WP_GDPR_C_DIR', plugin_dir_path(WP_GDPR_C_ROOT_FILE));
|
46 |
define('WP_GDPR_C_DIR_JS', WP_GDPR_C_DIR . 'assets/js');
|
47 |
define('WP_GDPR_C_DIR_CSS', WP_GDPR_C_DIR . 'assets/css');
|
48 |
define('WP_GDPR_C_DIR_SVG', WP_GDPR_C_DIR . 'assets/svg');
|
49 |
+
define('WP_GDPR_C_URI', plugin_dir_url(WP_GDPR_C_ROOT_FILE));
|
50 |
define('WP_GDPR_C_URI_JS', WP_GDPR_C_URI . 'assets/js');
|
51 |
define('WP_GDPR_C_URI_CSS', WP_GDPR_C_URI . 'assets/css');
|
52 |
define('WP_GDPR_C_URI_SVG', WP_GDPR_C_URI . 'assets/svg');
|
53 |
|
54 |
// Let's do this!
|
55 |
+
spl_autoload_register(__NAMESPACE__ . '\\autoload');
|
56 |
add_action('plugins_loaded', array(WPGDPRC::getInstance(), 'init'));
|
57 |
|
58 |
/**
|
75 |
|
76 |
public function init() {
|
77 |
load_plugin_textdomain(WP_GDPR_C_SLUG, false, basename(dirname(__FILE__)) . '/languages/');
|
78 |
+
add_action('admin_init', array(Pages::getInstance(), 'registerSettings'));
|
79 |
add_action('admin_menu', array(Pages::getInstance(), 'addAdminMenu'));
|
80 |
add_action('admin_enqueue_scripts', array($this, 'loadAssets'), 999);
|
81 |
+
add_action('admin_init', array(Integrations::getInstance(), 'registerSettings'));
|
82 |
+
new Ajax();
|
83 |
+
new Integrations();
|
84 |
}
|
85 |
|
86 |
public function loadAssets() {
|
87 |
wp_enqueue_style('wpgdprc.css', WP_GDPR_C_URI_CSS . '/admin.css', array(), filemtime(WP_GDPR_C_DIR_CSS . '/admin.css'));
|
88 |
wp_enqueue_style('wpgdprc.fontawesome', WP_GDPR_C_URI_CSS . '/font-awesome.min.css', array(), false);
|
89 |
wp_enqueue_script('wpgdprc.js', WP_GDPR_C_URI_JS . '/admin.js', array(), filemtime(WP_GDPR_C_DIR_JS . '/admin.js'), true);
|
90 |
+
wp_localize_script('wpgdprc.js', 'wpgdprcData', array(
|
91 |
+
'ajaxURL' => admin_url('admin-ajax.php'),
|
92 |
+
'ajaxSecurity' => wp_create_nonce('wpgdprc'),
|
93 |
+
));
|
|
|
|
|
|
|
94 |
}
|
95 |
}
|
96 |
|
|
|
|
|
97 |
/**
|
98 |
+
* @param string $class
|
99 |
*/
|
100 |
+
function autoload($class = '') {
|
101 |
if (!strstr($class, 'WPGDPRC')) {
|
102 |
return;
|
103 |
}
|
104 |
$result = str_replace('WPGDPRC\\', '', $class);
|
105 |
$result = str_replace('\\', '/', $result);
|
106 |
require $result . '.php';
|
107 |
+
}
|
108 |
+
|