*/ public function add_privacy_fields() { if ( ! charitable_is_settings_view( 'privacy' ) ) { return array(); } $data_fields = $this->get_user_donation_field_options(); return array( 'section' => array( 'title' => '', 'type' => 'hidden', 'priority' => 10000, 'value' => 'privacy', ), 'section_privacy' => array( 'title' => __( 'Privacy', 'charitable' ), 'type' => 'heading', 'class' => 'section-heading', 'priority' => 10, ), 'section_privacy_description' => array( 'type' => 'content', 'priority' => 20, 'content' => '
' . __( 'Charitable stores personal data such as donors\' names, email addresses, addresses and phone numbers in your database. Donors may request to have their personal data erased, but you may be legally required to retain some personal data for donations made within a certain time. Below you can control how long personal data is retained for at a minimum, as well as which data fields must be retained.', 'charitable' ) . '
' . '' . __( 'Read more about Charitable & user privacy', 'charitable' ) . '
' . '[privacy_policy] to link to the page assigned in general settings.', 'charitable' ),
esc_url( admin_url( 'admin.php?page=charitable-settings&tab=general' ) )
),
),
'terms_and_conditions_enabled' => array(
'title' => __( 'Terms And Conditions Field', 'charitable' ),
'type' => 'checkbox',
'priority' => 50,
'default' => charitable_get_option( 'terms_conditions_page', 0 ) ? true : false,
'help' => __( 'Display a field showing the terms and conditions (must have a terms page set and terms added below).', 'charitable' ),
),
'terms_conditions' => array(
'title' => __( 'Terms And Conditions', 'charitable' ),
'type' => 'textarea',
'priority' => 55,
'default' => __( 'I have read and agree to the website [terms].', 'charitable' ),
'help' => sprintf(
/* translators: %1$s: HTML code tag. %2$s: HTML closing code tag. %3$s: HTML anchor tag. %4$s: HTML closing anchor tag. */
__( 'Terms and conditions statement to display on donation forms. Use [terms] to link to the page assigned in general settings.', 'charitable' ),
esc_url( admin_url( 'admin.php?page=charitable-settings&tab=general' ) )
),
),
);
}
/**
* Return the list of user donation field options.
*
* @since 1.6.0
*
* @return string[]
*/
protected function get_user_donation_field_options() {
$fields = charitable()->donation_fields()->get_data_type_fields( 'user' );
return array_combine(
array_keys( $fields ),
wp_list_pluck( $fields, 'label' )
);
}
/**
* Sanitize the privacy policy field to prevent XSS attacks.
*
* @since 1.8.6.2
*
* @param mixed $value The submitted value.
* @param array $field The field configuration.
* @param array $submitted All submitted data.
* @return string
*/
public function sanitize_privacy_policy_field( $value, $field, $submitted ) { // phpcs:ignore
return wp_kses_post( $value );
}
/**
* Sanitize the terms and conditions field to prevent XSS attacks.
*
* @since 1.8.6.2
*
* @param mixed $value The submitted value.
* @param array $field The field configuration.
* @param array $submitted All submitted data.
* @return string
*/
public function sanitize_terms_conditions_field( $value, $field, $submitted ) { // phpcs:ignore
return wp_kses_post( $value );
}
/**
* Sanitize the contact consent label field to prevent XSS attacks.
*
* @since 1.8.6.2
*
* @param mixed $value The submitted value.
* @param array $field The field configuration.
* @param array $submitted All submitted data.
* @return string
*/
public function sanitize_contact_consent_label_field( $value, $field, $submitted ) { // phpcs:ignore
return wp_kses_post( $value );
}
}
endif;