-
Notifications
You must be signed in to change notification settings - Fork 0
/
salesforce-newsletterglue.php
131 lines (109 loc) · 2.72 KB
/
salesforce-newsletterglue.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
/**
* Plugin Name: Salesforce Marketing Cloud for Newsletter Glue
* Plugin URI: https://newsletterglue.com/
* Description: Email posts to subscribers from the WordPress editor. Works with Salesforce Marketing Cloud.
* Author: Newsletter Glue
* Author URI: https://newsletterglue.com
* Requires at least: 6.0
* Requires PHP: 7.3
* Version: 1.0.0
* Text Domain: newsletter-glue
* Domain Path: /i18n/languages/
*
* @package Newsletter Glue
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Main Class.
*/
final class NG_Salesforce {
/** Singleton *************************************************************/
/**
* Class instance.
*
* @var $instance
*/
private static $instance;
/**
* The lists.
*
* @var $thelists
*/
public static $the_lists = null;
/**
* Main Instance.
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof NG_Salesforce ) ) {
self::$instance = new NG_Salesforce();
self::$instance->setup_constants();
self::$instance->includes();
}
return self::$instance;
}
/**
* Throw error on object clone.
*/
public function __clone() {
// Cloning instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'newsletter-glue' ), '1.0.0' );
}
/**
* Disable unserializing of the class.
*/
public function __wakeup() {
// Unserializing instances of the class is forbidden.
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'newsletter-glue' ), '1.0.0' );
}
/**
* Setup plugin constants.
*/
private function setup_constants() {
// Plugin version.
if ( ! defined( 'NGSF_VERSION' ) ) {
define( 'NGSF_VERSION', '1.0.0' );
}
// Plugin Folder Path.
if ( ! defined( 'NGSF_PLUGIN_DIR' ) ) {
define( 'NGSF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder URL.
if ( ! defined( 'NGSF_PLUGIN_URL' ) ) {
define( 'NGSF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Plugin Root File.
if ( ! defined( 'NGSF_PLUGIN_FILE' ) ) {
define( 'NGSF_PLUGIN_FILE', __FILE__ );
}
// Feedback server.
if ( ! defined( 'NGSF_FEEDBACK_SERVER' ) ) {
define( 'NGSF_FEEDBACK_SERVER', 'https://newsletterglue.com' );
}
}
/**
* Include required files.
*/
private function includes() {
require_once NGSF_PLUGIN_DIR . 'filters.php';
require_once NGSF_PLUGIN_DIR . 'deactivation.php';
if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
}
}
}
/**
* The main function.
*/
if ( ! function_exists( 'newsletterglue_salesforce' ) ) {
/**
* Run NG instance.
*/
function newsletterglue_salesforce() {
return NG_Salesforce::instance();
}
}
// Get Running.
newsletterglue_salesforce();