mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 06:05:42 +00:00
General: Update code for readability and inclusion
There are two pieces in here: 1) The update to change blacklist to blocklist is moved to disallowed_list. "Block" has a meaning in our code, and there could be ambiguity between this code and code related to blocks. 2) This improves backwards compatibility for code that was accessing the now deprecated code. Previously: [48477], [48405], [48400], [48121], [48122], [48124], [48142], [48566] Props: desrosj, SergeyBiryukov, johnjamesjacoby Fixes: #50413 git-svn-id: https://develop.svn.wordpress.org/trunk@48575 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -35,6 +35,29 @@ function get_option( $option, $default = false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Until a proper _deprecated_option() function can be introduced,
|
||||
* redirect requests to deprecated keys to the new, correct ones.
|
||||
*/
|
||||
$deprecated_keys = array(
|
||||
'blacklist_keys' => 'disallowed_keys',
|
||||
'comment_whitelist' => 'comment_previously_approved',
|
||||
);
|
||||
|
||||
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) {
|
||||
_deprecated_argument(
|
||||
__FUNCTION__,
|
||||
'5.5.0',
|
||||
sprintf(
|
||||
/* translators: 1: Deprecated option key, 2: New option key. */
|
||||
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
|
||||
$option,
|
||||
$deprecated_keys[ $option ]
|
||||
)
|
||||
);
|
||||
return get_option( $deprecated_keys[ $option ], $default );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the value of an existing option before it is retrieved.
|
||||
*
|
||||
@@ -313,6 +336,29 @@ function update_option( $option, $value, $autoload = null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Until a proper _deprecated_option() function can be introduced,
|
||||
* redirect requests to deprecated keys to the new, correct ones.
|
||||
*/
|
||||
$deprecated_keys = array(
|
||||
'blacklist_keys' => 'disallowed_keys',
|
||||
'comment_whitelist' => 'comment_previously_approved',
|
||||
);
|
||||
|
||||
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) {
|
||||
_deprecated_argument(
|
||||
__FUNCTION__,
|
||||
'5.5.0',
|
||||
sprintf(
|
||||
/* translators: 1: Deprecated option key, 2: New option key. */
|
||||
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
|
||||
$option,
|
||||
$deprecated_keys[ $option ]
|
||||
)
|
||||
);
|
||||
return update_option( $deprecated_keys[ $option ], $value, $autoload );
|
||||
}
|
||||
|
||||
wp_protect_special_option( $option );
|
||||
|
||||
if ( is_object( $value ) ) {
|
||||
@@ -477,6 +523,29 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Until a proper _deprecated_option() function can be introduced,
|
||||
* redirect requests to deprecated keys to the new, correct ones.
|
||||
*/
|
||||
$deprecated_keys = array(
|
||||
'blacklist_keys' => 'disallowed_keys',
|
||||
'comment_whitelist' => 'comment_previously_approved',
|
||||
);
|
||||
|
||||
if ( ! wp_installing() && isset( $deprecated_keys[ $option ] ) ) {
|
||||
_deprecated_argument(
|
||||
__FUNCTION__,
|
||||
'5.5.0',
|
||||
sprintf(
|
||||
/* translators: 1: Deprecated option key, 2: New option key. */
|
||||
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
|
||||
$option,
|
||||
$deprecated_keys[ $option ]
|
||||
)
|
||||
);
|
||||
return add_option( $deprecated_keys[ $option ], $value, $deprecated, $autoload );
|
||||
}
|
||||
|
||||
wp_protect_special_option( $option );
|
||||
|
||||
if ( is_object( $value ) ) {
|
||||
|
||||
Reference in New Issue
Block a user