Version Description
- UI improvements in displaying JSON reCAPTCHA logs in the Inbound Message editor page.
- Moves to trash automatically after every 30 days of the creation of spam messages.
Download this release
Release Info
Developer | takayukister |
Plugin | Flamingo |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- admin/includes/meta-boxes.php +1 -1
- flamingo.php +7 -2
- includes/class-inbound-message.php +11 -0
- includes/cron.php +65 -0
- includes/functions.php +34 -0
- readme.txt +8 -9
admin/includes/meta-boxes.php
CHANGED
@@ -276,7 +276,7 @@ function flamingo_inbound_recaptcha_meta_box( $post ) {
|
|
276 |
<?php foreach ( (array) $post->recaptcha as $key => $value ) : ?>
|
277 |
<tr>
|
278 |
<td class="field-title"><?php echo esc_html( $key ); ?></td>
|
279 |
-
<td class="field-value"><?php echo esc_html( json_encode( $value ) ); ?></td>
|
280 |
</tr>
|
281 |
<?php endforeach; ?>
|
282 |
|
276 |
<?php foreach ( (array) $post->recaptcha as $key => $value ) : ?>
|
277 |
<tr>
|
278 |
<td class="field-title"><?php echo esc_html( $key ); ?></td>
|
279 |
+
<td class="field-value"><?php echo esc_html( json_encode( $value, JSON_PRETTY_PRINT ) ); ?></td>
|
280 |
</tr>
|
281 |
<?php endforeach; ?>
|
282 |
|
flamingo.php
CHANGED
@@ -5,10 +5,10 @@ Description: A trustworthy message storage plugin for Contact Form 7.
|
|
5 |
Author: Takayuki Miyoshi
|
6 |
Text Domain: flamingo
|
7 |
Domain Path: /languages/
|
8 |
-
Version: 2.
|
9 |
*/
|
10 |
|
11 |
-
define( 'FLAMINGO_VERSION', '2.
|
12 |
|
13 |
define( 'FLAMINGO_PLUGIN', __FILE__ );
|
14 |
|
@@ -21,6 +21,10 @@ define( 'FLAMINGO_PLUGIN_NAME',
|
|
21 |
define( 'FLAMINGO_PLUGIN_DIR',
|
22 |
untrailingslashit( dirname( FLAMINGO_PLUGIN ) ) );
|
23 |
|
|
|
|
|
|
|
|
|
24 |
// Deprecated, not used in the plugin core. Use flamingo_plugin_url() instead.
|
25 |
define( 'FLAMINGO_PLUGIN_URL',
|
26 |
untrailingslashit( plugins_url( '', FLAMINGO_PLUGIN ) ) );
|
@@ -35,6 +39,7 @@ require_once FLAMINGO_PLUGIN_DIR . '/includes/class-outbound-message.php';
|
|
35 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/user.php';
|
36 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/comment.php';
|
37 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/akismet.php';
|
|
|
38 |
|
39 |
if ( is_admin() ) {
|
40 |
require_once FLAMINGO_PLUGIN_DIR . '/admin/admin.php';
|
5 |
Author: Takayuki Miyoshi
|
6 |
Text Domain: flamingo
|
7 |
Domain Path: /languages/
|
8 |
+
Version: 2.1
|
9 |
*/
|
10 |
|
11 |
+
define( 'FLAMINGO_VERSION', '2.1' );
|
12 |
|
13 |
define( 'FLAMINGO_PLUGIN', __FILE__ );
|
14 |
|
21 |
define( 'FLAMINGO_PLUGIN_DIR',
|
22 |
untrailingslashit( dirname( FLAMINGO_PLUGIN ) ) );
|
23 |
|
24 |
+
if ( ! defined( 'FLAMINGO_MOVE_TRASH_DAYS' ) ) {
|
25 |
+
define( 'FLAMINGO_MOVE_TRASH_DAYS', 30 );
|
26 |
+
}
|
27 |
+
|
28 |
// Deprecated, not used in the plugin core. Use flamingo_plugin_url() instead.
|
29 |
define( 'FLAMINGO_PLUGIN_URL',
|
30 |
untrailingslashit( plugins_url( '', FLAMINGO_PLUGIN ) ) );
|
39 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/user.php';
|
40 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/comment.php';
|
41 |
require_once FLAMINGO_PLUGIN_DIR . '/includes/akismet.php';
|
42 |
+
require_once FLAMINGO_PLUGIN_DIR . '/includes/cron.php';
|
43 |
|
44 |
if ( is_admin() ) {
|
45 |
require_once FLAMINGO_PLUGIN_DIR . '/admin/admin.php';
|
includes/class-inbound-message.php
CHANGED
@@ -229,6 +229,17 @@ class Flamingo_Inbound_Message {
|
|
229 |
|
230 |
if ( $post_id ) {
|
231 |
$this->id = $post_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
update_post_meta( $post_id, '_subject', $this->subject );
|
233 |
update_post_meta( $post_id, '_from', $this->from );
|
234 |
update_post_meta( $post_id, '_from_name', $this->from_name );
|
229 |
|
230 |
if ( $post_id ) {
|
231 |
$this->id = $post_id;
|
232 |
+
|
233 |
+
if ( $post_status == self::spam_status ) {
|
234 |
+
|
235 |
+
// set spam meta time for later use to trash
|
236 |
+
update_post_meta( $post_id, '_spam_meta_time', time() );
|
237 |
+
} else {
|
238 |
+
|
239 |
+
// delete spam meta time to stop trashing in cron job
|
240 |
+
delete_post_meta( $post_id, '_spam_meta_time' );
|
241 |
+
}
|
242 |
+
|
243 |
update_post_meta( $post_id, '_subject', $this->subject );
|
244 |
update_post_meta( $post_id, '_from', $this->from );
|
245 |
update_post_meta( $post_id, '_from_name', $this->from_name );
|
includes/cron.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The file that defines the cron job functionality
|
5 |
+
*
|
6 |
+
* @since 2.1
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
|
11 |
+
// call when WP loads
|
12 |
+
add_action( 'wp', 'flamingo_schedule_activation', 10, 0 );
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Create schedule event for cron job, if its already not exists
|
16 |
+
*
|
17 |
+
* @since 2.1
|
18 |
+
*
|
19 |
+
* @see wp_next_scheduled(), wp_schedule_event()
|
20 |
+
*
|
21 |
+
*/
|
22 |
+
function flamingo_schedule_activation() {
|
23 |
+
if ( ! wp_next_scheduled( 'flamingo_daily_cron_job' ) ) {
|
24 |
+
wp_schedule_event( time(), 'daily', 'flamingo_daily_cron_job' );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
// deactivate cron job on deactivation of the plugin on plugin's deactivation
|
30 |
+
register_deactivation_hook( __FILE__, 'flamingo_schedule_deactivate' );
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Function to deactivate the cron job
|
34 |
+
*
|
35 |
+
* @since 2.1
|
36 |
+
*
|
37 |
+
* @see wp_next_scheduled(), wp_unschedule_event()
|
38 |
+
*
|
39 |
+
*/
|
40 |
+
function flamingo_schedule_deactivate() {
|
41 |
+
|
42 |
+
// when the last event was scheduled
|
43 |
+
$timestamp = wp_next_scheduled( 'flamingo_daily_cron_job' );
|
44 |
+
|
45 |
+
// unschedule previous event if any
|
46 |
+
wp_unschedule_event( $timestamp, 'flamingo_daily_cron_job' );
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
// hook flamingo_schedule_function to schedule event
|
51 |
+
add_action( 'flamingo_daily_cron_job', 'flamingo_schedule_function', 10, 0 );
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Function to run for cron job
|
55 |
+
*
|
56 |
+
* @since 2.1
|
57 |
+
*
|
58 |
+
* @see flamingo_schedule_move_trash()
|
59 |
+
*
|
60 |
+
*/
|
61 |
+
function flamingo_schedule_function() {
|
62 |
+
|
63 |
+
// run function move spam to trash
|
64 |
+
flamingo_schedule_move_trash();
|
65 |
+
}
|
includes/functions.php
CHANGED
@@ -23,3 +23,37 @@ function flamingo_array_flatten( $input ) {
|
|
23 |
|
24 |
return $output;
|
25 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
return $output;
|
25 |
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Move a spam to the Trash
|
29 |
+
*
|
30 |
+
* @since 2.1
|
31 |
+
*
|
32 |
+
* @see wp_trash_post()
|
33 |
+
*
|
34 |
+
*/
|
35 |
+
function flamingo_schedule_move_trash() {
|
36 |
+
|
37 |
+
// abort if FLAMINGO_MOVE_TRASH_DAYS is set to zero or in minus
|
38 |
+
if ( (int) FLAMINGO_MOVE_TRASH_DAYS <= 0 ) {
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
|
42 |
+
$posts_to_move = Flamingo_Inbound_Message::find( array(
|
43 |
+
'posts_per_page' => 100,
|
44 |
+
'meta_key' => '_spam_meta_time',
|
45 |
+
'meta_value' => time() - ( DAY_IN_SECONDS * FLAMINGO_MOVE_TRASH_DAYS ),
|
46 |
+
'meta_compare' => '<',
|
47 |
+
'post_status' => Flamingo_Inbound_Message::spam_status,
|
48 |
+
) );
|
49 |
+
|
50 |
+
foreach ( $posts_to_move as $post ) {
|
51 |
+
|
52 |
+
if ( $post->trash() ) {
|
53 |
+
|
54 |
+
// delete spam meta time to stop trashing in cron job
|
55 |
+
delete_post_meta( $post->id, '_spam_meta_time' );
|
56 |
+
}
|
57 |
+
|
58 |
+
}
|
59 |
+
}
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Flamingo ===
|
2 |
-
Contributors: takayukister, megumithemes
|
3 |
Tags: bird, contact, mail, crm
|
4 |
-
Requires at least: 5.
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -32,13 +32,12 @@ This plugin stores submission data collected through contact forms, which may in
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
= 2.0 =
|
36 |
|
37 |
* Displays spam logs in the Inbound Message editor page.
|
38 |
* Displays reCAPTCHA logs in the Inbound Message editor page.
|
39 |
-
|
40 |
-
= 1.9 =
|
41 |
-
|
42 |
-
* The admin screen UI has been updated.
|
43 |
-
* Enables to search Inbound Messages by keywords used in the Consent and Meta sections.
|
44 |
-
* Introduces personal data eraser for Address Book and Inbound Messages data.
|
1 |
=== Flamingo ===
|
2 |
+
Contributors: takayukister, megumithemes, itpixelz
|
3 |
Tags: bird, contact, mail, crm
|
4 |
+
Requires at least: 5.2
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 2.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 2.1 =
|
36 |
+
|
37 |
+
* UI improvements in displaying JSON reCAPTCHA logs in the Inbound Message editor page.
|
38 |
+
* Moves to trash automatically after every 30 days of the creation of spam messages.
|
39 |
+
|
40 |
= 2.0 =
|
41 |
|
42 |
* Displays spam logs in the Inbound Message editor page.
|
43 |
* Displays reCAPTCHA logs in the Inbound Message editor page.
|
|
|
|
|
|
|
|
|
|
|
|