Skip to content

Commit

Permalink
fclose removed, only use curl if we have to - http://mosquito.wordpre…
Browse files Browse the repository at this point in the history
…ss.org/view.php?id=1324 - hat tip: rboren

git-svn-id: http://svn.automattic.com/wordpress/trunk@2606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
matt committed May 13, 2005
1 parent e2f1542 commit b6cbe98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 11 additions & 8 deletions wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,16 @@ function add_magic_quotes($array) {
}

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();
curl_setopt ($handle, CURLOPT_URL, $uri);
curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
Expand All @@ -1868,13 +1877,7 @@ function wp_remote_fopen( $uri ) {
curl_close($handle);
return $buffer;
} else {
$fp = fopen( $uri, 'r' );
if ( !$fp )
return false;
$linea = '';
while( $remote_read = fread($fp, 4096) )
$linea .= $remote_read;
return $linea;
return false;
}
}

Expand Down
2 changes: 0 additions & 2 deletions xmlrpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1185,8 +1185,6 @@ function pingback_ping($args) {
$context = str_replace("\n", ' ', $context);
$context = str_replace('&', '&', $context);
}

fclose($fp);

if (empty($context)) {
// URL pattern not found
Expand Down

0 comments on commit b6cbe98

Please sign in to comment.