Plugin Directory

Changeset 2053498


Ignore:
Timestamp:
03/19/2019 03:13:11 PM (7 years ago)
Author:
codetipi
Message:

Release: 1.0.1

Location:
damn-spam/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • damn-spam/trunk/README.md

    r2053307 r2053498  
    77If you run into any issues, please let us know by [opening up a new issue here](https://github.com/codetipi/damn-spam/issues/new).
    88
    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  
    66Author URI: https://www.codetipi.com
    77Description: Be gone foul spam...
    8 Version: 1.0.0
     8Version: 1.0.1
    99Text Domain: damn-spam
    1010License: GPLv3
  • damn-spam/trunk/inc/class-damn-spam-comments.php

    r2053222 r2053498  
    2020     * @since 1.0.0
    2121     */
    22     public function damn_spam_naughty_comments( $approved = '', $commentdata = '' ) {
     22    public function damn_spam_pre_comment_approved( $approved = '', $commentdata = '' ) {
    2323        if ( 1 === $approved ) {
    2424            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'] );
    2826            }
    2927        }
     
    3432    }
    3533
     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    }
    3662}
  • damn-spam/trunk/inc/class-damn-spam.php

    r2053222 r2053498  
    5050    private function damn_spam_comments() {
    5151        $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 );
    5354    }
    5455
  • damn-spam/trunk/readme.txt

    r2053308 r2053498  
    3535
    3636## Changelog
     37= 1.0.1 =
     38* Added logic to filter out automated bot submissions
    3739= 1.0.0 =
    3840* Intial Release
Note: See TracChangeset for help on using the changeset viewer.