Plugin Directory

Changeset 188582


Ignore:
Timestamp:
12/31/2009 11:17:05 PM (16 years ago)
Author:
reaperhulk
Message:

0.99 release

Location:
cdn-tools
Files:
3 edited
4 copied

Legend:

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

    r182426 r188582  
    1010    private $conn = null;
    1111   
    12     function __construct($authname,$authkey) {
     12    function __construct($authname,$authkey,$use_servicenet=False) {
    1313        $this->authname = $authname;
    1414        $this->authkey = $authkey;
     
    1717        $this->upload_path = $wpuploadinfo['basedir'];
    1818        $this->uploads_use_yearmonth_folders = get_option('uploads_use_yearmonth_folders');
    19         $this->authconn();
     19        $this->authconn($use_servicenet);
    2020       
    2121    }
    2222   
    23     public function authconn() {
     23    public function authconn($use_servicenet) {
    2424        $auth = new CF_Authentication($this->authname,$this->authkey);
    2525        try {
     
    3131            return false;
    3232        }
    33         $this->conn = new CF_Connection($auth);
     33        $this->conn = new CF_Connection($auth,$servicenet=$use_servicenet);
    3434    }
    3535   
     
    5151    }
    5252
    53     public function attachment_upload($filepath) {
     53    public function attachment_upload($filepath,$keep_logs=False) {
    5454        $file = str_replace($this->upload_path.'/','',$filepath);
    5555        if($this->uploads_use_yearmonth_folders) {
     
    6363        //need try/catch blocks here, all possible exceptions!
    6464        $wp_uploads = $this->conn->create_container($container_name);
     65        $wp_uploads->log_retention($keep_logs);
    6566        $object = $wp_uploads->create_object($object_name);
    6667        try {
  • cdn-tools/tags/0.99/cdntools.php

    r182426 r188582  
    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.98
     7Version: 0.99
    88Author URI: http://langui.sh/
    99*/
     
    2828set_time_limit(90); //90 seconds max...
    2929
    30 define('CDNTOOLS_VERSION','0.98');
     30define('CDNTOOLS_VERSION','0.99');
    3131
    3232$dir_array = explode('/',dirname(__FILE__));
     
    5252    private $cdntools_authkey = null;
    5353    private $cdntools_adminscripts = null;
    54     private $cndtools_sideload_uploads = null;
     54    private $cdntools_sideload_uploads = null;
     55    private $cdntools_logretention = null;
     56    private $cdntools_servicenet = null;
    5557    private $cdntools_baseuris = array();
    5658    private $uploaded_file_path = null;
     
    98100        $this->cdntools_adminscripts = get_option('cdntools_adminscripts');
    99101        $this->cdntools_sideload_uploads = get_option('cdntools_sideload_uploads');
     102        $this->cdntools_logretention = get_option('cdntools_logretention');
     103        $this->cdntools_servicenet = get_option('cdntools_servicenet');
    100104        $this->cdntools_advanced_options = get_option('cdntools_advanced_options');
    101105        $wp_upload_dir = wp_upload_dir();
     
    238242                $file_to_upload = $this->uploaded_file_path;
    239243            }
    240             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
    241             $return_array = $cdn_loader->attachment_upload($file_to_upload);
     244            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
     245            $return_array = $cdn_loader->attachment_upload($file_to_upload, $this->cdntools_logretention);
    242246            if (!is_array($return_array)) {
    243247                return $return_array;
     
    253257        error_reporting(E_ERROR | E_WARNING | E_PARSE);
    254258        ini_set('display_errors',1);
    255         $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     259        $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    256260        $upload_return = $this->cdn_attachment_upload($_POST['post_id'],$_POST['path']);
    257261        if ($upload_return !== true) {
     
    328332                }
    329333            }
    330             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     334            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    331335            foreach($files_to_delete as $path) {
    332336                $cdn_loader->attachment_delete($path);
     
    436440        }
    437441        if( is_array($filestoload) ) {
    438             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     442            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    439443            $returndata = $cdn_loader->load_js_files($filestoload);
    440444            if ( $returndata[0] != '' && is_array($returndata[1]) ) {
     
    447451   
    448452    function cdn_remove_container($container_name) {
    449         $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     453        $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    450454        $cdn_loader->remove_container($container_name);
    451455        unset($this->cdntools_baseuris[$container_name]);
     
    464468        register_setting( 'cdn-options-group', 'cdntools_adminscripts', 'absint' );
    465469        register_setting( 'cdn-options-group', 'cdntools_sideload_uploads', 'absint' );
     470        register_setting( 'cdn-options-group', 'cdntools_logretention', 'absint' );
     471        register_setting( 'cdn-options-group', 'cdntools_servicenet', 'absint' );
    466472        register_setting( 'cdn-options-group', 'cdntools_advanced_options', 'absint' );
    467473        register_setting( 'cdn-options-group', 'cdntools_prefix', 'wp_filter_nohtml_kses' );
     
    532538                    delete_option('cdntools_adminscripts');
    533539                    delete_option('cdntools_sideload_uploads');
     540                    delete_option('cdntools_logretention');
     541                    delete_option('cdntools_servicenet');
    534542                    delete_option('cdntools_advanced_options');
    535543                    delete_option('cdntools_prefix');
     
    542550                    $this->cdntools_adminscripts = null;
    543551                    $this->cdntools_sideload_uploads = null;
     552                    $this->cdntools_logretention = null;
     553                    $this->cdntools_servicenet = null;
    544554                    $this->cdntools_advanced_options = null;
    545555            }
     
    645655                        <td colspan="2">Check this to enable side loading of uploads to your CDN.  Uploads will also be kept locally in the event that you wish to turn off the CDN/remove this plugin.  Once you configure your CDN you probably want to turn this on.</td>
    646656                    </tr>
     657                    <tr style="<?php echo $advanced_display; ?>">
     658                        <th>Enable CDN Log Retention:</th>
     659                        <?php
     660                        $logretentioncheck = ($this->cdntools_logretention)?'checked="checked"':'';
     661                        ?>
     662                        <td><input type="checkbox" name="cdntools_logretention" value="1" <?php echo $logretentioncheck; ?> /></td>
     663                    </tr>
     664                    <tr style="<?php echo $advanced_display; ?>">
     665                        <td colspan="2">Check this to enable CDN log retention. If enabled, logs will be periodically (at unpredictable intervals) compressed and uploaded to a ".CDN_ACCESS_LOGS" container in the form of "container_name.YYYYMMDDHH-XXXX.gz". After enabling  or disabling this option, you will need to re-upload your attachments to Cloud Files (click the "Load Attachments" button below).</td>
     666                    </tr>
     667                    <tr style="<?php echo $advanced_display; ?>">
     668                        <th>Enable Servicenet Connection:</th>
     669                        <?php
     670                        $servicenetcheck = ($this->cdntools_servicenet)?'checked="checked"':'';
     671                        ?>
     672                        <td><input type="checkbox" name="cdntools_servicenet" value="1" <?php echo $servicenetcheck; ?> /></td>
     673                    </tr>
     674                    <tr style="<?php echo $advanced_display; ?>">
     675                        <td colspan="2">Check this to enable the Servicenet connection to Cloud Files. If enabled, traffic to Cloud Files will use Rackspace's internal network to upload data to Cloud Files. This internal connection will almost always be faster than non-servicenet connections, and bandwidth on servicenet is free. However, servicenet connections will only work if this blog is hosted on a server that is hosted by Rackspace or Slicehost.  <b>Rackspace Cloud Sites does not currently support the servicenet.</b></td>
     676                    </tr>
    647677                    <!--tr style="<?php echo $advanced_display; ?>">
    648678                        <th>Load wp-admin Javascripts:</th>
     
    651681                        ?>
    652682                        <td><input type="checkbox" name="cdntools_adminscripts" value="1" <?php echo $adminupcheck; ?> /></td>
    653                     </tr-->
     683                    </tr>
    654684                    <tr style="<?php echo $advanced_display; ?>">
    655685                        <td colspan="2">Check this if you want the wp-admin javascript files to be put on your CDN.  Typically you will want to leave this unchecked.</td>
    656                     </tr>
     686                    </tr-->
    657687                    <tr style="<?php echo $advanced_display; ?>">
    658688                        <th>CDN Container Prefix:</th>
  • cdn-tools/tags/0.99/readme.txt

    r182426 r188582  
    44Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud
    55Requires at least: 2.8
    6 Tested up to: 2.9
    7 Stable tag: 0.98
     6Tested up to: 2.9.1
     7Stable tag: 0.99
    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= 0.99 =
     45* Log retention support (in advanced options)
     46* Servicenet flag (in advanced options)
     47* Both these features were added courtesy of John Dickinson
    4448
    4549= 0.98 =
     
    4953
    5054= 0.97 - 12/9/2009 =
    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.
     55* Initial sideload AJAX used an absolute path with the siteurl.  This should have been a relative path or the adminurl to accommodate situations where FORCE_SSL_ADMIN is defined.  Thanks to John for identifying the bug.
    5256
    5357= 0.96 - 12/4/2009 =
  • cdn-tools/trunk/cdn_classes/cloudfiles/loader.php

    r182426 r188582  
    1010    private $conn = null;
    1111   
    12     function __construct($authname,$authkey) {
     12    function __construct($authname,$authkey,$use_servicenet=False) {
    1313        $this->authname = $authname;
    1414        $this->authkey = $authkey;
     
    1717        $this->upload_path = $wpuploadinfo['basedir'];
    1818        $this->uploads_use_yearmonth_folders = get_option('uploads_use_yearmonth_folders');
    19         $this->authconn();
     19        $this->authconn($use_servicenet);
    2020       
    2121    }
    2222   
    23     public function authconn() {
     23    public function authconn($use_servicenet) {
    2424        $auth = new CF_Authentication($this->authname,$this->authkey);
    2525        try {
     
    3131            return false;
    3232        }
    33         $this->conn = new CF_Connection($auth);
     33        $this->conn = new CF_Connection($auth,$servicenet=$use_servicenet);
    3434    }
    3535   
     
    5151    }
    5252
    53     public function attachment_upload($filepath) {
     53    public function attachment_upload($filepath,$keep_logs=False) {
    5454        $file = str_replace($this->upload_path.'/','',$filepath);
    5555        if($this->uploads_use_yearmonth_folders) {
     
    6363        //need try/catch blocks here, all possible exceptions!
    6464        $wp_uploads = $this->conn->create_container($container_name);
     65        $wp_uploads->log_retention($keep_logs);
    6566        $object = $wp_uploads->create_object($object_name);
    6667        try {
  • cdn-tools/trunk/cdntools.php

    r182426 r188582  
    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.98
     7Version: 0.99
    88Author URI: http://langui.sh/
    99*/
     
    2828set_time_limit(90); //90 seconds max...
    2929
    30 define('CDNTOOLS_VERSION','0.98');
     30define('CDNTOOLS_VERSION','0.99');
    3131
    3232$dir_array = explode('/',dirname(__FILE__));
     
    5252    private $cdntools_authkey = null;
    5353    private $cdntools_adminscripts = null;
    54     private $cndtools_sideload_uploads = null;
     54    private $cdntools_sideload_uploads = null;
     55    private $cdntools_logretention = null;
     56    private $cdntools_servicenet = null;
    5557    private $cdntools_baseuris = array();
    5658    private $uploaded_file_path = null;
     
    98100        $this->cdntools_adminscripts = get_option('cdntools_adminscripts');
    99101        $this->cdntools_sideload_uploads = get_option('cdntools_sideload_uploads');
     102        $this->cdntools_logretention = get_option('cdntools_logretention');
     103        $this->cdntools_servicenet = get_option('cdntools_servicenet');
    100104        $this->cdntools_advanced_options = get_option('cdntools_advanced_options');
    101105        $wp_upload_dir = wp_upload_dir();
     
    238242                $file_to_upload = $this->uploaded_file_path;
    239243            }
    240             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
    241             $return_array = $cdn_loader->attachment_upload($file_to_upload);
     244            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
     245            $return_array = $cdn_loader->attachment_upload($file_to_upload, $this->cdntools_logretention);
    242246            if (!is_array($return_array)) {
    243247                return $return_array;
     
    253257        error_reporting(E_ERROR | E_WARNING | E_PARSE);
    254258        ini_set('display_errors',1);
    255         $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     259        $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    256260        $upload_return = $this->cdn_attachment_upload($_POST['post_id'],$_POST['path']);
    257261        if ($upload_return !== true) {
     
    328332                }
    329333            }
    330             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     334            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    331335            foreach($files_to_delete as $path) {
    332336                $cdn_loader->attachment_delete($path);
     
    436440        }
    437441        if( is_array($filestoload) ) {
    438             $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     442            $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    439443            $returndata = $cdn_loader->load_js_files($filestoload);
    440444            if ( $returndata[0] != '' && is_array($returndata[1]) ) {
     
    447451   
    448452    function cdn_remove_container($container_name) {
    449         $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey);
     453        $cdn_loader = new cdn_loader($this->cdntools_authname,$this->cdntools_authkey,$this->cdntools_servicenet);
    450454        $cdn_loader->remove_container($container_name);
    451455        unset($this->cdntools_baseuris[$container_name]);
     
    464468        register_setting( 'cdn-options-group', 'cdntools_adminscripts', 'absint' );
    465469        register_setting( 'cdn-options-group', 'cdntools_sideload_uploads', 'absint' );
     470        register_setting( 'cdn-options-group', 'cdntools_logretention', 'absint' );
     471        register_setting( 'cdn-options-group', 'cdntools_servicenet', 'absint' );
    466472        register_setting( 'cdn-options-group', 'cdntools_advanced_options', 'absint' );
    467473        register_setting( 'cdn-options-group', 'cdntools_prefix', 'wp_filter_nohtml_kses' );
     
    532538                    delete_option('cdntools_adminscripts');
    533539                    delete_option('cdntools_sideload_uploads');
     540                    delete_option('cdntools_logretention');
     541                    delete_option('cdntools_servicenet');
    534542                    delete_option('cdntools_advanced_options');
    535543                    delete_option('cdntools_prefix');
     
    542550                    $this->cdntools_adminscripts = null;
    543551                    $this->cdntools_sideload_uploads = null;
     552                    $this->cdntools_logretention = null;
     553                    $this->cdntools_servicenet = null;
    544554                    $this->cdntools_advanced_options = null;
    545555            }
     
    645655                        <td colspan="2">Check this to enable side loading of uploads to your CDN.  Uploads will also be kept locally in the event that you wish to turn off the CDN/remove this plugin.  Once you configure your CDN you probably want to turn this on.</td>
    646656                    </tr>
     657                    <tr style="<?php echo $advanced_display; ?>">
     658                        <th>Enable CDN Log Retention:</th>
     659                        <?php
     660                        $logretentioncheck = ($this->cdntools_logretention)?'checked="checked"':'';
     661                        ?>
     662                        <td><input type="checkbox" name="cdntools_logretention" value="1" <?php echo $logretentioncheck; ?> /></td>
     663                    </tr>
     664                    <tr style="<?php echo $advanced_display; ?>">
     665                        <td colspan="2">Check this to enable CDN log retention. If enabled, logs will be periodically (at unpredictable intervals) compressed and uploaded to a ".CDN_ACCESS_LOGS" container in the form of "container_name.YYYYMMDDHH-XXXX.gz". After enabling  or disabling this option, you will need to re-upload your attachments to Cloud Files (click the "Load Attachments" button below).</td>
     666                    </tr>
     667                    <tr style="<?php echo $advanced_display; ?>">
     668                        <th>Enable Servicenet Connection:</th>
     669                        <?php
     670                        $servicenetcheck = ($this->cdntools_servicenet)?'checked="checked"':'';
     671                        ?>
     672                        <td><input type="checkbox" name="cdntools_servicenet" value="1" <?php echo $servicenetcheck; ?> /></td>
     673                    </tr>
     674                    <tr style="<?php echo $advanced_display; ?>">
     675                        <td colspan="2">Check this to enable the Servicenet connection to Cloud Files. If enabled, traffic to Cloud Files will use Rackspace's internal network to upload data to Cloud Files. This internal connection will almost always be faster than non-servicenet connections, and bandwidth on servicenet is free. However, servicenet connections will only work if this blog is hosted on a server that is hosted by Rackspace or Slicehost.  <b>Rackspace Cloud Sites does not currently support the servicenet.</b></td>
     676                    </tr>
    647677                    <!--tr style="<?php echo $advanced_display; ?>">
    648678                        <th>Load wp-admin Javascripts:</th>
     
    651681                        ?>
    652682                        <td><input type="checkbox" name="cdntools_adminscripts" value="1" <?php echo $adminupcheck; ?> /></td>
    653                     </tr-->
     683                    </tr>
    654684                    <tr style="<?php echo $advanced_display; ?>">
    655685                        <td colspan="2">Check this if you want the wp-admin javascript files to be put on your CDN.  Typically you will want to leave this unchecked.</td>
    656                     </tr>
     686                    </tr-->
    657687                    <tr style="<?php echo $advanced_display; ?>">
    658688                        <th>CDN Container Prefix:</th>
  • cdn-tools/trunk/readme.txt

    r182426 r188582  
    44Tags: cdn, sideload, speed, content, distribution, performance, cloudfiles, files, media, accelerator, cloud
    55Requires at least: 2.8
    6 Tested up to: 2.9
    7 Stable tag: 0.98
     6Tested up to: 2.9.1
     7Stable tag: 0.99
    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= 0.99 =
     45* Log retention support (in advanced options)
     46* Servicenet flag (in advanced options)
     47* Both these features were added courtesy of John Dickinson
    4448
    4549= 0.98 =
     
    4953
    5054= 0.97 - 12/9/2009 =
    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.
     55* Initial sideload AJAX used an absolute path with the siteurl.  This should have been a relative path or the adminurl to accommodate situations where FORCE_SSL_ADMIN is defined.  Thanks to John for identifying the bug.
    5256
    5357= 0.96 - 12/4/2009 =
Note: See TracChangeset for help on using the changeset viewer.