Skip to content

Commit

Permalink
Deploying version 0.9.6
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Oct 1, 2015
1 parent 1090fa2 commit 87bd0a0
Show file tree
Hide file tree
Showing 22 changed files with 150 additions and 141 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Tags:** uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
**Requires at least:** 3.7
**Tested up to:** 4.3
**Stable tag:** 0.9.5
**Stable tag:** 0.9.6
**License:** GPLv3

Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
Expand Down Expand Up @@ -67,6 +67,10 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin

## Changelog ##

### 0.9.6 - 2015-10-01 ###

* Improvement: Update text domains for translate.wordpress.org integration

### 0.9.5 - 2015-09-01 ###
* Bug fix: Fatal error: Cannot use object of type WP_Error as array

Expand Down
1 change: 1 addition & 0 deletions assets/js/notice.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions classes/amazon-s3-and-cloudfront.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ function __construct( $plugin_file_path, $aws, $slug = null ) {
*/
function init( $plugin_file_path ) {
self::$plugin_page = $this->plugin_slug;
$this->plugin_title = __( 'Offload S3', 'as3cf' );
$this->plugin_menu_title = __( 'S3 and CloudFront', 'as3cf' );
$this->plugin_title = __( 'Offload S3', 'amazon-s3-and-cloudfront' );
$this->plugin_menu_title = __( 'S3 and CloudFront', 'amazon-s3-and-cloudfront' );

new AS3CF_Upgrade_Region_Meta( $this );
new AS3CF_Upgrade_File_Sizes( $this );
Expand Down Expand Up @@ -113,7 +113,7 @@ function init( $plugin_file_path ) {
// include compatibility code for other plugins
new AS3CF_Plugin_Compatibility( $this );

load_plugin_textdomain( 'as3cf', false, dirname( plugin_basename( $plugin_file_path ) ) . '/languages/' );
load_plugin_textdomain( 'amazon-s3-and-cloudfront', false, dirname( plugin_basename( $plugin_file_path ) ) . '/languages/' );

// Register modal scripts and styles
$this->register_modal_assets();
Expand Down Expand Up @@ -518,7 +518,7 @@ function upload_attachment_to_s3( $post_id, $data = null, $file_path = null, $fo

// Check file exists locally before attempting upload
if ( ! file_exists( $file_path ) ) {
return new WP_Error( 'exception', sprintf( __( 'File %s does not exist', 'as3cf' ), $file_path ) );
return new WP_Error( 'exception', sprintf( __( 'File %s does not exist', 'amazon-s3-and-cloudfront' ), $file_path ) );
}

$file_name = basename( $file_path );
Expand All @@ -527,7 +527,7 @@ function upload_attachment_to_s3( $post_id, $data = null, $file_path = null, $fo

// check mime type of file is in allowed S3 mime types
if ( ! in_array( $type, $allowed_types ) ) {
return new WP_Error( 'exception', sprintf( __( 'Mime type %s is not allowed', 'as3cf' ), $type ) );
return new WP_Error( 'exception', sprintf( __( 'Mime type %s is not allowed', 'amazon-s3-and-cloudfront' ), $type ) );
}

$acl = self::DEFAULT_ACL;
Expand Down Expand Up @@ -604,7 +604,7 @@ function upload_attachment_to_s3( $post_id, $data = null, $file_path = null, $fo
$s3client->putObject( $args );
}
catch ( Exception $e ) {
$error_msg = sprintf( __( 'Error uploading %s to S3: %s', 'as3cf' ), $file_path, $e->getMessage() );
$error_msg = sprintf( __( 'Error uploading %s to S3: %s', 'amazon-s3-and-cloudfront' ), $file_path, $e->getMessage() );
error_log( $error_msg );

return new WP_Error( 'exception', $error_msg );
Expand Down Expand Up @@ -1244,17 +1244,17 @@ function end_ajax( $return = array() ) {

function verify_ajax_request() {
if ( ! is_admin() || ! wp_verify_nonce( sanitize_key( $_POST['_nonce'] ), sanitize_key( $_POST['action'] ) ) ) { // input var okay
wp_die( __( 'Cheatin’ eh?', 'as3cf' ) );
wp_die( __( 'Cheatin’ eh?', 'amazon-s3-and-cloudfront' ) );
}

if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.', 'as3cf' ) );
wp_die( __( 'You do not have sufficient permissions to access this page.', 'amazon-s3-and-cloudfront' ) );
}
}

function ajax_check_bucket() {
if ( ! isset( $_POST['bucket_name'] ) || ! ( $bucket = sanitize_text_field( $_POST['bucket_name'] ) ) ) { // input var okay
$out = array( 'error' => __( 'No bucket name provided.', 'as3cf' ) );
$out = array( 'error' => __( 'No bucket name provided.', 'amazon-s3-and-cloudfront' ) );

$this->end_ajax( $out );
}
Expand Down Expand Up @@ -1529,8 +1529,8 @@ function get_bucket_region( $bucket ) {
try {
$region = $this->get_s3client()->getBucketLocation( array( 'Bucket' => $bucket ) );
} catch ( Exception $e ) {
$error_msg_title = '<strong>' . __( 'Error Getting Bucket Region', 'as3cf' ) . '</strong> &mdash;';
$error_msg = sprintf( __( 'There was an error attempting to get the region of the bucket %s: %s', 'as3cf' ), $bucket, $e->getMessage() );
$error_msg_title = '<strong>' . __( 'Error Getting Bucket Region', 'amazon-s3-and-cloudfront' ) . '</strong> &mdash;';
$error_msg = sprintf( __( 'There was an error attempting to get the region of the bucket %s: %s', 'amazon-s3-and-cloudfront' ), $bucket, $e->getMessage() );
error_log( $error_msg );

return new WP_Error( 'exception', $error_msg_title . $error_msg );
Expand Down Expand Up @@ -1650,7 +1650,7 @@ function check_write_permission( $bucket = null, $region = null ) {
}

$file_name = 'as3cf-permission-check.txt';
$file_contents = __( 'This is a test file to check if the user has write permission to S3. Delete me if found.', 'as3cf' );
$file_contents = __( 'This is a test file to check if the user has write permission to S3. Delete me if found.', 'amazon-s3-and-cloudfront' );

$path = $this->get_object_prefix();
$key = $path . $file_name;
Expand Down Expand Up @@ -1682,7 +1682,7 @@ function check_write_permission( $bucket = null, $region = null ) {
} catch ( Exception $e ) {
// if we encounter an error that isn't access denied, throw that error
if ( ! $e instanceof Aws\Common\Exception\ServiceResponseException || 'AccessDenied' !== $e->getExceptionCode() ) {
$error_msg = sprintf( __( 'There was an error attempting to check the permissions of the bucket %s: %s', 'as3cf' ), $bucket, $e->getMessage() );
$error_msg = sprintf( __( 'There was an error attempting to check the permissions of the bucket %s: %s', 'amazon-s3-and-cloudfront' ), $bucket, $e->getMessage() );
error_log( $error_msg );

return new WP_Error( 'exception', $error_msg );
Expand Down Expand Up @@ -1740,14 +1740,14 @@ function plugin_load() {
'as3cf',
array(
'strings' => array(
'create_bucket_error' => __( 'Error creating bucket', 'as3cf' ),
'create_bucket_name_short' => __( 'Bucket name too short.', 'as3cf' ),
'create_bucket_name_long' => __( 'Bucket name too long.', 'as3cf' ),
'create_bucket_invalid_chars' => __( 'Invalid character. Bucket names can contain lowercase letters, numbers, periods and hyphens.', 'as3cf' ),
'save_bucket_error' => __( 'Error saving bucket', 'as3cf' ),
'get_buckets_error' => __( 'Error fetching buckets', 'as3cf' ),
'get_url_preview_error' => __( 'Error getting URL preview: ', 'as3cf' ),
'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'as3cf' )
'create_bucket_error' => __( 'Error creating bucket', 'amazon-s3-and-cloudfront' ),
'create_bucket_name_short' => __( 'Bucket name too short.', 'amazon-s3-and-cloudfront' ),
'create_bucket_name_long' => __( 'Bucket name too long.', 'amazon-s3-and-cloudfront' ),
'create_bucket_invalid_chars' => __( 'Invalid character. Bucket names can contain lowercase letters, numbers, periods and hyphens.', 'amazon-s3-and-cloudfront' ),
'save_bucket_error' => __( 'Error saving bucket', 'amazon-s3-and-cloudfront' ),
'get_buckets_error' => __( 'Error fetching buckets', 'amazon-s3-and-cloudfront' ),
'get_url_preview_error' => __( 'Error getting URL preview: ', 'amazon-s3-and-cloudfront' ),
'save_alert' => __( 'The changes you made will be lost if you navigate away from this page', 'amazon-s3-and-cloudfront' )
),
'nonces' => array(
'create_bucket' => wp_create_nonce( 'as3cf-create-bucket' ),
Expand Down Expand Up @@ -1805,7 +1805,7 @@ function handle_post_request() {
}

if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['_wpnonce'] ), $this->get_settings_nonce_key() ) ) { // input var okay
die( __( "Cheatin' eh?", 'as3cf' ) );
die( __( "Cheatin' eh?", 'amazon-s3-and-cloudfront' ) );
}

do_action( 'as3cf_pre_save_settings' );
Expand Down Expand Up @@ -1908,8 +1908,8 @@ function render_page() {
*/
function get_settings_tabs() {
$tabs = array(
'media' => _x( 'Media Library', 'Show the media library tab', 'as3cf' ),
'support' => _x( 'Support', 'Show the support tab', 'as3cf' )
'media' => _x( 'Media Library', 'Show the media library tab', 'amazon-s3-and-cloudfront' ),
'support' => _x( 'Support', 'Show the support tab', 'amazon-s3-and-cloudfront' )
);

return apply_filters( 'as3cf_settings_tabs', $tabs );
Expand Down Expand Up @@ -2045,7 +2045,7 @@ function make_acl_admin_notice_text( $s3object ) {
$filename = basename( $s3object['key'] );
$acl = $this->get_acl_display_name( $s3object['acl'] );

return sprintf( __( 'The file %s has been given %s permissions on Amazon S3.', 'as3cf' ), "<strong>{$filename}</strong>", "<strong>{$acl}</strong>" );
return sprintf( __( 'The file %s has been given %s permissions on Amazon S3.', 'amazon-s3-and-cloudfront' ), "<strong>{$filename}</strong>", "<strong>{$acl}</strong>" );
}

/**
Expand Down Expand Up @@ -2546,11 +2546,11 @@ public function get_attachment_file_paths( $attachment_id, $exists_locally = tru
* @return string
*/
function get_access_denied_notice_message( $single = true ) {
$quick_start = sprintf( '<a class="js-link" href="%s">%s</a>', 'https://deliciousbrains.com/wp-offload-s3/doc/quick-start-guide/', __( 'Quick Start Guide', 'as3cf' ) );
$quick_start = sprintf( '<a class="js-link" href="%s">%s</a>', 'https://deliciousbrains.com/wp-offload-s3/doc/quick-start-guide/', __( 'Quick Start Guide', 'amazon-s3-and-cloudfront' ) );

$message = sprintf( __( "Looks like we don't have write access to this bucket. It's likely that the user you've provided access keys for hasn't been granted the correct permissions. Please see our %s for instructions on setting up permissions correctly.", 'as3cf' ), $quick_start );
$message = sprintf( __( "Looks like we don't have write access to this bucket. It's likely that the user you've provided access keys for hasn't been granted the correct permissions. Please see our %s for instructions on setting up permissions correctly.", 'amazon-s3-and-cloudfront' ), $quick_start );
if ( ! $single ) {
$message = sprintf( __( "Looks like we don't have access to the buckets. It's likely that the user you've provided access keys for hasn't been granted the correct permissions. Please see our %s for instructions on setting up permissions correctly.", 'as3cf' ), $quick_start );
$message = sprintf( __( "Looks like we don't have access to the buckets. It's likely that the user you've provided access keys for hasn't been granted the correct permissions. Please see our %s for instructions on setting up permissions correctly.", 'amazon-s3-and-cloudfront' ), $quick_start );

}

Expand Down
2 changes: 1 addition & 1 deletion classes/as3cf-plugin-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ protected function copy_s3_file_to_server( $s3_object, $file ) {
)
);
} catch ( Exception $e ) {
error_log( sprintf( __( 'There was an error attempting to download the file %s from S3: %s', 'as3cf' ), $s3_object['key'], $e->getMessage() ) );
error_log( sprintf( __( 'There was an error attempting to download the file %s from S3: %s', 'amazon-s3-and-cloudfront' ), $s3_object['key'], $e->getMessage() ) );

return false;
}
Expand Down
14 changes: 7 additions & 7 deletions classes/as3cf-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,17 @@ function maybe_display_notices() {

switch ( $this->get_upgrade_status() ) {
case self::STATUS_RUNNING:
$msg = sprintf( __( '<strong>Running %s Update</strong> &mdash; We&#8217;re going through all the Media Library items uploaded to S3 %s This will be done quietly in the background, processing a small batch of Media Library items every %d minutes. There should be no noticeable impact on your server&#8217;s performance.', 'as3cf' ), ucfirst( $this->upgrade_type ), $this->running_update_text, $this->cron_interval_in_minutes );
$action_text = __( 'Pause Update', 'as3cf' );
$msg = sprintf( __( '<strong>Running %s Update</strong> &mdash; We&#8217;re going through all the Media Library items uploaded to S3 %s This will be done quietly in the background, processing a small batch of Media Library items every %d minutes. There should be no noticeable impact on your server&#8217;s performance.', 'amazon-s3-and-cloudfront' ), ucfirst( $this->upgrade_type ), $this->running_update_text, $this->cron_interval_in_minutes );
$action_text = __( 'Pause Update', 'amazon-s3-and-cloudfront' );
$action_url = $this->as3cf->get_plugin_page_url( array( 'action' => 'pause_update', 'update' => $this->upgrade_name ), 'self' );
break;
case self::STATUS_PAUSED:
$msg = sprintf( __( '<strong>%s Update Paused</strong> &mdash; Updating Media Library %s has been paused.', 'as3cf' ), ucfirst( $this->upgrade_type ), $this->upgrade_type );
$action_text = __( 'Restart Update', 'as3cf' );
$msg = sprintf( __( '<strong>%s Update Paused</strong> &mdash; Updating Media Library %s has been paused.', 'amazon-s3-and-cloudfront' ), ucfirst( $this->upgrade_type ), $this->upgrade_type );
$action_text = __( 'Restart Update', 'amazon-s3-and-cloudfront' );
break;
case self::STATUS_ERROR:
$msg = sprintf( __( '<strong>Error Updating %s</strong> &mdash; We ran into some errors attempting to update the %s for all your Media Library items that have been uploaded to S3. Please check your error log for details.', 'as3cf' ), ucfirst( $this->upgrade_type ), $this->upgrade_type );
$action_text = __( 'Try Run It Again', 'as3cf' );
$msg = sprintf( __( '<strong>Error Updating %s</strong> &mdash; We ran into some errors attempting to update the %s for all your Media Library items that have been uploaded to S3. Please check your error log for details.', 'amazon-s3-and-cloudfront' ), ucfirst( $this->upgrade_type ), $this->upgrade_type );
$action_text = __( 'Try Run It Again', 'amazon-s3-and-cloudfront' );
$msg_type = 'error';
break;
default:
Expand Down Expand Up @@ -388,7 +388,7 @@ function cron_schedules( $schedules ) {
// Add the upgrade interval to the existing schedules.
$schedules[ $this->cron_schedule_key ] = array(
'interval' => $this->cron_interval_in_minutes * 60,
'display' => sprintf( __( 'Every %d Minutes', 'as3cf' ), $this->cron_interval_in_minutes ),
'display' => sprintf( __( 'Every %d Minutes', 'amazon-s3-and-cloudfront' ), $this->cron_interval_in_minutes ),
);

return $schedules;
Expand Down
2 changes: 1 addition & 1 deletion classes/upgrades/as3cf-file-sizes.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct( $as3cf ) {
$this->upgrade_name = 'file_sizes';
$this->upgrade_type = 'attachments';

$this->running_update_text = __( 'and updating the metadata with the sizes of files that have been removed from the server. This will allow us to serve the correct size for media items and the total space used in Multisite subsites.', 'as3cf' );
$this->running_update_text = __( 'and updating the metadata with the sizes of files that have been removed from the server. This will allow us to serve the correct size for media items and the total space used in Multisite subsites.', 'amazon-s3-and-cloudfront' );

parent::__construct( $as3cf );
}
Expand Down
4 changes: 2 additions & 2 deletions classes/upgrades/as3cf-meta-wp-error.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct( $as3cf ) {
$this->upgrade_name = 'meta_error';
$this->upgrade_type = 'attachments';

$this->running_update_text = __( 'and rebuilding the metadata for attachments that may have been corrupted.', 'as3cf' );
$this->running_update_text = __( 'and rebuilding the metadata for attachments that may have been corrupted.', 'amazon-s3-and-cloudfront' );

parent::__construct( $as3cf );
}
Expand Down Expand Up @@ -69,7 +69,7 @@ function upgrade_attachment( $attachment ) {
);
$this->as3cf->get_s3client( $s3object['region'], true )->getObject( $args );
} catch ( Exception $e ) {
error_log( sprintf( __( 'There was an error attempting to download the file %s from S3: %s', 'as3cf' ), $s3object['key'], $e->getMessage() ) );
error_log( sprintf( __( 'There was an error attempting to download the file %s from S3: %s', 'amazon-s3-and-cloudfront' ), $s3object['key'], $e->getMessage() ) );

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/upgrades/as3cf-region-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct( $as3cf ) {
$this->upgrade_name = 'meta_with_region';
$this->upgrade_type = 'metadata';

$this->running_update_text = __( 'and updating the metadata with the bucket region it is served from. This will allow us to serve your files from the proper S3 region subdomain <span style="white-space:nowrap;">(e.g. s3-us-west-2.amazonaws.com)</span>.', 'as3cf' );
$this->running_update_text = __( 'and updating the metadata with the bucket region it is served from. This will allow us to serve your files from the proper S3 region subdomain <span style="white-space:nowrap;">(e.g. s3-us-west-2.amazonaws.com)</span>.', 'amazon-s3-and-cloudfront' );

parent::__construct( $as3cf );
}
Expand Down
Loading

0 comments on commit 87bd0a0

Please sign in to comment.