Skip to content

Commit

Permalink
Deploying version 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmjones committed Feb 20, 2018
1 parent b9fe2dc commit 1bd5b75
Show file tree
Hide file tree
Showing 571 changed files with 49,179 additions and 692 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
**Requires at least:** 4.6
**Tested up to:** 4.9
**Stable tag:** 1.2.1
**Stable tag:** 1.3
**License:** GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -69,6 +69,23 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### WP Offload S3 Lite 1.3 - 2018-02-20 ###
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
* New: [Amazon Web Services plugin](https://wordpress.org/plugins/amazon-web-services/) is no longer required to run WP Offload S3 Lite
* New: Added [`as3cf_local_domains`](https://deliciousbrains.com/wp-offload-s3/doc/filtering-urls-for-multiple-domains/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting) filter for when site content is updated through multiple domains
* Improvement: AWS keys can be set in new "Settings" tab if not defined in wp-config.php
* Improvement: Minor tweaks to settings page UI including right aligning tabs and consistent title across Lite and Pro plugins
* Improvement: cURL version, theme version and parent theme information added to diagnostics
* Bug fix: Incompatible with plugins that include AWS PHP SDK v3
* Bug fix: Regenerate Thumbnails v3.0+ does not work with Remove Files From Server option
* Bug fix: "Warning: count(): Parameter must be an array or an object that implements Countable" error with PHP 7.2
* Bug fix: Force HTTPS not being applied to non-srcset S3 URLs in pages served over HTTP
* Bug fix: Content URLs not filtered to S3 URLs if AWS keys not set
* Bug fix: URL preview can be coerced to display invalid URL
* Bug fix: Changes to upload made via `as3cf_object_meta` filter are not reflected in amazonS3_info records
* Bug fix: Settings link not showing in network admin plugins page
* Bug fix: License in composer.json fails Packagist validation

### WP Offload S3 Lite 1.2.1 - 2017-11-20 ###
* New: Compatibility with HTML Widget
* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+
Expand Down
2 changes: 1 addition & 1 deletion assets/css/notice.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.as3cf-notice p,.aws-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none}
.as3cf-notice p,.as3cf-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none}.as3cf-notice-warning{border-left-color:#ffba00}
2 changes: 1 addition & 1 deletion assets/css/styles.css

Large diffs are not rendered by default.

Binary file added assets/img/as3cf-banner-bw.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/as3cf-banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions assets/img/aws-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/img/icon-assets-pull.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
159 changes: 145 additions & 14 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
var bucketNamePattern = /[^a-z0-9.-]/;
var refreshBucketListOnLoad = false;

var $body = $( 'body' );
var $tabs = $( '.as3cf-tab' );
var $settings = $( '.as3cf-settings' );
var $activeTab;

/**
Expand Down Expand Up @@ -68,7 +70,7 @@
$activeTab.show();
$( '.nav-tab' ).removeClass( 'nav-tab-active' );
$( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' );
$( '.aws-main' ).data( 'tab', hash );
$( '.as3cf-main' ).data( 'tab', hash );
if ( $activeTab.data( 'prefix' ) ) {
as3cfModal.prefix = $activeTab.data( 'prefix' );
}
Expand Down Expand Up @@ -294,6 +296,8 @@

// Make sure the bucket list will refresh the next time the modal loads
refreshBucketListOnLoad = true;

as3cf.showSettingsSavedNotice();
} else {
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
}
Expand Down Expand Up @@ -358,6 +362,8 @@
if ( 'undefined' !== typeof data[ 'success' ] ) {
that.set( bucketName, data[ 'region' ], data[ 'can_write' ] );
$( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );

as3cf.showSettingsSavedNotice();
} else {
that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
Expand Down Expand Up @@ -518,6 +524,8 @@

// Make sure the bucket list will refresh the next time the modal loads
refreshBucketListOnLoad = true;

as3cf.showSettingsSavedNotice();
} else {
that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
}
Expand Down Expand Up @@ -571,6 +579,35 @@

};

/**
* Reload the page, and show the persistent updated notice.
*
* Intended for use on plugin settings page.
*/
as3cf.reloadUpdated = function() {
var url = location.pathname + location.search;

if ( ! location.search.match( /[?&]updated=/ ) ) {
url += '&updated=1';
}

url += location.hash;

location.assign( url );
};

/**
* Show the standard "Settings saved." notice if not already visible.
*/
as3cf.showSettingsSavedNotice = function() {
if ( 0 < $( '#setting-error-settings_updated:visible' ).length || 0 < $( '#as3cf-settings_updated:visible' ).length ) {
return;
}
var settingsUpdatedNotice = '<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>' + as3cf.strings.settings_saved + '</strong></p></div>';
$( 'h2.nav-tab-wrapper' ).after( settingsUpdatedNotice );
$( document ).trigger( 'wp-updates-notice-added' ); // Hack to run WP Core's makeNoticesDismissible() function.
};

/**
* Get the link to the bucket on the AWS Console and update the DOM
*
Expand Down Expand Up @@ -667,6 +704,85 @@
$( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] );
}

/**
* Access Keys API object
* @constructor
*/
var AccessKeys = function() {
this.$key = $settings.find( 'input[name="aws-access-key-id"]' );
this.$secret = $settings.find( 'input[name="aws-secret-access-key"]' );
this.$spinner = $settings.find( '[data-as3cf-aws-keys-spinner]' );
this.$feedback = $settings.find( '[data-as3cf-aws-keys-feedback]' );
};

/**
* Set the access keys using the values in the settings fields.
*/
AccessKeys.prototype.set = function() {
this.sendRequest( 'set', {
'aws-access-key-id': this.$key.val(),
'aws-secret-access-key': this.$secret.val()
} ).done( function( response ) {
if ( response.success ) {
this.$secret.val( as3cf.strings.not_shown_placeholder );
}
}.bind( this ) );
};

/**
* Remove the access keys from the database and clear the fields.
*/
AccessKeys.prototype.remove = function() {
this.sendRequest( 'remove' )
.done( function( response ) {
if ( response.success ) {
this.$key.val( '' );
this.$secret.val( '' );
}
}.bind( this ) )
;
};

/**
* Send the request to the server to update the access keys.
*
* @param {string} action The action to perform with the keys
* @param {undefined|Object} params Extra parameters to send with the request
*
* @returns {jqXHR}
*/
AccessKeys.prototype.sendRequest = function( action, params ) {
var data = {
action: 'as3cf-aws-keys-' + action,
_ajax_nonce: as3cf.nonces[ 'aws_keys_' + action ]
};

if ( _.isObject( params ) ) {
data = _.extend( data, params );
}

this.$spinner.addClass( 'is-active' );

return $.post( ajaxurl, data )
.done( function( response ) {
this.$feedback
.toggleClass( 'notice-success', response.success )
.toggleClass( 'notice-error', ! response.success );

if ( response.data && response.data.message ) {
this.$feedback.html( '<p>' + response.data.message + '</p>' ).show();
}

if ( response.success ) {
as3cf.reloadUpdated();
}
}.bind( this ) )
.always( function() {
this.$spinner.removeClass( 'is-active' );
}.bind( this ) )
;
};

$( document ).ready( function() {

// Tabs
Expand All @@ -687,8 +803,8 @@
};

// Move any compatibility errors below the nav tabs
var $navTabs = $( '.wrap.aws-main .nav-tab-wrapper' );
$( '.aws-compatibility-notice, div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $navTabs );
var $navTabs = $( '.as3cf-main .nav-tab-wrapper' );
$( '.as3cf-compatibility-notice, div.updated, div.error, div.notice' ).not( '.below-h2, .inline' ).insertAfter( $navTabs );

// Settings
// --------------------
Expand Down Expand Up @@ -791,17 +907,17 @@
$( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );

// Action click handlers
$( 'body' ).on( 'click', '.bucket-action-manual', function( e ) {
$body.on( 'click', '.bucket-action-manual', function( e ) {
e.preventDefault();
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
} );
$( 'body' ).on( 'click', '.bucket-action-browse', function( e ) {
$body.on( 'click', '.bucket-action-browse', function( e ) {
e.preventDefault();
$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
as3cf.buckets.loadList( refreshBucketListOnLoad );
refreshBucketListOnLoad = false;
} );
$( 'body' ).on( 'click', '.bucket-action-create', function( e ) {
$body.on( 'click', '.bucket-action-create', function( e ) {
e.preventDefault();

// Reset create bucket modal
Expand All @@ -810,27 +926,27 @@

$( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
} );
$( 'body' ).on( 'click', '.bucket-action-cancel', function( e ) {
$body.on( 'click', '.bucket-action-cancel', function( e ) {
e.preventDefault();
as3cf.buckets.resetModal();
} );
$( 'body' ).on( 'click', '.bucket-action-save', function( e ) {
$body.on( 'click', '.bucket-action-save', function( e ) {
e.preventDefault();
as3cf.buckets.saveManual();
} );
$( 'body' ).on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
$body.on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
e.preventDefault();
as3cf.buckets.create();
} );

// Bucket list refresh handler
$( 'body' ).on( 'click', '.bucket-action-refresh', function( e ) {
$body.on( 'click', '.bucket-action-refresh', function( e ) {
e.preventDefault();
as3cf.buckets.loadList( true );
} );

// Bucket list click handler
$( 'body' ).on( 'click', '.as3cf-bucket-list a', function( e ) {
$body.on( 'click', '.as3cf-bucket-list a', function( e ) {
e.preventDefault();
as3cf.buckets.saveSelected( $( this ) );
} );
Expand All @@ -844,7 +960,7 @@
} );

// Modal open
$( 'body' ).on( 'as3cf-modal-open', function( e, target ) {
$body.on( 'as3cf-modal-open', function( e, target ) {
if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {

// Reset modal
Expand All @@ -862,7 +978,7 @@
as3cf.buckets.disabledButtons();

// Validate bucket name on create
$( 'body' ).on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
$body.on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
var bucketName = $( this ).val();
var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );

Expand All @@ -875,7 +991,7 @@
} );

// Check bucket name length on manual
$( 'body' ).on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
$body.on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );

if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
Expand All @@ -885,6 +1001,21 @@
}
} );

$settings
.on( 'click', '[data-as3cf-toggle-access-keys-form]', function( event ) {
event.preventDefault();
$( '#as3cf_access_keys' ).toggle();
} )
.on( 'click', '[data-as3cf-aws-keys-action]', function( event ) {
event.preventDefault();
var action = $( this ).data( 'as3cfAwsKeysAction' );
var api = new AccessKeys();

if ( 'function' === typeof api[action] ) {
api[action]();
}
} )
;
} );

})( jQuery, as3cfModal );
Loading

0 comments on commit 1bd5b75

Please sign in to comment.