WP Offload S3 Lite - Version 0.9.8

Version Description

  • 2015-11-02 =
  • Bug fix: Attachment URLs containing query string parameters incorrectly encoded
Download this release

Release Info

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

Code changes from version 0.9.7 to 0.9.8

README.md CHANGED
@@ -3,7 +3,7 @@
3
  **Tags:** uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 3.7
5
  **Tested up to:** 4.3
6
- **Stable tag:** 0.9.7
7
  **License:** GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
@@ -67,6 +67,9 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
67
 
68
  ## Changelog ##
69
 
 
 
 
70
  ### 0.9.7 - 2015-10-26 ###
71
  * Improvement: Improve compatibility with third party plugins when the _Remove Files From Server_ option is enabled
72
  * Improvement: Fix inconsistent spacing on the WP Offload S3 settings screen
3
  **Tags:** uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 3.7
5
  **Tested up to:** 4.3
6
+ **Stable tag:** 0.9.8
7
  **License:** GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
67
 
68
  ## Changelog ##
69
 
70
+ ### 0.9.8 - 2015-11-02 ###
71
+ * Bug fix: Attachment URLs containing query string parameters incorrectly encoded
72
+
73
  ### 0.9.7 - 2015-10-26 ###
74
  * Improvement: Improve compatibility with third party plugins when the _Remove Files From Server_ option is enabled
75
  * Improvement: Fix inconsistent spacing on the WP Offload S3 settings screen
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -114,9 +114,9 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
114
  add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
115
  add_filter( 'wp_handle_upload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
116
  add_filter( 'wp_update_attachment_metadata', array( $this, 'wp_update_attachment_metadata' ), 110, 2 );
117
- add_filter( 'get_image_tag', array( $this, 'maybe_encode_get_image_tag' ), 10, 6 );
118
- add_filter( 'wp_get_attachment_image_src', array( $this, 'maybe_encode_wp_get_attachment_image_src' ), 10, 4 );
119
- add_filter( 'wp_prepare_attachment_for_js', array( $this, 'maybe_encode_wp_prepare_attachment_for_js' ), 10, 3 );
120
  add_filter( 'delete_attachment', array( $this, 'delete_attachment' ), 20 );
121
  add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 );
122
  add_filter( 'get_attached_file', array( $this, 'get_attached_file' ), 10, 2 );
@@ -1444,37 +1444,50 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1444
  $url = parse_url( $file );
1445
 
1446
  if ( ! isset( $url['path'] ) ) {
 
1447
  return $file;
1448
  }
1449
 
1450
- if ( in_array( $this->leading_slash_it( $url['path'] ), $this->encode_files ) ) {
1451
- // Already encoded return original file
1452
  return $file;
1453
  }
1454
 
1455
  $file_path = dirname( $file );
1456
  $file_path = ( '.' !== $file_path ) ? trailingslashit( $file_path ) : '';
1457
- $file_name = basename( $file );
1458
  $encoded_file_name = rawurlencode( $file_name );
1459
  $encoded_file_path = $file_path . $encoded_file_name;
1460
 
1461
- if ( $file_name !== $encoded_file_name ) {
1462
- $encoded_url = parse_url( $encoded_file_path );
1463
- $this->encode_files[] = $this->leading_slash_it( $encoded_url['path'] );
 
 
 
 
 
 
1464
  }
1465
 
1466
- return $file_path . $encoded_file_name;
1467
  }
1468
 
1469
  /**
1470
- * Leading slash it
1471
  *
1472
  * @param string $path
1473
  *
1474
- * @return string
1475
  */
1476
- function leading_slash_it( $path ) {
1477
- return '/' . ltrim( $path, '/\\' );
 
 
 
 
 
 
1478
  }
1479
 
1480
  /**
114
  add_filter( 'wp_get_attachment_url', array( $this, 'wp_get_attachment_url' ), 99, 2 );
115
  add_filter( 'wp_handle_upload_prefilter', array( $this, 'wp_handle_upload_prefilter' ), 1 );
116
  add_filter( 'wp_update_attachment_metadata', array( $this, 'wp_update_attachment_metadata' ), 110, 2 );
117
+ add_filter( 'get_image_tag', array( $this, 'maybe_encode_get_image_tag' ), 99, 6 );
118
+ add_filter( 'wp_get_attachment_image_src', array( $this, 'maybe_encode_wp_get_attachment_image_src' ), 99, 4 );
119
+ add_filter( 'wp_prepare_attachment_for_js', array( $this, 'maybe_encode_wp_prepare_attachment_for_js' ), 99, 3 );
120
  add_filter( 'delete_attachment', array( $this, 'delete_attachment' ), 20 );
121
  add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 );
122
  add_filter( 'get_attached_file', array( $this, 'get_attached_file' ), 10, 2 );
1444
  $url = parse_url( $file );
1445
 
1446
  if ( ! isset( $url['path'] ) ) {
1447
+ // Can't determine path, return original
1448
  return $file;
1449
  }
1450
 
1451
+ if ( in_array( $this->normalize_file_path( $url['path'] ), $this->encode_files ) ) {
1452
+ // Already encoded, return original
1453
  return $file;
1454
  }
1455
 
1456
  $file_path = dirname( $file );
1457
  $file_path = ( '.' !== $file_path ) ? trailingslashit( $file_path ) : '';
1458
+ $file_name = basename( $url['path'] );
1459
  $encoded_file_name = rawurlencode( $file_name );
1460
  $encoded_file_path = $file_path . $encoded_file_name;
1461
 
1462
+ if ( $file_name === $encoded_file_name ) {
1463
+ // File name doesn't need encoding, return original
1464
+ return $file;
1465
+ }
1466
+
1467
+ $normalized_file_path = $this->normalize_file_path( $encoded_file_path );
1468
+
1469
+ if ( ! in_array( $normalized_file_path, $this->encode_files ) ) {
1470
+ $this->encode_files[] = $normalized_file_path;
1471
  }
1472
 
1473
+ return str_replace( $file_name, $encoded_file_name, $file );
1474
  }
1475
 
1476
  /**
1477
+ * Normalize file path
1478
  *
1479
  * @param string $path
1480
  *
1481
+ * @return string mixed
1482
  */
1483
+ function normalize_file_path( $path ) {
1484
+ $url = parse_url( $path );
1485
+
1486
+ if ( isset( $url['scheme'] ) ) {
1487
+ $path = str_replace( $url['scheme'] . '://', '', $path );
1488
+ }
1489
+
1490
+ return '/' . ltrim( $path, '/' );
1491
  }
1492
 
1493
  /**
classes/as3cf-notices.php CHANGED
@@ -72,9 +72,11 @@ class AS3CF_Notices {
72
  'dismissible' => true,
73
  'inline' => false,
74
  'flash' => true,
75
- 'only_show_to_user' => true,
76
  'only_show_in_settings' => false,
77
  'custom_id' => '',
 
 
78
  );
79
 
80
  $notice = array_intersect_key( array_merge( $defaults, $args ), $defaults );
@@ -127,7 +129,7 @@ class AS3CF_Notices {
127
  *
128
  * @param array $notice
129
  */
130
- protected function remove_notice( $notice ) {
131
  $user_id = get_current_user_id();
132
 
133
  if ( $notice['only_show_to_user'] ) {
@@ -144,17 +146,9 @@ class AS3CF_Notices {
144
  unset( $notices[ $notice['id'] ] );
145
 
146
  if ( $notice['only_show_to_user'] ) {
147
- if ( ! empty( $notices ) ) {
148
- update_user_meta( $user_id, 'as3cf_notices', $notices );
149
- } else {
150
- delete_user_meta( $user_id, 'as3cf_notices' );
151
- }
152
  } else {
153
- if ( ! empty( $notices ) ) {
154
- set_site_transient( 'as3cf_notices', $notices );
155
- } else {
156
- delete_site_transient( 'as3cf_notices' );
157
- }
158
  }
159
  }
160
  }
@@ -182,17 +176,12 @@ class AS3CF_Notices {
182
  $notice = $this->find_notice_by_id( $notice_id );
183
  if ( $notice ) {
184
  if ( $notice['only_show_to_user'] ) {
185
- if ( ! empty( $notices ) ) {
186
- unset( $notices[ $notice['id'] ] );
187
- update_user_meta( $user_id, 'as3cf_notices', $notices );
188
- } else {
189
- delete_user_meta( $user_id, 'as3cf_notices' );
190
- }
191
  } else {
192
- $dismissed_notices = get_user_meta( $user_id, 'as3cf_dismissed_notices', true );
193
- if ( ! is_array( $dismissed_notices ) ) {
194
- $dismissed_notices = array();
195
- }
196
 
197
  if ( ! in_array( $notice['id'], $dismissed_notices ) ) {
198
  $dismissed_notices[] = $notice['id'];
@@ -202,14 +191,75 @@ class AS3CF_Notices {
202
  }
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  /**
206
  * Find a notice by it's ID
207
  *
208
  * @param string $notice_id
209
  *
210
- * @return mixed
211
  */
212
- protected function find_notice_by_id( $notice_id ) {
213
  $user_id = get_current_user_id();
214
 
215
  $user_notices = get_user_meta( $user_id, 'as3cf_notices', true );
@@ -321,4 +371,33 @@ class AS3CF_Notices {
321
  $this->as3cf->end_ajax( $out );
322
  }
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  }
72
  'dismissible' => true,
73
  'inline' => false,
74
  'flash' => true,
75
+ 'only_show_to_user' => true, // The user who has initiated an action resulting in notice. Otherwise show to all users.
76
  'only_show_in_settings' => false,
77
  'custom_id' => '',
78
+ 'auto_p' => true, // Automatically wrap the message in a <p>
79
+ 'class' => '', // Extra classes for the notice
80
  );
81
 
82
  $notice = array_intersect_key( array_merge( $defaults, $args ), $defaults );
129
  *
130
  * @param array $notice
131
  */
132
+ public function remove_notice( $notice ) {
133
  $user_id = get_current_user_id();
134
 
135
  if ( $notice['only_show_to_user'] ) {
146
  unset( $notices[ $notice['id'] ] );
147
 
148
  if ( $notice['only_show_to_user'] ) {
149
+ $this->update_user_meta( $user_id, 'as3cf_notices', $notices );
 
 
 
 
150
  } else {
151
+ $this->set_site_transient( 'as3cf_notices', $notices );
 
 
 
 
152
  }
153
  }
154
  }
176
  $notice = $this->find_notice_by_id( $notice_id );
177
  if ( $notice ) {
178
  if ( $notice['only_show_to_user'] ) {
179
+ $notices = get_user_meta( $user_id, 'as3cf_notices' );
180
+ unset( $notices[ $notice['id'] ] );
181
+
182
+ $this->update_user_meta( $user_id, 'as3cf_notices', $notices );
 
 
183
  } else {
184
+ $dismissed_notices = $this->get_dismissed_notices( $user_id );
 
 
 
185
 
186
  if ( ! in_array( $notice['id'], $dismissed_notices ) ) {
187
  $dismissed_notices[] = $notice['id'];
191
  }
192
  }
193
 
194
+ /**
195
+ * Check if a notice has been dismissed for the current user
196
+ *
197
+ * @param null|int $user_id
198
+ *
199
+ * @return array
200
+ */
201
+ public function get_dismissed_notices( $user_id = null ) {
202
+ if ( is_null( $user_id ) ) {
203
+ $user_id = get_current_user_id();
204
+ }
205
+
206
+ $dismissed_notices = get_user_meta( $user_id, 'as3cf_dismissed_notices', true );
207
+ if ( ! is_array( $dismissed_notices ) ) {
208
+ $dismissed_notices = array();
209
+ }
210
+
211
+ return $dismissed_notices;
212
+ }
213
+
214
+ /**
215
+ * Un-dismiss a notice for a user
216
+ *
217
+ * @param string $notice_id
218
+ * @param null|int $user_id
219
+ * @param null|array $dismissed_notices
220
+ */
221
+ public function undismiss_notice_for_user( $notice_id, $user_id = null, $dismissed_notices = null ) {
222
+ if ( is_null( $user_id ) ) {
223
+ $user_id = get_current_user_id();
224
+ }
225
+
226
+ if ( is_null( $dismissed_notices ) ) {
227
+ $dismissed_notices = $this->get_dismissed_notices( $user_id );
228
+ }
229
+
230
+ $key = array_search( $notice_id, $dismissed_notices );
231
+ unset( $dismissed_notices[ $key ] );
232
+
233
+ $this->update_user_meta( $user_id, 'as3cf_dismissed_notices', $dismissed_notices );
234
+ }
235
+
236
+ /**
237
+ * Un-dismiss a notice for all users that have dismissed it
238
+ *
239
+ * @param string $notice_id
240
+ */
241
+ public function undismiss_notice_for_all( $notice_id ) {
242
+ $args = array(
243
+ 'meta_key' => 'as3cf_dismissed_notices',
244
+ 'meta_value' => $notice_id,
245
+ 'meta_compare' => 'LIKE',
246
+ );
247
+
248
+ $users = get_users( $args );
249
+
250
+ foreach( $users as $user ) {
251
+ $this->undismiss_notice_for_user( $notice_id, $user->ID );
252
+ }
253
+ }
254
+
255
  /**
256
  * Find a notice by it's ID
257
  *
258
  * @param string $notice_id
259
  *
260
+ * @return array|null
261
  */
262
+ public function find_notice_by_id( $notice_id ) {
263
  $user_id = get_current_user_id();
264
 
265
  $user_notices = get_user_meta( $user_id, 'as3cf_notices', true );
371
  $this->as3cf->end_ajax( $out );
372
  }
373
 
374
+ /**
375
+ * Helper to update/delete user meta
376
+ *
377
+ * @param int $user_id
378
+ * @param string $key
379
+ * @param array $value
380
+ */
381
+ protected function update_user_meta( $user_id, $key, $value ) {
382
+ if ( empty( $value ) ) {
383
+ delete_user_meta( $user_id, $key);
384
+ } else {
385
+ update_user_meta( $user_id, $key, $value );
386
+ }
387
+ }
388
+
389
+ /**
390
+ * Helper to update/delete site transient
391
+ *
392
+ * @param string $key
393
+ * @param array $value
394
+ */
395
+ protected function set_site_transient( $key, $value ) {
396
+ if ( empty( $value ) ) {
397
+ delete_site_transient( $key );
398
+ } else {
399
+ set_site_transient( $key, $value );
400
+ }
401
+ }
402
+
403
  }
classes/as3cf-plugin-compatibility.php CHANGED
@@ -46,6 +46,9 @@ class AS3CF_Plugin_Compatibility {
46
  * Register the compatibility hooks
47
  */
48
  function compatibility_init() {
 
 
 
49
  // Turn on stream wrapper S3 file
50
  add_filter( 'as3cf_get_attached_file', array( $this, 'get_stream_wrapper_file' ), 20, 4 );
51
 
@@ -78,6 +81,166 @@ class AS3CF_Plugin_Compatibility {
78
  add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
79
  }
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  /**
82
  * Allow any process to trigger the copy back to local with
83
  * the filter 'as3cf_get_attached_file_copy_back_to_local'
46
  * Register the compatibility hooks
47
  */
48
  function compatibility_init() {
49
+ // Add notices about compatibility addons to install
50
+ add_action( 'admin_init', array( $this, 'maybe_render_compatibility_addons_notice' ) );
51
+
52
  // Turn on stream wrapper S3 file
53
  add_filter( 'as3cf_get_attached_file', array( $this, 'get_stream_wrapper_file' ), 20, 4 );
54
 
81
  add_filter( 'as3cf_get_attached_file', array( $this, 'regenerate_thumbnails_download_file' ), 10, 4 );
82
  }
83
 
84
+ /**
85
+ * Get the addons for the Pro upgrade
86
+ *
87
+ * @return array
88
+ */
89
+ public function get_pro_addons() {
90
+ global $amazon_web_services;
91
+
92
+ $all_addons = $amazon_web_services->get_addons( true );
93
+ if ( ! isset( $all_addons['amazon-s3-and-cloudfront']['addons']['amazon-s3-and-cloudfront-pro']['addons'] ) ) {
94
+ return array();
95
+ }
96
+
97
+ $addons = $all_addons['amazon-s3-and-cloudfront']['addons']['amazon-s3-and-cloudfront-pro']['addons'];
98
+
99
+ return $addons;
100
+ }
101
+
102
+ /**
103
+ * Get compatibility addons that are required to be installed
104
+ *
105
+ * @return array
106
+ */
107
+ public function get_compatibility_addons_to_install() {
108
+ $addons = $this->get_pro_addons();
109
+
110
+ $addons_to_install = array();
111
+
112
+ if ( empty ( $addons ) ) {
113
+ return $addons_to_install;
114
+ }
115
+
116
+ foreach( $addons as $addon_slug => $addon ) {
117
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $addon_slug . '/' . $addon_slug . '.php' ) ) {
118
+ // Addon already installed, ignore.
119
+ continue;
120
+ }
121
+
122
+ if ( ! isset( $addon['parent_plugin_basename'] ) || '' === $addon['parent_plugin_basename'] ) {
123
+ // Addon doesn't have a parent plugin, ignore.
124
+ continue;
125
+ }
126
+
127
+ if ( ! file_exists( WP_PLUGIN_DIR . '/' . $addon['parent_plugin_basename'] ) || ! is_plugin_active( $addon['parent_plugin_basename'] ) ) {
128
+ // Parent plugin not installed or not activated, ignore.
129
+ continue;
130
+ }
131
+
132
+ $addons_to_install[ $addon_slug ] = $addon['title'];
133
+ }
134
+
135
+ return $addons_to_install;
136
+ }
137
+
138
+ /**
139
+ * Maybe show a notice about installing addons when the site is using the
140
+ * plugins they add compatibility for.
141
+ */
142
+ public function maybe_render_compatibility_addons_notice() {
143
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
144
+ return;
145
+ }
146
+
147
+ global $as3cf_compat_check;
148
+ if ( ! $as3cf_compat_check->check_capabilities() ){
149
+ // User can't install plugins anyway, bail.
150
+ return;
151
+ }
152
+
153
+ $addons_to_install = $this->get_compatibility_addons_to_install();
154
+
155
+ $notice_id = 'as3cf-compat-addons';
156
+
157
+ $this->maybe_prepare_compatibility_addons_notice( $notice_id, $addons_to_install );
158
+
159
+ if ( empty( $addons_to_install ) ) {
160
+ return;
161
+ }
162
+
163
+ $title = __( 'WP Offload S3 Compatibility Addons', 'amazon-s3-and-cloudfront' );
164
+ $compat_url = 'https://deliciousbrains.com/wp-offload-s3/doc/compatibility-with-other-plugins/';
165
+ $compat_link = sprintf( '<a href="%s">%s</a>', $compat_url, __( 'compatibility addons', 'amazon-s3-and-cloudfront' ) );
166
+ $message = sprintf( __( "To get WP Offload S3 to work with certain 3rd party plugins, you must install and activate some of our %s. We've detected the following addons need to be installed.", 'amazon-s3-and-cloudfront' ), $compat_link );
167
+
168
+ $notice_addons_text = $this->render_addon_list( $addons_to_install );
169
+ $notice_addons_text .= '<p>' . __( 'You will need to purchase a license to get access to these addons.', 'amazon-s3-and-cloudfront' ) . '</p>';
170
+ $notice_addons_text .= sprintf( '<p><a href="%s">%s</a></p>', 'https://deliciousbrains.com/wp-offload-s3/pricing/', __( 'View Licenses', 'amazon-s3-and-cloudfront' ) );
171
+
172
+ $notice_addons_text = apply_filters( 'wpos3_compat_addons_notice', $notice_addons_text, $addons_to_install );
173
+
174
+ if ( false === $notice_addons_text ) {
175
+ // Allow the notice to be aborted.
176
+ return;
177
+ }
178
+
179
+ $notice = '<p><strong>' . $title . '</strong> &mdash; ' . $message . '</p>' . $notice_addons_text;
180
+
181
+ $notice_args = array(
182
+ 'type' => 'notice-warning',
183
+ 'custom_id' => $notice_id,
184
+ 'only_show_to_user' => false,
185
+ 'flash' => false,
186
+ 'auto_p' => false,
187
+ );
188
+
189
+ $notice_args = apply_filters( 'wpos3_compat_addons_notice_args', $notice_args, $addons_to_install );
190
+
191
+ update_site_option( 'as3cf_compat_addons_to_install', $addons_to_install );
192
+
193
+ $this->as3cf->notices->add_notice( $notice, $notice_args );
194
+ }
195
+
196
+ /**
197
+ * Remove the notice if exists already and undismiss the notice
198
+ * if the addons available have changed.
199
+ *
200
+ * @param int $notice_id
201
+ * @param array $addons_to_install
202
+ */
203
+ protected function maybe_prepare_compatibility_addons_notice( $notice_id, $addons_to_install ) {
204
+ $notice = $this->as3cf->notices->find_notice_by_id( $notice_id );
205
+
206
+ if ( is_null( $notice ) ) {
207
+ return;
208
+ }
209
+
210
+ $previous_addons_to_install = get_site_option( 'as3cf_compat_addons_to_install', array() );
211
+
212
+ if ( ! empty( $previous_addons_to_install ) && $addons_to_install !== $previous_addons_to_install ) {
213
+ // Remove dismissed flag for all users, so we reshow the notice with new addons
214
+ $this->as3cf->notices->undismiss_notice_for_all( $notice_id );
215
+ }
216
+
217
+ // Remove the notice so we refresh it later on
218
+ $this->as3cf->notices->remove_notice( $notice );
219
+ }
220
+
221
+ /**
222
+ * Render list of addons for a notice
223
+ *
224
+ * @param array $addons
225
+ *
226
+ * @return string
227
+ */
228
+ protected function render_addon_list( $addons ) {
229
+ if ( ! is_array( $addons ) || empty( $addons ) ) {
230
+ return '';
231
+ }
232
+
233
+ sort( $addons );
234
+
235
+ $html = '<ul style="list-style-type: disc; padding: 0 0 0 30px; margin: 5px 0;">';
236
+ foreach ( $addons as $addon ) {
237
+ $html .= '<li style="margin: 0;">' . $addon . '</li>';
238
+ }
239
+ $html .= '</ul>';
240
+
241
+ return $html;
242
+ }
243
+
244
  /**
245
  * Allow any process to trigger the copy back to local with
246
  * the filter 'as3cf_get_attached_file_copy_back_to_local'
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: 2015-10-26 13:57+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"
@@ -44,93 +44,93 @@ msgstr ""
44
  msgid "Error uploading %s to S3: %s"
45
  msgstr ""
46
 
47
- #: classes/amazon-s3-and-cloudfront.php:1541
48
  msgid "Cheatin&#8217; eh?"
49
  msgstr ""
50
 
51
- #: classes/amazon-s3-and-cloudfront.php:1545
52
  msgid "You do not have sufficient permissions to access this page."
53
  msgstr ""
54
 
55
- #: classes/amazon-s3-and-cloudfront.php:1551
56
  msgid "No bucket name provided."
57
  msgstr ""
58
 
59
- #: classes/amazon-s3-and-cloudfront.php:1826
60
  msgid "Error Getting Bucket Region"
61
  msgstr ""
62
 
63
- #: classes/amazon-s3-and-cloudfront.php:1827
64
  #, php-format
65
  msgid "There was an error attempting to get the region of the bucket %s: %s"
66
  msgstr ""
67
 
68
- #: classes/amazon-s3-and-cloudfront.php:1947
69
  msgid ""
70
  "This is a test file to check if the user has write permission to S3. Delete "
71
  "me if found."
72
  msgstr ""
73
 
74
- #: classes/amazon-s3-and-cloudfront.php:1979
75
  #, php-format
76
  msgid ""
77
  "There was an error attempting to check the permissions of the bucket %s: %s"
78
  msgstr ""
79
 
80
- #: classes/amazon-s3-and-cloudfront.php:2037
81
  msgid "Error creating bucket"
82
  msgstr ""
83
 
84
- #: classes/amazon-s3-and-cloudfront.php:2038
85
  msgid "Bucket name too short."
86
  msgstr ""
87
 
88
- #: classes/amazon-s3-and-cloudfront.php:2039
89
  msgid "Bucket name too long."
90
  msgstr ""
91
 
92
- #: classes/amazon-s3-and-cloudfront.php:2040
93
  msgid ""
94
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
95
  "periods and hyphens."
96
  msgstr ""
97
 
98
- #: classes/amazon-s3-and-cloudfront.php:2041
99
  msgid "Error saving bucket"
100
  msgstr ""
101
 
102
- #: classes/amazon-s3-and-cloudfront.php:2042
103
  msgid "Error fetching buckets"
104
  msgstr ""
105
 
106
- #: classes/amazon-s3-and-cloudfront.php:2043
107
  msgid "Error getting URL preview: "
108
  msgstr ""
109
 
110
- #: classes/amazon-s3-and-cloudfront.php:2044
111
  msgid "The changes you made will be lost if you navigate away from this page"
112
  msgstr ""
113
 
114
- #: classes/amazon-s3-and-cloudfront.php:2104
115
  msgid "Cheatin' eh?"
116
  msgstr ""
117
 
118
- #: classes/amazon-s3-and-cloudfront.php:2207
119
  msgctxt "Show the media library tab"
120
  msgid "Media Library"
121
  msgstr ""
122
 
123
- #: classes/amazon-s3-and-cloudfront.php:2208
124
  msgctxt "Show the support tab"
125
  msgid "Support"
126
  msgstr ""
127
 
128
- #: classes/amazon-s3-and-cloudfront.php:2360
129
  #, php-format
130
  msgid "The file %s has been given %s permissions on Amazon S3."
131
  msgstr ""
132
 
133
- #: classes/amazon-s3-and-cloudfront.php:2372
134
  msgid ""
135
  "<strong>Image Manipulation Library Missing</strong> &mdash; Looks like you "
136
  "don't have an image manipulation library installed on this server and "
@@ -138,11 +138,11 @@ msgid ""
138
  "Please setup GD or ImageMagick."
139
  msgstr ""
140
 
141
- #: classes/amazon-s3-and-cloudfront.php:2902
142
  msgid "Quick Start Guide"
143
  msgstr ""
144
 
145
- #: classes/amazon-s3-and-cloudfront.php:2904
146
  #, php-format
147
  msgid ""
148
  "Looks like we don't have write access to this bucket. It's likely that the "
@@ -151,7 +151,7 @@ msgid ""
151
  "correctly."
152
  msgstr ""
153
 
154
- #: classes/amazon-s3-and-cloudfront.php:2906
155
  #, php-format
156
  msgid ""
157
  "Looks like we don't have access to the buckets. It's likely that the user "
@@ -159,15 +159,39 @@ msgid ""
159
  "Please see our %s for instructions on setting up permissions correctly."
160
  msgstr ""
161
 
162
- #: classes/as3cf-notices.php:297
163
  msgid "Error dismissing notice."
164
  msgstr ""
165
 
166
- #: classes/as3cf-notices.php:312
167
  msgid "Invalid notice ID."
168
  msgstr ""
169
 
170
- #: classes/as3cf-plugin-compatibility.php:444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  #: classes/upgrades/as3cf-meta-wp-error.php:72
172
  #, php-format
173
  msgid "There was an error attempting to download the file %s from S3: %s"
8
  msgstr ""
9
  "Project-Id-Version: amazon-s3-and-cloudfront\n"
10
  "Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
11
+ "POT-Creation-Date: 2015-11-02 14:28+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"
44
  msgid "Error uploading %s to S3: %s"
45
  msgstr ""
46
 
47
+ #: classes/amazon-s3-and-cloudfront.php:1554
48
  msgid "Cheatin&#8217; eh?"
49
  msgstr ""
50
 
51
+ #: classes/amazon-s3-and-cloudfront.php:1558
52
  msgid "You do not have sufficient permissions to access this page."
53
  msgstr ""
54
 
55
+ #: classes/amazon-s3-and-cloudfront.php:1564
56
  msgid "No bucket name provided."
57
  msgstr ""
58
 
59
+ #: classes/amazon-s3-and-cloudfront.php:1839
60
  msgid "Error Getting Bucket Region"
61
  msgstr ""
62
 
63
+ #: classes/amazon-s3-and-cloudfront.php:1840
64
  #, php-format
65
  msgid "There was an error attempting to get the region of the bucket %s: %s"
66
  msgstr ""
67
 
68
+ #: classes/amazon-s3-and-cloudfront.php:1960
69
  msgid ""
70
  "This is a test file to check if the user has write permission to S3. Delete "
71
  "me if found."
72
  msgstr ""
73
 
74
+ #: classes/amazon-s3-and-cloudfront.php:1992
75
  #, php-format
76
  msgid ""
77
  "There was an error attempting to check the permissions of the bucket %s: %s"
78
  msgstr ""
79
 
80
+ #: classes/amazon-s3-and-cloudfront.php:2050
81
  msgid "Error creating bucket"
82
  msgstr ""
83
 
84
+ #: classes/amazon-s3-and-cloudfront.php:2051
85
  msgid "Bucket name too short."
86
  msgstr ""
87
 
88
+ #: classes/amazon-s3-and-cloudfront.php:2052
89
  msgid "Bucket name too long."
90
  msgstr ""
91
 
92
+ #: classes/amazon-s3-and-cloudfront.php:2053
93
  msgid ""
94
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
95
  "periods and hyphens."
96
  msgstr ""
97
 
98
+ #: classes/amazon-s3-and-cloudfront.php:2054
99
  msgid "Error saving bucket"
100
  msgstr ""
101
 
102
+ #: classes/amazon-s3-and-cloudfront.php:2055
103
  msgid "Error fetching buckets"
104
  msgstr ""
105
 
106
+ #: classes/amazon-s3-and-cloudfront.php:2056
107
  msgid "Error getting URL preview: "
108
  msgstr ""
109
 
110
+ #: classes/amazon-s3-and-cloudfront.php:2057
111
  msgid "The changes you made will be lost if you navigate away from this page"
112
  msgstr ""
113
 
114
+ #: classes/amazon-s3-and-cloudfront.php:2117
115
  msgid "Cheatin' eh?"
116
  msgstr ""
117
 
118
+ #: classes/amazon-s3-and-cloudfront.php:2220
119
  msgctxt "Show the media library tab"
120
  msgid "Media Library"
121
  msgstr ""
122
 
123
+ #: classes/amazon-s3-and-cloudfront.php:2221
124
  msgctxt "Show the support tab"
125
  msgid "Support"
126
  msgstr ""
127
 
128
+ #: classes/amazon-s3-and-cloudfront.php:2373
129
  #, php-format
130
  msgid "The file %s has been given %s permissions on Amazon S3."
131
  msgstr ""
132
 
133
+ #: classes/amazon-s3-and-cloudfront.php:2385
134
  msgid ""
135
  "<strong>Image Manipulation Library Missing</strong> &mdash; Looks like you "
136
  "don't have an image manipulation library installed on this server and "
138
  "Please setup GD or ImageMagick."
139
  msgstr ""
140
 
141
+ #: classes/amazon-s3-and-cloudfront.php:2915
142
  msgid "Quick Start Guide"
143
  msgstr ""
144
 
145
+ #: classes/amazon-s3-and-cloudfront.php:2917
146
  #, php-format
147
  msgid ""
148
  "Looks like we don't have write access to this bucket. It's likely that the "
151
  "correctly."
152
  msgstr ""
153
 
154
+ #: classes/amazon-s3-and-cloudfront.php:2919
155
  #, php-format
156
  msgid ""
157
  "Looks like we don't have access to the buckets. It's likely that the user "
159
  "Please see our %s for instructions on setting up permissions correctly."
160
  msgstr ""
161
 
162
+ #: classes/as3cf-notices.php:347
163
  msgid "Error dismissing notice."
164
  msgstr ""
165
 
166
+ #: classes/as3cf-notices.php:362
167
  msgid "Invalid notice ID."
168
  msgstr ""
169
 
170
+ #: classes/as3cf-plugin-compatibility.php:163
171
+ msgid "WP Offload S3 Compatibility Addons"
172
+ msgstr ""
173
+
174
+ #: classes/as3cf-plugin-compatibility.php:165
175
+ msgid "compatibility addons"
176
+ msgstr ""
177
+
178
+ #: classes/as3cf-plugin-compatibility.php:166
179
+ #, php-format
180
+ msgid ""
181
+ "To get WP Offload S3 to work with certain 3rd party plugins, you must "
182
+ "install and activate some of our %s. We've detected the following addons "
183
+ "need to be installed."
184
+ msgstr ""
185
+
186
+ #: classes/as3cf-plugin-compatibility.php:169
187
+ msgid "You will need to purchase a license to get access to these addons."
188
+ msgstr ""
189
+
190
+ #: classes/as3cf-plugin-compatibility.php:170
191
+ msgid "View Licenses"
192
+ msgstr ""
193
+
194
+ #: classes/as3cf-plugin-compatibility.php:607
195
  #: classes/upgrades/as3cf-meta-wp-error.php:72
196
  #, php-format
197
  msgid "There was an error attempting to download the file %s from S3: %s"
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
3
  Tags: uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 3.7
5
  Tested up to: 4.3
6
- Stable tag: 0.9.7
7
  License: GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
@@ -63,6 +63,9 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
63
 
64
  == Changelog ==
65
 
 
 
 
66
  = 0.9.7 - 2015-10-26 =
67
  * Improvement: Improve compatibility with third party plugins when the _Remove Files From Server_ option is enabled
68
  * Improvement: Fix inconsistent spacing on the WP Offload S3 settings screen
@@ -220,4 +223,4 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
220
  * Fixed issues causing error messages when WP_DEBUG is on
221
  * [Delete files on S3 when deleting WP attachment](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/e777cd49a4b6999f999bd969241fb24cbbcece60)
222
  * [Added filter to the get_attachment_url function](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/bbe1aed5c2ae900e9ba1b16ba6806c28ab8e2f1c)
223
- * [Added function to get a temporary, secure download URL for private files](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/11f46ec2714d34907009e37ad3b97f4421aefed3)
3
  Tags: uploads, amazon, s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 3.7
5
  Tested up to: 4.3
6
+ Stable tag: 0.9.8
7
  License: GPLv3
8
 
9
  Copies files to Amazon S3 as they are uploaded to the Media Library. Optionally configure Amazon CloudFront for faster delivery.
63
 
64
  == Changelog ==
65
 
66
+ = 0.9.8 - 2015-11-02 =
67
+ * Bug fix: Attachment URLs containing query string parameters incorrectly encoded
68
+
69
  = 0.9.7 - 2015-10-26 =
70
  * Improvement: Improve compatibility with third party plugins when the _Remove Files From Server_ option is enabled
71
  * Improvement: Fix inconsistent spacing on the WP Offload S3 settings screen
223
  * Fixed issues causing error messages when WP_DEBUG is on
224
  * [Delete files on S3 when deleting WP attachment](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/e777cd49a4b6999f999bd969241fb24cbbcece60)
225
  * [Added filter to the get_attachment_url function](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/bbe1aed5c2ae900e9ba1b16ba6806c28ab8e2f1c)
226
+ * [Added function to get a temporary, secure download URL for private files](https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/commit/11f46ec2714d34907009e37ad3b97f4421aefed3)
uninstall.php CHANGED
@@ -20,6 +20,7 @@ $options = array(
20
  'tantan_wordpress_s3',
21
  'update_meta_with_region_session',
22
  'update_file_sizes_session',
 
23
  );
24
 
25
  $postmeta = array(
20
  'tantan_wordpress_s3',
21
  'update_meta_with_region_session',
22
  'update_file_sizes_session',
23
+ 'as3cf_compat_addons_to_install'
24
  );
25
 
26
  $postmeta = array(
view/notice.php CHANGED
@@ -4,7 +4,15 @@ $dismissible = ( isset( $dismissible ) ) ? $dismissible : false;
4
  $inline = ( isset( $inline ) ) ? $inline : false;
5
  $id = ( isset( $id ) ) ? 'id="' . $id . '"' : '';
6
  $style = ( isset( $style ) ) ? $style : '';
 
 
7
  ?>
8
- <div <?php echo $id; ?> class="notice <?php echo $type; ?><?php echo ( $dismissible ) ? ' is-dismissible' : ''; ?> as3cf-notice <?php echo ( $inline ) ? ' inline' : ''; ?>" style="<?php echo $style; ?>">
9
- <p><?php echo $message; // xss ok ?></p>
 
 
 
 
 
 
10
  </div>
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
  ?>
10
+ <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; ?>">
11
+ <?php if ( $auto_p ) : ?>
12
+ <p>
13
+ <?php endif; ?>
14
+ <?php echo $message; // xss ok ?>
15
+ <?php if ( $auto_p ) : ?>
16
+ </p>
17
+ <?php endif; ?>
18
  </div>
wordpress-s3.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Offload S3
4
  Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
5
  Description: Automatically copies media uploads to Amazon S3 for storage and delivery. Optionally configure Amazon CloudFront for even faster delivery.
6
  Author: Delicious Brains
7
- Version: 0.9.7
8
  Author URI: http://deliciousbrains.com/
9
  Network: True
10
  Text Domain: amazon-s3-and-cloudfront
@@ -26,13 +26,13 @@ Domain Path: /languages/
26
  // Then completely rewritten.
27
  */
28
 
29
- $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '0.9.7';
30
 
31
  $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['supported_addon_versions'] = array(
32
  'amazon-s3-and-cloudfront-pro' => '1.0b1',
33
  );
34
 
35
- $aws_plugin_version_required = '0.3';
36
 
37
  require dirname( __FILE__ ) . '/classes/wp-aws-compatibility-check.php';
38
  global $as3cf_compat_check;
4
  Plugin URI: http://wordpress.org/extend/plugins/amazon-s3-and-cloudfront/
5
  Description: Automatically copies media uploads to Amazon S3 for storage and delivery. Optionally configure Amazon CloudFront for even faster delivery.
6
  Author: Delicious Brains
7
+ Version: 0.9.8
8
  Author URI: http://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'] = '0.9.8';
30
 
31
  $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['supported_addon_versions'] = array(
32
  'amazon-s3-and-cloudfront-pro' => '1.0b1',
33
  );
34
 
35
+ $aws_plugin_version_required = '0.3.4';
36
 
37
  require dirname( __FILE__ ) . '/classes/wp-aws-compatibility-check.php';
38
  global $as3cf_compat_check;