Make WordPress Core

Changeset 44908


Ignore:
Timestamp:
03/15/2019 06:06:08 PM (8 years ago)
Author:
desrosj
Message:

Privacy: Improve data export/erasure error messages and translator comments.

These changes address inaccuracies in current messages and makes them more informative.

Props birgire, garrett-eclipse, desrosj.
See #43438.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r44842 r44908  
    45164516
    45174517                if ( $exporter_index > count( $exporters ) ) {
    4518                         wp_send_json_error( __( 'Exporter index out of range.' ) );
     4518                        wp_send_json_error( __( 'Exporter index is out of range.' ) );
    45194519                }
    45204520
    … …  
    45294529                if ( ! is_array( $exporter ) ) {
    45304530                        wp_send_json_error(
    4531                                 /* translators: %s: array index */
     4531                                /* translators: %s: exporter array index */
    45324532                                sprintf( __( 'Expected an array describing the exporter at index %s.' ), $exporter_key )
    45334533                        );
    … …  
    45354535                if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) {
    45364536                        wp_send_json_error(
    4537                                 /* translators: %s: array index */
     4537                                /* translators: %s: exporter array index */
    45384538                                sprintf( __( 'Exporter array at index %s does not include a friendly name.' ), $exporter_key )
    45394539                        );
    45404540                }
     4541
     4542                $exporter_friendly_name = $exporter['exporter_friendly_name'];
     4543
    45414544                if ( ! array_key_exists( 'callback', $exporter ) ) {
    45424545                        wp_send_json_error(
    45434546                                /* translators: %s: exporter friendly name */
    4544                                 sprintf( __( 'Exporter does not include a callback: %s.' ), esc_html( $exporter['exporter_friendly_name'] ) )
     4547                                sprintf( __( 'Exporter does not include a callback: %s.' ), esc_html( $exporter_friendly_name ) )
    45454548                        );
    45464549                }
    … …  
    45484551                        wp_send_json_error(
    45494552                                /* translators: %s: exporter friendly name */
    4550                                 sprintf( __( 'Exporter callback is not a valid callback: %s.' ), esc_html( $exporter['exporter_friendly_name'] ) )
     4553                                sprintf( __( 'Exporter callback is not a valid callback: %s.' ), esc_html( $exporter_friendly_name ) )
    45514554                        );
    45524555                }
    45534556
    4554                 $callback               = $exporter['callback'];
    4555                 $exporter_friendly_name = $exporter['exporter_friendly_name'];
    4556 
     4557                $callback = $exporter['callback'];
    45574558                $response = call_user_func( $callback, $email_address, $page );
     4559
    45584560                if ( is_wp_error( $response ) ) {
    45594561                        wp_send_json_error( $response );
    … …  
    46464648
    46474649        if ( ! $request || 'remove_personal_data' !== $request->action_name ) {
    4648                 wp_send_json_error( __( 'Invalid request ID.' ) );
     4650                wp_send_json_error( __( 'Invalid request type.' ) );
    46494651        }
    46504652
    … …  
    47094711
    47104712                if ( ! is_array( $eraser ) ) {
    4711                         /* translators: %d: array index */
     4713                        /* translators: %d: eraser array index */
    47124714                        wp_send_json_error( sprintf( __( 'Expected an array describing the eraser at index %d.' ), $eraser_index ) );
    47134715                }
    47144716
     4717                if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) {
     4718                        /* translators: %d: eraser array index */
     4719                        wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a friendly name.' ), $eraser_index ) );
     4720                }
     4721
     4722                $eraser_friendly_name = $eraser['eraser_friendly_name'];
     4723
    47154724                if ( ! array_key_exists( 'callback', $eraser ) ) {
    4716                         /* translators: %d: array index */
    4717                         wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a callback.' ), $eraser_index ) );
     4725                        wp_send_json_error(
     4726                                sprintf(
     4727                                        /* translators: %s: eraser friendly name */
     4728                                        __( 'Eraser does not include a callback: %s.' ),
     4729                                        esc_html( $eraser_friendly_name )
     4730                                )
     4731                        );
    47184732                }
    47194733
    47204734                if ( ! is_callable( $eraser['callback'] ) ) {
    4721                         /* translators: %d: array index */
    4722                         wp_send_json_error( sprintf( __( 'Eraser callback at index %d is not a valid callback.' ), $eraser_index ) );
    4723                 }
    4724 
    4725                 if ( ! array_key_exists( 'eraser_friendly_name', $eraser ) ) {
    4726                         /* translators: %d: array index */
    4727                         wp_send_json_error( sprintf( __( 'Eraser array at index %d does not include a friendly name.' ), $eraser_index ) );
    4728                 }
    4729 
    4730                 $callback             = $eraser['callback'];
    4731                 $eraser_friendly_name = $eraser['eraser_friendly_name'];
    4732 
     4735                        wp_send_json_error(
     4736                                sprintf(
     4737                                        /* translators: %s: eraser friendly name */
     4738                                        __( 'Eraser callback is not valid: %s.' ),
     4739                                        esc_html( $eraser_friendly_name )
     4740                                )
     4741                        );
     4742                }
     4743
     4744                $callback = $eraser['callback'];
    47334745                $response = call_user_func( $callback, $email_address, $page );
    47344746
    … …  
    47404752                        wp_send_json_error(
    47414753                                sprintf(
    4742                                         /* translators: 1: eraser friendly name, 2: array index */
     4754                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47434755                                        __( 'Did not receive array from %1$s eraser (index %2$d).' ),
    47444756                                        esc_html( $eraser_friendly_name ),
    … …  
    47514763                        wp_send_json_error(
    47524764                                sprintf(
    4753                                         /* translators: 1: eraser friendly name, 2: array index */
     4765                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47544766                                        __( 'Expected items_removed key in response array from %1$s eraser (index %2$d).' ),
    47554767                                        esc_html( $eraser_friendly_name ),
    … …  
    47624774                        wp_send_json_error(
    47634775                                sprintf(
    4764                                         /* translators: 1: eraser friendly name, 2: array index */
     4776                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47654777                                        __( 'Expected items_retained key in response array from %1$s eraser (index %2$d).' ),
    47664778                                        esc_html( $eraser_friendly_name ),
    … …  
    47734785                        wp_send_json_error(
    47744786                                sprintf(
    4775                                         /* translators: 1: eraser friendly name, 2: array index */
     4787                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47764788                                        __( 'Expected messages key in response array from %1$s eraser (index %2$d).' ),
    47774789                                        esc_html( $eraser_friendly_name ),
    … …  
    47844796                        wp_send_json_error(
    47854797                                sprintf(
    4786                                         /* translators: 1: eraser friendly name, 2: array index */
     4798                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47874799                                        __( 'Expected messages key to reference an array in response array from %1$s eraser (index %2$d).' ),
    47884800                                        esc_html( $eraser_friendly_name ),
    … …  
    47954807                        wp_send_json_error(
    47964808                                sprintf(
    4797                                         /* translators: 1: eraser friendly name, 2: array index */
     4809                                        /* translators: 1: eraser friendly name, 2: eraser array index */
    47984810                                        __( 'Expected done flag in response array from %1$s eraser (index %2$d).' ),
    47994811                                        esc_html( $eraser_friendly_name ),
Note: See TracChangeset for help on using the changeset viewer.