[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

title

Body

[close]

/wp-admin/includes/ -> class-wp-privacy-data-removal-requests-list-table.php (source)

   1  <?php
   2  /**
   3   * List Table API: WP_Privacy_Data_Removal_Requests_List_Table class
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   * @since 4.9.6
   8   */
   9  
  10  if ( ! class_exists( 'WP_Privacy_Requests_Table' ) ) {
  11      require_once ( ABSPATH . 'wp-admin/includes/class-wp-privacy-requests-table.php' );
  12  }
  13  
  14  /**
  15   * WP_Privacy_Data_Removal_Requests_List_Table class.
  16   *
  17   * @since 4.9.6
  18   */
  19  class WP_Privacy_Data_Removal_Requests_List_Table extends WP_Privacy_Requests_Table {
  20      /**
  21       * Action name for the requests this table will work with.
  22       *
  23       * @since 4.9.6
  24       *
  25       * @var string $request_type Name of action.
  26       */
  27      protected $request_type = 'remove_personal_data';
  28  
  29      /**
  30       * Post type for the requests.
  31       *
  32       * @since 4.9.6
  33       *
  34       * @var string $post_type The post type.
  35       */
  36      protected $post_type = 'user_request';
  37  
  38      /**
  39       * Actions column.
  40       *
  41       * @since 4.9.6
  42       *
  43       * @param WP_User_Request $item Item being shown.
  44       * @return string Email column markup.
  45       */
  46  	public function column_email( $item ) {
  47          $row_actions = array();
  48  
  49          // Allow the administrator to "force remove" the personal data even if confirmation has not yet been received.
  50          $status = $item->status;
  51          if ( 'request-confirmed' !== $status ) {
  52              /** This filter is documented in wp-admin/includes/ajax-actions.php */
  53              $erasers       = apply_filters( 'wp_privacy_personal_data_erasers', array() );
  54              $erasers_count = count( $erasers );
  55              $request_id    = $item->ID;
  56              $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
  57  
  58              $remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
  59                  'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
  60                  'data-request-id="' . esc_attr( $request_id ) . '" ' .
  61                  'data-nonce="' . esc_attr( $nonce ) .
  62                  '">';
  63  
  64              $remove_data_markup .= '<span class="remove-personal-data-idle"><button type="button" class="button-link remove-personal-data-handle">' . __( 'Force Erase Personal Data' ) . '</button></span>' .
  65                  '<span class="remove-personal-data-processing hidden">' . __( 'Erasing Data...' ) . '</span>' .
  66                  '<span class="remove-personal-data-success hidden">' . __( 'Erasure completed.' ) . '</span>' .
  67                  '<span class="remove-personal-data-failed hidden">' . __( 'Force Erasure has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
  68  
  69              $remove_data_markup .= '</div>';
  70  
  71              $row_actions = array(
  72                  'remove-data' => $remove_data_markup,
  73              );
  74          }
  75  
  76          return sprintf( '<a href="%1$s">%2$s</a> %3$s', esc_url( 'mailto:' . $item->email ), $item->email, $this->row_actions( $row_actions ) );
  77      }
  78  
  79      /**
  80       * Next steps column.
  81       *
  82       * @since 4.9.6
  83       *
  84       * @param WP_User_Request $item Item being shown.
  85       */
  86  	public function column_next_steps( $item ) {
  87          $status = $item->status;
  88  
  89          switch ( $status ) {
  90              case 'request-pending':
  91                  esc_html_e( 'Waiting for confirmation' );
  92                  break;
  93              case 'request-confirmed':
  94                  /** This filter is documented in wp-admin/includes/ajax-actions.php */
  95                  $erasers       = apply_filters( 'wp_privacy_personal_data_erasers', array() );
  96                  $erasers_count = count( $erasers );
  97                  $request_id    = $item->ID;
  98                  $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
  99  
 100                  echo '<div class="remove-personal-data" ' .
 101                      'data-force-erase="1" ' .
 102                      'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
 103                      'data-request-id="' . esc_attr( $request_id ) . '" ' .
 104                      'data-nonce="' . esc_attr( $nonce ) .
 105                      '">';
 106  
 107                  ?>
 108                  <span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
 109                  <span class="remove-personal-data-processing button updating-message hidden"><?php _e( 'Erasing Data...' ); ?></span>
 110                  <span class="remove-personal-data-success success-message hidden" ><?php _e( 'Erasure completed.' ); ?></span>
 111                  <span class="remove-personal-data-failed hidden"><?php _e( 'Data Erasure has failed.' ); ?> <button type="button" class="button remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
 112                  <?php
 113  
 114                  echo '</div>';
 115  
 116                  break;
 117              case 'request-failed':
 118                  submit_button( __( 'Retry' ), 'secondary', 'privacy_action_email_retry[' . $item->ID . ']', false );
 119                  break;
 120              case 'request-completed':
 121                  echo '<a href="' . esc_url(
 122                      wp_nonce_url(
 123                          add_query_arg(
 124                              array(
 125                                  'action'     => 'delete',
 126                                  'request_id' => array( $item->ID ),
 127                              ),
 128                              admin_url( 'erase-personal-data.php' )
 129                          ),
 130                          'bulk-privacy_requests'
 131                      )
 132                  ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
 133                  break;
 134          }
 135      }
 136  
 137  }


Generated: Sat Nov 23 20:47:33 2019 Cross-referenced by PHPXref 0.7