Make WordPress Core


Ignore:
Timestamp:
06/22/2020 05:24:34 PM (6 years ago)
Author:
desrosj
Message:

General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.

“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the $new_whitelist_options global variable) are removed. A new ticket has been opened to explore renaming the $new_whitelist_options variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.

File:
1 edited

Legend:

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

    r48115 r48121  
    8181}
    8282
    83 $whitelist_options            = array(
     83$allowed_options            = array(
    8484    'general'    => array(
    8585        'blogname',
     
    101101        'comment_moderation',
    102102        'require_name_email',
    103         'comment_whitelist',
     103        'comment_previously_approved',
    104104        'comment_max_links',
    105105        'moderation_keys',
    106         'blacklist_keys',
     106        'blocklist_keys',
    107107        'show_avatars',
    108108        'avatar_rating',
     
    147147    ),
    148148);
    149 $whitelist_options['misc']    = array();
    150 $whitelist_options['options'] = array();
    151 $whitelist_options['privacy'] = array();
     149$allowed_options['misc']    = array();
     150$allowed_options['options'] = array();
     151$allowed_options['privacy'] = array();
    152152
    153153$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
    154154
    155155if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
    156     $whitelist_options['reading'][] = 'blog_charset';
     156    $allowed_options['reading'][] = 'blog_charset';
    157157}
    158158
    159159if ( get_site_option( 'initial_db_version' ) < 32453 ) {
    160     $whitelist_options['writing'][] = 'use_smilies';
    161     $whitelist_options['writing'][] = 'use_balanceTags';
     160    $allowed_options['writing'][] = 'use_smilies';
     161    $allowed_options['writing'][] = 'use_balanceTags';
    162162}
    163163
    164164if ( ! is_multisite() ) {
    165165    if ( ! defined( 'WP_SITEURL' ) ) {
    166         $whitelist_options['general'][] = 'siteurl';
     166        $allowed_options['general'][] = 'siteurl';
    167167    }
    168168    if ( ! defined( 'WP_HOME' ) ) {
    169         $whitelist_options['general'][] = 'home';
    170     }
    171 
    172     $whitelist_options['general'][] = 'users_can_register';
    173     $whitelist_options['general'][] = 'default_role';
    174 
    175     $whitelist_options['writing']   = array_merge( $whitelist_options['writing'], $mail_options );
    176     $whitelist_options['writing'][] = 'ping_sites';
    177 
    178     $whitelist_options['media'][] = 'uploads_use_yearmonth_folders';
     169        $allowed_options['general'][] = 'home';
     170    }
     171
     172    $allowed_options['general'][] = 'users_can_register';
     173    $allowed_options['general'][] = 'default_role';
     174
     175    $allowed_options['writing']   = array_merge( $allowed_options['writing'], $mail_options );
     176    $allowed_options['writing'][] = 'ping_sites';
     177
     178    $allowed_options['media'][] = 'uploads_use_yearmonth_folders';
    179179
    180180    /*
     
    184184     */
    185185    if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) {
    186         $whitelist_options['media'][] = 'upload_path';
    187         $whitelist_options['media'][] = 'upload_url_path';
     186        $allowed_options['media'][] = 'upload_path';
     187        $allowed_options['media'][] = 'upload_url_path';
    188188    }
    189189} else {
     
    196196     */
    197197    if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
    198         $whitelist_options['writing'] = array_merge( $whitelist_options['writing'], $mail_options );
     198        $allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
    199199    }
    200200}
    201201
    202202/**
    203  * Filters the options whitelist.
     203 * Filters the allowed options list.
    204204 *
    205205 * @since 2.7.0
    206  *
    207  * @param array $whitelist_options The options whitelist.
     206 * @deprecated 5.5.0 Use {@see 'allowed_options'} instead.
     207 *
     208 * @param array $allowed_options The allowed options list.
    208209 */
    209 $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
     210$allowed_options = apply_filters_deprecated( 'whitelist_options', array( $allowed_options ), '5.5.0', 'apply_filters_deprecated', __( 'Please consider writing more inclusive code.' ) );
     211
     212/**
     213 * Filters the allowed options list.
     214 *
     215 * @since 5.5.0
     216 *
     217 * @param array $allowed_options The allowed options list.
     218 */
     219$allowed_options = apply_filters( 'allowed_options', $allowed_options );
    210220
    211221if ( 'update' === $action ) { // We are saving settings sent from a settings page.
     
    218228    }
    219229
    220     if ( ! isset( $whitelist_options[ $option_page ] ) ) {
     230    if ( ! isset( $allowed_options[ $option_page ] ) ) {
    221231        wp_die(
    222232            sprintf(
    223233                /* translators: %s: The options page name. */
    224                 __( '<strong>Error</strong>: Options page %s not found in the options whitelist.' ),
     234                __( '<strong>Error</strong>: Options page %s not found in the allowed options list.' ),
    225235                '<code>' . esc_html( $option_page ) . '</code>'
    226236            )
     
    234244        $options = explode( ',', wp_unslash( $_POST['page_options'] ) );
    235245    } else {
    236         $options = $whitelist_options[ $option_page ];
     246        $options = $allowed_options[ $option_page ];
    237247    }
    238248
Note: See TracChangeset for help on using the changeset viewer.