Plugin Directory

Changeset 3373563


Ignore:
Timestamp:
10/06/2025 09:59:25 AM (6 months ago)
Author:
newcodebyte
Message:

Update to 1.0.3

Location:
advanced-redirect-manager
Files:
39 added
6 edited

Legend:

Unmodified
Added
Removed
  • advanced-redirect-manager/trunk/advanced-redirect-manager.php

    r3372484 r3373563  
    44 * Plugin URI:        https://wordpress.org/plugins/advanced-redirect-manager/
    55 * 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.2
     6 * Version:           1.0.3
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.4
     
    2323 * Define core plugin constants.
    2424 */
    25 define( 'NCB_ARM_VERSION', '1.0.2' );
     25define( 'NCB_ARM_VERSION', '1.0.3' );
    2626define( 'NCB_ARM_PLUGIN_FILE', __FILE__ );
    2727define( 'NCB_ARM_PLUGIN_PATH', plugin_dir_path( NCB_ARM_PLUGIN_FILE ) );
  • advanced-redirect-manager/trunk/assets/css/arm-admin-styles.css

    r3372484 r3373563  
    2222#arm-redirects-table .arm-status-307 { background-color: #d63638; }
    2323#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; }
    2426#arm-redirects-table .arm-status-off { background-color: #777; }
    2527
  • advanced-redirect-manager/trunk/includes/class-arm-db.php

    r3346799 r3373563  
    180180        $url_from = sanitize_text_field($data['url_from']);
    181181        $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';
    183183        $type = strpos($url_from, '*') !== false ? 'wildcard' : 'url';
    184184
     
    224224
    225225    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    ];
    227235        return $labels[$status] ?? $status;
    228236    }
  • advanced-redirect-manager/trunk/includes/class-arm-redirect-handler.php

    r3346799 r3373563  
    135135     */
    136136    private function execute_redirect($rule, $destination_url) {
    137         global $wpdb;
     137    global $wpdb;
    138138
    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));
    142142
    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;
    148144
    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    }
    157150
    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    }
    163156
    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();
    167169    }
    168170
  • advanced-redirect-manager/trunk/readme.txt

    r3372484 r3373563  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
     15Our 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
    1517Tired 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.
    1818
    1919What 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.
     
    2121= Why Choose Advanced Redirect Manager? =
    2222
    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).
    2525*   **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!
    2626*   **Proactive Broken Link Scanner:** Find and fix broken links throughout your content before Google or your visitors do. Checks both internal and external URLs.
     
    112112== Changelog ==
    113113
     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
    114120= 1.0.2 =
    115121*   **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  
    6464                            </th>
    6565                            <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>
    7383                            </td>
    7484                        </tr>
Note: See TracChangeset for help on using the changeset viewer.