@@ -29,164 +29,164 @@ |
||
29 | 29 | class CoreAssetManager extends AssetManager |
30 | 30 | { |
31 | 31 | |
32 | - // WordPress core / Third party JS asset handles |
|
33 | - const JS_HANDLE_JS_CORE = 'eejs-core'; |
|
34 | - |
|
35 | - const JS_HANDLE_CORE = 'espresso_core'; |
|
36 | - |
|
37 | - const JS_HANDLE_I18N = 'eei18n'; |
|
38 | - |
|
39 | - const JS_HANDLE_VENDOR = 'eventespresso-vendor'; |
|
40 | - |
|
41 | - const JS_HANDLE_RAMDA = 'ramda'; |
|
42 | - |
|
43 | - const RAMDA_VERSION = '0.27.1'; |
|
44 | - |
|
45 | - // EE CSS assets handles |
|
46 | - const CSS_HANDLE_DEFAULT = 'espresso_default'; |
|
47 | - |
|
48 | - const CSS_HANDLE_CUSTOM = 'espresso_custom_css'; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var EE_Currency_Config $currency_config |
|
52 | - */ |
|
53 | - protected $currency_config; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var EE_Template_Config $template_config |
|
57 | - */ |
|
58 | - protected $template_config; |
|
59 | - |
|
60 | - |
|
61 | - /** |
|
62 | - * CoreAssetRegister constructor. |
|
63 | - * |
|
64 | - * @param AssetCollection $assets |
|
65 | - * @param EE_Currency_Config $currency_config |
|
66 | - * @param EE_Template_Config $template_config |
|
67 | - * @param DomainInterface $domain |
|
68 | - * @param Registry $registry |
|
69 | - */ |
|
70 | - public function __construct( |
|
71 | - AssetCollection $assets, |
|
72 | - EE_Currency_Config $currency_config, |
|
73 | - EE_Template_Config $template_config, |
|
74 | - DomainInterface $domain, |
|
75 | - Registry $registry |
|
76 | - ) { |
|
77 | - $this->currency_config = $currency_config; |
|
78 | - $this->template_config = $template_config; |
|
79 | - parent::__construct($domain, $assets, $registry); |
|
80 | - } |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * @throws DomainException |
|
85 | - * @throws DuplicateCollectionIdentifierException |
|
86 | - * @throws InvalidArgumentException |
|
87 | - * @throws InvalidDataTypeException |
|
88 | - * @throws InvalidEntityException |
|
89 | - * @throws InvalidInterfaceException |
|
90 | - * @since 4.9.62.p |
|
91 | - */ |
|
92 | - public function addAssets() |
|
93 | - { |
|
94 | - $this->addJavascriptFiles(); |
|
95 | - $this->addStylesheetFiles(); |
|
96 | - } |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * @throws DomainException |
|
101 | - * @throws DuplicateCollectionIdentifierException |
|
102 | - * @throws InvalidArgumentException |
|
103 | - * @throws InvalidDataTypeException |
|
104 | - * @throws InvalidEntityException |
|
105 | - * @throws InvalidInterfaceException |
|
106 | - * @since 4.9.62.p |
|
107 | - */ |
|
108 | - public function addJavascriptFiles() |
|
109 | - { |
|
110 | - $this->addJs(CoreAssetManager::JS_HANDLE_VENDOR); |
|
111 | - $this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData(); |
|
112 | - $this->addJavascript( |
|
113 | - CoreAssetManager::JS_HANDLE_CORE, |
|
114 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
115 | - [JqueryAssetManager::JS_HANDLE_JQUERY] |
|
116 | - )->setInlineDataCallback( |
|
117 | - function () { |
|
118 | - wp_localize_script( |
|
119 | - CoreAssetManager::JS_HANDLE_CORE, |
|
120 | - CoreAssetManager::JS_HANDLE_I18N, |
|
121 | - EE_Registry::$i18n_js_strings |
|
122 | - ); |
|
123 | - } |
|
124 | - ); |
|
125 | - $this->loadQtipJs(); |
|
126 | - $this->addVendorJavascript( |
|
127 | - CoreAssetManager::JS_HANDLE_RAMDA, |
|
128 | - [], |
|
129 | - true, |
|
130 | - CoreAssetManager::RAMDA_VERSION |
|
131 | - ); |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * @throws DuplicateCollectionIdentifierException |
|
137 | - * @throws InvalidDataTypeException |
|
138 | - * @throws InvalidEntityException |
|
139 | - * @throws DomainException |
|
140 | - * @since 4.9.62.p |
|
141 | - */ |
|
142 | - public function addStylesheetFiles() |
|
143 | - { |
|
144 | - if (! is_admin()) { |
|
145 | - $this->addStylesheet( |
|
146 | - CoreAssetManager::CSS_HANDLE_DEFAULT, |
|
147 | - is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css') |
|
148 | - ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css' |
|
149 | - : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
150 | - ['dashicons'] |
|
151 | - ); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * Returns configuration data for the js Currency VO. |
|
158 | - * |
|
159 | - * @return array |
|
160 | - * @since 4.9.71.p |
|
161 | - */ |
|
162 | - private function getCurrencySettings() |
|
163 | - { |
|
164 | - return [ |
|
165 | - 'code' => $this->currency_config->code, |
|
166 | - 'singularLabel' => $this->currency_config->name, |
|
167 | - 'pluralLabel' => $this->currency_config->plural, |
|
168 | - 'sign' => $this->currency_config->sign, |
|
169 | - 'signB4' => $this->currency_config->sign_b4, |
|
170 | - 'decimalPlaces' => $this->currency_config->dec_plc, |
|
171 | - 'decimalMark' => $this->currency_config->dec_mrk, |
|
172 | - 'thousandsSeparator' => $this->currency_config->thsnds, |
|
173 | - ]; |
|
174 | - } |
|
175 | - |
|
176 | - |
|
177 | - /** |
|
178 | - * replacement: |
|
179 | - * EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs() |
|
180 | - * |
|
181 | - * @param JavascriptAsset $script |
|
182 | - * @deprecated 5.0.0.p |
|
183 | - */ |
|
184 | - public function loadQtipJs(JavascriptAsset $script = null) |
|
185 | - { |
|
186 | - // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, |
|
187 | - // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
|
188 | - if (apply_filters('FHEE_load_qtip', false)) { |
|
189 | - EEH_Qtip_Loader::instance()->register_and_enqueue(); |
|
190 | - } |
|
191 | - } |
|
32 | + // WordPress core / Third party JS asset handles |
|
33 | + const JS_HANDLE_JS_CORE = 'eejs-core'; |
|
34 | + |
|
35 | + const JS_HANDLE_CORE = 'espresso_core'; |
|
36 | + |
|
37 | + const JS_HANDLE_I18N = 'eei18n'; |
|
38 | + |
|
39 | + const JS_HANDLE_VENDOR = 'eventespresso-vendor'; |
|
40 | + |
|
41 | + const JS_HANDLE_RAMDA = 'ramda'; |
|
42 | + |
|
43 | + const RAMDA_VERSION = '0.27.1'; |
|
44 | + |
|
45 | + // EE CSS assets handles |
|
46 | + const CSS_HANDLE_DEFAULT = 'espresso_default'; |
|
47 | + |
|
48 | + const CSS_HANDLE_CUSTOM = 'espresso_custom_css'; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var EE_Currency_Config $currency_config |
|
52 | + */ |
|
53 | + protected $currency_config; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var EE_Template_Config $template_config |
|
57 | + */ |
|
58 | + protected $template_config; |
|
59 | + |
|
60 | + |
|
61 | + /** |
|
62 | + * CoreAssetRegister constructor. |
|
63 | + * |
|
64 | + * @param AssetCollection $assets |
|
65 | + * @param EE_Currency_Config $currency_config |
|
66 | + * @param EE_Template_Config $template_config |
|
67 | + * @param DomainInterface $domain |
|
68 | + * @param Registry $registry |
|
69 | + */ |
|
70 | + public function __construct( |
|
71 | + AssetCollection $assets, |
|
72 | + EE_Currency_Config $currency_config, |
|
73 | + EE_Template_Config $template_config, |
|
74 | + DomainInterface $domain, |
|
75 | + Registry $registry |
|
76 | + ) { |
|
77 | + $this->currency_config = $currency_config; |
|
78 | + $this->template_config = $template_config; |
|
79 | + parent::__construct($domain, $assets, $registry); |
|
80 | + } |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * @throws DomainException |
|
85 | + * @throws DuplicateCollectionIdentifierException |
|
86 | + * @throws InvalidArgumentException |
|
87 | + * @throws InvalidDataTypeException |
|
88 | + * @throws InvalidEntityException |
|
89 | + * @throws InvalidInterfaceException |
|
90 | + * @since 4.9.62.p |
|
91 | + */ |
|
92 | + public function addAssets() |
|
93 | + { |
|
94 | + $this->addJavascriptFiles(); |
|
95 | + $this->addStylesheetFiles(); |
|
96 | + } |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * @throws DomainException |
|
101 | + * @throws DuplicateCollectionIdentifierException |
|
102 | + * @throws InvalidArgumentException |
|
103 | + * @throws InvalidDataTypeException |
|
104 | + * @throws InvalidEntityException |
|
105 | + * @throws InvalidInterfaceException |
|
106 | + * @since 4.9.62.p |
|
107 | + */ |
|
108 | + public function addJavascriptFiles() |
|
109 | + { |
|
110 | + $this->addJs(CoreAssetManager::JS_HANDLE_VENDOR); |
|
111 | + $this->addJs(CoreAssetManager::JS_HANDLE_JS_CORE)->setHasInlineData(); |
|
112 | + $this->addJavascript( |
|
113 | + CoreAssetManager::JS_HANDLE_CORE, |
|
114 | + EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', |
|
115 | + [JqueryAssetManager::JS_HANDLE_JQUERY] |
|
116 | + )->setInlineDataCallback( |
|
117 | + function () { |
|
118 | + wp_localize_script( |
|
119 | + CoreAssetManager::JS_HANDLE_CORE, |
|
120 | + CoreAssetManager::JS_HANDLE_I18N, |
|
121 | + EE_Registry::$i18n_js_strings |
|
122 | + ); |
|
123 | + } |
|
124 | + ); |
|
125 | + $this->loadQtipJs(); |
|
126 | + $this->addVendorJavascript( |
|
127 | + CoreAssetManager::JS_HANDLE_RAMDA, |
|
128 | + [], |
|
129 | + true, |
|
130 | + CoreAssetManager::RAMDA_VERSION |
|
131 | + ); |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * @throws DuplicateCollectionIdentifierException |
|
137 | + * @throws InvalidDataTypeException |
|
138 | + * @throws InvalidEntityException |
|
139 | + * @throws DomainException |
|
140 | + * @since 4.9.62.p |
|
141 | + */ |
|
142 | + public function addStylesheetFiles() |
|
143 | + { |
|
144 | + if (! is_admin()) { |
|
145 | + $this->addStylesheet( |
|
146 | + CoreAssetManager::CSS_HANDLE_DEFAULT, |
|
147 | + is_readable(EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css') |
|
148 | + ? EVENT_ESPRESSO_UPLOAD_URL . 'css/espresso_default.css' |
|
149 | + : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', |
|
150 | + ['dashicons'] |
|
151 | + ); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * Returns configuration data for the js Currency VO. |
|
158 | + * |
|
159 | + * @return array |
|
160 | + * @since 4.9.71.p |
|
161 | + */ |
|
162 | + private function getCurrencySettings() |
|
163 | + { |
|
164 | + return [ |
|
165 | + 'code' => $this->currency_config->code, |
|
166 | + 'singularLabel' => $this->currency_config->name, |
|
167 | + 'pluralLabel' => $this->currency_config->plural, |
|
168 | + 'sign' => $this->currency_config->sign, |
|
169 | + 'signB4' => $this->currency_config->sign_b4, |
|
170 | + 'decimalPlaces' => $this->currency_config->dec_plc, |
|
171 | + 'decimalMark' => $this->currency_config->dec_mrk, |
|
172 | + 'thousandsSeparator' => $this->currency_config->thsnds, |
|
173 | + ]; |
|
174 | + } |
|
175 | + |
|
176 | + |
|
177 | + /** |
|
178 | + * replacement: |
|
179 | + * EventEspresso\core\domain\services\assets\EspressoLegacyAdminAssetManager::loadQtipJs() |
|
180 | + * |
|
181 | + * @param JavascriptAsset $script |
|
182 | + * @deprecated 5.0.0.p |
|
183 | + */ |
|
184 | + public function loadQtipJs(JavascriptAsset $script = null) |
|
185 | + { |
|
186 | + // qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, |
|
187 | + // can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
|
188 | + if (apply_filters('FHEE_load_qtip', false)) { |
|
189 | + EEH_Qtip_Loader::instance()->register_and_enqueue(); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | } |
@@ -24,125 +24,125 @@ |
||
24 | 24 | class LegacyAccountingAssetManager extends AssetManager |
25 | 25 | { |
26 | 26 | |
27 | - const JS_HANDLE_UNDERSCORE = 'underscore'; |
|
28 | - |
|
29 | - const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core'; |
|
30 | - |
|
31 | - const JS_HANDLE_ACCOUNTING = 'ee-accounting'; |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @var EE_Currency_Config $currency_config |
|
36 | - */ |
|
37 | - protected $currency_config; |
|
38 | - |
|
39 | - /** |
|
40 | - * CoreAssetRegister constructor. |
|
41 | - * |
|
42 | - * @param AssetCollection $assets |
|
43 | - * @param DomainInterface $domain |
|
44 | - * @param Registry $registry |
|
45 | - * @param EE_Currency_Config $currency_config |
|
46 | - */ |
|
47 | - public function __construct( |
|
48 | - AssetCollection $assets, |
|
49 | - DomainInterface $domain, |
|
50 | - Registry $registry, |
|
51 | - EE_Currency_Config $currency_config |
|
52 | - ) { |
|
53 | - $this->currency_config = $currency_config; |
|
54 | - parent::__construct($domain, $assets, $registry); |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * @throws InvalidDataTypeException |
|
61 | - * @throws InvalidEntityException |
|
62 | - * @throws DuplicateCollectionIdentifierException |
|
63 | - * @throws DomainException |
|
64 | - */ |
|
65 | - public function addAssets() |
|
66 | - { |
|
67 | - $this->loadAccountingJs(); |
|
68 | - add_action('admin_enqueue_scripts', [$this, 'enqueueLegacyAccountingAssets'], 100); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - /** |
|
73 | - * accounting.js for performing client-side calculations |
|
74 | - * |
|
75 | - * @throws DomainException |
|
76 | - * @throws DuplicateCollectionIdentifierException |
|
77 | - * @throws InvalidDataTypeException |
|
78 | - * @throws InvalidEntityException |
|
79 | - * @since 5.0.0.p |
|
80 | - */ |
|
81 | - private function loadAccountingJs() |
|
82 | - { |
|
83 | - //accounting.js library |
|
84 | - // @link http://josscrowcroft.github.io/accounting.js/ |
|
85 | - $this->addJavascript( |
|
86 | - LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE, |
|
87 | - EE_THIRD_PARTY_URL . 'accounting/accounting.js', |
|
88 | - [LegacyAccountingAssetManager::JS_HANDLE_UNDERSCORE], |
|
89 | - true, |
|
90 | - '0.3.2' |
|
91 | - ); |
|
92 | - |
|
93 | - $this->addJavascript( |
|
94 | - LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING, |
|
95 | - EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', |
|
96 | - [LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE] |
|
97 | - ) |
|
98 | - ->setInlineDataCallback( |
|
99 | - function () { |
|
100 | - wp_localize_script( |
|
101 | - LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING, |
|
102 | - 'EE_ACCOUNTING_CFG', |
|
103 | - $this->getAccountingSettings() |
|
104 | - ); |
|
105 | - } |
|
106 | - ); |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * Returns configuration data for the accounting-js library. |
|
112 | - * |
|
113 | - * @return array |
|
114 | - * @since 5.0.0.p |
|
115 | - */ |
|
116 | - private function getAccountingSettings() |
|
117 | - { |
|
118 | - return [ |
|
119 | - 'currency' => [ |
|
120 | - 'symbol' => $this->currency_config->sign, |
|
121 | - 'format' => [ |
|
122 | - 'pos' => $this->currency_config->sign_b4 ? '%s%v' : '%v%s', |
|
123 | - 'neg' => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s', |
|
124 | - 'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s', |
|
125 | - ], |
|
126 | - 'decimal' => $this->currency_config->dec_mrk, |
|
127 | - 'thousand' => $this->currency_config->thsnds, |
|
128 | - 'precision' => $this->currency_config->dec_plc, |
|
129 | - ], |
|
130 | - 'number' => [ |
|
131 | - 'precision' => $this->currency_config->dec_plc, |
|
132 | - 'thousand' => $this->currency_config->thsnds, |
|
133 | - 'decimal' => $this->currency_config->dec_mrk, |
|
134 | - ], |
|
135 | - ]; |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - /** |
|
140 | - * enqueue_scripts - Load the scripts and css |
|
141 | - * |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - public function enqueueLegacyAccountingAssets() |
|
145 | - { |
|
146 | - $this->enqueueAsset(LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING); |
|
147 | - } |
|
27 | + const JS_HANDLE_UNDERSCORE = 'underscore'; |
|
28 | + |
|
29 | + const JS_HANDLE_ACCOUNTING_CORE = 'ee-accounting-core'; |
|
30 | + |
|
31 | + const JS_HANDLE_ACCOUNTING = 'ee-accounting'; |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @var EE_Currency_Config $currency_config |
|
36 | + */ |
|
37 | + protected $currency_config; |
|
38 | + |
|
39 | + /** |
|
40 | + * CoreAssetRegister constructor. |
|
41 | + * |
|
42 | + * @param AssetCollection $assets |
|
43 | + * @param DomainInterface $domain |
|
44 | + * @param Registry $registry |
|
45 | + * @param EE_Currency_Config $currency_config |
|
46 | + */ |
|
47 | + public function __construct( |
|
48 | + AssetCollection $assets, |
|
49 | + DomainInterface $domain, |
|
50 | + Registry $registry, |
|
51 | + EE_Currency_Config $currency_config |
|
52 | + ) { |
|
53 | + $this->currency_config = $currency_config; |
|
54 | + parent::__construct($domain, $assets, $registry); |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * @throws InvalidDataTypeException |
|
61 | + * @throws InvalidEntityException |
|
62 | + * @throws DuplicateCollectionIdentifierException |
|
63 | + * @throws DomainException |
|
64 | + */ |
|
65 | + public function addAssets() |
|
66 | + { |
|
67 | + $this->loadAccountingJs(); |
|
68 | + add_action('admin_enqueue_scripts', [$this, 'enqueueLegacyAccountingAssets'], 100); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + /** |
|
73 | + * accounting.js for performing client-side calculations |
|
74 | + * |
|
75 | + * @throws DomainException |
|
76 | + * @throws DuplicateCollectionIdentifierException |
|
77 | + * @throws InvalidDataTypeException |
|
78 | + * @throws InvalidEntityException |
|
79 | + * @since 5.0.0.p |
|
80 | + */ |
|
81 | + private function loadAccountingJs() |
|
82 | + { |
|
83 | + //accounting.js library |
|
84 | + // @link http://josscrowcroft.github.io/accounting.js/ |
|
85 | + $this->addJavascript( |
|
86 | + LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE, |
|
87 | + EE_THIRD_PARTY_URL . 'accounting/accounting.js', |
|
88 | + [LegacyAccountingAssetManager::JS_HANDLE_UNDERSCORE], |
|
89 | + true, |
|
90 | + '0.3.2' |
|
91 | + ); |
|
92 | + |
|
93 | + $this->addJavascript( |
|
94 | + LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING, |
|
95 | + EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', |
|
96 | + [LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING_CORE] |
|
97 | + ) |
|
98 | + ->setInlineDataCallback( |
|
99 | + function () { |
|
100 | + wp_localize_script( |
|
101 | + LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING, |
|
102 | + 'EE_ACCOUNTING_CFG', |
|
103 | + $this->getAccountingSettings() |
|
104 | + ); |
|
105 | + } |
|
106 | + ); |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * Returns configuration data for the accounting-js library. |
|
112 | + * |
|
113 | + * @return array |
|
114 | + * @since 5.0.0.p |
|
115 | + */ |
|
116 | + private function getAccountingSettings() |
|
117 | + { |
|
118 | + return [ |
|
119 | + 'currency' => [ |
|
120 | + 'symbol' => $this->currency_config->sign, |
|
121 | + 'format' => [ |
|
122 | + 'pos' => $this->currency_config->sign_b4 ? '%s%v' : '%v%s', |
|
123 | + 'neg' => $this->currency_config->sign_b4 ? '- %s%v' : '- %v%s', |
|
124 | + 'zero' => $this->currency_config->sign_b4 ? '%s--' : '--%s', |
|
125 | + ], |
|
126 | + 'decimal' => $this->currency_config->dec_mrk, |
|
127 | + 'thousand' => $this->currency_config->thsnds, |
|
128 | + 'precision' => $this->currency_config->dec_plc, |
|
129 | + ], |
|
130 | + 'number' => [ |
|
131 | + 'precision' => $this->currency_config->dec_plc, |
|
132 | + 'thousand' => $this->currency_config->thsnds, |
|
133 | + 'decimal' => $this->currency_config->dec_mrk, |
|
134 | + ], |
|
135 | + ]; |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + /** |
|
140 | + * enqueue_scripts - Load the scripts and css |
|
141 | + * |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + public function enqueueLegacyAccountingAssets() |
|
145 | + { |
|
146 | + $this->enqueueAsset(LegacyAccountingAssetManager::JS_HANDLE_ACCOUNTING); |
|
147 | + } |
|
148 | 148 | } |
@@ -16,31 +16,31 @@ |
||
16 | 16 | */ |
17 | 17 | class CoreBlocksAssetManager extends BlockAssetManager |
18 | 18 | { |
19 | - const DOMAIN = 'blocks'; |
|
20 | - |
|
21 | - const ASSET_HANDLE_EDITOR_BLOCKS = Domain::ASSET_NAMESPACE . '-' . CoreBlocksAssetManager::DOMAIN; |
|
22 | - const ASSET_HANDLE_CORE_BLOCKS = ''; |
|
23 | - |
|
24 | - |
|
25 | - /** |
|
26 | - * @since 5.0.0.p |
|
27 | - * @throws DomainException |
|
28 | - */ |
|
29 | - public function enqueueEventEditor() |
|
30 | - { |
|
31 | - if ($this->verifyAssetIsRegistered(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS)) { |
|
32 | - wp_enqueue_script(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
33 | - wp_enqueue_style(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
34 | - } |
|
35 | - } |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * @since 4.9.71.p |
|
40 | - */ |
|
41 | - public function setAssetHandles() |
|
42 | - { |
|
43 | - $this->setEditorScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
44 | - $this->setScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS); |
|
45 | - } |
|
19 | + const DOMAIN = 'blocks'; |
|
20 | + |
|
21 | + const ASSET_HANDLE_EDITOR_BLOCKS = Domain::ASSET_NAMESPACE . '-' . CoreBlocksAssetManager::DOMAIN; |
|
22 | + const ASSET_HANDLE_CORE_BLOCKS = ''; |
|
23 | + |
|
24 | + |
|
25 | + /** |
|
26 | + * @since 5.0.0.p |
|
27 | + * @throws DomainException |
|
28 | + */ |
|
29 | + public function enqueueEventEditor() |
|
30 | + { |
|
31 | + if ($this->verifyAssetIsRegistered(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS)) { |
|
32 | + wp_enqueue_script(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
33 | + wp_enqueue_style(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
34 | + } |
|
35 | + } |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * @since 4.9.71.p |
|
40 | + */ |
|
41 | + public function setAssetHandles() |
|
42 | + { |
|
43 | + $this->setEditorScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_EDITOR_BLOCKS); |
|
44 | + $this->setScriptHandle(CoreBlocksAssetManager::ASSET_HANDLE_CORE_BLOCKS); |
|
45 | + } |
|
46 | 46 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class GeneralSettings extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = 'generalSettings'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = 'generalSettings'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_GENERAL_SETTINGS { |
25 | 25 | {$field_key} { |
26 | 26 | dateFormat |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | QUERY; |
33 | - $this->setParams([ |
|
34 | - 'operation_name' => 'GET_GENERAL_SETTINGS', |
|
35 | - 'query' => $query, |
|
36 | - ]); |
|
33 | + $this->setParams([ |
|
34 | + 'operation_name' => 'GET_GENERAL_SETTINGS', |
|
35 | + 'query' => $query, |
|
36 | + ]); |
|
37 | 37 | |
38 | - return $this->getQueryResponse($field_key, $where_params); |
|
39 | - } |
|
38 | + return $this->getQueryResponse($field_key, $where_params); |
|
39 | + } |
|
40 | 40 | } |
@@ -14,74 +14,74 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class GraphQLData implements GraphQLDataInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * @var string $namespace The graphql namespace/prefix. |
|
19 | - */ |
|
20 | - protected $namespace = 'Espresso'; |
|
17 | + /** |
|
18 | + * @var string $namespace The graphql namespace/prefix. |
|
19 | + */ |
|
20 | + protected $namespace = 'Espresso'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * @var array $params |
|
24 | - */ |
|
25 | - private $params = []; |
|
22 | + /** |
|
23 | + * @var array $params |
|
24 | + */ |
|
25 | + private $params = []; |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @param array $params |
|
30 | - */ |
|
31 | - public function setParams(array $params) |
|
32 | - { |
|
33 | - $this->params = $params; |
|
34 | - } |
|
28 | + /** |
|
29 | + * @param array $params |
|
30 | + */ |
|
31 | + public function setParams(array $params) |
|
32 | + { |
|
33 | + $this->params = $params; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @param string $field_key |
|
40 | - * @param array $where_params |
|
41 | - * @return mixed|null |
|
42 | - * @since 5.0.0.p |
|
43 | - */ |
|
44 | - protected function getQueryResponse(string $field_key, array $where_params = []) |
|
45 | - { |
|
46 | - if (! empty($where_params)) { |
|
47 | - if (! array_key_exists('variables', $this->params)) { |
|
48 | - $this->params['variables'] = []; |
|
49 | - } |
|
50 | - $this->params['variables']['where'] = $where_params; |
|
51 | - } |
|
38 | + /** |
|
39 | + * @param string $field_key |
|
40 | + * @param array $where_params |
|
41 | + * @return mixed|null |
|
42 | + * @since 5.0.0.p |
|
43 | + */ |
|
44 | + protected function getQueryResponse(string $field_key, array $where_params = []) |
|
45 | + { |
|
46 | + if (! empty($where_params)) { |
|
47 | + if (! array_key_exists('variables', $this->params)) { |
|
48 | + $this->params['variables'] = []; |
|
49 | + } |
|
50 | + $this->params['variables']['where'] = $where_params; |
|
51 | + } |
|
52 | 52 | |
53 | - $responseData = $this->makeGraphQLRequest($this->params); |
|
54 | - return ! empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
55 | - } |
|
53 | + $responseData = $this->makeGraphQLRequest($this->params); |
|
54 | + return ! empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null; |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | - /** |
|
59 | - * @param array $data |
|
60 | - * @return array|null |
|
61 | - * @since 5.0.0.p |
|
62 | - */ |
|
63 | - protected function makeGraphQLRequest(array $data) |
|
64 | - { |
|
65 | - $error = ''; |
|
66 | - try { |
|
67 | - $response = graphql($data); |
|
68 | - if (! empty($response['data'])) { |
|
69 | - return $response['data']; |
|
70 | - } |
|
71 | - $error = ! empty($response['errors']) |
|
72 | - ? print_r($response['errors'], true) |
|
73 | - : esc_html__( |
|
74 | - 'An unknown error has occurred during the GraphQL request and no data was found to return.', |
|
75 | - 'event_espresso' |
|
76 | - ); |
|
77 | - } catch (Exception $e) { |
|
78 | - if (defined('GRAPHQL_DEBUG') && GRAPHQL_DEBUG) { |
|
79 | - $error = $e->getMessage(); |
|
80 | - } |
|
81 | - } |
|
82 | - if ($error !== '') { |
|
83 | - error_log($error); |
|
84 | - } |
|
85 | - return null; |
|
86 | - } |
|
58 | + /** |
|
59 | + * @param array $data |
|
60 | + * @return array|null |
|
61 | + * @since 5.0.0.p |
|
62 | + */ |
|
63 | + protected function makeGraphQLRequest(array $data) |
|
64 | + { |
|
65 | + $error = ''; |
|
66 | + try { |
|
67 | + $response = graphql($data); |
|
68 | + if (! empty($response['data'])) { |
|
69 | + return $response['data']; |
|
70 | + } |
|
71 | + $error = ! empty($response['errors']) |
|
72 | + ? print_r($response['errors'], true) |
|
73 | + : esc_html__( |
|
74 | + 'An unknown error has occurred during the GraphQL request and no data was found to return.', |
|
75 | + 'event_espresso' |
|
76 | + ); |
|
77 | + } catch (Exception $e) { |
|
78 | + if (defined('GRAPHQL_DEBUG') && GRAPHQL_DEBUG) { |
|
79 | + $error = $e->getMessage(); |
|
80 | + } |
|
81 | + } |
|
82 | + if ($error !== '') { |
|
83 | + error_log($error); |
|
84 | + } |
|
85 | + return null; |
|
86 | + } |
|
87 | 87 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class PriceTypes extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'PriceTypes'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_PRICE_TYPES(\$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | QUERY; |
44 | - $this->setParams([ |
|
45 | - 'operation_name' => 'GET_PRICE_TYPES', |
|
46 | - 'variables' => [ |
|
47 | - 'first' => 100, |
|
48 | - ], |
|
49 | - 'query' => $query, |
|
50 | - ]); |
|
44 | + $this->setParams([ |
|
45 | + 'operation_name' => 'GET_PRICE_TYPES', |
|
46 | + 'variables' => [ |
|
47 | + 'first' => 100, |
|
48 | + ], |
|
49 | + 'query' => $query, |
|
50 | + ]); |
|
51 | 51 | |
52 | - return $this->getQueryResponse($field_key, $where_params); |
|
53 | - } |
|
52 | + return $this->getQueryResponse($field_key, $where_params); |
|
53 | + } |
|
54 | 54 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Venues extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'Venues'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'Venues'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_VENUES(\$where: RootQueryTo{$this->namespace}VenueConnectionWhereArgs, \$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | QUERY; |
52 | - $this->setParams([ |
|
53 | - 'operation_name' => 'GET_VENUES', |
|
54 | - 'variables' => [ |
|
55 | - 'first' => 100, |
|
56 | - ], |
|
57 | - 'query' => $query, |
|
58 | - ]); |
|
52 | + $this->setParams([ |
|
53 | + 'operation_name' => 'GET_VENUES', |
|
54 | + 'variables' => [ |
|
55 | + 'first' => 100, |
|
56 | + ], |
|
57 | + 'query' => $query, |
|
58 | + ]); |
|
59 | 59 | |
60 | - return $this->getQueryResponse($field_key, $where_params); |
|
61 | - } |
|
60 | + return $this->getQueryResponse($field_key, $where_params); |
|
61 | + } |
|
62 | 62 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Prices extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'Prices'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'Prices'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs, \$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | QUERY; |
47 | - $this->setParams([ |
|
48 | - 'operation_name' => 'GET_PRICES', |
|
49 | - 'variables' => [ |
|
50 | - 'first' => 100, |
|
51 | - ], |
|
52 | - 'query' => $query, |
|
53 | - ]); |
|
47 | + $this->setParams([ |
|
48 | + 'operation_name' => 'GET_PRICES', |
|
49 | + 'variables' => [ |
|
50 | + 'first' => 100, |
|
51 | + ], |
|
52 | + 'query' => $query, |
|
53 | + ]); |
|
54 | 54 | |
55 | - return $this->getQueryResponse($field_key, $where_params); |
|
56 | - } |
|
55 | + return $this->getQueryResponse($field_key, $where_params); |
|
56 | + } |
|
57 | 57 | } |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Datetimes extends GraphQLData |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since 5.0.0.p |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []) |
|
21 | - { |
|
22 | - $field_key = lcfirst($this->namespace) . 'Datetimes'; |
|
23 | - $query = <<<QUERY |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since 5.0.0.p |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []) |
|
21 | + { |
|
22 | + $field_key = lcfirst($this->namespace) . 'Datetimes'; |
|
23 | + $query = <<<QUERY |
|
24 | 24 | query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs, \$first: Int, \$last: Int ) { |
25 | 25 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
26 | 26 | nodes { |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | } |
51 | 51 | } |
52 | 52 | QUERY; |
53 | - $this->setParams([ |
|
54 | - 'operation_name' => 'GET_DATETIMES', |
|
55 | - 'variables' => [ |
|
56 | - 'first' => 100, |
|
57 | - ], |
|
58 | - 'query' => $query, |
|
59 | - ]); |
|
53 | + $this->setParams([ |
|
54 | + 'operation_name' => 'GET_DATETIMES', |
|
55 | + 'variables' => [ |
|
56 | + 'first' => 100, |
|
57 | + ], |
|
58 | + 'query' => $query, |
|
59 | + ]); |
|
60 | 60 | |
61 | - return $this->getQueryResponse($field_key, $where_params); |
|
62 | - } |
|
61 | + return $this->getQueryResponse($field_key, $where_params); |
|
62 | + } |
|
63 | 63 | } |