Flamingo - Version 2.2.1

Version Description

  • Outputs a local date/time in a CSV export file.
  • Removes load_plugin_textdomain() calls.
  • Removes a reference to $_wp_last_object_menu.
  • Removes the set-screen-option filter.
  • Inherits post_status from the previous admin page.
  • Avoids using wp_date() for MySQL DATETIME values.
  • Has been tested with WordPress 5.6.
Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Flamingo
Version 2.2.1
Comparing to
See all releases

Code changes from version 2.2 to 2.2.1

admin/admin-functions.php CHANGED
@@ -7,12 +7,12 @@ function flamingo_current_action() {
7
  }
8
 
9
  if ( isset( $_REQUEST['action'] )
10
- and -1 !== $_REQUEST['action'] ) {
11
  return $_REQUEST['action'];
12
  }
13
 
14
  if ( isset( $_REQUEST['action2'] )
15
- and -1 !== $_REQUEST['action2'] ) {
16
  return $_REQUEST['action2'];
17
  }
18
 
7
  }
8
 
9
  if ( isset( $_REQUEST['action'] )
10
+ and -1 != $_REQUEST['action'] ) {
11
  return $_REQUEST['action'];
12
  }
13
 
14
  if ( isset( $_REQUEST['action2'] )
15
+ and -1 != $_REQUEST['action2'] ) {
16
  return $_REQUEST['action2'];
17
  }
18
 
admin/admin.php CHANGED
@@ -6,39 +6,47 @@ require_once FLAMINGO_PLUGIN_DIR . '/admin/includes/privacy.php';
6
  add_action( 'admin_menu', 'flamingo_admin_menu', 8, 0 );
7
 
8
  function flamingo_admin_menu() {
9
- global $_wp_last_object_menu;
10
-
11
- $_wp_last_object_menu++;
12
-
13
  add_menu_page(
14
  __( 'Flamingo Address Book', 'flamingo' ),
15
  __( 'Flamingo', 'flamingo' ),
16
- 'flamingo_edit_contacts', 'flamingo',
17
- 'flamingo_contact_admin_page', 'dashicons-feedback',
18
- $_wp_last_object_menu
 
 
19
  );
20
 
21
- $contact_admin = add_submenu_page( 'flamingo',
 
22
  __( 'Flamingo Address Book', 'flamingo' ),
23
  __( 'Address Book', 'flamingo' ),
24
- 'flamingo_edit_contacts', 'flamingo',
 
25
  'flamingo_contact_admin_page'
26
  );
27
 
28
- add_action( 'load-' . $contact_admin, 'flamingo_load_contact_admin', 10, 0 );
 
 
 
 
29
 
30
- $inbound_admin = add_submenu_page( 'flamingo',
 
31
  __( 'Flamingo Inbound Messages', 'flamingo' ),
32
  __( 'Inbound Messages', 'flamingo' ),
33
- 'flamingo_edit_inbound_messages', 'flamingo_inbound',
 
34
  'flamingo_inbound_admin_page'
35
  );
36
 
37
- add_action( 'load-' . $inbound_admin, 'flamingo_load_inbound_admin', 10, 0 );
 
 
 
 
38
  }
39
 
40
- add_filter( 'set-screen-option', 'flamingo_set_screen_options', 10, 3 );
41
-
42
  add_filter( 'set_screen_option_flamingo_contacts_per_page',
43
  'flamingo_set_screen_options', 10, 3
44
  );
@@ -388,6 +396,15 @@ function flamingo_load_inbound_admin() {
388
 
389
  $redirect_to = menu_page_url( 'flamingo_inbound', false );
390
 
 
 
 
 
 
 
 
 
 
391
  if ( 'save' == $action and ! empty( $_REQUEST['post'] ) ) {
392
  $post = new Flamingo_Inbound_Message( $_REQUEST['post'] );
393
 
@@ -451,7 +468,11 @@ function flamingo_load_inbound_admin() {
451
 
452
  if ( ! empty( $trashed ) ) {
453
  $redirect_to = add_query_arg(
454
- array( 'message' => 'inboundtrashed' ), $redirect_to );
 
 
 
 
455
  }
456
 
457
  wp_safe_redirect( $redirect_to );
@@ -489,7 +510,10 @@ function flamingo_load_inbound_admin() {
489
 
490
  if ( ! empty( $untrashed ) ) {
491
  $redirect_to = add_query_arg(
492
- array( 'message' => 'inbounduntrashed' ), $redirect_to );
 
 
 
493
  }
494
 
495
  wp_safe_redirect( $redirect_to );
@@ -536,7 +560,11 @@ function flamingo_load_inbound_admin() {
536
 
537
  if ( ! empty( $deleted ) ) {
538
  $redirect_to = add_query_arg(
539
- array( 'message' => 'inbounddeleted' ), $redirect_to );
 
 
 
 
540
  }
541
 
542
  wp_safe_redirect( $redirect_to );
@@ -571,7 +599,11 @@ function flamingo_load_inbound_admin() {
571
 
572
  if ( ! empty( $submitted ) ) {
573
  $redirect_to = add_query_arg(
574
- array( 'message' => 'inboundspammed' ), $redirect_to );
 
 
 
 
575
  }
576
 
577
  wp_safe_redirect( $redirect_to );
@@ -607,7 +639,11 @@ function flamingo_load_inbound_admin() {
607
 
608
  if ( ! empty( $submitted ) ) {
609
  $redirect_to = add_query_arg(
610
- array( 'message' => 'inboundunspammed' ), $redirect_to );
 
 
 
 
611
  }
612
 
613
  wp_safe_redirect( $redirect_to );
6
  add_action( 'admin_menu', 'flamingo_admin_menu', 8, 0 );
7
 
8
  function flamingo_admin_menu() {
 
 
 
 
9
  add_menu_page(
10
  __( 'Flamingo Address Book', 'flamingo' ),
11
  __( 'Flamingo', 'flamingo' ),
12
+ 'flamingo_edit_contacts',
13
+ 'flamingo',
14
+ 'flamingo_contact_admin_page',
15
+ 'dashicons-feedback',
16
+ 28
17
  );
18
 
19
+ $contact_admin = add_submenu_page(
20
+ 'flamingo',
21
  __( 'Flamingo Address Book', 'flamingo' ),
22
  __( 'Address Book', 'flamingo' ),
23
+ 'flamingo_edit_contacts',
24
+ 'flamingo',
25
  'flamingo_contact_admin_page'
26
  );
27
 
28
+ add_action(
29
+ 'load-' . $contact_admin,
30
+ 'flamingo_load_contact_admin',
31
+ 10, 0
32
+ );
33
 
34
+ $inbound_admin = add_submenu_page(
35
+ 'flamingo',
36
  __( 'Flamingo Inbound Messages', 'flamingo' ),
37
  __( 'Inbound Messages', 'flamingo' ),
38
+ 'flamingo_edit_inbound_messages',
39
+ 'flamingo_inbound',
40
  'flamingo_inbound_admin_page'
41
  );
42
 
43
+ add_action(
44
+ 'load-' . $inbound_admin,
45
+ 'flamingo_load_inbound_admin',
46
+ 10, 0
47
+ );
48
  }
49
 
 
 
50
  add_filter( 'set_screen_option_flamingo_contacts_per_page',
51
  'flamingo_set_screen_options', 10, 3
52
  );
396
 
397
  $redirect_to = menu_page_url( 'flamingo_inbound', false );
398
 
399
+ if ( isset( $_GET['post_status'] ) ) {
400
+ $redirect_to = add_query_arg(
401
+ array(
402
+ 'post_status' => $_GET['post_status'],
403
+ ),
404
+ $redirect_to
405
+ );
406
+ }
407
+
408
  if ( 'save' == $action and ! empty( $_REQUEST['post'] ) ) {
409
  $post = new Flamingo_Inbound_Message( $_REQUEST['post'] );
410
 
468
 
469
  if ( ! empty( $trashed ) ) {
470
  $redirect_to = add_query_arg(
471
+ array(
472
+ 'message' => 'inboundtrashed',
473
+ ),
474
+ $redirect_to
475
+ );
476
  }
477
 
478
  wp_safe_redirect( $redirect_to );
510
 
511
  if ( ! empty( $untrashed ) ) {
512
  $redirect_to = add_query_arg(
513
+ array(
514
+ 'message' => 'inbounduntrashed',
515
+ ), $redirect_to
516
+ );
517
  }
518
 
519
  wp_safe_redirect( $redirect_to );
560
 
561
  if ( ! empty( $deleted ) ) {
562
  $redirect_to = add_query_arg(
563
+ array(
564
+ 'message' => 'inbounddeleted',
565
+ ),
566
+ $redirect_to
567
+ );
568
  }
569
 
570
  wp_safe_redirect( $redirect_to );
599
 
600
  if ( ! empty( $submitted ) ) {
601
  $redirect_to = add_query_arg(
602
+ array(
603
+ 'message' => 'inboundspammed',
604
+ ),
605
+ $redirect_to
606
+ );
607
  }
608
 
609
  wp_safe_redirect( $redirect_to );
639
 
640
  if ( ! empty( $submitted ) ) {
641
  $redirect_to = add_query_arg(
642
+ array(
643
+ 'message' => 'inboundunspammed',
644
+ ),
645
+ $redirect_to
646
+ );
647
  }
648
 
649
  wp_safe_redirect( $redirect_to );
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.2
9
  */
10
 
11
- define( 'FLAMINGO_VERSION', '2.2' );
12
 
13
  define( 'FLAMINGO_PLUGIN', __FILE__ );
14
 
@@ -48,9 +48,6 @@ if ( is_admin() ) {
48
  /* Init */
49
 
50
  add_action( 'init', function() {
51
- /* L10N */
52
- load_plugin_textdomain( 'flamingo', false, 'flamingo/languages' );
53
-
54
  /* Custom Post Types */
55
  Flamingo_Contact::register_post_type();
56
  Flamingo_Inbound_Message::register_post_type();
5
  Author: Takayuki Miyoshi
6
  Text Domain: flamingo
7
  Domain Path: /languages/
8
+ Version: 2.2.1
9
  */
10
 
11
+ define( 'FLAMINGO_VERSION', '2.2.1' );
12
 
13
  define( 'FLAMINGO_PLUGIN', __FILE__ );
14
 
48
  /* Init */
49
 
50
  add_action( 'init', function() {
 
 
 
51
  /* Custom Post Types */
52
  Flamingo_Contact::register_post_type();
53
  Flamingo_Inbound_Message::register_post_type();
includes/class-contact.php CHANGED
@@ -103,14 +103,14 @@ class Flamingo_Contact {
103
  }
104
 
105
  public static function add( $args = '' ) {
106
- $defaults = array(
107
  'email' => '',
108
  'name' => '',
109
  'props' => array(),
110
- );
 
111
 
112
- $args = apply_filters( 'flamingo_add_contact',
113
- wp_parse_args( $args, $defaults ) );
114
 
115
  if ( empty( $args['email'] ) or ! is_email( $args['email'] ) ) {
116
  return;
@@ -126,10 +126,10 @@ class Flamingo_Contact {
126
  $obj->props = (array) $args['props'];
127
  }
128
 
129
- if ( ! empty( $args['last_contacted'] ) ) {
130
  $obj->last_contacted = $args['last_contacted'];
131
- } else {
132
- $obj->last_contacted = wp_date( 'Y-m-d H:i:s' );
133
  }
134
 
135
  $obj->save();
103
  }
104
 
105
  public static function add( $args = '' ) {
106
+ $args = wp_parse_args( $args, array(
107
  'email' => '',
108
  'name' => '',
109
  'props' => array(),
110
+ 'last_contacted' => '0000-00-00 00:00:00',
111
+ ) );
112
 
113
+ $args = apply_filters( 'flamingo_add_contact', $args );
 
114
 
115
  if ( empty( $args['email'] ) or ! is_email( $args['email'] ) ) {
116
  return;
126
  $obj->props = (array) $args['props'];
127
  }
128
 
129
+ if ( '0000-00-00 00:00:00' !== $args['last_contacted'] ) {
130
  $obj->last_contacted = $args['last_contacted'];
131
+ } elseif ( $datetime = date_create_immutable( 'now', wp_timezone() ) ) {
132
+ $obj->last_contacted = $datetime->format( 'Y-m-d H:i:s' );
133
  }
134
 
135
  $obj->save();
includes/class-inbound-message.php CHANGED
@@ -127,7 +127,7 @@ class Flamingo_Inbound_Message {
127
  }
128
 
129
  public static function add( $args = '' ) {
130
- $defaults = array(
131
  'channel' => '',
132
  'status' => '',
133
  'subject' => '',
@@ -143,11 +143,9 @@ class Flamingo_Inbound_Message {
143
  'consent' => array(),
144
  'timestamp' => null,
145
  'posted_data_hash' => null,
146
- );
147
 
148
- $args = apply_filters( 'flamingo_add_inbound',
149
- wp_parse_args( $args, $defaults )
150
- );
151
 
152
  $obj = new self();
153
 
@@ -275,8 +273,10 @@ class Flamingo_Inbound_Message {
275
  'post_date' => $this->get_post_date(),
276
  );
277
 
278
- if ( $this->timestamp ) {
279
- $postarr['post_date'] = wp_date( 'Y-m-d H:i:s', $this->timestamp );
 
 
280
  }
281
 
282
  $post_id = wp_insert_post( $postarr );
127
  }
128
 
129
  public static function add( $args = '' ) {
130
+ $args = wp_parse_args( $args, array(
131
  'channel' => '',
132
  'status' => '',
133
  'subject' => '',
143
  'consent' => array(),
144
  'timestamp' => null,
145
  'posted_data_hash' => null,
146
+ ) );
147
 
148
+ $args = apply_filters( 'flamingo_add_inbound', $args );
 
 
149
 
150
  $obj = new self();
151
 
273
  'post_date' => $this->get_post_date(),
274
  );
275
 
276
+ if ( $this->timestamp
277
+ and $datetime = date_create( '@' . $this->timestamp ) ) {
278
+ $datetime->setTimezone( wp_timezone() );
279
+ $postarr['post_date'] = $datetime->format( 'Y-m-d H:i:s' );
280
  }
281
 
282
  $post_id = wp_insert_post( $postarr );
readme.txt CHANGED
@@ -1,52 +1,62 @@
1
- === Flamingo ===
2
- Contributors: takayukister, megumithemes, itpixelz
3
- Tags: bird, contact, mail, crm
4
- Requires at least: 5.4
5
- Tested up to: 5.5
6
- Stable tag: 2.2
7
- License: GPLv2 or later
8
- License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- A trustworthy message storage plugin for Contact Form 7.
11
-
12
- == Description ==
13
-
14
- Flamingo is a message storage plugin originally created for [Contact Form 7](https://wordpress.org/plugins/contact-form-7/), which doesn't store submitted messages.
15
-
16
- After activation of the plugin, you'll find *Flamingo* on the WordPress admin screen menu. All messages through contact forms are listed there and are searchable. With Flamingo, you are no longer need to worry about losing important messages due to mail server issues or misconfiguration in mail setup.
17
-
18
- For more detailed information, please refer to the [Contact Form 7 documentation page](https://contactform7.com/save-submitted-messages-with-flamingo/).
19
-
20
- = Privacy Notices =
21
-
22
- This plugin stores submission data collected through contact forms, which may include the submitters' personal information, in the database on the server that hosts the website.
23
-
24
- == Installation ==
25
-
26
- 1. Upload the entire `flamingo` folder to the `/wp-content/plugins/` directory.
27
- 1. Activate the plugin through the 'Plugins' menu in WordPress.
28
-
29
- == Frequently Asked Questions ==
30
-
31
- == Screenshots ==
32
-
33
- == Changelog ==
34
-
35
- = 2.2 =
36
-
37
- * Sets the `post_date` of an inbound message based on the submission timestamp.
38
- * Allows users to search and filter messages within the Spam subgroup.
39
- * Changes the visibility of the `$found_items` property to private and introduces the `count()` method as an alternative.
40
- * Changes the visibility of the `$id` property to private and introduces the `id()` method as an alternative.
41
- * Introduces the submission result in the inbound message viewer screen.
42
- * Stores the `posted_data_hash` value for search.
43
-
44
- = 2.1.1 =
45
-
46
- * 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.
47
- * New filter hook: flamingo_csv_field_prefix
48
-
49
- = 2.1 =
50
-
51
- * UI improvements in displaying JSON reCAPTCHA logs in the Inbound Message editor page.
52
- * 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.4
5
+ Tested up to: 5.6
6
+ Stable tag: 2.2.1
7
+ License: GPLv2 or later
8
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ A trustworthy message storage plugin for Contact Form 7.
11
+
12
+ == Description ==
13
+
14
+ Flamingo is a message storage plugin originally created for [Contact Form 7](https://wordpress.org/plugins/contact-form-7/), which doesn't store submitted messages.
15
+
16
+ After activation of the plugin, you'll find *Flamingo* on the WordPress admin screen menu. All messages through contact forms are listed there and are searchable. With Flamingo, you are no longer need to worry about losing important messages due to mail server issues or misconfiguration in mail setup.
17
+
18
+ For more detailed information, please refer to the [Contact Form 7 documentation page](https://contactform7.com/save-submitted-messages-with-flamingo/).
19
+
20
+ = Privacy Notices =
21
+
22
+ This plugin stores submission data collected through contact forms, which may include the submitters' personal information, in the database on the server that hosts the website.
23
+
24
+ == Installation ==
25
+
26
+ 1. Upload the entire `flamingo` folder to the `/wp-content/plugins/` directory.
27
+ 1. Activate the plugin through the 'Plugins' menu in WordPress.
28
+
29
+ == Frequently Asked Questions ==
30
+
31
+ == Screenshots ==
32
+
33
+ == Changelog ==
34
+
35
+ = 2.2.1 =
36
+
37
+ * Outputs a local date/time in a CSV export file.
38
+ * Removes `load_plugin_textdomain()` calls.
39
+ * Removes a reference to `$_wp_last_object_menu`.
40
+ * Removes the `set-screen-option` filter.
41
+ * Inherits `post_status` from the previous admin page.
42
+ * Avoids using `wp_date()` for MySQL DATETIME values.
43
+ * Has been tested with WordPress 5.6.
44
+
45
+ = 2.2 =
46
+
47
+ * Sets the `post_date` of an inbound message based on the submission timestamp.
48
+ * Allows users to search and filter messages within the Spam subgroup.
49
+ * Changes the visibility of the `$found_items` property to private and introduces the `count()` method as an alternative.
50
+ * Changes the visibility of the `$id` property to private and introduces the `id()` method as an alternative.
51
+ * Introduces the submission result in the inbound message viewer screen.
52
+ * Stores the `posted_data_hash` value for search.
53
+
54
+ = 2.1.1 =
55
+
56
+ * 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.
57
+ * New filter hook: flamingo_csv_field_prefix
58
+
59
+ = 2.1 =
60
+
61
+ * UI improvements in displaying JSON reCAPTCHA logs in the Inbound Message editor page.
62
+ * Moves to trash automatically after every 30 days of the creation of spam messages.