Make WordPress Core


Ignore:
Timestamp:
05/16/2023 03:35:46 PM (18 months ago)
Author:
audrasjb
Message:

Grouped backports to the 5.7 branch.

  • Media: Prevent CSRF setting attachment thumbnails.
  • Embeds: Add protocol validation for WordPress Embed code.
  • I18N: Introduce sanitization function for locale.
  • Editor: Ensure block comments are of a valid form.

Merges [55760-55764] to the 5.7 branch.
Props dd32, isabel_brison, martinkrcho, matveb, ocean90, paulkevan, peterwilsoncc, timothyblynjacobs, xknown, youknowriad.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.7/src/wp-includes/formatting.php

    r52466 r55778  
    23732373
    23742374/**
     2375 * Strips out all characters not allowed in a locale name.
     2376 *
     2377 * @since 6.2.1
     2378 *
     2379 * @param string $locale_name The locale name to be sanitized.
     2380 * @return string The sanitized value.
     2381 */
     2382function sanitize_locale_name( $locale_name ) {
     2383    // Limit to A-Z, a-z, 0-9, '_', '-'.
     2384    $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $locale_name );
     2385
     2386    /**
     2387     * Filters a sanitized locale name string.
     2388     *
     2389     * @since 6.2.1
     2390     *
     2391     * @param string $sanitized   The sanitized locale name.
     2392     * @param string $locale_name The locale name before sanitization.
     2393     */
     2394    return apply_filters( 'sanitize_locale_name', $sanitized, $locale_name );
     2395}
     2396
     2397/**
    23752398 * Converts lone & characters into `&` (a.k.a. `&`)
    23762399 *
Note: See TracChangeset for help on using the changeset viewer.