Version Description
- 2017-11-20 =
- Improvement: Compatibility with WordPress 4.9
- Improvement: Compatibility with WP Offload S3 1.5.1
- Bug fix: Reveal access keys form option shown when keys partially defined
- Bug fix: WP_Error being passed to AWS methods
- Bug fix: "More info" links can be broken across two lines
Download this release
Release Info
Developer | deliciousbrains |
Plugin | Amazon Web Services |
Version | 1.0.4 |
Comparing to | |
See all releases |
Code changes from version 1.0.3 to 1.0.4
- README.md +9 -2
- amazon-web-services.php +4 -4
- assets/css/styles.css +1 -1
- assets/img/{icon-assets.svg → icon-assets-pull.svg} +0 -0
- assets/sass/styles.scss +1 -1
- classes/amazon-web-services.php +46 -19
- classes/aws-plugin-base.php +72 -10
- classes/wp-aws-compatibility-check.php +2 -2
- languages/amazon-web-services-en.pot +39 -24
- readme.txt +9 -2
- view/settings.php +24 -6
README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
**Contributors:** bradt, deliciousbrains
|
3 |
**Tags:** amazon, amazon web services
|
4 |
**Requires at least:** 4.6
|
5 |
-
**Tested up to:** 4.
|
6 |
-
**Stable tag:** 1.0.
|
7 |
**License:** GPLv3
|
8 |
|
9 |
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
|
@@ -35,6 +35,13 @@ This plugin is required by other plugins, which use its libraries and its settin
|
|
35 |
|
36 |
## Changelog ##
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
### 1.0.3 - 2017-06-19 ###
|
39 |
* Improvement: Compatibility with WP Offload S3 1.5
|
40 |
|
2 |
**Contributors:** bradt, deliciousbrains
|
3 |
**Tags:** amazon, amazon web services
|
4 |
**Requires at least:** 4.6
|
5 |
+
**Tested up to:** 4.9
|
6 |
+
**Stable tag:** 1.0.4
|
7 |
**License:** GPLv3
|
8 |
|
9 |
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
|
35 |
|
36 |
## Changelog ##
|
37 |
|
38 |
+
### 1.0.4 - 2017-11-20 ###
|
39 |
+
* Improvement: Compatibility with WordPress 4.9
|
40 |
+
* Improvement: Compatibility with WP Offload S3 1.5.1
|
41 |
+
* Bug fix: Reveal access keys form option shown when keys partially defined
|
42 |
+
* Bug fix: WP_Error being passed to AWS methods
|
43 |
+
* Bug fix: "More info" links can be broken across two lines
|
44 |
+
|
45 |
### 1.0.3 - 2017-06-19 ###
|
46 |
* Improvement: Compatibility with WP Offload S3 1.5
|
47 |
|
amazon-web-services.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Amazon Web Services
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/
|
5 |
Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it.
|
6 |
Author: Delicious Brains
|
7 |
-
Version: 1.0.
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-web-services
|
@@ -22,11 +22,11 @@ Domain Path: /languages/
|
|
22 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
23 |
// **********************************************************************
|
24 |
|
25 |
-
$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.
|
26 |
|
27 |
$GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array(
|
28 |
-
'amazon-s3-and-cloudfront' => '
|
29 |
-
'amazon-s3-and-cloudfront-pro' => '1.
|
30 |
);
|
31 |
|
32 |
require dirname( __FILE__ ) . '/classes/aws-compatibility-check.php';
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/
|
5 |
Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it.
|
6 |
Author: Delicious Brains
|
7 |
+
Version: 1.0.4
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-web-services
|
22 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
23 |
// **********************************************************************
|
24 |
|
25 |
+
$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.4';
|
26 |
|
27 |
$GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array(
|
28 |
+
'amazon-s3-and-cloudfront' => '1.2.1',
|
29 |
+
'amazon-s3-and-cloudfront-pro' => '1.5.1',
|
30 |
);
|
31 |
|
32 |
require dirname( __FILE__ ) . '/classes/aws-compatibility-check.php';
|
assets/css/styles.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.aws-content,.aws-updated,.aws-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.toplevel_page_amazon-web-services .error,.toplevel_page_amazon-web-services .notice,.toplevel_page_amazon-web-services .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.aws-addons,.aws-main[data-view="addons"] .aws-compatibility-notice{max-width:772px}.aws-settings h3{font-size:20px}.aws-settings .need-help{background-color:#fff;padding:20px 20px 20px 50px;line-height:1;font-size:16px;font-weight:bold;position:relative}.aws-settings .need-help:before{font-family:"dashicons";content:"\f348";font-size:24px;line-height:1;width:24px;height:24px;position:absolute;top:16px;left:16px}.aws-settings .need-help a{text-decoration:none}.aws-settings p{font-size:14px}body.toplevel_page_amazon-web-services .wrap h1{color:#fff;font-weight:600;font-size:26px;line-height:1;margin:20px 0 15px 0;width:650px;padding:100px 0 0 25px;height:150px;background:#f7a80d url(../img/aws-logo.svg) right 40px center no-repeat;background-size:100px 79px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.aws-addons .addons-list{margin:20px 0 200px;padding-top:5px;border-top:1px solid #ddd;font-size:14px}.aws-addons .addons-list li:last-child{margin-bottom:0}.aws-addons .addons-list article{margin-top:10px;width:100%;height:250px;position:relative;font-weight:300;line-height:1;overflow:hidden}.aws-addons .addons-list article .info{position:absolute;bottom:20px;left:20px}.aws-addons .addons-list article .info ul{margin:16px 0 0;color:rgba(255,255,255,0.7)}.aws-addons .addons-list article .info ul li{display:inline-block;margin:0 30px 0 0}.aws-addons .addons-list article .info ul li:last-child{margin-right:0}.aws-addons .addons-list article .info a{color:#fff;text-decoration:none}.aws-addons .addons-list article .info a:hover{text-decoration:underline}.aws-addons .addons-list article h1,.aws-addons .addons-list article h2{padding:0;color:#fff;line-height:1;font-weight:600}.aws-addons .addons-list article h1{margin:0;font-size:26px}.aws-addons .addons-list article h2{margin:4px 0 0;font-size:18px}.aws-addons .addons-list article .label{position:absolute;top:10px;right:10px;font-style:italic;color:#fff}.aws-addons .addons-list>li>ul{background-color:#fff;border-top:0;padding:10px;overflow:hidden}.aws-addons .addons-list>li>ul article{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.aws-addons .addons-list>li>ul article img{width:100px;height:100px}.aws-addons .addons-list>li>ul article h1{margin-top:8px;font-size:30px;line-height:1.2}.aws-addons .addons-list>li>ul article .info{display:block;left:auto;bottom:auto;margin:0 auto;text-align:center}.aws-addons .addons-list>li>ul article .info ul li{margin-right:10px;font-size:13px;line-height:1.6}.aws-addons .addons-list>li>ul li{margin-bottom:0}.aws-addons .addons-list .amazon-s3-and-cloudfront>article{background-image:url(../img/as3cf-banner-bw.jpg);background-size:772px 150px;background-repeat:no-repeat;height:150px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){.aws-addons .addons-list .amazon-s3-and-cloudfront>article{background-image:url(../img/as3cf-banner-bw@2x.jpg)}}.aws-addons .addons-list .amazon-s3-and-cloudfront-pro>article{background-image:url(../img/as3cf-banner.jpg);background-size:772px 250px;background-repeat:no-repeat}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){.aws-addons .addons-list .amazon-s3-and-cloudfront-pro>article{background-image:url(../img/as3cf-banner@2x.jpg)}}.aws-addons .addons-list .amazon-s3-and-cloudfront-assets>article{background-color:#0769ad;margin-top:0}
|
1 |
+
.aws-content,.aws-updated,.aws-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.toplevel_page_amazon-web-services .error,.toplevel_page_amazon-web-services .notice,.toplevel_page_amazon-web-services .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.aws-addons,.aws-main[data-view="addons"] .aws-compatibility-notice{max-width:772px}.aws-settings h3{font-size:20px}.aws-settings .need-help{background-color:#fff;padding:20px 20px 20px 50px;line-height:1;font-size:16px;font-weight:bold;position:relative}.aws-settings .need-help:before{font-family:"dashicons";content:"\f348";font-size:24px;line-height:1;width:24px;height:24px;position:absolute;top:16px;left:16px}.aws-settings .need-help a{text-decoration:none}.aws-settings p{font-size:14px}body.toplevel_page_amazon-web-services .wrap h1{color:#fff;font-weight:600;font-size:26px;line-height:1;margin:20px 0 15px 0;width:650px;padding:100px 0 0 25px;height:150px;background:#f7a80d url(../img/aws-logo.svg) right 40px center no-repeat;background-size:100px 79px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.aws-addons .addons-list{margin:20px 0 200px;padding-top:5px;border-top:1px solid #ddd;font-size:14px}.aws-addons .addons-list li:last-child{margin-bottom:0}.aws-addons .addons-list article{margin-top:10px;width:100%;height:250px;position:relative;font-weight:300;line-height:1;overflow:hidden}.aws-addons .addons-list article .info{position:absolute;bottom:20px;left:20px}.aws-addons .addons-list article .info ul{margin:16px 0 0;color:rgba(255,255,255,0.7)}.aws-addons .addons-list article .info ul li{display:inline-block;margin:0 30px 0 0}.aws-addons .addons-list article .info ul li:last-child{margin-right:0}.aws-addons .addons-list article .info a{color:#fff;text-decoration:none}.aws-addons .addons-list article .info a:hover{text-decoration:underline}.aws-addons .addons-list article h1,.aws-addons .addons-list article h2{padding:0;color:#fff;line-height:1;font-weight:600}.aws-addons .addons-list article h1{margin:0;font-size:26px}.aws-addons .addons-list article h2{margin:4px 0 0;font-size:18px}.aws-addons .addons-list article .label{position:absolute;top:10px;right:10px;font-style:italic;color:#fff}.aws-addons .addons-list>li>ul{background-color:#fff;border-top:0;padding:10px;overflow:hidden}.aws-addons .addons-list>li>ul article{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.aws-addons .addons-list>li>ul article img{width:100px;height:100px}.aws-addons .addons-list>li>ul article h1{margin-top:8px;font-size:30px;line-height:1.2}.aws-addons .addons-list>li>ul article .info{display:block;left:auto;bottom:auto;margin:0 auto;text-align:center}.aws-addons .addons-list>li>ul article .info ul li{margin-right:10px;font-size:13px;line-height:1.6}.aws-addons .addons-list>li>ul li{margin-bottom:0}.aws-addons .addons-list .amazon-s3-and-cloudfront>article{background-image:url(../img/as3cf-banner-bw.jpg);background-size:772px 150px;background-repeat:no-repeat;height:150px}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){.aws-addons .addons-list .amazon-s3-and-cloudfront>article{background-image:url(../img/as3cf-banner-bw@2x.jpg)}}.aws-addons .addons-list .amazon-s3-and-cloudfront-pro>article{background-image:url(../img/as3cf-banner.jpg);background-size:772px 250px;background-repeat:no-repeat}@media (min--moz-device-pixel-ratio: 1.3), (-webkit-min-device-pixel-ratio: 1.3), (min-device-pixel-ratio: 1.3), (min-resolution: 1.3dppx){.aws-addons .addons-list .amazon-s3-and-cloudfront-pro>article{background-image:url(../img/as3cf-banner@2x.jpg)}}.aws-addons .addons-list .amazon-s3-and-cloudfront-assets-pull>article{background-color:#0769ad;margin-top:0}
|
assets/img/{icon-assets.svg → icon-assets-pull.svg}
RENAMED
File without changes
|
assets/sass/styles.scss
CHANGED
@@ -227,7 +227,7 @@ body.toplevel_page_amazon-web-services .wrap {
|
|
227 |
}
|
228 |
}
|
229 |
|
230 |
-
.amazon-s3-and-cloudfront-assets > article {
|
231 |
background-color: #0769ad;
|
232 |
margin-top: 0;
|
233 |
}
|
227 |
}
|
228 |
}
|
229 |
|
230 |
+
.amazon-s3-and-cloudfront-assets-pull > article {
|
231 |
background-color: #0769ad;
|
232 |
margin-top: 0;
|
233 |
}
|
classes/amazon-web-services.php
CHANGED
@@ -213,7 +213,7 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
213 |
* @return bool
|
214 |
*/
|
215 |
function are_key_constants_set() {
|
216 |
-
return defined( 'AWS_ACCESS_KEY_ID' )
|
217 |
}
|
218 |
|
219 |
/**
|
@@ -222,7 +222,22 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
222 |
* @return bool
|
223 |
*/
|
224 |
function are_prefixed_key_constants_set() {
|
225 |
-
return defined( 'DBI_AWS_ACCESS_KEY_ID' )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
}
|
227 |
|
228 |
/**
|
@@ -237,31 +252,43 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
237 |
/**
|
238 |
* Get the AWS key from a constant or the settings
|
239 |
*
|
|
|
|
|
240 |
* @return string
|
241 |
*/
|
242 |
function get_access_key_id() {
|
243 |
-
if (
|
244 |
-
|
245 |
-
|
246 |
-
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
-
return
|
250 |
}
|
251 |
|
252 |
/**
|
253 |
* Get the AWS secret from a constant or the settings
|
254 |
*
|
|
|
|
|
255 |
* @return string
|
256 |
*/
|
257 |
function get_secret_access_key() {
|
258 |
-
if (
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
|
264 |
-
return
|
265 |
}
|
266 |
|
267 |
/**
|
@@ -283,15 +310,15 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
283 |
* Instantiate a new AWS service client for the AWS SDK
|
284 |
* using the defined AWS key and secret
|
285 |
*
|
286 |
-
* @return Aws
|
|
|
287 |
*/
|
288 |
function get_client() {
|
289 |
-
if (
|
290 |
-
|
291 |
}
|
292 |
|
293 |
if ( is_null( $this->client ) ) {
|
294 |
-
|
295 |
$args = array();
|
296 |
|
297 |
if ( ! $this->use_ec2_iam_roles() ) {
|
@@ -362,9 +389,9 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
362 |
'utm_campaign' => 'WP+Offload+S3',
|
363 |
) ),
|
364 |
'addons' => array(
|
365 |
-
'amazon-s3-and-cloudfront-assets' => array(
|
366 |
-
'title' => __( 'Assets', 'amazon-web-services' ),
|
367 |
-
'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-addon/', array(
|
368 |
'utm_campaign' => 'addons+install',
|
369 |
) ),
|
370 |
'label' => __( 'Feature', 'amazon-web-services' ),
|
213 |
* @return bool
|
214 |
*/
|
215 |
function are_key_constants_set() {
|
216 |
+
return defined( 'AWS_ACCESS_KEY_ID' ) || defined( 'AWS_SECRET_ACCESS_KEY' );
|
217 |
}
|
218 |
|
219 |
/**
|
222 |
* @return bool
|
223 |
*/
|
224 |
function are_prefixed_key_constants_set() {
|
225 |
+
return defined( 'DBI_AWS_ACCESS_KEY_ID' ) || defined( 'DBI_AWS_SECRET_ACCESS_KEY' );
|
226 |
+
}
|
227 |
+
|
228 |
+
/**
|
229 |
+
* Whether or not IAM access keys are needed.
|
230 |
+
*
|
231 |
+
* Keys are needed if we are not using EC2 roles or not defined/set yet.
|
232 |
+
*
|
233 |
+
* @return bool
|
234 |
+
*/
|
235 |
+
public function needs_access_keys() {
|
236 |
+
if ( $this->use_ec2_iam_roles() ) {
|
237 |
+
return false;
|
238 |
+
}
|
239 |
+
|
240 |
+
return ! $this->are_access_keys_set();
|
241 |
}
|
242 |
|
243 |
/**
|
252 |
/**
|
253 |
* Get the AWS key from a constant or the settings
|
254 |
*
|
255 |
+
* Falls back to settings only if neither constant is defined.
|
256 |
+
*
|
257 |
* @return string
|
258 |
*/
|
259 |
function get_access_key_id() {
|
260 |
+
if ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) {
|
261 |
+
if ( defined( 'DBI_AWS_ACCESS_KEY_ID' ) ) {
|
262 |
+
return DBI_AWS_ACCESS_KEY_ID;
|
263 |
+
} elseif ( defined( 'AWS_ACCESS_KEY_ID' ) ) {
|
264 |
+
return AWS_ACCESS_KEY_ID; // Deprecated
|
265 |
+
}
|
266 |
+
} else {
|
267 |
+
return $this->get_setting( 'access_key_id' );
|
268 |
}
|
269 |
|
270 |
+
return '';
|
271 |
}
|
272 |
|
273 |
/**
|
274 |
* Get the AWS secret from a constant or the settings
|
275 |
*
|
276 |
+
* Falls back to settings only if neither constant is defined.
|
277 |
+
*
|
278 |
* @return string
|
279 |
*/
|
280 |
function get_secret_access_key() {
|
281 |
+
if ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) {
|
282 |
+
if ( defined( 'DBI_AWS_SECRET_ACCESS_KEY' ) ) {
|
283 |
+
return DBI_AWS_SECRET_ACCESS_KEY;
|
284 |
+
} elseif ( defined( 'AWS_SECRET_ACCESS_KEY' ) ) {
|
285 |
+
return AWS_SECRET_ACCESS_KEY; // Deprecated
|
286 |
+
}
|
287 |
+
} else {
|
288 |
+
return $this->get_setting( 'secret_access_key' );
|
289 |
}
|
290 |
|
291 |
+
return '';
|
292 |
}
|
293 |
|
294 |
/**
|
310 |
* Instantiate a new AWS service client for the AWS SDK
|
311 |
* using the defined AWS key and secret
|
312 |
*
|
313 |
+
* @return Aws
|
314 |
+
* @throws Exception
|
315 |
*/
|
316 |
function get_client() {
|
317 |
+
if ( $this->needs_access_keys() ) {
|
318 |
+
throw new Exception( sprintf( __( 'You must first <a href="%s">set your AWS access keys</a> to use this addon.', 'amazon-web-services' ), 'admin.php?page=' . $this->plugin_slug ) );
|
319 |
}
|
320 |
|
321 |
if ( is_null( $this->client ) ) {
|
|
|
322 |
$args = array();
|
323 |
|
324 |
if ( ! $this->use_ec2_iam_roles() ) {
|
389 |
'utm_campaign' => 'WP+Offload+S3',
|
390 |
) ),
|
391 |
'addons' => array(
|
392 |
+
'amazon-s3-and-cloudfront-assets-pull' => array(
|
393 |
+
'title' => __( 'Assets Pull', 'amazon-web-services' ),
|
394 |
+
'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-pull-addon/', array(
|
395 |
'utm_campaign' => 'addons+install',
|
396 |
) ),
|
397 |
'label' => __( 'Feature', 'amazon-web-services' ),
|
classes/aws-plugin-base.php
CHANGED
@@ -95,18 +95,15 @@ class AWS_Plugin_Base {
|
|
95 |
* @return array
|
96 |
*/
|
97 |
function get_defined_settings( $force = false ) {
|
98 |
-
if (
|
99 |
$this->defined_settings = array();
|
100 |
-
$unserialized = array();
|
101 |
-
$class = get_class( $this );
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
if ( defined( $constant ) ) {
|
106 |
-
$unserialized = maybe_unserialize( constant( $constant ) );
|
107 |
-
}
|
108 |
-
}
|
109 |
|
|
|
|
|
|
|
110 |
$unserialized = is_array( $unserialized ) ? $unserialized : array();
|
111 |
|
112 |
foreach ( $unserialized as $key => $value ) {
|
@@ -126,11 +123,76 @@ class AWS_Plugin_Base {
|
|
126 |
|
127 |
$this->defined_settings[ $key ] = $value;
|
128 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
|
131 |
return $this->defined_settings;
|
132 |
}
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
/**
|
135 |
* Filter the plugin settings array
|
136 |
*
|
@@ -229,7 +291,7 @@ class AWS_Plugin_Base {
|
|
229 |
/**
|
230 |
* Render a view template file
|
231 |
*
|
232 |
-
* @param
|
233 |
* @param array $args Arguments to pass to the view
|
234 |
*/
|
235 |
function render_view( $view, $args = array() ) {
|
95 |
* @return array
|
96 |
*/
|
97 |
function get_defined_settings( $force = false ) {
|
98 |
+
if ( ! defined( static::SETTINGS_CONSTANT ) ) {
|
99 |
$this->defined_settings = array();
|
|
|
|
|
100 |
|
101 |
+
return $this->defined_settings;
|
102 |
+
}
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
if ( is_null( $this->defined_settings ) || $force ) {
|
105 |
+
$this->defined_settings = array();
|
106 |
+
$unserialized = maybe_unserialize( constant( static::SETTINGS_CONSTANT ) );
|
107 |
$unserialized = is_array( $unserialized ) ? $unserialized : array();
|
108 |
|
109 |
foreach ( $unserialized as $key => $value ) {
|
123 |
|
124 |
$this->defined_settings[ $key ] = $value;
|
125 |
}
|
126 |
+
|
127 |
+
$this->listen_for_settings_constant_changes();
|
128 |
+
|
129 |
+
// Normalize the defined settings before saving, so we can detect when a real change happens.
|
130 |
+
ksort( $this->defined_settings );
|
131 |
+
update_site_option( 'as3cf_constant_' . static::SETTINGS_CONSTANT, $this->defined_settings );
|
132 |
}
|
133 |
|
134 |
return $this->defined_settings;
|
135 |
}
|
136 |
|
137 |
+
/**
|
138 |
+
* Subscribe to changes of the site option used to store the constant-defined settings.
|
139 |
+
*/
|
140 |
+
protected function listen_for_settings_constant_changes() {
|
141 |
+
if ( ! has_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_changed' ) ) ) {
|
142 |
+
add_action( 'add_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_added' ), 10, 3 );
|
143 |
+
add_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_changed' ), 10, 4 );
|
144 |
+
}
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* Translate a settings constant option addition into a change.
|
149 |
+
*
|
150 |
+
* @param string $option Name of the option.
|
151 |
+
* @param mixed $value Value the option is being initialized with.
|
152 |
+
* @param int $network_id ID of the network.
|
153 |
+
*/
|
154 |
+
public function settings_constant_added( $option, $value, $network_id ) {
|
155 |
+
$db_settings = get_site_option( static::SETTINGS_KEY, array() );
|
156 |
+
$this->settings_constant_changed( $option, $value, $db_settings, $network_id );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Callback for announcing when settings-defined values change.
|
161 |
+
*
|
162 |
+
* @param string $option Name of the option.
|
163 |
+
* @param mixed $new_settings Current value of the option.
|
164 |
+
* @param mixed $old_settings Old value of the option.
|
165 |
+
* @param int $network_id ID of the network.
|
166 |
+
*/
|
167 |
+
public function settings_constant_changed( $option, $new_settings, $old_settings, $network_id ) {
|
168 |
+
$old_settings = $old_settings ?: array();
|
169 |
+
|
170 |
+
foreach ( $this->get_settings_whitelist() as $setting ) {
|
171 |
+
$old_value = isset( $old_settings[ $setting ] ) ? $old_settings[ $setting ] : null;
|
172 |
+
$new_value = isset( $new_settings[ $setting ] ) ? $new_settings[ $setting ] : null;
|
173 |
+
|
174 |
+
if ( $old_value !== $new_value ) {
|
175 |
+
/**
|
176 |
+
* Setting-specific hook for setting change.
|
177 |
+
*
|
178 |
+
* @param mixed $new_value
|
179 |
+
* @param mixed $old_value
|
180 |
+
* @param string $setting
|
181 |
+
*/
|
182 |
+
do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_' . $setting, $new_value, $old_value, $setting );
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Generic hook for setting change.
|
186 |
+
*
|
187 |
+
* @param mixed $new_value
|
188 |
+
* @param mixed $old_value
|
189 |
+
* @param string $setting
|
190 |
+
*/
|
191 |
+
do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed', $new_value, $old_value, $setting );
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
/**
|
197 |
* Filter the plugin settings array
|
198 |
*
|
291 |
/**
|
292 |
* Render a view template file
|
293 |
*
|
294 |
+
* @param string $view View filename without the extension
|
295 |
* @param array $args Arguments to pass to the view
|
296 |
*/
|
297 |
function render_view( $view, $args = array() ) {
|
classes/wp-aws-compatibility-check.php
CHANGED
@@ -304,7 +304,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
304 |
/**
|
305 |
* Get the compatibility error message
|
306 |
*
|
307 |
-
* @return string|
|
308 |
*/
|
309 |
function get_error_msg() {
|
310 |
if ( is_null( $this->parent_plugin_slug ) ) {
|
@@ -521,4 +521,4 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
|
|
521 |
return self::$is_installing_or_updating_plugins;
|
522 |
}
|
523 |
}
|
524 |
-
}
|
304 |
/**
|
305 |
* Get the compatibility error message
|
306 |
*
|
307 |
+
* @return string|bool
|
308 |
*/
|
309 |
function get_error_msg() {
|
310 |
if ( is_null( $this->parent_plugin_slug ) ) {
|
521 |
return self::$is_installing_or_updating_plugins;
|
522 |
}
|
523 |
}
|
524 |
+
}
|
languages/amazon-web-services-en.pot
CHANGED
@@ -8,7 +8,7 @@ msgid ""
|
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: amazon-web-services\n"
|
10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
11 |
-
"POT-Creation-Date: 2017-
|
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"
|
@@ -31,7 +31,7 @@ msgid "Addons"
|
|
31 |
msgstr ""
|
32 |
|
33 |
#: classes/amazon-web-services.php:83
|
34 |
-
#: classes/amazon-web-services.php:
|
35 |
#: view/settings.php:16
|
36 |
msgid "Access Keys"
|
37 |
msgstr ""
|
@@ -44,53 +44,53 @@ msgstr ""
|
|
44 |
msgid "Amazon Web Services: Addons"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#: classes/amazon-web-services.php:
|
48 |
#, php-format
|
49 |
msgid ""
|
50 |
"You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: classes/amazon-web-services.php:
|
54 |
msgid "WP Offload S3 Lite"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: classes/amazon-web-services.php:
|
58 |
msgid "WP Offload S3"
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: classes/amazon-web-services.php:
|
62 |
-
msgid "Assets"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: classes/amazon-web-services.php:
|
66 |
msgid "Feature"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: classes/amazon-web-services.php:
|
70 |
msgctxt "Plugin already installed and activated"
|
71 |
msgid "Installed & Activated"
|
72 |
msgstr ""
|
73 |
|
74 |
-
#: classes/amazon-web-services.php:
|
75 |
msgctxt "Plugin already installed"
|
76 |
msgid "Installed"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: classes/amazon-web-services.php:
|
80 |
msgctxt "Activate plugin now"
|
81 |
msgid "Activate Now"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: classes/amazon-web-services.php:
|
85 |
msgctxt "Install plugin now"
|
86 |
msgid "Install Now"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: classes/amazon-web-services.php:
|
90 |
msgid "Visit Site"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: classes/amazon-web-services.php:
|
94 |
msgctxt "View plugin details"
|
95 |
msgid "View Details"
|
96 |
msgstr ""
|
@@ -121,7 +121,7 @@ msgid ""
|
|
121 |
"7.16.2+ compiled with OpenSSL and zlib. Your server currently has"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: classes/aws-plugin-base.php:
|
125 |
msgid "Settings"
|
126 |
msgstr ""
|
127 |
|
@@ -217,38 +217,53 @@ msgstr ""
|
|
217 |
msgid "You have enabled the use of IAM roles for Amazon EC2 instances."
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: view/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
msgid ""
|
222 |
"You’ve already defined your AWS access keys in your wp-config.php. If "
|
223 |
-
"you’d prefer to manage them here and store them in the database (
|
224 |
-
"recommended), simply remove the lines from your wp-
|
|
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: view/settings.php:
|
228 |
msgid ""
|
229 |
"We recommend defining your Access Keys in wp-config.php so long as you "
|
230 |
"don’t commit it to source control (you shouldn’t be). Simply "
|
231 |
"copy the following snippet and replace the stars with the keys."
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: view/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
msgid ""
|
236 |
"If you’d rather store your Access Keys in the database, <a href="
|
237 |
"\"\">click here to reveal a form.</a>"
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: view/settings.php:
|
241 |
msgid "Access Key ID:"
|
242 |
msgstr ""
|
243 |
|
244 |
-
#: view/settings.php:
|
245 |
msgid "Secret Access Key:"
|
246 |
msgstr ""
|
247 |
|
248 |
-
#: view/settings.php:
|
249 |
msgid "Save Changes"
|
250 |
msgstr ""
|
251 |
|
252 |
-
#: view/settings.php:
|
253 |
msgid "Remove Keys"
|
254 |
msgstr ""
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: amazon-web-services\n"
|
10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
11 |
+
"POT-Creation-Date: 2017-11-20 14:50+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"
|
31 |
msgstr ""
|
32 |
|
33 |
#: classes/amazon-web-services.php:83
|
34 |
+
#: classes/amazon-web-services.php:369
|
35 |
#: view/settings.php:16
|
36 |
msgid "Access Keys"
|
37 |
msgstr ""
|
44 |
msgid "Amazon Web Services: Addons"
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: classes/amazon-web-services.php:318
|
48 |
#, php-format
|
49 |
msgid ""
|
50 |
"You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: classes/amazon-web-services.php:382
|
54 |
msgid "WP Offload S3 Lite"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: classes/amazon-web-services.php:387
|
58 |
msgid "WP Offload S3"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: classes/amazon-web-services.php:393
|
62 |
+
msgid "Assets Pull"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: classes/amazon-web-services.php:397
|
66 |
msgid "Feature"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: classes/amazon-web-services.php:443
|
70 |
msgctxt "Plugin already installed and activated"
|
71 |
msgid "Installed & Activated"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: classes/amazon-web-services.php:445
|
75 |
msgctxt "Plugin already installed"
|
76 |
msgid "Installed"
|
77 |
msgstr ""
|
78 |
|
79 |
+
#: classes/amazon-web-services.php:446
|
80 |
msgctxt "Activate plugin now"
|
81 |
msgid "Activate Now"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: classes/amazon-web-services.php:449
|
85 |
msgctxt "Install plugin now"
|
86 |
msgid "Install Now"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: classes/amazon-web-services.php:485
|
90 |
msgid "Visit Site"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: classes/amazon-web-services.php:488
|
94 |
msgctxt "View plugin details"
|
95 |
msgid "View Details"
|
96 |
msgstr ""
|
121 |
"7.16.2+ compiled with OpenSSL and zlib. Your server currently has"
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: classes/aws-plugin-base.php:360
|
125 |
msgid "Settings"
|
126 |
msgstr ""
|
127 |
|
217 |
msgid "You have enabled the use of IAM roles for Amazon EC2 instances."
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: view/settings.php:29
|
221 |
+
msgid ""
|
222 |
+
"Please check your wp-config.php file as it looks like one of your defines is "
|
223 |
+
"missing or incorrect."
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: view/settings.php:35
|
227 |
+
#, php-format
|
228 |
msgid ""
|
229 |
"You’ve already defined your AWS access keys in your wp-config.php. If "
|
230 |
+
"you’d prefer to manage them here and store them in the database (<a "
|
231 |
+
"href=\"%s\">not recommended</a>), simply remove the lines from your wp-"
|
232 |
+
"config."
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: view/settings.php:43
|
236 |
msgid ""
|
237 |
"We recommend defining your Access Keys in wp-config.php so long as you "
|
238 |
"don’t commit it to source control (you shouldn’t be). Simply "
|
239 |
"copy the following snippet and replace the stars with the keys."
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: view/settings.php:51
|
243 |
+
#, php-format
|
244 |
+
msgid ""
|
245 |
+
"You’re storing your Access Keys in the database (<a href=\"%s\">not "
|
246 |
+
"recommended</a>).</a>"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: view/settings.php:57
|
250 |
msgid ""
|
251 |
"If you’d rather store your Access Keys in the database, <a href="
|
252 |
"\"\">click here to reveal a form.</a>"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: view/settings.php:74
|
256 |
msgid "Access Key ID:"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: view/settings.php:80
|
260 |
msgid "Secret Access Key:"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: view/settings.php:87
|
264 |
msgid "Save Changes"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: view/settings.php:90
|
268 |
msgid "Remove Keys"
|
269 |
msgstr ""
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: bradt, deliciousbrains
|
3 |
Tags: amazon, amazon web services
|
4 |
Requires at least: 4.6
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv3
|
8 |
|
9 |
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
|
@@ -33,6 +33,13 @@ This plugin is required by other plugins, which use its libraries and its settin
|
|
33 |
|
34 |
== Changelog ==
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
= 1.0.3 - 2017-06-19 =
|
37 |
* Improvement: Compatibility with WP Offload S3 1.5
|
38 |
|
2 |
Contributors: bradt, deliciousbrains
|
3 |
Tags: amazon, amazon web services
|
4 |
Requires at least: 4.6
|
5 |
+
Tested up to: 4.9
|
6 |
+
Stable tag: 1.0.4
|
7 |
License: GPLv3
|
8 |
|
9 |
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
|
33 |
|
34 |
== Changelog ==
|
35 |
|
36 |
+
= 1.0.4 - 2017-11-20 =
|
37 |
+
* Improvement: Compatibility with WordPress 4.9
|
38 |
+
* Improvement: Compatibility with WP Offload S3 1.5.1
|
39 |
+
* Bug fix: Reveal access keys form option shown when keys partially defined
|
40 |
+
* Bug fix: WP_Error being passed to AWS methods
|
41 |
+
* Bug fix: "More info" links can be broken across two lines
|
42 |
+
|
43 |
= 1.0.3 - 2017-06-19 =
|
44 |
* Improvement: Compatibility with WP Offload S3 1.5
|
45 |
|
view/settings.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<?php
|
4 |
$use_ec2_iam_roles = $this->use_ec2_iam_roles(); ?>
|
5 |
|
6 |
-
<?php if (
|
7 |
|
8 |
<p class="need-help dashicons-before dashicons-info">
|
9 |
<?php printf( __( 'Need help getting your Access Keys? <a href="%s">Check out the Quick Start Guide →</a>', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
|
@@ -23,8 +23,18 @@
|
|
23 |
|
24 |
<?php elseif ( ! $use_ec2_iam_roles && ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) ) : ?>
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
<p>
|
27 |
-
<?php
|
|
|
|
|
28 |
</p>
|
29 |
|
30 |
<?php else : ?>
|
@@ -36,9 +46,17 @@
|
|
36 |
<pre>define( 'DBI_AWS_ACCESS_KEY_ID', '********************' );
|
37 |
define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************' );</pre>
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
<form method="post" <?php echo ( ! $this->get_access_key_id() && ! $this->get_secret_access_key() ) ? 'style="display: none;"' : ''; // xss ok ?>>
|
44 |
|
@@ -79,4 +97,4 @@ define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************'
|
|
79 |
|
80 |
<?php endif; ?>
|
81 |
|
82 |
-
</div>
|
3 |
<?php
|
4 |
$use_ec2_iam_roles = $this->use_ec2_iam_roles(); ?>
|
5 |
|
6 |
+
<?php if ( $this->needs_access_keys() ) : ?>
|
7 |
|
8 |
<p class="need-help dashicons-before dashicons-info">
|
9 |
<?php printf( __( 'Need help getting your Access Keys? <a href="%s">Check out the Quick Start Guide →</a>', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array(
|
23 |
|
24 |
<?php elseif ( ! $use_ec2_iam_roles && ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) ) : ?>
|
25 |
|
26 |
+
<?php if ( ! $this->are_access_keys_set() ) : ?>
|
27 |
+
<div class="notice-error notice">
|
28 |
+
<p>
|
29 |
+
<?php _e( 'Please check your wp-config.php file as it looks like one of your defines is missing or incorrect.', 'amazon-web-services' ); ?>
|
30 |
+
</p>
|
31 |
+
</div>
|
32 |
+
<?php endif; ?>
|
33 |
+
|
34 |
<p>
|
35 |
+
<?php printf( __( 'You’ve already defined your AWS access keys in your wp-config.php. If you’d prefer to manage them here and store them in the database (<a href="%s">not recommended</a>), simply remove the lines from your wp-config.', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/#save-access-keys', array(
|
36 |
+
'utm_campaign' => 'support+docs',
|
37 |
+
) ) ); ?>
|
38 |
</p>
|
39 |
|
40 |
<?php else : ?>
|
46 |
<pre>define( 'DBI_AWS_ACCESS_KEY_ID', '********************' );
|
47 |
define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************' );</pre>
|
48 |
|
49 |
+
<?php if ( $this->get_access_key_id() || $this->get_secret_access_key() ) : ?>
|
50 |
+
<p>
|
51 |
+
<?php printf( __( 'You’re storing your Access Keys in the database (<a href="%s">not recommended</a>).</a>', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/#save-access-keys', array(
|
52 |
+
'utm_campaign' => 'support+docs',
|
53 |
+
) ) ); ?>
|
54 |
+
</p>
|
55 |
+
<?php else : ?>
|
56 |
+
<p class="reveal-form">
|
57 |
+
<?php _e( 'If you’d rather store your Access Keys in the database, <a href="">click here to reveal a form.</a>', 'amazon-web-services' ); ?>
|
58 |
+
</p>
|
59 |
+
<?php endif; ?>
|
60 |
|
61 |
<form method="post" <?php echo ( ! $this->get_access_key_id() && ! $this->get_secret_access_key() ) ? 'style="display: none;"' : ''; // xss ok ?>>
|
62 |
|
97 |
|
98 |
<?php endif; ?>
|
99 |
|
100 |
+
</div>
|