Make WordPress Core


Ignore:
Timestamp:
05/16/2023 04:02:16 PM (3 years ago)
Author:
SergeyBiryukov
Message:

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

File:
1 edited

Legend:

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

    r52473 r55791  
    21142114     */
    21152115    return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
     2116}
     2117
     2118/**
     2119 * Strips out all characters not allowed in a locale name.
     2120 *
     2121 * @since 6.2.1
     2122 *
     2123 * @param string $locale_name The locale name to be sanitized.
     2124 * @return string The sanitized value.
     2125 */
     2126function sanitize_locale_name( $locale_name ) {
     2127    // Limit to A-Z, a-z, 0-9, '_', '-'.
     2128    $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $locale_name );
     2129
     2130    /**
     2131     * Filters a sanitized locale name string.
     2132     *
     2133     * @since 6.2.1
     2134     *
     2135     * @param string $sanitized   The sanitized locale name.
     2136     * @param string $locale_name The locale name before sanitization.
     2137     */
     2138    return apply_filters( 'sanitize_locale_name', $sanitized, $locale_name );
    21162139}
    21172140
Note: See TracChangeset for help on using the changeset viewer.