From 54b55db5176bc75f0e3f81efb71d857175a3fd1c Mon Sep 17 00:00:00 2001 From: "Ian M. Jones" Date: Mon, 20 Nov 2017 15:11:49 +0000 Subject: [PATCH] Deploying version 1.0.4 --- README.md | 11 ++- amazon-web-services.php | 8 +- assets/css/styles.css | 2 +- .../{icon-assets.svg => icon-assets-pull.svg} | 0 assets/sass/styles.scss | 2 +- classes/amazon-web-services.php | 65 ++++++++++----- classes/aws-plugin-base.php | 82 ++++++++++++++++--- classes/wp-aws-compatibility-check.php | 4 +- languages/amazon-web-services-en.pot | 63 ++++++++------ readme.txt | 11 ++- view/settings.php | 30 +++++-- 11 files changed, 207 insertions(+), 71 deletions(-) rename assets/img/{icon-assets.svg => icon-assets-pull.svg} (100%) diff --git a/README.md b/README.md index 7c7ea05..75c0375 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ **Contributors:** bradt, deliciousbrains **Tags:** amazon, amazon web services **Requires at least:** 4.6 -**Tested up to:** 4.8 -**Stable tag:** 1.0.3 +**Tested up to:** 4.9 +**Stable tag:** 1.0.4 **License:** GPLv3 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 ## Changelog ## +### 1.0.4 - 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 + ### 1.0.3 - 2017-06-19 ### * Improvement: Compatibility with WP Offload S3 1.5 diff --git a/amazon-web-services.php b/amazon-web-services.php index 07de1bf..cf051a9 100644 --- a/amazon-web-services.php +++ b/amazon-web-services.php @@ -4,7 +4,7 @@ Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/ Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it. Author: Delicious Brains -Version: 1.0.3 +Version: 1.0.4 Author URI: https://deliciousbrains.com/ Network: True Text Domain: amazon-web-services @@ -22,11 +22,11 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. // ********************************************************************** -$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.3'; +$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.4'; $GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array( - 'amazon-s3-and-cloudfront' => '0.9', - 'amazon-s3-and-cloudfront-pro' => '1.0b1', + 'amazon-s3-and-cloudfront' => '1.2.1', + 'amazon-s3-and-cloudfront-pro' => '1.5.1', ); require dirname( __FILE__ ) . '/classes/aws-compatibility-check.php'; diff --git a/assets/css/styles.css b/assets/css/styles.css index e84296d..091b768 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -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} +.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} diff --git a/assets/img/icon-assets.svg b/assets/img/icon-assets-pull.svg similarity index 100% rename from assets/img/icon-assets.svg rename to assets/img/icon-assets-pull.svg diff --git a/assets/sass/styles.scss b/assets/sass/styles.scss index a1e8d1a..647201b 100644 --- a/assets/sass/styles.scss +++ b/assets/sass/styles.scss @@ -227,7 +227,7 @@ body.toplevel_page_amazon-web-services .wrap { } } - .amazon-s3-and-cloudfront-assets > article { + .amazon-s3-and-cloudfront-assets-pull > article { background-color: #0769ad; margin-top: 0; } diff --git a/classes/amazon-web-services.php b/classes/amazon-web-services.php index 05cf380..ed4c977 100644 --- a/classes/amazon-web-services.php +++ b/classes/amazon-web-services.php @@ -213,7 +213,7 @@ function render_page() { * @return bool */ function are_key_constants_set() { - return defined( 'AWS_ACCESS_KEY_ID' ) && defined( 'AWS_SECRET_ACCESS_KEY' ); + return defined( 'AWS_ACCESS_KEY_ID' ) || defined( 'AWS_SECRET_ACCESS_KEY' ); } /** @@ -222,7 +222,22 @@ function are_key_constants_set() { * @return bool */ function are_prefixed_key_constants_set() { - return defined( 'DBI_AWS_ACCESS_KEY_ID' ) && defined( 'DBI_AWS_SECRET_ACCESS_KEY' ); + return defined( 'DBI_AWS_ACCESS_KEY_ID' ) || defined( 'DBI_AWS_SECRET_ACCESS_KEY' ); + } + + /** + * Whether or not IAM access keys are needed. + * + * Keys are needed if we are not using EC2 roles or not defined/set yet. + * + * @return bool + */ + public function needs_access_keys() { + if ( $this->use_ec2_iam_roles() ) { + return false; + } + + return ! $this->are_access_keys_set(); } /** @@ -237,31 +252,43 @@ function are_access_keys_set() { /** * Get the AWS key from a constant or the settings * + * Falls back to settings only if neither constant is defined. + * * @return string */ function get_access_key_id() { - if ( defined( 'DBI_AWS_ACCESS_KEY_ID' ) ) { - return DBI_AWS_ACCESS_KEY_ID; - } elseif ( defined( 'AWS_ACCESS_KEY_ID' ) ) { - return AWS_ACCESS_KEY_ID; // Deprecated + if ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) { + if ( defined( 'DBI_AWS_ACCESS_KEY_ID' ) ) { + return DBI_AWS_ACCESS_KEY_ID; + } elseif ( defined( 'AWS_ACCESS_KEY_ID' ) ) { + return AWS_ACCESS_KEY_ID; // Deprecated + } + } else { + return $this->get_setting( 'access_key_id' ); } - return $this->get_setting( 'access_key_id' ); + return ''; } /** * Get the AWS secret from a constant or the settings * + * Falls back to settings only if neither constant is defined. + * * @return string */ function get_secret_access_key() { - if ( defined( 'DBI_AWS_SECRET_ACCESS_KEY' ) ) { - return DBI_AWS_SECRET_ACCESS_KEY; - } elseif ( defined( 'AWS_SECRET_ACCESS_KEY' ) ) { - return AWS_SECRET_ACCESS_KEY; // Deprecated + if ( $this->are_prefixed_key_constants_set() || $this->are_key_constants_set() ) { + if ( defined( 'DBI_AWS_SECRET_ACCESS_KEY' ) ) { + return DBI_AWS_SECRET_ACCESS_KEY; + } elseif ( defined( 'AWS_SECRET_ACCESS_KEY' ) ) { + return AWS_SECRET_ACCESS_KEY; // Deprecated + } + } else { + return $this->get_setting( 'secret_access_key' ); } - return $this->get_setting( 'secret_access_key' ); + return ''; } /** @@ -283,15 +310,15 @@ function use_ec2_iam_roles() { * Instantiate a new AWS service client for the AWS SDK * using the defined AWS key and secret * - * @return Aws|WP_Error + * @return Aws + * @throws Exception */ function get_client() { - if ( ! $this->use_ec2_iam_roles() && ( ! $this->get_access_key_id() || ! $this->get_secret_access_key() ) ) { - return new WP_Error( 'access_keys_missing', sprintf( __( 'You must first set your AWS access keys to use this addon.', 'amazon-web-services' ), 'admin.php?page=' . $this->plugin_slug ) ); // xss ok + if ( $this->needs_access_keys() ) { + throw new Exception( sprintf( __( 'You must first set your AWS access keys to use this addon.', 'amazon-web-services' ), 'admin.php?page=' . $this->plugin_slug ) ); } if ( is_null( $this->client ) ) { - $args = array(); if ( ! $this->use_ec2_iam_roles() ) { @@ -362,9 +389,9 @@ public function get_addons( $unfiltered = false ) { 'utm_campaign' => 'WP+Offload+S3', ) ), 'addons' => array( - 'amazon-s3-and-cloudfront-assets' => array( - 'title' => __( 'Assets', 'amazon-web-services' ), - 'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-addon/', array( + 'amazon-s3-and-cloudfront-assets-pull' => array( + 'title' => __( 'Assets Pull', 'amazon-web-services' ), + 'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-pull-addon/', array( 'utm_campaign' => 'addons+install', ) ), 'label' => __( 'Feature', 'amazon-web-services' ), diff --git a/classes/aws-plugin-base.php b/classes/aws-plugin-base.php index 39eaec7..cfa3725 100644 --- a/classes/aws-plugin-base.php +++ b/classes/aws-plugin-base.php @@ -95,18 +95,15 @@ function get_settings( $force = false ) { * @return array */ function get_defined_settings( $force = false ) { - if ( is_null( $this->defined_settings ) || $force ) { + if ( ! defined( static::SETTINGS_CONSTANT ) ) { $this->defined_settings = array(); - $unserialized = array(); - $class = get_class( $this ); - if ( defined( "$class::SETTINGS_CONSTANT" ) ) { - $constant = static::SETTINGS_CONSTANT; - if ( defined( $constant ) ) { - $unserialized = maybe_unserialize( constant( $constant ) ); - } - } + return $this->defined_settings; + } + if ( is_null( $this->defined_settings ) || $force ) { + $this->defined_settings = array(); + $unserialized = maybe_unserialize( constant( static::SETTINGS_CONSTANT ) ); $unserialized = is_array( $unserialized ) ? $unserialized : array(); foreach ( $unserialized as $key => $value ) { @@ -126,11 +123,76 @@ function get_defined_settings( $force = false ) { $this->defined_settings[ $key ] = $value; } + + $this->listen_for_settings_constant_changes(); + + // Normalize the defined settings before saving, so we can detect when a real change happens. + ksort( $this->defined_settings ); + update_site_option( 'as3cf_constant_' . static::SETTINGS_CONSTANT, $this->defined_settings ); } return $this->defined_settings; } + /** + * Subscribe to changes of the site option used to store the constant-defined settings. + */ + protected function listen_for_settings_constant_changes() { + if ( ! has_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_changed' ) ) ) { + add_action( 'add_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_added' ), 10, 3 ); + add_action( 'update_site_option_' . 'as3cf_constant_' . static::SETTINGS_CONSTANT, array( $this, 'settings_constant_changed' ), 10, 4 ); + } + } + + /** + * Translate a settings constant option addition into a change. + * + * @param string $option Name of the option. + * @param mixed $value Value the option is being initialized with. + * @param int $network_id ID of the network. + */ + public function settings_constant_added( $option, $value, $network_id ) { + $db_settings = get_site_option( static::SETTINGS_KEY, array() ); + $this->settings_constant_changed( $option, $value, $db_settings, $network_id ); + } + + /** + * Callback for announcing when settings-defined values change. + * + * @param string $option Name of the option. + * @param mixed $new_settings Current value of the option. + * @param mixed $old_settings Old value of the option. + * @param int $network_id ID of the network. + */ + public function settings_constant_changed( $option, $new_settings, $old_settings, $network_id ) { + $old_settings = $old_settings ?: array(); + + foreach ( $this->get_settings_whitelist() as $setting ) { + $old_value = isset( $old_settings[ $setting ] ) ? $old_settings[ $setting ] : null; + $new_value = isset( $new_settings[ $setting ] ) ? $new_settings[ $setting ] : null; + + if ( $old_value !== $new_value ) { + /** + * Setting-specific hook for setting change. + * + * @param mixed $new_value + * @param mixed $old_value + * @param string $setting + */ + do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_' . $setting, $new_value, $old_value, $setting ); + + /** + * Generic hook for setting change. + * + * @param mixed $new_value + * @param mixed $old_value + * @param string $setting + */ + do_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed', $new_value, $old_value, $setting ); + } + } + } + /** * Filter the plugin settings array * @@ -229,7 +291,7 @@ function remove_defined_setting( $key ) { /** * Render a view template file * - * @param $view View filename without the extension + * @param string $view View filename without the extension * @param array $args Arguments to pass to the view */ function render_view( $view, $args = array() ) { diff --git a/classes/wp-aws-compatibility-check.php b/classes/wp-aws-compatibility-check.php index d108b1d..c0bab38 100644 --- a/classes/wp-aws-compatibility-check.php +++ b/classes/wp-aws-compatibility-check.php @@ -304,7 +304,7 @@ function is_parent_plugin_at_version( $version ) { /** * Get the compatibility error message * - * @return string|void + * @return string|bool */ function get_error_msg() { if ( is_null( $this->parent_plugin_slug ) ) { @@ -521,4 +521,4 @@ public static function is_installing_or_updating_plugins() { return self::$is_installing_or_updating_plugins; } } -} \ No newline at end of file +} diff --git a/languages/amazon-web-services-en.pot b/languages/amazon-web-services-en.pot index 88b4390..7d1dae7 100644 --- a/languages/amazon-web-services-en.pot +++ b/languages/amazon-web-services-en.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: amazon-web-services\n" "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n" -"POT-Creation-Date: 2017-06-19 14:44+0100\n" +"POT-Creation-Date: 2017-11-20 14:50+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -31,7 +31,7 @@ msgid "Addons" msgstr "" #: classes/amazon-web-services.php:83 -#: classes/amazon-web-services.php:342 +#: classes/amazon-web-services.php:369 #: view/settings.php:16 msgid "Access Keys" msgstr "" @@ -44,53 +44,53 @@ msgstr "" msgid "Amazon Web Services: Addons" msgstr "" -#: classes/amazon-web-services.php:290 +#: classes/amazon-web-services.php:318 #, php-format msgid "" "You must first set your AWS access keys to use this addon." msgstr "" -#: classes/amazon-web-services.php:355 +#: classes/amazon-web-services.php:382 msgid "WP Offload S3 Lite" msgstr "" -#: classes/amazon-web-services.php:360 +#: classes/amazon-web-services.php:387 msgid "WP Offload S3" msgstr "" -#: classes/amazon-web-services.php:366 -msgid "Assets" +#: classes/amazon-web-services.php:393 +msgid "Assets Pull" msgstr "" -#: classes/amazon-web-services.php:370 +#: classes/amazon-web-services.php:397 msgid "Feature" msgstr "" -#: classes/amazon-web-services.php:416 +#: classes/amazon-web-services.php:443 msgctxt "Plugin already installed and activated" msgid "Installed & Activated" msgstr "" -#: classes/amazon-web-services.php:418 +#: classes/amazon-web-services.php:445 msgctxt "Plugin already installed" msgid "Installed" msgstr "" -#: classes/amazon-web-services.php:419 +#: classes/amazon-web-services.php:446 msgctxt "Activate plugin now" msgid "Activate Now" msgstr "" -#: classes/amazon-web-services.php:422 +#: classes/amazon-web-services.php:449 msgctxt "Install plugin now" msgid "Install Now" msgstr "" -#: classes/amazon-web-services.php:458 +#: classes/amazon-web-services.php:485 msgid "Visit Site" msgstr "" -#: classes/amazon-web-services.php:461 +#: classes/amazon-web-services.php:488 msgctxt "View plugin details" msgid "View Details" msgstr "" @@ -121,7 +121,7 @@ msgid "" "7.16.2+ compiled with OpenSSL and zlib. Your server currently has" msgstr "" -#: classes/aws-plugin-base.php:298 +#: classes/aws-plugin-base.php:360 msgid "Settings" msgstr "" @@ -217,38 +217,53 @@ msgstr "" msgid "You have enabled the use of IAM roles for Amazon EC2 instances." msgstr "" -#: view/settings.php:27 +#: view/settings.php:29 +msgid "" +"Please check your wp-config.php file as it looks like one of your defines is " +"missing or incorrect." +msgstr "" + +#: view/settings.php:35 +#, php-format msgid "" "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 (not " -"recommended), simply remove the lines from your wp-config." +"you’d prefer to manage them here and store them in the database (not recommended), simply remove the lines from your wp-" +"config." msgstr "" -#: view/settings.php:33 +#: view/settings.php:43 msgid "" "We recommend defining your Access Keys in wp-config.php so long as you " "don’t commit it to source control (you shouldn’t be). Simply " "copy the following snippet and replace the stars with the keys." msgstr "" -#: view/settings.php:40 +#: view/settings.php:51 +#, php-format +msgid "" +"You’re storing your Access Keys in the database (not " +"recommended)." +msgstr "" + +#: view/settings.php:57 msgid "" "If you’d rather store your Access Keys in the database, click here to reveal a form." msgstr "" -#: view/settings.php:56 +#: view/settings.php:74 msgid "Access Key ID:" msgstr "" -#: view/settings.php:62 +#: view/settings.php:80 msgid "Secret Access Key:" msgstr "" -#: view/settings.php:69 +#: view/settings.php:87 msgid "Save Changes" msgstr "" -#: view/settings.php:72 +#: view/settings.php:90 msgid "Remove Keys" msgstr "" diff --git a/readme.txt b/readme.txt index 6c208c9..8f0d0e1 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: bradt, deliciousbrains Tags: amazon, amazon web services Requires at least: 4.6 -Tested up to: 4.8 -Stable tag: 1.0.3 +Tested up to: 4.9 +Stable tag: 1.0.4 License: GPLv3 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 == Changelog == += 1.0.4 - 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 + = 1.0.3 - 2017-06-19 = * Improvement: Compatibility with WP Offload S3 1.5 diff --git a/view/settings.php b/view/settings.php index 46e71de..98d985e 100644 --- a/view/settings.php +++ b/view/settings.php @@ -3,7 +3,7 @@ use_ec2_iam_roles(); ?> - are_access_keys_set() && ! $use_ec2_iam_roles ) : ?> + needs_access_keys() ) : ?>

Check out the Quick Start Guide →', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/', array( @@ -23,8 +23,18 @@ are_prefixed_key_constants_set() || $this->are_key_constants_set() ) ) : ?> + are_access_keys_set() ) : ?> +

+

+ +

+
+ +

- + not recommended), 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( + 'utm_campaign' => 'support+docs', + ) ) ); ?>

@@ -36,9 +46,17 @@
define( 'DBI_AWS_ACCESS_KEY_ID', '********************' );
 define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************' );
-

- click here to reveal a form.', 'amazon-web-services' ); ?> -

+ get_access_key_id() || $this->get_secret_access_key() ) : ?> +

+ not recommended).', 'amazon-web-services' ), $this->dbrains_url( '/wp-offload-s3/doc/quick-start-guide/#save-access-keys', array( + 'utm_campaign' => 'support+docs', + ) ) ); ?> +

+ +

+ click here to reveal a form.', 'amazon-web-services' ); ?> +

+
get_access_key_id() && ! $this->get_secret_access_key() ) ? 'style="display: none;"' : ''; // xss ok ?>> @@ -79,4 +97,4 @@ - \ No newline at end of file +