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 | 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 +15 -5
- assets/css/styles.css +1 -1
- assets/js/script.js +78 -385
- assets/js/script.min.js +1 -1
- assets/sass/styles.scss +43 -42
- classes/amazon-s3-and-cloudfront.php +238 -129
- classes/as3cf-compatibility-check.php +2 -2
- classes/as3cf-plugin-base.php +20 -3
- classes/providers/aws-provider.php +7 -0
- classes/providers/digitalocean-provider.php +7 -0
- classes/providers/provider.php +16 -0
- languages/amazon-s3-and-cloudfront-en.pot +156 -161
- readme.txt +15 -5
- view/bucket-select.php +96 -76
- view/bucket-setting.php +1 -1
- view/checkbox.php +2 -2
- view/provider-select.php +21 -10
- view/settings/media.php +37 -12
- wordpress-s3.php +2 -2
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:**
|
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-
|
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 |
-
*
|
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 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
402 |
return;
|
403 |
}
|
404 |
|
405 |
-
|
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()
|
|
|
|
|
415 |
$manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
|
|
|
|
|
|
|
|
|
416 |
} else {
|
417 |
-
$
|
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 |
-
//
|
874 |
-
|
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.
|
|
|
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-
|
952 |
var bucketName = $( this ).val();
|
953 |
-
|
|
|
|
|
954 |
|
955 |
-
|
956 |
-
|
957 |
-
} else {
|
958 |
-
$createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true );
|
959 |
-
}
|
960 |
as3cf.buckets.updateNameNotice( bucketName );
|
|
|
961 |
} );
|
962 |
|
963 |
-
//
|
964 |
-
$
|
965 |
-
|
|
|
966 |
|
967 |
-
|
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+" —"),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+" —"),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-
|
120 |
display: none;
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
-
}
|
123 |
|
124 |
-
|
125 |
-
|
|
|
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 |
-
|
|
|
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 =
|
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
|
2386 |
*
|
2387 |
-
* @param
|
|
|
2388 |
*
|
2389 |
-
* @return string
|
2390 |
*/
|
2391 |
-
function
|
2392 |
-
|
2393 |
-
|
2394 |
-
// Are we defining the region or specifying via the form?
|
2395 |
if ( defined( 'AS3CF_REGION' ) ) {
|
2396 |
-
|
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 |
-
|
2409 |
-
|
|
|
|
|
2410 |
|
2411 |
-
|
2412 |
-
|
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 |
-
|
|
|
2421 |
}
|
2422 |
|
2423 |
-
return
|
2424 |
}
|
2425 |
|
2426 |
/**
|
2427 |
-
*
|
2428 |
*
|
2429 |
-
* @
|
|
|
|
|
2430 |
*/
|
2431 |
-
function
|
2432 |
-
$
|
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 |
-
|
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
|
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 =
|
2552 |
} else {
|
2553 |
-
$out =
|
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 =
|
|
|
2784 |
|
2785 |
$result = $this->get_buckets( $region );
|
2786 |
|
2787 |
if ( is_wp_error( $result ) ) {
|
2788 |
-
$out =
|
|
|
|
|
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 =
|
|
|
|
|
|
|
2878 |
}
|
2879 |
-
|
2880 |
-
|
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
|
|
|
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 |
-
|
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
|
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 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
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-
|
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:
|
26 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
27 |
msgid "Unknown"
|
28 |
msgstr ""
|
29 |
|
30 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
31 |
#: view/bucket-setting.php:17
|
32 |
-
#: view/provider-select.php:
|
33 |
msgid "defined in wp-config.php"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
37 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
38 |
#, php-format
|
39 |
msgid "File %s does not exist"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
43 |
#, php-format
|
44 |
msgid "Mime type %s is not allowed"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
48 |
msgid "Already offloaded to a different provider"
|
49 |
msgstr ""
|
50 |
|
51 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
52 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
53 |
#, php-format
|
54 |
msgid "Error offloading %s to provider: %s"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
58 |
msgid "This action can only be performed through an admin screen."
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
62 |
msgid "Cheatin’ eh?"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
66 |
msgid "You do not have sufficient permissions to access this page."
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
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:
|
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:
|
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:
|
99 |
msgid "Error creating bucket"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
103 |
msgid "Bucket name too short."
|
104 |
msgstr ""
|
105 |
|
106 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
107 |
msgid "Bucket name too long."
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
117 |
msgid "Error saving bucket"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
121 |
msgid "Error fetching buckets"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
125 |
msgid "Error getting URL preview: "
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
133 |
msgid "Getting diagnostic info..."
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
137 |
msgid "Error getting diagnostic info: "
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
141 |
msgctxt "placeholder for hidden access key, 39 char max"
|
142 |
msgid "-- not shown --"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
146 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
147 |
msgid "Settings saved."
|
148 |
msgstr ""
|
149 |
|
150 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
151 |
msgid "Cheatin' eh?"
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
|
161 |
msgctxt "Show the media library tab"
|
162 |
msgid "Media Library"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
166 |
msgctxt "Show the addons tab"
|
167 |
msgid "Addons"
|
168 |
msgstr ""
|
169 |
|
170 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
171 |
msgctxt "Show the support tab"
|
172 |
msgid "Support"
|
173 |
msgstr ""
|
174 |
|
175 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
176 |
#, php-format
|
177 |
msgid ""
|
178 |
"<strong>WP Offload Media</strong> — The file %s has been given %s "
|
179 |
"permissions in the bucket."
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
183 |
msgid ""
|
184 |
"<strong>WP Offload Media Requirement Missing</strong> — 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:
|
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:
|
198 |
msgid "Quick Start Guide"
|
199 |
msgstr ""
|
200 |
|
201 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
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:
|
219 |
msgid "WP Offload Media Activation"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
229 |
msgid "WP Offload Media Lite Activation"
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
239 |
msgid "More info »"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
243 |
msgid "this doc"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
247 |
msgid "WP Offload Media Feature Removed"
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
262 |
msgid "Offload"
|
263 |
msgstr ""
|
264 |
|
265 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
266 |
msgctxt "Storage provider key name"
|
267 |
msgid "Storage Provider"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
271 |
msgctxt "Storage provider name"
|
272 |
msgid "Storage Provider"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
276 |
msgctxt "Bucket name"
|
277 |
msgid "Bucket"
|
278 |
msgstr ""
|
279 |
|
280 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
281 |
msgctxt "Path to file in bucket"
|
282 |
msgid "Path"
|
283 |
msgstr ""
|
284 |
|
285 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
286 |
msgctxt "Location of bucket"
|
287 |
msgid "Region"
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
291 |
msgctxt "Access control list of the file in bucket"
|
292 |
msgid "Access"
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
296 |
msgid "URL"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
300 |
msgid "Assets Pull"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
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:
|
310 |
msgid "Feature"
|
311 |
msgstr ""
|
312 |
|
313 |
-
#: classes/amazon-s3-and-cloudfront.php:
|
314 |
#, php-format
|
315 |
msgid ""
|
316 |
"<strong>Amazon Web Services Plugin No Longer Required</strong> — 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:
|
325 |
#, php-format
|
326 |
msgid ""
|
327 |
"<strong>WP Offload Media Settings Moved</strong> — You now define your "
|
@@ -441,7 +445,7 @@ msgstr ""
|
|
441 |
msgid "Invalid notice ID."
|
442 |
msgstr ""
|
443 |
|
444 |
-
#: classes/as3cf-plugin-base.php:
|
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:
|
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:
|
622 |
-
|
|
|
623 |
msgstr ""
|
624 |
|
625 |
-
#: view/bucket-select.php:
|
626 |
msgid "What bucket would you like to use?"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#: view/bucket-select.php:
|
630 |
-
#: view/bucket-select.php:
|
631 |
-
#: view/bucket-select.php:
|
632 |
msgid "Region:"
|
633 |
msgstr ""
|
634 |
|
635 |
-
#: view/bucket-select.php:
|
636 |
-
#: view/bucket-select.php:
|
637 |
-
#: view/bucket-select.php:
|
638 |
#, php-format
|
639 |
msgid "%s (defined in wp-config.php)"
|
640 |
msgstr ""
|
641 |
|
642 |
-
#: view/bucket-select.php:
|
643 |
-
#: view/bucket-select.php:
|
644 |
-
#: view/bucket-select.php:
|
645 |
#: view/bucket-setting.php:8
|
646 |
msgid "Bucket:"
|
647 |
msgstr ""
|
648 |
|
649 |
-
#: view/bucket-select.php:
|
650 |
msgid "Existing bucket name"
|
651 |
msgstr ""
|
652 |
|
653 |
-
#: view/bucket-select.php:
|
654 |
-
|
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:
|
|
|
664 |
msgid "Browse existing buckets"
|
665 |
msgstr ""
|
666 |
|
667 |
-
#: view/bucket-select.php:
|
668 |
-
#: view/bucket-select.php:
|
669 |
-
#: view/bucket-select.php:
|
670 |
msgid "Create new bucket"
|
671 |
msgstr ""
|
672 |
|
673 |
-
#: view/bucket-select.php:
|
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:
|
684 |
-
#: view/bucket-select.php:
|
685 |
msgid "Loading..."
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: view/bucket-select.php:
|
689 |
-
#: view/bucket-select.php:
|
690 |
msgid "Nothing found"
|
691 |
msgstr ""
|
692 |
|
693 |
-
#: view/bucket-select.php:
|
694 |
-
|
695 |
-
msgid "Refresh"
|
696 |
msgstr ""
|
697 |
|
698 |
-
#: view/bucket-select.php:
|
|
|
699 |
msgid "Enter bucket name"
|
700 |
msgstr ""
|
701 |
|
702 |
-
#: view/bucket-select.php:
|
703 |
-
msgid "
|
704 |
msgstr ""
|
705 |
|
706 |
-
#: view/bucket-select.php:
|
707 |
-
msgid "
|
708 |
msgstr ""
|
709 |
|
710 |
-
#: view/bucket-select.php:
|
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 "« Back"
|
801 |
-
msgstr ""
|
802 |
-
|
803 |
#: view/provider-select.php:17
|
804 |
msgid "Storage Provider"
|
805 |
msgstr ""
|
806 |
|
807 |
-
#: view/provider-select.php:
|
808 |
msgid "Define access keys in wp-config.php"
|
809 |
msgstr ""
|
810 |
|
811 |
-
#: view/provider-select.php:
|
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:
|
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:
|
830 |
msgctxt "joins multiple define keys in notice"
|
831 |
msgid " & "
|
832 |
msgstr ""
|
833 |
|
834 |
-
#: view/provider-select.php:
|
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:
|
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:
|
847 |
msgid "My server is on Amazon EC2 and I'd like to use IAM Roles"
|
848 |
msgstr ""
|
849 |
|
850 |
-
#: view/provider-select.php:
|
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:
|
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:
|
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:
|
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:
|
879 |
msgid "Access Key ID"
|
880 |
msgstr ""
|
881 |
|
882 |
-
#: view/provider-select.php:
|
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:
|
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:
|
907 |
msgid "Storage"
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: view/settings/media.php:
|
911 |
msgid "Copy Files to Bucket"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: view/settings/media.php:
|
915 |
msgid "When a file is uploaded to the Media Library, copy it to the bucket."
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: view/settings/media.php:
|
919 |
msgid "Path"
|
920 |
msgstr ""
|
921 |
|
922 |
-
#: view/settings/media.php:
|
923 |
msgid "By default the path is the same as your local WordPress files."
|
924 |
msgstr ""
|
925 |
|
926 |
-
#: view/settings/media.php:
|
927 |
msgid "Year/Month"
|
928 |
msgstr ""
|
929 |
|
930 |
-
#: view/settings/media.php:
|
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:
|
937 |
msgid "Object Versioning"
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: view/settings/media.php:
|
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:
|
947 |
msgid "URL Rewriting"
|
948 |
msgstr ""
|
949 |
|
950 |
-
#: view/settings/media.php:
|
951 |
msgid "Rewrite Media URLs"
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: view/settings/media.php:
|
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:
|
961 |
msgid "Force HTTPS"
|
962 |
msgstr ""
|
963 |
|
964 |
-
#: view/settings/media.php:
|
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:
|
972 |
msgid "Advanced Options"
|
973 |
msgstr ""
|
974 |
|
975 |
-
#: view/settings/media.php:
|
976 |
msgid "Remove Files From Server"
|
977 |
msgstr ""
|
978 |
|
979 |
-
#: view/settings/media.php:
|
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:
|
985 |
msgid ""
|
986 |
"<strong>Broken URLs</strong> — There will be broken URLs for files "
|
987 |
"that don't exist locally. You can fix this by enabling <strong>Rewrite Media "
|
988 |
"URLs</strong> to use the offloaded media."
|
989 |
msgstr ""
|
990 |
|
991 |
-
#: view/settings/media.php:
|
992 |
#, php-format
|
993 |
msgid ""
|
994 |
"<strong>Warning</strong> — Some plugins depend on the file being "
|
995 |
"present on the local server and may not work when the file is removed. %s"
|
996 |
msgstr ""
|
997 |
|
998 |
-
#: view/settings/media.php:
|
999 |
-
msgid "Save Changes"
|
1000 |
-
msgstr ""
|
1001 |
-
|
1002 |
-
#: view/settings/media.php:248
|
1003 |
#, php-format
|
1004 |
msgid ""
|
1005 |
"Need help getting your Access Keys? <a href=\"%s\">Check out the Quick Start "
|
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-12-17 10:03+0000\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 |
msgid "Offload Media"
|
23 |
msgstr ""
|
24 |
|
25 |
+
#: classes/amazon-s3-and-cloudfront.php:276
|
26 |
+
#: classes/amazon-s3-and-cloudfront.php:290
|
27 |
msgid "Unknown"
|
28 |
msgstr ""
|
29 |
|
30 |
+
#: classes/amazon-s3-and-cloudfront.php:344
|
31 |
#: view/bucket-setting.php:17
|
32 |
+
#: view/provider-select.php:88
|
33 |
msgid "defined in wp-config.php"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: classes/amazon-s3-and-cloudfront.php:1090
|
37 |
+
#: classes/amazon-s3-and-cloudfront.php:1229
|
38 |
#, php-format
|
39 |
msgid "File %s does not exist"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: classes/amazon-s3-and-cloudfront.php:1103
|
43 |
#, php-format
|
44 |
msgid "Mime type %s is not allowed"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: classes/amazon-s3-and-cloudfront.php:1114
|
48 |
msgid "Already offloaded to a different provider"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: classes/amazon-s3-and-cloudfront.php:1193
|
52 |
+
#: classes/amazon-s3-and-cloudfront.php:1237
|
53 |
#, php-format
|
54 |
msgid "Error offloading %s to provider: %s"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: classes/amazon-s3-and-cloudfront.php:2361
|
58 |
msgid "This action can only be performed through an admin screen."
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: classes/amazon-s3-and-cloudfront.php:2363
|
62 |
msgid "Cheatin’ eh?"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: classes/amazon-s3-and-cloudfront.php:2365
|
66 |
msgid "You do not have sufficient permissions to access this page."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: classes/amazon-s3-and-cloudfront.php:2645
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
msgid "Error Getting Bucket Region"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: classes/amazon-s3-and-cloudfront.php:2646
|
74 |
#, php-format
|
75 |
msgid "There was an error attempting to get the region of the bucket %s: %s"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: classes/amazon-s3-and-cloudfront.php:2773
|
79 |
msgid ""
|
80 |
"This is a test file to check if the user has write permission to S3. Delete "
|
81 |
"me if found."
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: classes/amazon-s3-and-cloudfront.php:2779
|
85 |
#, php-format
|
86 |
msgid ""
|
87 |
"There was an error attempting to check the permissions of the bucket %s: %s"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: classes/amazon-s3-and-cloudfront.php:2861
|
91 |
msgid "Error creating bucket"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: classes/amazon-s3-and-cloudfront.php:2862
|
95 |
msgid "Bucket name too short."
|
96 |
msgstr ""
|
97 |
|
98 |
+
#: classes/amazon-s3-and-cloudfront.php:2863
|
99 |
msgid "Bucket name too long."
|
100 |
msgstr ""
|
101 |
|
102 |
+
#: classes/amazon-s3-and-cloudfront.php:2864
|
103 |
msgid ""
|
104 |
"Invalid character. Bucket names can contain lowercase letters, numbers, "
|
105 |
"periods and hyphens."
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: classes/amazon-s3-and-cloudfront.php:2865
|
109 |
msgid "Error saving bucket"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: classes/amazon-s3-and-cloudfront.php:2866
|
113 |
msgid "Error fetching buckets"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: classes/amazon-s3-and-cloudfront.php:2867
|
117 |
msgid "Error getting URL preview: "
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: classes/amazon-s3-and-cloudfront.php:2868
|
121 |
msgid "The changes you made will be lost if you navigate away from this page"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: classes/amazon-s3-and-cloudfront.php:2869
|
125 |
msgid "Getting diagnostic info..."
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: classes/amazon-s3-and-cloudfront.php:2870
|
129 |
msgid "Error getting diagnostic info: "
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: classes/amazon-s3-and-cloudfront.php:2871
|
133 |
msgctxt "placeholder for hidden access key, 39 char max"
|
134 |
msgid "-- not shown --"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: classes/amazon-s3-and-cloudfront.php:2873
|
138 |
+
#: classes/amazon-s3-and-cloudfront.php:4771
|
139 |
msgid "Settings saved."
|
140 |
msgstr ""
|
141 |
|
142 |
+
#: classes/amazon-s3-and-cloudfront.php:2960
|
143 |
msgid "Cheatin' eh?"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: classes/amazon-s3-and-cloudfront.php:3037
|
147 |
+
msgid "No bucket name provided."
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: classes/amazon-s3-and-cloudfront.php:3046
|
151 |
+
msgid "No bucket name not valid."
|
152 |
+
msgstr ""
|
153 |
+
|
154 |
+
#: classes/amazon-s3-and-cloudfront.php:3059
|
155 |
+
msgid "No region provided."
|
156 |
+
msgstr ""
|
157 |
+
|
158 |
+
#: classes/amazon-s3-and-cloudfront.php:3136
|
159 |
+
#: view/provider-select.php:227
|
160 |
msgctxt "placeholder for hidden secret access key, 39 char max"
|
161 |
msgid "-- not shown --"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: classes/amazon-s3-and-cloudfront.php:3184
|
165 |
msgctxt "Show the media library tab"
|
166 |
msgid "Media Library"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: classes/amazon-s3-and-cloudfront.php:3185
|
170 |
msgctxt "Show the addons tab"
|
171 |
msgid "Addons"
|
172 |
msgstr ""
|
173 |
|
174 |
+
#: classes/amazon-s3-and-cloudfront.php:3186
|
175 |
msgctxt "Show the support tab"
|
176 |
msgid "Support"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: classes/amazon-s3-and-cloudfront.php:3405
|
180 |
#, php-format
|
181 |
msgid ""
|
182 |
"<strong>WP Offload Media</strong> — The file %s has been given %s "
|
183 |
"permissions in the bucket."
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: classes/amazon-s3-and-cloudfront.php:3424
|
187 |
msgid ""
|
188 |
"<strong>WP Offload Media Requirement Missing</strong> — Looks like you "
|
189 |
"don't have an image manipulation library installed on this server and "
|
191 |
"Please setup GD or ImageMagick."
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: classes/amazon-s3-and-cloudfront.php:4051
|
195 |
#, php-format
|
196 |
msgid ""
|
197 |
"<a href=\"%s\">Define your access keys</a> to enable write access to the "
|
198 |
"bucket"
|
199 |
msgstr ""
|
200 |
|
201 |
+
#: classes/amazon-s3-and-cloudfront.php:4058
|
202 |
msgid "Quick Start Guide"
|
203 |
msgstr ""
|
204 |
|
205 |
+
#: classes/amazon-s3-and-cloudfront.php:4060
|
206 |
#, php-format
|
207 |
msgid ""
|
208 |
"Looks like we don't have write access to this bucket. It's likely that the "
|
211 |
"correctly."
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: classes/amazon-s3-and-cloudfront.php:4062
|
215 |
#, php-format
|
216 |
msgid ""
|
217 |
"Looks like we don't have access to the buckets. It's likely that the user "
|
219 |
"Please see our %s for instructions on setting up permissions correctly."
|
220 |
msgstr ""
|
221 |
|
222 |
+
#: classes/amazon-s3-and-cloudfront.php:4212
|
223 |
msgid "WP Offload Media Activation"
|
224 |
msgstr ""
|
225 |
|
226 |
+
#: classes/amazon-s3-and-cloudfront.php:4213
|
227 |
msgid ""
|
228 |
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
|
229 |
"automatically deactivated WP Offload Media Lite."
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: classes/amazon-s3-and-cloudfront.php:4215
|
233 |
msgid "WP Offload Media Lite Activation"
|
234 |
msgstr ""
|
235 |
|
236 |
+
#: classes/amazon-s3-and-cloudfront.php:4216
|
237 |
msgid ""
|
238 |
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
|
239 |
"automatically deactivated WP Offload Media."
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: classes/amazon-s3-and-cloudfront.php:4268
|
243 |
msgid "More info »"
|
244 |
msgstr ""
|
245 |
|
246 |
+
#: classes/amazon-s3-and-cloudfront.php:4363
|
247 |
msgid "this doc"
|
248 |
msgstr ""
|
249 |
|
250 |
+
#: classes/amazon-s3-and-cloudfront.php:4365
|
251 |
msgid "WP Offload Media Feature Removed"
|
252 |
msgstr ""
|
253 |
|
254 |
+
#: classes/amazon-s3-and-cloudfront.php:4366
|
255 |
#, php-format
|
256 |
msgid ""
|
257 |
"You had the \"Always non-SSL\" option selected in your settings, but we've "
|
262 |
"to the old behavior."
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: classes/amazon-s3-and-cloudfront.php:4396
|
266 |
msgid "Offload"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: classes/amazon-s3-and-cloudfront.php:4504
|
270 |
msgctxt "Storage provider key name"
|
271 |
msgid "Storage Provider"
|
272 |
msgstr ""
|
273 |
|
274 |
+
#: classes/amazon-s3-and-cloudfront.php:4505
|
275 |
msgctxt "Storage provider name"
|
276 |
msgid "Storage Provider"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: classes/amazon-s3-and-cloudfront.php:4506
|
280 |
msgctxt "Bucket name"
|
281 |
msgid "Bucket"
|
282 |
msgstr ""
|
283 |
|
284 |
+
#: classes/amazon-s3-and-cloudfront.php:4507
|
285 |
msgctxt "Path to file in bucket"
|
286 |
msgid "Path"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: classes/amazon-s3-and-cloudfront.php:4508
|
290 |
msgctxt "Location of bucket"
|
291 |
msgid "Region"
|
292 |
msgstr ""
|
293 |
|
294 |
+
#: classes/amazon-s3-and-cloudfront.php:4509
|
295 |
msgctxt "Access control list of the file in bucket"
|
296 |
msgid "Access"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: classes/amazon-s3-and-cloudfront.php:4510
|
300 |
msgid "URL"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: classes/amazon-s3-and-cloudfront.php:4734
|
304 |
msgid "Assets Pull"
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: classes/amazon-s3-and-cloudfront.php:4735
|
308 |
msgid ""
|
309 |
"An addon for WP Offload Media to serve your site's JS, CSS, and other "
|
310 |
"enqueued assets from Amazon CloudFront or another CDN."
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: classes/amazon-s3-and-cloudfront.php:4739
|
314 |
msgid "Feature"
|
315 |
msgstr ""
|
316 |
|
317 |
+
#: classes/amazon-s3-and-cloudfront.php:4785
|
318 |
#, php-format
|
319 |
msgid ""
|
320 |
"<strong>Amazon Web Services Plugin No Longer Required</strong> — As of "
|
325 |
"plugin, it should be safe to deactivate and delete it. %2$s"
|
326 |
msgstr ""
|
327 |
|
328 |
+
#: classes/amazon-s3-and-cloudfront.php:4817
|
329 |
#, php-format
|
330 |
msgid ""
|
331 |
"<strong>WP Offload Media Settings Moved</strong> — You now define your "
|
445 |
msgid "Invalid notice ID."
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: classes/as3cf-plugin-base.php:516
|
449 |
msgid "Settings"
|
450 |
msgstr ""
|
451 |
|
469 |
"Offload Media will require PHP %2$s or later. %3$s"
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: classes/providers/provider.php:377
|
473 |
#, php-format
|
474 |
msgid "You must first <a href=\"%s\">set your access keys</a>."
|
475 |
msgstr ""
|
622 |
msgid "File does not exist on server"
|
623 |
msgstr ""
|
624 |
|
625 |
+
#: view/bucket-select.php:30
|
626 |
+
#: view/provider-select.php:14
|
627 |
+
msgid "« Back"
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: view/bucket-select.php:36
|
631 |
msgid "What bucket would you like to use?"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: view/bucket-select.php:49
|
635 |
+
#: view/bucket-select.php:102
|
636 |
+
#: view/bucket-select.php:155
|
637 |
msgid "Region:"
|
638 |
msgstr ""
|
639 |
|
640 |
+
#: view/bucket-select.php:64
|
641 |
+
#: view/bucket-select.php:117
|
642 |
+
#: view/bucket-select.php:170
|
643 |
#, php-format
|
644 |
msgid "%s (defined in wp-config.php)"
|
645 |
msgstr ""
|
646 |
|
647 |
+
#: view/bucket-select.php:71
|
648 |
+
#: view/bucket-select.php:123
|
649 |
+
#: view/bucket-select.php:176
|
650 |
#: view/bucket-setting.php:8
|
651 |
msgid "Bucket:"
|
652 |
msgstr ""
|
653 |
|
654 |
+
#: view/bucket-select.php:74
|
655 |
msgid "Existing bucket name"
|
656 |
msgstr ""
|
657 |
|
658 |
+
#: view/bucket-select.php:80
|
659 |
+
msgid "Save Bucket Setting"
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
msgstr ""
|
661 |
|
662 |
+
#: view/bucket-select.php:81
|
663 |
+
#: view/bucket-select.php:186
|
664 |
msgid "Browse existing buckets"
|
665 |
msgstr ""
|
666 |
|
667 |
+
#: view/bucket-select.php:82
|
668 |
+
#: view/bucket-select.php:137
|
669 |
+
#: view/bucket-select.php:143
|
670 |
msgid "Create new bucket"
|
671 |
msgstr ""
|
672 |
|
673 |
+
#: view/bucket-select.php:87
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
msgid "Select bucket"
|
675 |
msgstr ""
|
676 |
|
677 |
+
#: view/bucket-select.php:126
|
678 |
+
#: view/bucket-select.php:131
|
679 |
msgid "Loading..."
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: view/bucket-select.php:126
|
683 |
+
#: view/bucket-select.php:131
|
684 |
msgid "Nothing found"
|
685 |
msgstr ""
|
686 |
|
687 |
+
#: view/bucket-select.php:135
|
688 |
+
msgid "Save Selected Bucket"
|
|
|
689 |
msgstr ""
|
690 |
|
691 |
+
#: view/bucket-select.php:136
|
692 |
+
#: view/bucket-select.php:187
|
693 |
msgid "Enter bucket name"
|
694 |
msgstr ""
|
695 |
|
696 |
+
#: view/bucket-select.php:138
|
697 |
+
msgid "Refresh"
|
698 |
msgstr ""
|
699 |
|
700 |
+
#: view/bucket-select.php:179
|
701 |
+
msgid "New bucket name"
|
702 |
msgstr ""
|
703 |
|
704 |
+
#: view/bucket-select.php:185
|
705 |
msgid "Create New Bucket"
|
706 |
msgstr ""
|
707 |
|
790 |
msgid "Show"
|
791 |
msgstr ""
|
792 |
|
|
|
|
|
|
|
|
|
793 |
#: view/provider-select.php:17
|
794 |
msgid "Storage Provider"
|
795 |
msgstr ""
|
796 |
|
797 |
+
#: view/provider-select.php:108
|
798 |
msgid "Define access keys in wp-config.php"
|
799 |
msgstr ""
|
800 |
|
801 |
+
#: view/provider-select.php:117
|
802 |
#, php-format
|
803 |
msgctxt "Access Keys defined in multiple defines."
|
804 |
msgid ""
|
807 |
"config.php."
|
808 |
msgstr ""
|
809 |
|
810 |
+
#: view/provider-select.php:119
|
811 |
#, php-format
|
812 |
msgctxt "Access Keys defined in single define."
|
813 |
msgid ""
|
816 |
"config.php."
|
817 |
msgstr ""
|
818 |
|
819 |
+
#: view/provider-select.php:121
|
820 |
msgctxt "joins multiple define keys in notice"
|
821 |
msgid " & "
|
822 |
msgstr ""
|
823 |
|
824 |
+
#: view/provider-select.php:130
|
825 |
msgid ""
|
826 |
"Please check your wp-config.php file as it looks like one of your access key "
|
827 |
"defines is missing or incorrect."
|
828 |
msgstr ""
|
829 |
|
830 |
+
#: view/provider-select.php:136
|
831 |
msgid ""
|
832 |
"Copy the following snippet <strong>near the top</strong> of your wp-config."
|
833 |
"php and replace the stars with the keys."
|
834 |
msgstr ""
|
835 |
|
836 |
+
#: view/provider-select.php:162
|
837 |
msgid "My server is on Amazon EC2 and I'd like to use IAM Roles"
|
838 |
msgstr ""
|
839 |
|
840 |
+
#: view/provider-select.php:169
|
841 |
#, php-format
|
842 |
msgid ""
|
843 |
"You've defined the '%1$s' constant in your wp-config.php. To select a "
|
845 |
"config.php."
|
846 |
msgstr ""
|
847 |
|
848 |
+
#: view/provider-select.php:172
|
849 |
msgid ""
|
850 |
"If you host your WordPress site on an Amazon EC2 instance you should make "
|
851 |
"use of IAM Roles. To tell WP Offload Media you're using IAM Roles, copy the "
|
852 |
"following snippet <strong>near the top</strong> of your wp-config.php."
|
853 |
msgstr ""
|
854 |
|
855 |
+
#: view/provider-select.php:194
|
856 |
msgid ""
|
857 |
"I understand the risks but I'd like to store access keys in the database "
|
858 |
"anyway (not recommended)"
|
859 |
msgstr ""
|
860 |
|
861 |
+
#: view/provider-select.php:201
|
862 |
msgid ""
|
863 |
"Storing your access keys in the database is less secure than the options "
|
864 |
"above, but if you're ok with that, go ahead and enter your keys in the form "
|
865 |
"below."
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: view/provider-select.php:206
|
869 |
msgid "Access Key ID"
|
870 |
msgstr ""
|
871 |
|
872 |
+
#: view/provider-select.php:221
|
873 |
msgid "Secret Access Key"
|
874 |
msgstr ""
|
875 |
|
876 |
+
#: view/provider-select.php:243
|
877 |
+
msgid "Next"
|
878 |
+
msgstr ""
|
879 |
+
|
880 |
+
#: view/provider-select.php:243
|
881 |
+
#: view/settings/media.php:261
|
882 |
+
msgid "Save Changes"
|
883 |
+
msgstr ""
|
884 |
+
|
885 |
#: view/provider-setting.php:6
|
886 |
msgid "Provider:"
|
887 |
msgstr ""
|
894 |
"\">deliciousbrains.com</a> to purchase in just a few clicks."
|
895 |
msgstr ""
|
896 |
|
897 |
+
#: view/settings/media.php:76
|
898 |
#, php-format
|
899 |
msgid ""
|
900 |
"Yikes! That's not a very SEO-friendly URL. We strongly recommend you "
|
902 |
"point at your CDN. %2$s"
|
903 |
msgstr ""
|
904 |
|
905 |
+
#: view/settings/media.php:92
|
906 |
msgid "Storage"
|
907 |
msgstr ""
|
908 |
|
909 |
+
#: view/settings/media.php:120
|
910 |
msgid "Copy Files to Bucket"
|
911 |
msgstr ""
|
912 |
|
913 |
+
#: view/settings/media.php:122
|
914 |
msgid "When a file is uploaded to the Media Library, copy it to the bucket."
|
915 |
msgstr ""
|
916 |
|
917 |
+
#: view/settings/media.php:137
|
918 |
msgid "Path"
|
919 |
msgstr ""
|
920 |
|
921 |
+
#: view/settings/media.php:139
|
922 |
msgid "By default the path is the same as your local WordPress files."
|
923 |
msgstr ""
|
924 |
|
925 |
+
#: view/settings/media.php:157
|
926 |
msgid "Year/Month"
|
927 |
msgstr ""
|
928 |
|
929 |
+
#: view/settings/media.php:159
|
930 |
msgid ""
|
931 |
"Add the Year/Month to the end of the path above just like WordPress does by "
|
932 |
"default."
|
933 |
msgstr ""
|
934 |
|
935 |
+
#: view/settings/media.php:172
|
936 |
msgid "Object Versioning"
|
937 |
msgstr ""
|
938 |
|
939 |
+
#: view/settings/media.php:174
|
940 |
msgid ""
|
941 |
"Append a timestamp to the file's bucket path. Recommended when using a CDN "
|
942 |
"so you don't have to worry about cache invalidation."
|
943 |
msgstr ""
|
944 |
|
945 |
+
#: view/settings/media.php:182
|
946 |
msgid "URL Rewriting"
|
947 |
msgstr ""
|
948 |
|
949 |
+
#: view/settings/media.php:192
|
950 |
msgid "Rewrite Media URLs"
|
951 |
msgstr ""
|
952 |
|
953 |
+
#: view/settings/media.php:194
|
954 |
msgid ""
|
955 |
"For Media Library files that have been copied to your bucket, rewrite the "
|
956 |
"URLs so that they are served from the bucket or CDN instead of your server."
|
957 |
msgstr ""
|
958 |
|
959 |
+
#: view/settings/media.php:210
|
960 |
msgid "Force HTTPS"
|
961 |
msgstr ""
|
962 |
|
963 |
+
#: view/settings/media.php:212
|
964 |
msgid ""
|
965 |
"By default we use HTTPS when the request is HTTPS and regular HTTP when the "
|
966 |
"request is HTTP, but you may want to force the use of HTTPS always, "
|
967 |
"regardless of the request."
|
968 |
msgstr ""
|
969 |
|
970 |
+
#: view/settings/media.php:220
|
971 |
msgid "Advanced Options"
|
972 |
msgstr ""
|
973 |
|
974 |
+
#: view/settings/media.php:230
|
975 |
msgid "Remove Files From Server"
|
976 |
msgstr ""
|
977 |
|
978 |
+
#: view/settings/media.php:231
|
979 |
msgid ""
|
980 |
"Once a file has been copied to the bucket, remove it from the local server."
|
981 |
msgstr ""
|
982 |
|
983 |
+
#: view/settings/media.php:235
|
984 |
msgid ""
|
985 |
"<strong>Broken URLs</strong> — There will be broken URLs for files "
|
986 |
"that don't exist locally. You can fix this by enabling <strong>Rewrite Media "
|
987 |
"URLs</strong> to use the offloaded media."
|
988 |
msgstr ""
|
989 |
|
990 |
+
#: view/settings/media.php:246
|
991 |
#, php-format
|
992 |
msgid ""
|
993 |
"<strong>Warning</strong> — Some plugins depend on the file being "
|
994 |
"present on the local server and may not work when the file is removed. %s"
|
995 |
msgstr ""
|
996 |
|
997 |
+
#: view/settings/media.php:273
|
|
|
|
|
|
|
|
|
998 |
#, php-format
|
999 |
msgid ""
|
1000 |
"Need help getting your Access Keys? <a href=\"%s\">Check out the Quick Start "
|
readme.txt
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:
|
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
|
@@ -76,8 +78,16 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= WP Offload Media Lite 2.0 - 2018-09-24 =
|
80 |
-
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-
|
81 |
* New: DigitalOcean Spaces is now supported
|
82 |
* New: Plugin name updated from WP Offload S3 Lite to WP Offload Media Lite
|
83 |
* 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
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= WP Offload Media Lite 2.0.1 - 2018-12-17 =
|
82 |
+
* Improvement: Streamlined UI for setting Storage Provider and Bucket
|
83 |
+
* Bug fix: On/Off switches in settings look reversed
|
84 |
+
* Bug fix: Latest upgrade routine runs on fresh install
|
85 |
+
* Bug fix: Defined settings still found in database
|
86 |
+
* Bug fix: More Info links in Storage Provider settings incorrect
|
87 |
+
* Tested: WordPress 5.0
|
88 |
+
|
89 |
= WP Offload Media Lite 2.0 - 2018-09-24 =
|
90 |
+
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-s3-is-now-wp-offload-media-and-adds-support-for-digitalocean-spaces/)
|
91 |
* New: DigitalOcean Spaces is now supported
|
92 |
* New: Plugin name updated from WP Offload S3 Lite to WP Offload Media Lite
|
93 |
* Improvement: More logical UI layout and better description of each setting
|
view/bucket-select.php
CHANGED
@@ -3,12 +3,37 @@
|
|
3 |
$provider = $this->get_provider();
|
4 |
$provider_regions = $provider->get_regions();
|
5 |
$region_required = $provider->region_required();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
?>
|
7 |
|
8 |
<div class="as3cf-bucket-container <?php echo $prefix; ?>">
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<table class="form-table">
|
13 |
<?php
|
14 |
$this->render_view( 'provider-setting',
|
@@ -47,81 +72,75 @@ $region_required = $provider->region_required();
|
|
47 |
</td>
|
48 |
<td>
|
49 |
<input type="text" id="<?php echo $prefix; ?>-bucket-manual-name" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Existing bucket name', 'amazon-s3-and-cloudfront' ); ?>" value="<?php echo $selected_bucket; ?>">
|
|
|
50 |
</td>
|
51 |
</tr>
|
52 |
</table>
|
53 |
<p class="bucket-actions actions manual">
|
54 |
-
<button id="<?php echo $prefix; ?>-bucket-manual-save" type="submit" class="bucket-action-save button button-primary"
|
55 |
-
<span><a href="
|
56 |
-
<span><a href="
|
57 |
-
</p>
|
58 |
-
<p class="bucket-actions actions select">
|
59 |
-
<button id="<?php echo $prefix; ?>-bucket-select-save" type="submit" class="bucket-action-save button button-primary" data-working="<?php _e( 'Saving...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Save Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
|
60 |
-
<span><a href="#" class="bucket-action-cancel"><?php _e( 'Cancel', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
61 |
</p>
|
62 |
-
</
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
<table class="form-table">
|
67 |
-
<?php
|
68 |
-
$this->render_view( 'provider-setting',
|
69 |
-
array(
|
70 |
-
'prefix' => $prefix,
|
71 |
-
'tr_class' => "{$prefix}-provider-setting",
|
72 |
-
)
|
73 |
-
);
|
74 |
-
?>
|
75 |
-
</table>
|
76 |
-
<?php if ( defined( 'AS3CF_REGION' ) || false !== $this->get_defined_setting( 'region', false ) || true === $region_required ) { ?>
|
77 |
<table class="form-table">
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
<?php foreach ( $provider_regions as $value => $label ) {
|
87 |
-
$selected = ( $value === $selected_region ) ? ' selected="selected"' : '';
|
88 |
-
?>
|
89 |
-
<option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php echo $label; ?></option>
|
90 |
-
<?php } ?>
|
91 |
-
</select>
|
92 |
-
<?php } else {
|
93 |
-
$region = defined( 'AS3CF_REGION' ) ? AS3CF_REGION : $this->get_defined_setting( 'region' );
|
94 |
-
$region_name = isset( $provider_regions[ $region ] ) ? $provider_regions[ $region ] : $region;
|
95 |
-
printf( __( '%s (defined in wp-config.php)', 'amazon-s3-and-cloudfront' ), $region_name );
|
96 |
-
} ?>
|
97 |
-
</td>
|
98 |
-
</tr>
|
99 |
-
<tr>
|
100 |
-
<td>
|
101 |
-
<?php _e( 'Bucket:', 'amazon-s3-and-cloudfront' ); ?>
|
102 |
-
</td>
|
103 |
-
<td>
|
104 |
-
<ul class="as3cf-bucket-list" data-working="<?php _e( 'Loading...', 'amazon-s3-and-cloudfront' ); ?>" data-nothing-found="<?php _e( 'Nothing found', 'amazon-s3-and-cloudfront' ); ?>"></ul>
|
105 |
-
</td>
|
106 |
-
</tr>
|
107 |
</table>
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
<table class="form-table">
|
126 |
<?php
|
127 |
$this->render_view( 'provider-setting',
|
@@ -162,10 +181,11 @@ $region_required = $provider->region_required();
|
|
162 |
</td>
|
163 |
</tr>
|
164 |
</table>
|
165 |
-
<p class="bucket-actions actions">
|
166 |
-
<button id="<?php echo $prefix; ?>-bucket-create" type="submit" class="button button-primary"
|
167 |
-
<span><a href="
|
|
|
168 |
</p>
|
169 |
-
</
|
170 |
-
|
171 |
</div>
|
3 |
$provider = $this->get_provider();
|
4 |
$provider_regions = $provider->get_regions();
|
5 |
$region_required = $provider->region_required();
|
6 |
+
|
7 |
+
$bucket_mode = empty( $_GET['bucket_mode'] ) ? 'manual' : $_GET['bucket_mode'];
|
8 |
+
$bucket_mode = in_array( $bucket_mode, array( 'manual', 'select', 'create' ) ) ? $bucket_mode : 'manual';
|
9 |
+
|
10 |
+
$mode_args = array(
|
11 |
+
'action' => 'change-bucket',
|
12 |
+
);
|
13 |
+
|
14 |
+
if ( ! empty( $_GET['prev_action'] ) ) {
|
15 |
+
$mode_args['prev_action'] = $_GET['prev_action'];
|
16 |
+
}
|
17 |
+
|
18 |
+
$manual_mode = $this->get_plugin_page_url( array_merge( $mode_args, array( 'bucket_mode' => 'manual' ) ) );
|
19 |
+
$select_mode = $this->get_plugin_page_url( array_merge( $mode_args, array( 'bucket_mode' => 'select' ) ) );
|
20 |
+
$create_mode = $this->get_plugin_page_url( array_merge( $mode_args, array( 'bucket_mode' => 'create' ) ) );
|
21 |
?>
|
22 |
|
23 |
<div class="as3cf-bucket-container <?php echo $prefix; ?>">
|
24 |
+
<?php
|
25 |
+
if ( ! $this->get_setting( 'bucket' ) || ( ! empty( $_GET['action'] ) && 'change-bucket' === $_GET['action'] ) || ! empty( $_GET['prev_action'] ) ) {
|
26 |
+
$back_args = $this->get_setting( 'bucket' ) ? array() : array( 'action' => 'change-provider' );
|
27 |
+
if ( empty( $back_args['action'] ) && ! empty( $_GET['prev_action'] ) ) {
|
28 |
+
$back_args['action'] = $_GET['prev_action'];
|
29 |
+
}
|
30 |
+
echo '<a href="' . $this->get_plugin_page_url( $back_args ) . '">' . __( '« Back', 'amazon-s3-and-cloudfront' ) . '</a>';
|
31 |
+
}
|
32 |
+
|
33 |
+
if ( 'manual' === $bucket_mode ) {
|
34 |
+
?>
|
35 |
+
<div class="as3cf-bucket-manual">
|
36 |
+
<h3><?php _e( 'What bucket would you like to use?', 'amazon-s3-and-cloudfront' ); ?></h3>
|
37 |
<table class="form-table">
|
38 |
<?php
|
39 |
$this->render_view( 'provider-setting',
|
72 |
</td>
|
73 |
<td>
|
74 |
<input type="text" id="<?php echo $prefix; ?>-bucket-manual-name" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Existing bucket name', 'amazon-s3-and-cloudfront' ); ?>" value="<?php echo $selected_bucket; ?>">
|
75 |
+
<p class="as3cf-invalid-bucket-name"></p>
|
76 |
</td>
|
77 |
</tr>
|
78 |
</table>
|
79 |
<p class="bucket-actions actions manual">
|
80 |
+
<button id="<?php echo $prefix; ?>-bucket-manual-save" type="submit" class="bucket-action-save button button-primary"><?php _e( 'Save Bucket Setting', 'amazon-s3-and-cloudfront' ); ?></button>
|
81 |
+
<span><a href="<?php echo $select_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-browse" class="bucket-action-browse"><?php _e( 'Browse existing buckets', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
82 |
+
<span><a href="<?php echo $create_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-create" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
|
|
|
|
|
|
|
|
83 |
</p>
|
84 |
+
</div>
|
85 |
+
<?php } elseif ( 'select' === $bucket_mode ) { ?>
|
86 |
+
<div class="as3cf-bucket-select">
|
87 |
+
<h3><?php _e( 'Select bucket', 'amazon-s3-and-cloudfront' ); ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
<table class="form-table">
|
89 |
+
<?php
|
90 |
+
$this->render_view( 'provider-setting',
|
91 |
+
array(
|
92 |
+
'prefix' => $prefix,
|
93 |
+
'tr_class' => "{$prefix}-provider-setting",
|
94 |
+
)
|
95 |
+
);
|
96 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
</table>
|
98 |
+
<?php if ( defined( 'AS3CF_REGION' ) || false !== $this->get_defined_setting( 'region', false ) || true === $region_required ) { ?>
|
99 |
+
<table class="form-table">
|
100 |
+
<tr>
|
101 |
+
<td>
|
102 |
+
<?php _e( 'Region:', 'amazon-s3-and-cloudfront' ); ?>
|
103 |
+
</td>
|
104 |
+
<td>
|
105 |
+
<?php
|
106 |
+
if ( ! defined( 'AS3CF_REGION' ) && false === $this->get_defined_setting( 'region', false ) ) { ?>
|
107 |
+
<select id="<?php echo $prefix; ?>-bucket-select-region" class="bucket-select-region" name="region_name">
|
108 |
+
<?php foreach ( $provider_regions as $value => $label ) {
|
109 |
+
$selected = ( $value === $selected_region ) ? ' selected="selected"' : '';
|
110 |
+
?>
|
111 |
+
<option value="<?php echo $value; ?>"<?php echo $selected; ?>><?php echo $label; ?></option>
|
112 |
+
<?php } ?>
|
113 |
+
</select>
|
114 |
+
<?php } else {
|
115 |
+
$region = defined( 'AS3CF_REGION' ) ? AS3CF_REGION : $this->get_defined_setting( 'region' );
|
116 |
+
$region_name = isset( $provider_regions[ $region ] ) ? $provider_regions[ $region ] : $region;
|
117 |
+
printf( __( '%s (defined in wp-config.php)', 'amazon-s3-and-cloudfront' ), $region_name );
|
118 |
+
} ?>
|
119 |
+
</td>
|
120 |
+
</tr>
|
121 |
+
<tr>
|
122 |
+
<td>
|
123 |
+
<?php _e( 'Bucket:', 'amazon-s3-and-cloudfront' ); ?>
|
124 |
+
</td>
|
125 |
+
<td>
|
126 |
+
<ul class="as3cf-bucket-list" data-working="<?php _e( 'Loading...', 'amazon-s3-and-cloudfront' ); ?>" data-nothing-found="<?php _e( 'Nothing found', 'amazon-s3-and-cloudfront' ); ?>"></ul>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</table>
|
130 |
+
<?php } else { ?>
|
131 |
+
<ul class="as3cf-bucket-list" data-working="<?php _e( 'Loading...', 'amazon-s3-and-cloudfront' ); ?>" data-nothing-found="<?php _e( 'Nothing found', 'amazon-s3-and-cloudfront' ); ?>"></ul>
|
132 |
+
<?php } ?>
|
133 |
+
<input id="<?php echo $prefix; ?>-bucket-select-name" type="hidden" class="no-compare" name="bucket_name" value="<?php echo esc_attr( $selected_bucket ); ?>">
|
134 |
+
<p class="bucket-actions actions select">
|
135 |
+
<button id="<?php echo $prefix; ?>-bucket-select-save" type="submit" class="bucket-action-save button button-primary"><?php _e( 'Save Selected Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
|
136 |
+
<span><a href="<?php echo $manual_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-manual" class="bucket-action-manual"><?php _e( 'Enter bucket name', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
137 |
+
<span><a href="<?php echo $create_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-create" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
138 |
+
<span><a href="#" class="bucket-action-refresh"><?php _e( 'Refresh', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
139 |
+
</p>
|
140 |
+
</div>
|
141 |
+
<?php } elseif ( 'create' === $bucket_mode ) { ?>
|
142 |
+
<div class="as3cf-bucket-create">
|
143 |
+
<h3><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></h3>
|
144 |
<table class="form-table">
|
145 |
<?php
|
146 |
$this->render_view( 'provider-setting',
|
181 |
</td>
|
182 |
</tr>
|
183 |
</table>
|
184 |
+
<p class="bucket-actions actions create">
|
185 |
+
<button id="<?php echo $prefix; ?>-bucket-create" type="submit" class="button button-primary"><?php _e( 'Create New Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
|
186 |
+
<span><a href="<?php echo $select_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-browse" class="bucket-action-browse"><?php _e( 'Browse existing buckets', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
187 |
+
<span><a href="<?php echo $manual_mode; ?>" id="<?php echo $prefix; ?>-bucket-action-manual" class="bucket-action-manual"><?php _e( 'Enter bucket name', 'amazon-s3-and-cloudfront' ); ?></a></span>
|
188 |
</p>
|
189 |
+
</div>
|
190 |
+
<?php } ?>
|
191 |
</div>
|
view/bucket-setting.php
CHANGED
@@ -16,7 +16,7 @@ $tr_class = ( isset( $tr_class ) ) ? $tr_class : '';
|
|
16 |
<?php if ( defined( $constant_bucket ) || false !== $this->get_defined_setting( 'bucket', false ) ) {
|
17 |
echo '<span class="as3cf-defined-in-config">' . __( 'defined in wp-config.php', 'amazon-s3-and-cloudfront' ) . '</span>';
|
18 |
} elseif ( ! $needs_keys ) { ?>
|
19 |
-
<a href="
|
20 |
<?php } ?>
|
21 |
|
22 |
<p id="<?php echo $prefix; ?>-active-region" class="as3cf-active-region" title="<?php _e( 'The region that the bucket is in.', 'amazon-s3-and-cloudfront' ); ?>">
|
16 |
<?php if ( defined( $constant_bucket ) || false !== $this->get_defined_setting( 'bucket', false ) ) {
|
17 |
echo '<span class="as3cf-defined-in-config">' . __( 'defined in wp-config.php', 'amazon-s3-and-cloudfront' ) . '</span>';
|
18 |
} elseif ( ! $needs_keys ) { ?>
|
19 |
+
<a href="<?php echo $this->get_plugin_page_url( array( 'action' => 'change-bucket' ) ); ?>" id="<?php echo $prefix; ?>-change-bucket" class="as3cf-change-bucket"><?php _e( 'Change', 'amazon-s3-and-cloudfront' ); ?></a>
|
20 |
<?php } ?>
|
21 |
|
22 |
<p id="<?php echo $prefix; ?>-active-region" class="as3cf-active-region" title="<?php _e( 'The region that the bucket is in.', 'amazon-s3-and-cloudfront' ); ?>">
|
view/checkbox.php
CHANGED
@@ -6,8 +6,8 @@ $values = ( isset( $values ) && is_array( $values ) && 2 === count( $values )
|
|
6 |
$prefix = $this->get_plugin_prefix_slug();
|
7 |
?>
|
8 |
<div id="<?php echo $prefix . '-' . $key; ?>-wrap" data-checkbox="<?php echo $prefix . '-' . $key; ?>" class="as3cf-switch<?php echo $disabled . ( $value == $values[1] ? ' on' : '' ); ?>">
|
9 |
-
<span class="on <?php echo $value == $values[1] ? 'checked' : ''; ?>">ON</span>
|
10 |
<span class="off <?php echo $value == $values[0] ? 'checked' : ''; ?>">OFF</span>
|
11 |
-
<
|
|
|
12 |
<input type="checkbox" name="<?php echo $key; ?>" value="<?php echo $values[1]; ?>" id="<?php echo $prefix . '-' . $key; ?>" <?php echo $value == $values[1] ? 'checked="checked" ' : ''; ?> <?php echo $class ?>/>
|
13 |
</div>
|
6 |
$prefix = $this->get_plugin_prefix_slug();
|
7 |
?>
|
8 |
<div id="<?php echo $prefix . '-' . $key; ?>-wrap" data-checkbox="<?php echo $prefix . '-' . $key; ?>" class="as3cf-switch<?php echo $disabled . ( $value == $values[1] ? ' on' : '' ); ?>">
|
|
|
9 |
<span class="off <?php echo $value == $values[0] ? 'checked' : ''; ?>">OFF</span>
|
10 |
+
<span class="on <?php echo $value == $values[1] ? 'checked' : ''; ?>">ON</span>
|
11 |
+
<input type="hidden" name="<?php echo $key; ?>" value="<?php echo $values[0]; ?>"/>
|
12 |
<input type="checkbox" name="<?php echo $key; ?>" value="<?php echo $values[1]; ?>" id="<?php echo $prefix . '-' . $key; ?>" <?php echo $value == $values[1] ? 'checked="checked" ' : ''; ?> <?php echo $class ?>/>
|
13 |
</div>
|
view/provider-select.php
CHANGED
@@ -10,7 +10,7 @@ $providers = $this->get_provider_classes();
|
|
10 |
|
11 |
<div class="as3cf-content as3cf-provider-select">
|
12 |
<?php
|
13 |
-
if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) {
|
14 |
echo '<a href="' . $this->get_plugin_page_url() . '">' . __( '« Back', 'amazon-s3-and-cloudfront' ) . '</a>';
|
15 |
}
|
16 |
?>
|
@@ -20,6 +20,7 @@ $providers = $this->get_provider_classes();
|
|
20 |
<?php
|
21 |
/* @var \DeliciousBrains\WP_Offload_Media\Providers\Provider $provider_class */
|
22 |
foreach ( $providers as $provider_key => $provider_class ) {
|
|
|
23 |
$provider = new $provider_class( $this );
|
24 |
$provider_selected = $provider_key === $current_provider->get_provider_key_name();
|
25 |
$provider_selected_class = $provider_selected ? ' as3cf-provider-selected' : '';
|
@@ -65,6 +66,8 @@ $providers = $this->get_provider_classes();
|
|
65 |
$db_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
|
66 |
break;
|
67 |
}
|
|
|
|
|
68 |
?>
|
69 |
<tr class="as3cf-provider-title as3cf-provider-<?php echo $provider_key; ?><?php echo $provider_selected_class; ?>">
|
70 |
<td>
|
@@ -101,7 +104,9 @@ $providers = $this->get_provider_classes();
|
|
101 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-define" value="define"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
102 |
echo $define_authmethod_attr; ?>>
|
103 |
</th>
|
104 |
-
<td
|
|
|
|
|
105 |
</tr>
|
106 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="define"<?php echo 'define' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
107 |
<td></td>
|
@@ -116,7 +121,7 @@ $providers = $this->get_provider_classes();
|
|
116 |
$multiple_defined_keys_glue = _x( ' & ', 'joins multiple define keys in notice', 'amazon-s3-and-cloudfront' );
|
117 |
$defined_constants_str = join( $multiple_defined_keys_glue, $defined_constants );
|
118 |
printf( $remove_defines_msg, $defined_constants_str );
|
119 |
-
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/
|
120 |
|
121 |
if ( $provider_selected && ! $provider->are_access_keys_set() ) {
|
122 |
?>
|
@@ -129,7 +134,7 @@ $providers = $this->get_provider_classes();
|
|
129 |
}
|
130 |
} else {
|
131 |
_e( 'Copy the following snippet <strong>near the top</strong> of your wp-config.php and replace the stars with the keys.', 'amazon-s3-and-cloudfront' );
|
132 |
-
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/
|
133 |
?>
|
134 |
<textarea rows="5" class="as3cf-define-snippet code clear" readonly>
|
135 |
define( 'AS3CF_SETTINGS', serialize( array(
|
@@ -153,18 +158,19 @@ define( 'AS3CF_SETTINGS', serialize( array(
|
|
153 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-server-role" value="server-role"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
154 |
echo $server_role_authmethod_attr; ?>>
|
155 |
</th>
|
156 |
-
<td
|
|
|
|
|
157 |
</tr>
|
158 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="server-role"<?php echo 'server-role' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
159 |
<td></td>
|
160 |
<td>
|
161 |
<?php if ( $provider_class::use_server_roles() ) {
|
162 |
printf( __( 'You\'ve defined the \'%1$s\' constant in your wp-config.php. To select a different option here, simply comment out or remove the define in your wp-config.php.' ), $use_server_role_constant );
|
163 |
-
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/
|
164 |
-
|
165 |
} else {
|
166 |
_e( 'If you host your WordPress site on an Amazon EC2 instance you should make use of IAM Roles. To tell WP Offload Media you\'re using IAM Roles, copy the following snippet <strong>near the top</strong> of your wp-config.php.', 'amazon-s3-and-cloudfront' );
|
167 |
-
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/
|
168 |
?>
|
169 |
<textarea rows="1" class="as3cf-define-snippet code clear" readonly>
|
170 |
define( 'AS3CF_AWS_USE_EC2_IAM_ROLE', true );
|
@@ -184,14 +190,16 @@ define( 'AS3CF_AWS_USE_EC2_IAM_ROLE', true );
|
|
184 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-db" value="db"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
185 |
echo $db_authmethod_attr; ?>>
|
186 |
</th>
|
187 |
-
<td
|
|
|
|
|
188 |
</tr>
|
189 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="db"<?php echo 'db' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
190 |
<td></td>
|
191 |
<td>
|
192 |
<?php
|
193 |
_e( 'Storing your access keys in the database is less secure than the options above, but if you\'re ok with that, go ahead and enter your keys in the form below.', 'amazon-s3-and-cloudfront' );
|
194 |
-
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/
|
195 |
?>
|
196 |
<table class="form-table as3cf-access-keys">
|
197 |
<tr valign="top">
|
@@ -231,4 +239,7 @@ define( 'AS3CF_AWS_USE_EC2_IAM_ROLE', true );
|
|
231 |
</tr>
|
232 |
<?php } // Providers ?>
|
233 |
</table>
|
|
|
|
|
|
|
234 |
</div>
|
10 |
|
11 |
<div class="as3cf-content as3cf-provider-select">
|
12 |
<?php
|
13 |
+
if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] && $this->get_setting( 'bucket' ) && ! empty( $can_write ) ) {
|
14 |
echo '<a href="' . $this->get_plugin_page_url() . '">' . __( '« Back', 'amazon-s3-and-cloudfront' ) . '</a>';
|
15 |
}
|
16 |
?>
|
20 |
<?php
|
21 |
/* @var \DeliciousBrains\WP_Offload_Media\Providers\Provider $provider_class */
|
22 |
foreach ( $providers as $provider_key => $provider_class ) {
|
23 |
+
/* @var \DeliciousBrains\WP_Offload_Media\Providers\Provider $provider */
|
24 |
$provider = new $provider_class( $this );
|
25 |
$provider_selected = $provider_key === $current_provider->get_provider_key_name();
|
26 |
$provider_selected_class = $provider_selected ? ' as3cf-provider-selected' : '';
|
66 |
$db_authmethod_attr = $provider_selected ? ' checked="checked"' : '';
|
67 |
break;
|
68 |
}
|
69 |
+
|
70 |
+
$provider_service_quick_start_slug = $provider_class::get_provider_service_quick_start_slug();
|
71 |
?>
|
72 |
<tr class="as3cf-provider-title as3cf-provider-<?php echo $provider_key; ?><?php echo $provider_selected_class; ?>">
|
73 |
<td>
|
104 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-define" value="define"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
105 |
echo $define_authmethod_attr; ?>>
|
106 |
</th>
|
107 |
+
<td>
|
108 |
+
<label for="as3cf-provider-<?php echo $provider_key; ?>-define"><?php _e( 'Define access keys in wp-config.php', 'amazon-s3-and-cloudfront' ) ?></label>
|
109 |
+
</td>
|
110 |
</tr>
|
111 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="define"<?php echo 'define' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
112 |
<td></td>
|
121 |
$multiple_defined_keys_glue = _x( ' & ', 'joins multiple define keys in notice', 'amazon-s3-and-cloudfront' );
|
122 |
$defined_constants_str = join( $multiple_defined_keys_glue, $defined_constants );
|
123 |
printf( $remove_defines_msg, $defined_constants_str );
|
124 |
+
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
|
125 |
|
126 |
if ( $provider_selected && ! $provider->are_access_keys_set() ) {
|
127 |
?>
|
134 |
}
|
135 |
} else {
|
136 |
_e( 'Copy the following snippet <strong>near the top</strong> of your wp-config.php and replace the stars with the keys.', 'amazon-s3-and-cloudfront' );
|
137 |
+
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
|
138 |
?>
|
139 |
<textarea rows="5" class="as3cf-define-snippet code clear" readonly>
|
140 |
define( 'AS3CF_SETTINGS', serialize( array(
|
158 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-server-role" value="server-role"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
159 |
echo $server_role_authmethod_attr; ?>>
|
160 |
</th>
|
161 |
+
<td>
|
162 |
+
<label for="as3cf-provider-<?php echo $provider_key; ?>-server-role"><?php _e( 'My server is on Amazon EC2 and I\'d like to use IAM Roles', 'amazon-s3-and-cloudfront' ) ?></label>
|
163 |
+
</td>
|
164 |
</tr>
|
165 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="server-role"<?php echo 'server-role' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
166 |
<td></td>
|
167 |
<td>
|
168 |
<?php if ( $provider_class::use_server_roles() ) {
|
169 |
printf( __( 'You\'ve defined the \'%1$s\' constant in your wp-config.php. To select a different option here, simply comment out or remove the define in your wp-config.php.' ), $use_server_role_constant );
|
170 |
+
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
|
|
|
171 |
} else {
|
172 |
_e( 'If you host your WordPress site on an Amazon EC2 instance you should make use of IAM Roles. To tell WP Offload Media you\'re using IAM Roles, copy the following snippet <strong>near the top</strong> of your wp-config.php.', 'amazon-s3-and-cloudfront' );
|
173 |
+
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
|
174 |
?>
|
175 |
<textarea rows="1" class="as3cf-define-snippet code clear" readonly>
|
176 |
define( 'AS3CF_AWS_USE_EC2_IAM_ROLE', true );
|
190 |
<input type="radio" name="authmethod" id="as3cf-provider-<?php echo $provider_key; ?>-db" value="db"<?php echo $provider_selected ? '' : ' disabled="disabled"';
|
191 |
echo $db_authmethod_attr; ?>>
|
192 |
</th>
|
193 |
+
<td>
|
194 |
+
<label for="as3cf-provider-<?php echo $provider_key; ?>-db"><?php _e( 'I understand the risks but I\'d like to store access keys in the database anyway (not recommended)', 'amazon-s3-and-cloudfront' ) ?></label>
|
195 |
+
</td>
|
196 |
</tr>
|
197 |
<tr class="asc3f-provider-authmethod-content" data-provider-authmethod="db"<?php echo 'db' !== $selected_authmethod ? ' style="display: none"' : ''; ?>>
|
198 |
<td></td>
|
199 |
<td>
|
200 |
<?php
|
201 |
_e( 'Storing your access keys in the database is less secure than the options above, but if you\'re ok with that, go ahead and enter your keys in the form below.', 'amazon-s3-and-cloudfront' );
|
202 |
+
echo ' ' . $this->more_info_link( '/wp-offload-media/doc/' . $provider_service_quick_start_slug . '/#save-access-keys' );
|
203 |
?>
|
204 |
<table class="form-table as3cf-access-keys">
|
205 |
<tr valign="top">
|
239 |
</tr>
|
240 |
<?php } // Providers ?>
|
241 |
</table>
|
242 |
+
<p>
|
243 |
+
<button type="submit" class="button button-primary"><?php echo empty( $this->get_defined_setting( 'bucket', false ) ) ? __( 'Next', 'amazon-s3-and-cloudfront' ) : __( 'Save Changes', 'amazon-s3-and-cloudfront' ); ?></button>
|
244 |
+
</p>
|
245 |
</div>
|
view/settings/media.php
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
/* @var \Amazon_S3_And_CloudFront|\Amazon_S3_And_CloudFront_Pro $this */
|
3 |
$prefix = $this->get_plugin_prefix_slug();
|
4 |
$selected_provider = $this->get_setting( 'provider', static::$default_provider );
|
@@ -6,12 +8,27 @@ $selected_region = $this->get_setting( 'region' );
|
|
6 |
$selected_bucket = $this->get_setting( 'bucket' );
|
7 |
$selected_bucket_prefix = $this->get_object_prefix();
|
8 |
|
9 |
-
|
10 |
-
$storage_classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) {
|
13 |
$storage_classes .= ' as3cf-change-provider';
|
14 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
?>
|
16 |
<div id="tab-media" data-prefix="as3cf" class="as3cf-tab as3cf-content<?php echo $storage_classes; // xss ok ?>">
|
17 |
<div class="error inline as3cf-bucket-error as3cf-error" style="display: none;">
|
@@ -21,18 +38,24 @@ if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) {
|
|
21 |
</p>
|
22 |
</div>
|
23 |
|
24 |
-
<?php
|
25 |
-
|
|
|
|
|
26 |
|
27 |
<div class="as3cf-main-settings">
|
28 |
<form method="post">
|
29 |
-
<input type="hidden" name="action" value="save"
|
30 |
-
<input type="hidden" name="plugin" value="<?php echo $this->get_plugin_slug(); ?>"
|
31 |
<?php
|
32 |
wp_nonce_field( $this->get_settings_nonce_key() );
|
33 |
do_action( 'as3cf_form_hidden_fields' );
|
34 |
|
35 |
-
$this->render_view( 'provider-select' );
|
|
|
|
|
|
|
|
|
36 |
?>
|
37 |
|
38 |
<table class="form-table as3cf-media-settings">
|
@@ -231,16 +254,18 @@ if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) {
|
|
231 |
$this->render_view( 'notice', $remove_local_args ); ?>
|
232 |
</td>
|
233 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
</table>
|
235 |
-
<p>
|
236 |
-
<button type="submit" class="button button-primary" <?php echo $this->maybe_disable_save_button(); ?>><?php _e( 'Save Changes', 'amazon-s3-and-cloudfront' ); ?></button>
|
237 |
-
</p>
|
238 |
</form>
|
239 |
</div>
|
240 |
|
241 |
<?php
|
242 |
-
$this->render_view( 'bucket-select', array( 'prefix' => $prefix, 'selected_provider' => $selected_provider, 'selected_region' => $selected_region, 'selected_bucket' => $selected_bucket ) );
|
243 |
-
|
244 |
if ( $this->get_provider()->needs_access_keys() ) {
|
245 |
?>
|
246 |
<p class="as3cf-need-help">
|
1 |
<?php
|
2 |
+
// TODO: Update SASS to enable modals/copy-buckets view output when relevant.
|
3 |
+
|
4 |
/* @var \Amazon_S3_And_CloudFront|\Amazon_S3_And_CloudFront_Pro $this */
|
5 |
$prefix = $this->get_plugin_prefix_slug();
|
6 |
$selected_provider = $this->get_setting( 'provider', static::$default_provider );
|
8 |
$selected_bucket = $this->get_setting( 'bucket' );
|
9 |
$selected_bucket_prefix = $this->get_object_prefix();
|
10 |
|
11 |
+
if ( $this->get_provider()->needs_access_keys() ) {
|
12 |
+
$storage_classes = ' as3cf-needs-access-keys';
|
13 |
+
} else {
|
14 |
+
$storage_classes = ' as3cf-has-access-keys';
|
15 |
+
}
|
16 |
+
|
17 |
+
if ( $selected_bucket ) {
|
18 |
+
$storage_classes .= ' as3cf-has-bucket';
|
19 |
+
} else {
|
20 |
+
$storage_classes .= ' as3cf-needs-bucket';
|
21 |
+
}
|
22 |
|
23 |
if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] ) {
|
24 |
$storage_classes .= ' as3cf-change-provider';
|
25 |
}
|
26 |
+
|
27 |
+
if ( ! empty( $_GET['action'] ) && 'change-bucket' === $_GET['action'] ) {
|
28 |
+
$storage_classes .= ' as3cf-change-bucket';
|
29 |
+
}
|
30 |
+
|
31 |
+
$storage_classes = apply_filters( 'as3cf_media_tab_storage_classes', $storage_classes );
|
32 |
?>
|
33 |
<div id="tab-media" data-prefix="as3cf" class="as3cf-tab as3cf-content<?php echo $storage_classes; // xss ok ?>">
|
34 |
<div class="error inline as3cf-bucket-error as3cf-error" style="display: none;">
|
38 |
</p>
|
39 |
</div>
|
40 |
|
41 |
+
<?php
|
42 |
+
do_action( 'as3cf_pre_tab_render', 'media' );
|
43 |
+
$can_write = $this->render_bucket_permission_errors();
|
44 |
+
?>
|
45 |
|
46 |
<div class="as3cf-main-settings">
|
47 |
<form method="post">
|
48 |
+
<input type="hidden" name="action" value="save"/>
|
49 |
+
<input type="hidden" name="plugin" value="<?php echo $this->get_plugin_slug(); ?>"/>
|
50 |
<?php
|
51 |
wp_nonce_field( $this->get_settings_nonce_key() );
|
52 |
do_action( 'as3cf_form_hidden_fields' );
|
53 |
|
54 |
+
$this->render_view( 'provider-select', compact( 'can_write' ) );
|
55 |
+
|
56 |
+
$this->render_view( 'bucket-select', array( 'prefix' => $prefix, 'selected_provider' => $selected_provider, 'selected_region' => $selected_region, 'selected_bucket' => $selected_bucket ) );
|
57 |
+
|
58 |
+
do_action( 'as3cf_pre_media_settings' );
|
59 |
?>
|
60 |
|
61 |
<table class="form-table as3cf-media-settings">
|
254 |
$this->render_view( 'notice', $remove_local_args ); ?>
|
255 |
</td>
|
256 |
</tr>
|
257 |
+
|
258 |
+
<!-- Save button for main settings -->
|
259 |
+
<tr>
|
260 |
+
<td colspan="2">
|
261 |
+
<button type="submit" class="button button-primary" <?php echo $this->maybe_disable_save_button(); ?>><?php _e( 'Save Changes', 'amazon-s3-and-cloudfront' ); ?></button>
|
262 |
+
</td>
|
263 |
+
</tr>
|
264 |
</table>
|
|
|
|
|
|
|
265 |
</form>
|
266 |
</div>
|
267 |
|
268 |
<?php
|
|
|
|
|
269 |
if ( $this->get_provider()->needs_access_keys() ) {
|
270 |
?>
|
271 |
<p class="as3cf-need-help">
|
wordpress-s3.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Offload Media Lite
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
|
5 |
Description: Automatically copies media uploads to Amazon S3 or DigitalOcean Spaces for storage and delivery. Optionally configure Amazon CloudFront or another CDN for even faster delivery.
|
6 |
Author: Delicious Brains
|
7 |
-
Version: 2.0
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-s3-and-cloudfront
|
@@ -26,7 +26,7 @@ Domain Path: /languages/
|
|
26 |
// Then completely rewritten.
|
27 |
*/
|
28 |
|
29 |
-
$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.0';
|
30 |
|
31 |
require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';
|
32 |
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
|
5 |
Description: Automatically copies media uploads to Amazon S3 or DigitalOcean Spaces for storage and delivery. Optionally configure Amazon CloudFront or another CDN for even faster delivery.
|
6 |
Author: Delicious Brains
|
7 |
+
Version: 2.0.1
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-s3-and-cloudfront
|
26 |
// Then completely rewritten.
|
27 |
*/
|
28 |
|
29 |
+
$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '2.0.1';
|
30 |
|
31 |
require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';
|
32 |
|