Changeset 654088
- Timestamp:
- 01/17/2013 05:43:58 AM (13 years ago)
- Location:
- root-relative-urls/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
sb_root_relative_urls.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
root-relative-urls/trunk/readme.txt
r596065 r654088 109 109 == Changelog == 110 110 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 111 114 = 1.7 = 112 115 * 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 9 9 Author: Marcus E. Pope, marcuspope 10 10 Author URI: http://www.marcuspope.com 11 Version: 1. 711 Version: 1.8 12 12 13 13 Copyright 2011 Marcus E. Pope (email : me@marcuspope.com) … … 137 137 } 138 138 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 ;) 141 145 $p = parse_url($url); 142 146 $root = $p['scheme'] . "://" . $p['host']; 143 147 $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); 145 154 } 146 155 147 156 static function root_relative_media_urls($html, $id, $att) { 148 157 //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); 153 159 } 154 160
Note: See TracChangeset
for help on using the changeset viewer.