feat: add S3-compatible storage provider (MinIO, Ceph, R2, etc.)

Adds a new 'S3-Compatible Storage' provider that works with any
S3-API-compatible object storage service, including MinIO, Ceph,
Cloudflare R2, Backblaze B2, and others.

Changes:
- New provider class: classes/providers/storage/s3-compatible-provider.php
  - Provider key: s3compatible
  - Reads user-configured endpoint URL from settings
  - Uses path-style URL access (required by most S3-compatible services)
  - Supports credentials via AS3CF_S3COMPAT_ACCESS_KEY_ID /
    AS3CF_S3COMPAT_SECRET_ACCESS_KEY wp-config.php constants
  - Disables AWS-specific features (Block Public Access, Object Ownership)
- New provider SVG icons (s3compatible.svg, -link.svg, -round.svg)
- Registered provider in main plugin class with endpoint setting support
- Updated StorageProviderSubPage to show endpoint URL input for S3-compatible
- Built pro settings bundle with rollup (Svelte 4.2.19)
- Added package.json and updated rollup.config.mjs for pro-only builds
This commit is contained in:
2026-03-03 12:30:18 +01:00
commit 3248cbb029
2086 changed files with 359427 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
(function( $ ) {
$( document ).ready( function() {
$( 'body' ).on( 'click', '#as3cfpro-toggle-acl', function( e ) {
e.preventDefault();
var toggle = $( '#as3cfpro-toggle-acl' );
var currentACL = toggle.data( 'currentacl' );
var newACL = as3cfpro_media.settings.private_acl;
if ( -1 === as3cfpro_media.actions.indexOf( 'update_acl' ) ) {
return;
}
toggle.hide();
toggle.after( '<span id="as3cfpro-updating">' + as3cfpro_media.strings.updating_acl + '</span>' );
if ( currentACL === as3cfpro_media.settings.private_acl ) {
newACL = as3cfpro_media.settings.default_acl;
}
wp.ajax.send( 'as3cfpro_update_acl', {
data: {
_ajax_nonce: as3cfpro_media.nonces.singular_update_acl,
id: as3cfpro_media.settings.post_id,
acl: newACL
}
} ).done( function( response ) {
$( '#as3cfpro-updating' ).remove();
$( '#attachment_url' ).val( response.url );
toggle.text( response.acl_display );
toggle.attr( 'title', response.title );
toggle.data( 'currentacl', response.acl );
toggle.show();
} ).fail( function( response ) {
$( '#as3cfpro-updating' ).remove();
toggle.show();
alert( as3cfpro_media.strings.change_acl_error );
} );
} );
// Ask for confirmation when trying to remove attachment from S3 when the local file is missing
$( 'body' ).on( 'click', '.s3-actions a.local-warning', function( e ) {
if ( confirm( as3cfpro_media.strings.local_warning ) ) {
return true;
}
e.preventDefault();
e.stopImmediatePropagation();
return false;
} );
} );
})( jQuery );

1
assets/js/pro/attachment.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function($){$(document).ready((function(){$("body").on("click","#as3cfpro-toggle-acl",(function(e){e.preventDefault();var toggle=$("#as3cfpro-toggle-acl");var currentACL=toggle.data("currentacl");var newACL=as3cfpro_media.settings.private_acl;if(-1===as3cfpro_media.actions.indexOf("update_acl")){return}toggle.hide();toggle.after('<span id="as3cfpro-updating">'+as3cfpro_media.strings.updating_acl+"</span>");if(currentACL===as3cfpro_media.settings.private_acl){newACL=as3cfpro_media.settings.default_acl}wp.ajax.send("as3cfpro_update_acl",{data:{_ajax_nonce:as3cfpro_media.nonces.singular_update_acl,id:as3cfpro_media.settings.post_id,acl:newACL}}).done((function(response){$("#as3cfpro-updating").remove();$("#attachment_url").val(response.url);toggle.text(response.acl_display);toggle.attr("title",response.title);toggle.data("currentacl",response.acl);toggle.show()})).fail((function(response){$("#as3cfpro-updating").remove();toggle.show();alert(as3cfpro_media.strings.change_acl_error)}))}));$("body").on("click",".s3-actions a.local-warning",(function(e){if(confirm(as3cfpro_media.strings.local_warning)){return true}e.preventDefault();e.stopImmediatePropagation();return false}))}))})(jQuery);

View File

@@ -0,0 +1 @@
{"version":3,"names":["$","document","ready","on","e","preventDefault","toggle","currentACL","data","newACL","as3cfpro_media","settings","private_acl","actions","indexOf","hide","after","strings","updating_acl","default_acl","wp","ajax","send","_ajax_nonce","nonces","singular_update_acl","id","post_id","acl","done","response","remove","val","url","text","acl_display","attr","title","show","fail","alert","change_acl_error","confirm","local_warning","stopImmediatePropagation","jQuery"],"sources":["assets/js/pro/attachment.js"],"mappings":"CAAA,SAAWA,GAEVA,EAAGC,UAAWC,OAAO,WAEpBF,EAAG,QAASG,GAAI,QAAS,wBAAwB,SAAUC,GAC1DA,EAAEC,iBAEF,IAAIC,OAASN,EAAG,wBAChB,IAAIO,WAAaD,OAAOE,KAAM,cAC9B,IAAIC,OAASC,eAAeC,SAASC,YAErC,IAAM,IAAMF,eAAeG,QAAQC,QAAS,cAAiB,CAC5D,MACD,CAEAR,OAAOS,OACPT,OAAOU,MAAO,gCAAkCN,eAAeO,QAAQC,aAAe,WAEtF,GAAKX,aAAeG,eAAeC,SAASC,YAAc,CACzDH,OAASC,eAAeC,SAASQ,WAClC,CAEAC,GAAGC,KAAKC,KAAM,sBAAuB,CACpCd,KAAM,CACLe,YAAab,eAAec,OAAOC,oBACnCC,GAAIhB,eAAeC,SAASgB,QAC5BC,IAAKnB,UAEHoB,MAAM,SAAUC,UACnB9B,EAAG,sBAAuB+B,SAC1B/B,EAAG,mBAAoBgC,IAAKF,SAASG,KAErC3B,OAAO4B,KAAMJ,SAASK,aACtB7B,OAAO8B,KAAM,QAASN,SAASO,OAC/B/B,OAAOE,KAAM,aAAcsB,SAASF,KACpCtB,OAAOgC,MACR,IAAIC,MAAM,SAAUT,UACnB9B,EAAG,sBAAuB+B,SAE1BzB,OAAOgC,OAEPE,MAAO9B,eAAeO,QAAQwB,iBAC/B,GACD,IAGAzC,EAAG,QAASG,GAAI,QAAS,+BAA+B,SAAUC,GACjE,GAAKsC,QAAShC,eAAeO,QAAQ0B,eAAkB,CACtD,OAAO,IACR,CAEAvC,EAAEC,iBACFD,EAAEwC,2BAEF,OAAO,KACR,GAED,GAEA,EA3DD,CA2DIC","ignoreList":[]}

View File

@@ -0,0 +1,91 @@
(function( $, wp, _ ) {
/**
* Create and display a spinner next to an element
*
* @param element
*/
function createSpinner( element ) {
var $spinner = $( '<span />', { class: 'spinner' } );
$spinner.css( { 'display': 'inline-block', 'float': 'none', 'visibility': 'visible' } );
$spinner.insertAfter( element );
return $spinner;
}
$( document ).ready( function() {
// Move the filesystem credential form below the last error notice
var $lastNotice = $( '.as3cf-pro-installer-notice' ).last();
$( '.as3cfpro-installer-filesystem-creds' ).insertAfter( $lastNotice );
$( '.as3cfpro-installer-filesystem-creds form' ).on( 'submit', function( e ) {
var $submitBtn = $( '#upgrade' );
if ( $submitBtn.hasClass( 'button-disabled' ) ) {
return;
}
$submitBtn.addClass( 'button-disabled' );
$submitBtn.val( as3cfpro_installer.strings.installing + '...' );
createSpinner( $submitBtn );
} );
$( 'body' ).on( 'click', '.as3cf-pro-installer .install-plugins', function( e ) {
e.preventDefault();
if ( $( this ).hasClass( 'button-disabled' ) ) {
return;
}
$( this ).addClass( 'button-disabled' );
$( this ).text( as3cfpro_installer.strings.installing + '...' );
var $spinner = createSpinner( this );
/**
* Render an error notice and remove the installer notice
*
* @param string errorMessage
*/
function installerError( errorMessage ) {
var noticeText = as3cfpro_installer.strings.error_installing + ': ' + errorMessage;
var noticeHtml = '<div class="error"><p>' + noticeText + '</p></div>';
$( '.as3cf-pro-installer' ).after( noticeHtml );
$( '.as3cf-pro-installer' ).remove();
$spinner.hide();
}
var process = $( this ).data( 'process' );
$.ajax( {
url: ajaxurl,
type: 'POST',
dataType: 'json',
cache: false,
data: {
action: 'as3cfpro_install_plugins_' + process,
nonce: as3cfpro_installer.nonces.install_plugins
},
error: function( jqXHR, textStatus, errorThrown ) {
installerError( errorThrown + ' - ' + textStatus );
},
success: function( response ) {
if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) {
if ( response.success ) {
window.location.href = response.data.redirect;
}
if ( ! _.isUndefined( response.data.error ) ) {
installerError( response.data.error );
}
}
}
} );
} );
} );
})( jQuery, wp, _ );

1
assets/js/pro/installer.min.js vendored Normal file
View File

@@ -0,0 +1 @@
(function($,wp,_){function createSpinner(element){var $spinner=$("<span />",{class:"spinner"});$spinner.css({display:"inline-block",float:"none",visibility:"visible"});$spinner.insertAfter(element);return $spinner}$(document).ready((function(){var $lastNotice=$(".as3cf-pro-installer-notice").last();$(".as3cfpro-installer-filesystem-creds").insertAfter($lastNotice);$(".as3cfpro-installer-filesystem-creds form").on("submit",(function(e){var $submitBtn=$("#upgrade");if($submitBtn.hasClass("button-disabled")){return}$submitBtn.addClass("button-disabled");$submitBtn.val(as3cfpro_installer.strings.installing+"...");createSpinner($submitBtn)}));$("body").on("click",".as3cf-pro-installer .install-plugins",(function(e){e.preventDefault();if($(this).hasClass("button-disabled")){return}$(this).addClass("button-disabled");$(this).text(as3cfpro_installer.strings.installing+"...");var $spinner=createSpinner(this);function installerError(errorMessage){var noticeText=as3cfpro_installer.strings.error_installing+": "+errorMessage;var noticeHtml='<div class="error"><p>'+noticeText+"</p></div>";$(".as3cf-pro-installer").after(noticeHtml);$(".as3cf-pro-installer").remove();$spinner.hide()}var process=$(this).data("process");$.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:false,data:{action:"as3cfpro_install_plugins_"+process,nonce:as3cfpro_installer.nonces.install_plugins},error:function(jqXHR,textStatus,errorThrown){installerError(errorThrown+" - "+textStatus)},success:function(response){if(_.isObject(response)&&!_.isUndefined(response.success)){if(response.success){window.location.href=response.data.redirect}if(!_.isUndefined(response.data.error)){installerError(response.data.error)}}}})}))}))})(jQuery,wp,_);

View File

@@ -0,0 +1 @@
{"version":3,"names":["$","wp","_","createSpinner","element","$spinner","class","css","display","float","visibility","insertAfter","document","ready","$lastNotice","last","on","e","$submitBtn","hasClass","addClass","val","as3cfpro_installer","strings","installing","preventDefault","this","text","installerError","errorMessage","noticeText","error_installing","noticeHtml","after","remove","hide","process","data","ajax","url","ajaxurl","type","dataType","cache","action","nonce","nonces","install_plugins","error","jqXHR","textStatus","errorThrown","success","response","isObject","isUndefined","window","location","href","redirect","jQuery"],"sources":["assets/js/pro/installer.js"],"mappings":"CAAA,SAAWA,EAAGC,GAAIC,GAOjB,SAASC,cAAeC,SACvB,IAAIC,SAAWL,EAAG,WAAY,CAAEM,MAAO,YACvCD,SAASE,IAAK,CAAEC,QAAW,eAAgBC,MAAS,OAAQC,WAAc,YAC1EL,SAASM,YAAaP,SAEtB,OAAOC,QACR,CAEAL,EAAGY,UAAWC,OAAO,WAGpB,IAAIC,YAAcd,EAAG,+BAAgCe,OACrDf,EAAG,wCAAyCW,YAAaG,aAEzDd,EAAG,6CAA8CgB,GAAI,UAAU,SAAUC,GACxE,IAAIC,WAAalB,EAAG,YACpB,GAAKkB,WAAWC,SAAU,mBAAsB,CAC/C,MACD,CAEAD,WAAWE,SAAU,mBACrBF,WAAWG,IAAKC,mBAAmBC,QAAQC,WAAa,OAExDrB,cAAee,WAChB,IAEAlB,EAAG,QAASgB,GAAI,QAAS,yCAAyC,SAAUC,GAC3EA,EAAEQ,iBACF,GAAKzB,EAAG0B,MAAOP,SAAU,mBAAsB,CAC9C,MACD,CAEAnB,EAAG0B,MAAON,SAAU,mBACpBpB,EAAG0B,MAAOC,KAAML,mBAAmBC,QAAQC,WAAa,OAExD,IAAInB,SAAWF,cAAeuB,MAO9B,SAASE,eAAgBC,cACxB,IAAIC,WAAaR,mBAAmBC,QAAQQ,iBAAmB,KAAOF,aACtE,IAAIG,WAAa,yBAA2BF,WAAa,aAEzD9B,EAAG,wBAAyBiC,MAAOD,YACnChC,EAAG,wBAAyBkC,SAE5B7B,SAAS8B,MACV,CAEA,IAAIC,QAAUpC,EAAG0B,MAAOW,KAAM,WAE9BrC,EAAEsC,KAAM,CACPC,IAAKC,QACLC,KAAM,OACNC,SAAU,OACVC,MAAO,MACPN,KAAM,CACLO,OAAQ,4BAA8BR,QACtCS,MAAOvB,mBAAmBwB,OAAOC,iBAElCC,MAAO,SAAUC,MAAOC,WAAYC,aACnCvB,eAAgBuB,YAAc,MAAQD,WACvC,EACAE,QAAS,SAAUC,UAClB,GAAKnD,EAAEoD,SAAUD,YAAgBnD,EAAEqD,YAAaF,SAASD,SAAY,CAEpE,GAAKC,SAASD,QAAU,CACvBI,OAAOC,SAASC,KAAOL,SAAShB,KAAKsB,QACtC,CAEA,IAAOzD,EAAEqD,YAAaF,SAAShB,KAAKW,OAAU,CAC7CpB,eAAgByB,SAAShB,KAAKW,MAC/B,CACD,CACD,GAEF,GAED,GAEA,EA1FD,CA0FIY,OAAQ3D,GAAIC","ignoreList":[]}

View File

@@ -0,0 +1,76 @@
(function( $, _ ) {
var fileFrame;
var attachment;
var fileNameInput;
var fileUrlInput;
var fileNamePlaceholder;
var fileUrlPlaceholder;
/**
* Render custom media uploader
*
* @param row Object
*
* @return void
*/
function renderMediaUploader( row ) {
// Find the correct file name and url inputs
fileNameInput = row.find( 'td.file_name input.input_text' );
fileUrlInput = row.find( 'td.file_url input.input_text' );
// Use existing file frame instance or create one
if ( undefined !== fileFrame ) {
fileFrame.open();
return;
}
fileFrame = wp.media.frames.file_frame = wp.media( {
title: as3cf_woo.strings.media_modal_title,
button: {
text: as3cf_woo.strings.media_modal_button
},
states: [
new wp.media.controller.Library( {
title: as3cf_woo.strings.media_modal_title,
filterable: 'all',
multiple: false
} )
]
} );
// Handle file selection
fileFrame.on( 'select', function() {
attachment = fileFrame.state().get( 'selection' ).first().toJSON();
fileNamePlaceholder = fileNameInput.attr( 'placeholder' );
fileUrlPlaceholder = fileUrlInput.attr( 'placeholder' );
fileNameInput.val( attachment.title ).attr( 'placeholder', fileNamePlaceholder ).trigger( 'change' );
fileUrlInput.val( attachment.url ).attr( 'placeholder', fileUrlPlaceholder ).trigger( 'change' );
} );
// Ensure files are uploaded to the woocommerce_uploads directory
fileFrame.on( 'ready', function() {
fileFrame.uploader.options.uploader.params = {
type: 'downloadable_product'
};
} );
fileFrame.open();
}
// Replace WooCommerce upload file click handler
$( document ).ready( function() {
$( document ).off( 'click', '.upload_file_button' );
$( document.body ).off( 'click', '.upload_file_button' ); // WooCommerce 2.4+
$( document ).on( 'click', '.upload_file_button', function( e ) {
var row = $( this ).closest( 'tr' );
e.preventDefault();
renderMediaUploader( row );
} );
} );
})( jQuery, _ );

View File

@@ -0,0 +1 @@
!function(t,e){var o,l,a,i,n,r;t(document).ready(function(){t(document).off("click",".upload_file_button"),t(document.body).off("click",".upload_file_button"),t(document).on("click",".upload_file_button",function(e){var d=t(this).closest("tr");e.preventDefault(),function(t){a=t.find("td.file_name input.input_text"),i=t.find("td.file_url input.input_text"),void 0===o?((o=wp.media.frames.file_frame=wp.media({title:as3cf_woo.strings.media_modal_title,button:{text:as3cf_woo.strings.media_modal_button},states:[new wp.media.controller.Library({title:as3cf_woo.strings.media_modal_title,filterable:"all",multiple:!1})]})).on("select",function(){l=o.state().get("selection").first().toJSON(),n=a.attr("placeholder"),r=i.attr("placeholder"),a.val(l.title).attr("placeholder",n).trigger("change"),i.val(l.url).attr("placeholder",r).trigger("change")}),o.on("ready",function(){o.uploader.options.uploader.params={type:"downloadable_product"}}),o.open()):o.open()}(d)})})}(jQuery,_);

350
assets/js/pro/media.js Normal file
View File

@@ -0,0 +1,350 @@
(function( $, _ ) {
// Local reference to the WordPress media namespace.
var media = wp.media;
/**
* A button for offload actions
*
* @constructor
* @augments wp.media.view.Button
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
*/
media.view.OffloadButton = media.view.Button.extend( {
defaults: {
text: '',
style: 'primary',
size: 'large',
disabled: false
},
initialize: function( options ) {
if ( options ) {
this.options = options;
this.defaults.text = as3cfpro_media.strings[ this.options.action ];
}
this.options = _.extend( {}, this.defaults, this.options );
media.view.Button.prototype.initialize.apply( this, arguments );
this.controller.on( 'selection:toggle', this.toggleDisabled, this );
this.controller.on( 'select:activate', this.toggleDisabled, this );
},
render: function() {
media.view.Button.prototype.render.apply( this, arguments );
this.toggleDisabled();
return this;
},
toggleDisabled: function() {
var selection = this.controller.state().get( 'selection' ).length > 0;
if ( !selection ) {
this.$el.addClass( 'disabled' );
} else {
this.$el.removeClass( 'disabled' );
}
},
click: function( e ) {
e.preventDefault();
var selection = this.controller.state().get( 'selection' );
var models = selection.models;
var library = this.controller.state().get( 'library' );
if ( this.$el.hasClass( 'disabled' ) || !selection.length ) {
return;
}
var payload = {
_ajax_nonce: as3cfpro_media.nonces[ this.options.scope + '_' + this.options.action ],
scope: this.options.scope,
s3_action: this.options.action,
ids: _.pluck( models, 'id' )
};
this.startOffloadAction();
this.fireOffloadAction( payload )
.done( function() {
_.each( models, function( model ) {
// Refresh the attributes for each model from the server.
model.fetch();
} );
// Refresh the grid view
library._requery( true );
} );
},
startOffloadAction: function() {
$( '.media-toolbar .spinner' ).css( 'visibility', 'visible' ).show();
$( '.media-toolbar-secondary .button' ).addClass( 'disabled' );
$( '.offload-buttons__submenu' ).addClass( 'hidden' );
},
/**
* Send the offload action request via ajax.
*
* @param {object} payload
*
* @return {$.promise} A jQuery promise that represents the request,
* decorated with an abort() method.
*/
fireOffloadAction: function( payload ) {
return wp.ajax.send( 'as3cfpro_process_media_action', { data: payload } )
.done( _.bind( this.returnOffloadAction, this ) );
},
returnOffloadAction: function( response ) {
if ( response && '' !== response ) {
$( '.as3cf-notice' ).remove();
$( '#wp-media-grid h1' ).after( response );
}
this.controller.trigger( 'selection:action:done' );
$( '.media-toolbar .spinner' ).attr( 'style', '' ).hide();
}
} );
/**
* A toggle button for offload dropdown button
*
* @constructor
* @augments wp.media.view.Button
* @augments wp.media.View
* @augments wp.Backbone.View
* @augments Backbone.View
*/
media.view.OffloadToggle = media.view.Button.extend( {
className: 'offload-buttons__toggle',
defaults: {
style: 'primary',
size: 'large',
priority: -80,
disabled: true
},
initialize: function() {
media.view.Button.prototype.initialize.apply( this, arguments );
this.controller.on( 'selection:toggle', this.toggleDisabled, this );
this.controller.on( 'select:activate', this.toggleDisabled, this );
$( 'body' ).on( 'click', this.blur );
return this;
},
click: function( e ) {
e.preventDefault();
if ( this.$el.hasClass( 'disabled' ) ) {
return;
}
var toolbar = this.controller.content.get().toolbar;
this.$el.toggleClass( 'opened' );
toolbar.$( '.offload-buttons__submenu' ).toggleClass( 'hidden' );
},
blur: function() {
var $toggle = $( '.media-toolbar .offload-buttons__toggle' );
var $submenu = $( '.media-toolbar .offload-buttons__submenu' );
if ( $toggle.hasClass( 'opened' ) && !$submenu.parent().is( ':active, :hover' ) ) {
$submenu.addClass( 'hidden' );
$toggle.removeClass( 'opened' );
}
},
toggleDisabled: function() {
var selection = this.controller.state().get( 'selection' ).length > 0;
this.model.set( 'disabled', !selection );
if ( !selection ) {
this.$el.addClass( 'disabled' );
} else {
this.$el.removeClass( 'disabled' );
}
}
} );
/**
* Show and hide the offload dropdown button for the grid view only.
*/
var wpSelectModeToggleButton = media.view.SelectModeToggleButton;
/**
* Extend the SelectModeToggleButton functionality to show and hide
* the offload dropdown button when the Bulk Select button is clicked
*/
media.view.SelectModeToggleButton = wpSelectModeToggleButton.extend( {
toggleBulkEditHandler: function() {
wpSelectModeToggleButton.prototype.toggleBulkEditHandler.call( this, arguments );
var $toolbar = this.controller.content.get().toolbar;
var $buttons = $toolbar.$( '.offload-buttons' );
var $submenu = $buttons.find( '.offload-buttons__submenu' );
if ( this.controller.isModeActive( 'select' ) ) {
$buttons.addClass( 'visible' );
} else {
$buttons.removeClass( 'visible' );
}
// Applies children's width to dropdown button
if ( $submenu.length ) {
$buttons.width( $submenu.outerWidth() );
}
}
} );
/**
* A filter for Locations
*/
media.view.OffloadLocationFilter = wp.media.view.AttachmentFilters.extend( {
id: 'media-attachment-as3cf-location-filter',
// We override the default initialize function to support optgroups
initialize: function() {
this.createFilters();
_.extend( this.filters, this.options.filters );
var html = '';
_( as3cfpro_media.filters.as3cf_location.options ).each( function( option, key ) {
if ( typeof option === 'string' ) {
html += $( '<option></option>' ).val( key ).html( option ).wrap( '<p>' ).parent().html();
} else {
html += '<optgroup label="' + key + '">';
_( option ).each( function( sub_option, sub_key ) {
html += $( '<option></option>' ).val( sub_key ).html( sub_option ).wrap( '<p>' ).parent().html();
} );
html += '</optgroup>';
}
} );
this.$el.html( html );
this.listenTo( this.model, 'change', this.select );
this.select();
},
createFilters: function() {
var filters = {};
_( as3cfpro_media.filters.as3cf_location.options ).each( function( option, key ) {
if ( typeof option === 'string' ) {
filters[ key ] = {
text: option,
props: { as3cf_location: key },
priority: 10,
};
} else {
_( option ).each( function( sub_option, sub_key ) {
filters[ sub_key ] = {
text: sub_option,
props: { as3cf_location: sub_key },
priority: 10,
};
} );
}
} );
this.filters = filters;
},
} );
/**
* A filter for Access
*/
media.view.OffloadAccessFilter = wp.media.view.AttachmentFilters.extend( {
id: 'media-attachment-as3cf-access-filter',
createFilters: function() {
var filters = {};
_( as3cfpro_media.filters.as3cf_access.options ).each( function( value, key ) {
filters[ key ] = {
text: value,
props: { as3cf_access: key },
priority: 10,
};
} );
this.filters = filters;
},
} );
/**
* Extend the AttachmentsBrowser toolbar to add the offload dropdown button and
* our filters for location and access
*/
var wpAttachmentsBrowser = media.view.AttachmentsBrowser;
media.view.AttachmentsBrowser = wpAttachmentsBrowser.extend( {
createToolbar: function() {
wpAttachmentsBrowser.prototype.createToolbar.call( this );
var default_button_action = as3cfpro_media.actions.bulk.shift();
var default_button = new media.view.OffloadButton( {
action: default_button_action,
classes: 'offload-buttons__action-default',
scope: 'bulk',
controller: this.controller
} ).render();
if ( as3cfpro_media.actions.bulk.length ) {
var buttons = [];
_( as3cfpro_media.actions.bulk ).each( function( action ) {
buttons.push(
new media.view.OffloadButton( {
action: action,
classes: 'offload-buttons__action',
scope: 'bulk',
controller: this.controller
} ).render()
);
}.bind( this ) );
var dropdown_toggle = new media.view.OffloadToggle( {
controller: this.controller
} ).render();
var buttons_submenu = new media.view.ButtonGroup( {
buttons: buttons,
classes: 'offload-buttons__submenu hidden'
} ).render();
// Add the buttons
this.toolbar.set( 'OffloadButtons', new media.view.ButtonGroup( {
buttons: [default_button, buttons_submenu, dropdown_toggle],
classes: 'offload-buttons',
priority: -80
} ) );
}
// Add the locations filter
this.toolbar.set( 'offloadLocationFilter', new media.view.OffloadLocationFilter( {
controller: this.controller,
model: this.collection.props,
priority: -75
} ) );
// Add the access filter
this.toolbar.set( 'offloadAccessFilter', new media.view.OffloadAccessFilter( {
controller: this.controller,
model: this.collection.props,
priority: -75
} ) );
this.toolbar.render();
}
} );
})( jQuery, _ );

1
assets/js/pro/media.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
.notice-icon-wrapper.svelte-jtkdoa{display:inline-block;min-width:1.1875rem}.notice-icon.svelte-jtkdoa{margin-left:2px;margin-top:-1.5px;vertical-align:middle}
.panel-row.svelte-41r5oq.svelte-41r5oq{position:relative}.header.svelte-41r5oq .gradient.svelte-41r5oq{position:absolute;width:144px;left:0;top:0;bottom:0;transform:matrix(-1, 0, 0, 1, 0, 0);border-top-right-radius:5px}
.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}
#as3cf-settings.wpome div.panel.settings .header img.svelte-cn9mf.svelte-cn9mf{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-cn9mf.svelte-cn9mf{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-cn9mf h3.svelte-cn9mf{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf.svelte-cn9mf{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-cn9mf .console.svelte-cn9mf{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf a[target="_blank"].console.svelte-cn9mf:after{margin-right:0}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf .region.svelte-cn9mf{flex:1 0 auto;color:var(--as3cf-color-gray-500);margin:0 0.5rem}
div.check-again.svelte-1oue4lo.svelte-1oue4lo{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap;min-width:6rem;padding-left:0.5rem;color:var(--as3cf-color-gray-700)}#as3cf-settings .check-again.svelte-1oue4lo .last-update.svelte-1oue4lo{padding-right:2px;margin-top:2px}
.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}
#as3cf-settings.wpome div.panel.settings .header img.svelte-sglpwv.svelte-sglpwv{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-sglpwv.svelte-sglpwv{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-sglpwv h3.svelte-sglpwv{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv.svelte-sglpwv{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-sglpwv .console.svelte-sglpwv{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv a[target="_blank"].console.svelte-sglpwv:after{margin-right:0}
#as3cf-settings.wpome div.panel.settings .header img.svelte-1m7cok0.svelte-1m7cok0{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.assets-details.svelte-1m7cok0.svelte-1m7cok0{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .assets-details.svelte-1m7cok0 h3.svelte-1m7cok0{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-1m7cok0.svelte-1m7cok0{display:flex;align-items:center;color:var(--as3cf-color-gray-600);font-size:0.75rem}
.content.svelte-5j10or.svelte-5j10or{padding:1.875rem 2.25rem 1.5rem 2.25rem;display:flex;flex-direction:column}.heading.svelte-5j10or.svelte-5j10or{margin-top:1rem;font-weight:700;font-size:1.125rem;line-height:140%}.description.svelte-5j10or.svelte-5j10or{margin-top:1rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or.svelte-5j10or{margin-top:1.7rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or li.svelte-5j10or{display:flex;align-items:center}.benefits.svelte-5j10or img.svelte-5j10or{height:40px;margin-left:-5px;margin-right:10px}.call-to-action.svelte-5j10or.svelte-5j10or{margin-top:0.7rem}.call-to-action.svelte-5j10or .note.svelte-5j10or{text-align:center}
.nav-status-wrapper.svelte-1i784er{position:relative}

45667
assets/js/pro/settings.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1
assets/js/pro/settings.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,77 @@
var as3cfDeactivatePluginModal = (function( $, as3cfModal ) {
var modal = {
selector: '.as3cf-deactivate-plugin-container',
event: {}
};
var wpApiSettings = window.wpApiSettings;
/**
* Open modal
*
* @param {object} event
*/
modal.open = function( event ) {
modal.event = event;
modal.event.preventDefault();
as3cfModal.open( modal.selector, null, 'deactivate-plugin' );
};
/**
* Close modal
*/
modal.close = function( download ) {
as3cfModal.setLoadingState( false );
as3cfModal.close();
if ( 1 === parseInt( download ) ) {
// Start tool and let it redirect to Tools page.
modal.startTool();
} else {
// Just let page do its thing.
window.location = modal.event.target;
}
};
modal.startTool = function() {
$.ajax( {
url: wpApiSettings.root + 'wp-offload-media/v1/tool/',
method: 'POST',
beforeSend: function( xhr ) {
xhr.setRequestHeader( 'Accept', 'application/json' );
xhr.setRequestHeader( 'Content-Type', 'application/json' );
xhr.setRequestHeader( 'X-WP-Nonce', wpApiSettings.nonce );
},
data: JSON.stringify( {
'id': 'downloader',
'action': 'start'
} )
} ).done( function( response ) {
window.location = as3cfpro_downloader.plugin_url;
} );
};
// Setup click handlers
$( document ).ready( function() {
$( 'body' ).on( 'click', '.deactivate-plugin [data-download-tool]', function( e ) {
var value = $( this ).data( 'download-tool' );
$( '[data-download-tool]' ).prop( 'disabled', true ).siblings( '.spinner' ).css( 'visibility', 'visible' ).show();
as3cfModal.setLoadingState( true );
modal.close( value );
} );
$( 'body' ).on( 'click', '#' + as3cfpro_downloader.plugin_slug + ' .deactivate a, [data-slug="' + as3cfpro_downloader.plugin_slug + '"] .deactivate a', function( event ) {
as3cfDeactivatePluginModal.open( event );
} );
} );
return modal;
})( jQuery, as3cfModal );

View File

@@ -0,0 +1 @@
var as3cfDeactivatePluginModal=function(o,e){var t={selector:".as3cf-deactivate-plugin-container",event:{}},a=window.wpApiSettings;return t.open=function(o){t.event=o,t.event.preventDefault(),e.open(t.selector,null,"deactivate-plugin")},t.close=function(o){e.setLoadingState(!1),e.close(),1===parseInt(o)?t.startTool():window.location=t.event.target},t.startTool=function(){o.ajax({url:a.root+"wp-offload-media/v1/tool/",method:"POST",beforeSend:function(o){o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("X-WP-Nonce",a.nonce)},data:JSON.stringify({id:"downloader",action:"start"})}).done(function(o){window.location=as3cfpro_downloader.plugin_url})},o(document).ready(function(){o("body").on("click",".deactivate-plugin [data-download-tool]",function(a){var n=o(this).data("download-tool");o("[data-download-tool]").prop("disabled",!0).siblings(".spinner").css("visibility","visible").show(),e.setLoadingState(!0),t.close(n)}),o("body").on("click","#"+as3cfpro_downloader.plugin_slug+' .deactivate a, [data-slug="'+as3cfpro_downloader.plugin_slug+'"] .deactivate a',function(o){as3cfDeactivatePluginModal.open(o)})}),t}(jQuery,as3cfModal);