Changeset 2053498
- Timestamp:
- 03/19/2019 03:13:11 PM (7 years ago)
- Location:
- damn-spam/trunk
- Files:
-
- 5 edited
-
README.md (modified) (1 diff)
-
damn-spam.php (modified) (1 diff)
-
inc/class-damn-spam-comments.php (modified) (2 diffs)
-
inc/class-damn-spam.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
damn-spam/trunk/README.md
r2053307 r2053498 7 7 If you run into any issues, please let us know by [opening up a new issue here](https://github.com/codetipi/damn-spam/issues/new). 8 8 9 ## Changelog 10 1.0.0 11 * Intial Release 9 ## WordPress Repository URL 10 <https://wordpress.org/plugins/damn-spam/> -
damn-spam/trunk/damn-spam.php
r2053222 r2053498 6 6 Author URI: https://www.codetipi.com 7 7 Description: Be gone foul spam... 8 Version: 1.0. 08 Version: 1.0.1 9 9 Text Domain: damn-spam 10 10 License: GPLv3 -
damn-spam/trunk/inc/class-damn-spam-comments.php
r2053222 r2053498 20 20 * @since 1.0.0 21 21 */ 22 public function damn_spam_ naughty_comments( $approved = '', $commentdata = '' ) {22 public function damn_spam_pre_comment_approved( $approved = '', $commentdata = '' ) { 23 23 if ( 1 === $approved ) { 24 24 if ( ! empty( $commentdata['comment_content'] ) ) { 25 if ( strpos( $commentdata['comment_content'], 'http' ) !== false || strpos( $commentdata['comment_content'], 'www' ) !== false ) { 26 $naughty = true; 27 } 25 $naughty = $this->damn_spam_comment_check( $commentdata['comment_content'] ); 28 26 } 29 27 } … … 34 32 } 35 33 34 /** 35 * Comment On Post Filter 36 * 37 * @since 1.0.0 38 */ 39 public function damn_spam_comment_post_redirect( $location = '', $comment = '' ) { 40 if ( ! empty( $comment->comment_content ) ) { 41 $naughty = $this->damn_spam_comment_check( $comment->comment_content ); 42 } 43 if ( ! empty( $naughty ) ) { 44 $naughty_comment = array(); 45 $naughty_comment['comment_ID'] = $comment->comment_ID ; 46 $naughty_comment['comment_approved'] = 'spam'; 47 wp_update_comment( $naughty_comment ); 48 } 49 return $location; 50 } 51 52 /** 53 * Comment Checker 54 * 55 * @since 1.0.1 56 */ 57 private function damn_spam_comment_check( $data = '' ) { 58 if ( strpos( $data, 'http' ) !== false || strpos( $data, 'www.' ) !== false ) { 59 return true; 60 } 61 } 36 62 } -
damn-spam/trunk/inc/class-damn-spam.php
r2053222 r2053498 50 50 private function damn_spam_comments() { 51 51 $comments = new Damn_Spam_Comments(); 52 add_filter( 'pre_comment_approved', array( $comments, 'damn_spam_naughty_comments' ), 10, 2 ); 52 add_filter( 'pre_comment_approved', array( $comments, 'damn_spam_pre_comment_approved' ), 10, 2 ); 53 add_filter( 'comment_post_redirect', array( $comments, 'damn_spam_comment_post_redirect' ), 10, 2 ); 53 54 } 54 55 -
damn-spam/trunk/readme.txt
r2053308 r2053498 35 35 36 36 ## Changelog 37 = 1.0.1 = 38 * Added logic to filter out automated bot submissions 37 39 = 1.0.0 = 38 40 * Intial Release
Note: See TracChangeset
for help on using the changeset viewer.