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. Built from https://develop.svn.wordpress.org/trunk@48477 git-svn-id: http://core.svn.wordpress.org/trunk@48246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2c92383b8d
commit
fdd88e24ed
|
@ -2167,17 +2167,19 @@ function user_can_access_admin_page() {
|
||||||
* See the {@see 'allowed_options'} filter.
|
* See the {@see 'allowed_options'} filter.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
|
* @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
|
||||||
|
* Please consider writing more inclusive code.
|
||||||
*
|
*
|
||||||
* @global array $new_whitelist_options
|
* @global array $new_allowed_options
|
||||||
*
|
*
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function option_update_filter( $options ) {
|
function option_update_filter( $options ) {
|
||||||
global $new_whitelist_options;
|
global $new_allowed_options;
|
||||||
|
|
||||||
if ( is_array( $new_whitelist_options ) ) {
|
if ( is_array( $new_allowed_options ) ) {
|
||||||
$options = add_allowed_options( $new_whitelist_options, $options );
|
$options = add_allowed_options( $new_allowed_options, $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
|
|
|
@ -2123,8 +2123,10 @@ function register_initial_settings() {
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
* @since 4.7.0 `$args` can be passed to set flags on the setting, similar to `register_meta()`.
|
* @since 4.7.0 `$args` can be passed to set flags on the setting, similar to `register_meta()`.
|
||||||
|
* @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
|
||||||
|
* Please consider writing more inclusive code.
|
||||||
*
|
*
|
||||||
* @global array $new_whitelist_options
|
* @global array $new_allowed_options
|
||||||
* @global array $wp_registered_settings
|
* @global array $wp_registered_settings
|
||||||
*
|
*
|
||||||
* @param string $option_group A settings group name. Should correspond to an allowed option key name.
|
* @param string $option_group A settings group name. Should correspond to an allowed option key name.
|
||||||
|
@ -2145,7 +2147,13 @@ function register_initial_settings() {
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
function register_setting( $option_group, $option_name, $args = array() ) {
|
function register_setting( $option_group, $option_name, $args = array() ) {
|
||||||
global $new_whitelist_options, $wp_registered_settings;
|
global $new_allowed_options, $wp_registered_settings;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In 5.5.0, the `$new_whitelist_options` global variable was renamed to `$new_allowed_options`.
|
||||||
|
* Please consider writing more inclusive code.
|
||||||
|
*/
|
||||||
|
$GLOBALS['new_whitelist_options'] = &$new_allowed_options;
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
|
@ -2211,7 +2219,7 @@ function register_setting( $option_group, $option_name, $args = array() ) {
|
||||||
$option_group = 'reading';
|
$option_group = 'reading';
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_whitelist_options[ $option_group ][] = $option_name;
|
$new_allowed_options[ $option_group ][] = $option_name;
|
||||||
|
|
||||||
if ( ! empty( $args['sanitize_callback'] ) ) {
|
if ( ! empty( $args['sanitize_callback'] ) ) {
|
||||||
add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] );
|
add_filter( "sanitize_option_{$option_name}", $args['sanitize_callback'] );
|
||||||
|
@ -2239,8 +2247,10 @@ function register_setting( $option_group, $option_name, $args = array() ) {
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
* @since 4.7.0 `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead.
|
* @since 4.7.0 `$sanitize_callback` was deprecated. The callback from `register_setting()` is now used instead.
|
||||||
|
* @since 5.5.0 `$new_whitelist_options` was renamed to `$new_allowed_options`.
|
||||||
|
* Please consider writing more inclusive code.
|
||||||
*
|
*
|
||||||
* @global array $new_whitelist_options
|
* @global array $new_allowed_options
|
||||||
* @global array $wp_registered_settings
|
* @global array $wp_registered_settings
|
||||||
*
|
*
|
||||||
* @param string $option_group The settings group name used during registration.
|
* @param string $option_group The settings group name used during registration.
|
||||||
|
@ -2248,7 +2258,13 @@ function register_setting( $option_group, $option_name, $args = array() ) {
|
||||||
* @param callable $deprecated Deprecated.
|
* @param callable $deprecated Deprecated.
|
||||||
*/
|
*/
|
||||||
function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
|
function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
|
||||||
global $new_whitelist_options, $wp_registered_settings;
|
global $new_allowed_options, $wp_registered_settings;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In 5.5.0, the `$new_whitelist_options` global variable was renamed to `$new_allowed_options`.
|
||||||
|
* Please consider writing more inclusive code.
|
||||||
|
*/
|
||||||
|
$GLOBALS['new_whitelist_options'] = &$new_allowed_options;
|
||||||
|
|
||||||
if ( 'misc' === $option_group ) {
|
if ( 'misc' === $option_group ) {
|
||||||
_deprecated_argument(
|
_deprecated_argument(
|
||||||
|
@ -2276,10 +2292,10 @@ function unregister_setting( $option_group, $option_name, $deprecated = '' ) {
|
||||||
$option_group = 'reading';
|
$option_group = 'reading';
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ], true );
|
$pos = array_search( $option_name, (array) $new_allowed_options[ $option_group ], true );
|
||||||
|
|
||||||
if ( false !== $pos ) {
|
if ( false !== $pos ) {
|
||||||
unset( $new_whitelist_options[ $option_group ][ $pos ] );
|
unset( $new_allowed_options[ $option_group ][ $pos ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( '' !== $deprecated ) {
|
if ( '' !== $deprecated ) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-beta1-48476';
|
$wp_version = '5.5-beta1-48477';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue