| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: The GDPR Framework |
| 5 |
* Plugin URI: https://www.data443.com/gdpr-framework/ |
| 6 |
* Description: Tools to help make your website GDPR-compliant. Fully documented, extendable and developer-friendly. |
| 7 |
* Version: 1.0.34 |
| 8 |
* Author: Data443 |
| 9 |
* Author URI: https://www.data443.com/ |
| 10 |
* Text Domain: gdpr-framework |
| 11 |
* Domain Path: /languages |
| 12 |
*/ |
| 13 |
|
| 14 |
if (!defined('WPINC')) |
| 15 |
{ |
| 16 |
die; |
| 17 |
} |
| 18 |
|
| 19 |
define('GDPR_FRAMEWORK_VERSION', '1.0.34'); |
| 20 |
add_action( 'plugins_loaded', 'gdpr_framework_load_textdomain' ); |
| 21 |
function gdpr_framework_load_textdomain() |
| 22 |
{ |
| 23 |
load_plugin_textdomain( 'gdpr-framework', false, basename( dirname( __FILE__ ) ) . '/languages' ); |
| 24 |
} |
| 25 |
|
| 26 |
|
| 27 |
/** |
| 28 |
* Helper function for prettying up errors |
| 29 |
* |
| 30 |
* @param string $message |
| 31 |
* @param string $subtitle |
| 32 |
* @param string $title |
| 33 |
*/ |
| 34 |
$gdpr_error = function($message, $subtitle = '', $title = '') |
| 35 |
{ |
| 36 |
$title = $title ?: _x('WordPress GDPR › Error', '(Admin)', 'gdpr-framework'); |
| 37 |
$message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p>"; |
| 38 |
wp_die($message, $title); |
| 39 |
}; |
| 40 |
|
| 41 |
/** |
| 42 |
* Ensure compatible version of PHP is used |
| 43 |
*/ |
| 44 |
if (version_compare(phpversion(), '5.6.0', '<')) |
| 45 |
{ |
| 46 |
$gdpr_error( |
| 47 |
_x('You must be using PHP 5.6.0 or greater.', '(Admin)', 'gdpr-framework'), |
| 48 |
_x('Invalid PHP version', '(Admin)', 'gdpr-framework') |
| 49 |
); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Ensure compatible version of WordPress is used |
| 54 |
*/ |
| 55 |
if (version_compare(get_bloginfo('version'), '4.3', '<')) |
| 56 |
{ |
| 57 |
$gdpr_error( |
| 58 |
_x('You must be using WordPress 4.3.0 or greater.', '(Admin)', 'gdpr-framework'), |
| 59 |
_x('Invalid WordPress version', '(Admin)', 'gdpr-framework') |
| 60 |
); |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Fix issue with redeclate function issue on DIVI theme. |
| 65 |
*/ |
| 66 |
function TermAndConditionWithPrivacyContent() |
| 67 |
{ |
| 68 |
return 'I accept the %sTerms and Conditions%s and the %sPrivacy Policy%s'; |
| 69 |
} |
| 70 |
|
| 71 |
function gdprfPrivacyPolicy() |
| 72 |
{ |
| 73 |
return 'I accept the %sPrivacy Policy%s'; |
| 74 |
} |
| 75 |
|
| 76 |
function gdprfPrivacyPolicyurl($policypage) |
| 77 |
{ |
| 78 |
$policypageURL = get_option( 'gdpr_custom_policy_page' ); |
| 79 |
if($policypageURL=="") |
| 80 |
{ |
| 81 |
return $policypage; |
| 82 |
}else{ |
| 83 |
return $policypageURL; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
function gdpr_privacy_accpetance($gdpr_error_massage) |
| 88 |
{ |
| 89 |
return $gdpr_error_massage; |
| 90 |
} |
| 91 |
|
| 92 |
/** |
| 93 |
* Save user logs |
| 94 |
*/ |
| 95 |
add_action( 'profile_update', 'my_profile_update', 10, 2 ); |
| 96 |
|
| 97 |
function my_profile_update( $user_id, $old_user_data ) |
| 98 |
{ |
| 99 |
$data = (array) $old_user_data->data; |
| 100 |
|
| 101 |
$all_meta_for_user = get_user_meta( $user_id ); |
| 102 |
if($all_meta_for_user['nickname']['0']){ |
| 103 |
$data['nickname'] = $all_meta_for_user['nickname']['0']; |
| 104 |
} |
| 105 |
if($all_meta_for_user['first_name']['0']){ |
| 106 |
$data['first_name'] = $all_meta_for_user['first_name']['0']; |
| 107 |
} |
| 108 |
if($all_meta_for_user['last_name']['0']){ |
| 109 |
$data['last_name'] = $all_meta_for_user['last_name']['0']; |
| 110 |
} |
| 111 |
if($all_meta_for_user['description']['0']){ |
| 112 |
$data['description'] = $all_meta_for_user['description']['0']; |
| 113 |
} |
| 114 |
$userdata = serialize($data); |
| 115 |
$model = new \Codelight\GDPR\Components\Consent\UserConsentModel(); |
| 116 |
$model->savelog($user_id,$userdata); |
| 117 |
} |
| 118 |
|
| 119 |
require_once('gdpr-helper-functions.php'); |
| 120 |
require_once('bootstrap.php'); |
| 121 |
|