Make WordPress Core

Ticket #25840: 25840.2.diff

File 25840.2.diff, 1.1 KB (added by leewillis77, 11 years ago)

With the previous patch that the function would still block requests if WP_ACCESSIBLE_HOSTS was undefined - without ever invoking the filter. Revised patch attached - this includes the suggested rename as per Justin's patch.

  • wp-includes/class-http.php

     
    519519                if ( $check['host'] == 'localhost' || $check['host'] == $home['host'] )
    520520                        return apply_filters('block_local_requests', false);
    521521
    522                 if ( !defined('WP_ACCESSIBLE_HOSTS') )
    523                         return true;
    524 
    525522                static $accessible_hosts;
    526523                static $wildcard_regex = false;
    527524                if ( null == $accessible_hosts ) {
    528                         $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
    529525
     526                        /**
     527                         * Filter the list of accessible hosts.
     528                         *
     529                         * @since 3.8
     530                         *
     531                         * @param array List of accessible hosts
     532                         */
     533                        $accessible_hosts = ! defined( 'WP_ACCESSIBLE_HOSTS' ) ? array() : preg_split( '|,\s*|', WP_ACCESSIBLE_HOSTS );
     534                        $accessible_hosts = apply_filters( 'wp_http_accessible_hosts', $accessible_hosts );
     535
     536                        if ( empty( $acccessible_hosts ) )
     537                                return true;
     538
    530539                        if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) {
    531540                                $wildcard_regex = array();
    532541                                foreach ( $accessible_hosts as $host )