Plugin Directory

Changeset 3125910


Ignore:
Timestamp:
07/26/2024 11:50:59 AM (20 months ago)
Author:
inazo
Message:

upadte trunk

Location:
inazo-flamingo-automatically-delete-old-messages/trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • inazo-flamingo-automatically-delete-old-messages/trunk/inazo-flamingo-automatically-delete-old-messages.php

    r1729723 r3125910  
    33Plugin Name: Inazo's flamingo automatically delete old messages
    44Description: This plugin help you to auto removed all information stored by flamingo.
    5 Version:     1.0
     5Version:     1.1
    66Author:      Inazo
    77Author URI:  https://www.kanjian.fr
     
    2424class inazo_flamingo_auto_trash{
    2525   
    26     const VERSION_IAAM = '1.0';
     26    const VERSION_IAAM = '1.1';
    2727    const PLUGIN_NAME  = 'inazo_flamingo_auto_trash';
    2828   
     
    3636       
    3737       
    38         if (! wp_next_scheduled ( 'inazo_flamingo_auto_trash_cron_task_daily' ))
     38        if (! wp_next_scheduled ( 'inazo_flamingo_auto_trash_cron_task_daily' )){
    3939            wp_schedule_event(time(), 'hourly', 'inazo_flamingo_auto_trash_cron_task_daily');
     40        }
    4041    }
    4142   
     
    5152        add_option( self::PLUGIN_NAME.'_inbound_days', 365 );
    5253        add_option( self::PLUGIN_NAME.'_outbound_days', 365 );
     54        add_option( self::PLUGIN_NAME.'_spam_days', 30 );
    5355               
    5456    }
     
    9092            $this->check_option_exists_and_update( self::PLUGIN_NAME.'_inbound_days', (integer) $_POST['days_inbound'] );
    9193            $this->check_option_exists_and_update( self::PLUGIN_NAME.'_outbound_days', (integer) $_POST['days_outbound'] );
     94            $this->check_option_exists_and_update( self::PLUGIN_NAME.'_spam_days', (integer) $_POST['days_spam'] );
    9295           
    9396            include('view/modif-ok.php');
     
    112115         * Suppression des contacts
    113116         */
    114         $nb_days_contact = get_option('inazo_flamingo_auto_trash_contact_days','365');
     117        $nb_days_contact = get_option(self::PLUGIN_NAME.'_contact_days','365');
    115118       
    116119        $sql = $wpdb->prepare('SELECT ID FROM '.$wpdb->prefix.'posts WHERE post_type="flamingo_contact" AND
     
    130133         * Suppression des inbound
    131134         */
    132         $nb_days_inbound = get_option('inazo_flamingo_auto_trash_inbound_days','365');
     135        $nb_days_inbound = get_option(self::PLUGIN_NAME.'_inbound_days','365');
    133136       
    134137        $sql = $wpdb->prepare('SELECT ID FROM '.$wpdb->prefix.'posts WHERE post_type="flamingo_inbound" AND
     
    148151         * Suppression des outbound
    149152         */
    150         $nb_days_outbound = get_option('inazo_flamingo_auto_trash_outbound_days','365');
     153        $nb_days_outbound = get_option(self::PLUGIN_NAME.'_outbound_days','365');
    151154       
    152155        $sql = $wpdb->prepare('SELECT ID FROM '.$wpdb->prefix.'posts WHERE post_type="flamingo_outbound" AND
    153156        ( TIMESTAMPDIFF(DAY, post_date, NOW()) ) >= %d', $nb_days_outbound);
     157       
     158        $wpdb->query( $sql );
     159       
     160        if( $wpdb->num_rows > 0 ){
     161           
     162            foreach( $wpdb->get_results($sql, ARRAY_A) as $k => $v ){
     163               
     164                wp_delete_post($v['ID'], true);
     165            }
     166        }
     167       
     168        /**
     169         * Deleting spam
     170         */
     171        $nb_days_spam = get_option(self::PLUGIN_NAME.'_spam_days','365');
     172       
     173        $sql = $wpdb->prepare('
     174        SELECT
     175            DISTINCT(ID)
     176        FROM '.$wpdb->prefix.'posts
     177
     178        INNER JOIN '.$wpdb->prefix.'postmeta as pm
     179
     180        WHERE post_type="flamingo_inbound"
     181        AND ( TIMESTAMPDIFF(DAY, post_date, NOW()) ) >= %d
     182        AND ( (pm.meta_key = "_submission_status" AND pm.meta_value ="spam") OR post_status="flamingo-spam" )
     183        LIMIT 0, 10000
     184        ', $nb_days_spam);
    154185       
    155186        $wpdb->query( $sql );
  • inazo-flamingo-automatically-delete-old-messages/trunk/languages/inazo-flamingo-auto-trash-en_EN.po

    r1729704 r3125910  
    11msgid ""
    22msgstr ""
    3 "Content-Type: text/plain; charset=UTF-8\n"
    4 "Content-Transfer-Encoding: 8bit\n"
    53"Project-Id-Version: Inazo Flamingo auto trash\n"
    64"POT-Creation-Date: \n"
     
    86"Last-Translator: \n"
    97"Language-Team: \n"
     8"Language: en\n"
    109"MIME-Version: 1.0\n"
    11 "Language: en\n"
    12 "X-Generator: Poedit 1.7.1\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
     11"Content-Transfer-Encoding: 8bit\n"
     12"X-Generator: Poedit 3.4.4\n"
    1313
    1414#. Text in function
     
    2020#: add.php:19
    2121msgid "Supprimer tous les contacts de plus de "
    22 msgstr "Delete all contacts over"
     22msgstr "Delete all contacts over "
    2323
    2424#. Text in function
     
    3030#: add.php:31
    3131msgid "Supprimer tous les messages sortant de plus de "
    32 msgstr "Delete all outgoing messages over"
     32msgstr "Delete all outgoing messages over "
     33
     34#. Text in function
     35#: add.php:37
     36msgid "Supprimer tous les messages en spam de plus de "
     37msgstr "Delete all spam messages over "
    3338
    3439#. Text in function
  • inazo-flamingo-automatically-delete-old-messages/trunk/languages/inazo-flamingo-auto-trash-en_US.po

    r1729704 r3125910  
    11msgid ""
    22msgstr ""
    3 "Content-Type: text/plain; charset=UTF-8\n"
    4 "Content-Transfer-Encoding: 8bit\n"
    53"Project-Id-Version: Inazo Flamingo auto trash\n"
    64"POT-Creation-Date: \n"
     
    86"Last-Translator: \n"
    97"Language-Team: \n"
     8"Language: en\n"
    109"MIME-Version: 1.0\n"
    11 "Language: en\n"
    12 "X-Generator: Poedit 1.7.1\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
     11"Content-Transfer-Encoding: 8bit\n"
     12"X-Generator: Poedit 3.4.4\n"
    1313
    1414#. Text in function
     
    2020#: add.php:19
    2121msgid "Supprimer tous les contacts de plus de "
    22 msgstr "Delete all contacts over"
     22msgstr "Delete all contacts over "
    2323
    2424#. Text in function
     
    3030#: add.php:31
    3131msgid "Supprimer tous les messages sortant de plus de "
    32 msgstr "Delete all outgoing messages over"
     32msgstr "Delete all outgoing messages over "
    3333
    3434#. Text in function
     
    3737msgstr "days"
    3838
     39#. Text in function
     40#: add.php:37
     41msgid "Supprimer tous les messages en spam de plus de "
     42msgstr "Delete all spam messages over "
     43
    3944#. Text in echo
    4045#: modif-ok.php:9
  • inazo-flamingo-automatically-delete-old-messages/trunk/readme.txt

    r1787499 r3125910  
    44Tags: flamingo, rgpd, gdpr, contact form 7, contact
    55Requires at least: 4.5.1
    6 Tested up to: 4.9.1
    7 Stable tag: 1.0
     6Tested up to: 6.6.1
     7Stable tag: 1.1
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2222- Shelf life of incoming messages
    2323- Shelf life of outgoing messages
     24- Shelf life of spam messages (30 days by default)
    2425- It automatically adds to the worpdress CRON natively
    2526- Complete deletion of data ratachés to the posts of flamingo
     
    3334- Durée de conservation des messages entrants
    3435- Durée de conservation des messages sortants
     36- Durée de conservation des messages en spam (30 jours par défaut)
    3537- Il s'ajoute automatiquement au CRON de worpdress de manière native
    3638- Suppression complète des données ratachés aux posts de flamingo
     
    4143== CHANGELOG ==
    4244
     45= 1.1 =
     46Feature:
     47* Add auto trash config for spam messages, 30 days by default, like other it's configurable
     48* Adding limit to 10 000 for spam deletion, for avoid denial of service
     49
     50Coding:
     51* Adjust some coding style (using variable where needed)
     52
     53Translation:
     54* Add French translation
     55
    4356= 1.0 =
    4457* init version
  • inazo-flamingo-automatically-delete-old-messages/trunk/uninstall.php

    r1729704 r3125910  
    77
    88
    9 if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) exit();
     9if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ){
     10   
     11    exit();
     12}
    1013   
    1114delete_option('inazo_flamingo_auto_trash_version');
     
    1316delete_option('inazo_flamingo_auto_trash_inbound_days');
    1417delete_option('inazo_flamingo_auto_trash_outbound_days');
     18delete_option('inazo_flamingo_auto_trash_spam_days');
    1519
    1620wp_clear_scheduled_hook('inazo_flamingo_auto_trash_cron_task_daily');
  • inazo-flamingo-automatically-delete-old-messages/trunk/view/add.php

    r1729704 r3125910  
    3434            </p>
    3535           
     36            <p>
     37                <label><?php echo __('Supprimer tous les messages en spam de plus de ','inazo-flamingo-auto-trash');?></label>
     38                <input type="text" name="days_spam" value="<?php echo get_option('inazo_flamingo_auto_trash_spam_days','30'); ?>" required />
     39                <?php echo __('jours','inazo-flamingo-auto-trash');?>
     40            </p>
     41           
    3642            <div class="clear"></div>
    3743            <p>
Note: See TracChangeset for help on using the changeset viewer.