Make WordPress Core


Ignore:
Timestamp:
05/10/2018 10:00:19 AM (6 years ago)
Author:
azaozz
Message:

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

Props desrosj, xkon.
See #43929.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/user.php

    r43191 r43212  
    664664            );
    665665        }
    666 
    667666    } elseif ( isset( $_POST['action'] ) ) {
    668667        $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok.
     
    761760        'post_status'    => 'request-pending',
    762761        'fields'         => 'ids',
    763         'date_query' => array(
     762        'date_query'     => array(
    764763            array(
    765764                'column' => 'post_modified_gmt',
     
    11131112     */
    11141113    protected function get_views() {
    1115         $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ): '';
     1114        $current_status = isset( $_REQUEST['filter-status'] ) ? sanitize_text_field( $_REQUEST['filter-status'] ) : '';
    11161115        $statuses       = _wp_privacy_statuses();
    11171116        $views          = array();
     
    11521151        $action      = $this->current_action();
    11531152        $request_ids = isset( $_REQUEST['request_id'] ) ? wp_parse_id_list( wp_unslash( $_REQUEST['request_id'] ) ) : array(); // WPCS: input var ok, CSRF ok.
    1154         $count = 0;
     1153        $count       = 0;
    11551154
    11561155        if ( $request_ids ) {
     
    11691168                    'bulk_action',
    11701169                    'bulk_action',
     1170                    /* translators: %d: number of requests */
    11711171                    sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ),
    11721172                    'updated'
     
    11851185                    'bulk_action',
    11861186                    'bulk_action',
     1187                    /* translators: %d: number of requests */
    11871188                    sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ),
    11881189                    'updated'
     
    12141215            'post_name__in'  => array( $this->request_type ),
    12151216            'posts_per_page' => $posts_per_page,
    1216             'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page: 0,
     1217            'offset'         => isset( $_REQUEST['paged'] ) ? max( 0, absint( $_REQUEST['paged'] ) - 1 ) * $posts_per_page : 0,
    12171218            'post_status'    => 'any',
    12181219            's'              => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '',
     
    13061307
    13071308        if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
     1309            /* translators: human readable timestamp */
    13081310            return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) );
    13091311        }
     
    14131415        $nonce           = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
    14141416
    1415         $download_data_markup = '<div class="export_personal_data" ' .
     1417        $download_data_markup = '<div class="export-personal-data" ' .
    14161418            'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
    14171419            'data-request-id="' . esc_attr( $request_id ) . '" ' .
     
    14191421            '">';
    14201422
    1421         $download_data_markup .= '<span class="export_personal_data_idle"><a href="#" >' . __( 'Download Personal Data' ) . '</a></span>' .
    1422             '<span style="display:none" class="export_personal_data_processing" >' . __( 'Downloading Data...' ) . '</span>' .
    1423             '<span style="display:none" class="export_personal_data_success"><a href="#" >' . __( 'Download Personal Data Again' ) . '</a></span>' .
    1424             '<span style="display:none" class="export_personal_data_failed">' . __( 'Download has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>';
     1423        $download_data_markup .= '<span class="export-personal-data-idle"><button type="button" class="button-link export-personal-data-handle">' . __( 'Download Personal Data' ) . '</button></span>' .
     1424            '<span style="display:none" class="export-personal-data-processing" >' . __( 'Downloading Data...' ) . '</span>' .
     1425            '<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>' .
     1426            '<span style="display:none" class="export-personal-data-failed">' . __( 'Download has failed.' ) . ' <button type="button" class="button-link">' . __( 'Retry' ) . '</button></span>';
    14251427
    14261428        $download_data_markup .= '</div>';
    14271429
    14281430        $row_actions = array(
    1429             'download_data' => $download_data_markup,
     1431            'download-data' => $download_data_markup,
    14301432        );
    14311433
     
    14531455                $nonce           = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id );
    14541456
    1455                 echo '<div class="export_personal_data" ' .
     1457                echo '<div class="export-personal-data" ' .
    14561458                    'data-send-as-email="1" ' .
    14571459                    'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' .
     
    14611463
    14621464                ?>
    1463                 <span class="export_personal_data_idle"><a class="button" href="#" ><?php _e( 'Send Export Link' ); ?></a></span>
    1464                 <span style="display:none" class="export_personal_data_processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
    1465                 <span style="display:none" class="export_personal_data_success success-message" ><?php _e( 'Email sent.' ); ?></span>
    1466                 <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>
     1465                <span class="export-personal-data-idle"><button type="button" class="button export-personal-data-handle"><?php _e( 'Email Data' ); ?></button></span>
     1466                <span style="display:none" class="export-personal-data-processing button updating-message" ><?php _e( 'Sending Email...' ); ?></span>
     1467                <span style="display:none" class="export-personal-data-success success-message" ><?php _e( 'Email sent.' ); ?></span>
     1468                <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>
    14671469                <?php
    14681470
     
    14741476            case 'request-completed':
    14751477                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
    1476                     'action' => 'delete',
    1477                     'request_id' => array( $item->ID )
    1478                 ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
     1478                    'action'     => 'delete',
     1479                    'request_id' => array( $item->ID ),
     1480                ), admin_url( 'tools.php?page=export_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
    14791481                break;
    14801482        }
     
    15251527            $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
    15261528
    1527             $remove_data_markup = '<div class="remove_personal_data force_remove_personal_data" ' .
     1529            $remove_data_markup = '<div class="remove-personal-data force-remove-personal-data" ' .
    15281530                'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
    15291531                'data-request-id="' . esc_attr( $request_id ) . '" ' .
     
    15311533                '">';
    15321534
    1533             $remove_data_markup .= '<span class="remove_personal_data_idle"><a href="#" >' . __( 'Force Erase Personal Data' ) . '</a></span>' .
    1534                 '<span style="display:none" class="remove_personal_data_processing" >' . __( 'Erasing Data...' ) . '</span>' .
    1535                 '<span style="display:none" class="remove_personal_data_failed">' . __( 'Force Erase has failed.' ) . ' <a href="#" >' . __( 'Retry' ) . '</a></span>';
     1535            $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>' .
     1536                '<span style="display:none" class="remove-personal-data-processing" >' . __( 'Erasing Data...' ) . '</span>' .
     1537                '<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>';
    15361538
    15371539            $remove_data_markup .= '</div>';
    15381540
    15391541            $row_actions = array(
    1540                 'remove_data' => $remove_data_markup,
     1542                'remove-data' => $remove_data_markup,
    15411543            );
    15421544        }
     
    15651567                $nonce         = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id );
    15661568
    1567                 echo '<div class="remove_personal_data" ' .
     1569                echo '<div class="remove-personal-data" ' .
    15681570                    'data-force-erase="1" ' .
    15691571                    'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' .
     
    15731575
    15741576                ?>
    1575                 <span class="remove_personal_data_idle"><a class="button" href="#" ><?php _e( 'Erase Personal Data' ); ?></a></span>
    1576                 <span style="display:none" class="remove_personal_data_processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
    1577                 <span style="display:none" class="remove_personal_data_failed"><?php _e( 'Erasing Data has failed.' ); ?> <a class="button" href="#" ><?php _e( 'Retry' ); ?></a></span>
     1577                <span class="remove-personal-data-idle"><button type="button" class="button remove-personal-data-handle"><?php _e( 'Erase Personal Data' ); ?></button></span>
     1578                <span style="display:none" class="remove-personal-data-processing button updating-message" ><?php _e( 'Erasing Data...' ); ?></span>
     1579                <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>
    15781580                <?php
    15791581
     
    15861588            case 'request-completed':
    15871589                echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array(
    1588                     'action' => 'delete',
     1590                    'action'     => 'delete',
    15891591                    'request_id' => array( $item->ID ),
    1590                 ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '">' . esc_html__( 'Remove request' ) . '</a>';
     1592                ), admin_url( 'tools.php?page=remove_personal_data' ) ), 'bulk-privacy_requests' ) ) . '" class="button">' . esc_html__( 'Remove request' ) . '</a>';
    15911593                break;
    15921594        }
Note: See TracChangeset for help on using the changeset viewer.