コード例 #1
0
    ?>
        <tr>
            <td class="row-header"><?php 
    _ex('Total Amount (credit)', 'transaction items', 'AWPCP');
    ?>
</td>
            <td class="amount"><?php 
    echo esc_html(number_format($totals['credits'], 0));
    ?>
</td>
        </tr>
        <?php 
}
?>

        <tr>
            <?php 
$label = sprintf('%s (%s)', _x('Total Amount', 'transaction items', 'AWPCP'), awpcp_get_currency_symbol());
?>
            <td class="row-header"><?php 
echo esc_html($label);
?>
</td>
            <td class="amount"><?php 
echo esc_html(awpcp_format_money($totals['money']));
?>
</td>
        </tr>
    </tfoot>
</table>
コード例 #2
0
ファイル: functions.php プロジェクト: sabdev1/ljcdevsab
function awpcp_get_formmatted_amount($value, $include_symbol)
{
    $thousands_separator = get_awpcp_option('thousands-separator');
    $decimal_separator = get_awpcp_option('decimal-separator');
    $decimals = get_awpcp_option('show-decimals') ? 2 : 0;
    $symbol_position = get_awpcp_option('show-currency-symbol');
    $symbol = $include_symbol ? awpcp_get_currency_symbol() : '';
    if ($include_symbol && $symbol_position == 'show-currency-symbol-on-left') {
        $template = '<currenct-symbol><separator><amount>';
    } else {
        if ($include_symbol && $symbol_position == 'show-currency-symbol-on-right') {
            $template = '<amount><separator><currenct-symbol>';
        } else {
            $template = '<amount>';
        }
    }
    if (get_awpcp_option('include-space-between-currency-symbol-and-amount')) {
        $separator = ' ';
    } else {
        $separator = '';
    }
    if ($value >= 0) {
        $number = number_format($value, $decimals, $decimal_separator, $thousands_separator);
        $formatted = $template;
    } else {
        $number = number_format(-$value, $decimals, $decimal_separator, $thousands_separator);
        $formatted = '(' . $template . ')';
    }
    $formatted = str_replace('<currenct-symbol>', $symbol, $formatted);
    $formatted = str_replace('<amount>', $number, $formatted);
    $formatted = str_replace('<separator>', $separator, $formatted);
    return $formatted;
}