Conditions | 3 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | function lsx_currencies_get_price_html( $value = '' ) { |
||
19 | $prefix = '<span class="amount lsx-currencies" '; |
||
20 | $value = preg_replace( '/[^0-9.]+/', '', $value ); |
||
21 | $decimals = substr_count( $value, '.' ); |
||
22 | |||
23 | if ( false !== $decimals && $decimals > 1 ) { |
||
24 | $decimals--; |
||
25 | $decimals = (int) $decimals; |
||
26 | $value = preg_replace( '/' . preg_quote( '.', '/' ) . '/', '', $value, $decimals ); |
||
27 | } |
||
28 | $prefix .= '>'; |
||
29 | $suffix = '</span>'; |
||
30 | setlocale( LC_MONETARY, 'en_US' ); |
||
31 | |||
32 | // Work out the other tags |
||
33 | $currency = '<span class="currency-icon ' . mb_strtolower( lsx_currencies()->base_currency ) . '">' . lsx_currencies()->base_currency . '</span>'; |
||
34 | $amount = '<span class="value" data-price-' . lsx_currencies()->base_currency . '="' . trim( str_replace( 'USD', '', money_format( '%i', ltrim( rtrim( $value ) ) ) ) ) . '">' . str_replace( 'USD', '', money_format( '%i', ltrim( rtrim( $value ) ) ) ) . '</span>'; |
||
|
|||
35 | $price_html = '<span class="amount lsx-currencies">' . $currency . $amount . '</span>'; |
||
36 | return $price_html; |
||
37 | } |
||
55 |