PluginProbe
The GDPR Framework By Data443 / 1.0.42
The GDPR Framework By Data443 v1.0.42
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.42, at gdpr-framework.php

179 lines 5.6 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://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.42
8 * Author: Data443
9 * Author URI: https://www.data443.com/
10 * Text Domain: gdpr-framework
11 * Domain Path: /languages
12 *
13 * @package WordPress
14 */
15
16 if (!defined('WPINC'))
17 {
18 die;
19 }
20
21 define('GDPR_FRAMEWORK_VERSION', '1.0.42');
22
23 add_shortcode( 'gdpr_privacy_safe', 'render_privacy_safe' ); // preserve backward compatibility
24 add_shortcode( 'data443_privacy_safe', 'render_privacy_safe' );
25
26 /**
27 * Render WHMCS Seal Generator Addon Javascript
28 */
29 function render_privacy_safe() {
30 wp_register_script( 'gdpr_whmcs_seal_generator', gdpr( 'config' )->get( 'plugin.url' ) . 'assets/js/showseal.js', null, true, true );
31 wp_localize_script(
32 'gdpr_whmcs_seal_generator',
33 'gdpr_seal_var',
34 array(
35 'gdpr_imageparams' => esc_attr( get_option( 'gdpr_privacy_safe_params' ) ),
36 'gdpr_imagecode' => esc_attr( get_option( 'gdpr_privacy_safe_imagecode' ) ),
37 'gdpr_showimagefunc' => 'showimage_' . esc_attr( get_option( 'gdpr_privacy_safe_imagecode' ) ),
38 )
39 );
40 wp_enqueue_script( 'gdpr_whmcs_seal_generator', basename( dirname( __FILE__ ) ) . 'assets/js/showseal.js', null, true, true );
41
42 if( get_option( 'gdpr_privacy_safe_backlink' ) === '1' ){
43 $backlink = '<span style="font-size:12px;">Privacy Management Service by <a href="https://data443.com/products/global-privacy-manager/" target="_blank">Data443</a></span>';
44 }else{
45 $backlink = '';
46 }
47
48 if( get_option( 'gdpr_privacy_safe_imagecode' ) !== '' && get_option( 'gdpr_privacy_safe_params' ) !== '' ){
49 echo '<a href="javascript:;" onclick="openpopup_' . esc_attr( get_option( 'gdpr_privacy_safe_imagecode' ) ) . '();">
50 <img src="https://orders.data443.com/seal/seal.php?params=' . esc_attr( get_option( 'gdpr_privacy_safe_params' ) ) . '" alt="" />
51 </a><br/>' . $backlink;
52 }else{
53 echo $backlink;
54 }
55 }
56
57 add_action( 'plugins_loaded', 'gdpr_framework_load_textdomain' );
58 function gdpr_framework_load_textdomain()
59 {
60 load_plugin_textdomain( 'gdpr-framework', false, basename( dirname( __FILE__ ) ) . '/languages' );
61 }
62 /**
63 * Our custom post type function
64 */
65 function create_custom_post_type() {
66 $args = array(
67 'label' => 'Do Not Sell Info',
68 'public' => true,
69 'has_archive' => false,
70 'exclude_from_search' => true,
71 'publicly_queryable' => false,
72 'show_ui' => true,
73 'hierarchical' => false,
74 'rewrite' => array( 'slug' => 'donotsellrequests' ),
75 'query_var' => true,
76 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'post-formats' ),
77 );
78 register_post_type( 'donotsellrequests', $args );
79 }
80 /**
81 * Hooking up our function to theme setup
82 */
83 add_action( 'init', 'create_custom_post_type' );
84
85 /**
86 * Helper function for prettying up errors
87 *
88 * @param string $message
89 * @param string $subtitle
90 * @param string $title
91 */
92 $gdpr_error = function($message, $subtitle = '', $title = '')
93 {
94 $title = $title ?: _x('WordPress GDPR &rsaquo; Error', '(Admin)', 'gdpr-framework');
95 $message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p>";
96 wp_die($message, $title);
97 };
98
99 /**
100 * Ensure compatible version of PHP is used
101 */
102 if (version_compare(phpversion(), '5.6.0', '<'))
103 {
104 $gdpr_error(
105 _x('You must be using PHP 5.6.0 or greater.', '(Admin)', 'gdpr-framework'),
106 _x('Invalid PHP version', '(Admin)', 'gdpr-framework')
107 );
108 }
109
110 /**
111 * Ensure compatible version of WordPress is used
112 */
113 if (version_compare(get_bloginfo('version'), '4.3', '<'))
114 {
115 $gdpr_error(
116 _x('You must be using WordPress 4.3.0 or greater.', '(Admin)', 'gdpr-framework'),
117 _x('Invalid WordPress version', '(Admin)', 'gdpr-framework')
118 );
119 }
120
121 /**
122 * Fix issue with redeclate function issue on DIVI theme.
123 */
124 function TermAndConditionWithPrivacyContent()
125 {
126 return 'I accept the %sTerms and Conditions%s and the %sPrivacy Policy%s';
127 }
128
129 function gdprfPrivacyPolicy()
130 {
131 return 'I accept the %sPrivacy Policy%s';
132 }
133
134 function gdprfPrivacyPolicyurl($policypage)
135 {
136 $policypageURL = get_option( 'gdpr_custom_policy_page' );
137 if($policypageURL=="")
138 {
139 return $policypage;
140 }else{
141 return $policypageURL;
142 }
143 }
144
145 function gdpr_privacy_accpetance($gdpr_error_massage)
146 {
147 return $gdpr_error_massage;
148 }
149
150 /**
151 * Save user logs
152 */
153 add_action( 'profile_update', 'my_profile_update', 10, 2 );
154
155 function my_profile_update( $user_id, $old_user_data )
156 {
157 $data = (array) $old_user_data->data;
158
159 $all_meta_for_user = get_user_meta( $user_id );
160 if($all_meta_for_user['nickname']['0']){
161 $data['nickname'] = $all_meta_for_user['nickname']['0'];
162 }
163 if($all_meta_for_user['first_name']['0']){
164 $data['first_name'] = $all_meta_for_user['first_name']['0'];
165 }
166 if($all_meta_for_user['last_name']['0']){
167 $data['last_name'] = $all_meta_for_user['last_name']['0'];
168 }
169 if($all_meta_for_user['description']['0']){
170 $data['description'] = $all_meta_for_user['description']['0'];
171 }
172 $userdata = serialize($data);
173 $model = new \Codelight\GDPR\Components\Consent\UserConsentModel();
174 $model->savelog($user_id,$userdata);
175 }
176
177 require_once('gdpr-helper-functions.php');
178 require_once('bootstrap.php');
179