WordPress.org

Make WordPress Core

Changeset 8352


Ignore:
Timestamp:
07/16/2008 04:49:22 PM (10 years ago)
Author:
ryan
Message:

Derive the upload url from the upload path if no url given. fixes #7308 for trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r8280 r8352  
    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) )
     1495            $url = WP_CONTENT_URL . '/uploads';
     1496        else
     1497            $url = trailingslashit( $siteurl ) . $upload_path;
     1498    }
    14931499
    14941500    if ( defined('UPLOADS') ) {
Note: See TracChangeset for help on using the changeset viewer.