PluginProbe
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce / 1.2.6
ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce v1.2.6
1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.3.0 1.3.1 1.3.11 1.3.12 1.3.13 1.3.14 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 All 143 releases
erp / includes / class-emailer.php

class-emailer.php in ERP: Complete HR, Accounting & CRM Suite Built for WooCommerce 1.2.6, at includes/class-emailer.php

81 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WeDevs\ERP;
3
4 /**
5 * Emailer Class
6 */
7 class Emailer {
8
9 public $emails;
10
11 /**
12 * Initializes the WeDevs_ERP() class
13 *
14 * Checks for an existing WeDevs_ERP() instance
15 * and if it doesn't find one, creates it.
16 */
17 public static function init() {
18 static $instance = false;
19
20 if ( ! $instance ) {
21 $instance = new self();
22 }
23
24 return $instance;
25 }
26
27 public function __construct() {
28
29 // Email Header, Footer and content hooks
30 add_action( 'erp_email_header', array( $this, 'email_header' ) );
31 add_action( 'erp_email_footer', array( $this, 'email_footer' ) );
32
33 // Let 3rd parties unhook the above via this hook
34 do_action( 'erp_email', $this );
35 }
36
37 function init_emails() {
38 $this->emails = apply_filters( 'erp_email_classes', $this->emails );
39 }
40
41 /**
42 * Return the email classes - used in admin to load settings.
43 *
44 * @return array
45 */
46 public function get_emails() {
47 return $this->emails;
48 }
49
50 /**
51 * Get an registered email instance
52 *
53 * @param string $class_name
54 *
55 * @return \Email|false
56 */
57 public function get_email( $class_name ) {
58 if ( $this->emails && array_key_exists( $class_name, $this->emails ) ) {
59 return $this->emails[ $class_name ];
60 }
61
62 return false;
63 }
64
65 /**
66 * Get the email header.
67 *
68 * @param mixed $email_heading heading for the email
69 */
70 public function email_header( $email_heading ) {
71 include WPERP_INCLUDES . '/email/email-header.php';
72 }
73
74 /**
75 * Get the email footer.
76 */
77 public function email_footer() {
78 include WPERP_INCLUDES . '/email/email-footer.php';
79 }
80 }
81