Making WordPress.org


Ignore:
Timestamp:
11/09/2015 10:16:48 AM (10 years ago)
Author:
kovshenin
Message:

WordCamp.org: Add USD-equivalents for foreign currencies in the payments dashboard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/class-list-table.php

    r2036 r2057  
    172172        $amount = get_post_meta( $request->ID, '_camppayments_payment_amount', true );
    173173
     174        $amount = preg_replace( '#[^\d.-]+#', '', $amount );
     175        $amount = floatval( $amount );
     176
    174177        if ( strpos( $currency, 'null' ) === false && $amount ) {
    175             return sprintf( '%s %s', esc_html( $amount ), esc_html( $currency ) );
     178            $output = sprintf( '%s %s', esc_html( number_format( $amount, 2 ) ), esc_html( $currency ) );
     179
     180            if ( $currency != 'USD' ) {
     181                $usd_amount = WordCamp_Payments_Network_Tools::convert_currency( $currency, 'usd', $amount );
     182                if ( $usd_amount )
     183                    $output .= sprintf( '<br />~ %s&nbsp;USD', esc_html( number_format( $usd_amount, 2 ) ) );
     184            }
     185
     186            return $output;
    176187        } elseif ( $amount ) {
    177188            return esc_html( $amount );
Note: See TracChangeset for help on using the changeset viewer.