Skip to content

Commit

Permalink
Deploying version 0.9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Oct 26, 2015
1 parent 87bd0a0 commit 411d17f
Show file tree
Hide file tree
Showing 20 changed files with 1,466 additions and 272 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
**Requires at least:** 3.7
**Tested up to:** 4.3
**Stable tag:** 0.9.6
**Stable tag:** 0.9.7
**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 @@ -67,8 +67,25 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### 0.9.6 - 2015-10-01 ###
### 0.9.7 - 2015-10-26 ###
* Improvement: Improve compatibility with third party plugins when the _Remove Files From Server_ option is enabled
* Improvement: Fix inconsistent spacing on the WP Offload S3 settings screen
* Improvement: Validate _CloudFront or custom domain_ input field
* Improvement: Link to current S3 bucket added to WP Offload S3 settings screen
* Improvement: Show notice when neither GD or Imagick image libraries are not installed
* Improvement: Supply Cache-Control header to S3 when the _Far Future Expiration Header_ option is enabled
* Improvement: Additional information added to _Diagnostic Information_
* Improvement: Added warning when _Remove Files From Server_ option is enabled
* Improvement: Filter added to allow additional image versions to be uploaded to S3
* Bug fix: File size not stored in _wp_attachment_metadata_ when _Remove Files From Server_ option is enabled
* Bug fix: Uploads on Multisite installs allowed after surpassing upload limit
* Bug fix: Site icon in WordPress customizer returns 404
* Bug fix: Image versions remain locally and on S3 after deletion, when the file name contains characters which require escaping
* Bug fix: Files with the same file name overwritten when __Remove Files From Server_ option is enabled
* Bug fix: Cron tasks incorrectly scheduled due to passing the wrong time to `wp_schedule_event`
* Bug fix: Default options not shown in the UI after first install

### 0.9.6 - 2015-10-01 ###
* Improvement: Update text domains for translate.wordpress.org integration

### 0.9.5 - 2015-09-01 ###
Expand Down
2 changes: 1 addition & 1 deletion assets/css/styles.css

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions assets/js/notice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function( $ ) {

$( 'body' ).on( 'click', '.as3cf-notice .notice-dismiss', function( e ) {
var id = $( this ).parents( '.as3cf-notice' ).attr( 'id' );
if ( id ) {
var data = {
action : 'as3cf-dismiss-notice',
notice_id: id,
_nonce : as3cf_notice.nonces.dismiss_notice
};

$.ajax( {
url : ajaxurl,
type : 'POST',
dataType: 'JSON',
data : data,
error : function( jqXHR, textStatus, errorThrown ) {
alert( as3cf_notice.strings.dismiss_notice_error + errorThrown );
}
} );
}
} );

})( jQuery );
96 changes: 95 additions & 1 deletion assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@
$checkbox.attr( 'checked', switchOn ).trigger( 'change' );
}

/**
* Validate custom domain
*
* @param {object} $input
*/
function validateCustomDomain( $input ) {
var $error = $input.next( '.as3cf-validation-error' );
var $submit = $( '#' + $activeTab.attr( 'id' ) + ' form button[type="submit"]' );
var pattern = /[^a-zA-Z0-9\.\-]/;

if ( pattern.test( $input.val() ) ) {
$error.show();
$submit.attr( 'disabled', true );
} else {
$error.hide();
$submit.attr( 'disabled', false );
}
}

as3cf.tabs = {
defaultTab: 'media',
/**
Expand Down Expand Up @@ -348,7 +367,7 @@
var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
var $activeBucket = $( '#' + as3cfModal.prefix + '-active-bucket' );

if ( 'as3cf' === as3cfModal.prefix && '' === $activeBucket.text() ) {
if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
// first time bucket select - enable main options by default
setCheckbox( 'copy-to-s3-wrap' );
setCheckbox( 'serve-from-s3-wrap' );
Expand Down Expand Up @@ -376,6 +395,8 @@
generateUrlPreview();
}

setBucketLink();

as3cfModal.close( unlockBucketSelect );
},

Expand Down Expand Up @@ -479,6 +500,25 @@

};

/**
* Get the link to the bucket on the AWS Console and update the DOM
*
* @returns {string}
*/
function setBucketLink() {
var bucket = $( '#' + as3cfModal.prefix + '-bucket' ).val();
var $objectPrefix = $activeTab.find( 'input[name="object-prefix"]' );
var prefix = $objectPrefix.val();

if ( '' !== prefix ) {
prefix = '&prefix=' + encodeURIComponent( prefix );
}

var url = as3cf.aws_bucket_link + bucket + prefix;

$( '#' + as3cfModal.prefix + '-view-bucket' ).attr( 'href', url );
}

/**
* Generate URL preview
*/
Expand Down Expand Up @@ -525,6 +565,28 @@
as3cf.buckets.bucketSelectLock = false;
}

/*
* Toggle the lost files notice
*/
function toggleLostFilesNotice() {
if ( $( '#remove-local-file' ).is( ':checked' ) && $( '#serve-from-s3' ).is( ':not(:checked)' ) ) {
$( '#as3cf-lost-files-notice' ).show();
} else {
$( '#as3cf-lost-files-notice' ).hide();
}
}

/*
* Toggle the remove local files notice
*/
function toggleRemoveLocalNotice() {
if ( $( '#remove-local-file' ).is( ':checked' ) ) {
$( '#as3cf-remove-local-notice' ).show();
} else {
$( '#as3cf-remove-local-notice' ).hide();
}
}

$( document ).ready( function() {

// Tabs
Expand Down Expand Up @@ -630,6 +692,16 @@
generateUrlPreview();
} );

toggleLostFilesNotice();
$( '#serve-from-s3,#remove-local-file' ).on( 'change', function( e ) {
toggleLostFilesNotice();
} );

toggleRemoveLocalNotice();
$( '#remove-local-file' ).on( 'change', function( e ) {
toggleRemoveLocalNotice();
} );

// Don't allow 'enter' key to submit form on text input settings
$( '.as3cf-setting input[type="text"]' ).keypress( function( event ) {
if ( 13 === event.which ) {
Expand All @@ -640,6 +712,28 @@

} );

// Validate custom domain
$( 'input[name="cloudfront"]' ).on( 'keyup', function( e ) {
validateCustomDomain( $( this ) );
} );

// Re-enable submit button on domain change
$( 'input[name="domain"]' ).on( 'change', function( e ) {
var $input = $( this );
var $submit = $( '#' + $activeTab.attr( 'id' ) + ' form button[type="submit"]' );

if ( 'cloudfront' !== $input.val() ) {
$submit.attr( 'disabled', false );
} else {
validateCustomDomain( $input.next( '.as3cf-setting' ).find( 'input[name="cloudfront"]' ) );
}
} );

// Change bucket link when custom path changes
$( 'input[name="object-prefix"]' ).on( 'change', function( e ) {
setBucketLink();
} );

// Bucket select
// --------------------

Expand Down
2 changes: 1 addition & 1 deletion assets/js/script.min.js

Large diffs are not rendered by default.

51 changes: 37 additions & 14 deletions assets/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
* AWS wrap
*/
.aws-main.wrap {
&> h2 {
& > h1 {
float: left;
}

.as3cf-notice, .as3cf-updated, .as3cf-error {
margin-bottom: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
Expand All @@ -21,11 +20,10 @@

h2.nav-tab-wrapper {
float: none;
margin-bottom: 0;
margin-bottom: 15px;
width: 650px;
margin-top: 10px;
padding-left: 5px;
padding-right: 0;
padding: 9px 0 0 5px;

a.nav-tab-active {
color: #464646;
Expand Down Expand Up @@ -247,6 +245,7 @@

.form-table {
margin: 0;

tr {
&.as3cf-border-bottom td {
border-bottom: 1px solid #ddd;
Expand All @@ -264,6 +263,16 @@
vertical-align: top;
min-width: 120px;
}

.as3cf-notice:last-child {
margin-bottom: 0;
}
}

&:first-of-type {
td {
padding-top: 5px;
}
}
}
h3 {
Expand All @@ -275,10 +284,21 @@
}
}

.as3cf-active-bucket {
font-weight: bold;
margin-right: 10px;
}
.as3cf-active-bucket {
font-weight: bold;
margin-right: 10px;
}
.as3cf-view-bucket {
color: #444;
text-decoration: none;
margin-right: 10px;
&:hover, &:active {
color: #00a0d2;
}
.dashicons-external {
margin-top: -2px;
}
}

.tooltip {
position: relative;
Expand Down Expand Up @@ -405,11 +425,6 @@
}
}

.as3cf-invalid-bucket-name {
font-size: 12px;
color: #a00;
}

.bucket-actions {
margin: 15px 0;
border-top: 1px solid #ccc;
Expand Down Expand Up @@ -714,4 +729,12 @@
span.title {
font-weight: bold;
}
}

.as3cf-invalid-bucket-name,
.as3cf-validation-error {
display: block;
margin-top: 2px;
font-size: 12px;
color: #a00;
}
Loading

0 comments on commit 411d17f

Please sign in to comment.