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