PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.11.2
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.11.2
4.11.2 4.11.1 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 / clone / index.php
wp-staging / views / clone Last commit date
ajax 1 week ago index.php 2 days ago
index.php
245 lines
1 <?php
2
3 /**
4 * @see \WPStaging\Backend\Administrator::getClonePage()
5 * @see \WPStaging\Backend\Administrator::getBackupPage()
6 * @var bool $isBackupPage
7 * @var bool $isStagingPage
8 */
9
10 use WPStaging\Backup\BackupNextOffer;
11 use WPStaging\Core\WPStaging;
12 use WPStaging\Framework\Notices\BackupPluginsNotice;
13 use WPStaging\Framework\Notices\CliIntegrationNotice;
14 use WPStaging\Framework\Notices\Notices;
15 use WPStaging\Framework\Facades\Escape;
16 use WPStaging\Framework\Language\Language;
17 use WPStaging\Framework\Onboarding\FreeOnboarding;
18 use WPStaging\Framework\Onboarding\NextStepRenderer;
19 use WPStaging\Framework\Onboarding\OnboardingJourney;
20 use WPStaging\Framework\Onboarding\QueuedBackup;
21 use WPStaging\Framework\TemplateEngine\TemplateEngine;
22
23 $backupNotice = WPStaging::make(BackupPluginsNotice::class);
24 $notice = WPStaging::make(Notices::class);
25
26 $onboarding = FreeOnboarding::resolve();
27
28 if ($onboarding !== null) {
29 $onboarding->recordExposure();
30 }
31
32 $journey = $onboarding === null ? null : $onboarding->getJourney();
33 $journeyStep = $onboarding === null ? '' : $onboarding->getJourneyStep();
34 $isPreConsent = $onboarding !== null && $onboarding->isPreConsent();
35 $showBackupNext = $onboarding !== null && $onboarding->isTaskSelector();
36
37 $showSelector = $journeyStep === OnboardingJourney::STEP_SELECT;
38 $completedCapability = $journey === null ? '' : $journey->getAction(OnboardingJourney::POSITION_FIRST);
39 $nextCapability = $journey === null ? '' : $journey->getNextCapability();
40 $hasFirstSuccess = $journey !== null && $journey->isFirstCapabilityCompleted();
41
42 $secondAction = $journey === null ? '' : $journey->getAction(OnboardingJourney::POSITION_SECOND);
43
44 $nextStepRenderer = $hasFirstSuccess ? NextStepRenderer::resolve() : null;
45 $nextStepMarkup = $nextStepRenderer === null ? '' : $nextStepRenderer->render();
46 $isNextStepVisible = $nextStepMarkup !== '';
47
48 $isFocusMode = $isPreConsent || $journeyStep !== '';
49
50 $isFirstRunOffer = $showBackupNext && $journey !== null && $journey->getNextCapability() !== OnboardingJourney::CAPABILITY_STAGING;
51
52
53
54 $backupNextOffer = (!$isFocusMode && class_exists(BackupNextOffer::class)) ? BackupNextOffer::resolve() : null;
55 $offerBackupNext = $isFirstRunOffer || ($backupNextOffer !== null && $backupNextOffer->isEligible());
56
57 $adminUrl = admin_url('admin.php?page=');
58 $queuedBackupStatus = $offerBackupNext || $showBackupNext ? WPStaging::make(QueuedBackup::class)->getStatus() : '';
59 $runningCapability = $journeyStep === OnboardingJourney::STEP_RUNNING ? $journey->getRunningCapability() : '';
60
61 $activeCapability = $journeyStep === OnboardingJourney::STEP_RUNNING ? $journey->getActiveCapability() : '';
62 $showProgress = $activeCapability !== '' && !$isNextStepVisible;
63
64
65 $onboardingHiddenClass = ($isPreConsent || $showSelector || $isNextStepVisible || $showProgress) ? ' wpstg-onboarding-hidden' : '';
66 if ($isNextStepVisible && $secondAction === '') {
67 $journey->recordNextOfferShown();
68 }
69
70 $isCalledFromIndex = true;
71 ?>
72
73 <div id="wpstg-clonepage-wrapper" class="<?php echo $isFocusMode ? 'wpstg-onboarding-focus' : ''; ?>">
74 <?php
75 if (!$isFocusMode) {
76 require_once($this->viewsPath . (WPStaging::isPro() ? 'pro/_main/header.php' : '_main/header.php'));
77
78 do_action('wpstg_notifications');
79 }
80
81 if (empty($isStagingPage)) {
82 echo "<script>window.addEventListener('DOMContentLoaded', function() {window.dispatchEvent(new Event('backups-tab'));});</script>";
83 $classStagingPageActive = '';
84 $classBackupPageActive = 'wpstg--tab--active';
85 } else {
86 $classStagingPageActive = 'wpstg--tab--active';
87 $classBackupPageActive = '';
88 }
89
90 ?>
91 <div class="wpstg--tab--wrapper">
92 <?php
93 if (!$isFocusMode) {
94 require_once(WPSTG_VIEWS_DIR . 'navigation/web-template.php');
95 }
96 ?>
97
98 <div class="wpstg-header">
99 <?php
100 if (!$isFocusMode && !WPStaging::isBasic()) {
101 require_once($this->viewsPath . 'pro/notices/update-notification.php');
102 }
103 ?>
104 </div>
105
106 <div class="wpstg-loading-bar-container">
107 <div class="wpstg-loading-bar"></div>
108 </div>
109
110 <div id="wpstg-error-wrapper">
111 <div id="wpstg-error-details"></div>
112 </div>
113
114 <div class="wpstg--tab--contents <?php echo $isStagingPage ? 'min-h-152' : 'min-h-375'; ?>">
115 <?php
116
117
118 if ($isFocusMode) : ?>
119 <div class="wpstg-onboarding__logo">
120 <?php require WPSTG_VIEWS_DIR . 'notices/_partial/wp-staging-logo-svg.php'; ?>
121 </div>
122 <?php endif;
123
124 if ($isPreConsent) {
125 require WPSTG_VIEWS_DIR . 'onboarding/pre-consent.php';
126 } elseif ($showSelector) {
127 require WPSTG_VIEWS_DIR . 'onboarding/first-run.php';
128 }
129
130 if ($showProgress) {
131 require WPSTG_VIEWS_DIR . 'onboarding/progress.php';
132 }
133
134
135
136 if ($isFocusMode) : ?>
137 <div class="wpstg-onboarding-job" data-wpstg-inline-progress hidden></div>
138 <?php endif;
139
140 echo $nextStepMarkup; // phpcs:ignore WPStagingCS.Security.EscapeOutput.OutputNotEscaped -- Markup from NextStepRenderer; every value is escaped in onboarding/next-step.php.
141 ?>
142 <div id="wpstg--tab--staging" class="wpstg--tab--content wpstg-onboarding-pane <?php echo esc_attr($classStagingPageActive) . esc_attr($onboardingHiddenClass); ?>">
143 <?php
144 $notice->maybeShowElementorCloudNotice();
145 if ($this->siteInfo->isHostedOnWordPressCom()) {
146 require $this->viewsPath . 'staging/wordpress-com/index.php';
147 } elseif (!defined('WPSTGPRO_VERSION') && is_multisite()) {
148 require $this->viewsPath . 'staging/free-version.php';
149 } elseif (!$this->siteInfo->isCloneable()) {
150 require $this->viewsPath . 'staging/staging-site/index.php';
151 } elseif (defined('WPSTGPRO_VERSION') && is_multisite()) {
152 do_action(TemplateEngine::ACTION_MULTI_SITE_CLONE_OPTION);
153 } else {
154 require $this->viewsPath . 'staging/index.php';
155 }
156 ?>
157 </div>
158 <div id="wpstg--tab--backup" class="wpstg--tab--content wpstg-onboarding-pane <?php echo esc_attr($classBackupPageActive) . esc_attr($onboardingHiddenClass); ?>">
159 <?php
160 $cliNotice = WPStaging::make(CliIntegrationNotice::class);
161 $cliNotice->maybeShowCliNotice();
162
163 $cliNotice->maybeRenderCliModalForDockCta();
164 ?>
165 <div id="wpstg-backup-content">
166 <div class="wpstg-backup-listing-skeleton wpstg-animate-pulse wpstg-py-4">
167 <div class="wpstg-space-y-3">
168 <div class="wpstg-h-4 wpstg-bg-gray-200 wpstg-rounded wpstg-w-1/4 dark:wpstg-bg-gray-700"></div>
169 <div class="wpstg-h-3 wpstg-bg-gray-200 wpstg-rounded wpstg-w-full dark:wpstg-bg-gray-700"></div>
170 <div class="wpstg-h-3 wpstg-bg-gray-200 wpstg-rounded wpstg-w-5/6 dark:wpstg-bg-gray-700"></div>
171 <div class="wpstg-h-3 wpstg-bg-gray-200 wpstg-rounded wpstg-w-4/5 dark:wpstg-bg-gray-700"></div>
172 </div>
173 </div>
174 </div>
175 </div>
176 <div class="wpstg-did-you-know-footer wpstg-onboarding-pane<?php echo esc_attr($onboardingHiddenClass); ?>">
177 <?php echo sprintf(
178 Escape::escapeHtml(__('Need to move this site elsewhere? You can also use backup files for transfers. <a href="%s" target="_blank">Read more</a>', 'wp-staging')),
179 Language::localizeDocsUrl('https://wp-staging.com/docs/how-to-migrate-your-wordpress-site-to-a-new-host/')
180 ); ?>
181 </div>
182 </div>
183 </div>
184 <?php
185 if (!$isFocusMode) {
186 require_once($this->viewsPath . '_main/footer.php');
187 }
188 ?>
189 <script>
190 // Dismiss handler for the compact general "Upgrade to Pro" card. The staging
191 // listing is injected via innerHTML (scripts inside it do not execute), so
192 // this is delegated from the document to work on injected content.
193 (function () {
194 document.addEventListener('click', function (event) {
195 var trigger = event.target.closest('.wpstg-pro-card-dismiss');
196 if (!trigger) {
197 return;
198 }
199
200 event.preventDefault();
201
202 var body = new URLSearchParams();
203 body.append('action', 'wpstg_dismiss_notice');
204 body.append('nonce', wpstg.nonce);
205 body.append('wpstg_notice', 'general_pro_card');
206
207 fetch(ajaxurl, {
208 method: 'POST',
209 credentials: 'same-origin',
210 headers: {'Content-Type': 'application/x-www-form-urlencoded'},
211 body: body.toString()
212 }).then(function (response) {
213 return response.json();
214 }).then(function (success) {
215 // Only hide once the snooze was persisted; otherwise the card would
216 // vanish on a failed request and reappear on the next reload.
217 if (success !== true) {
218 return;
219 }
220
221 var card = document.querySelector('.wpstg-general-pro-card');
222 if (card) {
223 card.style.display = 'none';
224 }
225 }).catch(function () {});
226 });
227 })();
228 </script>
229 <?php
230
231
232
233 ?>
234 <div id="wpstg-staging-review-content" style="display:none;">
235 <?php include WPSTG_VIEWS_DIR . 'notices/review-prompt-modal.php'; ?>
236 </div>
237 <?php require_once(WPSTG_VIEWS_DIR . 'notices/review-prompt-handlers.php'); ?>
238
239 <?php if ($offerBackupNext) : ?>
240 <div id="wpstg-backup-next-content" style="display:none;">
241 <?php include WPSTG_VIEWS_DIR . 'onboarding/backup-next.php'; ?>
242 </div>
243 <?php endif; ?>
244 </div>
245