fclose removed, only use curl if we have to - http://mosquito.wordpress.org/view.php?id=1324 - hat tip: rboren
git-svn-id: https://develop.svn.wordpress.org/trunk@2606 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7e42be87ae
commit
7d07dc1201
|
@ -1859,7 +1859,16 @@ function add_magic_quotes($array) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_remote_fopen( $uri ) {
|
function wp_remote_fopen( $uri ) {
|
||||||
if ( function_exists('curl_init') ) {
|
if ( ini_get('allow_url_fopen') ) {
|
||||||
|
$fp = fopen( $uri, 'r' );
|
||||||
|
if ( !$fp )
|
||||||
|
return false;
|
||||||
|
$linea = '';
|
||||||
|
while( $remote_read = fread($fp, 4096) )
|
||||||
|
$linea .= $remote_read;
|
||||||
|
fclose($fp);
|
||||||
|
return $linea;
|
||||||
|
} else if ( function_exists('curl_init') ) {
|
||||||
$handle = curl_init();
|
$handle = curl_init();
|
||||||
curl_setopt ($handle, CURLOPT_URL, $uri);
|
curl_setopt ($handle, CURLOPT_URL, $uri);
|
||||||
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
|
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
|
||||||
|
@ -1868,13 +1877,7 @@ function wp_remote_fopen( $uri ) {
|
||||||
curl_close($handle);
|
curl_close($handle);
|
||||||
return $buffer;
|
return $buffer;
|
||||||
} else {
|
} else {
|
||||||
$fp = fopen( $uri, 'r' );
|
|
||||||
if ( !$fp )
|
|
||||||
return false;
|
return false;
|
||||||
$linea = '';
|
|
||||||
while( $remote_read = fread($fp, 4096) )
|
|
||||||
$linea .= $remote_read;
|
|
||||||
return $linea;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1186,8 +1186,6 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
$context = str_replace('&', '&', $context);
|
$context = str_replace('&', '&', $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
if (empty($context)) {
|
if (empty($context)) {
|
||||||
// URL pattern not found
|
// URL pattern not found
|
||||||
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.');
|
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.');
|
||||||
|
|
Loading…
Reference in New Issue