Completed
Pull Request — master (#1412)
by Ravinder
17:25
created
includes/admin/shortcodes/abstract-shortcode-generator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,8 +248,8 @@
 block discarded – undo
248 248
 
249 249
 			// do not reindex array!
250 250
 			$field['options'] = array(
251
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
-			                    ) + $field['options'];
251
+									'' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
+								) + $field['options'];
253 253
 
254 254
 			foreach ( $field['options'] as $value => $text ) {
255 255
 				$new_listbox['values'][] = array(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 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,12 +62,12 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @since 1.0
64 64
 	 */
65
-	public function __construct( $shortcode ) {
65
+	public function __construct($shortcode) {
66 66
 
67 67
 
68 68
 		$this->shortcode_tag = $shortcode;
69 69
 
70
-		add_action( 'admin_init', array( $this, 'init' ) );
70
+		add_action('admin_init', array($this, 'init'));
71 71
 
72 72
 	}
73 73
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public function init() {
80 80
 
81
-		if ( $this->shortcode_tag ) {
81
+		if ($this->shortcode_tag) {
82 82
 
83
-			$this->self = get_class( $this );
83
+			$this->self = get_class($this);
84 84
 
85 85
 			$this->errors   = array();
86 86
 			$this->required = array();
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
 			$fields = $this->get_fields();
90 90
 
91 91
 			$defaults = array(
92
-				'btn_close' => esc_html__( 'Close', 'give' ),
93
-				'btn_okay'  => esc_html__( 'Insert Shortcode', 'give' ),
92
+				'btn_close' => esc_html__('Close', 'give'),
93
+				'btn_okay'  => esc_html__('Insert Shortcode', 'give'),
94 94
 				'errors'    => $this->errors,
95 95
 				'fields'    => $fields,
96
-				'label'     => '[' . $this->shortcode_tag . ']',
96
+				'label'     => '['.$this->shortcode_tag.']',
97 97
 				'required'  => $this->required,
98
-				'title'     => esc_html__( 'Insert Shortcode', 'give' ),
98
+				'title'     => esc_html__('Insert Shortcode', 'give'),
99 99
 			);
100 100
 
101
-			if ( user_can_richedit() ) {
101
+			if (user_can_richedit()) {
102 102
 
103
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
103
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
104 104
 
105 105
 			}
106 106
 		}
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since 1.0
131 131
 	 */
132
-	protected function generate_fields( $defined_fields ) {
132
+	protected function generate_fields($defined_fields) {
133 133
 
134 134
 		$fields = array();
135 135
 
136
-		if ( is_array( $defined_fields ) ) {
136
+		if (is_array($defined_fields)) {
137 137
 
138
-			foreach ( $defined_fields as $field ) {
138
+			foreach ($defined_fields as $field) {
139 139
 
140 140
 				$defaults = array(
141 141
 					'label'       => false,
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 					'type'        => '',
147 147
 				);
148 148
 
149
-				$field  = wp_parse_args( (array) $field, $defaults );
150
-				$method = 'generate_' . strtolower( $field['type'] );
149
+				$field  = wp_parse_args((array) $field, $defaults);
150
+				$method = 'generate_'.strtolower($field['type']);
151 151
 
152
-				if ( method_exists( $this, $method ) ) {
152
+				if (method_exists($this, $method)) {
153 153
 
154
-					$field = call_user_func( array( $this, $method ), $field );
154
+					$field = call_user_func(array($this, $method), $field);
155 155
 
156
-					if ( $field ) {
156
+					if ($field) {
157 157
 						$fields[] = $field;
158 158
 					}
159 159
 				}
@@ -173,22 +173,22 @@  discard block
 block discarded – undo
173 173
 	protected function get_fields() {
174 174
 
175 175
 		$defined_fields   = $this->define_fields();
176
-		$generated_fields = $this->generate_fields( $defined_fields );
176
+		$generated_fields = $this->generate_fields($defined_fields);
177 177
 
178 178
 		$errors = array();
179 179
 
180
-		if ( ! empty( $this->errors ) ) {
181
-			foreach ( $this->required as $name => $alert ) {
182
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
180
+		if ( ! empty($this->errors)) {
181
+			foreach ($this->required as $name => $alert) {
182
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
183 183
 
184
-					$errors[] = $this->errors[ $name ];
184
+					$errors[] = $this->errors[$name];
185 185
 				}
186 186
 			}
187 187
 
188 188
 			$this->errors = $errors;
189 189
 		}
190 190
 
191
-		if ( ! empty( $errors ) ) {
191
+		if ( ! empty($errors)) {
192 192
 
193 193
 			return $errors;
194 194
 		}
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	protected function generate_container( $field ) {
208
+	protected function generate_container($field) {
209 209
 
210
-		if ( array_key_exists( 'html', $field ) ) {
210
+		if (array_key_exists('html', $field)) {
211 211
 
212 212
 			return array(
213 213
 				'type' => $field['type'],
@@ -227,36 +227,36 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @since 1.0
229 229
 	 */
230
-	protected function generate_listbox( $field ) {
230
+	protected function generate_listbox($field) {
231 231
 
232
-		$listbox = shortcode_atts( array(
232
+		$listbox = shortcode_atts(array(
233 233
 			'label'    => '',
234 234
 			'minWidth' => '',
235 235
 			'name'     => false,
236 236
 			'tooltip'  => '',
237 237
 			'type'     => '',
238 238
 			'value'    => '',
239
-		), $field );
239
+		), $field);
240 240
 
241
-		if ( $this->validate( $field ) ) {
241
+		if ($this->validate($field)) {
242 242
 
243 243
 			$new_listbox = array();
244 244
 
245
-			foreach ( $listbox as $key => $value ) {
245
+			foreach ($listbox as $key => $value) {
246 246
 
247
-				if ( $key == 'value' && empty( $value ) ) {
248
-					$new_listbox[ $key ] = $listbox['name'];
249
-				} else if ( $value ) {
250
-					$new_listbox[ $key ] = $value;
247
+				if ($key == 'value' && empty($value)) {
248
+					$new_listbox[$key] = $listbox['name'];
249
+				} else if ($value) {
250
+					$new_listbox[$key] = $value;
251 251
 				}
252 252
 			}
253 253
 
254 254
 			// do not reindex array!
255 255
 			$field['options'] = array(
256
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
256
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')),
257 257
 			                    ) + $field['options'];
258 258
 
259
-			foreach ( $field['options'] as $value => $text ) {
259
+			foreach ($field['options'] as $value => $text) {
260 260
 				$new_listbox['values'][] = array(
261 261
 					'text'  => $text,
262 262
 					'value' => $value,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @since 1.0
280 280
 	 */
281
-	protected function generate_post( $field ) {
281
+	protected function generate_post($field) {
282 282
 
283 283
 		$args = array(
284 284
 			'post_type'      => 'post',
@@ -287,23 +287,23 @@  discard block
 block discarded – undo
287 287
 			'posts_per_page' => 30,
288 288
 		);
289 289
 
290
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
291
-		$posts   = get_posts( $args );
290
+		$args    = wp_parse_args((array) $field['query_args'], $args);
291
+		$posts   = get_posts($args);
292 292
 		$options = array();
293 293
 
294
-		if ( $posts ) {
295
-			foreach ( $posts as $post ) {
296
-				$options[ absint( $post->ID ) ] = ( empty( $post->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) : $post->post_title );
294
+		if ($posts) {
295
+			foreach ($posts as $post) {
296
+				$options[absint($post->ID)] = (empty($post->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $post->ID) : $post->post_title);
297 297
 			}
298 298
 
299 299
 			$field['type']    = 'listbox';
300 300
 			$field['options'] = $options;
301 301
 
302
-			return $this->generate_listbox( $field );
302
+			return $this->generate_listbox($field);
303 303
 		}
304 304
 
305 305
 		// perform validation here before returning false
306
-		$this->validate( $field );
306
+		$this->validate($field);
307 307
 
308 308
 		return false;
309 309
 	}
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @since 1.0
319 319
 	 */
320
-	protected function generate_textbox( $field ) {
320
+	protected function generate_textbox($field) {
321 321
 
322
-		$textbox = shortcode_atts( array(
322
+		$textbox = shortcode_atts(array(
323 323
 			'label'     => '',
324 324
 			'maxLength' => '',
325 325
 			'minHeight' => '',
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 			'tooltip'   => '',
330 330
 			'type'      => '',
331 331
 			'value'     => '',
332
-		), $field );
332
+		), $field);
333 333
 
334
-		if ( $this->validate( $field ) ) {
335
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
334
+		if ($this->validate($field)) {
335
+			return array_filter($textbox, array($this, 'return_textbox_value'));
336 336
 		}
337 337
 
338 338
 		return false;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @return bool
347 347
 	 */
348
-	function return_textbox_value( $value ) {
348
+	function return_textbox_value($value) {
349 349
 		return $value !== '';
350 350
 	}
351 351
 
@@ -361,9 +361,9 @@  discard block
 block discarded – undo
361 361
 	 *
362 362
 	 * @since 1.0
363 363
 	 */
364
-	protected function validate( $field ) {
364
+	protected function validate($field) {
365 365
 
366
-		extract( shortcode_atts(
366
+		extract(shortcode_atts(
367 367
 				array(
368 368
 					'name'     => false,
369 369
 					'required' => false,
@@ -371,36 +371,36 @@  discard block
 block discarded – undo
371 371
 				), $field )
372 372
 		);
373 373
 
374
-		if ( $name ) {
374
+		if ($name) {
375 375
 
376
-			if ( isset( $required['error'] ) ) {
376
+			if (isset($required['error'])) {
377 377
 
378 378
 				$error = array(
379 379
 					'type' => 'container',
380 380
 					'html' => $required['error'],
381 381
 				);
382 382
 
383
-				$this->errors[ $name ] = $this->generate_container( $error );
383
+				$this->errors[$name] = $this->generate_container($error);
384 384
 			}
385 385
 
386
-			if ( ! ! $required || is_array( $required ) ) {
386
+			if ( ! ! $required || is_array($required)) {
387 387
 
388
-				$alert = esc_html__( 'Some of the shortcode options are required.', 'give' );
388
+				$alert = esc_html__('Some of the shortcode options are required.', 'give');
389 389
 
390
-				if ( isset( $required['alert'] ) ) {
390
+				if (isset($required['alert'])) {
391 391
 
392 392
 					$alert = $required['alert'];
393 393
 
394
-				} else if ( ! empty( $label ) ) {
394
+				} else if ( ! empty($label)) {
395 395
 
396 396
 					$alert = sprintf(
397 397
 					/* translators: %s: option label */
398
-						esc_html__( 'The "%s" option is required.', 'give' ),
399
-						str_replace( ':', '', $label )
398
+						esc_html__('The "%s" option is required.', 'give'),
399
+						str_replace(':', '', $label)
400 400
 					);
401 401
 				}
402 402
 
403
-				$this->required[ $name ] = $alert;
403
+				$this->required[$name] = $alert;
404 404
 			}
405 405
 
406 406
 			return true;
Please login to merge, or discard this patch.
includes/admin/customers/customer-functions.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views
25 25
  */
26
-function give_register_default_customer_views( $views ) {
26
+function give_register_default_customer_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_customers_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_customer_notes_view'
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 );
38
+add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single customer view
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_customer_tabs( $tabs ) {
49
+function give_register_default_customer_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52
-		'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ),
53
-		'notes'    => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) )
52
+		'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')),
53
+		'notes'    => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give'))
54 54
 	);
55 55
 
56
-	return array_merge( $tabs, $default_tabs );
56
+	return array_merge($tabs, $default_tabs);
57 57
 }
58 58
 
59
-add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 );
59
+add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1);
60 60
 
61 61
 /**
62 62
  * Register the Delete icon as late as possible so it's at the bottom
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array       The altered list of tabs, with 'delete' at the bottom
69 69
  */
70
-function give_register_delete_customer_tab( $tabs ) {
70
+function give_register_delete_customer_tab($tabs) {
71 71
 
72
-	$tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) );
72
+	$tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give'));
73 73
 
74 74
 	return $tabs;
75 75
 }
76 76
 
77
-add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 );
77
+add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => esc_html__( 'Once Weekly', 'give' )
49
+			'display'  => esc_html__('Once Weekly', 'give')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
includes/class-give-db-customer-meta.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		/* @var WPDB $wpdb */
32 32
 		global $wpdb;
33 33
 
34
-		$this->table_name  = $wpdb->prefix . 'give_customermeta';
34
+		$this->table_name  = $wpdb->prefix.'give_customermeta';
35 35
 		$this->primary_key = 'meta_id';
36 36
 		$this->version     = '1.0';
37 37
 
38
-		add_action( 'plugins_loaded', array( $this, 'register_table' ), 11 );
38
+		add_action('plugins_loaded', array($this, 'register_table'), 11);
39 39
 
40 40
 	}
41 41
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 * @access  private
80 80
 	 * @since   1.6
81 81
 	 */
82
-	public function get_meta( $customer_id = 0, $meta_key = '', $single = false ) {
83
-		$customer_id = $this->sanitize_customer_id( $customer_id );
84
-		if ( false === $customer_id ) {
82
+	public function get_meta($customer_id = 0, $meta_key = '', $single = false) {
83
+		$customer_id = $this->sanitize_customer_id($customer_id);
84
+		if (false === $customer_id) {
85 85
 			return false;
86 86
 		}
87 87
 
88
-		return get_metadata( 'customer', $customer_id, $meta_key, $single );
88
+		return get_metadata('customer', $customer_id, $meta_key, $single);
89 89
 	}
90 90
 
91 91
 	/**
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @access  private
104 104
 	 * @since   1.6
105 105
 	 */
106
-	public function add_meta( $customer_id = 0, $meta_key = '', $meta_value, $unique = false ) {
107
-		$customer_id = $this->sanitize_customer_id( $customer_id );
108
-		if ( false === $customer_id ) {
106
+	public function add_meta($customer_id = 0, $meta_key = '', $meta_value, $unique = false) {
107
+		$customer_id = $this->sanitize_customer_id($customer_id);
108
+		if (false === $customer_id) {
109 109
 			return false;
110 110
 		}
111 111
 
112
-		return add_metadata( 'customer', $customer_id, $meta_key, $meta_value, $unique );
112
+		return add_metadata('customer', $customer_id, $meta_key, $meta_value, $unique);
113 113
 	}
114 114
 
115 115
 	/**
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 	 * @access  private
133 133
 	 * @since   1.6
134 134
 	 */
135
-	public function update_meta( $customer_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
136
-		$customer_id = $this->sanitize_customer_id( $customer_id );
137
-		if ( false === $customer_id ) {
135
+	public function update_meta($customer_id = 0, $meta_key = '', $meta_value, $prev_value = '') {
136
+		$customer_id = $this->sanitize_customer_id($customer_id);
137
+		if (false === $customer_id) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		return update_metadata( 'customer', $customer_id, $meta_key, $meta_value, $prev_value );
141
+		return update_metadata('customer', $customer_id, $meta_key, $meta_value, $prev_value);
142 142
 	}
143 143
 
144 144
 	/**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @access  private
160 160
 	 * @since   1.6
161 161
 	 */
162
-	public function delete_meta( $customer_id = 0, $meta_key = '', $meta_value = '' ) {
163
-		return delete_metadata( 'customer', $customer_id, $meta_key, $meta_value );
162
+	public function delete_meta($customer_id = 0, $meta_key = '', $meta_value = '') {
163
+		return delete_metadata('customer', $customer_id, $meta_key, $meta_value);
164 164
 	}
165 165
 
166 166
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function create_table() {
173 173
 
174
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
174
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
175 175
 
176 176
 		$sql = "CREATE TABLE {$this->table_name} (
177 177
 			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 			KEY meta_key (meta_key)
184 184
 			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
185 185
 
186
-		dbDelta( $sql );
186
+		dbDelta($sql);
187 187
 
188
-		update_option( $this->table_name . '_db_version', $this->version );
188
+		update_option($this->table_name.'_db_version', $this->version);
189 189
 	}
190 190
 
191 191
 	/**
@@ -197,23 +197,23 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return int|bool                The normalized customer ID or false if it's found to not be valid.
199 199
 	 */
200
-	private function sanitize_customer_id( $customer_id ) {
201
-		if ( ! is_numeric( $customer_id ) ) {
200
+	private function sanitize_customer_id($customer_id) {
201
+		if ( ! is_numeric($customer_id)) {
202 202
 			return false;
203 203
 		}
204 204
 
205 205
 		$customer_id = (int) $customer_id;
206 206
 
207 207
 		// We were given a non positive number
208
-		if ( absint( $customer_id ) !== $customer_id ) {
208
+		if (absint($customer_id) !== $customer_id) {
209 209
 			return false;
210 210
 		}
211 211
 
212
-		if ( empty( $customer_id ) ) {
212
+		if (empty($customer_id)) {
213 213
 			return false;
214 214
 		}
215 215
 
216
-		return absint( $customer_id );
216
+		return absint($customer_id);
217 217
 
218 218
 	}
219 219
 
Please login to merge, or discard this patch.
includes/class-give-db-customers.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @since  1.0
159 159
 	 * @access public
160 160
 	 *
161
-	 * @param  bool|string|int $_id_or_email
161
+	 * @param  integer $_id_or_email
162 162
 	 *
163 163
 	 * @return bool|int
164 164
 	 */
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @param  int     $user_id       User ID.
314 314
 	 * @param  WP_User $old_user_data User data.
315 315
 	 *
316
-	 * @return bool
316
+	 * @return false|null
317 317
 	 */
318 318
 	public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
319 319
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 * @access public
363 363
 	 *
364 364
 	 * @param  string $field ID or email. Default is 'id'.
365
-	 * @param  mixed  $value The Customer ID or email to search. Default is 0.
365
+	 * @param  integer  $value The Customer ID or email to search. Default is 0.
366 366
 	 *
367 367
 	 * @return mixed         Upon success, an object of the customer. Upon failure, NULL
368 368
 	 */
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @since  1.0
429 429
 	 * @access public
430
-     *
431
-     * @param  array $args
432
-     *
433
-     * @return array|object|null Customers array or object. Null if not found.
430
+	 *
431
+	 * @param  array $args
432
+	 *
433
+	 * @return array|object|null Customers array or object. Null if not found.
434 434
 	 */
435 435
 	public function get_customers( $args = array() ) {
436
-        /* @var WPDB $wpdb */
436
+		/* @var WPDB $wpdb */
437 437
 		global $wpdb;
438 438
 
439 439
 		$defaults = array(
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @since  1.0
560 560
 	 * @access public
561
-     *
562
-     * @param  array $args
563
-     *
564
-     * @return int         Total number of customers.
561
+	 *
562
+	 * @param  array $args
563
+	 *
564
+	 * @return int         Total number of customers.
565 565
 	 */
566 566
 	public function count( $args = array() ) {
567
-        /* @var WPDB $wpdb */
567
+		/* @var WPDB $wpdb */
568 568
 		global $wpdb;
569 569
 
570 570
 		$where = ' WHERE 1=1 ';
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 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,11 +35,11 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_customers';
38
+		$this->table_name  = $wpdb->prefix.'give_customers';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 		
42
-		add_action( 'profile_update', array( $this, 'update_customer_email_on_user_update' ), 10, 2 );
42
+		add_action('profile_update', array($this, 'update_customer_email_on_user_update'), 10, 2);
43 43
 
44 44
 	}
45 45
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			'purchase_value' => 0.00,
83 83
 			'purchase_count' => 0,
84 84
 			'notes'          => '',
85
-			'date_created'   => date( 'Y-m-d H:i:s' ),
85
+			'date_created'   => date('Y-m-d H:i:s'),
86 86
 		);
87 87
 	}
88 88
 
@@ -96,40 +96,40 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return int|bool
98 98
 	 */
99
-	public function add( $data = array() ) {
99
+	public function add($data = array()) {
100 100
 
101 101
 		$defaults = array(
102 102
 			'payment_ids' => ''
103 103
 		);
104 104
 
105
-		$args = wp_parse_args( $data, $defaults );
105
+		$args = wp_parse_args($data, $defaults);
106 106
 
107
-		if ( empty( $args['email'] ) ) {
107
+		if (empty($args['email'])) {
108 108
 			return false;
109 109
 		}
110 110
 
111
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
112
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
111
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
112
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
113 113
 		}
114 114
 
115
-		$customer = $this->get_customer_by( 'email', $args['email'] );
115
+		$customer = $this->get_customer_by('email', $args['email']);
116 116
 
117
-		if ( $customer ) {
117
+		if ($customer) {
118 118
 			// update an existing customer
119 119
 
120 120
 			// Update the payment IDs attached to the customer
121
-			if ( ! empty( $args['payment_ids'] ) ) {
121
+			if ( ! empty($args['payment_ids'])) {
122 122
 
123
-				if ( empty( $customer->payment_ids ) ) {
123
+				if (empty($customer->payment_ids)) {
124 124
 
125 125
 					$customer->payment_ids = $args['payment_ids'];
126 126
 
127 127
 				} else {
128 128
 
129
-					$existing_ids          = array_map( 'absint', explode( ',', $customer->payment_ids ) );
130
-					$payment_ids           = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
131
-					$payment_ids           = array_merge( $payment_ids, $existing_ids );
132
-					$customer->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
129
+					$existing_ids          = array_map('absint', explode(',', $customer->payment_ids));
130
+					$payment_ids           = array_map('absint', explode(',', $args['payment_ids']));
131
+					$payment_ids           = array_merge($payment_ids, $existing_ids);
132
+					$customer->payment_ids = implode(',', array_unique(array_values($payment_ids)));
133 133
 
134 134
 				}
135 135
 
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 
138 138
 			}
139 139
 
140
-			$this->update( $customer->id, $args );
140
+			$this->update($customer->id, $args);
141 141
 
142 142
 			return $customer->id;
143 143
 
144 144
 		} else {
145 145
 
146
-			return $this->insert( $args, 'customer' );
146
+			return $this->insert($args, 'customer');
147 147
 
148 148
 		}
149 149
 
@@ -162,20 +162,20 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return bool|int
164 164
 	 */
165
-	public function delete( $_id_or_email = false ) {
165
+	public function delete($_id_or_email = false) {
166 166
 
167
-		if ( empty( $_id_or_email ) ) {
167
+		if (empty($_id_or_email)) {
168 168
 			return false;
169 169
 		}
170 170
 
171
-		$column   = is_email( $_id_or_email ) ? 'email' : 'id';
172
-		$customer = $this->get_customer_by( $column, $_id_or_email );
171
+		$column   = is_email($_id_or_email) ? 'email' : 'id';
172
+		$customer = $this->get_customer_by($column, $_id_or_email);
173 173
 
174
-		if ( $customer->id > 0 ) {
174
+		if ($customer->id > 0) {
175 175
 
176 176
 			global $wpdb;
177 177
 
178
-			return $wpdb->delete( $this->table_name, array( 'id' => $customer->id ), array( '%d' ) );
178
+			return $wpdb->delete($this->table_name, array('id' => $customer->id), array('%d'));
179 179
 
180 180
 		} else {
181 181
 			return false;
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return bool          True is exists, false otherwise.
196 196
 	 */
197
-	public function exists( $value = '', $field = 'email' ) {
197
+	public function exists($value = '', $field = 'email') {
198 198
 		
199 199
 		$columns = $this->get_columns();
200
-		if ( ! array_key_exists( $field, $columns ) ) {
200
+		if ( ! array_key_exists($field, $columns)) {
201 201
 			return false;
202 202
 		}
203 203
 
204
-		return (bool) $this->get_column_by( 'id', $field, $value );
204
+		return (bool) $this->get_column_by('id', $field, $value);
205 205
 
206 206
 	}
207 207
 
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return bool
218 218
 	 */
219
-	public function attach_payment( $customer_id = 0, $payment_id = 0 ) {
219
+	public function attach_payment($customer_id = 0, $payment_id = 0) {
220 220
 
221
-		$customer = new Give_Customer( $customer_id );
221
+		$customer = new Give_Customer($customer_id);
222 222
 
223
-		if ( empty( $customer->id ) ) {
223
+		if (empty($customer->id)) {
224 224
 			return false;
225 225
 		}
226 226
 
227 227
 		// Attach the payment, but don't increment stats, as this function previously did not
228
-		return $customer->attach_payment( $payment_id, false );
228
+		return $customer->attach_payment($payment_id, false);
229 229
 
230 230
 	}
231 231
 
@@ -240,16 +240,16 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool
242 242
 	 */
243
-	public function remove_payment( $customer_id = 0, $payment_id = 0 ) {
243
+	public function remove_payment($customer_id = 0, $payment_id = 0) {
244 244
 
245
-		$customer = new Give_Customer( $customer_id );
245
+		$customer = new Give_Customer($customer_id);
246 246
 
247
-		if ( ! $customer ) {
247
+		if ( ! $customer) {
248 248
 			return false;
249 249
 		}
250 250
 
251 251
 		// Remove the payment, but don't decrease stats, as this function previously did not
252
-		return $customer->remove_payment( $payment_id, false );
252
+		return $customer->remove_payment($payment_id, false);
253 253
 
254 254
 	}
255 255
 
@@ -263,18 +263,18 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @return bool
265 265
 	 */
266
-	public function increment_stats( $customer_id = 0, $amount = 0.00 ) {
266
+	public function increment_stats($customer_id = 0, $amount = 0.00) {
267 267
 
268
-		$customer = new Give_Customer( $customer_id );
268
+		$customer = new Give_Customer($customer_id);
269 269
 
270
-		if ( empty( $customer->id ) ) {
270
+		if (empty($customer->id)) {
271 271
 			return false;
272 272
 		}
273 273
 
274 274
 		$increased_count = $customer->increase_purchase_count();
275
-		$increased_value = $customer->increase_value( $amount );
275
+		$increased_value = $customer->increase_value($amount);
276 276
 
277
-		return ( $increased_count && $increased_value ) ? true : false;
277
+		return ($increased_count && $increased_value) ? true : false;
278 278
 
279 279
 	}
280 280
 
@@ -289,18 +289,18 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @return bool
291 291
 	 */
292
-	public function decrement_stats( $customer_id = 0, $amount = 0.00 ) {
292
+	public function decrement_stats($customer_id = 0, $amount = 0.00) {
293 293
 
294
-		$customer = new Give_Customer( $customer_id );
294
+		$customer = new Give_Customer($customer_id);
295 295
 
296
-		if ( ! $customer ) {
296
+		if ( ! $customer) {
297 297
 			return false;
298 298
 		}
299 299
 
300 300
 		$decreased_count = $customer->decrease_purchase_count();
301
-		$decreased_value = $customer->decrease_value( $amount );
301
+		$decreased_value = $customer->decrease_value($amount);
302 302
 
303
-		return ( $decreased_count && $decreased_value ) ? true : false;
303
+		return ($decreased_count && $decreased_value) ? true : false;
304 304
 
305 305
 	}
306 306
 
@@ -315,31 +315,31 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 * @return bool
317 317
 	 */
318
-	public function update_customer_email_on_user_update( $user_id = 0, $old_user_data ) {
318
+	public function update_customer_email_on_user_update($user_id = 0, $old_user_data) {
319 319
 
320
-		$customer = new Give_Customer( $user_id, true );
320
+		$customer = new Give_Customer($user_id, true);
321 321
 
322
-		if( ! $customer ) {
322
+		if ( ! $customer) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		$user = get_userdata( $user_id );
326
+		$user = get_userdata($user_id);
327 327
 
328
-		if( ! empty( $user ) && $user->user_email !== $customer->email ) {
328
+		if ( ! empty($user) && $user->user_email !== $customer->email) {
329 329
 
330
-			if( ! $this->get_customer_by( 'email', $user->user_email ) ) {
330
+			if ( ! $this->get_customer_by('email', $user->user_email)) {
331 331
 
332
-				$success = $this->update( $customer->id, array( 'email' => $user->user_email ) );
332
+				$success = $this->update($customer->id, array('email' => $user->user_email));
333 333
 
334
-				if( $success ) {
334
+				if ($success) {
335 335
 					// Update some payment meta if we need to
336
-					$payments_array = explode( ',', $customer->payment_ids );
336
+					$payments_array = explode(',', $customer->payment_ids);
337 337
 
338
-					if( ! empty( $payments_array ) ) {
338
+					if ( ! empty($payments_array)) {
339 339
 
340
-						foreach ( $payments_array as $payment_id ) {
340
+						foreach ($payments_array as $payment_id) {
341 341
 
342
-							give_update_payment_meta( $payment_id, 'email', $user->user_email );
342
+							give_update_payment_meta($payment_id, 'email', $user->user_email);
343 343
 
344 344
 						}
345 345
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 					 * @param  WP_User       $user     WordPress User object.
354 354
 					 * @param  Give_Customer $customer Give customer object.
355 355
 					 */
356
-					do_action( 'give_update_customer_email_on_user_update', $user, $customer );
356
+					do_action('give_update_customer_email_on_user_update', $user, $customer);
357 357
 
358 358
 				}
359 359
 
@@ -374,46 +374,46 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return mixed         Upon success, an object of the customer. Upon failure, NULL
376 376
 	 */
377
-	public function get_customer_by( $field = 'id', $value = 0 ) {
377
+	public function get_customer_by($field = 'id', $value = 0) {
378 378
 		/* @var WPDB $wpdb */
379 379
 		global $wpdb;
380 380
 
381
-		if ( empty( $field ) || empty( $value ) ) {
381
+		if (empty($field) || empty($value)) {
382 382
 			return null;
383 383
 		}
384 384
 
385
-		if ( 'id' == $field || 'user_id' == $field ) {
385
+		if ('id' == $field || 'user_id' == $field) {
386 386
 			// Make sure the value is numeric to avoid casting objects, for example,
387 387
 			// to int 1.
388
-			if ( ! is_numeric( $value ) ) {
388
+			if ( ! is_numeric($value)) {
389 389
 				return false;
390 390
 			}
391 391
 
392
-			$value = intval( $value );
392
+			$value = intval($value);
393 393
 
394
-			if ( $value < 1 ) {
394
+			if ($value < 1) {
395 395
 				return false;
396 396
 			}
397 397
 
398
-		} elseif ( 'email' === $field ) {
398
+		} elseif ('email' === $field) {
399 399
 
400
-			if ( ! is_email( $value ) ) {
400
+			if ( ! is_email($value)) {
401 401
 				return false;
402 402
 			}
403 403
 
404
-			$value = trim( $value );
404
+			$value = trim($value);
405 405
 		}
406 406
 
407
-		if ( ! $value ) {
407
+		if ( ! $value) {
408 408
 			return false;
409 409
 		}
410 410
 
411
-		switch ( $field ) {
411
+		switch ($field) {
412 412
 			case 'id':
413 413
 				$db_field = 'id';
414 414
 				break;
415 415
 			case 'email':
416
-				$value    = sanitize_text_field( $value );
416
+				$value    = sanitize_text_field($value);
417 417
 				$db_field = 'email';
418 418
 				break;
419 419
 			case 'user_id':
@@ -423,15 +423,15 @@  discard block
 block discarded – undo
423 423
 				return false;
424 424
 		}
425 425
 
426
-		if ( ! $customer = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value ) ) ) {
426
+		if ( ! $customer = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $db_field = %s LIMIT 1", $value))) {
427 427
 
428 428
 			// Look for customer from an additional email
429
-			if( 'email' === $field ) {
429
+			if ('email' === $field) {
430 430
 				$meta_table  = Give()->customer_meta->table_name;
431
-				$customer_id = $wpdb->get_var( $wpdb->prepare( "SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value ) );
431
+				$customer_id = $wpdb->get_var($wpdb->prepare("SELECT customer_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $value));
432 432
 
433
-				if( ! empty( $customer_id ) ) {
434
-					return $this->get( $customer_id );
433
+				if ( ! empty($customer_id)) {
434
+					return $this->get($customer_id);
435 435
  				}
436 436
  			}
437 437
 
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
      *
452 452
      * @return array|object|null Customers array or object. Null if not found.
453 453
 	 */
454
-	public function get_customers( $args = array() ) {
454
+	public function get_customers($args = array()) {
455 455
         /* @var WPDB $wpdb */
456 456
 		global $wpdb;
457 457
 
@@ -463,21 +463,21 @@  discard block
 block discarded – undo
463 463
 			'order'   => 'DESC'
464 464
 		);
465 465
 
466
-		$args = wp_parse_args( $args, $defaults );
466
+		$args = wp_parse_args($args, $defaults);
467 467
 
468
-		if ( $args['number'] < 1 ) {
468
+		if ($args['number'] < 1) {
469 469
 			$args['number'] = 999999999999;
470 470
 		}
471 471
 
472 472
 		$where = ' WHERE 1=1 ';
473 473
 
474 474
 		// specific customers
475
-		if ( ! empty( $args['id'] ) ) {
475
+		if ( ! empty($args['id'])) {
476 476
 
477
-			if ( is_array( $args['id'] ) ) {
478
-				$ids = implode( ',', array_map( 'intval', $args['id'] ) );
477
+			if (is_array($args['id'])) {
478
+				$ids = implode(',', array_map('intval', $args['id']));
479 479
 			} else {
480
-				$ids = intval( $args['id'] );
480
+				$ids = intval($args['id']);
481 481
 			}
482 482
 
483 483
 			$where .= " AND `id` IN( {$ids} ) ";
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
 		}
486 486
 
487 487
 		// customers for specific user accounts
488
-		if ( ! empty( $args['user_id'] ) ) {
488
+		if ( ! empty($args['user_id'])) {
489 489
 
490
-			if ( is_array( $args['user_id'] ) ) {
491
-				$user_ids = implode( ',', array_map( 'intval', $args['user_id'] ) );
490
+			if (is_array($args['user_id'])) {
491
+				$user_ids = implode(',', array_map('intval', $args['user_id']));
492 492
 			} else {
493
-				$user_ids = intval( $args['user_id'] );
493
+				$user_ids = intval($args['user_id']);
494 494
 			}
495 495
 
496 496
 			$where .= " AND `user_id` IN( {$user_ids} ) ";
@@ -498,41 +498,41 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 
500 500
 		//specific customers by email
501
-		if( ! empty( $args['email'] ) ) {
501
+		if ( ! empty($args['email'])) {
502 502
 
503
-			if( is_array( $args['email'] ) ) {
503
+			if (is_array($args['email'])) {
504 504
 
505
-				$emails_count       = count( $args['email'] );
506
-				$emails_placeholder = array_fill( 0, $emails_count, '%s' );
507
-				$emails             = implode( ', ', $emails_placeholder );
505
+				$emails_count       = count($args['email']);
506
+				$emails_placeholder = array_fill(0, $emails_count, '%s');
507
+				$emails             = implode(', ', $emails_placeholder);
508 508
 
509
-				$where .= $wpdb->prepare( " AND `email` IN( $emails ) ", $args['email'] );
509
+				$where .= $wpdb->prepare(" AND `email` IN( $emails ) ", $args['email']);
510 510
 			} else {
511
-				$where .= $wpdb->prepare( " AND `email` = %s ", $args['email'] );
511
+				$where .= $wpdb->prepare(" AND `email` = %s ", $args['email']);
512 512
 			}
513 513
 		}
514 514
 
515 515
 		// specific customers by name
516
-		if( ! empty( $args['name'] ) ) {
517
-			$where .= $wpdb->prepare( " AND `name` LIKE '%%%%" . '%s' . "%%%%' ", $args['name'] );
516
+		if ( ! empty($args['name'])) {
517
+			$where .= $wpdb->prepare(" AND `name` LIKE '%%%%".'%s'."%%%%' ", $args['name']);
518 518
 		}
519 519
 
520 520
 		// Customers created for a specific date or in a date range
521
-		if ( ! empty( $args['date'] ) ) {
521
+		if ( ! empty($args['date'])) {
522 522
 
523
-			if ( is_array( $args['date'] ) ) {
523
+			if (is_array($args['date'])) {
524 524
 
525
-				if ( ! empty( $args['date']['start'] ) ) {
525
+				if ( ! empty($args['date']['start'])) {
526 526
 
527
-					$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
527
+					$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
528 528
 
529 529
 					$where .= " AND `date_created` >= '{$start}'";
530 530
 
531 531
 				}
532 532
 
533
-				if ( ! empty( $args['date']['end'] ) ) {
533
+				if ( ! empty($args['date']['end'])) {
534 534
 
535
-					$end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
535
+					$end = date('Y-m-d H:i:s', strtotime($args['date']['end']));
536 536
 
537 537
 					$where .= " AND `date_created` <= '{$end}'";
538 538
 
@@ -540,31 +540,31 @@  discard block
 block discarded – undo
540 540
 
541 541
 			} else {
542 542
 
543
-				$year  = date( 'Y', strtotime( $args['date'] ) );
544
-				$month = date( 'm', strtotime( $args['date'] ) );
545
-				$day   = date( 'd', strtotime( $args['date'] ) );
543
+				$year  = date('Y', strtotime($args['date']));
544
+				$month = date('m', strtotime($args['date']));
545
+				$day   = date('d', strtotime($args['date']));
546 546
 
547 547
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
548 548
 			}
549 549
 
550 550
 		}
551 551
 
552
-		$args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby'];
552
+		$args['orderby'] = ! array_key_exists($args['orderby'], $this->get_columns()) ? 'id' : $args['orderby'];
553 553
 
554
-		if ( 'purchase_value' == $args['orderby'] ) {
554
+		if ('purchase_value' == $args['orderby']) {
555 555
 			$args['orderby'] = 'purchase_value+0';
556 556
 		}
557 557
 
558
-		$cache_key = md5( 'give_customers_' . serialize( $args ) );
558
+		$cache_key = md5('give_customers_'.serialize($args));
559 559
 
560
-		$customers = wp_cache_get( $cache_key, 'customers' );
560
+		$customers = wp_cache_get($cache_key, 'customers');
561 561
 
562
-		$args['orderby'] = esc_sql( $args['orderby'] );
563
-		$args['order']   = esc_sql( $args['order'] );
562
+		$args['orderby'] = esc_sql($args['orderby']);
563
+		$args['order']   = esc_sql($args['order']);
564 564
 
565
-		if ( $customers === false ) {
566
-			$customers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ) );
567
-			wp_cache_set( $cache_key, $customers, 'customers', 3600 );
565
+		if ($customers === false) {
566
+			$customers = $wpdb->get_results($wpdb->prepare("SELECT * FROM  $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint($args['offset']), absint($args['number'])));
567
+			wp_cache_set($cache_key, $customers, 'customers', 3600);
568 568
 		}
569 569
 
570 570
 		return $customers;
@@ -582,26 +582,26 @@  discard block
 block discarded – undo
582 582
      *
583 583
      * @return int         Total number of customers.
584 584
 	 */
585
-	public function count( $args = array() ) {
585
+	public function count($args = array()) {
586 586
         /* @var WPDB $wpdb */
587 587
 		global $wpdb;
588 588
 
589 589
 		$where = ' WHERE 1=1 ';
590 590
 
591
-		if ( ! empty( $args['date'] ) ) {
591
+		if ( ! empty($args['date'])) {
592 592
 
593
-			if ( is_array( $args['date'] ) ) {
593
+			if (is_array($args['date'])) {
594 594
 
595
-				$start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
596
-				$end   = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
595
+				$start = date('Y-m-d H:i:s', strtotime($args['date']['start']));
596
+				$end   = date('Y-m-d H:i:s', strtotime($args['date']['end']));
597 597
 
598 598
 				$where .= " AND `date_created` >= '{$start}' AND `date_created` <= '{$end}'";
599 599
 
600 600
 			} else {
601 601
 
602
-				$year  = date( 'Y', strtotime( $args['date'] ) );
603
-				$month = date( 'm', strtotime( $args['date'] ) );
604
-				$day   = date( 'd', strtotime( $args['date'] ) );
602
+				$year  = date('Y', strtotime($args['date']));
603
+				$month = date('m', strtotime($args['date']));
604
+				$day   = date('d', strtotime($args['date']));
605 605
 
606 606
 				$where .= " AND $year = YEAR ( date_created ) AND $month = MONTH ( date_created ) AND $day = DAY ( date_created )";
607 607
 			}
@@ -609,16 +609,16 @@  discard block
 block discarded – undo
609 609
 		}
610 610
 
611 611
 
612
-		$cache_key = md5( 'give_customers_count' . serialize( $args ) );
612
+		$cache_key = md5('give_customers_count'.serialize($args));
613 613
 
614
-		$count = wp_cache_get( $cache_key, 'customers' );
614
+		$count = wp_cache_get($cache_key, 'customers');
615 615
 
616
-		if ( $count === false ) {
617
-			$count = $wpdb->get_var( "SELECT COUNT($this->primary_key) FROM " . $this->table_name . "{$where};" );
618
-			wp_cache_set( $cache_key, $count, 'customers', 3600 );
616
+		if ($count === false) {
617
+			$count = $wpdb->get_var("SELECT COUNT($this->primary_key) FROM ".$this->table_name."{$where};");
618
+			wp_cache_set($cache_key, $count, 'customers', 3600);
619 619
 		}
620 620
 
621
-		return absint( $count );
621
+		return absint($count);
622 622
 
623 623
 	}
624 624
 
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 	 */
633 633
 	public function create_table() {
634 634
 
635
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
635
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
636 636
 
637
-		$sql = "CREATE TABLE " . $this->table_name . " (
637
+		$sql = "CREATE TABLE ".$this->table_name." (
638 638
 		id bigint(20) NOT NULL AUTO_INCREMENT,
639 639
 		user_id bigint(20) NOT NULL,
640 640
 		email varchar(50) NOT NULL,
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 		KEY user (user_id)
650 650
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
651 651
 
652
-		dbDelta( $sql );
652
+		dbDelta($sql);
653 653
 
654
-		update_option( $this->table_name . '_db_version', $this->version );
654
+		update_option($this->table_name.'_db_version', $this->version);
655 655
 	}
656 656
 	
657 657
 	/**
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
664 664
 	 */
665 665
 	public function installed() {
666
-		return $this->table_exists( $this->table_name );
666
+		return $this->table_exists($this->table_name);
667 667
 	}
668 668
 
669 669
 }
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
  * Used to redirect a user back to the purchase
157 157
  * page if there are errors present.
158 158
  *
159
- * @param array $args
159
+ * @param string $args
160 160
  *
161 161
  * @access public
162 162
  * @since  1.0
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @param int $form_id Give Form ID
392 392
  *
393
- * @return int $earnings Earnings for a certain form
393
+ * @return double $earnings Earnings for a certain form
394 394
  */
395 395
 function give_get_form_earnings_stats( $form_id = 0 ) {
396 396
 	$give_form = new Give_Donate_Form( $form_id );
Please login to merge, or discard this patch.
Spacing   +209 added lines, -209 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
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 
168 168
 	// Set the form_id.
169
-	if ( isset( $_POST['give-form-id'] ) ) {
170
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
169
+	if (isset($_POST['give-form-id'])) {
170
+		$form_id = sanitize_text_field($_POST['give-form-id']);
171 171
 	} else {
172 172
 		$form_id = 0;
173 173
 	}
174 174
 
175 175
 	// Need a URL to continue. If none, redirect back to single form.
176
-	if ( empty( $url ) ) {
177
-		wp_safe_redirect( get_permalink( $form_id ) );
176
+	if (empty($url)) {
177
+		wp_safe_redirect(get_permalink($form_id));
178 178
 		give_die();
179 179
 	}
180 180
 
@@ -183,36 +183,36 @@  discard block
 block discarded – undo
183 183
 	);
184 184
 
185 185
 	// Check for backward compatibility.
186
-	if ( is_string( $args ) ) {
187
-		$args = str_replace( '?', '', $args );
186
+	if (is_string($args)) {
187
+		$args = str_replace('?', '', $args);
188 188
 	}
189 189
 
190
-	$args = wp_parse_args( $args, $defaults );
190
+	$args = wp_parse_args($args, $defaults);
191 191
 
192 192
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
193
-	$url_data = wp_parse_url( $url );
193
+	$url_data = wp_parse_url($url);
194 194
 
195 195
 	// Check if an array to prevent notices before parsing.
196
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
197
-		parse_str( $url_data['query'], $query );
196
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
197
+		parse_str($url_data['query'], $query);
198 198
 
199 199
 		// Precaution: don't allow any CC info.
200
-		unset( $query['card_number'] );
201
-		unset( $query['card_cvc'] );
200
+		unset($query['card_number']);
201
+		unset($query['card_cvc']);
202 202
 
203 203
 	} else {
204 204
 		// No $url_data so pass empty array.
205 205
 		$query = array();
206 206
 	}
207 207
 
208
-	$new_query        = array_merge( $args, $query );
209
-	$new_query_string = http_build_query( $new_query );
208
+	$new_query        = array_merge($args, $query);
209
+	$new_query_string = http_build_query($new_query);
210 210
 
211 211
 	// Assemble URL parts.
212
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
212
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
213 213
 
214 214
 	// Redirect them.
215
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
215
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
216 216
 	give_die();
217 217
 
218 218
 }
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
  * @since       1.0
229 229
  * @return      string
230 230
  */
231
-function give_get_success_page_url( $query_string = null ) {
231
+function give_get_success_page_url($query_string = null) {
232 232
 
233
-	$success_page = give_get_option( 'success_page', 0 );
234
-	$success_page = get_permalink( $success_page );
233
+	$success_page = give_get_option('success_page', 0);
234
+	$success_page = get_permalink($success_page);
235 235
 
236
-	if ( $query_string ) {
236
+	if ($query_string) {
237 237
 		$success_page .= $query_string;
238 238
 	}
239 239
 
240
-	return apply_filters( 'give_success_page_url', $success_page );
240
+	return apply_filters('give_success_page_url', $success_page);
241 241
 
242 242
 }
243 243
 
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist
252 252
  */
253
-function give_get_failed_transaction_uri( $extras = false ) {
253
+function give_get_failed_transaction_uri($extras = false) {
254 254
 	$give_options = give_get_settings();
255 255
 
256
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
257
-	if ( $extras ) {
256
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
257
+	if ($extras) {
258 258
 		$uri .= $extras;
259 259
 	}
260 260
 
261
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
261
+	return apply_filters('give_get_failed_transaction_uri', $uri);
262 262
 }
263 263
 
264 264
 /**
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function give_is_failed_transaction_page() {
271 271
 	$give_options = give_get_settings();
272
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
272
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
273 273
 
274
-	return apply_filters( 'give_is_failure_page', $ret );
274
+	return apply_filters('give_is_failure_page', $ret);
275 275
 }
276 276
 
277 277
 /**
@@ -283,18 +283,18 @@  discard block
 block discarded – undo
283 283
  */
284 284
 function give_listen_for_failed_payments() {
285 285
 
286
-	$failed_page = give_get_option( 'failure_page', 0 );
286
+	$failed_page = give_get_option('failure_page', 0);
287 287
 
288
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
288
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
289 289
 
290
-		$payment_id = absint( $_GET['payment-id'] );
291
-		give_update_payment_status( $payment_id, 'failed' );
290
+		$payment_id = absint($_GET['payment-id']);
291
+		give_update_payment_status($payment_id, 'failed');
292 292
 
293 293
 	}
294 294
 
295 295
 }
296 296
 
297
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
297
+add_action('template_redirect', 'give_listen_for_failed_payments');
298 298
 
299 299
 /**
300 300
  * Retrieve the Donation History page URI
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
 function give_get_history_page_uri() {
308 308
 	$give_options = give_get_settings();
309 309
 
310
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
310
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
311 311
 
312
-	return apply_filters( 'give_get_history_page_uri', $history_page );
312
+	return apply_filters('give_get_history_page_uri', $history_page);
313 313
 }
314 314
 
315 315
 /**
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
  * @since       1.0
323 323
  * @return      bool
324 324
  */
325
-function give_field_is_required( $field = '', $form_id ) {
325
+function give_field_is_required($field = '', $form_id) {
326 326
 
327
-	$required_fields = give_get_required_fields( $form_id );
327
+	$required_fields = give_get_required_fields($form_id);
328 328
 
329
-	return array_key_exists( $field, $required_fields );
329
+	return array_key_exists($field, $required_fields);
330 330
 }
331 331
 
332 332
 /**
@@ -344,14 +344,14 @@  discard block
 block discarded – undo
344 344
  *
345 345
  * @return void
346 346
  */
347
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
347
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
348 348
 	global $give_logs;
349 349
 
350 350
 	$log_data = array(
351 351
 		'post_parent'   => $give_form_id,
352 352
 		'log_type'      => 'sale',
353
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
354
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null,
353
+		'post_date'     => isset($sale_date) ? $sale_date : null,
354
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null,
355 355
 	);
356 356
 
357 357
 	$log_meta = array(
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		'price_id'   => (int) $price_id,
360 360
 	);
361 361
 
362
-	$give_logs->insert_log( $log_data, $log_meta );
362
+	$give_logs->insert_log($log_data, $log_meta);
363 363
 }
364 364
 
365 365
 
@@ -373,11 +373,11 @@  discard block
 block discarded – undo
373 373
  *
374 374
  * @return bool|int
375 375
  */
376
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
376
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
377 377
 	$quantity = (int) $quantity;
378
-	$form     = new Give_Donate_Form( $form_id );
378
+	$form     = new Give_Donate_Form($form_id);
379 379
 
380
-	return $form->increase_sales( $quantity );
380
+	return $form->increase_sales($quantity);
381 381
 }
382 382
 
383 383
 /**
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
  *
391 391
  * @return bool|int
392 392
  */
393
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
393
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
394 394
 	$quantity = (int) $quantity;
395
-	$form     = new Give_Donate_Form( $form_id );
395
+	$form     = new Give_Donate_Form($form_id);
396 396
 
397
-	return $form->decrease_sales( $quantity );
397
+	return $form->decrease_sales($quantity);
398 398
 }
399 399
 
400 400
 /**
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
  *
408 408
  * @return bool|int
409 409
  */
410
-function give_increase_earnings( $give_form_id = 0, $amount ) {
411
-	$form = new Give_Donate_Form( $give_form_id );
410
+function give_increase_earnings($give_form_id = 0, $amount) {
411
+	$form = new Give_Donate_Form($give_form_id);
412 412
 
413
-	return $form->increase_earnings( $amount );
413
+	return $form->increase_earnings($amount);
414 414
 }
415 415
 
416 416
 /**
@@ -423,10 +423,10 @@  discard block
 block discarded – undo
423 423
  *
424 424
  * @return bool|int
425 425
  */
426
-function give_decrease_earnings( $form_id = 0, $amount ) {
427
-	$form = new Give_Donate_Form( $form_id );
426
+function give_decrease_earnings($form_id = 0, $amount) {
427
+	$form = new Give_Donate_Form($form_id);
428 428
 
429
-	return $form->decrease_earnings( $amount );
429
+	return $form->decrease_earnings($amount);
430 430
 }
431 431
 
432 432
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
  *
440 440
  * @return int $earnings Earnings for a certain form
441 441
  */
442
-function give_get_form_earnings_stats( $form_id = 0 ) {
443
-	$give_form = new Give_Donate_Form( $form_id );
442
+function give_get_form_earnings_stats($form_id = 0) {
443
+	$give_form = new Give_Donate_Form($form_id);
444 444
 
445 445
 	return $give_form->earnings;
446 446
 }
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
  *
456 456
  * @return int $sales Amount of sales for a certain form
457 457
  */
458
-function give_get_form_sales_stats( $give_form_id = 0 ) {
459
-	$give_form = new Give_Donate_Form( $give_form_id );
458
+function give_get_form_sales_stats($give_form_id = 0) {
459
+	$give_form = new Give_Donate_Form($give_form_id);
460 460
 
461 461
 	return $give_form->sales;
462 462
 }
@@ -471,16 +471,16 @@  discard block
 block discarded – undo
471 471
  *
472 472
  * @return float $sales Average monthly sales
473 473
  */
474
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
475
-	$sales        = give_get_form_sales_stats( $form_id );
476
-	$release_date = get_post_field( 'post_date', $form_id );
474
+function give_get_average_monthly_form_sales($form_id = 0) {
475
+	$sales        = give_get_form_sales_stats($form_id);
476
+	$release_date = get_post_field('post_date', $form_id);
477 477
 
478
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
478
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
479 479
 
480
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
480
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
481 481
 
482
-	if ( $months > 0 ) {
483
-		$sales = ( $sales / $months );
482
+	if ($months > 0) {
483
+		$sales = ($sales / $months);
484 484
 	}
485 485
 
486 486
 	return $sales;
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
  *
497 497
  * @return float $earnings Average monthly earnings
498 498
  */
499
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
500
-	$earnings     = give_get_form_earnings_stats( $form_id );
501
-	$release_date = get_post_field( 'post_date', $form_id );
499
+function give_get_average_monthly_form_earnings($form_id = 0) {
500
+	$earnings     = give_get_form_earnings_stats($form_id);
501
+	$release_date = get_post_field('post_date', $form_id);
502 502
 
503
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
503
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
504 504
 
505
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
505
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
506 506
 
507
-	if ( $months > 0 ) {
508
-		$earnings = ( $earnings / $months );
507
+	if ($months > 0) {
508
+		$earnings = ($earnings / $months);
509 509
 	}
510 510
 
511 511
 	return $earnings < 0 ? 0 : $earnings;
@@ -525,23 +525,23 @@  discard block
 block discarded – undo
525 525
  *
526 526
  * @return string $price_name Name of the price option
527 527
  */
528
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
528
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
529 529
 
530
-	$prices     = give_get_variable_prices( $form_id );
530
+	$prices     = give_get_variable_prices($form_id);
531 531
 	$price_name = '';
532 532
 
533
-	foreach ( $prices as $price ) {
533
+	foreach ($prices as $price) {
534 534
 
535
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
535
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
536 536
 
537
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
538
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
539
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
537
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
538
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
539
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
540 540
 
541 541
 		}
542 542
 	}
543 543
 
544
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
544
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
545 545
 }
546 546
 
547 547
 
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
  *
555 555
  * @return string $range A fully formatted price range
556 556
  */
557
-function give_price_range( $form_id = 0 ) {
558
-	$low   = give_get_lowest_price_option( $form_id );
559
-	$high  = give_get_highest_price_option( $form_id );
560
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
557
+function give_price_range($form_id = 0) {
558
+	$low   = give_get_lowest_price_option($form_id);
559
+	$high  = give_get_highest_price_option($form_id);
560
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
561 561
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
562
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
562
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
563 563
 
564
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
564
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
565 565
 }
566 566
 
567 567
 
@@ -576,35 +576,35 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return int ID of the lowest price
578 578
  */
579
-function give_get_lowest_price_id( $form_id = 0 ) {
579
+function give_get_lowest_price_id($form_id = 0) {
580 580
 
581
-	if ( empty( $form_id ) ) {
581
+	if (empty($form_id)) {
582 582
 		$form_id = get_the_ID();
583 583
 	}
584 584
 
585
-	if ( ! give_has_variable_prices( $form_id ) ) {
586
-		return give_get_form_price( $form_id );
585
+	if ( ! give_has_variable_prices($form_id)) {
586
+		return give_get_form_price($form_id);
587 587
 	}
588 588
 
589
-	$prices = give_get_variable_prices( $form_id );
589
+	$prices = give_get_variable_prices($form_id);
590 590
 
591 591
 	$min = $min_id = 0;
592 592
 
593
-	if ( ! empty( $prices ) ) {
593
+	if ( ! empty($prices)) {
594 594
 
595
-		foreach ( $prices as $key => $price ) {
595
+		foreach ($prices as $key => $price) {
596 596
 
597
-			if ( empty( $price['_give_amount'] ) ) {
597
+			if (empty($price['_give_amount'])) {
598 598
 				continue;
599 599
 			}
600 600
 
601
-			if ( ! isset( $min ) ) {
601
+			if ( ! isset($min)) {
602 602
 				$min = $price['_give_amount'];
603 603
 			} else {
604
-				$min = min( $min, $price['_give_amount'] );
604
+				$min = min($min, $price['_give_amount']);
605 605
 			}
606 606
 
607
-			if ( $price['_give_amount'] == $min ) {
607
+			if ($price['_give_amount'] == $min) {
608 608
 				$min_id = $price['_give_id']['level_id'];
609 609
 			}
610 610
 		}
@@ -622,45 +622,45 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return float Amount of the lowest price
624 624
  */
625
-function give_get_lowest_price_option( $form_id = 0 ) {
626
-	if ( empty( $form_id ) ) {
625
+function give_get_lowest_price_option($form_id = 0) {
626
+	if (empty($form_id)) {
627 627
 		$form_id = get_the_ID();
628 628
 	}
629 629
 
630
-	if ( ! give_has_variable_prices( $form_id ) ) {
631
-		return give_get_form_price( $form_id );
630
+	if ( ! give_has_variable_prices($form_id)) {
631
+		return give_get_form_price($form_id);
632 632
 	}
633 633
 
634
-	$prices = give_get_variable_prices( $form_id );
634
+	$prices = give_get_variable_prices($form_id);
635 635
 
636 636
 	$low = 0;
637 637
 
638
-	if ( ! empty( $prices ) ) {
638
+	if ( ! empty($prices)) {
639 639
 
640 640
 		$min = $min_id = 0;
641 641
 
642
-		foreach ( $prices as $key => $price ) {
642
+		foreach ($prices as $key => $price) {
643 643
 
644
-			if ( empty( $price['_give_amount'] ) ) {
644
+			if (empty($price['_give_amount'])) {
645 645
 				continue;
646 646
 			}
647 647
 
648
-			if ( ! isset( $min ) ) {
648
+			if ( ! isset($min)) {
649 649
 				$min = $price['_give_amount'];
650 650
 			} else {
651
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
651
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
652 652
 			}
653 653
 
654
-			if ( $price['_give_amount'] == $min ) {
654
+			if ($price['_give_amount'] == $min) {
655 655
 				$min_id = $key;
656 656
 			}
657 657
 		}
658 658
 
659
-		$low = $prices[ $min_id ]['_give_amount'];
659
+		$low = $prices[$min_id]['_give_amount'];
660 660
 
661 661
 	}
662 662
 
663
-	return give_sanitize_amount( $low );
663
+	return give_sanitize_amount($low);
664 664
 }
665 665
 
666 666
 /**
@@ -672,41 +672,41 @@  discard block
 block discarded – undo
672 672
  *
673 673
  * @return float Amount of the highest price
674 674
  */
675
-function give_get_highest_price_option( $form_id = 0 ) {
675
+function give_get_highest_price_option($form_id = 0) {
676 676
 
677
-	if ( empty( $form_id ) ) {
677
+	if (empty($form_id)) {
678 678
 		$form_id = get_the_ID();
679 679
 	}
680 680
 
681
-	if ( ! give_has_variable_prices( $form_id ) ) {
682
-		return give_get_form_price( $form_id );
681
+	if ( ! give_has_variable_prices($form_id)) {
682
+		return give_get_form_price($form_id);
683 683
 	}
684 684
 
685
-	$prices = give_get_variable_prices( $form_id );
685
+	$prices = give_get_variable_prices($form_id);
686 686
 
687 687
 	$high = 0.00;
688 688
 
689
-	if ( ! empty( $prices ) ) {
689
+	if ( ! empty($prices)) {
690 690
 
691 691
 		$max_id = $max = 0;
692 692
 
693
-		foreach ( $prices as $key => $price ) {
694
-			if ( empty( $price['_give_amount'] ) ) {
693
+		foreach ($prices as $key => $price) {
694
+			if (empty($price['_give_amount'])) {
695 695
 				continue;
696 696
 			}
697
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
697
+			$give_amount = give_sanitize_amount($price['_give_amount']);
698 698
 
699
-			$max = max( $max, $give_amount );
699
+			$max = max($max, $give_amount);
700 700
 
701
-			if ( $give_amount == $max ) {
701
+			if ($give_amount == $max) {
702 702
 				$max_id = $key;
703 703
 			}
704 704
 		}
705 705
 
706
-		$high = $prices[ $max_id ]['_give_amount'];
706
+		$high = $prices[$max_id]['_give_amount'];
707 707
 	}
708 708
 
709
-	return give_sanitize_amount( $high );
709
+	return give_sanitize_amount($high);
710 710
 }
711 711
 
712 712
 /**
@@ -718,15 +718,15 @@  discard block
 block discarded – undo
718 718
  *
719 719
  * @return mixed string|int Price of the form
720 720
  */
721
-function give_get_form_price( $form_id = 0 ) {
721
+function give_get_form_price($form_id = 0) {
722 722
 
723
-	if ( empty( $form_id ) ) {
723
+	if (empty($form_id)) {
724 724
 		return false;
725 725
 	}
726 726
 
727
-	$form = new Give_Donate_Form( $form_id );
727
+	$form = new Give_Donate_Form($form_id);
728 728
 
729
-	return $form->__get( 'price' );
729
+	return $form->__get('price');
730 730
 }
731 731
 
732 732
 /**
@@ -738,15 +738,15 @@  discard block
 block discarded – undo
738 738
  *
739 739
  * @return mixed string|int Minimum price of the form
740 740
  */
741
-function give_get_form_minimum_price( $form_id = 0 ) {
741
+function give_get_form_minimum_price($form_id = 0) {
742 742
 
743
-	if ( empty( $form_id ) ) {
743
+	if (empty($form_id)) {
744 744
 		return false;
745 745
 	}
746 746
 
747
-	$form = new Give_Donate_Form( $form_id );
747
+	$form = new Give_Donate_Form($form_id);
748 748
 
749
-	return $form->__get( 'minimum_price' );
749
+	return $form->__get('minimum_price');
750 750
 
751 751
 }
752 752
 
@@ -761,51 +761,51 @@  discard block
 block discarded – undo
761 761
  *
762 762
  * @return int $formatted_price
763 763
  */
764
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
764
+function give_price($form_id = 0, $echo = true, $price_id = false) {
765 765
 
766
-	if ( empty( $form_id ) ) {
766
+	if (empty($form_id)) {
767 767
 		$form_id = get_the_ID();
768 768
 	}
769 769
 
770
-	if ( give_has_variable_prices( $form_id ) ) {
770
+	if (give_has_variable_prices($form_id)) {
771 771
 
772
-		$prices = give_get_variable_prices( $form_id );
772
+		$prices = give_get_variable_prices($form_id);
773 773
 
774
-		if ( false !== $price_id ) {
774
+		if (false !== $price_id) {
775 775
 
776 776
 			// loop through multi-prices to see which is default
777
-			foreach ( $prices as $price ) {
777
+			foreach ($prices as $price) {
778 778
 				// this is the default price
779
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
779
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
780 780
 					$price = (float) $price['_give_amount'];
781 781
 				};
782 782
 			}
783 783
 		} else {
784 784
 
785
-			$price = give_get_lowest_price_option( $form_id );
785
+			$price = give_get_lowest_price_option($form_id);
786 786
 		}
787 787
 
788
-		$price = give_sanitize_amount( $price );
788
+		$price = give_sanitize_amount($price);
789 789
 
790 790
 	} else {
791 791
 
792
-		$price = give_get_form_price( $form_id );
792
+		$price = give_get_form_price($form_id);
793 793
 
794 794
 	}
795 795
 
796
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
797
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
798
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
796
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
797
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
798
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
799 799
 
800
-	if ( $echo ) {
800
+	if ($echo) {
801 801
 		echo $formatted_price;
802 802
 	} else {
803 803
 		return $formatted_price;
804 804
 	}
805 805
 }
806 806
 
807
-add_filter( 'give_form_price', 'give_format_amount', 10 );
808
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
807
+add_filter('give_form_price', 'give_format_amount', 10);
808
+add_filter('give_form_price', 'give_currency_filter', 20);
809 809
 
810 810
 
811 811
 /**
@@ -818,19 +818,19 @@  discard block
 block discarded – undo
818 818
  *
819 819
  * @return float $amount Amount of the price option
820 820
  */
821
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
822
-	$prices = give_get_variable_prices( $form_id );
821
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
822
+	$prices = give_get_variable_prices($form_id);
823 823
 
824 824
 	$amount = 0.00;
825 825
 
826
-	foreach ( $prices as $price ) {
827
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
828
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
826
+	foreach ($prices as $price) {
827
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
828
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
829 829
 			break;
830 830
 		};
831 831
 	}
832 832
 
833
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
833
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
834 834
 }
835 835
 
836 836
 /**
@@ -842,13 +842,13 @@  discard block
 block discarded – undo
842 842
  *
843 843
  * @return mixed string|int Goal of the form
844 844
  */
845
-function give_get_form_goal( $form_id = 0 ) {
845
+function give_get_form_goal($form_id = 0) {
846 846
 
847
-	if ( empty( $form_id ) ) {
847
+	if (empty($form_id)) {
848 848
 		return false;
849 849
 	}
850 850
 
851
-	$form = new Give_Donate_Form( $form_id );
851
+	$form = new Give_Donate_Form($form_id);
852 852
 
853 853
 	return $form->goal;
854 854
 
@@ -864,27 +864,27 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return string $formatted_goal
866 866
  */
867
-function give_goal( $form_id = 0, $echo = true ) {
867
+function give_goal($form_id = 0, $echo = true) {
868 868
 
869
-	if ( empty( $form_id ) ) {
869
+	if (empty($form_id)) {
870 870
 		$form_id = get_the_ID();
871 871
 	}
872 872
 
873
-	$goal = give_get_form_goal( $form_id );
873
+	$goal = give_get_form_goal($form_id);
874 874
 
875
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
876
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
877
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
875
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
876
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
877
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
878 878
 
879
-	if ( $echo ) {
879
+	if ($echo) {
880 880
 		echo $formatted_goal;
881 881
 	} else {
882 882
 		return $formatted_goal;
883 883
 	}
884 884
 }
885 885
 
886
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
887
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
886
+add_filter('give_form_goal', 'give_format_amount', 10);
887
+add_filter('give_form_goal', 'give_currency_filter', 20);
888 888
 
889 889
 
890 890
 /**
@@ -896,12 +896,12 @@  discard block
 block discarded – undo
896 896
  *
897 897
  * @return bool  $ret Whether or not the logged_in_only setting is set
898 898
  */
899
-function give_logged_in_only( $form_id ) {
899
+function give_logged_in_only($form_id) {
900 900
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
901 901
 	// Other wise it is member only donation form.
902
-	$ret = ! give_is_setting_enabled( get_post_meta( $form_id, '_give_logged_in_only', true ) );
902
+	$ret = ! give_is_setting_enabled(get_post_meta($form_id, '_give_logged_in_only', true));
903 903
 
904
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
904
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
905 905
 }
906 906
 
907 907
 
@@ -914,11 +914,11 @@  discard block
 block discarded – undo
914 914
  *
915 915
  * @return string
916 916
  */
917
-function give_show_login_register_option( $form_id ) {
917
+function give_show_login_register_option($form_id) {
918 918
 
919
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
919
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
920 920
 
921
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
921
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
922 922
 
923 923
 }
924 924
 
@@ -934,12 +934,12 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return array
936 936
  */
937
-function _give_get_prefill_form_field_values( $form_id ) {
937
+function _give_get_prefill_form_field_values($form_id) {
938 938
 	$logged_in_donor_info = array();
939 939
 
940
-	if ( is_user_logged_in() ) :
941
-		$donor_data    = get_userdata( get_current_user_id() );
942
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
940
+	if (is_user_logged_in()) :
941
+		$donor_data    = get_userdata(get_current_user_id());
942
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
943 943
 
944 944
 		$logged_in_donor_info = array(
945 945
 			// First name.
@@ -952,42 +952,42 @@  discard block
 block discarded – undo
952 952
 			'give_email'      => $donor_data->user_email,
953 953
 
954 954
 			// Street address 1.
955
-			'card_address'    => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
955
+			'card_address'    => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
956 956
 
957 957
 			// Street address 2.
958
-			'card_address_2'  => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
958
+			'card_address_2'  => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
959 959
 
960 960
 			// Country.
961
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
961
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
962 962
 
963 963
 			// State.
964
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
964
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
965 965
 
966 966
 			// City.
967
-			'card_city'       => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
967
+			'card_city'       => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
968 968
 
969 969
 			// Zipcode
970
-			'card_zip'        => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ),
970
+			'card_zip'        => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''),
971 971
 		);
972 972
 	endif;
973 973
 
974 974
 	// Bailout: Auto fill form field values only form form which donor is donating.
975 975
 	if (
976
-		empty( $_GET['form-id'] )
976
+		empty($_GET['form-id'])
977 977
 		|| ! $form_id
978
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
978
+		|| ($form_id !== absint($_GET['form-id']))
979 979
 	) {
980 980
 		return $logged_in_donor_info;
981 981
 	}
982 982
 
983 983
 	// Get purchase data.
984
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
984
+	$give_purchase_data = Give()->session->get('give_purchase');
985 985
 
986 986
 	// Get donor info from form data.
987
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
987
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
988 988
 		? array()
989 989
 		: $give_purchase_data['post_data'];
990 990
 
991 991
 	// Output.
992
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
992
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
993 993
 }
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function get_predefined_dates() {
87 87
 		$predefined = array(
88
-			'today'        => esc_html__( 'Today', 'give' ),
89
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
90
-			'this_week'    => esc_html__( 'This Week', 'give' ),
91
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
92
-			'this_month'   => esc_html__( 'This Month', 'give' ),
93
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
94
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
95
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
96
-			'this_year'    => esc_html__( 'This Year', 'give' ),
97
-			'last_year'    => esc_html__( 'Last Year', 'give' )
88
+			'today'        => esc_html__('Today', 'give'),
89
+			'yesterday'    => esc_html__('Yesterday', 'give'),
90
+			'this_week'    => esc_html__('This Week', 'give'),
91
+			'last_week'    => esc_html__('Last Week', 'give'),
92
+			'this_month'   => esc_html__('This Month', 'give'),
93
+			'last_month'   => esc_html__('Last Month', 'give'),
94
+			'this_quarter' => esc_html__('This Quarter', 'give'),
95
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
96
+			'this_year'    => esc_html__('This Year', 'give'),
97
+			'last_year'    => esc_html__('Last Year', 'give')
98 98
 		);
99 99
 
100
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
100
+		return apply_filters('give_stats_predefined_dates', $predefined);
101 101
 	}
102 102
 
103 103
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return void
115 115
 	 */
116
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
116
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
117 117
 
118
-		if ( empty( $_start_date ) ) {
118
+		if (empty($_start_date)) {
119 119
 			$_start_date = 'this_month';
120 120
 		}
121 121
 
122
-		if ( empty( $_end_date ) ) {
122
+		if (empty($_end_date)) {
123 123
 			$_end_date = $_start_date;
124 124
 		}
125 125
 
126
-		$this->start_date = $this->convert_date( $_start_date );
127
-		$this->end_date   = $this->convert_date( $_end_date, true );
126
+		$this->start_date = $this->convert_date($_start_date);
127
+		$this->end_date   = $this->convert_date($_end_date, true);
128 128
 	}
129 129
 
130 130
 	/**
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
142 142
 	 */
143
-	public function convert_date( $date, $end_date = false ) {
143
+	public function convert_date($date, $end_date = false) {
144 144
 
145 145
 		$this->timestamp = false;
146 146
 		$second          = $end_date ? 59 : 0;
147 147
 		$minute          = $end_date ? 59 : 0;
148 148
 		$hour            = $end_date ? 23 : 0;
149 149
 		$day             = 1;
150
-		$month           = date( 'n', current_time( 'timestamp' ) );
151
-		$year            = date( 'Y', current_time( 'timestamp' ) );
150
+		$month           = date('n', current_time('timestamp'));
151
+		$year            = date('Y', current_time('timestamp'));
152 152
 
153
-		if ( array_key_exists( $date, $this->get_predefined_dates() ) ) {
153
+		if (array_key_exists($date, $this->get_predefined_dates())) {
154 154
 
155 155
 			// This is a predefined date rate, such as last_week
156
-			switch ( $date ) {
156
+			switch ($date) {
157 157
 
158 158
 				case 'this_month' :
159 159
 
160
-					if ( $end_date ) {
160
+					if ($end_date) {
161 161
 
162
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
162
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
163 163
 						$hour   = 23;
164 164
 						$minute = 59;
165 165
 						$second = 59;
@@ -169,28 +169,28 @@  discard block
 block discarded – undo
169 169
 
170 170
 				case 'last_month' :
171 171
 
172
-					if ( $month == 1 ) {
172
+					if ($month == 1) {
173 173
 
174 174
 						$month = 12;
175
-						$year --;
175
+						$year--;
176 176
 
177 177
 					} else {
178 178
 
179
-						$month --;
179
+						$month--;
180 180
 
181 181
 					}
182 182
 
183
-					if ( $end_date ) {
184
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
183
+					if ($end_date) {
184
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
185 185
 					}
186 186
 
187 187
 					break;
188 188
 
189 189
 				case 'today' :
190 190
 
191
-					$day = date( 'd', current_time( 'timestamp' ) );
191
+					$day = date('d', current_time('timestamp'));
192 192
 
193
-					if ( $end_date ) {
193
+					if ($end_date) {
194 194
 						$hour   = 23;
195 195
 						$minute = 59;
196 196
 						$second = 59;
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 
201 201
 				case 'yesterday' :
202 202
 
203
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
203
+					$day = date('d', current_time('timestamp')) - 1;
204 204
 
205 205
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
206
-					if ( $day < 1 ) {
206
+					if ($day < 1) {
207 207
 
208 208
 						// If current month is 1
209
-						if ( 1 == $month ) {
209
+						if (1 == $month) {
210 210
 
211 211
 							$year -= 1; // Today is January 1, so skip back to last day of December
212 212
 							$month = 12;
213
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
213
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
214 214
 
215 215
 						} else {
216 216
 
217 217
 							// Go back one month and get the last day of the month
218 218
 							$month -= 1;
219
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
219
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
220 220
 
221 221
 						}
222 222
 					}
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
 
226 226
 				case 'this_week' :
227 227
 
228
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
229
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
228
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
229
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
230 230
 
231
-					if ( $today < $days_to_week_start ) {
231
+					if ($today < $days_to_week_start) {
232 232
 
233
-						if ( $month > 1 ) {
233
+						if ($month > 1) {
234 234
 							$month -= 1;
235 235
 						} else {
236 236
 							$month = 12;
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 
239 239
 					}
240 240
 
241
-					if ( ! $end_date ) {
241
+					if ( ! $end_date) {
242 242
 
243 243
 						// Getting the start day
244 244
 
245
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
246
-						$day += get_option( 'start_of_week' );
245
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
246
+						$day += get_option('start_of_week');
247 247
 
248 248
 					} else {
249 249
 
250 250
 						// Getting the end day
251 251
 
252
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
253
-						$day += get_option( 'start_of_week' ) + 6;
252
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
253
+						$day += get_option('start_of_week') + 6;
254 254
 
255 255
 					}
256 256
 
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 
259 259
 				case 'last_week' :
260 260
 
261
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
262
-					$today              = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24;
261
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
262
+					$today              = date('d', current_time('timestamp')) * 60 * 60 * 24;
263 263
 
264
-					if ( $today < $days_to_week_start ) {
264
+					if ($today < $days_to_week_start) {
265 265
 
266
-						if ( $month > 1 ) {
266
+						if ($month > 1) {
267 267
 							$month -= 1;
268 268
 						} else {
269 269
 							$month = 12;
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 
272 272
 					}
273 273
 
274
-					if ( ! $end_date ) {
274
+					if ( ! $end_date) {
275 275
 
276 276
 						// Getting the start day
277 277
 
278
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
279
-						$day += get_option( 'start_of_week' );
278
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
279
+						$day += get_option('start_of_week');
280 280
 
281 281
 					} else {
282 282
 
283 283
 						// Getting the end day
284 284
 
285
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
286
-						$day += get_option( 'start_of_week' ) + 6;
285
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
286
+						$day += get_option('start_of_week') + 6;
287 287
 
288 288
 					}
289 289
 
@@ -291,39 +291,39 @@  discard block
 block discarded – undo
291 291
 
292 292
 				case 'this_quarter' :
293 293
 
294
-					$month_now = date( 'n', current_time( 'timestamp' ) );
294
+					$month_now = date('n', current_time('timestamp'));
295 295
 
296
-					if ( $month_now <= 3 ) {
296
+					if ($month_now <= 3) {
297 297
 
298
-						if ( ! $end_date ) {
298
+						if ( ! $end_date) {
299 299
 							$month = 1;
300 300
 						} else {
301 301
 							$month  = 3;
302
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
302
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
303 303
 							$hour   = 23;
304 304
 							$minute = 59;
305 305
 							$second = 59;
306 306
 						}
307 307
 
308
-					} else if ( $month_now <= 6 ) {
308
+					} else if ($month_now <= 6) {
309 309
 
310
-						if ( ! $end_date ) {
310
+						if ( ! $end_date) {
311 311
 							$month = 4;
312 312
 						} else {
313 313
 							$month  = 6;
314
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
314
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
315 315
 							$hour   = 23;
316 316
 							$minute = 59;
317 317
 							$second = 59;
318 318
 						}
319 319
 
320
-					} else if ( $month_now <= 9 ) {
320
+					} else if ($month_now <= 9) {
321 321
 
322
-						if ( ! $end_date ) {
322
+						if ( ! $end_date) {
323 323
 							$month = 7;
324 324
 						} else {
325 325
 							$month  = 9;
326
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
326
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
327 327
 							$hour   = 23;
328 328
 							$minute = 59;
329 329
 							$second = 59;
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 
332 332
 					} else {
333 333
 
334
-						if ( ! $end_date ) {
334
+						if ( ! $end_date) {
335 335
 							$month = 10;
336 336
 						} else {
337 337
 							$month  = 12;
338
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
338
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
339 339
 							$hour   = 23;
340 340
 							$minute = 59;
341 341
 							$second = 59;
@@ -347,40 +347,40 @@  discard block
 block discarded – undo
347 347
 
348 348
 				case 'last_quarter' :
349 349
 
350
-					$month_now = date( 'n', current_time( 'timestamp' ) );
350
+					$month_now = date('n', current_time('timestamp'));
351 351
 
352
-					if ( $month_now <= 3 ) {
352
+					if ($month_now <= 3) {
353 353
 
354
-						if ( ! $end_date ) {
354
+						if ( ! $end_date) {
355 355
 							$month = 10;
356 356
 						} else {
357 357
 							$year -= 1;
358 358
 							$month  = 12;
359
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
359
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
360 360
 							$hour   = 23;
361 361
 							$minute = 59;
362 362
 							$second = 59;
363 363
 						}
364 364
 
365
-					} else if ( $month_now <= 6 ) {
365
+					} else if ($month_now <= 6) {
366 366
 
367
-						if ( ! $end_date ) {
367
+						if ( ! $end_date) {
368 368
 							$month = 1;
369 369
 						} else {
370 370
 							$month  = 3;
371
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
371
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
372 372
 							$hour   = 23;
373 373
 							$minute = 59;
374 374
 							$second = 59;
375 375
 						}
376 376
 
377
-					} else if ( $month_now <= 9 ) {
377
+					} else if ($month_now <= 9) {
378 378
 
379
-						if ( ! $end_date ) {
379
+						if ( ! $end_date) {
380 380
 							$month = 4;
381 381
 						} else {
382 382
 							$month  = 6;
383
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
383
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
384 384
 							$hour   = 23;
385 385
 							$minute = 59;
386 386
 							$second = 59;
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 
389 389
 					} else {
390 390
 
391
-						if ( ! $end_date ) {
391
+						if ( ! $end_date) {
392 392
 							$month = 7;
393 393
 						} else {
394 394
 							$month  = 9;
395
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
395
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
396 396
 							$hour   = 23;
397 397
 							$minute = 59;
398 398
 							$second = 59;
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 
405 405
 				case 'this_year' :
406 406
 
407
-					if ( ! $end_date ) {
407
+					if ( ! $end_date) {
408 408
 						$month = 1;
409 409
 					} else {
410 410
 						$month  = 12;
411
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
411
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
412 412
 						$hour   = 23;
413 413
 						$minute = 59;
414 414
 						$second = 59;
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 				case 'last_year' :
420 420
 
421 421
 					$year -= 1;
422
-					if ( ! $end_date ) {
422
+					if ( ! $end_date) {
423 423
 						$month = 1;
424 424
 					} else {
425 425
 						$month  = 12;
426
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
426
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
427 427
 						$hour   = 23;
428 428
 						$minute = 59;
429 429
 						$second = 59;
@@ -434,30 +434,30 @@  discard block
 block discarded – undo
434 434
 			}
435 435
 
436 436
 
437
-		} else if ( is_numeric( $date ) ) {
437
+		} else if (is_numeric($date)) {
438 438
 
439 439
 			// return $date unchanged since it is a timestamp
440 440
 			$this->timestamp = true;
441 441
 
442
-		} else if ( false !== strtotime( $date ) ) {
442
+		} else if (false !== strtotime($date)) {
443 443
 
444
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
445
-			$year  = date( 'Y', $date );
446
-			$month = date( 'm', $date );
447
-			$day   = date( 'd', $date );
444
+			$date  = strtotime($date, current_time('timestamp'));
445
+			$year  = date('Y', $date);
446
+			$month = date('m', $date);
447
+			$day   = date('d', $date);
448 448
 
449 449
 		} else {
450 450
 
451
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
451
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
452 452
 
453 453
 		}
454 454
 
455
-		if ( false === $this->timestamp ) {
455
+		if (false === $this->timestamp) {
456 456
 			// Create an exact timestamp
457
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
457
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
458 458
 		}
459 459
 
460
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
460
+		return apply_filters('give_stats_date', $date, $end_date, $this);
461 461
 
462 462
 	}
463 463
 
@@ -473,33 +473,33 @@  discard block
 block discarded – undo
473 473
 	 * 
474 474
 	 * @return string
475 475
 	 */
476
-	public function count_where( $where = '' ) {
476
+	public function count_where($where = '') {
477 477
 		// Only get payments in our date range
478 478
 
479 479
 		$start_where = '';
480 480
 		$end_where   = '';
481 481
 
482
-		if ( $this->start_date ) {
482
+		if ($this->start_date) {
483 483
 
484
-			if ( $this->timestamp ) {
484
+			if ($this->timestamp) {
485 485
 				$format = 'Y-m-d H:i:s';
486 486
 			} else {
487 487
 				$format = 'Y-m-d 00:00:00';
488 488
 			}
489 489
 
490
-			$start_date  = date( $format, $this->start_date );
490
+			$start_date  = date($format, $this->start_date);
491 491
 			$start_where = " AND p.post_date >= '{$start_date}'";
492 492
 		}
493 493
 
494
-		if ( $this->end_date ) {
494
+		if ($this->end_date) {
495 495
 
496
-			if ( $this->timestamp ) {
496
+			if ($this->timestamp) {
497 497
 				$format = 'Y-m-d H:i:s';
498 498
 			} else {
499 499
 				$format = 'Y-m-d 23:59:59';
500 500
 			}
501 501
 
502
-			$end_date = date( $format, $this->end_date );
502
+			$end_date = date($format, $this->end_date);
503 503
 
504 504
 			$end_where = " AND p.post_date <= '{$end_date}'";
505 505
 		}
@@ -521,34 +521,34 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return string
523 523
 	 */
524
-	public function payments_where( $where = '' ) {
524
+	public function payments_where($where = '') {
525 525
 
526 526
 		global $wpdb;
527 527
 
528 528
 		$start_where = '';
529 529
 		$end_where   = '';
530 530
 
531
-		if ( ! is_wp_error( $this->start_date ) ) {
531
+		if ( ! is_wp_error($this->start_date)) {
532 532
 
533
-			if ( $this->timestamp ) {
533
+			if ($this->timestamp) {
534 534
 				$format = 'Y-m-d H:i:s';
535 535
 			} else {
536 536
 				$format = 'Y-m-d 00:00:00';
537 537
 			}
538 538
 
539
-			$start_date  = date( $format, $this->start_date );
539
+			$start_date  = date($format, $this->start_date);
540 540
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
541 541
 		}
542 542
 
543
-		if ( ! is_wp_error( $this->end_date ) ) {
543
+		if ( ! is_wp_error($this->end_date)) {
544 544
 
545
-			if ( $this->timestamp ) {
545
+			if ($this->timestamp) {
546 546
 				$format = 'Y-m-d 00:00:00';
547 547
 			} else {
548 548
 				$format = 'Y-m-d 23:59:59';
549 549
 			}
550 550
 
551
-			$end_date = date( $format, $this->end_date );
551
+			$end_date = date($format, $this->end_date);
552 552
 
553 553
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
554 554
 		}
Please login to merge, or discard this patch.
includes/class-give-db.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 * @since  1.0
112 112
 	 * @access public
113 113
 	 *
114
-     * @param  int $column Column ID.
115
-     * @param  int $row_id Row ID.
116
-     *
117
-     * @return object
114
+	 * @param  int $column Column ID.
115
+	 * @param  int $row_id Row ID.
116
+	 *
117
+	 * @return object
118 118
 	 */
119 119
 	public function get_by( $column, $row_id ) {
120
-        /* @var WPDB $wpdb */
121
-        global $wpdb;
120
+		/* @var WPDB $wpdb */
121
+		global $wpdb;
122 122
 
123 123
 		$column = esc_sql( $column );
124 124
 		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @since  1.0
131 131
 	 * @access public
132
-     *
133
-     * @param  int $column Column ID.
134
-     * @param  int $row_id Row ID.
135
-     *
132
+	 *
133
+	 * @param  int $column Column ID.
134
+	 * @param  int $row_id Row ID.
135
+	 *
136 136
 	 * @return string      Column value.
137 137
 	 */
138 138
 	public function get_column( $column, $row_id ) {
139
-        /* @var WPDB $wpdb */
140
-        global $wpdb;
139
+		/* @var WPDB $wpdb */
140
+		global $wpdb;
141 141
 
142 142
 		$column = esc_sql( $column );
143 143
 		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @since  1.0
150 150
 	 * @access public
151
-     *
152
-     * @param  int    $column       Column ID.
153
-     * @param  string $column_where Column name.
154
-     * @param  string $column_value Column value.
155
-     *
151
+	 *
152
+	 * @param  int    $column       Column ID.
153
+	 * @param  string $column_where Column name.
154
+	 * @param  string $column_value Column value.
155
+	 *
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function get_column_by( $column, $column_where, $column_value ) {
159
-        /* @var WPDB $wpdb */
160
-        global $wpdb;
159
+		/* @var WPDB $wpdb */
160
+		global $wpdb;
161 161
 
162 162
 		$column_where = esc_sql( $column_where );
163 163
 		$column       = esc_sql( $column );
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 	 *
170 170
 	 * @since  1.0
171 171
 	 * @access public
172
-     *
173
-     * @param  array  $data
174
-     * @param  string $type
175
-     *
172
+	 *
173
+	 * @param  array  $data
174
+	 * @param  string $type
175
+	 *
176 176
 	 * @return int
177 177
 	 */
178 178
 	public function insert( $data, $type = '' ) {
179
-        /* @var WPDB $wpdb */
180
-        global $wpdb;
179
+		/* @var WPDB $wpdb */
180
+		global $wpdb;
181 181
 
182 182
 		// Set default values
183 183
 		$data = wp_parse_args( $data, $this->get_column_defaults() );
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @since  1.0
211 211
 	 * @access public
212
-     *
213
-     * @param  int    $row_id Column ID
214
-     * @param  array  $data
215
-     * @param  string $where  Column value
216
-     *
212
+	 *
213
+	 * @param  int    $row_id Column ID
214
+	 * @param  array  $data
215
+	 * @param  string $where  Column value
216
+	 *
217 217
 	 * @return bool
218 218
 	 */
219 219
 	public function update( $row_id, $data = array(), $where = '' ) {
220
-        /* @var WPDB $wpdb */
221
-        global $wpdb;
220
+		/* @var WPDB $wpdb */
221
+		global $wpdb;
222 222
 
223 223
 		// Row ID must be positive integer
224 224
 		$row_id = absint( $row_id );
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @since  1.0
258 258
 	 * @access public
259
-     *
260
-     * @param  int $row_id Column ID.
261
-     *
259
+	 *
260
+	 * @param  int $row_id Column ID.
261
+	 *
262 262
 	 * @return bool
263 263
 	 */
264 264
 	public function delete( $row_id = 0 ) {
265
-        /* @var WPDB $wpdb */
266
-        global $wpdb;
265
+		/* @var WPDB $wpdb */
266
+		global $wpdb;
267 267
 
268 268
 		// Row ID must be positive integer
269 269
 		$row_id = absint( $row_id );
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 	 *
285 285
 	 * @since  1.3.2
286 286
 	 * @access public
287
-     *
287
+	 *
288 288
 	 * @param  string $table The table name.
289
-     *
289
+	 *
290 290
 	 * @return bool          If the table name exists.
291 291
 	 */
292 292
 	public function table_exists( $table ) {
293
-        /* @var WPDB $wpdb */
293
+		/* @var WPDB $wpdb */
294 294
 		global $wpdb;
295 295
 
296 296
 		$table = sanitize_text_field( $table );
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
105
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return object
118 118
 	 */
119
-	public function get_by( $column, $row_id ) {
119
+	public function get_by($column, $row_id) {
120 120
         /* @var WPDB $wpdb */
121 121
         global $wpdb;
122 122
 
123
-		$column = esc_sql( $column );
124
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
123
+		$column = esc_sql($column);
124
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
125 125
 	}
126 126
 
127 127
 	/**
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
      *
136 136
 	 * @return string      Column value.
137 137
 	 */
138
-	public function get_column( $column, $row_id ) {
138
+	public function get_column($column, $row_id) {
139 139
         /* @var WPDB $wpdb */
140 140
         global $wpdb;
141 141
 
142
-		$column = esc_sql( $column );
143
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
142
+		$column = esc_sql($column);
143
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
144 144
 	}
145 145
 
146 146
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
 	 * @return string
157 157
 	 */
158
-	public function get_column_by( $column, $column_where, $column_value ) {
158
+	public function get_column_by($column, $column_where, $column_value) {
159 159
         /* @var WPDB $wpdb */
160 160
         global $wpdb;
161 161
 
162
-		$column_where = esc_sql( $column_where );
163
-		$column       = esc_sql( $column );
164
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
162
+		$column_where = esc_sql($column_where);
163
+		$column       = esc_sql($column);
164
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
165 165
 	}
166 166
 
167 167
 	/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
 	 * @return int
177 177
 	 */
178
-	public function insert( $data, $type = '' ) {
178
+	public function insert($data, $type = '') {
179 179
         /* @var WPDB $wpdb */
180 180
         global $wpdb;
181 181
 
182 182
 		// Set default values.
183
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
183
+		$data = wp_parse_args($data, $this->get_column_defaults());
184 184
 
185 185
 		/**
186 186
 		 * Fires before inserting data to the database.
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 		 *
190 190
 		 * @param array $data
191 191
 		 */
192
-		do_action( "give_pre_insert_{$type}", $data );
192
+		do_action("give_pre_insert_{$type}", $data);
193 193
 
194 194
 		// Initialise column format array
195 195
 		$column_formats = $this->get_columns();
196 196
 
197 197
 		// Force fields to lower case
198
-		$data = array_change_key_case( $data );
198
+		$data = array_change_key_case($data);
199 199
 
200 200
 		// White list columns
201
-		$data = array_intersect_key( $data, $column_formats );
201
+		$data = array_intersect_key($data, $column_formats);
202 202
 
203 203
 		// Reorder $column_formats to match the order of columns given in $data
204
-		$data_keys      = array_keys( $data );
205
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
204
+		$data_keys      = array_keys($data);
205
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
206 206
 
207
-		$wpdb->insert( $this->table_name, $data, $column_formats );
207
+		$wpdb->insert($this->table_name, $data, $column_formats);
208 208
 
209 209
 		/**
210 210
 		 * Fires after inserting data to the database.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		 * @param int   $insert_id
215 215
 		 * @param array $data
216 216
 		 */
217
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
217
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
218 218
 
219 219
 		return $wpdb->insert_id;
220 220
 	}
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
      *
232 232
 	 * @return bool
233 233
 	 */
234
-	public function update( $row_id, $data = array(), $where = '' ) {
234
+	public function update($row_id, $data = array(), $where = '') {
235 235
         /* @var WPDB $wpdb */
236 236
         global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239
-		$row_id = absint( $row_id );
239
+		$row_id = absint($row_id);
240 240
 
241
-		if ( empty( $row_id ) ) {
241
+		if (empty($row_id)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( empty( $where ) ) {
245
+		if (empty($where)) {
246 246
 			$where = $this->primary_key;
247 247
 		}
248 248
 
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 		$column_formats = $this->get_columns();
251 251
 
252 252
 		// Force fields to lower case
253
-		$data = array_change_key_case( $data );
253
+		$data = array_change_key_case($data);
254 254
 
255 255
 		// White list columns
256
-		$data = array_intersect_key( $data, $column_formats );
256
+		$data = array_intersect_key($data, $column_formats);
257 257
 
258 258
 		// Reorder $column_formats to match the order of columns given in $data
259
-		$data_keys      = array_keys( $data );
260
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
259
+		$data_keys      = array_keys($data);
260
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
261 261
 
262
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
262
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
263 263
 			return false;
264 264
 		}
265 265
 
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
      *
277 277
 	 * @return bool
278 278
 	 */
279
-	public function delete( $row_id = 0 ) {
279
+	public function delete($row_id = 0) {
280 280
         /* @var WPDB $wpdb */
281 281
         global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284
-		$row_id = absint( $row_id );
284
+		$row_id = absint($row_id);
285 285
 
286
-		if ( empty( $row_id ) ) {
286
+		if (empty($row_id)) {
287 287
 			return false;
288 288
 		}
289 289
 
290
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
290
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
291 291
 			return false;
292 292
 		}
293 293
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
      *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307
-	public function table_exists( $table ) {
307
+	public function table_exists($table) {
308 308
         /* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311
-		$table = sanitize_text_field( $table );
311
+		$table = sanitize_text_field($table);
312 312
 
313
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
313
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
323 323
 	 */
324 324
 	public function installed() {
325
-		return $this->table_exists( $this->table_name );
325
+		return $this->table_exists($this->table_name);
326 326
 	}
327 327
 
328 328
 }
Please login to merge, or discard this patch.
give.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -358,9 +358,9 @@
 block discarded – undo
358 358
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
359 359
 			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
360 360
 
361
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
362
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
-            }
361
+			if( defined( 'WP_CLI' ) && WP_CLI ) {
362
+				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
363
+			}
364 364
 
365 365
 			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
366 366
 
Please login to merge, or discard this patch.
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly.
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 
49 49
 	/**
50 50
 	 * Main Give Class
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 		 * @return    Give
196 196
 		 */
197 197
 		public static function instance() {
198
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
198
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
199 199
 				self::$instance = new Give;
200 200
 				self::$instance->setup_constants();
201 201
 
202
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
202
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
203 203
 
204 204
 				self::$instance->includes();
205 205
 				self::$instance->roles           = new Give_Roles();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 */
233 233
 		public function __clone() {
234 234
 			// Cloning instances of the class is forbidden
235
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
235
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
236 236
 		}
237 237
 
238 238
 		/**
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 */
246 246
 		public function __wakeup() {
247 247
 			// Unserializing instances of the class is forbidden.
248
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
248
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
249 249
 		}
250 250
 
251 251
 		/**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
 		private function setup_constants() {
260 260
 
261 261
 			// Plugin version
262
-			if ( ! defined( 'GIVE_VERSION' ) ) {
263
-				define( 'GIVE_VERSION', '1.8' );
262
+			if ( ! defined('GIVE_VERSION')) {
263
+				define('GIVE_VERSION', '1.8');
264 264
 			}
265 265
 
266 266
 			// Plugin Folder Path
267
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
268
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
267
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
268
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
269 269
 			}
270 270
 
271 271
 			// Plugin Folder URL
272
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
273
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
272
+			if ( ! defined('GIVE_PLUGIN_URL')) {
273
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
274 274
 			}
275 275
 
276 276
 			// Plugin Basename aka: "give/give.php"
277
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
278
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
277
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
278
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
279 279
 			}
280 280
 
281 281
 			// Plugin Root File
282
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
283
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
282
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
283
+				define('GIVE_PLUGIN_FILE', __FILE__);
284 284
 			}
285 285
 
286 286
 			// Make sure CAL_GREGORIAN is defined
287
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
288
-				define( 'CAL_GREGORIAN', 1 );
287
+			if ( ! defined('CAL_GREGORIAN')) {
288
+				define('CAL_GREGORIAN', 1);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,122 +300,122 @@  discard block
 block discarded – undo
300 300
 		private function includes() {
301 301
 			global $give_options;
302 302
 
303
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
305 305
 			$give_options = give_get_settings();
306 306
 
307
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
308
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
313
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
314
-
315
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
319
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
320
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php';
321
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
322
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
323
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
324
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
325
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
326
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
327
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
328
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
329
-
330
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
331
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
332
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
333
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
334
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
335
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
336
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
337
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
338
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
339
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
340
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
341
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
342
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
343
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
344
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
345
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
346
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
347
-
348
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
349
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
350
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
351
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
352
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
353
-
354
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
355
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
356
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
357
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
358
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
359
-
360
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
361
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
362
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
363
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
364
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
365
-
366
-            if( defined( 'WP_CLI' ) && WP_CLI ) {
367
-                require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
307
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
308
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
313
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
314
+
315
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
319
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
320
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php';
321
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
322
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
323
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
324
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
325
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
326
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
327
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
328
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
329
+
330
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
331
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
332
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
333
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
334
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
335
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
336
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
337
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
338
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
339
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
340
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
341
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
342
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
343
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
344
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
345
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
346
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
347
+
348
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
349
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
350
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
351
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
352
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
353
+
354
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
355
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
356
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
357
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
358
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
359
+
360
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
361
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
362
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
363
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
364
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
365
+
366
+            if (defined('WP_CLI') && WP_CLI) {
367
+                require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
368 368
             }
369 369
 
370
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
371
-
372
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
373
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
374
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
375
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
376
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
377
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
378
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
379
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
380
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
381
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
382
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
383
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
384
-
385
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
386
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
387
-
388
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
389
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
390
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
391
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
392
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
393
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
394
-
395
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
396
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
397
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
398
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
399
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
400
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
401
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
402
-
403
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
404
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
405
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
406
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
407
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
408
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
409
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
410
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
411
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
412
-
413
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
414
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
370
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
371
+
372
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
373
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
374
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
375
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
376
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
377
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
378
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
379
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
380
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
381
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
382
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
383
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
384
+
385
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
386
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
387
+
388
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
389
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
390
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
391
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
392
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
393
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
394
+
395
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
396
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
397
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
398
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
399
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
400
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
401
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
402
+
403
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
404
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
405
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
406
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
407
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
408
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
409
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
410
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
411
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
412
+
413
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
414
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
415 415
 
416 416
 			}
417 417
 
418
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
418
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
419 419
 
420 420
 		}
421 421
 
@@ -429,26 +429,26 @@  discard block
 block discarded – undo
429 429
 		 */
430 430
 		public function load_textdomain() {
431 431
 			// Set filter for Give's languages directory
432
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
433
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
432
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
433
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
434 434
 
435 435
 			// Traditional WordPress plugin locale filter
436
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
437
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
436
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
437
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
438 438
 
439 439
 			// Setup paths to current locale file
440
-			$mofile_local  = $give_lang_dir . $mofile;
441
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
440
+			$mofile_local  = $give_lang_dir.$mofile;
441
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
442 442
 
443
-			if ( file_exists( $mofile_global ) ) {
443
+			if (file_exists($mofile_global)) {
444 444
 				// Look in global /wp-content/languages/give folder
445
-				load_textdomain( 'give', $mofile_global );
446
-			} elseif ( file_exists( $mofile_local ) ) {
445
+				load_textdomain('give', $mofile_global);
446
+			} elseif (file_exists($mofile_local)) {
447 447
 				// Look in local location from filter `give_languages_directory`
448
-				load_textdomain( 'give', $mofile_local );
448
+				load_textdomain('give', $mofile_local);
449 449
 			} else {
450 450
 				// Load the default language files packaged up w/ Give
451
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
451
+				load_plugin_textdomain('give', false, $give_lang_dir);
452 452
 			}
453 453
 		}
454 454
 
Please login to merge, or discard this patch.