Completed
Pull Request — master (#1151)
by Darren
09:09
created
core/services/assets/BlockAssetManager.php 2 patches
Indentation   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -22,311 +22,311 @@
 block discarded – undo
22 22
 abstract class BlockAssetManager extends AssetManager implements BlockAssetManagerInterface
23 23
 {
24 24
 
25
-    /**
26
-     * @var string $editor_script_handle
27
-     */
28
-    private $editor_script_handle;
29
-
30
-    /**
31
-     * @var string $editor_style_handle
32
-     */
33
-    private $editor_style_handle;
34
-
35
-    /**
36
-     * @var string $script_handle
37
-     */
38
-    private $script_handle;
39
-
40
-    /**
41
-     * @var string $style_handle
42
-     */
43
-    private $style_handle;
44
-
45
-
46
-    /**
47
-     * @return string
48
-     */
49
-    public function getEditorScriptHandle()
50
-    {
51
-        return $this->editor_script_handle;
52
-    }
53
-
54
-
55
-    /**
56
-     * @param string $editor_script_handle
57
-     */
58
-    public function setEditorScriptHandle($editor_script_handle)
59
-    {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
-        }
63
-        $this->editor_script_handle = $editor_script_handle;
64
-    }
65
-
66
-
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getEditorStyleHandle()
71
-    {
72
-        return $this->editor_style_handle;
73
-    }
74
-
75
-
76
-    /**
77
-     * @param string $editor_style_handle
78
-     */
79
-    public function setEditorStyleHandle($editor_style_handle)
80
-    {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
-        }
84
-        $this->editor_style_handle = $editor_style_handle;
85
-    }
86
-
87
-
88
-    /**
89
-     * @return string
90
-     */
91
-    public function getScriptHandle()
92
-    {
93
-        return $this->script_handle;
94
-    }
95
-
96
-
97
-    /**
98
-     * @param string $script_handle
99
-     */
100
-    public function setScriptHandle($script_handle)
101
-    {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
-        }
105
-        $this->script_handle = $script_handle;
106
-    }
107
-
108
-
109
-    /**
110
-     * @return string
111
-     */
112
-    public function getStyleHandle()
113
-    {
114
-        return $this->style_handle;
115
-    }
116
-
117
-
118
-    /**
119
-     * @param string $style_handle
120
-     */
121
-    public function setStyleHandle($style_handle)
122
-    {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
-        }
126
-        $this->style_handle = $style_handle;
127
-    }
128
-
129
-    /**
130
-     * @since 4.9.71.p
131
-     * @throws InvalidDataTypeException
132
-     * @throws InvalidEntityException
133
-     * @throws DuplicateCollectionIdentifierException
134
-     */
135
-    public function addAssets()
136
-    {
137
-        $this->addEditorScript($this->getEditorScriptHandle());
138
-        $this->addEditorStyle($this->getEditorStyleHandle());
139
-        $this->addScript($this->getScriptHandle());
140
-        $this->addStyle($this->getStyleHandle());
141
-    }
142
-
143
-
144
-    /**
145
-     * @param       $handle
146
-     * @param array $dependencies
147
-     * @since 4.9.71.p
148
-     * @return JavascriptAsset
149
-     * @throws InvalidDataTypeException
150
-     * @throws InvalidEntityException
151
-     * @throws DuplicateCollectionIdentifierException
152
-     */
153
-    public function addEditorScript($handle, array $dependencies = array())
154
-    {
155
-        if($this->assets->hasJavascriptAsset($handle)){
156
-            return $this->assets->getJavascriptAsset($handle);
157
-        }
158
-        return parent::addJavascript(
159
-            $handle,
160
-            $this->registry->getJsUrl(
161
-                $this->domain->assetNamespace(),
162
-                $handle
163
-            ),
164
-            $this->addDefaultBlockScriptDependencies($dependencies)
165
-        )
166
-        ->setRequiresTranslation();
167
-    }
168
-
169
-
170
-    /**
171
-     * @param        $handle
172
-     * @param array  $dependencies
173
-     * @since 4.9.71.p
174
-     * @return StylesheetAsset
175
-     * @throws InvalidDataTypeException
176
-     * @throws InvalidEntityException
177
-     * @throws DuplicateCollectionIdentifierException
178
-     */
179
-    public function addEditorStyle($handle, array $dependencies = array())
180
-    {
181
-        if ($this->assets->hasStylesheetAsset($handle)) {
182
-            return $this->assets->getStylesheetAsset($handle);
183
-        }
184
-        return parent::addStylesheet(
185
-            $handle,
186
-            $this->registry->getCssUrl(
187
-                $this->domain->assetNamespace(),
188
-                $handle
189
-            ),
190
-            $this->addDefaultBlockStyleDependencies($dependencies)
191
-        );
192
-    }
193
-
194
-
195
-    /**
196
-     * @param       $handle
197
-     * @param array $dependencies
198
-     * @since 4.9.71.p
199
-     * @return JavascriptAsset
200
-     * @throws InvalidDataTypeException
201
-     * @throws InvalidEntityException
202
-     * @throws DuplicateCollectionIdentifierException
203
-     */
204
-    public function addScript($handle, array $dependencies = array())
205
-    {
206
-        if ($this->assets->hasJavascriptAsset($handle)) {
207
-            return $this->assets->getJavascriptAsset($handle);
208
-        }
209
-        return parent::addJavascript(
210
-            $handle,
211
-            $this->registry->getJsUrl(
212
-                $this->domain->assetNamespace(),
213
-                $handle
214
-            ),
215
-            $dependencies + array( CoreAssetManager::JS_HANDLE_COMPONENTS )
216
-        )
217
-        ->setRequiresTranslation();
218
-    }
219
-
220
-
221
-    /**
222
-     * @param        $handle
223
-     * @param array  $dependencies
224
-     * @since 4.9.71.p
225
-     * @return StylesheetAsset
226
-     * @throws InvalidDataTypeException
227
-     * @throws InvalidEntityException
228
-     * @throws DuplicateCollectionIdentifierException
229
-     */
230
-    public function addStyle($handle, array $dependencies = array())
231
-    {
232
-        if ($this->assets->hasStylesheetAsset($handle)) {
233
-            return $this->assets->getStylesheetAsset($handle);
234
-        }
235
-        return parent::addStylesheet(
236
-            $handle,
237
-            $this->registry->getCssUrl(
238
-                $this->domain->assetNamespace(),
239
-                $handle
240
-            ),
241
-            $dependencies + array( CoreAssetManager::CSS_HANDLE_COMPONENTS )
242
-        );
243
-    }
244
-
245
-
246
-    /**
247
-     * @param array $dependencies
248
-     * @return array
249
-     */
250
-    protected function addDefaultBlockScriptDependencies(array $dependencies)
251
-    {
252
-        $dependencies += array(
253
-                'wp-blocks',    // Provides useful functions and components for extending the editor
254
-                'wp-i18n',      // Provides localization functions
255
-                'wp-element',   // Provides React.Component
256
-                'wp-components', // Provides many prebuilt components and controls
257
-                'wp-block-editor', // block editor components
258
-                CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
259
-                $this->getScriptHandle(),
260
-            );
261
-        return $dependencies;
262
-    }
263
-
264
-
265
-    /**
266
-     * @param array $dependencies
267
-     * @return array
268
-     */
269
-    protected function addDefaultBlockStyleDependencies(array $dependencies)
270
-    {
271
-        $dependencies += array(
272
-            $this->getStyleHandle()
273
-        );
274
-        return $dependencies;
275
-    }
276
-
277
-
278
-    /**
279
-     * @return JavascriptAsset|null
280
-     */
281
-    public function getEditorScript()
282
-    {
283
-        return $this->assets->getJavascriptAsset($this->editor_script_handle);
284
-    }
285
-
286
-
287
-    /**
288
-     * @return StylesheetAsset|null
289
-     */
290
-    public function getEditorStyle()
291
-    {
292
-        return $this->assets->getStylesheetAsset($this->editor_style_handle);
293
-    }
294
-
295
-
296
-    /**
297
-     * @return JavascriptAsset|null
298
-     */
299
-    public function getScript()
300
-    {
301
-        return $this->assets->getJavascriptAsset($this->script_handle);
302
-    }
303
-
304
-
305
-    /**
306
-     * @return StylesheetAsset|null
307
-     */
308
-    public function getStyle()
309
-    {
310
-        return $this->assets->getStylesheetAsset($this->style_handle);
311
-    }
312
-
313
-
314
-    /**
315
-     * @return  void
316
-     */
317
-    public function enqueueAssets()
318
-    {
319
-        $assets = array(
320
-            $this->getEditorScript(),
321
-            $this->getEditorStyle(),
322
-            $this->getScript(),
323
-            $this->getStyle(),
324
-        );
325
-        foreach ($assets as $asset) {
326
-            if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
327
-                $asset->enqueueAsset();
328
-            }
329
-        }
330
-    }
25
+	/**
26
+	 * @var string $editor_script_handle
27
+	 */
28
+	private $editor_script_handle;
29
+
30
+	/**
31
+	 * @var string $editor_style_handle
32
+	 */
33
+	private $editor_style_handle;
34
+
35
+	/**
36
+	 * @var string $script_handle
37
+	 */
38
+	private $script_handle;
39
+
40
+	/**
41
+	 * @var string $style_handle
42
+	 */
43
+	private $style_handle;
44
+
45
+
46
+	/**
47
+	 * @return string
48
+	 */
49
+	public function getEditorScriptHandle()
50
+	{
51
+		return $this->editor_script_handle;
52
+	}
53
+
54
+
55
+	/**
56
+	 * @param string $editor_script_handle
57
+	 */
58
+	public function setEditorScriptHandle($editor_script_handle)
59
+	{
60
+		if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
+			$editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
62
+		}
63
+		$this->editor_script_handle = $editor_script_handle;
64
+	}
65
+
66
+
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getEditorStyleHandle()
71
+	{
72
+		return $this->editor_style_handle;
73
+	}
74
+
75
+
76
+	/**
77
+	 * @param string $editor_style_handle
78
+	 */
79
+	public function setEditorStyleHandle($editor_style_handle)
80
+	{
81
+		if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
+			$editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
83
+		}
84
+		$this->editor_style_handle = $editor_style_handle;
85
+	}
86
+
87
+
88
+	/**
89
+	 * @return string
90
+	 */
91
+	public function getScriptHandle()
92
+	{
93
+		return $this->script_handle;
94
+	}
95
+
96
+
97
+	/**
98
+	 * @param string $script_handle
99
+	 */
100
+	public function setScriptHandle($script_handle)
101
+	{
102
+		if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
+			$script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
104
+		}
105
+		$this->script_handle = $script_handle;
106
+	}
107
+
108
+
109
+	/**
110
+	 * @return string
111
+	 */
112
+	public function getStyleHandle()
113
+	{
114
+		return $this->style_handle;
115
+	}
116
+
117
+
118
+	/**
119
+	 * @param string $style_handle
120
+	 */
121
+	public function setStyleHandle($style_handle)
122
+	{
123
+		if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
+			$style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
125
+		}
126
+		$this->style_handle = $style_handle;
127
+	}
128
+
129
+	/**
130
+	 * @since 4.9.71.p
131
+	 * @throws InvalidDataTypeException
132
+	 * @throws InvalidEntityException
133
+	 * @throws DuplicateCollectionIdentifierException
134
+	 */
135
+	public function addAssets()
136
+	{
137
+		$this->addEditorScript($this->getEditorScriptHandle());
138
+		$this->addEditorStyle($this->getEditorStyleHandle());
139
+		$this->addScript($this->getScriptHandle());
140
+		$this->addStyle($this->getStyleHandle());
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param       $handle
146
+	 * @param array $dependencies
147
+	 * @since 4.9.71.p
148
+	 * @return JavascriptAsset
149
+	 * @throws InvalidDataTypeException
150
+	 * @throws InvalidEntityException
151
+	 * @throws DuplicateCollectionIdentifierException
152
+	 */
153
+	public function addEditorScript($handle, array $dependencies = array())
154
+	{
155
+		if($this->assets->hasJavascriptAsset($handle)){
156
+			return $this->assets->getJavascriptAsset($handle);
157
+		}
158
+		return parent::addJavascript(
159
+			$handle,
160
+			$this->registry->getJsUrl(
161
+				$this->domain->assetNamespace(),
162
+				$handle
163
+			),
164
+			$this->addDefaultBlockScriptDependencies($dependencies)
165
+		)
166
+		->setRequiresTranslation();
167
+	}
168
+
169
+
170
+	/**
171
+	 * @param        $handle
172
+	 * @param array  $dependencies
173
+	 * @since 4.9.71.p
174
+	 * @return StylesheetAsset
175
+	 * @throws InvalidDataTypeException
176
+	 * @throws InvalidEntityException
177
+	 * @throws DuplicateCollectionIdentifierException
178
+	 */
179
+	public function addEditorStyle($handle, array $dependencies = array())
180
+	{
181
+		if ($this->assets->hasStylesheetAsset($handle)) {
182
+			return $this->assets->getStylesheetAsset($handle);
183
+		}
184
+		return parent::addStylesheet(
185
+			$handle,
186
+			$this->registry->getCssUrl(
187
+				$this->domain->assetNamespace(),
188
+				$handle
189
+			),
190
+			$this->addDefaultBlockStyleDependencies($dependencies)
191
+		);
192
+	}
193
+
194
+
195
+	/**
196
+	 * @param       $handle
197
+	 * @param array $dependencies
198
+	 * @since 4.9.71.p
199
+	 * @return JavascriptAsset
200
+	 * @throws InvalidDataTypeException
201
+	 * @throws InvalidEntityException
202
+	 * @throws DuplicateCollectionIdentifierException
203
+	 */
204
+	public function addScript($handle, array $dependencies = array())
205
+	{
206
+		if ($this->assets->hasJavascriptAsset($handle)) {
207
+			return $this->assets->getJavascriptAsset($handle);
208
+		}
209
+		return parent::addJavascript(
210
+			$handle,
211
+			$this->registry->getJsUrl(
212
+				$this->domain->assetNamespace(),
213
+				$handle
214
+			),
215
+			$dependencies + array( CoreAssetManager::JS_HANDLE_COMPONENTS )
216
+		)
217
+		->setRequiresTranslation();
218
+	}
219
+
220
+
221
+	/**
222
+	 * @param        $handle
223
+	 * @param array  $dependencies
224
+	 * @since 4.9.71.p
225
+	 * @return StylesheetAsset
226
+	 * @throws InvalidDataTypeException
227
+	 * @throws InvalidEntityException
228
+	 * @throws DuplicateCollectionIdentifierException
229
+	 */
230
+	public function addStyle($handle, array $dependencies = array())
231
+	{
232
+		if ($this->assets->hasStylesheetAsset($handle)) {
233
+			return $this->assets->getStylesheetAsset($handle);
234
+		}
235
+		return parent::addStylesheet(
236
+			$handle,
237
+			$this->registry->getCssUrl(
238
+				$this->domain->assetNamespace(),
239
+				$handle
240
+			),
241
+			$dependencies + array( CoreAssetManager::CSS_HANDLE_COMPONENTS )
242
+		);
243
+	}
244
+
245
+
246
+	/**
247
+	 * @param array $dependencies
248
+	 * @return array
249
+	 */
250
+	protected function addDefaultBlockScriptDependencies(array $dependencies)
251
+	{
252
+		$dependencies += array(
253
+				'wp-blocks',    // Provides useful functions and components for extending the editor
254
+				'wp-i18n',      // Provides localization functions
255
+				'wp-element',   // Provides React.Component
256
+				'wp-components', // Provides many prebuilt components and controls
257
+				'wp-block-editor', // block editor components
258
+				CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
259
+				$this->getScriptHandle(),
260
+			);
261
+		return $dependencies;
262
+	}
263
+
264
+
265
+	/**
266
+	 * @param array $dependencies
267
+	 * @return array
268
+	 */
269
+	protected function addDefaultBlockStyleDependencies(array $dependencies)
270
+	{
271
+		$dependencies += array(
272
+			$this->getStyleHandle()
273
+		);
274
+		return $dependencies;
275
+	}
276
+
277
+
278
+	/**
279
+	 * @return JavascriptAsset|null
280
+	 */
281
+	public function getEditorScript()
282
+	{
283
+		return $this->assets->getJavascriptAsset($this->editor_script_handle);
284
+	}
285
+
286
+
287
+	/**
288
+	 * @return StylesheetAsset|null
289
+	 */
290
+	public function getEditorStyle()
291
+	{
292
+		return $this->assets->getStylesheetAsset($this->editor_style_handle);
293
+	}
294
+
295
+
296
+	/**
297
+	 * @return JavascriptAsset|null
298
+	 */
299
+	public function getScript()
300
+	{
301
+		return $this->assets->getJavascriptAsset($this->script_handle);
302
+	}
303
+
304
+
305
+	/**
306
+	 * @return StylesheetAsset|null
307
+	 */
308
+	public function getStyle()
309
+	{
310
+		return $this->assets->getStylesheetAsset($this->style_handle);
311
+	}
312
+
313
+
314
+	/**
315
+	 * @return  void
316
+	 */
317
+	public function enqueueAssets()
318
+	{
319
+		$assets = array(
320
+			$this->getEditorScript(),
321
+			$this->getEditorStyle(),
322
+			$this->getScript(),
323
+			$this->getStyle(),
324
+		);
325
+		foreach ($assets as $asset) {
326
+			if ($asset instanceof BrowserAsset && $asset->isRegistered()) {
327
+				$asset->enqueueAsset();
328
+			}
329
+		}
330
+	}
331 331
 
332 332
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function setEditorScriptHandle($editor_script_handle)
59 59
     {
60
-        if(strpos($editor_script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
61
-            $editor_script_handle = BlockInterface::NAME_SPACE . '-' . $editor_script_handle;
60
+        if (strpos($editor_script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
61
+            $editor_script_handle = BlockInterface::NAME_SPACE.'-'.$editor_script_handle;
62 62
         }
63 63
         $this->editor_script_handle = $editor_script_handle;
64 64
     }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function setEditorStyleHandle($editor_style_handle)
80 80
     {
81
-        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
82
-            $editor_style_handle = BlockInterface::NAME_SPACE . '-' . $editor_style_handle;
81
+        if (strpos($editor_style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
82
+            $editor_style_handle = BlockInterface::NAME_SPACE.'-'.$editor_style_handle;
83 83
         }
84 84
         $this->editor_style_handle = $editor_style_handle;
85 85
     }
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function setScriptHandle($script_handle)
101 101
     {
102
-        if (strpos($script_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
103
-            $script_handle = BlockInterface::NAME_SPACE . '-' . $script_handle;
102
+        if (strpos($script_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
103
+            $script_handle = BlockInterface::NAME_SPACE.'-'.$script_handle;
104 104
         }
105 105
         $this->script_handle = $script_handle;
106 106
     }
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function setStyleHandle($style_handle)
122 122
     {
123
-        if (strpos($style_handle, BlockInterface::NAME_SPACE . '-') !== 0) {
124
-            $style_handle = BlockInterface::NAME_SPACE . '-' . $style_handle;
123
+        if (strpos($style_handle, BlockInterface::NAME_SPACE.'-') !== 0) {
124
+            $style_handle = BlockInterface::NAME_SPACE.'-'.$style_handle;
125 125
         }
126 126
         $this->style_handle = $style_handle;
127 127
     }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function addEditorScript($handle, array $dependencies = array())
154 154
     {
155
-        if($this->assets->hasJavascriptAsset($handle)){
155
+        if ($this->assets->hasJavascriptAsset($handle)) {
156 156
             return $this->assets->getJavascriptAsset($handle);
157 157
         }
158 158
         return parent::addJavascript(
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                 $this->domain->assetNamespace(),
213 213
                 $handle
214 214
             ),
215
-            $dependencies + array( CoreAssetManager::JS_HANDLE_COMPONENTS )
215
+            $dependencies + array(CoreAssetManager::JS_HANDLE_COMPONENTS)
216 216
         )
217 217
         ->setRequiresTranslation();
218 218
     }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
                 $this->domain->assetNamespace(),
239 239
                 $handle
240 240
             ),
241
-            $dependencies + array( CoreAssetManager::CSS_HANDLE_COMPONENTS )
241
+            $dependencies + array(CoreAssetManager::CSS_HANDLE_COMPONENTS)
242 242
         );
243 243
     }
244 244
 
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
     protected function addDefaultBlockScriptDependencies(array $dependencies)
251 251
     {
252 252
         $dependencies += array(
253
-                'wp-blocks',    // Provides useful functions and components for extending the editor
254
-                'wp-i18n',      // Provides localization functions
255
-                'wp-element',   // Provides React.Component
253
+                'wp-blocks', // Provides useful functions and components for extending the editor
254
+                'wp-i18n', // Provides localization functions
255
+                'wp-element', // Provides React.Component
256 256
                 'wp-components', // Provides many prebuilt components and controls
257 257
                 'wp-block-editor', // block editor components
258 258
                 CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
Please login to merge, or discard this patch.
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Indentation   +1161 added lines, -1161 removed lines patch added patch discarded remove patch
@@ -23,1225 +23,1225 @@
 block discarded – undo
23 23
 class EE_Register_Addon implements EEI_Plugin_API
24 24
 {
25 25
 
26
-    /**
27
-     * possibly truncated version of the EE core version string
28
-     *
29
-     * @var string
30
-     */
31
-    protected static $_core_version = '';
26
+	/**
27
+	 * possibly truncated version of the EE core version string
28
+	 *
29
+	 * @var string
30
+	 */
31
+	protected static $_core_version = '';
32 32
 
33
-    /**
34
-     * Holds values for registered addons
35
-     *
36
-     * @var array
37
-     */
38
-    protected static $_settings = array();
33
+	/**
34
+	 * Holds values for registered addons
35
+	 *
36
+	 * @var array
37
+	 */
38
+	protected static $_settings = array();
39 39
 
40
-    /**
41
-     * @var  array $_incompatible_addons keys are addon SLUGS
42
-     * (first argument passed to EE_Register_Addon::register()), keys are
43
-     * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
44
-     * Generally this should be used sparingly, as we don't want to muddle up
45
-     * EE core with knowledge of ALL the addons out there.
46
-     * If you want NO versions of an addon to run with a certain version of core,
47
-     * it's usually best to define the addon's "min_core_version" as part of its call
48
-     * to EE_Register_Addon::register(), rather than using this array with a super high value for its
49
-     * minimum plugin version.
50
-     * @access    protected
51
-     */
52
-    protected static $_incompatible_addons = array(
53
-        'Multi_Event_Registration' => '2.0.11.rc.002',
54
-        'Promotions'               => '1.0.0.rc.084',
55
-    );
40
+	/**
41
+	 * @var  array $_incompatible_addons keys are addon SLUGS
42
+	 * (first argument passed to EE_Register_Addon::register()), keys are
43
+	 * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
44
+	 * Generally this should be used sparingly, as we don't want to muddle up
45
+	 * EE core with knowledge of ALL the addons out there.
46
+	 * If you want NO versions of an addon to run with a certain version of core,
47
+	 * it's usually best to define the addon's "min_core_version" as part of its call
48
+	 * to EE_Register_Addon::register(), rather than using this array with a super high value for its
49
+	 * minimum plugin version.
50
+	 * @access    protected
51
+	 */
52
+	protected static $_incompatible_addons = array(
53
+		'Multi_Event_Registration' => '2.0.11.rc.002',
54
+		'Promotions'               => '1.0.0.rc.084',
55
+	);
56 56
 
57 57
 
58
-    /**
59
-     * We should always be comparing core to a version like '4.3.0.rc.000',
60
-     * not just '4.3.0'.
61
-     * So if the addon developer doesn't provide that full version string,
62
-     * fill in the blanks for them
63
-     *
64
-     * @param string $min_core_version
65
-     * @return string always like '4.3.0.rc.000'
66
-     */
67
-    protected static function _effective_version($min_core_version)
68
-    {
69
-        // versions: 4 . 3 . 1 . p . 123
70
-        // offsets:    0 . 1 . 2 . 3 . 4
71
-        $version_parts = explode('.', $min_core_version);
72
-        // check they specified the micro version (after 2nd period)
73
-        if (! isset($version_parts[2])) {
74
-            $version_parts[2] = '0';
75
-        }
76
-        // if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
77
-        // soon we can assume that's 'rc', but this current version is 'alpha'
78
-        if (! isset($version_parts[3])) {
79
-            $version_parts[3] = 'dev';
80
-        }
81
-        if (! isset($version_parts[4])) {
82
-            $version_parts[4] = '000';
83
-        }
84
-        return implode('.', $version_parts);
85
-    }
58
+	/**
59
+	 * We should always be comparing core to a version like '4.3.0.rc.000',
60
+	 * not just '4.3.0'.
61
+	 * So if the addon developer doesn't provide that full version string,
62
+	 * fill in the blanks for them
63
+	 *
64
+	 * @param string $min_core_version
65
+	 * @return string always like '4.3.0.rc.000'
66
+	 */
67
+	protected static function _effective_version($min_core_version)
68
+	{
69
+		// versions: 4 . 3 . 1 . p . 123
70
+		// offsets:    0 . 1 . 2 . 3 . 4
71
+		$version_parts = explode('.', $min_core_version);
72
+		// check they specified the micro version (after 2nd period)
73
+		if (! isset($version_parts[2])) {
74
+			$version_parts[2] = '0';
75
+		}
76
+		// if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
77
+		// soon we can assume that's 'rc', but this current version is 'alpha'
78
+		if (! isset($version_parts[3])) {
79
+			$version_parts[3] = 'dev';
80
+		}
81
+		if (! isset($version_parts[4])) {
82
+			$version_parts[4] = '000';
83
+		}
84
+		return implode('.', $version_parts);
85
+	}
86 86
 
87 87
 
88
-    /**
89
-     * Returns whether or not the min core version requirement of the addon is met
90
-     *
91
-     * @param string $min_core_version    the minimum core version required by the addon
92
-     * @param string $actual_core_version the actual core version, optional
93
-     * @return boolean
94
-     */
95
-    public static function _meets_min_core_version_requirement(
96
-        $min_core_version,
97
-        $actual_core_version = EVENT_ESPRESSO_VERSION
98
-    ) {
99
-        return version_compare(
100
-            self::_effective_version($actual_core_version),
101
-            self::_effective_version($min_core_version),
102
-            '>='
103
-        );
104
-    }
88
+	/**
89
+	 * Returns whether or not the min core version requirement of the addon is met
90
+	 *
91
+	 * @param string $min_core_version    the minimum core version required by the addon
92
+	 * @param string $actual_core_version the actual core version, optional
93
+	 * @return boolean
94
+	 */
95
+	public static function _meets_min_core_version_requirement(
96
+		$min_core_version,
97
+		$actual_core_version = EVENT_ESPRESSO_VERSION
98
+	) {
99
+		return version_compare(
100
+			self::_effective_version($actual_core_version),
101
+			self::_effective_version($min_core_version),
102
+			'>='
103
+		);
104
+	}
105 105
 
106 106
 
107
-    /**
108
-     * Method for registering new EE_Addons.
109
-     * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
110
-     * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
111
-     * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
112
-     * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
113
-     * 'activate_plugin', it registers the addon still, but its components are not registered
114
-     * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
115
-     * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
116
-     * (so that we can detect that the addon has activated on the subsequent request)
117
-     *
118
-     * @since    4.3.0
119
-     * @param string                  $addon_name                       [Required] the EE_Addon's name.
120
-     * @param  array                  $setup_args                       {
121
-     *                                                                  An array of arguments provided for registering
122
-     *                                                                  the message type.
123
-     * @type  string                  $class_name                       the addon's main file name.
124
-     *                                                                  If left blank, generated from the addon name,
125
-     *                                                                  changes something like "calendar" to
126
-     *                                                                  "EE_Calendar"
127
-     * @type string                   $min_core_version                 the minimum version of EE Core that the
128
-     *                                                                  addon will work with. eg "4.8.1.rc.084"
129
-     * @type string                   $version                          the "software" version for the addon. eg
130
-     *                                                                  "1.0.0.p" for a first stable release, or
131
-     *                                                                  "1.0.0.rc.043" for a version in progress
132
-     * @type string                   $main_file_path                   the full server path to the main file
133
-     *                                                                  loaded directly by WP
134
-     * @type DomainInterface $domain                                    child class of
135
-     *                                                                  EventEspresso\core\domain\DomainBase
136
-     * @type string                   $domain_fqcn                      Fully Qualified Class Name
137
-     *                                                                  for the addon's Domain class
138
-     *                                                                  (see EventEspresso\core\domain\Domain)
139
-     * @type string                   $admin_path                       full server path to the folder where the
140
-     *                                                                  addon\'s admin files reside
141
-     * @type string                   $admin_callback                   a method to be called when the EE Admin is
142
-     *                                                                  first invoked, can be used for hooking into
143
-     *                                                                  any admin page
144
-     * @type string                   $config_section                   the section name for this addon's
145
-     *                                                                  configuration settings section
146
-     *                                                                  (defaults to "addons")
147
-     * @type string                   $config_class                     the class name for this addon's
148
-     *                                                                  configuration settings object
149
-     * @type string                   $config_name                      the class name for this addon's
150
-     *                                                                  configuration settings object
151
-     * @type string                   $autoloader_paths                 [Required] an array of class names and the full
152
-     *                                                                  server paths to those files.
153
-     * @type string                   $autoloader_folders               an array of  "full server paths" for any
154
-     *                                                                  folders containing classes that might be
155
-     *                                                                  invoked by the addon
156
-     * @type string                   $dms_paths                        [Required] an array of full server paths to
157
-     *                                                                  folders that contain data migration scripts.
158
-     *                                                                  The key should be the EE_Addon class name that
159
-     *                                                                  this set of data migration scripts belongs to.
160
-     *                                                                  If the EE_Addon class is namespaced, then this
161
-     *                                                                  needs to be the Fully Qualified Class Name
162
-     * @type string                   $module_paths                     an array of full server paths to any
163
-     *                                                                  EED_Modules used by the addon
164
-     * @type string                   $shortcode_paths                  an array of full server paths to folders
165
-     *                                                                  that contain EES_Shortcodes
166
-     * @type string                   $widget_paths                     an array of full server paths to folders
167
-     *                                                                  that contain WP_Widgets
168
-     * @type string                   $pue_options
169
-     * @type array                    $capabilities                     an array indexed by role name
170
-     *                                                                  (i.e administrator,author ) and the values
171
-     *                                                                  are an array of caps to add to the role.
172
-     *                                                                  'administrator' => array(
173
-     *                                                                  'read_addon',
174
-     *                                                                  'edit_addon',
175
-     *                                                                  etc.
176
-     *                                                                  ).
177
-     * @type EE_Meta_Capability_Map[] $capability_maps                  an array of EE_Meta_Capability_Map object
178
-     *                                                                  for any addons that need to register any
179
-     *                                                                  special meta mapped capabilities.  Should
180
-     *                                                                  be indexed where the key is the
181
-     *                                                                  EE_Meta_Capability_Map class name and the
182
-     *                                                                  values are the arguments sent to the class.
183
-     * @type array                    $model_paths                      array of folders containing DB models
184
-     * @see      EE_Register_Model
185
-     * @type array                    $class_paths                      array of folders containing DB classes
186
-     * @see      EE_Register_Model
187
-     * @type array                    $model_extension_paths            array of folders containing DB model
188
-     *                                                                  extensions
189
-     * @see      EE_Register_Model_Extension
190
-     * @type array                    $class_extension_paths            array of folders containing DB class
191
-     *                                                                  extensions
192
-     * @see      EE_Register_Model_Extension
193
-     * @type array message_types {
194
-     *                                                                  An array of message types with the key as
195
-     *                                                                  the message type name and the values as
196
-     *                                                                  below:
197
-     * @type string                   $mtfilename                       [Required] The filename of the message type
198
-     *                                                                  being registered. This will be the main
199
-     *                                                                  EE_{Message Type Name}_message_type class.
200
-     *                                                                  for example:
201
-     *                                                                  EE_Declined_Registration_message_type.class.php
202
-     * @type array                    $autoloadpaths                    [Required] An array of paths to add to the
203
-     *                                                                  messages autoloader for the new message type.
204
-     * @type array                    $messengers_to_activate_with      An array of messengers that this message
205
-     *                                                                  type should activate with. Each value in
206
-     *                                                                  the
207
-     *                                                                  array
208
-     *                                                                  should match the name property of a
209
-     *                                                                  EE_messenger. Optional.
210
-     * @type array                    $messengers_to_validate_with      An array of messengers that this message
211
-     *                                                                  type should validate with. Each value in
212
-     *                                                                  the
213
-     *                                                                  array
214
-     *                                                                  should match the name property of an
215
-     *                                                                  EE_messenger.
216
-     *                                                                  Optional.
217
-     *                                                                  }
218
-     * @type array                    $custom_post_types
219
-     * @type array                    $custom_taxonomies
220
-     * @type array                    $payment_method_paths             each element is the folder containing the
221
-     *                                                                  EE_PMT_Base child class
222
-     *                                                                  (eg,
223
-     *                                                                  '/wp-content/plugins/my_plugin/Payomatic/'
224
-     *                                                                  which contains the files
225
-     *                                                                  EE_PMT_Payomatic.pm.php)
226
-     * @type array                    $default_terms
227
-     * @type array                    $namespace                        {
228
-     *                                                                  An array with two items for registering the
229
-     *                                                                  addon's namespace. (If, for some reason, you
230
-     *                                                                  require additional namespaces,
231
-     *                                                                  use
232
-     *                                                                  EventEspresso\core\Psr4Autoloader::addNamespace()
233
-     *                                                                  directly)
234
-     * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
235
-     * @type string                   $FQNS                             the namespace prefix
236
-     * @type string                   $DIR                              a base directory for class files in the
237
-     *                                                                  namespace.
238
-     *                                                                  }
239
-     *                                                                  }
240
-     * @type string                   $privacy_policies                 FQNSs (namespaces, each of which contains only
241
-     *                                                                  privacy policy classes) or FQCNs (specific
242
-     *                                                                  classnames of privacy policy classes)
243
-     * @type string                   $personal_data_exporters          FQNSs (namespaces, each of which contains only
244
-     *                                                                  privacy policy classes) or FQCNs (specific
245
-     *                                                                  classnames of privacy policy classes)
246
-     * @type string                   $personal_data_erasers            FQNSs (namespaces, each of which contains only
247
-     *                                                                  privacy policy classes) or FQCNs (specific
248
-     *                                                                  classnames of privacy policy classes)
249
-     * @return void
250
-     * @throws DomainException
251
-     * @throws EE_Error
252
-     * @throws InvalidArgumentException
253
-     * @throws ReflectionException
254
-     * @throws InvalidDataTypeException
255
-     * @throws InvalidInterfaceException
256
-     */
257
-    public static function register($addon_name = '', $setup_args = array())
258
-    {
259
-        // required fields MUST be present, so let's make sure they are.
260
-        EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
261
-        // get class name for addon
262
-        $class_name = EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
263
-        // setup $_settings array from incoming values.
264
-        $addon_settings = EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
265
-        // setup PUE
266
-        EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
267
-        // does this addon work with this version of core or WordPress ?
268
-        if (! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
269
-            return;
270
-        }
271
-        // register namespaces
272
-        EE_Register_Addon::_setup_namespaces($addon_settings);
273
-        // check if this is an activation request
274
-        if (EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
275
-            // dont bother setting up the rest of the addon atm
276
-            return;
277
-        }
278
-        // we need cars
279
-        EE_Register_Addon::_setup_autoloaders($addon_name);
280
-        // register new models and extensions
281
-        EE_Register_Addon::_register_models_and_extensions($addon_name);
282
-        // setup DMS
283
-        EE_Register_Addon::_register_data_migration_scripts($addon_name);
284
-        // if config_class is present let's register config.
285
-        EE_Register_Addon::_register_config($addon_name);
286
-        // register admin pages
287
-        EE_Register_Addon::_register_admin_pages($addon_name);
288
-        // add to list of modules to be registered
289
-        EE_Register_Addon::_register_modules($addon_name);
290
-        // add to list of shortcodes to be registered
291
-        EE_Register_Addon::_register_shortcodes($addon_name);
292
-        // add to list of widgets to be registered
293
-        EE_Register_Addon::_register_widgets($addon_name);
294
-        // register capability related stuff.
295
-        EE_Register_Addon::_register_capabilities($addon_name);
296
-        // any message type to register?
297
-        EE_Register_Addon::_register_message_types($addon_name);
298
-        // any custom post type/ custom capabilities or default terms to register
299
-        EE_Register_Addon::_register_custom_post_types($addon_name);
300
-        // and any payment methods
301
-        EE_Register_Addon::_register_payment_methods($addon_name);
302
-        // and privacy policy generators
303
-        EE_Register_Addon::registerPrivacyPolicies($addon_name);
304
-        // and privacy policy generators
305
-        EE_Register_Addon::registerPersonalDataExporters($addon_name);
306
-        // and privacy policy generators
307
-        EE_Register_Addon::registerPersonalDataErasers($addon_name);
308
-        // load and instantiate main addon class
309
-        $addon = EE_Register_Addon::_load_and_init_addon_class($addon_name);
310
-        // delay calling after_registration hook on each addon until after all add-ons have been registered.
311
-        add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
312
-    }
107
+	/**
108
+	 * Method for registering new EE_Addons.
109
+	 * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
110
+	 * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
111
+	 * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
112
+	 * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
113
+	 * 'activate_plugin', it registers the addon still, but its components are not registered
114
+	 * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
115
+	 * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
116
+	 * (so that we can detect that the addon has activated on the subsequent request)
117
+	 *
118
+	 * @since    4.3.0
119
+	 * @param string                  $addon_name                       [Required] the EE_Addon's name.
120
+	 * @param  array                  $setup_args                       {
121
+	 *                                                                  An array of arguments provided for registering
122
+	 *                                                                  the message type.
123
+	 * @type  string                  $class_name                       the addon's main file name.
124
+	 *                                                                  If left blank, generated from the addon name,
125
+	 *                                                                  changes something like "calendar" to
126
+	 *                                                                  "EE_Calendar"
127
+	 * @type string                   $min_core_version                 the minimum version of EE Core that the
128
+	 *                                                                  addon will work with. eg "4.8.1.rc.084"
129
+	 * @type string                   $version                          the "software" version for the addon. eg
130
+	 *                                                                  "1.0.0.p" for a first stable release, or
131
+	 *                                                                  "1.0.0.rc.043" for a version in progress
132
+	 * @type string                   $main_file_path                   the full server path to the main file
133
+	 *                                                                  loaded directly by WP
134
+	 * @type DomainInterface $domain                                    child class of
135
+	 *                                                                  EventEspresso\core\domain\DomainBase
136
+	 * @type string                   $domain_fqcn                      Fully Qualified Class Name
137
+	 *                                                                  for the addon's Domain class
138
+	 *                                                                  (see EventEspresso\core\domain\Domain)
139
+	 * @type string                   $admin_path                       full server path to the folder where the
140
+	 *                                                                  addon\'s admin files reside
141
+	 * @type string                   $admin_callback                   a method to be called when the EE Admin is
142
+	 *                                                                  first invoked, can be used for hooking into
143
+	 *                                                                  any admin page
144
+	 * @type string                   $config_section                   the section name for this addon's
145
+	 *                                                                  configuration settings section
146
+	 *                                                                  (defaults to "addons")
147
+	 * @type string                   $config_class                     the class name for this addon's
148
+	 *                                                                  configuration settings object
149
+	 * @type string                   $config_name                      the class name for this addon's
150
+	 *                                                                  configuration settings object
151
+	 * @type string                   $autoloader_paths                 [Required] an array of class names and the full
152
+	 *                                                                  server paths to those files.
153
+	 * @type string                   $autoloader_folders               an array of  "full server paths" for any
154
+	 *                                                                  folders containing classes that might be
155
+	 *                                                                  invoked by the addon
156
+	 * @type string                   $dms_paths                        [Required] an array of full server paths to
157
+	 *                                                                  folders that contain data migration scripts.
158
+	 *                                                                  The key should be the EE_Addon class name that
159
+	 *                                                                  this set of data migration scripts belongs to.
160
+	 *                                                                  If the EE_Addon class is namespaced, then this
161
+	 *                                                                  needs to be the Fully Qualified Class Name
162
+	 * @type string                   $module_paths                     an array of full server paths to any
163
+	 *                                                                  EED_Modules used by the addon
164
+	 * @type string                   $shortcode_paths                  an array of full server paths to folders
165
+	 *                                                                  that contain EES_Shortcodes
166
+	 * @type string                   $widget_paths                     an array of full server paths to folders
167
+	 *                                                                  that contain WP_Widgets
168
+	 * @type string                   $pue_options
169
+	 * @type array                    $capabilities                     an array indexed by role name
170
+	 *                                                                  (i.e administrator,author ) and the values
171
+	 *                                                                  are an array of caps to add to the role.
172
+	 *                                                                  'administrator' => array(
173
+	 *                                                                  'read_addon',
174
+	 *                                                                  'edit_addon',
175
+	 *                                                                  etc.
176
+	 *                                                                  ).
177
+	 * @type EE_Meta_Capability_Map[] $capability_maps                  an array of EE_Meta_Capability_Map object
178
+	 *                                                                  for any addons that need to register any
179
+	 *                                                                  special meta mapped capabilities.  Should
180
+	 *                                                                  be indexed where the key is the
181
+	 *                                                                  EE_Meta_Capability_Map class name and the
182
+	 *                                                                  values are the arguments sent to the class.
183
+	 * @type array                    $model_paths                      array of folders containing DB models
184
+	 * @see      EE_Register_Model
185
+	 * @type array                    $class_paths                      array of folders containing DB classes
186
+	 * @see      EE_Register_Model
187
+	 * @type array                    $model_extension_paths            array of folders containing DB model
188
+	 *                                                                  extensions
189
+	 * @see      EE_Register_Model_Extension
190
+	 * @type array                    $class_extension_paths            array of folders containing DB class
191
+	 *                                                                  extensions
192
+	 * @see      EE_Register_Model_Extension
193
+	 * @type array message_types {
194
+	 *                                                                  An array of message types with the key as
195
+	 *                                                                  the message type name and the values as
196
+	 *                                                                  below:
197
+	 * @type string                   $mtfilename                       [Required] The filename of the message type
198
+	 *                                                                  being registered. This will be the main
199
+	 *                                                                  EE_{Message Type Name}_message_type class.
200
+	 *                                                                  for example:
201
+	 *                                                                  EE_Declined_Registration_message_type.class.php
202
+	 * @type array                    $autoloadpaths                    [Required] An array of paths to add to the
203
+	 *                                                                  messages autoloader for the new message type.
204
+	 * @type array                    $messengers_to_activate_with      An array of messengers that this message
205
+	 *                                                                  type should activate with. Each value in
206
+	 *                                                                  the
207
+	 *                                                                  array
208
+	 *                                                                  should match the name property of a
209
+	 *                                                                  EE_messenger. Optional.
210
+	 * @type array                    $messengers_to_validate_with      An array of messengers that this message
211
+	 *                                                                  type should validate with. Each value in
212
+	 *                                                                  the
213
+	 *                                                                  array
214
+	 *                                                                  should match the name property of an
215
+	 *                                                                  EE_messenger.
216
+	 *                                                                  Optional.
217
+	 *                                                                  }
218
+	 * @type array                    $custom_post_types
219
+	 * @type array                    $custom_taxonomies
220
+	 * @type array                    $payment_method_paths             each element is the folder containing the
221
+	 *                                                                  EE_PMT_Base child class
222
+	 *                                                                  (eg,
223
+	 *                                                                  '/wp-content/plugins/my_plugin/Payomatic/'
224
+	 *                                                                  which contains the files
225
+	 *                                                                  EE_PMT_Payomatic.pm.php)
226
+	 * @type array                    $default_terms
227
+	 * @type array                    $namespace                        {
228
+	 *                                                                  An array with two items for registering the
229
+	 *                                                                  addon's namespace. (If, for some reason, you
230
+	 *                                                                  require additional namespaces,
231
+	 *                                                                  use
232
+	 *                                                                  EventEspresso\core\Psr4Autoloader::addNamespace()
233
+	 *                                                                  directly)
234
+	 * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
235
+	 * @type string                   $FQNS                             the namespace prefix
236
+	 * @type string                   $DIR                              a base directory for class files in the
237
+	 *                                                                  namespace.
238
+	 *                                                                  }
239
+	 *                                                                  }
240
+	 * @type string                   $privacy_policies                 FQNSs (namespaces, each of which contains only
241
+	 *                                                                  privacy policy classes) or FQCNs (specific
242
+	 *                                                                  classnames of privacy policy classes)
243
+	 * @type string                   $personal_data_exporters          FQNSs (namespaces, each of which contains only
244
+	 *                                                                  privacy policy classes) or FQCNs (specific
245
+	 *                                                                  classnames of privacy policy classes)
246
+	 * @type string                   $personal_data_erasers            FQNSs (namespaces, each of which contains only
247
+	 *                                                                  privacy policy classes) or FQCNs (specific
248
+	 *                                                                  classnames of privacy policy classes)
249
+	 * @return void
250
+	 * @throws DomainException
251
+	 * @throws EE_Error
252
+	 * @throws InvalidArgumentException
253
+	 * @throws ReflectionException
254
+	 * @throws InvalidDataTypeException
255
+	 * @throws InvalidInterfaceException
256
+	 */
257
+	public static function register($addon_name = '', $setup_args = array())
258
+	{
259
+		// required fields MUST be present, so let's make sure they are.
260
+		EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
261
+		// get class name for addon
262
+		$class_name = EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
263
+		// setup $_settings array from incoming values.
264
+		$addon_settings = EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
265
+		// setup PUE
266
+		EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
267
+		// does this addon work with this version of core or WordPress ?
268
+		if (! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
269
+			return;
270
+		}
271
+		// register namespaces
272
+		EE_Register_Addon::_setup_namespaces($addon_settings);
273
+		// check if this is an activation request
274
+		if (EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
275
+			// dont bother setting up the rest of the addon atm
276
+			return;
277
+		}
278
+		// we need cars
279
+		EE_Register_Addon::_setup_autoloaders($addon_name);
280
+		// register new models and extensions
281
+		EE_Register_Addon::_register_models_and_extensions($addon_name);
282
+		// setup DMS
283
+		EE_Register_Addon::_register_data_migration_scripts($addon_name);
284
+		// if config_class is present let's register config.
285
+		EE_Register_Addon::_register_config($addon_name);
286
+		// register admin pages
287
+		EE_Register_Addon::_register_admin_pages($addon_name);
288
+		// add to list of modules to be registered
289
+		EE_Register_Addon::_register_modules($addon_name);
290
+		// add to list of shortcodes to be registered
291
+		EE_Register_Addon::_register_shortcodes($addon_name);
292
+		// add to list of widgets to be registered
293
+		EE_Register_Addon::_register_widgets($addon_name);
294
+		// register capability related stuff.
295
+		EE_Register_Addon::_register_capabilities($addon_name);
296
+		// any message type to register?
297
+		EE_Register_Addon::_register_message_types($addon_name);
298
+		// any custom post type/ custom capabilities or default terms to register
299
+		EE_Register_Addon::_register_custom_post_types($addon_name);
300
+		// and any payment methods
301
+		EE_Register_Addon::_register_payment_methods($addon_name);
302
+		// and privacy policy generators
303
+		EE_Register_Addon::registerPrivacyPolicies($addon_name);
304
+		// and privacy policy generators
305
+		EE_Register_Addon::registerPersonalDataExporters($addon_name);
306
+		// and privacy policy generators
307
+		EE_Register_Addon::registerPersonalDataErasers($addon_name);
308
+		// load and instantiate main addon class
309
+		$addon = EE_Register_Addon::_load_and_init_addon_class($addon_name);
310
+		// delay calling after_registration hook on each addon until after all add-ons have been registered.
311
+		add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
312
+	}
313 313
 
314 314
 
315
-    /**
316
-     * @param string $addon_name
317
-     * @param array  $setup_args
318
-     * @return void
319
-     * @throws EE_Error
320
-     */
321
-    private static function _verify_parameters($addon_name, array $setup_args)
322
-    {
323
-        // required fields MUST be present, so let's make sure they are.
324
-        if (empty($addon_name) || ! is_array($setup_args)) {
325
-            throw new EE_Error(
326
-                __(
327
-                    'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
328
-                    'event_espresso'
329
-                )
330
-            );
331
-        }
332
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
333
-            throw new EE_Error(
334
-                sprintf(
335
-                    __(
336
-                        'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
337
-                        'event_espresso'
338
-                    ),
339
-                    implode(',', array_keys($setup_args))
340
-                )
341
-            );
342
-        }
343
-        // check that addon has not already been registered with that name
344
-        if (isset(self::$_settings[ $addon_name ]) && ! did_action('activate_plugin')) {
345
-            throw new EE_Error(
346
-                sprintf(
347
-                    __(
348
-                        'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
349
-                        'event_espresso'
350
-                    ),
351
-                    $addon_name
352
-                )
353
-            );
354
-        }
355
-    }
315
+	/**
316
+	 * @param string $addon_name
317
+	 * @param array  $setup_args
318
+	 * @return void
319
+	 * @throws EE_Error
320
+	 */
321
+	private static function _verify_parameters($addon_name, array $setup_args)
322
+	{
323
+		// required fields MUST be present, so let's make sure they are.
324
+		if (empty($addon_name) || ! is_array($setup_args)) {
325
+			throw new EE_Error(
326
+				__(
327
+					'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
328
+					'event_espresso'
329
+				)
330
+			);
331
+		}
332
+		if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
333
+			throw new EE_Error(
334
+				sprintf(
335
+					__(
336
+						'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
337
+						'event_espresso'
338
+					),
339
+					implode(',', array_keys($setup_args))
340
+				)
341
+			);
342
+		}
343
+		// check that addon has not already been registered with that name
344
+		if (isset(self::$_settings[ $addon_name ]) && ! did_action('activate_plugin')) {
345
+			throw new EE_Error(
346
+				sprintf(
347
+					__(
348
+						'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
349
+						'event_espresso'
350
+					),
351
+					$addon_name
352
+				)
353
+			);
354
+		}
355
+	}
356 356
 
357 357
 
358
-    /**
359
-     * @param string $addon_name
360
-     * @param array  $setup_args
361
-     * @return string
362
-     */
363
-    private static function _parse_class_name($addon_name, array $setup_args)
364
-    {
365
-        if (empty($setup_args['class_name'])) {
366
-            // generate one by first separating name with spaces
367
-            $class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
368
-            // capitalize, then replace spaces with underscores
369
-            $class_name = str_replace(' ', '_', ucwords($class_name));
370
-        } else {
371
-            $class_name = $setup_args['class_name'];
372
-        }
373
-        // check if classname is fully  qualified or is a legacy classname already prefixed with 'EE_'
374
-        return strpos($class_name, '\\') || strpos($class_name, 'EE_') === 0
375
-            ? $class_name
376
-            : 'EE_' . $class_name;
377
-    }
358
+	/**
359
+	 * @param string $addon_name
360
+	 * @param array  $setup_args
361
+	 * @return string
362
+	 */
363
+	private static function _parse_class_name($addon_name, array $setup_args)
364
+	{
365
+		if (empty($setup_args['class_name'])) {
366
+			// generate one by first separating name with spaces
367
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
368
+			// capitalize, then replace spaces with underscores
369
+			$class_name = str_replace(' ', '_', ucwords($class_name));
370
+		} else {
371
+			$class_name = $setup_args['class_name'];
372
+		}
373
+		// check if classname is fully  qualified or is a legacy classname already prefixed with 'EE_'
374
+		return strpos($class_name, '\\') || strpos($class_name, 'EE_') === 0
375
+			? $class_name
376
+			: 'EE_' . $class_name;
377
+	}
378 378
 
379 379
 
380
-    /**
381
-     * @param string $class_name
382
-     * @param array  $setup_args
383
-     * @return array
384
-     */
385
-    private static function _get_addon_settings($class_name, array $setup_args)
386
-    {
387
-        // setup $_settings array from incoming values.
388
-        $addon_settings = array(
389
-            // generated from the addon name, changes something like "calendar" to "EE_Calendar"
390
-            'class_name'            => $class_name,
391
-            // the addon slug for use in URLs, etc
392
-            'plugin_slug'           => isset($setup_args['plugin_slug'])
393
-                ? (string) $setup_args['plugin_slug']
394
-                : '',
395
-            // page slug to be used when generating the "Settings" link on the WP plugin page
396
-            'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
397
-                ? (string) $setup_args['plugin_action_slug']
398
-                : '',
399
-            // the "software" version for the addon
400
-            'version'               => isset($setup_args['version'])
401
-                ? (string) $setup_args['version']
402
-                : '',
403
-            // the minimum version of EE Core that the addon will work with
404
-            'min_core_version'      => isset($setup_args['min_core_version'])
405
-                ? (string) $setup_args['min_core_version']
406
-                : '',
407
-            // the minimum version of WordPress that the addon will work with
408
-            'min_wp_version'        => isset($setup_args['min_wp_version'])
409
-                ? (string) $setup_args['min_wp_version']
410
-                : EE_MIN_WP_VER_REQUIRED,
411
-            // full server path to main file (file loaded directly by WP)
412
-            'main_file_path'        => isset($setup_args['main_file_path'])
413
-                ? (string) $setup_args['main_file_path']
414
-                : '',
415
-            // instance of \EventEspresso\core\domain\DomainInterface
416
-            'domain'                => isset($setup_args['domain']) && $setup_args['domain'] instanceof DomainInterface
417
-                ? $setup_args['domain']
418
-                : null,
419
-            // Fully Qualified Class Name for the addon's Domain class
420
-            'domain_fqcn'           => isset($setup_args['domain_fqcn'])
421
-                ? (string) $setup_args['domain_fqcn']
422
-                : '',
423
-            // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
424
-            'admin_path'            => isset($setup_args['admin_path'])
425
-                ? (string) $setup_args['admin_path'] : '',
426
-            // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
427
-            'admin_callback'        => isset($setup_args['admin_callback'])
428
-                ? (string) $setup_args['admin_callback']
429
-                : '',
430
-            // the section name for this addon's configuration settings section (defaults to "addons")
431
-            'config_section'        => isset($setup_args['config_section'])
432
-                ? (string) $setup_args['config_section']
433
-                : 'addons',
434
-            // the class name for this addon's configuration settings object
435
-            'config_class'          => isset($setup_args['config_class'])
436
-                ? (string) $setup_args['config_class'] : '',
437
-            // the name given to the config for this addons' configuration settings object (optional)
438
-            'config_name'           => isset($setup_args['config_name'])
439
-                ? (string) $setup_args['config_name'] : '',
440
-            // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
441
-            'autoloader_paths'      => isset($setup_args['autoloader_paths'])
442
-                ? (array) $setup_args['autoloader_paths']
443
-                : array(),
444
-            // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
445
-            'autoloader_folders'    => isset($setup_args['autoloader_folders'])
446
-                ? (array) $setup_args['autoloader_folders']
447
-                : array(),
448
-            // array of full server paths to any EE_DMS data migration scripts used by the addon.
449
-            // The key should be the EE_Addon class name that this set of data migration scripts belongs to.
450
-            // If the EE_Addon class is namespaced, then this needs to be the Fully Qualified Class Name
451
-            'dms_paths'             => isset($setup_args['dms_paths'])
452
-                ? (array) $setup_args['dms_paths']
453
-                : array(),
454
-            // array of full server paths to any EED_Modules used by the addon
455
-            'module_paths'          => isset($setup_args['module_paths'])
456
-                ? (array) $setup_args['module_paths']
457
-                : array(),
458
-            // array of full server paths to any EES_Shortcodes used by the addon
459
-            'shortcode_paths'       => isset($setup_args['shortcode_paths'])
460
-                ? (array) $setup_args['shortcode_paths']
461
-                : array(),
462
-            'shortcode_fqcns'       => isset($setup_args['shortcode_fqcns'])
463
-                ? (array) $setup_args['shortcode_fqcns']
464
-                : array(),
465
-            // array of full server paths to any WP_Widgets used by the addon
466
-            'widget_paths'          => isset($setup_args['widget_paths'])
467
-                ? (array) $setup_args['widget_paths']
468
-                : array(),
469
-            // array of PUE options used by the addon
470
-            'pue_options'           => isset($setup_args['pue_options'])
471
-                ? (array) $setup_args['pue_options']
472
-                : array(),
473
-            'message_types'         => isset($setup_args['message_types'])
474
-                ? (array) $setup_args['message_types']
475
-                : array(),
476
-            'capabilities'          => isset($setup_args['capabilities'])
477
-                ? (array) $setup_args['capabilities']
478
-                : array(),
479
-            'capability_maps'       => isset($setup_args['capability_maps'])
480
-                ? (array) $setup_args['capability_maps']
481
-                : array(),
482
-            'model_paths'           => isset($setup_args['model_paths'])
483
-                ? (array) $setup_args['model_paths']
484
-                : array(),
485
-            'class_paths'           => isset($setup_args['class_paths'])
486
-                ? (array) $setup_args['class_paths']
487
-                : array(),
488
-            'model_extension_paths' => isset($setup_args['model_extension_paths'])
489
-                ? (array) $setup_args['model_extension_paths']
490
-                : array(),
491
-            'class_extension_paths' => isset($setup_args['class_extension_paths'])
492
-                ? (array) $setup_args['class_extension_paths']
493
-                : array(),
494
-            'custom_post_types'     => isset($setup_args['custom_post_types'])
495
-                ? (array) $setup_args['custom_post_types']
496
-                : array(),
497
-            'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
498
-                ? (array) $setup_args['custom_taxonomies']
499
-                : array(),
500
-            'payment_method_paths'  => isset($setup_args['payment_method_paths'])
501
-                ? (array) $setup_args['payment_method_paths']
502
-                : array(),
503
-            'default_terms'         => isset($setup_args['default_terms'])
504
-                ? (array) $setup_args['default_terms']
505
-                : array(),
506
-            // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
507
-            // that can be used for adding upgrading/marketing info
508
-            'plugins_page_row'      => isset($setup_args['plugins_page_row'])
509
-                ? $setup_args['plugins_page_row']
510
-                : '',
511
-            'namespace'             => isset(
512
-                $setup_args['namespace']['FQNS'],
513
-                $setup_args['namespace']['DIR']
514
-            )
515
-                ? (array) $setup_args['namespace']
516
-                : array(),
517
-            'privacy_policies'      => isset($setup_args['privacy_policies'])
518
-                ? (array) $setup_args['privacy_policies']
519
-                : '',
520
-        );
521
-        // if plugin_action_slug is NOT set, but an admin page path IS set,
522
-        // then let's just use the plugin_slug since that will be used for linking to the admin page
523
-        $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
524
-                                                && ! empty($addon_settings['admin_path'])
525
-            ? $addon_settings['plugin_slug']
526
-            : $addon_settings['plugin_action_slug'];
527
-        // full server path to main file (file loaded directly by WP)
528
-        $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
529
-        return $addon_settings;
530
-    }
380
+	/**
381
+	 * @param string $class_name
382
+	 * @param array  $setup_args
383
+	 * @return array
384
+	 */
385
+	private static function _get_addon_settings($class_name, array $setup_args)
386
+	{
387
+		// setup $_settings array from incoming values.
388
+		$addon_settings = array(
389
+			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
390
+			'class_name'            => $class_name,
391
+			// the addon slug for use in URLs, etc
392
+			'plugin_slug'           => isset($setup_args['plugin_slug'])
393
+				? (string) $setup_args['plugin_slug']
394
+				: '',
395
+			// page slug to be used when generating the "Settings" link on the WP plugin page
396
+			'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
397
+				? (string) $setup_args['plugin_action_slug']
398
+				: '',
399
+			// the "software" version for the addon
400
+			'version'               => isset($setup_args['version'])
401
+				? (string) $setup_args['version']
402
+				: '',
403
+			// the minimum version of EE Core that the addon will work with
404
+			'min_core_version'      => isset($setup_args['min_core_version'])
405
+				? (string) $setup_args['min_core_version']
406
+				: '',
407
+			// the minimum version of WordPress that the addon will work with
408
+			'min_wp_version'        => isset($setup_args['min_wp_version'])
409
+				? (string) $setup_args['min_wp_version']
410
+				: EE_MIN_WP_VER_REQUIRED,
411
+			// full server path to main file (file loaded directly by WP)
412
+			'main_file_path'        => isset($setup_args['main_file_path'])
413
+				? (string) $setup_args['main_file_path']
414
+				: '',
415
+			// instance of \EventEspresso\core\domain\DomainInterface
416
+			'domain'                => isset($setup_args['domain']) && $setup_args['domain'] instanceof DomainInterface
417
+				? $setup_args['domain']
418
+				: null,
419
+			// Fully Qualified Class Name for the addon's Domain class
420
+			'domain_fqcn'           => isset($setup_args['domain_fqcn'])
421
+				? (string) $setup_args['domain_fqcn']
422
+				: '',
423
+			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
424
+			'admin_path'            => isset($setup_args['admin_path'])
425
+				? (string) $setup_args['admin_path'] : '',
426
+			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
427
+			'admin_callback'        => isset($setup_args['admin_callback'])
428
+				? (string) $setup_args['admin_callback']
429
+				: '',
430
+			// the section name for this addon's configuration settings section (defaults to "addons")
431
+			'config_section'        => isset($setup_args['config_section'])
432
+				? (string) $setup_args['config_section']
433
+				: 'addons',
434
+			// the class name for this addon's configuration settings object
435
+			'config_class'          => isset($setup_args['config_class'])
436
+				? (string) $setup_args['config_class'] : '',
437
+			// the name given to the config for this addons' configuration settings object (optional)
438
+			'config_name'           => isset($setup_args['config_name'])
439
+				? (string) $setup_args['config_name'] : '',
440
+			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
441
+			'autoloader_paths'      => isset($setup_args['autoloader_paths'])
442
+				? (array) $setup_args['autoloader_paths']
443
+				: array(),
444
+			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
445
+			'autoloader_folders'    => isset($setup_args['autoloader_folders'])
446
+				? (array) $setup_args['autoloader_folders']
447
+				: array(),
448
+			// array of full server paths to any EE_DMS data migration scripts used by the addon.
449
+			// The key should be the EE_Addon class name that this set of data migration scripts belongs to.
450
+			// If the EE_Addon class is namespaced, then this needs to be the Fully Qualified Class Name
451
+			'dms_paths'             => isset($setup_args['dms_paths'])
452
+				? (array) $setup_args['dms_paths']
453
+				: array(),
454
+			// array of full server paths to any EED_Modules used by the addon
455
+			'module_paths'          => isset($setup_args['module_paths'])
456
+				? (array) $setup_args['module_paths']
457
+				: array(),
458
+			// array of full server paths to any EES_Shortcodes used by the addon
459
+			'shortcode_paths'       => isset($setup_args['shortcode_paths'])
460
+				? (array) $setup_args['shortcode_paths']
461
+				: array(),
462
+			'shortcode_fqcns'       => isset($setup_args['shortcode_fqcns'])
463
+				? (array) $setup_args['shortcode_fqcns']
464
+				: array(),
465
+			// array of full server paths to any WP_Widgets used by the addon
466
+			'widget_paths'          => isset($setup_args['widget_paths'])
467
+				? (array) $setup_args['widget_paths']
468
+				: array(),
469
+			// array of PUE options used by the addon
470
+			'pue_options'           => isset($setup_args['pue_options'])
471
+				? (array) $setup_args['pue_options']
472
+				: array(),
473
+			'message_types'         => isset($setup_args['message_types'])
474
+				? (array) $setup_args['message_types']
475
+				: array(),
476
+			'capabilities'          => isset($setup_args['capabilities'])
477
+				? (array) $setup_args['capabilities']
478
+				: array(),
479
+			'capability_maps'       => isset($setup_args['capability_maps'])
480
+				? (array) $setup_args['capability_maps']
481
+				: array(),
482
+			'model_paths'           => isset($setup_args['model_paths'])
483
+				? (array) $setup_args['model_paths']
484
+				: array(),
485
+			'class_paths'           => isset($setup_args['class_paths'])
486
+				? (array) $setup_args['class_paths']
487
+				: array(),
488
+			'model_extension_paths' => isset($setup_args['model_extension_paths'])
489
+				? (array) $setup_args['model_extension_paths']
490
+				: array(),
491
+			'class_extension_paths' => isset($setup_args['class_extension_paths'])
492
+				? (array) $setup_args['class_extension_paths']
493
+				: array(),
494
+			'custom_post_types'     => isset($setup_args['custom_post_types'])
495
+				? (array) $setup_args['custom_post_types']
496
+				: array(),
497
+			'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
498
+				? (array) $setup_args['custom_taxonomies']
499
+				: array(),
500
+			'payment_method_paths'  => isset($setup_args['payment_method_paths'])
501
+				? (array) $setup_args['payment_method_paths']
502
+				: array(),
503
+			'default_terms'         => isset($setup_args['default_terms'])
504
+				? (array) $setup_args['default_terms']
505
+				: array(),
506
+			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page
507
+			// that can be used for adding upgrading/marketing info
508
+			'plugins_page_row'      => isset($setup_args['plugins_page_row'])
509
+				? $setup_args['plugins_page_row']
510
+				: '',
511
+			'namespace'             => isset(
512
+				$setup_args['namespace']['FQNS'],
513
+				$setup_args['namespace']['DIR']
514
+			)
515
+				? (array) $setup_args['namespace']
516
+				: array(),
517
+			'privacy_policies'      => isset($setup_args['privacy_policies'])
518
+				? (array) $setup_args['privacy_policies']
519
+				: '',
520
+		);
521
+		// if plugin_action_slug is NOT set, but an admin page path IS set,
522
+		// then let's just use the plugin_slug since that will be used for linking to the admin page
523
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
524
+												&& ! empty($addon_settings['admin_path'])
525
+			? $addon_settings['plugin_slug']
526
+			: $addon_settings['plugin_action_slug'];
527
+		// full server path to main file (file loaded directly by WP)
528
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
529
+		return $addon_settings;
530
+	}
531 531
 
532 532
 
533
-    /**
534
-     * @param string $addon_name
535
-     * @param array  $addon_settings
536
-     * @return boolean
537
-     */
538
-    private static function _addon_is_compatible($addon_name, array $addon_settings)
539
-    {
540
-        global $wp_version;
541
-        $incompatibility_message = '';
542
-        // check whether this addon version is compatible with EE core
543
-        if (isset(EE_Register_Addon::$_incompatible_addons[ $addon_name ])
544
-            && ! self::_meets_min_core_version_requirement(
545
-                EE_Register_Addon::$_incompatible_addons[ $addon_name ],
546
-                $addon_settings['version']
547
-            )
548
-        ) {
549
-            $incompatibility_message = sprintf(
550
-                __(
551
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.',
552
-                    'event_espresso'
553
-                ),
554
-                $addon_name,
555
-                '<br />',
556
-                EE_Register_Addon::$_incompatible_addons[ $addon_name ],
557
-                '<span style="font-weight: bold; color: #D54E21;">',
558
-                '</span><br />'
559
-            );
560
-        } elseif (! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
561
-        ) {
562
-            $incompatibility_message = sprintf(
563
-                __(
564
-                    '%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
565
-                    'event_espresso'
566
-                ),
567
-                $addon_name,
568
-                self::_effective_version($addon_settings['min_core_version']),
569
-                self::_effective_version(espresso_version()),
570
-                '<br />',
571
-                '<span style="font-weight: bold; color: #D54E21;">',
572
-                '</span><br />'
573
-            );
574
-        } elseif (RecommendedVersions::compareWordPressVersion($addon_settings['min_wp_version'], '<')) {
575
-            $incompatibility_message = sprintf(
576
-                __(
577
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
578
-                    'event_espresso'
579
-                ),
580
-                $addon_name,
581
-                $addon_settings['min_wp_version'],
582
-                '<br />',
583
-                '<span style="font-weight: bold; color: #D54E21;">',
584
-                '</span><br />'
585
-            );
586
-        }
587
-        if (! empty($incompatibility_message)) {
588
-            // remove 'activate' from the REQUEST
589
-            // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
590
-            unset($_GET['activate'], $_REQUEST['activate']);
591
-            if (current_user_can('activate_plugins')) {
592
-                // show an error message indicating the plugin didn't activate properly
593
-                EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
594
-            }
595
-            // BAIL FROM THE ADDON REGISTRATION PROCESS
596
-            return false;
597
-        }
598
-        // addon IS compatible
599
-        return true;
600
-    }
533
+	/**
534
+	 * @param string $addon_name
535
+	 * @param array  $addon_settings
536
+	 * @return boolean
537
+	 */
538
+	private static function _addon_is_compatible($addon_name, array $addon_settings)
539
+	{
540
+		global $wp_version;
541
+		$incompatibility_message = '';
542
+		// check whether this addon version is compatible with EE core
543
+		if (isset(EE_Register_Addon::$_incompatible_addons[ $addon_name ])
544
+			&& ! self::_meets_min_core_version_requirement(
545
+				EE_Register_Addon::$_incompatible_addons[ $addon_name ],
546
+				$addon_settings['version']
547
+			)
548
+		) {
549
+			$incompatibility_message = sprintf(
550
+				__(
551
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.',
552
+					'event_espresso'
553
+				),
554
+				$addon_name,
555
+				'<br />',
556
+				EE_Register_Addon::$_incompatible_addons[ $addon_name ],
557
+				'<span style="font-weight: bold; color: #D54E21;">',
558
+				'</span><br />'
559
+			);
560
+		} elseif (! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
561
+		) {
562
+			$incompatibility_message = sprintf(
563
+				__(
564
+					'%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
565
+					'event_espresso'
566
+				),
567
+				$addon_name,
568
+				self::_effective_version($addon_settings['min_core_version']),
569
+				self::_effective_version(espresso_version()),
570
+				'<br />',
571
+				'<span style="font-weight: bold; color: #D54E21;">',
572
+				'</span><br />'
573
+			);
574
+		} elseif (RecommendedVersions::compareWordPressVersion($addon_settings['min_wp_version'], '<')) {
575
+			$incompatibility_message = sprintf(
576
+				__(
577
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
578
+					'event_espresso'
579
+				),
580
+				$addon_name,
581
+				$addon_settings['min_wp_version'],
582
+				'<br />',
583
+				'<span style="font-weight: bold; color: #D54E21;">',
584
+				'</span><br />'
585
+			);
586
+		}
587
+		if (! empty($incompatibility_message)) {
588
+			// remove 'activate' from the REQUEST
589
+			// so WP doesn't erroneously tell the user the plugin activated fine when it didn't
590
+			unset($_GET['activate'], $_REQUEST['activate']);
591
+			if (current_user_can('activate_plugins')) {
592
+				// show an error message indicating the plugin didn't activate properly
593
+				EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
594
+			}
595
+			// BAIL FROM THE ADDON REGISTRATION PROCESS
596
+			return false;
597
+		}
598
+		// addon IS compatible
599
+		return true;
600
+	}
601 601
 
602 602
 
603
-    /**
604
-     * if plugin update engine is being used for auto-updates,
605
-     * then let's set that up now before going any further so that ALL addons can be updated
606
-     * (not needed if PUE is not being used)
607
-     *
608
-     * @param string $addon_name
609
-     * @param string $class_name
610
-     * @param array  $setup_args
611
-     * @return void
612
-     */
613
-    private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
614
-    {
615
-        if (! empty($setup_args['pue_options'])) {
616
-            self::$_settings[ $addon_name ]['pue_options'] = array(
617
-                'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
618
-                    ? (string) $setup_args['pue_options']['pue_plugin_slug']
619
-                    : 'espresso_' . strtolower($class_name),
620
-                'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
621
-                    ? (string) $setup_args['pue_options']['plugin_basename']
622
-                    : plugin_basename($setup_args['main_file_path']),
623
-                'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
624
-                    ? (string) $setup_args['pue_options']['checkPeriod']
625
-                    : '24',
626
-                'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
627
-                    ? (string) $setup_args['pue_options']['use_wp_update']
628
-                    : false,
629
-            );
630
-            add_action(
631
-                'AHEE__EE_System__brew_espresso__after_pue_init',
632
-                array('EE_Register_Addon', 'load_pue_update')
633
-            );
634
-        }
635
-    }
603
+	/**
604
+	 * if plugin update engine is being used for auto-updates,
605
+	 * then let's set that up now before going any further so that ALL addons can be updated
606
+	 * (not needed if PUE is not being used)
607
+	 *
608
+	 * @param string $addon_name
609
+	 * @param string $class_name
610
+	 * @param array  $setup_args
611
+	 * @return void
612
+	 */
613
+	private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
614
+	{
615
+		if (! empty($setup_args['pue_options'])) {
616
+			self::$_settings[ $addon_name ]['pue_options'] = array(
617
+				'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
618
+					? (string) $setup_args['pue_options']['pue_plugin_slug']
619
+					: 'espresso_' . strtolower($class_name),
620
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
621
+					? (string) $setup_args['pue_options']['plugin_basename']
622
+					: plugin_basename($setup_args['main_file_path']),
623
+				'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
624
+					? (string) $setup_args['pue_options']['checkPeriod']
625
+					: '24',
626
+				'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
627
+					? (string) $setup_args['pue_options']['use_wp_update']
628
+					: false,
629
+			);
630
+			add_action(
631
+				'AHEE__EE_System__brew_espresso__after_pue_init',
632
+				array('EE_Register_Addon', 'load_pue_update')
633
+			);
634
+		}
635
+	}
636 636
 
637 637
 
638
-    /**
639
-     * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
640
-     *
641
-     * @param array $addon_settings
642
-     * @return void
643
-     */
644
-    private static function _setup_namespaces(array $addon_settings)
645
-    {
646
-        //
647
-        if (isset(
648
-            $addon_settings['namespace']['FQNS'],
649
-            $addon_settings['namespace']['DIR']
650
-        )) {
651
-            EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
652
-                $addon_settings['namespace']['FQNS'],
653
-                $addon_settings['namespace']['DIR']
654
-            );
655
-        }
656
-    }
638
+	/**
639
+	 * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
640
+	 *
641
+	 * @param array $addon_settings
642
+	 * @return void
643
+	 */
644
+	private static function _setup_namespaces(array $addon_settings)
645
+	{
646
+		//
647
+		if (isset(
648
+			$addon_settings['namespace']['FQNS'],
649
+			$addon_settings['namespace']['DIR']
650
+		)) {
651
+			EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
652
+				$addon_settings['namespace']['FQNS'],
653
+				$addon_settings['namespace']['DIR']
654
+			);
655
+		}
656
+	}
657 657
 
658 658
 
659
-    /**
660
-     * @param string $addon_name
661
-     * @param array  $addon_settings
662
-     * @return bool
663
-     * @throws EE_Error
664
-     * @throws InvalidArgumentException
665
-     * @throws ReflectionException
666
-     * @throws InvalidDataTypeException
667
-     * @throws InvalidInterfaceException
668
-     */
669
-    private static function _addon_activation($addon_name, array $addon_settings)
670
-    {
671
-        // this is an activation request
672
-        if (did_action(
673
-            'activate_plugin'
674
-        )) {// to find if THIS is the addon that was activated, just check if we have already registered it or not
675
-            // (as the newly-activated addon wasn't around the first time addons were registered).
676
-            // Note: the presence of pue_options in the addon registration options will initialize the $_settings
677
-            // property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
678
-            if (! isset(self::$_settings[ $addon_name ])
679
-                || (isset(self::$_settings[ $addon_name ])
680
-                    && ! isset(self::$_settings[ $addon_name ]['class_name'])
681
-                )
682
-            ) {
683
-                self::$_settings[ $addon_name ] = $addon_settings;
684
-                $addon = self::_load_and_init_addon_class($addon_name);
685
-                $addon->set_activation_indicator_option();
686
-                // dont bother setting up the rest of the addon.
687
-                // we know it was just activated and the request will end soon
688
-            }
689
-            return true;
690
-        }
691
-        // make sure this was called in the right place!
692
-        if (! did_action('AHEE__EE_System__load_espresso_addons')
693
-            || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
694
-        ) {
695
-            EE_Error::doing_it_wrong(
696
-                __METHOD__,
697
-                sprintf(
698
-                    __(
699
-                        'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
700
-                        'event_espresso'
701
-                    ),
702
-                    $addon_name
703
-                ),
704
-                '4.3.0'
705
-            );
706
-        }
707
-        // make sure addon settings are set correctly without overwriting anything existing
708
-        if (isset(self::$_settings[ $addon_name ])) {
709
-            self::$_settings[ $addon_name ] += $addon_settings;
710
-        } else {
711
-            self::$_settings[ $addon_name ] = $addon_settings;
712
-        }
713
-        return false;
714
-    }
659
+	/**
660
+	 * @param string $addon_name
661
+	 * @param array  $addon_settings
662
+	 * @return bool
663
+	 * @throws EE_Error
664
+	 * @throws InvalidArgumentException
665
+	 * @throws ReflectionException
666
+	 * @throws InvalidDataTypeException
667
+	 * @throws InvalidInterfaceException
668
+	 */
669
+	private static function _addon_activation($addon_name, array $addon_settings)
670
+	{
671
+		// this is an activation request
672
+		if (did_action(
673
+			'activate_plugin'
674
+		)) {// to find if THIS is the addon that was activated, just check if we have already registered it or not
675
+			// (as the newly-activated addon wasn't around the first time addons were registered).
676
+			// Note: the presence of pue_options in the addon registration options will initialize the $_settings
677
+			// property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
678
+			if (! isset(self::$_settings[ $addon_name ])
679
+				|| (isset(self::$_settings[ $addon_name ])
680
+					&& ! isset(self::$_settings[ $addon_name ]['class_name'])
681
+				)
682
+			) {
683
+				self::$_settings[ $addon_name ] = $addon_settings;
684
+				$addon = self::_load_and_init_addon_class($addon_name);
685
+				$addon->set_activation_indicator_option();
686
+				// dont bother setting up the rest of the addon.
687
+				// we know it was just activated and the request will end soon
688
+			}
689
+			return true;
690
+		}
691
+		// make sure this was called in the right place!
692
+		if (! did_action('AHEE__EE_System__load_espresso_addons')
693
+			|| did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
694
+		) {
695
+			EE_Error::doing_it_wrong(
696
+				__METHOD__,
697
+				sprintf(
698
+					__(
699
+						'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
700
+						'event_espresso'
701
+					),
702
+					$addon_name
703
+				),
704
+				'4.3.0'
705
+			);
706
+		}
707
+		// make sure addon settings are set correctly without overwriting anything existing
708
+		if (isset(self::$_settings[ $addon_name ])) {
709
+			self::$_settings[ $addon_name ] += $addon_settings;
710
+		} else {
711
+			self::$_settings[ $addon_name ] = $addon_settings;
712
+		}
713
+		return false;
714
+	}
715 715
 
716 716
 
717
-    /**
718
-     * @param string $addon_name
719
-     * @return void
720
-     * @throws EE_Error
721
-     */
722
-    private static function _setup_autoloaders($addon_name)
723
-    {
724
-        if (! empty(self::$_settings[ $addon_name ]['autoloader_paths'])) {
725
-            // setup autoloader for single file
726
-            EEH_Autoloader::instance()->register_autoloader(self::$_settings[ $addon_name ]['autoloader_paths']);
727
-        }
728
-        // setup autoloaders for folders
729
-        if (! empty(self::$_settings[ $addon_name ]['autoloader_folders'])) {
730
-            foreach ((array) self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder) {
731
-                EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
732
-            }
733
-        }
734
-    }
717
+	/**
718
+	 * @param string $addon_name
719
+	 * @return void
720
+	 * @throws EE_Error
721
+	 */
722
+	private static function _setup_autoloaders($addon_name)
723
+	{
724
+		if (! empty(self::$_settings[ $addon_name ]['autoloader_paths'])) {
725
+			// setup autoloader for single file
726
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[ $addon_name ]['autoloader_paths']);
727
+		}
728
+		// setup autoloaders for folders
729
+		if (! empty(self::$_settings[ $addon_name ]['autoloader_folders'])) {
730
+			foreach ((array) self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder) {
731
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
732
+			}
733
+		}
734
+	}
735 735
 
736 736
 
737
-    /**
738
-     * register new models and extensions
739
-     *
740
-     * @param string $addon_name
741
-     * @return void
742
-     * @throws EE_Error
743
-     */
744
-    private static function _register_models_and_extensions($addon_name)
745
-    {
746
-        // register new models
747
-        if (! empty(self::$_settings[ $addon_name ]['model_paths'])
748
-            || ! empty(self::$_settings[ $addon_name ]['class_paths'])
749
-        ) {
750
-            EE_Register_Model::register(
751
-                $addon_name,
752
-                array(
753
-                    'model_paths' => self::$_settings[ $addon_name ]['model_paths'],
754
-                    'class_paths' => self::$_settings[ $addon_name ]['class_paths'],
755
-                )
756
-            );
757
-        }
758
-        // register model extensions
759
-        if (! empty(self::$_settings[ $addon_name ]['model_extension_paths'])
760
-            || ! empty(self::$_settings[ $addon_name ]['class_extension_paths'])
761
-        ) {
762
-            EE_Register_Model_Extensions::register(
763
-                $addon_name,
764
-                array(
765
-                    'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'],
766
-                    'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'],
767
-                )
768
-            );
769
-        }
770
-    }
737
+	/**
738
+	 * register new models and extensions
739
+	 *
740
+	 * @param string $addon_name
741
+	 * @return void
742
+	 * @throws EE_Error
743
+	 */
744
+	private static function _register_models_and_extensions($addon_name)
745
+	{
746
+		// register new models
747
+		if (! empty(self::$_settings[ $addon_name ]['model_paths'])
748
+			|| ! empty(self::$_settings[ $addon_name ]['class_paths'])
749
+		) {
750
+			EE_Register_Model::register(
751
+				$addon_name,
752
+				array(
753
+					'model_paths' => self::$_settings[ $addon_name ]['model_paths'],
754
+					'class_paths' => self::$_settings[ $addon_name ]['class_paths'],
755
+				)
756
+			);
757
+		}
758
+		// register model extensions
759
+		if (! empty(self::$_settings[ $addon_name ]['model_extension_paths'])
760
+			|| ! empty(self::$_settings[ $addon_name ]['class_extension_paths'])
761
+		) {
762
+			EE_Register_Model_Extensions::register(
763
+				$addon_name,
764
+				array(
765
+					'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'],
766
+					'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'],
767
+				)
768
+			);
769
+		}
770
+	}
771 771
 
772 772
 
773
-    /**
774
-     * @param string $addon_name
775
-     * @return void
776
-     * @throws EE_Error
777
-     */
778
-    private static function _register_data_migration_scripts($addon_name)
779
-    {
780
-        // setup DMS
781
-        if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) {
782
-            EE_Register_Data_Migration_Scripts::register(
783
-                $addon_name,
784
-                array('dms_paths' => self::$_settings[ $addon_name ]['dms_paths'])
785
-            );
786
-        }
787
-    }
773
+	/**
774
+	 * @param string $addon_name
775
+	 * @return void
776
+	 * @throws EE_Error
777
+	 */
778
+	private static function _register_data_migration_scripts($addon_name)
779
+	{
780
+		// setup DMS
781
+		if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) {
782
+			EE_Register_Data_Migration_Scripts::register(
783
+				$addon_name,
784
+				array('dms_paths' => self::$_settings[ $addon_name ]['dms_paths'])
785
+			);
786
+		}
787
+	}
788 788
 
789 789
 
790
-    /**
791
-     * @param string $addon_name
792
-     * @return void
793
-     * @throws EE_Error
794
-     */
795
-    private static function _register_config($addon_name)
796
-    {
797
-        // if config_class is present let's register config.
798
-        if (! empty(self::$_settings[ $addon_name ]['config_class'])) {
799
-            EE_Register_Config::register(
800
-                self::$_settings[ $addon_name ]['config_class'],
801
-                array(
802
-                    'config_section' => self::$_settings[ $addon_name ]['config_section'],
803
-                    'config_name'    => self::$_settings[ $addon_name ]['config_name'],
804
-                )
805
-            );
806
-        }
807
-    }
790
+	/**
791
+	 * @param string $addon_name
792
+	 * @return void
793
+	 * @throws EE_Error
794
+	 */
795
+	private static function _register_config($addon_name)
796
+	{
797
+		// if config_class is present let's register config.
798
+		if (! empty(self::$_settings[ $addon_name ]['config_class'])) {
799
+			EE_Register_Config::register(
800
+				self::$_settings[ $addon_name ]['config_class'],
801
+				array(
802
+					'config_section' => self::$_settings[ $addon_name ]['config_section'],
803
+					'config_name'    => self::$_settings[ $addon_name ]['config_name'],
804
+				)
805
+			);
806
+		}
807
+	}
808 808
 
809 809
 
810
-    /**
811
-     * @param string $addon_name
812
-     * @return void
813
-     * @throws EE_Error
814
-     */
815
-    private static function _register_admin_pages($addon_name)
816
-    {
817
-        if (! empty(self::$_settings[ $addon_name ]['admin_path'])) {
818
-            EE_Register_Admin_Page::register(
819
-                $addon_name,
820
-                array('page_path' => self::$_settings[ $addon_name ]['admin_path'])
821
-            );
822
-        }
823
-    }
810
+	/**
811
+	 * @param string $addon_name
812
+	 * @return void
813
+	 * @throws EE_Error
814
+	 */
815
+	private static function _register_admin_pages($addon_name)
816
+	{
817
+		if (! empty(self::$_settings[ $addon_name ]['admin_path'])) {
818
+			EE_Register_Admin_Page::register(
819
+				$addon_name,
820
+				array('page_path' => self::$_settings[ $addon_name ]['admin_path'])
821
+			);
822
+		}
823
+	}
824 824
 
825 825
 
826
-    /**
827
-     * @param string $addon_name
828
-     * @return void
829
-     * @throws EE_Error
830
-     */
831
-    private static function _register_modules($addon_name)
832
-    {
833
-        if (! empty(self::$_settings[ $addon_name ]['module_paths'])) {
834
-            EE_Register_Module::register(
835
-                $addon_name,
836
-                array('module_paths' => self::$_settings[ $addon_name ]['module_paths'])
837
-            );
838
-        }
839
-    }
826
+	/**
827
+	 * @param string $addon_name
828
+	 * @return void
829
+	 * @throws EE_Error
830
+	 */
831
+	private static function _register_modules($addon_name)
832
+	{
833
+		if (! empty(self::$_settings[ $addon_name ]['module_paths'])) {
834
+			EE_Register_Module::register(
835
+				$addon_name,
836
+				array('module_paths' => self::$_settings[ $addon_name ]['module_paths'])
837
+			);
838
+		}
839
+	}
840 840
 
841 841
 
842
-    /**
843
-     * @param string $addon_name
844
-     * @return void
845
-     * @throws EE_Error
846
-     */
847
-    private static function _register_shortcodes($addon_name)
848
-    {
849
-        if (! empty(self::$_settings[ $addon_name ]['shortcode_paths'])
850
-            || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns'])
851
-        ) {
852
-            EE_Register_Shortcode::register(
853
-                $addon_name,
854
-                array(
855
-                    'shortcode_paths' => isset(self::$_settings[ $addon_name ]['shortcode_paths'])
856
-                        ? self::$_settings[ $addon_name ]['shortcode_paths']
857
-                        : array(),
858
-                    'shortcode_fqcns' => isset(self::$_settings[ $addon_name ]['shortcode_fqcns'])
859
-                        ? self::$_settings[ $addon_name ]['shortcode_fqcns']
860
-                        : array(),
861
-                )
862
-            );
863
-        }
864
-    }
842
+	/**
843
+	 * @param string $addon_name
844
+	 * @return void
845
+	 * @throws EE_Error
846
+	 */
847
+	private static function _register_shortcodes($addon_name)
848
+	{
849
+		if (! empty(self::$_settings[ $addon_name ]['shortcode_paths'])
850
+			|| ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns'])
851
+		) {
852
+			EE_Register_Shortcode::register(
853
+				$addon_name,
854
+				array(
855
+					'shortcode_paths' => isset(self::$_settings[ $addon_name ]['shortcode_paths'])
856
+						? self::$_settings[ $addon_name ]['shortcode_paths']
857
+						: array(),
858
+					'shortcode_fqcns' => isset(self::$_settings[ $addon_name ]['shortcode_fqcns'])
859
+						? self::$_settings[ $addon_name ]['shortcode_fqcns']
860
+						: array(),
861
+				)
862
+			);
863
+		}
864
+	}
865 865
 
866 866
 
867
-    /**
868
-     * @param string $addon_name
869
-     * @return void
870
-     * @throws EE_Error
871
-     */
872
-    private static function _register_widgets($addon_name)
873
-    {
874
-        if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) {
875
-            EE_Register_Widget::register(
876
-                $addon_name,
877
-                array('widget_paths' => self::$_settings[ $addon_name ]['widget_paths'])
878
-            );
879
-        }
880
-    }
867
+	/**
868
+	 * @param string $addon_name
869
+	 * @return void
870
+	 * @throws EE_Error
871
+	 */
872
+	private static function _register_widgets($addon_name)
873
+	{
874
+		if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) {
875
+			EE_Register_Widget::register(
876
+				$addon_name,
877
+				array('widget_paths' => self::$_settings[ $addon_name ]['widget_paths'])
878
+			);
879
+		}
880
+	}
881 881
 
882 882
 
883
-    /**
884
-     * @param string $addon_name
885
-     * @return void
886
-     * @throws EE_Error
887
-     */
888
-    private static function _register_capabilities($addon_name)
889
-    {
890
-        if (! empty(self::$_settings[ $addon_name ]['capabilities'])) {
891
-            EE_Register_Capabilities::register(
892
-                $addon_name,
893
-                array(
894
-                    'capabilities'    => self::$_settings[ $addon_name ]['capabilities'],
895
-                    'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'],
896
-                )
897
-            );
898
-        }
899
-    }
883
+	/**
884
+	 * @param string $addon_name
885
+	 * @return void
886
+	 * @throws EE_Error
887
+	 */
888
+	private static function _register_capabilities($addon_name)
889
+	{
890
+		if (! empty(self::$_settings[ $addon_name ]['capabilities'])) {
891
+			EE_Register_Capabilities::register(
892
+				$addon_name,
893
+				array(
894
+					'capabilities'    => self::$_settings[ $addon_name ]['capabilities'],
895
+					'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'],
896
+				)
897
+			);
898
+		}
899
+	}
900 900
 
901 901
 
902
-    /**
903
-     * @param string $addon_name
904
-     * @return void
905
-     * @throws EE_Error
906
-     */
907
-    private static function _register_message_types($addon_name)
908
-    {
909
-        if (! empty(self::$_settings[ $addon_name ]['message_types'])) {
910
-            add_action(
911
-                'EE_Brewing_Regular___messages_caf',
912
-                array('EE_Register_Addon', 'register_message_types')
913
-            );
914
-        }
915
-    }
902
+	/**
903
+	 * @param string $addon_name
904
+	 * @return void
905
+	 * @throws EE_Error
906
+	 */
907
+	private static function _register_message_types($addon_name)
908
+	{
909
+		if (! empty(self::$_settings[ $addon_name ]['message_types'])) {
910
+			add_action(
911
+				'EE_Brewing_Regular___messages_caf',
912
+				array('EE_Register_Addon', 'register_message_types')
913
+			);
914
+		}
915
+	}
916 916
 
917 917
 
918
-    /**
919
-     * @param string $addon_name
920
-     * @return void
921
-     * @throws EE_Error
922
-     */
923
-    private static function _register_custom_post_types($addon_name)
924
-    {
925
-        if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])
926
-            || ! empty(self::$_settings[ $addon_name ]['custom_taxonomies'])
927
-        ) {
928
-            EE_Register_CPT::register(
929
-                $addon_name,
930
-                array(
931
-                    'cpts'          => self::$_settings[ $addon_name ]['custom_post_types'],
932
-                    'cts'           => self::$_settings[ $addon_name ]['custom_taxonomies'],
933
-                    'default_terms' => self::$_settings[ $addon_name ]['default_terms'],
934
-                )
935
-            );
936
-        }
937
-    }
918
+	/**
919
+	 * @param string $addon_name
920
+	 * @return void
921
+	 * @throws EE_Error
922
+	 */
923
+	private static function _register_custom_post_types($addon_name)
924
+	{
925
+		if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])
926
+			|| ! empty(self::$_settings[ $addon_name ]['custom_taxonomies'])
927
+		) {
928
+			EE_Register_CPT::register(
929
+				$addon_name,
930
+				array(
931
+					'cpts'          => self::$_settings[ $addon_name ]['custom_post_types'],
932
+					'cts'           => self::$_settings[ $addon_name ]['custom_taxonomies'],
933
+					'default_terms' => self::$_settings[ $addon_name ]['default_terms'],
934
+				)
935
+			);
936
+		}
937
+	}
938 938
 
939 939
 
940
-    /**
941
-     * @param string $addon_name
942
-     * @return void
943
-     * @throws InvalidArgumentException
944
-     * @throws InvalidInterfaceException
945
-     * @throws InvalidDataTypeException
946
-     * @throws DomainException
947
-     * @throws EE_Error
948
-     */
949
-    private static function _register_payment_methods($addon_name)
950
-    {
951
-        if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) {
952
-            EE_Register_Payment_Method::register(
953
-                $addon_name,
954
-                array('payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths'])
955
-            );
956
-        }
957
-    }
940
+	/**
941
+	 * @param string $addon_name
942
+	 * @return void
943
+	 * @throws InvalidArgumentException
944
+	 * @throws InvalidInterfaceException
945
+	 * @throws InvalidDataTypeException
946
+	 * @throws DomainException
947
+	 * @throws EE_Error
948
+	 */
949
+	private static function _register_payment_methods($addon_name)
950
+	{
951
+		if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) {
952
+			EE_Register_Payment_Method::register(
953
+				$addon_name,
954
+				array('payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths'])
955
+			);
956
+		}
957
+	}
958 958
 
959 959
 
960
-    /**
961
-     * @param string $addon_name
962
-     * @return void
963
-     * @throws InvalidArgumentException
964
-     * @throws InvalidInterfaceException
965
-     * @throws InvalidDataTypeException
966
-     * @throws DomainException
967
-     * @throws EE_Error
968
-     */
969
-    private static function registerPrivacyPolicies($addon_name)
970
-    {
971
-        if (! empty(self::$_settings[ $addon_name ]['privacy_policies'])) {
972
-            EE_Register_Privacy_Policy::register(
973
-                $addon_name,
974
-                self::$_settings[ $addon_name ]['privacy_policies']
975
-            );
976
-        }
977
-    }
960
+	/**
961
+	 * @param string $addon_name
962
+	 * @return void
963
+	 * @throws InvalidArgumentException
964
+	 * @throws InvalidInterfaceException
965
+	 * @throws InvalidDataTypeException
966
+	 * @throws DomainException
967
+	 * @throws EE_Error
968
+	 */
969
+	private static function registerPrivacyPolicies($addon_name)
970
+	{
971
+		if (! empty(self::$_settings[ $addon_name ]['privacy_policies'])) {
972
+			EE_Register_Privacy_Policy::register(
973
+				$addon_name,
974
+				self::$_settings[ $addon_name ]['privacy_policies']
975
+			);
976
+		}
977
+	}
978 978
 
979 979
 
980
-    /**
981
-     * @param string $addon_name
982
-     * @return void
983
-     */
984
-    private static function registerPersonalDataExporters($addon_name)
985
-    {
986
-        if (! empty(self::$_settings[ $addon_name ]['personal_data_exporters'])) {
987
-            EE_Register_Personal_Data_Eraser::register(
988
-                $addon_name,
989
-                self::$_settings[ $addon_name ]['personal_data_exporters']
990
-            );
991
-        }
992
-    }
980
+	/**
981
+	 * @param string $addon_name
982
+	 * @return void
983
+	 */
984
+	private static function registerPersonalDataExporters($addon_name)
985
+	{
986
+		if (! empty(self::$_settings[ $addon_name ]['personal_data_exporters'])) {
987
+			EE_Register_Personal_Data_Eraser::register(
988
+				$addon_name,
989
+				self::$_settings[ $addon_name ]['personal_data_exporters']
990
+			);
991
+		}
992
+	}
993 993
 
994 994
 
995
-    /**
996
-     * @param string $addon_name
997
-     * @return void
998
-     */
999
-    private static function registerPersonalDataErasers($addon_name)
1000
-    {
1001
-        if (! empty(self::$_settings[ $addon_name ]['personal_data_erasers'])) {
1002
-            EE_Register_Personal_Data_Eraser::register(
1003
-                $addon_name,
1004
-                self::$_settings[ $addon_name ]['personal_data_erasers']
1005
-            );
1006
-        }
1007
-    }
995
+	/**
996
+	 * @param string $addon_name
997
+	 * @return void
998
+	 */
999
+	private static function registerPersonalDataErasers($addon_name)
1000
+	{
1001
+		if (! empty(self::$_settings[ $addon_name ]['personal_data_erasers'])) {
1002
+			EE_Register_Personal_Data_Eraser::register(
1003
+				$addon_name,
1004
+				self::$_settings[ $addon_name ]['personal_data_erasers']
1005
+			);
1006
+		}
1007
+	}
1008 1008
 
1009 1009
 
1010
-    /**
1011
-     * Loads and instantiates the EE_Addon class and adds it onto the registry
1012
-     *
1013
-     * @param string $addon_name
1014
-     * @return EE_Addon
1015
-     * @throws InvalidArgumentException
1016
-     * @throws InvalidInterfaceException
1017
-     * @throws InvalidDataTypeException
1018
-     * @throws ReflectionException
1019
-     * @throws EE_Error
1020
-     */
1021
-    private static function _load_and_init_addon_class($addon_name)
1022
-    {
1023
-        $loader = EventEspresso\core\services\loaders\LoaderFactory::getLoader();
1024
-        $addon = $loader->getShared(
1025
-            self::$_settings[ $addon_name ]['class_name'],
1026
-            array('EE_Registry::create(addon)' => true)
1027
-        );
1028
-        // setter inject dep map if required
1029
-        if ($addon instanceof RequiresDependencyMapInterface && $addon->dependencyMap() === null) {
1030
-            $addon->setDependencyMap($loader->getShared('EE_Dependency_Map'));
1031
-        }
1032
-        // setter inject domain if required
1033
-        if ($addon instanceof RequiresDomainInterface
1034
-            && $addon->domain() === null
1035
-        ) {
1036
-            // using supplied Domain object
1037
-            $domain = self::$_settings[ $addon_name ]['domain'] instanceof DomainInterface
1038
-                ? self::$_settings[ $addon_name ]['domain']
1039
-                : null;
1040
-            // or construct one using Domain FQCN
1041
-            if ($domain === null && self::$_settings[ $addon_name ]['domain_fqcn'] !== '') {
1042
-                $domain = $loader->getShared(
1043
-                    self::$_settings[ $addon_name ]['domain_fqcn'],
1044
-                    array(
1045
-                        new EventEspresso\core\domain\values\FilePath(
1046
-                            self::$_settings[ $addon_name ]['main_file_path']
1047
-                        ),
1048
-                        EventEspresso\core\domain\values\Version::fromString(
1049
-                            self::$_settings[ $addon_name ]['version']
1050
-                        ),
1051
-                    )
1052
-                );
1053
-            }
1054
-            if ($domain instanceof DomainInterface) {
1055
-                $addon->setDomain($domain);
1056
-            }
1057
-        }
1058
-        $addon->set_name($addon_name);
1059
-        $addon->set_plugin_slug(self::$_settings[ $addon_name ]['plugin_slug']);
1060
-        $addon->set_plugin_basename(self::$_settings[ $addon_name ]['plugin_basename']);
1061
-        $addon->set_main_plugin_file(self::$_settings[ $addon_name ]['main_file_path']);
1062
-        $addon->set_plugin_action_slug(self::$_settings[ $addon_name ]['plugin_action_slug']);
1063
-        $addon->set_plugins_page_row(self::$_settings[ $addon_name ]['plugins_page_row']);
1064
-        $addon->set_version(self::$_settings[ $addon_name ]['version']);
1065
-        $addon->set_min_core_version(self::_effective_version(self::$_settings[ $addon_name ]['min_core_version']));
1066
-        $addon->set_config_section(self::$_settings[ $addon_name ]['config_section']);
1067
-        $addon->set_config_class(self::$_settings[ $addon_name ]['config_class']);
1068
-        $addon->set_config_name(self::$_settings[ $addon_name ]['config_name']);
1069
-        // unfortunately this can't be hooked in upon construction, because we don't have
1070
-        // the plugin mainfile's path upon construction.
1071
-        register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
1072
-        // call any additional admin_callback functions during load_admin_controller hook
1073
-        if (! empty(self::$_settings[ $addon_name ]['admin_callback'])) {
1074
-            add_action(
1075
-                'AHEE__EE_System__load_controllers__load_admin_controllers',
1076
-                array($addon, self::$_settings[ $addon_name ]['admin_callback'])
1077
-            );
1078
-        }
1079
-        return $addon;
1080
-    }
1010
+	/**
1011
+	 * Loads and instantiates the EE_Addon class and adds it onto the registry
1012
+	 *
1013
+	 * @param string $addon_name
1014
+	 * @return EE_Addon
1015
+	 * @throws InvalidArgumentException
1016
+	 * @throws InvalidInterfaceException
1017
+	 * @throws InvalidDataTypeException
1018
+	 * @throws ReflectionException
1019
+	 * @throws EE_Error
1020
+	 */
1021
+	private static function _load_and_init_addon_class($addon_name)
1022
+	{
1023
+		$loader = EventEspresso\core\services\loaders\LoaderFactory::getLoader();
1024
+		$addon = $loader->getShared(
1025
+			self::$_settings[ $addon_name ]['class_name'],
1026
+			array('EE_Registry::create(addon)' => true)
1027
+		);
1028
+		// setter inject dep map if required
1029
+		if ($addon instanceof RequiresDependencyMapInterface && $addon->dependencyMap() === null) {
1030
+			$addon->setDependencyMap($loader->getShared('EE_Dependency_Map'));
1031
+		}
1032
+		// setter inject domain if required
1033
+		if ($addon instanceof RequiresDomainInterface
1034
+			&& $addon->domain() === null
1035
+		) {
1036
+			// using supplied Domain object
1037
+			$domain = self::$_settings[ $addon_name ]['domain'] instanceof DomainInterface
1038
+				? self::$_settings[ $addon_name ]['domain']
1039
+				: null;
1040
+			// or construct one using Domain FQCN
1041
+			if ($domain === null && self::$_settings[ $addon_name ]['domain_fqcn'] !== '') {
1042
+				$domain = $loader->getShared(
1043
+					self::$_settings[ $addon_name ]['domain_fqcn'],
1044
+					array(
1045
+						new EventEspresso\core\domain\values\FilePath(
1046
+							self::$_settings[ $addon_name ]['main_file_path']
1047
+						),
1048
+						EventEspresso\core\domain\values\Version::fromString(
1049
+							self::$_settings[ $addon_name ]['version']
1050
+						),
1051
+					)
1052
+				);
1053
+			}
1054
+			if ($domain instanceof DomainInterface) {
1055
+				$addon->setDomain($domain);
1056
+			}
1057
+		}
1058
+		$addon->set_name($addon_name);
1059
+		$addon->set_plugin_slug(self::$_settings[ $addon_name ]['plugin_slug']);
1060
+		$addon->set_plugin_basename(self::$_settings[ $addon_name ]['plugin_basename']);
1061
+		$addon->set_main_plugin_file(self::$_settings[ $addon_name ]['main_file_path']);
1062
+		$addon->set_plugin_action_slug(self::$_settings[ $addon_name ]['plugin_action_slug']);
1063
+		$addon->set_plugins_page_row(self::$_settings[ $addon_name ]['plugins_page_row']);
1064
+		$addon->set_version(self::$_settings[ $addon_name ]['version']);
1065
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[ $addon_name ]['min_core_version']));
1066
+		$addon->set_config_section(self::$_settings[ $addon_name ]['config_section']);
1067
+		$addon->set_config_class(self::$_settings[ $addon_name ]['config_class']);
1068
+		$addon->set_config_name(self::$_settings[ $addon_name ]['config_name']);
1069
+		// unfortunately this can't be hooked in upon construction, because we don't have
1070
+		// the plugin mainfile's path upon construction.
1071
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
1072
+		// call any additional admin_callback functions during load_admin_controller hook
1073
+		if (! empty(self::$_settings[ $addon_name ]['admin_callback'])) {
1074
+			add_action(
1075
+				'AHEE__EE_System__load_controllers__load_admin_controllers',
1076
+				array($addon, self::$_settings[ $addon_name ]['admin_callback'])
1077
+			);
1078
+		}
1079
+		return $addon;
1080
+	}
1081 1081
 
1082 1082
 
1083
-    /**
1084
-     *    load_pue_update - Update notifications
1085
-     *
1086
-     * @return void
1087
-     * @throws InvalidArgumentException
1088
-     * @throws InvalidDataTypeException
1089
-     * @throws InvalidInterfaceException
1090
-     */
1091
-    public static function load_pue_update()
1092
-    {
1093
-        // load PUE client
1094
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
1095
-        $license_server = defined('PUE_UPDATES_ENDPOINT') ? PUE_UPDATES_ENDPOINT : 'https://eventespresso.com';
1096
-        // cycle thru settings
1097
-        foreach (self::$_settings as $settings) {
1098
-            if (! empty($settings['pue_options'])) {
1099
-                // initiate the class and start the plugin update engine!
1100
-                new PluginUpdateEngineChecker(
1101
-                    // host file URL
1102
-                    $license_server,
1103
-                    // plugin slug(s)
1104
-                    array(
1105
-                        'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
1106
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
1107
-                    ),
1108
-                    // options
1109
-                    array(
1110
-                        'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
1111
-                        'lang_domain'       => 'event_espresso',
1112
-                        'checkPeriod'       => $settings['pue_options']['checkPeriod'],
1113
-                        'option_key'        => 'ee_site_license_key',
1114
-                        'options_page_slug' => 'event_espresso',
1115
-                        'plugin_basename'   => $settings['pue_options']['plugin_basename'],
1116
-                        // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
1117
-                        'use_wp_update'     => $settings['pue_options']['use_wp_update'],
1118
-                    )
1119
-                );
1120
-            }
1121
-        }
1122
-    }
1083
+	/**
1084
+	 *    load_pue_update - Update notifications
1085
+	 *
1086
+	 * @return void
1087
+	 * @throws InvalidArgumentException
1088
+	 * @throws InvalidDataTypeException
1089
+	 * @throws InvalidInterfaceException
1090
+	 */
1091
+	public static function load_pue_update()
1092
+	{
1093
+		// load PUE client
1094
+		require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
1095
+		$license_server = defined('PUE_UPDATES_ENDPOINT') ? PUE_UPDATES_ENDPOINT : 'https://eventespresso.com';
1096
+		// cycle thru settings
1097
+		foreach (self::$_settings as $settings) {
1098
+			if (! empty($settings['pue_options'])) {
1099
+				// initiate the class and start the plugin update engine!
1100
+				new PluginUpdateEngineChecker(
1101
+					// host file URL
1102
+					$license_server,
1103
+					// plugin slug(s)
1104
+					array(
1105
+						'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
1106
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
1107
+					),
1108
+					// options
1109
+					array(
1110
+						'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
1111
+						'lang_domain'       => 'event_espresso',
1112
+						'checkPeriod'       => $settings['pue_options']['checkPeriod'],
1113
+						'option_key'        => 'ee_site_license_key',
1114
+						'options_page_slug' => 'event_espresso',
1115
+						'plugin_basename'   => $settings['pue_options']['plugin_basename'],
1116
+						// if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
1117
+						'use_wp_update'     => $settings['pue_options']['use_wp_update'],
1118
+					)
1119
+				);
1120
+			}
1121
+		}
1122
+	}
1123 1123
 
1124 1124
 
1125
-    /**
1126
-     * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
1127
-     *
1128
-     * @since 4.4.0
1129
-     * @return void
1130
-     * @throws EE_Error
1131
-     */
1132
-    public static function register_message_types()
1133
-    {
1134
-        foreach (self::$_settings as $addon_name => $settings) {
1135
-            if (! empty($settings['message_types'])) {
1136
-                foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) {
1137
-                    EE_Register_Message_Type::register($message_type, $message_type_settings);
1138
-                }
1139
-            }
1140
-        }
1141
-    }
1125
+	/**
1126
+	 * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
1127
+	 *
1128
+	 * @since 4.4.0
1129
+	 * @return void
1130
+	 * @throws EE_Error
1131
+	 */
1132
+	public static function register_message_types()
1133
+	{
1134
+		foreach (self::$_settings as $addon_name => $settings) {
1135
+			if (! empty($settings['message_types'])) {
1136
+				foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) {
1137
+					EE_Register_Message_Type::register($message_type, $message_type_settings);
1138
+				}
1139
+			}
1140
+		}
1141
+	}
1142 1142
 
1143 1143
 
1144
-    /**
1145
-     * This deregisters an addon that was previously registered with a specific addon_name.
1146
-     *
1147
-     * @since    4.3.0
1148
-     * @param string $addon_name the name for the addon that was previously registered
1149
-     * @throws DomainException
1150
-     * @throws EE_Error
1151
-     * @throws InvalidArgumentException
1152
-     * @throws InvalidDataTypeException
1153
-     * @throws InvalidInterfaceException
1154
-     */
1155
-    public static function deregister($addon_name = null)
1156
-    {
1157
-        if (isset(self::$_settings[ $addon_name ]['class_name'])) {
1158
-            try {
1159
-                do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1160
-                $class_name = self::$_settings[ $addon_name ]['class_name'];
1161
-                if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) {
1162
-                    // setup DMS
1163
-                    EE_Register_Data_Migration_Scripts::deregister($addon_name);
1164
-                }
1165
-                if (! empty(self::$_settings[ $addon_name ]['admin_path'])) {
1166
-                    // register admin page
1167
-                    EE_Register_Admin_Page::deregister($addon_name);
1168
-                }
1169
-                if (! empty(self::$_settings[ $addon_name ]['module_paths'])) {
1170
-                    // add to list of modules to be registered
1171
-                    EE_Register_Module::deregister($addon_name);
1172
-                }
1173
-                if (! empty(self::$_settings[ $addon_name ]['shortcode_paths'])
1174
-                    || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns'])
1175
-                ) {
1176
-                    // add to list of shortcodes to be registered
1177
-                    EE_Register_Shortcode::deregister($addon_name);
1178
-                }
1179
-                if (! empty(self::$_settings[ $addon_name ]['config_class'])) {
1180
-                    // if config_class present let's register config.
1181
-                    EE_Register_Config::deregister(self::$_settings[ $addon_name ]['config_class']);
1182
-                }
1183
-                if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) {
1184
-                    // add to list of widgets to be registered
1185
-                    EE_Register_Widget::deregister($addon_name);
1186
-                }
1187
-                if (! empty(self::$_settings[ $addon_name ]['model_paths'])
1188
-                    || ! empty(self::$_settings[ $addon_name ]['class_paths'])
1189
-                ) {
1190
-                    // add to list of shortcodes to be registered
1191
-                    EE_Register_Model::deregister($addon_name);
1192
-                }
1193
-                if (! empty(self::$_settings[ $addon_name ]['model_extension_paths'])
1194
-                    || ! empty(self::$_settings[ $addon_name ]['class_extension_paths'])
1195
-                ) {
1196
-                    // add to list of shortcodes to be registered
1197
-                    EE_Register_Model_Extensions::deregister($addon_name);
1198
-                }
1199
-                if (! empty(self::$_settings[ $addon_name ]['message_types'])) {
1200
-                    foreach ((array) self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings) {
1201
-                        EE_Register_Message_Type::deregister($message_type);
1202
-                    }
1203
-                }
1204
-                // deregister capabilities for addon
1205
-                if (! empty(self::$_settings[ $addon_name ]['capabilities'])
1206
-                    || ! empty(self::$_settings[ $addon_name ]['capability_maps'])
1207
-                ) {
1208
-                    EE_Register_Capabilities::deregister($addon_name);
1209
-                }
1210
-                // deregister custom_post_types for addon
1211
-                if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])) {
1212
-                    EE_Register_CPT::deregister($addon_name);
1213
-                }
1214
-                if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) {
1215
-                    EE_Register_Payment_Method::deregister($addon_name);
1216
-                }
1217
-                $addon = EE_Registry::instance()->getAddon($class_name);
1218
-                if ($addon instanceof EE_Addon) {
1219
-                    remove_action(
1220
-                        'deactivate_' . $addon->get_main_plugin_file_basename(),
1221
-                        array($addon, 'deactivation')
1222
-                    );
1223
-                    remove_action(
1224
-                        'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1225
-                        array($addon, 'initialize_db_if_no_migrations_required')
1226
-                    );
1227
-                    // remove `after_registration` call
1228
-                    remove_action(
1229
-                        'AHEE__EE_System__load_espresso_addons__complete',
1230
-                        array($addon, 'after_registration'),
1231
-                        999
1232
-                    );
1233
-                }
1234
-                EE_Registry::instance()->removeAddon($class_name);
1235
-            } catch (OutOfBoundsException $addon_not_yet_registered_exception) {
1236
-                // the add-on was not yet registered in the registry,
1237
-                // so RegistryContainer::__get() throws this exception.
1238
-                // also no need to worry about this or log it,
1239
-                // it's ok to deregister an add-on before its registered in the registry
1240
-            } catch (Exception $e) {
1241
-                new ExceptionLogger($e);
1242
-            }
1243
-            unset(self::$_settings[ $addon_name ]);
1244
-            do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1245
-        }
1246
-    }
1144
+	/**
1145
+	 * This deregisters an addon that was previously registered with a specific addon_name.
1146
+	 *
1147
+	 * @since    4.3.0
1148
+	 * @param string $addon_name the name for the addon that was previously registered
1149
+	 * @throws DomainException
1150
+	 * @throws EE_Error
1151
+	 * @throws InvalidArgumentException
1152
+	 * @throws InvalidDataTypeException
1153
+	 * @throws InvalidInterfaceException
1154
+	 */
1155
+	public static function deregister($addon_name = null)
1156
+	{
1157
+		if (isset(self::$_settings[ $addon_name ]['class_name'])) {
1158
+			try {
1159
+				do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1160
+				$class_name = self::$_settings[ $addon_name ]['class_name'];
1161
+				if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) {
1162
+					// setup DMS
1163
+					EE_Register_Data_Migration_Scripts::deregister($addon_name);
1164
+				}
1165
+				if (! empty(self::$_settings[ $addon_name ]['admin_path'])) {
1166
+					// register admin page
1167
+					EE_Register_Admin_Page::deregister($addon_name);
1168
+				}
1169
+				if (! empty(self::$_settings[ $addon_name ]['module_paths'])) {
1170
+					// add to list of modules to be registered
1171
+					EE_Register_Module::deregister($addon_name);
1172
+				}
1173
+				if (! empty(self::$_settings[ $addon_name ]['shortcode_paths'])
1174
+					|| ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns'])
1175
+				) {
1176
+					// add to list of shortcodes to be registered
1177
+					EE_Register_Shortcode::deregister($addon_name);
1178
+				}
1179
+				if (! empty(self::$_settings[ $addon_name ]['config_class'])) {
1180
+					// if config_class present let's register config.
1181
+					EE_Register_Config::deregister(self::$_settings[ $addon_name ]['config_class']);
1182
+				}
1183
+				if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) {
1184
+					// add to list of widgets to be registered
1185
+					EE_Register_Widget::deregister($addon_name);
1186
+				}
1187
+				if (! empty(self::$_settings[ $addon_name ]['model_paths'])
1188
+					|| ! empty(self::$_settings[ $addon_name ]['class_paths'])
1189
+				) {
1190
+					// add to list of shortcodes to be registered
1191
+					EE_Register_Model::deregister($addon_name);
1192
+				}
1193
+				if (! empty(self::$_settings[ $addon_name ]['model_extension_paths'])
1194
+					|| ! empty(self::$_settings[ $addon_name ]['class_extension_paths'])
1195
+				) {
1196
+					// add to list of shortcodes to be registered
1197
+					EE_Register_Model_Extensions::deregister($addon_name);
1198
+				}
1199
+				if (! empty(self::$_settings[ $addon_name ]['message_types'])) {
1200
+					foreach ((array) self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings) {
1201
+						EE_Register_Message_Type::deregister($message_type);
1202
+					}
1203
+				}
1204
+				// deregister capabilities for addon
1205
+				if (! empty(self::$_settings[ $addon_name ]['capabilities'])
1206
+					|| ! empty(self::$_settings[ $addon_name ]['capability_maps'])
1207
+				) {
1208
+					EE_Register_Capabilities::deregister($addon_name);
1209
+				}
1210
+				// deregister custom_post_types for addon
1211
+				if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])) {
1212
+					EE_Register_CPT::deregister($addon_name);
1213
+				}
1214
+				if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) {
1215
+					EE_Register_Payment_Method::deregister($addon_name);
1216
+				}
1217
+				$addon = EE_Registry::instance()->getAddon($class_name);
1218
+				if ($addon instanceof EE_Addon) {
1219
+					remove_action(
1220
+						'deactivate_' . $addon->get_main_plugin_file_basename(),
1221
+						array($addon, 'deactivation')
1222
+					);
1223
+					remove_action(
1224
+						'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1225
+						array($addon, 'initialize_db_if_no_migrations_required')
1226
+					);
1227
+					// remove `after_registration` call
1228
+					remove_action(
1229
+						'AHEE__EE_System__load_espresso_addons__complete',
1230
+						array($addon, 'after_registration'),
1231
+						999
1232
+					);
1233
+				}
1234
+				EE_Registry::instance()->removeAddon($class_name);
1235
+			} catch (OutOfBoundsException $addon_not_yet_registered_exception) {
1236
+				// the add-on was not yet registered in the registry,
1237
+				// so RegistryContainer::__get() throws this exception.
1238
+				// also no need to worry about this or log it,
1239
+				// it's ok to deregister an add-on before its registered in the registry
1240
+			} catch (Exception $e) {
1241
+				new ExceptionLogger($e);
1242
+			}
1243
+			unset(self::$_settings[ $addon_name ]);
1244
+			do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1245
+		}
1246
+	}
1247 1247
 }
Please login to merge, or discard this patch.