WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/23/2020 03:12:49 AM (6 months ago)
Author:
jorbin
Message:

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

File:
1 edited

Legend:

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

    r48574 r48575  
    821821        }
    822822
    823         if ( wp_blocklist_check(
     823        if ( wp_check_comment_disallowed_list(
    824824            $commentdata['comment_author'],
    825825            $commentdata['comment_author_email'],
     
    13211321 * @return bool True if comment contains disallowed content, false if comment does not
    13221322 */
    1323 function wp_blocklist_check( $author, $email, $url, $comment, $user_ip, $user_agent ) {
     1323function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
    13241324    /**
    13251325     * Fires before the comment is tested for disallowed characters or words.
    13261326     *
    13271327     * @since 1.5.0
    1328      * @deprecated 5.5.0 Use {@see 'wp_blocklist_check'} instead.
     1328     * @deprecated 5.5.0 Use {@see 'wp_check_comment_disallowed_list'} instead.
    13291329     *
    13301330     * @param string $author     Comment author.
     
    13391339        array( $author, $email, $url, $comment, $user_ip, $user_agent ),
    13401340        '5.5.0',
    1341         'wp_blocklist_check',
     1341        'wp_check_comment_disallowed_list',
    13421342        __( 'Please consider writing more inclusive code.' )
    13431343    );
     
    13551355     * @param string $user_agent Comment author's browser user agent.
    13561356     */
    1357     do_action( 'wp_blocklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
    1358 
    1359     $mod_keys = trim( get_option( 'blocklist_keys' ) );
     1357    do_action( 'wp_check_comment_disallowed_list', $author, $email, $url, $comment, $user_ip, $user_agent );
     1358
     1359    $mod_keys = trim( get_option( 'disallowed_keys' ) );
    13601360    if ( '' === $mod_keys ) {
    13611361        return false; // If moderation keys are empty.
Note: See TracChangeset for help on using the changeset viewer.