css
11 months ago
images
11 months ago
js
11 months ago
themes
11 months ago
webfonts
11 months ago
banner.php
11 months ago
default-options.php
11 months ago
index.php
11 months ago
option-data.php
11 months ago
option-panel.php
11 months ago
option-settings.php
11 months ago
option-data.php
342 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | |
| 4 | require(dirname(__FILE__) . '/themes/form-include/mailchimp/MailChimp.php'); |
| 5 | |
| 6 | use \DrewM\MailChimp\MailChimp; |
| 7 | |
| 8 | $wl_nls_options = weblizar_nls_get_options(); |
| 9 | /* |
| 10 | * Template settings save |
| 11 | */ |
| 12 | if (isset($_POST['weblizar_nls_settings_save_template_option']) && isset($_POST['security'])) { |
| 13 | if (!wp_verify_nonce($_POST['security'], 'subscriber_settings_save_template_option')) { |
| 14 | die(); |
| 15 | } |
| 16 | if ($_POST['weblizar_nls_settings_save_template_option'] == 1) { |
| 17 | foreach ($_POST as $key => $value) { |
| 18 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 19 | } |
| 20 | |
| 21 | if ($_POST['select_template']) { |
| 22 | echo esc_html($wl_nls_options['select_template'] = sanitize_text_field($_POST['select_template'])); |
| 23 | } else { |
| 24 | echo esc_html($wl_nls_options['select_template'] = "select_template1"); |
| 25 | } |
| 26 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 27 | //nls_page_layout_swap_setting(); |
| 28 | nls_skin_layout_setting(); |
| 29 | } |
| 30 | if ($_POST['weblizar_nls_settings_save_template_option'] == 2) { |
| 31 | nls_template_setting(); |
| 32 | //nls_page_layout_swap_setting(); |
| 33 | } |
| 34 | if ($_POST['weblizar_nls_settings_save_template_option'] == 3) { |
| 35 | nls_template_setting(); |
| 36 | nls_skin_layout_setting(); |
| 37 | nls_social_setting(); |
| 38 | nls_subscriber_form_setting(); |
| 39 | nls_subscriber_provider_setting(); |
| 40 | nls_subscriber_list_setting(); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | /* |
| 45 | * //Skin Layout Settings |
| 46 | */ |
| 47 | if (isset($_POST['weblizar_nls_settings_save_skin-layout_option']) && isset($_POST['security'])) { |
| 48 | if (!wp_verify_nonce($_POST['security'], 'subscriber_nonce_layout_option')) { |
| 49 | die(); |
| 50 | } |
| 51 | |
| 52 | if ($_POST['weblizar_nls_settings_save_skin-layout_option'] == 1) { |
| 53 | foreach ($_POST as $key => $value) { |
| 54 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 55 | } |
| 56 | |
| 57 | if (isset($_POST['custom_color_enable'])) { |
| 58 | $wl_nls_options['custom_color_enable'] = sanitize_text_field($_POST['custom_color_enable']); |
| 59 | } else { |
| 60 | $wl_nls_options['custom_color_enable'] = "off"; |
| 61 | } |
| 62 | |
| 63 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 64 | } |
| 65 | if ($_POST['weblizar_nls_settings_save_skin-layout_option'] == 2) { |
| 66 | nls_skin_layout_setting(); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /* |
| 71 | * social media link Settings |
| 72 | */ |
| 73 | if (isset($wl_nls_options['total_Social_links'])) { |
| 74 | $total_Social_links = $wl_nls_options['total_Social_links']; |
| 75 | } else { |
| 76 | $total_Social_links = 0; |
| 77 | } |
| 78 | |
| 79 | if (isset($_POST['weblizar_nls_settings_save_social_option']) && isset($_POST['security'])) { |
| 80 | if (!wp_verify_nonce($_POST['security'], 'subscriber_settings_save_social_option')) { |
| 81 | die(); |
| 82 | } |
| 83 | if ($_POST['weblizar_nls_settings_save_social_option'] == 1) { |
| 84 | |
| 85 | foreach ($_POST as $key => $value) { |
| 86 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 87 | } |
| 88 | |
| 89 | // Social Icons section yes or on |
| 90 | if (isset($_POST['social_icons_onoff'])) { |
| 91 | $wl_nls_options['social_icons_onoff'] = sanitize_text_field($_POST['social_icons_onoff']); |
| 92 | } else { |
| 93 | $wl_nls_options['social_icons_onoff'] = "off"; |
| 94 | } |
| 95 | |
| 96 | // social icons bottom section yes or on |
| 97 | if (isset($_POST['social_icons_bottom_onoff'])) { |
| 98 | $wl_nls_options['social_icons_bottom_onoff'] = sanitize_text_field($_POST['social_icons_bottom_onoff']); |
| 99 | } else { |
| 100 | $wl_nls_options['social_icons_bottom_onoff'] = "off"; |
| 101 | } |
| 102 | |
| 103 | $total_Social_links = sanitize_text_field($_POST['total_Social_links']); |
| 104 | |
| 105 | $social_icon_list = array(); |
| 106 | for ($i = 1; $i <= $total_Social_links; $i++) { |
| 107 | $social_icon = 'social_icon_' . $i; |
| 108 | $social_link = 'social_link_' . $i; |
| 109 | $social_link_tab = 'social_link_tab_' . $i; |
| 110 | $social_icolor = 'social_icolor_' . $i; |
| 111 | $wl_nls_options[$social_icon] = sanitize_text_field($_POST[$social_icon]); |
| 112 | $wl_nls_options[$social_link] = esc_url_raw($_POST[$social_link]); |
| 113 | $wl_nls_options[$social_link_tab] = sanitize_text_field( isset($_POST[$social_link_tab]) ? $_POST[$social_link_tab] : null ); |
| 114 | $wl_nls_options[$social_icolor] = sanitize_hex_color($_POST[$social_icolor]); |
| 115 | //$social_icon_list[$i] = array('social_icon' => $social_icon, 'social_link' => $social_link, 'social_link_tab' => $social_link_tab, 'social_icolor' => $social_icolor); |
| 116 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 117 | } |
| 118 | |
| 119 | $wl_nls_options['social_icon_list'] = $social_icon_list; |
| 120 | $wl_nls_options['total_Social_links'] = sanitize_text_field($_POST['total_Social_links']); |
| 121 | if (isset($wl_nls_options['social_icons'])) { |
| 122 | $wl_nls_options['social_icons'] = sanitize_text_field($_POST['social_icons']); |
| 123 | } |
| 124 | if (isset($wl_nls_options['social_links'])) { |
| 125 | $wl_nls_options['social_links'] = sanitize_text_field($_POST['social_links']); |
| 126 | } |
| 127 | if (isset($wl_nls_options['social_link_tab'])) { |
| 128 | $wl_nls_options['social_link_tab'] = sanitize_text_field($_POST['social_link_tab']); |
| 129 | } |
| 130 | if (isset($wl_nls_options['social_icolors'])) { |
| 131 | $wl_nls_options['social_icolors'] = sanitize_text_field($_POST['social_icolors']); |
| 132 | } |
| 133 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 134 | } |
| 135 | if ($_POST['weblizar_nls_settings_save_social_option'] == 2) { |
| 136 | nls_social_setting(); |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /* |
| 141 | * Subscriber Form Setting |
| 142 | */ |
| 143 | if (isset($_POST['weblizar_nls_settings_save_subscriber_option']) && isset($_POST['security'])) { |
| 144 | if (!wp_verify_nonce($_POST['security'], 'nonce_save_subscriber_option')) { |
| 145 | die(); |
| 146 | } |
| 147 | if ($_POST['weblizar_nls_settings_save_subscriber_option'] == 1) { |
| 148 | foreach ($_POST as $key => $value) { |
| 149 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 150 | } |
| 151 | if (isset($_POST['subscriber_form'])) { |
| 152 | $wl_nls_options['subscriber_form'] = sanitize_text_field($_POST['subscriber_form']); |
| 153 | } else { |
| 154 | $wl_nls_options['subscriber_form'] = "off"; |
| 155 | } |
| 156 | |
| 157 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 158 | } |
| 159 | if ($_POST['weblizar_nls_settings_save_subscriber_option'] == 2) { |
| 160 | nls_subscriber_form_setting(); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | if (isset($_POST['weblizar_nls_settings_save_subscriber_provider_option']) && isset($_POST['security'])) { |
| 165 | if (!wp_verify_nonce($_POST['security'], 'nonce_subscriber_provider_option')) { |
| 166 | die(); |
| 167 | } |
| 168 | if ($_POST['weblizar_nls_settings_save_subscriber_provider_option'] == 1 && isset($_POST['madmimi_api_key'])) { |
| 169 | foreach ($_POST as $key => $value) { |
| 170 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 171 | } |
| 172 | |
| 173 | if (isset($_POST['confirm_email_subscribe'])) { |
| 174 | $wl_nls_options['confirm_email_subscribe'] = sanitize_text_field($_POST['confirm_email_subscribe']); |
| 175 | } else { |
| 176 | $wl_nls_options['confirm_email_subscribe'] = "off"; |
| 177 | } |
| 178 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 179 | |
| 180 | if (isset($_POST['madmimi_api_key']) && !empty( $_POST['madmimi_api_key'] ) ) { |
| 181 | require( dirname(__FILE__) . '/themes/form-include/madmimi/MadMimi.class.php' ); |
| 182 | $adminemailid = stripslashes( $_POST['madmimi_username'] ); |
| 183 | $adminapi = stripslashes( $_POST['madmimi_api_key'] ); |
| 184 | $mailer = new MadMimi($adminemailid, $adminapi); |
| 185 | $response = $mailer->Lists(); |
| 186 | $response = json_decode( $response ); |
| 187 | foreach ($response as $k => $v) { |
| 188 | $listId = $v->id; |
| 189 | $listName = $v->name; |
| 190 | $weblizar_nls_madmimi_list[] = array('id' => $listId, 'name' => $listName); |
| 191 | } |
| 192 | update_option("weblizar_nls_madmimi_list", serialize($weblizar_nls_madmimi_list)); |
| 193 | } |
| 194 | } elseif ($_POST['weblizar_nls_settings_save_subscriber_provider_option'] == 1 && isset($_POST['mailchimp_api_key'])) { |
| 195 | foreach ($_POST as $key => $value) { |
| 196 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 197 | } |
| 198 | |
| 199 | if (isset($_POST['confirm_email_subscribe'])) { |
| 200 | $wl_nls_options['confirm_email_subscribe'] = sanitize_text_field($_POST['confirm_email_subscribe']); |
| 201 | } else { |
| 202 | $wl_nls_options['confirm_email_subscribe'] = "off"; |
| 203 | } |
| 204 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 205 | |
| 206 | if (isset($_POST['mailchimp_api_key'])) { |
| 207 | $mailchimp_key = stripslashes($_POST['mailchimp_api_key']); |
| 208 | $apikey = $mailchimp_key; |
| 209 | $api = new MailChimp($apikey); |
| 210 | $lists = $api->get('lists'); |
| 211 | foreach ($lists['lists'] as $list) { |
| 212 | $listId = $list['id']; |
| 213 | $listName = $list['name']; |
| 214 | $mailchimp_key_list[] = array('id' => $listId, 'name' => $listName); |
| 215 | } |
| 216 | foreach ($mailchimp_key_list as $List) { |
| 217 | $alllistid = $List['id']; |
| 218 | $alllistname = $List['name']; |
| 219 | $weblizar_nls_mailchimp_list[] = array('id' => $alllistid, 'name' => $alllistname); |
| 220 | } |
| 221 | update_option("weblizar_nls_mailchimp_list", serialize($weblizar_nls_mailchimp_list)); |
| 222 | } |
| 223 | } |
| 224 | if ($_POST['weblizar_nls_settings_save_subscriber_provider_option'] == 2) { |
| 225 | nls_subscriber_provider_setting(); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | if (isset($_POST['weblizar_nls_settings_save_subscriber_list_option'])) { |
| 230 | if ($_POST['weblizar_nls_settings_save_subscriber_list_option'] == 1) { |
| 231 | foreach ($_POST as $key => $value) { |
| 232 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 233 | } |
| 234 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 235 | } |
| 236 | if ($_POST['weblizar_nls_settings_save_subscriber_list_option'] == 2) { |
| 237 | nls_subscriber_list_setting(); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /* |
| 242 | * Subscriber Form Data save setting |
| 243 | */ |
| 244 | if (isset($_POST['weblizar_nls_settings_save_subscribe_form']) && isset($_POST['security'])) { |
| 245 | if (!wp_verify_nonce($_POST['security'], 'subscribers_options_settings')) { |
| 246 | die(); |
| 247 | } |
| 248 | if ($_POST['weblizar_nls_settings_save_subscribe_form'] == 1) { |
| 249 | foreach ($_POST as $key => $value) { |
| 250 | $wl_nls_options[$key] = sanitize_text_field($_POST[$key]); |
| 251 | } |
| 252 | update_option('weblizar_nls_options', stripslashes_deep($wl_nls_options)); |
| 253 | } |
| 254 | if ($_POST['weblizar_nls_settings_save_subscribe_form'] == 2) { |
| 255 | nls_subscriber_list_setting(); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | |
| 260 | /** |
| 261 | * Subscriber Form Mailed to Subscribers Users as selected action and Subscriber Form Data Removed setting |
| 262 | */ |
| 263 | if (isset($_POST['weblizar_nls_submit_subscriber'])) { |
| 264 | global $wpdb; |
| 265 | $table_name = $table_name = $wpdb->prefix . "nls_subscribers"; |
| 266 | if ($_POST['weblizar_nls_submit_subscriber'] == 1) { |
| 267 | $email_check = $wpdb->get_results("SELECT * FROM $table_name WHERE id !=0"); |
| 268 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 2) { |
| 269 | $z = 0; |
| 270 | if (is_array($_POST['rem'])) { |
| 271 | foreach ($_POST['rem'] as $subscribe_id) { |
| 272 | if ($subscribe_id != '') { |
| 273 | $email_check = $wpdb->get_results("SELECT * FROM $table_name WHERE id = $subscribe_id"); |
| 274 | } |
| 275 | $z++; |
| 276 | } |
| 277 | } |
| 278 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 3) { |
| 279 | $email_check = $wpdb->get_results("SELECT * FROM $table_name WHERE flag = '0'"); |
| 280 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 4) { |
| 281 | $email_check = $wpdb->get_results("SELECT * FROM $table_name WHERE flag = '1'"); |
| 282 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 5) { |
| 283 | $email_check = $wpdb->get_results("SELECT * FROM $table_name WHERE flag = '2'"); |
| 284 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 6) { |
| 285 | global $wpdb; |
| 286 | $table_name = $wpdb->prefix . "nls_subscribers"; |
| 287 | $j = 0; |
| 288 | if (isset($_POST['rem'])) { |
| 289 | foreach ($_POST['rem'] as $subscribe_ids) { |
| 290 | if ($subscribe_ids != '') { |
| 291 | $wpdb->delete($table_name, array('id' => $subscribe_ids), array('%d')); |
| 292 | } |
| 293 | $j++; |
| 294 | } |
| 295 | } |
| 296 | } elseif ($_POST['weblizar_nls_submit_subscriber'] == 7) { |
| 297 | global $wpdb; |
| 298 | $table_name = $wpdb->prefix . "nls_subscribers"; |
| 299 | $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE flag != %d", 30)); |
| 300 | } |
| 301 | if ($_POST['weblizar_nls_submit_subscriber'] == 8) { |
| 302 | global $wpdb; |
| 303 | $results = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "csmm_subscribers WHERE flag = '1'"); |
| 304 | echo "Name, Email, Date, Subscription Status, Activate-code\r\n"; |
| 305 | if (count($results)) { |
| 306 | foreach ($results as $row) { |
| 307 | if ($row->flag == '1') { |
| 308 | $flags = 'Subscribed'; |
| 309 | } else { |
| 310 | $flags = 'Pending'; |
| 311 | } |
| 312 | echo esc_html($row->f_name . " " . $row->l_name . ", " . $row->email . ", " . $row->date . ", " . $flags . "," . $row->act_code . "\r\n"); |
| 313 | } |
| 314 | } |
| 315 | $filename = $file . "_" . date("Y-m-d_H-i", time()); |
| 316 | header("Content-type: application/vnd.ms-excel"); |
| 317 | header("Content-disposition: csv" . date("Y-m-d") . ".csv"); |
| 318 | header("Content-disposition: filename=" . $filename . ".csv"); |
| 319 | print $results; |
| 320 | exit; |
| 321 | } |
| 322 | if (isset($email_check)) { |
| 323 | foreach ($email_check as $all_emails) { |
| 324 | $subscriber_email = $all_emails->email; |
| 325 | $f_name = $all_emails->f_name; |
| 326 | $l_name = $all_emails->l_name; |
| 327 | $flag_act = $all_emails->flag; |
| 328 | $current_time = current_time('Y-m-d h:i:s'); |
| 329 | $adminemail = $wl_nls_options['wp_mail_email_id']; |
| 330 | $plugin_url = site_url(); |
| 331 | $headers = 'Content-type: text/html' . "\r\n" . "From:$plugin_url <$adminemail>" . "\r\n" . 'Reply-To: ' . $adminemail . "\r\n" . 'X-Mailer: PHP/' . phpversion(); |
| 332 | $subject = sanitize_text_field($_POST['subscriber_mail_subject']) . ': Confirmation Subscription'; |
| 333 | $message = 'Hi ' . $f_name . ' ' . $l_name . ', <br/>'; |
| 334 | global $current_user; |
| 335 | wp_get_current_user(); |
| 336 | $plugin_site_url = site_url(); |
| 337 | $message .= sanitize_text_field($_POST['subscriber_mail_message']); |
| 338 | $wp_mails = wp_mail($subscriber_email, $subject, $message, $headers); |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 |