Completed
Pull Request — master (#801)
by
unknown
18:24
created
includes/admin/reporting/export/class-batch-export.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Give_API_V1 Class
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) exit;
15
+if ( ! defined('ABSPATH')) exit;
16 16
 
17 17
 /**
18 18
  * Give_Batch_Export Class
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 	 * @param $_step int The step to process
105 105
 	 * @since 1.5
106 106
 	 */
107
-	public function __construct( $_step = 1 ) {
107
+	public function __construct($_step = 1) {
108 108
 
109 109
 		$upload_dir       = wp_upload_dir();
110 110
 		$this->filetype   = '.csv';
111
-		$this->filename   = 'give-' . $this->export_type . $this->filetype;
112
-		$this->file       = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
111
+		$this->filename   = 'give-'.$this->export_type.$this->filetype;
112
+		$this->file       = trailingslashit($upload_dir['basedir']).$this->filename;
113 113
 
114
-		if ( ! is_writeable( $upload_dir['basedir'] ) ) {
114
+		if ( ! is_writeable($upload_dir['basedir'])) {
115 115
 			$this->is_writable = false;
116 116
 		}
117 117
 
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function process_step() {
129 129
 
130
-		if ( ! $this->can_export() ) {
131
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
130
+		if ( ! $this->can_export()) {
131
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
132 132
 		}
133 133
 
134
-		if( $this->step < 2 ) {
134
+		if ($this->step < 2) {
135 135
 
136 136
 			// Make sure we start with a fresh file on step 1
137
-			@unlink( $this->file );
137
+			@unlink($this->file);
138 138
 			$this->print_csv_cols();
139 139
 		}
140 140
 
141 141
 		$rows = $this->print_csv_rows();
142 142
 
143
-		if( $rows ) {
143
+		if ($rows) {
144 144
 			return true;
145 145
 		} else {
146 146
 			return false;
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 		$col_data = '';
161 161
 		$cols = $this->get_csv_cols();
162 162
 		$i = 1;
163
-		foreach( $cols as $col_id => $column ) {
164
-			$col_data .= '"' . addslashes( $column ) . '"';
165
-			$col_data .= $i == count( $cols ) ? '' : ',';
163
+		foreach ($cols as $col_id => $column) {
164
+			$col_data .= '"'.addslashes($column).'"';
165
+			$col_data .= $i == count($cols) ? '' : ',';
166 166
 			$i++;
167 167
 		}
168 168
 		$col_data .= "\r\n";
169 169
 
170
-		$this->stash_step_data( $col_data );
170
+		$this->stash_step_data($col_data);
171 171
 
172 172
 		return $col_data;
173 173
 
@@ -186,23 +186,23 @@  discard block
 block discarded – undo
186 186
 		$data     = $this->get_data();
187 187
 		$cols     = $this->get_csv_cols();
188 188
 
189
-		if( $data ) {
189
+		if ($data) {
190 190
 
191 191
 			// Output each row
192
-			foreach ( $data as $row ) {
192
+			foreach ($data as $row) {
193 193
 				$i = 1;
194
-				foreach ( $row as $col_id => $column ) {
194
+				foreach ($row as $col_id => $column) {
195 195
 					// Make sure the column is valid
196
-					if ( array_key_exists( $col_id, $cols ) ) {
197
-						$row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"';
198
-						$row_data .= $i == count( $cols ) ? '' : ',';
196
+					if (array_key_exists($col_id, $cols)) {
197
+						$row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"';
198
+						$row_data .= $i == count($cols) ? '' : ',';
199 199
 						$i++;
200 200
 					}
201 201
 				}
202 202
 				$row_data .= "\r\n";
203 203
 			}
204 204
 
205
-			$this->stash_step_data( $row_data );
205
+			$this->stash_step_data($row_data);
206 206
 
207 207
 			return $row_data;
208 208
 		}
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$file = '';
232 232
 
233
-		if ( @file_exists( $this->file ) ) {
233
+		if (@file_exists($this->file)) {
234 234
 
235
-			if ( ! is_writeable( $this->file ) ) {
235
+			if ( ! is_writeable($this->file)) {
236 236
 				$this->is_writable = false;
237 237
 			}
238 238
 
239
-			$file = @file_get_contents( $this->file );
239
+			$file = @file_get_contents($this->file);
240 240
 
241 241
 		} else {
242 242
 
243
-			@file_put_contents( $this->file, '' );
244
-			@chmod( $this->file, 0664 );
243
+			@file_put_contents($this->file, '');
244
+			@chmod($this->file, 0664);
245 245
 
246 246
 		}
247 247
 
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 	 * @param $data string The data to add to the file
256 256
 	 * @return void
257 257
 	 */
258
-	protected function stash_step_data( $data = '' ) {
258
+	protected function stash_step_data($data = '') {
259 259
 
260 260
 		$file = $this->get_file();
261 261
 		$file .= $data;
262
-		@file_put_contents( $this->file, $file );
262
+		@file_put_contents($this->file, $file);
263 263
 
264 264
 		// If we have no rows after this step, mark it as an empty export
265
-		$file_rows    = file( $this->file, FILE_SKIP_EMPTY_LINES);
265
+		$file_rows    = file($this->file, FILE_SKIP_EMPTY_LINES);
266 266
 		$default_cols = $this->get_csv_cols();
267
-		$default_cols = empty( $default_cols ) ? 0 : 1;
267
+		$default_cols = empty($default_cols) ? 0 : 1;
268 268
 
269
-		$this->is_empty = count( $file_rows ) == $default_cols ? true : false;
269
+		$this->is_empty = count($file_rows) == $default_cols ? true : false;
270 270
 
271 271
 	}
272 272
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
 		$file = $this->get_file();
286 286
 
287
-		@unlink( $this->file );
287
+		@unlink($this->file);
288 288
 
289 289
 		echo $file;
290 290
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @since 1.5
298 298
 	 * @param array $request The Form Data passed into the batch processing
299 299
 	 */
300
-	public function set_properties( $request ) {}
300
+	public function set_properties($request) {}
301 301
 
302 302
 	/**
303 303
 	 * Allow for prefetching of data for the remainder of the exporter
Please login to merge, or discard this patch.
admin/reporting/tools/class-give-tools-recount-single-customer-stats.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,8 +188,8 @@
 block discarded – undo
188 188
 
189 189
 			$payment_ids = implode( ',', $payment_ids );
190 190
 			$customer->update( array( 'payment_ids'    => $payment_ids,
191
-			                          'purchase_count' => $purchase_count,
192
-			                          'purchase_value' => $pending_total
191
+									  'purchase_count' => $purchase_count,
192
+									  'purchase_value' => $pending_total
193 193
 			) );
194 194
 
195 195
 			$this->done    = true;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 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
 
@@ -54,39 +54,39 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		$customer = new Give_Customer( $this->customer_id );
58
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $customer->id, array() );
57
+		$customer = new Give_Customer($this->customer_id);
58
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$customer->id, array());
59 59
 
60
-		$offset     = ( $this->step - 1 ) * $this->per_step;
61
-		$step_items = array_slice( $payments, $offset, $this->per_step );
60
+		$offset     = ($this->step - 1) * $this->per_step;
61
+		$step_items = array_slice($payments, $offset, $this->per_step);
62 62
 
63
-		if ( count( $step_items ) > 0 ) {
64
-			$pending_total = (float) $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
63
+		if (count($step_items) > 0) {
64
+			$pending_total = (float) $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
65 65
 			$step_total    = 0;
66 66
 
67
-			$found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $customer->id, array() );
67
+			$found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$customer->id, array());
68 68
 
69
-			foreach ( $step_items as $payment ) {
70
-				$payment = get_post( $payment->ID );
69
+			foreach ($step_items as $payment) {
70
+				$payment = get_post($payment->ID);
71 71
 
72
-				if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) {
72
+				if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) {
73 73
 
74
-					$missing_payments   = $this->get_stored_data( 'give_stats_missing_payments' . $customer->id, array() );
74
+					$missing_payments   = $this->get_stored_data('give_stats_missing_payments'.$customer->id, array());
75 75
 					$missing_payments[] = $payment->ID;
76
-					$this->store_data( 'give_stats_missing_payments' . $customer->id, $missing_payments );
76
+					$this->store_data('give_stats_missing_payments'.$customer->id, $missing_payments);
77 77
 
78 78
 					continue;
79 79
 				}
80 80
 
81 81
 				$should_process_payment = 'publish' == $payment->post_status || 'revoked' == $payment->post_status ? true : false;
82
-				$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
82
+				$should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
83 83
 
84
-				if ( true === $should_process_payment ) {
84
+				if (true === $should_process_payment) {
85 85
 
86 86
 					$found_payment_ids[] = $payment->ID;
87 87
 
88
-					if ( apply_filters( 'give_customer_recount_sholud_increase_value', true, $payment ) ) {
89
-						$payment_amount = give_get_payment_amount( $payment->ID );
88
+					if (apply_filters('give_customer_recount_sholud_increase_value', true, $payment)) {
89
+						$payment_amount = give_get_payment_amount($payment->ID);
90 90
 						$step_total += $payment_amount;
91 91
 					}
92 92
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 			}
96 96
 
97 97
 			$updated_total = $pending_total + $step_total;
98
-			$this->store_data( 'give_stats_customer_pending_total' . $customer->id, $updated_total );
99
-			$this->store_data( 'give_stats_found_payments_' . $customer->id, $found_payment_ids );
98
+			$this->store_data('give_stats_customer_pending_total'.$customer->id, $updated_total);
99
+			$this->store_data('give_stats_found_payments_'.$customer->id, $found_payment_ids);
100 100
 
101 101
 			return true;
102 102
 		}
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function get_percentage_complete() {
115 115
 
116
-		$payments = $this->get_stored_data( 'give_recount_customer_payments_' . $this->customer_id );
117
-		$total    = count( $payments );
116
+		$payments = $this->get_stored_data('give_recount_customer_payments_'.$this->customer_id);
117
+		$total    = count($payments);
118 118
 
119 119
 		$percentage = 100;
120 120
 
121
-		if ( $total > 0 ) {
122
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
121
+		if ($total > 0) {
122
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
123 123
 		}
124 124
 
125
-		if ( $percentage > 100 ) {
125
+		if ($percentage > 100) {
126 126
 			$percentage = 100;
127 127
 		}
128 128
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param array $request The Form Data passed into the batch processing
138 138
 	 */
139
-	public function set_properties( $request ) {
140
-		$this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false;
139
+	public function set_properties($request) {
140
+		$this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false;
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,62 +148,62 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function process_step() {
150 150
 
151
-		if ( ! $this->can_export() ) {
152
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
151
+		if ( ! $this->can_export()) {
152
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
153 153
 		}
154 154
 
155 155
 		$had_data = $this->get_data();
156 156
 
157
-		if ( $had_data ) {
157
+		if ($had_data) {
158 158
 			$this->done = false;
159 159
 
160 160
 			return true;
161 161
 		} else {
162
-			$customer    = new Give_Customer( $this->customer_id );
163
-			$payment_ids = get_option( 'give_stats_found_payments_' . $customer->id, array() );
164
-			$this->delete_data( 'give_stats_found_payments_' . $customer->id );
162
+			$customer    = new Give_Customer($this->customer_id);
163
+			$payment_ids = get_option('give_stats_found_payments_'.$customer->id, array());
164
+			$this->delete_data('give_stats_found_payments_'.$customer->id);
165 165
 
166
-			$removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $customer->id, array() ) );
166
+			$removed_payments = array_unique(get_option('give_stats_missing_payments'.$customer->id, array()));
167 167
 
168 168
 			// Find non-existing payments (deleted) and total up the purchase count
169 169
 			$purchase_count = 0;
170
-			foreach ( $payment_ids as $key => $payment_id ) {
171
-				if ( in_array( $payment_id, $removed_payments ) ) {
172
-					unset( $payment_ids[ $key ] );
170
+			foreach ($payment_ids as $key => $payment_id) {
171
+				if (in_array($payment_id, $removed_payments)) {
172
+					unset($payment_ids[$key]);
173 173
 					continue;
174 174
 				}
175 175
 
176
-				$payment = get_post( $payment_id );
177
-				if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
178
-					$purchase_count ++;
176
+				$payment = get_post($payment_id);
177
+				if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
178
+					$purchase_count++;
179 179
 				}
180 180
 			}
181 181
 
182
-			$this->delete_data( 'give_stats_missing_payments' . $customer->id );
182
+			$this->delete_data('give_stats_missing_payments'.$customer->id);
183 183
 
184
-			$pending_total = $this->get_stored_data( 'give_stats_customer_pending_total' . $customer->id, 0 );
185
-			$this->delete_data( 'give_stats_customer_pending_total' . $customer->id );
186
-			$this->delete_data( 'give_recount_customer_stats_' . $customer->id );
187
-			$this->delete_data( 'give_recount_customer_payments_' . $this->customer_id );
184
+			$pending_total = $this->get_stored_data('give_stats_customer_pending_total'.$customer->id, 0);
185
+			$this->delete_data('give_stats_customer_pending_total'.$customer->id);
186
+			$this->delete_data('give_recount_customer_stats_'.$customer->id);
187
+			$this->delete_data('give_recount_customer_payments_'.$this->customer_id);
188 188
 
189
-			$payment_ids = implode( ',', $payment_ids );
190
-			$customer->update( array( 'payment_ids'    => $payment_ids,
189
+			$payment_ids = implode(',', $payment_ids);
190
+			$customer->update(array('payment_ids'    => $payment_ids,
191 191
 			                          'purchase_count' => $purchase_count,
192 192
 			                          'purchase_value' => $pending_total
193
-			) );
193
+			));
194 194
 
195 195
 			$this->done    = true;
196
-			$this->message = esc_html__( 'Donor stats successfully recounted.', 'give' );
196
+			$this->message = esc_html__('Donor stats successfully recounted.', 'give');
197 197
 
198 198
 			return false;
199 199
 		}
200 200
 	}
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
 
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
 	 * @return void
231 231
 	 */
232 232
 	public function pre_fetch() {
233
-		if ( $this->step === 1 ) {
234
-			$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
233
+		if ($this->step === 1) {
234
+			$allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
235 235
 
236 236
 			// Before we start, let's zero out the customer's data
237
-			$customer = new Give_Customer( $this->customer_id );
238
-			$customer->update( array( 'purchase_value' => give_format_amount( 0 ), 'purchase_count' => 0 ) );
237
+			$customer = new Give_Customer($this->customer_id);
238
+			$customer->update(array('purchase_value' => give_format_amount(0), 'purchase_count' => 0));
239 239
 
240
-			$attached_payment_ids = explode( ',', $customer->payment_ids );
240
+			$attached_payment_ids = explode(',', $customer->payment_ids);
241 241
 
242 242
 			$attached_args = array(
243 243
 				'post__in' => $attached_payment_ids,
244
-				'number'   => - 1,
244
+				'number'   => -1,
245 245
 				'status'   => $allowed_post_status,
246 246
 			);
247 247
 
248
-			$attached_payments = give_get_payments( $attached_args );
248
+			$attached_payments = give_get_payments($attached_args);
249 249
 
250 250
 			$unattached_args = array(
251 251
 				'post__not_in' => $attached_payment_ids,
252
-				'number'       => - 1,
252
+				'number'       => -1,
253 253
 				'status'       => $allowed_post_status,
254 254
 				'meta_query'   => array(
255 255
 					array(
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				),
260 260
 			);
261 261
 
262
-			$unattached_payments = give_get_payments( $unattached_args );
262
+			$unattached_payments = give_get_payments($unattached_args);
263 263
 
264
-			$payments = array_merge( $attached_payments, $unattached_payments );
264
+			$payments = array_merge($attached_payments, $unattached_payments);
265 265
 
266
-			$this->store_data( 'give_recount_customer_payments_' . $customer->id, $payments );
266
+			$this->store_data('give_recount_customer_payments_'.$customer->id, $payments);
267 267
 		}
268 268
 	}
269 269
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 *
277 277
 	 * @return mixed       Returns the data from the database
278 278
 	 */
279
-	private function get_stored_data( $key ) {
279
+	private function get_stored_data($key) {
280 280
 		global $wpdb;
281
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
281
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
282 282
 
283
-		return empty( $value ) ? false : maybe_unserialize( $value );
283
+		return empty($value) ? false : maybe_unserialize($value);
284 284
 	}
285 285
 
286 286
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return void
295 295
 	 */
296
-	private function store_data( $key, $value ) {
296
+	private function store_data($key, $value) {
297 297
 		global $wpdb;
298 298
 
299
-		$value = maybe_serialize( $value );
299
+		$value = maybe_serialize($value);
300 300
 
301 301
 		$data = array(
302 302
 			'option_name'  => $key,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			'%s',
311 311
 		);
312 312
 
313
-		$wpdb->replace( $wpdb->options, $data, $formats );
313
+		$wpdb->replace($wpdb->options, $data, $formats);
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return void
324 324
 	 */
325
-	private function delete_data( $key ) {
325
+	private function delete_data($key) {
326 326
 		global $wpdb;
327
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
327
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
328 328
 	}
329 329
 
330 330
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/tools-actions.php 1 patch
Spacing   +31 added lines, -31 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
 
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
  * @since  1.5
20 20
  */
21 21
 function give_register_batch_recount_store_earnings_tool() {
22
-	add_action( 'give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1 );
22
+	add_action('give_batch_export_class_include', 'give_include_recount_income_tool_batch_processor', 10, 1);
23 23
 }
24 24
 
25
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10 );
25
+add_action('give_register_batch_exporter', 'give_register_batch_recount_store_earnings_tool', 10);
26 26
 
27 27
 /**
28 28
  * Loads the tools batch processing class for recounting store earnings
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * @return void
35 35
  */
36
-function give_include_recount_income_tool_batch_processor( $class ) {
36
+function give_include_recount_income_tool_batch_processor($class) {
37 37
 
38
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-income.php';
38
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-income.php';
39 39
 
40
-	if ( 'Give_Tools_Recount_Income' === $class && file_exists( $file_path ) ) {
40
+	if ('Give_Tools_Recount_Income' === $class && file_exists($file_path)) {
41 41
 		require_once $file_path;
42 42
 	}
43 43
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
  * @since  1.5
50 50
  */
51 51
 function give_register_batch_recount_form_tool() {
52
-	add_action( 'give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1 );
52
+	add_action('give_batch_export_class_include', 'give_include_recount_form_tool_batch_processor', 10, 1);
53 53
 }
54 54
 
55
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10 );
55
+add_action('give_register_batch_exporter', 'give_register_batch_recount_form_tool', 10);
56 56
 
57 57
 /**
58 58
  * Loads the tools batch processing class for recounting download stats
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
  *
64 64
  * @return void
65 65
  */
66
-function give_include_recount_form_tool_batch_processor( $class ) {
66
+function give_include_recount_form_tool_batch_processor($class) {
67 67
 
68
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
68
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-form-stats.php';
69 69
 
70
-	if ( 'Give_Tools_Recount_Form_Stats' === $class && file_exists( $file_path ) ) {
70
+	if ('Give_Tools_Recount_Form_Stats' === $class && file_exists($file_path)) {
71 71
 		require_once $file_path;
72 72
 	}
73 73
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
  * @since  1.5
79 79
  */
80 80
 function give_register_batch_recount_all_tool() {
81
-	add_action( 'give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1 );
81
+	add_action('give_batch_export_class_include', 'give_include_recount_all_tool_batch_processor', 10, 1);
82 82
 }
83 83
 
84
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10 );
84
+add_action('give_register_batch_exporter', 'give_register_batch_recount_all_tool', 10);
85 85
 
86 86
 /**
87 87
  * Loads the tools batch processing class for recounting all stats
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return void
94 94
  */
95
-function give_include_recount_all_tool_batch_processor( $class ) {
96
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
-	if ( 'Give_Tools_Recount_All_Stats' === $class && file_exists( $file_path ) ) {
95
+function give_include_recount_all_tool_batch_processor($class) {
96
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-all-stats.php';
97
+	if ('Give_Tools_Recount_All_Stats' === $class && file_exists($file_path)) {
98 98
 		require_once $file_path;
99 99
 	}
100 100
 
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
  * @since  1.5
107 107
  */
108 108
 function give_register_batch_reset_tool() {
109
-	add_action( 'give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1 );
109
+	add_action('give_batch_export_class_include', 'give_include_reset_tool_batch_processor', 10, 1);
110 110
 }
111 111
 
112
-add_action( 'give_register_batch_exporter', 'give_register_batch_reset_tool', 10 );
112
+add_action('give_register_batch_exporter', 'give_register_batch_reset_tool', 10);
113 113
 
114 114
 /**
115 115
  * Loads the tools batch processing class for resetting store and product earnings
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return void
122 122
  */
123
-function give_include_reset_tool_batch_processor( $class ) {
123
+function give_include_reset_tool_batch_processor($class) {
124 124
 
125
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
125
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-reset-stats.php';
126 126
 
127
-	if ( 'Give_Tools_Reset_Stats' === $class && file_exists( $file_path ) ) {
127
+	if ('Give_Tools_Reset_Stats' === $class && file_exists($file_path)) {
128 128
 		require_once $file_path;
129 129
 	}
130 130
 
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  * @since  1.5
136 136
  */
137 137
 function give_register_batch_customer_recount_tool() {
138
-	add_action( 'give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1 );
138
+	add_action('give_batch_export_class_include', 'give_include_customer_recount_tool_batch_processor', 10, 1);
139 139
 }
140 140
 
141
-add_action( 'give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10 );
141
+add_action('give_register_batch_exporter', 'give_register_batch_customer_recount_tool', 10);
142 142
 
143 143
 /**
144 144
  * Loads the tools batch processing class for resetting all customer stats
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
  *
150 150
  * @return void
151 151
  */
152
-function give_include_customer_recount_tool_batch_processor( $class ) {
152
+function give_include_customer_recount_tool_batch_processor($class) {
153 153
 
154
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
154
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php';
155 155
 
156
-	if ( 'Give_Tools_Recount_Customer_Stats' === $class && file_exists( $file_path ) ) {
156
+	if ('Give_Tools_Recount_Customer_Stats' === $class && file_exists($file_path)) {
157 157
 		require_once $file_path;
158 158
 	}
159 159
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
  * @since  1.5
165 165
  */
166 166
 function give_register_batch_delete_test_transactions_tool() {
167
-	add_action( 'give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1 );
167
+	add_action('give_batch_export_class_include', 'give_include_delete_test_transactions_batch_processor', 10, 1);
168 168
 }
169 169
 
170
-add_action( 'give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10 );
170
+add_action('give_register_batch_exporter', 'give_register_batch_delete_test_transactions_tool', 10);
171 171
 
172 172
 /**
173 173
  * Loads the tools batch processing class for resetting all customer stats
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return void
180 180
  */
181
-function give_include_delete_test_transactions_batch_processor( $class ) {
181
+function give_include_delete_test_transactions_batch_processor($class) {
182 182
 
183
-	$file_path = GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
183
+	$file_path = GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/class-give-tools-delete-test-transactions.php';
184 184
 
185
-	if ( 'Give_Tools_Delete_Test_Transactions' === $class && file_exists( $file_path ) ) {
185
+	if ('Give_Tools_Delete_Test_Transactions' === $class && file_exists($file_path)) {
186 186
 		require_once $file_path;
187 187
 	}
188 188
 
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 } // Exit if accessed directly
15 15
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 * @since   1.0
81 81
 	 * @return  object
82 82
 	 */
83
-	public function get( $row_id ) {
83
+	public function get($row_id) {
84 84
 		global $wpdb;
85 85
 
86
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
86
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @since   1.0
94 94
 	 * @return  object
95 95
 	 */
96
-	public function get_by( $column, $row_id ) {
96
+	public function get_by($column, $row_id) {
97 97
 		global $wpdb;
98
-		$column = esc_sql( $column );
99
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
98
+		$column = esc_sql($column);
99
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 * @since   1.0
107 107
 	 * @return  string
108 108
 	 */
109
-	public function get_column( $column, $row_id ) {
109
+	public function get_column($column, $row_id) {
110 110
 		global $wpdb;
111
-		$column = esc_sql( $column );
112
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
111
+		$column = esc_sql($column);
112
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @since   1.0
120 120
 	 * @return  string
121 121
 	 */
122
-	public function get_column_by( $column, $column_where, $column_value ) {
122
+	public function get_column_by($column, $column_where, $column_value) {
123 123
 		global $wpdb;
124
-		$column_where = esc_sql( $column_where );
125
-		$column       = esc_sql( $column );
126
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
124
+		$column_where = esc_sql($column_where);
125
+		$column       = esc_sql($column);
126
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
127 127
 	}
128 128
 
129 129
 	/**
@@ -133,30 +133,30 @@  discard block
 block discarded – undo
133 133
 	 * @since   1.0
134 134
 	 * @return  int
135 135
 	 */
136
-	public function insert( $data, $type = '' ) {
136
+	public function insert($data, $type = '') {
137 137
 		global $wpdb;
138 138
 
139 139
 		// Set default values
140
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
140
+		$data = wp_parse_args($data, $this->get_column_defaults());
141 141
 
142
-		do_action( 'give_pre_insert_' . $type, $data );
142
+		do_action('give_pre_insert_'.$type, $data);
143 143
 
144 144
 		// Initialise column format array
145 145
 		$column_formats = $this->get_columns();
146 146
 
147 147
 		// Force fields to lower case
148
-		$data = array_change_key_case( $data );
148
+		$data = array_change_key_case($data);
149 149
 
150 150
 		// White list columns
151
-		$data = array_intersect_key( $data, $column_formats );
151
+		$data = array_intersect_key($data, $column_formats);
152 152
 
153 153
 		// Reorder $column_formats to match the order of columns given in $data
154
-		$data_keys      = array_keys( $data );
155
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
154
+		$data_keys      = array_keys($data);
155
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
156 156
 
157
-		$wpdb->insert( $this->table_name, $data, $column_formats );
157
+		$wpdb->insert($this->table_name, $data, $column_formats);
158 158
 
159
-		do_action( 'give_post_insert_' . $type, $wpdb->insert_id, $data );
159
+		do_action('give_post_insert_'.$type, $wpdb->insert_id, $data);
160 160
 
161 161
 		return $wpdb->insert_id;
162 162
 	}
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
 	 * @since   1.0
169 169
 	 * @return  bool
170 170
 	 */
171
-	public function update( $row_id, $data = array(), $where = '' ) {
171
+	public function update($row_id, $data = array(), $where = '') {
172 172
 
173 173
 		global $wpdb;
174 174
 
175 175
 		// Row ID must be positive integer
176
-		$row_id = absint( $row_id );
176
+		$row_id = absint($row_id);
177 177
 
178
-		if ( empty( $row_id ) ) {
178
+		if (empty($row_id)) {
179 179
 			return false;
180 180
 		}
181 181
 
182
-		if ( empty( $where ) ) {
182
+		if (empty($where)) {
183 183
 			$where = $this->primary_key;
184 184
 		}
185 185
 
@@ -187,16 +187,16 @@  discard block
 block discarded – undo
187 187
 		$column_formats = $this->get_columns();
188 188
 
189 189
 		// Force fields to lower case
190
-		$data = array_change_key_case( $data );
190
+		$data = array_change_key_case($data);
191 191
 
192 192
 		// White list columns
193
-		$data = array_intersect_key( $data, $column_formats );
193
+		$data = array_intersect_key($data, $column_formats);
194 194
 
195 195
 		// Reorder $column_formats to match the order of columns given in $data
196
-		$data_keys      = array_keys( $data );
197
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
196
+		$data_keys      = array_keys($data);
197
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
198 198
 
199
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
199
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
200 200
 			return false;
201 201
 		}
202 202
 
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
 	 * @since   1.0
211 211
 	 * @return  bool
212 212
 	 */
213
-	public function delete( $row_id = 0 ) {
213
+	public function delete($row_id = 0) {
214 214
 
215 215
 		global $wpdb;
216 216
 
217 217
 		// Row ID must be positive integer
218
-		$row_id = absint( $row_id );
218
+		$row_id = absint($row_id);
219 219
 
220
-		if ( empty( $row_id ) ) {
220
+		if (empty($row_id)) {
221 221
 			return false;
222 222
 		}
223 223
 
224
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
224
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
225 225
 			return false;
226 226
 		}
227 227
 
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 * @param  string $table The table name
236 236
 	 * @return bool          If the table name exists
237 237
 	 */
238
-	public function table_exists( $table ) {
238
+	public function table_exists($table) {
239 239
 		global $wpdb;
240
-		$table = sanitize_text_field( $table );
240
+		$table = sanitize_text_field($table);
241 241
 
242
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
242
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
243 243
 	}
244 244
 
245 245
 }
246 246
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 * Retrieve a row by a specific column / value
96 96
 	 *
97 97
 	 * @access  public
98
-     *
98
+	 *
99 99
 	 * @since   1.0
100 100
 	 *
101
-     * @param int $column Column ID
102
-     * @param int $row_id Row ID
103
-     *
104
-     * @return  object
101
+	 * @param int $column Column ID
102
+	 * @param int $row_id Row ID
103
+	 *
104
+	 * @return  object
105 105
 	 */
106 106
 	public function get_by( $column, $row_id ) {
107
-        /* @var WPDB $wpdb */
108
-        global $wpdb;
107
+		/* @var WPDB $wpdb */
108
+		global $wpdb;
109 109
 
110 110
 		$column = esc_sql( $column );
111 111
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
 	 * Retrieve a specific column's value by the primary key
116 116
 	 *
117 117
 	 * @access  public
118
-     *
118
+	 *
119 119
 	 * @since   1.0
120
-     *
121
-     * @param int $column Column ID
122
-     * @param int $row_id Row ID
123
-     *
120
+	 *
121
+	 * @param int $column Column ID
122
+	 * @param int $row_id Row ID
123
+	 *
124 124
 	 * @return  string
125 125
 	 */
126 126
 	public function get_column( $column, $row_id ) {
127
-        /* @var WPDB $wpdb */
128
-        global $wpdb;
127
+		/* @var WPDB $wpdb */
128
+		global $wpdb;
129 129
 
130 130
 		$column = esc_sql( $column );
131 131
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 	 * Retrieve a specific column's value by the the specified column / value
136 136
 	 *
137 137
 	 * @access  public
138
-     *
138
+	 *
139 139
 	 * @since   1.0
140
-     *
141
-     * @param int       $column         Column ID
142
-     * @param string    $column_where   Column name
143
-     * @param string    $column_value   Column value
144
-     *
140
+	 *
141
+	 * @param int       $column         Column ID
142
+	 * @param string    $column_where   Column name
143
+	 * @param string    $column_value   Column value
144
+	 *
145 145
 	 * @return  string
146 146
 	 */
147 147
 	public function get_column_by( $column, $column_where, $column_value ) {
148
-        /* @var WPDB $wpdb */
149
-        global $wpdb;
148
+		/* @var WPDB $wpdb */
149
+		global $wpdb;
150 150
 
151 151
 		$column_where = esc_sql( $column_where );
152 152
 		$column       = esc_sql( $column );
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	 * Insert a new row
158 158
 	 *
159 159
 	 * @access  public
160
-     *
160
+	 *
161 161
 	 * @since   1.0
162
-     *
163
-     * @param array  $data
164
-     * @param string $type
165
-     *
162
+	 *
163
+	 * @param array  $data
164
+	 * @param string $type
165
+	 *
166 166
 	 * @return  int
167 167
 	 */
168 168
 	public function insert( $data, $type = '' ) {
169
-        /* @var WPDB $wpdb */
170
-        global $wpdb;
169
+		/* @var WPDB $wpdb */
170
+		global $wpdb;
171 171
 
172 172
 		// Set default values
173 173
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
 	 * Update a row
199 199
 	 *
200 200
 	 * @access  public
201
-     *
201
+	 *
202 202
 	 * @since   1.0
203
-     *
204
-     * @param int       $row_id     Column ID
205
-     * @param array     $data
206
-     * @param string    $where      Column value
207
-     *
203
+	 *
204
+	 * @param int       $row_id     Column ID
205
+	 * @param array     $data
206
+	 * @param string    $where      Column value
207
+	 *
208 208
 	 * @return  bool
209 209
 	 */
210 210
 	public function update( $row_id, $data = array(), $where = '' ) {
211
-        /* @var WPDB $wpdb */
212
-        global $wpdb;
211
+		/* @var WPDB $wpdb */
212
+		global $wpdb;
213 213
 
214 214
 		// Row ID must be positive integer
215 215
 		$row_id = absint( $row_id );
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 	 * Delete a row identified by the primary key
247 247
 	 *
248 248
 	 * @access  public
249
-     *
249
+	 *
250 250
 	 * @since   1.0
251
-     *
252
-     * @param int $row_id Column ID
253
-     *
251
+	 *
252
+	 * @param int $row_id Column ID
253
+	 *
254 254
 	 * @return  bool
255 255
 	 */
256 256
 	public function delete( $row_id = 0 ) {
257
-        /* @var WPDB $wpdb */
258
-        global $wpdb;
257
+		/* @var WPDB $wpdb */
258
+		global $wpdb;
259 259
 
260 260
 		// Row ID must be positive integer
261 261
 		$row_id = absint( $row_id );
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return bool          If the table name exists
280 280
 	 */
281 281
 	public function table_exists( $table ) {
282
-        /* @var WPDB $wpdb */
282
+		/* @var WPDB $wpdb */
283 283
 		global $wpdb;
284 284
 
285 285
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param $url
83 83
 	 *
84
-	 * @return mixed
84
+	 * @return string
85 85
 	 */
86 86
 	public function give_update_cmb_meta_box_url( $url ) {
87 87
 		//Path to Give's CMB
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  * @since 1.0
768 768
  *
769 769
  * @param string $key The Key to update
770
- * @param string|bool|int $value The value to set the key to
770
+ * @param integer $value The value to set the key to
771 771
  *
772 772
  * @return boolean True if updated, false if not.
773 773
  */
Please login to merge, or discard this patch.
Spacing   +312 added lines, -312 removed lines patch added patch discarded remove patch
@@ -46,26 +46,26 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function __construct() {
48 48
 
49
-		add_action( 'admin_init', array( $this, 'init' ) );
49
+		add_action('admin_init', array($this, 'init'));
50 50
 
51 51
 		//Customize CMB2 URL
52
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
52
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
53 53
 
54 54
 		//Custom CMB2 Settings Fields
55
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
56
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
57
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
58
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
59
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
60
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
61
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
62
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
63
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
55
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
56
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
57
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
58
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
59
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
60
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
61
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
62
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
63
+		add_action('admin_notices', array($this, 'settings_notices'));
64 64
 
65 65
 		// Include CMB CSS in the head to avoid FOUC
66
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
66
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
67 67
 
68
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
68
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
69 69
 
70 70
 	}
71 71
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @since  1.0
77 77
 	 */
78 78
 	public function init() {
79
-		register_setting( $this->key, $this->key );
79
+		register_setting($this->key, $this->key);
80 80
 
81 81
 	}
82 82
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return mixed
92 92
 	 */
93
-	public function give_update_cmb_meta_box_url( $url ) {
93
+	public function give_update_cmb_meta_box_url($url) {
94 94
 		//Path to Give's CMB
95
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
95
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
96 96
 	}
97 97
 
98 98
 
@@ -104,27 +104,27 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function give_get_settings_tabs() {
106 106
 
107
-		$settings = $this->give_settings( null );
107
+		$settings = $this->give_settings(null);
108 108
 
109 109
 		$tabs             = array();
110
-		$tabs['general']  = esc_html__( 'General', 'give' );
111
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
112
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
113
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
110
+		$tabs['general']  = esc_html__('General', 'give');
111
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
112
+		$tabs['display']  = esc_html__('Display Options', 'give');
113
+		$tabs['emails']   = esc_html__('Emails', 'give');
114 114
 
115
-		if ( ! empty( $settings['addons']['fields'] ) ) {
116
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
115
+		if ( ! empty($settings['addons']['fields'])) {
116
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
117 117
 		}
118 118
 
119
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
120
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
119
+		if ( ! empty($settings['licenses']['fields'])) {
120
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
121 121
 		}
122 122
 
123
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
124
-		$tabs['api']         = esc_html__( 'API', 'give' );
125
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
123
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
124
+		$tabs['api']         = esc_html__('API', 'give');
125
+		$tabs['system_info'] = esc_html__('System Info', 'give');
126 126
 
127
-		return apply_filters( 'give_settings_tabs', $tabs );
127
+		return apply_filters('give_settings_tabs', $tabs);
128 128
 	}
129 129
 
130 130
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function admin_page_display() {
136 136
 
137
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
137
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
138 138
 
139 139
 		?>
140 140
 
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
 
143 143
 			<h1 class="nav-tab-wrapper">
144 144
 				<?php
145
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
145
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
146 146
 
147 147
 					//Support legacy tab creation conditions based off $_GET parameter
148 148
 					//We pass the $_GET['tab'] to conditions executed later
149 149
 					$_GET['tab'] = $tab_id;
150 150
 
151
-					$tab_url = esc_url( add_query_arg( array(
151
+					$tab_url = esc_url(add_query_arg(array(
152 152
 						'settings-updated' => false,
153 153
 						'tab'              => $tab_id
154
-					) ) );
154
+					)));
155 155
 
156 156
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
157 157
 
158
-					echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
158
+					echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
159 159
 
160 160
 				}
161 161
 				?>
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
 
164 164
 			<?php
165 165
 			//Loop through and output settings
166
-			foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
166
+			foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
167 167
 
168 168
 				//Support legacy tab creation conditions based off $_GET parameter
169 169
 				//We 'trick' the conditions into thinking this is the tab
170 170
 				$_GET['tab'] = $tab_id;
171 171
 
172
-				$tab_settings = $this->give_settings( $tab_id );
172
+				$tab_settings = $this->give_settings($tab_id);
173 173
 
174 174
 				//Pass active tab within $tab_settings so we can hide with CSS via PHP
175
-				if ( $active_tab == $tab_id ) {
175
+				if ($active_tab == $tab_id) {
176 176
 					$tab_settings['active_tab'] = true;
177 177
 				}
178 178
 
179
-				cmb2_metabox_form( $tab_settings, $this->key );
179
+				cmb2_metabox_form($tab_settings, $this->key);
180 180
 
181 181
 			} ?>
182 182
 
@@ -194,34 +194,34 @@  discard block
 block discarded – undo
194 194
 	 * @since 1.5 Modified to CSS hide non-active tabs
195 195
 	 * @since 1.0
196 196
 	 */
197
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
197
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
198 198
 
199 199
 
200
-		$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
200
+		$pagenow = isset($_GET['page']) ? $_GET['page'] : '';
201 201
 
202 202
 		//only modify the give settings form
203
-		if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) {
203
+		if ('give_settings' == $object_id && $pagenow == 'give-settings') {
204 204
 
205 205
 			$style = '';
206
-			if ( ! isset( $cmb->meta_box['active_tab'] ) ) {
206
+			if ( ! isset($cmb->meta_box['active_tab'])) {
207 207
 				$style = 'style="display:none;"';
208 208
 			}
209 209
 
210 210
 			//Set ID based off tab name - protects backwards compatibility
211
-			$tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id'];
211
+			$tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id'];
212 212
 
213
-			$save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div>' );
213
+			$save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div>');
214 214
 
215 215
 			//Filter so some tabs won't have save settings
216
-			$no_save_button = apply_filters( 'give_settings_no_save_output', array(
216
+			$no_save_button = apply_filters('give_settings_no_save_output', array(
217 217
 				'system_info'
218
-			) );
218
+			));
219 219
 
220
-			if ( in_array( $tab_id, $no_save_button ) ) {
220
+			if (in_array($tab_id, $no_save_button)) {
221 221
 				$save_button = '';
222 222
 			}
223 223
 
224
-			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>';
224
+			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>';
225 225
 
226 226
 		}
227 227
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return array
240 240
 	 */
241
-	public function give_settings( $active_tab ) {
241
+	public function give_settings($active_tab) {
242 242
 
243 243
 		$give_settings = array(
244 244
 			/**
@@ -246,92 +246,92 @@  discard block
 block discarded – undo
246 246
 			 */
247 247
 			'general'     => array(
248 248
 				'id'         => 'general_settings',
249
-				'give_title' => esc_html__( 'General Settings', 'give' ),
250
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
251
-				'fields'     => apply_filters( 'give_settings_general', array(
249
+				'give_title' => esc_html__('General Settings', 'give'),
250
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
251
+				'fields'     => apply_filters('give_settings_general', array(
252 252
 						array(
253
-							'name' => esc_html__( 'General Settings', 'give' ),
253
+							'name' => esc_html__('General Settings', 'give'),
254 254
 							'desc' => '',
255 255
 							'type' => 'give_title',
256 256
 							'id'   => 'give_title_general_settings_1'
257 257
 						),
258 258
 						array(
259
-							'name'    => esc_html__( 'Success Page', 'give' ),
259
+							'name'    => esc_html__('Success Page', 'give'),
260 260
 							/* translators: %s: [give_receipt] */
261
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
261
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
262 262
 							'id'      => 'success_page',
263 263
 							'type'    => 'select',
264
-							'options' => give_cmb2_get_post_options( array(
264
+							'options' => give_cmb2_get_post_options(array(
265 265
 								'post_type'   => 'page',
266
-								'numberposts' => - 1
267
-							) ),
266
+								'numberposts' => -1
267
+							)),
268 268
 						),
269 269
 						array(
270
-							'name'    => esc_html__( 'Failed Transaction Page', 'give' ),
271
-							'desc'    => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
270
+							'name'    => esc_html__('Failed Transaction Page', 'give'),
271
+							'desc'    => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
272 272
 							'id'      => 'failure_page',
273 273
 							'type'    => 'select',
274
-							'options' => give_cmb2_get_post_options( array(
274
+							'options' => give_cmb2_get_post_options(array(
275 275
 								'post_type'   => 'page',
276
-								'numberposts' => - 1
277
-							) ),
276
+								'numberposts' => -1
277
+							)),
278 278
 						),
279 279
 						array(
280
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
280
+							'name'    => esc_html__('Donation History Page', 'give'),
281 281
 							/* translators: %s: [donation_history] */
282
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
282
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
283 283
 							'id'      => 'history_page',
284 284
 							'type'    => 'select',
285
-							'options' => give_cmb2_get_post_options( array(
285
+							'options' => give_cmb2_get_post_options(array(
286 286
 								'post_type'   => 'page',
287
-								'numberposts' => - 1
288
-							) ),
287
+								'numberposts' => -1
288
+							)),
289 289
 						),
290 290
 						array(
291
-							'name'    => esc_html__( 'Base Country', 'give' ),
292
-							'desc'    => esc_html__( 'Where does your site operate from?', 'give' ),
291
+							'name'    => esc_html__('Base Country', 'give'),
292
+							'desc'    => esc_html__('Where does your site operate from?', 'give'),
293 293
 							'id'      => 'base_country',
294 294
 							'type'    => 'select',
295 295
 							'options' => give_get_country_list(),
296 296
 						),
297 297
 						array(
298
-							'name' => esc_html__( 'Currency Settings', 'give' ),
298
+							'name' => esc_html__('Currency Settings', 'give'),
299 299
 							'desc' => '',
300 300
 							'type' => 'give_title',
301 301
 							'id'   => 'give_title_general_settings_2'
302 302
 						),
303 303
 						array(
304
-							'name'    => esc_html__( 'Currency', 'give' ),
305
-							'desc'    => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'give' ),
304
+							'name'    => esc_html__('Currency', 'give'),
305
+							'desc'    => esc_html__('Choose your currency. Note that some payment gateways have currency restrictions.', 'give'),
306 306
 							'id'      => 'currency',
307 307
 							'type'    => 'select',
308 308
 							'options' => give_get_currencies(),
309 309
 							'default' => 'USD',
310 310
 						),
311 311
 						array(
312
-							'name'    => esc_html__( 'Currency Position', 'give' ),
313
-							'desc'    => esc_html__( 'Choose the position of the currency sign.', 'give' ),
312
+							'name'    => esc_html__('Currency Position', 'give'),
313
+							'desc'    => esc_html__('Choose the position of the currency sign.', 'give'),
314 314
 							'id'      => 'currency_position',
315 315
 							'type'    => 'select',
316 316
 							'options' => array(
317 317
 								/* translators: %s: currency symbol */
318
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
318
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
319 319
 								/* translators: %s: currency symbol */
320
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
320
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
321 321
 							),
322 322
 							'default' => 'before',
323 323
 						),
324 324
 						array(
325
-							'name'    => esc_html__( 'Thousands Separator', 'give' ),
326
-							'desc'    => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
325
+							'name'    => esc_html__('Thousands Separator', 'give'),
326
+							'desc'    => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
327 327
 							'id'      => 'thousands_separator',
328 328
 							'type'    => 'text_small',
329 329
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
330 330
 							'default' => ',',
331 331
 						),
332 332
 						array(
333
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
334
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
333
+							'name'    => esc_html__('Decimal Separator', 'give'),
334
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
335 335
 							'id'      => 'decimal_separator',
336 336
 							'type'    => 'text_small',
337 337
 							'default' => '.',
@@ -344,83 +344,83 @@  discard block
 block discarded – undo
344 344
 			 */
345 345
 			'gateways'    => array(
346 346
 				'id'         => 'payment_gateways',
347
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
348
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
349
-				'fields'     => apply_filters( 'give_settings_gateways', array(
347
+				'give_title' => esc_html__('Payment Gateways', 'give'),
348
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
349
+				'fields'     => apply_filters('give_settings_gateways', array(
350 350
 						array(
351
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
351
+							'name' => esc_html__('Gateways Settings', 'give'),
352 352
 							'desc' => '',
353 353
 							'id'   => 'give_title_gateway_settings_1',
354 354
 							'type' => 'give_title'
355 355
 						),
356 356
 						array(
357
-							'name' => esc_html__( 'Test Mode', 'give' ),
358
-							'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
357
+							'name' => esc_html__('Test Mode', 'give'),
358
+							'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
359 359
 							'id'   => 'test_mode',
360 360
 							'type' => 'checkbox'
361 361
 						),
362 362
 						array(
363
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
364
-							'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
363
+							'name' => esc_html__('Enabled Gateways', 'give'),
364
+							'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
365 365
 							'id'   => 'gateways',
366 366
 							'type' => 'enabled_gateways'
367 367
 						),
368 368
 						array(
369
-							'name' => esc_html__( 'Default Gateway', 'give' ),
370
-							'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ),
369
+							'name' => esc_html__('Default Gateway', 'give'),
370
+							'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'),
371 371
 							'id'   => 'default_gateway',
372 372
 							'type' => 'default_gateway'
373 373
 						),
374 374
 						array(
375
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
375
+							'name' => esc_html__('PayPal Standard', 'give'),
376 376
 							'desc' => '',
377 377
 							'type' => 'give_title',
378 378
 							'id'   => 'give_title_gateway_settings_2',
379 379
 						),
380 380
 						array(
381
-							'name' => esc_html__( 'PayPal Email', 'give' ),
382
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
381
+							'name' => esc_html__('PayPal Email', 'give'),
382
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
383 383
 							'id'   => 'paypal_email',
384 384
 							'type' => 'text_email',
385 385
 						),
386 386
 						array(
387
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
388
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
387
+							'name' => esc_html__('PayPal Page Style', 'give'),
388
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
389 389
 							'id'   => 'paypal_page_style',
390 390
 							'type' => 'text',
391 391
 						),
392 392
 						array(
393
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
394
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
393
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
394
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
395 395
 							'id'      => 'paypal_button_type',
396 396
 							'type'    => 'radio_inline',
397 397
 							'options' => array(
398
-								'donation' => esc_html__( 'Donation', 'give' ),
399
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
398
+								'donation' => esc_html__('Donation', 'give'),
399
+								'standard' => esc_html__('Standard Transaction', 'give')
400 400
 							),
401 401
 							'default' => 'donation',
402 402
 						),
403 403
 						array(
404
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
405
-							'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
404
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
405
+							'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
406 406
 							'id'   => 'disable_paypal_verification',
407 407
 							'type' => 'checkbox'
408 408
 						),
409 409
 						array(
410
-							'name' => esc_html__( 'Offline Donations', 'give' ),
410
+							'name' => esc_html__('Offline Donations', 'give'),
411 411
 							'desc' => '',
412 412
 							'type' => 'give_title',
413 413
 							'id'   => 'give_title_gateway_settings_3',
414 414
 						),
415 415
 						array(
416
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
417
-							'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
416
+							'name' => esc_html__('Collect Billing Details', 'give'),
417
+							'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
418 418
 							'id'   => 'give_offline_donation_enable_billing_fields',
419 419
 							'type' => 'checkbox'
420 420
 						),
421 421
 						array(
422
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
423
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
422
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
423
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
424 424
 							'id'      => 'global_offline_donation_content',
425 425
 							'default' => give_get_default_offline_donation_content(),
426 426
 							'type'    => 'wysiwyg',
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
 							)
430 430
 						),
431 431
 						array(
432
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
433
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
432
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
433
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
434 434
 							'id'      => 'offline_donation_subject',
435
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
435
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
436 436
 							'type'    => 'text'
437 437
 						),
438 438
 						array(
439
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
440
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
439
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
440
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
441 441
 							'id'      => 'global_offline_donation_email',
442 442
 							'default' => give_get_default_offline_donation_email_content(),
443 443
 							'type'    => 'wysiwyg',
@@ -451,95 +451,95 @@  discard block
 block discarded – undo
451 451
 			/** Display Settings */
452 452
 			'display'     => array(
453 453
 				'id'         => 'display_settings',
454
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
455
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
456
-				'fields'     => apply_filters( 'give_settings_display', array(
454
+				'give_title' => esc_html__('Display Settings', 'give'),
455
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
456
+				'fields'     => apply_filters('give_settings_display', array(
457 457
 						array(
458
-							'name' => esc_html__( 'Display Settings', 'give' ),
458
+							'name' => esc_html__('Display Settings', 'give'),
459 459
 							'desc' => '',
460 460
 							'id'   => 'give_title_display_settings_1',
461 461
 							'type' => 'give_title'
462 462
 						),
463 463
 						array(
464
-							'name' => esc_html__( 'Disable CSS', 'give' ),
465
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
464
+							'name' => esc_html__('Disable CSS', 'give'),
465
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
466 466
 							'id'   => 'disable_css',
467 467
 							'type' => 'checkbox'
468 468
 						),
469 469
 						array(
470
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
470
+							'name' => esc_html__('Enable Floating Labels', 'give'),
471 471
 							/* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */
472
-							'desc' => sprintf( wp_kses ( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ) , array(  'a' => array( 'href' => array() ) ) ), esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' ) ),
472
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array()))), esc_url('http://bradfrost.com/blog/post/float-label-pattern/')),
473 473
 							'id'   => 'enable_floatlabels',
474 474
 							'type' => 'checkbox'
475 475
 						),
476 476
 						array(
477
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
477
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
478 478
 							/* translators: %s: about page URL */
479
-							'desc' => sprintf( wp_kses ( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), array(  'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
479
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), array('a' => array('href' => array()))), esc_url(admin_url('index.php?page=give-about'))),
480 480
 							'id'   => 'disable_welcome',
481 481
 							'type' => 'checkbox'
482 482
 						),
483 483
 						array(
484
-							'name' => esc_html__( 'Post Types', 'give' ),
484
+							'name' => esc_html__('Post Types', 'give'),
485 485
 							'desc' => '',
486 486
 							'id'   => 'give_title_display_settings_2',
487 487
 							'type' => 'give_title'
488 488
 						),
489 489
 						array(
490
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
491
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
490
+							'name' => esc_html__('Disable Form Single Views', 'give'),
491
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
492 492
 							'id'   => 'disable_forms_singular',
493 493
 							'type' => 'checkbox'
494 494
 						),
495 495
 						array(
496
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
497
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
496
+							'name' => esc_html__('Disable Form Archives', 'give'),
497
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
498 498
 							'id'   => 'disable_forms_archives',
499 499
 							'type' => 'checkbox'
500 500
 						),
501 501
 						array(
502
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
503
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
502
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
503
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
504 504
 							'id'   => 'disable_forms_excerpt',
505 505
 							'type' => 'checkbox'
506 506
 						),
507 507
 
508 508
 						array(
509
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
510
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
509
+							'name'    => esc_html__('Featured Image Size', 'give'),
510
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
511 511
 							'id'      => 'featured_image_size',
512 512
 							'type'    => 'select',
513 513
 							'default' => 'large',
514 514
 							'options' => give_get_featured_image_sizes()
515 515
 						),
516 516
 						array(
517
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
518
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
517
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
518
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
519 519
 							'id'   => 'disable_form_featured_img',
520 520
 							'type' => 'checkbox'
521 521
 						),
522 522
 						array(
523
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
524
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
523
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
524
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
525 525
 							'id'   => 'disable_form_sidebar',
526 526
 							'type' => 'checkbox'
527 527
 						),
528 528
 						array(
529
-							'name' => esc_html__( 'Taxonomies', 'give' ),
529
+							'name' => esc_html__('Taxonomies', 'give'),
530 530
 							'desc' => '',
531 531
 							'id'   => 'give_title_display_settings_3',
532 532
 							'type' => 'give_title'
533 533
 						),
534 534
 						array(
535
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
536
-							'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
535
+							'name' => esc_html__('Enable Form Categories', 'give'),
536
+							'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
537 537
 							'id'   => 'enable_categories',
538 538
 							'type' => 'checkbox'
539 539
 						),
540 540
 						array(
541
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
542
-							'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
541
+							'name' => esc_html__('Enable Form Tags', 'give'),
542
+							'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
543 543
 							'id'   => 'enable_tags',
544 544
 							'type' => 'checkbox'
545 545
 						),
@@ -552,95 +552,95 @@  discard block
 block discarded – undo
552 552
 			 */
553 553
 			'emails'      => array(
554 554
 				'id'         => 'email_settings',
555
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
556
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
557
-				'fields'     => apply_filters( 'give_settings_emails', array(
555
+				'give_title' => esc_html__('Email Settings', 'give'),
556
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
557
+				'fields'     => apply_filters('give_settings_emails', array(
558 558
 						array(
559
-							'name' => esc_html__( 'Email Settings', 'give' ),
559
+							'name' => esc_html__('Email Settings', 'give'),
560 560
 							'desc' => '',
561 561
 							'id'   => 'give_title_email_settings_1',
562 562
 							'type' => 'give_title'
563 563
 						),
564 564
 						array(
565 565
 							'id'      => 'email_template',
566
-							'name'    => esc_html__( 'Email Template', 'give' ),
567
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
566
+							'name'    => esc_html__('Email Template', 'give'),
567
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
568 568
 							'type'    => 'select',
569 569
 							'options' => give_get_email_templates()
570 570
 						),
571 571
 						array(
572 572
 							'id'   => 'email_logo',
573
-							'name' => esc_html__( 'Logo', 'give' ),
574
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
573
+							'name' => esc_html__('Logo', 'give'),
574
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
575 575
 							'type' => 'file'
576 576
 						),
577 577
 						array(
578 578
 							'id'      => 'from_name',
579
-							'name'    => esc_html__( 'From Name', 'give' ),
580
-							'desc'    => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
581
-							'default' => get_bloginfo( 'name' ),
579
+							'name'    => esc_html__('From Name', 'give'),
580
+							'desc'    => esc_html__('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
581
+							'default' => get_bloginfo('name'),
582 582
 							'type'    => 'text'
583 583
 						),
584 584
 						array(
585 585
 							'id'      => 'from_email',
586
-							'name'    => esc_html__( 'From Email', 'give' ),
587
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
588
-							'default' => get_bloginfo( 'admin_email' ),
586
+							'name'    => esc_html__('From Email', 'give'),
587
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
588
+							'default' => get_bloginfo('admin_email'),
589 589
 							'type'    => 'text'
590 590
 						),
591 591
 						array(
592
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
592
+							'name' => esc_html__('Donation Receipt', 'give'),
593 593
 							'desc' => '',
594 594
 							'id'   => 'give_title_email_settings_2',
595 595
 							'type' => 'give_title'
596 596
 						),
597 597
 						array(
598 598
 							'id'      => 'donation_subject',
599
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
600
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
601
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
599
+							'name'    => esc_html__('Donation Email Subject', 'give'),
600
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
601
+							'default' => esc_attr__('Donation Receipt', 'give'),
602 602
 							'type'    => 'text'
603 603
 						),
604 604
 						array(
605 605
 							'id'      => 'donation_receipt',
606
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
606
+							'name'    => esc_html__('Donation Receipt', 'give'),
607 607
 							/* translators: %s: emails tags list */
608
-							'desc'    => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
608
+							'desc'    => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
609 609
 							'type'    => 'wysiwyg',
610 610
 							'default' => give_get_default_donation_receipt_email()
611 611
 						),
612 612
 						array(
613
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
613
+							'name' => esc_html__('New Donation Notification', 'give'),
614 614
 							'desc' => '',
615 615
 							'id'   => 'give_title_email_settings_3',
616 616
 							'type' => 'give_title'
617 617
 						),
618 618
 						array(
619 619
 							'id'      => 'donation_notification_subject',
620
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
621
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
620
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
621
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
622 622
 							'type'    => 'text',
623
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
623
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
624 624
 						),
625 625
 						array(
626 626
 							'id'      => 'donation_notification',
627
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
627
+							'name'    => esc_html__('Donation Notification', 'give'),
628 628
 							/* translators: %s: emails tags list */
629
-							'desc'    => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
629
+							'desc'    => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
630 630
 							'type'    => 'wysiwyg',
631 631
 							'default' => give_get_default_donation_notification_email()
632 632
 						),
633 633
 						array(
634 634
 							'id'      => 'admin_notice_emails',
635
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
636
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give' ),
635
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
636
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and not separated by commas.', 'give'),
637 637
 							'type'    => 'textarea',
638
-							'default' => get_bloginfo( 'admin_email' )
638
+							'default' => get_bloginfo('admin_email')
639 639
 						),
640 640
 						array(
641 641
 							'id'   => 'disable_admin_notices',
642
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
643
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
642
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
643
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
644 644
 							'type' => 'checkbox'
645 645
 						)
646 646
 					)
@@ -649,99 +649,99 @@  discard block
 block discarded – undo
649 649
 			/** Extension Settings */
650 650
 			'addons'      => array(
651 651
 				'id'         => 'addons',
652
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
653
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
654
-				'fields'     => apply_filters( 'give_settings_addons', array()
652
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
653
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
654
+				'fields'     => apply_filters('give_settings_addons', array()
655 655
 				)
656 656
 			),
657 657
 			/** Licenses Settings */
658 658
 			'licenses'    => array(
659 659
 				'id'         => 'licenses',
660
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
661
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
662
-				'fields'     => apply_filters( 'give_settings_licenses', array()
660
+				'give_title' => esc_html__('Give Licenses', 'give'),
661
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
662
+				'fields'     => apply_filters('give_settings_licenses', array()
663 663
 				)
664 664
 			),
665 665
 			/** Advanced Options */
666 666
 			'advanced'    => array(
667 667
 				'id'         => 'advanced_options',
668
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
669
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
670
-				'fields'     => apply_filters( 'give_settings_advanced', array(
668
+				'give_title' => esc_html__('Advanced Options', 'give'),
669
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
670
+				'fields'     => apply_filters('give_settings_advanced', array(
671 671
 						array(
672
-							'name' => esc_html__( 'Access Control', 'give' ),
672
+							'name' => esc_html__('Access Control', 'give'),
673 673
 							'desc' => '',
674 674
 							'id'   => 'give_title_session_control_1',
675 675
 							'type' => 'give_title'
676 676
 						),
677 677
 						array(
678 678
 							'id'      => 'session_lifetime',
679
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
680
-							'desc'    => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
679
+							'name'    => esc_html__('Session Lifetime', 'give'),
680
+							'desc'    => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
681 681
 							'type'    => 'select',
682 682
 							'options' => array(
683
-								'86400'  => esc_html__( '24 Hours', 'give' ),
684
-								'172800' => esc_html__( '48 Hours', 'give' ),
685
-								'259200' => esc_html__( '72 Hours', 'give' ),
686
-								'604800' => esc_html__( '1 Week', 'give' ),
683
+								'86400'  => esc_html__('24 Hours', 'give'),
684
+								'172800' => esc_html__('48 Hours', 'give'),
685
+								'259200' => esc_html__('72 Hours', 'give'),
686
+								'604800' => esc_html__('1 Week', 'give'),
687 687
 							)
688 688
 						),
689 689
 						array(
690
-							'name' => esc_html__( 'Email Access', 'give' ),
691
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
690
+							'name' => esc_html__('Email Access', 'give'),
691
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
692 692
 							'id'   => 'email_access',
693 693
 							'type' => 'checkbox',
694 694
 						),
695 695
 						array(
696 696
 							'id'      => 'recaptcha_key',
697
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
697
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
698 698
 							/* translators: %s: https://www.google.com/recaptcha/ */
699
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
699
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
700 700
 							'default' => '',
701 701
 							'type'    => 'text'
702 702
 						),
703 703
 						array(
704 704
 							'id'      => 'recaptcha_secret',
705
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
706
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
705
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
706
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
707 707
 							'default' => '',
708 708
 							'type'    => 'text'
709 709
 						),
710 710
 						array(
711
-							'name' => esc_html__( 'Data Control', 'give' ),
711
+							'name' => esc_html__('Data Control', 'give'),
712 712
 							'desc' => '',
713 713
 							'id'   => 'give_title_data_control_2',
714 714
 							'type' => 'give_title'
715 715
 						),
716 716
 						array(
717
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
718
-							'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
717
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
718
+							'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
719 719
 							'id'   => 'uninstall_on_delete',
720 720
 							'type' => 'checkbox'
721 721
 						),
722 722
 						array(
723
-							'name' => esc_html__( 'Filter Control', 'give' ),
723
+							'name' => esc_html__('Filter Control', 'give'),
724 724
 							'desc' => '',
725 725
 							'id'   => 'give_title_filter_control',
726 726
 							'type' => 'give_title'
727 727
 						),
728 728
 						array(
729 729
 							/* translators: %s: the_content */
730
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
730
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
731 731
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
732
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
732
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
733 733
 							'id'   => 'disable_the_content_filter',
734 734
 							'type' => 'checkbox'
735 735
 						),
736 736
 						array(
737
-							'name' => esc_html__( 'Script Loading', 'give' ),
737
+							'name' => esc_html__('Script Loading', 'give'),
738 738
 							'desc' => '',
739 739
 							'id'   => 'give_title_script_control',
740 740
 							'type' => 'give_title'
741 741
 						),
742 742
 						array(
743
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
744
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
743
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
744
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
745 745
 							'id'   => 'scripts_footer',
746 746
 							'type' => 'checkbox'
747 747
 						)
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 			/** API Settings */
752 752
 			'api'         => array(
753 753
 				'id'         => 'api',
754
-				'give_title' => esc_html__( 'API', 'give' ),
755
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
754
+				'give_title' => esc_html__('API', 'give'),
755
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
756 756
 				'show_names' => false, // Hide field names on the left
757
-				'fields'     => apply_filters( 'give_settings_system', array(
757
+				'fields'     => apply_filters('give_settings_system', array(
758 758
 						array(
759 759
 							'id'   => 'api',
760
-							'name' => esc_html__( 'API', 'give' ),
760
+							'name' => esc_html__('API', 'give'),
761 761
 							'type' => 'api'
762 762
 						)
763 763
 					)
@@ -766,13 +766,13 @@  discard block
 block discarded – undo
766 766
 			/** Licenses Settings */
767 767
 			'system_info' => array(
768 768
 				'id'         => 'system_info',
769
-				'give_title' => esc_html__( 'System Info', 'give' ),
770
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
771
-				'fields'     => apply_filters( 'give_settings_system', array(
769
+				'give_title' => esc_html__('System Info', 'give'),
770
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
771
+				'fields'     => apply_filters('give_settings_system', array(
772 772
 						array(
773 773
 							'id'   => 'system_info',
774
-							'name' => esc_html__( 'System Info', 'give' ),
775
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
774
+							'name' => esc_html__('System Info', 'give'),
775
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
776 776
 							'type' => 'system_info'
777 777
 						)
778 778
 					)
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 		);
782 782
 
783 783
 		//Return all settings array if no active tab
784
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
784
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
785 785
 
786
-			return apply_filters( 'give_registered_settings', $give_settings );
786
+			return apply_filters('give_registered_settings', $give_settings);
787 787
 
788 788
 		}
789 789
 
790 790
 
791 791
 		// Add other tabs and settings fields as needed
792
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
792
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
793 793
 
794 794
 	}
795 795
 
@@ -798,11 +798,11 @@  discard block
 block discarded – undo
798 798
 	 */
799 799
 	public function settings_notices() {
800 800
 
801
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
801
+		if ( ! isset($_POST['give_settings_saved'])) {
802 802
 			return;
803 803
 		}
804 804
 
805
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
805
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
806 806
 
807 807
 	}
808 808
 
@@ -816,17 +816,17 @@  discard block
 block discarded – undo
816 816
 	 *
817 817
 	 * @return mixed          Field value or exception is thrown
818 818
 	 */
819
-	public function __get( $field ) {
819
+	public function __get($field) {
820 820
 
821 821
 		// Allowed fields to retrieve
822
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
822
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
823 823
 			return $this->{$field};
824 824
 		}
825
-		if ( 'option_metabox' === $field ) {
825
+		if ('option_metabox' === $field) {
826 826
 			return $this->option_metabox();
827 827
 		}
828 828
 
829
-		throw new Exception( 'Invalid property: ' . $field );
829
+		throw new Exception('Invalid property: '.$field);
830 830
 	}
831 831
 
832 832
 
@@ -843,12 +843,12 @@  discard block
 block discarded – undo
843 843
  *
844 844
  * @return mixed        Option value
845 845
  */
846
-function give_get_option( $key = '', $default = false ) {
846
+function give_get_option($key = '', $default = false) {
847 847
 	global $give_options;
848
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
849
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
848
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
849
+	$value = apply_filters('give_get_option', $value, $key, $default);
850 850
 
851
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
851
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
852 852
 }
853 853
 
854 854
 
@@ -866,33 +866,33 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return boolean True if updated, false if not.
868 868
  */
869
-function give_update_option( $key = '', $value = false ) {
869
+function give_update_option($key = '', $value = false) {
870 870
 
871 871
 	// If no key, exit
872
-	if ( empty( $key ) ) {
872
+	if (empty($key)) {
873 873
 		return false;
874 874
 	}
875 875
 
876
-	if ( empty( $value ) ) {
877
-		$remove_option = give_delete_option( $key );
876
+	if (empty($value)) {
877
+		$remove_option = give_delete_option($key);
878 878
 
879 879
 		return $remove_option;
880 880
 	}
881 881
 
882 882
 	// First let's grab the current settings
883
-	$options = get_option( 'give_settings' );
883
+	$options = get_option('give_settings');
884 884
 
885 885
 	// Let's let devs alter that value coming in
886
-	$value = apply_filters( 'give_update_option', $value, $key );
886
+	$value = apply_filters('give_update_option', $value, $key);
887 887
 
888 888
 	// Next let's try to update the value
889
-	$options[ $key ] = $value;
890
-	$did_update      = update_option( 'give_settings', $options );
889
+	$options[$key] = $value;
890
+	$did_update      = update_option('give_settings', $options);
891 891
 
892 892
 	// If it updated, let's update the global variable
893
-	if ( $did_update ) {
893
+	if ($did_update) {
894 894
 		global $give_options;
895
-		$give_options[ $key ] = $value;
895
+		$give_options[$key] = $value;
896 896
 	}
897 897
 
898 898
 	return $did_update;
@@ -909,27 +909,27 @@  discard block
 block discarded – undo
909 909
  *
910 910
  * @return boolean True if updated, false if not.
911 911
  */
912
-function give_delete_option( $key = '' ) {
912
+function give_delete_option($key = '') {
913 913
 
914 914
 	// If no key, exit
915
-	if ( empty( $key ) ) {
915
+	if (empty($key)) {
916 916
 		return false;
917 917
 	}
918 918
 
919 919
 	// First let's grab the current settings
920
-	$options = get_option( 'give_settings' );
920
+	$options = get_option('give_settings');
921 921
 
922 922
 	// Next let's try to update the value
923
-	if ( isset( $options[ $key ] ) ) {
923
+	if (isset($options[$key])) {
924 924
 
925
-		unset( $options[ $key ] );
925
+		unset($options[$key]);
926 926
 
927 927
 	}
928 928
 
929
-	$did_update = update_option( 'give_settings', $options );
929
+	$did_update = update_option('give_settings', $options);
930 930
 
931 931
 	// If it updated, let's update the global variable
932
-	if ( $did_update ) {
932
+	if ($did_update) {
933 933
 		global $give_options;
934 934
 		$give_options = $options;
935 935
 	}
@@ -948,9 +948,9 @@  discard block
 block discarded – undo
948 948
  */
949 949
 function give_get_settings() {
950 950
 
951
-	$settings = get_option( 'give_settings' );
951
+	$settings = get_option('give_settings');
952 952
 
953
-	return (array) apply_filters( 'give_get_settings', $settings );
953
+	return (array) apply_filters('give_get_settings', $settings);
954 954
 
955 955
 }
956 956
 
@@ -968,25 +968,25 @@  discard block
 block discarded – undo
968 968
  *
969 969
  * @return array
970 970
  */
971
-function give_settings_array_insert( $array, $position, $insert ) {
972
-	if ( is_int( $position ) ) {
973
-		array_splice( $array, $position, 0, $insert );
971
+function give_settings_array_insert($array, $position, $insert) {
972
+	if (is_int($position)) {
973
+		array_splice($array, $position, 0, $insert);
974 974
 	} else {
975 975
 
976
-		foreach ( $array as $index => $subarray ) {
977
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
976
+		foreach ($array as $index => $subarray) {
977
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
978 978
 				$pos = $index;
979 979
 			}
980 980
 		}
981 981
 
982
-		if ( ! isset( $pos ) ) {
982
+		if ( ! isset($pos)) {
983 983
 			return $array;
984 984
 		}
985 985
 
986 986
 		$array = array_merge(
987
-			array_slice( $array, 0, $pos ),
987
+			array_slice($array, 0, $pos),
988 988
 			$insert,
989
-			array_slice( $array, $pos )
989
+			array_slice($array, $pos)
990 990
 		);
991 991
 	}
992 992
 
@@ -1009,31 +1009,31 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @return void
1011 1011
  */
1012
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1012
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1013 1013
 
1014 1014
 	$id                = $field_type_object->field->args['id'];
1015 1015
 	$field_description = $field_type_object->field->args['desc'];
1016
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1016
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1017 1017
 
1018 1018
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1019 1019
 
1020
-	foreach ( $gateways as $key => $option ) :
1020
+	foreach ($gateways as $key => $option) :
1021 1021
 
1022
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1022
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1023 1023
 			$enabled = '1';
1024 1024
 		} else {
1025 1025
 			$enabled = null;
1026 1026
 		}
1027 1027
 
1028
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1029
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1028
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1029
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1030 1030
 
1031 1031
 	endforeach;
1032 1032
 
1033 1033
 	echo '</ul>';
1034 1034
 
1035
-	if ( $field_description ) {
1036
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1035
+	if ($field_description) {
1036
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1037 1037
 	}
1038 1038
 
1039 1039
 }
@@ -1049,31 +1049,31 @@  discard block
 block discarded – undo
1049 1049
  *
1050 1050
  * @return void
1051 1051
  */
1052
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1052
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1053 1053
 
1054 1054
 	$id                = $field_type_object->field->args['id'];
1055 1055
 	$field_description = $field_type_object->field->args['desc'];
1056 1056
 	$gateways          = give_get_enabled_payment_gateways();
1057 1057
 
1058
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1058
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1059 1059
 
1060 1060
 	//Add a field to the Give Form admin single post view of this field
1061
-	if ( $field_type_object->field->object_type === 'post' ) {
1062
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1061
+	if ($field_type_object->field->object_type === 'post') {
1062
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1063 1063
 	}
1064 1064
 
1065
-	foreach ( $gateways as $key => $option ) :
1065
+	foreach ($gateways as $key => $option) :
1066 1066
 
1067
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1067
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1068 1068
 
1069 1069
 
1070
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1070
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1071 1071
 
1072 1072
 	endforeach;
1073 1073
 
1074 1074
 	echo '</select>';
1075 1075
 
1076
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1076
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1077 1077
 
1078 1078
 }
1079 1079
 
@@ -1088,13 +1088,13 @@  discard block
 block discarded – undo
1088 1088
  *
1089 1089
  * @return void
1090 1090
  */
1091
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1091
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1092 1092
 
1093 1093
 	$id                = $field_type_object->field->args['id'];
1094 1094
 	$title             = $field_type_object->field->args['name'];
1095 1095
 	$field_description = $field_type_object->field->args['desc'];
1096 1096
 
1097
-	echo '<hr>' . $field_description;
1097
+	echo '<hr>'.$field_description;
1098 1098
 
1099 1099
 }
1100 1100
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
  *
1110 1110
  * @return void
1111 1111
  */
1112
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1112
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1113 1113
 
1114 1114
 	$id                = $field_type_object->field->args['id'];
1115 1115
 	$title             = $field_type_object->field->args['name'];
@@ -1129,25 +1129,25 @@  discard block
 block discarded – undo
1129 1129
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1130 1130
  * @return array An array of options that matches the CMB2 options array
1131 1131
  */
1132
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1132
+function give_cmb2_get_post_options($query_args, $force = false) {
1133 1133
 
1134
-	$post_options = array( '' => '' ); // Blank option
1134
+	$post_options = array('' => ''); // Blank option
1135 1135
 
1136
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1136
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1137 1137
 		return $post_options;
1138 1138
 	}
1139 1139
 
1140
-	$args = wp_parse_args( $query_args, array(
1140
+	$args = wp_parse_args($query_args, array(
1141 1141
 		'post_type'   => 'page',
1142 1142
 		'numberposts' => 10,
1143
-	) );
1143
+	));
1144 1144
 
1145
-	$posts = get_posts( $args );
1145
+	$posts = get_posts($args);
1146 1146
 
1147
-	if ( $posts ) {
1148
-		foreach ( $posts as $post ) {
1147
+	if ($posts) {
1148
+		foreach ($posts as $post) {
1149 1149
 
1150
-			$post_options[ $post->ID ] = $post->post_title;
1150
+			$post_options[$post->ID] = $post->post_title;
1151 1151
 
1152 1152
 		}
1153 1153
 	}
@@ -1167,17 +1167,17 @@  discard block
 block discarded – undo
1167 1167
 	global $_wp_additional_image_sizes;
1168 1168
 	$sizes = array();
1169 1169
 
1170
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1170
+	foreach (get_intermediate_image_sizes() as $_size) {
1171 1171
 
1172
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1173
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1174
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1175
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1172
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1173
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1174
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1175
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1176 1176
 		}
1177 1177
 
1178 1178
 	}
1179 1179
 
1180
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1180
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1181 1181
 }
1182 1182
 
1183 1183
 
@@ -1192,34 +1192,34 @@  discard block
 block discarded – undo
1192 1192
  *
1193 1193
  * @return void
1194 1194
  */
1195
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1195
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1196 1196
 
1197 1197
 	$id                = $field_type_object->field->args['id'];
1198 1198
 	$field_description = $field_type_object->field->args['desc'];
1199
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1199
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1200 1200
 	$field_classes     = 'regular-text give-license-field';
1201
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1201
+	$type              = empty($escaped_value) ? 'text' : 'password';
1202 1202
 
1203
-	if ( $license_status === 'valid' ) {
1203
+	if ($license_status === 'valid') {
1204 1204
 		$field_classes .= ' give-license-active';
1205 1205
 	}
1206 1206
 
1207
-	$html = $field_type_object->input( array(
1207
+	$html = $field_type_object->input(array(
1208 1208
 		'class' => $field_classes,
1209 1209
 		'type'  => $type
1210
-	) );
1210
+	));
1211 1211
 
1212 1212
 	//License is active so show deactivate button
1213
-	if ( $license_status === 'valid' ) {
1214
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1213
+	if ($license_status === 'valid') {
1214
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1215 1215
 	} else {
1216 1216
 		//This license is not valid so delete it
1217
-		give_delete_option( $id );
1217
+		give_delete_option($id);
1218 1218
 	}
1219 1219
 
1220
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1220
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1221 1221
 
1222
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1222
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1223 1223
 
1224 1224
 	echo $html;
1225 1225
 }
@@ -1233,13 +1233,13 @@  discard block
 block discarded – undo
1233 1233
  */
1234 1234
 function give_api_callback() {
1235 1235
 
1236
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1236
+	if ( ! current_user_can('manage_give_settings')) {
1237 1237
 		return;
1238 1238
 	}
1239 1239
 
1240
-	do_action( 'give_tools_api_keys_before' );
1240
+	do_action('give_tools_api_keys_before');
1241 1241
 
1242
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1242
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1243 1243
 
1244 1244
 	$api_keys_table = new Give_API_Keys_Table();
1245 1245
 	$api_keys_table->prepare_items();
@@ -1248,17 +1248,17 @@  discard block
 block discarded – undo
1248 1248
 	<span class="cmb2-metabox-description api-description">
1249 1249
 		<?php echo sprintf(
1250 1250
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1251
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1252
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1253
-			esc_url( 'https://givewp.com/addons/zapier/' )
1251
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1252
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1253
+			esc_url('https://givewp.com/addons/zapier/')
1254 1254
 		); ?>
1255 1255
 	</span>
1256 1256
 	<?php
1257 1257
 
1258
-	do_action( 'give_tools_api_keys_after' );
1258
+	do_action('give_tools_api_keys_after');
1259 1259
 }
1260 1260
 
1261
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1261
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1262 1262
 
1263 1263
 /**
1264 1264
  * Hook Callback
@@ -1271,8 +1271,8 @@  discard block
 block discarded – undo
1271 1271
  *
1272 1272
  * @return void
1273 1273
  */
1274
-function give_hook_callback( $args ) {
1275
-	do_action( 'give_' . $args['id'] );
1274
+function give_hook_callback($args) {
1275
+	do_action('give_'.$args['id']);
1276 1276
 }
1277 1277
 
1278 1278
 /**
@@ -1283,10 +1283,10 @@  discard block
 block discarded – undo
1283 1283
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1284 1284
  */
1285 1285
 
1286
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1287
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1288
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1289
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1290
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1291
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1286
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1287
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1288
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1289
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1290
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1291
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1292 1292
 }
1293 1293
\ No newline at end of file
Please login to merge, or discard this patch.
admin/reporting/tools/class-give-tools-delete-test-transactions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 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_reset_ids' );
58
+		$items = $this->get_stored_data('give_temp_reset_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,15 +78,15 @@  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
-				$ids = implode( ',', $ids );
87
+				$ids = implode(',', $ids);
88 88
 
89
-				switch ( $type ) {
89
+				switch ($type) {
90 90
 					case 'other':
91 91
 						$sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)";
92 92
 						$sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)";
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 
98 98
 			}
99 99
 
100
-			if ( ! empty( $sql ) ) {
101
-				foreach ( $sql as $query ) {
102
-					$wpdb->query( $query );
100
+			if ( ! empty($sql)) {
101
+				foreach ($sql as $query) {
102
+					$wpdb->query($query);
103 103
 				}
104 104
 			}
105 105
 
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function get_percentage_complete() {
121 121
 
122
-		$items = $this->get_stored_data( 'give_temp_reset_ids', false );
123
-		$total = count( $items );
122
+		$items = $this->get_stored_data('give_temp_reset_ids', false);
123
+		$total = count($items);
124 124
 
125 125
 		$percentage = 100;
126 126
 
127
-		if ( $total > 0 ) {
128
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
127
+		if ($total > 0) {
128
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
129 129
 		}
130 130
 
131
-		if ( $percentage > 100 ) {
131
+		if ($percentage > 100) {
132 132
 			$percentage = 100;
133 133
 		}
134 134
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @param array $request The Form Data passed into the batch processing
144 144
 	 */
145
-	public function set_properties( $request ) {
145
+	public function set_properties($request) {
146 146
 	}
147 147
 
148 148
 	/**
@@ -153,30 +153,30 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	public function process_step() {
155 155
 
156
-		if ( ! $this->can_export() ) {
157
-			wp_die( esc_html__( 'You do not have permission to delete test transactions.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
156
+		if ( ! $this->can_export()) {
157
+			wp_die(esc_html__('You do not have permission to delete test transactions.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
158 158
 		}
159 159
 
160 160
 		$had_data = $this->get_data();
161 161
 
162
-		if ( $had_data ) {
162
+		if ($had_data) {
163 163
 			$this->done = false;
164 164
 
165 165
 			return true;
166 166
 		} else {
167
-			update_option( 'give_earnings_total', 0 );
168
-			delete_transient( 'give_earnings_total' );
169
-			delete_transient( 'give_estimated_monthly_stats' . true );
170
-			delete_transient( 'give_estimated_monthly_stats' . false );
171
-			$this->delete_data( 'give_temp_reset_ids' );
167
+			update_option('give_earnings_total', 0);
168
+			delete_transient('give_earnings_total');
169
+			delete_transient('give_estimated_monthly_stats'.true);
170
+			delete_transient('give_estimated_monthly_stats'.false);
171
+			$this->delete_data('give_temp_reset_ids');
172 172
 
173 173
 			// Reset the sequential order numbers
174
-			if ( give_get_option( 'enable_sequential' ) ) {
175
-				delete_option( 'give_last_payment_number' );
174
+			if (give_get_option('enable_sequential')) {
175
+				delete_option('give_last_payment_number');
176 176
 			}
177 177
 
178 178
 			$this->done    = true;
179
-			$this->message = esc_html__( 'Test transactions successfully deleted.', 'give' );
179
+			$this->message = esc_html__('Test transactions successfully deleted.', 'give');
180 180
 
181 181
 			return false;
182 182
 		}
@@ -186,10 +186,10 @@  discard block
 block discarded – undo
186 186
 	 * Headers
187 187
 	 */
188 188
 	public function headers() {
189
-		ignore_user_abort( true );
189
+		ignore_user_abort(true);
190 190
 
191
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
192
-			set_time_limit( 0 );
191
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
192
+			set_time_limit(0);
193 193
 		}
194 194
 	}
195 195
 
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function pre_fetch() {
215 215
 
216
-		if ( $this->step == 1 ) {
217
-			$this->delete_data( 'give_temp_reset_ids' );
216
+		if ($this->step == 1) {
217
+			$this->delete_data('give_temp_reset_ids');
218 218
 		}
219 219
 
220
-		$items = get_option( 'give_temp_reset_ids', false );
220
+		$items = get_option('give_temp_reset_ids', false);
221 221
 
222
-		if ( false === $items ) {
222
+		if (false === $items) {
223 223
 			$items = array();
224 224
 
225
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
225
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
226 226
 				'post_type'      => 'give_payment',
227 227
 				'post_status'    => 'any',
228
-				'posts_per_page' => - 1,
228
+				'posts_per_page' => -1,
229 229
 				//ONLY TEST MODE TRANSACTIONS!!!
230 230
 				'meta_key'   => '_give_payment_mode',
231 231
 				'meta_value' => 'test'
232
-			) );
232
+			));
233 233
 
234
-			$posts = get_posts( $args );
235
-			foreach ( $posts as $post ) {
234
+			$posts = get_posts($args);
235
+			foreach ($posts as $post) {
236 236
 				$items[] = array(
237 237
 					'id'   => (int) $post->ID,
238 238
 					'type' => $post->post_type,
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 
242 242
 			// Allow filtering of items to remove with an unassociative array for each item
243 243
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
244
-			$items = apply_filters( 'give_reset_store_items', $items );
244
+			$items = apply_filters('give_reset_store_items', $items);
245 245
 
246
-			$this->store_data( 'give_temp_reset_ids', $items );
246
+			$this->store_data('give_temp_reset_ids', $items);
247 247
 		}
248 248
 
249 249
 	}
@@ -257,11 +257,11 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return mixed       Returns the data from the database
259 259
 	 */
260
-	private function get_stored_data( $key ) {
260
+	private function get_stored_data($key) {
261 261
 		global $wpdb;
262
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
262
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
263 263
 
264
-		return empty( $value ) ? false : maybe_unserialize( $value );
264
+		return empty($value) ? false : maybe_unserialize($value);
265 265
 	}
266 266
 
267 267
 	/**
@@ -274,10 +274,10 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return void
276 276
 	 */
277
-	private function store_data( $key, $value ) {
277
+	private function store_data($key, $value) {
278 278
 		global $wpdb;
279 279
 
280
-		$value = maybe_serialize( $value );
280
+		$value = maybe_serialize($value);
281 281
 
282 282
 		$data = array(
283 283
 			'option_name'  => $key,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 			'%s',
292 292
 		);
293 293
 
294
-		$wpdb->replace( $wpdb->options, $data, $formats );
294
+		$wpdb->replace($wpdb->options, $data, $formats);
295 295
 	}
296 296
 
297 297
 	/**
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @return void
305 305
 	 */
306
-	private function delete_data( $key ) {
306
+	private function delete_data($key) {
307 307
 		global $wpdb;
308
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
308
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
309 309
 	}
310 310
 
311 311
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-all-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 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,26 +55,26 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $give_logs, $wpdb;
57 57
 
58
-		$totals             = $this->get_stored_data( 'give_temp_recount_all_stats' );
59
-		$payment_items      = $this->get_stored_data( 'give_temp_payment_items' );
60
-		$processed_payments = $this->get_stored_data( 'give_temp_processed_payments' );
61
-		$accepted_statuses  = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
58
+		$totals             = $this->get_stored_data('give_temp_recount_all_stats');
59
+		$payment_items      = $this->get_stored_data('give_temp_payment_items');
60
+		$processed_payments = $this->get_stored_data('give_temp_processed_payments');
61
+		$accepted_statuses  = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
62 62
 
63
-		if ( false === $totals ) {
63
+		if (false === $totals) {
64 64
 			$totals = array();
65 65
 		}
66 66
 
67
-		if ( false === $payment_items ) {
67
+		if (false === $payment_items) {
68 68
 			$payment_items = array();
69 69
 		}
70 70
 
71
-		if ( false === $processed_payments ) {
71
+		if (false === $processed_payments) {
72 72
 			$processed_payments = array();
73 73
 		}
74 74
 
75
-		$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
75
+		$all_forms = $this->get_stored_data('give_temp_form_ids');
76 76
 
77
-		$args = apply_filters( 'give_recount_form_stats_args', array(
77
+		$args = apply_filters('give_recount_form_stats_args', array(
78 78
 			'post_parent__in' => $all_forms,
79 79
 			'post_type'       => 'give_log',
80 80
 			'posts_per_page'  => $this->per_step,
@@ -82,73 +82,73 @@  discard block
 block discarded – undo
82 82
 			'paged'           => $this->step,
83 83
 			'log_type'        => 'sale',
84 84
 			'fields'          => 'ids',
85
-		) );
85
+		));
86 86
 
87
-		$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
87
+		$log_ids = $give_logs->get_connected_logs($args, 'sale');
88 88
 
89
-		if ( $log_ids ) {
90
-			$log_ids = implode( ',', $log_ids );
89
+		if ($log_ids) {
90
+			$log_ids = implode(',', $log_ids);
91 91
 
92
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
93
-			unset( $log_ids );
92
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
93
+			unset($log_ids);
94 94
 
95
-			$payment_ids = implode( ',', $payment_ids );
96
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
97
-			unset( $payment_ids );
95
+			$payment_ids = implode(',', $payment_ids);
96
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
97
+			unset($payment_ids);
98 98
 
99 99
 			//Loop through payments
100
-			foreach ( $payments as $payment ) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Prevent payments that have all ready been retrieved from a previous sales log from counting again.
103
-				if ( in_array( $payment->ID, $processed_payments ) ) {
103
+				if (in_array($payment->ID, $processed_payments)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				//Verify accepted status'
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					$processed_payments[] = $payment->ID;
110 110
 					continue;
111 111
 				}
112 112
 
113
-				$payment_item = $payment_items[ $payment->ID ];
113
+				$payment_item = $payment_items[$payment->ID];
114 114
 
115 115
 
116
-				$form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : '';
116
+				$form_id = isset($payment_item['id']) ? $payment_item['id'] : '';
117 117
 
118 118
 				//Must have a form ID
119
-				if ( empty( $form_id ) ) {
119
+				if (empty($form_id)) {
120 120
 					continue;
121 121
 				}
122 122
 
123 123
 				//Form ID must be within $all_forms array to be validated
124
-				if ( ! in_array( $form_id, $all_forms ) ) {
124
+				if ( ! in_array($form_id, $all_forms)) {
125 125
 					continue;
126 126
 				}
127 127
 
128 128
 				//If array key doesn't exist, create it
129
-				if ( ! array_key_exists( $form_id, $totals ) ) {
130
-					$totals[ $form_id ] = array(
129
+				if ( ! array_key_exists($form_id, $totals)) {
130
+					$totals[$form_id] = array(
131 131
 						'sales'    => (int) 0,
132 132
 						'earnings' => (float) 0,
133 133
 					);
134 134
 				}
135 135
 
136
-				$totals[ $form_id ]['sales'] ++;
137
-				$totals[ $form_id ]['earnings'] += $payment_item['price'];
136
+				$totals[$form_id]['sales']++;
137
+				$totals[$form_id]['earnings'] += $payment_item['price'];
138 138
 
139 139
 				$processed_payments[] = $payment->ID;
140 140
 
141 141
 			}
142 142
 
143
-			$this->store_data( 'give_temp_processed_payments', $processed_payments );
144
-			$this->store_data( 'give_temp_recount_all_stats', $totals );
143
+			$this->store_data('give_temp_processed_payments', $processed_payments);
144
+			$this->store_data('give_temp_recount_all_stats', $totals);
145 145
 
146 146
 			return true;
147 147
 		}
148 148
 
149
-		foreach ( $totals as $key => $stats ) {
150
-			update_post_meta( $key, '_give_form_sales', $stats['sales'] );
151
-			update_post_meta( $key, '_give_form_earnings', $stats['earnings'] );
149
+		foreach ($totals as $key => $stats) {
150
+			update_post_meta($key, '_give_form_sales', $stats['sales']);
151
+			update_post_meta($key, '_give_form_earnings', $stats['earnings']);
152 152
 		}
153 153
 
154 154
 		return false;
@@ -163,20 +163,20 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function get_percentage_complete() {
165 165
 
166
-		$total = $this->get_stored_data( 'give_recount_all_total', false );
166
+		$total = $this->get_stored_data('give_recount_all_total', false);
167 167
 
168
-		if ( false === $total ) {
168
+		if (false === $total) {
169 169
 			$this->pre_fetch();
170
-			$total = $this->get_stored_data( 'give_recount_all_total', 0 );
170
+			$total = $this->get_stored_data('give_recount_all_total', 0);
171 171
 		}
172 172
 
173 173
 		$percentage = 100;
174 174
 
175
-		if ( $total > 0 ) {
176
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
175
+		if ($total > 0) {
176
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
177 177
 		}
178 178
 
179
-		if ( $percentage > 100 ) {
179
+		if ($percentage > 100) {
180 180
 			$percentage = 100;
181 181
 		}
182 182
 
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @param array $request The Form Data passed into the batch processing
192 192
 	 */
193
-	public function set_properties( $request ) {
194
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
193
+	public function set_properties($request) {
194
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
195 195
 	}
196 196
 
197 197
 	/**
@@ -202,34 +202,34 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function process_step() {
204 204
 
205
-		if ( ! $this->can_export() ) {
206
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
205
+		if ( ! $this->can_export()) {
206
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
207 207
 		}
208 208
 
209 209
 		$had_data = $this->get_data();
210 210
 
211
-		if ( $had_data ) {
211
+		if ($had_data) {
212 212
 			$this->done = false;
213 213
 
214 214
 			return true;
215 215
 		} else {
216
-			$this->delete_data( 'give_recount_all_total' );
217
-			$this->delete_data( 'give_temp_recount_all_stats' );
218
-			$this->delete_data( 'give_temp_payment_items' );
219
-			$this->delete_data( 'give_temp_form_ids' );
220
-			$this->delete_data( 'give_temp_processed_payments' );
216
+			$this->delete_data('give_recount_all_total');
217
+			$this->delete_data('give_temp_recount_all_stats');
218
+			$this->delete_data('give_temp_payment_items');
219
+			$this->delete_data('give_temp_form_ids');
220
+			$this->delete_data('give_temp_processed_payments');
221 221
 			$this->done    = true;
222
-			$this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' );
222
+			$this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give');
223 223
 
224 224
 			return false;
225 225
 		}
226 226
 	}
227 227
 
228 228
 	public function headers() {
229
-		ignore_user_abort( true );
229
+		ignore_user_abort(true);
230 230
 
231
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
232
-			set_time_limit( 0 );
231
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
232
+			set_time_limit(0);
233 233
 		}
234 234
 	}
235 235
 
@@ -258,76 +258,76 @@  discard block
 block discarded – undo
258 258
 
259 259
 		global $give_logs, $wpdb;
260 260
 
261
-		if ( $this->step == 1 ) {
262
-			$this->delete_data( 'give_temp_recount_all_total' );
263
-			$this->delete_data( 'give_temp_recount_all_stats' );
264
-			$this->delete_data( 'give_temp_payment_items' );
265
-			$this->delete_data( 'give_temp_processed_payments' );
261
+		if ($this->step == 1) {
262
+			$this->delete_data('give_temp_recount_all_total');
263
+			$this->delete_data('give_temp_recount_all_stats');
264
+			$this->delete_data('give_temp_payment_items');
265
+			$this->delete_data('give_temp_processed_payments');
266 266
 		}
267 267
 
268
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
269
-		$total             = $this->get_stored_data( 'give_temp_recount_all_total' );
268
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
269
+		$total             = $this->get_stored_data('give_temp_recount_all_total');
270 270
 
271
-		if ( false === $total ) {
271
+		if (false === $total) {
272 272
 			$total         = 0;
273
-			$payment_items = $this->get_stored_data( 'give_temp_payment_items' );
273
+			$payment_items = $this->get_stored_data('give_temp_payment_items');
274 274
 
275
-			if ( false === $payment_items ) {
275
+			if (false === $payment_items) {
276 276
 				$payment_items = array();
277
-				$this->store_data( 'give_temp_payment_items', $payment_items );
277
+				$this->store_data('give_temp_payment_items', $payment_items);
278 278
 			}
279 279
 
280
-			$all_forms = $this->get_stored_data( 'give_temp_form_ids' );
280
+			$all_forms = $this->get_stored_data('give_temp_form_ids');
281 281
 
282
-			if ( false === $all_forms ) {
282
+			if (false === $all_forms) {
283 283
 				$args = array(
284 284
 					'post_status'    => 'any',
285 285
 					'post_type'      => 'give_forms',
286
-					'posts_per_page' => - 1,
286
+					'posts_per_page' => -1,
287 287
 					'fields'         => 'ids',
288 288
 				);
289 289
 
290
-				$all_forms = get_posts( $args );
291
-				$this->store_data( 'give_temp_form_ids', $all_forms );
290
+				$all_forms = get_posts($args);
291
+				$this->store_data('give_temp_form_ids', $all_forms);
292 292
 			}
293 293
 
294
-			$args = apply_filters( 'give_recount_form_stats_total_args', array(
294
+			$args = apply_filters('give_recount_form_stats_total_args', array(
295 295
 				'post_parent__in' => $all_forms,
296 296
 				'post_type'       => 'give_log',
297 297
 				'post_status'     => 'publish',
298 298
 				'log_type'        => 'sale',
299 299
 				'fields'          => 'ids',
300 300
 				'nopaging'        => true,
301
-			) );
301
+			));
302 302
 
303
-			$all_logs = $give_logs->get_connected_logs( $args, 'sale' );
303
+			$all_logs = $give_logs->get_connected_logs($args, 'sale');
304 304
 
305
-			if ( $all_logs ) {
306
-				$log_ids     = implode( ',', $all_logs );
307
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
308
-				unset( $log_ids );
305
+			if ($all_logs) {
306
+				$log_ids     = implode(',', $all_logs);
307
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
308
+				unset($log_ids);
309 309
 
310
-				$payment_ids = implode( ',', $payment_ids );
311
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
312
-				unset( $payment_ids );
310
+				$payment_ids = implode(',', $payment_ids);
311
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
312
+				unset($payment_ids);
313 313
 
314
-				foreach ( $payments as $payment ) {
314
+				foreach ($payments as $payment) {
315 315
 
316
-					$payment = new Give_Payment( $payment->ID );
316
+					$payment = new Give_Payment($payment->ID);
317 317
 					$form_id = $payment->form_id;
318 318
 
319 319
 					//If for some reason somehow the form_ID isn't set check payment meta
320
-					if ( empty( $payment->form_id ) ) {
320
+					if (empty($payment->form_id)) {
321 321
 						$payment_meta = $payment->get_meta();
322
-						$form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
322
+						$form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
323 323
 					}
324 324
 
325
-					if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
325
+					if ( ! in_array($payment->post_status, $accepted_statuses)) {
326 326
 						continue;
327 327
 					}
328 328
 
329
-					if ( ! array_key_exists( $payment->ID, $payment_items ) ) {
330
-						$payment_items[ $payment->ID ] = array(
329
+					if ( ! array_key_exists($payment->ID, $payment_items)) {
330
+						$payment_items[$payment->ID] = array(
331 331
 							'id'         => $form_id,
332 332
 							'payment_id' => $payment->ID,
333 333
 							'price'      => $payment->total
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 
337 337
 				}
338 338
 
339
-				$total = count( $all_logs );
339
+				$total = count($all_logs);
340 340
 			}
341 341
 
342
-			$this->store_data( 'give_temp_payment_items', $payment_items );
343
-			$this->store_data( 'give_recount_all_total', $total );
342
+			$this->store_data('give_temp_payment_items', $payment_items);
343
+			$this->store_data('give_recount_all_total', $total);
344 344
 		}
345 345
 
346 346
 	}
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return mixed       Returns the data from the database
356 356
 	 */
357
-	private function get_stored_data( $key ) {
357
+	private function get_stored_data($key) {
358 358
 		global $wpdb;
359
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
359
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
360 360
 
361
-		return empty( $value ) ? false : maybe_unserialize( $value );
361
+		return empty($value) ? false : maybe_unserialize($value);
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 	 *
372 372
 	 * @return void
373 373
 	 */
374
-	private function store_data( $key, $value ) {
374
+	private function store_data($key, $value) {
375 375
 		global $wpdb;
376 376
 
377
-		$value = maybe_serialize( $value );
377
+		$value = maybe_serialize($value);
378 378
 
379 379
 		$data = array(
380 380
 			'option_name'  => $key,
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			'%s',
389 389
 		);
390 390
 
391
-		$wpdb->replace( $wpdb->options, $data, $formats );
391
+		$wpdb->replace($wpdb->options, $data, $formats);
392 392
 	}
393 393
 
394 394
 	/**
@@ -400,9 +400,9 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return void
402 402
 	 */
403
-	private function delete_data( $key ) {
403
+	private function delete_data($key) {
404 404
 		global $wpdb;
405
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
405
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
406 406
 	}
407 407
 
408 408
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-customer-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 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
 
@@ -56,32 +56,32 @@  discard block
 block discarded – undo
56 56
 
57 57
 		$args = array(
58 58
 			'number'  => $this->per_step,
59
-			'offset'  => $this->per_step * ( $this->step - 1 ),
59
+			'offset'  => $this->per_step * ($this->step - 1),
60 60
 			'orderby' => 'id',
61 61
 			'order'   => 'DESC',
62 62
 		);
63 63
 
64
-		$customers = Give()->customers->get_customers( $args );
64
+		$customers = Give()->customers->get_customers($args);
65 65
 
66
-		if ( $customers ) {
66
+		if ($customers) {
67 67
 
68
-			$allowed_payment_status = apply_filters( 'give_recount_customer_payment_statuses', give_get_payment_status_keys() );
68
+			$allowed_payment_status = apply_filters('give_recount_customer_payment_statuses', give_get_payment_status_keys());
69 69
 
70
-			foreach ( $customers as $customer ) {
70
+			foreach ($customers as $customer) {
71 71
 
72
-				$attached_payment_ids = explode( ',', $customer->payment_ids );
72
+				$attached_payment_ids = explode(',', $customer->payment_ids);
73 73
 
74 74
 				$attached_args = array(
75 75
 					'post__in' => $attached_payment_ids,
76
-					'number'   => - 1,
76
+					'number'   => -1,
77 77
 					'status'   => $allowed_payment_status,
78 78
 				);
79 79
 
80
-				$attached_payments = (array) give_get_payments( $attached_args );
80
+				$attached_payments = (array) give_get_payments($attached_args);
81 81
 
82 82
 				$unattached_args = array(
83 83
 					'post__not_in' => $attached_payment_ids,
84
-					'number'       => - 1,
84
+					'number'       => -1,
85 85
 					'status'       => $allowed_payment_status,
86 86
 					'meta_query'   => array(
87 87
 						array(
@@ -92,29 +92,29 @@  discard block
 block discarded – undo
92 92
 					),
93 93
 				);
94 94
 
95
-				$unattached_payments = give_get_payments( $unattached_args );
95
+				$unattached_payments = give_get_payments($unattached_args);
96 96
 
97
-				$payments = array_merge( $attached_payments, $unattached_payments );
97
+				$payments = array_merge($attached_payments, $unattached_payments);
98 98
 
99 99
 				$purchase_value = 0.00;
100 100
 				$purchase_count = 0;
101 101
 				$payment_ids    = array();
102 102
 
103
-				if ( $payments ) {
103
+				if ($payments) {
104 104
 
105
-					foreach ( $payments as $payment ) {
105
+					foreach ($payments as $payment) {
106 106
 
107 107
 						$should_process_payment = 'publish' == $payment->post_status || 'revoked' == $payment->post_status ? true : false;
108
-						$should_process_payment = apply_filters( 'give_customer_recount_should_process_payment', $should_process_payment, $payment );
108
+						$should_process_payment = apply_filters('give_customer_recount_should_process_payment', $should_process_payment, $payment);
109 109
 
110
-						if ( true === $should_process_payment ) {
110
+						if (true === $should_process_payment) {
111 111
 
112
-							if ( apply_filters( 'give_customer_recount_should_increase_value', true, $payment ) ) {
113
-								$purchase_value += give_get_payment_amount( $payment->ID );
112
+							if (apply_filters('give_customer_recount_should_increase_value', true, $payment)) {
113
+								$purchase_value += give_get_payment_amount($payment->ID);
114 114
 							}
115 115
 
116
-							if ( apply_filters( 'give_customer_recount_should_increase_count', true, $payment ) ) {
117
-								$purchase_count ++;
116
+							if (apply_filters('give_customer_recount_should_increase_count', true, $payment)) {
117
+								$purchase_count++;
118 118
 							}
119 119
 
120 120
 						}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 				}
126 126
 
127
-				$payment_ids = implode( ',', $payment_ids );
127
+				$payment_ids = implode(',', $payment_ids);
128 128
 
129 129
 				$customer_update_data = array(
130 130
 					'purchase_count' => $purchase_count,
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 					'payment_ids'    => $payment_ids,
133 133
 				);
134 134
 
135
-				$customer_instance = new Give_Customer( $customer->id );
136
-				$customer_instance->update( $customer_update_data );
135
+				$customer_instance = new Give_Customer($customer->id);
136
+				$customer_instance->update($customer_update_data);
137 137
 
138 138
 			}
139 139
 
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
 	public function get_percentage_complete() {
154 154
 
155 155
 		$args = array(
156
-			'number'  => - 1,
156
+			'number'  => -1,
157 157
 			'orderby' => 'id',
158 158
 			'order'   => 'DESC',
159 159
 		);
160 160
 
161
-		$customers = Give()->customers->get_customers( $args );
162
-		$total     = count( $customers );
161
+		$customers = Give()->customers->get_customers($args);
162
+		$total     = count($customers);
163 163
 
164 164
 		$percentage = 100;
165 165
 
166
-		if ( $total > 0 ) {
167
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
166
+		if ($total > 0) {
167
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
168 168
 		}
169 169
 
170
-		if ( $percentage > 100 ) {
170
+		if ($percentage > 100) {
171 171
 			$percentage = 100;
172 172
 		}
173 173
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param array $request The Form Data passed into the batch processing
183 183
 	 */
184
-	public function set_properties( $request ) {
184
+	public function set_properties($request) {
185 185
 	}
186 186
 
187 187
 	/**
@@ -192,19 +192,19 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function process_step() {
194 194
 
195
-		if ( ! $this->can_export() ) {
196
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
195
+		if ( ! $this->can_export()) {
196
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
197 197
 		}
198 198
 
199 199
 		$had_data = $this->get_data();
200 200
 
201
-		if ( $had_data ) {
201
+		if ($had_data) {
202 202
 			$this->done = false;
203 203
 
204 204
 			return true;
205 205
 		} else {
206 206
 			$this->done    = true;
207
-			$this->message = esc_html__( 'Donor stats successfully recounted.', 'give' );
207
+			$this->message = esc_html__('Donor stats successfully recounted.', 'give');
208 208
 
209 209
 			return false;
210 210
 		}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * Headers
215 215
 	 */
216 216
 	public function headers() {
217
-		ignore_user_abort( true );
217
+		ignore_user_abort(true);
218 218
 
219
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-			set_time_limit( 0 );
219
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+			set_time_limit(0);
221 221
 		}
222 222
 	}
223 223
 
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-form-stats.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	 * @since 1.5
51 51
 	 * @global object $wpdb Used to query the database using the WordPress
52 52
 	 *   Database API
53
-	 * @return array $data The data for the CSV file
53
+	 * @return boolean $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56 56
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 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
 
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	public function get_data() {
63 63
 		global $give_logs, $wpdb;
64 64
 
65
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
65
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
66 66
 
67
-		if ( $this->step == 1 ) {
68
-			$this->delete_data( 'give_temp_recount_form_stats' );
67
+		if ($this->step == 1) {
68
+			$this->delete_data('give_temp_recount_form_stats');
69 69
 		}
70 70
 
71
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
71
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
72 72
 
73
-		if ( false === $totals ) {
73
+		if (false === $totals) {
74 74
 			$totals = array(
75 75
 				'earnings' => (float) 0,
76 76
 				'sales'    => 0,
77 77
 			);
78
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
78
+			$this->store_data('give_temp_recount_form_stats', $totals);
79 79
 		}
80 80
 
81
-		$args = apply_filters( 'give_recount_form_stats_args', array(
81
+		$args = apply_filters('give_recount_form_stats_args', array(
82 82
 			'post_parent'    => $this->form_id,
83 83
 			'post_type'      => 'give_log',
84 84
 			'posts_per_page' => $this->per_step,
@@ -86,49 +86,49 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step,
87 87
 			'log_type'       => 'sale',
88 88
 			'fields'         => 'ids',
89
-		) );
89
+		));
90 90
 
91
-		$log_ids              = $give_logs->get_connected_logs( $args, 'sale' );
91
+		$log_ids              = $give_logs->get_connected_logs($args, 'sale');
92 92
 		$this->_log_ids_debug = array();
93 93
 
94
-		if ( $log_ids ) {
95
-			$log_ids     = implode( ',', $log_ids );
96
-			$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
97
-			unset( $log_ids );
94
+		if ($log_ids) {
95
+			$log_ids     = implode(',', $log_ids);
96
+			$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
97
+			unset($log_ids);
98 98
 
99
-			$payment_ids = implode( ',', $payment_ids );
100
-			$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
101
-			unset( $payment_ids );
99
+			$payment_ids = implode(',', $payment_ids);
100
+			$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
101
+			unset($payment_ids);
102 102
 
103
-			foreach ( $payments as $payment ) {
103
+			foreach ($payments as $payment) {
104 104
 
105
-				$payment = new Give_Payment( $payment->ID );
105
+				$payment = new Give_Payment($payment->ID);
106 106
 
107 107
 				//Ensure acceptible status only
108
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
108
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
109 109
 					continue;
110 110
 				}
111 111
 
112 112
 				//Ensure only payments for this form are counted
113
-				if ( $payment->form_id != $this->form_id ) {
113
+				if ($payment->form_id != $this->form_id) {
114 114
 					continue;
115 115
 				}
116 116
 
117 117
 				$this->_log_ids_debug[] = $payment->ID;
118 118
 
119
-				$totals['sales'] ++;
119
+				$totals['sales']++;
120 120
 				$totals['earnings'] += $payment->total;
121 121
 
122 122
 			}
123 123
 
124
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
124
+			$this->store_data('give_temp_recount_form_stats', $totals);
125 125
 
126 126
 			return true;
127 127
 		}
128 128
 
129 129
 
130
-		update_post_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
131
-		update_post_meta( $this->form_id, '_give_form_earnings', $totals['earnings'] );
130
+		update_post_meta($this->form_id, '_give_form_sales', $totals['sales']);
131
+		update_post_meta($this->form_id, '_give_form_earnings', $totals['earnings']);
132 132
 
133 133
 		return false;
134 134
 
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	public function get_percentage_complete() {
144 144
 		global $give_logs, $wpdb;
145 145
 
146
-		if ( $this->step == 1 ) {
147
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
146
+		if ($this->step == 1) {
147
+			$this->delete_data('give_recount_total_'.$this->form_id);
148 148
 		}
149 149
 
150
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish', 'revoked' ) );
151
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
150
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish', 'revoked'));
151
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
152 152
 
153
-		if ( false === $total ) {
153
+		if (false === $total) {
154 154
 			$total = 0;
155
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
155
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
156 156
 				'post_parent' => $this->form_id,
157 157
 				'post_type'   => 'give_log',
158 158
 				'post_status' => 'publish',
159 159
 				'log_type'    => 'sale',
160 160
 				'fields'      => 'ids',
161 161
 				'nopaging'    => true,
162
-			) );
162
+			));
163 163
 
164
-			$log_ids = $give_logs->get_connected_logs( $args, 'sale' );
164
+			$log_ids = $give_logs->get_connected_logs($args, 'sale');
165 165
 
166
-			if ( $log_ids ) {
167
-				$log_ids     = implode( ',', $log_ids );
168
-				$payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)" );
169
-				unset( $log_ids );
166
+			if ($log_ids) {
167
+				$log_ids     = implode(',', $log_ids);
168
+				$payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids)");
169
+				unset($log_ids);
170 170
 
171
-				$payment_ids = implode( ',', $payment_ids );
172
-				$payments    = $wpdb->get_results( "SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (" . $payment_ids . ")" );
173
-				unset( $payment_ids );
171
+				$payment_ids = implode(',', $payment_ids);
172
+				$payments    = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts WHERE ID IN (".$payment_ids.")");
173
+				unset($payment_ids);
174 174
 
175
-				foreach ( $payments as $payment ) {
176
-					if ( in_array( $payment->post_status, $accepted_statuses ) ) {
175
+				foreach ($payments as $payment) {
176
+					if (in_array($payment->post_status, $accepted_statuses)) {
177 177
 						continue;
178 178
 					}
179 179
 
180
-					$total ++;
180
+					$total++;
181 181
 				}
182 182
 			}
183 183
 
184
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
184
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
185 185
 		}
186 186
 
187 187
 		$percentage = 100;
188 188
 
189
-		if ( $total > 0 ) {
190
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
189
+		if ($total > 0) {
190
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
191 191
 		}
192 192
 
193
-		if ( $percentage > 100 ) {
193
+		if ($percentage > 100) {
194 194
 			$percentage = 100;
195 195
 		}
196 196
 
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @param array $request The Form Data passed into the batch processing
206 206
 	 */
207
-	public function set_properties( $request ) {
208
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
207
+	public function set_properties($request) {
208
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
209 209
 	}
210 210
 
211 211
 	/**
@@ -216,31 +216,31 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function process_step() {
218 218
 
219
-		if ( ! $this->can_export() ) {
220
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
219
+		if ( ! $this->can_export()) {
220
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
221 221
 		}
222 222
 
223 223
 		$had_data = $this->get_data();
224 224
 
225
-		if ( $had_data ) {
225
+		if ($had_data) {
226 226
 			$this->done = false;
227 227
 
228 228
 			return true;
229 229
 		} else {
230
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
231
-			$this->delete_data( 'give_temp_recount_form_stats' );
230
+			$this->delete_data('give_recount_total_'.$this->form_id);
231
+			$this->delete_data('give_temp_recount_form_stats');
232 232
 			$this->done    = true;
233
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
233
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
234 234
 
235 235
 			return false;
236 236
 		}
237 237
 	}
238 238
 
239 239
 	public function headers() {
240
-		ignore_user_abort( true );
240
+		ignore_user_abort(true);
241 241
 
242
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
243
-			set_time_limit( 0 );
242
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
243
+			set_time_limit(0);
244 244
 		}
245 245
 	}
246 246
 
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return mixed       Returns the data from the database
270 270
 	 */
271
-	private function get_stored_data( $key ) {
271
+	private function get_stored_data($key) {
272 272
 		global $wpdb;
273
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
273
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
274 274
 
275
-		return empty( $value ) ? false : maybe_unserialize( $value );
275
+		return empty($value) ? false : maybe_unserialize($value);
276 276
 	}
277 277
 
278 278
 	/**
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @return void
287 287
 	 */
288
-	private function store_data( $key, $value ) {
288
+	private function store_data($key, $value) {
289 289
 		global $wpdb;
290 290
 
291
-		$value = maybe_serialize( $value );
291
+		$value = maybe_serialize($value);
292 292
 
293 293
 		$data = array(
294 294
 			'option_name'  => $key,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 			'%s',
303 303
 		);
304 304
 
305
-		$wpdb->replace( $wpdb->options, $data, $formats );
305
+		$wpdb->replace($wpdb->options, $data, $formats);
306 306
 	}
307 307
 
308 308
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @return void
316 316
 	 */
317
-	private function delete_data( $key ) {
317
+	private function delete_data($key) {
318 318
 		global $wpdb;
319
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
319
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
320 320
 	}
321 321
 
322 322
 }
Please login to merge, or discard this patch.