Changeset 3114115
- Timestamp:
- 07/08/2024 09:12:35 AM (21 months ago)
- Location:
- en-spam
- Files:
-
- 9 added
- 7 edited
-
tags/1.0 (added)
-
tags/1.0/README.md (added)
-
tags/1.0/default.mo (added)
-
tags/1.0/default.pot (added)
-
tags/1.0/en-spam-he_IL.mo (added)
-
tags/1.0/en-spam-he_IL.po (added)
-
tags/1.0/en-spam.js (added)
-
tags/1.0/en-spam.php (added)
-
tags/1.0/readme.txt (added)
-
trunk/README.md (modified) (3 diffs)
-
trunk/default.pot (modified) (1 diff)
-
trunk/en-spam-he_IL.mo (modified) (previous)
-
trunk/en-spam-he_IL.po (modified) (1 diff)
-
trunk/en-spam.js (modified) (1 diff)
-
trunk/en-spam.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
en-spam/trunk/README.md
r3112188 r3114115 1 1 # En Spam # 2 2 **Contributors:** hatul 3 3 4 **Donate link:** https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4HTHWS3LGDDPJ 5 4 6 **Tags:** anti-spam, antispam, block spam, bot, comment, comment spam, comments, spam, Spam Free, spambot, hebrew 7 5 8 **Requires at least:** 2.0 9 6 10 **Tested up to:** 6.6 7 **Stable tag:** 0.7.2 11 12 **Stable tag:** 1.0 8 13 9 14 Block spam with cookies and JavaScript. … … 16 21 17 22 The plugin is transparent to your visitors, only bots will be blocked. 23 24 We protect Elementor Pro and Contact Form 7 (cf7) forms and default comments of WordPress. 18 25 19 26 You can see how many spambots blocked in dashboard widget. … … 29 36 30 37 ## Changelog ## 38 = 1.0 = 39 * Add support to Elementor form and contact form 7 (cf7) 31 40 ### 0.7.2 ### 32 41 * Add support to old PHP versions -
en-spam/trunk/default.pot
r1091706 r3114115 36 36 msgid "Blocked Spambots by En Spam" 37 37 msgstr "" 38 39 msgid "Enable JavaScript and cookies" 40 msgstr "" -
en-spam/trunk/en-spam-he_IL.po
r1091706 r3114115 36 36 msgid "Blocked Spambots by En Spam" 37 37 msgstr "כמה בוטים en spam חסם" 38 39 #: /srv/http/wp/wp-content/plugins/en-spam/en-spam.php:75 40 msgid "Enable JavaScript and cookies" 41 msgstr "יש לאפשר JavaScript ועוגיות" -
en-spam/trunk/en-spam.js
r1090570 r3114115 1 function setCookie(c _name,value,exdays) {2 var exdate=new Date();3 exdate.setDate(exdate.getDate() + exdays);4 var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()) + "; path=/";5 document.cookie =c_name + "=" + c_value;1 function setCookie(cname, cvalue, exdays) { 2 const d = new Date(); 3 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 4 const expires = "expires=" + d.toUTCString(); 5 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 6 6 } 7 7 8 function getCookie(c_name) { 9 var i,x,y,ARRcookies=document.cookie.split(";"); 10 for (i=0;i<ARRcookies.length;i++) { 11 x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); 12 y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); 13 x=x.replace(/^\s+|\s+$/g,""); 14 if (x==c_name) { 15 return unescape(y); 16 } 17 } 18 } 19 20 jQuery(document).ready(function( $ ) { 21 $('#commentform').submit(function(){ 22 var hash = data.hash; 23 if (!getCookie('wordpress_logged_in_' + hash) && !getCookie('comment_author_email_' + hash)) { 24 setCookie('comment_author_email_' + hash, $('#email').val(), 30); 25 } 26 }); 27 }); 8 setCookie('en_spam_validate', 1, 30); -
en-spam/trunk/en-spam.php
r2949086 r3114115 4 4 Description: Block Spam with Cookies and JavaScript Filtering. 5 5 Plugin URI: http://hatul.info/en-spam 6 Version: 0.7.36 Version: 1.0 7 7 Author: Hatul 8 8 Author URI: http://hatul.info … … 10 10 */ 11 11 12 load_plugin_textdomain('en-spam', false, dirname( plugin_basename( __FILE__ ) ) ); 13 12 14 add_filter('preprocess_comment','ens_check_comment'); 13 15 function ens_check_comment($comment){ 14 if ((isset($_COOKIE['comment_author_email_' . COOKIEHASH])) 15 || (is_user_logged_in()) 16 || ($_POST['code'] == get_option('ens_code'))) { 16 if (ens_valid_no_bot() || wp_verify_nonce($_POST['code'], 'en-spam')) { 17 17 $comment['comment_content'] = stripcslashes($comment['comment_content']); 18 18 return $comment; … … 22 22 23 23 function ens_block_page(){ 24 $counter = get_option('ens_counter', 0) + 1; 25 update_option('ens_counter', $counter); 24 ens_count_block(); 26 25 27 26 $message = sprintf(__('For to post comment, you need to enable cookies and JavaScript or to click on "%s" button in this page', 'en-spam'), __( 'Post Comment' )); 28 27 $message .= '<form method="post">'; 29 28 foreach ($_POST as $name=>$value){ 30 if ($name == 'comment') {29 if ($name == 'comment') 31 30 $message .= sprintf('<label for="comment">%s</label><br /><textarea id="comment" name="comment">%s</textarea><br />',__('Your comment:', 'en-spam'), $value); 32 } 33 elseif (is_string($value)){ 31 else 34 32 $message .= sprintf('<input type="hidden" name="%s" value="%s" />', $name, stripcslashes($value)); 35 }36 33 } 37 $message .= sprintf('<input type="hidden" name="code" value="%s" />', get_option('ens_code'));34 $message .= sprintf('<input type="hidden" name="code" value="%s" />', wp_create_nonce('en-spam')); 38 35 $message .= sprintf('<input type="submit" name="submit" value="%s" />', __( 'Post Comment' )); 39 36 $message .= '</form>'; … … 42 39 } 43 40 44 45 //random code in activation the plugin 46 register_activation_hook(__FILE__, 'ens_init_code'); 47 function ens_init_code(){ 48 update_option('ens_code', rand(10000, 99999)); 41 function ens_count_block(){ 42 $counter = get_option('ens_counter', 0) + 1; 43 update_option('ens_counter', $counter); 49 44 } 50 45 51 46 add_action('wp_enqueue_scripts', 'ens_scripts'); 52 47 function ens_scripts() { 53 wp_register_script('en-spam', plugins_url('en-spam.js', __FILE__), array('jquery')); 54 wp_localize_script('en-spam', 'data', array('hash' => COOKIEHASH)); 55 wp_enqueue_script('en-spam'); 48 wp_enqueue_script('en-spam', plugins_url('en-spam.js', __FILE__)); 56 49 } 57 50 … … 69 62 } 70 63 71 load_plugin_textdomain('en-spam', false, dirname( plugin_basename( __FILE__ ) ) ); 64 function ens_valid_no_bot(){ 65 return isset($_COOKIE['comment_author_email_' . COOKIEHASH]) 66 || is_user_logged_in() 67 || isset($_COOKIE['en_spam_validate']); 68 } 69 70 // CF7 71 function ens_check_cf7($form, &$abort, $submission) { 72 if (! ens_valid_no_bot()) { 73 $abort = true; 74 $submission->set_status( 'validation_failed' ); 75 $submission->set_response($form->filter_message(__('Enable JavaScript and cookies', 'en-spam'))); 76 77 ens_count_block(); 78 } 79 } 80 add_action( 'wpcf7_before_send_mail', 'ens_check_cf7', 10, 3); 81 82 // Elementor Form 83 function ens_check_elementor_form($record, $ajax_handler) { 84 if (! ens_valid_no_bot()){ 85 $ajax_handler->add_error('field_id', __('Enable JavaScript and cookies', 'en-spam')); // stop sending 86 $ajax_handler->add_error_message(__('Enable JavaScript and cookies', 'en-spam')); 87 } 88 } 89 add_action( 'elementor_pro/forms/validation', 'ens_check_elementor_form'); -
en-spam/trunk/readme.txt
r3112188 r3114115 5 5 Requires at least: 2.0 6 6 Tested up to: 6.6 7 Stable tag: 0.7.27 Stable tag: 1.0 8 8 9 9 Block spam with cookies and JavaScript. … … 12 12 == Description == 13 13 14 "En Spam" blocks totally comments of bots by cookies and javascript. Bots can't use cookies and javascript and therefore will not be able to comment.14 "En Spam" blocks totally comments and form submissions of bots by cookies and javascript. Bots can't use cookies and javascript and therefore will not be able to comment. 15 15 Users that blocking cookies or Javascript can to comment after transfer in special page. 16 17 We protect Elementor Pro and Contact Form 7 (cf7) forms and default comments of WordPress. 16 18 17 19 The plugin is transparent to your visitors, only bots will be blocked. … … 29 31 30 32 == Changelog == 33 = 1.0 = 34 * Add support to Elementor form and contact form 7 (cf7) 31 35 = 0.7.2 = 32 36 * Add support to old PHP versions
Note: See TracChangeset
for help on using the changeset viewer.