Ticket #43637: 43637.4.diff
File 43637.4.diff, 6.0 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( 4539 __( 'Error: Expected an array describing the eraser at index %d.' ), 4543 /* translators: %s: the array index */ 4544 __( 'Error: Expected an array describing the eraser at index %s.' ), 4540 4545 $eraser_index 4541 4546 ) 4542 4547 ); … … 4544 4549 if ( ! array_key_exists( 'callback', $eraser ) ) { 4545 4550 wp_send_json_error( 4546 4551 sprintf( 4547 __( 'Error: Eraser array at index %d does not include a callback.' ), 4552 /* translators: %s: the array index */ 4553 __( 'Error: Eraser array at index %s does not include a callback.' ), 4548 4554 $eraser_index 4549 4555 ) 4550 4556 ); … … 4552 4558 if ( ! is_callable( $eraser['callback'] ) ) { 4553 4559 wp_send_json_error( 4554 4560 sprintf( 4555 __( 'Error: Eraser callback at index %d is not a valid callback.' ), 4561 /* translators: %s: the array index */ 4562 __( 'Error: Eraser callback at index %s is not a valid callback.' ), 4556 4563 $eraser_index 4557 4564 ) 4558 4565 ); … … 4560 4567 if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) { 4561 4568 wp_send_json_error( 4562 4569 sprintf( 4563 __( 'Error: Eraser array at index %d does not include a friendly name.' ), 4570 /* translators: %s: the array index */ 4571 __( 'Error: Eraser array at index %s does not include a friendly name.' ), 4564 4572 $eraser_index 4565 4573 ) 4566 4574 ); … … 4577 4585 if ( ! is_array( $response ) ) { 4578 4586 wp_send_json_error( 4579 4587 sprintf( 4580 __( 'Error: Did not receive array from %s eraser (index %d).' ), 4588 /* translators: 1: eraser friendly name, 2: array index */ 4589 __( 'Error: Did not receive array from %s eraser (index %s).' ), 4581 4590 $eraser_friendly_name, 4582 4591 $eraser_index 4583 4592 ) … … 4586 4595 if ( ! array_key_exists( 'num_items_removed', $response ) ) { 4587 4596 wp_send_json_error( 4588 4597 sprintf( 4589 __( 'Error: Expected num_items_removed key in response array from %s eraser (index %d).' ), 4598 /* translators: 1: eraser friendly name, 2: array index */ 4599 __( 'Error: Expected num_items_removed key in response array from %s eraser (index %s).' ), 4590 4600 $eraser_friendly_name, 4591 4601 $eraser_index 4592 4602 ) … … 4595 4605 if ( ! array_key_exists( 'num_items_retained', $response ) ) { 4596 4606 wp_send_json_error( 4597 4607 sprintf( 4598 __( 'Error: Expected num_items_retained key in response array from %s eraser (index %d).' ), 4608 /* translators: 1: eraser friendly name, 2: array index */ 4609 __( 'Error: Expected num_items_retained key in response array from %s eraser (index %s).' ), 4599 4610 $eraser_friendly_name, 4600 4611 $eraser_index 4601 4612 ) … … 4604 4615 if ( ! array_key_exists( 'messages', $response ) ) { 4605 4616 wp_send_json_error( 4606 4617 sprintf( 4607 __( 'Error: Expected messages key in response array from %s eraser (index %d).' ), 4618 /* translators: 1: eraser friendly name, 2: array index */ 4619 __( 'Error: Expected messages key in response array from %s eraser (index %s).' ), 4608 4620 $eraser_friendly_name, 4609 4621 $eraser_index 4610 4622 ) … … 4613 4625 if ( ! is_array( $response['messages'] ) ) { 4614 4626 wp_send_json_error( 4615 4627 sprintf( 4616 __( 'Error: Expected messages key to reference an array in response array from %s eraser (index %d).' ), 4628 /* translators: 1: eraser friendly name, 2: array index */ 4629 __( 'Error: Expected messages key to reference an array in response array from %s eraser (index %s).' ), 4617 4630 $eraser_friendly_name, 4618 4631 $eraser_index 4619 4632 ) … … 4622 4635 if ( ! array_key_exists( 'done', $response ) ) { 4623 4636 wp_send_json_error( 4624 4637 sprintf( 4625 __( 'Error: Expected done flag in response array from %s eraser (index %d).' ), 4638 /* translators: 1: eraser friendly name, 2: array index */ 4639 __( 'Error: Expected done flag in response array from %s eraser (index %s).' ), 4626 4640 $eraser_friendly_name, 4627 4641 $eraser_index 4628 4642 ) … … 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 }