Changeset 182426
- Timestamp:
- 12/13/2009 11:26:10 PM (16 years ago)
- Location:
- cdn-tools
- Files:
-
- 6 edited
- 1 copied
-
tags/0.98 (copied) (copied from cdn-tools/trunk)
-
tags/0.98/cdn_classes/cloudfiles/loader.php (modified) (1 diff)
-
tags/0.98/cdntools.php (modified) (6 diffs)
-
tags/0.98/readme.txt (modified) (2 diffs)
-
trunk/cdn_classes/cloudfiles/loader.php (modified) (1 diff)
-
trunk/cdntools.php (modified) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cdn-tools/tags/0.98/cdn_classes/cloudfiles/loader.php
r118409 r182426 89 89 //need try/catch blocks here 90 90 $wp_uploads = $this->conn->create_container($container_name); 91 $object = $wp_uploads->delete_object($object_name); 91 try { 92 $object = $wp_uploads->delete_object($object_name); 93 } 94 catch(NoSuchObjectException $e) { 95 //we don't care about something not existing when we try to delete it, so let's just 96 //eat the exception. yum yum yum 97 } 92 98 } 93 99 -
cdn-tools/tags/0.98/cdntools.php
r181430 r182426 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 77 Version: 0.98 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(90); //90 seconds max... 29 29 30 define('CDNTOOLS_VERSION','0.9 7');30 define('CDNTOOLS_VERSION','0.98'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 126 126 add_filter('wp_delete_file', array($this,'delete_file_filter')); //we need info about this damn file before it's deleted and the delete_attachment hook fires too late in WP 2.7 127 127 // add_filter('attachment_fields_to_edit', array($this,'attachment_fields_to_edit_filter')); 128 add_filter('the_content', array($this,'cdn_media_url_rewrite'), 1000); //this needs to run after any other filter 128 add_filter('the_content', array($this,'cdn_media_url_rewrite'), 1000); //this needs to run after any other filter that may alter URLs 129 129 add_filter('wp_generate_attachment_metadata', array($this,'cdn_upload_resized_images')); 130 } 131 132 //wp 2.8 concatenates scripts in the admin panel and this messes up the google ajax rewriting. hook init and disable it for now. revisit for 2.9 130 add_filter('update_attached_file', array($this,'update_attached_file'), 10, 2); //upload edited images 131 add_filter('wp_update_attachment_metadata', array($this,'cdn_upload_resized_images')); //hook same function to upload the edited image resizes 132 } 133 134 //this will capture image edited files and probably other stuff 135 function update_attached_file($filepath,$attachment_id) { 136 $full_filepath = $this->file_path($filepath); //make the file path absolute if required 137 $this->cdn_attachment_upload(0,$full_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 138 return $filepath; 139 } 140 141 //wp 2.8 concatenates scripts in the admin panel and this messes up the google ajax rewriting. hook init and disable it for now. revisit at some point 133 142 function disable_script_concatenation() { 134 143 global $concatenate_scripts; … … 294 303 295 304 //check for metadata that has resized images 305 //consider using wp_delete_file filter here instead of these methods. see line 2902 from wp-includes/post.php 296 306 $metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_metadata',$post_id ) ) ); 297 307 if(is_array($metadata) && isset($metadata['sizes'])) { … … 299 309 foreach($metadata['sizes'] as $data) { 300 310 array_pop($file_array); 311 array_push($file_array,$data['file']); 312 $filepath = $this->file_path(implode('/',$file_array)); 313 $files_to_delete[] = $filepath; 314 } 315 } 316 //check for edited image data. yes i don't understand the meta_key name either 317 //consider using wp_delete_file filter here instead of these methods. see line 2902 from wp-includes/post.php 318 $backup_metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_backup_sizes',$post_id ) ) ); 319 if(is_array($backup_metadata)) { 320 foreach($backup_metadata as $data) { 321 array_pop($file_array); //same file_array from the attachment_metadata 301 322 array_push($file_array,$data['file']); 302 323 $filepath = $this->file_path(implode('/',$file_array)); … … 341 362 } 342 363 } 364 $backup_metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_backup_sizes',$attachment->post_id ) ) ); 365 if(is_array($backup_metadata)) { 366 foreach($backup_metadata as $data) { 367 array_pop($file_array); //same file_array from the attachment_metadata 368 array_push($file_array,$data['file']); 369 $filepath = $this->file_path(implode('/',$file_array)); 370 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$filepath); 371 } 372 } 373 343 374 } 344 375 return $this->array2json($uploadinfo); -
cdn-tools/tags/0.98/readme.txt
r181430 r182426 3 3 Donate link: http://langui.sh/cdn-tools 4 4 Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud 5 Requires at least: 2. 76 Tested up to: 2. 8.67 Stable tag: 0.9 75 Requires at least: 2.8 6 Tested up to: 2.9 7 Stable tag: 0.98 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). … … 42 42 43 43 == Changelog == 44 45 = 0.98 = 46 * WordPress 2.9 support. CDN Tools can now handle the image edit system introduced in WP 2.9. 47 * Better error handling for a few scenarios. 48 * As of this release WP 2.7 is no longer supported. It might work, but future releases will almost certainly break it. 49 44 50 = 0.97 - 12/9/2009 = 45 51 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations were FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug. -
cdn-tools/trunk/cdn_classes/cloudfiles/loader.php
r118409 r182426 89 89 //need try/catch blocks here 90 90 $wp_uploads = $this->conn->create_container($container_name); 91 $object = $wp_uploads->delete_object($object_name); 91 try { 92 $object = $wp_uploads->delete_object($object_name); 93 } 94 catch(NoSuchObjectException $e) { 95 //we don't care about something not existing when we try to delete it, so let's just 96 //eat the exception. yum yum yum 97 } 92 98 } 93 99 -
cdn-tools/trunk/cdntools.php
r181430 r182426 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 77 Version: 0.98 8 8 Author URI: http://langui.sh/ 9 9 */ … … 28 28 set_time_limit(90); //90 seconds max... 29 29 30 define('CDNTOOLS_VERSION','0.9 7');30 define('CDNTOOLS_VERSION','0.98'); 31 31 32 32 $dir_array = explode('/',dirname(__FILE__)); … … 126 126 add_filter('wp_delete_file', array($this,'delete_file_filter')); //we need info about this damn file before it's deleted and the delete_attachment hook fires too late in WP 2.7 127 127 // add_filter('attachment_fields_to_edit', array($this,'attachment_fields_to_edit_filter')); 128 add_filter('the_content', array($this,'cdn_media_url_rewrite'), 1000); //this needs to run after any other filter 128 add_filter('the_content', array($this,'cdn_media_url_rewrite'), 1000); //this needs to run after any other filter that may alter URLs 129 129 add_filter('wp_generate_attachment_metadata', array($this,'cdn_upload_resized_images')); 130 } 131 132 //wp 2.8 concatenates scripts in the admin panel and this messes up the google ajax rewriting. hook init and disable it for now. revisit for 2.9 130 add_filter('update_attached_file', array($this,'update_attached_file'), 10, 2); //upload edited images 131 add_filter('wp_update_attachment_metadata', array($this,'cdn_upload_resized_images')); //hook same function to upload the edited image resizes 132 } 133 134 //this will capture image edited files and probably other stuff 135 function update_attached_file($filepath,$attachment_id) { 136 $full_filepath = $this->file_path($filepath); //make the file path absolute if required 137 $this->cdn_attachment_upload(0,$full_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 138 return $filepath; 139 } 140 141 //wp 2.8 concatenates scripts in the admin panel and this messes up the google ajax rewriting. hook init and disable it for now. revisit at some point 133 142 function disable_script_concatenation() { 134 143 global $concatenate_scripts; … … 294 303 295 304 //check for metadata that has resized images 305 //consider using wp_delete_file filter here instead of these methods. see line 2902 from wp-includes/post.php 296 306 $metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_metadata',$post_id ) ) ); 297 307 if(is_array($metadata) && isset($metadata['sizes'])) { … … 299 309 foreach($metadata['sizes'] as $data) { 300 310 array_pop($file_array); 311 array_push($file_array,$data['file']); 312 $filepath = $this->file_path(implode('/',$file_array)); 313 $files_to_delete[] = $filepath; 314 } 315 } 316 //check for edited image data. yes i don't understand the meta_key name either 317 //consider using wp_delete_file filter here instead of these methods. see line 2902 from wp-includes/post.php 318 $backup_metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_backup_sizes',$post_id ) ) ); 319 if(is_array($backup_metadata)) { 320 foreach($backup_metadata as $data) { 321 array_pop($file_array); //same file_array from the attachment_metadata 301 322 array_push($file_array,$data['file']); 302 323 $filepath = $this->file_path(implode('/',$file_array)); … … 341 362 } 342 363 } 364 $backup_metadata = unserialize( $wpdb->get_var( $wpdb->prepare( "select meta_value from $wpdb->postmeta WHERE meta_key = %s and post_id = %d", '_wp_attachment_backup_sizes',$attachment->post_id ) ) ); 365 if(is_array($backup_metadata)) { 366 foreach($backup_metadata as $data) { 367 array_pop($file_array); //same file_array from the attachment_metadata 368 array_push($file_array,$data['file']); 369 $filepath = $this->file_path(implode('/',$file_array)); 370 $uploadinfo[] = array('post_id'=>$attachment->post_id,'path'=>$filepath); 371 } 372 } 373 343 374 } 344 375 return $this->array2json($uploadinfo); -
cdn-tools/trunk/readme.txt
r181430 r182426 3 3 Donate link: http://langui.sh/cdn-tools 4 4 Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud 5 Requires at least: 2. 76 Tested up to: 2. 8.67 Stable tag: 0.9 75 Requires at least: 2.8 6 Tested up to: 2.9 7 Stable tag: 0.98 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). … … 42 42 43 43 == Changelog == 44 45 = 0.98 = 46 * WordPress 2.9 support. CDN Tools can now handle the image edit system introduced in WP 2.9. 47 * Better error handling for a few scenarios. 48 * As of this release WP 2.7 is no longer supported. It might work, but future releases will almost certainly break it. 49 44 50 = 0.97 - 12/9/2009 = 45 51 * Initial sideload AJAX used an absolute path with the siteurl. This should have been a relative path or the adminurl to accommodate situations were FORCE_SSL_ADMIN is defined. Thanks to John for identifying the bug.
Note: See TracChangeset
for help on using the changeset viewer.