resources
3 years ago
Assets.php
4 years ago
ServiceProvider.php
4 years ago
SummaryView.php
4 years ago
Assets.php
45 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonationSummary; |
| 4 | |
| 5 | /** |
| 6 | * @since 2.17.0 |
| 7 | */ |
| 8 | class Assets |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @since 2.17.0 |
| 13 | */ |
| 14 | public function loadFrontendAssets() |
| 15 | { |
| 16 | wp_enqueue_style( |
| 17 | 'give-donation-summary-style-frontend', |
| 18 | GIVE_PLUGIN_URL . 'assets/dist/css/give-donation-summary.css', |
| 19 | [], |
| 20 | GIVE_VERSION |
| 21 | ); |
| 22 | |
| 23 | wp_enqueue_script( |
| 24 | 'give-donation-summary-script-frontend', |
| 25 | GIVE_PLUGIN_URL . 'assets/dist/js/give-donation-summary.js', |
| 26 | ['wp-i18n'], |
| 27 | GIVE_VERSION, |
| 28 | true |
| 29 | ); |
| 30 | |
| 31 | wp_localize_script( |
| 32 | 'give-donation-summary-script-frontend', |
| 33 | 'GiveDonationSummaryData', |
| 34 | [ |
| 35 | 'currencyPrecisionLookup' => array_map(function ($currency) { |
| 36 | return $currency['setting']['number_decimals']; |
| 37 | }, give_get_currencies_list()), |
| 38 | 'recurringLabelLookup' => function_exists('give_recurring_get_default_pretty_periods') |
| 39 | ? give_recurring_get_default_pretty_periods() |
| 40 | : [], |
| 41 | ] |
| 42 | ); |
| 43 | } |
| 44 | } |
| 45 |