WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/22/2020 05:24:34 PM (4 months ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r48115 r48121  
    1111 *
    1212 * If manual comment moderation is set in the administration, then all checks,
    13  * regardless of their type and whitelist, will fail and the function will
     13 * regardless of their type and substance, will fail and the function will
    1414 * return false.
    1515 *
    1616 * If the number of links exceeds the amount in the administration, then the
    17  * check fails. If any of the parameter contents match the blacklist of words,
     17 * check fails. If any of the parameter contents contain any disallowed words,
    1818 * then the check fails.
    1919 *
    2020 * If the comment author was approved before, then the comment is automatically
    21  * whitelisted.
     21 * approved.
    2222 *
    2323 * If all checks pass, the function will return true.
     
    127127     * email address. If both checks pass, return true. Otherwise, return false.
    128128     */
    129     if ( 1 == get_option( 'comment_whitelist' ) ) {
     129    if ( 1 == get_option( 'comment_previously_approved' ) ) {
    130130        if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) {
    131131            $comment_user = get_user_by( 'email', wp_unslash( $email ) );
     
    816816        }
    817817
    818         if ( wp_blacklist_check(
     818        if ( wp_blocklist_check(
    819819            $commentdata['comment_author'],
    820820            $commentdata['comment_author_email'],
     
    12631263
    12641264/**
    1265  * Does comment contain blacklisted characters or words.
    1266  *
    1267  * @since 1.5.0
     1265 * Checks if a comment contains disallowed characters or words.
     1266 *
     1267 * @since 5.5.0
    12681268 *
    12691269 * @param string $author The author of the comment
     
    12731273 * @param string $user_ip The comment author's IP address
    12741274 * @param string $user_agent The author's browser user agent
    1275  * @return bool True if comment contains blacklisted content, false if comment does not
    1276  */
    1277 function wp_blacklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
     1275 * @return bool True if comment contains disallowed content, false if comment does not
     1276 */
     1277function wp_blocklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
    12781278    /**
    1279      * Fires before the comment is tested for blacklisted characters or words.
     1279     * Fires before the comment is tested for disallowed characters or words.
    12801280     *
    12811281     * @since 1.5.0
     1282     * @deprecated 5.5.0 Use {@see 'wp_blocklist_check'} instead.
    12821283     *
    12831284     * @param string $author     Comment author.
     
    12881289     * @param string $user_agent Comment author's browser user agent.
    12891290     */
    1290     do_action( 'wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
    1291 
    1292     $mod_keys = trim( get_option( 'blacklist_keys' ) );
     1291    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.' ) );
     1292
     1293    /**
     1294     * Fires before the comment is tested for disallowed characters or words.
     1295     *
     1296     * @since 5.5.0
     1297     *
     1298     * @param string $author     Comment author.
     1299     * @param string $email      Comment author's email.
     1300     * @param string $url        Comment author's URL.
     1301     * @param string $comment    Comment content.
     1302     * @param string $user_ip    Comment author's IP address.
     1303     * @param string $user_agent Comment author's browser user agent.
     1304     */
     1305    do_action( 'wp_blocklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
     1306
     1307    $mod_keys = trim( get_option( 'blocklist_keys' ) );
    12931308    if ( '' === $mod_keys ) {
    12941309        return false; // If moderation keys are empty.
    12951310    }
    12961311
    1297     // Ensure HTML tags are not being used to bypass the blacklist.
     1312    // Ensure HTML tags are not being used to bypass the list of disallowed characters and words.
    12981313    $comment_without_html = wp_strip_all_tags( $comment );
    12991314
Note: See TracChangeset for help on using the changeset viewer.