first commit

This commit is contained in:
Roman Pyrih
2026-04-21 15:48:41 +02:00
commit 7483681901
10216 changed files with 3236626 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Libs\WpUtils\WpDbUtils;
use Duplicator\Models\TemplateEntity;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var bool $isTemplateEdit
*/
$isTemplateEdit = $tplData['isTemplateEdit'];
/** @var ?TemplateEntity */
$template = ($tplData['template'] ?? null);
$dbbuild_mode = WpDbUtils::getBuildMode();
if ($dbbuild_mode != 'MYSQLDUMP') {
return;
}
?>
<div class="dup-form-item margin-top-1">
<label class="lbl-larger">
<?php esc_html_e("Compatibility Mode", 'duplicator-pro') ?>:
<?php
$tipCont = __(
'This is an advanced database backwards compatibility feature that should ONLY be used if having problems installing Backups.
If the database server version is lower than the version where the Backup was built then these options may help generate
a script that is more compliant with the older database server. It is recommended to try each option separately starting with mysql40.',
'duplicator-pro'
);
?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php echo esc_attr($tipCont); ?>"
aria-expanded="false"></i>
</label>
<div>
<?php if ($isTemplateEdit) { ?>
<i>
<?php
printf(
esc_html_x(
'This option is not available as a template setting.
It can only be used when creating a new Backup. Please see the full %1$sFAQ details%2$s',
'1 and 2 are opening and closing anchor/link tags',
'duplicator-pro'
),
'<a href="' . esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-fix-database-write-issues') . '" target="_blank">',
'</a>'
);
?>
</i>
<?php } else { ?>
<div class="dup-form-horiz-opts">
<span>
<input
type="checkbox"
name="dbcompat[]"
id="dbcompat-mysql40"
class="margin-0"
value="mysql40">
<label for="dbcompat-mysql40"><?php esc_html_e("mysql40", 'duplicator-pro') ?></label>
</span>
<span>
<input
type="checkbox"
name="dbcompat[]"
id="dbcompat-no_table_options"
value="no_table_options"
class="margin-0">
<label for="dbcompat-no_table_options"><?php esc_html_e("no_table_options", 'duplicator-pro') ?></label>
</span>
<span>
<input
type="checkbox"
name="dbcompat[]"
id="dbcompat-no_key_options"
value="no_key_options"
class="margin-0">
<label for="dbcompat-no_key_options"><?php esc_html_e("no_key_options", 'duplicator-pro') ?></label>
</span>
<span>
<input
type="checkbox"
name="dbcompat[]"
id="dbcompat-no_field_options"
value="no_field_options"
class="margin-0">
<label for="dbcompat-no_field_options"><?php esc_html_e("no_field_options", 'duplicator-pro') ?></label>
</span>
</div>
<div class="dup-tabs-opts-help">
<?php esc_html_e("Compatibility mode settings are not persistent. They must be enabled with every new build.", 'duplicator-pro'); ?>&nbsp;
<a href="<?php echo esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-fix-database-write-issues'); ?>" target="_blank">
[<?php esc_html_e('full overview', 'duplicator-pro'); ?>]
</a>
</div>
<?php } ?>
</div>
</div>

View File

@@ -0,0 +1,463 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Libs\Snap\SnapIO;
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Libs\WpUtils\WpArchiveUtils;
use Duplicator\Package\Create\BuildComponents;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
$activeComponents = $tplData['components'] ?? [];
$archiveFilterOn = $tplData['archiveFilterOn'] ?? false;
$archiveFilterDirs = $tplData['archiveFilterDirs'] ?? '';
$archiveFilterFiles = $tplData['archiveFilterFiles'] ?? '';
$archiveFilterPaths = strlen($archiveFilterDirs) > 0 && strlen($archiveFilterFiles) > 0
? $archiveFilterDirs . ';' . $archiveFilterFiles : $archiveFilterDirs . $archiveFilterFiles;
$archiveFilterPaths = str_replace(';', ";\n", $archiveFilterPaths);
$archiveFilterExtensions = $tplData['archiveFilterExtensions'] ?? '';
$licenseDisabledClass = License::can(License::CAPABILITY_PACKAGE_COMPONENTS_PLUS) ? '' : 'disabled';
$pathFiltersTooltip = __('File filters allow you to exclude files and folders from the Backup.', 'duplicator-pro') . ' ' .
__('To enable path and extension filters check the checkbox.', 'duplicator-pro') . ' ' .
__('Enter the full path of the files and folders you want to exclude from the backup as a semicolon (;) seperated list.', 'duplicator-pro');
$extensionFilterTooltip = __(
"File extension filters allow you to exclude files with certain file extensions from the backup e.g. zip;rar;pdf etc.",
'duplicator-pro'
) . ' ' . __("Enter the file extensions you want to exclude from the backup as a semicolon (;) seperated list.", 'duplicator-pro');
$presetsTooltip = __(
'Presets allow you to quickly include/exclude differents part of your WordPress installation in the backup.',
'duplicator-pro'
);
$componentsTooltip = $tplMng->render('parts/packages/filters/package_components_tootip', [], false);
?>
<div class="dup-package-components">
<div class="component-section">
<label class="lbl-larger">
<?php esc_html_e('Presets:', 'duplicator-pro'); ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php echo esc_attr($presetsTooltip); ?>"
aria-expanded="false"></i>
</label>
<div class="components-shortcut-select">
<div class="dup-radio-button-group-wrapper">
<?php foreach (BuildComponents::COMPONENTS_ACTIONS as $action) {
$inputId = 'dup-component-shortcut-action-' . $action;
if (
in_array($action, BuildComponents::COMPONENTS_PLUS_ACTIONS) &&
!License::can(License::CAPABILITY_PACKAGE_COMPONENTS_PLUS)
) {
$disabled = 'disabled';
} else {
$disabled = '';
}
?>
<input
type="radio"
id="<?php echo esc_attr($inputId); ?>"
name="auto-select-components"
class="dup-components-shortcut-radio"
value="<?php echo esc_html($action); ?>"
<?php checked($action === BuildComponents::getActionFromComponents($activeComponents)); ?>>
<label
for="<?php echo esc_attr($inputId); ?>"
class="button hollow secondary small <?php echo esc_attr($disabled); ?>">
<?php
echo wp_kses(
BuildComponents::getActionLabel($action, true),
[
'i' => [
'class' => [],
],
]
);
?>
</label>
<?php } ?>
</div>
<div class="dup-tabs-opts-help">
<?php
if (!License::can(License::CAPABILITY_PACKAGE_COMPONENTS_PLUS)) { ?>
<div id="dup-upgrade-license-info" class="margin-top-1">
<?php
printf(
esc_html_x(
'The %1$s and %2$s options are not included in your license plan.',
'%1$s and %2$s are the options not included in the license.',
'duplicator-pro'
),
'<b>' . esc_html(BuildComponents::getActionLabel(BuildComponents::COMP_ACTION_MEDIA)) . '</b>',
'<b>' . esc_html(BuildComponents::getActionLabel(BuildComponents::COMP_ACTION_CUSTOM)) . '</b>'
);
?>
<br>
<?php
printf(
esc_html_x(
'To enable advanced options please %1$supgrade your license%2$s.',
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link.',
'duplicator-pro'
),
'<a href="' . esc_url(License::getUpsellURL()) . '" target="_blank">',
'</a>'
);
?>
</div>
<?php } ?>
</div>
</div>
<hr>
<label class="lbl-larger">
<?php esc_html_e('Components:', 'duplicator-pro'); ?>&nbsp;
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e('Backup Components', 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($componentsTooltip); ?>"
aria-expanded="false"></i>
</label>
<div>
<ul class="custom-components-select no-bullet">
<?php foreach (BuildComponents::COMPONENTS as $component) { ?>
<li>
<label class="<?php echo in_array($component, BuildComponents::SUB_OPTIONS) ? 'secondary license-disabled' : 'license-disabled' ?>">
<input
type="checkbox"
<?php echo !in_array($component, BuildComponents::SUB_OPTIONS) ? 'data-parsley-multiple="package_components"' : '' ?>
name="<?php echo esc_attr($component) ?>"
id="<?php echo esc_attr($component) ?>"
class="dup-components-checkbox"
<?php checked(in_array($component, $activeComponents)); ?>>
<?php echo esc_html(BuildComponents::getLabel($component)); ?>
</label>
</li>
<?php } ?>
</ul>
<span id="components_error_container" class="duplicator-error-container"></span>
</div>
</div>
<div class="files-filter-section">
<hr>
<label class="lbl-larger">
<?php esc_html_e('File Filters:', 'duplicator-pro'); ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php esc_attr_e('File filters allow you to exclude files and folders from the backup.', 'duplicator-pro'); ?>"
aria-expanded="false"></i>
</label>
<div class="margin-bottom-1">
<label>
<input
id="files-filter-on"
name="filter-on"
type="checkbox" <?php checked($archiveFilterOn); ?>
class="margin-0">&nbsp;<?php esc_html_e('Enable', 'duplicator-pro'); ?>
</label>
</div>
<div class="filters <?php echo ($archiveFilterOn ? 'no-display' : ''); ?>">
<label class="lbl-larger">
<?php
esc_html_e('Filters:', 'duplicator-pro');
$tooltip = __(
'- Use full path for directories or specific files.<br>
- Use filenames without paths to filter same-named files across multiple directories.<br>
- Use semicolons to separate all items.<br>
- Use # to comment a line.',
'duplicator-pro'
);
?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php echo esc_attr($tooltip); ?>"
aria-expanded="false"></i>
</label>
<div>
<textarea
id="filter-paths"
name="filter-paths"
class="margin-0"
placeholder="/full_path/dir/;&#10;/full_path/file;"
readonly><?php echo esc_html($archiveFilterPaths); ?></textarea>
<small class="filter-links margin-bottom-1">
<a href="#" data-filter-path="<?php echo esc_attr(SnapIO::trailingslashit(WpArchiveUtils::getOriginalPaths('home'))); ?>">
[<?php esc_html_e('root path', 'duplicator-pro') ?>]
</a>
<a href="#" data-filter-path="<?php echo esc_attr(SnapIO::trailingslashit(WpArchiveUtils::getOriginalPaths('wpcontent'))); ?>">
[wp-content]
</a>
<a href="#" data-filter-path="<?php echo esc_attr(SnapIO::trailingslashit(WpArchiveUtils::getOriginalPaths('uploads'))); ?>">
[wp-uploads]
</a>
<a href="#" data-filter-path="<?php echo esc_attr(SnapIO::trailingslashit(WpArchiveUtils::getOriginalPaths('wpcontent')) . 'cache/'); ?>">
[<?php esc_html_e('cache', 'duplicator-pro') ?>]
</a>
<a href="#" id="clear-path-filters">(<?php esc_html_e('clear', 'duplicator-pro') ?>)</a>
</small>
</div>
<label class="lbl-larger">
<?php esc_html_e('File Extensions', 'duplicator-pro'); ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e('File Extensions', 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($extensionFilterTooltip); ?>"
aria-expanded="false"></i>
</label>
<div>
<textarea
id="filter-exts"
name="filter-exts"
class="margin-bottom-0"
placeholder="ext1;ext2;ext3;"
readonly><?php echo esc_html($archiveFilterExtensions); ?></textarea>
<small class="filter-links">
<a href="#" data-filter-exts="avi;mov;mp4;mpeg;mpg;swf;wmv;aac;m3u;mp3;mpa;wav;wma">[media]</a>
<a href="#" data-filter-exts="zip;rar;tar;gz;bz2;7z">[archive]</a>
<a href="#" id="clear-extension-filters">(<?php esc_html_e('clear', 'duplicator-pro'); ?>)</a>
</small>
</div>
</div>
</div>
</div>
<script>
jQuery(document).ready(function($) {
$('#package_component_db').attr('data-parsley-required', 'true');
$('#package_component_db').attr('data-parsley-mincheck', '1');
$('#package_component_db').attr('data-parsley-errors-container', '#components_error_container');
$('#package_component_db')
.attr('data-parsley-required-message', '<?php echo esc_js(__("Please select at least one component.", "duplicator-pro")); ?>');
$('.dup-package-components .component-section input[type=checkbox]').on('change', function() {
$('#package_component_db').parsley().validate();
});
DupliJs.Pack.ToggleFileFilters = function() {
if ($("#files-filter-on").is(':checked')) {
$('#dup-archive-filter-file-icon').show();
$('.files-filter-section .filters').removeClass('no-display');
$('#filter-exts, #filter-paths').prop('readonly', false);
} else {
$('#dup-archive-filter-file-icon').hide();
$('.files-filter-section .filters').addClass('no-display');
$('#filter-exts, #filter-paths').prop('readonly', true);
}
};
DupliJs.Pack.ToggleDBExcluded = function() {
if (!$('#package_component_db').is(":checked")) {
$('.filter-db-tab-content').hide();
} else {
$('.filter-db-tab-content').show();
}
}
DupliJs.Pack.ToggleDBOnly = function() {
let allComponentCheckboxes = $('.dup-package-components .component-section input[type=checkbox]');
if (allComponentCheckboxes.filter(':checked').length === 1 && $('#package_component_db').is(":checked")) {
$('#dup-archive-filter-file-icon').hide();
$("#dup-archive-db-only-icon").show();
$('.files-filter-section').hide();
$('.db-only-message').show();
} else {
if ($('#files-filter-on').is(':checked')) {
$('#dup-archive-filter-file-icon').show();
}
$("#dup-archive-db-only-icon").hide();
$('.files-filter-section').show();
$('.db-only-message').hide();
}
}
DupliJs.Pack.ToggleMediaOnly = function() {
let allComponentCheckboxes = $('.dup-package-components .component-section input[type=checkbox]');
if (allComponentCheckboxes.filter(':checked').length === 1 && $('#package_component_uploads').is(":checked")) {
$("#dup-archive-media-only-icon").show();
} else {
$("#dup-archive-media-only-icon").hide();
}
}
DupliJs.Pack.SetDBOnly = function() {
$('.dup-components-checkbox').prop('checked', false);
$('.custom-components-select label').addClass('disabled');
$('#package_component_db').prop('checked', true);
}
DupliJs.Pack.SetMediaOnly = function() {
$('.dup-components-checkbox').prop('checked', false);
$('.custom-components-select label').addClass('disabled');
$('#package_component_uploads').prop('checked', true);
}
DupliJs.Pack.SetDefault = function() {
$('.dup-components-checkbox').prop('checked', false);
$('label:not(.secondary) .dup-components-checkbox').prop('checked', true);
$('.custom-components-select label').addClass('disabled');
}
DupliJs.Pack.SetCustom = function() {
$('.custom-components-select label').removeClass('disabled');
}
DupliJs.Pack.ToggleComponentsSelect = function() {
let checkedSelect = $('.dup-components-shortcut-radio:checked').val();
console.log(checkedSelect);
switch (checkedSelect) {
case 'all':
DupliJs.Pack.SetDefault();
break;
case 'database':
DupliJs.Pack.SetDBOnly();
break;
case 'media':
DupliJs.Pack.SetMediaOnly();
break;
case 'custom':
DupliJs.Pack.SetCustom();
break;
}
$('.dup-components-checkbox').trigger('change');
}
DupliJs.Pack.SetComponentsSelect = function() {
let allComponentCheckboxes = $('.dup-components-checkbox');
let checkedComponentsCount = allComponentCheckboxes.filter(':checked').length;
let activeOnlyDisabled = (!$('#package_component_plugins_active').is(":checked") && !$('#package_component_themes_active').is(":checked"));
if (checkedComponentsCount === (allComponentCheckboxes.length - 2) && activeOnlyDisabled) {
$('#dup-component-shortcut-action-all').prop('checked', true);
} else if (checkedComponentsCount === 1 && $('#package_component_db').is(":checked")) {
$('#dup-component-shortcut-action-database').prop('checked', true);
} else if (checkedComponentsCount === 1 && $('#package_component_uploads').is(":checked")) {
$('#dup-component-shortcut-action-media').prop('checked', true);
} else {
$('#dup-component-shortcut-action-custom').prop('checked', true);
}
DupliJs.Pack.ToggleComponentsSelect();
}
DupliJs.Pack.ToggleActivePlugins = function() {
let activePluginsInput = $('#package_component_plugins_active');
if (activePluginsInput.parent().hasClass('disabled')) {
activePluginsInput.prop('disabled', true);
return;
}
if (!$('#package_component_plugins').is(':checked')) {
activePluginsInput.prop('disabled', true);
activePluginsInput.prop('checked', false);
} else {
activePluginsInput.prop('disabled', false);
}
}
DupliJs.Pack.ToggleActiveThemes = function() {
let activeThemesInput = $('#package_component_themes_active');
if (activeThemesInput.parent().hasClass('disabled')) {
activeThemesInput.prop('disabled', true);
return;
}
if (!$('#package_component_themes').is(':checked')) {
activeThemesInput.prop('disabled', true);
activeThemesInput.prop('checked', false);
} else {
activeThemesInput.prop('disabled', false);
}
}
DupliJs.Pack.ToggleFileFilters();
DupliJs.Pack.ToggleActiveThemes();
DupliJs.Pack.ToggleActivePlugins();
DupliJs.Pack.ToggleDBExcluded();
DupliJs.Pack.ToggleDBOnly();
DupliJs.Pack.ToggleMediaOnly();
DupliJs.Pack.SetComponentsSelect();
$('a[data-filter-path]').click(function(e) {
e.preventDefault()
if ($('#filter-paths').is("[readonly]")) {
return;
}
let currentVal = $('#filter-paths').val()
let newVal = currentVal.length > 0 ? currentVal + ";\n" + $(this).data('filter-path') : $(this).data('filter-path')
$('#filter-paths').val(newVal)
})
$('#clear-path-filters').click(function(e) {
e.preventDefault()
if ($('#filter-paths').is("[readonly]")) {
return;
}
$('#filter-paths').val('')
})
$('a[data-filter-exts]').click(function(e) {
e.preventDefault()
if ($('#filter-exts').is("[readonly]")) {
return;
}
let currentVal = $('#filter-exts').val()
let newVal = currentVal.length > 0 ? currentVal + ";" + $(this).data('filter-exts') : $(this).data('filter-exts')
$('#filter-exts').val(newVal)
})
$('#clear-extension-filters').click(function(e) {
e.preventDefault()
if ($('#filter-exts').is("[readonly]")) {
return;
}
$('#filter-exts').val('')
})
$('#files-filter-on').change(DupliJs.Pack.ToggleFileFilters)
$('#package_component_db').change(function() {
DupliJs.Pack.ToggleDBExcluded();
})
$('.dup-components-shortcut-radio').change(function() {
DupliJs.Pack.ToggleComponentsSelect();
})
$('.dup-components-checkbox').change(function() {
DupliJs.Pack.ToggleDBOnly()
DupliJs.Pack.ToggleMediaOnly()
})
$('#package_component_plugins').change(function() {
DupliJs.Pack.ToggleActivePlugins();
});
$('#package_component_themes').change(function() {
DupliJs.Pack.ToggleActiveThemes();
});
});
</script>

View File

@@ -0,0 +1,70 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Package\Create\BuildComponents;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<p>
<?php esc_html_e('Backup components allow you to include/exclude different parts of your WordPress installation in the Backup.', 'duplicator-pro'); ?>
</p>
<ul>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_DB)); ?></b>:
<?php esc_html_e('Include the database in the Backup.', 'duplicator-pro'); ?>
</li>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_CORE)); ?></b>:
<?php esc_html_e('Includes WordPress core files in the Backup (e.g. wp-include, wp-admin wp-login.php and other.', 'duplicator-pro'); ?>
</li>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_PLUGINS)); ?></b>:
<?php
printf(
esc_html_x(
'Include the plugins in the Backup. With the %1$sactive only%2$s option enabled, only active plugins will be included in the Backup.',
'%1$s and %2$s represent opening and closing bold (<b> and </b>) tags',
'duplicator-pro'
),
'<b>',
'</b>'
);
?>
</li>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_THEMES)); ?></b>:
<?php
printf(
esc_html_x(
'Include the themes in the Backup. With the %1$sactive only%2$s option enabled, only active themes will be included in the Backup.',
'%1$s and %2$s represent opening and closing bold (<b> and </b>) tags',
'duplicator-pro'
),
'<b>',
'</b>'
);
?>
</li>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_UPLOADS)); ?></b>:
<?php esc_html_e('Include the \'uploads\' folder.', 'duplicator-pro'); ?>
</li>
<li>
<b><?php echo esc_html(BuildComponents::getLabel(BuildComponents::COMP_OTHER)); ?></b>:
<?php esc_html_e('Include non-WordPress files and folders in the root directory.', 'duplicator-pro'); ?>
</li>
</ul>

View File

@@ -0,0 +1,116 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Installer\Package\ArchiveDescriptor;
use Duplicator\Models\GlobalEntity;
use Duplicator\Models\TemplateEntity;
use Duplicator\Package\Archive\PackageArchive;
use Duplicator\Views\UI\UiDialog;
use Duplicator\Views\UI\UiViewState;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var bool $isTemplateEdit
*/
$isTemplateEdit = $tplData['isTemplateEdit'];
/** @var ?TemplateEntity */
$template = ($tplData['template'] ?? null);
$archive_format = (GlobalEntity::getInstance()->getBuildMode() == PackageArchive::BUILD_MODE_DUP_ARCHIVE ? 'daf' : 'zip');
?>
<div class="dup-box dup-archive-filters-wrapper">
<div class="dup-box-title">
<i class="far fa-file-archive fa-sm"></i> <?php esc_html_e('Backup', 'duplicator-pro') ?>
<?php if (!$isTemplateEdit) { ?>
<sup class="dup-box-title-badge">
<?php echo esc_html($archive_format); ?>
</sup>
<?php } ?>
&nbsp;&nbsp;
<?php $tplMng->render('parts/packages/filters/section_filters_incons'); ?>
<button class="dup-box-arrow">
<span class="screen-reader-text">
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Archive Settings', 'duplicator-pro') ?>
</span>
</button>
</div>
<div
id="dup-pack-archive-panel"
class="dup-box-panel <?php echo UiViewState::getValue('dup-pack-archive-panel') ? '' : 'no-display'; ?>">
<div data-dupli-tabs="true">
<ul>
<li class="filter-files-tab">
<?php esc_html_e('Filters', 'duplicator-pro') ?>
</li>
<?php if (is_multisite()) { ?>
<li class="filter-mu-tab">
<?php esc_html_e('Multisite', 'duplicator-pro') ?>
</li>
<?php } ?>
<li class="archive-setup-tab">
<?php esc_html_e('Security', 'duplicator-pro') ?>
</li>
</ul>
<?php
$tplMng->render('parts/packages/filters/section_filters_subtab_filters_files');
if (is_multisite()) {
$tplMng->render('admin_pages/packages/setup/archive-filter-mu-tab');
}
if ($isTemplateEdit && $template != null) {
$setupParams = [
'secureOn' => $template->installer_opts_secure_on,
'securePass' => $template->installerPassowrd,
];
} else {
$setupParams = [
'secureOn' => ArchiveDescriptor::SECURE_MODE_NONE,
'securePass' => '',
];
}
$tplMng->render('parts/packages/filters/section_filters_subtab_setup', $setupParams);
?>
</div>
</div>
</div>
<div class="duplicator-error-container"></div>
<?php
$alert1 = new UiDialog();
$alert1->title = __('ERROR!', 'duplicator-pro');
$alert1->message = __('You can\'t exclude all sites.', 'duplicator-pro');
$alert1->initAlert();
?>
<script>
//INIT
jQuery(document).ready(function($) {
//MU-Transfer buttons
$('#mu-include-btn').click(function() {
return !$('#mu-exclude option:selected').remove().appendTo('#mu-include');
});
$('#mu-exclude-btn').click(function() {
var include_all_count = $('#mu-include option').length;
var include_selected_count = $('#mu-include option:selected').length;
if (include_all_count > include_selected_count) {
return !$('#mu-include option:selected').remove().appendTo('#mu-exclude');
} else {
<?php $alert1->showAlert(); ?>
}
});
});
</script>

View File

@@ -0,0 +1,34 @@
<?php
/**
* @package Duplicator
*/
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<span class="dup-archive-filters-icons">
<span id="dup-archive-filter-file-icon" title="<?php esc_attr_e('Folder/File Filters Enabled', 'duplicator-pro'); ?>">
<i class="fa-solid fa-folder-minus fa-sm primary-color"></i>
</span>
<span id="dup-archive-filter-db-icon" title="<?php esc_attr_e('Database Filters Enabled', 'duplicator-pro'); ?>">
<i class="fa-solid fa-table fa-sm primary-color"></i>
</span>
<span id="dup-archive-db-only-icon" title="<?php esc_attr_e('Backup Only the Database', 'duplicator-pro'); ?>">
<i class="fa-solid fa-database fa-sm primary-color"></i>
</span>
<span id="dup-archive-media-only-icon" title="<?php esc_attr_e('Backup Only Media files', 'duplicator-pro'); ?>">
<i class="fa-solid fa-file-image fa-sm primary-color"></i>
</span>
<span id="dupli-install-secure-lock-icon" title="<?php esc_attr_e('Backup Password Protection is On', 'duplicator-pro'); ?>" >
<i class="fa-solid fa-lock fa-sm primary-color"></i>
</span>
</span>

View File

@@ -0,0 +1,93 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Controllers\SettingsPageController;
use Duplicator\Libs\WpUtils\WpDbUtils;
use Duplicator\Models\TemplateEntity;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var bool $isTemplateEdit
*/
$isTemplateEdit = $tplData['isTemplateEdit'];
/** @var ?TemplateEntity */
$template = ($tplData['template'] ?? null);
$dbbuild_mode = WpDbUtils::getBuildMode();
$settingsPackageUrl = SettingsPageController::getInstance()->getMenuLink(SettingsPageController::L2_SLUG_PACKAGE);
if ($isTemplateEdit && $template != null) {
$tableList = explode(',', $template->database_filter_tables);
$tableListFilterParams = [
'dbFilterOn' => $template->database_filter_on,
'dbPrefixFilter' => $template->databasePrefixFilter,
'dbPrefixSubFilter' => $template->databasePrefixSubFilter,
'tablesSlected' => $tableList,
];
} else {
$tableListFilterParams = [
'dbFilterOn' => false,
'dbPrefixFilter' => '',
'dbPrefixSubFilter' => '',
'tablesSlected' => [],
];
}
?>
<div class="filter-db-tab-content">
<hr>
<div class="db-only-message margin-bottom-1">
<label class="lbl-larger">
<?php esc_html_e("Database Only", 'duplicator-pro') ?>
</label>
<div class="input">
<?php
esc_html_e(
'This advanced option excludes all files from the archive.
Only the database and a copy of the installer.php will be included in the Backup file.',
'duplicator-pro'
);
?><br>
<?php
esc_html_e(
'The option can be used for backing up and moving only the database.',
'duplicator-pro'
);
?><br>
<?php
printf(
esc_html_x(
'When installing a database only backup please visit the %1$sdatabase only quick start%2$s',
'%1$s and %2$s are opening and closing anchor tags',
'duplicator-pro'
),
'<a href="' . esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'database-install') . '" target="_blank">',
'</a>'
);
?>
</div>
</div>
<div class="margin-bottom-1">
<?php $tplMng->render('parts/packages/filters/tables_list_filter', $tableListFilterParams); ?>
</div>
<div class="dup-form-item">
<label class="lbl-larger">
<?php esc_html_e("SQL Mode", 'duplicator-pro') ?>
</label>
<span class="input">
<a href="<?php echo esc_url($settingsPackageUrl); ?>" target="settings">
<?php echo esc_html($dbbuild_mode); ?>
</a>
</span>
</div>
<?php $tplMng->render('parts/packages/filters/mysqldump_compatibility_mode'); ?>
</div>

View File

@@ -0,0 +1,45 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Libs\Snap\SnapIO;
use Duplicator\Models\TemplateEntity;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var bool $isTemplateEdit
*/
$isTemplateEdit = $tplData['isTemplateEdit'];
/** @var ?TemplateEntity */
$template = ($tplData['template'] ?? null);
if ($isTemplateEdit && $template != null) {
$componentsParams = [
'archiveFilterOn' => $template->archive_filter_on,
'archiveFilterDirs' => $template->archive_filter_dirs,
'archiveFilterFiles' => $template->archive_filter_files,
'archiveFilterExtensions' => $template->archive_filter_exts,
'components' => $template->components,
];
} else {
$componentsParams = [
'archiveFilterOn' => 0,
'archiveFilterDirs' => '',
'archiveFilterFiles' => '',
'archiveFilterExtensions' => '',
'components' => [],
];
}
?>
<div class="filter-files-tab-content">
<?php $tplMng->render('parts/packages/filters/package_components', $componentsParams); ?>
<?php $tplMng->render('parts/packages/filters/section_filters_subtab_filters_db'); ?>
</div>

View File

@@ -0,0 +1,166 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Installer\Package\ArchiveDescriptor;
use Duplicator\Package\SettingsUtils;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
$secureOn = ($tplData['secureOn'] ?? ArchiveDescriptor::SECURE_MODE_NONE);
$securePass = ($tplData['securePass'] ?? '');
$unavaliableMessage = '';
$encryptAvaliable = SettingsUtils::isArchiveEncryptionAvailable($unavaliableMessage);
?>
<div class="archive-setup-tab" >
<div class="dup-package-hdr-1">
<?php esc_html_e('Security', 'duplicator-pro'); ?>
</div>
<div class="dup-form-item margin-bottom-1">
<label class="lbl-larger" >
<?php esc_html_e('Mode', 'duplicator-pro') ?>:&nbsp;
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e('Security', 'duplicator-pro'); ?>"
data-tooltip="<?php $tplMng->renderEscAttr('admin_pages/packages/setup/security-tooltip-content'); ?>">
</i>
</label>
<div class="input">
<span class="secure-on-input-wrapper">
<label class="inline-display margin-right-1" >
<input
type="radio"
name="secure-on"
class="margin-0"
id="secure-on-none"
onclick="DupliJs.EnableInstallerPassword()"
required
value="<?php echo (int) ArchiveDescriptor::SECURE_MODE_NONE; ?>"
<?php checked($secureOn, ArchiveDescriptor::SECURE_MODE_NONE); ?>
data-parsley-multiple="secure-on-mltiple-error"
data-parsley-errors-container="#secure-on-parsely-error"
>
<?php esc_html_e('None', 'duplicator-pro') ?>
</label>
<label class="inline-display margin-right-1" >
<input
type="radio"
name="secure-on"
class="margin-0"
id="secure-on-inst-pwd"
value="<?php echo (int) ArchiveDescriptor::SECURE_MODE_INST_PWD; ?>"
<?php checked($secureOn, ArchiveDescriptor::SECURE_MODE_INST_PWD); ?>
onclick="DupliJs.EnableInstallerPassword()"
data-parsley-multiple="secure-on-mltiple-error"
>
<?php esc_html_e('Installer password', 'duplicator-pro') ?>
</label>
<label class="inline-display" >
<input
type="radio"
name="secure-on"
class="margin-0"
id="secure-on-arc-encrypt"
value="<?php echo (int) ArchiveDescriptor::SECURE_MODE_ARC_ENCRYPT; ?>"
<?php echo ($encryptAvaliable ? checked($secureOn, ArchiveDescriptor::SECURE_MODE_ARC_ENCRYPT, false) : ''); ?>
onclick="DupliJs.EnableInstallerPassword()"
<?php disabled(!$encryptAvaliable); ?>
data-parsley-multiple="secure-on-mltiple-error"
>
<?php esc_html_e('Archive encryption', 'duplicator-pro') ?>
</label>
</span>
<div id="secure-on-parsely-error"></div>
</div>
</div>
<div class="dup-form-item">
<label class="lbl-larger" >
<?php esc_html_e('Password', 'duplicator-pro') ?>:
</label>
<div class="input">
<span class="dup-password-toggle width-xlarge">
<input
id="secure-pass"
type="password"
name="secure-pass"
required="required"
size="50"
maxlength="150"
value="<?php echo esc_attr($securePass); ?>"
>
<button type="button" >
<i class="fas fa-eye fa-sm"></i>
</button>
</span>
<div class="input dup-tabs-opts-help-secure-pass">
<?php
esc_html_e(
'Caution: Passwords are case-sensitive and if lost cannot be recovered. Please keep passwords in a safe place!',
'duplicator-pro'
);
echo '<br/>';
esc_html_e(
'If this password is lost then a new archive file will need to be created.',
'duplicator-pro'
);
?>
</div>
</div>
</div>
<?php if (!$encryptAvaliable) { ?>
<div class="dup-form-item">
<span class="title">
&nbsp;
</span>
<span class="input dup-tabs-opts-notice">
<i>
<i class="fas fa-exclamation-triangle fa-xs"></i>
<?php
echo esc_html__("The security mode 'Archive encryption' option above is currently disabled on this server.", 'duplicator-pro') . '<br>'
. esc_html($unavaliableMessage);
?>
</i>
</span>
</div>
<?php } ?>
</div>
<script>
jQuery(function($) {
DupliJs.EnableInstallerPassword = function () {
let $button = $('#secure-btn');
let secureOnVal = $('.secure-on-input-wrapper input:checked').val();
if (secureOnVal == <?php echo json_encode(ArchiveDescriptor::SECURE_MODE_NONE); ?>) {
$('#dupli-install-secure-lock-icon').hide();
$('#secure-pass').removeAttr('required');
$('#secure-pass').attr('readonly', true);
$button.prop('disabled', true);
} else {
$('#dupli-install-secure-lock-icon').show();
$('#secure-pass').attr('readonly', false);
$('#secure-pass').attr('required', 'true').focus();
$button.prop('disabled', false);
}
};
$('#secure-on-none').parsley().on('field:error', function() {
$('.archive-setup-tab button').trigger('click');
$('html,body').animate({scrollTop: $(".archive-setup-tab").offset().top - 30},'slow');
});
});
</script>

View File

@@ -0,0 +1,409 @@
<?php
/**
* @package Duplicator
*/
defined("ABSPATH") or die("");
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Controllers\SettingsPageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Models\BrandEntity;
use Duplicator\Models\TemplateEntity;
use Duplicator\Views\UI\UiViewState;
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var int $activeBrandId
*/
$activeBrandId = ($tplData['activeBrandId'] ?? -1);
/** @var string */
$dbHost = ($tplData['dbHost'] ?? '');
/** @var string */
$dbName = ($tplData['dbName'] ?? '');
/** @var string */
$dbUser = ($tplData['dbUser'] ?? '');
/** @var bool */
$cpnlEnable = ($tplData['cpnlEnable'] ?? false);
/** @var string */
$cpnlHost = ($tplData['cpnlHost'] ?? '');
/** @var string */
$cpnlUser = ($tplData['cpnlUser'] ?? '');
/** @var string */
$cpnlDbAction = ($tplData['cpnlDbAction'] ?? '');
/** @var string */
$cpnlDbHost = ($tplData['cpnlDbHost'] ?? '');
/** @var string */
$cpnlDbName = ($tplData['cpnlDbName'] ?? '');
/** @var string */
$cpnlDbUser = ($tplData['cpnlDbUser'] ?? '');
$ui_css_installer = (UiViewState::getValue('dupli-pack-installer-panel') ? 'display:block' : 'display:none');
?>
<div class="dup-box">
<div class="dup-box-title">
<i class="fa fa-bolt fa-sm"></i> <?php esc_html_e('Installer', 'duplicator-pro') ?>
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?>
<?php esc_html_e('Installer Settings', 'duplicator-pro') ?>
</span>
</button>
</div>
<div class="dup-box-panel" id="dupli-pack-installer-panel" style="<?php echo esc_attr($ui_css_installer); ?>">
<div class="dup-package-hdr-1">
<?php esc_html_e("Setup", 'duplicator-pro') ?>
</div>
<label class="lbl-larger">
<?php esc_html_e('Branding', 'duplicator-pro'); ?>
<?php
$tipContent = __(
'This option changes the branding of the installer file. Click the preview button to see the selected style.',
'duplicator-pro'
);
?>
<i
class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e("Choose Brand", 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($tipContent); ?>"></i>
</label>
<div>
<?php
if (License::can(License::CAPABILITY_BRAND)) :
$brands = BrandEntity::getAllWithDefault();
/** @todo remove this */
/*
$activeBrandId = TemplateEntity::get_manual_template()->installer_opts_brand;
if ($activeBrandId < 0) {
$activeBrandId = -1; // for old brand version
}
*/
?>
<select name="installer_opts_brand" id="brand" class="width-auto">
<?php foreach ($brands as $i => $brand) { ?>
<option
value="<?php echo (int) $brand->getId(); ?>"
title="<?php echo esc_attr($brand->notes); ?>"
<?php selected($brand->getId(), $activeBrandId); ?>>
<?php echo esc_html($brand->name); ?>
</option>
<?php } ?>
</select>
<?php
if ($activeBrandId > 0) {
$preview_url = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE_BRAND,
null,
[
ControllersManager::QUERY_STRING_INNER_PAGE => SettingsPageController::BRAND_INNER_PAGE_EDIT,
'action' => 'edit',
'id' => intval($activeBrandId),
]
);
} else {
$preview_url = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE_BRAND,
null,
[
ControllersManager::QUERY_STRING_INNER_PAGE => SettingsPageController::BRAND_INNER_PAGE_EDIT,
'action' => 'default',
]
);
}
?>
&nbsp;
<a href="<?php echo esc_url($preview_url); ?>" target="_blank" class="button hollow secondary small" id="brand-preview">
<?php esc_html_e("Preview", 'duplicator-pro'); ?>
</a> &nbsp;
<?php else :
$link = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE_BRAND
);
?>
<a href="<?php echo esc_url($link); ?>"><?php esc_html_e("Enable Branding", 'duplicator-pro'); ?></a>
<?php endif; ?>
</div>
<div class="dup-package-hdr-1">
<?php esc_html_e("Prefills", 'duplicator-pro') ?>&nbsp;
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e("Setup/Prefills", 'duplicator-pro'); ?>"
data-tooltip="<?php
esc_attr_e(
'All values in this section are OPTIONAL! If you know ahead of time the database input fields the installer will use,
then you can optionally enter them here and they will be prefilled at install time.
Otherwise you can just enter them in at install time and ignore all these options in the Installer section.',
'duplicator-pro'
);
?>">
</i>
</div>
<!-- ===================
BASIC/CPANEL TABS -->
<div data-dupli-tabs="true">
<ul>
<li id="dupli-bsc-tab-lbl"><?php esc_html_e('Basic', 'duplicator-pro') ?></li>
<li id="dupli-cpnl-tab-lbl"><?php esc_html_e('cPanel', 'duplicator-pro') ?></li>
</ul>
<!-- ===================
TAB1: Basic -->
<div>
<div class="dup-package-hdr-2">
<?php esc_html_e("MySQL Server", 'duplicator-pro') ?>
<div class="dup-package-hdr-usecurrent">
<a href="javascript:void(0)" onclick="DupliJs.Pack.ApplyDataCurrent('s1-installer-dbbasic')">
[<?php esc_html_e('use current', 'duplicator-pro') ?>]
</a>
</div>
</div>
<div id="s1-installer-dbbasic">
<label class="lbl-larger">
<?php esc_html_e("Host", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_db_host"
id="dbhost"
maxlength="200"
placeholder="<?php esc_html_e("example: localhost (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_attr(DB_HOST); ?>"
value="<?php echo esc_attr($dbHost); ?>">
</div>
<label class="lbl-larger">
<?php esc_html_e("Database", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_db_name"
id="dbname"
maxlength="100"
placeholder="<?php esc_html_e("example: DatabaseName (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_attr(DB_NAME) ?>"
value="<?php echo esc_attr($dbName); ?>">
</div>
<label class="lbl-larger">
<?php esc_html_e("User", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_db_user"
id="dbuser"
maxlength="100"
placeholder="<?php esc_html_e("example: DatabaseUser (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_attr(DB_USER); ?>"
value="<?php echo esc_attr($dbUser); ?>">
</div>
</div>
</div>
<!-- ===================
TAB2: cPanel -->
<div>
<div class="dup-package-hdr-2">
<?php esc_html_e("cPanel Login", 'duplicator-pro') ?>
</div>
<label class="lbl-larger">
<?php esc_html_e("Automation", 'duplicator-pro') ?>:
</label>
<div>
<?php
$tipContent = __(
'Enabling this options will automatically select the cPanel tab when step one of the installer is shown.',
'duplicator-pro'
);
?>
<input
type="checkbox"
name="installer_opts_cpnl_enable"
id="cpnl-enable"
value="1"
<?php checked($cpnlEnable); ?>>
<label for="cpnl-enable"><?php esc_html_e('Auto Select cPanel', 'duplicator-pro') ?></label>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e('Auto Select cPanel', 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($tipContent); ?>">
</i>
</div>
<label class="lbl-larger">
<?php esc_html_e("Host", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_cpnl_host"
id="cpnl-host"
maxlength="200"
value="<?php echo esc_attr($cpnlHost); ?>"
placeholder="<?php esc_attr_e("example: cpanelHost (value is optional)", 'duplicator-pro') ?>">
</div>
<label class="lbl-larger">
<?php esc_html_e("User", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_cpnl_user"
id="cpnl-user"
value="<?php echo esc_attr($cpnlUser); ?>"
maxlength="200"
placeholder="<?php esc_attr_e("example: cpanelUser (value is optional)", 'duplicator-pro') ?>">
</div>
<div class="dup-package-hdr-2">
<?php esc_html_e("MySQL Server", 'duplicator-pro') ?>
<div class="dup-package-hdr-usecurrent">
<a href="javascript:void(0)" onclick="DupliJs.Pack.ApplyDataCurrent('s1-installer-dbcpanel')">
[<?php esc_html_e('use current', 'duplicator-pro') ?>]
</a>
</div>
</div>
<div id="s1-installer-dbcpanel">
<label class="lbl-larger">
<?php esc_html_e("Action", 'duplicator-pro') ?>:
</label>
<div>
<select name="installer_opts_cpnl_db_action" id="cpnl-dbaction">
<option value="" <?php selected($cpnlDbAction, ''); ?>>
<?php esc_html_e('Default', 'duplicator-pro'); ?>
</option>
<option value="create" <?php selected($cpnlDbAction, 'create'); ?>>
<?php esc_html_e('Create A New Database', 'duplicator-pro'); ?>
</option>
<option value="empty" <?php selected($cpnlDbAction, 'empty'); ?>>
<?php esc_html_e('Connect and Delete Any Existing Data', 'duplicator-pro'); ?>
</option>
<option value="rename" <?php selected($cpnlDbAction, 'rename'); ?>>
<?php esc_html_e('Connect and Backup Any Existing Data', 'duplicator-pro'); ?>
</option>
<option value="manual" <?php selected($cpnlDbAction, 'manual'); ?>>
<?php esc_html_e('Skip Database Extraction', 'duplicator-pro'); ?>
</option>
</select>
</div>
<label class="lbl-larger">
<?php esc_html_e("Host", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_cpnl_db_host"
id="cpnl-dbhost"
value="<?php echo esc_attr($cpnlDbHost); ?>"
maxlength="200"
placeholder="<?php esc_attr_e("example: localhost (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_html(DB_HOST); ?>">
</div>
<label class="lbl-larger">
<?php esc_html_e("Database", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_cpnl_db_name"
value="<?php echo esc_attr($cpnlDbName); ?>"
id="cpnl-dbname"
data-parsley-pattern="/^[a-zA-Z0-9-_]+$/"
maxlength="100"
placeholder="<?php esc_attr_e("example: DatabaseName (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_html(DB_NAME); ?>">
</div>
<label class="lbl-larger">
<?php esc_html_e("User", 'duplicator-pro') ?>:
</label>
<div>
<input
type="text"
name="installer_opts_cpnl_db_user"
value="<?php echo esc_attr($cpnlDbUser); ?>"
id="cpnl-dbuser"
data-parsley-pattern="/^[a-zA-Z0-9-_]+$/"
maxlength="100"
placeholder="<?php esc_attr_e("example: DatabaseUserName (value is optional)", 'duplicator-pro') ?>"
data-current="<?php echo esc_html(DB_USER); ?>">
</div>
</div>
</div>
</div><br />
<small><?php esc_html_e("Additional inputs can be entered at install time.", 'duplicator-pro') ?></small>
<br /><br />
</div>
</div><br />
<script>
(function($) {
DupliJs.Pack.ApplyDataCurrent = function(id) {
$('#' + id + ' input').each(function() {
var attr = $(this).attr('data-current');
if (typeof attr !== typeof undefined && attr !== false) {
$(this).val($(this).attr('data-current'));
}
});
};
<?php if (License::can(License::CAPABILITY_BRAND)) : ?>
// brand-preview
var $brand = $("#brand"),
brandCheck = function(e) {
var $this = $(this) || $brand;
var $id = $this.val();
<?php
$prewURLs = [
ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE_BRAND,
null,
[
ControllersManager::QUERY_STRING_INNER_PAGE => SettingsPageController::BRAND_INNER_PAGE_EDIT,
'action' => 'default',
]
),
ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE_BRAND,
null,
[
ControllersManager::QUERY_STRING_INNER_PAGE => SettingsPageController::BRAND_INNER_PAGE_EDIT,
'action' => 'edit',
]
),
];
?>
var $url = <?php echo json_encode($prewURLs); ?>;
$url[1] += "&id=" + $id;
$("#brand-preview").attr('href', $url[$id > 0 ? 1 : 0]);
$this.find('option[value="' + $id + '"]')
.prop('selected', true)
.parent();
};
$brand.on('select change', brandCheck);
<?php endif; ?>
}(window.jQuery));
</script>

View File

@@ -0,0 +1,304 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Libs\Snap\SnapWP;
use Duplicator\Libs\WpUtils\WpDbUtils;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var \wpdb $wpdb
*/
$dbFilterOn = $tplData['dbFilterOn'] ?? false;
$dbPrefixFilter = $tplData['dbPrefixFilter'] ?? false;
$dbPrefixSubFilter = $tplData['dbPrefixSubFilter'] ?? false;
$tSelected = $tplData['tablesSlected'] ?? [];
$dbTableCount = 1;
global $wpdb;
$toolTipPrefixFilterContent = sprintf(
__(
'By enabling this option all tables that do not start with the prefix <b>"%s"</b> are excluded from the Backup.',
'duplicator-pro'
),
esc_html($wpdb->prefix)
) . ' ' .
__(
'This option is useful for multiple WordPress installs in the same database or if several applications are installed in the same database.',
'duplicator-pro'
);
$toolTipSubsiteFilterContent =
__('Enabling this option excludes all tables associated with deleted sites from the Backup.', 'duplicator-pro') . '<br><br>' .
__(
'When deleting a site in a multisite; WordPress deletes the tables of items related to the core, however it is not assumed that the tables of third party plugins are removed.', // phpcs:ignore Generic.Files.LineLength
'duplicator-pro'
) . ' ' .
__('With a multisite with a large number of deleted sites the database may be full of unused tables.', 'duplicator-pro') . ' ' .
__('With this option only the tables of currently existing sites will be included in the backup.', 'duplicator-pro');
$toolTipTablesFilters = __(
"Checked tables will be <b>excluded</b> from the database script.
Excluding certain tables can cause your site or plugins to not work correctly after install!",
'duplicator-pro'
) . '<br><br>' .
__(
"Use caution when excluding tables! It is highly recommended to not exclude WordPress core tables in red with an *,
unless you know the impact.",
'duplicator-pro'
);
?>
<label class="lbl-larger">
<?php esc_html_e('Database Filters:', 'duplicator-pro'); ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php esc_attr_e('Database filters allow you to exclude table from the backup.', 'duplicator-pro'); ?>"
aria-expanded="false"></i>
</label>
<div class="margin-bottom-1">
<label>
<input
type="checkbox"
id="dbfilter-on"
name="dbfilter-on" <?php checked($dbFilterOn); ?>
class="margin-0">&nbsp;<?php esc_html_e('Enable', 'duplicator-pro'); ?>
</label>
</div>
<div class="db-filter-section">
<label class="lbl-larger">
<?php esc_html_e("Table Prefixes:", 'duplicator-pro') ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
title="<?php echo esc_attr($toolTipPrefixFilterContent); ?>"
aria-expanded="false"></i>
</label>
<div class="margin-bottom-1">
<label>
<input
type="checkbox"
id="db-prefix-filter"
name="db-prefix-filter"
class="margin-0"
<?php checked($dbPrefixFilter); ?>
<?php disabled(!$dbFilterOn); ?>
data-prefix-value="<?php echo esc_attr($wpdb->prefix); ?>" />
<?php
esc_html_e('Filter tables without current WordPress prefix', 'duplicator-pro');
echo isset($wpdb->prefix) ? '&nbsp;<i>(' . esc_html($wpdb->prefix) . ')</i>&nbsp;' : '';
?>
</label>
</div>
<?php if (is_multisite()) { ?>
<label class="lbl-larger">
<?php esc_html_e("Subsites:", 'duplicator-pro') ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e("Multisite-Subsite Filters", 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($toolTipSubsiteFilterContent); ?>">
</i>
</label>
<div class="margin-bottom-1">
<label>
<input
type="checkbox"
id="db-prefix-sub-filter"
name="db-prefix-sub-filter"
class="margin-0"
<?php checked($dbPrefixSubFilter); ?>
<?php disabled(!$dbFilterOn); ?>>
<?php esc_html_e("Filter/Hide Tables of Deleted Multisite-Subsites", 'duplicator-pro') ?>
</label>
</div>
<?php } ?>
<label class="lbl-larger">
<?php esc_html_e("Exclude Tables:", 'duplicator-pro') ?>
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip="<?php echo esc_attr($toolTipTablesFilters); ?>">
</i>
</label>
<div id="dup-db-filter-items">
<div class="dup-db-filter-buttons">
<span id="dbnone" class="link-style gray dup-db-filter-none">
<i class="fa-regular fa-square-minus fa-lg" title="<?php esc_html_e('Unfilter All Tables', 'duplicator-pro'); ?>"></i>
</span>&nbsp;
<span id="dball" class="link-style gray dup-db-filter-all">
<i class="fa-regular fa-square-check fa-lg" title="<?php esc_html_e('Filter All Tables', 'duplicator-pro'); ?>"></i>
</span>
</div>
<div id="dup-db-tables-exclude-wrapper">
<div id="dup-db-tables-exclude">
<input type="hidden" id="dup-db-tables-lists" name="dbtables-list" value="">
<?php
$substesIds = SnapWP::getSitesIds();
foreach (WpDbUtils::getTablesList() as $table) {
$info = SnapWP::getTableInfoByName($table, $wpdb->prefix);
$classes = ['table-item'];
if ($info['isCore']) {
$classes[] = 'core-table';
$core_note = '*';
if ($info['subsiteId'] > 0) {
$classes[] = ' subcore-table-' . ($info['subsiteId'] % 2);
}
} else {
$core_note = '';
}
$dbTableCount++;
$cboxClasses = ['dup-pseudo-checkbox'];
$checked = in_array($table, $tSelected);
if ($info['subsiteId'] > 1 && !in_array($info['subsiteId'], $substesIds)) {
$classes[] = 'no-subsite-exists';
if ($dbPrefixSubFilter) {
$cboxClasses[] = 'disabled';
$checked = true;
}
}
if ($info['havePrefix'] == false) {
$classes[] = 'no-prefix-table';
if ($dbPrefixFilter) {
$cboxClasses[] = 'disabled';
$checked = true;
}
}
if ($checked) {
$cboxClasses[] = 'checked';
}
?>
<label class="<?php echo esc_attr(implode(' ', $classes)); ?>">
<span
class="<?php echo esc_attr(implode(' ', $cboxClasses)); ?>"
aria-checked="<?php echo $checked ? "true" : "false"; ?>"
role="checkbox"
data-value="<?php echo esc_attr($table); ?>">
</span>
&nbsp;<span><?php echo esc_html($table . $core_note); ?></span>
</label>
<?php } ?>
</div>
</div>
</div>
</div>
<script>
jQuery(function($) {
/* METHOD: Toggle Database table filter red icon */
DupliJs.Pack.ToggleDBFiltersRedIcon = function() {
if (
$("#dbfilter-on").is(':checked')
) {
$('#dup-archive-filter-db-icon').show();
$('#db-prefix-filter').prop('disabled', false);
$('#db-prefix-sub-filter').prop('disabled', false);
} else {
$('#dup-archive-filter-db-icon').hide();
$('#db-prefix-filter').prop('disabled', true);
$('#db-prefix-sub-filter').prop('disabled', true);
}
}
DupliJs.Pack.ToggleDBFilters = function() {
var filterItems = $('#dup-db-filter-items');
if (
$("#dbfilter-on").is(':checked')
) {
$('.db-filter-section').removeClass('no-display');
filterItems.removeClass('disabled');
$('#dup-db-filter-items-no-filters').hide();
} else {
$('.db-filter-section').addClass('no-display');
filterItems.addClass('disabled');
$('#dup-db-filter-items-no-filters').show();
}
DupliJs.Pack.ToggleDBFiltersRedIcon();
};
DupliJs.Pack.FillExcludeTablesList = function() {
let values = $("#dup-db-tables-exclude .dup-pseudo-checkbox.checked")
.map(function() {
return this.getAttribute('data-value');
})
.get()
.join();
$('#dup-db-tables-lists').val(values);
};
DupliJs.Pack.ToggleNoPrefixTables = function(removeCheckOnEnable = true) {
let checkNode = $('#db-prefix-filter');
let display = !checkNode.is(":checked");
$("#dup-db-tables-exclude .no-prefix-table").each(function() {
let checkBox = $(this).find(".dup-pseudo-checkbox").first();
if (display) {
checkBox.removeClass('disabled');
if (removeCheckOnEnable) {
checkBox.removeClass("checked");
}
} else {
checkBox
.addClass('disabled')
.addClass("checked");
}
});
DupliJs.Pack.ToggleDBFiltersRedIcon();
}
DupliJs.Pack.ToggleNoSubsiteExistsTables = function(removeCheckOnEnable = true) {
let checkNode = $('#db-prefix-sub-filter');
let display = !checkNode.is(":checked");
$("#dup-db-tables-exclude .no-subsite-exists").each(function() {
let checkBox = $(this).find(".dup-pseudo-checkbox").first();
if (display) {
checkBox.removeClass('disabled');
if (removeCheckOnEnable) {
checkBox.removeClass("checked");
}
} else {
checkBox
.addClass('disabled')
.addClass("checked");
}
});
DupliJs.Pack.ToggleDBFiltersRedIcon();
}
});
jQuery(document).ready(function($) {
let tablesToExclude = $("#dup-db-tables-exclude");
$('.dup-db-filter-none').click(function() {
tablesToExclude.find(".dup-pseudo-checkbox.checked").removeClass("checked");
});
$('.dup-db-filter-all').click(function() {
tablesToExclude.find(".dup-pseudo-checkbox:not(.checked)").addClass("checked");
});
$('#db-prefix-sub-filter').change(DupliJs.Pack.ToggleNoSubsiteExistsTables);
$('#db-prefix-filter').change(DupliJs.Pack.ToggleNoPrefixTables);
$('#dbfilter-on').change(DupliJs.Pack.ToggleDBFilters);
DupliJs.Pack.ToggleDBFilters();
});
</script>

View File

@@ -0,0 +1,48 @@
<?php
/**
* Activity Log integration upgrade notice template
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<div>
<p><b><?php esc_html_e('Activity Log Integration Update', 'duplicator-pro'); ?></b></p>
<p>
<?php esc_html_e('Failed backups are no longer shown in the main backup list.', 'duplicator-pro'); ?>
<?php
echo esc_html(
sprintf(
_n(
'%d failed backup has been moved to the Activity Log.',
'%d failed backups have been moved to the Activity Log.',
$tplData['count'],
'duplicator-pro'
),
$tplData['count']
)
);
?>
<?php
printf(
esc_html__(
'You can view them in the %1$sActivity Log%2$s.',
'duplicator-pro'
),
'<a href="' . esc_url($tplData['activityLogUrl']) . '">',
'</a>'
);
?>
</p>
</div>

View File

@@ -0,0 +1,34 @@
<?php
/**
* Failed backups notice template
*/
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<img src="<?php echo esc_url(plugins_url('duplicator-pro/assets/img/warning.png')); ?>"
style="float:left; padding:0 10px 0 5px"
alt="<?php esc_attr_e('Warning', 'duplicator-pro'); ?>" />
<div style="margin-left: 70px;">
<p><b><?php esc_html_e('Failed Backups Detected', 'duplicator-pro'); ?></b></p>
<p>
<?php
printf(
esc_html__(
'One or more backups have failed. To view failure details, check the %1$sActivity Log%2$s.',
'duplicator-pro'
),
'<a href="' . esc_url($tplData['activityLogUrl']) . '">',
'</a>'
);
?>
</p>
</div>

View File

@@ -0,0 +1,40 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<?php echo esc_html(
sprintf(
_x(
'There are currently (%1$s) orphaned Backup files taking up %2$s of space.
These Backup files are no longer visible in the backups list below and are safe to remove.',
'%1$s is the number of orphaned packages, %2$s is the total size of orphaned packages',
'duplicator-pro'
),
$tplData['count'],
$tplData['size']
)
); ?>
<br>
<?php esc_html_e(
'Go to: Tools > General > Information > Stored Data > look for the [Delete Backups Orphans] button for more details.',
'duplicator-pro'
); ?>
<br>
<a href="<?php echo esc_url($tplData['url']); ?>">
<?php esc_html_e('Take me there now!', 'duplicator-pro'); ?>
</a>