Plugin Directory

Changeset 3208056


Ignore:
Timestamp:
12/14/2024 11:52:58 PM (14 months ago)
Author:
rizonepress
Message:

Removed CSS redirect feature.

Location:
mail-cloak
Files:
13 added
3 edited

Legend:

Unmodified
Added
Removed
  • mail-cloak/trunk/assets/js/mail-cloak.js

    r3208054 r3208056  
    5353                $this.fadeOut(200, function() {
    5454                    if (isMailto && decodedMailto) {
    55                         // Set the href for mailto links
    5655                        $this.attr('href', decodedMailto);
    5756                    } else if ($this.is('a')) {
    58                         // Remove href for non-mailto links that were initially links
    5957                        $this.removeAttr('href');
    6058                    }
    6159                   
    62                     // Then show the email text
    6360                    $this.text(decodedEmail).fadeIn(200);
    6461                    $this.data('decoded', true);
     
    6663            }
    6764
    68             // Handle initial state and reveal
    6965            if (useTimeReveal === 'true') {
    70                 // For timed reveal
    7166                if (!$this.data('placeholder-set') && placeholder) {
    7267                    $this.text(placeholder);
    7368                    $this.data('placeholder-set', true);
    7469                }
    75                 // Only use delay if it's actually set
    7670                if (!isNaN(revealDelay) && revealDelay > 0) {
    7771                    setTimeout(revealEmail, revealDelay * 1000);
     
    8074                }
    8175            } else if (method === 'matrix' && placeholder) {
    82                 // For matrix encoding without timed reveal
    8376                if (!$this.data('placeholder-set')) {
    8477                    $this.text(placeholder);
     
    8780                revealEmail();
    8881            } else {
    89                 // No timed reveal or matrix encoding
    9082                revealEmail();
    9183            }
  • mail-cloak/trunk/mail-cloak.php

    r3208054 r3208056  
    44 * Plugin URI: https://rizonepress.com/plugins/mail-cloak
    55 * Description: Protects email addresses from spam bots and scrapers while keeping them visible to real users.
    6  * Version: 1.1.0
     6 * Version: 1.1.1
    77 * Author: rizonepress
    88 * Author URI: https://rizonepress.com
     
    4747            add_filter('the_title', array($this, 'cloak_emails_in_content'));
    4848           
    49             // Footer specific filters
    50             add_filter('dynamic_sidebar_params', array($this, 'filter_widget_params'));
    51             add_filter('widget_title', array($this, 'cloak_emails_in_content'));
    52            
    5349            // Theme customizer and custom fields
    5450            add_filter('theme_mod_custom_html', array($this, 'cloak_emails_in_content'));
     
    6864        $this->options = get_option('mail_cloak_settings', $this->get_default_settings());
    6965
    70         // Add CSS if redirection is enabled and we should cloak emails
    71         if (!empty($this->options['use_css_redirection']) && $this->should_cloak_emails()) {
    72             add_action('wp_head', array($this, 'add_css_redirection'));
    73         }
    74 
    7566        // Initialize honeypot trigger counter
    7667        add_action('init', array($this, 'init'));
     
    8374        return [
    8475            'encoding_method' => 'matrix',
    85             'use_css_redirection' => true,
    86             'use_honeypot' => false,
    87             'honeypot_email' => '',
    8876            'use_timed_reveal' => true,
    8977            'reveal_delay' => 3
     
    10795            'time' => 'email-time',
    10896            'delay' => 'email-delay',
    109             'redir' => 'email-redir',
    11097            'fake' => 'email-fake'
    11198        );
     
    225212            },
    226213            'mail-cloak-settings'
    227         );
    228 
    229         add_settings_field(
    230             'use_css_redirection',
    231             'CSS Direction Protection',
    232             array($this, 'css_redirection_callback'),
    233             'mail-cloak-settings',
    234             'mail_cloak_additional'
    235214        );
    236215
     
    298277
    299278    /**
    300      * CSS redirection field callback
    301      */
    302     public function css_redirection_callback() {
    303         $settings = get_option('mail_cloak_settings', $this->get_default_settings());
    304         $enabled = isset($settings['use_css_redirection']) ? $settings['use_css_redirection'] : false;
    305         ?>
    306         <div class="toggle-option">
    307             <input type="checkbox"
    308                    id="use_css_redirection"
    309                    name="mail_cloak_settings[use_css_redirection]"
    310                    value="1"
    311                    <?php checked($enabled, true); ?>>
    312             <label for="use_css_redirection" class="toggle-switch">
    313                 <span class="toggle-slider"></span>
    314             </label>
    315             <div class="toggle-content">
    316                 <div class="toggle-label">
    317                     CSS Direction Protection
    318                 </div>
    319                 <div class="toggle-description">
    320                     Dynamically reverses text direction and applies transforms to make email addresses unreadable to bots while maintaining perfect visibility for real users
    321                 </div>
    322             </div>
    323         </div>
    324         <?php
    325     }
    326 
    327     /**
    328279     * Timed reveal callback
    329280     */
    330281    public function timed_reveal_callback() {
    331282        $settings = get_option('mail_cloak_settings', $this->get_default_settings());
    332         $enabled = isset($settings['use_timed_reveal']) ? $settings['use_timed_reveal'] : false;
     283        $enabled = isset($settings['use_timed_reveal']) && $settings['use_timed_reveal'];
    333284        $delay = isset($settings['reveal_delay']) ? $settings['reveal_delay'] : 3;
    334285        ?>
     
    400351
    401352    /**
    402      * Add CSS redirection styles with dynamic class name
    403      */
    404     public function add_css_redirection() {
    405         $email_class = $this->get_email_class();
    406         ?>
    407         <style>
    408             .<?php echo esc_attr($email_class); ?>[data-redirect="1"]::before {
    409                 content: attr(data-fake);
    410                 display: inline;
    411             }
    412             .<?php echo esc_attr($email_class); ?>[data-redirect="1"] a {
    413                 position: absolute;
    414                 top: -9999px;
    415                 left: -9999px;
    416                 color: transparent;
    417                 background: transparent;
    418                 user-select: none;
    419             }
    420             @media print, screen {
    421                 .<?php echo esc_attr($email_class); ?>[data-redirect="1"]::before {
    422                     display: none;
    423                 }
    424                 .<?php echo esc_attr($email_class); ?>[data-redirect="1"] a {
    425                     position: static;
    426                     color: inherit;
    427                 }
    428             }
    429         </style>
    430         <?php
    431     }
    432 
    433     /**
    434353     * Cloak email addresses in content
    435354     */
     
    478397        // Handle both mailto links and plain emails
    479398        if (is_array($matches) && count($matches) > 2) {
    480             // For mailto links: $matches[1] is the email, $matches[2] is the display text
    481399            $email = $matches[1];
    482400            $display_text = $matches[2];
    483401            $is_mailto = true;
    484402        } else {
    485             // For plain emails: $matches is the email itself or $matches[1] for regex match
    486403            $email = is_array($matches) ? $matches[1] : $matches;
    487404            $display_text = $email;
     
    491408        $email_class = $this->get_email_class();
    492409       
    493         // Get encoding method from options
     410        // Get encoding method and protection options
    494411        $method = isset($this->options['encoding_method']) ? $this->options['encoding_method'] : 'entities';
    495412        $use_timed_reveal = isset($this->options['use_timed_reveal']) && $this->options['use_timed_reveal'];
     
    499416            $encoded_email = $this->custom_matrix_encoding($email);
    500417            $encoded_mailto = $is_mailto ? $this->custom_matrix_encoding('mailto:' . $email) : '';
    501             // Always use placeholder for matrix encoding to prevent showing encoded text
    502418            $placeholder = str_repeat('•', strlen($display_text));
    503419            $initial_text = $placeholder;
    504420        } else {
    505             // HTML entity encoding
    506421            $encoded_email = '';
    507422            $encoded_mailto = '';
    508423           
    509             // Encode email
    510424            for($i = 0; $i < strlen($email); $i++) {
    511425                $encoded_email .= '&#x' . bin2hex($email[$i]) . ';';
    512426            }
    513427           
    514             // Encode mailto only if it's a mailto link
    515428            if ($is_mailto) {
    516429                $mailto = 'mailto:' . $email;
     
    520433            }
    521434           
    522             // Only use placeholder if timed reveal is enabled
    523435            if ($use_timed_reveal) {
    524436                $placeholder = str_repeat('•', strlen($display_text));
    525437                $initial_text = $placeholder;
    526438            } else {
    527                 $placeholder = '';
    528439                $initial_text = $display_text;
    529440            }
     
    536447        );
    537448
    538         // Only add mailto data if it's a mailto link
    539449        if ($is_mailto && $encoded_mailto) {
    540450            $data_attrs[] = 'data-email-mailto="' . esc_attr($encoded_mailto) . '"';
    541451        }
    542452       
    543         // Add CSS redirection if enabled
    544         if (!empty($this->options['use_css_redirection'])) {
    545             $data_attrs[] = 'data-redirect="1"';
    546             // Add a fake email for bots to find
    547             $data_attrs[] = 'data-fake="[email protected]"';
    548         }
    549        
    550         // Add timed reveal attributes only if enabled with valid delay
    551453        if ($use_timed_reveal && $reveal_delay > 0) {
    552454            $data_attrs[] = 'data-email-time="true"';
    553455            $data_attrs[] = 'data-email-delay="' . esc_attr($reveal_delay) . '"';
    554             if ($placeholder) {
     456            if (isset($placeholder)) {
    555457                $data_attrs[] = 'data-placeholder="' . esc_attr($placeholder) . '"';
    556458            }
    557         } else if ($method === 'matrix' && $placeholder) {
    558             // For matrix encoding, always add placeholder even without time reveal
     459        } else if ($method === 'matrix' && isset($placeholder)) {
    559460            $data_attrs[] = 'data-placeholder="' . esc_attr($placeholder) . '"';
    560461        }
    561462
    562         // Build the final HTML - use <a> only for mailto links
     463        $attrs = implode(' ', $data_attrs);
     464       
    563465        if ($is_mailto) {
    564466            return sprintf(
    565467                '<a href="#" class="%s" %s>%s</a>',
    566468                esc_attr($email_class),
    567                 implode(' ', $data_attrs),
     469                $attrs,
    568470                esc_html($initial_text)
    569471            );
     
    572474                '<span class="%s" %s>%s</span>',
    573475                esc_attr($email_class),
    574                 implode(' ', $data_attrs),
     476                $attrs,
    575477                esc_html($initial_text)
    576478            );
     
    722624        // Boolean switches - store as actual booleans
    723625        $switches = array(
    724             'use_css_redirection',
    725626            'use_timed_reveal'
    726627        );
  • mail-cloak/trunk/readme.txt

    r3208054 r3208056  
    11=== Mail Cloak ===
    2 Contributors: RizonePress
     2Contributors: Rizonepress
    33Tags: email protection, anti-spam, email security, content protection, anti-scraping, email cloaking, spam protection
    44Requires at least: 5.0
    55Tested up to: 6.7
    6 Stable tag: 1.1.0
     6Stable tag: 1.1.1
    77Requires PHP: 7.2
    88License: GPLv2 or later
     
    1515Mail Cloak is an innovative WordPress plugin that provides sophisticated protection for email addresses on your website without compromising user experience. Using advanced encoding techniques, it makes email addresses invisible to spam bots and scrapers while ensuring they remain perfectly readable and clickable for your human visitors.
    1616
    17 = 🚀 Key Features =
     17= Key Features =
    1818
    1919* **Multiple Protection Methods** - Choose between Matrix encoding or HTML entities for optimal protection
    2020* **Timed Reveal Protection** - Optional delayed display of email addresses for enhanced security
    21 * **CSS Direction Protection** - Advanced CSS-based protection layer
    2221* **Smart Protection** - Automatically detects and protects all email addresses in your content
    2322* **Universal Coverage** - Protects emails in posts, pages, widgets, and custom post types
     
    2827* **Developer Friendly** - Clean code with hooks for customization
    2928
    30 = 🛡️ Protection Methods =
     29= Protection Methods =
    3130
    32311. **Matrix Encoding**
     
    4544   * Effective against automated scraping
    4645
    47 4. **CSS Direction**
    48    * Advanced CSS-based protection
    49    * Reverses text direction
    50    * Invisible to users, confusing to bots
    51 
    52 = 🎯 Perfect For =
     46= Perfect For =
    5347
    5448* Business websites displaying contact information
     
    5852* Any WordPress site that displays email addresses
    5953
    60 = 💡 Pro Tips =
     54= Pro Tips =
    6155
    62 * Mix and match protection methods for maximum security
    63 * Use timed reveal for critical email addresses
    64 * Enable CSS direction for an extra layer of protection
     56* Use matrix encoding for maximum security
     57* Enable timed reveal for critical email addresses
    6558* Customize placeholder text for better user experience
    6659
    67 = 🔒 Security First =
     60= Security First =
    6861
    6962Mail Cloak employs multiple layers of protection:
     
    7164* HTML entity encoding
    7265* Timed reveal protection
    73 * CSS direction scrambling
    74 * Bot detection patterns
    7566* Automated protection
    7667
     
    111102== Changelog ==
    112103
     104= 1.1.1 =
     105* Removed CSS direction protection layer to improve stability
     106* Fixed email display issues
     107* Enhanced compatibility with various themes and plugins
     108* Performance improvements
     109
    113110= 1.1.0 =
    114111* Added Matrix encoding method for enhanced protection
     
    125122== Upgrade Notice ==
    126123
     124= 1.1.1 =
     125This update removes the CSS direction protection layer and fixes email display issues. Update recommended for all users.
     126
    127127= 1.1.0 =
    128 Major update with new protection methods including Matrix encoding, timed reveal, and CSS direction protection. Upgrade for enhanced email security!
     128Major update with new protection methods including Matrix encoding and timed reveal. Upgrade for enhanced email security!
    129129
    130130= 1.0.0 =
     
    133133== Additional Info ==
    134134
    135 For more information and support, visit [RizonePress](https://rizonepress.com).
     135For more information and support, visit [Rizonepress](https://rizonepress.com).
Note: See TracChangeset for help on using the changeset viewer.