Test Failed
Push — master ( 553162...c86db0 )
by Devin
03:45
created
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/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +48 added lines, -48 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
 
@@ -53,49 +53,49 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function get_data() {
55 55
 
56
-		if ( $this->step == 1 ) {
57
-			$this->delete_data( 'give_temp_recount_earnings' );
56
+		if ($this->step == 1) {
57
+			$this->delete_data('give_temp_recount_earnings');
58 58
 		}
59 59
 
60
-		$total = get_option( 'give_temp_recount_earnings', false );
60
+		$total = get_option('give_temp_recount_earnings', false);
61 61
 
62
-		if ( false === $total ) {
62
+		if (false === $total) {
63 63
 			$total = (float) 0;
64
-			$this->store_data( 'give_temp_recount_earnings', $total );
64
+			$this->store_data('give_temp_recount_earnings', $total);
65 65
 		}
66 66
 
67
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
67
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
68 68
 
69
-		$args = apply_filters( 'give_recount_earnings_args', array(
69
+		$args = apply_filters('give_recount_earnings_args', array(
70 70
 			'number' => $this->per_step,
71 71
 			'page'   => $this->step,
72 72
 			'status' => $accepted_statuses,
73 73
 			'fields' => 'ids'
74
-		) );
74
+		));
75 75
 
76
-		$payments = give_get_payments( $args );
76
+		$payments = give_get_payments($args);
77 77
 
78
-		if ( ! empty( $payments ) ) {
78
+		if ( ! empty($payments)) {
79 79
 
80
-			foreach ( $payments as $payment ) {
80
+			foreach ($payments as $payment) {
81 81
 
82
-				$total += give_get_payment_amount( $payment );
82
+				$total += give_get_payment_amount($payment);
83 83
 
84 84
 			}
85 85
 
86
-			if ( $total < 0 ) {
86
+			if ($total < 0) {
87 87
 				$totals = 0;
88 88
 			}
89 89
 
90
-			$total = round( $total, give_currency_decimal_filter() );
90
+			$total = round($total, give_currency_decimal_filter());
91 91
 
92
-			$this->store_data( 'give_temp_recount_earnings', $total );
92
+			$this->store_data('give_temp_recount_earnings', $total);
93 93
 
94 94
 			return true;
95 95
 
96 96
 		}
97 97
 
98
-		update_option( 'give_earnings_total', $total );
98
+		update_option('give_earnings_total', $total);
99 99
 
100 100
 		return false;
101 101
 
@@ -109,25 +109,25 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function get_percentage_complete() {
111 111
 
112
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
112
+		$total = $this->get_stored_data('give_recount_earnings_total');
113 113
 
114
-		if ( false === $total ) {
115
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
114
+		if (false === $total) {
115
+			$args = apply_filters('give_recount_earnings_total_args', array());
116 116
 
117
-			$counts = give_count_payments( $args );
118
-			$total  = absint( $counts->publish );
119
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
117
+			$counts = give_count_payments($args);
118
+			$total  = absint($counts->publish);
119
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
120 120
 
121
-			$this->store_data( 'give_recount_earnings_total', $total );
121
+			$this->store_data('give_recount_earnings_total', $total);
122 122
 		}
123 123
 
124 124
 		$percentage = 100;
125 125
 
126
-		if ( $total > 0 ) {
127
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
126
+		if ($total > 0) {
127
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
128 128
 		}
129 129
 
130
-		if ( $percentage > 100 ) {
130
+		if ($percentage > 100) {
131 131
 			$percentage = 100;
132 132
 		}
133 133
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @param array $request The Form Data passed into the batch processing
143 143
 	 */
144
-	public function set_properties( $request ) {
144
+	public function set_properties($request) {
145 145
 	}
146 146
 
147 147
 	/**
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function process_step() {
154 154
 
155
-		if ( ! $this->can_export() ) {
156
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
155
+		if ( ! $this->can_export()) {
156
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
157 157
 		}
158 158
 
159 159
 		$had_data = $this->get_data();
160 160
 
161
-		if ( $had_data ) {
161
+		if ($had_data) {
162 162
 			$this->done = false;
163 163
 
164 164
 			return true;
165 165
 		} else {
166
-			$this->delete_data( 'give_recount_earnings_total' );
167
-			$this->delete_data( 'give_temp_recount_earnings' );
166
+			$this->delete_data('give_recount_earnings_total');
167
+			$this->delete_data('give_temp_recount_earnings');
168 168
 			$this->done    = true;
169
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
169
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
170 170
 
171 171
 			return false;
172 172
 		}
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	 * Headers.
177 177
 	 */
178 178
 	public function headers() {
179
-		ignore_user_abort( true );
179
+		ignore_user_abort(true);
180 180
 
181
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
182
-			set_time_limit( 0 );
181
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
182
+			set_time_limit(0);
183 183
 		}
184 184
 	}
185 185
 
@@ -207,17 +207,17 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return mixed       Returns the data from the database
209 209
 	 */
210
-	private function get_stored_data( $key ) {
210
+	private function get_stored_data($key) {
211 211
 		global $wpdb;
212
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
212
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
213 213
 
214
-		if ( empty( $value ) ) {
214
+		if (empty($value)) {
215 215
 			return false;
216 216
 		}
217 217
 
218
-		$maybe_json = json_decode( $value );
219
-		if ( ! is_null( $maybe_json ) ) {
220
-			$value = json_decode( $value, true );
218
+		$maybe_json = json_decode($value);
219
+		if ( ! is_null($maybe_json)) {
220
+			$value = json_decode($value, true);
221 221
 		}
222 222
 
223 223
 		return $value;
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
 	 *
234 234
 	 * @return void
235 235
 	 */
236
-	private function store_data( $key, $value ) {
236
+	private function store_data($key, $value) {
237 237
 		global $wpdb;
238 238
 
239
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
239
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
240 240
 
241 241
 		$data = array(
242 242
 			'option_name'  => $key,
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			'%s',
251 251
 		);
252 252
 
253
-		$wpdb->replace( $wpdb->options, $data, $formats );
253
+		$wpdb->replace($wpdb->options, $data, $formats);
254 254
 	}
255 255
 
256 256
 	/**
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 *
263 263
 	 * @return void
264 264
 	 */
265
-	private function delete_data( $key ) {
265
+	private function delete_data($key) {
266 266
 		global $wpdb;
267
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
267
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
268 268
 	}
269 269
 
270 270
 }
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 patch
Spacing   +59 added lines, -59 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
 
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $wpdb;
57 57
 
58
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
58
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
59 59
 
60
-		if ( ! is_array( $items ) ) {
60
+		if ( ! is_array($items)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$offset     = ( $this->step - 1 ) * $this->per_step;
65
-		$step_items = array_slice( $items, $offset, $this->per_step );
64
+		$offset     = ($this->step - 1) * $this->per_step;
65
+		$step_items = array_slice($items, $offset, $this->per_step);
66 66
 
67
-		if ( $step_items ) {
67
+		if ($step_items) {
68 68
 
69 69
 			$step_ids = array(
70 70
 				'other' => array(),
71 71
 			);
72 72
 
73
-			foreach ( $step_items as $item ) {
73
+			foreach ($step_items as $item) {
74 74
 
75 75
 				$step_ids['other'][] = $item['id'];
76 76
 
@@ -78,31 +78,31 @@  discard block
 block discarded – undo
78 78
 
79 79
 			$sql = array();
80 80
 
81
-			foreach ( $step_ids as $type => $ids ) {
81
+			foreach ($step_ids as $type => $ids) {
82 82
 
83
-				if ( empty( $ids ) ) {
83
+				if (empty($ids)) {
84 84
 					continue;
85 85
 				}
86 86
 
87 87
 				$parent_query = '';
88 88
 
89
-				switch ( $type ) {
89
+				switch ($type) {
90 90
 					case 'other':
91 91
 
92
-						$temp_ids = implode( ',', $ids );
92
+						$temp_ids = implode(',', $ids);
93 93
 
94 94
 						// Get all the test logs of the donations ids.
95 95
 						$parent_query = "SELECT DISTINCT post_id as id FROM $wpdb->postmeta WHERE meta_key = '_give_log_payment_id' AND meta_value IN ( $temp_ids )";
96
-						$parent_ids   = $wpdb->get_results( $parent_query, 'ARRAY_A' );
96
+						$parent_ids   = $wpdb->get_results($parent_query, 'ARRAY_A');
97 97
 
98 98
 						// List of all test logs.
99
-						if ( $parent_ids ) {
100
-							foreach ( $parent_ids as $parent_id ) {
99
+						if ($parent_ids) {
100
+							foreach ($parent_ids as $parent_id) {
101 101
 								// Adding all the test log in post ids that are going to get deleted.
102 102
 								$ids[] = $parent_id['id'];
103 103
 							}
104 104
 						}
105
-						$ids = implode( ',', $ids );
105
+						$ids = implode(',', $ids);
106 106
 
107 107
 						$sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)";
108 108
 						$sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)";
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 
114 114
 			}
115 115
 
116
-			if ( ! empty( $sql ) ) {
117
-				foreach ( $sql as $query ) {
118
-					$wpdb->query( $query );
116
+			if ( ! empty($sql)) {
117
+				foreach ($sql as $query) {
118
+					$wpdb->query($query);
119 119
 				}
120
-				do_action( 'give_delete_log_cache' );
120
+				do_action('give_delete_log_cache');
121 121
 			}
122 122
 
123 123
 			return true;
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function get_percentage_complete() {
136 136
 
137
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
138
-		$total = count( $items );
137
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
138
+		$total = count($items);
139 139
 
140 140
 		$percentage = 100;
141 141
 
142
-		if ( $total > 0 ) {
143
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
142
+		if ($total > 0) {
143
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
144 144
 		}
145 145
 
146
-		if ( $percentage > 100 ) {
146
+		if ($percentage > 100) {
147 147
 			$percentage = 100;
148 148
 		}
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param array $request The Form Data passed into the batch processing
159 159
 	 */
160
-	public function set_properties( $request ) {
160
+	public function set_properties($request) {
161 161
 	}
162 162
 
163 163
 	/**
@@ -168,29 +168,29 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function process_step() {
170 170
 
171
-		if ( ! $this->can_export() ) {
172
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
171
+		if ( ! $this->can_export()) {
172
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
173 173
 		}
174 174
 
175 175
 		$had_data = $this->get_data();
176 176
 
177
-		if ( $had_data ) {
177
+		if ($had_data) {
178 178
 			$this->done = false;
179 179
 
180 180
 			return true;
181 181
 		} else {
182
-			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
183
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
182
+			update_option('give_earnings_total', give_get_total_earnings(true));
183
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
184 184
 
185
-			$this->delete_data( 'give_temp_delete_test_ids' );
185
+			$this->delete_data('give_temp_delete_test_ids');
186 186
 
187 187
 			// Reset the sequential order numbers
188
-			if ( give_get_option( 'enable_sequential' ) ) {
189
-				delete_option( 'give_last_payment_number' );
188
+			if (give_get_option('enable_sequential')) {
189
+				delete_option('give_last_payment_number');
190 190
 			}
191 191
 
192 192
 			$this->done    = true;
193
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
193
+			$this->message = __('Test transactions successfully deleted.', 'give');
194 194
 
195 195
 			return false;
196 196
 		}
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 	 * Headers
201 201
 	 */
202 202
 	public function headers() {
203
-		ignore_user_abort( true );
203
+		ignore_user_abort(true);
204 204
 
205
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
206
-			set_time_limit( 0 );
205
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
206
+			set_time_limit(0);
207 207
 		}
208 208
 	}
209 209
 
@@ -227,27 +227,27 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	public function pre_fetch() {
229 229
 
230
-		if ( $this->step == 1 ) {
231
-			$this->delete_data( 'give_temp_delete_test_ids' );
230
+		if ($this->step == 1) {
231
+			$this->delete_data('give_temp_delete_test_ids');
232 232
 		}
233 233
 
234
-		$items = get_option( 'give_temp_delete_test_ids', false );
234
+		$items = get_option('give_temp_delete_test_ids', false);
235 235
 
236
-		if ( false === $items ) {
236
+		if (false === $items) {
237 237
 			$items = array();
238 238
 
239
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
239
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
240 240
 				'post_status' => 'any',
241
-				'number'      => - 1,
241
+				'number'      => -1,
242 242
 				'meta_key'    => '_give_payment_mode',
243 243
 				'meta_value'  => 'test'
244
-			) );
244
+			));
245 245
 
246
-			$posts    = new Give_Payments_Query( $args );
246
+			$posts    = new Give_Payments_Query($args);
247 247
 			$payments = $posts->get_payments();
248 248
 
249 249
 			/* @var Give_Payment $payment */
250
-			foreach ( $payments as $payment ) {
250
+			foreach ($payments as $payment) {
251 251
 				$items[] = array(
252 252
 					'id'   => (int) $payment->ID,
253 253
 					'type' => 'give_payment',
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			
257 257
 			// Allow filtering of items to remove with an unassociative array for each item.
258 258
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
259
-			$items = apply_filters( 'give_delete_test_items', $items );
259
+			$items = apply_filters('give_delete_test_items', $items);
260 260
 
261
-			$this->store_data( 'give_temp_delete_test_ids', $items );
261
+			$this->store_data('give_temp_delete_test_ids', $items);
262 262
 		}
263 263
 
264 264
 	}
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return mixed       Returns the data from the database
274 274
 	 */
275
-	private function get_stored_data( $key ) {
275
+	private function get_stored_data($key) {
276 276
 		global $wpdb;
277
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
277
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
278 278
 
279
-		if ( empty( $value ) ) {
279
+		if (empty($value)) {
280 280
 			return false;
281 281
 		}
282 282
 
283
-		$maybe_json = json_decode( $value );
284
-		if ( ! is_null( $maybe_json ) ) {
285
-			$value = json_decode( $value, true );
283
+		$maybe_json = json_decode($value);
284
+		if ( ! is_null($maybe_json)) {
285
+			$value = json_decode($value, true);
286 286
 		}
287 287
 
288 288
 		return $value;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @return void
300 300
 	 */
301
-	private function store_data( $key, $value ) {
301
+	private function store_data($key, $value) {
302 302
 		global $wpdb;
303 303
 
304
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
304
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
305 305
 
306 306
 		$data = array(
307 307
 			'option_name'  => $key,
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 			'%s',
316 316
 		);
317 317
 
318
-		$wpdb->replace( $wpdb->options, $data, $formats );
318
+		$wpdb->replace($wpdb->options, $data, $formats);
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return void
329 329
 	 */
330
-	private function delete_data( $key ) {
330
+	private function delete_data($key) {
331 331
 		global $wpdb;
332
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
332
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
333 333
 	}
334 334
 
335 335
 }
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-imports.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Import Donations
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.8.13
18 18
  */
19
-do_action( 'give_tools_import_main_before' );
19
+do_action('give_tools_import_main_before');
20 20
 ?>
21 21
     <div id="poststuff">
22 22
         <div class="postbox">
23
-            <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1>
23
+            <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1>
24 24
             <div class="inside give-tools-setting-page-import">
25 25
 				<?php
26 26
 				/**
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 				 *
29 29
 				 * @since 1.5
30 30
 				 */
31
-				do_action( 'give_tools_import_form_before_start' );
31
+				do_action('give_tools_import_form_before_start');
32 32
 				?>
33 33
                 <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import">
34 34
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 					 *
39 39
 					 * @since 1.5
40 40
 					 */
41
-					do_action( 'give_tools_import_form_start' );
41
+					do_action('give_tools_import_form_start');
42 42
 					?>
43 43
 
44 44
 					<?php
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 					 *
48 48
 					 * @since 1.5
49 49
 					 */
50
-					do_action( 'give_tools_import_form_end' );
50
+					do_action('give_tools_import_form_end');
51 51
 					?>
52 52
                 </form>
53 53
 				<?php
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 				 *
57 57
 				 * @since 1.5
58 58
 				 */
59
-				do_action( 'give_tools_import_form_after_end' );
59
+				do_action('give_tools_import_form_after_end');
60 60
 				?>
61 61
             </div><!-- .inside -->
62 62
         </div><!-- .postbox -->
@@ -67,4 +67,4 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @since 1.8.13
69 69
  */
70
-do_action( 'give_tools_import_main_after' );
70
+do_action('give_tools_import_main_after');
Please login to merge, or discard this patch.
includes/admin/tools/views/html-admin-page-data.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
  * Admin View: Exports
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if ( ! defined('ABSPATH')) {
7 7
 	exit;
8 8
 }
9 9
 
10
-if ( ! current_user_can( 'manage_give_settings' ) ) {
10
+if ( ! current_user_can('manage_give_settings')) {
11 11
 	return;
12 12
 }
13 13
 
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @since 1.5
18 18
  */
19
-do_action( 'give_tools_recount_stats_before' );
19
+do_action('give_tools_recount_stats_before');
20 20
 ?>
21 21
 	<div id="poststuff">
22 22
 		<div class="postbox">
23 23
 
24
-			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2>
24
+			<h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2>
25 25
 
26 26
 			<div class="inside recount-stats-controls">
27
-				<p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p>
27
+				<p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p>
28 28
 				<form method="post" id="give-tools-recount-form" class="give-export-form">
29 29
 
30
-					<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
30
+					<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
31 31
 
32 32
 					<select name="give-export-class" id="recount-stats-type">
33
-						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option>
34
-						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option>
35
-						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option>
36
-						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option>
37
-						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option>
38
-						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option>
39
-						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option>
40
-						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option>
41
-						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option>
33
+						<option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option>
34
+						<option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option>
35
+						<option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option>
36
+						<option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option>
37
+						<option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option>
38
+						<option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option>
39
+						<option data-type="delete-test-donors"   value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option>
40
+						<option data-type="delete-import-donors"   value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option>
41
+						<option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option>
42 42
 						<?php
43 43
 						/**
44 44
 						 * Fires in the recount stats selectbox.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 						 *
48 48
 						 * @since 1.5
49 49
 						 */
50
-						do_action( 'give_recount_tool_options' );
50
+						do_action('give_recount_tool_options');
51 51
 						?>
52 52
 					</select>
53 53
 
@@ -55,22 +55,22 @@  discard block
 block discarded – undo
55 55
 						<?php
56 56
 						$args = array(
57 57
 							'name'   => 'form_id',
58
-							'number' => - 1,
58
+							'number' => -1,
59 59
 							'chosen' => true,
60 60
 						);
61
-						echo Give()->html->forms_dropdown( $args );
61
+						echo Give()->html->forms_dropdown($args);
62 62
 						?>
63 63
 					</span>
64 64
 
65
-					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/>
65
+					<input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/>
66 66
 
67 67
 					<br/>
68 68
 
69 69
 					<span class="give-recount-stats-descriptions">
70
-						<span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span>
71
-						<span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span>
72
-						<span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span>
73
-						<span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span>
70
+						<span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span>
71
+						<span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span>
72
+						<span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span>
73
+						<span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span>
74 74
 						<?php
75 75
 						/**
76 76
 						 * Fires in the recount stats description area.
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 						 *
80 80
 						 * @since 1.5
81 81
 						 */
82
-						do_action( 'give_recount_tool_descriptions' );
82
+						do_action('give_recount_tool_descriptions');
83 83
 						?>
84
-						<span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span>
85
-						<span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span>
84
+						<span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span>
85
+						<span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span>
86 86
 					</span>
87 87
 
88 88
 					<span class="spinner"></span>
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 				 *
97 97
 				 * @since 1.5
98 98
 				 */
99
-				do_action( 'give_tools_recount_forms' );
99
+				do_action('give_tools_recount_forms');
100 100
 				?>
101 101
 			</div><!-- .inside -->
102 102
 		</div><!-- .postbox -->
@@ -107,4 +107,4 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @since 1.5
109 109
  */
110
-do_action( 'give_tools_recount_stats_after' );
110
+do_action('give_tools_recount_stats_after');
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 	public function __construct() {
135 135
 
136 136
 		// Set parent defaults.
137
-		parent::__construct( array(
138
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
139
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
140
-			'ajax'     => false,                              // Does this table support ajax?
141
-		) );
137
+		parent::__construct(array(
138
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
139
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
140
+			'ajax'     => false, // Does this table support ajax?
141
+		));
142 142
 
143 143
 		$this->process_bulk_action();
144 144
 		$this->get_payment_counts();
145
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
145
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
146 146
 	}
147 147
 
148 148
 	/**
@@ -151,55 +151,55 @@  discard block
 block discarded – undo
151 151
 	 * @return void
152 152
 	 */
153 153
 	public function advanced_filters() {
154
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
155
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
156
-		$status     = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
157
-		$donor      = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : '';
158
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
159
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
154
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
155
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
156
+		$status     = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '';
157
+		$donor      = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : '';
158
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '';
159
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
160 160
 		?>
161 161
 		<div id="give-payment-filters" class="give-filters">
162
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
162
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
163 163
 			<div id="give-payment-date-filters">
164 164
 				<div class="give-filter give-filter-half">
165 165
 					<label for="start-date"
166
-					       class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label>
166
+					       class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label>
167 167
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
168 168
 					       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
169 169
 				</div>
170 170
 				<div class="give-filter give-filter-half">
171
-					<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label>
171
+					<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label>
172 172
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
173 173
 					       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
174 174
 				</div>
175 175
 			</div>
176 176
 			<div id="give-payment-form-filter" class="give-filter">
177 177
 				<label for="give-donation-forms-filter"
178
-				       class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label>
178
+				       class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label>
179 179
 				<?php
180 180
 				// Filter Donations by Donation Forms.
181
-				echo Give()->html->forms_dropdown( array(
181
+				echo Give()->html->forms_dropdown(array(
182 182
 					'name'     => 'form_id',
183 183
 					'id'       => 'give-donation-forms-filter',
184 184
 					'class'    => 'give-donation-forms-filter',
185 185
 					'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
186 186
 					'chosen'   => true,
187
-					'number'   => - 1,
188
-				) );
187
+					'number'   => -1,
188
+				));
189 189
 				?>
190 190
 			</div>
191 191
 
192
-			<?php if ( ! empty( $status ) ) : ?>
193
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
192
+			<?php if ( ! empty($status)) : ?>
193
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
194 194
 			<?php endif; ?>
195 195
 
196 196
 			<div class="give-filter">
197
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
197
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
198 198
 				<?php
199 199
 				// Clear active filters button.
200
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?>
201
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
202
-					   class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a>
200
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?>
201
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
202
+					   class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a>
203 203
 				<?php endif; ?>
204 204
 			</div>
205 205
 		</div>
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return void
220 220
 	 */
221
-	public function search_box( $text, $input_id ) {
222
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
221
+	public function search_box($text, $input_id) {
222
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
223 223
 			return;
224 224
 		}
225 225
 
226
-		$input_id = $input_id . '-search-input';
226
+		$input_id = $input_id.'-search-input';
227 227
 
228
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
229
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
228
+		if ( ! empty($_REQUEST['orderby'])) {
229
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
230 230
 		}
231
-		if ( ! empty( $_REQUEST['order'] ) ) {
232
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
231
+		if ( ! empty($_REQUEST['order'])) {
232
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
233 233
 		}
234 234
 		?>
235 235
 		<div class="give-filter give-filter-search" role="search">
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 			 *
242 242
 			 * @since 1.7
243 243
 			 */
244
-			do_action( 'give_payment_history_search' );
244
+			do_action('give_payment_history_search');
245 245
 			?>
246 246
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
247 247
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
248
-			<?php submit_button( $text, 'button', false, false, array(
248
+			<?php submit_button($text, 'button', false, false, array(
249 249
 				'ID' => 'search-submit',
250
-			) ); ?><br />
250
+			)); ?><br />
251 251
 		</div>
252 252
 		<?php
253 253
 	}
@@ -261,52 +261,52 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function get_views() {
263 263
 
264
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
264
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
265 265
 		$views   = array();
266 266
 		$tabs    = array(
267 267
 			'all'        => array(
268 268
 				'total_count',
269
-				esc_html__( 'All', 'give' ),
269
+				esc_html__('All', 'give'),
270 270
 			),
271 271
 			'publish'    => array(
272 272
 				'complete_count',
273
-				esc_html__( 'Completed', 'give' ),
273
+				esc_html__('Completed', 'give'),
274 274
 			),
275 275
 			'pending'    => array(
276 276
 				'pending_count',
277
-				esc_html__( 'Pending', 'give' ),
277
+				esc_html__('Pending', 'give'),
278 278
 			),
279 279
 			'processing' => array(
280 280
 				'processing_count',
281
-				esc_html__( 'Processing', 'give' ),
281
+				esc_html__('Processing', 'give'),
282 282
 			),
283 283
 			'refunded'   => array(
284 284
 				'refunded_count',
285
-				esc_html__( 'Refunded', 'give' ),
285
+				esc_html__('Refunded', 'give'),
286 286
 			),
287 287
 			'revoked'    => array(
288 288
 				'revoked_count',
289
-				esc_html__( 'Revoked', 'give' ),
289
+				esc_html__('Revoked', 'give'),
290 290
 			),
291 291
 			'failed'     => array(
292 292
 				'failed_count',
293
-				esc_html__( 'Failed', 'give' ),
293
+				esc_html__('Failed', 'give'),
294 294
 			),
295 295
 			'cancelled'  => array(
296 296
 				'cancelled_count',
297
-				esc_html__( 'Cancelled', 'give' ),
297
+				esc_html__('Cancelled', 'give'),
298 298
 			),
299 299
 			'abandoned'  => array(
300 300
 				'abandoned_count',
301
-				esc_html__( 'Abandoned', 'give' ),
301
+				esc_html__('Abandoned', 'give'),
302 302
 			),
303 303
 			'preapproval'  => array(
304 304
 				'preapproval_count',
305
-				esc_html__( 'Preapproval Pending', 'give' ),
305
+				esc_html__('Preapproval Pending', 'give'),
306 306
 			),
307 307
 		);
308 308
 
309
-		foreach ( $tabs as $key => $tab ) {
309
+		foreach ($tabs as $key => $tab) {
310 310
 			$count_key = $tab[0];
311 311
 			$name      = $tab[1];
312 312
 			$count     = $this->$count_key;
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 			 * @param string $key   Current view tab value.
322 322
 			 * @param int    $count Number of donation inside the tab.
323 323
 			 */
324
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
324
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
325 325
 
326
-				$views[ $key ] = sprintf(
326
+				$views[$key] = sprintf(
327 327
 					'<a href="%s" %s >%s&nbsp;<span class="count">(%s)</span></a>',
328
-					esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ) ) ),
329
-					( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',
328
+					esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false))),
329
+					(('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '',
330 330
 					$name,
331 331
 					$count
332 332
 				);
333 333
 			}
334 334
 		}
335 335
 
336
-		return apply_filters( 'give_payments_table_views', $views );
336
+		return apply_filters('give_payments_table_views', $views);
337 337
 	}
338 338
 
339 339
 	/**
@@ -346,15 +346,15 @@  discard block
 block discarded – undo
346 346
 	public function get_columns() {
347 347
 		$columns = array(
348 348
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
349
-			'donation'      => esc_html__( 'Donation', 'give' ),
350
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
351
-			'status'        => esc_html__( 'Status', 'give' ),
352
-			'date'          => esc_html__( 'Date', 'give' ),
353
-			'amount'        => esc_html__( 'Amount', 'give' ),
354
-			'details'       => esc_html__( 'Details', 'give' ),
349
+			'donation'      => esc_html__('Donation', 'give'),
350
+			'donation_form' => esc_html__('Donation Form', 'give'),
351
+			'status'        => esc_html__('Status', 'give'),
352
+			'date'          => esc_html__('Date', 'give'),
353
+			'amount'        => esc_html__('Amount', 'give'),
354
+			'details'       => esc_html__('Details', 'give'),
355 355
 		);
356 356
 
357
-		return apply_filters( 'give_payments_table_columns', $columns );
357
+		return apply_filters('give_payments_table_columns', $columns);
358 358
 	}
359 359
 
360 360
 	/**
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
 	 */
367 367
 	public function get_sortable_columns() {
368 368
 		$columns = array(
369
-			'donation'      => array( 'ID', true ),
370
-			'donation_form' => array( 'donation_form', false ),
371
-			'status'        => array( 'status', false ),
372
-			'amount'        => array( 'amount', false ),
373
-			'date'          => array( 'date', false ),
369
+			'donation'      => array('ID', true),
370
+			'donation_form' => array('donation_form', false),
371
+			'status'        => array('status', false),
372
+			'amount'        => array('amount', false),
373
+			'date'          => array('date', false),
374 374
 		);
375 375
 
376
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
376
+		return apply_filters('give_payments_table_sortable_columns', $columns);
377 377
 	}
378 378
 
379 379
 	/**
@@ -399,55 +399,55 @@  discard block
 block discarded – undo
399 399
 	 *
400 400
 	 * @return string Column Name
401 401
 	 */
402
-	public function column_default( $payment, $column_name ) {
402
+	public function column_default($payment, $column_name) {
403 403
 
404
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) );
405
-		$row_actions         = $this->get_row_actions( $payment );
404
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details')));
405
+		$row_actions         = $this->get_row_actions($payment);
406 406
 
407
-		switch ( $column_name ) {
407
+		switch ($column_name) {
408 408
 			case 'donation' :
409
-				$value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) );
410
-				$value .= $this->get_donor_email( $payment );
411
-				$value .= $this->row_actions( $row_actions );
409
+				$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment));
410
+				$value .= $this->get_donor_email($payment);
411
+				$value .= $this->row_actions($row_actions);
412 412
 				break;
413 413
 
414 414
 			case 'amount' :
415
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
416
-				$value  = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) );
417
-				$value  .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
415
+				$amount = ! empty($payment->total) ? $payment->total : 0;
416
+				$value  = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID));
417
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
418 418
 				break;
419 419
 
420 420
 			case 'donation_form' :
421
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
422
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
423
-				$level      = give_get_payment_form_title( $payment->meta, true );
421
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
422
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
423
+				$level      = give_get_payment_form_title($payment->meta, true);
424 424
 
425
-				if ( ! empty( $level ) ) {
425
+				if ( ! empty($level)) {
426 426
 					$value .= $level;
427 427
 				}
428 428
 
429 429
 				break;
430 430
 
431 431
 			case 'date' :
432
-				$date  = strtotime( $payment->date );
433
-				$value = date_i18n( give_date_format(), $date );
432
+				$date  = strtotime($payment->date);
433
+				$value = date_i18n(give_date_format(), $date);
434 434
 				break;
435 435
 
436 436
 			case 'status' :
437
-				$value = $this->get_payment_status( $payment );
437
+				$value = $this->get_payment_status($payment);
438 438
 				break;
439 439
 
440 440
 			case 'details' :
441
-				$value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) );
441
+				$value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID));
442 442
 				break;
443 443
 
444 444
 			default:
445
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
445
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
446 446
 				break;
447 447
 
448 448
 		}// End switch().
449 449
 
450
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
450
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
451 451
 	}
452 452
 
453 453
 	/**
@@ -460,17 +460,17 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @return string                Data shown in the Email column
462 462
 	 */
463
-	public function get_donor_email( $payment ) {
463
+	public function get_donor_email($payment) {
464 464
 
465
-		$email = give_get_payment_user_email( $payment->ID );
465
+		$email = give_get_payment_user_email($payment->ID);
466 466
 
467
-		if ( empty( $email ) ) {
468
-			$email = esc_html__( '(unknown)', 'give' );
467
+		if (empty($email)) {
468
+			$email = esc_html__('(unknown)', 'give');
469 469
 		}
470 470
 
471
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
471
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
472 472
 
473
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
473
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
474 474
 	}
475 475
 
476 476
 	/**
@@ -482,32 +482,32 @@  discard block
 block discarded – undo
482 482
 	 *
483 483
 	 * @return array $actions
484 484
 	 */
485
-	function get_row_actions( $payment ) {
485
+	function get_row_actions($payment) {
486 486
 
487 487
 		$actions = array();
488
-		$email   = give_get_payment_user_email( $payment->ID );
488
+		$email   = give_get_payment_user_email($payment->ID);
489 489
 
490 490
 		// Add search term string back to base URL.
491
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
492
-		if ( ! empty( $search_terms ) ) {
493
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
491
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
492
+		if ( ! empty($search_terms)) {
493
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
494 494
 		}
495 495
 
496
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
496
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
497 497
 
498
-			$actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
498
+			$actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
499 499
 				'give-action' => 'email_links',
500 500
 				'purchase_id' => $payment->ID,
501
-			), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) );
501
+			), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give'));
502 502
 
503 503
 		}
504 504
 
505
-		$actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
505
+		$actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
506 506
 			'give-action' => 'delete_payment',
507 507
 			'purchase_id' => $payment->ID,
508
-		), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) );
508
+		), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give'));
509 509
 
510
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
510
+		return apply_filters('give_payment_row_actions', $actions, $payment);
511 511
 	}
512 512
 
513 513
 
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string                Data shown in the Email column
523 523
 	 */
524
-	function get_payment_status( $payment ) {
525
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
526
-		if ( $payment->mode == 'test' ) {
527
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
524
+	function get_payment_status($payment) {
525
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
526
+		if ($payment->mode == 'test') {
527
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
528 528
 		}
529 529
 
530
-		if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) {
531
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was imported.', 'give' ) . '">' . esc_html__( 'Import', 'give' ) . '</span>';
530
+		if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) {
531
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was imported.', 'give').'">'.esc_html__('Import', 'give').'</span>';
532 532
 		}
533 533
 
534 534
 		return $value;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	 *
545 545
 	 * @return string Displays a checkbox.
546 546
 	 */
547
-	public function column_cb( $payment ) {
548
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
547
+	public function column_cb($payment) {
548
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
549 549
 	}
550 550
 
551 551
 	/**
@@ -558,8 +558,8 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @return string Displays a checkbox.
560 560
 	 */
561
-	public function get_payment_id( $payment ) {
562
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
561
+	public function get_payment_id($payment) {
562
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
563 563
 	}
564 564
 
565 565
 	/**
@@ -572,32 +572,32 @@  discard block
 block discarded – undo
572 572
 	 *
573 573
 	 * @return string Data shown in the User column
574 574
 	 */
575
-	public function get_donor( $payment ) {
575
+	public function get_donor($payment) {
576 576
 
577
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
578
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
579
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
577
+		$donor_id           = give_get_payment_donor_id($payment->ID);
578
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
579
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
580 580
 
581 581
 		$value = '';
582
-		if ( ! empty( $donor_id ) ) {
582
+		if ( ! empty($donor_id)) {
583 583
 
584 584
 			// Check whether the donor name and WP_User name is same or not.
585
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
586
-				$value .= $donor_billing_name . ' (';
585
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
586
+				$value .= $donor_billing_name.' (';
587 587
 			}
588 588
 
589
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
589
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
590 590
 
591 591
 			// Check whether the donor name and WP_User name is same or not.
592
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
592
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
593 593
 				$value .= ')';
594 594
 			}
595 595
 		} else {
596
-			$email = give_get_payment_user_email( $payment->ID );
597
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
596
+			$email = give_get_payment_user_email($payment->ID);
597
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
598 598
 		}
599 599
 
600
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
600
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
601 601
 	}
602 602
 
603 603
 	/**
@@ -609,20 +609,20 @@  discard block
 block discarded – undo
609 609
 	 */
610 610
 	public function get_bulk_actions() {
611 611
 		$actions = array(
612
-			'delete'                 => __( 'Delete', 'give' ),
613
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
614
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
615
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
616
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
617
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
618
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
619
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
620
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
621
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
622
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
612
+			'delete'                 => __('Delete', 'give'),
613
+			'set-status-publish'     => __('Set To Completed', 'give'),
614
+			'set-status-pending'     => __('Set To Pending', 'give'),
615
+			'set-status-processing'  => __('Set To Processing', 'give'),
616
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
617
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
618
+			'set-status-failed'      => __('Set To Failed', 'give'),
619
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
620
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
621
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
622
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
623 623
 		);
624 624
 
625
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
625
+		return apply_filters('give_payments_table_bulk_actions', $actions);
626 626
 	}
627 627
 
628 628
 	/**
@@ -633,63 +633,63 @@  discard block
 block discarded – undo
633 633
 	 * @return void
634 634
 	 */
635 635
 	public function process_bulk_action() {
636
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
636
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
637 637
 		$action = $this->current_action();
638 638
 
639
-		if ( ! is_array( $ids ) ) {
640
-			$ids = array( $ids );
639
+		if ( ! is_array($ids)) {
640
+			$ids = array($ids);
641 641
 		}
642 642
 
643
-		if ( empty( $action ) ) {
643
+		if (empty($action)) {
644 644
 			return;
645 645
 		}
646 646
 
647
-		foreach ( $ids as $id ) {
647
+		foreach ($ids as $id) {
648 648
 
649 649
 			// Detect when a bulk action is being triggered.
650
-			switch ( $this->current_action() ) {
650
+			switch ($this->current_action()) {
651 651
 
652 652
 				case'delete':
653
-					give_delete_donation( $id );
653
+					give_delete_donation($id);
654 654
 					break;
655 655
 
656 656
 				case 'set-status-publish':
657
-					give_update_payment_status( $id, 'publish' );
657
+					give_update_payment_status($id, 'publish');
658 658
 					break;
659 659
 
660 660
 				case 'set-status-pending':
661
-					give_update_payment_status( $id, 'pending' );
661
+					give_update_payment_status($id, 'pending');
662 662
 					break;
663 663
 
664 664
 				case 'set-status-processing':
665
-					give_update_payment_status( $id, 'processing' );
665
+					give_update_payment_status($id, 'processing');
666 666
 					break;
667 667
 
668 668
 				case 'set-status-refunded':
669
-					give_update_payment_status( $id, 'refunded' );
669
+					give_update_payment_status($id, 'refunded');
670 670
 					break;
671 671
 				case 'set-status-revoked':
672
-					give_update_payment_status( $id, 'revoked' );
672
+					give_update_payment_status($id, 'revoked');
673 673
 					break;
674 674
 
675 675
 				case 'set-status-failed':
676
-					give_update_payment_status( $id, 'failed' );
676
+					give_update_payment_status($id, 'failed');
677 677
 					break;
678 678
 
679 679
 				case 'set-status-cancelled':
680
-					give_update_payment_status( $id, 'cancelled' );
680
+					give_update_payment_status($id, 'cancelled');
681 681
 					break;
682 682
 
683 683
 				case 'set-status-abandoned':
684
-					give_update_payment_status( $id, 'abandoned' );
684
+					give_update_payment_status($id, 'abandoned');
685 685
 					break;
686 686
 
687 687
 				case 'set-status-preapproval':
688
-					give_update_payment_status( $id, 'preapproval' );
688
+					give_update_payment_status($id, 'preapproval');
689 689
 					break;
690 690
 
691 691
 				case 'resend-receipt':
692
-					give_email_donation_receipt( $id, false );
692
+					give_email_donation_receipt($id, false);
693 693
 					break;
694 694
 			}// End switch().
695 695
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 			 * @param int    $id             The ID of the payment.
702 702
 			 * @param string $current_action The action that is being triggered.
703 703
 			 */
704
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
704
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
705 705
 		}// End foreach().
706 706
 
707 707
 	}
@@ -717,31 +717,31 @@  discard block
 block discarded – undo
717 717
 
718 718
 		$args = array();
719 719
 
720
-		if ( isset( $_GET['user'] ) ) {
721
-			$args['user'] = urldecode( $_GET['user'] );
722
-		} elseif ( isset( $_GET['donor'] ) ) {
723
-			$args['donor'] = absint( $_GET['donor'] );
724
-		} elseif ( isset( $_GET['s'] ) ) {
725
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
726
-			if ( $is_user ) {
727
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
728
-				unset( $args['s'] );
720
+		if (isset($_GET['user'])) {
721
+			$args['user'] = urldecode($_GET['user']);
722
+		} elseif (isset($_GET['donor'])) {
723
+			$args['donor'] = absint($_GET['donor']);
724
+		} elseif (isset($_GET['s'])) {
725
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
726
+			if ($is_user) {
727
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
728
+				unset($args['s']);
729 729
 			} else {
730
-				$args['s'] = sanitize_text_field( $_GET['s'] );
730
+				$args['s'] = sanitize_text_field($_GET['s']);
731 731
 			}
732 732
 		}
733 733
 
734
-		if ( ! empty( $_GET['start-date'] ) ) {
735
-			$args['start-date'] = urldecode( $_GET['start-date'] );
734
+		if ( ! empty($_GET['start-date'])) {
735
+			$args['start-date'] = urldecode($_GET['start-date']);
736 736
 		}
737 737
 
738
-		if ( ! empty( $_GET['end-date'] ) ) {
739
-			$args['end-date'] = urldecode( $_GET['end-date'] );
738
+		if ( ! empty($_GET['end-date'])) {
739
+			$args['end-date'] = urldecode($_GET['end-date']);
740 740
 		}
741 741
 
742
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
742
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
743 743
 
744
-		$payment_count           = give_count_payments( $args );
744
+		$payment_count           = give_count_payments($args);
745 745
 		$this->complete_count    = $payment_count->publish;
746 746
 		$this->pending_count     = $payment_count->pending;
747 747
 		$this->processing_count  = $payment_count->processing;
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 		$this->abandoned_count   = $payment_count->abandoned;
753 753
 		$this->preapproval_count = $payment_count->preapproval;
754 754
 
755
-		foreach ( $payment_count as $count ) {
755
+		foreach ($payment_count as $count) {
756 756
 			$this->total_count += $count;
757 757
 		}
758 758
 	}
@@ -767,28 +767,28 @@  discard block
 block discarded – undo
767 767
 	public function payments_data() {
768 768
 
769 769
 		$per_page   = $this->per_page;
770
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
771
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
772
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
773
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
774
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
775
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
776
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
777
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
778
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
779
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
780
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
781
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
782
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
783
-
784
-		if ( ! empty( $search ) ) {
770
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
771
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
772
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
773
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
774
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
775
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
776
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
777
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
778
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
779
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
780
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
781
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
782
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
783
+
784
+		if ( ! empty($search)) {
785 785
 			$status = 'any'; // Force all payment statuses when searching.
786 786
 		}
787 787
 
788 788
 		$args = array(
789 789
 			'output'     => 'payments',
790 790
 			'number'     => $per_page,
791
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
791
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
792 792
 			'orderby'    => $orderby,
793 793
 			'order'      => $order,
794 794
 			'user'       => $user,
@@ -804,12 +804,12 @@  discard block
 block discarded – undo
804 804
 			'give_forms' => $form_id,
805 805
 		);
806 806
 
807
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
807
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
808 808
 			$args['search_in_notes'] = true;
809
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
809
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
810 810
 		}
811 811
 
812
-		$p_query = new Give_Payments_Query( $args );
812
+		$p_query = new Give_Payments_Query($args);
813 813
 
814 814
 		return $p_query->get_payments();
815 815
 
@@ -829,17 +829,17 @@  discard block
 block discarded – undo
829 829
 	 */
830 830
 	public function prepare_items() {
831 831
 
832
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
832
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
833 833
 
834 834
 		$columns  = $this->get_columns();
835 835
 		$hidden   = array(); // No hidden columns.
836 836
 		$sortable = $this->get_sortable_columns();
837 837
 		$data     = $this->payments_data();
838
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
838
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
839 839
 
840
-		$this->_column_headers = array( $columns, $hidden, $sortable );
840
+		$this->_column_headers = array($columns, $hidden, $sortable);
841 841
 
842
-		switch ( $status ) {
842
+		switch ($status) {
843 843
 			case 'publish':
844 844
 				$total_items = $this->complete_count;
845 845
 				break;
@@ -872,20 +872,20 @@  discard block
 block discarded – undo
872 872
 				break;
873 873
 			default:
874 874
 				// Retrieve the count of the non-default-Give status.
875
-				$count       = wp_count_posts( 'give_payment' );
876
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
875
+				$count       = wp_count_posts('give_payment');
876
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
877 877
 				break;
878 878
 		}
879 879
 
880 880
 		$this->items = $data;
881 881
 
882
-		$this->set_pagination_args( array(
882
+		$this->set_pagination_args(array(
883 883
 			'total_items' => $total_items,
884 884
 			// We have to calculate the total number of items.
885 885
 			'per_page'    => $this->per_page,
886 886
 			// We have to determine how many items to show on a page.
887
-			'total_pages' => ceil( $total_items / $this->per_page ),
887
+			'total_pages' => ceil($total_items / $this->per_page),
888 888
 			// We have to calculate the total number of pages.
889
-		) );
889
+		));
890 890
 	}
891 891
 }
Please login to merge, or discard this patch.
includes/admin/class-i18n-module.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param $args
67 67
 	 */
68
-	public function __construct( $args ) {
68
+	public function __construct($args) {
69 69
 
70 70
 		// Only for admins.
71
-		if ( ! is_admin() ) {
71
+		if ( ! is_admin()) {
72 72
 			return;
73 73
 		}
74 74
 
75
-		foreach ( $args as $key => $arg ) {
75
+		foreach ($args as $key => $arg) {
76 76
 			$this->$key = $arg;
77 77
 		}
78 78
 
79
-		add_action( 'admin_init', array( $this, 'init' ) );
79
+		add_action('admin_init', array($this, 'init'));
80 80
 
81 81
 
82 82
 	}
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 	function init() {
88 88
 
89 89
 		// First get user's locale (4.7+).
90
-		$this->locale = function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
90
+		$this->locale = function_exists('get_user_locale') ? get_user_locale() : get_locale();
91 91
 
92 92
 		// This plugin is en_US native.
93
-		if ( 'en_US' === $this->locale ) {
93
+		if ('en_US' === $this->locale) {
94 94
 			return;
95 95
 		}
96 96
 
97 97
 		if (
98 98
 			! $this->hide_promo()
99
-			&& ( ! empty( $_GET['post_type'] ) && 'give_forms' === $_GET['post_type'] )
100
-			&& ( ! empty( $_GET['page'] ) && 'give-settings' === $_GET['page'] )
99
+			&& ( ! empty($_GET['post_type']) && 'give_forms' === $_GET['post_type'])
100
+			&& ( ! empty($_GET['page']) && 'give-settings' === $_GET['page'])
101 101
 		) {
102
-			add_action( $this->hook, array( $this, 'promo' ) );
102
+			add_action($this->hook, array($this, 'promo'));
103 103
 		}
104 104
 	}
105 105
 
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 	 * @return bool
113 113
 	 */
114 114
 	private function hide_promo() {
115
-		$hide_promo = Give_Cache::get( 'give_i18n_give_promo_hide', true );
116
-		if ( ! $hide_promo ) {
117
-			if ( filter_input( INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT ) === 1 ) {
115
+		$hide_promo = Give_Cache::get('give_i18n_give_promo_hide', true);
116
+		if ( ! $hide_promo) {
117
+			if (filter_input(INPUT_GET, 'remove_i18n_promo', FILTER_VALIDATE_INT) === 1) {
118 118
 				// No expiration time, so this would normally not expire, but it wouldn't be copied to other sites etc.
119
-				Give_Cache::set( 'give_i18n_give_promo_hide', true, null, true );
119
+				Give_Cache::set('give_i18n_give_promo_hide', true, null, true);
120 120
 				$hide_promo = true;
121 121
 			}
122 122
 		}
@@ -135,20 +135,20 @@  discard block
 block discarded – undo
135 135
 		$message = false;
136 136
 
137 137
 		// Using a translation less than 90% complete.
138
-		if ( $this->translation_exists && $this->translation_loaded && $this->percent_translated < 90 ) {
139
-			$message = __( 'As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give' );
140
-		} elseif ( ! $this->translation_loaded && $this->translation_exists ) {
141
-			$message = __( 'You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give' );
142
-		} elseif ( ! $this->translation_exists ) {
143
-			$message = __( 'You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give' );
138
+		if ($this->translation_exists && $this->translation_loaded && $this->percent_translated < 90) {
139
+			$message = __('As you can see, there is a translation of this plugin in %1$s. This translation is currently %3$d%% complete. We need your help to make it complete and to fix any errors. Please register at %4$s to help %5$s to %1$s!', 'give');
140
+		} elseif ( ! $this->translation_loaded && $this->translation_exists) {
141
+			$message = __('You\'re using WordPress in %1$s. While %2$s has been %3$d%% translated to %1$s, it has not been shipped with the plugin yet. You can help! Register at %4$s to help complete the translation to %1$s!', 'give');
142
+		} elseif ( ! $this->translation_exists) {
143
+			$message = __('You\'re using WordPress in a language we don\'t support yet. We\'d love for %2$s to be translated in that language too, but unfortunately, it isn\'t right now. You can change that! Register at %4$s to help translate it!', 'give');
144 144
 		}
145 145
 
146 146
 		// Links.
147
-		$registration_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__( 'WordPress.org', 'give' ) );
148
-		$translations_link = sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__( 'complete the translation', 'give' ) );
147
+		$registration_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://wordpress.org/support/register.php', esc_html__('WordPress.org', 'give'));
148
+		$translations_link = sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://translate.wordpress.org/projects/wp-plugins/give', esc_html__('complete the translation', 'give'));
149 149
 
150 150
 		// Message.
151
-		$message = sprintf( $message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link );
151
+		$message = sprintf($message, $this->locale_name, 'Give', $this->percent_translated, $registration_link, $translations_link);
152 152
 
153 153
 		return $message;
154 154
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		$this->translation_details();
163 163
 		$message = $this->promo_message();
164 164
 
165
-		if ( $message ) { ?>
165
+		if ($message) { ?>
166 166
 
167 167
 			<style>
168 168
 				/* Banner specific styles */
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 				                                                                                                                             style="font-size: 110px; text-decoration: none;"></span></a>
228 228
 
229 229
 				<div class="give-i18n-notice-content">
230
-					<a href="<?php echo esc_url( add_query_arg( array( 'remove_i18n_promo' => '1' ) ) ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
230
+					<a href="<?php echo esc_url(add_query_arg(array('remove_i18n_promo' => '1'))); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
231 231
 
232
-					<h2 style="margin: 10px 0;"><?php printf( esc_html__( 'Help Translate Give to %s', 'give' ), $this->locale_name ); ?></h2>
232
+					<h2 style="margin: 10px 0;"><?php printf(esc_html__('Help Translate Give to %s', 'give'), $this->locale_name); ?></h2>
233 233
 					<p><?php echo $message; ?></p>
234 234
 					<p>
235
-						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e( 'Register now &raquo;', 'give' ); ?></a>
235
+						<a href="https://wordpress.org/support/register.php" target="_blank"><?php _e('Register now &raquo;', 'give'); ?></a>
236 236
 					</p>
237 237
 				</div>
238 238
 			</div>
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	private function find_or_initialize_translation_details() {
251 251
 
252
-		$set = Give_Cache::get( "give_i18n_give_{$this->locale}", true );
252
+		$set = Give_Cache::get("give_i18n_give_{$this->locale}", true);
253 253
 
254
-		if ( ! $set ) {
254
+		if ( ! $set) {
255 255
 			$set = $this->retrieve_translation_details();
256
-			Give_Cache::set( "give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true );
256
+			Give_Cache::set("give_i18n_give_{$this->locale}", $set, DAY_IN_SECONDS, true);
257 257
 		}
258 258
 
259 259
 		return $set;
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 	private function translation_details() {
268 268
 		$set = $this->find_or_initialize_translation_details();
269 269
 
270
-		$this->translation_exists = ! is_null( $set );
271
-		$this->translation_loaded = is_textdomain_loaded( 'give' );
270
+		$this->translation_exists = ! is_null($set);
271
+		$this->translation_loaded = is_textdomain_loaded('give');
272 272
 
273
-		$this->parse_translation_set( $set );
273
+		$this->parse_translation_set($set);
274 274
 	}
275 275
 
276 276
 	/**
@@ -282,26 +282,26 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	private function retrieve_translation_details() {
284 284
 
285
-		$api_url = trailingslashit( $this->glotpress_url );
285
+		$api_url = trailingslashit($this->glotpress_url);
286 286
 
287
-		$resp = wp_remote_get( $api_url );
287
+		$resp = wp_remote_get($api_url);
288 288
 
289
-		if ( is_wp_error( $resp ) || wp_remote_retrieve_response_code( $resp ) === '404' ) {
289
+		if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) === '404') {
290 290
 			return null;
291 291
 		}
292 292
 
293
-		$body = wp_remote_retrieve_body( $resp );
294
-		unset( $resp );
293
+		$body = wp_remote_retrieve_body($resp);
294
+		unset($resp);
295 295
 
296
-		if ( $body ) {
297
-			$body = json_decode( $body );
296
+		if ($body) {
297
+			$body = json_decode($body);
298 298
 
299
-			foreach ( $body->translation_sets as $set ) {
300
-				if ( ! property_exists( $set, 'wp_locale' ) ) {
299
+			foreach ($body->translation_sets as $set) {
300
+				if ( ! property_exists($set, 'wp_locale')) {
301 301
 					continue;
302 302
 				}
303 303
 
304
-				if ( $this->locale == $set->wp_locale ) {
304
+				if ($this->locale == $set->wp_locale) {
305 305
 					return $set;
306 306
 				}
307 307
 			}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @access private
319 319
 	 */
320
-	private function parse_translation_set( $set ) {
321
-		if ( $this->translation_exists && is_object( $set ) ) {
320
+	private function parse_translation_set($set) {
321
+		if ($this->translation_exists && is_object($set)) {
322 322
 			$this->locale_name        = $set->name;
323 323
 			$this->percent_translated = $set->percent_translated;
324 324
 		} else {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	}
329 329
 }
330 330
 
331
-$give_i18n = new Give_i18n_Banner( array(
331
+$give_i18n = new Give_i18n_Banner(array(
332 332
 		'hook'          => 'admin_notices',
333 333
 		'glotpress_url' => 'https://translate.wordpress.org/api/projects/wp-plugins/give/stable/',
334
-	) );
334
+	));
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/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.