Completed
Pull Request — master (#471)
by Darren
18:25
created
core/domain/services/assets/CoreAssetManager.php 2 patches
Indentation   +325 added lines, -325 removed lines patch added patch discarded remove patch
@@ -27,329 +27,329 @@
 block discarded – undo
27 27
 class CoreAssetManager extends AssetManager
28 28
 {
29 29
 
30
-    // WordPress core / Third party JS asset handles
31
-    const JS_HANDLE_JQUERY                = 'jquery';
32
-
33
-    const JS_HANDLE_JQUERY_VALIDATE       = 'jquery-validate';
34
-
35
-    const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
36
-
37
-    const JS_HANDLE_UNDERSCORE            = 'underscore';
38
-
39
-    const JS_HANDLE_ACCOUNTING_CORE       = 'ee-accounting-core';
40
-
41
-    // EE JS assets handles
42
-    const JS_HANDLE_EE_MANIFEST        = 'ee-manifest';
43
-
44
-    const JS_HANDLE_EE_JS_CORE         = 'eejs-core';
45
-
46
-    const JS_HANDLE_EE_VENDOR           = 'eventespresso-vendor';
47
-
48
-    const JS_HANDLE_EE_JS_API          = 'eejs-api';
49
-
50
-    const JS_HANDLE_EE_CORE            = 'espresso_core';
51
-
52
-    const JS_HANDLE_EE_I18N            = 'eei18n';
53
-
54
-    const JS_HANDLE_EE_ACCOUNTING      = 'ee-accounting';
55
-
56
-    const JS_HANDLE_EE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
57
-
58
-    // EE CSS assets handles
59
-    const CSS_HANDLE_EE_DEFAULT = 'espresso_default';
60
-
61
-    const CSS_HANDLE_EE_CUSTOM  = 'espresso_custom_css';
62
-
63
-    /**
64
-     * @var EE_Currency_Config $currency_config
65
-     */
66
-    protected $currency_config;
67
-
68
-    /**
69
-     * @var EE_Template_Config $template_config
70
-     */
71
-    protected $template_config;
72
-
73
-
74
-    /**
75
-     * CoreAssetRegister constructor.
76
-     *
77
-     * @param AssetCollection    $assets
78
-     * @param EE_Currency_Config $currency_config
79
-     * @param EE_Template_Config $template_config
80
-     * @param DomainInterface    $domain
81
-     * @param Registry           $registry
82
-     */
83
-    public function __construct(
84
-        AssetCollection $assets,
85
-        EE_Currency_Config $currency_config,
86
-        EE_Template_Config $template_config,
87
-        DomainInterface $domain,
88
-        Registry $registry
89
-    ) {
90
-        $this->currency_config = $currency_config;
91
-        $this->template_config = $template_config;
92
-        parent::__construct($domain, $assets, $registry);
93
-    }
94
-
95
-
96
-    /**
97
-     * @since 4.9.62.p
98
-     * @throws DuplicateCollectionIdentifierException
99
-     * @throws InvalidArgumentException
100
-     * @throws InvalidDataTypeException
101
-     * @throws InvalidEntityException
102
-     */
103
-    public function addAssets()
104
-    {
105
-        $this->addJavascriptFiles();
106
-        $this->addStylesheetFiles();
107
-    }
108
-
109
-
110
-    /**
111
-     * @since 4.9.62.p
112
-     * @throws DuplicateCollectionIdentifierException
113
-     * @throws InvalidArgumentException
114
-     * @throws InvalidDataTypeException
115
-     * @throws InvalidEntityException
116
-     */
117
-    public function addJavascriptFiles()
118
-    {
119
-        $this->loadCoreJs();
120
-        $this->loadJqueryValidate();
121
-        $this->loadAccountingJs();
122
-        add_action(
123
-            'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
124
-            array($this, 'loadQtipJs')
125
-        );
126
-        $this->registerAdminAssets();
127
-    }
128
-
129
-
130
-    /**
131
-     * @since 4.9.62.p
132
-     * @throws DuplicateCollectionIdentifierException
133
-     * @throws InvalidDataTypeException
134
-     * @throws InvalidEntityException
135
-     */
136
-    public function addStylesheetFiles()
137
-    {
138
-        $this->loadCoreCss();
139
-    }
140
-
141
-
142
-    /**
143
-     * core default javascript
144
-     *
145
-     * @since 4.9.62.p
146
-     * @throws DuplicateCollectionIdentifierException
147
-     * @throws InvalidArgumentException
148
-     * @throws InvalidDataTypeException
149
-     * @throws InvalidEntityException
150
-     */
151
-    private function loadCoreJs()
152
-    {
153
-        $this->addJavascript(
154
-            CoreAssetManager::JS_HANDLE_EE_MANIFEST,
155
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'manifest')
156
-        );
157
-
158
-        $this->addJavascript(
159
-            CoreAssetManager::JS_HANDLE_EE_JS_CORE,
160
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'eejs'),
161
-            array(CoreAssetManager::JS_HANDLE_EE_MANIFEST)
162
-        )
163
-        ->setHasInlineData();
164
-
165
-        $this->addJavascript(
166
-            CoreAssetManager::JS_HANDLE_EE_VENDOR,
167
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'vendor'),
168
-            array(CoreAssetManager::JS_HANDLE_EE_JS_CORE)
169
-        );
170
-
171
-        global $wp_version;
172
-        if (version_compare($wp_version, '4.4.0', '>')) {
173
-            //js.api
174
-            $this->addJavascript(
175
-                CoreAssetManager::JS_HANDLE_EE_JS_API,
176
-                EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
177
-                array(
178
-                    CoreAssetManager::JS_HANDLE_UNDERSCORE,
179
-                    CoreAssetManager::JS_HANDLE_EE_JS_CORE
180
-                )
181
-            );
182
-            $this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
183
-            $this->registry->addData('paths', array('rest_route' => rest_url('ee/v4.8.36/')));
184
-        }
185
-
186
-        $this->addJavascript(
187
-            CoreAssetManager::JS_HANDLE_EE_CORE,
188
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
189
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
190
-        )
191
-        ->setInlineDataCallback(
192
-            function () {
193
-                wp_localize_script(
194
-                    CoreAssetManager::JS_HANDLE_EE_CORE,
195
-                    CoreAssetManager::JS_HANDLE_EE_I18N,
196
-                    EE_Registry::$i18n_js_strings
197
-                );
198
-            }
199
-        );
200
-    }
201
-
202
-
203
-    /**
204
-     * @since 4.9.62.p
205
-     * @throws DuplicateCollectionIdentifierException
206
-     * @throws InvalidDataTypeException
207
-     * @throws InvalidEntityException
208
-     */
209
-    private function loadCoreCss()
210
-    {
211
-        if ($this->template_config->enable_default_style && ! is_admin()) {
212
-            $this->addStylesheet(
213
-                CoreAssetManager::CSS_HANDLE_EE_DEFAULT,
214
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
215
-                    ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
216
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
217
-                array('dashicons')
218
-            );
219
-            //Load custom style sheet if available
220
-            if ($this->template_config->custom_style_sheet !== null) {
221
-                $this->addStylesheet(
222
-                    CoreAssetManager::CSS_HANDLE_EE_CUSTOM,
223
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
224
-                    array(CoreAssetManager::CSS_HANDLE_EE_DEFAULT)
225
-                );
226
-            }
227
-        }
228
-    }
229
-
230
-
231
-    /**
232
-     * jQuery Validate for form validation
233
-     *
234
-     * @since 4.9.62.p
235
-     * @throws DuplicateCollectionIdentifierException
236
-     * @throws InvalidDataTypeException
237
-     * @throws InvalidEntityException
238
-     */
239
-    private function loadJqueryValidate()
240
-    {
241
-        $this->addJavascript(
242
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
243
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
244
-            array(CoreAssetManager::JS_HANDLE_JQUERY)
245
-        )
246
-        ->setVersion('1.15.0');
247
-
248
-        $this->addJavascript(
249
-            CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
250
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
251
-            array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
252
-        )
253
-        ->setVersion('1.15.0');
254
-    }
255
-
256
-
257
-    /**
258
-     * accounting.js for performing client-side calculations
259
-     *
260
-     * @since 4.9.62.p
261
-     * @throws DuplicateCollectionIdentifierException
262
-     * @throws InvalidDataTypeException
263
-     * @throws InvalidEntityException
264
-     */
265
-    private function loadAccountingJs()
266
-    {
267
-        //accounting.js library
268
-        // @link http://josscrowcroft.github.io/accounting.js/
269
-        $this->addJavascript(
270
-            CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
271
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
272
-            array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
273
-        )
274
-        ->setVersion('0.3.2');
275
-
276
-        $currency_config = $this->currency_config;
277
-        $this->addJavascript(
278
-            CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
279
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
280
-            array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
281
-        )
282
-        ->setInlineDataCallback(
283
-            function () use ($currency_config) {
284
-                 wp_localize_script(
285
-                     CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
286
-                     'EE_ACCOUNTING_CFG',
287
-                     array(
288
-                         'currency' => array(
289
-                             'symbol'    => $currency_config->sign,
290
-                             'format'    => array(
291
-                                 'pos'  => $currency_config->sign_b4 ? '%s%v' : '%v%s',
292
-                                 'neg'  => $currency_config->sign_b4 ? '- %s%v' : '- %v%s',
293
-                                 'zero' => $currency_config->sign_b4 ? '%s--' : '--%s',
294
-                             ),
295
-                             'decimal'   => $currency_config->dec_mrk,
296
-                             'thousand'  => $currency_config->thsnds,
297
-                             'precision' => $currency_config->dec_plc,
298
-                         ),
299
-                         'number'   => array(
300
-                             'precision' => $currency_config->dec_plc,
301
-                             'thousand'  => $currency_config->thsnds,
302
-                             'decimal'   => $currency_config->dec_mrk,
303
-                         ),
304
-                     )
305
-                 );
306
-            }
307
-        )
308
-        ->setVersion();
309
-    }
310
-
311
-
312
-    /**
313
-     * registers assets for cleaning your ears
314
-     *
315
-     * @param JavascriptAsset $script
316
-     */
317
-    public function loadQtipJs(JavascriptAsset $script)
318
-    {
319
-        // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
320
-        // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
321
-        if (
322
-            $script->handle() === CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE
323
-            && apply_filters('FHEE_load_qtip', false)
324
-        ) {
325
-            EEH_Qtip_Loader::instance()->register_and_enqueue();
326
-        }
327
-    }
328
-
329
-
330
-    /**
331
-     * assets that are used in the WordPress admin
332
-     *
333
-     * @since 4.9.62.p
334
-     * @throws DuplicateCollectionIdentifierException
335
-     * @throws InvalidDataTypeException
336
-     * @throws InvalidEntityException
337
-     */
338
-    private function registerAdminAssets()
339
-    {
340
-        $this->addJavascript(
341
-            CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE,
342
-            $this->registry->getJsUrl($this->domain->assetNamespace(), 'wp-plugins-page'),
343
-            array(
344
-                CoreAssetManager::JS_HANDLE_JQUERY,
345
-                CoreAssetManager::JS_HANDLE_EE_VENDOR,
346
-            )
347
-        )
348
-        ->setRequiresTranslation();
349
-
350
-        $this->addStylesheet(
351
-            CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE,
352
-            $this->registry->getCssUrl($this->domain->assetNamespace(), 'wp-plugins-page')
353
-        );
354
-    }
30
+	// WordPress core / Third party JS asset handles
31
+	const JS_HANDLE_JQUERY                = 'jquery';
32
+
33
+	const JS_HANDLE_JQUERY_VALIDATE       = 'jquery-validate';
34
+
35
+	const JS_HANDLE_JQUERY_VALIDATE_EXTRA = 'jquery-validate-extra-methods';
36
+
37
+	const JS_HANDLE_UNDERSCORE            = 'underscore';
38
+
39
+	const JS_HANDLE_ACCOUNTING_CORE       = 'ee-accounting-core';
40
+
41
+	// EE JS assets handles
42
+	const JS_HANDLE_EE_MANIFEST        = 'ee-manifest';
43
+
44
+	const JS_HANDLE_EE_JS_CORE         = 'eejs-core';
45
+
46
+	const JS_HANDLE_EE_VENDOR           = 'eventespresso-vendor';
47
+
48
+	const JS_HANDLE_EE_JS_API          = 'eejs-api';
49
+
50
+	const JS_HANDLE_EE_CORE            = 'espresso_core';
51
+
52
+	const JS_HANDLE_EE_I18N            = 'eei18n';
53
+
54
+	const JS_HANDLE_EE_ACCOUNTING      = 'ee-accounting';
55
+
56
+	const JS_HANDLE_EE_WP_PLUGINS_PAGE = 'ee-wp-plugins-page';
57
+
58
+	// EE CSS assets handles
59
+	const CSS_HANDLE_EE_DEFAULT = 'espresso_default';
60
+
61
+	const CSS_HANDLE_EE_CUSTOM  = 'espresso_custom_css';
62
+
63
+	/**
64
+	 * @var EE_Currency_Config $currency_config
65
+	 */
66
+	protected $currency_config;
67
+
68
+	/**
69
+	 * @var EE_Template_Config $template_config
70
+	 */
71
+	protected $template_config;
72
+
73
+
74
+	/**
75
+	 * CoreAssetRegister constructor.
76
+	 *
77
+	 * @param AssetCollection    $assets
78
+	 * @param EE_Currency_Config $currency_config
79
+	 * @param EE_Template_Config $template_config
80
+	 * @param DomainInterface    $domain
81
+	 * @param Registry           $registry
82
+	 */
83
+	public function __construct(
84
+		AssetCollection $assets,
85
+		EE_Currency_Config $currency_config,
86
+		EE_Template_Config $template_config,
87
+		DomainInterface $domain,
88
+		Registry $registry
89
+	) {
90
+		$this->currency_config = $currency_config;
91
+		$this->template_config = $template_config;
92
+		parent::__construct($domain, $assets, $registry);
93
+	}
94
+
95
+
96
+	/**
97
+	 * @since 4.9.62.p
98
+	 * @throws DuplicateCollectionIdentifierException
99
+	 * @throws InvalidArgumentException
100
+	 * @throws InvalidDataTypeException
101
+	 * @throws InvalidEntityException
102
+	 */
103
+	public function addAssets()
104
+	{
105
+		$this->addJavascriptFiles();
106
+		$this->addStylesheetFiles();
107
+	}
108
+
109
+
110
+	/**
111
+	 * @since 4.9.62.p
112
+	 * @throws DuplicateCollectionIdentifierException
113
+	 * @throws InvalidArgumentException
114
+	 * @throws InvalidDataTypeException
115
+	 * @throws InvalidEntityException
116
+	 */
117
+	public function addJavascriptFiles()
118
+	{
119
+		$this->loadCoreJs();
120
+		$this->loadJqueryValidate();
121
+		$this->loadAccountingJs();
122
+		add_action(
123
+			'AHEE__EventEspresso_core_services_assets_Registry__registerScripts__before_script',
124
+			array($this, 'loadQtipJs')
125
+		);
126
+		$this->registerAdminAssets();
127
+	}
128
+
129
+
130
+	/**
131
+	 * @since 4.9.62.p
132
+	 * @throws DuplicateCollectionIdentifierException
133
+	 * @throws InvalidDataTypeException
134
+	 * @throws InvalidEntityException
135
+	 */
136
+	public function addStylesheetFiles()
137
+	{
138
+		$this->loadCoreCss();
139
+	}
140
+
141
+
142
+	/**
143
+	 * core default javascript
144
+	 *
145
+	 * @since 4.9.62.p
146
+	 * @throws DuplicateCollectionIdentifierException
147
+	 * @throws InvalidArgumentException
148
+	 * @throws InvalidDataTypeException
149
+	 * @throws InvalidEntityException
150
+	 */
151
+	private function loadCoreJs()
152
+	{
153
+		$this->addJavascript(
154
+			CoreAssetManager::JS_HANDLE_EE_MANIFEST,
155
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'manifest')
156
+		);
157
+
158
+		$this->addJavascript(
159
+			CoreAssetManager::JS_HANDLE_EE_JS_CORE,
160
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'eejs'),
161
+			array(CoreAssetManager::JS_HANDLE_EE_MANIFEST)
162
+		)
163
+		->setHasInlineData();
164
+
165
+		$this->addJavascript(
166
+			CoreAssetManager::JS_HANDLE_EE_VENDOR,
167
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'vendor'),
168
+			array(CoreAssetManager::JS_HANDLE_EE_JS_CORE)
169
+		);
170
+
171
+		global $wp_version;
172
+		if (version_compare($wp_version, '4.4.0', '>')) {
173
+			//js.api
174
+			$this->addJavascript(
175
+				CoreAssetManager::JS_HANDLE_EE_JS_API,
176
+				EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
177
+				array(
178
+					CoreAssetManager::JS_HANDLE_UNDERSCORE,
179
+					CoreAssetManager::JS_HANDLE_EE_JS_CORE
180
+				)
181
+			);
182
+			$this->registry->addData('eejs_api_nonce', wp_create_nonce('wp_rest'));
183
+			$this->registry->addData('paths', array('rest_route' => rest_url('ee/v4.8.36/')));
184
+		}
185
+
186
+		$this->addJavascript(
187
+			CoreAssetManager::JS_HANDLE_EE_CORE,
188
+			EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
189
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
190
+		)
191
+		->setInlineDataCallback(
192
+			function () {
193
+				wp_localize_script(
194
+					CoreAssetManager::JS_HANDLE_EE_CORE,
195
+					CoreAssetManager::JS_HANDLE_EE_I18N,
196
+					EE_Registry::$i18n_js_strings
197
+				);
198
+			}
199
+		);
200
+	}
201
+
202
+
203
+	/**
204
+	 * @since 4.9.62.p
205
+	 * @throws DuplicateCollectionIdentifierException
206
+	 * @throws InvalidDataTypeException
207
+	 * @throws InvalidEntityException
208
+	 */
209
+	private function loadCoreCss()
210
+	{
211
+		if ($this->template_config->enable_default_style && ! is_admin()) {
212
+			$this->addStylesheet(
213
+				CoreAssetManager::CSS_HANDLE_EE_DEFAULT,
214
+				is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
215
+					? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
216
+					: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
217
+				array('dashicons')
218
+			);
219
+			//Load custom style sheet if available
220
+			if ($this->template_config->custom_style_sheet !== null) {
221
+				$this->addStylesheet(
222
+					CoreAssetManager::CSS_HANDLE_EE_CUSTOM,
223
+					EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
224
+					array(CoreAssetManager::CSS_HANDLE_EE_DEFAULT)
225
+				);
226
+			}
227
+		}
228
+	}
229
+
230
+
231
+	/**
232
+	 * jQuery Validate for form validation
233
+	 *
234
+	 * @since 4.9.62.p
235
+	 * @throws DuplicateCollectionIdentifierException
236
+	 * @throws InvalidDataTypeException
237
+	 * @throws InvalidEntityException
238
+	 */
239
+	private function loadJqueryValidate()
240
+	{
241
+		$this->addJavascript(
242
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
243
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
244
+			array(CoreAssetManager::JS_HANDLE_JQUERY)
245
+		)
246
+		->setVersion('1.15.0');
247
+
248
+		$this->addJavascript(
249
+			CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
250
+			EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
251
+			array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
252
+		)
253
+		->setVersion('1.15.0');
254
+	}
255
+
256
+
257
+	/**
258
+	 * accounting.js for performing client-side calculations
259
+	 *
260
+	 * @since 4.9.62.p
261
+	 * @throws DuplicateCollectionIdentifierException
262
+	 * @throws InvalidDataTypeException
263
+	 * @throws InvalidEntityException
264
+	 */
265
+	private function loadAccountingJs()
266
+	{
267
+		//accounting.js library
268
+		// @link http://josscrowcroft.github.io/accounting.js/
269
+		$this->addJavascript(
270
+			CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
271
+			EE_THIRD_PARTY_URL . 'accounting/accounting.js',
272
+			array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
273
+		)
274
+		->setVersion('0.3.2');
275
+
276
+		$currency_config = $this->currency_config;
277
+		$this->addJavascript(
278
+			CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
279
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
280
+			array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
281
+		)
282
+		->setInlineDataCallback(
283
+			function () use ($currency_config) {
284
+				 wp_localize_script(
285
+					 CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
286
+					 'EE_ACCOUNTING_CFG',
287
+					 array(
288
+						 'currency' => array(
289
+							 'symbol'    => $currency_config->sign,
290
+							 'format'    => array(
291
+								 'pos'  => $currency_config->sign_b4 ? '%s%v' : '%v%s',
292
+								 'neg'  => $currency_config->sign_b4 ? '- %s%v' : '- %v%s',
293
+								 'zero' => $currency_config->sign_b4 ? '%s--' : '--%s',
294
+							 ),
295
+							 'decimal'   => $currency_config->dec_mrk,
296
+							 'thousand'  => $currency_config->thsnds,
297
+							 'precision' => $currency_config->dec_plc,
298
+						 ),
299
+						 'number'   => array(
300
+							 'precision' => $currency_config->dec_plc,
301
+							 'thousand'  => $currency_config->thsnds,
302
+							 'decimal'   => $currency_config->dec_mrk,
303
+						 ),
304
+					 )
305
+				 );
306
+			}
307
+		)
308
+		->setVersion();
309
+	}
310
+
311
+
312
+	/**
313
+	 * registers assets for cleaning your ears
314
+	 *
315
+	 * @param JavascriptAsset $script
316
+	 */
317
+	public function loadQtipJs(JavascriptAsset $script)
318
+	{
319
+		// qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook,
320
+		// can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
321
+		if (
322
+			$script->handle() === CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE
323
+			&& apply_filters('FHEE_load_qtip', false)
324
+		) {
325
+			EEH_Qtip_Loader::instance()->register_and_enqueue();
326
+		}
327
+	}
328
+
329
+
330
+	/**
331
+	 * assets that are used in the WordPress admin
332
+	 *
333
+	 * @since 4.9.62.p
334
+	 * @throws DuplicateCollectionIdentifierException
335
+	 * @throws InvalidDataTypeException
336
+	 * @throws InvalidEntityException
337
+	 */
338
+	private function registerAdminAssets()
339
+	{
340
+		$this->addJavascript(
341
+			CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE,
342
+			$this->registry->getJsUrl($this->domain->assetNamespace(), 'wp-plugins-page'),
343
+			array(
344
+				CoreAssetManager::JS_HANDLE_JQUERY,
345
+				CoreAssetManager::JS_HANDLE_EE_VENDOR,
346
+			)
347
+		)
348
+		->setRequiresTranslation();
349
+
350
+		$this->addStylesheet(
351
+			CoreAssetManager::JS_HANDLE_EE_WP_PLUGINS_PAGE,
352
+			$this->registry->getCssUrl($this->domain->assetNamespace(), 'wp-plugins-page')
353
+		);
354
+	}
355 355
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     const JS_HANDLE_EE_JS_CORE         = 'eejs-core';
45 45
 
46
-    const JS_HANDLE_EE_VENDOR           = 'eventespresso-vendor';
46
+    const JS_HANDLE_EE_VENDOR = 'eventespresso-vendor';
47 47
 
48 48
     const JS_HANDLE_EE_JS_API          = 'eejs-api';
49 49
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             //js.api
174 174
             $this->addJavascript(
175 175
                 CoreAssetManager::JS_HANDLE_EE_JS_API,
176
-                EE_LIBRARIES_URL . 'rest_api/assets/js/eejs-api.min.js',
176
+                EE_LIBRARIES_URL.'rest_api/assets/js/eejs-api.min.js',
177 177
                 array(
178 178
                     CoreAssetManager::JS_HANDLE_UNDERSCORE,
179 179
                     CoreAssetManager::JS_HANDLE_EE_JS_CORE
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 
186 186
         $this->addJavascript(
187 187
             CoreAssetManager::JS_HANDLE_EE_CORE,
188
-            EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js',
188
+            EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js',
189 189
             array(CoreAssetManager::JS_HANDLE_JQUERY)
190 190
         )
191 191
         ->setInlineDataCallback(
192
-            function () {
192
+            function() {
193 193
                 wp_localize_script(
194 194
                     CoreAssetManager::JS_HANDLE_EE_CORE,
195 195
                     CoreAssetManager::JS_HANDLE_EE_I18N,
@@ -211,16 +211,16 @@  discard block
 block discarded – undo
211 211
         if ($this->template_config->enable_default_style && ! is_admin()) {
212 212
             $this->addStylesheet(
213 213
                 CoreAssetManager::CSS_HANDLE_EE_DEFAULT,
214
-                is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css')
214
+                is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')
215 215
                     ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css'
216
-                    : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css',
216
+                    : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css',
217 217
                 array('dashicons')
218 218
             );
219 219
             //Load custom style sheet if available
220 220
             if ($this->template_config->custom_style_sheet !== null) {
221 221
                 $this->addStylesheet(
222 222
                     CoreAssetManager::CSS_HANDLE_EE_CUSTOM,
223
-                    EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->template_config->custom_style_sheet,
223
+                    EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->template_config->custom_style_sheet,
224 224
                     array(CoreAssetManager::CSS_HANDLE_EE_DEFAULT)
225 225
                 );
226 226
             }
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     {
241 241
         $this->addJavascript(
242 242
             CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE,
243
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js',
243
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js',
244 244
             array(CoreAssetManager::JS_HANDLE_JQUERY)
245 245
         )
246 246
         ->setVersion('1.15.0');
247 247
 
248 248
         $this->addJavascript(
249 249
             CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE_EXTRA,
250
-            EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js',
250
+            EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js',
251 251
             array(CoreAssetManager::JS_HANDLE_JQUERY_VALIDATE)
252 252
         )
253 253
         ->setVersion('1.15.0');
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         // @link http://josscrowcroft.github.io/accounting.js/
269 269
         $this->addJavascript(
270 270
             CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE,
271
-            EE_THIRD_PARTY_URL . 'accounting/accounting.js',
271
+            EE_THIRD_PARTY_URL.'accounting/accounting.js',
272 272
             array(CoreAssetManager::JS_HANDLE_UNDERSCORE)
273 273
         )
274 274
         ->setVersion('0.3.2');
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
         $currency_config = $this->currency_config;
277 277
         $this->addJavascript(
278 278
             CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
279
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js',
279
+            EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js',
280 280
             array(CoreAssetManager::JS_HANDLE_ACCOUNTING_CORE)
281 281
         )
282 282
         ->setInlineDataCallback(
283
-            function () use ($currency_config) {
283
+            function() use ($currency_config) {
284 284
                  wp_localize_script(
285 285
                      CoreAssetManager::JS_HANDLE_EE_ACCOUNTING,
286 286
                      'EE_ACCOUNTING_CFG',
Please login to merge, or discard this patch.