WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/10/2018 10:02:41 AM (3 years ago)
Author:
azaozz
Message:

Privacy: cleanup of the "Export Personal Data" and "Erase Personal Data" screens.

Props desrosj, xkon.
Merges [43212] to the 4.9 branch.
See #43929.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/user.php

    r43192 r43213  
    623623            );
    624624        }
    625 
    626625    } elseif ( isset( $_POST['action'] ) ) {
    627626        $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok.
     
    720719        'post_status'    => 'request-pending',
    721720        'fields'         => 'ids',
    722         'date_query' => array(
     721        'date_query'     => array(
    723722            array(
    724723                'column' => 'post_modified_gmt',
     
    10721071     */
    10731072    protected function get_views() {
    1074         $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ): '';
     1073        $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
    10751074        $statuses       = _wp_privacy_statuses();
    10761075        $views          = array();
     
    11111110        $action      = $this->current_action();
    11121111        $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); // WPCS: input var ok, CSRF ok.
    1113         $count = 0;
     1112        $count       = 0;
    11141113
    11151114        if ( $request_ids ) {
     
    11281127                    'bulk_action',
    11291128                    'bulk_action',
     1129                    /* translators: %d: number of requests */
    11301130                    sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ),
    11311131                    'updated'
     
    11441144                    'bulk_action',
    11451145                    'bulk_action',
     1146                    /* translators: %d: number of requests */
    11461147                    sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ),
    11471148                    'updated'
     
    11731174            'post_name__in'  => array( $this->request_type ),
    11741175            'posts_per_page' => $posts_per_page,
    1175             'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0,
     1176            'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0,
    11761177            'post_status'    => 'any',
    11771178            's'              => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
     
    12651266
    12661267        if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
     1268            /* translators: human readable timestamp */
    12671269            return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
    12681270        }
     
    13721374        $nonce           = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
    13731375
    1374         $download_data_markup = '<div class="export_personal_data" ' .
     1376        $download_data_markup = '<div class="export-personal-data" ' .
    13751377            'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
    13761378            'data-request-id="' . esc_attr( $request_id ) . '" ' .
     
    13781380            '">';
    13791381
    1380         $download_data_markup .= '<span class="export_personal_data_idle"><a href="#" >' . __( 'Download Personal Data' ) . '</a></span>' .
    1381             '<span style="display:none" class="export_personal_data_processing" >' . __( 'Downloading Data...' ) . '</span>' .
    1382             '<span style="display:none" class="export_personal_data_success"><a href="#" >' . __( 'Download Personal Data Again' ) . '</a></span>' .
    1383             '<span style="display:none" class="export_personal_data_failed">' . __( 'Download has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>';
     1382        $download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
     1383            '<span style="display:none" class="export-personal-data-processing" >' . __( 'Downloading Data...' ) . '</span>' .
     1384            '<span style="display:none" class="export-personal-data-success"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data Again' ) . '</button></span>' .
     1385            '<span style="display:none" class="export-personal-data-failed">' . __( 'Download has failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
    13841386
    13851387        $download_data_markup .= '</div>';
    13861388
    13871389        $row_actions = array(
    1388             'download_data' => $download_data_markup,
     1390            'download-data' => $download_data_markup,
    13891391        );
    13901392
     
    14121414                $nonce           = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
    14131415
    1414                 echo '<div class="export_personal_data" ' .
     1416                echo '<div class="export-personal-data" ' .
    14151417                    'data-send-as-email="1" ' .
    14161418                    'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
     
    14201422
    14211423                ?>
    1422                 <span class="export_personal_data_idle"><a class="button" href="#" ><?php _e( 'Send Export Link' ); ?></a></span>
    1423                 <span style="display:none" class="export_personal_data_processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
    1424                 <span style="display:none" class="export_personal_data_success success-message" ><?php _e( 'Email sent.' ); ?></span>
    1425                 <span style="display:none" class="export_personal_data_failed"><?php _e( 'Email could not be sent.' ); ?> <a class="button" href="#" ><?php _e( 'Retry' ); ?></a></span>
     1424                <span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Email Data' ); ?></button></span>
     1425                <span style="display:none" class="export-personal-data-processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
     1426                <span style="display:none" class="export-personal-data-success success-message" ><?php _e( 'Email sent.' ); ?></span>
     1427                <span style="display:none" class="export-personal-data-failed"><?php _e( 'Email could not be sent.' ); ?> <button type="button" class="button export-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
    14261428                <?php
    14271429
     
    14331435            case 'request-completed':
    14341436                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
    1435                     'action' => 'delete',
    1436                     'request_id' => array( $item->ID )
    1437                 ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
     1437                    'action'     => 'delete',
     1438                    'request_id' => array( $item->ID ),
     1439                ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
    14381440                break;
    14391441        }
     
    14841486            $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
    14851487
    1486             $remove_data_markup = '<div class="remove_personal_data force_remove_personal_data" ' .
     1488            $remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
    14871489                'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
    14881490                'data-request-id="' . esc_attr( $request_id ) . '" ' .
     
    14901492                '">';
    14911493
    1492             $remove_data_markup .= '<span class="remove_personal_data_idle"><a href="#" >' . __( 'Force Erase Personal Data' ) . '</a></span>' .
    1493                 '<span style="display:none" class="remove_personal_data_processing" >' . __( 'Erasing Data...' ) . '</span>' .
    1494                 '<span style="display:none" class="remove_personal_data_failed">' . __( 'Force Erase has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>';
     1494            $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>' .
     1495                '<span style="display:none" class="remove-personal-data-processing" >' . __( 'Erasing Data...' ) . '</span>' .
     1496                '<span style="display:none" class="remove-personal-data-failed">' . __( 'Force Erase has failed.' ) . ' <button type="button" class="button-link remove-personal-data-handle">' . __( 'Retry' ) . '</button></span>';
    14951497
    14961498            $remove_data_markup .= '</div>';
    14971499
    14981500            $row_actions = array(
    1499                 'remove_data' => $remove_data_markup,
     1501                'remove-data' => $remove_data_markup,
    15001502            );
    15011503        }
     
    15241526                $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
    15251527
    1526                 echo '<div class="remove_personal_data" ' .
     1528                echo '<div class="remove-personal-data" ' .
    15271529                    'data-force-erase="1" ' .
    15281530                    'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
     
    15321534
    15331535                ?>
    1534                 <span class="remove_personal_data_idle"><a class="button" href="#" ><?php _e( 'Erase Personal Data' ); ?></a></span>
    1535                 <span style="display:none" class="remove_personal_data_processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
    1536                 <span style="display:none" class="remove_personal_data_failed"><?php _e( 'Erasing Data has failed.' ); ?> <a class="button" href="#" ><?php _e( 'Retry' ); ?></a></span>
     1536                <span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
     1537                <span style="display:none" class="remove-personal-data-processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
     1538                <span style="display:none" class="remove-personal-data-failed"><?php _e( 'Erasing Data has failed.' ); ?> <button type="button" class="button remove-personal-data-handle"><?php _e( 'Retry' ); ?></button></span>
    15371539                <?php
    15381540
     
    15451547            case 'request-completed':
    15461548                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
    1547                     'action' => 'delete',
     1549                    'action'     => 'delete',
    15481550                    'request_id' => array( $item->ID ),
    1549                 ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
     1551                ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
    15501552                break;
    15511553        }
Note: See TracChangeset for help on using the changeset viewer.