Changeset 3208056
- Timestamp:
- 12/14/2024 11:52:58 PM (14 months ago)
- Location:
- mail-cloak
- Files:
-
- 13 added
- 3 edited
-
tags/1.1.1 (added)
-
tags/1.1.1/assets (added)
-
tags/1.1.1/assets/admin-style.css (added)
-
tags/1.1.1/assets/css (added)
-
tags/1.1.1/assets/css/admin.css (added)
-
tags/1.1.1/assets/css/mail-cloak.css (added)
-
tags/1.1.1/assets/img (added)
-
tags/1.1.1/assets/img/title.png (added)
-
tags/1.1.1/assets/js (added)
-
tags/1.1.1/assets/js/admin.js (added)
-
tags/1.1.1/assets/js/mail-cloak.js (added)
-
tags/1.1.1/mail-cloak.php (added)
-
tags/1.1.1/readme.txt (added)
-
trunk/assets/js/mail-cloak.js (modified) (4 diffs)
-
trunk/mail-cloak.php (modified) (15 diffs)
-
trunk/readme.txt (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mail-cloak/trunk/assets/js/mail-cloak.js
r3208054 r3208056 53 53 $this.fadeOut(200, function() { 54 54 if (isMailto && decodedMailto) { 55 // Set the href for mailto links56 55 $this.attr('href', decodedMailto); 57 56 } else if ($this.is('a')) { 58 // Remove href for non-mailto links that were initially links59 57 $this.removeAttr('href'); 60 58 } 61 59 62 // Then show the email text63 60 $this.text(decodedEmail).fadeIn(200); 64 61 $this.data('decoded', true); … … 66 63 } 67 64 68 // Handle initial state and reveal69 65 if (useTimeReveal === 'true') { 70 // For timed reveal71 66 if (!$this.data('placeholder-set') && placeholder) { 72 67 $this.text(placeholder); 73 68 $this.data('placeholder-set', true); 74 69 } 75 // Only use delay if it's actually set76 70 if (!isNaN(revealDelay) && revealDelay > 0) { 77 71 setTimeout(revealEmail, revealDelay * 1000); … … 80 74 } 81 75 } else if (method === 'matrix' && placeholder) { 82 // For matrix encoding without timed reveal83 76 if (!$this.data('placeholder-set')) { 84 77 $this.text(placeholder); … … 87 80 revealEmail(); 88 81 } else { 89 // No timed reveal or matrix encoding90 82 revealEmail(); 91 83 } -
mail-cloak/trunk/mail-cloak.php
r3208054 r3208056 4 4 * Plugin URI: https://rizonepress.com/plugins/mail-cloak 5 5 * Description: Protects email addresses from spam bots and scrapers while keeping them visible to real users. 6 * Version: 1.1. 06 * Version: 1.1.1 7 7 * Author: rizonepress 8 8 * Author URI: https://rizonepress.com … … 47 47 add_filter('the_title', array($this, 'cloak_emails_in_content')); 48 48 49 // Footer specific filters50 add_filter('dynamic_sidebar_params', array($this, 'filter_widget_params'));51 add_filter('widget_title', array($this, 'cloak_emails_in_content'));52 53 49 // Theme customizer and custom fields 54 50 add_filter('theme_mod_custom_html', array($this, 'cloak_emails_in_content')); … … 68 64 $this->options = get_option('mail_cloak_settings', $this->get_default_settings()); 69 65 70 // Add CSS if redirection is enabled and we should cloak emails71 if (!empty($this->options['use_css_redirection']) && $this->should_cloak_emails()) {72 add_action('wp_head', array($this, 'add_css_redirection'));73 }74 75 66 // Initialize honeypot trigger counter 76 67 add_action('init', array($this, 'init')); … … 83 74 return [ 84 75 'encoding_method' => 'matrix', 85 'use_css_redirection' => true,86 'use_honeypot' => false,87 'honeypot_email' => '',88 76 'use_timed_reveal' => true, 89 77 'reveal_delay' => 3 … … 107 95 'time' => 'email-time', 108 96 'delay' => 'email-delay', 109 'redir' => 'email-redir',110 97 'fake' => 'email-fake' 111 98 ); … … 225 212 }, 226 213 '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'235 214 ); 236 215 … … 298 277 299 278 /** 300 * CSS redirection field callback301 */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 Protection318 </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 users321 </div>322 </div>323 </div>324 <?php325 }326 327 /**328 279 * Timed reveal callback 329 280 */ 330 281 public function timed_reveal_callback() { 331 282 $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']; 333 284 $delay = isset($settings['reveal_delay']) ? $settings['reveal_delay'] : 3; 334 285 ?> … … 400 351 401 352 /** 402 * Add CSS redirection styles with dynamic class name403 */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 <?php431 }432 433 /**434 353 * Cloak email addresses in content 435 354 */ … … 478 397 // Handle both mailto links and plain emails 479 398 if (is_array($matches) && count($matches) > 2) { 480 // For mailto links: $matches[1] is the email, $matches[2] is the display text481 399 $email = $matches[1]; 482 400 $display_text = $matches[2]; 483 401 $is_mailto = true; 484 402 } else { 485 // For plain emails: $matches is the email itself or $matches[1] for regex match486 403 $email = is_array($matches) ? $matches[1] : $matches; 487 404 $display_text = $email; … … 491 408 $email_class = $this->get_email_class(); 492 409 493 // Get encoding method fromoptions410 // Get encoding method and protection options 494 411 $method = isset($this->options['encoding_method']) ? $this->options['encoding_method'] : 'entities'; 495 412 $use_timed_reveal = isset($this->options['use_timed_reveal']) && $this->options['use_timed_reveal']; … … 499 416 $encoded_email = $this->custom_matrix_encoding($email); 500 417 $encoded_mailto = $is_mailto ? $this->custom_matrix_encoding('mailto:' . $email) : ''; 501 // Always use placeholder for matrix encoding to prevent showing encoded text502 418 $placeholder = str_repeat('•', strlen($display_text)); 503 419 $initial_text = $placeholder; 504 420 } else { 505 // HTML entity encoding506 421 $encoded_email = ''; 507 422 $encoded_mailto = ''; 508 423 509 // Encode email510 424 for($i = 0; $i < strlen($email); $i++) { 511 425 $encoded_email .= '&#x' . bin2hex($email[$i]) . ';'; 512 426 } 513 427 514 // Encode mailto only if it's a mailto link515 428 if ($is_mailto) { 516 429 $mailto = 'mailto:' . $email; … … 520 433 } 521 434 522 // Only use placeholder if timed reveal is enabled523 435 if ($use_timed_reveal) { 524 436 $placeholder = str_repeat('•', strlen($display_text)); 525 437 $initial_text = $placeholder; 526 438 } else { 527 $placeholder = '';528 439 $initial_text = $display_text; 529 440 } … … 536 447 ); 537 448 538 // Only add mailto data if it's a mailto link539 449 if ($is_mailto && $encoded_mailto) { 540 450 $data_attrs[] = 'data-email-mailto="' . esc_attr($encoded_mailto) . '"'; 541 451 } 542 452 543 // Add CSS redirection if enabled544 if (!empty($this->options['use_css_redirection'])) {545 $data_attrs[] = 'data-redirect="1"';546 // Add a fake email for bots to find547 $data_attrs[] = 'data-fake="[email protected]"';548 }549 550 // Add timed reveal attributes only if enabled with valid delay551 453 if ($use_timed_reveal && $reveal_delay > 0) { 552 454 $data_attrs[] = 'data-email-time="true"'; 553 455 $data_attrs[] = 'data-email-delay="' . esc_attr($reveal_delay) . '"'; 554 if ( $placeholder) {456 if (isset($placeholder)) { 555 457 $data_attrs[] = 'data-placeholder="' . esc_attr($placeholder) . '"'; 556 458 } 557 } else if ($method === 'matrix' && $placeholder) { 558 // For matrix encoding, always add placeholder even without time reveal 459 } else if ($method === 'matrix' && isset($placeholder)) { 559 460 $data_attrs[] = 'data-placeholder="' . esc_attr($placeholder) . '"'; 560 461 } 561 462 562 // Build the final HTML - use <a> only for mailto links 463 $attrs = implode(' ', $data_attrs); 464 563 465 if ($is_mailto) { 564 466 return sprintf( 565 467 '<a href="#" class="%s" %s>%s</a>', 566 468 esc_attr($email_class), 567 implode(' ', $data_attrs),469 $attrs, 568 470 esc_html($initial_text) 569 471 ); … … 572 474 '<span class="%s" %s>%s</span>', 573 475 esc_attr($email_class), 574 implode(' ', $data_attrs),476 $attrs, 575 477 esc_html($initial_text) 576 478 ); … … 722 624 // Boolean switches - store as actual booleans 723 625 $switches = array( 724 'use_css_redirection',725 626 'use_timed_reveal' 726 627 ); -
mail-cloak/trunk/readme.txt
r3208054 r3208056 1 1 === Mail Cloak === 2 Contributors: Rizone Press2 Contributors: Rizonepress 3 3 Tags: email protection, anti-spam, email security, content protection, anti-scraping, email cloaking, spam protection 4 4 Requires at least: 5.0 5 5 Tested up to: 6.7 6 Stable tag: 1.1. 06 Stable tag: 1.1.1 7 7 Requires PHP: 7.2 8 8 License: GPLv2 or later … … 15 15 Mail 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. 16 16 17 = 🚀Key Features =17 = Key Features = 18 18 19 19 * **Multiple Protection Methods** - Choose between Matrix encoding or HTML entities for optimal protection 20 20 * **Timed Reveal Protection** - Optional delayed display of email addresses for enhanced security 21 * **CSS Direction Protection** - Advanced CSS-based protection layer22 21 * **Smart Protection** - Automatically detects and protects all email addresses in your content 23 22 * **Universal Coverage** - Protects emails in posts, pages, widgets, and custom post types … … 28 27 * **Developer Friendly** - Clean code with hooks for customization 29 28 30 = 🛡️Protection Methods =29 = Protection Methods = 31 30 32 31 1. **Matrix Encoding** … … 45 44 * Effective against automated scraping 46 45 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 = 53 47 54 48 * Business websites displaying contact information … … 58 52 * Any WordPress site that displays email addresses 59 53 60 = 💡Pro Tips =54 = Pro Tips = 61 55 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 65 58 * Customize placeholder text for better user experience 66 59 67 = 🔒Security First =60 = Security First = 68 61 69 62 Mail Cloak employs multiple layers of protection: … … 71 64 * HTML entity encoding 72 65 * Timed reveal protection 73 * CSS direction scrambling74 * Bot detection patterns75 66 * Automated protection 76 67 … … 111 102 == Changelog == 112 103 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 113 110 = 1.1.0 = 114 111 * Added Matrix encoding method for enhanced protection … … 125 122 == Upgrade Notice == 126 123 124 = 1.1.1 = 125 This update removes the CSS direction protection layer and fixes email display issues. Update recommended for all users. 126 127 127 = 1.1.0 = 128 Major update with new protection methods including Matrix encoding , timed reveal, and CSS direction protection. Upgrade for enhanced email security!128 Major update with new protection methods including Matrix encoding and timed reveal. Upgrade for enhanced email security! 129 129 130 130 = 1.0.0 = … … 133 133 == Additional Info == 134 134 135 For more information and support, visit [Rizone Press](https://rizonepress.com).135 For more information and support, visit [Rizonepress](https://rizonepress.com).
Note: See TracChangeset
for help on using the changeset viewer.