WP Offload S3 Lite - Version 2.1.1

Version Description

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

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

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

Download this release

Release Info

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

Code changes from version 2.1 to 2.1.1

README.md CHANGED
@@ -1,10 +1,10 @@
1
- # WP Offload Media Lite for Amazon S3 and DigitalOcean Spaces #
2
**Contributors:** bradt, deliciousbrains, ianmjones
3
**Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
**Requires at least:** 4.7
5
- **Tested up to:** 5.1
6
**Requires PHP:** 5.5
7
- **Stable tag:** 2.1
8
**License:** GPLv3
9
10
Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
@@ -61,16 +61,16 @@ If you upgrade to the pro version of [WP Offload Media](https://deliciousbrains.
61
## Screenshots ##
62
63
### 1. Select Cloud Storage Provider ###
64
- ![Select Cloud Storage Provider](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-1.png)
65
66
### 2. Select or Create Bucket ###
67
- ![Select or Create Bucket](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-2.png)
68
69
### 3. Settings Screen ###
70
- ![Settings Screen](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-3.png)
71
72
### 4. Custom Domain Used With CDN ###
73
- ![Custom Domain Used With CDN](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3-and-digitalocean-spaces/assets/screenshot-4.png)
74
75
76
## Upgrade Notice ##
@@ -86,6 +86,17 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
86
87
## Changelog ##
88
89
### WP Offload Media Lite 2.1 - 2019-03-05 ###
90
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-2-1-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
91
* New: Google Cloud Storage is now supported
1
+ # WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage #
2
**Contributors:** bradt, deliciousbrains, ianmjones
3
**Tags:** uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
**Requires at least:** 4.7
5
+ **Tested up to:** 5.2
6
**Requires PHP:** 5.5
7
+ **Stable tag:** 2.2-dev
8
**License:** GPLv3
9
10
Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
61
## Screenshots ##
62
63
### 1. Select Cloud Storage Provider ###
64
+ ![Select Cloud Storage Provider](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3,-digitalocean-spaces,-and-google-cloud-storage/assets/screenshot-1.png)
65
66
### 2. Select or Create Bucket ###
67
+ ![Select or Create Bucket](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3,-digitalocean-spaces,-and-google-cloud-storage/assets/screenshot-2.png)
68
69
### 3. Settings Screen ###
70
+ ![Settings Screen](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3,-digitalocean-spaces,-and-google-cloud-storage/assets/screenshot-3.png)
71
72
### 4. Custom Domain Used With CDN ###
73
+ ![Custom Domain Used With CDN](https://raw.githubusercontent.com/deliciousbrains/wp-wp-offload-media-lite-for-amazon-s3,-digitalocean-spaces,-and-google-cloud-storage/assets/screenshot-4.png)
74
75
76
## Upgrade Notice ##
86
87
## Changelog ##
88
89
+ ### WP Offload Media Lite 2.1.1 - 2019-04-29 ###
90
+ * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
91
+ * Improvement: Local to Provider content filtering performance improvements
92
+ * Improvement: Warning notice shown when changing storage provider and media already offloaded
93
+ * Bug fix: Media title not retaining characters stripped from filename
94
+ * Bug fix: Warning: is_readable(): open_basedir restriction in effect. File(~/.aws/config) is not within the allowed path(s)
95
+ * Bug fix: Fatal error when GCS Key File not accessible
96
+ * Bug fix: Non-image offloads on subsites with 4 digit IDs get duplicate subsite ID in bucket path
97
+ * Bug fix: No srcset added to img tag if filename includes non-ASCII characters
98
+ * Bug fix: Full size image URL saved to img tag src attribute when thumbnail picked if filename includes non-ASCII characters
99
+
100
### WP Offload Media Lite 2.1 - 2019-03-05 ###
101
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-2-1-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
102
* New: Google Cloud Storage is now supported
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -188,8 +188,7 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
188
add_filter( 'wp_video_shortcode', array( $this, 'wp_media_shortcode' ), 100, 5 );
189
190
// Communication with provider, plugin needs to be setup
191
- add_filter( 'wp_handle_upload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
192
- add_filter( 'wp_handle_sideload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
193
add_filter( 'wp_update_attachment_metadata', array( $this, 'wp_update_attachment_metadata' ), 110, 2 );
194
add_filter( 'delete_attachment', array( $this, 'delete_attachment' ), 20 );
195
add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 );
@@ -1431,17 +1430,17 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
1431
*
1432
* @param string $url
1433
*
1434
- * @return null|string
1435
*/
1436
function get_folder_time_from_url( $url ) {
1437
if ( ! is_string( $url ) ) {
1438
return null;
1439
}
1440
1441
- preg_match( '@[0-9]{4}/[0-9]{2}@', $url, $matches );
1442
1443
if ( isset( $matches[0] ) ) {
1444
- return $matches[0];
1445
}
1446
1447
return null;
@@ -1490,19 +1489,23 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
1490
}
1491
1492
/**
1493
- * Filter file details before upload.
1494
*
1495
- * @param array $file An array of data for a single file.
1496
*
1497
- * @return array $file The altered file array with AWS unique filename.
1498
*/
1499
- public function wp_handle_upload_prefilter( $file ) {
1500
// Get Post ID if uploaded in post screen.
1501
$post_id = filter_input( INPUT_POST, 'post_id', FILTER_VALIDATE_INT );
1502
1503
- $file['name'] = $this->filter_unique_filename( $file['name'], $post_id );
1504
1505
- return $file;
1506
}
1507
1508
/**
@@ -1510,22 +1513,20 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
1510
* This only applies when the remove local file option is enabled.
1511
*
1512
* @param string $filename Unique file name.
1513
* @param int $post_id Attachment's parent Post ID.
1514
*
1515
* @return string
1516
*/
1517
- public function filter_unique_filename( $filename, $post_id = null ) {
1518
if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup( true ) ) {
1519
return $filename;
1520
}
1521
1522
// sanitize the file name before we begin processing
1523
$filename = sanitize_file_name( $filename );
1524
-
1525
- // Get base filename without extension.
1526
- $ext = pathinfo( $filename, PATHINFO_EXTENSION );
1527
- $ext = $ext ? ".$ext" : '';
1528
- $name = wp_basename( $filename, $ext );
1529
1530
// Edge case: if file is named '.ext', treat as an empty name.
1531
if ( $name === $ext ) {
@@ -4276,15 +4277,18 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4276
*
4277
* @param string $prefix
4278
* @param null|bool $uploaded_to_provider
4279
- * null - All attachments
4280
- * true - Attachments only uploaded to S3
4281
- * false - Attachments not uploaded to S3
4282
*
4283
* @return int
4284
*/
4285
- public function count_attachments( $prefix, $uploaded_to_provider = null ) {
4286
global $wpdb;
4287
4288
$sql = "SELECT COUNT(DISTINCT p.ID)
4289
FROM `{$prefix}posts` p";
4290
@@ -4297,11 +4301,19 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4297
4298
$operator = $uploaded_to_provider ? 'not ' : '';
4299
$where .= " AND pm.`post_id` is {$operator}null";
4300
}
4301
4302
$sql .= ' ' . $where;
4303
4304
- return (int) $wpdb->get_var( $sql );
4305
}
4306
4307
/**
@@ -4789,9 +4801,9 @@ class Amazon_S3_And_CloudFront extends AS3CF_Plugin_Base {
4789
$siteurl = trailingslashit( get_option( 'siteurl' ) );
4790
4791
if ( is_multisite() && ! $this->is_current_blog( get_current_blog_id() ) && 0 !== strpos( $url, $siteurl ) ) {
4792
- // Replace network URL with subsite's URL.
4793
- $network_siteurl = trailingslashit( network_site_url() );
4794
- $url = str_replace( $network_siteurl, $siteurl, $url );
4795
}
4796
4797
return $url;
188
add_filter( 'wp_video_shortcode', array( $this, 'wp_media_shortcode' ), 100, 5 );
189
190
// Communication with provider, plugin needs to be setup
191
+ add_filter( 'wp_unique_filename', array( $this, 'wp_unique_filename' ), 10, 3 );
192
add_filter( 'wp_update_attachment_metadata', array( $this, 'wp_update_attachment_metadata' ), 110, 2 );
193
add_filter( 'delete_attachment', array( $this, 'delete_attachment' ), 20 );
194
add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 );
1430
*
1431
* @param string $url
1432
*
1433
+ * @return null|string YYYY/MM format.
1434
*/
1435
function get_folder_time_from_url( $url ) {
1436
if ( ! is_string( $url ) ) {
1437
return null;
1438
}
1439
1440
+ preg_match( '@[0-9]{4}/[0-9]{2}/@', $url, $matches );
1441
1442
if ( isset( $matches[0] ) ) {
1443
+ return untrailingslashit( $matches[0] );
1444
}
1445
1446
return null;
1489
}
1490
1491
/**
1492
+ * Filters the result when generating a unique file name.
1493
+ *
1494
+ * @param string $filename Unique file name.
1495
+ * @param string $ext File extension, eg. ".png".
1496
+ * @param string $dir Directory path.
1497
*
1498
+ * @return string
1499
+ * @since 4.5.0
1500
*
1501
*/
1502
+ public function wp_unique_filename( $filename, $ext, $dir ) {
1503
// Get Post ID if uploaded in post screen.
1504
$post_id = filter_input( INPUT_POST, 'post_id', FILTER_VALIDATE_INT );
1505
1506
+ $filename = $this->filter_unique_filename( $filename, $ext, $dir, $post_id );
1507
1508
+ return $filename;
1509
}
1510
1511
/**
1513
* This only applies when the remove local file option is enabled.
1514
*
1515
* @param string $filename Unique file name.
1516
+ * @param string $ext File extension, eg. ".png".
1517
+ * @param string $dir Directory path.
1518
* @param int $post_id Attachment's parent Post ID.
1519
*
1520
* @return string
1521
*/
1522
+ public function filter_unique_filename( $filename, $ext, $dir, $post_id = null ) {
1523
if ( ! $this->get_setting( 'copy-to-s3' ) || ! $this->is_plugin_setup( true ) ) {
1524
return $filename;
1525
}
1526
1527
// sanitize the file name before we begin processing
1528
$filename = sanitize_file_name( $filename );
1529
+ $name = wp_basename( $filename, $ext );
1530
1531
// Edge case: if file is named '.ext', treat as an empty name.
1532
if ( $name === $ext ) {
4277
*
4278
* @param string $prefix
4279
* @param null|bool $uploaded_to_provider
4280
+ * null - All attachments
4281
+ * true - Attachments only uploaded to provider
4282
+ * false - Attachments not uploaded to provider
4283
+ * @param bool $skip_transient Whether to force database query and skip transient, default false
4284
*
4285
* @return int
4286
*/
4287
+ public function count_attachments( $prefix, $uploaded_to_provider = null, $skip_transient = false ) {
4288
global $wpdb;
4289
4290
+ $transient_key = 'as3cf_' . $prefix . '_media_count';
4291
+
4292
$sql = "SELECT COUNT(DISTINCT p.ID)
4293
FROM `{$prefix}posts` p";
4294
4301
4302
$operator = $uploaded_to_provider ? 'not ' : '';
4303
$where .= " AND pm.`post_id` is {$operator}null";
4304
+
4305
+ $transient_key .= ( $uploaded_to_provider ) ? '_offloaded' : 'not_offloaded';
4306
}
4307
4308
$sql .= ' ' . $where;
4309
4310
+ if ( true === $skip_transient || false === ( $count = get_site_transient( $transient_key ) ) ) {
4311
+ $count = (int) $wpdb->get_var( $sql );
4312
+
4313
+ set_site_transient( $transient_key, $count, 2 * MINUTE_IN_SECONDS );
4314
+ }
4315
+
4316
+ return $count;
4317
}
4318
4319
/**
4801
$siteurl = trailingslashit( get_option( 'siteurl' ) );
4802
4803
if ( is_multisite() && ! $this->is_current_blog( get_current_blog_id() ) && 0 !== strpos( $url, $siteurl ) ) {
4804
+ // Replace original URL with subsite's current URL.
4805
+ $orig_siteurl = trailingslashit( apply_filters( 'as3cf_get_orig_siteurl', network_site_url() ) );
4806
+ $url = str_replace( $orig_siteurl, $siteurl, $url );
4807
}
4808
4809
return $url;
classes/as3cf-filter.php CHANGED
@@ -421,7 +421,15 @@ abstract class AS3CF_Filter {
421
$attachment_id = null;
422
$bare_url = AS3CF_Utils::reduce_url( $url );
423
424
- if ( isset( $cache[ $bare_url ] ) ) {
425
$attachment_id = $cache[ $bare_url ];
426
427
if ( $this->is_failure( $attachment_id ) ) {
@@ -493,7 +501,7 @@ abstract class AS3CF_Filter {
493
return false;
494
}
495
496
- $base_url = AS3CF_Utils::reduce_url( $this->get_base_url( $attachment_id ) );
497
$basename = wp_basename( $base_url );
498
499
// Add full size URL
@@ -501,10 +509,10 @@ abstract class AS3CF_Filter {
501
502
// Add additional image size URLs
503
foreach ( $meta['sizes'] as $size ) {
504
- $base_urls[] = str_replace( $basename, $size['file'], $base_url );
505
}
506
507
- $url = AS3CF_Utils::reduce_url( $url );
508
509
if ( in_array( $url, $base_urls ) ) {
510
// Match found, return true
@@ -582,10 +590,10 @@ abstract class AS3CF_Filter {
582
return null;
583
}
584
585
- $basename = wp_basename( $this->as3cf->maybe_remove_query_string( $url ) );
586
587
foreach ( $meta['sizes'] as $size => $file ) {
588
- if ( $basename === $file['file'] ) {
589
return $size;
590
}
591
}
@@ -651,7 +659,7 @@ abstract class AS3CF_Filter {
651
/**
652
* Get post cache
653
*
654
- * @param null|int|WP_Post $post Optional. Post ID or post object. Defaults to current post.
655
*
656
* @return array
657
*/
@@ -678,8 +686,8 @@ abstract class AS3CF_Filter {
678
/**
679
* Set the cache for the given post.
680
*
681
- * @param null|int|WP_Post $post Optional. Post ID or post object. Defaults to current post.
682
- * @param $data
683
*/
684
protected function set_post_cache( $post, $data ) {
685
$post_id = AS3CF_Utils::get_post_id( $post );
@@ -905,8 +913,8 @@ abstract class AS3CF_Filter {
905
}
906
907
if ( ! empty( $merge_cache ) ) {
908
- $add_cache_keys = array_map( 'AS3CF_Utils::reduce_url', array_keys( $merge_cache ) );
909
- $merge_cache = array_combine( $add_cache_keys, $merge_cache );
910
}
911
912
return array_merge( $existing_cache, $merge_cache );
421
$attachment_id = null;
422
$bare_url = AS3CF_Utils::reduce_url( $url );
423
424
+ // If attachment ID recently or previously cached, skip full search.
425
+ if ( isset( $to_cache[ $bare_url ] ) ) {
426
+ $attachment_id = $to_cache[ $bare_url ];
427
+
428
+ if ( $this->is_failure( $attachment_id ) ) {
429
+ // Attachment ID failure, continue
430
+ continue;
431
+ }
432
+ } elseif ( isset( $cache[ $bare_url ] ) ) {
433
$attachment_id = $cache[ $bare_url ];
434
435
if ( $this->is_failure( $attachment_id ) ) {
501
return false;
502
}
503
504
+ $base_url = $this->as3cf->encode_filename_in_path( AS3CF_Utils::reduce_url( $this->get_base_url( $attachment_id ) ) );
505
$basename = wp_basename( $base_url );
506
507
// Add full size URL
509
510
// Add additional image size URLs
511
foreach ( $meta['sizes'] as $size ) {
512
+ $base_urls[] = str_replace( $basename, $this->as3cf->encode_filename_in_path( $size['file'] ), $base_url );
513
}
514
515
+ $url = $this->as3cf->encode_filename_in_path( AS3CF_Utils::reduce_url( $url ) );
516
517
if ( in_array( $url, $base_urls ) ) {
518
// Match found, return true
590
return null;
591
}
592
593
+ $basename = $this->as3cf->encode_filename_in_path( wp_basename( $this->as3cf->maybe_remove_query_string( $url ) ) );
594
595
foreach ( $meta['sizes'] as $size => $file ) {
596
+ if ( $basename === $this->as3cf->encode_filename_in_path( $file['file'] ) ) {
597
return $size;
598
}
599
}
659
/**
660
* Get post cache
661
*
662
+ * @param null|int|WP_Post $post Optional. Post ID or post object. Defaults to current post.
663
*
664
* @return array
665
*/
686
/**
687
* Set the cache for the given post.
688
*
689
+ * @param null|int|WP_Post $post Optional. Post ID or post object. Defaults to current post.
690
+ * @param $data
691
*/
692
protected function set_post_cache( $post, $data ) {
693
$post_id = AS3CF_Utils::get_post_id( $post );
913
}
914
915
if ( ! empty( $merge_cache ) ) {
916
+ $add_cache_keys = array_map( 'AS3CF_Utils::reduce_url', array_keys( $merge_cache ) );
917
+ $merge_cache = array_combine( $add_cache_keys, $merge_cache );
918
}
919
920
return array_merge( $existing_cache, $merge_cache );
classes/as3cf-plugin-compatibility.php CHANGED
@@ -67,12 +67,16 @@ class AS3CF_Plugin_Compatibility {
67
/*
68
* Responsive Images WP 4.4
69
*/
70
add_filter( 'wp_calculate_image_srcset', array( $this, 'wp_calculate_image_srcset' ), 10, 5 );
71
add_filter( 'wp_calculate_image_srcset_meta', array( $this, 'wp_calculate_image_srcset_meta' ), 10, 4 );
72
73
// Maybe warn about PHP version if in admin screens.
74
add_action( 'admin_init', array( $this, 'maybe_warn_about_php_version' ) );
75
76
if ( $this->as3cf->is_plugin_setup( true ) ) {
77
$this->compatibility_init_if_setup();
78
}
@@ -610,7 +614,6 @@ class AS3CF_Plugin_Compatibility {
610
611
$client = $this->as3cf->get_provider_client( $region, true );
612
613
-
614
if ( ! empty( $client ) && $client->register_stream_wrapper( $region ) ) {
615
self::$stream_wrappers[ $stored_region ] = $client;
616
@@ -648,6 +651,40 @@ class AS3CF_Plugin_Compatibility {
648
return $url;
649
}
650
651
/**
652
* Adds 'srcset' and 'sizes' attributes to an existing S3 'img' element.
653
*
@@ -763,22 +800,22 @@ class AS3CF_Plugin_Compatibility {
763
return $image_meta;
764
}
765
766
- $image_basename = wp_basename( $image_meta['file'] );
767
768
- if ( false === strpos( $provider_object['key'], $image_basename ) ) {
769
// Not the correct attachment, abort
770
return $image_meta;
771
}
772
773
- // Strip the meta file prefix so the just the filename will always match
774
// the S3 URL regardless of different prefixes for the offloaded file.
775
// Also ensure filename is encoded the same way as URL.
776
- $image_meta['file'] = rawurlencode( $image_basename );
777
778
// Ensure each size filename is encoded the same way as URL.
779
if ( ! empty( $image_meta['sizes'] ) ) {
780
$image_meta['sizes'] = array_map( function ( $size ) {
781
- $size['file'] = rawurlencode( $size['file'] );
782
783
return $size;
784
}, $image_meta['sizes'] );
@@ -861,7 +898,7 @@ class AS3CF_Plugin_Compatibility {
861
// Get parent Post ID for cropped image.
862
$post_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
863
864
- $filename = $this->as3cf->filter_unique_filename( $filename, $post_id );
865
866
return $filename;
867
}
@@ -937,4 +974,19 @@ class AS3CF_Plugin_Compatibility {
937
938
return $dispatch_result;
939
}
940
}
67
/*
68
* Responsive Images WP 4.4
69
*/
70
+ add_filter( 'wp_get_attachment_metadata', array( $this, 'wp_get_attachment_metadata' ), 10, 2 );
71
add_filter( 'wp_calculate_image_srcset', array( $this, 'wp_calculate_image_srcset' ), 10, 5 );
72
add_filter( 'wp_calculate_image_srcset_meta', array( $this, 'wp_calculate_image_srcset_meta' ), 10, 4 );
73
74
// Maybe warn about PHP version if in admin screens.
75
add_action( 'admin_init', array( $this, 'maybe_warn_about_php_version' ) );
76
77
+ // WordPress MU Domain Mapping plugin compatibility.
78
+ add_filter( 'as3cf_get_orig_siteurl', array( $this, 'get_orig_siteurl' ) );
79
+
80
if ( $this->as3cf->is_plugin_setup( true ) ) {
81
$this->compatibility_init_if_setup();
82
}
614
615
$client = $this->as3cf->get_provider_client( $region, true );
616
617
if ( ! empty( $client ) && $client->register_stream_wrapper( $region ) ) {
618
self::$stream_wrappers[ $stored_region ] = $client;
619
651
return $url;
652
}
653
654
+ /**
655
+ * Fixes comparison of attachment metadata to already urlencoded content during 'the_content' filter.
656
+ *
657
+ * @param array $data
658
+ * @param int $attachment_id
659
+ *
660
+ * @return array
661
+ */
662
+ public function wp_get_attachment_metadata( $data, $attachment_id ) {
663
+ global $wp_current_filter;
664
+
665
+ if (
666
+ is_array( $wp_current_filter ) &&
667
+ ! empty( $wp_current_filter[0] ) &&
668
+ 'the_content' === $wp_current_filter[0] &&
669
+ $this->as3cf->is_attachment_served_by_provider( $attachment_id )
670
+ ) {
671
+ // Ensure each filename is encoded the same way as URL, slightly fixed up for wp_basename() manipulation compatibility.
672
+ if ( ! empty( $data['file'] ) ) {
673
+ $data['file'] = $this->as3cf->encode_filename_in_path( $data['file'] );
674
+ }
675
+
676
+ if ( ! empty( $data['sizes'] ) ) {
677
+ $data['sizes'] = array_map( function ( $size ) {
678
+ $size['file'] = $this->as3cf->encode_filename_in_path( $size['file'] );
679
+
680
+ return $size;
681
+ }, $data['sizes'] );
682
+ }
683
+ }
684
+
685
+ return $data;
686
+ }
687
+
688
/**
689
* Adds 'srcset' and 'sizes' attributes to an existing S3 'img' element.
690
*
800
return $image_meta;
801
}
802
803
+ $image_basename = $this->as3cf->encode_filename_in_path( wp_basename( $image_meta['file'] ) );
804
805
+ if ( false === strpos( $this->as3cf->encode_filename_in_path( $provider_object['key'] ), $image_basename ) ) {
806
// Not the correct attachment, abort
807
return $image_meta;
808
}
809
810
+ // Strip the meta file prefix so that just the filename will always match
811
// the S3 URL regardless of different prefixes for the offloaded file.
812
// Also ensure filename is encoded the same way as URL.
813
+ $image_meta['file'] = $image_basename;
814
815
// Ensure each size filename is encoded the same way as URL.
816
if ( ! empty( $image_meta['sizes'] ) ) {
817
$image_meta['sizes'] = array_map( function ( $size ) {
818
+ $size['file'] = $this->as3cf->encode_filename_in_path( $size['file'] );
819
820
return $size;
821
}, $image_meta['sizes'] );
898
// Get parent Post ID for cropped image.
899
$post_id = filter_input( INPUT_POST, 'id', FILTER_VALIDATE_INT );
900
901
+ $filename = $this->as3cf->filter_unique_filename( $filename, $ext, $dir, $post_id );
902
903
return $filename;
904
}
974
975
return $dispatch_result;
976
}
977
+
978
+ /**
979
+ * Domain Mapping may have overridden the original siteurl that is needed for search/replace.
980
+ *
981
+ * @param string $siteurl
982
+ *
983
+ * @return mixed
984
+ */
985
+ public function get_orig_siteurl( $siteurl ) {
986
+ if ( defined( 'DOMAIN_MAPPING' ) && function_exists( 'get_original_url' ) ) {
987
+ $siteurl = get_original_url( 'siteurl' );
988
+ }
989
+
990
+ return $siteurl;
991
+ }
992
}
classes/filters/as3cf-local-to-s3.php CHANGED
@@ -129,23 +129,38 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
129
* @return array
130
*/
131
private function get_bare_upload_base_urls() {
132
- $base_urls = array();
133
134
- $uploads = wp_upload_dir();
135
- $base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
136
- $base_url = AS3CF_Utils::remove_scheme( $base_url );
137
- $domain = AS3CF_Utils::parse_url( $uploads['baseurl'], PHP_URL_HOST );
138
-
139
- /**
140
- * Allow alteration of the local domains that can be matched on.
141
- *
142
- * @param array $domains
143
- */
144
- $domains = apply_filters( 'as3cf_local_domains', (array) $domain );
145
-
146
- if ( ! empty( $domains ) ) {
147
- foreach ( array_unique( $domains ) as $match_domain ) {
148
- $base_urls[] = substr_replace( $base_url, $match_domain, 2, strlen( $domain ) );
149
}
150
}
151
@@ -249,36 +264,40 @@ class AS3CF_Local_To_S3 extends AS3CF_Filter {
249
250
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
251
252
- $paths[ $path ] = $full_url;
253
- $full_urls[ $full_url ] = $url;
254
- $meta_values[] = "'" . esc_sql( $path ) . "'";
255
}
256
257
if ( ! empty( $meta_values ) ) {
258
$sql = "
259
SELECT post_id, meta_value FROM {$wpdb->postmeta}
260
WHERE meta_key = '_wp_attached_file'
261
- AND meta_value IN ( " . implode( ',', $meta_values ) . " )
262
";
263
264
$query_results = $wpdb->get_results( $sql );
265
266
if ( ! empty( $query_results ) ) {
267
foreach ( $query_results as $postmeta ) {
268
- $attachment_id = (int) $postmeta->post_id;
269
- $full_url = $paths[ $postmeta->meta_value ];
270
- $this->query_cache[ $full_url ] = $attachment_id;
271
- $results[ $full_urls[ $full_url ] ] = $attachment_id;
272
}
273
-
274
}
275
276
// No more attachment IDs found, set remaining results as false.
277
if ( count( $urls ) !== count( $results ) ) {
278
- foreach ( $full_urls as $full_url => $url ) {
279
- if ( ! array_key_exists( $url, $results ) ) {
280
- $this->query_cache[ $full_url ] = false;
281
- $results[ $url ] = false;
282
}
283
}
284
}
129
* @return array
130
*/
131
private function get_bare_upload_base_urls() {
132
+ static $base_urls = array();
133
134
+ if ( empty( $base_urls ) ) {
135
+ $domains = array();
136
+
137
+ // Original domain and path.
138
+ $uploads = wp_upload_dir();
139
+ $base_url = AS3CF_Utils::remove_scheme( $uploads['baseurl'] );
140
+ $orig_domain = AS3CF_Utils::parse_url( $base_url, PHP_URL_HOST );
141
+ $domains[] = $orig_domain;
142
+ $base_urls[] = $base_url;
143
+
144
+ // Current domain and path after potential domain mapping.
145
+ $base_url = $this->as3cf->maybe_fix_local_subsite_url( $uploads['baseurl'] );
146
+ $base_url = AS3CF_Utils::remove_scheme( $base_url );
147
+ $curr_domain = AS3CF_Utils::parse_url( $base_url, PHP_URL_HOST );
148
+
149
+ if ( $curr_domain !== $orig_domain ) {
150
+ $domains[] = $curr_domain;
151
+ }
152
+
153
+ /**
154
+ * Allow alteration of the local domains that can be matched on.
155
+ *
156
+ * @param array $domains
157
+ */
158
+ $domains = apply_filters( 'as3cf_local_domains', $domains );
159
+
160
+ if ( ! empty( $domains ) ) {
161
+ foreach ( array_unique( $domains ) as $match_domain ) {
162
+ $base_urls[] = substr_replace( $base_url, $match_domain, 2, strlen( $curr_domain ) );
163
+ }
164
}
165
}
166
264
265
$path = $this->as3cf->decode_filename_in_path( ltrim( str_replace( $this->get_bare_upload_base_urls(), '', $full_url ), '/' ) );
266
267
+ $paths[ $path ] = $full_url;
268
+ $full_urls[ $full_url ][] = $url;
269
+ $meta_values[] = "'" . esc_sql( $path ) . "'";
270
}
271
272
if ( ! empty( $meta_values ) ) {
273
$sql = "
274
SELECT post_id, meta_value FROM {$wpdb->postmeta}
275
WHERE meta_key = '_wp_attached_file'
276
+ AND meta_value IN ( " . implode( ',', array_unique( $meta_values ) ) . " )
277
";
278
279
$query_results = $wpdb->get_results( $sql );
280
281
if ( ! empty( $query_results ) ) {
282
foreach ( $query_results as $postmeta ) {
283
+ $attachment_id = (int) $postmeta->post_id;
284
+ $full_url = $paths[ $postmeta->meta_value ];
285
+ $this->query_cache[ $full_url ] = $attachment_id;
286
+ foreach ( $full_urls[ $full_url ] as $url ) {
287
+ $results[ $url ] = $attachment_id;
288
+ }
289
+ unset( $full_urls[ $full_url ] );
290
}
291
}
292
293
// No more attachment IDs found, set remaining results as false.
294
if ( count( $urls ) !== count( $results ) ) {
295
+ foreach ( $full_urls as $full_url => $sizes ) {
296
+ foreach ( $sizes as $url ) {
297
+ if ( ! array_key_exists( $url, $results ) ) {
298
+ $this->query_cache[ $full_url ] = false;
299
+ $results[ $url ] = false;
300
+ }
301
}
302
}
303
}
classes/providers/aws-provider.php CHANGED
@@ -155,10 +155,23 @@ class AWS_Provider extends Provider {
155
public function __construct( \AS3CF_Plugin_Base $as3cf ) {
156
parent::__construct( $as3cf );
157
158
// Autoloader.
159
require_once $as3cf->get_plugin_sdks_dir_path() . '/Aws3/aws-autoloader.php';
160
}
161
162
/**
163
* Returns default args array for the client.
164
*
155
public function __construct( \AS3CF_Plugin_Base $as3cf ) {
156
parent::__construct( $as3cf );
157
158
+ $this->disable_csm();
159
+
160
// Autoloader.
161
require_once $as3cf->get_plugin_sdks_dir_path() . '/Aws3/aws-autoloader.php';
162
}
163
164
+ /**
165
+ * Disable AWS CSM which tries to check ~/.aws/config causing issues if open_basedir in effect.
166
+ *
167
+ * @see https://github.com/aws/aws-sdk-php/issues/1659
168
+ */
169
+ private function disable_csm() {
170
+ if ( apply_filters( 'as3cf_disable_aws_csm', true ) ) {
171
+ putenv( 'AWS_CSM_ENABLED=false' );
172
+ }
173
+ }
174
+
175
/**
176
* Returns default args array for the client.
177
*
classes/providers/provider.php CHANGED
@@ -404,10 +404,63 @@ abstract class Provider {
404
if ( static::is_key_file_path_constant_defined() ) {
405
$constant = static::key_file_path_constant();
406
407
- return $constant ? constant( $constant ) : false;
408
}
409
410
- return $this->as3cf->get_core_setting( static::$key_file_path_setting_name, false );
411
}
412
413
/**
404
if ( static::is_key_file_path_constant_defined() ) {
405
$constant = static::key_file_path_constant();
406
407
+ if ( $constant ) {
408
+ return $this->validate_key_file_path( constant( $constant ) );
409
+ } else {
410
+ // Constant defined but value is not a non-empty string.
411
+ return false;
412
+ }
413
+ }
414
+
415
+ return $this->validate_key_file_path( $this->as3cf->get_core_setting( static::$key_file_path_setting_name, false ) );
416
+ }
417
+
418
+ /**
419
+ * Validate a key file path to ensure it exists, is readable, and contains JSON.
420
+ *
421
+ * @param string $key_file_path
422
+ *
423
+ * @return bool|string
424
+ */
425
+ public function validate_key_file_path( $key_file_path ) {
426
+ $notice_id = 'validate-key-file-path';
427
+ $this->as3cf->notices->remove_notice_by_id( $notice_id );
428
+
429
+ if ( empty( $key_file_path ) ) {
430
+ return false;
431
+ }
432
+
433
+ if ( ! file_exists( $key_file_path ) ) {
434
+ $this->as3cf->notices->add_notice( __( 'Given Key File Path is invalid or could not be accessed.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media', 'custom_id' => $notice_id ) );
435
+
436
+ return false;
437
+ }
438
+
439
+ try {
440
+ $value = file_get_contents( $key_file_path );
441
+
442
+ // An exception isn't always thrown, so check value instead.
443
+ if ( empty( $value ) ) {
444
+ $this->as3cf->notices->add_notice( __( 'Could not read Key File Path\'s contents.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media', 'custom_id' => $notice_id ) );
445
+
446
+ return false;
447
+ }
448
+ } catch ( \Exception $e ) {
449
+ $this->as3cf->notices->add_notice( __( 'Could not read Key File Path\'s contents.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media', 'custom_id' => $notice_id ) );
450
+
451
+ return false;
452
+ }
453
+
454
+ $value = json_decode( $value, true );
455
+
456
+ if ( empty( $value ) ) {
457
+ $this->as3cf->notices->add_notice( __( 'Given Key File Path does not contain valid JSON.', 'amazon-s3-and-cloudfront' ), array( 'type' => 'error', 'only_show_in_settings' => true, 'only_show_on_tab' => 'media', 'custom_id' => $notice_id ) );
458
+
459
+ return false;
460
}
461
462
+ // File exists and looks like JSON.
463
+ return $key_file_path;
464
}
465
466
/**
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: 2019-03-05 11:14+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,172 +22,172 @@ msgstr ""
22
msgid "Offload Media"
23
msgstr ""
24
25
- #: classes/amazon-s3-and-cloudfront.php:278
26
- #: classes/amazon-s3-and-cloudfront.php:292
27
msgid "Unknown"
28
msgstr ""
29
30
- #: classes/amazon-s3-and-cloudfront.php:346
31
#: view/bucket-setting.php:17
32
- #: view/provider-select.php:106
33
msgid "defined in wp-config.php"
34
msgstr ""
35
36
- #: classes/amazon-s3-and-cloudfront.php:1092
37
- #: classes/amazon-s3-and-cloudfront.php:1226
38
#, php-format
39
msgid "File %s does not exist"
40
msgstr ""
41
42
- #: classes/amazon-s3-and-cloudfront.php:1105
43
#, php-format
44
msgid "Mime type %s is not allowed"
45
msgstr ""
46
47
- #: classes/amazon-s3-and-cloudfront.php:1116
48
msgid "Already offloaded to a different provider"
49
msgstr ""
50
51
- #: classes/amazon-s3-and-cloudfront.php:1190
52
- #: classes/amazon-s3-and-cloudfront.php:1234
53
#, php-format
54
msgid "Error offloading %s to provider: %s"
55
msgstr ""
56
57
- #: classes/amazon-s3-and-cloudfront.php:2374
58
msgid "This action can only be performed through an admin screen."
59
msgstr ""
60
61
- #: classes/amazon-s3-and-cloudfront.php:2376
62
msgid "Cheatin&#8217; eh?"
63
msgstr ""
64
65
- #: classes/amazon-s3-and-cloudfront.php:2378
66
msgid "You do not have sufficient permissions to access this page."
67
msgstr ""
68
69
- #: classes/amazon-s3-and-cloudfront.php:2658
70
msgid "Error Getting Bucket Region"
71
msgstr ""
72
73
- #: classes/amazon-s3-and-cloudfront.php:2659
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:2790
79
msgid ""
80
"This is a test file to check if the user has write permission to the bucket. "
81
"Delete me if found."
82
msgstr ""
83
84
- #: classes/amazon-s3-and-cloudfront.php:2796
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:2878
91
msgid "Error creating bucket"
92
msgstr ""
93
94
- #: classes/amazon-s3-and-cloudfront.php:2879
95
msgid "Bucket name too short."
96
msgstr ""
97
98
- #: classes/amazon-s3-and-cloudfront.php:2880
99
msgid "Bucket name too long."
100
msgstr ""
101
102
- #: classes/amazon-s3-and-cloudfront.php:2881
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:2882
109
msgid "Error saving bucket"
110
msgstr ""
111
112
- #: classes/amazon-s3-and-cloudfront.php:2883
113
msgid "Error fetching buckets"
114
msgstr ""
115
116
- #: classes/amazon-s3-and-cloudfront.php:2884
117
msgid "Error getting URL preview: "
118
msgstr ""
119
120
- #: classes/amazon-s3-and-cloudfront.php:2885
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:2886
125
msgid "Getting diagnostic info..."
126
msgstr ""
127
128
- #: classes/amazon-s3-and-cloudfront.php:2887
129
msgid "Error getting diagnostic info: "
130
msgstr ""
131
132
- #: classes/amazon-s3-and-cloudfront.php:2888
133
msgctxt "placeholder for hidden access key, 39 char max"
134
msgid "-- not shown --"
135
msgstr ""
136
137
- #: classes/amazon-s3-and-cloudfront.php:2890
138
- #: classes/amazon-s3-and-cloudfront.php:4901
139
msgid "Settings saved."
140
msgstr ""
141
142
- #: classes/amazon-s3-and-cloudfront.php:2979
143
msgid "Cheatin' eh?"
144
msgstr ""
145
146
- #: classes/amazon-s3-and-cloudfront.php:3063
147
msgid "No bucket name provided."
148
msgstr ""
149
150
- #: classes/amazon-s3-and-cloudfront.php:3072
151
msgid "Bucket name not valid."
152
msgstr ""
153
154
- #: classes/amazon-s3-and-cloudfront.php:3085
155
msgid "No region provided."
156
msgstr ""
157
158
- #: classes/amazon-s3-and-cloudfront.php:3162
159
- #: view/provider-select.php:295
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:3185
165
msgid "Key File not valid JSON."
166
msgstr ""
167
168
- #: classes/amazon-s3-and-cloudfront.php:3227
169
msgctxt "Show the media library tab"
170
msgid "Media Library"
171
msgstr ""
172
173
- #: classes/amazon-s3-and-cloudfront.php:3228
174
msgctxt "Show the addons tab"
175
msgid "Addons"
176
msgstr ""
177
178
- #: classes/amazon-s3-and-cloudfront.php:3229
179
msgctxt "Show the support tab"
180
msgid "Support"
181
msgstr ""
182
183
- #: classes/amazon-s3-and-cloudfront.php:3449
184
#, php-format
185
msgid ""
186
"<strong>WP Offload Media</strong> &mdash; The file %s has been given %s "
187
"permissions in the bucket."
188
msgstr ""
189
190
- #: classes/amazon-s3-and-cloudfront.php:3468
191
msgid ""
192
"<strong>WP Offload Media Requirement Missing</strong> &mdash; Looks like you "
193
"don't have an image manipulation library installed on this server and "
@@ -195,18 +195,18 @@ msgid ""
195
"Please setup GD or ImageMagick."
196
msgstr ""
197
198
- #: classes/amazon-s3-and-cloudfront.php:4181
199
#, php-format
200
msgid ""
201
"<a href=\"%s\">Define your access keys</a> to enable write access to the "
202
"bucket"
203
msgstr ""
204
205
- #: classes/amazon-s3-and-cloudfront.php:4188
206
msgid "Quick Start Guide"
207
msgstr ""
208
209
- #: classes/amazon-s3-and-cloudfront.php:4190
210
#, php-format
211
msgid ""
212
"Looks like we don't have write access to this bucket. It's likely that the "
@@ -215,7 +215,7 @@ msgid ""
215
"correctly."
216
msgstr ""
217
218
- #: classes/amazon-s3-and-cloudfront.php:4192
219
#, php-format
220
msgid ""
221
"Looks like we don't have access to the buckets. It's likely that the user "
@@ -223,39 +223,39 @@ msgid ""
223
"Please see our %s for instructions on setting up permissions correctly."
224
msgstr ""
225
226
- #: classes/amazon-s3-and-cloudfront.php:4342
227
msgid "WP Offload Media Activation"
228
msgstr ""
229
230
- #: classes/amazon-s3-and-cloudfront.php:4343
231
msgid ""
232
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
233
"automatically deactivated WP Offload Media Lite."
234
msgstr ""
235
236
- #: classes/amazon-s3-and-cloudfront.php:4345
237
msgid "WP Offload Media Lite Activation"
238
msgstr ""
239
240
- #: classes/amazon-s3-and-cloudfront.php:4346
241
msgid ""
242
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
243
"automatically deactivated WP Offload Media."
244
msgstr ""
245
246
- #: classes/amazon-s3-and-cloudfront.php:4398
247
msgid "More&nbsp;info&nbsp;&raquo;"
248
msgstr ""
249
250
- #: classes/amazon-s3-and-cloudfront.php:4493
251
msgid "this doc"
252
msgstr ""
253
254
- #: classes/amazon-s3-and-cloudfront.php:4495
255
msgid "WP Offload Media Feature Removed"
256
msgstr ""
257
258
- #: classes/amazon-s3-and-cloudfront.php:4496
259
#, php-format
260
msgid ""
261
"You had the \"Always non-SSL\" option selected in your settings, but we've "
@@ -266,59 +266,59 @@ msgid ""
266
"to the old behavior."
267
msgstr ""
268
269
- #: classes/amazon-s3-and-cloudfront.php:4526
270
msgid "Offload"
271
msgstr ""
272
273
- #: classes/amazon-s3-and-cloudfront.php:4634
274
msgctxt "Storage provider key name"
275
msgid "Storage Provider"
276
msgstr ""
277
278
- #: classes/amazon-s3-and-cloudfront.php:4635
279
msgctxt "Storage provider name"
280
msgid "Storage Provider"
281
msgstr ""
282
283
- #: classes/amazon-s3-and-cloudfront.php:4636
284
msgctxt "Bucket name"
285
msgid "Bucket"
286
msgstr ""
287
288
- #: classes/amazon-s3-and-cloudfront.php:4637
289
msgctxt "Path to file in bucket"
290
msgid "Path"
291
msgstr ""
292
293
- #: classes/amazon-s3-and-cloudfront.php:4638
294
msgctxt "Location of bucket"
295
msgid "Region"
296
msgstr ""
297
298
- #: classes/amazon-s3-and-cloudfront.php:4639
299
msgctxt "Access control list of the file in bucket"
300
msgid "Access"
301
msgstr ""
302
303
- #: classes/amazon-s3-and-cloudfront.php:4640
304
msgid "URL"
305
msgstr ""
306
307
- #: classes/amazon-s3-and-cloudfront.php:4864
308
msgid "Assets Pull"
309
msgstr ""
310
311
- #: classes/amazon-s3-and-cloudfront.php:4865
312
msgid ""
313
"An addon for WP Offload Media to serve your site's JS, CSS, and other "
314
"enqueued assets from Amazon CloudFront or another CDN."
315
msgstr ""
316
317
- #: classes/amazon-s3-and-cloudfront.php:4869
318
msgid "Feature"
319
msgstr ""
320
321
- #: classes/amazon-s3-and-cloudfront.php:4915
322
#, php-format
323
msgid ""
324
"<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
@@ -329,7 +329,7 @@ msgid ""
329
"plugin, it should be safe to deactivate and delete it. %2$s"
330
msgstr ""
331
332
- #: classes/amazon-s3-and-cloudfront.php:4947
333
#, php-format
334
msgid ""
335
"<strong>WP Offload Media Settings Moved</strong> &mdash; You now define your "
@@ -462,27 +462,40 @@ msgstr ""
462
msgid "Settings"
463
msgstr ""
464
465
- #: classes/as3cf-plugin-compatibility.php:575
466
#, php-format
467
msgid "The local directory %s does not exist and could not be created."
468
msgstr ""
469
470
- #: classes/as3cf-plugin-compatibility.php:576
471
- #: classes/as3cf-plugin-compatibility.php:588
472
#: classes/upgrades/upgrade-meta-wp-error.php:81
473
#, php-format
474
msgid ""
475
"There was an error attempting to download the file %s from the bucket: %s"
476
msgstr ""
477
478
- #: classes/as3cf-plugin-compatibility.php:880
479
#, php-format
480
msgid ""
481
"<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
482
"Offload Media will require PHP %2$s or later. %3$s"
483
msgstr ""
484
485
- #: classes/providers/provider.php:517
486
#, php-format
487
msgid "You must first <a href=\"%s\">set your access keys</a>."
488
msgstr ""
@@ -640,7 +653,7 @@ msgid "File exists on server"
640
msgstr ""
641
642
#: view/bucket-select.php:38
643
- #: view/provider-select.php:17
644
msgid "&laquo;&nbsp;Back"
645
msgstr ""
646
@@ -807,15 +820,22 @@ msgstr ""
807
msgid "Show"
808
msgstr ""
809
810
- #: view/provider-select.php:20
811
msgid "Storage Provider"
812
msgstr ""
813
814
- #: view/provider-select.php:129
815
msgid "Define access keys in wp-config.php"
816
msgstr ""
817
818
- #: view/provider-select.php:138
819
#, php-format
820
msgctxt "Access Keys defined in multiple defines."
821
msgid ""
@@ -824,7 +844,7 @@ msgid ""
824
"config.php."
825
msgstr ""
826
827
- #: view/provider-select.php:140
828
#, php-format
829
msgctxt "Access Keys defined in single define."
830
msgid ""
@@ -833,29 +853,29 @@ msgid ""
833
"config.php."
834
msgstr ""
835
836
- #: view/provider-select.php:142
837
- #: view/provider-select.php:192
838
msgctxt "joins multiple define keys in notice"
839
msgid " & "
840
msgstr ""
841
842
- #: view/provider-select.php:151
843
msgid ""
844
"Please check your wp-config.php file as it looks like one of your access key "
845
"defines is missing or incorrect."
846
msgstr ""
847
848
- #: view/provider-select.php:157
849
msgid ""
850
"Copy the following snippet <strong>near the top</strong> of your wp-config."
851
"php and replace the stars with the keys."
852
msgstr ""
853
854
- #: view/provider-select.php:183
855
msgid "Define key file path in wp-config.php"
856
msgstr ""
857
858
- #: view/provider-select.php:191
859
#, php-format
860
msgctxt "Key file path defined in single define."
861
msgid ""
@@ -864,18 +884,18 @@ msgid ""
864
"your wp-config.php."
865
msgstr ""
866
867
- #: view/provider-select.php:197
868
msgid ""
869
"Copy the following snippet <strong>near the top</strong> of your wp-config."
870
"php and replace \"<strong>/path/to/key/file.json</strong>\"."
871
msgstr ""
872
873
- #: view/provider-select.php:226
874
#, php-format
875
msgid "My server is on %s and I'd like to use IAM Roles"
876
msgstr ""
877
878
- #: view/provider-select.php:233
879
#, php-format
880
msgid ""
881
"You've defined the '%1$s' constant in your wp-config.php. To select a "
@@ -883,7 +903,7 @@ msgid ""
883
"config.php."
884
msgstr ""
885
886
- #: view/provider-select.php:236
887
#, php-format
888
msgid ""
889
"If you host your WordPress site on %s you should make use of IAM Roles. To "
@@ -891,45 +911,45 @@ msgid ""
891
"<strong>near the top</strong> of your wp-config.php."
892
msgstr ""
893
894
- #: view/provider-select.php:262
895
msgid ""
896
"I understand the risks but I'd like to store access keys in the database "
897
"anyway (not recommended)"
898
msgstr ""
899
900
- #: view/provider-select.php:269
901
msgid ""
902
"Storing your access keys in the database is less secure than the options "
903
"above, but if you're ok with that, go ahead and enter your keys in the form "
904
"below."
905
msgstr ""
906
907
- #: view/provider-select.php:274
908
msgid "Access Key ID"
909
msgstr ""
910
911
- #: view/provider-select.php:289
912
msgid "Secret Access Key"
913
msgstr ""
914
915
- #: view/provider-select.php:316
916
msgid ""
917
"I understand the risks but I'd like to store the key file's contents in the "
918
"database anyway (not recommended)"
919
msgstr ""
920
921
- #: view/provider-select.php:323
922
msgid ""
923
"Storing your key file's contents in the database is less secure than the "
924
"options above, but if you're ok with that, go ahead and enter your key "
925
"file's JSON data in the field below."
926
msgstr ""
927
928
- #: view/provider-select.php:339
929
msgid "Next"
930
msgstr ""
931
932
- #: view/provider-select.php:339
933
#: view/settings/media.php:261
934
msgid "Save Changes"
935
msgstr ""
8
msgstr ""
9
"Project-Id-Version: amazon-s3-and-cloudfront\n"
10
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
+ "POT-Creation-Date: 2019-04-29 10:28+0100\n"
12
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
"Language-Team: LANGUAGE <LL@li.org>\n"
22
msgid "Offload Media"
23
msgstr ""
24
25
+ #: classes/amazon-s3-and-cloudfront.php:277
26
+ #: classes/amazon-s3-and-cloudfront.php:291
27
msgid "Unknown"
28
msgstr ""
29
30
+ #: classes/amazon-s3-and-cloudfront.php:345
31
#: view/bucket-setting.php:17
32
+ #: view/provider-select.php:108
33
msgid "defined in wp-config.php"
34
msgstr ""
35
36
+ #: classes/amazon-s3-and-cloudfront.php:1091
37
+ #: classes/amazon-s3-and-cloudfront.php:1225
38
#, php-format
39
msgid "File %s does not exist"
40
msgstr ""
41
42
+ #: classes/amazon-s3-and-cloudfront.php:1104
43
#, php-format
44
msgid "Mime type %s is not allowed"
45
msgstr ""
46
47
+ #: classes/amazon-s3-and-cloudfront.php:1115
48
msgid "Already offloaded to a different provider"
49
msgstr ""
50
51
+ #: classes/amazon-s3-and-cloudfront.php:1189
52
+ #: classes/amazon-s3-and-cloudfront.php:1233
53
#, php-format
54
msgid "Error offloading %s to provider: %s"
55
msgstr ""
56
57
+ #: classes/amazon-s3-and-cloudfront.php:2375
58
msgid "This action can only be performed through an admin screen."
59
msgstr ""
60
61
+ #: classes/amazon-s3-and-cloudfront.php:2377
62
msgid "Cheatin&#8217; eh?"
63
msgstr ""
64
65
+ #: classes/amazon-s3-and-cloudfront.php:2379
66
msgid "You do not have sufficient permissions to access this page."
67
msgstr ""
68
69
+ #: classes/amazon-s3-and-cloudfront.php:2659
70
msgid "Error Getting Bucket Region"
71
msgstr ""
72
73
+ #: classes/amazon-s3-and-cloudfront.php:2660
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:2791
79
msgid ""
80
"This is a test file to check if the user has write permission to the bucket. "
81
"Delete me if found."
82
msgstr ""
83
84
+ #: classes/amazon-s3-and-cloudfront.php:2797
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:2879
91
msgid "Error creating bucket"
92
msgstr ""
93
94
+ #: classes/amazon-s3-and-cloudfront.php:2880
95
msgid "Bucket name too short."
96
msgstr ""
97
98
+ #: classes/amazon-s3-and-cloudfront.php:2881
99
msgid "Bucket name too long."
100
msgstr ""
101
102
+ #: classes/amazon-s3-and-cloudfront.php:2882
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:2883
109
msgid "Error saving bucket"
110
msgstr ""
111
112
+ #: classes/amazon-s3-and-cloudfront.php:2884
113
msgid "Error fetching buckets"
114
msgstr ""
115
116
+ #: classes/amazon-s3-and-cloudfront.php:2885
117
msgid "Error getting URL preview: "
118
msgstr ""
119
120
+ #: classes/amazon-s3-and-cloudfront.php:2886
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:2887
125
msgid "Getting diagnostic info..."
126
msgstr ""
127
128
+ #: classes/amazon-s3-and-cloudfront.php:2888
129
msgid "Error getting diagnostic info: "
130
msgstr ""
131
132
+ #: classes/amazon-s3-and-cloudfront.php:2889
133
msgctxt "placeholder for hidden access key, 39 char max"
134
msgid "-- not shown --"
135
msgstr ""
136
137
+ #: classes/amazon-s3-and-cloudfront.php:2891
138
+ #: classes/amazon-s3-and-cloudfront.php:4913
139
msgid "Settings saved."
140
msgstr ""
141
142
+ #: classes/amazon-s3-and-cloudfront.php:2980
143
msgid "Cheatin' eh?"
144
msgstr ""
145
146
+ #: classes/amazon-s3-and-cloudfront.php:3064
147
msgid "No bucket name provided."
148
msgstr ""
149
150
+ #: classes/amazon-s3-and-cloudfront.php:3073
151
msgid "Bucket name not valid."
152
msgstr ""
153
154
+ #: classes/amazon-s3-and-cloudfront.php:3086
155
msgid "No region provided."
156
msgstr ""
157
158
+ #: classes/amazon-s3-and-cloudfront.php:3163
159
+ #: view/provider-select.php:314
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:3186
165
msgid "Key File not valid JSON."
166
msgstr ""
167
168
+ #: classes/amazon-s3-and-cloudfront.php:3228
169
msgctxt "Show the media library tab"
170
msgid "Media Library"
171
msgstr ""
172
173
+ #: classes/amazon-s3-and-cloudfront.php:3229
174
msgctxt "Show the addons tab"
175
msgid "Addons"
176
msgstr ""
177
178
+ #: classes/amazon-s3-and-cloudfront.php:3230
179
msgctxt "Show the support tab"
180
msgid "Support"
181
msgstr ""
182
183
+ #: classes/amazon-s3-and-cloudfront.php:3450
184
#, php-format
185
msgid ""
186
"<strong>WP Offload Media</strong> &mdash; The file %s has been given %s "
187
"permissions in the bucket."
188
msgstr ""
189
190
+ #: classes/amazon-s3-and-cloudfront.php:3469
191
msgid ""
192
"<strong>WP Offload Media Requirement Missing</strong> &mdash; Looks like you "
193
"don't have an image manipulation library installed on this server and "
195
"Please setup GD or ImageMagick."
196
msgstr ""
197
198
+ #: classes/amazon-s3-and-cloudfront.php:4182
199
#, php-format
200
msgid ""
201
"<a href=\"%s\">Define your access keys</a> to enable write access to the "
202
"bucket"
203
msgstr ""
204
205
+ #: classes/amazon-s3-and-cloudfront.php:4189
206
msgid "Quick Start Guide"
207
msgstr ""
208
209
+ #: classes/amazon-s3-and-cloudfront.php:4191
210
#, php-format
211
msgid ""
212
"Looks like we don't have write access to this bucket. It's likely that the "
215
"correctly."
216
msgstr ""
217
218
+ #: classes/amazon-s3-and-cloudfront.php:4193
219
#, php-format
220
msgid ""
221
"Looks like we don't have access to the buckets. It's likely that the user "
223
"Please see our %s for instructions on setting up permissions correctly."
224
msgstr ""
225
226
+ #: classes/amazon-s3-and-cloudfront.php:4354
227
msgid "WP Offload Media Activation"
228
msgstr ""
229
230
+ #: classes/amazon-s3-and-cloudfront.php:4355
231
msgid ""
232
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
233
"automatically deactivated WP Offload Media Lite."
234
msgstr ""
235
236
+ #: classes/amazon-s3-and-cloudfront.php:4357
237
msgid "WP Offload Media Lite Activation"
238
msgstr ""
239
240
+ #: classes/amazon-s3-and-cloudfront.php:4358
241
msgid ""
242
"WP Offload Media Lite and WP Offload Media cannot both be active. We've "
243
"automatically deactivated WP Offload Media."
244
msgstr ""
245
246
+ #: classes/amazon-s3-and-cloudfront.php:4410
247
msgid "More&nbsp;info&nbsp;&raquo;"
248
msgstr ""
249
250
+ #: classes/amazon-s3-and-cloudfront.php:4505
251
msgid "this doc"
252
msgstr ""
253
254
+ #: classes/amazon-s3-and-cloudfront.php:4507
255
msgid "WP Offload Media Feature Removed"
256
msgstr ""
257
258
+ #: classes/amazon-s3-and-cloudfront.php:4508
259
#, php-format
260
msgid ""
261
"You had the \"Always non-SSL\" option selected in your settings, but we've "
266
"to the old behavior."
267
msgstr ""
268
269
+ #: classes/amazon-s3-and-cloudfront.php:4538
270
msgid "Offload"
271
msgstr ""
272
273
+ #: classes/amazon-s3-and-cloudfront.php:4646
274
msgctxt "Storage provider key name"
275
msgid "Storage Provider"
276
msgstr ""
277
278
+ #: classes/amazon-s3-and-cloudfront.php:4647
279
msgctxt "Storage provider name"
280
msgid "Storage Provider"
281
msgstr ""
282
283
+ #: classes/amazon-s3-and-cloudfront.php:4648
284
msgctxt "Bucket name"
285
msgid "Bucket"
286
msgstr ""
287
288
+ #: classes/amazon-s3-and-cloudfront.php:4649
289
msgctxt "Path to file in bucket"
290
msgid "Path"
291
msgstr ""
292
293
+ #: classes/amazon-s3-and-cloudfront.php:4650
294
msgctxt "Location of bucket"
295
msgid "Region"
296
msgstr ""
297
298
+ #: classes/amazon-s3-and-cloudfront.php:4651
299
msgctxt "Access control list of the file in bucket"
300
msgid "Access"
301
msgstr ""
302
303
+ #: classes/amazon-s3-and-cloudfront.php:4652
304
msgid "URL"
305
msgstr ""
306
307
+ #: classes/amazon-s3-and-cloudfront.php:4876
308
msgid "Assets Pull"
309
msgstr ""
310
311
+ #: classes/amazon-s3-and-cloudfront.php:4877
312
msgid ""
313
"An addon for WP Offload Media to serve your site's JS, CSS, and other "
314
"enqueued assets from Amazon CloudFront or another CDN."
315
msgstr ""
316
317
+ #: classes/amazon-s3-and-cloudfront.php:4881
318
msgid "Feature"
319
msgstr ""
320
321
+ #: classes/amazon-s3-and-cloudfront.php:4927
322
#, php-format
323
msgid ""
324
"<strong>Amazon Web Services Plugin No Longer Required</strong> &mdash; As of "
329
"plugin, it should be safe to deactivate and delete it. %2$s"
330
msgstr ""
331
332
+ #: classes/amazon-s3-and-cloudfront.php:4959
333
#, php-format
334
msgid ""
335
"<strong>WP Offload Media Settings Moved</strong> &mdash; You now define your "
462
msgid "Settings"
463
msgstr ""
464
465
+ #: classes/as3cf-plugin-compatibility.php:579
466
#, php-format
467
msgid "The local directory %s does not exist and could not be created."
468
msgstr ""
469
470
+ #: classes/as3cf-plugin-compatibility.php:580
471
+ #: classes/as3cf-plugin-compatibility.php:592
472
#: classes/upgrades/upgrade-meta-wp-error.php:81
473
#, php-format
474
msgid ""
475
"There was an error attempting to download the file %s from the bucket: %s"
476
msgstr ""
477
478
+ #: classes/as3cf-plugin-compatibility.php:917
479
#, php-format
480
msgid ""
481
"<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP "
482
"Offload Media will require PHP %2$s or later. %3$s"
483
msgstr ""
484
485
+ #: classes/providers/provider.php:434
486
+ msgid "Given Key File Path is invalid or could not be accessed."
487
+ msgstr ""
488
+
489
+ #: classes/providers/provider.php:444
490
+ #: classes/providers/provider.php:449
491
+ msgid "Could not read Key File Path's contents."
492
+ msgstr ""
493
+
494
+ #: classes/providers/provider.php:457
495
+ msgid "Given Key File Path does not contain valid JSON."
496
+ msgstr ""
497
+
498
+ #: classes/providers/provider.php:570
499
#, php-format
500
msgid "You must first <a href=\"%s\">set your access keys</a>."
501
msgstr ""
653
msgstr ""
654
655
#: view/bucket-select.php:38
656
+ #: view/provider-select.php:19
657
msgid "&laquo;&nbsp;Back"
658
msgstr ""
659
820
msgid "Show"
821
msgstr ""
822
823
+ #: view/provider-select.php:22
824
msgid "Storage Provider"
825
msgstr ""
826
827
+ #: view/provider-select.php:125
828
+ #, php-format
829
+ msgid ""
830
+ "<strong>Warning:</strong> You have %s offloaded Media Library items, you "
831
+ "should remove them from the bucket before changing storage provider."
832
+ msgstr ""
833
+
834
+ #: view/provider-select.php:148
835
msgid "Define access keys in wp-config.php"
836
msgstr ""
837
838
+ #: view/provider-select.php:157
839
#, php-format
840
msgctxt "Access Keys defined in multiple defines."
841
msgid ""
844
"config.php."
845
msgstr ""
846
847
+ #: view/provider-select.php:159
848
#, php-format
849
msgctxt "Access Keys defined in single define."
850
msgid ""
853
"config.php."
854
msgstr ""
855
856
+ #: view/provider-select.php:161
857
+ #: view/provider-select.php:211
858
msgctxt "joins multiple define keys in notice"
859
msgid " & "
860
msgstr ""
861
862
+ #: view/provider-select.php:170
863
msgid ""
864
"Please check your wp-config.php file as it looks like one of your access key "
865
"defines is missing or incorrect."
866
msgstr ""
867
868
+ #: view/provider-select.php:176
869
msgid ""
870
"Copy the following snippet <strong>near the top</strong> of your wp-config."
871
"php and replace the stars with the keys."
872
msgstr ""
873
874
+ #: view/provider-select.php:202
875
msgid "Define key file path in wp-config.php"
876
msgstr ""
877
878
+ #: view/provider-select.php:210
879
#, php-format
880
msgctxt "Key file path defined in single define."
881
msgid ""
884
"your wp-config.php."
885
msgstr ""
886
887
+ #: view/provider-select.php:216
888
msgid ""
889
"Copy the following snippet <strong>near the top</strong> of your wp-config."
890
"php and replace \"<strong>/path/to/key/file.json</strong>\"."
891
msgstr ""
892
893
+ #: view/provider-select.php:245
894
#, php-format
895
msgid "My server is on %s and I'd like to use IAM Roles"
896
msgstr ""
897
898
+ #: view/provider-select.php:252
899
#, php-format
900
msgid ""
901
"You've defined the '%1$s' constant in your wp-config.php. To select a "
903
"config.php."
904
msgstr ""
905
906
+ #: view/provider-select.php:255
907
#, php-format
908
msgid ""
909
"If you host your WordPress site on %s you should make use of IAM Roles. To "
911
"<strong>near the top</strong> of your wp-config.php."
912
msgstr ""
913
914
+ #: view/provider-select.php:281
915
msgid ""
916
"I understand the risks but I'd like to store access keys in the database "
917
"anyway (not recommended)"
918
msgstr ""
919
920
+ #: view/provider-select.php:288
921
msgid ""
922
"Storing your access keys in the database is less secure than the options "
923
"above, but if you're ok with that, go ahead and enter your keys in the form "
924
"below."
925
msgstr ""
926
927
+ #: view/provider-select.php:293
928
msgid "Access Key ID"
929
msgstr ""
930
931
+ #: view/provider-select.php:308
932
msgid "Secret Access Key"
933
msgstr ""
934
935
+ #: view/provider-select.php:335
936
msgid ""
937
"I understand the risks but I'd like to store the key file's contents in the "
938
"database anyway (not recommended)"
939
msgstr ""
940
941
+ #: view/provider-select.php:342
942
msgid ""
943
"Storing your key file's contents in the database is less secure than the "
944
"options above, but if you're ok with that, go ahead and enter your key "
945
"file's JSON data in the field below."
946
msgstr ""
947
948
+ #: view/provider-select.php:358
949
msgid "Next"
950
msgstr ""
951
952
+ #: view/provider-select.php:358
953
#: view/settings/media.php:261
954
msgid "Save Changes"
955
msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === WP Offload Media Lite for Amazon S3 and DigitalOcean Spaces ===
2
Contributors: bradt, deliciousbrains, ianmjones
3
Tags: uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
Requires at least: 4.7
5
- Tested up to: 5.1
6
Requires PHP: 5.5
7
- Stable tag: 2.1
8
License: GPLv3
9
10
Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
@@ -78,6 +78,17 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
78
79
== Changelog ==
80
81
= WP Offload Media Lite 2.1 - 2019-03-05 =
82
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-2-1-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
83
* New: Google Cloud Storage is now supported
1
+ === WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage ===
2
Contributors: bradt, deliciousbrains, ianmjones
3
Tags: uploads, amazon, s3, amazon s3, digitalocean, digitalocean spaces, google cloud storage, gcs, mirror, admin, media, cdn, cloudfront
4
Requires at least: 4.7
5
+ Tested up to: 5.2
6
Requires PHP: 5.5
7
+ Stable tag: 2.1.1
8
License: GPLv3
9
10
Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery.
78
79
== Changelog ==
80
81
+ = WP Offload Media Lite 2.1.1 - 2019-04-29 =
82
+ * New: Multisite domain mapping via WordPress MU Domain Mapping plugin is now supported
83
+ * Improvement: Local to Provider content filtering performance improvements
84
+ * Improvement: Warning notice shown when changing storage provider and media already offloaded
85
+ * Bug fix: Media title not retaining characters stripped from filename
86
+ * Bug fix: Warning: is_readable(): open_basedir restriction in effect. File(~/.aws/config) is not within the allowed path(s)
87
+ * Bug fix: Fatal error when GCS Key File not accessible
88
+ * Bug fix: Non-image offloads on subsites with 4 digit IDs get duplicate subsite ID in bucket path
89
+ * Bug fix: No srcset added to img tag if filename includes non-ASCII characters
90
+ * Bug fix: Full size image URL saved to img tag src attribute when thumbnail picked if filename includes non-ASCII characters
91
+
92
= WP Offload Media Lite 2.1 - 2019-03-05 =
93
* [Release Summary Blog Post](https://deliciousbrains.com/wp-offload-media-2-1-released/?utm_campaign=changelogs&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting)
94
* New: Google Cloud Storage is now supported
view/notice.php CHANGED
@@ -1,28 +1,28 @@
1
<?php
2
- $type = ( isset( $type ) ) ? $type : 'notice-info';
3
- $dismissible = ( isset( $dismissible ) ) ? $dismissible : false;
4
- $inline = ( isset( $inline ) ) ? $inline : false;
5
- $id = ( isset( $id ) ) ? 'id="' . $id . '"' : '';
6
- $style = ( isset( $style ) ) ? $style : '';
7
- $auto_p = ( isset( $auto_p ) ) ? $auto_p : 'true';
8
- $class = ( isset( $class ) ) ? $class : '';
9
- $show_callback = ( isset( $show_callback ) && false !== $show_callback ) ? array( $GLOBALS[ $show_callback[0] ], $show_callback[1] ) : false;
10
- $callback_args = ( isset( $callback_args ) ) ? $callback_args : array();
11
?>
12
- <div <?php echo $id; ?> class="notice <?php echo $type; ?><?php echo ( $dismissible ) ? ' is-dismissible' : ''; ?> as3cf-notice <?php echo ( $inline ) ? ' inline' : ''; ?> <?php echo ( '' !== $class ) ? ' ' . $class : ''; ?>" style="<?php echo $style; ?>">
13
- <?php if ( $auto_p ) : ?>
14
<p>
15
- <?php endif; ?>
16
<?php echo $message; // xss ok ?>
17
<?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
18
<a href="#" class="as3cf-notice-toggle" data-hide="<?php _e( 'Hide', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Show', 'amazon-s3-and-cloudfront' ); ?></a>
19
<?php endif; ?>
20
- <?php if ( $auto_p ) : ?>
21
</p>
22
<?php endif; ?>
23
- <?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
24
- <div class="as3cf-notice-toggle-content" style="display: none;">
25
- <?php call_user_func_array( $show_callback, $callback_args ); ?>
26
- </div>
27
- <?php endif; ?>
28
</div>
1
<?php
2
+ $type = ( isset( $type ) ) ? $type : 'notice-info';
3
+ $dismissible = ( isset( $dismissible ) ) ? $dismissible : false;
4
+ $inline = ( isset( $inline ) ) ? $inline : false;
5
+ $id = ( isset( $id ) ) ? 'id="' . $id . '"' : '';
6
+ $style = ( isset( $style ) ) ? $style : '';
7
+ $auto_p = ( isset( $auto_p ) ) ? $auto_p : 'true';
8
+ $class = ( isset( $class ) ) ? $class : '';
9
+ $show_callback = ( isset( $show_callback ) && false !== $show_callback ) ? array( $GLOBALS[ $show_callback[0] ], $show_callback[1] ) : false;
10
+ $callback_args = ( isset( $callback_args ) ) ? $callback_args : array();
11
?>
12
+ <div <?php echo $id; ?> class="notice <?php echo $type; ?><?php echo ( $dismissible ) ? ' is-dismissible' : ''; ?> as3cf-notice <?php echo ( $inline ) ? ' inline' : ''; ?> <?php echo empty( $class ) ? '' : ' ' . $class; ?>" style="<?php echo $style; ?>">
13
+ <?php if ( $auto_p ) : ?>
14
<p>
15
+ <?php endif; ?>
16
<?php echo $message; // xss ok ?>
17
<?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
18
<a href="#" class="as3cf-notice-toggle" data-hide="<?php _e( 'Hide', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Show', 'amazon-s3-and-cloudfront' ); ?></a>
19
<?php endif; ?>
20
+ <?php if ( $auto_p ) : ?>
21
</p>
22
<?php endif; ?>
23
+ <?php if ( false !== $show_callback && is_callable( $show_callback ) ) : ?>
24
+ <div class="as3cf-notice-toggle-content" style="display: none;">
25
+ <?php call_user_func_array( $show_callback, $callback_args ); ?>
26
+ </div>
27
+ <?php endif; ?>
28
</div>
view/provider-select.php CHANGED
@@ -9,11 +9,13 @@ $key_file_path_defined = $this->get_defined_setting( 'key-file-path',
9
$key_file_defined = $this->get_defined_setting( 'key-file', false );
10
$key_file_path_settings_constant = ( $key_file_path_defined || $key_file_defined ) ? $this->settings_constant() : false;
11
$providers = $this->get_provider_classes();
12
?>
13
14
<div class="as3cf-content as3cf-provider-select">
15
<?php
16
- if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] && $this->get_setting( 'bucket' ) && ! empty( $can_write ) ) {
17
echo '<a href="' . $this->get_plugin_page_url() . '">' . __( '&laquo;&nbsp;Back', 'amazon-s3-and-cloudfront' ) . '</a>';
18
}
19
?>
@@ -116,7 +118,24 @@ $providers = $this->get_provider_classes();
116
<td></td>
117
<td>
118
<table>
119
- <?php
120
if ( $provider_class::use_access_keys_allowed() ) {
121
?>
122
<!-- Defined Access Keys Begin -->
9
$key_file_defined = $this->get_defined_setting( 'key-file', false );
10
$key_file_path_settings_constant = ( $key_file_path_defined || $key_file_defined ) ? $this->settings_constant() : false;
11
$providers = $this->get_provider_classes();
12
+ $media_counts = $this->diagnostic_media_counts();
13
+ $media_offloaded_string = empty( $media_counts['s3'] ) ? '' : number_format( $media_counts['s3'] );
14
?>
15
16
<div class="as3cf-content as3cf-provider-select">
17
<?php
18
+ if ( ! empty( $_GET['action'] ) && 'change-provider' === $_GET['action'] && $this->get_setting( 'bucket' ) ) {
19
echo '<a href="' . $this->get_plugin_page_url() . '">' . __( '&laquo;&nbsp;Back', 'amazon-s3-and-cloudfront' ) . '</a>';
20
}
21
?>
118
<td></td>
119
<td>
120
<table>
121
+ <?php if ( ! $provider_selected && ! empty( $media_offloaded_string ) ) { ?>
122
+ <tr>
123
+ <td colspan="2">
124
+ <?php
125
+ $message_string = sprintf( __( '<strong>Warning:</strong> You have %s offloaded Media Library items, you should remove them from the bucket before changing storage provider.', 'amazon-s3-and-cloudfront' ), $media_offloaded_string );
126
+ $message_string .= '&nbsp;' . $this->more_info_link( '/wp-offload-media/doc/how-to-change-storage-provider/#mixed-provider' );
127
+
128
+ $media_offloaded_notice = array(
129
+ 'message' => $message_string,
130
+ 'id' => 'as3cf-media-offloaded-' . $provider_key,
131
+ 'inline' => true,
132
+ 'type' => 'notice-warning',
133
+ );
134
+ $this->render_view( 'notice', $media_offloaded_notice );
135
+ ?>
136
+ </td>
137
+ </tr>
138
+ <?php }
139
if ( $provider_class::use_access_keys_allowed() ) {
140
?>
141
<!-- Defined Access Keys Begin -->
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, DigitalOcean Spaces or Google Cloud Storage for storage and delivery. Optionally configure Amazon CloudFront or another CDN for even faster delivery.
6
Author: Delicious Brains
7
- Version: 2.1
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.1';
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, DigitalOcean Spaces or Google Cloud Storage for storage and delivery. Optionally configure Amazon CloudFront or another CDN for even faster delivery.
6
Author: Delicious Brains
7
+ Version: 2.1.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.1.1';
30
31
require_once dirname( __FILE__ ) . '/classes/as3cf-compatibility-check.php';
32