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() { ?>
' . 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() { ?> 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 ); ?> __( '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' ) . '