PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.0
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.0
4.11.0 4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / views / settings / tabs / general.php
wp-staging / views / settings / tabs Last commit date
general.php 1 day ago mail-settings.php 4 months ago remote-sync-settings.php 1 month ago temporary-login.php 1 month ago
general.php
760 lines
1 <?php
2
3 use WPStaging\Core\WPStaging;
4 use WPStaging\Framework\Facades\Escape;
5 use WPStaging\Framework\Language\Language;
6 use WPStaging\Framework\Facades\Hooks;
7 use WPStaging\Framework\Facades\UI\Toggle;
8 use WPStaging\Framework\Security\EncryptionNoticeService;
9 use WPStaging\Framework\Settings\Settings;
10 use WPStaging\Backup\BackupScheduler;
11 use WPStaging\Notifications\Notifications;
12 use WPStaging\Framework\Adapter\Directory;
13 use WPStaging\Framework\BackgroundProcessing\Queue;
14
15 $directory = WPStaging::make(Directory::class);
16 ?>
17
18 <!-- General Settings -->
19 <div class="wpstg-general-settings-wrapper">
20 <?php if (isset($_GET['settings-updated']) && $_GET['settings-updated'] === 'true') : ?>
21 <div class="wpstg-callout wpstg-callout-success wpstg-mb-6">
22 <svg class="wpstg-h-5 wpstg-w-5 wpstg-flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
23 <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
24 </svg>
25 <span class="wpstg-text-sm wpstg-font-medium">
26 <?php esc_html_e('Settings updated.', 'wp-staging'); ?>
27 </span>
28 </div>
29 <?php endif; ?>
30 <div class="wpstg-provider-page-header">
31 <h1 class="wpstg-text-2xl wpstg-font-semibold wpstg-text-slate-900 dark:wpstg-text-slate-100"><?php esc_html_e('General Settings', 'wp-staging'); ?></h1>
32 <p class="wpstg-mt-1 wpstg-text-sm wpstg-text-slate-600 dark:wpstg-text-slate-400"><?php esc_html_e('Configure your staging and backup preferences', 'wp-staging'); ?></p>
33 </div>
34 <div class="wpstg-settings-container">
35 <div class="wpstg-quick-access">
36 <div class="wpstg-quick-card wpstg-card">
37 <div class="wpstg-quick-icon">
38 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/></svg>
39 </div>
40 <div class="wpstg-quick-content">
41 <h3><?php esc_html_e('Database Management', 'wp-staging'); ?></h3>
42 <p><?php esc_html_e('Optimize copy and search operations', 'wp-staging'); ?></p>
43 </div>
44 </div>
45
46 <div class="wpstg-quick-card wpstg-card">
47 <div class="wpstg-quick-icon">
48 <svg class="wpstg-icon-green" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
49 <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
50 </svg>
51 </div>
52 <div class="wpstg-quick-content wpstg-icon-blue">
53 <h3><?php esc_html_e('Security & Access', 'wp-staging'); ?></h3>
54 <p><?php esc_html_e('Control user permissions and access', 'wp-staging'); ?></p>
55 </div>
56 </div>
57
58 <div class="wpstg-quick-card wpstg-card">
59 <div class="wpstg-quick-icon">
60 <svg class="wpstg-icon-blue" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
61 <circle cx="12" cy="12" r="3"></circle>
62 <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
63 </svg>
64 </div>
65 <div class="wpstg-quick-content">
66 <h3><?php esc_html_e('Advanced Options', 'wp-staging'); ?></h3>
67 <p><?php esc_html_e('Fine-tune performance settings', 'wp-staging'); ?></p>
68 </div>
69 </div>
70 </div>
71 <form class="wpstg-settings-form" method="post" action="options.php">
72 <?php
73 settings_fields("wpstg_settings");
74
75 foreach ($tabs as $id => $name) :
76 if ($id === 'mail-settings' || $id === 'remote-storages' || $id === 'temporary-login' || $id === 'remote-sync-settings') {
77 continue;
78 }
79
80 /** @var \WPStaging\Core\Forms\Form */
81 $form = \WPStaging\Core\WPStaging::getInstance()->get("forms")->get($id);
82
83 if ($form === null) {
84 continue;
85 }
86 ?>
87 <div class="wpstg-settings-grid" id="<?php echo esc_attr($id) ?>__wpstg_header">
88 <div class="wpstg-settings-column">
89 <div class="wpstg-settings-card wpstg-card wpstg-settings-card-first">
90 <div class="wpstg-settings-card-header">
91 <h3 class="wpstg-settings-card-title"><?php echo esc_html__("Staging: Database & performance", "wp-staging");?></h3>
92 <p class="wpstg-settings-card-description">
93 <?php echo esc_html__("Configure database operations and performance optimization settings", "wp-staging");?>
94 </p>
95 </div>
96 <div class="wpstg-settings-card-body">
97 <div class="wpstg-settings-field wpstg-settings-has-toggle">
98 <div>
99 <div class="wpstg-settings-field-header">
100 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[queryLimit]"); ?></span>
101 <span class="wpstg-settings-field-badge wpstg-recommended"><?php echo esc_html__('Recommended', 'wp-staging');?></span>
102 </div>
103 <div class="wpstg-settings-field-description">
104 <?php
105 esc_html_e(
106 "Number of DB rows, that are queried within one request.
107 The higher the value the faster the database copy process.
108 To find out the highest possible values try a high value like 10.000 or more. If you get timeout issues, lower it
109 until you get no more errors during copying process.",
110 "wp-staging"
111 ); ?>
112 </div>
113 <div class="wpstg-settings-default-value">
114 <div>Default:</div>
115 <div>10000</div>
116 </div>
117 </div>
118 <div class="wpstg-settings-field-input">
119 <?php $form->renderInput("wpstg_settings[queryLimit]"); ?>
120 </div>
121 </div>
122 <div class="wpstg-settings-field wpstg-settings-has-toggle">
123 <div>
124 <div class="wpstg-settings-field-header">
125 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[querySRLimit]"); ?></span>
126 </div>
127 <div class="wpstg-settings-field-description">
128 <?php esc_html_e("Number of DB rows processed within one request for search and replace operations. Memory intensive process - lower values for large databases.", "wp-staging"); ?>
129 </div>
130 <div class="wpstg-settings-default-value">
131 <div>Default:</div>
132 <div>5000</div>
133 </div>
134 </div>
135 <div class="wpstg-settings-field-input">
136 <?php $form->renderInput("wpstg_settings[querySRLimit]"); ?>
137 </div>
138 </div>
139 <div class="wpstg-settings-field wpstg-settings-has-toggle">
140 <div>
141 <div class="wpstg-settings-field-header">
142 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[fileLimit]"); ?></span>
143 </div>
144 <div class="wpstg-settings-field-description">
145 <?php esc_html_e("Number of files copied within one request. Higher values speed up file copying but may cause timeouts with large file sets.", "wp-staging"); ?>
146 </div>
147 <div class="wpstg-settings-default-value">
148 <div>Default:</div>
149 <div>50</div>
150 </div>
151 </div>
152 <div class="wpstg-settings-field-input wpstg-select">
153 <?php $form->renderInput("wpstg_settings[fileLimit]"); ?>
154 </div>
155 </div>
156 <div class="wpstg-settings-field wpstg-settings-has-toggle">
157 <div>
158 <div class="wpstg-settings-field-header">
159 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[maxFileSize]"); ?></span>
160 </div>
161 <div class="wpstg-settings-field-description">
162 <?php esc_html_e("Maximum size of files that can be copied. Files larger than this will be skipped to prevent memory issues during staging.", "wp-staging"); ?>
163 </div>
164 <div class="wpstg-settings-default-value">
165 <div>Default:</div>
166 <div>8 MB</div>
167 </div>
168 </div>
169 <div class="wpstg-settings-field-input">
170 <?php $form->renderInput("wpstg_settings[maxFileSize]"); ?>
171 </div>
172 </div>
173 <div class="wpstg-settings-field wpstg-settings-has-toggle">
174 <div>
175 <div class="wpstg-settings-field-header">
176 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[batchSize]"); ?></span>
177 </div>
178 <div class="wpstg-settings-field-description">
179 <?php
180 esc_html_e(
181 "Buffer size for the file copy process in megabytes.
182 The higher the value the faster large files are copied.
183 To find out the highest possible values try a high one and lower it until
184 you get no more errors during file copy process. Usually this value correlates directly
185 with the memory consumption of PHP so make sure that
186 it does not exceed any php.ini max_memory limits.",
187 "wp-staging"
188 ); ?>
189 </div>
190 <div class="wpstg-settings-default-value">
191 <div>Default:</div>
192 <div>2 MB</div>
193 </div>
194 </div>
195 <div class="wpstg-settings-field-input">
196 <?php $form->renderInput("wpstg_settings[batchSize]"); ?>
197 </div>
198 </div>
199 <div class="wpstg-settings-field wpstg-settings-has-toggle">
200 <div>
201 <div class="wpstg-settings-field-header">
202 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[cpuLoad]"); ?></span>
203 </div>
204 <div class="wpstg-settings-field-description">
205 <?php esc_html_e("Using HIGH results in faster processing but higher CPU load. Using lower values reduces server load but slows staging site creation.", "wp-staging"); ?>
206 </div>
207 <div class="wpstg-settings-default-value">
208 <div>Default:</div>
209 <div>Low</div>
210 </div>
211 </div>
212 <div class="wpstg-settings-field-input wpstg-select">
213 <?php $form->renderInput("wpstg_settings[cpuLoad]"); ?>
214 </div>
215 </div>
216 </div>
217 </div>
218 <!-- Backups Settings -->
219 <div id="wpstg-backups" class="wpstg-settings-card wpstg-card wpstg-settings-card-first">
220 <div class="wpstg-settings-card-header">
221 <h3 class="wpstg-settings-card-title"><?php esc_html_e("Backups", "wp-staging");?></h3>
222 <p class="wpstg-settings-card-description"><?php esc_html_e("Configure how backups are created and stored.", "wp-staging");?></p>
223 </div>
224 <div class="wpstg-settings-card-body">
225 <?php if (!defined('WPSTGPRO_VERSION')) : ?>
226 <div class="wpstg-settings-field wpstg-settings-has-toggle">
227 <div>
228 <div class="wpstg-settings-field-header">
229 <span class="wpstg-settings-field-label"><?php esc_html_e('Compress Backups', 'wp-staging') ?></span>
230 <a href="<?php echo esc_url(Language::getUpgradeUrl('compress_backups')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
231 </div>
232 <div class="wpstg-settings-field-description">
233 <?php echo esc_html__('This reduces backup size by up to 60%, making it especially useful for large databases.', 'wp-staging'); ?>
234 </div>
235 </div>
236 <div class="wpstg-settings-field-input">
237 <?php
238 Toggle::render('wpstg-compress-backups', 'wpstg_settings[enableCompression]', 'false', false, ['classes' => 'wpstg-settings-field', 'isDisabled' => true]);
239 ?>
240 </div>
241 </div>
242 <?php else : ?>
243 <div class="wpstg-settings-field wpstg-settings-has-toggle">
244 <div>
245 <div class="wpstg-settings-field-header">
246 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[enableCompression]"); ?></span>
247 <span class="wpstg-settings-field-badge wpstg-recommended"><?php echo esc_html__('Recommended', 'wp-staging');?></span>
248 </div>
249 <div class="wpstg-settings-field-description">
250 <?php echo esc_html__('This reduces backup size by up to 60%, making it especially useful for large databases.', 'wp-staging'); ?>
251 </div>
252 </div>
253 <div class="wpstg-settings-field-input">
254 <?php $form->renderInput("wpstg_settings[enableCompression]"); ?>
255 </div>
256 </div>
257 <?php endif; ?>
258 <div class="wpstg-settings-field wpstg-settings-has-toggle">
259 <div>
260 <div class="wpstg-settings-field-header">
261 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[enableBackupBeforeUpdate]"); ?></span>
262 <span class="wpstg-settings-field-badge wpstg-recommended"><?php esc_html_e('Recommended', 'wp-staging'); ?></span>
263 </div>
264 <div class="wpstg-settings-field-description">
265 <?php esc_html_e('Prompt to create a backup before installing plugin, theme, or WordPress core updates. Turn this off and on again to reset your saved choice for future updates.', 'wp-staging'); ?>
266 </div>
267 </div>
268 <div class="wpstg-settings-field-input">
269 <?php $form->renderInput("wpstg_settings[enableBackupBeforeUpdate]"); ?>
270 </div>
271 </div>
272 </div>
273 </div>
274 <!-- /Backups Settings -->
275
276 <!-- Notifications Settings -->
277 <div id="wpstg-notifications" class="wpstg-settings-card wpstg-card">
278 <div class="wpstg-settings-card-header">
279 <h3 class="wpstg-settings-card-title"><?php esc_html_e("Notifications", "wp-staging");?></h3>
280 <p class="wpstg-settings-card-description"><?php esc_html_e("Configure email and Slack alerts for backup and remote sync events.", "wp-staging");?></p>
281 </div>
282 <div class="wpstg-settings-card-body">
283 <div class="wpstg-settings-field wpstg-settings-has-toggle wpstg-notification-toggles">
284 <div class="wpstg-notification-toggles-header">
285 <span class="wpstg-settings-field-label"><?php esc_html_e('Email Notifications', 'wp-staging'); ?></span>
286 </div>
287 <div class="wpstg-notification-toggles-input">
288 <div class="wpstg-notification-toggle-row">
289 <div class="wpstg-notification-toggle-label">
290 <?php esc_html_e('Errors', 'wp-staging'); ?>
291 </div>
292 <div class="wpstg-notification-toggle-switch">
293 <?php
294 $isErrorCheckboxChecked = get_option(BackupScheduler::OPTION_BACKUP_SCHEDULE_ERROR_REPORT) === 'true';
295 Toggle::render('wpstg-send-schedules-error-report', 'wpstg_settings[schedulesErrorReport]', 'true', $isErrorCheckboxChecked, ['classes' => 'wpstg-settings-field']);
296 ?>
297 </div>
298 </div>
299 <div class="wpstg-notification-toggle-row">
300 <div class="wpstg-notification-toggle-label">
301 <?php esc_html_e('Warnings', 'wp-staging'); ?>
302 </div>
303 <div class="wpstg-notification-toggle-switch">
304 <?php
305 $isWarningCheckboxChecked = get_option(BackupScheduler::OPTION_BACKUP_SCHEDULE_WARNING_REPORT) === 'true';
306 Toggle::render('wpstg-send-schedules-warning-report', 'wpstg_settings[schedulesWarningReport]', 'true', $isWarningCheckboxChecked, ['classes' => 'wpstg-settings-field']);
307 ?>
308 </div>
309 </div>
310 <div class="wpstg-notification-toggle-row">
311 <div class="wpstg-notification-toggle-label">
312 <?php esc_html_e('General Backup Status', 'wp-staging'); ?>
313 </div>
314 <div class="wpstg-notification-toggle-switch">
315 <?php
316 $isGeneralCheckboxChecked = get_option(BackupScheduler::OPTION_BACKUP_SCHEDULE_GENERAL_REPORT) === 'true';
317 Toggle::render('wpstg-send-schedules-general-report', 'wpstg_settings[schedulesGeneralReport]', 'true', $isGeneralCheckboxChecked, ['classes' => 'wpstg-settings-field']);
318 ?>
319 </div>
320 </div>
321 </div>
322 </div>
323 <div class="wpstg-email-controls-container wpstg-two-column-settings <?php echo $isErrorCheckboxChecked || $isWarningCheckboxChecked || $isGeneralCheckboxChecked ? '' : 'hidden';?>" id="wpstg-send-schedules-email-notification-input">
324 <div class="wpstg-settings-field wpstg-settings-has-toggle">
325 <div>
326 <div class="wpstg-settings-field-header">
327 <span class="wpstg-settings-field-label"><?php esc_html_e('Email Address', 'wp-staging'); ?></span>
328 </div>
329 <div class="wpstg-settings-field-description">
330 <?php esc_html_e('Send emails to this address', 'wp-staging'); ?>
331 </div>
332 </div>
333 <div class="wpstg-settings-field-input">
334 <input type="text" id="wpstg-send-schedules-report-email" name="wpstg_settings[schedulesReportEmail]" value="<?php echo esc_attr(get_option(Notifications::OPTION_BACKUP_SCHEDULE_REPORT_EMAIL)) ?>"/>
335 </div>
336 <div>
337 <div class="wpstg-settings-field-header">
338 <span class="wpstg-settings-field-label"><?php esc_html_e('Email as HTML', 'wp-staging') ?></span>
339 </div>
340 <div class="wpstg-settings-field-description">
341 <?php esc_html_e('Send emails as HTML', 'wp-staging') ?>
342 </div>
343 </div>
344 <div class="wpstg-settings-field-input">
345 <?php
346 $isCheckboxChecked = get_option(\WPStaging\Notifications\Notifications::OPTION_SEND_EMAIL_AS_HTML) === 'true';
347 Toggle::render('wpstg-send-email-as-html', 'wpstg_settings[emailAsHTML]', 'true', $isCheckboxChecked);
348 ?>
349 </div>
350 </div>
351 </div>
352 <?php
353 $attrDisabled = defined('WPSTGPRO_VERSION') ? '' : ' disabled';
354 ?>
355 <div class="wpstg-settings-field wpstg-settings-has-toggle">
356 <div>
357 <div class="wpstg-settings-field-header">
358 <span class="wpstg-settings-field-label"><?php esc_html_e('Slack Notifications', 'wp-staging'); ?></span>
359 <?php if (!defined('WPSTGPRO_VERSION')) : ?>
360 <a href="<?php echo esc_url(Language::getUpgradeUrl('slack_notifications')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
361 <?php endif; ?>
362 </div>
363 <div class="wpstg-settings-field-description">
364 <?php esc_html_e('If a scheduled backup fails, send a report to the Slack channel.', 'wp-staging'); ?>
365 </div>
366 </div>
367 <div class="wpstg-settings-field-input">
368 <?php
369 $isCheckboxChecked = get_option(BackupScheduler::OPTION_BACKUP_SCHEDULE_SLACK_ERROR_REPORT) === 'true';
370 Toggle::render('wpstg-send-schedules-slack-error-report', 'wpstg_settings[schedulesSlackErrorReport]', 'true', $isCheckboxChecked, ['classes' => 'wpstg-settings-field', 'isDisabled' => !empty($attrDisabled)]);
371 ?>
372 </div>
373 </div>
374 <div class="wpstg-settings-field <?php echo $isCheckboxChecked && defined('WPSTGPRO_VERSION') ? '' : 'hidden';?>" id="wpstg-send-schedules-slack-error-report-input">
375 <div>
376 <div class="wpstg-settings-field-header">
377 <label for="wpstg-send-schedules-report-slack-webhook" class="wpstg-settings-field-label"><?php esc_html_e('Slack Webhook URL', 'wp-staging'); ?></label>
378 </div>
379 <div class="wpstg-settings-field-description">
380 <?php
381 $link = '<a href="https://api.slack.com/messaging/webhooks" target="_blank" rel="noopener">' .
382 esc_html__('Slack webhooks documentation', 'wp-staging') .
383 '</a>';
384 echo wp_kses_post(sprintf(
385 /* translators: %s is a link to Slack webhook documentation */
386 Escape::escapeHtml(__('Send Slack notifications by using a Webhook URL. Read the %s to learn how to create one.', 'wp-staging')),
387 $link
388 ));
389 ?>
390 </div>
391 </div>
392 <div class="wpstg-settings-field-input">
393 <input type="text" id="wpstg-send-schedules-report-slack-webhook" name="wpstg_settings[schedulesReportSlackWebhook]" class="wpstg-settings-field" value="<?php echo esc_attr(get_option(BackupScheduler::OPTION_BACKUP_SCHEDULE_REPORT_SLACK_WEBHOOK)) ?>"<?php echo esc_attr($attrDisabled);?>/>
394 </div>
395 </div>
396 </div>
397 </div>
398 <!-- /Notifications Settings -->
399 </div>
400 <div class="wpstg-settings-column">
401 <!-- Access Control Settings -->
402 <div class="wpstg-settings-card wpstg-card wpstg-settings-card-fixed">
403 <div class="wpstg-settings-card-header">
404 <h3 class="wpstg-settings-card-title"><?php esc_html_e("Access Control", "wp-staging");?></h3>
405 <p class="wpstg-settings-card-description"><?php esc_html_e("Manage user permissions and access control for staging operations", "wp-staging");?></p>
406 </div>
407 <div class="wpstg-settings-card-body">
408 <?php if (defined("WPSTGPRO_VERSION")) : ?>
409 <?php Hooks::callInternalHook(Settings::ACTION_WPSTG_PRO_SETTINGS, [$form]); ?>
410 <?php else :?>
411 <div class="wpstg-settings-field wpstg-settings-has-toggle">
412 <div>
413 <div class="wpstg-settings-field-header">
414 <span class="wpstg-settings-field-label">
415 <?php echo esc_html__("Keep Permalinks", "wp-staging"); ?>
416 </span>
417 <a href="<?php echo esc_url(Language::getUpgradeUrl('keep_permalinks')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
418 </div>
419 <div class="wpstg-settings-field-description">
420 <?php
421 echo wp_kses_post(sprintf(
422 __(
423 'Use on the staging site the same permalink structure and do not set permalinks to plain structure. <br/>Read more: <a href="%1$s" target="_blank">Permalink Settings</a> ',
424 'wp-staging'
425 ),
426 'https://wp-staging.com/docs/activate-permalinks-staging-site/'
427 )); ?>
428 </div>
429 </div>
430 <div class="wpstg-settings-field-input">
431 <?php Toggle::render('wpstg-keep-permalinks', 'wpstg-keep-permalinks', 'false', false, ['classes' => 'wpstg-settings-field', 'isDisabled' => true]); ?>
432 </div>
433 </div>
434
435 <div class="wpstg-settings-field">
436 <div>
437 <div class="wpstg-settings-field-header">
438 <span class="wpstg-settings-field-label">
439 <?php echo esc_html__("Access Permissions", "wp-staging"); ?>
440 </span>
441 <a href="<?php echo esc_url(Language::getUpgradeUrl('access_permissions')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
442 </div>
443 <div class="wpstg-settings-field-description">
444 <?php
445 echo Escape::escapeHtml(__(
446 'Select the user role you want to give access to the staging site. You can select multiple roles by holding CTRL or ⌘ Cmd key while clicking. <strong>Change this option on the staging site if you want to change the authentication behavior there.</strong>',
447 'wp-staging'
448 )); ?>
449 </div>
450 </div>
451 <div class="wpstg-settings-field-input wpstg-select wpstg-multi-select">
452 <?php
453 $roles = wp_roles()->get_names();
454 echo '<select multiple disabled>';
455 echo '<option value="all">Allow access from all visitors</option>';
456
457 foreach ($roles as $key => $name) {
458 echo '<option value="' . esc_attr($key) . '">' . esc_html($name) . '</option>';
459 }
460
461 echo '</select>';
462 ?>
463 </div>
464 </div>
465 <div class="wpstg-settings-field">
466 <div>
467 <div class="wpstg-settings-field-header">
468 <label class="wpstg-settings-field-label">
469 <?php echo esc_html__("Users With Staging Access", "wp-staging"); ?>
470 </label>
471 <a href="<?php echo esc_url(Language::getUpgradeUrl('staging_access_users')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
472 </div>
473 <div class="wpstg-settings-field-description">
474 <?php
475 echo Escape::escapeHtml(__(
476 'Specify users who will have access to the staging site regardless of their role. You can enter multiple user names separated by a comma. <strong>Change this option on the staging site if you want to change the authentication behavior there.</strong>',
477 'wp-staging'
478 )); ?>
479 </div>
480 </div>
481 <div class="wpstg-settings-field-input">
482 <input type="text" value="" name="wpstg-users-with-staging-access" disabled>
483 </div>
484 </div>
485 <div class="wpstg-settings-field wpstg-settings-has-toggle">
486 <div>
487 <div class="wpstg-settings-field-header">
488 <label class="wpstg-settings-field-label">
489 <?php echo esc_html__("Admin Bar Background Color", "wp-staging"); ?>
490 </label>
491 <a href="<?php echo esc_url(Language::getUpgradeUrl('admin_bar_color')); ?>" target="_blank" rel="noopener" class="wpstg-button danger wpstg-banner-button"><?php esc_html_e('Upgrade Now', 'wp-staging');?></a>
492 </div>
493 <div class="wpstg-settings-field-description">
494 </div>
495 </div>
496 <div class="wpstg-settings-field-input">
497 <input type="color" value="#ff8d00" disabled>
498 </div>
499 </div>
500 <div class="wpstg-settings-field wpstg-settings-has-toggle">
501 <div>
502 <div class="wpstg-settings-field-header">
503 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[disableAdminLogin]"); ?></span>
504 </div>
505 <div class="wpstg-settings-field-description">
506 <?php esc_html_e("Disable the additional login form on the staging site. Search engine indexing is always blocked via the 'noindex' tag, regardless of this setting.", "wp-staging"); ?>
507 </div>
508 </div>
509 <div class="wpstg-settings-field-input">
510 <?php $form->renderInput("wpstg_settings[disableAdminLogin]"); ?>
511 </div>
512 </div>
513 <?php endif; ?>
514 <?php if (defined('WPSTGPRO_VERSION') && $this->siteInfo->isStagingSite()) : ?>
515 <div class="wpstg-settings-field wpstg-settings-has-toggle">
516 <div>
517 <div class="wpstg-settings-field-header">
518 <span class="wpstg-settings-field-label">
519 <?php esc_html_e('Allow Cloning (Staging Site Only)', 'wp-staging') ?>
520 </span>
521 </div>
522 <div class="wpstg-settings-field-description">
523 <?php esc_html_e('Check this box to make this staging site cloneable.', 'wp-staging') ?>
524 <?php echo sprintf(__("If you would like to know more about cloning staging sites check out <a href='%s' target='_new'>this article</a>.", 'wp-staging'), 'https://wp-staging.com/docs/cloning-a-staging-site-testing-push-method/'); ?>
525 </div>
526 </div>
527 <div class="wpstg-settings-field-input">
528 <?php Toggle::render('wpstg-is-staging-cloneable', 'wpstg_settings[isStagingSiteCloneable]', 'true', $this->siteInfo->isCloneable(), ['classes' => 'wpstg-settings-field']); ?>
529 </div>
530 </div>
531 <?php endif; ?>
532 </div>
533 </div>
534 <!-- Access Control Settings -->
535 <!-- Debug & System Settings -->
536 <div class="wpstg-settings-card wpstg-card">
537 <div class="wpstg-settings-card-header">
538 <h3 class="wpstg-settings-card-title"><?php esc_html_e("System & Debugging", "wp-staging");?></h3>
539 <p class="wpstg-settings-card-description"><?php esc_html_e("Advanced system settings and debugging options", "wp-staging");?></p>
540 </div>
541 <div class="wpstg-settings-card-body">
542 <div class="wpstg-settings-field wpstg-settings-has-toggle">
543 <div>
544 <div class="wpstg-settings-field-header">
545 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[debugMode]"); ?></span>
546 <span class="wpstg-settings-field-badge wpstg-caution"><?php echo esc_html__('Caution', 'wp-staging');?></span>
547 </div>
548 <div class="wpstg-settings-field-description">
549 <?php
550 esc_html_e(
551 "Enable a debug mode that creates log entries in wp-content/uploads/wp-staging/logs/logfile.log.",
552 "wp-staging"
553 );
554 ?>
555 <strong>
556 <?php esc_attr_e('It\'s not recommended to activate this until we ask you to do so!', 'wp-staging') ?>
557 </strong>
558 </div>
559 </div>
560 <div class="wpstg-settings-field-input">
561 <?php $form->renderInput("wpstg_settings[debugMode]"); ?>
562 </div>
563 </div>
564
565 <div class="wpstg-settings-field wpstg-settings-has-toggle">
566 <div>
567 <div class="wpstg-settings-field-header">
568 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[optimizer]"); ?></span>
569 <span class="wpstg-settings-field-badge wpstg-recommended"><?php esc_html_e("Recommended", "wp-staging");?></span>
570 </div>
571 <div class="wpstg-settings-field-description">
572 <?php
573 esc_html_e(
574 "The Optimizer is a mu-plugin that disables all other plugins during staging and backup operations.
575 This lowers memory consumption and speeds up processing. It should always be enabled!",
576 "wp-staging"
577 ); ?>
578 </div>
579 </div>
580 <div class="wpstg-settings-field-input">
581 <?php $form->renderInput("wpstg_settings[optimizer]"); ?>
582 </div>
583 </div>
584 <div class="wpstg-settings-field wpstg-settings-has-toggle">
585 <div>
586 <div class="wpstg-settings-field-header">
587 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[unInstallOnDelete]"); ?></span>
588 <span class="wpstg-settings-field-badge wpstg-caution"><?php echo esc_html__('Caution', 'wp-staging');?></span>
589 </div>
590 <div class="wpstg-settings-field-description">
591 <?php
592 esc_html_e(
593 "Remove all WP STAGING settings and data on uninstall. Staging site data, backups, and related database tables will not be deleted unless empty.",
594 "wp-staging"
595 );
596 ?>
597 <br><br>
598 <strong><?php echo esc_html__("Note:", "wp-staging"); ?></strong>
599 <br>
600 <?php
601 echo sprintf(
602 esc_html__("The backups folder %s will only be deleted if it does not contain any backup files.", "wp-staging"),
603 "<strong>" . esc_html($directory->getBackupDirectory()) . "</strong>"
604 );
605 ?>
606 <br>
607 <?php esc_html_e("Staging site data is never deleted while staging sites exist.", "wp-staging");?>
608 </div>
609 </div>
610 <div class="wpstg-settings-field-input">
611 <?php $form->renderInput("wpstg_settings[unInstallOnDelete]"); ?>
612 </div>
613 </div>
614 </div>
615 </div>
616 <!-- Debug & System Settings -->
617 <!-- Network Settings -->
618 <?php $httpAuthCredentials = get_option(Queue::OPTION_HTTP_AUTH_CREDENTIALS, []); ?>
619 <?php $hasHttpAuthCredentials = !empty($httpAuthCredentials['username']); ?>
620 <div class="wpstg-settings-card wpstg-card">
621 <div class="wpstg-settings-card-header">
622 <h3 class="wpstg-settings-card-title !wpstg-me-2"><?php esc_html_e("WP Admin HTTP Basic Auth", "wp-staging"); ?></h3>
623 <p class="wpstg-settings-card-description"><?php esc_html_e("Only fill this in if your /wp-admin is protected with HTTP Basic Authentication (browser login prompt). Background tasks (scans, updates, scheduled jobs) can't access wp-admin without these credentials and may fail. If you don't use HTTP Basic Auth for wp-admin, leave both fields blank.", "wp-staging"); ?></p>
624 </div>
625 <div class="wpstg-settings-card-body">
626 <div class="wpstg-settings-field wpstg-settings-has-toggle">
627 <div>
628 <div class="wpstg-settings-field-header">
629 <label class="wpstg-settings-field-label"><?php esc_html_e('My wp-admin is protected with HTTP Basic Auth', 'wp-staging'); ?></label>
630 </div>
631 </div>
632 <div class="wpstg-settings-field-input">
633 <?php Toggle::render('wpstg-http-basic-auth-active', '', '', $hasHttpAuthCredentials, ['classes' => 'wpstg-settings-field']); ?>
634 </div>
635 </div>
636 <div id="wpstg-http-basic-auth-fields" <?php echo $hasHttpAuthCredentials ? '' : 'class="hidden"'; ?>>
637 <div class="wpstg-mb-4">
638 <?php
639
640 $encryptionNoticeService = WPStaging::make(EncryptionNoticeService::class);
641 $encryptionNoticeService->renderEncryptedNotice(Queue::OPTION_HTTP_AUTH_CREDENTIALS, 'password', 'HTTP Basic Auth');
642 ?>
643 </div>
644 <div class="wpstg-settings-field wpstg-settings-has-toggle">
645 <div>
646 <div class="wpstg-settings-field-header">
647 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[httpAuthUsername]"); ?></span>
648 <span class="wpstg-settings-field-badge wpstg-badge-gray wpstg-icon-person"><?php echo esc_html__('Username', 'wp-staging'); ?></span>
649 </div>
650 <div class="wpstg-settings-field-description">
651 <?php esc_html_e('The HTTP Basic Auth username required to access /wp-admin.', 'wp-staging'); ?>
652 </div>
653 </div>
654 <div class="wpstg-settings-field-input">
655 <div class="wpstg-settings-field-input-with-icon wpstg-icon-person">
656 <?php $form->renderInput("wpstg_settings[httpAuthUsername]"); ?>
657 </div>
658 </div>
659 </div>
660 <div class="wpstg-settings-field wpstg-settings-has-toggle">
661 <div>
662 <div class="wpstg-settings-field-header">
663 <span class="wpstg-settings-field-label"><?php $form->renderLabel("wpstg_settings[httpAuthPassword]"); ?></span>
664 <span class="wpstg-settings-field-badge wpstg-badge-gray wpstg-icon-lock"><?php echo esc_html__('Password', 'wp-staging'); ?></span>
665 </div>
666 <div class="wpstg-settings-field-description">
667 <?php esc_html_e('The HTTP Basic Auth password for the username above.', 'wp-staging'); ?>
668 </div>
669 </div>
670 <div class="wpstg-settings-field-input">
671 <div class="wpstg-password-toggle-wrapper wpstg-settings-field-input-with-icon wpstg-icon-lock">
672 <?php $form->renderInput("wpstg_settings[httpAuthPassword]"); ?>
673 <?php require WPSTG_VIEWS_DIR . '_main/partials/password-toggle-button.php'; ?>
674 </div>
675 </div>
676 </div>
677 <div class="wpstg-callout wpstg-callout-warning wpstg-mt-4">
678 <svg class="wpstg-h-5 wpstg-w-5 wpstg-flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
679 <path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.168 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 6a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 6zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
680 </svg>
681 <span class="wpstg-text-sm wpstg-font-medium">
682 <?php esc_html_e('Without these credentials, background processing may not run on sites with protected wp-admin.', 'wp-staging'); ?>
683 </span>
684 </div>
685 <div class="wpstg-mt-4">
686 <button type="button" class="wpstg-btn wpstg-btn-sm wpstg-btn-secondary" id="wpstg-test-http-auth">
687 <svg class="wpstg-btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
688 <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
689 <polyline points="22 4 12 14.01 9 11.01"></polyline>
690 </svg>
691 <?php esc_html_e('Test Connection', 'wp-staging'); ?>
692 </button>
693 <div id="wpstg-http-auth-test-result" class="wpstg-mt-3 hidden"></div>
694 </div>
695 </div>
696 </div>
697 </div>
698 <!-- Network Settings -->
699 </div>
700 </div>
701 <?php if (defined('WPSTGPRO_VERSION')) : ?>
702 <div class="wpstg-settings-card wpstg-card wpstg-full-width">
703 <div class="wpstg-settings-card-header">
704 <h3 class="wpstg-settings-card-title"><?php esc_html_e("Usage Information", "wp-staging");?></h3>
705 <p class="wpstg-settings-card-description"><?php esc_html_e("Help improve this plugin by sharing anonymous usage data.", "wp-staging");?></p>
706 </div>
707 <div class="wpstg-settings-card-body">
708 <div class="wpstg-settings-field wpstg-settings-has-toggle">
709 <div>
710 <div class="wpstg-settings-field-header">
711 <label class="wpstg-settings-field-label"><?php esc_html_e("Send Usage Information", "wp-staging");?></label>
712 </div>
713 <div class="wpstg-settings-field-description">
714 <?php esc_html_e("Send usage information to wp-staging.com to help improve the plugin. No personal data is collected.", "wp-staging");
715 echo '<br/><i>' . wp_kses_post(sprintf(__('See the data we collect <a href="%s" target="_blank">here</a>', 'wp-staging'), 'https://wp-staging.com/what-data-do-we-collect/')) . '</i>';
716 ?>
717 </div>
718 </div>
719 <div class="wpstg-settings-field-input">
720 <?php
721 $analytics = \WPStaging\Core\WPStaging::make(\WPStaging\Framework\Analytics\AnalyticsConsent::class);
722 $analyticsAllowed = $analytics->hasUserConsent();
723 $isChecked = $analyticsAllowed === '1' || $analyticsAllowed === true;
724 ?>
725 <span id="wpstg-analytics-consent-allowed-link" data-href="<?php echo esc_url($analytics->getConsentLink(true)) ?>"></span>
726 <span id="wpstg-analytics-consent-decline-link" data-href="<?php echo esc_url($analytics->getConsentLink(false)) ?>"></span>
727 <?php
728 Toggle::render('wpstg-analytics-consent', 'analytics_consent', 'true', $isChecked, ['classes' => 'wpstg-settings-field']);
729 ?>
730 </div>
731 </div>
732 </div>
733 </div>
734 <?php endif; ?>
735 <?php
736 endforeach;
737 ?>
738 <div class="wpstg-settings-actions wpstg-card">
739 <button type="button" class="wpstg-btn wpstg-btn-md wpstg-btn-secondary" id="wpstg-reset-settings-to-defaults">
740 <svg class="wpstg-btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
741 <path d="M3 6h18l-2 13H5L3 6z"></path>
742 <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
743 </svg>
744 <?php echo esc_html__('Reset to Defaults', 'wp-staging');?>
745 </button>
746 <button type="submit" class="wpstg-btn wpstg-btn-md wpstg-btn-primary">
747 <svg class="wpstg-btn-icon-sm" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
748 <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"></path>
749 <polyline points="17,21 17,13 7,13 7,21"></polyline>
750 <polyline points="7,3 7,8 15,8"></polyline>
751 </svg>
752 <?php echo esc_html__('Save Changes', 'wp-staging');?>
753 </button>
754 </div>
755 <?php
756 unset($tabs);
757 ?>
758 </form>
759 </div>
760 </div>