Make WordPress Core

Ticket #1324: wp_remote_fopen.2.diff

File wp_remote_fopen.2.diff, 1.4 KB (added by macmanx, 21 years ago)
  • xmlrpc.php

     
    11861186                        $context = str_replace('&', '&', $context);
    11871187                }
    11881188                                       
    1189                 fclose($fp);
    1190 
    11911189                if (empty($context)) {
    11921190                        // URL pattern not found
    11931191                        return new IXR_Error(17, 'The source URI does not contain a link to the target URI, and so cannot be used as a source.');
  • wp-includes/functions.php

     
    18591859}
    18601860
    18611861function wp_remote_fopen( $uri ) {
    1862         if ( function_exists('curl_init') ) {
     1862        if ( ini_get('allow_url_fopen') ) {
     1863                $fp = fopen( $uri, 'r' );
     1864                if ( !$fp )
     1865                        return false;
     1866                $linea = '';
     1867                while( $remote_read = fread($fp, 4096) )
     1868                        $linea .= $remote_read;
     1869                fclose($fp);
     1870                return $linea;         
     1871        } else if ( function_exists('curl_init') ) {
    18631872                $handle = curl_init();
    18641873                curl_setopt ($handle, CURLOPT_URL, $uri);
    18651874                curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
     
    18681877                curl_close($handle);
    18691878                return $buffer;
    18701879        } else {
    1871                 $fp = fopen( $uri, 'r' );
    1872                 if ( !$fp )
    1873                         return false;
    1874                 $linea = '';
    1875                 while( $remote_read = fread($fp, 4096) )
    1876                         $linea .= $remote_read;
    1877                 return $linea;
     1880                return false;
    18781881        }       
    18791882}
    18801883