diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 4e66b28bb8..7f9e09e0ed 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -74,7 +74,7 @@ add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' ); add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' ); // Plugin hooks. -add_filter( 'whitelist_options', 'option_update_filter' ); +add_filter( 'allowed_options', 'option_update_filter' ); // Plugin Install hooks. add_action( 'install_plugins_featured', 'install_dashboard' ); diff --git a/wp-admin/includes/class-wp-plugins-list-table.php b/wp-admin/includes/class-wp-plugins-list-table.php index 094ff1b97e..b2b74d65db 100644 --- a/wp-admin/includes/class-wp-plugins-list-table.php +++ b/wp-admin/includes/class-wp-plugins-list-table.php @@ -47,10 +47,10 @@ class WP_Plugins_List_Table extends WP_List_Table { ) ); - $status_whitelist = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' ); + $allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' ); $status = 'all'; - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $status_whitelist, true ) ) { + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) { $status = $_REQUEST['plugin_status']; } diff --git a/wp-admin/includes/class-wp-site-health.php b/wp-admin/includes/class-wp-site-health.php index 7f69cca53c..3beb111bb4 100644 --- a/wp-admin/includes/class-wp-site-health.php +++ b/wp-admin/includes/class-wp-site-health.php @@ -1776,8 +1776,9 @@ class WP_Site_Health { /** * Test if HTTP requests are blocked. * - * It's possible to block all outgoing communication (with the possibility of whitelisting hosts) via the - * HTTP API. This may create problems for users as many features are running as services these days. + * It's possible to block all outgoing communication (with the possibility of allowing certain + * hosts) via the HTTP API. This may create problems for users as many features are running as + * services these days. * * @since 5.2.0 * @@ -1833,8 +1834,8 @@ class WP_Site_Health { $result['description'] .= sprintf( '

%s

', sprintf( - /* translators: 1: Name of the constant used. 2: List of hostnames whitelisted. */ - __( 'HTTP requests have been blocked by the %1$s constant, with some hosts whitelisted: %2$s.' ), + /* translators: 1: Name of the constant used. 2: List of allowed hostnames. */ + __( 'HTTP requests have been blocked by the %1$s constant, with some allowed hosts: %2$s.' ), 'WP_HTTP_BLOCK_EXTERNAL', implode( ',', $hosts ) ) diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index a9abf670a5..47201332dd 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -159,8 +159,8 @@ function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $le * @deprecated 3.0.0 Use register_setting() * @see register_setting() * - * @param string $option_group A settings group name. Should correspond to a whitelisted option key name. - * Default whitelisted option key names include 'general', 'discussion', 'media', + * @param string $option_group A settings group name. Should correspond to an allowed option key name. + * Default allowed option key names include 'general', 'discussion', 'media', * 'reading', 'writing', 'misc', 'options', and 'privacy'. * @param string $option_name The name of an option to sanitize and save. * @param callable $sanitize_callback A callback function that sanitizes the option's value. @@ -1530,7 +1530,7 @@ class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Reque $args['screen'] = 'export-personal-data'; } - parent::__construct( $args ); + parent::__construct( $args ); } } diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 8f0b39f9dd..3492b15ee2 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -2136,12 +2136,12 @@ function user_can_access_admin_page() { return true; } -/* Whitelist functions */ +/* Allowed list functions */ /** - * Refreshes the value of the options whitelist available via the 'whitelist_options' hook. + * Refreshes the value of the allowed options list available via the 'allowed_options' hook. * - * See the {@see 'whitelist_options'} filter. + * See the {@see 'allowed_options'} filter. * * @since 2.7.0 * @@ -2154,77 +2154,77 @@ function option_update_filter( $options ) { global $new_whitelist_options; if ( is_array( $new_whitelist_options ) ) { - $options = add_option_whitelist( $new_whitelist_options, $options ); + $options = add_option_allowed_list( $new_whitelist_options, $options ); } return $options; } /** - * Adds an array of options to the options whitelist. + * Adds an array of options to the list of allowed options. * * @since 2.7.0 * - * @global array $whitelist_options + * @global array $allowed_options * * @param array $new_options * @param string|array $options * @return array */ -function add_option_whitelist( $new_options, $options = '' ) { +function add_option_allowed_list( $new_options, $options = '' ) { if ( '' === $options ) { - global $whitelist_options; + global $allowed_options; } else { - $whitelist_options = $options; + $allowed_options = $options; } foreach ( $new_options as $page => $keys ) { foreach ( $keys as $key ) { - if ( ! isset( $whitelist_options[ $page ] ) || ! is_array( $whitelist_options[ $page ] ) ) { - $whitelist_options[ $page ] = array(); - $whitelist_options[ $page ][] = $key; + if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) { + $allowed_options[ $page ] = array(); + $allowed_options[ $page ][] = $key; } else { - $pos = array_search( $key, $whitelist_options[ $page ], true ); + $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false === $pos ) { - $whitelist_options[ $page ][] = $key; + $allowed_options[ $page ][] = $key; } } } } - return $whitelist_options; + return $allowed_options; } /** - * Removes a list of options from the options whitelist. + * Removes a list of options from the allowed options list. * - * @since 2.7.0 + * @since 5.5.0 * - * @global array $whitelist_options + * @global array $allowed_options * * @param array $del_options * @param string|array $options * @return array */ -function remove_option_whitelist( $del_options, $options = '' ) { +function remove_option_allowed_list( $del_options, $options = '' ) { if ( '' === $options ) { - global $whitelist_options; + global $allowed_options; } else { - $whitelist_options = $options; + $allowed_options = $options; } foreach ( $del_options as $page => $keys ) { foreach ( $keys as $key ) { - if ( isset( $whitelist_options[ $page ] ) && is_array( $whitelist_options[ $page ] ) ) { - $pos = array_search( $key, $whitelist_options[ $page ], true ); + if ( isset( $allowed_options[ $page ] ) && is_array( $allowed_options[ $page ] ) ) { + $pos = array_search( $key, $allowed_options[ $page ], true ); if ( false !== $pos ) { - unset( $whitelist_options[ $page ][ $pos ] ); + unset( $allowed_options[ $page ][ $pos ] ); } } } } - return $whitelist_options; + return $allowed_options; } /** diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index e6ad6da6e6..907f92b46a 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -2234,7 +2234,7 @@ function get_block_categories( $post ) { function get_block_editor_server_block_settings() { $block_registry = WP_Block_Type_Registry::get_instance(); $blocks = array(); - $fields_to_pick = array( + $fields_to_pick = array( 'title' => 'title', 'description' => 'description', 'icon' => 'icon', diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 616c63349c..1104b99871 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -446,8 +446,6 @@ function populate_options( array $options = array() ) { 'recently_edited' => '', 'template' => $template, 'stylesheet' => $stylesheet, - 'comment_whitelist' => 1, - 'blacklist_keys' => '', 'comment_registration' => 0, 'html_type' => 'text/html', @@ -532,6 +530,10 @@ function populate_options( array $options = array() ) { // 5.3.0 'admin_email_lifespan' => ( time() + 6 * MONTH_IN_SECONDS ), + + // 5.5.0 + 'blocklist_keys' => '', + 'comment_previously_approved' => 1, ); // 3.3.0 @@ -550,7 +552,7 @@ function populate_options( array $options = array() ) { $options = wp_parse_args( $options, $defaults ); // Set autoload to no for these options. - $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); + $fat_options = array( 'moderation_keys', 'recently_edited', 'blocklist_keys', 'uninstall_plugins' ); $keys = "'" . implode( "', '", array_keys( $options ) ) . "'"; $existing_options = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name in ( $keys )" ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared @@ -1140,7 +1142,7 @@ function populate_network_meta( $network_id, array $meta = array() ) { $allowed_themes[ WP_DEFAULT_THEME ] = true; } - // If WP_DEFAULT_THEME doesn't exist, also whitelist the latest core default theme. + // If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme. if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) { $core_default = WP_Theme::get_core_default_theme(); if ( $core_default ) { diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index be125f913e..3f45ea6f9b 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -835,7 +835,7 @@ function upgrade_all() { upgrade_530(); } - if ( $wp_current_db_version < 47597 ) { + if ( $wp_current_db_version < 48082 ) { upgrade_550(); } @@ -2168,6 +2168,15 @@ function upgrade_530() { function upgrade_550() { update_option( 'finished_updating_comment_type', 0 ); wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' ); + + // Use more clear and inclusive language. + $blocklist = get_option( 'blacklist_keys', '' ); + update_option( 'blocklist_keys', $blocklist ); + delete_option( 'blacklist_keys' ); + + $comment_previously_approved = get_option( 'comment_whitelist', '' ); + update_option( 'comment_previously_approved', $comment_previously_approved ); + delete_option( 'comment_whitelist' ); } /** diff --git a/wp-admin/js/password-strength-meter.js b/wp-admin/js/password-strength-meter.js index 135095910c..2678d5b9b5 100644 --- a/wp-admin/js/password-strength-meter.js +++ b/wp-admin/js/password-strength-meter.js @@ -22,16 +22,16 @@ window.wp = window.wp || {}; * * @since 3.7.0 * - * @param {string} password1 The subject password. - * @param {Array} blacklist An array of words that will lower the entropy of - * the password. - * @param {string} password2 The password confirmation. + * @param {string} password1 The subject password. + * @param {Array} disallowedList An array of words that will lower the entropy of + * the password. + * @param {string} password2 The password confirmation. * * @return {number} The password strength score. */ - meter : function( password1, blacklist, password2 ) { - if ( ! $.isArray( blacklist ) ) - blacklist = [ blacklist.toString() ]; + meter : function( password1, disallowedList, password2 ) { + if ( ! $.isArray( disallowedList ) ) + disallowedList = [ disallowedList.toString() ]; if (password1 != password2 && password2 && password2.length > 0) return 5; @@ -41,7 +41,7 @@ window.wp = window.wp || {}; return -1; } - var result = zxcvbn( password1, blacklist ); + var result = zxcvbn( password1, disallowedList ); return result.score; }, @@ -49,20 +49,43 @@ window.wp = window.wp || {}; * Builds an array of words that should be penalized. * * Certain words need to be penalized because it would lower the entropy of a - * password if they were used. The blacklist is based on user input fields such + * password if they were used. The disallowedList is based on user input fields such * as username, first name, email etc. * * @since 3.7.0 + * @deprecated 5.5.0 Use {@see 'userInputBlockList()'} instead. * - * @return {string[]} The array of words to be blacklisted. + * @return {string[]} The array of words to be disallowed. */ userInputBlacklist : function() { + wp.deprecated( 'wp.passwordStrength.userInputBlacklist()', { + version: '5.5.0', + alternative: 'wp.passwordStrength.userInputDisallowedList()', + plugin: 'WordPress', + hint: wp.i18n.__( 'Please consider writing more inclusive code.' ) + } ); + + return wp.passwordStrength.userInputDisallowedList(); + }, + + /** + * Builds an array of words that should be penalized. + * + * Certain words need to be penalized because it would lower the entropy of a + * password if they were used. The disallowed list is based on user input fields such + * as username, first name, email etc. + * + * @since 5.5.0 + * + * @return {string[]} The array of words to be disallowed. + */ + userInputDisallowedList : function() { var i, userInputFieldsLength, rawValuesLength, currentField, rawValues = [], - blacklist = [], + disallowedList = [], userInputFields = [ 'user_login', 'first_name', 'last_name', 'nickname', 'display_name', 'email', 'url', 'description', 'weblog_title', 'admin_email' ]; - // Collect all the strings we want to blacklist. + // Collect all the strings we want to disallow. rawValues.push( document.title ); rawValues.push( document.URL ); @@ -85,7 +108,7 @@ window.wp = window.wp || {}; rawValuesLength = rawValues.length; for ( i = 0; i < rawValuesLength; i++ ) { if ( rawValues[ i ] ) { - blacklist = blacklist.concat( rawValues[ i ].replace( /\W/g, ' ' ).split( ' ' ) ); + disallowedList = disallowedList.concat( rawValues[ i ].replace( /\W/g, ' ' ).split( ' ' ) ); } } @@ -93,15 +116,15 @@ window.wp = window.wp || {}; * Remove empty values, short words and duplicates. Short words are likely to * cause many false positives. */ - blacklist = $.grep( blacklist, function( value, key ) { + disallowedList = $.grep( disallowedList, function( value, key ) { if ( '' === value || 4 > value.length ) { return false; } - return $.inArray( value, blacklist ) === key; + return $.inArray( value, disallowedList ) === key; }); - return blacklist; + return disallowedList; } }; diff --git a/wp-admin/js/password-strength-meter.min.js b/wp-admin/js/password-strength-meter.min.js index 808d02e959..e768d8327a 100644 --- a/wp-admin/js/password-strength-meter.min.js +++ b/wp-admin/js/password-strength-meter.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -window.wp=window.wp||{},function(l){wp.passwordStrength={meter:function(n,e,t){return l.isArray(e)||(e=[e.toString()]),n!=t&&t&&0]*>/gi,"");n[e].length&&-1===o.inArray(a,t)&&(t.push(a),o("