Making WordPress.org


Ignore:
Timestamp:
03/09/2019 01:13:13 PM (7 years ago)
Author:
ocean90
Message:

Rosetta: Check if the provided locale exists before adding the association.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/rosetta/inc/admin/network/class-locale-associations.php

    r6641 r8430  
    119119        $subdomain = sanitize_text_field( $_POST['subdomain'] );
    120120
     121        if ( 0 !== strpos( $locale, 'test' ) ) {
     122            $locales = get_available_languages();
     123            if ( ! in_array( $locale, $locales, true ) ) {
     124                return new WP_Error( 'locale_does_not_exist' );
     125            }
     126        }
     127
    121128        $result = $wpdb->insert( Tables::LOCALES, [
    122129            'locale'    => $locale,
Note: See TracChangeset for help on using the changeset viewer.