Flamingo - Version 1.8

Version Description

  • Remove support for outdated Akismet APIs.
  • Take consent data through an inbound message.
Download this release

Release Info

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

Code changes from version 1.7 to 1.8

admin/admin.php CHANGED
@@ -656,6 +656,9 @@ function flamingo_load_inbound_admin() {
656
  add_meta_box( 'inboundfieldsdiv', __( 'Fields', 'flamingo' ),
657
  'flamingo_inbound_fields_meta_box', null, 'normal', 'core' );
658
 
 
 
 
659
  add_meta_box( 'inboundmetadiv', __( 'Meta', 'flamingo' ),
660
  'flamingo_inbound_meta_meta_box', null, 'normal', 'core' );
661
 
656
  add_meta_box( 'inboundfieldsdiv', __( 'Fields', 'flamingo' ),
657
  'flamingo_inbound_fields_meta_box', null, 'normal', 'core' );
658
 
659
+ add_meta_box( 'inboundconsentdiv', __( 'Consent', 'flamingo' ),
660
+ 'flamingo_inbound_consent_meta_box', null, 'normal', 'core' );
661
+
662
  add_meta_box( 'inboundmetadiv', __( 'Meta', 'flamingo' ),
663
  'flamingo_inbound_meta_meta_box', null, 'normal', 'core' );
664
 
admin/includes/meta-boxes.php CHANGED
@@ -184,6 +184,29 @@ function flamingo_inbound_fields_meta_box( $post ) {
184
  <?php
185
  }
186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  function flamingo_inbound_meta_meta_box( $post ) {
188
  ?>
189
  <table class="widefat message-fields striped">
184
  <?php
185
  }
186
 
187
+ function flamingo_inbound_consent_meta_box( $post ) {
188
+ $consent = $post->consent;
189
+
190
+ if ( empty( $consent ) ) {
191
+ return;
192
+ }
193
+
194
+ ?>
195
+ <table class="widefat message-fields striped">
196
+ <tbody>
197
+
198
+ <?php foreach ( (array) $consent as $key => $value ) : ?>
199
+ <tr>
200
+ <td class="field-title"><?php echo esc_html( $key ); ?></td>
201
+ <td class="field-value"><?php echo wp_kses( $value, wp_kses_allowed_html( 'data' ) ); ?></td>
202
+ </tr>
203
+ <?php endforeach; ?>
204
+
205
+ </tbody>
206
+ </table>
207
+ <?php
208
+ }
209
+
210
  function flamingo_inbound_meta_meta_box( $post ) {
211
  ?>
212
  <table class="widefat message-fields striped">
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: 1.7
9
  */
10
 
11
- define( 'FLAMINGO_VERSION', '1.7' );
12
 
13
  define( 'FLAMINGO_PLUGIN', __FILE__ );
14
 
5
  Author: Takayuki Miyoshi
6
  Text Domain: flamingo
7
  Domain Path: /languages/
8
+ Version: 1.8
9
  */
10
 
11
+ define( 'FLAMINGO_VERSION', '1.8' );
12
 
13
  define( 'FLAMINGO_PLUGIN', __FILE__ );
14
 
includes/akismet.php CHANGED
@@ -9,37 +9,26 @@ function flamingo_akismet_submit_ham( $comment ) {
9
  }
10
 
11
  function flamingo_akismet_submit( $comment, $as = 'spam' ) {
12
- global $akismet_api_host, $akismet_api_port;
13
-
14
- if ( ! flamingo_akismet_is_active() )
15
  return false;
 
16
 
17
- if ( ! in_array( $as, array( 'spam', 'ham' ) ) )
18
  return false;
 
19
 
20
  $query_string = '';
21
 
22
- foreach ( (array) $comment as $key => $data )
23
- $query_string .= $key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&';
24
-
25
- if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+
26
- $response = Akismet::http_post( $query_string, 'submit-' . $as );
27
- } else {
28
- $response = akismet_http_post( $query_string, $akismet_api_host,
29
- '/1.1/submit-' . $as, $akismet_api_port );
30
  }
31
 
 
 
32
  return (bool) $response[1];
33
  }
34
 
35
  function flamingo_akismet_is_active() {
36
- if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+
37
- return (bool) Akismet::get_api_key();
38
- }
39
-
40
- if ( function_exists( 'akismet_get_key' ) ) {
41
- return (bool) akismet_get_key();
42
- }
43
-
44
- return false;
45
  }
9
  }
10
 
11
  function flamingo_akismet_submit( $comment, $as = 'spam' ) {
12
+ if ( ! flamingo_akismet_is_active() ) {
 
 
13
  return false;
14
+ }
15
 
16
+ if ( ! in_array( $as, array( 'spam', 'ham' ) ) ) {
17
  return false;
18
+ }
19
 
20
  $query_string = '';
21
 
22
+ foreach ( (array) $comment as $key => $data ) {
23
+ $query_string .=
24
+ $key . '=' . urlencode( wp_unslash( (string) $data ) ) . '&';
 
 
 
 
 
25
  }
26
 
27
+ $response = Akismet::http_post( $query_string, 'submit-' . $as );
28
+
29
  return (bool) $response[1];
30
  }
31
 
32
  function flamingo_akismet_is_active() {
33
+ return (bool) Akismet::get_api_key();
 
 
 
 
 
 
 
 
34
  }
includes/class-inbound-message.php CHANGED
@@ -19,6 +19,7 @@ class Flamingo_Inbound_Message {
19
  public $meta;
20
  public $akismet;
21
  public $spam;
 
22
 
23
  public static function register_post_type() {
24
  register_post_type( self::post_type, array(
@@ -122,6 +123,7 @@ class Flamingo_Inbound_Message {
122
  'meta' => array(),
123
  'akismet' => array(),
124
  'spam' => false,
 
125
  );
126
 
127
  $args = apply_filters( 'flamingo_add_inbound',
@@ -137,6 +139,7 @@ class Flamingo_Inbound_Message {
137
  $obj->fields = $args['fields'];
138
  $obj->meta = $args['meta'];
139
  $obj->akismet = $args['akismet'];
 
140
 
141
  if ( $args['spam'] ) {
142
  $obj->spam = true;
@@ -174,6 +177,7 @@ class Flamingo_Inbound_Message {
174
 
175
  $this->meta = get_post_meta( $post->ID, '_meta', true );
176
  $this->akismet = get_post_meta( $post->ID, '_akismet', true );
 
177
 
178
  $terms = wp_get_object_terms( $this->id, self::channel_taxonomy );
179
 
@@ -229,6 +233,7 @@ class Flamingo_Inbound_Message {
229
  update_post_meta( $post_id, '_fields', $this->fields );
230
  update_post_meta( $post_id, '_meta', $this->meta );
231
  update_post_meta( $post_id, '_akismet', $this->akismet );
 
232
 
233
  if ( term_exists( $this->channel, self::channel_taxonomy ) ) {
234
  wp_set_object_terms( $this->id, $this->channel,
19
  public $meta;
20
  public $akismet;
21
  public $spam;
22
+ public $consent;
23
 
24
  public static function register_post_type() {
25
  register_post_type( self::post_type, array(
123
  'meta' => array(),
124
  'akismet' => array(),
125
  'spam' => false,
126
+ 'consent' => array(),
127
  );
128
 
129
  $args = apply_filters( 'flamingo_add_inbound',
139
  $obj->fields = $args['fields'];
140
  $obj->meta = $args['meta'];
141
  $obj->akismet = $args['akismet'];
142
+ $obj->consent = $args['consent'];
143
 
144
  if ( $args['spam'] ) {
145
  $obj->spam = true;
177
 
178
  $this->meta = get_post_meta( $post->ID, '_meta', true );
179
  $this->akismet = get_post_meta( $post->ID, '_akismet', true );
180
+ $this->consent = get_post_meta( $post->ID, '_consent', true );
181
 
182
  $terms = wp_get_object_terms( $this->id, self::channel_taxonomy );
183
 
233
  update_post_meta( $post_id, '_fields', $this->fields );
234
  update_post_meta( $post_id, '_meta', $this->meta );
235
  update_post_meta( $post_id, '_akismet', $this->akismet );
236
+ update_post_meta( $post_id, '_consent', $this->consent );
237
 
238
  if ( term_exists( $this->channel, self::channel_taxonomy ) ) {
239
  wp_set_object_terms( $this->id, $this->channel,
license.txt CHANGED
@@ -1,4 +1,4 @@
1
- Flamingo - WordPress Plugin, 2012-2017 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
1
+ Flamingo - WordPress Plugin, 2012-2018 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
3
  Tags: bird, contact, mail, crm
4
- Requires at least: 4.7
5
- Tested up to: 4.8.1
6
- Stable tag: 1.7
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -28,18 +28,13 @@ For more detailed information, please refer to the [Contact Form 7 documentation
28
 
29
  == Changelog ==
30
 
 
 
 
 
 
31
  = 1.7 =
32
 
33
  * New filter: flamingo_add_inbound
34
  * New filter: flamingo_add_contact
35
  * New filter: flamingo_htmlize
36
-
37
- = 1.6 =
38
-
39
- * Tested up to WordPress 4.8.
40
- * Requires WordPress 4.7 or higher.
41
- * Added RTL stylesheet.
42
- * Strengthened capability checking.
43
- * Removed inappropriate content from h1 headings.
44
- * Changed the default format of the export CSV.
45
- * Introduced the flamingo_csv_value_separator and flamingo_csv_quotation filter hooks to enable customizing CSV output.
1
  === Flamingo ===
2
  Contributors: takayukister, megumithemes
3
  Tags: bird, contact, mail, crm
4
+ Requires at least: 4.8
5
+ Tested up to: 4.9.2
6
+ Stable tag: 1.8
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
28
 
29
  == Changelog ==
30
 
31
+ = 1.8 =
32
+
33
+ * Remove support for outdated Akismet APIs.
34
+ * Take consent data through an inbound message.
35
+
36
  = 1.7 =
37
 
38
  * New filter: flamingo_add_inbound
39
  * New filter: flamingo_add_contact
40
  * New filter: flamingo_htmlize