Plugin Directory

Changeset 654088


Ignore:
Timestamp:
01/17/2013 05:43:58 AM (13 years ago)
Author:
MarcusPope
Message:

fixed bug in 3.5 due to wp core devs finally pulling their heads out of their a.....

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

Legend:

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

    r596065 r654088  
    109109== Changelog ==
    110110
     111= 1.8 =
     112* Bug fix: Apparently WordPress core devs had a change of heart about root relative urls, this patch fixes add media support
     113
    111114= 1.7 =
    112115* Bug fix: Added fix for users who have customized File Upload paths, image attachments now use root relative urls.
  • root-relative-urls/trunk/sb_root_relative_urls.php

    r596065 r654088  
    99Author: Marcus E. Pope, marcuspope
    1010Author URI: http://www.marcuspope.com
    11 Version: 1.7
     11Version: 1.8
    1212
    1313Copyright 2011 Marcus E. Pope (email : me@marcuspope.com)
     
    137137    }
    138138
    139     static function root_relative_image_urls($html, $id, $caption, $title, $align, $url, $size, $alt) {
    140         //Same as media_send_to_editor but images are handled separately
     139    static function root_relative_url($url, $html) {
     140       
     141        //bugfix: wp3.5 started using root relative urls... I guess they're doing it wrong? o_O #riot
     142        if ($url[0] == "/") return $html;
     143       
     144        //in case they missed one ;)
    141145        $p = parse_url($url);
    142146        $root = $p['scheme'] . "://" . $p['host'];
    143147        $html = str_ireplace($root, '', $html);
    144         return $html;
     148        return $html;       
     149    }
     150   
     151    static function root_relative_image_urls($html, $id, $caption, $title, $align, $url, $size, $alt) {
     152        //Same as media_send_to_editor but images are handled separately
     153        return MP_WP_Root_Relative_URLS::root_relative_url($url, $html);
    145154    }
    146155
    147156    static function root_relative_media_urls($html, $id, $att) {
    148157        //Filter out host from embed urls
    149         $p = parse_url($att['url']);
    150         $root = $p['scheme'] . "://" . $p['host'];
    151         $html = str_ireplace($root, '', $html);
    152         return $html;
     158        return MP_WP_Root_Relative_URLS::root_relative_url($att['url'], $html);
    153159    }
    154160
Note: See TracChangeset for help on using the changeset viewer.