| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $current_user, $wppmfunction; |
| 6 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
$wppm_email_notificatins = get_option('wppm_email_notification'); |
| 10 |
$term_id = isset($_POST) && isset($_POST['id']) ? intval(sanitize_text_field($_POST['id'])) : 0; |
| 11 |
if(!$term_id) die(); |
| 12 |
$type = isset($_POST) && isset($_POST['wppm_en_type']) ? sanitize_text_field($_POST['wppm_en_type']) : ''; |
| 13 |
$subject = isset($_POST) && isset($_POST['wppm_en_subject']) ? sanitize_text_field($_POST['wppm_en_subject']) : ''; |
| 14 |
$allowed_tags = array( 'br' => array(), 'abbr' => array('title' => array(),), 'p' => array(), 'strong' => array(), 'a' => array('href' => array(), 'title' => array(),'target'=> array(), 'rel'=>array()),'em' =>array(),'span' =>array(), 'blockquote'=>array('cite' => array(),),'div' => array('class' => array(),'title' => array(),'style' => array(),),'ul'=>array(),'li'=>array(),'ol'=>array(),'img' => array( 'alt'=> array(),'class' => array(),'height' => array(),'src'=> array(),'width'=> array(),)); |
| 15 |
$body = isset($_POST) && isset($_POST['wppm_en_body']) ? wp_kses(stripslashes(htmlspecialchars_decode($_POST['wppm_en_body'], ENT_QUOTES)),$allowed_tags) : ''; |
| 16 |
$recipients = isset($_POST) && isset($_POST['wppm_en_recipients']) ? $wppmfunction->sanitize_array($_POST['wppm_en_recipients']) : array(); |
| 17 |
foreach($wppm_email_notificatins as $key=>$val){ |
| 18 |
if($key==$term_id){ |
| 19 |
$val['type'] = $type; |
| 20 |
$val['subject'] = $subject; |
| 21 |
$val['body'] = $body; |
| 22 |
$val['recipients'] = $recipients; |
| 23 |
$wppm_email_notificatins[$key] = $val; |
| 24 |
update_option('wppm_email_notification',$wppm_email_notificatins); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
do_action('wppm_set_edit_email_notification',$term_id); |
| 29 |
|
| 30 |
echo '{ "sucess_status":"1","messege":"'.__('Email Notification updated successfully.','taskbuilder').'" }'; |
| 31 |
|