Contact Form 7 - Version 5.5.3

Version Description

https://contactform7.com/contact-form-7-553/

Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Contact Form 7
Version 5.5.3
Comparing to
See all releases

Code changes from version 5.5.2 to 5.5.3

admin/css/styles.css CHANGED
@@ -328,16 +328,19 @@ ul.config-error li {
328
  }
329
 
330
  /*
331
- * Sendinblue Tab
332
  */
 
333
  #sendinblue-panel table tr.inactive ~ tr {
334
  display: none;
335
  }
336
 
 
337
  #sendinblue-panel .dashicons {
338
  text-decoration: none;
339
  }
340
 
 
341
  #sendinblue-panel td p {
342
  margin-top: 12px;
343
  }
328
  }
329
 
330
  /*
331
+ * Tabs for integration modules
332
  */
333
+ #ctct-panel table tr.inactive ~ tr,
334
  #sendinblue-panel table tr.inactive ~ tr {
335
  display: none;
336
  }
337
 
338
+ #ctct-panel .dashicons,
339
  #sendinblue-panel .dashicons {
340
  text-decoration: none;
341
  }
342
 
343
+ #ctct-panel td p,
344
  #sendinblue-panel td p {
345
  margin-top: 12px;
346
  }
admin/js/scripts.js CHANGED
@@ -138,7 +138,7 @@
138
  }
139
  } );
140
 
141
- $( '#wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email' ).on( 'change', function() {
142
  if ( $( this ).is( ':checked' ) ) {
143
  $( this ).closest( 'tr' ).removeClass( 'inactive' );
144
  } else {
138
  }
139
  } );
140
 
141
+ $( '#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email' ).on( 'change', function() {
142
  if ( $( this ).is( ':checked' ) ) {
143
  $( this ).closest( 'tr' ).removeClass( 'inactive' );
144
  } else {
includes/contact-form.php CHANGED
@@ -124,7 +124,11 @@ class WPCF7_ContactForm {
124
  $properties = $contact_form->get_properties();
125
 
126
  foreach ( $properties as $key => $value ) {
127
- $properties[$key] = WPCF7_ContactFormTemplate::get_default( $key );
 
 
 
 
128
  }
129
 
130
  $contact_form->properties = $properties;
@@ -200,18 +204,10 @@ class WPCF7_ContactForm {
200
  $this->title = $post->post_title;
201
  $this->locale = get_post_meta( $post->ID, '_locale', true );
202
 
203
- $properties = $this->get_properties();
204
-
205
- foreach ( $properties as $key => $value ) {
206
- if ( metadata_exists( 'post', $post->ID, '_' . $key ) ) {
207
- $properties[$key] = get_post_meta( $post->ID, '_' . $key, true );
208
- } elseif ( metadata_exists( 'post', $post->ID, $key ) ) {
209
- $properties[$key] = get_post_meta( $post->ID, $key, true );
210
- }
211
- }
212
-
213
- $this->properties = $properties;
214
  $this->upgrade();
 
 
215
  }
216
 
217
  do_action( 'wpcf7_contact_form', $this );
@@ -263,6 +259,85 @@ class WPCF7_ContactForm {
263
  }
264
 
265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266
  /**
267
  * Returns the value for the given property name.
268
  *
@@ -281,22 +356,7 @@ class WPCF7_ContactForm {
281
  * @return array This contact form's properties.
282
  */
283
  public function get_properties() {
284
- $properties = (array) $this->properties;
285
-
286
- $properties = wp_parse_args( $properties, array(
287
- 'form' => '',
288
- 'mail' => array(),
289
- 'mail_2' => array(),
290
- 'messages' => array(),
291
- 'additional_settings' => '',
292
- ) );
293
-
294
- $properties = (array) apply_filters(
295
- 'wpcf7_contact_form_properties',
296
- $properties, $this
297
- );
298
-
299
- return $properties;
300
  }
301
 
302
 
124
  $properties = $contact_form->get_properties();
125
 
126
  foreach ( $properties as $key => $value ) {
127
+ $default_template = WPCF7_ContactFormTemplate::get_default( $key );
128
+
129
+ if ( isset( $default_template ) ) {
130
+ $properties[$key] = $default_template;
131
+ }
132
  }
133
 
134
  $contact_form->properties = $properties;
204
  $this->title = $post->post_title;
205
  $this->locale = get_post_meta( $post->ID, '_locale', true );
206
 
207
+ $this->construct_properties( $post );
 
 
 
 
 
 
 
 
 
 
208
  $this->upgrade();
209
+ } else {
210
+ $this->construct_properties();
211
  }
212
 
213
  do_action( 'wpcf7_contact_form', $this );
259
  }
260
 
261
 
262
+ /**
263
+ * Constructs contact form properties. This is called only once
264
+ * from the constructor.
265
+ */
266
+ private function construct_properties( $post = null ) {
267
+ $builtin_properties = array(
268
+ 'form' => '',
269
+ 'mail' => array(),
270
+ 'mail_2' => array(),
271
+ 'messages' => array(),
272
+ 'additional_settings' => '',
273
+ );
274
+
275
+ $properties = apply_filters(
276
+ 'wpcf7_pre_construct_contact_form_properties',
277
+ $builtin_properties, $this
278
+ );
279
+
280
+ // Filtering out properties with invalid name
281
+ $properties = array_filter(
282
+ $properties,
283
+ function ( $key ) {
284
+ $sanitized_key = sanitize_key( $key );
285
+ return $key === $sanitized_key;
286
+ },
287
+ ARRAY_FILTER_USE_KEY
288
+ );
289
+
290
+ foreach ( $properties as $name => $val ) {
291
+ $prop = $this->retrieve_property( $name );
292
+
293
+ if ( isset( $prop ) ) {
294
+ $properties[$name] = $prop;
295
+ }
296
+ }
297
+
298
+ $this->properties = $properties;
299
+
300
+ foreach ( $properties as $name => $val ) {
301
+ $properties[$name] = apply_filters(
302
+ "wpcf7_contact_form_property_{$name}",
303
+ $val, $this
304
+ );
305
+ }
306
+
307
+ $this->properties = $properties;
308
+
309
+ $properties = (array) apply_filters(
310
+ 'wpcf7_contact_form_properties',
311
+ $properties, $this
312
+ );
313
+
314
+ $this->properties = $properties;
315
+ }
316
+
317
+
318
+ /**
319
+ * Retrieves contact form property of the specified name from the database.
320
+ *
321
+ * @param string $name Property name.
322
+ * @return array|string|null Property value. Null if property doesn't exist.
323
+ */
324
+ private function retrieve_property( $name ) {
325
+ $property = null;
326
+
327
+ if ( ! $this->initial() ) {
328
+ $post_id = $this->id;
329
+
330
+ if ( metadata_exists( 'post', $post_id, '_' . $name ) ) {
331
+ $property = get_post_meta( $post_id, '_' . $name, true );
332
+ } elseif ( metadata_exists( 'post', $post_id, $name ) ) {
333
+ $property = get_post_meta( $post_id, $name, true );
334
+ }
335
+ }
336
+
337
+ return $property;
338
+ }
339
+
340
+
341
  /**
342
  * Returns the value for the given property name.
343
  *
356
  * @return array This contact form's properties.
357
  */
358
  public function get_properties() {
359
+ return (array) $this->properties;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
361
 
362
 
includes/functions.php CHANGED
@@ -29,6 +29,30 @@ function wpcf7_plugin_url( $path = '' ) {
29
  }
30
 
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  /**
33
  * Retrieves uploads directory information.
34
  *
29
  }
30
 
31
 
32
+ /**
33
+ * Include a file under WPCF7_PLUGIN_MODULES_DIR.
34
+ *
35
+ * @param string $path File path relative to the module dir.
36
+ * @return bool True on success, false on failure.
37
+ */
38
+ function wpcf7_include_module_file( $path ) {
39
+ $dir = WPCF7_PLUGIN_MODULES_DIR;
40
+
41
+ if ( empty( $dir ) or ! is_dir( $dir ) ) {
42
+ return false;
43
+ }
44
+
45
+ $path = path_join( $dir, ltrim( $path, '/' ) );
46
+
47
+ if ( file_exists( $path ) ) {
48
+ include_once $path;
49
+ return true;
50
+ }
51
+
52
+ return false;
53
+ }
54
+
55
+
56
  /**
57
  * Retrieves uploads directory information.
58
  *
load.php CHANGED
@@ -68,25 +68,9 @@ class WPCF7 {
68
  * @return bool True on success, false on failure.
69
  */
70
  protected static function load_module( $mod ) {
71
- $dir = WPCF7_PLUGIN_MODULES_DIR;
72
-
73
- if ( empty( $dir ) or ! is_dir( $dir ) ) {
74
- return false;
75
- }
76
-
77
- $files = array(
78
- path_join( $dir, $mod . '/' . $mod . '.php' ),
79
- path_join( $dir, $mod . '.php' ),
80
- );
81
-
82
- foreach ( $files as $file ) {
83
- if ( file_exists( $file ) ) {
84
- include_once $file;
85
- return true;
86
- }
87
- }
88
-
89
- return false;
90
  }
91
 
92
 
68
  * @return bool True on success, false on failure.
69
  */
70
  protected static function load_module( $mod ) {
71
+ return false
72
+ || wpcf7_include_module_file( $mod . '/' . $mod . '.php' )
73
+ || wpcf7_include_module_file( $mod . '.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  }
75
 
76
 
modules/constant-contact.php DELETED
@@ -1,957 +0,0 @@
1
- <?php
2
-
3
- add_action(
4
- 'wpcf7_init',
5
- 'wpcf7_constant_contact_register_service',
6
- 5, 0
7
- );
8
-
9
- function wpcf7_constant_contact_register_service() {
10
- $integration = WPCF7_Integration::get_instance();
11
-
12
- $integration->add_category( 'email_marketing',
13
- __( 'Email marketing', 'contact-form-7' ) );
14
-
15
- $service = WPCF7_ConstantContact::get_instance();
16
- $integration->add_service( 'constant_contact', $service );
17
- }
18
-
19
-
20
- add_action(
21
- 'wpcf7_save_contact_form',
22
- 'wpcf7_constant_contact_save_contact_form',
23
- 10, 1
24
- );
25
-
26
- function wpcf7_constant_contact_save_contact_form( $contact_form ) {
27
- $service = WPCF7_ConstantContact::get_instance();
28
-
29
- if ( ! $service->is_active() ) {
30
- return;
31
- }
32
-
33
- $additional_settings = $contact_form->additional_setting(
34
- 'constant_contact',
35
- false
36
- );
37
-
38
- $list_names = array();
39
-
40
- $pattern = '/[\t ]*('
41
- . "'[^']*'"
42
- . '|'
43
- . '"[^"]*"'
44
- . '|'
45
- . '[^,]*?'
46
- . ')[\t ]*(?:[,]+|$)/';
47
-
48
- foreach ( $additional_settings as $setting ) {
49
- if ( preg_match_all( $pattern, $setting, $matches ) ) {
50
- foreach ( $matches[1] as $match ) {
51
- $name = trim( wpcf7_strip_quote( $match ) );
52
-
53
- if ( '' !== $name ) {
54
- $list_names[] = $name;
55
- }
56
- }
57
- }
58
- }
59
-
60
- $list_names = array_unique( $list_names );
61
-
62
- $key = sprintf( 'wpcf7_contact_form:%d', $contact_form->id() );
63
-
64
- $service->update_contact_lists( array( $key => $list_names ) );
65
- }
66
-
67
-
68
- add_action( 'wpcf7_submit', 'wpcf7_constant_contact_submit', 10, 2 );
69
-
70
- function wpcf7_constant_contact_submit( $contact_form, $result ) {
71
- $service = WPCF7_ConstantContact::get_instance();
72
-
73
- if ( ! $service->is_active() ) {
74
- return;
75
- }
76
-
77
- if ( $contact_form->in_demo_mode() ) {
78
- return;
79
- }
80
-
81
- $do_submit = true;
82
-
83
- if ( empty( $result['status'] )
84
- or ! in_array( $result['status'], array( 'mail_sent' ) ) ) {
85
- $do_submit = false;
86
- }
87
-
88
- $additional_settings = $contact_form->additional_setting(
89
- 'constant_contact',
90
- false
91
- );
92
-
93
- foreach ( $additional_settings as $setting ) {
94
- if ( in_array( $setting, array( 'off', 'false', '0' ), true ) ) {
95
- $do_submit = false;
96
- break;
97
- }
98
- }
99
-
100
- $do_submit = apply_filters( 'wpcf7_constant_contact_submit',
101
- $do_submit, $contact_form, $result );
102
-
103
- if ( ! $do_submit ) {
104
- return;
105
- }
106
-
107
- $submission = WPCF7_Submission::get_instance();
108
-
109
- $consented = true;
110
-
111
- foreach ( $contact_form->scan_form_tags( 'feature=name-attr' ) as $tag ) {
112
- if ( $tag->has_option( 'consent_for:constant_contact' )
113
- and null == $submission->get_posted_data( $tag->name ) ) {
114
- $consented = false;
115
- break;
116
- }
117
- }
118
-
119
- if ( ! $consented ) {
120
- return;
121
- }
122
-
123
- $request_builder_class_name = apply_filters(
124
- 'wpcf7_constant_contact_contact_post_request_builder',
125
- 'WPCF7_ConstantContact_ContactPostRequest'
126
- );
127
-
128
- if ( ! class_exists( $request_builder_class_name ) ) {
129
- return;
130
- }
131
-
132
- $request_builder = new $request_builder_class_name;
133
- $request_builder->build( $submission );
134
-
135
- if ( ! $request_builder->is_valid() ) {
136
- return;
137
- }
138
-
139
- if ( $email = $request_builder->get_email_address()
140
- and $service->email_exists( $email ) ) {
141
- return;
142
- }
143
-
144
- $service->create_contact( $request_builder->to_array() );
145
- }
146
-
147
-
148
- if ( ! class_exists( 'WPCF7_Service_OAuth2' ) ) {
149
- return;
150
- }
151
-
152
- class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
153
-
154
- const service_name = 'constant_contact';
155
- const authorization_endpoint = 'https://api.cc.email/v3/idfed';
156
- const token_endpoint = 'https://idfed.constantcontact.com/as/token.oauth2';
157
-
158
- private static $instance;
159
- protected $contact_lists = array();
160
-
161
- public static function get_instance() {
162
- if ( empty( self::$instance ) ) {
163
- self::$instance = new self;
164
- }
165
-
166
- return self::$instance;
167
- }
168
-
169
- private function __construct() {
170
- $this->authorization_endpoint = self::authorization_endpoint;
171
- $this->token_endpoint = self::token_endpoint;
172
-
173
- $option = (array) WPCF7::get_option( self::service_name );
174
-
175
- if ( isset( $option['client_id'] ) ) {
176
- $this->client_id = $option['client_id'];
177
- }
178
-
179
- if ( isset( $option['client_secret'] ) ) {
180
- $this->client_secret = $option['client_secret'];
181
- }
182
-
183
- if ( isset( $option['access_token'] ) ) {
184
- $this->access_token = $option['access_token'];
185
- }
186
-
187
- if ( isset( $option['refresh_token'] ) ) {
188
- $this->refresh_token = $option['refresh_token'];
189
- }
190
-
191
- if ( $this->is_active() ) {
192
- if ( isset( $option['contact_lists'] ) ) {
193
- $this->contact_lists = $option['contact_lists'];
194
- }
195
- }
196
-
197
- add_action( 'wpcf7_admin_init', array( $this, 'auth_redirect' ) );
198
- }
199
-
200
- public function auth_redirect() {
201
- $auth = isset( $_GET['auth'] ) ? trim( $_GET['auth'] ) : '';
202
- $code = isset( $_GET['code'] ) ? trim( $_GET['code'] ) : '';
203
-
204
- if ( self::service_name === $auth and $code
205
- and current_user_can( 'wpcf7_manage_integration' ) ) {
206
- $redirect_to = add_query_arg(
207
- array(
208
- 'service' => self::service_name,
209
- 'action' => 'auth_redirect',
210
- 'code' => $code,
211
- ),
212
- menu_page_url( 'wpcf7-integration', false )
213
- );
214
-
215
- wp_safe_redirect( $redirect_to );
216
- exit();
217
- }
218
- }
219
-
220
- protected function save_data() {
221
- $option = array_merge(
222
- (array) WPCF7::get_option( self::service_name ),
223
- array(
224
- 'client_id' => $this->client_id,
225
- 'client_secret' => $this->client_secret,
226
- 'access_token' => $this->access_token,
227
- 'refresh_token' => $this->refresh_token,
228
- 'contact_lists' => $this->contact_lists,
229
- )
230
- );
231
-
232
- WPCF7::update_option( self::service_name, $option );
233
- }
234
-
235
- protected function reset_data() {
236
- $this->client_id = '';
237
- $this->client_secret = '';
238
- $this->access_token = '';
239
- $this->refresh_token = '';
240
- $this->contact_lists = array();
241
-
242
- $this->save_data();
243
- }
244
-
245
- public function get_title() {
246
- return __( 'Constant Contact', 'contact-form-7' );
247
- }
248
-
249
- public function get_categories() {
250
- return array( 'email_marketing' );
251
- }
252
-
253
- public function icon() {
254
- }
255
-
256
- public function link() {
257
- echo sprintf( '<a href="%1$s">%2$s</a>',
258
- 'https://constant-contact.evyy.net/c/1293104/205991/3411',
259
- 'constantcontact.com'
260
- );
261
- }
262
-
263
- protected function get_redirect_uri() {
264
- return admin_url( '/?auth=' . self::service_name );
265
- }
266
-
267
- protected function menu_page_url( $args = '' ) {
268
- $args = wp_parse_args( $args, array() );
269
-
270
- $url = menu_page_url( 'wpcf7-integration', false );
271
- $url = add_query_arg( array( 'service' => self::service_name ), $url );
272
-
273
- if ( ! empty( $args) ) {
274
- $url = add_query_arg( $args, $url );
275
- }
276
-
277
- return $url;
278
- }
279
-
280
- public function load( $action = '' ) {
281
- parent::load( $action );
282
-
283
- if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) {
284
- check_admin_referer( 'wpcf7-constant-contact-setup' );
285
-
286
- if ( ! empty( $_POST['reset'] ) ) {
287
- $this->reset_data();
288
- } else {
289
- $this->client_id = isset( $_POST['client_id'] )
290
- ? trim( $_POST['client_id'] ) : '';
291
-
292
- $this->client_secret = isset( $_POST['client_secret'] )
293
- ? trim( $_POST['client_secret'] ) : '';
294
-
295
- $this->save_data();
296
- $this->authorize( 'contact_data' );
297
- }
298
-
299
- wp_safe_redirect( $this->menu_page_url( 'action=setup' ) );
300
- exit();
301
- }
302
-
303
- if ( 'edit' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) {
304
- check_admin_referer( 'wpcf7-constant-contact-edit' );
305
-
306
- $list_ids = isset( $_POST['contact_lists'] )
307
- ? (array) $_POST['contact_lists']
308
- : array();
309
-
310
- $this->update_contact_lists( array( 'default' => $list_ids ) );
311
-
312
- wp_safe_redirect( $this->menu_page_url(
313
- array(
314
- 'action' => 'setup',
315
- 'message' => 'updated',
316
- )
317
- ) );
318
-
319
- exit();
320
- }
321
-
322
- if ( $this->is_active() ) {
323
- $this->update_contact_lists();
324
- }
325
- }
326
-
327
- public function email_exists( $email ) {
328
- $endpoint = add_query_arg(
329
- array(
330
- 'email' => $email,
331
- 'status' => 'all',
332
- ),
333
- 'https://api.cc.email/v3/contacts'
334
- );
335
-
336
- $request = array(
337
- 'method' => 'GET',
338
- 'headers' => array(
339
- 'Accept' => 'application/json',
340
- 'Content-Type' => 'application/json; charset=utf-8',
341
- ),
342
- );
343
-
344
- $response = $this->remote_request( $endpoint, $request );
345
-
346
- if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
347
- if ( WP_DEBUG ) {
348
- $this->log( $endpoint, $request, $response );
349
- }
350
-
351
- return false;
352
- }
353
-
354
- $response_body = wp_remote_retrieve_body( $response );
355
-
356
- if ( empty( $response_body ) ) {
357
- return false;
358
- }
359
-
360
- $response_body = json_decode( $response_body, true );
361
-
362
- return ! empty( $response_body['contacts'] );
363
- }
364
-
365
- public function create_contact( $properties ) {
366
- $endpoint = 'https://api.cc.email/v3/contacts';
367
-
368
- $request = array(
369
- 'method' => 'POST',
370
- 'headers' => array(
371
- 'Accept' => 'application/json',
372
- 'Content-Type' => 'application/json; charset=utf-8',
373
- ),
374
- 'body' => json_encode( $properties ),
375
- );
376
-
377
- $response = $this->remote_request( $endpoint, $request );
378
-
379
- if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
380
- if ( WP_DEBUG ) {
381
- $this->log( $endpoint, $request, $response );
382
- }
383
-
384
- return false;
385
- }
386
- }
387
-
388
- public function get_contact_lists() {
389
- $endpoint = 'https://api.cc.email/v3/contact_lists';
390
-
391
- $request = array(
392
- 'method' => 'GET',
393
- 'headers' => array(
394
- 'Accept' => 'application/json',
395
- 'Content-Type' => 'application/json; charset=utf-8',
396
- ),
397
- );
398
-
399
- $response = $this->remote_request( $endpoint, $request );
400
-
401
- if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
402
- if ( WP_DEBUG ) {
403
- $this->log( $endpoint, $request, $response );
404
- }
405
-
406
- return false;
407
- }
408
-
409
- $response_body = wp_remote_retrieve_body( $response );
410
-
411
- if ( empty( $response_body ) ) {
412
- return false;
413
- }
414
-
415
- $response_body = json_decode( $response_body, true );
416
-
417
- if ( ! empty( $response_body['lists'] ) ) {
418
- return (array) $response_body['lists'];
419
- } else {
420
- return array();
421
- }
422
- }
423
-
424
- public function update_contact_lists( $selection = array() ) {
425
- $contact_lists = array();
426
- $contact_lists_on_api = $this->get_contact_lists();
427
-
428
- if ( false !== $contact_lists_on_api ) {
429
- foreach ( (array) $contact_lists_on_api as $list ) {
430
- if ( isset( $list['list_id'] ) ) {
431
- $list_id = trim( $list['list_id'] );
432
- } else {
433
- continue;
434
- }
435
-
436
- if ( isset( $this->contact_lists[$list_id]['selected'] ) ) {
437
- $list['selected'] = $this->contact_lists[$list_id]['selected'];
438
- } else {
439
- $list['selected'] = array();
440
- }
441
-
442
- $contact_lists[$list_id] = $list;
443
- }
444
- } else {
445
- $contact_lists = $this->contact_lists;
446
- }
447
-
448
- foreach ( (array) $selection as $key => $ids_or_names ) {
449
- foreach( $contact_lists as $list_id => $list ) {
450
- if ( in_array( $list['list_id'], (array) $ids_or_names, true )
451
- or in_array( $list['name'], (array) $ids_or_names, true ) ) {
452
- $contact_lists[$list_id]['selected'][$key] = true;
453
- } else {
454
- unset( $contact_lists[$list_id]['selected'][$key] );
455
- }
456
- }
457
- }
458
-
459
- $this->contact_lists = $contact_lists;
460
-
461
- if ( $selection ) {
462
- $this->save_data();
463
- }
464
-
465
- return $this->contact_lists;
466
- }
467
-
468
- public function admin_notice( $message = '' ) {
469
- switch ( $message ) {
470
- case 'success':
471
- echo sprintf(
472
- '<div class="notice notice-success"><p>%s</p></div>',
473
- esc_html( __( "Connection established.", 'contact-form-7' ) )
474
- );
475
- break;
476
- case 'failed':
477
- echo sprintf(
478
- '<div class="notice notice-error"><p><strong>%1$s</strong>: %2$s</p></div>',
479
- esc_html( __( "Error", 'contact-form-7' ) ),
480
- esc_html( __( "Failed to establish connection. Please double-check your configuration.", 'contact-form-7' ) )
481
- );
482
- break;
483
- case 'updated':
484
- echo sprintf(
485
- '<div class="notice notice-success"><p>%s</p></div>',
486
- esc_html( __( "Configuration updated.", 'contact-form-7' ) )
487
- );
488
- break;
489
- }
490
- }
491
-
492
- public function display( $action = '' ) {
493
- echo '<p>' . sprintf(
494
- esc_html( __( 'The Constant Contact integration module allows you to send contact data collected through your contact forms to the Constant Contact API. You can create reliable email subscription services in a few easy steps. For details, see %s.', 'contact-form-7' ) ),
495
- wpcf7_link(
496
- __(
497
- 'https://contactform7.com/constant-contact-integration/',
498
- 'contact-form-7'
499
- ),
500
- __( 'Constant Contact integration', 'contact-form-7' )
501
- )
502
- ) . '</p>';
503
-
504
- if ( $this->is_active() ) {
505
- echo sprintf(
506
- '<p class="dashicons-before dashicons-yes">%s</p>',
507
- esc_html( __( "This site is connected to the Constant Contact API.", 'contact-form-7' ) )
508
- );
509
- }
510
-
511
- if ( 'setup' == $action ) {
512
- $this->display_setup();
513
- } else {
514
- echo sprintf(
515
- '<p><a href="%1$s" class="button">%2$s</a></p>',
516
- esc_url( $this->menu_page_url( 'action=setup' ) ),
517
- esc_html( __( 'Setup Integration', 'contact-form-7' ) )
518
- );
519
- }
520
- }
521
-
522
- private function display_setup() {
523
- ?>
524
- <form method="post" action="<?php echo esc_url( $this->menu_page_url( 'action=setup' ) ); ?>">
525
- <?php wp_nonce_field( 'wpcf7-constant-contact-setup' ); ?>
526
- <table class="form-table">
527
- <tbody>
528
- <tr>
529
- <th scope="row"><label for="client_id"><?php echo esc_html( __( 'API Key', 'contact-form-7' ) ); ?></label></th>
530
- <td><?php
531
- if ( $this->is_active() ) {
532
- echo esc_html( $this->client_id );
533
- echo sprintf(
534
- '<input type="hidden" value="%1$s" id="client_id" name="client_id" />',
535
- esc_attr( $this->client_id )
536
- );
537
- } else {
538
- echo sprintf(
539
- '<input type="text" aria-required="true" value="%1$s" id="client_id" name="client_id" class="regular-text code" />',
540
- esc_attr( $this->client_id )
541
- );
542
- }
543
- ?></td>
544
- </tr>
545
- <tr>
546
- <th scope="row"><label for="client_secret"><?php echo esc_html( __( 'App Secret', 'contact-form-7' ) ); ?></label></th>
547
- <td><?php
548
- if ( $this->is_active() ) {
549
- echo esc_html( wpcf7_mask_password( $this->client_secret, 4, 4 ) );
550
- echo sprintf(
551
- '<input type="hidden" value="%1$s" id="client_secret" name="client_secret" />',
552
- esc_attr( $this->client_secret )
553
- );
554
- } else {
555
- echo sprintf(
556
- '<input type="text" aria-required="true" value="%1$s" id="client_secret" name="client_secret" class="regular-text code" />',
557
- esc_attr( $this->client_secret )
558
- );
559
- }
560
- ?></td>
561
- </tr>
562
- <tr>
563
- <th scope="row"><label for="redirect_uri"><?php echo esc_html( __( 'Redirect URI', 'contact-form-7' ) ); ?></label></th>
564
- <td><?php
565
- echo sprintf(
566
- '<input type="text" value="%1$s" id="redirect_uri" name="redirect_uri" class="large-text code" readonly="readonly" onfocus="this.select();" style="font-size: 11px;" />',
567
- $this->get_redirect_uri()
568
- );
569
- ?>
570
- <p class="description"><?php echo esc_html( __( "Set this URL as the redirect URI.", 'contact-form-7' ) ); ?></p>
571
- </td>
572
- </tr>
573
- </tbody>
574
- </table>
575
- <?php
576
- if ( $this->is_active() ) {
577
- submit_button(
578
- _x( 'Reset Keys', 'API keys', 'contact-form-7' ),
579
- 'small', 'reset'
580
- );
581
- } else {
582
- submit_button(
583
- __( 'Connect to the Constant Contact API', 'contact-form-7' )
584
- );
585
- }
586
- ?>
587
- </form>
588
-
589
- <?php
590
- if ( $this->is_active() and ! empty( $this->contact_lists ) ) {
591
- ?>
592
- <form method="post" action="<?php echo esc_url( $this->menu_page_url( 'action=edit' ) ); ?>">
593
- <?php wp_nonce_field( 'wpcf7-constant-contact-edit' ); ?>
594
- <table class="form-table">
595
- <tbody>
596
- <tr>
597
- <th scope="row"><?php echo esc_html( _x( 'Contact Lists', 'Constant Contact', 'contact-form-7' ) ); ?></th>
598
- <td>
599
- <fieldset>
600
- <legend class="screen-reader-text"><span><?php echo esc_html( _x( "Contact Lists: Select lists to which newly added contacts are to belong.", 'Constant Contact', 'contact-form-7' ) ); ?></span></legend>
601
- <p class="description"><?php echo esc_html( __( "Select lists to which newly added contacts are to belong.", 'contact-form-7' ) ); ?></p>
602
- <ul class="checkboxes"><?php
603
- foreach ( $this->contact_lists as $list ) {
604
- echo sprintf(
605
- '<li><input %1$s /> <label for="%2$s">%3$s</label></li>',
606
- wpcf7_format_atts( array(
607
- 'type' => 'checkbox',
608
- 'name' => 'contact_lists[]',
609
- 'value' => $list['list_id'],
610
- 'id' => 'contact_list_' . $list['list_id'],
611
- 'checked' => empty( $list['selected']['default'] )
612
- ? ''
613
- : 'checked',
614
- ) ),
615
- esc_attr( 'contact_list_' . $list['list_id'] ),
616
- esc_html( $list['name'] )
617
- );
618
- }
619
- ?></ul>
620
- </fieldset>
621
- </td>
622
- </tr>
623
- </tbody>
624
- </table>
625
- <?php
626
- submit_button();
627
- }
628
- ?>
629
- </form>
630
- <?php
631
- }
632
-
633
- }
634
-
635
- class WPCF7_ConstantContact_ContactPostRequest {
636
-
637
- private $email_address;
638
- private $first_name;
639
- private $last_name;
640
- private $job_title;
641
- private $company_name;
642
- private $create_source;
643
- private $birthday_month;
644
- private $birthday_day;
645
- private $anniversary;
646
- private $custom_fields = array();
647
- private $phone_numbers = array();
648
- private $street_addresses = array();
649
- private $list_memberships = array();
650
-
651
- public function __construct() {
652
- }
653
-
654
- public function build( WPCF7_Submission $submission ) {
655
- $this->set_create_source( 'Contact' );
656
-
657
- $posted_data = (array) $submission->get_posted_data();
658
-
659
- if ( isset( $posted_data['your-first-name'] ) ) {
660
- $this->set_first_name( $posted_data['your-first-name'] );
661
- }
662
-
663
- if ( isset( $posted_data['your-last-name'] ) ) {
664
- $this->set_last_name( $posted_data['your-last-name'] );
665
- }
666
-
667
- if ( ! ( $this->first_name || $this->last_name )
668
- and isset( $posted_data['your-name'] ) ) {
669
- $your_name = preg_split( '/[\s]+/', $posted_data['your-name'], 2 );
670
- $this->set_first_name( array_shift( $your_name ) );
671
- $this->set_last_name( array_shift( $your_name ) );
672
- }
673
-
674
- if ( isset( $posted_data['your-email'] ) ) {
675
- $this->set_email_address( $posted_data['your-email'], 'implicit' );
676
- }
677
-
678
- if ( isset( $posted_data['your-job-title'] ) ) {
679
- $this->set_job_title( $posted_data['your-job-title'] );
680
- }
681
-
682
- if ( isset( $posted_data['your-company-name'] ) ) {
683
- $this->set_company_name( $posted_data['your-company-name'] );
684
- }
685
-
686
- if ( isset( $posted_data['your-birthday-month'] )
687
- and isset( $posted_data['your-birthday-day'] ) ) {
688
- $this->set_birthday(
689
- $posted_data['your-birthday-month'],
690
- $posted_data['your-birthday-day']
691
- );
692
- } elseif ( isset( $posted_data['your-birthday'] ) ) {
693
- $date = trim( $posted_data['your-birthday'] );
694
-
695
- if ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})$/', $date, $matches ) ) {
696
- $this->set_birthday( $matches[2], $matches[3] );
697
- }
698
- }
699
-
700
- if ( isset( $posted_data['your-anniversary'] ) ) {
701
- $this->set_anniversary( $posted_data['your-anniversary'] );
702
- }
703
-
704
- if ( isset( $posted_data['your-phone-number'] ) ) {
705
- $this->add_phone_number( $posted_data['your-phone-number'] );
706
- }
707
-
708
- $this->add_street_address(
709
- isset( $posted_data['your-address-street'] )
710
- ? $posted_data['your-address-street'] : '',
711
- isset( $posted_data['your-address-city'] )
712
- ? $posted_data['your-address-city'] : '',
713
- isset( $posted_data['your-address-state'] )
714
- ? $posted_data['your-address-state'] : '',
715
- isset( $posted_data['your-address-postal-code'] )
716
- ? $posted_data['your-address-postal-code'] : '',
717
- isset( $posted_data['your-address-country'] )
718
- ? $posted_data['your-address-country'] : ''
719
- );
720
-
721
- $service_option = (array) WPCF7::get_option( 'constant_contact' );
722
-
723
- $contact_lists = isset( $service_option['contact_lists'] )
724
- ? $service_option['contact_lists'] : array();
725
-
726
- $contact_form = $submission->get_contact_form();
727
-
728
- if ( $contact_form->additional_setting( 'constant_contact' ) ) {
729
- $key = sprintf( 'wpcf7_contact_form:%d', $contact_form->id() );
730
- } else {
731
- $key = 'default';
732
- }
733
-
734
- foreach ( (array) $contact_lists as $list ) {
735
- if ( ! empty( $list['selected'][$key] ) ) {
736
- $this->add_list_membership( $list['list_id'] );
737
- }
738
- }
739
- }
740
-
741
- public function is_valid() {
742
- return $this->create_source
743
- && ( $this->email_address || $this->first_name || $this->last_name );
744
- }
745
-
746
- public function to_array() {
747
- $output = array(
748
- 'email_address' => $this->email_address,
749
- 'first_name' => $this->first_name,
750
- 'last_name' => $this->last_name,
751
- 'job_title' => $this->job_title,
752
- 'company_name' => $this->company_name,
753
- 'create_source' => $this->create_source,
754
- 'birthday_month' => $this->birthday_month,
755
- 'birthday_day' => $this->birthday_day,
756
- 'anniversary' => $this->anniversary,
757
- 'custom_fields' => $this->custom_fields,
758
- 'phone_numbers' => $this->phone_numbers,
759
- 'street_addresses' => $this->street_addresses,
760
- 'list_memberships' => $this->list_memberships,
761
- );
762
-
763
- return array_filter( $output );
764
- }
765
-
766
- public function get_email_address() {
767
- if ( isset( $this->email_address['address'] ) ) {
768
- return $this->email_address['address'];
769
- }
770
-
771
- return '';
772
- }
773
-
774
- public function set_email_address( $address, $permission_to_send = '' ) {
775
- if ( ! wpcf7_is_email( $address )
776
- or 80 < $this->strlen( $address ) ) {
777
- return false;
778
- }
779
-
780
- $types_of_permission = array(
781
- 'implicit', 'explicit', 'deprecate', 'pending',
782
- 'unsubscribe', 'temp_hold', 'not_set',
783
- );
784
-
785
- if ( ! in_array( $permission_to_send, $types_of_permission ) ) {
786
- $permission_to_send = 'implicit';
787
- }
788
-
789
- return $this->email_address = array(
790
- 'address' => $address,
791
- 'permission_to_send' => $permission_to_send,
792
- );
793
- }
794
-
795
- public function set_first_name( $first_name ) {
796
- $first_name = trim( $first_name );
797
-
798
- if ( empty( $first_name )
799
- or 50 < $this->strlen( $first_name ) ) {
800
- return false;
801
- }
802
-
803
- return $this->first_name = $first_name;
804
- }
805
-
806
- public function set_last_name( $last_name ) {
807
- $last_name = trim( $last_name );
808
-
809
- if ( empty( $last_name )
810
- or 50 < $this->strlen( $last_name ) ) {
811
- return false;
812
- }
813
-
814
- return $this->last_name = $last_name;
815
- }
816
-
817
- public function set_job_title( $job_title ) {
818
- $job_title = trim( $job_title );
819
-
820
- if ( empty( $job_title )
821
- or 50 < $this->strlen( $job_title ) ) {
822
- return false;
823
- }
824
-
825
- return $this->job_title = $job_title;
826
- }
827
-
828
- public function set_company_name( $company_name ) {
829
- $company_name = trim( $company_name );
830
-
831
- if ( empty( $company_name )
832
- or 50 < $this->strlen( $company_name ) ) {
833
- return false;
834
- }
835
-
836
- return $this->company_name = $company_name;
837
- }
838
-
839
- public function set_create_source( $create_source ) {
840
- if ( ! in_array( $create_source, array( 'Contact', 'Account' ) ) ) {
841
- return false;
842
- }
843
-
844
- return $this->create_source = $create_source;
845
- }
846
-
847
- public function set_birthday( $month, $day ) {
848
- $month = (int) $month;
849
- $day = (int) $day;
850
-
851
- if ( $month < 1 || 12 < $month
852
- or $day < 1 || 31 < $day ) {
853
- return false;
854
- }
855
-
856
- $this->birthday_month = $month;
857
- $this->birthday_day = $day;
858
-
859
- return array( $this->birthday_month, $this->birthday_day );
860
- }
861
-
862
- public function set_anniversary( $anniversary ) {
863
- $pattern = sprintf(
864
- '#^(%s)$#',
865
- implode( '|', array(
866
- '\d{1,2}/\d{1,2}/\d{4}',
867
- '\d{4}/\d{1,2}/\d{1,2}',
868
- '\d{4}-\d{1,2}-\d{1,2}',
869
- '\d{1,2}-\d{1,2}-\d{4}',
870
- ) )
871
- );
872
-
873
- if ( ! preg_match( $pattern, $anniversary ) ) {
874
- return false;
875
- }
876
-
877
- return $this->anniversary = $anniversary;
878
- }
879
-
880
- public function add_custom_field( $custom_field_id, $value ) {
881
- $uuid_pattern = '/^[0-9a-f-]+$/i';
882
-
883
- $value = trim( $value );
884
-
885
- if ( 25 <= count( $this->custom_fields )
886
- or ! preg_match( $uuid_pattern, $custom_field_id )
887
- or 255 < $this->strlen( $value ) ) {
888
- return false;
889
- }
890
-
891
- return $this->custom_fields[] = array(
892
- 'custom_field_id' => $custom_field_id,
893
- 'value' => $value,
894
- );
895
- }
896
-
897
- public function add_phone_number( $phone_number, $kind = 'home' ) {
898
- $phone_number = trim( $phone_number );
899
-
900
- if ( empty( $phone_number )
901
- or ! wpcf7_is_tel( $phone_number )
902
- or 25 < $this->strlen( $phone_number )
903
- or 2 <= count( $this->phone_numbers )
904
- or ! in_array( $kind, array( 'home', 'work', 'other' ) ) ) {
905
- return false;
906
- }
907
-
908
- return $this->phone_numbers[] = array(
909
- 'phone_number' => $phone_number,
910
- 'kind' => $kind,
911
- );
912
- }
913
-
914
- public function add_street_address( $street, $city, $state, $postal_code, $country, $kind = 'home' ) {
915
- $street = trim( $street );
916
- $city = trim( $city );
917
- $state = trim( $state );
918
- $postal_code = trim( $postal_code );
919
- $country = trim( $country );
920
-
921
- if ( ! ( $street || $city || $state || $postal_code || $country )
922
- or 1 <= count( $this->street_addresses )
923
- or ! in_array( $kind, array( 'home', 'work', 'other' ) )
924
- or 255 < $this->strlen( $street )
925
- or 50 < $this->strlen( $city )
926
- or 50 < $this->strlen( $state )
927
- or 50 < $this->strlen( $postal_code )
928
- or 50 < $this->strlen( $country ) ) {
929
- return false;
930
- }
931
-
932
- return $this->street_addresses[] = array(
933
- 'kind' => $kind,
934
- 'street' => $street,
935
- 'city' => $city,
936
- 'state' => $state,
937
- 'postal_code' => $postal_code,
938
- 'country' => $country,
939
- );
940
- }
941
-
942
- public function add_list_membership( $list_id ) {
943
- $uuid_pattern = '/^[0-9a-f-]+$/i';
944
-
945
- if ( 50 <= count( $this->list_memberships )
946
- or ! preg_match( $uuid_pattern, $list_id ) ) {
947
- return false;
948
- }
949
-
950
- return $this->list_memberships[] = $list_id;
951
- }
952
-
953
- protected function strlen( $string ) {
954
- return wpcf7_count_code_units( $string );
955
- }
956
-
957
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/constant-contact/constant-contact.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ wpcf7_include_module_file( 'constant-contact/service.php' );
4
+ wpcf7_include_module_file( 'constant-contact/contact-post-request.php' );
5
+ wpcf7_include_module_file( 'constant-contact/contact-form-properties.php' );
6
+
7
+
8
+ add_action(
9
+ 'wpcf7_init',
10
+ 'wpcf7_constant_contact_register_service',
11
+ 5, 0
12
+ );
13
+
14
+ /**
15
+ * Registers the Constant Contact service.
16
+ */
17
+ function wpcf7_constant_contact_register_service() {
18
+ $integration = WPCF7_Integration::get_instance();
19
+
20
+ $integration->add_category( 'email_marketing',
21
+ __( 'Email marketing', 'contact-form-7' )
22
+ );
23
+
24
+ $service = WPCF7_ConstantContact::get_instance();
25
+ $integration->add_service( 'constant_contact', $service );
26
+ }
27
+
28
+
29
+ add_action( 'wpcf7_submit', 'wpcf7_constant_contact_submit', 10, 2 );
30
+
31
+ /**
32
+ * Callback to the wpcf7_submit action hook. Creates a contact
33
+ * based on the submission.
34
+ */
35
+ function wpcf7_constant_contact_submit( $contact_form, $result ) {
36
+ $service = WPCF7_ConstantContact::get_instance();
37
+
38
+ if ( ! $service->is_active() ) {
39
+ return;
40
+ }
41
+
42
+ if ( $contact_form->in_demo_mode() ) {
43
+ return;
44
+ }
45
+
46
+ $do_submit = true;
47
+
48
+ if ( empty( $result['status'] )
49
+ or ! in_array( $result['status'], array( 'mail_sent' ) ) ) {
50
+ $do_submit = false;
51
+ }
52
+
53
+ $prop = $contact_form->prop( 'constant_contact' );
54
+
55
+ if ( empty( $prop['enable_contact_list'] ) ) {
56
+ $do_submit = false;
57
+ }
58
+
59
+ $do_submit = apply_filters( 'wpcf7_constant_contact_submit',
60
+ $do_submit, $contact_form, $result
61
+ );
62
+
63
+ if ( ! $do_submit ) {
64
+ return;
65
+ }
66
+
67
+ $submission = WPCF7_Submission::get_instance();
68
+
69
+ $consented = true;
70
+
71
+ foreach ( $contact_form->scan_form_tags( 'feature=name-attr' ) as $tag ) {
72
+ if ( $tag->has_option( 'consent_for:constant_contact' )
73
+ and null == $submission->get_posted_data( $tag->name ) ) {
74
+ $consented = false;
75
+ break;
76
+ }
77
+ }
78
+
79
+ if ( ! $consented ) {
80
+ return;
81
+ }
82
+
83
+ $request_builder_class_name = apply_filters(
84
+ 'wpcf7_constant_contact_contact_post_request_builder',
85
+ 'WPCF7_ConstantContact_ContactPostRequest'
86
+ );
87
+
88
+ if ( ! class_exists( $request_builder_class_name ) ) {
89
+ return;
90
+ }
91
+
92
+ $request_builder = new $request_builder_class_name;
93
+ $request_builder->build( $submission );
94
+
95
+ if ( ! $request_builder->is_valid() ) {
96
+ return;
97
+ }
98
+
99
+ if ( $email = $request_builder->get_email_address()
100
+ and $service->email_exists( $email ) ) {
101
+ return;
102
+ }
103
+
104
+ $service->create_contact( $request_builder->to_array() );
105
+ }
modules/constant-contact/contact-form-properties.php ADDED
@@ -0,0 +1,287 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ add_filter(
4
+ 'wpcf7_pre_construct_contact_form_properties',
5
+ 'wpcf7_constant_contact_register_property',
6
+ 10, 2
7
+ );
8
+
9
+ /**
10
+ * Registers the constant_contact contact form property.
11
+ */
12
+ function wpcf7_constant_contact_register_property( $properties, $contact_form ) {
13
+ $service = WPCF7_ConstantContact::get_instance();
14
+
15
+ if ( $service->is_active() ) {
16
+ $properties += array(
17
+ 'constant_contact' => array(),
18
+ );
19
+ }
20
+
21
+ return $properties;
22
+ }
23
+
24
+
25
+ add_filter(
26
+ 'wpcf7_contact_form_property_constant_contact',
27
+ 'wpcf7_constant_contact_setup_property',
28
+ 10, 2
29
+ );
30
+
31
+ /**
32
+ * Sets up the constant_contact property value. For back-compat, this attempts
33
+ * to take over the value from old settings if the property is empty.
34
+ */
35
+ function wpcf7_constant_contact_setup_property( $property, $contact_form ) {
36
+ if ( ! empty( $property ) ) {
37
+ $property = wp_parse_args(
38
+ $property,
39
+ array(
40
+ 'enable_contact_list' => false,
41
+ 'contact_lists' => array(),
42
+ )
43
+ );
44
+
45
+ return $property;
46
+ }
47
+
48
+ $property = array(
49
+ 'enable_contact_list' => true,
50
+ 'contact_lists' => array(),
51
+ );
52
+
53
+ if ( $contact_form->initial() ) {
54
+ return $property;
55
+ }
56
+
57
+ $service_option = (array) WPCF7::get_option( 'constant_contact' );
58
+
59
+ $additional_settings = $contact_form->additional_setting(
60
+ 'constant_contact',
61
+ false
62
+ );
63
+
64
+ $property['enable_contact_list'] = ! array_filter(
65
+ $additional_settings,
66
+ function ( $setting ) {
67
+ return in_array( $setting, array( 'off', 'false', '0' ), true );
68
+ }
69
+ );
70
+
71
+ if ( isset( $service_option['contact_lists'] ) ) {
72
+ $contact_lists = (array) $service_option['contact_lists'];
73
+ $contact_lists_selected = array();
74
+
75
+ foreach ( $contact_lists as $list ) {
76
+ if ( empty( $list['selected'] ) ) {
77
+ continue;
78
+ }
79
+
80
+ foreach ( (array) $list['selected'] as $key => $val ) {
81
+ if ( ! isset( $contact_lists_selected[$key] ) ) {
82
+ $contact_lists_selected[$key] = array();
83
+ }
84
+
85
+ $contact_lists_selected[$key][] = $list['list_id'];
86
+ }
87
+ }
88
+
89
+ $related_keys = array(
90
+ sprintf( 'wpcf7_contact_form:%d', $contact_form->id() ),
91
+ 'default',
92
+ );
93
+
94
+ foreach ( $related_keys as $key ) {
95
+ if ( ! empty( $contact_lists_selected[$key] ) ) {
96
+ $property['contact_lists'] = $contact_lists_selected[$key];
97
+ break;
98
+ }
99
+ }
100
+ }
101
+
102
+ return $property;
103
+ }
104
+
105
+
106
+ add_action(
107
+ 'wpcf7_save_contact_form',
108
+ 'wpcf7_constant_contact_save_contact_form',
109
+ 10, 1
110
+ );
111
+
112
+ /**
113
+ * Saves the constant_contact property value.
114
+ */
115
+ function wpcf7_constant_contact_save_contact_form( $contact_form ) {
116
+ $service = WPCF7_ConstantContact::get_instance();
117
+
118
+ if ( ! $service->is_active() ) {
119
+ return;
120
+ }
121
+
122
+ $prop = isset( $_POST['wpcf7-ctct'] )
123
+ ? (array) $_POST['wpcf7-ctct']
124
+ : array();
125
+
126
+ $prop = wp_parse_args(
127
+ $prop,
128
+ array(
129
+ 'enable_contact_list' => false,
130
+ 'contact_lists' => array(),
131
+ )
132
+ );
133
+
134
+ $contact_form->set_properties( array(
135
+ 'constant_contact' => $prop,
136
+ ) );
137
+ }
138
+
139
+
140
+ add_filter(
141
+ 'wpcf7_editor_panels',
142
+ 'wpcf7_constant_contact_editor_panels',
143
+ 10, 1
144
+ );
145
+
146
+ /**
147
+ * Builds the editor panel for the constant_contact property.
148
+ */
149
+ function wpcf7_constant_contact_editor_panels( $panels ) {
150
+ $service = WPCF7_ConstantContact::get_instance();
151
+
152
+ if ( ! $service->is_active() ) {
153
+ return $panels;
154
+ }
155
+
156
+ $contact_form = WPCF7_ContactForm::get_current();
157
+
158
+ $prop = wp_parse_args(
159
+ $contact_form->prop( 'constant_contact' ),
160
+ array(
161
+ 'enable_contact_list' => false,
162
+ 'contact_lists' => array(),
163
+ )
164
+ );
165
+
166
+ $editor_panel = function () use ( $prop, $service ) {
167
+
168
+ $description = sprintf(
169
+ esc_html(
170
+ __( "You can set up the Constant Contact integration here. For details, see %s.", 'contact-form-7' )
171
+ ),
172
+ wpcf7_link(
173
+ __( 'https://contactform7.com/constant-contact-integration/', 'contact-form-7' ),
174
+ __( 'Constant Contact integration', 'contact-form-7' )
175
+ )
176
+ );
177
+
178
+ $lists = $service->get_contact_lists();
179
+
180
+ ?>
181
+ <h2><?php echo esc_html( __( 'Constant Contact', 'contact-form-7' ) ); ?></h2>
182
+
183
+ <fieldset>
184
+ <legend><?php echo $description; ?></legend>
185
+
186
+ <table class="form-table" role="presentation">
187
+ <tbody>
188
+ <tr class="<?php echo $prop['enable_contact_list'] ? '' : 'inactive'; ?>">
189
+ <th scope="row">
190
+ <?php
191
+
192
+ echo esc_html( __( 'Contact lists', 'contact-form-7' ) );
193
+
194
+ ?>
195
+ </th>
196
+ <td>
197
+ <fieldset>
198
+ <legend class="screen-reader-text">
199
+ <?php
200
+
201
+ echo esc_html( __( 'Contact lists', 'contact-form-7' ) );
202
+
203
+ ?>
204
+ </legend>
205
+ <label for="wpcf7-ctct-enable-contact-list">
206
+ <input type="checkbox" name="wpcf7-ctct[enable_contact_list]" id="wpcf7-ctct-enable-contact-list" value="1" <?php checked( $prop['enable_contact_list'] ); ?> />
207
+ <?php
208
+
209
+ echo esc_html(
210
+ __( "Add form submitters to your contact lists", 'contact-form-7' )
211
+ );
212
+
213
+ ?>
214
+ </label>
215
+ </fieldset>
216
+ </td>
217
+ </tr>
218
+ <tr>
219
+ <th scope="row"></th>
220
+ <td>
221
+ <fieldset>
222
+ <?php
223
+
224
+ if ( $lists ) {
225
+ echo sprintf(
226
+ '<legend>%1$s</legend>',
227
+ esc_html( __( 'Select lists to which contacts are added:', 'contact-form-7' ) )
228
+ );
229
+
230
+ echo '<ul>';
231
+
232
+ foreach ( $lists as $list ) {
233
+ echo sprintf(
234
+ '<li><label><input %1$s /> %2$s</label></li>',
235
+ wpcf7_format_atts( array(
236
+ 'type' => 'checkbox',
237
+ 'name' => 'wpcf7-ctct[contact_lists][]',
238
+ 'value' => $list['list_id'],
239
+ 'checked' => in_array( $list['list_id'], $prop['contact_lists'] )
240
+ ? 'checked'
241
+ : '',
242
+ ) ),
243
+ esc_html( $list['name'] )
244
+ );
245
+ }
246
+
247
+ echo '</ul>';
248
+ } else {
249
+ echo sprintf(
250
+ '<legend>%1$s</legend>',
251
+ esc_html( __( 'You have no contact list yet.', 'contact-form-7' ) )
252
+ );
253
+ }
254
+
255
+ ?>
256
+ </fieldset>
257
+ <?php
258
+
259
+ echo sprintf(
260
+ '<p><a %1$s>%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a></p>',
261
+ wpcf7_format_atts( array(
262
+ 'href' => 'https://app.constantcontact.com/pages/contacts/ui#lists',
263
+ 'target' => '_blank',
264
+ 'rel' => 'external noreferrer noopener',
265
+ ) ),
266
+ esc_html( __( 'Manage your contact lists', 'contact-form-7' ) ),
267
+ esc_html( __( '(opens in a new tab)', 'contact-form-7' ) )
268
+ );
269
+
270
+ ?>
271
+ </td>
272
+ </tr>
273
+ </tbody>
274
+ </table>
275
+ </fieldset>
276
+ <?php
277
+ };
278
+
279
+ $panels += array(
280
+ 'ctct-panel' => array(
281
+ 'title' => __( 'Constant Contact', 'contact-form-7' ),
282
+ 'callback' => $editor_panel,
283
+ ),
284
+ );
285
+
286
+ return $panels;
287
+ }
modules/constant-contact/contact-post-request.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPCF7_ConstantContact_ContactPostRequest {
4
+
5
+ private $email_address;
6
+ private $first_name;
7
+ private $last_name;
8
+ private $job_title;
9
+ private $company_name;
10
+ private $create_source;
11
+ private $birthday_month;
12
+ private $birthday_day;
13
+ private $anniversary;
14
+ private $custom_fields = array();
15
+ private $phone_numbers = array();
16
+ private $street_addresses = array();
17
+ private $list_memberships = array();
18
+
19
+ public function __construct() {
20
+ }
21
+
22
+ public function build( WPCF7_Submission $submission ) {
23
+ $this->set_create_source( 'Contact' );
24
+
25
+ $posted_data = (array) $submission->get_posted_data();
26
+
27
+ if ( isset( $posted_data['your-first-name'] ) ) {
28
+ $this->set_first_name( $posted_data['your-first-name'] );
29
+ }
30
+
31
+ if ( isset( $posted_data['your-last-name'] ) ) {
32
+ $this->set_last_name( $posted_data['your-last-name'] );
33
+ }
34
+
35
+ if ( ! ( $this->first_name || $this->last_name )
36
+ and isset( $posted_data['your-name'] ) ) {
37
+ $your_name = preg_split( '/[\s]+/', $posted_data['your-name'], 2 );
38
+ $this->set_first_name( array_shift( $your_name ) );
39
+ $this->set_last_name( array_shift( $your_name ) );
40
+ }
41
+
42
+ if ( isset( $posted_data['your-email'] ) ) {
43
+ $this->set_email_address( $posted_data['your-email'], 'implicit' );
44
+ }
45
+
46
+ if ( isset( $posted_data['your-job-title'] ) ) {
47
+ $this->set_job_title( $posted_data['your-job-title'] );
48
+ }
49
+
50
+ if ( isset( $posted_data['your-company-name'] ) ) {
51
+ $this->set_company_name( $posted_data['your-company-name'] );
52
+ }
53
+
54
+ if ( isset( $posted_data['your-birthday-month'] )
55
+ and isset( $posted_data['your-birthday-day'] ) ) {
56
+ $this->set_birthday(
57
+ $posted_data['your-birthday-month'],
58
+ $posted_data['your-birthday-day']
59
+ );
60
+ } elseif ( isset( $posted_data['your-birthday'] ) ) {
61
+ $date = trim( $posted_data['your-birthday'] );
62
+
63
+ if ( preg_match( '/^(\d{4})-(\d{2})-(\d{2})$/', $date, $matches ) ) {
64
+ $this->set_birthday( $matches[2], $matches[3] );
65
+ }
66
+ }
67
+
68
+ if ( isset( $posted_data['your-anniversary'] ) ) {
69
+ $this->set_anniversary( $posted_data['your-anniversary'] );
70
+ }
71
+
72
+ if ( isset( $posted_data['your-phone-number'] ) ) {
73
+ $this->add_phone_number( $posted_data['your-phone-number'] );
74
+ }
75
+
76
+ $this->add_street_address(
77
+ isset( $posted_data['your-address-street'] )
78
+ ? $posted_data['your-address-street'] : '',
79
+ isset( $posted_data['your-address-city'] )
80
+ ? $posted_data['your-address-city'] : '',
81
+ isset( $posted_data['your-address-state'] )
82
+ ? $posted_data['your-address-state'] : '',
83
+ isset( $posted_data['your-address-postal-code'] )
84
+ ? $posted_data['your-address-postal-code'] : '',
85
+ isset( $posted_data['your-address-country'] )
86
+ ? $posted_data['your-address-country'] : ''
87
+ );
88
+
89
+ $service_option = (array) WPCF7::get_option( 'constant_contact' );
90
+
91
+ $contact_lists = isset( $service_option['contact_lists'] )
92
+ ? $service_option['contact_lists'] : array();
93
+
94
+ $contact_form = $submission->get_contact_form();
95
+
96
+ $prop = $contact_form->prop( 'constant_contact' );
97
+
98
+ if ( ! empty( $prop['enable_contact_list'] )
99
+ and ! empty( $prop['contact_lists'] ) ) {
100
+ foreach ( (array) $prop['contact_lists'] as $list_id ) {
101
+ $this->add_list_membership( $list_id );
102
+ }
103
+ }
104
+ }
105
+
106
+ public function is_valid() {
107
+ return $this->create_source
108
+ && ( $this->email_address || $this->first_name || $this->last_name );
109
+ }
110
+
111
+ public function to_array() {
112
+ $output = array(
113
+ 'email_address' => $this->email_address,
114
+ 'first_name' => $this->first_name,
115
+ 'last_name' => $this->last_name,
116
+ 'job_title' => $this->job_title,
117
+ 'company_name' => $this->company_name,
118
+ 'create_source' => $this->create_source,
119
+ 'birthday_month' => $this->birthday_month,
120
+ 'birthday_day' => $this->birthday_day,
121
+ 'anniversary' => $this->anniversary,
122
+ 'custom_fields' => $this->custom_fields,
123
+ 'phone_numbers' => $this->phone_numbers,
124
+ 'street_addresses' => $this->street_addresses,
125
+ 'list_memberships' => $this->list_memberships,
126
+ );
127
+
128
+ return array_filter( $output );
129
+ }
130
+
131
+ public function get_email_address() {
132
+ if ( isset( $this->email_address['address'] ) ) {
133
+ return $this->email_address['address'];
134
+ }
135
+
136
+ return '';
137
+ }
138
+
139
+ public function set_email_address( $address, $permission_to_send = '' ) {
140
+ if ( ! wpcf7_is_email( $address )
141
+ or 80 < $this->strlen( $address ) ) {
142
+ return false;
143
+ }
144
+
145
+ $types_of_permission = array(
146
+ 'implicit', 'explicit', 'deprecate', 'pending',
147
+ 'unsubscribe', 'temp_hold', 'not_set',
148
+ );
149
+
150
+ if ( ! in_array( $permission_to_send, $types_of_permission ) ) {
151
+ $permission_to_send = 'implicit';
152
+ }
153
+
154
+ return $this->email_address = array(
155
+ 'address' => $address,
156
+ 'permission_to_send' => $permission_to_send,
157
+ );
158
+ }
159
+
160
+ public function set_first_name( $first_name ) {
161
+ $first_name = trim( $first_name );
162
+
163
+ if ( empty( $first_name )
164
+ or 50 < $this->strlen( $first_name ) ) {
165
+ return false;
166
+ }
167
+
168
+ return $this->first_name = $first_name;
169
+ }
170
+
171
+ public function set_last_name( $last_name ) {
172
+ $last_name = trim( $last_name );
173
+
174
+ if ( empty( $last_name )
175
+ or 50 < $this->strlen( $last_name ) ) {
176
+ return false;
177
+ }
178
+
179
+ return $this->last_name = $last_name;
180
+ }
181
+
182
+ public function set_job_title( $job_title ) {
183
+ $job_title = trim( $job_title );
184
+
185
+ if ( empty( $job_title )
186
+ or 50 < $this->strlen( $job_title ) ) {
187
+ return false;
188
+ }
189
+
190
+ return $this->job_title = $job_title;
191
+ }
192
+
193
+ public function set_company_name( $company_name ) {
194
+ $company_name = trim( $company_name );
195
+
196
+ if ( empty( $company_name )
197
+ or 50 < $this->strlen( $company_name ) ) {
198
+ return false;
199
+ }
200
+
201
+ return $this->company_name = $company_name;
202
+ }
203
+
204
+ public function set_create_source( $create_source ) {
205
+ if ( ! in_array( $create_source, array( 'Contact', 'Account' ) ) ) {
206
+ return false;
207
+ }
208
+
209
+ return $this->create_source = $create_source;
210
+ }
211
+
212
+ public function set_birthday( $month, $day ) {
213
+ $month = (int) $month;
214
+ $day = (int) $day;
215
+
216
+ if ( $month < 1 || 12 < $month
217
+ or $day < 1 || 31 < $day ) {
218
+ return false;
219
+ }
220
+
221
+ $this->birthday_month = $month;
222
+ $this->birthday_day = $day;
223
+
224
+ return array( $this->birthday_month, $this->birthday_day );
225
+ }
226
+
227
+ public function set_anniversary( $anniversary ) {
228
+ $pattern = sprintf(
229
+ '#^(%s)$#',
230
+ implode( '|', array(
231
+ '\d{1,2}/\d{1,2}/\d{4}',
232
+ '\d{4}/\d{1,2}/\d{1,2}',
233
+ '\d{4}-\d{1,2}-\d{1,2}',
234
+ '\d{1,2}-\d{1,2}-\d{4}',
235
+ ) )
236
+ );
237
+
238
+ if ( ! preg_match( $pattern, $anniversary ) ) {
239
+ return false;
240
+ }
241
+
242
+ return $this->anniversary = $anniversary;
243
+ }
244
+
245
+ public function add_custom_field( $custom_field_id, $value ) {
246
+ $uuid_pattern = '/^[0-9a-f-]+$/i';
247
+
248
+ $value = trim( $value );
249
+
250
+ if ( 25 <= count( $this->custom_fields )
251
+ or ! preg_match( $uuid_pattern, $custom_field_id )
252
+ or 255 < $this->strlen( $value ) ) {
253
+ return false;
254
+ }
255
+
256
+ return $this->custom_fields[] = array(
257
+ 'custom_field_id' => $custom_field_id,
258
+ 'value' => $value,
259
+ );
260
+ }
261
+
262
+ public function add_phone_number( $phone_number, $kind = 'home' ) {
263
+ $phone_number = trim( $phone_number );
264
+
265
+ if ( empty( $phone_number )
266
+ or ! wpcf7_is_tel( $phone_number )
267
+ or 25 < $this->strlen( $phone_number )
268
+ or 2 <= count( $this->phone_numbers )
269
+ or ! in_array( $kind, array( 'home', 'work', 'other' ) ) ) {
270
+ return false;
271
+ }
272
+
273
+ return $this->phone_numbers[] = array(
274
+ 'phone_number' => $phone_number,
275
+ 'kind' => $kind,
276
+ );
277
+ }
278
+
279
+ public function add_street_address( $street, $city, $state, $postal_code, $country, $kind = 'home' ) {
280
+ $street = trim( $street );
281
+ $city = trim( $city );
282
+ $state = trim( $state );
283
+ $postal_code = trim( $postal_code );
284
+ $country = trim( $country );
285
+
286
+ if ( ! ( $street || $city || $state || $postal_code || $country )
287
+ or 1 <= count( $this->street_addresses )
288
+ or ! in_array( $kind, array( 'home', 'work', 'other' ) )
289
+ or 255 < $this->strlen( $street )
290
+ or 50 < $this->strlen( $city )
291
+ or 50 < $this->strlen( $state )
292
+ or 50 < $this->strlen( $postal_code )
293
+ or 50 < $this->strlen( $country ) ) {
294
+ return false;
295
+ }
296
+
297
+ return $this->street_addresses[] = array(
298
+ 'kind' => $kind,
299
+ 'street' => $street,
300
+ 'city' => $city,
301
+ 'state' => $state,
302
+ 'postal_code' => $postal_code,
303
+ 'country' => $country,
304
+ );
305
+ }
306
+
307
+ public function add_list_membership( $list_id ) {
308
+ $uuid_pattern = '/^[0-9a-f-]+$/i';
309
+
310
+ if ( 50 <= count( $this->list_memberships )
311
+ or ! preg_match( $uuid_pattern, $list_id ) ) {
312
+ return false;
313
+ }
314
+
315
+ return $this->list_memberships[] = $list_id;
316
+ }
317
+
318
+ protected function strlen( $string ) {
319
+ return wpcf7_count_code_units( $string );
320
+ }
321
+
322
+ }
modules/constant-contact/service.php ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists( 'WPCF7_Service_OAuth2' ) ) {
4
+ return;
5
+ }
6
+
7
+ class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
8
+
9
+ const service_name = 'constant_contact';
10
+ const authorization_endpoint = 'https://api.cc.email/v3/idfed';
11
+ const token_endpoint = 'https://idfed.constantcontact.com/as/token.oauth2';
12
+
13
+ private static $instance;
14
+ protected $contact_lists = array();
15
+
16
+ public static function get_instance() {
17
+ if ( empty( self::$instance ) ) {
18
+ self::$instance = new self;
19
+ }
20
+
21
+ return self::$instance;
22
+ }
23
+
24
+ private function __construct() {
25
+ $this->authorization_endpoint = self::authorization_endpoint;
26
+ $this->token_endpoint = self::token_endpoint;
27
+
28
+ $option = (array) WPCF7::get_option( self::service_name );
29
+
30
+ if ( isset( $option['client_id'] ) ) {
31
+ $this->client_id = $option['client_id'];
32
+ }
33
+
34
+ if ( isset( $option['client_secret'] ) ) {
35
+ $this->client_secret = $option['client_secret'];
36
+ }
37
+
38
+ if ( isset( $option['access_token'] ) ) {
39
+ $this->access_token = $option['access_token'];
40
+ }
41
+
42
+ if ( isset( $option['refresh_token'] ) ) {
43
+ $this->refresh_token = $option['refresh_token'];
44
+ }
45
+
46
+ if ( $this->is_active() ) {
47
+ if ( isset( $option['contact_lists'] ) ) {
48
+ $this->contact_lists = $option['contact_lists'];
49
+ }
50
+ }
51
+
52
+ add_action( 'wpcf7_admin_init', array( $this, 'auth_redirect' ) );
53
+ }
54
+
55
+ public function auth_redirect() {
56
+ $auth = isset( $_GET['auth'] ) ? trim( $_GET['auth'] ) : '';
57
+ $code = isset( $_GET['code'] ) ? trim( $_GET['code'] ) : '';
58
+
59
+ if ( self::service_name === $auth and $code
60
+ and current_user_can( 'wpcf7_manage_integration' ) ) {
61
+ $redirect_to = add_query_arg(
62
+ array(
63
+ 'service' => self::service_name,
64
+ 'action' => 'auth_redirect',
65
+ 'code' => $code,
66
+ ),
67
+ menu_page_url( 'wpcf7-integration', false )
68
+ );
69
+
70
+ wp_safe_redirect( $redirect_to );
71
+ exit();
72
+ }
73
+ }
74
+
75
+ protected function save_data() {
76
+ $option = array_merge(
77
+ (array) WPCF7::get_option( self::service_name ),
78
+ array(
79
+ 'client_id' => $this->client_id,
80
+ 'client_secret' => $this->client_secret,
81
+ 'access_token' => $this->access_token,
82
+ 'refresh_token' => $this->refresh_token,
83
+ 'contact_lists' => $this->contact_lists,
84
+ )
85
+ );
86
+
87
+ WPCF7::update_option( self::service_name, $option );
88
+ }
89
+
90
+ protected function reset_data() {
91
+ $this->client_id = '';
92
+ $this->client_secret = '';
93
+ $this->access_token = '';
94
+ $this->refresh_token = '';
95
+ $this->contact_lists = array();
96
+
97
+ $this->save_data();
98
+ }
99
+
100
+ public function get_title() {
101
+ return __( 'Constant Contact', 'contact-form-7' );
102
+ }
103
+
104
+ public function get_categories() {
105
+ return array( 'email_marketing' );
106
+ }
107
+
108
+ public function icon() {
109
+ }
110
+
111
+ public function link() {
112
+ echo sprintf( '<a href="%1$s">%2$s</a>',
113
+ 'https://constant-contact.evyy.net/c/1293104/205991/3411',
114
+ 'constantcontact.com'
115
+ );
116
+ }
117
+
118
+ protected function get_redirect_uri() {
119
+ return admin_url( '/?auth=' . self::service_name );
120
+ }
121
+
122
+ protected function menu_page_url( $args = '' ) {
123
+ $args = wp_parse_args( $args, array() );
124
+
125
+ $url = menu_page_url( 'wpcf7-integration', false );
126
+ $url = add_query_arg( array( 'service' => self::service_name ), $url );
127
+
128
+ if ( ! empty( $args) ) {
129
+ $url = add_query_arg( $args, $url );
130
+ }
131
+
132
+ return $url;
133
+ }
134
+
135
+ public function load( $action = '' ) {
136
+ parent::load( $action );
137
+
138
+ if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) {
139
+ check_admin_referer( 'wpcf7-constant-contact-setup' );
140
+
141
+ if ( ! empty( $_POST['reset'] ) ) {
142
+ $this->reset_data();
143
+ } else {
144
+ $this->client_id = isset( $_POST['client_id'] )
145
+ ? trim( $_POST['client_id'] ) : '';
146
+
147
+ $this->client_secret = isset( $_POST['client_secret'] )
148
+ ? trim( $_POST['client_secret'] ) : '';
149
+
150
+ $this->save_data();
151
+ $this->authorize( 'contact_data' );
152
+ }
153
+
154
+ wp_safe_redirect( $this->menu_page_url( 'action=setup' ) );
155
+ exit();
156
+ }
157
+ }
158
+
159
+ public function email_exists( $email ) {
160
+ $endpoint = add_query_arg(
161
+ array(
162
+ 'email' => $email,
163
+ 'status' => 'all',
164
+ ),
165
+ 'https://api.cc.email/v3/contacts'
166
+ );
167
+
168
+ $request = array(
169
+ 'method' => 'GET',
170
+ 'headers' => array(
171
+ 'Accept' => 'application/json',
172
+ 'Content-Type' => 'application/json; charset=utf-8',
173
+ ),
174
+ );
175
+
176
+ $response = $this->remote_request( $endpoint, $request );
177
+
178
+ if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
179
+ if ( WP_DEBUG ) {
180
+ $this->log( $endpoint, $request, $response );
181
+ }
182
+
183
+ return false;
184
+ }
185
+
186
+ $response_body = wp_remote_retrieve_body( $response );
187
+
188
+ if ( empty( $response_body ) ) {
189
+ return false;
190
+ }
191
+
192
+ $response_body = json_decode( $response_body, true );
193
+
194
+ return ! empty( $response_body['contacts'] );
195
+ }
196
+
197
+ public function create_contact( $properties ) {
198
+ $endpoint = 'https://api.cc.email/v3/contacts';
199
+
200
+ $request = array(
201
+ 'method' => 'POST',
202
+ 'headers' => array(
203
+ 'Accept' => 'application/json',
204
+ 'Content-Type' => 'application/json; charset=utf-8',
205
+ ),
206
+ 'body' => json_encode( $properties ),
207
+ );
208
+
209
+ $response = $this->remote_request( $endpoint, $request );
210
+
211
+ if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
212
+ if ( WP_DEBUG ) {
213
+ $this->log( $endpoint, $request, $response );
214
+ }
215
+
216
+ return false;
217
+ }
218
+ }
219
+
220
+ public function get_contact_lists() {
221
+ $endpoint = 'https://api.cc.email/v3/contact_lists';
222
+
223
+ $request = array(
224
+ 'method' => 'GET',
225
+ 'headers' => array(
226
+ 'Accept' => 'application/json',
227
+ 'Content-Type' => 'application/json; charset=utf-8',
228
+ ),
229
+ );
230
+
231
+ $response = $this->remote_request( $endpoint, $request );
232
+
233
+ if ( 400 <= (int) wp_remote_retrieve_response_code( $response ) ) {
234
+ if ( WP_DEBUG ) {
235
+ $this->log( $endpoint, $request, $response );
236
+ }
237
+
238
+ return false;
239
+ }
240
+
241
+ $response_body = wp_remote_retrieve_body( $response );
242
+
243
+ if ( empty( $response_body ) ) {
244
+ return false;
245
+ }
246
+
247
+ $response_body = json_decode( $response_body, true );
248
+
249
+ if ( ! empty( $response_body['lists'] ) ) {
250
+ return (array) $response_body['lists'];
251
+ } else {
252
+ return array();
253
+ }
254
+ }
255
+
256
+ public function update_contact_lists( $selection = array() ) {
257
+ $contact_lists = array();
258
+ $contact_lists_on_api = $this->get_contact_lists();
259
+
260
+ if ( false !== $contact_lists_on_api ) {
261
+ foreach ( (array) $contact_lists_on_api as $list ) {
262
+ if ( isset( $list['list_id'] ) ) {
263
+ $list_id = trim( $list['list_id'] );
264
+ } else {
265
+ continue;
266
+ }
267
+
268
+ if ( isset( $this->contact_lists[$list_id]['selected'] ) ) {
269
+ $list['selected'] = $this->contact_lists[$list_id]['selected'];
270
+ } else {
271
+ $list['selected'] = array();
272
+ }
273
+
274
+ $contact_lists[$list_id] = $list;
275
+ }
276
+ } else {
277
+ $contact_lists = $this->contact_lists;
278
+ }
279
+
280
+ foreach ( (array) $selection as $key => $ids_or_names ) {
281
+ foreach( $contact_lists as $list_id => $list ) {
282
+ if ( in_array( $list['list_id'], (array) $ids_or_names, true )
283
+ or in_array( $list['name'], (array) $ids_or_names, true ) ) {
284
+ $contact_lists[$list_id]['selected'][$key] = true;
285
+ } else {
286
+ unset( $contact_lists[$list_id]['selected'][$key] );
287
+ }
288
+ }
289
+ }
290
+
291
+ $this->contact_lists = $contact_lists;
292
+
293
+ if ( $selection ) {
294
+ $this->save_data();
295
+ }
296
+
297
+ return $this->contact_lists;
298
+ }
299
+
300
+ public function admin_notice( $message = '' ) {
301
+ switch ( $message ) {
302
+ case 'success':
303
+ echo sprintf(
304
+ '<div class="notice notice-success"><p>%s</p></div>',
305
+ esc_html( __( "Connection established.", 'contact-form-7' ) )
306
+ );
307
+ break;
308
+ case 'failed':
309
+ echo sprintf(
310
+ '<div class="notice notice-error"><p><strong>%1$s</strong>: %2$s</p></div>',
311
+ esc_html( __( "Error", 'contact-form-7' ) ),
312
+ esc_html( __( "Failed to establish connection. Please double-check your configuration.", 'contact-form-7' ) )
313
+ );
314
+ break;
315
+ case 'updated':
316
+ echo sprintf(
317
+ '<div class="notice notice-success"><p>%s</p></div>',
318
+ esc_html( __( "Configuration updated.", 'contact-form-7' ) )
319
+ );
320
+ break;
321
+ }
322
+ }
323
+
324
+ public function display( $action = '' ) {
325
+ echo '<p>' . sprintf(
326
+ esc_html( __( 'The Constant Contact integration module allows you to send contact data collected through your contact forms to the Constant Contact API. You can create reliable email subscription services in a few easy steps. For details, see %s.', 'contact-form-7' ) ),
327
+ wpcf7_link(
328
+ __(
329
+ 'https://contactform7.com/constant-contact-integration/',
330
+ 'contact-form-7'
331
+ ),
332
+ __( 'Constant Contact integration', 'contact-form-7' )
333
+ )
334
+ ) . '</p>';
335
+
336
+ if ( $this->is_active() ) {
337
+ echo sprintf(
338
+ '<p class="dashicons-before dashicons-yes">%s</p>',
339
+ esc_html( __( "This site is connected to the Constant Contact API.", 'contact-form-7' ) )
340
+ );
341
+ }
342
+
343
+ if ( 'setup' == $action ) {
344
+ $this->display_setup();
345
+ } else {
346
+ echo sprintf(
347
+ '<p><a href="%1$s" class="button">%2$s</a></p>',
348
+ esc_url( $this->menu_page_url( 'action=setup' ) ),
349
+ esc_html( __( 'Setup Integration', 'contact-form-7' ) )
350
+ );
351
+ }
352
+ }
353
+
354
+ private function display_setup() {
355
+ ?>
356
+ <form method="post" action="<?php echo esc_url( $this->menu_page_url( 'action=setup' ) ); ?>">
357
+ <?php wp_nonce_field( 'wpcf7-constant-contact-setup' ); ?>
358
+ <table class="form-table">
359
+ <tbody>
360
+ <tr>
361
+ <th scope="row"><label for="client_id"><?php echo esc_html( __( 'API Key', 'contact-form-7' ) ); ?></label></th>
362
+ <td><?php
363
+ if ( $this->is_active() ) {
364
+ echo esc_html( $this->client_id );
365
+ echo sprintf(
366
+ '<input type="hidden" value="%1$s" id="client_id" name="client_id" />',
367
+ esc_attr( $this->client_id )
368
+ );
369
+ } else {
370
+ echo sprintf(
371
+ '<input type="text" aria-required="true" value="%1$s" id="client_id" name="client_id" class="regular-text code" />',
372
+ esc_attr( $this->client_id )
373
+ );
374
+ }
375
+ ?></td>
376
+ </tr>
377
+ <tr>
378
+ <th scope="row"><label for="client_secret"><?php echo esc_html( __( 'App Secret', 'contact-form-7' ) ); ?></label></th>
379
+ <td><?php
380
+ if ( $this->is_active() ) {
381
+ echo esc_html( wpcf7_mask_password( $this->client_secret, 4, 4 ) );
382
+ echo sprintf(
383
+ '<input type="hidden" value="%1$s" id="client_secret" name="client_secret" />',
384
+ esc_attr( $this->client_secret )
385
+ );
386
+ } else {
387
+ echo sprintf(
388
+ '<input type="text" aria-required="true" value="%1$s" id="client_secret" name="client_secret" class="regular-text code" />',
389
+ esc_attr( $this->client_secret )
390
+ );
391
+ }
392
+ ?></td>
393
+ </tr>
394
+ <tr>
395
+ <th scope="row"><label for="redirect_uri"><?php echo esc_html( __( 'Redirect URI', 'contact-form-7' ) ); ?></label></th>
396
+ <td><?php
397
+ echo sprintf(
398
+ '<input type="text" value="%1$s" id="redirect_uri" name="redirect_uri" class="large-text code" readonly="readonly" onfocus="this.select();" style="font-size: 11px;" />',
399
+ $this->get_redirect_uri()
400
+ );
401
+ ?>
402
+ <p class="description"><?php echo esc_html( __( "Set this URL as the redirect URI.", 'contact-form-7' ) ); ?></p>
403
+ </td>
404
+ </tr>
405
+ </tbody>
406
+ </table>
407
+ <?php
408
+ if ( $this->is_active() ) {
409
+ submit_button(
410
+ _x( 'Reset Keys', 'API keys', 'contact-form-7' ),
411
+ 'small', 'reset'
412
+ );
413
+ } else {
414
+ submit_button(
415
+ __( 'Connect to the Constant Contact API', 'contact-form-7' )
416
+ );
417
+ }
418
+ ?>
419
+ </form>
420
+ <?php
421
+ }
422
+
423
+ }
modules/sendinblue/contact-form-properties.php CHANGED
@@ -1,22 +1,23 @@
1
  <?php
2
 
3
  add_filter(
4
- 'wpcf7_contact_form_properties',
5
  'wpcf7_sendinblue_register_property',
6
  10, 2
7
  );
8
 
 
 
 
9
  function wpcf7_sendinblue_register_property( $properties, $contact_form ) {
10
  $service = WPCF7_Sendinblue::get_instance();
11
 
12
- if ( ! $service->is_active() ) {
13
- return $properties;
 
 
14
  }
15
 
16
- $properties += array(
17
- 'sendinblue' => array(),
18
- );
19
-
20
  return $properties;
21
  }
22
 
@@ -27,6 +28,9 @@ add_action(
27
  10, 3
28
  );
29
 
 
 
 
30
  function wpcf7_sendinblue_save_contact_form( $contact_form, $args, $context ) {
31
  $service = WPCF7_Sendinblue::get_instance();
32
 
@@ -64,6 +68,9 @@ add_filter(
64
  10, 1
65
  );
66
 
 
 
 
67
  function wpcf7_sendinblue_editor_panels( $panels ) {
68
  $service = WPCF7_Sendinblue::get_instance();
69
 
1
  <?php
2
 
3
  add_filter(
4
+ 'wpcf7_pre_construct_contact_form_properties',
5
  'wpcf7_sendinblue_register_property',
6
  10, 2
7
  );
8
 
9
+ /**
10
+ * Registers the sendinblue contact form property.
11
+ */
12
  function wpcf7_sendinblue_register_property( $properties, $contact_form ) {
13
  $service = WPCF7_Sendinblue::get_instance();
14
 
15
+ if ( $service->is_active() ) {
16
+ $properties += array(
17
+ 'sendinblue' => array(),
18
+ );
19
  }
20
 
 
 
 
 
21
  return $properties;
22
  }
23
 
28
  10, 3
29
  );
30
 
31
+ /**
32
+ * Saves the sendinblue property value.
33
+ */
34
  function wpcf7_sendinblue_save_contact_form( $contact_form, $args, $context ) {
35
  $service = WPCF7_Sendinblue::get_instance();
36
 
68
  10, 1
69
  );
70
 
71
+ /**
72
+ * Builds the editor panel for the sendinblue property.
73
+ */
74
  function wpcf7_sendinblue_editor_panels( $panels ) {
75
  $service = WPCF7_Sendinblue::get_instance();
76
 
modules/sendinblue/sendinblue.php CHANGED
@@ -1,14 +1,7 @@
1
  <?php
2
 
3
- include_once path_join(
4
- WPCF7_PLUGIN_MODULES_DIR,
5
- 'sendinblue/service.php'
6
- );
7
-
8
- include_once path_join(
9
- WPCF7_PLUGIN_MODULES_DIR,
10
- 'sendinblue/contact-form-properties.php'
11
- );
12
 
13
 
14
  add_action( 'wpcf7_init', 'wpcf7_sendinblue_register_service', 1, 0 );
1
  <?php
2
 
3
+ wpcf7_include_module_file( 'sendinblue/service.php' );
4
+ wpcf7_include_module_file( 'sendinblue/contact-form-properties.php' );
 
 
 
 
 
 
 
5
 
6
 
7
  add_action( 'wpcf7_init', 'wpcf7_sendinblue_register_service', 1, 0 );
modules/stripe/stripe.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
- include_once path_join( WPCF7_PLUGIN_MODULES_DIR, 'stripe/service.php' );
4
- include_once path_join( WPCF7_PLUGIN_MODULES_DIR, 'stripe/api.php' );
5
 
6
 
7
  add_action(
@@ -213,7 +213,7 @@ add_filter(
213
  /**
214
  * Registers the [_stripe_payment_link] special mail-tag.
215
  */
216
- function wpcf7_stripe_smt( $output, $tag_name, $html, $mail_tag ) {
217
  if ( '_stripe_payment_link' === $tag_name ) {
218
  $submission = WPCF7_Submission::get_instance();
219
 
1
  <?php
2
 
3
+ wpcf7_include_module_file( 'stripe/service.php' );
4
+ wpcf7_include_module_file( 'stripe/api.php' );
5
 
6
 
7
  add_action(
213
  /**
214
  * Registers the [_stripe_payment_link] special mail-tag.
215
  */
216
+ function wpcf7_stripe_smt( $output, $tag_name, $html, $mail_tag = null ) {
217
  if ( '_stripe_payment_link' === $tag_name ) {
218
  $submission = WPCF7_Submission::get_instance();
219
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 5.7
6
  Tested up to: 5.8
7
- Stable tag: 5.5.2
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,10 @@ Do you have questions or issues with Contact Form 7? Use these support channels
77
 
78
  For more information, see [Releases](https://contactform7.com/category/releases/).
79
 
 
 
 
 
80
  = 5.5.2 =
81
 
82
  * REST API: Removes argument schema reference that causes error when the form has 'id' field.
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 5.7
6
  Tested up to: 5.8
7
+ Stable tag: 5.5.3
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  For more information, see [Releases](https://contactform7.com/category/releases/).
79
 
80
+ = 5.5.3 =
81
+
82
+ [https://contactform7.com/contact-form-7-553/](https://contactform7.com/contact-form-7-553/)
83
+
84
  = 5.5.2 =
85
 
86
  * REST API: Removes argument schema reference that causes error when the form has 'id' field.
wp-contact-form-7.php CHANGED
@@ -7,10 +7,10 @@ Author: Takayuki Miyoshi
7
  Author URI: https://ideasilo.wordpress.com/
8
  Text Domain: contact-form-7
9
  Domain Path: /languages/
10
- Version: 5.5.2
11
  */
12
 
13
- define( 'WPCF7_VERSION', '5.5.2' );
14
 
15
  define( 'WPCF7_REQUIRED_WP_VERSION', '5.7' );
16
 
7
  Author URI: https://ideasilo.wordpress.com/
8
  Text Domain: contact-form-7
9
  Domain Path: /languages/
10
+ Version: 5.5.3
11
  */
12
 
13
+ define( 'WPCF7_VERSION', '5.5.3' );
14
 
15
  define( 'WPCF7_REQUIRED_WP_VERSION', '5.7' );
16