Completed
Branch master (34b06a)
by Devin
20:06
created
includes/admin/shortcodes/shortcode-give-login.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
42 42
 				'minWidth' => 320,
43 43
 				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),
44 44
 			),
45
-            array(
46
-                'type' => 'container',
47
-                'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
48
-            ),
49
-            array(
50
-                'type'     => 'textbox',
51
-                'name'     => 'logout-redirect',
52
-                'minWidth' => 320,
53
-                'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
54
-            ),
45
+			array(
46
+				'type' => 'container',
47
+				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
48
+			),
49
+			array(
50
+				'type'     => 'textbox',
51
+				'name'     => 'logout-redirect',
52
+				'minWidth' => 320,
53
+				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
54
+			),
55 55
 		);
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Login', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Login', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Login', 'give');
25
+		$this->shortcode['label'] = esc_html__('Login', 'give');
26 26
 
27
-		parent::__construct( 'give_login' );
27
+		parent::__construct('give_login');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Login Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Login Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'login-redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after login.', 'give'),
47 47
 			),
48 48
             array(
49 49
                 'type' => 'container',
50
-                'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
50
+                'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Logout Redirect URL (optional):', 'give')),
51 51
             ),
52 52
             array(
53 53
                 'type'     => 'textbox',
54 54
                 'name'     => 'logout-redirect',
55 55
                 'minWidth' => 320,
56
-                'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
56
+                'tooltip'  => esc_attr__('Enter an URL here to redirect to after logout.', 'give'),
57 57
             ),
58 58
 		);
59 59
 	}
Please login to merge, or discard this patch.
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 ) ] = $post->post_title;
294
+		if ($posts) {
295
+			foreach ($posts as $post) {
296
+				$options[absint($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/admin/class-give-settings.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param $url
91 91
 	 *
92
-	 * @return mixed
92
+	 * @return string
93 93
 	 */
94 94
 	public function give_update_cmb_meta_box_url( $url ) {
95 95
 		//Path to Give's CMB
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
  * @since 1.0
874 874
  *
875 875
  * @param string          $key The Key to update
876
- * @param string|bool|int $value The value to set the key to
876
+ * @param integer $value The value to set the key to
877 877
  *
878 878
  * @return boolean True if updated, false if not.
879 879
  */
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @since      1.3.5
975 975
  *
976 976
  * @param $array
977
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
977
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
978 978
  * @param $insert |array a valid array of options to insert
979 979
  *
980 980
  * @return array
Please login to merge, or discard this patch.
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function __construct() {
47 47
 
48
-		add_action( 'admin_init', array( $this, 'init' ) );
48
+		add_action('admin_init', array($this, 'init'));
49 49
 
50 50
 		//Customize CMB2 URL
51
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
51
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
52 52
 
53 53
 		//Custom CMB2 Settings Fields
54
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
55
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
56
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
57
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
58
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
59
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
60
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
61
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
62
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
54
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
55
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
56
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
57
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
58
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
59
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
60
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
61
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
62
+		add_action('admin_notices', array($this, 'settings_notices'));
63 63
 
64 64
 		// Include CMB CSS in the head to avoid FOUC
65
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
65
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
66 66
 
67
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
67
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
68 68
 
69 69
 	}
70 70
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @since  1.0
76 76
 	 */
77 77
 	public function init() {
78
-		register_setting( $this->key, $this->key );
78
+		register_setting($this->key, $this->key);
79 79
 
80 80
 	}
81 81
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return mixed
91 91
 	 */
92
-	public function give_update_cmb_meta_box_url( $url ) {
92
+	public function give_update_cmb_meta_box_url($url) {
93 93
 		//Path to Give's CMB
94
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
94
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
95 95
 	}
96 96
 
97 97
 
@@ -103,27 +103,27 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function give_get_settings_tabs() {
105 105
 
106
-		$settings = $this->give_settings( null );
106
+		$settings = $this->give_settings(null);
107 107
 
108 108
 		$tabs             = array();
109
-		$tabs['general']  = esc_html__( 'General', 'give' );
110
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
111
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
112
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
109
+		$tabs['general']  = esc_html__('General', 'give');
110
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
111
+		$tabs['display']  = esc_html__('Display Options', 'give');
112
+		$tabs['emails']   = esc_html__('Emails', 'give');
113 113
 
114
-		if ( ! empty( $settings['addons']['fields'] ) ) {
115
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
114
+		if ( ! empty($settings['addons']['fields'])) {
115
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
116 116
 		}
117 117
 
118
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
119
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
118
+		if ( ! empty($settings['licenses']['fields'])) {
119
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
120 120
 		}
121 121
 
122
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
123
-		$tabs['api']         = esc_html__( 'API', 'give' );
124
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
122
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
123
+		$tabs['api']         = esc_html__('API', 'give');
124
+		$tabs['system_info'] = esc_html__('System Info', 'give');
125 125
 
126
-		return apply_filters( 'give_settings_tabs', $tabs );
126
+		return apply_filters('give_settings_tabs', $tabs);
127 127
 	}
128 128
 
129 129
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function admin_page_display() {
135 135
 
136
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
136
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
137 137
 
138 138
 		?>
139 139
 
@@ -143,22 +143,22 @@  discard block
 block discarded – undo
143 143
 
144 144
 			<h2 class="nav-tab-wrapper">
145 145
 				<?php
146
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
146
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
147 147
 
148
-					$tab_url = esc_url( add_query_arg( array(
148
+					$tab_url = esc_url(add_query_arg(array(
149 149
 						'settings-updated' => false,
150 150
 						'tab'              => $tab_id
151
-					) ) );
151
+					)));
152 152
 
153 153
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
154 154
 
155
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
155
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
156 156
 
157 157
 				}
158 158
 				?>
159 159
 			</h2>
160 160
 
161
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
161
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
162 162
 
163 163
 		</div><!-- .wrap -->
164 164
 
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return string
182 182
 	 */
183
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
183
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
184 184
 
185 185
 		//only modify the give settings form
186
-		if ( 'give_settings' == $object_id ) {
186
+		if ('give_settings' == $object_id) {
187 187
 
188
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
188
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>';
189 189
 
190 190
 		}
191 191
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return array
204 204
 	 */
205
-	public function give_settings( $active_tab ) {
205
+	public function give_settings($active_tab) {
206 206
 
207 207
 		$give_settings = array(
208 208
 			/**
@@ -210,99 +210,99 @@  discard block
 block discarded – undo
210 210
 			 */
211 211
 			'general'     => array(
212 212
 				'id'         => 'general_settings',
213
-				'give_title' => esc_html__( 'General Settings', 'give' ),
214
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
215
-				'fields'     => apply_filters( 'give_settings_general', array(
213
+				'give_title' => esc_html__('General Settings', 'give'),
214
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
215
+				'fields'     => apply_filters('give_settings_general', array(
216 216
 						array(
217
-							'name' => esc_html__( 'General Settings', 'give' ),
217
+							'name' => esc_html__('General Settings', 'give'),
218 218
 							'desc' => '',
219 219
 							'type' => 'give_title',
220 220
 							'id'   => 'give_title_general_settings_1'
221 221
 						),
222 222
 						array(
223
-							'name'    => esc_html__( 'Success Page', 'give' ),
223
+							'name'    => esc_html__('Success Page', 'give'),
224 224
 							/* translators: %s: [give_receipt] */
225
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
225
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
226 226
 							'id'      => 'success_page',
227 227
 							'type'    => 'select',
228
-							'options' => give_cmb2_get_post_options( array(
228
+							'options' => give_cmb2_get_post_options(array(
229 229
 								'post_type'   => 'page',
230
-								'numberposts' => - 1
231
-							) ),
230
+								'numberposts' => -1
231
+							)),
232 232
 						),
233 233
 						array(
234
-							'name'    => esc_html__( 'Failed Donation Page', 'give' ),
235
-							'desc'    => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
234
+							'name'    => esc_html__('Failed Donation Page', 'give'),
235
+							'desc'    => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'),
236 236
 							'id'      => 'failure_page',
237 237
 							'type'    => 'select',
238
-							'options' => give_cmb2_get_post_options( array(
238
+							'options' => give_cmb2_get_post_options(array(
239 239
 								'post_type'   => 'page',
240
-								'numberposts' => - 1
241
-							) ),
240
+								'numberposts' => -1
241
+							)),
242 242
 						),
243 243
 						array(
244
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
244
+							'name'    => esc_html__('Donation History Page', 'give'),
245 245
 							/* translators: %s: [donation_history] */
246
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
246
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
247 247
 							'id'      => 'history_page',
248 248
 							'type'    => 'select',
249
-							'options' => give_cmb2_get_post_options( array(
249
+							'options' => give_cmb2_get_post_options(array(
250 250
 								'post_type'   => 'page',
251
-								'numberposts' => - 1
252
-							) ),
251
+								'numberposts' => -1
252
+							)),
253 253
 						),
254 254
 						array(
255
-							'name'    => esc_html__( 'Base Country', 'give' ),
256
-							'desc'    => esc_html__( 'The country your site operates from.', 'give' ),
255
+							'name'    => esc_html__('Base Country', 'give'),
256
+							'desc'    => esc_html__('The country your site operates from.', 'give'),
257 257
 							'id'      => 'base_country',
258 258
 							'type'    => 'select',
259 259
 							'options' => give_get_country_list(),
260 260
 						),
261 261
 						array(
262
-							'name' => esc_html__( 'Currency Settings', 'give' ),
262
+							'name' => esc_html__('Currency Settings', 'give'),
263 263
 							'desc' => '',
264 264
 							'type' => 'give_title',
265 265
 							'id'   => 'give_title_general_settings_2'
266 266
 						),
267 267
 						array(
268
-							'name'    => esc_html__( 'Currency', 'give' ),
269
-							'desc'    => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
268
+							'name'    => esc_html__('Currency', 'give'),
269
+							'desc'    => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
270 270
 							'id'      => 'currency',
271 271
 							'type'    => 'select',
272 272
 							'options' => give_get_currencies(),
273 273
 							'default' => 'USD',
274 274
 						),
275 275
 						array(
276
-							'name'    => esc_html__( 'Currency Position', 'give' ),
277
-							'desc'    => esc_html__( 'The position of the currency symbol.', 'give' ),
276
+							'name'    => esc_html__('Currency Position', 'give'),
277
+							'desc'    => esc_html__('The position of the currency symbol.', 'give'),
278 278
 							'id'      => 'currency_position',
279 279
 							'type'    => 'select',
280 280
 							'options' => array(
281 281
 								/* translators: %s: currency symbol */
282
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
282
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
283 283
 								/* translators: %s: currency symbol */
284
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
284
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
285 285
 							),
286 286
 							'default' => 'before',
287 287
 						),
288 288
 						array(
289
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
290
-							'desc'            => esc_html__( 'The symbol (usually , or .) to separate thousands.', 'give' ),
289
+							'name'            => esc_html__('Thousands Separator', 'give'),
290
+							'desc'            => esc_html__('The symbol (usually , or .) to separate thousands.', 'give'),
291 291
 							'id'              => 'thousands_separator',
292 292
 							'type'            => 'text_small',
293 293
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
294 294
 							'default'         => ',',
295 295
 						),
296 296
 						array(
297
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
298
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
297
+							'name'    => esc_html__('Decimal Separator', 'give'),
298
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
299 299
 							'id'      => 'decimal_separator',
300 300
 							'type'    => 'text_small',
301 301
 							'default' => '.',
302 302
 						),
303 303
 						array(
304
-							'name'            => esc_html__( 'Number of Decimals', 'give' ),
305
-							'desc'            => esc_html__( 'The number of decimal points displayed in amounts.', 'give' ),
304
+							'name'            => esc_html__('Number of Decimals', 'give'),
305
+							'desc'            => esc_html__('The number of decimal points displayed in amounts.', 'give'),
306 306
 							'id'              => 'number_decimals',
307 307
 							'type'            => 'text_small',
308 308
 							'default'         => 2,
@@ -316,83 +316,83 @@  discard block
 block discarded – undo
316 316
 			 */
317 317
 			'gateways'    => array(
318 318
 				'id'         => 'payment_gateways',
319
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
320
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
321
-				'fields'     => apply_filters( 'give_settings_gateways', array(
319
+				'give_title' => esc_html__('Payment Gateways', 'give'),
320
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
321
+				'fields'     => apply_filters('give_settings_gateways', array(
322 322
 						array(
323
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
323
+							'name' => esc_html__('Gateways Settings', 'give'),
324 324
 							'desc' => '',
325 325
 							'id'   => 'give_title_gateway_settings_1',
326 326
 							'type' => 'give_title'
327 327
 						),
328 328
 						array(
329
-							'name' => esc_html__( 'Test Mode', 'give' ),
330
-							'desc' => esc_html__( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
329
+							'name' => esc_html__('Test Mode', 'give'),
330
+							'desc' => esc_html__('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
331 331
 							'id'   => 'test_mode',
332 332
 							'type' => 'checkbox'
333 333
 						),
334 334
 						array(
335
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
336
-							'desc' => esc_html__( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
335
+							'name' => esc_html__('Enabled Gateways', 'give'),
336
+							'desc' => esc_html__('Enable your payment gateway. Can be ordered by dragging.', 'give'),
337 337
 							'id'   => 'gateways',
338 338
 							'type' => 'enabled_gateways'
339 339
 						),
340 340
 						array(
341
-							'name' => esc_html__( 'Default Gateway', 'give' ),
342
-							'desc' => esc_html__( 'The gateway that will be selected by default.', 'give' ),
341
+							'name' => esc_html__('Default Gateway', 'give'),
342
+							'desc' => esc_html__('The gateway that will be selected by default.', 'give'),
343 343
 							'id'   => 'default_gateway',
344 344
 							'type' => 'default_gateway'
345 345
 						),
346 346
 						array(
347
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
347
+							'name' => esc_html__('PayPal Standard', 'give'),
348 348
 							'desc' => '',
349 349
 							'type' => 'give_title',
350 350
 							'id'   => 'give_title_gateway_settings_2',
351 351
 						),
352 352
 						array(
353
-							'name' => esc_html__( 'PayPal Email', 'give' ),
354
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
353
+							'name' => esc_html__('PayPal Email', 'give'),
354
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
355 355
 							'id'   => 'paypal_email',
356 356
 							'type' => 'text_email',
357 357
 						),
358 358
 						array(
359
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
360
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
359
+							'name' => esc_html__('PayPal Page Style', 'give'),
360
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
361 361
 							'id'   => 'paypal_page_style',
362 362
 							'type' => 'text',
363 363
 						),
364 364
 						array(
365
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
366
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
365
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
366
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
367 367
 							'id'      => 'paypal_button_type',
368 368
 							'type'    => 'radio_inline',
369 369
 							'options' => array(
370
-								'donation' => esc_html__( 'Donation', 'give' ),
371
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
370
+								'donation' => esc_html__('Donation', 'give'),
371
+								'standard' => esc_html__('Standard Transaction', 'give')
372 372
 							),
373 373
 							'default' => 'donation',
374 374
 						),
375 375
 						array(
376
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
377
-							'desc' => esc_html__( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
376
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
377
+							'desc' => esc_html__('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
378 378
 							'id'   => 'disable_paypal_verification',
379 379
 							'type' => 'checkbox'
380 380
 						),
381 381
 						array(
382
-							'name' => esc_html__( 'Offline Donations', 'give' ),
382
+							'name' => esc_html__('Offline Donations', 'give'),
383 383
 							'desc' => '',
384 384
 							'type' => 'give_title',
385 385
 							'id'   => 'give_title_gateway_settings_3',
386 386
 						),
387 387
 						array(
388
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
389
-							'desc' => esc_html__( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
388
+							'name' => esc_html__('Collect Billing Details', 'give'),
389
+							'desc' => esc_html__('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
390 390
 							'id'   => 'give_offline_donation_enable_billing_fields',
391 391
 							'type' => 'checkbox'
392 392
 						),
393 393
 						array(
394
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
395
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
394
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
395
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
396 396
 							'id'      => 'global_offline_donation_content',
397 397
 							'default' => give_get_default_offline_donation_content(),
398 398
 							'type'    => 'wysiwyg',
@@ -401,15 +401,15 @@  discard block
 block discarded – undo
401 401
 							)
402 402
 						),
403 403
 						array(
404
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
405
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
404
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
405
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
406 406
 							'id'      => 'offline_donation_subject',
407
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
407
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
408 408
 							'type'    => 'text'
409 409
 						),
410 410
 						array(
411
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
412
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
411
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
412
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
413 413
 							'id'      => 'global_offline_donation_email',
414 414
 							'default' => give_get_default_offline_donation_email_content(),
415 415
 							'type'    => 'wysiwyg',
@@ -423,105 +423,105 @@  discard block
 block discarded – undo
423 423
 			/** Display Settings */
424 424
 			'display'     => array(
425 425
 				'id'         => 'display_settings',
426
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
427
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
428
-				'fields'     => apply_filters( 'give_settings_display', array(
426
+				'give_title' => esc_html__('Display Settings', 'give'),
427
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
428
+				'fields'     => apply_filters('give_settings_display', array(
429 429
 						array(
430
-							'name' => esc_html__( 'Display Settings', 'give' ),
430
+							'name' => esc_html__('Display Settings', 'give'),
431 431
 							'desc' => '',
432 432
 							'id'   => 'give_title_display_settings_1',
433 433
 							'type' => 'give_title'
434 434
 						),
435 435
 						array(
436
-							'name' => esc_html__( 'Disable CSS', 'give' ),
437
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
436
+							'name' => esc_html__('Disable CSS', 'give'),
437
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
438 438
 							'id'   => 'disable_css',
439 439
 							'type' => 'checkbox'
440 440
 						),
441 441
 						array(
442
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
442
+							'name' => esc_html__('Enable Floating Labels', 'give'),
443 443
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
444
-							'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array(
444
+							'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array(
445 445
 								'a' => array(
446 446
 									'href'   => array(),
447 447
 									'target' => array()
448 448
 								)
449
-							) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
449
+							)), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
450 450
 							'id'   => 'enable_floatlabels',
451 451
 							'type' => 'checkbox'
452 452
 						),
453 453
 						array(
454
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
454
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
455 455
 							/* translators: %s: about page URL */
456
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array(
456
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array(
457 457
 								'a' => array(
458 458
 									'href'   => array(),
459 459
 									'target' => array()
460 460
 								)
461
-							) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
461
+							)), esc_url(admin_url('index.php?page=give-about'))),
462 462
 							'id'   => 'disable_welcome',
463 463
 							'type' => 'checkbox'
464 464
 						),
465 465
 						array(
466
-							'name' => esc_html__( 'Post Types', 'give' ),
466
+							'name' => esc_html__('Post Types', 'give'),
467 467
 							'desc' => '',
468 468
 							'id'   => 'give_title_display_settings_2',
469 469
 							'type' => 'give_title'
470 470
 						),
471 471
 						array(
472
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
473
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
472
+							'name' => esc_html__('Disable Form Single Views', 'give'),
473
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
474 474
 							'id'   => 'disable_forms_singular',
475 475
 							'type' => 'checkbox'
476 476
 						),
477 477
 						array(
478
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
479
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
478
+							'name' => esc_html__('Disable Form Archives', 'give'),
479
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
480 480
 							'id'   => 'disable_forms_archives',
481 481
 							'type' => 'checkbox'
482 482
 						),
483 483
 						array(
484
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
485
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
484
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
485
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
486 486
 							'id'   => 'disable_forms_excerpt',
487 487
 							'type' => 'checkbox'
488 488
 						),
489 489
 
490 490
 						array(
491
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
492
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
491
+							'name'    => esc_html__('Featured Image Size', 'give'),
492
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
493 493
 							'id'      => 'featured_image_size',
494 494
 							'type'    => 'select',
495 495
 							'default' => 'large',
496 496
 							'options' => give_get_featured_image_sizes()
497 497
 						),
498 498
 						array(
499
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
500
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
499
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
500
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
501 501
 							'id'   => 'disable_form_featured_img',
502 502
 							'type' => 'checkbox'
503 503
 						),
504 504
 						array(
505
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
506
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
505
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
506
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
507 507
 							'id'   => 'disable_form_sidebar',
508 508
 							'type' => 'checkbox'
509 509
 						),
510 510
 						array(
511
-							'name' => esc_html__( 'Taxonomies', 'give' ),
511
+							'name' => esc_html__('Taxonomies', 'give'),
512 512
 							'desc' => '',
513 513
 							'id'   => 'give_title_display_settings_3',
514 514
 							'type' => 'give_title'
515 515
 						),
516 516
 						array(
517
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
518
-							'desc' => esc_html__( 'Enables the "Category" taxonomy for all Give forms.', 'give' ),
517
+							'name' => esc_html__('Enable Form Categories', 'give'),
518
+							'desc' => esc_html__('Enables the "Category" taxonomy for all Give forms.', 'give'),
519 519
 							'id'   => 'enable_categories',
520 520
 							'type' => 'checkbox'
521 521
 						),
522 522
 						array(
523
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
524
-							'desc' => esc_html__( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ),
523
+							'name' => esc_html__('Enable Form Tags', 'give'),
524
+							'desc' => esc_html__('Enables the "Tag" taxonomy for all Give forms.', 'give'),
525 525
 							'id'   => 'enable_tags',
526 526
 							'type' => 'checkbox'
527 527
 						),
@@ -555,101 +555,101 @@  discard block
 block discarded – undo
555 555
 			 */
556 556
 			'emails'      => array(
557 557
 				'id'         => 'email_settings',
558
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
559
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
560
-				'fields'     => apply_filters( 'give_settings_emails', array(
558
+				'give_title' => esc_html__('Email Settings', 'give'),
559
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
560
+				'fields'     => apply_filters('give_settings_emails', array(
561 561
 						array(
562
-							'name' => esc_html__( 'Email Settings', 'give' ),
562
+							'name' => esc_html__('Email Settings', 'give'),
563 563
 							'desc' => '',
564 564
 							'id'   => 'give_title_email_settings_1',
565 565
 							'type' => 'give_title'
566 566
 						),
567 567
 						array(
568 568
 							'id'      => 'email_template',
569
-							'name'    => esc_html__( 'Email Template', 'give' ),
570
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
569
+							'name'    => esc_html__('Email Template', 'give'),
570
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
571 571
 							'type'    => 'select',
572 572
 							'options' => give_get_email_templates()
573 573
 						),
574 574
 						array(
575 575
 							'id'   => 'email_logo',
576
-							'name' => esc_html__( 'Logo', 'give' ),
577
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
576
+							'name' => esc_html__('Logo', 'give'),
577
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
578 578
 							'type' => 'file'
579 579
 						),
580 580
 						array(
581 581
 							'id'      => 'from_name',
582
-							'name'    => esc_html__( 'From Name', 'give' ),
583
-							'desc'    => esc_html__( 'The name that appears in the "From" field in donation receipt emails.', 'give' ),
584
-							'default' => get_bloginfo( 'name' ),
582
+							'name'    => esc_html__('From Name', 'give'),
583
+							'desc'    => esc_html__('The name that appears in the "From" field in donation receipt emails.', 'give'),
584
+							'default' => get_bloginfo('name'),
585 585
 							'type'    => 'text'
586 586
 						),
587 587
 						array(
588 588
 							'id'      => 'from_email',
589
-							'name'    => esc_html__( 'From Email', 'give' ),
590
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
591
-							'default' => get_bloginfo( 'admin_email' ),
589
+							'name'    => esc_html__('From Email', 'give'),
590
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
591
+							'default' => get_bloginfo('admin_email'),
592 592
 							'type'    => 'text'
593 593
 						),
594 594
 						array(
595
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
595
+							'name' => esc_html__('Donation Receipt', 'give'),
596 596
 							'desc' => '',
597 597
 							'id'   => 'give_title_email_settings_2',
598 598
 							'type' => 'give_title'
599 599
 						),
600 600
 						array(
601 601
 							'id'      => 'donation_subject',
602
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
603
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
604
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
602
+							'name'    => esc_html__('Donation Email Subject', 'give'),
603
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
604
+							'default' => esc_attr__('Donation Receipt', 'give'),
605 605
 							'type'    => 'text'
606 606
 						),
607 607
 						array(
608 608
 							'id'      => 'donation_receipt',
609
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
609
+							'name'    => esc_html__('Donation Receipt', 'give'),
610 610
 							'desc'    => sprintf(
611 611
 							/* translators: %s: emails tags list */
612
-								esc_html__( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ),
613
-								'<br/>' . give_get_emails_tags_list()
612
+								esc_html__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'),
613
+								'<br/>'.give_get_emails_tags_list()
614 614
 							),
615 615
 							'type'    => 'wysiwyg',
616 616
 							'default' => give_get_default_donation_receipt_email()
617 617
 						),
618 618
 						array(
619
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
619
+							'name' => esc_html__('New Donation Notification', 'give'),
620 620
 							'desc' => '',
621 621
 							'id'   => 'give_title_email_settings_3',
622 622
 							'type' => 'give_title'
623 623
 						),
624 624
 						array(
625 625
 							'id'      => 'donation_notification_subject',
626
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
627
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
626
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
627
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
628 628
 							'type'    => 'text',
629
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
629
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
630 630
 						),
631 631
 						array(
632 632
 							'id'      => 'donation_notification',
633
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
633
+							'name'    => esc_html__('Donation Notification', 'give'),
634 634
 							'desc'    => sprintf(
635 635
 							/* translators: %s: emails tags list */
636
-								esc_html__( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ),
637
-								'<br/>' . give_get_emails_tags_list()
636
+								esc_html__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'),
637
+								'<br/>'.give_get_emails_tags_list()
638 638
 							),
639 639
 							'type'    => 'wysiwyg',
640 640
 							'default' => give_get_default_donation_notification_email()
641 641
 						),
642 642
 						array(
643 643
 							'id'      => 'admin_notice_emails',
644
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
645
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
644
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
645
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
646 646
 							'type'    => 'textarea',
647
-							'default' => get_bloginfo( 'admin_email' )
647
+							'default' => get_bloginfo('admin_email')
648 648
 						),
649 649
 						array(
650 650
 							'id'   => 'disable_admin_notices',
651
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
652
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
651
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
652
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
653 653
 							'type' => 'checkbox'
654 654
 						)
655 655
 					)
@@ -658,99 +658,99 @@  discard block
 block discarded – undo
658 658
 			/** Extension Settings */
659 659
 			'addons'      => array(
660 660
 				'id'         => 'addons',
661
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
662
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
663
-				'fields'     => apply_filters( 'give_settings_addons', array()
661
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
662
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
663
+				'fields'     => apply_filters('give_settings_addons', array()
664 664
 				)
665 665
 			),
666 666
 			/** Licenses Settings */
667 667
 			'licenses'    => array(
668 668
 				'id'         => 'licenses',
669
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
670
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
671
-				'fields'     => apply_filters( 'give_settings_licenses', array()
669
+				'give_title' => esc_html__('Give Licenses', 'give'),
670
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
671
+				'fields'     => apply_filters('give_settings_licenses', array()
672 672
 				)
673 673
 			),
674 674
 			/** Advanced Options */
675 675
 			'advanced'    => array(
676 676
 				'id'         => 'advanced_options',
677
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
678
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
679
-				'fields'     => apply_filters( 'give_settings_advanced', array(
677
+				'give_title' => esc_html__('Advanced Options', 'give'),
678
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
679
+				'fields'     => apply_filters('give_settings_advanced', array(
680 680
 						array(
681
-							'name' => esc_html__( 'Access Control', 'give' ),
681
+							'name' => esc_html__('Access Control', 'give'),
682 682
 							'desc' => '',
683 683
 							'id'   => 'give_title_session_control_1',
684 684
 							'type' => 'give_title'
685 685
 						),
686 686
 						array(
687 687
 							'id'      => 'session_lifetime',
688
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
689
-							'desc'    => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
688
+							'name'    => esc_html__('Session Lifetime', 'give'),
689
+							'desc'    => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
690 690
 							'type'    => 'select',
691 691
 							'options' => array(
692
-								'86400'  => esc_html__( '24 Hours', 'give' ),
693
-								'172800' => esc_html__( '48 Hours', 'give' ),
694
-								'259200' => esc_html__( '72 Hours', 'give' ),
695
-								'604800' => esc_html__( '1 Week', 'give' ),
692
+								'86400'  => esc_html__('24 Hours', 'give'),
693
+								'172800' => esc_html__('48 Hours', 'give'),
694
+								'259200' => esc_html__('72 Hours', 'give'),
695
+								'604800' => esc_html__('1 Week', 'give'),
696 696
 							)
697 697
 						),
698 698
 						array(
699
-							'name' => esc_html__( 'Email Access', 'give' ),
700
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
699
+							'name' => esc_html__('Email Access', 'give'),
700
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
701 701
 							'id'   => 'email_access',
702 702
 							'type' => 'checkbox',
703 703
 						),
704 704
 						array(
705 705
 							'id'      => 'recaptcha_key',
706
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
706
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
707 707
 							/* translators: %s: https://www.google.com/recaptcha/ */
708
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
708
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
709 709
 							'default' => '',
710 710
 							'type'    => 'text'
711 711
 						),
712 712
 						array(
713 713
 							'id'      => 'recaptcha_secret',
714
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
715
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
714
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
715
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
716 716
 							'default' => '',
717 717
 							'type'    => 'text'
718 718
 						),
719 719
 						array(
720
-							'name' => esc_html__( 'Data Control', 'give' ),
720
+							'name' => esc_html__('Data Control', 'give'),
721 721
 							'desc' => '',
722 722
 							'id'   => 'give_title_data_control_2',
723 723
 							'type' => 'give_title'
724 724
 						),
725 725
 						array(
726
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
727
-							'desc' => esc_html__( 'When the plugin is deleted, completely remove all Give data.', 'give' ),
726
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
727
+							'desc' => esc_html__('When the plugin is deleted, completely remove all Give data.', 'give'),
728 728
 							'id'   => 'uninstall_on_delete',
729 729
 							'type' => 'checkbox'
730 730
 						),
731 731
 						array(
732
-							'name' => esc_html__( 'Filter Control', 'give' ),
732
+							'name' => esc_html__('Filter Control', 'give'),
733 733
 							'desc' => '',
734 734
 							'id'   => 'give_title_filter_control',
735 735
 							'type' => 'give_title'
736 736
 						),
737 737
 						array(
738 738
 							/* translators: %s: the_content */
739
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
739
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
740 740
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
741
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
741
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
742 742
 							'id'   => 'disable_the_content_filter',
743 743
 							'type' => 'checkbox'
744 744
 						),
745 745
 						array(
746
-							'name' => esc_html__( 'Script Loading', 'give' ),
746
+							'name' => esc_html__('Script Loading', 'give'),
747 747
 							'desc' => '',
748 748
 							'id'   => 'give_title_script_control',
749 749
 							'type' => 'give_title'
750 750
 						),
751 751
 						array(
752
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
753
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
752
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
753
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
754 754
 							'id'   => 'scripts_footer',
755 755
 							'type' => 'checkbox'
756 756
 						)
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 			/** API Settings */
761 761
 			'api'         => array(
762 762
 				'id'         => 'api',
763
-				'give_title' => esc_html__( 'API', 'give' ),
764
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
763
+				'give_title' => esc_html__('API', 'give'),
764
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
765 765
 				'show_names' => false, // Hide field names on the left
766
-				'fields'     => apply_filters( 'give_settings_system', array(
766
+				'fields'     => apply_filters('give_settings_system', array(
767 767
 						array(
768 768
 							'id'   => 'api',
769
-							'name' => esc_html__( 'API', 'give' ),
769
+							'name' => esc_html__('API', 'give'),
770 770
 							'type' => 'api'
771 771
 						)
772 772
 					)
@@ -775,13 +775,13 @@  discard block
 block discarded – undo
775 775
 			/** Licenses Settings */
776 776
 			'system_info' => array(
777 777
 				'id'         => 'system_info',
778
-				'give_title' => esc_html__( 'System Info', 'give' ),
779
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
780
-				'fields'     => apply_filters( 'give_settings_system', array(
778
+				'give_title' => esc_html__('System Info', 'give'),
779
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
780
+				'fields'     => apply_filters('give_settings_system', array(
781 781
 						array(
782 782
 							'id'   => 'system-info-textarea',
783
-							'name' => esc_html__( 'System Info', 'give' ),
784
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
783
+							'name' => esc_html__('System Info', 'give'),
784
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
785 785
 							'type' => 'system_info'
786 786
 						)
787 787
 					)
@@ -790,15 +790,15 @@  discard block
 block discarded – undo
790 790
 		);
791 791
 
792 792
 		//Return all settings array if no active tab
793
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
793
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
794 794
 
795
-			return apply_filters( 'give_registered_settings', $give_settings );
795
+			return apply_filters('give_registered_settings', $give_settings);
796 796
 
797 797
 		}
798 798
 
799 799
 
800 800
 		// Add other tabs and settings fields as needed
801
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
801
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
802 802
 
803 803
 	}
804 804
 
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
 	 */
808 808
 	public function settings_notices() {
809 809
 
810
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
810
+		if ( ! isset($_POST['give_settings_saved'])) {
811 811
 			return;
812 812
 		}
813 813
 
814
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
814
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
815 815
 
816 816
 	}
817 817
 
@@ -826,17 +826,17 @@  discard block
 block discarded – undo
826 826
 	 * @return mixed         Field value or exception is thrown.
827 827
 	 * @throws Exception     Throws an exception if the field is invalid.
828 828
 	 */
829
-	public function __get( $field ) {
829
+	public function __get($field) {
830 830
 
831 831
 		// Allowed fields to retrieve
832
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
832
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
833 833
 			return $this->{$field};
834 834
 		}
835
-		if ( 'option_metabox' === $field ) {
835
+		if ('option_metabox' === $field) {
836 836
 			return $this->option_metabox();
837 837
 		}
838 838
 
839
-		throw new Exception( sprintf( esc_html__( 'Invalid property: %s', 'give' ), $field ) );
839
+		throw new Exception(sprintf(esc_html__('Invalid property: %s', 'give'), $field));
840 840
 	}
841 841
 
842 842
 
@@ -854,12 +854,12 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return mixed        Option value
856 856
  */
857
-function give_get_option( $key = '', $default = false ) {
857
+function give_get_option($key = '', $default = false) {
858 858
 	$give_options = give_get_settings();
859
-	$value        = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
860
-	$value        = apply_filters( 'give_get_option', $value, $key, $default );
859
+	$value        = ! empty($give_options[$key]) ? $give_options[$key] : $default;
860
+	$value        = apply_filters('give_get_option', $value, $key, $default);
861 861
 
862
-	return apply_filters( "give_get_option_{$key}", $value, $key, $default );
862
+	return apply_filters("give_get_option_{$key}", $value, $key, $default);
863 863
 }
864 864
 
865 865
 
@@ -877,33 +877,33 @@  discard block
 block discarded – undo
877 877
  *
878 878
  * @return boolean True if updated, false if not.
879 879
  */
880
-function give_update_option( $key = '', $value = false ) {
880
+function give_update_option($key = '', $value = false) {
881 881
 
882 882
 	// If no key, exit
883
-	if ( empty( $key ) ) {
883
+	if (empty($key)) {
884 884
 		return false;
885 885
 	}
886 886
 
887
-	if ( empty( $value ) ) {
888
-		$remove_option = give_delete_option( $key );
887
+	if (empty($value)) {
888
+		$remove_option = give_delete_option($key);
889 889
 
890 890
 		return $remove_option;
891 891
 	}
892 892
 
893 893
 	// First let's grab the current settings
894
-	$options = get_option( 'give_settings' );
894
+	$options = get_option('give_settings');
895 895
 
896 896
 	// Let's let devs alter that value coming in
897
-	$value = apply_filters( 'give_update_option', $value, $key );
897
+	$value = apply_filters('give_update_option', $value, $key);
898 898
 
899 899
 	// Next let's try to update the value
900
-	$options[ $key ] = $value;
901
-	$did_update      = update_option( 'give_settings', $options );
900
+	$options[$key] = $value;
901
+	$did_update      = update_option('give_settings', $options);
902 902
 
903 903
 	// If it updated, let's update the global variable
904
-	if ( $did_update ) {
904
+	if ($did_update) {
905 905
 		global $give_options;
906
-		$give_options[ $key ] = $value;
906
+		$give_options[$key] = $value;
907 907
 	}
908 908
 
909 909
 	return $did_update;
@@ -922,27 +922,27 @@  discard block
 block discarded – undo
922 922
  *
923 923
  * @return boolean True if updated, false if not.
924 924
  */
925
-function give_delete_option( $key = '' ) {
925
+function give_delete_option($key = '') {
926 926
 
927 927
 	// If no key, exit
928
-	if ( empty( $key ) ) {
928
+	if (empty($key)) {
929 929
 		return false;
930 930
 	}
931 931
 
932 932
 	// First let's grab the current settings
933
-	$options = get_option( 'give_settings' );
933
+	$options = get_option('give_settings');
934 934
 
935 935
 	// Next let's try to update the value
936
-	if ( isset( $options[ $key ] ) ) {
936
+	if (isset($options[$key])) {
937 937
 
938
-		unset( $options[ $key ] );
938
+		unset($options[$key]);
939 939
 
940 940
 	}
941 941
 
942
-	$did_update = update_option( 'give_settings', $options );
942
+	$did_update = update_option('give_settings', $options);
943 943
 
944 944
 	// If it updated, let's update the global variable
945
-	if ( $did_update ) {
945
+	if ($did_update) {
946 946
 		global $give_options;
947 947
 		$give_options = $options;
948 948
 	}
@@ -961,9 +961,9 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function give_get_settings() {
963 963
 
964
-	$settings = get_option( 'give_settings' );
964
+	$settings = get_option('give_settings');
965 965
 
966
-	return (array) apply_filters( 'give_get_settings', $settings );
966
+	return (array) apply_filters('give_get_settings', $settings);
967 967
 
968 968
 }
969 969
 
@@ -981,25 +981,25 @@  discard block
 block discarded – undo
981 981
  *
982 982
  * @return array
983 983
  */
984
-function give_settings_array_insert( $array, $position, $insert ) {
985
-	if ( is_int( $position ) ) {
986
-		array_splice( $array, $position, 0, $insert );
984
+function give_settings_array_insert($array, $position, $insert) {
985
+	if (is_int($position)) {
986
+		array_splice($array, $position, 0, $insert);
987 987
 	} else {
988 988
 
989
-		foreach ( $array as $index => $subarray ) {
990
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
989
+		foreach ($array as $index => $subarray) {
990
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
991 991
 				$pos = $index;
992 992
 			}
993 993
 		}
994 994
 
995
-		if ( ! isset( $pos ) ) {
995
+		if ( ! isset($pos)) {
996 996
 			return $array;
997 997
 		}
998 998
 
999 999
 		$array = array_merge(
1000
-			array_slice( $array, 0, $pos ),
1000
+			array_slice($array, 0, $pos),
1001 1001
 			$insert,
1002
-			array_slice( $array, $pos )
1002
+			array_slice($array, $pos)
1003 1003
 		);
1004 1004
 	}
1005 1005
 
@@ -1022,31 +1022,31 @@  discard block
 block discarded – undo
1022 1022
  *
1023 1023
  * @return void
1024 1024
  */
1025
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1025
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1026 1026
 
1027 1027
 	$id                = $field_type_object->field->args['id'];
1028 1028
 	$field_description = $field_type_object->field->args['desc'];
1029
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1029
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1030 1030
 
1031 1031
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1032 1032
 
1033
-	foreach ( $gateways as $key => $option ) :
1033
+	foreach ($gateways as $key => $option) :
1034 1034
 
1035
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1035
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1036 1036
 			$enabled = '1';
1037 1037
 		} else {
1038 1038
 			$enabled = null;
1039 1039
 		}
1040 1040
 
1041
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1042
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1041
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1042
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1043 1043
 
1044 1044
 	endforeach;
1045 1045
 
1046 1046
 	echo '</ul>';
1047 1047
 
1048
-	if ( $field_description ) {
1049
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1048
+	if ($field_description) {
1049
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1050 1050
 	}
1051 1051
 
1052 1052
 }
@@ -1062,31 +1062,31 @@  discard block
 block discarded – undo
1062 1062
  *
1063 1063
  * @return void
1064 1064
  */
1065
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1065
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1066 1066
 
1067 1067
 	$id                = $field_type_object->field->args['id'];
1068 1068
 	$field_description = $field_type_object->field->args['desc'];
1069 1069
 	$gateways          = give_get_enabled_payment_gateways();
1070 1070
 
1071
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1071
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1072 1072
 
1073 1073
 	//Add a field to the Give Form admin single post view of this field
1074
-	if ( $field_type_object->field->object_type === 'post' ) {
1075
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1074
+	if ($field_type_object->field->object_type === 'post') {
1075
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1076 1076
 	}
1077 1077
 
1078
-	foreach ( $gateways as $key => $option ) :
1078
+	foreach ($gateways as $key => $option) :
1079 1079
 
1080
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1080
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1081 1081
 
1082 1082
 
1083
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1083
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1084 1084
 
1085 1085
 	endforeach;
1086 1086
 
1087 1087
 	echo '</select>';
1088 1088
 
1089
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1089
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1090 1090
 
1091 1091
 }
1092 1092
 
@@ -1101,13 +1101,13 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return void
1103 1103
  */
1104
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1104
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1105 1105
 
1106 1106
 	$id                = $field_type_object->field->args['id'];
1107 1107
 	$title             = $field_type_object->field->args['name'];
1108 1108
 	$field_description = $field_type_object->field->args['desc'];
1109 1109
 
1110
-	echo '<hr>' . $field_description;
1110
+	echo '<hr>'.$field_description;
1111 1111
 
1112 1112
 }
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
  *
1123 1123
  * @return void
1124 1124
  */
1125
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1125
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1126 1126
 
1127 1127
 	$id                = $field_type_object->field->args['id'];
1128 1128
 	$title             = $field_type_object->field->args['name'];
@@ -1142,25 +1142,25 @@  discard block
 block discarded – undo
1142 1142
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1143 1143
  * @return array An array of options that matches the CMB2 options array
1144 1144
  */
1145
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1145
+function give_cmb2_get_post_options($query_args, $force = false) {
1146 1146
 
1147
-	$post_options = array( '' => '' ); // Blank option
1147
+	$post_options = array('' => ''); // Blank option
1148 1148
 
1149
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1149
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1150 1150
 		return $post_options;
1151 1151
 	}
1152 1152
 
1153
-	$args = wp_parse_args( $query_args, array(
1153
+	$args = wp_parse_args($query_args, array(
1154 1154
 		'post_type'   => 'page',
1155 1155
 		'numberposts' => 10,
1156
-	) );
1156
+	));
1157 1157
 
1158
-	$posts = get_posts( $args );
1158
+	$posts = get_posts($args);
1159 1159
 
1160
-	if ( $posts ) {
1161
-		foreach ( $posts as $post ) {
1160
+	if ($posts) {
1161
+		foreach ($posts as $post) {
1162 1162
 
1163
-			$post_options[ $post->ID ] = $post->post_title;
1163
+			$post_options[$post->ID] = $post->post_title;
1164 1164
 
1165 1165
 		}
1166 1166
 	}
@@ -1184,21 +1184,21 @@  discard block
 block discarded – undo
1184 1184
 	$get_sizes = get_intermediate_image_sizes();
1185 1185
 
1186 1186
 	// check whether intermediate image sizes exist first
1187
-	if ( empty( $get_sizes ) ) {
1188
-		$get_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' );
1187
+	if (empty($get_sizes)) {
1188
+		$get_sizes = array('thumbnail', 'medium', 'medium_large', 'large');
1189 1189
 	}
1190 1190
 
1191
-	foreach ( $get_sizes as $_size ) {
1191
+	foreach ($get_sizes as $_size) {
1192 1192
 
1193
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1194
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1195
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1196
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1193
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1194
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1195
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1196
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1197 1197
 		}
1198 1198
 
1199 1199
 	}
1200 1200
 
1201
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1201
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1202 1202
 }
1203 1203
 
1204 1204
 
@@ -1213,18 +1213,18 @@  discard block
 block discarded – undo
1213 1213
  *
1214 1214
  * @return void
1215 1215
  */
1216
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1216
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1217 1217
 	/* @var CMB2_Types $field_type_object */
1218 1218
 
1219 1219
 	$id                 = $field_type_object->field->args['id'];
1220 1220
 	$field_description  = $field_type_object->field->args['desc'];
1221 1221
 	$license            = $field_type_object->field->args['options']['license'];
1222 1222
 	$license_key        = $escaped_value;
1223
-	$is_license_key     = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) );
1224
-	$is_valid_license   = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) );
1223
+	$is_license_key     = apply_filters('give_is_license_key', (is_object($license) && ! empty($license)));
1224
+	$is_valid_license   = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license));
1225 1225
 	$shortname          = $field_type_object->field->args['options']['shortname'];
1226 1226
 	$field_classes      = 'regular-text give-license-field';
1227
-	$type               = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password';
1227
+	$type               = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password';
1228 1228
 	$custom_html        = '';
1229 1229
 	$value              = $escaped_value;
1230 1230
 	$messages           = array();
@@ -1236,17 +1236,17 @@  discard block
 block discarded – undo
1236 1236
 
1237 1237
 	// By default query on edd api url will return license object which contain status and message property, this can break below functionality.
1238 1238
 	// To combat that check if status is set to error or not, if yes then set $is_license_key to false.
1239
-	if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) {
1239
+	if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) {
1240 1240
 		$is_license_key = false;
1241 1241
 	}
1242 1242
 
1243 1243
 
1244 1244
 	// Check if current license is part of subscription or not.
1245
-	$subscriptions = get_option( 'give_subscriptions' );
1245
+	$subscriptions = get_option('give_subscriptions');
1246 1246
 
1247
-	if ( $is_license_key && $subscriptions ) {
1248
-		foreach ( $subscriptions as $subscription ) {
1249
-			if ( in_array( $license_key, $subscription['licenses'] ) ) {
1247
+	if ($is_license_key && $subscriptions) {
1248
+		foreach ($subscriptions as $subscription) {
1249
+			if (in_array($license_key, $subscription['licenses'])) {
1250 1250
 				$is_in_subscription = $subscription['id'];
1251 1251
 				break;
1252 1252
 			}
@@ -1254,122 +1254,122 @@  discard block
 block discarded – undo
1254 1254
 	}
1255 1255
 
1256 1256
 
1257
-	if ( $is_license_key ) {
1258
-		if ( $is_in_subscription ) {
1259
-			$subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] );
1260
-			$subscription_status  = esc_html__( 'renew', 'give' );
1257
+	if ($is_license_key) {
1258
+		if ($is_in_subscription) {
1259
+			$subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']);
1260
+			$subscription_status  = esc_html__('renew', 'give');
1261 1261
 
1262
-			if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) {
1263
-				$subscription_status = esc_html__( 'expire', 'give' );
1262
+			if (('active' !== $subscriptions[$is_in_subscription]['status'])) {
1263
+				$subscription_status = esc_html__('expire', 'give');
1264 1264
 			}
1265 1265
 
1266
-			if ( $subscription_expires < current_time( 'timestamp', 1 ) ) {
1267
-				$messages[]     = sprintf(
1268
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ),
1269
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1270
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1271
-					$checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1266
+			if ($subscription_expires < current_time('timestamp', 1)) {
1267
+				$messages[] = sprintf(
1268
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) expired. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'),
1269
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1270
+					$subscriptions[$is_in_subscription]['payment_id'],
1271
+					$checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1272 1272
 				);
1273 1273
 				$license_status = 'license-expired';
1274
-			} elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) {
1274
+			} elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) {
1275 1275
 				$messages[]     = sprintf(
1276
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give' ),
1277
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1278
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1276
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s in %s.', 'give'),
1277
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1278
+					$subscriptions[$is_in_subscription]['payment_id'],
1279 1279
 					$subscription_status,
1280
-					human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) )
1280
+					human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires']))
1281 1281
 				);
1282 1282
 				$license_status = 'license-expires-soon';
1283 1283
 			} else {
1284 1284
 				$messages[]     = sprintf(
1285
-					__( 'Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give' ),
1286
-					urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ),
1287
-					$subscriptions[ $is_in_subscription ]['payment_id'],
1285
+					__('Your subscription (<a href="%s" target="_blank">#%d</a>) will %s on %s.', 'give'),
1286
+					urldecode($subscriptions[$is_in_subscription]['invoice_url']),
1287
+					$subscriptions[$is_in_subscription]['payment_id'],
1288 1288
 					$subscription_status,
1289
-					date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) )
1289
+					date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp')))
1290 1290
 				);
1291 1291
 				$license_status = 'license-expiration-date';
1292 1292
 			}
1293 1293
 
1294 1294
 
1295
-		} elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) {
1295
+		} elseif (empty($license->success) && property_exists($license, 'error')) {
1296 1296
 
1297 1297
 			// activate_license 'invalid' on anything other than valid, so if there was an error capture it
1298
-			switch ( $license->error ) {
1298
+			switch ($license->error) {
1299 1299
 				case 'expired' :
1300
-					error_log( print_r( $license->error, true ) . "\n", 3, WP_CONTENT_DIR . '/debug_new.log' );
1300
+					error_log(print_r($license->error, true)."\n", 3, WP_CONTENT_DIR.'/debug_new.log');
1301 1301
 					$class          = $license->error;
1302 1302
 					$messages[]     = sprintf(
1303
-						__( 'Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ),
1304
-						date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1305
-						$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1303
+						__('Your license key expired on %s. Please <a href="%s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'),
1304
+						date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1305
+						$checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired'
1306 1306
 					);
1307
-					$license_status = 'license-' . $class;
1307
+					$license_status = 'license-'.$class;
1308 1308
 					break;
1309 1309
 
1310 1310
 				case 'missing' :
1311 1311
 					$class          = $license->error;
1312 1312
 					$messages[]     = sprintf(
1313
-						__( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ),
1314
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1313
+						__('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'),
1314
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing'
1315 1315
 					);
1316
-					$license_status = 'license-' . $class;
1316
+					$license_status = 'license-'.$class;
1317 1317
 					break;
1318 1318
 
1319 1319
 				case 'invalid' :
1320 1320
 					$class          = $license->error;
1321 1321
 					$messages[]     = sprintf(
1322
-						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1322
+						__('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1323 1323
 						$addon_name,
1324
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1324
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1325 1325
 					);
1326
-					$license_status = 'license-' . $class;
1326
+					$license_status = 'license-'.$class;
1327 1327
 					break;
1328 1328
 
1329 1329
 				case 'site_inactive' :
1330 1330
 					$class          = $license->error;
1331 1331
 					$messages[]     = sprintf(
1332
-						__( 'Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ),
1332
+						__('Your %s is not active for this URL. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'),
1333 1333
 						$addon_name,
1334
-						$account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1334
+						$account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid'
1335 1335
 					);
1336
-					$license_status = 'license-' . $class;
1336
+					$license_status = 'license-'.$class;
1337 1337
 					break;
1338 1338
 
1339 1339
 				case 'item_name_mismatch' :
1340 1340
 					$class          = $license->error;
1341
-					$messages[]     = sprintf( __( 'This license %s does not belong to %s.', 'give' ), $value, $addon_name );
1342
-					$license_status = 'license-' . $class;
1341
+					$messages[]     = sprintf(__('This license %s does not belong to %s.', 'give'), $value, $addon_name);
1342
+					$license_status = 'license-'.$class;
1343 1343
 					break;
1344 1344
 
1345 1345
 				case 'no_activations_left':
1346 1346
 					$class          = $license->error;
1347
-					$messages[]     = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link );
1348
-					$license_status = 'license-' . $class;
1347
+					$messages[]     = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link);
1348
+					$license_status = 'license-'.$class;
1349 1349
 					break;
1350 1350
 			}
1351 1351
 		} else {
1352
-			switch ( $license->license ) {
1352
+			switch ($license->license) {
1353 1353
 				case 'valid' :
1354 1354
 				default:
1355 1355
 					$class      = 'valid';
1356
-					$now        = current_time( 'timestamp' );
1357
-					$expiration = strtotime( $license->expires, current_time( 'timestamp' ) );
1356
+					$now        = current_time('timestamp');
1357
+					$expiration = strtotime($license->expires, current_time('timestamp'));
1358 1358
 
1359
-					if ( 'lifetime' === $license->expires ) {
1360
-						$messages[]     = esc_html__( 'License key never expires.', 'give' );
1359
+					if ('lifetime' === $license->expires) {
1360
+						$messages[]     = esc_html__('License key never expires.', 'give');
1361 1361
 						$license_status = 'license-lifetime-notice';
1362
-					} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
1362
+					} elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) {
1363 1363
 						$messages[]     = sprintf(
1364
-							__( 'Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ),
1365
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
1366
-							$checkout_page_link . '?edd_license_key=' . $value . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1364
+							__('Your license key expires soon! It expires on %s. <a href="%s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'),
1365
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))),
1366
+							$checkout_page_link.'?edd_license_key='.$value.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew'
1367 1367
 						);
1368 1368
 						$license_status = 'license-expires-soon';
1369 1369
 					} else {
1370 1370
 						$messages[]     = sprintf(
1371
-							__( 'Your license key expires on %s.', 'give' ),
1372
-							date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) )
1371
+							__('Your license key expires on %s.', 'give'),
1372
+							date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp')))
1373 1373
 						);
1374 1374
 						$license_status = 'license-expiration-date';
1375 1375
 					}
@@ -1377,8 +1377,8 @@  discard block
 block discarded – undo
1377 1377
 			}
1378 1378
 		}
1379 1379
 	} else {
1380
-		$messages[]     = sprintf(
1381
-			__( 'To receive updates, please enter your valid %s license key.', 'give' ),
1380
+		$messages[] = sprintf(
1381
+			__('To receive updates, please enter your valid %s license key.', 'give'),
1382 1382
 			$addon_name
1383 1383
 		);
1384 1384
 		$license_status = 'inactive';
@@ -1386,54 +1386,54 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
 
1388 1388
 	// Add class for input field if license is active.
1389
-	if ( $is_valid_license ) {
1389
+	if ($is_valid_license) {
1390 1390
 		$field_classes .= ' give-license-active';
1391 1391
 	}
1392 1392
 
1393 1393
 	// Get input filed html.
1394
-	$input_field_html = $field_type_object->input( array(
1394
+	$input_field_html = $field_type_object->input(array(
1395 1395
 		'class' => $field_classes,
1396 1396
 		'type'  => $type
1397
-	) );
1397
+	));
1398 1398
 
1399 1399
 	// If license is active so show deactivate button.
1400
-	if ( $is_valid_license ) {
1400
+	if ($is_valid_license) {
1401 1401
 
1402 1402
 		// Get input filed html.
1403
-		$input_field_html = $field_type_object->input( array(
1403
+		$input_field_html = $field_type_object->input(array(
1404 1404
 			'class'    => $field_classes,
1405 1405
 			'type'     => $type,
1406 1406
 			'readonly' => 'readonly',
1407
-		) );
1407
+		));
1408 1408
 
1409
-		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1409
+		$custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1410 1410
 
1411 1411
 
1412 1412
 	}
1413 1413
 
1414 1414
 	// Field description.
1415
-	$custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1415
+	$custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1416 1416
 
1417 1417
 	// If no messages found then inform user that to get updated in future register yourself.
1418
-	if ( empty( $messages ) ) {
1419
-		$messages[] = apply_filters( "{$shortname}_default_addon_notice", esc_html__( 'To receive updates, please enter your valid license key.', 'give' ) );
1418
+	if (empty($messages)) {
1419
+		$messages[] = apply_filters("{$shortname}_default_addon_notice", esc_html__('To receive updates, please enter your valid license key.', 'give'));
1420 1420
 	}
1421 1421
 
1422
-	foreach ( $messages as $message ) {
1423
-		$custom_html .= '<div class="give-license-notice give-' . $license_status . '">';
1424
-		$custom_html .= '<p>' . $message . '</p>';
1422
+	foreach ($messages as $message) {
1423
+		$custom_html .= '<div class="give-license-notice give-'.$license_status.'">';
1424
+		$custom_html .= '<p>'.$message.'</p>';
1425 1425
 		$custom_html .= '</div>';
1426 1426
 	}
1427 1427
 
1428 1428
 
1429 1429
 	// Field html.
1430
-	$custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object );
1430
+	$custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object);
1431 1431
 
1432 1432
 	// Nonce.
1433
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1433
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1434 1434
 
1435 1435
 	// Print field html.
1436
-	echo '<div>' . $custom_html . '</div>';
1436
+	echo '<div>'.$custom_html.'</div>';
1437 1437
 }
1438 1438
 
1439 1439
 
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
  */
1446 1446
 function give_api_callback() {
1447 1447
 
1448
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1448
+	if ( ! current_user_can('manage_give_settings')) {
1449 1449
 		return;
1450 1450
 	}
1451 1451
 
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
 	 *
1455 1455
 	 * @since 1.0
1456 1456
 	 */
1457
-	do_action( 'give_tools_api_keys_before' );
1457
+	do_action('give_tools_api_keys_before');
1458 1458
 
1459
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1459
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1460 1460
 
1461 1461
 	$api_keys_table = new Give_API_Keys_Table();
1462 1462
 	$api_keys_table->prepare_items();
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
 	<span class="cmb2-metabox-description api-description">
1466 1466
 		<?php echo sprintf(
1467 1467
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1468
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1469
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1470
-			esc_url( 'https://givewp.com/addons/zapier/' )
1468
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1469
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1470
+			esc_url('https://givewp.com/addons/zapier/')
1471 1471
 		); ?>
1472 1472
 	</span>
1473 1473
 	<?php
@@ -1477,10 +1477,10 @@  discard block
 block discarded – undo
1477 1477
 	 *
1478 1478
 	 * @since 1.0
1479 1479
 	 */
1480
-	do_action( 'give_tools_api_keys_after' );
1480
+	do_action('give_tools_api_keys_after');
1481 1481
 }
1482 1482
 
1483
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1483
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1484 1484
 
1485 1485
 /**
1486 1486
  * Hook Callback
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
  *
1494 1494
  * @return void
1495 1495
  */
1496
-function give_hook_callback( $args ) {
1496
+function give_hook_callback($args) {
1497 1497
 
1498 1498
 	$id = $args['id'];
1499 1499
 
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 	 *
1503 1503
 	 * @since 1.0
1504 1504
 	 */
1505
-	do_action( "give_{$id}" );
1505
+	do_action("give_{$id}");
1506 1506
 
1507 1507
 }
1508 1508
 
@@ -1514,10 +1514,10 @@  discard block
 block discarded – undo
1514 1514
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1515 1515
  */
1516 1516
 
1517
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1518
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1519
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1520
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1521
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1522
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1517
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1518
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1519
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1520
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1521
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1522
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1523 1523
 }
1524 1524
\ No newline at end of file
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        esc_html_e( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		esc_html_e( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 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
 
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
37 37
 			}
38 38
 
39 39
 		} else {
40 40
 
41
-			if ( $airplane->check_status() == 'on' ) {
41
+			if ($airplane->check_status() == 'on') {
42 42
 				return true;
43 43
 			}
44 44
 		}
45 45
 	}
46 46
 
47
-	add_filter( 'block_local_requests', '__return_false' );
47
+	add_filter('block_local_requests', '__return_false');
48 48
 
49
-	if ( get_transient( '_give_ajax_works' ) ) {
49
+	if (get_transient('_give_ajax_works')) {
50 50
 		return true;
51 51
 	}
52 52
 
@@ -58,35 +58,35 @@  discard block
 block discarded – undo
58 58
 		)
59 59
 	);
60 60
 
61
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
61
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
84 84
 		}
85 85
 
86 86
 	}
87 87
 
88
-	if ( $works ) {
89
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
88
+	if ($works) {
89
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
90 90
 	}
91 91
 
92 92
 	return $works;
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
  * @return string
102 102
  */
103 103
 function give_get_ajax_url() {
104
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
104
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
105 105
 
106 106
 	$current_url = give_get_current_page_url();
107
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
107
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
108 108
 
109
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
110
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
109
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
110
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111 111
 	}
112 112
 
113
-	return apply_filters( 'give_ajax_url', $ajax_url );
113
+	return apply_filters('give_ajax_url', $ajax_url);
114 114
 }
115 115
 
116 116
 /**
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @since 1.7
128 128
 	 */
129
-	do_action( 'give_donation_form_login_fields' );
129
+	do_action('give_donation_form_login_fields');
130 130
 
131 131
 	give_die();
132 132
 }
133 133
 
134
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
134
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
135 135
 
136 136
 /**
137 137
  * Load Checkout Fields
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
  * @return void
142 142
  */
143 143
 function give_load_checkout_fields() {
144
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
144
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
145 145
 
146 146
 	ob_start();
147 147
 
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @since 1.7
152 152
 	 */
153
-	do_action( 'give_donation_form_register_login_fields', $form_id );
153
+	do_action('give_donation_form_register_login_fields', $form_id);
154 154
 
155 155
 	$fields = ob_get_clean();
156 156
 
157
-	wp_send_json( array(
158
-		'fields' => wp_json_encode( $fields ),
159
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
160
-	) );
157
+	wp_send_json(array(
158
+		'fields' => wp_json_encode($fields),
159
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
160
+	));
161 161
 }
162 162
 
163
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
164
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
163
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
164
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
165 165
 
166 166
 /**
167 167
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
  * @return void
172 172
  */
173 173
 function give_ajax_get_form_title() {
174
-	if ( isset( $_POST['form_id'] ) ) {
175
-		$title = get_the_title( $_POST['form_id'] );
176
-		if ( $title ) {
174
+	if (isset($_POST['form_id'])) {
175
+		$title = get_the_title($_POST['form_id']);
176
+		if ($title) {
177 177
 			echo $title;
178 178
 		} else {
179 179
 			echo 'fail';
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
 	give_die();
183 183
 }
184 184
 
185
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
186
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
185
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
186
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
187 187
 
188 188
 /**
189 189
  * Retrieve a states drop down
@@ -194,23 +194,23 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_ajax_get_states_field() {
196 196
 
197
-	if ( empty( $_POST['country'] ) ) {
197
+	if (empty($_POST['country'])) {
198 198
 		$_POST['country'] = give_get_country();
199 199
 	}
200
-	$states = give_get_states( $_POST['country'] );
200
+	$states = give_get_states($_POST['country']);
201 201
 
202
-	if ( ! empty( $states ) ) {
202
+	if ( ! empty($states)) {
203 203
 
204 204
 		$args = array(
205 205
 			'name'             => $_POST['field_name'],
206 206
 			'id'               => $_POST['field_name'],
207
-			'class'            => $_POST['field_name'] . '  give-select',
208
-			'options'          => give_get_states( $_POST['country'] ),
207
+			'class'            => $_POST['field_name'].'  give-select',
208
+			'options'          => give_get_states($_POST['country']),
209 209
 			'show_option_all'  => false,
210 210
 			'show_option_none' => false
211 211
 		);
212 212
 
213
-		$response = Give()->html->select( $args );
213
+		$response = Give()->html->select($args);
214 214
 
215 215
 	} else {
216 216
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 	give_die();
223 223
 }
224 224
 
225
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
226
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
225
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
226
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
227 227
 
228 228
 /**
229 229
  * Retrieve a states drop down
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 function give_ajax_form_search() {
236 236
 	global $wpdb;
237 237
 
238
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
238
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
239 239
 	$results = array();
240
-	if ( current_user_can( 'edit_give_forms' ) ) {
241
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
240
+	if (current_user_can('edit_give_forms')) {
241
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
242 242
 	} else {
243
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
243
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
244 244
 	}
245 245
 
246
-	if ( $items ) {
246
+	if ($items) {
247 247
 
248
-		foreach ( $items as $item ) {
248
+		foreach ($items as $item) {
249 249
 
250 250
 			$results[] = array(
251 251
 				'id'   => $item->ID,
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 
258 258
 		$items[] = array(
259 259
 			'id'   => 0,
260
-			'name' => esc_html__( 'No forms found.', 'give' )
260
+			'name' => esc_html__('No forms found.', 'give')
261 261
 		);
262 262
 
263 263
 	}
264 264
 
265
-	echo json_encode( $results );
265
+	echo json_encode($results);
266 266
 
267 267
 	give_die();
268 268
 }
269 269
 
270
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
271
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
270
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
271
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
272 272
 
273 273
 /**
274 274
  * Search the donors database via Ajax
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 function give_ajax_donor_search() {
281 281
 	global $wpdb;
282 282
 
283
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
283
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
284 284
 	$results = array();
285
-	if ( ! current_user_can( 'view_give_reports' ) ) {
285
+	if ( ! current_user_can('view_give_reports')) {
286 286
 		$donors = array();
287 287
 	} else {
288
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
288
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
289 289
 	}
290 290
 
291
-	if ( $donors ) {
291
+	if ($donors) {
292 292
 
293
-		foreach ( $donors as $donor ) {
293
+		foreach ($donors as $donor) {
294 294
 
295 295
 			$results[] = array(
296 296
 				'id'   => $donor->id,
297
-				'name' => $donor->name . '(' . $donor->email . ')'
297
+				'name' => $donor->name.'('.$donor->email.')'
298 298
 			);
299 299
 		}
300 300
 
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$donors[] = array(
304 304
 			'id'   => 0,
305
-			'name' => esc_html__( 'No donors found.', 'give' )
305
+			'name' => esc_html__('No donors found.', 'give')
306 306
 		);
307 307
 
308 308
 	}
309 309
 
310
-	echo json_encode( $results );
310
+	echo json_encode($results);
311 311
 
312 312
 	give_die();
313 313
 }
314 314
 
315
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
315
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
316 316
 
317 317
 
318 318
 /**
@@ -324,42 +324,42 @@  discard block
 block discarded – undo
324 324
  */
325 325
 function give_ajax_search_users() {
326 326
 
327
-	if ( current_user_can( 'manage_give_settings' ) ) {
327
+	if (current_user_can('manage_give_settings')) {
328 328
 
329
-		$search_query = trim( $_POST['user_name'] );
330
-		$exclude      = trim( $_POST['exclude'] );
329
+		$search_query = trim($_POST['user_name']);
330
+		$exclude      = trim($_POST['exclude']);
331 331
 
332 332
 		$get_users_args = array(
333 333
 			'number' => 9999,
334
-			'search' => $search_query . '*'
334
+			'search' => $search_query.'*'
335 335
 		);
336 336
 
337
-		if ( ! empty( $exclude ) ) {
338
-			$exclude_array             = explode( ',', $exclude );
337
+		if ( ! empty($exclude)) {
338
+			$exclude_array             = explode(',', $exclude);
339 339
 			$get_users_args['exclude'] = $exclude_array;
340 340
 		}
341 341
 
342
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
342
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
343 343
 
344
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
344
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
345 345
 
346 346
 		$user_list = '<ul>';
347
-		if ( $found_users ) {
348
-			foreach ( $found_users as $user ) {
349
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
347
+		if ($found_users) {
348
+			foreach ($found_users as $user) {
349
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
350 350
 			}
351 351
 		} else {
352
-			$user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>';
352
+			$user_list .= '<li>'.esc_html__('No users found.', 'give').'</li>';
353 353
 		}
354 354
 		$user_list .= '</ul>';
355 355
 
356
-		echo json_encode( array( 'results' => $user_list ) );
356
+		echo json_encode(array('results' => $user_list));
357 357
 
358 358
 	}
359 359
 	die();
360 360
 }
361 361
 
362
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
362
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
363 363
 
364 364
 
365 365
 /**
@@ -371,32 +371,32 @@  discard block
 block discarded – undo
371 371
  */
372 372
 function give_check_for_form_price_variations() {
373 373
 
374
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
375
-		die( '-1' );
374
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
375
+		die('-1');
376 376
 	}
377 377
 
378
-	$form_id = intval( $_POST['form_id'] );
379
-	$form    = get_post( $form_id );
378
+	$form_id = intval($_POST['form_id']);
379
+	$form    = get_post($form_id);
380 380
 
381
-	if ( 'give_forms' != $form->post_type ) {
382
-		die( '-2' );
381
+	if ('give_forms' != $form->post_type) {
382
+		die('-2');
383 383
 	}
384 384
 
385
-	if ( give_has_variable_prices( $form_id ) ) {
386
-		$variable_prices = give_get_variable_prices( $form_id );
385
+	if (give_has_variable_prices($form_id)) {
386
+		$variable_prices = give_get_variable_prices($form_id);
387 387
 
388
-		if ( $variable_prices ) {
388
+		if ($variable_prices) {
389 389
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
390 390
 
391
-			if ( isset( $_POST['all_prices'] ) ) {
392
-				$ajax_response .= '<option value="">' . esc_html__( 'All Levels', 'give' ) . '</option>';
391
+			if (isset($_POST['all_prices'])) {
392
+				$ajax_response .= '<option value="">'.esc_html__('All Levels', 'give').'</option>';
393 393
 			}
394 394
 
395
-			foreach ( $variable_prices as $key => $price ) {
395
+			foreach ($variable_prices as $key => $price) {
396 396
 
397
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
397
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
398 398
 				
399
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
399
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
400 400
 			}
401 401
 			$ajax_response .= '</select>';
402 402
 			echo $ajax_response;
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	give_die();
408 408
 }
409 409
 
410
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
410
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
411 411
 
412 412
 
413 413
 /**
@@ -418,30 +418,30 @@  discard block
 block discarded – undo
418 418
  * @return void
419 419
  */
420 420
 function give_check_for_form_price_variations_html() {
421
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
421
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
422 422
 		wp_die();
423 423
 	}
424 424
 
425
-	$form_id = intval( $_POST['form_id'] );
426
-	$payment_id = intval( $_POST['payment_id'] );
427
-	$form    = get_post( $form_id );
425
+	$form_id = intval($_POST['form_id']);
426
+	$payment_id = intval($_POST['payment_id']);
427
+	$form    = get_post($form_id);
428 428
 
429
-	if ( 'give_forms' != $form->post_type ) {
429
+	if ('give_forms' != $form->post_type) {
430 430
 		wp_die();
431 431
 	}
432 432
 
433
-    if ( ! give_has_variable_prices( $form_id ) ) {
434
-        esc_html_e( 'n/a', 'give' );
433
+    if ( ! give_has_variable_prices($form_id)) {
434
+        esc_html_e('n/a', 'give');
435 435
     } else {
436 436
         // Payment object.
437
-        $payment = new Give_Payment( $payment_id );
437
+        $payment = new Give_Payment($payment_id);
438 438
 
439 439
         // Payment meta.
440 440
         $payment_meta = $payment->get_meta();
441 441
 
442 442
 
443 443
         // Variable price dropdown options.
444
-        $variable_price_dropdown_option =  array(
444
+        $variable_price_dropdown_option = array(
445 445
             'id'                => $form_id,
446 446
             'name'              => 'give-variable-price',
447 447
             'chosen'            => true,
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
         );
451 451
 
452 452
         // Render variable prices select tag html.
453
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
453
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
454 454
     }
455 455
 
456 456
     give_die();
457 457
 }
458 458
 
459
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
459
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
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/admin/admin-footer.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @return      string
26 26
  */
27
-function give_admin_rate_us( $footer_text ) {
27
+function give_admin_rate_us($footer_text) {
28 28
 	global $typenow;
29 29
 
30
-	if ( $typenow == 'give_forms' ) {
30
+	if ($typenow == 'give_forms') {
31 31
 		$rate_text = sprintf(
32 32
 			/* translators: %s: Link to 5 star rating */
33
-			__( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ),
34
-			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
33
+			__('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'),
34
+			'<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.esc_attr__('Thanks :)', 'give').'">&#9733;&#9733;&#9733;&#9733;&#9733;</a>'
35 35
 		);
36 36
 
37 37
 		return $rate_text;
@@ -40,4 +40,4 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 }
42 42
 
43
-add_filter( 'admin_footer_text', 'give_admin_rate_us' );
43
+add_filter('admin_footer_text', 'give_admin_rate_us');
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.