Plugin Directory

Changeset 842232


Ignore:
Timestamp:
01/21/2014 03:10:10 AM (12 years ago)
Author:
StuartSequeira
Message:

Add blocked spam comment counter
Add uninstall.php to remove option data upon uninstalling

Location:
comment-gatekeeper
Files:
13 added
4 edited

Legend:

Unmodified
Added
Removed
  • comment-gatekeeper/trunk/comment-gatekeeper.php

    r821475 r842232  
    66Author: Stuart Sequeira
    77Author URI: http://lb3computingsolutions.com/about/
    8 Version: 1.0
     8Version: 1.1
    99Text Domain: comment-gatekeeper
    1010*/
     11
     12define('LB3CGK_VERSION', '1.1');
    1113
    1214/*----------
     
    2931}
    3032
    31 define('LB3CGK_VERSION', '1.0');
     33
    3234
    3335
  • comment-gatekeeper/trunk/includes/comment-form.php

    r818398 r842232  
    5050
    5151function lb3cgk_gatekey_gatelock_test( $comment_post_id ){
     52   
     53    // get current spam block count
     54    $lb3cgk_data = get_option( 'lb3cgk_data' );
    5255
     56    if( !isset( $lb3cgk_data['spam-count'] ) ){
     57   
     58        $lb3cgk_data['spam-count'] = 0;
     59   
     60    }
     61   
    5362    $result = TRUE;
     63   
     64   
     65    // check comment form value against correct answer
    5466   
    5567    if( apply_filters( 'lb3cgk_add_gatekeeper_filter' , $result , $comment_post_id ) ){
     
    6476            if( '' == $_POST['gatekey']){
    6577
     78                // increment spam blocked count and update option
     79                $lb3cgk_data['spam-count']++;
     80                update_option( 'lb3cgk_data' , $lb3cgk_data );
     81               
    6682                wp_die( __('<strong>ERROR</strong>: please enter a valid spam-filtering answer.' , 'comment-gatekeeper' ) ); //no gatekey was entered
    6783
     
    7288        }else{
    7389       
    74             //$gatekey = 'nonce_al_pass'; //no key was entered so set a fake key to fail
     90            // increment spam blocked count and update option
     91            $lb3cgk_data['spam-count']++;
     92            update_option( 'lb3cgk_data' , $lb3cgk_data );
     93               
    7594            wp_die( __('<strong>ERROR</strong>: please enter a valid spam-filtering answer.' , 'comment-gatekeeper' ) );//gatekey was not set
    7695           
     
    81100        if( !$result){
    82101       
    83             //$_POST['comment'] = ''; //empty the post comment and let it fail
     102            // increment spam blocked count and update option
     103            $lb3cgk_data['spam-count']++;
     104            update_option( 'lb3cgk_data' , $lb3cgk_data );
     105           
    84106            wp_die( __('<strong>SORRY</strong>: you did not answer to gatekeeper question correctly.' , 'comment-gatekeeper' ) );
    85107       
  • comment-gatekeeper/trunk/includes/settings.php

    r818409 r842232  
    8989
    9090function lb3cgk_settings_section_output(){
     91
     92    // get current spam block count
     93    $lb3cgk_data = get_option( 'lb3cgk_data' );
     94
     95    if( !isset( $lb3cgk_data['spam-count'] ) ){
    9196   
    92     echo __("Please complete these site-wide comment gatekeeper settings" , 'comment-gatekeeper' );
     97        $lb3cgk_data['spam-count'] = 0;
     98   
     99    }
     100   
     101    echo __("Please complete these site-wide comment gatekeeper settings" , 'comment-gatekeeper' )
     102        . '<br />'
     103        . __("Sor far, this plugin has blocked ")
     104        . number_format( $lb3cgk_data['spam-count'] )
     105        . __( " spam comments for you." );
    93106   
    94107} // end lb3cgk_settings_section_output
  • comment-gatekeeper/trunk/readme.txt

    r821475 r842232  
    55Requires at least: 3.0.3
    66Tested up to: 3.8
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4343== Changelog ==
    4444
     45= 1.1 =
     46Add successfully blocked spam comment counter
     47Add uninstall function to remove options on uninstall
     48
    4549= 1.0 =
    4650Add Spanish translation
Note: See TracChangeset for help on using the changeset viewer.