Plugin Directory

source: duplicator/tags/1.5.14/views/settings/storage.php

Last change on this file was 3378310, checked in by andreamk, 6 weeks ago

Staging version 1.5.14

File size: 4.4 KB
Line 
1<?php
2
3use Duplicator\Controllers\StorageController;
4use Duplicator\Core\Controllers\ControllersManager;
5use Duplicator\Libs\Snap\SnapUtil;
6
7defined('ABSPATH') || defined('DUPXABSPATH') || exit;
8
9$action_updated  = false;
10$action_response = esc_html__("Storage Settings Saved", 'duplicator');
11
12// Save results
13if (SnapUtil::sanitizeTextInput(INPUT_POST, 'action') === 'save') {
14    // Nonce check
15    $nonce = SnapUtil::sanitizeTextInput(INPUT_POST, 'dup_storage_settings_save_nonce_field');
16    if (!wp_verify_nonce($nonce, 'dup_settings_save')) {
17        wp_die(esc_html__('Invalid token permissions to perform this request.', 'duplicator'));
18    }
19
20    DUP_Settings::Set('storage_htaccess_off', SnapUtil::sanitizeBoolInput(INPUT_POST, 'storage_htaccess_off'));
21    DUP_Settings::Save();
22    $action_updated = true;
23}
24
25$storageHtaccessCheck = DUP_Settings::Get('storage_htaccess_off');
26$actionUrl            = ControllersManager::getMenuLink(ControllersManager::SETTINGS_SUBMENU_SLUG, 'storage');
27$storagePath          = DUP_Settings::Get('storage_position');
28// Keep the storage path in sync with the storage position to identify the correct storage path after migration
29$storagePath = $storagePath === DUP_Settings::STORAGE_POSITION_WP_CONTENT ? DUP_Settings::getSsdirPathWpCont() : DUP_Settings::getSsdirPathLegacy();
30?>
31<style>
32    div.panel {padding: 20px 5px 10px 10px;}
33    div.area {font-size:16px; text-align: center; line-height: 30px; width:500px; margin:auto}
34    ul.li {padding:2px}
35</style>
36
37<div class="panel">
38    <form id="dup-settings-form" action="<?php echo esc_url($actionUrl); ?>" method="post">
39        <?php wp_nonce_field('dup_settings_save', 'dup_storage_settings_save_nonce_field', false); ?>
40        <input type="hidden" name="action" value="save">
41        <input type="hidden" name="page"   value="duplicator-settings">
42
43        <?php if ($action_updated) : ?>
44            <div id="message" class="notice notice-success is-dismissible dup-wpnotice-box"><p><?php echo esc_html($action_response); ?></p></div>
45        <?php endif; ?>
46
47        <table class="form-table">
48            <tr valign="top">
49                <th scope="row"><label><?php esc_html_e("Storage Location", 'duplicator'); ?></label></th>
50                <td>
51                    <p>
52                        <code><?php echo esc_html($storagePath); ?></code>
53                    </p>
54                    <p class="description">
55                        <?php esc_html_e("Backup files are stored in the wp-content directory for better security and compatibility.", 'duplicator'); ?>
56                        <br/>
57                        <i class="fas fa-server fa-sm"></i>&nbsp;
58                        <span id="duplicator_advanced_storage_text" class="link-style">[<?php esc_html_e("More Advanced Storage Options...", 'duplicator'); ?>]</span>
59                    </p>
60                </td>
61            </tr>
62            <tr valign="top">
63                <th scope="row"><label><?php esc_html_e("Apache .htaccess", 'duplicator'); ?></label></th>
64                <td>
65                    <input type="checkbox" name="storage_htaccess_off" id="storage_htaccess_off" <?php checked($storageHtaccessCheck); ?> />
66                    <label for="storage_htaccess_off"><?php esc_html_e("Disable .htaccess file in storage directory", 'duplicator') ?> </label>
67                    <p class="description">
68                        <?php
69                            esc_html_e("When checked this setting will prevent Duplicator from laying down an .htaccess file in the storage location above.", 'duplicator');
70                            esc_html_e("Only disable this option if issues occur when downloading either the installer/archive files.", 'duplicator');
71                        ?>
72                    </p>
73                </td>
74            </tr>
75        </table>
76        <p class="submit" style="margin: 20px 0px 0xp 5px;">
77            <br/>
78            <input type="submit" name="submit" id="submit" class="button-primary" value="<?php esc_attr_e("Save Storage Settings", 'duplicator') ?>" style="display: inline-block;" />
79        </p>
80    </form>
81    <br/>
82</div>
83<!-- ==========================================
84THICK-BOX DIALOGS: -->
85<?php
86$storageAlert = StorageController::getDialogBox('settings-storage-tab');
87?>
88<script>
89    jQuery(document).ready(function ($) {
90        $("#duplicator_advanced_storage_text").click(function () {
91<?php $storageAlert->showAlert(); ?>
92        });
93    });
94</script>
Note: See TracBrowser for help on using the repository browser.