/** * @param $period monthly or yearly */ function get_premium_price($currency, $period) { // because of floating point inaccuracy we need to round it to 8 decimal places, particularly before displaying it return wrap_number(get_site_config('premium_' . $currency . '_' . $period) * (1 - get_premium_price_discount($currency)), 8); }
<?php echo ht("OR"); ?> </td> </tr> <tr> <th><?php echo t("Purchase years (:cost/year)", array(':cost' => currency_format($currency, get_premium_price($currency, 'yearly')))); ?> </td> <td> <select name="years" id="yearly"> <option value="0" selected></option> <?php for ($i = 1; $i <= 5; $i++) { echo "<option value=\"{$i}\">" . htmlspecialchars(plural("year", $i)) . " " . currency_format($currency, wrap_number(get_premium_price($currency, 'yearly') * $i, 8), 8) . "</option>\n"; } ?> </select> </td> </tr> <tr> <td colspan="2" class="buttons"> <input type="hidden" name="currency" value="<?php echo htmlspecialchars($currency); ?> "> <button type="submit" class="purchase_button"><span class="currency_name_<?php echo htmlspecialchars($currency); ?> ">Purchase</span></button>