PluginProbe
The GDPR Framework By Data443 / 1.0.10
The GDPR Framework By Data443 v1.0.10
2.5.0 2.4.0 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.3 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 All 41 releases
gdpr-framework / gdpr-framework.php

gdpr-framework.php in The GDPR Framework By Data443 1.0.10, at gdpr-framework.php

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