WordPress.org

Plugin Directory

Changeset 1771524


Ignore:
Timestamp:
11/20/17 15:14:34 (2 months ago)
Author:
deliciousbrains
Message:

Deploy version 1.2.1

Location:
amazon-s3-and-cloudfront
Files:
82 added
17 edited

Legend:

Unmodified
Added
Removed
  • amazon-s3-and-cloudfront/trunk/README.md

    r1681217 r1771524  
    33**Tags:** uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront   
    44**Requires at least:** 4.6   
    5 **Tested up to:** 4.8   
    6 **Stable tag:** 1.2   
     5**Tested up to:** 4.9   
     6**Stable tag:** 1.2.1   
    77**License:** GPLv3   
    88 
     
    6969 
    7070## Changelog ## 
     71 
     72### WP Offload S3 Lite 1.2.1 - 2017-11-20 ### 
     73* New: Compatibility with HTML Widget 
     74* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+ 
     75* Improvement: Compatibility with WordPress 4.9 
     76* Bug fix: Incorrect region used when changing bucket by defining it in WPOS3_SETTINGS 
     77* Bug fix: Media library notices render inside the upload tool 
     78* Bug fix: Save notices disappear on settings page 
     79* Bug fix: Improper use of jQuery.attr logged to browser console 
     80* Bug fix: "Content Filtering Upgrade" URL in notice incorrect 
     81* Bug fix: "More info" links can be broken across two lines 
    7182 
    7283### WP Offload S3 Lite 1.2 - 2017-06-19 ### 
  • amazon-s3-and-cloudfront/trunk/assets/css/notice.css

    r1426758 r1771524  
    1 .as3cf-notice p,.aws-compatibility-notice p{max-width:800px} 
     1.as3cf-notice p,.aws-compatibility-notice p{max-width:800px}.as3cf-license-notice p:not(.as3cf-before):before{display:none} 
  • amazon-s3-and-cloudfront/trunk/assets/js/media.js

    r1613429 r1771524  
    113113 
    114114            var toggle = $( '#as3cfpro-toggle-acl' ); 
    115             var currentACL = toggle.attr( 'data-currentACL' ); 
     115            var currentACL = toggle.data( 'currentacl' ); 
    116116            var newACL = as3cfpro_media.settings.private_acl; 
    117117 
     
    125125            wp.ajax.send( 'as3cfpro_update_acl', { 
    126126                    data: { 
    127                         _nonce: as3cfpro_media.nonces.update_acl, 
     127                        _ajax_nonce: as3cfpro_media.nonces.singular_update_acl, 
    128128                        id: this.model.get( 'id' ), 
    129129                        acl: newACL 
     
    156156            toggle.text( response.acl_display ); 
    157157            toggle.attr( 'title', response.title ); 
    158             toggle.attr( 'data-currentACL', response.acl ); 
     158            toggle.data( 'currentacl', response.acl ); 
    159159            toggle.show(); 
    160160        } 
  • amazon-s3-and-cloudfront/trunk/assets/js/media.min.js

    r1613429 r1771524  
    1 var test={};!function(a,b){var c=wp.media,d=c.view.Attachment.Details.TwoColumn;c.view.Attachment.Details.TwoColumn=d.extend({events:function(){return b.extend({},d.prototype.events,{"click .local-warning":"confirmS3Removal","click #as3cfpro-toggle-acl":"toggleACL"})},render:function(){this.fetchS3Details(this.model.get("id"))},fetchS3Details:function(a){wp.ajax.send("as3cf_get_attachment_s3_details",{data:{_nonce:as3cf_media.nonces.get_attachment_s3_details,id:a}}).done(b.bind(this.renderView,this))},renderView:function(a){d.prototype.render.apply(this),this.renderActionLinks(a),this.renderS3Details(a)},renderActionLinks:function(c){var d=c&&c.links||[],e=this.$el.find(".actions"),f=a("<div />",{"class":"s3-actions"}),g=[];b(d).each(function(a){g.push(a)}),f.append(g.join(" | ")),e.append(f)},renderS3Details:function(a){if(a&&a.s3object){var b=this.$el.find(".attachment-info .details"),c=this.generateDetails(a,["bucket","key","region","acl"]);b.append(c)}},generateDetails:function(a,c){var d="",e=b.template('<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>');return b(c).each(function(c){if(a.s3object[c]){var f=a.s3object[c];if("acl"===c&&(f=a.s3object[c].name,a.acl_toggle)){var g=b.template('<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>');f=g({title:a.s3object[c].title,acl:a.s3object[c].acl,value:f})}d+=e({key:c,label:as3cf_media.strings[c],value:f})}}),d},confirmS3Removal:function(a){if(!confirm(as3cfpro_media.strings.local_warning))return a.preventDefault(),a.stopImmediatePropagation(),!1},toggleACL:function(c){c.preventDefault();var d=a("#as3cfpro-toggle-acl"),e=d.attr("data-currentACL"),f=as3cfpro_media.settings.private_acl;d.hide(),d.after('<span id="as3cfpro-updating">'+as3cfpro_media.strings.updating_acl+"</span>"),e===as3cfpro_media.settings.private_acl&&(f=as3cfpro_media.settings.default_acl),wp.ajax.send("as3cfpro_update_acl",{data:{_nonce:as3cfpro_media.nonces.update_acl,id:this.model.get("id"),acl:f}}).done(b.bind(this.updateACL,this)).fail(b.bind(this.renderACLError,this))},renderACLError:function(){a("#as3cfpro-updating").remove(),a("#as3cfpro-toggle-acl").show(),alert(as3cfpro_media.strings.change_acl_error)},updateACL:function(b){if(null==b.acl_display||null==b.title||null==b.acl||null==b.url)return void this.renderACLError();this.model.set("url",b.url),this.render();var c=a("#as3cfpro-toggle-acl");a("#as3cfpro-updating").remove(),c.text(b.acl_display),c.attr("title",b.title),c.attr("data-currentACL",b.acl),c.show()}})}(jQuery,_); 
     1var test={};!function(a,b){var c=wp.media,d=c.view.Attachment.Details.TwoColumn;c.view.Attachment.Details.TwoColumn=d.extend({events:function(){return b.extend({},d.prototype.events,{"click .local-warning":"confirmS3Removal","click #as3cfpro-toggle-acl":"toggleACL"})},render:function(){this.fetchS3Details(this.model.get("id"))},fetchS3Details:function(a){wp.ajax.send("as3cf_get_attachment_s3_details",{data:{_nonce:as3cf_media.nonces.get_attachment_s3_details,id:a}}).done(b.bind(this.renderView,this))},renderView:function(a){d.prototype.render.apply(this),this.renderActionLinks(a),this.renderS3Details(a)},renderActionLinks:function(c){var d=c&&c.links||[],e=this.$el.find(".actions"),f=a("<div />",{"class":"s3-actions"}),g=[];b(d).each(function(a){g.push(a)}),f.append(g.join(" | ")),e.append(f)},renderS3Details:function(a){if(a&&a.s3object){var b=this.$el.find(".attachment-info .details"),c=this.generateDetails(a,["bucket","key","region","acl"]);b.append(c)}},generateDetails:function(a,c){var d="",e=b.template('<div class="<%= key %>"><strong><%= label %>:</strong> <%= value %></div>');return b(c).each(function(c){if(a.s3object[c]){var f=a.s3object[c];if("acl"===c&&(f=a.s3object[c].name,a.acl_toggle)){var g=b.template('<a href="#" id="as3cfpro-toggle-acl" title="<%= title %>" data-currentACL="<%= acl %>"><%= value %></a>');f=g({title:a.s3object[c].title,acl:a.s3object[c].acl,value:f})}d+=e({key:c,label:as3cf_media.strings[c],value:f})}}),d},confirmS3Removal:function(a){if(!confirm(as3cfpro_media.strings.local_warning))return a.preventDefault(),a.stopImmediatePropagation(),!1},toggleACL:function(c){c.preventDefault();var d=a("#as3cfpro-toggle-acl"),e=d.data("currentacl"),f=as3cfpro_media.settings.private_acl;d.hide(),d.after('<span id="as3cfpro-updating">'+as3cfpro_media.strings.updating_acl+"</span>"),e===as3cfpro_media.settings.private_acl&&(f=as3cfpro_media.settings.default_acl),wp.ajax.send("as3cfpro_update_acl",{data:{_ajax_nonce:as3cfpro_media.nonces.singular_update_acl,id:this.model.get("id"),acl:f}}).done(b.bind(this.updateACL,this)).fail(b.bind(this.renderACLError,this))},renderACLError:function(){a("#as3cfpro-updating").remove(),a("#as3cfpro-toggle-acl").show(),alert(as3cfpro_media.strings.change_acl_error)},updateACL:function(b){if(null==b.acl_display||null==b.title||null==b.acl||null==b.url)return void this.renderACLError();this.model.set("url",b.url),this.render();var c=a("#as3cfpro-toggle-acl");a("#as3cfpro-updating").remove(),c.text(b.acl_display),c.attr("title",b.title),c.data("currentacl",b.acl),c.show()}})}(jQuery,_); 
  • amazon-s3-and-cloudfront/trunk/assets/js/script.js

    r1681217 r1771524  
    3131        $switch.toggleClass( 'on' ).find( 'span' ).toggleClass( 'checked' ); 
    3232        var switchOn = $switch.find( 'span.on' ).hasClass( 'checked' ); 
    33         $checkbox.attr( 'checked', switchOn ).trigger( 'change' ); 
     33        $checkbox.prop( 'checked', switchOn ).trigger( 'change' ); 
    3434    } 
    3535 
     
    4646        if ( pattern.test( $input.val() ) ) { 
    4747            $error.show(); 
    48             $submit.attr( 'disabled', true ); 
     48            $submit.prop( 'disabled', true ); 
    4949        } else { 
    5050            $error.hide(); 
    51             $submit.attr( 'disabled', false ); 
     51            $submit.prop( 'disabled', false ); 
    5252        } 
    5353    } 
     
    6969            $( '.nav-tab' ).removeClass( 'nav-tab-active' ); 
    7070            $( 'a.nav-tab[data-tab="' + hash + '"]' ).addClass( 'nav-tab-active' ); 
    71             $( '.aws-main' ).attr( 'data-tab', hash ); 
    72             if ( $activeTab.attr( 'data-prefix' ) ) { 
    73                 as3cfModal.prefix = $activeTab.attr( 'data-prefix' ); 
     71            $( '.aws-main' ).data( 'tab', hash ); 
     72            if ( $activeTab.data( 'prefix' ) ) { 
     73                as3cfModal.prefix = $activeTab.data( 'prefix' ); 
    7474            } 
    7575            if ( ! persist_updated_notice ) { 
     
    168168            } 
    169169 
    170             $bucketList.html( '<li class="loading">' + $bucketList.attr( 'data-working' ) + '</li>' ); 
     170            $bucketList.html( '<li class="loading">' + $bucketList.data( 'working' ) + '</li>' ); 
    171171 
    172172            var data = { 
     
    265265            } 
    266266            $( '.as3cf-bucket-error' ).hide(); 
    267             $manualBucketButton.text( $manualBucketButton.attr( 'data-working' ) ); 
     267            $manualBucketButton.text( $manualBucketButton.data( 'working' ) ); 
    268268            $manualBucketButton.prop( 'disabled', true ); 
    269269 
     
    325325            } 
    326326 
    327             var previousBucket = $( '.as3cf-bucket-list a.selected' ).attr( 'data-bucket' ); 
     327            var previousBucket = $( '.as3cf-bucket-list a.selected' ).data( 'bucket' ); 
    328328 
    329329            $( '.as3cf-bucket-list a' ).removeClass( 'selected' ); 
     
    332332            $bucketList.addClass( 'saving' ); 
    333333            $link.find( '.spinner' ).show().css( 'visibility', 'visible' ); 
    334             var bucketName = $link.attr( 'data-bucket' ); 
     334            var bucketName = $link.data( 'bucket' ); 
    335335 
    336336            var data = { 
     
    380380 
    381381            if ( $createBucketForm.find( '.as3cf-bucket-name' ).val().length < 3 ) { 
    382                 $createBucketForm.find( 'button[type=submit]' ).attr( 'disabled', true ); 
     382                $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true ); 
    383383            } else { 
    384                 $createBucketForm.find( 'button[type=submit]' ).attr( 'disabled', false ); 
     384                $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false ); 
    385385            } 
    386386 
    387387            if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < 3 ) { 
    388                 $manualBucketForm.find( 'button[type=submit]' ).attr( 'disabled', true ); 
     388                $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true ); 
    389389            } else { 
    390                 $manualBucketForm.find( 'button[type=submit]' ).attr( 'disabled', false ); 
     390                $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false ); 
    391391            } 
    392392        }, 
     
    481481 
    482482            $( '.as3cf-bucket-error' ).hide(); 
    483             $createBucketButton.text( $createBucketButton.attr( 'data-working' ) ); 
     483            $createBucketButton.text( $createBucketButton.data( 'working' ) ); 
    484484            $createBucketButton.prop( 'disabled', true ); 
    485485 
     
    513513                        // Tidy up create bucket form 
    514514                        $( '.as3cf-bucket-select-region' ).hide(); 
    515                         $( '.as3cf-bucket-select-region' ).removeAttr( 'selected' ); 
     515                        $( '.as3cf-bucket-select-region' ).prop( 'selected', false ); 
    516516                        $createBucketInput.val( '' ); 
    517                         $createBucketButton.attr( 'disabled', true ); 
     517                        $createBucketButton.prop( 'disabled', true ); 
    518518 
    519519                        // Make sure the bucket list will refresh the next time the modal loads 
     
    663663        } 
    664664 
    665         // Strip the # if still on the end of the URL 
    666         if ( 'function' === typeof history.replaceState && '#' === location.href.slice( -1 ) ) { 
    667             history.replaceState( {}, '', location.href.slice( 0, -1 ) ); 
    668         } 
    669  
    670665        as3cf.tabs.toggle( location.hash.replace( '#', '' ), true ); 
     666 
     667        $( document ).trigger( 'as3cf.tabRendered', [ location.hash.replace( '#', '' ) ] ); 
    671668    } 
    672669 
     
    680677         * Set the hashchange callback to update the rendered active tab. 
    681678         */ 
    682         window.onhashchange = renderCurrentTab; 
     679        window.onhashchange = function( event ) { 
     680 
     681            // Strip the # if still on the end of the URL 
     682            if ( 'function' === typeof history.replaceState && '#' === location.href.slice( -1 ) ) { 
     683                history.replaceState( {}, '', location.href.slice( 0, -1 ) ); 
     684            } 
     685 
     686            renderCurrentTab(); 
     687        }; 
    683688 
    684689        // Move any compatibility errors below the nav tabs 
     
    769774 
    770775            if ( 'cloudfront' !== $input.val() ) { 
    771                 $submit.attr( 'disabled', false ); 
     776                $submit.prop( 'disabled', false ); 
    772777            } else { 
    773778                validateCustomDomain( $input.next( '.as3cf-setting' ).find( 'input[name="cloudfront"]' ) ); 
     
    863868 
    864869            if ( as3cf.buckets.isValidName( bucketName ) ) { 
    865                 $createBucketForm.find( 'button[type=submit]' ).removeAttr( 'disabled' ); 
     870                $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false ); 
    866871            } else { 
    867                 $createBucketForm.find( 'button[type=submit]' ).attr( 'disabled', true ); 
     872                $createBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true ); 
    868873            } 
    869874            as3cf.buckets.updateNameNotice( bucketName ); 
     
    875880 
    876881            if ( $manualBucketForm.find( '.as3cf-bucket-name' ).val().length < as3cf.buckets.validLength ) { 
    877                 $manualBucketForm.find( 'button[type=submit]' ).attr( 'disabled', true ); 
     882                $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', true ); 
    878883            } else { 
    879                 $manualBucketForm.find( 'button[type=submit]' ).removeAttr( 'disabled' ); 
     884                $manualBucketForm.find( 'button[type=submit]' ).prop( 'disabled', false ); 
    880885            } 
    881886        } ); 
  • amazon-s3-and-cloudfront/trunk/assets/js/script.min.js

    r1681217 r1771524  
    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-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 i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):("function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),void as3cf.tabs.toggle(location.hash.replace("#",""),!0))}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,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},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(){j(),window.onhashchange=j;var m=a(".wrap.aws-main .nav-tab-wrapper");a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),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()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),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.prop("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.prop("disabled",!0)):(c.hide(),d.prop("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-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 i(){a("#as3cf-remove-local-file").is(":checked")?a("#as3cf-remove-local-notice").show():a("#as3cf-remove-local-notice").hide()}function j(){return"#"+as3cf.tabs.defaultTab===location.hash?void(location.hash=""):(as3cf.tabs.toggle(location.hash.replace("#",""),!0),void a(document).trigger("as3cf.tabRendered",[location.hash.replace("#","")]))}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").data("tab",c),k.data("prefix")&&(b.prefix=k.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.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.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").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.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]").prop("disabled",!0):c.find("button[type=submit]").prop("disabled",!1),d.find(".as3cf-bucket-name").val().length<3?d.find("button[type=submit]").prop("disabled",!0):d.find("button[type=submit]").prop("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,h,i){var j=a(".as3cf-bucket-container."+b.prefix+" .as3cf-manual-save-bucket-form"),m=a("#"+b.prefix+"-active-bucket");if("as3cf"===b.prefix&&0===m.text().trim().length){d("as3cf-copy-to-s3-wrap"),d("as3cf-serve-from-s3-wrap");var n=k.attr("id");l[n]=c(n)}a(".as3cf-error.fatal").hide(),m.text(e),j.find(".as3cf-bucket-name").val(e),a("#"+b.prefix+"-bucket").val(e),a("#"+b.prefix+"-region").val(h),a(".updated").not(".as3cf-notice").show(),k.addClass("as3cf-has-bucket"),k.find(".as3cf-can-write-error").toggle(!i),k.find(".as3cf-bucket-error").hide(),"as3cf"===b.prefix&&g(),f(),b.close(function(){k.trigger("bucket-change",[i]),as3cf.buckets.bucketSelectLock=!1})},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.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").prop("selected",!1),d.val(""),f.prop("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(){j(),window.onhashchange=function(a){"function"==typeof history.replaceState&&"#"===location.href.slice(-1)&&history.replaceState({},"",location.href.slice(0,-1)),j()};var m=a(".wrap.aws-main .nav-tab-wrapper");a(".aws-compatibility-notice, div.updated, div.error, div.notice").not(".below-h2, .inline").insertAfter(m),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()}),h(),a("#as3cf-serve-from-s3,#as3cf-remove-local-file").on("change",function(a){h()}),i(),a("#as3cf-remove-local-file").on("change",function(a){i()}),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.prop("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]").prop("disabled",!1):e.find("button[type=submit]").prop("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]").prop("disabled",!0):d.find("button[type=submit]").prop("disabled",!1)})})}(jQuery,as3cfModal); 
  • amazon-s3-and-cloudfront/trunk/assets/sass/notice.scss

    r1426758 r1771524  
    88    } 
    99} 
     10 
     11/** 
     12 * Prevent WP from adding the circular arrow icon to all P tags inside the notice html. 
     13 */ 
     14.as3cf-license-notice p:not(.as3cf-before):before { 
     15    display: none; 
     16} 
  • amazon-s3-and-cloudfront/trunk/classes/amazon-s3-and-cloudfront.php

    r1681217 r1771524  
    11<?php 
    22 
     3use DeliciousBrains\WP_Offload_S3\Null_S3_Client; 
    34use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_Content_Replace_URLs; 
    45use DeliciousBrains\WP_Offload_S3\Upgrades\Upgrade_EDD_Replace_URLs; 
     
    168169        add_filter( 'update_attached_file', array( $this, 'update_attached_file' ), 100, 2 ); 
    169170 
     171        // Listen for settings changes 
     172        add_action( 'as3cf_constant_' . static::SETTINGS_CONSTANT . '_changed_bucket', array( $this, 'bucket_changed' ) ); 
     173 
    170174        // Content filtering 
    171175        $this->filter_local = new AS3CF_Local_To_S3( $this ); 
     
    224228            'tr_class'      => str_replace( '_', '-', $this->plugin_prefix . '-' . $key . '-container' ), 
    225229            'setting_msg'   => '', 
     230            'is_defined'    => false, 
    226231        ); 
    227232 
    228233        if ( false !== $is_defined ) { 
     234            $args['is_defined']    = true; 
    229235            $args['disabled']      = true; 
    230236            $args['disabled_attr'] = 'disabled="disabled"'; 
     
    453459 
    454460        if ( false !== $value && $bucket !== $value ) { 
    455             // Clear region 
    456             $this->remove_setting( 'region' ); 
    457             $this->save_settings(); 
    458         } 
     461            $this->bucket_changed(); 
     462        } 
     463    } 
     464 
     465    /** 
     466     * Perform necessary actions when the chosen bucket is changed. 
     467     */ 
     468    public function bucket_changed() { 
     469        $this->remove_setting( 'region' ); 
     470        $this->save_settings(); 
    459471    } 
    460472 
     
    891903 
    892904        // Allow S3 upload to be hijacked / cancelled for any reason 
    893         $pre = apply_filters( 'as3cf_pre_upload_attachment', false, $post_id, $data ); 
     905        try { 
     906            $pre = apply_filters( 'as3cf_pre_upload_attachment', false, $post_id, $data ); 
     907        } catch ( \Exception $e ) { 
     908            return $this->return_upload_error( $e->getMessage() ); 
     909        } 
     910 
    894911        if ( false !== $pre ) { 
    895             if ( ! is_null( $return_metadata ) ) { 
    896                 // If the attachment metadata is supplied, return it 
    897                 return $data; 
    898             } 
    899  
    900             $error_msg = is_string( $pre ) ? $pre : __( 'Upload aborted by filter \'as3cf_pre_upload_attachment\'', 'amazon-s3-and-cloudfront' ); 
    901  
    902             return $this->return_upload_error( $error_msg ); 
     912            return $data; 
    903913        } 
    904914 
     
    15081518     */ 
    15091519    function is_plugin_setup() { 
    1510         if ( is_wp_error( $this->aws->get_client() ) ) { 
     1520        if ( $this->aws->needs_access_keys() ) { 
    15111521            // AWS not configured 
    15121522            return false; 
     
    24682478            } 
    24692479 
    2470             $client = $this->aws->get_client()->get( 's3', $args ); 
    2471             $this->set_client( $client ); 
     2480            try { 
     2481                $aws_client = $this->aws->get_client(); 
     2482                $this->set_client( $aws_client->get( 's3', $args ) ); 
     2483            } catch ( \Exception $e ) { 
     2484                AS3CF_Error::log( $e->getMessage() ); 
     2485                $this->set_client( new Null_S3_Client ); 
     2486            } 
    24722487        } 
    24732488 
     
    24782493     * Setter for S3 client 
    24792494     * 
    2480      * @param Aws\S3\S3Client $client 
     2495     * @param Aws\S3\S3Client|Null_S3_Client $client 
    24812496     */ 
    24822497    public function set_client( $client ) { 
     
    24872502     * Get the region of a bucket 
    24882503     * 
    2489      * @param string $bucket 
     2504     * @param string  $bucket 
     2505     * @param boolean $use_cache 
    24902506     * 
    24912507     * @return string|WP_Error 
    24922508     */ 
    2493     function get_bucket_region( $bucket ) { 
     2509    public function get_bucket_region( $bucket, $use_cache = false ) { 
     2510        $regions = get_site_transient( 'as3cf_regions_cache' ); 
     2511 
     2512        if ( ! is_array( $regions ) ) { 
     2513            $regions = array(); 
     2514        } 
     2515 
     2516        if ( $use_cache && isset( $regions[ $bucket ] ) ) { 
     2517            return $regions[ $bucket ]; 
     2518        } 
     2519 
    24942520        try { 
    24952521            $region = $this->get_s3client()->getBucketLocation( array( 'Bucket' => $bucket ) ); 
     
    25032529 
    25042530        $region = $this->translate_region( $region['Location'] ); 
     2531 
     2532        if ( is_string( $region ) ) { 
     2533            $regions[ $bucket ] = $region; 
     2534            set_site_transient( 'as3cf_regions_cache', $regions, 5 * MINUTE_IN_SECONDS ); 
     2535        } 
    25052536 
    25062537        return $region; 
     
    28602891        $this->aws->render_view( 'header', array( 'page_title' => $this->get_plugin_page_title(), 'page' => 'as3cf' ) ); 
    28612892 
    2862         $aws_client = $this->aws->get_client(); 
    2863  
    2864         if ( is_wp_error( $aws_client ) ) { 
    2865             $this->render_view( 'error-fatal', array( 'message' => $aws_client->get_error_message() ) ); 
    2866         } else { 
     2893        try { 
     2894            $this->aws->get_client(); 
    28672895            $this->render_view( 'settings-tabs' ); 
    28682896            do_action( 'as3cf_pre_settings_render' ); 
    28692897            $this->render_view( 'settings' ); 
    28702898            do_action( 'as3cf_post_settings_render' ); 
     2899        } catch ( \Exception $e ) { 
     2900            $this->render_view( 'error-fatal', array( 'message' => $e->getMessage() ) ); 
    28712901        } 
    28722902 
     
    34063436        $output .= "\r\n"; 
    34073437 
    3408         $output .= 'AS3CF_ASSETS_BUCKET: '; 
    3409         $output .= esc_html( ( defined( 'AS3CF_ASSETS_BUCKET' ) ) ? AS3CF_ASSETS_BUCKET : 'Not defined' ); 
    3410         $output .= "\r\n"; 
    3411  
    34123438        $output .= 'AS3CF_REGION: '; 
    34133439        $output .= esc_html( ( defined( 'AS3CF_REGION' ) ) ? AS3CF_REGION : 'Not defined' ); 
     
    39373963 
    39383964        $url  = $this->dbrains_url( $path, $args, $hash ); 
    3939         $text = __( 'More info', 'amazon-s3-and-cloudfront' ); 
     3965        $text = __( 'More&nbsp;info', 'amazon-s3-and-cloudfront' ); 
    39403966        $link = AS3CF_Utils::dbrains_link( $url, $text ); 
    39413967 
    3942         return sprintf( '<span class="more-info">%s &raquo;</span>', $link ); 
     3968        return sprintf( '<span class="more-info">%s&nbsp;&raquo;</span>', $link ); 
    39433969    } 
    39443970 
     
    40834109 
    40844110    /** 
     4111     * Get a list of available media actions which can be performed according to plugin and user capability requirements. 
     4112     * 
     4113     * @param string|null $scope 
     4114     * 
     4115     * @return array 
     4116     */ 
     4117    public function get_available_media_actions( $scope = '' ) { 
     4118        return array(); 
     4119    } 
     4120 
     4121    /** 
    40854122     * Render the S3 attachment meta box 
    40864123     */ 
     
    40934130            'post'                     => $post, 
    40944131            'local_file_exists'        => file_exists( $file ), 
    4095             'user_can_perform_actions' => $this->verify_media_actions(), 
     4132            'available_actions'        => $this->get_available_media_actions( 'singular' ), 
    40964133            'sendback'                 => 'post.php?post=' . $post->ID . '&action=edit', 
    40974134        ); 
  • amazon-s3-and-cloudfront/trunk/classes/as3cf-filter.php

    r1681217 r1771524  
    175175        } 
    176176 
     177        if ( $class instanceof WP_Widget_Custom_HTML ) { 
     178            return $this->filter_custom_html_widget( $instance, $update_cache ); 
     179        } 
     180 
    177181        return $instance; 
    178182    } 
     
    219223        $to_cache         = array(); 
    220224        $instance['text'] = $this->process_content( $instance['text'], $cache, $to_cache ); 
     225 
     226        if ( $update_cache ) { 
     227            $this->maybe_update_option_cache( $to_cache ); 
     228        } 
     229 
     230        return $instance; 
     231    } 
     232 
     233    /** 
     234     * Filter custom html widget. 
     235     * 
     236     * @param array $instance 
     237     * @param bool  $update_cache 
     238     * 
     239     * @return array 
     240     */ 
     241    protected function filter_custom_html_widget( $instance, $update_cache ) { 
     242        $cache               = $this->get_option_cache(); 
     243        $to_cache            = array(); 
     244        $instance['content'] = $this->process_content( $instance['content'], $cache, $to_cache ); 
    221245 
    222246        if ( $update_cache ) { 
  • amazon-s3-and-cloudfront/trunk/classes/as3cf-plugin-compatibility.php

    r1681217 r1771524  
    6363        add_filter( 'wp_calculate_image_srcset', array( $this, 'wp_calculate_image_srcset' ), 10, 5 ); 
    6464        add_filter( 'wp_calculate_image_srcset_meta', array( $this, 'wp_calculate_image_srcset_meta' ), 10, 4 ); 
     65 
     66        // Maybe warn about PHP version if in admin screens. 
     67        add_action( 'admin_init', array( $this, 'maybe_warn_about_php_version' ) ); 
    6568 
    6669        if ( $this->as3cf->is_plugin_setup() ) { 
     
    819822        return $filename; 
    820823    } 
     824 
     825    /** 
     826     * Display an admin message if PHP version is soon to be unsupported by plugin. 
     827     * 
     828     * NOTE: This is not added to AWS SDK compatibility checks as it is remaining compatible with earlier PHP versions. 
     829     * This function should be removed or reworked once PHP 5.5 is required. 
     830     */ 
     831    public function maybe_warn_about_php_version() { 
     832        $key_base = 'php-version-55'; 
     833 
     834        if ( version_compare( PHP_VERSION, '5.5', '<' ) ) { 
     835            $message = sprintf( 
     836                __( '<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP Offload S3 will require PHP %2$s or later. %3$s', 'amazon-s3-and-cloudfront' ), 
     837                PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION, 
     838                '5.5', 
     839                $this->as3cf->more_info_link( '/wp-offload-s3/doc/php-version-requirements/', 'upgrade-php-version' ) 
     840            ); 
     841 
     842            // Show notice to user if not already dismissed. 
     843            $args = array( 
     844                'custom_id'         => $key_base . '-site', 
     845                'type'              => 'notice-warning', 
     846                'flash'             => false, 
     847                'only_show_to_user' => false, 
     848            ); 
     849 
     850            if ( ! in_array( $args['custom_id'], $this->as3cf->notices->get_dismissed_notices() ) ) { 
     851                $this->as3cf->notices->add_notice( $message, $args ); 
     852            } else { 
     853                // If user has dismissed site-wide notice but we're in settings pages, show notice. 
     854                $args['custom_id']             = $key_base . '-settings'; 
     855                $args['dismissible']           = false; 
     856                $args['only_show_in_settings'] = true; 
     857 
     858                $this->as3cf->notices->add_notice( $message, $args ); 
     859            } 
     860        } else { 
     861            // If PHP version (now) OK, make sure notices not shown. 
     862            $this->as3cf->notices->remove_notice_by_id( $key_base . '-site' ); 
     863            $this->as3cf->notices->remove_notice_by_id( $key_base . '-settings' ); 
     864        } 
     865    } 
    821866} 
  • amazon-s3-and-cloudfront/trunk/classes/as3cf-utils.php

    r1681217 r1771524  
    169169         * Parses a URL into its components. Compatible with PHP < 5.4.7. 
    170170         * 
    171          * @param $url string The URL to parse. 
    172          * 
    173          * @return array|false The parsed components or false on error. 
    174          */ 
    175         public static function parse_url( $url ) { 
     171         * @param     $url string The URL to parse. 
     172         * 
     173         * @param int $component PHP_URL_ constant for URL component to return. 
     174         * 
     175         * @return mixed An array of the parsed components, mixed for a requested component, or false on error. 
     176         */ 
     177        public static function parse_url( $url, $component = -1 ) { 
    176178            $url       = trim( $url ); 
    177179            $no_scheme = 0 === strpos( $url, '//' ); 
     
    181183            } 
    182184 
    183             $parts = parse_url( $url ); 
    184  
    185             if ( $no_scheme ) { 
     185            $parts = parse_url( $url, $component ); 
     186 
     187            if ( 0 < $component ) { 
     188                return $parts; 
     189            } 
     190 
     191            if ( $no_scheme && is_array( $parts ) ) { 
    186192                unset( $parts['scheme'] ); 
    187193            } 
     
    198204         */ 
    199205        public static function is_url( $string ) { 
    200             if ( preg_match( '@^(?:https?:)?\/\/[a-zA-Z0-9\-]{3,}@', $string ) ) { 
     206            if ( preg_match( '@^(?:https?:)?//[a-zA-Z0-9\-]+@', $string ) ) { 
    201207                return true; 
    202208            } 
    203209 
    204210            return false; 
     211        } 
     212 
     213        /** 
     214         * Is the string a relative URL? 
     215         * 
     216         * @param $string 
     217         * 
     218         * @return bool 
     219         */ 
     220        public static function is_relative_url( $string ) { 
     221            if ( empty( $string ) || ! is_string( $string ) ) { 
     222                return false; 
     223            } 
     224 
     225            $url = static::parse_url( $string ); 
     226 
     227            return ( empty( $url['scheme'] ) && empty( $url['host'] ) ); 
    205228        } 
    206229 
     
    358381            return sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html( $text ) ); 
    359382        } 
     383 
     384        /** 
     385         * Check whether two URLs share the same domain. 
     386         * 
     387         * @param string $url_a 
     388         * @param string $url_b 
     389         * 
     390         * @return bool 
     391         */ 
     392        public static function url_domains_match( $url_a, $url_b ) { 
     393            if ( ! static::is_url( $url_a ) || ! static::is_url( $url_b ) ) { 
     394                return false; 
     395            } 
     396 
     397            return static::parse_url( $url_a, PHP_URL_HOST ) === static::parse_url( $url_b, PHP_URL_HOST ); 
     398        } 
     399 
     400        /** 
     401         * Get the current domain. 
     402         * 
     403         * @return string|false 
     404         */ 
     405        public static function current_domain() { 
     406            return parse_url( home_url(), PHP_URL_HOST ); 
     407        } 
     408 
     409        /** 
     410         * Get the base domain of the current domain. 
     411         * 
     412         * @return string 
     413         */ 
     414        public static function current_base_domain() { 
     415            $domain = static::current_domain(); 
     416            $parts  = explode( '.', $domain, 2 ); 
     417 
     418            if ( isset( $parts[1] ) && in_array( $parts[0], array( 'www' ) ) ) { 
     419                return $parts[1]; 
     420            } 
     421 
     422            return $domain; 
     423        } 
     424 
     425        /** 
     426         * A safe wrapper for deactivate_plugins() 
     427         */ 
     428        public static function deactivate_plugins() { 
     429            if ( ! function_exists( 'deactivate_plugins' ) ) { 
     430                require_once ABSPATH . 'wp-admin/includes/plugin.php'; 
     431            } 
     432 
     433            call_user_func_array( 'deactivate_plugins', func_get_args() ); 
     434        } 
    360435    } 
    361436} 
  • amazon-s3-and-cloudfront/trunk/classes/upgrades/upgrade-filter-post.php

    r1681217 r1771524  
    396396    protected function get_generic_message() { 
    397397        $link_text = __( 'See our documentation', 'amazon-s3-and-cloudfront' ); 
    398         $url       = $this->as3cf->dbrains_url( '/wp-offload-s3/doc/version-1-2-upgrade', array( 
     398        $url       = $this->as3cf->dbrains_url( '/wp-offload-s3/doc/content-filtering-upgrade', array( 
    399399            'utm_campaign' => 'support+docs', 
    400400        ) ); 
  • amazon-s3-and-cloudfront/trunk/classes/wp-aws-compatibility-check.php

    r1553609 r1771524  
    305305         * Get the compatibility error message 
    306306         * 
    307          * @return string|void 
     307         * @return string|bool 
    308308         */ 
    309309        function get_error_msg() { 
  • amazon-s3-and-cloudfront/trunk/languages/amazon-s3-and-cloudfront-en.pot

    r1681217 r1771524  
    99"Project-Id-Version: amazon-s3-and-cloudfront\n" 
    1010"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n" 
    11 "POT-Creation-Date: 2017-06-19 15:09+0100\n" 
     11"POT-Creation-Date: 2017-11-20 15:12+0000\n" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    1818"Content-Transfer-Encoding: 8bit\n" 
    1919 
    20 #: classes/amazon-s3-and-cloudfront.php:122 
     20#: classes/amazon-s3-and-cloudfront.php:123 
    2121msgid "Offload S3 Lite" 
    2222msgstr "" 
    2323 
    24 #: classes/amazon-s3-and-cloudfront.php:123 
     24#: classes/amazon-s3-and-cloudfront.php:124 
    2525msgid "S3 and CloudFront" 
    2626msgstr "" 
    2727 
    28 #: classes/amazon-s3-and-cloudfront.php:232 
     28#: classes/amazon-s3-and-cloudfront.php:238 
    2929#: view/bucket-setting.php:18 
    3030msgid "defined in wp-config.php" 
    3131msgstr "" 
    3232 
    33 #: classes/amazon-s3-and-cloudfront.php:900 
    34 msgid "Upload aborted by filter 'as3cf_pre_upload_attachment'" 
    35 msgstr "" 
    36  
    37 #: classes/amazon-s3-and-cloudfront.php:911 
    38 #: classes/amazon-s3-and-cloudfront.php:1071 
     33#: classes/amazon-s3-and-cloudfront.php:921 
     34#: classes/amazon-s3-and-cloudfront.php:1081 
    3935#, php-format 
    4036msgid "File %s does not exist" 
    4137msgstr "" 
    4238 
    43 #: classes/amazon-s3-and-cloudfront.php:922 
     39#: classes/amazon-s3-and-cloudfront.php:932 
    4440#, php-format 
    4541msgid "Mime type %s is not allowed" 
    4642msgstr "" 
    4743 
    48 #: classes/amazon-s3-and-cloudfront.php:1007 
    49 #: classes/amazon-s3-and-cloudfront.php:1079 
     44#: classes/amazon-s3-and-cloudfront.php:1017 
     45#: classes/amazon-s3-and-cloudfront.php:1089 
    5046#, php-format 
    5147msgid "Error uploading %s to S3: %s" 
    5248msgstr "" 
    5349 
    54 #: classes/amazon-s3-and-cloudfront.php:2223 
     50#: classes/amazon-s3-and-cloudfront.php:2233 
    5551msgid "Cheatin&#8217; eh?" 
    5652msgstr "" 
    5753 
    58 #: classes/amazon-s3-and-cloudfront.php:2227 
     54#: classes/amazon-s3-and-cloudfront.php:2237 
    5955msgid "You do not have sufficient permissions to access this page." 
    6056msgstr "" 
    6157 
    62 #: classes/amazon-s3-and-cloudfront.php:2233 
     58#: classes/amazon-s3-and-cloudfront.php:2243 
    6359msgid "No bucket name provided." 
    6460msgstr "" 
    6561 
    66 #: classes/amazon-s3-and-cloudfront.php:2497 
     62#: classes/amazon-s3-and-cloudfront.php:2523 
    6763msgid "Error Getting Bucket Region" 
    6864msgstr "" 
    6965 
    70 #: classes/amazon-s3-and-cloudfront.php:2498 
     66#: classes/amazon-s3-and-cloudfront.php:2524 
    7167#, php-format 
    7268msgid "There was an error attempting to get the region of the bucket %s: %s" 
    7369msgstr "" 
    7470 
    75 #: classes/amazon-s3-and-cloudfront.php:2626 
     71#: classes/amazon-s3-and-cloudfront.php:2657 
    7672msgid "" 
    7773"This is a test file to check if the user has write permission to S3. Delete " 
     
    7975msgstr "" 
    8076 
    81 #: classes/amazon-s3-and-cloudfront.php:2645 
     77#: classes/amazon-s3-and-cloudfront.php:2676 
    8278#, php-format 
    8379msgid "" 
     
    8581msgstr "" 
    8682 
    87 #: classes/amazon-s3-and-cloudfront.php:2699 
     83#: classes/amazon-s3-and-cloudfront.php:2730 
    8884msgid "Error creating bucket" 
    8985msgstr "" 
    9086 
    91 #: classes/amazon-s3-and-cloudfront.php:2700 
     87#: classes/amazon-s3-and-cloudfront.php:2731 
    9288msgid "Bucket name too short." 
    9389msgstr "" 
    9490 
    95 #: classes/amazon-s3-and-cloudfront.php:2701 
     91#: classes/amazon-s3-and-cloudfront.php:2732 
    9692msgid "Bucket name too long." 
    9793msgstr "" 
    9894 
    99 #: classes/amazon-s3-and-cloudfront.php:2702 
     95#: classes/amazon-s3-and-cloudfront.php:2733 
    10096msgid "" 
    10197"Invalid character. Bucket names can contain lowercase letters, numbers, " 
     
    10399msgstr "" 
    104100 
    105 #: classes/amazon-s3-and-cloudfront.php:2703 
     101#: classes/amazon-s3-and-cloudfront.php:2734 
    106102msgid "Error saving bucket" 
    107103msgstr "" 
    108104 
    109 #: classes/amazon-s3-and-cloudfront.php:2704 
     105#: classes/amazon-s3-and-cloudfront.php:2735 
    110106msgid "Error fetching buckets" 
    111107msgstr "" 
    112108 
    113 #: classes/amazon-s3-and-cloudfront.php:2705 
     109#: classes/amazon-s3-and-cloudfront.php:2736 
    114110msgid "Error getting URL preview: " 
    115111msgstr "" 
    116112 
    117 #: classes/amazon-s3-and-cloudfront.php:2706 
     113#: classes/amazon-s3-and-cloudfront.php:2737 
    118114msgid "The changes you made will be lost if you navigate away from this page" 
    119115msgstr "" 
    120116 
    121 #: classes/amazon-s3-and-cloudfront.php:2707 
     117#: classes/amazon-s3-and-cloudfront.php:2738 
    122118msgid "Getting diagnostic info..." 
    123119msgstr "" 
    124120 
    125 #: classes/amazon-s3-and-cloudfront.php:2708 
     121#: classes/amazon-s3-and-cloudfront.php:2739 
    126122msgid "Error getting diagnostic info: " 
    127123msgstr "" 
    128124 
    129 #: classes/amazon-s3-and-cloudfront.php:2776 
     125#: classes/amazon-s3-and-cloudfront.php:2807 
    130126msgid "Cheatin' eh?" 
    131127msgstr "" 
    132128 
    133 #: classes/amazon-s3-and-cloudfront.php:2883 
     129#: classes/amazon-s3-and-cloudfront.php:2913 
    134130msgctxt "Show the media library tab" 
    135131msgid "Media Library" 
    136132msgstr "" 
    137133 
    138 #: classes/amazon-s3-and-cloudfront.php:2884 
     134#: classes/amazon-s3-and-cloudfront.php:2914 
    139135msgctxt "Show the support tab" 
    140136msgid "Support" 
    141137msgstr "" 
    142138 
    143 #: classes/amazon-s3-and-cloudfront.php:3101 
     139#: classes/amazon-s3-and-cloudfront.php:3131 
    144140#, php-format 
    145141msgid "" 
     
    148144msgstr "" 
    149145 
    150 #: classes/amazon-s3-and-cloudfront.php:3120 
     146#: classes/amazon-s3-and-cloudfront.php:3150 
    151147msgid "" 
    152148"<strong>WP Offload S3 Requirement Missing</strong> &mdash; Looks like you " 
     
    156152msgstr "" 
    157153 
    158 #: classes/amazon-s3-and-cloudfront.php:3729 
     154#: classes/amazon-s3-and-cloudfront.php:3755 
    159155msgid "Quick Start Guide" 
    160156msgstr "" 
    161157 
    162 #: classes/amazon-s3-and-cloudfront.php:3731 
     158#: classes/amazon-s3-and-cloudfront.php:3757 
    163159#, php-format 
    164160msgid "" 
     
    169165msgstr "" 
    170166 
    171 #: classes/amazon-s3-and-cloudfront.php:3733 
     167#: classes/amazon-s3-and-cloudfront.php:3759 
    172168#, php-format 
    173169msgid "" 
     
    177173msgstr "" 
    178174 
    179 #: classes/amazon-s3-and-cloudfront.php:3883 
     175#: classes/amazon-s3-and-cloudfront.php:3909 
    180176msgid "WP Offload S3 Activation" 
    181177msgstr "" 
    182178 
    183 #: classes/amazon-s3-and-cloudfront.php:3884 
     179#: classes/amazon-s3-and-cloudfront.php:3910 
    184180msgid "" 
    185181"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've " 
     
    187183msgstr "" 
    188184 
    189 #: classes/amazon-s3-and-cloudfront.php:3886 
     185#: classes/amazon-s3-and-cloudfront.php:3912 
    190186msgid "WP Offload S3 Lite Activation" 
    191187msgstr "" 
    192188 
    193 #: classes/amazon-s3-and-cloudfront.php:3887 
     189#: classes/amazon-s3-and-cloudfront.php:3913 
    194190msgid "" 
    195191"WP Offload S3 Lite and WP Offload S3 cannot both be active. We've " 
     
    197193msgstr "" 
    198194 
    199 #: classes/amazon-s3-and-cloudfront.php:3939 
    200 msgid "More info" 
    201 msgstr "" 
    202  
    203 #: classes/amazon-s3-and-cloudfront.php:4034 
     195#: classes/amazon-s3-and-cloudfront.php:3965 
     196msgid "More&nbsp;info" 
     197msgstr "" 
     198 
     199#: classes/amazon-s3-and-cloudfront.php:4060 
    204200msgid "this doc" 
    205201msgstr "" 
    206202 
    207 #: classes/amazon-s3-and-cloudfront.php:4036 
     203#: classes/amazon-s3-and-cloudfront.php:4062 
    208204msgid "WP Offload S3 Feature Removed" 
    209205msgstr "" 
    210206 
    211 #: classes/amazon-s3-and-cloudfront.php:4037 
     207#: classes/amazon-s3-and-cloudfront.php:4063 
    212208#, php-format 
    213209msgid "" 
     
    220216msgstr "" 
    221217 
    222 #: classes/amazon-s3-and-cloudfront.php:4067 
    223 #: classes/amazon-s3-and-cloudfront.php:4165 
     218#: classes/amazon-s3-and-cloudfront.php:4093 
     219#: classes/amazon-s3-and-cloudfront.php:4202 
    224220msgid "Amazon S3" 
    225221msgstr "" 
    226222 
    227 #: classes/amazon-s3-and-cloudfront.php:4166 
     223#: classes/amazon-s3-and-cloudfront.php:4203 
    228224msgctxt "Amazon S3 bucket" 
    229225msgid "Bucket" 
    230226msgstr "" 
    231227 
    232 #: classes/amazon-s3-and-cloudfront.php:4167 
     228#: classes/amazon-s3-and-cloudfront.php:4204 
    233229msgctxt "Path to file on Amazon S3" 
    234230msgid "Path" 
    235231msgstr "" 
    236232 
    237 #: classes/amazon-s3-and-cloudfront.php:4168 
     233#: classes/amazon-s3-and-cloudfront.php:4205 
    238234msgctxt "Location of Amazon S3 bucket" 
    239235msgid "Region" 
    240236msgstr "" 
    241237 
    242 #: classes/amazon-s3-and-cloudfront.php:4169 
     238#: classes/amazon-s3-and-cloudfront.php:4206 
    243239msgctxt "Access control list of the file on Amazon S3" 
    244240msgid "Access" 
    245241msgstr "" 
    246242 
    247 #: classes/amazon-s3-and-cloudfront.php:4170 
     243#: classes/amazon-s3-and-cloudfront.php:4207 
    248244msgid "URL" 
    249245msgstr "" 
     
    257253msgstr "" 
    258254 
    259 #: classes/as3cf-plugin-compatibility.php:512 
     255#: classes/as3cf-plugin-compatibility.php:515 
    260256#, php-format 
    261257msgid "The local directory %s does not exist and could not be created." 
    262258msgstr "" 
    263259 
    264 #: classes/as3cf-plugin-compatibility.php:513 
    265 #: classes/as3cf-plugin-compatibility.php:525 
     260#: classes/as3cf-plugin-compatibility.php:516 
     261#: classes/as3cf-plugin-compatibility.php:528 
    266262#: classes/upgrades/upgrade-meta-wp-error.php:81 
    267263#, php-format 
    268264msgid "There was an error attempting to download the file %s from S3: %s" 
     265msgstr "" 
     266 
     267#: classes/as3cf-plugin-compatibility.php:836 
     268#, php-format 
     269msgid "" 
     270"<strong>Warning:</strong> This site is using PHP %1$s, in a future update WP " 
     271"Offload S3 will require PHP %2$s or later. %3$s" 
    269272msgstr "" 
    270273 
     
    456459msgstr "" 
    457460 
    458 #: view/attachment-metabox.php:4 
     461#: view/attachment-metabox.php:14 
    459462msgid "This item has not been copied to S3 yet." 
    460463msgstr "" 
    461464 
    462 #: view/attachment-metabox.php:29 
     465#: view/attachment-metabox.php:39 
    463466msgid "File does not exist on server" 
    464467msgstr "" 
  • amazon-s3-and-cloudfront/trunk/readme.txt

    r1681217 r1771524  
    33Tags: uploads, amazon, s3, amazon s3, mirror, admin, media, cdn, cloudfront 
    44Requires at least: 4.6 
    5 Tested up to: 4.8 
    6 Stable tag: 1.2 
     5Tested up to: 4.9 
     6Stable tag: 1.2.1 
    77License: GPLv3 
    88 
     
    6565 
    6666== Changelog == 
     67 
     68= WP Offload S3 Lite 1.2.1 - 2017-11-20 = 
     69* New: Compatibility with HTML Widget 
     70* New: Dismissible admin notice that WP Offload S3 Lite will soon require PHP 5.5+ 
     71* Improvement: Compatibility with WordPress 4.9 
     72* Bug fix: Incorrect region used when changing bucket by defining it in WPOS3_SETTINGS 
     73* Bug fix: Media library notices render inside the upload tool 
     74* Bug fix: Save notices disappear on settings page 
     75* Bug fix: Improper use of jQuery.attr logged to browser console 
     76* Bug fix: "Content Filtering Upgrade" URL in notice incorrect 
     77* Bug fix: "More info" links can be broken across two lines 
    6778 
    6879= WP Offload S3 Lite 1.2 - 2017-06-19 = 
  • amazon-s3-and-cloudfront/trunk/view/attachment-metabox.php

    r1613429 r1771524  
     1<?php 
     2/** @var array|bool $s3object */ 
     3/** @var WP_Post $post */ 
     4/** @var array $available_actions */ 
     5/** @var bool $local_file_exists */ 
     6/** @var string $sendback */ 
     7$is_removable    = $s3object && in_array( 'remove', $available_actions ); 
     8$is_copyable     = $local_file_exists && in_array( 'copy', $available_actions ); 
     9$is_downloadable = ! $local_file_exists && in_array( 'download', $available_actions ); 
     10?> 
    111<div class="s3-details"> 
    212    <?php if ( ! $s3object ) : ?> 
     
    2535            </div> 
    2636        </div> 
    27         <?php if ( $user_can_perform_actions && ! $local_file_exists ) : ?> 
     37        <?php if ( $is_downloadable ) : ?> 
    2838            <div class="misc-pub-section"> 
    2939                <div class="not-copied"><?php _e( 'File does not exist on server', 'amazon-s3-and-cloudfront' ); ?></div> 
     
    3646    <div class="clear"></div> 
    3747</div> 
    38 <?php if ( $user_can_perform_actions && ( $s3object || $local_file_exists ) ) : ?> 
     48 
     49<?php if ( $is_removable || $is_copyable ) : ?> 
    3950    <div class="s3-actions"> 
    40         <?php if ( $s3object ) : ?> 
     51        <?php if ( $is_removable ) : ?> 
    4152            <div class="remove-action"> 
    42                 <a id="as3cf-remove-action" href="<?php echo $this->get_media_action_url( 'remove', $post->ID, $sendback ); ?>" class="<?php echo ( ! $local_file_exists ) ? 'local-warning' : ''; ?>"> 
     53                <a id="as3cf-remove-action" href="<?php echo $this->get_media_action_url( 'remove', $post->ID, $sendback ); ?>"> 
    4354                    <?php echo $this->get_media_action_strings( 'remove' ); ?> 
    4455                </a> 
    4556            </div> 
    4657        <?php endif; ?> 
    47         <?php if ( $local_file_exists ) : ?> 
     58        <?php if ( $is_copyable ) : ?> 
    4859            <div class="copy-action"> 
    4960                <a id="as3cf-copy-action" href="<?php echo $this->get_media_action_url( 'copy', $post->ID, $sendback ); ?>" class="button button-secondary"> 
  • amazon-s3-and-cloudfront/trunk/wordpress-s3.php

    r1681217 r1771524  
    55Description: Automatically copies media uploads to Amazon S3 for storage and delivery. Optionally configure Amazon CloudFront for even faster delivery. 
    66Author: Delicious Brains 
    7 Version: 1.2 
     7Version: 1.2.1 
    88Author URI: https://deliciousbrains.com/ 
    99Network: True 
     
    2727*/ 
    2828 
    29 $GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.2'; 
     29$GLOBALS['aws_meta']['amazon-s3-and-cloudfront']['version'] = '1.2.1'; 
    3030 
    31 $aws_plugin_version_required = '1.0.3'; 
     31$aws_plugin_version_required = '1.0.4'; 
    3232 
    3333require_once dirname( __FILE__ ) . '/classes/wp-aws-compatibility-check.php'; 
Note: See TracChangeset for help on using the changeset viewer.