modules
2 months ago
display-settings.php
2 months ago
migration-page.php
2 months ago
register-settings.php
2 months ago
migration-page.php
143 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display Logic Migration Page |
| 4 | * |
| 5 | * Provides a UI for reviewing and batch-migrating legacy display logic |
| 6 | * snippets to the new snippet-based system. |
| 7 | * |
| 8 | * @copyright Copyright (c) 2024, Widget Options Team |
| 9 | * @since 5.1 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly |
| 13 | if (!defined('ABSPATH')) exit; |
| 14 | ?> |
| 15 | <div class="wrap" id="widgetopts-migration-wrap"> |
| 16 | <h1><?php esc_html_e('Display Logic Migration', 'widget-options'); ?></h1> |
| 17 | |
| 18 | <div id="widgetopts-migration-notices"></div> |
| 19 | |
| 20 | <div id="widgetopts-migration-loading" style="padding: 20px; text-align: center;"> |
| 21 | <span class="spinner is-active" style="float: none;"></span> |
| 22 | <span><?php esc_html_e('Scanning website for legacy display logic...', 'widget-options'); ?></span> |
| 23 | </div> |
| 24 | |
| 25 | <div id="widgetopts-migration-empty" style="display:none; padding: 20px; background: #f0f6fc; border-left: 4px solid #72aee6;"> |
| 26 | <p><strong><?php esc_html_e('No legacy display logic found.', 'widget-options'); ?></strong></p> |
| 27 | <p><?php esc_html_e('All widgets are using the new snippet-based system.', 'widget-options'); ?></p> |
| 28 | </div> |
| 29 | |
| 30 | <div id="widgetopts-migration-content" style="display:none;"> |
| 31 | <div style="margin-bottom: 15px; display: flex; gap: 8px; align-items: center;"> |
| 32 | <button type="button" class="button button-primary" id="widgetopts-migrate-all"> |
| 33 | <?php esc_html_e('Migrate All', 'widget-options'); ?> |
| 34 | </button> |
| 35 | <button type="button" class="button" id="widgetopts-migrate-selected"> |
| 36 | <?php esc_html_e('Migrate Selected', 'widget-options'); ?> |
| 37 | </button> |
| 38 | <label style="margin-left: 10px;"> |
| 39 | <input type="checkbox" id="widgetopts-select-all" /> |
| 40 | <?php esc_html_e('Select All', 'widget-options'); ?> |
| 41 | </label> |
| 42 | </div> |
| 43 | |
| 44 | <table class="wp-list-table widefat fixed striped" id="widgetopts-migration-table"> |
| 45 | <thead> |
| 46 | <tr> |
| 47 | <td class="manage-column column-cb check-column" style="width: 40px;"> |
| 48 | <span class="screen-reader-text"><?php esc_html_e('Select', 'widget-options'); ?></span> |
| 49 | </td> |
| 50 | <th class="manage-column" style="width: 35%;"><?php esc_html_e('Code Snippet', 'widget-options'); ?></th> |
| 51 | <th class="manage-column" style="width: 20%;"><?php esc_html_e('Name', 'widget-options'); ?></th> |
| 52 | <th class="manage-column" style="width: 35%;"><?php esc_html_e('Locations', 'widget-options'); ?></th> |
| 53 | <th class="manage-column" style="width: 10%;"><?php esc_html_e('Actions', 'widget-options'); ?></th> |
| 54 | </tr> |
| 55 | </thead> |
| 56 | <tbody id="widgetopts-migration-tbody"> |
| 57 | </tbody> |
| 58 | </table> |
| 59 | </div> |
| 60 | </div> |
| 61 | |
| 62 | <style> |
| 63 | #widgetopts-migration-table .widgetopts-code-preview { |
| 64 | font-family: 'Courier New', Consolas, Monaco, monospace; |
| 65 | font-size: 12px; |
| 66 | line-height: 1.4; |
| 67 | background: #f9f2f4; |
| 68 | color: #c7254e; |
| 69 | padding: 8px 10px; |
| 70 | border-radius: 3px; |
| 71 | max-height: 120px; |
| 72 | overflow-y: auto; |
| 73 | white-space: pre-wrap; |
| 74 | word-break: break-all; |
| 75 | display: block; |
| 76 | } |
| 77 | #widgetopts-migration-table .widgetopts-name-input { |
| 78 | width: 100%; |
| 79 | padding: 4px 8px; |
| 80 | } |
| 81 | #widgetopts-migration-table .widgetopts-locations-list { |
| 82 | list-style: none; |
| 83 | margin: 0; |
| 84 | padding: 0; |
| 85 | font-size: 12px; |
| 86 | } |
| 87 | #widgetopts-migration-table .widgetopts-locations-list li { |
| 88 | padding: 2px 0; |
| 89 | color: #50575e; |
| 90 | } |
| 91 | #widgetopts-migration-table .widgetopts-locations-list .widgetopts-loc-type { |
| 92 | display: inline-block; |
| 93 | padding: 1px 6px; |
| 94 | border-radius: 3px; |
| 95 | font-size: 10px; |
| 96 | font-weight: 600; |
| 97 | text-transform: uppercase; |
| 98 | margin-right: 4px; |
| 99 | color: #fff; |
| 100 | } |
| 101 | .widgetopts-loc-type-classic_widget { background: #0073aa; } |
| 102 | .widgetopts-loc-type-gutenberg { background: #1e1e1e; } |
| 103 | .widgetopts-loc-type-elementor { background: #92003B; } |
| 104 | .widgetopts-loc-type-beaver { background: #6bc04b; } |
| 105 | .widgetopts-loc-type-siteorigin { background: #2ea2cc; } |
| 106 | .widgetopts-loc-count { |
| 107 | display: inline-block; |
| 108 | font-size: 11px; |
| 109 | font-weight: 600; |
| 110 | color: #787c82; |
| 111 | } |
| 112 | #widgetopts-migration-table .widgetopts-locations-list { |
| 113 | max-height: 150px; |
| 114 | overflow-y: auto; |
| 115 | } |
| 116 | #widgetopts-migration-table .button-delete { |
| 117 | color: #b32d2e; |
| 118 | border-color: #b32d2e; |
| 119 | } |
| 120 | #widgetopts-migration-table .button-delete:hover { |
| 121 | background: #b32d2e; |
| 122 | color: #fff; |
| 123 | } |
| 124 | .widgetopts-migration-notice { |
| 125 | padding: 10px 15px; |
| 126 | margin: 10px 0; |
| 127 | border-left: 4px solid; |
| 128 | background: #fff; |
| 129 | } |
| 130 | .widgetopts-migration-notice.success { |
| 131 | border-color: #00a32a; |
| 132 | background: #f0f6e8; |
| 133 | } |
| 134 | .widgetopts-migration-notice.error { |
| 135 | border-color: #d63638; |
| 136 | background: #fcf0f1; |
| 137 | } |
| 138 | .widgetopts-row-disabled { |
| 139 | opacity: 0.5; |
| 140 | pointer-events: none; |
| 141 | } |
| 142 | </style> |
| 143 |