General: Rename (add|remove)_option_allowed_list()
to (add|remove)_allowed_option()
.
The new names make the purpose more clear. It also adds consistency with the `$allowed_options` global variable. Also in this change, the `wp-deprecated` dependency has been removed from the password strength meter in favor of a `window.console.log()` call to avoid adding 3 dependencies for one deprecated notice. Props SergeyBiryukov, ocean90, desrosj Fixes #50413. git-svn-id: https://develop.svn.wordpress.org/trunk@48142 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5f6ab44340
commit
19c9963d9d
@ -6,6 +6,8 @@
|
|||||||
window.wp = window.wp || {};
|
window.wp = window.wp || {};
|
||||||
|
|
||||||
(function($){
|
(function($){
|
||||||
|
var __ = wp.i18n.__,
|
||||||
|
sprintf = wp.i18n.sprintf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains functions to determine the password strength.
|
* Contains functions to determine the password strength.
|
||||||
@ -58,11 +60,15 @@ window.wp = window.wp || {};
|
|||||||
* @return {string[]} The array of words to be disallowed.
|
* @return {string[]} The array of words to be disallowed.
|
||||||
*/
|
*/
|
||||||
userInputBlacklist : function() {
|
userInputBlacklist : function() {
|
||||||
wp.deprecated( 'wp.passwordStrength.userInputBlacklist()', {
|
window.console.log(
|
||||||
alternative: 'wp.passwordStrength.userInputDisallowedList()',
|
sprintf(
|
||||||
plugin: 'WordPress',
|
/* translators: 1: Deprecated JSfunction name, 2: Version number, 3: Alternative function name. */
|
||||||
hint: wp.i18n.__( 'Please consider writing more inclusive code.' )
|
__( '%1$s is deprecated since version %2$s! Use %3$s instead. Please consider writing more inclusive code.' ),
|
||||||
} );
|
'wp.passwordStrength.userInputBlacklist()',
|
||||||
|
'5.5.0',
|
||||||
|
'wp.passwordStrength.userInputDisallowedList()'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return wp.passwordStrength.userInputDisallowedList();
|
return wp.passwordStrength.userInputDisallowedList();
|
||||||
},
|
},
|
||||||
|
@ -2154,7 +2154,7 @@ function option_update_filter( $options ) {
|
|||||||
global $new_whitelist_options;
|
global $new_whitelist_options;
|
||||||
|
|
||||||
if ( is_array( $new_whitelist_options ) ) {
|
if ( is_array( $new_whitelist_options ) ) {
|
||||||
$options = add_option_allowed_list( $new_whitelist_options, $options );
|
$options = add_allowed_options( $new_whitelist_options, $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
@ -2171,7 +2171,7 @@ function option_update_filter( $options ) {
|
|||||||
* @param string|array $options
|
* @param string|array $options
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function add_option_allowed_list( $new_options, $options = '' ) {
|
function add_allowed_options( $new_options, $options = '' ) {
|
||||||
if ( '' === $options ) {
|
if ( '' === $options ) {
|
||||||
global $allowed_options;
|
global $allowed_options;
|
||||||
} else {
|
} else {
|
||||||
|
@ -4042,7 +4042,7 @@ function _wp_register_meta_args_whitelist( $args, $default_args ) {
|
|||||||
* Adds an array of options to the list of allowed options.
|
* Adds an array of options to the list of allowed options.
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
* @deprecated 5.5.0 Use add_option_allowed_list() instead.
|
* @deprecated 5.5.0 Use add_allowed_options() instead.
|
||||||
* Please consider writing more inclusive code.
|
* Please consider writing more inclusive code.
|
||||||
*
|
*
|
||||||
* @global array $allowed_options
|
* @global array $allowed_options
|
||||||
@ -4052,9 +4052,9 @@ function _wp_register_meta_args_whitelist( $args, $default_args ) {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function add_option_whitelist( $new_options, $options = '' ) {
|
function add_option_whitelist( $new_options, $options = '' ) {
|
||||||
_deprecated_function( __FUNCTION__, '5.5.0', 'add_option_allowed_list()' );
|
_deprecated_function( __FUNCTION__, '5.5.0', 'add_allowed_options()' );
|
||||||
|
|
||||||
return add_option_allowed_list( $new_options, $options );
|
return add_allowed_options( $new_options, $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1064,7 +1064,7 @@ function wp_default_scripts( $scripts ) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'wp-deprecated', 'zxcvbn-async' ), false, 1 );
|
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
|
||||||
did_action( 'init' ) && $scripts->localize(
|
did_action( 'init' ) && $scripts->localize(
|
||||||
'password-strength-meter',
|
'password-strength-meter',
|
||||||
'pwsL10n',
|
'pwsL10n',
|
||||||
|
Loading…
Reference in New Issue
Block a user