diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index 4f30007..b24c90a 100644
|
|
|
function wp_ajax_edit_theme_plugin_file() { |
| 4333 | 4333 | * @since 4.9.6 |
| 4334 | 4334 | */ |
| 4335 | 4335 | function wp_ajax_wp_privacy_export_personal_data() { |
| 4336 | | $request_id = (int) $_POST['id']; |
| 4337 | 4336 | |
| 4338 | | if ( empty( $request_id ) ) { |
| 4339 | | wp_send_json_error( __( 'Error: Invalid request ID.' ) ); |
| | 4337 | if ( ! isset( $_POST['id'] ) ) { |
| | 4338 | wp_send_json_error( __( 'Missing request ID.' ) ); |
| | 4339 | } |
| | 4340 | $request_id = (int) $_POST['id']; |
| | 4341 | |
| | 4342 | if ( $request_id < 0 ) { |
| | 4343 | wp_send_json_error( __( 'Invalid request ID.' ) ); |
| 4340 | 4344 | } |
| 4341 | 4345 | |
| 4342 | 4346 | if ( ! current_user_can( 'manage_options' ) ) { |
| 4343 | | wp_send_json_error( __( 'Error: Invalid request.' ) ); |
| | 4347 | wp_send_json_error( __( 'Invalid request.' ) ); |
| 4344 | 4348 | } |
| 4345 | 4349 | |
| 4346 | 4350 | check_ajax_referer( 'wp-privacy-export-personal-data-' . $request_id, 'security' ); |
| … |
… |
function wp_ajax_wp_privacy_export_personal_data() { |
| 4349 | 4353 | $request = wp_get_user_request_data( $request_id ); |
| 4350 | 4354 | |
| 4351 | 4355 | if ( ! $request || 'export_personal_data' !== $request->action_name ) { |
| 4352 | | wp_send_json_error( __( 'Error: Invalid request type.' ) ); |
| | 4356 | wp_send_json_error( __( 'Invalid request type.' ) ); |
| 4353 | 4357 | } |
| 4354 | 4358 | |
| 4355 | 4359 | $email_address = $request->email; |
| 4356 | | if ( ! is_email( $email_address ) ) { |
| 4357 | | wp_send_json_error( __( 'Error: A valid email address must be given.' ) ); |
| | 4360 | if ( ! is_email( strtolower( $email_address ) ) ) { |
| | 4361 | wp_send_json_error( __( 'A valid email address must be given.' ) ); |
| 4358 | 4362 | } |
| 4359 | 4363 | |
| | 4364 | if ( ! isset( $_POST['exporter'] ) ) { |
| | 4365 | wp_send_json_error( __( 'Missing exporter index.' ) ); |
| | 4366 | } |
| 4360 | 4367 | $exporter_index = (int) $_POST['exporter']; |
| 4361 | | $page = (int) $_POST['page']; |
| 4362 | | $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( "true" === $_POST['sendAsEmail'] ) : false; |
| | 4368 | |
| | 4369 | if ( ! isset( $_POST['page'] ) ) { |
| | 4370 | wp_send_json_error( __( 'Missing page index.' ) ); |
| | 4371 | } |
| | 4372 | $page = (int) $_POST['page']; |
| | 4373 | |
| | 4374 | $send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false; |
| 4363 | 4375 | |
| 4364 | 4376 | /** |
| 4365 | 4377 | * Filters the array of exporter callbacks. |
| … |
… |
function wp_ajax_wp_privacy_export_personal_data() { |
| 4368 | 4380 | * |
| 4369 | 4381 | * @param array $args { |
| 4370 | 4382 | * An array of callable exporters of personal data. Default empty array. |
| 4371 | | * [ |
| 4372 | | * callback string Callable exporter that accepts an email address and |
| 4373 | | * a page and returns an array of name => value |
| 4374 | | * pairs of personal data. |
| 4375 | | * exporter_friendly_name string Translated user facing friendly name for the exporter. |
| 4376 | | * ] |
| | 4383 | * |
| | 4384 | * @type array { |
| | 4385 | * Array of personal data exporters. |
| | 4386 | * |
| | 4387 | * @type string $callback Callable exporter function that accepts an |
| | 4388 | * email address and a page and returns an array |
| | 4389 | * of name => value pairs of personal data. |
| | 4390 | * @type string $exporter_friendly_name Translated user facing friendly name for the |
| | 4391 | * exporter. |
| | 4392 | * } |
| 4377 | 4393 | * } |
| 4378 | 4394 | */ |
| 4379 | 4395 | $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() ); |
| 4380 | 4396 | |
| 4381 | 4397 | if ( ! is_array( $exporters ) ) { |
| 4382 | | wp_send_json_error( 'An exporter has improperly used the registration filter.' ); |
| | 4398 | wp_send_json_error( __( 'An exporter has improperly used the registration filter.' ) ); |
| 4383 | 4399 | } |
| 4384 | 4400 | |
| 4385 | 4401 | // Do we have any registered exporters? |
| 4386 | 4402 | if ( 0 < count( $exporters ) ) { |
| 4387 | 4403 | if ( $exporter_index < 1 ) { |
| 4388 | | wp_send_json_error( 'Exporter index cannot be negative.' ); |
| | 4404 | wp_send_json_error( __( 'Exporter index cannot be negative.' ) ); |
| 4389 | 4405 | } |
| 4390 | 4406 | |
| 4391 | 4407 | if ( $exporter_index > count( $exporters ) ) { |
| 4392 | | wp_send_json_error( 'Exporter index out of range.' ); |
| | 4408 | wp_send_json_error( __( 'Exporter index out of range.' ) ); |
| 4393 | 4409 | } |
| 4394 | 4410 | |
| 4395 | 4411 | $index = $exporter_index - 1; |
| 4396 | 4412 | |
| 4397 | 4413 | if ( $page < 1 ) { |
| 4398 | | wp_send_json_error( 'Page index cannot be less than one.' ); |
| | 4414 | wp_send_json_error( __( 'Page index cannot be less than one.' ) ); |
| 4399 | 4415 | } |
| 4400 | 4416 | |
| 4401 | 4417 | $exporter = $exporters[ $index ]; |
| 4402 | 4418 | |
| 4403 | 4419 | if ( ! is_array( $exporter ) ) { |
| 4404 | | wp_send_json_error( "Expected an array describing the exporter at index {$exporter_index}." ); |
| | 4420 | wp_send_json_error( |
| | 4421 | sprintf( |
| | 4422 | /* translators: %d: array index */ |
| | 4423 | __( 'Expected an array describing the exporter at index %d.' ), |
| | 4424 | $exporter_index |
| | 4425 | ) |
| | 4426 | ); |
| 4405 | 4427 | } |
| 4406 | 4428 | if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) { |
| 4407 | | wp_send_json_error( "Exporter array at index {$exporter_index} does not include a friendly name." ); |
| | 4429 | wp_send_json_error( |
| | 4430 | sprintf( |
| | 4431 | /* translators: %d: array index */ |
| | 4432 | __( 'Exporter array at index %d does not include a friendly name.' ), |
| | 4433 | $exporter_index |
| | 4434 | ) |
| | 4435 | ); |
| 4408 | 4436 | } |
| 4409 | 4437 | if ( ! array_key_exists( 'callback', $exporter ) ) { |
| 4410 | | wp_send_json_error( "Exporter does not include a callback: {$exporter['exporter_friendly_name']}." ); |
| | 4438 | wp_send_json_error( |
| | 4439 | sprintf( |
| | 4440 | /* translators: %s: exporter friendly name */ |
| | 4441 | __( 'Exporter does not include a callback: %s.' ), |
| | 4442 | $exporter['exporter_friendly_name'] |
| | 4443 | ) |
| | 4444 | ); |
| 4411 | 4445 | } |
| 4412 | 4446 | if ( ! is_callable( $exporter['callback'] ) ) { |
| 4413 | | wp_send_json_error( "Exporter callback is not a valid callback: {$exporter['exporter_friendly_name']}." ); |
| | 4447 | wp_send_json_error( |
| | 4448 | sprintf( |
| | 4449 | /* translators: %s: exporter friendly name */ |
| | 4450 | __( 'Exporter callback is not a valid callback: %s.' ), |
| | 4451 | $exporter['exporter_friendly_name'] |
| | 4452 | ) |
| | 4453 | ); |
| 4414 | 4454 | } |
| 4415 | 4455 | |
| 4416 | | $callback = $exporters[ $index ]['callback']; |
| | 4456 | $callback = $exporters[ $index ]['callback']; |
| 4417 | 4457 | $exporter_friendly_name = $exporters[ $index ]['exporter_friendly_name']; |
| 4418 | 4458 | |
| 4419 | 4459 | $response = call_user_func( $callback, $email_address, $page ); |
| … |
… |
function wp_ajax_wp_privacy_export_personal_data() { |
| 4422 | 4462 | } |
| 4423 | 4463 | |
| 4424 | 4464 | if ( ! is_array( $response ) ) { |
| 4425 | | wp_send_json_error( "Expected response as an array from exporter: {$exporter_friendly_name}." ); |
| | 4465 | wp_send_json_error( |
| | 4466 | sprintf( |
| | 4467 | /* translators: %s: exporter friendly name */ |
| | 4468 | __( 'Expected response as an array from exporter: %s.' ), |
| | 4469 | $exporter_friendly_name |
| | 4470 | ) |
| | 4471 | ); |
| 4426 | 4472 | } |
| 4427 | 4473 | if ( ! array_key_exists( 'data', $response ) ) { |
| 4428 | | wp_send_json_error( "Expected data in response array from exporter: {$exporter_friendly_name}." ); |
| | 4474 | wp_send_json_error( |
| | 4475 | sprintf( |
| | 4476 | /* translators: %s: exporter friendly name */ |
| | 4477 | __( 'Expected data in response array from exporter: %s.' ), |
| | 4478 | $exporter_friendly_name |
| | 4479 | ) |
| | 4480 | ); |
| 4429 | 4481 | } |
| 4430 | 4482 | if ( ! is_array( $response['data'] ) ) { |
| 4431 | | wp_send_json_error( "Expected data array in response array from exporter: {$exporter_friendly_name}." ); |
| | 4483 | wp_send_json_error( |
| | 4484 | sprintf( |
| | 4485 | /* translators: %s: exporter friendly name */ |
| | 4486 | __( 'Expected data array in response array from exporter: %s.' ), |
| | 4487 | $exporter_friendly_name |
| | 4488 | ) |
| | 4489 | ); |
| 4432 | 4490 | } |
| 4433 | 4491 | if ( ! array_key_exists( 'done', $response ) ) { |
| 4434 | | wp_send_json_error( "Expected done (boolean) in response array from exporter: {$exporter_friendly_name}." ); |
| | 4492 | wp_send_json_error( |
| | 4493 | sprintf( |
| | 4494 | /* translators: %s: exporter friendly name */ |
| | 4495 | __( 'Expected done (boolean) in response array from exporter: %s.' ), |
| | 4496 | $exporter_friendly_name |
| | 4497 | ) |
| | 4498 | ); |
| 4435 | 4499 | } |
| 4436 | 4500 | } else { |
| 4437 | 4501 | // No exporters, so we're done. |
| … |
… |
function wp_ajax_wp_privacy_export_personal_data() { |
| 4448 | 4512 | * |
| 4449 | 4513 | * @since 4.9.6 |
| 4450 | 4514 | * |
| 4451 | | * @param array $response The personal data for the given exporter and page. |
| 4452 | | * @param int $exporter_index The index of the exporter that provided this data. |
| 4453 | | * @param string $email_address The email address associated with this personal data. |
| 4454 | | * @param int $page The zero-based page for this response. |
| 4455 | | * @param int $request_id The privacy request post ID associated with this request. |
| 4456 | | * @param bool $send_as_email Whether the final results of the export should be emailed to the user. |
| | 4515 | * @param array|WP_Error $response The personal data for the given exporter and page. WP_Error on failure. |
| | 4516 | * @param int $exporter_index The index of the exporter that provided this data. |
| | 4517 | * @param string $email_address The email address associated with this personal data. |
| | 4518 | * @param int $page The page for this response. |
| | 4519 | * @param int $request_id The privacy request post ID associated with this request. |
| | 4520 | * @param bool $send_as_email Whether the final results of the export should be emailed to the user. |
| 4457 | 4521 | */ |
| 4458 | 4522 | $response = apply_filters( 'wp_privacy_personal_data_export_page', $response, $exporter_index, $email_address, $page, $request_id, $send_as_email ); |
| 4459 | 4523 | |
| … |
… |
function wp_ajax_wp_privacy_export_personal_data() { |
| 4470 | 4534 | * @since 4.9.6 |
| 4471 | 4535 | */ |
| 4472 | 4536 | function wp_ajax_wp_privacy_erase_personal_data() { |
| 4473 | | $request_id = (int) $_POST['id']; |
| 4474 | 4537 | |
| 4475 | | if ( empty( $request_id ) ) { |
| 4476 | | wp_send_json_error( __( 'Error: Invalid request ID.' ) ); |
| | 4538 | if ( ! isset( $_POST['id'] ) ) { |
| | 4539 | wp_send_json_error( __( 'Missing request ID.' ) ); |
| | 4540 | } |
| | 4541 | $request_id = (int) $_POST['id']; |
| | 4542 | |
| | 4543 | if ( $request_id < 0 ) { |
| | 4544 | wp_send_json_error( __( 'Invalid request ID.' ) ); |
| 4477 | 4545 | } |
| 4478 | 4546 | |
| 4479 | 4547 | if ( ! current_user_can( 'delete_users' ) ) { |
| 4480 | | wp_send_json_error( __( 'Error: Invalid request.' ) ); |
| | 4548 | wp_send_json_error( __( 'Invalid request.' ) ); |
| 4481 | 4549 | } |
| 4482 | 4550 | |
| 4483 | 4551 | check_ajax_referer( 'wp-privacy-erase-personal-data-' . $request_id, 'security' ); |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4486 | 4554 | $request = wp_get_user_request_data( $request_id ); |
| 4487 | 4555 | |
| 4488 | 4556 | if ( ! $request || 'remove_personal_data' !== $request->action_name ) { |
| 4489 | | wp_send_json_error( __( 'Error: Invalid request ID.' ) ); |
| | 4557 | wp_send_json_error( __( 'Invalid request ID.' ) ); |
| 4490 | 4558 | } |
| 4491 | 4559 | |
| 4492 | 4560 | $email_address = $request->email; |
| 4493 | 4561 | |
| 4494 | 4562 | if ( ! is_email( $email_address ) ) { |
| 4495 | | wp_send_json_error( __( 'Error: Invalid email address in request.' ) ); |
| | 4563 | wp_send_json_error( __( 'Invalid email address in request.' ) ); |
| 4496 | 4564 | } |
| 4497 | 4565 | |
| | 4566 | if ( ! isset( $_POST['eraser'] ) ) { |
| | 4567 | wp_send_json_error( __( 'Missing eraser index.' ) ); |
| | 4568 | } |
| 4498 | 4569 | $eraser_index = (int) $_POST['eraser']; |
| 4499 | | $page = (int) $_POST['page']; |
| | 4570 | |
| | 4571 | if ( ! isset( $_POST['page'] ) ) { |
| | 4572 | wp_send_json_error( __( 'Missing page index.' ) ); |
| | 4573 | } |
| | 4574 | $page = (int) $_POST['page']; |
| 4500 | 4575 | |
| 4501 | 4576 | /** |
| 4502 | 4577 | * Filters the array of personal data eraser callbacks. |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4505 | 4580 | * |
| 4506 | 4581 | * @param array $args { |
| 4507 | 4582 | * 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 | | * ] |
| | 4583 | * @type array { |
| | 4584 | * Array of personal data exporters. |
| | 4585 | * |
| | 4586 | * @type string $callback Callable eraser that accepts an email address and |
| | 4587 | * a page and returns an array with the number of items |
| | 4588 | * removed, the number of items retained and any messages |
| | 4589 | * from the eraser, as well as if additional pages are |
| | 4590 | * available. |
| | 4591 | * @type string $exporter_friendly_name Translated user facing friendly name for the eraser. |
| | 4592 | * } |
| 4516 | 4593 | * } |
| 4517 | 4594 | */ |
| 4518 | 4595 | $erasers = apply_filters( 'wp_privacy_personal_data_erasers', array() ); |
| 4519 | 4596 | |
| 4520 | 4597 | // Do we have any registered erasers? |
| 4521 | 4598 | if ( 0 < count( $erasers ) ) { |
| | 4599 | |
| 4522 | 4600 | if ( $eraser_index < 1 ) { |
| 4523 | | wp_send_json_error( __( 'Error: Eraser index cannot be less than one.' ) ); |
| | 4601 | wp_send_json_error( __( 'Eraser index cannot be less than one.' ) ); |
| 4524 | 4602 | } |
| 4525 | 4603 | |
| 4526 | 4604 | if ( $eraser_index > count( $erasers ) ) { |
| 4527 | | wp_send_json_error( __( 'Error: Eraser index is out of range.' ) ); |
| | 4605 | wp_send_json_error( __( 'Eraser index is out of range.' ) ); |
| 4528 | 4606 | } |
| 4529 | 4607 | |
| 4530 | 4608 | if ( $page < 1 ) { |
| 4531 | | wp_send_json_error( __( 'Error: Page index cannot be less than one.' ) ); |
| | 4609 | wp_send_json_error( __( 'Page index cannot be less than one.' ) ); |
| 4532 | 4610 | } |
| 4533 | 4611 | |
| 4534 | | $index = $eraser_index - 1; // Convert to zero based for eraser index |
| | 4612 | $index = $eraser_index - 1; // Convert to zero based for eraser index. |
| 4535 | 4613 | $eraser = $erasers[ $index ]; |
| 4536 | 4614 | if ( ! is_array( $eraser ) ) { |
| 4537 | 4615 | wp_send_json_error( |
| 4538 | 4616 | sprintf( |
| 4539 | | __( 'Error: Expected an array describing the eraser at index %d.' ), |
| | 4617 | /* translators: %d: array index */ |
| | 4618 | __( 'Expected an array describing the eraser at index %d.' ), |
| 4540 | 4619 | $eraser_index |
| 4541 | 4620 | ) |
| 4542 | 4621 | ); |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4544 | 4623 | if ( ! array_key_exists( 'callback', $eraser ) ) { |
| 4545 | 4624 | wp_send_json_error( |
| 4546 | 4625 | sprintf( |
| 4547 | | __( 'Error: Eraser array at index %d does not include a callback.' ), |
| | 4626 | /* translators: %d: array index */ |
| | 4627 | __( 'Eraser array at index %d does not include a callback.' ), |
| 4548 | 4628 | $eraser_index |
| 4549 | 4629 | ) |
| 4550 | 4630 | ); |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4552 | 4632 | if ( ! is_callable( $eraser['callback'] ) ) { |
| 4553 | 4633 | wp_send_json_error( |
| 4554 | 4634 | sprintf( |
| 4555 | | __( 'Error: Eraser callback at index %d is not a valid callback.' ), |
| | 4635 | /* translators: %d: array index */ |
| | 4636 | __( 'Eraser callback at index %d is not a valid callback.' ), |
| 4556 | 4637 | $eraser_index |
| 4557 | 4638 | ) |
| 4558 | 4639 | ); |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4560 | 4641 | if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) { |
| 4561 | 4642 | wp_send_json_error( |
| 4562 | 4643 | sprintf( |
| 4563 | | __( 'Error: Eraser array at index %d does not include a friendly name.' ), |
| | 4644 | /* translators: %d: array index */ |
| | 4645 | __( 'Eraser array at index %d does not include a friendly name.' ), |
| 4564 | 4646 | $eraser_index |
| 4565 | 4647 | ) |
| 4566 | 4648 | ); |
| 4567 | 4649 | } |
| 4568 | 4650 | |
| 4569 | | $callback = $erasers[ $index ]['callback']; |
| | 4651 | $callback = $erasers[ $index ]['callback']; |
| 4570 | 4652 | $eraser_friendly_name = $erasers[ $index ]['eraser_friendly_name']; |
| 4571 | 4653 | |
| 4572 | 4654 | $response = call_user_func( $callback, $email_address, $page ); |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4577 | 4659 | if ( ! is_array( $response ) ) { |
| 4578 | 4660 | wp_send_json_error( |
| 4579 | 4661 | sprintf( |
| 4580 | | __( 'Error: Did not receive array from %s eraser (index %d).' ), |
| | 4662 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4663 | __( 'Did not receive array from %1$s eraser (index %2$d).' ), |
| 4581 | 4664 | $eraser_friendly_name, |
| 4582 | 4665 | $eraser_index |
| 4583 | 4666 | ) |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4586 | 4669 | if ( ! array_key_exists( 'num_items_removed', $response ) ) { |
| 4587 | 4670 | wp_send_json_error( |
| 4588 | 4671 | sprintf( |
| 4589 | | __( 'Error: Expected num_items_removed key in response array from %s eraser (index %d).' ), |
| | 4672 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4673 | __( 'Expected num_items_removed key in response array from %1$s eraser (index %2$d).' ), |
| 4590 | 4674 | $eraser_friendly_name, |
| 4591 | 4675 | $eraser_index |
| 4592 | 4676 | ) |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4595 | 4679 | if ( ! array_key_exists( 'num_items_retained', $response ) ) { |
| 4596 | 4680 | wp_send_json_error( |
| 4597 | 4681 | sprintf( |
| 4598 | | __( 'Error: Expected num_items_retained key in response array from %s eraser (index %d).' ), |
| | 4682 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4683 | __( 'Expected num_items_retained key in response array from %1$s eraser (index %2$d).' ), |
| 4599 | 4684 | $eraser_friendly_name, |
| 4600 | 4685 | $eraser_index |
| 4601 | 4686 | ) |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4604 | 4689 | if ( ! array_key_exists( 'messages', $response ) ) { |
| 4605 | 4690 | wp_send_json_error( |
| 4606 | 4691 | sprintf( |
| 4607 | | __( 'Error: Expected messages key in response array from %s eraser (index %d).' ), |
| | 4692 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4693 | __( 'Expected messages key in response array from %1$s eraser (index %2$d).' ), |
| 4608 | 4694 | $eraser_friendly_name, |
| 4609 | 4695 | $eraser_index |
| 4610 | 4696 | ) |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4613 | 4699 | if ( ! is_array( $response['messages'] ) ) { |
| 4614 | 4700 | wp_send_json_error( |
| 4615 | 4701 | sprintf( |
| 4616 | | __( 'Error: Expected messages key to reference an array in response array from %s eraser (index %d).' ), |
| | 4702 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4703 | __( 'Expected messages key to reference an array in response array from %1$s eraser (index %2$d).' ), |
| 4617 | 4704 | $eraser_friendly_name, |
| 4618 | 4705 | $eraser_index |
| 4619 | 4706 | ) |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4622 | 4709 | if ( ! array_key_exists( 'done', $response ) ) { |
| 4623 | 4710 | wp_send_json_error( |
| 4624 | 4711 | sprintf( |
| 4625 | | __( 'Error: Expected done flag in response array from %s eraser (index %d).' ), |
| | 4712 | /* translators: %1$s: eraser friendly name, %2$d: array index */ |
| | 4713 | __( 'Expected done flag in response array from %1$s eraser (index %2$d).' ), |
| 4626 | 4714 | $eraser_friendly_name, |
| 4627 | 4715 | $eraser_index |
| 4628 | 4716 | ) |
| 4629 | 4717 | ); |
| 4630 | 4718 | } |
| 4631 | 4719 | } else { |
| 4632 | | // No erasers, so we're done |
| | 4720 | // No erasers, so we're done. |
| 4633 | 4721 | $response = array( |
| 4634 | | 'num_items_removed' => 0, |
| | 4722 | 'num_items_removed' => 0, |
| 4635 | 4723 | 'num_items_retained' => 0, |
| 4636 | | 'messages' => array(), |
| 4637 | | 'done' => true, |
| | 4724 | 'messages' => array(), |
| | 4725 | 'done' => true, |
| 4638 | 4726 | ); |
| 4639 | 4727 | } |
| 4640 | 4728 | |
| … |
… |
function wp_ajax_wp_privacy_erase_personal_data() { |
| 4645 | 4733 | * |
| 4646 | 4734 | * @since 4.9.6 |
| 4647 | 4735 | * |
| 4648 | | * @param array $response The personal data for the given exporter and page. |
| 4649 | | * @param int $exporter_index The index of the exporter that provided this data. |
| 4650 | | * @param string $email_address The email address associated with this personal data. |
| 4651 | | * @param int $page The zero-based page for this response. |
| 4652 | | * @param int $request_id The privacy request post ID associated with this request. |
| | 4736 | * @param array|WP_Error $response The personal data for the given exporter and page. WP_Error on failure. |
| | 4737 | * @param int $exporter_index The index of the exporter that provided this data. |
| | 4738 | * @param string $email_address The email address associated with this personal data. |
| | 4739 | * @param int $page The page for this response. |
| | 4740 | * @param int $request_id The privacy request post ID associated with this request. |
| 4653 | 4741 | */ |
| 4654 | 4742 | $response = apply_filters( 'wp_privacy_personal_data_erasure_page', $response, $eraser_index, $email_address, $page, $request_id ); |
| | 4743 | |
| 4655 | 4744 | if ( is_wp_error( $response ) ) { |
| 4656 | 4745 | wp_send_json_error( $response ); |
| 4657 | 4746 | } |