| @@ -220,10 +220,10 @@ | ||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /* Specific button targeting */ |
| 223 | 223 | .wrap input[type="submit"]#doaction, |
| 224 | - .wrap input[type="submit"]#post-query-submit, | |
| 225 | - .wrap input[type="submit"]#search-submit, | |
| 224 | + .wrap input[type="submit"]#redirections-filter-submit, | |
| 225 | + .wrap input[type="submit"]#redirections-search-submit, | |
| 226 | 226 | .wrap input[type="submit"].button { |
| 227 | 227 | background: var(--dashboard-accent) !important; |
| 228 | 228 | border-color: var(--dashboard-accent) !important; |
| 229 | 229 | color: white !important; |
| @@ -232,10 +232,10 @@ | ||
| 232 | 232 | transition: all 0.3s ease !important; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | .wrap input[type="submit"]#doaction:hover, |
| 236 | - .wrap input[type="submit"]#post-query-submit:hover, | |
| 237 | - .wrap input[type="submit"]#search-submit:hover, | |
| 236 | + .wrap input[type="submit"]#redirections-filter-submit:hover, | |
| 237 | + .wrap input[type="submit"]#redirections-search-submit:hover, | |
| 238 | 238 | .wrap input[type="submit"].button:hover { |
| 239 | 239 | background: var(--dashboard-accent-hover) !important; |
| 240 | 240 | border-color: var(--dashboard-accent-hover) !important; |
| 241 | 241 | transform: translateY(-1px) !important; |
| @@ -869,13 +869,40 @@ | ||
| 869 | 869 | <?php endif; ?> |
| 870 | 870 | </form> |
| 871 | 871 | </div> |
| 872 | 872 | |
| 873 | + | |
| 874 | + <!-- Auto-Redirect on Slug Change Setting --> | |
| 875 | + <?php | |
| 876 | + if (isset($_POST['metasync_save_auto_redirect']) && current_user_can('manage_options') && wp_verify_nonce($_POST['_metasync_auto_redirect_nonce'], 'metasync_auto_redirect_toggle')) { | |
| 877 | + $auto_redirect = isset($_POST['metasync_auto_redirect_enabled']) ? 1 : 0; | |
| 878 | + update_option('metasync_auto_redirect_enabled', $auto_redirect, true); | |
| 879 | + echo '<div class="notice notice-success is-dismissible"><p>Auto-redirect setting updated.</p></div>'; | |
| 880 | + } | |
| 881 | + $auto_redirect_current = get_option('metasync_auto_redirect_enabled', 1); | |
| 882 | + ?> | |
| 883 | + <div style="background: var(--dashboard-card-bg, #1a1f26); border: 1px solid var(--dashboard-border, #374151); border-radius: 8px; padding: 12px 16px; margin: 15px 0; display: flex; align-items: center; gap: 12px;"> | |
| 884 | + <form method="post" style="display: flex; align-items: center; gap: 12px; margin: 0;"> | |
| 885 | + <?php wp_nonce_field('metasync_auto_redirect_toggle', '_metasync_auto_redirect_nonce'); ?> | |
| 886 | + <label style="display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--dashboard-text-primary, #fff); font-weight: 500;"> | |
| 887 | + <input type="checkbox" name="metasync_auto_redirect_enabled" value="1" <?php checked($auto_redirect_current, 1); ?> onchange="this.form.submit();" style="width: 16px; height: 16px; margin: 0; flex-shrink: 0;"> | |
| 888 | + Auto-Redirect on Slug Change | |
| 889 | + </label> | |
| 890 | + <input type="hidden" name="metasync_save_auto_redirect" value="1"> | |
| 891 | + <?php if ($auto_redirect_current) : ?> | |
| 892 | + <span style="color: var(--dashboard-text-secondary, #9ca3af); font-size: 13px;">Redirects are created automatically when a post or page slug changes.</span> | |
| 893 | + <?php else : ?> | |
| 894 | + <span style="color: var(--dashboard-warning, #f59e0b); font-size: 13px;">Auto-redirects are paused. Slug changes will not create redirect rules (useful during migrations or bulk edits).</span> | |
| 895 | + <?php endif; ?> | |
| 896 | + </form> | |
| 897 | + </div> | |
| 898 | + | |
| 873 | 899 | <!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions --> |
| 874 | 900 | <form id="redirection-form" method="post" action=""> |
| 875 | 901 | <?php wp_nonce_field('metasync_redirection_form', 'metasync_redirection_nonce'); ?> |
| 876 | 902 | <?php include "metasync-add-redirection.php"; |
| 877 | - $request_data = metasync_sanitize_input_array($_REQUEST); ?> | |
| 903 | + $request_data = metasync_sanitize_input_array($_REQUEST); | |
| 904 | + $list_state = Metasync_Per_Page_Helper::request_state('redirections'); ?> | |
| 878 | 905 | <!-- For plugins, we also need to ensure that the form posts back to our current page --> |
| 879 | 906 | <input type="hidden" name="page" value="<?php echo esc_attr($request_data['page']) ?>" /> |
| 880 | 907 | |
| 881 | 908 | <!-- Search and Filter Controls --> |
| @@ -908,15 +935,15 @@ | ||
| 908 | 935 | <option value="410" <?php selected(isset($_REQUEST['http_code_filter']) ? $_REQUEST['http_code_filter'] : '', '410'); ?>>410 Gone</option> |
| 909 | 936 | <option value="451" <?php selected(isset($_REQUEST['http_code_filter']) ? $_REQUEST['http_code_filter'] : '', '451'); ?>>451 Unavailable</option> |
| 910 | 937 | </select> |
| 911 | 938 | |
| 912 | - <input type="submit" name="filter_action" id="post-query-submit" class="button" value="Filter"> | |
| 939 | + <input type="submit" name="filter_action" id="redirections-filter-submit" class="button" value="Filter"> | |
| 913 | 940 | </div> |
| 914 | 941 | |
| 915 | 942 | <div class="metasync-search-box"> |
| 916 | - <label class="screen-reader-text" for="post-search-input">Search Redirections:</label> | |
| 917 | - <input type="search" id="post-search-input" name="s" value="<?php echo esc_attr(isset($_REQUEST['s']) ? $_REQUEST['s'] : ''); ?>" placeholder="Search redirections..."> | |
| 918 | - <input type="submit" id="search-submit" class="button" value="Search"> | |
| 943 | + <label class="screen-reader-text" for="redirections-search-input">Search Redirections:</label> | |
| 944 | + <input type="search" id="redirections-search-input" name="s_redir" value="<?php echo esc_attr($list_state['s_redir'] ?? ''); ?>" placeholder="Search redirections..."> | |
| 945 | + <input type="submit" name="search_submit" id="redirections-search-submit" class="button" value="Search"> | |
| 919 | 946 | </div> |
| 920 | 947 | </div> |
| 921 | 948 | |
| 922 | 949 | <!-- Now we can render the completed list table --> |