Changeset 43213
- Timestamp:
- 05/10/2018 10:02:41 AM (6 years ago)
- Location:
- branches/4.9
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.9
-
branches/4.9/src/wp-admin/css/forms.css
r43194 r43213 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: bold; -
branches/4.9/src/wp-admin/includes/user.php
r43192 r43213 623 623 ); 624 624 } 625 626 625 } elseif ( isset( $_POST['action'] ) ) { 627 626 $action = isset( $_POST['action'] ) ? sanitize_key( wp_unslash( $_POST['action'] ) ) : ''; // WPCS: input var ok, CSRF ok. … … 720 719 'post_status' => 'request-pending', 721 720 'fields' => 'ids', 722 'date_query' => array(721 'date_query' => array( 723 722 array( 724 723 'column' => 'post_modified_gmt', … … 1072 1071 */ 1073 1072 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'] ) : ''; 1075 1074 $statuses = _wp_privacy_statuses(); 1076 1075 $views = array(); … … 1111 1110 $action = $this->current_action(); 1112 1111 $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; 1114 1113 1115 1114 if ( $request_ids ) { … … 1128 1127 'bulk_action', 1129 1128 'bulk_action', 1129 /* translators: %d: number of requests */ 1130 1130 sprintf( _n( 'Deleted %d request', 'Deleted %d requests', $count ), $count ), 1131 1131 'updated' … … 1144 1144 'bulk_action', 1145 1145 'bulk_action', 1146 /* translators: %d: number of requests */ 1146 1147 sprintf( _n( 'Re-sent %d request', 'Re-sent %d requests', $count ), $count ), 1147 1148 'updated' … … 1173 1174 'post_name__in' => array( $this->request_type ), 1174 1175 '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, 1176 1177 'post_status' => 'any', 1177 1178 's' => isset( $_REQUEST['s'] ) ? sanitize_text_field( $_REQUEST['s'] ) : '', … … 1265 1266 1266 1267 if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) { 1268 /* translators: human readable timestamp */ 1267 1269 return sprintf( __( '%s ago' ), human_time_diff( $timestamp ) ); 1268 1270 } … … 1372 1374 $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); 1373 1375 1374 $download_data_markup = '<div class="export _personal_data" ' .1376 $download_data_markup = '<div class="export-personal-data" ' . 1375 1377 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . 1376 1378 'data-request-id="' . esc_attr( $request_id ) . '" ' . … … 1378 1380 '">'; 1379 1381 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>'; 1384 1386 1385 1387 $download_data_markup .= '</div>'; 1386 1388 1387 1389 $row_actions = array( 1388 'download _data' => $download_data_markup,1390 'download-data' => $download_data_markup, 1389 1391 ); 1390 1392 … … 1412 1414 $nonce = wp_create_nonce( 'wp-privacy-export-personal-data-' . $request_id ); 1413 1415 1414 echo '<div class="export _personal_data" ' .1416 echo '<div class="export-personal-data" ' . 1415 1417 'data-send-as-email="1" ' . 1416 1418 'data-exporters-count="' . esc_attr( $exporters_count ) . '" ' . … … 1420 1422 1421 1423 ?> 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> 1426 1428 <?php 1427 1429 … … 1433 1435 case 'request-completed': 1434 1436 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>'; 1438 1440 break; 1439 1441 } … … 1484 1486 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1485 1487 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" ' . 1487 1489 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . 1488 1490 'data-request-id="' . esc_attr( $request_id ) . '" ' . … … 1490 1492 '">'; 1491 1493 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>'; 1495 1497 1496 1498 $remove_data_markup .= '</div>'; 1497 1499 1498 1500 $row_actions = array( 1499 'remove _data' => $remove_data_markup,1501 'remove-data' => $remove_data_markup, 1500 1502 ); 1501 1503 } … … 1524 1526 $nonce = wp_create_nonce( 'wp-privacy-erase-personal-data-' . $request_id ); 1525 1527 1526 echo '<div class="remove _personal_data" ' .1528 echo '<div class="remove-personal-data" ' . 1527 1529 'data-force-erase="1" ' . 1528 1530 'data-erasers-count="' . esc_attr( $erasers_count ) . '" ' . … … 1532 1534 1533 1535 ?> 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> 1537 1539 <?php 1538 1540 … … 1545 1547 case 'request-completed': 1546 1548 echo '<a href="' . esc_url( wp_nonce_url( add_query_arg( array( 1547 'action' => 'delete',1549 'action' => 'delete', 1548 1550 '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>'; 1550 1552 break; 1551 1553 } -
branches/4.9/src/wp-admin/js/xfn.js
r43204 r43213 21 21 var strings = window.privacyToolsL10n || {}; 22 22 23 function set _action_state( $action, state ) {23 function setActionState( $action, state ) { 24 24 $action.children().hide(); 25 25 $action.children( '.' + state ).show(); … … 33 33 34 34 function appendResultsAfterRow( $requestRow, classes, summaryMessage, additionalMessages ) { 35 var itemList = ''; 36 35 37 clearResultsAfterRow( $requestRow ); 36 38 37 var itemList = '';38 39 if ( additionalMessages.length ) { 39 40 $.each( additionalMessages, function( index, value ) { 40 41 itemList = itemList + '<li>' + value + '</li>'; 41 } 42 }); 42 43 itemList = '<ul>' + itemList + '</ul>'; 43 44 } … … 51 52 '</td>' + 52 53 '</tr>'; 53 } 54 }); 54 55 } 55 56 56 $( '.export_personal_data a' ).click( function( event ) { 57 $( '.export-personal-data-handle' ).click( function( event ) { 58 59 var $this = $( this ), 60 $action = $this.parents( '.export-personal-data' ), 61 $requestRow = $this.parents( 'tr' ), 62 requestID = $action.data( 'request-id' ), 63 nonce = $action.data( 'nonce' ), 64 exportersCount = $action.data( 'exporters-count' ), 65 sendAsEmail = $action.data( 'send-as-email' ) ? true : false; 66 57 67 event.preventDefault(); 58 68 event.stopPropagation(); 59 69 60 var $this = $( this );61 var $action = $this.parents( '.export_personal_data' );62 var $requestRow = $this.parents( 'tr' );63 var requestID = $action.data( 'request-id' );64 var nonce = $action.data( 'nonce' );65 var exportersCount = $action.data( 'exporters-count' );66 var sendAsEmail = $action.data( 'send-as-email' ) ? true : false;67 68 70 $action.blur(); 69 71 clearResultsAfterRow( $requestRow ); 70 72 71 function on _export_done_success( zipUrl ) {72 set _action_state( $action, 'export_personal_data_success' );73 function onExportDoneSuccess( zipUrl ) { 74 setActionState( $action, 'export-personal-data-success' ); 73 75 if ( 'undefined' !== typeof zipUrl ) { 74 76 window.location = zipUrl; 75 77 } else if ( ! sendAsEmail ) { 76 on _export_failure( strings.noExportFile );77 } 78 } 79 80 function on _export_failure( errorMessage ) {81 set _action_state( $action, 'export_personal_data_failed' );78 onExportFailure( strings.noExportFile ); 79 } 80 } 81 82 function onExportFailure( errorMessage ) { 83 setActionState( $action, 'export-personal-data-failed' ); 82 84 if ( errorMessage ) { 83 85 appendResultsAfterRow( $requestRow, 'notice-error', strings.exportError, [ errorMessage ] ); … … 85 87 } 86 88 87 function do _next_export( exporterIndex, pageIndex ) {89 function doNextExport( exporterIndex, pageIndex ) { 88 90 $.ajax( 89 91 { … … 100 102 } 101 103 ).done( function( response ) { 104 var responseData = response.data; 105 102 106 if ( ! response.success ) { 107 103 108 // e.g. invalid request ID 104 on _export_failure( response.data );109 onExportFailure( response.data ); 105 110 return; 106 111 } 107 var responseData = response.data; 112 108 113 if ( ! responseData.done ) { 109 setTimeout( do _next_export( exporterIndex, pageIndex + 1 ) );114 setTimeout( doNextExport( exporterIndex, pageIndex + 1 ) ); 110 115 } else { 111 116 if ( exporterIndex < exportersCount ) { 112 setTimeout( do _next_export( exporterIndex + 1, 1 ) );117 setTimeout( doNextExport( exporterIndex + 1, 1 ) ); 113 118 } else { 114 on _export_done_success( responseData.url );119 onExportDoneSuccess( responseData.url ); 115 120 } 116 121 } 117 } ).fail( function( jqxhr, textStatus, error ) { 122 }).fail( function( jqxhr, textStatus, error ) { 123 118 124 // e.g. Nonce failure 119 on _export_failure( error );120 } 125 onExportFailure( error ); 126 }); 121 127 } 122 128 123 129 // And now, let's begin 124 set_action_state( $action, 'export_personal_data_processing' ); 125 do_next_export( 1, 1 ); 126 } ); 127 128 $( '.remove_personal_data a' ).click( function( event ) { 129 event.preventDefault(); 130 setActionState( $action, 'export-personal-data-processing' ); 131 doNextExport( 1, 1 ); 132 }); 133 134 $( '.remove-personal-data-handle' ).click( function( event ) { 135 136 var $this = $( this ), 137 $action = $this.parents( '.remove-personal-data' ), 138 $requestRow = $this.parents( 'tr' ), 139 requestID = $action.data( 'request-id' ), 140 nonce = $action.data( 'nonce' ), 141 erasersCount = $action.data( 'erasers-count' ), 142 hasRemoved = false, 143 hasRetained = false, 144 messages = []; 145 130 146 event.stopPropagation(); 131 132 var $this = $( this );133 var $action = $this.parents( '.remove_personal_data' );134 var $requestRow = $this.parents( 'tr' );135 var requestID = $action.data( 'request-id' );136 var nonce = $action.data( 'nonce' );137 var erasersCount = $action.data( 'erasers-count' );138 139 var hasRemoved = false;140 var hasRetained = false;141 var messages = [];142 147 143 148 $action.blur(); 144 149 clearResultsAfterRow( $requestRow ); 145 150 146 function on_erasure_done_success() { 147 set_action_state( $action, 'remove_personal_data_idle' ); 151 function onErasureDoneSuccess() { 148 152 var summaryMessage = strings.noDataFound; 149 153 var classes = 'notice-success'; 154 155 setActionState( $action, 'remove-personal-data-idle' ); 156 150 157 if ( false === hasRemoved ) { 151 158 if ( false === hasRetained ) { … … 166 173 } 167 174 168 function on _erasure_failure() {169 set _action_state( $action, 'remove_personal_data_failed' );175 function onErasureFailure() { 176 setActionState( $action, 'remove-personal-data-failed' ); 170 177 appendResultsAfterRow( $requestRow, 'notice-error', strings.removalError, [] ); 171 178 } 172 179 173 function do _next_erasure( eraserIndex, pageIndex ) {174 $.ajax( 180 function doNextErasure( eraserIndex, pageIndex ) { 181 $.ajax({ 175 182 url: window.ajaxurl, 176 183 data: { … … 182 189 }, 183 190 method: 'post' 184 } ).done( function( response ) { 191 }).done( function( response ) { 192 var responseData = response.data; 193 185 194 if ( ! response.success ) { 186 on _erasure_failure();195 onErasureFailure(); 187 196 return; 188 197 } 189 var responseData = response.data;190 198 if ( responseData.items_removed ) { 191 199 hasRemoved = hasRemoved || responseData.items_removed; … … 198 206 } 199 207 if ( ! responseData.done ) { 200 setTimeout( do _next_erasure( eraserIndex, pageIndex + 1 ) );208 setTimeout( doNextErasure( eraserIndex, pageIndex + 1 ) ); 201 209 } else { 202 210 if ( eraserIndex < erasersCount ) { 203 setTimeout( do _next_erasure( eraserIndex + 1, 1 ) );211 setTimeout( doNextErasure( eraserIndex + 1, 1 ) ); 204 212 } else { 205 on _erasure_done_success();213 onErasureDoneSuccess(); 206 214 } 207 215 } 208 } 209 on _erasure_failure();210 } 216 }).fail( function() { 217 onErasureFailure(); 218 }); 211 219 } 212 220 213 221 // And now, let's begin 214 set _action_state( $action, 'remove_personal_data_processing' );215 216 do _next_erasure( 1, 1 );217 } 218 } 222 setActionState( $action, 'remove-personal-data-processing' ); 223 224 doNextErasure( 1, 1 ); 225 }); 226 }); 219 227 220 228 ( function( $ ) { 229 221 230 // Privacy policy page, copy button. 222 231 $( document ).on( 'click', function( event ) { … … 249 258 }); 250 259 251 } )( jQuery);260 } ( jQuery ) ); -
branches/4.9/src/wp-includes/user.php
r43200 r43213 2885 2885 2886 2886 if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) { 2887 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>';2887 $message = '<p class="message">' . __( 'Action has been confirmed.' ) . '</p>'; 2888 2888 $message .= __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ); 2889 2889 } … … 2918 2918 2919 2919 $user = get_user_by( 'email', $email_address ); 2920 $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0;2920 $user_id = $user && ! is_wp_error( $user ) ? $user->ID : 0; 2921 2921 2922 2922 // Check for duplicates.
Note: See TracChangeset
for help on using the changeset viewer.