Passed
Pull Request — master (#442)
by Brian
04:21
created
includes/gateways/class-getpaid-authorize-net-legacy-gateway.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@  discard block
 block discarded – undo
15 15
 abstract class GetPaid_Authorize_Net_Legacy_Gateway extends GetPaid_Payment_Gateway {
16 16
 
17 17
     /**
18
-	 * Class constructor.
19
-	 */
20
-	public function __construct() {
18
+     * Class constructor.
19
+     */
20
+    public function __construct() {
21 21
         parent::__construct();
22 22
     }
23 23
 
24 24
     /**
25
-	 * Returns the API URL.
26
-	 *
27
-	 *
28
-	 * @param WPInv_Invoice $invoice Invoice.
29
-	 * @return string
30
-	 */
31
-	public function get_api_url( $invoice ) {
25
+     * Returns the API URL.
26
+     *
27
+     *
28
+     * @param WPInv_Invoice $invoice Invoice.
29
+     * @return string
30
+     */
31
+    public function get_api_url( $invoice ) {
32 32
         return $this->is_sandbox( $invoice ) ? 'https://apitest.authorize.net/xml/v1/request.api' : 'https://api.authorize.net/xml/v1/request.api';
33 33
     }
34 34
 
35 35
     /**
36
-	 * Communicates with authorize.net
37
-	 *
38
-	 *
39
-	 * @param array $post Data to post.
36
+     * Communicates with authorize.net
37
+     *
38
+     *
39
+     * @param array $post Data to post.
40 40
      * @param WPInv_Invoice $invoice Invoice.
41
-	 * @return stdClass|WP_Error
42
-	 */
41
+     * @return stdClass|WP_Error
42
+     */
43 43
     public function post( $post, $invoice ){
44 44
 
45 45
         $url      = $this->get_api_url( $invoice );
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
     }
82 82
 
83 83
     /**
84
-	 * Returns the API authentication params.
85
-	 *
86
-	 *
87
-	 * @return array
88
-	 */
89
-	public function get_auth_params() {
84
+     * Returns the API authentication params.
85
+     *
86
+     *
87
+     * @return array
88
+     */
89
+    public function get_auth_params() {
90 90
 
91 91
         return array(
92 92
             'name'           => $this->get_option( 'login_id' ),
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
     }
97 97
 
98 98
     /**
99
-	 * Cancels a subscription remotely
100
-	 *
101
-	 *
102
-	 * @param WPInv_Subscription $subscription Subscription.
99
+     * Cancels a subscription remotely
100
+     *
101
+     *
102
+     * @param WPInv_Subscription $subscription Subscription.
103 103
      * @param WPInv_Invoice $invoice Invoice.
104
-	 */
105
-	public function cancel_subscription( $subscription, $invoice ) {
104
+     */
105
+    public function cancel_subscription( $subscription, $invoice ) {
106 106
 
107 107
         // Backwards compatibility. New version do not use authorize.net subscriptions.
108 108
         $this->post(
@@ -118,17 +118,17 @@  discard block
 block discarded – undo
118 118
     }
119 119
 
120 120
     /**
121
-	 * Processes ipns.
122
-	 *
123
-	 * @return void
124
-	 */
125
-	public function verify_ipn() {
121
+     * Processes ipns.
122
+     *
123
+     * @return void
124
+     */
125
+    public function verify_ipn() {
126 126
 
127 127
         $this->maybe_process_old_ipn();
128 128
 
129 129
         // Validate the IPN.
130 130
         if ( empty( $_POST ) || ! $this->validate_ipn() ) {
131
-		    wp_die( 'Authorize.NET IPN Request Failure', 'Authorize.NET IPN', array( 'response' => 500 ) );
131
+            wp_die( 'Authorize.NET IPN Request Failure', 'Authorize.NET IPN', array( 'response' => 500 ) );
132 132
         }
133 133
 
134 134
         // Event type.
@@ -167,24 +167,24 @@  discard block
 block discarded – undo
167 167
     }
168 168
 
169 169
     /**
170
-	 * Validates IPN invoices.
171
-	 *
170
+     * Validates IPN invoices.
171
+     *
172 172
      * @param WPInv_Invoice $invoice
173 173
      * @param object $payload
174
-	 * @return void
175
-	 */
176
-	public function validate_ipn_invoice( $invoice, $payload ) {
174
+     * @return void
175
+     */
176
+    public function validate_ipn_invoice( $invoice, $payload ) {
177 177
         if ( ! $invoice->exists() || $payload->id != $invoice->get_transaction_id() ) {
178 178
             exit;
179 179
         }
180 180
     }
181 181
 
182 182
     /**
183
-	 * Process subscriptio IPNS.
184
-	 *
185
-	 * @return void
186
-	 */
187
-	public function maybe_process_old_ipn() {
183
+     * Process subscriptio IPNS.
184
+     *
185
+     * @return void
186
+     */
187
+    public function maybe_process_old_ipn() {
188 188
 
189 189
         $data = wp_unslash( $_POST );
190 190
 
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
     }
227 227
 
228 228
     /**
229
-	 * Validates the old IPN signature.
229
+     * Validates the old IPN signature.
230 230
      *
231 231
      * @param array $posted
232
-	 */
233
-	public function validate_old_ipn_signature( $posted ) {
232
+     */
233
+    public function validate_old_ipn_signature( $posted ) {
234 234
 
235 235
         $signature = $this->get_option( 'signature_key' );
236 236
         if ( ! empty( $signature ) ) {
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
     }
250 250
 
251 251
     /**
252
-	 * Check Authorize.NET IPN validity.
253
-	 */
254
-	public function validate_ipn() {
252
+     * Check Authorize.NET IPN validity.
253
+     */
254
+    public function validate_ipn() {
255 255
 
256 256
         wpinv_error_log( 'Validating Authorize.NET IPN response' );
257 257
 
Please login to merge, or discard this patch.
includes/gateways/class-getpaid-bank-transfer-gateway.php 1 patch
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@  discard block
 block discarded – undo
13 13
 class GetPaid_Bank_Transfer_Gateway extends GetPaid_Payment_Gateway {
14 14
 
15 15
     /**
16
-	 * Payment method id.
17
-	 *
18
-	 * @var string
19
-	 */
16
+     * Payment method id.
17
+     *
18
+     * @var string
19
+     */
20 20
     public $id = 'bank_transfer';
21 21
 
22 22
     /**
23
-	 * Payment method order.
24
-	 *
25
-	 * @var int
26
-	 */
27
-	public $order = 8;
23
+     * Payment method order.
24
+     *
25
+     * @var int
26
+     */
27
+    public $order = 8;
28 28
     
29 29
     /**
30
-	 * Class constructor.
31
-	 */
32
-	public function __construct() {
30
+     * Class constructor.
31
+     */
32
+    public function __construct() {
33 33
         parent::__construct();
34 34
 
35 35
         $this->title                = __( 'Direct bank transfer', 'invoicing' );
@@ -37,22 +37,22 @@  discard block
 block discarded – undo
37 37
         $this->checkout_button_text = __( 'Proceed', 'invoicing' );
38 38
         $this->instructions         = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) );
39 39
 
40
-		add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
41
-		add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
42
-		add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
40
+        add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) );
41
+        add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 );
42
+        add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 );
43 43
 
44 44
     }
45 45
 
46 46
     /**
47
-	 * Process Payment.
48
-	 *
49
-	 *
50
-	 * @param WPInv_Invoice $invoice Invoice.
51
-	 * @param array $submission_data Posted checkout fields.
52
-	 * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
53
-	 * @return array
54
-	 */
55
-	public function process_payment( $invoice, $submission_data, $submission ) {
47
+     * Process Payment.
48
+     *
49
+     *
50
+     * @param WPInv_Invoice $invoice Invoice.
51
+     * @param array $submission_data Posted checkout fields.
52
+     * @param GetPaid_Payment_Form_Submission $submission Checkout submission.
53
+     * @return array
54
+     */
55
+    public function process_payment( $invoice, $submission_data, $submission ) {
56 56
 
57 57
         // Add a transaction id.
58 58
         $invoice->set_transaction_id( $invoice->generate_key('trans_') );
@@ -73,66 +73,66 @@  discard block
 block discarded – undo
73 73
     }
74 74
 
75 75
     /**
76
-	 * Output for the order received page.
77
-	 *
78
-	 * @param WPInv_Invoice $invoice Invoice.
79
-	 */
80
-	public function thankyou_page( $invoice ) {
76
+     * Output for the order received page.
77
+     *
78
+     * @param WPInv_Invoice $invoice Invoice.
79
+     */
80
+    public function thankyou_page( $invoice ) {
81 81
 
82 82
         if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
83 83
 
84
-			echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
84
+            echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL;
85 85
 
86 86
             if ( ! empty( $this->instructions ) ) {
87 87
                 echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) );
88
-			}
88
+            }
89 89
 
90
-			$this->bank_details( $invoice );
90
+            $this->bank_details( $invoice );
91 91
 			
92
-			echo '</div>';
92
+            echo '</div>';
93 93
         
94 94
         }
95 95
 
96
-	}
96
+    }
97 97
     
98 98
     /**
99
-	 * Add content to the WPI emails.
100
-	 *
101
-	 * @param WPInv_Invoice $invoice Invoice.
102
-	 * @param string     $email_type Email format: plain text or HTML.
103
-	 * @param bool     $sent_to_admin Sent to admin.
104
-	 */
105
-	public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
99
+     * Add content to the WPI emails.
100
+     *
101
+     * @param WPInv_Invoice $invoice Invoice.
102
+     * @param string     $email_type Email format: plain text or HTML.
103
+     * @param bool     $sent_to_admin Sent to admin.
104
+     */
105
+    public function email_instructions( $invoice, $email_type, $sent_to_admin ) {
106 106
 
107
-		if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
107
+        if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) {
108 108
 
109
-			echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
109
+            echo '<div class="wpi-email-row getpaid-bank-transfer-details">';
110 110
 
111
-			if ( $this->instructions ) {
112
-				echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
111
+            if ( $this->instructions ) {
112
+                echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL );
113 113
             }
114 114
 
115
-			$this->bank_details( $invoice );
115
+            $this->bank_details( $invoice );
116 116
 			
117
-			echo '</div>';
117
+            echo '</div>';
118 118
 
119
-		}
119
+        }
120 120
 
121 121
     }
122 122
     
123 123
     /**
124
-	 * Get bank details and place into a list format.
125
-	 *
126
-	 * @param WPInv_Invoice $invoice Invoice.
127
-	 */
128
-	protected function bank_details( $invoice ) {
124
+     * Get bank details and place into a list format.
125
+     *
126
+     * @param WPInv_Invoice $invoice Invoice.
127
+     */
128
+    protected function bank_details( $invoice ) {
129 129
 
130
-		// Get the invoice country and country $locale.
131
-		$country = $invoice->get_country();
132
-		$locale  = $this->get_country_locale();
130
+        // Get the invoice country and country $locale.
131
+        $country = $invoice->get_country();
132
+        $locale  = $this->get_country_locale();
133 133
 
134
-		// Get sortcode label in the $locale array and use appropriate one.
135
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
134
+        // Get sortcode label in the $locale array and use appropriate one.
135
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
136 136
 
137 137
         $bank_fields = array(
138 138
             'ac_name'     => __( 'Account Name', 'invoicing' ),
@@ -161,144 +161,144 @@  discard block
 block discarded – undo
161 161
             return;
162 162
         }
163 163
 
164
-		echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
164
+        echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL;
165 165
 
166
-		echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
166
+        echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL;
167 167
 
168
-		foreach ( $bank_info as $key => $data ) {
168
+        foreach ( $bank_info as $key => $data ) {
169 169
 
170
-			$key   = sanitize_html_class( $key );
171
-			$label = wp_kses_post( $data['label'] );
172
-			$value = wp_kses_post( wptexturize( $data['value'] ) );
170
+            $key   = sanitize_html_class( $key );
171
+            $label = wp_kses_post( $data['label'] );
172
+            $value = wp_kses_post( wptexturize( $data['value'] ) );
173 173
 
174
-			echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL;
175
-		}
174
+            echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL;
175
+        }
176 176
 
177
-		echo '</table>';
177
+        echo '</table>';
178 178
 
179 179
     }
180 180
     
181 181
     /**
182
-	 * Get country locale if localized.
183
-	 *
184
-	 * @return array
185
-	 */
186
-	public function get_country_locale() {
187
-
188
-		if ( empty( $this->locale ) ) {
189
-
190
-			// Locale information to be used - only those that are not 'Sort Code'.
191
-			$this->locale = apply_filters(
192
-				'getpaid_get_bank_transfer_locale',
193
-				array(
194
-					'AU' => array(
195
-						'sortcode' => array(
196
-							'label' => __( 'BSB', 'invoicing' ),
197
-						),
198
-					),
199
-					'CA' => array(
200
-						'sortcode' => array(
201
-							'label' => __( 'Bank transit number', 'invoicing' ),
202
-						),
203
-					),
204
-					'IN' => array(
205
-						'sortcode' => array(
206
-							'label' => __( 'IFSC', 'invoicing' ),
207
-						),
208
-					),
209
-					'IT' => array(
210
-						'sortcode' => array(
211
-							'label' => __( 'Branch sort', 'invoicing' ),
212
-						),
213
-					),
214
-					'NZ' => array(
215
-						'sortcode' => array(
216
-							'label' => __( 'Bank code', 'invoicing' ),
217
-						),
218
-					),
219
-					'SE' => array(
220
-						'sortcode' => array(
221
-							'label' => __( 'Bank code', 'invoicing' ),
222
-						),
223
-					),
224
-					'US' => array(
225
-						'sortcode' => array(
226
-							'label' => __( 'Routing number', 'invoicing' ),
227
-						),
228
-					),
229
-					'ZA' => array(
230
-						'sortcode' => array(
231
-							'label' => __( 'Branch code', 'invoicing' ),
232
-						),
233
-					),
234
-				)
235
-			);
236
-
237
-		}
238
-
239
-		return $this->locale;
240
-
241
-	}
242
-
243
-	/**
244
-	 * Filters the gateway settings.
245
-	 * 
246
-	 * @param array $admin_settings
247
-	 */
248
-	public function admin_settings( $admin_settings ) {
182
+     * Get country locale if localized.
183
+     *
184
+     * @return array
185
+     */
186
+    public function get_country_locale() {
187
+
188
+        if ( empty( $this->locale ) ) {
189
+
190
+            // Locale information to be used - only those that are not 'Sort Code'.
191
+            $this->locale = apply_filters(
192
+                'getpaid_get_bank_transfer_locale',
193
+                array(
194
+                    'AU' => array(
195
+                        'sortcode' => array(
196
+                            'label' => __( 'BSB', 'invoicing' ),
197
+                        ),
198
+                    ),
199
+                    'CA' => array(
200
+                        'sortcode' => array(
201
+                            'label' => __( 'Bank transit number', 'invoicing' ),
202
+                        ),
203
+                    ),
204
+                    'IN' => array(
205
+                        'sortcode' => array(
206
+                            'label' => __( 'IFSC', 'invoicing' ),
207
+                        ),
208
+                    ),
209
+                    'IT' => array(
210
+                        'sortcode' => array(
211
+                            'label' => __( 'Branch sort', 'invoicing' ),
212
+                        ),
213
+                    ),
214
+                    'NZ' => array(
215
+                        'sortcode' => array(
216
+                            'label' => __( 'Bank code', 'invoicing' ),
217
+                        ),
218
+                    ),
219
+                    'SE' => array(
220
+                        'sortcode' => array(
221
+                            'label' => __( 'Bank code', 'invoicing' ),
222
+                        ),
223
+                    ),
224
+                    'US' => array(
225
+                        'sortcode' => array(
226
+                            'label' => __( 'Routing number', 'invoicing' ),
227
+                        ),
228
+                    ),
229
+                    'ZA' => array(
230
+                        'sortcode' => array(
231
+                            'label' => __( 'Branch code', 'invoicing' ),
232
+                        ),
233
+                    ),
234
+                )
235
+            );
236
+
237
+        }
238
+
239
+        return $this->locale;
240
+
241
+    }
242
+
243
+    /**
244
+     * Filters the gateway settings.
245
+     * 
246
+     * @param array $admin_settings
247
+     */
248
+    public function admin_settings( $admin_settings ) {
249 249
 
250 250
         $admin_settings['worldpay_desc']['std']    = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' );
251
-		$admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
251
+        $admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' );
252 252
 
253
-		$locale  = $this->get_country_locale();
253
+        $locale  = $this->get_country_locale();
254 254
 
255
-		// Get sortcode label in the $locale array and use appropriate one.
256
-		$country  = wpinv_default_billing_country();
257
-		$sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
255
+        // Get sortcode label in the $locale array and use appropriate one.
256
+        $country  = wpinv_default_billing_country();
257
+        $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' );
258 258
 
259
-		$admin_settings['bank_transfer_ac_name'] = array(
259
+        $admin_settings['bank_transfer_ac_name'] = array(
260 260
             'type' => 'text',
261 261
             'id'   => 'bank_transfer_ac_name',
262 262
             'name' => __( 'Account Name', 'invoicing' ),
263
-		);
263
+        );
264 264
 		
265
-		$admin_settings['bank_transfer_ac_no'] = array(
265
+        $admin_settings['bank_transfer_ac_no'] = array(
266 266
             'type' => 'text',
267 267
             'id'   => 'bank_transfer_ac_no',
268 268
             'name' => __( 'Account Number', 'invoicing' ),
269
-		);
269
+        );
270 270
 		
271
-		$admin_settings['bank_transfer_bank_name'] = array(
271
+        $admin_settings['bank_transfer_bank_name'] = array(
272 272
             'type' => 'text',
273 273
             'id'   => 'bank_transfer_bank_name',
274 274
             'name' => __( 'Bank Name', 'invoicing' ),
275
-		);
275
+        );
276 276
 
277
-		$admin_settings['bank_transfer_ifsc'] = array(
277
+        $admin_settings['bank_transfer_ifsc'] = array(
278 278
             'type' => 'text',
279 279
             'id'   => 'bank_transfer_ifsc',
280 280
             'name' => __( 'IFSC Code', 'invoicing' ),
281
-		);
281
+        );
282 282
 
283
-		$admin_settings['bank_transfer_iban'] = array(
283
+        $admin_settings['bank_transfer_iban'] = array(
284 284
             'type' => 'text',
285 285
             'id'   => 'bank_transfer_iban',
286 286
             'name' => __( 'IBAN', 'invoicing' ),
287
-		);
287
+        );
288 288
 
289
-		$admin_settings['bank_transfer_bic'] = array(
289
+        $admin_settings['bank_transfer_bic'] = array(
290 290
             'type' => 'text',
291 291
             'id'   => 'bank_transfer_bic',
292 292
             'name' => __( 'BIC/Swift Code', 'invoicing' ),
293
-		);
293
+        );
294 294
 		
295
-		$admin_settings['bank_transfer_sort_code'] = array(
296
-			'type' => 'text',
297
-			'id'   => 'bank_transfer_sort_code',
298
-			'name' => $sortcode,
299
-		);
295
+        $admin_settings['bank_transfer_sort_code'] = array(
296
+            'type' => 'text',
297
+            'id'   => 'bank_transfer_sort_code',
298
+            'name' => $sortcode,
299
+        );
300 300
 
301
-		$admin_settings['bank_transfer_info'] = array(
301
+        $admin_settings['bank_transfer_info'] = array(
302 302
             'id'   => 'bank_transfer_info',
303 303
             'name' => __( 'Instructions', 'invoicing' ),
304 304
             'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ),
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             'rows' => 5
309 309
         );
310 310
 
311
-		return $admin_settings;
312
-	}
311
+        return $admin_settings;
312
+    }
313 313
 
314 314
 }
Please login to merge, or discard this patch.
includes/class-wpinv-reports.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $current = 'earnings';
117 117
 
118 118
         if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) )
119
-		$current = $_GET['view'];
119
+        $current = $_GET['view'];
120 120
 
121 121
         ?>
122 122
 	        <form id="wpinv-reports-filter" method="get" class="tablenav">
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	        </form>
135 135
         <?php
136 136
 
137
-	    do_action( 'wpinv_reports_view_' . $current );
137
+        do_action( 'wpinv_reports_view_' . $current );
138 138
 
139 139
     }
140 140
 
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
             $is_writeable   = $is_dir && is_writeable( $this->export_dir );
225 225
 
226 226
             if ( $is_dir && $is_writeable ) {
227
-               return true;
227
+                return true;
228 228
             } else if ( $is_dir && !$is_writeable ) {
229
-               if ( !$this->wp_filesystem->chmod( $this->export_dir, FS_CHMOD_DIR ) ) {
230
-                   return wp_sprintf( __( 'Filesystem ERROR: Export location %s is not writable, check your file permissions.', 'invoicing' ), $this->export_dir );
231
-               }
229
+                if ( !$this->wp_filesystem->chmod( $this->export_dir, FS_CHMOD_DIR ) ) {
230
+                    return wp_sprintf( __( 'Filesystem ERROR: Export location %s is not writable, check your file permissions.', 'invoicing' ), $this->export_dir );
231
+                }
232 232
 
233
-               return true;
233
+                return true;
234 234
             } else {
235 235
                 if ( !$this->wp_filesystem->mkdir( $this->export_dir, FS_CHMOD_DIR ) ) {
236 236
                     return wp_sprintf( __( 'Filesystem ERROR: Could not create directory %s. This is usually due to inconsistent file permissions.', 'invoicing' ), $this->export_dir );
@@ -325,12 +325,12 @@  discard block
 block discarded – undo
325 325
         $output  = fopen( 'php://output', 'w' ) or die( 'Unsupported server' );
326 326
 
327 327
         // Let the browser know what content we're streaming and how it should save the content.
328
-		$name = time();
329
-		header( "Content-Type:application/csv" );
328
+        $name = time();
329
+        header( "Content-Type:application/csv" );
330 330
         header( "Content-Disposition:attachment;filename=getpaid-discounts-$name.csv" );
331 331
 
332 332
         // Output the csv column headers.
333
-		fputcsv(
333
+        fputcsv(
334 334
             $output,
335 335
             array(
336 336
                 __( 'Discount Id', 'invoicing' ),
@@ -698,12 +698,12 @@  discard block
 block discarded – undo
698 698
         $thirty_days_ago      = date( 'Y-m-d', strtotime( '-30 days', current_time( 'timestamp' ) ) );
699 699
         $first_day_month  	  = date( 'Y-m-1', current_time( 'timestamp' ) );
700 700
         $last_day_month  	  = date( 'Y-m-t', current_time( 'timestamp' ) );
701
-		$first_day_last_month = date( 'Y-m-d', strtotime( 'first day of last month', current_time( 'timestamp' ) ) );
701
+        $first_day_last_month = date( 'Y-m-d', strtotime( 'first day of last month', current_time( 'timestamp' ) ) );
702 702
         $last_day_last_month  = date( 'Y-m-d', strtotime( 'last day of last month', current_time( 'timestamp' ) ) );
703 703
         $first_day_year  	  = date( 'Y-1-1', current_time( 'timestamp' ) );
704 704
         $last_day_year  	  = date( 'Y-12-31', current_time( 'timestamp' ) );
705
-		$first_day_last_year  = date( 'Y-m-d', strtotime( 'first day of last year', current_time( 'timestamp' ) ) );
706
-		$last_day_last_year   = date( 'Y-m-d', strtotime( 'last day of last year', current_time( 'timestamp' ) ) );
705
+        $first_day_last_year  = date( 'Y-m-d', strtotime( 'first day of last year', current_time( 'timestamp' ) ) );
706
+        $last_day_last_year   = date( 'Y-m-d', strtotime( 'last day of last year', current_time( 'timestamp' ) ) );
707 707
 
708 708
         $ranges = array(
709 709
 
Please login to merge, or discard this patch.
includes/wpinv-email-functions.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
     $css = getpaid_get_email_css();
111 111
 
112 112
     // include css inliner
113
-	if ( ! class_exists( 'Emogrifier' ) ) {
114
-		include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
113
+    if ( ! class_exists( 'Emogrifier' ) ) {
114
+        include_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-emogrifier.php' );
115 115
     }
116 116
 
117 117
     // Inline the css.
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     $message = wpinv_email_style_body( $message );
191 191
     $to      = array_merge( wpinv_parse_list( $to ), wpinv_parse_list( $cc ) );
192 192
 
193
-	return $mailer->send(
193
+    return $mailer->send(
194 194
         $to,
195 195
         $subject,
196 196
         $message,
Please login to merge, or discard this patch.
includes/error-functions.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -117,14 +117,14 @@
 block discarded – undo
117 117
  */
118 118
 function getpaid_doing_it_wrong( $function, $message, $version ) {
119 119
 
120
-	$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
121
-
122
-	if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
123
-		do_action( 'doing_it_wrong_run', $function, $message, $version );
124
-		error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
125
-	} else {
126
-		_doing_it_wrong( $function, $message, $version );
127
-	}
120
+    $message .= ' Backtrace: ' . wp_debug_backtrace_summary();
121
+
122
+    if ( wp_doing_ajax() || defined( 'REST_REQUEST' ) ) {
123
+        do_action( 'doing_it_wrong_run', $function, $message, $version );
124
+        error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
125
+    } else {
126
+        _doing_it_wrong( $function, $message, $version );
127
+    }
128 128
 
129 129
 }
130 130
 
Please login to merge, or discard this patch.
widgets/getpaid.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
                     'desc_tip'    => true,
37 37
                     'default'     => '',
38 38
                     'advanced'    => false
39
-				),
39
+                ),
40 40
 
41 41
                 'form'  => array(
42
-	                'title'       => __( 'Form', 'invoicing' ),
43
-	                'desc'        => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ),
44
-	                'type'        => 'text',
45
-	                'desc_tip'    => true,
46
-	                'default'     => '',
47
-	                'placeholder' => __('1','invoicing'),
48
-	                'advanced'    => false
49
-				),
50
-
51
-				'item'  => array(
52
-	                'title'       => __( 'Items', 'invoicing' ),
53
-	                'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ),
54
-	                'type'        => 'text',
55
-	                'desc_tip'    => true,
56
-	                'default'     => '',
57
-	                'placeholder' => __('1','invoicing'),
58
-	                'advanced'    => false
59
-				),
42
+                    'title'       => __( 'Form', 'invoicing' ),
43
+                    'desc'        => __( 'Enter a form id in case you want to display a specific payment form', 'invoicing' ),
44
+                    'type'        => 'text',
45
+                    'desc_tip'    => true,
46
+                    'default'     => '',
47
+                    'placeholder' => __('1','invoicing'),
48
+                    'advanced'    => false
49
+                ),
50
+
51
+                'item'  => array(
52
+                    'title'       => __( 'Items', 'invoicing' ),
53
+                    'desc'        => __( 'Enter comma separated list of invoicing item id and quantity (item_id|quantity). Ex. 101|2. This will be ignored in case you specify a form above. Enter 0 as the quantity to let users select their own quantities', 'invoicing' ),
54
+                    'type'        => 'text',
55
+                    'desc_tip'    => true,
56
+                    'default'     => '',
57
+                    'placeholder' => __('1','invoicing'),
58
+                    'advanced'    => false
59
+                ),
60 60
 
61 61
                 'button'  => array(
62
-	                'title'       => __( 'Button', 'invoicing' ),
63
-	                'desc'        => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ),
64
-	                'type'        => 'text',
65
-	                'desc_tip'    => true,
66
-	                'default'     => '',
67
-	                'advanced'    => false
68
-				)
62
+                    'title'       => __( 'Button', 'invoicing' ),
63
+                    'desc'        => __( 'Enter button label in case you would like to display the forms in a popup.', 'invoicing' ),
64
+                    'type'        => 'text',
65
+                    'desc_tip'    => true,
66
+                    'default'     => '',
67
+                    'advanced'    => false
68
+                )
69 69
 
70 70
             )
71 71
 
@@ -75,95 +75,95 @@  discard block
 block discarded – undo
75 75
         parent::__construct( $options );
76 76
     }
77 77
 
78
-	/**
79
-	 * The Super block output function.
80
-	 *
81
-	 * @param array $args
82
-	 * @param array $widget_args
83
-	 * @param string $content
84
-	 *
85
-	 * @return string
86
-	 */
78
+    /**
79
+     * The Super block output function.
80
+     *
81
+     * @param array $args
82
+     * @param array $widget_args
83
+     * @param string $content
84
+     *
85
+     * @return string
86
+     */
87 87
     public function output( $args = array(), $widget_args = array(), $content = '' ) {
88 88
 
89
-	    // Is the shortcode set up correctly?
90
-		if ( empty( $args['form'] ) && empty( $args['item'] ) ) {
91
-			return aui()->alert(
92
-				array(
93
-					'type'    => 'warning',
94
-					'content' => __( 'No payment form or item selected', 'invoicing' ),
95
-				)
96
-			);
97
-		}
98
-
99
-		// Payment form or button?
100
-		if ( ! empty( $args['form'] ) ) {
101
-			return $this->handle_payment_form(  $args );
102
-		} else {
103
-			return $this->handle_buy_item(  $args );
104
-		}
105
-
106
-	}
107
-
108
-	/**
109
-	 * Displaying a payment form
110
-	 *
111
-	 * @return string
112
-	 */
89
+        // Is the shortcode set up correctly?
90
+        if ( empty( $args['form'] ) && empty( $args['item'] ) ) {
91
+            return aui()->alert(
92
+                array(
93
+                    'type'    => 'warning',
94
+                    'content' => __( 'No payment form or item selected', 'invoicing' ),
95
+                )
96
+            );
97
+        }
98
+
99
+        // Payment form or button?
100
+        if ( ! empty( $args['form'] ) ) {
101
+            return $this->handle_payment_form(  $args );
102
+        } else {
103
+            return $this->handle_buy_item(  $args );
104
+        }
105
+
106
+    }
107
+
108
+    /**
109
+     * Displaying a payment form
110
+     *
111
+     * @return string
112
+     */
113 113
     protected function handle_payment_form( $args = array() ) {
114 114
 
115
-		if ( empty( $args['button'] ) ) {
116
-			ob_start();
117
-			getpaid_display_payment_form( $args['form'] );
118
-			return ob_get_clean();
119
-		}
115
+        if ( empty( $args['button'] ) ) {
116
+            ob_start();
117
+            getpaid_display_payment_form( $args['form'] );
118
+            return ob_get_clean();
119
+        }
120 120
 
121
-		return $this->payment_form_button( $args['form'], $args['button'] );
122
-	}
121
+        return $this->payment_form_button( $args['form'], $args['button'] );
122
+    }
123 123
 
124
-	/**
125
-	 * Displays a payment form button.
126
-	 *
127
-	 * @return string
128
-	 */
124
+    /**
125
+     * Displays a payment form button.
126
+     *
127
+     * @return string
128
+     */
129 129
     protected function payment_form_button( $form, $button ) {
130
-		return getpaid_get_payment_button( $button, $form );
131
-	}
132
-
133
-	/**
134
-	 * Selling an item
135
-	 *
136
-	 * @return string
137
-	 */
130
+        return getpaid_get_payment_button( $button, $form );
131
+    }
132
+
133
+    /**
134
+     * Selling an item
135
+     *
136
+     * @return string
137
+     */
138 138
     protected function handle_buy_item( $args = array() ) {
139 139
 
140
-		if ( empty( $args['button'] ) ) {
141
-			return $this->buy_item_form( $args['item'] );
142
-		}
140
+        if ( empty( $args['button'] ) ) {
141
+            return $this->buy_item_form( $args['item'] );
142
+        }
143 143
 
144
-		return $this->buy_item_button( $args['item'], $args['button'] );
144
+        return $this->buy_item_button( $args['item'], $args['button'] );
145 145
 
146
-	}
146
+    }
147 147
 
148
-	/**
149
-	 * Displays a buy item form.
150
-	 *
151
-	 * @return string
152
-	 */
148
+    /**
149
+     * Displays a buy item form.
150
+     *
151
+     * @return string
152
+     */
153 153
     protected function buy_item_form( $item ) {
154
-		$items = getpaid_convert_items_to_array( $item );
155
-		ob_start();
156
-		getpaid_display_item_payment_form( $items );
157
-		return ob_get_clean();
158
-	}
159
-
160
-	/**
161
-	 * Displays a buy item button.
162
-	 *
163
-	 * @return string
164
-	 */
154
+        $items = getpaid_convert_items_to_array( $item );
155
+        ob_start();
156
+        getpaid_display_item_payment_form( $items );
157
+        return ob_get_clean();
158
+    }
159
+
160
+    /**
161
+     * Displays a buy item button.
162
+     *
163
+     * @return string
164
+     */
165 165
     protected function buy_item_button( $item, $button ) {
166
-		return getpaid_get_payment_button( $button, null, $item );
166
+        return getpaid_get_payment_button( $button, null, $item );
167 167
     }
168 168
 
169 169
 }
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-forms.php 1 patch
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -13,128 +13,128 @@
 block discarded – undo
13 13
 class GetPaid_Payment_Forms {
14 14
 
15 15
     /**
16
-	 * Class constructor
17
-	 *
18
-	 */
19
-	public function __construct() {
20
-
21
-		// Update a payment form's revenue whenever an invoice is paid for or refunded.
22
-		add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) );
23
-		add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) );
24
-
25
-		// Sync form amount whenever invoice statuses change.
26
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 );
27
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 );
28
-		add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 );
29
-
30
-	}
31
-
32
-	/**
33
-	 * Increments a form's revenue whenever there is a payment.
34
-	 *
35
-	 * @param WPInv_Invoice $invoice
36
-	 */
37
-	public function increment_form_revenue( $invoice ) {
38
-
39
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
40
-		if ( $form->get_id() ) {
41
-			$form->set_earned( $form->get_earned() + $invoice->get_total() );
42
-			$form->save();
43
-		}
44
-
45
-	}
46
-
47
-	/**
48
-	 * Decreases form revenue whenever invoice payment changes.
49
-	 *
50
-	 * @param WPInv_Invoice $invoice
51
-	 */
52
-	public function decrease_form_revenue( $invoice ) {
53
-
54
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
55
-		if ( $form->get_id() ) {
56
-			$form->set_earned( $form->get_earned() - $invoice->get_total() );
57
-			$form->save();
58
-		}
59
-
60
-	}
61
-
62
-	/**
63
-	 * Updates a form's failed amount.
64
-	 *
65
-	 * @param WPInv_Invoice $invoice
66
-	 * @param string $from
67
-	 * @param string $to
68
-	 */
69
-	public function update_form_failed_amount( $invoice, $from, $to ) {
70
-
71
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
72
-		if ( $form->get_id() ) {
73
-			return;
74
-		}
75
-
76
-		if ( 'wpi-failed' == $from ) {
77
-			$form->set_failed( $form->get_failed() - $invoice->get_total() );
78
-			$form->save();
79
-		}
80
-
81
-		if ( 'wpi-failed' == $to ) {
82
-			$form->set_failed( $form->get_failed() + $invoice->get_total() );
83
-			$form->save();
84
-		}
85
-
86
-	}
87
-
88
-	/**
89
-	 * Updates a form's refunded amount.
90
-	 *
91
-	 * @param WPInv_Invoice $invoice
92
-	 * @param string $from
93
-	 * @param string $to
94
-	 */
95
-	public function update_form_refunded_amount( $invoice, $from, $to ) {
96
-
97
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
98
-		if ( $form->get_id() ) {
99
-			return;
100
-		}
101
-
102
-		if ( 'wpi-refunded' == $from ) {
103
-			$form->set_refunded( $form->get_refunded() - $invoice->get_total() );
104
-			$form->save();
105
-		}
106
-
107
-		if ( 'wpi-refunded' == $to ) {
108
-			$form->set_refunded( $form->get_refunded() + $invoice->get_total() );
109
-			$form->save();
110
-		}
111
-
112
-	}
113
-
114
-	/**
115
-	 * Updates a form's cancelled amount.
116
-	 *
117
-	 * @param WPInv_Invoice $invoice
118
-	 * @param string $from
119
-	 * @param string $to
120
-	 */
121
-	public function update_form_cancelled_amount( $invoice, $from, $to ) {
122
-
123
-		$form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
124
-		if ( $form->get_id() ) {
125
-			return;
126
-		}
127
-
128
-		if ( 'wpi-cancelled' == $from ) {
129
-			$form->set_cancelled( $form->get_cancelled() - $invoice->get_total() );
130
-			$form->save();
131
-		}
132
-
133
-		if ( 'wpi-cancelled' == $to ) {
134
-			$form->set_cancelled( $form->get_cancelled() + $invoice->get_total() );
135
-			$form->save();
136
-		}
137
-
138
-	}
16
+     * Class constructor
17
+     *
18
+     */
19
+    public function __construct() {
20
+
21
+        // Update a payment form's revenue whenever an invoice is paid for or refunded.
22
+        add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) );
23
+        add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) );
24
+
25
+        // Sync form amount whenever invoice statuses change.
26
+        add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 );
27
+        add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 );
28
+        add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 );
29
+
30
+    }
31
+
32
+    /**
33
+     * Increments a form's revenue whenever there is a payment.
34
+     *
35
+     * @param WPInv_Invoice $invoice
36
+     */
37
+    public function increment_form_revenue( $invoice ) {
38
+
39
+        $form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
40
+        if ( $form->get_id() ) {
41
+            $form->set_earned( $form->get_earned() + $invoice->get_total() );
42
+            $form->save();
43
+        }
44
+
45
+    }
46
+
47
+    /**
48
+     * Decreases form revenue whenever invoice payment changes.
49
+     *
50
+     * @param WPInv_Invoice $invoice
51
+     */
52
+    public function decrease_form_revenue( $invoice ) {
53
+
54
+        $form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
55
+        if ( $form->get_id() ) {
56
+            $form->set_earned( $form->get_earned() - $invoice->get_total() );
57
+            $form->save();
58
+        }
59
+
60
+    }
61
+
62
+    /**
63
+     * Updates a form's failed amount.
64
+     *
65
+     * @param WPInv_Invoice $invoice
66
+     * @param string $from
67
+     * @param string $to
68
+     */
69
+    public function update_form_failed_amount( $invoice, $from, $to ) {
70
+
71
+        $form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
72
+        if ( $form->get_id() ) {
73
+            return;
74
+        }
75
+
76
+        if ( 'wpi-failed' == $from ) {
77
+            $form->set_failed( $form->get_failed() - $invoice->get_total() );
78
+            $form->save();
79
+        }
80
+
81
+        if ( 'wpi-failed' == $to ) {
82
+            $form->set_failed( $form->get_failed() + $invoice->get_total() );
83
+            $form->save();
84
+        }
85
+
86
+    }
87
+
88
+    /**
89
+     * Updates a form's refunded amount.
90
+     *
91
+     * @param WPInv_Invoice $invoice
92
+     * @param string $from
93
+     * @param string $to
94
+     */
95
+    public function update_form_refunded_amount( $invoice, $from, $to ) {
96
+
97
+        $form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
98
+        if ( $form->get_id() ) {
99
+            return;
100
+        }
101
+
102
+        if ( 'wpi-refunded' == $from ) {
103
+            $form->set_refunded( $form->get_refunded() - $invoice->get_total() );
104
+            $form->save();
105
+        }
106
+
107
+        if ( 'wpi-refunded' == $to ) {
108
+            $form->set_refunded( $form->get_refunded() + $invoice->get_total() );
109
+            $form->save();
110
+        }
111
+
112
+    }
113
+
114
+    /**
115
+     * Updates a form's cancelled amount.
116
+     *
117
+     * @param WPInv_Invoice $invoice
118
+     * @param string $from
119
+     * @param string $to
120
+     */
121
+    public function update_form_cancelled_amount( $invoice, $from, $to ) {
122
+
123
+        $form = new GetPaid_Payment_Form( $invoice->get_payment_form() );
124
+        if ( $form->get_id() ) {
125
+            return;
126
+        }
127
+
128
+        if ( 'wpi-cancelled' == $from ) {
129
+            $form->set_cancelled( $form->get_cancelled() - $invoice->get_total() );
130
+            $form->save();
131
+        }
132
+
133
+        if ( 'wpi-cancelled' == $to ) {
134
+            $form->set_cancelled( $form->get_cancelled() + $invoice->get_total() );
135
+            $form->save();
136
+        }
137
+
138
+    }
139 139
 
140 140
 }
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-payment-form.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit; // Exit if accessed directly
10
+    exit; // Exit if accessed directly
11 11
 }
12 12
 
13 13
 /**
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 class GetPaid_Meta_Box_Payment_Form {
17 17
 
18 18
     /**
19
-	 * Output the metabox.
20
-	 *
21
-	 * @param WP_Post $post
22
-	 */
19
+     * Output the metabox.
20
+     *
21
+     * @param WP_Post $post
22
+     */
23 23
     public static function output( $post ) {
24 24
         ?>
25 25
         <div id="wpinv-form-builder" class="bsui">
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
     }
87 87
 
88 88
     /**
89
-	 * Save meta box data.
90
-	 *
91
-	 * @param int $post_id
92
-	 */
93
-	public static function save( $post_id ) {
89
+     * Save meta box data.
90
+     *
91
+     * @param int $post_id
92
+     */
93
+    public static function save( $post_id ) {
94 94
 
95 95
         // Prepare the form.
96 96
         $form = new GetPaid_Payment_Form( $post_id );
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
     }
122 122
 
123 123
     /**
124
-	 * Converts an array fo form items to objects.
125
-	 *
126
-	 * @param array $items
127
-	 */
128
-	public static function item_to_objects( $items ) {
124
+     * Converts an array fo form items to objects.
125
+     *
126
+     * @param array $items
127
+     */
128
+    public static function item_to_objects( $items ) {
129 129
 
130 130
         $objects = array();
131 131
 
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-discount-details.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	exit; // Exit if accessed directly
11
+    exit; // Exit if accessed directly
12 12
 }
13 13
 
14 14
 /**
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 class GetPaid_Meta_Box_Discount_Details {
18 18
 
19 19
     /**
20
-	 * Output the metabox.
21
-	 *
22
-	 * @param WP_Post $post
23
-	 */
20
+     * Output the metabox.
21
+     *
22
+     * @param WP_Post $post
23
+     */
24 24
     public static function output( $post ) {
25 25
 
26 26
         // Prepare the discount.
@@ -368,34 +368,34 @@  discard block
 block discarded – undo
368 368
     }
369 369
 
370 370
     /**
371
-	 * Save meta box data.
372
-	 *
373
-	 * @param int $post_id
374
-	 */
375
-	public static function save( $post_id ) {
371
+     * Save meta box data.
372
+     *
373
+     * @param int $post_id
374
+     */
375
+    public static function save( $post_id ) {
376 376
 
377 377
         // Prepare the discount.
378 378
         $discount = new WPInv_Discount( $post_id );
379 379
 
380 380
         // Load new data.
381 381
         $discount->set_props(
382
-			array(
383
-				'code'                 => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null,
384
-				'amount'               => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null,
385
-				'start'                => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null,
386
-				'expiration'           => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null,
387
-				'is_single_use'        => isset( $_POST['wpinv_discount_single_use'] ),
382
+            array(
383
+                'code'                 => isset( $_POST['wpinv_discount_code'] ) ? $_POST['wpinv_discount_code'] : null,
384
+                'amount'               => isset( $_POST['wpinv_discount_amount'] ) ? $_POST['wpinv_discount_amount'] : null,
385
+                'start'                => isset( $_POST['wpinv_discount_start'] ) ? wpinv_clean( $_POST['wpinv_discount_start'] ) : null,
386
+                'expiration'           => isset( $_POST['wpinv_discount_expiration'] ) ? wpinv_clean( $_POST['wpinv_discount_expiration'] ) : null,
387
+                'is_single_use'        => isset( $_POST['wpinv_discount_single_use'] ),
388 388
                 'type'                 => isset( $_POST['wpinv_discount_type'] ) ? $_POST['wpinv_discount_type'] : null,
389
-				'is_recurring'         => isset( $_POST['wpinv_discount_recurring'] ),
390
-				'items'                => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : array(),
391
-				'excluded_items'       => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : array(),
392
-				'max_uses'             => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null,
393
-				'min_total'            => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null,
394
-				'max_total'            => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null,
395
-			)
389
+                'is_recurring'         => isset( $_POST['wpinv_discount_recurring'] ),
390
+                'items'                => isset( $_POST['wpinv_discount_items'] ) ? $_POST['wpinv_discount_items'] : array(),
391
+                'excluded_items'       => isset( $_POST['wpinv_discount_excluded_items'] ) ? $_POST['wpinv_discount_excluded_items'] : array(),
392
+                'max_uses'             => isset( $_POST['wpinv_discount_max_uses'] ) ? $_POST['wpinv_discount_max_uses'] : null,
393
+                'min_total'            => isset( $_POST['wpinv_discount_min_total'] ) ? $_POST['wpinv_discount_min_total'] : null,
394
+                'max_total'            => isset( $_POST['wpinv_discount_max_total'] ) ? $_POST['wpinv_discount_max_total'] : null,
395
+            )
396 396
         );
397 397
 
398
-		$discount->save();
399
-		do_action( 'getpaid_discount_metabox_save', $post_id, $discount );
400
-	}
398
+        $discount->save();
399
+        do_action( 'getpaid_discount_metabox_save', $post_id, $discount );
400
+    }
401 401
 }
Please login to merge, or discard this patch.