page_title = __( 'Do Not Sell', 'wpconsent-cookies-banner-privacy-suite' ); $this->menu_title = __( 'Do Not Sell', 'wpconsent-cookies-banner-privacy-suite' ); parent::__construct(); } /** * Page specific Hooks. * * @return void */ public function page_hooks() { $this->views = array( 'requests' => __( 'Requests', 'wpconsent-cookies-banner-privacy-suite' ), 'configuration' => __( 'Configuration', 'wpconsent-cookies-banner-privacy-suite' ), 'notifications' => __( 'Notifications', 'wpconsent-cookies-banner-privacy-suite' ), 'export' => __( 'Export', 'wpconsent-cookies-banner-privacy-suite' ), ); } /** * The page output based on the view. * * @return void */ public function output_content() { ?>
view ) ) { call_user_func( array( $this, 'output_view_' . $this->view ) ); } ?>
' . esc_html__( 'Upgrade to WPConsent Plus or higher plans today and improve the way you manage "Do Not Sell My Personal Information" requests.', 'wpconsent-cookies-banner-privacy-suite' ) . '

', array( 'text' => esc_html__( 'Upgrade to PRO and Unlock "Do Not Sell"', 'wpconsent-cookies-banner-privacy-suite' ), 'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'do-not-track-page', 'main' ) ), ), array( 'text' => esc_html__( 'Learn more about all the features', 'wpconsent-cookies-banner-privacy-suite' ), 'url' => esc_url( wpconsent_utm_url( 'https://wpconsent.com/lite/', 'do-not-track-page', 'features' ) ), ), array( esc_html__( 'Customizable requests form', 'wpconsent-cookies-banner-privacy-suite' ), esc_html__( 'Easily export to CSV', 'wpconsent-cookies-banner-privacy-suite' ), esc_html__( 'Mark requests as processed', 'wpconsent-cookies-banner-privacy-suite' ), esc_html__( 'Avoid Spam with an easy configuration', 'wpconsent-cookies-banner-privacy-suite' ), esc_html__( '1-click Do Not Sell page creation', 'wpconsent-cookies-banner-privacy-suite' ), esc_html__( 'Self-Hosted records for compliance proof', 'wpconsent-cookies-banner-privacy-suite' ), ) ); } /** * For this page we output a menu. * * @return void */ public function output_header_bottom() { ?>


1, 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'john.doe@example.com', 'city' => 'New York', 'state' => 'NY', 'country' => 'USA', 'request_status' => 'received', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-2 days' ) ), ), array( 'request_id' => 2, 'first_name' => 'Jane', 'last_name' => 'Smith', 'email' => 'jane.smith@example.com', 'city' => 'London', 'state' => '', 'country' => 'UK', 'request_status' => 'confirmed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-5 days' ) ), ), array( 'request_id' => 3, 'first_name' => 'Robert', 'last_name' => 'Johnson', 'email' => 'robert.johnson@example.com', 'city' => 'Paris', 'state' => '', 'country' => 'France', 'request_status' => 'processed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-10 days' ) ), 'processed_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-8 days' ) ), ), array( 'request_id' => 4, 'first_name' => 'Maria', 'last_name' => 'Garcia', 'email' => 'maria.garcia@example.com', 'city' => 'Madrid', 'state' => '', 'country' => 'Spain', 'request_status' => 'received', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-1 day' ) ), ), array( 'request_id' => 5, 'first_name' => 'Michael', 'last_name' => 'Brown', 'email' => 'michael.brown@example.com', 'city' => 'Sydney', 'state' => 'NSW', 'country' => 'Australia', 'request_status' => 'processed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-15 days' ) ), 'processed_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-12 days' ) ), ), array( 'request_id' => 6, 'first_name' => 'Emma', 'last_name' => 'Wilson', 'email' => 'emma.wilson@example.com', 'city' => 'Toronto', 'state' => 'ON', 'country' => 'Canada', 'request_status' => 'received', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-3 days' ) ), ), array( 'request_id' => 7, 'first_name' => 'David', 'last_name' => 'Lee', 'email' => 'david.lee@example.com', 'city' => 'Tokyo', 'state' => '', 'country' => 'Japan', 'request_status' => 'confirmed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-7 days' ) ), ), array( 'request_id' => 8, 'first_name' => 'Sophia', 'last_name' => 'Martinez', 'email' => 'sophia.martinez@example.com', 'city' => 'Berlin', 'state' => '', 'country' => 'Germany', 'request_status' => 'processed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-20 days' ) ), 'processed_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-18 days' ) ), ), array( 'request_id' => 9, 'first_name' => 'James', 'last_name' => 'Taylor', 'email' => 'james.taylor@example.com', 'city' => 'Dublin', 'state' => '', 'country' => 'Ireland', 'request_status' => 'received', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-1 day' ) ), ), array( 'request_id' => 10, 'first_name' => 'Olivia', 'last_name' => 'Anderson', 'email' => 'olivia.anderson@example.com', 'city' => 'Stockholm', 'state' => '', 'country' => 'Sweden', 'request_status' => 'confirmed', 'created_at' => gmdate( 'Y-m-d H:i:s', strtotime( '-4 days' ) ), ), ); foreach ( $dummy_data as $item ) { $status_labels = array( 'received' => __( 'Received', 'wpconsent-cookies-banner-privacy-suite' ), 'confirmed' => __( 'Confirmed', 'wpconsent-cookies-banner-privacy-suite' ), 'processed' => __( 'Processed', 'wpconsent-cookies-banner-privacy-suite' ), ); $status_text = isset( $status_labels[ $item['request_status'] ] ) ? $status_labels[ $item['request_status'] ] : $item['request_status']; // Add processed date if available. if ( 'processed' === $item['request_status'] && isset( $item['processed_at'] ) ) { $processed_at = date_i18n( get_option( 'date_format' ), strtotime( $item['processed_at'] ) ); // Translators: %s: date. $status_text .= ' ' . sprintf( __( 'on %s', 'wpconsent-cookies-banner-privacy-suite' ), $processed_at ) . ''; } // Build location string. $location = array(); if ( ! empty( $item['city'] ) ) { $location[] = $item['city']; } if ( ! empty( $item['state'] ) ) { $location[] = $item['state']; } if ( ! empty( $item['country'] ) ) { $location[] = $item['country']; } $location_text = implode( ', ', $location ); // Row actions for non-processed items. $row_actions = ''; if ( 'processed' !== $item['request_status'] ) { $row_actions = ''; } ?>

metabox( esc_html__( 'Do Not Sell Page Configuration', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_dnt_page_metabox() ); $this->metabox( esc_html__( 'Form Fields', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_configuration_metabox() ); ?>
metabox_row( esc_html__( 'Do Not Sell Page', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_dnt_page_input(), '', '', '', '', false, 'dnt-page-input' ); return ob_get_clean(); } /** * Get the do not track page input. * * @return string */ protected function get_configuration_metabox() { ob_start(); ?>

metabox_row( esc_html__( 'Submit Button Text', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_input_text( 'dnt_submit_text', wpconsent()->settings->get_option( 'dnt_submit_text', __( 'Submit Request', 'wpconsent-cookies-banner-privacy-suite' ) ), '', 'true' ), 'dnt_submit_text', '', '', 'The text for the form submit button.' ); $this->metabox_row_separator(); $this->get_form_fields_content(); $this->get_spam_protection_content(); return ob_get_clean(); } /** * Get the do not track page input. * * @return string */ protected function get_dnt_page_input() { ob_start(); $selected_page_id = wpconsent()->settings->get_option( 'dnt_page_id' ); $selected_page = $selected_page_id ? get_post( $selected_page_id ) : null; $pages_args = array( 'number' => 20, 'orderby' => 'title', 'order' => 'ASC', ); if ( ! empty( $selected_page_id ) ) { $pages_args['exclude'] = array( $selected_page_id ); } // Let's pre-load 20 pages. $pages = get_pages( $pages_args ); ?>
[wpconsent_do_not_sell_form]' ); ?>
__( 'First Name', 'wpconsent-cookies-banner-privacy-suite' ), 'last_name' => __( 'Last Name', 'wpconsent-cookies-banner-privacy-suite' ), 'email' => __( 'Email', 'wpconsent-cookies-banner-privacy-suite' ), 'address' => __( 'Address', 'wpconsent-cookies-banner-privacy-suite' ), ); $required_fields = array( 'first_name', 'last_name', 'email' ); foreach ( $available_fields as $field_key => $default_label ) { $enabled_key = 'dnt_field_' . $field_key . '_enabled'; $required_key = 'dnt_field_' . $field_key . '_required'; $label_key = 'dnt_field_' . $field_key . '_label'; $is_enabled = false; $is_required = false; $field_label = ''; $is_core_field = in_array( $field_key, $required_fields, true ); echo $this->get_form_fields_input( $default_label, $enabled_key, $required_key, $label_key, $is_enabled, $is_required, $field_label, $is_core_field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } /** * Get the form fields input. * * @param string $default_label The default label for the field. * @param string $enabled_key The key for the enabled field. * @param string $required_key The key for the required field. * @param string $label_key The key for the label field. * @param bool $is_enabled Whether the field is enabled. * @param bool $is_required Whether the field is required. * @param string $field_label The label for the field. * @param bool $is_core_field Whether the field is a core field. * * @return string */ protected function get_form_fields_input( $default_label, $enabled_key, $required_key, $label_key, $is_enabled = false, $is_required = false, $field_label = '', $is_core_field = false ) { ob_start(); if ( ! $is_core_field ) { $this->metabox_row( esc_html( $default_label ), $this->get_checkbox_toggle( $is_enabled, $enabled_key, esc_html__( 'Enable this field', 'wpconsent-cookies-banner-privacy-suite' ) ) ); $this->metabox_row( '', $this->get_checkbox_toggle( $is_required, $required_key, esc_html__( 'Make this field required', 'wpconsent-cookies-banner-privacy-suite' ) ) ); } else { $this->metabox_row( esc_html( $default_label ), '

' . esc_html__( 'This field is always required and cannot be disabled.', 'wpconsent-cookies-banner-privacy-suite' ) . '

', '', '', '' ); } $this->metabox_row( '', $this->get_input_text( $label_key, $field_label, '', true ) . '

Field Label

' ); $this->metabox_row_separator(); return ob_get_clean(); } /** * Get the spam protection content. * * @return void */ protected function get_spam_protection_content() { ?>

metabox( __( 'Export Do Not Sell Requests', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_export_input() ); } /** * Get the export form content. * * @return string */ public function get_export_input() { ob_start(); ?>

metabox_row( __( 'From:', 'wpconsent-cookies-banner-privacy-suite' ), sprintf( '', esc_html__( 'From Date', 'wpconsent-cookies-banner-privacy-suite' ) ) ); $this->metabox_row( __( 'To:', 'wpconsent-cookies-banner-privacy-suite' ), sprintf( '', esc_html__( 'To Date', 'wpconsent-cookies-banner-privacy-suite' ) ) ); $this->metabox_row( __( 'Export Options:', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_checkbox_toggle( false, 'export-only-not-processed', esc_html__( 'Export only "not processed" entries', 'wpconsent-cookies-banner-privacy-suite' ) ), '', '', '', esc_html__( 'If checked, only entries that have not been marked as processed will be exported.', 'wpconsent-cookies-banner-privacy-suite' ) ); $this->metabox_row( '', $this->get_checkbox_toggle( false, 'mark-as-processed', esc_html__( 'Mark exported data as processed', 'wpconsent-cookies-banner-privacy-suite' ) ), '', '', '', esc_html__( 'If checked, all exported entries will be automatically marked as processed.', 'wpconsent-cookies-banner-privacy-suite' ) ); wp_nonce_field( 'wpconsent_dnt_export_start', 'wpconsent_dnt_export_nonce' ); ?>
metabox( __( 'Email Notifications', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_notifications_content() ); ?>

wp_mail_smtp_notice(); $this->metabox_row( esc_html__( 'Email Notifications', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_checkbox_toggle( wpconsent()->settings->get_option( 'dnt_email_notifications', 0 ), 'dnt_email_notifications', esc_html__( 'Send email notifications when new Do Not Sell requests are received.', 'wpconsent-cookies-banner-privacy-suite' ) ), 'dnt_email_notifications' ); $this->metabox_row( esc_html__( 'Send To', 'wpconsent-cookies-banner-privacy-suite' ), $this->get_input_text( 'dnt_email_addresses', wpconsent()->settings->get_option( 'dnt_email_addresses', get_option( 'admin_email' ) ), '', 'true' ), 'dnt_email_addresses', '', '', esc_html__( 'Enter a comma separated list of email addresses to receive Do Not Sell request notifications. Defaults to the admin email address.', 'wpconsent-cookies-banner-privacy-suite' ) ); $this->metabox_row( '', $this->get_preview_email_button() ); return ob_get_clean(); } /** * Get the preview email button. * * @return string */ public function get_preview_email_button() { ob_start(); $preview_url = add_query_arg( array( 'wpconsent_dnt_email_template' => 'dnt', 'wpconsent_dnt_email_preview' => '1', ), admin_url() ); ?> 'term', 's' => 'wp mail smtp', 'tab' => 'search', ), admin_url( 'plugin-install.php' ) ); if ( ! isset( $dismissed_notices[ $slug ] ) || empty( $dismissed_notices[ $slug ]['dismissed'] ) ) { ?>

', '' ); ?>

notice->enqueues(); } } }