| Server IP : 3.147.158.171 / Your IP : 216.73.216.88 Web Server : Apache/2.4.67 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-2-178.us-east-2.compute.internal 6.1.172-216.329.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 20 06:31:34 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.21 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /tsai/repo/.git/objects/pack/ |
Upload File : |
PACK ��x� �tree 367fd0da2cdbf2e883cb8cf7fe2e8d7e281d06d0
parent 7ae358b22714babb95f4d93c864773e26dcba3c0
author John Turman <jturman87@gmail.com> 1766802248 -0600
committer John Turman <jturman87@gmail.com> 1766802248 -0600
add complianz
T;Eːx���Mn1@�}N�+���9�bͺ�ĞB�$(��G���I�
U(�k�U9P�$4W����E�I�����<�xf� ��5/5�Rg�k�Ò5�).��v�����96np���(x��z��};9#b��)O�{��j���Nz�<~Zac�/�Y:Ik���ɕ0I�!�PҬ3
�|�x�{��iB�H����.��(��Z:頼q��� ���=x ����1er+��>��ܾ�������E$�N^�x�31 �����Լ����^��[=��*9G�{�,���mV�V��WR����}�����ʃ}�ߘ
�LL���K�3����5zf�Ϯ��N�Ʃ�rjgh� ��.V�;a�=�+�-'�V7~ x��Ƹ�q�"��i%�u�CR���tU';�� ��
�1�]hP��:�PW�kxw;z��x� ����n��Q��g�$�ʼn�̥�'�O�?��#ɤ}�b�J�GY��]τO.��x�; sHf�6F�Ɂ<��7��m>�V� ]����
m)��.�\6p8��:�x ���T0�`�K{L�s~�!{���7���h��J
�������b� ߿� L��J�x! �����r��6$ᖖ�4�R���;�[�������xh ��100644 index.php b (��-�]�X�u��Me��40000 plugins 7.��_�F�2J��HϤ'��40000 themes �3G�0���T6lj�=��[�*Ыx� t�40000 complianz-gdpr ��Yf�������&Pw4100644 index.php b (��-�]�X�u��Me��40000 jwt-authentication-for-wp-rest-api ����n#x�k0H�@�a86R�ޞh8%�dxL��40000 DNSMPD ��d�ۤ!
�]����;r�?100644 LICENSE.txt �'t��]B�3�"����( �40000 assets �>6��e�:�=���~���100644 class-admin.php 8����
�aޯ!��~^�100644 class-company.php �P%�
W�'��~�Nޑ�b100644 class-cookie-blocker.php � �x|,�s��Dg�?i3�100644 class-document.php o
0�P\�')���M�jѐ
a100644 class-export.php �b�b�L��M�baF#��+�100644 class-field.php �: �W2D�'a��b4�%�`~100644 class-installer.php ۋ�&�c�)�#�*�<��2100644 class-review.php �oN�����)�?�zw��T100644 class-wizard.php f��^���s�%�j�u�%�100644 complianz-gpdr.php ��ɠ�NSFT����}3�100644 composer.json � �1���*��=��=�~40000 config ��˰���#��H���&�40000 cookie �]
Z�ޑ����L�x�940000 cookiebanner ��W�-ޅ�
�;���;%�o�%40000 cron ����I���4GGA+m�ao40000 documents �#i��i[5�\
���B�100644 functions-legacy.php ��
('��l�?b+xn�1�e �100644 functions.php ����҈��&�Tp�I��100644 gulpfile.js ����Բ�DS�9�|P
V��40000 gutenberg &�1A�-�Ȣiw%T����j100644 index.php b (��-�]�X�u��Me��40000 integrations ;m�6[{k!������Q�40000 languages u�ŋ$mW��X3�100644 loco.xml r����g����B���aٙB40000 mailer g^ɼ��y� k=&.40000 onboarding |��� �eDbF�\� cC)B40000 placeholders Y��Z�(q���s�sX�'T
40000 progress g%)��H������4F��`i40000 proof-of-consent M6�|��!_�������100644 readme.txt y�?�Cg>�B� MAQGJ�40000 rest-api /�,�,hk2�"J��(��40000 settings !9���A'ϧտ3g#�b�t100644 system-status.php ���j �ƥ�"/��L�3t40000 templates 2u�"��hj�L4��ȶ#g�100644 uninstall.php �!��Əj��X�[�\�E8��100644 upgrade.php �F^7�� �f�'�� �V�40000 upgrade lVi���Cs-$+6+-��40000 websitescan 4h���KucQ���
'�W%��c�
x� .�100644 class-DNSMPD.php k�������-�"d ��100644 class-admin-DNSMPD.php "�g����� D���Z@�100644 index.php b (��-�]�X�u��Me��100644 script.js ���1 �d=�����.fko 100644 script.min.js ��J�f|Q�4�OJ/��1�St��x�(_�<?php
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
if ( ! class_exists( "cmplz_DNSMPD" ) ) {
class cmplz_DNSMPD {
private static $_this;
function __construct() {
if ( isset( self::$_this ) ) {
wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.',
get_class( $this ) ) );
}
self::$_this = $this;
if ( cmplz_has_region('us') ) {
add_shortcode( 'cmplz-dnsmpi-request', array($this, 'datarequest_form') );
}
add_action( 'rest_api_init', array($this, 'register_rest_route') );
add_filter( 'cmplz_datarequest_options', array( $this, 'datarequest_options' ), 20 );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) );
}
static function this() {
return self::$_this;
}
/**
* Enqueue front-end assets
* @param $hook
*/
public function enqueue_assets( $hook ) {
global $post;
if ( $post && isset($post->ID) && !COMPLIANZ::$document->is_complianz_page($post->ID ) ) {
return;
}
if ( !cmplz_has_region('us') && !cmplz_datarequests_active() ) {
return;
}
$v = filemtime(CMPLZ_PATH . "DNSMPD/script.min.js");
wp_enqueue_script( 'cmplz-dnsmpd', CMPLZ_URL . "DNSMPD/script.min.js", array( 'jquery' ), $v, true );
wp_localize_script(
'cmplz-dnsmpd',
'cmplz_datarequests',
array(
'url' => get_rest_url(null, 'complianz/v1/datarequests'),
)
);
}
/**
* Extend options with generic options
*
* @param array $options
*
* @return array
*/
public function datarequest_options( array $options = [] ): array {
$options += [
"global_optout" => [
'slug' => 'definition/what-is-global-opt-out',
'short' => __( 'Global opt-out', 'complianz-gdpr' ),
'long' => __( 'Global opt-out from selling and sharing my personal information and limiting the use or disclosure of sensitive personal information.', 'complianz-gdpr' ),
],
"cross_context" => [
'slug' => 'definition/what-is-cross-context-behavioral-advertising/',
'short' => __( 'Do not sell my info', 'complianz-gdpr' ),
'long' => __( 'Do not sell my personal information for cross-context behavioral advertising', 'complianz-gdpr' ),
],
"limit_sensitive" => [
'slug' => 'definition/what-is-limit-sensitive-data/',
'short' => __( 'Limit sensitive data', 'complianz-gdpr' ),
'long' => __( 'Limit the use of my sensitive personal information', 'complianz-gdpr' ),
],
"request_for_access" => [
'slug' => 'definition/what-is-the-right-to-access/',
'short' => __( 'Request for access', 'complianz-gdpr' ),
'long' => __( 'Request for access', 'complianz-gdpr' ),
],
"right_to_be_forgotten" => [
'slug' => 'definition/right-to-be-forgotten/',
'short' => __( 'Right to be Forgotten', 'complianz-gdpr' ),
'long' => __( 'Right to be Forgotten', 'complianz-gdpr' ),
],
"right_to_data_portability" => [
'slug' => 'definition/right-to-data-portability/',
'short' => __( 'Right to Data Portability', 'complianz-gdpr' ),
'long' => __( 'Right to Data Portability', 'complianz-gdpr' ),
],
];
return $options;
}
/**
* Send confirmation mail
*
* @param string $email
* @param string $name
*
* @return void
*/
private function send_confirmation_mail( $email, $name ) {
$message = cmplz_get_option( 'notification_email_content' );
$subject = cmplz_get_option( 'notification_email_subject' );
$message = str_replace( '{name}', $name, $message );
$message = str_replace( '{blogname}', get_bloginfo( 'name' ), $message );
$this->send_mail( $email, $subject, $message );
}
/**
* Send confirmation mail
*
* @return void
*/
private function send_notification_mail( ) {
$email = sanitize_email( apply_filters('cmplz_datarequest_email',get_option( 'admin_email' )) );
$subject = cmplz_sprintf(__("You have received a new data request on %s", "complianz-gdpr") , get_bloginfo( 'name' ) );
$message = $subject.'<br />'.cmplz_sprintf(__("Please check the data request on %s", "complianz-gdpr"), '<a href="'.site_url().'" target="_blank">'.site_url().'</a>');
$this->send_mail( $email, $subject, $message );
}
/**
* Send an email
* @param string $email
* @param string $subject
* @param string $message
*
* @return bool
*/
private function send_mail( $email, $subject, $message ) {
$headers = [];
$from_name = get_bloginfo( 'name' );
$from_email = cmplz_get_option( 'notification_from_email' );
add_filter( 'wp_mail_content_type', function ( $content_type ) {
return 'text/html';
} );
if ( ! empty( $from_email ) ) {
$headers[] = 'From: ' . $from_name . ' <' . $from_email . '>'
. "\r\n";
}
$success = true;
if ( wp_mail( $email, $subject, $message, $headers ) === false ) {
$success = false;
}
// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
return $success;
}
/**
* Register the rest route
*
* @return void
*/
public function register_rest_route()
{
register_rest_route('complianz/v1', 'datarequests/', array(
'methods' => 'POST',
'callback' => array($this, 'process_restapi_datarequest'),
'args' => array(),
'permission_callback' => '__return_true',
));
}
/**
* Process the form submit
*
* @param WP_REST_Request $request
*
* @return array
*/
public function process_restapi_datarequest( WP_REST_Request $request ) {
$params = $request->get_json_params();
$new_request = false;
$error = false;
$message = "";
//check honeypot
if ( isset($params['cmplz_datarequest_firstname']) && ! empty( $params['cmplz_datarequest_firstname'] ) ) {
$error = true;
$message = __( "Sorry, it looks like you're a bot", 'complianz-gdpr' );
}
if ( ! isset($params['cmplz_datarequest_email']) || ! is_email( $params['cmplz_datarequest_email'] ) ) {
$error = true;
$message = __( "Please enter a valid email address.", 'complianz-gdpr' );
}
if ( ! isset($params['cmplz_datarequest_name']) || empty( $params['cmplz_datarequest_name'] ) ) {
$error = true;
$message = __( "Please enter your name", 'complianz-gdpr' );
}
if ( strlen( $params['cmplz_datarequest_name'] ) > 100 ) {
$error = true;
$message = __( "That's a long name you got there. Please try to shorten the name.", 'complianz-gdpr' );
}
if ( ! isset($params['cmplz_datarequest_region']) || empty( $params['cmplz_datarequest_region'] ) ) {
$region = 'us';
}
if ( ! $error ) {
$email = sanitize_email( $params['cmplz_datarequest_email'] );
$name = sanitize_text_field( $params['cmplz_datarequest_name'] );
$region = sanitize_title( $params['cmplz_datarequest_region'] );
//check if this email address is already registered:
global $wpdb;
$options = apply_filters( 'cmplz_datarequest_options', [] );
foreach ( $options as $fieldname => $label ) {
$value = isset( $params['cmplz_datarequest_'.$fieldname] ) ? intval( $params['cmplz_datarequest_'.$fieldname] ) : false;
if ( $value === 1 ) {
$count = $wpdb->get_var( $wpdb->prepare( "SELECT count(*) from {$wpdb->prefix}cmplz_dnsmpd WHERE email = %s and $fieldname=1", $email ) );
if ( $count == 0 ) {
$new_request = true;
$wpdb->insert( $wpdb->prefix . 'cmplz_dnsmpd',
array(
'name' => $name,
'email' => $email,
'region' => $region,
$fieldname => $value,
'request_date' => time()
)
);
}
}
}
if ( $new_request ) {
$this->send_confirmation_mail( $email, $name );
$this->send_notification_mail();
$message = __( "Your request has been processed successfully!", 'complianz-gdpr' );
} else {
$message = __( "Your request could not be processed. A request is already in progress for this email address or the form is not complete.", 'complianz-gdpr' );
$error = true;
}
}
return array(
'message' => $message,
'success' => ! $error,
);
}
/**
* Render the form in the shortcode
*
* @return false|string
*/
public function datarequest_form() {
ob_start();
?>
<div class="cmplz-datarequest cmplz-alert">
<span class="cmplz-close">×</span>
<span id="cmplz-message"></span>
</div>
<form id="cmplz-datarequest-form">
<input type="hidden" required value="us" name="cmplz_datarequest_region" id="cmplz_datarequest_region">
<label for="cmplz_datarequest_firstname" class="cmplz-first-name"><?php echo esc_html(__('Name','complianz-gdpr'))?><input type="search" class="dnsmpd-firstname" value="" placeholder="your first name" id="cmplz_datarequest_firstname" name="cmplz_datarequest_firstname"></label>
<div>
<label for="cmplz_datarequest_name"><?php esc_html_e(__('Name','complianz-gdpr') )?></label>
<input type="text" required value="" placeholder="<?php echo esc_html(__('Your name','complianz-gdpr') )?>" id="cmplz_datarequest_name" name="cmplz_datarequest_name">
</div>
<div>
<label for="cmplz_datarequest_email"><?php esc_html_e(__('Email','complianz-gdpr'))?></label>
<input type="email" required value="" placeholder="email@email.com" id="cmplz_datarequest_email" name="cmplz_datarequest_email">
</div>
<?php
$options = $this->datarequest_options();
foreach ( $options as $id => $label ) { ?>
<div class="cmplz_datarequest cmplz_datarequest_<?php echo esc_attr($id)?>">
<label for="cmplz_datarequest_<?php echo esc_attr($id)?>">
<input type="checkbox" value="1" name="cmplz_datarequest_<?php echo esc_attr($id)?>" id="cmplz_datarequest_<?php echo esc_attr($id)?>"/>
<?php echo esc_html($label['long'])?>
</label>
</div>
<?php } ?>
<input type="button" id="cmplz-datarequest-submit" name="cmplz-datarequest-submit" value="<?php esc_html_e(__('Send','complianz-gdpr'))?>">
</form>
<style>
/* first-name is honeypot */
.cmplz-first-name {
position: absolute !important;
left: -5000px !important;
}
</style>
<?php
return ob_get_clean();
}
} //class closure
}
J�uནx=9��<?php
defined( 'ABSPATH' ) or die( "you do not have access to this page!" );
if ( ! class_exists( "cmplz_admin_DNSMPD" ) ) {
class cmplz_admin_DNSMPD {
private static $_this;
function __construct() {
if ( isset( self::$_this ) ) {
wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.',
get_class( $this ) ) );
}
self::$_this = $this;
add_filter( 'cmplz_do_action', array( $this, 'get_datarequests_data' ), 10, 3 );
add_action( 'cmplz_install_tables', array( $this, 'update_db_check' ), 10 );
add_filter( 'cmplz_warning_types', array($this, 'new_datarequests_notice') );
}
static function this() {
return self::$_this;
}
public function sanitize_status($status){
$statuses = array('open', 'resolved', 'all');
if (in_array($status, $statuses)) return $status;
return 'open';
}
/**
* Get a list of processors
* @param array $data
* @param string $action
* @param WP_REST_Request $request
*
* @return []
*/
public function get_datarequests_data($data, $action, $request){
if ( ! cmplz_user_can_manage() ) {
return [];
}
if ( $action==='get_datarequests' ){
$data = $request->get_params();
$per_page = $data['per_page'] ?? 10;
$page = $data['page'] ?? 1;
$search = $data['search'] ?? false;
$order = $data['order'] ?? 'ASC';
$orderby = $data['orderBy'] ?? 'id';
$status = $data['status'] ?? 'open';
$offset = $per_page * ( $page - 1 );
$args = array(
'number' => $per_page,
'offset' => $offset,
'order' => $order,
'orderby' => $orderby,
'status' => $this->sanitize_status( $status)
);
if ( is_email( $search ) ) {
$args['email'] = $search;
} else {
$args['name'] = $search;
}
$records = $this->get_requests( $args );
foreach ($records as $key => $record ) {
$records[ $key ]->type = $this->get_request_type( $record );
$records[ $key ]->request_date = $this->format_request_date( $record->request_date );
}
$open_args = $args;
$open_args['status'] = 'open';
$data = [
'records' => $records,
'totalRecords' => $this->count_requests($args),
'totalOpen' => $this->count_requests($open_args),
];
return $data;
} else if ($action==='delete_datarequests') {
$records = $request->get_param('records');
foreach ($records as $record) {
$this->delete($record['ID']);
}
$data = [];
} else if ($action==='resolve_datarequests') {
$records = $request->get_param('records');
foreach ($records as $record) {
$this->resolve($record['ID']);
}
$data = [];
} else if ( $action === 'export_datarequests' ) {
$data = $request->get_params();
$dateStart = $data['startDate'] ?? false;
$dateEnd = $data['endDate'] ?? false;
$statusOnly = $data['statusOnly'] ?? false;
$data = $this->run_export_to_csv($dateStart, $dateEnd, $statusOnly);
}
return $data;
}
private function get_request_type($record){
$options = COMPLIANZ::$DNSMPD->datarequest_options();
if ($record->global_optout) {
return isset($options['global_optout']) ? $options['global_optout'] : '';
}
if ($record->limit_sensitive){
return isset($options['limit_sensitive']) ? $options['limit_sensitive'] : '';
}
if ($record->cross_context){
return isset($options['cross_context']) ? $options['cross_context'] : '';
}
//deprecated
if ($record->request_for_access ) {
return isset($options['request_for_access']) ? $options['request_for_access'] : '';
}
if ($record->right_to_be_forgotten){
return isset($options['right_to_be_forgotten']) ? $options['right_to_be_forgotten'] : '';
}
if ($record->right_to_data_portability){
return isset($options['right_to_data_portability']) ? $options['right_to_data_portability'] : '';
}
}
/**
* Add new datarequests
*
* @param array $warnings
*
* @return array
*/
public function new_datarequests_notice($warnings){
$warnings['new_datarequest'] = [
'warning_condition' => 'admin_DNSMPD->has_open_requests',
'include_in_progress' => true,
'plus_one' => true,
'open' => __( 'You have open data requests.', 'complianz-gdpr' ).' '.cmplz_sprintf(__( 'Please check the data requests <a href="%s">overview page</a>.', 'complianz-gdpr' ), add_query_arg(array('page'=>'complianz#tools/data-requests'),admin_url('admin.php'))),
'dismissible' => false,
];
return $warnings;
}
/**
* Check if there are open requests
*
* @return bool
*/
public function has_open_requests(){
$has_requests = false;
if ( cmplz_has_region('us') || cmplz_datarequests_active() ) {
global $wpdb;
$count = $wpdb->get_var( "SELECT count(*) from {$wpdb->prefix}cmplz_dnsmpd WHERE NOT resolved = 1" );
$has_requests = $count > 0;
}
return $has_requests;
}
/**
* Get users or count users
* @param array $args
* @param string $type the type of query to be run (SELECT or COUNT)
*
* @return array|int
*/
public function get_requests( $args, $type = "SELECT" ) {
global $wpdb;
$defaults = array(
'number' => false,
'offset' => 0,
'order' => 'DESC',
'orderby' => 'request_date',
'start_date' => 0,
'end_date' => false,
'search' => false,
'status' => 'all'
);
$args = wp_parse_args( array_filter($args), $defaults );
// Build the base SQL query
$select_clause = $type === "COUNT" ? "SELECT COUNT(*)" : "SELECT *";
$sql = $select_clause . " from {$wpdb->prefix}cmplz_dnsmpd WHERE request_date>0 ";
$sql .= $args['end_date'] ? $wpdb->prepare( " AND request_date> %s AND request_date < %s", (int) $args['start_date'], (int) $args['end_date'] ) : "";
$sql .= $args['search'] ? " AND (name like='%".esc_sql( $args['search'])."%' OR email like='%".esc_sql( $args['search'])."%' )" : "";
//$sql .= isset($args['resolved']) ? $wpdb->prepare( " AND resolved = %d ", (int) $args['resolved'] ) : "";
if ( 'all' !== $args['status'] ) {
$sql .= $wpdb->prepare( " AND resolved = %d ", $args['status']==='resolved' ? 1 : 0 );
}
// Only add ORDER BY and LIMIT for SELECT queries, not COUNT queries
if ( $type === "SELECT" ) {
$limit = (int) $args['number'];
$orderby = $args['orderby'] ?? 'ID';
$order = $args['order'] ?? 'ASC';
$orderby = sanitize_title( $orderby );
$order = sanitize_title( $order );
$sql .= " ORDER BY " . esc_sql( $orderby ) . " " . esc_sql( $order );
$sql .= $limit>0 ? " LIMIT " . (int) $limit . " OFFSET " . (int) $args["offset"] : '';
return $wpdb->get_results( $sql );
} else {
// For COUNT queries, return the count as integer
return (int) $wpdb->get_var( $sql );
}
}
/**
* Count number of users
* @param $args
*
* @return int
*/
public function count_requests( $args ) {
unset( $args['number'] );
return $this->get_requests( $args, "COUNT" );
}
/**
* Handle resolve request
*
* @param int $id
*/
public function resolve(int $id): void {
if ( !cmplz_user_can_manage() ) {
return;
}
global $wpdb;
$wpdb->update( $wpdb->prefix . 'cmplz_dnsmpd',
array(
'resolved' => 1
),
array( 'ID' => (int) $id )
);
}
/**
* Handle delete request
* @param int $id
*/
public function delete($id): void {
if ( !cmplz_user_can_manage() ) {
return;
}
global $wpdb;
$wpdb->delete( $wpdb->prefix . 'cmplz_dnsmpd', array( 'ID' => (int) $id ) );
}
/**
* Export all records in the current selection to a csv file
*/
public function run_export_to_csv($dateStart, $dateEnd, $statusOnly = false ){
$page_batch = 500;
if ( ! cmplz_user_can_manage() ) {
return [];
}
$offset = get_option( 'cmplz_current_datarequest_export_offset' ) ?: 0;
if ( $statusOnly ) {
$progress = get_option( 'cmplz_current_datarequest_export_progress' ) ?: 100;
$total = 1;
} else {
if ($offset===0) {
//cleanup old file
$file = $this->filepath();
if ( file_exists($file) ){
unlink($file);
}
}
$args = array(
'number' => $page_batch,
'offset' => $offset * $page_batch,
'start_date' => strtotime($dateStart),
'end_date' => strtotime($dateEnd),
);
$offset++;
$pages_completed = $offset * $page_batch;
update_option('cmplz_datarequest_export_args', $args, false );
update_option('cmplz_current_datarequest_export_offset', $offset , false );
$total = $this->count_requests( $args );
if ($total>0) {
$data = $this->get_requests($args);
$add_header = $offset==1;
$this->create_csv_file( $data, $add_header);
$progress = 100 * ($pages_completed/$total);
$progress = $progress>100 ? 100 : $progress;
} else {
$progress = 100;
}
update_option('cmplz_current_datarequest_export_progress', $progress, false );
}
if ( $progress === 100 ) {
delete_option('cmplz_current_datarequest_export_offset' );
delete_option('cmplz_datarequest_export_args');
}
return array(
'progress' => round($progress, 0),
'exportLink' => $this->fileurl(),
'noData' => $total ===0,
);
}
/**
* create csv file from array
*
* @param array $data
* @param bool $add_header
* @throws Exception
*/
private function create_csv_file($data, $add_header = true ){
$delimiter=",";
require_once(ABSPATH . 'wp-admin/includes/file.php');
$upload_dir = cmplz_upload_dir();
//generate random filename for storage
if ( !get_option('cmplz_datarequest_file_name') ) {
$token = str_shuffle ( time() );
update_option('cmplz_datarequest_file_name', $token, false );
}
$filename = get_option('cmplz_datarequest_file_name');
//set the path
$file = $upload_dir .$filename.".csv";
//'a' creates file if not existing, otherwise appends.
$csv_handle = fopen ($file,'a');
//create a line with headers
if ( $add_header ) {
$headers = $this->parse_headers_from_array( $data );
fputcsv( $csv_handle, $headers, $delimiter );
}
if ( is_array($data) ) {
foreach ( $data as $line ) {
$date = $this->localize_date($line->request_date);
$line = array_values(get_object_vars($line));
$line = array_map( 'sanitize_text_field', $line );
$line[] = $date;
fputcsv( $csv_handle, $line, $delimiter );
}
}
fclose ($csv_handle);
}
/**
* Get headers from an array
* @param array $array
*
* @return array|bool
*/
private function parse_headers_from_array($array){
if (!isset($array[0])) return array();
$array = $array[0];
//parse object property names from object
$headers = array_keys(get_object_vars($array));
$options = COMPLIANZ::$DNSMPD->datarequest_options();
foreach ($headers as $key => $header) {
if (isset($options[$header])) {
$headers[$key] = $options[$header]['short'];
}
}
$headers[] = __("Date","complianz-gdpr");
return $headers;
}
/**
* Format request date with proper validation
*
* @param mixed $request_date
* @param bool $include_time Whether to include time in the format
*
* @return string
*/
public function format_request_date($request_date, $include_time = false): string {
if (empty($request_date) || $request_date == 0) {
return __('No date available', 'complianz-gdpr');
}
$timestamp = (int) $request_date;
// Get WordPress date format, fallback to default if empty
$date_format = get_option('date_format');
if (empty($date_format)) {
$date_format = 'F j, Y';
}
// For CSV export, use a more compact format
if ($include_time) {
$time_format = get_option('time_format');
if (empty($time_format)) {
$time_format = 'g:i a';
}
$formatted_date = date_i18n($date_format, $timestamp) . ' at ' . date_i18n($time_format, $timestamp);
// Fallback if date_i18n fails
if (empty($formatted_date) || $formatted_date === ' at ') {
$formatted_date = date($date_format, $timestamp) . ' at ' . date($time_format, $timestamp);
}
// Final fallback
if (empty($formatted_date) || $formatted_date === ' at ') {
$formatted_date = date('Y-m-d H:i:s', $timestamp);
}
} else {
// For API responses, just date
$formatted_date = date_i18n($date_format, $timestamp);
if (empty($formatted_date)) {
$formatted_date = date($date_format, $timestamp);
}
if (empty($formatted_date)) {
$formatted_date = date('Y-m-d', $timestamp);
}
}
return $formatted_date;
}
/**
* Get a localized date for this row (for backward compatibility)
*
* @param int $unix
*
* @return string
*/
public function localize_date(int $unix): string {
return $this->format_request_date($unix, true);
}
/**
* Get a filepath
* @return string
*/
private function filepath(){
$upload_dir = cmplz_upload_dir();
return $upload_dir .get_option('cmplz_datarequest_file_name').".csv";
}
/**
* Get a file URL
* @return string
*/
private function fileurl(){
if ( file_exists($this->filepath() ) ) {
return untrailingslashit( cmplz_upload_url( get_option('cmplz_datarequest_file_name').".csv" ) ) . '?' . time();
}
return '';
}
/**
* Check if the table needs to be created or updated
* @return void
*/
public function update_db_check() {
//only load on front-end if it's a cron job
if ( !is_admin() && !wp_doing_cron() ) {
return;
}
if (!wp_doing_cron() && !cmplz_user_can_manage() ) {
return;
}
if ( get_option( 'cmplz_dnsmpd_db_version' ) != CMPLZ_VERSION ) {
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'cmplz_dnsmpd';
$sql = "CREATE TABLE $table_name (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`region` TEXT NOT NULL,
`global_optout` int(11) NOT NULL,
`cross_context` int(11) NOT NULL,
`limit_sensitive` int(11) NOT NULL,
`request_for_access` int(11) NOT NULL,
`right_to_be_forgotten` int(11) NOT NULL,
`right_to_data_portability` int(11) NOT NULL,
`request_date` int(11) NOT NULL,
`resolved` int(11) NOT NULL,
PRIMARY KEY (ID)
) $charset_collate;";
dbDelta( $sql );
update_option( 'cmplz_dnsmpd_db_version', CMPLZ_VERSION, false );
}
}
} //class closure
}
y��yx��U�O�0~N�
�=$-��y��0�����$���\�ñ3�)�����NRZڔ��*��}���kt8�рKm�|�&��a͘!</�����I�VdD2����J0�$p�Mڣ�� c�@�u�
�`i��?�#1%�{#R��BAF�dGѦeYv:C��:P�����7$�Rq'�J���=K�ܥZWI����d֓(� AB���ZıWd@��$�V���6��ӆ u�/��u��z��_*��d���zSVJ���Vt���k>�O����s������ �&?����p8-�gJ@������/�}PG���V8٢��+��6�C�I}��>Ic;j?�v=��߿=jڧ��M�L��!ڳ�
�F �8�� ����;��/˛�%�ދw+m�5�r,��O���>p>!�����~`�[���ς�R�}|u�3a���*�(�O�me�Xes�����,��߁����o���\]�68��
�B+��"p�-솯��مrV���R���z
��X׀{��u���ұ6r���㪤Bᴟ]_�#��ژ�uڥ͖���5[���voɷ�d�����z��(�M�KW.�ֿa�=b��Dj����$T��h�*�i���q�6���N2[��(w7�E���?~�?�E�W���fx��T�o�0�Wh����y�Շ��(L��IU��}�W��l�E��焄X;^��}w��ߎ���{ɤ��\��iE�fi��_)�l��&p�q�o���P �
j�
�H��n��*k����kƔ�O=ց��I�^��:U� �B����8���jغL��&�f$PZAP�B�����*�_�}�T7:8�k9 �Tp�|C �r���uk�J�hwF��]�������d�\�.��N@����|�0�9t&���I�R y�2�>�]����Z�8@�q���e
�iX+��KN�<����ip��S�Ê��L�e B���ү�]c�4�?7���+
���6���r�_���t�2I0h����r�Z���\
�x�u>��m5Bm�:/Ԇ���x>�u��R��z�=�<祧o��.�����p�D+���ߙ��A����W7�?OI��U�ҽ����`-�+���Op�x���(��e��Φ�y5�߿�}�'jSd�Z[^߫X��*��qmα��4����,�Jjd��P\�q=0P�G� -�oa՟��W_����?�dx��x��\[s�ƕ~N��.��Tő��ec��*J�FL4�LR3�[@�)"\4 ��~�si������Ǥ�x� �O��w.��2�v]�e����t�bQm��]�mQ�Y����S_�鴮�M+����Ү�y���P�sW�j�l�ʕ�ł�����~t�+��>��,��t�r�l�}��ts;�z��v����I���u)���͕���Z��9M*"��Ś>:�[�%U�ݹ1�����4�5���Xb5l�f��:[{��������pr��<�����?�&/�x�Zx�ޜ����Y�eq�2ɫ-h6���;�߿�'/ ��'����>�l�>�G���}d��GO���cG9�
v.X���UI�y��� )��e�� ęK�@Pbg�z��22IV�|0����Ҧ�U�n�
QvOz��^���y���$��|���t��o��({������o�..����/�}��1����[|���`Կ����<��Z�9�N��Ν���c���2}]V������?9��z�=
^�Ɖ��yP�m��0��"�Y,��H+Iu��xES�
K
f*�y1�W.��e���T/AH6ɲb��P�?��t�j�9���<�j,�&�I>}ͅ�*��7ɖ-̐��+z�>���=@c���7��ă��Zf���4�<o�Z'd.�>g&��=^Y��.�^���F?@�'�.=H%�`�9�5���͙?j2�4���8��i�컂��,Z���(=�����
$�����ώ�a�p�j�Qb���8�1w��r������t֭Z��J�� ���e ǶW�.�J���="rJ�peIg��Uz=�D�.�;��X���)^,P�3R��`�N�賧�8�+�a+�ް594�u���^�Up�X�.g��ܑ�&v�:�&|��_�O�Uӎ*�sh��3���m�6Bo�hPX�k^l�u��p=�>����a�f٥y�I�"N���4#�8X1M�zJ�X�r�r�BV"�I��WyT�LJ�D}y�܊����)��s%�
���t�fi�������<c>R�RB�c`��u�&�xE�\�׳%"���Z:�7��U)����]8,Ļ�p ���4#�R9XC��s��������d˦�k�,R-
���a�>ԡ�q}Cfl"0��[Q�)-M���i��
�Y���ў^�q����8Ҝ~8�`�"Q$�,S��8�a�^a��<G^�p�X�$��4�3�\B�b��·�Кd$8��:[aPuU5��v!�2P�>�ć�E��hK>['�@��^`a�Sv��}�h�y� �^�D�Q/�c��*.� �!�M#8�X@ i�d=�!G��F ��8��ż� 9�`WZ .9#�yg-�A�^X��R�[z�m{�E씈�j �h��ቓ��]��WZ�s�Q�s��w��O,�Q^A�f�˛`IGH�y���k"�Sv �Iaz��r�v��g�.�"� �[���, �W,dV�*�sz3�\��z 1�i�梘�X�a�o���潄Aع��5ɾ�X�I�'��V$���m��Ѵ���EA���w2}#M��7����A��ǧ���Ǟ��'���3=�?=�o��}������C�~�^P-`eS�_�����I�c�Y��Ij�:�e�Q��V��
0|�R3s0�a�a�:gO���`cf�c��|��z�r��>�4���jf��BJ=�5h]���AJ�(^E�o�%�ņS�'Ƕ�M���]%��ACϴ9�$t�汚��`�(Li.��%f2Xc���N�� a����|@2B�e5!��f)p�>�M��=�w?!|9 ��.-��K�n1���\=��@�B�J �-tɠ� f�E;T.ť2��+���#Zb��* yDž)�|����q�"3^
~�_��OL�ȋ�@��7$ٲ�gǙV�잢���)�[��9���"�8�]�y��s�ꁉ�deM����K�3�!�#�q.p%��\4`2]䝏 7���Ӝ�c�_r����]�r
1f������þ��_�bDG`D�D�o������!fY������ܚ��8��g>D(�:\��$wt�d�]�](v�l�҆�a�ئ�Q�ﲮS�i��`�����R�|�a��8����42�j1吔�N涺J�p���Cڢ �kH�<9Z�Q$��ə�����z5#^
o�WB�Q7���)ZCJv�]'��P�r�G�0�6{@+� �+�DE��Eq�Gc���ϒ�K��`�E�I���R���Z��x�l�!d.�����יS.��&oAӽ�Y��͒���%MY��7���UY5!����,;�Ni���ł�V�7H��Щ��R(b�K�9�@�r,ڇ�n��,@��!���F���s)�0ڧS�P��'�a�D�<��N�F:�!���e��Z&Z�ព��@T�AK��܁���wI� "e�gȋ>��vXY�;~��c�z�o�.��J3��+�j䯚
D^>k�\c��ٟ(gY,fW�5�,q������-u��fZ�v:�u���HA�v+�E(~�&C��Cr#ia�d�bZ���u��9��NK)��j;��������$�碙��Fy�V�9o4)�q<O��Y�:�<�̏?s��zT�D0%:_�X�K��jJw-d����Q�:�^��
�}���Zr��5-&�������ܞ�@\j�gK��-\�H���T�����c>YE\��yN�kHV��NL0�1��c�5��!�ӯ�s1]H���[HZ&<�X��_�d��7$�R� ��f�/������t�I9�Og��#��+� >�E�{n%1pl���� ���H��W&���5I�J�4 �3����K)-�[qfbܯ��l5Է��CՆ� ��ܧ(��2*<�L���8�0�� ��ʊ�Z�J\
�j�"� �Z��%����7���=�oEVS�}�諢DN�n�=� W�8�i\^D]�%%�8���m��{�]�)���ˇ3
B��_T�Ej�nVW�mN�f��i�`C@pT�R����/�?C�]�ʁ~��RJ��V� ������8o詥[����7�#�HU\3�T��2��סn�V�(����z��O�4���gߒ,�������Ҙ3[���3i�?�6�mOq����-g��Z�i�)�x
o��Xke���r����
��sFk�w���wy=;�9iNG���H�nYf��s�6���d�!,��Q��\�� 2��C�Ww�<����$��!�I&�6Qf>�R_��z|�T����ӉZ��AJRB�߄��&��K���h7=��x�H>&XJb���w�-C�c�.��MjJ\�6�@z�՞Ӆ�b���T<!�v�4O��II��/L�ҷ��kB"�R-T1x��t�%q�oO�S�A�o�tBhƯK�$��;Ol�M#߯1j�q���4�4��2g�����єSCr:k5����
Z��TNH��L �'w|�'4�4�d�~�+ 0��#힟�p��}0��VF1w�ɕ�.��{1?Z��R����B+:�3X���qƸ��|Y�N��4|e t���;�i_ �)y1<��{sv<�����2�۩���ʸZ#ۉF6�Ev*63��?���TH
1R0A��%�0�tQSR]��ʨ��h�>;B�7�Tb]�)t����N��8��ܛIj�F*
)I��c<@�i�0p�PpwLI�F̌��f�R8 +��5ݮ0���KC�
ˈ2r �t�X�u&n%K�ܟEp!?��E��u��D��J�� �Z�#
�g���e�~�+��R4�6M���}D,T���n�A�[(eMBZUrKl�N�J��Y�i����G�A\)�<�J#�k��S8?�����_��7ktF�O��ڑp��Z�T�s<�N#M(n�7;L��Q8�˹t0�t��|���y�xt`�xT�)�
�|� -[}"�b�ݪ^�Ht��� U��nq,*�kJ����K�u�:4�j��l�+�WU�g�+��\:7];�)�FHL�3�Rk}�̉�0���P�.$�s-�����#�W=�z�`�(����@��K�f��S�ŞJ_w��v�a���g=i �]�"�iΩΘБ�* >"�u�ƭ�>���`"���f���I�K�'i�&"�VFt��>��酂nO�1P.���&�M#�D�W����7q�$�s�$����4�� ��vP�#��
v���O��̨�8,-%���,����y�v�.p|�vv)�֖�7� 3��z�7d�&p9"{�#t���T�N�$��?!~J��:�%�����B��ݢ��^5 \�� ��4���I:wty 2�Y�%�i9�W�=���i������Gc�F*���^��;c�:���
�x[�\;��u]��:P0�dj��7��h�÷�T���n��ŵ�0
��6��<�͋pZ�n�L4���E���άС_K]��1�6��X�~�)��9gO"�}-cA��\F'�Y����
����W���Y���m��{C��4A�G������4�y?��E.�jώ��IfQ�� (�G�Z��M�������`��3��Mi�~�:C0�C{�.���k��)c͜��A��∗E�hp�c5����J�Pi�G�6�N��&0u��Jb���ܳ1=�ݚ�w:R��R�,P�?�^r2T��Ҍ��U��m=Ź�8���
�K�t�w��G���\j
�������Kn\w�M� �I�̈n�ғ�Ǥ�~����M�`�����Q{��)��Q�%Z#Gt_�|���ٛG$�ȡ��X���i1�k�C�?�����o�Sy(�[ʍT8����^
��O�, ��%t�x
��I���:(���y�PX�d����7
8i^ ����2��[4C�Ҟ��!��p�l�j)UI��p�C�Ko�j��v3$�\�Yp~���^� ^2�a� {B~�sQ��&o��`D[��J�]$�Bg/U��i�٪s�%u0�a��m#B��=Ă��ֶ)��PJz��CwhZ��Øgd��>x�Lo<���ֱ�4-z�M�ν# F�� ���b��7]���߿uͩsI��F+G&�
���蛑b��@ы�.�A��--4��Z$�6[^��N� �M-������po�sEV*VE���}<�ýhi>yo�m����cs�
��8�W���x`'w�4z�8���q=������>�����G��F�͢F�G�������>
F��� V�z���',����q����~�<�GZ���'}�`�`������G^�^GÏw{�x3�T�w؝?�[w����7�C��� ��������
��nzv0��x
�8����O�x�������
�� '��GfMx7�b���uA�����X
����Q���ow�Ƨ��5jG�t\��L�羿�Lx�5�7���d��ś�f��i��O�A���ap
z��;�>��f4x��~�E�h��r)�ItБ�gҀ�{:�h��3Ns@h��G��2���2��$�]��<hE�%z���/2����"���N@%Z��_=�@ϐ�!��M�S��`�3�
��:�ݳ������P<H�^x��d�tۇ0�h��*0�@Ҵ��!�{�*O۽w����qL��M&}��Wz{4x �ؘ����#�A_���3Lm��B1t^����&X�����ϣ=
�Ώ`!-ɚ�$����:`����N�g;6�b� ��^��|�ߑ},a<T�<�
�G��C�<0 o�6M�TP'������
h��j��"~f�1XAO;��ӹ8���|��WY���j�I�4�����\q^R!�F&�9ؤ��:} v�����Mʦ�ʃr�,�[�*�NR��1� �� �©�Ot0���z^��:n�m�Pï�i)w9dV8��m�|���c�<_CK���Мg�~�D�@�\�Rv]p��s2<Q������)|�E`�O�I�64��ÿ���,;Ej����L�ȅr���y���O44�?�����_�?�sA?�u�����v���I}<�AU/q�<