Make WordPress Core


Ignore:
Timestamp:
05/16/2023 03:50:15 PM (3 years ago)
Author:
audrasjb
Message:

Grouped backports to the 5.4 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.4 branch.
Props dd32, isabel_brison, martinkrcho, matveb, ocean90, paulkevan, peterwilsoncc, timothyblynjacobs, xknown, youknowriad.

File:
1 edited

Legend:

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

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