WP Offload S3 Lite - Version 2.0.1

Version Description

= 2.0 = This is a major upgrade that introduces support for DigitalOcean Spaces, renames the plugin to WP Offload Media Lite, and coincidentally upgrades some of its database settings. You may not be able to downgrade to WP Offload S3 Lite 1.x after upgrading to WP Offload Media Lite 2.0+.

= 1.1 = This is a major change, which ensures S3 URLs are no longer saved in post content. Instead, local URLs are filtered on page generation and replaced with the S3 version. If you depend on the S3 URLs being stored in post content you will need to make modifications to support this version.

= 0.6 = This version requires PHP 5.3.3+ and the Amazon Web Services plugin

Download this release

Release Info

Developer deliciousbrains
Plugin Icon 128x128 WP Offload S3 Lite
Version 2.0.1
Comparing to
See all releases

Code changes from version 2.0 to 2.0.1

README.md CHANGED
@@ -2,9 +2,9 @@
2
**Contributors:** bradt, deliciousbrains, ianmjones
3
**Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, mirror, admin, media, cdn, cloudfront
4
**Requires at least:** 4.7
5
- **Tested up to:** 4.9
6
**Requires PHP:** 5.5
7
- **Stable tag:** 2.0
8
**License:** GPLv3
9
10
Copies files to Amazon S3 or DigitalOcean Spaces as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
@@ -21,6 +21,10 @@ Uploading files *directly* to your Amazon S3 or DigitalOcean Spaces account is n
21
22
If you're adding this plugin to a site that's been around for a while, your existing media files will not be copied to or served from Amazon S3 or DigitalOcean Spaces. Only newly uploaded files will be copied to and served from the bucket. The pro upgrade has an upload tool to handle existing media files.
23
24
**PRO Upgrade with Email Support and More Features**
25
26
* Upload existing Media Library to Amazon S3 or DigitalOcean Spaces
@@ -36,8 +40,6 @@ The video below runs through the pro upgrade features...
36
37
https://www.youtube.com/watch?v=55xNGnbJ_CY
38
39
- *This plugin has been completely rewritten, but was originally a fork of [Amazon S3 for WordPress with CloudFront](http://wordpress.org/extend/plugins/tantan-s3-cloudfront/) which is a fork of [Amazon S3 for WordPress](http://wordpress.org/extend/plugins/tantan-s3/), also known as tantan-s3.*
40
-
41
## Installation ##
42
43
1. Install this plugin using WordPress' built-in installer
@@ -84,8 +86,16 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
84
85
## Changelog ##
86
87
### WP Offload Media Lite 2.0 - 2018-09-24 ###
88
- * [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-supports-digitalocean-spaces/)
89
* New: DigitalOcean Spaces is now supported
90
* New: Plugin name updated from WP Offload S3 Lite to WP Offload Media Lite
91
* Improvement: More logical UI layout and better description of each setting
2
**Contributors:** bradt, deliciousbrains, ianmjones
3
**Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, mirror, admin, media, cdn, cloudfront
4
**Requires at least:** 4.7
5
+ **Tested up to:** 5.0
6
**Requires PHP:** 5.5
7
+ **Stable tag:** 2.0.1
8
**License:** GPLv3
9
10
Copies files to Amazon S3 or DigitalOcean Spaces as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
21
22
If you're adding this plugin to a site that's been around for a while, your existing media files will not be copied to or served from Amazon S3 or DigitalOcean Spaces. Only newly uploaded files will be copied to and served from the bucket. The pro upgrade has an upload tool to handle existing media files.
23
24
+ **Image Optimization**
25
+
26
+ Although WP Offload Media doesn't include image optimization features, we work closely with the author of [EWWW Image Optimizer](https://wordpress.org/plugins/ewww-image-optimizer/) to ensure they always work well together. Not only do we recommend EWWW Image Optimizer but we officially support its integration with WP Offload Media.
27
+
28
**PRO Upgrade with Email Support and More Features**
29
30
* Upload existing Media Library to Amazon S3 or DigitalOcean Spaces
40
41
https://www.youtube.com/watch?v=55xNGnbJ_CY
42
43
## Installation ##
44
45
1. Install this plugin using WordPress' built-in installer
86
87
## Changelog ##
88
89
+ ### WP Offload Media Lite 2.0.1 - 2018-12-17 ###
90
+ * Improvement: Streamlined UI for setting Storage Provider and Bucket
91
+ * Bug fix: On/Off switches in settings look reversed
92
+ * Bug fix: Latest upgrade routine runs on fresh install
93
+ * Bug fix: Defined settings still found in database
94
+ * Bug fix: More Info links in Storage Provider settings incorrect
95
+ * Tested: WordPress 5.0
96
+
97
### WP Offload Media Lite 2.0 - 2018-09-24 ###
98
+ * [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-is-now-wp-offload-media-and-adds-support-for-digitalocean-spaces/)
99
* New: DigitalOcean Spaces is now supported
100
* New: Plugin name updated from WP Offload S3 Lite to WP Offload Media Lite
101
* Improvement: More logical UI layout and better description of each setting
assets/css/styles.css CHANGED
@@ -1 +1 @@
1
- .as3cf-content,.as3cf-updated,.as3cf-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.settings_page_amazon-s3-and-cloudfront .error,.settings_page_amazon-s3-and-cloudfront .notice,.settings_page_amazon-s3-and-cloudfront .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.as3cf-main.wrap{position:relative}.as3cf-main.wrap>h1{float:left}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .as3cf-updated,.as3cf-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-error.fatal{clear:both}.as3cf-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container{float:right}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container :last-child{margin-right:5px}.as3cf-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.as3cf-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-main.wrap .more-info{white-space:nowrap}.as3cf-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.as3cf-main.wrap .error pre code{padding:0;background:none}.as3cf-main.wrap[data-tab="support"] .as3cf-notice,.as3cf-main.wrap[data-tab="support"] .error,.as3cf-main.wrap[data-tab="support"] .updated,.as3cf-main.wrap[data-tab="support"] .updated.show{display:none}.as3cf-main.wrap[data-tab="support"] .fatal .error,.as3cf-main.wrap[data-tab="support"] .as3cf-notice.important,.as3cf-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .error,.as3cf-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-updated{display:none}.as3cf-main.wrap .as3cf-updated.as3cf-notice,.as3cf-main.wrap .as3cf-updated.show{display:block}.as3cf-main.wrap .alignleft{margin-right:20px;margin-bottom:20px}.as3cf-main.wrap .spinner{min-width:20px}.as3cf-tab .as3cf-main-settings{display:none}.as3cf-tab .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-can-write-error,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-can-write-error{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings{display:block}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-provider-select,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-provider-select{display:block}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-media-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-bucket-container,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) .as3cf-bucket-container{display:none}.as3cf-content>section{margin-bottom:20px}.as3cf-content>section+section.as3cf-access-keys{padding-top:20px;border-top:1px solid #d3d3d3}.as3cf-content>section+section.as3cf-access-keys .as3cf-section-heading{margin-top:0}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr.configure-url:first-child td{padding-top:5px;padding-bottom:0}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px;padding-top:20px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-region{font-style:italic}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right;white-space:nowrap}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}#tab-media{display:block}#tab-media .as3cf-provider-setting td{padding-top:20px;padding-bottom:5px}#tab-media .as3cf-bucket-setting td{padding:5px 0}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table .as3cf-provider-setting h4{font-weight:inherit;margin:0}.as3cf-bucket-container .form-table .as3cf-bucket-list{margin:5px 0 0 0}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .bucket-actions .bucket-action-cancel{color:#a00;text-decoration:none}.as3cf-bucket-container .bucket-actions .bucket-action-cancel:hover{color:red}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}.as3cf-bucket-container .as3cf-bucket-select,.as3cf-bucket-container .as3cf-bucket-create{display:none}.as3cf-bucket-container .bucket-actions.select{display:none}#tab-media{display:block}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .support-section h3{font-size:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-active-provider,.as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.as3cf-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}.as3cf-need-help{background-color:white;font-size:16px;font-weight:bold;padding:1em}.as3cf-need-help a{text-decoration:none}.as3cf-settings h3{font-size:20px}.as3cf-settings p{font-size:14px}.as3cf-addons,.as3cf-tab .as3cf-compatibility-notice{max-width:cover}textarea.as3cf-access-key-constants-snippet.code{width:100%;white-space:pre;overflow:hidden;font-size:12px;padding:10px;height:53px}.as3cf-addons .as3cf-addons-list{margin:20px 0 200px;padding-top:5px}.as3cf-addons .as3cf-addon{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:20px;font-size:14px}.as3cf-addons .as3cf-addon-info{min-height:100px}.as3cf-addons .as3cf-addon-links{float:right}.as3cf-addons .as3cf-addon-links span{padding:4px 6px}.as3cf-addons .as3cf-addon-icon{float:left;margin-right:20px}.as3cf-addons .as3cf-addon-details{white-space:nowrap}.as3cf-addons .as3cf-addon-title,.as3cf-addons .as3cf-addon-description{font-weight:100}.as3cf-addons .as3cf-addon+.as3cf-addon{margin-top:20px}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull{background-color:#0769ad;color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-title,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-description,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull a{color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra{background:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra a{color:#0769ad;text-decoration:none}
1
+ .as3cf-content,.as3cf-updated,.as3cf-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.settings_page_amazon-s3-and-cloudfront .error,.settings_page_amazon-s3-and-cloudfront .notice,.settings_page_amazon-s3-and-cloudfront .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.as3cf-main.wrap{position:relative}.as3cf-main.wrap>h1{float:left}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .as3cf-updated,.as3cf-main.wrap .as3cf-error{-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-error.fatal{clear:both}.as3cf-main.wrap h2.nav-tab-wrapper{float:none;margin-bottom:15px;width:650px;margin-top:10px;padding:9px 0 0 5px}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container{float:right}.as3cf-main.wrap h2.nav-tab-wrapper .nav-tab-container :last-child{margin-right:5px}.as3cf-main.wrap h2.nav-tab-wrapper a.nav-tab-active{color:#464646;cursor:default}.as3cf-main.wrap h2.nav-tab-wrapper a:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-main.wrap .more-info{white-space:nowrap}.as3cf-main.wrap .error pre{background:#eaeaea;background:rgba(0,0,0,0.07);display:block;padding:10px 15px}.as3cf-main.wrap .error pre code{padding:0;background:none}.as3cf-main.wrap[data-tab="support"] .as3cf-notice,.as3cf-main.wrap[data-tab="support"] .error,.as3cf-main.wrap[data-tab="support"] .updated,.as3cf-main.wrap[data-tab="support"] .updated.show{display:none}.as3cf-main.wrap[data-tab="support"] .fatal .error,.as3cf-main.wrap[data-tab="support"] .as3cf-notice.important,.as3cf-main.wrap[data-tab="support"] .dbrains-api-down{display:block}.as3cf-main.wrap .as3cf-notice,.as3cf-main.wrap .error,.as3cf-main.wrap .updated{max-width:650px;margin-top:15px;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-main.wrap .as3cf-updated{display:none}.as3cf-main.wrap .as3cf-updated.as3cf-notice,.as3cf-main.wrap .as3cf-updated.show{display:block}.as3cf-main.wrap .alignleft{margin-right:20px;margin-bottom:20px}.as3cf-main.wrap .spinner{min-width:20px}.as3cf-tab .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab .as3cf-main-settings .as3cf-bucket-container{display:none}.as3cf-tab .as3cf-main-settings .as3cf-bucket-container a.as3cf-change-provider{display:none}.as3cf-tab .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-can-write-error,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-can-write-error{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-provider-select,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-provider-select{display:block}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-bucket-container,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-needs-access-keys .as3cf-main-settings .as3cf-media-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-provider .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-can-write-error,.as3cf-tab.as3cf-has-access-keys.as3cf-change-bucket:not(.as3cf-change-provider) .as3cf-can-write-error{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select,.as3cf-tab.as3cf-has-access-keys.as3cf-change-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-bucket-container,.as3cf-tab.as3cf-has-access-keys.as3cf-change-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-bucket-container{display:block}.as3cf-tab.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings,.as3cf-tab.as3cf-has-access-keys.as3cf-change-bucket:not(.as3cf-change-provider) .as3cf-main-settings .as3cf-media-settings{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider):not(.as3cf-change-bucket) .as3cf-main-settings .as3cf-provider-select{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider):not(.as3cf-change-bucket) .as3cf-main-settings .as3cf-bucket-container{display:none}.as3cf-tab.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider):not(.as3cf-change-bucket) .as3cf-main-settings .as3cf-media-settings{display:block}.as3cf-content>section{margin-bottom:20px}.as3cf-content>section+section.as3cf-access-keys{padding-top:20px;border-top:1px solid #d3d3d3}.as3cf-content>section+section.as3cf-access-keys .as3cf-section-heading{margin-top:0}.as3cf-tab{display:none;position:relative;width:650px}.as3cf-tab .as3cf-main-settings p{font-size:13px}.as3cf-tab .as3cf-main-settings p a{color:#444}.as3cf-tab .object-prefix-desc em{white-space:nowrap}.as3cf-tab .as3cf-url-preview-wrap{background:#fff;text-align:center;padding:20px 0 0;max-width:650px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.as3cf-tab .as3cf-url-preview-wrap .as3cf-url-preview{margin-top:10px;padding:0 20px 10px;overflow-x:scroll}.as3cf-tab .as3cf-url-preview-wrap span{color:#aaa;text-transform:uppercase;font-weight:bold}.as3cf-tab .as3cf-radio-group label{display:block;margin-bottom:10px}.as3cf-tab .as3cf-radio-group label.disabled,.as3cf-tab .as3cf-radio-group label.disabled p{color:#bbb;cursor:default}.as3cf-tab .as3cf-radio-group p{padding-left:25px;color:#6b6b6b;margin:0;font-size:12px}.as3cf-tab .as3cf-radio-group p.as3cf-setting{margin-top:5px}.as3cf-tab .as3cf-switch{position:relative;display:inline-block;padding:2px;overflow:hidden;border-radius:2px;background-color:#d4d3d3;cursor:pointer}.as3cf-tab .as3cf-switch.on{background-color:#ade7b5}.as3cf-tab .as3cf-switch span{visibility:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;display:inline-block;height:100%;font-size:12px;line-height:20px;border-radius:2px;font-weight:bold;padding:4px 8px;background:#fff;color:#8d8d8d;z-index:1}.as3cf-tab .as3cf-switch span.on{color:#82d78b}.as3cf-tab .as3cf-switch span.checked{visibility:visible}.as3cf-tab .as3cf-switch.disabled{cursor:default;background:#e6e6e6}.as3cf-tab .as3cf-switch.disabled span{background:#f1f1f1;color:#d6d6d6}.as3cf-tab .as3cf-switch input[type="checkbox"]{position:absolute !important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.as3cf-tab .as3cf-setting.hide{display:none}.as3cf-tab div.as3cf-setting{margin-top:4px}.as3cf-tab h3{font-weight:normal;text-transform:uppercase}.as3cf-tab .form-table{margin:0}.as3cf-tab .form-table tr.as3cf-border-bottom td{border-bottom:1px solid #ddd;padding:20px 0px}.as3cf-tab .form-table tr.as3cf-setting-title td{padding-bottom:0}.as3cf-tab .form-table tr.as3cf-setting-title:first-child td{padding-top:20px}.as3cf-tab .form-table tr.configure-url:first-child td{padding-top:5px;padding-bottom:0}.as3cf-tab .form-table tr td{padding:15px 0}.as3cf-tab .form-table tr td:first-child{vertical-align:top;min-width:120px;padding-top:20px}.as3cf-tab .form-table tr td .as3cf-notice:last-child{margin-bottom:0}.as3cf-tab .form-table tr td>p:first-child{margin-top:0}.as3cf-tab .form-table h3{padding:0;margin:0}.as3cf-tab .form-table h4{margin:0}.as3cf-tab .as3cf-active-region{font-style:italic}.as3cf-tab .as3cf-view-bucket{color:#444;text-decoration:none;margin-right:10px}.as3cf-tab .as3cf-view-bucket:hover,.as3cf-tab .as3cf-view-bucket:active{color:#00a0d2}.as3cf-tab .as3cf-view-bucket:focus{-webkit-box-shadow:none;box-shadow:none}.as3cf-tab .as3cf-view-bucket .dashicons-external{margin-top:-2px}.as3cf-tab .tooltip{position:relative;z-index:2;cursor:pointer}.as3cf-tab .tooltip:before,.as3cf-tab .tooltip:after{visibility:hidden;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=0);opacity:0;pointer-events:none}.as3cf-tab .tooltip:before{position:absolute;bottom:150%;left:50%;margin-bottom:5px;margin-left:-250px;padding:10px;width:500px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,0.9);color:#fff;content:attr(data-tooltip);text-align:center;font-size:14px;line-height:1.3}.as3cf-tab .tooltip:after{position:absolute;bottom:150%;left:50%;margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,0.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.as3cf-tab .tooltip:hover:before,.as3cf-tab .tooltip:hover:after{visibility:visible;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=100);opacity:1}.as3cf-tab .as3cf-defined-in-config{background:#ccc;color:#fff;padding:2px 5px;margin:0 0 5px 5px;float:right;white-space:nowrap}.as3cf-tab .as3cf-defined-setting{color:#bbb}.as3cf-tab .as3cf-defined-setting label{cursor:default}.as3cf-tab .as3cf-defined-setting p .more-info a{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-radio-group p{color:#bbb}.as3cf-tab .as3cf-defined-setting .as3cf-notice{display:none !important}.as3cf-tab p.actions{margin:20px -30px -30px;padding:20px 30px;border-top:none;overflow:hidden}.as3cf-tab p.actions .right{margin-left:15px}.as3cf-tab p.actions .right:last-of-type{margin-left:0}.as3cf-tab p.actions button{min-width:90px}#tab-media{display:block}#tab-media .as3cf-provider-setting td{padding-top:20px;padding-bottom:5px}#tab-media .as3cf-bucket-setting td{padding:5px 0}.as3cf-bucket-container h3{line-height:1.3;text-transform:none}.as3cf-bucket-container a:focus{-webkit-box-shadow:none;box-shadow:none;outline:none}.as3cf-bucket-container input[type=text]{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%}.as3cf-bucket-container select{-webkit-box-sizing:border-box;box-sizing:border-box;width:50%}.as3cf-bucket-container .form-table .as3cf-provider-setting h4{font-weight:inherit;margin:0}.as3cf-bucket-container .form-table .as3cf-bucket-list{margin:5px 0 0 0}.as3cf-bucket-container .form-table td{padding:5px 0}.as3cf-bucket-container .form-table td:first-child{width:100px;line-height:30px;vertical-align:top}.as3cf-bucket-container .bucket-actions{margin:15px 0;border-top:1px solid #ccc;padding-top:15px;overflow:hidden}.as3cf-bucket-container .bucket-actions button,.as3cf-bucket-container .bucket-actions .right{float:right;margin-right:0}.as3cf-bucket-container .bucket-actions span{display:inline-block;margin-right:20px;line-height:28px}.as3cf-bucket-container .as3cf-bucket-list{padding:15px;max-height:200px;overflow-x:hidden;overflow-y:auto;background-color:#fff;font-size:14px}.as3cf-bucket-container .as3cf-bucket-list li:last-of-type{margin-bottom:0}.as3cf-bucket-container .as3cf-bucket-list a{color:#444;text-decoration:none}.as3cf-bucket-container .as3cf-bucket-list a:hover{color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a.selected{font-weight:bold;color:#0074a2}.as3cf-bucket-container .as3cf-bucket-list a .dashicons{margin-right:5px}#tab-media{display:block}#tab-support{min-height:900px}#tab-support .as3cf-sidebar{top:11px}#tab-support .support-section{border-bottom:1px solid #ccc;padding-bottom:20px;margin-bottom:20px}#tab-support .support-section h3{font-size:20px}#tab-support .debug textarea{width:100%;min-height:200px;font-family:Consolas, Monaco, monospace;margin-bottom:5px}.as3cf-sidebar{position:absolute;top:9px;left:670px;width:292px}.as3cf-sidebar .block{padding:20px;border:1px solid #ccc}.as3cf-sidebar .subscribe{border-top:none}.as3cf-sidebar .subscribe h2{padding:0;margin:0;margin-bottom:0.5em;color:#666;font-size:20px;line-height:1.2em;float:none}.as3cf-sidebar .subscribe h3{font-size:16px;margin:0}.as3cf-sidebar .subscribe p{margin:0}.as3cf-sidebar .subscribe .intro{margin-bottom:1em;line-height:1.4}.as3cf-sidebar .subscribe li{line-height:1.4}.as3cf-sidebar .subscribe .links{margin-bottom:2em}.as3cf-sidebar .subscribe .links a{text-decoration:none}.as3cf-sidebar .subscribe .promise{color:#999;font-size:12px;line-height:1.4em}.as3cf-sidebar .subscribe .field{margin-bottom:0.5em}.as3cf-sidebar .subscribe .field p{margin-bottom:0.3em}.as3cf-sidebar .subscribe .field input[type=text],.as3cf-sidebar .subscribe .field input[type=email]{width:100%}.as3cf-sidebar .subscribe .field.submit-button{margin-bottom:1em}.as3cf-sidebar .credits{border-top:0}.as3cf-sidebar .credits h4{font-size:16px;margin-top:0;margin-bottom:10px}.as3cf-sidebar .credits ul{margin:0}.as3cf-sidebar .credits li{overflow:hidden}.as3cf-sidebar .credits li:last-child{margin-bottom:0}.as3cf-sidebar .credits img{float:left;margin-right:10px}.as3cf-sidebar .credits span{float:left;display:block;line-height:32px}.as3cf-sidebar .credits a{display:block;text-decoration:none;color:#444;font-size:16px;text-align:center}.as3cf-sidebar .credits a:hover{color:#888}@media screen and (max-width: 1052px){.as3cf-sidebar{position:relative;top:auto;right:auto}}.as3cf-active-provider,.as3cf-active-bucket{font-weight:bold;margin-right:10px}.as3cf-banner{margin-top:35px;width:292px;height:200px;display:block;background:#f8cfae url(../img/os3-banner.svg) left bottom/220px 220px no-repeat}.as3cf-banner:focus{-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details{background-color:#4e0d33;padding:10px 20px 20px 20px;color:#eee;font-size:13px;margin:0;display:block;text-decoration:none}.wrap .as3cf-upgrade-details h1{font-size:28px;color:#eee;margin:0 0 15px 0;padding:0;text-decoration:none;font-weight:200;line-height:1}.wrap .as3cf-upgrade-details p{margin:0}.wrap .as3cf-upgrade-details a{color:#eee;font-weight:bold;text-decoration:none;font-size:16px;-webkit-box-shadow:none;box-shadow:none}.wrap .as3cf-upgrade-details a:hover{color:#fff}.wrap .as3cf-upgrade-details ul{margin-top:0;margin-left:16px;list-style-type:disc}.as3cf-compatibility-notice.error{clear:both;margin:5px 20px 5px 0}.as3cf-bucket-error span.title{font-weight:bold}.as3cf-invalid-bucket-name,.as3cf-validation-error{display:block;margin-top:2px;font-size:12px;color:#a00}.as3cf-notice-toggle-content{max-height:100px;overflow-y:scroll}.as3cf-notice-toggle-content .as3cf-notice-toggle-list{margin-top:0;margin-left:0;padding-left:40px;color:#dc3232}.as3cf-need-help{background-color:white;font-size:16px;font-weight:bold;padding:1em}.as3cf-need-help a{text-decoration:none}.as3cf-settings h3{font-size:20px}.as3cf-settings p{font-size:14px}.as3cf-addons,.as3cf-tab .as3cf-compatibility-notice{max-width:cover}textarea.as3cf-access-key-constants-snippet.code{width:100%;white-space:pre;overflow:hidden;font-size:12px;padding:10px;height:53px}.as3cf-addons .as3cf-addons-list{margin:20px 0 200px;padding-top:5px}.as3cf-addons .as3cf-addon{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:20px;font-size:14px}.as3cf-addons .as3cf-addon-info{min-height:100px}.as3cf-addons .as3cf-addon-links{float:right}.as3cf-addons .as3cf-addon-links span{padding:4px 6px}.as3cf-addons .as3cf-addon-icon{float:left;margin-right:20px}.as3cf-addons .as3cf-addon-details{white-space:nowrap}.as3cf-addons .as3cf-addon-title,.as3cf-addons .as3cf-addon-description{font-weight:100}.as3cf-addons .as3cf-addon+.as3cf-addon{margin-top:20px}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull{background-color:#0769ad;color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-title,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .as3cf-addon-description,.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull a{color:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra{background:white}.as3cf-addons .as3cf-addon.amazon-s3-and-cloudfront-assets-pull .extra a{color:#0769ad;text-decoration:none}
assets/js/script.js CHANGED
@@ -2,7 +2,6 @@
2
3
var savedSettings = {};
4
var bucketNamePattern = /[^a-z0-9.-]/;
5
- var refreshBucketListOnLoad = false;
6
7
var $body = $( 'body' );
8
var $tabs = $( '.as3cf-tab' );
@@ -173,6 +172,9 @@
173
174
$bucketList.html( '<li class="loading">' + $bucketList.data( 'working' ) + '</li>' );
175
176
var data = {
177
action: as3cfModal.prefix + '-get-buckets',
178
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.get_buckets
@@ -199,7 +201,7 @@
199
if ( 'undefined' !== typeof data[ 'success' ] ) {
200
$( '.as3cf-bucket-error' ).hide();
201
202
- if ( 0 === data['buckets'].length ) {
203
$bucketList.html( '<li class="loading">' + $bucketList.data( 'nothing-found' ) + '</li>' );
204
} else {
205
$( data[ 'buckets' ] ).each( function( idx, bucket ) {
@@ -208,6 +210,7 @@
208
} );
209
210
that.scrollToSelected();
211
}
212
} else {
213
that.showError( as3cf.strings.get_buckets_error, data[ 'error' ], 'as3cf-bucket-select' );
@@ -232,189 +235,44 @@
232
},
233
234
/**
235
- * Reset bucket modal
236
- */
237
- resetModal: function() {
238
- var $bucketContainer = $( '.as3cf-bucket-container.' + as3cfModal.prefix );
239
-
240
- if ( false === $activeTab.hasClass( 'as3cf-has-bucket' ) || 'manual' === $( '#' + as3cfModal.prefix + '-bucket-select' ).val() ) {
241
- $bucketContainer.find( '.as3cf-bucket-manual' ).show().siblings().hide();
242
- $bucketContainer.find( '.bucket-actions.manual' ).show().siblings( '.bucket-actions' ).hide();
243
- } else {
244
- $bucketContainer.find( '.as3cf-bucket-select' ).show().siblings().hide();
245
- $bucketContainer.find( '.bucket-actions.select' ).show().siblings( '.bucket-actions' ).hide();
246
-
247
- this.loadList( refreshBucketListOnLoad );
248
-
249
- refreshBucketListOnLoad = false;
250
- }
251
-
252
- $bucketContainer.find( '.as3cf-bucket-error' ).hide();
253
-
254
- // Reset manual select value
255
- var bucket = $( '#' + as3cfModal.prefix + '-bucket' ).val();
256
- $bucketContainer.find( '.as3cf-bucket-manual .as3cf-bucket-name' ).val( bucket );
257
-
258
- // Unlock setting the bucket
259
- this.bucketSelectLock = false;
260
- },
261
-
262
- /**
263
- * Save manual bucket
264
- */
265
- saveManual: function() {
266
- var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
267
- var $manualBucketRegion = $manualBucketForm.find( '.bucket-manual-region' );
268
- var $manualBucketInput = $manualBucketForm.find( '.as3cf-bucket-name' );
269
- var $manualBucketButton = $manualBucketForm.find( 'button[type=submit]' );
270
- var bucketName = $manualBucketInput.val();
271
- var originalBucketText = $manualBucketButton.first().text();
272
-
273
- if ( bucketName === $( '#' + as3cfModal.prefix + '-active-bucket' ).text() ) {
274
- $( '.as3cf-bucket-error' ).hide();
275
- $activeTab.addClass( 'as3cf-has-bucket' );
276
- as3cfModal.close();
277
- return;
278
- }
279
- $( '.as3cf-bucket-error' ).hide();
280
- $manualBucketButton.text( $manualBucketButton.data( 'working' ) );
281
- $manualBucketButton.prop( 'disabled', true );
282
-
283
- var data = {
284
- action: as3cfModal.prefix + '-manual-save-bucket',
285
- bucket_name: bucketName,
286
- _nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.manual_bucket
287
- };
288
-
289
- if ( $manualBucketRegion.val() ) {
290
- data[ 'region' ] = $manualBucketRegion.val();
291
- }
292
-
293
- var that = this;
294
-
295
- $.ajax( {
296
- url: ajaxurl,
297
- type: 'POST',
298
- dataType: 'JSON',
299
- data: data,
300
- error: function( jqXHR, textStatus, errorThrown ) {
301
- $manualBucketButton.text( originalBucketText );
302
- that.showError( as3cf.strings.save_bucket_error, errorThrown, 'as3cf-bucket-manual' );
303
- },
304
- success: function( data, textStatus, jqXHR ) {
305
- $manualBucketButton.text( originalBucketText );
306
- $manualBucketButton.prop( 'disabled', false );
307
- if ( 'undefined' !== typeof data[ 'success' ] ) {
308
- that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
309
- $( '#' + as3cfModal.prefix + '-bucket-select' ).val( 'manual' );
310
- $( '.as3cf-bucket-list a' ).removeClass( 'selected' ).filter( '[data-bucket="' + bucketName + '"]' ).addClass( 'selected' );
311
-
312
- // Make sure the bucket list will refresh the next time the modal loads
313
- refreshBucketListOnLoad = true;
314
-
315
- as3cf.showSettingsSavedNotice();
316
- } else {
317
- that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-manual' );
318
- }
319
- }
320
- } );
321
- },
322
-
323
- /**
324
- * Save select bucket
325
*
326
* @param {object} $link
327
*/
328
- saveSelected: function( $link ) {
329
- if ( this.bucketSelectLock ) {
330
-
331
- // Bail if a bucket has already been clicked
332
- return;
333
- }
334
-
335
- // Lock the bucket selection
336
- this.bucketSelectLock = true;
337
-
338
- var $selectBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
339
- var $selectBucketRegion = $selectBucketForm.find( '.bucket-select-region' );
340
- var $bucketList = $selectBucketForm.find( '.as3cf-bucket-list' );
341
-
342
- if ( $link.hasClass( 'selected' ) ) {
343
- $activeTab.addClass( 'as3cf-has-bucket' );
344
- as3cfModal.close();
345
- return;
346
- }
347
-
348
- var previousBucket = $selectBucketForm.find( '.as3cf-bucket-list a.selected' ).data( 'bucket' );
349
-
350
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
351
$link.addClass( 'selected' );
352
-
353
- $bucketList.addClass( 'saving' );
354
- $link.find( '.spinner' ).show().css( 'visibility', 'visible' );
355
- var bucketName = $link.data( 'bucket' );
356
-
357
- var data = {
358
- action: as3cfModal.prefix + '-save-bucket',
359
- bucket_name: bucketName,
360
- _nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.save_bucket
361
- };
362
-
363
- if ( $selectBucketRegion.val() ) {
364
- data[ 'region' ] = $selectBucketRegion.val();
365
- }
366
-
367
- var that = this;
368
-
369
- $.ajax( {
370
- url: ajaxurl,
371
- type: 'POST',
372
- dataType: 'JSON',
373
- data: data,
374
- error: function( jqXHR, textStatus, errorThrown ) {
375
- $bucketList.removeClass( 'saving' );
376
- that.showError( as3cf.strings.save_bucket_error, errorThrown, 'as3cf-bucket-select' );
377
- $( '.as3cf-bucket-list a' ).removeClass( 'selected' );
378
- $( '.as3cf-bucket-list a[data-bucket="' + previousBucket + '"]' ).addClass( 'selected' );
379
- },
380
- success: function( data, textStatus, jqXHR ) {
381
- $link.find( '.spinner' ).hide().css( 'visibility', 'hidden' );
382
- $bucketList.removeClass( 'saving' );
383
- if ( 'undefined' !== typeof data[ 'success' ] ) {
384
- that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
385
- $( '#' + as3cfModal.prefix + '-bucket-select' ).val( '' );
386
-
387
- as3cf.showSettingsSavedNotice();
388
- } else {
389
- that.showError( as3cf.strings.save_bucket_error, data[ 'error' ], 'as3cf-bucket-select' );
390
- $( '.as3cf-bucket-list a' ).removeClass( 'selected' );
391
- $( '.as3cf-bucket-list a[data-bucket="' + previousBucket + '"]' ).addClass( 'selected' );
392
- }
393
- }
394
- } );
395
},
396
397
/**
398
* Disable bucket buttons
399
*/
400
disabledButtons: function() {
401
- if ( 0 === $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' ).length ) {
402
return;
403
}
404
405
- var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
406
- var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
407
-
408
- if ( $createBucketForm.find( '.as3cf-bucket-name' ).val().length < 3 ) {
409
- $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
410
- } else {
411
$createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
412
}
413
414
- if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < 3 ) {
415
$manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
416
} else {
417
- $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
418
}
419
},
420
@@ -443,127 +301,6 @@
443
this.bucketSelectLock = false;
444
},
445
446
- /**
447
- * Set the selected bucket in the UI
448
- *
449
- * @param {string} bucket
450
- * @param {string} region
451
- * @param {string} region_name
452
- * @param {boolean} canWrite
453
- */
454
- set: function( bucket, region, region_name, canWrite ) {
455
- var $manualBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' );
456
- var $selectBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
457
- var $createBucket = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' );
458
- var $activeRegion = $( '#' + as3cfModal.prefix + '-active-region' );
459
- var $activeBucket = $( '#' + as3cfModal.prefix + '-active-bucket' );
460
-
461
- if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
462
-
463
- // First time bucket select - enable main options by default
464
- setCheckbox( 'as3cf-copy-to-s3-wrap' );
465
- setCheckbox( 'as3cf-serve-from-s3-wrap' );
466
-
467
- // Update the saved settings string so we don't trigger the navigation alert
468
- var id = $activeTab.attr( 'id' );
469
- savedSettings[ id ] = serializedForm( id );
470
- }
471
-
472
- // Remove previous permission errors
473
- $( '.as3cf-error.fatal' ).hide();
474
-
475
- $activeBucket.text( bucket );
476
- $manualBucket.find( '.as3cf-bucket-name' ).val( bucket );
477
- $( '#' + as3cfModal.prefix + '-bucket' ).val( bucket );
478
-
479
- $activeRegion.text( region_name );
480
- $manualBucket.find( '.bucket-manual-region' ).val( region );
481
- $selectBucket.find( '.bucket-select-region' ).val( region );
482
- $createBucket.find( '.bucket-create-region' ).val( region );
483
- $( '#' + as3cfModal.prefix + '-region' ).val( region );
484
-
485
- $( '.updated' ).not( '.as3cf-notice' ).show();
486
-
487
- $activeTab.addClass( 'as3cf-has-bucket' );
488
-
489
- // Check permission on bucket
490
- $activeTab.find( '.as3cf-can-write-error' ).toggle( ! canWrite );
491
- $activeTab.find( '.as3cf-bucket-error' ).hide();
492
-
493
- if ( 'as3cf' === as3cfModal.prefix ) {
494
- generateUrlPreview();
495
- }
496
-
497
- setBucketLink();
498
-
499
- as3cfModal.close( function() {
500
- $activeTab.trigger( 'bucket-change', [ canWrite ] );
501
-
502
- // Unlock setting the bucket
503
- as3cf.buckets.bucketSelectLock = false;
504
- } );
505
- },
506
-
507
- /**
508
- * Save create bucket
509
- */
510
- create: function() {
511
- var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
512
- var $createBucketInput = $createBucketForm.find( '.as3cf-bucket-name' );
513
- var $createBucketRegion = $createBucketForm.find( '.bucket-create-region' );
514
- var $createBucketButton = $createBucketForm.find( 'button[type=submit]' );
515
-
516
- var bucketName = $createBucketInput.val();
517
- var origButtonText = $createBucketButton.text();
518
-
519
- $( '.as3cf-bucket-error' ).hide();
520
- $createBucketButton.text( $createBucketButton.data( 'working' ) );
521
- $createBucketButton.prop( 'disabled', true );
522
-
523
- var data = {
524
- action: as3cfModal.prefix + '-create-bucket',
525
- bucket_name: bucketName,
526
- _nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.create_bucket
527
- };
528
-
529
- if ( $createBucketRegion.val() ) {
530
- data[ 'region' ] = $createBucketRegion.val();
531
- }
532
-
533
- var that = this;
534
-
535
- $.ajax( {
536
- url: ajaxurl,
537
- type: 'POST',
538
- dataType: 'JSON',
539
- data: data,
540
- error: function( jqXHR, textStatus, errorThrown ) {
541
- $createBucketButton.text( origButtonText );
542
- that.showError( as3cf.strings.create_bucket_error, errorThrown, 'as3cf-bucket-create' );
543
- },
544
- success: function( data, textStatus, jqXHR ) {
545
- $createBucketButton.text( origButtonText );
546
- $createBucketButton.prop( 'disabled', false );
547
- if ( 'undefined' !== typeof data[ 'success' ] ) {
548
- that.set( bucketName, data[ 'region' ], data['region_name'], data[ 'can_write' ] );
549
-
550
- // Tidy up create bucket form
551
- $( '.as3cf-bucket-select-region' ).hide();
552
- $( '.as3cf-bucket-select-region' ).prop( 'selected', false );
553
- $createBucketInput.val( '' );
554
- $createBucketButton.prop( 'disabled', true );
555
-
556
- // Make sure the bucket list will refresh the next time the modal loads
557
- refreshBucketListOnLoad = true;
558
-
559
- as3cf.showSettingsSavedNotice();
560
- } else {
561
- that.showError( as3cf.strings.create_bucket_error, data[ 'error' ], 'as3cf-bucket-create' );
562
- }
563
- }
564
- } );
565
- },
566
-
567
/**
568
* Check for a valid bucket name
569
*
@@ -658,6 +395,39 @@
658
$( '#' + as3cfModal.prefix + '-view-bucket' ).attr( 'href', url );
659
}
660
661
/**
662
* Generate URL preview
663
*/
@@ -697,39 +467,6 @@
697
} );
698
}
699
700
- /*
701
- * Toggle the lost files notice
702
- */
703
- function toggleLostFilesNotice() {
704
- if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) && $( '#as3cf-serve-from-s3' ).is( ':not(:checked)' ) ) {
705
- $( '#as3cf-lost-files-notice' ).show();
706
- } else {
707
- $( '#as3cf-lost-files-notice' ).hide();
708
- }
709
- }
710
-
711
- /*
712
- * Toggle the remove local files notice
713
- */
714
- function toggleRemoveLocalNotice() {
715
- if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) ) {
716
- $( '#as3cf-remove-local-notice' ).show();
717
- } else {
718
- $( '#as3cf-remove-local-notice' ).hide();
719
- }
720
- }
721
-
722
- /*
723
- * Toggle the seo friendly url notice.
724
- */
725
- function toggleSEOFriendlyURLNotice( seo_friendly ) {
726
- if ( true !== seo_friendly ) {
727
- $( '#as3cf-seo-friendly-url-notice' ).show();
728
- } else {
729
- $( '#as3cf-seo-friendly-url-notice' ).hide();
730
- }
731
- }
732
-
733
/**
734
* Update the UI with the current active tab set in the URL hash.
735
*/
@@ -870,38 +607,8 @@
870
// Move bucket errors
871
$( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
872
873
- // Action click handlers
874
- $body.on( 'click', '.bucket-action-manual', function( e ) {
875
- e.preventDefault();
876
- $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' ).show().siblings().hide();
877
- } );
878
- $body.on( 'click', '.bucket-action-browse', function( e ) {
879
- e.preventDefault();
880
- $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).show().siblings().hide();
881
- as3cf.buckets.loadList( refreshBucketListOnLoad );
882
- refreshBucketListOnLoad = false;
883
- } );
884
- $body.on( 'click', '.bucket-action-create', function( e ) {
885
- e.preventDefault();
886
-
887
- // Reset create bucket modal
888
- $( '.as3cf-bucket-name' ).val( '' );
889
- $( '.as3cf-invalid-bucket-name' ).html( '' );
890
-
891
- $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' ).show().siblings().hide();
892
- } );
893
- $body.on( 'click', '.bucket-action-cancel', function( e ) {
894
- e.preventDefault();
895
- as3cf.buckets.resetModal();
896
- } );
897
- $body.on( 'click', '.bucket-action-save', function( e ) {
898
- e.preventDefault();
899
- as3cf.buckets.saveManual();
900
- } );
901
- $body.on( 'click', '.as3cf-create-bucket-form button[type="submit"]', function( e ) {
902
- e.preventDefault();
903
- as3cf.buckets.create();
904
- } );
905
906
// Bucket list refresh handler
907
$body.on( 'click', '.bucket-action-refresh', function( e ) {
@@ -915,10 +622,16 @@
915
as3cf.buckets.loadList( true );
916
} );
917
918
// Bucket list click handler
919
$body.on( 'click', '.as3cf-bucket-list a', function( e ) {
920
e.preventDefault();
921
- as3cf.buckets.saveSelected( $( this ) );
922
} );
923
924
// External links click handler
@@ -929,45 +642,25 @@
929
return false;
930
} );
931
932
- // Modal open
933
- $body.on( 'as3cf-modal-open', function( e, target ) {
934
- if ( '.as3cf-bucket-container.' + as3cfModal.prefix === target ) {
935
-
936
- // Reset modal
937
- as3cf.buckets.resetModal();
938
-
939
- // Change manual title text
940
- var title = $( '.as3cf-bucket-manual h3' ).data( 'modal-title' );
941
- $( '.as3cf-bucket-manual h3' ).text( title );
942
-
943
- // Hide buttons
944
- as3cf.buckets.disabledButtons();
945
- }
946
- } );
947
-
948
- as3cf.buckets.disabledButtons();
949
-
950
// Validate bucket name on create
951
- $body.on( 'input keyup', '.as3cf-create-bucket-form .as3cf-bucket-name', function( e ) {
952
var bucketName = $( this ).val();
953
- var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-create-bucket-form' );
954
955
- if ( as3cf.buckets.isValidName( bucketName ) ) {
956
- $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
957
- } else {
958
- $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
959
- }
960
as3cf.buckets.updateNameNotice( bucketName );
961
} );
962
963
- // Check bucket name length on manual
964
- $body.on( 'input keyup', '.as3cf-manual-save-bucket-form .as3cf-bucket-name', function( e ) {
965
- var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-manual-save-bucket-form' );
966
967
- if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) {
968
- $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
969
- } else {
970
- $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
971
}
972
} );
973
} );
2
3
var savedSettings = {};
4
var bucketNamePattern = /[^a-z0-9.-]/;
5
6
var $body = $( 'body' );
7
var $tabs = $( '.as3cf-tab' );
172
173
$bucketList.html( '<li class="loading">' + $bucketList.data( 'working' ) + '</li>' );
174
175
+ // Stop accidental submit while reloading list.
176
+ this.disabledButtons();
177
+
178
var data = {
179
action: as3cfModal.prefix + '-get-buckets',
180
_nonce: window[ as3cfModal.prefix.replace( /-/g, '_' ) ].nonces.get_buckets
201
if ( 'undefined' !== typeof data[ 'success' ] ) {
202
$( '.as3cf-bucket-error' ).hide();
203
204
+ if ( 0 === data[ 'buckets' ].length ) {
205
$bucketList.html( '<li class="loading">' + $bucketList.data( 'nothing-found' ) + '</li>' );
206
} else {
207
$( data[ 'buckets' ] ).each( function( idx, bucket ) {
210
} );
211
212
that.scrollToSelected();
213
+ that.disabledButtons();
214
}
215
} else {
216
that.showError( as3cf.strings.get_buckets_error, data[ 'error' ], 'as3cf-bucket-select' );
235
},
236
237
/**
238
+ * Set the selected bucket in list.
239
*
240
* @param {object} $link
241
*/
242
+ setSelected: function( $link ) {
243
$( '.as3cf-bucket-list a' ).removeClass( 'selected' );
244
$link.addClass( 'selected' );
245
+ $( '#' + as3cfModal.prefix + '-bucket-select-name' ).val( $link.data( 'bucket' ) );
246
},
247
248
/**
249
* Disable bucket buttons
250
*/
251
disabledButtons: function() {
252
+ var $createBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-create' );
253
+ var $manualBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-manual' );
254
+ var $selectBucketForm = $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' );
255
+
256
+ if ( 0 === $createBucketForm.length && 0 === $manualBucketForm.length && 0 === $selectBucketForm.length ) {
257
return;
258
}
259
260
+ if ( 0 < $createBucketForm.length && this.isValidName( $createBucketForm.find( '.as3cf-bucket-name' ).val() ) ) {
261
$createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
262
+ } else {
263
+ $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
264
}
265
266
+ if ( 0 < $manualBucketForm.length && this.isValidName( $manualBucketForm.find( '.as3cf-bucket-name' ).val() ) ) {
267
+ $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
268
+ } else {
269
$manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
270
+ }
271
+
272
+ if ( 0 < $selectBucketForm.length && 1 === $selectBucketForm.find( '.as3cf-bucket-list a.selected' ).length ) {
273
+ $selectBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false );
274
} else {
275
+ $selectBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
276
}
277
},
278
301
this.bucketSelectLock = false;
302
},
303
304
/**
305
* Check for a valid bucket name
306
*
395
$( '#' + as3cfModal.prefix + '-view-bucket' ).attr( 'href', url );
396
}
397
398
+ /*
399
+ * Toggle the lost files notice
400
+ */
401
+ function toggleLostFilesNotice() {
402
+ if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) && $( '#as3cf-serve-from-s3' ).is( ':not(:checked)' ) ) {
403
+ $( '#as3cf-lost-files-notice' ).show();
404
+ } else {
405
+ $( '#as3cf-lost-files-notice' ).hide();
406
+ }
407
+ }
408
+
409
+ /*
410
+ * Toggle the remove local files notice
411
+ */
412
+ function toggleRemoveLocalNotice() {
413
+ if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) ) {
414
+ $( '#as3cf-remove-local-notice' ).show();
415
+ } else {
416
+ $( '#as3cf-remove-local-notice' ).hide();
417
+ }
418
+ }
419
+
420
+ /*
421
+ * Toggle the seo friendly url notice.
422
+ */
423
+ function toggleSEOFriendlyURLNotice( seo_friendly ) {
424
+ if ( true !== seo_friendly ) {
425
+ $( '#as3cf-seo-friendly-url-notice' ).show();
426
+ } else {
427
+ $( '#as3cf-seo-friendly-url-notice' ).hide();
428
+ }
429
+ }
430
+
431
/**
432
* Generate URL preview
433
*/
467
} );
468
}
469
470
/**
471
* Update the UI with the current active tab set in the URL hash.
472
*/
607
// Move bucket errors
608
$( '#tab-media > .as3cf-bucket-error' ).detach().insertAfter( '.as3cf-bucket-container h3' );
609
610
+ // Enable/disable change bucket's save buttons.
611
+ as3cf.buckets.disabledButtons();
612
613
// Bucket list refresh handler
614
$body.on( 'click', '.bucket-action-refresh', function( e ) {
622
as3cf.buckets.loadList( true );
623
} );
624
625
+ // If select bucket form is available on load, populate its list.
626
+ if ( 0 < $( '.as3cf-bucket-container.' + as3cfModal.prefix + ' .as3cf-bucket-select' ).length ) {
627
+ as3cf.buckets.loadList( true );
628
+ }
629
+
630
// Bucket list click handler
631
$body.on( 'click', '.as3cf-bucket-list a', function( e ) {
632
e.preventDefault();
633
+ as3cf.buckets.setSelected( $( this ) );
634
+ as3cf.buckets.disabledButtons();
635
} );
636
637
// External links click handler
642
return false;
643
} );
644
645
// Validate bucket name on create
646
+ $body.on( 'input keyup', '.as3cf-bucket-create .as3cf-bucket-name', function( e ) {
647
var bucketName = $( this ).val();
648
+ as3cf.buckets.updateNameNotice( bucketName );
649
+ as3cf.buckets.disabledButtons();
650
+ } );
651
652
+ $body.on( 'input keyup', '.as3cf-bucket-manual .as3cf-bucket-name', function( e ) {
653
+ var bucketName = $( this ).val();
654
as3cf.buckets.updateNameNotice( bucketName );
655
+ as3cf.buckets.disabledButtons();
656
} );
657
658
+ // Don't allow 'enter' key to submit form on text input settings
659
+ $( '.as3cf-bucket-container input[type="text"]' ).keypress( function( event ) {
660
+ if ( 13 === event.which ) {
661
+ event.preventDefault();
662
663
+ return false;
664
}
665
} );
666
} );
assets/js/script.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=l.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+l.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=l.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e=as3cf.provider_console_url_param+encodeURIComponent(e));var f=as3cf.provider_console_url+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?(a(".as3cf-url-preview").html(b.url),j(b.seo_friendly)):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(b){!0!==b?a("#as3cf-seo-friendly-url-notice").show():a("#as3cf-seo-friendly-url-notice").hide()}function k(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var l,m={},n=/[^a-z0-9.-]/,o=!1,p=a("body"),q=a(".as3cf-tab");a(".as3cf-settings");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),q.hide(),l=a("#tab-"+c),l.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".as3cf-main").data("tab",c),l.data("prefix")&&(b.prefix=l.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),e=d.find(".bucket-select-region"),f=d.find(".as3cf-bucket-list"),g=a("#"+b.prefix+"-bucket").val();if(!1===c&&f.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected"),void this.scrollToSelected();f.html('<li class="loading">'+f.data("working")+"</li>");var h={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets};e.val()&&(h.region=e.val());var i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){f.html(""),i.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,d){f.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),0===b.buckets.length?f.html('<li class="loading">'+f.data("nothing-found")+"</li>"):(a(b.buckets).each(function(a,b){var c=b.Name===g?"selected":"";f.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),i.scrollToSelected())):i.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===l.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(o),o=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".bucket-manual-region"),e=c.find(".as3cf-bucket-name"),f=c.find("button[type=submit]"),g=e.val(),h=f.first().text();if(g===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),l.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-manual-save-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket};d.val()&&(i.region=d.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof c.success?(j.set(g,c.region,c.region_name,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+g+'"]').addClass("selected"),o=!0,as3cf.showSettingsSavedNotice()):j.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){if(!this.bucketSelectLock){this.bucketSelectLock=!0;var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),e=d.find(".bucket-select-region"),f=d.find(".as3cf-bucket-list");if(c.hasClass("selected"))return l.addClass("as3cf-has-bucket"),void b.close();var g=d.find(".as3cf-bucket-list a.selected").data("bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),f.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var h=c.data("bucket"),i={action:b.prefix+"-save-bucket",bucket_name:h,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(b,c,d){f.removeClass("saving"),j.showError(as3cf.strings.save_bucket_error,d,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected")},success:function(d,e,i){c.find(".spinner").hide().css("visibility","hidden"),f.removeClass("saving"),"undefined"!=typeof d.success?(j.set(h,d.region,d.region_name,d.can_write),a("#"+b.prefix+"-bucket-select").val(""),as3cf.showSettingsSavedNotice()):(j.showError(as3cf.strings.save_bucket_error,d.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,h,i,j){var k=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual"),n=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),o=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create"),p=a("#"+b.prefix+"-active-region"),q=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===q.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var r=l.attr("id");m[r]=c(r)}a(".as3cf-error.fatal").hide(),q.text(e),k.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),p.text(i),k.find(".bucket-manual-region").val(h),n.find(".bucket-select-region").val(h),o.find(".bucket-create-region").val(h),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),l.addClass("as3cf-has-bucket"),l.find(".as3cf-can-write-error").toggle(!j),l.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){l.trigger("bucket-change",[j]),as3cf.buckets.bucketSelectLock=!1})},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.data("working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.region_name,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").prop("selected",!1),d.val(""),f.prop("disabled",!0),o=!0,as3cf.showSettingsSavedNotice()):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==n.test(a)},updateNameNotice:function(b){var c=null;!0===n.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},as3cf.reloadUpdated=function(){var a=location.pathname+location.search;location.search.match(/[?&]updated=/)||(a+="&updated=1"),a+=location.hash,location.assign(a)},as3cf.showSettingsSavedNotice=function(){if(!(0<a("#setting-error-settings_updated:visible").length||0<a("#as3cf-settings_updated:visible").length)){var b='<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>'+as3cf.strings.settings_saved+"</strong></p></div>";a("h2.nav-tab-wrapper").after(b),a(document).trigger("wp-updates-notice-added")}},a(document).ready(function(){k(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),k()};var j=a(".as3cf-main .nav-tab-wrapper");a(".as3cf-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(j),q.length&&q.each(function(a,b){m[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(m)){var b=l.attr("id");return c(b)!==m[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),q.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+l.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),p.on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),p.on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(o),o=!1}),p.on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),p.on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),p.on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),p.on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),p.on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),p.on("change",".bucket-select-region",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),p.on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),p.on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),p.on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0),as3cf.buckets.updateNameNotice(d)}),p.on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)})})}(jQuery,as3cfModal);
1
+ !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=l.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.prop("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+l.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.prop("disabled",!0)):(c.hide(),d.prop("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=l.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e=as3cf.provider_console_url_param+encodeURIComponent(e));var f=as3cf.provider_console_url+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function h(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function i(b){!0!==b?a("#as3cf-seo-friendly-url-notice").show():a("#as3cf-seo-friendly-url-notice").hide()}function j(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?(a(".as3cf-url-preview").html(b.url),i(b.seo_friendly)):alert(as3cf.strings.get_url_preview_error+b.error)}})}function k(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}var l,m={},n=/[^a-z0-9.-]/,o=a("body"),p=a(".as3cf-tab");a(".as3cf-settings");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),p.hide(),l=a("#tab-"+c),l.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".as3cf-main").data("tab",c),l.data("prefix")&&(b.prefix=l.data("prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select"),e=d.find(".bucket-select-region"),f=d.find(".as3cf-bucket-list"),g=a("#"+b.prefix+"-bucket").val();if(!1===c&&f.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+g+'"]').addClass("selected"),void this.scrollToSelected();f.html('<li class="loading">'+f.data("working")+"</li>"),this.disabledButtons();var h={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets};e.val()&&(h.region=e.val());var i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){f.html(""),i.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,d){f.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),0===b.buckets.length?f.html('<li class="loading">'+f.data("nothing-found")+"</li>"):(a(b.buckets).each(function(a,b){var c=b.Name===g?"selected":"";f.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),i.scrollToSelected(),i.disabledButtons())):i.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},setSelected:function(c){a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),a("#"+b.prefix+"-bucket-select-name").val(c.data("bucket"))},disabledButtons:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual"),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select");0===c.length&&0===d.length&&0===e.length||(0<c.length&&this.isValidName(c.find(".as3cf-bucket-name").val())?c.find("button[type=submit]").prop("disabled",!1):c.find("button[type=submit]").prop("disabled",!0),0<d.length&&this.isValidName(d.find(".as3cf-bucket-name").val())?d.find("button[type=submit]").prop("disabled",!1):d.find("button[type=submit]").prop("disabled",!0),0<e.length&&1===e.find(".as3cf-bucket-list a.selected").length?e.find("button[type=submit]").prop("disabled",!1):e.find("button[type=submit]").prop("disabled",!0))},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==n.test(a)},updateNameNotice:function(b){var c=null;!0===n.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},as3cf.reloadUpdated=function(){var a=location.pathname+location.search;location.search.match(/[?&]updated=/)||(a+="&updated=1"),a+=location.hash,location.assign(a)},as3cf.showSettingsSavedNotice=function(){if(!(0<a("#setting-error-settings_updated:visible").length||0<a("#as3cf-settings_updated:visible").length)){var b='<div id="as3cf-settings_updated" class="updated settings-error notice is-dismissible"><p><strong>'+as3cf.strings.settings_saved+"</strong></p></div>";a("h2.nav-tab-wrapper").after(b),a(document).trigger("wp-updates-notice-added")}},a(document).ready(function(){k(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),k()};var i=a(".as3cf-main .nav-tab-wrapper");a(".as3cf-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(i),p.length&&p.each(function(a,b){m[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(m)){var b=l.attr("id");return c(b)!==m[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),p.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){j()}),g(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){g()}),h(),a("#as3cf-remove-local-file").on("change",function(a){h()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+l.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.prop("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),as3cf.buckets.disabledButtons(),o.on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),o.on("change",".bucket-select-region",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),0<a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").length&&as3cf.buckets.loadList(!0),o.on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.setSelected(a(this)),as3cf.buckets.disabledButtons()}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),o.on("input keyup",".as3cf-bucket-create .as3cf-bucket-name",function(b){var c=a(this).val();as3cf.buckets.updateNameNotice(c),as3cf.buckets.disabledButtons()}),o.on("input keyup",".as3cf-bucket-manual .as3cf-bucket-name",function(b){var c=a(this).val();as3cf.buckets.updateNameNotice(c),as3cf.buckets.disabledButtons()}),a('.as3cf-bucket-container input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1})})}(jQuery,as3cfModal);
assets/sass/styles.scss CHANGED
@@ -110,19 +110,21 @@ $as3cf_assets: #0769ad;
110
*/
111
.as3cf-tab {
112
.as3cf-main-settings {
113
- display: none;
114
-
115
.as3cf-provider-select {
116
display: none;
117
}
118
119
- .as3cf-media-settings {
120
display: none;
121
}
122
- }
123
124
- .as3cf-bucket-container {
125
- display: none;
126
}
127
128
&.as3cf-needs-access-keys, &.as3cf-has-access-keys.as3cf-change-provider {
@@ -131,56 +133,54 @@ $as3cf_assets: #0769ad;
131
}
132
133
.as3cf-main-settings {
134
- display: block;
135
-
136
.as3cf-provider-select {
137
display: block;
138
}
139
140
.as3cf-media-settings {
141
display: none;
142
}
143
}
144
145
- .as3cf-bucket-container {
146
display: none;
147
}
148
- }
149
150
- &.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider) {
151
.as3cf-main-settings {
152
- display: none;
153
-
154
.as3cf-provider-select {
155
display: none;
156
}
157
158
.as3cf-media-settings {
159
display: none;
160
}
161
}
162
-
163
- .as3cf-bucket-container {
164
- display: block;
165
- }
166
}
167
168
- &.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider) {
169
.as3cf-main-settings {
170
- display: block;
171
-
172
.as3cf-provider-select {
173
display: none;
174
}
175
176
.as3cf-media-settings {
177
display: block;
178
}
179
}
180
-
181
- .as3cf-bucket-container {
182
- display: none;
183
- }
184
}
185
}
186
@@ -487,6 +487,25 @@ $as3cf_assets: #0769ad;
487
display: none !important;
488
}
489
}
490
}
491
492
/**
@@ -567,15 +586,6 @@ $as3cf_assets: #0769ad;
567
margin-right: 20px;
568
line-height: 28px;
569
}
570
-
571
- .bucket-action-cancel {
572
- color: #a00;
573
- text-decoration: none;
574
-
575
- &:hover {
576
- color: red;
577
- }
578
- }
579
}
580
581
.as3cf-bucket-list {
@@ -608,15 +618,6 @@ $as3cf_assets: #0769ad;
608
}
609
}
610
}
611
-
612
- .as3cf-bucket-select,
613
- .as3cf-bucket-create {
614
- display: none;
615
- }
616
-
617
- .bucket-actions.select {
618
- display: none;
619
- }
620
}
621
622
#tab-media {
110
*/
111
.as3cf-tab {
112
.as3cf-main-settings {
113
.as3cf-provider-select {
114
display: none;
115
}
116
117
+ .as3cf-bucket-container {
118
display: none;
119
+
120
+ a.as3cf-change-provider {
121
+ display: none;
122
+ }
123
}
124
125
+ .as3cf-media-settings {
126
+ display: none;
127
+ }
128
}
129
130
&.as3cf-needs-access-keys, &.as3cf-has-access-keys.as3cf-change-provider {
133
}
134
135
.as3cf-main-settings {
136
.as3cf-provider-select {
137
display: block;
138
}
139
140
+ .as3cf-bucket-container {
141
+ display: none;
142
+ }
143
+
144
.as3cf-media-settings {
145
display: none;
146
}
147
}
148
+ }
149
150
+ &.as3cf-has-access-keys.as3cf-needs-bucket:not(.as3cf-change-provider), &.as3cf-has-access-keys.as3cf-change-bucket:not(.as3cf-change-provider) {
151
+ .as3cf-can-write-error {
152
display: none;
153
}
154
155
.as3cf-main-settings {
156
.as3cf-provider-select {
157
display: none;
158
}
159
160
+ .as3cf-bucket-container {
161
+ display: block;
162
+ }
163
+
164
.as3cf-media-settings {
165
display: none;
166
}
167
}
168
}
169
170
+ &.as3cf-has-access-keys.as3cf-has-bucket:not(.as3cf-change-provider):not(.as3cf-change-bucket) {
171
.as3cf-main-settings {
172
.as3cf-provider-select {
173
display: none;
174
}
175
176
+ .as3cf-bucket-container {
177
+ display: none;
178
+ }
179
+
180
.as3cf-media-settings {
181
display: block;
182
}
183
}
184
}
185
}
186
487
display: none !important;
488
}
489
}
490
+
491
+ p.actions {
492
+ margin: 20px -30px -30px;
493
+ padding: 20px 30px;
494
+ border-top: none;
495
+ overflow: hidden;
496
+
497
+ .right {
498
+ margin-left: 15px;
499
+
500
+ &:last-of-type {
501
+ margin-left: 0;
502
+ }
503
+ }
504
+
505
+ button {
506
+ min-width: 90px;
507
+ }
508
+ }
509
}
510
511
/**
586
margin-right: 20px;
587
line-height: 28px;
588
}
589
}
590
591
.as3cf-bucket-list {
618
}
619
}
620
}
621
}
622
623
#tab-media {
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -106,7 +106,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
106
'WPOS3_SETTINGS',
107
);
108
109
- const LATEST_UPGRADE_ROUTINE = 6;
110
111
/**
112
* @param string $plugin_file_path
@@ -171,9 +171,6 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
171
172
// UI AJAX
173
add_action( 'wp_ajax_as3cf-get-buckets', array( $this, 'ajax_get_buckets' ) );
174
- add_action( 'wp_ajax_as3cf-save-bucket', array( $this, 'ajax_save_bucket' ) );
175
- add_action( 'wp_ajax_as3cf-create-bucket', array( $this, 'ajax_create_bucket' ) );
176
- add_action( 'wp_ajax_as3cf-manual-save-bucket', array( $this, 'ajax_save_bucket' ) );
177
add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
178
add_action( 'wp_ajax_as3cf_get_attachment_provider_details', array( $this, 'ajax_get_attachment_provider_details' ) );
179
add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
@@ -2382,74 +2379,46 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2382
}
2383
2384
/**
2385
- * Returns cleaned up region name or kills ajax request if missing.
2386
*
2387
- * @param bool $region_required
2388
*
2389
- * @return string
2390
*/
2391
- function ajax_check_region( $region_required = false ) {
2392
- $region = '';
2393
-
2394
- // Are we defining the region or specifying via the form?
2395
if ( defined( 'AS3CF_REGION' ) ) {
2396
- $region = AS3CF_REGION;
2397
- } elseif ( false !== $this->get_defined_setting( 'region', false ) ) {
2398
- $region = $this->get_defined_setting( 'region' );
2399
- } elseif (
2400
- ( ! isset( $_POST['region'] ) || ! ( $region = sanitize_text_field( $_POST['region'] ) ) ) &&
2401
- $region_required // It's very important that this test is after the above inline assign!
2402
- ) { // input var okay
2403
- $out = array( 'error' => __( 'No region provided.', 'amazon-s3-and-cloudfront' ) );
2404
-
2405
- $this->end_ajax( $out );
2406
}
2407
2408
- return $region;
2409
- }
2410
2411
- /**
2412
- * Returns cleaned up bucket name or kills ajax request if missing.
2413
- *
2414
- * @return string
2415
- */
2416
- function ajax_check_bucket() {
2417
- if ( ! isset( $_POST['bucket_name'] ) || ! ( $bucket = sanitize_text_field( $_POST['bucket_name'] ) ) ) { // input var okay
2418
- $out = array( 'error' => __( 'No bucket name provided.', 'amazon-s3-and-cloudfront' ) );
2419
2420
- $this->end_ajax( $out );
2421
}
2422
2423
- return strtolower( $bucket );
2424
}
2425
2426
/**
2427
- * Handler for AJAX callback to create a bucket in provider
2428
*
2429
- * @throws Exception
2430
*/
2431
- function ajax_create_bucket() {
2432
- $this->verify_ajax_request();
2433
-
2434
- $region = $this->ajax_check_region( true );
2435
- $bucket = $this->ajax_check_bucket();
2436
-
2437
- $result = $this->create_bucket( $bucket, $region );
2438
-
2439
- if ( is_wp_error( $result ) ) {
2440
- $out = $this->prepare_bucket_error( $result, false );
2441
2442
- $this->end_ajax( $out );
2443
- }
2444
-
2445
- // check if we were previously selecting a bucket manually via the input
2446
- $previous_manual_bucket_select = $this->get_setting( 'manual_bucket', false );
2447
-
2448
- $args = array(
2449
- '_nonce' => wp_create_nonce( 'as3cf-create-bucket' ),
2450
- );
2451
-
2452
- $this->save_bucket_for_ajax( $bucket, $previous_manual_bucket_select, $region, $args );
2453
}
2454
2455
/**
@@ -2481,76 +2450,20 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2481
return true;
2482
}
2483
2484
- /**
2485
- * Handler for AJAX callback to save the selection of a bucket
2486
- *
2487
- * @throws Exception
2488
- */
2489
- function ajax_save_bucket() {
2490
- $this->verify_ajax_request();
2491
-
2492
- $region = $this->ajax_check_region( $this->get_provider()->region_required() );
2493
- $bucket = $this->ajax_check_bucket();
2494
-
2495
- $manual = false;
2496
- // are we inputting the bucket manually?
2497
- if ( isset( $_POST['action'] ) && false !== strpos( $_POST['action'], 'manual-save-bucket' ) ) {
2498
- $manual = true;
2499
- }
2500
-
2501
- $this->save_bucket_for_ajax( $bucket, $manual, $region );
2502
- }
2503
-
2504
- /**
2505
- * Wrapper method for saving a bucket when creating or selecting
2506
- *
2507
- * @param string $bucket
2508
- * @param bool|false $manual_select
2509
- * @param null|string $region
2510
- * @param array $defaults
2511
- *
2512
- * @throws Exception
2513
- */
2514
- function save_bucket_for_ajax( $bucket, $manual_select = false, $region = null, $defaults = array() ) {
2515
- $region = $this->save_bucket( $bucket, $manual_select, $region );
2516
-
2517
- if ( ! is_wp_error( $region ) ) {
2518
- $out = array(
2519
- 'success' => '1',
2520
- 'region' => $region,
2521
- 'region_name' => $this->get_provider()->get_region_name( $region ),
2522
- );
2523
-
2524
- $out = wp_parse_args( $out, $defaults );
2525
-
2526
- $can_write = $this->check_write_permission( $bucket, $region );
2527
-
2528
- if ( is_wp_error( $can_write ) ) {
2529
- $out = $this->prepare_bucket_error( $can_write );
2530
- } else {
2531
- $out['can_write'] = $can_write;
2532
- }
2533
- } else {
2534
- $out = $this->prepare_bucket_error( $region );
2535
- }
2536
-
2537
- $this->end_ajax( $out );
2538
- }
2539
-
2540
/**
2541
* Prepare the bucket error before returning to JS
2542
*
2543
* @param WP_Error $object
2544
* @param bool $single Are we dealing with a single bucket?
2545
*
2546
- * @return array
2547
*/
2548
function prepare_bucket_error( $object, $single = true ) {
2549
if ( 'Access Denied' === $object->get_error_message() ) {
2550
// If the bucket error is access denied, show our notice message
2551
- $out = array( 'error' => $this->get_access_denied_notice_message( $single ) );
2552
} else {
2553
- $out = array( 'error' => $object->get_error_message() );
2554
}
2555
2556
return $out;
@@ -2577,7 +2490,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2577
* @param bool $manual if we are entering the bucket via the manual input form
2578
* @param null|string $region
2579
*
2580
- * @return string|bool region on success
2581
*/
2582
function save_bucket( $bucket_name, $manual = false, $region = null ) {
2583
if ( $bucket_name ) {
@@ -2780,12 +2693,15 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2780
function ajax_get_buckets() {
2781
$this->verify_ajax_request();
2782
2783
- $region = $this->ajax_check_region( $this->get_provider()->region_required() );
2784
2785
$result = $this->get_buckets( $region );
2786
2787
if ( is_wp_error( $result ) ) {
2788
- $out = $this->prepare_bucket_error( $result, false );
2789
} else {
2790
$out = array(
2791
'success' => '1',
@@ -2829,6 +2745,11 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2829
}
2830
2831
if ( is_null( $bucket ) ) {
2832
if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
2833
// if no bucket set then no need check
2834
return true;
@@ -2868,16 +2789,22 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2868
2869
/**
2870
* Render error messages in a view for bucket permission and access issues
2871
*/
2872
function render_bucket_permission_errors() {
2873
$can_write = $this->check_write_permission();
2874
// catch any checking issues
2875
if ( is_wp_error( $can_write ) ) {
2876
$this->render_view( 'error-fatal', array( 'message' => $can_write->get_error_message() ) );
2877
- $can_write = true;
2878
}
2879
- // display a error message if the user does not have write permission to S3 bucket
2880
- $this->render_view( 'error-access', array( 'can_write' => $can_write ) );
2881
}
2882
2883
/**
@@ -2995,6 +2922,19 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
2995
);
2996
}
2997
2998
/**
2999
* List of settings that should skip full sanitize.
3000
*
@@ -3007,7 +2947,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3007
/**
3008
* Handle the saving of the settings page
3009
*/
3010
- function handle_post_request() {
3011
if ( empty( $_POST['plugin'] ) || $this->get_plugin_slug() != sanitize_key( $_POST['plugin'] ) ) { // input var okay
3012
return;
3013
}
@@ -3020,9 +2960,176 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3020
die( __( "Cheatin' eh?", 'amazon-s3-and-cloudfront' ) );
3021
}
3022
3023
do_action( 'as3cf_pre_save_settings' );
3024
3025
- $post_vars = $this->get_settings_whitelist();
3026
3027
foreach ( $post_vars as $var ) {
3028
// Special case for when Secret Access Key is not changed.
@@ -3039,13 +3146,16 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3039
$value = $this->sanitize_setting( $var, $_POST[ $var ] );
3040
3041
$this->set_setting( $var, $value );
3042
}
3043
3044
$this->save_settings();
3045
3046
- $url = $this->get_plugin_page_url( array( 'updated' => '1' ) );
3047
- wp_redirect( $url );
3048
- exit;
3049
}
3050
3051
/**
@@ -3340,7 +3450,6 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
3340
} elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
3341
$size_details .= $size . ' (' . $_wp_additional_image_sizes[ $size ]['width'] . 'x' . $_wp_additional_image_sizes[ $size ]['height'] . ')' . "\r\n";
3342
}
3343
-
3344
}
3345
3346
return $size_details;
@@ -4429,7 +4538,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4429
}
4430
4431
/**
4432
- * Handle retieving the S3 details for attachment modals.
4433
*/
4434
public function ajax_get_attachment_provider_details() {
4435
if ( ! isset( $_POST['id'] ) ) {
@@ -4724,7 +4833,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4724
* @return array Attachment's cleaned up metadata.
4725
*/
4726
public function maybe_cleanup_filesize_metadata( $post_id, $data, $update_metadata = true ) {
4727
- if ( ! is_int( $post_id ) || empty( $post_id ) || empty( $data ) ) {
4728
return $data;
4729
}
4730
106
'WPOS3_SETTINGS',
107
);
108
109
+ const LATEST_UPGRADE_ROUTINE = 7;
110
111
/**
112
* @param string $plugin_file_path
171
172
// UI AJAX
173
add_action( 'wp_ajax_as3cf-get-buckets', array( $this, 'ajax_get_buckets' ) );
174
add_action( 'wp_ajax_as3cf-get-url-preview', array( $this, 'ajax_get_url_preview' ) );
175
add_action( 'wp_ajax_as3cf_get_attachment_provider_details', array( $this, 'ajax_get_attachment_provider_details' ) );
176
add_action( 'wp_ajax_as3cf-get-diagnostic-info', array( $this, 'ajax_get_diagnostic_info' ) );
2379
}
2380
2381
/**
2382
+ * Returns cleaned up region name to be used while setting bucket or returns false if missing.
2383
*
2384
+ * @param string $region
2385
+ * @param bool $region_required
2386
*
2387
+ * @return string|bool
2388
*/
2389
+ function check_region( $region = '', $region_required = false ) {
2390
+ // If defined, just use.
2391
if ( defined( 'AS3CF_REGION' ) ) {
2392
+ return AS3CF_REGION;
2393
}
2394
2395
+ // If defined in settings define, just use.
2396
+ if ( false !== $this->get_defined_setting( 'region', false ) ) {
2397
+ return $this->get_defined_setting( 'region' );
2398
+ }
2399
2400
+ if ( ! empty( $region ) ) {
2401
+ $region = sanitize_text_field( $region );
2402
+ }
2403
2404
+ if ( $region_required && empty( $region ) ) {
2405
+ return false;
2406
}
2407
2408
+ return $region;
2409
}
2410
2411
/**
2412
+ * Returns cleaned up bucket name or returns false if missing.
2413
*
2414
+ * @param string $bucket
2415
+ *
2416
+ * @return string|bool
2417
*/
2418
+ function check_bucket( $bucket ) {
2419
+ $bucket = sanitize_text_field( $bucket );
2420
2421
+ return empty( $bucket ) ? false : strtolower( $bucket );
2422
}
2423
2424
/**
2450
return true;
2451
}
2452
2453
/**
2454
* Prepare the bucket error before returning to JS
2455
*
2456
* @param WP_Error $object
2457
* @param bool $single Are we dealing with a single bucket?
2458
*
2459
+ * @return string
2460
*/
2461
function prepare_bucket_error( $object, $single = true ) {
2462
if ( 'Access Denied' === $object->get_error_message() ) {
2463
// If the bucket error is access denied, show our notice message
2464
+ $out = $this->get_access_denied_notice_message( $single );
2465
} else {
2466
+ $out = $object->get_error_message();
2467
}
2468
2469
return $out;
2490
* @param bool $manual if we are entering the bucket via the manual input form
2491
* @param null|string $region
2492
*
2493
+ * @return string|bool|WP_Error region on success
2494
*/
2495
function save_bucket( $bucket_name, $manual = false, $region = null ) {
2496
if ( $bucket_name ) {
2693
function ajax_get_buckets() {
2694
$this->verify_ajax_request();
2695
2696
+ $region = empty( $_POST['region'] ) ? '' : $_POST['region'];
2697
+ $region = $this->check_region( $region, $this->get_provider()->region_required() );
2698
2699
$result = $this->get_buckets( $region );
2700
2701
if ( is_wp_error( $result ) ) {
2702
+ $out = array(
2703
+ 'error' => $this->prepare_bucket_error( $result, false ),
2704
+ );
2705
} else {
2706
$out = array(
2707
'success' => '1',
2745
}
2746
2747
if ( is_null( $bucket ) ) {
2748
+ // If changing provider or bucket don't bother to test saved bucket permissions.
2749
+ if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], array( 'change-provider', 'change-bucket' ) ) ) {
2750
+ return false;
2751
+ }
2752
+
2753
if ( ! ( $bucket = $this->get_setting( 'bucket' ) ) ) {
2754
// if no bucket set then no need check
2755
return true;
2789
2790
/**
2791
* Render error messages in a view for bucket permission and access issues
2792
+ *
2793
+ * @return bool
2794
+ * @throws Exception
2795
*/
2796
function render_bucket_permission_errors() {
2797
$can_write = $this->check_write_permission();
2798
// catch any checking issues
2799
if ( is_wp_error( $can_write ) ) {
2800
$this->render_view( 'error-fatal', array( 'message' => $can_write->get_error_message() ) );
2801
+ $can_write = false;
2802
+ } else {
2803
+ // display a error message if the user does not have write permission to S3 bucket
2804
+ $this->render_view( 'error-access', array( 'can_write' => $can_write ) );
2805
}
2806
+
2807
+ return $can_write;
2808
}
2809
2810
/**
2922
);
2923
}
2924
2925
+ /**
2926
+ * Get the blacklisted settings for monitoring changes in defines.
2927
+ * These settings will not be saved in the database.
2928
+ *
2929
+ * @return array
2930
+ */
2931
+ function get_monitored_settings_blacklist() {
2932
+ return array(
2933
+ 'access-key-id',
2934
+ 'secret-access-key',
2935
+ );
2936
+ }
2937
+
2938
/**
2939
* List of settings that should skip full sanitize.
2940
*
2947
/**
2948
* Handle the saving of the settings page
2949
*/
2950
+ public function handle_post_request() {
2951
if ( empty( $_POST['plugin'] ) || $this->get_plugin_slug() != sanitize_key( $_POST['plugin'] ) ) { // input var okay
2952
return;
2953
}
2960
die( __( "Cheatin' eh?", 'amazon-s3-and-cloudfront' ) );
2961
}
2962
2963
+ if ( $this->get_provider()->needs_access_keys() || ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) ) {
2964
+ // Changing Provider currently doesn't need anything special over saving settings,
2965
+ // but if not already set needs to be handled rather than change-bucket raising its hand.
2966
+ $changed_keys = $this->handle_save_settings();
2967
+ } elseif ( empty( $this->get_setting( 'bucket' ) ) || ( ! empty( $_GET['action'] ) && 'change-bucket' === $_GET['action'] ) ) {
2968
+ $changed_keys = $this->handle_change_bucket();
2969
+ } elseif ( ! empty( $_GET['action'] ) ) {
2970
+ $changed_keys = apply_filters( 'as3cf_handle_post_request', array() );
2971
+ } else {
2972
+ $changed_keys = $this->handle_save_settings();
2973
+ }
2974
+
2975
+ // If the changes can't be saved, stay on same page.
2976
+ // An admin notice should be created with the error message.
2977
+ if ( false === $changed_keys ) {
2978
+ return;
2979
+ }
2980
+
2981
+ // No failures, so let's make things super green.
2982
+ $url_args = array( 'updated' => '1' );
2983
+
2984
+ if ( ! empty( $changed_keys ) ) {
2985
+ $action = null;
2986
+
2987
+ foreach ( $changed_keys as $key ) {
2988
+ // If anything about the Provider has changed then we need to verify the bucket selection.
2989
+ // Otherwise we can let the filter decide whether there is an action to take.
2990
+ // Last implementer will win, but the above handlers take care of grouping things appropriately.
2991
+ if ( in_array( $key, array( 'provider', 'access-key-id', 'secret-access-key' ) ) && ! $this->get_defined_setting( 'bucket', false ) ) {
2992
+ $action = 'change-bucket';
2993
+ break;
2994
+ } else {
2995
+ $action = apply_filters( 'as3cf_action_for_changed_settings_key', $action, $key );
2996
+ }
2997
+ }
2998
+ }
2999
+
3000
+ // Stash which step we're on in possibly multi-step config.
3001
+ $prev_action = ! empty( $_GET['action'] ) ? $_GET['action'] : null;
3002
+
3003
+ // Depending on the step we're on, we may need another step if not already determined by newly saved settings.
3004
+ if ( empty( $action ) && ! empty( $prev_action ) ) {
3005
+ // After change-provider we always want the user to confirm the bucket is still ok.
3006
+ // This gets round the change-provider => change-bucket => "back" problem.
3007
+ // but then no change in provider settings problem.
3008
+ if ( 'change-provider' === $prev_action && ! $this->get_defined_setting( 'bucket', false ) ) {
3009
+ $action = 'change-bucket';
3010
+ }
3011
+ }
3012
+
3013
+ if ( ! empty( $action ) ) {
3014
+ $url_args['action'] = $action;
3015
+ }
3016
+
3017
+ if ( ! empty( $prev_action ) ) {
3018
+ $url_args['prev_action'] = $prev_action;
3019
+ }
3020
+
3021
+ $url = $this->get_plugin_page_url( $url_args );
3022
+ wp_redirect( $url );
3023
+ exit;
3024
+ }
3025
+
3026
+ /**
3027
+ * Handle saving change in bucket as submitted by user, whether create, enter or select.
3028
+ *
3029
+ * @return array|bool
3030
+ * @throws Exception
3031
+ */
3032
+ private function handle_change_bucket() {
3033
+ // Quick check that bucket name actually given.
3034
+ $bucket = empty( $_POST['bucket_name'] ) ? false : $_POST['bucket_name'];
3035
+
3036
+ if ( false === $bucket ) {
3037
+ $this->notices->add_notice( __( 'No bucket name provided.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3038
+
3039
+ return false;
3040
+ }
3041
+
3042
+ // Check and set bucket.
3043
+ $bucket = $this->check_bucket( $bucket );
3044
+
3045
+ if ( false === $bucket ) {
3046
+ $this->notices->add_notice( __( 'No bucket name not valid.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3047
+
3048
+ return false;
3049
+ }
3050
+
3051
+ $bucket_mode = empty( $_GET['bucket_mode'] ) ? 'manual' : $_GET['bucket_mode'];
3052
+
3053
+ // Check and set region.
3054
+ $region = empty( $_POST['region_name'] ) ? '' : $_POST['region_name'];
3055
+ $region_required = 'create' === $bucket_mode ? true : $this->get_provider()->region_required();
3056
+ $region = $this->check_region( $region, $region_required );
3057
+
3058
+ if ( false === $region ) {
3059
+ $this->notices->add_notice( __( 'No region provided.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3060
+
3061
+ return false;
3062
+ }
3063
+
3064
+ // Are we creating a bucket?
3065
+ if ( 'create' === $bucket_mode ) {
3066
+ $result = $this->create_bucket( $bucket, $region );
3067
+
3068
+ if ( is_wp_error( $result ) ) {
3069
+ $this->notices->add_notice( $this->prepare_bucket_error( $result, false ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3070
+
3071
+ return false;
3072
+ }
3073
+
3074
+ // Check if we were previously selecting a bucket manually via the input.
3075
+ $manual_select = $this->get_setting( 'manual_bucket', false );
3076
+
3077
+ $args = array(
3078
+ '_nonce' => wp_create_nonce( 'as3cf-create-bucket' ),
3079
+ );
3080
+ } elseif ( 'manual' === $bucket_mode ) {
3081
+ $manual_select = true;
3082
+ } else {
3083
+ $manual_select = false;
3084
+ }
3085
+
3086
+ // Stash the current bucket and region before they change.
3087
+ $old_bucket = $this->get_setting( 'bucket', false );
3088
+ $old_region = $this->get_setting( 'region', '' );
3089
+
3090
+ // Set bucket.
3091
+ $region = $this->save_bucket( $bucket, $manual_select, $region );
3092
+
3093
+ if ( is_wp_error( $region ) ) {
3094
+ $this->notices->add_notice( $this->prepare_bucket_error( $region, false ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3095
+
3096
+ return false;
3097
+ }
3098
+
3099
+ $can_write = $this->check_write_permission( $bucket, $region );
3100
+
3101
+ if ( is_wp_error( $can_write ) ) {
3102
+ $this->notices->add_notice( $this->prepare_bucket_error( $can_write, false ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media' ) );
3103
+
3104
+ return false;
3105
+ }
3106
+
3107
+ // Tell the parent handler whether the bucket or region have changed.
3108
+ $changed_keys = array();
3109
+
3110
+ if ( ! $old_bucket || $bucket !== $old_bucket ) {
3111
+ $changed_keys[] = 'bucket';
3112
+ }
3113
+
3114
+ if ( $region !== $old_region ) {
3115
+ $changed_keys[] = 'region';
3116
+ }
3117
+
3118
+ return $changed_keys;
3119
+ }
3120
+
3121
+ /**
3122
+ * Handle saving settings submitted by user.
3123
+ *
3124
+ * @return array
3125
+ */
3126
+ private function handle_save_settings() {
3127
+ $changed_keys = array();
3128
+
3129
do_action( 'as3cf_pre_save_settings' );
3130
3131
+ $post_vars = $this->get_settings_whitelist();
3132
+ $old_settings = $this->get_settings();
3133
3134
foreach ( $post_vars as $var ) {
3135
// Special case for when Secret Access Key is not changed.
3146
$value = $this->sanitize_setting( $var, $_POST[ $var ] );
3147
3148
$this->set_setting( $var, $value );
3149
+
3150
+ // Some setting changes might have knock-on effects that require confirmation of secondary settings.
3151
+ if ( isset( $old_settings[ $var ] ) && $old_settings[ $var ] !== $value ) {
3152
+ $changed_keys[] = $var;
3153
+ }
3154
}
3155
3156
$this->save_settings();
3157
3158
+ return $changed_keys;
3159
}
3160
3161
/**
3450
} elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
3451
$size_details .= $size . ' (' . $_wp_additional_image_sizes[ $size ]['width'] . 'x' . $_wp_additional_image_sizes[ $size ]['height'] . ')' . "\r\n";
3452
}
3453
}
3454
3455
return $size_details;
4538
}
4539
4540
/**
4541
+ * Handle retrieving the provider details for attachment modals.
4542
*/
4543
public function ajax_get_attachment_provider_details() {
4544
if ( ! isset( $_POST['id'] ) ) {
4833
* @return array Attachment's cleaned up metadata.
4834
*/
4835
public function maybe_cleanup_filesize_metadata( $post_id, $data, $update_metadata = true ) {
4836
+ if ( ! is_int( $post_id ) || empty( $post_id ) || empty( $data ) || ! is_array( $data ) ) {
4837
return $data;
4838
}
4839
classes/as3cf-compatibility-check.php CHANGED
@@ -369,7 +369,7 @@ if ( ! class_exists( 'AS3CF_Compatibility_Check' ) ) {
369
global $as3cfpro;
370
if ( ! empty( $as3cfpro ) && $as3cfpro->get_plugin_slug( true ) === $this->parent_plugin_slug ) {
371
// Don't show update link for addons of a licensed plugin where the license is invalid
372
- if ( ! $as3cfpro->is_valid_licence() ) {
373
$msg .= ' ' . sprintf( __( 'A valid license for %s is required to update.', 'amazon-s3-and-cloudfront' ), $this->get_parent_plugin_name() );
374
$msg .= $hide_notice_msg;
375
@@ -407,7 +407,7 @@ if ( ! class_exists( 'AS3CF_Compatibility_Check' ) ) {
407
global $as3cfpro;
408
if ( ! empty( $as3cfpro ) && $as3cfpro->get_plugin_slug( true ) === $this->parent_plugin_slug ) {
409
// Don't show update link for addons of a licensed plugin where the license is invalid
410
- if ( ! $as3cfpro->is_valid_licence() ) {
411
$upgrade_msg = ' ' . sprintf( __( 'A valid license for %s is required to update.', 'amazon-s3-and-cloudfront' ), $this->get_parent_plugin_name() );
412
}
413
}
369
global $as3cfpro;
370
if ( ! empty( $as3cfpro ) && $as3cfpro->get_plugin_slug( true ) === $this->parent_plugin_slug ) {
371
// Don't show update link for addons of a licensed plugin where the license is invalid
372
+ if ( ! $as3cfpro->is_valid_licence( false, true ) ) {
373
$msg .= ' ' . sprintf( __( 'A valid license for %s is required to update.', 'amazon-s3-and-cloudfront' ), $this->get_parent_plugin_name() );
374
$msg .= $hide_notice_msg;
375
407
global $as3cfpro;
408
if ( ! empty( $as3cfpro ) && $as3cfpro->get_plugin_slug( true ) === $this->parent_plugin_slug ) {
409
// Don't show update link for addons of a licensed plugin where the license is invalid
410
+ if ( ! $as3cfpro->is_valid_licence( false, true ) ) {
411
$upgrade_msg = ' ' . sprintf( __( 'A valid license for %s is required to update.', 'amazon-s3-and-cloudfront' ), $this->get_parent_plugin_name() );
412
}
413
}
classes/as3cf-plugin-base.php CHANGED
@@ -114,7 +114,13 @@ abstract class AS3CF_Plugin_Base {
114
*/
115
function get_settings( $force = false ) {
116
if ( is_null( $this->settings ) || $force ) {
117
- $this->settings = $this->filter_settings( get_site_option( static::SETTINGS_KEY ) );
118
}
119
120
return $this->settings;
@@ -170,7 +176,7 @@ abstract class AS3CF_Plugin_Base {
170
171
// Normalize the defined settings before saving, so we can detect when a real change happens.
172
ksort( $this->defined_settings );
173
- update_site_option( 'as3cf_constant_' . static::settings_constant(), $this->defined_settings );
174
}
175
176
return $this->defined_settings;
@@ -280,6 +286,17 @@ abstract class AS3CF_Plugin_Base {
280
return array();
281
}
282
283
/**
284
* List of settings that should skip full sanitize.
285
*
@@ -424,7 +441,7 @@ abstract class AS3CF_Plugin_Base {
424
ksort( $this->settings );
425
}
426
427
- $this->update_site_option( static::SETTINGS_KEY, $this->settings );
428
}
429
430
/**
114
*/
115
function get_settings( $force = false ) {
116
if ( is_null( $this->settings ) || $force ) {
117
+ $saved_settings = get_site_option( static::SETTINGS_KEY );
118
+ $this->settings = $this->filter_settings( $saved_settings );
119
+
120
+ // If defined settings keys have changed since last time settings were saved to database, re-save to remove the new keys.
121
+ if ( ! empty( $saved_settings ) && ! empty( $this->defined_settings ) && ! empty( array_intersect_key( $saved_settings, $this->defined_settings ) ) ) {
122
+ $this->save_settings();
123
+ }
124
}
125
126
return $this->settings;
176
177
// Normalize the defined settings before saving, so we can detect when a real change happens.
178
ksort( $this->defined_settings );
179
+ update_site_option( 'as3cf_constant_' . static::settings_constant(), array_diff_key( $this->defined_settings, array_flip( $this->get_monitored_settings_blacklist() ) ) );
180
}
181
182
return $this->defined_settings;
286
return array();
287
}
288
289
+ /**
290
+ * Get the blacklisted settings for monitoring changes in defines.
291
+ * These settings will not be saved in the database.
292
+ * Meant to be overridden in child classes.
293
+ *
294
+ * @return array
295
+ */
296
+ function get_monitored_settings_blacklist() {
297
+ return array();
298
+ }
299
+
300
/**
301
* List of settings that should skip full sanitize.
302
*
441
ksort( $this->settings );
442
}
443
444
+ $this->update_site_option( static::SETTINGS_KEY, array_diff_key( $this->settings, $this->defined_settings ) );
445
}
446
447
/**
classes/providers/aws-provider.php CHANGED
@@ -63,6 +63,13 @@ class AWS_Provider extends Provider {
63
*/
64
protected static $provider_service_name = 'Amazon S3';
65
66
/**
67
* @var array
68
*/
63
*/
64
protected static $provider_service_name = 'Amazon S3';
65
66
+ /**
67
+ * The slug for the service's quick start guide doc.
68
+ *
69
+ * @var string
70
+ */
71
+ protected static $provider_service_quick_start_slug = 'amazon-s3-quick-start-guide';
72
+
73
/**
74
* @var array
75
*/
classes/providers/digitalocean-provider.php CHANGED
@@ -45,6 +45,13 @@ class DigitalOcean_Provider extends AWS_Provider {
45
*/
46
protected static $provider_service_name = '';
47
48
/**
49
* @var array
50
*/
45
*/
46
protected static $provider_service_name = '';
47
48
+ /**
49
+ * The slug for the service's quick start guide doc.
50
+ *
51
+ * @var string
52
+ */
53
+ protected static $provider_service_quick_start_slug = 'digitalocean-spaces-quick-start-guide';
54
+
55
/**
56
* @var array
57
*/
classes/providers/provider.php CHANGED
@@ -60,6 +60,13 @@ abstract class Provider {
60
*/
61
protected static $provider_service_name = '';
62
63
/**
64
* @var string
65
*/
@@ -166,6 +173,15 @@ abstract class Provider {
166
return static::$provider_name . ' ' . static::$service_name;
167
}
168
169
/**
170
* Whether or not access keys are needed.
171
*
60
*/
61
protected static $provider_service_name = '';
62
63
+ /**
64
+ * The slug for the service's quick start guide doc.
65
+ *
66
+ * @var string
67
+ */
68
+ protected static $provider_service_quick_start_slug = 'quick-start-guide';
69
+
70
/**
71
* @var string
72
*/
173
return static::$provider_name . ' ' . static::$service_name;
174
}
175
176
+ /**
177
+ * Returns the slug for the service's quick start guide doc.
178
+ *
179
+ * @return string
180
+ */
181
+ public static function get_provider_service_quick_start_slug() {
182
+ return static::$provider_service_quick_start_slug;
183
+ }
184
+
185
/**
186
* Whether or not access keys are needed.
187
*
languages/amazon-s3-and-cloudfront-en.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
msgstr ""
9
"Project-Id-Version: amazon-s3-and-cloudfront\n"
10
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
- "POT-Creation-Date: 2018-09-25 11:15+0100\n"
12
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -22,164 +22,168 @@ msgstr ""
22
msgid "Offload Media"
23
msgstr ""
24
25
- #: classes/amazon-s3-and-cloudfront.php:279
26
- #: classes/amazon-s3-and-cloudfront.php:293
27
msgid "Unknown"
28
msgstr ""
29
30
- #: classes/amazon-s3-and-cloudfront.php:347
31
#: view/bucket-setting.php:17
32
- #: view/provider-select.php:85
33
msgid "defined in wp-config.php"
34
msgstr ""
35
36
- #: classes/amazon-s3-and-cloudfront.php:1093
37
- #: classes/amazon-s3-and-cloudfront.php:1232
38
#, php-format
39
msgid "File %s does not exist"
40
msgstr ""
41
42
- #: classes/amazon-s3-and-cloudfront.php:1106
43
#, php-format
44
msgid "Mime type %s is not allowed"
45
msgstr ""
46
47
- #: classes/amazon-s3-and-cloudfront.php:1117
48
msgid "Already offloaded to a different provider"
49
msgstr ""
50
51
- #: classes/amazon-s3-and-cloudfront.php:1196
52
- #: classes/amazon-s3-and-cloudfront.php:1240
53
#, php-format
54
msgid "Error offloading %s to provider: %s"
55
msgstr ""
56
57
- #: classes/amazon-s3-and-cloudfront.php:2364
58
msgid "This action can only be performed through an admin screen."
59
msgstr ""
60
61
- #: classes/amazon-s3-and-cloudfront.php:2366
62
msgid "Cheatin&#8217; eh?"
63
msgstr ""
64
65
- #: classes/amazon-s3-and-cloudfront.php:2368
66
msgid "You do not have sufficient permissions to access this page."
67
msgstr ""
68
69
- #: classes/amazon-s3-and-cloudfront.php:2403
70
- msgid "No region provided."
71
- msgstr ""
72
-
73
- #: classes/amazon-s3-and-cloudfront.php:2418
74
- msgid "No bucket name provided."
75
- msgstr ""
76
-
77
- #: classes/amazon-s3-and-cloudfront.php:2732
78
msgid "Error Getting Bucket Region"
79
msgstr ""
80
81
- #: classes/amazon-s3-and-cloudfront.php:2733
82
#, php-format
83
msgid "There was an error attempting to get the region of the bucket %s: %s"
84
msgstr ""
85
86
- #: classes/amazon-s3-and-cloudfront.php:2852
87
msgid ""
88
"This is a test file to check if the user has write permission to S3. Delete "
89
"me if found."
90
msgstr ""
91
92
- #: classes/amazon-s3-and-cloudfront.php:2858
93
#, php-format
94
msgid ""
95
"There was an error attempting to check the permissions of the bucket %s: %s"
96
msgstr ""
97
98
- #: classes/amazon-s3-and-cloudfront.php:2934
99
msgid "Error creating bucket"
100
msgstr ""
101
102
- #: classes/amazon-s3-and-cloudfront.php:2935
103
msgid "Bucket name too short."
104
msgstr ""
105
106
- #: classes/amazon-s3-and-cloudfront.php:2936
107
msgid "Bucket name too long."
108
msgstr ""
109
110
- #: classes/amazon-s3-and-cloudfront.php:2937
111
msgid ""
112
"Invalid character. Bucket names can contain lowercase letters, numbers, "
113
"periods and hyphens."
114
msgstr ""
115
116
- #: classes/amazon-s3-and-cloudfront.php:2938
117
msgid "Error saving bucket"
118
msgstr ""
119
120
- #: classes/amazon-s3-and-cloudfront.php:2939
121
msgid "Error fetching buckets"
122
msgstr ""
123
124
- #: classes/amazon-s3-and-cloudfront.php:2940
125
msgid "Error getting URL preview: "
126
msgstr ""
127
128
- #: classes/amazon-s3-and-cloudfront.php:2941
129
msgid "The changes you made will be lost if you navigate away from this page"
130
msgstr ""
131
132
- #: classes/amazon-s3-and-cloudfront.php:2942
133
msgid "Getting diagnostic info..."
134
msgstr ""
135
136
- #: classes/amazon-s3-and-cloudfront.php:2943
137
msgid "Error getting diagnostic info: "
138
msgstr ""
139
140
- #: classes/amazon-s3-and-cloudfront.php:2944
141
msgctxt "placeholder for hidden access key, 39 char max"
142
msgid "-- not shown --"
143
msgstr ""
144
145
- #: classes/amazon-s3-and-cloudfront.php:2946
146
- #: classes/amazon-s3-and-cloudfront.php:4662
147
msgid "Settings saved."
148
msgstr ""
149
150
- #: classes/amazon-s3-and-cloudfront.php:3020
151
msgid "Cheatin' eh?"
152
msgstr ""
153
154
- #: classes/amazon-s3-and-cloudfront.php:3029
155
- #: view/provider-select.php:219
156
msgctxt "placeholder for hidden secret access key, 39 char max"
157
msgid "-- not shown --"
158
msgstr ""
159
160
- #: classes/amazon-s3-and-cloudfront.php:3074
161
msgctxt "Show the media library tab"
162
msgid "Media Library"
163
msgstr ""
164
165
- #: classes/amazon-s3-and-cloudfront.php:3075
166
msgctxt "Show the addons tab"
167
msgid "Addons"
168
msgstr ""
169
170
- #: classes/amazon-s3-and-cloudfront.php:3076
171
msgctxt "Show the support tab"
172
msgid "Support"
173
msgstr ""
174
175
- #: classes/amazon-s3-and-cloudfront.php:3295
176
#, php-format
177
msgid ""
178
"<strong>WP Offload Media</strong> &mdash; The file %s has been given %s "
179
"permissions in the bucket."
180
msgstr ""
181
182
- #: classes/amazon-s3-and-cloudfront.php:3314
183
msgid ""
184
"<strong>WP Offload Media Requirement Missing</strong> &mdash; Looks like you "
185
"don't have an image manipulation library installed on this server and "
@@ -187,18 +191,18 @@ msgid ""
187
"Please setup GD or ImageMagick."
188
msgstr ""
189
190
- #: classes/amazon-s3-and-cloudfront.php:3942
191
#, php-format
192
msgid ""
193
"<a href=\"%s\">Define your access keys</a> to enable write access to the "
194
"bucket"
195
msgstr ""
196
197
- #: classes/amazon-s3-and-cloudfront.php:3949
198
msgid "Quick Start Guide"
199
msgstr ""
200
201
- #: classes/amazon-s3-and-cloudfront.php:3951
202
#, php-format
203
msgid ""
204
"Looks like we don't have write access to this bucket. It's likely that the "
@@ -207,7 +211,7 @@ msgid ""
207
"correctly."
208
msgstr ""
209
210
- #: classes/amazon-s3-and-cloudfront.php:3953
211
#, php-format
212
msgid ""
213
"Looks like we don't have access to the buckets. It's likely that the user "
@@ -215,39 +219,39 @@ msgid ""
215
"Please see our %s for instructions on setting up permissions correctly."
216
msgstr ""
217
218
- #: classes/amazon-s3-and-cloudfront.php:4103
219
msgid "WP Offload Media Activation"
220
msgstr ""
221
222
- #: classes/amazon-s3-and-cloudfront.php:4104
223
msgid ""
224
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
225
"automatically deactivated WP Offload Media Lite."
226
msgstr ""
227
228
- #: classes/amazon-s3-and-cloudfront.php:4106
229
msgid "WP Offload Media Lite Activation"
230
msgstr ""
231
232
- #: classes/amazon-s3-and-cloudfront.php:4107
233
msgid ""
234
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
235
"automatically deactivated WP Offload Media."
236
msgstr ""
237
238
- #: classes/amazon-s3-and-cloudfront.php:4159
239
msgid "More&nbsp;info&nbsp;&raquo;"
240
msgstr ""
241
242
- #: classes/amazon-s3-and-cloudfront.php:4254
243
msgid "this doc"
244
msgstr ""
245
246
- #: classes/amazon-s3-and-cloudfront.php:4256
247
msgid "WP Offload Media Feature Removed"
248
msgstr ""
249
250
- #: classes/amazon-s3-and-cloudfront.php:4257
251
#, php-format
252
msgid ""
253
"You had the \"Always non-SSL\" option selected in your settings, but we've "
@@ -258,59 +262,59 @@ msgid ""
258
"to the old behavior."
259
msgstr ""
260
261
- #: classes/amazon-s3-and-cloudfront.php:4287
262
msgid "Offload"
263
msgstr ""
264
265
- #: classes/amazon-s3-and-cloudfront.php:4395
266
msgctxt "Storage provider key name"
267
msgid "Storage Provider"
268
msgstr ""
269
270
- #: classes/amazon-s3-and-cloudfront.php:4396
271
msgctxt "Storage provider name"
272
msgid "Storage Provider"
273
msgstr ""
274
275
- #: classes/amazon-s3-and-cloudfront.php:4397
276
msgctxt "Bucket name"
277
msgid "Bucket"
278
msgstr ""
279
280
- #: classes/amazon-s3-and-cloudfront.php:4398
281
msgctxt "Path to file in bucket"
282
msgid "Path"
283
msgstr ""
284
285
- #: classes/amazon-s3-and-cloudfront.php:4399
286
msgctxt "Location of bucket"
287
msgid "Region"
288
msgstr ""
289
290
- #: classes/amazon-s3-and-cloudfront.php:4400
291
msgctxt "Access control list of the file in bucket"
292
msgid "Access"
293
msgstr ""
294
295
- #: classes/amazon-s3-and-cloudfront.php:4401
296
msgid "URL"
297
msgstr ""
298
299
- #: classes/amazon-s3-and-cloudfront.php:4625
300
msgid "Assets Pull"
301
msgstr ""
302
303
- #: classes/amazon-s3-and-cloudfront.php:4626
304
msgid ""
305
"An addon for WP Offload Media to serve your site's JS, CSS, and other "
306
"enqueued assets from Amazon CloudFront or another CDN."
307
msgstr ""
308
309
- #: classes/amazon-s3-and-cloudfront.php:4630
310
msgid "Feature"
311
msgstr ""
312
313
- #: classes/amazon-s3-and-cloudfront.php:4676
314
#, php-format
315
msgid ""
316
"<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
@@ -321,7 +325,7 @@ msgid ""
321
"plugin, it should be safe to deactivate and delete it. %2$s"
322
msgstr ""
323
324
- #: classes/amazon-s3-and-cloudfront.php:4708
325
#, php-format
326
msgid ""
327
"<strong>WP Offload Media Settings Moved</strong> &mdash; You now define your "
@@ -441,7 +445,7 @@ msgstr ""
441
msgid "Invalid notice ID."
442
msgstr ""
443
444
- #: classes/as3cf-plugin-base.php:499
445
msgid "Settings"
446
msgstr ""
447
@@ -465,7 +469,7 @@ msgid ""
465
"Offload Media will require PHP %2$s or later. %3$s"
466
msgstr ""
467
468
- #: classes/providers/provider.php:361
469
#, php-format
470
msgid "You must first <a href=\"%s\">set your access keys</a>."
471
msgstr ""
@@ -618,96 +622,86 @@ msgstr ""
618
msgid "File does not exist on server"
619
msgstr ""
620
621
- #: view/bucket-select.php:10
622
- msgid "Change bucket"
623
msgstr ""
624
625
- #: view/bucket-select.php:10
626
msgid "What bucket would you like to use?"
627
msgstr ""
628
629
- #: view/bucket-select.php:24
630
- #: view/bucket-select.php:80
631
- #: view/bucket-select.php:136
632
msgid "Region:"
633
msgstr ""
634
635
- #: view/bucket-select.php:39
636
- #: view/bucket-select.php:95
637
- #: view/bucket-select.php:151
638
#, php-format
639
msgid "%s (defined in wp-config.php)"
640
msgstr ""
641
642
- #: view/bucket-select.php:46
643
- #: view/bucket-select.php:101
644
- #: view/bucket-select.php:157
645
#: view/bucket-setting.php:8
646
msgid "Bucket:"
647
msgstr ""
648
649
- #: view/bucket-select.php:49
650
msgid "Existing bucket name"
651
msgstr ""
652
653
- #: view/bucket-select.php:54
654
- #: view/bucket-select.php:59
655
- msgid "Saving..."
656
- msgstr ""
657
-
658
- #: view/bucket-select.php:54
659
- #: view/bucket-select.php:59
660
- msgid "Save Bucket"
661
msgstr ""
662
663
- #: view/bucket-select.php:55
664
msgid "Browse existing buckets"
665
msgstr ""
666
667
- #: view/bucket-select.php:56
668
- #: view/bucket-select.php:117
669
- #: view/bucket-select.php:122
670
msgid "Create new bucket"
671
msgstr ""
672
673
- #: view/bucket-select.php:60
674
- #: view/bucket-select.php:112
675
- #: view/bucket-select.php:167
676
- msgid "Cancel"
677
- msgstr ""
678
-
679
- #: view/bucket-select.php:65
680
msgid "Select bucket"
681
msgstr ""
682
683
- #: view/bucket-select.php:104
684
- #: view/bucket-select.php:109
685
msgid "Loading..."
686
msgstr ""
687
688
- #: view/bucket-select.php:104
689
- #: view/bucket-select.php:109
690
msgid "Nothing found"
691
msgstr ""
692
693
- #: view/bucket-select.php:113
694
- #: view/bucket-select.php:118
695
- msgid "Refresh"
696
msgstr ""
697
698
- #: view/bucket-select.php:116
699
msgid "Enter bucket name"
700
msgstr ""
701
702
- #: view/bucket-select.php:160
703
- msgid "New bucket name"
704
msgstr ""
705
706
- #: view/bucket-select.php:166
707
- msgid "Creating..."
708
msgstr ""
709
710
- #: view/bucket-select.php:166
711
msgid "Create New Bucket"
712
msgstr ""
713
@@ -796,19 +790,15 @@ msgstr ""
796
msgid "Show"
797
msgstr ""
798
799
- #: view/provider-select.php:14
800
- msgid "&laquo;&nbsp;Back"
801
- msgstr ""
802
-
803
#: view/provider-select.php:17
804
msgid "Storage Provider"
805
msgstr ""
806
807
- #: view/provider-select.php:104
808
msgid "Define access keys in wp-config.php"
809
msgstr ""
810
811
- #: view/provider-select.php:112
812
#, php-format
813
msgctxt "Access Keys defined in multiple defines."
814
msgid ""
@@ -817,7 +807,7 @@ msgid ""
817
"config.php."
818
msgstr ""
819
820
- #: view/provider-select.php:114
821
#, php-format
822
msgctxt "Access Keys defined in single define."
823
msgid ""
@@ -826,28 +816,28 @@ msgid ""
826
"config.php."
827
msgstr ""
828
829
- #: view/provider-select.php:116
830
msgctxt "joins multiple define keys in notice"
831
msgid " & "
832
msgstr ""
833
834
- #: view/provider-select.php:125
835
msgid ""
836
"Please check your wp-config.php file as it looks like one of your access key "
837
"defines is missing or incorrect."
838
msgstr ""
839
840
- #: view/provider-select.php:131
841
msgid ""
842
"Copy the following snippet <strong>near the top</strong> of your wp-config."
843
"php and replace the stars with the keys."
844
msgstr ""
845
846
- #: view/provider-select.php:156
847
msgid "My server is on Amazon EC2 and I'd like to use IAM Roles"
848
msgstr ""
849
850
- #: view/provider-select.php:162
851
#, php-format
852
msgid ""
853
"You've defined the '%1$s' constant in your wp-config.php. To select a "
@@ -855,34 +845,43 @@ msgid ""
855
"config.php."
856
msgstr ""
857
858
- #: view/provider-select.php:166
859
msgid ""
860
"If you host your WordPress site on an Amazon EC2 instance you should make "
861
"use of IAM Roles. To tell WP Offload Media you're using IAM Roles, copy the "
862
"following snippet <strong>near the top</strong> of your wp-config.php."
863
msgstr ""
864
865
- #: view/provider-select.php:187
866
msgid ""
867
"I understand the risks but I'd like to store access keys in the database "
868
"anyway (not recommended)"
869
msgstr ""
870
871
- #: view/provider-select.php:193
872
msgid ""
873
"Storing your access keys in the database is less secure than the options "
874
"above, but if you're ok with that, go ahead and enter your keys in the form "
875
"below."
876
msgstr ""
877
878
- #: view/provider-select.php:198
879
msgid "Access Key ID"
880
msgstr ""
881
882
- #: view/provider-select.php:213
883
msgid "Secret Access Key"
884
msgstr ""
885
886
#: view/provider-setting.php:6
887
msgid "Provider:"
888
msgstr ""
@@ -895,7 +894,7 @@ msgid ""
895
"\">deliciousbrains.com</a> to purchase in just a few clicks."
896
msgstr ""
897
898
- #: view/settings/media.php:53
899
#, php-format
900
msgid ""
901
"Yikes! That's not a very SEO-friendly URL. We strongly recommend you "
@@ -903,103 +902,99 @@ msgid ""
903
"point at your CDN. %2$s"
904
msgstr ""
905
906
- #: view/settings/media.php:69
907
msgid "Storage"
908
msgstr ""
909
910
- #: view/settings/media.php:97
911
msgid "Copy Files to Bucket"
912
msgstr ""
913
914
- #: view/settings/media.php:99
915
msgid "When a file is uploaded to the Media Library, copy it to the bucket."
916
msgstr ""
917
918
- #: view/settings/media.php:114
919
msgid "Path"
920
msgstr ""
921
922
- #: view/settings/media.php:116
923
msgid "By default the path is the same as your local WordPress files."
924
msgstr ""
925
926
- #: view/settings/media.php:134
927
msgid "Year/Month"
928
msgstr ""
929
930
- #: view/settings/media.php:136
931
msgid ""
932
"Add the Year/Month to the end of the path above just like WordPress does by "
933
"default."
934
msgstr ""
935
936
- #: view/settings/media.php:149
937
msgid "Object Versioning"
938
msgstr ""
939
940
- #: view/settings/media.php:151
941
msgid ""
942
"Append a timestamp to the file's bucket path. Recommended when using a CDN "
943
"so you don't have to worry about cache invalidation."
944
msgstr ""
945
946
- #: view/settings/media.php:159
947
msgid "URL Rewriting"
948
msgstr ""
949
950
- #: view/settings/media.php:169
951
msgid "Rewrite Media URLs"
952
msgstr ""
953
954
- #: view/settings/media.php:171
955
msgid ""
956
"For Media Library files that have been copied to your bucket, rewrite the "
957
"URLs so that they are served from the bucket or CDN instead of your server."
958
msgstr ""
959
960
- #: view/settings/media.php:187
961
msgid "Force HTTPS"
962
msgstr ""
963
964
- #: view/settings/media.php:189
965
msgid ""
966
"By default we use HTTPS when the request is HTTPS and regular HTTP when the "
967
"request is HTTP, but you may want to force the use of HTTPS always, "
968
"regardless of the request."
969
msgstr ""
970
971
- #: view/settings/media.php:197
972
msgid "Advanced Options"
973
msgstr ""
974
975
- #: view/settings/media.php:207
976
msgid "Remove Files From Server"
977
msgstr ""
978
979
- #: view/settings/media.php:208
980
msgid ""
981
"Once a file has been copied to the bucket, remove it from the local server."
982
msgstr ""
983
984
- #: view/settings/media.php:212
985
msgid ""