Version Description
- Sets status to previous when restoring data.
Download this release
Release Info
Developer | takayukister |
Plugin | Flamingo |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.3 to 2.3
- flamingo.php +23 -2
- includes/akismet.php +3 -3
- includes/comment.php +15 -5
- includes/csv.php +13 -3
- includes/functions.php +9 -4
- includes/user.php +10 -3
- license.txt +1 -1
- readme.txt +7 -13
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 |
|
@@ -57,5 +57,26 @@ add_action( 'init', function() {
|
|
57 |
Flamingo_Inbound_Message::register_post_type();
|
58 |
Flamingo_Outbound_Message::register_post_type();
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
do_action( 'flamingo_init' );
|
61 |
}, 10, 0 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
Author: Takayuki Miyoshi
|
6 |
Text Domain: flamingo
|
7 |
Domain Path: /languages/
|
8 |
+
Version: 2.3
|
9 |
*/
|
10 |
|
11 |
+
define( 'FLAMINGO_VERSION', '2.3' );
|
12 |
|
13 |
define( 'FLAMINGO_PLUGIN', __FILE__ );
|
14 |
|
57 |
Flamingo_Inbound_Message::register_post_type();
|
58 |
Flamingo_Outbound_Message::register_post_type();
|
59 |
|
60 |
+
add_filter(
|
61 |
+
'wp_untrash_post_status',
|
62 |
+
'flamingo_untrash_post_status',
|
63 |
+
10, 3
|
64 |
+
);
|
65 |
+
|
66 |
do_action( 'flamingo_init' );
|
67 |
}, 10, 0 );
|
68 |
+
|
69 |
+
|
70 |
+
function flamingo_untrash_post_status( $new_status, $post_id, $prev_status ) {
|
71 |
+
$flamingo_post_types = array(
|
72 |
+
Flamingo_Contact::post_type,
|
73 |
+
Flamingo_Inbound_Message::post_type,
|
74 |
+
Flamingo_Outbound_Message::post_type,
|
75 |
+
);
|
76 |
+
|
77 |
+
if ( in_array( get_post_type( $post_id ), $flamingo_post_types, true ) ) {
|
78 |
+
return $prev_status;
|
79 |
+
}
|
80 |
+
|
81 |
+
return $new_status;
|
82 |
+
}
|
includes/akismet.php
CHANGED
@@ -8,12 +8,12 @@ function flamingo_akismet_submit_ham( $comment ) {
|
|
8 |
return flamingo_akismet_submit( $comment, 'ham' );
|
9 |
}
|
10 |
|
11 |
-
function flamingo_akismet_submit( $comment, $
|
12 |
if ( ! flamingo_akismet_is_active() ) {
|
13 |
return false;
|
14 |
}
|
15 |
|
16 |
-
if ( ! in_array( $
|
17 |
return false;
|
18 |
}
|
19 |
|
@@ -24,7 +24,7 @@ function flamingo_akismet_submit( $comment, $as = 'spam' ) {
|
|
24 |
$key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&';
|
25 |
}
|
26 |
|
27 |
-
$response = Akismet::http_post( $query_string, 'submit-' . $
|
28 |
|
29 |
return (bool) $response[1];
|
30 |
}
|
8 |
return flamingo_akismet_submit( $comment, 'ham' );
|
9 |
}
|
10 |
|
11 |
+
function flamingo_akismet_submit( $comment, $spam_or_ham = 'spam' ) {
|
12 |
if ( ! flamingo_akismet_is_active() ) {
|
13 |
return false;
|
14 |
}
|
15 |
|
16 |
+
if ( ! in_array( $spam_or_ham, array( 'spam', 'ham' ) ) ) {
|
17 |
return false;
|
18 |
}
|
19 |
|
24 |
$key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&';
|
25 |
}
|
26 |
|
27 |
+
$response = Akismet::http_post( $query_string, 'submit-' . $spam_or_ham );
|
28 |
|
29 |
return (bool) $response[1];
|
30 |
}
|
includes/comment.php
CHANGED
@@ -1,14 +1,17 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
4 |
-
|
5 |
|
6 |
add_action( 'wp_insert_comment', 'flamingo_insert_comment', 10, 1 );
|
7 |
|
|
|
|
|
|
|
8 |
function flamingo_insert_comment( $comment_id ) {
|
9 |
$comment = get_comment( $comment_id );
|
10 |
|
11 |
-
if ( 1
|
12 |
return;
|
13 |
}
|
14 |
|
@@ -19,13 +22,17 @@ function flamingo_insert_comment( $comment_id ) {
|
|
19 |
) );
|
20 |
}
|
21 |
|
|
|
22 |
add_action( 'transition_comment_status',
|
23 |
'flamingo_transition_comment_status',
|
24 |
10, 3
|
25 |
);
|
26 |
|
|
|
|
|
|
|
27 |
function flamingo_transition_comment_status( $new_status, $old_status, $comment ) {
|
28 |
-
if ( 'approved'
|
29 |
return;
|
30 |
}
|
31 |
|
@@ -39,12 +46,15 @@ function flamingo_transition_comment_status( $new_status, $old_status, $comment
|
|
39 |
) );
|
40 |
}
|
41 |
|
42 |
-
|
43 |
add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME,
|
44 |
'flamingo_collect_contacts_from_comments',
|
45 |
10, 0
|
46 |
);
|
47 |
|
|
|
|
|
|
|
48 |
function flamingo_collect_contacts_from_comments() {
|
49 |
$comments = get_comments( array(
|
50 |
'status' => 'approve',
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Module for WordPress comments handling
|
4 |
+
*/
|
5 |
|
6 |
add_action( 'wp_insert_comment', 'flamingo_insert_comment', 10, 1 );
|
7 |
|
8 |
+
/**
|
9 |
+
* Creates a Flamingo_Contact record for the given comment.
|
10 |
+
*/
|
11 |
function flamingo_insert_comment( $comment_id ) {
|
12 |
$comment = get_comment( $comment_id );
|
13 |
|
14 |
+
if ( 1 !== (int) $comment->comment_approved ) {
|
15 |
return;
|
16 |
}
|
17 |
|
22 |
) );
|
23 |
}
|
24 |
|
25 |
+
|
26 |
add_action( 'transition_comment_status',
|
27 |
'flamingo_transition_comment_status',
|
28 |
10, 3
|
29 |
);
|
30 |
|
31 |
+
/**
|
32 |
+
* Creates a Flamingo_Contact record when the comment status changes.
|
33 |
+
*/
|
34 |
function flamingo_transition_comment_status( $new_status, $old_status, $comment ) {
|
35 |
+
if ( 'approved' !== $new_status ) {
|
36 |
return;
|
37 |
}
|
38 |
|
46 |
) );
|
47 |
}
|
48 |
|
49 |
+
|
50 |
add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME,
|
51 |
'flamingo_collect_contacts_from_comments',
|
52 |
10, 0
|
53 |
);
|
54 |
|
55 |
+
/**
|
56 |
+
* Creates Flamingo_Contact records for existing comments.
|
57 |
+
*/
|
58 |
function flamingo_collect_contacts_from_comments() {
|
59 |
$comments = get_comments( array(
|
60 |
'status' => 'approve',
|
includes/csv.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
function flamingo_csv_row( $inputs = array() ) {
|
4 |
$row = array();
|
5 |
|
@@ -12,8 +15,12 @@ function flamingo_csv_row( $inputs = array() ) {
|
|
12 |
return implode( $separator, $row );
|
13 |
}
|
14 |
|
|
|
15 |
add_filter( 'flamingo_csv_quotation', 'flamingo_csv_quote', 10, 1 );
|
16 |
|
|
|
|
|
|
|
17 |
function flamingo_csv_quote( $input ) {
|
18 |
$prefix = apply_filters( 'flamingo_csv_field_prefix', '', $input );
|
19 |
$input = trim( sprintf( '%1$s %2$s', $prefix, $input ) );
|
@@ -21,14 +28,17 @@ function flamingo_csv_quote( $input ) {
|
|
21 |
return sprintf( '"%s"', str_replace( '"', '""', $input ) );
|
22 |
}
|
23 |
|
24 |
-
|
25 |
-
* https://contactform7.com/2020/01/15/heads-up-about-spreadsheet-vulnerabilities/
|
26 |
-
*/
|
27 |
add_filter( 'flamingo_csv_field_prefix',
|
28 |
'flamingo_csv_field_prefix_text',
|
29 |
10, 2
|
30 |
);
|
31 |
|
|
|
|
|
|
|
|
|
|
|
32 |
function flamingo_csv_field_prefix_text( $prefix, $input ) {
|
33 |
$formula_triggers = array( '=', '+', '-', '@' );
|
34 |
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Retrieves text that represents a CSV row.
|
5 |
+
*/
|
6 |
function flamingo_csv_row( $inputs = array() ) {
|
7 |
$row = array();
|
8 |
|
15 |
return implode( $separator, $row );
|
16 |
}
|
17 |
|
18 |
+
|
19 |
add_filter( 'flamingo_csv_quotation', 'flamingo_csv_quote', 10, 1 );
|
20 |
|
21 |
+
/**
|
22 |
+
* Retrieves text that represents a CSV cell with quotation.
|
23 |
+
*/
|
24 |
function flamingo_csv_quote( $input ) {
|
25 |
$prefix = apply_filters( 'flamingo_csv_field_prefix', '', $input );
|
26 |
$input = trim( sprintf( '%1$s %2$s', $prefix, $input ) );
|
28 |
return sprintf( '"%s"', str_replace( '"', '""', $input ) );
|
29 |
}
|
30 |
|
31 |
+
|
|
|
|
|
32 |
add_filter( 'flamingo_csv_field_prefix',
|
33 |
'flamingo_csv_field_prefix_text',
|
34 |
10, 2
|
35 |
);
|
36 |
|
37 |
+
/**
|
38 |
+
* Adds a security alert at the head of a cell.
|
39 |
+
*
|
40 |
+
* @see https://contactform7.com/2020/01/15/heads-up-about-spreadsheet-vulnerabilities/
|
41 |
+
*/
|
42 |
function flamingo_csv_field_prefix_text( $prefix, $input ) {
|
43 |
$formula_triggers = array( '=', '+', '-', '@' );
|
44 |
|
includes/functions.php
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
3 |
function flamingo_plugin_url( $path = '' ) {
|
4 |
$url = plugins_url( $path, FLAMINGO_PLUGIN );
|
5 |
|
@@ -10,6 +13,10 @@ function flamingo_plugin_url( $path = '' ) {
|
|
10 |
return $url;
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
13 |
function flamingo_array_flatten( $input ) {
|
14 |
if ( ! is_array( $input ) ) {
|
15 |
return array( $input );
|
@@ -24,13 +31,11 @@ function flamingo_array_flatten( $input ) {
|
|
24 |
return $output;
|
25 |
}
|
26 |
|
|
|
27 |
/**
|
28 |
-
*
|
29 |
*
|
30 |
* @since 2.1
|
31 |
-
*
|
32 |
-
* @see wp_trash_post()
|
33 |
-
*
|
34 |
*/
|
35 |
function flamingo_schedule_move_trash() {
|
36 |
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Retrieves a URL of a file under the Flamingo plugin directory.
|
5 |
+
*/
|
6 |
function flamingo_plugin_url( $path = '' ) {
|
7 |
$url = plugins_url( $path, FLAMINGO_PLUGIN );
|
8 |
|
13 |
return $url;
|
14 |
}
|
15 |
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Converts a multidimensional array to a flat array.
|
19 |
+
*/
|
20 |
function flamingo_array_flatten( $input ) {
|
21 |
if ( ! is_array( $input ) ) {
|
22 |
return array( $input );
|
31 |
return $output;
|
32 |
}
|
33 |
|
34 |
+
|
35 |
/**
|
36 |
+
* Moves a spam to the Trash.
|
37 |
*
|
38 |
* @since 2.1
|
|
|
|
|
|
|
39 |
*/
|
40 |
function flamingo_schedule_move_trash() {
|
41 |
|
includes/user.php
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
add_action( 'profile_update', 'flamingo_user_profile_update', 10, 1 );
|
7 |
add_action( 'user_register', 'flamingo_user_profile_update', 10, 1 );
|
8 |
|
|
|
|
|
|
|
9 |
function flamingo_user_profile_update( $user_id ) {
|
10 |
$user = new WP_User( $user_id );
|
11 |
|
@@ -27,12 +31,15 @@ function flamingo_user_profile_update( $user_id ) {
|
|
27 |
}
|
28 |
}
|
29 |
|
30 |
-
|
31 |
add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME,
|
32 |
'flamingo_collect_contacts_from_users',
|
33 |
10, 0
|
34 |
);
|
35 |
|
|
|
|
|
|
|
36 |
function flamingo_collect_contacts_from_users() {
|
37 |
$users = get_users( array(
|
38 |
'number' => 20,
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Module for WordPress users handling
|
4 |
+
*/
|
5 |
+
|
6 |
|
7 |
add_action( 'profile_update', 'flamingo_user_profile_update', 10, 1 );
|
8 |
add_action( 'user_register', 'flamingo_user_profile_update', 10, 1 );
|
9 |
|
10 |
+
/**
|
11 |
+
* Creates a Flamingo_Contact record for the given user.
|
12 |
+
*/
|
13 |
function flamingo_user_profile_update( $user_id ) {
|
14 |
$user = new WP_User( $user_id );
|
15 |
|
31 |
}
|
32 |
}
|
33 |
|
34 |
+
|
35 |
add_action( 'activate_' . FLAMINGO_PLUGIN_BASENAME,
|
36 |
'flamingo_collect_contacts_from_users',
|
37 |
10, 0
|
38 |
);
|
39 |
|
40 |
+
/**
|
41 |
+
* Creates Flamingo_Contact records for existing users.
|
42 |
+
*/
|
43 |
function flamingo_collect_contacts_from_users() {
|
44 |
$users = get_users( array(
|
45 |
'number' => 20,
|
license.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
Flamingo - WordPress Plugin, 2012-
|
2 |
Flamingo is distributed under the terms of the GNU GPL
|
3 |
|
4 |
This program is free software; you can redistribute it and/or modify
|
1 |
+
Flamingo - WordPress Plugin, 2012-2022 Takayuki Miyoshi
|
2 |
Flamingo is distributed under the terms of the GNU GPL
|
3 |
|
4 |
This program is free software; you can redistribute it and/or modify
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Flamingo ===
|
2 |
Contributors: takayukister, megumithemes, itpixelz
|
3 |
Tags: bird, contact, mail, crm
|
4 |
-
Requires at least: 5.
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -32,6 +32,10 @@ This plugin stores submission data collected through contact forms, which may in
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
35 |
= 2.2.3 =
|
36 |
|
37 |
* Fixed: Cron jobs clean-up on plugin deactivation was failing to work.
|
@@ -58,13 +62,3 @@ This plugin stores submission data collected through contact forms, which may in
|
|
58 |
* Changes the visibility of the `$id` property to private and introduces the `id()` method as an alternative.
|
59 |
* Introduces the submission result in the inbound message viewer screen.
|
60 |
* Stores the `posted_data_hash` value for search.
|
61 |
-
|
62 |
-
= 2.1.1 =
|
63 |
-
|
64 |
-
* Security enhancement, CSV: Prefixes a field when its value begins with `=`, `+`, `-`, or `@`. See https://contactform7.com/2020/01/15/heads-up-about-spreadsheet-vulnerabilities/ for details.
|
65 |
-
* New filter hook: flamingo_csv_field_prefix
|
66 |
-
|
67 |
-
= 2.1 =
|
68 |
-
|
69 |
-
* UI improvements in displaying JSON reCAPTCHA logs in the Inbound Message editor page.
|
70 |
-
* Moves to trash automatically after every 30 days of the creation of spam messages.
|
1 |
=== Flamingo ===
|
2 |
Contributors: takayukister, megumithemes, itpixelz
|
3 |
Tags: bird, contact, mail, crm
|
4 |
+
Requires at least: 5.9
|
5 |
+
Tested up to: 6.0
|
6 |
+
Stable tag: 2.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 2.3 =
|
36 |
+
|
37 |
+
* Sets status to previous when restoring data.
|
38 |
+
|
39 |
= 2.2.3 =
|
40 |
|
41 |
* Fixed: Cron jobs clean-up on plugin deactivation was failing to work.
|
62 |
* Changes the visibility of the `$id` property to private and introduces the `id()` method as an alternative.
|
63 |
* Introduces the submission result in the inbound message viewer screen.
|
64 |
* Stores the `posted_data_hash` value for search.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|