Test Failed
Pull Request — master (#2482)
by Devin
05:37
created
includes/admin/tools/data/class-give-tools-reset-stats.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	public function get_data() {
59 59
 		global $wpdb;
60 60
 
61
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
61
+		$items = $this->get_stored_data('give_temp_reset_ids');
62 62
 
63
-		if ( ! is_array( $items ) ) {
63
+		if ( ! is_array($items)) {
64 64
 			return false;
65 65
 		}
66 66
 
67
-		$offset     = ( $this->step - 1 ) * $this->per_step;
68
-		$step_items = array_slice( $items, $offset, $this->per_step );
67
+		$offset     = ($this->step - 1) * $this->per_step;
68
+		$step_items = array_slice($items, $offset, $this->per_step);
69 69
 
70
-		if ( $step_items ) {
70
+		if ($step_items) {
71 71
 
72 72
 			$step_ids = array(
73 73
 				'customers' => array(),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 				'other'     => array(),
76 76
 			);
77 77
 
78
-			foreach ( $step_items as $item ) {
78
+			foreach ($step_items as $item) {
79 79
 
80
-				switch ( $item['type'] ) {
80
+				switch ($item['type']) {
81 81
 					case 'customer':
82 82
 						$step_ids['customers'][] = $item['id'];
83 83
 						break;
@@ -85,26 +85,26 @@  discard block
 block discarded – undo
85 85
 						$step_ids['give_forms'][] = $item['id'];
86 86
 						break;
87 87
 					default:
88
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
89
-						$step_ids[ $item_type ][] = $item['id'];
88
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
89
+						$step_ids[$item_type][] = $item['id'];
90 90
 						break;
91 91
 				}
92 92
 			}
93 93
 
94 94
 			$sql = array();
95 95
 
96
-			foreach ( $step_ids as $type => $ids ) {
96
+			foreach ($step_ids as $type => $ids) {
97 97
 
98
-				if ( empty( $ids ) ) {
98
+				if (empty($ids)) {
99 99
 					continue;
100 100
 				}
101 101
 
102
-				$ids = implode( ',', $ids );
102
+				$ids = implode(',', $ids);
103 103
 
104
-				switch ( $type ) {
104
+				switch ($type) {
105 105
 					case 'customers':
106
-						$table_name = $wpdb->prefix . 'give_customers';
107
-						$meta_table_name = $wpdb->prefix . 'give_customermeta';
106
+						$table_name = $wpdb->prefix.'give_customers';
107
+						$meta_table_name = $wpdb->prefix.'give_customermeta';
108 108
 						$sql[]      = "DELETE FROM $table_name WHERE id IN ($ids)";
109 109
 						$sql[]      = "DELETE FROM $meta_table_name WHERE customer_id IN ($ids)";
110 110
 						break;
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 						break;
121 121
 				}
122 122
 
123
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
123
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
124 124
 					// Allows other types of custom post types to filter on their own post_type
125 125
 					// and add items to the query list, for the IDs found in their post type.
126
-					$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
126
+					$sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids);
127 127
 				}
128 128
 			}
129 129
 
130
-			if ( ! empty( $sql ) ) {
131
-				foreach ( $sql as $query ) {
132
-					$wpdb->query( $query );
130
+			if ( ! empty($sql)) {
131
+				foreach ($sql as $query) {
132
+					$wpdb->query($query);
133 133
 				}
134 134
 			}
135 135
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function get_percentage_complete() {
151 151
 
152
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
153
-		$total = count( $items );
152
+		$items = $this->get_stored_data('give_temp_reset_ids');
153
+		$total = count($items);
154 154
 
155 155
 		$percentage = 100;
156 156
 
157
-		if ( $total > 0 ) {
158
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
157
+		if ($total > 0) {
158
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
159 159
 		}
160 160
 
161
-		if ( $percentage > 100 ) {
161
+		if ($percentage > 100) {
162 162
 			$percentage = 100;
163 163
 		}
164 164
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @param array $request The Form Data passed into the batch processing.
174 174
 	 */
175
-	public function set_properties( $request ) {
175
+	public function set_properties($request) {
176 176
 	}
177 177
 
178 178
 	/**
@@ -183,31 +183,31 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function process_step() {
185 185
 
186
-		if ( ! $this->can_export() ) {
187
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array(
186
+		if ( ! $this->can_export()) {
187
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array(
188 188
 				'response' => 403,
189
-			) );
189
+			));
190 190
 		}
191 191
 
192 192
 		$had_data = $this->get_data();
193 193
 
194
-		if ( $had_data ) {
194
+		if ($had_data) {
195 195
 			$this->done = false;
196 196
 
197 197
 			return true;
198 198
 		} else {
199
-			update_option( 'give_earnings_total', 0 );
200
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
199
+			update_option('give_earnings_total', 0);
200
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
201 201
 
202
-			$this->delete_data( 'give_temp_reset_ids' );
202
+			$this->delete_data('give_temp_reset_ids');
203 203
 
204 204
 			// Reset the sequential order numbers
205
-			if ( give_get_option( 'enable_sequential' ) ) {
206
-				delete_option( 'give_last_payment_number' );
205
+			if (give_get_option('enable_sequential')) {
206
+				delete_option('give_last_payment_number');
207 207
 			}
208 208
 
209 209
 			$this->done    = true;
210
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
210
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
211 211
 
212 212
 			return false;
213 213
 		}
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 * Headers
218 218
 	 */
219 219
 	public function headers() {
220
-		ignore_user_abort( true );
220
+		ignore_user_abort(true);
221 221
 
222
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
223
-			set_time_limit( 0 );
222
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
223
+			set_time_limit(0);
224 224
 		}
225 225
 	}
226 226
 
@@ -244,26 +244,26 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function pre_fetch() {
246 246
 
247
-		if ( $this->step == 1 ) {
248
-			$this->delete_data( 'give_temp_reset_ids' );
247
+		if ($this->step == 1) {
248
+			$this->delete_data('give_temp_reset_ids');
249 249
 		}
250 250
 
251
-		$items = get_option( 'give_temp_reset_ids', false );
251
+		$items = get_option('give_temp_reset_ids', false);
252 252
 
253
-		if ( false === $items ) {
253
+		if (false === $items) {
254 254
 			$items = array();
255 255
 
256
-			$give_types_for_reset = array( 'give_forms', 'give_payment' );
257
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
256
+			$give_types_for_reset = array('give_forms', 'give_payment');
257
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
258 258
 
259
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
259
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
260 260
 				'post_type'      => $give_types_for_reset,
261 261
 				'post_status'    => 'any',
262
-				'posts_per_page' => - 1,
263
-			) );
262
+				'posts_per_page' => -1,
263
+			));
264 264
 
265
-			$posts = get_posts( $args );
266
-			foreach ( $posts as $post ) {
265
+			$posts = get_posts($args);
266
+			foreach ($posts as $post) {
267 267
 				$items[] = array(
268 268
 					'id'   => (int) $post->ID,
269 269
 					'type' => $post->post_type,
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 			}
272 272
 
273 273
 			$donor_args = array(
274
-				'number' => - 1,
274
+				'number' => -1,
275 275
 			);
276
-			$donors     = Give()->donors->get_donors( $donor_args );
277
-			foreach ( $donors as $donor ) {
276
+			$donors     = Give()->donors->get_donors($donor_args);
277
+			foreach ($donors as $donor) {
278 278
 				$items[] = array(
279 279
 					'id'   => (int) $donor->id,
280 280
 					'type' => 'customer',
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 
284 284
 			// Allow filtering of items to remove with an unassociative array for each item
285 285
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
286
-			$items = apply_filters( 'give_reset_items', $items );
286
+			$items = apply_filters('give_reset_items', $items);
287 287
 
288
-			$this->store_data( 'give_temp_reset_ids', $items );
288
+			$this->store_data('give_temp_reset_ids', $items);
289 289
 		}// End if().
290 290
 
291 291
 	}
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return mixed       Returns the data from the database.
301 301
 	 */
302
-	private function get_stored_data( $key ) {
302
+	private function get_stored_data($key) {
303 303
 		global $wpdb;
304
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
304
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
305 305
 
306
-		if ( empty( $value ) ) {
306
+		if (empty($value)) {
307 307
 			return false;
308 308
 		}
309 309
 
310
-		$maybe_json = json_decode( $value );
311
-		if ( ! is_null( $maybe_json ) ) {
312
-			$value = json_decode( $value, true );
310
+		$maybe_json = json_decode($value);
311
+		if ( ! is_null($maybe_json)) {
312
+			$value = json_decode($value, true);
313 313
 		}
314 314
 
315 315
 		return $value;
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @return void
327 327
 	 */
328
-	private function store_data( $key, $value ) {
328
+	private function store_data($key, $value) {
329 329
 		global $wpdb;
330 330
 
331
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
331
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
332 332
 
333 333
 		$data = array(
334 334
 			'option_name'  => $key,
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			'%s',
343 343
 		);
344 344
 
345
-		$wpdb->replace( $wpdb->options, $data, $formats );
345
+		$wpdb->replace($wpdb->options, $data, $formats);
346 346
 	}
347 347
 
348 348
 	/**
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return void
356 356
 	 */
357
-	private function delete_data( $key ) {
357
+	private function delete_data($key) {
358 358
 		global $wpdb;
359
-		$wpdb->delete( $wpdb->options, array(
359
+		$wpdb->delete($wpdb->options, array(
360 360
 			'option_name' => $key,
361
-		) );
361
+		));
362 362
 	}
363 363
 
364 364
 }
365 365
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/tools-actions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
  * @since  1.5
21 21
  */
22 22
 function give_register_batch_recount_export_classes() {
23
-	add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 );
23
+	add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1);
24 24
 }
25 25
 
26
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 );
26
+add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10);
27 27
 
28 28
 
29 29
 /**
@@ -35,39 +35,39 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return void
37 37
  */
38
-function give_include_batch_export_class( $class ) {
39
-	switch ( $class ) {
38
+function give_include_batch_export_class($class) {
39
+	switch ($class) {
40 40
 
41 41
 		case 'Give_Tools_Delete_Donors':
42
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-donors.php';
42
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-donors.php';
43 43
 			break;
44 44
 
45 45
 		case 'Give_Tools_Import_Donors':
46
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-import-donors.php';
46
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-import-donors.php';
47 47
 			break;
48 48
 
49 49
 		case 'Give_Tools_Delete_Test_Transactions':
50
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-transactions.php';
50
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-transactions.php';
51 51
 			break;
52 52
 
53 53
 		case 'Give_Tools_Recount_Donor_Stats':
54
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-donor-stats.php';
54
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-donor-stats.php';
55 55
 			break;
56 56
 
57 57
 		case 'Give_Tools_Reset_Stats':
58
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-reset-stats.php';
58
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-reset-stats.php';
59 59
 			break;
60 60
 
61 61
 		case 'Give_Tools_Recount_All_Stats':
62
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-all-stats.php';
62
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-all-stats.php';
63 63
 			break;
64 64
 
65 65
 		case 'Give_Tools_Recount_Form_Stats':
66
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-form-stats.php';
66
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-form-stats.php';
67 67
 			break;
68 68
 
69 69
 		case 'Give_Tools_Recount_Income':
70
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-income.php';
70
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-income.php';
71 71
 			break;
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
includes/payments/actions.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_donation', $payment_id );
61
+	do_action('give_pre_complete_donation', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int $payment_id The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_donation_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_donation_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$donor = new Give_Donor( $donor_id );
89
+	$donor = new Give_Donor($donor_id);
90 90
 	$donor->increase_purchase_count();
91
-	$donor->increase_value( $amount );
91
+	$donor->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136
-	$status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
136
+	$status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
137 137
 
138
-	give_insert_payment_note( $payment_id, $status_change );
138
+	give_insert_payment_note($payment_id, $status_change);
139 139
 }
140 140
 
141
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
141
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
142 142
 
143 143
 
144 144
 /**
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_update_old_payments_with_totals( $data ) {
158
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
157
+function give_update_old_payments_with_totals($data) {
158
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
159 159
 		return;
160 160
 	}
161 161
 
162
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
162
+	if (get_option('give_payment_totals_upgraded')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	$payments = give_get_payments( array(
166
+	$payments = give_get_payments(array(
167 167
 		'offset' => 0,
168
-		'number' => - 1,
168
+		'number' => -1,
169 169
 		'mode'   => 'all',
170
-	) );
170
+	));
171 171
 
172
-	if ( $payments ) {
173
-		foreach ( $payments as $payment ) {
172
+	if ($payments) {
173
+		foreach ($payments as $payment) {
174 174
 
175
-			$payment = new Give_Payment( $payment->ID );
175
+			$payment = new Give_Payment($payment->ID);
176 176
 			$meta    = $payment->get_meta();
177 177
 
178 178
 			$payment->total = $meta['amount'];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 		}
182 182
 	}
183 183
 
184
-	add_option( 'give_payment_totals_upgraded', 1 );
184
+	add_option('give_payment_totals_upgraded', 1);
185 185
 }
186 186
 
187
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
187
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
188 188
 
189 189
 /**
190 190
  * Mark Abandoned Donations
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
211
+	if ($payments) {
212 212
 		/**
213 213
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214 214
 		 *
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param array $skip_payment_gateways Array of payment gateways
218 218
 		 */
219
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
219
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
220 220
 
221
-		foreach ( $payments as $payment ) {
222
-			$gateway = give_get_payment_gateway( $payment );
221
+		foreach ($payments as $payment) {
222
+			$gateway = give_get_payment_gateway($payment);
223 223
 
224 224
 			// Skip payment gateways.
225
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
225
+			if (in_array($gateway, $skip_payment_gateways)) {
226 226
 				continue;
227 227
 			}
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	}
233 233
 }
234 234
 
235
-Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' );
235
+Give_Cron::add_weekly_event('give_mark_abandoned_donations');
236 236
 
237 237
 
238 238
 /**
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return void
246 246
  */
247
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
247
+function give_refresh_thismonth_stat_transients($payment_ID) {
248 248
 	// Monthly stats.
249
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
249
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
250 250
 
251 251
 	// @todo: Refresh only range related stat cache
252 252
 	give_delete_donation_stats();
253 253
 }
254 254
 
255
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
255
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
256 256
 
257 257
 /*
258 258
  * Add meta in payment that store page id and page url.
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @param {integer} $payment_id Payment id for which the meta value should be updated.
266 266
  */
267
-function give_payment_save_page_data( $payment_id ) {
268
-	$page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false );
267
+function give_payment_save_page_data($payment_id) {
268
+	$page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false);
269 269
 	// Check $page_url is not empty.
270
-	if ( $page_url ) {
271
-		update_post_meta( $payment_id, '_give_current_url', $page_url );
272
-		$page_id = url_to_postid( $page_url );
270
+	if ($page_url) {
271
+		update_post_meta($payment_id, '_give_current_url', $page_url);
272
+		$page_id = url_to_postid($page_url);
273 273
 		// Check $page_id is not empty.
274
-		if ( $page_id ) {
275
-			update_post_meta( $payment_id, '_give_current_page_id', $page_id );
274
+		if ($page_id) {
275
+			update_post_meta($payment_id, '_give_current_page_id', $page_id);
276 276
 		}
277 277
 	}
278 278
 }
279 279
 
280 280
 // Fire when payment is save.
281
-add_action( 'give_insert_payment', 'give_payment_save_page_data' );
282 281
\ No newline at end of file
282
+add_action('give_insert_payment', 'give_payment_save_page_data');
283 283
\ No newline at end of file
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1012,7 +1012,7 @@
 block discarded – undo
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014 1014
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1015
-					     && $args['price_id'] == $price['_give_id']['level_id']
1015
+						 && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @param  int|bool $payment_id A given payment
393 393
 	 *
394
-	 * @return mixed void|false
394
+	 * @return false|null void|false
395 395
 	 */
396 396
 	public function __construct( $payment_id = false ) {
397 397
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @param  string|bool $note The note to add
1117 1117
 	 *
1118
-	 * @return bool           If the note was specified or not
1118
+	 * @return false|null           If the note was specified or not
1119 1119
 	 */
1120 1120
 	public function add_note( $note = false ) {
1121 1121
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Spacing   +287 added lines, -287 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return mixed void|false
395 395
 	 */
396
-	public function __construct( $payment_id = false ) {
396
+	public function __construct($payment_id = false) {
397 397
 
398
-		if ( empty( $payment_id ) ) {
398
+		if (empty($payment_id)) {
399 399
 			return false;
400 400
 		}
401 401
 
402
-		$this->setup_payment( $payment_id );
402
+		$this->setup_payment($payment_id);
403 403
 	}
404 404
 
405 405
 	/**
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @return mixed        The value.
414 414
 	 */
415
-	public function __get( $key ) {
415
+	public function __get($key) {
416 416
 
417
-		if ( method_exists( $this, 'get_' . $key ) ) {
417
+		if (method_exists($this, 'get_'.$key)) {
418 418
 
419
-			$value = call_user_func( array( $this, 'get_' . $key ) );
419
+			$value = call_user_func(array($this, 'get_'.$key));
420 420
 
421 421
 		} else {
422 422
 
@@ -438,18 +438,18 @@  discard block
 block discarded – undo
438 438
 	 * @param  string $key   The property name
439 439
 	 * @param  mixed  $value The value of the property
440 440
 	 */
441
-	public function __set( $key, $value ) {
442
-		$ignore = array( '_ID' );
441
+	public function __set($key, $value) {
442
+		$ignore = array('_ID');
443 443
 
444
-		if ( 'status' === $key ) {
444
+		if ('status' === $key) {
445 445
 			$this->old_status = $this->status;
446 446
 		}
447 447
 
448
-		if ( ! in_array( $key, $ignore ) ) {
449
-			$this->pending[ $key ] = $value;
448
+		if ( ! in_array($key, $ignore)) {
449
+			$this->pending[$key] = $value;
450 450
 		}
451 451
 
452
-		if ( '_ID' !== $key ) {
452
+		if ('_ID' !== $key) {
453 453
 			$this->$key = $value;
454 454
 		}
455 455
 	}
@@ -464,9 +464,9 @@  discard block
 block discarded – undo
464 464
 	 *
465 465
 	 * @return boolean|null       If the item is set or not
466 466
 	 */
467
-	public function __isset( $name ) {
468
-		if ( property_exists( $this, $name ) ) {
469
-			return false === empty( $this->$name );
467
+	public function __isset($name) {
468
+		if (property_exists($this, $name)) {
469
+			return false === empty($this->$name);
470 470
 		} else {
471 471
 			return null;
472 472
 		}
@@ -482,20 +482,20 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @return bool            If the setup was successful or not
484 484
 	 */
485
-	private function setup_payment( $payment_id ) {
485
+	private function setup_payment($payment_id) {
486 486
 		$this->pending = array();
487 487
 
488
-		if ( empty( $payment_id ) ) {
488
+		if (empty($payment_id)) {
489 489
 			return false;
490 490
 		}
491 491
 
492
-		$payment = get_post( $payment_id );
492
+		$payment = get_post($payment_id);
493 493
 
494
-		if ( ! $payment || is_wp_error( $payment ) ) {
494
+		if ( ! $payment || is_wp_error($payment)) {
495 495
 			return false;
496 496
 		}
497 497
 
498
-		if ( 'give_payment' !== $payment->post_type ) {
498
+		if ('give_payment' !== $payment->post_type) {
499 499
 			return false;
500 500
 		}
501 501
 
@@ -509,13 +509,13 @@  discard block
 block discarded – undo
509 509
 		 * @param Give_Payment $this       Payment object.
510 510
 		 * @param int          $payment_id The ID of the payment.
511 511
 		 */
512
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
512
+		do_action('give_pre_setup_payment', $this, $payment_id);
513 513
 
514 514
 		// Primary Identifier.
515
-		$this->ID = absint( $payment_id );
515
+		$this->ID = absint($payment_id);
516 516
 
517 517
 		// Protected ID that can never be changed.
518
-		$this->_ID = absint( $payment_id );
518
+		$this->_ID = absint($payment_id);
519 519
 
520 520
 		// We have a payment, get the generic payment_meta item to reduce calls to it.
521 521
 		$this->payment_meta = $this->get_meta();
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		$this->parent_payment = $payment->post_parent;
532 532
 
533 533
 		$all_payment_statuses  = give_get_payment_statuses();
534
-		$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
534
+		$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
535 535
 
536 536
 		// Currency Based.
537 537
 		$this->total    = $this->setup_total();
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		 * @param Give_Payment $this       Payment object.
571 571
 		 * @param int          $payment_id The ID of the payment.
572 572
 		 */
573
-		do_action( 'give_setup_payment', $this, $payment_id );
573
+		do_action('give_setup_payment', $this, $payment_id);
574 574
 
575 575
 		return true;
576 576
 	}
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 	 *
589 589
 	 * @return void
590 590
 	 */
591
-	public function update_payment_setup( $payment_id ) {
592
-		$this->setup_payment( $payment_id );
591
+	public function update_payment_setup($payment_id) {
592
+		$this->setup_payment($payment_id);
593 593
 	}
594 594
 
595 595
 	/**
@@ -604,24 +604,24 @@  discard block
 block discarded – undo
604 604
 
605 605
 		// Construct the payment title.
606 606
 		$payment_title = '';
607
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
608
-			$payment_title = $this->first_name . ' ' . $this->last_name;
609
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
607
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
608
+			$payment_title = $this->first_name.' '.$this->last_name;
609
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
610 610
 			$payment_title = $this->first_name;
611
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
611
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
612 612
 			$payment_title = $this->email;
613 613
 		}
614 614
 
615 615
 		// Set Key.
616
-		if ( empty( $this->key ) ) {
616
+		if (empty($this->key)) {
617 617
 
618
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
619
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
618
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
619
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
620 620
 			$this->pending['key'] = $this->key;
621 621
 		}
622 622
 
623 623
 		// Set IP.
624
-		if ( empty( $this->ip ) ) {
624
+		if (empty($this->ip)) {
625 625
 
626 626
 			$this->ip            = give_get_ip();
627 627
 			$this->pending['ip'] = $this->ip;
@@ -648,19 +648,19 @@  discard block
 block discarded – undo
648 648
 			'status'       => $this->status,
649 649
 		);
650 650
 
651
-		$args = apply_filters( 'give_insert_payment_args', array(
651
+		$args = apply_filters('give_insert_payment_args', array(
652 652
 			'post_title'    => $payment_title,
653 653
 			'post_status'   => $this->status,
654 654
 			'post_type'     => 'give_payment',
655
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
656
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
655
+			'post_date'     => ! empty($this->date) ? $this->date : null,
656
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
657 657
 			'post_parent'   => $this->parent_payment,
658
-		), $payment_data );
658
+		), $payment_data);
659 659
 
660 660
 		// Create a blank payment
661
-		$payment_id = wp_insert_post( $args );
661
+		$payment_id = wp_insert_post($args);
662 662
 
663
-		if ( ! empty( $payment_id ) ) {
663
+		if ( ! empty($payment_id)) {
664 664
 
665 665
 			$this->ID  = $payment_id;
666 666
 			$this->_ID = $payment_id;
@@ -672,40 +672,40 @@  discard block
 block discarded – undo
672 672
 			 *
673 673
 			 * @since 1.8.13
674 674
 			 */
675
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
675
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
676 676
 
677
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
678
-				$donor = new Give_Donor( get_current_user_id(), true );
677
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
678
+				$donor = new Give_Donor(get_current_user_id(), true);
679 679
 
680 680
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
681
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
682
-					$donor->add_email( $this->email );
681
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
682
+					$donor->add_email($this->email);
683 683
 				}
684 684
 			}
685 685
 
686
-			if ( empty( $donor->id ) ) {
687
-				$donor = new Give_Donor( $this->email );
686
+			if (empty($donor->id)) {
687
+				$donor = new Give_Donor($this->email);
688 688
 			}
689 689
 
690
-			if ( empty( $donor->id ) ) {
690
+			if (empty($donor->id)) {
691 691
 
692 692
 				$donor_data = array(
693
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
693
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
694 694
 					'email'   => $this->email,
695 695
 					'user_id' => $this->user_id,
696 696
 				);
697 697
 
698
-				$donor->create( $donor_data );
698
+				$donor->create($donor_data);
699 699
 
700 700
 			}
701 701
 
702 702
 			$this->customer_id            = $donor->id;
703 703
 			$this->pending['customer_id'] = $this->customer_id;
704
-			$donor->attach_payment( $this->ID, false );
704
+			$donor->attach_payment($this->ID, false);
705 705
 
706
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
706
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
707 707
 
708
-			$this->update_meta( '_give_payment_meta', $this->payment_meta );
708
+			$this->update_meta('_give_payment_meta', $this->payment_meta);
709 709
 			$this->new = true;
710 710
 		}// End if().
711 711
 
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
 		$saved = false;
728 728
 
729 729
 		// Must have an ID.
730
-		if ( empty( $this->ID ) ) {
730
+		if (empty($this->ID)) {
731 731
 
732 732
 			$payment_id = $this->insert_payment();
733 733
 
734
-			if ( false === $payment_id ) {
734
+			if (false === $payment_id) {
735 735
 				$saved = false;
736 736
 			} else {
737 737
 				$this->ID = $payment_id;
@@ -739,42 +739,42 @@  discard block
 block discarded – undo
739 739
 		}
740 740
 
741 741
 		// Set ID if not matching.
742
-		if ( $this->ID !== $this->_ID ) {
742
+		if ($this->ID !== $this->_ID) {
743 743
 			$this->ID = $this->_ID;
744 744
 		}
745 745
 
746 746
 		// If we have something pending, let's save it.
747
-		if ( ! empty( $this->pending ) ) {
747
+		if ( ! empty($this->pending)) {
748 748
 
749 749
 			$total_increase = 0;
750 750
 			$total_decrease = 0;
751 751
 
752
-			foreach ( $this->pending as $key => $value ) {
752
+			foreach ($this->pending as $key => $value) {
753 753
 
754
-				switch ( $key ) {
754
+				switch ($key) {
755 755
 
756 756
 					case 'donations':
757 757
 						// Update totals for pending donations.
758
-						foreach ( $this->pending[ $key ] as $item ) {
758
+						foreach ($this->pending[$key] as $item) {
759 759
 
760
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
761
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
760
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
761
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
762 762
 
763
-							switch ( $item['action'] ) {
763
+							switch ($item['action']) {
764 764
 
765 765
 								case 'add':
766 766
 
767 767
 									$price = $item['price'];
768 768
 
769
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
769
+									if ('publish' === $this->status || 'complete' === $this->status) {
770 770
 
771 771
 										// Add donation to logs.
772
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
773
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
772
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
773
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
774 774
 
775
-										$form = new Give_Donate_Form( $item['id'] );
776
-										$form->increase_sales( $quantity );
777
-										$form->increase_earnings( $price );
775
+										$form = new Give_Donate_Form($item['id']);
776
+										$form->increase_sales($quantity);
777
+										$form->increase_earnings($price);
778 778
 
779 779
 										$total_increase += $price;
780 780
 									}
@@ -799,15 +799,15 @@  discard block
 block discarded – undo
799 799
 										),
800 800
 									);
801 801
 
802
-									$found_logs = get_posts( $log_args );
803
-									foreach ( $found_logs as $log ) {
804
-										wp_delete_post( $log->ID, true );
802
+									$found_logs = get_posts($log_args);
803
+									foreach ($found_logs as $log) {
804
+										wp_delete_post($log->ID, true);
805 805
 									}
806 806
 
807
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
808
-										$form = new Give_Donate_Form( $item['id'] );
809
-										$form->decrease_sales( $quantity );
810
-										$form->decrease_earnings( $item['amount'] );
807
+									if ('publish' === $this->status || 'complete' === $this->status) {
808
+										$form = new Give_Donate_Form($item['id']);
809
+										$form->decrease_sales($quantity);
810
+										$form->decrease_earnings($item['amount']);
811 811
 
812 812
 										$total_decrease += $item['amount'];
813 813
 									}
@@ -818,44 +818,44 @@  discard block
 block discarded – undo
818 818
 						break;
819 819
 
820 820
 					case 'status':
821
-						$this->update_status( $this->status );
821
+						$this->update_status($this->status);
822 822
 						break;
823 823
 
824 824
 					case 'gateway':
825
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
825
+						$this->update_meta('_give_payment_gateway', $this->gateway);
826 826
 						break;
827 827
 
828 828
 					case 'mode':
829
-						$this->update_meta( '_give_payment_mode', $this->mode );
829
+						$this->update_meta('_give_payment_mode', $this->mode);
830 830
 						break;
831 831
 
832 832
 					case 'transaction_id':
833
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
833
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
834 834
 						break;
835 835
 
836 836
 					case 'ip':
837
-						$this->update_meta( '_give_payment_user_ip', $this->ip );
837
+						$this->update_meta('_give_payment_user_ip', $this->ip);
838 838
 						break;
839 839
 
840 840
 					case 'customer_id':
841
-						$this->update_meta( '_give_payment_customer_id', $this->customer_id );
841
+						$this->update_meta('_give_payment_customer_id', $this->customer_id);
842 842
 						break;
843 843
 
844 844
 					case 'user_id':
845
-						$this->update_meta( '_give_payment_user_id', $this->user_id );
845
+						$this->update_meta('_give_payment_user_id', $this->user_id);
846 846
 						$this->user_info['id'] = $this->user_id;
847 847
 						break;
848 848
 
849 849
 					case 'form_title':
850
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
850
+						$this->update_meta('_give_payment_form_title', $this->form_title);
851 851
 						break;
852 852
 
853 853
 					case 'form_id':
854
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
854
+						$this->update_meta('_give_payment_form_id', $this->form_id);
855 855
 						break;
856 856
 
857 857
 					case 'price_id':
858
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
858
+						$this->update_meta('_give_payment_price_id', $this->price_id);
859 859
 						break;
860 860
 
861 861
 					case 'first_name':
@@ -871,15 +871,15 @@  discard block
 block discarded – undo
871 871
 						break;
872 872
 
873 873
 					case 'email':
874
-						$this->update_meta( '_give_payment_user_email', $this->email );
874
+						$this->update_meta('_give_payment_user_email', $this->email);
875 875
 						break;
876 876
 
877 877
 					case 'key':
878
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
878
+						$this->update_meta('_give_payment_purchase_key', $this->key);
879 879
 						break;
880 880
 
881 881
 					case 'number':
882
-						$this->update_meta( '_give_payment_number', $this->number );
882
+						$this->update_meta('_give_payment_number', $this->number);
883 883
 						break;
884 884
 
885 885
 					case 'date':
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
 							'edit_date' => true,
890 890
 						);
891 891
 
892
-						wp_update_post( $args );
892
+						wp_update_post($args);
893 893
 						break;
894 894
 
895 895
 					case 'completed_date':
896
-						$this->update_meta( '_give_completed_date', $this->completed_date );
896
+						$this->update_meta('_give_completed_date', $this->completed_date);
897 897
 						break;
898 898
 
899 899
 					case 'parent_payment':
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 							'post_parent' => $this->parent_payment,
903 903
 						);
904 904
 
905
-						wp_update_post( $args );
905
+						wp_update_post($args);
906 906
 						break;
907 907
 
908 908
 					default:
@@ -913,33 +913,33 @@  discard block
 block discarded – undo
913 913
 						 *
914 914
 						 * @param Give_Payment $this Payment object.
915 915
 						 */
916
-						do_action( 'give_payment_save', $this, $key );
916
+						do_action('give_payment_save', $this, $key);
917 917
 						break;
918 918
 				}// End switch().
919 919
 			}// End foreach().
920 920
 
921
-			if ( 'pending' !== $this->status ) {
921
+			if ('pending' !== $this->status) {
922 922
 
923
-				$donor = new Give_Donor( $this->customer_id );
923
+				$donor = new Give_Donor($this->customer_id);
924 924
 
925 925
 				$total_change = $total_increase - $total_decrease;
926
-				if ( $total_change < 0 ) {
926
+				if ($total_change < 0) {
927 927
 
928
-					$total_change = - ( $total_change );
928
+					$total_change = - ($total_change);
929 929
 					// Decrease the donor's donation stats.
930
-					$donor->decrease_value( $total_change );
931
-					give_decrease_total_earnings( $total_change );
930
+					$donor->decrease_value($total_change);
931
+					give_decrease_total_earnings($total_change);
932 932
 
933
-				} elseif ( $total_change > 0 ) {
933
+				} elseif ($total_change > 0) {
934 934
 
935 935
 					// Increase the donor's donation stats.
936
-					$donor->increase_value( $total_change );
937
-					give_increase_total_earnings( $total_change );
936
+					$donor->increase_value($total_change);
937
+					give_increase_total_earnings($total_change);
938 938
 
939 939
 				}
940 940
 			}
941 941
 
942
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
942
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
943 943
 
944 944
 			$new_meta = array(
945 945
 				'form_title' => $this->form_title,
@@ -950,12 +950,12 @@  discard block
 block discarded – undo
950 950
 			);
951 951
 
952 952
 			$meta        = $this->get_meta();
953
-			$merged_meta = array_merge( $meta, $new_meta );
953
+			$merged_meta = array_merge($meta, $new_meta);
954 954
 
955 955
 			// Only save the payment meta if it's changed.
956
-			if ( md5( serialize( $meta ) ) !== md5( serialize( $merged_meta ) ) ) {
957
-				$updated = $this->update_meta( '_give_payment_meta', $merged_meta );
958
-				if ( false !== $updated ) {
956
+			if (md5(serialize($meta)) !== md5(serialize($merged_meta))) {
957
+				$updated = $this->update_meta('_give_payment_meta', $merged_meta);
958
+				if (false !== $updated) {
959 959
 					$saved = true;
960 960
 				}
961 961
 			}
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
 			$saved         = true;
965 965
 		}// End if().
966 966
 
967
-		if ( true === $saved ) {
968
-			$this->setup_payment( $this->ID );
967
+		if (true === $saved) {
968
+			$this->setup_payment($this->ID);
969 969
 		}
970 970
 
971 971
 		return $saved;
@@ -983,12 +983,12 @@  discard block
 block discarded – undo
983 983
 	 *
984 984
 	 * @return bool           True when successful, false otherwise
985 985
 	 */
986
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
986
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
987 987
 
988
-		$donation = new Give_Donate_Form( $form_id );
988
+		$donation = new Give_Donate_Form($form_id);
989 989
 
990 990
 		// Bail if this post isn't a give donation form.
991
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
991
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
992 992
 			return false;
993 993
 		}
994 994
 
@@ -998,59 +998,59 @@  discard block
 block discarded – undo
998 998
 			'price_id' => false,
999 999
 		);
1000 1000
 
1001
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1001
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1002 1002
 
1003 1003
 		// Allow overriding the price.
1004
-		if ( false !== $args['price'] ) {
1004
+		if (false !== $args['price']) {
1005 1005
 			$donation_amount = $args['price'];
1006 1006
 		} else {
1007 1007
 
1008 1008
 			// Deal with variable pricing.
1009
-			if ( give_has_variable_prices( $donation->ID ) ) {
1010
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1009
+			if (give_has_variable_prices($donation->ID)) {
1010
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1011 1011
 				$donation_amount = '';
1012 1012
 				// Loop through prices.
1013
-				foreach ( $prices as $price ) {
1013
+				foreach ($prices as $price) {
1014 1014
 					// Find a match between price_id and level_id.
1015 1015
 					// First verify array keys exists THEN make the match.
1016
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1016
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1017 1017
 					     && $args['price_id'] == $price['_give_id']['level_id']
1018 1018
 					) {
1019 1019
 						$donation_amount = $price['_give_amount'];
1020 1020
 					}
1021 1021
 				}
1022 1022
 				// Fallback to the lowest price point.
1023
-				if ( $donation_amount == '' ) {
1024
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1025
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1023
+				if ($donation_amount == '') {
1024
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1025
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1026 1026
 				}
1027 1027
 			} else {
1028 1028
 				// Simple form price.
1029
-				$donation_amount = give_get_form_price( $donation->ID );
1029
+				$donation_amount = give_get_form_price($donation->ID);
1030 1030
 			}
1031 1031
 		}
1032 1032
 
1033 1033
 		// Sanitizing the price here so we don't have a dozen calls later.
1034
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1035
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1034
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1035
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1036 1036
 
1037 1037
 		// Add Options.
1038 1038
 		$default_options = array();
1039
-		if ( false !== $args['price_id'] ) {
1039
+		if (false !== $args['price_id']) {
1040 1040
 			$default_options['price_id'] = (int) $args['price_id'];
1041 1041
 		}
1042
-		$options = wp_parse_args( $options, $default_options );
1042
+		$options = wp_parse_args($options, $default_options);
1043 1043
 
1044 1044
 		// Do not allow totals to go negative.
1045
-		if ( $total < 0 ) {
1045
+		if ($total < 0) {
1046 1046
 			$total = 0;
1047 1047
 		}
1048 1048
 
1049 1049
 		$donation = array(
1050 1050
 			'name'     => $donation->post_title,
1051 1051
 			'id'       => $donation->ID,
1052
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1053
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1052
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1053
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1054 1054
 			'price_id' => $args['price_id'],
1055 1055
 			'action'   => 'add',
1056 1056
 			'options'  => $options,
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
 		$this->pending['donations'][] = $donation;
1060 1060
 
1061
-		$this->increase_subtotal( $total );
1061
+		$this->increase_subtotal($total);
1062 1062
 
1063 1063
 		return true;
1064 1064
 
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 	 *
1076 1076
 	 * @return bool           If the item was removed or not
1077 1077
 	 */
1078
-	public function remove_donation( $form_id, $args = array() ) {
1078
+	public function remove_donation($form_id, $args = array()) {
1079 1079
 
1080 1080
 		// Set some defaults.
1081 1081
 		$defaults = array(
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 			'price'    => false,
1084 1084
 			'price_id' => false,
1085 1085
 		);
1086
-		$args     = wp_parse_args( $args, $defaults );
1086
+		$args = wp_parse_args($args, $defaults);
1087 1087
 
1088
-		$form = new Give_Donate_Form( $form_id );
1088
+		$form = new Give_Donate_Form($form_id);
1089 1089
 
1090 1090
 		// Bail if this post isn't a valid give donation form.
1091
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1091
+		if ( ! $form || $form->post_type !== 'give_forms') {
1092 1092
 			return false;
1093 1093
 		}
1094 1094
 
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
 		$this->pending['donations'][] = $pending_args;
1103 1103
 
1104
-		$this->decrease_subtotal( $this->total );
1104
+		$this->decrease_subtotal($this->total);
1105 1105
 
1106 1106
 		return true;
1107 1107
 	}
@@ -1117,13 +1117,13 @@  discard block
 block discarded – undo
1117 1117
 	 *
1118 1118
 	 * @return bool           If the note was specified or not
1119 1119
 	 */
1120
-	public function add_note( $note = false ) {
1120
+	public function add_note($note = false) {
1121 1121
 		// Bail if no note specified.
1122
-		if ( ! $note ) {
1122
+		if ( ! $note) {
1123 1123
 			return false;
1124 1124
 		}
1125 1125
 
1126
-		give_insert_payment_note( $this->ID, $note );
1126
+		give_insert_payment_note($this->ID, $note);
1127 1127
 	}
1128 1128
 
1129 1129
 	/**
@@ -1136,8 +1136,8 @@  discard block
 block discarded – undo
1136 1136
 	 *
1137 1137
 	 * @return void
1138 1138
 	 */
1139
-	private function increase_subtotal( $amount = 0.00 ) {
1140
-		$amount         = (float) $amount;
1139
+	private function increase_subtotal($amount = 0.00) {
1140
+		$amount = (float) $amount;
1141 1141
 		$this->subtotal += $amount;
1142 1142
 
1143 1143
 		$this->recalculate_total();
@@ -1153,11 +1153,11 @@  discard block
 block discarded – undo
1153 1153
 	 *
1154 1154
 	 * @return void
1155 1155
 	 */
1156
-	private function decrease_subtotal( $amount = 0.00 ) {
1157
-		$amount         = (float) $amount;
1156
+	private function decrease_subtotal($amount = 0.00) {
1157
+		$amount = (float) $amount;
1158 1158
 		$this->subtotal -= $amount;
1159 1159
 
1160
-		if ( $this->subtotal < 0 ) {
1160
+		if ($this->subtotal < 0) {
1161 1161
 			$this->subtotal = 0;
1162 1162
 		}
1163 1163
 
@@ -1186,24 +1186,24 @@  discard block
 block discarded – undo
1186 1186
 	 *
1187 1187
 	 * @return bool   $updated Returns if the status was successfully updated.
1188 1188
 	 */
1189
-	public function update_status( $status = false ) {
1189
+	public function update_status($status = false) {
1190 1190
 
1191 1191
 		// standardize the 'complete(d)' status.
1192
-		if ( $status == 'completed' || $status == 'complete' ) {
1192
+		if ($status == 'completed' || $status == 'complete') {
1193 1193
 			$status = 'publish';
1194 1194
 		}
1195 1195
 
1196
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1196
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1197 1197
 
1198
-		if ( $old_status === $status ) {
1198
+		if ($old_status === $status) {
1199 1199
 			return false; // Don't permit status changes that aren't changes.
1200 1200
 		}
1201 1201
 
1202
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1202
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1203 1203
 
1204 1204
 		$updated = false;
1205 1205
 
1206
-		if ( $do_change ) {
1206
+		if ($do_change) {
1207 1207
 
1208 1208
 			/**
1209 1209
 			 * Fires before changing payment status.
@@ -1214,21 +1214,21 @@  discard block
 block discarded – undo
1214 1214
 			 * @param string $status     The new status.
1215 1215
 			 * @param string $old_status The old status.
1216 1216
 			 */
1217
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1217
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1218 1218
 
1219 1219
 			$update_fields = array(
1220 1220
 				'ID'          => $this->ID,
1221 1221
 				'post_status' => $status,
1222
-				'edit_date'   => current_time( 'mysql' ),
1222
+				'edit_date'   => current_time('mysql'),
1223 1223
 			);
1224 1224
 
1225
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1225
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1226 1226
 
1227 1227
 			$all_payment_statuses  = give_get_payment_statuses();
1228
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1228
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1229 1229
 
1230 1230
 			// Process any specific status functions.
1231
-			switch ( $status ) {
1231
+			switch ($status) {
1232 1232
 				case 'refunded':
1233 1233
 					$this->process_refund();
1234 1234
 					break;
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 			 * @param string $status     The new status.
1256 1256
 			 * @param string $old_status The old status.
1257 1257
 			 */
1258
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1258
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1259 1259
 
1260 1260
 		}// End if().
1261 1261
 
@@ -1290,41 +1290,41 @@  discard block
 block discarded – undo
1290 1290
 	 *
1291 1291
 	 * @return mixed             The value from the post meta
1292 1292
 	 */
1293
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1293
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1294 1294
 
1295
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1295
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1296 1296
 
1297
-		if ( $meta_key === '_give_payment_meta' ) {
1297
+		if ($meta_key === '_give_payment_meta') {
1298 1298
 			$meta = (array) $meta;
1299 1299
 
1300
-			if ( empty( $meta['key'] ) ) {
1300
+			if (empty($meta['key'])) {
1301 1301
 				$meta['key'] = $this->setup_payment_key();
1302 1302
 			}
1303 1303
 
1304
-			if ( empty( $meta['form_title'] ) ) {
1304
+			if (empty($meta['form_title'])) {
1305 1305
 				$meta['form_title'] = $this->setup_form_title();
1306 1306
 			}
1307 1307
 
1308
-			if ( empty( $meta['email'] ) ) {
1308
+			if (empty($meta['email'])) {
1309 1309
 				$meta['email'] = $this->setup_email();
1310 1310
 			}
1311 1311
 
1312
-			if ( empty( $meta['date'] ) ) {
1313
-				$meta['date'] = get_post_field( 'post_date', $this->ID );
1312
+			if (empty($meta['date'])) {
1313
+				$meta['date'] = get_post_field('post_date', $this->ID);
1314 1314
 			}
1315 1315
 		}
1316 1316
 
1317
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1317
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1318 1318
 
1319 1319
 		// Security check.
1320
-		if ( is_serialized( $meta ) ) {
1321
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1322
-			if ( ! empty( $matches ) ) {
1320
+		if (is_serialized($meta)) {
1321
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1322
+			if ( ! empty($matches)) {
1323 1323
 				$meta = array();
1324 1324
 			}
1325 1325
 		}
1326 1326
 
1327
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1327
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1328 1328
 	}
1329 1329
 
1330 1330
 	/**
@@ -1339,23 +1339,23 @@  discard block
 block discarded – undo
1339 1339
 	 *
1340 1340
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1341 1341
 	 */
1342
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1343
-		if ( empty( $meta_key ) ) {
1342
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1343
+		if (empty($meta_key)) {
1344 1344
 			return false;
1345 1345
 		}
1346 1346
 
1347
-		if ( $meta_key == 'key' || $meta_key == 'date' ) {
1347
+		if ($meta_key == 'key' || $meta_key == 'date') {
1348 1348
 
1349 1349
 			$current_meta              = $this->get_meta();
1350
-			$current_meta[ $meta_key ] = $meta_value;
1350
+			$current_meta[$meta_key] = $meta_value;
1351 1351
 
1352 1352
 			$meta_key   = '_give_payment_meta';
1353 1353
 			$meta_value = $current_meta;
1354 1354
 
1355
-		} elseif ( $meta_key == 'email' || $meta_key == '_give_payment_user_email' ) {
1355
+		} elseif ($meta_key == 'email' || $meta_key == '_give_payment_user_email') {
1356 1356
 
1357
-			$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1358
-			give_update_meta( $this->ID, '_give_payment_user_email', $meta_value );
1357
+			$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1358
+			give_update_meta($this->ID, '_give_payment_user_email', $meta_value);
1359 1359
 
1360 1360
 			$current_meta                       = $this->get_meta();
1361 1361
 			$current_meta['user_info']['email'] = $meta_value;
@@ -1365,9 +1365,9 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
 		}
1367 1367
 
1368
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1368
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1369 1369
 
1370
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1370
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1371 1371
 	}
1372 1372
 
1373 1373
 	/**
@@ -1382,14 +1382,14 @@  discard block
 block discarded – undo
1382 1382
 		$process_refund = true;
1383 1383
 
1384 1384
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1385
-		if ( 'publish' != $this->old_status || 'refunded' != $this->status ) {
1385
+		if ('publish' != $this->old_status || 'refunded' != $this->status) {
1386 1386
 			$process_refund = false;
1387 1387
 		}
1388 1388
 
1389 1389
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1390
-		$process_refund = apply_filters( 'give_should_process_refund', $process_refund, $this );
1390
+		$process_refund = apply_filters('give_should_process_refund', $process_refund, $this);
1391 1391
 
1392
-		if ( false === $process_refund ) {
1392
+		if (false === $process_refund) {
1393 1393
 			return;
1394 1394
 		}
1395 1395
 
@@ -1400,13 +1400,13 @@  discard block
 block discarded – undo
1400 1400
 		 *
1401 1401
 		 * @param Give_Payment $this Payment object.
1402 1402
 		 */
1403
-		do_action( 'give_pre_refund_payment', $this );
1403
+		do_action('give_pre_refund_payment', $this);
1404 1404
 
1405
-		$decrease_earnings       = apply_filters( 'give_decrease_store_earnings_on_refund', true, $this );
1406
-		$decrease_customer_value = apply_filters( 'give_decrease_customer_value_on_refund', true, $this );
1407
-		$decrease_purchase_count = apply_filters( 'give_decrease_customer_purchase_count_on_refund', true, $this );
1405
+		$decrease_earnings       = apply_filters('give_decrease_store_earnings_on_refund', true, $this);
1406
+		$decrease_customer_value = apply_filters('give_decrease_customer_value_on_refund', true, $this);
1407
+		$decrease_purchase_count = apply_filters('give_decrease_customer_purchase_count_on_refund', true, $this);
1408 1408
 
1409
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_customer_value, $decrease_purchase_count );
1409
+		$this->maybe_alter_stats($decrease_earnings, $decrease_customer_value, $decrease_purchase_count);
1410 1410
 		$this->delete_sales_logs();
1411 1411
 
1412 1412
 		// @todo: Refresh only range related stat cache
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		 *
1420 1420
 		 * @param Give_Payment $this Payment object.
1421 1421
 		 */
1422
-		do_action( 'give_post_refund_payment', $this );
1422
+		do_action('give_post_refund_payment', $this);
1423 1423
 	}
1424 1424
 
1425 1425
 	/**
@@ -1446,26 +1446,26 @@  discard block
 block discarded – undo
1446 1446
 		$process_pending = true;
1447 1447
 
1448 1448
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1449
-		if ( 'publish' != $this->old_status || 'pending' != $this->status ) {
1449
+		if ('publish' != $this->old_status || 'pending' != $this->status) {
1450 1450
 			$process_pending = false;
1451 1451
 		}
1452 1452
 
1453 1453
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1454
-		$process_pending = apply_filters( 'give_should_process_pending', $process_pending, $this );
1454
+		$process_pending = apply_filters('give_should_process_pending', $process_pending, $this);
1455 1455
 
1456
-		if ( false === $process_pending ) {
1456
+		if (false === $process_pending) {
1457 1457
 			return;
1458 1458
 		}
1459 1459
 
1460
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_pending', true, $this );
1461
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_pending', true, $this );
1462
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_pending', true, $this );
1460
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_pending', true, $this);
1461
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_pending', true, $this);
1462
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_pending', true, $this);
1463 1463
 
1464
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1464
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1465 1465
 		$this->delete_sales_logs();
1466 1466
 
1467 1467
 		$this->completed_date = false;
1468
-		$this->update_meta( '_give_completed_date', '' );
1468
+		$this->update_meta('_give_completed_date', '');
1469 1469
 
1470 1470
 		// @todo: Refresh only range related stat cache
1471 1471
 		give_delete_donation_stats();
@@ -1483,26 +1483,26 @@  discard block
 block discarded – undo
1483 1483
 		$process_cancelled = true;
1484 1484
 
1485 1485
 		// If the payment was not in publish or revoked status, don't decrement stats as they were never incremented.
1486
-		if ( 'publish' != $this->old_status || 'cancelled' != $this->status ) {
1486
+		if ('publish' != $this->old_status || 'cancelled' != $this->status) {
1487 1487
 			$process_cancelled = false;
1488 1488
 		}
1489 1489
 
1490 1490
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1491
-		$process_cancelled = apply_filters( 'give_should_process_cancelled', $process_cancelled, $this );
1491
+		$process_cancelled = apply_filters('give_should_process_cancelled', $process_cancelled, $this);
1492 1492
 
1493
-		if ( false === $process_cancelled ) {
1493
+		if (false === $process_cancelled) {
1494 1494
 			return;
1495 1495
 		}
1496 1496
 
1497
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_cancelled', true, $this );
1498
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_cancelled', true, $this );
1499
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_cancelled', true, $this );
1497
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_cancelled', true, $this);
1498
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_cancelled', true, $this);
1499
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_cancelled', true, $this);
1500 1500
 
1501
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1501
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1502 1502
 		$this->delete_sales_logs();
1503 1503
 
1504 1504
 		$this->completed_date = false;
1505
-		$this->update_meta( '_give_completed_date', '' );
1505
+		$this->update_meta('_give_completed_date', '');
1506 1506
 
1507 1507
 		// @todo: Refresh only range related stat cache
1508 1508
 		give_delete_donation_stats();
@@ -1518,26 +1518,26 @@  discard block
 block discarded – undo
1518 1518
 		$process_revoked = true;
1519 1519
 
1520 1520
 		// If the payment was not in publish, don't decrement stats as they were never incremented.
1521
-		if ( 'publish' != $this->old_status || 'revoked' != $this->status ) {
1521
+		if ('publish' != $this->old_status || 'revoked' != $this->status) {
1522 1522
 			$process_revoked = false;
1523 1523
 		}
1524 1524
 
1525 1525
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1526
-		$process_revoked = apply_filters( 'give_should_process_revoked', $process_revoked, $this );
1526
+		$process_revoked = apply_filters('give_should_process_revoked', $process_revoked, $this);
1527 1527
 
1528
-		if ( false === $process_revoked ) {
1528
+		if (false === $process_revoked) {
1529 1529
 			return;
1530 1530
 		}
1531 1531
 
1532
-		$decrease_earnings       = apply_filters( 'give_decrease_earnings_on_revoked', true, $this );
1533
-		$decrease_donor_value    = apply_filters( 'give_decrease_donor_value_on_revoked', true, $this );
1534
-		$decrease_donation_count = apply_filters( 'give_decrease_donors_donation_count_on_revoked', true, $this );
1532
+		$decrease_earnings       = apply_filters('give_decrease_earnings_on_revoked', true, $this);
1533
+		$decrease_donor_value    = apply_filters('give_decrease_donor_value_on_revoked', true, $this);
1534
+		$decrease_donation_count = apply_filters('give_decrease_donors_donation_count_on_revoked', true, $this);
1535 1535
 
1536
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1536
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1537 1537
 		$this->delete_sales_logs();
1538 1538
 
1539 1539
 		$this->completed_date = false;
1540
-		$this->update_meta( '_give_completed_date', '' );
1540
+		$this->update_meta('_give_completed_date', '');
1541 1541
 
1542 1542
 		// @todo: Refresh only range related stat cache
1543 1543
 		give_delete_donation_stats();
@@ -1555,25 +1555,25 @@  discard block
 block discarded – undo
1555 1555
 	 *
1556 1556
 	 * @return void
1557 1557
 	 */
1558
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1558
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1559 1559
 
1560
-		give_undo_donation( $this->ID );
1560
+		give_undo_donation($this->ID);
1561 1561
 
1562 1562
 		// Decrease store earnings.
1563
-		if ( true === $alter_store_earnings ) {
1564
-			give_decrease_total_earnings( $this->total );
1563
+		if (true === $alter_store_earnings) {
1564
+			give_decrease_total_earnings($this->total);
1565 1565
 		}
1566 1566
 
1567 1567
 		// Decrement the stats for the donor.
1568
-		if ( ! empty( $this->customer_id ) ) {
1568
+		if ( ! empty($this->customer_id)) {
1569 1569
 
1570
-			$donor = new Give_Donor( $this->customer_id );
1570
+			$donor = new Give_Donor($this->customer_id);
1571 1571
 
1572
-			if ( true === $alter_customer_value ) {
1573
-				$donor->decrease_value( $this->total );
1572
+			if (true === $alter_customer_value) {
1573
+				$donor->decrease_value($this->total);
1574 1574
 			}
1575 1575
 
1576
-			if ( true === $alter_customer_purchase_count ) {
1576
+			if (true === $alter_customer_purchase_count) {
1577 1577
 				$donor->decrease_donation_count();
1578 1578
 			}
1579 1579
 		}
@@ -1622,13 +1622,13 @@  discard block
 block discarded – undo
1622 1622
 	 * @return string The date the payment was completed
1623 1623
 	 */
1624 1624
 	private function setup_completed_date() {
1625
-		$payment = get_post( $this->ID );
1625
+		$payment = get_post($this->ID);
1626 1626
 
1627
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1627
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1628 1628
 			return false; // This payment was never completed.
1629 1629
 		}
1630 1630
 
1631
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1631
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1632 1632
 
1633 1633
 		return $date;
1634 1634
 	}
@@ -1642,7 +1642,7 @@  discard block
 block discarded – undo
1642 1642
 	 * @return string The payment mode
1643 1643
 	 */
1644 1644
 	private function setup_mode() {
1645
-		return $this->get_meta( '_give_payment_mode' );
1645
+		return $this->get_meta('_give_payment_mode');
1646 1646
 	}
1647 1647
 
1648 1648
 	/**
@@ -1654,7 +1654,7 @@  discard block
 block discarded – undo
1654 1654
 	 * @return bool The payment import
1655 1655
 	 */
1656 1656
 	private function setup_import() {
1657
-		return (bool) $this->get_meta( '_give_payment_import' );
1657
+		return (bool) $this->get_meta('_give_payment_import');
1658 1658
 	}
1659 1659
 
1660 1660
 	/**
@@ -1666,18 +1666,18 @@  discard block
 block discarded – undo
1666 1666
 	 * @return float The payment total
1667 1667
 	 */
1668 1668
 	private function setup_total() {
1669
-		$amount = $this->get_meta( '_give_payment_total', true );
1669
+		$amount = $this->get_meta('_give_payment_total', true);
1670 1670
 
1671
-		if ( empty( $amount ) && '0.00' != $amount ) {
1672
-			$meta = $this->get_meta( '_give_payment_meta', true );
1673
-			$meta = maybe_unserialize( $meta );
1671
+		if (empty($amount) && '0.00' != $amount) {
1672
+			$meta = $this->get_meta('_give_payment_meta', true);
1673
+			$meta = maybe_unserialize($meta);
1674 1674
 
1675
-			if ( isset( $meta['amount'] ) ) {
1675
+			if (isset($meta['amount'])) {
1676 1676
 				$amount = $meta['amount'];
1677 1677
 			}
1678 1678
 		}
1679 1679
 
1680
-		return round( (float) $amount, give_get_price_decimals( $this->ID ) );
1680
+		return round((float) $amount, give_get_price_decimals($this->ID));
1681 1681
 	}
1682 1682
 
1683 1683
 	/**
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	 * @return string The currency for the payment
1704 1704
 	 */
1705 1705
 	private function setup_currency() {
1706
-		$currency = ! empty( $this->payment_meta['currency'] ) ? $this->payment_meta['currency'] : apply_filters( 'give_payment_currency_default', give_get_currency( $this->form_id, $this ), $this );
1706
+		$currency = ! empty($this->payment_meta['currency']) ? $this->payment_meta['currency'] : apply_filters('give_payment_currency_default', give_get_currency($this->form_id, $this), $this);
1707 1707
 
1708 1708
 		return $currency;
1709 1709
 	}
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	 * @return string The gateway
1718 1718
 	 */
1719 1719
 	private function setup_gateway() {
1720
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1720
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1721 1721
 
1722 1722
 		return $gateway;
1723 1723
 	}
@@ -1731,11 +1731,11 @@  discard block
 block discarded – undo
1731 1731
 	 * @return string The donation ID
1732 1732
 	 */
1733 1733
 	private function setup_transaction_id() {
1734
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1734
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1735 1735
 
1736
-		if ( empty( $transaction_id ) ) {
1736
+		if (empty($transaction_id)) {
1737 1737
 			$gateway        = $this->gateway;
1738
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1738
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1739 1739
 		}
1740 1740
 
1741 1741
 		return $transaction_id;
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
 	 * @return string The IP address for the payment
1751 1751
 	 */
1752 1752
 	private function setup_ip() {
1753
-		$ip = $this->get_meta( '_give_payment_user_ip', true );
1753
+		$ip = $this->get_meta('_give_payment_user_ip', true);
1754 1754
 
1755 1755
 		return $ip;
1756 1756
 	}
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
 	 * @return int The Donor ID.
1765 1765
 	 */
1766 1766
 	private function setup_donor_id() {
1767
-		$customer_id = $this->get_meta( '_give_payment_customer_id', true );
1767
+		$customer_id = $this->get_meta('_give_payment_customer_id', true);
1768 1768
 
1769 1769
 		return $customer_id;
1770 1770
 	}
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 	 * @return int The User ID
1779 1779
 	 */
1780 1780
 	private function setup_user_id() {
1781
-		$user_id = $this->get_meta( '_give_payment_user_id', true );
1781
+		$user_id = $this->get_meta('_give_payment_user_id', true);
1782 1782
 
1783 1783
 		return $user_id;
1784 1784
 	}
@@ -1792,10 +1792,10 @@  discard block
 block discarded – undo
1792 1792
 	 * @return string The email address for the payment.
1793 1793
 	 */
1794 1794
 	private function setup_email() {
1795
-		$email = $this->get_meta( '_give_payment_user_email', true );
1795
+		$email = $this->get_meta('_give_payment_user_email', true);
1796 1796
 
1797
-		if ( empty( $email ) && $this->customer_id ) {
1798
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1797
+		if (empty($email) && $this->customer_id) {
1798
+			$email = Give()->donors->get_column('email', $this->customer_id);
1799 1799
 		}
1800 1800
 
1801 1801
 		return $email;
@@ -1815,23 +1815,23 @@  discard block
 block discarded – undo
1815 1815
 			'last_name'  => $this->last_name,
1816 1816
 		);
1817 1817
 
1818
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1818
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1819 1819
 
1820
-		if ( is_serialized( $user_info ) ) {
1821
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1822
-			if ( ! empty( $matches ) ) {
1820
+		if (is_serialized($user_info)) {
1821
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1822
+			if ( ! empty($matches)) {
1823 1823
 				$user_info = array();
1824 1824
 			}
1825 1825
 		}
1826 1826
 
1827
-		$user_info = wp_parse_args( $user_info, $defaults );
1827
+		$user_info = wp_parse_args($user_info, $defaults);
1828 1828
 
1829
-		if ( empty( $user_info ) ) {
1829
+		if (empty($user_info)) {
1830 1830
 			// Get the donor, but only if it's been created.
1831
-			$donor = new Give_Donor( $this->customer_id );
1831
+			$donor = new Give_Donor($this->customer_id);
1832 1832
 
1833
-			if ( $donor->id > 0 ) {
1834
-				$name      = explode( ' ', $donor->name, 2 );
1833
+			if ($donor->id > 0) {
1834
+				$name      = explode(' ', $donor->name, 2);
1835 1835
 				$user_info = array(
1836 1836
 					'first_name' => $name[0],
1837 1837
 					'last_name'  => $name[1],
@@ -1841,29 +1841,29 @@  discard block
 block discarded – undo
1841 1841
 			}
1842 1842
 		} else {
1843 1843
 			// Get the donor, but only if it's been created.
1844
-			$donor = new Give_Donor( $this->customer_id );
1845
-			if ( $donor->id > 0 ) {
1846
-				foreach ( $user_info as $key => $value ) {
1847
-					if ( ! empty( $value ) ) {
1844
+			$donor = new Give_Donor($this->customer_id);
1845
+			if ($donor->id > 0) {
1846
+				foreach ($user_info as $key => $value) {
1847
+					if ( ! empty($value)) {
1848 1848
 						continue;
1849 1849
 					}
1850 1850
 
1851
-					switch ( $key ) {
1851
+					switch ($key) {
1852 1852
 						case 'first_name':
1853
-							$name = explode( ' ', $donor->name, 2 );
1853
+							$name = explode(' ', $donor->name, 2);
1854 1854
 
1855
-							$user_info[ $key ] = $name[0];
1855
+							$user_info[$key] = $name[0];
1856 1856
 							break;
1857 1857
 
1858 1858
 						case 'last_name':
1859
-							$name      = explode( ' ', $donor->name, 2 );
1860
-							$last_name = ! empty( $name[1] ) ? $name[1] : '';
1859
+							$name      = explode(' ', $donor->name, 2);
1860
+							$last_name = ! empty($name[1]) ? $name[1] : '';
1861 1861
 
1862
-							$user_info[ $key ] = $last_name;
1862
+							$user_info[$key] = $last_name;
1863 1863
 							break;
1864 1864
 
1865 1865
 						case 'email':
1866
-							$user_info[ $key ] = $donor->email;
1866
+							$user_info[$key] = $donor->email;
1867 1867
 							break;
1868 1868
 					}
1869 1869
 				}
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 	 */
1885 1885
 	private function setup_address() {
1886 1886
 
1887
-		$address = ! empty( $this->payment_meta['user_info']['address'] ) ? $this->payment_meta['user_info']['address'] : array(
1887
+		$address = ! empty($this->payment_meta['user_info']['address']) ? $this->payment_meta['user_info']['address'] : array(
1888 1888
 			'line1'   => '',
1889 1889
 			'line2'   => '',
1890 1890
 			'city'    => '',
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
 	 */
1907 1907
 	private function setup_form_title() {
1908 1908
 
1909
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1909
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1910 1910
 
1911 1911
 		return $form_id;
1912 1912
 	}
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
 	 */
1922 1922
 	private function setup_form_id() {
1923 1923
 
1924
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1924
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1925 1925
 
1926 1926
 		return $form_id;
1927 1927
 	}
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
 	 * @return int The Form Price ID.
1936 1936
 	 */
1937 1937
 	private function setup_price_id() {
1938
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1938
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1939 1939
 
1940 1940
 		return $price_id;
1941 1941
 	}
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 	 * @return string The Payment Key.
1950 1950
 	 */
1951 1951
 	private function setup_payment_key() {
1952
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1952
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1953 1953
 
1954 1954
 		return $key;
1955 1955
 	}
@@ -1965,11 +1965,11 @@  discard block
 block discarded – undo
1965 1965
 	private function setup_payment_number() {
1966 1966
 		$number = $this->ID;
1967 1967
 
1968
-		if ( give_get_option( 'enable_sequential' ) ) {
1968
+		if (give_get_option('enable_sequential')) {
1969 1969
 
1970
-			$number = $this->get_meta( '_give_payment_number', true );
1970
+			$number = $this->get_meta('_give_payment_number', true);
1971 1971
 
1972
-			if ( ! $number ) {
1972
+			if ( ! $number) {
1973 1973
 
1974 1974
 				$number = $this->ID;
1975 1975
 
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 	 * @return array The payment object as an array.
1988 1988
 	 */
1989 1989
 	public function array_convert() {
1990
-		return get_object_vars( $this );
1990
+		return get_object_vars($this);
1991 1991
 	}
1992 1992
 
1993 1993
 
@@ -2000,7 +2000,7 @@  discard block
 block discarded – undo
2000 2000
 	 * @return bool
2001 2001
 	 */
2002 2002
 	public function is_completed() {
2003
-		return ( 'publish' === $this->status && $this->completed_date );
2003
+		return ('publish' === $this->status && $this->completed_date);
2004 2004
 	}
2005 2005
 
2006 2006
 	/**
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
 	 * @return string Date payment was completed.
2013 2013
 	 */
2014 2014
 	private function get_completed_date() {
2015
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
2015
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
2016 2016
 	}
2017 2017
 
2018 2018
 	/**
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
 	 * @return float Payment subtotal.
2025 2025
 	 */
2026 2026
 	private function get_subtotal() {
2027
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
2027
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
2028 2028
 	}
2029 2029
 
2030 2030
 	/**
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 	 * @return string Payment currency code.
2037 2037
 	 */
2038 2038
 	private function get_currency() {
2039
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
2039
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
2040 2040
 	}
2041 2041
 
2042 2042
 	/**
@@ -2048,7 +2048,7 @@  discard block
 block discarded – undo
2048 2048
 	 * @return string Gateway used.
2049 2049
 	 */
2050 2050
 	private function get_gateway() {
2051
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
2051
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
2052 2052
 	}
2053 2053
 
2054 2054
 	/**
@@ -2060,7 +2060,7 @@  discard block
 block discarded – undo
2060 2060
 	 * @return string Donation ID from merchant processor.
2061 2061
 	 */
2062 2062
 	private function get_transaction_id() {
2063
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
2063
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
2064 2064
 	}
2065 2065
 
2066 2066
 	/**
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 	 * @return string Payment IP address
2073 2073
 	 */
2074 2074
 	private function get_ip() {
2075
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
2075
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
2076 2076
 	}
2077 2077
 
2078 2078
 	/**
@@ -2084,7 +2084,7 @@  discard block
 block discarded – undo
2084 2084
 	 * @return int Payment donor ID.
2085 2085
 	 */
2086 2086
 	private function get_donor_id() {
2087
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
2087
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
2088 2088
 	}
2089 2089
 
2090 2090
 	/**
@@ -2096,7 +2096,7 @@  discard block
 block discarded – undo
2096 2096
 	 * @return int Payment user ID.
2097 2097
 	 */
2098 2098
 	private function get_user_id() {
2099
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
2099
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
2100 2100
 	}
2101 2101
 
2102 2102
 	/**
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
 	 * @return string Payment donor email.
2109 2109
 	 */
2110 2110
 	private function get_email() {
2111
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
2111
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
2112 2112
 	}
2113 2113
 
2114 2114
 	/**
@@ -2120,7 +2120,7 @@  discard block
 block discarded – undo
2120 2120
 	 * @return array Payment user info.
2121 2121
 	 */
2122 2122
 	private function get_user_info() {
2123
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
2123
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
2124 2124
 	}
2125 2125
 
2126 2126
 	/**
@@ -2132,7 +2132,7 @@  discard block
 block discarded – undo
2132 2132
 	 * @return array Payment billing address.
2133 2133
 	 */
2134 2134
 	private function get_address() {
2135
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2135
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2136 2136
 	}
2137 2137
 
2138 2138
 	/**
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
 	 * @return string Payment key.
2145 2145
 	 */
2146 2146
 	private function get_key() {
2147
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2147
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2148 2148
 	}
2149 2149
 
2150 2150
 	/**
@@ -2156,7 +2156,7 @@  discard block
 block discarded – undo
2156 2156
 	 * @return string Payment form id
2157 2157
 	 */
2158 2158
 	private function get_form_id() {
2159
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2159
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2160 2160
 	}
2161 2161
 
2162 2162
 	/**
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 	 * @return int|string Payment number
2169 2169
 	 */
2170 2170
 	private function get_number() {
2171
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2171
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2172 2172
 	}
2173 2173
 
2174 2174
 }
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @return static
52 52
 	 */
53 53
 	public static function get_instance() {
54
-		if ( null === static::$instance ) {
54
+		if (null === static::$instance) {
55 55
 			self::$instance = new static();
56 56
 			self::$instance->setup();
57 57
 		}
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * @since 1.8.13
67 67
 	 */
68 68
 	private function setup() {
69
-		add_filter( 'cron_schedules', array( self::$instance, '__add_schedules' ) );
70
-		add_action( 'wp', array( self::$instance, '__schedule_events' ) );
69
+		add_filter('cron_schedules', array(self::$instance, '__add_schedules'));
70
+		add_action('wp', array(self::$instance, '__schedule_events'));
71 71
 
72 72
 		// Load async event only when cron is running.
73
-		if( defined( 'DOING_CRON' ) && DOING_CRON ) {
74
-			add_action( 'init', array( self::$instance, '__load_async_events' ) );
73
+		if (defined('DOING_CRON') && DOING_CRON) {
74
+			add_action('init', array(self::$instance, '__load_async_events'));
75 75
 		}
76 76
 	}
77 77
 
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
 	 * @since 1.8.13
83 83
 	 */
84 84
 	public function __load_async_events() {
85
-		$async_events = get_option( 'give_async_events', array() );
85
+		$async_events = get_option('give_async_events', array());
86 86
 
87 87
 		// Bailout.
88
-		if ( empty( $async_events ) ) {
88
+		if (empty($async_events)) {
89 89
 			return;
90 90
 		}
91 91
 
92
-		foreach ( $async_events as $index => $event ) {
92
+		foreach ($async_events as $index => $event) {
93 93
 			// Set cron name.
94 94
 			$cron_name = "give_async_scheduled_events_{$index}";
95 95
 
96 96
 			// Setup cron.
97
-			wp_schedule_single_event( current_time( 'timestamp', 1 ), $cron_name, $event['params'] );
97
+			wp_schedule_single_event(current_time('timestamp', 1), $cron_name, $event['params']);
98 98
 
99 99
 			// Add cron action.
100
-			add_action( $cron_name, $event['callback'], 10, count( $event['params'] ) );
101
-			add_action( $cron_name, array( $this, '__delete_async_events' ), 9999, 0 );
100
+			add_action($cron_name, $event['callback'], 10, count($event['params']));
101
+			add_action($cron_name, array($this, '__delete_async_events'), 9999, 0);
102 102
 		}
103 103
 	}
104 104
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	 * @since 1.8.13
109 109
 	 */
110 110
 	public function __delete_async_events() {
111
-		$async_events    = get_option( 'give_async_events', array() );
112
-		$cron_name_parts = explode( '_', current_action() );
113
-		$cron_id         = end( $cron_name_parts );
111
+		$async_events    = get_option('give_async_events', array());
112
+		$cron_name_parts = explode('_', current_action());
113
+		$cron_id         = end($cron_name_parts);
114 114
 
115
-		if ( ! empty( $async_events[ $cron_id ] ) ) {
116
-			unset( $async_events[ $cron_id ] );
117
-			update_option( 'give_async_events', $async_events );
115
+		if ( ! empty($async_events[$cron_id])) {
116
+			unset($async_events[$cron_id]);
117
+			update_option('give_async_events', $async_events);
118 118
 		}
119 119
 	}
120 120
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @return array            An array of non-default cron schedules.
130 130
 	 */
131
-	public function __add_schedules( $schedules = array() ) {
131
+	public function __add_schedules($schedules = array()) {
132 132
 		// Adds once weekly to the existing schedules.
133 133
 		$schedules['weekly'] = array(
134 134
 			'interval' => 604800,
135
-			'display'  => __( 'Once Weekly', 'give' ),
135
+			'display'  => __('Once Weekly', 'give'),
136 136
 		);
137 137
 
138 138
 		return $schedules;
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @return void
161 161
 	 */
162 162
 	private function weekly_events() {
163
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
164
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
163
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
164
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
165 165
 		}
166 166
 	}
167 167
 
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return void
175 175
 	 */
176 176
 	private function daily_events() {
177
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
178
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
177
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
178
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
179 179
 		}
180 180
 	}
181 181
 
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return string
191 191
 	 */
192
-	public static function get_cron_action( $type = 'weekly' ) {
193
-		switch ( $type ) {
192
+	public static function get_cron_action($type = 'weekly') {
193
+		switch ($type) {
194 194
 			case 'daily':
195 195
 				$cron_action = 'give_daily_scheduled_events';
196 196
 				break;
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @param        $action
213 213
 	 * @param string $type
214 214
 	 */
215
-	private static function add_event( $action, $type = 'weekly' ) {
216
-		$cron_event = self::get_cron_action( $type );
217
-		add_action( $cron_event, $action );
215
+	private static function add_event($action, $type = 'weekly') {
216
+		$cron_event = self::get_cron_action($type);
217
+		add_action($cron_event, $action);
218 218
 	}
219 219
 
220 220
 	/**
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @param $action
227 227
 	 */
228
-	public static function add_weekly_event( $action ) {
229
-		self::add_event( $action, 'weekly' );
228
+	public static function add_weekly_event($action) {
229
+		self::add_event($action, 'weekly');
230 230
 	}
231 231
 
232 232
 	/**
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param $action
239 239
 	 */
240
-	public static function add_daily_event( $action ) {
241
-		self::add_event( $action, 'daily' );
240
+	public static function add_daily_event($action) {
241
+		self::add_event($action, 'daily');
242 242
 	}
243 243
 
244 244
 	/**
@@ -251,17 +251,17 @@  discard block
 block discarded – undo
251 251
 	 * @param string $action
252 252
 	 * @param array  $args
253 253
 	 */
254
-	public static function add_async_event( $action, $args = array() ) {
254
+	public static function add_async_event($action, $args = array()) {
255 255
 
256 256
 		// Cache async events.
257
-		$async_events             = get_option( 'give_async_events', array() );
258
-		$async_events[ uniqid() ] = array(
257
+		$async_events             = get_option('give_async_events', array());
258
+		$async_events[uniqid()] = array(
259 259
 			'callback' => $action,
260 260
 			'params'   => $args,
261 261
 		);
262 262
 
263 263
 
264
-		update_option( 'give_async_events', $async_events );
264
+		update_option('give_async_events', $async_events);
265 265
 	}
266 266
 }
267 267
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -62,50 +62,50 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return bool If the gravatar exists or not
64 64
 	 */
65
-	public function validate_gravatar( $id_or_email ) {
65
+	public function validate_gravatar($id_or_email) {
66 66
 		//id or email code borrowed from wp-includes/pluggable.php
67 67
 		$email = '';
68
-		if ( is_numeric( $id_or_email ) ) {
68
+		if (is_numeric($id_or_email)) {
69 69
 			$id   = (int) $id_or_email;
70
-			$user = get_userdata( $id );
71
-			if ( $user ) {
70
+			$user = get_userdata($id);
71
+			if ($user) {
72 72
 				$email = $user->user_email;
73 73
 			}
74
-		} elseif ( is_object( $id_or_email ) ) {
74
+		} elseif (is_object($id_or_email)) {
75 75
 			// No avatar for pingbacks or trackbacks
76
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
77
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
76
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
77
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
78 78
 				return false;
79 79
 			}
80 80
 
81
-			if ( ! empty( $id_or_email->user_id ) ) {
81
+			if ( ! empty($id_or_email->user_id)) {
82 82
 				$id   = (int) $id_or_email->user_id;
83
-				$user = get_userdata( $id );
84
-				if ( $user ) {
83
+				$user = get_userdata($id);
84
+				if ($user) {
85 85
 					$email = $user->user_email;
86 86
 				}
87
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
87
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
88 88
 				$email = $id_or_email->comment_author_email;
89 89
 			}
90 90
 		} else {
91 91
 			$email = $id_or_email;
92 92
 		}
93 93
 
94
-		$hashkey = md5( strtolower( trim( $email ) ) );
95
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
94
+		$hashkey = md5(strtolower(trim($email)));
95
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
96 96
 
97
-		$data = wp_cache_get( $hashkey );
98
-		if ( false === $data ) {
99
-			$response = wp_remote_head( $uri );
100
-			if ( is_wp_error( $response ) ) {
97
+		$data = wp_cache_get($hashkey);
98
+		if (false === $data) {
99
+			$response = wp_remote_head($uri);
100
+			if (is_wp_error($response)) {
101 101
 				$data = 'not200';
102 102
 			} else {
103 103
 				$data = $response['response']['code'];
104 104
 			}
105
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
105
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
106 106
 
107 107
 		}
108
-		if ( $data == '200' ) {
108
+		if ($data == '200') {
109 109
 			return true;
110 110
 		} else {
111 111
 			return false;
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return array        IDs if logs, false otherwise
124 124
 	 */
125
-	public function get_log_ids( $form_id = '' ) {
125
+	public function get_log_ids($form_id = '') {
126 126
 
127 127
 		// get Give_Logging class
128 128
 		global $give_logs;
129 129
 
130 130
 		// get log for this form
131
-		$logs = $give_logs->get_logs( $form_id );
131
+		$logs = $give_logs->get_logs($form_id);
132 132
 
133
-		if ( $logs ) {
133
+		if ($logs) {
134 134
 			$log_ids = array();
135 135
 
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,51 +155,51 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		$give_options = give_get_settings();
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = give_get_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have donated more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
178
+				$email = give_get_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = give_get_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = give_get_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			$unique_ids = array();
191 191
 
192 192
 			// strip duplicate emails
193
-			$unique_emails = array_unique( $unique_emails );
193
+			$unique_emails = array_unique($unique_emails);
194 194
 
195 195
 			// convert the unique IDs back into simple array
196
-			foreach ( $unique_emails as $id => $email ) {
196
+			foreach ($unique_emails as $id => $email) {
197 197
 				$unique_ids[] = $id;
198 198
 			}
199 199
 
200 200
 			// randomize the payment IDs if enabled
201
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
202
-				shuffle( $unique_ids );
201
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
202
+				shuffle($unique_ids);
203 203
 			}
204 204
 
205 205
 			// return our unique IDs
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function gravatars( $form_id = false, $title = '' ) {
223
+	public function gravatars($form_id = false, $title = '') {
224 224
 
225 225
 		// unique $payment_ids 
226
-		$payment_ids = $this->get_payment_ids( $form_id );
226
+		$payment_ids = $this->get_payment_ids($form_id);
227 227
 
228 228
 		$give_options = give_get_settings();
229 229
 
230 230
 		// return if no ID
231
-		if ( ! $form_id ) {
231
+		if ( ! $form_id) {
232 232
 			return;
233 233
 		}
234 234
 
235 235
 		// minimum amount of donations before showing gravatars
236 236
 		// if the number of items in array is not greater or equal to the number specified, then exit
237
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
238
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
237
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
238
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
239 239
 				return;
240 240
 			}
241 241
 		}
@@ -246,28 +246,28 @@  discard block
 block discarded – undo
246 246
 		echo '<div id="give-purchase-gravatars">';
247 247
 
248 248
 
249
-		if ( isset ( $title ) ) {
249
+		if (isset ($title)) {
250 250
 
251
-			if ( $title ) {
252
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
253
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
254
-				echo apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' );
251
+			if ($title) {
252
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
253
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
254
+				echo apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>');
255 255
 			}
256 256
 
257 257
 		}
258 258
 		echo '<ul class="give-purchase-gravatars-list">';
259 259
 		$i = 0;
260 260
 
261
-		if ( $payment_ids ) {
262
-			foreach ( $payment_ids as $id ) {
261
+		if ($payment_ids) {
262
+			foreach ($payment_ids as $id) {
263 263
 
264 264
 				// Give saves a blank option even when the control is turned off, hence the extra check
265
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
265
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
266 266
 					continue;
267 267
 				}
268 268
 
269 269
 				// get the payment meta
270
-				$payment_meta = give_get_meta( $id, '_give_payment_meta', true );
270
+				$payment_meta = give_get_meta($id, '_give_payment_meta', true);
271 271
 
272 272
 				$user_info = $payment_meta['user_info'];
273 273
 
@@ -275,21 +275,21 @@  discard block
 block discarded – undo
275 275
 				$name = $user_info['first_name'];
276 276
 
277 277
 				// get donor's email
278
-				$email = give_get_meta( $id, '_give_payment_user_email', true );
278
+				$email = give_get_meta($id, '_give_payment_user_email', true);
279 279
 
280 280
 				// set gravatar size and provide filter
281
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
281
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
282 282
 
283 283
 				// default image
284
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
284
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
285 285
 
286 286
 				// assemble output
287 287
 				$output .= '<li>';
288 288
 
289
-				$output .= get_avatar( $email, $size, $default_image, $name );
289
+				$output .= get_avatar($email, $size, $default_image, $name);
290 290
 				$output .= '</li>';
291 291
 
292
-				$i ++;
292
+				$i++;
293 293
 
294 294
 			} // end foreach
295 295
 		}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 		echo '</ul>';
299 299
 		echo '</div>';
300 300
 
301
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
301
+		return apply_filters('give_donors_gravatars', ob_get_clean());
302 302
 	}
303 303
 
304 304
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * @return void
311 311
 	 */
312 312
 	public function register_widget() {
313
-		register_widget( 'Give_Donors_Gravatars_Widget' );
313
+		register_widget('Give_Donors_Gravatars_Widget');
314 314
 	}
315 315
 
316 316
 	/**
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @return string
326 326
 	 */
327
-	public function shortcode( $atts, $content = null ) {
327
+	public function shortcode($atts, $content = null) {
328 328
 
329
-		$atts = shortcode_atts( array(
329
+		$atts = shortcode_atts(array(
330 330
 			'id'    => '',
331 331
 			'title' => ''
332
-		), $atts, 'give_donors_gravatars' );
332
+		), $atts, 'give_donors_gravatars');
333 333
 
334 334
 		// if no ID is passed on single give_forms pages, get the correct ID
335
-		if ( is_singular( 'give_forms' ) ) {
335
+		if (is_singular('give_forms')) {
336 336
 			$id = get_the_ID();
337 337
 		}
338 338
 
339
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
339
+		$content = $this->gravatars($atts['id'], $atts['title']);
340 340
 
341 341
 		return $content;
342 342
 
@@ -352,56 +352,56 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @return array           Gravatar settings.
354 354
 	 */
355
-	public function settings( $settings ) {
355
+	public function settings($settings) {
356 356
 
357 357
 		$give_gravatar_settings = array(
358 358
 			array(
359
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
359
+				'name' => esc_html__('Donator Gravatars', 'give'),
360 360
 				'desc' => '<hr>',
361 361
 				'id'   => 'give_title',
362 362
 				'type' => 'give_title'
363 363
 			),
364 364
 			array(
365
-				'name' => esc_html__( 'Heading', 'give' ),
366
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
365
+				'name' => esc_html__('Heading', 'give'),
366
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
367 367
 				'type' => 'text',
368 368
 				'id'   => 'give_donors_gravatars_heading'
369 369
 			),
370 370
 			array(
371
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
372
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
371
+				'name'    => esc_html__('Gravatar Size', 'give'),
372
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
373 373
 				'type'    => 'text_small',
374 374
 				'id'      => 'give_donors_gravatars_gravatar_size',
375 375
 				'default' => '64'
376 376
 			),
377 377
 			array(
378
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
379
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
378
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
379
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
380 380
 				'type' => 'text_small',
381 381
 				'id'   => 'give_donors_gravatars_min_purchases_required',
382 382
 			),
383 383
 			array(
384
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
385
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
384
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
385
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
386 386
 				'type'    => 'text',
387 387
 				'id'      => 'give_donors_gravatars_maximum_number',
388 388
 				'default' => '20',
389 389
 			),
390 390
 			array(
391
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
392
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
391
+				'name' => esc_html__('Gravatar Visibility', 'give'),
392
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
393 393
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
394 394
 				'type' => 'checkbox',
395 395
 			),
396 396
 			array(
397
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
398
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
397
+				'name' => esc_html__('Randomize Gravatars', 'give'),
398
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
399 399
 				'id'   => 'give_donors_gravatars_random_gravatars',
400 400
 				'type' => 'checkbox',
401 401
 			),
402 402
 		);
403 403
 
404
-		return array_merge( $settings, $give_gravatar_settings );
404
+		return array_merge($settings, $give_gravatar_settings);
405 405
 	}
406 406
 
407 407
 }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		// widget settings
428 428
 		$widget_ops = array(
429 429
 			'classname'   => 'give-donors-gravatars',
430
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
430
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
431 431
 		);
432 432
 
433 433
 		// widget control settings
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 		// create the widget
441 441
 		parent::__construct(
442 442
 			'give_donors_gravatars_widget',
443
-			esc_html__( 'Give Donors Gravatars', 'give' ),
443
+			esc_html__('Give Donors Gravatars', 'give'),
444 444
 			$widget_ops,
445 445
 			$control_ops
446 446
 		);
@@ -460,29 +460,29 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return void
462 462
 	 */
463
-	public function widget( $args, $instance ) {
463
+	public function widget($args, $instance) {
464 464
 
465 465
 		//@TODO: Don't extract it!!!
466
-		extract( $args );
466
+		extract($args);
467 467
 
468
-		if ( ! is_singular( 'give_forms' ) ) {
468
+		if ( ! is_singular('give_forms')) {
469 469
 			return;
470 470
 		}
471 471
 
472 472
 		// Variables from widget settings
473
-		$title = apply_filters( 'widget_title', $instance['title'] );
473
+		$title = apply_filters('widget_title', $instance['title']);
474 474
 
475 475
 		// Used by themes. Opens the widget
476 476
 		echo $before_widget;
477 477
 
478 478
 		// Display the widget title
479
-		if ( $title ) {
480
-			echo $before_title . $title . $after_title;
479
+		if ($title) {
480
+			echo $before_title.$title.$after_title;
481 481
 		}
482 482
 
483 483
 		$gravatars = new Give_Donors_Gravatars();
484 484
 
485
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
485
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
486 486
 
487 487
 		// Used by themes. Closes the widget
488 488
 		echo $after_widget;
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @return array Updated settings to save.
504 504
 	 */
505
-	public function update( $new_instance, $old_instance ) {
505
+	public function update($new_instance, $old_instance) {
506 506
 
507 507
 		$instance = $old_instance;
508 508
 
509
-		$instance['title'] = strip_tags( $new_instance['title'] );
509
+		$instance['title'] = strip_tags($new_instance['title']);
510 510
 
511 511
 		return $instance;
512 512
 
@@ -524,19 +524,19 @@  discard block
 block discarded – undo
524 524
 	 *
525 525
 	 * @return void
526 526
 	 */
527
-	public function form( $instance ) {
527
+	public function form($instance) {
528 528
 
529 529
 		// Set up some default widget settings.
530 530
 		$defaults = array(
531 531
 			'title' => '',
532 532
 		);
533 533
 
534
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
534
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
535 535
 
536 536
 		<!-- Title -->
537 537
 		<p>
538
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
539
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
538
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
539
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
540 540
 		</p>
541 541
 
542 542
 		<?php
Please login to merge, or discard this patch.
includes/template-functions.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @return string
22 22
  */
23 23
 function give_get_templates_dir() {
24
-	return GIVE_PLUGIN_DIR . 'templates';
24
+	return GIVE_PLUGIN_DIR.'templates';
25 25
 }
26 26
 
27 27
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @return string
32 32
  */
33 33
 function give_get_templates_url() {
34
-	return GIVE_PLUGIN_URL . 'templates';
34
+	return GIVE_PLUGIN_URL.'templates';
35 35
 }
36 36
 
37 37
 /**
@@ -44,24 +44,24 @@  discard block
 block discarded – undo
44 44
  * @param string $template_path Template file path. Default is empty.
45 45
  * @param string $default_path  Default path. Default is empty.
46 46
  */
47
-function give_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
48
-	if ( ! empty( $args ) && is_array( $args ) ) {
49
-		extract( $args );
47
+function give_get_template($template_name, $args = array(), $template_path = '', $default_path = '') {
48
+	if ( ! empty($args) && is_array($args)) {
49
+		extract($args);
50 50
 	}
51 51
 
52
-	$template_names = array( $template_name . '.php' );
52
+	$template_names = array($template_name.'.php');
53 53
 
54
-	$located = give_locate_template( $template_names, $template_path, $default_path );
54
+	$located = give_locate_template($template_names, $template_path, $default_path);
55 55
 
56
-	if ( ! file_exists( $located ) ) {
56
+	if ( ! file_exists($located)) {
57 57
 		/* translators: %s: the template */
58
-		Give()->notices->print_frontend_notice( sprintf( __( 'The %s template was not found.', 'give' ), $located ), true );
58
+		Give()->notices->print_frontend_notice(sprintf(__('The %s template was not found.', 'give'), $located), true);
59 59
 
60 60
 		return;
61 61
 	}
62 62
 
63 63
 	// Allow 3rd party plugin filter template file from their plugin.
64
-	$located = apply_filters( 'give_get_template', $located, $template_name, $args, $template_path, $default_path );
64
+	$located = apply_filters('give_get_template', $located, $template_name, $args, $template_path, $default_path);
65 65
 
66 66
 	/**
67 67
 	 * Fires in give template, before the file is included.
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 * @param string $located       Template file filter by 3rd party plugin.
76 76
 	 * @param array  $args          Passed arguments.
77 77
 	 */
78
-	do_action( 'give_before_template_part', $template_name, $template_path, $located, $args );
78
+	do_action('give_before_template_part', $template_name, $template_path, $located, $args);
79 79
 
80
-	include( $located );
80
+	include($located);
81 81
 
82 82
 	/**
83 83
 	 * Fires in give template, after the file is included.
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param string $located       Template file filter by 3rd party plugin.
92 92
 	 * @param array  $args          Passed arguments.
93 93
 	 */
94
-	do_action( 'give_after_template_part', $template_name, $template_path, $located, $args );
94
+	do_action('give_after_template_part', $template_name, $template_path, $located, $args);
95 95
 }
96 96
 
97 97
 /**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return string
109 109
  */
110
-function give_get_template_part( $slug, $name = null, $load = true ) {
110
+function give_get_template_part($slug, $name = null, $load = true) {
111 111
 
112 112
 	/**
113 113
 	 * Fires in give template part, before the template part is retrieved.
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 * @param string $slug Template part file slug {slug}.php.
120 120
 	 * @param string $name Template part file name {slug}-{name}.php.
121 121
 	 */
122
-	do_action( "get_template_part_{$slug}", $slug, $name );
122
+	do_action("get_template_part_{$slug}", $slug, $name);
123 123
 
124 124
 	// Setup possible parts
125 125
 	$templates = array();
126
-	if ( isset( $name ) ) {
127
-		$templates[] = $slug . '-' . $name . '.php';
126
+	if (isset($name)) {
127
+		$templates[] = $slug.'-'.$name.'.php';
128 128
 	}
129
-	$templates[] = $slug . '.php';
129
+	$templates[] = $slug.'.php';
130 130
 
131 131
 	// Allow template parts to be filtered
132
-	$templates = apply_filters( 'give_get_template_part', $templates, $slug, $name );
132
+	$templates = apply_filters('give_get_template_part', $templates, $slug, $name);
133 133
 
134 134
 	// Return the part that is found
135
-	return give_locate_template( $templates, $load, false );
135
+	return give_locate_template($templates, $load, false);
136 136
 }
137 137
 
138 138
 /**
@@ -153,37 +153,37 @@  discard block
 block discarded – undo
153 153
  *
154 154
  * @return string The template filename if one is located.
155 155
  */
156
-function give_locate_template( $template_names, $load = false, $require_once = true ) {
156
+function give_locate_template($template_names, $load = false, $require_once = true) {
157 157
 	// No file found yet
158 158
 	$located = false;
159 159
 
160 160
 	// Try to find a template file
161
-	foreach ( (array) $template_names as $template_name ) {
161
+	foreach ((array) $template_names as $template_name) {
162 162
 
163 163
 		// Continue if template is empty
164
-		if ( empty( $template_name ) ) {
164
+		if (empty($template_name)) {
165 165
 			continue;
166 166
 		}
167 167
 
168 168
 		// Trim off any slashes from the template name
169
-		$template_name = ltrim( $template_name, '/' );
169
+		$template_name = ltrim($template_name, '/');
170 170
 
171 171
 		// try locating this template file by looping through the template paths
172
-		foreach ( give_get_theme_template_paths() as $template_path ) {
172
+		foreach (give_get_theme_template_paths() as $template_path) {
173 173
 
174
-			if ( file_exists( $template_path . $template_name ) ) {
175
-				$located = $template_path . $template_name;
174
+			if (file_exists($template_path.$template_name)) {
175
+				$located = $template_path.$template_name;
176 176
 				break;
177 177
 			}
178 178
 		}
179 179
 
180
-		if ( $located ) {
180
+		if ($located) {
181 181
 			break;
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( ( true == $load ) && ! empty( $located ) ) {
186
-		load_template( $located, $require_once );
185
+	if ((true == $load) && ! empty($located)) {
186
+		load_template($located, $require_once);
187 187
 	}
188 188
 
189 189
 	return $located;
@@ -200,17 +200,17 @@  discard block
 block discarded – undo
200 200
 	$template_dir = give_get_theme_template_dir_name();
201 201
 
202 202
 	$file_paths = array(
203
-		1   => trailingslashit( get_stylesheet_directory() ) . $template_dir,
204
-		10  => trailingslashit( get_template_directory() ) . $template_dir,
203
+		1   => trailingslashit(get_stylesheet_directory()).$template_dir,
204
+		10  => trailingslashit(get_template_directory()).$template_dir,
205 205
 		100 => give_get_templates_dir(),
206 206
 	);
207 207
 
208
-	$file_paths = apply_filters( 'give_template_paths', $file_paths );
208
+	$file_paths = apply_filters('give_template_paths', $file_paths);
209 209
 
210 210
 	// sort the file paths based on priority
211
-	ksort( $file_paths, SORT_NUMERIC );
211
+	ksort($file_paths, SORT_NUMERIC);
212 212
 
213
-	return array_map( 'trailingslashit', $file_paths );
213
+	return array_map('trailingslashit', $file_paths);
214 214
 }
215 215
 
216 216
 /**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
  * @return string
223 223
  */
224 224
 function give_get_theme_template_dir_name() {
225
-	return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) );
225
+	return trailingslashit(apply_filters('give_templates_dir', 'give'));
226 226
 }
227 227
 
228 228
 /**
@@ -232,10 +232,10 @@  discard block
 block discarded – undo
232 232
  * @return void
233 233
  */
234 234
 function give_version_in_header() {
235
-	echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n";
235
+	echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n";
236 236
 }
237 237
 
238
-add_action( 'wp_head', 'give_version_in_header' );
238
+add_action('wp_head', 'give_version_in_header');
239 239
 
240 240
 /**
241 241
  * Determines if we're currently on the Donations History page.
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function give_is_donation_history_page() {
247 247
 
248
-	$ret = is_page( give_get_option( 'history_page' ) );
248
+	$ret = is_page(give_get_option('history_page'));
249 249
 
250
-	return apply_filters( 'give_is_donation_history_page', $ret );
250
+	return apply_filters('give_is_donation_history_page', $ret);
251 251
 }
252 252
 
253 253
 /**
@@ -259,25 +259,25 @@  discard block
 block discarded – undo
259 259
  *
260 260
  * @return array Modified array of classes
261 261
  */
262
-function give_add_body_classes( $class ) {
262
+function give_add_body_classes($class) {
263 263
 	$classes = (array) $class;
264 264
 
265
-	if ( give_is_success_page() ) {
265
+	if (give_is_success_page()) {
266 266
 		$classes[] = 'give-success';
267 267
 		$classes[] = 'give-page';
268 268
 	}
269 269
 
270
-	if ( give_is_failed_transaction_page() ) {
270
+	if (give_is_failed_transaction_page()) {
271 271
 		$classes[] = 'give-failed-transaction';
272 272
 		$classes[] = 'give-page';
273 273
 	}
274 274
 
275
-	if ( give_is_donation_history_page() ) {
275
+	if (give_is_donation_history_page()) {
276 276
 		$classes[] = 'give-donation-history';
277 277
 		$classes[] = 'give-page';
278 278
 	}
279 279
 
280
-	if ( give_is_test_mode() ) {
280
+	if (give_is_test_mode()) {
281 281
 		$classes[] = 'give-test-mode';
282 282
 		$classes[] = 'give-page';
283 283
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	/* @var WP_Theme $current_theme */
287 287
 	$current_theme = wp_get_theme();
288 288
 
289
-	switch ( $current_theme->get_template() ) {
289
+	switch ($current_theme->get_template()) {
290 290
 
291 291
 		case 'Divi':
292 292
 			$classes[] = 'give-divi';
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 	}
305 305
 
306
-	return array_unique( $classes );
306
+	return array_unique($classes);
307 307
 }
308 308
 
309
-add_filter( 'body_class', 'give_add_body_classes' );
309
+add_filter('body_class', 'give_add_body_classes');
310 310
 
311 311
 
312 312
 /**
@@ -322,22 +322,22 @@  discard block
 block discarded – undo
322 322
  *
323 323
  * @return array
324 324
  */
325
-function give_add_post_class( $classes, $class = '', $post_id = '' ) {
326
-	if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) {
325
+function give_add_post_class($classes, $class = '', $post_id = '') {
326
+	if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) {
327 327
 		return $classes;
328 328
 	}
329 329
 
330 330
 	//@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc).
331 331
 
332
-	if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) {
333
-		unset( $classes[ $key ] );
332
+	if (false !== ($key = array_search('hentry', $classes))) {
333
+		unset($classes[$key]);
334 334
 	}
335 335
 
336 336
 	return $classes;
337 337
 }
338 338
 
339 339
 
340
-add_filter( 'post_class', 'give_add_post_class', 20, 3 );
340
+add_filter('post_class', 'give_add_post_class', 20, 3);
341 341
 
342 342
 /**
343 343
  * Get the placeholder image URL for forms etc
@@ -347,74 +347,74 @@  discard block
 block discarded – undo
347 347
  */
348 348
 function give_get_placeholder_img_src() {
349 349
 
350
-	$placeholder_url = '//placehold.it/600x600&text=' . urlencode( esc_attr__( 'Give Placeholder Image', 'give' ) );
350
+	$placeholder_url = '//placehold.it/600x600&text='.urlencode(esc_attr__('Give Placeholder Image', 'give'));
351 351
 
352
-	return apply_filters( 'give_placeholder_img_src', $placeholder_url );
352
+	return apply_filters('give_placeholder_img_src', $placeholder_url);
353 353
 }
354 354
 
355 355
 
356 356
 /**
357 357
  * Global
358 358
  */
359
-if ( ! function_exists( 'give_output_content_wrapper' ) ) {
359
+if ( ! function_exists('give_output_content_wrapper')) {
360 360
 
361 361
 	/**
362 362
 	 * Output the start of the page wrapper.
363 363
 	 */
364 364
 	function give_output_content_wrapper() {
365
-		give_get_template_part( 'global/wrapper-start' );
365
+		give_get_template_part('global/wrapper-start');
366 366
 	}
367 367
 }
368
-if ( ! function_exists( 'give_output_content_wrapper_end' ) ) {
368
+if ( ! function_exists('give_output_content_wrapper_end')) {
369 369
 
370 370
 	/**
371 371
 	 * Output the end of the page wrapper.
372 372
 	 */
373 373
 	function give_output_content_wrapper_end() {
374
-		give_get_template_part( 'global/wrapper-end' );
374
+		give_get_template_part('global/wrapper-end');
375 375
 	}
376 376
 }
377 377
 
378 378
 /**
379 379
  * Single Give Form
380 380
  */
381
-if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) {
381
+if ( ! function_exists('give_left_sidebar_pre_wrap')) {
382 382
 	function give_left_sidebar_pre_wrap() {
383
-		echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' );
383
+		echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">');
384 384
 	}
385 385
 }
386 386
 
387
-if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) {
387
+if ( ! function_exists('give_left_sidebar_post_wrap')) {
388 388
 	function give_left_sidebar_post_wrap() {
389
-		echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' );
389
+		echo apply_filters('give_left_sidebar_post_wrap', '</div>');
390 390
 	}
391 391
 }
392 392
 
393
-if ( ! function_exists( 'give_get_forms_sidebar' ) ) {
393
+if ( ! function_exists('give_get_forms_sidebar')) {
394 394
 	function give_get_forms_sidebar() {
395
-		give_get_template_part( 'single-give-form/sidebar' );
395
+		give_get_template_part('single-give-form/sidebar');
396 396
 	}
397 397
 }
398 398
 
399
-if ( ! function_exists( 'give_show_form_images' ) ) {
399
+if ( ! function_exists('give_show_form_images')) {
400 400
 
401 401
 	/**
402 402
 	 * Output the donation form featured image.
403 403
 	 */
404 404
 	function give_show_form_images() {
405
-		if ( give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
406
-			give_get_template_part( 'single-give-form/featured-image' );
405
+		if (give_is_setting_enabled(give_get_option('form_featured_img'))) {
406
+			give_get_template_part('single-give-form/featured-image');
407 407
 		}
408 408
 	}
409 409
 }
410 410
 
411
-if ( ! function_exists( 'give_template_single_title' ) ) {
411
+if ( ! function_exists('give_template_single_title')) {
412 412
 
413 413
 	/**
414 414
 	 * Output the form title.
415 415
 	 */
416 416
 	function give_template_single_title() {
417
-		give_get_template_part( 'single-give-form/title' );
417
+		give_get_template_part('single-give-form/title');
418 418
 	}
419 419
 }
420 420
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  * Conditional Functions
423 423
  */
424 424
 
425
-if ( ! function_exists( 'is_give_form' ) ) {
425
+if ( ! function_exists('is_give_form')) {
426 426
 
427 427
 	/**
428 428
 	 * is_give_form
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
 	 * @return bool
435 435
 	 */
436 436
 	function is_give_form() {
437
-		return is_singular( array( 'give_form' ) );
437
+		return is_singular(array('give_form'));
438 438
 	}
439 439
 }
440 440
 
441
-if ( ! function_exists( 'is_give_category' ) ) {
441
+if ( ! function_exists('is_give_category')) {
442 442
 
443 443
 	/**
444 444
 	 * is_give_category
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return bool
455 455
 	 */
456
-	function is_give_category( $term = '' ) {
457
-		return is_tax( 'give_forms_category', $term );
456
+	function is_give_category($term = '') {
457
+		return is_tax('give_forms_category', $term);
458 458
 	}
459 459
 }
460 460
 
461
-if ( ! function_exists( 'is_give_tag' ) ) {
461
+if ( ! function_exists('is_give_tag')) {
462 462
 
463 463
 	/**
464 464
 	 * is_give_tag
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
 	 *
474 474
 	 * @return bool
475 475
 	 */
476
-	function is_give_tag( $term = '' ) {
477
-		return is_tax( 'give_forms_tag', $term );
476
+	function is_give_tag($term = '') {
477
+		return is_tax('give_forms_tag', $term);
478 478
 	}
479 479
 }
480 480
 
481
-if ( ! function_exists( 'is_give_taxonomy' ) ) {
481
+if ( ! function_exists('is_give_taxonomy')) {
482 482
 
483 483
 	/**
484 484
 	 * is_give_taxonomy
@@ -490,6 +490,6 @@  discard block
 block discarded – undo
490 490
 	 * @return bool
491 491
 	 */
492 492
 	function is_give_taxonomy() {
493
-		return is_tax( get_object_taxonomies( 'give_form' ) );
493
+		return is_tax(get_object_taxonomies('give_form'));
494 494
 	}
495 495
 }
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type');
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
 	Give()->roles->remove_caps();
74 74
 
75 75
 	// Delete the Roles.
76
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker', 'give_donor' );
77
-	foreach ( $give_roles as $role ) {
78
-		remove_role( $role );
76
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker', 'give_donor');
77
+	foreach ($give_roles as $role) {
78
+		remove_role($role);
79 79
 	}
80 80
 
81 81
 	// Remove all database tables.
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
84
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
84
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
85 85
 
86 86
 	// Cleanup Cron Events.
87
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
88
-	wp_clear_scheduled_hook( 'give_weekly_scheduled_events' );
89
-	wp_clear_scheduled_hook( 'give_daily_cron' );
90
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
87
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
88
+	wp_clear_scheduled_hook('give_weekly_scheduled_events');
89
+	wp_clear_scheduled_hook('give_daily_cron');
90
+	wp_clear_scheduled_hook('give_weekly_cron');
91 91
 
92 92
 	// Get all options.
93 93
 	$give_option_names = $wpdb->get_col(
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 		)
98 98
 	);
99 99
 
100
-	if ( ! empty( $give_option_names ) ) {
100
+	if ( ! empty($give_option_names)) {
101 101
 		// Convert option name to transient or option name.
102 102
 		$new_give_option_names = array();
103 103
 
104 104
 		// Delete all the Plugin Options.
105
-		foreach ( $give_option_names as $option ) {
106
-			if ( false !== strpos( $option, 'give_cache' ) ) {
107
-				Give_Cache::delete( $option );
105
+		foreach ($give_option_names as $option) {
106
+			if (false !== strpos($option, 'give_cache')) {
107
+				Give_Cache::delete($option);
108 108
 			} else {
109
-				delete_option( $option );
109
+				delete_option($option);
110 110
 			}
111 111
 		}
112 112
 	}
Please login to merge, or discard this patch.
includes/admin/reports/class-give-graph.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	 * @param array $_data
82 82
 	 * @param array $options
83 83
 	 */
84
-	public function __construct( $_data, $options = array() ) {
84
+	public function __construct($_data, $options = array()) {
85 85
 
86
-		$this->data      = $_data;
86
+		$this->data = $_data;
87 87
 
88 88
 		// Generate unique ID
89
-		$this->id = md5( rand() );
89
+		$this->id = md5(rand());
90 90
 
91 91
 		// Setup default options;
92
-		$this->options = apply_filters( 'give_graph_args', array(
92
+		$this->options = apply_filters('give_graph_args', array(
93 93
 			'y_mode'          => null,
94 94
 			'x_mode'          => null,
95 95
 			'y_decimals'      => 0,
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			'lines'           => false,
108 108
 			'points'          => true,
109 109
 			'dataType'        => array()
110
-		) );
110
+		));
111 111
 
112
-		$this->options = wp_parse_args( $options, $this->options );
112
+		$this->options = wp_parse_args($options, $this->options);
113 113
 	}
114 114
 
115 115
 	/**
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.0
122 122
 	 */
123
-	public function set( $key, $value ) {
124
-		$this->options[ $key ] = $value;
123
+	public function set($key, $value) {
124
+		$this->options[$key] = $value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @since 1.0
133 133
 	 */
134
-	public function get( $key ) {
135
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
134
+	public function get($key) {
135
+		return isset($this->options[$key]) ? $this->options[$key] : false;
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @since 1.0
142 142
 	 */
143 143
 	public function get_data() {
144
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
144
+		return apply_filters('give_get_graph_data', $this->data, $this);
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function load_scripts() {
153 153
 		// Use minified libraries if SCRIPT_DEBUG is turned off
154
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
154
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
155 155
 
156
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
157
-		wp_enqueue_script( 'jquery-flot-orderbars' );
156
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
157
+		wp_enqueue_script('jquery-flot-orderbars');
158 158
 
159
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
160
-		wp_enqueue_script( 'jquery-flot-time' );
159
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
160
+		wp_enqueue_script('jquery-flot-time');
161 161
 
162
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
163
-		wp_enqueue_script( 'jquery-flot-resize' );
162
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
163
+		wp_enqueue_script('jquery-flot-resize');
164 164
 
165
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
166
-		wp_enqueue_script( 'jquery-flot' );
165
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
166
+		wp_enqueue_script('jquery-flot');
167 167
 
168 168
 	}
169 169
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 					[
191 191
 						<?php
192 192
 							$order = 0;
193
-							foreach( $this->get_data() as $label => $data ) :
193
+							foreach ($this->get_data() as $label => $data) :
194 194
 						?>
195 195
 						{
196
-							label : "<?php echo esc_attr( $label ); ?>",
197
-							id    : "<?php echo sanitize_key( $label ); ?>",
198
-							dataType  : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>',
196
+							label : "<?php echo esc_attr($label); ?>",
197
+							id    : "<?php echo sanitize_key($label); ?>",
198
+							dataType  : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>',
199 199
 							// data format is: [ point on x, value on y ]
200
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
200
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
201 201
 							points: {
202 202
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
203 203
 							},
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 								fill     : true,
213 213
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
214 214
 							},
215
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
215
+							<?php if ($this->options['multiple_y_axes']) : ?>
216 216
 							yaxis : <?php echo $yaxis_count; ?>
217 217
 							<?php endif; ?>
218 218
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 						grid: {
227 227
 							show           : true,
228 228
 							aboveData      : false,
229
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
230
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
231
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
232
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
229
+							color          : "<?php echo $this->options['color']; ?>",
230
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
231
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
232
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
233 233
 							clickable      : false,
234 234
 							hoverable      : true
235 235
 						},
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 							mode        : "<?php echo $this->options['x_mode']; ?>",
241 241
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
242 242
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
243
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
243
+							<?php if ($this->options['x_mode'] != 'time') : ?>
244 244
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
245 245
 							<?php endif; ?>
246 246
 						},
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 							min         : 0,
250 250
 							mode        : "<?php echo $this->options['y_mode']; ?>",
251 251
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
252
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
252
+							<?php if ($this->options['y_mode'] != 'time') : ?>
253 253
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>,
254 254
 							<?php endif; ?>
255 255
 							tickFormatter: function(val) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Graph $this Graph object.
325 325
 		 */
326
-		do_action( 'give_before_graph', $this );
326
+		do_action('give_before_graph', $this);
327 327
 
328 328
 		// Build the graph.
329 329
 		echo $this->build_graph();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @param Give_Graph $this Graph object.
337 337
 		 */
338
-		do_action( 'give_after_graph', $this );
338
+		do_action('give_after_graph', $this);
339 339
 	}
340 340
 
341 341
 }
Please login to merge, or discard this patch.