1 | <?php namespace EmailLog\Core; |
||
11 | class EmailLog { |
||
12 | |||
13 | /** |
||
14 | * Plugin Version number. |
||
15 | * |
||
16 | * @since Genesis |
||
17 | * @var string |
||
18 | */ |
||
19 | const VERSION = '2.0.2'; |
||
20 | |||
21 | /** |
||
22 | * Email Log Store URL. |
||
23 | */ |
||
24 | const STORE_URL = 'https://wpemaillog.com'; |
||
25 | |||
26 | /** |
||
27 | * Flag to track if the plugin is loaded. |
||
28 | * |
||
29 | * @since 2.0 |
||
30 | * @access private |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $loaded = false; |
||
34 | |||
35 | /** |
||
36 | * Plugin file path. |
||
37 | * |
||
38 | * @since 2.0 |
||
39 | * @access private |
||
40 | * @var string |
||
41 | */ |
||
42 | private $plugin_file; |
||
43 | |||
44 | /** |
||
45 | * Filesystem directory path where translations are stored. |
||
46 | * |
||
47 | * @since 2.0 |
||
48 | * @var string |
||
49 | */ |
||
50 | public $translations_path; |
||
51 | |||
52 | /** |
||
53 | * Auto loader. |
||
54 | * |
||
55 | * @var \EmailLog\EmailLogAutoloader |
||
56 | */ |
||
57 | public $loader; |
||
58 | |||
59 | /** |
||
60 | * Database Table Manager. |
||
61 | * |
||
62 | * @since 2.0 |
||
63 | * @var \EmailLog\Core\DB\TableManager |
||
64 | */ |
||
65 | public $table_manager; |
||
66 | |||
67 | /** |
||
68 | * Add-on Licenser. |
||
69 | * For non-admin requests it will not be set. |
||
70 | * |
||
71 | * @since 2.0 |
||
72 | * @var \EmailLog\Addon\License\Licenser |
||
73 | */ |
||
74 | private $licenser = null; |
||
75 | |||
76 | /** |
||
77 | * List of loadies. |
||
78 | * |
||
79 | * @var Loadie[] |
||
80 | */ |
||
81 | private $loadies = array(); |
||
82 | |||
83 | /** |
||
84 | * Initialize the plugin. |
||
85 | * |
||
86 | * @param string $file Plugin file. |
||
87 | * @param EmailLogAutoloader $loader EmailLog Autoloader. |
||
88 | * @param TableManager $table_manager Table Manager. |
||
89 | */ |
||
90 | 1 | public function __construct( $file, $loader, $table_manager ) { |
|
99 | |||
100 | /** |
||
101 | * Set Licenser. |
||
102 | * |
||
103 | * @param \EmailLog\Addon\License\Licenser $licenser Add-on Licenser. |
||
104 | */ |
||
105 | public function set_licenser( $licenser ) { |
||
110 | |||
111 | /** |
||
112 | * Get Licenser. |
||
113 | * |
||
114 | * @return null|\EmailLog\Addon\License\Licenser |
||
115 | */ |
||
116 | public function get_licenser() { |
||
119 | |||
120 | /** |
||
121 | * Add an Email Log Loadie. |
||
122 | * The `load()` method of the Loadies will be called when Email Log is loaded. |
||
123 | * |
||
124 | * @param \EmailLog\Core\Loadie $loadie Loadie to be loaded. |
||
125 | * |
||
126 | * @return bool False if Email Log is already loaded or if $loadie is not of `Loadie` type. True otherwise. |
||
127 | */ |
||
128 | 1 | public function add_loadie( $loadie ) { |
|
141 | |||
142 | /** |
||
143 | * Load the plugin. |
||
144 | */ |
||
145 | 1 | public function load() { |
|
146 | 1 | if ( $this->loaded ) { |
|
147 | return; |
||
148 | } |
||
149 | |||
150 | 1 | load_plugin_textdomain( 'email-log', false, $this->translations_path ); |
|
151 | |||
152 | 1 | $this->table_manager->load(); |
|
153 | |||
154 | 1 | foreach ( $this->loadies as $loadie ) { |
|
155 | 1 | $loadie->load(); |
|
156 | 1 | } |
|
157 | |||
158 | 1 | $this->loaded = true; |
|
159 | |||
160 | /** |
||
161 | * Email Log plugin loaded. |
||
162 | * |
||
163 | * @since 2.0 |
||
164 | */ |
||
165 | 1 | do_action( 'el_loaded' ); |
|
166 | 1 | } |
|
167 | |||
168 | /** |
||
169 | * Return Email Log version. |
||
170 | * |
||
171 | * @return string Email Log Version. |
||
172 | */ |
||
173 | public function get_version() { |
||
174 | return self::VERSION; |
||
175 | } |
||
176 | |||
177 | /** |
||
178 | * Return the Email Log plugin directory path. |
||
179 | * |
||
180 | * @return string Plugin directory path. |
||
181 | */ |
||
182 | public function get_plugin_path() { |
||
183 | return plugin_dir_path( $this->plugin_file ); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * Return the Email Log plugin file. |
||
188 | * |
||
189 | * @since 2.0.0 |
||
190 | * |
||
191 | * @return string Plugin directory path. |
||
192 | */ |
||
193 | public function get_plugin_file() { |
||
196 | |||
197 | /** |
||
198 | * Get Email Log Store URL. |
||
199 | * |
||
200 | * @since 2.0.0 |
||
201 | * |
||
202 | * @return string Store URL |
||
203 | */ |
||
204 | public function get_store_url() { |
||
207 | } |
||
208 |