WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/wp-includes/functions.php

    r8280 r8571  
    342342        if ( false === $value ) {
    343343            if ( defined( 'WP_INSTALLING' ) )
    344                 $supress = $wpdb->suppress_errors();
     344                $suppress = $wpdb->suppress_errors();
    345345            // expected_slashed ($setting)
    346346            $row = $wpdb->get_row( "SELECT option_value FROM $wpdb->options WHERE option_name = '$setting' LIMIT 1" );
     
    631631 */
    632632function maybe_serialize( $data ) {
    633     if ( is_string( $data ) )
    634         return $data;
    635     elseif ( is_array( $data ) || is_object( $data ) )
     633    if ( is_array( $data ) || is_object( $data ) )
    636634        return serialize( $data );
     635
    637636    if ( is_serialized( $data ) )
    638637        return serialize( $data );
     638
    639639    return $data;
    640640}
     
    14821482    $siteurl = get_option( 'siteurl' );
    14831483    $upload_path = get_option( 'upload_path' );
    1484     if ( trim($upload_path) === '' )
    1485         $upload_path = WP_CONTENT_DIR . '/uploads';
    1486     $dir = $upload_path;
     1484    $upload_path = trim($upload_path);
     1485    if ( empty($upload_path) )
     1486        $dir = WP_CONTENT_DIR . '/uploads';
     1487    else
     1488        $dir = $upload_path;
    14871489
    14881490    // $dir is absolute, $path is (maybe) relative to ABSPATH
    1489     $dir = path_join( ABSPATH, $upload_path );
    1490 
    1491     if ( !$url = get_option( 'upload_url_path' ) )
    1492         $url = WP_CONTENT_URL . '/uploads';
     1491    $dir = path_join( ABSPATH, $dir );
     1492   
     1493    if ( !$url = get_option( 'upload_url_path' ) ) {
     1494        if ( empty($upload_path) or ( $upload_path == $dir ) )
     1495            $url = WP_CONTENT_URL . '/uploads';
     1496        else
     1497            $url = trailingslashit( $siteurl ) . $upload_path;
     1498    }
    14931499
    14941500    if ( defined('UPLOADS') ) {
     
    15181524        return array( 'error' => $message );
    15191525    }
    1520 
     1526   
    15211527    $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
     1528
    15221529    return apply_filters( 'upload_dir', $uploads );
    15231530}
Note: See TracChangeset for help on using the changeset viewer.