Make WordPress Core

Ticket #43438: 43438.7.diff

File 43438.7.diff, 5.4 KB (added by desrosj, 7 years ago)
  • src/wp-admin/includes/ajax-actions.php

     
    43534353        }
    43544354
    43554355        $email_address = $request->email;
    4356         if ( ! is_email( $email_address ) ) {
     4356        if ( ! is_email( strtolower( $email_address ) ) ) {
    43574357                wp_send_json_error( __( 'Error: A valid email address must be given.' ) );
    43584358        }
    43594359
     
    43684368         *
    43694369         * @param array $args {
    43704370         *     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          *     ]
     4371         *
     4372         *     @type array {
     4373         *         Array of personal data exporters.
     4374         *
     4375         *         @type string $callback               Callable exporter function that accepts an
     4376         *                                              email address and a page and returns an array
     4377         *                                              of name => value pairs of personal data.
     4378         *         @type string $exporter_friendly_name Translated user facing friendly name for the
     4379         *                                              exporter.
     4380         *     }
    43774381         * }
    43784382         */
    43794383        $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
    43804384
    43814385        if ( ! is_array( $exporters ) ) {
    4382                 wp_send_json_error( 'An exporter has improperly used the registration filter.' );
     4386                wp_send_json_error( __( 'An exporter has improperly used the registration filter.' ) );
    43834387        }
    43844388
    43854389        // Do we have any registered exporters?
    43864390        if ( 0 < count( $exporters ) ) {
    43874391                if ( $exporter_index < 1 ) {
    4388                         wp_send_json_error( 'Exporter index cannot be negative.' );
     4392                        wp_send_json_error( __( 'Exporter index cannot be negative.' ) );
    43894393                }
    43904394
    43914395                if ( $exporter_index > count( $exporters ) ) {
    4392                         wp_send_json_error( 'Exporter index out of range.' );
     4396                        wp_send_json_error( __( 'Exporter index out of range.' ) );
    43934397                }
    43944398
    43954399                $index = $exporter_index - 1;
    43964400
    43974401                if ( $page < 1 ) {
    4398                         wp_send_json_error( 'Page index cannot be less than one.' );
     4402                        wp_send_json_error( __( 'Page index cannot be less than one.' ) );
    43994403                }
    44004404
    44014405                $exporter = $exporters[ $index ];
    44024406
    44034407                if ( ! is_array( $exporter ) ) {
    4404                         wp_send_json_error( "Expected an array describing the exporter at index {$exporter_index}." );
     4408                        wp_send_json_error(
     4409                                sprintf(
     4410                                        /* translators: %s: array index */
     4411                                        __( 'Expected an array describing the exporter at index %s.' ),
     4412                                        $exporter_index
     4413                                )
     4414                        );
    44054415                }
    44064416                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." );
     4417                        wp_send_json_error(
     4418                                sprintf(
     4419                                        /* translators: %s: array index */
     4420                                        __( 'Exporter array at index %s does not include a friendly name.' ),
     4421                                        $exporter_index
     4422                                )
     4423                        );
    44084424                }
    44094425                if ( ! array_key_exists( 'callback', $exporter ) ) {
    4410                         wp_send_json_error( "Exporter does not include a callback: {$exporter['exporter_friendly_name']}." );
     4426                        wp_send_json_error(
     4427                                sprintf(
     4428                                        /* translators: %s: exporter friendly name */
     4429                                        __( 'Exporter does not include a callback: %s.' ),
     4430                                        $exporter['exporter_friendly_name']
     4431                                )
     4432                        );
    44114433                }
    44124434                if ( ! is_callable( $exporter['callback'] ) ) {
    4413                         wp_send_json_error( "Exporter callback is not a valid callback: {$exporter['exporter_friendly_name']}." );
     4435                        wp_send_json_error(
     4436                                sprintf(
     4437                                        /* translators: %s: exporter friendly name */
     4438                                        __( 'Exporter callback is not a valid callback: %s.' ),
     4439                                        $exporter['exporter_friendly_name']
     4440                                )
     4441                        );
    44144442                }
    44154443
    44164444                $callback = $exporters[ $index ]['callback'];
     
    44224450                }
    44234451
    44244452                if ( ! is_array( $response ) ) {
    4425                         wp_send_json_error( "Expected response as an array from exporter: {$exporter_friendly_name}." );
     4453                        wp_send_json_error(
     4454                                sprintf(
     4455                                        /* translators: %s: exporter friendly name */
     4456                                        __( 'Expected response as an array from exporter: %s.' ),
     4457                                        $exporter_friendly_name
     4458                                )
     4459                        );
    44264460                }
    44274461                if ( ! array_key_exists( 'data', $response ) ) {
    4428                         wp_send_json_error( "Expected data in response array from exporter: {$exporter_friendly_name}." );
     4462                        wp_send_json_error(
     4463                                sprintf(
     4464                                        /* translators: %s: exporter friendly name */
     4465                                        __( 'Expected data in response array from exporter: %s.' ),
     4466                                        $exporter_friendly_name
     4467                                )
     4468                        );
    44294469                }
    44304470                if ( ! is_array( $response['data'] ) ) {
    4431                         wp_send_json_error( "Expected data array in response array from exporter: {$exporter_friendly_name}." );
     4471                        wp_send_json_error(
     4472                                sprintf(
     4473                                        /* translators: %s: exporter friendly name */
     4474                                        __( 'Expected data array in response array from exporter: %s.' ),
     4475                                        $exporter_friendly_name
     4476                                )
     4477                        );
    44324478                }
    44334479                if ( ! array_key_exists( 'done', $response ) ) {
    4434                         wp_send_json_error( "Expected done (boolean) in response array from exporter: {$exporter_friendly_name}." );
     4480                        wp_send_json_error(
     4481                                sprintf(
     4482                                        /* translators: %s: exporter friendly name */
     4483                                        __( 'Expected done (boolean) in response array from exporter: %s.' ),
     4484                                        $exporter_friendly_name
     4485                                )
     4486                        );
    44354487                }
    44364488        } else {
    44374489                // No exporters, so we're done.