| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPPIZZA_MODULE_TOOLS_PRIVACY_GENERAL Class |
| 4 |
* |
| 5 |
* @package WPPIZZA |
| 6 |
* @subpackage WPPIZZA_MODULE_TOOLS_PRIVACY_GENERAL |
| 7 |
* @copyright Copyright (c) 2015, Oliver Bach |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 3.6 |
| 10 |
* |
| 11 |
*/ |
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/ |
| 13 |
|
| 14 |
|
| 15 |
/************************************************************************************************************************ |
| 16 |
* |
| 17 |
* |
| 18 |
* |
| 19 |
* |
| 20 |
* |
| 21 |
* |
| 22 |
************************************************************************************************************************/ |
| 23 |
class WPPIZZA_MODULE_TOOLS_PRIVACY_GENERAL{ |
| 24 |
|
| 25 |
private $settings_page = 'tools';/* which admin subpage (identified there by this->class_key) are we adding this to */ |
| 26 |
private $tab_key = 'privacy';/* must be unique within this admin page*/ |
| 27 |
private $section_key = 'general'; |
| 28 |
|
| 29 |
function __construct() { |
| 30 |
/********************************************************** |
| 31 |
[add settings to admin] |
| 32 |
***********************************************************/ |
| 33 |
if(is_admin()){ |
| 34 |
/*** add to a specific tab ***/ |
| 35 |
add_filter('wppizza_filter_admin_tabs_'.$this->settings_page.'', array($this, 'admin_tabs'), 10); |
| 36 |
/* add admin options settings page*/ |
| 37 |
add_filter('wppizza_filter_settings_sections_'.$this->settings_page.'', array($this, 'admin_options_settings'), 10, 5); |
| 38 |
/* add admin options settings page fields */ |
| 39 |
add_action('wppizza_admin_settings_section_fields_'.$this->settings_page.'', array($this, 'admin_options_fields_settings'), 10, 5); |
| 40 |
/**add default options **/ |
| 41 |
add_filter('wppizza_filter_setup_default_options', array( $this, 'options_default'), 10, 2 ); |
| 42 |
/**validate options**/ |
| 43 |
add_filter('wppizza_filter_options_validate', array( $this, 'options_validate'), 10, 2 ); |
| 44 |
/**add text header*/ |
| 45 |
// //add_action('wppizza_settings_sections_header_'.$this->settings_page.'', array( $this, 'sections_header'), 10, 2 ); |
| 46 |
} |
| 47 |
|
| 48 |
/********************************************************** |
| 49 |
Register WP Privacy actions/filters (admin) |
| 50 |
**********************************************************/ |
| 51 |
global $wppizza_options, $wp_version; |
| 52 |
|
| 53 |
/* |
| 54 |
admin only |
| 55 |
*/ |
| 56 |
if(is_admin()){ |
| 57 |
/* suggested privacy policy text */ |
| 58 |
add_action( 'admin_init', array( $this, 'register_privacy_policy_template')); |
| 59 |
/* register data export */ |
| 60 |
add_filter('wp_privacy_personal_data_exporters',array( $this, 'register_data_exporter'), 10); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
/* |
| 65 |
frontend |
| 66 |
*/ |
| 67 |
/* add accept T/C & Privacy checkbox, must be wp >=4.9.6 */ |
| 68 |
if ( version_compare( $wp_version, '4.9.6', '>=' ) ) { |
| 69 |
add_filter('wppizza_register_formfields',array( $this, 'register_formfields_accept_privacy_checkbox'), 100); |
| 70 |
} |
| 71 |
|
| 72 |
} |
| 73 |
|
| 74 |
/******************************************************************************************************************************************************* |
| 75 |
* |
| 76 |
* |
| 77 |
* |
| 78 |
* [admin privacy actions (export/erase/suggested text) ] |
| 79 |
* |
| 80 |
* |
| 81 |
* |
| 82 |
********************************************************************************************************************************************************/ |
| 83 |
|
| 84 |
/*------------------------------------------------------------------------------ |
| 85 |
# [suggested privacy policy text] |
| 86 |
# |
| 87 |
# @since 3.6 |
| 88 |
# @return array() |
| 89 |
------------------------------------------------------------------------------*/ |
| 90 |
function register_privacy_policy_template() { |
| 91 |
global $wppizza_options; |
| 92 |
/* |
| 93 |
skip if function does not exist (WP < 4.9.6) |
| 94 |
*/ |
| 95 |
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { |
| 96 |
return; |
| 97 |
} |
| 98 |
|
| 99 |
/* |
| 100 |
set suggested text |
| 101 |
*/ |
| 102 |
$registered_formfields = array(); |
| 103 |
if(!empty($wppizza_options['order_form'])){ |
| 104 |
foreach($wppizza_options['order_form'] as $ff){ |
| 105 |
if(!empty($ff['enabled'])){ |
| 106 |
$registered_formfields[] = $ff['lbl']; |
| 107 |
} |
| 108 |
}} |
| 109 |
$ffs = "· ".implode(PHP_EOL."· ", $registered_formfields).PHP_EOL."· Credit Card / Payment Details."; |
| 110 |
|
| 111 |
/* text */ |
| 112 |
/* Translators: 1: WPPizza Name as defined by constant */ |
| 113 |
$content = '<div class="wppizza-highlight">'.sprintf(__('Disclaimer: the below is some suggested privacy policy text when using the %s plugin. Edit as required for your particular site/setup. It does not constitute legal advise as to what is appropriate in your particular scenario.', 'wppizza-admin'),WPPIZZA_NAME).'</div>'; |
| 114 |
/* Translators: 1: middot separated list of information that may be collected, based on formfields in WPPizza->Orderform */ |
| 115 |
$content .= sprintf(__( ' |
| 116 |
We collect information about you during the checkout process on our store. |
| 117 |
This information may include but is not limited to: |
| 118 |
%s |
| 119 |
alongside any other details that might be requested from you for the purpose of processing your order. |
| 120 |
However, please note that specific credit card / payment details such as actual full credit card numbers, CVC codes and expiry dates are NOT being collected or processed by this server but are processed in a secure environmemt by our payment provider(s) |
| 121 |
<span class="wppizza-highlight">(i.e Paypal, Stripe etc - DELETE/ADD AS APPROPRIATE)</span>. |
| 122 |
|
| 123 |
On the basis of our legitimate business interests handling this data will allows us to: |
| 124 |
· Send you important order/service/account information. |
| 125 |
· Respond to your queries, refund requests or complaints. |
| 126 |
· Process payments and prevent fraudulent transactions. |
| 127 |
· Set up and administer your account, provide technical and/or customer support and to verify your identity. |
| 128 |
|
| 129 |
Additionally we may also collect the following information: |
| 130 |
· Your location if you place an order, or if we need to estimate taxes and delivery costs based on your location. |
| 131 |
· If you choose to create an account with us, your name, address, and email address, which will be used to populate the checkout for future orders. |
| 132 |
· Your account email/password to allow you to access your account, if you have registered an account with us. |
| 133 |
', 'wppizza-admin'), $ffs ); |
| 134 |
$content .= "\n\n"; |
| 135 |
|
| 136 |
|
| 137 |
$suggested_text = wp_kses_post( apply_filters( 'wppizza_privacy_policy_content', $content ) ); |
| 138 |
|
| 139 |
wp_add_privacy_policy_content(WPPIZZA_NAME, wpautop( $suggested_text ) ); |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
/*------------------------------------------------------------------------------ |
| 145 |
# [register data exporters] |
| 146 |
# |
| 147 |
# @since 3.5 |
| 148 |
# @return array() |
| 149 |
------------------------------------------------------------------------------*/ |
| 150 |
function register_data_exporter($exporters){ |
| 151 |
$exporters[] = array( |
| 152 |
'exporter_friendly_name' => WPPIZZA_NAME, |
| 153 |
'callback' => array($this, 'data_exporter'), |
| 154 |
); |
| 155 |
return $exporters; |
| 156 |
} |
| 157 |
/*------------------------------------------------------------------------------ |
| 158 |
# [export data] |
| 159 |
# |
| 160 |
# @since 3.5 |
| 161 |
# @return array() |
| 162 |
------------------------------------------------------------------------------*/ |
| 163 |
function data_exporter( $email_address, $page = 1 ){ |
| 164 |
$limit = 250; // Limit us to avoid timing out |
| 165 |
$page = (int)$page; |
| 166 |
|
| 167 |
|
| 168 |
// Core group IDs include 'comments', 'posts', etc. |
| 169 |
// But you can add your own group IDs as needed |
| 170 |
$group_id = WPPIZZA_SLUG; |
| 171 |
|
| 172 |
// Optional group label. Core provides these for core groups. |
| 173 |
// If you define your own group, the first exporter to |
| 174 |
// include a label will be used as the group label in the |
| 175 |
// final exported report |
| 176 |
/* Translators: 1 : Bloginfo name as set in general settings */ |
| 177 |
$group_label = sprintf(__( '%s Orders', 'wppizza-admin'), get_bloginfo( 'name' )); |
| 178 |
|
| 179 |
|
| 180 |
/* |
| 181 |
email addresses stored might also be encrypted (using WPPIZZA_CRYPT_KEY) |
| 182 |
so lets make an array of encrypted and unencrypted emails to check |
| 183 |
*/ |
| 184 |
$email_export = array(); |
| 185 |
$email_export[] = $email_address; //unencrypted email |
| 186 |
$email_export[] = wppizza_maybe_encrypt_decrypt($email_address, true, false, true); //perhaps encrypted email |
| 187 |
/* make sure they are not identical (in case a WPPIZZA_CRYPT_KEY was not set) */ |
| 188 |
$email_export = array_unique(array_filter($email_export)); |
| 189 |
|
| 190 |
/* |
| 191 |
ini items to export |
| 192 |
*/ |
| 193 |
$export_items = array(); |
| 194 |
|
| 195 |
/* |
| 196 |
query args |
| 197 |
*/ |
| 198 |
$args = array( |
| 199 |
'query'=>array( |
| 200 |
'payment_status' => 'NULL',//getting all data, even abandoned/non completed |
| 201 |
'email' => $email_export,//query for plain and hashed emails (if any) |
| 202 |
), |
| 203 |
'pagination' =>array( |
| 204 |
'paged' => $page , |
| 205 |
'limit' => $limit , |
| 206 |
), |
| 207 |
); |
| 208 |
$orders_for_export = WPPIZZA()->db->get_orders($args, 'data_exporter'); |
| 209 |
|
| 210 |
/* |
| 211 |
do we have any orders to start off with ? |
| 212 |
*/ |
| 213 |
if(empty($orders_for_export['total_number_of_orders'])){ |
| 214 |
$export_data = array('data' => array(), 'done' => true); |
| 215 |
return $export_data; |
| 216 |
} |
| 217 |
|
| 218 |
foreach ( $orders_for_export['orders'] as $order_id => $order ) { |
| 219 |
|
| 220 |
/* ini customer data array */ |
| 221 |
$customer_data = array(); |
| 222 |
|
| 223 |
/* Order ID (blog_orderid) , append status*/ |
| 224 |
$order_status = !empty($order['ordervars']['payment_status']['value_formatted']) ? ' ('.$order['ordervars']['payment_status']['value_formatted'].')' : ''; |
| 225 |
$customer_data['blog_order_id']['name'] = __('Order ID (Status)' ,'wppizza-admin'); |
| 226 |
$customer_data['blog_order_id']['value'] = str_replace('_', '.' ,$order_id) . $order_status ; |
| 227 |
|
| 228 |
|
| 229 |
/* |
| 230 |
customer_ini data , omitting accept privacy policy acceptance (for now as initialized orders will also be exported but will not necessarily have the policy accepted yet and could lead to confusion) |
| 231 |
also omitting wordpress registered users firts name / last name / email / login |
| 232 |
as that data already exists in the standard WP User export data |
| 233 |
|
| 234 |
*/ |
| 235 |
foreach($order['customer'] as $cKey => $cArr){ |
| 236 |
if(!empty($cArr['value']) && !in_array($cKey, array('privacy_terms_accept', 'email', 'first_name', 'last_name', 'login'))){ |
| 237 |
$customer_data[$cKey]['name'] = $cArr['label']; |
| 238 |
$customer_data[$cKey]['value'] = $cArr['value']; |
| 239 |
} |
| 240 |
} |
| 241 |
|
| 242 |
/* ipaddress */ |
| 243 |
if(!empty($order['ordervars']['ip_address']['value_formatted'])){ |
| 244 |
$customer_data['ip_address']['name'] = $order['ordervars']['ip_address']['label']; |
| 245 |
$customer_data['ip_address']['value'] = $order['ordervars']['ip_address']['value_formatted']; |
| 246 |
} |
| 247 |
|
| 248 |
/* browser data */ |
| 249 |
if(!empty($order['ordervars']['user_data']['value_formatted']['HTTP_USER_AGENT'])){ |
| 250 |
$customer_data['user_data']['name'] = 'HTTP_USER_AGENT'; |
| 251 |
$customer_data['user_data']['value'] = $order['ordervars']['user_data']['value_formatted']['HTTP_USER_AGENT']; |
| 252 |
} |
| 253 |
|
| 254 |
/* |
| 255 |
allow filtering for other plugins |
| 256 |
that have added their own columns perhaps |
| 257 |
*/ |
| 258 |
$customer_data = apply_filters('wppizza_filter_data_exporter', $customer_data, $order, $order_id); |
| 259 |
|
| 260 |
/* payment status - to perhaps make sense of privacy policies acceptance if set to NO - dont think that's necessary, but leave it here for now*/ |
| 261 |
//if(!empty($order['ordervars']['payment_status']['value_formatted'])){ |
| 262 |
// $customer_data['payment_status']['name'] = $order['ordervars']['payment_status']['label']; |
| 263 |
// $customer_data['payment_status']['value'] = $order['ordervars']['payment_status']['value_formatted']; |
| 264 |
//} |
| 265 |
|
| 266 |
/* |
| 267 |
dataset for this order |
| 268 |
*/ |
| 269 |
if(!empty( $customer_data)){ |
| 270 |
$export_items[] = array( |
| 271 |
'group_id' => $group_id, |
| 272 |
'group_label' => $group_label, |
| 273 |
'item_id' => $order_id, |
| 274 |
'data' => $customer_data, |
| 275 |
); |
| 276 |
} |
| 277 |
|
| 278 |
} |
| 279 |
|
| 280 |
// Tell core if we have more to work on still |
| 281 |
$done = $orders_for_export['number_orders_on_page'] < $limit; |
| 282 |
|
| 283 |
/* |
| 284 |
return data to export |
| 285 |
*/ |
| 286 |
$export_data = array(); |
| 287 |
$export_data['data'] = $export_items; |
| 288 |
$export_data['done'] = $done; |
| 289 |
|
| 290 |
return $export_data; |
| 291 |
} |
| 292 |
|
| 293 |
|
| 294 |
/******************************************************************************************************************************************************* |
| 295 |
* |
| 296 |
* |
| 297 |
* |
| 298 |
* [Privacy Frontend] |
| 299 |
* |
| 300 |
* |
| 301 |
* |
| 302 |
********************************************************************************************************************************************************/ |
| 303 |
/*------------------------------------------------------------------------------ |
| 304 |
# [add checkbox to checkout form that accepts t&c's + privacy] |
| 305 |
# |
| 306 |
# @since 3.5 |
| 307 |
# @param array() |
| 308 |
# @return array() |
| 309 |
------------------------------------------------------------------------------*/ |
| 310 |
function register_formfields_accept_privacy_checkbox($formfields){ |
| 311 |
|
| 312 |
global $wppizza_options; |
| 313 |
// only if enabled |
| 314 |
if(empty($wppizza_options[$this->settings_page]['privacy'])){ |
| 315 |
return $formfields; |
| 316 |
} |
| 317 |
|
| 318 |
$privacy_link_id = (int)get_option('wp_page_for_privacy_policy'); |
| 319 |
$privacy_permalink = get_permalink($privacy_link_id); |
| 320 |
$privacy_link_status = get_post_status($privacy_link_id); |
| 321 |
|
| 322 |
/* make sure privacy page status == 'publish' */ |
| 323 |
if('publish' == $privacy_link_status){ |
| 324 |
global $wppizza_options; |
| 325 |
|
| 326 |
/* making sure we always add this last (adding 10 instead of just 1, just for good measure)*/ |
| 327 |
$mk_last_sort_id = max(wppizza_array_column($formfields, 'sort'))+10; |
| 328 |
|
| 329 |
$privacy_terms_label = (wppizza_is_checkout()) ? sprintf($wppizza_options['localization']['privacy_terms_accept'], $privacy_permalink) : $wppizza_options['localization']['privacy_terms_accepted'] ; |
| 330 |
|
| 331 |
$formfields['privacy_terms_accept'] = array(); |
| 332 |
$formfields['privacy_terms_accept']['sort'] = $mk_last_sort_id; |
| 333 |
$formfields['privacy_terms_accept']['key'] = 'privacy_terms_accept'; |
| 334 |
$formfields['privacy_terms_accept']['lbl'] = $privacy_terms_label; |
| 335 |
$formfields['privacy_terms_accept']['value'] = array(); |
| 336 |
$formfields['privacy_terms_accept']['type'] = 'checkbox'; |
| 337 |
$formfields['privacy_terms_accept']['enabled'] = true; |
| 338 |
$formfields['privacy_terms_accept']['required'] = true; |
| 339 |
$formfields['privacy_terms_accept']['required_on_pickup'] = true; |
| 340 |
$formfields['privacy_terms_accept']['prefill'] = null;//null => never prefill/check |
| 341 |
$formfields['privacy_terms_accept']['onregister'] = false; |
| 342 |
$formfields['privacy_terms_accept']['add_to_subject_line'] = false; |
| 343 |
$formfields['privacy_terms_accept']['placeholder'] = ''; |
| 344 |
$formfields['privacy_terms_accept']['validation'] = array('default' => true); |
| 345 |
} |
| 346 |
|
| 347 |
|
| 348 |
return $formfields; |
| 349 |
} |
| 350 |
|
| 351 |
/******************************************************************************************************************************************************* |
| 352 |
* |
| 353 |
* |
| 354 |
* |
| 355 |
* [add admin page options] |
| 356 |
* |
| 357 |
* |
| 358 |
* |
| 359 |
********************************************************************************************************************************************************/ |
| 360 |
|
| 361 |
/*------------------------------------------------------------------------------ |
| 362 |
# |
| 363 |
# |
| 364 |
# [settings page] |
| 365 |
# |
| 366 |
# |
| 367 |
------------------------------------------------------------------------------*/ |
| 368 |
|
| 369 |
/********************************************************* |
| 370 |
[add section to a particular tab] |
| 371 |
*********************************************************/ |
| 372 |
function admin_tabs($tabs){ |
| 373 |
$tabs['tab'][$this->tab_key]['sections'][] = $this->section_key; |
| 374 |
return $tabs; |
| 375 |
} |
| 376 |
/*------------------------------------------------------------------------------ |
| 377 |
# [settings section - setting page] |
| 378 |
# @since 3.6 |
| 379 |
# @return array() |
| 380 |
------------------------------------------------------------------------------*/ |
| 381 |
function admin_options_settings($settings, $sections, $fields, $inputs, $help){ |
| 382 |
global $wp_version; |
| 383 |
|
| 384 |
$version_notice = version_compare( $wp_version, '4.9.6', '<' ) ? '<span class="wppizza-highlight">'.__('Requires Wordpress 4.9.6+', 'wppizza-admin').'</span>' : '' ; |
| 385 |
|
| 386 |
/*section*/ |
| 387 |
if($sections){ |
| 388 |
$settings['sections'][$this->section_key] = __('Privacy', 'wppizza-admin'); |
| 389 |
} |
| 390 |
|
| 391 |
/*help*/ |
| 392 |
if($help){ |
| 393 |
$settings['help'][$this->section_key][] = array( |
| 394 |
'label'=>__('Privacy (General)', 'wppizza-admin'), |
| 395 |
'description'=>array( |
| 396 |
'<h3>'.__('Enables certain privacy settings and functions to <b>help</b> you comply with privacy regulations (notably GDPR, if applicable) for your business.', 'wppizza-admin'). ' ' .$version_notice.'</h3>', |
| 397 |
'<span class="wppizza-highlight">'.__('Disclaimer: The below does not constitute legal advise. Neither does enabling the Privacy / GDPR setting here automatically make your site compliant with privacy regulations in your country. Furthermore, the outlines below <b>only</b> apply to the WPPizza plugin. Please consult a lawyer regarding full requirements to make your site (and business) compliant according to the privacy laws of your country.', 'wppizza-admin').'</span>', |
| 398 |
'<br>', |
| 399 |
|
| 400 |
'<b>'.__('The following will apply if you check "Enable Privacy Settings" below.', 'wppizza-admin').'</b>', |
| 401 |
'<ul>', |
| 402 |
/* Translators: 1, 2, 3: WPPizza Name as defined by constant */ |
| 403 |
'<li><b>'.__('Agree to Privacy Policy', 'wppizza-admin').'</b> - '.sprintf(__('A checkbox will be added to the end of the personal information form at checkout that must be ticked by the customer to be able to place an order.<br>If required, you can change the text adjacent to this checkbox in the "%1$s -> Localization -> Miscellaneous" settings of this plugin.<br>Use " %2$s -> Templates -> Emails / Templates -> Print" to show/hide the submitted value if required<br><span class="wppizza-highlight">Make sure you also write, set and publish a page that contains your privacy policy in "Wordpress -> Setings-> Privacy".<br/>Your privacy statement should include a statement why you need to collect certain data (i.e the formfields you have enabled in "%3$s -> Order Form") to fulfill an order.</span>', 'wppizza-admin'), WPPIZZA_NAME, WPPIZZA_NAME, WPPIZZA_NAME).'</li>', |
| 404 |
'<li><b>'.__('Personal Data - "Keep Browser Data"', 'wppizza-admin').'</b> - '.__('Unless this option is specifically enabled/checked, Browser Data (such as Referrer URL, User Agent etc) will not be stored anymore, as this data is typically unnecessary for processing or fulfillment of an order', 'wppizza-admin').'</li>', |
| 405 |
'<li><b>'.__('Personal Data - "Keep IP Addresses"', 'wppizza-admin').'</b> - '.__('Unless this option is specifically enabled/checked all IP Addresses will be stored anonymised, as this data is typically unnecessary for processing or fulfillment of an order.', 'wppizza-admin').'</li>', |
| 406 |
'<li><b>'.__('Export Personal Data', 'wppizza-admin').'</b> - '.__('Any personal data captured in the orders table of this plugin will be appended to the data export information when using "Wordpress -> Tools -> Export Personal Data"', 'wppizza-admin').'</li>', |
| 407 |
'<li><b>'.__('Erase Personal Data', 'wppizza-admin').'</b> - '.__('If you have received a request to erase a users personal data, you can choose which action (if any) should be taken for the various order statuses when using "Wordpress -> Tools -> Erase Personal Data"', 'wppizza-admin').'</li>', |
| 408 |
/* Translators: 1 : WPPizza Name as defined by constant */ |
| 409 |
'<li><b>'.__('Data Retention', 'wppizza-admin').'</b> - '.sprintf(__('You might want to consider removing old database entries of orders that were not being completed for one reason or another in "%s -> Tools -> Maintenance"', 'wppizza-admin'), WPPIZZA_NAME ).'</li>', |
| 410 |
'</ul>', |
| 411 |
'<b>'.__('The functionalities associated with the settings here might be amended over time as requirements and possibilities (i.e additions to the Wordpress core) develop.', 'wppizza-admin').'</b>', |
| 412 |
|
| 413 |
'<br>', |
| 414 |
'<h3>'.__('A note on if you need to move this site elsewhere:', 'wppizza-admin').'</h3>'. |
| 415 |
'<span class="wppizza-highlight"><b>('.__('ONLY relevant if you ever need to move/copy any wppizza orders you have received on *this* site here to a *new* site. Else you can completely ignore the below', 'wppizza-admin').')</b></span>'. |
| 416 |
'<ul>'. |
| 417 |
'<li>'.__('Email addresses associated with privacy functions are stored encrypted in the database utilizing the standard - but unique to every site - <code>"SECURE_AUTH_SALT"</code> constant defined in your wp-config.php.', 'wppizza-admin').'</li>'. |
| 418 |
'<li>'.__('If for one reason or another you need to move existing ordesr from this site to another you must *add* the string from your <code>"SECURE_AUTH_SALT"</code> constant from *this* sites wp-config.php as <code>"WPPIZZA_CRYPT_KEY"</code> constant to the *new* sites wp-config.php', 'wppizza-admin').'</li>'. |
| 419 |
'<li>'.__('Example: If your current/this sites wp-config.php has the following: <code>define("SECURE_AUTH_SALT", "abcdefghifklmn");</code> *add* <code>"define("WPPIZZA_CRYPT_KEY", "abcdefghifklmn");"</code> to the *new* sites wp-config.php', 'wppizza-admin').'</li>'. |
| 420 |
'<li>'.__('Nothing will break if you do not do this, but some privacy functions might not work as expected on your new site if you do not define this constant.', 'wppizza-admin').'</li>'. |
| 421 |
'</ul>', |
| 422 |
/* Translators: 1 : Url to support forum */ |
| 423 |
'<br/>'.sprintf(__('If you have any questions or comments regarding the above, please use the ususal channels (preferably the <a href="%s" target="_blank">"Support forum"</a> in this case to make conversations about this topic visible to anyone)', 'wppizza-admin'), 'https://www.wp-pizza.com/support/').'', |
| 424 |
) |
| 425 |
); |
| 426 |
} |
| 427 |
|
| 428 |
|
| 429 |
/*fields*/ |
| 430 |
if($fields){ |
| 431 |
|
| 432 |
$field = 'privacy'; |
| 433 |
$settings['fields'][$this->section_key][$field] = array( __('Enable Privacy Settings', 'wppizza-admin'), array( |
| 434 |
'value_key'=>$field, |
| 435 |
'option_key'=>$this->settings_page, |
| 436 |
'label'=>__('Simply enabling this option will NOT automatically make you GDPR compliant.', 'wppizza-admin').'<br/><span class="wppizza-highlight"><b>'.__('Please refer to the <a href="javascript:void(0)" class="wppizza-show-admin-help">help screen</a> for more details.', 'wppizza-admin').'</b></span>', |
| 437 |
'description'=>array($version_notice,) |
| 438 |
)); |
| 439 |
|
| 440 |
$field = 'privacy_keep_ip_address'; |
| 441 |
$settings['fields'][$this->section_key][$field] = array( __('Keep IP Address', 'wppizza-admin'), array( |
| 442 |
'value_key'=>$field, |
| 443 |
'option_key'=>$this->settings_page, |
| 444 |
'label'=>__('If - for legal or other reasons - you need to always store full ip addresses with your orders, even if you have the privacy settings enabled above, check this box.', 'wppizza-admin'), |
| 445 |
'description'=>array($version_notice,) |
| 446 |
)); |
| 447 |
|
| 448 |
$field = 'privacy_keep_browser_data'; |
| 449 |
$settings['fields'][$this->section_key][$field] = array( __('Keep Browser Data', 'wppizza-admin'), array( |
| 450 |
'value_key'=>$field, |
| 451 |
'option_key'=>$this->settings_page, |
| 452 |
'label'=>__('If - for legal or other reasons - you need to always store browser data (Referrer URL, User Agent) with your orders, even if you have the privacy settings enabled above, check this box', 'wppizza-admin'), |
| 453 |
'description'=>array($version_notice,) |
| 454 |
)); |
| 455 |
|
| 456 |
} |
| 457 |
return $settings; |
| 458 |
} |
| 459 |
/*------------------------------------------------------------------------------ |
| 460 |
# [output option fields - setting page] |
| 461 |
# @since 3.6 |
| 462 |
# @return array() |
| 463 |
------------------------------------------------------------------------------*/ |
| 464 |
function admin_options_fields_settings($wppizza_options, $options_key, $field, $label, $description){ |
| 465 |
|
| 466 |
if($field=='privacy'){ |
| 467 |
echo "<label>"; |
| 468 |
echo "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 469 |
echo "" . $label . ""; |
| 470 |
echo "</label>"; |
| 471 |
echo"".$description.""; |
| 472 |
} |
| 473 |
|
| 474 |
if($field=='privacy_keep_ip_address'){ |
| 475 |
echo "<label>"; |
| 476 |
echo "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 477 |
echo "" . $label . ""; |
| 478 |
echo "</label>"; |
| 479 |
echo"".$description.""; |
| 480 |
} |
| 481 |
|
| 482 |
if($field=='privacy_keep_browser_data'){ |
| 483 |
echo "<label>"; |
| 484 |
echo "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 485 |
echo "" . $label . ""; |
| 486 |
echo "</label>"; |
| 487 |
echo"".$description.""; |
| 488 |
} |
| 489 |
} |
| 490 |
|
| 491 |
/**************************************************************** |
| 492 |
* |
| 493 |
* [insert default option on install] |
| 494 |
* $parameter $options array() | filter passing on filtered options |
| 495 |
* @since 3.6 |
| 496 |
* @return array() |
| 497 |
* |
| 498 |
****************************************************************/ |
| 499 |
function options_default($options, $install){ |
| 500 |
global $wppizza_options; |
| 501 |
|
| 502 |
/* enable privacy (keeping any settings from v3.5.0.x though)*/ |
| 503 |
$options[$this->settings_page]['privacy'] = isset($wppizza_options['settings']['privacy']) ? $wppizza_options['settings']['privacy'] : false; |
| 504 |
/* keep ip address even if privacy enabled (keeping any settings from v3.5.0.x though)*/ |
| 505 |
$options[$this->settings_page]['privacy_keep_ip_address'] = isset($wppizza_options['settings']['privacy_keep_ip_address']) ? $wppizza_options['settings']['privacy_keep_ip_address'] : false; |
| 506 |
/* keep bowser data even if privacy enabled (keeping any settings from v3.5.0.x though) */ |
| 507 |
$options[$this->settings_page]['privacy_keep_browser_data'] = isset($wppizza_options['settings']['privacy_keep_browser_data']) ? $wppizza_options['settings']['privacy_keep_browser_data'] : false; |
| 508 |
|
| 509 |
/* |
| 510 |
unset old 3.5.0.x parameters |
| 511 |
*/ |
| 512 |
unset($options['settings']['privacy']); |
| 513 |
unset($options['settings']['privacy_keep_ip_address']); |
| 514 |
unset($options['settings']['privacy_keep_browser_data']); |
| 515 |
unset($options['settings']['privacy_copy_emails']); |
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
return $options; |
| 520 |
} |
| 521 |
|
| 522 |
/*------------------------------------------------------------------------------ |
| 523 |
# [validate options on save/update] |
| 524 |
# |
| 525 |
# @since 3.6 |
| 526 |
# @return array() |
| 527 |
------------------------------------------------------------------------------*/ |
| 528 |
function options_validate($options, $input){ |
| 529 |
/**make sure we get the full array on install/update**/ |
| 530 |
if ( empty( $_POST['_wp_http_referer'] ) ) { |
| 531 |
return $input; |
| 532 |
} |
| 533 |
/******************************** |
| 534 |
* [validate] |
| 535 |
********************************/ |
| 536 |
if(isset($_POST[''.WPPIZZA_SLUG.'_'.$this->settings_page.'_'.$this->tab_key.''])){ |
| 537 |
global $wppizza_options; |
| 538 |
|
| 539 |
$options[$this->settings_page]['privacy'] = !empty($input[$this->settings_page]['privacy']) ? true : false; |
| 540 |
|
| 541 |
$options[$this->settings_page]['privacy_keep_ip_address'] = !empty($input[$this->settings_page]['privacy_keep_ip_address']) ? true : false; |
| 542 |
|
| 543 |
$options[$this->settings_page]['privacy_keep_browser_data'] = !empty($input[$this->settings_page]['privacy_keep_browser_data']) ? true : false; |
| 544 |
|
| 545 |
} |
| 546 |
return $options; |
| 547 |
} |
| 548 |
|
| 549 |
} |
| 550 |
/*************************************************************** |
| 551 |
* |
| 552 |
* [ini] |
| 553 |
* |
| 554 |
***************************************************************/ |
| 555 |
$WPPIZZA_MODULE_TOOLS_PRIVACY_GENERAL = new WPPIZZA_MODULE_TOOLS_PRIVACY_GENERAL(); |
| 556 |
?> |