WordPress.org

Plugin Directory

Changeset 596065


Ignore:
Timestamp:
09/07/12 19:53:50 (20 months ago)
Author:
MarcusPope
Message:

fixed absolute urls used when wp site has customized file upload directory [JOBID: admin]

Location:
root-relative-urls/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • root-relative-urls/trunk/readme.txt

    r595971 r596065  
    109109== Changelog == 
    110110 
     111= 1.7 = 
     112* Bug fix: Added fix for users who have customized File Upload paths, image attachments now use root relative urls. 
     113 
    111114= 1.6 = 
    112115* Bug fix: I really wish php < 5.3 would die - fixed incompatible funciton reference. 
  • root-relative-urls/trunk/sb_root_relative_urls.php

    r595971 r596065  
    99Author: Marcus E. Pope, marcuspope 
    1010Author URI: http://www.marcuspope.com 
    11 Version: 1.6 
     11Version: 1.7 
    1212 
    1313Copyright 2011 Marcus E. Pope (email : me@marcuspope.com) 
     
    161161    } 
    162162    
     163    static function fix_upload_paths($o) { 
     164        //Fixes attachment urls when user has customized the base url and/or upload folder in Admin > Settings > Media : Uploading Files 
     165        $o['url'] = MP_WP_Root_Relative_URLS::proper_root_relative_url($o['url']); 
     166        $o['baseurl'] = MP_WP_Root_Relative_URLS::proper_root_relative_url($o['baseurl']); 
     167        return $o; 
     168    } 
     169    
    163170    static function init() { 
    164171        //Setup all hooks / filters for either dynamically replacing the host part of a URL with the current host 
     
    282289            2 
    283290        ); 
     291 
     292        add_filter( 
     293            'upload_dir', 
     294            array( 
     295                'MP_WP_Root_Relative_URLS', 
     296                'fix_upload_paths' 
     297            ), 
     298            1, 
     299            1 
     300        ); 
    284301    } 
    285302} 
Note: See TracChangeset for help on using the changeset viewer.