|
Server IP : 10.131.40.8 / Your IP : 216.73.216.37 Web Server : Apache System : Linux webd008.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : ludmqhh ( 137773) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/ludmqhh/www/hotel-forum/wp-content/plugins/wp-hotelier/includes/privacy/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* Privacy Class.
*
* @author Benito Lopez <hello@lopezb.com>
* @category Class
* @package Hotelier/Classes
* @version 1.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'HTL_Privacy' ) ) :
/**
* HTL_Privacy Class
*/
class HTL_Privacy {
/**
* List of exporters.
*
* @var array
*/
protected $exporters = array();
/**
* List of erasers.
*
* @var array
*/
protected $erasers = array();
/**
* Constructor
*/
public function __construct() {
// Include supporting classes.
include_once 'class-htl-privacy-erasers.php';
include_once 'class-htl-privacy-exporters.php';
$this->init();
}
/**
* Hook in events.
*/
protected function init() {
add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 5 );
add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) );
$this->add_exporter( 'hotelier-guest-reservations', __( 'Guest Reservations', 'wp-hotelier' ), array( 'HTL_Privacy_Exporters', 'reservation_data_exporter' ) );
$this->add_eraser( 'hotelier-guest-reservations', __( 'Guest Reservations', 'wp-hotelier' ), array( 'HTL_Privacy_Erasers', 'reservation_data_eraser' ) );
// Handles custom anonomization types not included in core.
add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 );
}
/**
* Integrate this exporter implementation within the WordPress core exporters.
*
* @param array $exporters List of exporter callbacks.
* @return array
*/
public function register_exporters( $exporters = array() ) {
foreach ( $this->exporters as $id => $exporter ) {
$exporters[ $id ] = $exporter;
}
return $exporters;
}
/**
* Integrate this eraser implementation within the WordPress core erasers.
*
* @param array $erasers List of eraser callbacks.
* @return array
*/
public function register_erasers( $erasers = array() ) {
foreach ( $this->erasers as $id => $eraser ) {
$erasers[ $id ] = $eraser;
}
return $erasers;
}
/**
* Add exporter to list of exporters.
*
* @param string $id ID of the Exporter.
* @param string $name Exporter name.
* @param string $callback Exporter callback.
*/
public function add_exporter( $id, $name, $callback ) {
$this->exporters[ $id ] = array(
'exporter_friendly_name' => $name,
'callback' => $callback,
);
return $this->exporters;
}
/**
* Add eraser to list of erasers.
*
* @param string $id ID of the Eraser.
* @param string $name Exporter name.
* @param string $callback Exporter callback.
*/
public function add_eraser( $id, $name, $callback ) {
$this->erasers[ $id ] = array(
'eraser_friendly_name' => $name,
'callback' => $callback,
);
return $this->erasers;
}
/**
* Handle some custom types of data and anonymize them.
*
* @param string $anonymous Anonymized string.
* @param string $type Type of data.
* @param string $data The data being anonymized.
* @return string Anonymized string.
*/
public function anonymize_custom_data_types( $anonymous, $type, $data ) {
switch ( $type ) {
case 'phone':
$anonymous = preg_replace( '/\d/u', '0', $data );
break;
case 'numeric_id':
$anonymous = 0;
break;
}
return $anonymous;
}
}
endif;
new HTL_Privacy();
