WordPress.org

Make WordPress Core

Changeset 48477


Ignore:
Timestamp:
07/14/2020 12:31:22 PM (2 months ago)
Author:
desrosj
Message:

General: Rename the $new_whitelist_options global variable.

This change renames $new_whitelist_options to $new_allowed_options. This makes the variable’s purpose more clear, and promotes using more inclusive language.

For backwards compatibility, the new variable is passed by reference to the old one.

Follow up to [48121].

Props ayeshrajans, desrosj, jorbin, SergeyBiryukov.
See #50413.
Fixes #50434.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/plugin.php

    r48326 r48477  
    21682168 *
    21692169 * @since 2.7.0
    2170  *
    2171  * @global array $new_whitelist_options
     2170 * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
     2171 *              Please consider writing more inclusive code.
     2172 *
     2173 * @global array $new_allowed_options
    21722174 *
    21732175 * @param array $options
     
    21752177 */
    21762178function option_update_filter( $options ) {
    2177     global $new_whitelist_options;
    2178 
    2179     if ( is_array( $new_whitelist_options ) ) {
    2180         $options = add_allowed_options( $new_whitelist_options, $options );
     2179    global $new_allowed_options;
     2180
     2181    if ( is_array( $new_allowed_options ) ) {
     2182        $options = add_allowed_options( $new_allowed_options, $options );
    21812183    }
    21822184
  • trunk/src/wp-includes/option.php

    r48321 r48477  
    21242124 * @since 2.7.0
    21252125 * @since 4.7.0 `$args` can be passed to set flags on the setting, similar to `register_meta()`.
    2126  *
    2127  * @global array $new_whitelist_options
     2126 * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
     2127 *              Please consider writing more inclusive code.
     2128 *
     2129 * @global array $new_allowed_options
    21282130 * @global array $wp_registered_settings
    21292131 *
     
    21462148 */
    21472149function register_setting( $option_group, $option_name, $args = array() ) {
    2148     global $new_whitelist_options, $wp_registered_settings;
     2150    global $new_allowed_options, $wp_registered_settings;
     2151
     2152    /*
     2153     * In 5.5.0, the `$new_whitelist_options` global variable was renamed to `$new_allowed_options`.
     2154     * Please consider writing more inclusive code.
     2155     */
     2156    $GLOBALS['new_whitelist_options'] = &$new_allowed_options;
    21492157
    21502158    $defaults = array(
     
    22122220    }
    22132221
    2214     $new_whitelist_options[ $option_group ][] = $option_name;
     2222    $new_allowed_options[ $option_group ][] = $option_name;
    22152223
    22162224    if ( ! empty( $args['sanitize_callback'] ) ) {
     
    22402248 * @since 2.7.0
    22412249 * @since 4.7.0 `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead.
    2242  *
    2243  * @global array $new_whitelist_options
     2250 * @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
     2251 *              Please consider writing more inclusive code.
     2252 *
     2253 * @global array $new_allowed_options
    22442254 * @global array $wp_registered_settings
    22452255 *
     
    22492259 */
    22502260function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
    2251     global $new_whitelist_options, $wp_registered_settings;
     2261    global $new_allowed_options, $wp_registered_settings;
     2262
     2263    /*
     2264     * In 5.5.0, the `$new_whitelist_options` global variable was renamed to `$new_allowed_options`.
     2265     * Please consider writing more inclusive code.
     2266     */
     2267    $GLOBALS['new_whitelist_options'] = &$new_allowed_options;
    22522268
    22532269    if ( 'misc' === $option_group ) {
     
    22772293    }
    22782294
    2279     $pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ], true );
     2295    $pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true );
    22802296
    22812297    if ( false !== $pos ) {
    2282         unset( $new_whitelist_options[ $option_group ][ $pos ] );
     2298        unset( $new_allowed_options[ $option_group ][ $pos ] );
    22832299    }
    22842300
Note: See TracChangeset for help on using the changeset viewer.