BlossomThemes Email Newsletter - Version 2.1.2

Version Description

Download this release

Release Info

Developer blossomthemes
Plugin Icon 128x128 BlossomThemes Email Newsletter
Version 2.1.2
Comparing to
See all releases

Code changes from version 2.1.1 to 2.1.2

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: subscribe, newsletter, email
5
  Requires at least: 4.3
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
- Stable tag: 2.1.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -17,7 +17,7 @@ BlossomThemes Email Newsletter allows you to add email subscription form on your
17
 
18
  Adding Subscription Form has never been this easy. Choose an email platform, enter your API key, choose an email list, and start getting new subscribers to your website.
19
 
20
- **The plugin supports MailChimp, MailerLite, ConvertKit, GetResponse, ActiveCampaign, AWeber.**
21
 
22
  You can create any number of Newsletter forms and display them using a shortcode, popup and/or a widget.
23
 
@@ -26,7 +26,7 @@ Once installed, the plugin page will appear on the Admin dashboard.
26
  = Key Features and Highlights =
27
 
28
  * Unlimited newsletters and subscribers with statistics
29
- * Supports MailChimp, MailerLite, ConvertKit, GetResponse, ActiveCampaign and AWeber
30
  * Display newsletter forms using a shortcode, popup and/or a widget
31
  * Lists/Campaigns updates via AJAX
32
  * Multi-list or single-list targeting in individual newsletter
@@ -49,6 +49,19 @@ Once installed, the plugin page will appear on the Admin dashboard.
49
 
50
  = 2.1.1 =
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  Released on: 23rd April, 2020
53
 
54
  Fixes:
5
  Requires at least: 4.3
6
  Tested up to: 5.5
7
  Requires PHP: 5.6
8
+ Stable tag: 2.1.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
17
 
18
  Adding Subscription Form has never been this easy. Choose an email platform, enter your API key, choose an email list, and start getting new subscribers to your website.
19
 
20
+ **The plugin supports Sendinblue, MailChimp, MailerLite, ConvertKit, GetResponse, ActiveCampaign, AWeber.**
21
 
22
  You can create any number of Newsletter forms and display them using a shortcode, popup and/or a widget.
23
 
26
  = Key Features and Highlights =
27
 
28
  * Unlimited newsletters and subscribers with statistics
29
+ * Supports Sendinblue, MailChimp, MailerLite, ConvertKit, GetResponse, ActiveCampaign and AWeber
30
  * Display newsletter forms using a shortcode, popup and/or a widget
31
  * Lists/Campaigns updates via AJAX
32
  * Multi-list or single-list targeting in individual newsletter
49
 
50
  = 2.1.1 =
51
 
52
+ Released on: 28th August, 2020
53
+
54
+ Enhancements:
55
+
56
+ * Sendinblue support added.
57
+ * WordPress 5.5. compatibility test.
58
+
59
+ Fixes:
60
+
61
+ * Minor bug fixes.
62
+
63
+ = 2.1.1 =
64
+
65
  Released on: 23rd April, 2020
66
 
67
  Fixes:
admin/js/bten-mailing-platform-lists.js CHANGED
@@ -1,155 +1,204 @@
1
- jQuery(document).ready(function(){
2
-
3
- //MailChimp Lists
4
- jQuery('body').on('click', '.bten_get_mailchimp_lists', function(e){
5
- ListsSelect=jQuery('#'+jQuery(this).attr('rel-id'));
6
- ListsSelect.find('option').remove();
7
- jQuery("<option/>").val(0).text('Loading...').appendTo(ListsSelect);
8
- jQuery.ajax({
9
- url: ajaxurl,
10
- data:{
11
- 'action': 'bten_get_mailing_list',
12
- 'calling_action': 'bten_mailchimp_list',
13
- 'bten_mc_api_key': jQuery('#bten_mailchimp_api_key').val()
14
- },
15
- dataType: 'JSON',
16
- type: 'POST',
17
- success:function(response){
18
- ListsSelect.find('option').remove();
19
- jQuery.each(response, function(i, option)
20
- {
21
- if(option.name){
22
- jQuery("<option/>").val(option.id).text(option.name).appendTo(ListsSelect);
23
- }
24
- else{
25
- jQuery("<option/>").val(i).text("No Lists Found").appendTo(ListsSelect);
26
- }
27
-
28
- });
29
- },
30
- error: function(errorThrown){
31
- alert('Error...');
32
- }
33
- });
34
- });
35
-
36
- //MailerLite Lists
37
- jQuery('body').on('click', '.bten_get_mailerlite_lists', function(e){
38
- ListsSelect=jQuery('#'+jQuery(this).attr('rel-id'));
39
- ListsSelect.find('option').remove();
40
- jQuery("<option/>").val(0).text('Loading...').appendTo(ListsSelect);
41
- jQuery.ajax({
42
- url: ajaxurl,
43
- data:{
44
- 'action': 'bten_get_mailing_list',
45
- 'calling_action': 'bten_mailerlite_list',
46
- 'bten_ml_api_key': jQuery('#bten_mailerlite_api_key').val()
47
- },
48
- dataType: 'JSON',
49
- type: 'POST',
50
- success:function(response){
51
- ListsSelect.find('option').remove();
52
- jQuery.each(response, function(i, option)
53
- {
54
- if(option.name){
55
- jQuery("<option/>").val(option.id).text(option.name).appendTo(ListsSelect);
56
- }
57
- else{
58
- jQuery("<option/>").val(i).text("No Lists Found").appendTo(ListsSelect);
59
- }
60
- });
61
- },
62
- error: function(errorThrown){
63
- alert('Error...');
64
- }
65
- });
66
- });
67
-
68
- //ConvertKit Lists
69
- jQuery('body').on('click', '.bten_get_convertkit_lists', function(e){
70
- ListsSelect=jQuery('#'+jQuery(this).attr('rel-id'));
71
- ListsSelect.find('option').remove();
72
- jQuery("<option/>").val(0).text('Loading...').appendTo(ListsSelect);
73
- jQuery.ajax({
74
- url: ajaxurl,
75
- data:{
76
- 'action': 'bten_get_mailing_list',
77
- 'calling_action': 'bten_convertkit_list',
78
- 'bten_ck_api_key': jQuery('#bten_convertkit_api_key').val()
79
- },
80
- dataType: 'JSON',
81
- type: 'POST',
82
- success:function(response){
83
- ListsSelect.find('option').remove();
84
- jQuery.each(response, function(i, option)
85
- {
86
- jQuery("<option/>").val(i).text(option.name).appendTo(ListsSelect);
87
- });
88
- },
89
- error: function(errorThrown){
90
- alert('Error...');
91
- }
92
- });
93
- });
94
-
95
- //GetResponse Lists
96
- jQuery('body').on('click', '.bten_get_getresponse_lists', function(e){
97
- ListsSelect=jQuery('#'+jQuery(this).attr('rel-id'));
98
- ListsSelect.find('option').remove();
99
- jQuery("<option/>").val(0).text('Loading...').appendTo(ListsSelect);
100
- jQuery.ajax({
101
- url: ajaxurl,
102
- data:{
103
- 'action': 'bten_get_mailing_list',
104
- 'calling_action': 'bten_getresponse_list',
105
- 'bten_gr_api_key': jQuery('#bten_getresponse_api_key').val()
106
- },
107
- dataType: 'JSON',
108
- type: 'POST',
109
- success:function(response){
110
- ListsSelect.find('option').remove();
111
- jQuery.each(response, function(i, option)
112
- {
113
- jQuery("<option/>").val(option.campaignId).text(option.name).appendTo(ListsSelect);
114
- });
115
- },
116
- error: function(errorThrown){
117
- ListsSelect.find('option').remove();
118
- jQuery("<option/>").val("-").text("No Lists Found").appendTo(ListsSelect);
119
- alert('Error: Invalid API key');
120
- }
121
- });
122
- });
123
-
124
- //ActiveCampaign Lists
125
- jQuery('body').on('click', '.bten_get_activecampaign_lists', function(e){
126
- ListsSelect=jQuery('#'+jQuery(this).attr('rel-id'));
127
- ListsSelect.find('option').remove();
128
- jQuery("<option/>").val(0).text('Loading...').appendTo(ListsSelect);
129
- jQuery.ajax({
130
- url: ajaxurl,
131
- data:{
132
- 'action': 'bten_get_mailing_list',
133
- 'calling_action': 'bten_activecampaign_list',
134
- 'bten_ac_api_url': jQuery('#bten_activecampaign_api_url').val(),
135
- 'bten_ac_api_key': jQuery('#bten_activecampaign_api_key').val()
136
- },
137
- dataType: 'JSON',
138
- type: 'POST',
139
- success:function(response){
140
- ListsSelect.find('option').remove();
141
- jQuery.each(response, function(i, option)
142
- {
143
- jQuery("<option/>").val(i).text(option.name).appendTo(ListsSelect);
144
- });
145
- },
146
- error: function(errorThrown){
147
- ListsSelect.find('option').remove();
148
- jQuery("<option/>").val("-").text("No Lists Found").appendTo(ListsSelect);
149
- alert('Error: Invalid API key or Url');
150
- }
151
- });
152
- });
153
-
154
-
155
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function () {
2
+ //MailChimp Lists
3
+ jQuery("body").on("click", ".bten_get_mailchimp_lists", function (e) {
4
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
5
+ ListsSelect.find("option").remove();
6
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
7
+ jQuery.ajax({
8
+ url: ajaxurl,
9
+ data: {
10
+ action: "bten_get_mailing_list",
11
+ calling_action: "bten_mailchimp_list",
12
+ bten_mc_api_key: jQuery("#bten_mailchimp_api_key").val(),
13
+ },
14
+ dataType: "JSON",
15
+ type: "POST",
16
+ success: function (response) {
17
+ ListsSelect.find("option").remove();
18
+ jQuery.each(response, function (i, option) {
19
+ if (option.name) {
20
+ jQuery("<option/>")
21
+ .val(option.id)
22
+ .text(option.name)
23
+ .appendTo(ListsSelect);
24
+ } else {
25
+ jQuery("<option/>")
26
+ .val(i)
27
+ .text("No Lists Found")
28
+ .appendTo(ListsSelect);
29
+ }
30
+ });
31
+ },
32
+ error: function (errorThrown) {
33
+ alert("Error...");
34
+ },
35
+ });
36
+ });
37
+
38
+ //MailerLite Lists
39
+ jQuery("body").on("click", ".bten_get_mailerlite_lists", function (e) {
40
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
41
+ ListsSelect.find("option").remove();
42
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
43
+ jQuery.ajax({
44
+ url: ajaxurl,
45
+ data: {
46
+ action: "bten_get_mailing_list",
47
+ calling_action: "bten_mailerlite_list",
48
+ bten_ml_api_key: jQuery("#bten_mailerlite_api_key").val(),
49
+ },
50
+ dataType: "JSON",
51
+ type: "POST",
52
+ success: function (response) {
53
+ ListsSelect.find("option").remove();
54
+ jQuery.each(response, function (i, option) {
55
+ if (option.name) {
56
+ jQuery("<option/>")
57
+ .val(option.id)
58
+ .text(option.name)
59
+ .appendTo(ListsSelect);
60
+ } else {
61
+ jQuery("<option/>")
62
+ .val(i)
63
+ .text("No Lists Found")
64
+ .appendTo(ListsSelect);
65
+ }
66
+ });
67
+ },
68
+ error: function (errorThrown) {
69
+ alert("Error...");
70
+ },
71
+ });
72
+ });
73
+
74
+ //ConvertKit Lists
75
+ jQuery("body").on("click", ".bten_get_convertkit_lists", function (e) {
76
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
77
+ ListsSelect.find("option").remove();
78
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
79
+ jQuery.ajax({
80
+ url: ajaxurl,
81
+ data: {
82
+ action: "bten_get_mailing_list",
83
+ calling_action: "bten_convertkit_list",
84
+ bten_ck_api_key: jQuery("#bten_convertkit_api_key").val(),
85
+ },
86
+ dataType: "JSON",
87
+ type: "POST",
88
+ success: function (response) {
89
+ ListsSelect.find("option").remove();
90
+ jQuery.each(response, function (i, option) {
91
+ jQuery("<option/>").val(i).text(option.name).appendTo(ListsSelect);
92
+ });
93
+ },
94
+ error: function (errorThrown) {
95
+ alert("Error...");
96
+ },
97
+ });
98
+ });
99
+
100
+ //GetResponse Lists
101
+ jQuery("body").on("click", ".bten_get_getresponse_lists", function (e) {
102
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
103
+ ListsSelect.find("option").remove();
104
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
105
+ jQuery.ajax({
106
+ url: ajaxurl,
107
+ data: {
108
+ action: "bten_get_mailing_list",
109
+ calling_action: "bten_getresponse_list",
110
+ bten_gr_api_key: jQuery("#bten_getresponse_api_key").val(),
111
+ },
112
+ dataType: "JSON",
113
+ type: "POST",
114
+ success: function (response) {
115
+ ListsSelect.find("option").remove();
116
+ jQuery.each(response, function (i, option) {
117
+ jQuery("<option/>")
118
+ .val(option.campaignId)
119
+ .text(option.name)
120
+ .appendTo(ListsSelect);
121
+ });
122
+ },
123
+ error: function (errorThrown) {
124
+ ListsSelect.find("option").remove();
125
+ jQuery("<option/>")
126
+ .val("-")
127
+ .text("No Lists Found")
128
+ .appendTo(ListsSelect);
129
+ alert("Error: Invalid API key");
130
+ },
131
+ });
132
+ });
133
+
134
+ //sendinblue Lists
135
+ jQuery("body").on("click", ".bten_get_sendinblue_lists", function (e) {
136
+ if ("" === jQuery("#bten_sendinblue_api_key").val()) {
137
+ alert("Please enter your API key first");
138
+ return false;
139
+ }
140
+
141
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
142
+ ListsSelect.find("option").remove();
143
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
144
+ jQuery.ajax({
145
+ url: ajaxurl,
146
+ data: {
147
+ action: "bten_get_mailing_list",
148
+ calling_action: "bten_sendinblue_list",
149
+ bten_sendin_api_key: jQuery("#bten_sendinblue_api_key").val(),
150
+ },
151
+ dataType: "JSON",
152
+ type: "POST",
153
+ success: function (response) {
154
+ ListsSelect.find("option").remove();
155
+ jQuery.each(response.data, function (i, option) {
156
+ jQuery("<option/>")
157
+ .val(option.id)
158
+ .text(option.name)
159
+ .appendTo(ListsSelect);
160
+ });
161
+ },
162
+ error: function (errorThrown) {
163
+ ListsSelect.find("option").remove();
164
+ jQuery("<option/>")
165
+ .val("-")
166
+ .text("No Lists Found")
167
+ .appendTo(ListsSelect);
168
+ alert("Error: Invalid API key");
169
+ },
170
+ });
171
+ });
172
+
173
+ //ActiveCampaign Lists
174
+ jQuery("body").on("click", ".bten_get_activecampaign_lists", function (e) {
175
+ ListsSelect = jQuery("#" + jQuery(this).attr("rel-id"));
176
+ ListsSelect.find("option").remove();
177
+ jQuery("<option/>").val(0).text("Loading...").appendTo(ListsSelect);
178
+ jQuery.ajax({
179
+ url: ajaxurl,
180
+ data: {
181
+ action: "bten_get_mailing_list",
182
+ calling_action: "bten_activecampaign_list",
183
+ bten_ac_api_url: jQuery("#bten_activecampaign_api_url").val(),
184
+ bten_ac_api_key: jQuery("#bten_activecampaign_api_key").val(),
185
+ },
186
+ dataType: "JSON",
187
+ type: "POST",
188
+ success: function (response) {
189
+ ListsSelect.find("option").remove();
190
+ jQuery.each(response, function (i, option) {
191
+ jQuery("<option/>").val(i).text(option.name).appendTo(ListsSelect);
192
+ });
193
+ },
194
+ error: function (errorThrown) {
195
+ ListsSelect.find("option").remove();
196
+ jQuery("<option/>")
197
+ .val("-")
198
+ .text("No Lists Found")
199
+ .appendTo(ListsSelect);
200
+ alert("Error: Invalid API key or Url");
201
+ },
202
+ });
203
+ });
204
+ });
blossomthemes-email-newsletter.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: BlossomThemes Email Newsletter
17
  * Plugin URI:
18
  * Description: Easily add email subscription form to your website using shortcode and widget.
19
- * Version: 2.1.1
20
  * Author: blossomthemes
21
  * Author URI: https://blossomthemes.com
22
  * License: GPL-2.0+
@@ -33,7 +33,7 @@ if ( ! defined( 'WPINC' ) ) {
33
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_PATH', __FILE__ );
34
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH', dirname( __FILE__ ) );
35
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
36
- define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_VERSION', '2.1.1' );
37
 
38
 
39
  /**
16
  * Plugin Name: BlossomThemes Email Newsletter
17
  * Plugin URI:
18
  * Description: Easily add email subscription form to your website using shortcode and widget.
19
+ * Version: 2.1.2
20
  * Author: blossomthemes
21
  * Author URI: https://blossomthemes.com
22
  * License: GPL-2.0+
33
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_PATH', __FILE__ );
34
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH', dirname( __FILE__ ) );
35
  define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL', rtrim( plugin_dir_url( __FILE__ ), '/' ) );
36
+ define( 'BLOSSOMTHEMES_EMAIL_NEWSLETTER_VERSION', '2.1.2' );
37
 
38
 
39
  /**
includes/class-blossomthemes-email-newsletter-functions.php CHANGED
@@ -1,314 +1,353 @@
1
- <?php
2
- /**
3
- * Functions of the plugin.
4
- *
5
- * @package Blossomthemes_Email_Newsletter
6
- * @subpackage Blossomthemes_Email_Newsletter/includes
7
- * @author blossomthemes
8
- */
9
- class Blossomthemes_Email_Newsletter_Functions {
10
- // JavaScript Minifier
11
- function __construct()
12
- {
13
- add_action( 'wp_ajax_bten_get_mailing_list', array( $this, 'bten_get_mailing_list' ) );
14
- }
15
-
16
- function bten_minify_js( $input ) {
17
- if(trim($input) === "") return $input;
18
- return preg_replace(
19
- array(
20
- // Remove comment(s)
21
- '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
22
- // Remove white-space(s) outside the string and regex
23
- '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
24
- // Remove the last semicolon
25
- '#;+\}#',
26
- // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
27
- '#([\{,])([\'])(\d+|[a-z_]\w*)\2(?=\:)#i',
28
- // --ibid. From `foo['bar']` to `foo.bar`
29
- '#([\w\)\]])\[([\'"])([a-z_]\w*)\2\]#i',
30
- // Replace `true` with `!0`
31
- '#(?<=return |[=:,\(\[])true\b#',
32
- // Replace `false` with `!1`
33
- '#(?<=return |[=:,\(\[])false\b#',
34
- // Clean up ...
35
- '#\s*(\/\*|\*\/)\s*#'
36
- ),
37
- array(
38
- '$1',
39
- '$1$2',
40
- '}',
41
- '$1$3',
42
- '$1.$3',
43
- '!0',
44
- '!1',
45
- '$1'
46
- ),
47
- $input);
48
- }
49
-
50
-
51
-
52
- function bten_minify_css( $input ) {
53
- if(trim($input) === "") return $input;
54
- // Force white-space(s) in `calc()`
55
- if(strpos($input, 'calc(') !== false) {
56
- $input = preg_replace_callback('#(?<=[\s:])calc\(\s*(.*?)\s*\)#', function($matches) {
57
- return 'calc(' . preg_replace('#\s+#', "\x1A", $matches[1]) . ')';
58
- }, $input);
59
- }
60
- return preg_replace(
61
- array(
62
- // Remove comment(s)
63
- '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
64
- // Remove unused white-space(s)
65
- '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~+]|\s*+-(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
66
- // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
67
- '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
68
- // Replace `:0 0 0 0` with `:0`
69
- '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
70
- // Replace `background-position:0` with `background-position:0 0`
71
- '#(background-position):0(?=[;\}])#si',
72
- // Replace `0.6` with `.6`, but only when preceded by a white-space or `=`, `:`, `,`, `(`, `-`
73
- '#(?<=[\s=:,\(\-]|&\#32;)0+\.(\d+)#s',
74
- // Minify string value
75
- '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][-\w]*?)\2(?=[\s\{\}\];,])#si',
76
- '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
77
- // Minify HEX color code
78
- '#(?<=[\s=:,\(]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
79
- // Replace `(border|outline):none` with `(border|outline):0`
80
- '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
81
- // Remove empty selector(s)
82
- '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s',
83
- '#\x1A#'
84
- ),
85
- array(
86
- '$1',
87
- '$1$2$3$4$5$6$7',
88
- '$1',
89
- ':0',
90
- '$1:0 0',
91
- '.$1',
92
- '$1$3',
93
- '$1$2$4$5',
94
- '$1$2$3',
95
- '$1:0',
96
- '$1$2',
97
- ' '
98
- ),
99
- $input);
100
- }
101
-
102
- /**
103
- * Retrieves the image field.
104
- *
105
- * @link https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
106
- */
107
- function blossomthemes_email_newsletter_companion_get_image_field( $id, $name, $image, $label ){
108
- $output = '';
109
- $output .= '<div class="widget-upload">';
110
- $output .= '<label for="' . esc_attr( $id ) . '">' . esc_html( $label ) . '</label><br/>';
111
- $output .= '<input id="' . esc_attr( $id ) . '" class="bten-upload" type="hidden" name="' . esc_attr( $name ) . '" value="' . esc_attr( $image ) . '" placeholder="' . __('No file chosen', 'blossomthemes-email-newsletter') . '" />' . "\n";
112
- if ( function_exists( 'wp_enqueue_media' ) ) {
113
- if ( $image == '' ) {
114
- $output .= '<input id="upload-' . esc_attr( $id ) . '" class="bten-upload-button button" type="button" value="' . __('Upload', 'blossomthemes-email-newsletter') . '" />' . "\n";
115
- } else {
116
- $output .= '<input id="upload-' . esc_attr( $id ) . '" class="bten-upload-button button" type="button" value="' . __('Change', 'blossomthemes-email-newsletter') . '" />' . "\n";
117
- }
118
- } else {
119
- $output .= '<p><i>' . __('Upgrade your version of WordPress for full media support.', 'blossomthemes-email-newsletter') . '</i></p>';
120
- }
121
-
122
- $output .= '<div class="bten-screenshot" id="' . esc_attr( $id ) . '-image">' . "\n";
123
-
124
- if ( $image != '' ) {
125
- $remove = '<a href="#" class="bten-remove-image">'.__('Remove Image','blossomthemes-email-newsletter').'</a>';
126
- $attachment_id = $image;
127
- $image_array = wp_get_attachment_image_src( $attachment_id, 'full');
128
- if ( $image_array[0] ) {
129
- $output .= '<img src="' . esc_url( $image_array[0] ) . '" alt="" />' . $remove;
130
- } else {
131
- // Standard generic output if it's not an image.
132
- $output .= '<small>' . __( 'Please upload valid image file.', 'blossomthemes-email-newsletter' ) . '</small>';
133
- }
134
- }
135
- $output .= '</div></div>' . "\n";
136
-
137
- echo $output;
138
- }
139
-
140
- /**
141
- * Get an attachment ID given a URL.
142
- *
143
- * @param string $url
144
- *
145
- * @return int Attachment ID on success, 0 on failure
146
- */
147
- function blossomthemes_email_newsletter_get_attachment_id( $url ) {
148
- $attachment_id = 0;
149
- $dir = wp_upload_dir();
150
- if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory?
151
- $file = basename( $url );
152
- $query_args = array(
153
- 'post_type' => 'attachment',
154
- 'post_status' => 'inherit',
155
- 'fields' => 'ids',
156
- 'meta_query' => array(
157
- array(
158
- 'value' => $file,
159
- 'compare' => 'LIKE',
160
- 'key' => '_wp_attachment_metadata',
161
- ),
162
- )
163
- );
164
- $query = new WP_Query( $query_args );
165
- if ( $query->have_posts() ) {
166
- foreach ( $query->posts as $post_id ) {
167
- $meta = wp_get_attachment_metadata( $post_id );
168
- $original_file = basename( $meta['file'] );
169
- $cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' );
170
- if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
171
- $attachment_id = $post_id;
172
- break;
173
- }
174
- }
175
- }
176
- }
177
- return $attachment_id;
178
- }
179
-
180
- function bten_get_mailing_list()
181
- {
182
- if ($_POST['calling_action'] == 'bten_aweber_auth')
183
- {
184
- $aw = new Blossomthemes_Email_Newsletter_AWeber;
185
- echo json_encode($aw->bten_get_aw_auth($_POST['bten_aw_auth_code']));
186
- }
187
-
188
- elseif($_POST['calling_action'] == 'bten_aweber_remove_auth')
189
- {
190
- $aw = new Blossomthemes_Email_Newsletter_AWeber;
191
- echo json_encode($aw->bten_get_aw_remove_auth());
192
- }
193
-
194
- elseif ($_POST['calling_action'] == 'bten_aweber_list')
195
- {
196
- $aw = new Blossomthemes_Email_Newsletter_AWeber;
197
- echo json_encode($aw->bten_get_aw_lists());
198
- }
199
-
200
- elseif ($_POST['calling_action'] == 'bten_mailchimp_list')
201
- {
202
- if(empty($_POST['bten_mc_api_key']))
203
- {
204
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
205
- echo json_encode($data);
206
- }
207
- else
208
- {
209
- $mc = new BlossomThemes_Email_Newsletter_Settings;
210
- $data = $mc->mailchimp_lists($_POST['bten_mc_api_key']);
211
- if(empty($data['lists']))
212
- {
213
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'invalid api key');
214
- echo json_encode($data);
215
- }
216
- else
217
- {
218
- echo json_encode($data['lists']);
219
- }
220
- }
221
- }
222
-
223
- elseif ($_POST['calling_action'] == 'bten_mailerlite_list')
224
- {
225
- if(empty($_POST['bten_ml_api_key']))
226
- {
227
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
228
- echo json_encode($data);
229
- }
230
- else
231
- {
232
- $ml = new BlossomThemes_Email_Newsletter_Settings;
233
- $data = $ml->mailerlite_lists($_POST['bten_ml_api_key']);
234
-
235
- if(empty($data['Results']))
236
- {
237
- echo json_encode($data);
238
- }
239
- else
240
- {
241
- echo json_encode($data['Results']);
242
- }
243
- }
244
-
245
- }
246
-
247
- elseif ($_POST['calling_action'] == 'bten_convertkit_list')
248
- {
249
- if(empty($_POST['bten_ck_api_key']))
250
- {
251
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
252
- echo json_encode($data);
253
- }
254
- else
255
- {
256
- $ck = new BlossomThemes_Email_Newsletter_Settings;
257
- $data = $ck->convertkit_lists($_POST['bten_ck_api_key']);
258
- if(empty($data))
259
- {
260
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'invalid api key');
261
- echo json_encode($data);
262
- }
263
- else
264
- {
265
- echo json_encode($data);
266
- }
267
- }
268
- }
269
-
270
- elseif ($_POST['calling_action'] == 'bten_getresponse_list')
271
- {
272
- $getresponse = new GetResponse( $_POST['bten_gr_api_key'] );
273
- $account = $getresponse->accounts();
274
-
275
- if( isset( $account->accountId ) && '' != $account->accountId ){
276
-
277
- $campaigns = $getresponse->getCampaigns();
278
-
279
- if( !empty( $campaigns ) ){
280
- echo json_encode($campaigns);
281
- } # END if( !empty( $campaigns ) )
282
- else{
283
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
284
- echo json_encode($data);
285
- }
286
-
287
- }
288
- }
289
-
290
- elseif ($_POST['calling_action'] == 'bten_activecampaign_list')
291
- {
292
- if(empty($_POST['bten_ac_api_url']) || empty($_POST['bten_ac_api_key']))
293
- {
294
- $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key or URL", 'desc' => 'empty api key or url');
295
- echo json_encode($data);
296
- }
297
- else
298
- {
299
- $ac = new BlossomThemes_Email_Newsletter_Settings;
300
- $data = $ac->activecampaign_lists( $_POST['bten_ac_api_key'], $_POST['bten_ac_api_url'] );
301
- echo json_encode($data);
302
-
303
- }
304
- }
305
-
306
- else {
307
- echo json_encode(array());
308
- }
309
-
310
- die();
311
- }
312
-
313
- }
314
- new Blossomthemes_Email_Newsletter_Functions;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Functions of the plugin.
4
+ *
5
+ * @package Blossomthemes_Email_Newsletter
6
+ * @subpackage Blossomthemes_Email_Newsletter/includes
7
+ * @author blossomthemes
8
+ */
9
+ class Blossomthemes_Email_Newsletter_Functions {
10
+ // JavaScript Minifier
11
+ function __construct()
12
+ {
13
+ add_action( 'wp_ajax_bten_get_mailing_list', array( $this, 'bten_get_mailing_list' ) );
14
+ }
15
+
16
+ function bten_minify_js( $input ) {
17
+ if(trim($input) === "") return $input;
18
+ return preg_replace(
19
+ array(
20
+ // Remove comment(s)
21
+ '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
22
+ // Remove white-space(s) outside the string and regex
23
+ '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s',
24
+ // Remove the last semicolon
25
+ '#;+\}#',
26
+ // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}`
27
+ '#([\{,])([\'])(\d+|[a-z_]\w*)\2(?=\:)#i',
28
+ // --ibid. From `foo['bar']` to `foo.bar`
29
+ '#([\w\)\]])\[([\'"])([a-z_]\w*)\2\]#i',
30
+ // Replace `true` with `!0`
31
+ '#(?<=return |[=:,\(\[])true\b#',
32
+ // Replace `false` with `!1`
33
+ '#(?<=return |[=:,\(\[])false\b#',
34
+ // Clean up ...
35
+ '#\s*(\/\*|\*\/)\s*#'
36
+ ),
37
+ array(
38
+ '$1',
39
+ '$1$2',
40
+ '}',
41
+ '$1$3',
42
+ '$1.$3',
43
+ '!0',
44
+ '!1',
45
+ '$1'
46
+ ),
47
+ $input);
48
+ }
49
+
50
+
51
+
52
+ function bten_minify_css( $input ) {
53
+ if(trim($input) === "") return $input;
54
+ // Force white-space(s) in `calc()`
55
+ if(strpos($input, 'calc(') !== false) {
56
+ $input = preg_replace_callback('#(?<=[\s:])calc\(\s*(.*?)\s*\)#', function($matches) {
57
+ return 'calc(' . preg_replace('#\s+#', "\x1A", $matches[1]) . ')';
58
+ }, $input);
59
+ }
60
+ return preg_replace(
61
+ array(
62
+ // Remove comment(s)
63
+ '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s',
64
+ // Remove unused white-space(s)
65
+ '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~+]|\s*+-(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si',
66
+ // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0`
67
+ '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si',
68
+ // Replace `:0 0 0 0` with `:0`
69
+ '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i',
70
+ // Replace `background-position:0` with `background-position:0 0`
71
+ '#(background-position):0(?=[;\}])#si',
72
+ // Replace `0.6` with `.6`, but only when preceded by a white-space or `=`, `:`, `,`, `(`, `-`
73
+ '#(?<=[\s=:,\(\-]|&\#32;)0+\.(\d+)#s',
74
+ // Minify string value
75
+ '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][-\w]*?)\2(?=[\s\{\}\];,])#si',
76
+ '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si',
77
+ // Minify HEX color code
78
+ '#(?<=[\s=:,\(]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i',
79
+ // Replace `(border|outline):none` with `(border|outline):0`
80
+ '#(?<=[\{;])(border|outline):none(?=[;\}\!])#',
81
+ // Remove empty selector(s)
82
+ '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s',
83
+ '#\x1A#'
84
+ ),
85
+ array(
86
+ '$1',
87
+ '$1$2$3$4$5$6$7',
88
+ '$1',
89
+ ':0',
90
+ '$1:0 0',
91
+ '.$1',
92
+ '$1$3',
93
+ '$1$2$4$5',
94
+ '$1$2$3',
95
+ '$1:0',
96
+ '$1$2',
97
+ ' '
98
+ ),
99
+ $input);
100
+ }
101
+
102
+ /**
103
+ * Retrieves the image field.
104
+ *
105
+ * @link https://pippinsplugins.com/retrieve-attachment-id-from-image-url/
106
+ */
107
+ function blossomthemes_email_newsletter_companion_get_image_field( $id, $name, $image, $label ){
108
+ $output = '';
109
+ $output .= '<div class="widget-upload">';
110
+ $output .= '<label for="' . esc_attr( $id ) . '">' . esc_html( $label ) . '</label><br/>';
111
+ $output .= '<input id="' . esc_attr( $id ) . '" class="bten-upload" type="hidden" name="' . esc_attr( $name ) . '" value="' . esc_attr( $image ) . '" placeholder="' . __('No file chosen', 'blossomthemes-email-newsletter') . '" />' . "\n";
112
+ if ( function_exists( 'wp_enqueue_media' ) ) {
113
+ if ( $image == '' ) {
114
+ $output .= '<input id="upload-' . esc_attr( $id ) . '" class="bten-upload-button button" type="button" value="' . __('Upload', 'blossomthemes-email-newsletter') . '" />' . "\n";
115
+ } else {
116
+ $output .= '<input id="upload-' . esc_attr( $id ) . '" class="bten-upload-button button" type="button" value="' . __('Change', 'blossomthemes-email-newsletter') . '" />' . "\n";
117
+ }
118
+ } else {
119
+ $output .= '<p><i>' . __('Upgrade your version of WordPress for full media support.', 'blossomthemes-email-newsletter') . '</i></p>';
120
+ }
121
+
122
+ $output .= '<div class="bten-screenshot" id="' . esc_attr( $id ) . '-image">' . "\n";
123
+
124
+ if ( $image != '' ) {
125
+ $remove = '<a href="#" class="bten-remove-image">'.__('Remove Image','blossomthemes-email-newsletter').'</a>';
126
+ $attachment_id = $image;
127
+ $image_array = wp_get_attachment_image_src( $attachment_id, 'full');
128
+ if ( $image_array[0] ) {
129
+ $output .= '<img src="' . esc_url( $image_array[0] ) . '" alt="" />' . $remove;
130
+ } else {
131
+ // Standard generic output if it's not an image.
132
+ $output .= '<small>' . __( 'Please upload valid image file.', 'blossomthemes-email-newsletter' ) . '</small>';
133
+ }
134
+ }
135
+ $output .= '</div></div>' . "\n";
136
+
137
+ echo $output;
138
+ }
139
+
140
+ /**
141
+ * Get an attachment ID given a URL.
142
+ *
143
+ * @param string $url
144
+ *
145
+ * @return int Attachment ID on success, 0 on failure
146
+ */
147
+ function blossomthemes_email_newsletter_get_attachment_id( $url ) {
148
+ $attachment_id = 0;
149
+ $dir = wp_upload_dir();
150
+ if ( false !== strpos( $url, $dir['baseurl'] . '/' ) ) { // Is URL in uploads directory?
151
+ $file = basename( $url );
152
+ $query_args = array(
153
+ 'post_type' => 'attachment',
154
+ 'post_status' => 'inherit',
155
+ 'fields' => 'ids',
156
+ 'meta_query' => array(
157
+ array(
158
+ 'value' => $file,
159
+ 'compare' => 'LIKE',
160
+ 'key' => '_wp_attachment_metadata',
161
+ ),
162
+ )
163
+ );
164
+ $query = new WP_Query( $query_args );
165
+ if ( $query->have_posts() ) {
166
+ foreach ( $query->posts as $post_id ) {
167
+ $meta = wp_get_attachment_metadata( $post_id );
168
+ $original_file = basename( $meta['file'] );
169
+ $cropped_image_files = wp_list_pluck( $meta['sizes'], 'file' );
170
+ if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
171
+ $attachment_id = $post_id;
172
+ break;
173
+ }
174
+ }
175
+ }
176
+ }
177
+ return $attachment_id;
178
+ }
179
+
180
+ function bten_get_mailing_list()
181
+ {
182
+ if ($_POST['calling_action'] == 'bten_aweber_auth')
183
+ {
184
+ $aw = new Blossomthemes_Email_Newsletter_AWeber;
185
+ echo json_encode($aw->bten_get_aw_auth($_POST['bten_aw_auth_code']));
186
+ }
187
+
188
+ elseif($_POST['calling_action'] == 'bten_aweber_remove_auth')
189
+ {
190
+ $aw = new Blossomthemes_Email_Newsletter_AWeber;
191
+ echo json_encode($aw->bten_get_aw_remove_auth());
192
+ }
193
+
194
+ elseif ($_POST['calling_action'] == 'bten_aweber_list')
195
+ {
196
+ $aw = new Blossomthemes_Email_Newsletter_AWeber;
197
+ echo json_encode($aw->bten_get_aw_lists());
198
+ }
199
+
200
+ elseif ($_POST['calling_action'] == 'bten_mailchimp_list')
201
+ {
202
+ if(empty($_POST['bten_mc_api_key']))
203
+ {
204
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
205
+ echo json_encode($data);
206
+ }
207
+ else
208
+ {
209
+ $mc = new BlossomThemes_Email_Newsletter_Settings;
210
+ $data = $mc->mailchimp_lists($_POST['bten_mc_api_key']);
211
+ if(empty($data['lists']))
212
+ {
213
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'invalid api key');
214
+ echo json_encode($data);
215
+ }
216
+ else
217
+ {
218
+ echo json_encode($data['lists']);
219
+ }
220
+ }
221
+ }
222
+
223
+ elseif ($_POST['calling_action'] == 'bten_mailerlite_list')
224
+ {
225
+ if(empty($_POST['bten_ml_api_key']))
226
+ {
227
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
228
+ echo json_encode($data);
229
+ }
230
+ else
231
+ {
232
+ $ml = new BlossomThemes_Email_Newsletter_Settings;
233
+ $data = $ml->mailerlite_lists($_POST['bten_ml_api_key']);
234
+
235
+ if(empty($data['Results']))
236
+ {
237
+ echo json_encode($data);
238
+ }
239
+ else
240
+ {
241
+ echo json_encode($data['Results']);
242
+ }
243
+ }
244
+
245
+ }
246
+
247
+ elseif ($_POST['calling_action'] == 'bten_convertkit_list')
248
+ {
249
+ if(empty($_POST['bten_ck_api_key']))
250
+ {
251
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
252
+ echo json_encode($data);
253
+ }
254
+ else
255
+ {
256
+ $ck = new BlossomThemes_Email_Newsletter_Settings;
257
+ $data = $ck->convertkit_lists($_POST['bten_ck_api_key']);
258
+ if(empty($data))
259
+ {
260
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'invalid api key');
261
+ echo json_encode($data);
262
+ }
263
+ else
264
+ {
265
+ echo json_encode($data);
266
+ }
267
+ }
268
+ }
269
+
270
+ elseif ($_POST['calling_action'] == 'bten_getresponse_list')
271
+ {
272
+ $getresponse = new GetResponse( $_POST['bten_gr_api_key'] );
273
+ $account = $getresponse->accounts();
274
+
275
+ if( isset( $account->accountId ) && '' != $account->accountId ){
276
+
277
+ $campaigns = $getresponse->getCampaigns();
278
+
279
+ if( !empty( $campaigns ) ){
280
+ echo json_encode($campaigns);
281
+ } # END if( !empty( $campaigns ) )
282
+ else{
283
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key", 'desc' => 'empty api key');
284
+ echo json_encode($data);
285
+ }
286
+
287
+ }
288
+ }
289
+
290
+ elseif ($_POST['calling_action'] == 'bten_activecampaign_list')
291
+ {
292
+ if(empty($_POST['bten_ac_api_url']) || empty($_POST['bten_ac_api_key']))
293
+ {
294
+ $data[0] = array('name' => 'No Lists Found', 'message' => "Please enter a valid API Key or URL", 'desc' => 'empty api key or url');
295
+ echo json_encode($data);
296
+ }
297
+ else
298
+ {
299
+ $ac = new BlossomThemes_Email_Newsletter_Settings;
300
+ $data = $ac->activecampaign_lists( $_POST['bten_ac_api_key'], $_POST['bten_ac_api_url'] );
301
+ echo json_encode($data);
302
+
303
+ }
304
+ } elseif ( $_POST['calling_action'] == 'bten_sendinblue_list' ) {
305
+ $lists = array();
306
+
307
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', false );
308
+
309
+ if ( ! $blossomthemes_email_newsletter_settings ) {
310
+ return $lists;
311
+ }
312
+
313
+ $api_key = isset( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) : '';
314
+
315
+ if ( empty( $api_key ) ) {
316
+ $api_key = isset( $_POST['bten_sendin_api_key'] ) ? $_POST['bten_sendin_api_key'] : '';
317
+ }
318
+
319
+ if ( ! empty( $api_key ) ) {
320
+
321
+ $mailin = new SendinblueApiClient();
322
+ $lists = array();
323
+ $list_data = $mailin->getAllLists();
324
+
325
+ if (!empty($list_data['lists'])) {
326
+ foreach ( $list_data['lists'] as $value ) {
327
+ if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
328
+ $tempList = $value['id'];
329
+ update_option( 'bten_sib_temp_list', $tempList );
330
+ continue;
331
+ }
332
+ $lists[] = array(
333
+ 'id' => $value['id'],
334
+ 'name' => $value['name'],
335
+ );
336
+ }
337
+ }
338
+ }
339
+ if ( count( $lists ) > 0 ) {
340
+ set_transient( 'bten_sib_list_' . md5( $api_key ), $lists, 4 * HOUR_IN_SECONDS );
341
+ }
342
+ wp_send_json_success( $lists );
343
+ }
344
+
345
+ else {
346
+ echo json_encode(array());
347
+ }
348
+
349
+ die();
350
+ }
351
+
352
+ }
353
+ new Blossomthemes_Email_Newsletter_Functions;
includes/class-blossomthemes-email-newsletter-sendinblue.php ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Sendinblue Handler.
4
+ */
5
+ class Blossomthemes_Email_Newsletter_Sendinblue {
6
+
7
+ /**
8
+ * Get Seninblue lists.
9
+ *
10
+ * @return void
11
+ */
12
+ public function get_lists() {
13
+ $lists = array();
14
+
15
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', false );
16
+
17
+ if ( ! $blossomthemes_email_newsletter_settings ) {
18
+ return $lists;
19
+ }
20
+
21
+ $api_key = isset( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) : '';
22
+ // get lists.
23
+ $lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
24
+ if ( false === $lists || false == $lists ) {
25
+
26
+ $mailin = new SendinblueApiClient();
27
+ $lists = array();
28
+ $list_data = $mailin->getAllLists();
29
+
30
+ if (!empty($list_data['lists'])) {
31
+ foreach ( $list_data['lists'] as $value ) {
32
+ if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
33
+ $tempList = $value['id'];
34
+ update_option( 'bten_sib_temp_list', $tempList );
35
+ continue;
36
+ }
37
+ $lists[] = array(
38
+ 'id' => $value['id'],
39
+ 'name' => $value['name'],
40
+ );
41
+ }
42
+ }
43
+ }
44
+ if ( count( $lists ) > 0 ) {
45
+ set_transient( 'bten_sib_list_' . md5( $api_key ), $lists, 4 * HOUR_IN_SECONDS );
46
+ }
47
+ return $lists;
48
+ }
49
+
50
+ /**
51
+ * Action for form submissions.
52
+ *
53
+ * @return void
54
+ */
55
+ public function action_form_submission( $email, $sid, $fname ) {
56
+
57
+ // MailChimp API credentials
58
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
59
+
60
+ $listids = get_post_meta( $sid, 'blossomthemes_email_newsletter_setting', true );
61
+
62
+ if( ! isset( $listids['sendinblue']['list-id'] ) ) {
63
+ $listids = $blossomthemes_email_newsletter_settings['sendinblue']['list-id'];
64
+ $result = $this->create_subscriber( 'simple', $email, $listids, $info = array( 'name' => $fname ), $unlinkedLists = array() );
65
+ }else {
66
+ // foreach ( $listids['sendinblue']['list-id'] as $key => $value ) {
67
+ $result = $this->create_subscriber( 'simple', $email, $listids['sendinblue']['list-id'], $info = array( 'name' => $fname ), $unlinkedLists = array() );
68
+ // }
69
+ }
70
+
71
+ return $result;
72
+ }
73
+
74
+ /**
75
+ * Signup process
76
+ *
77
+ * @param string $type - simple, confirm, double-optin / subscribe.
78
+ * @param $email - subscriber email.
79
+ * @param $list_id - desired list ids.
80
+ * @param $info - user's attributes.
81
+ * @param null $list_unlink - remove temp list.
82
+ * @return string
83
+ */
84
+ public function create_subscriber( $type = 'simple', $email, $list_id, $info, $list_unlink = null ) {
85
+ $mailin = new SendinblueApiClient();
86
+ $user = $mailin->getUser($email);
87
+
88
+ $response = $this->validation_email( $user, $type, $email, $list_id );
89
+ $exist = '';
90
+
91
+ if ( 'already_exist' == $response['code'] ) {
92
+ $exist = 'already_exist';
93
+ }
94
+
95
+ if ( 'subscribe' == $type ) {
96
+ $info['DOUBLE_OPT-IN'] = '1'; // Yes.
97
+ } else {
98
+ if ( 'double-optin' == $type ) {
99
+ if ( ( 'new' == $response['code'] && ! $response['isDopted']) || ( 'update' == $response['code'] && ! $response['isDopted']) ) {
100
+ $info['DOUBLE_OPT-IN'] = '2'; // No.
101
+ }
102
+ }
103
+ }
104
+
105
+ $listid = $response['listid'];
106
+ if ( $list_unlink != null ) {
107
+ $listid = array_diff( $listid, $list_unlink );
108
+ }
109
+
110
+ $attributes = $this->get_attributes();
111
+ if( !empty($attributes["attributes"]["normal_attributes"]) ) {
112
+ foreach ( $attributes["attributes"]["normal_attributes"] as $key => $value ) {
113
+ if( "boolean" == $value["type"] && array_key_exists($value["name"], $info) )
114
+ if( in_array($info[ $value["name"] ], array("true","True","TRUE",1)) ) {
115
+ $info[ $value["name"] ] = true;
116
+ }
117
+ else {
118
+ $info[ $value["name"] ] = false;
119
+ }
120
+ }
121
+ }
122
+
123
+ $info = array(
124
+ 'email' => $email,
125
+ 'FNAME' => $info['name'],
126
+ );
127
+
128
+ if ($mailin->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_OK && isset($user['email'])) {
129
+ unset($info["email"]);
130
+ if (isset($info["internalUserHistory"]) && is_array($info["internalUserHistory"])) {
131
+ $info["internalUserHistory"][] = array("action"=>"SUBSCRIBE_BY_PLUGIN", "id"=> 1, "name"=>"Blossomthemes Email Newsletter");
132
+ } else {
133
+ $info["internalUserHistory"] = array(array("action"=>"SUBSCRIBE_BY_PLUGIN", "id"=> 1, "name"=>"Blossomthemes Email Newsletter"));
134
+ }
135
+ $data = [
136
+ 'email' => $email,
137
+ 'attributes' => $info,
138
+ 'emailBlacklisted' => false,
139
+ 'smsBlacklisted' => false,
140
+ 'listIds' => $listid,
141
+ 'unlinkListIds' => $list_unlink
142
+ ];
143
+ $mailin->updateUser($email ,$data );
144
+ $exist = $mailin->getLastResponseCode() == 204 ? 'success' : '' ;
145
+ } else {
146
+ $info["internalUserHistory"] = array(array("action"=>"SUBSCRIBE_BY_PLUGIN", "id"=> 1, "name"=>"Blossomthemes Email Newsletter"));
147
+ $data = [
148
+ 'email' => $email,
149
+ 'attributes' => $info,
150
+ 'emailBlacklisted' => false,
151
+ 'smsBlacklisted' => false,
152
+ 'listIds' => $listid
153
+ ];
154
+
155
+ $created_user = $mailin->createUser( $data );
156
+ }
157
+
158
+ if ('' != $exist) {
159
+ $response['code'] = $exist;
160
+ } else if(isset($created_user['id'])) {
161
+ $response['code'] = "success";
162
+ }
163
+
164
+ return $response['code'];
165
+ }
166
+
167
+ /**
168
+ * Validation the email if it exist in contact list
169
+ *
170
+ * @param $res
171
+ * @param string $type - form type.
172
+ * @param string $email - email.
173
+ * @param array $list_id - list ids.
174
+ * @return array
175
+ */
176
+ static function validation_email( $res, $type = 'simple', $email, $list_id ) {
177
+
178
+ $isDopted = false;
179
+
180
+ $temp_dopt_list = get_option( 'bten_sib_temp_list' );
181
+ $desired_lists = $list_id;
182
+
183
+ if ( 'double-optin' == $type ) {
184
+ $list_id = array( $temp_dopt_list );
185
+ }
186
+
187
+ // new user.
188
+ if ( isset($res['code']) && $res['code'] == 'document_not_found' ) {
189
+ $ret = array(
190
+ 'code' => 'new',
191
+ 'isDopted' => $isDopted,
192
+ 'listid' => $list_id,
193
+ );
194
+ return $ret;
195
+ }
196
+
197
+ $listid = $res['listIds'];
198
+
199
+ // update user when listid is empty.
200
+ if ( ! isset( $listid ) || ! is_array( $listid ) ) {
201
+ $ret = array(
202
+ 'code' => 'update',
203
+ 'isDopted' => $isDopted,
204
+ 'listid' => $list_id,
205
+ );
206
+ return $ret;
207
+ }
208
+
209
+ $attrs = $res['attributes'];
210
+ if ( isset( $attrs['DOUBLE_OPT-IN'] ) && '1' == $attrs['DOUBLE_OPT-IN'] ) {
211
+ $isDopted = true;
212
+ }
213
+ // remove dopt temp list from $listid.
214
+ if (($key = array_search($temp_dopt_list, $listid)) !== false) {
215
+ unset($listid[$key]);
216
+ }
217
+
218
+ // $diff = array_diff( $desired_lists, $listid );
219
+ // if ( ! empty( $diff ) ) {
220
+ // $status = 'update';
221
+ // if ( 'double-optin' != $type ) {
222
+ // $listid = array_unique( array_merge( $listid, $list_id ) );
223
+ // }
224
+ // if ( ( 'double-optin' == $type && ! $isDopted) ) {
225
+ // array_push( $listid, $temp_dopt_list );
226
+ // }
227
+ // } else {
228
+ if ( '1' == $res['emailBlacklisted'] ) {
229
+ $status = 'update';
230
+ } else {
231
+ $status = 'already_exist';
232
+ }
233
+ // }
234
+
235
+ $ret = array(
236
+ 'code' => $status,
237
+ 'isDopted' => $isDopted,
238
+ 'listid' => $listid,
239
+ );
240
+ return $ret;
241
+ }
242
+
243
+ /**
244
+ * Get Attributes.
245
+ *
246
+ * @return void
247
+ */
248
+ public function get_attributes() {
249
+
250
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', false );
251
+
252
+ $api_key = isset( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) : '';
253
+ // get attributes.
254
+ $attrs = get_transient( 'sib_attributes_' . md5( $api_key ) );
255
+
256
+ if ( false === $attrs || false == $attrs ) {
257
+ $mailin = new SendinblueApiClient();
258
+ $response = $mailin->getAttributes();
259
+ $attributes = $response['attributes'];
260
+ $attrs = array(
261
+ 'attributes' => array(
262
+ 'normal_attributes' => array(),
263
+ 'category_attributes' => array(),
264
+ )
265
+ );
266
+
267
+ if ( count( $attributes ) > 0 ) {
268
+ foreach ($attributes as $key => $value) {
269
+ if ($value["category"] == "normal") {
270
+ $attrs['attributes']['normal_attributes'][] = $value;
271
+ }
272
+ elseif ($value["category"] == "category") {
273
+ $value["type"] = "category";
274
+ $attrs['attributes']['category_attributes'][] = $value;
275
+ }
276
+
277
+ }
278
+ }
279
+
280
+ set_transient( 'sib_attributes_' . md5( $api_key ), $attrs, 4 * HOUR_IN_SECONDS );
281
+ }
282
+
283
+ return $attrs;
284
+
285
+ }
286
+
287
+ }
288
+ new Blossomthemes_Email_Newsletter_Sendinblue;
includes/class-blossomthemes-email-newsletter-settings.php CHANGED
@@ -1,579 +1,666 @@
1
- <?php
2
- /**
3
- * Settings section of the plugin.
4
- *
5
- * Maintain a list of functions that are used for settings purposes of the plugin
6
- *
7
- * @package BlossomThemes Email Newsletters
8
- * @subpackage BlossomThemes_Email_Newsletters/includes
9
- * @author blossomthemes
10
- */
11
- class BlossomThemes_Email_Newsletter_Settings {
12
-
13
- function __construct()
14
- {
15
- add_action( 'wp_ajax_bten_get_platform', array( $this, 'bten_get_platform' ) );
16
- }
17
-
18
- function bten_get_platform(){
19
- if ($_POST['calling_action'] == 'bten_platform_settings')
20
- {
21
- echo $this->bten_platform_settings($_POST['platform']);
22
- exit;
23
- }
24
- }
25
-
26
- function mailerlite_lists($api_key='')
27
- {
28
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
29
-
30
- if( empty($api_key) && isset( $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] ) && $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] !='' )
31
- {
32
- $api_key = $blossomthemes_email_newsletter_settings['mailerlite']['api-key'];
33
- }
34
-
35
- $key = preg_replace('/[^a-z0-9]/i', '', $api_key);
36
- $ML_Lists = new ML_Lists($key);
37
- $lists = $ML_Lists->getAll();
38
- $data = json_decode($lists, TRUE);
39
- return $data;
40
-
41
- }
42
-
43
- function mailchimp_lists($api_key='')
44
- {
45
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
46
-
47
- if( empty($api_key ) && isset( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ) && $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] !='' )
48
- {
49
- $api_key = $blossomthemes_email_newsletter_settings['mailchimp']['api-key'];
50
- }
51
-
52
- $MC_Lists = new MC_Lists($api_key);
53
- $lists = $MC_Lists->getAll();
54
- $data = json_decode($lists, TRUE);
55
- return $data;
56
-
57
- }
58
-
59
- function convertkit_lists($apikey = '')
60
- {
61
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
62
- $list = array();
63
- if( empty($apikey ) && isset( $blossomthemes_email_newsletter_settings['convertkit']['api-key'] ) && $blossomthemes_email_newsletter_settings['convertkit']['api-key'] !='' )
64
- {
65
- $apikey = $blossomthemes_email_newsletter_settings['convertkit']['api-key'];
66
- }
67
-
68
- $api = new Convertkit($apikey);
69
-
70
- try {
71
- $result = $api->getForms();
72
-
73
- if (isset($result->forms)) {
74
- foreach ($result->forms as $l) {
75
- $list[$l->id] = array('name' => $l->name);
76
- }
77
- }
78
- }
79
- catch (Exception $e) {
80
- echo $e->getMessage();
81
- }
82
-
83
- return $list;
84
- }
85
-
86
- /**
87
- * Get Response API
88
- *
89
- */
90
- function getresponse_lists($api_key = '')
91
- {
92
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
93
- $list = array();
94
-
95
- if( empty($api_key ) && isset( $blossomthemes_email_newsletter_settings['getresponse']['api-key'] ) && $blossomthemes_email_newsletter_settings['getresponse']['api-key'] !='' )
96
- {
97
- $api_key = $blossomthemes_email_newsletter_settings['getresponse']['api-key']; //Place API key here
98
- }
99
-
100
- if(!empty($api_key))
101
- {
102
- $getresponse = new GetResponse( $api_key );
103
- $account = $getresponse->accounts();
104
-
105
- if( isset( $account->accountId ) && '' != $account->accountId ){
106
-
107
- $campaigns = $getresponse->getCampaigns();
108
-
109
- if( !empty( $campaigns ) ){
110
- foreach ($campaigns as $k => $v) {
111
- $list[$v->campaignId]['name'] = $v->name;
112
- }
113
- } # END if( !empty( $campaigns ) )
114
- else{
115
- echo ('Connection Problem: Invalid API key');
116
- }
117
-
118
- }
119
-
120
- }
121
- return $list;
122
- }
123
-
124
- /**
125
- * ActiveCampaign API
126
- *
127
- */
128
- function activecampaign_lists($api_key = '', $url = '')
129
- {
130
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
131
- $list = array();
132
- if( empty($api_key) && empty($url) && isset($blossomthemes_email_newsletter_settings['activecampaign']['api-url']) && $blossomthemes_email_newsletter_settings['activecampaign']['api-url']!='' && isset($blossomthemes_email_newsletter_settings['activecampaign']['api-key']) && $blossomthemes_email_newsletter_settings['activecampaign']['api-key']!='' )
133
- {
134
- $api_key = $blossomthemes_email_newsletter_settings['activecampaign']['api-key']; //Place API key here
135
- $url = $blossomthemes_email_newsletter_settings['activecampaign']['api-url'];
136
- }
137
-
138
- if(!empty($api_key) && !empty($url)){
139
-
140
- $ac = new ActiveCampaign($url, $api_key);
141
- try
142
- {
143
- $response = $ac->api( "list/list", array('ids' => 'all') );
144
- // print_r($response);
145
- if (is_object($response) && !empty($response) && $response->success==1) {
146
- foreach ($response as $v) {
147
- if(is_object($v)) {
148
- $list[$v->id] = array('name' => $v->name);
149
- }
150
- }
151
- }
152
- elseif( is_object($response) && !empty($response) && $response->success==0 ){
153
- echo $response->result_message;
154
- }
155
- else{
156
- echo $response;
157
- }
158
-
159
- } catch (Exception $e){
160
- echo $e->getMessage();
161
- }
162
-
163
- }
164
- return $list;
165
- }
166
-
167
- function get_status($url)
168
- {
169
- // must set $url first.
170
- $ch = curl_init();
171
- curl_setopt($ch, CURLOPT_URL, $url);
172
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
173
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
174
- // do your curl thing here
175
- $data = curl_exec($ch);
176
- $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
177
- curl_close($ch);
178
- return $http_status;
179
- }
180
-
181
- function blossomthemes_email_newsletter_settings_tabs() {
182
-
183
- $tabs = array(
184
- 'general' => 'general.php',
185
- 'popup' => 'popup.php',
186
- );
187
- $tabs = apply_filters( 'blossomthemes_email_newsletter_settings_tabs', $tabs );
188
- return $tabs;
189
- }
190
-
191
- function blossomthemes_email_newsletter_backend_settings()
192
- { ?>
193
- <div class="wrap">
194
- <div class="btnb-header">
195
- <h3><?php _e('Settings','blossomthemes-email-newsletter');?></h3>
196
- </div>
197
- <?php
198
- if( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ==true )
199
- { ?>
200
- <div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible">
201
- <p><strong><?php _e('Settings updated.','blossomthemes-email-newsletter');?></strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php _e('Dismiss this notice.','blossomthemes-email-newsletter');?></span></button>
202
- </div>
203
- <?php
204
- }
205
- ?>
206
- <div id="tabs-container">
207
- <ul class="tabs-menu">
208
- <?php
209
- $settings_tab = $this->blossomthemes_email_newsletter_settings_tabs();
210
- $count = 0;
211
- foreach ($settings_tab as $key => $value) {
212
- $tab_label = preg_replace('/_/', ' ', $key);
213
- ?>
214
- <li <?php if($count==0){ ?>class="current"<?php } ?>><a href="<?php echo $key;?>"><?php echo $tab_label;?></a></li>
215
- <?php $count++;
216
- } ?>
217
- </ul>
218
- <div class="tab">
219
- <form method="POST" name="form1" action="options.php" id="form1" class="btemn-settings-form">
220
- <?php
221
- settings_fields( 'blossomthemes_email_newsletter_settings' );
222
- do_settings_sections( __FILE__ );
223
-
224
- $counter = 0;
225
- foreach ($settings_tab as $key => $value) { ?>
226
- <div id="<?php echo $key;?>" class="tab-content" <?php if($counter==0){ ?> style="display: block;" <?php } else{ ?> style="display: none;" <?php } ?>>
227
- <?php
228
- include_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/tabs/'.$value;
229
- ?>
230
- </div>
231
- <?php $counter++; }
232
- ?>
233
-
234
- <div class="blossomthemes_email_newsletter_settings-settings-submit">
235
- <?php echo submit_button();?>
236
- </div>
237
- </form>
238
- </div>
239
- </div>
240
- </div>
241
- <?php
242
- }
243
-
244
- function bten_platform_settings($platform='')
245
- {
246
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
247
- switch ($platform) {
248
- case 'mailchimp':
249
- ob_start();
250
- ?>
251
- <div id="mailchimp" class="newsletter-settings<?php if( $platform == 'mailchimp' || !isset($platform) ){ echo ' current'; }?>">
252
- <div class="blossomthemes-email-newsletter-wrap-field">
253
- <label for="blossomthemes_email_newsletter_settings[mailchimp][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
254
- <input type="text" id="bten_mailchimp_api_key" name="blossomthemes_email_newsletter_settings[mailchimp][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailchimp']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ): '';?>">
255
- <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your API key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://us15.admin.mailchimp.com/account/api/" target="_blank">','</a>' ).'</div>';?>
256
- </div>
257
- <div class="blossomthemes-email-newsletter-wrap-field">
258
- <label for="blossomthemes_email_newsletter_settings[mailchimp][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
259
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
260
- </span>
261
- </label>
262
- <?php
263
- $data = $this->mailchimp_lists();
264
- ?>
265
- <div class="select-holder">
266
- <select id="bten_mailchimp_list" name="blossomthemes_email_newsletter_settings[mailchimp][list-id]">
267
- <?php $mailchimp_list = isset($blossomthemes_email_newsletter_settings['mailchimp']['list-id']) ? $blossomthemes_email_newsletter_settings['mailchimp']['list-id'] : '';
268
- if( sizeof($data['lists']) < 1 ){ ?>
269
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
270
- <?php } else{
271
- $max = max(array_keys($data['lists']));
272
- for ($i=0; $i <= $max; $i++) { ?>
273
- <option <?php selected( $mailchimp_list, esc_attr($data['lists'][$i]['id'] ) );?> value="<?php echo esc_attr($data['lists'][$i]['id']);?>"><?php echo esc_attr($data['lists'][$i]['name']);?></option>
274
-
275
- <?php }} ?>
276
- </select>
277
- </div>
278
- <input type="button" rel-id="bten_mailchimp_list" class="button bten_get_mailchimp_lists" name="" value="Grab Lists">
279
-
280
- </div>
281
- <div class="blossomthemes-email-newsletter-wrap-field">
282
- <input type="checkbox" class="enable_notif_opt" name="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" <?php $j = isset( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ): '0';?> id="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?>/>
283
-
284
- <label for="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]"><?php _e('Confirmation','blossomthemes-email-newsletter');?>
285
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Check this box if you want subscribers to receive confirmation mail before they are added to list.', 'blossomthemes-email-newsletter' ); ?>">
286
- <i class="far fa-question-circle"></i>
287
- </span>
288
- </label>
289
- </div>
290
- </div>
291
- <?php
292
- $output = ob_get_contents();
293
- ob_end_clean();
294
- return $output;
295
- break;
296
-
297
- case 'mailerlite':
298
- ob_start();
299
- ?>
300
- <div id="mailerlite" class="newsletter-settings<?php if($platform == 'mailerlite'){ echo ' current'; }?>">
301
- <div class="blossomthemes-email-newsletter-wrap-field">
302
- <label for="blossomthemes_email_newsletter_settings[mailerlite][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
303
- <input type="text" id="bten_mailerlite_api_key" name="blossomthemes_email_newsletter_settings[mailerlite][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailerlite']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] ): '';?>">
304
- <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your api key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://app.mailerlite.com/subscribe/api" target="_blank">','</a>' ).'</div>';?>
305
- </div>
306
- <div class="blossomthemes-email-newsletter-wrap-field">
307
- <label for="blossomthemes_email_newsletter_settings[mailerlite][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
308
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
309
- </span>
310
- </label>
311
- <?php
312
- $data = $this->mailerlite_lists();
313
- ?>
314
- <div class="select-holder">
315
- <select id="bten_mailerlite_list" name="blossomthemes_email_newsletter_settings[mailerlite][list-id]">
316
- <?php $mailerlite_list = isset($blossomthemes_email_newsletter_settings['mailerlite']['list-id']) ? $blossomthemes_email_newsletter_settings['mailerlite']['list-id']: '';
317
- if( empty($data['Results']) ){ ?>
318
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
319
- <?php } else{
320
- $max = max(array_keys($data['Results']));
321
- for ($i=0; $i <= $max; $i++) { ?>
322
- <option <?php selected( $mailerlite_list, esc_attr($data['Results'][$i]['id'] ) );?> value="<?php echo esc_attr($data['Results'][$i]['id']);?>"><?php echo esc_attr($data['Results'][$i]['name']);?></option>
323
-
324
- <?php }} ?>
325
- </select>
326
- </div>
327
- <input type="button" rel-id="bten_mailerlite_list" class="button bten_get_mailerlite_lists" name="" value="Grab Lists">
328
- </div>
329
- </div>
330
- <?php
331
- $output = ob_get_contents();
332
- ob_end_clean();
333
- return $output;
334
- break;
335
-
336
- case 'convertkit':
337
- ob_start();
338
- ?>
339
- <div id="convertkit" class="newsletter-settings<?php if($platform == 'convertkit'){ echo ' current'; }?>">
340
- <div class="blossomthemes-email-newsletter-wrap-field">
341
- <label for="blossomthemes_email_newsletter_settings[convertkit][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
342
- <input type="text" id="bten_convertkit_api_key" name="blossomthemes_email_newsletter_settings[convertkit][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['convertkit']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['convertkit']['api-key'] ): '';?>">
343
- </div>
344
- <div class="blossomthemes-email-newsletter-wrap-field">
345
- <label for="blossomthemes_email_newsletter_settings[convertkit][api-secret]"><?php _e('API Secret : ','blossomthemes-email-newsletter');?></label>
346
- <input type="text" id="bten_convertkit_api_secret" name="blossomthemes_email_newsletter_settings[convertkit][api-secret]" value="<?php echo isset($blossomthemes_email_newsletter_settings['convertkit']['api-secret']) ? esc_attr( $blossomthemes_email_newsletter_settings['convertkit']['api-secret'] ): '';?>">
347
- </div>
348
- <div class="blossomthemes-email-newsletter-wrap-field">
349
- <label for="blossomthemes_email_newsletter_settings[convertkit][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
350
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
351
- </span>
352
- </label>
353
- <?php
354
- $data = $this->convertkit_lists();
355
- ?>
356
- <div class="select-holder">
357
- <select id="bten_convertkit_list" name="blossomthemes_email_newsletter_settings[convertkit][list-id]">
358
- <?php $convertkit_list = isset( $blossomthemes_email_newsletter_settings['convertkit']['list-id'] ) ? $blossomthemes_email_newsletter_settings['convertkit']['list-id'] : '';
359
- if( sizeof($data) < 1 ){ ?>
360
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
361
- <?php } else{
362
- foreach ($data as $key => $value) {
363
- ?>
364
- <option <?php selected( $convertkit_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
365
- <?php }} ?>
366
- </select>
367
- </div>
368
- <input type="button" rel-id="bten_convertkit_list" class="button bten_get_convertkit_lists" name="" value="Grab Lists">
369
- </div>
370
- </div>
371
- <?php
372
- $output = ob_get_contents();
373
- ob_end_clean();
374
- return $output;
375
- break;
376
-
377
- case 'getresponse':
378
- ob_start();
379
- ?>
380
- <div id="getresponse" class="newsletter-settings<?php if($platform == 'getresponse'){ echo ' current'; }?>">
381
- <div class="blossomthemes-email-newsletter-wrap-field">
382
- <label for="blossomthemes_email_newsletter_settings[getresponse][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
383
- <input type="text" id="bten_getresponse_api_key" name="blossomthemes_email_newsletter_settings[getresponse][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['getresponse']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['getresponse']['api-key'] ): '';?>">
384
- </div>
385
- <div class="blossomthemes-email-newsletter-wrap-field">
386
- <label for="blossomthemes_email_newsletter_settings[getresponse][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
387
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
388
- </span>
389
- </label>
390
- <?php
391
- $data = $this->getresponse_lists();
392
- ?>
393
- <div class="select-holder">
394
- <select id="bten_getresponse_list" name="blossomthemes_email_newsletter_settings[getresponse][list-id]">
395
- <?php
396
- $getresponse_list = isset($blossomthemes_email_newsletter_settings['getresponse']['list-id']) ? $blossomthemes_email_newsletter_settings['getresponse']['list-id'] : '';
397
- if( sizeof($data) < 1 ){ ?>
398
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
399
- <?php } else{ ?>
400
- <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
401
- <?php
402
- foreach ($data as $key => $value) {
403
- ?>
404
- <option <?php selected( $getresponse_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
405
- <?php }} ?>
406
- </select></div>
407
- <input type="button" rel-id="bten_getresponse_list" class="button bten_get_getresponse_lists" name="" value="Grab Lists">
408
- </div>
409
- </div>
410
- <?php
411
- $output = ob_get_contents();
412
- ob_end_clean();
413
- return $output;
414
- break;
415
-
416
- case 'activecampaign':
417
- ob_start();
418
- ?>
419
- <div id="activecampaign" class="newsletter-settings<?php if($platform == 'activecampaign'){ echo ' current'; }?>">
420
- <div class="blossomthemes-email-newsletter-wrap-field">
421
- <label for="blossomthemes_email_newsletter_settings[activecampaign][api-url]"><?php _e('API Url : ','blossomthemes-email-newsletter');?></label>
422
- <input type="text" id="bten_activecampaign_api_url" name="blossomthemes_email_newsletter_settings[activecampaign][api-url]" value="<?php echo isset($blossomthemes_email_newsletter_settings['activecampaign']['api-url']) ? esc_attr( $blossomthemes_email_newsletter_settings['activecampaign']['api-url'] ): '';?>">
423
- </div>
424
- <div class="blossomthemes-email-newsletter-wrap-field">
425
- <label for="blossomthemes_email_newsletter_settings[activecampaign][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
426
- <input type="text" id="bten_activecampaign_api_key" name="blossomthemes_email_newsletter_settings[activecampaign][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['activecampaign']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['activecampaign']['api-key'] ): '';?>">
427
- </div>
428
- <div class="blossomthemes-email-newsletter-wrap-field">
429
- <label for="blossomthemes_email_newsletter_settings[activecampaign][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
430
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
431
- </span>
432
- </label>
433
- <?php
434
- $data = $this->activecampaign_lists();
435
- // print_r($data);
436
- ?>
437
- <div class="select-holder">
438
- <select id="bten_activecampaign_list" name="blossomthemes_email_newsletter_settings[activecampaign][list-id]">
439
- <?php
440
- $activecampaign_list = isset( $blossomthemes_email_newsletter_settings['activecampaign']['list-id'] ) ? $blossomthemes_email_newsletter_settings['activecampaign']['list-id'] : '';
441
- if( sizeof($data) < 1 ){ ?>
442
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
443
- <?php } else{ ?>
444
- <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
445
- <?php
446
- foreach ($data as $key => $value) {
447
- ?>
448
- <option <?php selected( $activecampaign_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
449
- <?php }} ?>
450
- </select>
451
- </div>
452
- <input type="button" rel-id="bten_activecampaign_list" class="button bten_get_activecampaign_lists" name="" value="Grab Lists">
453
- </div>
454
- </div>
455
- <?php
456
- $output = ob_get_contents();
457
- ob_end_clean();
458
- return $output;
459
- break;
460
-
461
- case 'aweber':
462
- ob_start();
463
- ?>
464
- <div id="aweber" class="newsletter-settings<?php if($platform == 'aweber'){ echo ' current'; }?>">
465
-
466
- <?php
467
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
468
- $bten_aw_auth_info = get_option('bten_aw_auth_info');
469
-
470
- $appId = '9c213c43'; //Place APP ID here
471
- $url = "https://auth.aweber.com/1.0/oauth/authorize_app/".$appId;
472
- $status = $this->get_status($url);
473
-
474
- if($status!=200)
475
- {
476
- echo '<div class="blossomthemes-email-newsletter-note">' . __( 'The APP ID does not seem to exist. Please enter a valid AWeber APP ID to connect to the mailing lists.', 'blossomthemes-email-newsletter' ).'</div>';
477
- }
478
- else
479
- {
480
- echo '<div id="bten_aweber_connect_div"'.($bten_aw_auth_info ? 'style="display:none;"': '').'>';
481
- echo '<label>' .__('AWeber Connection : ','blossomthemes-email-newsletter'). '</label> ';
482
- echo '<b>Step 1:</b> <a href="https://auth.aweber.com/1.0/oauth/authorize_app/'.$appId.'" target="_blank">Click here to get your authorization code.</a><br />';
483
- echo '<b>Step 2:</b> Paste in your authorization code:<br />';
484
- echo '<textarea id="bten_aweber_auth_code" rows="3"></textarea><br />';
485
- echo '<input type="button" class="button-primary bten_aweber_auth" name="" value="Connect" />';
486
- echo '</div>';
487
-
488
- echo '<div id="bten_aweber_disconnect_div"'.($bten_aw_auth_info ? '': ' style="display:none;"').'>';
489
- echo '<label>' .__('AWeber Connection : ','blossomthemes-email-newsletter'). '</label> ';
490
- echo '<input type="button" class="button-primary bten_aweber_remove_auth" name="" value="Remove Connection" />';
491
- echo '</div>';
492
- ?>
493
- <div class="blossomthemes-email-newsletter-wrap-field">
494
- <label for="blossomthemes_email_newsletter_settings[aweber][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
495
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>">
496
- <i class="far fa-question-circle"></i>
497
- </span>
498
- </label>
499
- <div class="select-holder">
500
- <select id="bten_aweber_list" name="blossomthemes_email_newsletter_settings[aweber][list-id]">
501
- <?php
502
- $aw = new Blossomthemes_Email_Newsletter_AWeber;
503
- $aweber_list = isset($blossomthemes_email_newsletter_settings['aweber']['list-id']) ? $blossomthemes_email_newsletter_settings['aweber']['list-id'] : '';
504
- $data = $aw->bten_get_aw_lists();
505
- if( sizeof($data) < 1 ){ ?>
506
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
507
- <?php } else{ ?>
508
- <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
509
- <?php
510
- foreach ($data as $key => $value) {
511
- ?>
512
- <option <?php selected( $aweber_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
513
- <?php }} ?>
514
- </select>
515
- </div>
516
- <input type="button" rel-id="bten_aweber_list" class="button bten_get_aweber_lists" name="" value="Grab Lists">
517
- </div>
518
- <?php
519
- }
520
-
521
- ?>
522
- </div>
523
- <?php
524
- $output = ob_get_contents();
525
- ob_end_clean();
526
- return $output;
527
- break;
528
-
529
- default:
530
- ob_start();
531
- ?>
532
- <div id="mailchimp" class="newsletter-settings current">
533
- <div class="blossomthemes-email-newsletter-wrap-field">
534
- <label for="blossomthemes_email_newsletter_settings[mailchimp][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
535
- <input type="text" id="bten_mailchimp_api_key" name="blossomthemes_email_newsletter_settings[mailchimp][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailchimp']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ): '';?>">
536
- <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your API key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://us15.admin.mailchimp.com/account/api/" target="_blank">','</a>' ).'</div>';?>
537
- </div>
538
- <div class="blossomthemes-email-newsletter-wrap-field">
539
- <label for="blossomthemes_email_newsletter_settings[mailchimp][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
540
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
541
- </span>
542
- </label>
543
- <?php
544
- $data = $this->mailchimp_lists();
545
- ?>
546
- <div class="select-holder">
547
- <select id="bten_mailchimp_list" name="blossomthemes_email_newsletter_settings[mailchimp][list-id]">
548
- <?php $mailchimp_list = isset($blossomthemes_email_newsletter_settings['mailchimp']['list-id']) ? $blossomthemes_email_newsletter_settings['mailchimp']['list-id'] : '' ;
549
- if( sizeof($data['lists']) < 1 ){ ?>
550
- <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
551
- <?php } else{
552
- $max = max(array_keys($data['lists']));
553
- for ($i=0; $i <= $max; $i++) { ?>
554
- <option <?php selected( $mailchimp_list, esc_attr($data['lists'][$i]['id'] ) );?> value="<?php echo esc_attr($data['lists'][$i]['id']);?>"><?php echo esc_attr($data['lists'][$i]['name']);?></option>
555
-
556
- <?php }} ?>
557
- </select>
558
- </div>
559
- <input type="button" rel-id="bten_mailchimp_list" class="button bten_get_mailchimp_lists" name="" value="Grab Lists">
560
- </div>
561
- <div class="blossomthemes-email-newsletter-wrap-field">
562
- <input type="checkbox" class="enable_notif_opt" name="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" <?php $j = isset( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ): '0';?> id="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?>/>
563
-
564
- <label for="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]"><?php _e('Confirmation','blossomthemes-email-newsletter');?>
565
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Check this box if you want subscribers to receive confirmation mail before they are added to list.', 'blossomthemes-email-newsletter' ); ?>">
566
- <i class="far fa-question-circle"></i>
567
- </span>
568
- </label>
569
- </div>
570
- </div>
571
- <?php
572
- $output = ob_get_contents();
573
- ob_end_clean();
574
- return $output;
575
- break;
576
- }
577
- }
578
- }
579
- new BlossomThemes_Email_Newsletter_Settings;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Settings section of the plugin.
4
+ *
5
+ * Maintain a list of functions that are used for settings purposes of the plugin
6
+ *
7
+ * @package BlossomThemes Email Newsletters
8
+ * @subpackage BlossomThemes_Email_Newsletters/includes
9
+ * @author blossomthemes
10
+ */
11
+ class BlossomThemes_Email_Newsletter_Settings {
12
+
13
+ function __construct()
14
+ {
15
+ add_action( 'wp_ajax_bten_get_platform', array( $this, 'bten_get_platform' ) );
16
+ }
17
+
18
+ function bten_get_platform(){
19
+ if ($_POST['calling_action'] == 'bten_platform_settings')
20
+ {
21
+ echo $this->bten_platform_settings($_POST['platform']);
22
+ exit;
23
+ }
24
+ }
25
+
26
+ function mailerlite_lists($api_key='')
27
+ {
28
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
29
+
30
+ if( empty($api_key) && isset( $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] ) && $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] !='' )
31
+ {
32
+ $api_key = $blossomthemes_email_newsletter_settings['mailerlite']['api-key'];
33
+ }
34
+
35
+ $key = preg_replace('/[^a-z0-9]/i', '', $api_key);
36
+ $ML_Lists = new ML_Lists($key);
37
+ $lists = $ML_Lists->getAll();
38
+ $data = json_decode($lists, TRUE);
39
+ return $data;
40
+
41
+ }
42
+
43
+ function mailchimp_lists($api_key='')
44
+ {
45
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
46
+
47
+ if( empty($api_key ) && isset( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ) && $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] !='' )
48
+ {
49
+ $api_key = $blossomthemes_email_newsletter_settings['mailchimp']['api-key'];
50
+ }
51
+
52
+ $MC_Lists = new MC_Lists($api_key);
53
+ $lists = $MC_Lists->getAll();
54
+ $data = json_decode($lists, TRUE);
55
+ return $data;
56
+
57
+ }
58
+
59
+ /**
60
+ * Get Sendinblue lists.
61
+ *
62
+ * @return void
63
+ */
64
+ function sendinblue_lists() {
65
+ $lists = array();
66
+
67
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', false );
68
+
69
+ if ( ! $blossomthemes_email_newsletter_settings ) {
70
+ return $lists;
71
+ }
72
+
73
+ $api_key = isset( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) : '';
74
+ // get lists.
75
+ $lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
76
+ if ( false === $lists || false == $lists ) {
77
+
78
+ $mailin = new SendinblueApiClient();
79
+ $lists = array();
80
+ $list_data = $mailin->getAllLists();
81
+
82
+ if (!empty($list_data['lists'])) {
83
+ foreach ( $list_data['lists'] as $value ) {
84
+ if ( 'Temp - DOUBLE OPTIN' == $value['name'] ) {
85
+ $tempList = $value['id'];
86
+ update_option( 'bten_sib_temp_list', $tempList );
87
+ continue;
88
+ }
89
+ $lists[] = array(
90
+ 'id' => $value['id'],
91
+ 'name' => $value['name'],
92
+ );
93
+ }
94
+ }
95
+ }
96
+ if ( count( $lists ) > 0 ) {
97
+ set_transient( 'bten_sib_list_' . md5( $api_key ), $lists, 4 * HOUR_IN_SECONDS );
98
+ }
99
+ return $lists;
100
+ }
101
+
102
+ function convertkit_lists($apikey = '')
103
+ {
104
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
105
+ $list = array();
106
+ if( empty($apikey ) && isset( $blossomthemes_email_newsletter_settings['convertkit']['api-key'] ) && $blossomthemes_email_newsletter_settings['convertkit']['api-key'] !='' )
107
+ {
108
+ $apikey = $blossomthemes_email_newsletter_settings['convertkit']['api-key'];
109
+ }
110
+
111
+ $api = new Convertkit($apikey);
112
+
113
+ try {
114
+ $result = $api->getForms();
115
+
116
+ if (isset($result->forms)) {
117
+ foreach ($result->forms as $l) {
118
+ $list[$l->id] = array('name' => $l->name);
119
+ }
120
+ }
121
+ }
122
+ catch (Exception $e) {
123
+ echo $e->getMessage();
124
+ }
125
+
126
+ return $list;
127
+ }
128
+
129
+ /**
130
+ * Get Response API
131
+ *
132
+ */
133
+ function getresponse_lists($api_key = '')
134
+ {
135
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
136
+ $list = array();
137
+
138
+ if( empty($api_key ) && isset( $blossomthemes_email_newsletter_settings['getresponse']['api-key'] ) && $blossomthemes_email_newsletter_settings['getresponse']['api-key'] !='' )
139
+ {
140
+ $api_key = $blossomthemes_email_newsletter_settings['getresponse']['api-key']; //Place API key here
141
+ }
142
+
143
+ if(!empty($api_key))
144
+ {
145
+ $getresponse = new GetResponse( $api_key );
146
+ $account = $getresponse->accounts();
147
+
148
+ if( isset( $account->accountId ) && '' != $account->accountId ){
149
+
150
+ $campaigns = $getresponse->getCampaigns();
151
+
152
+ if( !empty( $campaigns ) ){
153
+ foreach ($campaigns as $k => $v) {
154
+ $list[$v->campaignId]['name'] = $v->name;
155
+ }
156
+ } # END if( !empty( $campaigns ) )
157
+ else{
158
+ echo ('Connection Problem: Invalid API key');
159
+ }
160
+
161
+ }
162
+
163
+ }
164
+ return $list;
165
+ }
166
+
167
+ /**
168
+ * ActiveCampaign API
169
+ *
170
+ */
171
+ function activecampaign_lists($api_key = '', $url = '')
172
+ {
173
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
174
+ $list = array();
175
+ if( empty($api_key) && empty($url) && isset($blossomthemes_email_newsletter_settings['activecampaign']['api-url']) && $blossomthemes_email_newsletter_settings['activecampaign']['api-url']!='' && isset($blossomthemes_email_newsletter_settings['activecampaign']['api-key']) && $blossomthemes_email_newsletter_settings['activecampaign']['api-key']!='' )
176
+ {
177
+ $api_key = $blossomthemes_email_newsletter_settings['activecampaign']['api-key']; //Place API key here
178
+ $url = $blossomthemes_email_newsletter_settings['activecampaign']['api-url'];
179
+ }
180
+
181
+ if(!empty($api_key) && !empty($url)){
182
+
183
+ $ac = new ActiveCampaign($url, $api_key);
184
+ try
185
+ {
186
+ $response = $ac->api( "list/list", array('ids' => 'all') );
187
+ // print_r($response);
188
+ if (is_object($response) && !empty($response) && $response->success==1) {
189
+ foreach ($response as $v) {
190
+ if(is_object($v)) {
191
+ $list[$v->id] = array('name' => $v->name);
192
+ }
193
+ }
194
+ }
195
+ elseif( is_object($response) && !empty($response) && $response->success==0 ){
196
+ echo $response->result_message;
197
+ }
198
+ else{
199
+ echo $response;
200
+ }
201
+
202
+ } catch (Exception $e){
203
+ echo $e->getMessage();
204
+ }
205
+
206
+ }
207
+ return $list;
208
+ }
209
+
210
+ function get_status($url)
211
+ {
212
+ // must set $url first.
213
+ $ch = curl_init();
214
+ curl_setopt($ch, CURLOPT_URL, $url);
215
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
216
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
217
+ // do your curl thing here
218
+ $data = curl_exec($ch);
219
+ $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
220
+ curl_close($ch);
221
+ return $http_status;
222
+ }
223
+
224
+ function blossomthemes_email_newsletter_settings_tabs() {
225
+
226
+ $tabs = array(
227
+ 'general' => 'general.php',
228
+ 'popup' => 'popup.php',
229
+ );
230
+ $tabs = apply_filters( 'blossomthemes_email_newsletter_settings_tabs', $tabs );
231
+ return $tabs;
232
+ }
233
+
234
+ function blossomthemes_email_newsletter_backend_settings()
235
+ { ?>
236
+ <div class="wrap">
237
+ <div class="btnb-header">
238
+ <h3><?php _e('Settings','blossomthemes-email-newsletter');?></h3>
239
+ </div>
240
+ <?php
241
+ if( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] ==true )
242
+ { ?>
243
+ <div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible">
244
+ <p><strong><?php _e('Settings updated.','blossomthemes-email-newsletter');?></strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php _e('Dismiss this notice.','blossomthemes-email-newsletter');?></span></button>
245
+ </div>
246
+ <?php
247
+ }
248
+ ?>
249
+ <div id="tabs-container">
250
+ <ul class="tabs-menu">
251
+ <?php
252
+ $settings_tab = $this->blossomthemes_email_newsletter_settings_tabs();
253
+ $count = 0;
254
+ foreach ($settings_tab as $key => $value) {
255
+ $tab_label = preg_replace('/_/', ' ', $key);
256
+ ?>
257
+ <li <?php if($count==0){ ?>class="current"<?php } ?>><a href="<?php echo $key;?>"><?php echo $tab_label;?></a></li>
258
+ <?php $count++;
259
+ } ?>
260
+ </ul>
261
+ <div class="tab">
262
+ <form method="POST" name="form1" action="options.php" id="form1" class="btemn-settings-form">
263
+ <?php
264
+ settings_fields( 'blossomthemes_email_newsletter_settings' );
265
+ do_settings_sections( __FILE__ );
266
+
267
+ $counter = 0;
268
+ foreach ($settings_tab as $key => $value) { ?>
269
+ <div id="<?php echo $key;?>" class="tab-content" <?php if($counter==0){ ?> style="display: block;" <?php } else{ ?> style="display: none;" <?php } ?>>
270
+ <?php
271
+ include_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/tabs/'.$value;
272
+ ?>
273
+ </div>
274
+ <?php $counter++; }
275
+ ?>
276
+
277
+ <div class="blossomthemes_email_newsletter_settings-settings-submit">
278
+ <?php echo submit_button();?>
279
+ </div>
280
+ </form>
281
+ </div>
282
+ </div>
283
+ </div>
284
+ <?php
285
+ }
286
+
287
+ function bten_platform_settings($platform='')
288
+ {
289
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
290
+ switch ($platform) {
291
+ case 'mailchimp':
292
+ ob_start();
293
+ ?>
294
+ <div id="mailchimp" class="newsletter-settings<?php if( $platform == 'mailchimp' || !isset($platform) ){ echo ' current'; }?>">
295
+ <div class="blossomthemes-email-newsletter-wrap-field">
296
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
297
+ <input type="text" id="bten_mailchimp_api_key" name="blossomthemes_email_newsletter_settings[mailchimp][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailchimp']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ): '';?>">
298
+ <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your API key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://us15.admin.mailchimp.com/account/api/" target="_blank">','</a>' ).'</div>';?>
299
+ </div>
300
+ <div class="blossomthemes-email-newsletter-wrap-field">
301
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
302
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
303
+ </span>
304
+ </label>
305
+ <?php
306
+ $data = $this->mailchimp_lists();
307
+ ?>
308
+ <div class="select-holder">
309
+ <select id="bten_mailchimp_list" name="blossomthemes_email_newsletter_settings[mailchimp][list-id]">
310
+ <?php $mailchimp_list = isset($blossomthemes_email_newsletter_settings['mailchimp']['list-id']) ? $blossomthemes_email_newsletter_settings['mailchimp']['list-id'] : '';
311
+ if( sizeof($data['lists']) < 1 ){ ?>
312
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
313
+ <?php } else{
314
+ $max = max(array_keys($data['lists']));
315
+ for ($i=0; $i <= $max; $i++) { ?>
316
+ <option <?php selected( $mailchimp_list, esc_attr($data['lists'][$i]['id'] ) );?> value="<?php echo esc_attr($data['lists'][$i]['id']);?>"><?php echo esc_attr($data['lists'][$i]['name']);?></option>
317
+
318
+ <?php }} ?>
319
+ </select>
320
+ </div>
321
+ <input type="button" rel-id="bten_mailchimp_list" class="button bten_get_mailchimp_lists" name="" value="Grab Lists">
322
+
323
+ </div>
324
+ <div class="blossomthemes-email-newsletter-wrap-field">
325
+ <input type="checkbox" class="enable_notif_opt" name="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" <?php $j = isset( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ): '0';?> id="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?>/>
326
+
327
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]"><?php _e('Confirmation','blossomthemes-email-newsletter');?>
328
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Check this box if you want subscribers to receive confirmation mail before they are added to list.', 'blossomthemes-email-newsletter' ); ?>">
329
+ <i class="far fa-question-circle"></i>
330
+ </span>
331
+ </label>
332
+ </div>
333
+ </div>
334
+ <?php
335
+ $output = ob_get_contents();
336
+ ob_end_clean();
337
+ return $output;
338
+ break;
339
+
340
+ case 'mailerlite':
341
+ ob_start();
342
+ ?>
343
+ <div id="mailerlite" class="newsletter-settings<?php if($platform == 'mailerlite'){ echo ' current'; }?>">
344
+ <div class="blossomthemes-email-newsletter-wrap-field">
345
+ <label for="blossomthemes_email_newsletter_settings[mailerlite][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
346
+ <input type="text" id="bten_mailerlite_api_key" name="blossomthemes_email_newsletter_settings[mailerlite][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailerlite']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailerlite']['api-key'] ): '';?>">
347
+ <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your api key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://app.mailerlite.com/subscribe/api" target="_blank">','</a>' ).'</div>';?>
348
+ </div>
349
+ <div class="blossomthemes-email-newsletter-wrap-field">
350
+ <label for="blossomthemes_email_newsletter_settings[mailerlite][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
351
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
352
+ </span>
353
+ </label>
354
+ <?php
355
+ $data = $this->mailerlite_lists();
356
+ ?>
357
+ <div class="select-holder">
358
+ <select id="bten_mailerlite_list" name="blossomthemes_email_newsletter_settings[mailerlite][list-id]">
359
+ <?php $mailerlite_list = isset($blossomthemes_email_newsletter_settings['mailerlite']['list-id']) ? $blossomthemes_email_newsletter_settings['mailerlite']['list-id']: '';
360
+ if( empty($data['Results']) ){ ?>
361
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
362
+ <?php } else{
363
+ $max = max(array_keys($data['Results']));
364
+ for ($i=0; $i <= $max; $i++) { ?>
365
+ <option <?php selected( $mailerlite_list, esc_attr($data['Results'][$i]['id'] ) );?> value="<?php echo esc_attr($data['Results'][$i]['id']);?>"><?php echo esc_attr($data['Results'][$i]['name']);?></option>
366
+
367
+ <?php }} ?>
368
+ </select>
369
+ </div>
370
+ <input type="button" rel-id="bten_mailerlite_list" class="button bten_get_mailerlite_lists" name="" value="Grab Lists">
371
+ </div>
372
+ </div>
373
+ <?php
374
+ $output = ob_get_contents();
375
+ ob_end_clean();
376
+ return $output;
377
+ break;
378
+
379
+ case 'convertkit':
380
+ ob_start();
381
+ ?>
382
+ <div id="convertkit" class="newsletter-settings<?php if($platform == 'convertkit'){ echo ' current'; }?>">
383
+ <div class="blossomthemes-email-newsletter-wrap-field">
384
+ <label for="blossomthemes_email_newsletter_settings[convertkit][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
385
+ <input type="text" id="bten_convertkit_api_key" name="blossomthemes_email_newsletter_settings[convertkit][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['convertkit']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['convertkit']['api-key'] ): '';?>">
386
+ </div>
387
+ <div class="blossomthemes-email-newsletter-wrap-field">
388
+ <label for="blossomthemes_email_newsletter_settings[convertkit][api-secret]"><?php _e('API Secret : ','blossomthemes-email-newsletter');?></label>
389
+ <input type="text" id="bten_convertkit_api_secret" name="blossomthemes_email_newsletter_settings[convertkit][api-secret]" value="<?php echo isset($blossomthemes_email_newsletter_settings['convertkit']['api-secret']) ? esc_attr( $blossomthemes_email_newsletter_settings['convertkit']['api-secret'] ): '';?>">
390
+ </div>
391
+ <div class="blossomthemes-email-newsletter-wrap-field">
392
+ <label for="blossomthemes_email_newsletter_settings[convertkit][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
393
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
394
+ </span>
395
+ </label>
396
+ <?php
397
+ $data = $this->convertkit_lists();
398
+ ?>
399
+ <div class="select-holder">
400
+ <select id="bten_convertkit_list" name="blossomthemes_email_newsletter_settings[convertkit][list-id]">
401
+ <?php $convertkit_list = isset( $blossomthemes_email_newsletter_settings['convertkit']['list-id'] ) ? $blossomthemes_email_newsletter_settings['convertkit']['list-id'] : '';
402
+ if( sizeof($data) < 1 ){ ?>
403
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
404
+ <?php } else{
405
+ foreach ($data as $key => $value) {
406
+ ?>
407
+ <option <?php selected( $convertkit_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
408
+ <?php }} ?>
409
+ </select>
410
+ </div>
411
+ <input type="button" rel-id="bten_convertkit_list" class="button bten_get_convertkit_lists" name="" value="Grab Lists">
412
+ </div>
413
+ </div>
414
+ <?php
415
+ $output = ob_get_contents();
416
+ ob_end_clean();
417
+ return $output;
418
+ break;
419
+
420
+ case 'getresponse':
421
+ ob_start();
422
+ ?>
423
+ <div id="getresponse" class="newsletter-settings<?php if($platform == 'getresponse'){ echo ' current'; }?>">
424
+ <div class="blossomthemes-email-newsletter-wrap-field">
425
+ <label for="blossomthemes_email_newsletter_settings[getresponse][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
426
+ <input type="text" id="bten_getresponse_api_key" name="blossomthemes_email_newsletter_settings[getresponse][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['getresponse']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['getresponse']['api-key'] ): '';?>">
427
+ </div>
428
+ <div class="blossomthemes-email-newsletter-wrap-field">
429
+ <label for="blossomthemes_email_newsletter_settings[getresponse][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
430
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
431
+ </span>
432
+ </label>
433
+ <?php
434
+ $data = $this->getresponse_lists();
435
+ ?>
436
+ <div class="select-holder">
437
+ <select id="bten_getresponse_list" name="blossomthemes_email_newsletter_settings[getresponse][list-id]">
438
+ <?php
439
+ $getresponse_list = isset($blossomthemes_email_newsletter_settings['getresponse']['list-id']) ? $blossomthemes_email_newsletter_settings['getresponse']['list-id'] : '';
440
+ if( sizeof($data) < 1 ){ ?>
441
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
442
+ <?php } else{ ?>
443
+ <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
444
+ <?php
445
+ foreach ($data as $key => $value) {
446
+ ?>
447
+ <option <?php selected( $getresponse_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
448
+ <?php }} ?>
449
+ </select></div>
450
+ <input type="button" rel-id="bten_getresponse_list" class="button bten_get_getresponse_lists" name="" value="Grab Lists">
451
+ </div>
452
+ </div>
453
+ <?php
454
+ $output = ob_get_contents();
455
+ ob_end_clean();
456
+ return $output;
457
+ break;
458
+
459
+ case 'activecampaign':
460
+ ob_start();
461
+ ?>
462
+ <div id="activecampaign" class="newsletter-settings<?php if($platform == 'activecampaign'){ echo ' current'; }?>">
463
+ <div class="blossomthemes-email-newsletter-wrap-field">
464
+ <label for="blossomthemes_email_newsletter_settings[activecampaign][api-url]"><?php _e('API Url : ','blossomthemes-email-newsletter');?></label>
465
+ <input type="text" id="bten_activecampaign_api_url" name="blossomthemes_email_newsletter_settings[activecampaign][api-url]" value="<?php echo isset($blossomthemes_email_newsletter_settings['activecampaign']['api-url']) ? esc_attr( $blossomthemes_email_newsletter_settings['activecampaign']['api-url'] ): '';?>">
466
+ </div>
467
+ <div class="blossomthemes-email-newsletter-wrap-field">
468
+ <label for="blossomthemes_email_newsletter_settings[activecampaign][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
469
+ <input type="text" id="bten_activecampaign_api_key" name="blossomthemes_email_newsletter_settings[activecampaign][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['activecampaign']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['activecampaign']['api-key'] ): '';?>">
470
+ </div>
471
+ <div class="blossomthemes-email-newsletter-wrap-field">
472
+ <label for="blossomthemes_email_newsletter_settings[activecampaign][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
473
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
474
+ </span>
475
+ </label>
476
+ <?php
477
+ $data = $this->activecampaign_lists();
478
+ // print_r($data);
479
+ ?>
480
+ <div class="select-holder">
481
+ <select id="bten_activecampaign_list" name="blossomthemes_email_newsletter_settings[activecampaign][list-id]">
482
+ <?php
483
+ $activecampaign_list = isset( $blossomthemes_email_newsletter_settings['activecampaign']['list-id'] ) ? $blossomthemes_email_newsletter_settings['activecampaign']['list-id'] : '';
484
+ if( sizeof($data) < 1 ){ ?>
485
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
486
+ <?php } else{ ?>
487
+ <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
488
+ <?php
489
+ foreach ($data as $key => $value) {
490
+ ?>
491
+ <option <?php selected( $activecampaign_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
492
+ <?php }} ?>
493
+ </select>
494
+ </div>
495
+ <input type="button" rel-id="bten_activecampaign_list" class="button bten_get_activecampaign_lists" name="" value="Grab Lists">
496
+ </div>
497
+ </div>
498
+ <?php
499
+ $output = ob_get_contents();
500
+ ob_end_clean();
501
+ return $output;
502
+ break;
503
+
504
+ case 'aweber':
505
+ ob_start();
506
+ ?>
507
+ <div id="aweber" class="newsletter-settings<?php if($platform == 'aweber'){ echo ' current'; }?>">
508
+
509
+ <?php
510
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
511
+ $bten_aw_auth_info = get_option('bten_aw_auth_info');
512
+
513
+ $appId = '9c213c43'; //Place APP ID here
514
+ $url = "https://auth.aweber.com/1.0/oauth/authorize_app/".$appId;
515
+ $status = $this->get_status($url);
516
+
517
+ if($status!=200)
518
+ {
519
+ echo '<div class="blossomthemes-email-newsletter-note">' . __( 'The APP ID does not seem to exist. Please enter a valid AWeber APP ID to connect to the mailing lists.', 'blossomthemes-email-newsletter' ).'</div>';
520
+ }
521
+ else
522
+ {
523
+ echo '<div id="bten_aweber_connect_div"'.($bten_aw_auth_info ? 'style="display:none;"': '').'>';
524
+ echo '<label>' .__('AWeber Connection : ','blossomthemes-email-newsletter'). '</label> ';
525
+ echo '<b>Step 1:</b> <a href="https://auth.aweber.com/1.0/oauth/authorize_app/'.$appId.'" target="_blank">Click here to get your authorization code.</a><br />';
526
+ echo '<b>Step 2:</b> Paste in your authorization code:<br />';
527
+ echo '<textarea id="bten_aweber_auth_code" rows="3"></textarea><br />';
528
+ echo '<input type="button" class="button-primary bten_aweber_auth" name="" value="Connect" />';
529
+ echo '</div>';
530
+
531
+ echo '<div id="bten_aweber_disconnect_div"'.($bten_aw_auth_info ? '': ' style="display:none;"').'>';
532
+ echo '<label>' .__('AWeber Connection : ','blossomthemes-email-newsletter'). '</label> ';
533
+ echo '<input type="button" class="button-primary bten_aweber_remove_auth" name="" value="Remove Connection" />';
534
+ echo '</div>';
535
+ ?>
536
+ <div class="blossomthemes-email-newsletter-wrap-field">
537
+ <label for="blossomthemes_email_newsletter_settings[aweber][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
538
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>">
539
+ <i class="far fa-question-circle"></i>
540
+ </span>
541
+ </label>
542
+ <div class="select-holder">
543
+ <select id="bten_aweber_list" name="blossomthemes_email_newsletter_settings[aweber][list-id]">
544
+ <?php
545
+ $aw = new Blossomthemes_Email_Newsletter_AWeber;
546
+ $aweber_list = isset($blossomthemes_email_newsletter_settings['aweber']['list-id']) ? $blossomthemes_email_newsletter_settings['aweber']['list-id'] : '';
547
+ $data = $aw->bten_get_aw_lists();
548
+ if( sizeof($data) < 1 ){ ?>
549
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
550
+ <?php } else{ ?>
551
+ <option value=""><?php _e('Choose Campaign ID','blossomthemes-email-newsletter');?></option>
552
+ <?php
553
+ foreach ($data as $key => $value) {
554
+ ?>
555
+ <option <?php selected( $aweber_list, esc_attr($key) );?> value="<?php echo esc_attr($key);?>"><?php echo esc_attr($value['name']);?></option>
556
+ <?php }} ?>
557
+ </select>
558
+ </div>
559
+ <input type="button" rel-id="bten_aweber_list" class="button bten_get_aweber_lists" name="" value="Grab Lists">
560
+ </div>
561
+ <?php
562
+ }
563
+
564
+ ?>
565
+ </div>
566
+ <?php
567
+ $output = ob_get_contents();
568
+ ob_end_clean();
569
+ return $output;
570
+ break;
571
+
572
+ case 'sendinblue' :
573
+ ob_start();
574
+ ?>
575
+ <div id="sendinblue-settings" class="newsletter-settings <?php echo 'sendinblue' === $platform ? esc_attr( 'current' ) : ''; ?>">
576
+ <div class="blossomthemes-email-newsletter-wrap-field">
577
+ <label for="blossomthemes_email_newsletter_settings[sendinblue][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
578
+ <input type="text" id="bten_sendinblue_api_key" name="blossomthemes_email_newsletter_settings[sendinblue][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['sendinblue']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ): '';?>">
579
+ <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your API key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://my.sendinblue.com/advanced/apikey/" target="_blank">','</a>' ).'</div>';?>
580
+ </div>
581
+ <div class="blossomthemes-email-newsletter-wrap-field">
582
+ <label for="blossomthemes_email_newsletter_settings[sendinblue][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
583
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>">
584
+ <i class="far fa-question-circle"></i>
585
+ </span>
586
+ </label>
587
+ <?php
588
+ $data = $this->sendinblue_lists();
589
+ ?>
590
+ <div class="select-holder">
591
+ <select id="bten_sendinblue_list" name="blossomthemes_email_newsletter_settings[sendinblue][list-id]">
592
+ <?php
593
+ $sendinblue_list = isset( $blossomthemes_email_newsletter_settings['sendinblue']['list-id'] ) ? $blossomthemes_email_newsletter_settings['sendinblue']['list-id'] : '' ;
594
+ if ( empty( $data ) ) { ?>
595
+ <option value="-">
596
+ <?php _e('No Lists Found','blossomthemes-email-newsletter');?>
597
+ </option>
598
+ <?php
599
+ } else {
600
+ echo '<option>'. esc_html( 'Choose sendinblue list' ) .'</option>';
601
+ foreach ( $data as $listarray => $list ) {
602
+ echo '<option '. selected( $sendinblue_list, $list['id'] ) .' value="'. esc_attr( $list['id'] ) .'" >'. esc_html( $list['name'] ) .'</option>';
603
+ }
604
+ }
605
+ ?>
606
+ </select>
607
+ </div>
608
+ <input type="button" rel-id="bten_sendinblue_list" class="button bten_get_sendinblue_lists" name="" value="<?php esc_attr_e( 'Grab Lists', 'blossomthemes-email-newsletter' ); ?>">
609
+ </div>
610
+ </div>
611
+ <?php
612
+ $output = ob_get_clean();
613
+ return $output;
614
+ break;
615
+
616
+ default:
617
+ ob_start();
618
+ ?>
619
+ <div id="mailchimp" class="newsletter-settings current">
620
+ <div class="blossomthemes-email-newsletter-wrap-field">
621
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][api-key]"><?php _e('API Key : ','blossomthemes-email-newsletter');?></label>
622
+ <input type="text" id="bten_mailchimp_api_key" name="blossomthemes_email_newsletter_settings[mailchimp][api-key]" value="<?php echo isset($blossomthemes_email_newsletter_settings['mailchimp']['api-key']) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['api-key'] ): '';?>">
623
+ <?php echo '<div class="blossomthemes-email-newsletter-note">'.sprintf( __( 'Get your API key %1$shere%2$s', 'blossomthemes-email-newsletter' ), '<a href="https://us15.admin.mailchimp.com/account/api/" target="_blank">','</a>' ).'</div>';?>
624
+ </div>
625
+ <div class="blossomthemes-email-newsletter-wrap-field">
626
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][list-id]"><?php _e('List Id : ','blossomthemes-email-newsletter');?>
627
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose the default list. If no groups/lists are selected in the newsletter posts, users will be subscribed to the list selected above.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
628
+ </span>
629
+ </label>
630
+ <?php
631
+ $data = $this->mailchimp_lists();
632
+ ?>
633
+ <div class="select-holder">
634
+ <select id="bten_mailchimp_list" name="blossomthemes_email_newsletter_settings[mailchimp][list-id]">
635
+ <?php $mailchimp_list = isset($blossomthemes_email_newsletter_settings['mailchimp']['list-id']) ? $blossomthemes_email_newsletter_settings['mailchimp']['list-id'] : '' ;
636
+ if( sizeof($data['lists']) < 1 ){ ?>
637
+ <option value="-"><?php _e('No Lists Found','blossomthemes-email-newsletter');?></option>
638
+ <?php } else{
639
+ $max = max(array_keys($data['lists']));
640
+ for ($i=0; $i <= $max; $i++) { ?>
641
+ <option <?php selected( $mailchimp_list, esc_attr($data['lists'][$i]['id'] ) );?> value="<?php echo esc_attr($data['lists'][$i]['id']);?>"><?php echo esc_attr($data['lists'][$i]['name']);?></option>
642
+
643
+ <?php }} ?>
644
+ </select>
645
+ </div>
646
+ <input type="button" rel-id="bten_mailchimp_list" class="button bten_get_mailchimp_lists" name="" value="Grab Lists">
647
+ </div>
648
+ <div class="blossomthemes-email-newsletter-wrap-field">
649
+ <input type="checkbox" class="enable_notif_opt" name="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" <?php $j = isset( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] ): '0';?> id="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]" value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?>/>
650
+
651
+ <label for="blossomthemes_email_newsletter_settings[mailchimp][enable_notif]"><?php _e('Confirmation','blossomthemes-email-newsletter');?>
652
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Check this box if you want subscribers to receive confirmation mail before they are added to list.', 'blossomthemes-email-newsletter' ); ?>">
653
+ <i class="far fa-question-circle"></i>
654
+ </span>
655
+ </label>
656
+ </div>
657
+ </div>
658
+ <?php
659
+ $output = ob_get_contents();
660
+ ob_end_clean();
661
+ return $output;
662
+ break;
663
+ }
664
+ }
665
+ }
666
+ new BlossomThemes_Email_Newsletter_Settings;
includes/class-blossomthemes-email-newsletter-shortcodes.php CHANGED
@@ -1,441 +1,460 @@
1
- <?php
2
- /**
3
- * Frontend view of the plugin.
4
- *
5
- * @package Blossomthemes_Email_Newsletter
6
- * @subpackage Blossomthemes_Email_Newsletter/includes
7
- * @author blossomthemes
8
- */
9
- class Blossomthemes_Email_Newsletter_Shortcodes {
10
-
11
- function __construct()
12
- {
13
- add_shortcode( 'BTEN', array( $this, 'blossomthemes_email_newsletter_shortcode_callback' ) );
14
- add_action( 'wp_ajax_subscription_response', array( $this, 'blossomthemes_email_newsletter_ajax_callback' ) );
15
- add_action( 'wp_ajax_nopriv_subscription_response', array( $this, 'blossomthemes_email_newsletter_ajax_callback' ) );
16
- }
17
-
18
- //function to generate shortcode
19
- function blossomthemes_email_newsletter_shortcode_callback( $atts, $content = "" )
20
- {
21
- $obj = new Blossomthemes_Email_Newsletter_Functions;
22
-
23
- $atts = shortcode_atts( array(
24
- 'id' => '',
25
- ), $atts, 'BTEN' );
26
- $atts['id'] = absint($atts['id']);
27
- $rrsb_bg = '';
28
- $rrsb_font = '';
29
- $blossomthemes_email_newsletter_setting = get_post_meta( $atts['id'], 'blossomthemes_email_newsletter_setting', true );
30
- $settings = get_option( 'blossomthemes_email_newsletter_settings', true );
31
- $rrsb_option = ! empty( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) : 'bg-color';
32
-
33
- if( $rrsb_option == 'image' )
34
- {
35
- $overlay = isset( $blossomthemes_email_newsletter_setting['appearance']['overlay'] ) && $blossomthemes_email_newsletter_setting['appearance']['overlay'] == '1' ? ' has-overlay' : ' no-overlay';
36
- if( isset( $blossomthemes_email_newsletter_setting['appearance']['bg']) && $blossomthemes_email_newsletter_setting['appearance']['bg']!='' )
37
- {
38
- $attachment_id = $blossomthemes_email_newsletter_setting['appearance']['bg'];
39
- $newsletter_bio_img_size = apply_filters('bt_newsletter_img_size','full');
40
- $image_array = wp_get_attachment_image_src( $attachment_id, $newsletter_bio_img_size );
41
- $rrsb_bg = 'url('.$image_array[0].') no-repeat';
42
- }
43
- }
44
- else{
45
- if( isset( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['bgcolor']!='' )
46
- {
47
- $rrsb_bg = ! empty( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
48
- }
49
- elseif( isset( $settings['appearance']['bgcolor'] ) && $settings['appearance']['bgcolor']!='' )
50
- {
51
- $rrsb_bg = ! empty( $settings['appearance']['bgcolor'] ) ? sanitize_text_field( $settings['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
52
- }
53
- }
54
- if( isset( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['fontcolor']!='' )
55
- {
56
- $rrsb_font = ! empty( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
57
- }
58
- elseif( isset( $settings['appearance']['fontcolor'] ) && $settings['appearance']['fontcolor']!='' )
59
- {
60
- $rrsb_font = ! empty( $settings['appearance']['fontcolor'] ) ? sanitize_text_field( $settings['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
61
- }
62
-
63
- ob_start();
64
- ?>
65
- <div class="blossomthemes-email-newsletter-wrapper<?php if(isset($rrsb_option) && $rrsb_option == 'image'){ echo ' bg-img', $overlay;}?>" id="boxes-<?php echo esc_attr($atts['id']);?>" style="background: <?php echo esc_attr($rrsb_bg);?>; color: <?php echo esc_attr($rrsb_font);?> ">
66
-
67
- <?php $inner_wrap = apply_filters( 'bt_newsletter_shortcode_inner_wrap_display', false );
68
- if ( $inner_wrap ) {
69
- do_action( 'bt_newsletter_shortcode_inner_wrap_start' );
70
- } ?>
71
-
72
- <div class="text-holder" >
73
- <?php if( get_the_title( $atts['id'] ) ) { $title = get_the_title( $atts['id'] ); echo '<h3>'.esc_attr($title).'</h3>'; }?>
74
- <?php
75
- if( isset($blossomthemes_email_newsletter_setting['appearance']['note']) && $blossomthemes_email_newsletter_setting['appearance']['note']!='' )
76
- {
77
- $note = $blossomthemes_email_newsletter_setting['appearance']['note'];
78
- echo '<span>'.esc_attr($note).'</span>';
79
- }
80
- ?>
81
- </div>
82
- <form id="blossomthemes-email-newsletter-<?php echo esc_attr($atts['id']);?>" class="blossomthemes-email-newsletter-window-<?php echo esc_attr($atts['id']);?>">
83
- <?php
84
- $val = isset($blossomthemes_email_newsletter_setting['field']['select']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['select']):'email';
85
- if( $val=='email' )
86
- {
87
- ?>
88
- <input type="text" name="subscribe-email" required="required" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) && $blossomthemes_email_newsletter_setting['field']['email_placeholder'] !='' ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']): __('Your Email', 'blossomthemes-email-newsletter');?>">
89
- <?php
90
- }
91
- else{ ?>
92
- <input type="text" name="subscribe-fname" required="required" class="subscribe-fname-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']) && $blossomthemes_email_newsletter_setting['field']['first_name_placeholder'] != '' ? esc_attr($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']): __('Your Name', 'blossomthemes-email-newsletter');?>">
93
-
94
- <input type="text" name="subscribe-email" required="required" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) && $blossomthemes_email_newsletter_setting['field']['email_placeholder'] != '' ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']): __('Your Email', 'blossomthemes-email-newsletter');?>">
95
- <?php
96
- }
97
- if( isset( $blossomthemes_email_newsletter_setting['appearance']['gdpr'] ) && $blossomthemes_email_newsletter_setting['appearance']['gdpr'] == '1' )
98
- {
99
- ?>
100
- <label for="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>">
101
- <div class="subscribe-inner-wrap">
102
- <input type="checkbox" class="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>" name="subscribe-confirmation" id="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>" required/><span class="check-mark"></span>
103
- <span class="text">
104
- <?php
105
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
106
- $gdprmsg = isset($blossomthemes_email_newsletter_settings['gdpr-msg']) && $blossomthemes_email_newsletter_settings['gdpr-msg'] !='' ? $blossomthemes_email_newsletter_settings['gdpr-msg']: __('By checking this, you agree to our Privacy Policy.', 'blossomthemes-email-newsletter');
107
- echo wp_kses_post($gdprmsg);
108
- ?>
109
- </span>
110
- </div>
111
- </label>
112
- <?php
113
- }
114
- ?>
115
- <div id="loader-<?php echo esc_attr($atts['id']);?>" style="display: none">
116
- <div class="table">
117
- <div class="table-row">
118
- <div class="table-cell">
119
- <img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
120
- </div>
121
- </div>
122
- </div>
123
- </div>
124
- <input type="submit" name="subscribe-submit" class="subscribe-submit-<?php echo esc_attr($atts['id']);?>" value="<?php echo isset($blossomthemes_email_newsletter_setting['field']['submit_label']) && $blossomthemes_email_newsletter_setting['field']['submit_label'] !='' ? esc_attr($blossomthemes_email_newsletter_setting['field']['submit_label']): __('Subscribe', 'blossomthemes-email-newsletter');?>">
125
- <?php wp_nonce_field( 'subscription_response', 'bten_subscription_nonce_'.esc_attr($atts['id']).'' ); ?>
126
- </form>
127
-
128
- <?php $inner_wrap = apply_filters( 'bt_newsletter_shortcode_inner_wrap_display', false );
129
- if ( $inner_wrap ) {
130
- do_action( 'bt_newsletter_shortcode_inner_wrap_close' );
131
- } ?>
132
-
133
- <div class="bten-response" id="bten-response-<?php echo esc_attr($atts['id']);?>"><span></span></div>
134
- <div id="mask-<?php echo esc_attr($atts['id']);?>"></div>
135
- </div>
136
- <?php
137
- global $post;
138
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
139
- $style = '<style>
140
- #mask-'.esc_attr($atts['id']).' {
141
- position: fixed;
142
- width: 100%;
143
- height: 100%;
144
- left: 0;
145
- top: 0;
146
- z-index: 9000;
147
- background-color: #000;
148
- display: none;
149
- }
150
-
151
- #boxes-'.esc_attr($atts['id']).' #dialog {
152
- width: 750px;
153
- height: 300px;
154
- padding: 10px;
155
- background-color: #ffffff;
156
- font-family: "Segoe UI Light", sans-serif;
157
- font-size: 15pt;
158
- }
159
-
160
-
161
- #loader-'.esc_attr($atts['id']).' {
162
- position: absolute;
163
- top: 27%;
164
- left: 0;
165
- width: 100%;
166
- height: 80%;
167
- text-align: center;
168
- font-size: 50px;
169
- }
170
-
171
- #loader-'.esc_attr($atts['id']).' .table{
172
- display: table;
173
- width: 100%;
174
- height: 100%;
175
- }
176
-
177
- #loader-'.esc_attr($atts['id']).' .table-row{
178
- display: table-row;
179
- }
180
-
181
- #loader-'.esc_attr($atts['id']).' .table-cell{
182
- display: table-cell;
183
- vertical-align: middle;
184
- }
185
- </style>';
186
- echo $obj->bten_minify_css($style);
187
- // echo $style;
188
-
189
- $ajax =
190
- '<script>
191
- jQuery(document).ready(function() {
192
- jQuery(document).on("submit","form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'", function(e){
193
- e.preventDefault();
194
- jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );
195
- var email = jQuery(".subscribe-email-'.esc_attr($atts['id']).'").val();
196
- var fname = jQuery(".subscribe-fname-'.esc_attr($atts['id']).'").val();
197
- var confirmation = jQuery(".subscribe-confirmation-'.esc_attr($atts['id']).'").val();
198
- var sid = '.esc_attr($atts['id']).';
199
- var nonce = jQuery("#bten_subscription_nonce_'.esc_attr($atts['id']).'").val();
200
- jQuery.ajax({
201
- type : "post",
202
- dataType : "json",
203
- url : bten_ajax_data.ajaxurl,
204
- data : {action: "subscription_response", email : email, fname : fname, sid : sid, confirmation : confirmation, nonce : nonce},
205
- beforeSend: function(){
206
- jQuery("#loader-'.esc_attr($atts['id']).'").fadeIn(500);
207
- },
208
- success: function(response){
209
- jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );';
210
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
211
- $option = isset($bten_settings['thankyou-option']) ? esc_attr($bten_settings['thankyou-option']):'text';
212
- $ajax .='if(response.type === "success") {';
213
- if($option == 'text')
214
- {
215
- $ajax .= 'jQuery("#bten-response-'.esc_attr($atts['id']).' span").html(response.message);jQuery("#bten-response-'.esc_attr($atts['id']).'").fadeIn("slow").delay("3000").fadeOut("3000",function(){
216
- jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
217
- jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
218
- jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=checkbox]").prop("checked", false);
219
- });';
220
- }
221
- else{
222
- $selected_page = isset($bten_settings['page'])?esc_attr($bten_settings['page']):'';
223
- $url = get_permalink($selected_page);
224
- $ajax.= 'window.location.href = "'.esc_url($url).'"';
225
- }
226
-
227
- $ajax.='}
228
- else{
229
- jQuery("#bten-response-'.esc_attr($atts['id']).' span").html(response.message);jQuery("#bten-response-'.esc_attr($atts['id']).'").fadeIn("slow").delay("3000").fadeOut("3000",function(){
230
- jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
231
- jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
232
- jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=checkbox]").prop("checked", false);
233
-
234
- });
235
- }
236
- },
237
- complete: function(){
238
- jQuery("#loader-'.esc_attr($atts['id']).'").fadeOut(500);
239
- }
240
- });
241
- });
242
- });
243
- </script>';
244
- echo $obj->bten_minify_js($ajax);
245
- $output = ob_get_contents();
246
- ob_end_clean();
247
- return apply_filters( 'blossomthemes_newsletter_shortcode_filter', $output, $atts );
248
- }
249
-
250
- //function to generate ajax actions
251
- function blossomthemes_email_newsletter_ajax_callback()
252
- {
253
- if ( ! isset( $_POST['nonce'] )
254
- || ! wp_verify_nonce( $_POST['nonce'], 'subscription_response' )
255
- ) {
256
- $result['type'] = 'error';
257
- $result['message'] = __( 'Sorry, your nonce did not verify.', 'blossomthemes-email-newsletter' );
258
- echo json_encode( $result );
259
- exit;
260
- }
261
-
262
- $email = sanitize_email( $_POST['email'] );
263
- $fname = isset( $_POST['fname'] ) ? esc_attr( $_POST['fname'] ) : '';
264
- $lname = ' ';
265
-
266
- $arr['subscriber']['email'] = $email;
267
- $sid = intval( $_POST['sid'] );
268
- $to = $email;
269
-
270
- /*if ( !preg_match('/^[a-z A-Z]+$/', $fname ) ) {
271
- $result['type'] = 'error';
272
- $result['message'] = __( 'Please enter a valid name.', 'blossomthemes-email-newsletter' );
273
- echo json_encode( $result );
274
- exit;
275
- }*/
276
-
277
- if ( !is_email($to) ) {
278
- $result['type'] = 'error';
279
- $result['message'] = __( 'Please enter a valid email.', 'blossomthemes-email-newsletter' );
280
- echo json_encode( $result );
281
- exit;
282
- }
283
-
284
- $subject = 'Subscribe To Newsletter';
285
- $admin_email = get_option('admin_email');
286
- if( $admin_email != '')
287
- {
288
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
289
- $platform = $blossomthemes_email_newsletter_settings['platform'];
290
-
291
- if( $platform == 'mailerlite' )
292
- {
293
- $obj = new Blossomthemes_Email_Newsletter_Mailerlite;
294
- $response = $obj->bten_mailerlite_action($email, $sid, $fname);
295
- if( $response == 200 )
296
- {
297
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
298
- $result['type'] = 'success';
299
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: __('Successfully subscribed.', 'blossomthemes-email-newsletter');
300
- echo json_encode( $result );
301
- exit;
302
- }
303
-
304
- else{
305
-
306
- $result['type'] = 'error';
307
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
308
- echo json_encode( $result );
309
- exit;
310
- }
311
- }
312
-
313
- elseif( $platform == 'mailchimp' )
314
- {
315
- $obj = new Blossomthemes_Email_Newsletter_Mailchimp;
316
- $response = $obj->bten_mailchimp_action($email, $sid, $fname);
317
- if( $response == 200 )
318
- {
319
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
320
- if( isset($bten_settings['mailchimp']['enable_notif']) && $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] =='1'){
321
- $result['type'] = 'success';
322
- $result['message'] = __( 'Please check your email for confirmation.', 'blossomthemes-email-newsletter' );
323
-
324
- echo json_encode( $result );
325
- exit;
326
- }
327
- else{
328
- $result['type'] = 'success';
329
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
330
- echo json_encode( $result );
331
- exit;
332
- }
333
- }
334
-
335
- else{
336
- $result['type'] = 'error';
337
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
338
- echo json_encode( $result );
339
- exit;
340
- }
341
- }
342
-
343
- elseif( $platform == 'convertkit' )
344
- {
345
- $obj = new Blossomthemes_Email_Newsletter_Convertkit;
346
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
347
- $response = $obj->bten_convertkit_action($email,$sid,$fname,$lname);
348
- if( $response == 200 )
349
- {
350
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
351
- $result['type'] = 'success';
352
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
353
- echo json_encode( $result );
354
- exit;
355
- }
356
-
357
- else{
358
- $result['type'] = 'error';
359
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
360
- echo json_encode( $result );
361
- exit;
362
- }
363
- }
364
-
365
- elseif( $platform == 'getresponse' )
366
- {
367
- $obj = new Blossomthemes_Email_Newsletter_GetResponse;
368
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
369
- $response = $obj->bten_getresponse_action($email, $sid, $fname);
370
- if( isset( $response['response'] ) && $response['response'] == 200 )
371
- {
372
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
373
- $result['type'] = 'success';
374
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
375
-
376
- echo json_encode( $result );
377
- exit;
378
- }
379
-
380
- else{
381
- $result['type'] = 'error';
382
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
383
- $result['errorMessage'] = $response['log']['errorMessage'];
384
- echo json_encode( $result );
385
- exit;
386
- }
387
- }
388
- elseif( $platform == 'activecampaign' )
389
- {
390
- $obj = new Blossomthemes_Email_Newsletter_ActiveCampaign;
391
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
392
- $response = $obj->bten_activecampaign_action($email,$sid,$fname);
393
- if( $response['response'] == 200 )
394
- {
395
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
396
- $result['type'] = 'success';
397
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
398
-
399
- echo json_encode( $result );
400
- exit;
401
- }
402
-
403
- else{
404
- $result['type'] = 'error';
405
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
406
- echo json_encode( $result );
407
- exit;
408
- }
409
- }
410
- elseif( $platform == 'aweber' )
411
- {
412
- $obj = new Blossomthemes_Email_Newsletter_AWeber;
413
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
414
- $response = $obj->bten_aweber_action($email, $sid, $fname);
415
- if( $response['status'] == true )
416
- {
417
- $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
418
- $result['type'] = 'success';
419
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
420
-
421
- echo json_encode( $result );
422
- exit;
423
- }
424
-
425
- else{
426
- $result['type'] = 'error';
427
- $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
428
- echo json_encode( $result );
429
- exit;
430
- }
431
- }
432
- else{
433
- $result['type'] = 'error';
434
- $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Error in subscription. Please check the platform and API key used in the Settings.';
435
- echo json_encode( $result );
436
- exit;
437
- }
438
- }
439
- }
440
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  new Blossomthemes_Email_Newsletter_Shortcodes;
1
+ <?php
2
+ /**
3
+ * Frontend view of the plugin.
4
+ *
5
+ * @package Blossomthemes_Email_Newsletter
6
+ * @subpackage Blossomthemes_Email_Newsletter/includes
7
+ * @author blossomthemes
8
+ */
9
+ class Blossomthemes_Email_Newsletter_Shortcodes {
10
+
11
+ function __construct()
12
+ {
13
+ add_shortcode( 'BTEN', array( $this, 'blossomthemes_email_newsletter_shortcode_callback' ) );
14
+ add_action( 'wp_ajax_subscription_response', array( $this, 'blossomthemes_email_newsletter_ajax_callback' ) );
15
+ add_action( 'wp_ajax_nopriv_subscription_response', array( $this, 'blossomthemes_email_newsletter_ajax_callback' ) );
16
+ }
17
+
18
+ //function to generate shortcode
19
+ function blossomthemes_email_newsletter_shortcode_callback( $atts, $content = "" )
20
+ {
21
+ $obj = new Blossomthemes_Email_Newsletter_Functions;
22
+
23
+ $atts = shortcode_atts( array(
24
+ 'id' => '',
25
+ ), $atts, 'BTEN' );
26
+ $atts['id'] = absint($atts['id']);
27
+ $rrsb_bg = '';
28
+ $rrsb_font = '';
29
+ $blossomthemes_email_newsletter_setting = get_post_meta( $atts['id'], 'blossomthemes_email_newsletter_setting', true );
30
+ $settings = get_option( 'blossomthemes_email_newsletter_settings', true );
31
+ $rrsb_option = ! empty( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) : 'bg-color';
32
+
33
+ if( $rrsb_option == 'image' )
34
+ {
35
+ $overlay = isset( $blossomthemes_email_newsletter_setting['appearance']['overlay'] ) && $blossomthemes_email_newsletter_setting['appearance']['overlay'] == '1' ? ' has-overlay' : ' no-overlay';
36
+ if( isset( $blossomthemes_email_newsletter_setting['appearance']['bg']) && $blossomthemes_email_newsletter_setting['appearance']['bg']!='' )
37
+ {
38
+ $attachment_id = $blossomthemes_email_newsletter_setting['appearance']['bg'];
39
+ $newsletter_bio_img_size = apply_filters('bt_newsletter_img_size','full');
40
+ $image_array = wp_get_attachment_image_src( $attachment_id, $newsletter_bio_img_size );
41
+ $rrsb_bg = 'url('.$image_array[0].') no-repeat';
42
+ }
43
+ }
44
+ else{
45
+ if( isset( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['bgcolor']!='' )
46
+ {
47
+ $rrsb_bg = ! empty( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
48
+ }
49
+ elseif( isset( $settings['appearance']['bgcolor'] ) && $settings['appearance']['bgcolor']!='' )
50
+ {
51
+ $rrsb_bg = ! empty( $settings['appearance']['bgcolor'] ) ? sanitize_text_field( $settings['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
52
+ }
53
+ }
54
+ if( isset( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['fontcolor']!='' )
55
+ {
56
+ $rrsb_font = ! empty( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
57
+ }
58
+ elseif( isset( $settings['appearance']['fontcolor'] ) && $settings['appearance']['fontcolor']!='' )
59
+ {
60
+ $rrsb_font = ! empty( $settings['appearance']['fontcolor'] ) ? sanitize_text_field( $settings['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
61
+ }
62
+
63
+ ob_start();
64
+ ?>
65
+ <div class="blossomthemes-email-newsletter-wrapper<?php if(isset($rrsb_option) && $rrsb_option == 'image'){ echo ' bg-img', $overlay;}?>" id="boxes-<?php echo esc_attr($atts['id']);?>" style="background: <?php echo esc_attr($rrsb_bg);?>; color: <?php echo esc_attr($rrsb_font);?> ">
66
+
67
+ <?php $inner_wrap = apply_filters( 'bt_newsletter_shortcode_inner_wrap_display', false );
68
+ if ( $inner_wrap ) {
69
+ do_action( 'bt_newsletter_shortcode_inner_wrap_start' );
70
+ } ?>
71
+
72
+ <div class="text-holder" >
73
+ <?php if( get_the_title( $atts['id'] ) ) { $title = get_the_title( $atts['id'] ); echo '<h3>'.esc_attr($title).'</h3>'; }?>
74
+ <?php
75
+ if( isset($blossomthemes_email_newsletter_setting['appearance']['note']) && $blossomthemes_email_newsletter_setting['appearance']['note']!='' )
76
+ {
77
+ $note = $blossomthemes_email_newsletter_setting['appearance']['note'];
78
+ echo '<span>'.esc_attr($note).'</span>';
79
+ }
80
+ ?>
81
+ </div>
82
+ <form id="blossomthemes-email-newsletter-<?php echo esc_attr($atts['id']);?>" class="blossomthemes-email-newsletter-window-<?php echo esc_attr($atts['id']);?>">
83
+ <?php
84
+ $val = isset($blossomthemes_email_newsletter_setting['field']['select']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['select']):'email';
85
+ if( $val=='email' )
86
+ {
87
+ ?>
88
+ <input type="text" name="subscribe-email" required="required" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) && $blossomthemes_email_newsletter_setting['field']['email_placeholder'] !='' ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']): __('Your Email', 'blossomthemes-email-newsletter');?>">
89
+ <?php
90
+ }
91
+ else{ ?>
92
+ <input type="text" name="subscribe-fname" required="required" class="subscribe-fname-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']) && $blossomthemes_email_newsletter_setting['field']['first_name_placeholder'] != '' ? esc_attr($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']): __('Your Name', 'blossomthemes-email-newsletter');?>">
93
+
94
+ <input type="text" name="subscribe-email" required="required" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) && $blossomthemes_email_newsletter_setting['field']['email_placeholder'] != '' ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']): __('Your Email', 'blossomthemes-email-newsletter');?>">
95
+ <?php
96
+ }
97
+ if( isset( $blossomthemes_email_newsletter_setting['appearance']['gdpr'] ) && $blossomthemes_email_newsletter_setting['appearance']['gdpr'] == '1' )
98
+ {
99
+ ?>
100
+ <label for="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>">
101
+ <div class="subscribe-inner-wrap">
102
+ <input type="checkbox" class="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>" name="subscribe-confirmation" id="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>" required/><span class="check-mark"></span>
103
+ <span class="text">
104
+ <?php
105
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
106
+ $gdprmsg = isset($blossomthemes_email_newsletter_settings['gdpr-msg']) && $blossomthemes_email_newsletter_settings['gdpr-msg'] !='' ? $blossomthemes_email_newsletter_settings['gdpr-msg']: __('By checking this, you agree to our Privacy Policy.', 'blossomthemes-email-newsletter');
107
+ echo wp_kses_post($gdprmsg);
108
+ ?>
109
+ </span>
110
+ </div>
111
+ </label>
112
+ <?php
113
+ }
114
+ ?>
115
+ <div id="loader-<?php echo esc_attr($atts['id']);?>" style="display: none">
116
+ <div class="table">
117
+ <div class="table-row">
118
+ <div class="table-cell">
119
+ <img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
120
+ </div>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ <input type="submit" name="subscribe-submit" class="subscribe-submit-<?php echo esc_attr($atts['id']);?>" value="<?php echo isset($blossomthemes_email_newsletter_setting['field']['submit_label']) && $blossomthemes_email_newsletter_setting['field']['submit_label'] !='' ? esc_attr($blossomthemes_email_newsletter_setting['field']['submit_label']): __('Subscribe', 'blossomthemes-email-newsletter');?>">
125
+ <?php wp_nonce_field( 'subscription_response', 'bten_subscription_nonce_'.esc_attr($atts['id']).'' ); ?>
126
+ </form>
127
+
128
+ <?php $inner_wrap = apply_filters( 'bt_newsletter_shortcode_inner_wrap_display', false );
129
+ if ( $inner_wrap ) {
130
+ do_action( 'bt_newsletter_shortcode_inner_wrap_close' );
131
+ } ?>
132
+
133
+ <div class="bten-response" id="bten-response-<?php echo esc_attr($atts['id']);?>"><span></span></div>
134
+ <div id="mask-<?php echo esc_attr($atts['id']);?>"></div>
135
+ </div>
136
+ <?php
137
+ global $post;
138
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
139
+ $style = '<style>
140
+ #mask-'.esc_attr($atts['id']).' {
141
+ position: fixed;
142
+ width: 100%;
143
+ height: 100%;
144
+ left: 0;
145
+ top: 0;
146
+ z-index: 9000;
147
+ background-color: #000;
148
+ display: none;
149
+ }
150
+
151
+ #boxes-'.esc_attr($atts['id']).' #dialog {
152
+ width: 750px;
153
+ height: 300px;
154
+ padding: 10px;
155
+ background-color: #ffffff;
156
+ font-family: "Segoe UI Light", sans-serif;
157
+ font-size: 15pt;
158
+ }
159
+
160
+
161
+ #loader-'.esc_attr($atts['id']).' {
162
+ position: absolute;
163
+ top: 27%;
164
+ left: 0;
165
+ width: 100%;
166
+ height: 80%;
167
+ text-align: center;
168
+ font-size: 50px;
169
+ }
170
+
171
+ #loader-'.esc_attr($atts['id']).' .table{
172
+ display: table;
173
+ width: 100%;
174
+ height: 100%;
175
+ }
176
+
177
+ #loader-'.esc_attr($atts['id']).' .table-row{
178
+ display: table-row;
179
+ }
180
+
181
+ #loader-'.esc_attr($atts['id']).' .table-cell{
182
+ display: table-cell;
183
+ vertical-align: middle;
184
+ }
185
+ </style>';
186
+ echo $obj->bten_minify_css($style);
187
+ // echo $style;
188
+
189
+ $ajax =
190
+ '<script>
191
+ jQuery(document).ready(function() {
192
+ jQuery(document).on("submit","form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'", function(e){
193
+ e.preventDefault();
194
+ jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );
195
+ var email = jQuery(".subscribe-email-'.esc_attr($atts['id']).'").val();
196
+ var fname = jQuery(".subscribe-fname-'.esc_attr($atts['id']).'").val();
197
+ var confirmation = jQuery(".subscribe-confirmation-'.esc_attr($atts['id']).'").val();
198
+ var sid = '.esc_attr($atts['id']).';
199
+ var nonce = jQuery("#bten_subscription_nonce_'.esc_attr($atts['id']).'").val();
200
+ jQuery.ajax({
201
+ type : "post",
202
+ dataType : "json",
203
+ url : bten_ajax_data.ajaxurl,
204
+ data : {action: "subscription_response", email : email, fname : fname, sid : sid, confirmation : confirmation, nonce : nonce},
205
+ beforeSend: function(){
206
+ jQuery("#loader-'.esc_attr($atts['id']).'").fadeIn(500);
207
+ },
208
+ success: function(response){
209
+ jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );';
210
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
211
+ $option = isset($bten_settings['thankyou-option']) ? esc_attr($bten_settings['thankyou-option']):'text';
212
+ $ajax .='if(response.type === "success") {';
213
+ if($option == 'text')
214
+ {
215
+ $ajax .= 'jQuery("#bten-response-'.esc_attr($atts['id']).' span").html(response.message);jQuery("#bten-response-'.esc_attr($atts['id']).'").fadeIn("slow").delay("3000").fadeOut("3000",function(){
216
+ jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
217
+ jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
218
+ jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=checkbox]").prop("checked", false);
219
+ });';
220
+ }
221
+ else{
222
+ $selected_page = isset($bten_settings['page'])?esc_attr($bten_settings['page']):'';
223
+ $url = get_permalink($selected_page);
224
+ $ajax.= 'window.location.href = "'.esc_url($url).'"';
225
+ }
226
+
227
+ $ajax.='}
228
+ else{
229
+ jQuery("#bten-response-'.esc_attr($atts['id']).' span").html(response.message);jQuery("#bten-response-'.esc_attr($atts['id']).'").fadeIn("slow").delay("3000").fadeOut("3000",function(){
230
+ jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
231
+ jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
232
+ jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=checkbox]").prop("checked", false);
233
+
234
+ });
235
+ }
236
+ },
237
+ complete: function(){
238
+ jQuery("#loader-'.esc_attr($atts['id']).'").fadeOut(500);
239
+ }
240
+ });
241
+ });
242
+ });
243
+ </script>';
244
+ echo $obj->bten_minify_js($ajax);
245
+ $output = ob_get_contents();
246
+ ob_end_clean();
247
+ return apply_filters( 'blossomthemes_newsletter_shortcode_filter', $output, $atts );
248
+ }
249
+
250
+ //function to generate ajax actions
251
+ function blossomthemes_email_newsletter_ajax_callback()
252
+ {
253
+ if ( ! isset( $_POST['nonce'] )
254
+ || ! wp_verify_nonce( $_POST['nonce'], 'subscription_response' )
255
+ ) {
256
+ $result['type'] = 'error';
257
+ $result['message'] = __( 'Sorry, your nonce did not verify.', 'blossomthemes-email-newsletter' );
258
+ echo json_encode( $result );
259
+ exit;
260
+ }
261
+
262
+ $email = sanitize_email( $_POST['email'] );
263
+ $fname = isset( $_POST['fname'] ) ? esc_attr( $_POST['fname'] ) : '';
264
+ $lname = ' ';
265
+
266
+ $arr['subscriber']['email'] = $email;
267
+ $sid = intval( $_POST['sid'] );
268
+ $to = $email;
269
+
270
+ /*if ( !preg_match('/^[a-z A-Z]+$/', $fname ) ) {
271
+ $result['type'] = 'error';
272
+ $result['message'] = __( 'Please enter a valid name.', 'blossomthemes-email-newsletter' );
273
+ echo json_encode( $result );
274
+ exit;
275
+ }*/
276
+
277
+ if ( !is_email($to) ) {
278
+ $result['type'] = 'error';
279
+ $result['message'] = __( 'Please enter a valid email.', 'blossomthemes-email-newsletter' );
280
+ echo json_encode( $result );
281
+ exit;
282
+ }
283
+
284
+ $subject = 'Subscribe To Newsletter';
285
+ $admin_email = get_option('admin_email');
286
+ if( $admin_email != '')
287
+ {
288
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
289
+ $platform = $blossomthemes_email_newsletter_settings['platform'];
290
+
291
+ if( $platform == 'mailerlite' )
292
+ {
293
+ $obj = new Blossomthemes_Email_Newsletter_Mailerlite;
294
+ $response = $obj->bten_mailerlite_action($email, $sid, $fname);
295
+ if( $response == 200 )
296
+ {
297
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
298
+ $result['type'] = 'success';
299
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: __('Successfully subscribed.', 'blossomthemes-email-newsletter');
300
+ echo json_encode( $result );
301
+ exit;
302
+ }
303
+
304
+ else{
305
+
306
+ $result['type'] = 'error';
307
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
308
+ echo json_encode( $result );
309
+ exit;
310
+ }
311
+ }
312
+
313
+ elseif( $platform == 'mailchimp' )
314
+ {
315
+ $obj = new Blossomthemes_Email_Newsletter_Mailchimp;
316
+ $response = $obj->bten_mailchimp_action($email, $sid, $fname);
317
+ if( $response == 200 )
318
+ {
319
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
320
+ if( isset($bten_settings['mailchimp']['enable_notif']) && $blossomthemes_email_newsletter_settings['mailchimp']['enable_notif'] =='1'){
321
+ $result['type'] = 'success';
322
+ $result['message'] = __( 'Please check your email for confirmation.', 'blossomthemes-email-newsletter' );
323
+
324
+ echo json_encode( $result );
325
+ exit;
326
+ }
327
+ else{
328
+ $result['type'] = 'success';
329
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
330
+ echo json_encode( $result );
331
+ exit;
332
+ }
333
+ }
334
+
335
+ else{
336
+ $result['type'] = 'error';
337
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
338
+ echo json_encode( $result );
339
+ exit;
340
+ }
341
+ }
342
+
343
+ elseif( $platform == 'convertkit' )
344
+ {
345
+ $obj = new Blossomthemes_Email_Newsletter_Convertkit;
346
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
347
+ $response = $obj->bten_convertkit_action($email,$sid,$fname,$lname);
348
+ if( $response == 200 )
349
+ {
350
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
351
+ $result['type'] = 'success';
352
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
353
+ echo json_encode( $result );
354
+ exit;
355
+ }
356
+
357
+ else{
358
+ $result['type'] = 'error';
359
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
360
+ echo json_encode( $result );
361
+ exit;
362
+ }
363
+ }
364
+
365
+ elseif( $platform == 'getresponse' )
366
+ {
367
+ $obj = new Blossomthemes_Email_Newsletter_GetResponse;
368
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
369
+ $response = $obj->bten_getresponse_action($email, $sid, $fname);
370
+ if( isset( $response['response'] ) && $response['response'] == 200 )
371
+ {
372
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
373
+ $result['type'] = 'success';
374
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
375
+
376
+ echo json_encode( $result );
377
+ exit;
378
+ }
379
+
380
+ else{
381
+ $result['type'] = 'error';
382
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
383
+ $result['errorMessage'] = $response['log']['errorMessage'];
384
+ echo json_encode( $result );
385
+ exit;
386
+ }
387
+ }
388
+ elseif( $platform == 'activecampaign' )
389
+ {
390
+ $obj = new Blossomthemes_Email_Newsletter_ActiveCampaign;
391
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
392
+ $response = $obj->bten_activecampaign_action($email,$sid,$fname);
393
+ if( $response['response'] == 200 )
394
+ {
395
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
396
+ $result['type'] = 'success';
397
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
398
+
399
+ echo json_encode( $result );
400
+ exit;
401
+ }
402
+
403
+ else{
404
+ $result['type'] = 'error';
405
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
406
+ echo json_encode( $result );
407
+ exit;
408
+ }
409
+ }
410
+ elseif( $platform == 'aweber' )
411
+ {
412
+ $obj = new Blossomthemes_Email_Newsletter_AWeber;
413
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
414
+ $response = $obj->bten_aweber_action($email, $sid, $fname);
415
+ if( $response['status'] == true )
416
+ {
417
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
418
+ $result['type'] = 'success';
419
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
420
+
421
+ echo json_encode( $result );
422
+ exit;
423
+ }
424
+
425
+ else{
426
+ $result['type'] = 'error';
427
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
428
+ echo json_encode( $result );
429
+ exit;
430
+ }
431
+ } elseif( $platform === 'sendinblue' ) {
432
+ $sendinblue_object = new Blossomthemes_Email_Newsletter_Sendinblue;
433
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
434
+
435
+ $response = $sendinblue_object->action_form_submission( $email, $sid, $fname );
436
+
437
+ if( 'success' === $response ) {
438
+ $bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
439
+ $result['type'] = 'success';
440
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Successfully subscribed.';
441
+
442
+ echo json_encode( $result );
443
+ exit;
444
+ } else{
445
+ $result['type'] = 'error';
446
+ $result['message'] = __( 'Error in subscription.', 'blossomthemes-email-newsletter' );
447
+ echo json_encode( $result );
448
+ exit;
449
+ }
450
+ }
451
+ else{
452
+ $result['type'] = 'error';
453
+ $result['message'] = isset($bten_settings['msg']) ? $bten_settings['msg']: 'Error in subscription. Please check the platform and API key used in the Settings.';
454
+ echo json_encode( $result );
455
+ exit;
456
+ }
457
+ }
458
+ }
459
+ }
460
  new Blossomthemes_Email_Newsletter_Shortcodes;
includes/class-blossomthemes-email-newsletter.php CHANGED
@@ -1,345 +1,356 @@
1
- <?php
2
-
3
- /**
4
- * The file that defines the core plugin class
5
- *
6
- * A class definition that includes attributes and functions used across both the
7
- * public-facing side of the site and the admin area.
8
- *
9
- * @link https://blossomthemes.com
10
- * @since 2.0.0
11
- *
12
- * @package Blossomthemes_Email_Newsletter
13
- * @subpackage Blossomthemes_Email_Newsletter/includes
14
- */
15
-
16
- /**
17
- * The core plugin class.
18
- *
19
- * This is used to define internationalization, admin-specific hooks, and
20
- * public-facing site hooks.
21
- *
22
- * Also maintains the unique identifier of this plugin as well as the current
23
- * version of the plugin.
24
- *
25
- * @since 2.0.0
26
- * @package Blossomthemes_Email_Newsletter
27
- * @subpackage Blossomthemes_Email_Newsletter/includes
28
- * @author blossomthemes <blossomthemes.com>
29
- */
30
- class Blossomthemes_Email_Newsletter {
31
-
32
- /**
33
- * The loader that's responsible for maintaining and registering all hooks that power
34
- * the plugin.
35
- *
36
- * @since 2.0.0
37
- * @access protected
38
- * @var Blossomthemes_Email_Newsletter_Loader $loader Maintains and registers all hooks for the plugin.
39
- */
40
- protected $loader;
41
-
42
- /**
43
- * The unique identifier of this plugin.
44
- *
45
- * @since 2.0.0
46
- * @access protected
47
- * @var string $plugin_name The string used to uniquely identify this plugin.
48
- */
49
- protected $plugin_name;
50
-
51
- /**
52
- * The current version of the plugin.
53
- *
54
- * @since 2.0.0
55
- * @access protected
56
- * @var string $version The current version of the plugin.
57
- */
58
- protected $version;
59
-
60
- /**
61
- * Define the core functionality of the plugin.
62
- *
63
- * Set the plugin name and the plugin version that can be used throughout the plugin.
64
- * Load the dependencies, define the locale, and set the hooks for the admin area and
65
- * the public-facing side of the site.
66
- *
67
- * @since 2.0.0
68
- */
69
- public function __construct() {
70
-
71
- $this->plugin_name = 'blossomthemes-email-newsletter';
72
- $this->version = '2.0.0';
73
-
74
- $this->load_dependencies();
75
- $this->set_locale();
76
- $this->define_admin_hooks();
77
- $this->define_public_hooks();
78
-
79
- }
80
-
81
- /**
82
- * Load the required dependencies for this plugin.
83
- *
84
- * Include the following files that make up the plugin:
85
- *
86
- * - Blossomthemes_Email_Newsletter_Loader. Orchestrates the hooks of the plugin.
87
- * - Blossomthemes_Email_Newsletter_i18n. Defines internationalization functionality.
88
- * - Blossomthemes_Email_Newsletter_Admin. Defines all hooks for the admin area.
89
- * - Blossomthemes_Email_Newsletter_Public. Defines all hooks for the public side of the site.
90
- *
91
- * Create an instance of the loader which will be used to register the hooks
92
- * with WordPress.
93
- *
94
- * @since 2.0.0
95
- * @access private
96
- */
97
- private function load_dependencies() {
98
-
99
- /**
100
- * Add autoloader
101
- */
102
- require_once plugin_dir_path( dirname( __FILE__ ) ) . 'vendor/autoload.php';
103
-
104
- /**
105
- * The class responsible for orchestrating the actions and filters of the
106
- * core plugin.
107
- */
108
- require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-loader.php';
109
-
110
- /**
111
- * The class responsible for defining internationalization functionality
112
- * of the plugin.
113
- */
114
- require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-i18n.php';
115
-
116
- /**
117
- * The class responsible for defining all actions that occur in the admin area.
118
- */
119
- require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-blossomthemes-email-newsletter-admin.php';
120
-
121
- /**
122
- * The class responsible for defining all actions that occur in the public-facing
123
- * side of the site.
124
- */
125
- require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-blossomthemes-email-newsletter-public.php';
126
-
127
- /**
128
- * The class responsible for defining all actions that occur in the public-facing
129
- * side of the site.
130
- */
131
- require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-settings.php';
132
-
133
- /**
134
- * The class responsible for general functions.
135
- *
136
- */
137
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-functions.php';
138
-
139
- /**
140
- * The class responsible for meta for subscription form.
141
- *
142
- */
143
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-form-meta.php';
144
-
145
- /**
146
- * The class responsible for mailerlite libraries.
147
- *
148
- */
149
- if (!class_exists('ML_Lists')) {
150
- require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailerlite_rest/ML_Lists.php';
151
- }
152
-
153
- /**
154
- * The class responsible for mailchimp libraries.
155
- *
156
- */
157
- if(!class_exists('MC_Lists')) {
158
- require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailchimp/MC_Lists.php';
159
- }
160
-
161
- /**
162
- * The class responsible for convertkit libraries.
163
- *
164
- */
165
- if (!class_exists('Convertkit')) {
166
- require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/convertkit/convertkit.php';
167
- }
168
-
169
- /**
170
- * The class responsible for doing mailerlite libraries.
171
- *
172
- */
173
- if (!class_exists('ML_Webforms')) {
174
- require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailerlite_rest/ML_Webforms.php';
175
- }
176
-
177
- /**
178
- * The class responsible for doing mailerlite actions.
179
- *
180
- */
181
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-mailerlite.php';
182
-
183
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/activecampaign/ActiveCampaign.class.php';
184
-
185
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/aweber/aweber_api.php';
186
- /**
187
- * The class responsible for doing mailchimp actions.
188
- *
189
- */
190
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-mailchimp.php';
191
-
192
- /**
193
- * The class responsible for doing convertkit actions.
194
- *
195
- */
196
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-convertkit.php';
197
-
198
- /**
199
- * The class responsible for doing GetResponse actions.
200
- *
201
- */
202
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-getresponse.php';
203
-
204
- /**
205
- * The class responsible for doing ActiveCampaign actions.
206
- *
207
- */
208
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-activecampaign.php';
209
-
210
- /**
211
- * The class responsible for doing AWeber actions.
212
- *
213
- */
214
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-aweber.php';
215
-
216
- /**
217
- * The class responsible for generating shortcode.
218
- *
219
- */
220
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-shortcodes.php';
221
-
222
- /**
223
- * The class responsible for generating widget.
224
- *
225
- */
226
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/widgets/widget-blossomthemes-newsletter.php';
227
-
228
- /**
229
- * Privacy content and sections.
230
- *
231
- */
232
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/privacy-sections.php';
233
-
234
- /**
235
- * The class responsible for popup functions.
236
- *
237
- */
238
- require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-popup-functions.php';
239
-
240
-
241
- $this->loader = new Blossomthemes_Email_Newsletter_Loader();
242
-
243
- }
244
-
245
- /**
246
- * Define the locale for this plugin for internationalization.
247
- *
248
- * Uses the Blossomthemes_Email_Newsletter_i18n class in order to set the domain and to register the hook
249
- * with WordPress.
250
- *
251
- * @since 2.0.0
252
- * @access private
253
- */
254
- private function set_locale() {
255
-
256
- $plugin_i18n = new Blossomthemes_Email_Newsletter_i18n();
257
-
258
- $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
259
-
260
- }
261
-
262
- /**
263
- * Register all of the hooks related to the admin area functionality
264
- * of the plugin.
265
- *
266
- * @since 2.0.0
267
- * @access private
268
- */
269
- private function define_admin_hooks() {
270
-
271
- $plugin_admin = new Blossomthemes_Email_Newsletter_Admin( $this->get_plugin_name(), $this->get_version() );
272
-
273
- $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
274
- $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
275
- $this->loader->add_action( 'init', $plugin_admin, 'blossomthemes_register_form' );
276
- // $this->loader->add_action( 'init', $plugin_admin, 'blossomthemes_register_subscriber' );
277
- $this->loader->add_action( 'admin_menu', $plugin_admin, 'blossomthemes_email_newsletter_settings_page' );
278
- $this->loader->add_action( 'admin_init', $plugin_admin, 'blossomthemes_email_newsletter_register_settings' );
279
- // $this->loader->add_filter( 'manage_subscriber_posts_columns', $plugin_admin, 'blossomthemes_subscriber_cpt_columns');
280
- // $this->loader->add_action( 'manage_posts_custom_column' , $plugin_admin, 'blossomthemes_subscriber_custom_columns', 10, 2 );
281
- $this->loader->add_filter('manage_subscribe-form_posts_columns', $plugin_admin, 'set_subscribe_form_columns');
282
- $this->loader->add_action('manage_subscribe-form_posts_custom_column', $plugin_admin, 'set_subscribe_form_columns_content', 10, 2);
283
- $this->loader->add_action( 'admin_notices', $plugin_admin, 'bten_api_update_notice' );
284
- $this->loader->add_action('admin_init', $plugin_admin, 'bten_ignore_admin_notice');
285
-
286
- }
287
-
288
- /**
289
- * Register all of the hooks related to the public-facing functionality
290
- * of the plugin.
291
- *
292
- * @since 2.0.0
293
- * @access private
294
- */
295
- private function define_public_hooks() {
296
-
297
- $plugin_public = new Blossomthemes_Email_Newsletter_Public( $this->get_plugin_name(), $this->get_version() );
298
-
299
- $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
300
- $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
301
- $this->loader->add_filter( 'script_loader_tag', $plugin_public, 'blossom_email_newsletter_js_defer_files', 10 );
302
-
303
- }
304
-
305
- /**
306
- * Run the loader to execute all of the hooks with WordPress.
307
- *
308
- * @since 2.0.0
309
- */
310
- public function run() {
311
- $this->loader->run();
312
- }
313
-
314
- /**
315
- * The name of the plugin used to uniquely identify it within the context of
316
- * WordPress and to define internationalization functionality.
317
- *
318
- * @since 2.0.0
319
- * @return string The name of the plugin.
320
- */
321
- public function get_plugin_name() {
322
- return $this->plugin_name;
323
- }
324
-
325
- /**
326
- * The reference to the class that orchestrates the hooks with the plugin.
327
- *
328
- * @since 2.0.0
329
- * @return Blossomthemes_Email_Newsletter_Loader Orchestrates the hooks of the plugin.
330
- */
331
- public function get_loader() {
332
- return $this->loader;
333
- }
334
-
335
- /**
336
- * Retrieve the version number of the plugin.
337
- *
338
- * @since 2.0.0
339
- * @return string The version number of the plugin.
340
- */
341
- public function get_version() {
342
- return $this->version;
343
- }
344
-
345
- }
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The file that defines the core plugin class
5
+ *
6
+ * A class definition that includes attributes and functions used across both the
7
+ * public-facing side of the site and the admin area.
8
+ *
9
+ * @link https://blossomthemes.com
10
+ * @since 2.0.0
11
+ *
12
+ * @package Blossomthemes_Email_Newsletter
13
+ * @subpackage Blossomthemes_Email_Newsletter/includes
14
+ */
15
+
16
+ /**
17
+ * The core plugin class.
18
+ *
19
+ * This is used to define internationalization, admin-specific hooks, and
20
+ * public-facing site hooks.
21
+ *
22
+ * Also maintains the unique identifier of this plugin as well as the current
23
+ * version of the plugin.
24
+ *
25
+ * @since 2.0.0
26
+ * @package Blossomthemes_Email_Newsletter
27
+ * @subpackage Blossomthemes_Email_Newsletter/includes
28
+ * @author blossomthemes <blossomthemes.com>
29
+ */
30
+ class Blossomthemes_Email_Newsletter {
31
+
32
+ /**
33
+ * The loader that's responsible for maintaining and registering all hooks that power
34
+ * the plugin.
35
+ *
36
+ * @since 2.0.0
37
+ * @access protected
38
+ * @var Blossomthemes_Email_Newsletter_Loader $loader Maintains and registers all hooks for the plugin.
39
+ */
40
+ protected $loader;
41
+
42
+ /**
43
+ * The unique identifier of this plugin.
44
+ *
45
+ * @since 2.0.0
46
+ * @access protected
47
+ * @var string $plugin_name The string used to uniquely identify this plugin.
48
+ */
49
+ protected $plugin_name;
50
+
51
+ /**
52
+ * The current version of the plugin.
53
+ *
54
+ * @since 2.0.0
55
+ * @access protected
56
+ * @var string $version The current version of the plugin.
57
+ */
58
+ protected $version;
59
+
60
+ /**
61
+ * Define the core functionality of the plugin.
62
+ *
63
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
64
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
65
+ * the public-facing side of the site.
66
+ *
67
+ * @since 2.0.0
68
+ */
69
+ public function __construct() {
70
+
71
+ $this->plugin_name = 'blossomthemes-email-newsletter';
72
+ $this->version = '2.0.0';
73
+
74
+ $this->load_dependencies();
75
+ $this->set_locale();
76
+ $this->define_admin_hooks();
77
+ $this->define_public_hooks();
78
+
79
+ }
80
+
81
+ /**
82
+ * Load the required dependencies for this plugin.
83
+ *
84
+ * Include the following files that make up the plugin:
85
+ *
86
+ * - Blossomthemes_Email_Newsletter_Loader. Orchestrates the hooks of the plugin.
87
+ * - Blossomthemes_Email_Newsletter_i18n. Defines internationalization functionality.
88
+ * - Blossomthemes_Email_Newsletter_Admin. Defines all hooks for the admin area.
89
+ * - Blossomthemes_Email_Newsletter_Public. Defines all hooks for the public side of the site.
90
+ *
91
+ * Create an instance of the loader which will be used to register the hooks
92
+ * with WordPress.
93
+ *
94
+ * @since 2.0.0
95
+ * @access private
96
+ */
97
+ private function load_dependencies() {
98
+
99
+ /**
100
+ * Add autoloader
101
+ */
102
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'vendor/autoload.php';
103
+
104
+ /**
105
+ * The class responsible for orchestrating the actions and filters of the
106
+ * core plugin.
107
+ */
108
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-loader.php';
109
+
110
+ /**
111
+ * The class responsible for defining internationalization functionality
112
+ * of the plugin.
113
+ */
114
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-i18n.php';
115
+
116
+ /**
117
+ * The class responsible for defining all actions that occur in the admin area.
118
+ */
119
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-blossomthemes-email-newsletter-admin.php';
120
+
121
+ /**
122
+ * The class responsible for defining all actions that occur in the public-facing
123
+ * side of the site.
124
+ */
125
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-blossomthemes-email-newsletter-public.php';
126
+
127
+ /**
128
+ * The class responsible for defining all actions that occur in the public-facing
129
+ * side of the site.
130
+ */
131
+ require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-blossomthemes-email-newsletter-settings.php';
132
+
133
+ /**
134
+ * The class responsible for general functions.
135
+ *
136
+ */
137
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-functions.php';
138
+
139
+ /**
140
+ * The class responsible for meta for subscription form.
141
+ *
142
+ */
143
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-form-meta.php';
144
+
145
+ /**
146
+ * The class responsible for mailerlite libraries.
147
+ *
148
+ */
149
+ if (!class_exists('ML_Lists')) {
150
+ require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailerlite_rest/ML_Lists.php';
151
+ }
152
+
153
+ /**
154
+ * The class responsible for mailchimp libraries.
155
+ *
156
+ */
157
+ if(!class_exists('MC_Lists')) {
158
+ require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailchimp/MC_Lists.php';
159
+ }
160
+
161
+ /**
162
+ * The class responsible for convertkit libraries.
163
+ *
164
+ */
165
+ if (!class_exists('Convertkit')) {
166
+ require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/convertkit/convertkit.php';
167
+ }
168
+
169
+ /**
170
+ * The class responsible for doing mailerlite libraries.
171
+ *
172
+ */
173
+ if (!class_exists('ML_Webforms')) {
174
+ require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/mailerlite_rest/ML_Webforms.php';
175
+ }
176
+
177
+ /**
178
+ * Get Sendinblue email newsletter controller.
179
+ */
180
+ require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/sendinblue/SendinblueApiClient.php';
181
+
182
+ /**
183
+ * The class responsible for doing mailerlite actions.
184
+ *
185
+ */
186
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-mailerlite.php';
187
+
188
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/activecampaign/ActiveCampaign.class.php';
189
+
190
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/aweber/aweber_api.php';
191
+ /**
192
+ * The class responsible for doing mailchimp actions.
193
+ *
194
+ */
195
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-mailchimp.php';
196
+
197
+ /**
198
+ * The class responsible for doing convertkit actions.
199
+ *
200
+ */
201
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-convertkit.php';
202
+
203
+ /**
204
+ * The class responsible for doing GetResponse actions.
205
+ *
206
+ */
207
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-getresponse.php';
208
+
209
+ /**
210
+ * The class responsible for doing ActiveCampaign actions.
211
+ *
212
+ */
213
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-activecampaign.php';
214
+
215
+ /**
216
+ * The class responsible for doing AWeber actions.
217
+ *
218
+ */
219
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-aweber.php';
220
+
221
+ /**
222
+ * The class responsible for doing Sendinblue actions.
223
+ *
224
+ */
225
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-sendinblue.php';
226
+
227
+ /**
228
+ * The class responsible for generating shortcode.
229
+ *
230
+ */
231
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-shortcodes.php';
232
+
233
+ /**
234
+ * The class responsible for generating widget.
235
+ *
236
+ */
237
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/widgets/widget-blossomthemes-newsletter.php';
238
+
239
+ /**
240
+ * Privacy content and sections.
241
+ *
242
+ */
243
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/privacy-sections.php';
244
+
245
+ /**
246
+ * The class responsible for popup functions.
247
+ *
248
+ */
249
+ require BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/class-blossomthemes-email-newsletter-popup-functions.php';
250
+
251
+
252
+ $this->loader = new Blossomthemes_Email_Newsletter_Loader();
253
+
254
+ }
255
+
256
+ /**
257
+ * Define the locale for this plugin for internationalization.
258
+ *
259
+ * Uses the Blossomthemes_Email_Newsletter_i18n class in order to set the domain and to register the hook
260
+ * with WordPress.
261
+ *
262
+ * @since 2.0.0
263
+ * @access private
264
+ */
265
+ private function set_locale() {
266
+
267
+ $plugin_i18n = new Blossomthemes_Email_Newsletter_i18n();
268
+
269
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
270
+
271
+ }
272
+
273
+ /**
274
+ * Register all of the hooks related to the admin area functionality
275
+ * of the plugin.
276
+ *
277
+ * @since 2.0.0
278
+ * @access private
279
+ */
280
+ private function define_admin_hooks() {
281
+
282
+ $plugin_admin = new Blossomthemes_Email_Newsletter_Admin( $this->get_plugin_name(), $this->get_version() );
283
+
284
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
285
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
286
+ $this->loader->add_action( 'init', $plugin_admin, 'blossomthemes_register_form' );
287
+ // $this->loader->add_action( 'init', $plugin_admin, 'blossomthemes_register_subscriber' );
288
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'blossomthemes_email_newsletter_settings_page' );
289
+ $this->loader->add_action( 'admin_init', $plugin_admin, 'blossomthemes_email_newsletter_register_settings' );
290
+ // $this->loader->add_filter( 'manage_subscriber_posts_columns', $plugin_admin, 'blossomthemes_subscriber_cpt_columns');
291
+ // $this->loader->add_action( 'manage_posts_custom_column' , $plugin_admin, 'blossomthemes_subscriber_custom_columns', 10, 2 );
292
+ $this->loader->add_filter('manage_subscribe-form_posts_columns', $plugin_admin, 'set_subscribe_form_columns');
293
+ $this->loader->add_action('manage_subscribe-form_posts_custom_column', $plugin_admin, 'set_subscribe_form_columns_content', 10, 2);
294
+ $this->loader->add_action( 'admin_notices', $plugin_admin, 'bten_api_update_notice' );
295
+ $this->loader->add_action('admin_init', $plugin_admin, 'bten_ignore_admin_notice');
296
+
297
+ }
298
+
299
+ /**
300
+ * Register all of the hooks related to the public-facing functionality
301
+ * of the plugin.
302
+ *
303
+ * @since 2.0.0
304
+ * @access private
305
+ */
306
+ private function define_public_hooks() {
307
+
308
+ $plugin_public = new Blossomthemes_Email_Newsletter_Public( $this->get_plugin_name(), $this->get_version() );
309
+
310
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
311
+ $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
312
+ $this->loader->add_filter( 'script_loader_tag', $plugin_public, 'blossom_email_newsletter_js_defer_files', 10 );
313
+
314
+ }
315
+
316
+ /**
317
+ * Run the loader to execute all of the hooks with WordPress.
318
+ *
319
+ * @since 2.0.0
320
+ */
321
+ public function run() {
322
+ $this->loader->run();
323
+ }
324
+
325
+ /**
326
+ * The name of the plugin used to uniquely identify it within the context of
327
+ * WordPress and to define internationalization functionality.
328
+ *
329
+ * @since 2.0.0
330
+ * @return string The name of the plugin.
331
+ */
332
+ public function get_plugin_name() {
333
+ return $this->plugin_name;
334
+ }
335
+
336
+ /**
337
+ * The reference to the class that orchestrates the hooks with the plugin.
338
+ *
339
+ * @since 2.0.0
340
+ * @return Blossomthemes_Email_Newsletter_Loader Orchestrates the hooks of the plugin.
341
+ */
342
+ public function get_loader() {
343
+ return $this->loader;
344
+ }
345
+
346
+ /**
347
+ * Retrieve the version number of the plugin.
348
+ *
349
+ * @since 2.0.0
350
+ * @return string The version number of the plugin.
351
+ */
352
+ public function get_version() {
353
+ return $this->version;
354
+ }
355
+
356
+ }
includes/libs/sendinblue/SendinblueApiClient.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Send in blue API Client.
4
+ */
5
+ class SendinblueApiClient
6
+ {
7
+ const API_BASE_URL = 'https://api.sendinblue.com/v3';
8
+ const HTTP_METHOD_GET = 'GET';
9
+ const HTTP_METHOD_POST = 'POST';
10
+ const HTTP_METHOD_PUT = 'PUT';
11
+ const HTTP_METHOD_DELETE = 'DELETE';
12
+ const CAMPAIGN_TYPE_EMAIL = 'email';
13
+ const CAMPAIGN_TYPE_SMS = 'sms';
14
+ const RESPONSE_CODE_OK = 200;
15
+ const RESPONSE_CODE_CREATED = 201;
16
+ const RESPONSE_CODE_ACCEPTED = 202;
17
+
18
+ private $apiKey;
19
+ private $lastResponseCode;
20
+
21
+ /**
22
+ * SendinblueApiClient constructor.
23
+ */
24
+ public function __construct()
25
+ {
26
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', false );
27
+
28
+ $this->apiKey = isset( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) ? esc_attr( $blossomthemes_email_newsletter_settings['sendinblue']['api-key'] ) : '';
29
+ }
30
+
31
+ /**
32
+ * @return mixed
33
+ */
34
+ public function getAccount()
35
+ {
36
+ return $this->get('/account');
37
+ }
38
+
39
+ /**
40
+ * @return mixed
41
+ */
42
+ public function getAttributes()
43
+ {
44
+ return $this->get("/contacts/attributes");
45
+ }
46
+
47
+ /**
48
+ * @param $type ,$name,$data
49
+ * @return mixed
50
+ */
51
+ public function createAttribute($type, $name, $data)
52
+ {
53
+ return $this->post("/contacts/attributes/" . $type . "/" . $name, $data);
54
+ }
55
+
56
+ /**
57
+ * @param $id
58
+ * @return mixed
59
+ */
60
+ public function getEmailTemplate($id)
61
+ {
62
+ return $this->get("/smtp/templates/" . $id);
63
+ }
64
+
65
+ /**
66
+ * @param string $type
67
+ * @param array $data
68
+ * @return array
69
+ */
70
+ public function getAllCampaignsByType($type = self::CAMPAIGN_TYPE_EMAIL, $data = [])
71
+ {
72
+ $campaigns = [];
73
+
74
+ if (!isset($data['offset'])) {
75
+ $data['offset'] = 0;
76
+ }
77
+
78
+ do {
79
+ if ($type === self::CAMPAIGN_TYPE_SMS) {
80
+ $response = $this->getSmsCampaigns($data);
81
+ } else {
82
+ $response = $this->getEmailCampaigns($data);
83
+ }
84
+
85
+ if (isset($response['campaigns']) && is_array($response['campaigns'])) {
86
+ $campaigns = array_merge($campaigns, $response['campaigns']);
87
+ $data['offset']++;
88
+ }
89
+ } while (!empty($response['campaigns']));
90
+
91
+ return $campaigns;
92
+ }
93
+
94
+ /**
95
+ * @param $data
96
+ * @return mixed
97
+ */
98
+ public function getEmailCampaigns($data)
99
+ {
100
+ return $this->get("/emailCampaigns", $data);
101
+ }
102
+
103
+ /**
104
+ * @param $data
105
+ * @return mixed
106
+ */
107
+ public function getSmsCampaigns($data)
108
+ {
109
+ return $this->get("/smsCampaigns", $data);
110
+ }
111
+
112
+ /**
113
+ * @param $data
114
+ * @return mixed
115
+ */
116
+ public function getEmailTemplates($data)
117
+ {
118
+ return $this->get("/smtp/templates", $data);
119
+ }
120
+
121
+ /**
122
+ * @param $data
123
+ * @return mixed
124
+ */
125
+ public function sendEmail($data)
126
+ {
127
+ return $this->post("/smtp/email", $data);
128
+ }
129
+
130
+ /**
131
+ * @param $id ,$data
132
+ * @return mixed
133
+ */
134
+ public function sendTransactionalTemplate($id, $data)
135
+ {
136
+ return $this->post("/smtp/templates/" . $id . "/send", $data);
137
+ }
138
+
139
+ /**
140
+ * @param $email
141
+ * @return mixed
142
+ */
143
+ public function getUser($email)
144
+ {
145
+ return $this->get("/contacts/" . urlencode($email));
146
+ }
147
+
148
+ /**
149
+ * @param $data
150
+ * @return mixed
151
+ */
152
+ public function createUser($data)
153
+ {
154
+ return $this->post("/contacts", $data);
155
+ }
156
+
157
+ /**
158
+ * @return mixed
159
+ */
160
+ public function getSenders()
161
+ {
162
+ return $this->get("/senders");
163
+ }
164
+
165
+ /**
166
+ * @param $email ,$data
167
+ * @return mixed
168
+ */
169
+ public function updateUser($email, $data)
170
+ {
171
+ return $this->put("/contacts/" . $email, $data);
172
+ }
173
+
174
+ /**
175
+ * @param $data
176
+ * @return mixed
177
+ */
178
+ public function createList($data)
179
+ {
180
+ return $this->post("/contacts/lists", $data);
181
+ }
182
+
183
+ /**
184
+ * @param $data
185
+ * @return mixed
186
+ */
187
+ public function getLists($data)
188
+ {
189
+ return $this->get("/contacts/lists", $data);
190
+ }
191
+
192
+ /**
193
+ * @param $data
194
+ * @return mixed
195
+ */
196
+ public function getAllLists()
197
+ {
198
+ $lists = array("lists" => array(), "count" => 0);
199
+ $offset = 0;
200
+ $limit = 50;
201
+ do {
202
+ $list_data = $this->getLists(array('limit' => $limit, 'offset' => $offset));
203
+ if (isset($list_data["lists"]) && is_array($list_data["lists"])) {
204
+ $lists["lists"] = array_merge($lists["lists"], $list_data["lists"]);
205
+ $offset += 50;
206
+ $lists["count"] = $list_data["count"];
207
+ }
208
+ } while (!empty($lists['lists']) && count($lists["lists"]) < $list_data["count"]);
209
+
210
+ return $lists;
211
+ }
212
+
213
+ /**
214
+ * @param $data
215
+ * @return mixed
216
+ */
217
+ public function importContacts($data)
218
+ {
219
+ return $this->post('/contacts/import', $data);
220
+ }
221
+
222
+ /**
223
+ * @param $endpoint
224
+ * @param array $parameters
225
+ * @return mixed
226
+ */
227
+ public function get($endpoint, $parameters = [])
228
+ {
229
+ if ($parameters) {
230
+ foreach ($parameters as $key => $parameter) {
231
+ if (is_bool($parameter)) {
232
+ // http_build_query converts bool to int
233
+ $parameters[$key] = $parameter ? 'true' : 'false';
234
+ }
235
+ }
236
+ $endpoint .= '?' . http_build_query($parameters);
237
+ }
238
+ return $this->makeHttpRequest(self::HTTP_METHOD_GET, $endpoint);
239
+ }
240
+
241
+ /**
242
+ * @param $endpoint
243
+ * @param array $data
244
+ * @return mixed
245
+ */
246
+ public function post($endpoint, $data = [])
247
+ {
248
+ return $this->makeHttpRequest(self::HTTP_METHOD_POST, $endpoint, $data);
249
+ }
250
+
251
+ /**
252
+ * @param $endpoint
253
+ * @param array $data
254
+ * @return mixed
255
+ */
256
+ public function put($endpoint, $data = [])
257
+ {
258
+ return $this->makeHttpRequest(self::HTTP_METHOD_PUT, $endpoint, $data);
259
+ }
260
+
261
+ /**
262
+ * @param $method
263
+ * @param $endpoint
264
+ * @param array $body
265
+ * @return mixed
266
+ */
267
+ private function makeHttpRequest($method, $endpoint, $body = [])
268
+ {
269
+ $url = self::API_BASE_URL . $endpoint;
270
+
271
+ $args = [
272
+ 'timeout' => 10000,
273
+ 'method' => $method,
274
+ 'headers' => [
275
+ 'api-key' => $this->apiKey,
276
+ 'Content-Type' => 'application/json'
277
+ ],
278
+ ];
279
+
280
+ if ($method != self::HTTP_METHOD_GET && $method != self::HTTP_METHOD_DELETE) {
281
+ if (isset($body['listIds'])) {
282
+ $body['listIds'] = $this->getListsIds($body['listIds']);
283
+ }
284
+ if (isset($body['unlinkListIds'])) {
285
+ $body['unlinkListIds'] = $this->getListsIds($body['unlinkListIds']);
286
+ }
287
+ $args['body'] = wp_json_encode($body);
288
+ }
289
+
290
+ $response = wp_remote_request($url, $args);
291
+ $this->lastResponseCode = wp_remote_retrieve_response_code($response);
292
+
293
+ if (is_wp_error($response)) {
294
+ $data = [
295
+ 'code' => $response->get_error_code(),
296
+ 'message' => $response->get_error_message()
297
+ ];
298
+ } else {
299
+ $data = json_decode(wp_remote_retrieve_body($response), true);
300
+ }
301
+
302
+ return $data;
303
+ }
304
+
305
+ private function getListsIds($listIds)
306
+ {
307
+ return array_unique(array_values(array_map('intval', (array)$listIds)));
308
+ }
309
+
310
+ /**
311
+ * @return int
312
+ */
313
+ public function getLastResponseCode()
314
+ {
315
+ return $this->lastResponseCode;
316
+ }
317
+ }
includes/setting/form-list-meta.php CHANGED
@@ -1,109 +1,130 @@
1
- <?php
2
- $blossomthemes_email_newsletter_setting = get_option( 'blossomthemes_email_newsletter_settings', true );
3
- $BlossomThemes_Email_Newsletters_lists = get_post_meta( get_the_ID(),'blossomthemes_email_newsletter_setting', true );
4
- if(isset($blossomthemes_email_newsletter_setting['platform']) && $blossomthemes_email_newsletter_setting['platform']!='')
5
- {
6
- $platform = $blossomthemes_email_newsletter_setting['platform'];
7
- $obj = new BlossomThemes_Email_Newsletter_Settings;
8
- if ($platform == 'mailerlite' && isset($blossomthemes_email_newsletter_setting['mailerlite']['api-key']) && $blossomthemes_email_newsletter_setting['mailerlite']['api-key']!='')
9
- {
10
- $data = $obj->mailerlite_lists();
11
- if( isset( $data['Results'] ) )
12
- {
13
- $max = max(array_keys($data['Results']));
14
- for ($i=0; $i <= $max; $i++) {
15
- $id = $data['Results'][$i]['id']?>
16
- <div class="newsletter-list">
17
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['mailerlite']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['mailerlite']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]"><?php echo esc_attr($data['Results'][$i]['name']);?></label>
18
- </div>
19
- <?php
20
- }
21
- }
22
- ?>
23
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
24
- <?php
25
- }
26
-
27
- if ($platform == 'mailchimp' && isset($blossomthemes_email_newsletter_setting['mailchimp']['api-key']) && $blossomthemes_email_newsletter_setting['mailchimp']['api-key']!='' )
28
- {
29
- $data = $obj->mailchimp_lists();
30
- $max = max(array_keys($data['lists']));
31
- for ($i=0; $i <= $max; $i++) {
32
- $id = $data['lists'][$i]['id']?>
33
- <div class="newsletter-list">
34
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['mailchimp']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['mailchimp']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]"><?php echo esc_attr($data['lists'][$i]['name']);?></label>
35
- </div>
36
- <?php
37
- }
38
- ?>
39
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
40
- <?php
41
- }
42
-
43
- if ($platform == 'convertkit' && isset($blossomthemes_email_newsletter_setting['convertkit']['api-key']) && $blossomthemes_email_newsletter_setting['convertkit']['api-key']!='')
44
- {
45
- $data = $obj->convertkit_lists();
46
- foreach ($data as $key => $value){
47
- $id = $key;?>
48
- <div class="newsletter-list">
49
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['convertkit']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['convertkit']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
50
- </div>
51
- <?php
52
- }
53
- ?>
54
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
55
- <?php
56
- }
57
-
58
- if ($platform == 'getresponse' && isset($blossomthemes_email_newsletter_setting['getresponse']['api-key']) && $blossomthemes_email_newsletter_setting['getresponse']['api-key']!='')
59
- {
60
- $data = $obj->getresponse_lists();
61
- $i = 0;
62
- foreach ($data as $key => $value){
63
- $id = $key;?>
64
- <div class="newsletter-list">
65
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['getresponse']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['getresponse']['list-id'][$id] ): '';?> value="<?php echo esc_attr( $id ) ?>" class="getresponse-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]" <?php echo checked($j,$id);?>><label for="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
66
- </div>
67
- <?php
68
- $i++;
69
- }
70
- ?>
71
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
72
- <?php
73
- }
74
-
75
- if ($platform == 'activecampaign' && $blossomthemes_email_newsletter_setting['activecampaign']['api-url']!='' && $blossomthemes_email_newsletter_setting['activecampaign']['api-key']!='')
76
- {
77
- $data = $obj->activecampaign_lists();
78
- foreach ($data as $key => $value)
79
- {
80
- $id = $key;?>
81
- <div class="newsletter-list">
82
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['activecampaign']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['activecampaign']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
83
- </div>
84
- <?php
85
- }
86
- ?>
87
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
88
- <?php
89
- }
90
-
91
- if ($platform == 'aweber' && isset($blossomthemes_email_newsletter_setting['aweber']['app-id']) && $blossomthemes_email_newsletter_setting['aweber']['app-id']!='')
92
- {
93
- $aw = new Blossomthemes_Email_Newsletter_AWeber;
94
- $data = $aw->bten_get_aw_lists();
95
- foreach ($data as $key => $value)
96
- {
97
- $id = $key;?>
98
- <div class="newsletter-list">
99
- <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['aweber']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['aweber']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
100
- </div>
101
- <?php
102
- }
103
- ?>
104
- <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
105
- <?php
106
- }
107
-
108
- }?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  <div class="blossomthemes-email-newsletter-note"><?php echo sprintf( __('Please put your valid API key for the respective platform in %1$s BlossomThemes Email Newsletter > Settings > API Key %2$s if no groups/lists are displayed here.', 'blossomthemes-email-newsletter' ),'<b>','</b>'); ?></div>
1
+ <?php
2
+ $blossomthemes_email_newsletter_setting = get_option( 'blossomthemes_email_newsletter_settings', true );
3
+ $BlossomThemes_Email_Newsletters_lists = get_post_meta( get_the_ID(),'blossomthemes_email_newsletter_setting', true );
4
+ if(isset($blossomthemes_email_newsletter_setting['platform']) && $blossomthemes_email_newsletter_setting['platform']!='')
5
+ {
6
+ $platform = $blossomthemes_email_newsletter_setting['platform'];
7
+ $obj = new BlossomThemes_Email_Newsletter_Settings;
8
+ if ($platform == 'mailerlite' && isset($blossomthemes_email_newsletter_setting['mailerlite']['api-key']) && $blossomthemes_email_newsletter_setting['mailerlite']['api-key']!='')
9
+ {
10
+ $data = $obj->mailerlite_lists();
11
+ if( isset( $data['Results'] ) )
12
+ {
13
+ $max = max(array_keys($data['Results']));
14
+ for ($i=0; $i <= $max; $i++) {
15
+ $id = $data['Results'][$i]['id']?>
16
+ <div class="newsletter-list">
17
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['mailerlite']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['mailerlite']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[mailerlite][list-id][<?php echo $id;?>]"><?php echo esc_attr($data['Results'][$i]['name']);?></label>
18
+ </div>
19
+ <?php
20
+ }
21
+ }
22
+ ?>
23
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
24
+ <?php
25
+ }
26
+
27
+ if ($platform == 'mailchimp' && isset($blossomthemes_email_newsletter_setting['mailchimp']['api-key']) && $blossomthemes_email_newsletter_setting['mailchimp']['api-key']!='' )
28
+ {
29
+ $data = $obj->mailchimp_lists();
30
+ $max = max(array_keys($data['lists']));
31
+ for ($i=0; $i <= $max; $i++) {
32
+ $id = $data['lists'][$i]['id']?>
33
+ <div class="newsletter-list">
34
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['mailchimp']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['mailchimp']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[mailchimp][list-id][<?php echo $id;?>]"><?php echo esc_attr($data['lists'][$i]['name']);?></label>
35
+ </div>
36
+ <?php
37
+ }
38
+ ?>
39
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
40
+ <?php
41
+ }
42
+
43
+ if ($platform == 'convertkit' && isset($blossomthemes_email_newsletter_setting['convertkit']['api-key']) && $blossomthemes_email_newsletter_setting['convertkit']['api-key']!='')
44
+ {
45
+ $data = $obj->convertkit_lists();
46
+ foreach ($data as $key => $value){
47
+ $id = $key;?>
48
+ <div class="newsletter-list">
49
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['convertkit']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['convertkit']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[convertkit][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
50
+ </div>
51
+ <?php
52
+ }
53
+ ?>
54
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
55
+ <?php
56
+ }
57
+
58
+ if ($platform == 'getresponse' && isset($blossomthemes_email_newsletter_setting['getresponse']['api-key']) && $blossomthemes_email_newsletter_setting['getresponse']['api-key']!='')
59
+ {
60
+ $data = $obj->getresponse_lists();
61
+ $i = 0;
62
+ foreach ($data as $key => $value){
63
+ $id = $key;?>
64
+ <div class="newsletter-list">
65
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['getresponse']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['getresponse']['list-id'][$id] ): '';?> value="<?php echo esc_attr( $id ) ?>" class="getresponse-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]" <?php echo checked($j,$id);?>><label for="blossomthemes_email_newsletter_setting[getresponse][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
66
+ </div>
67
+ <?php
68
+ $i++;
69
+ }
70
+ ?>
71
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
72
+ <?php
73
+ }
74
+
75
+ if ($platform == 'activecampaign' && $blossomthemes_email_newsletter_setting['activecampaign']['api-url']!='' && $blossomthemes_email_newsletter_setting['activecampaign']['api-key']!='')
76
+ {
77
+ $data = $obj->activecampaign_lists();
78
+ foreach ($data as $key => $value)
79
+ {
80
+ $id = $key;?>
81
+ <div class="newsletter-list">
82
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['activecampaign']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['activecampaign']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[activecampaign][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
83
+ </div>
84
+ <?php
85
+ }
86
+ ?>
87
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
88
+ <?php
89
+ }
90
+
91
+ if ($platform == 'aweber' && isset($blossomthemes_email_newsletter_setting['aweber']['app-id']) && $blossomthemes_email_newsletter_setting['aweber']['app-id']!='')
92
+ {
93
+ $aw = new Blossomthemes_Email_Newsletter_AWeber;
94
+ $data = $aw->bten_get_aw_lists();
95
+ foreach ($data as $key => $value)
96
+ {
97
+ $id = $key;?>
98
+ <div class="newsletter-list">
99
+ <input <?php $j = isset( $BlossomThemes_Email_Newsletters_lists['aweber']['list-id'][$id] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['aweber']['list-id'][$id] ): '0';?> value="<?php echo esc_attr($j);?>" <?php if($j=='1'){ echo "checked";}?> class="mailerlite-lists" type="checkbox" id="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]" name="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]"><label for="blossomthemes_email_newsletter_setting[aweber][list-id][<?php echo $id;?>]"><?php echo esc_attr($value['name']);?></label>
100
+ </div>
101
+ <?php
102
+ }
103
+ ?>
104
+ <div class="blossomthemes-email-newsletter-note"><?php _e( 'Users will be subscribed to the groups selected above. If no groups are selected then the group selected in the plugin settings page will be used as a default group.', 'blossomthemes-email-newsletter' ); ?></div>
105
+ <?php
106
+ }
107
+
108
+ if ($platform == 'sendinblue' && isset($blossomthemes_email_newsletter_setting['sendinblue']['api-key']) && $blossomthemes_email_newsletter_setting['sendinblue']['api-key']!='') {
109
+
110
+ $sendinblue = new Blossomthemes_Email_Newsletter_Sendinblue;
111
+ $lists = $sendinblue->get_lists();
112
+
113
+ if ( ! empty( $lists ) ) {
114
+ foreach( $lists as $key => $list ) {
115
+ $cheched_val = isset( $BlossomThemes_Email_Newsletters_lists['sendinblue']['list-id'][$list['id']] ) ? esc_attr( $BlossomThemes_Email_Newsletters_lists['sendinblue']['list-id'][$list['id']] ) : 'no';
116
+ ?>
117
+ <div class="newsletter-list">
118
+ <input <?php checked( $cheched_val, $list['id'] ); ?> value="<?php echo esc_attr( $list['id'] ); ?>" id="btn_sendinblue_list_<?php echo esc_attr( $list['id'] ); ?>" name="blossomthemes_email_newsletter_setting[sendinblue][list-id][<?php echo esc_attr( $list['id'] );?>]" type="checkbox">
119
+ <label for="btn_sendinblue_list_<?php echo esc_attr( $list['id'] ); ?>"><?php echo esc_html( $list['name'] ); ?></label>
120
+ </div>
121
+ <?php
122
+ }
123
+ } else {
124
+ esc_html_e( 'Lists not available to fetch from your sendinblue account.', 'blossomthemes-email-newsletter' );
125
+ }
126
+
127
+ }
128
+
129
+ }?>
130
  <div class="blossomthemes-email-newsletter-note"><?php echo sprintf( __('Please put your valid API key for the respective platform in %1$s BlossomThemes Email Newsletter > Settings > API Key %2$s if no groups/lists are displayed here.', 'blossomthemes-email-newsletter' ),'<b>','</b>'); ?></div>
includes/tabs/general.php CHANGED
@@ -1,113 +1,114 @@
1
- <?php
2
-
3
- $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
4
- $platform = isset($blossomthemes_email_newsletter_settings['platform']) ? $blossomthemes_email_newsletter_settings['platform'] : '';
5
- $selected_page = isset($blossomthemes_email_newsletter_settings['page'])?esc_attr($blossomthemes_email_newsletter_settings['page']):'';
6
- ?>
7
- <div class="blossomthemes-email-newsletter-settings-platform">
8
- <label for="blossomthemes_email_newsletter_settings[platform]"><?php _e('Platform : ','blossomthemes-email-newsletter');?>
9
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose your newsletter platform.','blossomthemes-email-newsletter'); ?>">
10
- <i class="far fa-question-circle"></i>
11
- </span>
12
- </label>
13
-
14
- <div class="select-holder">
15
- <select id="platform-select" name="blossomthemes_email_newsletter_settings[platform]">
16
- <option value="mailchimp" <?php selected($platform,'mailchimp');?>><?php _e('Mailchimp', 'blossomthemes-email-newsletter');?></option>
17
- <option value="mailerlite" <?php selected($platform,'mailerlite');?>><?php _e('Mailerlite', 'blossomthemes-email-newsletter'); ?></option>
18
- <option value="convertkit" <?php selected($platform,'convertkit');?>><?php _e('ConvertKit', 'blossomthemes-email-newsletter'); ?></option>
19
- <option value="getresponse" <?php selected($platform,'getresponse');?>><?php _e('GetReponse', 'blossomthemes-email-newsletter'); ?></option>
20
- <option value="activecampaign" <?php selected($platform,'activecampaign');?>><?php _e('ActiveCampaign', 'blossomthemes-email-newsletter'); ?></option>
21
- <option value="aweber" <?php selected($platform,'aweber');?>><?php _e('AWeber', 'blossomthemes-email-newsletter'); ?></option>
22
- </select>
23
- </div>
24
-
25
- </div>
26
- <div id="platform-switch-holder">
27
- <?php
28
- $platform_settings = new BlossomThemes_Email_Newsletter_Settings;
29
- echo $platform_settings->bten_platform_settings($platform);
30
- ?>
31
- </div>
32
- <div id="ajax-loader" style="display: none">
33
- <div class="table">
34
- <div class="table-row">
35
- <div class="table-cell">
36
- <img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
-
42
- <div class="bten-color-wrap form-bg-color">
43
- <div class="form-bg-color">
44
- <label for="blossomthemes_email_newsletter_settings[appearance][bgcolor]"><?php _e('Background Color: ','blossomthemes-email-newsletter');?></label>
45
- <input type="text" class="blossomthemes-email-newsletter-color-form" id="blossomthemes_email_newsletter_settings[appearance][bgcolor]" name="blossomthemes_email_newsletter_settings[appearance][bgcolor]" value="<?php echo isset($blossomthemes_email_newsletter_settings['appearance']['bgcolor']) ? esc_attr($blossomthemes_email_newsletter_settings['appearance']['bgcolor']):apply_filters('bt_newsletter_bg_color_setting','#ffffff')?>">
46
- </div>
47
- </div>
48
-
49
- <div class="bten-color-wrap font-bg-color">
50
- <div class="font-bg-color">
51
- <label for="blossomthemes_email_newsletter_settings[appearance][fontcolor]"><?php _e('Font Color: ','blossomthemes-email-newsletter');?></label>
52
- <input type="text" class="blossomthemes-email-newsletter-color-form" id="blossomthemes_email_newsletter_settings[appearance][fontcolor]" name="blossomthemes_email_newsletter_settings[appearance][fontcolor]" value="<?php echo isset($blossomthemes_email_newsletter_settings['appearance']['fontcolor']) ? esc_attr($blossomthemes_email_newsletter_settings['appearance']['fontcolor']):apply_filters('bt_newsletter_font_color_setting','#ffffff')?>">
53
- </div>
54
- </div>
55
-
56
- <div class="success-msg-option">
57
- <label><?php _e('Display Successful Subscription Message From:','blossomthemes-email-newsletter');?>
58
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set how to show the confirmation message to the subscribers after successful subscription.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
59
- </span>
60
- </label>
61
- <?php
62
- $option = isset($blossomthemes_email_newsletter_settings['thankyou-option']) ? esc_attr($blossomthemes_email_newsletter_settings['thankyou-option']):'text';?><br>
63
-
64
- <div class="success-msg-option-text">
65
- <label><?php _e('Popup text','blossomthemes-email-newsletter');?><input class="newsletter-success-option" type="radio" name="blossomthemes_email_newsletter_settings[thankyou-option]" value="text" <?php if( $option == 'text' ) echo 'checked'; ?>><span class="check-mark"></span></label>
66
-
67
- <div class="blossomthemes-email-newsletter-settings-wrap message">
68
- <label for="blossomthemes_email_newsletter_settings[msg]"><?php _e('Success Message : ','blossomthemes-email-newsletter');?>
69
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set what message to show when the subscriber is successfully subscribed.', 'blossomthemes-email-newsletter' ); ?>">
70
- <i class="far fa-question-circle"></i>
71
- </span>
72
- </label>
73
- <textarea name="blossomthemes_email_newsletter_settings[msg]" id="blossomthemes_email_newsletter_settings[msg]"><?php echo isset($blossomthemes_email_newsletter_settings['msg']) ? esc_attr( $blossomthemes_email_newsletter_settings['msg']): 'Successfully subscribed.';?></textarea>
74
- </div>
75
-
76
- <div class="blossomthemes-email-newsletter-settings-wrap message">
77
- <label for="blossomthemes_email_newsletter_settings[gdpr-msg]"><?php _e('GDPR Message : ','blossomthemes-email-newsletter');?>
78
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set GDPR message to show on the subscription form.', 'blossomthemes-email-newsletter' ); ?>">
79
- <i class="far fa-question-circle"></i>
80
- </span>
81
- </label>
82
- <textarea name="blossomthemes_email_newsletter_settings[gdpr-msg]" id="blossomthemes_email_newsletter_settings[gdpr-msg]"><?php echo isset($blossomthemes_email_newsletter_settings['gdpr-msg']) ? wp_kses_post($blossomthemes_email_newsletter_settings['gdpr-msg']): 'By checking this, you agree to our Privacy Policy.';?></textarea>
83
-
84
- </div>
85
- </div>
86
-
87
- <div class="success-msg-option-page">
88
- <label><?php _e('Page','blossomthemes-email-newsletter');?><input class="newsletter-success-option" type="radio" name="blossomthemes_email_newsletter_settings[thankyou-option]" value="page" <?php if( $option == 'page' ) echo 'checked'; ?>><span class="check-mark"></span></label>
89
- <div class="blossomthemes-email-newsletter-settings-wrap page">
90
- <label for="blossomthemes_email_newsletter_settings[page]"><?php _e('Thank You Page : ','blossomthemes-email-newsletter');?>
91
- <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set the page user will be redirected to after successful subscription.', 'blossomthemes-email-newsletter' ); ?>">
92
- <i class="far fa-question-circle"></i>
93
- </span>
94
- </label>
95
- <div class="select-holder">
96
- <select name="blossomthemes_email_newsletter_settings[page]">
97
- <option selected="selected" disabled="disabled" value=""><?php esc_attr_e( 'Select page', 'blossomthemes-email-newsletter' ) ; ?></option>
98
- <?php
99
- $pages = get_pages();
100
- foreach ( $pages as $page ) {
101
- $option = '<option value="' . $page->ID . '" ';
102
- $option .= ( $page->ID == $selected_page ) ? 'selected="selected"' : '';
103
- $option .= '>';
104
- $option .= $page->post_title;
105
- $option .= '</option>';
106
- echo $option;
107
- }
108
- ?>
109
- </select>
110
- </div>
111
- </div>
112
- </div>
113
- </div>
 
1
+ <?php
2
+
3
+ $blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
4
+ $platform = isset($blossomthemes_email_newsletter_settings['platform']) ? $blossomthemes_email_newsletter_settings['platform'] : '';
5
+ $selected_page = isset($blossomthemes_email_newsletter_settings['page'])?esc_attr($blossomthemes_email_newsletter_settings['page']):'';
6
+ ?>
7
+ <div class="blossomthemes-email-newsletter-settings-platform">
8
+ <label for="blossomthemes_email_newsletter_settings[platform]"><?php _e('Platform : ','blossomthemes-email-newsletter');?>
9
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Choose your newsletter platform.','blossomthemes-email-newsletter'); ?>">
10
+ <i class="far fa-question-circle"></i>
11
+ </span>
12
+ </label>
13
+
14
+ <div class="select-holder">
15
+ <select id="platform-select" name="blossomthemes_email_newsletter_settings[platform]">
16
+ <option value="sendinblue" <?php selected($platform,'sendinblue');?>><?php _e('Sendinblue', 'blossomthemes-email-newsletter'); ?></option>
17
+ <option value="mailchimp" <?php selected($platform,'mailchimp');?>><?php _e('Mailchimp', 'blossomthemes-email-newsletter');?></option>
18
+ <option value="mailerlite" <?php selected($platform,'mailerlite');?>><?php _e('Mailerlite', 'blossomthemes-email-newsletter'); ?></option>
19
+ <option value="convertkit" <?php selected($platform,'convertkit');?>><?php _e('ConvertKit', 'blossomthemes-email-newsletter'); ?></option>
20
+ <option value="getresponse" <?php selected($platform,'getresponse');?>><?php _e('GetReponse', 'blossomthemes-email-newsletter'); ?></option>
21
+ <option value="activecampaign" <?php selected($platform,'activecampaign');?>><?php _e('ActiveCampaign', 'blossomthemes-email-newsletter'); ?></option>
22
+ <option value="aweber" <?php selected($platform,'aweber');?>><?php _e('AWeber', 'blossomthemes-email-newsletter'); ?></option>
23
+ </select>
24
+ </div>
25
+
26
+ </div>
27
+ <div id="platform-switch-holder">
28
+ <?php
29
+ $platform_settings = new BlossomThemes_Email_Newsletter_Settings;
30
+ echo $platform_settings->bten_platform_settings($platform);
31
+ ?>
32
+ </div>
33
+ <div id="ajax-loader" style="display: none">
34
+ <div class="table">
35
+ <div class="table-row">
36
+ <div class="table-cell">
37
+ <img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="bten-color-wrap form-bg-color">
44
+ <div class="form-bg-color">
45
+ <label for="blossomthemes_email_newsletter_settings[appearance][bgcolor]"><?php _e('Background Color: ','blossomthemes-email-newsletter');?></label>
46
+ <input type="text" class="blossomthemes-email-newsletter-color-form" id="blossomthemes_email_newsletter_settings[appearance][bgcolor]" name="blossomthemes_email_newsletter_settings[appearance][bgcolor]" value="<?php echo isset($blossomthemes_email_newsletter_settings['appearance']['bgcolor']) ? esc_attr($blossomthemes_email_newsletter_settings['appearance']['bgcolor']):apply_filters('bt_newsletter_bg_color_setting','#ffffff')?>">
47
+ </div>
48
+ </div>
49
+
50
+ <div class="bten-color-wrap font-bg-color">
51
+ <div class="font-bg-color">
52
+ <label for="blossomthemes_email_newsletter_settings[appearance][fontcolor]"><?php _e('Font Color: ','blossomthemes-email-newsletter');?></label>
53
+ <input type="text" class="blossomthemes-email-newsletter-color-form" id="blossomthemes_email_newsletter_settings[appearance][fontcolor]" name="blossomthemes_email_newsletter_settings[appearance][fontcolor]" value="<?php echo isset($blossomthemes_email_newsletter_settings['appearance']['fontcolor']) ? esc_attr($blossomthemes_email_newsletter_settings['appearance']['fontcolor']):apply_filters('bt_newsletter_font_color_setting','#ffffff')?>">
54
+ </div>
55
+ </div>
56
+
57
+ <div class="success-msg-option">
58
+ <label><?php _e('Display Successful Subscription Message From:','blossomthemes-email-newsletter');?>
59
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set how to show the confirmation message to the subscribers after successful subscription.', 'blossomthemes-email-newsletter' ); ?>"><i class="far fa-question-circle"></i>
60
+ </span>
61
+ </label>
62
+ <?php
63
+ $option = isset($blossomthemes_email_newsletter_settings['thankyou-option']) ? esc_attr($blossomthemes_email_newsletter_settings['thankyou-option']):'text';?><br>
64
+
65
+ <div class="success-msg-option-text">
66
+ <label><?php _e('Popup text','blossomthemes-email-newsletter');?><input class="newsletter-success-option" type="radio" name="blossomthemes_email_newsletter_settings[thankyou-option]" value="text" <?php if( $option == 'text' ) echo 'checked'; ?>><span class="check-mark"></span></label>
67
+
68
+ <div class="blossomthemes-email-newsletter-settings-wrap message">
69
+ <label for="blossomthemes_email_newsletter_settings[msg]"><?php _e('Success Message : ','blossomthemes-email-newsletter');?>
70
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set what message to show when the subscriber is successfully subscribed.', 'blossomthemes-email-newsletter' ); ?>">
71
+ <i class="far fa-question-circle"></i>
72
+ </span>
73
+ </label>
74
+ <textarea name="blossomthemes_email_newsletter_settings[msg]" id="blossomthemes_email_newsletter_settings[msg]"><?php echo isset($blossomthemes_email_newsletter_settings['msg']) ? esc_attr( $blossomthemes_email_newsletter_settings['msg']): 'Successfully subscribed.';?></textarea>
75
+ </div>
76
+
77
+ <div class="blossomthemes-email-newsletter-settings-wrap message">
78
+ <label for="blossomthemes_email_newsletter_settings[gdpr-msg]"><?php _e('GDPR Message : ','blossomthemes-email-newsletter');?>
79
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set GDPR message to show on the subscription form.', 'blossomthemes-email-newsletter' ); ?>">
80
+ <i class="far fa-question-circle"></i>
81
+ </span>
82
+ </label>
83
+ <textarea name="blossomthemes_email_newsletter_settings[gdpr-msg]" id="blossomthemes_email_newsletter_settings[gdpr-msg]"><?php echo isset($blossomthemes_email_newsletter_settings['gdpr-msg']) ? wp_kses_post($blossomthemes_email_newsletter_settings['gdpr-msg']): 'By checking this, you agree to our Privacy Policy.';?></textarea>
84
+
85
+ </div>
86
+ </div>
87
+
88
+ <div class="success-msg-option-page">
89
+ <label><?php _e('Page','blossomthemes-email-newsletter');?><input class="newsletter-success-option" type="radio" name="blossomthemes_email_newsletter_settings[thankyou-option]" value="page" <?php if( $option == 'page' ) echo 'checked'; ?>><span class="check-mark"></span></label>
90
+ <div class="blossomthemes-email-newsletter-settings-wrap page">
91
+ <label for="blossomthemes_email_newsletter_settings[page]"><?php _e('Thank You Page : ','blossomthemes-email-newsletter');?>
92
+ <span class="blossomthemes-email-newsletter-tooltip" title="<?php esc_html_e( 'Set the page user will be redirected to after successful subscription.', 'blossomthemes-email-newsletter' ); ?>">
93
+ <i class="far fa-question-circle"></i>
94
+ </span>
95
+ </label>
96
+ <div class="select-holder">
97
+ <select name="blossomthemes_email_newsletter_settings[page]">
98
+ <option selected="selected" disabled="disabled" value=""><?php esc_attr_e( 'Select page', 'blossomthemes-email-newsletter' ) ; ?></option>
99
+ <?php
100
+ $pages = get_pages();
101
+ foreach ( $pages as $page ) {
102
+ $option = '<option value="' . $page->ID . '" ';
103
+ $option .= ( $page->ID == $selected_page ) ? 'selected="selected"' : '';
104
+ $option .= '>';
105
+ $option .= $page->post_title;
106
+ $option .= '</option>';
107
+ echo $option;
108
+ }
109
+ ?>
110
+ </select>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </div>
languages/blossomthemes-email-newsletter.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: BlossomThemes Email Newsletter 2.1.1\n"
6
  "Report-Msgid-Bugs-To: \n"
7
- "POT-Creation-Date: 2020-04-23 08:17:33+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -131,105 +131,114 @@ msgstr ""
131
  msgid "Remove Image"
132
  msgstr ""
133
 
134
- #: includes/class-blossomthemes-email-newsletter-settings.php:195
135
  msgid "Settings"
136
  msgstr ""
137
 
138
- #: includes/class-blossomthemes-email-newsletter-settings.php:201
139
  msgid "Settings updated."
140
  msgstr ""
141
 
142
- #: includes/class-blossomthemes-email-newsletter-settings.php:201
143
  msgid "Dismiss this notice."
144
  msgstr ""
145
 
146
- #: includes/class-blossomthemes-email-newsletter-settings.php:253
147
- #: includes/class-blossomthemes-email-newsletter-settings.php:302
148
- #: includes/class-blossomthemes-email-newsletter-settings.php:341
149
- #: includes/class-blossomthemes-email-newsletter-settings.php:382
150
  #: includes/class-blossomthemes-email-newsletter-settings.php:425
151
- #: includes/class-blossomthemes-email-newsletter-settings.php:534
 
 
152
  msgid "API Key : "
153
  msgstr ""
154
 
155
- #: includes/class-blossomthemes-email-newsletter-settings.php:255
156
- #: includes/class-blossomthemes-email-newsletter-settings.php:536
 
157
  msgid "Get your API key %1$shere%2$s"
158
  msgstr ""
159
 
160
- #: includes/class-blossomthemes-email-newsletter-settings.php:258
161
- #: includes/class-blossomthemes-email-newsletter-settings.php:307
162
- #: includes/class-blossomthemes-email-newsletter-settings.php:349
163
- #: includes/class-blossomthemes-email-newsletter-settings.php:386
164
  #: includes/class-blossomthemes-email-newsletter-settings.php:429
165
- #: includes/class-blossomthemes-email-newsletter-settings.php:494
166
- #: includes/class-blossomthemes-email-newsletter-settings.php:539
 
 
167
  msgid "List Id : "
168
  msgstr ""
169
 
170
- #: includes/class-blossomthemes-email-newsletter-settings.php:259
171
- #: includes/class-blossomthemes-email-newsletter-settings.php:308
172
- #: includes/class-blossomthemes-email-newsletter-settings.php:350
173
- #: includes/class-blossomthemes-email-newsletter-settings.php:387
174
  #: includes/class-blossomthemes-email-newsletter-settings.php:430
175
- #: includes/class-blossomthemes-email-newsletter-settings.php:495
176
- #: includes/class-blossomthemes-email-newsletter-settings.php:540
 
 
177
  msgid ""
178
  "Choose the default list. If no groups/lists are selected in the newsletter "
179
  "posts, users will be subscribed to the list selected above."
180
  msgstr ""
181
 
182
- #: includes/class-blossomthemes-email-newsletter-settings.php:269
183
- #: includes/class-blossomthemes-email-newsletter-settings.php:318
184
- #: includes/class-blossomthemes-email-newsletter-settings.php:360
185
- #: includes/class-blossomthemes-email-newsletter-settings.php:398
186
- #: includes/class-blossomthemes-email-newsletter-settings.php:442
187
- #: includes/class-blossomthemes-email-newsletter-settings.php:506
188
- #: includes/class-blossomthemes-email-newsletter-settings.php:550
 
189
  msgid "No Lists Found"
190
  msgstr ""
191
 
192
- #: includes/class-blossomthemes-email-newsletter-settings.php:284
193
- #: includes/class-blossomthemes-email-newsletter-settings.php:564
194
  msgid "Confirmation"
195
  msgstr ""
196
 
197
- #: includes/class-blossomthemes-email-newsletter-settings.php:285
198
- #: includes/class-blossomthemes-email-newsletter-settings.php:565
199
  msgid ""
200
  "Check this box if you want subscribers to receive confirmation mail before "
201
  "they are added to list."
202
  msgstr ""
203
 
204
- #: includes/class-blossomthemes-email-newsletter-settings.php:304
205
  msgid "Get your api key %1$shere%2$s"
206
  msgstr ""
207
 
208
- #: includes/class-blossomthemes-email-newsletter-settings.php:345
209
  msgid "API Secret : "
210
  msgstr ""
211
 
212
- #: includes/class-blossomthemes-email-newsletter-settings.php:400
213
- #: includes/class-blossomthemes-email-newsletter-settings.php:444
214
- #: includes/class-blossomthemes-email-newsletter-settings.php:508
215
  msgid "Choose Campaign ID"
216
  msgstr ""
217
 
218
- #: includes/class-blossomthemes-email-newsletter-settings.php:421
219
  msgid "API Url : "
220
  msgstr ""
221
 
222
- #: includes/class-blossomthemes-email-newsletter-settings.php:476
223
  msgid ""
224
  "The APP ID does not seem to exist. Please enter a valid AWeber APP ID to "
225
  "connect to the mailing lists."
226
  msgstr ""
227
 
228
- #: includes/class-blossomthemes-email-newsletter-settings.php:481
229
- #: includes/class-blossomthemes-email-newsletter-settings.php:489
230
  msgid "AWeber Connection : "
231
  msgstr ""
232
 
 
 
 
 
233
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:88
234
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:94
235
  msgid "Your Email"
@@ -265,6 +274,7 @@ msgstr ""
265
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:382
266
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:405
267
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:427
 
268
  msgid "Error in subscription."
269
  msgstr ""
270
 
@@ -331,7 +341,11 @@ msgid ""
331
  "as a default group."
332
  msgstr ""
333
 
334
- #: includes/setting/form-list-meta.php:109
 
 
 
 
335
  msgid ""
336
  "Please put your valid API key for the respective platform in %1$s "
337
  "BlossomThemes Email Newsletter > Settings > API Key %2$s if no groups/lists "
@@ -362,11 +376,11 @@ msgstr ""
362
  msgid "Enable to display overlay on email newsletter background."
363
  msgstr ""
364
 
365
- #: includes/setting/form-meta.php:55 includes/tabs/general.php:44
366
  msgid "Background Color: "
367
  msgstr ""
368
 
369
- #: includes/setting/form-meta.php:61 includes/tabs/general.php:51
370
  msgid "Font Color: "
371
  msgstr ""
372
 
@@ -393,72 +407,76 @@ msgid "Choose your newsletter platform."
393
  msgstr ""
394
 
395
  #: includes/tabs/general.php:16
396
- msgid "Mailchimp"
397
  msgstr ""
398
 
399
  #: includes/tabs/general.php:17
400
- msgid "Mailerlite"
401
  msgstr ""
402
 
403
  #: includes/tabs/general.php:18
404
- msgid "ConvertKit"
405
  msgstr ""
406
 
407
  #: includes/tabs/general.php:19
408
- msgid "GetReponse"
409
  msgstr ""
410
 
411
  #: includes/tabs/general.php:20
412
- msgid "ActiveCampaign"
413
  msgstr ""
414
 
415
  #: includes/tabs/general.php:21
 
 
 
 
416
  msgid "AWeber"
417
  msgstr ""
418
 
419
- #: includes/tabs/general.php:57
420
  msgid "Display Successful Subscription Message From:"
421
  msgstr ""
422
 
423
- #: includes/tabs/general.php:58
424
  msgid ""
425
  "Set how to show the confirmation message to the subscribers after "
426
  "successful subscription."
427
  msgstr ""
428
 
429
- #: includes/tabs/general.php:65
430
  msgid "Popup text"
431
  msgstr ""
432
 
433
- #: includes/tabs/general.php:68
434
  msgid "Success Message : "
435
  msgstr ""
436
 
437
- #: includes/tabs/general.php:69
438
  msgid "Set what message to show when the subscriber is successfully subscribed."
439
  msgstr ""
440
 
441
- #: includes/tabs/general.php:77
442
  msgid "GDPR Message : "
443
  msgstr ""
444
 
445
- #: includes/tabs/general.php:78
446
  msgid "Set GDPR message to show on the subscription form."
447
  msgstr ""
448
 
449
- #: includes/tabs/general.php:88
450
  msgid "Page"
451
  msgstr ""
452
 
453
- #: includes/tabs/general.php:90
454
  msgid "Thank You Page : "
455
  msgstr ""
456
 
457
- #: includes/tabs/general.php:91
458
  msgid "Set the page user will be redirected to after successful subscription."
459
  msgstr ""
460
 
461
- #: includes/tabs/general.php:97
462
  msgid "Select page"
463
  msgstr ""
464
 
2
  # This file is distributed under the GPL-2.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: BlossomThemes Email Newsletter 2.1.2\n"
6
  "Report-Msgid-Bugs-To: \n"
7
+ "POT-Creation-Date: 2020-08-28 08:39:49+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
131
  msgid "Remove Image"
132
  msgstr ""
133
 
134
+ #: includes/class-blossomthemes-email-newsletter-settings.php:238
135
  msgid "Settings"
136
  msgstr ""
137
 
138
+ #: includes/class-blossomthemes-email-newsletter-settings.php:244
139
  msgid "Settings updated."
140
  msgstr ""
141
 
142
+ #: includes/class-blossomthemes-email-newsletter-settings.php:244
143
  msgid "Dismiss this notice."
144
  msgstr ""
145
 
146
+ #: includes/class-blossomthemes-email-newsletter-settings.php:296
147
+ #: includes/class-blossomthemes-email-newsletter-settings.php:345
148
+ #: includes/class-blossomthemes-email-newsletter-settings.php:384
 
149
  #: includes/class-blossomthemes-email-newsletter-settings.php:425
150
+ #: includes/class-blossomthemes-email-newsletter-settings.php:468
151
+ #: includes/class-blossomthemes-email-newsletter-settings.php:577
152
+ #: includes/class-blossomthemes-email-newsletter-settings.php:621
153
  msgid "API Key : "
154
  msgstr ""
155
 
156
+ #: includes/class-blossomthemes-email-newsletter-settings.php:298
157
+ #: includes/class-blossomthemes-email-newsletter-settings.php:579
158
+ #: includes/class-blossomthemes-email-newsletter-settings.php:623
159
  msgid "Get your API key %1$shere%2$s"
160
  msgstr ""
161
 
162
+ #: includes/class-blossomthemes-email-newsletter-settings.php:301
163
+ #: includes/class-blossomthemes-email-newsletter-settings.php:350
164
+ #: includes/class-blossomthemes-email-newsletter-settings.php:392
 
165
  #: includes/class-blossomthemes-email-newsletter-settings.php:429
166
+ #: includes/class-blossomthemes-email-newsletter-settings.php:472
167
+ #: includes/class-blossomthemes-email-newsletter-settings.php:537
168
+ #: includes/class-blossomthemes-email-newsletter-settings.php:582
169
+ #: includes/class-blossomthemes-email-newsletter-settings.php:626
170
  msgid "List Id : "
171
  msgstr ""
172
 
173
+ #: includes/class-blossomthemes-email-newsletter-settings.php:302
174
+ #: includes/class-blossomthemes-email-newsletter-settings.php:351
175
+ #: includes/class-blossomthemes-email-newsletter-settings.php:393
 
176
  #: includes/class-blossomthemes-email-newsletter-settings.php:430
177
+ #: includes/class-blossomthemes-email-newsletter-settings.php:473
178
+ #: includes/class-blossomthemes-email-newsletter-settings.php:538
179
+ #: includes/class-blossomthemes-email-newsletter-settings.php:583
180
+ #: includes/class-blossomthemes-email-newsletter-settings.php:627
181
  msgid ""
182
  "Choose the default list. If no groups/lists are selected in the newsletter "
183
  "posts, users will be subscribed to the list selected above."
184
  msgstr ""
185
 
186
+ #: includes/class-blossomthemes-email-newsletter-settings.php:312
187
+ #: includes/class-blossomthemes-email-newsletter-settings.php:361
188
+ #: includes/class-blossomthemes-email-newsletter-settings.php:403
189
+ #: includes/class-blossomthemes-email-newsletter-settings.php:441
190
+ #: includes/class-blossomthemes-email-newsletter-settings.php:485
191
+ #: includes/class-blossomthemes-email-newsletter-settings.php:549
192
+ #: includes/class-blossomthemes-email-newsletter-settings.php:596
193
+ #: includes/class-blossomthemes-email-newsletter-settings.php:637
194
  msgid "No Lists Found"
195
  msgstr ""
196
 
197
+ #: includes/class-blossomthemes-email-newsletter-settings.php:327
198
+ #: includes/class-blossomthemes-email-newsletter-settings.php:651
199
  msgid "Confirmation"
200
  msgstr ""
201
 
202
+ #: includes/class-blossomthemes-email-newsletter-settings.php:328
203
+ #: includes/class-blossomthemes-email-newsletter-settings.php:652
204
  msgid ""
205
  "Check this box if you want subscribers to receive confirmation mail before "
206
  "they are added to list."
207
  msgstr ""
208
 
209
+ #: includes/class-blossomthemes-email-newsletter-settings.php:347
210
  msgid "Get your api key %1$shere%2$s"
211
  msgstr ""
212
 
213
+ #: includes/class-blossomthemes-email-newsletter-settings.php:388
214
  msgid "API Secret : "
215
  msgstr ""
216
 
217
+ #: includes/class-blossomthemes-email-newsletter-settings.php:443
218
+ #: includes/class-blossomthemes-email-newsletter-settings.php:487
219
+ #: includes/class-blossomthemes-email-newsletter-settings.php:551
220
  msgid "Choose Campaign ID"
221
  msgstr ""
222
 
223
+ #: includes/class-blossomthemes-email-newsletter-settings.php:464
224
  msgid "API Url : "
225
  msgstr ""
226
 
227
+ #: includes/class-blossomthemes-email-newsletter-settings.php:519
228
  msgid ""
229
  "The APP ID does not seem to exist. Please enter a valid AWeber APP ID to "
230
  "connect to the mailing lists."
231
  msgstr ""
232
 
233
+ #: includes/class-blossomthemes-email-newsletter-settings.php:524
234
+ #: includes/class-blossomthemes-email-newsletter-settings.php:532
235
  msgid "AWeber Connection : "
236
  msgstr ""
237
 
238
+ #: includes/class-blossomthemes-email-newsletter-settings.php:608
239
+ msgid "Grab Lists"
240
+ msgstr ""
241
+
242
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:88
243
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:94
244
  msgid "Your Email"
274
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:382
275
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:405
276
  #: includes/class-blossomthemes-email-newsletter-shortcodes.php:427
277
+ #: includes/class-blossomthemes-email-newsletter-shortcodes.php:446
278
  msgid "Error in subscription."
279
  msgstr ""
280
 
341
  "as a default group."
342
  msgstr ""
343
 
344
+ #: includes/setting/form-list-meta.php:124
345
+ msgid "Lists not available to fetch from your sendinblue account."
346
+ msgstr ""
347
+
348
+ #: includes/setting/form-list-meta.php:130
349
  msgid ""
350
  "Please put your valid API key for the respective platform in %1$s "
351
  "BlossomThemes Email Newsletter > Settings > API Key %2$s if no groups/lists "
376
  msgid "Enable to display overlay on email newsletter background."
377
  msgstr ""
378
 
379
+ #: includes/setting/form-meta.php:55 includes/tabs/general.php:45
380
  msgid "Background Color: "
381
  msgstr ""
382
 
383
+ #: includes/setting/form-meta.php:61 includes/tabs/general.php:52
384
  msgid "Font Color: "
385
  msgstr ""
386
 
407
  msgstr ""
408
 
409
  #: includes/tabs/general.php:16
410
+ msgid "Sendinblue"
411
  msgstr ""
412
 
413
  #: includes/tabs/general.php:17
414
+ msgid "Mailchimp"
415
  msgstr ""
416
 
417
  #: includes/tabs/general.php:18
418
+ msgid "Mailerlite"
419
  msgstr ""
420
 
421
  #: includes/tabs/general.php:19
422
+ msgid "ConvertKit"
423
  msgstr ""
424
 
425
  #: includes/tabs/general.php:20
426
+ msgid "GetReponse"
427
  msgstr ""
428
 
429
  #: includes/tabs/general.php:21
430
+ msgid "ActiveCampaign"
431
+ msgstr ""
432
+
433
+ #: includes/tabs/general.php:22
434
  msgid "AWeber"
435
  msgstr ""
436
 
437
+ #: includes/tabs/general.php:58
438
  msgid "Display Successful Subscription Message From:"
439
  msgstr ""
440
 
441
+ #: includes/tabs/general.php:59
442
  msgid ""
443
  "Set how to show the confirmation message to the subscribers after "
444
  "successful subscription."
445
  msgstr ""
446
 
447
+ #: includes/tabs/general.php:66
448
  msgid "Popup text"
449
  msgstr ""
450
 
451
+ #: includes/tabs/general.php:69
452
  msgid "Success Message : "
453
  msgstr ""
454
 
455
+ #: includes/tabs/general.php:70
456
  msgid "Set what message to show when the subscriber is successfully subscribed."
457
  msgstr ""
458
 
459
+ #: includes/tabs/general.php:78
460
  msgid "GDPR Message : "
461
  msgstr ""
462
 
463
+ #: includes/tabs/general.php:79
464
  msgid "Set GDPR message to show on the subscription form."
465
  msgstr ""
466
 
467
+ #: includes/tabs/general.php:89
468
  msgid "Page"
469
  msgstr ""
470
 
471
+ #: includes/tabs/general.php:91
472
  msgid "Thank You Page : "
473
  msgstr ""
474
 
475
+ #: includes/tabs/general.php:92
476
  msgid "Set the page user will be redirected to after successful subscription."
477
  msgstr ""
478
 
479
+ #: includes/tabs/general.php:98
480
  msgid "Select page"
481
  msgstr ""
482