_partials
1 day ago
setup
2 weeks ago
staging-site
1 year ago
wordpress-com
3 months ago
confirm-delete.php
2 weeks ago
free-version.php
1 day ago
index.php
4 months ago
listing.php
1 day ago
setup.php
1 day ago
staging-site-list-item.php
1 day ago
setup.php
664 lines
| 1 | <?php |
| 2 | |
| 3 | use WPStaging\Core\WPStaging; |
| 4 | use WPStaging\Framework\Facades\UI\Checkbox; |
| 5 | use WPStaging\Framework\Language\Language; |
| 6 | use WPStaging\Staging\Dto\StagingSiteDto; |
| 7 | use WPStaging\Staging\Service\AbstractStagingSetup; |
| 8 | use WPStaging\Staging\Service\DirectoryScanner; |
| 9 | use WPStaging\Staging\Service\StagingEngine; |
| 10 | use WPStaging\Staging\Service\TableScanner; |
| 11 | use WPStaging\Staging\Renderer\SetupRenderer; |
| 12 | |
| 13 | /** |
| 14 | * Unified setup UI for create, update, and reset staging jobs. |
| 15 | * |
| 16 | * @var AbstractStagingSetup $stagingSetup |
| 17 | * @var StagingSiteDto $stagingSiteDto |
| 18 | * @var DirectoryScanner $directoryScanner |
| 19 | * @var TableScanner $tableScanner |
| 20 | * @var string $setupMode |
| 21 | */ |
| 22 | |
| 23 | $setupMode = isset($setupMode) ? $setupMode : 'create'; |
| 24 | $isCreate = $setupMode === 'create'; |
| 25 | $isUpdate = $setupMode === 'update'; |
| 26 | $isReset = $setupMode === 'reset'; |
| 27 | $isPro = WPStaging::isPro(); |
| 28 | // Pro advanced settings stay locked unless the Pro build also has a valid/active |
| 29 | // license; an unlicensed Pro install is gated exactly like the free build. |
| 30 | $isProLicenseActive = $stagingSetup->isProLicenseActive(); |
| 31 | |
| 32 | $productionSiteUrl = home_url('/'); |
| 33 | $defaultSiteName = $isCreate ? $stagingSiteDto->getSiteName() : ''; |
| 34 | if ($isCreate && empty($defaultSiteName)) { |
| 35 | $defaultSiteName = 'staging'; |
| 36 | } |
| 37 | |
| 38 | $previewSiteUrl = trailingslashit($productionSiteUrl) . $defaultSiteName; |
| 39 | $defaultPathBase = trailingslashit(wp_normalize_path(ABSPATH)); |
| 40 | |
| 41 | $stagingSiteName = $isCreate ? $defaultSiteName : $stagingSiteDto->getSiteName(); |
| 42 | if (!$isCreate && empty($stagingSiteName)) { |
| 43 | $stagingSiteName = $stagingSiteDto->getCloneId(); |
| 44 | } |
| 45 | |
| 46 | $selectedEngine = WPStaging::make(StagingEngine::class)->getEngine(); |
| 47 | $selectedEngineName = $selectedEngine === StagingEngine::ENGINE_NEXT_GEN ? esc_html__('Next-Gen', 'wp-staging') : esc_html__('Classic', 'wp-staging'); |
| 48 | $enginePanelId = sprintf('wpstg-%s-engine-panel', $setupMode); |
| 49 | $setupRenderer = new SetupRenderer(); |
| 50 | $setupRenderer->setSelectedEngineName($selectedEngineName); |
| 51 | |
| 52 | $stagingSiteDirectoryName = $stagingSiteDto->getDirectoryName(); |
| 53 | $stagingSiteUrl = $isCreate ? $previewSiteUrl : $stagingSiteDto->getUrl(); |
| 54 | if (!$isCreate && empty($stagingSiteUrl) && !empty($stagingSiteDirectoryName)) { |
| 55 | $stagingSiteUrl = trailingslashit($productionSiteUrl) . $stagingSiteDirectoryName; |
| 56 | } |
| 57 | |
| 58 | $productionSiteHost = wp_parse_url($productionSiteUrl, PHP_URL_HOST); |
| 59 | $stagingSitePath = wp_parse_url($stagingSiteUrl, PHP_URL_PATH); |
| 60 | if (empty($productionSiteHost)) { |
| 61 | $productionSiteHost = untrailingslashit(str_replace(['https://', 'http://'], '', $productionSiteUrl)); |
| 62 | } |
| 63 | |
| 64 | if (empty($stagingSitePath) || $stagingSitePath === '/') { |
| 65 | $stagingSitePathName = empty($stagingSiteDirectoryName) ? $stagingSiteName : $stagingSiteDirectoryName; |
| 66 | $stagingSitePath = '/' . trim($stagingSitePathName, '/'); |
| 67 | } |
| 68 | |
| 69 | $showWooSchedulerSettings = $setupRenderer->hasWooSchedulerSettings($stagingSetup); |
| 70 | $runtimeSummaryUpgradeLink = $isProLicenseActive ? '' : sprintf( |
| 71 | ' <a href="%s" target="_blank" rel="noopener noreferrer">%s</a>', |
| 72 | esc_url(Language::getUpgradeUrl('runtime_summary')), |
| 73 | esc_html__('Upgrade', 'wp-staging') |
| 74 | ); |
| 75 | |
| 76 | |
| 77 | $runtimeSummaryTooltips = [ |
| 78 | 'emails' => [ |
| 79 | 'enabled' => __('The staging site is allowed to send real emails.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 80 | 'disabled' => __('Email sending is blocked on the staging site.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 81 | ], |
| 82 | 'cron' => [ |
| 83 | 'enabled' => __('WordPress cron runs scheduled tasks such as publishing schedules, cleanup jobs, and plugin maintenance on staging.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 84 | 'disabled' => __('WordPress cron is blocked, so scheduled tasks will not run on the staging site.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 85 | ], |
| 86 | 'woo' => [ |
| 87 | 'enabled' => __('WooCommerce background actions can run on staging for subscriptions, webhooks, cleanup, and other queued shop tasks.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 88 | 'disabled' => __('WooCommerce background actions are blocked, so queued shop tasks will not run on the staging site.', 'wp-staging') . $runtimeSummaryUpgradeLink, |
| 89 | ], |
| 90 | ]; |
| 91 | ?> |
| 92 | |
| 93 | <?php if ($isUpdate) : |
| 94 | $stagingSiteDisplay = preg_replace('#^https?://#', '', untrailingslashit($stagingSiteUrl)); |
| 95 | $hasSavedSelection = !empty($stagingSiteDto->getIncludedTables()) || !empty($stagingSiteDto->getExcludedDirectories()); |
| 96 | |
| 97 | // Advanced options surfaced from the (previously hidden) runtime/cleanup |
| 98 | // config. Defaults, ids and the free Pro-lock mirror the runtime section so |
| 99 | // the update payload stays byte-for-byte identical. |
| 100 | $advOptionDisabled = !$isProLicenseActive; |
| 101 | $advNotifyOptions = [ |
| 102 | ['id' => 'wpstg_allow_emails', 'icon' => 'mail', 'label' => __('Allow Emails Sending', 'wp-staging'), 'checked' => $isProLicenseActive, 'sumLabel' => __('Emails', 'wp-staging'), 'tip' => __('Let the staging site send real emails after the update. Keep off so test activity never reaches real users.', 'wp-staging')], |
| 103 | ['id' => 'wpstg_reminder_emails', 'icon' => 'bell', 'label' => __('Get Reminder Email', 'wp-staging'), 'checked' => false, 'sumLabel' => __('Reminder email', 'wp-staging'), 'tip' => __('Email you a periodic reminder that this staging site still exists.', 'wp-staging')], |
| 104 | ['id' => 'wpstg_auto_update_plugins', 'icon' => 'refresh', 'label' => __('Auto Update Plugins', 'wp-staging'), 'checked' => false, 'sumLabel' => __('Auto-update plugins', 'wp-staging'), 'tip' => __('Automatically update plugins on staging once the update finishes.', 'wp-staging')], |
| 105 | ]; |
| 106 | if ($showWooSchedulerSettings) { |
| 107 | $advNotifyOptions[] = ['id' => 'wpstg_woo_scheduler_enabled', 'icon' => 'cart', 'label' => __('Enable WooCommerce Scheduler', 'wp-staging'), 'checked' => $isProLicenseActive, 'sumLabel' => __('WooCommerce scheduler', 'wp-staging'), 'tip' => __('Run WooCommerce scheduled actions on staging. Off prevents orders, emails and background jobs.', 'wp-staging')]; |
| 108 | } |
| 109 | |
| 110 | $advCleanupOptions = [ |
| 111 | ['id' => 'wpstg-clean-plugins-themes', 'label' => __('Clean Plugins/Themes', 'wp-staging'), 'checked' => false, 'disabled' => false, 'sumLabel' => __('Clean plugins/themes', 'wp-staging'), 'desc' => __('Remove staging plugins and themes that no longer exist on the live site.', 'wp-staging')], |
| 112 | ['id' => 'wpstg-clean-uploads', 'label' => __('Clean Uploads', 'wp-staging'), 'checked' => false, 'disabled' => $stagingSiteDto->getUploadsSymlinked(), 'sumLabel' => __('Clean uploads', 'wp-staging'), 'desc' => $stagingSiteDto->getUploadsSymlinked() ? __('Disabled because uploads are symlinked.', 'wp-staging') : __('Remove staging uploads before copying uploads from the live site.', 'wp-staging')], |
| 113 | ]; |
| 114 | |
| 115 | // Summary mirrors only the enabled options (cleanup flagged as destructive). |
| 116 | $advSummaryOptions = []; |
| 117 | foreach ($advNotifyOptions as $advOption) { |
| 118 | $advSummaryOptions[] = ['id' => $advOption['id'], 'icon' => $advOption['icon'], 'sumLabel' => $advOption['sumLabel'], 'checked' => $advOption['checked'], 'risk' => false]; |
| 119 | } |
| 120 | |
| 121 | foreach ($advCleanupOptions as $advOption) { |
| 122 | $advSummaryOptions[] = ['id' => $advOption['id'], 'icon' => 'trash', 'sumLabel' => $advOption['sumLabel'], 'checked' => $advOption['checked'], 'risk' => true]; |
| 123 | } |
| 124 | |
| 125 | $advAnyEnabled = (bool) array_filter(wp_list_pluck($advSummaryOptions, 'checked')); |
| 126 | ?> |
| 127 | <div class="wpstg-update-setup-modal wpstg-create-setup-modal wpstg-staging-setup-modal wpstg-text-left" role="dialog" aria-modal="true" aria-labelledby="wpstg-update-modal-title" data-engine-legacy-label="<?php esc_attr_e('Classic', 'wp-staging'); ?>" data-engine-next-gen-label="<?php esc_attr_e('Next-Gen', 'wp-staging'); ?>" data-update-none="<?php esc_attr_e('None', 'wp-staging'); ?>" data-update-empty-summary="<?php esc_attr_e('Nothing selected — open to choose what to overwrite', 'wp-staging'); ?>" data-update-tables-count="<?php esc_attr_e('%1$s of %2$s tables · %3$s', 'wp-staging'); ?>" data-update-folders-count="<?php esc_attr_e('%1$s of %2$s folders', 'wp-staging'); ?>" data-update-of="<?php esc_attr_e('%1$s of %2$s', 'wp-staging'); ?>" data-update-summary-line="<?php esc_attr_e('%1$s tables · %2$s folders', 'wp-staging'); ?>"> |
| 128 | <?php $setupRenderer->closeButton('wpstg-update-modal-close wpstg-staging-modal-close'); ?> |
| 129 | |
| 130 | <header class="wpstg-update-setup-modal__header"> |
| 131 | <span class="wpstg-update-header-badge" aria-hidden="true"><?php $setupRenderer->icon('refresh', 'wpstg-h-5 wpstg-w-5'); ?></span> |
| 132 | <div class="wpstg-min-w-0 wpstg-flex-1"> |
| 133 | <h1 id="wpstg-update-modal-title" class="wpstg-update-header-title"><?php esc_html_e('Update Staging Site', 'wp-staging'); ?></h1> |
| 134 | <p class="wpstg-update-header-subtitle"> |
| 135 | <?php echo wp_kses_post(sprintf( |
| 136 | /* translators: %s: staging site name */ |
| 137 | __('Copy selected files and database tables from your live site to %s.', 'wp-staging'), |
| 138 | '<span class="wpstg-font-semibold wpstg-text-gray-700 dark:wpstg-text-slate-300">' . esc_html($stagingSiteName) . '</span>' |
| 139 | )); ?> |
| 140 | </p> |
| 141 | </div> |
| 142 | </header> |
| 143 | |
| 144 | <div class="wpstg-update-setup-modal__body"> |
| 145 | <main class="wpstg-update-setup-modal__main"> |
| 146 | |
| 147 | <section class="wpstg-update-section"> |
| 148 | <h2 class="wpstg-update-section__title"><?php esc_html_e('Staging site to update', 'wp-staging'); ?></h2> |
| 149 | <div class="wpstg-update-direction"> |
| 150 | <div class="wpstg-update-direction__node"> |
| 151 | <span class="wpstg-update-direction__label"><?php esc_html_e('Source', 'wp-staging'); ?></span> |
| 152 | <span class="wpstg-update-direction__name"><?php $setupRenderer->icon('globe', 'wpstg-update-direction__icon'); ?><span class="wpstg-truncate"><?php esc_html_e('Live Site', 'wp-staging'); ?></span></span> |
| 153 | <span class="wpstg-update-direction__url"><?php echo esc_html($productionSiteHost); ?></span> |
| 154 | </div> |
| 155 | <div class="wpstg-update-direction__arrow" aria-hidden="true"> |
| 156 | <?php $setupRenderer->icon('arrow-right', 'wpstg-h-[18px] wpstg-w-[18px]', 2); ?> |
| 157 | <span class="wpstg-update-direction__arrow-label"><?php esc_html_e('overwrites', 'wp-staging'); ?></span> |
| 158 | </div> |
| 159 | <div class="wpstg-update-direction__node wpstg-update-direction__node--target"> |
| 160 | <span class="wpstg-update-direction__label"><?php esc_html_e('Target — staging', 'wp-staging'); ?></span> |
| 161 | <span class="wpstg-update-direction__name"><?php $setupRenderer->icon('server', 'wpstg-update-direction__icon wpstg-update-direction__icon--target'); ?><span class="wpstg-truncate"><?php echo esc_html($stagingSiteName); ?></span></span> |
| 162 | <span class="wpstg-update-direction__url"><?php echo esc_html($stagingSiteDisplay); ?></span> |
| 163 | </div> |
| 164 | </div> |
| 165 | </section> |
| 166 | |
| 167 | <section class="wpstg-update-section"> |
| 168 | <div class="wpstg-update-hero"> |
| 169 | <span class="wpstg-update-hero__icon" aria-hidden="true"><?php $setupRenderer->icon('warning', 'wpstg-h-4 wpstg-w-4', 2.2); ?></span> |
| 170 | <div class="wpstg-min-w-0"> |
| 171 | <h3 class="wpstg-update-hero__title"><?php esc_html_e('This will overwrite selected staging data', 'wp-staging'); ?></h3> |
| 172 | <p class="wpstg-update-hero__body"> |
| 173 | <?php echo wp_kses_post(sprintf( |
| 174 | /* translators: %s: staging site name */ |
| 175 | __('Selected tables and files from your live site will replace matching data on %s. This cannot be undone. Unselected items stay unchanged.', 'wp-staging'), |
| 176 | '<span class="wpstg-font-semibold">' . esc_html($stagingSiteName) . '</span>' |
| 177 | )); ?> |
| 178 | </p> |
| 179 | </div> |
| 180 | </div> |
| 181 | </section> |
| 182 | |
| 183 | <section class="wpstg-update-section"> |
| 184 | <div class="wpstg-create-accordion wpstg-staging-accordion"> |
| 185 | <div class="wpstg-create-accordion-card wpstg-staging-accordion-card wpstg-update-overwrite-card"> |
| 186 | <a href="#" class="wpstg-tab-header wpstg-create-accordion-header wpstg-staging-accordion-header" data-id="#wpstg-update-overwrite-panel" data-collapsed="true" role="button" aria-expanded="false" aria-controls="wpstg-update-overwrite-panel"> |
| 187 | <span class="wpstg-create-accordion-icon wpstg-staging-accordion-icon" aria-hidden="true"><?php $setupRenderer->icon('copy'); ?></span> |
| 188 | <span class="wpstg-min-w-0 wpstg-flex-1"> |
| 189 | <span class="wpstg-flex wpstg-flex-wrap wpstg-items-center wpstg-gap-2"> |
| 190 | <strong><?php esc_html_e('What to copy', 'wp-staging'); ?></strong> |
| 191 | <?php if ($hasSavedSelection) : ?> |
| 192 | <span class="wpstg-create-pill wpstg-create-pill--soft"><?php esc_html_e('Saved selection', 'wp-staging'); ?></span> |
| 193 | <?php else : ?> |
| 194 | <span class="wpstg-create-pill wpstg-create-pill--slate"><?php esc_html_e('All selected', 'wp-staging'); ?></span> |
| 195 | <?php endif; ?> |
| 196 | </span> |
| 197 | <span class="wpstg-create-accordion-description" data-wpstg-update-overwrite-summary><?php esc_html_e('Open to choose what to overwrite', 'wp-staging'); ?></span> |
| 198 | </span> |
| 199 | <span class="wpstg-create-accordion-chevron wpstg-staging-accordion-chevron" aria-hidden="true"><?php $setupRenderer->icon('chevron', 'wpstg-h-4 wpstg-w-4'); ?></span> |
| 200 | </a> |
| 201 | <div class="wpstg-create-accordion-panel wpstg-staging-accordion-panel wpstg-collapse-panel" id="wpstg-update-overwrite-panel" style="display: none;" aria-hidden="true"> |
| 202 | <p class="wpstg-update-overwrite-helper"><?php esc_html_e('Your previous selection is saved. Select which live site tables and folders should be copied to the staging site. Change this only if you want to overwrite different staging tables or files.', 'wp-staging'); ?></p> |
| 203 | |
| 204 | <div class="wpstg-update-subblock"> |
| 205 | <div class="wpstg-update-subblock__label"><?php $setupRenderer->icon('database', 'wpstg-h-[15px] wpstg-w-[15px]'); ?><?php esc_html_e('Database tables', 'wp-staging'); ?></div> |
| 206 | <div class="wpstg-update-list-head"> |
| 207 | <span class="wpstg-update-list-count" data-wpstg-update-tables-count></span> |
| 208 | <span class="wpstg-update-list-actions"> |
| 209 | <button type="button" class="wpstg-update-select-all-tables"><?php esc_html_e('Select all live tables', 'wp-staging'); ?></button> |
| 210 | <span class="wpstg-update-list-sep" aria-hidden="true">·</span> |
| 211 | <button type="button" class="wpstg-update-deselect-all-tables"><?php esc_html_e('Deselect all', 'wp-staging'); ?></button> |
| 212 | </span> |
| 213 | </div> |
| 214 | <fieldset id="wpstg-setup-tables" class="wpstg-update-selection wpstg-update-selection--tables"> |
| 215 | <?php $tableScanner->renderTablesSelection(); ?> |
| 216 | </fieldset> |
| 217 | <p class="wpstg-update-critical-note" data-wpstg-update-critical-note data-note-both="<?php esc_attr_e('wp_users and wp_options affect logins, users, and site settings.', 'wp-staging'); ?>" data-note-users="<?php esc_attr_e('wp_users affects logins and user accounts.', 'wp-staging'); ?>" data-note-options="<?php esc_attr_e('wp_options affects site settings and configuration.', 'wp-staging'); ?>" style="display:none;"><?php $setupRenderer->icon('warning', 'wpstg-h-[13px] wpstg-w-[13px]'); ?><span data-wpstg-update-critical-text></span></p> |
| 218 | </div> |
| 219 | |
| 220 | <div class="wpstg-update-subblock"> |
| 221 | <div class="wpstg-update-subblock__label"><?php $setupRenderer->icon('folder', 'wpstg-h-[15px] wpstg-w-[15px]'); ?><?php esc_html_e('Files & folders', 'wp-staging'); ?></div> |
| 222 | <div class="wpstg-update-list-head"> |
| 223 | <span class="wpstg-update-list-count" data-wpstg-update-folders-count></span> |
| 224 | <span class="wpstg-update-list-actions"> |
| 225 | <button type="button" class="wpstg-update-select-all-files"><?php esc_html_e('Select all', 'wp-staging'); ?></button> |
| 226 | <span class="wpstg-update-list-sep" aria-hidden="true">·</span> |
| 227 | <button type="button" class="wpstg-update-deselect-all-files"><?php esc_html_e('Deselect all', 'wp-staging'); ?></button> |
| 228 | </span> |
| 229 | </div> |
| 230 | <fieldset id="wpstg-setup-files" class="wpstg-update-selection wpstg-update-selection--files"> |
| 231 | <?php $directoryScanner->renderFilesSelection(); ?> |
| 232 | </fieldset> |
| 233 | </div> |
| 234 | |
| 235 | <p class="wpstg-update-saved-line"><?php $setupRenderer->icon('check', 'wpstg-h-3 wpstg-w-3'); ?><?php esc_html_e('Selection saved for the next update.', 'wp-staging'); ?></p> |
| 236 | </div> |
| 237 | </div> |
| 238 | </div> |
| 239 | </section> |
| 240 | |
| 241 | <section class="wpstg-update-section"> |
| 242 | <div class="wpstg-create-accordion wpstg-staging-accordion"> |
| 243 | <div class="wpstg-create-accordion-card wpstg-staging-accordion-card wpstg-update-advanced-card"> |
| 244 | <a href="#" class="wpstg-tab-header wpstg-create-accordion-header wpstg-staging-accordion-header" data-id="#wpstg-update-advanced-panel" data-collapsed="true" role="button" aria-expanded="false" aria-controls="wpstg-update-advanced-panel"> |
| 245 | <span class="wpstg-create-accordion-icon wpstg-staging-accordion-icon" aria-hidden="true"><?php $setupRenderer->icon('sliders'); ?></span> |
| 246 | <span class="wpstg-min-w-0 wpstg-flex-1"> |
| 247 | <span class="wpstg-flex wpstg-flex-wrap wpstg-items-center wpstg-gap-2"> |
| 248 | <strong><?php esc_html_e('Advanced options', 'wp-staging'); ?></strong> |
| 249 | <span class="wpstg-create-pill wpstg-create-pill--slate wpstg-update-advanced-badge"><span data-wpstg-staging-engine-summary><?php echo esc_html($selectedEngineName); ?></span><span><?php echo esc_html_x('engine', 'follows the engine name in the advanced-options badge, e.g. "Classic engine"', 'wp-staging'); ?></span></span> |
| 250 | </span> |
| 251 | <span class="wpstg-create-accordion-description"><?php esc_html_e('Engine, emails, scheduler and cleanup behavior', 'wp-staging'); ?></span> |
| 252 | </span> |
| 253 | <span class="wpstg-create-accordion-chevron wpstg-staging-accordion-chevron" aria-hidden="true"><?php $setupRenderer->icon('chevron', 'wpstg-h-4 wpstg-w-4'); ?></span> |
| 254 | </a> |
| 255 | <div class="wpstg-create-accordion-panel wpstg-staging-accordion-panel wpstg-collapse-panel" id="wpstg-update-advanced-panel" style="display: none;" aria-hidden="true"> |
| 256 | <div class="wpstg-update-adv-groups"> |
| 257 | |
| 258 | <div class="wpstg-update-adv-group"> |
| 259 | <div class="wpstg-update-adv-group__label"><?php esc_html_e('Copy method', 'wp-staging'); ?></div> |
| 260 | <?php |
| 261 | $selectorClass = 'wpstg-update-engine-selector'; |
| 262 | require WPSTG_VIEWS_DIR . 'staging/_partials/staging-engine-selector-modal.php'; |
| 263 | ?> |
| 264 | </div> |
| 265 | |
| 266 | <div class="wpstg-update-adv-group"> |
| 267 | <div class="wpstg-update-adv-group__label"><?php esc_html_e('Notifications and automation', 'wp-staging'); ?></div> |
| 268 | <div class="wpstg-update-adv-rows"> |
| 269 | <?php foreach ($advNotifyOptions as $advOption) : ?> |
| 270 | <div class="wpstg-update-adv-row"> |
| 271 | <label class="wpstg-update-adv-row__main" for="<?php echo esc_attr($advOption['id']); ?>"> |
| 272 | <?php Checkbox::render($advOption['id'], $advOption['id'], 'true', $advOption['checked'], ['usePrimitive' => true, 'isDisabled' => $advOptionDisabled, 'classes' => 'wpstg-update-adv-option']); ?> |
| 273 | <span class="wpstg-update-adv-row__icon" aria-hidden="true"><?php $setupRenderer->icon($advOption['icon'], 'wpstg-h-[15px] wpstg-w-[15px]'); ?></span> |
| 274 | <span class="wpstg-update-adv-row__label"> |
| 275 | <?php echo esc_html($advOption['label']); ?> |
| 276 | <?php if ($advOptionDisabled) : ?> |
| 277 | <span class="wpstg-badge-amber wpstg-flex-shrink-0"><?php $setupRenderer->icon('lock', 'wpstg-h-3 wpstg-w-3'); ?><?php esc_html_e('Pro', 'wp-staging'); ?></span> |
| 278 | <?php endif; ?> |
| 279 | </span> |
| 280 | </label> |
| 281 | <button type="button" class="wpstg--tooltip wpstg-update-infotip" aria-label="<?php echo esc_attr($advOption['tip']); ?>"> |
| 282 | <?php $setupRenderer->icon('info', 'wpstg-h-[15px] wpstg-w-[15px]'); ?> |
| 283 | <span class="wpstg--tooltiptext"><?php echo esc_html($advOption['tip']); ?></span> |
| 284 | </button> |
| 285 | </div> |
| 286 | <?php endforeach; ?> |
| 287 | </div> |
| 288 | </div> |
| 289 | |
| 290 | <div class="wpstg-update-adv-group"> |
| 291 | <div class="wpstg-update-adv-group__label"><?php esc_html_e('Cleanup', 'wp-staging'); ?></div> |
| 292 | <div class="wpstg-update-adv-cleanup"> |
| 293 | <?php foreach ($advCleanupOptions as $advOption) : ?> |
| 294 | <label class="wpstg-update-clean-card" for="<?php echo esc_attr($advOption['id']); ?>"> |
| 295 | <?php Checkbox::render($advOption['id'], $advOption['id'], 'true', $advOption['checked'], ['usePrimitive' => true, 'isDisabled' => $advOption['disabled'], 'classes' => 'wpstg-update-adv-option']); ?> |
| 296 | <span class="wpstg-update-clean-card__body"> |
| 297 | <span class="wpstg-update-clean-card__title"><?php $setupRenderer->icon('trash', 'wpstg-update-clean-card__icon wpstg-h-[15px] wpstg-w-[15px]'); ?><?php echo esc_html($advOption['label']); ?></span> |
| 298 | <span class="wpstg-update-clean-card__desc"><?php echo esc_html($advOption['desc']); ?></span> |
| 299 | </span> |
| 300 | </label> |
| 301 | <?php endforeach; ?> |
| 302 | </div> |
| 303 | </div> |
| 304 | |
| 305 | </div> |
| 306 | |
| 307 | <div class="wpstg-update-hidden-config" aria-hidden="true" style="display: none;"> |
| 308 | <?php Checkbox::render('wpstg_enable_cron', 'wpstg_enable_cron', 'true', $isProLicenseActive, ['usePrimitive' => true, 'isDisabled' => $advOptionDisabled]); ?> |
| 309 | </div> |
| 310 | </div> |
| 311 | </div> |
| 312 | </div> |
| 313 | </section> |
| 314 | </main> |
| 315 | |
| 316 | <aside class="wpstg-update-setup-modal__summary" aria-label="<?php esc_attr_e('Update Summary', 'wp-staging'); ?>"> |
| 317 | <div class="wpstg-update-summary-sticky"> |
| 318 | <h2 class="wpstg-update-summary__heading"><?php $setupRenderer->icon('clipboard', 'wpstg-update-summary__heading-icon'); ?><?php esc_html_e('Update Summary', 'wp-staging'); ?></h2> |
| 319 | <dl class="wpstg-update-summary-list"> |
| 320 | <div class="wpstg-update-summary-row"> |
| 321 | <dt><?php $setupRenderer->icon('server', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Target', 'wp-staging'); ?></dt> |
| 322 | <dd class="wpstg-update-summary-mono"><?php echo esc_html($stagingSiteName); ?></dd> |
| 323 | </div> |
| 324 | <div class="wpstg-update-summary-row"> |
| 325 | <dt><?php $setupRenderer->icon('globe', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Source', 'wp-staging'); ?></dt> |
| 326 | <dd><?php esc_html_e('Live site', 'wp-staging'); ?></dd> |
| 327 | </div> |
| 328 | <hr class="wpstg-update-summary-divider" /> |
| 329 | <div class="wpstg-update-summary-row"> |
| 330 | <dt><?php $setupRenderer->icon('database', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Tables', 'wp-staging'); ?></dt> |
| 331 | <dd data-wpstg-update-summary-tables></dd> |
| 332 | </div> |
| 333 | <div class="wpstg-update-summary-row"> |
| 334 | <dt><?php $setupRenderer->icon('folder', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Folders', 'wp-staging'); ?></dt> |
| 335 | <dd data-wpstg-update-summary-folders></dd> |
| 336 | </div> |
| 337 | <div class="wpstg-update-summary-row"> |
| 338 | <dt><?php $setupRenderer->icon('disk', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Data to overwrite', 'wp-staging'); ?></dt> |
| 339 | <dd class="wpstg-update-summary-mono wpstg-update-summary-size"> |
| 340 | <span class="wpstg-create-disk-status"> |
| 341 | <span class="wpstg-create-disk-spinner" data-wpstg-disk-spinner aria-hidden="true"> |
| 342 | <svg viewBox="0 0 24 24" fill="none" width="14" height="14"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="3" opacity="0.2"></circle><path d="M21 12a9 9 0 0 0-9-9" stroke="currentColor" stroke-width="3" stroke-linecap="round"></path></svg> |
| 343 | </span> |
| 344 | <strong data-wpstg-disk-space-status data-status-checking="<?php esc_attr_e('Calculating…', 'wp-staging'); ?>" data-status-failed="<?php esc_attr_e('Check failed', 'wp-staging'); ?>">—</strong> |
| 345 | </span> |
| 346 | <span class="wpstg-create-disk-total" style="display:none;"><span data-wpstg-disk-space-value></span></span> |
| 347 | </dd> |
| 348 | </div> |
| 349 | <hr class="wpstg-update-summary-divider" data-wpstg-update-options-divider<?php echo !$advAnyEnabled ? ' style="display:none;"' : ''; ?> /> |
| 350 | <?php foreach ($advSummaryOptions as $advOption) : ?> |
| 351 | <div class="wpstg-update-summary-row" data-wpstg-update-option-row="<?php echo esc_attr($advOption['id']); ?>"<?php echo !$advOption['checked'] ? ' style="display:none;"' : ''; ?>> |
| 352 | <dt><?php $setupRenderer->icon($advOption['icon'], 'wpstg-update-summary__icon'); ?><?php echo esc_html($advOption['sumLabel']); ?></dt> |
| 353 | <dd class="<?php echo esc_attr($advOption['risk'] ? 'wpstg-update-summary-on-risk' : ''); ?>"><?php esc_html_e('On', 'wp-staging'); ?></dd> |
| 354 | </div> |
| 355 | <?php endforeach; ?> |
| 356 | </dl> |
| 357 | <a href="#" id="wpstg-check-space" class="wpstg-hidden" aria-hidden="true" tabindex="-1"><?php esc_html_e('Recalculate size', 'wp-staging'); ?></a> |
| 358 | <div id="wpstg-disk-space-result" class="wpstg-update-summary-disk-msg" style="display:none;"><div id="wpstg-disk-space-result-msg"></div></div> |
| 359 | |
| 360 | <div class="wpstg-update-backup-card"> |
| 361 | <div class="wpstg-update-backup-card__head"> |
| 362 | <?php $setupRenderer->icon('archive', 'wpstg-update-backup-card__icon'); ?> |
| 363 | <strong><?php esc_html_e('Back up staging first', 'wp-staging'); ?></strong> |
| 364 | <span class="wpstg-update-backup-card__pill"><?php esc_html_e('Recommended', 'wp-staging'); ?></span> |
| 365 | </div> |
| 366 | <p class="wpstg-update-backup-card__body"> |
| 367 | <?php esc_html_e('WP STAGING can\'t back up automatically. Open the staging site and create a backup first.', 'wp-staging'); ?> |
| 368 | </p> |
| 369 | <a href="<?php echo esc_url($stagingSiteUrl); ?>" target="_blank" rel="noopener noreferrer" class="wpstg-update-backup-card__button"> |
| 370 | <?php $setupRenderer->icon('external', 'wpstg-h-[13px] wpstg-w-[13px]'); ?><?php esc_html_e('Open staging site', 'wp-staging'); ?> |
| 371 | </a> |
| 372 | </div> |
| 373 | </div> |
| 374 | </aside> |
| 375 | </div> |
| 376 | |
| 377 | <footer class="wpstg-update-setup-modal__footer"> |
| 378 | <label class="wpstg-update-confirm-row" for="wpstg-update-review-confirmation"> |
| 379 | <?php Checkbox::render('wpstg-update-review-confirmation', 'wpstg-update-review-confirmation', '1', false, ['classes' => 'wpstg-update-review-confirmation-checkbox', 'usePrimitive' => true]); ?> |
| 380 | <span class="wpstg-update-confirm-row__text"> |
| 381 | <?php echo wp_kses_post(sprintf( |
| 382 | /* translators: %1$s: the word "overwrite" (emphasized); %2$s: staging site name */ |
| 383 | __('I understand this will %1$s selected data on %2$s.', 'wp-staging'), |
| 384 | '<span class="wpstg-update-confirm-strong">' . esc_html__('overwrite', 'wp-staging') . '</span>', |
| 385 | '<span class="wpstg-update-confirm-site">' . esc_html($stagingSiteName) . '</span>' |
| 386 | )); ?> |
| 387 | </span> |
| 388 | </label> |
| 389 | <div class="wpstg-update-footer-actions"> |
| 390 | <button type="button" class="wpstg-update-modal-cancel wpstg-btn wpstg-btn-md wpstg-h-11 wpstg-rounded-lg wpstg-py-0 wpstg-leading-none wpstg-btn-secondary wpstg-px-5"><?php esc_html_e('Cancel', 'wp-staging'); ?></button> |
| 391 | <button type="button" class="wpstg--update--staging-site wpstg-setup-cta wpstg-setup-cta--red" data-url="<?php echo esc_attr($stagingSiteUrl); ?>" data-wpstg-update-confirmed="true" disabled> |
| 392 | <?php $setupRenderer->icon('refresh', 'wpstg-h-4 wpstg-w-4', 2); ?><?php esc_html_e('Update Staging Site', 'wp-staging'); ?> |
| 393 | </button> |
| 394 | </div> |
| 395 | </footer> |
| 396 | </div> |
| 397 | <?php elseif ($isReset) : |
| 398 | $stagingSiteDisplay = preg_replace('#^https?://#', '', untrailingslashit($stagingSiteUrl)); |
| 399 | $hasSavedSelection = !empty($stagingSiteDto->getIncludedTables()) || !empty($stagingSiteDto->getExcludedDirectories()); |
| 400 | ?> |
| 401 | <div class="wpstg-reset-setup-modal wpstg-update-setup-modal wpstg-create-setup-modal wpstg-staging-setup-modal wpstg-text-left" role="dialog" aria-modal="true" aria-labelledby="wpstg-reset-modal-title" data-update-none="<?php esc_attr_e('None', 'wp-staging'); ?>" data-update-empty-summary="<?php esc_attr_e('Nothing selected — open to choose what to reset', 'wp-staging'); ?>" data-update-tables-count="<?php esc_attr_e('%1$s of %2$s tables · %3$s', 'wp-staging'); ?>" data-update-folders-count="<?php esc_attr_e('%1$s of %2$s folders', 'wp-staging'); ?>" data-update-of="<?php esc_attr_e('%1$s of %2$s', 'wp-staging'); ?>" data-update-summary-line="<?php esc_attr_e('%1$s tables · %2$s folders', 'wp-staging'); ?>"> |
| 402 | <?php $setupRenderer->closeButton('wpstg-reset-modal-close wpstg-staging-modal-close'); ?> |
| 403 | |
| 404 | <header class="wpstg-update-setup-modal__header"> |
| 405 | <span class="wpstg-update-header-badge" aria-hidden="true"><?php $setupRenderer->icon('refresh', 'wpstg-h-5 wpstg-w-5'); ?></span> |
| 406 | <div class="wpstg-min-w-0 wpstg-flex-1"> |
| 407 | <h1 id="wpstg-reset-modal-title" class="wpstg-update-header-title"><?php esc_html_e('Reset Staging Site', 'wp-staging'); ?></h1> |
| 408 | <p class="wpstg-update-header-subtitle"><?php esc_html_e('Rebuild this staging site from the current state of your production site.', 'wp-staging'); ?></p> |
| 409 | </div> |
| 410 | </header> |
| 411 | |
| 412 | <div class="wpstg-update-setup-modal__body"> |
| 413 | <main class="wpstg-update-setup-modal__main"> |
| 414 | |
| 415 | <section class="wpstg-update-section"> |
| 416 | <h2 class="wpstg-update-section__title"><?php esc_html_e('Staging site to reset', 'wp-staging'); ?></h2> |
| 417 | <div class="wpstg-update-direction"> |
| 418 | <div class="wpstg-update-direction__node"> |
| 419 | <span class="wpstg-update-direction__label"><?php esc_html_e('Source — production', 'wp-staging'); ?></span> |
| 420 | <span class="wpstg-update-direction__name"><?php $setupRenderer->icon('globe', 'wpstg-update-direction__icon'); ?><span class="wpstg-truncate"><?php esc_html_e('Production Site', 'wp-staging'); ?></span></span> |
| 421 | <span class="wpstg-update-direction__url"><?php echo esc_html($productionSiteHost); ?></span> |
| 422 | </div> |
| 423 | <div class="wpstg-update-direction__arrow" aria-hidden="true"> |
| 424 | <?php $setupRenderer->icon('arrow-right', 'wpstg-h-[18px] wpstg-w-[18px]', 2); ?> |
| 425 | <span class="wpstg-update-direction__arrow-label"><?php esc_html_e('resets', 'wp-staging'); ?></span> |
| 426 | </div> |
| 427 | <div class="wpstg-update-direction__node wpstg-update-direction__node--target"> |
| 428 | <span class="wpstg-update-direction__label"><?php esc_html_e('Target — staging', 'wp-staging'); ?></span> |
| 429 | <span class="wpstg-update-direction__name"><?php $setupRenderer->icon('server', 'wpstg-update-direction__icon wpstg-update-direction__icon--target'); ?><span class="wpstg-truncate"><?php echo esc_html($stagingSiteName); ?></span></span> |
| 430 | <span class="wpstg-update-direction__url"><?php echo esc_html($stagingSiteDisplay); ?></span> |
| 431 | </div> |
| 432 | </div> |
| 433 | </section> |
| 434 | |
| 435 | <section class="wpstg-update-section"> |
| 436 | <div class="wpstg-update-hero"> |
| 437 | <span class="wpstg-update-hero__icon" aria-hidden="true"><?php $setupRenderer->icon('warning', 'wpstg-h-4 wpstg-w-4', 2.2); ?></span> |
| 438 | <div class="wpstg-min-w-0"> |
| 439 | <h3 class="wpstg-update-hero__title"><?php esc_html_e('This rebuilds the staging site from scratch', 'wp-staging'); ?></h3> |
| 440 | <p class="wpstg-update-hero__body"> |
| 441 | <?php echo wp_kses_post(sprintf( |
| 442 | /* translators: %s: staging site name */ |
| 443 | __('%s is recreated from the current production state using its original name and URL. The entire staging database is deleted, then only the tables you select are copied over. Every change on the staging site — including its settings and wp-config.php — is lost. This cannot be undone.', 'wp-staging'), |
| 444 | '<span class="wpstg-font-semibold">' . esc_html($stagingSiteName) . '</span>' |
| 445 | )); ?> |
| 446 | </p> |
| 447 | </div> |
| 448 | </div> |
| 449 | </section> |
| 450 | |
| 451 | <section class="wpstg-update-section"> |
| 452 | <div class="wpstg-create-accordion wpstg-staging-accordion"> |
| 453 | <div class="wpstg-create-accordion-card wpstg-staging-accordion-card wpstg-update-overwrite-card"> |
| 454 | <a href="#" class="wpstg-tab-header wpstg-create-accordion-header wpstg-staging-accordion-header" data-id="#wpstg-reset-overwrite-panel" data-collapsed="true" role="button" aria-expanded="false" aria-controls="wpstg-reset-overwrite-panel"> |
| 455 | <span class="wpstg-create-accordion-icon wpstg-staging-accordion-icon" aria-hidden="true"><?php $setupRenderer->icon('copy'); ?></span> |
| 456 | <span class="wpstg-min-w-0 wpstg-flex-1"> |
| 457 | <span class="wpstg-flex wpstg-flex-wrap wpstg-items-center wpstg-gap-2"> |
| 458 | <strong><?php esc_html_e('What to copy', 'wp-staging'); ?></strong> |
| 459 | <?php if ($hasSavedSelection) : ?> |
| 460 | <span class="wpstg-create-pill wpstg-create-pill--soft"><?php esc_html_e('Saved selection', 'wp-staging'); ?></span> |
| 461 | <?php else : ?> |
| 462 | <span class="wpstg-create-pill wpstg-create-pill--slate"><?php esc_html_e('Preselected defaults', 'wp-staging'); ?></span> |
| 463 | <?php endif; ?> |
| 464 | </span> |
| 465 | <span class="wpstg-create-accordion-description" data-wpstg-update-overwrite-summary><?php esc_html_e('Open to choose what to reset', 'wp-staging'); ?></span> |
| 466 | </span> |
| 467 | <span class="wpstg-create-accordion-chevron wpstg-staging-accordion-chevron" aria-hidden="true"><?php $setupRenderer->icon('chevron', 'wpstg-h-4 wpstg-w-4'); ?></span> |
| 468 | </a> |
| 469 | <div class="wpstg-create-accordion-panel wpstg-staging-accordion-panel wpstg-collapse-panel" id="wpstg-reset-overwrite-panel" style="display: none;" aria-hidden="true"> |
| 470 | <p class="wpstg-update-overwrite-helper"> |
| 471 | <?php if ($hasSavedSelection) : ?> |
| 472 | <?php esc_html_e('Your previous selection is saved. Select which live site tables and folders should be copied to the staging site. Change this only if you want to overwrite different staging tables or files.', 'wp-staging'); ?> |
| 473 | <?php else : ?> |
| 474 | <?php esc_html_e('Everything is selected by default. Narrow it down if you only want to reset specific tables or folders.', 'wp-staging'); ?> |
| 475 | <?php endif; ?> |
| 476 | </p> |
| 477 | |
| 478 | <div class="wpstg-update-subblock"> |
| 479 | <div class="wpstg-update-subblock__label"><?php $setupRenderer->icon('database', 'wpstg-h-[15px] wpstg-w-[15px]'); ?><?php esc_html_e('Database tables', 'wp-staging'); ?></div> |
| 480 | <div class="wpstg-update-list-head"> |
| 481 | <span class="wpstg-update-list-count" data-wpstg-update-tables-count></span> |
| 482 | <span class="wpstg-update-list-actions"> |
| 483 | <button type="button" class="wpstg-update-select-all-tables"><?php esc_html_e('Select all live tables', 'wp-staging'); ?></button> |
| 484 | <span class="wpstg-update-list-sep" aria-hidden="true">·</span> |
| 485 | <button type="button" class="wpstg-update-deselect-all-tables"><?php esc_html_e('Deselect all', 'wp-staging'); ?></button> |
| 486 | </span> |
| 487 | </div> |
| 488 | <fieldset id="wpstg-setup-tables" class="wpstg-update-selection wpstg-update-selection--tables"> |
| 489 | <?php $tableScanner->renderTablesSelection(); ?> |
| 490 | </fieldset> |
| 491 | <p class="wpstg-update-critical-note" data-wpstg-update-critical-note data-note-both="<?php esc_attr_e('wp_users and wp_options affect logins, users, and site settings.', 'wp-staging'); ?>" data-note-users="<?php esc_attr_e('wp_users affects logins and user accounts.', 'wp-staging'); ?>" data-note-options="<?php esc_attr_e('wp_options affects site settings and configuration.', 'wp-staging'); ?>" style="display:none;"><?php $setupRenderer->icon('warning', 'wpstg-h-[13px] wpstg-w-[13px]'); ?><span data-wpstg-update-critical-text></span></p> |
| 492 | </div> |
| 493 | |
| 494 | <div class="wpstg-update-subblock"> |
| 495 | <div class="wpstg-update-subblock__label"><?php $setupRenderer->icon('folder', 'wpstg-h-[15px] wpstg-w-[15px]'); ?><?php esc_html_e('Files & folders', 'wp-staging'); ?></div> |
| 496 | <div class="wpstg-update-list-head"> |
| 497 | <span class="wpstg-update-list-count" data-wpstg-update-folders-count></span> |
| 498 | <span class="wpstg-update-list-actions"> |
| 499 | <button type="button" class="wpstg-update-select-all-files"><?php esc_html_e('Select all', 'wp-staging'); ?></button> |
| 500 | <span class="wpstg-update-list-sep" aria-hidden="true">·</span> |
| 501 | <button type="button" class="wpstg-update-deselect-all-files"><?php esc_html_e('Deselect all', 'wp-staging'); ?></button> |
| 502 | </span> |
| 503 | </div> |
| 504 | <fieldset id="wpstg-setup-files" class="wpstg-update-selection wpstg-update-selection--files"> |
| 505 | <?php $directoryScanner->renderFilesSelection(); ?> |
| 506 | </fieldset> |
| 507 | <p class="wpstg-m-0 wpstg-mt-2 wpstg-flex wpstg-items-start wpstg-gap-1.5 wpstg-text-[12px] wpstg-leading-snug wpstg-text-gray-500 dark:wpstg-text-slate-400"> |
| 508 | <?php $setupRenderer->icon('folder', 'wpstg-h-[13px] wpstg-w-[13px] wpstg-mt-0.5 wpstg-flex-shrink-0'); ?> |
| 509 | <span><?php echo wp_kses_post(sprintf( |
| 510 | /* translators: %s: the file name wp-config.php, shown in a monospace font. */ |
| 511 | __('Root files including %s are reset too.', 'wp-staging'), |
| 512 | '<span class="wpstg-font-mono">wp-config.php</span>' |
| 513 | )); ?></span> |
| 514 | </p> |
| 515 | </div> |
| 516 | |
| 517 | <p class="wpstg-update-saved-line"><?php $setupRenderer->icon('check', 'wpstg-h-3 wpstg-w-3'); ?><?php esc_html_e('Selection saved for the next reset.', 'wp-staging'); ?></p> |
| 518 | </div> |
| 519 | </div> |
| 520 | </div> |
| 521 | </section> |
| 522 | |
| 523 | <section class="wpstg-update-section"> |
| 524 | <div class="wpstg-create-accordion wpstg-staging-accordion"> |
| 525 | <?php $setupRenderer->engineSection($setupMode, $enginePanelId); ?> |
| 526 | </div> |
| 527 | </section> |
| 528 | </main> |
| 529 | |
| 530 | <aside class="wpstg-update-setup-modal__summary" aria-label="<?php esc_attr_e('Reset Summary', 'wp-staging'); ?>"> |
| 531 | <div class="wpstg-update-summary-sticky"> |
| 532 | <h2 class="wpstg-update-summary__heading"><?php $setupRenderer->icon('clipboard', 'wpstg-update-summary__heading-icon'); ?><?php esc_html_e('Reset Summary', 'wp-staging'); ?></h2> |
| 533 | <dl class="wpstg-update-summary-list"> |
| 534 | <div class="wpstg-update-summary-row"> |
| 535 | <dt><?php $setupRenderer->icon('server', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Target', 'wp-staging'); ?></dt> |
| 536 | <dd class="wpstg-update-summary-mono"><?php echo esc_html($stagingSiteName); ?></dd> |
| 537 | </div> |
| 538 | <div class="wpstg-update-summary-row"> |
| 539 | <dt><?php $setupRenderer->icon('globe', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Source', 'wp-staging'); ?></dt> |
| 540 | <dd><?php esc_html_e('Production site', 'wp-staging'); ?></dd> |
| 541 | </div> |
| 542 | <hr class="wpstg-update-summary-divider" /> |
| 543 | <div class="wpstg-update-summary-row"> |
| 544 | <dt><?php $setupRenderer->icon('database', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Tables', 'wp-staging'); ?></dt> |
| 545 | <dd data-wpstg-update-summary-tables></dd> |
| 546 | </div> |
| 547 | <div class="wpstg-update-summary-row"> |
| 548 | <dt><?php $setupRenderer->icon('folder', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Folders', 'wp-staging'); ?></dt> |
| 549 | <dd data-wpstg-update-summary-folders></dd> |
| 550 | </div> |
| 551 | <div class="wpstg-update-summary-row"> |
| 552 | <dt><?php $setupRenderer->icon('disk', 'wpstg-update-summary__icon'); ?><?php esc_html_e('Data to reset', 'wp-staging'); ?></dt> |
| 553 | <dd class="wpstg-update-summary-mono wpstg-update-summary-size"> |
| 554 | <span class="wpstg-create-disk-status"> |
| 555 | <span class="wpstg-create-disk-spinner" data-wpstg-disk-spinner aria-hidden="true"> |
| 556 | <svg viewBox="0 0 24 24" fill="none" width="14" height="14"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="3" opacity="0.2"></circle><path d="M21 12a9 9 0 0 0-9-9" stroke="currentColor" stroke-width="3" stroke-linecap="round"></path></svg> |
| 557 | </span> |
| 558 | <strong data-wpstg-disk-space-status data-status-checking="<?php esc_attr_e('Calculating…', 'wp-staging'); ?>" data-status-failed="<?php esc_attr_e('Check failed', 'wp-staging'); ?>">—</strong> |
| 559 | </span> |
| 560 | <span class="wpstg-create-disk-total" style="display:none;"><span data-wpstg-disk-space-value></span></span> |
| 561 | </dd> |
| 562 | </div> |
| 563 | </dl> |
| 564 | <a href="#" id="wpstg-check-space" class="wpstg-hidden" aria-hidden="true" tabindex="-1"><?php esc_html_e('Recalculate size', 'wp-staging'); ?></a> |
| 565 | <div id="wpstg-disk-space-result" class="wpstg-update-summary-disk-msg" style="display:none;"><div id="wpstg-disk-space-result-msg"></div></div> |
| 566 | |
| 567 | <div class="wpstg-update-backup-card"> |
| 568 | <div class="wpstg-update-backup-card__head"> |
| 569 | <?php $setupRenderer->icon('archive', 'wpstg-update-backup-card__icon'); ?> |
| 570 | <strong><?php esc_html_e('Back up staging first', 'wp-staging'); ?></strong> |
| 571 | <span class="wpstg-update-backup-card__pill"><?php esc_html_e('Recommended', 'wp-staging'); ?></span> |
| 572 | </div> |
| 573 | <p class="wpstg-update-backup-card__body"> |
| 574 | <?php echo wp_kses_post(sprintf( |
| 575 | /* translators: %s: staging site name */ |
| 576 | __('This reset cannot create a backup automatically. Open %s and create a WP STAGING backup before continuing.', 'wp-staging'), |
| 577 | '<span class="wpstg-font-semibold">' . esc_html($stagingSiteName) . '</span>' |
| 578 | )); ?> |
| 579 | </p> |
| 580 | <a href="<?php echo esc_url($stagingSiteUrl); ?>" target="_blank" rel="noopener noreferrer" class="wpstg-update-backup-card__button"> |
| 581 | <?php $setupRenderer->icon('external', 'wpstg-h-[13px] wpstg-w-[13px]'); ?><?php esc_html_e('Open staging site', 'wp-staging'); ?> |
| 582 | </a> |
| 583 | </div> |
| 584 | </div> |
| 585 | </aside> |
| 586 | </div> |
| 587 | |
| 588 | <footer class="wpstg-update-setup-modal__footer"> |
| 589 | <label class="wpstg-update-confirm-row" for="wpstg-update-review-confirmation"> |
| 590 | <?php Checkbox::render('wpstg-update-review-confirmation', 'wpstg-update-review-confirmation', '1', false, ['classes' => 'wpstg-update-review-confirmation-checkbox', 'usePrimitive' => true]); ?> |
| 591 | <span class="wpstg-update-confirm-row__text"> |
| 592 | <?php echo wp_kses_post(sprintf( |
| 593 | /* translators: %1$s: the word "rebuilds" (emphasized); %2$s: staging site name */ |
| 594 | __('I understand this %1$s %2$s and permanently deletes my staging changes.', 'wp-staging'), |
| 595 | '<span class="wpstg-update-confirm-strong">' . esc_html__('rebuilds', 'wp-staging') . '</span>', |
| 596 | '<span class="wpstg-update-confirm-site">' . esc_html($stagingSiteName) . '</span>' |
| 597 | )); ?> |
| 598 | </span> |
| 599 | </label> |
| 600 | <div class="wpstg-update-footer-actions"> |
| 601 | <button type="button" class="wpstg-reset-modal-cancel wpstg-btn wpstg-btn-md wpstg-h-11 wpstg-rounded-lg wpstg-py-0 wpstg-leading-none wpstg-btn-secondary wpstg-px-5"><?php esc_html_e('Cancel', 'wp-staging'); ?></button> |
| 602 | <button type="button" class="wpstg--reset--staging-site wpstg-setup-cta wpstg-setup-cta--red" data-url="<?php echo esc_attr($stagingSiteUrl); ?>" disabled> |
| 603 | <?php $setupRenderer->icon('refresh', 'wpstg-h-4 wpstg-w-4', 2); ?><?php esc_html_e('Reset Staging Site', 'wp-staging'); ?> |
| 604 | </button> |
| 605 | </div> |
| 606 | </footer> |
| 607 | </div> |
| 608 | <?php else : ?> |
| 609 | <div |
| 610 | class="wpstg-create-setup-modal wpstg-staging-setup-modal wpstg-text-left" |
| 611 | role="dialog" |
| 612 | aria-modal="true" |
| 613 | aria-labelledby="wpstg-create-modal-title" |
| 614 | data-engine-legacy-label="<?php esc_attr_e('Classic', 'wp-staging'); ?>" |
| 615 | data-engine-next-gen-label="<?php esc_attr_e('Next-Gen', 'wp-staging'); ?>" |
| 616 | data-engine-legacy-suffix="<?php esc_attr_e(' Engine - faster one available', 'wp-staging'); ?>" |
| 617 | data-engine-next-gen-suffix="<?php esc_attr_e(' Engine - recommended', 'wp-staging'); ?>" |
| 618 | data-summary-enabled="<?php esc_attr_e('Enabled', 'wp-staging'); ?>" |
| 619 | data-summary-disabled="<?php esc_attr_e('Disabled', 'wp-staging'); ?>" |
| 620 | data-summary-emails-enabled="<?php esc_attr_e('Enabled', 'wp-staging'); ?>" |
| 621 | data-summary-emails-disabled="<?php esc_attr_e('Disabled', 'wp-staging'); ?>" |
| 622 | data-summary-emails-enabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['emails']['enabled']); ?>" |
| 623 | data-summary-emails-disabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['emails']['disabled']); ?>" |
| 624 | data-summary-cron-enabled="<?php esc_attr_e('Enabled', 'wp-staging'); ?>" |
| 625 | data-summary-cron-disabled="<?php esc_attr_e('Disabled', 'wp-staging'); ?>" |
| 626 | data-summary-cron-enabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['cron']['enabled']); ?>" |
| 627 | data-summary-cron-disabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['cron']['disabled']); ?>" |
| 628 | data-summary-woo-enabled="<?php esc_attr_e('Enabled', 'wp-staging'); ?>" |
| 629 | data-summary-woo-disabled="<?php esc_attr_e('Disabled', 'wp-staging'); ?>" |
| 630 | data-summary-woo-enabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['woo']['enabled']); ?>" |
| 631 | data-summary-woo-disabled-tooltip="<?php echo esc_attr($runtimeSummaryTooltips['woo']['disabled']); ?>" |
| 632 | data-copy-tables-selected-automatically="<?php esc_attr_e('%s tables selected automatically.', 'wp-staging'); ?>" |
| 633 | data-copy-tables-summary="<?php esc_attr_e('%s tables', 'wp-staging'); ?>" |
| 634 | data-copy-files-summary="<?php esc_attr_e('%s core folders excluded', 'wp-staging'); ?>" |
| 635 | data-copy-files-summary-empty="<?php esc_attr_e('All folders selected', 'wp-staging'); ?>" |
| 636 | > |
| 637 | <?php $setupRenderer->closeButton('wpstg-create-modal-close wpstg-staging-modal-close'); ?> |
| 638 | <?php $setupRenderer->modalHeader(__('Create Staging Site', 'wp-staging'), __('Create a safe copy of your live site for testing changes.', 'wp-staging'), 'wpstg-create-modal-title', '', '', '', 'copy'); ?> |
| 639 | <?php |
| 640 | $setupRenderer->configurationBody([ |
| 641 | 'isCreate' => $isCreate, |
| 642 | 'isUpdate' => $isUpdate, |
| 643 | 'isReset' => $isReset, |
| 644 | 'isProLicenseActive' => $isProLicenseActive, |
| 645 | 'isProBuild' => $isPro, |
| 646 | 'setupMode' => $setupMode, |
| 647 | 'stagingSetup' => $stagingSetup, |
| 648 | 'stagingSiteDto' => $stagingSiteDto, |
| 649 | 'directoryScanner' => $directoryScanner, |
| 650 | 'tableScanner' => $tableScanner, |
| 651 | 'stagingSiteName' => $stagingSiteName, |
| 652 | 'defaultSiteName' => $defaultSiteName, |
| 653 | 'productionSiteUrl' => $productionSiteUrl, |
| 654 | 'selectedEngineName' => $selectedEngineName, |
| 655 | 'enginePanelId' => $enginePanelId, |
| 656 | 'showWooSchedulerSettings' => $showWooSchedulerSettings, |
| 657 | 'runtimeSummaryTooltips' => $runtimeSummaryTooltips, |
| 658 | 'defaultPathBase' => $defaultPathBase, |
| 659 | ]); |
| 660 | ?> |
| 661 | <?php $setupRenderer->createSetupFooter($previewSiteUrl); ?> |
| 662 | </div> |
| 663 | <?php endif; ?> |
| 664 |