Changeset 3373563
- Timestamp:
- 10/06/2025 09:59:25 AM (6 months ago)
- Location:
- advanced-redirect-manager
- Files:
-
- 39 added
- 6 edited
-
tags/1.0.3 (added)
-
tags/1.0.3/admin (added)
-
tags/1.0.3/admin/class-arm-admin-page.php (added)
-
tags/1.0.3/admin/class-arm-dashboard-widget.php (added)
-
tags/1.0.3/admin/class-arm-link-scanner.php (added)
-
tags/1.0.3/admin/class-arm-tools.php (added)
-
tags/1.0.3/admin/index.php (added)
-
tags/1.0.3/advanced-redirect-manager.php (added)
-
tags/1.0.3/assets (added)
-
tags/1.0.3/assets/css (added)
-
tags/1.0.3/assets/css/arm-admin-styles.css (added)
-
tags/1.0.3/assets/css/arm-flyout.css (added)
-
tags/1.0.3/assets/js (added)
-
tags/1.0.3/assets/js/arm-admin-scripts.js (added)
-
tags/1.0.3/assets/js/arm-flyout.js (added)
-
tags/1.0.3/includes (added)
-
tags/1.0.3/includes/class-advanced-redirect-manager.php (added)
-
tags/1.0.3/includes/class-arm-404-logger.php (added)
-
tags/1.0.3/includes/class-arm-activator.php (added)
-
tags/1.0.3/includes/class-arm-db.php (added)
-
tags/1.0.3/includes/class-arm-deactivator.php (added)
-
tags/1.0.3/includes/class-arm-redirect-handler.php (added)
-
tags/1.0.3/includes/index.php (added)
-
tags/1.0.3/index.php (added)
-
tags/1.0.3/languages (added)
-
tags/1.0.3/languages/advanced-redirect-manager-it_IT.mo (added)
-
tags/1.0.3/languages/advanced-redirect-manager-it_IT.po (added)
-
tags/1.0.3/languages/advanced-redirect-manager.pot (added)
-
tags/1.0.3/readme.txt (added)
-
tags/1.0.3/templates (added)
-
tags/1.0.3/templates/admin-page-wrapper.php (added)
-
tags/1.0.3/templates/modal-edit-rule.php (added)
-
tags/1.0.3/templates/tab-404-log.php (added)
-
tags/1.0.3/templates/tab-link-scanner.php (added)
-
tags/1.0.3/templates/tab-ncb-apps.php (added)
-
tags/1.0.3/templates/tab-redirect-rules.php (added)
-
tags/1.0.3/templates/tab-support.php (added)
-
tags/1.0.3/templates/tab-tools.php (added)
-
tags/1.0.3/uninstall.php (added)
-
trunk/advanced-redirect-manager.php (modified) (2 diffs)
-
trunk/assets/css/arm-admin-styles.css (modified) (1 diff)
-
trunk/includes/class-arm-db.php (modified) (2 diffs)
-
trunk/includes/class-arm-redirect-handler.php (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/templates/modal-edit-rule.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
advanced-redirect-manager/trunk/advanced-redirect-manager.php
r3372484 r3373563 4 4 * Plugin URI: https://wordpress.org/plugins/advanced-redirect-manager/ 5 5 * Description: A powerful suite for site maintenance: create and manage 301/302 redirects, monitor 404 errors in real-time, and proactively scan your content for broken links. 6 * Version: 1.0. 26 * Version: 1.0.3 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.4 … … 23 23 * Define core plugin constants. 24 24 */ 25 define( 'NCB_ARM_VERSION', '1.0. 2' );25 define( 'NCB_ARM_VERSION', '1.0.3' ); 26 26 define( 'NCB_ARM_PLUGIN_FILE', __FILE__ ); 27 27 define( 'NCB_ARM_PLUGIN_PATH', plugin_dir_path( NCB_ARM_PLUGIN_FILE ) ); -
advanced-redirect-manager/trunk/assets/css/arm-admin-styles.css
r3372484 r3373563 22 22 #arm-redirects-table .arm-status-307 { background-color: #d63638; } 23 23 #arm-redirects-table .arm-status-308 { background-color: #5b2a8a; } 24 #arm-redirects-table .arm-status-410 { background-color: #1d2327; } 25 #arm-redirects-table .arm-status-451 { background-color: #b02a2a; } 24 26 #arm-redirects-table .arm-status-off { background-color: #777; } 25 27 -
advanced-redirect-manager/trunk/includes/class-arm-db.php
r3346799 r3373563 180 180 $url_from = sanitize_text_field($data['url_from']); 181 181 $url_to = sanitize_text_field($data['url_to']); 182 $status = in_array($data['status'], ['301', '302', '307', '308', ' off']) ? $data['status'] : '301';182 $status = in_array($data['status'], ['301', '302', '307', '308', '410', '451', 'off']) ? $data['status'] : '301'; 183 183 $type = strpos($url_from, '*') !== false ? 'wildcard' : 'url'; 184 184 … … 224 224 225 225 private function get_status_label($status) { 226 $labels = ['301' => '301', '302' => '302', '307' => '307', '308' => '308', 'off' => 'Off']; 226 $labels = [ 227 '301' => '301', 228 '302' => '302', 229 '307' => '307', 230 '308' => '308', 231 '410' => '410', 232 '451' => '451', 233 'off' => 'Off' 234 ]; 227 235 return $labels[$status] ?? $status; 228 236 } -
advanced-redirect-manager/trunk/includes/class-arm-redirect-handler.php
r3346799 r3373563 135 135 */ 136 136 private function execute_redirect($rule, $destination_url) { 137 global $wpdb;137 global $wpdb; 138 138 139 // Incrementa il contatore delle visite (hits) per questa regola.140 $table_name = $wpdb->prefix . 'ncb_arm_redirects';141 $wpdb->query($wpdb->prepare("UPDATE {$table_name} SET count = count + 1, last_hit = %s WHERE id = %d", current_time('mysql'), $rule->id));139 // Incrementa il contatore delle visite (hits) per questa regola. 140 $table_name = $wpdb->prefix . 'ncb_arm_redirects'; 141 $wpdb->query($wpdb->prepare("UPDATE {$table_name} SET count = count + 1, last_hit = %s WHERE id = %d", current_time('mysql'), $rule->id)); 142 142 143 // Risolve la destinazione se è un ID numerico di un post/pagina. 144 if (is_numeric($destination_url)) { 145 $link = get_permalink((int) $destination_url); 146 if ($link) $destination_url = $link; 147 } 143 $status_code = (int) $rule->status; 148 144 149 // Rende l'URL assoluto se è relativo (inizia con '/'). 150 if (substr($destination_url, 0, 1) === '/') { 151 $destination_url = home_url($destination_url); 152 } 153 // Aggiunge 'https://' se manca uno schema (http, https, ftp, etc.). 154 else if (!preg_match("~^(?:f|ht)tps?://~i", $destination_url)) { 155 $destination_url = 'https://' . $destination_url; 156 } 145 // Se lo stato è un codice di errore (4xx), invia l'header e termina. 146 if ($status_code === 410 || $status_code === 451) { 147 wp_die( get_status_header_desc($status_code), '', array('response' => $status_code) ); 148 exit(); 149 } 157 150 158 // Imposta il codice di stato HTTP corretto, con 301 come fallback.159 $status_code = (int) $rule->status;160 if (!in_array($status_code, [301, 302, 307, 308])) {161 $status_code = 301;162 }151 // La logica di reindirizzamento rimane la stessa per i codici 3xx. 152 if (is_numeric($destination_url)) { 153 $link = get_permalink((int) $destination_url); 154 if ($link) $destination_url = $link; 155 } 163 156 164 // Esegue il reindirizzamento e termina l'esecuzione dello script. 165 wp_redirect(esc_url_raw($destination_url), $status_code); 166 exit(); 157 if (substr($destination_url, 0, 1) === '/') { 158 $destination_url = home_url($destination_url); 159 } else if (!preg_match("~^(?:f|ht)tps?://~i", $destination_url)) { 160 $destination_url = 'https://' . $destination_url; 161 } 162 163 if (!in_array($status_code, [301, 302, 307, 308])) { 164 $status_code = 301; 165 } 166 167 wp_redirect(esc_url_raw($destination_url), $status_code); 168 exit(); 167 169 } 168 170 -
advanced-redirect-manager/trunk/readme.txt
r3372484 r3373563 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 13 13 == Description == 14 14 15 Our powerful, yet user-friendly, interface allows you to manage your site's URLs with precision. Create all types of redirects (301, 302, 307, 308) with ease, including complex wildcard rules. But we don't stop there. You can also serve specific client error codes like 410 (Gone) for permanently removed content or 451 (Unavailable For Legal Reasons). Advanced Redirect Manager actively monitors your site for "Page Not Found" (404) errors, allowing you to turn lost traffic into successful conversions with just a few clicks. 16 15 17 Tired of losing visitors to broken links and 404 errors? **Advanced Redirect Manager** is your all-in-one solution for complete link management and site health monitoring. Go beyond simple redirects and take full control of your site's URL structure, user experience, and SEO performance. 16 17 Our powerful, yet user-friendly, interface allows you to create and manage all types of redirects (301, 302, 307, 308) with ease, including complex wildcard rules. But we don't stop there. Advanced Redirect Manager actively monitors your site for "Page Not Found" (404) errors, allowing you to turn lost traffic into successful conversions with just a few clicks.18 18 19 19 What truly sets us apart is the **proactive Link Scanner**. Don't wait for users to report broken links. Our intelligent scanner crawls your posts and pages, identifying both internal and external broken links before they can harm your site's reputation and search engine rankings. … … 21 21 = Why Choose Advanced Redirect Manager? = 22 22 23 * ** Effortless Redirect Management:** A clean, intuitive interface for creating, editing, and deleting 301, 302, 307 and 308 redirects.24 * **Powerful Wildcard Redirects:** Redirect entire directories or URL patterns with a single rule (e.g., `/blog/*` to `/articles/$1`).23 * **Complete URL Control:** A clean, intuitive interface for creating and managing all standard redirects (301, 308, 302, 307) and serving specific client errors like 410 (Gone) and 451 (Unavailable For Legal Reasons). 24 * **Powerful Wildcard Redirects:** Redirect entire directories or URL patterns with a single rule (e.g., /blog/* to /articles/$1). 25 25 * **Intelligent 404 Error Logging:** Automatically captures 404 errors, showing you exactly which pages visitors are trying to access. Create a redirect directly from the log! 26 26 * **Proactive Broken Link Scanner:** Find and fix broken links throughout your content before Google or your visitors do. Checks both internal and external URLs. … … 112 112 == Changelog == 113 113 114 = 1.0.3 = 115 * **New Feature:** Added support for serving 410 Gone and 451 Unavailable For Legal Reasons status codes for specific URLs. 116 * **Enhancement:** The status code selector in the rule editor is now grouped by category (Permanent, Temporary, Error) for a better user experience. 117 * **Enhancement:** Added distinct status badges and colors for the new 410 and 451 codes in the main redirect table for easy identification. 118 * **Tweak:** Updated plugin documentation and help texts to include information about the new 410 and 451 status codes. 119 114 120 = 1.0.2 = 115 121 * **New Feature:** Added "NewCodeByte Apps" section for a cleaner and more intuitive user experience, a new "NewCodeByte Apps" tab to showcase other available plugins from the author. -
advanced-redirect-manager/trunk/templates/modal-edit-rule.php
r3346799 r3373563 64 64 </th> 65 65 <td> 66 <select id="arm-status" name="status"> 67 <option value="301">301 - <?php esc_html_e( 'Moved Permanently', 'advanced-redirect-manager' ); ?></option> 68 <option value="308">308 - <?php esc_html_e( 'Permanent Redirect', 'advanced-redirect-manager' ); ?></option> 69 <option value="302">302 - <?php esc_html_e( 'Found', 'advanced-redirect-manager' ); ?></option> 70 <option value="307">307 - <?php esc_html_e( 'Temporary Redirect', 'advanced-redirect-manager' ); ?></option> 71 <option value="off">Off - <?php esc_html_e( 'Inactive', 'advanced-redirect-manager' ); ?></option> 72 </select> 66 <select id="arm-status" name="status"> 67 <optgroup label="<?php esc_attr_e( 'Permanent Redirects', 'advanced-redirect-manager' ); ?>"> 68 <option value="301">301 - <?php esc_html_e( 'Moved Permanently', 'advanced-redirect-manager' ); ?></option> 69 <option value="308">308 - <?php esc_html_e( 'Permanent Redirect', 'advanced-redirect-manager' ); ?></option> 70 </optgroup> 71 <optgroup label="<?php esc_attr_e( 'Temporary Redirects', 'advanced-redirect-manager' ); ?>"> 72 <option value="302">302 - <?php esc_html_e( 'Found', 'advanced-redirect-manager' ); ?></option> 73 <option value="307">307 - <?php esc_html_e( 'Temporary Redirect', 'advanced-redirect-manager' ); ?></option> 74 </optgroup> 75 <optgroup label="<?php esc_attr_e( 'Error & Other Codes', 'advanced-redirect-manager' ); ?>"> 76 <option value="410">410 - <?php esc_html_e( 'Gone', 'advanced-redirect-manager' ); ?></option> 77 <option value="451">451 - <?php esc_html_e( 'Unavailable For Legal Reasons', 'advanced-redirect-manager' ); ?></option> 78 </optgroup> 79 <optgroup label="<?php esc_attr_e( 'Rule Status', 'advanced-redirect-manager' ); ?>"> 80 <option value="off">Off - <?php esc_html_e( 'Inactive', 'advanced-redirect-manager' ); ?></option> 81 </optgroup> 82 </select> 73 83 </td> 74 84 </tr>
Note: See TracChangeset
for help on using the changeset viewer.