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:
Jonathan Desrosiers
2020-06-22 17:24:34 +00:00
parent 9e3b322f8f
commit e26394bb2d
60 changed files with 423 additions and 281 deletions

View File

@@ -1282,7 +1282,7 @@ function retrieve_widgets( $theme_changed = false ) {
}
/**
* Compares a list of sidebars with their widgets against a whitelist.
* Compares a list of sidebars with their widgets against an allowed list.
*
* @since 4.9.0
* @since 4.9.2 Always tries to restore widget assignments from previous data, not just if sidebars needed mapping.
@@ -1457,22 +1457,22 @@ function wp_map_sidebars_widgets( $existing_sidebars_widgets ) {
}
/**
* Compares a list of sidebars with their widgets against a whitelist.
* Compares a list of sidebars with their widgets against an allowed list.
*
* @since 4.9.0
*
* @param array $sidebars_widgets List of sidebars and their widget instance IDs.
* @param array $whitelist Optional. List of widget IDs to compare against. Default: Registered widgets.
* @return array Sidebars with whitelisted widgets.
* @param array $sidebars_widgets List of sidebars and their widget instance IDs.
* @param array $allowed_widget_ids Optional. List of widget IDs to compare against. Default: Registered widgets.
* @return array Sidebars with allowed widgets.
*/
function _wp_remove_unregistered_widgets( $sidebars_widgets, $whitelist = array() ) {
if ( empty( $whitelist ) ) {
$whitelist = array_keys( $GLOBALS['wp_registered_widgets'] );
function _wp_remove_unregistered_widgets( $sidebars_widgets, $allowed_widget_ids = array() ) {
if ( empty( $allowed_widget_ids ) ) {
$allowed_widget_ids = array_keys( $GLOBALS['wp_registered_widgets'] );
}
foreach ( $sidebars_widgets as $sidebar => $widgets ) {
if ( is_array( $widgets ) ) {
$sidebars_widgets[ $sidebar ] = array_intersect( $widgets, $whitelist );
$sidebars_widgets[ $sidebar ] = array_intersect( $widgets, $allowed_widget_ids );
}
}