backup-next.php
4 days ago
capability-icon.php
4 days ago
first-run.php
4 days ago
next-step.php
4 days ago
open-staging-site.php
4 days ago
pre-consent.php
4 days ago
progress.php
4 days ago
progress.php
69 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * What the first run shows while it is waiting on a job. It exists for the |
| 5 | * reload: the browser that started the job has the process modal, but a page |
| 6 | * loaded fresh mid-job would otherwise fall back to the normal WP STAGING page, |
| 7 | * promotions and all, in the middle of a guided first run. |
| 8 | * |
| 9 | * @var string $activeCapability The capability the journey is on. |
| 10 | * @var string $runningCapability Same, once its job has reported a start. |
| 11 | * @var string $queuedBackupStatus One of the QueuedBackup STATUS_* values, or empty. |
| 12 | */ |
| 13 | |
| 14 | use WPStaging\Framework\Onboarding\OnboardingJourney; |
| 15 | use WPStaging\Framework\Onboarding\QueuedBackup; |
| 16 | |
| 17 | $states = [ |
| 18 | OnboardingJourney::CAPABILITY_STAGING => [ |
| 19 | 'title' => __('Creating your staging site', 'wp-staging'), |
| 20 | 'text' => __('This can take a few minutes. Leave this page open while it finishes.', 'wp-staging'), |
| 21 | 'starting' => __('Starting your staging site', 'wp-staging'), |
| 22 | 'icon' => 'wpstg-icon-box-blue', |
| 23 | ], |
| 24 | OnboardingJourney::CAPABILITY_BACKUP => [ |
| 25 | 'title' => __('Creating your backup', 'wp-staging'), |
| 26 | 'text' => __('This runs on the server, so you can keep working while it finishes.', 'wp-staging'), |
| 27 | 'starting' => __('Starting your backup', 'wp-staging'), |
| 28 | 'icon' => 'wpstg-icon-box-green', |
| 29 | ], |
| 30 | ]; |
| 31 | |
| 32 | if (!isset($states[$activeCapability])) { |
| 33 | return; |
| 34 | } |
| 35 | |
| 36 | $state = $states[$activeCapability]; |
| 37 | |
| 38 | // Until the job reports a start there is nothing to describe the progress of, |
| 39 | // so the state says what it is doing rather than how long it will take. |
| 40 | $isStarted = $runningCapability !== ''; |
| 41 | $title = $isStarted ? $state['title'] : $state['starting']; |
| 42 | $text = $isStarted ? $state['text'] : __('This only takes a moment.', 'wp-staging'); |
| 43 | ?> |
| 44 | <div class="wpstg-onboarding-next wpstg-onboarding-progress" role="status" aria-live="polite"> |
| 45 | <div class="wpstg-onboarding-next__offer"> |
| 46 | <div class="wpstg-icon-box <?php echo esc_attr($state['icon']); ?> wpstg-onboarding-next__icon"> |
| 47 | <?php |
| 48 | $capability = $activeCapability; |
| 49 | include WPSTG_VIEWS_DIR . 'onboarding/capability-icon.php'; |
| 50 | ?> |
| 51 | </div> |
| 52 | |
| 53 | <h2 class="wpstg-onboarding-next__title"><?php echo esc_html($title); ?></h2> |
| 54 | <p class="wpstg-onboarding-next__text"><?php echo esc_html($text); ?></p> |
| 55 | |
| 56 | <span class="wpstg-onboarding-progress__bar" aria-hidden="true"></span> |
| 57 | |
| 58 | <?php if ($activeCapability === OnboardingJourney::CAPABILITY_STAGING && in_array($queuedBackupStatus, [QueuedBackup::STATUS_QUEUED, QueuedBackup::STATUS_RUNNING], true)) : ?> |
| 59 | <p class="wpstg-onboarding-progress__queued"> |
| 60 | <?php esc_html_e('Your backup will start automatically when this finishes.', 'wp-staging'); ?> |
| 61 | </p> |
| 62 | <?php endif; ?> |
| 63 | |
| 64 | <button type="button" class="wpstg-onboarding-next__finish" data-wpstg-onboarding-finish> |
| 65 | <?php esc_html_e('Skip for now', 'wp-staging'); ?> |
| 66 | </button> |
| 67 | </div> |
| 68 | </div> |
| 69 |