Make WordPress Core

Changeset 6780


Ignore:
Timestamp:
02/11/2008 06:35:24 AM (19 years ago)
Author:
matt
Message:

Allow uploads outside of the WP path and custom URLs for the same.

Location:
trunk
Files:
3 edited

Legend:

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

    r6748 r6780  
    239239        add_option('show_avatars', '1');
    240240        add_option('avatar_rating', 'G');
     241        add_option('upload_url_path', '');
    241242
    242243        // Delete unused options
  • trunk/wp-admin/options-misc.php

    r6475 r6780  
    2424</td>
    2525</tr>
     26
     27<tr valign="top">
     28<th scope="row"><?php _e('Full URL path to files (optional)'); ?>:</th>
     29<td><input name="upload_url_path" type="text" id="upload_url_path" class="code" value="<?php echo attribute_escape( get_option('upload_url_path')); ?>" size="40" />
     30</td>
     31</tr>
     32
    2633<tr>
    2734<td></td>
     
    4451<p class="submit">
    4552<input type="hidden" name="action" value="update" />
    46 <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
     53<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path,upload_url_path" />
    4754<input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" />
    4855</p>
  • trunk/wp-includes/functions.php

    r6777 r6780  
    10271027function wp_upload_dir( $time = NULL ) {
    10281028        $siteurl = get_option( 'siteurl' );
    1029         //prepend ABSPATH to $dir and $siteurl to $url if they're not already there
    1030         $path = str_replace( ABSPATH, '', trim( get_option( 'upload_path' ) ) );
    1031         $dir = ABSPATH . $path;
    1032         $url = trailingslashit( $siteurl ) . $path;
     1029        $upload_path = $dir = get_option( 'upload_path' );
     1030       
     1031        if ( $upload_path != realpath( $upload_path ) ) { // not an absolute path
     1032                //prepend ABSPATH to $dir and $siteurl to $url if they're not already there
     1033                $path = str_replace( ABSPATH, '', trim( $upload_path ) );
     1034                $dir = ABSPATH . $path;
     1035        }
     1036
     1037        if ( !$url = get_option( 'upload_url_path' ) )
     1038                $url = trailingslashit( $siteurl ) . $path;
    10331039
    10341040        if ( $dir == ABSPATH ) // the option was empty
Note: See TracChangeset for help on using the changeset viewer.