Changeset 2347
- Timestamp:
- 01/21/2016 08:41:54 PM (9 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/wordcamp-budgets-dashboard.php
r2298 r2347 19 19 function format_amount( $amount, $currency ) { 20 20 $formatted_amount = ''; 21 $amount = preg_replace( '#[^\d.-]+#', '', $amount ); 22 $amount = floatval( $amount ); 21 $amount = \WordCamp_Budgets::validate_amount( $amount ); 23 22 24 23 if ( false === strpos( $currency, 'null' ) && $amount ) { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php
r2342 r2347 654 654 655 655 case 'payment_amount': 656 $safe_value = sanitize_text_field( $unsafe_value ); 657 $safe_value = preg_replace( '#[^\d.-]+#', '', $safe_value ); 658 $safe_value = round( floatval( $safe_value ), 2 ); 656 $safe_value = WordCamp_Budgets::validate_amount( $unsafe_value ); 659 657 break; 660 658 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php
r2327 r2347 376 376 377 377 if ( 'amount' == $field ) { 378 $value = preg_replace( '#[^\d.-]+#', '', $value ); 379 $value = round( floatval( $value ), 2 ); 378 $value = \WordCamp_Budgets::validate_amount( $value ); 380 379 } 381 380 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r2342 r2347 78 78 self::VERSION 79 79 ); 80 } 81 82 /** 83 * Validate an amount value 84 * 85 * @param string $amount 86 * 87 * @return float 88 */ 89 public static function validate_amount( $amount ) { 90 $amount = sanitize_text_field( $amount ); 91 $amount = preg_replace( '#[^\d.-]+#', '', $amount ); 92 $amount = round( floatval( $amount ), 2 ); 93 94 return $amount; 80 95 } 81 96
Note: See TracChangeset
for help on using the changeset viewer.