| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying currency form while setting up. |
| 4 |
* |
| 5 |
* @author ThimPres |
| 6 |
* @package LearnPress/Admin/Views |
| 7 |
* @version 3.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) or exit; |
| 11 |
|
| 12 |
// $settings = LP_Settings::instance()->refresh(); |
| 13 |
$settings = LP_Settings::instance(); |
| 14 |
$currency = $settings->get( 'currency', 'USD' ); |
| 15 |
$preview_price = ''; |
| 16 |
?> |
| 17 |
|
| 18 |
<h2><?php _e( 'Currency', 'learnpress' ); ?></h2> |
| 19 |
|
| 20 |
<table> |
| 21 |
<tr> |
| 22 |
<th><?php _e( 'Currency', 'learnpress' ); ?></th> |
| 23 |
<td> |
| 24 |
<select id="currency" name="settings[currency][currency]"> |
| 25 |
<?php |
| 26 |
$payment_currencies = learn_press_currencies(); |
| 27 |
if ( $payment_currencies ) { |
| 28 |
foreach ( $payment_currencies as $code => $symbol ) { |
| 29 |
?> |
| 30 |
<option value="<?php echo esc_attr( $code ); ?>" |
| 31 |
data-symbol="<?php echo learn_press_get_currency_symbol( $code ); ?>" <?php selected( $code == $currency ); ?>> |
| 32 |
<?php echo wp_kses_post( $symbol ); ?> |
| 33 |
</option> |
| 34 |
<?php |
| 35 |
} |
| 36 |
} |
| 37 |
?> |
| 38 |
</select> |
| 39 |
</td> |
| 40 |
</tr> |
| 41 |
<tr> |
| 42 |
<th><?php _e( 'Currency position', 'learnpress' ); ?></th> |
| 43 |
<td> |
| 44 |
<select id="currency-pos" name="settings[currency][currency_pos]"> |
| 45 |
<?php |
| 46 |
$positions = array(); |
| 47 |
foreach ( learn_press_currency_positions() as $pos => $text ) { |
| 48 |
?> |
| 49 |
<option value="<?php echo esc_attr( $pos ); ?>"<?php selected( $pos == $settings->get( 'currency_pos' ) ); ?>><?php echo wp_kses_post( $text ); ?></option> |
| 50 |
<?php |
| 51 |
} |
| 52 |
?> |
| 53 |
</select> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
<tr> |
| 57 |
<th><?php _e( 'Thousands Separator', 'learnpress' ); ?></th> |
| 58 |
<td> |
| 59 |
<input id="thousands-separator" type="text" name="settings[currency][thousands_separator]" |
| 60 |
value="<?php echo esc_attr( $settings->get( 'thousands_separator', ',' ) ); ?>"> |
| 61 |
</td> |
| 62 |
</tr> |
| 63 |
<tr> |
| 64 |
<th><?php _e( 'Decimals Separator', 'learnpress' ); ?></th> |
| 65 |
<td> |
| 66 |
<input id="decimals-separator" type="text" name="settings[currency][decimals_separator]" |
| 67 |
value="<?php echo esc_attr( $settings->get( 'decimals_separator', '.' ) ); ?>"> |
| 68 |
</td> |
| 69 |
</tr> |
| 70 |
<tr> |
| 71 |
<th><?php _e( 'Number of Decimals', 'learnpress' ); ?></th> |
| 72 |
<td> |
| 73 |
<input id="number-of-decimals" type="text" name="settings[currency][number_of_decimals]" |
| 74 |
value="<?php echo esc_attr( $settings->get( 'number_of_decimals', '2' ) ); ?>"> |
| 75 |
</td> |
| 76 |
</tr> |
| 77 |
<tr> |
| 78 |
<th></th> |
| 79 |
<td> |
| 80 |
<div id="preview-price"><?php echo learn_press_format_price( 1234.56, true ); ?></div> |
| 81 |
</td> |
| 82 |
</tr> |
| 83 |
</table> |
| 84 |
|