WP Offload S3 Lite - Version 1.1.4

Version Description

= 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 1.1.4
Comparing to
See all releases

Code changes from version 1.1.3 to 1.1.4

README.md CHANGED
@@ -2,8 +2,8 @@
2
  **Contributors:** bradt, deliciousbrains
3
  **Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 4.4
5
- **Tested up to:** 4.6.1
6
- **Stable tag:** 1.1.3
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.
@@ -69,6 +69,12 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
69
 
70
  ## Changelog ##
71
 
 
 
 
 
 
 
72
  ### WP Offload S3 Lite 1.1.3 - 2016-11-28 ###
73
  * Bug fix: Private URL signing params stripped in some circumstances
74
  * Improvement: Performance improvements for URL filtering, especially on large sites
2
  **Contributors:** bradt, deliciousbrains
3
  **Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  **Requires at least:** 4.4
5
+ **Tested up to:** 4.7
6
+ **Stable tag:** 1.1.4
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.
69
 
70
  ## Changelog ##
71
 
72
+ ### WP Offload S3 Lite 1.1.4 - 2016-12-13 ###
73
+ * New: Upgrade routine to replace all S3 URLs in post excerpts with local URLs
74
+ * Improvement: Performance improvements
75
+ * Improvement: Allow expires time to be filtered for private content using the `as3cf_expires` filter
76
+ * Bug fix: Image `srcset` not correctly applied when file names contain special characters
77
+
78
  ### WP Offload S3 Lite 1.1.3 - 2016-11-28 ###
79
  * Bug fix: Private URL signing params stripped in some circumstances
80
  * Improvement: Performance improvements for URL filtering, especially on large sites
assets/js/script.js CHANGED
@@ -430,8 +430,8 @@
430
  if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
431
 
432
  // First time bucket select - enable main options by default
433
- setCheckbox( 'copy-to-s3-wrap' );
434
- setCheckbox( 'serve-from-s3-wrap' );
435
 
436
  // Update the saved settings string so we don't trigger the navigation alert
437
  var id = $activeTab.attr( 'id' );
@@ -636,7 +636,7 @@
636
  * Toggle the lost files notice
637
  */
638
  function toggleLostFilesNotice() {
639
- if ( $( '#remove-local-file' ).is( ':checked' ) && $( '#serve-from-s3' ).is( ':not(:checked)' ) ) {
640
  $( '#as3cf-lost-files-notice' ).show();
641
  } else {
642
  $( '#as3cf-lost-files-notice' ).hide();
@@ -647,7 +647,7 @@
647
  * Toggle the remove local files notice
648
  */
649
  function toggleRemoveLocalNotice() {
650
- if ( $( '#remove-local-file' ).is( ':checked' ) ) {
651
  $( '#as3cf-remove-local-notice' ).show();
652
  } else {
653
  $( '#as3cf-remove-local-notice' ).hide();
@@ -749,12 +749,12 @@
749
  } );
750
 
751
  toggleLostFilesNotice();
752
- $( '#serve-from-s3,#remove-local-file' ).on( 'change', function( e ) {
753
  toggleLostFilesNotice();
754
  } );
755
 
756
  toggleRemoveLocalNotice();
757
- $( '#remove-local-file' ).on( 'change', function( e ) {
758
  toggleRemoveLocalNotice();
759
  } );
760
 
430
  if ( 'as3cf' === as3cfModal.prefix && 0 === $activeBucket.text().trim().length ) {
431
 
432
  // First time bucket select - enable main options by default
433
+ setCheckbox( 'as3cf-copy-to-s3-wrap' );
434
+ setCheckbox( 'as3cf-serve-from-s3-wrap' );
435
 
436
  // Update the saved settings string so we don't trigger the navigation alert
437
  var id = $activeTab.attr( 'id' );
636
  * Toggle the lost files notice
637
  */
638
  function toggleLostFilesNotice() {
639
+ if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) && $( '#as3cf-serve-from-s3' ).is( ':not(:checked)' ) ) {
640
  $( '#as3cf-lost-files-notice' ).show();
641
  } else {
642
  $( '#as3cf-lost-files-notice' ).hide();
647
  * Toggle the remove local files notice
648
  */
649
  function toggleRemoveLocalNotice() {
650
+ if ( $( '#as3cf-remove-local-file' ).is( ':checked' ) ) {
651
  $( '#as3cf-remove-local-notice' ).show();
652
  } else {
653
  $( '#as3cf-remove-local-notice' ).hide();
749
  } );
750
 
751
  toggleLostFilesNotice();
752
+ $( '#as3cf-serve-from-s3,#as3cf-remove-local-file' ).on( 'change', function( e ) {
753
  toggleLostFilesNotice();
754
  } );
755
 
756
  toggleRemoveLocalNotice();
757
+ $( '#as3cf-remove-local-file' ).on( 'change', function( e ) {
758
  toggleRemoveLocalNotice();
759
  } );
760
 
assets/js/script.min.js CHANGED
@@ -1 +1 @@
1
- !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.attr("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.attr("disabled",!0)):(c.hide(),d.attr("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(a){as3cf.buckets.bucketSelectLock=!1}function i(){a("#remove-local-file").is(":checked")&&a("#serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function j(){a("#remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a(".as3cf-tab");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),o.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".aws-main").attr("data-tab",c),k.attr("data-prefix")&&(b.prefix=k.attr("data-prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.attr("data-working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.attr("data-working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").attr("data-bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.attr("data-bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val("")):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").attr("disabled",!0):c.find("button[type=submit]").attr("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").attr("disabled",!0):d.find("button[type=submit]").attr("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,i,j){var m=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),n=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===n.text().trim().length){d("copy-to-s3-wrap"),d("serve-from-s3-wrap");var o=k.attr("id");l[o]=c(o)}a(".as3cf-error.fatal").hide(),n.text(e),m.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(i),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!j),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(h)},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.attr("data-working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").removeAttr("selected"),d.val(""),f.attr("disabled",!0),n=!0):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},a(document).ready(function(){var h=a(".wrap.aws-main .nav-tab-wrapper");if(a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(h),window.location.hash){var m=window.location.hash.substring(1);as3cf.tabs.toggle(m,!0)}else k=a("#tab-"+as3cf.tabs.defaultTab),a(".aws-main").attr("data-tab",as3cf.tabs.defaultTab);a(".aws-main").on("click",".nav-tab",function(b){if(b.preventDefault(),!a(this).hasClass("nav-tab-active")){var c=a(this).attr("data-tab");as3cf.tabs.toggle(c),"media"===c?(window.location.hash="","function"==typeof window.history.replaceState&&"#"===window.location.href.slice(-1)&&history.replaceState({},"",window.location.href.slice(0,-1))):window.location.hash=c}}),o.length&&o.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),o.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),i(),a("#serve-from-s3,#remove-local-file").on("change",function(a){i()}),j(),a("#remove-local-file").on("change",function(a){j()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.attr("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),a("body").on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),a("body").on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),a("body").on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),a("body").on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),a("body").on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),a("body").on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),a("body").on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),a("body").on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),a("body").on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),a("body").on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").removeAttr("disabled"):e.find("button[type=submit]").attr("disabled",!0),as3cf.buckets.updateNameNotice(d)}),a("body").on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").attr("disabled",!0):d.find("button[type=submit]").removeAttr("disabled")})})}(jQuery,as3cfModal);
1
+ !function(a,b){function c(b){return a("#"+b+" .as3cf-main-settings form").find("input:not(.no-compare)").serialize()}function d(a){var b=k.find("#"+a),c=b.find("input[type=checkbox]");b.toggleClass("on").find("span").toggleClass("checked");var d=b.find("span.on").hasClass("checked");c.attr("checked",d).trigger("change")}function e(b){var c=b.next(".as3cf-validation-error"),d=a("#"+k.attr("id")+' form button[type="submit"]'),e=/[^a-zA-Z0-9\.\-]/;e.test(b.val())?(c.show(),d.attr("disabled",!0)):(c.hide(),d.attr("disabled",!1))}function f(){var c=a("#"+b.prefix+"-bucket").val(),d=k.find('input[name="object-prefix"]'),e=d.val();""!==e&&(e="&prefix="+encodeURIComponent(e));var f=as3cf.aws_bucket_link+c+e;a("#"+b.prefix+"-view-bucket").attr("href",f)}function g(){a(".as3cf-url-preview").html("Generating...");var b={_nonce:as3cf.nonces.get_url_preview};a.each(a("#tab-"+as3cf.tabs.defaultTab+" .as3cf-main-settings form").serializeArray(),function(c,d){var e=d.name,f=d.value;e=e.replace("[]",""),b[e]=void 0===b[e]?f:a.isArray(b[e])?b[e].concat(f):[b[e],f]}),b.action="as3cf-get-url-preview",a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:b,error:function(a,b,c){alert(as3cf.strings.get_url_preview_error+c)},success:function(b,c,d){"undefined"!=typeof b.success?a(".as3cf-url-preview").html(b.url):alert(as3cf.strings.get_url_preview_error+b.error)}})}function h(a){as3cf.buckets.bucketSelectLock=!1}function i(){a("#as3cf-remove-local-file").is(":checked")&&a("#as3cf-serve-from-s3").is(":not(:checked)")?a("#as3cf-lost-files-notice").show():a("#as3cf-lost-files-notice").hide()}function j(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}var k,l={},m=/[^a-z0-9.-]/,n=!1,o=a(".as3cf-tab");as3cf.tabs={defaultTab:"media",toggle:function(c,d){c=as3cf.tabs.sanitizeHash(c),o.hide(),k=a("#tab-"+c),k.show(),a(".nav-tab").removeClass("nav-tab-active"),a('a.nav-tab[data-tab="'+c+'"]').addClass("nav-tab-active"),a(".aws-main").attr("data-tab",c),k.attr("data-prefix")&&(b.prefix=k.attr("data-prefix")),d||a(".as3cf-updated").removeClass("show"),"support"===c&&as3cf.tabs.getDiagnosticInfo()},getDiagnosticInfo:function(){var b=a(".debug-log-textarea");b.html(as3cf.strings.get_diagnostic_info);var c={action:"as3cf-get-diagnostic-info",_nonce:as3cf.nonces.get_diagnostic_info};a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:c,error:function(a,c,d){b.html(d)},success:function(a,c,d){"undefined"!=typeof a.success?b.html(a.diagnostic_info):(b.html(as3cf.strings.get_diagnostic_info_error),b.append(a.error))}})},sanitizeHash:function(b){var c=a("#tab-"+b);return 0===c.length&&(b=as3cf.tabs.defaultTab),b}},as3cf.buckets={validLength:3,bucketSelectLock:!1,loadList:function(c){"undefined"==typeof c&&(c=!1);var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-list"),e=a("#"+b.prefix+"-bucket").val();if(!1===c&&d.find("li").length>1)return a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"),void this.scrollToSelected();d.html('<li class="loading">'+d.attr("data-working")+"</li>");var f={action:b.prefix+"-get-buckets",_nonce:window[b.prefix.replace(/-/g,"_")].nonces.get_buckets},g=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:f,error:function(a,b,c){d.html(""),g.showError(as3cf.strings.get_buckets_error,c,"as3cf-bucket-select")},success:function(b,c,f){d.html(""),"undefined"!=typeof b.success?(a(".as3cf-bucket-error").hide(),a(b.buckets).each(function(a,b){var c=b.Name===e?"selected":"";d.append('<li><a class="'+c+'" href="#" data-bucket="'+b.Name+'"><span class="bucket"><span class="dashicons dashicons-portfolio"></span> '+b.Name+'</span><span class="spinner"></span></span></a></li>')}),g.scrollToSelected()):g.showError(as3cf.strings.get_buckets_error,b.error,"as3cf-bucket-select")}})},scrollToSelected:function(){if(a(".as3cf-bucket-list a.selected").length){var b=a("ul.as3cf-bucket-list li").first().position().top+150;a(".as3cf-bucket-list").animate({scrollTop:a("ul.as3cf-bucket-list li a.selected").position().top-b})}},resetModal:function(){var c=a(".as3cf-bucket-container."+b.prefix);!1===k.hasClass("as3cf-has-bucket")||"manual"===a("#"+b.prefix+"-bucket-select").val()?(c.find(".as3cf-bucket-manual").show().siblings().hide(),c.find(".bucket-actions.manual").show().siblings(".bucket-actions").hide()):(c.find(".as3cf-bucket-select").show().siblings().hide(),c.find(".bucket-actions.select").show().siblings(".bucket-actions").hide(),this.loadList(n),n=!1),c.find(".as3cf-bucket-error").hide();var d=a("#"+b.prefix+"-bucket").val();c.find(".as3cf-bucket-manual .as3cf-bucket-name").val(d),this.bucketSelectLock=!1},saveManual:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find("button[type=submit]"),f=d.val(),g=e.first().text();if(f===a("#"+b.prefix+"-active-bucket").text())return a(".as3cf-bucket-error").hide(),k.addClass("as3cf-has-bucket"),void b.close();a(".as3cf-bucket-error").hide(),e.text(e.attr("data-working")),e.prop("disabled",!0);var h={action:b.prefix+"-manual-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.manual_bucket},i=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:h,error:function(a,b,c){e.text(g),i.showError(as3cf.strings.save_bucket_error,c,"as3cf-bucket-manual")},success:function(c,d,h){e.text(g),e.prop("disabled",!1),"undefined"!=typeof c.success?(i.set(f,c.region,c.can_write),a("#"+b.prefix+"-bucket-select").val("manual"),a(".as3cf-bucket-list a").removeClass("selected").filter('[data-bucket="'+f+'"]').addClass("selected"),n=!0):i.showError(as3cf.strings.save_bucket_error,c.error,"as3cf-bucket-manual")}})},saveSelected:function(c){var d=a(".as3cf-bucket-list");if(!this.bucketSelectLock){if(this.bucketSelectLock=!0,c.hasClass("selected"))return k.addClass("as3cf-has-bucket"),void b.close();var e=a(".as3cf-bucket-list a.selected").attr("data-bucket");a(".as3cf-bucket-list a").removeClass("selected"),c.addClass("selected"),d.addClass("saving"),c.find(".spinner").show().css("visibility","visible");var f=c.attr("data-bucket"),g={action:b.prefix+"-save-bucket",bucket_name:f,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.save_bucket},h=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:g,error:function(b,c,f){d.removeClass("saving"),h.showError(as3cf.strings.save_bucket_error,f,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected")},success:function(g,i,j){c.find(".spinner").hide().css("visibility","hidden"),d.removeClass("saving"),"undefined"!=typeof g.success?(h.set(f,g.region,g.can_write),a("#"+b.prefix+"-bucket-select").val("")):(h.showError(as3cf.strings.save_bucket_error,g.error,"as3cf-bucket-select"),a(".as3cf-bucket-list a").removeClass("selected"),a('.as3cf-bucket-list a[data-bucket="'+e+'"]').addClass("selected"))}})}},disabledButtons:function(){if(0!==a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form").length){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");c.find(".as3cf-bucket-name").val().length<3?c.find("button[type=submit]").attr("disabled",!0):c.find("button[type=submit]").attr("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").attr("disabled",!0):d.find("button[type=submit]").attr("disabled",!1)}},showError:function(b,c,d){var e=a(".as3cf-bucket-container").children(":visible"),f=e.find(".as3cf-bucket-error");d="undefined"==typeof d?null:d,d&&!e.hasClass(d)||(f.find("span.title").html(b+" &mdash;"),f.find("span.message").html(c),f.show(),this.bucketSelectLock=!1)},set:function(e,i,j){var m=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),n=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===n.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var o=k.attr("id");l[o]=c(o)}a(".as3cf-error.fatal").hide(),n.text(e),m.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(i),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!j),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(h)},create:function(){var c=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form"),d=c.find(".as3cf-bucket-name"),e=c.find(".bucket-create-region"),f=c.find("button[type=submit]"),g=d.val(),h=f.text();a(".as3cf-bucket-error").hide(),f.text(f.attr("data-working")),f.prop("disabled",!0);var i={action:b.prefix+"-create-bucket",bucket_name:g,_nonce:window[b.prefix.replace(/-/g,"_")].nonces.create_bucket};e.val()&&(i.region=e.val());var j=this;a.ajax({url:ajaxurl,type:"POST",dataType:"JSON",data:i,error:function(a,b,c){f.text(h),j.showError(as3cf.strings.create_bucket_error,c,"as3cf-bucket-create")},success:function(b,c,e){f.text(h),f.prop("disabled",!1),"undefined"!=typeof b.success?(j.set(g,b.region,b.can_write),a(".as3cf-bucket-select-region").hide(),a(".as3cf-bucket-select-region").removeAttr("selected"),d.val(""),f.attr("disabled",!0),n=!0):j.showError(as3cf.strings.create_bucket_error,b.error,"as3cf-bucket-create")}})},isValidName:function(a){return!(a.length<3||a.length>63)&&!0!==m.test(a)},updateNameNotice:function(b){var c=null;!0===m.test(b)?c=as3cf.strings.create_bucket_invalid_chars:b.length<3?c=as3cf.strings.create_bucket_name_short:b.length>63&&(c=as3cf.strings.create_bucket_name_long),c&&b.length>0?a(".as3cf-invalid-bucket-name").html(c):a(".as3cf-invalid-bucket-name").html("")}},a(document).ready(function(){var h=a(".wrap.aws-main .nav-tab-wrapper");if(a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(h),window.location.hash){var m=window.location.hash.substring(1);as3cf.tabs.toggle(m,!0)}else k=a("#tab-"+as3cf.tabs.defaultTab),a(".aws-main").attr("data-tab",as3cf.tabs.defaultTab);a(".aws-main").on("click",".nav-tab",function(b){if(b.preventDefault(),!a(this).hasClass("nav-tab-active")){var c=a(this).attr("data-tab");as3cf.tabs.toggle(c),"media"===c?(window.location.hash="","function"==typeof window.history.replaceState&&"#"===window.location.href.slice(-1)&&history.replaceState({},"",window.location.href.slice(0,-1))):window.location.hash=c}}),o.length&&o.each(function(a,b){l[b.id]=c(b.id)}),a(window).on("beforeunload.as3cf-settings",function(){if(!a.isEmptyObject(l)){var b=k.attr("id");return c(b)!==l[b]?as3cf.strings.save_alert:void 0}}),a(document).on("submit",".as3cf-main-settings form",function(b){a(window).off("beforeunload.as3cf-settings")}),a(".as3cf-switch").on("click",function(b){a(this).hasClass("disabled")||d(a(this).attr("id"))}),o.on("change",".sub-toggle",function(b){var c=a(this).attr("id");a(".as3cf-setting."+c).toggleClass("hide")}),a(".as3cf-domain").on("change",'input[type="radio"]',function(b){var c=a(this).closest('input:radio[name="domain"]:checked'),d=c.val(),e=a(this).parents(".as3cf-domain").find(".as3cf-setting.cloudfront"),f="cloudfront"===d;e.toggleClass("hide",!f)}),a(".url-preview").on("change","input",function(a){g()}),i(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){i()}),j(),a("#as3cf-remove-local-file").on("change",function(a){j()}),a('.as3cf-setting input[type="text"]').keypress(function(a){if(13===a.which)return a.preventDefault(),!1}),a('input[name="cloudfront"]').on("keyup",function(b){e(a(this))}),a('input[name="domain"]').on("change",function(b){var c=a(this),d=a("#"+k.attr("id")+' form button[type="submit"]');"cloudfront"!==c.val()?d.attr("disabled",!1):e(c.next(".as3cf-setting").find('input[name="cloudfront"]'))}),a('input[name="object-prefix"]').on("change",function(a){f()}),a("#tab-media > .as3cf-bucket-error").detach().insertAfter(".as3cf-bucket-container h3"),a("body").on("click",".bucket-action-manual",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-manual").show().siblings().hide()}),a("body").on("click",".bucket-action-browse",function(c){c.preventDefault(),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-select").show().siblings().hide(),as3cf.buckets.loadList(n),n=!1}),a("body").on("click",".bucket-action-create",function(c){c.preventDefault(),a(".as3cf-bucket-name").val(""),a(".as3cf-invalid-bucket-name").html(""),a(".as3cf-bucket-container."+b.prefix+" .as3cf-bucket-create").show().siblings().hide()}),a("body").on("click",".bucket-action-cancel",function(a){a.preventDefault(),as3cf.buckets.resetModal()}),a("body").on("click",".bucket-action-save",function(a){a.preventDefault(),as3cf.buckets.saveManual()}),a("body").on("click",'.as3cf-create-bucket-form button[type="submit"]',function(a){a.preventDefault(),as3cf.buckets.create()}),a("body").on("click",".bucket-action-refresh",function(a){a.preventDefault(),as3cf.buckets.loadList(!0)}),a("body").on("click",".as3cf-bucket-list a",function(b){b.preventDefault(),as3cf.buckets.saveSelected(a(this))}),a(".as3cf-bucket-container").on("click","a.js-link",function(b){return b.preventDefault(),window.open(a(this).attr("href")),!1}),a("body").on("as3cf-modal-open",function(c,d){if(".as3cf-bucket-container."+b.prefix===d){as3cf.buckets.resetModal();var e=a(".as3cf-bucket-manual h3").data("modal-title");a(".as3cf-bucket-manual h3").text(e),as3cf.buckets.disabledButtons()}}),as3cf.buckets.disabledButtons(),a("body").on("input keyup",".as3cf-create-bucket-form .as3cf-bucket-name",function(c){var d=a(this).val(),e=a(".as3cf-bucket-container."+b.prefix+" .as3cf-create-bucket-form");as3cf.buckets.isValidName(d)?e.find("button[type=submit]").removeAttr("disabled"):e.find("button[type=submit]").attr("disabled",!0),as3cf.buckets.updateNameNotice(d)}),a("body").on("input keyup",".as3cf-manual-save-bucket-form .as3cf-bucket-name",function(c){var d=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form");d.find(".as3cf-bucket-name").val().length<as3cf.buckets.validLength?d.find("button[type=submit]").attr("disabled",!0):d.find("button[type=submit]").removeAttr("disabled")})})}(jQuery,as3cfModal);
classes/amazon-s3-and-cloudfront.php CHANGED
@@ -80,7 +80,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
80
  const SETTINGS_KEY = 'tantan_wordpress_s3';
81
  const SETTINGS_CONSTANT = 'WPOS3_SETTINGS';
82
 
83
- const LATEST_UPGRADE_ROUTINE = 5;
84
 
85
  /**
86
  * @param string $plugin_file_path
@@ -113,6 +113,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
113
  new AS3CF_Upgrade_Meta_WP_Error( $this );
114
  new AS3CF_Upgrade_Content_Replace_URLs( $this );
115
  new AS3CF_Upgrade_EDD_Replace_URLs( $this );
 
116
 
117
  // Plugin setup
118
  add_action( 'aws_admin_menu', array( $this, 'admin_menu' ) );
@@ -400,20 +401,41 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
400
  if ( 'bucket' === $key && defined( $constant ) ) {
401
  $bucket = constant( $constant );
402
 
403
- if ( $bucket !== $value ) {
404
- // Save the defined bucket
405
- parent::set_setting( 'bucket', $bucket );
406
- // Clear region
407
- $this->remove_setting( 'region' );
408
  $this->save_settings();
409
  }
410
 
 
 
411
  return $bucket;
412
  }
413
 
414
  return false;
415
  }
416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
417
  /**
418
  * Filter in defined settings with sensible defaults.
419
  *
@@ -746,6 +768,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
746
  $bucket = $s3object['bucket'];
747
  $region = $this->get_s3object_region( $s3object );
748
  $paths = $this->get_attachment_file_paths( $post_id, false, false, $remove_backup_sizes );
 
749
 
750
  if ( is_wp_error( $region ) ) {
751
  $region = '';
@@ -1145,7 +1168,15 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1145
  }
1146
 
1147
  if ( ! @unlink( $path ) ) {
1148
- AS3CF_Error::log( 'Error removing local file ' . $path );
 
 
 
 
 
 
 
 
1149
  }
1150
  }
1151
  }
@@ -1750,7 +1781,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
1750
 
1751
  if ( ! is_null( $expires ) && $this->is_plugin_setup() ) {
1752
  try {
1753
- $expires = time() + $expires;
1754
  $secure_url = $this->get_s3client( $region )->getObjectUrl( $s3object['bucket'], $s3object['key'], $expires, $headers );
1755
 
1756
  return apply_filters( 'as3cf_get_attachment_secure_url', $secure_url, $s3object, $post_id, $expires, $headers );
@@ -2030,7 +2061,12 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2030
  return $file;
2031
  }
2032
 
2033
- $file_name = basename( $url['path'] );
 
 
 
 
 
2034
 
2035
  if ( false !== strpos( $file_name, '%' ) ) {
2036
  // File name already encoded, return original
@@ -2339,32 +2375,6 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2339
  return false;
2340
  }
2341
 
2342
- /**
2343
- * Get all AWS regions
2344
- *
2345
- * @return array
2346
- */
2347
- function get_aws_regions() {
2348
- $regionEnum = new ReflectionClass( 'Aws\Common\Enum\Region' );
2349
- $all_regions = $regionEnum->getConstants();
2350
-
2351
- $regions = array();
2352
- foreach ( $all_regions as $label => $region ) {
2353
- // Nicely format region name
2354
- if ( self::DEFAULT_REGION === $region ) {
2355
- $label = 'US Standard';
2356
- } else {
2357
- $label = strtolower( $label );
2358
- $label = str_replace( '_', ' ', $label );
2359
- $label = ucwords( $label );
2360
- }
2361
-
2362
- $regions[ $region ] = $label;
2363
- }
2364
-
2365
- return $regions;
2366
- }
2367
-
2368
  /**
2369
  * Add the settings menu item
2370
  *
@@ -2934,7 +2944,8 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
2934
  }
2935
 
2936
  $args = array(
2937
- 'limit' => false,
 
2938
  'spam' => 0,
2939
  'deleted' => 0,
2940
  'archived' => 0,
@@ -3122,10 +3133,13 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3122
  $output .= 'WordPress: ';
3123
  $output .= get_bloginfo( 'version', 'display' );
3124
  if ( is_multisite() ) {
3125
- $output .= ' Multisite';
 
3126
  $output .= "\r\n";
3127
  $output .= 'Multisite Site Count: ';
3128
  $output .= esc_html( get_blog_count() );
 
 
3129
  }
3130
  $output .= "\r\n";
3131
 
@@ -3444,6 +3458,17 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
3444
  $output .= implode( '', $mu_plugin_details );
3445
  }
3446
 
 
 
 
 
 
 
 
 
 
 
 
3447
  return $output;
3448
  }
3449
 
@@ -4317,21 +4342,4 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
4317
 
4318
  return $url;
4319
  }
4320
-
4321
- /**
4322
- * Update site option.
4323
- *
4324
- * @param string $option
4325
- * @param mixed $value
4326
- * @param bool $autoload
4327
- *
4328
- * @return bool
4329
- */
4330
- public function update_site_option( $option, $value, $autoload = true ) {
4331
- if ( is_multisite() ) {
4332
- return update_site_option( $option, $value );
4333
- }
4334
-
4335
- return update_option( $option, $value, $autoload );
4336
- }
4337
  }
80
  const SETTINGS_KEY = 'tantan_wordpress_s3';
81
  const SETTINGS_CONSTANT = 'WPOS3_SETTINGS';
82
 
83
+ const LATEST_UPGRADE_ROUTINE = 6;
84
 
85
  /**
86
  * @param string $plugin_file_path
113
  new AS3CF_Upgrade_Meta_WP_Error( $this );
114
  new AS3CF_Upgrade_Content_Replace_URLs( $this );
115
  new AS3CF_Upgrade_EDD_Replace_URLs( $this );
116
+ new AS3CF_Upgrade_Filter_Post_Excerpt( $this );
117
 
118
  // Plugin setup
119
  add_action( 'aws_admin_menu', array( $this, 'admin_menu' ) );
401
  if ( 'bucket' === $key && defined( $constant ) ) {
402
  $bucket = constant( $constant );
403
 
404
+ if ( ! empty( $value ) ) {
405
+ // Clear bucket
406
+ $this->remove_setting( 'bucket' );
 
 
407
  $this->save_settings();
408
  }
409
 
410
+ $this->remove_region_on_constant_change( $bucket, $constant );
411
+
412
  return $bucket;
413
  }
414
 
415
  return false;
416
  }
417
 
418
+ /**
419
+ * Remove region on constant change.
420
+ *
421
+ * @param string $bucket
422
+ * @param string $constant
423
+ */
424
+ private function remove_region_on_constant_change( $bucket, $constant ) {
425
+ $key = 'as3cf_constant_' . strtolower( $constant );
426
+ $value = get_site_transient( $key );
427
+
428
+ if ( false === $value || $bucket !== $value ) {
429
+ set_site_transient( $key, $bucket );
430
+ }
431
+
432
+ if ( false !== $value && $bucket !== $value ) {
433
+ // Clear region
434
+ $this->remove_setting( 'region' );
435
+ $this->save_settings();
436
+ }
437
+ }
438
+
439
  /**
440
  * Filter in defined settings with sensible defaults.
441
  *
768
  $bucket = $s3object['bucket'];
769
  $region = $this->get_s3object_region( $s3object );
770
  $paths = $this->get_attachment_file_paths( $post_id, false, false, $remove_backup_sizes );
771
+ $paths = apply_filters( 'as3cf_remove_attachment_paths', $paths, $post_id, $s3object, $remove_backup_sizes );
772
 
773
  if ( is_wp_error( $region ) ) {
774
  $region = '';
1168
  }
1169
 
1170
  if ( ! @unlink( $path ) ) {
1171
+ $message = 'Error removing local file ';
1172
+
1173
+ if ( ! file_exists( $path ) ) {
1174
+ $message = "Error removing local file. Couldn't find the file at ";
1175
+ } else if ( ! is_writable( $path ) ) {
1176
+ $message = 'Error removing local file. Ownership or permissions are mis-configured for ';
1177
+ }
1178
+
1179
+ AS3CF_Error::log( $message . $path );
1180
  }
1181
  }
1182
  }
1781
 
1782
  if ( ! is_null( $expires ) && $this->is_plugin_setup() ) {
1783
  try {
1784
+ $expires = time() + apply_filters( 'as3cf_expires', $expires );
1785
  $secure_url = $this->get_s3client( $region )->getObjectUrl( $s3object['bucket'], $s3object['key'], $expires, $headers );
1786
 
1787
  return apply_filters( 'as3cf_get_attachment_secure_url', $secure_url, $s3object, $post_id, $expires, $headers );
2061
  return $file;
2062
  }
2063
 
2064
+ if ( isset( $url['query'] ) ) {
2065
+ // Manually strip query string, as passing $url['path'] to basename results in corrupt � characters
2066
+ $file_name = basename( str_replace( '?' . $url['query'], '', $file ) );
2067
+ } else {
2068
+ $file_name = basename( $file );
2069
+ }
2070
 
2071
  if ( false !== strpos( $file_name, '%' ) ) {
2072
  // File name already encoded, return original
2375
  return false;
2376
  }
2377
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2378
  /**
2379
  * Add the settings menu item
2380
  *
2944
  }
2945
 
2946
  $args = array(
2947
+ 'limit' => false, // Deprecated
2948
+ 'number' => false, // WordPress 4.6+
2949
  'spam' => 0,
2950
  'deleted' => 0,
2951
  'archived' => 0,
3133
  $output .= 'WordPress: ';
3134
  $output .= get_bloginfo( 'version', 'display' );
3135
  if ( is_multisite() ) {
3136
+ $output .= ' Multisite ';
3137
+ $output .= '(' . ( is_subdomain_install() ? 'subdomain' : 'subdirectory' ) . ')';
3138
  $output .= "\r\n";
3139
  $output .= 'Multisite Site Count: ';
3140
  $output .= esc_html( get_blog_count() );
3141
+ $output .= "\r\n";
3142
+ $output .= 'Domain Mapping: ' . ( defined( 'SUNRISE' ) && SUNRISE ? 'Enabled' : 'Disabled' );
3143
  }
3144
  $output .= "\r\n";
3145
 
3458
  $output .= implode( '', $mu_plugin_details );
3459
  }
3460
 
3461
+ $dropins = get_dropins();
3462
+ if ( $dropins ) {
3463
+ $output .= "\r\n\r\n";
3464
+ $output .= "Drop-ins:\r\n";
3465
+
3466
+ foreach ( $dropins as $file => $dropin ) {
3467
+ $output .= $file . ( isset( $dropin['Name'] ) ? ' - ' . $dropin['Name'] : '' );
3468
+ $output .= "\r\n";
3469
+ }
3470
+ }
3471
+
3472
  return $output;
3473
  }
3474
 
4342
 
4343
  return $url;
4344
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4345
  }
classes/as3cf-filter.php CHANGED
@@ -344,8 +344,7 @@ abstract class AS3CF_Filter {
344
  * @return bool
345
  */
346
  protected function attachment_id_matches_src( $attachment_id, $url ) {
347
- $base_urls = array();
348
- $meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
349
 
350
  if ( ! isset( $meta['sizes'] ) ) {
351
  // No sizes found, return
344
  * @return bool
345
  */
346
  protected function attachment_id_matches_src( $attachment_id, $url ) {
347
+ $meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
 
348
 
349
  if ( ! isset( $meta['sizes'] ) ) {
350
  // No sizes found, return
classes/{upgrades/as3cf-content-replace-urls.php → as3cf-upgrade-filter-post.php} RENAMED
@@ -6,14 +6,19 @@ if ( ! defined( 'ABSPATH' ) ) {
6
  }
7
 
8
  /**
9
- * AS3CF_Upgrade_Content_Replace_URLs Class
10
  *
11
- * This class handles replacing all S3 URLs in post
12
- * content with the local URL.
13
  *
14
- * @since 1.2
15
  */
16
- class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
 
 
 
 
 
17
 
18
  /**
19
  * @var int Current blog ID
@@ -31,19 +36,9 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
31
  protected $session;
32
 
33
  /**
34
- * Initiate the upgrade
35
- *
36
- * @param object $as3cf Instance of calling class
37
  */
38
- public function __construct( $as3cf ) {
39
- $this->upgrade_id = 4;
40
- $this->upgrade_name = 'replace_s3_urls';
41
- $this->upgrade_type = 'posts';
42
-
43
- $this->running_update_text = __( 'and ensuring that only the local URL exists in post content.', 'amazon-s3-and-cloudfront' );
44
-
45
- parent::__construct( $as3cf );
46
- }
47
 
48
  /**
49
  * Fire up the upgrade
@@ -94,6 +89,8 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
94
  * Cron job to update post content, ensuring no S3 URLs exist.
95
  */
96
  public function do_upgrade() {
 
 
97
  // Check if the cron should even be running
98
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id || $this->get_upgrade_status() !== self::STATUS_RUNNING ) {
99
  $this->unschedule();
@@ -162,6 +159,19 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
162
  $this->as3cf->restore_current_blog();
163
  }
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  $this->save_session( $this->session );
166
  }
167
 
@@ -183,8 +193,9 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
183
  }
184
 
185
  if ( is_null( $blog['total_attachments'] ) ) {
186
- // Handle theme mods
187
- $this->upgrade_theme_mods( $blog['prefix'] );
 
188
 
189
  // Count total attachments
190
  $count = $this->as3cf->count_attachments( $blog['prefix'], true );
@@ -235,39 +246,6 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
235
  return true;
236
  }
237
 
238
- /**
239
- * Upgrade theme mods. Ensures background and header images have local URLs saved to the database.
240
- *
241
- * @param string $prefix
242
- */
243
- protected function upgrade_theme_mods( $prefix ) {
244
- global $wpdb;
245
-
246
- $mods = $wpdb->get_results( "SELECT * FROM `{$prefix}options` WHERE option_name LIKE 'theme_mods_%'" );
247
-
248
- foreach ( $mods as $mod ) {
249
- $value = maybe_unserialize( $mod->option_value );
250
-
251
- if ( isset( $value['background_image'] ) ) {
252
- $value['background_image'] = $this->as3cf->filter_s3->filter_customizer_image( $value['background_image'] );
253
- }
254
-
255
- if ( isset( $value['header_image'] ) ) {
256
- $value['header_image'] = $this->as3cf->filter_s3->filter_customizer_image( $value['header_image'] );
257
- }
258
-
259
- if ( isset( $value['header_image_data'] ) ) {
260
- $value['header_image_data'] = $this->as3cf->filter_s3->filter_header_image_data( $value['header_image_data'] );
261
- }
262
-
263
- $value = maybe_serialize( $value );
264
-
265
- if ( $value !== $mod->option_value ) {
266
- $wpdb->query( "UPDATE `{$prefix}options` SET option_value = '{$value}' WHERE option_id = '{$mod->option_id}'" );
267
- }
268
- }
269
- }
270
-
271
  /**
272
  * Get items to process.
273
  *
@@ -411,7 +389,7 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
411
  $url_pairs[ $key ]['new_url'] = $this->as3cf->remove_scheme( $url_pair['new_url'] );
412
  }
413
 
414
- return apply_filters( 'as3cf_find_replace_url_pairs', $url_pairs, $file_path, $old_url, $new_url, $meta );
415
  }
416
 
417
  /**
@@ -519,7 +497,7 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
519
  $sql .= " OR ";
520
  }
521
 
522
- $sql .= "post_content LIKE '%{$path}%'";
523
  }
524
 
525
  return "SELECT ID FROM {$wpdb->posts} WHERE ID > {$where_lowest_id} AND ID <= {$where_highest_id} AND ({$sql})";
@@ -547,23 +525,14 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
547
 
548
  if ( empty( $sql ) ) {
549
  // First replace statement
550
- $sql = "REPLACE(post_content, '{$pair['old_url']}', '{$pair['new_url']}')";
551
  } else {
552
  // Nested replace statement
553
  $sql = "REPLACE({$sql}, '{$pair['old_url']}', '{$pair['new_url']}')";
554
  }
555
  }
556
 
557
- return "UPDATE {$wpdb->posts} SET `post_content` = {$sql} WHERE `ID` IN({$ids})";
558
- }
559
-
560
- /**
561
- * Get running message.
562
- *
563
- * @return string
564
- */
565
- protected function get_running_message() {
566
- return sprintf( __( '<strong>Running 1.2 Upgrade%1$s</strong><br>A find &amp; replace is running in the background to update URLs in your content. %2$s', 'amazon-s3-and-cloudfront' ), $this->get_progress_text(), $this->get_generic_message() );
567
  }
568
 
569
  /**
@@ -572,7 +541,7 @@ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade {
572
  * @return string
573
  */
574
  protected function get_paused_message() {
575
- return sprintf( __( '<strong>Paused 1.2 Upgrade</strong><br>The find &amp; replace to update URLs in your content has been paused. %s', 'amazon-s3-and-cloudfront' ), $this->get_generic_message() );
576
  }
577
 
578
  /**
6
  }
7
 
8
  /**
9
+ * AS3CF_Upgrade_Filter Class
10
  *
11
+ * The base upgrade class for handling find and replace
12
+ * on the posts tables for content filtering.
13
  *
14
+ * @since 1.3
15
  */
16
+ abstract class AS3CF_Upgrade_Filter_Post extends AS3CF_Upgrade {
17
+
18
+ /**
19
+ * @var string 'metadata', 'attachment'
20
+ */
21
+ protected $upgrade_type = 'posts';
22
 
23
  /**
24
  * @var int Current blog ID
36
  protected $session;
37
 
38
  /**
39
+ * @var string
 
 
40
  */
41
+ protected $column_name;
 
 
 
 
 
 
 
 
42
 
43
  /**
44
  * Fire up the upgrade
89
  * Cron job to update post content, ensuring no S3 URLs exist.
90
  */
91
  public function do_upgrade() {
92
+ $this->lock_upgrade();
93
+
94
  // Check if the cron should even be running
95
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id || $this->get_upgrade_status() !== self::STATUS_RUNNING ) {
96
  $this->unschedule();
159
  $this->as3cf->restore_current_blog();
160
  }
161
 
162
+ $this->maybe_finish_upgrade();
163
+ }
164
+
165
+ /**
166
+ * Maybe finish the upgrade process.
167
+ */
168
+ protected function maybe_finish_upgrade() {
169
+ if ( $this->session['processed_attachments'] >= $this->session['total_attachments']) {
170
+ $this->upgrade_finished();
171
+
172
+ return;
173
+ }
174
+
175
  $this->save_session( $this->session );
176
  }
177
 
193
  }
194
 
195
  if ( is_null( $blog['total_attachments'] ) ) {
196
+ if ( method_exists( $this, 'process_blog' ) ) {
197
+ $this->process_blog( $blog );
198
+ }
199
 
200
  // Count total attachments
201
  $count = $this->as3cf->count_attachments( $blog['prefix'], true );
246
  return true;
247
  }
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  /**
250
  * Get items to process.
251
  *
389
  $url_pairs[ $key ]['new_url'] = $this->as3cf->remove_scheme( $url_pair['new_url'] );
390
  }
391
 
392
+ return apply_filters( 'as3cf_update_' . $this->upgrade_name . '_url_pairs', $url_pairs, $file_path, $old_url, $new_url, $meta );
393
  }
394
 
395
  /**
497
  $sql .= " OR ";
498
  }
499
 
500
+ $sql .= "{$this->column_name} LIKE '%{$path}%'";
501
  }
502
 
503
  return "SELECT ID FROM {$wpdb->posts} WHERE ID > {$where_lowest_id} AND ID <= {$where_highest_id} AND ({$sql})";
525
 
526
  if ( empty( $sql ) ) {
527
  // First replace statement
528
+ $sql = "REPLACE({$this->column_name}, '{$pair['old_url']}', '{$pair['new_url']}')";
529
  } else {
530
  // Nested replace statement
531
  $sql = "REPLACE({$sql}, '{$pair['old_url']}', '{$pair['new_url']}')";
532
  }
533
  }
534
 
535
+ return "UPDATE {$wpdb->posts} SET `{$this->column_name}` = {$sql} WHERE `ID` IN({$ids})";
 
 
 
 
 
 
 
 
 
536
  }
537
 
538
  /**
541
  * @return string
542
  */
543
  protected function get_paused_message() {
544
+ return sprintf( __( '<strong>Paused Upgrade</strong><br>The find &amp; replace to update URLs has been paused. %s', 'amazon-s3-and-cloudfront' ), $this->get_generic_message() );
545
  }
546
 
547
  /**
classes/as3cf-upgrade.php CHANGED
@@ -78,6 +78,11 @@ abstract class AS3CF_Upgrade {
78
  */
79
  protected $error_count;
80
 
 
 
 
 
 
81
  const STATUS_RUNNING = 1;
82
  const STATUS_ERROR = 2;
83
  const STATUS_PAUSED = 3;
@@ -90,8 +95,9 @@ abstract class AS3CF_Upgrade {
90
  public function __construct( $as3cf ) {
91
  $this->as3cf = $as3cf;
92
 
93
- $this->cron_hook = 'as3cf_cron_update_' . $this->upgrade_name;
94
- $this->cron_schedule_key = 'as3cf_update_' . $this->upgrade_name . '_interval';
 
95
 
96
  $this->cron_interval_in_minutes = apply_filters( 'as3cf_update_' . $this->upgrade_name . '_interval', 2 );
97
  $this->error_threshold = apply_filters( 'as3cf_update_' . $this->upgrade_name . '_error_threshold', 20 );
@@ -128,16 +134,6 @@ abstract class AS3CF_Upgrade {
128
  return false;
129
  }
130
 
131
- // If the upgrade status is already set, then we've already initialized the upgrade
132
- if ( $upgrade_status = $this->get_upgrade_status() ) {
133
- if ( self::STATUS_RUNNING === $upgrade_status ) {
134
- // Make sure cron job is persisted in case it has dropped
135
- $this->schedule();
136
- }
137
-
138
- return false;
139
- }
140
-
141
  // Have we completed the upgrade?
142
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id ) {
143
  return false;
@@ -148,6 +144,11 @@ abstract class AS3CF_Upgrade {
148
  return false;
149
  }
150
 
 
 
 
 
 
151
  // Do we actually have attachments to process?
152
  if ( 0 === $this->count_items_to_process() ) {
153
  $this->upgrade_finished();
@@ -155,6 +156,16 @@ abstract class AS3CF_Upgrade {
155
  return false;
156
  }
157
 
 
 
 
 
 
 
 
 
 
 
158
  return true;
159
  }
160
 
@@ -185,6 +196,13 @@ abstract class AS3CF_Upgrade {
185
  */
186
  abstract protected function upgrade_item( $attachment );
187
 
 
 
 
 
 
 
 
188
  /**
189
  * Fire up the upgrade
190
  */
@@ -199,6 +217,8 @@ abstract class AS3CF_Upgrade {
199
  * Cron job to update the region of the bucket in s3 metadata
200
  */
201
  public function do_upgrade() {
 
 
202
  // Check if the cron should even be running
203
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id || $this->get_upgrade_status() !== self::STATUS_RUNNING ) {
204
  $this->unschedule();
@@ -570,4 +590,11 @@ abstract class AS3CF_Upgrade {
570
 
571
  return true;
572
  }
 
 
 
 
 
 
 
573
  }
78
  */
79
  protected $error_count;
80
 
81
+ /**
82
+ * @var string
83
+ */
84
+ protected $lock_key = 'as3cf_upgrade_lock';
85
+
86
  const STATUS_RUNNING = 1;
87
  const STATUS_ERROR = 2;
88
  const STATUS_PAUSED = 3;
95
  public function __construct( $as3cf ) {
96
  $this->as3cf = $as3cf;
97
 
98
+ $this->running_update_text = $this->get_running_update_text();
99
+ $this->cron_hook = 'as3cf_cron_update_' . $this->upgrade_name;
100
+ $this->cron_schedule_key = 'as3cf_update_' . $this->upgrade_name . '_interval';
101
 
102
  $this->cron_interval_in_minutes = apply_filters( 'as3cf_update_' . $this->upgrade_name . '_interval', 2 );
103
  $this->error_threshold = apply_filters( 'as3cf_update_' . $this->upgrade_name . '_error_threshold', 20 );
134
  return false;
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
137
  // Have we completed the upgrade?
138
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id ) {
139
  return false;
144
  return false;
145
  }
146
 
147
+ // Does the upgrade lock exist?
148
+ if ( false !== get_site_transient( $this->lock_key ) ) {
149
+ return false;
150
+ }
151
+
152
  // Do we actually have attachments to process?
153
  if ( 0 === $this->count_items_to_process() ) {
154
  $this->upgrade_finished();
156
  return false;
157
  }
158
 
159
+ // If the upgrade status is already set, then we've already initialized the upgrade
160
+ if ( $upgrade_status = $this->get_upgrade_status() ) {
161
+ if ( self::STATUS_RUNNING === $upgrade_status ) {
162
+ // Make sure cron job is persisted in case it has dropped
163
+ $this->schedule();
164
+ }
165
+
166
+ return false;
167
+ }
168
+
169
  return true;
170
  }
171
 
196
  */
197
  abstract protected function upgrade_item( $attachment );
198
 
199
+ /**
200
+ * Get running update text.
201
+ *
202
+ * @return string
203
+ */
204
+ abstract protected function get_running_update_text();
205
+
206
  /**
207
  * Fire up the upgrade
208
  */
217
  * Cron job to update the region of the bucket in s3 metadata
218
  */
219
  public function do_upgrade() {
220
+ $this->lock_upgrade();
221
+
222
  // Check if the cron should even be running
223
  if ( $this->get_saved_upgrade_id() >= $this->upgrade_id || $this->get_upgrade_status() !== self::STATUS_RUNNING ) {
224
  $this->unschedule();
590
 
591
  return true;
592
  }
593
+
594
+ /**
595
+ * Lock upgrade.
596
+ */
597
+ protected function lock_upgrade() {
598
+ set_site_transient( $this->lock_key, $this->upgrade_id, MINUTE_IN_SECONDS * 3 );
599
+ }
600
  }
classes/upgrades/as3cf-file-sizes.php CHANGED
@@ -25,18 +25,27 @@ if ( ! defined( 'ABSPATH' ) ) {
25
  class AS3CF_Upgrade_File_Sizes extends AS3CF_Upgrade {
26
 
27
  /**
28
- * Initiate the upgrade
29
- *
30
- * @param object $as3cf Instance of calling class
31
  */
32
- public function __construct( $as3cf ) {
33
- $this->upgrade_id = 2;
34
- $this->upgrade_name = 'file_sizes';
35
- $this->upgrade_type = 'attachments';
36
 
37
- $this->running_update_text = __( 'and updating the metadata with the sizes of files that have been removed from the server. This will allow us to serve the correct size for media items and the total space used in Multisite subsites.', 'amazon-s3-and-cloudfront' );
 
 
 
38
 
39
- parent::__construct( $as3cf );
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  /**
25
  class AS3CF_Upgrade_File_Sizes extends AS3CF_Upgrade {
26
 
27
  /**
28
+ * @var int
 
 
29
  */
30
+ protected $upgrade_id = 2;
 
 
 
31
 
32
+ /**
33
+ * @var string
34
+ */
35
+ protected $upgrade_name = 'file_sizes';
36
 
37
+ /**
38
+ * @var string 'metadata', 'attachment'
39
+ */
40
+ protected $upgrade_type = 'attachments';
41
+
42
+ /**
43
+ * Get running update text.
44
+ *
45
+ * @return string
46
+ */
47
+ protected function get_running_update_text() {
48
+ return __( 'and updating the metadata with the sizes of files that have been removed from the server. This will allow us to serve the correct size for media items and the total space used in Multisite subsites.', 'amazon-s3-and-cloudfront' );
49
  }
50
 
51
  /**
classes/upgrades/{as3cf-edd-replace-urls.php → as3cf-filter-edd.php} RENAMED
@@ -16,18 +16,27 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  class AS3CF_Upgrade_EDD_Replace_URLs extends AS3CF_Upgrade {
17
 
18
  /**
19
- * Initiate the upgrade
20
- *
21
- * @param object $as3cf Instance of calling class
22
  */
23
- public function __construct( $as3cf ) {
24
- $this->upgrade_id = 5;
25
- $this->upgrade_name = 'replace_edd_urls';
26
- $this->upgrade_type = 'post meta';
27
 
28
- $this->running_update_text = __( 'and ensuring that only the local URL exists in EDD post meta.', 'amazon-s3-and-cloudfront' );
 
 
 
29
 
30
- parent::__construct( $as3cf );
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  /**
16
  class AS3CF_Upgrade_EDD_Replace_URLs extends AS3CF_Upgrade {
17
 
18
  /**
19
+ * @var int
 
 
20
  */
21
+ protected $upgrade_id = 5;
 
 
 
22
 
23
+ /**
24
+ * @var string
25
+ */
26
+ protected $upgrade_name = 'replace_edd_urls';
27
 
28
+ /**
29
+ * @var string 'metadata', 'attachment'
30
+ */
31
+ protected $upgrade_type = 'post meta';
32
+
33
+ /**
34
+ * Get running update text.
35
+ *
36
+ * @return string
37
+ */
38
+ protected function get_running_update_text() {
39
+ return __( 'and ensuring that only the local URL exists in EDD post meta.', 'amazon-s3-and-cloudfront' );
40
  }
41
 
42
  /**
classes/upgrades/as3cf-filter-post-content.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ /**
9
+ * AS3CF_Upgrade_Content_Replace_URLs Class
10
+ *
11
+ * This class handles replacing all S3 URLs in post
12
+ * content with the local URL.
13
+ *
14
+ * @since 1.2
15
+ */
16
+ class AS3CF_Upgrade_Content_Replace_URLs extends AS3CF_Upgrade_Filter_Post {
17
+
18
+ /**
19
+ * @var int
20
+ */
21
+ protected $upgrade_id = 4;
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ protected $upgrade_name = 'replace_s3_urls';
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ protected $column_name = 'post_content';
32
+
33
+ /**
34
+ * Get running update text.
35
+ *
36
+ * @return string
37
+ */
38
+ protected function get_running_update_text() {
39
+ return __( 'and ensuring that only the local URL exists in post content.', 'amazon-s3-and-cloudfront' );
40
+ }
41
+
42
+ /**
43
+ * Get running message.
44
+ *
45
+ * @return string
46
+ */
47
+ protected function get_running_message() {
48
+ return sprintf( __( '<strong>Running Content Upgrade%1$s</strong><br>A find &amp; replace is running in the background to update URLs in your post content. %2$s', 'amazon-s3-and-cloudfront' ), $this->get_progress_text(), $this->get_generic_message() );
49
+ }
50
+
51
+ /**
52
+ * Process blog.
53
+ *
54
+ * @param array $blog
55
+ */
56
+ protected function process_blog( $blog ) {
57
+ $this->upgrade_theme_mods( $blog['prefix'] );
58
+ }
59
+
60
+ /**
61
+ * Upgrade theme mods. Ensures background and header images have local URLs saved to the database.
62
+ *
63
+ * @param string $prefix
64
+ */
65
+ protected function upgrade_theme_mods( $prefix ) {
66
+ global $wpdb;
67
+
68
+ $mods = $wpdb->get_results( "SELECT * FROM `{$prefix}options` WHERE option_name LIKE 'theme_mods_%'" );
69
+
70
+ foreach ( $mods as $mod ) {
71
+ $value = maybe_unserialize( $mod->option_value );
72
+
73
+ if ( isset( $value['background_image'] ) ) {
74
+ $value['background_image'] = $this->as3cf->filter_s3->filter_customizer_image( $value['background_image'] );
75
+ }
76
+
77
+ if ( isset( $value['header_image'] ) ) {
78
+ $value['header_image'] = $this->as3cf->filter_s3->filter_customizer_image( $value['header_image'] );
79
+ }
80
+
81
+ if ( isset( $value['header_image_data'] ) ) {
82
+ $value['header_image_data'] = $this->as3cf->filter_s3->filter_header_image_data( $value['header_image_data'] );
83
+ }
84
+
85
+ $value = maybe_serialize( $value );
86
+
87
+ if ( $value !== $mod->option_value ) {
88
+ $wpdb->query( "UPDATE `{$prefix}options` SET option_value = '{$value}' WHERE option_id = '{$mod->option_id}'" );
89
+ }
90
+ }
91
+ }
92
+
93
+ }
classes/upgrades/as3cf-filter-post-excerpt.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ /**
9
+ * AS3CF_Upgrade_Filter_Post_Excerpt Class
10
+ *
11
+ * This class handles replacing all S3 URLs in post
12
+ * excerpts with the local URL.
13
+ *
14
+ * @since 1.3
15
+ */
16
+ class AS3CF_Upgrade_Filter_Post_Excerpt extends AS3CF_Upgrade_Filter_Post {
17
+
18
+ /**
19
+ * @var int
20
+ */
21
+ protected $upgrade_id = 6;
22
+
23
+ /**
24
+ * @var string
25
+ */
26
+ protected $upgrade_name = 'filter_post_excerpt';
27
+
28
+ /**
29
+ * @var string
30
+ */
31
+ protected $column_name = 'post_excerpt';
32
+
33
+ /**
34
+ * Get running update text.
35
+ *
36
+ * @return string
37
+ */
38
+ protected function get_running_update_text() {
39
+ return __( 'and ensuring that only the local URL exists in post excerpts.', 'amazon-s3-and-cloudfront' );
40
+ }
41
+
42
+ /**
43
+ * Get running message.
44
+ *
45
+ * @return string
46
+ */
47
+ protected function get_running_message() {
48
+ return sprintf( __( '<strong>Running Excerpts Upgrade%1$s</strong><br>A find &amp; replace is running in the background to update URLs in your post excerpts. %2$s', 'amazon-s3-and-cloudfront' ), $this->get_progress_text(), $this->get_generic_message() );
49
+ }
50
+ }
classes/upgrades/as3cf-meta-wp-error.php CHANGED
@@ -26,18 +26,27 @@ if ( ! defined( 'ABSPATH' ) ) {
26
  class AS3CF_Upgrade_Meta_WP_Error extends AS3CF_Upgrade {
27
 
28
  /**
29
- * Initiate the upgrade
30
- *
31
- * @param object $as3cf Instance of calling class
32
  */
33
- public function __construct( $as3cf ) {
34
- $this->upgrade_id = 3;
35
- $this->upgrade_name = 'meta_error';
36
- $this->upgrade_type = 'attachments';
37
 
38
- $this->running_update_text = __( 'and rebuilding the metadata for attachments that may have been corrupted.', 'amazon-s3-and-cloudfront' );
 
 
 
39
 
40
- parent::__construct( $as3cf );
 
 
 
 
 
 
 
 
 
 
 
41
  }
42
 
43
  /**
26
  class AS3CF_Upgrade_Meta_WP_Error extends AS3CF_Upgrade {
27
 
28
  /**
29
+ * @var int
 
 
30
  */
31
+ protected $upgrade_id = 3;
 
 
 
32
 
33
+ /**
34
+ * @var string
35
+ */
36
+ protected $upgrade_name = 'meta_error';
37
 
38
+ /**
39
+ * @var string 'metadata', 'attachment'
40
+ */
41
+ protected $upgrade_type = 'attachments';
42
+
43
+ /**
44
+ * Get running update text.
45
+ *
46
+ * @return string
47
+ */
48
+ protected function get_running_update_text() {
49
+ return __( 'and rebuilding the metadata for attachments that may have been corrupted.', 'amazon-s3-and-cloudfront' );
50
  }
51
 
52
  /**
classes/upgrades/as3cf-region-meta.php CHANGED
@@ -24,18 +24,27 @@ if ( ! defined( 'ABSPATH' ) ) {
24
  class AS3CF_Upgrade_Region_Meta extends AS3CF_Upgrade {
25
 
26
  /**
27
- * Initiate the upgrade
28
- *
29
- * @param object $as3cf Instance of calling class
30
  */
31
- public function __construct( $as3cf ) {
32
- $this->upgrade_id = 1;
33
- $this->upgrade_name = 'meta_with_region';
34
- $this->upgrade_type = 'metadata';
35
 
36
- $this->running_update_text = __( 'and updating the metadata with the bucket region it is served from. This will allow us to serve your files from the proper S3 region subdomain <span style="white-space:nowrap;">(e.g. s3-us-west-2.amazonaws.com)</span>.', 'amazon-s3-and-cloudfront' );
 
 
 
37
 
38
- parent::__construct( $as3cf );
 
 
 
 
 
 
 
 
 
 
 
39
  }
40
 
41
  /**
24
  class AS3CF_Upgrade_Region_Meta extends AS3CF_Upgrade {
25
 
26
  /**
27
+ * @var int
 
 
28
  */
29
+ protected $upgrade_id = 1;
 
 
 
30
 
31
+ /**
32
+ * @var string
33
+ */
34
+ protected $upgrade_name = 'meta_with_region';
35
 
36
+ /**
37
+ * @var string 'metadata', 'attachment'
38
+ */
39
+ protected $upgrade_type = 'metadata';
40
+
41
+ /**
42
+ * Get running update text.
43
+ *
44
+ * @return string
45
+ */
46
+ protected function get_running_update_text() {
47
+ return __( 'and updating the metadata with the bucket region it is served from. This will allow us to serve your files from the proper S3 region subdomain <span style="white-space:nowrap;">(e.g. s3-us-west-2.amazonaws.com)</span>.', 'amazon-s3-and-cloudfront' );
48
  }
49
 
50
  /**
classes/wp-aws-compatibility-check.php CHANGED
@@ -332,7 +332,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
332
  } else {
333
  $msg .= ' ' . __( 'It appears to be installed already.', 'amazon-s3-and-cloudfront' );
334
  $activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
335
- $msg .= ' <a style="font-weight:bold;text-decoration:none;" href="' . $activate_url . '">' . _x( 'Activate it now.', 'Activate plugin', 'amazon-s3-and-cloudfront' ) . '</a>';
336
  }
337
  } else {
338
  $install_url = 'https://deliciousbrains.com/my-account/';
@@ -479,7 +479,7 @@ if ( ! class_exists( 'WP_AWS_Compatibility_Check' ) ) {
479
  * @param string $message
480
  */
481
  function render_notice( $message ) {
482
- printf( '<div class="' . $this->notice_class . ' aws-compatibility-notice"><p>%s</p></div>', $message );
483
  }
484
 
485
  /**
332
  } else {
333
  $msg .= ' ' . __( 'It appears to be installed already.', 'amazon-s3-and-cloudfront' );
334
  $activate_url = $this->get_plugin_action_url( 'activate', $parent_basename );
335
+ $msg .= ' <a id="'. $this->plugin_slug . '-activate-parent" style="font-weight:bold;text-decoration:none;" href="' . $activate_url . '">' . _x( 'Activate it now.', 'Activate plugin', 'amazon-s3-and-cloudfront' ) . '</a>';
336
  }
337
  } else {
338
  $install_url = 'https://deliciousbrains.com/my-account/';
479
  * @param string $message
480
  */
481
  function render_notice( $message ) {
482
+ printf( '<div id="aws-compat-notice' . $this->plugin_slug . '" class="' . $this->notice_class . ' aws-compatibility-notice"><p>%s</p></div>', $message );
483
  }
484
 
485
  /**
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: 2016-11-28 11:11+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"
@@ -25,127 +25,127 @@ msgstr ""
25
  msgid "S3 and CloudFront"
26
  msgstr ""
27
 
28
- #: classes/amazon-s3-and-cloudfront.php:214
29
  #: view/bucket-setting.php:18
30
  msgid "defined in wp-config.php"
31
  msgstr ""
32
 
33
- #: classes/amazon-s3-and-cloudfront.php:851
34
  msgid "Upload aborted by filter 'as3cf_pre_upload_attachment'"
35
  msgstr ""
36
 
37
- #: classes/amazon-s3-and-cloudfront.php:862
38
  #, php-format
39
  msgid "File %s does not exist"
40
  msgstr ""
41
 
42
- #: classes/amazon-s3-and-cloudfront.php:873
43
  #, php-format
44
  msgid "Mime type %s is not allowed"
45
  msgstr ""
46
 
47
- #: classes/amazon-s3-and-cloudfront.php:958
48
  #, php-format
49
  msgid "Error uploading %s to S3: %s"
50
  msgstr ""
51
 
52
- #: classes/amazon-s3-and-cloudfront.php:2134
53
  msgid "Cheatin&#8217; eh?"
54
  msgstr ""
55
 
56
- #: classes/amazon-s3-and-cloudfront.php:2138
57
  msgid "You do not have sufficient permissions to access this page."
58
  msgstr ""
59
 
60
- #: classes/amazon-s3-and-cloudfront.php:2144
61
  msgid "No bucket name provided."
62
  msgstr ""
63
 
64
- #: classes/amazon-s3-and-cloudfront.php:2429
65
  msgid "Error Getting Bucket Region"
66
  msgstr ""
67
 
68
- #: classes/amazon-s3-and-cloudfront.php:2430
69
  #, php-format
70
  msgid "There was an error attempting to get the region of the bucket %s: %s"
71
  msgstr ""
72
 
73
- #: classes/amazon-s3-and-cloudfront.php:2550
74
  msgid ""
75
  "This is a test file to check if the user has write permission to S3. Delete "
76
  "me if found."
77
  msgstr ""
78
 
79
- #: classes/amazon-s3-and-cloudfront.php:2582
80
  #, php-format
81
  msgid ""
82
  "There was an error attempting to check the permissions of the bucket %s: %s"
83
  msgstr ""
84
 
85
- #: classes/amazon-s3-and-cloudfront.php:2639
86
  msgid "Error creating bucket"
87
  msgstr ""
88
 
89
- #: classes/amazon-s3-and-cloudfront.php:2640
90
  msgid "Bucket name too short."
91
  msgstr ""
92
 
93
- #: classes/amazon-s3-and-cloudfront.php:2641
94
  msgid "Bucket name too long."
95
  msgstr ""
96
 
97
- #: classes/amazon-s3-and-cloudfront.php:2642
98
  msgid ""
99
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
100
  "periods and hyphens."
101
  msgstr ""
102
 
103
- #: classes/amazon-s3-and-cloudfront.php:2643
104
  msgid "Error saving bucket"
105
  msgstr ""
106
 
107
- #: classes/amazon-s3-and-cloudfront.php:2644
108
  msgid "Error fetching buckets"
109
  msgstr ""
110
 
111
- #: classes/amazon-s3-and-cloudfront.php:2645
112
  msgid "Error getting URL preview: "
113
  msgstr ""
114
 
115
- #: classes/amazon-s3-and-cloudfront.php:2646
116
  msgid "The changes you made will be lost if you navigate away from this page"
117
  msgstr ""
118
 
119
- #: classes/amazon-s3-and-cloudfront.php:2647
120
  msgid "Getting diagnostic info..."
121
  msgstr ""
122
 
123
- #: classes/amazon-s3-and-cloudfront.php:2648
124
  msgid "Error getting diagnostic info: "
125
  msgstr ""
126
 
127
- #: classes/amazon-s3-and-cloudfront.php:2716
128
  msgid "Cheatin' eh?"
129
  msgstr ""
130
 
131
- #: classes/amazon-s3-and-cloudfront.php:2824
132
  msgctxt "Show the media library tab"
133
  msgid "Media Library"
134
  msgstr ""
135
 
136
- #: classes/amazon-s3-and-cloudfront.php:2825
137
  msgctxt "Show the support tab"
138
  msgid "Support"
139
  msgstr ""
140
 
141
- #: classes/amazon-s3-and-cloudfront.php:3041
142
  #, php-format
143
  msgid ""
144
  "<strong>WP Offload S3</strong> &mdash; The file %s has been given %s "
145
  "permissions on Amazon S3."
146
  msgstr ""
147
 
148
- #: classes/amazon-s3-and-cloudfront.php:3060
149
  msgid ""
150
  "<strong>WP Offload S3 Requirement Missing</strong> &mdash; Looks like you "
151
  "don't have an image manipulation library installed on this server and "
@@ -153,11 +153,11 @@ msgid ""
153
  "Please setup GD or ImageMagick."
154
  msgstr ""
155
 
156
- #: classes/amazon-s3-and-cloudfront.php:3723
157
  msgid "Quick Start Guide"
158
  msgstr ""
159
 
160
- #: classes/amazon-s3-and-cloudfront.php:3725
161
  #, php-format
162
  msgid ""
163
  "Looks like we don't have write access to this bucket. It's likely that the "
@@ -166,7 +166,7 @@ msgid ""
166
  "correctly."
167
  msgstr ""
168
 
169
- #: classes/amazon-s3-and-cloudfront.php:3727
170
  #, php-format
171
  msgid ""
172
  "Looks like we don't have access to the buckets. It's likely that the user "
@@ -174,39 +174,39 @@ msgid ""
174
  "Please see our %s for instructions on setting up permissions correctly."
175
  msgstr ""
176
 
177
- #: classes/amazon-s3-and-cloudfront.php:3878
178
  msgid "WP Offload S3 Activation"
179
  msgstr ""
180
 
181
- #: classes/amazon-s3-and-cloudfront.php:3879
182
  msgid ""
183
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
184
  "automatically deactivated WP Offload S3 Lite."
185
  msgstr ""
186
 
187
- #: classes/amazon-s3-and-cloudfront.php:3881
188
  msgid "WP Offload S3 Lite Activation"
189
  msgstr ""
190
 
191
- #: classes/amazon-s3-and-cloudfront.php:3882
192
  msgid ""
193
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
194
  "automatically deactivated WP Offload S3."
195
  msgstr ""
196
 
197
- #: classes/amazon-s3-and-cloudfront.php:3956
198
  msgid "More info"
199
  msgstr ""
200
 
201
- #: classes/amazon-s3-and-cloudfront.php:4047
202
  msgid "this doc"
203
  msgstr ""
204
 
205
- #: classes/amazon-s3-and-cloudfront.php:4049
206
  msgid "WP Offload S3 Feature Removed"
207
  msgstr ""
208
 
209
- #: classes/amazon-s3-and-cloudfront.php:4050
210
  #, php-format
211
  msgid ""
212
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
@@ -217,32 +217,32 @@ msgid ""
217
  "to the old behavior."
218
  msgstr ""
219
 
220
- #: classes/amazon-s3-and-cloudfront.php:4078
221
- #: classes/amazon-s3-and-cloudfront.php:4171
222
  msgid "Amazon S3"
223
  msgstr ""
224
 
225
- #: classes/amazon-s3-and-cloudfront.php:4172
226
  msgctxt "Amazon S3 bucket"
227
  msgid "Bucket"
228
  msgstr ""
229
 
230
- #: classes/amazon-s3-and-cloudfront.php:4173
231
  msgctxt "Path to file on Amazon S3"
232
  msgid "Path"
233
  msgstr ""
234
 
235
- #: classes/amazon-s3-and-cloudfront.php:4174
236
  msgctxt "Location of Amazon S3 bucket"
237
  msgid "Region"
238
  msgstr ""
239
 
240
- #: classes/amazon-s3-and-cloudfront.php:4175
241
  msgctxt "Access control list of the file on Amazon S3"
242
  msgid "Access"
243
  msgstr ""
244
 
245
- #: classes/amazon-s3-and-cloudfront.php:4176
246
  msgid "URL"
247
  msgstr ""
248
 
@@ -290,24 +290,42 @@ msgstr ""
290
 
291
  #: classes/as3cf-plugin-compatibility.php:665
292
  #: classes/as3cf-plugin-compatibility.php:677
293
- #: classes/upgrades/as3cf-meta-wp-error.php:72
294
  #, php-format
295
  msgid "There was an error attempting to download the file %s from S3: %s"
296
  msgstr ""
297
 
298
- #: classes/as3cf-upgrade.php:298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
  msgid "Pause Update"
300
  msgstr ""
301
 
302
- #: classes/as3cf-upgrade.php:306
303
  msgid "Restart Update"
304
  msgstr ""
305
 
306
- #: classes/as3cf-upgrade.php:310
307
  msgid "Try Run It Again"
308
  msgstr ""
309
 
310
- #: classes/as3cf-upgrade.php:333
311
  #, php-format
312
  msgid ""
313
  "<strong>Running %1$s Update%2$s</strong> &mdash; We&#8217;re going through "
@@ -317,14 +335,14 @@ msgid ""
317
  "performance."
318
  msgstr ""
319
 
320
- #: classes/as3cf-upgrade.php:347
321
  #, php-format
322
  msgid ""
323
  "<strong>%1$s Update Paused%2$s</strong> &mdash; Updating Media Library %3$s "
324
  "has been paused."
325
  msgstr ""
326
 
327
- #: classes/as3cf-upgrade.php:360
328
  #, php-format
329
  msgid ""
330
  "<strong>Error Updating %1$s</strong> &mdash; We ran into some errors "
@@ -332,62 +350,55 @@ msgid ""
332
  "been uploaded to S3. Please check your error log for details. (#%3$d)"
333
  msgstr ""
334
 
335
- #: classes/as3cf-upgrade.php:384
336
  #, php-format
337
  msgid " (%s%% Complete)"
338
  msgstr ""
339
 
340
- #: classes/as3cf-upgrade.php:495
341
  #, php-format
342
  msgid "Every %d Minutes"
343
  msgstr ""
344
 
345
- #: classes/upgrades/as3cf-content-replace-urls.php:43
346
- msgid "and ensuring that only the local URL exists in post content."
347
- msgstr ""
348
-
349
- #: classes/upgrades/as3cf-content-replace-urls.php:566
350
- #, php-format
351
  msgid ""
352
- "<strong>Running 1.2 Upgrade%1$s</strong><br>A find &amp; replace is running "
353
- "in the background to update URLs in your content. %2$s"
 
354
  msgstr ""
355
 
356
- #: classes/upgrades/as3cf-content-replace-urls.php:575
357
- #, php-format
358
- msgid ""
359
- "<strong>Paused 1.2 Upgrade</strong><br>The find &amp; replace to update URLs "
360
- "in your content has been paused. %s"
361
  msgstr ""
362
 
363
- #: classes/upgrades/as3cf-content-replace-urls.php:584
364
- msgid "See our documentation"
365
  msgstr ""
366
 
367
- #: classes/upgrades/as3cf-content-replace-urls.php:587
368
  #, php-format
369
  msgid ""
370
- "%s for details on why we&#8217;re doing this, why it runs slowly, and how to "
371
- "make it run faster."
372
  msgstr ""
373
 
374
- #: classes/upgrades/as3cf-edd-replace-urls.php:28
375
- msgid "and ensuring that only the local URL exists in EDD post meta."
376
  msgstr ""
377
 
378
- #: classes/upgrades/as3cf-file-sizes.php:37
 
379
  msgid ""
380
- "and updating the metadata with the sizes of files that have been removed "
381
- "from the server. This will allow us to serve the correct size for media "
382
- "items and the total space used in Multisite subsites."
383
  msgstr ""
384
 
385
- #: classes/upgrades/as3cf-meta-wp-error.php:38
386
  msgid ""
387
  "and rebuilding the metadata for attachments that may have been corrupted."
388
  msgstr ""
389
 
390
- #: classes/upgrades/as3cf-region-meta.php:36
391
  msgid ""
392
  "and updating the metadata with the bucket region it is served from. This "
393
  "will allow us to serve your files from the proper S3 region subdomain <span "
@@ -571,7 +582,7 @@ msgstr ""
571
  msgid "Change"
572
  msgstr ""
573
 
574
- #: view/cloudfront-setting.php:4
575
  #: view/deprecated-domain-setting.php:49
576
  msgid "Invalid character. Letters, numbers, periods and hyphens are allowed."
577
  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: 2016-12-13 11:56+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"
25
  msgid "S3 and CloudFront"
26
  msgstr ""
27
 
28
+ #: classes/amazon-s3-and-cloudfront.php:215
29
  #: view/bucket-setting.php:18
30
  msgid "defined in wp-config.php"
31
  msgstr ""
32
 
33
+ #: classes/amazon-s3-and-cloudfront.php:874
34
  msgid "Upload aborted by filter 'as3cf_pre_upload_attachment'"
35
  msgstr ""
36
 
37
+ #: classes/amazon-s3-and-cloudfront.php:885
38
  #, php-format
39
  msgid "File %s does not exist"
40
  msgstr ""
41
 
42
+ #: classes/amazon-s3-and-cloudfront.php:896
43
  #, php-format
44
  msgid "Mime type %s is not allowed"
45
  msgstr ""
46
 
47
+ #: classes/amazon-s3-and-cloudfront.php:981
48
  #, php-format
49
  msgid "Error uploading %s to S3: %s"
50
  msgstr ""
51
 
52
+ #: classes/amazon-s3-and-cloudfront.php:2170
53
  msgid "Cheatin&#8217; eh?"
54
  msgstr ""
55
 
56
+ #: classes/amazon-s3-and-cloudfront.php:2174
57
  msgid "You do not have sufficient permissions to access this page."
58
  msgstr ""
59
 
60
+ #: classes/amazon-s3-and-cloudfront.php:2180
61
  msgid "No bucket name provided."
62
  msgstr ""
63
 
64
+ #: classes/amazon-s3-and-cloudfront.php:2439
65
  msgid "Error Getting Bucket Region"
66
  msgstr ""
67
 
68
+ #: classes/amazon-s3-and-cloudfront.php:2440
69
  #, php-format
70
  msgid "There was an error attempting to get the region of the bucket %s: %s"
71
  msgstr ""
72
 
73
+ #: classes/amazon-s3-and-cloudfront.php:2560
74
  msgid ""
75
  "This is a test file to check if the user has write permission to S3. Delete "
76
  "me if found."
77
  msgstr ""
78
 
79
+ #: classes/amazon-s3-and-cloudfront.php:2592
80
  #, php-format
81
  msgid ""
82
  "There was an error attempting to check the permissions of the bucket %s: %s"
83
  msgstr ""
84
 
85
+ #: classes/amazon-s3-and-cloudfront.php:2649
86
  msgid "Error creating bucket"
87
  msgstr ""
88
 
89
+ #: classes/amazon-s3-and-cloudfront.php:2650
90
  msgid "Bucket name too short."
91
  msgstr ""
92
 
93
+ #: classes/amazon-s3-and-cloudfront.php:2651
94
  msgid "Bucket name too long."
95
  msgstr ""
96
 
97
+ #: classes/amazon-s3-and-cloudfront.php:2652
98
  msgid ""
99
  "Invalid character. Bucket names can contain lowercase letters, numbers, "
100
  "periods and hyphens."
101
  msgstr ""
102
 
103
+ #: classes/amazon-s3-and-cloudfront.php:2653
104
  msgid "Error saving bucket"
105
  msgstr ""
106
 
107
+ #: classes/amazon-s3-and-cloudfront.php:2654
108
  msgid "Error fetching buckets"
109
  msgstr ""
110
 
111
+ #: classes/amazon-s3-and-cloudfront.php:2655
112
  msgid "Error getting URL preview: "
113
  msgstr ""
114
 
115
+ #: classes/amazon-s3-and-cloudfront.php:2656
116
  msgid "The changes you made will be lost if you navigate away from this page"
117
  msgstr ""
118
 
119
+ #: classes/amazon-s3-and-cloudfront.php:2657
120
  msgid "Getting diagnostic info..."
121
  msgstr ""
122
 
123
+ #: classes/amazon-s3-and-cloudfront.php:2658
124
  msgid "Error getting diagnostic info: "
125
  msgstr ""
126
 
127
+ #: classes/amazon-s3-and-cloudfront.php:2726
128
  msgid "Cheatin' eh?"
129
  msgstr ""
130
 
131
+ #: classes/amazon-s3-and-cloudfront.php:2834
132
  msgctxt "Show the media library tab"
133
  msgid "Media Library"
134
  msgstr ""
135
 
136
+ #: classes/amazon-s3-and-cloudfront.php:2835
137
  msgctxt "Show the support tab"
138
  msgid "Support"
139
  msgstr ""
140
 
141
+ #: classes/amazon-s3-and-cloudfront.php:3052
142
  #, php-format
143
  msgid ""
144
  "<strong>WP Offload S3</strong> &mdash; The file %s has been given %s "
145
  "permissions on Amazon S3."
146
  msgstr ""
147
 
148
+ #: classes/amazon-s3-and-cloudfront.php:3071
149
  msgid ""
150
  "<strong>WP Offload S3 Requirement Missing</strong> &mdash; Looks like you "
151
  "don't have an image manipulation library installed on this server and "
153
  "Please setup GD or ImageMagick."
154
  msgstr ""
155
 
156
+ #: classes/amazon-s3-and-cloudfront.php:3748
157
  msgid "Quick Start Guide"
158
  msgstr ""
159
 
160
+ #: classes/amazon-s3-and-cloudfront.php:3750
161
  #, php-format
162
  msgid ""
163
  "Looks like we don't have write access to this bucket. It's likely that the "
166
  "correctly."
167
  msgstr ""
168
 
169
+ #: classes/amazon-s3-and-cloudfront.php:3752
170
  #, php-format
171
  msgid ""
172
  "Looks like we don't have access to the buckets. It's likely that the user "
174
  "Please see our %s for instructions on setting up permissions correctly."
175
  msgstr ""
176
 
177
+ #: classes/amazon-s3-and-cloudfront.php:3903
178
  msgid "WP Offload S3 Activation"
179
  msgstr ""
180
 
181
+ #: classes/amazon-s3-and-cloudfront.php:3904
182
  msgid ""
183
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
184
  "automatically deactivated WP Offload S3 Lite."
185
  msgstr ""
186
 
187
+ #: classes/amazon-s3-and-cloudfront.php:3906
188
  msgid "WP Offload S3 Lite Activation"
189
  msgstr ""
190
 
191
+ #: classes/amazon-s3-and-cloudfront.php:3907
192
  msgid ""
193
  "WP Offload S3 Lite and WP Offload S3 cannot both be active. We've "
194
  "automatically deactivated WP Offload S3."
195
  msgstr ""
196
 
197
+ #: classes/amazon-s3-and-cloudfront.php:3981
198
  msgid "More info"
199
  msgstr ""
200
 
201
+ #: classes/amazon-s3-and-cloudfront.php:4072
202
  msgid "this doc"
203
  msgstr ""
204
 
205
+ #: classes/amazon-s3-and-cloudfront.php:4074
206
  msgid "WP Offload S3 Feature Removed"
207
  msgstr ""
208
 
209
+ #: classes/amazon-s3-and-cloudfront.php:4075
210
  #, php-format
211
  msgid ""
212
  "You had the \"Always non-SSL\" option selected in your settings, but we've "
217
  "to the old behavior."
218
  msgstr ""
219
 
220
+ #: classes/amazon-s3-and-cloudfront.php:4103
221
+ #: classes/amazon-s3-and-cloudfront.php:4196
222
  msgid "Amazon S3"
223
  msgstr ""
224
 
225
+ #: classes/amazon-s3-and-cloudfront.php:4197
226
  msgctxt "Amazon S3 bucket"
227
  msgid "Bucket"
228
  msgstr ""
229
 
230
+ #: classes/amazon-s3-and-cloudfront.php:4198
231
  msgctxt "Path to file on Amazon S3"
232
  msgid "Path"
233
  msgstr ""
234
 
235
+ #: classes/amazon-s3-and-cloudfront.php:4199
236
  msgctxt "Location of Amazon S3 bucket"
237
  msgid "Region"
238
  msgstr ""
239
 
240
+ #: classes/amazon-s3-and-cloudfront.php:4200
241
  msgctxt "Access control list of the file on Amazon S3"
242
  msgid "Access"
243
  msgstr ""
244
 
245
+ #: classes/amazon-s3-and-cloudfront.php:4201
246
  msgid "URL"
247
  msgstr ""
248
 
290
 
291
  #: classes/as3cf-plugin-compatibility.php:665
292
  #: classes/as3cf-plugin-compatibility.php:677
293
+ #: classes/upgrades/as3cf-meta-wp-error.php:81
294
  #, php-format
295
  msgid "There was an error attempting to download the file %s from S3: %s"
296
  msgstr ""
297
 
298
+ #: classes/as3cf-upgrade-filter-post.php:544
299
+ #, php-format
300
+ msgid ""
301
+ "<strong>Paused Upgrade</strong><br>The find &amp; replace to update URLs has "
302
+ "been paused. %s"
303
+ msgstr ""
304
+
305
+ #: classes/as3cf-upgrade-filter-post.php:553
306
+ msgid "See our documentation"
307
+ msgstr ""
308
+
309
+ #: classes/as3cf-upgrade-filter-post.php:556
310
+ #, php-format
311
+ msgid ""
312
+ "%s for details on why we&#8217;re doing this, why it runs slowly, and how to "
313
+ "make it run faster."
314
+ msgstr ""
315
+
316
+ #: classes/as3cf-upgrade.php:318
317
  msgid "Pause Update"
318
  msgstr ""
319
 
320
+ #: classes/as3cf-upgrade.php:326
321
  msgid "Restart Update"
322
  msgstr ""
323
 
324
+ #: classes/as3cf-upgrade.php:330
325
  msgid "Try Run It Again"
326
  msgstr ""
327
 
328
+ #: classes/as3cf-upgrade.php:353
329
  #, php-format
330
  msgid ""
331
  "<strong>Running %1$s Update%2$s</strong> &mdash; We&#8217;re going through "
335
  "performance."
336
  msgstr ""
337
 
338
+ #: classes/as3cf-upgrade.php:367
339
  #, php-format
340
  msgid ""
341
  "<strong>%1$s Update Paused%2$s</strong> &mdash; Updating Media Library %3$s "
342
  "has been paused."
343
  msgstr ""
344
 
345
+ #: classes/as3cf-upgrade.php:380
346
  #, php-format
347
  msgid ""
348
  "<strong>Error Updating %1$s</strong> &mdash; We ran into some errors "
350
  "been uploaded to S3. Please check your error log for details. (#%3$d)"
351
  msgstr ""
352
 
353
+ #: classes/as3cf-upgrade.php:404
354
  #, php-format
355
  msgid " (%s%% Complete)"
356
  msgstr ""
357
 
358
+ #: classes/as3cf-upgrade.php:515
359
  #, php-format
360
  msgid "Every %d Minutes"
361
  msgstr ""
362
 
363
+ #: classes/upgrades/as3cf-file-sizes.php:48
 
 
 
 
 
364
  msgid ""
365
+ "and updating the metadata with the sizes of files that have been removed "
366
+ "from the server. This will allow us to serve the correct size for media "
367
+ "items and the total space used in Multisite subsites."
368
  msgstr ""
369
 
370
+ #: classes/upgrades/as3cf-filter-edd.php:39
371
+ msgid "and ensuring that only the local URL exists in EDD post meta."
 
 
 
372
  msgstr ""
373
 
374
+ #: classes/upgrades/as3cf-filter-post-content.php:39
375
+ msgid "and ensuring that only the local URL exists in post content."
376
  msgstr ""
377
 
378
+ #: classes/upgrades/as3cf-filter-post-content.php:48
379
  #, php-format
380
  msgid ""
381
+ "<strong>Running Content Upgrade%1$s</strong><br>A find &amp; replace is "
382
+ "running in the background to update URLs in your post content. %2$s"
383
  msgstr ""
384
 
385
+ #: classes/upgrades/as3cf-filter-post-excerpt.php:39
386
+ msgid "and ensuring that only the local URL exists in post excerpts."
387
  msgstr ""
388
 
389
+ #: classes/upgrades/as3cf-filter-post-excerpt.php:48
390
+ #, php-format
391
  msgid ""
392
+ "<strong>Running Excerpts Upgrade%1$s</strong><br>A find &amp; replace is "
393
+ "running in the background to update URLs in your post excerpts. %2$s"
 
394
  msgstr ""
395
 
396
+ #: classes/upgrades/as3cf-meta-wp-error.php:49
397
  msgid ""
398
  "and rebuilding the metadata for attachments that may have been corrupted."
399
  msgstr ""
400
 
401
+ #: classes/upgrades/as3cf-region-meta.php:47
402
  msgid ""
403
  "and updating the metadata with the bucket region it is served from. This "
404
  "will allow us to serve your files from the proper S3 region subdomain <span "
582
  msgid "Change"
583
  msgstr ""
584
 
585
+ #: view/cloudfront-setting.php:7
586
  #: view/deprecated-domain-setting.php:49
587
  msgid "Invalid character. Letters, numbers, periods and hyphens are allowed."
588
  msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: bradt, deliciousbrains
3
  Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 4.4
5
  Tested up to: 4.7
6
- Stable tag: 1.1.3
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.
@@ -65,6 +65,12 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
68
  = WP Offload S3 Lite 1.1.3 - 2016-11-28 =
69
  * Bug fix: Private URL signing params stripped in some circumstances
70
  * Improvement: Performance improvements for URL filtering, especially on large sites
3
  Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront
4
  Requires at least: 4.4
5
  Tested up to: 4.7
6
+ Stable tag: 1.1.4
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.
65
 
66
  == Changelog ==
67
 
68
+ = WP Offload S3 Lite 1.1.4 - 2016-12-13 =
69
+ * New: Upgrade routine to replace all S3 URLs in post excerpts with local URLs
70
+ * Improvement: Performance improvements
71
+ * Improvement: Allow expires time to be filtered for private content using the `as3cf_expires` filter
72
+ * Bug fix: Image `srcset` not correctly applied when file names contain special characters
73
+
74
  = WP Offload S3 Lite 1.1.3 - 2016-11-28 =
75
  * Bug fix: Private URL signing params stripped in some circumstances
76
  * Improvement: Performance improvements for URL filtering, especially on large sites
view/bucket-select.php CHANGED
@@ -2,14 +2,14 @@
2
  <div class="as3cf-bucket-manual">
3
  <h3 data-modal-title="<?php _e( 'Change bucket', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'What bucket would you like to use?', 'amazon-s3-and-cloudfront' ); ?></h3>
4
  <form method="post" class="as3cf-manual-save-bucket-form">
5
- <input type="text" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Existing bucket name', 'amazon-s3-and-cloudfront' ); ?>" value="<?php echo $selected_bucket; ?>">
6
  <p class="bucket-actions actions manual">
7
- <button type="submit" class="bucket-action-save button button-primary" data-working="<?php _e( 'Saving...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Save Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
8
- <span><a href="#" class="bucket-action-browse"><?php _e( 'Browse existing buckets', 'amazon-s3-and-cloudfront' ); ?></a></span>
9
- <span><a href="#" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
10
  </p>
11
  <p class="bucket-actions actions select">
12
- <button type="submit" class="bucket-action-save button button-primary" data-working="<?php _e( 'Saving...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Save Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
13
  <span><a href="#" class="bucket-action-cancel"><?php _e( 'Cancel', 'amazon-s3-and-cloudfront' ); ?></a></span>
14
  </p>
15
  </form>
@@ -22,8 +22,8 @@
22
  <span class="right"><a href="#" class="bucket-action-refresh"><?php _e( 'Refresh', 'amazon-s3-and-cloudfront' ); ?></a></span>
23
  </p>
24
  <p class="bucket-actions actions select">
25
- <span><a href="#" class="bucket-action-manual"><?php _e( 'Enter bucket name', 'amazon-s3-and-cloudfront' ); ?></a></span>
26
- <span><a href="#" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
27
  <span class="right"><a href="#" class="bucket-action-refresh"><?php _e( 'Refresh', 'amazon-s3-and-cloudfront' ); ?></a></span>
28
  </p>
29
  </div>
@@ -37,7 +37,7 @@
37
  <?php _e( 'Bucket Name:', 'amazon-s3-and-cloudfront' ); ?>
38
  </td>
39
  <td>
40
- <input type="text" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Bucket Name', 'amazon-s3-and-cloudfront' ); ?>">
41
  <p class="as3cf-invalid-bucket-name"></p>
42
  </td>
43
  </tr>
@@ -49,7 +49,7 @@
49
  <?php
50
  $aws_regions = $this->get_aws_regions();
51
  if ( ! defined( 'AS3CF_REGION' ) ) { ?>
52
- <select class="bucket-create-region" name="region_name">
53
  <?php foreach ( $aws_regions as $value => $label ) : ?>
54
  <option value="<?php echo $value; ?>"> <?php echo $label; ?></option>
55
  <?php endforeach; ?>
@@ -63,7 +63,7 @@
63
  </tr>
64
  </table>
65
  <p class="bucket-actions actions">
66
- <button type="submit" class="button button-primary" data-working="<?php _e( 'Creating...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Create New Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
67
  <span><a href="#" class="bucket-action-cancel"><?php _e( 'Cancel', 'amazon-s3-and-cloudfront' ); ?></a></span>
68
  </p>
69
  </form>
2
  <div class="as3cf-bucket-manual">
3
  <h3 data-modal-title="<?php _e( 'Change bucket', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'What bucket would you like to use?', 'amazon-s3-and-cloudfront' ); ?></h3>
4
  <form method="post" class="as3cf-manual-save-bucket-form">
5
+ <input type="text" id="<?php echo $prefix ;?>-bucket-manual-name" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Existing bucket name', 'amazon-s3-and-cloudfront' ); ?>" value="<?php echo $selected_bucket; ?>">
6
  <p class="bucket-actions actions manual">
7
+ <button id="<?php echo $prefix ;?>-bucket-manual-save" type="submit" class="bucket-action-save button button-primary" data-working="<?php _e( 'Saving...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Save Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
8
+ <span><a href="#" id="<?php echo $prefix ;?>-bucket-action-browse" class="bucket-action-browse"><?php _e( 'Browse existing buckets', 'amazon-s3-and-cloudfront' ); ?></a></span>
9
+ <span><a href="#" id="<?php echo $prefix ;?>-bucket-action-create" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
10
  </p>
11
  <p class="bucket-actions actions select">
12
+ <button id="<?php echo $prefix ;?>-bucket-select-save" type="submit" class="bucket-action-save button button-primary" data-working="<?php _e( 'Saving...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Save Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
13
  <span><a href="#" class="bucket-action-cancel"><?php _e( 'Cancel', 'amazon-s3-and-cloudfront' ); ?></a></span>
14
  </p>
15
  </form>
22
  <span class="right"><a href="#" class="bucket-action-refresh"><?php _e( 'Refresh', 'amazon-s3-and-cloudfront' ); ?></a></span>
23
  </p>
24
  <p class="bucket-actions actions select">
25
+ <span><a href="#" id="<?php echo $prefix ;?>-bucket-action-manual" class="bucket-action-manual"><?php _e( 'Enter bucket name', 'amazon-s3-and-cloudfront' ); ?></a></span>
26
+ <span><a href="#" id="<?php echo $prefix ;?>-bucket-action-create" class="bucket-action-create"><?php _e( 'Create new bucket', 'amazon-s3-and-cloudfront' ); ?></a></span>
27
  <span class="right"><a href="#" class="bucket-action-refresh"><?php _e( 'Refresh', 'amazon-s3-and-cloudfront' ); ?></a></span>
28
  </p>
29
  </div>
37
  <?php _e( 'Bucket Name:', 'amazon-s3-and-cloudfront' ); ?>
38
  </td>
39
  <td>
40
+ <input type="text" id="<?php echo $prefix ;?>-create-bucket-name" class="as3cf-bucket-name" name="bucket_name" placeholder="<?php _e( 'Bucket Name', 'amazon-s3-and-cloudfront' ); ?>">
41
  <p class="as3cf-invalid-bucket-name"></p>
42
  </td>
43
  </tr>
49
  <?php
50
  $aws_regions = $this->get_aws_regions();
51
  if ( ! defined( 'AS3CF_REGION' ) ) { ?>
52
+ <select id="<?php echo $prefix ;?>-bucket-create-region" class="bucket-create-region" name="region_name">
53
  <?php foreach ( $aws_regions as $value => $label ) : ?>
54
  <option value="<?php echo $value; ?>"> <?php echo $label; ?></option>
55
  <?php endforeach; ?>
63
  </tr>
64
  </table>
65
  <p class="bucket-actions actions">
66
+ <button id="<?php echo $prefix ;?>-bucket-create" type="submit" class="button button-primary" data-working="<?php _e( 'Creating...', 'amazon-s3-and-cloudfront' ); ?>"><?php _e( 'Create New Bucket', 'amazon-s3-and-cloudfront' ); ?></button>
67
  <span><a href="#" class="bucket-action-cancel"><?php _e( 'Cancel', 'amazon-s3-and-cloudfront' ); ?></a></span>
68
  </p>
69
  </form>
view/bucket-setting.php CHANGED
@@ -13,7 +13,7 @@ $tr_class = ( isset( $tr_class ) ) ? $tr_class : '';
13
  <span class="dashicons dashicons-external"></span>
14
  </a>
15
  <?php if ( ! defined( $constant ) && ! $this->get_defined_setting( 'bucket', false ) ) { ?>
16
- <a href="#" class="as3cf-change-bucket" data-as3cf-modal=".as3cf-bucket-container"><?php _e( 'Change', 'amazon-s3-and-cloudfront' ); ?></a>
17
  <?php } else {
18
  echo '<span class="as3cf-defined-in-config">' . __( 'defined in wp-config.php', 'amazon-s3-and-cloudfront' ) . '</span>';
19
  } ?>
13
  <span class="dashicons dashicons-external"></span>
14
  </a>
15
  <?php if ( ! defined( $constant ) && ! $this->get_defined_setting( 'bucket', false ) ) { ?>
16
+ <a href="#" id="<?php echo $prefix; ?>-change-bucket" class="as3cf-change-bucket" data-as3cf-modal=".as3cf-bucket-container"><?php _e( 'Change', 'amazon-s3-and-cloudfront' ); ?></a>
17
  <?php } else {
18
  echo '<span class="as3cf-defined-in-config">' . __( 'defined in wp-config.php', 'amazon-s3-and-cloudfront' ) . '</span>';
19
  } ?>
view/checkbox.php CHANGED
@@ -3,10 +3,11 @@ $value = ( isset( $value ) ) ? $value : $this->get_setting( $key );
3
  $class = ( isset( $class ) ) ? 'class="' . $class . '"' : '';
4
  $disabled = ( isset( $disabled ) && $disabled ) ? ' disabled' : '';
5
  $values = ( isset( $values ) && is_array( $values ) && 2 === count( $values ) ) ? $values : array( 0, 1 );
 
6
  ?>
7
- <div id="<?php echo $key; ?>-wrap" data-checkbox="<?php echo $key; ?>" class="as3cf-switch<?php echo $disabled . ( $value == $values[1] ? ' on' : '' ); ?>">
8
  <span class="on <?php echo $value == $values[1] ? 'checked' : ''; ?>">ON</span>
9
  <span class="off <?php echo $value == $values[0] ? 'checked' : ''; ?>">OFF</span>
10
  <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $values[0]; ?>" />
11
- <input type="checkbox" name="<?php echo $key; ?>" value="<?php echo $values[1]; ?>" id="<?php echo $key; ?>" <?php echo $value == $values[1] ? 'checked="checked" ' : ''; ?> <?php echo $class ?>/>
12
- </div>
3
  $class = ( isset( $class ) ) ? 'class="' . $class . '"' : '';
4
  $disabled = ( isset( $disabled ) && $disabled ) ? ' disabled' : '';
5
  $values = ( isset( $values ) && is_array( $values ) && 2 === count( $values ) ) ? $values : array( 0, 1 );
6
+ $prefix = $this->get_plugin_prefix_slug();
7
  ?>
8
+ <div id="<?php echo $prefix . '-' . $key; ?>-wrap" data-checkbox="<?php echo $prefix . '-' . $key; ?>" class="as3cf-switch<?php echo $disabled . ( $value == $values[1] ? ' on' : '' ); ?>">
9
  <span class="on <?php echo $value == $values[1] ? 'checked' : ''; ?>">ON</span>
10
  <span class="off <?php echo $value == $values[0] ? 'checked' : ''; ?>">OFF</span>
11
  <input type="hidden" name="<?php echo $key; ?>" value="<?php echo $values[0]; ?>" />
12
+ <input type="checkbox" name="<?php echo $key; ?>" value="<?php echo $values[1]; ?>" id="<?php echo $prefix . '-' . $key; ?>" <?php echo $value == $values[1] ? 'checked="checked" ' : ''; ?> <?php echo $class ?>/>
13
+ </div>
view/cloudfront-setting.php CHANGED
@@ -1,6 +1,9 @@
1
- <p class="as3cf-setting domain cloudfront <?php echo ( 'cloudfront' == $domain ) ? '' : 'hide'; // xss ok ?>">
 
 
 
2
  <input type="text" name="cloudfront" value="<?php echo esc_attr( $this->get_setting( 'cloudfront' ) ); ?>" size="30" <?php echo $disabled_attr; ?> />
3
  <span class="as3cf-validation-error" style="display: none;">
4
  <?php _e( 'Invalid character. Letters, numbers, periods and hyphens are allowed.', 'amazon-s3-and-cloudfront' ); ?>
5
  </span>
6
- </p>
1
+ <?php
2
+ $prefix = $this->get_plugin_prefix_slug();
3
+ ?>
4
+ <p class="as3cf-setting <?php echo $prefix; ?>-domain <?php echo $prefix; ?>-cloudfront <?php echo ( 'cloudfront' == $domain ) ? '' : 'hide'; // xss ok ?>">
5
  <input type="text" name="cloudfront" value="<?php echo esc_attr( $this->get_setting( 'cloudfront' ) ); ?>" size="30" <?php echo $disabled_attr; ?> />
6
  <span class="as3cf-validation-error" style="display: none;">
7
  <?php _e( 'Invalid character. Letters, numbers, periods and hyphens are allowed.', 'amazon-s3-and-cloudfront' ); ?>
8
  </span>
9
+ </p>
view/settings.php CHANGED
@@ -39,7 +39,7 @@ $selected_bucket_prefix = $this->get_object_prefix(); ?>
39
  'prefix' => $prefix,
40
  'selected_bucket' => $selected_bucket,
41
  'selected_bucket_prefix' => $selected_bucket_prefix,
42
- 'tr_class' => 'as3cf-border-bottom as3cf-bucket-setting',
43
  )
44
  ); ?>
45
 
@@ -103,7 +103,7 @@ $selected_bucket_prefix = $this->get_object_prefix(); ?>
103
  <?php _e( 'By default the path is the same as your local WordPress files.', 'amazon-s3-and-cloudfront' ); ?>
104
  <?php echo $this->settings_more_info_link( 'object-prefix' ); ?>
105
  </p>
106
- <p class="as3cf-setting enable-object-prefix <?php echo ( $this->get_setting( 'enable-object-prefix' ) ) ? '' : 'hide'; // xss ok ?>">
107
  <?php $args = $this->get_setting_args( 'object-prefix' ); ?>
108
  <input type="text" name="object-prefix" value="<?php echo esc_attr( $this->get_setting( 'object-prefix' ) ); ?>" size="30" placeholder="<?php echo $this->get_default_object_prefix(); ?>" <?php echo $args['disabled_attr']; ?> />
109
  </p>
@@ -214,4 +214,4 @@ if ( ! empty( $tabs['support'] ) ) {
214
  if ( ! $this->is_pro() ) {
215
  $this->render_view( 'sidebar' );
216
  }
217
- ?>
39
  'prefix' => $prefix,
40
  'selected_bucket' => $selected_bucket,
41
  'selected_bucket_prefix' => $selected_bucket_prefix,
42
+ 'tr_class' => "as3cf-border-bottom {$prefix}-bucket-setting",
43
  )
44
  ); ?>
45
 
103
  <?php _e( 'By default the path is the same as your local WordPress files.', 'amazon-s3-and-cloudfront' ); ?>
104
  <?php echo $this->settings_more_info_link( 'object-prefix' ); ?>
105
  </p>
106
+ <p class="as3cf-setting <?php echo $prefix; ?>-enable-object-prefix <?php echo ( $this->get_setting( 'enable-object-prefix' ) ) ? '' : 'hide'; // xss ok ?>">
107
  <?php $args = $this->get_setting_args( 'object-prefix' ); ?>
108
  <input type="text" name="object-prefix" value="<?php echo esc_attr( $this->get_setting( 'object-prefix' ) ); ?>" size="30" placeholder="<?php echo $this->get_default_object_prefix(); ?>" <?php echo $args['disabled_attr']; ?> />
109
  </p>
214
  if ( ! $this->is_pro() ) {
215
  $this->render_view( 'sidebar' );
216
  }
217
+ ?>
wordpress-s3.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Offload S3 Lite
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: 1.1.3
8
  Author URI: http://deliciousbrains.com/
9
  Network: True
10
  Text Domain: amazon-s3-and-cloudfront
@@ -26,9 +26,9 @@ Domain Path: /languages/
26
  // Then completely rewritten.
27
  */
28
 
29
- $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.1.3';
30
 
31
- $aws_plugin_version_required = '1.0';
32
 
33
  require_once dirname( __FILE__ ) . '/classes/wp-aws-compatibility-check.php';
34
  require_once dirname( __FILE__ ) . '/classes/as3cf-utils.php';
@@ -62,11 +62,13 @@ function as3cf_init( $aws ) {
62
  require_once $abspath . '/include/functions.php';
63
  require_once $abspath . '/classes/as3cf-error.php';
64
  require_once $abspath . '/classes/as3cf-upgrade.php';
 
65
  require_once $abspath . '/classes/upgrades/as3cf-region-meta.php';
66
  require_once $abspath . '/classes/upgrades/as3cf-file-sizes.php';
67
  require_once $abspath . '/classes/upgrades/as3cf-meta-wp-error.php';
68
- require_once $abspath . '/classes/upgrades/as3cf-content-replace-urls.php';
69
- require_once $abspath . '/classes/upgrades/as3cf-edd-replace-urls.php';
 
70
  require_once $abspath . '/classes/as3cf-filter.php';
71
  require_once $abspath . '/classes/filters/as3cf-local-to-s3.php';
72
  require_once $abspath . '/classes/filters/as3cf-s3-to-local.php';
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: 1.1.4
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'] = '1.1.4';
30
 
31
+ $aws_plugin_version_required = '1.0.1';
32
 
33
  require_once dirname( __FILE__ ) . '/classes/wp-aws-compatibility-check.php';
34
  require_once dirname( __FILE__ ) . '/classes/as3cf-utils.php';
62
  require_once $abspath . '/include/functions.php';
63
  require_once $abspath . '/classes/as3cf-error.php';
64
  require_once $abspath . '/classes/as3cf-upgrade.php';
65
+ require_once $abspath . '/classes/as3cf-upgrade-filter-post.php';
66
  require_once $abspath . '/classes/upgrades/as3cf-region-meta.php';
67
  require_once $abspath . '/classes/upgrades/as3cf-file-sizes.php';
68
  require_once $abspath . '/classes/upgrades/as3cf-meta-wp-error.php';
69
+ require_once $abspath . '/classes/upgrades/as3cf-filter-edd.php';
70
+ require_once $abspath . '/classes/upgrades/as3cf-filter-post-content.php';
71
+ require_once $abspath . '/classes/upgrades/as3cf-filter-post-excerpt.php';
72
  require_once $abspath . '/classes/as3cf-filter.php';
73
  require_once $abspath . '/classes/filters/as3cf-local-to-s3.php';
74
  require_once $abspath . '/classes/filters/as3cf-s3-to-local.php';