Plugin Directory

Changeset 3372798


Ignore:
Timestamp:
10/04/2025 10:51:50 AM (6 months ago)
Author:
newcodebyte
Message:

Update to 1.3.4

Location:
smart-external-links-manager
Files:
83 added
4 edited

Legend:

Unmodified
Added
Removed
  • smart-external-links-manager/trunk/css/welm-admin.css

    r3337893 r3372798  
    249249    margin-top: 15px;
    250250}
     251
     252/* --- Stili per il Pulsante di Reset --- */
     253.welm-reset-button {
     254    background-color: #d63638 !important; /* Colore rosso standard di WordPress per gli avvisi/errori */
     255    border-color: #d63638 !important;
     256    color: #fff !important; /* Testo bianco */
     257    box-shadow: none !important;
     258    text-shadow: none !important;
     259}
     260
     261/* Stile al passaggio del mouse (hover) */
     262.welm-reset-button:hover {
     263    background-color: #a71f21 !important; /* Un rosso più scuro */
     264    border-color: #a71f21 !important;
     265    color: #fff !important;
     266}
  • smart-external-links-manager/trunk/js/welm-admin.js

    r3351294 r3372798  
    4343        initializeTabs();
    4444
     45        // Gestione conferma per il reset delle impostazioni
     46        $('#welm-reset-form').on('submit', function(e) {
     47            // Usa la funzione di conferma nativa del browser
     48            if (!confirm('Are you sure you want to reset all settings to their default values? This action cannot be undone.')) {
     49                e.preventDefault(); // Annulla l'invio del form se l'utente clicca "Annulla"
     50            }
     51        });       
    4552
    4653        // --- GESTIONE LISTE (Force/Ignore) ---
  • smart-external-links-manager/trunk/readme.txt

    r3351294 r3372798  
    55Requires PHP: 7.0
    66Tested up to: 6.8.2
    7 Stable tag: 1.3.3
     7Stable tag: 1.3.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    106106== Changelog ==
    107107
     108= 1.3.4 =
     109*   **New Feature:** Added a "Reset to Default Settings" button on the settings page. This allows users to safely revert all options to their original configuration with a single click, improving usability and making troubleshooting easier.
     110*   **Tweak:** The new reset button is styled in red to clearly distinguish it as a potentially destructive action, following WordPress UI conventions.
     111
    108112= 1.3.3 =
    109113*   **New Feature:** Added an option to display a customizable text tooltip on mouse hover for all modified links, improving user experience and accessibility.
  • smart-external-links-manager/trunk/smart-external-links-manager.php

    r3351294 r3372798  
    33Plugin Name: Smart External Links Manager
    44Description: Opens external links in new tabs with full SEO control. Add nofollow, noopener, noreferrer & sponsored attributes. Highly configurable, secure and XHTML Strict compliant.
    5 Version: 1.3.3
     5Version: 1.3.4
    66Author: NewCodeByte
    77Author URI: https://newcodebyte.altervista.org
     
    4343        add_action('admin_init', array($this, 'register_settings'));
    4444        add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_assets'));
     45        add_action('admin_init', array($this, 'handle_reset_settings'));
    4546    }
    4647
     
    6465            dirname(plugin_basename(__FILE__)) . '/languages/'
    6566        );
     67    }
     68
     69    /**
     70     * Gestisce la richiesta di ripristino delle impostazioni predefinite.
     71     */
     72    public function handle_reset_settings() {
     73        // Controlla se la nostra azione di reset è stata inviata e se il nonce è valido
     74        if (isset($_POST['welm_action']) && $_POST['welm_action'] === 'reset_settings') {
     75           
     76            if (!isset($_POST['_wpnonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['_wpnonce'])), 'welm_reset_nonce_action')) {
     77                wp_die('Security check failed.');
     78            }
     79
     80            // Cancella l'opzione dal database
     81            delete_option('welm_settings');
     82
     83            // Aggiungi un avviso di successo
     84            add_settings_error(
     85                'welm_settings_reset',
     86                'settings_reset',
     87                __('Settings have been reset to their default values.', 'smart-external-links-manager'),
     88                'updated' // 'updated' è la classe CSS per il messaggio verde di successo
     89            );
     90
     91            // Ricarica la pagina per mostrare le impostazioni resettate e il messaggio
     92            // Usiamo wp_safe_redirect per sicurezza
     93            wp_safe_redirect(admin_url('options-general.php?page=smart_external_links_manager'));
     94            exit;
     95        }
    6696    }
    6797
     
    195225            )
    196226        );
    197 
    198         // Aggiungi questo blocco dentro la funzione register_settings()
    199227
    200228        // Abilita Tooltip
     
    592620        <div class="wrap">
    593621            <h1><?php echo esc_html(get_admin_page_title()); ?></h1>
     622            <?php settings_errors('welm_settings_reset'); ?>
    594623
    595624            <h2 class="nav-tab-wrapper">
     
    608637                    ?>
    609638                </form>
     639                <form method="post" id="welm-reset-form" style="margin-top: 20px;">
     640                    <input type="hidden" name="welm_action" value="reset_settings" />
     641                    <?php wp_nonce_field('welm_reset_nonce_action'); ?>
     642                    <button type="submit" class="button button-large welm-reset-button">
     643                        <?php esc_html_e('Reset to Default Settings', 'smart-external-links-manager'); ?>
     644                    </button>
     645                </form>               
    610646            </div>
    611647
Note: See TracChangeset for help on using the changeset viewer.