Beispiel #1
0
 /**
  * Send email notification
  */
 public static function send_notification($data)
 {
     $emails = self::get_option_value('pending.email', '');
     if ($emails == '') {
         return;
     }
     $dbmodels = new EADBModels();
     $app_id = $data['id'];
     $data = $dbmodels->get_appintment_by_id($app_id);
     $meta = $dbmodels->get_all_rows('ea_meta_fields', array(), array('position' => 'ASC'));
     ob_start();
     require EA_SRC_DIR . 'templates/mail.notification.tpl.php';
     $mail_content = ob_get_clean();
     $headers = array('Content-Type: text/html; charset=UTF-8');
     wp_mail($emails, __('New Reservation #', 'easy-appointments') . $app_id, $mail_content, $headers);
 }
 /**
  * Send email notification for admin
  */
 public static function send_notification($data)
 {
     $emails = self::get_option_value('pending.email', '');
     if ($emails == '') {
         return;
     }
     $dbmodels = new EADBModels();
     $app_id = $data['id'];
     $data = $dbmodels->get_appintment_by_id($app_id);
     $meta = $dbmodels->get_all_rows('ea_meta_fields', array(), array('position' => 'ASC'));
     $params = array();
     $time_format = get_option('time_format');
     $date_format = get_option('date_format');
     foreach ($data as $key => $value) {
         if ($key == 'start' || $key == 'end') {
             $value = date($time_format, strtotime("{$data['date']} {$value}"));
         }
         if ($key == 'date') {
             $value = date($date_format, strtotime("{$value} {$data['start']}"));
         }
         $params["#{$key}#"] = $value;
         $data[$key] = $value;
     }
     $subject_template = EALogic::get_option_value('pending.subject.email', 'Notification : #id#');
     $send_from = EALogic::get_option_value('send.from.email', '');
     $subject = str_replace(array_keys($params), array_values($params), $subject_template);
     ob_start();
     require EA_SRC_DIR . 'templates/mail.notification.tpl.php';
     $mail_content = ob_get_clean();
     $headers = array('Content-Type: text/html; charset=UTF-8');
     if (!empty($send_from)) {
         $headers[] = 'From: ' . $send_from;
     }
     wp_mail($emails, $subject, $mail_content, $headers);
 }