WordPress.org

Make WordPress Core

Changeset 25146


Ignore:
Timestamp:
08/28/2013 01:46:57 AM (8 years ago)
Author:
dd32
Message:

Use a better variable name in antispambot() introduced with [25055]. Props duck_ Fixes #16754

File:
1 edited

Legend:

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

    r25058 r25146  
    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    }
Note: See TracChangeset for help on using the changeset viewer.