Changeset 161722
- Timestamp:
- 10/09/2009 01:29:29 AM (16 years ago)
- Location:
- cdn-tools
- Files:
-
- 4 edited
- 1 copied
-
tags/0.93 (copied) (copied from cdn-tools/trunk)
-
tags/0.93/cdntools.php (modified) (8 diffs)
-
tags/0.93/readme.txt (modified) (3 diffs)
-
trunk/cdntools.php (modified) (8 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cdn-tools/tags/0.93/cdntools.php
r160603 r161722 5 5 Description: CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading content onto a distribution network. You can use a commercial CDN or just load some of your larger JS libraries for free from Google's servers! At this time Cloud Files is the only supported CDN. 6 6 Author: Paul Kehrer 7 Version: 0.9 27 Version: 0.93 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(300); //5 minutes max... 29 29 30 define('CDNTOOLS_VERSION','0.9 2');30 define('CDNTOOLS_VERSION','0.93'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 138 138 [height] => 150 139 139 )*/ 140 if(is set($metadata['sizes'])) {140 if(is_array($metadata) && isset($metadata['sizes'])) { 141 141 $file_array = explode('/',$metadata['file']); 142 142 foreach($metadata['sizes'] as $data) { 143 $file_array[2] = $data['file']; 144 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 143 array_pop($file_array); 144 array_push($file_array,$data['file']); 145 $filepath = $this->file_path(implode('/',$file_array)); 145 146 $this->cdn_attachment_upload(0,$filepath); //pass a zero post_id since we don't know it and it doesn't matter. post_id can't be removed from the function though since the hook passes it 146 147 } … … 170 171 171 172 function cdn_media_url_rewrite($data) { 172 if($this->cdntools_sideload_uploads == 1 && !empty($this->cdntools_baseuris) ) {173 //only rewrite if the pref is set and the baseuris array isn't empty 173 if($this->cdntools_sideload_uploads == 1 && !empty($this->cdntools_baseuris) && ($this->cdntools_primarycdn) ) { 174 //only rewrite if the pref is set and the baseuris array isn't empty and they have a CDN selected 174 175 $file_upload_url = $this->wp_upload_url_path.'/'; 175 176 $file_upload_url = str_replace('/','\/',str_replace('://','://(www.)?',$file_upload_url)); … … 241 242 echo 'true'; 242 243 } 244 } 245 246 //this function is mostl stolen from get_attached_file in post.php in wordpress. it attempts to correct for absolute vs relative paths. 247 //if the if conditional is met it's a relative path 248 function file_path($file) { 249 if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) ) { 250 $file = $uploads['basedir'] . "/$file"; 251 } 252 return $file; 243 253 } 244 254 … … 270 280 $file_array = explode('/',$metadata['file']); 271 281 foreach($metadata['sizes'] as $data) { 272 $file_array[2] = $data['file']; 273 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 282 array_pop($file_array); 283 array_push($file_array,$data['file']); 284 $filepath = $this->file_path(implode('/',$file_array)); 274 285 $files_to_delete[] = $filepath; 275 286 } … … 298 309 foreach($result as $attachment) { 299 310 //we only need the basedir from our upload info var 300 $fullpath = $this-> wp_upload_basedir.'/'.$attachment->meta_value;311 $fullpath = $this->file_path($attachment->meta_value); 301 312 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$fullpath); 302 313 … … 306 317 $file_array = explode('/',$metadata['file']); 307 318 foreach($metadata['sizes'] as $data) { 308 $file_array[2] = $data['file']; 309 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 319 array_pop($file_array); 320 array_push($file_array,$data['file']); 321 $filepath = $this->file_path(implode('/',$file_array)); 310 322 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$filepath); 311 323 } -
cdn-tools/tags/0.93/readme.txt
r160815 r161722 5 5 Requires at least: 2.7 6 6 Tested up to: 2.8.4 7 Stable tag: 0.9 27 Stable tag: 0.93 8 8 9 9 CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading data onto a content distribution network (CDN). … … 13 13 [CDN Tools](http://swearingscience.com/cdn-tools/ "CDN Tools Home") is a WordPress plugin that allows you to load javascript and media files to an external server to drastically speed page loads. You can sideload data to a commercial CDN or just load your larger JS libraries (prototype, jquery) for **free** from Google's servers. CDN Tools has been designed to be as easy to use as possible, so give it a shot! Your blog's readers will thank you. At this time the only commercial CDN supported is Cloud Files. Check out the plugin homepage to view a screencast. 14 14 15 New in 0.92 16 17 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you <b>MUST</b>unload files and then load them again. Please let me know if you have issues because several major changes were made. See http://langui.sh/cdn-tools for more details.15 = New in 0.92/0.93 = 16 * A partial fix for issues with customers who have full file paths stored in their postmeta table. This is not a complete fix, but should help some (most?) users. 17 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you _MUST_ unload files and then load them again. Please let me know if you have issues because several major changes were made. See http://langui.sh/cdn-tools for more details. 18 18 19 19 [View complete changelog](http://swearingscience.com/cdn-tools/ "CDN Tools Home"). … … 46 46 47 47 == Changelog == 48 = 0.92 – 10/5/2009=49 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you MUST unload files and then load them again. Please let me know if you have issues because several major changes were made.48 = 0.93 - 10/8/2009 = 49 * A partial fix for issues with customers who have full file paths stored in their postmeta table. This is not a complete fix, but should help some (most?) users. 50 50 51 =0.81 – 5/17/2009= 52 *Major upgrade to the initial load for attachments. Now done via AJAX with percentage progress. 53 *Additional exception handling (this is still incomplete) 54 *Upgrade to CF API 1.3.0. 55 *Wordpress MU compatible (credit John Keyes) 51 = 0.92 – 10/5/2009 = 52 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you MUST unload files and then load them again. Please let me know if you have issues because several major changes were made. 56 53 57 =0.72 – 2/25/2009= 58 *First public release, no changes from previous. 54 = 0.81 – 5/17/2009 = 55 * Major upgrade to the initial load for attachments. Now done via AJAX with percentage progress. 56 * Additional exception handling (this is still incomplete) 57 * Upgrade to CF API 1.3.0. 58 * Wordpress MU compatible (credit John Keyes) 59 59 60 =0.72 – 2/22/2009= 61 *Small bugfixes 62 *WP Super Cache compatibility. 60 = 0.72 – 2/25/2009 = 61 * First public release, no changes from previous. 63 62 64 =0.71 – 2/22/2009= 65 *Workaround for a MIME/PHP bug on RHEL4. 63 = 0.72 – 2/22/2009 = 64 * Small bugfixes 65 * WP Super Cache compatibility. 66 66 67 =0.7 – 2/17/2009= 68 *Nearing completion of initial feature set. 69 *UI rework (again) 67 = 0.71 – 2/22/2009 = 68 * Workaround for a MIME/PHP bug on RHEL4. 70 69 71 =0.6 – 2/15/2009= 72 *Huge improvements on all fronts 70 = 0.7 – 2/17/2009 = 71 * Nearing completion of initial feature set. 72 * UI rework (again) 73 73 74 = 0.4 – 2/8/2009=75 * Initial sideload support.74 = 0.6 – 2/15/2009 = 75 * Huge improvements on all fronts 76 76 77 =0.2 – 2/7/2009= 78 *First release outside of my own work (seeded to Major Hayden). 79 *GoogleAJAX for Prototype, jQuery, Dojo, and mootools (free for anyone to use) 80 *Uploading JS to CloudFiles (only supported CDN presently) 81 *Supports opting out of CDN’ing wp-admin scripts. 77 = 0.4 – 2/8/2009 = 78 * Initial sideload support. 79 80 = 0.2 – 2/7/2009 = 81 * First release outside of my own work (seeded to Major Hayden). 82 * GoogleAJAX for Prototype, jQuery, Dojo, and mootools (free for anyone to use) 83 * Uploading JS to CloudFiles (only supported CDN presently) 84 * Supports opting out of CDN’ing wp-admin scripts. 82 85 83 86 -
cdn-tools/trunk/cdntools.php
r160603 r161722 5 5 Description: CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading content onto a distribution network. You can use a commercial CDN or just load some of your larger JS libraries for free from Google's servers! At this time Cloud Files is the only supported CDN. 6 6 Author: Paul Kehrer 7 Version: 0.9 27 Version: 0.93 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(300); //5 minutes max... 29 29 30 define('CDNTOOLS_VERSION','0.9 2');30 define('CDNTOOLS_VERSION','0.93'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 138 138 [height] => 150 139 139 )*/ 140 if(is set($metadata['sizes'])) {140 if(is_array($metadata) && isset($metadata['sizes'])) { 141 141 $file_array = explode('/',$metadata['file']); 142 142 foreach($metadata['sizes'] as $data) { 143 $file_array[2] = $data['file']; 144 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 143 array_pop($file_array); 144 array_push($file_array,$data['file']); 145 $filepath = $this->file_path(implode('/',$file_array)); 145 146 $this->cdn_attachment_upload(0,$filepath); //pass a zero post_id since we don't know it and it doesn't matter. post_id can't be removed from the function though since the hook passes it 146 147 } … … 170 171 171 172 function cdn_media_url_rewrite($data) { 172 if($this->cdntools_sideload_uploads == 1 && !empty($this->cdntools_baseuris) ) {173 //only rewrite if the pref is set and the baseuris array isn't empty 173 if($this->cdntools_sideload_uploads == 1 && !empty($this->cdntools_baseuris) && ($this->cdntools_primarycdn) ) { 174 //only rewrite if the pref is set and the baseuris array isn't empty and they have a CDN selected 174 175 $file_upload_url = $this->wp_upload_url_path.'/'; 175 176 $file_upload_url = str_replace('/','\/',str_replace('://','://(www.)?',$file_upload_url)); … … 241 242 echo 'true'; 242 243 } 244 } 245 246 //this function is mostl stolen from get_attached_file in post.php in wordpress. it attempts to correct for absolute vs relative paths. 247 //if the if conditional is met it's a relative path 248 function file_path($file) { 249 if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) ) { 250 $file = $uploads['basedir'] . "/$file"; 251 } 252 return $file; 243 253 } 244 254 … … 270 280 $file_array = explode('/',$metadata['file']); 271 281 foreach($metadata['sizes'] as $data) { 272 $file_array[2] = $data['file']; 273 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 282 array_pop($file_array); 283 array_push($file_array,$data['file']); 284 $filepath = $this->file_path(implode('/',$file_array)); 274 285 $files_to_delete[] = $filepath; 275 286 } … … 298 309 foreach($result as $attachment) { 299 310 //we only need the basedir from our upload info var 300 $fullpath = $this-> wp_upload_basedir.'/'.$attachment->meta_value;311 $fullpath = $this->file_path($attachment->meta_value); 301 312 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$fullpath); 302 313 … … 306 317 $file_array = explode('/',$metadata['file']); 307 318 foreach($metadata['sizes'] as $data) { 308 $file_array[2] = $data['file']; 309 $filepath = $this->wp_upload_basedir.'/'.implode('/',$file_array); 319 array_pop($file_array); 320 array_push($file_array,$data['file']); 321 $filepath = $this->file_path(implode('/',$file_array)); 310 322 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$filepath); 311 323 } -
cdn-tools/trunk/readme.txt
r160815 r161722 5 5 Requires at least: 2.7 6 6 Tested up to: 2.8.4 7 Stable tag: 0.9 27 Stable tag: 0.93 8 8 9 9 CDN Tools is a plugin designed to help you drastically speed up your blog's load time by loading data onto a content distribution network (CDN). … … 13 13 [CDN Tools](http://swearingscience.com/cdn-tools/ "CDN Tools Home") is a WordPress plugin that allows you to load javascript and media files to an external server to drastically speed page loads. You can sideload data to a commercial CDN or just load your larger JS libraries (prototype, jquery) for **free** from Google's servers. CDN Tools has been designed to be as easy to use as possible, so give it a shot! Your blog's readers will thank you. At this time the only commercial CDN supported is Cloud Files. Check out the plugin homepage to view a screencast. 14 14 15 New in 0.92 16 17 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you <b>MUST</b>unload files and then load them again. Please let me know if you have issues because several major changes were made. See http://langui.sh/cdn-tools for more details.15 = New in 0.92/0.93 = 16 * A partial fix for issues with customers who have full file paths stored in their postmeta table. This is not a complete fix, but should help some (most?) users. 17 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you _MUST_ unload files and then load them again. Please let me know if you have issues because several major changes were made. See http://langui.sh/cdn-tools for more details. 18 18 19 19 [View complete changelog](http://swearingscience.com/cdn-tools/ "CDN Tools Home"). … … 46 46 47 47 == Changelog == 48 = 0.92 – 10/5/2009=49 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you MUST unload files and then load them again. Please let me know if you have issues because several major changes were made.48 = 0.93 - 10/8/2009 = 49 * A partial fix for issues with customers who have full file paths stored in their postmeta table. This is not a complete fix, but should help some (most?) users. 50 50 51 =0.81 – 5/17/2009= 52 *Major upgrade to the initial load for attachments. Now done via AJAX with percentage progress. 53 *Additional exception handling (this is still incomplete) 54 *Upgrade to CF API 1.3.0. 55 *Wordpress MU compatible (credit John Keyes) 51 = 0.92 – 10/5/2009 = 52 * Major upgrade to support WP 2.8. If you are a previous user of CDN Tools you MUST unload files and then load them again. Please let me know if you have issues because several major changes were made. 56 53 57 =0.72 – 2/25/2009= 58 *First public release, no changes from previous. 54 = 0.81 – 5/17/2009 = 55 * Major upgrade to the initial load for attachments. Now done via AJAX with percentage progress. 56 * Additional exception handling (this is still incomplete) 57 * Upgrade to CF API 1.3.0. 58 * Wordpress MU compatible (credit John Keyes) 59 59 60 =0.72 – 2/22/2009= 61 *Small bugfixes 62 *WP Super Cache compatibility. 60 = 0.72 – 2/25/2009 = 61 * First public release, no changes from previous. 63 62 64 =0.71 – 2/22/2009= 65 *Workaround for a MIME/PHP bug on RHEL4. 63 = 0.72 – 2/22/2009 = 64 * Small bugfixes 65 * WP Super Cache compatibility. 66 66 67 =0.7 – 2/17/2009= 68 *Nearing completion of initial feature set. 69 *UI rework (again) 67 = 0.71 – 2/22/2009 = 68 * Workaround for a MIME/PHP bug on RHEL4. 70 69 71 =0.6 – 2/15/2009= 72 *Huge improvements on all fronts 70 = 0.7 – 2/17/2009 = 71 * Nearing completion of initial feature set. 72 * UI rework (again) 73 73 74 = 0.4 – 2/8/2009=75 * Initial sideload support.74 = 0.6 – 2/15/2009 = 75 * Huge improvements on all fronts 76 76 77 =0.2 – 2/7/2009= 78 *First release outside of my own work (seeded to Major Hayden). 79 *GoogleAJAX for Prototype, jQuery, Dojo, and mootools (free for anyone to use) 80 *Uploading JS to CloudFiles (only supported CDN presently) 81 *Supports opting out of CDN’ing wp-admin scripts. 77 = 0.4 – 2/8/2009 = 78 * Initial sideload support. 79 80 = 0.2 – 2/7/2009 = 81 * First release outside of my own work (seeded to Major Hayden). 82 * GoogleAJAX for Prototype, jQuery, Dojo, and mootools (free for anyone to use) 83 * Uploading JS to CloudFiles (only supported CDN presently) 84 * Supports opting out of CDN’ing wp-admin scripts. 82 85 83 86
Note: See TracChangeset
for help on using the changeset viewer.