export-personal-data.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Privacy tools, Export Personal Data screen.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. /** WordPress Administration Bootstrap */
  9. require_once( dirname( __FILE__ ) . '/admin.php' );
  10. if ( ! current_user_can( 'export_others_personal_data' ) ) {
  11. wp_die( __( 'Sorry, you are not allowed to export personal data on this site.' ) );
  12. }
  13. // Handle list table actions.
  14. _wp_personal_data_handle_actions();
  15. // Cleans up failed and expired requests before displaying the list table.
  16. _wp_personal_data_cleanup_requests();
  17. wp_enqueue_script( 'privacy-tools' );
  18. add_screen_option(
  19. 'per_page',
  20. array(
  21. 'default' => 20,
  22. 'option' => 'export_personal_data_requests_per_page',
  23. )
  24. );
  25. $_list_table_args = array(
  26. 'plural' => 'privacy_requests',
  27. 'singular' => 'privacy_request',
  28. );
  29. $requests_table = _get_list_table( 'WP_Privacy_Data_Export_Requests_List_Table', $_list_table_args );
  30. $requests_table->screen->set_screen_reader_content(
  31. array(
  32. 'heading_views' => __( 'Filter export personal data list' ),
  33. 'heading_pagination' => __( 'Export personal data list navigation' ),
  34. 'heading_list' => __( 'Export personal data list' ),
  35. )
  36. );
  37. $requests_table->process_bulk_action();
  38. $requests_table->prepare_items();
  39. require_once( ABSPATH . 'wp-admin/admin-header.php' );
  40. ?>
  41. <div class="wrap nosubsub">
  42. <h1><?php esc_html_e( 'Export Personal Data' ); ?></h1>
  43. <hr class="wp-header-end" />
  44. <?php settings_errors(); ?>
  45. <form action="<?php echo esc_url( admin_url( 'export-personal-data.php' ) ); ?>" method="post" class="wp-privacy-request-form">
  46. <h2><?php esc_html_e( 'Add Data Export Request' ); ?></h2>
  47. <p><?php esc_html_e( 'An email will be sent to the user at this email address asking them to verify the request.' ); ?></p>
  48. <div class="wp-privacy-request-form-field">
  49. <label for="username_or_email_for_privacy_request"><?php esc_html_e( 'Username or email address' ); ?></label>
  50. <input type="text" required class="regular-text" id="username_or_email_for_privacy_request" name="username_or_email_for_privacy_request" />
  51. <?php submit_button( __( 'Send Request' ), 'secondary', 'submit', false ); ?>
  52. </div>
  53. <?php wp_nonce_field( 'personal-data-request' ); ?>
  54. <input type="hidden" name="action" value="add_export_personal_data_request" />
  55. <input type="hidden" name="type_of_action" value="export_personal_data" />
  56. </form>
  57. <hr />
  58. <?php $requests_table->views(); ?>
  59. <form class="search-form wp-clearfix">
  60. <?php $requests_table->search_box( __( 'Search Requests' ), 'requests' ); ?>
  61. <input type="hidden" name="filter-status" value="<?php echo isset( $_REQUEST['filter-status'] ) ? esc_attr( sanitize_text_field( $_REQUEST['filter-status'] ) ) : ''; ?>" />
  62. <input type="hidden" name="orderby" value="<?php echo isset( $_REQUEST['orderby'] ) ? esc_attr( sanitize_text_field( $_REQUEST['orderby'] ) ) : ''; ?>" />
  63. <input type="hidden" name="order" value="<?php echo isset( $_REQUEST['order'] ) ? esc_attr( sanitize_text_field( $_REQUEST['order'] ) ) : ''; ?>" />
  64. </form>
  65. <form method="post">
  66. <?php
  67. $requests_table->display();
  68. $requests_table->embed_scripts();
  69. ?>
  70. </form>
  71. </div>
  72. <?php
  73. include( ABSPATH . 'wp-admin/admin-footer.php' );