PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.6.2
LatePoint – Calendar Booking Plugin for Appointments and Events v5.6.2
5.6.7 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 3 months ago customer_mailer.php 3 months ago mailer.php 3 months ago
mailer.php
65 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() ) {
18 return true;
19 }
20 return wp_mail( $to, $subject, $message, $headers );
21 }
22
23 function get_headers() {
24 return $this->headers;
25 }
26
27 function get_view_uri( $view_name ) {
28 return $this->views_folder . $view_name . '.php';
29 }
30
31 function __construct() {
32 $this->headers[] = 'Content-Type: text/html; charset=UTF-8';
33 $this->headers[] = 'From: ' . OsNotificationsHelper::get_email_headers_from();
34 }
35
36 function set_layout( $layout = 'mailer' ) {
37 if ( isset( $this->params['layout'] ) ) {
38 $this->layout = $this->params['layout'];
39 } else {
40 $this->layout = $layout;
41 }
42 }
43
44 function get_layout() {
45 return $this->layout;
46 }
47
48 function render( $view, $extra_vars = array() ) {
49 $view = $this->get_view_uri( $view );
50 extract( $this->vars );
51 extract( $extra_vars );
52 ob_start();
53 if ( $this->get_layout() != 'none' ) {
54 // rendering layout, view variable will be passed and used in layout file
55 include LATEPOINT_VIEWS_LAYOUTS_ABSPATH . OsRouterHelper::add_extension( $this->get_layout(), '.php' );
56 } else {
57 include OsRouterHelper::add_extension( $view, '.php' );
58 }
59 $response_html = ob_get_clean();
60 return $response_html;
61 }
62 }
63
64 endif;
65