first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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 class="wrap">
|
||||
<h1>
|
||||
<?php esc_html_e("Install Backup error", 'duplicator-pro'); ?>
|
||||
</h1>
|
||||
<p>
|
||||
<?php esc_html_e("Error on Backup prepare, please go back and try again.", 'duplicator-pro'); ?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\ImportPageController;
|
||||
use Duplicator\Package\Import\PackageImporter;
|
||||
use Duplicator\Package\Recovery\RecoveryPackage;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var PackageImporter $importObj
|
||||
*/
|
||||
$importObj = $tplData['importObj'];
|
||||
/** @var string $iframeSrc */
|
||||
$iframeSrc = $tplData['iframeSrc'];
|
||||
$importFailMessage = '';
|
||||
|
||||
if (!$importObj->isImportable($importFailMessage)) {
|
||||
?>
|
||||
<div class="wrap dup-styles">
|
||||
<h1>
|
||||
<?php esc_html_e("Install Backup", 'duplicator-pro'); ?>
|
||||
</h1>
|
||||
<div class="dupli-import-installer-content-wrapper" >
|
||||
<p class="orangered">
|
||||
<?php echo esc_html($importFailMessage); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div id="dupli-import-installer-wrapper" class="dup-styles" >
|
||||
<div id="dupli-import-installer-top-bar" class="dupli-recovery-details-max-width-wrapper" >
|
||||
<a href="<?php echo esc_url(ImportPageController::getImportPageLink()); ?>" class="button secondary hollow small margin-bottom-0" >
|
||||
<i class="fa fa-caret-left"></i> <?php esc_html_e("Back to Import", 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<span class="link-style no-decoration recovery-copy-top-wrapper" >
|
||||
<?php if (($recoverPackage = RecoveryPackage::getRecoverPackage()) !== false) { ?>
|
||||
<span class="button secondary hollow small margin-bottom-0"
|
||||
data-tooltip-placement="right"
|
||||
data-dup-copy-value="<?php echo esc_url($recoverPackage->getInstallLink()); ?>"
|
||||
data-dup-copy-title="<?php esc_attr_e("Copy Recovery URL to clipboard", 'duplicator-pro'); ?>"
|
||||
data-dup-copied-title="<?php esc_attr_e("Recovery URL copied to clipboard", 'duplicator-pro'); ?>" >
|
||||
<?php esc_html_e("Copy Recovery URL", 'duplicator-pro'); ?>
|
||||
</span>
|
||||
<?php } else { ?>
|
||||
<span class="button secondary hollow disabled small margin-bottom-0">
|
||||
<i class="fas fa-exclamation-circle"></i> <?php esc_html_e("Recovery Point Not Set", 'duplicator-pro'); ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</div>
|
||||
<div id="dupli-import-installer-modal" class="no-display"></div>
|
||||
<iframe id="dupli-import-installer-iframe" src="<?php echo esc_url($iframeSrc); ?>" ></iframe>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\SettingsPageController;
|
||||
use Duplicator\Core\Controllers\ControllersManager;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$importSettingsUrl = $ctrlMng->getMenuLink(
|
||||
ControllersManager::SETTINGS_SUBMENU_SLUG,
|
||||
SettingsPageController::L2_SLUG_IMPORT
|
||||
);
|
||||
|
||||
?>
|
||||
<div class="dupli-import-upload-message" >
|
||||
<p class="import-upload-reset-message-error">
|
||||
<i class="fa fa-exclamation-triangle"></i> <b><?php esc_html_e('UPLOAD FILE PROBLEM', 'duplicator-pro'); ?></b>
|
||||
</p>
|
||||
<p>
|
||||
<?php esc_html_e('Error message:', 'duplicator-pro'); ?>
|
||||
<b><span class="import-upload-error-message"><!-- here is set the message received from the server --></span></b>
|
||||
</p>
|
||||
<div><?php esc_html_e('Possible solutions:', 'duplicator-pro'); ?></div>
|
||||
<ul class="dupli-simple-style-list" >
|
||||
<li>
|
||||
<?php esc_html_e('If you are using Server to Server transfer function make sure the URL is a valid URL', 'duplicator-pro'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'If you are using the upload function try to change the chunk size in %1$ssettings%2$s and try again',
|
||||
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<a href="' . esc_url($importSettingsUrl) . '">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__('Upload the file via FTP/file manager to the "%s" folder and reload the page.', 'duplicator-pro'),
|
||||
esc_html(DUPLICATOR_IMPORTS_PATH)
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'For more information see %1$s[this FAQ item]%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(DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-handle-import-install-upload-launch-issues') . '" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</b>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Installer\Package\PComponents;
|
||||
use Duplicator\Libs\Snap\SnapString;
|
||||
use Duplicator\Package\Create\BuildComponents;
|
||||
use Duplicator\Package\Import\PackageImporter;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
/* passed values */
|
||||
/** @var PackageImporter $importObj */
|
||||
$importObj = $tplData['importObj'];
|
||||
|
||||
if (!$importObj instanceof PackageImporter) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="dupli-import-package-detail-content">
|
||||
<?php
|
||||
$errorMsg = '';
|
||||
if (!$importObj->encryptCheck($errorMsg)) {
|
||||
?>
|
||||
<p class="maroon">
|
||||
<b>
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$errorMsg,
|
||||
[
|
||||
'a' => [
|
||||
'href' => [],
|
||||
'target' => [],
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</b>
|
||||
</p>
|
||||
<?php
|
||||
} elseif (!$importObj->passwordCheck()) {
|
||||
?>
|
||||
<p class="maroon">
|
||||
<b><i class="fas fa-exclamation-triangle"></i> <?php esc_html_e('Valid password required', 'duplicator-pro'); ?></b>
|
||||
</p>
|
||||
<div class="dup-import-archive-password-request">
|
||||
<input type="password" class="dup-import-archive-password" name="password" value="">
|
||||
<button type="button" class="dup-import-set-archive-password button">
|
||||
<?php esc_html_e('Submit', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php
|
||||
} elseif (!$importObj->isImportable($importFailMessage)) {
|
||||
?>
|
||||
<p class="maroon">
|
||||
<b>
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$importFailMessage,
|
||||
[
|
||||
'br' => [],
|
||||
'a' => [
|
||||
'href' => [],
|
||||
'target' => [],
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</b>
|
||||
</p>
|
||||
<?php
|
||||
} elseif ($importObj->haveImportWaring($importWarnMessage)) {
|
||||
?>
|
||||
<p class="gray">
|
||||
<b><i class="fas fa-exclamation-triangle"></i> <?php echo wp_kses($importWarnMessage, ['br' => []]); ?></b>
|
||||
</p>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<p class="green">
|
||||
<b>
|
||||
<i class="fas fa-check-circle"></i>
|
||||
<?php esc_html_e('This Backup is ready to install, click the continue button to proceed.', 'duplicator-pro'); ?>
|
||||
</b><br />
|
||||
<b><?php esc_html_e('The information below is related to the Backup and the source site where the Backup was created.', 'duplicator-pro'); ?></b>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($importObj->isValid()) {
|
||||
?>
|
||||
<ul class="no-bullet">
|
||||
<li>
|
||||
<span class="label title"><?php esc_html_e('Site Details:', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('URL', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getHomeUrl()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Path', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getHomePath()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label title"><?php esc_html_e('Versions:', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Duplicator', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getDupVersion()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('WordPress', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getWPVersion()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('PHP', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getPhpVersion()); ?></span>
|
||||
</li>
|
||||
<?php if ($importObj->getPackageComponents() !== false) { ?>
|
||||
<li>
|
||||
<span class="label title"><?php esc_html_e('Backup components:', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<?php
|
||||
$packComponents = $importObj->getPackageComponents();
|
||||
foreach (BuildComponents::COMPONENTS_DEFAULT as $component) {
|
||||
?>
|
||||
<li>
|
||||
<span class="label"><?php echo esc_html(BuildComponents::getLabel($component)); ?>:</span>
|
||||
<span class="value">
|
||||
<?php if (in_array($component, $packComponents)) { ?>
|
||||
<i class="fas fa-check-circle green"></i> <?php esc_html_e('included', 'duplicator-pro'); ?>
|
||||
<?php } else { ?>
|
||||
<i class="fas fa-times-circle maroon"></i> <?php esc_html_e('excluded', 'duplicator-pro'); ?>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<span class="label title"><?php esc_html_e('Archive:', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Created', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getCreated()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Size', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html(SnapString::byteSize($importObj->getSize())); ?></span>
|
||||
</li>
|
||||
<?php if (!$importObj->isLite()) { ?>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Folders', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html(number_format($importObj->getNumFolders())); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Files', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html(number_format($importObj->getNumFiles())); ?></span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<span class="label title"><?php esc_html_e('Database:', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<?php
|
||||
if (
|
||||
$importObj->getPackageComponents() === false ||
|
||||
in_array(PComponents::COMP_DB, $importObj->getPackageComponents())
|
||||
) {
|
||||
?>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Size', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html($importObj->getDbSize()); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Tables', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo (int) $importObj->getNumTables(); ?></span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Rows', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php echo esc_html(number_format($importObj->getNumRows())); ?></span>
|
||||
</li>
|
||||
<?php } else { ?>
|
||||
<li>
|
||||
<span class="label"><?php esc_html_e('Database', 'duplicator-pro'); ?>:</span>
|
||||
<span class="value"><?php esc_html_e('Not Included', 'duplicator-pro'); ?></span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -0,0 +1,646 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\ImportPageController;
|
||||
use Duplicator\Views\UI\UiDialog;
|
||||
use Duplicator\Views\UI\UiMessages;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$packageDeteleConfirm = new UiDialog();
|
||||
$packageDeteleConfirm->title = __('Delete Backup?', 'duplicator-pro');
|
||||
$packageDeteleConfirm->wrapperClassButtons = 'dupli-dlg-import-detete-package-btns';
|
||||
$packageDeteleConfirm->progressOn = false;
|
||||
$packageDeteleConfirm->closeOnConfirm = true;
|
||||
$packageDeteleConfirm->message = __('Are you sure you want to delete the selected Backup?', 'duplicator-pro');
|
||||
$packageDeteleConfirm->jsCallback = 'DupliJs.ImportManager.removePackage()';
|
||||
$packageDeteleConfirm->initConfirm();
|
||||
|
||||
$packageInvalidName = new UiMessages(
|
||||
__(
|
||||
'<b>Invalid archive name:</b> The archive name must follow the Duplicator Backup name pattern
|
||||
e.g. BACKUP_NAME_[HASH]_[YYYYMMDDHHSS]_archive.zip (or with a .daf extension).
|
||||
<br>Please make sure not to rename the archive after downloading it and try again!',
|
||||
'duplicator-pro'
|
||||
),
|
||||
UiMessages::ERROR
|
||||
);
|
||||
$packageInvalidName->hide_on_init = true;
|
||||
$packageInvalidName->is_dismissible = true;
|
||||
$packageInvalidName->auto_hide_delay = 10000;
|
||||
$packageInvalidName->initMessage();
|
||||
|
||||
$packageAlreadyExists = new UiMessages(
|
||||
__('Archive file name already exists! <br>Please remove it and try again!', 'duplicator-pro'),
|
||||
UiMessages::ERROR
|
||||
);
|
||||
$packageAlreadyExists->hide_on_init = true;
|
||||
$packageAlreadyExists->is_dismissible = true;
|
||||
$packageAlreadyExists->auto_hide_delay = 5000;
|
||||
$packageAlreadyExists->initMessage();
|
||||
|
||||
$packageUploaded = new UiMessages(__('Backup uploaded', 'duplicator-pro'), UiMessages::NOTICE);
|
||||
$packageUploaded->hide_on_init = true;
|
||||
$packageUploaded->is_dismissible = true;
|
||||
$packageUploaded->auto_hide_delay = 5000;
|
||||
$packageUploaded->initMessage();
|
||||
|
||||
$packageCancelUpload = new UiMessages(__('Backup upload cancelled', 'duplicator-pro'), UiMessages::ERROR);
|
||||
$packageCancelUpload->hide_on_init = true;
|
||||
$packageCancelUpload->is_dismissible = true;
|
||||
$packageCancelUpload->auto_hide_delay = 5000;
|
||||
$packageCancelUpload->initMessage();
|
||||
|
||||
$packageRemoved = new UiMessages(__('Backup removed', 'duplicator-pro'), UiMessages::NOTICE);
|
||||
$packageRemoved->hide_on_init = true;
|
||||
$packageRemoved->is_dismissible = true;
|
||||
$packageRemoved->auto_hide_delay = 5000;
|
||||
$packageRemoved->initMessage();
|
||||
|
||||
$importChunkSize = ImportPageController::getChunkSize();
|
||||
?><script>
|
||||
jQuery(document).ready(function($) {
|
||||
var uploadFileMessageContent = <?php $tplMng->renderJson('admin_pages/import/import-message-upload-error'); ?>;
|
||||
|
||||
DupliJs.ImportManager = {
|
||||
uploaderWrapper: $('#dupli-import-upload-tabs-wrapper'),
|
||||
uploaderDisabler: $('<div>'),
|
||||
uploader: $('#dupli-import-upload-file'),
|
||||
uploaderContent: $('#dupli-import-upload-file-content'),
|
||||
packageRowTemplate: $('#dupli-import-row-template'),
|
||||
packageRowNoFoundTemplate: $('#dupli-import-available-packages-templates .dupli-import-no-package-found'),
|
||||
packagesAviable: $('#dupli-import-available-packages'),
|
||||
packagesList: $('#dupli-import-available-packages .packages-list'),
|
||||
packageRowUploading: null,
|
||||
packageRowToDelete: null,
|
||||
autoLaunchAfterUpload: false,
|
||||
autoLaunchLink: false,
|
||||
confirmLaunchLink: false,
|
||||
startUpload: false,
|
||||
lastUploadsTimes: [],
|
||||
debug: true,
|
||||
init: function() {
|
||||
$('#dupli-import-instructions-toggle').click(function() {
|
||||
$('#dupli-import-instructions-content').toggle(300);
|
||||
})
|
||||
|
||||
DupliJs.ImportManager.uploaderWrapper.css('position', 'relative');
|
||||
DupliJs.ImportManager.uploaderDisabler = $('<div>').css({
|
||||
'position': 'absolute',
|
||||
'top': 0,
|
||||
'left': 0,
|
||||
'width': '100%',
|
||||
'height': '100%',
|
||||
'z-index': '10',
|
||||
'cursor': 'not-allowed',
|
||||
'display': 'none'
|
||||
});
|
||||
DupliJs.ImportManager.uploaderDisabler.appendTo(DupliJs.ImportManager.uploaderWrapper);
|
||||
|
||||
DupliJs.ImportManager.uploader.upload({
|
||||
autoUpload: true,
|
||||
multiple: false,
|
||||
maxSize: <?php echo empty($importChunkSize) ? (int) wp_max_upload_size() : 10737418240; ?>, //100GB get value from upload_max_filesize
|
||||
maxConcurrent: 1,
|
||||
maxFiles: 1,
|
||||
postData: {
|
||||
action: 'duplicator_import_upload',
|
||||
nonce: <?php echo json_encode(wp_create_nonce('duplicator_import_upload')); ?>
|
||||
},
|
||||
chunkSize: <?php echo (int) $importChunkSize; ?>, // This is in kb
|
||||
action: <?php echo json_encode(get_admin_url(null, 'admin-ajax.php')); ?>,
|
||||
chunked: <?php echo empty($importChunkSize) ? 'false' : 'true'; ?>,
|
||||
label: DupliJs.ImportManager.uploaderContent.parent().html(),
|
||||
leave: '<?php echo esc_js(__('You have uploads pending, are you sure you want to leave this page?', 'duplicator-pro')); ?>'
|
||||
})
|
||||
.on("start.upload", DupliJs.ImportManager.onStart)
|
||||
.on("complete.upload", DupliJs.ImportManager.onComplete)
|
||||
.on("filestart.upload", DupliJs.ImportManager.onFileStart)
|
||||
.on("fileprogress.upload", DupliJs.ImportManager.onFileProgress)
|
||||
.on("filecomplete.upload", DupliJs.ImportManager.onFileComplete)
|
||||
.on("fileerror.upload", DupliJs.ImportManager.onFileError)
|
||||
.on("fileerror.chunkerror", DupliJs.ImportManager.onChunkError);
|
||||
|
||||
DupliJs.ImportManager.uploaderContent.remove();
|
||||
DupliJs.ImportManager.uploaderContent = $('#dupli-import-upload-file #dupli-import-upload-file-content');
|
||||
DupliJs.ImportManager.initPageButtons();
|
||||
DupliJs.ImportManager.checkMaxUploadedFiles();
|
||||
|
||||
DupliJs.ImportManager.packagesList.on('click', '.dupli-import-action-remove', function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.packageRowToDelete = $(this).closest('.dupli-import-package');
|
||||
<?php $packageDeteleConfirm->showConfirm(); ?>
|
||||
return false;
|
||||
});
|
||||
|
||||
DupliJs.ImportManager.packagesList.on('click', '.dupli-import-action-package-detail-toggle', function(event) {
|
||||
event.stopPropagation();
|
||||
let button = $(this);
|
||||
let details = button.closest('.dupli-import-package').find('.dupli-import-package-detail');
|
||||
if (details.hasClass('no-display')) {
|
||||
button.find('.fa').removeClass('fa-caret-down').addClass('fa-caret-up');
|
||||
details.removeClass('no-display');
|
||||
} else {
|
||||
button.find('.fa').removeClass('fa-caret-up').addClass('fa-caret-down');
|
||||
details.addClass('no-display');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
DupliJs.ImportManager.packagesList.on('click', '.dupli-import-action-cancel-upload', function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.abortUpload();
|
||||
<?php $packageCancelUpload->showMessage(); ?>
|
||||
return false;
|
||||
});
|
||||
|
||||
DupliJs.ImportManager.packagesList.on('click', '.dupli-import-action-install', function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.confirmLaunchLink = $(this).data('install-url');
|
||||
$('#dupli-import-phase-one').addClass('no-display');
|
||||
$('#dupli-import-phase-two').removeClass('no-display');
|
||||
return false;
|
||||
});
|
||||
|
||||
DupliJs.ImportManager.packagesList.on('click', '.dup-import-set-archive-password', function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.setArchivePassword($(this));
|
||||
return false;
|
||||
});
|
||||
|
||||
DupliJs.ImportManager.initRemoteUpload();
|
||||
},
|
||||
initRemoteUpload: function() {
|
||||
$('#dupli-import-remote-upload').click(function() {
|
||||
let uploadUrl = $('#dupli-import-remote-url').val();
|
||||
let parsedUrl = null;
|
||||
|
||||
try {
|
||||
parsedUrl = new URL(uploadUrl);
|
||||
} catch (error) {
|
||||
DupliJs.addAdminMessage('<?php echo esc_js(__('Invalid URL', 'duplicator-pro')) ?>', 'error');
|
||||
}
|
||||
|
||||
let files = [{
|
||||
'name': parsedUrl.pathname.split('/').pop(),
|
||||
'size': -1
|
||||
}];
|
||||
if (DupliJs.ImportManager.onStart(null, files) == false) {
|
||||
DupliJs.ImportManager.onComplete(null);
|
||||
return false;
|
||||
}
|
||||
DupliJs.ImportManager.onFileStart(null, files[0]);
|
||||
DupliJs.ImportManager.remoteUploadCall(uploadUrl, null);
|
||||
});
|
||||
},
|
||||
remoteUploadCall: function(uploadUrl, restoreDownload) {
|
||||
DupliJs.Util.ajaxWrapper({
|
||||
action: 'duplicator_import_remote_download',
|
||||
url: uploadUrl,
|
||||
restoreDownload: (restoreDownload == null ? '' : JSON.stringify(restoreDownload)),
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_remote_download')); ?>'
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
if (DupliJs.ImportManager.packageRowUploading == null) {
|
||||
// if row don't exitst the upload is aboted
|
||||
DupliJs.ImportManager.onComplete(null);
|
||||
return '';
|
||||
}
|
||||
|
||||
if (funcData.status == 'complete') {
|
||||
DupliJs.ImportManager.onFileComplete(null, uploadUrl, result);
|
||||
DupliJs.ImportManager.onComplete(null);
|
||||
} else {
|
||||
DupliJs.ImportManager.updateProgress(funcData.remoteChunk.offset, funcData.remoteChunk.fullSize);
|
||||
|
||||
// Update filename display with real archive name from cloud processing
|
||||
if (funcData.remoteChunk.extraData && funcData.remoteChunk.extraData.archiveName) {
|
||||
DupliJs.ImportManager.packageRowUploading.find('.name .text').text(funcData.remoteChunk.extraData.archiveName);
|
||||
}
|
||||
|
||||
DupliJs.ImportManager.remoteUploadCall(uploadUrl, funcData.remoteChunk);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.ImportManager.uploadError(result.data.message);
|
||||
DupliJs.ImportManager.onComplete(null);
|
||||
return '';
|
||||
}, {
|
||||
timeout: 30000 // 30 seconds for large cloud file downloads
|
||||
}
|
||||
);
|
||||
},
|
||||
setArchivePassword: function(button) {
|
||||
let row = button.closest('.dupli-import-package');
|
||||
let archiveFile = row.data('path');
|
||||
let password = row.find('.dup-import-archive-password-request .dup-import-archive-password').val();
|
||||
|
||||
DupliJs.Util.ajaxWrapper({
|
||||
action: 'duplicator_import_set_archive_password',
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_import_set_archive_password')); ?>',
|
||||
archive: archiveFile,
|
||||
password: password
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.ImportManager.packageRowUploading = row;
|
||||
DupliJs.ImportManager.onFileComplete(null, archiveFile, result, false);
|
||||
DupliJs.ImportManager.onComplete(null);
|
||||
return '';
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.addAdminMessage(data.message, 'error', {
|
||||
'hideDelay': 5000
|
||||
});
|
||||
return '';
|
||||
}
|
||||
);
|
||||
},
|
||||
initPageButtons: function() {
|
||||
$('.dupli-import-view-list').click(function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.updateViewMode('<?php echo esc_js(ImportPageController::VIEW_MODE_ADVANCED); ?>');
|
||||
});
|
||||
|
||||
$('.dupli-import-view-single').click(function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.updateViewMode('<?php echo esc_js(ImportPageController::VIEW_MODE_BASIC); ?>');
|
||||
});
|
||||
|
||||
$('#dupli-import-launch-installer-confirm').click(function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.confirmLaunchInstaller();
|
||||
});
|
||||
|
||||
$('#dupli-import-launch-installer-cancel').click(function(event) {
|
||||
event.stopPropagation();
|
||||
DupliJs.ImportManager.confirmLaunchLink = false;
|
||||
$('#dupli-import-phase-two').addClass('no-display');
|
||||
$('#dupli-import-phase-one').removeClass('no-display');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#wpbody-content').each(function() {
|
||||
let tabWrapper = $(this);
|
||||
|
||||
tabWrapper.find('[data-tab-target]').click(function() {
|
||||
let targetId = $(this).data('tab-target');
|
||||
tabWrapper.find('[data-tab-target]').removeClass('active');
|
||||
tabWrapper.find('.tab-content').addClass('no-display');
|
||||
|
||||
$(this).addClass('active');
|
||||
tabWrapper.find('#' + targetId).removeClass('no-display');
|
||||
});
|
||||
});
|
||||
},
|
||||
confirmLaunchInstaller: function() {
|
||||
window.location.href = DupliJs.ImportManager.confirmLaunchLink;
|
||||
return false;
|
||||
},
|
||||
onStart: function(e, files) {
|
||||
DupliJs.ImportManager.uploaderDisabler.show();
|
||||
DupliJs.ImportManager.startUpload = true;
|
||||
DupliJs.ImportManager.uploader.upload("disable");
|
||||
DupliJs.ImportManager.autoLaunchLink = false;
|
||||
|
||||
let isValidName = true;
|
||||
let alreadyExists = false;
|
||||
|
||||
$.each(files, function(index, value) {
|
||||
if (!DupliJs.ImportManager.isValidFileName(value.name)) {
|
||||
isValidName = false;
|
||||
}
|
||||
|
||||
if (DupliJs.ImportManager.isAlreadyExists(value.name)) {
|
||||
alreadyExists = true;
|
||||
}
|
||||
});
|
||||
|
||||
/*if (!isValidName) {
|
||||
<?php $packageInvalidName->showMessage(); ?>
|
||||
DupliJs.ImportManager.abortUpload();
|
||||
return false;
|
||||
}*/
|
||||
|
||||
if (alreadyExists) {
|
||||
<?php $packageAlreadyExists->showMessage(); ?>
|
||||
DupliJs.ImportManager.abortUpload();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
onComplete: function(e) {
|
||||
$('#dupli-import-remote-url').val('');
|
||||
|
||||
if (DupliJs.ImportManager.autoLaunchAfterUpload && DupliJs.ImportManager.autoLaunchLink) {
|
||||
document.location.href = DupliJs.ImportManager.autoLaunchLink;
|
||||
}
|
||||
DupliJs.ImportManager.checkMaxUploadedFiles();
|
||||
},
|
||||
onFileStart: function(e, file) {
|
||||
DupliJs.ImportManager.resetUploadTimes();
|
||||
DupliJs.ImportManager.packagesList.find('.dupli-import-no-package-found').remove();
|
||||
DupliJs.ImportManager.packageRowUploading = DupliJs.ImportManager.packageRowTemplate.clone().prependTo(DupliJs.ImportManager.packagesList);
|
||||
|
||||
DupliJs.ImportManager.packageRowUploading.removeAttr('id');
|
||||
DupliJs.ImportManager.packageRowUploading.find('.name .text').text(file.name);
|
||||
DupliJs.ImportManager.packageRowUploading.find('.size').text(DupliJs.Util.humanFileSize(file.size));
|
||||
DupliJs.ImportManager.packageRowUploading.find('.created').html("<i><?php esc_html_e('loading...', 'duplicator-pro'); ?></i>");
|
||||
|
||||
let loader = DupliJs.ImportManager.packageRowUploading.find('.funcs .dupli-loader').removeClass('no-display');
|
||||
loader.find('.dupli-meter > span').css('width', '0%');
|
||||
loader.find('.text').text('0%');
|
||||
},
|
||||
onFileProgress: function(e, file, percent, eventObj) {
|
||||
let position = 0;
|
||||
if ('currentChunk' in file) {
|
||||
position = file.currentChunk * file.chunkSize;
|
||||
} else {
|
||||
if (eventObj.lengthComputable) {
|
||||
position = eventObj.loaded || eventObj.position;
|
||||
} else {
|
||||
position = false;
|
||||
}
|
||||
}
|
||||
|
||||
DupliJs.ImportManager.updateProgress(position, file.size);
|
||||
},
|
||||
onFileComplete: function(e, file, response, showMessage = true) {
|
||||
let result = null;
|
||||
if (typeof response === 'string' || response instanceof String) {
|
||||
result = JSON.parse(response);
|
||||
} else {
|
||||
result = response;
|
||||
}
|
||||
DupliJs.ImportManager.resetUploadTimes();
|
||||
|
||||
if (result.success == false) {
|
||||
DupliJs.ImportManager.uploadError(result.data.message);
|
||||
return;
|
||||
}
|
||||
|
||||
DupliJs.ImportManager.packageRowUploading.data('path', result.data.funcData.archivePath);
|
||||
if (result.data.funcData.isImportable) {
|
||||
DupliJs.ImportManager.packageRowUploading.addClass('is-importable');
|
||||
DupliJs.ImportManager.packageRowUploading
|
||||
.find('.dupli-import-action-install')
|
||||
.prop('disabled', false)
|
||||
.data('install-url', result.data.funcData.installerPageLink);
|
||||
DupliJs.ImportManager.autoLaunchLink = result.data.funcData.installerPageLink;
|
||||
} else {
|
||||
DupliJs.ImportManager.autoLaunchLink = false;
|
||||
DupliJs.ImportManager.packageRowUploading.find('.dupli-import-action-package-detail-toggle').trigger('click');
|
||||
}
|
||||
DupliJs.ImportManager.packageRowUploading.find('.dupli-import-package-detail').html(result.data.funcData.htmlDetails);
|
||||
DupliJs.ImportManager.packageRowUploading.find('.size').text(DupliJs.Util.humanFileSize(result.data.funcData.archiveSize));
|
||||
DupliJs.ImportManager.packageRowUploading.find('.created').text(result.data.funcData.created);
|
||||
DupliJs.ImportManager.packageRowUploading.find('.funcs .dupli-loader').addClass('no-display');
|
||||
DupliJs.ImportManager.packageRowUploading.find('.funcs .actions').removeClass('no-display');
|
||||
DupliJs.ImportManager.packageRowUploading = null;
|
||||
if (showMessage) {
|
||||
<?php $packageUploaded->showMessage(); ?>
|
||||
}
|
||||
},
|
||||
onFileError: function(e, file, error) {
|
||||
if (error === 'abort') {
|
||||
// no message for abort
|
||||
DupliJs.ImportManager.uploadError(null);
|
||||
} else if (error === 'size') {
|
||||
DupliJs.ImportManager.uploadError(<?php echo json_encode(__('The file size exceeds the maximum upload limit.', 'duplicator-pro')); ?>);
|
||||
} else {
|
||||
DupliJs.ImportManager.uploadError(error);
|
||||
}
|
||||
},
|
||||
getTimeLeft: function(sizeToFinish) {
|
||||
if (DupliJs.ImportManager.lastUploadsTimes.length < 2) {
|
||||
return false;
|
||||
}
|
||||
let pos1 = DupliJs.ImportManager.lastUploadsTimes[0].pos;
|
||||
let time1 = DupliJs.ImportManager.lastUploadsTimes[0].time;
|
||||
|
||||
let index = DupliJs.ImportManager.lastUploadsTimes.length - 1
|
||||
let pos2 = DupliJs.ImportManager.lastUploadsTimes[index].pos;
|
||||
let time2 = DupliJs.ImportManager.lastUploadsTimes[index].time;
|
||||
|
||||
let deltaPos = pos2 - pos1;
|
||||
let deltaTime = time2 - time1;
|
||||
|
||||
return deltaTime / deltaPos * sizeToFinish;
|
||||
},
|
||||
millisecToTime: function(s) {
|
||||
if (s <= 0) {
|
||||
return '<?php echo esc_js(__('loading...', 'duplicator-pro')) ?>';
|
||||
}
|
||||
|
||||
var ms = s % 1000;
|
||||
s = (s - ms) / 1000;
|
||||
var secs = s % 60;
|
||||
s = (s - secs) / 60;
|
||||
var mins = s % 60;
|
||||
var hrs = (s - mins) / 60;
|
||||
|
||||
let result = '';
|
||||
if (hrs > 0) {
|
||||
result += ' ' + hrs + ' <?php echo esc_js(__('hr', 'duplicator-pro')) ?>';
|
||||
}
|
||||
|
||||
if (mins > 0) {
|
||||
result += ' ' + (mins + 1) + ' <?php echo esc_js(__('min', 'duplicator-pro')) ?>';
|
||||
return result;
|
||||
}
|
||||
|
||||
return secs + ' <?php echo esc_js(__('sec', 'duplicator-pro')) ?>';
|
||||
},
|
||||
resetUploadTimes: function() {
|
||||
DupliJs.ImportManager.lastUploadsTimes = [];
|
||||
},
|
||||
addUploadTime: function(postion) {
|
||||
if (DupliJs.ImportManager.lastUploadsTimes.length > 20) {
|
||||
DupliJs.ImportManager.lastUploadsTimes.shift();
|
||||
}
|
||||
|
||||
DupliJs.ImportManager.lastUploadsTimes.push({
|
||||
'pos': postion,
|
||||
'time': Date.now()
|
||||
});
|
||||
},
|
||||
updateProgress: function(position, total) {
|
||||
let percent = 0;
|
||||
|
||||
if (position !== false) {
|
||||
DupliJs.ImportManager.addUploadTime(position);
|
||||
percent = Math.round((position / total) * 100 * 10) / 10;
|
||||
percent = Number.isInteger(percent) ? percent + ".0" : percent;
|
||||
}
|
||||
|
||||
DupliJs.ImportManager.packageRowUploading.find('.size').text(DupliJs.Util.humanFileSize(total));
|
||||
let timeLeft = DupliJs.ImportManager.getTimeLeft(total - position);
|
||||
let loader = DupliJs.ImportManager.packageRowUploading.find('.funcs .dupli-loader');
|
||||
loader.find('.dupli-meter > span').css("width", percent + "%");
|
||||
loader.find('.text').text(percent + "% - " + DupliJs.ImportManager.millisecToTime(timeLeft));
|
||||
},
|
||||
updateContentMessage: function(icon, line1, line2) {
|
||||
DupliJs.ImportManager.uploaderContent.find('.message').html('<i class="fas ' + icon + ' fa-sm"></i> ' + line1 + '<br>' + line2);
|
||||
},
|
||||
uploadError: function(message) {
|
||||
DupliJs.ImportManager.removeRow(DupliJs.ImportManager.packageRowUploading);
|
||||
DupliJs.ImportManager.packageRowUploading = null;
|
||||
|
||||
if (message != null) {
|
||||
DupliJs.addAdminMessage(uploadFileMessageContent, 'error', {
|
||||
'hideDelay': 60000,
|
||||
'updateCallback': function(msgNode) {
|
||||
msgNode.find('.import-upload-error-message').text(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
isAlreadyExists: function(name) {
|
||||
let alreadyExists = false;
|
||||
DupliJs.ImportManager.packagesList.find('tbody .name .text').each(function() {
|
||||
if (name === $(this).text()) {
|
||||
alreadyExists = true;
|
||||
}
|
||||
});
|
||||
|
||||
return alreadyExists;
|
||||
},
|
||||
isValidFileName: function(name) {
|
||||
if (!name.match(<?php echo wp_json_encode(DUPLICATOR_ARCHIVE_REGEX_PATTERN); ?>)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
abortUpload: function() {
|
||||
try {
|
||||
DupliJs.ImportManager.uploader.upload("abort");
|
||||
} catch (err) {
|
||||
// prevent abort error
|
||||
}
|
||||
DupliJs.ImportManager.removeRow(DupliJs.ImportManager.packageRowUploading);
|
||||
DupliJs.ImportManager.packageRowUploading = null;
|
||||
},
|
||||
removePackage: function() {
|
||||
DupliJs.Util.ajaxWrapper({
|
||||
action: 'duplicator_import_package_delete',
|
||||
path: DupliJs.ImportManager.packageRowToDelete.data('path'),
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_import_package_delete')); ?>'
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.ImportManager.removeRow(DupliJs.ImportManager.packageRowToDelete);
|
||||
<?php $packageRemoved->showMessage(); ?>;
|
||||
return '';
|
||||
}
|
||||
);
|
||||
},
|
||||
removeRow: function(row) {
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
row.fadeOut(
|
||||
'fast',
|
||||
function() {
|
||||
row.remove();
|
||||
if (DupliJs.ImportManager.packagesList.find('.dupli-import-package').length === 0) {
|
||||
DupliJs.ImportManager.packageRowNoFoundTemplate.clone().appendTo(DupliJs.ImportManager.packagesList);
|
||||
}
|
||||
DupliJs.ImportManager.checkMaxUploadedFiles();
|
||||
}
|
||||
);
|
||||
},
|
||||
checkMaxUploadedFiles: function() {
|
||||
let limit = 0; // 0 no limit
|
||||
let numPackages = $('.packages-list .dupli-import-package').length;
|
||||
|
||||
if ($('#dupli-import-available-packages').hasClass('view-single-item')) {
|
||||
limit = 1;
|
||||
}
|
||||
|
||||
if (limit > 0 && numPackages >= limit) {
|
||||
DupliJs.ImportManager.uploaderDisabler.show();
|
||||
DupliJs.ImportManager.uploader.upload("disable");
|
||||
} else {
|
||||
DupliJs.ImportManager.uploaderDisabler.hide();
|
||||
DupliJs.ImportManager.uploader.upload("enable");
|
||||
}
|
||||
},
|
||||
disableWrapper: function() {
|
||||
DupliJs.ImportManager.uploaderWrapper
|
||||
},
|
||||
updateViewMode: function(viewMode) {
|
||||
DupliJs.Util.ajaxWrapper({
|
||||
action: 'duplicator_import_set_view_mode',
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_import_set_view_mode')); ?>',
|
||||
view_mode: viewMode
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
switch (funcData) {
|
||||
case '<?php echo esc_js(ImportPageController::VIEW_MODE_ADVANCED); ?>':
|
||||
$('.dupli-import-view-single').removeClass('active');
|
||||
$('.dupli-import-view-list').addClass('active');
|
||||
$('#dupli-basic-mode-message').addClass('no-display');
|
||||
DupliJs.ImportManager.packagesAviable.removeClass('view-single-item').addClass('view-list-item');
|
||||
break;
|
||||
case '<?php echo esc_js(ImportPageController::VIEW_MODE_BASIC); ?>':
|
||||
$('.dupli-import-view-list').removeClass('active');
|
||||
$('.dupli-import-view-single').addClass('active');
|
||||
$('#dupli-basic-mode-message').removeClass('no-display');
|
||||
DupliJs.ImportManager.packagesAviable.removeClass('view-list-item').addClass('view-single-item');
|
||||
break;
|
||||
default:
|
||||
throw '<?php echo esc_js(__('Invalid view mode', 'duplicator-pro')); ?>';
|
||||
}
|
||||
DupliJs.ImportManager.checkMaxUploadedFiles();
|
||||
return '';
|
||||
|
||||
},
|
||||
function(result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.addAdminMessage(data.message, 'error', {
|
||||
'hideDelay': 5000
|
||||
});
|
||||
return '';
|
||||
}
|
||||
);
|
||||
},
|
||||
console: function() {
|
||||
if (this.debug) {
|
||||
if (arguments.length > 1) {
|
||||
console.log(arguments[0], arguments[1]);
|
||||
} else {
|
||||
console.log(arguments[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// wait form stone init, it's not a great method but for now I haven't found a better one.
|
||||
window.setTimeout(DupliJs.ImportManager.init, 500);
|
||||
|
||||
$('.dupli-import-box.closable').each(function() {
|
||||
let box = $(this);
|
||||
let title = $(this).find('.box-title');
|
||||
let content = $(this).find('.box-content');
|
||||
|
||||
title.click(function() {
|
||||
if (box.hasClass('opened')) {
|
||||
box.removeClass('opened').addClass('closed');
|
||||
} else {
|
||||
box.removeClass('closed').addClass('opened');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
use Duplicator\Controllers\RecoveryController;
|
||||
use Duplicator\Libs\Snap\SnapWP;
|
||||
use Duplicator\Package\Recovery\RecoveryPackage;
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$postTypeCount = SnapWP::getPostTypesCount();
|
||||
if (
|
||||
($recoverPackage = RecoveryPackage::getRecoverPackage()) == false ||
|
||||
$recoverPackage->isOutToDate()
|
||||
) {
|
||||
$badgeClass = 'badge-warn';
|
||||
$badgeLabel = 'Notice';
|
||||
} else {
|
||||
$badgeClass = 'badge-pass';
|
||||
$badgeLabel = 'Good';
|
||||
}
|
||||
?>
|
||||
<div class="dupli-import-header" >
|
||||
<h2 class="title">
|
||||
<b>
|
||||
<?php printf(esc_html__("Step %s of 2: Confirmation", 'duplicator-pro'), '<span class="red">2</span>'); ?>
|
||||
</b>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="dupli-recovery-details-max-width-wrapper" >
|
||||
<div class="dupli-import-box closable opened" >
|
||||
<div class="box-title" >
|
||||
<?php esc_html_e('Disaster Recovery', 'duplicator-pro'); ?>
|
||||
<div class="badge <?php echo esc_attr($badgeClass); ?> margin-right-1">
|
||||
<?php echo esc_html($badgeLabel); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div id="dupli-recovery-details-select-entry" class="dupli-recovery-info-set" >
|
||||
<?php
|
||||
RecoveryController::renderRecoveryWidged([
|
||||
'selector' => true,
|
||||
'subtitle' => '',
|
||||
'copyLink' => true,
|
||||
'copyButton' => true,
|
||||
'launch' => false,
|
||||
'download' => true,
|
||||
'info' => true,
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="dupli-recovery-not-required">
|
||||
<i class="far fa-arrow-alt-circle-right"></i>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'The Recovery Point is not mandatory to perform an import.
|
||||
However, it can assist in restoring this site if there is a problem during install.
|
||||
If you have no need to recover this site then you can continue without creating the Recovery Point.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><br/>
|
||||
|
||||
<div class="dupli-import-box closable opened" >
|
||||
<div class="box-title" >
|
||||
<?php esc_html_e('System Overview', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div id="dupli-recovery-details-overview" >
|
||||
<div>
|
||||
<?php esc_html_e("This site currently contains", 'duplicator-pro'); ?>:
|
||||
</div>
|
||||
|
||||
<table class="margin-left-2" >
|
||||
<?php foreach ($postTypeCount as $label => $count) { ?>
|
||||
<tr>
|
||||
<td><?php echo esc_html($label); ?></td>
|
||||
<td class="text-right"><?php echo (int) $count; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<p>
|
||||
<?php esc_html_e("This process will:", 'duplicator-pro') ?>
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<i class="far fa-check-circle"></i>
|
||||
<?php esc_html_e("Launch the interactive installer wizard to install this new Backup.", 'duplicator-pro'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dupli-import-confirm-buttons">
|
||||
<input
|
||||
id="dupli-import-launch-installer-cancel"
|
||||
type="button" class="button secondary hollow small recovery-reset"
|
||||
value="<?php esc_attr_e('Cancel', 'duplicator-pro'); ?>"
|
||||
>
|
||||
<button
|
||||
id="dupli-import-launch-installer-confirm"
|
||||
type="button"
|
||||
class="button primary small"
|
||||
onclick="DupliJs.ImportManager.confirmLaunchInstaller();"
|
||||
>
|
||||
<i class="fa fa-bolt fa-sm"></i> <?php esc_html_e('Launch Installer', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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 class="dupli-tab-content-wrapper" >
|
||||
<div id="dupli-import-phase-one" >
|
||||
<?php $tplMng->render('admin_pages/import/step1/import-step1'); ?>
|
||||
</div>
|
||||
<div id="dupli-import-phase-two" class="no-display" >
|
||||
<?php $tplMng->render('admin_pages/import/import-step2'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$tplMng->render('admin_pages/tools/recovery/widget/recovery-widget-scripts');
|
||||
|
||||
$tplMng->render('admin_pages/import/import-scripts');
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\SettingsPageController;
|
||||
use Duplicator\Core\Controllers\ControllersManager;
|
||||
use Duplicator\Core\Controllers\SubMenuItem;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string,mixed> $tplData
|
||||
* @var string $pageTitle
|
||||
*/
|
||||
$pageTitle = $tplData['pageTitle'];
|
||||
/** @var string */
|
||||
$templateSecondaryPart = ($tplData['templateSecondaryPart'] ?? '');
|
||||
/** @var array<string,mixed> */
|
||||
$templateSecondaryArgs = ($tplData['templateSecondaryArgs'] ?? []);
|
||||
/** @var bool $blur */
|
||||
$blur = $tplData['blur'];
|
||||
|
||||
$importSettingsUrl = $ctrlMng->getMenuLink(
|
||||
ControllersManager::SETTINGS_SUBMENU_SLUG,
|
||||
SettingsPageController::L2_SLUG_IMPORT
|
||||
);
|
||||
|
||||
$items = [];
|
||||
$item = new SubMenuItem(
|
||||
'mode-upload-tab',
|
||||
__('Import File', 'duplicator-pro'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$item->link = '';
|
||||
$item->active = true;
|
||||
$item->attributes = ['data-tab-target' => "dupli-import-upload-file-tab"];
|
||||
$items[] = $item;
|
||||
|
||||
$item = new SubMenuItem(
|
||||
'mode-remote-tab',
|
||||
__('Import Link', 'duplicator-pro'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$item->link = '';
|
||||
$item->active = false;
|
||||
$item->attributes = ['data-tab-target' => "dupli-import-remote-file-tab"];
|
||||
$items[] = $item;
|
||||
|
||||
$item = new SubMenuItem(
|
||||
'import-settings',
|
||||
__('Settings', 'duplicator-pro'),
|
||||
'',
|
||||
true
|
||||
);
|
||||
$item->link = $importSettingsUrl;
|
||||
$item->active = false;
|
||||
$items[] = $item;
|
||||
?>
|
||||
|
||||
<div class="dup-body-header">
|
||||
<h1><?php echo esc_html($pageTitle); ?></h1>
|
||||
<?php
|
||||
if (!$blur) {
|
||||
$tplMng->render('parts/tabs_menu_l2', ['menuItemsL2' => $items]);
|
||||
}
|
||||
if (strlen($templateSecondaryPart) > 0) {
|
||||
$tplMng->render($templateSecondaryPart, $templateSecondaryArgs);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<hr class="wp-header-end margin-top-0">
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\ImportPageController;
|
||||
use Duplicator\Models\GlobalEntity;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
if (GlobalEntity::getInstance()->import_chunk_size == 0) {
|
||||
$footerChunkInfo = sprintf(__('<b>Chunk Size:</b> N/A | <b>Max Size:</b> %s', 'duplicator-pro'), size_format(wp_max_upload_size()));
|
||||
$toolTipContent = __('If you need to upload a larger file, go to [Settings > Import] and set Upload Chunk Size', 'duplicator-pro');
|
||||
} else {
|
||||
$footerChunkInfo = sprintf(
|
||||
__(
|
||||
'<b>Chunk Size:</b> %s | <b>Max Size:</b> No Limit',
|
||||
'duplicator-pro'
|
||||
),
|
||||
size_format(ImportPageController::getChunkSize() * 1024)
|
||||
);
|
||||
$toolTipContent = __(
|
||||
'The max file size limit is ignored when chunk size is enabled.
|
||||
Use a large chunk size with fast connections and a small size with slower connections.
|
||||
You can change the chunk size by going to [Settings > Import].',
|
||||
'duplicator-pro'
|
||||
);
|
||||
}
|
||||
|
||||
/** @var string */
|
||||
$openTab = $tplData['defSubtab'];
|
||||
|
||||
$hlpUpload = __(
|
||||
'Upload speeds can be affected by different server connections and settings.
|
||||
The chunk size can also impact upload speed [Settings > Import].
|
||||
If adjusting the chunk size doesn\'t help, try these steps to manually upload the archive:',
|
||||
'duplicator-pro'
|
||||
);
|
||||
|
||||
$hlpUpload .= '<ul>' .
|
||||
'<li>' . __('1. Cancel the current upload.', 'duplicator-pro') . '</li>' .
|
||||
'<li>' . __('2. Manually upload the archive to:<br/> <i>/wp-content/duplicator-backups/imports/</i>', 'duplicator-pro') . '</li>' .
|
||||
'<li>' . __('3. Refresh the Import screen.', 'duplicator-pro') . '</li>' .
|
||||
'</ul>';
|
||||
?>
|
||||
<!-- ==============================
|
||||
DRAG/DROP AREA -->
|
||||
<div id="dupli-import-upload-tabs-wrapper" class="dupli-tabs-wrapper margin-bottom-2">
|
||||
<div
|
||||
id="dupli-import-upload-file-tab"
|
||||
class="tab-content <?php echo ($openTab == ImportPageController::L2_TAB_UPLOAD ? '' : 'no-display'); ?>">
|
||||
<div id="dupli-import-upload-file" class="dupli-import-upload-box"></div>
|
||||
<div class="no-display">
|
||||
<div id="dupli-import-upload-file-content" class="center-xy">
|
||||
<i class="fa fa-download fa-2x"></i>
|
||||
<span class="dup-drag-drop-message">
|
||||
<?php esc_html_e("Drag & Drop Backup File Here", 'duplicator-pro'); ?>
|
||||
</span>
|
||||
<input
|
||||
id="dup-import-dd-btn"
|
||||
type="button"
|
||||
class="button secondary hollow button-default dup-import-button margin-0"
|
||||
name="dupli-files"
|
||||
value="<?php esc_attr_e("Select File...", 'duplicator-pro'); ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div id="dupli-import-upload-file-footer">
|
||||
<i
|
||||
class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_html_e("Upload Chunk Size", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($toolTipContent); ?>"></i> <?php echo wp_kses($footerChunkInfo, ['b' => []]); ?> |
|
||||
<span
|
||||
class="pointer link-style"
|
||||
data-tooltip-title="<?php esc_html_e("Improve Upload Speed", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($hlpUpload); ?>">
|
||||
<i><?php esc_html_e('Slow Upload', 'duplicator-pro'); ?></i> <i class="fa-solid fa-question-circle fa-sm dark-gray-color"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
id="dupli-import-remote-file-tab"
|
||||
class="tab-content <?php echo ($openTab == ImportPageController::L2_TAB_REMOTE_URL ? '' : 'no-display'); ?>">
|
||||
<div class="dupli-import-upload-box">
|
||||
<div class="center-xy">
|
||||
<i class="fa fa-download fa-2x"></i>
|
||||
<span class="dup-drag-drop-message">
|
||||
<?php esc_html_e("Import From Link", 'duplicator-pro'); ?>
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
id="dupli-import-remote-url"
|
||||
class="inline-display margin-bottom-0"
|
||||
placeholder="<?php esc_attr_e('Enter Full URL to Archive', 'duplicator-pro'); ?>">
|
||||
<button id="dupli-import-remote-upload" type="button" class="button primary button-default dup-import-button margin-bottom-0">
|
||||
<?php esc_html_e("Upload", 'duplicator-pro'); ?>
|
||||
</button> <br />
|
||||
<small>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'For additional help visit the %1$sonline faq%2$s.',
|
||||
'%1$s and %2$s are <a> tags',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<a href="' . esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-handle-import-install-upload-launch-issues')
|
||||
. '" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @var bool $blur
|
||||
*/
|
||||
|
||||
$blur = $tplData['blur'];
|
||||
|
||||
if ($tplData['adminMessageViewModeSwtich'] && !$blur) {
|
||||
$tplMng->render('admin_pages/import/step1/message-view-mode-switch');
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="dupli-import-header" >
|
||||
<h2 class="title">
|
||||
<b>
|
||||
<?php printf(esc_html__("Step %s of 2: Upload Backup", 'duplicator-pro'), '<span class="red">1</span>'); ?>
|
||||
</b>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="dup-import-header-content-wrapper <?php echo ($blur ? 'dup-mock-blur' : ''); ?>" >
|
||||
<?php $tplMng->render('admin_pages/import/step1/add-file-area'); ?>
|
||||
<?php $tplMng->render('admin_pages/import/step1/packages-list'); ?>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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 class="notice notice-success is-dismissible dupli-admin-notice">
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'The mode has %1$sswitched to advanced%2$s because more backups have been detected in the import folder.',
|
||||
'%1$s and %2$s are opening and closing bold tags (<b> and </b>)',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<b>',
|
||||
'</b>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
|
||||
?>
|
||||
<tr class="dupli-import-no-package-found">
|
||||
<td colspan="4" >
|
||||
<div class="dupli-import-no-package-found-msg">
|
||||
<b><?php esc_html_e("No archive files found!", 'duplicator-pro'); ?></b><br/><br/>
|
||||
<?php esc_html_e("Please upload a Duplicator archive.zip/daf in the area above.", 'duplicator-pro'); ?><br/>
|
||||
<?php esc_html_e("This will start the import process to overwrite the current site.", 'duplicator-pro'); ?>
|
||||
<br/><br/>
|
||||
<a href="<?php echo esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'import-install'); ?>" target="_blank">
|
||||
<?php esc_html_e('How does this work?', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Libs\Snap\SnapString;
|
||||
use Duplicator\Package\Import\PackageImporter;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
/** @var PackageImporter $importObj */
|
||||
$importObj = $tplData['importObj'];
|
||||
|
||||
if ($importObj instanceof PackageImporter) {
|
||||
$name = $importObj->getName();
|
||||
$size = $importObj->getSize();
|
||||
$created = $importObj->getCreated();
|
||||
$archivePath = $importObj->getFullPath();
|
||||
$installPakageUrl = $importObj->getInstallerPageLink();
|
||||
$isImportable = $importObj->isImportable();
|
||||
$funcsEnalbed = true;
|
||||
} else {
|
||||
$name = '';
|
||||
$size = 0;
|
||||
$created = '';
|
||||
$archivePath = '';
|
||||
$installPakageUrl = '';
|
||||
$isImportable = false;
|
||||
$funcsEnalbed = false;
|
||||
}
|
||||
|
||||
$rowClasses = ['dupli-import-package'];
|
||||
if ($isImportable) {
|
||||
$rowClasses[] = 'is-importable';
|
||||
}
|
||||
?>
|
||||
<tr <?php echo strlen($tplData['idRow']) ? 'id="' . esc_attr($tplData['idRow']) . '" ' : ''; ?>
|
||||
class="<?php echo esc_attr(implode(' ', $rowClasses)) ?>"
|
||||
data-path="<?php echo esc_attr($archivePath); ?>">
|
||||
<td class="name">
|
||||
<span class="text"><b><?php echo esc_html($name); ?></b></span>
|
||||
<div class="dupli-import-package-detail no-display">
|
||||
<?php
|
||||
if ($funcsEnalbed) {
|
||||
$importObj->getHtmlDetails();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="size">
|
||||
<span title="<?php printf(esc_attr__('Total %d bytes', 'duplicator-pro'), (int) $size); ?>">
|
||||
<?php echo esc_html(SnapString::byteSize($size)); ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="created">
|
||||
<?php echo esc_html($created); ?>
|
||||
</td>
|
||||
<td class="funcs">
|
||||
<div class="actions <?php echo $funcsEnalbed ? '' : 'no-display'; ?>">
|
||||
<button type="button" class="button secondary hollow margin-bottom-0 small dupli-import-action-package-detail-toggle">
|
||||
<i class="fa fa-caret-down"></i> <?php esc_html_e('Details', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
<span class="separator"></span>
|
||||
<button type="button" class="dupli-import-action-remove button secondary hollow small margin-bottom-0 ">
|
||||
<i class="fa fa-ban"></i> <?php esc_html_e('Remove', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
<span class="separator"></span>
|
||||
<button type="button" class="dupli-import-action-install button primary small margin-bottom-0"
|
||||
data-install-url="<?php echo esc_url($installPakageUrl); ?>"
|
||||
<?php echo $isImportable ? '' : 'disabled'; ?>>
|
||||
<i class="fa fa-bolt fa-sm"></i> <?php esc_html_e('Continue', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class="invalid no-display">
|
||||
<?php esc_html_e('Backup Invalid', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<div class="dupli-loader no-display">
|
||||
<div class="dupli-meter-wrapper">
|
||||
<div class="dupli-meter green">
|
||||
<span style="width: 0%"></span>
|
||||
</div>
|
||||
<span class="text">0%</span>
|
||||
</div>
|
||||
<a href="" class="dupli-import-action-cancel-upload button secondary hollow small margin-bottom-0 button-cancel">
|
||||
<i class="fa fa-ban"></i> <?php esc_html_e('Cancel', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\ImportPageController;
|
||||
use Duplicator\Package\Import\PackageImporter;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
switch ($tplData['viewMode']) {
|
||||
case ImportPageController::VIEW_MODE_ADVANCED:
|
||||
$viewModeClass = 'view-list-item';
|
||||
break;
|
||||
case ImportPageController::VIEW_MODE_BASIC:
|
||||
default:
|
||||
$viewModeClass = 'view-single-item';
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="dupli-import-available-packages" class="<?php echo esc_attr($viewModeClass); ?>" >
|
||||
<table class="dup-import-avail-packs packages-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="name"><?php esc_html_e("Backups", 'duplicator-pro'); ?></th>
|
||||
<th class="size"><?php esc_html_e("Size", 'duplicator-pro'); ?></th>
|
||||
<th class="created"><?php esc_html_e("Created", 'duplicator-pro'); ?></th>
|
||||
<th class="funcs"><?php esc_html_e("Status", 'duplicator-pro'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$importObjs = PackageImporter::getArchiveObjects();
|
||||
if (count($importObjs) === 0) {
|
||||
$tplMng->render('admin_pages/import/step1/package-row-no-found');
|
||||
} else {
|
||||
foreach ($importObjs as $importObj) {
|
||||
$tplMng->render(
|
||||
'admin_pages/import/step1/package-row',
|
||||
[
|
||||
'importObj' => $importObj,
|
||||
'idRow' => '',
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="no-display" >
|
||||
<table id="dupli-import-available-packages-templates">
|
||||
<?php
|
||||
$tplMng->render(
|
||||
'admin_pages/import/step1/package-row',
|
||||
[
|
||||
'importObj' => null,
|
||||
'idRow' => 'dupli-import-row-template',
|
||||
]
|
||||
);
|
||||
$tplMng->render('admin_pages/import/step1/package-row-no-found');
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\SettingsPageController;
|
||||
use Duplicator\Core\CapMng;
|
||||
use Duplicator\Core\Controllers\ControllersManager;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$importSettingsUrl = $ctrlMng->getMenuLink(
|
||||
ControllersManager::SETTINGS_SUBMENU_SLUG,
|
||||
SettingsPageController::L2_SLUG_IMPORT
|
||||
);
|
||||
|
||||
?>
|
||||
<div id="dupli-import-vews-and-opt-wrapper" >
|
||||
<ul class="dupli-toggle-sub-menu">
|
||||
<li>
|
||||
<span class="dupli-toggle" >
|
||||
<span class="button" >
|
||||
<i class="fas fa-bars fa-lg"></i><span class="screen-reader-text">Options</span>
|
||||
</span>
|
||||
</span>
|
||||
<ul>
|
||||
<li class="title"><?php esc_html_e('VIEWS', 'duplicator-pro'); ?></li>
|
||||
<li>
|
||||
<span class="link-style no-decoration dupli-import-view-list <?php echo $tplData['viewMode'] == 'list' ? 'active' : ''; ?>">
|
||||
<?php esc_html_e('Advanced mode', 'duplicator-pro'); ?>
|
||||
<span class="description"><?php esc_html_e('View multiple Backups', 'duplicator-pro') ?></span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class="link-style no-decoration dupli-import-view-single <?php echo $tplData['viewMode'] == 'single' ? 'active' : ''; ?>">
|
||||
<?php esc_html_e('Basic mode', 'duplicator-pro') ?>
|
||||
<span class="description"><?php esc_html_e('View last uploaded Backup', 'duplicator-pro'); ?></span>
|
||||
</span>
|
||||
</li>
|
||||
<li class="title separator"><?php esc_html_e('TOOLS', 'duplicator-pro'); ?></li>
|
||||
<?php if (CapMng::can(CapMng::CAP_SETTINGS, false)) { ?>
|
||||
<li>
|
||||
<a class="no-decoration" href="<?php echo esc_url($importSettingsUrl); ?>" target="_blank">
|
||||
<?php esc_html_e('Import Settings', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<i class="fas fa-external-link-alt fa-small" ></i>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li>
|
||||
<span class="link-style no-decoration dupli-open-help-link">
|
||||
<a href="<?php echo esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'import-install'); ?>" target="_blank">
|
||||
<?php esc_html_e('Quick Start', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<i class="fas fa-external-link-alt fa-small" ></i>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
Reference in New Issue
Block a user