partials
2 weeks ago
advanced-exclude-options.php
11 months ago
backup-parts.php
10 months ago
backup-scheduling-options.php
3 days ago
backup-storages.php
3 days ago
backup.php
3 days ago
confirm-restore.php
2 weeks ago
download-modal.php
10 months ago
edit-schedule-modal.php
2 weeks ago
manage-schedules.php
2 weeks ago
remote-upload.php
4 months ago
restore.php
2 weeks ago
upload.php
2 weeks ago
backup-scheduling-options.php
119 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @var Times $time ; |
| 5 | * @var DateTimeImmutable[] $recurrenceTimes |
| 6 | * @var string $disabledProAttribute |
| 7 | * @var string $timeFormatOption |
| 8 | * @var string $urlAssets |
| 9 | * @var bool $isProVersion |
| 10 | * @var bool $hasSchedule * |
| 11 | * @see src/views/backup/modal/backup.php |
| 12 | */ |
| 13 | |
| 14 | use WPStaging\Core\Cron\Cron; |
| 15 | use WPStaging\Framework\Facades\Escape; |
| 16 | use WPStaging\Framework\Facades\UI\Checkbox; |
| 17 | use WPStaging\Framework\Utils\Times; |
| 18 | |
| 19 | $proFeature = $isProVersion ? ' ' : ' (' . __('Pro', 'wp-staging') . ')'; |
| 20 | |
| 21 | ?> |
| 22 | |
| 23 | <div class="hidden" data-show-if-unchecked="repeatBackupOnSchedule"> |
| 24 | <div class="wpstg-backup-schedule-option"> |
| 25 | <label for="backupScheduleRecurrence"> |
| 26 | <?php esc_html_e('How often:', 'wp-staging'); ?> |
| 27 | </label> |
| 28 | <select name="backupScheduleRecurrence" id="backupScheduleRecurrence" class="wpstg-input wpstg-input-md"> |
| 29 | <option value="<?php echo esc_attr(Cron::HOURLY); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::HOURLY)) . esc_html($proFeature); ?></option> |
| 30 | <option value="<?php echo esc_attr(Cron::SIX_HOURS); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::SIX_HOURS)) . esc_html($proFeature); ?></option> |
| 31 | <option value="<?php echo esc_attr(Cron::TWELVE_HOURS); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::TWELVE_HOURS)) . esc_html($proFeature); ?></option> |
| 32 | <option value="<?php echo esc_attr(Cron::DAILY); ?>" selected> <?php echo esc_html(Cron::getCronDisplayName(Cron::DAILY));?></option> |
| 33 | <option value="<?php echo esc_attr(Cron::EVERY_TWO_DAYS); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::EVERY_TWO_DAYS)) . esc_html($proFeature); ?></option> |
| 34 | <?php // Weekly schedules with day selection (1-7: Monday-Sunday, ISO 8601) ?> |
| 35 | <?php for ($day = 1; $day <= 7; $day++) : |
| 36 | $weeklyDay = Cron::WEEKLY . '_' . $day; |
| 37 | ?> |
| 38 | <option value="<?php echo esc_attr($weeklyDay); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName($weeklyDay)) . esc_html($proFeature); ?></option> |
| 39 | <?php endfor; ?> |
| 40 | <option value="<?php echo esc_attr(Cron::EVERY_TWO_WEEKS); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::EVERY_TWO_WEEKS)) . esc_html($proFeature); ?></option> |
| 41 | <option value="<?php echo esc_attr(Cron::MONTHLY); ?>" <?php echo esc_attr($disabledProAttribute); ?>><?php echo esc_html(Cron::getCronDisplayName(Cron::MONTHLY)) . esc_html($proFeature); ?></option> |
| 42 | </select> |
| 43 | </div> |
| 44 | <div class="wpstg-backup-schedule-option"> |
| 45 | <div class="wpstg-backup-schedule-option-inner"> |
| 46 | <label for="backupScheduleTime"> |
| 47 | <?php esc_html_e('Start Time:', 'wp-staging'); ?> |
| 48 | </label> |
| 49 | <select name="backupScheduleTime" id="backupScheduleTime" class="wpstg-input wpstg-input-md"> |
| 50 | <?php $currentTime = (new DateTime('now', $time->getSiteTimezoneObject()))->format($timeFormatOption); ?> |
| 51 | <?php foreach ($recurrenceTimes as $recurTime) : ?> |
| 52 | <option value="<?php echo esc_attr($recurTime->format('H:i')) ?>" <?php echo $isProVersion ? (esc_html($recurTime->format($timeFormatOption)) === esc_html($currentTime) ? 'selected' : '') : ($recurTime->format('H:i') === "00:00" ? 'selected' : 'disabled') ?>> |
| 53 | <?php echo esc_html($recurTime->format($timeFormatOption)); ?> |
| 54 | </option> |
| 55 | <?php endforeach; ?> |
| 56 | </select> |
| 57 | <div id="backup-schedule-current-time" style="white-space: nowrap; margin-left: 12px;"> |
| 58 | <span><?php echo esc_html__('Current Time', 'wp-staging'); ?></span> |
| 59 | <span><?php echo esc_html($currentTime); ?></span> |
| 60 | </div> |
| 61 | </div> |
| 62 | <div class="wpstg--tooltip"> |
| 63 | <img class="wpstg--dashicons wpstg-dashicons-19 wpstg--grey" src="<?php echo esc_url($urlAssets); ?>svg/info-outline.svg" alt="info"/> |
| 64 | <span class="wpstg--tooltiptext wpstg--tooltiptext-backups"> |
| 65 | <?php echo sprintf( |
| 66 | Escape::escapeHtml(__('Relative to current server time, which you can change in <a href="%s">WordPress Settings</a>.', 'wp-staging')), |
| 67 | esc_url(admin_url('options-general.php#timezone_string')) |
| 68 | ); ?> |
| 69 | <br> |
| 70 | <br> |
| 71 | <?php echo sprintf(esc_html__('Current Server Time: %s', 'wp-staging'), esc_html((new DateTime('now', $time->getSiteTimezoneObject()))->format($timeFormatOption))); ?> |
| 72 | <br> |
| 73 | <?php echo sprintf(esc_html__('Site Timezone: %s', 'wp-staging'), esc_html($time->getSiteTimezoneString())); ?> |
| 74 | |
| 75 | <?php if (!$isProVersion) { |
| 76 | echo '<br><br><hr>'; |
| 77 | echo esc_html__('You can customize this start time in WP Staging Pro!', 'wp-staging'); ?> |
| 78 | <a href="<?php echo esc_url(\WPStaging\Framework\Language\Language::getUpgradeUrl('backup_schedule_time')); ?>" target="_blank" class="wpstg-pro-feature-link"><?php echo esc_html__('Get Pro Version', 'wp-staging'); ?></a> |
| 79 | <?php |
| 80 | } |
| 81 | ?> |
| 82 | </span> |
| 83 | </div> |
| 84 | </div> |
| 85 | <div class="wpstg-backup-schedule-option"> |
| 86 | <div class="wpstg-backup-schedule-option-inner"> |
| 87 | <label for="backupScheduleRotation"> |
| 88 | <?php esc_html_e('Retention:', 'wp-staging'); ?> |
| 89 | </label> |
| 90 | <select name="backupScheduleRotation" id="backupScheduleRotation" class="wpstg-input wpstg-input-md"> |
| 91 | <?php for ($i = 1; $i <= 10; $i++) : ?> |
| 92 | <option value="<?php echo esc_attr((string)$i) ?>" <?php echo $isProVersion ? "" : ($i === 1 ? 'selected' : 'disabled') ?>> |
| 93 | <?php echo sprintf(esc_html__('Keep last %d backup%s', 'wp-staging'), (int)$i, (int)$i > 1 ? 's' : ''); ?> |
| 94 | </option> |
| 95 | <?php endfor; ?> |
| 96 | </select> |
| 97 | </div> |
| 98 | <div class="wpstg--tooltip"> |
| 99 | <img class="wpstg--dashicons wpstg-dashicons-19 wpstg--grey" src="<?php echo esc_url($urlAssets); ?>svg/info-outline.svg" alt="info"/> |
| 100 | <span class="wpstg--tooltiptext wpstg--tooltiptext-backups"> |
| 101 | <?php esc_html_e('Number of backups to keep before deleting old ones to free up storage space.', 'wp-staging') ?> |
| 102 | <?php if (!$isProVersion) { |
| 103 | echo '<br><br><hr>'; |
| 104 | echo esc_html__('Keep more than one automatic backup with WP Staging Pro!', 'wp-staging'); ?> |
| 105 | <a href="<?php echo esc_url(\WPStaging\Framework\Language\Language::getUpgradeUrl('backup_schedule_retention')); ?>" target="_blank" class="wpstg-pro-feature-link"><?php echo esc_html__('Get Pro Version', 'wp-staging'); ?></a> |
| 106 | <?php |
| 107 | } |
| 108 | ?> |
| 109 | </span> |
| 110 | </div> |
| 111 | </div> |
| 112 | <div class="wpstg-backup-schedule-option wpstg-align-checkbox"> |
| 113 | <label for="backupScheduleLaunch"> |
| 114 | <?php esc_html_e('Run Now:', 'wp-staging'); ?> |
| 115 | </label> |
| 116 | <?php Checkbox::render('backupScheduleLaunch', 'backupScheduleLaunch'); ?> |
| 117 | </div> |
| 118 | </div> |
| 119 |