Completed
Pull Request — FET/editor-dates-tickets-refac... (#1265)
by
unknown
27:36 queued 17:28
created
core/domain/services/assets/EspressoEditorAssetManager.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -19,70 +19,70 @@
 block discarded – undo
19 19
  */
20 20
 class EspressoEditorAssetManager extends AssetManager
21 21
 {
22
-    const JS_HANDLE_EDITOR = 'eventespresso-editor';
23
-    const CSS_HANDLE_EDITOR = 'eventespresso-editor';
24
-    const ASSET_CHUNK_NAME_EDITOR = 'editor';
22
+	const JS_HANDLE_EDITOR = 'eventespresso-editor';
23
+	const CSS_HANDLE_EDITOR = 'eventespresso-editor';
24
+	const ASSET_CHUNK_NAME_EDITOR = 'editor';
25 25
 
26
-    /**
27
-     * @since 4.9.62.p
28
-     * @throws DomainException
29
-     * @throws InvalidDataTypeException
30
-     * @throws InvalidEntityException
31
-     * @throws DuplicateCollectionIdentifierException
32
-     */
33
-    public function addAssets()
34
-    {
35
-        $this->registerJavascript();
36
-        $this->registerStyleSheets();
37
-    }
26
+	/**
27
+	 * @since 4.9.62.p
28
+	 * @throws DomainException
29
+	 * @throws InvalidDataTypeException
30
+	 * @throws InvalidEntityException
31
+	 * @throws DuplicateCollectionIdentifierException
32
+	 */
33
+	public function addAssets()
34
+	{
35
+		$this->registerJavascript();
36
+		$this->registerStyleSheets();
37
+	}
38 38
 
39 39
 
40
-    /**
41
-     * Register javascript assets
42
-     *
43
-     * @throws DomainException
44
-     * @throws InvalidDataTypeException
45
-     * @throws InvalidEntityException
46
-     * @throws DuplicateCollectionIdentifierException
47
-     */
48
-    private function registerJavascript()
49
-    {
50
-        $this->addJavascript(
51
-            self::JS_HANDLE_EDITOR,
52
-            $this->registry->getJsUrl(
53
-                $this->domain->assetNamespace(),
54
-                self::ASSET_CHUNK_NAME_EDITOR
55
-            ),
56
-            [
57
-                CoreAssetManager::JS_HANDLE_COMPONENTS,
58
-                CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
59
-                'ee-datepicker'
60
-            ]
61
-        )
62
-            ->setRequiresTranslation();
63
-    }
40
+	/**
41
+	 * Register javascript assets
42
+	 *
43
+	 * @throws DomainException
44
+	 * @throws InvalidDataTypeException
45
+	 * @throws InvalidEntityException
46
+	 * @throws DuplicateCollectionIdentifierException
47
+	 */
48
+	private function registerJavascript()
49
+	{
50
+		$this->addJavascript(
51
+			self::JS_HANDLE_EDITOR,
52
+			$this->registry->getJsUrl(
53
+				$this->domain->assetNamespace(),
54
+				self::ASSET_CHUNK_NAME_EDITOR
55
+			),
56
+			[
57
+				CoreAssetManager::JS_HANDLE_COMPONENTS,
58
+				CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
59
+				'ee-datepicker'
60
+			]
61
+		)
62
+			->setRequiresTranslation();
63
+	}
64 64
 
65 65
 
66
-    /**
67
-     * Register CSS assets.
68
-     *
69
-     * @throws DomainException
70
-     * @throws DuplicateCollectionIdentifierException
71
-     * @throws InvalidDataTypeException
72
-     * @throws InvalidEntityException
73
-     */
74
-    private function registerStyleSheets()
75
-    {
76
-        $this->addStylesheet(
77
-            self::CSS_HANDLE_EDITOR,
78
-            $this->registry->getCssUrl(
79
-                $this->domain->assetNamespace(),
80
-                self::ASSET_CHUNK_NAME_EDITOR
81
-            ),
82
-            [
83
-                CoreAssetManager::CSS_HANDLE_COMPONENTS,
84
-                CoreAssetManager::CSS_HANDLE_EDITOR_HOCS,
85
-            ]
86
-        );
87
-    }
66
+	/**
67
+	 * Register CSS assets.
68
+	 *
69
+	 * @throws DomainException
70
+	 * @throws DuplicateCollectionIdentifierException
71
+	 * @throws InvalidDataTypeException
72
+	 * @throws InvalidEntityException
73
+	 */
74
+	private function registerStyleSheets()
75
+	{
76
+		$this->addStylesheet(
77
+			self::CSS_HANDLE_EDITOR,
78
+			$this->registry->getCssUrl(
79
+				$this->domain->assetNamespace(),
80
+				self::ASSET_CHUNK_NAME_EDITOR
81
+			),
82
+			[
83
+				CoreAssetManager::CSS_HANDLE_COMPONENTS,
84
+				CoreAssetManager::CSS_HANDLE_EDITOR_HOCS,
85
+			]
86
+		);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
core/domain/services/assets/CoreAssetManager.php 1 patch
Indentation   +562 added lines, -562 removed lines patch added patch discarded remove patch
@@ -32,591 +32,591 @@
 block discarded – undo
32 32
 class CoreAssetManager extends AssetManager
33 33
 {
34 34
 
35
-    // WordPress core / Third party JS asset handles
36
-    const JS_HANDLE_JQUERY = 'jquery';
35
+	// WordPress core / Third party JS asset handles
36
+	const JS_HANDLE_JQUERY = 'jquery';
37 37
 
38
-    const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
38
+	const JS_HANDLE_JQUERY_VALIDATE = 'jquery-validate';
39 39
 
40
-    const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
40
+	const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
41 41
 
42
-    const JS_HANDLE_UNDERSCORE = 'underscore';
42
+	const JS_HANDLE_UNDERSCORE = 'underscore';
43 43
 
44
-    const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
44
+	const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core';
45 45
 
46
-    /**
47
-     * @since 4.9.71.p
48
-     */
49
-    const JS_HANDLE_REACT = 'react';
46
+	/**
47
+	 * @since 4.9.71.p
48
+	 */
49
+	const JS_HANDLE_REACT = 'react';
50 50
 
51
-    /**
52
-     * @since 4.9.71.p
53
-     */
54
-    const JS_HANDLE_REACT_DOM = 'react-dom';
51
+	/**
52
+	 * @since 4.9.71.p
53
+	 */
54
+	const JS_HANDLE_REACT_DOM = 'react-dom';
55 55
 
56
-    /**
57
-     * @since 4.9.71.p
58
-     */
59
-    const JS_HANDLE_LODASH = 'lodash';
56
+	/**
57
+	 * @since 4.9.71.p
58
+	 */
59
+	const JS_HANDLE_LODASH = 'lodash';
60 60
 
61
-    // EE JS assets handles
62
-    const JS_HANDLE_MANIFEST = 'ee-manifest';
61
+	// EE JS assets handles
62
+	const JS_HANDLE_MANIFEST = 'ee-manifest';
63 63
 
64
-    const JS_HANDLE_JS_CORE = 'eejs-core';
64
+	const JS_HANDLE_JS_CORE = 'eejs-core';
65 65
 
66
-    const JS_HANDLE_VENDOR = 'eventespresso-vendor';
66
+	const JS_HANDLE_VENDOR = 'eventespresso-vendor';
67 67
 
68
-    const JS_HANDLE_DATA_STORES = 'eventespresso-data-stores';
68
+	const JS_HANDLE_DATA_STORES = 'eventespresso-data-stores';
69 69
 
70
-    const JS_HANDLE_HELPERS = 'eventespresso-helpers';
70
+	const JS_HANDLE_HELPERS = 'eventespresso-helpers';
71 71
 
72
-    const JS_HANDLE_MODEL = 'eventespresso-model';
72
+	const JS_HANDLE_MODEL = 'eventespresso-model';
73 73
 
74
-    const JS_HANDLE_VALUE_OBJECTS = 'eventespresso-value-objects';
74
+	const JS_HANDLE_VALUE_OBJECTS = 'eventespresso-value-objects';
75 75
 
76
-    const JS_HANDLE_HOCS = 'eventespresso-hocs';
76
+	const JS_HANDLE_HOCS = 'eventespresso-hocs';
77 77
 
78
-    const JS_HANDLE_COMPONENTS = 'eventespresso-components';
78
+	const JS_HANDLE_COMPONENTS = 'eventespresso-components';
79 79
 
80
-    const JS_HANDLE_HOOKS = 'eventespresso-hooks';
80
+	const JS_HANDLE_HOOKS = 'eventespresso-hooks';
81 81
 
82
-    const JS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
82
+	const JS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
83 83
 
84
-    const JS_HANDLE_VALIDATORS = 'eventespresso-validators';
84
+	const JS_HANDLE_VALIDATORS = 'eventespresso-validators';
85 85
 
86
-    const JS_HANDLE_CORE = 'espresso_core';
86
+	const JS_HANDLE_CORE = 'espresso_core';
87 87
 
88
-    const JS_HANDLE_I18N = 'eei18n';
88
+	const JS_HANDLE_I18N = 'eei18n';
89 89
 
90
-    const JS_HANDLE_ACCOUNTING = 'ee-accounting';
90
+	const JS_HANDLE_ACCOUNTING = 'ee-accounting';
91 91
 
92
-    const JS_HANDLE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
92
+	const JS_HANDLE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
93 93
 
94
-    // EE CSS assets handles
95
-    const CSS_HANDLE_DEFAULT = 'espresso_default';
94
+	// EE CSS assets handles
95
+	const CSS_HANDLE_DEFAULT = 'espresso_default';
96 96
 
97
-    const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
98
-
99
-    const CSS_HANDLE_COMPONENTS = 'eventespresso-components';
100
-
101
-    const CSS_HANDLE_CORE_CSS_DEFAULT = 'eventespresso-core-css-default';
102
-
103
-    const CSS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
104
-
105
-    /**
106
-     * @var EE_Currency_Config $currency_config
107
-     */
108
-    protected $currency_config;
109
-
110
-    /**
111
-     * @var EE_Template_Config $template_config
112
-     */
113
-    protected $template_config;
114
-
115
-
116
-    /**
117
-     * CoreAssetRegister constructor.
118
-     *
119
-     * @param AssetCollection    $assets
120
-     * @param EE_Currency_Config $currency_config
121
-     * @param EE_Template_Config $template_config
122
-     * @param DomainInterface    $domain
123
-     * @param Registry           $registry
124
-     */
125
-    public function __construct(
126
-        AssetCollection $assets,
127
-        EE_Currency_Config $currency_config,
128
-        EE_Template_Config $template_config,
129
-        DomainInterface $domain,
130
-        Registry $registry
131
-    ) {
132
-        $this->currency_config = $currency_config;
133
-        $this->template_config = $template_config;
134
-        parent::__construct($domain, $assets, $registry);
135
-    }
136
-
137
-
138
-    /**
139
-     * @since 4.9.62.p
140
-     * @throws DomainException
141
-     * @throws DuplicateCollectionIdentifierException
142
-     * @throws InvalidArgumentException
143
-     * @throws InvalidDataTypeException
144
-     * @throws InvalidEntityException
145
-     * @throws InvalidInterfaceException
146
-     */
147
-    public function addAssets()
148
-    {
149
-        $this->addJavascriptFiles();
150
-        $this->addStylesheetFiles();
151
-    }
152
-
153
-
154
-    /**
155
-     * @since 4.9.62.p
156
-     * @throws DomainException
157
-     * @throws DuplicateCollectionIdentifierException
158
-     * @throws InvalidArgumentException
159
-     * @throws InvalidDataTypeException
160
-     * @throws InvalidEntityException
161
-     * @throws InvalidInterfaceException
162
-     */
163
-    public function addJavascriptFiles()
164
-    {
165
-        $this->loadCoreJs();
166
-        $this->loadJqueryValidate();
167
-        $this->loadAccountingJs();
168
-        add_action(
169
-            'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
170
-            array($this, 'loadQtipJs')
171
-        );
172
-        $this->registerAdminAssets();
173
-    }
174
-
175
-
176
-    /**
177
-     * @since 4.9.62.p
178
-     * @throws DuplicateCollectionIdentifierException
179
-     * @throws InvalidDataTypeException
180
-     * @throws InvalidEntityException
181
-     */
182
-    public function addStylesheetFiles()
183
-    {
184
-        $this->loadCoreCss();
185
-    }
186
-
187
-
188
-    /**
189
-     * core default javascript
190
-     *
191
-     * @since 4.9.62.p
192
-     * @throws DomainException
193
-     * @throws DuplicateCollectionIdentifierException
194
-     * @throws InvalidArgumentException
195
-     * @throws InvalidDataTypeException
196
-     * @throws InvalidEntityException
197
-     * @throws InvalidInterfaceException
198
-     */
199
-    private function loadCoreJs()
200
-    {
201
-        // conditionally load third-party libraries that WP core MIGHT have.
202
-        $this->registerWpAssets();
203
-
204
-        $this->addJavascript(
205
-            CoreAssetManager::JS_HANDLE_MANIFEST,
206
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'manifest')
207
-        );
208
-
209
-        $this->addJavascript(
210
-            CoreAssetManager::JS_HANDLE_JS_CORE,
211
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'eejs'),
212
-            array(CoreAssetManager::JS_HANDLE_MANIFEST)
213
-        )
214
-        ->setHasInlineData();
215
-
216
-        $this->addJavascript(
217
-            CoreAssetManager::JS_HANDLE_VENDOR,
218
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'vendor'),
219
-            array(
220
-                CoreAssetManager::JS_HANDLE_JS_CORE,
221
-                CoreAssetManager::JS_HANDLE_REACT,
222
-                CoreAssetManager::JS_HANDLE_REACT_DOM,
223
-                CoreAssetManager::JS_HANDLE_LODASH,
224
-            )
225
-        );
226
-
227
-        $this->addJavascript(
228
-            CoreAssetManager::JS_HANDLE_VALIDATORS,
229
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'validators')
230
-        )->setRequiresTranslation();
231
-
232
-        $this->addJavascript(
233
-            CoreAssetManager::JS_HANDLE_HELPERS,
234
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'helpers'),
235
-            array(
236
-                CoreAssetManager::JS_HANDLE_VALIDATORS
237
-            )
238
-        )->setRequiresTranslation();
239
-
240
-        $this->addJavascript(
241
-            CoreAssetManager::JS_HANDLE_MODEL,
242
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'model'),
243
-            array(
244
-                CoreAssetManager::JS_HANDLE_HELPERS,
245
-                CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
246
-            )
247
-        )->setRequiresTranslation();
248
-
249
-        $this->addJavascript(
250
-            CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
251
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'valueObjects'),
252
-            array(
253
-                CoreAssetManager::JS_HANDLE_VALIDATORS,
254
-                CoreAssetManager::JS_HANDLE_HELPERS,
255
-            )
256
-        )->setRequiresTranslation();
257
-
258
-        $this->addJavascript(
259
-            CoreAssetManager::JS_HANDLE_DATA_STORES,
260
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'data-stores'),
261
-            array(
262
-                CoreAssetManager::JS_HANDLE_VENDOR,
263
-                'wp-data',
264
-                'wp-api-fetch',
265
-                CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
266
-                CoreAssetManager::JS_HANDLE_MODEL,
267
-            )
268
-        )
269
-             ->setRequiresTranslation()
270
-             ->setInlineDataCallback(
271
-                 function() {
272
-                     wp_add_inline_script(
273
-                         CoreAssetManager::JS_HANDLE_DATA_STORES,
274
-                         is_admin()
275
-                             ? 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware( eejs.middleWares.apiFetch.CONTEXT_CAPS_EDIT ) )'
276
-                             : 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware )'
277
-                     );
278
-                 }
279
-             );
280
-        $this->addJavascript(
281
-            CoreAssetManager::JS_HANDLE_HOOKS,
282
-            $this->registry->getJsUrl( $this->domain->assetNamespace(), 'hooks' ),
283
-            [
284
-                CoreAssetManager::JS_HANDLE_CORE
285
-            ]
286
-        );
287
-
288
-        $this->addJavascript(
289
-            CoreAssetManager::JS_HANDLE_HOCS,
290
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'hocs'),
291
-            array(
292
-                CoreAssetManager::JS_HANDLE_DATA_STORES,
293
-                CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
294
-                CoreAssetManager::JS_HANDLE_HOOKS,
295
-                'wp-components',
296
-            )
297
-        )->setRequiresTranslation();
298
-
299
-        $this->addJavascript(
300
-            CoreAssetManager::JS_HANDLE_COMPONENTS,
301
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'components'),
302
-            array(
303
-                CoreAssetManager::JS_HANDLE_DATA_STORES,
304
-                CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
305
-                CoreAssetManager::JS_HANDLE_HOOKS,
306
-                'wp-components',
307
-            )
308
-        )
309
-        ->setRequiresTranslation();
310
-
311
-        $this->addJavascript(
312
-            CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
313
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'editor-hocs'),
314
-            array(
315
-                CoreAssetManager::JS_HANDLE_HOCS
316
-            )
317
-        )->setRequiresTranslation();
318
-
319
-        $this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
320
-        $this->registry->addData(
321
-            'paths',
322
-            array(
323
-                'base_rest_route' => rest_url(),
324
-                'rest_route' => rest_url('ee/v4.8.36/'),
325
-                'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
326
-                'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
327
-                'site_url' => site_url('/'),
328
-                'admin_url' => admin_url('/'),
329
-            )
330
-        );
331
-        // Event Espresso brand name
332
-        $this->registry->addData('brandName', Domain::brandName());
333
-        /** site formatting values **/
334
-        $this->registry->addData(
335
-            'site_formats',
336
-            array(
337
-                'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
338
-            )
339
-        );
340
-        /** currency data **/
341
-        $this->registry->addData(
342
-            'currency_config',
343
-            $this->getCurrencySettings()
344
-        );
345
-        /** site timezone */
346
-        $this->registry->addData(
347
-            'default_timezone',
348
-            array(
349
-                'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
350
-                'string' => get_option('timezone_string'),
351
-                'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
352
-            )
353
-        );
354
-        /** site locale (user locale if user logged in) */
355
-        $this->registry->addData(
356
-            'locale',
357
-            array(
358
-                'user' => get_user_locale(),
359
-                'site' => get_locale()
360
-            )
361
-        );
362
-
363
-        $this->addJavascript(
364
-            CoreAssetManager::JS_HANDLE_CORE,
365
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
366
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
367
-        )
368
-        ->setInlineDataCallback(
369
-            function () {
370
-                wp_localize_script(
371
-                    CoreAssetManager::JS_HANDLE_CORE,
372
-                    CoreAssetManager::JS_HANDLE_I18N,
373
-                    EE_Registry::$i18n_js_strings
374
-                );
375
-            }
376
-        );
377
-    }
378
-
379
-
380
-    /**
381
-     * Registers vendor files that are bundled with a later version WP but might not be for the current version of
382
-     * WordPress in the running environment.
383
-     *
384
-     * @throws DuplicateCollectionIdentifierException
385
-     * @throws InvalidDataTypeException
386
-     * @throws InvalidEntityException
387
-     * @throws DomainException
388
-     * @since 4.9.71.p
389
-     */
390
-    private function registerWpAssets()
391
-    {
392
-        global $wp_version;
393
-        if (version_compare($wp_version, '5.0.beta', '>=')) {
394
-            return;
395
-        }
396
-        $this->addVendorJavascript(CoreAssetManager::JS_HANDLE_REACT)
397
-            ->setVersion('16.6.0');
398
-        $this->addVendorJavascript(
399
-            CoreAssetManager::JS_HANDLE_REACT_DOM,
400
-            array(CoreAssetManager::JS_HANDLE_REACT)
401
-        )->setVersion('16.6.0');
402
-        $this->addVendorJavascript(CoreAssetManager::JS_HANDLE_LODASH)
403
-            ->setInlineDataCallback(
404
-                function() {
405
-                    wp_add_inline_script(
406
-                        CoreAssetManager::JS_HANDLE_LODASH,
407
-                        'window.lodash = _.noConflict();'
408
-                    );
409
-                }
410
-            )
411
-            ->setVersion('4.17.11');
412
-    }
413
-
414
-
415
-    /**
416
-     * Returns configuration data for the accounting-js library.
417
-     * @since 4.9.71.p
418
-     * @return array
419
-     */
420
-    private function getAccountingSettings() {
421
-        return array(
422
-            'currency' => array(
423
-                'symbol'    => $this->currency_config->sign,
424
-                'format'    => array(
425
-                    'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
426
-                    'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
427
-                    'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
428
-                ),
429
-                'decimal'   => $this->currency_config->dec_mrk,
430
-                'thousand'  => $this->currency_config->thsnds,
431
-                'precision' => $this->currency_config->dec_plc,
432
-            ),
433
-            'number'   => array(
434
-                'precision' => $this->currency_config->dec_plc,
435
-                'thousand'  => $this->currency_config->thsnds,
436
-                'decimal'   => $this->currency_config->dec_mrk,
437
-            ),
438
-        );
439
-    }
440
-
441
-
442
-    /**
443
-     * Returns configuration data for the js Currency VO.
444
-     * @since 4.9.71.p
445
-     * @return array
446
-     */
447
-    private function getCurrencySettings()
448
-    {
449
-        return array(
450
-            'code' => $this->currency_config->code,
451
-            'singularLabel' => $this->currency_config->name,
452
-            'pluralLabel' => $this->currency_config->plural,
453
-            'sign' => $this->currency_config->sign,
454
-            'signB4' => $this->currency_config->sign_b4,
455
-            'decimalPlaces' => $this->currency_config->dec_plc,
456
-            'decimalMark' => $this->currency_config->dec_mrk,
457
-            'thousandsSeparator' => $this->currency_config->thsnds,
458
-        );
459
-    }
460
-
461
-
462
-    /**
463
-     * @since 4.9.62.p
464
-     * @throws DuplicateCollectionIdentifierException
465
-     * @throws InvalidDataTypeException
466
-     * @throws InvalidEntityException
467
-     */
468
-    private function loadCoreCss()
469
-    {
470
-        if ($this->template_config->enable_default_style && ! is_admin()) {
471
-            $this->addStylesheet(
472
-                CoreAssetManager::CSS_HANDLE_DEFAULT,
473
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
474
-                    ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
475
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
476
-                array('dashicons')
477
-            );
478
-            //Load custom style sheet if available
479
-            if ($this->template_config->custom_style_sheet !== null) {
480
-                $this->addStylesheet(
481
-                    CoreAssetManager::CSS_HANDLE_CUSTOM,
482
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
483
-                    array(CoreAssetManager::CSS_HANDLE_DEFAULT)
484
-                );
485
-            }
486
-        }
487
-        $this->addStylesheet(
488
-            CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT,
489
-            $this->registry->getCssUrl(
490
-                $this->domain->assetNamespace(),
491
-                'core-default-theme'
492
-            ),
493
-            ['dashicons']
494
-        );
495
-        $this->addStylesheet(
496
-            CoreAssetManager::CSS_HANDLE_COMPONENTS,
497
-            $this->registry->getCssUrl(
498
-                $this->domain->assetNamespace(),
499
-                'components'
500
-            ),
501
-            [CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT, 'wp-components']
502
-        );
503
-        $this->addStylesheet(
504
-            CoreAssetManager::CSS_HANDLE_EDITOR_HOCS,
505
-            $this->registry->getCssUrl(
506
-                $this->domain->assetNamespace(),
507
-                'editor-hocs'
508
-            ),
509
-            [CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT]
510
-        );
511
-    }
512
-
513
-
514
-    /**
515
-     * jQuery Validate for form validation
516
-     *
517
-     * @since 4.9.62.p
518
-     * @throws DomainException
519
-     * @throws DuplicateCollectionIdentifierException
520
-     * @throws InvalidDataTypeException
521
-     * @throws InvalidEntityException
522
-     */
523
-    private function loadJqueryValidate()
524
-    {
525
-        $this->addJavascript(
526
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
527
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
528
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
529
-        )
530
-        ->setVersion('1.15.0');
531
-
532
-        $this->addJavascript(
533
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
534
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
535
-            array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
536
-        )
537
-        ->setVersion('1.15.0');
538
-    }
539
-
540
-
541
-    /**
542
-     * accounting.js for performing client-side calculations
543
-     *
544
-     * @since 4.9.62.p
545
-     * @throws DomainException
546
-     * @throws DuplicateCollectionIdentifierException
547
-     * @throws InvalidDataTypeException
548
-     * @throws InvalidEntityException
549
-     */
550
-    private function loadAccountingJs()
551
-    {
552
-        //accounting.js library
553
-        // @link http://josscrowcroft.github.io/accounting.js/
554
-        $this->addJavascript(
555
-            CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
556
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
557
-            array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
558
-        )
559
-        ->setVersion('0.3.2');
560
-
561
-        $this->addJavascript(
562
-            CoreAssetManager::JS_HANDLE_ACCOUNTING,
563
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
564
-            array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
565
-        )
566
-        ->setInlineDataCallback(
567
-            function () {
568
-                 wp_localize_script(
569
-                     CoreAssetManager::JS_HANDLE_ACCOUNTING,
570
-                     'EE_ACCOUNTING_CFG',
571
-                     $this->getAccountingSettings()
572
-                 );
573
-            }
574
-        )
575
-        ->setVersion();
576
-    }
577
-
578
-
579
-    /**
580
-     * registers assets for cleaning your ears
581
-     *
582
-     * @param JavascriptAsset $script
583
-     */
584
-    public function loadQtipJs(JavascriptAsset $script)
585
-    {
586
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
587
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
588
-        if (
589
-            $script->handle() === CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE
590
-            && apply_filters('FHEE_load_qtip', false)
591
-        ) {
592
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
593
-        }
594
-    }
595
-
596
-
597
-    /**
598
-     * assets that are used in the WordPress admin
599
-     *
600
-     * @since 4.9.62.p
601
-     * @throws DuplicateCollectionIdentifierException
602
-     * @throws InvalidDataTypeException
603
-     * @throws InvalidEntityException
604
-     */
605
-    private function registerAdminAssets()
606
-    {
607
-        $this->addJavascript(
608
-            CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
609
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'wp-plugins-page'),
610
-            array(
611
-                CoreAssetManager::JS_HANDLE_JQUERY,
612
-                CoreAssetManager::JS_HANDLE_VENDOR,
613
-            )
614
-        )
615
-        ->setRequiresTranslation();
616
-
617
-        $this->addStylesheet(
618
-            CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
619
-            $this->registry->getCssUrl($this->domain->assetNamespace(), 'wp-plugins-page')
620
-        );
621
-    }
97
+	const CSS_HANDLE_CUSTOM = 'espresso_custom_css';
98
+
99
+	const CSS_HANDLE_COMPONENTS = 'eventespresso-components';
100
+
101
+	const CSS_HANDLE_CORE_CSS_DEFAULT = 'eventespresso-core-css-default';
102
+
103
+	const CSS_HANDLE_EDITOR_HOCS = 'eventespresso-editor-hocs';
104
+
105
+	/**
106
+	 * @var EE_Currency_Config $currency_config
107
+	 */
108
+	protected $currency_config;
109
+
110
+	/**
111
+	 * @var EE_Template_Config $template_config
112
+	 */
113
+	protected $template_config;
114
+
115
+
116
+	/**
117
+	 * CoreAssetRegister constructor.
118
+	 *
119
+	 * @param AssetCollection    $assets
120
+	 * @param EE_Currency_Config $currency_config
121
+	 * @param EE_Template_Config $template_config
122
+	 * @param DomainInterface    $domain
123
+	 * @param Registry           $registry
124
+	 */
125
+	public function __construct(
126
+		AssetCollection $assets,
127
+		EE_Currency_Config $currency_config,
128
+		EE_Template_Config $template_config,
129
+		DomainInterface $domain,
130
+		Registry $registry
131
+	) {
132
+		$this->currency_config = $currency_config;
133
+		$this->template_config = $template_config;
134
+		parent::__construct($domain, $assets, $registry);
135
+	}
136
+
137
+
138
+	/**
139
+	 * @since 4.9.62.p
140
+	 * @throws DomainException
141
+	 * @throws DuplicateCollectionIdentifierException
142
+	 * @throws InvalidArgumentException
143
+	 * @throws InvalidDataTypeException
144
+	 * @throws InvalidEntityException
145
+	 * @throws InvalidInterfaceException
146
+	 */
147
+	public function addAssets()
148
+	{
149
+		$this->addJavascriptFiles();
150
+		$this->addStylesheetFiles();
151
+	}
152
+
153
+
154
+	/**
155
+	 * @since 4.9.62.p
156
+	 * @throws DomainException
157
+	 * @throws DuplicateCollectionIdentifierException
158
+	 * @throws InvalidArgumentException
159
+	 * @throws InvalidDataTypeException
160
+	 * @throws InvalidEntityException
161
+	 * @throws InvalidInterfaceException
162
+	 */
163
+	public function addJavascriptFiles()
164
+	{
165
+		$this->loadCoreJs();
166
+		$this->loadJqueryValidate();
167
+		$this->loadAccountingJs();
168
+		add_action(
169
+			'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
170
+			array($this, 'loadQtipJs')
171
+		);
172
+		$this->registerAdminAssets();
173
+	}
174
+
175
+
176
+	/**
177
+	 * @since 4.9.62.p
178
+	 * @throws DuplicateCollectionIdentifierException
179
+	 * @throws InvalidDataTypeException
180
+	 * @throws InvalidEntityException
181
+	 */
182
+	public function addStylesheetFiles()
183
+	{
184
+		$this->loadCoreCss();
185
+	}
186
+
187
+
188
+	/**
189
+	 * core default javascript
190
+	 *
191
+	 * @since 4.9.62.p
192
+	 * @throws DomainException
193
+	 * @throws DuplicateCollectionIdentifierException
194
+	 * @throws InvalidArgumentException
195
+	 * @throws InvalidDataTypeException
196
+	 * @throws InvalidEntityException
197
+	 * @throws InvalidInterfaceException
198
+	 */
199
+	private function loadCoreJs()
200
+	{
201
+		// conditionally load third-party libraries that WP core MIGHT have.
202
+		$this->registerWpAssets();
203
+
204
+		$this->addJavascript(
205
+			CoreAssetManager::JS_HANDLE_MANIFEST,
206
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'manifest')
207
+		);
208
+
209
+		$this->addJavascript(
210
+			CoreAssetManager::JS_HANDLE_JS_CORE,
211
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'eejs'),
212
+			array(CoreAssetManager::JS_HANDLE_MANIFEST)
213
+		)
214
+		->setHasInlineData();
215
+
216
+		$this->addJavascript(
217
+			CoreAssetManager::JS_HANDLE_VENDOR,
218
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'vendor'),
219
+			array(
220
+				CoreAssetManager::JS_HANDLE_JS_CORE,
221
+				CoreAssetManager::JS_HANDLE_REACT,
222
+				CoreAssetManager::JS_HANDLE_REACT_DOM,
223
+				CoreAssetManager::JS_HANDLE_LODASH,
224
+			)
225
+		);
226
+
227
+		$this->addJavascript(
228
+			CoreAssetManager::JS_HANDLE_VALIDATORS,
229
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'validators')
230
+		)->setRequiresTranslation();
231
+
232
+		$this->addJavascript(
233
+			CoreAssetManager::JS_HANDLE_HELPERS,
234
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'helpers'),
235
+			array(
236
+				CoreAssetManager::JS_HANDLE_VALIDATORS
237
+			)
238
+		)->setRequiresTranslation();
239
+
240
+		$this->addJavascript(
241
+			CoreAssetManager::JS_HANDLE_MODEL,
242
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'model'),
243
+			array(
244
+				CoreAssetManager::JS_HANDLE_HELPERS,
245
+				CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
246
+			)
247
+		)->setRequiresTranslation();
248
+
249
+		$this->addJavascript(
250
+			CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
251
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'valueObjects'),
252
+			array(
253
+				CoreAssetManager::JS_HANDLE_VALIDATORS,
254
+				CoreAssetManager::JS_HANDLE_HELPERS,
255
+			)
256
+		)->setRequiresTranslation();
257
+
258
+		$this->addJavascript(
259
+			CoreAssetManager::JS_HANDLE_DATA_STORES,
260
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'data-stores'),
261
+			array(
262
+				CoreAssetManager::JS_HANDLE_VENDOR,
263
+				'wp-data',
264
+				'wp-api-fetch',
265
+				CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
266
+				CoreAssetManager::JS_HANDLE_MODEL,
267
+			)
268
+		)
269
+			 ->setRequiresTranslation()
270
+			 ->setInlineDataCallback(
271
+				 function() {
272
+					 wp_add_inline_script(
273
+						 CoreAssetManager::JS_HANDLE_DATA_STORES,
274
+						 is_admin()
275
+							 ? 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware( eejs.middleWares.apiFetch.CONTEXT_CAPS_EDIT ) )'
276
+							 : 'wp.apiFetch.use( eejs.middleWares.apiFetch.capsMiddleware )'
277
+					 );
278
+				 }
279
+			 );
280
+		$this->addJavascript(
281
+			CoreAssetManager::JS_HANDLE_HOOKS,
282
+			$this->registry->getJsUrl( $this->domain->assetNamespace(), 'hooks' ),
283
+			[
284
+				CoreAssetManager::JS_HANDLE_CORE
285
+			]
286
+		);
287
+
288
+		$this->addJavascript(
289
+			CoreAssetManager::JS_HANDLE_HOCS,
290
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'hocs'),
291
+			array(
292
+				CoreAssetManager::JS_HANDLE_DATA_STORES,
293
+				CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
294
+				CoreAssetManager::JS_HANDLE_HOOKS,
295
+				'wp-components',
296
+			)
297
+		)->setRequiresTranslation();
298
+
299
+		$this->addJavascript(
300
+			CoreAssetManager::JS_HANDLE_COMPONENTS,
301
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'components'),
302
+			array(
303
+				CoreAssetManager::JS_HANDLE_DATA_STORES,
304
+				CoreAssetManager::JS_HANDLE_VALUE_OBJECTS,
305
+				CoreAssetManager::JS_HANDLE_HOOKS,
306
+				'wp-components',
307
+			)
308
+		)
309
+		->setRequiresTranslation();
310
+
311
+		$this->addJavascript(
312
+			CoreAssetManager::JS_HANDLE_EDITOR_HOCS,
313
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'editor-hocs'),
314
+			array(
315
+				CoreAssetManager::JS_HANDLE_HOCS
316
+			)
317
+		)->setRequiresTranslation();
318
+
319
+		$this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
320
+		$this->registry->addData(
321
+			'paths',
322
+			array(
323
+				'base_rest_route' => rest_url(),
324
+				'rest_route' => rest_url('ee/v4.8.36/'),
325
+				'collection_endpoints' => EED_Core_Rest_Api::getCollectionRoutesIndexedByModelName(),
326
+				'primary_keys' => EED_Core_Rest_Api::getPrimaryKeyNamesIndexedByModelName(),
327
+				'site_url' => site_url('/'),
328
+				'admin_url' => admin_url('/'),
329
+			)
330
+		);
331
+		// Event Espresso brand name
332
+		$this->registry->addData('brandName', Domain::brandName());
333
+		/** site formatting values **/
334
+		$this->registry->addData(
335
+			'site_formats',
336
+			array(
337
+				'date_formats' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats()
338
+			)
339
+		);
340
+		/** currency data **/
341
+		$this->registry->addData(
342
+			'currency_config',
343
+			$this->getCurrencySettings()
344
+		);
345
+		/** site timezone */
346
+		$this->registry->addData(
347
+			'default_timezone',
348
+			array(
349
+				'pretty' => EEH_DTT_Helper::get_timezone_string_for_display(),
350
+				'string' => get_option('timezone_string'),
351
+				'offset' => EEH_DTT_Helper::get_site_timezone_gmt_offset(),
352
+			)
353
+		);
354
+		/** site locale (user locale if user logged in) */
355
+		$this->registry->addData(
356
+			'locale',
357
+			array(
358
+				'user' => get_user_locale(),
359
+				'site' => get_locale()
360
+			)
361
+		);
362
+
363
+		$this->addJavascript(
364
+			CoreAssetManager::JS_HANDLE_CORE,
365
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
366
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
367
+		)
368
+		->setInlineDataCallback(
369
+			function () {
370
+				wp_localize_script(
371
+					CoreAssetManager::JS_HANDLE_CORE,
372
+					CoreAssetManager::JS_HANDLE_I18N,
373
+					EE_Registry::$i18n_js_strings
374
+				);
375
+			}
376
+		);
377
+	}
378
+
379
+
380
+	/**
381
+	 * Registers vendor files that are bundled with a later version WP but might not be for the current version of
382
+	 * WordPress in the running environment.
383
+	 *
384
+	 * @throws DuplicateCollectionIdentifierException
385
+	 * @throws InvalidDataTypeException
386
+	 * @throws InvalidEntityException
387
+	 * @throws DomainException
388
+	 * @since 4.9.71.p
389
+	 */
390
+	private function registerWpAssets()
391
+	{
392
+		global $wp_version;
393
+		if (version_compare($wp_version, '5.0.beta', '>=')) {
394
+			return;
395
+		}
396
+		$this->addVendorJavascript(CoreAssetManager::JS_HANDLE_REACT)
397
+			->setVersion('16.6.0');
398
+		$this->addVendorJavascript(
399
+			CoreAssetManager::JS_HANDLE_REACT_DOM,
400
+			array(CoreAssetManager::JS_HANDLE_REACT)
401
+		)->setVersion('16.6.0');
402
+		$this->addVendorJavascript(CoreAssetManager::JS_HANDLE_LODASH)
403
+			->setInlineDataCallback(
404
+				function() {
405
+					wp_add_inline_script(
406
+						CoreAssetManager::JS_HANDLE_LODASH,
407
+						'window.lodash = _.noConflict();'
408
+					);
409
+				}
410
+			)
411
+			->setVersion('4.17.11');
412
+	}
413
+
414
+
415
+	/**
416
+	 * Returns configuration data for the accounting-js library.
417
+	 * @since 4.9.71.p
418
+	 * @return array
419
+	 */
420
+	private function getAccountingSettings() {
421
+		return array(
422
+			'currency' => array(
423
+				'symbol'    => $this->currency_config->sign,
424
+				'format'    => array(
425
+					'pos'  => $this->currency_config->sign_b4 ? '%s%v' : '%v%s',
426
+					'neg'  => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s',
427
+					'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s',
428
+				),
429
+				'decimal'   => $this->currency_config->dec_mrk,
430
+				'thousand'  => $this->currency_config->thsnds,
431
+				'precision' => $this->currency_config->dec_plc,
432
+			),
433
+			'number'   => array(
434
+				'precision' => $this->currency_config->dec_plc,
435
+				'thousand'  => $this->currency_config->thsnds,
436
+				'decimal'   => $this->currency_config->dec_mrk,
437
+			),
438
+		);
439
+	}
440
+
441
+
442
+	/**
443
+	 * Returns configuration data for the js Currency VO.
444
+	 * @since 4.9.71.p
445
+	 * @return array
446
+	 */
447
+	private function getCurrencySettings()
448
+	{
449
+		return array(
450
+			'code' => $this->currency_config->code,
451
+			'singularLabel' => $this->currency_config->name,
452
+			'pluralLabel' => $this->currency_config->plural,
453
+			'sign' => $this->currency_config->sign,
454
+			'signB4' => $this->currency_config->sign_b4,
455
+			'decimalPlaces' => $this->currency_config->dec_plc,
456
+			'decimalMark' => $this->currency_config->dec_mrk,
457
+			'thousandsSeparator' => $this->currency_config->thsnds,
458
+		);
459
+	}
460
+
461
+
462
+	/**
463
+	 * @since 4.9.62.p
464
+	 * @throws DuplicateCollectionIdentifierException
465
+	 * @throws InvalidDataTypeException
466
+	 * @throws InvalidEntityException
467
+	 */
468
+	private function loadCoreCss()
469
+	{
470
+		if ($this->template_config->enable_default_style && ! is_admin()) {
471
+			$this->addStylesheet(
472
+				CoreAssetManager::CSS_HANDLE_DEFAULT,
473
+				is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
474
+					? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
475
+					: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
476
+				array('dashicons')
477
+			);
478
+			//Load custom style sheet if available
479
+			if ($this->template_config->custom_style_sheet !== null) {
480
+				$this->addStylesheet(
481
+					CoreAssetManager::CSS_HANDLE_CUSTOM,
482
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
483
+					array(CoreAssetManager::CSS_HANDLE_DEFAULT)
484
+				);
485
+			}
486
+		}
487
+		$this->addStylesheet(
488
+			CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT,
489
+			$this->registry->getCssUrl(
490
+				$this->domain->assetNamespace(),
491
+				'core-default-theme'
492
+			),
493
+			['dashicons']
494
+		);
495
+		$this->addStylesheet(
496
+			CoreAssetManager::CSS_HANDLE_COMPONENTS,
497
+			$this->registry->getCssUrl(
498
+				$this->domain->assetNamespace(),
499
+				'components'
500
+			),
501
+			[CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT, 'wp-components']
502
+		);
503
+		$this->addStylesheet(
504
+			CoreAssetManager::CSS_HANDLE_EDITOR_HOCS,
505
+			$this->registry->getCssUrl(
506
+				$this->domain->assetNamespace(),
507
+				'editor-hocs'
508
+			),
509
+			[CoreAssetManager::CSS_HANDLE_CORE_CSS_DEFAULT]
510
+		);
511
+	}
512
+
513
+
514
+	/**
515
+	 * jQuery Validate for form validation
516
+	 *
517
+	 * @since 4.9.62.p
518
+	 * @throws DomainException
519
+	 * @throws DuplicateCollectionIdentifierException
520
+	 * @throws InvalidDataTypeException
521
+	 * @throws InvalidEntityException
522
+	 */
523
+	private function loadJqueryValidate()
524
+	{
525
+		$this->addJavascript(
526
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
527
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
528
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
529
+		)
530
+		->setVersion('1.15.0');
531
+
532
+		$this->addJavascript(
533
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
534
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
535
+			array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
536
+		)
537
+		->setVersion('1.15.0');
538
+	}
539
+
540
+
541
+	/**
542
+	 * accounting.js for performing client-side calculations
543
+	 *
544
+	 * @since 4.9.62.p
545
+	 * @throws DomainException
546
+	 * @throws DuplicateCollectionIdentifierException
547
+	 * @throws InvalidDataTypeException
548
+	 * @throws InvalidEntityException
549
+	 */
550
+	private function loadAccountingJs()
551
+	{
552
+		//accounting.js library
553
+		// @link http://josscrowcroft.github.io/accounting.js/
554
+		$this->addJavascript(
555
+			CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
556
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
557
+			array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
558
+		)
559
+		->setVersion('0.3.2');
560
+
561
+		$this->addJavascript(
562
+			CoreAssetManager::JS_HANDLE_ACCOUNTING,
563
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
564
+			array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
565
+		)
566
+		->setInlineDataCallback(
567
+			function () {
568
+				 wp_localize_script(
569
+					 CoreAssetManager::JS_HANDLE_ACCOUNTING,
570
+					 'EE_ACCOUNTING_CFG',
571
+					 $this->getAccountingSettings()
572
+				 );
573
+			}
574
+		)
575
+		->setVersion();
576
+	}
577
+
578
+
579
+	/**
580
+	 * registers assets for cleaning your ears
581
+	 *
582
+	 * @param JavascriptAsset $script
583
+	 */
584
+	public function loadQtipJs(JavascriptAsset $script)
585
+	{
586
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
587
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
588
+		if (
589
+			$script->handle() === CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE
590
+			&& apply_filters('FHEE_load_qtip', false)
591
+		) {
592
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
593
+		}
594
+	}
595
+
596
+
597
+	/**
598
+	 * assets that are used in the WordPress admin
599
+	 *
600
+	 * @since 4.9.62.p
601
+	 * @throws DuplicateCollectionIdentifierException
602
+	 * @throws InvalidDataTypeException
603
+	 * @throws InvalidEntityException
604
+	 */
605
+	private function registerAdminAssets()
606
+	{
607
+		$this->addJavascript(
608
+			CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
609
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'wp-plugins-page'),
610
+			array(
611
+				CoreAssetManager::JS_HANDLE_JQUERY,
612
+				CoreAssetManager::JS_HANDLE_VENDOR,
613
+			)
614
+		)
615
+		->setRequiresTranslation();
616
+
617
+		$this->addStylesheet(
618
+			CoreAssetManager::JS_HANDLE_WP_PLUGINS_PAGE,
619
+			$this->registry->getCssUrl($this->domain->assetNamespace(), 'wp-plugins-page')
620
+		);
621
+	}
622 622
 }
Please login to merge, or discard this patch.