Version Description
- Enhanced the plugins to be compatible upto PHP version 8
- Enhanced the plugin to be compatible upto Wordpress version 5.8
Download this release
Release Info
Developer | amarsib |
Plugin | SendinBlue Subscribe Form And WP SMTP |
Version | 3.1.16 |
Comparing to | |
See all releases |
Code changes from version 3.1.15 to 3.1.16
- inc/SendinblueApiClient.php +1 -1
- inc/sib-api-manager.php +86 -74
- model/model-users.php +14 -2
- readme.txt +6 -1
- sendinblue.php +5 -5
inc/SendinblueApiClient.php
CHANGED
@@ -14,7 +14,7 @@ class SendinblueApiClient
|
|
14 |
const RESPONSE_CODE_CREATED = 201;
|
15 |
const RESPONSE_CODE_ACCEPTED = 202;
|
16 |
const RESPONSE_CODE_UNAUTHORIZED = 401;
|
17 |
-
const PLUGIN_VERSION = '3.1.
|
18 |
const USER_AGENT = 'sendinblue_plugins/wordpress';
|
19 |
|
20 |
private $apiKey;
|
14 |
const RESPONSE_CODE_CREATED = 201;
|
15 |
const RESPONSE_CODE_ACCEPTED = 202;
|
16 |
const RESPONSE_CODE_UNAUTHORIZED = 401;
|
17 |
+
const PLUGIN_VERSION = '3.1.19';
|
18 |
const USER_AGENT = 'sendinblue_plugins/wordpress';
|
19 |
|
20 |
private $apiKey;
|
inc/sib-api-manager.php
CHANGED
@@ -297,7 +297,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
297 |
* @param array $list_id - list ids.
|
298 |
* @return array
|
299 |
*/
|
300 |
-
static function validation_email( $res, $type = 'simple'
|
301 |
|
302 |
$isDopted = false;
|
303 |
|
@@ -366,11 +366,11 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
366 |
* @param null $list_unlink - remove temp list.
|
367 |
* @return string
|
368 |
*/
|
369 |
-
public static function create_subscriber( $
|
370 |
$mailin = new SendinblueApiClient();
|
371 |
$user = $mailin->getUser($email);
|
372 |
|
373 |
-
$response = self::validation_email( $user, $
|
374 |
$exist = '';
|
375 |
|
376 |
if ( 'already_exist' == $response['code'] ) {
|
@@ -505,7 +505,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
505 |
* @param null $attributes - attributes.
|
506 |
* @param string $code - code.
|
507 |
*/
|
508 |
-
public static function send_comfirm_email( $type = 'confirm', $
|
509 |
$mailin = new SendinblueApiClient();
|
510 |
|
511 |
// set subject info.
|
@@ -677,11 +677,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
677 |
/**
|
678 |
* Subscribe process for double optin subscribers
|
679 |
*/
|
680 |
-
public static function subscribe() {
|
681 |
-
$code = isset( $_GET['code'] ) ? sanitize_text_field( $_GET['code'] ) : '';
|
682 |
-
|
683 |
-
$contact_info = SIB_Model_Users::get_data_by_code( $code );
|
684 |
-
|
685 |
if ( false != $contact_info ) {
|
686 |
$email = $contact_info['email'];
|
687 |
$info = maybe_unserialize( $contact_info['info'] );
|
@@ -696,14 +692,14 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
696 |
}
|
697 |
if ( '1' == $current_form['isDopt'] )
|
698 |
{
|
699 |
-
SIB_API_Manager::send_comfirm_email( 'confirm', $
|
700 |
}
|
701 |
|
702 |
if( $unlinkedLists != null ) {
|
703 |
-
self::create_subscriber(
|
704 |
}
|
705 |
else {
|
706 |
-
self::create_subscriber(
|
707 |
}
|
708 |
|
709 |
}
|
@@ -713,68 +709,8 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
713 |
exit;
|
714 |
}
|
715 |
|
716 |
-
$
|
717 |
-
|
718 |
-
?>
|
719 |
-
<body style="margin:0; padding:0;">
|
720 |
-
<table style="background-color:#ffffff" cellpadding="0" cellspacing="0" border="0" width="100%">
|
721 |
-
<tbody>
|
722 |
-
<tr style="border-collapse:collapse;">
|
723 |
-
<td style="border-collapse:collapse;" align="center">
|
724 |
-
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
725 |
-
<tbody>
|
726 |
-
<tr>
|
727 |
-
<td style="line-height:0; font-size:0;" height="20"></td>
|
728 |
-
</tr>
|
729 |
-
</tbody>
|
730 |
-
</table>
|
731 |
-
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
732 |
-
<tbody>
|
733 |
-
<tr>
|
734 |
-
<td style="line-height:0; font-size:0;" height="20">
|
735 |
-
<div
|
736 |
-
style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
737 |
-
<?php esc_attr_e( 'Thank you for subscribing', 'sib_lang' ); ?></div>
|
738 |
-
</td>
|
739 |
-
</tr>
|
740 |
-
</tbody>
|
741 |
-
</table>
|
742 |
-
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
743 |
-
<tbody>
|
744 |
-
<tr>
|
745 |
-
<td style="line-height:0; font-size:0;" height="20"></td>
|
746 |
-
</tr>
|
747 |
-
</tbody>
|
748 |
-
</table>
|
749 |
-
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
750 |
-
<tbody>
|
751 |
-
<tr>
|
752 |
-
<td align="left">
|
753 |
-
|
754 |
-
<div
|
755 |
-
style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
756 |
-
<br>
|
757 |
-
<?php echo esc_attr__( 'You have just subscribed to the newsletter of ', 'sib_lang' ) . esc_attr( $site_domain ) . ' .'; ?>
|
758 |
-
<br><br>
|
759 |
-
<?php esc_attr_e( '-Sendinblue', 'sib_lang' ); ?></div>
|
760 |
-
</td>
|
761 |
-
</tr>
|
762 |
-
</tbody>
|
763 |
-
</table>
|
764 |
-
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
765 |
-
<tbody>
|
766 |
-
<tr>
|
767 |
-
<td style="line-height:0; font-size:0;" height="20">
|
768 |
-
</td>
|
769 |
-
</tr>
|
770 |
-
</tbody>
|
771 |
-
</table>
|
772 |
-
</td>
|
773 |
-
</tr>
|
774 |
-
</tbody>
|
775 |
-
</table>
|
776 |
-
</body>
|
777 |
-
<?php
|
778 |
exit;
|
779 |
}
|
780 |
|
@@ -910,5 +846,81 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
|
|
910 |
}
|
911 |
}
|
912 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
913 |
}
|
914 |
}
|
297 |
* @param array $list_id - list ids.
|
298 |
* @return array
|
299 |
*/
|
300 |
+
static function validation_email( $res, $email, $list_id, $type = 'simple' ) {
|
301 |
|
302 |
$isDopted = false;
|
303 |
|
366 |
* @param null $list_unlink - remove temp list.
|
367 |
* @return string
|
368 |
*/
|
369 |
+
public static function create_subscriber( $email, $list_id, $info, $type = 'simple', $list_unlink = null ) {
|
370 |
$mailin = new SendinblueApiClient();
|
371 |
$user = $mailin->getUser($email);
|
372 |
|
373 |
+
$response = self::validation_email( $user, $email, $list_id, $type );
|
374 |
$exist = '';
|
375 |
|
376 |
if ( 'already_exist' == $response['code'] ) {
|
505 |
* @param null $attributes - attributes.
|
506 |
* @param string $code - code.
|
507 |
*/
|
508 |
+
public static function send_comfirm_email( $to_email, $type = 'confirm', $template_id = '-1', $attributes = null, $code = '' ) {
|
509 |
$mailin = new SendinblueApiClient();
|
510 |
|
511 |
// set subject info.
|
677 |
/**
|
678 |
* Subscribe process for double optin subscribers
|
679 |
*/
|
680 |
+
public static function subscribe( $contact_info ) {
|
|
|
|
|
|
|
|
|
681 |
if ( false != $contact_info ) {
|
682 |
$email = $contact_info['email'];
|
683 |
$info = maybe_unserialize( $contact_info['info'] );
|
692 |
}
|
693 |
if ( '1' == $current_form['isDopt'] )
|
694 |
{
|
695 |
+
SIB_API_Manager::send_comfirm_email( $email, 'confirm', $current_form['confirmID'], $info );
|
696 |
}
|
697 |
|
698 |
if( $unlinkedLists != null ) {
|
699 |
+
self::create_subscriber( $email, $list_id, $info, 'subscribe', $unlinkedLists );
|
700 |
}
|
701 |
else {
|
702 |
+
self::create_subscriber( $email, $list_id, $info, 'subscribe' );
|
703 |
}
|
704 |
|
705 |
}
|
709 |
exit;
|
710 |
}
|
711 |
|
712 |
+
$type = 'Subscribe';
|
713 |
+
self::template_subscribe( $type );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
exit;
|
715 |
}
|
716 |
|
846 |
}
|
847 |
}
|
848 |
}
|
849 |
+
|
850 |
+
/** Template for subscriber and bot event using $type */
|
851 |
+
public static function template_subscribe( $type ) {
|
852 |
+
$site_domain = str_replace( 'https://', '', home_url() );
|
853 |
+
$site_domain = str_replace( 'http://', '', $site_domain );
|
854 |
+
?>
|
855 |
+
<body style="margin:0; padding:0;">
|
856 |
+
<table style="background-color:#ffffff" cellpadding="0" cellspacing="0" border="0" width="100%">
|
857 |
+
<tbody>
|
858 |
+
<tr style="border-collapse:collapse;">
|
859 |
+
<td style="border-collapse:collapse;" align="center">
|
860 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
861 |
+
<tbody>
|
862 |
+
<tr>
|
863 |
+
<td style="line-height:0; font-size:0;" height="20"></td>
|
864 |
+
</tr>
|
865 |
+
</tbody>
|
866 |
+
</table>
|
867 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
868 |
+
<tbody>
|
869 |
+
<tr>
|
870 |
+
<td style="line-height:0; font-size:0;" height="20">
|
871 |
+
<div
|
872 |
+
style="font-family:arial,sans-serif; color:#61a6f3; font-size:20px; font-weight:bold; line-height:28px;">
|
873 |
+
<?php
|
874 |
+
if ( 'Subscribe' === $type ) {
|
875 |
+
esc_attr_e( 'Thank you for subscribing', 'sib_lang' );
|
876 |
+
} elseif ( 'Bot Event' === $type ) {
|
877 |
+
esc_attr_e( 'Please Try Again', 'sib_lang' );
|
878 |
+
}
|
879 |
+
?>
|
880 |
+
</div>
|
881 |
+
</td>
|
882 |
+
</tr>
|
883 |
+
</tbody>
|
884 |
+
</table>
|
885 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
886 |
+
<tbody>
|
887 |
+
<tr>
|
888 |
+
<td style="line-height:0; font-size:0;" height="20"></td>
|
889 |
+
</tr>
|
890 |
+
</tbody>
|
891 |
+
</table>
|
892 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
893 |
+
<tbody>
|
894 |
+
<tr>
|
895 |
+
<td align="left">
|
896 |
+
|
897 |
+
<div
|
898 |
+
style="font-family:arial,sans-serif; font-size:14px; margin:0; line-height:24px; color:#555555;">
|
899 |
+
<br>
|
900 |
+
<?php
|
901 |
+
if ( 'Subscribe' === $type ) {
|
902 |
+
echo esc_attr__( 'You have just subscribed to the newsletter of ', 'sib_lang' ) . esc_attr( $site_domain ) . ' .'; }
|
903 |
+
?>
|
904 |
+
<br><br>
|
905 |
+
<?php esc_attr_e( '-Sendinblue', 'sib_lang' ); ?></div>
|
906 |
+
</td>
|
907 |
+
</tr>
|
908 |
+
</tbody>
|
909 |
+
</table>
|
910 |
+
<table cellpadding="0" cellspacing="0" border="0" width="540">
|
911 |
+
<tbody>
|
912 |
+
<tr>
|
913 |
+
<td style="line-height:0; font-size:0;" height="20">
|
914 |
+
</td>
|
915 |
+
</tr>
|
916 |
+
</tbody>
|
917 |
+
</table>
|
918 |
+
</td>
|
919 |
+
</tr>
|
920 |
+
</tbody>
|
921 |
+
</table>
|
922 |
+
</body>
|
923 |
+
<?php
|
924 |
+
}
|
925 |
}
|
926 |
}
|
model/model-users.php
CHANGED
@@ -38,6 +38,7 @@ class SIB_Model_Users {
|
|
38 |
`redirectUrl` varchar(255),
|
39 |
`info` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
|
40 |
`frmid` int(2),
|
|
|
41 |
PRIMARY KEY (`id`)
|
42 |
);';
|
43 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
@@ -122,7 +123,7 @@ class SIB_Model_Users {
|
|
122 |
$data[$key] = esc_sql($value);
|
123 |
}
|
124 |
|
125 |
-
|
126 |
$wpdb->query( $query ); // db call ok; no-cache ok.
|
127 |
$index = $wpdb->get_var( 'SELECT LAST_INSERT_ID();' ); // db call ok; no-cache ok.
|
128 |
|
@@ -233,4 +234,15 @@ class SIB_Model_Users {
|
|
233 |
}
|
234 |
}
|
235 |
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
`redirectUrl` varchar(255),
|
39 |
`info` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci,
|
40 |
`frmid` int(2),
|
41 |
+
`user_added_date` DATETIME NOT NULL,
|
42 |
PRIMARY KEY (`id`)
|
43 |
);';
|
44 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
123 |
$data[$key] = esc_sql($value);
|
124 |
}
|
125 |
|
126 |
+
$query = $wpdb->prepare('INSERT INTO ' . $wpdb->prefix . self::TABLE_NAME . ' (email,code,info,frmid,listIDs,redirectUrl,user_added_date) VALUES (%s, %s, %s, %d, %s, %s, %s) ',array( $data["email"], $data["code"], $data["info"], $data["frmid"], $data["listIDs"], $data["redirectUrl"], $data["user_added_date"] ));
|
127 |
$wpdb->query( $query ); // db call ok; no-cache ok.
|
128 |
$index = $wpdb->get_var( 'SELECT LAST_INSERT_ID();' ); // db call ok; no-cache ok.
|
129 |
|
234 |
}
|
235 |
}
|
236 |
|
237 |
+
/** Add column to the table */
|
238 |
+
public static function add_user_added_date_column() {
|
239 |
+
global $wpdb;
|
240 |
+
$row = $wpdb->get_results( "SELECT 'user_added_date' FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '" . $wpdb->prefix . self::TABLE_NAME . "' AND column_name = 'user_added_date'" );
|
241 |
+
|
242 |
+
if ( empty( $row ) ) {
|
243 |
+
$query = 'ALTER TABLE ' . $wpdb->prefix . self::TABLE_NAME . ' ADD user_added_date DATETIME NOT NULL';
|
244 |
+
$wpdb->query( $query );
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
readme.txt
CHANGED
@@ -2,7 +2,8 @@
|
|
2 |
Contributors: neeraj_slit
|
3 |
Tags: sendinblue, marketing automation, email marketing, email campaign, newsletter, wordpress smtp, subscription form, phpmailer, SMTP, wp_mail, massive email, sendmail, ssl, tls, wp-phpmailer, mail smtp, mailchimp, newsletters, email plugin, signup form, email widget, widget, plugin, sidebar, shortcode
|
4 |
Requires at least: 4.4
|
5 |
-
Tested up to: 5.
|
|
|
6 |
Stable tag: trunk
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -115,6 +116,10 @@ In order to create a signup form, you need to:
|
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
118 |
= 3.1.15 =
|
119 |
**Improvements**
|
120 |
|
2 |
Contributors: neeraj_slit
|
3 |
Tags: sendinblue, marketing automation, email marketing, email campaign, newsletter, wordpress smtp, subscription form, phpmailer, SMTP, wp_mail, massive email, sendmail, ssl, tls, wp-phpmailer, mail smtp, mailchimp, newsletters, email plugin, signup form, email widget, widget, plugin, sidebar, shortcode
|
4 |
Requires at least: 4.4
|
5 |
+
Tested up to: 5.8
|
6 |
+
Requires PHP: 5.6
|
7 |
Stable tag: trunk
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 3.1.16 =
|
120 |
+
* Enhanced the plugins to be compatible upto PHP version 8
|
121 |
+
* Enhanced the plugin to be compatible upto Wordpress version 5.8
|
122 |
+
|
123 |
= 3.1.15 =
|
124 |
**Improvements**
|
125 |
|
sendinblue.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
|
4 |
* Plugin URI: https://www.sendinblue.com/?r=wporg
|
5 |
* Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
|
6 |
-
* Version: 3.1.
|
7 |
* Author: Sendinblue
|
8 |
* Author URI: https://www.sendinblue.com/?r=wporg
|
9 |
* License: GPLv2 or later
|
@@ -732,16 +732,16 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
|
|
732 |
if ( 'success' == $result ) {
|
733 |
// Add a recode with activate code in db.
|
734 |
$activateCode = $this->create_activate_code( $email, $info, $formID, $listID, $redirectUrlInEmail, $unlinkedLists );
|
735 |
-
SIB_API_Manager::send_comfirm_email( 'double-optin', $
|
736 |
}
|
737 |
} elseif ( $isOptin ) {
|
738 |
-
$result = SIB_API_Manager::create_subscriber(
|
739 |
if ( 'success' == $result ) {
|
740 |
// Send a confirm email.
|
741 |
-
SIB_API_Manager::send_comfirm_email( 'confirm', $
|
742 |
}
|
743 |
} else {
|
744 |
-
$result = SIB_API_Manager::create_subscriber(
|
745 |
}
|
746 |
$msg = array(
|
747 |
'successMsg' => $formData['successMsg'],
|
3 |
* Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
|
4 |
* Plugin URI: https://www.sendinblue.com/?r=wporg
|
5 |
* Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
|
6 |
+
* Version: 3.1.16
|
7 |
* Author: Sendinblue
|
8 |
* Author URI: https://www.sendinblue.com/?r=wporg
|
9 |
* License: GPLv2 or later
|
732 |
if ( 'success' == $result ) {
|
733 |
// Add a recode with activate code in db.
|
734 |
$activateCode = $this->create_activate_code( $email, $info, $formID, $listID, $redirectUrlInEmail, $unlinkedLists );
|
735 |
+
SIB_API_Manager::send_comfirm_email( $email, 'double-optin', $templateID, $info, $activateCode );
|
736 |
}
|
737 |
} elseif ( $isOptin ) {
|
738 |
+
$result = SIB_API_Manager::create_subscriber( $email, $listID, $info, 'confirm', $unlinkedLists );
|
739 |
if ( 'success' == $result ) {
|
740 |
// Send a confirm email.
|
741 |
+
SIB_API_Manager::send_comfirm_email( $email, 'confirm', $templateID, $info );
|
742 |
}
|
743 |
} else {
|
744 |
+
$result = SIB_API_Manager::create_subscriber( $email, $listID, $info, 'simple', $unlinkedLists );
|
745 |
}
|
746 |
$msg = array(
|
747 |
'successMsg' => $formData['successMsg'],
|