WordPress.org

Make WordPress Core

Ticket #16754: 16754.diff

File 16754.diff, 1.3 KB (added by duck_, 5 years ago)
  • src/wp-includes/formatting.php

     
    14841484 * @since 0.71
    14851485 *
    14861486 * @param string $email_address Email address.
    1487  * @param int $extra_entropy Optional. Range from 0 to 1. Used for encoding.
     1487 * @param int $hex_encoding Optional. Set to 1 to enable hex encoding.
    14881488 * @return string Converted email address.
    14891489 */
    1490 function antispambot( $email_address, $extra_entropy = 0 ) {
     1490function antispambot( $email_address, $hex_encoding = 0 ) {
    14911491        $email_no_spam_address = '';
    14921492        for ( $i = 0; $i < strlen( $email_address ); $i++ ) {
    1493                 $j = rand( 0, 1 + $extra_entropy );
     1493                $j = rand( 0, 1 + $hex_encoding );
    14941494                if ( $j == 0 ) {
    1495                         $email_no_spam_address .= '&#' . ord( substr( $email_address, $i, 1 ) ) . ';';
     1495                        $email_no_spam_address .= '&#' . ord( $email_address[$i] ) . ';';
    14961496                } elseif ( $j == 1 ) {
    1497                         $email_no_spam_address .= substr( $email_address, $i, 1 );
     1497                        $email_no_spam_address .= $email_address[$i];
    14981498                } elseif ( $j == 2 ) {
    1499                         $email_no_spam_address .= '%' . zeroise( dechex( ord( substr( $email_address, $i, 1 ) ) ), 2 );
     1499                        $email_no_spam_address .= '%' . zeroise( dechex( ord( $email_address[$i] ) ), 2 );
    15001500                }
    15011501        }
    15021502