-
Notifications
You must be signed in to change notification settings - Fork 7
/
gdpr-framework.php
94 lines (82 loc) · 2.58 KB
/
gdpr-framework.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* Plugin Name: The GDPR Framework
* Plugin URI: https://codelight.eu/wordpress-gdpr-framework/
* Description: Tools to help make your website GDPR-compliant. Fully documented, extendable and developer-friendly.
* Version: 1.0.10
* Author: Codelight
* Author URI: https://codelight.eu/
* Text Domain: gdpr-framework
* Domain Path: /languages
*/
if (!defined('WPINC')) {
die;
}
define('GDPR_FRAMEWORK_VERSION', '1.0.10');
/**
* Helper function for prettying up errors
*
* @param string $message
* @param string $subtitle
* @param string $title
*/
$gdpr_error = function($message, $subtitle = '', $title = '') {
$title = $title ?: _x('WordPress GDPR › Error', '(Admin)', 'gdpr-framework');
$message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p>";
wp_die($message, $title);
};
/**
* Ensure compatible version of PHP is used
*/
if (version_compare(phpversion(), '5.6.0', '<')) {
$gdpr_error(
_x('You must be using PHP 5.6.0 or greater.', '(Admin)', 'gdpr-framework'),
_x('Invalid PHP version', '(Admin)', 'gdpr-framework')
);
}
/**
* Ensure compatible version of WordPress is used
*/
if (version_compare(get_bloginfo('version'), '4.3', '<')) {
$gdpr_error(
_x('You must be using WordPress 4.3.0 or greater.', '(Admin)', 'gdpr-framework'),
_x('Invalid WordPress version', '(Admin)', 'gdpr-framework')
);
}
/**
* Load dependencies
*/
if (!class_exists('\Codelight\GDPR\Container')) {
if (!file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
$gdpr_error(
_x(
'You appear to be running a development version of GDPR. You must run <code>composer install</code> from the plugin directory.',
'(Admin)',
'gdpr-framework'
),
_x(
'Autoloader not found.',
'(Admin)',
'gdpr-framework'
)
);
}
require_once $composer;
}
/**
* Install the database table and custom role
*/
register_activation_hook(__FILE__, function () {
$model = new \Codelight\GDPR\Components\Consent\UserConsentModel();
$model->createTable();
if (apply_filters('gdpr/data-subject/anonymize/change_role', true) && ! get_role('anonymous')) {
add_role(
'anonymous',
_x('Anonymous', '(Admin)', 'gdpr-framework'),
array()
);
}
update_option('gdpr_enable_stylesheet', true);
update_option('gdpr_enable', true);
});
require_once('bootstrap.php');