Contact Form & SMTP Plugin for WordPress by PirateForms - Version 1.0.6

Version Description

Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Contact Form & SMTP Plugin for WordPress by PirateForms
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.5 to 1.0.6

Files changed (5) hide show
  1. css/wp-admin.css +27 -1
  2. inc/settings.php +165 -135
  3. mailin.php +939 -0
  4. pirate-forms.php +16 -15
  5. readme.txt +1 -1
css/wp-admin.css CHANGED
@@ -43,7 +43,7 @@
43
  border-bottom: 1px solid #ddd;
44
  border-right: 1px solid #ddd;
45
  border-left: 1px solid #ddd;
46
- width: 960px;
47
  float: left;
48
  }
49
  .pirate-forms-tab-content > .tab-pane {
@@ -84,4 +84,30 @@
84
  width: 30%;
85
  }
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  .ajaxAnimation { background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8); position: absolute;top: 0; left: 0; right: 0; bottom: 0; display: none;}
43
  border-bottom: 1px solid #ddd;
44
  border-right: 1px solid #ddd;
45
  border-left: 1px solid #ddd;
46
+ width: 860px;
47
  float: left;
48
  }
49
  .pirate-forms-tab-content > .tab-pane {
84
  width: 30%;
85
  }
86
 
87
+ .pirate-options{
88
+ display: inline-block;
89
+ }
90
+ .pirate-subscribe.postbox{
91
+ display: inline-block;
92
+ vertical-align: top;
93
+ margin: 20px;
94
+ margin-right: 0px;
95
+ margin-bottom: 0;
96
+ margin-top: 51px;
97
+ padding: 10px;
98
+ width: 250px;
99
+ }
100
+
101
+ .wrap{
102
+ margin-right: 0;
103
+ }
104
+
105
+ @media( max-width: 1360px){
106
+ .pirate-subscribe.postbox{
107
+ margin-left: 0;
108
+ margin-top: 20px;
109
+ display: block;
110
+ }
111
+ }
112
+
113
  .ajaxAnimation { background: url("../img/loader.gif") no-repeat center center, rgba(255,255,255,0.8); position: absolute;top: 0; left: 0; right: 0; bottom: 0; display: none;}
inc/settings.php CHANGED
@@ -4,7 +4,7 @@ function pirate_forms_is_localhost() {
4
  return in_array( $server_name, array( 'localhost', '127.0.0.1' ) );
5
  }
6
  function pirate_forms_from_email() {
7
-
8
  $admin_email = get_option( 'admin_email' );
9
  $sitename = strtolower( $_SERVER['SERVER_NAME'] );
10
 
@@ -22,7 +22,7 @@ function pirate_forms_from_email() {
22
 
23
  return 'wordpress@' . $sitename;
24
  }
25
-
26
  /*
27
  *
28
  * OPTIONS
@@ -77,7 +77,7 @@ function pirate_forms_plugin_options() {
77
  else:
78
  $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
79
  endif;
80
-
81
  return array(
82
  'fourth_tab' => array(
83
  'header_options' => array(
@@ -352,49 +352,49 @@ function pirate_forms_save_callback() {
352
  endif;
353
 
354
  if( !empty($params) ):
355
-
356
  update_option( 'pirate_forms_settings_array', $params );
357
-
358
  $pirate_forms_zerif_lite_mods = get_option('theme_mods_zerif-lite');
359
-
360
  if( empty($pirate_forms_zerif_lite_mods) ):
361
  $pirate_forms_zerif_lite_mods = array();
362
  endif;
363
-
364
  if( isset($params['pirateformsopt_label_submit_btn']) ):
365
  $pirate_forms_zerif_lite_mods['zerif_contactus_button_label'] = $params['pirateformsopt_label_submit_btn'];
366
- endif;
367
-
368
  if( isset($params['pirateformsopt_email']) ):
369
  $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email'];
370
  endif;
371
-
372
  if( isset($params['pirateformsopt_email_recipients']) ):
373
  $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email_recipients'];
374
- endif;
375
-
376
  if( isset($params['pirateformsopt_recaptcha_field']) && ($params['pirateformsopt_recaptcha_field'] == 'yes') ):
377
  $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 0;
378
  else:
379
  $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 1;
380
  endif;
381
-
382
  if( isset($params['pirateformsopt_recaptcha_sitekey']) ):
383
  $pirate_forms_zerif_lite_mods['zerif_contactus_sitekey'] = $params['pirateformsopt_recaptcha_sitekey'];
384
- endif;
385
-
386
  if( isset($params['pirateformsopt_recaptcha_secretkey']) ):
387
  $pirate_forms_zerif_lite_mods['zerif_contactus_secretkey'] = $params['pirateformsopt_recaptcha_secretkey'];
388
- endif;
389
-
390
  update_option('theme_mods_zerif-lite', $pirate_forms_zerif_lite_mods);
391
-
392
-
393
-
394
  endif;
395
 
396
  endif;
397
-
398
  die();
399
 
400
  }
@@ -418,158 +418,188 @@ function pirate_forms_admin() {
418
  <h1><?php esc_html_e( 'Pirate Forms','pirate-forms' ); ?></h1>
419
 
420
 
 
 
 
 
 
 
 
 
 
421
 
422
- <ul class="pirate-forms-nav-tabs" role="tablist">
423
- <li role="presentation" class="active"><a href="#0" aria-controls="how_to_use" role="tab" data-toggle="tab"><?php esc_html_e( 'How to use','pirate-forms'); ?></a></li>
424
- <li role="presentation"><a href="#1" aria-controls="options" role="tab" data-toggle="tab"><?php esc_html_e( 'Options','pirate-forms'); ?></a></li>
425
- <li role="presentation"><a href="#2" aria-controls="fields" role="tab" data-toggle="tab"><?php esc_html_e( 'Fields','pirate-forms'); ?></a></li>
426
- <li role="presentation"><a href="#3" aria-controls="labels" role="tab" data-toggle="tab"><?php esc_html_e( 'Labels','pirate-forms'); ?></a></li>
427
- <li role="presentation"><a href="#4" aria-controls="messages" role="tab" data-toggle="tab"><?php esc_html_e( 'Messages','pirate-forms'); ?></a></li>
428
- <li role="presentation"><a href="#5" aria-controls="smtp" role="tab" data-toggle="tab"><?php esc_html_e( 'SMTP','pirate-forms'); ?></a></li>
429
- </ul>
430
-
431
- <div class="pirate-forms-tab-content">
432
-
433
- <div id="0" class="pirate-forms-tab-pane active">
434
-
435
- <p><?php esc_html_e( 'Welcome to Pirate Forms!','pirate-forms' ); ?><p>
436
- <p><?php esc_html_e( 'To get started, just ','pirate-forms'); ?><b><?php esc_html_e( 'configure all the options ','pirate-forms'); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.','pirate-forms' ); ?><p>
437
 
438
- <hr>
439
 
440
- <p><?php esc_html_e( 'There are 3 ways of using the newly created form:','pirate-forms' ); ?><p>
441
- <p><?php esc_html_e( '1. Use the shortcode ','pirate-forms' ); ?><code>[pirate_forms] </code><?php esc_html_e( 'in any page or post.','pirate-forms' ); ?><p>
442
- <p><?php esc_html_e( '2. Add a ','pirate-forms' ); ?><a href="<?php echo admin_url( 'widgets.php' ); ?>"><?php esc_html_e( 'widget','pirate-forms' ); ?></a><p>
443
- <p><?php esc_html_e( '3. Use the shortcode ','pirate-forms' ); ?><code>&lt;?php echo do_shortcode( '[pirate_forms]' ) ?&gt;</code><?php esc_html_e( 'in the theme\'s files.','pirate-forms' ); ?><p>
444
 
445
- </div>
446
 
447
- <?php
 
 
 
448
 
449
- $pirate_forms_nr_tabs = 1;
450
 
451
- foreach ( $plugin_options as $plugin_options_tab ) :
452
 
453
- echo '<div id="'.$pirate_forms_nr_tabs.'" class="pirate-forms-tab-pane">';
454
 
455
- ?>
456
- <form method="post" class="pirate_forms_contact_settings">
457
 
458
- <?php
459
- $pirate_forms_nr_tabs++;
460
- foreach ( $plugin_options_tab as $key => $value ) :
461
 
462
- /* Label */
463
- if( !empty($value[0]) ):
464
- $opt_name = $value[0];
465
- endif;
466
 
467
- /* ID */
468
- $opt_id = $key;
 
469
 
470
- /* Description */
471
- if( !empty($value[1]) ):
472
- $opt_desc = $value[1];
473
- else:
474
- $opt_desc = '';
475
- endif;
476
 
477
- /* Input type */
478
- if( !empty($value[2]) ):
479
- $opt_type = $value[2];
480
- else:
481
- $opt_type = '';
482
- endif;
483
 
484
- /* Default value */
485
- if( !empty($value[3]) ):
486
- $opt_default = $value[3];
487
- else:
488
- $opt_default = '';
489
- endif;
490
 
491
- /* Value */
492
- $opt_val = isset( $pirate_forms_options[$opt_id] ) ? $pirate_forms_options[$opt_id] : $opt_default;
 
 
 
 
493
 
494
- /* Options if checkbox, select, or radio */
495
- $opt_options = empty( $value[4] ) ? array() : $value[4];
 
 
 
 
496
 
497
- switch ($opt_type) {
498
- case "title":
499
 
500
- if( !empty($opt_name) ):
501
- echo '<h3 class="title">'.$opt_name.'</h3><hr />';
502
- endif;
503
 
504
- break;
 
505
 
506
- case "text":
507
- ?>
 
508
 
509
- <div class="pirate-forms-grouped">
510
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
511
- <input name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>" type="<?php echo $opt_type; ?>" value="<?php echo stripslashes( $opt_val ); ?>" class="widefat">
512
- </div>
513
 
514
- <?php
515
- break;
516
- case "select":
517
- ?>
518
- <div class="pirate-forms-grouped">
519
 
520
- <label for="<?php echo $opt_id ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
521
-
522
- <select name="<?php echo $opt_id ?>" id="<?php echo $opt_id; ?>">
523
- <?php
524
- foreach ( $opt_options as $key => $val ) :
525
 
526
- $selected = '';
527
- if ( $opt_val == $key )
528
- $selected = 'selected';
529
- ?>
530
- <option value="<?php echo $key ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
531
- <?php endforeach; ?>
532
- </select>
533
 
 
534
 
535
- </div>
 
 
536
 
537
- <?php
538
- break;
539
- case "checkbox":
540
- ?>
541
- <div class="pirate-forms-grouped">
542
- <label for="<?php echo $opt_id; ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
 
543
 
544
- <?php
545
 
546
- $checked = '';
547
- if ( $opt_val == 'yes' )
548
- $checked = 'checked';
549
- ?>
550
 
551
- <input type="checkbox" value="yes" name="<?php echo $opt_id; ?>" id="<?php echo $opt_id; ?>" <?php echo $checked; ?>>Yes
 
 
 
 
 
552
 
553
- </div>
554
 
 
 
 
 
555
 
556
- <?php
557
- break;
558
- }
559
 
560
- endforeach;
561
- ?>
562
- <input name="save" type="submit" value="<?php _e( 'Save changes', 'pirate-forms' ) ?>" class="button-primary pirate-forms-save-button">
563
- <input type="hidden" name="action" value="save">
564
- <input type="hidden" name="proper_nonce" value="<?php echo wp_create_nonce( $current_user->user_email ) ?>">
565
 
566
- </form><!-- .pirate_forms_contact_settings -->
567
- <div class="ajaxAnimation"></div>
568
- </div><!-- .pirate-forms-tab-pane -->
569
 
570
- <?php endforeach; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
 
572
- </div><!-- .pirate-forms-tab-content -->
573
 
574
 
575
  </div><!-- .wrap -->
4
  return in_array( $server_name, array( 'localhost', '127.0.0.1' ) );
5
  }
6
  function pirate_forms_from_email() {
7
+
8
  $admin_email = get_option( 'admin_email' );
9
  $sitename = strtolower( $_SERVER['SERVER_NAME'] );
10
 
22
 
23
  return 'wordpress@' . $sitename;
24
  }
25
+
26
  /*
27
  *
28
  * OPTIONS
77
  else:
78
  $pirate_forms_contactus_email = get_bloginfo( 'admin_email' );
79
  endif;
80
+
81
  return array(
82
  'fourth_tab' => array(
83
  'header_options' => array(
352
  endif;
353
 
354
  if( !empty($params) ):
355
+
356
  update_option( 'pirate_forms_settings_array', $params );
357
+
358
  $pirate_forms_zerif_lite_mods = get_option('theme_mods_zerif-lite');
359
+
360
  if( empty($pirate_forms_zerif_lite_mods) ):
361
  $pirate_forms_zerif_lite_mods = array();
362
  endif;
363
+
364
  if( isset($params['pirateformsopt_label_submit_btn']) ):
365
  $pirate_forms_zerif_lite_mods['zerif_contactus_button_label'] = $params['pirateformsopt_label_submit_btn'];
366
+ endif;
367
+
368
  if( isset($params['pirateformsopt_email']) ):
369
  $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email'];
370
  endif;
371
+
372
  if( isset($params['pirateformsopt_email_recipients']) ):
373
  $pirate_forms_zerif_lite_mods['zerif_contactus_email'] = $params['pirateformsopt_email_recipients'];
374
+ endif;
375
+
376
  if( isset($params['pirateformsopt_recaptcha_field']) && ($params['pirateformsopt_recaptcha_field'] == 'yes') ):
377
  $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 0;
378
  else:
379
  $pirate_forms_zerif_lite_mods['zerif_contactus_recaptcha_show'] = 1;
380
  endif;
381
+
382
  if( isset($params['pirateformsopt_recaptcha_sitekey']) ):
383
  $pirate_forms_zerif_lite_mods['zerif_contactus_sitekey'] = $params['pirateformsopt_recaptcha_sitekey'];
384
+ endif;
385
+
386
  if( isset($params['pirateformsopt_recaptcha_secretkey']) ):
387
  $pirate_forms_zerif_lite_mods['zerif_contactus_secretkey'] = $params['pirateformsopt_recaptcha_secretkey'];
388
+ endif;
389
+
390
  update_option('theme_mods_zerif-lite', $pirate_forms_zerif_lite_mods);
391
+
392
+
393
+
394
  endif;
395
 
396
  endif;
397
+
398
  die();
399
 
400
  }
418
  <h1><?php esc_html_e( 'Pirate Forms','pirate-forms' ); ?></h1>
419
 
420
 
421
+ <div class="pirate-options">
422
+ <ul class="pirate-forms-nav-tabs" role="tablist">
423
+ <li role="presentation" class="active"><a href="#0" aria-controls="how_to_use" role="tab" data-toggle="tab"><?php esc_html_e( 'How to use','pirate-forms'); ?></a></li>
424
+ <li role="presentation"><a href="#1" aria-controls="options" role="tab" data-toggle="tab"><?php esc_html_e( 'Options','pirate-forms'); ?></a></li>
425
+ <li role="presentation"><a href="#2" aria-controls="fields" role="tab" data-toggle="tab"><?php esc_html_e( 'Fields','pirate-forms'); ?></a></li>
426
+ <li role="presentation"><a href="#3" aria-controls="labels" role="tab" data-toggle="tab"><?php esc_html_e( 'Labels','pirate-forms'); ?></a></li>
427
+ <li role="presentation"><a href="#4" aria-controls="messages" role="tab" data-toggle="tab"><?php esc_html_e( 'Messages','pirate-forms'); ?></a></li>
428
+ <li role="presentation"><a href="#5" aria-controls="smtp" role="tab" data-toggle="tab"><?php esc_html_e( 'SMTP','pirate-forms'); ?></a></li>
429
+ </ul>
430
 
431
+ <div class="pirate-forms-tab-content">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
 
433
+ <div id="0" class="pirate-forms-tab-pane active">
434
 
435
+ <p><?php esc_html_e( 'Welcome to Pirate Forms!','pirate-forms' ); ?><p>
436
+ <p><?php esc_html_e( 'To get started, just ','pirate-forms'); ?><b><?php esc_html_e( 'configure all the options ','pirate-forms'); ?></b><?php esc_html_e( 'you need, hit save and start using the created form.','pirate-forms' ); ?><p>
 
 
437
 
438
+ <hr>
439
 
440
+ <p><?php esc_html_e( 'There are 3 ways of using the newly created form:','pirate-forms' ); ?><p>
441
+ <p><?php esc_html_e( '1. Use the shortcode ','pirate-forms' ); ?><code>[pirate_forms] </code><?php esc_html_e( 'in any page or post.','pirate-forms' ); ?><p>
442
+ <p><?php esc_html_e( '2. Add a ','pirate-forms' ); ?><a href="<?php echo admin_url( 'widgets.php' ); ?>"><?php esc_html_e( 'widget','pirate-forms' ); ?></a><p>
443
+ <p><?php esc_html_e( '3. Use the shortcode ','pirate-forms' ); ?><code>&lt;?php echo do_shortcode( '[pirate_forms]' ) ?&gt;</code><?php esc_html_e( 'in the theme\'s files.','pirate-forms' ); ?><p>
444
 
445
+ </div>
446
 
447
+ <?php
448
 
449
+ $pirate_forms_nr_tabs = 1;
450
 
451
+ foreach ( $plugin_options as $plugin_options_tab ) :
 
452
 
453
+ echo '<div id="'.$pirate_forms_nr_tabs.'" class="pirate-forms-tab-pane">';
 
 
454
 
455
+ ?>
456
+ <form method="post" class="pirate_forms_contact_settings">
 
 
457
 
458
+ <?php
459
+ $pirate_forms_nr_tabs++;
460
+ foreach ( $plugin_options_tab as $key => $value ) :
461
 
462
+ /* Label */
463
+ if( !empty($value[0]) ):
464
+ $opt_name = $value[0];
465
+ endif;
 
 
466
 
467
+ /* ID */
468
+ $opt_id = $key;
 
 
 
 
469
 
470
+ /* Description */
471
+ if( !empty($value[1]) ):
472
+ $opt_desc = $value[1];
473
+ else:
474
+ $opt_desc = '';
475
+ endif;
476
 
477
+ /* Input type */
478
+ if( !empty($value[2]) ):
479
+ $opt_type = $value[2];
480
+ else:
481
+ $opt_type = '';
482
+ endif;
483
 
484
+ /* Default value */
485
+ if( !empty($value[3]) ):
486
+ $opt_default = $value[3];
487
+ else:
488
+ $opt_default = '';
489
+ endif;
490
 
491
+ /* Value */
492
+ $opt_val = isset( $pirate_forms_options[$opt_id] ) ? $pirate_forms_options[$opt_id] : $opt_default;
493
 
494
+ /* Options if checkbox, select, or radio */
495
+ $opt_options = empty( $value[4] ) ? array() : $value[4];
 
496
 
497
+ switch ($opt_type) {
498
+ case "title":
499
 
500
+ if( !empty($opt_name) ):
501
+ echo '<h3 class="title">'.$opt_name.'</h3><hr />';
502
+ endif;
503
 
504
+ break;
 
 
 
505
 
506
+ case "text":
507
+ ?>
 
 
 
508
 
509
+ <div class="pirate-forms-grouped">
510
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
511
+ <input name="<?php echo $opt_id; ?>" id="<?php echo $opt_id ?>" type="<?php echo $opt_type; ?>" value="<?php echo stripslashes( $opt_val ); ?>" class="widefat">
512
+ </div>
 
513
 
514
+ <?php
515
+ break;
516
+ case "select":
517
+ ?>
518
+ <div class="pirate-forms-grouped">
 
 
519
 
520
+ <label for="<?php echo $opt_id ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
521
 
522
+ <select name="<?php echo $opt_id ?>" id="<?php echo $opt_id; ?>">
523
+ <?php
524
+ foreach ( $opt_options as $key => $val ) :
525
 
526
+ $selected = '';
527
+ if ( $opt_val == $key )
528
+ $selected = 'selected';
529
+ ?>
530
+ <option value="<?php echo $key ?>" <?php echo $selected; ?>><?php echo $val; ?></option>
531
+ <?php endforeach; ?>
532
+ </select>
533
 
 
534
 
535
+ </div>
 
 
 
536
 
537
+ <?php
538
+ break;
539
+ case "checkbox":
540
+ ?>
541
+ <div class="pirate-forms-grouped">
542
+ <label for="<?php echo $opt_id; ?>"><?php echo $opt_name.'<br>'.'<span>'.$opt_desc.'</span>'; ?></label>
543
 
544
+ <?php
545
 
546
+ $checked = '';
547
+ if ( $opt_val == 'yes' )
548
+ $checked = 'checked';
549
+ ?>
550
 
551
+ <input type="checkbox" value="yes" name="<?php echo $opt_id; ?>" id="<?php echo $opt_id; ?>" <?php echo $checked; ?>>Yes
 
 
552
 
553
+ </div>
 
 
 
 
554
 
 
 
 
555
 
556
+ <?php
557
+ break;
558
+ }
559
+
560
+ endforeach;
561
+ ?>
562
+ <input name="save" type="submit" value="<?php _e( 'Save changes', 'pirate-forms' ) ?>" class="button-primary pirate-forms-save-button">
563
+ <input type="hidden" name="action" value="save">
564
+ <input type="hidden" name="proper_nonce" value="<?php echo wp_create_nonce( $current_user->user_email ) ?>">
565
+
566
+ </form><!-- .pirate_forms_contact_settings -->
567
+ <div class="ajaxAnimation"></div>
568
+ </div><!-- .pirate-forms-tab-pane -->
569
+
570
+ <?php endforeach; ?>
571
+
572
+ </div><!-- .pirate-forms-tab-content -->
573
+ </div><!-- .pirate-options -->
574
+
575
+ <div class="pirate-subscribe postbox card">
576
+ <h3 class="title"><?php esc_html_e( 'Get Our Free Email Course', 'islemag' )?></h3>
577
+ <div class="pirate-forms-subscribe-content">
578
+ <?php
579
+ if(!empty($_POST["pirate_forms_mail"])){
580
+ require( PIRATE_FORMS_PATH . 'mailin.php' );
581
+ $user_info = get_userdata(1);
582
+ $mailin = new Mailin("https://api.sendinblue.com/v2.0","cHW5sxZnzE7mhaYb");
583
+ $data = array( "email" => $_POST["pirate_forms_mail"],
584
+ "attributes" => array("NAME"=>$user_info->first_name, "SURNAME"=>$user_info->last_name),
585
+ "blacklisted" => 0,
586
+ "listid" => array(51),
587
+ "blacklisted_sms" => 0
588
+ );
589
+ $status = $mailin->create_update_user($data);
590
+ if($status['code'] == 'success'){
591
+ update_option( 'pirate_forms_subscribe', true);
592
+ }
593
+ }
594
+ $was_submited = get_option( 'pirate_forms_subscribe', false);
595
+ if( $was_submited == false ){
596
+ echo sprintf( '<p> %s </p><form class="pirate-forms-submit-mail" method="post"><input name="pirate_forms_mail" type="email" value="'.get_option( 'admin_email' ) .'" /><input class="button" type="submit" value="Submit"></form>', esc_html__('Ready to learn how to reduce your website loading times by half? Come and join the 1st lesson here!', 'pirate-forms' ) );
597
+ } else {
598
+ echo sprintf( '<p> %s </p>', esc_html__( 'Thank you for subscribing! You have been added to the mailing list and will receive the next email information in the coming weeks. If you ever wish to unsubscribe, simply use the “Unsubscribe” link included in each newsletter.', 'pirate-forms' ) );
599
+ } ?>
600
+ </div>
601
+ </div>
602
 
 
603
 
604
 
605
  </div><!-- .wrap -->
mailin.php ADDED
@@ -0,0 +1,939 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * SendinBlue REST client
5
+ */
6
+
7
+ class Mailin
8
+ {
9
+ public $api_key;
10
+ public $base_url;
11
+ public $curl_opts = array();
12
+ public function __construct($base_url,$api_key)
13
+ {
14
+ if(!function_exists('curl_init'))
15
+ {
16
+ throw new Exception('Mailin requires CURL module');
17
+ }
18
+ $this->base_url = $base_url;
19
+ $this->api_key = $api_key;
20
+ }
21
+ /**
22
+ * Do CURL request with authorization
23
+ */
24
+ private function do_request($resource,$method,$input)
25
+ {
26
+ $called_url = $this->base_url."/".$resource;
27
+ $ch = curl_init($called_url);
28
+ $auth_header = 'api-key:'.$this->api_key;
29
+ $content_header = "Content-Type:application/json";
30
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
31
+ // Windows only over-ride
32
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
33
+ }
34
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth_header,$content_header));
35
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
36
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
37
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
38
+ curl_setopt($ch, CURLOPT_HEADER, 0);
39
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
40
+ $data = curl_exec($ch);
41
+ if(curl_errno($ch))
42
+ {
43
+ echo 'Curl error: ' . curl_error($ch). '\n';
44
+ }
45
+ curl_close($ch);
46
+ return json_decode($data,true);
47
+ }
48
+ public function get($resource,$input)
49
+ {
50
+ return $this->do_request($resource,"GET",$input);
51
+ }
52
+ public function put($resource,$input)
53
+ {
54
+ return $this->do_request($resource,"PUT",$input);
55
+ }
56
+ public function post($resource,$input)
57
+ {
58
+ return $this->do_request($resource,"POST",$input);
59
+ }
60
+ public function delete($resource,$input)
61
+ {
62
+ return $this->do_request($resource,"DELETE",$input);
63
+ }
64
+
65
+ /*
66
+ Get Account.
67
+ No input required
68
+ */
69
+ public function get_account()
70
+ {
71
+ return $this->get("account","");
72
+ }
73
+
74
+ /*
75
+ Get SMTP details.
76
+ No input required
77
+ */
78
+ public function get_smtp_details()
79
+ {
80
+ return $this->get("account/smtpdetail","");
81
+ }
82
+
83
+ /*
84
+ Create Child Account.
85
+ @param {Array} data contains php array with key value pair.
86
+ @options data {String} child_email: Email address of Reseller child [Mandatory]
87
+ @options data {String} password: Password of Reseller child to login [Mandatory]
88
+ @options data {String} company_org: Name of Reseller child’s company [Mandatory]
89
+ @options data {String} first_name: First name of Reseller child [Mandatory]
90
+ @options data {String} last_name: Last name of Reseller child [Mandatory]
91
+ @options data {Array} credits: Number of email & sms credits respectively, which will be assigned to the Reseller child’s account [Optional]
92
+ - email_credit {Integer} number of email credits
93
+ - sms_credit {Integer} Number of sms credts
94
+ @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
95
+ */
96
+ public function create_child_account($data)
97
+ {
98
+ return $this->post("account",json_encode($data));
99
+ }
100
+
101
+ /*
102
+ Update Child Account.
103
+ @param {Array} data contains php array with key value pair.
104
+ @options data {String} auth_key: 16 character authorization key of Reseller child to be modified [Mandatory]
105
+ @options data {String} company_org: Name of Reseller child’s company [Optional]
106
+ @options data {String} first_name: First name of Reseller child [Optional]
107
+ @options data {String} last_name: Last name of Reseller child [Optional]
108
+ @options data {String} password: Password of Reseller child to login [Optional]
109
+ @options data {Array} associate_ip: Associate dedicated IPs to reseller child. You can use commas to separate multiple IPs [Optional]
110
+ @options data {Array} disassociate_ip: Disassociate dedicated IPs from reseller child. You can use commas to separate multiple IPs [Optional]
111
+ */
112
+ public function update_child_account($data)
113
+ {
114
+ return $this->put("account",json_encode($data));
115
+ }
116
+
117
+ /*
118
+ Delete Child Account.
119
+ @param {Array} data contains php array with key value pair.
120
+ @options data {String} auth_key: 16 character authorization key of Reseller child to be deleted [Mandatory]
121
+ */
122
+ public function delete_child_account($data)
123
+ {
124
+ return $this->delete("account/".$data['auth_key'],"");
125
+ }
126
+
127
+ /*
128
+ Get Reseller child Account.
129
+ @param {Array} data contains php array with key value pair.
130
+ @options data {String} auth_key: 16 character authorization key of Reseller child. Example : To get the details of more than one child account, use, {"key1":"abC01De2fGHI3jkL","key2":"mnO45Pq6rSTU7vWX"} [Mandatory]
131
+ */
132
+ public function get_reseller_child($data)
133
+ {
134
+ return $this->post("account/getchildv2",json_encode($data));
135
+ }
136
+
137
+ /*
138
+ Add/Remove Reseller child's Email/Sms credits.
139
+ @param {Array} data contains php array with key value pair.
140
+ @options data {String} auth_key: 16 character authorization key of Reseller child to modify credits [Mandatory]
141
+ @options data {Array} add_credit: Number of email & sms credits to be added. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if rmv_credit is empty]
142
+ - email_credit {Integer} number of email credits
143
+ - sms_credit {Integer} Number of sms credts
144
+ @options data {Array} rmv_credit: Number of email & sms credits to be removed. You can assign either email or sms credits, one at a time other will remain 0. [Mandatory: if add_credits is empty]
145
+ - email_credit {Integer} number of email credits
146
+ - sms_credit {Integer} Number of sms credts
147
+ */
148
+ public function add_remove_child_credits($data)
149
+ {
150
+ return $this->post("account/addrmvcredit",json_encode($data));
151
+ }
152
+
153
+ /*
154
+ Get a particular campaign detail.
155
+ @param {Array} data contains php array with key value pair.
156
+ @options data {Integer} id: Unique Id of the campaign [Mandatory]
157
+ */
158
+ public function get_campaign_v2($data)
159
+ {
160
+ return $this->get("campaign/".$data['id']."/detailsv2","");
161
+ }
162
+
163
+ /*
164
+ Get all campaigns detail.
165
+ @param {Array} data contains php array with key value pair.
166
+ @options data {String} type: Type of campaign. Possible values – classic, trigger, sms, template ( case sensitive ) [Optional]
167
+ @options data {String} status: Status of campaign. Possible values – draft, sent, archive, queued, suspended, in_process, temp_active, temp_inactive ( case sensitive ) [Optional]
168
+ @options data {Integer} page: Maximum number of records per request is 500, if there are more than 500 campaigns then you can use this parameter to get next 500 results [Optional]
169
+ @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
170
+ */
171
+ public function get_campaigns_v2($data)
172
+ {
173
+ return $this->get("campaign/detailsv2",json_encode($data));
174
+ }
175
+
176
+ /*
177
+ Create and Schedule your campaigns. It returns the ID of the created campaign.
178
+ @param {Array} data contains php array with key value pair.
179
+ @options data {String} category: Tag name of the campaign [Optional]
180
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
181
+ @options data {String} name: Name of the campaign [Mandatory]
182
+ @options data {String} bat: Email address for test mail [Optional]
183
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
184
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
185
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
186
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
187
+ @options data {String} subject: Subject of the campaign [Mandatory]
188
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
189
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
190
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM] To use the contact attributes here, these should already exist in SendinBlue account [Optional]
191
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
192
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
193
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
194
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
195
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
196
+
197
+ */
198
+ public function create_campaign($data)
199
+ {
200
+ return $this->post("campaign",json_encode($data));
201
+ }
202
+
203
+ /*
204
+ Update your campaign.
205
+ @param {Array} data contains php array with key value pair.
206
+ @options data {Integer} id: Id of campaign to be modified [Mandatory]
207
+ @options data {String} category: Tag name of the campaign [Optional]
208
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
209
+ @options data {String} name: Name of the campaign [Optional]
210
+ @options data {String} bat: Email address for test mail [Optional]
211
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Optional]
212
+ @options data {String} html_url: Url which content is the body of content [Optional]
213
+ @options data {Array} listid These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
214
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
215
+ @options data {String} subject: Subject of the campaign.
216
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
217
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
218
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
219
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
220
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
221
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
222
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
223
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
224
+ */
225
+ public function update_campaign($data)
226
+ {
227
+ $id = $data['id'];
228
+ unset($data['id']);
229
+ return $this->put("campaign/".$id,json_encode($data));
230
+ }
231
+
232
+ /*
233
+ Delete your campaigns.
234
+ @param {Array} data contains php array with key value pair.
235
+ @options data {Integer} id: Id of campaign to be deleted [Mandatory]
236
+ */
237
+ public function delete_campaign($data)
238
+ {
239
+ return $this->delete("campaign/".$data['id'],"");
240
+ }
241
+
242
+ /*
243
+ Send report of Sent and Archived campaign.
244
+ @param {Array} data contains php array with key value pair.
245
+ @options data {Integer} id: Id of campaign to send its report [Mandatory]
246
+ @options data {String} lang: Language of email content. Possible values – fr (default), en, es, it & pt [Optional]
247
+ @options data {String} email_subject: Message subject [Mandatory]
248
+ @options data {Array} email_to: Email address of the recipient(s). Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
249
+ @options data {String} email_content_type: Body of the message in text/HTML version. Possible values – text & html [Mandatory]
250
+ @options data {Array} email_bcc: Same as email_to but for Bcc [Optional]
251
+ @options data {Array} email_cc: Same as email_to but for Cc [Optional]
252
+ @options data {String} email_body: Body of the message [Mandatory]
253
+ */
254
+ public function campaign_report_email($data)
255
+ {
256
+ $id = $data['id'];
257
+ unset($data['id']);
258
+ return $this->post("campaign/".$id."/report",json_encode($data));
259
+ }
260
+
261
+ /*
262
+ Export the recipients of a specified campaign.
263
+ @param {Array} data contains php array with key value pair.
264
+ @options data {Integer} id: Id of campaign to export its recipients [Mandatory]
265
+ @options data {String} notify_url: URL that will be called once the export process is finished [Mandatory]
266
+ @options data {String} type: Type of recipients. Possible values – all, non_clicker, non_opener, clicker, opener, soft_bounces, hard_bounces & unsubscribes [Mandatory]
267
+ */
268
+ public function campaign_recipients_export($data)
269
+ {
270
+ $id = $data['id'];
271
+ unset($data['id']);
272
+ return $this->post("campaign/".$id."/recipients",json_encode($data));
273
+ }
274
+
275
+ /*
276
+ Get the Campaign name, subject and share link of the classic type campaigns only which are sent, for those which are not sent and the rest of campaign types like trigger, template & sms, will return an error message of share link not available.
277
+ @param {Array} data contains php array with key value pair.
278
+ @options data {Array} camp_ids: Id of campaign to get share link. You can use commas to separate multiple ids [Mandatory]
279
+ */
280
+
281
+ public function share_campaign($data)
282
+ {
283
+ return $this->post("campaign/sharelinkv2",json_encode($data));
284
+ }
285
+
286
+ /*
287
+ Send a Test Campaign.
288
+ @param {Array} data contains php array with key value pair.
289
+ @options data {Integer} id: Id of the campaign [Mandatory]
290
+ @options data {Array} emails: Email address of recipient(s) existing in the one of the lists & should not be blacklisted. Example: "test@example.net". You can use commas to separate multiple recipients [Mandatory]
291
+ */
292
+ public function send_bat_email($data)
293
+ {
294
+ $id = $data['id'];
295
+ unset($data['id']);
296
+ return $this->post("campaign/".$id."/test",json_encode($data));
297
+ }
298
+
299
+ /*
300
+ Update the Campaign status.
301
+ @param {Array} data contains php array with key value pair.
302
+ @options data {Integer} id: Id of campaign to update its status [Mandatory]
303
+ @options data {String} status: Types of status. Possible values – suspended, archive, darchive, sent, queued, replicate and replicate_template ( case sensitive ) [Mandatory]
304
+ */
305
+ public function update_campaign_status($data)
306
+ {
307
+ $id = $data['id'];
308
+ unset($data['id']);
309
+ return $this->put("campaign/".$id."/updatecampstatus",json_encode($data));
310
+ }
311
+
312
+ /*
313
+ Create and schedule your Trigger campaigns.
314
+ @param {Array} data contains php array with key value pair.
315
+ @options data {String} category: Tag name of the campaign [Optional]
316
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
317
+ @options data {String} trigger_name: Name of the campaign [Mandatory]
318
+ @options data {String} bat: Email address for test mail [Optional]
319
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
320
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
321
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
322
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
323
+ @options data {String} subject: Subject of the campaign [Mandatory]
324
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
325
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
326
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
327
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
328
+ @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
329
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
330
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
331
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
332
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
333
+ */
334
+ public function create_trigger_campaign($data)
335
+ {
336
+ return $this->post("campaign",json_encode($data));
337
+ }
338
+
339
+ /*
340
+ Update and schedule your Trigger campaigns.
341
+ @param {Array} data contains php array with key value pair.
342
+ @options data {Integer} id: Id of Trigger campaign to be modified [Mandatory]
343
+ @options data {String} category: Tag name of the campaign [Optional]
344
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
345
+ @options data {String} trigger_name: Name of the campaign [Mandatory]
346
+ @options data {String} bat Email address for test mail [Optional]
347
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
348
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
349
+ @options data {Array} listid: These are the lists to which the campaign has been sent [Mandatory: if scheduled_date is not empty]
350
+ @options data {String} scheduled_date: The day on which the campaign is supposed to run[Optional]
351
+ @options data {String} subject: Subject of the campaign [Mandatory]
352
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients, please make sure that the sender details are defined here, and in case of no sender, you can add them also via API & for Shared IP clients, if sender exists]
353
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
354
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
355
+ @options data {Array} exclude_list: These are the lists which must be excluded from the campaign [Optional]
356
+ @options data {Integer} recurring: Type of trigger campaign. Possible values = 0 (default) & 1. recurring = 0 means contact can receive the same Trigger campaign only once, & recurring = 1 means contact can receive the same Trigger campaign several times [Optional]
357
+ @options data {String} attachment_url: Provide the absolute url of the attachment [Optional]
358
+ @options data {Integer} inline_image: Status of inline image. Possible values = 0 (default) & 1. inline_image = 0 means image can’t be embedded, & inline_image = 1 means image can be embedded, in the email [Optional]
359
+ @options data {Integer} mirror_active: Status of mirror links in campaign. Possible values = 0 & 1 (default). mirror_active = 0 means mirror links are deactivated, & mirror_active = 1 means mirror links are activated, in the campaign [Optional]
360
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
361
+ */
362
+ public function update_trigger_campaign($data)
363
+ {
364
+ $id = $data['id'];
365
+ unset($data['id']);
366
+ return $this->put("campaign/".$id,json_encode($data));
367
+ }
368
+
369
+ /*
370
+ Get all folders detail.
371
+ @param {Array} data contains php array with key value pair.
372
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 folders then you can use this parameter to get next 50 results [Mandatory]
373
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
374
+ */
375
+ public function get_folders($data)
376
+ {
377
+ return $this->get("folder",json_encode($data));
378
+ }
379
+
380
+ /*
381
+ Get a particular folder detail.
382
+ @param {Array} data contains php array with key value pair.
383
+ @options data {Integer} id: Id of folder to get details [Mandatory]
384
+ */
385
+ public function get_folder($data)
386
+ {
387
+ return $this->get("folder/".$data['id'],"");
388
+ }
389
+
390
+ /*
391
+ Create a new folder.
392
+ @param {Array} data contains php array with key value pair.
393
+ @options data {String} name: Desired name of the folder to be created [Mandatory]
394
+ */
395
+ public function create_folder($data)
396
+ {
397
+ return $this->post("folder",json_encode($data));
398
+ }
399
+
400
+ /*
401
+ Delete a specific folder information.
402
+ @param {Array} data contains php array with key value pair.
403
+ @options data {Integer} id: Id of folder to be deleted [Mandatory]
404
+ */
405
+ public function delete_folder($data)
406
+ {
407
+ return $this->delete("folder/".$data['id'],"");
408
+ }
409
+
410
+ /*
411
+ Update an existing folder.
412
+ @param {Array} data contains php array with key value pair.
413
+ @options data {Integer} id: Id of folder to be modified [Mandatory]
414
+ @options data {String} name: Desired name of the folder to be modified [Mandatory]
415
+ */
416
+ public function update_folder($data)
417
+ {
418
+ $id = $data['id'];
419
+ unset($data['id']);
420
+ return $this->put("folder/".$id,json_encode($data));
421
+ }
422
+
423
+ /*
424
+ Get all lists detail.
425
+ @param {Array} data contains php array with key value pair.
426
+ @options data {Integer} list_parent: This is the existing folder id & can be used to get all lists belonging to it [Optional]
427
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
428
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
429
+ */
430
+ public function get_lists($data)
431
+ {
432
+ return $this->get("list",json_encode($data));
433
+ }
434
+
435
+ /*
436
+ Get a particular list detail.
437
+ @param {Array} data contains php array with key value pair.
438
+ @options data {Integer} id: Id of list to get details [Mandatory]
439
+ */
440
+ public function get_list($data)
441
+ {
442
+ return $this->get("list/".$data['id'],"");
443
+ }
444
+
445
+ /*
446
+ Create a new list.
447
+ @param {Array} data contains php array with key value pair.
448
+ @options data {String} list_name: Desired name of the list to be created [Mandatory]
449
+ @options data {Integer} list_parent: Folder ID [Mandatory]
450
+ */
451
+ public function create_list($data)
452
+ {
453
+ return $this->post("list",json_encode($data));
454
+ }
455
+
456
+ /*
457
+ Update a list.
458
+ @param {Array} data contains php array with key value pair.
459
+ @options data {Integer} id: Id of list to be modified [Mandatory]
460
+ @options data {String} list_name: Desired name of the list to be modified [Optional]
461
+ @options data {Integer} list_parent: Folder ID [Mandatory]
462
+ */
463
+ public function update_list($data)
464
+ {
465
+ $id = $data['id'];
466
+ unset($data['id']);
467
+ return $this->put("list/".$id,json_encode($data));
468
+ }
469
+
470
+ /*
471
+ Delete a specific list.
472
+ @param {Array} data contains php array with key value pair.
473
+ @options data {Integer} id: Id of list to be deleted [Mandatory]
474
+ */
475
+ public function delete_list($data)
476
+ {
477
+ return $this->delete("list/".$data['id'],"");
478
+ }
479
+
480
+ /*
481
+ Display details of all users for the given lists.
482
+ @param {Array} data contains php array with key value pair.
483
+ @options data {Array} listids: These are the list ids to get their data. The ids found will display records [Mandatory]
484
+ @options data {String} timestamp: This is date-time filter to fetch modified user records >= this time. Valid format Y-m-d H:i:s. Example: "2015-05-22 14:30:00" [Optional]
485
+ @options data {Integer} page: Maximum number of records per request is 500, if in your list there are more than 500 users then you can use this parameter to get next 500 results [Optional]
486
+ @options data {Integer} page_limit: This should be a valid number between 1-500 [Optional]
487
+ */
488
+ public function display_list_users($data)
489
+ {
490
+ return $this->post("list/display",json_encode($data));
491
+ }
492
+
493
+ /*
494
+ Add already existing users in the SendinBlue contacts to the list.
495
+ @param {Array} data contains php array with key value pair.
496
+ @options data {Integer} id: Id of list to link users in it [Mandatory]
497
+ @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
498
+ */
499
+
500
+ public function add_users_list($data)
501
+ {
502
+ $id = $data['id'];
503
+ unset($data['id']);
504
+ return $this->post("list/".$id."/users",json_encode($data));
505
+ }
506
+
507
+ /*
508
+ Delete already existing users in the SendinBlue contacts from the list.
509
+ @param {Array} data contains php array with key value pair.
510
+ @options data {Integer} id: Id of list to unlink users from it [Mandatory]
511
+ @options data {Array} users: Email address of the already existing user(s) in the SendinBlue contacts to be modified. Example: "test@example.net". You can use commas to separate multiple users [Mandatory]
512
+ */
513
+ public function delete_users_list($data)
514
+ {
515
+ $id = $data['id'];
516
+ unset($data['id']);
517
+ return $this->delete("list/".$id."/delusers",json_encode($data));
518
+ }
519
+
520
+ /*
521
+ Access all the attributes information under the account.
522
+ No input required
523
+ */
524
+ public function get_attributes()
525
+ {
526
+ return $this->get("attribute","");
527
+ }
528
+
529
+ /*
530
+ Access the specific type of attribute information.
531
+ @param {Array} data contains php array with key value pair.
532
+ @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global [Optional]
533
+ */
534
+ public function get_attribute($data)
535
+ {
536
+ return $this->get("attribute/".$data['type'],"");
537
+ }
538
+
539
+ /*
540
+ Create an Attribute.
541
+ @param {Array} data contains php array with key value pair.
542
+ @options data {String} type: Type of attribute. Possible values – normal, transactional, category, calculated & global ( case sensitive ) [Mandatory]
543
+ @options data {Array} data: The name and data type of ‘normal’ & ‘transactional’ attribute to be created in your SendinBlue account. It should be sent as an associative array. Example: array(‘ATTRIBUTE_NAME1′ => ‘DATA_TYPE1′, ‘ATTRIBUTE_NAME2’=> ‘DATA_TYPE2′).
544
+ The name and data value of ‘category’, ‘calculated’ & ‘global’, should be sent as JSON string. Example: ‘[{ "name":"ATTRIBUTE_NAME1", "value":"Attribute_value1" }, { "name":"ATTRIBUTE_NAME2", "value":"Attribute_value2" }]’. You can use commas to separate multiple attributes [Mandatory]
545
+ */
546
+ public function create_attribute($data)
547
+ {
548
+ return $this->post("attribute/",json_encode($data));
549
+ }
550
+
551
+ /*
552
+ Delete a specific type of attribute information.
553
+ @param {Array} data contains php array with key value pair.
554
+ @options data {Integer} type: Type of attribute to be deleted [Mandatory]
555
+ */
556
+ public function delete_attribute($type,$data)
557
+ {
558
+ $type = $data['type'];
559
+ unset($data['type']);
560
+ return $this->post("attribute/".$type,json_encode($data));
561
+ }
562
+
563
+ /*
564
+ Create a new user if an email provided as input, doesn’t exists in the contact list of your SendinBlue account, otherwise it will update the existing user.
565
+ @param {Array} data contains php array with key value pair.
566
+ @options data {String} email: Email address of the user to be created in SendinBlue contacts. Already existing email address of user in the SendinBlue contacts to be modified [Mandatory]
567
+ @options data {Array} attributes: The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
568
+ @options data {Integer} blacklisted: This is used to blacklist/ Unblacklist a user. Possible values – 0 & 1. blacklisted = 1 means user has been blacklisted [Optional]
569
+ @options data {Array} listid: The list id(s) to be linked from user [Optional]
570
+ @options data {Array} listid_unlink: The list id(s) to be unlinked from user [Optional]
571
+ @options data {Array} blacklisted_sms: This is used to blacklist/ Unblacklist a user’s SMS number. Possible values – 0 & 1. blacklisted_sms = 1 means user’s SMS number has been blacklisted [Optional]
572
+ */
573
+ public function create_update_user($data)
574
+ {
575
+ return $this->post("user/createdituser",json_encode($data));
576
+ }
577
+
578
+ /*
579
+ Get Access a specific user Information.
580
+ @param {Array} data contains php array with key value pair.
581
+ @options data {String} email: Email address of the already existing user in the SendinBlue contacts [Mandatory]
582
+ */
583
+ public function get_user($data)
584
+ {
585
+ return $this->get("user/".$data['email'],"");
586
+ }
587
+
588
+ /*
589
+ Unlink existing user from all lists.
590
+ @param {Array} data contains php array with key value pair.
591
+ @options data {String} email: Email address of the already existing user in the SendinBlue contacts to be unlinked from all lists [Mandatory]
592
+ */
593
+ public function delete_user($data)
594
+ {
595
+ return $this->delete("user/".$data['email'],"");
596
+ }
597
+
598
+ /*
599
+ Import Users Information.
600
+ @param {Array} data contains php array with key value pair.
601
+ @options data {String} url: The URL of the file to be imported. Possible file types – .txt, .csv [Mandatory: if body is empty]
602
+ @options data {String} body: The Body with csv content to be imported. Example: ‘NAME;SURNAME;EMAIL\n"Name1";"Surname1";"example1@example.net"\n"Name2";"Surname2";"example2@example.net"‘, where \n separates each user data. You can use semicolon to separate multiple attributes [Mandatory: if url is empty]
603
+ @options data {Array} listids: These are the list ids in which the the users will be imported [Mandatory: if name is empty]
604
+ @options data {String} notify_url: URL that will be called once the import process is finished [Optional] In notify_url, we are sending the content using POST method
605
+ @options data {String} name: This is new list name which will be created first & then users will be imported in it [Mandatory: if listids is empty]
606
+ @options data {Integer} list_parent: This is the existing folder id & can be used with name parameter to make newly created list’s desired parent [Optional]
607
+ */
608
+ public function import_users($data)
609
+ {
610
+ return $this->post("user/import",json_encode($data));
611
+ }
612
+
613
+ /*
614
+ Export Users Information.
615
+ @param {Array} data contains php array with key value pair.
616
+ @options data {String} export_attrib: The name of attribute present in your SendinBlue account. You can use commas to separate multiple attributes. Example: "EMAIL,NAME,SMS" [Optional]
617
+ @options data {String} filter: Filter can be added to export users. Example: "{\"blacklisted\":1}", will export all blacklisted users [Mandatory]
618
+ @options data {String} notify_url: URL that will be called once the export process is finished [Optional]
619
+ */
620
+ public function export_users($data)
621
+ {
622
+ return $this->post("user/export",json_encode($data));
623
+ }
624
+
625
+ /*
626
+ Get all the processes information under the account.
627
+ @param {Array} data contains php array with key value pair.
628
+ @options data {Integer} page: Maximum number of records per request is 50, if there are more than 50 processes then you can use this parameter to get next 50 results [Mandatory]
629
+ @options data {Integer} page_limit: This should be a valid number between 1-50 [Mandatory]
630
+ */
631
+ public function get_processes($data)
632
+ {
633
+ return $this->get("process",json_encode($data));
634
+ }
635
+
636
+ /*
637
+ Get the process information.
638
+ @param {Array} data contains php array with key value pair.
639
+ @options data {Integer} id: Id of process to get details [Mandatory]
640
+ */
641
+ public function get_process($data)
642
+ {
643
+ return $this->get("process/".$data['id'],"");
644
+ }
645
+
646
+ /*
647
+ To retrieve details of all webhooks.
648
+ @param {Array} data contains php array with key value pair.
649
+ @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional]
650
+ */
651
+ public function get_webhooks($data)
652
+ {
653
+ return $this->get("webhook",json_encode($data));
654
+ }
655
+
656
+ /*
657
+ To retrieve details of any particular webhook.
658
+ @param {Array} data contains php array with key value pair.
659
+ @options data {Integer} id: Id of webhook to get details [Mandatory]
660
+ */
661
+ public function get_webhook($data)
662
+ {
663
+ return $this->get("webhook/".$data['id'],"");
664
+ }
665
+
666
+ /*
667
+ Create a Webhook.
668
+ @param {Array} data contains php array with key value pair.
669
+ @options data {String} url: URL that will be triggered by a webhook [Mandatory]
670
+ @options data {String} description: Webook description [Optional]
671
+ @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
672
+ @options data {Integer} is_plat: Flag to create webhook type. Possible values – 0 (default) & 1. Example: to create Transactional webhooks, use $is_plat=0, & to create Marketing webhooks, use $is_plat=1 [Optional]
673
+ */
674
+ public function create_webhook($data)
675
+ {
676
+ return $this->post("webhook",json_encode($data));
677
+ }
678
+
679
+ /*
680
+ Delete a webhook.
681
+ @param {Array} data contains php array with key value pair.
682
+ @options data {Integer} id: Id of webhook to be deleted [Mandatory]
683
+ */
684
+ public function delete_webhook($data)
685
+ {
686
+ return $this->delete("webhook/".$data['id'],"");
687
+ }
688
+
689
+ /*
690
+ Update a webhook.
691
+ @param {Array} data contains php array with key value pair.
692
+ @options data {Integer} id: Id of webhook to be modified [Mandatory]
693
+ @options data {String} url: URL that will be triggered by a webhook [Mandatory]
694
+ @options data {String} description: Webook description [Optional]
695
+ @options data {Array} events: Set of events. You can use commas to separate multiple events. Possible values for Transcational webhook – request, delivered, hard_bounce, soft_bounce, blocked, spam, invalid_email, deferred, click, & opened and Possible Values for Marketing webhook – spam, opened, click, hard_bounce, unsubscribe, soft_bounce & list_addition ( case sensitive ) [Mandatory]
696
+ */
697
+ public function update_webhook($data)
698
+ {
699
+ $id = $data['id'];
700
+ unset($data['id']);
701
+ return $this->put("webhook/".$id,json_encode($data));
702
+ }
703
+
704
+ /*
705
+ Get Access of created senders information.
706
+ @param {Array} data contains php array with key value pair.
707
+ @options data {String} option: Options to get senders. Possible options – IP-wise, & Domain-wise ( only for dedicated IP clients ). Example: to get senders with specific IP, use $option=’1.2.3.4′, to get senders with specific domain use, $option=’domain.com’, & to get all senders, use $option="" [Optional]
708
+ */
709
+ public function get_senders($data)
710
+ {
711
+ return $this->get("advanced",json_encode($data));
712
+ }
713
+
714
+ /*
715
+ Create your Senders.
716
+ @param {Array} data contains php array with key value pair.
717
+ @options data {String} name: Name of the sender [Mandatory]
718
+ @options data {String} email: Email address of the sender [Mandatory]
719
+ @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
720
+ */
721
+ public function create_sender($data)
722
+ {
723
+ return $this->post("advanced",json_encode($data));
724
+ }
725
+
726
+ /*
727
+ Update your Senders.
728
+ @param {Array} data contains php array with key value pair.
729
+ @options data {Integer} id: Id of sender to be modified [Mandatory]
730
+ @options data {String} name: Name of the sender [Mandatory]
731
+ @options data {Array} ip_domain: Pass pipe ( | ) separated Dedicated IP and its associated Domain. Example: "1.2.3.4|mydomain.com". You can use commas to separate multiple ip_domain’s [Mandatory: Only for Dedicated IP clients, for Shared IP clients, it should be kept blank]
732
+ */
733
+ public function update_sender($data)
734
+ {
735
+ $id = $data['id'];
736
+ unset($data['id']);
737
+ return $this->put("advanced/".$id,json_encode($data));
738
+ }
739
+
740
+ /*
741
+ Delete your Sender Information.
742
+ @param {Array} data contains php array with key value pair.
743
+ @options data {Integer} id: Id of sender to be deleted [Mandatory]
744
+ */
745
+ public function delete_sender($data)
746
+ {
747
+ return $this->delete("advanced/".$data['id'],"");
748
+ }
749
+
750
+ /*
751
+ Send Transactional Email.
752
+ @param {Array} data contains php array with key value pair.
753
+ @options data {Array} to: Email address of the recipient(s). It should be sent as an associative array. Example: array("to@example.net"=>"to whom"). You can use commas to separate multiple recipients [Mandatory]
754
+ @options data {String} subject: Message subject [Mandatory]
755
+ @options data {Array} from Email address for From header. It should be sent as an array. Example: array("from@email.com","from email") [Mandatory]
756
+ @options data {String} html: Body of the message. (HTML version) [Mandatory]. To send inline images, use <img src="{YourFileName.Extension}" alt="image" border="0" >, the 'src' attribute value inside {} (curly braces) should be same as the filename used in 'inline_image' parameter
757
+ @options data {String} text: Body of the message. (text version) [Optional]
758
+ @options data {Array} cc: Same as to but for Cc. Example: array("cc@example.net","cc whom") [Optional]
759
+ @options data {Array} bcc: Same as to but for Bcc. Example: array("bcc@example.net","bcc whom") [Optional]
760
+ @options data {Array} replyto: Same as from but for Reply To. Example: array("from@email.com","from email") [Optional]
761
+ @options data {Array} attachment: Provide the absolute url of the attachment/s. Possible extension values = gif, png, bmp, cgm, jpg, jpeg, txt, css, shtml, html, htm, csv, zip, pdf, xml, doc, xls, ppt, tar, and ez. To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple attachments [Optional]
762
+ @options data {Array} headers: The headers will be sent along with the mail headers in original email. Example: array("Content-Type"=>"text/html; charset=iso-8859-1"). You can use commas to separate multiple headers [Optional]
763
+ @options data {Array} inline_image: Pass your inline image/s filename & its base64 encoded chunk data as an associative array. Example: array("YourFileName.Extension"=>"Base64EncodedChunkData"). You can use commas to separate multiple inline images [Optional]
764
+ */
765
+ public function send_email($data)
766
+ {
767
+ return $this->post("email",json_encode($data));
768
+ }
769
+
770
+ /*
771
+ Aggregate / date-wise report of the SendinBlue SMTP account.
772
+ @param {Array} data contains php array with key value pair.
773
+ @options data {Integer} aggregate: This is used to indicate, you are interested in all-time totals. Possible values – 0 & 1. aggregate = 0 means it will not aggregate records, and will show stats per day/date wise [Optional]
774
+ @options data {String} start_date: The start date to look up statistics. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
775
+ @options data {String} end_date: The end date to look up statistics. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
776
+ @options data {Integer} days: Number of days in the past to include statistics ( Includes today ). It must be an integer greater than 0 [Optional]
777
+ @options data {String} tag: The tag you will specify to retrieve detailed stats. It must be an existing tag that has statistics [Optional]
778
+ */
779
+ public function get_statistics($data)
780
+ {
781
+ return $this->post("statistics",json_encode($data));
782
+ }
783
+
784
+ /*
785
+ Get Email Event report.
786
+ @param {Array} data contains php array with key value pair.
787
+ @options data {Integer} limit: To limit the number of results returned. It should be an integer [Optional]
788
+ @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
789
+ @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
790
+ @options data {Integer} offset: Beginning point in the list to retrieve from. It should be an integer [Optional]
791
+ @options data {String} date: Specific date to get its report. Date must be in YYYY-MM-DD format and should be earlier than todays date [Optional]
792
+ @options data {Integer} days: Number of days in the past (includes today). If specified, must be an integer greater than 0 [Optional]
793
+ @options data {String} email: Email address to search report for [Optional]
794
+ */
795
+ public function get_report($data)
796
+ {
797
+ return $this->post("report",json_encode($data));
798
+ }
799
+
800
+ /*
801
+ Delete any hardbounce, which actually would have been blocked due to some temporary ISP failures.
802
+ @param {Array} data contains php array with key value pair.
803
+ @options data {String} start_date: The start date to get report from. Date must be in YYYY-MM-DD format and should be before the end_date [Optional]
804
+ @options data {String} end_date: The end date to get report till date. Date must be in YYYY-MM-DD format and should be after the start_date [Optional]
805
+ @options data {String} email: Email address to delete its bounces [Optional]
806
+ */
807
+ public function delete_bounces($data)
808
+ {
809
+ return $this->post("bounces",json_encode($data));
810
+ }
811
+
812
+ /*
813
+ Send templates created on SendinBlue, through SendinBlue SMTP (transactional mails).
814
+ @param {Array} data contains php array with key value pair.
815
+ @options data {Integer} id: Id of the template created on SendinBlue account [Mandatory]
816
+ @options data {String} to: Email address of the recipient(s). You can use pipe ( | ) to separate multiple recipients. Example: "to-example@example.net|to2-example@example.net" [Mandatory]
817
+ @options data {String} cc: Same as to but for Cc [Optional]
818
+ @options data {String} bcc: Same as to but for Bcc [Optional]
819
+ @options data {Array} attrv The name of attribute present in your SendinBlue account. It should be sent as an associative array. Example: array("NAME"=>"name"). You can use commas to separate multiple attributes [Optional]
820
+ @options data {String} attachment_url: Provide the absolute url of the attachment. Url not allowed from local machine. File must be hosted somewhere [Optional]
821
+ @options data {Array} attachment: To send attachment/s generated on the fly you have to pass your attachment/s filename & its base64 encoded chunk data as an associative array [Optional]
822
+ */
823
+ public function send_transactional_template($data)
824
+ {
825
+ $id = $data['id'];
826
+ unset($data['id']);
827
+ return $this->put("template/".$id,json_encode($data));
828
+ }
829
+
830
+ /*
831
+ Create a Template.
832
+ @param {Array} data contains php array with key value pair.
833
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
834
+ @options data {String} template_name: Name of the Template [Mandatory]
835
+ @options data {String} bat: Email address for test mail [Optional]
836
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
837
+ @options data {String} html_url Url: which content is the body of content [Mandatory: if html_content is empty]
838
+ @options data {String} subject: Subject of the campaign [Mandatory]
839
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
840
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
841
+ @options data {String} to_fieldv This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
842
+ @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
843
+ @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
844
+ */
845
+ public function create_template($data)
846
+ {
847
+ return $this->post("template",json_encode($data));
848
+ }
849
+
850
+ /*
851
+ Update a Template.
852
+ @param {Array} data contains php array with key value pair.
853
+ @options data {Integer} id: Id of Template to be modified [Mandatory]
854
+ @options data {String} from_name: Sender name from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
855
+ @options data {String} template_name: Name of the Template [Mandatory]
856
+ @options data {String} bat: Email address for test mail [Optional]
857
+ @options data {String} html_content: Body of the content. The HTML content field must have more than 10 characters [Mandatory: if html_url is empty]
858
+ @options data {String} html_url: Url which content is the body of content [Mandatory: if html_content is empty]
859
+ @options data {String} subject: Subject of the campaign [Mandatory]
860
+ @options data {String} from_email: Sender email from which the campaign emails are sent [Mandatory: for Dedicated IP clients & for Shared IP clients, if sender exists]
861
+ @options data {String} reply_to: The reply to email in the campaign emails [Optional]
862
+ @options data {String} to_field: This is to personalize the «To» Field. If you want to include the first name and last name of your recipient, add [PRENOM] [NOM]. To use the contact attributes here, these should already exist in SendinBlue account [Optional]
863
+ @options data {Integer} status: Status of template. Possible values = 0 (default) & 1. status = 0 means template is inactive, & status = 1 means template is active [Optional]
864
+ @options data {Integer} attachment: Status of attachment. Possible values = 0 (default) & 1. attach = 0 means an attachment can’t be sent, & attach = 1 means an attachment can be sent, in the email [Optional]
865
+ */
866
+ public function update_template($data)
867
+ {
868
+ $id = $data['id'];
869
+ unset($data['id']);
870
+ return $this->put("template/".$id,json_encode($data));
871
+ }
872
+
873
+ /*
874
+ Send a transactional SMS.
875
+ @param {Array} data contains php array with key value pair.
876
+ @options data {String} to: The mobile number to send SMS to with country code [Mandatory]
877
+ @options data {String} from: The name of the sender. The number of characters is limited to 11 (alphanumeric format) [Mandatory]
878
+ @options data {String} text: The text of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Mandatory]
879
+ @options data {String} web_url: The web URL that can be called once the message is successfully delivered [Optional]
880
+ @options data {String} tag: The tag that you can associate with the message [Optional]
881
+ @options data {String} type: Type of message. Possible values – marketing (default) & transactional. You can use marketing for sending marketing SMS, & for sending transactional SMS, use transactional type [Optional]
882
+ */
883
+ public function send_sms($data)
884
+ {
885
+ return $this->post("sms",json_encode($data));
886
+ }
887
+
888
+ /*
889
+ Create & Schedule your SMS campaigns.
890
+ @param {Array} data contains php array with key value pair.
891
+ @options data {String} name: Name of the SMS campaign [Mandatory]
892
+ @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
893
+ @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
894
+ @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
895
+ @options data {Array} listid: These are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
896
+ @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
897
+ @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
898
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
899
+ */
900
+ public function create_sms_campaign($data)
901
+ {
902
+ return $this->post("sms",json_encode($data));
903
+ }
904
+
905
+ /*
906
+ Update your SMS campaigns.
907
+ @param {Array} data contains php array with key value pair.
908
+ @options data {Integer} id: Id of the SMS campaign [Mandatory]
909
+ @options data {String} name: Name of the SMS campaign [Optional]
910
+ @options data {String} sender: This allows you to customize the SMS sender. The number of characters is limited to 11 ( alphanumeric format ) [Optional]
911
+ @options data {String} content: Content of the message. The maximum characters used per SMS is 160, if used more than that, it will be counted as more than one SMS [Optional]
912
+ @options data {String} bat: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Optional]
913
+ @options data {Array} listid: hese are the list ids to which the SMS campaign is sent [Mandatory: if scheduled_date is not empty]
914
+ @options data {Array} exclude_list: These are the list ids which will be excluded from the SMS campaign [Optional]
915
+ @options data {String} scheduled_date: The day on which the SMS campaign is supposed to run [Optional]
916
+ @options data {Integer} send_now: Flag to send campaign now. Possible values = 0 (default) & 1. send_now = 0 means campaign can’t be send now, & send_now = 1 means campaign ready to send now [Optional]
917
+ */
918
+ public function update_sms_campaign($data)
919
+ {
920
+ $id = $data['id'];
921
+ unset($data['id']);
922
+ return $this->put("sms/".$id,json_encode($data));
923
+ }
924
+
925
+ /*
926
+ Send a Test SMS.
927
+ @param {Array} data contains php array with key value pair.
928
+ @options data {Integer} id: Id of the SMS campaign [Mandatory]
929
+ @options data {String} to: Mobile number with the country code to send test SMS. The mobile number defined here should belong to one of your contacts in SendinBlue account and should not be blacklisted [Mandatory]
930
+ */
931
+ public function send_bat_sms($data)
932
+ {
933
+ $id = $data['id'];
934
+ unset($data['id']);
935
+ return $this->get("sms/".$id,json_encode($data));
936
+ }
937
+
938
+ }
939
+ ?>
pirate-forms.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pirate Forms - Contact form and SMTP Plugin
4
  Plugin URI: http://themeisle.com/plugins/pirate-forms/
5
  Description: Easily creates a nice looking, simple contact form on your WP site.
6
- Version: 1.0.5
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  Text Domain: pirate-forms
@@ -19,6 +19,7 @@ if ( ! function_exists( 'add_action' ) ) {
19
  /* Important constants */
20
  define( 'PIRATE_FORMS_VERSION', '1.0.0' );
21
  define( 'PIRATE_FORMS_URL', plugin_dir_url( __FILE__ ) );
 
22
 
23
  /* Required helper functions */
24
  include_once( dirname( __FILE__ ) . '/inc/helpers.php' );
@@ -74,45 +75,45 @@ function pirate_forms_display_form( $atts, $content = NULL ) {
74
  $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
75
 
76
  if( !empty($pirate_forms_options) ):
77
-
78
  /* Count the number of requested fields from Name, Email and Subject to add a certain class col-12, col-6 or col-4 */
79
  $pirate_forms_required_fields = 0;
80
-
81
  if( !empty($pirate_forms_options['pirateformsopt_name_field']) && !empty($pirate_forms_options['pirateformsopt_label_name']) ):
82
 
83
  $pirateformsopt_name_field = $pirate_forms_options['pirateformsopt_name_field'];
84
  $pirateformsopt_name_label = $pirate_forms_options['pirateformsopt_label_name'];
85
-
86
  if ( !empty($pirateformsopt_name_field) && !empty($pirateformsopt_name_label) && ($pirateformsopt_name_field != '') ):
87
  $pirate_forms_required_fields++;
88
  endif;
89
-
90
- endif;
91
 
92
  if( !empty($pirate_forms_options['pirateformsopt_email_field']) && !empty($pirate_forms_options['pirateformsopt_label_email']) ):
93
 
94
  $pirateformsopt_email_field = $pirate_forms_options['pirateformsopt_email_field'];
95
  $pirateformsopt_email_label = $pirate_forms_options['pirateformsopt_label_email'];
96
-
97
  if ( !empty($pirateformsopt_email_field) && !empty($pirateformsopt_email_label) && ($pirateformsopt_email_field != '') ):
98
  $pirate_forms_required_fields++;
99
  endif;
100
 
101
- endif;
102
 
103
  if( !empty($pirate_forms_options['pirateformsopt_subject_field']) && !empty($pirate_forms_options['pirateformsopt_label_subject']) ):
104
 
105
  $pirateformsopt_subject_field = $pirate_forms_options['pirateformsopt_subject_field'];
106
  $pirateformsopt_subject_label = $pirate_forms_options['pirateformsopt_label_subject'];
107
-
108
  if ( !empty($pirateformsopt_subject_field) && !empty($pirateformsopt_subject_label) && ($pirateformsopt_subject_field != '') ):
109
  $pirate_forms_required_fields++;
110
  endif;
111
 
112
  endif;
113
-
114
  $pirate_forms_layout_input = '';
115
-
116
  switch ($pirate_forms_required_fields) {
117
  case 1:
118
  $pirate_forms_layout_input = 'col-lg-12 col-sm-12';
@@ -203,7 +204,7 @@ function pirate_forms_display_form( $atts, $content = NULL ) {
203
  ),
204
  'pirate-forms-contact-subject'
205
  );
206
-
207
  endif;
208
 
209
  /********************************/
@@ -376,7 +377,7 @@ function pirate_forms_process_contact() {
376
  /***********************************************/
377
  /******* Sanitize and validate email **********/
378
  /***********************************************/
379
-
380
  $pirate_forms_contact_email = isset( $_POST['pirate-forms-contact-email'] ) ? sanitize_email( $_POST['pirate-forms-contact-email'] ) : '';
381
 
382
  // If required, is it valid?
@@ -517,7 +518,7 @@ function pirate_forms_process_contact() {
517
  $send_from = pirate_forms_from_email();
518
  endif;
519
  $send_from_name = $site_name;
520
-
521
 
522
  // Sent an email notification to the correct address
523
  $headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>";
@@ -719,7 +720,7 @@ function pirate_forms_add_settings_link( $links ) {
719
  if (function_exists('array_unshift')):
720
  array_unshift( $links, $settings_link );
721
  else:
722
- array_push( $links, $settings_link );
723
  endif;
724
  return $links;
725
  }
3
  Plugin Name: Pirate Forms - Contact form and SMTP Plugin
4
  Plugin URI: http://themeisle.com/plugins/pirate-forms/
5
  Description: Easily creates a nice looking, simple contact form on your WP site.
6
+ Version: 1.0.6
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  Text Domain: pirate-forms
19
  /* Important constants */
20
  define( 'PIRATE_FORMS_VERSION', '1.0.0' );
21
  define( 'PIRATE_FORMS_URL', plugin_dir_url( __FILE__ ) );
22
+ define( 'PIRATE_FORMS_PATH', plugin_dir_path( __FILE__ ) );
23
 
24
  /* Required helper functions */
25
  include_once( dirname( __FILE__ ) . '/inc/helpers.php' );
75
  $pirate_forms_options = get_option( 'pirate_forms_settings_array' );
76
 
77
  if( !empty($pirate_forms_options) ):
78
+
79
  /* Count the number of requested fields from Name, Email and Subject to add a certain class col-12, col-6 or col-4 */
80
  $pirate_forms_required_fields = 0;
81
+
82
  if( !empty($pirate_forms_options['pirateformsopt_name_field']) && !empty($pirate_forms_options['pirateformsopt_label_name']) ):
83
 
84
  $pirateformsopt_name_field = $pirate_forms_options['pirateformsopt_name_field'];
85
  $pirateformsopt_name_label = $pirate_forms_options['pirateformsopt_label_name'];
86
+
87
  if ( !empty($pirateformsopt_name_field) && !empty($pirateformsopt_name_label) && ($pirateformsopt_name_field != '') ):
88
  $pirate_forms_required_fields++;
89
  endif;
90
+
91
+ endif;
92
 
93
  if( !empty($pirate_forms_options['pirateformsopt_email_field']) && !empty($pirate_forms_options['pirateformsopt_label_email']) ):
94
 
95
  $pirateformsopt_email_field = $pirate_forms_options['pirateformsopt_email_field'];
96
  $pirateformsopt_email_label = $pirate_forms_options['pirateformsopt_label_email'];
97
+
98
  if ( !empty($pirateformsopt_email_field) && !empty($pirateformsopt_email_label) && ($pirateformsopt_email_field != '') ):
99
  $pirate_forms_required_fields++;
100
  endif;
101
 
102
+ endif;
103
 
104
  if( !empty($pirate_forms_options['pirateformsopt_subject_field']) && !empty($pirate_forms_options['pirateformsopt_label_subject']) ):
105
 
106
  $pirateformsopt_subject_field = $pirate_forms_options['pirateformsopt_subject_field'];
107
  $pirateformsopt_subject_label = $pirate_forms_options['pirateformsopt_label_subject'];
108
+
109
  if ( !empty($pirateformsopt_subject_field) && !empty($pirateformsopt_subject_label) && ($pirateformsopt_subject_field != '') ):
110
  $pirate_forms_required_fields++;
111
  endif;
112
 
113
  endif;
114
+
115
  $pirate_forms_layout_input = '';
116
+
117
  switch ($pirate_forms_required_fields) {
118
  case 1:
119
  $pirate_forms_layout_input = 'col-lg-12 col-sm-12';
204
  ),
205
  'pirate-forms-contact-subject'
206
  );
207
+
208
  endif;
209
 
210
  /********************************/
377
  /***********************************************/
378
  /******* Sanitize and validate email **********/
379
  /***********************************************/
380
+
381
  $pirate_forms_contact_email = isset( $_POST['pirate-forms-contact-email'] ) ? sanitize_email( $_POST['pirate-forms-contact-email'] ) : '';
382
 
383
  // If required, is it valid?
518
  $send_from = pirate_forms_from_email();
519
  endif;
520
  $send_from_name = $site_name;
521
+
522
 
523
  // Sent an email notification to the correct address
524
  $headers = "From: $send_from_name <$send_from>\r\nReply-To: $pirate_forms_contact_name <$pirate_forms_contact_email>";
720
  if (function_exists('array_unshift')):
721
  array_unshift( $links, $settings_link );
722
  else:
723
+ array_push( $links, $settings_link );
724
  endif;
725
  return $links;
726
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: themeisle, codeinwp
3
  Tags: Attachment, cnotact, conact, contact, contact button, contact form, contact form plugin, contact me, contacts, contacts form plugin, contatc, copy, email submit form, email subscription, feedback, feedback form, form, insert the shortcode, message form, post feedback, request, send, send copy, send messages, shortcode, text, web-page feedback,smtp,recaptcha
4
  Requires at least: 3.0
5
- Tested up to: 4.3
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
2
  Contributors: themeisle, codeinwp
3
  Tags: Attachment, cnotact, conact, contact, contact button, contact form, contact form plugin, contact me, contacts, contacts form plugin, contatc, copy, email submit form, email subscription, feedback, feedback form, form, insert the shortcode, message form, post feedback, request, send, send copy, send messages, shortcode, text, web-page feedback,smtp,recaptcha
4
  Requires at least: 3.0
5
+ Tested up to: 4.4
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8