files.php
112 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @var stdClass $options |
| 5 | * @var $scan Object |
| 6 | * @var $excludeUtils Object |
| 7 | * @see src/views/clone/ajax/scan.php Context where this is included. |
| 8 | * @see \WPStaging\Backend\Modules\Jobs\Scan::start For details on $options. |
| 9 | */ |
| 10 | |
| 11 | use WPStaging\Backend\Modules\Jobs\Job; |
| 12 | use WPStaging\Framework\Facades\Escape; |
| 13 | |
| 14 | ?> |
| 15 | <p> |
| 16 | <strong><?php esc_html_e("Select Folders to Copy", "wp-staging") ?></strong> |
| 17 | <br> |
| 18 | <?php esc_html_e("Click on a folder name to expand it.", "wp-staging") ?> |
| 19 | </p> |
| 20 | <div id="wpstg-directories-listing" data-existing-excludes="<?php echo (($options->mainJob === Job::UPDATE || $options->mainJob === Job::RESET) && isset($options->currentClone['excludedDirectories'])) ? esc_html(implode(',', $options->currentClone['excludedDirectories'])) : '' ?>"> |
| 21 | <div class="wpstg-mb-8px"> |
| 22 | <button type="button" class="wpstg-unselect-dirs button"><?php esc_html_e('Unselect All', 'wp-staging'); ?></button> |
| 23 | <button type="button" class="wpstg-select-dirs-default button"> <?php esc_html_e('Select Default', 'wp-staging'); ?></button> |
| 24 | </div> |
| 25 | <?php echo $scan->directoryListing(); // phpcs:ignore ?> |
| 26 | </div> |
| 27 | <!-- Exclusion Rules Table --> |
| 28 | <div class="wpstg-excluded-filters-container" id="wpstg-exclude-filters-container"> |
| 29 | <div class="wpstg-exclude-list"> |
| 30 | <?php |
| 31 | $hasRules = false; |
| 32 | if ($options->mainJob === Job::UPDATE || $options->mainJob === Job::RESET) : |
| 33 | foreach ($options->currentClone['excludeSizeRules'] as $rule) : |
| 34 | $hasRules = true; |
| 35 | echo $excludeUtils->renderSizeExclude($rule); // phpcs:ignore |
| 36 | endforeach; |
| 37 | foreach ($options->currentClone['excludeGlobRules'] as $rule) : |
| 38 | $hasRules = true; |
| 39 | echo $excludeUtils->renderGlobExclude($rule); // phpcs:ignore |
| 40 | endforeach; |
| 41 | endif; ?> |
| 42 | </div> |
| 43 | <p><b><?php esc_html_e('Note', 'wp-staging'); ?>:</b> <?php esc_html_e('These rules will not affect wp-admin and wp-includes directories!', 'wp-staging')?></p> |
| 44 | <div class="wpstg-exclude-filters-foot"> |
| 45 | <div class="wpstg-dropdown wpstg-exclude-filter-dropdown" id="wpstg-exclude-filter-dropdown"> |
| 46 | <button class="wpstg-dropdown-toggler wpstg-button--secondary wpstg-button--blue"> |
| 47 | <?php esc_html_e("Add Exclude Rule + ", "wp-staging"); ?> |
| 48 | </button> |
| 49 | <div class="wpstg-dropdown-menu wpstg-menu-dropup" id="wpstg-exclude-filter-dropdown-menu"> |
| 50 | <button class="wpstg-dropdown-action wpstg-file-size-rule"><?php esc_html_e('File Size', 'wp-staging'); ?></button> |
| 51 | <button class="wpstg-dropdown-action wpstg-file-ext-rule"><?php esc_html_e('File Extension', 'wp-staging'); ?></button> |
| 52 | <button class="wpstg-dropdown-action wpstg-file-name-rule"><?php esc_html_e('File Name', 'wp-staging'); ?></button> |
| 53 | <button class="wpstg-dropdown-action wpstg-dir-name-rule"><?php esc_html_e('Folder Name', 'wp-staging'); ?></button> |
| 54 | </div> |
| 55 | </div> |
| 56 | <button <?php echo !$hasRules ? 'style="display: none;"' : '' ?> class="wpstg-ml-8px wpstg-button--secondary wpstg-clear-all-rules wpstg-has-exclude-rules wpstg-button--red"> |
| 57 | <?php esc_html_e("Clear All Rules", "wp-staging"); ?> |
| 58 | </button> |
| 59 | </div> |
| 60 | </div> |
| 61 | <?php |
| 62 | if ($options->current !== null && $options->mainJob === 'updating') { |
| 63 | echo '<p>' . esc_html__("Applying an exclude rule will not effect existing files on the staging site if you don't clean up the wp-content folder before updating. Existing files will not be deleted afterwards automatically!", 'wp-staging') . '</p>'; |
| 64 | } |
| 65 | ?> |
| 66 | <!-- End Exclusion Rules Table --> |
| 67 | |
| 68 | <!-- Templates for exclusion filters. These will never be rendered until added to exclusion rule table --> |
| 69 | <?php unset($rule); ?> |
| 70 | <template id="wpstg-file-ext-exclude-filter-template"> |
| 71 | <?php require(WPSTG_VIEWS_DIR . 'exclude-filters/file-ext-exclude-filter.php'); ?> |
| 72 | </template> |
| 73 | <template id="wpstg-file-size-exclude-filter-template"> |
| 74 | <?php require(WPSTG_VIEWS_DIR . 'exclude-filters/file-size-exclude-filter.php'); ?> |
| 75 | </template> |
| 76 | <template id="wpstg-file-name-exclude-filter-template"> |
| 77 | <?php require(WPSTG_VIEWS_DIR . 'exclude-filters/file-name-exclude-filter.php'); ?> |
| 78 | </template> |
| 79 | <template id="wpstg-dir-name-exclude-filter-template"> |
| 80 | <?php require(WPSTG_VIEWS_DIR . 'exclude-filters/dir-name-exclude-filter.php'); ?> |
| 81 | </template> |
| 82 | <!-- End - Templates for exclusion filters --> |
| 83 | |
| 84 | <?php if (defined('WPSTG_ALLOW_EXTRA_DIRECTORIES') && WPSTG_ALLOW_EXTRA_DIRECTORIES) { ?> |
| 85 | <h4 style="margin:10px 0 10px 0"> |
| 86 | <?php echo esc_html__("Extra directories to copy", "wp-staging") ?> |
| 87 | </h4> |
| 88 | |
| 89 | <textarea id="wpstg_extraDirectories" name="wpstg_extraDirectories" style="width:100%;height:100px;"></textarea> |
| 90 | <p> |
| 91 | <span> |
| 92 | <?php |
| 93 | echo sprintf( |
| 94 | Escape::escapeHtml(__("Enter one folder path per line.<br>Folders must be relative to the path: %s", 'wp-staging')), |
| 95 | esc_html($options->root) |
| 96 | ); |
| 97 | ?> |
| 98 | </span> |
| 99 | </p> |
| 100 | <?php } ?> |
| 101 | |
| 102 | <p> |
| 103 | <span> |
| 104 | <?php |
| 105 | if (isset($options->current)) { |
| 106 | $destination = isset($options->currentClone['cloneDir']) ? $options->currentClone['cloneDir'] : $options->currentClone['path']; |
| 107 | echo esc_html__("All files will be copied to: ", "wp-staging") . "<code>" . esc_html($destination) . "</code>"; |
| 108 | } |
| 109 | ?> |
| 110 | </span> |
| 111 | </p> |
| 112 |