mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@48121 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -80,7 +80,7 @@ if ( is_multisite() && ! current_user_can( 'manage_network_options' ) && 'update
|
||||
);
|
||||
}
|
||||
|
||||
$whitelist_options = array(
|
||||
$allowed_options = array(
|
||||
'general' => array(
|
||||
'blogname',
|
||||
'blogdescription',
|
||||
@@ -100,10 +100,10 @@ $whitelist_options = array(
|
||||
'moderation_notify',
|
||||
'comment_moderation',
|
||||
'require_name_email',
|
||||
'comment_whitelist',
|
||||
'comment_previously_approved',
|
||||
'comment_max_links',
|
||||
'moderation_keys',
|
||||
'blacklist_keys',
|
||||
'blocklist_keys',
|
||||
'show_avatars',
|
||||
'avatar_rating',
|
||||
'avatar_default',
|
||||
@@ -146,36 +146,36 @@ $whitelist_options = array(
|
||||
'default_post_format',
|
||||
),
|
||||
);
|
||||
$whitelist_options['misc'] = array();
|
||||
$whitelist_options['options'] = array();
|
||||
$whitelist_options['privacy'] = array();
|
||||
$allowed_options['misc'] = array();
|
||||
$allowed_options['options'] = array();
|
||||
$allowed_options['privacy'] = array();
|
||||
|
||||
$mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' );
|
||||
|
||||
if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true ) ) {
|
||||
$whitelist_options['reading'][] = 'blog_charset';
|
||||
$allowed_options['reading'][] = 'blog_charset';
|
||||
}
|
||||
|
||||
if ( get_site_option( 'initial_db_version' ) < 32453 ) {
|
||||
$whitelist_options['writing'][] = 'use_smilies';
|
||||
$whitelist_options['writing'][] = 'use_balanceTags';
|
||||
$allowed_options['writing'][] = 'use_smilies';
|
||||
$allowed_options['writing'][] = 'use_balanceTags';
|
||||
}
|
||||
|
||||
if ( ! is_multisite() ) {
|
||||
if ( ! defined( 'WP_SITEURL' ) ) {
|
||||
$whitelist_options['general'][] = 'siteurl';
|
||||
$allowed_options['general'][] = 'siteurl';
|
||||
}
|
||||
if ( ! defined( 'WP_HOME' ) ) {
|
||||
$whitelist_options['general'][] = 'home';
|
||||
$allowed_options['general'][] = 'home';
|
||||
}
|
||||
|
||||
$whitelist_options['general'][] = 'users_can_register';
|
||||
$whitelist_options['general'][] = 'default_role';
|
||||
$allowed_options['general'][] = 'users_can_register';
|
||||
$allowed_options['general'][] = 'default_role';
|
||||
|
||||
$whitelist_options['writing'] = array_merge( $whitelist_options['writing'], $mail_options );
|
||||
$whitelist_options['writing'][] = 'ping_sites';
|
||||
$allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
|
||||
$allowed_options['writing'][] = 'ping_sites';
|
||||
|
||||
$whitelist_options['media'][] = 'uploads_use_yearmonth_folders';
|
||||
$allowed_options['media'][] = 'uploads_use_yearmonth_folders';
|
||||
|
||||
/*
|
||||
* If upload_url_path is not the default (empty),
|
||||
@@ -183,8 +183,8 @@ if ( ! is_multisite() ) {
|
||||
* they can be edited, otherwise they're locked.
|
||||
*/
|
||||
if ( get_option( 'upload_url_path' ) || ( get_option( 'upload_path' ) != 'wp-content/uploads' && get_option( 'upload_path' ) ) ) {
|
||||
$whitelist_options['media'][] = 'upload_path';
|
||||
$whitelist_options['media'][] = 'upload_url_path';
|
||||
$allowed_options['media'][] = 'upload_path';
|
||||
$allowed_options['media'][] = 'upload_url_path';
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
@@ -195,18 +195,28 @@ if ( ! is_multisite() ) {
|
||||
* @param bool $enabled Whether post-by-email configuration is enabled. Default true.
|
||||
*/
|
||||
if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
|
||||
$whitelist_options['writing'] = array_merge( $whitelist_options['writing'], $mail_options );
|
||||
$allowed_options['writing'] = array_merge( $allowed_options['writing'], $mail_options );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the options whitelist.
|
||||
* Filters the allowed options list.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @deprecated 5.5.0 Use {@see 'allowed_options'} instead.
|
||||
*
|
||||
* @param array $whitelist_options The options whitelist.
|
||||
* @param array $allowed_options The allowed options list.
|
||||
*/
|
||||
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
||||
$allowed_options = apply_filters_deprecated( 'whitelist_options', array( $allowed_options ), '5.5.0', 'apply_filters_deprecated', __( 'Please consider writing more inclusive code.' ) );
|
||||
|
||||
/**
|
||||
* Filters the allowed options list.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param array $allowed_options The allowed options list.
|
||||
*/
|
||||
$allowed_options = apply_filters( 'allowed_options', $allowed_options );
|
||||
|
||||
if ( 'update' === $action ) { // We are saving settings sent from a settings page.
|
||||
if ( 'options' === $option_page && ! isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
|
||||
@@ -217,11 +227,11 @@ if ( 'update' === $action ) { // We are saving settings sent from a settings pag
|
||||
check_admin_referer( $option_page . '-options' );
|
||||
}
|
||||
|
||||
if ( ! isset( $whitelist_options[ $option_page ] ) ) {
|
||||
if ( ! isset( $allowed_options[ $option_page ] ) ) {
|
||||
wp_die(
|
||||
sprintf(
|
||||
/* translators: %s: The options page name. */
|
||||
__( '<strong>Error</strong>: Options page %s not found in the options whitelist.' ),
|
||||
__( '<strong>Error</strong>: Options page %s not found in the allowed options list.' ),
|
||||
'<code>' . esc_html( $option_page ) . '</code>'
|
||||
)
|
||||
);
|
||||
@@ -233,7 +243,7 @@ if ( 'update' === $action ) { // We are saving settings sent from a settings pag
|
||||
}
|
||||
$options = explode( ',', wp_unslash( $_POST['page_options'] ) );
|
||||
} else {
|
||||
$options = $whitelist_options[ $option_page ];
|
||||
$options = $allowed_options[ $option_page ];
|
||||
}
|
||||
|
||||
if ( 'general' === $option_page ) {
|
||||
|
||||
Reference in New Issue
Block a user