Making WordPress.org

Changeset 7028


Ignore:
Timestamp:
04/04/2018 07:41:24 PM (6 years ago)
Author:
iandunn
Message:

WordCamp Payments: Apply coding standards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-payment-stripe.php

    r7027 r7028  
    1010use Exception;
    1111
    12 defined( 'WPINC' ) or die();
     12defined( 'WPINC' ) || die();
    1313
    1414const STEP_SELECT_INVOICE  = 1;
     
    9898                'key'     => 'Start Date (YYYY-mm-dd)',
    9999                'value'   => strtotime( '-2 years' ),
    100                 'compare' => '>'
    101             )
    102         )
     100                'compare' => '>',
     101            ),
     102        ),
    103103    );
    104104}
     
    118118    switch ( $step ) {
    119119        // An invoice, event, currency and amount have been selected.
    120         default :
    121         case STEP_SELECT_INVOICE :
     120        default:
     121        case STEP_SELECT_INVOICE:
    122122            $payment_type = filter_input( INPUT_POST, 'payment_type' );
    123123            $wordcamp_id  = filter_input( INPUT_POST, 'wordcamp_id', FILTER_VALIDATE_INT );
     
    128128
    129129            switch ( $payment_type ) {
    130                 default :
    131                 case 'invoice' :
     130                default:
     131                case 'invoice':
    132132                    if ( ! $wordcamp_id ) {
    133133                        $data['errors'][] = 'Please select an event.';
     
    156156                    break;
    157157
    158                 case 'other' :
     158                case 'other':
    159159                    $description = substr( sanitize_text_field( $description ), 0, 100 );
    160160
     
    200200
    201201            // Passed through to the charge step.
    202             $data['payment_data_json']      = json_encode( $data['payment'] );
     202            $data['payment_data_json']      = wp_json_encode( $data['payment'] );
    203203            $data['payment_data_signature'] = hash_hmac( 'sha256', $data['payment_data_json'], $data['keys']['hmac_key'] );
    204204
     
    208208
    209209        // The card details have been entered and Stripe has submitted our form.
    210         case STEP_PAYMENT_DETAILS :
     210        case STEP_PAYMENT_DETAILS:
    211211            $stripe_token           = filter_input( INPUT_POST, 'stripeToken' );
    212212            $payment_data_json      = filter_input( INPUT_POST, 'payment_data_json' );
     
    224224
    225225            // Make sure our data hasn't been altered.
    226 
    227226            if ( ! hash_equals( hash_hmac( 'sha256', $payment_data_json, $data['keys']['hmac_key'] ), $payment_data_signature ) ) {
    228227                $data['errors'][] = 'Could not verify payload signature.';
     
    233232
    234233            switch ( $payment_data['payment_type'] ) {
    235                 case 'invoice' :
     234                case 'invoice':
    236235                    $wordcamp_obj     = get_post( $payment_data['wordcamp_id'] );
    237236                    $wordcamp_site_id = get_wordcamp_site_id( $wordcamp_obj );
     
    246245                    break;
    247246
    248                 case 'other' :
     247                case 'other':
    249248                    $description = 'Other Payment';
    250249                    $metadata    = array(
Note: See TracChangeset for help on using the changeset viewer.