Ticket #43637: 43637.5.diff
File 43637.5.diff, 5.1 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
4505 4505 * 4506 4506 * @param array $args { 4507 4507 * An array of callable erasers of personal data. Default empty array. 4508 * [ 4509 * callback string Callable eraser that accepts an email address and 4510 * a page and returns an array with the number of items 4511 * removed, the number of items retained and any messages 4512 * from the eraser, as well as if additional pages are 4513 * available. 4514 * eraser_friendly_name string Translated user facing friendly name for the eraser. 4515 * ] 4508 * 4509 * @type array { 4510 * Array of personal data erasers. 4511 * 4512 * @type string $callback Callable eraser that accepts an email address and 4513 * a page and returns an array with the number of 4514 * items removed, the number of items retained and 4515 * any messages from the eraser, as well as if 4516 * additional pages are available. 4517 * @type string $eraser_friendly_name Translated user facing friendly name for the 4518 * eraser. 4519 * } 4516 4520 * } 4517 4521 */ 4518 4522 $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); … … 4531 4535 wp_send_json_error( __( 'Error: Page index cannot be less than one.' ) ); 4532 4536 } 4533 4537 4534 $index = $eraser_index - 1; // Convert to zero based for eraser index 4538 $index = $eraser_index - 1; // Convert to zero based for eraser index. 4535 4539 $eraser = $erasers[ $index ]; 4536 4540 if ( ! is_array( $eraser ) ) { 4537 4541 wp_send_json_error( 4538 4542 sprintf( 4543 /* translators: %d: the array index */ 4539 4544 __( 'Error: Expected an array describing the eraser at index %d.' ), 4540 4545 $eraser_index 4541 4546 ) … … 4544 4549 if ( ! array_key_exists( 'callback', $eraser ) ) { 4545 4550 wp_send_json_error( 4546 4551 sprintf( 4552 /* translators: %d: the array index */ 4547 4553 __( 'Error: Eraser array at index %d does not include a callback.' ), 4548 4554 $eraser_index 4549 4555 ) … … 4552 4558 if ( ! is_callable( $eraser['callback'] ) ) { 4553 4559 wp_send_json_error( 4554 4560 sprintf( 4561 /* translators: %d: the array index */ 4555 4562 __( 'Error: Eraser callback at index %d is not a valid callback.' ), 4556 4563 $eraser_index 4557 4564 ) … … 4560 4567 if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) { 4561 4568 wp_send_json_error( 4562 4569 sprintf( 4570 /* translators: %d: the array index */ 4563 4571 __( 'Error: Eraser array at index %d does not include a friendly name.' ), 4564 4572 $eraser_index 4565 4573 ) … … 4577 4585 if ( ! is_array( $response ) ) { 4578 4586 wp_send_json_error( 4579 4587 sprintf( 4588 /* translators: %s: eraser friendly name, %d: array index */ 4580 4589 __( 'Error: Did not receive array from %s eraser (index %d).' ), 4581 4590 $eraser_friendly_name, 4582 4591 $eraser_index … … 4586 4595 if ( ! array_key_exists( 'num_items_removed', $response ) ) { 4587 4596 wp_send_json_error( 4588 4597 sprintf( 4598 /* translators: %s: eraser friendly name, %d: array index */ 4589 4599 __( 'Error: Expected num_items_removed key in response array from %s eraser (index %d).' ), 4590 4600 $eraser_friendly_name, 4591 4601 $eraser_index … … 4595 4605 if ( ! array_key_exists( 'num_items_retained', $response ) ) { 4596 4606 wp_send_json_error( 4597 4607 sprintf( 4608 /* translators: %s: eraser friendly name, %d: array index */ 4598 4609 __( 'Error: Expected num_items_retained key in response array from %s eraser (index %d).' ), 4599 4610 $eraser_friendly_name, 4600 4611 $eraser_index … … 4604 4615 if ( ! array_key_exists( 'messages', $response ) ) { 4605 4616 wp_send_json_error( 4606 4617 sprintf( 4618 /* translators: %s: eraser friendly name, %d: array index */ 4607 4619 __( 'Error: Expected messages key in response array from %s eraser (index %d).' ), 4608 4620 $eraser_friendly_name, 4609 4621 $eraser_index … … 4613 4625 if ( ! is_array( $response['messages'] ) ) { 4614 4626 wp_send_json_error( 4615 4627 sprintf( 4628 /* translators: %s: eraser friendly name, %d: array index */ 4616 4629 __( 'Error: Expected messages key to reference an array in response array from %s eraser (index %d).' ), 4617 4630 $eraser_friendly_name, 4618 4631 $eraser_index … … 4622 4635 if ( ! array_key_exists( 'done', $response ) ) { 4623 4636 wp_send_json_error( 4624 4637 sprintf( 4638 /* translators: %s: eraser friendly name, %d: array index */ 4625 4639 __( 'Error: Expected done flag in response array from %s eraser (index %d).' ), 4626 4640 $eraser_friendly_name, 4627 4641 $eraser_index … … 4652 4666 * @param int $request_id The privacy request post ID associated with this request. 4653 4667 */ 4654 4668 $response = apply_filters( 'wp_privacy_personal_data_erasure_page', $response, $eraser_index, $email_address, $page, $request_id ); 4669 4655 4670 if ( is_wp_error( $response ) ) { 4656 4671 wp_send_json_error( $response ); 4657 4672 }