Make WordPress Core


Ignore:
Timestamp:
05/16/2023 03:59:15 PM (4 months ago)
Author:
audrasjb
Message:

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

File:
1 edited

Legend:

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

    r52471 r55789  
    23672367
    23682368/**
     2369 * Strips out all characters not allowed in a locale name.
     2370 *
     2371 * @since 6.2.1
     2372 *
     2373 * @param string $locale_name The locale name to be sanitized.
     2374 * @return string The sanitized value.
     2375 */
     2376function sanitize_locale_name( $locale_name ) {
     2377    // Limit to A-Z, a-z, 0-9, '_', '-'.
     2378    $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $locale_name );
     2379
     2380    /**
     2381     * Filters a sanitized locale name string.
     2382     *
     2383     * @since 6.2.1
     2384     *
     2385     * @param string $sanitized   The sanitized locale name.
     2386     * @param string $locale_name The locale name before sanitization.
     2387     */
     2388    return apply_filters( 'sanitize_locale_name', $sanitized, $locale_name );
     2389}
     2390
     2391/**
    23692392 * Converts lone & characters into `&` (a.k.a. `&`)
    23702393 *
Note: See TracChangeset for help on using the changeset viewer.