PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.1.3
LatePoint – Calendar Booking Plugin for Appointments and Events v5.1.3
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / mailers / mailer.php
latepoint / lib / mailers Last commit date
agent_mailer.php 1 year ago customer_mailer.php 1 year ago mailer.php 1 year ago
mailer.php
63 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit; // Exit if accessed directly.
4 }
5
6
7 if ( ! class_exists( 'OsMailer' ) ) :
8
9 class OsMailer {
10
11 protected $views_folder = LATEPOINT_VIEWS_MAILERS_ABSPATH,
12 $vars = array(),
13 $layout = 'mailer',
14 $headers = [];
15
16 public static function send_email($to, $subject, $message, $headers){
17 if(!OsSettingsHelper::is_email_allowed()) return true;
18 return wp_mail($to, $subject, $message, $headers);
19 }
20
21 function get_headers(){
22 return $this->headers;
23 }
24
25 function get_view_uri($view_name){
26 return $this->views_folder.$view_name.'.php';
27 }
28
29 function __construct(){
30 $this->headers[] = 'Content-Type: text/html; charset=UTF-8';
31 $this->headers[] = 'From: '.OsNotificationsHelper::get_email_headers_from();
32 }
33
34 function set_layout($layout = 'mailer'){
35 if(isset($this->params['layout'])){
36 $this->layout = $this->params['layout'];
37 }else{
38 $this->layout = $layout;
39 }
40 }
41
42 function get_layout(){
43 return $this->layout;
44 }
45
46 function render($view, $extra_vars = array()){
47 $view = $this->get_view_uri($view);
48 extract($this->vars);
49 extract($extra_vars);
50 ob_start();
51 if($this->get_layout() != 'none'){
52 // rendering layout, view variable will be passed and used in layout file
53 include LATEPOINT_VIEWS_LAYOUTS_ABSPATH . OsRouterHelper::add_extension($this->get_layout(), '.php');
54 }else{
55 include OsRouterHelper::add_extension($view, '.php');
56 }
57 $response_html = ob_get_clean();
58 return $response_html;
59 }
60
61 }
62
63 endif;