PluginProbe ʕ •ᴥ•ʔ
Newsletter Subscription Form – User Subscriptions Form, Capture Email / 1.5.8
Newsletter Subscription Form – User Subscriptions Form, Capture Email v1.5.8
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8
newsletter-subscription-form / newsletter-subscription-form.php
newsletter-subscription-form Last commit date
languages 2 weeks ago options 2 weeks ago newsletter-subscription-form.php 2 weeks ago readme.txt 2 weeks ago
newsletter-subscription-form.php
167 lines
1 <?php
2 /*
3 * Plugin Name: Newsletter Subscription Form
4 * Description: Newsletter Subscription Form for WordPress is the ultimate lead generation, customer acquisition and email marketing plugin to grow and engage your mailing list and visitors.
5 * Version: 1.5.8
6 * Author: Weblizar
7 * Text Domain: newsletter-subscription-form
8 * Domain Path: /options/languages
9 * Author URI: https://weblizar.com/
10 * Plugin URI: https://weblizar.com/plugins/newsletter-subscription-form/
11 * License: GPL-2.0+
12 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
13 * Copyright 2016-25 Weblizar (email : lizarweb@gmail.com, twitter : @weblizar)
14 */
15
16 /**
17 * Default Constants
18 */
19
20 define('NLS_TEXT_DOMAIN', 'newsletter-subscription-form'); // Your textdomain
21 define('NLS_PLUGIN_NAME', esc_html__('Newsletter Subscription Form', 'NLS_TEXT_DOMAIN')); // Plugin Name shows up on the admin settings screen.
22
23 define("WEBLIZAR_NLS_PLUGIN_URL", plugin_dir_url(__FILE__));
24
25 // echo dirname(__FILE__) . '/options/option-panel.php';
26
27 if (file_exists(dirname(__FILE__) . '/options/option-panel.php')) {
28 include 'options/option-panel.php';
29 }
30 if (file_exists(dirname(__FILE__) . '/options/default-options.php')) {
31 include 'options/default-options.php';
32 }
33
34 add_action('plugins_loaded', 'NLS_Language_Translater');
35 function NLS_Language_Translater() {
36 load_plugin_textdomain('NLS_TEXT_DOMAIN', false, dirname(plugin_basename(__FILE__)) . '/languages');
37 }
38
39 /**
40 * Function to create table for subscriber
41 */
42 function nls_callback_plugin_subscriber() {
43 global $wpdb;
44 $table_name = $wpdb->prefix . 'nls_subscribers';
45 $charset_collate = $wpdb->get_charset_collate();
46 $sql= '';
47
48 $col2 = $wpdb->get_var("SHOW TABLES LIKE '$table_name'");
49 if ($col2) {
50 /* Add deact_code column if not exists to nls_subscribers table */
51 $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . DB_NAME . "' AND TABLE_NAME = '" . $table_name . "' AND COLUMN_NAME = 'deact_code'");
52 if( !$row) {
53 $sql .= $wpdb->query("ALTER TABLE $table_name ADD deact_code VARCHAR(255) NOT NULL");
54 }
55
56 /* Add deact_code column if not exists to nls_subscribers table */
57 $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '" . DB_NAME . "' AND TABLE_NAME = '" . $table_name . "' AND COLUMN_NAME = 'form_type'");
58 if( !$row) {
59 $sql .= $wpdb->query("ALTER TABLE $table_name ADD form_type VARCHAR(255) NOT NULL");
60 }
61 } else {
62 $sql = "CREATE TABLE IF NOT EXISTS $table_name (
63 id int NOT NULL AUTO_INCREMENT,
64 f_name VARCHAR(255) NOT NULL,
65 l_name VARCHAR(255) NOT NULL,
66 terms VARCHAR(255) NOT NULL,
67 email VARCHAR(255) NOT NULL,
68 date timestamp,
69 act_code VARCHAR(255) NOT NULL,
70 deact_code VARCHAR(255) NOT NULL,
71 extra_detail text,
72 form_type VARCHAR(255) NOT NULL,
73 flag int,
74 UNIQUE KEY id (id)
75 )$charset_collate;";
76 }
77 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
78 dbDelta($sql);
79 }
80 register_activation_hook(__FILE__, 'nls_callback_plugin_subscriber');
81
82 /**
83 * Function to redirect to maintenance mode page
84 */
85 function nls_template_redirect_enqueue_script() {
86 wp_enqueue_style('form-style', plugin_dir_url(__FILE__) . 'options/css/form-style.css');
87 wp_enqueue_script('form_js', plugin_dir_url(__FILE__) . 'options/js/form_js.js', array('jquery'));
88 }
89
90 add_action('wp_enqueue_scripts', 'nls_template_redirect_enqueue_script');
91 function nls_maintenance_mode_template_redirect() {
92 if (isset($_GET['act_code'])) {
93 $act_code = $_GET['act_code'];
94 $email = $_GET['email'];
95 $wl_wnlsp_options = get_option('weblizar_wnlsp_options');
96 //search & match the email & activation code
97 global $wpdb;
98 $table_name = $wpdb->prefix . 'nls_subscribers';
99 $user_search_result = $wpdb->get_row("SELECT * FROM `$table_name` WHERE `email` LIKE '$email' AND `act_code` LIKE '$act_code'");
100 if (count($user_search_result)) {
101 // check user is already subscribed
102 if ($user_search_result->flag == 1) {
103 get_header();
104 echo '<div class="main_div1"><p class="subscribe-messages1">' . esc_html($wl_wnlsp_options['sub_form_subscribe_already_confirm_message']) . '<span class="close_message1">' . esc_html__('X', 'NLS_TEXT_DOMAIN') . '</span></p></div>';
105 } else {
106 // update user subscription active
107 if ($wpdb->query("UPDATE `$table_name` SET `flag` = '1' WHERE `email` = '$email'")) {
108 get_header();
109 echo '<div class="main_div1"><p class="subscribe-messages1">' . esc_html($wl_wnlsp_options['sub_form_subscribe_confirm_success_message']) . '<span class="close_message1">' . esc_html__('X', 'NLS_TEXT_DOMAIN') . '</span></p></div>';
110 }
111 //require_once('wnlsp-options/themes/form-include/confirmation-mail-from.php');
112 require_once('options/themes/form-include/confirmation-mail-from.php');
113 }
114 } else {
115 get_header();
116 echo '<div class="main_div1"><p class="subscribe-messages1">' . esc_html($wl_wnlsp_options['sub_form_invalid_confirmation_message']) . '<span class="close_message1">' . esc_html__('X', 'NLS_TEXT_DOMAIN') . '</span></p></div>';
117 }
118 }
119 }
120 add_action('template_redirect', 'nls_maintenance_mode_template_redirect');
121
122 function weblizar_nls_activation() {
123 $weblizar_nls_default_settings = weblizar_nls_default_settings();
124 $weblizar_nls_saved_theme_settings = get_option('weblizar_nls_options'); // get existing option data
125 if ($weblizar_nls_saved_theme_settings) {
126 $weblizar_nls_saved_theme_settings = array_merge($weblizar_nls_default_settings, $weblizar_nls_saved_theme_settings);
127 update_option('weblizar_nls_options', $weblizar_nls_saved_theme_settings); // Set existing and new option data
128 } else {
129 add_option('weblizar_nls_options', $weblizar_nls_default_settings); // set New option data
130
131 /*mailchimp list display Settings data post function **/
132 $weblizar_nls_mailchimp_allLists = "";
133 add_option("weblizar_nls_mailchimp_key", serialize($weblizar_nls_mailchimp_allLists));
134
135 /*Madmimi display Settings data post function **/
136 $weblizar_nls_madmimi = "";
137 add_option("weblizar_nls_madmimi_list", serialize($weblizar_nls_madmimi));
138 }
139 }
140
141 register_activation_hook(__FILE__, 'weblizar_nls_activation');
142
143 // Do redirect when Plugin activate
144 function nls_nht_plugin_activate() {
145 add_option('nls_nht_plugin_do_activation_redirect', true);
146 }
147 function nls_nht_plugin_redirect() {
148 if (get_option('nls_nht_plugin_do_activation_redirect', false)) {
149 delete_option('nls_nht_plugin_do_activation_redirect');
150 if (!isset($_GET['activate-multi'])) {
151 wp_redirect("admin.php?page=nls-weblizar");
152 }
153 }
154 }
155 register_activation_hook(__FILE__, 'nls_nht_plugin_activate');
156 add_action('admin_init', 'nls_nht_plugin_redirect');
157
158 // Add settings link on plugin page
159 function nls_settings_link($links) {
160 $nls_settings_link = '<a href="admin.php?page=nls-weblizar">' . esc_html__('Settings', 'NLS_TEXT_DOMAIN') . '</a>';
161 $nls_pro_link = '<a style="color: #ea5a21;font-weight: 700;" href="https://weblizar.com/plugins/newsletter-subscription-form-pro/" target="_blank">' . esc_html('Get Premium', 'NLS_TEXT_DOMAIN') . '</a>';
162 array_unshift($links, $nls_pro_link, $nls_settings_link);
163 return $links;
164 }
165 $nls_plugin_name = plugin_basename(__FILE__);
166 add_filter("plugin_action_links_$nls_plugin_name", 'nls_settings_link');
167