mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
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:
@@ -10,15 +10,15 @@
|
||||
* Check whether a comment passes internal checks to be allowed to add.
|
||||
*
|
||||
* If manual comment moderation is set in the administration, then all checks,
|
||||
* regardless of their type and whitelist, will fail and the function will
|
||||
* regardless of their type and substance, will fail and the function will
|
||||
* return false.
|
||||
*
|
||||
* If the number of links exceeds the amount in the administration, then the
|
||||
* check fails. If any of the parameter contents match the blacklist of words,
|
||||
* check fails. If any of the parameter contents contain any disallowed words,
|
||||
* then the check fails.
|
||||
*
|
||||
* If the comment author was approved before, then the comment is automatically
|
||||
* whitelisted.
|
||||
* approved.
|
||||
*
|
||||
* If all checks pass, the function will return true.
|
||||
*
|
||||
@@ -126,7 +126,7 @@ function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent,
|
||||
* as well as whether there are any moderation keywords (if set) present in the author
|
||||
* email address. If both checks pass, return true. Otherwise, return false.
|
||||
*/
|
||||
if ( 1 == get_option( 'comment_whitelist' ) ) {
|
||||
if ( 1 == get_option( 'comment_previously_approved' ) ) {
|
||||
if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) {
|
||||
$comment_user = get_user_by( 'email', wp_unslash( $email ) );
|
||||
if ( ! empty( $comment_user->ID ) ) {
|
||||
@@ -815,7 +815,7 @@ function wp_allow_comment( $commentdata, $avoid_die = false ) {
|
||||
$approved = 0;
|
||||
}
|
||||
|
||||
if ( wp_blacklist_check(
|
||||
if ( wp_blocklist_check(
|
||||
$commentdata['comment_author'],
|
||||
$commentdata['comment_author_email'],
|
||||
$commentdata['comment_author_url'],
|
||||
@@ -1262,9 +1262,9 @@ function wp_check_comment_data_max_lengths( $comment_data ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Does comment contain blacklisted characters or words.
|
||||
* Checks if a comment contains disallowed characters or words.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $author The author of the comment
|
||||
* @param string $email The email of the comment
|
||||
@@ -1272,13 +1272,14 @@ function wp_check_comment_data_max_lengths( $comment_data ) {
|
||||
* @param string $comment The comment content
|
||||
* @param string $user_ip The comment author's IP address
|
||||
* @param string $user_agent The author's browser user agent
|
||||
* @return bool True if comment contains blacklisted content, false if comment does not
|
||||
* @return bool True if comment contains disallowed content, false if comment does not
|
||||
*/
|
||||
function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
|
||||
function wp_blocklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
|
||||
/**
|
||||
* Fires before the comment is tested for blacklisted characters or words.
|
||||
* Fires before the comment is tested for disallowed characters or words.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @deprecated 5.5.0 Use {@see 'wp_blocklist_check'} instead.
|
||||
*
|
||||
* @param string $author Comment author.
|
||||
* @param string $email Comment author's email.
|
||||
@@ -1287,14 +1288,28 @@ function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_ag
|
||||
* @param string $user_ip Comment author's IP address.
|
||||
* @param string $user_agent Comment author's browser user agent.
|
||||
*/
|
||||
do_action( 'wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
|
||||
do_action_deprecated( 'wp_blacklist_check', array( $author, $email, $url, $comment, $user_ip, $user_agent ), '5.5.0', 'wp_blocklist_check', __( 'Please consider writing more inclusive code.' ) );
|
||||
|
||||
$mod_keys = trim( get_option( 'blacklist_keys' ) );
|
||||
/**
|
||||
* Fires before the comment is tested for disallowed characters or words.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param string $author Comment author.
|
||||
* @param string $email Comment author's email.
|
||||
* @param string $url Comment author's URL.
|
||||
* @param string $comment Comment content.
|
||||
* @param string $user_ip Comment author's IP address.
|
||||
* @param string $user_agent Comment author's browser user agent.
|
||||
*/
|
||||
do_action( 'wp_blocklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
|
||||
|
||||
$mod_keys = trim( get_option( 'blocklist_keys' ) );
|
||||
if ( '' === $mod_keys ) {
|
||||
return false; // If moderation keys are empty.
|
||||
}
|
||||
|
||||
// Ensure HTML tags are not being used to bypass the blacklist.
|
||||
// Ensure HTML tags are not being used to bypass the list of disallowed characters and words.
|
||||
$comment_without_html = wp_strip_all_tags( $comment );
|
||||
|
||||
$words = explode( "\n", $mod_keys );
|
||||
|
||||
Reference in New Issue
Block a user