Version Description
Released on: 23rd October, 2020
Enhancements:
- Sendinblue_API_Client class renamed for resolving conflicts with Sendinblue.
Fixes:
- Minor bug fixes.
Download this release
Release Info
Developer | blossomthemes |
Plugin | BlossomThemes Email Newsletter |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.1.4
- README.txt +13 -1
- blossomthemes-email-newsletter.php +2 -2
- includes/class-blossomthemes-email-newsletter-functions.php +1 -1
- includes/class-blossomthemes-email-newsletter-sendinblue.php +4 -4
- includes/class-blossomthemes-email-newsletter-settings.php +1 -1
- includes/class-blossomthemes-email-newsletter.php +1 -1
- includes/libs/sendinblue/{SendinblueApiClient.php → Blossom_Sendinblue_API_Client.php} +2 -3
- includes/widgets/widget-blossomthemes-newsletter.php +374 -374
- languages/blossomthemes-email-newsletter.pot +2 -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.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -47,6 +47,18 @@ Once installed, the plugin page will appear on the Admin dashboard.
|
|
47 |
|
48 |
== Changelog ==
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
= 2.1.3 =
|
51 |
|
52 |
Released on: 28th September, 2020
|
5 |
Requires at least: 4.3
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.1.4
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 2.1.4 =
|
51 |
+
|
52 |
+
Released on: 23rd October, 2020
|
53 |
+
|
54 |
+
Enhancements:
|
55 |
+
|
56 |
+
* Sendinblue_API_Client class renamed for resolving conflicts with Sendinblue.
|
57 |
+
|
58 |
+
Fixes:
|
59 |
+
|
60 |
+
* Minor bug fixes.
|
61 |
+
|
62 |
= 2.1.3 =
|
63 |
|
64 |
Released on: 28th September, 2020
|
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.
|
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.
|
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.4
|
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.4' );
|
37 |
|
38 |
|
39 |
/**
|
includes/class-blossomthemes-email-newsletter-functions.php
CHANGED
@@ -318,7 +318,7 @@ class Blossomthemes_Email_Newsletter_Functions {
|
|
318 |
|
319 |
if ( ! empty( $api_key ) ) {
|
320 |
|
321 |
-
$mailin = new
|
322 |
$lists = array();
|
323 |
$list_data = $mailin->getAllLists();
|
324 |
|
318 |
|
319 |
if ( ! empty( $api_key ) ) {
|
320 |
|
321 |
+
$mailin = new Blossom_Sendinblue_API_Client();
|
322 |
$lists = array();
|
323 |
$list_data = $mailin->getAllLists();
|
324 |
|
includes/class-blossomthemes-email-newsletter-sendinblue.php
CHANGED
@@ -23,7 +23,7 @@ class Blossomthemes_Email_Newsletter_Sendinblue {
|
|
23 |
$lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
|
24 |
if ( false === $lists || false == $lists ) {
|
25 |
|
26 |
-
$mailin = new
|
27 |
$lists = array();
|
28 |
$list_data = $mailin->getAllLists();
|
29 |
|
@@ -82,7 +82,7 @@ class Blossomthemes_Email_Newsletter_Sendinblue {
|
|
82 |
* @return string
|
83 |
*/
|
84 |
public function create_subscriber( $type = 'simple', $email, $list_id, $info, $list_unlink = null ) {
|
85 |
-
$mailin = new
|
86 |
$user = $mailin->getUser($email);
|
87 |
|
88 |
$response = $this->validation_email( $user, $type, $email, $list_id );
|
@@ -125,7 +125,7 @@ class Blossomthemes_Email_Newsletter_Sendinblue {
|
|
125 |
'FNAME' => $info['name'],
|
126 |
);
|
127 |
|
128 |
-
if ($mailin->getLastResponseCode() ===
|
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");
|
@@ -254,7 +254,7 @@ class Blossomthemes_Email_Newsletter_Sendinblue {
|
|
254 |
$attrs = get_transient( 'sib_attributes_' . md5( $api_key ) );
|
255 |
|
256 |
if ( false === $attrs || false == $attrs ) {
|
257 |
-
$mailin = new
|
258 |
$response = $mailin->getAttributes();
|
259 |
$attributes = $response['attributes'];
|
260 |
$attrs = array(
|
23 |
$lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
|
24 |
if ( false === $lists || false == $lists ) {
|
25 |
|
26 |
+
$mailin = new Blossom_Sendinblue_API_Client();
|
27 |
$lists = array();
|
28 |
$list_data = $mailin->getAllLists();
|
29 |
|
82 |
* @return string
|
83 |
*/
|
84 |
public function create_subscriber( $type = 'simple', $email, $list_id, $info, $list_unlink = null ) {
|
85 |
+
$mailin = new Blossom_Sendinblue_API_Client();
|
86 |
$user = $mailin->getUser($email);
|
87 |
|
88 |
$response = $this->validation_email( $user, $type, $email, $list_id );
|
125 |
'FNAME' => $info['name'],
|
126 |
);
|
127 |
|
128 |
+
if ($mailin->getLastResponseCode() === Blossom_Sendinblue_API_Client::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");
|
254 |
$attrs = get_transient( 'sib_attributes_' . md5( $api_key ) );
|
255 |
|
256 |
if ( false === $attrs || false == $attrs ) {
|
257 |
+
$mailin = new Blossom_Sendinblue_API_Client();
|
258 |
$response = $mailin->getAttributes();
|
259 |
$attributes = $response['attributes'];
|
260 |
$attrs = array(
|
includes/class-blossomthemes-email-newsletter-settings.php
CHANGED
@@ -75,7 +75,7 @@ class BlossomThemes_Email_Newsletter_Settings {
|
|
75 |
$lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
|
76 |
if ( false === $lists || false == $lists ) {
|
77 |
|
78 |
-
$mailin = new
|
79 |
$lists = array();
|
80 |
$list_data = $mailin->getAllLists();
|
81 |
|
75 |
$lists = get_transient( 'bten_sib_list_' . md5( $api_key ) );
|
76 |
if ( false === $lists || false == $lists ) {
|
77 |
|
78 |
+
$mailin = new Blossom_Sendinblue_API_Client();
|
79 |
$lists = array();
|
80 |
$list_data = $mailin->getAllLists();
|
81 |
|
includes/class-blossomthemes-email-newsletter.php
CHANGED
@@ -177,7 +177,7 @@ class Blossomthemes_Email_Newsletter {
|
|
177 |
/**
|
178 |
* Get Sendinblue email newsletter controller.
|
179 |
*/
|
180 |
-
require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/sendinblue/
|
181 |
|
182 |
/**
|
183 |
* The class responsible for doing mailerlite actions.
|
177 |
/**
|
178 |
* Get Sendinblue email newsletter controller.
|
179 |
*/
|
180 |
+
require_once BLOSSOMTHEMES_EMAIL_NEWSLETTER_BASE_PATH . '/includes/libs/sendinblue/Blossom_Sendinblue_API_Client.php';
|
181 |
|
182 |
/**
|
183 |
* The class responsible for doing mailerlite actions.
|
includes/libs/sendinblue/{SendinblueApiClient.php → Blossom_Sendinblue_API_Client.php}
RENAMED
@@ -2,8 +2,7 @@
|
|
2 |
/**
|
3 |
* Send in blue API Client.
|
4 |
*/
|
5 |
-
class
|
6 |
-
{
|
7 |
const API_BASE_URL = 'https://api.sendinblue.com/v3';
|
8 |
const HTTP_METHOD_GET = 'GET';
|
9 |
const HTTP_METHOD_POST = 'POST';
|
@@ -19,7 +18,7 @@ class SendinblueApiClient
|
|
19 |
private $lastResponseCode;
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
*/
|
24 |
public function __construct()
|
25 |
{
|
2 |
/**
|
3 |
* Send in blue API Client.
|
4 |
*/
|
5 |
+
class Blossom_Sendinblue_API_Client {
|
|
|
6 |
const API_BASE_URL = 'https://api.sendinblue.com/v3';
|
7 |
const HTTP_METHOD_GET = 'GET';
|
8 |
const HTTP_METHOD_POST = 'POST';
|
18 |
private $lastResponseCode;
|
19 |
|
20 |
/**
|
21 |
+
* Blossom_Sendinblue_Api_Client constructor.
|
22 |
*/
|
23 |
public function __construct()
|
24 |
{
|
includes/widgets/widget-blossomthemes-newsletter.php
CHANGED
@@ -1,375 +1,375 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Widget Featured
|
4 |
-
*
|
5 |
-
* @package Rttk
|
6 |
-
*/
|
7 |
-
|
8 |
-
// register widget
|
9 |
-
function blossomthemes_email_newsletter_featured_widget() {
|
10 |
-
register_widget( 'BlossomThemes_Email_Newsletter_Widget' );
|
11 |
-
}
|
12 |
-
add_action( 'widgets_init', 'blossomthemes_email_newsletter_featured_widget' );
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Adds BlossomThemes_Email_Newsletter_Widget widget.
|
16 |
-
*/
|
17 |
-
class BlossomThemes_Email_Newsletter_Widget extends WP_Widget {
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Register widget with WordPress.
|
21 |
-
*/
|
22 |
-
function __construct() {
|
23 |
-
parent::__construct(
|
24 |
-
'blossomthemes_email_newsletter_widget', // Base ID
|
25 |
-
__( 'BlossomThemes: Email Newsletter Widget', 'blossomthemes-email-newsletter' ), // Name
|
26 |
-
array( 'description' => __( 'A Newsletter Widget to add Email Subscription Form to your website.', 'blossomthemes-email-newsletter' ), ) // Args
|
27 |
-
);
|
28 |
-
}
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Front-end display of widget.
|
32 |
-
*
|
33 |
-
* @see WP_Widget::widget()
|
34 |
-
*
|
35 |
-
* @param array $args Widget arguments.
|
36 |
-
* @param array $instance Saved values from database.
|
37 |
-
*/
|
38 |
-
public function widget( $args, $instance ) {
|
39 |
-
global $post;
|
40 |
-
$obj = new Blossomthemes_Email_Newsletter_Functions;
|
41 |
-
$title = !empty( $instance['title'] ) ? $instance['title'] :'';
|
42 |
-
$newsletter = !empty( $instance['newsletter'] ) ? $instance['newsletter'] : '' ;
|
43 |
-
$image = !empty( $instance['image'] ) ? $instance['image'] : '' ;
|
44 |
-
$gdpr = !empty( $instance['gdpr'] ) ? $instance['gdpr'] :'';
|
45 |
-
|
46 |
-
if( isset( $image ) && $image!='' )
|
47 |
-
{
|
48 |
-
$icon_img_size = apply_filters( 'bten_icon_header_img_size', 'full' );
|
49 |
-
}
|
50 |
-
|
51 |
-
echo $args['before_widget'];
|
52 |
-
ob_start();
|
53 |
-
if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
54 |
-
if( $newsletter == '' )
|
55 |
-
{
|
56 |
-
return;
|
57 |
-
}
|
58 |
-
|
59 |
-
$atts['id'] = absint($newsletter);
|
60 |
-
$blossomthemes_email_newsletter_setting = get_post_meta( $atts['id'], 'blossomthemes_email_newsletter_setting', true );
|
61 |
-
$settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
62 |
-
$rrsb_fc = '';
|
63 |
-
if( isset( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['fontcolor']!='' )
|
64 |
-
{
|
65 |
-
$rrsb_fc = ! empty( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
|
66 |
-
}
|
67 |
-
elseif( isset( $settings['appearance']['fontcolor'] ) && $settings['appearance']['fontcolor']!='' )
|
68 |
-
{
|
69 |
-
$rrsb_fc = ! empty( $settings['appearance']['fontcolor'] ) ? sanitize_text_field( $settings['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
|
70 |
-
}
|
71 |
-
$rrsb_sc = isset( $blossomthemes_email_newsletter_setting['appearance']['submitcolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submitcolor'] ): '';
|
72 |
-
$rrsb_shc = isset( $blossomthemes_email_newsletter_setting['appearance']['submithovercolor'] ) ? esc_attr($blossomthemes_email_newsletter_setting['appearance']['submithovercolor']) : '';
|
73 |
-
$rrsb_stc = isset( $blossomthemes_email_newsletter_setting['appearance']['submittextcolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submittextcolor'] ) : '';
|
74 |
-
$rrsb_sthc = isset( $blossomthemes_email_newsletter_setting['appearance']['submittexthovercolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submittexthovercolor'] ) : '';
|
75 |
-
$rrsb_bg = '';
|
76 |
-
$rrsb_option = ! empty( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) : 'bg-color';
|
77 |
-
if( $rrsb_option == 'image' )
|
78 |
-
{
|
79 |
-
$overlay = isset( $blossomthemes_email_newsletter_setting['appearance']['overlay'] ) && $blossomthemes_email_newsletter_setting['appearance']['overlay'] == '1' ? ' has-overlay' : ' no-overlay';
|
80 |
-
if( isset( $blossomthemes_email_newsletter_setting['appearance']['bg']) && $blossomthemes_email_newsletter_setting['appearance']['bg']!='' )
|
81 |
-
{
|
82 |
-
$attachment_id = $blossomthemes_email_newsletter_setting['appearance']['bg'];
|
83 |
-
$newsletter_bio_img_size = apply_filters('bt_newsletter_img_size','full');
|
84 |
-
$image_array = wp_get_attachment_image_src( $attachment_id, $newsletter_bio_img_size );
|
85 |
-
$rrsb_bg = 'url('.$image_array[0].') no-repeat';
|
86 |
-
}
|
87 |
-
}
|
88 |
-
else{
|
89 |
-
if( isset( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['bgcolor']!='' )
|
90 |
-
{
|
91 |
-
$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');
|
92 |
-
}
|
93 |
-
elseif( isset( $settings['appearance']['bgcolor'] ) && $settings['appearance']['bgcolor']!='' )
|
94 |
-
{
|
95 |
-
$rrsb_bg = ! empty( $settings['appearance']['bgcolor'] ) ? sanitize_text_field( $settings['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
|
96 |
-
}
|
97 |
-
}
|
98 |
-
// ob_start();
|
99 |
-
|
100 |
-
?>
|
101 |
-
<div class="blossomthemes-email-newsletter-wrapper<?php if(isset($blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option']) && $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-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_fc);?>;">
|
102 |
-
|
103 |
-
<?php $inner_wrap = apply_filters( 'bt_newsletter_widget_inner_wrap_display', false );
|
104 |
-
if ( $inner_wrap ) {
|
105 |
-
do_action( 'bt_newsletter_widget_inner_wrap_start' );
|
106 |
-
} ?>
|
107 |
-
|
108 |
-
<?php if( isset( $image ) && $image!='' ) { ?>
|
109 |
-
<div class="img-holder">
|
110 |
-
<?php echo wp_get_attachment_image( $image, $icon_img_size, false,
|
111 |
-
array( 'alt' => esc_attr( $title )));
|
112 |
-
?>
|
113 |
-
</div>
|
114 |
-
<?php } ?>
|
115 |
-
<div class="text-holder" >
|
116 |
-
<?php if( get_the_title( $atts['id'] ) ) { $title = get_the_title( $atts['id'] ); echo '<h3>'.esc_attr($title).'</h3>'; }?>
|
117 |
-
<?php
|
118 |
-
if( isset($blossomthemes_email_newsletter_setting['appearance']['note']) && $blossomthemes_email_newsletter_setting['appearance']['note']!='' )
|
119 |
-
{
|
120 |
-
$note = $blossomthemes_email_newsletter_setting['appearance']['note'];
|
121 |
-
echo '<span>'.esc_attr($note).'</span>';
|
122 |
-
}
|
123 |
-
?>
|
124 |
-
</div>
|
125 |
-
<form id="blossomthemes-email-newsletter-<?php echo esc_attr($atts['id']);?>" class="blossomthemes-email-newsletter-window-<?php echo esc_attr($atts['id']);?>">
|
126 |
-
<?php
|
127 |
-
$val = isset($blossomthemes_email_newsletter_setting['field']['select']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['select']):'email';
|
128 |
-
if( $val=='email' )
|
129 |
-
{
|
130 |
-
?>
|
131 |
-
<input type="text" name="subscribe-email" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']):'Your Email';?>">
|
132 |
-
<?php
|
133 |
-
}
|
134 |
-
else{ ?>
|
135 |
-
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']):'Your Name';?>">
|
136 |
-
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']):'Your Email';?>">
|
137 |
-
<?php
|
138 |
-
}
|
139 |
-
if(isset($gdpr) && $gdpr!='')
|
140 |
-
{
|
141 |
-
?>
|
142 |
-
<label for="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>">
|
143 |
-
<div class="subscribe-inner-wrap">
|
144 |
-
<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>
|
145 |
-
<span class="text">
|
146 |
-
<?php
|
147 |
-
$blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
148 |
-
$gdprmsg = isset($blossomthemes_email_newsletter_settings['gdpr-msg']) ? $blossomthemes_email_newsletter_settings['gdpr-msg']: 'By checking this, you agree to our Privacy Policy.';
|
149 |
-
echo wp_kses_post($gdprmsg);
|
150 |
-
?>
|
151 |
-
</span>
|
152 |
-
</div>
|
153 |
-
</label>
|
154 |
-
<?php
|
155 |
-
}
|
156 |
-
?>
|
157 |
-
<div id="loader-<?php echo esc_attr($atts['id']);?>" style="display: none">
|
158 |
-
<div class="table">
|
159 |
-
<div class="table-row">
|
160 |
-
<div class="table-cell">
|
161 |
-
<img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
|
162 |
-
</div>
|
163 |
-
</div>
|
164 |
-
</div>
|
165 |
-
</div>
|
166 |
-
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['submit_label']):'Subscribe';?>">
|
167 |
-
<?php wp_nonce_field( 'subscription_response', 'bten_subscription_nonce_'.esc_attr($atts['id']).'' ); ?>
|
168 |
-
</form>
|
169 |
-
<div class="bten-response" id="bten-response-<?php echo esc_attr($atts['id']);?>"><span></span></div>
|
170 |
-
<div id="mask-<?php echo esc_attr($atts['id']);?>"></div>
|
171 |
-
|
172 |
-
<?php $inner_wrap = apply_filters( 'bt_newsletter_widget_inner_wrap_display', false );
|
173 |
-
if ( $inner_wrap ) {
|
174 |
-
do_action( 'bt_newsletter_widget_inner_wrap_close' );
|
175 |
-
} ?>
|
176 |
-
</div>
|
177 |
-
<?php
|
178 |
-
|
179 |
-
global $post;
|
180 |
-
$bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
181 |
-
$style = '<style>
|
182 |
-
#mask-'.esc_attr($atts['id']).' {
|
183 |
-
position: fixed;
|
184 |
-
width: 100%;
|
185 |
-
height: 100%;
|
186 |
-
left: 0;
|
187 |
-
top: 0;
|
188 |
-
z-index: 9000;
|
189 |
-
background-color: #000;
|
190 |
-
display: none;
|
191 |
-
}
|
192 |
-
|
193 |
-
#boxes-'.esc_attr($atts['id']).' #dialog {
|
194 |
-
width: 750px;
|
195 |
-
height: 300px;
|
196 |
-
padding: 10px;
|
197 |
-
background-color: #ffffff;
|
198 |
-
font-family: "Segoe UI Light", sans-serif;
|
199 |
-
font-size: 15pt;
|
200 |
-
}
|
201 |
-
|
202 |
-
#blossomthemes-email-newsletter-'.esc_attr($atts['id']).' input.subscribe-submit-'.esc_attr($atts['id']).'{
|
203 |
-
color: '.$rrsb_stc.';
|
204 |
-
background: '.$rrsb_sc.';
|
205 |
-
}
|
206 |
-
|
207 |
-
#blossomthemes-email-newsletter-'.esc_attr($atts['id']).' input.subscribe-submit-'.esc_attr($atts['id']).':hover{
|
208 |
-
color: '.$rrsb_sthc.';
|
209 |
-
background: '.$rrsb_shc.';
|
210 |
-
}
|
211 |
-
#loader-'.esc_attr($atts['id']).' {
|
212 |
-
position: absolute;
|
213 |
-
top: 27%;
|
214 |
-
left: 0;
|
215 |
-
width: 100%;
|
216 |
-
height: 80%;
|
217 |
-
text-align: center;
|
218 |
-
font-size: 50px;
|
219 |
-
}
|
220 |
-
|
221 |
-
#loader-'.esc_attr($atts['id']).' .table{
|
222 |
-
display: table;
|
223 |
-
width: 100%;
|
224 |
-
height: 100%;
|
225 |
-
}
|
226 |
-
|
227 |
-
#loader-'.esc_attr($atts['id']).' .table-row{
|
228 |
-
display: table-row;
|
229 |
-
}
|
230 |
-
|
231 |
-
#loader-'.esc_attr($atts['id']).' .table-cell{
|
232 |
-
display: table-cell;
|
233 |
-
vertical-align: middle;
|
234 |
-
}
|
235 |
-
</style>';
|
236 |
-
echo $obj->bten_minify_css($style);
|
237 |
-
// echo $style;
|
238 |
-
|
239 |
-
$ajax =
|
240 |
-
'<script>
|
241 |
-
jQuery(document).ready(function() {
|
242 |
-
jQuery(document).on("submit","form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'", function(e){
|
243 |
-
e.preventDefault();
|
244 |
-
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );
|
245 |
-
var email = jQuery(".subscribe-email-'.esc_attr($atts['id']).'").val();
|
246 |
-
var fname = jQuery(".subscribe-fname-'.esc_attr($atts['id']).'").val();
|
247 |
-
var sid = '.esc_attr($atts['id']).';
|
248 |
-
var nonce = jQuery("#bten_subscription_nonce_'.esc_attr($atts['id']).'").val();
|
249 |
-
jQuery.ajax({
|
250 |
-
type : "post",
|
251 |
-
dataType : "json",
|
252 |
-
url : bten_ajax_data.ajaxurl,
|
253 |
-
data : {action: "subscription_response", email : email, fname : fname, sid : sid, nonce : nonce},
|
254 |
-
beforeSend: function(){
|
255 |
-
jQuery("#loader-'.esc_attr($atts['id']).'").fadeIn(500);
|
256 |
-
},
|
257 |
-
success: function(response){
|
258 |
-
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );';
|
259 |
-
$bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
260 |
-
$option = isset($bten_settings['thankyou-option']) ? esc_attr($bten_settings['thankyou-option']):'text';
|
261 |
-
$ajax .='if(response.type === "success") {';
|
262 |
-
if($option == 'text')
|
263 |
-
{
|
264 |
-
$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(){
|
265 |
-
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
|
266 |
-
jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
|
267 |
-
});';
|
268 |
-
}
|
269 |
-
else{
|
270 |
-
$selected_page = isset($bten_settings['page'])?esc_attr($bten_settings['page']):'';
|
271 |
-
$url = get_permalink($selected_page);
|
272 |
-
$ajax.= 'window.location.href = "'.esc_url($url).'"';
|
273 |
-
}
|
274 |
-
|
275 |
-
$ajax.='}
|
276 |
-
else{
|
277 |
-
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(){
|
278 |
-
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
|
279 |
-
jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
|
280 |
-
});
|
281 |
-
}
|
282 |
-
},
|
283 |
-
complete: function(){
|
284 |
-
jQuery("#loader-'.esc_attr($atts['id']).'").fadeOut(500);
|
285 |
-
}
|
286 |
-
});
|
287 |
-
});
|
288 |
-
});
|
289 |
-
</script>';
|
290 |
-
echo $obj->bten_minify_js($ajax);
|
291 |
-
$html = ob_get_clean();
|
292 |
-
echo apply_filters( 'widget_blossomthemes_newsletter', $html, $args, $title, $image );
|
293 |
-
echo $args['after_widget'];
|
294 |
-
}
|
295 |
-
|
296 |
-
/**
|
297 |
-
* Back-end widget form.
|
298 |
-
*
|
299 |
-
* @see WP_Widget::form()
|
300 |
-
*
|
301 |
-
* @param array $instance Previously saved values from database.
|
302 |
-
*/
|
303 |
-
public function form( $instance ) {
|
304 |
-
|
305 |
-
$obj = new Blossomthemes_Email_Newsletter_Functions;
|
306 |
-
$title = !empty( $instance['title'] ) ? $instance['title'] : '';
|
307 |
-
$gdpr = !empty( $instance['gdpr'] ) ? $instance['gdpr'] : '';
|
308 |
-
$newsletter = !empty( $instance['newsletter'] ) ? $instance['newsletter'] : '' ;
|
309 |
-
$image = !empty( $instance['image'] ) ? $instance['image'] : '' ;
|
310 |
-
$postlist[0] = array(
|
311 |
-
'value' => 0,
|
312 |
-
'label' => __('--Choose--', 'blossomthemes-email-newsletter'),
|
313 |
-
);
|
314 |
-
$arg = array( 'posts_per_page' => -1, 'post_type' => array( 'subscribe-form' ) );
|
315 |
-
$posts = get_posts($arg);
|
316 |
-
|
317 |
-
foreach( $posts as $p ){
|
318 |
-
$postlist[$p->ID] = array(
|
319 |
-
'value' => $p->ID,
|
320 |
-
'label' => $p->post_title
|
321 |
-
);
|
322 |
-
}
|
323 |
-
?>
|
324 |
-
<p>
|
325 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'blossomthemes-email-newsletter' ); ?></label>
|
326 |
-
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
327 |
-
</p>
|
328 |
-
|
329 |
-
<p>
|
330 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'newsletter' ) ); ?>"><?php esc_html_e( 'Newsletter', 'blossomthemes-email-newsletter' ); ?></label>
|
331 |
-
<select name="<?php echo esc_attr( $this->get_field_name( 'newsletter' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'newsletter' ) ); ?>" class="widefat">
|
332 |
-
<?php
|
333 |
-
foreach ( $postlist as $single_post ) { ?>
|
334 |
-
<option value="<?php echo $single_post['value']; ?>" id="<?php echo esc_attr( $this->get_field_id( $single_post['label'] ) ); ?>" <?php selected( $single_post['value'], $newsletter ); ?>><?php echo $single_post['label']; ?></option>
|
335 |
-
<?php } ?>
|
336 |
-
</select>
|
337 |
-
<span id="footer-thankyou">
|
338 |
-
<?php
|
339 |
-
$bold = '<b>';
|
340 |
-
$boldclose = '</b>'; echo sprintf( __( 'To create a new newsletter form, go to %1$sBlossomThemes Email Newsletters > Add New%2$s','blossomthemes-email-newsletter'),$bold, $boldclose);?>
|
341 |
-
</span>
|
342 |
-
</p>
|
343 |
-
<p>
|
344 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'gdpr' ) ); ?>"><?php esc_html_e( 'Enable GDPR', 'blossomthemes-email-newsletter' ); ?></label>
|
345 |
-
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'gdpr' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gdpr' ) ); ?>" type="checkbox" value="1" <?php echo checked($gdpr,1);?> />
|
346 |
-
</p>
|
347 |
-
<?php
|
348 |
-
|
349 |
-
$obj->blossomthemes_email_newsletter_companion_get_image_field($this->get_field_id( 'image' ), $this->get_field_name( 'image' ), $image, __( 'Upload Newsletter Icon', 'blossomthemes-email-newsletter' ));
|
350 |
-
|
351 |
-
}
|
352 |
-
|
353 |
-
/**
|
354 |
-
* Sanitize widget form values as they are saved.
|
355 |
-
*
|
356 |
-
* @see WP_Widget::update()
|
357 |
-
*
|
358 |
-
* @param array $new_instance Values just sent to be saved.
|
359 |
-
* @param array $old_instance Previously saved values from database.
|
360 |
-
*
|
361 |
-
* @return array Updated safe values to be saved.
|
362 |
-
*/
|
363 |
-
public function update( $new_instance, $old_instance ) {
|
364 |
-
$instance = array();
|
365 |
-
|
366 |
-
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '';
|
367 |
-
$instance['newsletter'] = ! empty( $new_instance['newsletter'] ) ? absint( $new_instance['newsletter'] ) : 1;
|
368 |
-
$instance['image'] = ! empty( $new_instance['image'] ) ? absint( $new_instance['image'] ) : '';
|
369 |
-
$instance['gdpr'] = !empty( $new_instance['gdpr'] ) ? $new_instance['gdpr'] : '';
|
370 |
-
|
371 |
-
|
372 |
-
return $instance;
|
373 |
-
}
|
374 |
-
|
375 |
} // class BlossomThemes_Email_Newsletter_Widget
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widget Featured
|
4 |
+
*
|
5 |
+
* @package Rttk
|
6 |
+
*/
|
7 |
+
|
8 |
+
// register widget
|
9 |
+
function blossomthemes_email_newsletter_featured_widget() {
|
10 |
+
register_widget( 'BlossomThemes_Email_Newsletter_Widget' );
|
11 |
+
}
|
12 |
+
add_action( 'widgets_init', 'blossomthemes_email_newsletter_featured_widget' );
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Adds BlossomThemes_Email_Newsletter_Widget widget.
|
16 |
+
*/
|
17 |
+
class BlossomThemes_Email_Newsletter_Widget extends WP_Widget {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Register widget with WordPress.
|
21 |
+
*/
|
22 |
+
function __construct() {
|
23 |
+
parent::__construct(
|
24 |
+
'blossomthemes_email_newsletter_widget', // Base ID
|
25 |
+
__( 'BlossomThemes: Email Newsletter Widget', 'blossomthemes-email-newsletter' ), // Name
|
26 |
+
array( 'description' => __( 'A Newsletter Widget to add Email Subscription Form to your website.', 'blossomthemes-email-newsletter' ), ) // Args
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Front-end display of widget.
|
32 |
+
*
|
33 |
+
* @see WP_Widget::widget()
|
34 |
+
*
|
35 |
+
* @param array $args Widget arguments.
|
36 |
+
* @param array $instance Saved values from database.
|
37 |
+
*/
|
38 |
+
public function widget( $args, $instance ) {
|
39 |
+
global $post;
|
40 |
+
$obj = new Blossomthemes_Email_Newsletter_Functions;
|
41 |
+
$title = !empty( $instance['title'] ) ? $instance['title'] :'';
|
42 |
+
$newsletter = !empty( $instance['newsletter'] ) ? $instance['newsletter'] : '' ;
|
43 |
+
$image = !empty( $instance['image'] ) ? $instance['image'] : '' ;
|
44 |
+
$gdpr = !empty( $instance['gdpr'] ) ? $instance['gdpr'] :'';
|
45 |
+
|
46 |
+
if( isset( $image ) && $image!='' )
|
47 |
+
{
|
48 |
+
$icon_img_size = apply_filters( 'bten_icon_header_img_size', 'full' );
|
49 |
+
}
|
50 |
+
|
51 |
+
echo $args['before_widget'];
|
52 |
+
ob_start();
|
53 |
+
if( $title ) echo $args['before_title'] . apply_filters( 'widget_title', $title, $instance, $this->id_base ) . $args['after_title'];
|
54 |
+
if( $newsletter == '' )
|
55 |
+
{
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$atts['id'] = absint($newsletter);
|
60 |
+
$blossomthemes_email_newsletter_setting = get_post_meta( $atts['id'], 'blossomthemes_email_newsletter_setting', true );
|
61 |
+
$settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
62 |
+
$rrsb_fc = '';
|
63 |
+
if( isset( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['fontcolor']!='' )
|
64 |
+
{
|
65 |
+
$rrsb_fc = ! empty( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
|
66 |
+
}
|
67 |
+
elseif( isset( $settings['appearance']['fontcolor'] ) && $settings['appearance']['fontcolor']!='' )
|
68 |
+
{
|
69 |
+
$rrsb_fc = ! empty( $settings['appearance']['fontcolor'] ) ? sanitize_text_field( $settings['appearance']['fontcolor'] ) : apply_filters('bt_newsletter_font_color_setting','#ffffff');
|
70 |
+
}
|
71 |
+
$rrsb_sc = isset( $blossomthemes_email_newsletter_setting['appearance']['submitcolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submitcolor'] ): '';
|
72 |
+
$rrsb_shc = isset( $blossomthemes_email_newsletter_setting['appearance']['submithovercolor'] ) ? esc_attr($blossomthemes_email_newsletter_setting['appearance']['submithovercolor']) : '';
|
73 |
+
$rrsb_stc = isset( $blossomthemes_email_newsletter_setting['appearance']['submittextcolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submittextcolor'] ) : '';
|
74 |
+
$rrsb_sthc = isset( $blossomthemes_email_newsletter_setting['appearance']['submittexthovercolor'] ) ? esc_attr( $blossomthemes_email_newsletter_setting['appearance']['submittexthovercolor'] ) : '';
|
75 |
+
$rrsb_bg = '';
|
76 |
+
$rrsb_option = ! empty( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) ? sanitize_text_field( $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option'] ) : 'bg-color';
|
77 |
+
if( $rrsb_option == 'image' )
|
78 |
+
{
|
79 |
+
$overlay = isset( $blossomthemes_email_newsletter_setting['appearance']['overlay'] ) && $blossomthemes_email_newsletter_setting['appearance']['overlay'] == '1' ? ' has-overlay' : ' no-overlay';
|
80 |
+
if( isset( $blossomthemes_email_newsletter_setting['appearance']['bg']) && $blossomthemes_email_newsletter_setting['appearance']['bg']!='' )
|
81 |
+
{
|
82 |
+
$attachment_id = $blossomthemes_email_newsletter_setting['appearance']['bg'];
|
83 |
+
$newsletter_bio_img_size = apply_filters('bt_newsletter_img_size','full');
|
84 |
+
$image_array = wp_get_attachment_image_src( $attachment_id, $newsletter_bio_img_size );
|
85 |
+
$rrsb_bg = 'url('.$image_array[0].') no-repeat';
|
86 |
+
}
|
87 |
+
}
|
88 |
+
else{
|
89 |
+
if( isset( $blossomthemes_email_newsletter_setting['appearance']['bgcolor'] ) && $blossomthemes_email_newsletter_setting['appearance']['bgcolor']!='' )
|
90 |
+
{
|
91 |
+
$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');
|
92 |
+
}
|
93 |
+
elseif( isset( $settings['appearance']['bgcolor'] ) && $settings['appearance']['bgcolor']!='' )
|
94 |
+
{
|
95 |
+
$rrsb_bg = ! empty( $settings['appearance']['bgcolor'] ) ? sanitize_text_field( $settings['appearance']['bgcolor'] ) : apply_filters('bt_newsletter_bg_color','#ffffff');
|
96 |
+
}
|
97 |
+
}
|
98 |
+
// ob_start();
|
99 |
+
|
100 |
+
?>
|
101 |
+
<div class="blossomthemes-email-newsletter-wrapper<?php if(isset($blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-option']) && $blossomthemes_email_newsletter_setting['appearance']['newsletter-bg-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_fc);?>;">
|
102 |
+
|
103 |
+
<?php $inner_wrap = apply_filters( 'bt_newsletter_widget_inner_wrap_display', false );
|
104 |
+
if ( $inner_wrap ) {
|
105 |
+
do_action( 'bt_newsletter_widget_inner_wrap_start' );
|
106 |
+
} ?>
|
107 |
+
|
108 |
+
<?php if( isset( $image ) && $image!='' ) { ?>
|
109 |
+
<div class="img-holder">
|
110 |
+
<?php echo wp_get_attachment_image( $image, $icon_img_size, false,
|
111 |
+
array( 'alt' => esc_attr( $title )));
|
112 |
+
?>
|
113 |
+
</div>
|
114 |
+
<?php } ?>
|
115 |
+
<div class="text-holder" >
|
116 |
+
<?php if( get_the_title( $atts['id'] ) ) { $title = get_the_title( $atts['id'] ); echo '<h3>'.esc_attr($title).'</h3>'; }?>
|
117 |
+
<?php
|
118 |
+
if( isset($blossomthemes_email_newsletter_setting['appearance']['note']) && $blossomthemes_email_newsletter_setting['appearance']['note']!='' )
|
119 |
+
{
|
120 |
+
$note = $blossomthemes_email_newsletter_setting['appearance']['note'];
|
121 |
+
echo '<span>'.esc_attr($note).'</span>';
|
122 |
+
}
|
123 |
+
?>
|
124 |
+
</div>
|
125 |
+
<form id="blossomthemes-email-newsletter-<?php echo esc_attr($atts['id']);?>" class="blossomthemes-email-newsletter-window-<?php echo esc_attr($atts['id']);?>">
|
126 |
+
<?php
|
127 |
+
$val = isset($blossomthemes_email_newsletter_setting['field']['select']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['select']):'email';
|
128 |
+
if( $val=='email' )
|
129 |
+
{
|
130 |
+
?>
|
131 |
+
<input type="text" name="subscribe-email" class="subscribe-email-<?php echo esc_attr($atts['id']);?>" value="" placeholder="<?php echo isset($blossomthemes_email_newsletter_setting['field']['email_placeholder']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']):'Your Email';?>">
|
132 |
+
<?php
|
133 |
+
}
|
134 |
+
else{ ?>
|
135 |
+
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['first_name_placeholder']):'Your Name';?>">
|
136 |
+
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['email_placeholder']):'Your Email';?>">
|
137 |
+
<?php
|
138 |
+
}
|
139 |
+
if(isset($gdpr) && $gdpr!='')
|
140 |
+
{
|
141 |
+
?>
|
142 |
+
<label for="subscribe-confirmation-<?php echo esc_attr($atts['id']);?>">
|
143 |
+
<div class="subscribe-inner-wrap">
|
144 |
+
<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>
|
145 |
+
<span class="text">
|
146 |
+
<?php
|
147 |
+
$blossomthemes_email_newsletter_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
148 |
+
$gdprmsg = isset($blossomthemes_email_newsletter_settings['gdpr-msg']) ? $blossomthemes_email_newsletter_settings['gdpr-msg']: 'By checking this, you agree to our Privacy Policy.';
|
149 |
+
echo wp_kses_post($gdprmsg);
|
150 |
+
?>
|
151 |
+
</span>
|
152 |
+
</div>
|
153 |
+
</label>
|
154 |
+
<?php
|
155 |
+
}
|
156 |
+
?>
|
157 |
+
<div id="loader-<?php echo esc_attr($atts['id']);?>" style="display: none">
|
158 |
+
<div class="table">
|
159 |
+
<div class="table-row">
|
160 |
+
<div class="table-cell">
|
161 |
+
<img src="<?php echo BLOSSOMTHEMES_EMAIL_NEWSLETTER_FILE_URL.'/public/css/loader.gif';?>">
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
</div>
|
165 |
+
</div>
|
166 |
+
<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']) ? esc_attr($blossomthemes_email_newsletter_setting['field']['submit_label']):'Subscribe';?>">
|
167 |
+
<?php wp_nonce_field( 'subscription_response', 'bten_subscription_nonce_'.esc_attr($atts['id']).'' ); ?>
|
168 |
+
</form>
|
169 |
+
<div class="bten-response" id="bten-response-<?php echo esc_attr($atts['id']);?>"><span></span></div>
|
170 |
+
<div id="mask-<?php echo esc_attr($atts['id']);?>"></div>
|
171 |
+
|
172 |
+
<?php $inner_wrap = apply_filters( 'bt_newsletter_widget_inner_wrap_display', false );
|
173 |
+
if ( $inner_wrap ) {
|
174 |
+
do_action( 'bt_newsletter_widget_inner_wrap_close' );
|
175 |
+
} ?>
|
176 |
+
</div>
|
177 |
+
<?php
|
178 |
+
|
179 |
+
global $post;
|
180 |
+
$bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
181 |
+
$style = '<style>
|
182 |
+
#mask-'.esc_attr($atts['id']).' {
|
183 |
+
position: fixed;
|
184 |
+
width: 100%;
|
185 |
+
height: 100%;
|
186 |
+
left: 0;
|
187 |
+
top: 0;
|
188 |
+
z-index: 9000;
|
189 |
+
background-color: #000;
|
190 |
+
display: none;
|
191 |
+
}
|
192 |
+
|
193 |
+
#boxes-'.esc_attr($atts['id']).' #dialog {
|
194 |
+
width: 750px;
|
195 |
+
height: 300px;
|
196 |
+
padding: 10px;
|
197 |
+
background-color: #ffffff;
|
198 |
+
font-family: "Segoe UI Light", sans-serif;
|
199 |
+
font-size: 15pt;
|
200 |
+
}
|
201 |
+
|
202 |
+
#blossomthemes-email-newsletter-'.esc_attr($atts['id']).' input.subscribe-submit-'.esc_attr($atts['id']).'{
|
203 |
+
color: '.$rrsb_stc.';
|
204 |
+
background: '.$rrsb_sc.';
|
205 |
+
}
|
206 |
+
|
207 |
+
#blossomthemes-email-newsletter-'.esc_attr($atts['id']).' input.subscribe-submit-'.esc_attr($atts['id']).':hover{
|
208 |
+
color: '.$rrsb_sthc.';
|
209 |
+
background: '.$rrsb_shc.';
|
210 |
+
}
|
211 |
+
#loader-'.esc_attr($atts['id']).' {
|
212 |
+
position: absolute;
|
213 |
+
top: 27%;
|
214 |
+
left: 0;
|
215 |
+
width: 100%;
|
216 |
+
height: 80%;
|
217 |
+
text-align: center;
|
218 |
+
font-size: 50px;
|
219 |
+
}
|
220 |
+
|
221 |
+
#loader-'.esc_attr($atts['id']).' .table{
|
222 |
+
display: table;
|
223 |
+
width: 100%;
|
224 |
+
height: 100%;
|
225 |
+
}
|
226 |
+
|
227 |
+
#loader-'.esc_attr($atts['id']).' .table-row{
|
228 |
+
display: table-row;
|
229 |
+
}
|
230 |
+
|
231 |
+
#loader-'.esc_attr($atts['id']).' .table-cell{
|
232 |
+
display: table-cell;
|
233 |
+
vertical-align: middle;
|
234 |
+
}
|
235 |
+
</style>';
|
236 |
+
echo $obj->bten_minify_css($style);
|
237 |
+
// echo $style;
|
238 |
+
|
239 |
+
$ajax =
|
240 |
+
'<script>
|
241 |
+
jQuery(document).ready(function() {
|
242 |
+
jQuery(document).on("submit","form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'", function(e){
|
243 |
+
e.preventDefault();
|
244 |
+
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );
|
245 |
+
var email = jQuery(".subscribe-email-'.esc_attr($atts['id']).'").val();
|
246 |
+
var fname = jQuery(".subscribe-fname-'.esc_attr($atts['id']).'").val();
|
247 |
+
var sid = '.esc_attr($atts['id']).';
|
248 |
+
var nonce = jQuery("#bten_subscription_nonce_'.esc_attr($atts['id']).'").val();
|
249 |
+
jQuery.ajax({
|
250 |
+
type : "post",
|
251 |
+
dataType : "json",
|
252 |
+
url : bten_ajax_data.ajaxurl,
|
253 |
+
data : {action: "subscription_response", email : email, fname : fname, sid : sid, nonce : nonce},
|
254 |
+
beforeSend: function(){
|
255 |
+
jQuery("#loader-'.esc_attr($atts['id']).'").fadeIn(500);
|
256 |
+
},
|
257 |
+
success: function(response){
|
258 |
+
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").attr("disabled", "disabled" );';
|
259 |
+
$bten_settings = get_option( 'blossomthemes_email_newsletter_settings', true );
|
260 |
+
$option = isset($bten_settings['thankyou-option']) ? esc_attr($bten_settings['thankyou-option']):'text';
|
261 |
+
$ajax .='if(response.type === "success") {';
|
262 |
+
if($option == 'text')
|
263 |
+
{
|
264 |
+
$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(){
|
265 |
+
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
|
266 |
+
jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
|
267 |
+
});';
|
268 |
+
}
|
269 |
+
else{
|
270 |
+
$selected_page = isset($bten_settings['page'])?esc_attr($bten_settings['page']):'';
|
271 |
+
$url = get_permalink($selected_page);
|
272 |
+
$ajax.= 'window.location.href = "'.esc_url($url).'"';
|
273 |
+
}
|
274 |
+
|
275 |
+
$ajax.='}
|
276 |
+
else{
|
277 |
+
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(){
|
278 |
+
jQuery(".subscribe-submit-'.esc_attr($atts['id']).'").removeAttr("disabled", "disabled" );
|
279 |
+
jQuery("form#blossomthemes-email-newsletter-'.esc_attr($atts['id']).'").find("input[type=text]").val("");
|
280 |
+
});
|
281 |
+
}
|
282 |
+
},
|
283 |
+
complete: function(){
|
284 |
+
jQuery("#loader-'.esc_attr($atts['id']).'").fadeOut(500);
|
285 |
+
}
|
286 |
+
});
|
287 |
+
});
|
288 |
+
});
|
289 |
+
</script>';
|
290 |
+
echo $obj->bten_minify_js($ajax);
|
291 |
+
$html = ob_get_clean();
|
292 |
+
echo apply_filters( 'widget_blossomthemes_newsletter', $html, $args, $title, $image );
|
293 |
+
echo $args['after_widget'];
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Back-end widget form.
|
298 |
+
*
|
299 |
+
* @see WP_Widget::form()
|
300 |
+
*
|
301 |
+
* @param array $instance Previously saved values from database.
|
302 |
+
*/
|
303 |
+
public function form( $instance ) {
|
304 |
+
|
305 |
+
$obj = new Blossomthemes_Email_Newsletter_Functions;
|
306 |
+
$title = !empty( $instance['title'] ) ? $instance['title'] : '';
|
307 |
+
$gdpr = !empty( $instance['gdpr'] ) ? $instance['gdpr'] : '';
|
308 |
+
$newsletter = !empty( $instance['newsletter'] ) ? $instance['newsletter'] : '' ;
|
309 |
+
$image = !empty( $instance['image'] ) ? $instance['image'] : '' ;
|
310 |
+
$postlist[0] = array(
|
311 |
+
'value' => 0,
|
312 |
+
'label' => __('--Choose--', 'blossomthemes-email-newsletter'),
|
313 |
+
);
|
314 |
+
$arg = array( 'posts_per_page' => -1, 'post_type' => array( 'subscribe-form' ) );
|
315 |
+
$posts = get_posts($arg);
|
316 |
+
|
317 |
+
foreach( $posts as $p ){
|
318 |
+
$postlist[$p->ID] = array(
|
319 |
+
'value' => $p->ID,
|
320 |
+
'label' => $p->post_title
|
321 |
+
);
|
322 |
+
}
|
323 |
+
?>
|
324 |
+
<p>
|
325 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'blossomthemes-email-newsletter' ); ?></label>
|
326 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
327 |
+
</p>
|
328 |
+
|
329 |
+
<p>
|
330 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'newsletter' ) ); ?>"><?php esc_html_e( 'Newsletter', 'blossomthemes-email-newsletter' ); ?></label>
|
331 |
+
<select name="<?php echo esc_attr( $this->get_field_name( 'newsletter' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'newsletter' ) ); ?>" class="widefat">
|
332 |
+
<?php
|
333 |
+
foreach ( $postlist as $single_post ) { ?>
|
334 |
+
<option value="<?php echo $single_post['value']; ?>" id="<?php echo esc_attr( $this->get_field_id( $single_post['label'] ) ); ?>" <?php selected( $single_post['value'], $newsletter ); ?>><?php echo $single_post['label']; ?></option>
|
335 |
+
<?php } ?>
|
336 |
+
</select>
|
337 |
+
<span id="footer-thankyou">
|
338 |
+
<?php
|
339 |
+
$bold = '<b>';
|
340 |
+
$boldclose = '</b>'; echo sprintf( __( 'To create a new newsletter form, go to %1$sBlossomThemes Email Newsletters > Add New%2$s','blossomthemes-email-newsletter'),$bold, $boldclose);?>
|
341 |
+
</span>
|
342 |
+
</p>
|
343 |
+
<p>
|
344 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'gdpr' ) ); ?>"><?php esc_html_e( 'Enable GDPR', 'blossomthemes-email-newsletter' ); ?></label>
|
345 |
+
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'gdpr' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'gdpr' ) ); ?>" type="checkbox" value="1" <?php echo checked($gdpr,1);?> />
|
346 |
+
</p>
|
347 |
+
<?php
|
348 |
+
|
349 |
+
$obj->blossomthemes_email_newsletter_companion_get_image_field($this->get_field_id( 'image' ), $this->get_field_name( 'image' ), $image, __( 'Upload Newsletter Icon', 'blossomthemes-email-newsletter' ));
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Sanitize widget form values as they are saved.
|
355 |
+
*
|
356 |
+
* @see WP_Widget::update()
|
357 |
+
*
|
358 |
+
* @param array $new_instance Values just sent to be saved.
|
359 |
+
* @param array $old_instance Previously saved values from database.
|
360 |
+
*
|
361 |
+
* @return array Updated safe values to be saved.
|
362 |
+
*/
|
363 |
+
public function update( $new_instance, $old_instance ) {
|
364 |
+
$instance = array();
|
365 |
+
|
366 |
+
$instance['title'] = ! empty( $new_instance['title'] ) ? sanitize_text_field( $new_instance['title'] ) : '';
|
367 |
+
$instance['newsletter'] = ! empty( $new_instance['newsletter'] ) ? absint( $new_instance['newsletter'] ) : 1;
|
368 |
+
$instance['image'] = ! empty( $new_instance['image'] ) ? absint( $new_instance['image'] ) : '';
|
369 |
+
$instance['gdpr'] = !empty( $new_instance['gdpr'] ) ? $new_instance['gdpr'] : '';
|
370 |
+
|
371 |
+
|
372 |
+
return $instance;
|
373 |
+
}
|
374 |
+
|
375 |
} // class BlossomThemes_Email_Newsletter_Widget
|
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.
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
-
"POT-Creation-Date: 2020-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
2 |
# This file is distributed under the GPL-2.0+.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: BlossomThemes Email Newsletter 2.1.4\n"
|
6 |
"Report-Msgid-Bugs-To: \n"
|
7 |
+
"POT-Creation-Date: 2020-10-23 08:14:55+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|