getByToken($token) : false; if ($request !== false) { if ( SessionHelper::checkSession($request->getSessionId()) && Helper::checkIpAddress($request->getIpAddress()) ) { $data = new Data($request->getEmailAddress()); $users = Data::getOutput($data->getUsers(), 'user', $request->getId()); $comments = Data::getOutput($data->getComments(), 'comment', $request->getId()); $output .= sprintf( '
%s
', apply_filters('wpgdprc_the_content', Integration::getDeleteRequestFormExplanationText()) ); // WordPress Users $output .= sprintf('

%s

', __('Users', WP_GDPR_C_SLUG)); if (!empty($users)) { $output .= $users; } else { $output .= sprintf( '
%s
', sprintf( __('No users found with email address %s.', WP_GDPR_C_SLUG), sprintf('%s', $request->getEmailAddress()) ) ); } // WordPress Comments $output .= sprintf('

%s

', __('Comments', WP_GDPR_C_SLUG)); if (!empty($comments)) { $output .= $comments; } else { $output .= sprintf( '
%s
', sprintf( __('No comments found with email address %s.', WP_GDPR_C_SLUG), sprintf('%s', $request->getEmailAddress()) ) ); } // WooCommerce Orders if (in_array('woocommerce/woocommerce.php', Helper::getActivePlugins())) { $woocommerceOrders = Data::getOutput($data->getWooCommerceOrders(), 'woocommerce_order', $request->getId()); $output .= sprintf('

%s

', __('WooCommerce Orders', WP_GDPR_C_SLUG)); if (!empty($woocommerceOrders)) { $output .= $woocommerceOrders; } else { $output .= sprintf( '
%s
', sprintf( __('No WooCommerce orders found with email address %s.', WP_GDPR_C_SLUG), sprintf('%s', $request->getEmailAddress()) ) ); } } $output = apply_filters('wpgdprc_request_data', $output, $data, $request); } else { $accessRequestPage = Helper::getAccessRequestPage(); $output .= sprintf( '

%s

', sprintf( __('ERROR: %s', WP_GDPR_C_SLUG), sprintf( '%s

%s', __('You are only able to view your data when visiting this page on the same device with the same IP and in the same browser session as when you performed your request. This is an extra security measure to keep your data safe.', WP_GDPR_C_SLUG), sprintf( __('If needed you can put in a new request after 24 hours here: %s.', WP_GDPR_C_SLUG), sprintf( '%s', get_permalink($accessRequestPage), get_the_title($accessRequestPage) ) ) ) ) ); } } else { $output .= sprintf( '

%s

', sprintf( __('ERROR: %s', WP_GDPR_C_SLUG), __('This request is expired or doesn\'t exist.', WP_GDPR_C_SLUG) ) ); } return $output; } /** * @return string */ public function accessRequestForm() { $output = '
'; if (isset($_REQUEST['wpgdprc'])) { $output .= self::getAccessRequestData(); } else { $output .= '
'; $output .= apply_filters( 'wpgdprc_request_form_email_field', sprintf( '

', apply_filters('wpgdprc_request_form_email_label', esc_attr__('Your Email Address', WP_GDPR_C_SLUG)) ) ); $output .= apply_filters( 'wpgdprc_request_form_consent_field', sprintf( '

', Integration::getAccessRequestFormCheckboxText() ) ); $output .= apply_filters( 'wpgdprc_request_form_submit_field', sprintf( '

', apply_filters('wpgdprc_request_form_submit_label', esc_attr__('Send', WP_GDPR_C_SLUG)) ) ); $output .= ''; $output .= '
'; $output = apply_filters('wpgdprc_request_form', $output); } $output .= '
'; return $output; } /** * @param $attributes * @param string $label * @return string */ public function consentsSettingsLink($attributes, $label = '') { $attributes = shortcode_atts(array( 'class' => '', ), $attributes, 'wpgdprc_consents_settings_link'); $output = ''; if (current_user_can('administrator')) { $output = sprintf( '

%s: %s

', strtoupper(__('Note', WP_GDPR_C_SLUG)), __('You need to make sure you have added atleast one (1) active consent.', WP_GDPR_C_SLUG) ); } if (Consent::isActive()) { $label = (!empty($label)) ? esc_html($label) : __('My settings', WP_GDPR_C_SLUG); $classes = explode(',', $attributes['class']); $classes[] = 'wpgdprc-consents-settings-link'; $classes = implode(' ', $classes); $output = sprintf( '%s', esc_attr($classes), $label ); } return $output; } /** * @return null|Shortcode */ public static function getInstance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; } }