__( 'ALPEG Forms – form submissions', 'alpeg-forms' ), 'callback' => array( __CLASS__, 'export' ), ); return $exporters; } /** * Register the eraser (Tools → Erase Personal Data). * * @param array $erasers Erasers. * @return array */ public static function register_eraser( $erasers ) { $erasers['alpeg-forms'] = array( 'eraser_friendly_name' => __( 'ALPEG Forms – form submissions', 'alpeg-forms' ), 'callback' => array( __CLASS__, 'erase' ), ); return $erasers; } /** * Export data for an email address. * * @param string $email Email. * @param int $page Page. * @return array */ public static function export( $email, $page = 1 ) { $per = 50; $rows = Entries::query( array( 'email' => $email, 'per_page' => $per, 'page' => $page, ) ); $items = array(); foreach ( $rows as $row ) { $data = array( array( 'name' => __( 'Form', 'alpeg-forms' ), 'value' => $row->form_title, ), array( 'name' => __( 'Date', 'alpeg-forms' ), 'value' => get_date_from_gmt( $row->created_at ), ), ); foreach ( $row->data as $field ) { $data[] = array( 'name' => $field['label'], 'value' => $field['value'], ); } if ( $row->ip ) { $data[] = array( 'name' => __( 'IP address', 'alpeg-forms' ), 'value' => $row->ip, ); } $items[] = array( 'group_id' => 'alpeg-forms', 'group_label' => __( 'Form submissions', 'alpeg-forms' ), 'item_id' => 'alpeg-forms-entry-' . $row->id, 'data' => $data, ); } return array( 'data' => $items, 'done' => count( $rows ) < $per, ); } /** * Erase data for an email address (including uploaded files). * * @param string $email Email. * @param int $page Page (always 1, as rows get deleted). * @return array */ public static function erase( $email, $page = 1 ) { $rows = Entries::query( array( 'email' => $email, 'per_page' => 100, ) ); $removed = Entries::delete( wp_list_pluck( $rows, 'id' ) ); return array( 'items_removed' => $removed > 0, 'items_retained' => false, 'messages' => array(), 'done' => count( $rows ) < 100, ); } /** * Privacy policy suggestion (Settings → Privacy). */ public static function policy_text() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $days = (int) alpeg_forms_setting( 'retention_days', 180 ); $text = '

' . esc_html__( 'Suggestion by ALPEG Forms. Please adapt it to your actual processes.', 'alpeg-forms' ) . '

' . '

' . esc_html__( 'Suggested text:', 'alpeg-forms' ) . ' ' . esc_html__( 'If you contact us via a form on this website, we store the data you enter, including any files you upload, in order to process your request. The legal basis is your consent (Art. 6(1)(a) GDPR) or the performance of pre-contractual measures (Art. 6(1)(b) GDPR). The data is stored on our own server and is not passed on to third parties.', 'alpeg-forms' ) . ' ' . ( $days > 0 /* translators: %d: number of days */ ? esc_html( sprintf( __( 'Submissions are deleted automatically after %d days.', 'alpeg-forms' ), $days ) ) : esc_html__( 'Submissions are deleted as soon as they are no longer needed for processing.', 'alpeg-forms' ) ) . '

'; wp_add_privacy_policy_content( 'ALPEG Forms', wp_kses_post( $text ) ); } }