forked from LiveCarta/LiveCartaWP
Changed source root directory
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
/*! dup tooltip */
|
||||
(function ($) {
|
||||
DuplicatorTooltip = {
|
||||
initialized: false,
|
||||
messages: {
|
||||
'copy': window.hasOwnProperty('l10nDupTooltip') ? l10nDupTooltip.copy : 'Copy to clipboard',
|
||||
'copied': window.hasOwnProperty('l10nDupTooltip') ? l10nDupTooltip.copied : 'copied to clipboard',
|
||||
'copyUnable': window.hasOwnProperty('l10nDupTooltip') ? l10nDupTooltip.copyUnable : 'Unable to copy'
|
||||
},
|
||||
messages: Object.assign(
|
||||
{},
|
||||
{
|
||||
'copy': 'Copy to Clipboard',
|
||||
'copied': 'Copied to Clipboard',
|
||||
'copyUnable': 'Unable to Copy'
|
||||
},
|
||||
(typeof l10nDupTooltip === 'object' ? l10nDupTooltip : {})
|
||||
),
|
||||
load: function () {
|
||||
if (this.initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadSelector('[data-tooltip]');
|
||||
this.loadCopySelector('[data-dup-copy-value]');
|
||||
|
||||
this.initialized = true;
|
||||
},
|
||||
loadSelector: function (selector) {
|
||||
$(selector).each(function () {
|
||||
if (this._tippy) {
|
||||
// already init
|
||||
return;
|
||||
}
|
||||
|
||||
tippy(this, {
|
||||
content: function (ref) {
|
||||
var header = ref.dataset.tooltipTitle;
|
||||
var body = ref.dataset.tooltip;
|
||||
var res = header !== undefined ? '<h3>' + header + '</h3>' : '';
|
||||
res += '<div class="dup-tippy-content">' + body + '</div>';
|
||||
return res;
|
||||
},
|
||||
allowHTML: true,
|
||||
interactive: true,
|
||||
placement: this.dataset.tooltipPlacement ? this.dataset.tooltipPlacement : 'bottom-start',
|
||||
theme: 'duplicator',
|
||||
zIndex: 900000,
|
||||
appendTo: document.body
|
||||
});
|
||||
$(this).data('dup-tooltip-loaded', true);
|
||||
});
|
||||
},
|
||||
loadCopySelector: function (selector) {
|
||||
$(selector).each(function () {
|
||||
if (this._tippy) {
|
||||
// already init
|
||||
return;
|
||||
}
|
||||
|
||||
var element = $(this);
|
||||
if (element.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tippyElement = tippy(this, {
|
||||
allowHTML: true,
|
||||
placement: this.dataset.tooltipPlacement ? this.dataset.tooltipPlacement : 'bottom-start',
|
||||
theme: 'duplicator',
|
||||
zIndex: 900000,
|
||||
hideOnClick: false,
|
||||
trigger: 'manual'
|
||||
});
|
||||
|
||||
var copyTitle = element.is('[data-dup-copy-title]') ? element.data('dup-copy-title') : DuplicatorTooltip.messages.copy;
|
||||
tippyElement.setContent('<div class="dup-tippy-content">' + copyTitle + '</div>');
|
||||
|
||||
//Have to set manually otherwise might hide on click.
|
||||
element.mouseover(function () {
|
||||
tippyElement.show();
|
||||
}).mouseout(function () {
|
||||
tippyElement.hide();
|
||||
});
|
||||
|
||||
element.click(function () {
|
||||
var valueToCopy = element.data('dup-copy-value');
|
||||
var copiedTitle = element.is('[data-dup-copied-title]') ? element.data('dup-copied-title') : valueToCopy + ' ' + DuplicatorTooltip.messages.copied;
|
||||
var message = DuplicatorTooltip.messages.copyUnable;
|
||||
var tmpArea = jQuery("<textarea></textarea>").css({
|
||||
position: 'absolute',
|
||||
top: '-10000px'
|
||||
}).text(valueToCopy).appendTo("body");
|
||||
tmpArea.select();
|
||||
|
||||
try {
|
||||
message = document.execCommand('copy') ? copiedTitle : DuplicatorTooltip.messages.copyUnable;
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
tippyElement.setContent('<div class="dup-tippy-content">' + message + '</div>');
|
||||
tippyElement.setProps({ theme: 'duplicator-filled' });
|
||||
|
||||
setTimeout(function () {
|
||||
tippyElement.setContent('<div class="dup-tippy-content">' + copyTitle + '</div>');
|
||||
tippyElement.setProps({ theme: 'duplicator' });
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
},
|
||||
updateElementContent: function (selector, content) {
|
||||
if ($(selector).get(0)) {
|
||||
$(selector).get(0)._tippy.setContent('<div class="dup-tippy-content">' + content + '</div>');
|
||||
}
|
||||
},
|
||||
unload: function () {
|
||||
var tooltips = document.querySelectorAll('[data-tooltip], [data-dup-copy-value]');
|
||||
tooltips.forEach(function (element) {
|
||||
if (element._tippy) {
|
||||
element._tippy.destroy();
|
||||
element._tippy = null;
|
||||
}
|
||||
});
|
||||
this.initialized = false;
|
||||
},
|
||||
reload: function () {
|
||||
this.unload();
|
||||
this.load();
|
||||
}
|
||||
}
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
/*! ============================================================================
|
||||
* UTIL NAMESPACE: All methods at the top of the Duplicator Namespace
|
||||
* =========================================================================== */
|
||||
defined("ABSPATH") or die("");
|
||||
use Duplicator\Libs\Snap\SnapJson;
|
||||
|
||||
?>
|
||||
|
||||
<script>
|
||||
Duplicator.Util.ajaxProgress = null;
|
||||
|
||||
Duplicator.Util.ajaxProgressInit = function () {
|
||||
let ajaxProgress = jQuery('#duplicator-ajax-loader');
|
||||
if (ajaxProgress.length === 0) {
|
||||
let ajaxProgress = `
|
||||
<div id="duplicator-ajax-loader" >
|
||||
<div id="duplicator-ajax-loader-img-wrapper" >
|
||||
<img
|
||||
src="<?php echo esc_url(DUPLICATOR_PLUGIN_URL . '/assets/img/duplicator-logo-icon.svg'); ?>"
|
||||
alt="<?php _e('wait ...', 'duplicator'); ?>"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
jQuery('body').append(ajaxProgress);
|
||||
}
|
||||
|
||||
Duplicator.Util.ajaxProgress = jQuery('#duplicator-ajax-loader');
|
||||
}
|
||||
|
||||
Duplicator.Util.ajaxProgressShow = function () {
|
||||
if (Duplicator.Util.ajaxProgress === null) {
|
||||
Duplicator.Util.ajaxProgressInit();
|
||||
}
|
||||
|
||||
Duplicator.Util.ajaxProgress
|
||||
.stop(true, true)
|
||||
.css('display', 'block')
|
||||
.delay(1000)
|
||||
.animate({
|
||||
opacity: 1
|
||||
}, 500);
|
||||
}
|
||||
|
||||
Duplicator.Util.ajaxProgressHide = function () {
|
||||
if (Duplicator.Util.ajaxProgress === null) {
|
||||
return;
|
||||
}
|
||||
Duplicator.Util.ajaxProgress
|
||||
.stop(true, true)
|
||||
.delay(500)
|
||||
.animate({
|
||||
opacity: 0
|
||||
}, 300, function () {
|
||||
jQuery(this).css({
|
||||
'display': 'none'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Duplicator.Util.ajaxWrapper = function (ajaxData, callbackSuccess, callbackFail) {
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
dataType: "json",
|
||||
data: ajaxData,
|
||||
beforeSend: function( xhr ) {
|
||||
Duplicator.Util.ajaxProgressShow();
|
||||
},
|
||||
success: function (result, textStatus, jqXHR) {
|
||||
var message = '';
|
||||
if (result.success) {
|
||||
if (typeof callbackSuccess === "function") {
|
||||
try {
|
||||
message = callbackSuccess(result, result.data, result.data.funcData, textStatus, jqXHR);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
Duplicator.addAdminMessage(error.message, 'error');
|
||||
message = '';
|
||||
}
|
||||
} else {
|
||||
message = '<?php _e('RESPONSE SUCCESS', 'duplicator'); ?>';
|
||||
}
|
||||
if (message != null && String(message).length) {
|
||||
Duplicator.addAdminMessage(message, 'notice');
|
||||
}
|
||||
} else {
|
||||
if (typeof callbackFail === "function") {
|
||||
try {
|
||||
message = callbackFail(result, result.data, result.data.funcData, textStatus, jqXHR);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
message = error.message;
|
||||
}
|
||||
} else {
|
||||
message = '<?php _e('RESPONSE ERROR!', 'duplicator'); ?>' + '<br><br>' + result.data.message;
|
||||
}
|
||||
if (message != null && String(message).length) {
|
||||
Duplicator.addAdminMessage(message, 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (result) {
|
||||
Duplicator.addAdminMessage(<?php
|
||||
echo SnapJson::jsonEncode(__('AJAX ERROR! ', 'duplicator') . '<br>' . __('Ajax request error', 'duplicator'));
|
||||
?>, 'error');
|
||||
},
|
||||
complete: function () {
|
||||
Duplicator.Util.ajaxProgressHide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get human size from bytes number.
|
||||
* Is size is -1 return unknown
|
||||
*
|
||||
* @param {size} int bytes size
|
||||
*/
|
||||
Duplicator.Util.humanFileSize = function(size) {
|
||||
if (size < 0) {
|
||||
return "unknown";
|
||||
}
|
||||
else if (size == 0) {
|
||||
return "0";
|
||||
} else {
|
||||
var i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
||||
}
|
||||
};
|
||||
|
||||
Duplicator.Util.isEmpty = function (val) {
|
||||
return (val === undefined || val == null || val.length <= 0) ? true : false;
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
125
html/wp-content/plugins/duplicator/assets/js/dynamic-help.js
Normal file
125
html/wp-content/plugins/duplicator/assets/js/dynamic-help.js
Normal file
@@ -0,0 +1,125 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
if (typeof Duplicator === 'undefined') {
|
||||
Duplicator = {};
|
||||
Duplicator.Help = {};
|
||||
}
|
||||
|
||||
Duplicator.Help.Data = null;
|
||||
|
||||
Duplicator.Help.isDataLoaded = function() {
|
||||
return Duplicator.Help.Data !== null;
|
||||
};
|
||||
|
||||
Duplicator.Help.ToggleCategory = function(categoryHeader) {
|
||||
$(categoryHeader).find(".fa-angle-right").toggleClass("fa-rotate-90");
|
||||
$(categoryHeader).siblings(".duplicator-help-article-list").slideToggle();
|
||||
$(categoryHeader).siblings(".duplicator-help-category-list").slideToggle();
|
||||
};
|
||||
|
||||
Duplicator.Help.Search = function(search) {
|
||||
let results = $("#duplicator-help-search-results");
|
||||
let noResults = $("#duplicator-help-search-results-empty");
|
||||
let context = $("#duplicator-context-articles");
|
||||
let articles = $(".duplicator-help-article");
|
||||
let regex = Duplicator.Help.GetRegex(search);
|
||||
|
||||
if (search.length === 0 && regex === null) {
|
||||
context.show();
|
||||
results.hide();
|
||||
noResults.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
let found = false;
|
||||
let foundIds = [];
|
||||
|
||||
context.hide();
|
||||
results.empty();
|
||||
|
||||
articles.each(function() {
|
||||
let article = $(this);
|
||||
let id = article.data("id");
|
||||
let title = article.find("a").text().toLowerCase();
|
||||
|
||||
if (title.search(regex) !== -1 && foundIds.indexOf(id) === -1) {
|
||||
found = true;
|
||||
results.append(article.clone());
|
||||
foundIds.push(id);
|
||||
}
|
||||
});
|
||||
|
||||
if (found) {
|
||||
results.show();
|
||||
noResults.hide();
|
||||
} else {
|
||||
results.hide();
|
||||
noResults.show();
|
||||
}
|
||||
};
|
||||
|
||||
Duplicator.Help.Load = function(url) {
|
||||
if (Duplicator.Help.isDataLoaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: url,
|
||||
beforeSend: function(xhr) {
|
||||
Duplicator.Util.ajaxProgressShow();
|
||||
},
|
||||
success: function (result) {
|
||||
Duplicator.Help.Data = result;
|
||||
//because ajax is async we need to open the modal here for first time
|
||||
Duplicator.Help.Display();
|
||||
},
|
||||
error: function (result) {
|
||||
Duplicator.addAdminMessage(l10nDupDynamicHelp.failMsg, 'error');
|
||||
},
|
||||
complete: function () {
|
||||
Duplicator.Util.ajaxProgressHide();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Duplicator.Help.Display = function() {
|
||||
if (!Duplicator.Help.isDataLoaded()) {
|
||||
throw 'Duplicator.Help.Data is null';
|
||||
}
|
||||
|
||||
let box = new DuplicatorModalBox({
|
||||
htmlContent: Duplicator.Help.Data,
|
||||
});
|
||||
box.open();
|
||||
};
|
||||
|
||||
Duplicator.Help.GetRegex = function(search = '') {
|
||||
let regexStr = '';
|
||||
let regex = null;
|
||||
|
||||
if (search.length < 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$.each(search.split(' '), function(key, value) {
|
||||
//escape regex
|
||||
value = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
|
||||
if (value.length > 1) {
|
||||
regexStr += '(?=.*'+value+')';
|
||||
}
|
||||
});
|
||||
|
||||
regex = new RegExp(regexStr, 'i');
|
||||
return regex;
|
||||
};
|
||||
|
||||
|
||||
$("body").on("click", ".duplicator-help-category header", function() {
|
||||
Duplicator.Help.ToggleCategory(this);
|
||||
});
|
||||
|
||||
$("body").on("keyup", "#duplicator-help-search input", function() {
|
||||
Duplicator.Help.Search($(this).val().toLowerCase());
|
||||
});
|
||||
});
|
||||
103
html/wp-content/plugins/duplicator/assets/js/extra-plugins.js
Normal file
103
html/wp-content/plugins/duplicator/assets/js/extra-plugins.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* Duplicator Dismissible Notices.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DupExtraPlugins = window.DupExtraPlugins || (function (document, window, $) {
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*/
|
||||
init: function () {
|
||||
$(app.ready);
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*/
|
||||
ready: function () {
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Dismissible notices events.
|
||||
*/
|
||||
events: function () {
|
||||
$(document).on(
|
||||
'click',
|
||||
'button.dup-extra-plugin-item[data-plugin]',
|
||||
function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ($(this).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
let button = $(this);
|
||||
let status = $(this).closest('.actions').find('.status').eq(0);
|
||||
let statusLabel = status.find('.status-label').eq(0)
|
||||
let statusLabelText = statusLabel.html();
|
||||
let buttonText = $(this).html();
|
||||
|
||||
$(this).addClass('disabled');
|
||||
$(this).html(l10nDupExtraPlugins.loading);
|
||||
|
||||
$.post(
|
||||
duplicator_extra_plugins.ajax_url,
|
||||
{
|
||||
action: 'duplicator_install_extra_plugin',
|
||||
nonce: duplicator_extra_plugins.extra_plugin_install_nonce,
|
||||
plugin: $(this).data('plugin'),
|
||||
}
|
||||
).done(function (response) {
|
||||
console.log(response);
|
||||
if (response.success !== true) {
|
||||
console.log("Plugin installed failed with message: " + response.data.message);
|
||||
Duplicator.addAdminMessage(response.data.message, "error", {hideDelay: 5000});
|
||||
statusLabel.html(l10nDupExtraPlugins.failure);
|
||||
statusLabel.addClass('status-installed');
|
||||
button.fadeOut(300);
|
||||
|
||||
setTimeout(function () {
|
||||
statusLabel.html(statusLabelText);
|
||||
statusLabel.removeClass('status-installed');
|
||||
button.html(buttonText);
|
||||
button.removeClass('disabled');
|
||||
button.fadeIn(100);
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
button.fadeOut(500);
|
||||
status.fadeOut(500);
|
||||
|
||||
button.html(l10nDupExtraPlugins.activated);
|
||||
statusLabel.html(l10nDupExtraPlugins.active);
|
||||
|
||||
statusLabel.removeClass('status-missing');
|
||||
statusLabel.removeClass('status-installed');
|
||||
statusLabel.addClass('status-active');
|
||||
|
||||
button.fadeIn(300);
|
||||
status.fadeIn(300);
|
||||
});
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}(document, window, jQuery));
|
||||
|
||||
// Initialize.
|
||||
DupExtraPlugins.init();
|
||||
@@ -0,0 +1,139 @@
|
||||
jQuery(document).ready(function ($) {
|
||||
$('.duplicator-admin-notice[data-to-dismiss]').each(function () {
|
||||
var notice = $(this);
|
||||
var notice_to_dismiss = notice.data('to-dismiss');
|
||||
|
||||
notice.find('.notice-dismiss').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
$.post(ajaxurl, {
|
||||
action: 'duplicator_admin_notice_to_dismiss',
|
||||
notice: notice_to_dismiss,
|
||||
nonce: dup_global_script_data.nonce_admin_notice_to_dismiss
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('.dup-settings-lite-cta .dismiss').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
action: 'duplicator_settings_callout_cta_dismiss',
|
||||
nonce: dup_global_script_data.nonce_settings_callout_to_dismiss
|
||||
},
|
||||
function (response) {
|
||||
if (response.success) {
|
||||
$('.dup-settings-lite-cta').fadeOut(300);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('#dup-packages-bottom-bar-dismiss').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
action: 'duplicator_packages_bottom_bar_dismiss',
|
||||
nonce: dup_global_script_data.nonce_packages_bottom_bar_dismiss
|
||||
},
|
||||
function (response) {
|
||||
if (response.success) {
|
||||
$('#dup-packages-bottom-bar').closest('tr').fadeOut(300);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('.dup-subscribe-form button').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var button = $('.dup-subscribe-form button');
|
||||
var wrapper = $('.dup-subscribe-form');
|
||||
var input = $('.dup-subscribe-form input[name="email"]');
|
||||
|
||||
button.html(loalizedStrings.subscribing);
|
||||
input.attr('disabled', 'disabled');
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
action: 'duplicator_email_subscribe',
|
||||
email: input.val(),
|
||||
nonce: dup_global_script_data.nonce_email_subscribe
|
||||
},
|
||||
function (response) {
|
||||
if (response.success) {
|
||||
wrapper.fadeOut(300);
|
||||
button.html(l10nDupGlobalScript.subscribed);
|
||||
wrapper.fadeIn(300);
|
||||
|
||||
setTimeout(function () {
|
||||
wrapper.fadeOut(300);
|
||||
}, 3000);
|
||||
} else {
|
||||
console.log(l10nDupGlobalScript.emailFail + response.message);
|
||||
button.html(l10nDupGlobalScript.fail);
|
||||
|
||||
setTimeout(function () {
|
||||
button.html(l10nDupGlobalScript.subscribe);
|
||||
input.removeAttr('disabled');
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
function dupDashboardUpdate() {
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: dup_global_script_data.ajaxurl,
|
||||
dataType: "json",
|
||||
data: {
|
||||
action: 'duplicator_dashboad_widget_info',
|
||||
nonce: dup_global_script_data.nonce_dashboard_widged_info
|
||||
},
|
||||
success: function (result, textStatus, jqXHR) {
|
||||
if (result.success) {
|
||||
$('#duplicator_dashboard_widget .dup-last-backup-info').html(result.data.funcData.lastBackupInfo);
|
||||
|
||||
if (result.data.funcData.isRunning) {
|
||||
$('#duplicator_dashboard_widget #dup-pro-create-new').addClass('disabled');
|
||||
} else {
|
||||
$('#duplicator_dashboard_widget #dup-pro-create-new').removeClass('disabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
setTimeout(
|
||||
function(){
|
||||
dupDashboardUpdate();
|
||||
},
|
||||
5000
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#duplicator_dashboard_widget').length) {
|
||||
dupDashboardUpdate();
|
||||
|
||||
$('#duplicator_dashboard_widget #dup-dash-widget-section-recommended').on('click', function (event) {
|
||||
event.stopPropagation();
|
||||
|
||||
$(this).closest('.dup-section-recommended').fadeOut();
|
||||
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: dup_global_script_data.ajaxurl,
|
||||
dataType: "json",
|
||||
data: {
|
||||
action: 'duplicator_dismiss_recommended_plugin',
|
||||
nonce: dup_global_script_data.nonce_dashboard_widged_dismiss_recommended
|
||||
},
|
||||
success: function (result, textStatus, jqXHR) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
29
html/wp-content/plugins/duplicator/assets/js/handlebars.min.js
vendored
Normal file
29
html/wp-content/plugins/duplicator/assets/js/handlebars.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
html/wp-content/plugins/duplicator/assets/js/index.php
Normal file
3
html/wp-content/plugins/duplicator/assets/js/index.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
//silent
|
||||
495
html/wp-content/plugins/duplicator/assets/js/javascript.php
Normal file
495
html/wp-content/plugins/duplicator/assets/js/javascript.php
Normal file
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
?>
|
||||
<script>
|
||||
/* DESCRIPTION: Methods and Objects in this file are global and common in
|
||||
* nature use this file to place all shared methods and varibles */
|
||||
|
||||
//UNIQUE NAMESPACE
|
||||
Duplicator = new Object();
|
||||
Duplicator.Util = new Object();
|
||||
Duplicator.UI = new Object();
|
||||
Duplicator.Pack = new Object();
|
||||
Duplicator.Settings = new Object();
|
||||
Duplicator.Tools = new Object();
|
||||
Duplicator.Debug = new Object();
|
||||
Duplicator.Help = new Object();
|
||||
|
||||
//GLOBAL CONSTANTS
|
||||
Duplicator.DEBUG_AJAX_RESPONSE = false;
|
||||
Duplicator.AJAX_TIMER = null;
|
||||
|
||||
Duplicator.parseJSON = function(mixData) {
|
||||
try {
|
||||
var parsed = JSON.parse(mixData);
|
||||
return parsed;
|
||||
} catch (e) {
|
||||
console.log("JSON parse failed - 1");
|
||||
console.log(mixData);
|
||||
}
|
||||
|
||||
if (mixData.indexOf('[') > -1 && mixData.indexOf('{') > -1) {
|
||||
if (mixData.indexOf('{') < mixData.indexOf('[')) {
|
||||
var startBracket = '{';
|
||||
var endBracket = '}';
|
||||
} else {
|
||||
var startBracket = '[';
|
||||
var endBracket = ']';
|
||||
}
|
||||
} else if (mixData.indexOf('[') > -1 && mixData.indexOf('{') === -1) {
|
||||
var startBracket = '[';
|
||||
var endBracket = ']';
|
||||
} else {
|
||||
var startBracket = '{';
|
||||
var endBracket = '}';
|
||||
}
|
||||
|
||||
var jsonStartPos = mixData.indexOf(startBracket);
|
||||
var jsonLastPos = mixData.lastIndexOf(endBracket);
|
||||
if (jsonStartPos > -1 && jsonLastPos > -1) {
|
||||
var expectedJsonStr = mixData.slice(jsonStartPos, jsonLastPos + 1);
|
||||
try {
|
||||
var parsed = JSON.parse(expectedJsonStr);
|
||||
return parsed;
|
||||
} catch (e) {
|
||||
console.log("JSON parse failed - 2");
|
||||
console.log(mixData);
|
||||
throw e;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
throw "could not parse the JSON";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* ============================================================================
|
||||
* BASE NAMESPACE: All methods at the top of the Duplicator Namespace
|
||||
* ============================================================================ */
|
||||
|
||||
/* Starts a timer for Ajax calls */
|
||||
Duplicator.StartAjaxTimer = function()
|
||||
{
|
||||
Duplicator.AJAX_TIMER = new Date();
|
||||
};
|
||||
|
||||
/* Ends a timer for Ajax calls */
|
||||
Duplicator.EndAjaxTimer = function()
|
||||
{
|
||||
var endTime = new Date();
|
||||
Duplicator.AJAX_TIMER = (endTime.getTime() - Duplicator.AJAX_TIMER) /1000;
|
||||
};
|
||||
|
||||
/* Reloads the current window
|
||||
* @param data An xhr object */
|
||||
Duplicator.ReloadWindow = function(data)
|
||||
{
|
||||
if (Duplicator.DEBUG_AJAX_RESPONSE) {
|
||||
Duplicator.Pack.ShowError('debug on', data);
|
||||
} else {
|
||||
window.location.reload(true);
|
||||
}
|
||||
};
|
||||
|
||||
//Basic Util Methods here:
|
||||
Duplicator.OpenLogWindow = function(target)
|
||||
{
|
||||
var target = "log-win" || null;
|
||||
if (target != null) {
|
||||
window.open('?page=duplicator-tools&tab=diagnostics§ion=log', 'log-win');
|
||||
} else {
|
||||
window.open('<?php echo esc_js(DUP_Settings::getSsdirUrl()); ?>' + '/' + log)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/* ============================================================================
|
||||
* UI NAMESPACE: All methods at the top of the Duplicator Namespace
|
||||
* ============================================================================ */
|
||||
|
||||
/* Saves the state of a UI element */
|
||||
Duplicator.UI.SaveViewState = function (key, value)
|
||||
{
|
||||
if (key != undefined && value != undefined ) {
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
dataType: "text",
|
||||
data: {
|
||||
action : 'DUP_CTRL_UI_SaveViewState',
|
||||
key: key,
|
||||
value: value,
|
||||
nonce: '<?php echo wp_create_nonce('DUP_CTRL_UI_SaveViewState'); ?>'
|
||||
},
|
||||
success: function(respData) {
|
||||
try {
|
||||
var data = Duplicator.parseJSON(respData);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
console.error('JSON parse failed for response data: ' + respData);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function(data) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* Saves multiple states of a UI element */
|
||||
Duplicator.UI.SaveMulViewStates = function (states)
|
||||
{
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
dataType: "text",
|
||||
data: {
|
||||
action : 'DUP_CTRL_UI_SaveViewState',
|
||||
states: states,
|
||||
nonce: '<?php echo wp_create_nonce('DUP_CTRL_UI_SaveViewState'); ?>'
|
||||
},
|
||||
success: function(respData) {
|
||||
try {
|
||||
var data = Duplicator.parseJSON(respData);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
console.error('JSON parse failed for response data: ' + respData);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function(data) {}
|
||||
});
|
||||
}
|
||||
|
||||
/* Animates the progress bar */
|
||||
Duplicator.UI.AnimateProgressBar = function(id)
|
||||
{
|
||||
//Create Progress Bar
|
||||
var $mainbar = jQuery("#" + id);
|
||||
$mainbar.progressbar({ value: 100 });
|
||||
$mainbar.height(25);
|
||||
runAnimation($mainbar);
|
||||
|
||||
function runAnimation($pb) {
|
||||
$pb.css({ "padding-left": "0%", "padding-right": "90%" });
|
||||
$pb.progressbar("option", "value", 100);
|
||||
$pb.animate({ paddingLeft: "90%", paddingRight: "0%" }, 3000, "linear", function () { runAnimation($pb); });
|
||||
}
|
||||
}
|
||||
|
||||
Duplicator.UI.IsSaveViewState = true;
|
||||
/* Toggle MetaBoxes */
|
||||
Duplicator.UI.ToggleMetaBox = function()
|
||||
{
|
||||
var $title = jQuery(this);
|
||||
var $panel = $title.parent().find('.dup-box-panel');
|
||||
var $arrow = $title.parent().find('.dup-box-arrow i');
|
||||
var key = $panel.attr('id');
|
||||
var value = $panel.is(":visible") ? 0 : 1;
|
||||
$panel.toggle();
|
||||
if (Duplicator.UI.IsSaveViewState)
|
||||
Duplicator.UI.SaveViewState(key, value);
|
||||
(value)
|
||||
? $arrow.removeClass().addClass('fa fa-caret-up')
|
||||
: $arrow.removeClass().addClass('fa fa-caret-down');
|
||||
|
||||
}
|
||||
|
||||
Duplicator.UI.readonly = function(item)
|
||||
{
|
||||
jQuery(item).attr('readonly', 'true').css({color:'#999'});
|
||||
}
|
||||
|
||||
Duplicator.UI.disable = function(item)
|
||||
{
|
||||
jQuery(item).attr('disabled', 'true').css({color:'#999'});
|
||||
}
|
||||
|
||||
Duplicator.UI.enable = function(item)
|
||||
{
|
||||
jQuery(item).removeAttr('disabled').css({color:'#000'});
|
||||
jQuery(item).removeAttr('readonly').css({color:'#000'});
|
||||
}
|
||||
|
||||
//Init
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
|
||||
Duplicator.UI.loadQtip = function()
|
||||
{
|
||||
//Look for tooltip data
|
||||
$('[data-tooltip!=""]').qtip({
|
||||
content: {
|
||||
attr: 'data-tooltip',
|
||||
title: function() {
|
||||
if ($(this)[0].hasAttribute("data-tooltip-title")) {
|
||||
return $(this).data('tooltip-title');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
style: {
|
||||
classes: 'qtip-light qtip-rounded qtip-shadow',
|
||||
width: 500
|
||||
},
|
||||
position: {
|
||||
my: 'top left',
|
||||
at: 'bottom center'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Duplicator.UI.loadSimpeQtip = function()
|
||||
{
|
||||
//Look for tooltip data
|
||||
$('[data-simpletip!=""]').qtip({
|
||||
content: {
|
||||
attr: 'data-simpletip'
|
||||
},
|
||||
style: {
|
||||
classes: 'qtip-light qtip-rounded qtip-shadow'
|
||||
},
|
||||
position: {
|
||||
my: 'top left',
|
||||
at: 'bottom center'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Duplicator.UI.Copytext = function () {
|
||||
$('[data-dup-copy-text]').each(function () {
|
||||
$(this).click(function () {
|
||||
var elem = $(this);
|
||||
var message = '';
|
||||
var textToCopy = elem.data('dup-copy-text');
|
||||
var tmpArea = jQuery("<textarea></textarea>").css({
|
||||
position: 'absolute',
|
||||
top: '-10000px'
|
||||
}).text(textToCopy).appendTo( "body" );
|
||||
tmpArea.select();
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
message = successful ? '<?php echo esc_html_e('Copied: ', 'duplicator'); ?>' + textToCopy : '<?php echo esc_html_e('unable to copy'); ?>';
|
||||
} catch (err) {
|
||||
message = '<?php echo esc_html_e('unable to copy', 'duplicator'); ?>';
|
||||
}
|
||||
elem.qtip('option', 'content.text', message).qtip('show');
|
||||
setTimeout(function(){
|
||||
elem.qtip('option', 'content.text', '<?php esc_html_e('Copy to Clipboard!', 'duplicator'); ?>');
|
||||
}, 2000);
|
||||
}).qtip({
|
||||
content: {
|
||||
text: '<?php esc_html_e('Copy to Clipboard!', 'duplicator'); ?>'
|
||||
},
|
||||
style: {
|
||||
classes: 'qtip-light qtip-rounded qtip-shadow'
|
||||
},
|
||||
position: {
|
||||
my: 'top left',
|
||||
at: 'bottom center'
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//INIT: Tabs
|
||||
$("div[data-dup-tabs='true']").each(function () {
|
||||
|
||||
//Load Tab Setup
|
||||
var $root = $(this);
|
||||
var $lblRoot = $root.find('ul:first-child')
|
||||
var $lblKids = $lblRoot.children('li');
|
||||
var $pnls = $root.children('div');
|
||||
|
||||
//Apply Styles
|
||||
$root.addClass('categorydiv');
|
||||
$lblRoot.addClass('category-tabs');
|
||||
$pnls.addClass('tabs-panel').css('display', 'none');
|
||||
$lblKids.eq(0).addClass('tabs').css('font-weight', 'bold');
|
||||
$pnls.eq(0).show();
|
||||
|
||||
//Attach Events
|
||||
$lblKids.click(function(evt)
|
||||
{
|
||||
var $lbls = $(evt.target).parent().children('li');
|
||||
var $pnls = $(evt.target).parent().parent().children('div');
|
||||
var index = ($(evt.target).index());
|
||||
|
||||
$lbls.removeClass('tabs').css('font-weight', 'normal');
|
||||
$lbls.eq(index).addClass('tabs').css('font-weight', 'bold');
|
||||
$pnls.hide();
|
||||
$pnls.eq(index).show();
|
||||
});
|
||||
});
|
||||
|
||||
//Init: Toggle MetaBoxes
|
||||
$('div.dup-box div.dup-box-title').each(function() {
|
||||
var $title = $(this);
|
||||
var $panel = $title.parent().find('.dup-box-panel');
|
||||
var $arrow = $title.find('.dup-box-arrow');
|
||||
$title.click(Duplicator.UI.ToggleMetaBox);
|
||||
($panel.is(":visible"))
|
||||
? $arrow.html('<i class="fa fa-caret-up"></i>')
|
||||
: $arrow.html('<i class="fa fa-caret-down"></i>');
|
||||
});
|
||||
|
||||
|
||||
Duplicator.UI.loadQtip();
|
||||
Duplicator.UI.loadSimpeQtip();
|
||||
Duplicator.UI.Copytext();
|
||||
|
||||
//HANDLEBARS HELPERS
|
||||
if (typeof(Handlebars) != "undefined"){
|
||||
|
||||
function _handleBarscheckCondition(v1, operator, v2) {
|
||||
switch(operator) {
|
||||
case '==':
|
||||
return (v1 == v2);
|
||||
case '===':
|
||||
return (v1 === v2);
|
||||
case '!==':
|
||||
return (v1 !== v2);
|
||||
case '<':
|
||||
return (v1 < v2);
|
||||
case '<=':
|
||||
return (v1 <= v2);
|
||||
case '>':
|
||||
return (v1 > v2);
|
||||
case '>=':
|
||||
return (v1 >= v2);
|
||||
case '&&':
|
||||
return (v1 && v2);
|
||||
case '||':
|
||||
return (v1 || v2);
|
||||
case 'obj||':
|
||||
v1 = typeof(v1) == 'object' ? v1.length : v1;
|
||||
v2 = typeof(v2) == 'object' ? v2.length : v2;
|
||||
return (v1 !=0 || v2 != 0);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
|
||||
return _handleBarscheckCondition(v1, operator, v2)
|
||||
? options.fn(this)
|
||||
: options.inverse(this);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('if_eq', function(a, b, opts) { return (a == b) ? opts.fn(this) : opts.inverse(this);});
|
||||
Handlebars.registerHelper('if_neq', function(a, b, opts) { return (a != b) ? opts.fn(this) : opts.inverse(this);});
|
||||
}
|
||||
|
||||
//Prevent notice boxes from flashing as its re-positioned in DOM
|
||||
$('div.dup-wpnotice-box').show(300);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string message // html message conent
|
||||
* @param string errLevel // notice warning error
|
||||
* @param function updateCallback // called after message content is updated
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
Duplicator.addAdminMessage = function (message, errLevel, options) {
|
||||
let settings = $.extend({}, {
|
||||
'isDismissible': true,
|
||||
'hideDelay': 0, // 0 no hide or millisec
|
||||
'updateCallback': false
|
||||
}, options);
|
||||
|
||||
var classErrLevel = 'notice';
|
||||
switch (errLevel) {
|
||||
case 'error':
|
||||
classErrLevel = 'notice-error';
|
||||
break;
|
||||
case 'warning':
|
||||
classErrLevel = 'update-nag';
|
||||
break;
|
||||
case 'notice':
|
||||
default:
|
||||
classErrLevel = 'updated notice-success';
|
||||
break;
|
||||
}
|
||||
|
||||
var noticeCLasses = 'duplicator-admin-notice notice ' + classErrLevel + ' no_display';
|
||||
if (settings.isDismissible) {
|
||||
noticeCLasses += ' is-dismissible';
|
||||
}
|
||||
|
||||
var msgNode = $('<div class="' + noticeCLasses + '">' +
|
||||
'<div class="margin-top-1 margin-bottom-1 msg-content">' + message + '</div>' +
|
||||
'</div>');
|
||||
var dismissButton = $('<button type="button" class="notice-dismiss">' +
|
||||
'<span class="screen-reader-text">Dismiss this notice.</span>' +
|
||||
'</button>');
|
||||
|
||||
var anchor = $("#wpcontent");
|
||||
if (anchor.find('.wrap').length) {
|
||||
anchor = anchor.find('.wrap').first();
|
||||
}
|
||||
|
||||
if (anchor.find('h1').length) {
|
||||
anchor = anchor.find('h1').first();
|
||||
msgNode.insertAfter(anchor);
|
||||
} else {
|
||||
msgNode.prependTo(anchor);
|
||||
}
|
||||
|
||||
if (settings.isDismissible) {
|
||||
dismissButton.appendTo(msgNode).click(function () {
|
||||
dismissButton.closest('.is-dismissible').fadeOut("slow", function () {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof settings.updateCallback === "function") {
|
||||
settings.updateCallback(msgNode);
|
||||
}
|
||||
|
||||
$("body, html").animate({scrollTop: 0}, 500);
|
||||
$(msgNode).css('display', 'none').removeClass("no_display").fadeIn("slow", function () {
|
||||
if (settings.hideDelay > 0) {
|
||||
setTimeout(function () {
|
||||
dismissButton.closest('.is-dismissible').fadeOut("slow", function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}, settings.hideDelay);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
$('.duplicator-message .notice-dismiss, .duplicator-message .duplicator-notice-dismiss, .duplicator-message .duplicator-notice-rate-now')
|
||||
.on('click', function (event) {
|
||||
if ('button button-primary duplicator-notice-rate-now' !== $(event.target).attr('class')) {
|
||||
event.preventDefault();
|
||||
}
|
||||
$.post(ajaxurl, {
|
||||
action: 'duplicator_set_admin_notice_viewed',
|
||||
notice_id: $(this).closest('.duplicator-message-dismissed').data('notice_id'),
|
||||
nonce: '<?php echo wp_create_nonce('duplicator_set_admin_notice_viewed'); ?>'
|
||||
});
|
||||
var $wrapperElm = $(this).closest('.duplicator-message-dismissed');
|
||||
$wrapperElm.fadeTo(100, 0, function () {
|
||||
$wrapperElm.slideUp(100, function () {
|
||||
$wrapperElm.remove();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#screen-meta-links, #screen-meta').prependTo('#dup-meta-screen');
|
||||
$('#screen-meta-links').show();
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php
|
||||
require_once(DUPLICATOR_PLUGIN_PATH . '/assets/js/duplicator/dup.util.php');
|
||||
?>
|
||||
<script>
|
||||
<?php
|
||||
require_once(DUPLICATOR_PLUGIN_PATH . '/assets/js/modal-box.js');
|
||||
?>
|
||||
</script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
//silent
|
||||
3
html/wp-content/plugins/duplicator/assets/js/jquery.qtip/jquery.qtip.min.css
vendored
Normal file
3
html/wp-content/plugins/duplicator/assets/js/jquery.qtip/jquery.qtip.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
5
html/wp-content/plugins/duplicator/assets/js/jquery.qtip/jquery.qtip.min.js
vendored
Normal file
5
html/wp-content/plugins/duplicator/assets/js/jquery.qtip/jquery.qtip.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
184
html/wp-content/plugins/duplicator/assets/js/modal-box.js
Normal file
184
html/wp-content/plugins/duplicator/assets/js/modal-box.js
Normal file
@@ -0,0 +1,184 @@
|
||||
/*! Duplicator iframe modal box */
|
||||
|
||||
class DuplicatorModalBox {
|
||||
#url;
|
||||
#modal;
|
||||
#iframe;
|
||||
#htmlContent;
|
||||
#canClose;
|
||||
#closeButton;
|
||||
#openCallack;
|
||||
|
||||
constructor(options = {}) {
|
||||
if (!options.url && !options.htmlContent) {
|
||||
throw 'DuplicatorModalBox: url or htmlContent option is required';
|
||||
}
|
||||
|
||||
if (options.url && options.htmlContent) {
|
||||
throw 'DuplicatorModalBox: url and htmlContent options cannot be used together';
|
||||
}
|
||||
|
||||
if (options.url) {
|
||||
this.#url = options.url;
|
||||
} else {
|
||||
this.#htmlContent = options.htmlContent;
|
||||
}
|
||||
|
||||
if (options.openCallback && typeof options.openCallback === 'function') {
|
||||
this.#openCallack = options.openCallback;
|
||||
} else {
|
||||
this.#openCallack = null;
|
||||
}
|
||||
|
||||
this.#modal = null;
|
||||
this.#iframe = null;
|
||||
this.#canClose = true;
|
||||
this.#closeButton = null;
|
||||
}
|
||||
|
||||
open() {
|
||||
// Create modal element
|
||||
this.#modal = document.createElement('div');
|
||||
this.#modal.classList.add('dup-modal-wrapper');
|
||||
|
||||
// Add modal styles
|
||||
this.#addModalStyles();
|
||||
|
||||
// Create close button
|
||||
this.#closeButton = document.createElement('div');
|
||||
this.#closeButton.classList.add('dup-modal-close-button');
|
||||
this.#closeButton.innerHTML = '<i class="fa-regular fa-circle-xmark"></i>';
|
||||
|
||||
// Add event listener to close button
|
||||
this.#closeButton.addEventListener('click', () => {
|
||||
this.close();
|
||||
});
|
||||
|
||||
// Add close button to modal
|
||||
this.#modal.appendChild(this.#closeButton);
|
||||
|
||||
if (this.#url) {
|
||||
this.#insertContentAsIframe();
|
||||
} else {
|
||||
this.#insertContentAsHtml();
|
||||
}
|
||||
|
||||
// Set overflow property of body to hidden
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
// Add opacity animation
|
||||
this.#modal.animate([
|
||||
{ opacity: '0' },
|
||||
{ opacity: '1' }
|
||||
], {
|
||||
duration: 500,
|
||||
iterations: 1,
|
||||
});
|
||||
|
||||
// Add modal to document
|
||||
document.body.appendChild(this.#modal);
|
||||
}
|
||||
|
||||
close() {
|
||||
if (!this.#canClose) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove modal from document
|
||||
document.body.removeChild(this.#modal);
|
||||
// Set overflow property of body to hidden
|
||||
document.body.style.overflow = 'auto';
|
||||
|
||||
// Reset modal and iframe variables
|
||||
this.#modal = null;
|
||||
this.#iframe = null;
|
||||
}
|
||||
|
||||
enableClose() {
|
||||
this.#canClose = true;
|
||||
this.#closeButton.removeAttribute('disabled');
|
||||
}
|
||||
|
||||
disableClose() {
|
||||
this.#canClose = false;
|
||||
this.#closeButton.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
|
||||
#insertContentAsHtml() {
|
||||
let content = document.createElement('div');
|
||||
content.classList.add('dup-modal-content');
|
||||
content.innerHTML = this.#htmlContent;
|
||||
|
||||
// Add content to modal
|
||||
this.#modal.appendChild(content);
|
||||
|
||||
if (typeof this.#openCallack == 'function') {
|
||||
this.#openCallack(content, this);
|
||||
}
|
||||
}
|
||||
|
||||
#insertContentAsIframe() {
|
||||
// Create iframe element
|
||||
this.#iframe = document.createElement('iframe');
|
||||
this.#iframe.classList.add('dup-modal-iframe');
|
||||
|
||||
// Add open callback function
|
||||
if(typeof this.#openCallack == 'function') {
|
||||
let openCallack = this.#openCallack;
|
||||
let iframe = this.#iframe;
|
||||
let modalObj = this;
|
||||
this.#iframe.onload = function() {
|
||||
openCallack(iframe, modalObj);
|
||||
};
|
||||
}
|
||||
|
||||
this.#iframe.src = this.#url;
|
||||
this.#iframe.setAttribute('frameborder', '0');
|
||||
this.#iframe.setAttribute('allowfullscreen', '');
|
||||
|
||||
// Add iframe to modal
|
||||
this.#modal.appendChild(this.#iframe);
|
||||
}
|
||||
|
||||
#addModalStyles() {
|
||||
const style = document.createElement('style');
|
||||
style.innerHTML = `
|
||||
.dup-modal-wrapper {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: rgba(230, 230, 230, 0.9);
|
||||
z-index: 1000005;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dup-modal-iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.dup-modal-close-button {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
font-size: 23px;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
line-height: 0;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.dup-modal-close-button[disabled] {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
/**
|
||||
* Duplicator Admin Notifications.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DupAdminNotifications = window.DupAdminNotifications || (function (document, window, $) {
|
||||
|
||||
/**
|
||||
* Elements holder.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
|
||||
$notifications: $('#dup-notifications'),
|
||||
$nextButton: $('#dup-notifications .navigation .next'),
|
||||
$prevButton: $('#dup-notifications .navigation .prev'),
|
||||
$adminBarCounter: $('#wp-admin-bar-dup-menu .dup-menu-notification-counter'),
|
||||
$adminBarMenuItem: $('#wp-admin-bar-dup-notifications'),
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
init: function () {
|
||||
|
||||
$(app.ready);
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
ready: function () {
|
||||
|
||||
app.updateNavigation();
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Register JS events.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
events: function () {
|
||||
|
||||
el.$notifications
|
||||
.on('click', '.dismiss', app.dismiss)
|
||||
.on('click', '.next', app.navNext)
|
||||
.on('click', '.prev', app.navPrev);
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Dismiss notification button.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
dismiss: function (event) {
|
||||
|
||||
if (el.$currentMessage.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update counter.
|
||||
var count = parseInt(el.$adminBarCounter.text(), 10);
|
||||
if (count > 1) {
|
||||
--count;
|
||||
el.$adminBarCounter.html(count);
|
||||
} else {
|
||||
el.$adminBarCounter.remove();
|
||||
el.$adminBarMenuItem.remove();
|
||||
}
|
||||
|
||||
// Remove notification.
|
||||
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage,
|
||||
messageId = el.$currentMessage.data('message-id');
|
||||
|
||||
if ($nextMessage.length === 0) {
|
||||
el.$notifications.fadeOut(300);
|
||||
} else {
|
||||
el.$currentMessage.remove();
|
||||
$nextMessage.addClass('current');
|
||||
app.updateNavigation();
|
||||
}
|
||||
|
||||
// AJAX call - update option.
|
||||
var data = {
|
||||
action: 'duplicator_notification_dismiss',
|
||||
nonce: dup_admin_notifications.nonce,
|
||||
id: messageId,
|
||||
};
|
||||
|
||||
$.post(dup_admin_notifications.ajax_url, data, function (res) {
|
||||
|
||||
if (!res.success) {
|
||||
console.log(res);
|
||||
}
|
||||
}).fail(function (xhr, textStatus, e) {
|
||||
|
||||
console.log(xhr.responseText);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Next notification button.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navNext: function (event) {
|
||||
|
||||
if (el.$nextButton.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass('current');
|
||||
el.$nextMessage.addClass('current');
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Previous notification button.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navPrev: function (event) {
|
||||
|
||||
if (el.$prevButton.hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass('current');
|
||||
el.$prevMessage.addClass('current');
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update navigation buttons.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
updateNavigation: function () {
|
||||
|
||||
if (el.$notifications.find('.dup-notifications-message.current').length === 0) {
|
||||
el.$notifications.find('.dup-notifications-message:first-child').addClass('current');
|
||||
}
|
||||
|
||||
el.$currentMessage = el.$notifications.find('.dup-notifications-message.current');
|
||||
el.$nextMessage = el.$currentMessage.next('.dup-notifications-message');
|
||||
el.$prevMessage = el.$currentMessage.prev('.dup-notifications-message');
|
||||
|
||||
if (el.$nextMessage.length === 0) {
|
||||
el.$nextButton.addClass('disabled');
|
||||
} else {
|
||||
el.$nextButton.removeClass('disabled');
|
||||
}
|
||||
|
||||
if (el.$prevMessage.length === 0) {
|
||||
el.$prevButton.addClass('disabled');
|
||||
} else {
|
||||
el.$prevButton.removeClass('disabled');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}(document, window, jQuery));
|
||||
|
||||
// Initialize.
|
||||
DupAdminNotifications.init();
|
||||
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* Duplicator Dismissible Notices.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DupAdminNotices = window.DupAdminNotices || (function (document, window, $) {
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*/
|
||||
init: function () {
|
||||
|
||||
$(app.ready);
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*/
|
||||
ready: function () {
|
||||
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Dismissible notices events.
|
||||
*/
|
||||
events: function () {
|
||||
$(document).on(
|
||||
'click',
|
||||
'.dup-notice .notice-dismiss, .dup-notice .dup-notice-dismiss',
|
||||
app.dismissNotice
|
||||
);
|
||||
|
||||
$(document).on(
|
||||
'click',
|
||||
'.dup-notice .dup-multi-notice a[data-step]',
|
||||
function (e) {
|
||||
e.preventDefault();
|
||||
var target = $(this).attr('data-step');
|
||||
console.log(target)
|
||||
if (target) {
|
||||
var notice = $(this).closest('.dup-multi-notice');
|
||||
var review_step = notice.find('.dup-multi-notice-step-' + target);
|
||||
if (review_step.length > 0) {
|
||||
notice.find('.dup-multi-notice-step:visible').fadeOut(function () {
|
||||
review_step.fadeIn();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Dismiss notice event handler.
|
||||
*
|
||||
* @param {object} e Event object.
|
||||
* */
|
||||
dismissNotice: function (e) {
|
||||
|
||||
$.post(dup_admin_notices.ajax_url, {
|
||||
action: 'dup_notice_dismiss',
|
||||
nonce: dup_admin_notices.nonce,
|
||||
id: ($(this).closest('.dup-notice').attr('id') || '').replace('dup-notice-', ''),
|
||||
});
|
||||
|
||||
$(this).closest('.dup-notice').fadeOut();
|
||||
}
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}(document, window, jQuery));
|
||||
|
||||
// Initialize.
|
||||
DupAdminNotices.init();
|
||||
107
html/wp-content/plugins/duplicator/assets/js/onboarding.js
Normal file
107
html/wp-content/plugins/duplicator/assets/js/onboarding.js
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Duplicator Dismissible Notices.
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var DupOnboarding = window.DupOnboarding || (function (document, window, $) {
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*/
|
||||
init: function () {
|
||||
$(app.ready);
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*/
|
||||
ready: function () {
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Dismissible notices events.
|
||||
*/
|
||||
events: function () {
|
||||
$('[data-tooltip!=""]').qtip({
|
||||
content: {
|
||||
attr: 'data-tooltip',
|
||||
title: function() {
|
||||
if ($(this)[0].hasAttribute("data-tooltip-title")) {
|
||||
return $(this).data('tooltip-title');
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
style: {
|
||||
classes: 'qtip-light qtip-rounded qtip-shadow',
|
||||
width: 500
|
||||
},
|
||||
position: {
|
||||
my: 'top left',
|
||||
at: 'bottom center'
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '#enable-usage-stats-btn', function () {
|
||||
let btn = $(this);
|
||||
$.ajax(
|
||||
{
|
||||
url: duplicator_onboarding.ajax_url,
|
||||
type: "POST",
|
||||
data: {
|
||||
action: 'duplicator_enable_usage_stats',
|
||||
nonce: duplicator_onboarding.nonce,
|
||||
email: duplicator_onboarding.email,
|
||||
},
|
||||
beforeSend: function () {
|
||||
// Show spinner
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-spinner fa-spin"></i>');
|
||||
},
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-check"></i>');
|
||||
//wait to display checkmark before redirecting
|
||||
setTimeout(function () {
|
||||
window.location.href = duplicator_onboarding.redirect_url;
|
||||
}, 1000);
|
||||
} else {
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-times"></i>');
|
||||
//wait to display X (fail) sign before reverting back to arrow
|
||||
setTimeout(function () {
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-arrow-right"></i>');
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
fail: function () {
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-times"></i>');
|
||||
//wait to display X (fail) sign before reverting back to arrow
|
||||
setTimeout(function () {
|
||||
btn.find('i.fas').replaceWith('<i class="fas fa-arrow-right"></i>');
|
||||
}, 1000);
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on( 'click', '.terms-list-toggle', function () {
|
||||
$(this).next('.terms-list').slideToggle();
|
||||
$(this).find('i.fas').toggleClass('fa-chevron-right fa-chevron-down');
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}(document, window, jQuery));
|
||||
|
||||
// Initialize.
|
||||
DupOnboarding.init();
|
||||
@@ -0,0 +1,40 @@
|
||||
// Endpoint to connect to Duplicator Pro
|
||||
var remoteEndpoint = "https://connect.duplicator.com/get-remote-url";
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
if ($('#dup-settings-connect-btn').length) {
|
||||
$('#dup-settings-connect-btn').on('click', function (event) {
|
||||
event.stopPropagation();
|
||||
|
||||
// Generate OTH for secure redirect
|
||||
Duplicator.Util.ajaxWrapper(
|
||||
{
|
||||
action: 'duplicator_generate_connect_oth',
|
||||
nonce: dup_one_click_upgrade_script_data.nonce_generate_connect_oth
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
var redirectUrl = remoteEndpoint + "?" + new URLSearchParams({
|
||||
"oth": funcData.oth,
|
||||
"homeurl": window.location.origin,
|
||||
"redirect": funcData.redirect_url,
|
||||
"origin": window.location.href,
|
||||
"php_version": funcData.php_version,
|
||||
"wp_version": funcData.wp_version
|
||||
}).toString();
|
||||
|
||||
window.location.href = redirectUrl;
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
let errorMsg = `<p>
|
||||
<b>${dup_one_click_upgrade_script_data.fail_notice_title}</b>
|
||||
</p>
|
||||
<p>
|
||||
${dup_one_click_upgrade_script_data.fail_notice_message_label} ${data.message}<br>
|
||||
${dup_one_click_upgrade_script_data.fail_notice_suggestion}
|
||||
</p>`;
|
||||
Duplicator.addAdminMessage(errorMsg, 'error');
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
11
html/wp-content/plugins/duplicator/assets/js/parsley.min.js
vendored
Normal file
11
html/wp-content/plugins/duplicator/assets/js/parsley.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
1961
html/wp-content/plugins/duplicator/assets/js/popper/popper.js
Normal file
1961
html/wp-content/plugins/duplicator/assets/js/popper/popper.js
Normal file
File diff suppressed because it is too large
Load Diff
5
html/wp-content/plugins/duplicator/assets/js/popper/popper.min.js
vendored
Normal file
5
html/wp-content/plugins/duplicator/assets/js/popper/popper.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,91 @@
|
||||
/*! ================================================
|
||||
* DUPLICATOR TIPPY STYLE
|
||||
* Copyright:Snap Creek LLC 2015-2021
|
||||
* ================================================ */
|
||||
|
||||
.tippy-box[data-theme~='duplicator'],
|
||||
.tippy-box[data-theme~='duplicator-filled'] {
|
||||
background-color: white;
|
||||
color: black;
|
||||
font-size: 12px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] .tippy-content,
|
||||
.tippy-box[data-theme~='duplicator-filled'] .tippy-content {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] h3,
|
||||
.tippy-box[data-theme~='duplicator-filled'] h3 {
|
||||
display: block;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
padding: 5px;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] .dup-tippy-content,
|
||||
.tippy-box[data-theme~='duplicator-filled'] .dup-tippy-content {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] .dup-tippy-content *:first-child,
|
||||
.tippy-box[data-theme~='duplicator-filled'] .dup-tippy-content *:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] .dup-tippy-content *:last-child,
|
||||
.tippy-box[data-theme~='duplicator-filled'] .dup-tippy-content *:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tippy-box[data-placement^='top']>.tippy-arrow::before {
|
||||
bottom: -9px;
|
||||
}
|
||||
|
||||
.tippy-box[data-placement^='bottom']>.tippy-arrow::before {
|
||||
top: -9px;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'],
|
||||
.tippy-box[data-theme~='duplicator-filled'] {
|
||||
border-color: #13659C;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'] h3,
|
||||
.tippy-box[data-theme~='duplicato-filled'] h3 {
|
||||
background-color: #13659C;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator-filled'] .tippy-content {
|
||||
background-color: #13659C;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'][data-placement^='top']>.tippy-arrow::before,
|
||||
.tippy-box[data-theme~='duplicator-filled'][data-placement^='top']>.tippy-arrow::before {
|
||||
border-top-color: #13659C;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'][data-placement^='bottom']>.tippy-arrow::before,
|
||||
.tippy-box[data-theme~='duplicator-filled'][data-placement^='bottom']>.tippy-arrow::before {
|
||||
border-bottom-color: #13659C;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'][data-placement^='left']>.tippy-arrow::before,
|
||||
.tippy-box[data-theme~='duplicator-filled'][data-placement^='left']>.tippy-arrow::before {
|
||||
border-left-color: #13659C;
|
||||
}
|
||||
|
||||
.tippy-box[data-theme~='duplicator'][data-placement^='right']>.tippy-arrow::before,
|
||||
.tippy-box[data-theme~='duplicator-filled'][data-placement^='right']>.tippy-arrow::before {
|
||||
border-right-color: #13659C;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
//silent
|
||||
File diff suppressed because it is too large
Load Diff
1
html/wp-content/plugins/duplicator/assets/js/tippy/tippy-bundle.umd.min.js
vendored
Normal file
1
html/wp-content/plugins/duplicator/assets/js/tippy/tippy-bundle.umd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1}
|
||||
Reference in New Issue
Block a user