Changeset 43212
- Timestamp:
- 05/10/2018 10:00:19 AM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/forms.css
r43193 r43212 1133 1133 } 1134 1134 1135 .privacy_requests .request-results .notice { 1136 margin: -2px 0 0; 1137 } 1138 1139 .privacy_requests .request-results .notice p { 1140 margin: 0.5em 0; 1141 } 1142 1143 .request-results td { 1144 padding: 0 0 1px; 1145 } 1146 1135 1147 .status-label { 1136 1148 font-weight: 600; -
trunk/src/wp-admin/includes/user.php
r43191 r43212 664 664 ); 665 665 } 666 667 666 } elseif ( isset( $_POST['action'] ) ) { 668 667 $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok. … … 761 760 'post_status' => 'request-pending', 762 761 'fields' => 'ids', 763 'date_query' => array(762 'date_query' => array( 764 763 array( 765 764 'column' => 'post_modified_gmt', … … 1113 1112 */ 1114 1113 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'] ) : ''; 1116 1115 $statuses = _wp_privacy_statuses(); 1117 1116 $views = array(); … … 1152 1151 $action = $this->current_action(); 1153 1152 $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; 1155 1154 1156 1155 if ( $request_ids ) { … … 1169 1168 'bulk_action', 1170 1169 'bulk_action', 1170 /* translators: %d: number of requests */ 1171 1171 sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ), 1172 1172 'updated' … … 1185 1185 'bulk_action', 1186 1186 'bulk_action', 1187 /* translators: %d: number of requests */ 1187 1188 sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ), 1188 1189 'updated' … … 1214 1215 'post_name__in' => array( $this->request_type ), 1215 1216 '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, 1217 1218 'post_status' => 'any', 1218 1219 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', … … 1306 1307 1307 1308 if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { 1309 /* translators: human readable timestamp */ 1308 1310 return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) ); 1309 1311 } … … 1413 1415 $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); 1414 1416 1415 $download_data_markup = '<div class="export _personal_data" ' .1417 $download_data_markup = '<div class="export-personal-data" ' . 1416 1418 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . 1417 1419 'data-request-id="' . esc_attr( $request_id ) . '" ' . … … 1419 1421 '">'; 1420 1422 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>'; 1425 1427 1426 1428 $download_data_markup .= '</div>'; 1427 1429 1428 1430 $row_actions = array( 1429 'download _data' => $download_data_markup,1431 'download-data' => $download_data_markup, 1430 1432 ); 1431 1433 … … 1453 1455 $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); 1454 1456 1455 echo '<div class="export _personal_data" ' .1457 echo '<div class="export-personal-data" ' . 1456 1458 'data-send-as-email="1" ' . 1457 1459 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . … … 1461 1463 1462 1464 ?> 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> 1467 1469 <?php 1468 1470 … … 1474 1476 case 'request-completed': 1475 1477 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>'; 1479 1481 break; 1480 1482 } … … 1525 1527 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1526 1528 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" ' . 1528 1530 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . 1529 1531 'data-request-id="' . esc_attr( $request_id ) . '" ' . … … 1531 1533 '">'; 1532 1534 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>'; 1536 1538 1537 1539 $remove_data_markup .= '</div>'; 1538 1540 1539 1541 $row_actions = array( 1540 'remove _data' => $remove_data_markup,1542 'remove-data' => $remove_data_markup, 1541 1543 ); 1542 1544 } … … 1565 1567 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1566 1568 1567 echo '<div class="remove _personal_data" ' .1569 echo '<div class="remove-personal-data" ' . 1568 1570 'data-force-erase="1" ' . 1569 1571 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . … … 1573 1575 1574 1576 ?> 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> 1578 1580 <?php 1579 1581 … … 1586 1588 case 'request-completed': 1587 1589 echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( 1588 'action' => 'delete',1590 'action' => 'delete', 1589 1591 '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>'; 1591 1593 break; 1592 1594 } -
trunk/src/wp-admin/js/xfn.js
r43184 r43212 26 26 var strings = window.privacyToolsL10n || {}; 27 27 28 function set _action_state( $action, state ) {28 function setActionState( $action, state ) { 29 29 $action.children().hide(); 30 30 $action.children( '.' + state ).show(); … … 38 38 39 39 function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) { 40 var itemList = ''; 41 40 42 clearResultsAfterRow( $requestRow ); 41 43 42 var itemList = '';43 44 if ( additionalMessages.length ) { 44 45 $.each( additionalMessages, function( index, value ) { 45 46 itemList = itemList + '<li>' + value + '</li>'; 46 } 47 }); 47 48 itemList = '<ul>' + itemList + '</ul>'; 48 49 } … … 56 57 '</td>' + 57 58 '</tr>'; 58 } 59 }); 59 60 } 60 61 61 $( '.export_personal_data a' ).click( function( event ) { 62 $( '.export-personal-data-handle' ).click( function( event ) { 63 64 var $this = $( this ), 65 $action = $this.parents( '.export-personal-data' ), 66 $requestRow = $this.parents( 'tr' ), 67 requestID = $action.data( 'request-id' ), 68 nonce = $action.data( 'nonce' ), 69 exportersCount = $action.data( 'exporters-count' ), 70 sendAsEmail = $action.data( 'send-as-email' ) ? true : false; 71 62 72 event.preventDefault(); 63 73 event.stopPropagation(); 64 74 65 var $this = $( this );66 var $action = $this.parents( '.export_personal_data' );67 var $requestRow = $this.parents( 'tr' );68 var requestID = $action.data( 'request-id' );69 var nonce = $action.data( 'nonce' );70 var exportersCount = $action.data( 'exporters-count' );71 var sendAsEmail = $action.data( 'send-as-email' ) ? true : false;72 73 75 $action.blur(); 74 76 clearResultsAfterRow( $requestRow ); 75 77 76 function on _export_done_success( zipUrl ) {77 set _action_state( $action, 'export_personal_data_success' );78 function onExportDoneSuccess( zipUrl ) { 79 setActionState( $action, 'export-personal-data-success' ); 78 80 if ( 'undefined' !== typeof zipUrl ) { 79 81 window.location = zipUrl; 80 82 } else if ( ! sendAsEmail ) { 81 on _export_failure( strings.noExportFile );82 } 83 } 84 85 function on _export_failure( errorMessage ) {86 set _action_state( $action, 'export_personal_data_failed' );83 onExportFailure( strings.noExportFile ); 84 } 85 } 86 87 function onExportFailure( errorMessage ) { 88 setActionState( $action, 'export-personal-data-failed' ); 87 89 if ( errorMessage ) { 88 90 appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] ); … … 90 92 } 91 93 92 function do _next_export( exporterIndex, pageIndex ) {94 function doNextExport( exporterIndex, pageIndex ) { 93 95 $.ajax( 94 96 { … … 105 107 } 106 108 ).done( function( response ) { 109 var responseData = response.data; 110 107 111 if ( ! response.success ) { 112 108 113 // e.g. invalid request ID 109 on _export_failure( response.data );114 onExportFailure( response.data ); 110 115 return; 111 116 } 112 var responseData = response.data; 117 113 118 if ( ! responseData.done ) { 114 setTimeout( do _next_export( exporterIndex, pageIndex + 1 ) );119 setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) ); 115 120 } else { 116 121 if ( exporterIndex < exportersCount ) { 117 setTimeout( do _next_export( exporterIndex + 1, 1 ) );122 setTimeout( doNextExport( exporterIndex + 1, 1 ) ); 118 123 } else { 119 on _export_done_success( responseData.url );124 onExportDoneSuccess( responseData.url ); 120 125 } 121 126 } 122 } ).fail( function( jqxhr, textStatus, error ) { 127 }).fail( function( jqxhr, textStatus, error ) { 128 123 129 // e.g. Nonce failure 124 on _export_failure( error );125 } 130 onExportFailure( error ); 131 }); 126 132 } 127 133 128 134 // And now, let's begin 129 set_action_state( $action, 'export_personal_data_processing' ); 130 do_next_export( 1, 1 ); 131 } ); 132 133 $( '.remove_personal_data a' ).click( function( event ) { 134 event.preventDefault(); 135 setActionState( $action, 'export-personal-data-processing' ); 136 doNextExport( 1, 1 ); 137 }); 138 139 $( '.remove-personal-data-handle' ).click( function( event ) { 140 141 var $this = $( this ), 142 $action = $this.parents( '.remove-personal-data' ), 143 $requestRow = $this.parents( 'tr' ), 144 requestID = $action.data( 'request-id' ), 145 nonce = $action.data( 'nonce' ), 146 erasersCount = $action.data( 'erasers-count' ), 147 hasRemoved = false, 148 hasRetained = false, 149 messages = []; 150 135 151 event.stopPropagation(); 136 137 var $this = $( this );138 var $action = $this.parents( '.remove_personal_data' );139 var $requestRow = $this.parents( 'tr' );140 var requestID = $action.data( 'request-id' );141 var nonce = $action.data( 'nonce' );142 var erasersCount = $action.data( 'erasers-count' );143 144 var hasRemoved = false;145 var hasRetained = false;146 var messages = [];147 152 148 153 $action.blur(); 149 154 clearResultsAfterRow( $requestRow ); 150 155 151 function on_erasure_done_success() { 152 set_action_state( $action, 'remove_personal_data_idle' ); 156 function onErasureDoneSuccess() { 153 157 var summaryMessage = strings.noDataFound; 154 158 var classes = 'notice-success'; 159 160 setActionState( $action, 'remove-personal-data-idle' ); 161 155 162 if ( false === hasRemoved ) { 156 163 if ( false === hasRetained ) { … … 171 178 } 172 179 173 function on _erasure_failure() {174 set _action_state( $action, 'remove_personal_data_failed' );180 function onErasureFailure() { 181 setActionState( $action, 'remove-personal-data-failed' ); 175 182 appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] ); 176 183 } 177 184 178 function do _next_erasure( eraserIndex, pageIndex ) {179 $.ajax( 185 function doNextErasure( eraserIndex, pageIndex ) { 186 $.ajax({ 180 187 url: window.ajaxurl, 181 188 data: { … … 187 194 }, 188 195 method: 'post' 189 } ).done( function( response ) { 196 }).done( function( response ) { 197 var responseData = response.data; 198 190 199 if ( ! response.success ) { 191 on _erasure_failure();200 onErasureFailure(); 192 201 return; 193 202 } 194 var responseData = response.data;195 203 if ( responseData.items_removed ) { 196 204 hasRemoved = hasRemoved || responseData.items_removed; … … 203 211 } 204 212 if ( ! responseData.done ) { 205 setTimeout( do _next_erasure( eraserIndex, pageIndex + 1 ) );213 setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) ); 206 214 } else { 207 215 if ( eraserIndex < erasersCount ) { 208 setTimeout( do _next_erasure( eraserIndex + 1, 1 ) );216 setTimeout( doNextErasure( eraserIndex + 1, 1 ) ); 209 217 } else { 210 on _erasure_done_success();218 onErasureDoneSuccess(); 211 219 } 212 220 } 213 } 214 on _erasure_failure();215 } 221 }).fail( function() { 222 onErasureFailure(); 223 }); 216 224 } 217 225 218 226 // And now, let's begin 219 set _action_state( $action, 'remove_personal_data_processing' );220 221 do _next_erasure( 1, 1 );222 } 223 } 227 setActionState( $action, 'remove-personal-data-processing' ); 228 229 doNextErasure( 1, 1 ); 230 }); 231 }); 224 232 225 233 ( function( $ ) { 234 226 235 // Privacy policy page, copy button. 227 236 $( document ).on( 'click', function( event ) { … … 254 263 }); 255 264 256 } )( jQuery);265 } ( jQuery ) ); -
trunk/src/wp-includes/user.php
r43211 r43212 3079 3079 3080 3080 if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { 3081 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>';3081 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>'; 3082 3082 $message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ); 3083 3083 } … … 3112 3112 3113 3113 $user = get_user_by( 'email', $email_address ); 3114 $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0;3114 $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0; 3115 3115 3116 3116 // Check for duplicates.
Note: See TracChangeset
for help on using the changeset viewer.