Test Failed
Push — master ( 5a5a1c...38b67b )
by Devin
15:58 queued 10:09
created
includes/class-give-db-logs.php 1 patch
Spacing   +71 added lines, -73 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_logs';
38
+		$this->table_name  = $wpdb->prefix.'give_logs';
39 39
 		$this->primary_key = 'ID';
40 40
 		$this->version     = '1.0';
41 41
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @return array  Default column values.
74 74
 	 */
75 75
 	public function get_column_defaults() {
76
-		$log_create_date     = current_time( 'mysql', 0 );
77
-		$log_create_date_gmt = get_gmt_from_date( $log_create_date );
76
+		$log_create_date     = current_time('mysql', 0);
77
+		$log_create_date_gmt = get_gmt_from_date($log_create_date);
78 78
 
79 79
 		return array(
80 80
 			'ID'           => 0,
@@ -97,39 +97,39 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return bool|int
99 99
 	 */
100
-	public function add( $data = array() ) {
100
+	public function add($data = array()) {
101 101
 		// Valid table columns.
102
-		$table_columns = array_keys( $this->get_columns() );
102
+		$table_columns = array_keys($this->get_columns());
103 103
 
104 104
 		// Filter data.
105
-		foreach ( $data as $table_column => $column_data ) {
106
-			if ( ! in_array( $table_column, $table_columns ) ) {
107
-				unset( $data[ $table_column ] );
105
+		foreach ($data as $table_column => $column_data) {
106
+			if ( ! in_array($table_column, $table_columns)) {
107
+				unset($data[$table_column]);
108 108
 			}
109 109
 		}
110 110
 
111 111
 		// Set default values.
112
-		$current_log_data = wp_parse_args( $data, $this->get_column_defaults() );
112
+		$current_log_data = wp_parse_args($data, $this->get_column_defaults());
113 113
 
114 114
 		// Log parent should be an int.
115
-		$current_log_data['log_parent'] = absint( $current_log_data['log_parent'] );
115
+		$current_log_data['log_parent'] = absint($current_log_data['log_parent']);
116 116
 
117 117
 		// Get log.
118
-		$existing_log = $this->get_log_by( $current_log_data['ID'] );
118
+		$existing_log = $this->get_log_by($current_log_data['ID']);
119 119
 
120 120
 		// Update an existing log.
121
-		if ( $existing_log ) {
121
+		if ($existing_log) {
122 122
 
123 123
 			// Create new log data from existing and new log data.
124
-			$current_log_data = array_merge( $current_log_data, $existing_log );
124
+			$current_log_data = array_merge($current_log_data, $existing_log);
125 125
 
126 126
 			// Update log data.
127
-			$this->update( $current_log_data['ID'], $current_log_data );
127
+			$this->update($current_log_data['ID'], $current_log_data);
128 128
 
129 129
 			$log_id = $current_log_data['ID'];
130 130
 
131 131
 		} else {
132
-			$log_id = $this->insert( $current_log_data, 'log' );
132
+			$log_id = $this->insert($current_log_data, 'log');
133 133
 		}
134 134
 
135 135
 		return $log_id;
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return bool|null|array
149 149
 	 */
150
-	public function get_log_by( $log_id = 0, $by = 'id' ) {
150
+	public function get_log_by($log_id = 0, $by = 'id') {
151 151
 		/* @var WPDB $wpdb */
152 152
 		global $wpdb;
153 153
 		$log = null;
154 154
 
155 155
 		// Make sure $log_id is int.
156
-		$log_id = absint( $log_id );
156
+		$log_id = absint($log_id);
157 157
 
158 158
 		// Bailout.
159
-		if ( empty( $log_id ) ) {
159
+		if (empty($log_id)) {
160 160
 			return null;
161 161
 		}
162 162
 
163
-		switch ( $by ) {
163
+		switch ($by) {
164 164
 			case 'id':
165 165
 				$log = $wpdb->get_row(
166 166
 					$wpdb->prepare(
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 				break;
173 173
 
174 174
 			default:
175
-				$log = apply_filters( "give_get_log_by_{$by}", $log, $log_id );
175
+				$log = apply_filters("give_get_log_by_{$by}", $log, $log_id);
176 176
 		}
177 177
 
178 178
 		return $log;
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return mixed
190 190
 	 */
191
-	public function get_logs( $args = array() ) {
191
+	public function get_logs($args = array()) {
192 192
 		global $wpdb;
193
-		$sql_query = $this->get_sql( $args );
193
+		$sql_query = $this->get_sql($args);
194 194
 		
195 195
 		// Get log.
196
-		if ( ! ( $logs = Give_Cache::get( 'give_logs', true, $sql_query ) ) ) {
197
-			$logs = $wpdb->get_results( $sql_query );
198
-			Give_Cache::set( 'give_logs', $logs, 3600, true, $sql_query );
196
+		if ( ! ($logs = Give_Cache::get('give_logs', true, $sql_query))) {
197
+			$logs = $wpdb->get_results($sql_query);
198
+			Give_Cache::set('give_logs', $logs, 3600, true, $sql_query);
199 199
 		}
200 200
 
201 201
 		return $logs;
@@ -212,21 +212,21 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return int
214 214
 	 */
215
-	public function count( $args = array() ) {
215
+	public function count($args = array()) {
216 216
 		/* @var WPDB $wpdb */
217 217
 		global $wpdb;
218 218
 		$args['number'] = - 1;
219 219
 		$args['fields'] = 'ID';
220 220
 		$args['count']  = true;
221 221
 
222
-		$sql_query = $this->get_sql( $args );
222
+		$sql_query = $this->get_sql($args);
223 223
 
224
-		if ( ! ( $count = Give_Cache::get( 'give_logs_count', true, $sql_query ) ) ) {
225
-			$count = $wpdb->get_var( $sql_query );
226
-			Give_Cache::set( 'give_logs_count', $count, 3600, true, $args );
224
+		if ( ! ($count = Give_Cache::get('give_logs_count', true, $sql_query))) {
225
+			$count = $wpdb->get_var($sql_query);
226
+			Give_Cache::set('give_logs_count', $count, 3600, true, $args);
227 227
 		}
228 228
 		
229
-		return absint( $count );
229
+		return absint($count);
230 230
 	}
231 231
 
232 232
 	/**
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
         PRIMARY KEY  (ID)
253 253
         ) {$charset_collate};";
254 254
 
255
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
256
-		dbDelta( $sql );
255
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
256
+		dbDelta($sql);
257 257
 
258
-		update_option( $this->table_name . '_db_version', $this->version );
258
+		update_option($this->table_name.'_db_version', $this->version);
259 259
 	}
260 260
 
261 261
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return string
271 271
 	 */
272
-	public function get_sql( $args = array() ) {
272
+	public function get_sql($args = array()) {
273 273
 		/* @var WPDB $wpdb */
274 274
 		global $wpdb;
275 275
 
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 			'count'   => false,
284 284
 		);
285 285
 
286
-		$args = wp_parse_args( $args, $defaults );
286
+		$args = wp_parse_args($args, $defaults);
287 287
 
288 288
 		// validate params.
289
-		$this->validate_params( $args );
289
+		$this->validate_params($args);
290 290
 
291
-		if ( $args['number'] < 1 ) {
291
+		if ($args['number'] < 1) {
292 292
 			$args['number'] = 99999999999;
293 293
 		}
294 294
 
@@ -296,78 +296,78 @@  discard block
 block discarded – undo
296 296
 		$where = '';
297 297
 
298 298
 		// Get sql query for meta.
299
-		if ( ! empty( $args['meta_query'] ) ) {
300
-			$meta_query_object = new WP_Meta_Query( $args['meta_query'] );
301
-			$meta_query        = $meta_query_object->get_sql( 'log', $this->table_name, 'id' );
302
-			$where             = implode( '', $meta_query );
299
+		if ( ! empty($args['meta_query'])) {
300
+			$meta_query_object = new WP_Meta_Query($args['meta_query']);
301
+			$meta_query        = $meta_query_object->get_sql('log', $this->table_name, 'id');
302
+			$where             = implode('', $meta_query);
303 303
 		}
304 304
 
305 305
 		$where .= ' WHERE 1=1 ';
306 306
 
307 307
 		// Set offset.
308
-		if ( empty( $args['offset'] ) && ( 0 < $args['paged'] ) ) {
309
-			$args['offset'] = $args['number'] * ( $args['paged'] - 1 );
308
+		if (empty($args['offset']) && (0 < $args['paged'])) {
309
+			$args['offset'] = $args['number'] * ($args['paged'] - 1);
310 310
 		}
311 311
 
312 312
 		// Set fields.
313 313
 		$fields = "{$this->table_name}.*";
314
-		if ( is_string( $args['fields'] ) && ( 'all' !== $args['fields'] ) ) {
314
+		if (is_string($args['fields']) && ('all' !== $args['fields'])) {
315 315
 			$fields = "{$this->table_name}.{$args['fields']}";
316 316
 		}
317 317
 
318 318
 		// Set count.
319
-		if ( $args['count'] ) {
319
+		if ($args['count']) {
320 320
 			$fields = "COUNT({$fields})";
321 321
 		}
322 322
 
323 323
 		// Specific logs.
324
-		if ( ! empty( $args['ID'] ) ) {
324
+		if ( ! empty($args['ID'])) {
325 325
 
326
-			if ( ! is_array( $args['ID'] ) ) {
327
-				$args['ID'] = explode( ',', $args['ID'] );
326
+			if ( ! is_array($args['ID'])) {
327
+				$args['ID'] = explode(',', $args['ID']);
328 328
 			}
329
-			$log_ids = implode( ',', array_map( 'intval', $args['ID'] ) );
329
+			$log_ids = implode(',', array_map('intval', $args['ID']));
330 330
 
331 331
 			$where .= " AND {$this->table_name}.ID IN( {$log_ids} ) ";
332 332
 		}
333 333
 
334 334
 		// Logs created for a specific date or in a date range
335
-		if ( ! empty( $args['date_query'] ) ) {
336
-			$date_query_object = new WP_Date_Query( $args['date_query'], "{$this->table_name}.log_date" );
337
-			$where             .= $date_query_object->get_sql();
335
+		if ( ! empty($args['date_query'])) {
336
+			$date_query_object = new WP_Date_Query($args['date_query'], "{$this->table_name}.log_date");
337
+			$where .= $date_query_object->get_sql();
338 338
 		}
339 339
 
340 340
 		// Logs create for specific parent.
341
-		if ( ! empty( $args['log_parent'] ) ) {
342
-			if ( ! is_array( $args['log_parent'] ) ) {
343
-				$args['log_parent'] = explode( ',', $args['log_parent'] );
341
+		if ( ! empty($args['log_parent'])) {
342
+			if ( ! is_array($args['log_parent'])) {
343
+				$args['log_parent'] = explode(',', $args['log_parent']);
344 344
 			}
345
-			$parent_ids = implode( ',', array_map( 'intval', $args['log_parent'] ) );
345
+			$parent_ids = implode(',', array_map('intval', $args['log_parent']));
346 346
 
347 347
 			$where .= " AND {$this->table_name}.log_parent IN( {$parent_ids} ) ";
348 348
 		}
349 349
 
350 350
 		// Logs create for specific type.
351 351
 		// is_array check is for backward compatibility.
352
-		if ( ! empty( $args['log_type'] ) && ! is_array( $args['log_type'] ) ) {
353
-			if ( ! is_array( $args['log_type'] ) ) {
354
-				$args['log_type'] = explode( ',', $args['log_type'] );
352
+		if ( ! empty($args['log_type']) && ! is_array($args['log_type'])) {
353
+			if ( ! is_array($args['log_type'])) {
354
+				$args['log_type'] = explode(',', $args['log_type']);
355 355
 			}
356 356
 
357
-			$log_types = implode( '\',\'', array_map( 'trim', $args['log_type'] ) );
357
+			$log_types = implode('\',\'', array_map('trim', $args['log_type']));
358 358
 
359 359
 			$where .= " AND {$this->table_name}.log_type IN( '{$log_types}' ) ";
360 360
 		}
361 361
 
362
-		$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'log_date' : $args['orderby'];
362
+		$args['orderby'] = ! array_key_exists($args['orderby'], $this->get_columns()) ? 'log_date' : $args['orderby'];
363 363
 
364
-		$args['orderby'] = esc_sql( $args['orderby'] );
365
-		$args['order']   = esc_sql( $args['order'] );
364
+		$args['orderby'] = esc_sql($args['orderby']);
365
+		$args['order']   = esc_sql($args['order']);
366 366
 
367 367
 		return $wpdb->prepare(
368 368
 			"SELECT {$fields} FROM {$this->table_name} {$where} ORDER BY {$this->table_name}.{$args['orderby']} {$args['order']} LIMIT %d,%d;",
369
-			absint( $args['offset'] ),
370
-			absint( $args['number'] )
369
+			absint($args['offset']),
370
+			absint($args['number'])
371 371
 		);
372 372
 	}
373 373
 
@@ -382,13 +382,11 @@  discard block
 block discarded – undo
382 382
 	 *
383 383
 	 * @return mixed
384 384
 	 */
385
-	private function validate_params( &$args ) {
385
+	private function validate_params(&$args) {
386 386
 		// fields params
387 387
 		$args['fields'] = 'ids' === $args['fields'] ?
388
-			'ID' :
389
-			$args['fields'];
390
-		$args['fields'] = array_key_exists( $args['fields'], $this->get_columns() ) ?
391
-			$args['fields'] :
392
-			'all';
388
+			'ID' : $args['fields'];
389
+		$args['fields'] = array_key_exists($args['fields'], $this->get_columns()) ?
390
+			$args['fields'] : 'all';
393 391
 	}
394 392
 }
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
68 68
 	 */
69
-	public function __construct( $args = array() ) {
69
+	public function __construct($args = array()) {
70 70
 		$defaults = array(
71 71
 			'output'          => 'payments',
72
-			'post_type'       => array( 'give_payment' ),
72
+			'post_type'       => array('give_payment'),
73 73
 			'start_date'      => false,
74 74
 			'end_date'        => false,
75 75
 			'number'          => 20,
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'count'           => false,
97 97
 		);
98 98
 
99
-		$this->args = $this->_args = wp_parse_args( $args, $defaults );
99
+		$this->args = $this->_args = wp_parse_args($args, $defaults);
100 100
 
101 101
 		$this->init();
102 102
 	}
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	 * @param $query_var
111 111
 	 * @param $value
112 112
 	 */
113
-	public function __set( $query_var, $value ) {
114
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
115
-			$this->args[ $query_var ][] = $value;
113
+	public function __set($query_var, $value) {
114
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
115
+			$this->args[$query_var][] = $value;
116 116
 		} else {
117
-			$this->args[ $query_var ] = $value;
117
+			$this->args[$query_var] = $value;
118 118
 		}
119 119
 	}
120 120
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param $query_var
128 128
 	 */
129
-	public function __unset( $query_var ) {
130
-		unset( $this->args[ $query_var ] );
129
+	public function __unset($query_var) {
130
+		unset($this->args[$query_var]);
131 131
 	}
132 132
 
133 133
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->give_forms();
168 168
 		$this->gateway_filter();
169 169
 
170
-		add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 );
170
+		add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2);
171 171
 
172 172
 		/**
173 173
 		 * Fires after setup filters.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 *
177 177
 		 * @param Give_Payments_Query $this Payments query object.
178 178
 		 */
179
-		do_action( 'give_pre_get_payments', $this );
179
+		do_action('give_pre_get_payments', $this);
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access private
187 187
 	 */
188 188
 	private function unset_filters() {
189
-		remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) );
189
+		remove_filter('posts_orderby', array($this, 'custom_orderby'));
190 190
 
191 191
 		/**
192 192
 		 * Fires after retrieving payments.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 *
196 196
 		 * @param Give_Payments_Query $this Payments query object.
197 197
 		 */
198
-		do_action( 'give_post_get_payments', $this );
198
+		do_action('give_post_get_payments', $this);
199 199
 	}
200 200
 
201 201
 
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 * @return array
213 213
 	 */
214 214
 	public function get_payments() {
215
-		$cache_key      = Give_Cache::get_key( 'give_payment_query', $this->args, false );
216
-		$this->payments = Give_Cache::get_db_query( $cache_key );
215
+		$cache_key      = Give_Cache::get_key('give_payment_query', $this->args, false);
216
+		$this->payments = Give_Cache::get_db_query($cache_key);
217 217
 
218 218
 		// Return cached result.
219
-		if ( ! is_null( $this->payments ) ) {
219
+		if ( ! is_null($this->payments)) {
220 220
 			return $this->payments;
221 221
 		}
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		// Modify the query/query arguments before we retrieve payments.
225 225
 		$this->set_filters();
226 226
 
227
-		$query          = new WP_Query( $this->args );
227
+		$query          = new WP_Query($this->args);
228 228
 		$this->payments = array();
229 229
 
230 230
 		$custom_output = array(
@@ -232,24 +232,24 @@  discard block
 block discarded – undo
232 232
 			'give_payments',
233 233
 		);
234 234
 
235
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
235
+		if ( ! in_array($this->args['output'], $custom_output)) {
236 236
 			return $query->posts;
237 237
 		}
238 238
 
239
-		if ( $query->have_posts() ) {
240
-			while ( $query->have_posts() ) {
239
+		if ($query->have_posts()) {
240
+			while ($query->have_posts()) {
241 241
 				$query->the_post();
242 242
 
243 243
 				$payment_id = get_post()->ID;
244
-				$payment    = new Give_Payment( $payment_id );
244
+				$payment    = new Give_Payment($payment_id);
245 245
 
246
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
246
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
247 247
 			}
248 248
 
249 249
 			wp_reset_postdata();
250 250
 		}
251 251
 
252
-		Give_Cache::set_db_query( $cache_key, $this->payments );
252
+		Give_Cache::set_db_query($cache_key, $this->payments);
253 253
 
254 254
 		// Remove query filters after we retrieve payments.
255 255
 		$this->unset_filters();
@@ -268,31 +268,31 @@  discard block
 block discarded – undo
268 268
 	public function get_payment_by_group() {
269 269
 		global $wpdb;
270 270
 
271
-		$allowed_groups = array( 'post_status' );
271
+		$allowed_groups = array('post_status');
272 272
 		$result         = array();
273 273
 
274 274
 
275
-		if ( in_array( $this->args['group_by'], $allowed_groups ) ) {
275
+		if (in_array($this->args['group_by'], $allowed_groups)) {
276 276
 			// Set only count in result.
277
-			if ( $this->args['count'] ) {
277
+			if ($this->args['count']) {
278 278
 
279 279
 				$this->set_filters();
280 280
 
281
-				$new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N );
281
+				$new_results = $wpdb->get_results($this->get_sql(), ARRAY_N);
282 282
 
283 283
 				$this->unset_filters();
284 284
 
285
-				foreach ( $new_results as $results ) {
286
-					$result[ $results[0] ] = $results[1];
285
+				foreach ($new_results as $results) {
286
+					$result[$results[0]] = $results[1];
287 287
 				}
288 288
 
289
-				switch ( $this->args['group_by'] ) {
289
+				switch ($this->args['group_by']) {
290 290
 					case 'post_status':
291 291
 
292 292
 						/* @var Give_Payment $donation */
293
-						foreach ( give_get_payment_status_keys() as $status ) {
294
-							if ( ! isset( $result[ $status ] ) ) {
295
-								$result[ $status ] = 0;
293
+						foreach (give_get_payment_status_keys() as $status) {
294
+							if ( ! isset($result[$status])) {
295
+								$result[$status] = 0;
296 296
 							}
297 297
 						}
298 298
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 				$donations = $this->get_payments();
303 303
 
304 304
 				/* @var $donation Give_Payment */
305
-				foreach ( $donations as $donation ) {
306
-					$result[ $donation->{$this->args['group_by']} ][] = $donation;
305
+				foreach ($donations as $donation) {
306
+					$result[$donation->{$this->args['group_by']}][] = $donation;
307 307
 				}
308 308
 			}
309 309
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		 *
315 315
 		 * @since 1.8.17
316 316
 		 */
317
-		return apply_filters( 'give_get_payment_by_group', $result, $this );
317
+		return apply_filters('give_get_payment_by_group', $result, $this);
318 318
 	}
319 319
 
320 320
 	/**
@@ -326,29 +326,29 @@  discard block
 block discarded – undo
326 326
 	 * @return void
327 327
 	 */
328 328
 	public function date_filter_pre() {
329
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
329
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
330 330
 			return;
331 331
 		}
332 332
 
333
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
334
-		$is_start_date = property_exists( __CLASS__, 'start_date' );
335
-		$is_end_date   = property_exists( __CLASS__, 'end_date' );
333
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
334
+		$is_start_date = property_exists(__CLASS__, 'start_date');
335
+		$is_end_date   = property_exists(__CLASS__, 'end_date');
336 336
 
337
-		if ( $is_start_date || $is_end_date ) {
337
+		if ($is_start_date || $is_end_date) {
338 338
 			$date_query = array();
339 339
 
340
-			if ( $is_start_date && ! is_wp_error( $this->start_date ) ) {
341
-				$date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date );
340
+			if ($is_start_date && ! is_wp_error($this->start_date)) {
341
+				$date_query['after'] = date('Y-m-d H:i:s', $this->start_date);
342 342
 			}
343 343
 
344
-			if ( $is_end_date && ! is_wp_error( $this->end_date ) ) {
345
-				$date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date );
344
+			if ($is_end_date && ! is_wp_error($this->end_date)) {
345
+				$date_query['before'] = date('Y-m-d H:i:s', $this->end_date);
346 346
 			}
347 347
 
348 348
 			// Include Start Date and End Date while querying.
349 349
 			$date_query['inclusive'] = true;
350 350
 
351
-			$this->__set( 'date_query', $date_query );
351
+			$this->__set('date_query', $date_query);
352 352
 
353 353
 		}
354 354
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	 * @return void
364 364
 	 */
365 365
 	public function status() {
366
-		if ( ! isset( $this->args['status'] ) ) {
366
+		if ( ! isset($this->args['status'])) {
367 367
 			return;
368 368
 		}
369 369
 
370
-		$this->__set( 'post_status', $this->args['status'] );
371
-		$this->__unset( 'status' );
370
+		$this->__set('post_status', $this->args['status']);
371
+		$this->__unset('status');
372 372
 	}
373 373
 
374 374
 	/**
@@ -380,12 +380,12 @@  discard block
 block discarded – undo
380 380
 	 * @return void
381 381
 	 */
382 382
 	public function page() {
383
-		if ( ! isset( $this->args['page'] ) ) {
383
+		if ( ! isset($this->args['page'])) {
384 384
 			return;
385 385
 		}
386 386
 
387
-		$this->__set( 'paged', $this->args['page'] );
388
-		$this->__unset( 'page' );
387
+		$this->__set('paged', $this->args['page']);
388
+		$this->__unset('page');
389 389
 	}
390 390
 
391 391
 	/**
@@ -398,17 +398,17 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	public function per_page() {
400 400
 
401
-		if ( ! isset( $this->args['number'] ) ) {
401
+		if ( ! isset($this->args['number'])) {
402 402
 			return;
403 403
 		}
404 404
 
405
-		if ( $this->args['number'] == - 1 ) {
406
-			$this->__set( 'nopaging', true );
405
+		if ($this->args['number'] == - 1) {
406
+			$this->__set('nopaging', true);
407 407
 		} else {
408
-			$this->__set( 'posts_per_page', $this->args['number'] );
408
+			$this->__set('posts_per_page', $this->args['number']);
409 409
 		}
410 410
 
411
-		$this->__unset( 'number' );
411
+		$this->__unset('number');
412 412
 	}
413 413
 
414 414
 	/**
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
 	 * @return void
421 421
 	 */
422 422
 	public function month() {
423
-		if ( ! isset( $this->args['month'] ) ) {
423
+		if ( ! isset($this->args['month'])) {
424 424
 			return;
425 425
 		}
426 426
 
427
-		$this->__set( 'monthnum', $this->args['month'] );
428
-		$this->__unset( 'month' );
427
+		$this->__set('monthnum', $this->args['month']);
428
+		$this->__unset('month');
429 429
 	}
430 430
 
431 431
 	/**
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 	 * @return void
438 438
 	 */
439 439
 	public function orderby() {
440
-		switch ( $this->args['orderby'] ) {
440
+		switch ($this->args['orderby']) {
441 441
 			case 'amount':
442
-				$this->__set( 'orderby', 'meta_value_num' );
443
-				$this->__set( 'meta_key', '_give_payment_total' );
442
+				$this->__set('orderby', 'meta_value_num');
443
+				$this->__set('meta_key', '_give_payment_total');
444 444
 				break;
445 445
 
446 446
 			case 'status':
447
-				$this->__set( 'orderby', 'post_status' );
447
+				$this->__set('orderby', 'post_status');
448 448
 				break;
449 449
 
450 450
 			case 'donation_form':
451
-				$this->__set( 'orderby', 'meta_value' );
452
-				$this->__set( 'meta_key', '_give_payment_form_title' );
451
+				$this->__set('orderby', 'meta_value');
452
+				$this->__set('meta_key', '_give_payment_form_title');
453 453
 				break;
454 454
 
455 455
 			default:
456
-				$this->__set( 'orderby', $this->args['orderby'] );
456
+				$this->__set('orderby', $this->args['orderby']);
457 457
 				break;
458 458
 		}
459 459
 	}
@@ -470,19 +470,19 @@  discard block
 block discarded – undo
470 470
 	 *
471 471
 	 * @return mixed
472 472
 	 */
473
-	public function custom_orderby( $order, $query ) {
473
+	public function custom_orderby($order, $query) {
474 474
 
475
-		if ( ! empty( $query->query['post_type'] ) ) {
476
-			$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
475
+		if ( ! empty($query->query['post_type'])) {
476
+			$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
477 477
 
478
-			if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) {
478
+			if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) {
479 479
 				return $order;
480 480
 			}
481 481
 
482 482
 			global $wpdb;
483
-			switch ( $query->query['orderby'] ) {
483
+			switch ($query->query['orderby']) {
484 484
 				case 'post_status':
485
-					$order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] );
485
+					$order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']);
486 486
 					break;
487 487
 			}
488 488
 		}
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 	 * @return void
500 500
 	 */
501 501
 	public function user() {
502
-		if ( is_null( $this->args['user'] ) ) {
502
+		if (is_null($this->args['user'])) {
503 503
 			return;
504 504
 		}
505 505
 
506
-		if ( is_numeric( $this->args['user'] ) ) {
506
+		if (is_numeric($this->args['user'])) {
507 507
 			$user_key = '_give_payment_donor_id';
508 508
 		} else {
509 509
 			$user_key = '_give_payment_donor_email';
@@ -525,16 +525,16 @@  discard block
 block discarded – undo
525 525
 	 * @return  void
526 526
 	 */
527 527
 	public function donor() {
528
-		if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) {
528
+		if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) {
529 529
 			return;
530 530
 		}
531 531
 
532 532
 		$donor_meta_type = Give()->donor_meta->meta_type;
533 533
 
534
-		$this->__set( 'meta_query', array(
534
+		$this->__set('meta_query', array(
535 535
 			'key'   => "_give_payment_{$donor_meta_type}_id",
536 536
 			'value' => (int) $this->args['donor'],
537
-		) );
537
+		));
538 538
 	}
539 539
 
540 540
 	/**
@@ -547,33 +547,33 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	public function search() {
549 549
 
550
-		if ( ! isset( $this->args['s'] ) ) {
550
+		if ( ! isset($this->args['s'])) {
551 551
 			return;
552 552
 		}
553 553
 
554
-		$search = trim( $this->args['s'] );
554
+		$search = trim($this->args['s']);
555 555
 
556
-		if ( empty( $search ) ) {
556
+		if (empty($search)) {
557 557
 			return;
558 558
 		}
559 559
 
560
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
561
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
560
+		$is_email = is_email($search) || strpos($search, '@') !== false;
561
+		$is_user  = strpos($search, strtolower('user:')) !== false;
562 562
 
563
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
563
+		if ( ! empty($this->args['search_in_notes'])) {
564 564
 
565
-			$notes = give_get_payment_notes( 0, $search );
565
+			$notes = give_get_payment_notes(0, $search);
566 566
 
567
-			if ( ! empty( $notes ) ) {
567
+			if ( ! empty($notes)) {
568 568
 
569
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
569
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
570 570
 
571
-				$this->__set( 'post__in', $payment_ids );
571
+				$this->__set('post__in', $payment_ids);
572 572
 			}
573 573
 
574
-			$this->__unset( 's' );
574
+			$this->__unset('s');
575 575
 
576
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
576
+		} elseif ($is_email || strlen($search) == 32) {
577 577
 
578 578
 			$key         = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key';
579 579
 			$search_meta = array(
@@ -582,19 +582,19 @@  discard block
 block discarded – undo
582 582
 				'compare' => 'LIKE',
583 583
 			);
584 584
 
585
-			$this->__set( 'meta_query', $search_meta );
586
-			$this->__unset( 's' );
585
+			$this->__set('meta_query', $search_meta);
586
+			$this->__unset('s');
587 587
 
588
-		} elseif ( $is_user ) {
588
+		} elseif ($is_user) {
589 589
 
590 590
 			$search_meta = array(
591 591
 				'key'   => '_give_payment_donor_id',
592
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
592
+				'value' => trim(str_replace('user:', '', strtolower($search))),
593 593
 			);
594 594
 
595
-			$this->__set( 'meta_query', $search_meta );
595
+			$this->__set('meta_query', $search_meta);
596 596
 
597
-			if ( give_get_option( 'enable_sequential' ) ) {
597
+			if (give_get_option('enable_sequential')) {
598 598
 
599 599
 				$search_meta = array(
600 600
 					'key'     => '_give_payment_number',
@@ -602,19 +602,19 @@  discard block
 block discarded – undo
602 602
 					'compare' => 'LIKE',
603 603
 				);
604 604
 
605
-				$this->__set( 'meta_query', $search_meta );
605
+				$this->__set('meta_query', $search_meta);
606 606
 
607 607
 				$this->args['meta_query']['relation'] = 'OR';
608 608
 
609 609
 			}
610 610
 
611
-			$this->__unset( 's' );
611
+			$this->__unset('s');
612 612
 
613 613
 		} elseif (
614
-			give_get_option( 'enable_sequential' ) &&
614
+			give_get_option('enable_sequential') &&
615 615
 			(
616
-				false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) ||
617
-				false !== strpos( $search, give_get_option( 'sequential_postfix' ) )
616
+				false !== strpos($search, give_get_option('sequential_prefix')) ||
617
+				false !== strpos($search, give_get_option('sequential_postfix'))
618 618
 			)
619 619
 		) {
620 620
 
@@ -624,29 +624,29 @@  discard block
 block discarded – undo
624 624
 				'compare' => 'LIKE',
625 625
 			);
626 626
 
627
-			$this->__set( 'meta_query', $search_meta );
628
-			$this->__unset( 's' );
627
+			$this->__set('meta_query', $search_meta);
628
+			$this->__unset('s');
629 629
 
630
-		} elseif ( is_numeric( $search ) ) {
630
+		} elseif (is_numeric($search)) {
631 631
 
632
-			$post = get_post( $search );
632
+			$post = get_post($search);
633 633
 
634
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
634
+			if (is_object($post) && $post->post_type == 'give_payment') {
635 635
 
636 636
 				$arr   = array();
637 637
 				$arr[] = $search;
638
-				$this->__set( 'post__in', $arr );
639
-				$this->__unset( 's' );
638
+				$this->__set('post__in', $arr);
639
+				$this->__unset('s');
640 640
 			}
641
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
641
+		} elseif ('#' == substr($search, 0, 1)) {
642 642
 
643
-			$search = str_replace( '#:', '', $search );
644
-			$search = str_replace( '#', '', $search );
645
-			$this->__set( 'give_forms', $search );
646
-			$this->__unset( 's' );
643
+			$search = str_replace('#:', '', $search);
644
+			$search = str_replace('#', '', $search);
645
+			$this->__set('give_forms', $search);
646
+			$this->__unset('s');
647 647
 
648 648
 		} else {
649
-			$this->__set( 's', $search );
649
+			$this->__set('s', $search);
650 650
 
651 651
 		}
652 652
 
@@ -661,8 +661,8 @@  discard block
 block discarded – undo
661 661
 	 * @return void
662 662
 	 */
663 663
 	public function mode() {
664
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
665
-			$this->__unset( 'mode' );
664
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
665
+			$this->__unset('mode');
666 666
 
667 667
 			return;
668 668
 		}
@@ -684,10 +684,10 @@  discard block
 block discarded – undo
684 684
 	 * @return void
685 685
 	 */
686 686
 	public function children() {
687
-		if ( empty( $this->args['children'] ) ) {
688
-			$this->__set( 'post_parent', 0 );
687
+		if (empty($this->args['children'])) {
688
+			$this->__set('post_parent', 0);
689 689
 		}
690
-		$this->__unset( 'children' );
690
+		$this->__unset('children');
691 691
 	}
692 692
 
693 693
 	/**
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	public function give_forms() {
702 702
 
703
-		if ( empty( $this->args['give_forms'] ) ) {
703
+		if (empty($this->args['give_forms'])) {
704 704
 			return;
705 705
 		}
706 706
 
707 707
 		$compare = '=';
708 708
 
709
-		if ( is_array( $this->args['give_forms'] ) ) {
709
+		if (is_array($this->args['give_forms'])) {
710 710
 			$compare = 'IN';
711 711
 		}
712 712
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 			)
720 720
 		);
721 721
 
722
-		$this->__unset( 'give_forms' );
722
+		$this->__unset('give_forms');
723 723
 
724 724
 	}
725 725
 
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
 	 */
734 734
 	public function gateway_filter() {
735 735
 
736
-		if ( empty( $this->args['gateway'] ) ) {
736
+		if (empty($this->args['gateway'])) {
737 737
 			return;
738 738
 		}
739 739
 
740 740
 		$compare = '=';
741 741
 
742
-		if ( is_array( $this->args['gateway'] ) ) {
742
+		if (is_array($this->args['gateway'])) {
743 743
 			$compare = 'IN';
744 744
 		}
745 745
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 			)
754 754
 		);
755 755
 
756
-		$this->__unset( 'gateway' );
756
+		$this->__unset('gateway');
757 757
 
758 758
 	}
759 759
 
@@ -773,9 +773,9 @@  discard block
 block discarded – undo
773 773
 		global $wpdb;
774 774
 
775 775
 		$where = "WHERE {$wpdb->posts}.post_type = 'give_payment'";
776
-		$where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')";
776
+		$where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')";
777 777
 
778
-		if( is_numeric( $this->args['post_parent'] ) ) {
778
+		if (is_numeric($this->args['post_parent'])) {
779 779
 			$where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}";
780 780
 		}
781 781
 
@@ -784,42 +784,42 @@  discard block
 block discarded – undo
784 784
 		$group_by = '';
785 785
 
786 786
 		// Set group by.
787
-		if ( ! empty( $this->args['group_by'] ) ) {
787
+		if ( ! empty($this->args['group_by'])) {
788 788
 			$group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}";
789 789
 		}
790 790
 
791 791
 		// Set offset.
792 792
 		if (
793
-			empty( $this->args['nopaging'] ) &&
794
-			empty( $this->args['offset'] ) &&
795
-			( ! empty( $this->args['page'] ) && 0 < $this->args['page'] )
793
+			empty($this->args['nopaging']) &&
794
+			empty($this->args['offset']) &&
795
+			( ! empty($this->args['page']) && 0 < $this->args['page'])
796 796
 		) {
797
-			$this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 );
797
+			$this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1);
798 798
 		}
799 799
 
800 800
 		// Set fields.
801 801
 		$fields = "{$wpdb->posts}.*";
802
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
803
-			if ( is_string( $this->args['fields'] ) ) {
802
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
803
+			if (is_string($this->args['fields'])) {
804 804
 				$fields = "{$wpdb->posts}.{$this->args['fields']}";
805
-			} elseif ( is_array( $this->args['fields'] ) ) {
806
-				$fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] );
805
+			} elseif (is_array($this->args['fields'])) {
806
+				$fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']);
807 807
 			}
808 808
 		}
809 809
 
810 810
 		// Set count.
811
-		if ( ! empty( $this->args['count'] ) ) {
811
+		if ( ! empty($this->args['count'])) {
812 812
 			$fields = "COUNT({$wpdb->posts}.ID)";
813 813
 
814
-			if ( ! empty( $this->args['group_by'] ) ) {
814
+			if ( ! empty($this->args['group_by'])) {
815 815
 				$fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}";
816 816
 			}
817 817
 		}
818 818
 
819 819
 		// Date query.
820
-		if ( ! empty( $this->args['date_query'] ) ) {
821
-			$date_query_obj = new WP_Date_Query( $this->args['date_query'] );
822
-			$where          .= str_replace(
820
+		if ( ! empty($this->args['date_query'])) {
821
+			$date_query_obj = new WP_Date_Query($this->args['date_query']);
822
+			$where .= str_replace(
823 823
 				array(
824 824
 					"\n",
825 825
 					'(   (',
@@ -835,21 +835,21 @@  discard block
 block discarded – undo
835 835
 		}
836 836
 
837 837
 		// Meta query.
838
-		if ( ! empty( $this->args['meta_query'] ) ) {
839
-			$meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] );
840
-			$where          = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}";
838
+		if ( ! empty($this->args['meta_query'])) {
839
+			$meta_query_obj = new WP_Meta_Query($this->args['meta_query']);
840
+			$where          = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}";
841 841
 		}
842 842
 
843 843
 		// Set sql query.
844 844
 		$sql = $wpdb->prepare(
845 845
 			"SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;",
846
-			absint( $this->args['offset'] ),
847
-			( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 )
846
+			absint($this->args['offset']),
847
+			(empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999)
848 848
 		);
849 849
 
850 850
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
851 851
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
852
-		$sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql );
852
+		$sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql);
853 853
 
854 854
 		return $sql;
855 855
 	}
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-general.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly.
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_General' ) ) :
16
+if ( ! class_exists('Give_Settings_General')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_General.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'general';
30
-			$this->label = __( 'General', 'give' );
30
+			$this->label = __('General', 'give');
31 31
 
32 32
 			$this->default_tab = 'general-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'access-control':
49 49
 					$settings = array(
50 50
 						// Section 3: Access control.
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 						),
55 55
 						array(
56 56
 							'id'      => 'session_lifetime',
57
-							'name'    => __( 'Session Lifetime', 'give' ),
58
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
57
+							'name'    => __('Session Lifetime', 'give'),
58
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
59 59
 							'type'    => 'select',
60 60
 							'options' => array(
61
-								'86400'  => __( '24 Hours', 'give' ),
62
-								'172800' => __( '48 Hours', 'give' ),
63
-								'259200' => __( '72 Hours', 'give' ),
64
-								'604800' => __( '1 Week', 'give' ),
61
+								'86400'  => __('24 Hours', 'give'),
62
+								'172800' => __('48 Hours', 'give'),
63
+								'259200' => __('72 Hours', 'give'),
64
+								'604800' => __('1 Week', 'give'),
65 65
 							),
66 66
 						),
67 67
 						array(
68 68
 							'id'         => 'limit_display_donations',
69
-							'name'       => __( 'Limit Donations Displayed', 'give' ),
70
-							'desc'       => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ),
69
+							'name'       => __('Limit Donations Displayed', 'give'),
70
+							'desc'       => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'),
71 71
 							'default'    => '1',
72 72
 							'type'       => 'number',
73 73
 							'css'        => 'width:50px;',
@@ -77,36 +77,36 @@  discard block
 block discarded – undo
77 77
 							),
78 78
 						),
79 79
 						array(
80
-							'name'    => __( 'Email Access', 'give' ),
81
-							'desc'    => __( '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' ),
80
+							'name'    => __('Email Access', 'give'),
81
+							'desc'    => __('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'),
82 82
 							'id'      => 'email_access',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'disabled',
85 85
 							'options' => array(
86
-								'enabled'  => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled'  => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							),
89 89
 						),
90 90
 						array(
91 91
 							'id'      => 'recaptcha_key',
92
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
92
+							'name'    => __('reCAPTCHA Site Key', 'give'),
93 93
 							/* translators: %s: https://www.google.com/recaptcha/ */
94
-							'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 and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ),
94
+							'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 and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')),
95 95
 							'default' => '',
96 96
 							'type'    => 'text',
97 97
 						),
98 98
 						array(
99 99
 							'id'      => 'recaptcha_secret',
100
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
101
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give' ),
100
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
101
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give'),
102 102
 							'default' => '',
103 103
 							'type'    => 'text',
104 104
 						),
105 105
 						array(
106
-							'name'  => __( 'Access Control Docs Link', 'give' ),
106
+							'name'  => __('Access Control Docs Link', 'give'),
107 107
 							'id'    => 'access_control_docs_link',
108
-							'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
109
-							'title' => __( 'Access Control', 'give' ),
108
+							'url'   => esc_url('http://docs.givewp.com/settings-access-control'),
109
+							'title' => __('Access Control', 'give'),
110 110
 							'type'  => 'give_docs_link',
111 111
 						),
112 112
 						array(
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 					break;
118 118
 
119 119
 				case 'currency-settings' :
120
-					$current_position_before = __( 'Before - %s&#x200e;10', 'give' );
121
-					$current_position_after  = __( 'After - 10%s&#x200f;', 'give' );
120
+					$current_position_before = __('Before - %s&#x200e;10', 'give');
121
+					$current_position_after  = __('After - 10%s&#x200f;', 'give');
122 122
 
123 123
 					$settings = array(
124 124
 						// Section 2: Currency
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 							'id'   => 'give_title_general_settings_2',
128 128
 						),
129 129
 						array(
130
-							'name' => __( 'Currency Settings', 'give' ),
130
+							'name' => __('Currency Settings', 'give'),
131 131
 							'desc' => '',
132 132
 							'type' => 'give_title',
133 133
 							'id'   => 'give_title_general_settings_2',
134 134
 						),
135 135
 						array(
136
-							'name'    => __( 'Currency', 'give' ),
137
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
136
+							'name'    => __('Currency', 'give'),
137
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
138 138
 							'id'      => 'currency',
139 139
 							'class'   => 'give-select-chosen',
140 140
 							'type'    => 'select',
@@ -142,51 +142,51 @@  discard block
 block discarded – undo
142 142
 							'default' => 'USD',
143 143
 						),
144 144
 						array(
145
-							'name'       => __( 'Currency Position', 'give' ),
146
-							'desc'       => __( 'The position of the currency symbol.', 'give' ),
145
+							'name'       => __('Currency Position', 'give'),
146
+							'desc'       => __('The position of the currency symbol.', 'give'),
147 147
 							'id'         => 'currency_position',
148 148
 							'type'       => 'select',
149 149
 							'options'    => array(
150 150
 								/* translators: %s: currency symbol */
151
-								'before' => sprintf( $current_position_before, give_currency_symbol( give_get_currency() ) ),
151
+								'before' => sprintf($current_position_before, give_currency_symbol(give_get_currency())),
152 152
 								/* translators: %s: currency symbol */
153
-								'after'  => sprintf( __( $current_position_after, 'give' ), give_currency_symbol( give_get_currency() ) ),
153
+								'after'  => sprintf(__($current_position_after, 'give'), give_currency_symbol(give_get_currency())),
154 154
 							),
155 155
 							'default'    => 'before',
156 156
 							'attributes' => array(
157
-								'data-before-template' => sprintf( $current_position_before, '{currency_pos}' ),
158
-								'data-after-template' => sprintf( $current_position_after, '{currency_pos}' ),
157
+								'data-before-template' => sprintf($current_position_before, '{currency_pos}'),
158
+								'data-after-template' => sprintf($current_position_after, '{currency_pos}'),
159 159
 							),
160 160
 						),
161 161
 						array(
162
-							'name'    => __( 'Thousands Separator', 'give' ),
163
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
162
+							'name'    => __('Thousands Separator', 'give'),
163
+							'desc'    => __('The symbol (typically , or .) to separate thousands.', 'give'),
164 164
 							'id'      => 'thousands_separator',
165 165
 							'type'    => 'text',
166 166
 							'default' => ',',
167 167
 							'css'     => 'width:12em;',
168 168
 						),
169 169
 						array(
170
-							'name'    => __( 'Decimal Separator', 'give' ),
171
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
170
+							'name'    => __('Decimal Separator', 'give'),
171
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
172 172
 							'id'      => 'decimal_separator',
173 173
 							'type'    => 'text',
174 174
 							'default' => '.',
175 175
 							'css'     => 'width:12em;',
176 176
 						),
177 177
 						array(
178
-							'name'    => __( 'Number of Decimals', 'give' ),
179
-							'desc'    => __( 'The number of decimal points displayed in amounts.', 'give' ),
178
+							'name'    => __('Number of Decimals', 'give'),
179
+							'desc'    => __('The number of decimal points displayed in amounts.', 'give'),
180 180
 							'id'      => 'number_decimals',
181 181
 							'type'    => 'text',
182 182
 							'default' => 2,
183 183
 							'css'     => 'width:12em;',
184 184
 						),
185 185
 						array(
186
-							'name'  => __( 'Currency Options Docs Link', 'give' ),
186
+							'name'  => __('Currency Options Docs Link', 'give'),
187 187
 							'id'    => 'currency_settings_docs_link',
188
-							'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
189
-							'title' => __( 'Currency Settings', 'give' ),
188
+							'url'   => esc_url('http://docs.givewp.com/settings-currency'),
189
+							'title' => __('Currency Settings', 'give'),
190 190
 							'type'  => 'give_docs_link',
191 191
 						),
192 192
 						array(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					$country = give_get_country();
203 203
 
204 204
 					// get the list of the states of which default country is selected.
205
-					$states = give_get_states( $country );
205
+					$states = give_get_states($country);
206 206
 
207 207
 					// Get the country list that does not have any states init.
208 208
 					$no_states_country = give_no_states_country_list();
@@ -214,46 +214,46 @@  discard block
 block discarded – undo
214 214
 							'id'   => 'give_title_general_settings_1',
215 215
 						),
216 216
 						array(
217
-							'name' => __( 'General Settings', 'give' ),
217
+							'name' => __('General Settings', 'give'),
218 218
 							'desc' => '',
219 219
 							'type' => 'give_title',
220 220
 							'id'   => 'give_title_general_settings_1',
221 221
 						),
222 222
 						array(
223
-							'name'    => __( 'Success Page', 'give' ),
223
+							'name'    => __('Success Page', 'give'),
224 224
 							/* translators: %s: [give_receipt] */
225
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
225
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
226 226
 							'id'      => 'success_page',
227 227
 							'type'    => 'select',
228
-							'options' => give_cmb2_get_post_options( array(
228
+							'options' => give_cmb2_get_post_options(array(
229 229
 								'post_type'   => 'page',
230 230
 								'numberposts' => 999,
231
-							) ),
231
+							)),
232 232
 						),
233 233
 						array(
234
-							'name'    => __( 'Failed Donation Page', 'give' ),
235
-							'desc'    => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
234
+							'name'    => __('Failed Donation Page', 'give'),
235
+							'desc'    => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
236 236
 							'id'      => 'failure_page',
237 237
 							'type'    => 'select',
238
-							'options' => give_cmb2_get_post_options( array(
238
+							'options' => give_cmb2_get_post_options(array(
239 239
 								'post_type'   => 'page',
240 240
 								'numberposts' => 999,
241
-							) ),
241
+							)),
242 242
 						),
243 243
 						array(
244
-							'name'    => __( 'Donation History Page', 'give' ),
244
+							'name'    => __('Donation History Page', 'give'),
245 245
 							/* translators: %s: [donation_history] */
246
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
246
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
247 247
 							'id'      => 'history_page',
248 248
 							'type'    => 'select',
249
-							'options' => give_cmb2_get_post_options( array(
249
+							'options' => give_cmb2_get_post_options(array(
250 250
 								'post_type'   => 'page',
251 251
 								'numberposts' => 999,
252
-							) ),
252
+							)),
253 253
 						),
254 254
 						array(
255
-							'name'    => __( 'Base Country', 'give' ),
256
-							'desc'    => __( 'The country your site operates from.', 'give' ),
255
+							'name'    => __('Base Country', 'give'),
256
+							'desc'    => __('The country your site operates from.', 'give'),
257 257
 							'id'      => 'base_country',
258 258
 							'type'    => 'select',
259 259
 							'options' => give_get_country_list(),
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
 						 * @since 1.8.14
265 265
 						 */
266 266
 						array(
267
-							'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ),
268
-							'name'          => __( 'Base State/Province', 'give' ),
269
-							'desc'          => __( 'The state/province your site operates from.', 'give' ),
267
+							'wrapper_class' => (array_key_exists($country, $no_states_country) ? 'give-hidden' : ''),
268
+							'name'          => __('Base State/Province', 'give'),
269
+							'desc'          => __('The state/province your site operates from.', 'give'),
270 270
 							'id'            => 'base_state',
271
-							'type'          => ( empty( $states ) ? 'text' : 'select' ),
271
+							'type'          => (empty($states) ? 'text' : 'select'),
272 272
 							'options'       => $states,
273 273
 						),
274 274
 						array(
275
-							'name'  => __( 'General Options Docs Link', 'give' ),
275
+							'name'  => __('General Options Docs Link', 'give'),
276 276
 							'id'    => 'general_options_docs_link',
277
-							'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
278
-							'title' => __( 'General Options', 'give' ),
277
+							'url'   => esc_url('http://docs.givewp.com/settings-general'),
278
+							'title' => __('General Options', 'give'),
279 279
 							'type'  => 'give_docs_link',
280 280
 						),
281 281
 						array(
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 * Filter the general settings.
291 291
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
292 292
 			 */
293
-			$settings = apply_filters( 'give_settings_general', $settings );
293
+			$settings = apply_filters('give_settings_general', $settings);
294 294
 
295 295
 			/**
296 296
 			 * Filter the settings.
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			 *
300 300
 			 * @param  array $settings
301 301
 			 */
302
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
302
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
303 303
 
304 304
 			// Output.
305 305
 			return $settings;
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 		 */
314 314
 		public function get_sections() {
315 315
 			$sections = array(
316
-				'general-settings'  => __( 'General', 'give' ),
317
-				'currency-settings' => __( 'Currency', 'give' ),
318
-				'access-control'    => __( 'Access Control', 'give' ),
316
+				'general-settings'  => __('General', 'give'),
317
+				'currency-settings' => __('Currency', 'give'),
318
+				'access-control'    => __('Access Control', 'give'),
319 319
 			);
320 320
 
321
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
321
+			return apply_filters('give_get_sections_'.$this->id, $sections);
322 322
 		}
323 323
 	}
324 324
 
Please login to merge, or discard this patch.
includes/donors/class-give-donors-query.php 1 patch
Spacing   +53 added lines, -54 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
88 88
 	 */
89
-	public function __construct( $args = array() ) {
89
+	public function __construct($args = array()) {
90 90
 		$defaults = array(
91 91
 			'number'     => 20,
92 92
 			'offset'     => 0,
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			// 'form'       => array(),
105 105
 		);
106 106
 
107
-		$this->args = wp_parse_args( $args, $defaults );
107
+		$this->args = wp_parse_args($args, $defaults);
108 108
 		$this->table_name      = Give()->donors->table_name;
109 109
 		$this->meta_table_name = Give()->donor_meta->table_name;
110 110
 		$this->meta_type       = Give()->donor_meta->meta_type;
@@ -146,21 +146,21 @@  discard block
 block discarded – undo
146 146
 		 *
147 147
 		 * @param Give_Donors_Query $this Donors query object.
148 148
 		 */
149
-		do_action( 'give_pre_get_donors', $this );
149
+		do_action('give_pre_get_donors', $this);
150 150
 
151
-		$cache_key        = Give_Cache::get_key( 'give_donor', $this->get_sql(), false );
151
+		$cache_key = Give_Cache::get_key('give_donor', $this->get_sql(), false);
152 152
 
153 153
 		// Get donors from cache.
154
-		$this->donors = Give_Cache::get_db_query( $cache_key );
154
+		$this->donors = Give_Cache::get_db_query($cache_key);
155 155
 
156
-		if ( is_null( $this->donors  ) ) {
157
-			if ( empty( $this->args['count'] ) ) {
158
-				$this->donors = $wpdb->get_results( $this->get_sql() );
156
+		if (is_null($this->donors)) {
157
+			if (empty($this->args['count'])) {
158
+				$this->donors = $wpdb->get_results($this->get_sql());
159 159
 			} else {
160
-				$this->donors = $wpdb->get_var( $this->get_sql() );
160
+				$this->donors = $wpdb->get_var($this->get_sql());
161 161
 			}
162 162
 
163
-			Give_Cache::set_db_query( $cache_key, $this->donors );
163
+			Give_Cache::set_db_query($cache_key, $this->donors);
164 164
 		}
165 165
 
166 166
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		 *
172 172
 		 * @param Give_Donors_Query $this Donors query object.
173 173
 		 */
174
-		do_action( 'give_post_get_donors', $this );
174
+		do_action('give_post_get_donors', $this);
175 175
 
176 176
 		return $this->donors;
177 177
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	public function get_sql() {
189 189
 		global $wpdb;
190 190
 
191
-		if ( $this->args['number'] < 1 ) {
191
+		if ($this->args['number'] < 1) {
192 192
 			$this->args['number'] = 99999999999;
193 193
 		}
194 194
 
@@ -196,22 +196,22 @@  discard block
 block discarded – undo
196 196
 
197 197
 
198 198
 		// Set offset.
199
-		if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) {
200
-			$this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 );
199
+		if (empty($this->args['offset']) && (0 < $this->args['paged'])) {
200
+			$this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1);
201 201
 		}
202 202
 
203 203
 		// Set fields.
204 204
 		$fields = "{$this->table_name}.*";
205
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
206
-			if ( is_string( $this->args['fields'] ) ) {
205
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
206
+			if (is_string($this->args['fields'])) {
207 207
 				$fields = "{$this->table_name}.{$this->args['fields']}";
208
-			} elseif ( is_array( $this->args['fields'] ) ) {
209
-				$fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] );
208
+			} elseif (is_array($this->args['fields'])) {
209
+				$fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']);
210 210
 			}
211 211
 		}
212 212
 
213 213
 		// Set count.
214
-		if ( ! empty( $this->args['count'] ) ) {
214
+		if ( ! empty($this->args['count'])) {
215 215
 			$fields = "COUNT({$this->table_name}.id)";
216 216
 		}
217 217
 
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$sql = $wpdb->prepare(
221 221
 			"SELECT {$fields} FROM {$this->table_name} LIMIT %d,%d;",
222
-			absint( $this->args['offset'] ),
223
-			absint( $this->args['number'] )
222
+			absint($this->args['offset']),
223
+			absint($this->args['number'])
224 224
 		);
225 225
 
226 226
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
227 227
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
228
-		$sql = str_replace( 'LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql );
228
+		$sql = str_replace('LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql);
229 229
 
230 230
 		return $sql;
231 231
 	}
@@ -243,15 +243,15 @@  discard block
 block discarded – undo
243 243
 		$where = '';
244 244
 
245 245
 		// Get sql query for meta.
246
-		if ( ! empty( $this->args['meta_query'] ) ) {
247
-			$meta_query_object = new WP_Meta_Query( $this->args['meta_query'] );
246
+		if ( ! empty($this->args['meta_query'])) {
247
+			$meta_query_object = new WP_Meta_Query($this->args['meta_query']);
248 248
 			$meta_query        = $meta_query_object->get_sql(
249 249
 				$this->meta_type,
250 250
 				$this->table_name,
251 251
 				'id'
252 252
 			);
253 253
 
254
-			$where = implode( '', $meta_query );
254
+			$where = implode('', $meta_query);
255 255
 		}
256 256
 
257 257
 		$where .= 'WHERE 1=1 ';
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		$where .= $this->get_where_user();
262 262
 		$where .= $this->get_where_date();
263 263
 
264
-		return trim( $where );
264
+		return trim($where);
265 265
 		
266 266
 	}
267 267
 
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
 
280 280
 		$where = '';
281 281
 
282
-		if ( ! empty( $this->args['email'] ) ) {
282
+		if ( ! empty($this->args['email'])) {
283 283
 
284
-			if ( is_array( $this->args['email'] ) ) {
284
+			if (is_array($this->args['email'])) {
285 285
 
286
-				$emails_count       = count( $this->args['email'] );
287
-				$emails_placeholder = array_fill( 0, $emails_count, '%s' );
288
-				$emails             = implode( ', ', $emails_placeholder );
286
+				$emails_count       = count($this->args['email']);
287
+				$emails_placeholder = array_fill(0, $emails_count, '%s');
288
+				$emails             = implode(', ', $emails_placeholder);
289 289
 
290
-				$where .= $wpdb->prepare( "AND {$this->table_name}.email IN( $emails )", $this->args['email'] );
290
+				$where .= $wpdb->prepare("AND {$this->table_name}.email IN( $emails )", $this->args['email']);
291 291
 			} else {
292
-				$where .= $wpdb->prepare( "AND {$this->table_name}.email = %s", $this->args['email'] );
292
+				$where .= $wpdb->prepare("AND {$this->table_name}.email = %s", $this->args['email']);
293 293
 			}
294 294
 		}
295 295
 
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 		$where = '';
310 310
 
311 311
 		// Specific donors.
312
-		if ( ! empty( $this->args['donor'] ) ) {
313
-			if ( ! is_array( $this->args['donor'] ) ) {
314
-				$this->args['donor'] = explode( ',', $this->args['donor'] );
312
+		if ( ! empty($this->args['donor'])) {
313
+			if ( ! is_array($this->args['donor'])) {
314
+				$this->args['donor'] = explode(',', $this->args['donor']);
315 315
 			}
316
-			$donor_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) );
316
+			$donor_ids = implode(',', array_map('intval', $this->args['donor']));
317 317
 
318 318
 			$where .= "AND {$this->table_name}.id IN( {$donor_ids} )";
319 319
 		}
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 		$where = '';
335 335
 
336 336
 		// Donors created for a specific date or in a date range
337
-		if ( ! empty( $this->args['date_query'] ) ) {
337
+		if ( ! empty($this->args['date_query'])) {
338 338
 			$date_query_object = new WP_Date_Query(
339
-				is_array( $this->args['date_query'] ) ? $this->args['date_query'] : wp_parse_args( $this->args['date_query'] ),
339
+				is_array($this->args['date_query']) ? $this->args['date_query'] : wp_parse_args($this->args['date_query']),
340 340
 				"{$this->table_name}.date_created"
341 341
 			);
342 342
 
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
 		$where = '';
372 372
 
373 373
 		// Donors created for a specific date or in a date range
374
-		if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) {
375
-			$search_parts = explode( ':', $this->args['s'] );
374
+		if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) {
375
+			$search_parts = explode(':', $this->args['s']);
376 376
 
377
-			if ( ! empty( $search_parts[0] ) ) {
378
-				switch ( $search_parts[0] ) {
377
+			if ( ! empty($search_parts[0])) {
378
+				switch ($search_parts[0]) {
379 379
 					case 'name':
380 380
 						$where = "AND {$this->table_name}.name LIKE '%{$search_parts[1]}%'";
381 381
 						break;
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 		$where = '';
404 404
 
405 405
 		// Donors create for specific wp user.
406
-		if ( ! empty( $this->args['user'] ) ) {
407
-			if ( ! is_array( $this->args['user'] ) ) {
408
-				$this->args['user'] = explode( ',', $this->args['user'] );
406
+		if ( ! empty($this->args['user'])) {
407
+			if ( ! is_array($this->args['user'])) {
408
+				$this->args['user'] = explode(',', $this->args['user']);
409 409
 			}
410
-			$user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) );
410
+			$user_ids = implode(',', array_map('intval', $this->args['user']));
411 411
 
412 412
 			$where .= "AND {$this->table_name}.user_id IN( {$user_ids} )";
413 413
 		}
@@ -426,14 +426,13 @@  discard block
 block discarded – undo
426 426
 	private function get_order_query() {
427 427
 		$table_columns = Give()->donors->get_columns();
428 428
 
429
-		$this->args['orderby'] = ! array_key_exists( $this->args['orderby'], $table_columns ) ?
430
-			'id' :
431
-			$this->args['orderby'];
429
+		$this->args['orderby'] = ! array_key_exists($this->args['orderby'], $table_columns) ?
430
+			'id' : $this->args['orderby'];
432 431
 
433
-		$this->args['orderby'] = esc_sql( $this->args['orderby'] );
434
-		$this->args['order']   = esc_sql( $this->args['order'] );
432
+		$this->args['orderby'] = esc_sql($this->args['orderby']);
433
+		$this->args['order']   = esc_sql($this->args['order']);
435 434
 
436
-		switch ( $table_columns[ $this->args['orderby'] ] ) {
435
+		switch ($table_columns[$this->args['orderby']]) {
437 436
 			case '%d':
438 437
 			case '%f':
439 438
 				$query = "ORDER BY {$this->table_name}.{$this->args['orderby']}+0";
Please login to merge, or discard this patch.