| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user, $wppmfunction; |
| 7 |
if ( check_ajax_referer( 'wppm_set_en_general_settings', '_ajax_nonce', false ) != 1 ) { |
| 8 |
wp_send_json_error( 'Unauthorised request!', 401 ); |
| 9 |
} |
| 10 |
if (!($current_user->ID && $current_user->has_cap('wppm_admin') || $current_user->has_cap('manage_options'))) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
// From Name |
| 15 |
$from_name = isset($_POST) && isset($_POST['wppm_en_from_name']) ? sanitize_text_field(wp_unslash($_POST['wppm_en_from_name'])) : ''; |
| 16 |
update_option('wppm_en_from_name',$from_name); |
| 17 |
|
| 18 |
// From Email |
| 19 |
$from_email = isset($_POST) && isset($_POST['wppm_en_from_email']) ? sanitize_text_field(wp_unslash($_POST['wppm_en_from_email'])) : ''; |
| 20 |
update_option('wppm_en_from_email',$from_email); |
| 21 |
|
| 22 |
// Block emails |
| 23 |
$ignore_emails = isset($_POST) && isset($_POST['wppm_en_ignore_emails']) ? explode("\n", (wp_unslash($_POST['wppm_en_ignore_emails']))) : array(); |
| 24 |
$ignore_emails = $wppmfunction->sanitize_array($ignore_emails); |
| 25 |
update_option('wppm_en_ignore_emails',$ignore_emails); |
| 26 |
|
| 27 |
do_action('wppm_set_en_gerneral_settings'); |
| 28 |
|
| 29 |
echo wp_json_encode( array( |
| 30 |
'sucess_status' => 1, |
| 31 |
'messege' => esc_html__( 'Settings saved.', 'taskbuilder' ), |
| 32 |
) ); |
| 33 |
wp_die(); |
| 34 |
|