Making WordPress.org


Ignore:
Timestamp:
04/03/2024 07:01:21 AM (6 months ago)
Author:
dd32
Message:

Plugin Directory: Store error codes (rather than english error messages) that occur during a plugin import, to allow the errors to be generated with the appropriate translations.

This expands some errors to better highlight what is invalid as well.

See #6108.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r13335 r13443  
    721721    $import_warnings = get_post_meta( $post->ID, '_import_warnings', true );
    722722    if ( $import_warnings ) {
     723
     724        if ( ! wp_is_numeric_array( $import_warnings ) ) {
     725            // error_code => error_data, convert to error_code => human_readable_error
     726
     727            foreach ( $import_warnings as $error_code => $error_data ) {
     728                $import_warnings[ $error_code ] = Readme_Validator::instance()->translate_code_to_message( $error_code, $error_data );
     729            }
     730        } else {
     731            // back-compat; previously this was an array of numeric indexed human-readable strings.
     732        }
     733
    723734        $import_warnings  = '<ul><li>' . implode( '</li><li>', $import_warnings ) . '</li></ul>';
    724735        printf(
Note: See TracChangeset for help on using the changeset viewer.