Plugin Directory

Changeset 182426


Ignore:
Timestamp:
12/13/2009 11:26:10 PM (16 years ago)
Author:
reaperhulk
Message:

0.98 release

Location:
cdn-tools
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • cdn-tools/tags/0.98/cdn_classes/cloudfiles/loader.php

    r118409 r182426  
    8989        //need try/catch blocks here
    9090        $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        }
    9298    }
    9399   
  • cdn-tools/tags/0.98/cdntools.php

    r181430 r182426  
    55Description: 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.
    66Author: Paul Kehrer
    7 Version: 0.97
     7Version: 0.98
    88Author URI: http://langui.sh/
    99*/
     
    2828set_time_limit(90); //90 seconds max...
    2929
    30 define('CDNTOOLS_VERSION','0.97');
     30define('CDNTOOLS_VERSION','0.98');
    3131
    3232$dir_array = explode('/',dirname(__FILE__));
     
    126126        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
    127127    //  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
    129129        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
    133142    function disable_script_concatenation() {
    134143        global $concatenate_scripts;
     
    294303
    295304                        //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
    296306                        $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 ) ) );
    297307                        if(is_array($metadata) && isset($metadata['sizes'])) {
     
    299309                            foreach($metadata['sizes'] as $data) {
    300310                                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
    301322                                array_push($file_array,$data['file']);
    302323                                $filepath = $this->file_path(implode('/',$file_array));
     
    341362                }
    342363            }
     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
    343374        }
    344375        return $this->array2json($uploadinfo);
  • cdn-tools/tags/0.98/readme.txt

    r181430 r182426  
    33Donate link: http://langui.sh/cdn-tools
    44Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud
    5 Requires at least: 2.7
    6 Tested up to: 2.8.6
    7 Stable tag: 0.97
     5Requires at least: 2.8
     6Tested up to: 2.9
     7Stable tag: 0.98
    88
    99CDN 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).
     
    4242
    4343== 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
    4450= 0.97 - 12/9/2009 =
    4551* 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  
    8989        //need try/catch blocks here
    9090        $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        }
    9298    }
    9399   
  • cdn-tools/trunk/cdntools.php

    r181430 r182426  
    55Description: 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.
    66Author: Paul Kehrer
    7 Version: 0.97
     7Version: 0.98
    88Author URI: http://langui.sh/
    99*/
     
    2828set_time_limit(90); //90 seconds max...
    2929
    30 define('CDNTOOLS_VERSION','0.97');
     30define('CDNTOOLS_VERSION','0.98');
    3131
    3232$dir_array = explode('/',dirname(__FILE__));
     
    126126        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
    127127    //  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
    129129        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
    133142    function disable_script_concatenation() {
    134143        global $concatenate_scripts;
     
    294303
    295304                        //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
    296306                        $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 ) ) );
    297307                        if(is_array($metadata) && isset($metadata['sizes'])) {
     
    299309                            foreach($metadata['sizes'] as $data) {
    300310                                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
    301322                                array_push($file_array,$data['file']);
    302323                                $filepath = $this->file_path(implode('/',$file_array));
     
    341362                }
    342363            }
     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
    343374        }
    344375        return $this->array2json($uploadinfo);
  • cdn-tools/trunk/readme.txt

    r181430 r182426  
    33Donate link: http://langui.sh/cdn-tools
    44Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud
    5 Requires at least: 2.7
    6 Tested up to: 2.8.6
    7 Stable tag: 0.97
     5Requires at least: 2.8
     6Tested up to: 2.9
     7Stable tag: 0.98
    88
    99CDN 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).
     
    4242
    4343== 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
    4450= 0.97 - 12/9/2009 =
    4551* 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.