Make WordPress Core

Changeset 2581


Ignore:
Timestamp:
05/03/2005 07:52:11 AM (21 years ago)
Author:
matt
Message:

Use CURL if available, possible fix for http://mosquito.wordpress.org/view.php?id=1166

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-schema.php

    r2393 r2581  
    216216    add_option('rss_language', 'en');
    217217    add_option('html_type', 'text/html');
     218    // 1.5.1
     219    add_option('use_trackback', 0);
    218220
    219221    // Delete unused options
  • trunk/wp-includes/functions.php

    r2572 r2581  
    18591859}
    18601860
     1861function wp_remote_fopen( $uri ) {
     1862    if ( function_exists('curl_init') ) {
     1863        $handle = curl_init();
     1864        curl_setopt ($handle, CURLOPT_URL, $uri);
     1865        curl_setopt ($handle, CURLOPT_CONNECTTIMEOUT, 1);
     1866        curl_setopt ($handle, CURLOPT_RETURNTRANSFER, 1);
     1867        $buffer = curl_exec($handle);
     1868        curl_close($handle);
     1869        return $buffer;
     1870    } 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;
     1878    }   
     1879}
     1880
    18611881?>
  • trunk/xmlrpc.php

    r2399 r2581  
    11631163
    11641164        // Let's check the remote site
    1165         $fp = @fopen($pagelinkedfrom, 'r');
    1166         if (!$fp) {
    1167             // The source URI does not exist
     1165        $linea = wp_remote_fopen( $pagelinkedfrom );
     1166        if ( !$linea )
    11681167            return new IXR_Error(16, 'The source URI does not exist.');
    1169         }
    1170 
    1171         $puntero = 4096;
    1172         while($remote_read = fread($fp, $puntero)) {
    1173             $linea .= $remote_read;
    1174         }
    11751168
    11761169        // Work around bug in strip_tags():
     
    11801173        // I don't think we need this? -- emc3
    11811174        //$linea = preg_replace('#&([^amp\;])#is', '&$1', $linea);
    1182         if (empty($matchtitle)) {
     1175        if ( empty($matchtitle) ) {
    11831176            preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
    11841177        }
Note: See TracChangeset for help on using the changeset viewer.