WordPress.org

Make WordPress Core

Ticket #9235: wp_remote_ip.diff

File wp_remote_ip.diff, 1.4 KB (added by scribu, 4 years ago)
  • wp-includes/comment.php

     
    12471247        $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; 
    12481248        $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0; 
    12491249 
    1250         $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] ); 
     1250        $commentdata['comment_author_IP'] = wp_remote_ip(); 
    12511251        $commentdata['comment_agent']     = substr($_SERVER['HTTP_USER_AGENT'], 0, 254); 
    12521252 
    12531253        $commentdata['comment_date']     = current_time('mysql'); 
  • wp-includes/functions.php

     
    13021302} 
    13031303 
    13041304/** 
     1305 * Retrieve the IP address of the user 
     1306 * 
     1307 * @since 3.0.0 
     1308 * 
     1309 * @return string 
     1310 */ 
     1311function wp_remote_ip() { 
     1312        return apply_filters('get_ip', preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'])); 
     1313} 
     1314 
     1315/** 
    13051316 * Whether today is a new day. 
    13061317 * 
    13071318 * @since 0.71 
     
    40374048function _search_terms_tidy($t) { 
    40384049        return trim($t, "\"'\n\r "); 
    40394050} 
    4040 ?> 
    4041  No newline at end of file 
     4051?>