455 | | return false; |
456 | | $parts = array_map( 'intval', explode( '.', $ip ) ); |
457 | | if ( 10 === $parts[0] ) |
458 | | return false; |
459 | | if ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) |
460 | | return false; |
461 | | if ( 192 === $parts[0] && 168 === $parts[1] ) |
462 | | return false; |
| 457 | $maybe_local = true; |
| 458 | elseif ( 10 === $parts[0] ) |
| 459 | $maybe_local = true; |
| 460 | elseif ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] ) |
| 461 | $maybe_local = true; |
| 462 | elseif ( 192 === $parts[0] && 168 === $parts[1] ) |
| 463 | $maybe_local = true; |
| 464 | |
| 465 | if ( $maybe_local ) { |
| 466 | $allowed_hosts = (array) apply_filters( 'allowed_http_request_hosts', array(), $host ); |
| 467 | if ( in_array( $host, $allowed_hosts ) ) { |
| 468 | $maybe_local = false; |
| 469 | } elseif ( wp_validate_redirect( 'http://' . $host ) ) { |
| 470 | $maybe_local = false; |
| 471 | } elseif ( is_multisite() ) { |
| 472 | if ( $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ) ) |
| 473 | $maybe_local = false; |
| 474 | } |
| 475 | |
| 476 | if ( $maybe_local ) |
| 477 | return false; |
| 478 | } |