| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user, $wpscfunction; |
| 7 |
|
| 8 |
if ( |
| 9 |
check_ajax_referer('set_en_general_settings', '_ajax_nonce', false) != 1 |
| 10 |
) wp_send_json_error('Unauthorised request!', 400); |
| 11 |
|
| 12 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
// From Name |
| 17 |
$from_name = isset($_POST) && isset($_POST['wpsc_en_from_name']) ? sanitize_text_field($_POST['wpsc_en_from_name']) : ''; |
| 18 |
update_option('wpsc_en_from_name',$from_name); |
| 19 |
|
| 20 |
// From Email |
| 21 |
$from_email = isset($_POST) && isset($_POST['wpsc_en_from_email']) ? sanitize_email($_POST['wpsc_en_from_email']) : ''; |
| 22 |
update_option('wpsc_en_from_email',$from_email); |
| 23 |
|
| 24 |
// Reply To |
| 25 |
$reply_to = isset($_POST) && isset($_POST['wpsc_en_reply_to']) ? sanitize_email($_POST['wpsc_en_reply_to']) : ''; |
| 26 |
update_option('wpsc_en_reply_to',$reply_to); |
| 27 |
|
| 28 |
$ignore_list = isset($_POST) && isset($_POST['wpsc_en_ignore_emails']) && strlen($_POST['wpsc_en_ignore_emails']) ? sanitize_textarea_field($_POST['wpsc_en_ignore_emails']) : ''; |
| 29 |
$ignore_emails = $ignore_list ? explode("\n", $ignore_list) : array(); |
| 30 |
|
| 31 |
$ignore_emails = $wpscfunction->sanitize_array($ignore_emails); |
| 32 |
update_option('wpsc_en_ignore_emails',$ignore_emails); |
| 33 |
|
| 34 |
|
| 35 |
// Mail send count for every cron |
| 36 |
$wpsc_en_send_mail_count = isset($_POST) && isset($_POST['wpsc_en_send_mail_count']) ? sanitize_text_field($_POST['wpsc_en_send_mail_count']) : ''; |
| 37 |
update_option('wpsc_en_send_mail_count',$wpsc_en_send_mail_count); |
| 38 |
|
| 39 |
// Send email as per admin requirment |
| 40 |
$wpsc_email_sending_method = isset($_POST) && isset($_POST['wpsc_email_sending_method']) ? sanitize_text_field($_POST['wpsc_email_sending_method']) : ''; |
| 41 |
update_option('wpsc_email_sending_method',$wpsc_email_sending_method); |
| 42 |
|
| 43 |
do_action('wpsc_set_en_gerneral_settings'); |
| 44 |
|
| 45 |
echo '{ "sucess_status":"1","messege":"'.__('Settings saved.','supportcandy').'" }'; |
| 46 |
|