Constant Contact Forms - Version 1.8.1

Version Description

  • Fixed: Google reCAPTCHA issues with jQuery dependencies.
  • Fixed: Google reCAPTCHA undefined class errors when allow_url_fopen is disabled.
  • Fixed: Array to string errors when API errors occurred.
Download this release

Release Info

Developer constantcontact
Plugin Icon 128x128 Constant Contact Forms
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8.0 to 1.8.1

constant-contact-forms.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Constant Contact Forms for WordPress
13
  * Plugin URI: https://www.constantcontact.com
14
  * Description: Be a better marketer. All it takes is Constant Contact email marketing.
15
- * Version: 1.8.0
16
  * Author: Constant Contact
17
  * Author URI: https://www.constantcontact.com/index?pn=miwordpress
18
  * License: GPLv3
@@ -72,7 +72,7 @@ class Constant_Contact {
72
  * @since 1.0.0
73
  * @var string
74
  */
75
- const VERSION = '1.8.0';
76
 
77
  /**
78
  * URL of plugin directory.
12
  * Plugin Name: Constant Contact Forms for WordPress
13
  * Plugin URI: https://www.constantcontact.com
14
  * Description: Be a better marketer. All it takes is Constant Contact email marketing.
15
+ * Version: 1.8.1
16
  * Author: Constant Contact
17
  * Author URI: https://www.constantcontact.com/index?pn=miwordpress
18
  * License: GPLv3
72
  * @since 1.0.0
73
  * @var string
74
  */
75
+ const VERSION = '1.8.1';
76
 
77
  /**
78
  * URL of plugin directory.
includes/class-api.php CHANGED
@@ -128,19 +128,21 @@ class ConstantContact_API {
128
  }
129
  } catch ( CtctException $ex ) {
130
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
131
- $this->log_errors( $extra . $ex->getErrors() );
 
 
132
  constant_contact_set_has_exceptions();
133
  } catch ( Exception $ex ) {
134
  $error = new stdClass();
135
  $error->error_key = get_class( $ex );
136
  $error->error_message = $ex->getMessage();
137
- $messages[] = $error;
138
 
139
  add_filter( 'constant_contact_force_logging', '__return_true' );
140
  constant_contact_set_has_exceptions();
141
 
142
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
143
- $this->log_errors( $extra . $messages );
 
144
  }
145
  }
146
 
@@ -170,19 +172,21 @@ class ConstantContact_API {
170
 
171
  } catch ( CtctException $ex ) {
172
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
173
- $this->log_errors( $extra . $ex->getErrors() );
 
 
174
  constant_contact_set_has_exceptions();
175
  } catch ( Exception $ex ) {
176
  $error = new stdClass();
177
  $error->error_key = get_class( $ex );
178
  $error->error_message = $ex->getMessage();
179
- $messages[] = $error;
180
 
181
  add_filter( 'constant_contact_force_logging', '__return_true' );
182
  constant_contact_set_has_exceptions();
183
 
184
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
185
- $this->log_errors( $extra . $messages );
 
186
  }
187
  }
188
 
@@ -220,19 +224,21 @@ class ConstantContact_API {
220
  }
221
  } catch ( CtctException $ex ) {
222
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
223
- $this->log_errors( $extra . $ex->getErrors() );
 
 
224
  constant_contact_set_has_exceptions();
225
  } catch ( Exception $ex ) {
226
  $error = new stdClass();
227
  $error->error_key = get_class( $ex );
228
  $error->error_message = $ex->getMessage();
229
- $messages[] = $error;
230
 
231
  add_filter( 'constant_contact_force_logging', '__return_true' );
232
  constant_contact_set_has_exceptions();
233
 
234
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
235
- $this->log_errors( $extra . $messages );
 
236
  }
237
  }
238
 
@@ -268,19 +274,21 @@ class ConstantContact_API {
268
  return $list;
269
  } catch ( CtctException $ex ) {
270
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
271
- $this->log_errors( $extra . $ex->getErrors() );
 
 
272
  constant_contact_set_has_exceptions();
273
  } catch ( Exception $ex ) {
274
  $error = new stdClass();
275
  $error->error_key = get_class( $ex );
276
  $error->error_message = $ex->getMessage();
277
- $messages[] = $error;
278
 
279
  add_filter( 'constant_contact_force_logging', '__return_true' );
280
  constant_contact_set_has_exceptions();
281
 
282
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
283
- $this->log_errors( $extra . $messages );
 
284
  }
285
  }
286
 
@@ -308,19 +316,21 @@ class ConstantContact_API {
308
  $list = $this->cc()->listService->getList( $this->get_api_token(), esc_attr( $new_list['id'] ) );
309
  } catch ( CtctException $ex ) {
310
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
311
- $this->log_errors( $extra . $ex->getErrors() );
 
 
312
  constant_contact_set_has_exceptions();
313
  } catch ( Exception $ex ) {
314
  $error = new stdClass();
315
  $error->error_key = get_class( $ex );
316
  $error->error_message = $ex->getMessage();
317
- $messages[] = $error;
318
 
319
  add_filter( 'constant_contact_force_logging', '__return_true' );
320
  constant_contact_set_has_exceptions();
321
 
322
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
323
- $this->log_errors( $extra . $messages );
 
324
  }
325
 
326
  if ( isset( $list ) ) {
@@ -346,19 +356,21 @@ class ConstantContact_API {
346
 
347
  } catch ( CtctException $ex ) {
348
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
349
- $this->log_errors( $extra . $ex->getErrors() );
 
 
350
  constant_contact_set_has_exceptions();
351
  } catch ( Exception $ex ) {
352
  $error = new stdClass();
353
  $error->error_key = get_class( $ex );
354
  $error->error_message = $ex->getMessage();
355
- $messages[] = $error;
356
 
357
  add_filter( 'constant_contact_force_logging', '__return_true' );
358
  constant_contact_set_has_exceptions();
359
 
360
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
361
- $this->log_errors( $extra . $messages );
 
362
  }
363
 
364
  return $return_list;
@@ -396,19 +408,21 @@ class ConstantContact_API {
396
 
397
  } catch ( CtctException $ex ) {
398
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
399
- $this->log_errors( $extra . $ex->getErrors() );
 
 
400
  constant_contact_set_has_exceptions();
401
  } catch ( Exception $ex ) {
402
  $error = new stdClass();
403
  $error->error_key = get_class( $ex );
404
  $error->error_message = $ex->getMessage();
405
- $messages[] = $error;
406
 
407
  add_filter( 'constant_contact_force_logging', '__return_true' );
408
  constant_contact_set_has_exceptions();
409
 
410
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
411
- $this->log_errors( $extra . $messages );
 
412
  }
413
 
414
  return $return_list;
@@ -434,19 +448,21 @@ class ConstantContact_API {
434
  $list = $this->cc()->listService->deleteList( $this->get_api_token(), $updated_list['id'] );
435
  } catch ( CtctException $ex ) {
436
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
437
- $this->log_errors( $extra . $ex->getErrors() );
 
 
438
  constant_contact_set_has_exceptions();
439
  } catch ( Exception $ex ) {
440
  $error = new stdClass();
441
  $error->error_key = get_class( $ex );
442
  $error->error_message = $ex->getMessage();
443
- $messages[] = $error;
444
 
445
  add_filter( 'constant_contact_force_logging', '__return_true' );
446
  constant_contact_set_has_exceptions();
447
 
448
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
449
- $this->log_errors( $extra . $messages );
 
450
  }
451
 
452
  return $list;
@@ -495,7 +511,9 @@ class ConstantContact_API {
495
  }
496
  } catch ( CtctException $ex ) {
497
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
498
- $this->log_errors( $extra . $ex->getErrors() );
 
 
499
  if ( 400 !== $ex->getCode() || false !== strpos( 'Bad Request', $ex->getMessage() ) ) {
500
  constant_contact_set_has_exceptions();
501
  }
@@ -503,15 +521,15 @@ class ConstantContact_API {
503
  $error = new stdClass();
504
  $error->error_key = get_class( $ex );
505
  $error->error_message = $ex->getMessage();
506
- $messages[] = $error;
507
 
508
  add_filter( 'constant_contact_force_logging', '__return_true' );
509
  if ( 400 !== $ex->getCode() || false !== strpos( 'Bad Request', $ex->getMessage() ) ) {
510
  constant_contact_set_has_exceptions();
511
  }
512
 
513
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
514
- $this->log_errors( $extra . $messages );
 
515
  }
516
 
517
  $new_contact = $this->clear_email( $new_contact );
@@ -566,19 +584,21 @@ class ConstantContact_API {
566
  $contact = $this->set_contact_properties( $contact, $user_data, $form_id );
567
  } catch ( CtctException $ex ) {
568
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
569
- $this->log_errors( $extra . $ex->getErrors() );
 
 
570
  constant_contact_set_has_exceptions();
571
  } catch ( Exception $ex ) {
572
  $error = new stdClass();
573
  $error->error_key = get_class( $ex );
574
  $error->error_message = $ex->getMessage();
575
- $messages[] = $error;
576
 
577
  add_filter( 'constant_contact_force_logging', '__return_true' );
578
  constant_contact_set_has_exceptions();
579
 
580
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
581
- $this->log_errors( $extra . $messages );
 
582
  }
583
 
584
  /*
@@ -622,19 +642,21 @@ class ConstantContact_API {
622
  $contact = $this->set_contact_properties( $contact, $user_data, $form_id, true );
623
  } catch ( CtctException $ex ) {
624
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
625
- $this->log_errors( $extra . $ex->getErrors() );
 
 
626
  constant_contact_set_has_exceptions();
627
  } catch ( Exception $ex ) {
628
  $error = new stdClass();
629
  $error->error_key = get_class( $ex );
630
  $error->error_message = $ex->getMessage();
631
- $messages[] = $error;
632
 
633
  add_filter( 'constant_contact_force_logging', '__return_true' );
634
  constant_contact_set_has_exceptions();
635
 
636
- $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
637
- $this->log_errors( $extra . $messages );
 
638
  }
639
 
640
  /*
128
  }
129
  } catch ( CtctException $ex ) {
130
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
131
+ $errors = $ex->getErrors();
132
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
133
+ $this->log_errors( $our_errors );
134
  constant_contact_set_has_exceptions();
135
  } catch ( Exception $ex ) {
136
  $error = new stdClass();
137
  $error->error_key = get_class( $ex );
138
  $error->error_message = $ex->getMessage();
 
139
 
140
  add_filter( 'constant_contact_force_logging', '__return_true' );
141
  constant_contact_set_has_exceptions();
142
 
143
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
144
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
145
+ $this->log_errors( $our_errors );
146
  }
147
  }
148
 
172
 
173
  } catch ( CtctException $ex ) {
174
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
175
+ $errors = $ex->getErrors();
176
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
177
+ $this->log_errors( $our_errors );
178
  constant_contact_set_has_exceptions();
179
  } catch ( Exception $ex ) {
180
  $error = new stdClass();
181
  $error->error_key = get_class( $ex );
182
  $error->error_message = $ex->getMessage();
 
183
 
184
  add_filter( 'constant_contact_force_logging', '__return_true' );
185
  constant_contact_set_has_exceptions();
186
 
187
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
188
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
189
+ $this->log_errors( $our_errors );
190
  }
191
  }
192
 
224
  }
225
  } catch ( CtctException $ex ) {
226
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
227
+ $errors = $ex->getErrors();
228
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
229
+ $this->log_errors( $our_errors );
230
  constant_contact_set_has_exceptions();
231
  } catch ( Exception $ex ) {
232
  $error = new stdClass();
233
  $error->error_key = get_class( $ex );
234
  $error->error_message = $ex->getMessage();
 
235
 
236
  add_filter( 'constant_contact_force_logging', '__return_true' );
237
  constant_contact_set_has_exceptions();
238
 
239
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
240
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
241
+ $this->log_errors( $our_errors );
242
  }
243
  }
244
 
274
  return $list;
275
  } catch ( CtctException $ex ) {
276
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
277
+ $errors = $ex->getErrors();
278
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
279
+ $this->log_errors( $our_errors );
280
  constant_contact_set_has_exceptions();
281
  } catch ( Exception $ex ) {
282
  $error = new stdClass();
283
  $error->error_key = get_class( $ex );
284
  $error->error_message = $ex->getMessage();
 
285
 
286
  add_filter( 'constant_contact_force_logging', '__return_true' );
287
  constant_contact_set_has_exceptions();
288
 
289
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
290
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
291
+ $this->log_errors( $our_errors );
292
  }
293
  }
294
 
316
  $list = $this->cc()->listService->getList( $this->get_api_token(), esc_attr( $new_list['id'] ) );
317
  } catch ( CtctException $ex ) {
318
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
319
+ $errors = $ex->getErrors();
320
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
321
+ $this->log_errors( $our_errors );
322
  constant_contact_set_has_exceptions();
323
  } catch ( Exception $ex ) {
324
  $error = new stdClass();
325
  $error->error_key = get_class( $ex );
326
  $error->error_message = $ex->getMessage();
 
327
 
328
  add_filter( 'constant_contact_force_logging', '__return_true' );
329
  constant_contact_set_has_exceptions();
330
 
331
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
332
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
333
+ $this->log_errors( $our_errors );
334
  }
335
 
336
  if ( isset( $list ) ) {
356
 
357
  } catch ( CtctException $ex ) {
358
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
359
+ $errors = $ex->getErrors();
360
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
361
+ $this->log_errors( $our_errors );
362
  constant_contact_set_has_exceptions();
363
  } catch ( Exception $ex ) {
364
  $error = new stdClass();
365
  $error->error_key = get_class( $ex );
366
  $error->error_message = $ex->getMessage();
 
367
 
368
  add_filter( 'constant_contact_force_logging', '__return_true' );
369
  constant_contact_set_has_exceptions();
370
 
371
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
372
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
373
+ $this->log_errors( $our_errors );
374
  }
375
 
376
  return $return_list;
408
 
409
  } catch ( CtctException $ex ) {
410
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
411
+ $errors = $ex->getErrors();
412
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
413
+ $this->log_errors( $our_errors );
414
  constant_contact_set_has_exceptions();
415
  } catch ( Exception $ex ) {
416
  $error = new stdClass();
417
  $error->error_key = get_class( $ex );
418
  $error->error_message = $ex->getMessage();
 
419
 
420
  add_filter( 'constant_contact_force_logging', '__return_true' );
421
  constant_contact_set_has_exceptions();
422
 
423
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
424
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
425
+ $this->log_errors( $our_errors );
426
  }
427
 
428
  return $return_list;
448
  $list = $this->cc()->listService->deleteList( $this->get_api_token(), $updated_list['id'] );
449
  } catch ( CtctException $ex ) {
450
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
451
+ $errors = $ex->getErrors();
452
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
453
+ $this->log_errors( $our_errors );
454
  constant_contact_set_has_exceptions();
455
  } catch ( Exception $ex ) {
456
  $error = new stdClass();
457
  $error->error_key = get_class( $ex );
458
  $error->error_message = $ex->getMessage();
 
459
 
460
  add_filter( 'constant_contact_force_logging', '__return_true' );
461
  constant_contact_set_has_exceptions();
462
 
463
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
464
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
465
+ $this->log_errors( $our_errors );
466
  }
467
 
468
  return $list;
511
  }
512
  } catch ( CtctException $ex ) {
513
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
514
+ $errors = $ex->getErrors();
515
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
516
+ $this->log_errors( $our_errors );
517
  if ( 400 !== $ex->getCode() || false !== strpos( 'Bad Request', $ex->getMessage() ) ) {
518
  constant_contact_set_has_exceptions();
519
  }
521
  $error = new stdClass();
522
  $error->error_key = get_class( $ex );
523
  $error->error_message = $ex->getMessage();
 
524
 
525
  add_filter( 'constant_contact_force_logging', '__return_true' );
526
  if ( 400 !== $ex->getCode() || false !== strpos( 'Bad Request', $ex->getMessage() ) ) {
527
  constant_contact_set_has_exceptions();
528
  }
529
 
530
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
531
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
532
+ $this->log_errors( $our_errors );
533
  }
534
 
535
  $new_contact = $this->clear_email( $new_contact );
584
  $contact = $this->set_contact_properties( $contact, $user_data, $form_id );
585
  } catch ( CtctException $ex ) {
586
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
587
+ $errors = $ex->getErrors();
588
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
589
+ $this->log_errors( $our_errors );
590
  constant_contact_set_has_exceptions();
591
  } catch ( Exception $ex ) {
592
  $error = new stdClass();
593
  $error->error_key = get_class( $ex );
594
  $error->error_message = $ex->getMessage();
 
595
 
596
  add_filter( 'constant_contact_force_logging', '__return_true' );
597
  constant_contact_set_has_exceptions();
598
 
599
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
600
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
601
+ $this->log_errors( $our_errors );
602
  }
603
 
604
  /*
642
  $contact = $this->set_contact_properties( $contact, $user_data, $form_id, true );
643
  } catch ( CtctException $ex ) {
644
  $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
645
+ $errors = $ex->getErrors();
646
+ $our_errors[] = $extra . ' - ' . $errors[0]->error_key . ' - ' . $errors[0]->error_message;
647
+ $this->log_errors( $our_errors );
648
  constant_contact_set_has_exceptions();
649
  } catch ( Exception $ex ) {
650
  $error = new stdClass();
651
  $error->error_key = get_class( $ex );
652
  $error->error_message = $ex->getMessage();
 
653
 
654
  add_filter( 'constant_contact_force_logging', '__return_true' );
655
  constant_contact_set_has_exceptions();
656
 
657
+ $extra = constant_contact_location_and_line( __METHOD__, __LINE__ );
658
+ $our_errors[] = $extra . ' - ' . $error->error_key . ' - ' . $error->error_message;
659
+ $this->log_errors( $our_errors );
660
  }
661
 
662
  /*
includes/class-process-form.php CHANGED
@@ -11,6 +11,7 @@
11
  */
12
 
13
  use \ReCaptcha\ReCaptcha;
 
14
 
15
  /**
16
  * Powers our form processing, validation, and value cleanup.
@@ -201,7 +202,7 @@ class ConstantContact_Process_Form {
201
  if ( isset( $data['g-recaptcha-response'] ) ) {
202
  $method = null;
203
  if ( ! ini_get( 'allow_url_fopen' ) ) {
204
- $method = new ReCaptcha\RequestMethod\CurlPost();
205
  }
206
  $ctctrecaptcha = new ConstantContact_reCAPTCHA();
207
  $ctctrecaptcha->set_recaptcha_keys();
11
  */
12
 
13
  use \ReCaptcha\ReCaptcha;
14
+ use \ReCaptcha\RequestMethod\CurlPost;
15
 
16
  /**
17
  * Powers our form processing, validation, and value cleanup.
202
  if ( isset( $data['g-recaptcha-response'] ) ) {
203
  $method = null;
204
  if ( ! ini_get( 'allow_url_fopen' ) ) {
205
+ $method = new CurlPost();
206
  }
207
  $ctctrecaptcha = new ConstantContact_reCAPTCHA();
208
  $ctctrecaptcha->set_recaptcha_keys();
includes/class-recaptcha-v2.php CHANGED
@@ -34,7 +34,7 @@ class ConstantContact_reCAPTCHA_v2 extends ConstantContact_reCAPTCHA {
34
  * @return string
35
  */
36
  public function enqueue_scripts() {
37
- wp_add_inline_script( 'jquery', 'function ctctEnableBtn(){ jQuery( "#ctct-submitted" ).attr( "disabled", false ); }function ctctDisableBtn(){ jQuery( "#ctct-submitted" ).attr( "disabled", "disabled" ); }' );
38
  }
39
 
40
  /**
34
  * @return string
35
  */
36
  public function enqueue_scripts() {
37
+ wp_add_inline_script( 'ctct_frontend_forms', 'function ctctEnableBtn(){ jQuery( "#ctct-submitted" ).attr( "disabled", false ); }function ctctDisableBtn(){ jQuery( "#ctct-submitted" ).attr( "disabled", "disabled" ); }' );
38
  }
39
 
40
  /**
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: constantcontact, webdevstudios, tw2113, znowebdev, ggwicz, ra
3
  Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
4
  Requires at least: 5.2.0
5
  Tested up to: 5.3.2
6
- Stable tag: 1.8.0
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
  Requires PHP: 5.6
@@ -35,6 +35,11 @@ BONUS: If you have a Constant Contact account, all new email addresses that you
35
 
36
  == Changelog ==
37
 
 
 
 
 
 
38
  = 1.8.0 =
39
  * Added: Form and field IDs parameters to the `constant_contact_input_classes` filters.
40
  * Added: Site owners will be notified if they have stray shortcodes or widgets using a newly deleted form.
3
  Tags: capture, contacts, constant contact, constant contact form, constant contact newsletter, constant contact official, contact forms, email, form, forms, marketing, mobile, newsletter, opt-in, plugin, signup, subscribe, subscription, widget
4
  Requires at least: 5.2.0
5
  Tested up to: 5.3.2
6
+ Stable tag: 1.8.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
  Requires PHP: 5.6
35
 
36
  == Changelog ==
37
 
38
+ = 1.8.1 =
39
+ * Fixed: Google reCAPTCHA issues with jQuery dependencies.
40
+ * Fixed: Google reCAPTCHA undefined class errors when `allow_url_fopen` is disabled.
41
+ * Fixed: Array to string errors when API errors occurred.
42
+
43
  = 1.8.0 =
44
  * Added: Form and field IDs parameters to the `constant_contact_input_classes` filters.
45
  * Added: Site owners will be notified if they have stray shortcodes or widgets using a newly deleted form.
tests/bin/install-wp-tests.sh DELETED
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [ $# -lt 3 ]; then
4
- echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]"
5
- exit 1
6
- fi
7
-
8
- DB_NAME=$1
9
- DB_USER=$2
10
- DB_PASS=$3
11
- DB_HOST=${4-localhost}
12
- WP_VERSION=${5-latest}
13
- SKIP_DB_CREATE=${6-false}
14
-
15
- WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
16
- WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
17
-
18
- download() {
19
- if [ `which curl` ]; then
20
- curl -s "$1" > "$2";
21
- elif [ `which wget` ]; then
22
- wget -nv -O "$2" "$1"
23
- fi
24
- }
25
-
26
- if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
27
- WP_TESTS_TAG="tags/$WP_VERSION"
28
- else
29
- # http serves a single offer, whereas https serves multiple. we only want one
30
- download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
31
- grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
32
- LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
33
- if [[ -z "$LATEST_VERSION" ]]; then
34
- echo "Latest WordPress version could not be found"
35
- exit 1
36
- fi
37
- WP_TESTS_TAG="tags/$LATEST_VERSION"
38
- fi
39
-
40
- set -ex
41
-
42
- install_wp() {
43
-
44
- if [ -d $WP_CORE_DIR ]; then
45
- return;
46
- fi
47
-
48
- mkdir -p $WP_CORE_DIR
49
-
50
- if [ $WP_VERSION == 'latest' ]; then
51
- local ARCHIVE_NAME='latest'
52
- else
53
- local ARCHIVE_NAME="wordpress-$WP_VERSION"
54
- fi
55
-
56
- download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
57
- tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
58
-
59
- download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
60
- }
61
-
62
- install_test_suite() {
63
- # portable in-place argument for both GNU sed and Mac OSX sed
64
- if [[ $(uname -s) == 'Darwin' ]]; then
65
- local ioption='-i .bak'
66
- else
67
- local ioption='-i'
68
- fi
69
-
70
- # set up testing suite if it doesn't yet exist
71
- if [ ! -d $WP_TESTS_DIR ]; then
72
- # set up testing suite
73
- mkdir -p $WP_TESTS_DIR
74
- svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
75
- fi
76
-
77
- if [ ! -f wp-tests-config.php ]; then
78
- download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
79
- # remove all forward slashes in the end
80
- WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")
81
- sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR/':" "$WP_TESTS_DIR"/wp-tests-config.php
82
- sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
83
- sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
84
- sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
85
- sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
86
- fi
87
-
88
- }
89
-
90
- install_db() {
91
- # parse DB_HOST for port or socket references
92
- local PARTS=(${DB_HOST//\:/ })
93
- local DB_HOSTNAME=${PARTS[0]};
94
- local DB_SOCK_OR_PORT=${PARTS[1]};
95
- local EXTRA=""
96
-
97
- if ! [ -z $DB_HOSTNAME ] ; then
98
- if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
99
- EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
100
- elif ! [ -z $DB_SOCK_OR_PORT ] ; then
101
- EXTRA=" --socket=$DB_SOCK_OR_PORT"
102
- elif ! [ -z $DB_HOSTNAME ] ; then
103
- EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
104
- fi
105
- fi
106
-
107
- # create database
108
- mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
109
- }
110
-
111
- install_wp
112
- install_test_suite
113
- install_db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/bootstrap.php DELETED
@@ -1,39 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Boostrap
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- /**
10
- * Bootstrap the plugin unit testing environment.
11
- *
12
- * Edit 'active_plugins' setting below to point to your main plugin file.
13
- *
14
- * @package wordpress-plugin-tests
15
- */
16
-
17
- // Support for:
18
- // 1. `WP_DEVELOP_DIR` environment variable
19
- // 2. Plugin installed inside of WordPress.org developer checkout
20
- // 3. Tests checked out to /tmp
21
-
22
- if ( false !== getenv( 'WP_DEVELOP_DIR' ) ) {
23
- $test_root = getenv( 'WP_DEVELOP_DIR' );
24
- } elseif ( false !== getenv( 'WP_TESTS_DIR' ) ) {
25
- $test_root = getenv( 'WP_TESTS_DIR' );
26
- } elseif ( file_exists( '../../../../tests/phpunit/includes/bootstrap.php' ) ) {
27
- $test_root = '../../../../tests/phpunit';
28
- } elseif ( file_exists( '/tmp/wordpress-tests-lib/includes/bootstrap.php' ) ) {
29
- $test_root = '/tmp/wordpress-tests-lib';
30
- }
31
- require_once $test_root . '/includes/functions.php';
32
-
33
- function _test_constant_contact_manually_load_plugin() {
34
- require dirname( dirname( __FILE__ ) ) . '/constant-contact-forms.php';
35
- }
36
-
37
- tests_add_filter( 'muplugins_loaded', '_test_constant_contact_manually_load_plugin' );
38
-
39
- require $test_root . '/includes/bootstrap.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-admin-pages.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage AdminPages
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Admin_Pages_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Admin_Pages' ) );
13
- }
14
-
15
- function test_class_access() {
16
-
17
- $this->assertTrue( constant_contact()->admin_pages instanceof ConstantContact_Admin_Pages );
18
- }
19
-
20
- function test_sample() {
21
- // replace this with some actual testing code
22
- $this->assertTrue( true );
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-admin.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Admin
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Admin_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Admin' ) );
13
- }
14
-
15
- function test_class_access() {
16
-
17
- $this->assertTrue( constant_contact()->admin instanceof ConstantContact_Admin );
18
- }
19
-
20
- function test_sample() {
21
- // replace this with some actual testing code
22
- $this->assertTrue( true );
23
- }
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-api.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage API
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_API_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_API' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->api instanceof ConstantContact_API );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-auth-redirect.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage AuthRedirect
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Auth_Redirect_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Auth_Redirect' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->auth_redirect instanceof ConstantContact_Auth_Redirect );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-base.php DELETED
@@ -1,63 +0,0 @@
1
- <?php
2
- /**
3
- * Tests the Constant_Contact base class.
4
- *
5
- * @package ConstantContact
6
- * @subpackage Display
7
- * @since 1.6.0
8
- *
9
- * phpcs:disable WebDevStudios.All.RequireAuthor -- Don't require author tag in docblocks.
10
- */
11
-
12
- /**
13
- * Tests the Constant_Contact base class.
14
- *
15
- * @since 1.6.0
16
- */
17
- class BaseTest extends WP_UnitTestCase {
18
-
19
- /**
20
- * Set up.
21
- *
22
- * @since 1.6.0
23
- */
24
- public function setUp() {
25
- parent::setUp();
26
- $this->plugin = constant_contact();
27
- }
28
-
29
- /**
30
- * Should map classes to base class properties.
31
- *
32
- * @since 1.6.0
33
- *
34
- * @test
35
- */
36
- public function should_map_classes_to_base_class_properties() {
37
- $this->assertInstanceOf( ConstantContact_API::class, $this->plugin->api );
38
- $this->assertInstanceOf( ConstantContact_Builder::class, $this->plugin->builder );
39
- $this->assertInstanceOf( ConstantContact_Builder_Fields::class, $this->plugin->builder_fields );
40
- $this->assertInstanceOf( ConstantContact_Check::class, $this->plugin->check );
41
- $this->assertInstanceOf( ConstantContact_CPTS::class, $this->plugin->cpts );
42
- $this->assertInstanceOf( ConstantContact_Display::class, $this->plugin->display );
43
- $this->assertInstanceOf( ConstantContact_Shortcode::class, $this->plugin->shortcode );
44
- $this->assertInstanceOf( ConstantContact_Display_Shortcode::class, $this->plugin->display_shortcode );
45
- $this->assertInstanceOf( ConstantContact_Lists::class, $this->plugin->lists );
46
- $this->assertInstanceOf( ConstantContact_Process_Form::class, $this->plugin->process_form );
47
- $this->assertInstanceOf( ConstantContact_Settings::class, $this->plugin->settings );
48
- $this->assertInstanceOf( ConstantContact_Auth_Redirect::class, $this->plugin->auth_redirect );
49
- $this->assertInstanceOf( ConstantContact_Connect::class, $this->plugin->connect );
50
- $this->assertInstanceOf( ConstantContact_Mail::class, $this->plugin->mail );
51
- $this->assertInstanceOf( ConstantContact_Notifications::class, $this->plugin->notifications );
52
- $this->assertInstanceOf( ConstantContact_Notification_Content::class, $this->plugin->notification_content );
53
- $this->assertInstanceOf( ConstantContact_Middleware::class, $this->plugin->authserver );
54
- $this->assertInstanceOf( ConstantContact_Updates::class, $this->plugin->updates );
55
- $this->assertInstanceOf( ConstantContact_Optin::class, $this->plugin->optin );
56
- $this->assertInstanceOf( ConstantContact_Logging::class, $this->plugin->logging );
57
- $this->assertInstanceOf( ConstantContact_User_Customizations::class, $this->plugin->customizations );
58
- $this->assertInstanceOf( ConstantContact_Admin::class, $this->plugin->admin );
59
- $this->assertInstanceOf( ConstantContact_Admin_Pages::class, $this->plugin->admin_pages );
60
- $this->assertInstanceOf( ConstantContact_Gutenberg::class, $this->plugin->gutenberg );
61
- }
62
-
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-builder-fields.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage BuilderFields
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Builder_Fields_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Builder_Fields' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->builder_fields instanceof ConstantContact_Builder_Fields );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-builder.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Builder
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Builder_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Builder' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->builder instanceof ConstantContact_Builder );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-check.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Check
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Check_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Check' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->check instanceof ConstantContact_Check );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-connect.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Connect
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Connect_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Connect' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->connect instanceof ConstantContact_Connect );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-cpts.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage CPTS
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_CPTS_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_CPTS' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->cpts instanceof ConstantContact_CPTS );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-display-shortcode.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage DisplayShortcode
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Display_Shortcode_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Display_Shortcode' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->display_shortcode instanceof ConstantContact_Display_Shortcode );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-display.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Display
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Display_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Display' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->display instanceof ConstantContact_Display );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-helper-functions.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage HelperFunctions
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Helper_Functions_Test extends WP_UnitTestCase {
10
-
11
- function test_functions_exist() {
12
- $this->assertTrue( function_exists( 'constant_contact_get_form' ) );
13
- $this->assertTrue( function_exists( 'constant_contact_display_form' ) );
14
- $this->assertTrue( function_exists( 'constant_contact_get_forms' ) );
15
- }
16
-
17
- function test_sample() {
18
- // replace this with some actual testing code
19
- $this->assertTrue( true );
20
- }
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-lists.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Lists
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Lists_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Lists' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->lists instanceof ConstantContact_Lists );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-mail.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Mail
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Mail_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Mail' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->mail instanceof ConstantContact_Mail );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-middleware.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Middleware
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Middleware_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Middleware' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->authserver instanceof ConstantContact_Middleware );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-notification-content.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage NotificationContent
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Notification_Content_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Notification_Content' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->notification_content instanceof ConstantContact_Notification_Content );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-notifications.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Notifications
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Notifications_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Notifications' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->notifications instanceof ConstantContact_Notifications );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-process-form.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage ProcessForm
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Process_Form_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Process_Form' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->process_form instanceof ConstantContact_Process_Form );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-settings.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Settings
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Settings_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Settings' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->settings instanceof ConstantContact_Settings );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-shortcode.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
- /**
3
- * Tests the ConstantContact_Shortcode class.
4
- *
5
- * @package ConstantContact
6
- * @subpackage Display
7
- * @since 1.6.0
8
- *
9
- * phpcs:disable WebDevStudios.All.RequireAuthor -- Don't require author tag in docblocks.
10
- */
11
-
12
- /**
13
- * Tests the ConstantContact_Shortcode class.
14
- *
15
- * @since 1.6.0
16
- */
17
- class ConstantContact_Shortcode_Test extends WP_UnitTestCase {
18
-
19
- /**
20
- * Set up.
21
- *
22
- * @since 1.6.0
23
- */
24
- public function setUp() {
25
- parent::setUp();
26
- $this->plugin = constant_contact();
27
- }
28
-
29
- /**
30
- * Should get default shortcode atts values.
31
- *
32
- * @since 1.6.0
33
- *
34
- * @test
35
- */
36
- public function should_get_default_shortcode_atts_values() {
37
-
38
- $expected = [
39
- 'form' => '0',
40
- 'show_title' => 'false',
41
- ];
42
-
43
- $actual = $this->plugin->shortcode->get_atts();
44
-
45
- $this->assertEquals( $expected, $actual );
46
- }
47
-
48
- /**
49
- * Should get filtered shortcode atts values.
50
- *
51
- * @since 1.6.0
52
- *
53
- * @test
54
- */
55
- public function should_get_filtered_shortcode_atts_values() {
56
-
57
- // Ensure WP Core's 'shortcode_atts_{tag}' filter works to set att values and even add new atts.
58
- add_filter( 'shortcode_atts_ctct', function( $atts ) {
59
- $atts['form'] = '12';
60
- $atts['show_title'] = 'true';
61
- $atts['foo'] = 'bar';
62
-
63
- return $atts;
64
- } );
65
-
66
- $expected = [
67
- 'form' => '12',
68
- 'show_title' => 'true',
69
- 'foo' => 'bar',
70
- ];
71
-
72
- // Using an empty array here because we just want to know the filter-provided values are working.
73
- $actual = shortcode_atts( $this->plugin->shortcode->get_atts(), [], 'ctct' );
74
-
75
- $this->assertEquals( $expected, $actual );
76
- }
77
-
78
- /**
79
- * Should clear forms list transient on save post.
80
- *
81
- * @since 1.6.0
82
- *
83
- * @test
84
- */
85
- public function should_clear_forms_list_transient_on_save_post() {
86
- $test_post_id = $this->factory->post->create( [ 'post_content' => 'Hi here is the form: [ctct form="12" show_title="true"]' ] );
87
-
88
- set_transient( ConstantContact_Shortcode::FORMS_LIST_TRANSIENT, [ 'form1', 'form2' ], 1 * WEEK_IN_SECONDS );
89
-
90
- $forms_list = get_transient( ConstantContact_Shortcode::FORMS_LIST_TRANSIENT );
91
-
92
- // Multiple assertions in a method is bad, but we want to confirm the transient was set so that the next assertion is meaningful.
93
- $this->assertIsArray( $forms_list );
94
-
95
- // Trigger save_post.
96
- wp_update_post( [
97
- 'ID' => $test_post_id,
98
- 'post_title' => 'We are now updating the post to trigger save_post action.',
99
- ] );
100
-
101
- $should_be_false = get_transient( ConstantContact_Shortcode::FORMS_LIST_TRANSIENT );
102
-
103
- $this->assertFalse( $should_be_false );
104
- }
105
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test-updates.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- /**
3
- * @package ConstantContact_Tests
4
- * @subpackage Updates
5
- * @author Pluginize
6
- * @since 1.0.0
7
- */
8
-
9
- class ConstantContact_Updates_Test extends WP_UnitTestCase {
10
-
11
- function test_class_exists() {
12
- $this->assertTrue( class_exists( 'ConstantContact_Updates' ) );
13
- }
14
-
15
- function test_class_access() {
16
- $this->assertTrue( constant_contact()->updates instanceof ConstantContact_Updates );
17
- }
18
-
19
- function test_sample() {
20
- // replace this with some actual testing code
21
- $this->assertTrue( true );
22
- }
23
- }