Completed
Push — master ( d800f4...465f79 )
by Devin
21:03
created
includes/admin/customers/class-customer-table.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -253,7 +253,7 @@
 block discarded – undo
253 253
 	 *
254 254
 	 * @access public
255 255
 	 * @since  1.0
256
-	 * @return mixed string If search is present, false otherwise.
256
+	 * @return string|false string If search is present, false otherwise.
257 257
 	 */
258 258
 	public function get_search() {
259 259
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,8 +185,8 @@
 block discarded – undo
185 185
 				
186 186
 			case 'num_donations' :
187 187
 				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
188
+						 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
+						 ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults
64
-		parent::__construct( array(
65
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
66
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
64
+		parent::__construct(array(
65
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
66
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
67 67
 			'ajax'     => false                       // Does this table support ajax?
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
88 88
 		}
89
-		if ( ! empty( $_REQUEST['order'] ) ) {
90
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
89
+		if ( ! empty($_REQUEST['order'])) {
90
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
91 91
 		}
92 92
 		?>
93 93
         <p class="search-box" role="search">
94 94
             <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
95 95
             <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
96
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
96
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
97 97
         </p>
98 98
 		<?php
99 99
 	}
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return string Column Name.
111 111
 	 */
112
-	public function column_default( $item, $column_name ) {
113
-		switch ( $column_name ) {
112
+	public function column_default($item, $column_name) {
113
+		switch ($column_name) {
114 114
 
115 115
 			case 'num_donations' :
116
-				$value = '<a href="' .
117
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
118
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
116
+				$value = '<a href="'.
117
+				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
118
+				         ).'">'.esc_html($item['num_donations']).'</a>';
119 119
 				break;
120 120
 
121 121
 			case 'amount_spent' :
122
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
122
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
123 123
 				break;
124 124
 
125 125
 			case 'date_created' :
126
-				$value = date_i18n( give_date_format(), strtotime( $item['date_created'] ) );
126
+				$value = date_i18n(give_date_format(), strtotime($item['date_created']));
127 127
 				break;
128 128
 
129 129
 			default:
130
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
130
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
131 131
 				break;
132 132
 		}
133 133
 
134
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
134
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
135 135
 
136 136
 	}
137 137
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string
144 144
 	 */
145
-	public function column_name( $item ) {
146
-		$name = '#' . $item['id'] . ' ';
147
-		$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
148
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
149
-		$actions  = $this->get_row_actions( $item );
145
+	public function column_name($item) {
146
+		$name = '#'.$item['id'].' ';
147
+		$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
148
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
149
+		$actions  = $this->get_row_actions($item);
150 150
 
151
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
151
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
152 152
 	}
153 153
 
154 154
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_columns() {
162 162
 		$columns = array(
163
-			'name'          => esc_html__( 'Name', 'give' ),
164
-			'email'         => esc_html__( 'Email', 'give' ),
165
-			'num_donations' => esc_html__( 'Donations', 'give' ),
166
-			'amount_spent'  => esc_html__( 'Total Donated', 'give' ),
167
-			'date_created'  => esc_html__( 'Date Created', 'give' )
163
+			'name'          => esc_html__('Name', 'give'),
164
+			'email'         => esc_html__('Email', 'give'),
165
+			'num_donations' => esc_html__('Donations', 'give'),
166
+			'amount_spent'  => esc_html__('Total Donated', 'give'),
167
+			'date_created'  => esc_html__('Date Created', 'give')
168 168
 		);
169 169
 
170
-		return apply_filters( 'give_report_customer_columns', $columns );
170
+		return apply_filters('give_report_customer_columns', $columns);
171 171
 
172 172
 	}
173 173
 
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	public function get_sortable_columns() {
182 182
 
183 183
 		$columns = array(
184
-			'date_created'  => array( 'date_created', true ),
185
-			'name'          => array( 'name', true ),
186
-			'num_donations' => array( 'purchase_count', false ),
187
-			'amount_spent'  => array( 'purchase_value', false ),
184
+			'date_created'  => array('date_created', true),
185
+			'name'          => array('name', true),
186
+			'num_donations' => array('purchase_count', false),
187
+			'amount_spent'  => array('purchase_value', false),
188 188
 		);
189 189
 
190
-		return apply_filters( 'give_report_sortable_customer_columns', $columns );
190
+		return apply_filters('give_report_sortable_customer_columns', $columns);
191 191
 	}
192 192
 
193 193
 	/**
@@ -200,34 +200,34 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return array An array of action links.
202 202
 	 */
203
-	public function get_row_actions( $item ) {
203
+	public function get_row_actions($item) {
204 204
 
205 205
 		$actions = array(
206 206
 
207 207
 			'view' => sprintf(
208 208
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
209
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ),
210
-				sprintf( esc_attr__( 'View "%s"', 'give' ), $item['name'] ),
211
-				esc_html__( 'View Donor', 'give' )
209
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']),
210
+				sprintf(esc_attr__('View "%s"', 'give'), $item['name']),
211
+				esc_html__('View Donor', 'give')
212 212
 			),
213 213
 
214 214
 			'notes' => sprintf(
215 215
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
216
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $item['id'] ),
217
-				sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $item['name'] ),
218
-				esc_html__( 'Notes', 'give' )
216
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$item['id']),
217
+				sprintf(esc_attr__('Notes for "%s"', 'give'), $item['name']),
218
+				esc_html__('Notes', 'give')
219 219
 			),
220 220
 
221 221
 			'delete' => sprintf(
222 222
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
223
-				admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ),
224
-				sprintf( esc_attr__( 'Delete "%s"', 'give' ), $item['name'] ),
225
-				esc_html__( 'Delete', 'give' )
223
+				admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id']),
224
+				sprintf(esc_attr__('Delete "%s"', 'give'), $item['name']),
225
+				esc_html__('Delete', 'give')
226 226
 			)
227 227
 
228 228
 		);
229 229
 
230
-		return apply_filters( 'give_donor_row_actions', $actions, $item );
230
+		return apply_filters('give_donor_row_actions', $actions, $item);
231 231
 
232 232
 	}
233 233
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @since  1.0
242 242
 	 * @return void
243 243
 	 */
244
-	public function bulk_actions( $which = '' ) {
244
+	public function bulk_actions($which = '') {
245 245
 		// These aren't really bulk actions but this outputs the markup in the right place.
246 246
 	}
247 247
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return int Current page number.
254 254
 	 */
255 255
 	public function get_paged() {
256
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
256
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
257 257
 	}
258 258
 
259 259
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return mixed string If search is present, false otherwise.
265 265
 	 */
266 266
 	public function get_search() {
267
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
267
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
268 268
 	}
269 269
 
270 270
 	/**
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 
282 282
 		// Get donor query.
283 283
 		$args      = $this->get_donor_query();
284
-		$customers = Give()->customers->get_customers( $args );
284
+		$customers = Give()->customers->get_customers($args);
285 285
 
286
-		if ( $customers ) {
286
+		if ($customers) {
287 287
 
288
-			foreach ( $customers as $customer ) {
288
+			foreach ($customers as $customer) {
289 289
 
290
-				$user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0;
290
+				$user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0;
291 291
 
292 292
 				$data[] = array(
293 293
 					'id'            => $customer->id,
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 		}
303 303
 
304
-		return apply_filters( 'give_donors_column_query_data', $data );
304
+		return apply_filters('give_donors_column_query_data', $data);
305 305
 	}
306 306
 
307 307
 	/**
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
 		$_donor_query = $this->get_donor_query();
316 316
 
317 317
 		$_donor_query['number'] = - 1;
318
-		$donors                 = Give()->customers->get_customers( $_donor_query );
318
+		$donors                 = Give()->customers->get_customers($_donor_query);
319 319
 
320
-		return count( $donors );
320
+		return count($donors);
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 	 */
330 330
 	public function get_donor_query() {
331 331
 		$paged   = $this->get_paged();
332
-		$offset  = $this->per_page * ( $paged - 1 );
332
+		$offset  = $this->per_page * ($paged - 1);
333 333
 		$search  = $this->get_search();
334
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
335
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
334
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
335
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
336 336
 
337 337
 		$args = array(
338 338
 			'number'  => $this->per_page,
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 			'orderby' => $orderby,
342 342
 		);
343 343
 
344
-		if ( $search ) {
345
-			if ( is_email( $search ) ) {
344
+		if ($search) {
345
+			if (is_email($search)) {
346 346
 				$args['email'] = $search;
347
-			} elseif ( is_numeric( $search ) ) {
347
+			} elseif (is_numeric($search)) {
348 348
 				$args['id'] = $search;
349 349
 			} else {
350 350
 				$args['name'] = $search;
@@ -371,16 +371,16 @@  discard block
 block discarded – undo
371 371
 		$hidden   = array(); // No hidden columns
372 372
 		$sortable = $this->get_sortable_columns();
373 373
 
374
-		$this->_column_headers = array( $columns, $hidden, $sortable );
374
+		$this->_column_headers = array($columns, $hidden, $sortable);
375 375
 
376 376
 		$this->items = $this->donor_data();
377 377
 
378 378
 		$this->total = $this->get_donor_count();
379 379
 
380
-		$this->set_pagination_args( array(
380
+		$this->set_pagination_args(array(
381 381
 			'total_items' => $this->total,
382 382
 			'per_page'    => $this->per_page,
383
-			'total_pages' => ceil( $this->total / $this->per_page )
384
-		) );
383
+			'total_pages' => ceil($this->total / $this->per_page)
384
+		));
385 385
 	}
386 386
 }
387 387
\ No newline at end of file
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file.
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) {
23
+if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) {
24 24
 
25 25
 	// Delete All the Custom Post Types.
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type');
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids',
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies.
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms.
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies.
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages.
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
@@ -72,20 +72,20 @@  discard block
 block discarded – undo
72 72
 	Give()->roles->remove_caps();
73 73
 
74 74
 	// Delete the Roles.
75
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker' );
76
-	foreach ( $give_roles as $role ) {
77
-		remove_role( $role );
75
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker');
76
+	foreach ($give_roles as $role) {
77
+		remove_role($role);
78 78
 	}
79 79
 
80 80
 	// Remove all database tables.
81
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' );
82
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' );
83
-	$wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' );
81
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors');
82
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers');
83
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta');
84 84
 
85 85
 	// Cleanup Cron Events.
86
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
87
-	wp_clear_scheduled_hook( 'give_daily_cron' );
88
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
86
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
87
+	wp_clear_scheduled_hook('give_daily_cron');
88
+	wp_clear_scheduled_hook('give_weekly_cron');
89 89
 
90 90
 	// Get all options.
91 91
 	$give_option_names = $wpdb->get_results(
@@ -96,24 +96,24 @@  discard block
 block discarded – undo
96 96
 		ARRAY_A
97 97
 	);
98 98
 
99
-	if ( ! empty( $give_option_names ) ) {
99
+	if ( ! empty($give_option_names)) {
100 100
 		// Convert option name to transient or option name.
101 101
 		$new_give_option_names = array();
102 102
 
103
-		foreach ( $give_option_names as $option ) {
104
-			$new_give_option_names[] = ( false !== strpos( $option['option_name'], '_transient_' ) )
105
-				? str_replace( '_transient_', '', $option['option_name'] )
103
+		foreach ($give_option_names as $option) {
104
+			$new_give_option_names[] = (false !== strpos($option['option_name'], '_transient_'))
105
+				? str_replace('_transient_', '', $option['option_name'])
106 106
 				: $option['option_name'];
107 107
 		}
108 108
 
109 109
 		$give_option_names = $new_give_option_names;
110 110
 
111 111
 		// Delete all the Plugin Options.
112
-		foreach ( $give_option_names as $option ) {
113
-			if ( false !== strpos( $option, '_transient_' ) ) {
114
-				delete_transient( $option );
112
+		foreach ($give_option_names as $option) {
113
+			if (false !== strpos($option, '_transient_')) {
114
+				delete_transient($option);
115 115
 			} else {
116
-				delete_option( $option );
116
+				delete_option($option);
117 117
 			}
118 118
 		}
119 119
 	}
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +119 added lines, -119 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
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  bool  $_id   Post id. Default is false.
338 338
 	 * @param  array $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => __( 'New Donation Form', 'give' ),
431
+			'post_title'  => __('New Donation Form', 'give'),
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,13 +490,13 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
495
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
496 496
 
497
-			if ( $this->price ) {
497
+			if ($this->price) {
498 498
 
499
-				$this->price = give_sanitize_amount( $this->price );
499
+				$this->price = give_sanitize_amount($this->price);
500 500
 
501 501
 			} else {
502 502
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,14 +527,14 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
533
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
533
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
534 534
 
535
-			if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) {
535
+			if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) {
536 536
 
537
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
537
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
538 538
 
539 539
 			} else {
540 540
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 
545 545
 		}
546 546
 
547
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
547
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
548 548
 	}
549 549
 
550 550
 	/**
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	public function get_prices() {
559 559
 
560
-		if ( ! isset( $this->prices ) ) {
560
+		if ( ! isset($this->prices)) {
561 561
 
562
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
562
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
563 563
 
564 564
 		}
565 565
 
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		 * @param array      $prices The array of mulit-level prices.
572 572
 		 * @param int|string $ID     The ID of the form.
573 573
 		 */
574
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
574
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
575 575
 
576 576
 	}
577 577
 
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	public function get_goal() {
587 587
 
588
-		if ( ! isset( $this->goal ) ) {
588
+		if ( ! isset($this->goal)) {
589 589
 
590
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
590
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
591 591
 
592
-			if ( $this->goal ) {
592
+			if ($this->goal) {
593 593
 
594
-				$this->goal = give_sanitize_amount( $this->goal );
594
+				$this->goal = give_sanitize_amount($this->goal);
595 595
 
596 596
 			} else {
597 597
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 
602 602
 		}
603 603
 
604
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
604
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
605 605
 
606 606
 	}
607 607
 
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
 	 */
616 616
 	public function is_single_price_mode() {
617 617
 
618
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
618
+		$option = get_post_meta($this->ID, '_give_price_option', true);
619 619
 		$ret    = 0;
620 620
 
621
-		if ( empty( $option ) || $option === 'set' ) {
621
+		if (empty($option) || $option === 'set') {
622 622
 			$ret = 1;
623 623
 		}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		 * @param bool       $ret Is donation form in single price mode?
631 631
 		 * @param int|string $ID The ID of the donation form.
632 632
 		 */
633
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
633
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
634 634
 
635 635
 	}
636 636
 
@@ -644,10 +644,10 @@  discard block
 block discarded – undo
644 644
 	 */
645 645
 	public function is_custom_price_mode() {
646 646
 
647
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
647
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
648 648
 		$ret    = 0;
649 649
 
650
-		if ( give_is_setting_enabled( $option ) ) {
650
+		if (give_is_setting_enabled($option)) {
651 651
 			$ret = 1;
652 652
 		}
653 653
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		 * @param bool       $ret Is donation form in custom price mode?
660 660
 		 * @param int|string $ID  The ID of the donation form.
661 661
 		 */
662
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
662
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
663 663
 
664 664
 	}
665 665
 
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	 */
676 676
 	public function has_variable_prices() {
677 677
 
678
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
678
+		$option = get_post_meta($this->ID, '_give_price_option', true);
679 679
 		$ret    = 0;
680 680
 
681
-		if ( $option === 'multi' ) {
681
+		if ($option === 'multi') {
682 682
 			$ret = 1;
683 683
 		}
684 684
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		 * @param bool       $ret Does donation form have variable prices?
689 689
 		 * @param int|string $ID  The ID of the donation form.
690 690
 		 */
691
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
691
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
692 692
 
693 693
 	}
694 694
 
@@ -702,17 +702,17 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function get_type() {
704 704
 
705
-		if ( ! isset( $this->type ) ) {
705
+		if ( ! isset($this->type)) {
706 706
 
707
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
707
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
708 708
 
709
-			if ( empty( $this->type ) ) {
709
+			if (empty($this->type)) {
710 710
 				$this->type = 'set';
711 711
 			}
712 712
 
713 713
 		}
714 714
 
715
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
715
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
716 716
 
717 717
 	}
718 718
 
@@ -728,23 +728,23 @@  discard block
 block discarded – undo
728 728
 	 *
729 729
 	 * @return string
730 730
 	 */
731
-	public function get_form_classes( $args ) {
731
+	public function get_form_classes($args) {
732 732
 
733
-		$float_labels_option = give_is_float_labels_enabled( $args )
733
+		$float_labels_option = give_is_float_labels_enabled($args)
734 734
 			? 'float-labels-enabled'
735 735
 			: '';
736 736
 
737
-		$form_classes_array = apply_filters( 'give_form_classes', array(
737
+		$form_classes_array = apply_filters('give_form_classes', array(
738 738
 			'give-form',
739
-			'give-form-' . $this->ID,
740
-			'give-form-type-' . $this->get_type(),
739
+			'give-form-'.$this->ID,
740
+			'give-form-type-'.$this->get_type(),
741 741
 			$float_labels_option,
742
-		), $this->ID, $args );
742
+		), $this->ID, $args);
743 743
 
744 744
 		// Remove empty class names.
745
-		$form_classes_array = array_filter( $form_classes_array );
745
+		$form_classes_array = array_filter($form_classes_array);
746 746
 
747
-		return implode( ' ', $form_classes_array );
747
+		return implode(' ', $form_classes_array);
748 748
 
749 749
 	}
750 750
 
@@ -759,24 +759,24 @@  discard block
 block discarded – undo
759 759
 	 *
760 760
 	 * @return string
761 761
 	 */
762
-	public function get_form_wrap_classes( $args ) {
762
+	public function get_form_wrap_classes($args) {
763 763
 
764
-		$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
764
+		$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
765 765
 			? $args['display_style']
766
-			: get_post_meta( $this->ID, '_give_payment_display', true );
766
+			: get_post_meta($this->ID, '_give_payment_display', true);
767 767
 
768 768
 		// If admin want to show only button for form then user inbuilt modal functionality.
769
-		if( 'button' === $display_option ) {
769
+		if ('button' === $display_option) {
770 770
 			$display_option = 'modal give-display-button-only';
771 771
 		}
772 772
 
773
-		$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
773
+		$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
774 774
 			'give-form-wrap',
775
-			'give-display-' . $display_option,
776
-		), $this->ID, $args );
775
+			'give-display-'.$display_option,
776
+		), $this->ID, $args);
777 777
 
778 778
 
779
-		return implode( ' ', $form_wrap_classes_array );
779
+		return implode(' ', $form_wrap_classes_array);
780 780
 
781 781
 	}
782 782
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	public function is_set_type_donation_form() {
792 792
 		$form_type = $this->get_type();
793 793
 
794
-		return ( 'set' === $form_type ? true : false );
794
+		return ('set' === $form_type ? true : false);
795 795
 	}
796 796
 
797 797
 	/**
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	public function is_multi_type_donation_form() {
806 806
 		$form_type = $this->get_type();
807 807
 
808
-		return ( 'multi' === $form_type ? true : false );
808
+		return ('multi' === $form_type ? true : false);
809 809
 
810 810
 	}
811 811
 
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 	 */
820 820
 	public function get_sales() {
821 821
 
822
-		if ( ! isset( $this->sales ) ) {
822
+		if ( ! isset($this->sales)) {
823 823
 
824
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
825
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
824
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
825
+				add_post_meta($this->ID, '_give_form_sales', 0);
826 826
 			} // End if
827 827
 
828
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
828
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
829 829
 
830
-			if ( $this->sales < 0 ) {
830
+			if ($this->sales < 0) {
831 831
 				// Never let sales be less than zero
832 832
 				$this->sales = 0;
833 833
 			}
@@ -848,13 +848,13 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @return int|false     New number of total sales.
850 850
 	 */
851
-	public function increase_sales( $quantity = 1 ) {
851
+	public function increase_sales($quantity = 1) {
852 852
 
853
-		$sales       = give_get_form_sales_stats( $this->ID );
854
-		$quantity    = absint( $quantity );
853
+		$sales       = give_get_form_sales_stats($this->ID);
854
+		$quantity    = absint($quantity);
855 855
 		$total_sales = $sales + $quantity;
856 856
 
857
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
857
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
858 858
 
859 859
 			$this->sales = $total_sales;
860 860
 
@@ -875,17 +875,17 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @return int|false     New number of total sales.
877 877
 	 */
878
-	public function decrease_sales( $quantity = 1 ) {
878
+	public function decrease_sales($quantity = 1) {
879 879
 
880
-		$sales = give_get_form_sales_stats( $this->ID );
880
+		$sales = give_get_form_sales_stats($this->ID);
881 881
 
882 882
 		// Only decrease if not already zero
883
-		if ( $sales > 0 ) {
883
+		if ($sales > 0) {
884 884
 
885
-			$quantity    = absint( $quantity );
885
+			$quantity    = absint($quantity);
886 886
 			$total_sales = $sales - $quantity;
887 887
 
888
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
888
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
889 889
 
890 890
 				$this->sales = $sales;
891 891
 
@@ -909,15 +909,15 @@  discard block
 block discarded – undo
909 909
 	 */
910 910
 	public function get_earnings() {
911 911
 
912
-		if ( ! isset( $this->earnings ) ) {
912
+		if ( ! isset($this->earnings)) {
913 913
 
914
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
915
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
914
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
915
+				add_post_meta($this->ID, '_give_form_earnings', 0);
916 916
 			}
917 917
 
918
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
918
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
919 919
 
920
-			if ( $this->earnings < 0 ) {
920
+			if ($this->earnings < 0) {
921 921
 				// Never let earnings be less than zero
922 922
 				$this->earnings = 0;
923 923
 			}
@@ -938,12 +938,12 @@  discard block
 block discarded – undo
938 938
 	 *
939 939
 	 * @return float|false
940 940
 	 */
941
-	public function increase_earnings( $amount = 0 ) {
941
+	public function increase_earnings($amount = 0) {
942 942
 
943
-		$earnings   = give_get_form_earnings_stats( $this->ID );
943
+		$earnings   = give_get_form_earnings_stats($this->ID);
944 944
 		$new_amount = $earnings + (float) $amount;
945 945
 
946
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
946
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
947 947
 
948 948
 			$this->earnings = $new_amount;
949 949
 
@@ -965,16 +965,16 @@  discard block
 block discarded – undo
965 965
 	 *
966 966
 	 * @return float|false
967 967
 	 */
968
-	public function decrease_earnings( $amount ) {
968
+	public function decrease_earnings($amount) {
969 969
 
970
-		$earnings = give_get_form_earnings_stats( $this->ID );
970
+		$earnings = give_get_form_earnings_stats($this->ID);
971 971
 
972
-		if ( $earnings > 0 ) {
972
+		if ($earnings > 0) {
973 973
 			// Only decrease if greater than zero
974 974
 			$new_amount = $earnings - (float) $amount;
975 975
 
976 976
 
977
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
977
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
978 978
 
979 979
 				$this->earnings = $new_amount;
980 980
 
@@ -998,22 +998,22 @@  discard block
 block discarded – undo
998 998
 	 *
999 999
 	 * @return bool
1000 1000
 	 */
1001
-	public function is_free( $price_id = false ) {
1001
+	public function is_free($price_id = false) {
1002 1002
 
1003 1003
 		$is_free          = false;
1004
-		$variable_pricing = give_has_variable_prices( $this->ID );
1004
+		$variable_pricing = give_has_variable_prices($this->ID);
1005 1005
 
1006
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1007
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1008
-		} elseif ( ! $variable_pricing ) {
1009
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
1006
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1007
+			$price = give_get_price_option_amount($this->ID, $price_id);
1008
+		} elseif ( ! $variable_pricing) {
1009
+			$price = get_post_meta($this->ID, '_give_set_price', true);
1010 1010
 		}
1011 1011
 
1012
-		if ( isset( $price ) && (float) $price == 0 ) {
1012
+		if (isset($price) && (float) $price == 0) {
1013 1013
 			$is_free = true;
1014 1014
 		}
1015 1015
 
1016
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1016
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1017 1017
 
1018 1018
 	}
1019 1019
 
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
 		$is_close_form = apply_filters(
1041 1041
 			'give_is_close_donation_form',
1042 1042
 			(
1043
-			give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) )
1044
-			&& give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
1045
-			&& ( $this->get_goal() <= $this->get_earnings()
1043
+			give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) )
1044
+			&& give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
1045
+			&& ($this->get_goal() <= $this->get_earnings()
1046 1046
 			),
1047 1047
 			$this->ID
1048 1048
 		);
@@ -1061,29 +1061,29 @@  discard block
 block discarded – undo
1061 1061
 	 *
1062 1062
 	 * @return bool                            The result of the update query.
1063 1063
 	 */
1064
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1064
+	private function update_meta($meta_key = '', $meta_value = '') {
1065 1065
 
1066 1066
 		/* @var WPDB $wpdb */
1067 1067
 		global $wpdb;
1068 1068
 
1069
-		if ( empty( $meta_key ) ) {
1069
+		if (empty($meta_key)) {
1070 1070
 			return false;
1071 1071
 		}
1072 1072
 
1073 1073
 		// Make sure if it needs to be serialized, we do
1074
-		$meta_value = maybe_serialize( $meta_value );
1074
+		$meta_value = maybe_serialize($meta_value);
1075 1075
 
1076
-		if ( is_numeric( $meta_value ) ) {
1077
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
1076
+		if (is_numeric($meta_value)) {
1077
+			$value_type = is_float($meta_value) ? '%f' : '%d';
1078 1078
 		} else {
1079 1079
 			$value_type = "'%s'";
1080 1080
 		}
1081 1081
 
1082
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
1082
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
1083 1083
 
1084
-		if ( $wpdb->query( $sql ) ) {
1084
+		if ($wpdb->query($sql)) {
1085 1085
 
1086
-			clean_post_cache( $this->ID );
1086
+			clean_post_cache($this->ID);
1087 1087
 
1088 1088
 			return true;
1089 1089
 
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +140 added lines, -140 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,36 +23,36 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	// Give Forms single post and archive options.
26
-	$give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) );
27
-	$give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) );
26
+	$give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular'));
27
+	$give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives'));
28 28
 
29
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
29
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
30 30
 	// Support for old 'GIVE_FORMS_SLUG' constant
31
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
31
+	if (defined('GIVE_FORMS_SLUG')) {
32 32
 		$give_forms_slug = GIVE_FORMS_SLUG;
33 33
 	}
34 34
 
35
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
35
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36 36
 		'slug'       => $give_forms_slug,
37 37
 		'with_front' => false,
38 38
 	);
39 39
 
40
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
41
-		'name'               => esc_html__( 'Donation Forms', 'give' ),
42
-		'singular_name'      => esc_html__( 'Form', 'give' ),
43
-		'add_new'            => esc_html__( 'Add Form', 'give' ),
44
-		'add_new_item'       => esc_html__( 'Add New Donation Form', 'give' ),
45
-		'edit_item'          => esc_html__( 'Edit Donation Form', 'give' ),
46
-		'new_item'           => esc_html__( 'New Form', 'give' ),
47
-		'all_items'          => esc_html__( 'All Forms', 'give' ),
48
-		'view_item'          => esc_html__( 'View Form', 'give' ),
49
-		'search_items'       => esc_html__( 'Search Forms', 'give' ),
50
-		'not_found'          => esc_html__( 'No forms found.', 'give' ),
51
-		'not_found_in_trash' => esc_html__( 'No forms found in Trash.', 'give' ),
40
+	$give_forms_labels = apply_filters('give_forms_labels', array(
41
+		'name'               => esc_html__('Donation Forms', 'give'),
42
+		'singular_name'      => esc_html__('Form', 'give'),
43
+		'add_new'            => esc_html__('Add Form', 'give'),
44
+		'add_new_item'       => esc_html__('Add New Donation Form', 'give'),
45
+		'edit_item'          => esc_html__('Edit Donation Form', 'give'),
46
+		'new_item'           => esc_html__('New Form', 'give'),
47
+		'all_items'          => esc_html__('All Forms', 'give'),
48
+		'view_item'          => esc_html__('View Form', 'give'),
49
+		'search_items'       => esc_html__('Search Forms', 'give'),
50
+		'not_found'          => esc_html__('No forms found.', 'give'),
51
+		'not_found_in_trash' => esc_html__('No forms found in Trash.', 'give'),
52 52
 		'parent_item_colon'  => '',
53
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
54
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) ),
55
-	) );
53
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
54
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give')),
55
+	));
56 56
 
57 57
 	// Default give_forms supports.
58 58
 	$give_form_supports = array(
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 	);
65 65
 
66 66
 	// Has the user disabled the excerpt?
67
-	if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) {
68
-		unset( $give_form_supports[2] );
67
+	if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) {
68
+		unset($give_form_supports[2]);
69 69
 	}
70 70
 
71 71
 	// Has user disabled the featured image?
72
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
73
-		unset( $give_form_supports[1] );
74
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
72
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
73
+		unset($give_form_supports[1]);
74
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
75 75
 	}
76 76
 
77 77
 	$give_forms_args = array(
@@ -87,42 +87,42 @@  discard block
 block discarded – undo
87 87
 		'has_archive'        => $give_forms_archives,
88 88
 		'menu_icon'          => 'dashicons-give',
89 89
 		'hierarchical'       => false,
90
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
90
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
91 91
 	);
92
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
92
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
93 93
 
94 94
 	/** Donation Post Type */
95 95
 	$payment_labels = array(
96
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
97
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
98
-		'add_new'            => esc_html__( 'Add New', 'give' ),
99
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
100
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
101
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
102
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
103
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
104
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
105
-		'not_found'          => esc_html__( 'No donations found.', 'give' ),
106
-		'not_found_in_trash' => esc_html__( 'No donations found in Trash.', 'give' ),
96
+		'name'               => _x('Donations', 'post type general name', 'give'),
97
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
98
+		'add_new'            => esc_html__('Add New', 'give'),
99
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
100
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
101
+		'new_item'           => esc_html__('New Donation', 'give'),
102
+		'all_items'          => esc_html__('All Donations', 'give'),
103
+		'view_item'          => esc_html__('View Donation', 'give'),
104
+		'search_items'       => esc_html__('Search Donations', 'give'),
105
+		'not_found'          => esc_html__('No donations found.', 'give'),
106
+		'not_found_in_trash' => esc_html__('No donations found in Trash.', 'give'),
107 107
 		'parent_item_colon'  => '',
108
-		'menu_name'          => esc_html__( 'Donations', 'give' ),
108
+		'menu_name'          => esc_html__('Donations', 'give'),
109 109
 	);
110 110
 
111 111
 	$payment_args = array(
112
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
112
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
113 113
 		'public'          => false,
114 114
 		'query_var'       => false,
115 115
 		'rewrite'         => false,
116 116
 		'map_meta_cap'    => true,
117 117
 		'capability_type' => 'give_payment',
118
-		'supports'        => array( 'title' ),
118
+		'supports'        => array('title'),
119 119
 		'can_export'      => true,
120 120
 	);
121
-	register_post_type( 'give_payment', $payment_args );
121
+	register_post_type('give_payment', $payment_args);
122 122
 
123 123
 }
124 124
 
125
-add_action( 'init', 'give_setup_post_types', 1 );
125
+add_action('init', 'give_setup_post_types', 1);
126 126
 
127 127
 
128 128
 /**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_setup_taxonomies() {
137 137
 
138
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
138
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
139 139
 
140 140
 	/** Categories */
141 141
 	$category_labels = array(
142
-		'name'              => _x( 'Form Categories', 'taxonomy general name', 'give' ),
143
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
144
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
145
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
146
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
147
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
148
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
149
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
150
-		'add_new_item'      => esc_html__( 'Add New Category', 'give' ),
151
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
152
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
142
+		'name'              => _x('Form Categories', 'taxonomy general name', 'give'),
143
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
144
+		'search_items'      => esc_html__('Search Categories', 'give'),
145
+		'all_items'         => esc_html__('All Categories', 'give'),
146
+		'parent_item'       => esc_html__('Parent Category', 'give'),
147
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
148
+		'edit_item'         => esc_html__('Edit Category', 'give'),
149
+		'update_item'       => esc_html__('Update Category', 'give'),
150
+		'add_new_item'      => esc_html__('Add New Category', 'give'),
151
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
152
+		'menu_name'         => esc_html__('Categories', 'give'),
153 153
 	);
154 154
 
155
-	$category_args = apply_filters( 'give_forms_category_args', array(
155
+	$category_args = apply_filters('give_forms_category_args', array(
156 156
 			'hierarchical' => true,
157
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
157
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
158 158
 			'show_ui'      => true,
159 159
 			'query_var'    => 'give_forms_category',
160 160
 			'rewrite'      => array(
161
-				'slug'         => $slug . '/category',
161
+				'slug'         => $slug.'/category',
162 162
 				'with_front'   => false,
163 163
 				'hierarchical' => true,
164 164
 			),
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
 	);
173 173
 
174 174
 	// Does the user want categories?
175
-	if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
176
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
177
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
175
+	if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
176
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
177
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
178 178
 	}
179 179
 
180 180
 	/** Tags */
181 181
 	$tag_labels = array(
182
-		'name'                  => _x( 'Form Tags', 'taxonomy general name', 'give' ),
183
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
184
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
185
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
186
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
187
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
188
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
189
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
190
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
191
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
192
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
193
-		'choose_from_most_used' => esc_html__( 'Choose from most used tags.', 'give' ),
182
+		'name'                  => _x('Form Tags', 'taxonomy general name', 'give'),
183
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
184
+		'search_items'          => esc_html__('Search Tags', 'give'),
185
+		'all_items'             => esc_html__('All Tags', 'give'),
186
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
187
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
188
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
189
+		'update_item'           => esc_html__('Update Tag', 'give'),
190
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
191
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
192
+		'menu_name'             => esc_html__('Tags', 'give'),
193
+		'choose_from_most_used' => esc_html__('Choose from most used tags.', 'give'),
194 194
 	);
195 195
 
196
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
196
+	$tag_args = apply_filters('give_forms_tag_args', array(
197 197
 			'hierarchical' => false,
198
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
198
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
199 199
 			'show_ui'      => true,
200 200
 			'query_var'    => 'give_forms_tag',
201
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
201
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
202 202
 			'capabilities' => array(
203 203
 				'manage_terms' => 'manage_give_form_terms',
204 204
 				'edit_terms'   => 'edit_give_form_terms',
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	);
210 210
 
211
-	if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
212
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
213
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
211
+	if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
212
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
213
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
214 214
 	}
215 215
 
216 216
 }
217 217
 
218
-add_action( 'init', 'give_setup_taxonomies', 0 );
218
+add_action('init', 'give_setup_taxonomies', 0);
219 219
 
220 220
 
221 221
 /**
@@ -226,11 +226,11 @@  discard block
 block discarded – undo
226 226
  */
227 227
 function give_get_default_form_labels() {
228 228
 	$defaults = array(
229
-		'singular' => esc_html__( 'Form', 'give' ),
230
-		'plural'   => esc_html__( 'Forms', 'give' ),
229
+		'singular' => esc_html__('Form', 'give'),
230
+		'plural'   => esc_html__('Forms', 'give'),
231 231
 	);
232 232
 
233
-	return apply_filters( 'give_default_form_name', $defaults );
233
+	return apply_filters('give_default_form_name', $defaults);
234 234
 }
235 235
 
236 236
 /**
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return string $defaults['singular'] Singular label
244 244
  */
245
-function give_get_forms_label_singular( $lowercase = false ) {
245
+function give_get_forms_label_singular($lowercase = false) {
246 246
 	$defaults = give_get_default_form_labels();
247 247
 
248
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
248
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
249 249
 }
250 250
 
251 251
 /**
@@ -254,10 +254,10 @@  discard block
 block discarded – undo
254 254
  * @since 1.0
255 255
  * @return string $defaults['plural'] Plural label
256 256
  */
257
-function give_get_forms_label_plural( $lowercase = false ) {
257
+function give_get_forms_label_plural($lowercase = false) {
258 258
 	$defaults = give_get_default_form_labels();
259 259
 
260
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
260
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
261 261
 }
262 262
 
263 263
 /**
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return string $title New placeholder text
271 271
  */
272
-function give_change_default_title( $title ) {
272
+function give_change_default_title($title) {
273 273
 	// If a frontend plugin uses this filter (check extensions before changing this function)
274
-	if ( ! is_admin() ) {
275
-		$title = esc_html__( 'Enter form title here', 'give' );
274
+	if ( ! is_admin()) {
275
+		$title = esc_html__('Enter form title here', 'give');
276 276
 
277 277
 		return $title;
278 278
 	}
279 279
 
280 280
 	$screen = get_current_screen();
281 281
 
282
-	if ( 'give_forms' == $screen->post_type ) {
283
-		$title = esc_html__( 'Enter form title here', 'give' );
282
+	if ('give_forms' == $screen->post_type) {
283
+		$title = esc_html__('Enter form title here', 'give');
284 284
 	}
285 285
 
286 286
 	return $title;
287 287
 }
288 288
 
289
-add_filter( 'enter_title_here', 'give_change_default_title' );
289
+add_filter('enter_title_here', 'give_change_default_title');
290 290
 
291 291
 /**
292 292
  * Registers Custom Post Statuses which are used by the Payments
@@ -296,50 +296,50 @@  discard block
 block discarded – undo
296 296
  */
297 297
 function give_register_post_type_statuses() {
298 298
 	// Payment Statuses
299
-	register_post_status( 'refunded', array(
300
-		'label'                     => esc_html__( 'Refunded', 'give' ),
299
+	register_post_status('refunded', array(
300
+		'label'                     => esc_html__('Refunded', 'give'),
301 301
 		'public'                    => true,
302 302
 		'exclude_from_search'       => false,
303 303
 		'show_in_admin_all_list'    => true,
304 304
 		'show_in_admin_status_list' => true,
305
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ),
306
-	) );
307
-	register_post_status( 'failed', array(
308
-		'label'                     => esc_html__( 'Failed', 'give' ),
305
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'),
306
+	));
307
+	register_post_status('failed', array(
308
+		'label'                     => esc_html__('Failed', 'give'),
309 309
 		'public'                    => true,
310 310
 		'exclude_from_search'       => false,
311 311
 		'show_in_admin_all_list'    => true,
312 312
 		'show_in_admin_status_list' => true,
313
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ),
314
-	) );
315
-	register_post_status( 'revoked', array(
316
-		'label'                     => esc_html__( 'Revoked', 'give' ),
313
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'),
314
+	));
315
+	register_post_status('revoked', array(
316
+		'label'                     => esc_html__('Revoked', 'give'),
317 317
 		'public'                    => true,
318 318
 		'exclude_from_search'       => false,
319 319
 		'show_in_admin_all_list'    => true,
320 320
 		'show_in_admin_status_list' => true,
321
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ),
322
-	) );
323
-	register_post_status( 'cancelled', array(
324
-		'label'                     => esc_html__( 'Cancelled', 'give' ),
321
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'),
322
+	));
323
+	register_post_status('cancelled', array(
324
+		'label'                     => esc_html__('Cancelled', 'give'),
325 325
 		'public'                    => true,
326 326
 		'exclude_from_search'       => false,
327 327
 		'show_in_admin_all_list'    => true,
328 328
 		'show_in_admin_status_list' => true,
329
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ),
330
-	) );
331
-	register_post_status( 'abandoned', array(
332
-		'label'                     => esc_html__( 'Abandoned', 'give' ),
329
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'),
330
+	));
331
+	register_post_status('abandoned', array(
332
+		'label'                     => esc_html__('Abandoned', 'give'),
333 333
 		'public'                    => true,
334 334
 		'exclude_from_search'       => false,
335 335
 		'show_in_admin_all_list'    => true,
336 336
 		'show_in_admin_status_list' => true,
337
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ),
338
-	) );
337
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'),
338
+	));
339 339
 
340 340
 }
341 341
 
342
-add_action( 'init', 'give_register_post_type_statuses' );
342
+add_action('init', 'give_register_post_type_statuses');
343 343
 
344 344
 /**
345 345
  * Updated Messages
@@ -352,27 +352,27 @@  discard block
 block discarded – undo
352 352
  *
353 353
  * @return array $messages New post updated messages
354 354
  */
355
-function give_updated_messages( $messages ) {
355
+function give_updated_messages($messages) {
356 356
 	global $post, $post_ID;
357 357
 
358
-	if ( give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) {
358
+	if (give_is_setting_enabled(give_get_option('forms_singular'))) {
359 359
 
360 360
 		$messages['give_forms'] = array(
361
-			1 => esc_html__( 'Form updated.', 'give' ),
362
-			4 => esc_html__( 'Form updated.', 'give' ),
363
-			6 => esc_html__( 'Form published.', 'give' ),
364
-			7 => esc_html__( 'Form saved.', 'give' ),
365
-			8 => esc_html__( 'Form submitted.', 'give' ),
361
+			1 => esc_html__('Form updated.', 'give'),
362
+			4 => esc_html__('Form updated.', 'give'),
363
+			6 => esc_html__('Form published.', 'give'),
364
+			7 => esc_html__('Form saved.', 'give'),
365
+			8 => esc_html__('Form submitted.', 'give'),
366 366
 		);
367 367
 
368 368
 	} else {
369 369
 
370 370
 		$messages['give_forms'] = array(
371
-			1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
372
-			4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form updated.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
373
-			6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form published.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
374
-			7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form saved.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
375
-			8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', esc_html__( 'Form submitted.', 'give' ), get_permalink( $post_ID ), esc_html__( 'View Form', 'give' ) ),
371
+			1 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
372
+			4 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form updated.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
373
+			6 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form published.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
374
+			7 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form saved.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
375
+			8 => sprintf('%1$s <a href="%2$s">%3$s</a>', esc_html__('Form submitted.', 'give'), get_permalink($post_ID), esc_html__('View Form', 'give')),
376 376
 		);
377 377
 
378 378
 	}
@@ -380,27 +380,27 @@  discard block
 block discarded – undo
380 380
 	return $messages;
381 381
 }
382 382
 
383
-add_filter( 'post_updated_messages', 'give_updated_messages' );
383
+add_filter('post_updated_messages', 'give_updated_messages');
384 384
 
385 385
 
386 386
 /**
387 387
  * Setup Post Type Images
388 388
  */
389
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
389
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
390 390
 
391 391
 /**
392 392
  * Ensure post thumbnail support is turned on
393 393
  */
394 394
 function give_add_thumbnail_support() {
395
-	if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) {
395
+	if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) {
396 396
 		return;
397 397
 	}
398 398
 
399
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
400
-		add_theme_support( 'post-thumbnails' );
399
+	if ( ! current_theme_supports('post-thumbnails')) {
400
+		add_theme_support('post-thumbnails');
401 401
 	}
402 402
 
403
-	add_post_type_support( 'give_forms', 'thumbnail' );
403
+	add_post_type_support('give_forms', 'thumbnail');
404 404
 }
405 405
 
406 406
 /**
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
 
413 413
 	// Single Give Forms (disabled if single turned off in settings)
414 414
 	if (
415
-		give_is_setting_enabled( give_get_option( 'forms_singular' ) )
416
-		&& give_is_setting_enabled( give_get_option( 'form_sidebar' ) )
415
+		give_is_setting_enabled(give_get_option('forms_singular'))
416
+		&& give_is_setting_enabled(give_get_option('form_sidebar'))
417 417
 	) {
418 418
 
419
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
420
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
419
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
420
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
421 421
 			'id'            => 'give-forms-sidebar',
422
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
422
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
423 423
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
424 424
 			'after_widget'  => '</div>',
425 425
 			'before_title'  => '<h3 class="widgettitle widget-title">',
426 426
 			'after_title'   => '</h3>',
427
-		) ) );
427
+		)));
428 428
 
429 429
 	}
430 430
 }
431 431
 
432
-add_action( 'widgets_init', 'give_widgets_init', 999 );
432
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 3 patches
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -641,9 +641,12 @@  discard block
 block discarded – undo
641 641
 							<a href="#<?php echo $form_data_tab['id']; ?>">
642 642
 								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
643 643
 									<?php echo $form_data_tab['icon-html']; ?>
644
-								<?php else : ?>
644
+								<?php else {
645
+	: ?>
645 646
 									<span class="give-icon give-icon-default"></span>
646
-								<?php endif; ?>
647
+								<?php endif;
648
+}
649
+?>
647 650
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
648 651
 							</a>
649 652
 							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
@@ -653,9 +656,12 @@  discard block
 block discarded – undo
653 656
 											<a href="#<?php echo $sub_tab['id']; ?>">
654 657
 												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
655 658
 													<?php echo $sub_tab['icon-html']; ?>
656
-												<?php else : ?>
659
+												<?php else {
660
+	: ?>
657 661
 													<span class="give-icon give-icon-default"></span>
658
-												<?php endif; ?>
662
+												<?php endif;
663
+}
664
+?>
659 665
 												<span class="give-label"><?php echo $sub_tab['label']; ?></span>
660 666
 											</a>
661 667
 										</li>
@@ -682,11 +688,14 @@  discard block
 block discarded – undo
682 688
 						</div>
683 689
 
684 690
 						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
685
-					<?php else: ?>
691
+					<?php else {
692
+	: ?>
686 693
 						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
687 694
 							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
688 695
 								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
689
-									<div id="<?php echo $sub_fields['id']; ?>"
696
+									<div id="<?php echo $sub_fields['id'];
697
+}
698
+?>"
690 699
 										 class="panel give_options_panel give-hidden">
691 700
 										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
692 701
 											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 						'desc'       => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
400 400
 						'id'         => $prefix . 'form_goal_achieved_message',
401 401
 						'type'       => 'wysiwyg',
402
-                        'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
402
+						'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
403 403
 					),
404 404
 					array(
405 405
 						'name'  => 'donation_goal_docs',
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
 						<div id="<?php echo $setting['id']; ?>"
673 673
 							 class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
674
-						     $show_first_tab_content = false; ?>">
674
+							 $show_first_tab_content = false; ?>">
675 675
 							<?php if ( ! empty( $setting['fields'] ) ) : ?>
676 676
 								<?php foreach ( $setting['fields'] as $field ) : ?>
677 677
 									<?php give_render_field( $field ); ?>
Please login to merge, or discard this patch.
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = esc_html__( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = esc_html__('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 30);
56 56
 
57 57
 		// Load required scripts.
58
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
58
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_script'));
59 59
 
60 60
 		// Save form meta.
61
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
61
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
62 62
 
63 63
 		// cmb2 old setting loaders.
64 64
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
65 65
 		// Add offline donations options.
66
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
66
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
67 67
 	}
68 68
 
69 69
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	function get_settings() {
88 88
 		$post_id               = give_get_admin_post_id();
89
-		$price                 = give_get_form_price( $post_id );
90
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
91
-		$goal                  = give_get_form_goal( $post_id );
89
+		$price                 = give_get_form_price($post_id);
90
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
91
+		$goal                  = give_get_form_goal($post_id);
92 92
 
93 93
 		// No empty prices - min. 1.00 for new forms
94
-		if ( empty( $price ) && is_null( $post_id ) ) {
95
-			$price = esc_attr( give_format_decimal( '1.00' ) );
94
+		if (empty($price) && is_null($post_id)) {
95
+			$price = esc_attr(give_format_decimal('1.00'));
96 96
 		}
97 97
 
98 98
 		// Min. $1.00 for new forms
99
-		if ( empty( $custom_amount_minimum ) ) {
100
-			$custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) );
99
+		if (empty($custom_amount_minimum)) {
100
+			$custom_amount_minimum = esc_attr(give_format_decimal('1.00'));
101 101
 		}
102 102
 
103 103
 		// Start with an underscore to hide fields from custom fields list
@@ -107,215 +107,215 @@  discard block
 block discarded – undo
107 107
 			/**
108 108
 			 * Repeatable Field Groups
109 109
 			 */
110
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
110
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
111 111
 				'id'        => 'form_field_options',
112
-				'title'     => esc_html__( 'Donation Options', 'give' ),
112
+				'title'     => esc_html__('Donation Options', 'give'),
113 113
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
114
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
114
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
115 115
 					// Donation Option
116 116
 					array(
117
-						'name'        => esc_html__( 'Donation Option', 'give' ),
118
-						'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
119
-						'id'          => $prefix . 'price_option',
117
+						'name'        => esc_html__('Donation Option', 'give'),
118
+						'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
119
+						'id'          => $prefix.'price_option',
120 120
 						'type'        => 'radio_inline',
121 121
 						'default'     => 'set',
122
-						'options'     => apply_filters( 'give_forms_price_options', array(
123
-							'set'   => esc_html__( 'Set Donation', 'give' ),
124
-							'multi' => esc_html__( 'Multi-level Donation', 'give' ),
125
-						) ),
122
+						'options'     => apply_filters('give_forms_price_options', array(
123
+							'set'   => esc_html__('Set Donation', 'give'),
124
+							'multi' => esc_html__('Multi-level Donation', 'give'),
125
+						)),
126 126
 					),
127 127
 					array(
128
-						'name'        => esc_html__( 'Set Donation', 'give' ),
129
-						'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
130
-						'id'          => $prefix . 'set_price',
128
+						'name'        => esc_html__('Set Donation', 'give'),
129
+						'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
130
+						'id'          => $prefix.'set_price',
131 131
 						'type'        => 'text_small',
132 132
 						'data_type'   => 'price',
133 133
 						'attributes'  => array(
134
-							'placeholder' => give_format_decimal( '1.00' ),
135
-							'value'       => give_format_decimal( $price ),
134
+							'placeholder' => give_format_decimal('1.00'),
135
+							'value'       => give_format_decimal($price),
136 136
 							'class'       => 'give-money-field',
137 137
 						),
138 138
 					),
139 139
 					// Display Style
140 140
 					array(
141
-						'name'        => esc_html__( 'Display Style', 'give' ),
142
-						'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
143
-						'id'          => $prefix . 'display_style',
141
+						'name'        => esc_html__('Display Style', 'give'),
142
+						'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
143
+						'id'          => $prefix.'display_style',
144 144
 						'type'        => 'radio_inline',
145 145
 						'default'     => 'buttons',
146 146
 						'options'     => array(
147
-							'buttons'  => esc_html__( 'Buttons', 'give' ),
148
-							'radios'   => esc_html__( 'Radios', 'give' ),
149
-							'dropdown' => esc_html__( 'Dropdown', 'give' ),
147
+							'buttons'  => esc_html__('Buttons', 'give'),
148
+							'radios'   => esc_html__('Radios', 'give'),
149
+							'dropdown' => esc_html__('Dropdown', 'give'),
150 150
 						),
151 151
 					),
152 152
 					// Custom Amount
153 153
 					array(
154
-						'name'        => esc_html__( 'Custom Amount', 'give' ),
155
-						'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
156
-						'id'          => $prefix . 'custom_amount',
154
+						'name'        => esc_html__('Custom Amount', 'give'),
155
+						'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
156
+						'id'          => $prefix.'custom_amount',
157 157
 						'type'        => 'radio_inline',
158 158
 						'default'     => 'disabled',
159 159
 						'options'     => array(
160
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
161
-							'disabled' => esc_html__( 'Disabled', 'give' ),
160
+							'enabled'  => esc_html__('Enabled', 'give'),
161
+							'disabled' => esc_html__('Disabled', 'give'),
162 162
 						),
163 163
 					),
164 164
 					array(
165
-						'name'        => esc_html__( 'Minimum Amount', 'give' ),
166
-						'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ),
167
-						'id'          => $prefix . 'custom_amount_minimum',
165
+						'name'        => esc_html__('Minimum Amount', 'give'),
166
+						'description' => esc_html__('Enter the minimum custom donation amount.', 'give'),
167
+						'id'          => $prefix.'custom_amount_minimum',
168 168
 						'type'        => 'text_small',
169 169
 						'data_type'   => 'price',
170 170
 						'attributes'  => array(
171
-							'placeholder' => give_format_decimal( '1.00' ),
172
-							'value'       => give_format_decimal( $custom_amount_minimum ),
171
+							'placeholder' => give_format_decimal('1.00'),
172
+							'value'       => give_format_decimal($custom_amount_minimum),
173 173
 							'class'       => 'give-money-field',
174 174
 						),
175 175
 					),
176 176
 					array(
177
-						'name'        => esc_html__( 'Custom Amount Text', 'give' ),
178
-						'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
179
-						'id'          => $prefix . 'custom_amount_text',
177
+						'name'        => esc_html__('Custom Amount Text', 'give'),
178
+						'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
179
+						'id'          => $prefix.'custom_amount_text',
180 180
 						'type'        => 'text_medium',
181 181
 						'attributes'  => array(
182 182
 							'rows'        => 3,
183
-							'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
183
+							'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
184 184
 						),
185 185
 					),
186 186
 					// Donation Levels: Repeatable CMB2 Group
187 187
 					array(
188
-						'id'      => $prefix . 'donation_levels',
188
+						'id'      => $prefix.'donation_levels',
189 189
 						'type'    => 'group',
190 190
 						'options' => array(
191
-							'add_button'    => esc_html__( 'Add Level', 'give' ),
192
-							'header_title'  => esc_html__( 'Donation Level', 'give' ),
191
+							'add_button'    => esc_html__('Add Level', 'give'),
192
+							'header_title'  => esc_html__('Donation Level', 'give'),
193 193
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
194 194
 						),
195 195
 						// Fields array works the same, except id's only need to be unique for this group.
196 196
 						// Prefix is not needed.
197
-						'fields'  => apply_filters( 'give_donation_levels_table_row', array(
197
+						'fields'  => apply_filters('give_donation_levels_table_row', array(
198 198
 							array(
199
-								'name' => esc_html__( 'ID', 'give' ),
200
-								'id'   => $prefix . 'id',
199
+								'name' => esc_html__('ID', 'give'),
200
+								'id'   => $prefix.'id',
201 201
 								'type' => 'levels_id',
202 202
 							),
203 203
 							array(
204
-								'name'       => esc_html__( 'Amount', 'give' ),
205
-								'id'         => $prefix . 'amount',
204
+								'name'       => esc_html__('Amount', 'give'),
205
+								'id'         => $prefix.'amount',
206 206
 								'type'       => 'text_small',
207 207
 								'data_type'  => 'price',
208 208
 								'attributes' => array(
209
-									'placeholder' => give_format_decimal( '1.00' ),
209
+									'placeholder' => give_format_decimal('1.00'),
210 210
 									'class'       => 'give-money-field',
211 211
 								),
212 212
 							),
213 213
 							array(
214
-								'name'       => esc_html__( 'Text', 'give' ),
215
-								'id'         => $prefix . 'text',
214
+								'name'       => esc_html__('Text', 'give'),
215
+								'id'         => $prefix.'text',
216 216
 								'type'       => 'text',
217 217
 								'attributes' => array(
218
-									'placeholder' => esc_html__( 'Donation Level', 'give' ),
218
+									'placeholder' => esc_html__('Donation Level', 'give'),
219 219
 									'class'       => 'give-multilevel-text-field',
220 220
 								),
221 221
 							),
222 222
 							array(
223
-								'name' => esc_html__( 'Default', 'give' ),
224
-								'id'   => $prefix . 'default',
223
+								'name' => esc_html__('Default', 'give'),
224
+								'id'   => $prefix.'default',
225 225
 								'type' => 'give_default_radio_inline',
226 226
 							),
227
-						) ),
227
+						)),
228 228
 					),
229 229
 					array(
230 230
 						'name'  => 'donation_options_docs',
231 231
 						'type'  => 'docs_link',
232 232
 						'url'   => 'http://docs.givewp.com/form-donation-options',
233
-						'title' => esc_html__( 'Donation Options', 'give' ),
233
+						'title' => esc_html__('Donation Options', 'give'),
234 234
 					),
235 235
 				),
236 236
 					$post_id
237 237
 				),
238
-			) ),
238
+			)),
239 239
 
240 240
 			/**
241 241
 			 * Display Options
242 242
 			 */
243
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
243
+			'form_display_options'  => apply_filters('give_form_display_options', array(
244 244
 					'id'        => 'form_display_options',
245
-					'title'     => esc_html__( 'Form Display', 'give' ),
245
+					'title'     => esc_html__('Form Display', 'give'),
246 246
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
247
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
247
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
248 248
 						array(
249
-							'name'    => esc_html__( 'Display Options', 'give' ),
250
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
251
-							'id'      => $prefix . 'payment_display',
249
+							'name'    => esc_html__('Display Options', 'give'),
250
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
251
+							'id'      => $prefix.'payment_display',
252 252
 							'type'    => 'radio_inline',
253 253
 							'options' => array(
254
-								'onpage' => esc_html__( 'All Fields', 'give' ),
255
-								'modal'  => esc_html__( 'Modal', 'give' ),
256
-								'reveal' => esc_html__( 'Reveal', 'give' ),
257
-								'button' => esc_html__( 'Button', 'give' ),
254
+								'onpage' => esc_html__('All Fields', 'give'),
255
+								'modal'  => esc_html__('Modal', 'give'),
256
+								'reveal' => esc_html__('Reveal', 'give'),
257
+								'button' => esc_html__('Button', 'give'),
258 258
 							),
259 259
 							'default' => 'onpage',
260 260
 						),
261 261
 						array(
262
-							'id'         => $prefix . 'reveal_label',
263
-							'name'       => esc_html__( 'Continue Button', 'give' ),
264
-							'desc'       => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ),
262
+							'id'         => $prefix.'reveal_label',
263
+							'name'       => esc_html__('Continue Button', 'give'),
264
+							'desc'       => esc_html__('The button label for displaying the additional payment fields.', 'give'),
265 265
 							'type'       => 'text_small',
266 266
 							'attributes' => array(
267
-								'placeholder' => esc_attr__( 'Donate Now', 'give' ),
267
+								'placeholder' => esc_attr__('Donate Now', 'give'),
268 268
 							),
269 269
 						),
270 270
 						array(
271
-							'id'         => $prefix . 'checkout_label',
272
-							'name'       => esc_html__( 'Submit Button', 'give' ),
273
-							'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
271
+							'id'         => $prefix.'checkout_label',
272
+							'name'       => esc_html__('Submit Button', 'give'),
273
+							'desc'       => esc_html__('The button label for completing a donation.', 'give'),
274 274
 							'type'       => 'text_small',
275 275
 							'attributes' => array(
276
-								'placeholder' => esc_html__( 'Donate Now', 'give' ),
276
+								'placeholder' => esc_html__('Donate Now', 'give'),
277 277
 							),
278 278
 						),
279 279
 						array(
280
-							'name' => esc_html__( 'Default Gateway', 'give' ),
281
-							'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
282
-							'id'   => $prefix . 'default_gateway',
280
+							'name' => esc_html__('Default Gateway', 'give'),
281
+							'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
282
+							'id'   => $prefix.'default_gateway',
283 283
 							'type' => 'default_gateway',
284 284
 						),
285 285
 						array(
286
-							'name'    => esc_html__( 'Guest Donations', 'give' ),
287
-							'desc'    => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
288
-							'id'      => $prefix . 'logged_in_only',
286
+							'name'    => esc_html__('Guest Donations', 'give'),
287
+							'desc'    => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'),
288
+							'id'      => $prefix.'logged_in_only',
289 289
 							'type'    => 'radio_inline',
290 290
 							'default' => 'enabled',
291 291
 							'options' => array(
292
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
293
-								'disabled' => esc_html__( 'Disabled', 'give' ),
292
+								'enabled'  => esc_html__('Enabled', 'give'),
293
+								'disabled' => esc_html__('Disabled', 'give'),
294 294
 							),
295 295
 						),
296 296
 						array(
297
-							'name'    => esc_html__( 'Registration', 'give' ),
298
-							'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
299
-							'id'      => $prefix . 'show_register_form',
297
+							'name'    => esc_html__('Registration', 'give'),
298
+							'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
299
+							'id'      => $prefix.'show_register_form',
300 300
 							'type'    => 'radio',
301 301
 							'options' => array(
302
-								'none'         => esc_html__( 'None', 'give' ),
303
-								'registration' => esc_html__( 'Registration', 'give' ),
304
-								'login'        => esc_html__( 'Login', 'give' ),
305
-								'both'         => esc_html__( 'Registration + Login', 'give' ),
302
+								'none'         => esc_html__('None', 'give'),
303
+								'registration' => esc_html__('Registration', 'give'),
304
+								'login'        => esc_html__('Login', 'give'),
305
+								'both'         => esc_html__('Registration + Login', 'give'),
306 306
 							),
307 307
 							'default' => 'none',
308 308
 						),
309 309
 						array(
310
-							'name'    => esc_html__( 'Floating Labels', 'give' ),
310
+							'name'    => esc_html__('Floating Labels', 'give'),
311 311
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
312
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
313
-							'id'      => $prefix . 'form_floating_labels',
312
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
313
+							'id'      => $prefix.'form_floating_labels',
314 314
 							'type'    => 'radio_inline',
315 315
 							'options' => array(
316
-								'global'   => esc_html__( 'Global Option', 'give' ),
317
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
318
-								'disabled' => esc_html__( 'Disabled', 'give' ),
316
+								'global'   => esc_html__('Global Option', 'give'),
317
+								'enabled'  => esc_html__('Enabled', 'give'),
318
+								'disabled' => esc_html__('Disabled', 'give'),
319 319
 							),
320 320
 							'default' => 'global',
321 321
 						),
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 							'name'  => 'form_display_docs',
324 324
 							'type'  => 'docs_link',
325 325
 							'url'   => 'http://docs.givewp.com/form-display-options',
326
-							'title' => esc_html__( 'Form Display', 'give' ),
326
+							'title' => esc_html__('Form Display', 'give'),
327 327
 						),
328 328
 					),
329 329
 						$post_id
@@ -334,191 +334,191 @@  discard block
 block discarded – undo
334 334
 			/**
335 335
 			 * Donation Goals
336 336
 			 */
337
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
337
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
338 338
 				'id'        => 'donation_goal_options',
339
-				'title'     => esc_html__( 'Donation Goal', 'give' ),
339
+				'title'     => esc_html__('Donation Goal', 'give'),
340 340
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
341
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
341
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
342 342
 					// Goals
343 343
 					array(
344
-						'name'        => esc_html__( 'Donation Goal', 'give' ),
345
-						'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
346
-						'id'          => $prefix . 'goal_option',
344
+						'name'        => esc_html__('Donation Goal', 'give'),
345
+						'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
346
+						'id'          => $prefix.'goal_option',
347 347
 						'type'        => 'radio_inline',
348 348
 						'default'     => 'disabled',
349 349
 						'options'     => array(
350
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
351
-							'disabled' => esc_html__( 'Disabled', 'give' ),
350
+							'enabled'  => esc_html__('Enabled', 'give'),
351
+							'disabled' => esc_html__('Disabled', 'give'),
352 352
 						),
353 353
 					),
354 354
 					array(
355
-						'name'        => esc_html__( 'Goal Amount', 'give' ),
356
-						'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
357
-						'id'          => $prefix . 'set_goal',
355
+						'name'        => esc_html__('Goal Amount', 'give'),
356
+						'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'),
357
+						'id'          => $prefix.'set_goal',
358 358
 						'type'        => 'text_small',
359 359
 						'data_type'   => 'price',
360 360
 						'attributes'  => array(
361
-							'placeholder' => give_format_decimal( '0.00' ),
362
-							'value'       => give_format_decimal( $goal ),
361
+							'placeholder' => give_format_decimal('0.00'),
362
+							'value'       => give_format_decimal($goal),
363 363
 							'class'       => 'give-money-field',
364 364
 						),
365 365
 					),
366 366
 
367 367
 					array(
368
-						'name'        => esc_html__( 'Goal Format', 'give' ),
369
-						'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
370
-						'id'          => $prefix . 'goal_format',
368
+						'name'        => esc_html__('Goal Format', 'give'),
369
+						'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
370
+						'id'          => $prefix.'goal_format',
371 371
 						'type'        => 'radio_inline',
372 372
 						'default'     => 'amount',
373 373
 						'options'     => array(
374
-							'amount'     => esc_html__( 'Amount', 'give' ),
375
-							'percentage' => esc_html__( 'Percentage', 'give' ),
374
+							'amount'     => esc_html__('Amount', 'give'),
375
+							'percentage' => esc_html__('Percentage', 'give'),
376 376
 						),
377 377
 					),
378 378
 					array(
379
-						'name'    => esc_html__( 'Progress Bar Color', 'give' ),
380
-						'desc'    => esc_html__( 'Customize the color of the goal progress bar.', 'give' ),
381
-						'id'      => $prefix . 'goal_color',
379
+						'name'    => esc_html__('Progress Bar Color', 'give'),
380
+						'desc'    => esc_html__('Customize the color of the goal progress bar.', 'give'),
381
+						'id'      => $prefix.'goal_color',
382 382
 						'type'    => 'colorpicker',
383 383
 						'default' => '#2bc253',
384 384
 					),
385 385
 
386 386
 					array(
387
-						'name'    => esc_html__( 'Close Form', 'give' ),
388
-						'desc'    => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
389
-						'id'      => $prefix . 'close_form_when_goal_achieved',
387
+						'name'    => esc_html__('Close Form', 'give'),
388
+						'desc'    => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
389
+						'id'      => $prefix.'close_form_when_goal_achieved',
390 390
 						'type'    => 'radio_inline',
391 391
 						'default' => 'disabled',
392 392
 						'options' => array(
393
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
394
-							'disabled' => esc_html__( 'Disabled', 'give' ),
393
+							'enabled'  => esc_html__('Enabled', 'give'),
394
+							'disabled' => esc_html__('Disabled', 'give'),
395 395
 						),
396 396
 					),
397 397
 					array(
398
-						'name'       => __( 'Goal Achieved Message', 'give' ),
399
-						'desc'       => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
400
-						'id'         => $prefix . 'form_goal_achieved_message',
398
+						'name'       => __('Goal Achieved Message', 'give'),
399
+						'desc'       => __('Do you want to display a custom message when the goal is closed?', 'give'),
400
+						'id'         => $prefix.'form_goal_achieved_message',
401 401
 						'type'       => 'wysiwyg',
402
-                        'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
402
+                        'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
403 403
 					),
404 404
 					array(
405 405
 						'name'  => 'donation_goal_docs',
406 406
 						'type'  => 'docs_link',
407 407
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
408
-						'title' => esc_html__( 'Donation Goal', 'give' ),
408
+						'title' => esc_html__('Donation Goal', 'give'),
409 409
 					),
410 410
 				),
411 411
 					$post_id
412 412
 				),
413
-			) ),
413
+			)),
414 414
 
415 415
 			/**
416 416
 			 * Content Field
417 417
 			 */
418
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
418
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
419 419
 				'id'        => 'form_content_options',
420
-				'title'     => esc_html__( 'Form Content', 'give' ),
420
+				'title'     => esc_html__('Form Content', 'give'),
421 421
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
422
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
422
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
423 423
 
424 424
 					// Donation content.
425 425
 					array(
426
-						'name'        => esc_html__( 'Display Content', 'give' ),
427
-						'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ),
428
-						'id'          => $prefix . 'display_content',
426
+						'name'        => esc_html__('Display Content', 'give'),
427
+						'description' => esc_html__('Do you want to add custom content to this form?', 'give'),
428
+						'id'          => $prefix.'display_content',
429 429
 						'type'        => 'radio_inline',
430 430
 						'options'     => array(
431
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
432
-							'disabled' => esc_html__( 'Disabled', 'give' ),
431
+							'enabled'  => esc_html__('Enabled', 'give'),
432
+							'disabled' => esc_html__('Disabled', 'give'),
433 433
 						),
434 434
 						'default'     => 'disabled',
435 435
 					),
436 436
 
437 437
 					// Content placement.
438 438
 					array(
439
-						'name'        => esc_html__( 'Content Placement', 'give' ),
440
-						'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ),
441
-						'id'          => $prefix . 'content_placement',
439
+						'name'        => esc_html__('Content Placement', 'give'),
440
+						'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'),
441
+						'id'          => $prefix.'content_placement',
442 442
 						'type'        => 'radio_inline',
443
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
444
-								'give_pre_form'  => esc_html__( 'Above fields', 'give' ),
445
-								'give_post_form' => esc_html__( 'Below fields', 'give' ),
443
+						'options'     => apply_filters('give_forms_content_options_select', array(
444
+								'give_pre_form'  => esc_html__('Above fields', 'give'),
445
+								'give_post_form' => esc_html__('Below fields', 'give'),
446 446
 							)
447 447
 						),
448 448
 						'default'     => 'give_pre_form',
449 449
 					),
450 450
 					array(
451
-						'name'        => esc_html__( 'Content', 'give' ),
452
-						'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
453
-						'id'          => $prefix . 'form_content',
451
+						'name'        => esc_html__('Content', 'give'),
452
+						'description' => esc_html__('This content will display on the single give form page.', 'give'),
453
+						'id'          => $prefix.'form_content',
454 454
 						'type'        => 'wysiwyg',
455 455
 					),
456 456
 					array(
457 457
 						'name'  => 'form_content_docs',
458 458
 						'type'  => 'docs_link',
459 459
 						'url'   => 'http://docs.givewp.com/form-content',
460
-						'title' => esc_html__( 'Form Content', 'give' ),
460
+						'title' => esc_html__('Form Content', 'give'),
461 461
 					),
462 462
 				),
463 463
 					$post_id
464 464
 				),
465
-			) ),
465
+			)),
466 466
 
467 467
 			/**
468 468
 			 * Terms & Conditions
469 469
 			 */
470
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
470
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
471 471
 				'id'        => 'form_terms_options',
472
-				'title'     => esc_html__( 'Terms & Conditions', 'give' ),
472
+				'title'     => esc_html__('Terms & Conditions', 'give'),
473 473
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
474
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
474
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
475 475
 					// Donation Option
476 476
 					array(
477
-						'name'        => esc_html__( 'Terms and Conditions', 'give' ),
478
-						'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
479
-						'id'          => $prefix . 'terms_option',
477
+						'name'        => esc_html__('Terms and Conditions', 'give'),
478
+						'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
479
+						'id'          => $prefix.'terms_option',
480 480
 						'type'        => 'radio_inline',
481
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
482
-								'global'   => esc_html__( 'Global Option', 'give' ),
483
-								'enabled'  => esc_html__( 'Customize', 'give' ),
484
-								'disabled' => esc_html__( 'Disable', 'give' ),
481
+						'options'     => apply_filters('give_forms_content_options_select', array(
482
+								'global'   => esc_html__('Global Option', 'give'),
483
+								'enabled'  => esc_html__('Customize', 'give'),
484
+								'disabled' => esc_html__('Disable', 'give'),
485 485
 							)
486 486
 						),
487 487
 						'default'     => 'global',
488 488
 					),
489 489
 					array(
490
-						'id'         => $prefix . 'agree_label',
491
-						'name'       => esc_html__( 'Agreement Label', 'give' ),
492
-						'desc'       => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
490
+						'id'         => $prefix.'agree_label',
491
+						'name'       => esc_html__('Agreement Label', 'give'),
492
+						'desc'       => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
493 493
 						'type'       => 'text',
494 494
 						'size'       => 'regular',
495 495
 						'attributes' => array(
496
-							'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
496
+							'placeholder' => esc_attr__('Agree to Terms?', 'give'),
497 497
 						),
498 498
 					),
499 499
 					array(
500
-						'id'   => $prefix . 'agree_text',
501
-						'name' => esc_html__( 'Agreement Text', 'give' ),
502
-						'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
500
+						'id'   => $prefix.'agree_text',
501
+						'name' => esc_html__('Agreement Text', 'give'),
502
+						'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
503 503
 						'type' => 'wysiwyg',
504 504
 					),
505 505
 					array(
506 506
 						'name'  => 'terms_docs',
507 507
 						'type'  => 'docs_link',
508 508
 						'url'   => 'http://docs.givewp.com/form-terms',
509
-						'title' => esc_html__( 'Terms and Conditions', 'give' ),
509
+						'title' => esc_html__('Terms and Conditions', 'give'),
510 510
 					),
511 511
 				),
512 512
 					$post_id
513 513
 				),
514
-			) ),
514
+			)),
515 515
 		);
516 516
 
517 517
 
518 518
 		/**
519 519
 		 * Filter the metabox tabbed panel settings.
520 520
 		 */
521
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
521
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
522 522
 
523 523
 		// Output.
524 524
 		return $settings;
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 		add_meta_box(
535 535
 			$this->get_metabox_ID(),
536 536
 			$this->get_metabox_label(),
537
-			array( $this, 'output' ),
538
-			array( 'give_forms' ),
537
+			array($this, 'output'),
538
+			array('give_forms'),
539 539
 			'normal',
540 540
 			'high'
541 541
 		);
@@ -551,9 +551,9 @@  discard block
 block discarded – undo
551 551
 	function enqueue_script() {
552 552
 		global $post;
553 553
 
554
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
555
-			wp_enqueue_style( 'wp-color-picker' );
556
-			wp_enqueue_script( 'wp-color-picker' );
554
+		if (is_object($post) && 'give_forms' === $post->post_type) {
555
+			wp_enqueue_style('wp-color-picker');
556
+			wp_enqueue_script('wp-color-picker');
557 557
 		}
558 558
 	}
559 559
 
@@ -587,32 +587,32 @@  discard block
 block discarded – undo
587 587
 	public function get_tabs() {
588 588
 		$tabs = array();
589 589
 
590
-		if ( ! empty( $this->settings ) ) {
591
-			foreach ( $this->settings as $setting ) {
592
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
590
+		if ( ! empty($this->settings)) {
591
+			foreach ($this->settings as $setting) {
592
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
593 593
 					continue;
594 594
 				}
595 595
 				$tab = array(
596 596
 					'id'        => $setting['id'],
597 597
 					'label'     => $setting['title'],
598
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
598
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
599 599
 				);
600 600
 
601
-				if ( $this->has_sub_tab( $setting ) ) {
602
-					if ( empty( $setting['sub-fields'] ) ) {
601
+				if ($this->has_sub_tab($setting)) {
602
+					if (empty($setting['sub-fields'])) {
603 603
 						$tab = array();
604 604
 					} else {
605
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
605
+						foreach ($setting['sub-fields'] as $sub_fields) {
606 606
 							$tab['sub-fields'][] = array(
607 607
 								'id'        => $sub_fields['id'],
608 608
 								'label'     => $sub_fields['title'],
609
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
609
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
610 610
 							);
611 611
 						}
612 612
 					}
613 613
 				}
614 614
 
615
-				if ( ! empty( $tab ) ) {
615
+				if ( ! empty($tab)) {
616 616
 					$tabs[] = $tab;
617 617
 				}
618 618
 			}
@@ -629,27 +629,27 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	public function output() {
631 631
 		// Bailout.
632
-		if ( $form_data_tabs = $this->get_tabs() ) {
633
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
632
+		if ($form_data_tabs = $this->get_tabs()) {
633
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
634 634
 			?>
635 635
 			<div class="give-metabox-panel-wrap">
636 636
 				<ul class="give-form-data-tabs give-metabox-tabs">
637
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
638
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
637
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
638
+						<li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
639 639
 							<a href="#<?php echo $form_data_tab['id']; ?>">
640
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
640
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
641 641
 									<?php echo $form_data_tab['icon-html']; ?>
642 642
 								<?php else : ?>
643 643
 									<span class="give-icon give-icon-default"></span>
644 644
 								<?php endif; ?>
645 645
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
646 646
 							</a>
647
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
647
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
648 648
 								<ul class="give-metabox-sub-tabs give-hidden">
649
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
649
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
650 650
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
651 651
 											<a href="#<?php echo $sub_tab['id']; ?>">
652
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
652
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
653 653
 													<?php echo $sub_tab['icon-html']; ?>
654 654
 												<?php else : ?>
655 655
 													<span class="give-icon give-icon-default"></span>
@@ -665,30 +665,30 @@  discard block
 block discarded – undo
665 665
 				</ul>
666 666
 
667 667
 				<?php $show_first_tab_content = true; ?>
668
-				<?php foreach ( $this->settings as $setting ) : ?>
669
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
670
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
668
+				<?php foreach ($this->settings as $setting) : ?>
669
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
670
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
671 671
 
672 672
 						<div id="<?php echo $setting['id']; ?>"
673
-							 class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
673
+							 class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden');
674 674
 						     $show_first_tab_content = false; ?>">
675
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
676
-								<?php foreach ( $setting['fields'] as $field ) : ?>
677
-									<?php give_render_field( $field ); ?>
675
+							<?php if ( ! empty($setting['fields'])) : ?>
676
+								<?php foreach ($setting['fields'] as $field) : ?>
677
+									<?php give_render_field($field); ?>
678 678
 								<?php endforeach; ?>
679 679
 							<?php endif; ?>
680 680
 						</div>
681 681
 
682
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
682
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
683 683
 					<?php else: ?>
684
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
685
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
686
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
684
+						<?php if ($this->has_sub_tab($setting)) : ?>
685
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
686
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
687 687
 									<div id="<?php echo $sub_fields['id']; ?>"
688 688
 										 class="panel give_options_panel give-hidden">
689
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
690
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
691
-												<?php give_render_field( $sub_field ); ?>
689
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
690
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
691
+												<?php give_render_field($sub_field); ?>
692 692
 											<?php endforeach; ?>
693 693
 										<?php endif; ?>
694 694
 									</div>
@@ -712,9 +712,9 @@  discard block
 block discarded – undo
712 712
 	 *
713 713
 	 * @return bool
714 714
 	 */
715
-	private function has_sub_tab( $field_setting ) {
715
+	private function has_sub_tab($field_setting) {
716 716
 		$has_sub_tab = false;
717
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
717
+		if (array_key_exists('sub-fields', $field_setting)) {
718 718
 			$has_sub_tab = true;
719 719
 		}
720 720
 
@@ -728,13 +728,13 @@  discard block
 block discarded – undo
728 728
 	 * @return array
729 729
 	 */
730 730
 	function cmb2_metabox_settings() {
731
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
731
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
732 732
 		$give_forms_settings = $all_cmb2_settings;
733 733
 
734 734
 		// Filter settings: Use only give forms related settings.
735
-		foreach ( $all_cmb2_settings as $index => $setting ) {
736
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
737
-				unset( $give_forms_settings[ $index ] );
735
+		foreach ($all_cmb2_settings as $index => $setting) {
736
+			if ( ! in_array('give_forms', $setting['object_types'])) {
737
+				unset($give_forms_settings[$index]);
738 738
 			}
739 739
 		}
740 740
 
@@ -752,114 +752,114 @@  discard block
 block discarded – undo
752 752
 	 *
753 753
 	 * @return void
754 754
 	 */
755
-	public function save( $post_id, $post ) {
755
+	public function save($post_id, $post) {
756 756
 
757 757
 		// $post_id and $post are required.
758
-		if ( empty( $post_id ) || empty( $post ) ) {
758
+		if (empty($post_id) || empty($post)) {
759 759
 			return;
760 760
 		}
761 761
 
762 762
 		// Don't save meta boxes for revisions or autosaves.
763
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
763
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
764 764
 			return;
765 765
 		}
766 766
 
767 767
 		// Check the nonce.
768
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
768
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
769 769
 			return;
770 770
 		}
771 771
 
772 772
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
773
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
773
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
774 774
 			return;
775 775
 		}
776 776
 
777 777
 		// Check user has permission to edit.
778
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
778
+		if ( ! current_user_can('edit_post', $post_id)) {
779 779
 			return;
780 780
 		}
781 781
 
782 782
 		// Fire action before saving form meta.
783
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
783
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
784 784
 
785 785
 		/**
786 786
 		 * Filter the meta key to save.
787 787
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
788 788
 		 */
789
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
789
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
790 790
 
791 791
 		// Save form meta data.
792
-		if ( ! empty( $form_meta_keys ) ) {
793
-			foreach ( $form_meta_keys as $form_meta_key ) {
792
+		if ( ! empty($form_meta_keys)) {
793
+			foreach ($form_meta_keys as $form_meta_key) {
794 794
 
795 795
 				// Set default value for checkbox fields.
796 796
 				if (
797
-					! isset( $_POST[ $form_meta_key ] )
798
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
797
+					! isset($_POST[$form_meta_key])
798
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
799 799
 				) {
800
-					$_POST[ $form_meta_key ] = '';
800
+					$_POST[$form_meta_key] = '';
801 801
 				}
802 802
 
803
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
804
-					if ( $field_type = $this->get_field_type( $form_meta_key ) ) {
805
-						switch ( $field_type ) {
803
+				if (isset($_POST[$form_meta_key])) {
804
+					if ($field_type = $this->get_field_type($form_meta_key)) {
805
+						switch ($field_type) {
806 806
 							case 'textarea':
807 807
 							case 'wysiwyg':
808
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
809
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
808
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
809
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
810 810
 								break;
811 811
 
812 812
 							case 'group':
813 813
 								$form_meta_value = array();
814 814
 
815
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
815
+								foreach ($_POST[$form_meta_key] as $index => $group) {
816 816
 
817 817
 									// Do not save template input field values.
818
-									if ( '{{row-count-placeholder}}' === $index ) {
818
+									if ('{{row-count-placeholder}}' === $index) {
819 819
 										continue;
820 820
 									}
821 821
 
822 822
 									$group_meta_value = array();
823
-									foreach ( $group as $field_id => $field_value ) {
824
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
823
+									foreach ($group as $field_id => $field_value) {
824
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
825 825
 											case 'wysiwyg':
826
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
826
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
827 827
 												break;
828 828
 
829 829
 											default:
830
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
830
+												$group_meta_value[$field_id] = give_clean($field_value);
831 831
 										}
832 832
 									}
833 833
 
834
-									if ( ! empty( $group_meta_value ) ) {
835
-										$form_meta_value[ $index ] = $group_meta_value;
834
+									if ( ! empty($group_meta_value)) {
835
+										$form_meta_value[$index] = $group_meta_value;
836 836
 									}
837 837
 								}
838 838
 
839 839
 
840 840
 								// Arrange repeater field keys in order.
841
-								$form_meta_value = array_values( $form_meta_value );
841
+								$form_meta_value = array_values($form_meta_value);
842 842
 
843 843
 								// Save data.
844
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
844
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
845 845
 								break;
846 846
 
847 847
 							default:
848
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
848
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
849 849
 
850 850
 								// Save data.
851
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
851
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
852 852
 						}
853 853
 
854 854
 						// Fire after saving form meta key.
855
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
855
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
856 856
 					}
857 857
 				}
858 858
 			}
859 859
 		}
860 860
 
861 861
 		// Fire action after saving form meta.
862
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
862
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
863 863
 	}
864 864
 
865 865
 
@@ -872,10 +872,10 @@  discard block
 block discarded – undo
872 872
 	 *
873 873
 	 * @return string
874 874
 	 */
875
-	private function get_field_id( $field ) {
875
+	private function get_field_id($field) {
876 876
 		$field_id = '';
877 877
 
878
-		if ( array_key_exists( 'id', $field ) ) {
878
+		if (array_key_exists('id', $field)) {
879 879
 			$field_id = $field['id'];
880 880
 
881 881
 		}
@@ -892,12 +892,12 @@  discard block
 block discarded – undo
892 892
 	 *
893 893
 	 * @return array
894 894
 	 */
895
-	private function get_fields_id( $setting ) {
895
+	private function get_fields_id($setting) {
896 896
 		$meta_keys = array();
897 897
 
898
-		if ( ! empty( $setting ) ) {
899
-			foreach ( $setting['fields'] as $field ) {
900
-				if ( $field_id = $this->get_field_id( $field ) ) {
898
+		if ( ! empty($setting)) {
899
+			foreach ($setting['fields'] as $field) {
900
+				if ($field_id = $this->get_field_id($field)) {
901 901
 					$meta_keys[] = $field_id;
902 902
 				}
903 903
 			}
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 	 *
916 916
 	 * @return array
917 917
 	 */
918
-	private function get_sub_fields_id( $setting ) {
918
+	private function get_sub_fields_id($setting) {
919 919
 		$meta_keys = array();
920 920
 
921
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
922
-			foreach ( $setting['sub-fields'] as $fields ) {
923
-				if ( ! empty( $fields['fields'] ) ) {
924
-					foreach ( $fields['fields'] as $field ) {
925
-						if ( $field_id = $this->get_field_id( $field ) ) {
921
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
922
+			foreach ($setting['sub-fields'] as $fields) {
923
+				if ( ! empty($fields['fields'])) {
924
+					foreach ($fields['fields'] as $field) {
925
+						if ($field_id = $this->get_field_id($field)) {
926 926
 							$meta_keys[] = $field_id;
927 927
 						}
928 928
 					}
@@ -943,14 +943,14 @@  discard block
 block discarded – undo
943 943
 	private function get_meta_keys_from_settings() {
944 944
 		$meta_keys = array();
945 945
 
946
-		foreach ( $this->settings as $setting ) {
947
-			if ( $this->has_sub_tab( $setting ) ) {
948
-				$meta_key = $this->get_sub_fields_id( $setting );
946
+		foreach ($this->settings as $setting) {
947
+			if ($this->has_sub_tab($setting)) {
948
+				$meta_key = $this->get_sub_fields_id($setting);
949 949
 			} else {
950
-				$meta_key = $this->get_fields_id( $setting );
950
+				$meta_key = $this->get_fields_id($setting);
951 951
 			}
952 952
 
953
-			$meta_keys = array_merge( $meta_keys, $meta_key );
953
+			$meta_keys = array_merge($meta_keys, $meta_key);
954 954
 		}
955 955
 
956 956
 		return $meta_keys;
@@ -967,10 +967,10 @@  discard block
 block discarded – undo
967 967
 	 *
968 968
 	 * @return string
969 969
 	 */
970
-	function get_field_type( $field_id, $group_id = '' ) {
971
-		$field = $this->get_setting_field( $field_id, $group_id );
970
+	function get_field_type($field_id, $group_id = '') {
971
+		$field = $this->get_setting_field($field_id, $group_id);
972 972
 
973
-		$type = array_key_exists( 'type', $field )
973
+		$type = array_key_exists('type', $field)
974 974
 			? $field['type']
975 975
 			: '';
976 976
 
@@ -988,12 +988,12 @@  discard block
 block discarded – undo
988 988
 	 *
989 989
 	 * @return array
990 990
 	 */
991
-	private function get_field( $setting, $field_id ) {
991
+	private function get_field($setting, $field_id) {
992 992
 		$setting_field = array();
993 993
 
994
-		if ( ! empty( $setting['fields'] ) ) {
995
-			foreach ( $setting['fields'] as $field ) {
996
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
994
+		if ( ! empty($setting['fields'])) {
995
+			foreach ($setting['fields'] as $field) {
996
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
997 997
 					$setting_field = $field;
998 998
 					break;
999 999
 				}
@@ -1013,12 +1013,12 @@  discard block
 block discarded – undo
1013 1013
 	 *
1014 1014
 	 * @return array
1015 1015
 	 */
1016
-	private function get_sub_field( $setting, $field_id ) {
1016
+	private function get_sub_field($setting, $field_id) {
1017 1017
 		$setting_field = array();
1018 1018
 
1019
-		if ( ! empty( $setting['sub-fields'] ) ) {
1020
-			foreach ( $setting['sub-fields'] as $fields ) {
1021
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1019
+		if ( ! empty($setting['sub-fields'])) {
1020
+			foreach ($setting['sub-fields'] as $fields) {
1021
+				if ($field = $this->get_field($fields, $field_id)) {
1022 1022
 					$setting_field = $field;
1023 1023
 					break;
1024 1024
 				}
@@ -1038,17 +1038,17 @@  discard block
 block discarded – undo
1038 1038
 	 *
1039 1039
 	 * @return array
1040 1040
 	 */
1041
-	function get_setting_field( $field_id, $group_id = '' ) {
1041
+	function get_setting_field($field_id, $group_id = '') {
1042 1042
 		$setting_field = array();
1043 1043
 
1044 1044
 		$_field_id = $field_id;
1045
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1045
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1046 1046
 
1047
-		if ( ! empty( $this->settings ) ) {
1048
-			foreach ( $this->settings as $setting ) {
1047
+		if ( ! empty($this->settings)) {
1048
+			foreach ($this->settings as $setting) {
1049 1049
 				if (
1050
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1051
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1050
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1051
+					|| ($setting_field = $this->get_field($setting, $field_id))
1052 1052
 				) {
1053 1053
 					break;
1054 1054
 				}
@@ -1057,9 +1057,9 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 
1059 1059
 		// Get field from group.
1060
-		if ( ! empty( $group_id ) ) {
1061
-			foreach ( $setting_field['fields'] as $field ) {
1062
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1060
+		if ( ! empty($group_id)) {
1061
+			foreach ($setting_field['fields'] as $field) {
1062
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1063 1063
 					$setting_field = $field;
1064 1064
 				}
1065 1065
 			}
@@ -1078,14 +1078,14 @@  discard block
 block discarded – undo
1078 1078
 	 *
1079 1079
 	 * @return mixed
1080 1080
 	 */
1081
-	function add_offline_donations_setting_tab( $settings ) {
1082
-		if ( give_is_gateway_active( 'offline' ) ) {
1083
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1081
+	function add_offline_donations_setting_tab($settings) {
1082
+		if (give_is_gateway_active('offline')) {
1083
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1084 1084
 				'id'        => 'offline_donations_options',
1085
-				'title'     => esc_html__( 'Offline Donations', 'give' ),
1085
+				'title'     => esc_html__('Offline Donations', 'give'),
1086 1086
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1087
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1088
-			) );
1087
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1088
+			));
1089 1089
 		}
1090 1090
 
1091 1091
 		return $settings;
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 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
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function __construct() {
89 89
 
90
-		if ( 'none' === $this->get_template() ) {
90
+		if ('none' === $this->get_template()) {
91 91
 			$this->html = false;
92 92
 		}
93 93
 
94
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
95
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
94
+		add_action('give_email_send_before', array($this, 'send_before'));
95
+		add_action('give_email_send_after', array($this, 'send_after'));
96 96
 
97 97
 	}
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param $key
105 105
 	 * @param $value
106 106
 	 */
107
-	public function __set( $key, $value ) {
107
+	public function __set($key, $value) {
108 108
 		$this->$key = $value;
109 109
 	}
110 110
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @since 1.0
115 115
 	 */
116 116
 	public function get_from_name() {
117
-		if ( ! $this->from_name ) {
118
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
117
+		if ( ! $this->from_name) {
118
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
119 119
 		}
120 120
 
121
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
121
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @since 1.0
128 128
 	 */
129 129
 	public function get_from_address() {
130
-		if ( ! $this->from_address ) {
131
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
130
+		if ( ! $this->from_address) {
131
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
132 132
 		}
133 133
 
134
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
134
+		return apply_filters('give_email_from_address', $this->from_address, $this);
135 135
 	}
136 136
 
137 137
 	/**
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 * @since 1.0
141 141
 	 */
142 142
 	public function get_content_type() {
143
-		if ( ! $this->content_type && $this->html ) {
144
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
145
-		} else if ( ! $this->html ) {
143
+		if ( ! $this->content_type && $this->html) {
144
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
145
+		} else if ( ! $this->html) {
146 146
 			$this->content_type = 'text/plain';
147 147
 		}
148 148
 
149
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
149
+		return apply_filters('give_email_content_type', $this->content_type, $this);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @since 1.0
156 156
 	 */
157 157
 	public function get_headers() {
158
-		if ( ! $this->headers ) {
158
+		if ( ! $this->headers) {
159 159
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
160 160
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
161 161
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
162 162
 		}
163 163
 
164
-		return apply_filters( 'give_email_headers', $this->headers, $this );
164
+		return apply_filters('give_email_headers', $this->headers, $this);
165 165
 	}
166 166
 
167 167
 	/**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function get_templates() {
173 173
 		$templates = array(
174
-			'default' => esc_html__( 'Default Template', 'give' ),
175
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
174
+			'default' => esc_html__('Default Template', 'give'),
175
+			'none'    => esc_html__('No template, plain text only', 'give')
176 176
 		);
177 177
 
178
-		return apply_filters( 'give_email_templates', $templates );
178
+		return apply_filters('give_email_templates', $templates);
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 * @since 1.0
185 185
 	 */
186 186
 	public function get_template() {
187
-		if ( ! $this->template ) {
188
-			$this->template = give_get_option( 'email_template', 'default' );
187
+		if ( ! $this->template) {
188
+			$this->template = give_get_option('email_template', 'default');
189 189
 		}
190 190
 
191
-		return apply_filters( 'give_email_template', $this->template );
191
+		return apply_filters('give_email_template', $this->template);
192 192
 	}
193 193
 
194 194
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @since 1.0
198 198
 	 */
199 199
 	public function get_heading() {
200
-		return apply_filters( 'give_email_heading', $this->heading );
200
+		return apply_filters('give_email_heading', $this->heading);
201 201
 	}
202 202
 
203 203
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return mixed
209 209
 	 */
210
-	public function parse_tags( $content ) {
210
+	public function parse_tags($content) {
211 211
 		return $content;
212 212
 	}
213 213
 
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function build_email( $message ) {
223
+	public function build_email($message) {
224 224
 
225
-		if ( false === $this->html ) {
226
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
225
+		if (false === $this->html) {
226
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
227 227
 		}
228 228
 
229
-		$message = $this->text_to_html( $message );
229
+		$message = $this->text_to_html($message);
230 230
 
231 231
 		$template = $this->get_template();
232 232
 
233 233
 		ob_start();
234 234
 
235
-		give_get_template_part( 'emails/header', $template, true );
235
+		give_get_template_part('emails/header', $template, true);
236 236
 
237 237
 		/**
238 238
 		 * Fires in the email head.
@@ -241,17 +241,17 @@  discard block
 block discarded – undo
241 241
 		 *
242 242
 		 * @param Give_Emails $this The email object.
243 243
 		 */
244
-		do_action( 'give_email_header', $this );
244
+		do_action('give_email_header', $this);
245 245
 
246
-		if ( has_action( 'give_email_template_' . $template ) ) {
246
+		if (has_action('give_email_template_'.$template)) {
247 247
 			/**
248 248
 			 * Fires in a specific email template.
249 249
 			 *
250 250
 			 * @since 1.0
251 251
 			 */
252
-			do_action( "give_email_template_{$template}" );
252
+			do_action("give_email_template_{$template}");
253 253
 		} else {
254
-			give_get_template_part( 'emails/body', $template, true );
254
+			give_get_template_part('emails/body', $template, true);
255 255
 		}
256 256
 
257 257
 		/**
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 		 *
262 262
 		 * @param Give_Emails $this The email object.
263 263
 		 */
264
-		do_action( 'give_email_body', $this );
264
+		do_action('give_email_body', $this);
265 265
 
266
-		give_get_template_part( 'emails/footer', $template, true );
266
+		give_get_template_part('emails/footer', $template, true);
267 267
 
268 268
 		/**
269 269
 		 * Fires in the email footer.
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @param Give_Emails $this The email object.
274 274
 		 */
275
-		do_action( 'give_email_footer', $this );
275
+		do_action('give_email_footer', $this);
276 276
 
277 277
 		$body    = ob_get_clean();
278
-		$message = str_replace( '{email}', $message, $body );
278
+		$message = str_replace('{email}', $message, $body);
279 279
 
280
-		return apply_filters( 'give_email_message', $message, $this );
280
+		return apply_filters('give_email_message', $message, $this);
281 281
 	}
282 282
 
283 283
 	/**
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return bool
292 292
 	 */
293
-	public function send( $to, $subject, $message, $attachments = '' ) {
293
+	public function send($to, $subject, $message, $attachments = '') {
294 294
 
295
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
296
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
295
+		if ( ! did_action('init') && ! did_action('admin_init')) {
296
+			_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
297 297
 
298 298
 			return false;
299 299
 		}
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @param Give_Emails $this The email object.
307 307
 		 */
308
-		do_action( 'give_email_send_before', $this );
308
+		do_action('give_email_send_before', $this);
309 309
 
310
-		$subject = $this->parse_tags( $subject );
311
-		$message = $this->parse_tags( $message );
310
+		$subject = $this->parse_tags($subject);
311
+		$message = $this->parse_tags($message);
312 312
 
313
-		$message = $this->build_email( $message );
313
+		$message = $this->build_email($message);
314 314
 
315
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
315
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
316 316
 
317
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
317
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
318 318
 
319 319
 		/**
320 320
 		 * Fires after sending an email.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Emails $this The email object.
325 325
 		 */
326
-		do_action( 'give_email_send_after', $this );
326
+		do_action('give_email_send_after', $this);
327 327
 
328 328
 		return $sent;
329 329
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @since 1.0
336 336
 	 */
337 337
 	public function send_before() {
338
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
339
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
340
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
338
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
339
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
340
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
341 341
 	}
342 342
 
343 343
 	/**
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @since 1.0
347 347
 	 */
348 348
 	public function send_after() {
349
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
350
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
351
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
349
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
350
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
351
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
352 352
 
353 353
 		// Reset heading to an empty string
354 354
 		$this->heading = '';
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @since 1.0
361 361
 	 */
362
-	public function text_to_html( $message ) {
362
+	public function text_to_html($message) {
363 363
 
364
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
365
-			$message = wpautop( $message );
364
+		if ('text/html' == $this->content_type || true === $this->html) {
365
+			$message = wpautop($message);
366 366
 		}
367 367
 
368 368
 		return $message;
Please login to merge, or discard this patch.
includes/process-donation.php 1 patch
Spacing   +235 added lines, -235 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_purchase_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array      $_POST      Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_purchase_form_user( $valid_data );
58
+	$user = give_get_purchase_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
103
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
103
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
104 104
 
105 105
 	// Setup donation information
106 106
 	$purchase_data = array(
107 107
 		'price'        => $price,
108 108
 		'purchase_key' => $purchase_key,
109 109
 		'user_email'   => $user['user_email'],
110
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
111
-		'user_info'    => stripslashes_deep( $user_info ),
110
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
111
+		'user_info'    => stripslashes_deep($user_info),
112 112
 		'post_data'    => $_POST,
113 113
 		'gateway'      => $valid_data['gateway'],
114 114
 		'card_info'    => $valid_data['cc_info'],
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param array      $user_info  Array containing basic user information.
129 129
 	 * @param bool|array $valid_data Validate fields.
130 130
 	 */
131
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
131
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
132 132
 
133 133
 	// Sanity check for price
134
-	if ( ! $purchase_data['price'] ) {
134
+	if ( ! $purchase_data['price']) {
135 135
 		// Revert to manual
136 136
 		$purchase_data['gateway'] = 'manual';
137 137
 		$_POST['give-gateway']    = 'manual';
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @since 1.7
144 144
 	 */
145
-	$purchase_data = apply_filters( 'give_donation_data_before_gateway', $purchase_data, $valid_data );
145
+	$purchase_data = apply_filters('give_donation_data_before_gateway', $purchase_data, $valid_data);
146 146
 
147 147
 	// Setup the data we're storing in the donation session
148 148
 	$session_data = $purchase_data;
149 149
 
150 150
 	// Make sure credit card numbers are never stored in sessions
151
-	unset( $session_data['card_info']['card_number'] );
152
-	unset( $session_data['post_data']['card_number'] );
151
+	unset($session_data['card_info']['card_number']);
152
+	unset($session_data['post_data']['card_number']);
153 153
 
154 154
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
155
-	give_set_purchase_session( $session_data );
155
+	give_set_purchase_session($session_data);
156 156
 
157 157
 	// Send info to the gateway for payment processing
158
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
158
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
159 159
 	give_die();
160 160
 
161 161
 }
162 162
 
163
-add_action( 'give_purchase', 'give_process_donation_form' );
164
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
165
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
163
+add_action('give_purchase', 'give_process_donation_form');
164
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
165
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
166 166
 
167 167
 
168 168
 /**
@@ -175,26 +175,26 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_checkout_check_existing_email( $valid_data, $post ) {
178
+function give_checkout_check_existing_email($valid_data, $post) {
179 179
 
180 180
 	// Verify that the email address belongs to this customer.
181
-	if ( is_user_logged_in() ) {
181
+	if (is_user_logged_in()) {
182 182
 
183 183
 		$email    = $valid_data['logged_in_user']['user_email'];
184
-		$customer = new Give_Customer( get_current_user_id(), true );
184
+		$customer = new Give_Customer(get_current_user_id(), true);
185 185
 
186 186
 		// If this email address is not registered with this customer, see if it belongs to any other customer
187
-		if ( $email !== $customer->email && ( is_array( $customer->emails ) && ! in_array( $email, $customer->emails ) ) ) {
188
-			$found_customer = new Give_Customer( $email );
187
+		if ($email !== $customer->email && (is_array($customer->emails) && ! in_array($email, $customer->emails))) {
188
+			$found_customer = new Give_Customer($email);
189 189
 
190
-			if ( $found_customer->id > 0 ) {
191
-				give_set_error( 'give-customer-email-exists', sprintf( esc_html__( 'The email address %s is already in use.', 'give' ), $email ) );
190
+			if ($found_customer->id > 0) {
191
+				give_set_error('give-customer-email-exists', sprintf(esc_html__('The email address %s is already in use.', 'give'), $email));
192 192
 			}
193 193
 		}
194 194
 	}
195 195
 }
196 196
 
197
-add_action( 'give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2 );
197
+add_action('give_checkout_error_checks', 'give_checkout_check_existing_email', 10, 2);
198 198
 
199 199
 /**
200 200
  * Process the checkout login form
@@ -205,37 +205,37 @@  discard block
 block discarded – undo
205 205
  */
206 206
 function give_process_form_login() {
207 207
 
208
-	$is_ajax = isset( $_POST['give_ajax'] );
208
+	$is_ajax = isset($_POST['give_ajax']);
209 209
 
210 210
 	$user_data = give_purchase_form_validate_user_login();
211 211
 
212
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
213
-		if ( $is_ajax ) {
212
+	if (give_get_errors() || $user_data['user_id'] < 1) {
213
+		if ($is_ajax) {
214 214
 			/**
215 215
 			 * Fires when AJAX sends back errors from the donation form.
216 216
 			 *
217 217
 			 * @since 1.0
218 218
 			 */
219
-			do_action( 'give_ajax_donation_errors' );
219
+			do_action('give_ajax_donation_errors');
220 220
 			give_die();
221 221
 		} else {
222
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
222
+			wp_redirect($_SERVER['HTTP_REFERER']);
223 223
 			exit;
224 224
 		}
225 225
 	}
226 226
 
227
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
227
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
228 228
 
229
-	if ( $is_ajax ) {
229
+	if ($is_ajax) {
230 230
 		echo 'success';
231 231
 		give_die();
232 232
 	} else {
233
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
233
+		wp_redirect($_SERVER['HTTP_REFERER']);
234 234
 	}
235 235
 }
236 236
 
237
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
238
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
237
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
238
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
239 239
 
240 240
 /**
241 241
  * Donation Form Validate Fields
@@ -247,44 +247,44 @@  discard block
 block discarded – undo
247 247
 function give_purchase_form_validate_fields() {
248 248
 
249 249
 	// Check if there is $_POST
250
-	if ( empty( $_POST ) ) {
250
+	if (empty($_POST)) {
251 251
 		return false;
252 252
 	}
253 253
 
254
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
254
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
255 255
 
256 256
 	// Start an array to collect valid data
257 257
 	$valid_data = array(
258 258
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
259
-		'need_new_user'    => false,     // New user flag
260
-		'need_user_login'  => false,     // Login user flag
261
-		'logged_user_data' => array(),   // Logged user collected data
262
-		'new_user_data'    => array(),   // New user collected data
263
-		'login_user_data'  => array(),   // Login user collected data
264
-		'guest_user_data'  => array(),   // Guest user collected data
265
-		'cc_info'          => give_purchase_form_validate_cc(),// Credit card info
259
+		'need_new_user'    => false, // New user flag
260
+		'need_user_login'  => false, // Login user flag
261
+		'logged_user_data' => array(), // Logged user collected data
262
+		'new_user_data'    => array(), // New user collected data
263
+		'login_user_data'  => array(), // Login user collected data
264
+		'guest_user_data'  => array(), // Guest user collected data
265
+		'cc_info'          => give_purchase_form_validate_cc(), // Credit card info
266 266
 	);
267 267
 
268 268
 	// Validate Honeypot First
269
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
270
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
269
+	if ( ! empty($_POST['give-honeypot'])) {
270
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
271 271
 	}
272 272
 
273 273
 	// Validate agree to terms
274
-	if ( give_is_terms_enabled( $form_id ) ) {
274
+	if (give_is_terms_enabled($form_id)) {
275 275
 		give_purchase_form_validate_agree_to_terms();
276 276
 	}
277 277
 
278
-	if ( is_user_logged_in() ) {
278
+	if (is_user_logged_in()) {
279 279
 		// Collect logged in user data
280 280
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
281
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
281
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
282 282
 		// Set new user registration as required
283 283
 		$valid_data['need_new_user'] = true;
284 284
 		// Validate new user data
285 285
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
286 286
 		// Check if login validation is needed
287
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
287
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
288 288
 		// Set user login as required
289 289
 		$valid_data['need_user_login'] = true;
290 290
 		// Validate users login info
@@ -309,41 +309,41 @@  discard block
 block discarded – undo
309 309
  */
310 310
 function give_purchase_form_validate_gateway() {
311 311
 
312
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
313
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
314
-	$gateway = give_get_default_gateway( $form_id );
312
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
313
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
314
+	$gateway = give_get_default_gateway($form_id);
315 315
 
316 316
 	// Check if a gateway value is present
317
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
317
+	if ( ! empty($_REQUEST['give-gateway'])) {
318 318
 
319
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
319
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
320 320
 
321 321
 		// Is amount being donated in LIVE mode 0.00? If so, error:
322
-		if ( $amount == 0 && ! give_is_test_mode() ) {
322
+		if ($amount == 0 && ! give_is_test_mode()) {
323 323
 
324
-			give_set_error( 'invalid_donation_amount', esc_html__( 'Please insert a valid donation amount.', 'give' ) );
324
+			give_set_error('invalid_donation_amount', esc_html__('Please insert a valid donation amount.', 'give'));
325 325
 
326 326
 		} //Check for a minimum custom amount
327
-		elseif ( ! give_verify_minimum_price() ) {
327
+		elseif ( ! give_verify_minimum_price()) {
328 328
 			// translators: %s: minimum donation amount.
329 329
 			give_set_error(
330 330
 				'invalid_donation_minimum',
331 331
 				sprintf(
332 332
 					/* translators: %s: minimum donation amount */
333
-					esc_html__( 'This form has a minimum donation amount of %s.', 'give' ),
334
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
333
+					esc_html__('This form has a minimum donation amount of %s.', 'give'),
334
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
335 335
 				)
336 336
 			);
337 337
 
338 338
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
339
-		elseif ( $amount == 0 && give_is_test_mode() ) {
339
+		elseif ($amount == 0 && give_is_test_mode()) {
340 340
 
341 341
 			$gateway = 'manual';
342 342
 
343 343
 		} //Check if this gateway is active.
344
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
344
+		elseif ( ! give_is_gateway_active($gateway)) {
345 345
 
346
-			give_set_error( 'invalid_gateway', esc_html__( 'The selected payment gateway is not enabled.', 'give' ) );
346
+			give_set_error('invalid_gateway', esc_html__('The selected payment gateway is not enabled.', 'give'));
347 347
 
348 348
 		}
349 349
 	}
@@ -361,23 +361,23 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function give_verify_minimum_price() {
363 363
 
364
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
365
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
366
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
367
-	$variable_prices = give_has_variable_prices( $form_id );
364
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
365
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
366
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
367
+	$variable_prices = give_has_variable_prices($form_id);
368 368
 
369
-	if ( $variable_prices && ! empty( $price_id ) ) {
369
+	if ($variable_prices && ! empty($price_id)) {
370 370
 
371
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
371
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
372 372
 
373
-		if ( $price_level_amount == $amount ) {
373
+		if ($price_level_amount == $amount) {
374 374
 			return true;
375 375
 		}
376 376
 	}
377 377
 
378
-	$minimum = give_get_form_minimum_price( $form_id );
378
+	$minimum = give_get_form_minimum_price($form_id);
379 379
 
380
-	if ( $minimum > $amount ) {
380
+	if ($minimum > $amount) {
381 381
 		return false;
382 382
 	}
383 383
 
@@ -393,9 +393,9 @@  discard block
 block discarded – undo
393 393
  */
394 394
 function give_purchase_form_validate_agree_to_terms() {
395 395
 	// Validate agree to terms.
396
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
396
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
397 397
 		// User did not agree.
398
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', esc_html__( 'You must agree to the terms and conditions.', 'give' ) ) );
398
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', esc_html__('You must agree to the terms and conditions.', 'give')));
399 399
 	}
400 400
 }
401 401
 
@@ -409,43 +409,43 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return      array
411 411
  */
412
-function give_get_required_fields( $form_id ) {
412
+function give_get_required_fields($form_id) {
413 413
 
414
-	$payment_mode = give_get_chosen_gateway( $form_id );
414
+	$payment_mode = give_get_chosen_gateway($form_id);
415 415
 
416 416
 	$required_fields = array(
417 417
 		'give_email' => array(
418 418
 			'error_id'      => 'invalid_email',
419
-			'error_message' => esc_html__( 'Please enter a valid email address.', 'give' ),
419
+			'error_message' => esc_html__('Please enter a valid email address.', 'give'),
420 420
 		),
421 421
 		'give_first' => array(
422 422
 			'error_id'      => 'invalid_first_name',
423
-			'error_message' => esc_html__( 'Please enter your first name.', 'give' ),
423
+			'error_message' => esc_html__('Please enter your first name.', 'give'),
424 424
 		),
425 425
 	);
426 426
 
427
-	$require_address = give_require_billing_address( $payment_mode );
427
+	$require_address = give_require_billing_address($payment_mode);
428 428
 
429
-	if ( $require_address ) {
430
-		$required_fields['card_address']    = array(
429
+	if ($require_address) {
430
+		$required_fields['card_address'] = array(
431 431
 			'error_id'      => 'invalid_card_address',
432
-			'error_message' => esc_html__( 'Please enter your primary billing address.', 'give' ),
432
+			'error_message' => esc_html__('Please enter your primary billing address.', 'give'),
433 433
 		);
434
-		$required_fields['card_zip']        = array(
434
+		$required_fields['card_zip'] = array(
435 435
 			'error_id'      => 'invalid_zip_code',
436
-			'error_message' => esc_html__( 'Please enter your zip / postal code.', 'give' ),
436
+			'error_message' => esc_html__('Please enter your zip / postal code.', 'give'),
437 437
 		);
438
-		$required_fields['card_city']       = array(
438
+		$required_fields['card_city'] = array(
439 439
 			'error_id'      => 'invalid_city',
440
-			'error_message' => esc_html__( 'Please enter your billing city.', 'give' ),
440
+			'error_message' => esc_html__('Please enter your billing city.', 'give'),
441 441
 		);
442 442
 		$required_fields['billing_country'] = array(
443 443
 			'error_id'      => 'invalid_country',
444
-			'error_message' => esc_html__( 'Please select your billing country.', 'give' ),
444
+			'error_message' => esc_html__('Please select your billing country.', 'give'),
445 445
 		);
446
-		$required_fields['card_state']      = array(
446
+		$required_fields['card_state'] = array(
447 447
 			'error_id'      => 'invalid_state',
448
-			'error_message' => esc_html__( 'Please enter billing state / province.', 'give' ),
448
+			'error_message' => esc_html__('Please enter billing state / province.', 'give'),
449 449
 		);
450 450
 	}
451 451
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @since 1.7
456 456
 	 */
457
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
457
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
458 458
 
459 459
 	return $required_fields;
460 460
 
@@ -469,16 +469,16 @@  discard block
 block discarded – undo
469 469
  *
470 470
  * @return mixed|void
471 471
  */
472
-function give_require_billing_address( $payment_mode ) {
472
+function give_require_billing_address($payment_mode) {
473 473
 
474 474
 	$return = false;
475 475
 
476
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
476
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
477 477
 		$return = true;
478 478
 	}
479 479
 
480 480
 	// Let payment gateways and other extensions determine if address fields should be required.
481
-	return apply_filters( 'give_require_billing_address', $return );
481
+	return apply_filters('give_require_billing_address', $return);
482 482
 
483 483
 }
484 484
 
@@ -492,42 +492,42 @@  discard block
 block discarded – undo
492 492
 function give_purchase_form_validate_logged_in_user() {
493 493
 	global $user_ID;
494 494
 
495
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
495
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
496 496
 
497 497
 	// Start empty array to collect valid user data.
498 498
 	$valid_user_data = array(
499 499
 		// Assume there will be errors.
500
-		'user_id' => - 1,
500
+		'user_id' => -1,
501 501
 	);
502 502
 
503 503
 	// Verify there is a user_ID.
504
-	if ( $user_ID > 0 ) {
504
+	if ($user_ID > 0) {
505 505
 		// Get the logged in user data.
506
-		$user_data = get_userdata( $user_ID );
506
+		$user_data = get_userdata($user_ID);
507 507
 
508 508
 		// Loop through required fields and show error messages.
509
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
510
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
511
-				give_set_error( $value['error_id'], $value['error_message'] );
509
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
510
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
511
+				give_set_error($value['error_id'], $value['error_message']);
512 512
 			}
513 513
 		}
514 514
 
515 515
 		// Verify data.
516
-		if ( $user_data ) {
516
+		if ($user_data) {
517 517
 			// Collected logged in user data.
518 518
 			$valid_user_data = array(
519 519
 				'user_id'    => $user_ID,
520
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
521
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
522
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
520
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
521
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
522
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
523 523
 			);
524 524
 
525
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
526
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
525
+			if ( ! is_email($valid_user_data['user_email'])) {
526
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
527 527
 			}
528 528
 		} else {
529 529
 			// Set invalid user error.
530
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
530
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
531 531
 		}
532 532
 	}
533 533
 
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	// Default user data.
547 547
 	$default_user_data = array(
548 548
 		'give-form-id'           => '',
549
-		'user_id'                => - 1, // Assume there will be errors.
549
+		'user_id'                => -1, // Assume there will be errors.
550 550
 		'user_first'             => '',
551 551
 		'user_last'              => '',
552 552
 		'give_user_login'        => false,
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
 	);
557 557
 
558 558
 	// Get user data.
559
-	$user_data = wp_parse_args( array_map( 'trim', give_clean( $_POST ) ), $default_user_data );
559
+	$user_data = wp_parse_args(array_map('trim', give_clean($_POST)), $default_user_data);
560 560
 	$registering_new_user = false;
561
-	$form_id              = absint( $user_data['give-form-id'] );
561
+	$form_id              = absint($user_data['give-form-id']);
562 562
 
563 563
 	// Start an empty array to collect valid user data.
564 564
 	$valid_user_data = array(
565 565
 		// Assume there will be errors.
566
-		'user_id'    => - 1,
566
+		'user_id'    => -1,
567 567
 
568 568
 		// Get first name.
569 569
 		'user_first' => $user_data['give_first'],
@@ -573,25 +573,25 @@  discard block
 block discarded – undo
573 573
 	);
574 574
 
575 575
 	// Loop through required fields and show error messages.
576
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
577
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
578
-			give_set_error( $value['error_id'], $value['error_message'] );
576
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
577
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
578
+			give_set_error($value['error_id'], $value['error_message']);
579 579
 		}
580 580
 	}
581 581
 
582 582
 	// Check if we have an username to register.
583
-	if( give_validate_username( $user_data['give_user_login'] ) ) {
583
+	if (give_validate_username($user_data['give_user_login'])) {
584 584
 		$registering_new_user = true;
585 585
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
586 586
 	}
587 587
 
588 588
 	// Check if we have an email to verify.
589
-	if( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
589
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
590 590
 		$valid_user_data['user_email'] = $user_data['give_email'];
591 591
 	}
592 592
 
593 593
 	// Check password.
594
-	if( give_validate_user_password( $user_data['give_user_pass'],  $user_data['give_user_pass_confirm'], $registering_new_user)){
594
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
595 595
 		// All is good to go.
596 596
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
597 597
 	}
@@ -611,36 +611,36 @@  discard block
 block discarded – undo
611 611
 	// Start an array to collect valid user data.
612 612
 	$valid_user_data = array(
613 613
 		// Assume there will be errors
614
-		'user_id' => - 1,
614
+		'user_id' => -1,
615 615
 	);
616 616
 
617 617
 	// Username.
618
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
619
-		give_set_error( 'must_log_in', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
618
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
619
+		give_set_error('must_log_in', esc_html__('You must register or login to complete your donation.', 'give'));
620 620
 
621 621
 		return $valid_user_data;
622 622
 	}
623 623
 
624 624
 	// Get the user by login.
625
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
625
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
626 626
 
627 627
 	// Check if user exists.
628
-	if ( $user_data ) {
628
+	if ($user_data) {
629 629
 		// Get password.
630
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
630
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
631 631
 
632 632
 		// Check user_pass.
633
-		if ( $user_pass ) {
633
+		if ($user_pass) {
634 634
 			// Check if password is valid.
635
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
635
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
636 636
 				// Incorrect password.
637 637
 				give_set_error(
638 638
 					'password_incorrect',
639 639
 					sprintf(
640 640
 						'%1$s <a href="%2$s">%3$s</a>',
641
-						esc_html__( 'The password you entered is incorrect.', 'give' ),
642
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
643
-						esc_html__( 'Reset Password', 'give' )
641
+						esc_html__('The password you entered is incorrect.', 'give'),
642
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
643
+						esc_html__('Reset Password', 'give')
644 644
 					)
645 645
 				);
646 646
 				// All is correct.
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 			}
658 658
 		} else {
659 659
 			// Empty password.
660
-			give_set_error( 'password_empty', esc_html__( 'Enter a password.', 'give' ) );
660
+			give_set_error('password_empty', esc_html__('Enter a password.', 'give'));
661 661
 		}
662 662
 	} else {
663 663
 		// No username.
664
-		give_set_error( 'username_incorrect', esc_html__( 'The username you entered does not exist.', 'give' ) );
664
+		give_set_error('username_incorrect', esc_html__('The username you entered does not exist.', 'give'));
665 665
 	}
666 666
 
667 667
 	return $valid_user_data;
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
  */
677 677
 function give_purchase_form_validate_guest_user() {
678 678
 
679
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
679
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
680 680
 
681 681
 	// Start an array to collect valid user data.
682 682
 	$valid_user_data = array(
@@ -685,38 +685,38 @@  discard block
 block discarded – undo
685 685
 	);
686 686
 
687 687
 	// Show error message if user must be logged in.
688
-	if ( give_logged_in_only( $form_id ) ) {
689
-		give_set_error( 'logged_in_only', esc_html__( 'You must be logged in to donate.', 'give' ) );
688
+	if (give_logged_in_only($form_id)) {
689
+		give_set_error('logged_in_only', esc_html__('You must be logged in to donate.', 'give'));
690 690
 	}
691 691
 
692 692
 	// Get the guest email.
693
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
693
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
694 694
 
695 695
 	// Check email.
696
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
696
+	if ($guest_email && strlen($guest_email) > 0) {
697 697
 		// Validate email.
698
-		if ( ! is_email( $guest_email ) ) {
698
+		if ( ! is_email($guest_email)) {
699 699
 			// Invalid email.
700
-			give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
700
+			give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
701 701
 		} else {
702 702
 			// All is good to go.
703 703
 			$valid_user_data['user_email'] = $guest_email;
704 704
 
705 705
 			// Get user_id from donor if exist.
706
-			$donor = new Give_Customer( $guest_email );
707
-			if ( $donor->id && $donor->user_id ) {
706
+			$donor = new Give_Customer($guest_email);
707
+			if ($donor->id && $donor->user_id) {
708 708
 				$valid_user_data['user_id'] = $donor->user_id;
709 709
 			}
710 710
 		}
711 711
 	} else {
712 712
 		// No email.
713
-		give_set_error( 'email_empty', esc_html__( 'Enter an email.', 'give' ) );
713
+		give_set_error('email_empty', esc_html__('Enter an email.', 'give'));
714 714
 	}
715 715
 
716 716
 	// Loop through required fields and show error messages.
717
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
718
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
719
-			give_set_error( $value['error_id'], $value['error_message'] );
717
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
718
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
719
+			give_set_error($value['error_id'], $value['error_message']);
720 720
 		}
721 721
 	}
722 722
 
@@ -732,36 +732,36 @@  discard block
 block discarded – undo
732 732
  * @since   1.0
733 733
  * @return  integer
734 734
  */
735
-function give_register_and_login_new_user( $user_data = array() ) {
735
+function give_register_and_login_new_user($user_data = array()) {
736 736
 	// Verify the array.
737
-	if ( empty( $user_data ) ) {
738
-		return - 1;
737
+	if (empty($user_data)) {
738
+		return -1;
739 739
 	}
740 740
 
741
-	if ( give_get_errors() ) {
742
-		return - 1;
741
+	if (give_get_errors()) {
742
+		return -1;
743 743
 	}
744 744
 
745
-	$user_args = apply_filters( 'give_insert_user_args', array(
746
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
747
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
748
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
749
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
750
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
751
-		'user_registered' => date( 'Y-m-d H:i:s' ),
752
-		'role'            => get_option( 'default_role' ),
753
-	), $user_data );
745
+	$user_args = apply_filters('give_insert_user_args', array(
746
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
747
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
748
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
749
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
750
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
751
+		'user_registered' => date('Y-m-d H:i:s'),
752
+		'role'            => get_option('default_role'),
753
+	), $user_data);
754 754
 
755 755
 	// Insert new user.
756
-	$user_id = wp_insert_user( $user_args );
756
+	$user_id = wp_insert_user($user_args);
757 757
 
758 758
 	// Validate inserted user.
759
-	if ( is_wp_error( $user_id ) ) {
760
-		return - 1;
759
+	if (is_wp_error($user_id)) {
760
+		return -1;
761 761
 	}
762 762
 
763 763
 	// Allow themes and plugins to filter the user data.
764
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
764
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
765 765
 
766 766
 	/**
767 767
 	 * Fires after inserting user.
@@ -771,10 +771,10 @@  discard block
 block discarded – undo
771 771
 	 * @param int   $user_id   User id.
772 772
 	 * @param array $user_data Array containing user data.
773 773
 	 */
774
-	do_action( 'give_insert_user', $user_id, $user_data );
774
+	do_action('give_insert_user', $user_id, $user_data);
775 775
 
776 776
 	// Login new user.
777
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
777
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
778 778
 
779 779
 	// Return user id.
780 780
 	return $user_id;
@@ -789,27 +789,27 @@  discard block
 block discarded – undo
789 789
  * @since   1.0
790 790
  * @return  array
791 791
  */
792
-function give_get_purchase_form_user( $valid_data = array() ) {
792
+function give_get_purchase_form_user($valid_data = array()) {
793 793
 
794 794
 	// Initialize user.
795 795
 	$user    = false;
796
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
796
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
797 797
 
798
-	if ( $is_ajax ) {
798
+	if ($is_ajax) {
799 799
 		// Do not create or login the user during the ajax submission (check for errors only).
800 800
 		return true;
801
-	} elseif ( is_user_logged_in() ) {
801
+	} elseif (is_user_logged_in()) {
802 802
 		// Set the valid user as the logged in collected data.
803 803
 		$user = $valid_data['logged_in_user'];
804
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
804
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
805 805
 		// New user registration.
806
-		if ( $valid_data['need_new_user'] === true ) {
806
+		if ($valid_data['need_new_user'] === true) {
807 807
 			// Set user.
808 808
 			$user = $valid_data['new_user_data'];
809 809
 			// Register and login new user.
810
-			$user['user_id'] = give_register_and_login_new_user( $user );
810
+			$user['user_id'] = give_register_and_login_new_user($user);
811 811
 			// User login
812
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
812
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
813 813
 
814 814
 			/*
815 815
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -822,48 +822,48 @@  discard block
 block discarded – undo
822 822
 			// Set user.
823 823
 			$user = $valid_data['login_user_data'];
824 824
 			// Login user.
825
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
825
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
826 826
 		}
827 827
 	}
828 828
 
829 829
 	// Check guest checkout.
830
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
830
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
831 831
 		// Set user
832 832
 		$user = $valid_data['guest_user_data'];
833 833
 	}
834 834
 
835 835
 	// Verify we have an user.
836
-	if ( false === $user || empty( $user ) ) {
836
+	if (false === $user || empty($user)) {
837 837
 		// Return false.
838 838
 		return false;
839 839
 	}
840 840
 
841 841
 	// Get user first name.
842
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
843
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
842
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
843
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
844 844
 	}
845 845
 
846 846
 	// Get user last name.
847
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
848
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
847
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
848
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
849 849
 	}
850 850
 
851 851
 	// Get the user's billing address details.
852 852
 	$user['address']            = array();
853
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
854
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
855
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
856
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
857
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
858
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
859
-
860
-	if ( empty( $user['address']['country'] ) ) {
853
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
854
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
855
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
856
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
857
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
858
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
859
+
860
+	if (empty($user['address']['country'])) {
861 861
 		$user['address'] = false;
862 862
 	} // Country will always be set if address fields are present.
863 863
 
864
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
864
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
865 865
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases.
866
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
866
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
867 867
 	}
868 868
 
869 869
 	// Return valid user.
@@ -882,16 +882,16 @@  discard block
 block discarded – undo
882 882
 	$card_data = give_get_purchase_cc_info();
883 883
 
884 884
 	// Validate the card zip.
885
-	if ( ! empty( $card_data['card_zip'] ) ) {
886
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
887
-			give_set_error( 'invalid_cc_zip', esc_html__( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
885
+	if ( ! empty($card_data['card_zip'])) {
886
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
887
+			give_set_error('invalid_cc_zip', esc_html__('The zip / postal code you entered for your billing address is invalid.', 'give'));
888 888
 		}
889 889
 	}
890 890
 
891 891
 	// Ensure no spaces.
892
-	if ( ! empty( $card_data['card_number'] ) ) {
893
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
894
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
892
+	if ( ! empty($card_data['card_number'])) {
893
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
894
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
895 895
 	}
896 896
 
897 897
 	// This should validate card numbers at some point too.
@@ -907,17 +907,17 @@  discard block
 block discarded – undo
907 907
  */
908 908
 function give_get_purchase_cc_info() {
909 909
 	$cc_info                   = array();
910
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
911
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
912
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
913
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
914
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
915
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
916
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
917
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
918
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
919
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
920
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
910
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
911
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
912
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
913
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
914
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
915
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
916
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
917
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
918
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
919
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
920
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
921 921
 
922 922
 	// Return cc info
923 923
 	return $cc_info;
@@ -933,14 +933,14 @@  discard block
 block discarded – undo
933 933
  *
934 934
  * @return bool|mixed|void
935 935
  */
936
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
936
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
937 937
 	$ret = false;
938 938
 
939
-	if ( empty( $zip ) || empty( $country_code ) ) {
939
+	if (empty($zip) || empty($country_code)) {
940 940
 		return $ret;
941 941
 	}
942 942
 
943
-	$country_code = strtoupper( $country_code );
943
+	$country_code = strtoupper($country_code);
944 944
 
945 945
 	$zip_regex = array(
946 946
 		'AD' => 'AD\d{3}',
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 		'ZM' => '\d{5}',
1101 1101
 	);
1102 1102
 
1103
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1103
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1104 1104
 		$ret = true;
1105 1105
 	}
1106 1106
 
1107
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1107
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1108 1108
 }
1109 1109
 
1110 1110
 
@@ -1118,36 +1118,36 @@  discard block
 block discarded – undo
1118 1118
  *
1119 1119
  * @return bool
1120 1120
  */
1121
-function give_validate_multi_donation_form_level( $valid_data, $data ) {
1121
+function give_validate_multi_donation_form_level($valid_data, $data) {
1122 1122
 	/* @var Give_Donate_Form $form */
1123
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1123
+	$form = new Give_Donate_Form($data['give-form-id']);
1124 1124
 
1125 1125
 	$donation_level_matched = false;
1126 1126
 
1127
-	if ( $form->is_multi_type_donation_form() ) {
1127
+	if ($form->is_multi_type_donation_form()) {
1128 1128
 
1129 1129
 		// Bailout.
1130
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1130
+		if ( ! ($variable_prices = $form->get_prices())) {
1131 1131
 			return false;
1132 1132
 		}
1133 1133
 
1134 1134
 		// Sanitize donation amount.
1135
-		$data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1135
+		$data['give-amount'] = give_sanitize_amount($data['give-amount']);
1136 1136
 
1137 1137
 		// Get number of decimals.
1138 1138
 		$default_decimals = give_get_price_decimals();
1139 1139
 
1140
-		if ( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ) {
1140
+		if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) {
1141 1141
 			return true;
1142 1142
 		}
1143 1143
 
1144 1144
 		// Find correct donation level from all donation levels.
1145
-		foreach ( $variable_prices as $variable_price ) {
1145
+		foreach ($variable_prices as $variable_price) {
1146 1146
 			// Sanitize level amount.
1147
-			$variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1147
+			$variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals);
1148 1148
 
1149 1149
 			// Set first match donation level ID.
1150
-			if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1150
+			if ($data['give-amount'] === $variable_price['_give_amount']) {
1151 1151
 				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1152 1152
 				$donation_level_matched = true;
1153 1153
 				break;
@@ -1158,19 +1158,19 @@  discard block
 block discarded – undo
1158 1158
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1159 1159
 		if (
1160 1160
 			! $donation_level_matched
1161
-			&& ( give_is_setting_enabled( get_post_meta( $data['give-form-id'], '_give_custom_amount', true ) ) )
1161
+			&& (give_is_setting_enabled(get_post_meta($data['give-form-id'], '_give_custom_amount', true)))
1162 1162
 		) {
1163 1163
 			// Sanitize custom minimum amount.
1164
-			$custom_minimum_amount = give_sanitize_amount( get_post_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1164
+			$custom_minimum_amount = give_sanitize_amount(get_post_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals);
1165 1165
 
1166
-			if ( $data['give-amount'] >= $custom_minimum_amount ) {
1166
+			if ($data['give-amount'] >= $custom_minimum_amount) {
1167 1167
 				$_POST['give-price-id'] = 'custom';
1168 1168
 				$donation_level_matched = true;
1169 1169
 			}
1170 1170
 		}
1171 1171
 	}
1172 1172
 
1173
-	return ( $donation_level_matched ? true : false );
1173
+	return ($donation_level_matched ? true : false);
1174 1174
 }
1175 1175
 
1176
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1176
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
Please login to merge, or discard this patch.
includes/forms/template.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
  *
1474 1474
  * @param  int $form_id The form ID.
1475 1475
  *
1476
- * @return bool
1476
+ * @return false|null
1477 1477
  */
1478 1478
 function give_terms_agreement( $form_id ) {
1479 1479
 	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
  * @param  int   $form_id The form ID.
1684 1684
  * @param  array $args    An array of form arguments.
1685 1685
  *
1686
- * @return mixed
1686
+ * @return boolean
1687 1687
  */
1688 1688
 function give_show_goal_progress( $form_id, $args ) {
1689 1689
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
  *
1704 1704
  * @since  1.8
1705 1705
  *
1706
- * @param  $form_id
1706
+ * @param  integer $form_id
1707 1707
  * @param  $args
1708 1708
  *
1709 1709
  * @return mixed|string
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
  * @param  int   $form_id The form ID.
1745 1745
  * @param  array $args    An array of form arguments.
1746 1746
  *
1747
- * @return void|bool
1747
+ * @return false|null
1748 1748
  */
1749 1749
 function give_form_content( $form_id, $args ) {
1750 1750
 
Please login to merge, or discard this patch.
Spacing   +406 added lines, -406 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,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args );
81
+	do_action('give_pre_form_output', $form->ID, $args);
82 82
 
83 83
 	?>
84 84
     <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103
-				( isset( $args['show_title'] ) && $args['show_title'] == true )
104
-				&& ! doing_action( 'give_single_form_summary' )
103
+				(isset($args['show_title']) && $args['show_title'] == true)
104
+				&& ! doing_action('give_single_form_summary')
105 105
 			) {
106 106
 				echo $form_title;
107 107
 			}
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
 			 * @param int   $form_id The form ID.
115 115
 			 * @param array $args    An array of form arguments.
116 116
 			 */
117
-			do_action( 'give_pre_form', $form->ID, $args );
117
+			do_action('give_pre_form', $form->ID, $args);
118 118
 			?>
119 119
 
120 120
             <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
121
-                  action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
121
+                  action="<?php echo esc_url_raw($form_action); ?>" method="post">
122 122
                 <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
123
-                <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
123
+                <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
124 124
                 <input type="hidden" name="give-current-url"
125
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
125
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
126 126
                 <input type="hidden" name="give-form-url"
127
-                       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
127
+                       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
128 128
                 <input type="hidden" name="give-form-minimum"
129
-                       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
129
+                       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
130 130
 
131 131
                 <!-- The following field is for robots only, invisible to humans: -->
132 132
                 <span class="give-hidden" style="display: none !important;">
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 				<?php
139 139
 
140 140
 				// Price ID hidden field for variable (mult-level) donation forms.
141
-				if ( give_has_variable_prices( $form_id ) ) {
141
+				if (give_has_variable_prices($form_id)) {
142 142
 					// Get default selected price ID.
143
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
143
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
144 144
 					$price_id = 0;
145 145
 					//loop through prices.
146
-					foreach ( $prices as $price ) {
147
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
146
+					foreach ($prices as $price) {
147
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
148 148
 							$price_id = $price['_give_id']['level_id'];
149 149
 						};
150 150
 					}
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 				 * @param int   $form_id The form ID.
161 161
 				 * @param array $args    An array of form arguments.
162 162
 				 */
163
-				do_action( 'give_checkout_form_top', $form->ID, $args );
163
+				do_action('give_checkout_form_top', $form->ID, $args);
164 164
 
165 165
 				/**
166 166
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				 * @param int   $form_id The form ID.
171 171
 				 * @param array $args    An array of form arguments.
172 172
 				 */
173
-				do_action( 'give_payment_mode_select', $form->ID, $args );
173
+				do_action('give_payment_mode_select', $form->ID, $args);
174 174
 
175 175
 				/**
176 176
 				 * Fires while outputing donation form, after all other fields.
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 				 * @param int   $form_id The form ID.
181 181
 				 * @param array $args    An array of form arguments.
182 182
 				 */
183
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
183
+				do_action('give_checkout_form_bottom', $form->ID, $args);
184 184
 
185 185
 				?>
186 186
             </form>
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 			 * @param int   $form_id The form ID.
195 195
 			 * @param array $args    An array of form arguments.
196 196
 			 */
197
-			do_action( 'give_post_form', $form->ID, $args );
197
+			do_action('give_post_form', $form->ID, $args);
198 198
 
199 199
 		}
200 200
 		?>
201 201
 
202
-    </div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
202
+    </div><!--end #give-form-<?php echo absint($form->ID); ?>-->
203 203
 	<?php
204 204
 
205 205
 	/**
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 	 * @param int   $form_id The form ID.
211 211
 	 * @param array $args    An array of form arguments.
212 212
 	 */
213
-	do_action( 'give_post_form_output', $form->ID, $args );
213
+	do_action('give_post_form_output', $form->ID, $args);
214 214
 
215 215
 	$final_output = ob_get_clean();
216 216
 
217
-	echo apply_filters( 'give_donate_form', $final_output, $args );
217
+	echo apply_filters('give_donate_form', $final_output, $args);
218 218
 }
219 219
 
220 220
 /**
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return string
233 233
  */
234
-function give_show_purchase_form( $form_id ) {
234
+function give_show_purchase_form($form_id) {
235 235
 
236
-	$payment_mode = give_get_chosen_gateway( $form_id );
236
+	$payment_mode = give_get_chosen_gateway($form_id);
237 237
 
238
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
238
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
239 239
 		$form_id = $_POST['give_form_id'];
240 240
 	}
241 241
 
@@ -244,33 +244,33 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @since 1.7
246 246
 	 */
247
-	do_action( 'give_donation_form_top', $form_id );
247
+	do_action('give_donation_form_top', $form_id);
248 248
 
249
-	if ( give_can_checkout() && isset( $form_id ) ) {
249
+	if (give_can_checkout() && isset($form_id)) {
250 250
 
251 251
 		/**
252 252
 		 * Fires while displaying donation form, before registration login.
253 253
 		 *
254 254
 		 * @since 1.7
255 255
 		 */
256
-		do_action( 'give_donation_form_before_register_login', $form_id );
256
+		do_action('give_donation_form_before_register_login', $form_id);
257 257
 
258 258
 		/**
259 259
 		 * Fire when register/login form fields render.
260 260
 		 *
261 261
 		 * @since 1.7
262 262
 		 */
263
-		do_action( 'give_donation_form_register_login_fields', $form_id );
263
+		do_action('give_donation_form_register_login_fields', $form_id);
264 264
 
265 265
 		/**
266 266
 		 * Fire when credit card form fields render.
267 267
 		 *
268 268
 		 * @since 1.7
269 269
 		 */
270
-		do_action( 'give_donation_form_before_cc_form', $form_id );
270
+		do_action('give_donation_form_before_cc_form', $form_id);
271 271
 
272 272
 		// Load the credit card form and allow gateways to load their own if they wish.
273
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
273
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
274 274
 			/**
275 275
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
276 276
 			 *
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			 *
279 279
 			 * @param int $form_id The form ID.
280 280
 			 */
281
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
281
+			do_action("give_{$payment_mode}_cc_form", $form_id);
282 282
 		} else {
283 283
 			/**
284 284
 			 * Fires while displaying donation form, credit card form fields.
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			 *
288 288
 			 * @param int $form_id The form ID.
289 289
 			 */
290
-			do_action( 'give_cc_form', $form_id );
290
+			do_action('give_cc_form', $form_id);
291 291
 		}
292 292
 
293 293
 		/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 1.7
297 297
 		 */
298
-		do_action( 'give_donation_form_after_cc_form', $form_id );
298
+		do_action('give_donation_form_after_cc_form', $form_id);
299 299
 
300 300
 	} else {
301 301
 		/**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @since 1.7
305 305
 		 */
306
-		do_action( 'give_donation_form_no_access', $form_id );
306
+		do_action('give_donation_form_no_access', $form_id);
307 307
 
308 308
 	}
309 309
 
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 1.7
314 314
 	 */
315
-	do_action( 'give_donation_form_bottom', $form_id );
315
+	do_action('give_donation_form_bottom', $form_id);
316 316
 }
317 317
 
318
-add_action( 'give_donation_form', 'give_show_purchase_form' );
318
+add_action('give_donation_form', 'give_show_purchase_form');
319 319
 
320 320
 /**
321 321
  * Give Show Login/Register Form Fields.
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @return void
328 328
  */
329
-function give_show_register_login_fields( $form_id ) {
329
+function give_show_register_login_fields($form_id) {
330 330
 
331
-	$show_register_form = give_show_login_register_option( $form_id );
331
+	$show_register_form = give_show_login_register_option($form_id);
332 332
 
333
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
333
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
334 334
 		?>
335 335
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
336 336
 			<?php
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 			 *
340 340
 			 * @since 1.7
341 341
 			 */
342
-			do_action( 'give_donation_form_register_fields', $form_id );
342
+			do_action('give_donation_form_register_fields', $form_id);
343 343
 			?>
344 344
         </div>
345 345
 		<?php
346
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
346
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
347 347
 		?>
348 348
         <div id="give-checkout-login-register-<?php echo $form_id; ?>">
349 349
 			<?php
@@ -352,23 +352,23 @@  discard block
 block discarded – undo
352 352
 			 *
353 353
 			 * @since 1.7
354 354
 			 */
355
-			do_action( 'give_donation_form_login_fields', $form_id );
355
+			do_action('give_donation_form_login_fields', $form_id);
356 356
 			?>
357 357
         </div>
358 358
 		<?php
359 359
 	endif;
360 360
 
361
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
361
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
362 362
 		/**
363 363
 		 * Fire when user info render.
364 364
 		 *
365 365
 		 * @since 1.7
366 366
 		 */
367
-		do_action( 'give_donation_form_after_user_info', $form_id );
367
+		do_action('give_donation_form_after_user_info', $form_id);
368 368
 	}
369 369
 }
370 370
 
371
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
371
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
372 372
 
373 373
 /**
374 374
  * Donation Amount Field.
@@ -383,16 +383,16 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return void
385 385
  */
386
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
386
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
387 387
 
388 388
 	$give_options        = give_get_settings();
389
-	$variable_pricing    = give_has_variable_prices( $form_id );
390
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
391
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
392
-	$symbol              = give_currency_symbol( give_get_currency() );
393
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
394
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
395
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
389
+	$variable_pricing    = give_has_variable_prices($form_id);
390
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
391
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
392
+	$symbol              = give_currency_symbol(give_get_currency());
393
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
394
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
395
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
396 396
 
397 397
 	/**
398 398
 	 * Fires while displaying donation form, before donation level fields.
@@ -402,20 +402,20 @@  discard block
 block discarded – undo
402 402
 	 * @param int   $form_id The form ID.
403 403
 	 * @param array $args    An array of form arguments.
404 404
 	 */
405
-	do_action( 'give_before_donation_levels', $form_id, $args );
405
+	do_action('give_before_donation_levels', $form_id, $args);
406 406
 
407 407
 	//Set Price, No Custom Amount Allowed means hidden price field
408
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
408
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
409 409
 		?>
410
-        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
410
+        <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
411 411
         <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
412 412
                value="<?php echo $default_amount; ?>" required aria-required="true"/>
413 413
         <div class="set-price give-donation-amount form-row-wide">
414
-			<?php if ( $currency_position == 'before' ) {
414
+			<?php if ($currency_position == 'before') {
415 415
 				echo $currency_output;
416 416
 			} ?>
417 417
             <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
418
-			<?php if ( $currency_position == 'after' ) {
418
+			<?php if ($currency_position == 'after') {
419 419
 				echo $currency_output;
420 420
 			} ?>
421 421
         </div>
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
 		?>
426 426
         <div class="give-total-wrap">
427 427
             <div class="give-donation-amount form-row-wide">
428
-				<?php if ( $currency_position == 'before' ) {
428
+				<?php if ($currency_position == 'before') {
429 429
 					echo $currency_output;
430 430
 				} ?>
431
-                <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
431
+                <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
432 432
                 <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
433 433
                        placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
434
-				<?php if ( $currency_position == 'after' ) {
434
+				<?php if ($currency_position == 'after') {
435 435
 					echo $currency_output;
436 436
 				} ?>
437 437
             </div>
@@ -446,16 +446,16 @@  discard block
 block discarded – undo
446 446
 	 * @param int   $form_id The form ID.
447 447
 	 * @param array $args    An array of form arguments.
448 448
 	 */
449
-	do_action( 'give_after_donation_amount', $form_id, $args );
449
+	do_action('give_after_donation_amount', $form_id, $args);
450 450
 
451 451
 	//Custom Amount Text
452
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
452
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
453 453
         <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
454 454
 	<?php }
455 455
 
456 456
 	//Output Variable Pricing Levels.
457
-	if ( $variable_pricing ) {
458
-		give_output_levels( $form_id );
457
+	if ($variable_pricing) {
458
+		give_output_levels($form_id);
459 459
 	}
460 460
 
461 461
 	/**
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	 * @param int   $form_id The form ID.
467 467
 	 * @param array $args    An array of form arguments.
468 468
 	 */
469
-	do_action( 'give_after_donation_levels', $form_id, $args );
469
+	do_action('give_after_donation_levels', $form_id, $args);
470 470
 }
471 471
 
472
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
472
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
473 473
 
474 474
 /**
475 475
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -480,32 +480,32 @@  discard block
 block discarded – undo
480 480
  *
481 481
  * @return string Donation levels.
482 482
  */
483
-function give_output_levels( $form_id ) {
483
+function give_output_levels($form_id) {
484 484
 
485 485
 	//Get variable pricing.
486
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
487
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
488
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
489
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
490
-	if ( empty( $custom_amount_text ) ) {
491
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
486
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
487
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
488
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
489
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
490
+	if (empty($custom_amount_text)) {
491
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
492 492
 	}
493 493
 
494 494
 	$output  = '';
495 495
 	$counter = 0;
496 496
 
497
-	switch ( $display_style ) {
497
+	switch ($display_style) {
498 498
 		case 'buttons':
499 499
 
500 500
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
501 501
 
502
-			foreach ( $prices as $price ) {
503
-				$counter ++;
504
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
505
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
502
+			foreach ($prices as $price) {
503
+				$counter++;
504
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
505
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
506 506
 
507 507
 				$output .= '<li>';
508
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
508
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
509 509
 				$output .= $level_text;
510 510
 				$output .= '</button>';
511 511
 				$output .= '</li>';
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			}
514 514
 
515 515
 			//Custom Amount.
516
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
516
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
517 517
 				$output .= '<li>';
518 518
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
519 519
 				$output .= $custom_amount_text;
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
 
530 530
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
531 531
 
532
-			foreach ( $prices as $price ) {
533
-				$counter ++;
534
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
535
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
532
+			foreach ($prices as $price) {
533
+				$counter++;
534
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
535
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
536 536
 
537 537
 				$output .= '<li>';
538
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
539
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
538
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
539
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
540 540
 				$output .= '</li>';
541 541
 
542 542
 			}
543 543
 
544 544
 			//Custom Amount.
545
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
545
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
546 546
 				$output .= '<li>';
547 547
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
548
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
548
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
549 549
 				$output .= '</li>';
550 550
 			}
551 551
 
@@ -555,23 +555,23 @@  discard block
 block discarded – undo
555 555
 
556 556
 		case 'dropdown':
557 557
 
558
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
559
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
558
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
559
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
560 560
 
561 561
 			//first loop through prices.
562
-			foreach ( $prices as $price ) {
563
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
564
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
562
+			foreach ($prices as $price) {
563
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
564
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
565 565
 
566
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
566
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
567 567
 				$output .= $level_text;
568 568
 				$output .= '</option>';
569 569
 
570 570
 			}
571 571
 
572 572
 			//Custom Amount.
573
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
574
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
573
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
574
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
575 575
 			}
576 576
 
577 577
 			$output .= '</select>';
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			break;
580 580
 	}
581 581
 
582
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
582
+	echo apply_filters('give_form_level_output', $output, $form_id);
583 583
 }
584 584
 
585 585
 /**
@@ -594,27 +594,27 @@  discard block
 block discarded – undo
594 594
  *
595 595
  * @return string Checkout button.
596 596
  */
597
-function give_display_checkout_button( $form_id, $args ) {
597
+function give_display_checkout_button($form_id, $args) {
598 598
 
599
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
599
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
600 600
 		? $args['display_style']
601
-		: get_post_meta( $form_id, '_give_payment_display', true );
601
+		: get_post_meta($form_id, '_give_payment_display', true);
602 602
 
603
-	if ( 'button' === $display_option ) {
603
+	if ('button' === $display_option) {
604 604
 		$display_option = 'modal';
605
-	} elseif ( $display_option === 'onpage' ) {
605
+	} elseif ($display_option === 'onpage') {
606 606
 		return '';
607 607
 	}
608 608
 
609
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
610
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
609
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
610
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
611 611
 
612
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
612
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
613 613
 
614
-	echo apply_filters( 'give_display_checkout_button', $output );
614
+	echo apply_filters('give_display_checkout_button', $output);
615 615
 }
616 616
 
617
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
617
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
618 618
 
619 619
 /**
620 620
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -625,57 +625,57 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_user_info_fields( $form_id ) {
628
+function give_user_info_fields($form_id) {
629 629
 	// Get user info.
630
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
630
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
631 631
 
632 632
 	/**
633 633
 	 * Fire before user personal information fields
634 634
 	 *
635 635
 	 * @since 1.7
636 636
 	 */
637
-	do_action( 'give_donation_form_before_personal_info', $form_id );
637
+	do_action('give_donation_form_before_personal_info', $form_id);
638 638
 	?>
639 639
     <fieldset id="give_checkout_user_info">
640
-        <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
640
+        <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
641 641
         <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
642 642
             <label class="give-label" for="give-first">
643
-				<?php esc_html_e( 'First Name', 'give' ); ?>
644
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
643
+				<?php esc_html_e('First Name', 'give'); ?>
644
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
645 645
                     <span class="give-required-indicator">*</span>
646 646
 				<?php endif ?>
647 647
                 <span class="give-tooltip give-icon give-icon-question"
648
-                      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
648
+                      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
649 649
             </label>
650 650
             <input
651 651
                     class="give-input required"
652 652
                     type="text"
653 653
                     name="give_first"
654
-                    placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
654
+                    placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
655 655
                     id="give-first"
656
-                    value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
657
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
656
+                    value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
657
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
658 658
             />
659 659
         </p>
660 660
 
661 661
         <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
662 662
             <label class="give-label" for="give-last">
663
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
664
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
663
+				<?php esc_html_e('Last Name', 'give'); ?>
664
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
665 665
                     <span class="give-required-indicator">*</span>
666 666
 				<?php endif ?>
667 667
                 <span class="give-tooltip give-icon give-icon-question"
668
-                      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
668
+                      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
669 669
             </label>
670 670
 
671 671
             <input
672
-                    class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
672
+                    class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
673 673
                     type="text"
674 674
                     name="give_last"
675 675
                     id="give-last"
676
-                    placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
677
-                    value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
678
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
676
+                    placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
677
+                    value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
678
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
679 679
             />
680 680
         </p>
681 681
 
@@ -685,26 +685,26 @@  discard block
 block discarded – undo
685 685
 		 *
686 686
 		 * @since 1.7
687 687
 		 */
688
-		do_action( 'give_donation_form_before_email', $form_id );
688
+		do_action('give_donation_form_before_email', $form_id);
689 689
 		?>
690 690
         <p id="give-email-wrap" class="form-row form-row-wide">
691 691
             <label class="give-label" for="give-email">
692
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
693
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
692
+				<?php esc_html_e('Email Address', 'give'); ?>
693
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
694 694
                     <span class="give-required-indicator">*</span>
695 695
 				<?php } ?>
696 696
                 <span class="give-tooltip give-icon give-icon-question"
697
-                      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
697
+                      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
698 698
             </label>
699 699
 
700 700
             <input
701 701
                     class="give-input required"
702 702
                     type="email"
703 703
                     name="give_email"
704
-                    placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
704
+                    placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
705 705
                     id="give-email"
706
-                    value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
707
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
706
+                    value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
707
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
708 708
             />
709 709
 
710 710
         </p>
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
 		 *
715 715
 		 * @since 1.7
716 716
 		 */
717
-		do_action( 'give_donation_form_after_email', $form_id );
717
+		do_action('give_donation_form_after_email', $form_id);
718 718
 
719 719
 		/**
720 720
 		 * Fire after personal email field
721 721
 		 *
722 722
 		 * @since 1.7
723 723
 		 */
724
-		do_action( 'give_donation_form_user_info', $form_id );
724
+		do_action('give_donation_form_user_info', $form_id);
725 725
 		?>
726 726
     </fieldset>
727 727
 	<?php
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 	 *
731 731
 	 * @since 1.7
732 732
 	 */
733
-	do_action( 'give_donation_form_after_personal_info', $form_id );
733
+	do_action('give_donation_form_after_personal_info', $form_id);
734 734
 }
735 735
 
736
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
737
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
736
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
737
+add_action('give_register_fields_before', 'give_user_info_fields');
738 738
 
739 739
 /**
740 740
  * Renders the credit card info form.
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
  *
746 746
  * @return void
747 747
  */
748
-function give_get_cc_form( $form_id ) {
748
+function give_get_cc_form($form_id) {
749 749
 
750 750
 	ob_start();
751 751
 
@@ -756,53 +756,53 @@  discard block
 block discarded – undo
756 756
 	 *
757 757
 	 * @param int $form_id The form ID.
758 758
 	 */
759
-	do_action( 'give_before_cc_fields', $form_id );
759
+	do_action('give_before_cc_fields', $form_id);
760 760
 	?>
761 761
     <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
762
-        <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
763
-		<?php if ( is_ssl() ) : ?>
762
+        <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
763
+		<?php if (is_ssl()) : ?>
764 764
             <div id="give_secure_site_wrapper-<?php echo $form_id ?>">
765 765
                 <span class="give-icon padlock"></span>
766
-                <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
766
+                <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
767 767
             </div>
768 768
 		<?php endif; ?>
769 769
         <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
770 770
             <label for="card_number-<?php echo $form_id ?>" class="give-label">
771
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
771
+				<?php esc_html_e('Card Number', 'give'); ?>
772 772
                 <span class="give-required-indicator">*</span>
773 773
                 <span class="give-tooltip give-icon give-icon-question"
774
-                      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
774
+                      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
775 775
                 <span class="card-type"></span>
776 776
             </label>
777 777
 
778 778
             <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
779
-                   class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
779
+                   class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
780 780
                    required aria-required="true"/>
781 781
         </p>
782 782
 
783 783
         <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
784 784
             <label for="card_cvc-<?php echo $form_id ?>" class="give-label">
785
-				<?php esc_html_e( 'CVC', 'give' ); ?>
785
+				<?php esc_html_e('CVC', 'give'); ?>
786 786
                 <span class="give-required-indicator">*</span>
787 787
                 <span class="give-tooltip give-icon give-icon-question"
788
-                      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
788
+                      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
789 789
             </label>
790 790
 
791 791
             <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
792
-                   class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
792
+                   class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
793 793
                    required aria-required="true"/>
794 794
         </p>
795 795
 
796 796
         <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
797 797
             <label for="card_name-<?php echo $form_id ?>" class="give-label">
798
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
798
+				<?php esc_html_e('Name on the Card', 'give'); ?>
799 799
                 <span class="give-required-indicator">*</span>
800 800
                 <span class="give-tooltip give-icon give-icon-question"
801
-                      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
801
+                      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
802 802
             </label>
803 803
 
804 804
             <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
805
-                   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
805
+                   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
806 806
                    required aria-required="true"/>
807 807
         </p>
808 808
 		<?php
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 		 *
814 814
 		 * @param int $form_id The form ID.
815 815
 		 */
816
-		do_action( 'give_before_cc_expiration' );
816
+		do_action('give_before_cc_expiration');
817 817
 		?>
818 818
         <p class="card-expiration form-row form-row-one-third form-row-responsive">
819 819
             <label for="card_expiry-<?php echo $form_id ?>" class="give-label">
820
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
820
+				<?php esc_html_e('Expiration', 'give'); ?>
821 821
                 <span class="give-required-indicator">*</span>
822 822
                 <span class="give-tooltip give-icon give-icon-question"
823
-                      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
823
+                      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
824 824
             </label>
825 825
 
826 826
             <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
                    class="card-expiry-year"/>
830 830
 
831 831
             <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
832
-                   class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
832
+                   class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
833 833
                    required aria-required="true"/>
834 834
         </p>
835 835
 		<?php
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 		 *
841 841
 		 * @param int $form_id The form ID.
842 842
 		 */
843
-		do_action( 'give_after_cc_expiration', $form_id );
843
+		do_action('give_after_cc_expiration', $form_id);
844 844
 		?>
845 845
     </fieldset>
846 846
 	<?php
@@ -851,12 +851,12 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @param int $form_id The form ID.
853 853
 	 */
854
-	do_action( 'give_after_cc_fields', $form_id );
854
+	do_action('give_after_cc_fields', $form_id);
855 855
 
856 856
 	echo ob_get_clean();
857 857
 }
858 858
 
859
-add_action( 'give_cc_form', 'give_get_cc_form' );
859
+add_action('give_cc_form', 'give_get_cc_form');
860 860
 
861 861
 /**
862 862
  * Outputs the default credit card address fields.
@@ -867,24 +867,24 @@  discard block
 block discarded – undo
867 867
  *
868 868
  * @return void
869 869
  */
870
-function give_default_cc_address_fields( $form_id ) {
870
+function give_default_cc_address_fields($form_id) {
871 871
 	// Get user info.
872
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
872
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
873 873
 
874 874
 	$logged_in = is_user_logged_in();
875 875
 
876
-	if ( $logged_in ) {
877
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
876
+	if ($logged_in) {
877
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
878 878
 	}
879
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
880
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
881
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
882
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
879
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
880
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
881
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
882
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
883 883
 
884 884
 	ob_start();
885 885
 	?>
886 886
     <fieldset id="give_cc_address" class="cc-address">
887
-        <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
887
+        <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
888 888
 		<?php
889 889
 		/**
890 890
 		 * Fires while rendering credit card billing form, before address fields.
@@ -893,79 +893,79 @@  discard block
 block discarded – undo
893 893
 		 *
894 894
 		 * @param int $form_id The form ID.
895 895
 		 */
896
-		do_action( 'give_cc_billing_top' );
896
+		do_action('give_cc_billing_top');
897 897
 		?>
898 898
         <p id="give-card-address-wrap" class="form-row form-row-wide">
899 899
             <label for="card_address" class="give-label">
900
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
900
+				<?php esc_html_e('Address 1', 'give'); ?>
901 901
 				<?php
902
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
902
+				if (give_field_is_required('card_address', $form_id)) : ?>
903 903
                     <span class="give-required-indicator">*</span>
904 904
 				<?php endif; ?>
905 905
                 <span class="give-tooltip give-icon give-icon-question"
906
-                      data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
906
+                      data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
907 907
             </label>
908 908
 
909 909
             <input
910 910
                     type="text"
911 911
                     id="card_address"
912 912
                     name="card_address"
913
-                    class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
914
-                    placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
915
-                    value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
916
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
913
+                    class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
914
+                    placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
915
+                    value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
916
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
917 917
             />
918 918
         </p>
919 919
 
920 920
         <p id="give-card-address-2-wrap" class="form-row form-row-wide">
921 921
             <label for="card_address_2" class="give-label">
922
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
923
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
922
+				<?php esc_html_e('Address 2', 'give'); ?>
923
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
924 924
                     <span class="give-required-indicator">*</span>
925 925
 				<?php endif; ?>
926 926
                 <span class="give-tooltip give-icon give-icon-question"
927
-                      data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
927
+                      data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
928 928
             </label>
929 929
 
930 930
             <input
931 931
                     type="text"
932 932
                     id="card_address_2"
933 933
                     name="card_address_2"
934
-                    class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
935
-                    placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
936
-                    value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
937
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
934
+                    class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
935
+                    placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
936
+                    value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
937
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
938 938
             />
939 939
         </p>
940 940
 
941 941
         <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive">
942 942
             <label for="card_city" class="give-label">
943
-				<?php esc_html_e( 'City', 'give' ); ?>
944
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
943
+				<?php esc_html_e('City', 'give'); ?>
944
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
945 945
                     <span class="give-required-indicator">*</span>
946 946
 				<?php endif; ?>
947 947
                 <span class="give-tooltip give-icon give-icon-question"
948
-                      data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
948
+                      data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
949 949
             </label>
950 950
             <input
951 951
                     type="text"
952 952
                     id="card_city"
953 953
                     name="card_city"
954
-                    class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
955
-                    placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
956
-                    value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
957
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
954
+                    class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
955
+                    placeholder="<?php esc_attr_e('City', 'give'); ?>"
956
+                    value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
957
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
958 958
             />
959 959
         </p>
960 960
 
961 961
         <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
962 962
             <label for="card_zip" class="give-label">
963
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
964
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
963
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
964
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
965 965
                     <span class="give-required-indicator">*</span>
966 966
 				<?php endif; ?>
967 967
                 <span class="give-tooltip give-icon give-icon-question"
968
-                      data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
968
+                      data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
969 969
             </label>
970 970
 
971 971
             <input
@@ -973,40 +973,40 @@  discard block
 block discarded – undo
973 973
                     size="4"
974 974
                     id="card_zip"
975 975
                     name="card_zip"
976
-                    class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
977
-                    placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
978
-                    value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
979
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
976
+                    class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
977
+                    placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
978
+                    value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
979
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
980 980
             />
981 981
         </p>
982 982
 
983 983
         <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive">
984 984
             <label for="billing_country" class="give-label">
985
-				<?php esc_html_e( 'Country', 'give' ); ?>
986
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
985
+				<?php esc_html_e('Country', 'give'); ?>
986
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
987 987
                     <span class="give-required-indicator">*</span>
988 988
 				<?php endif; ?>
989 989
                 <span class="give-tooltip give-icon give-icon-question"
990
-                      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
990
+                      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
991 991
             </label>
992 992
 
993 993
             <select
994 994
                     name="billing_country"
995 995
                     id="billing_country"
996
-                    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
997
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
996
+                    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
997
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
998 998
             >
999 999
 				<?php
1000 1000
 
1001 1001
 				$selected_country = give_get_country();
1002 1002
 
1003
-				if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1003
+				if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1004 1004
 					$selected_country = $give_user_info['billing_country'];
1005 1005
 				}
1006 1006
 
1007 1007
 				$countries = give_get_country_list();
1008
-				foreach ( $countries as $country_code => $country ) {
1009
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1008
+				foreach ($countries as $country_code => $country) {
1009
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1010 1010
 				}
1011 1011
 				?>
1012 1012
             </select>
@@ -1014,37 +1014,37 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
         <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive">
1016 1016
             <label for="card_state" class="give-label">
1017
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
1018
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?>
1017
+				<?php esc_html_e('State / Province', 'give'); ?>
1018
+				<?php if (give_field_is_required('card_state', $form_id)) : ?>
1019 1019
                     <span class="give-required-indicator">*</span>
1020 1020
 				<?php endif; ?>
1021 1021
                 <span class="give-tooltip give-icon give-icon-question"
1022
-                      data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
1022
+                      data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
1023 1023
             </label>
1024 1024
 
1025 1025
 			<?php
1026 1026
 			$selected_state = give_get_state();
1027
-			$states         = give_get_states( $selected_country );
1027
+			$states         = give_get_states($selected_country);
1028 1028
 
1029
-			if ( ! empty( $give_user_info['card_state'] ) ) {
1029
+			if ( ! empty($give_user_info['card_state'])) {
1030 1030
 				$selected_state = $give_user_info['card_state'];
1031 1031
 			}
1032 1032
 
1033
-			if ( ! empty( $states ) ) : ?>
1033
+			if ( ! empty($states)) : ?>
1034 1034
                 <select
1035 1035
                         name="card_state"
1036 1036
                         id="card_state"
1037
-                        class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1038
-					<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1037
+                        class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1038
+					<?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1039 1039
 					<?php
1040
-					foreach ( $states as $state_code => $state ) {
1041
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1040
+					foreach ($states as $state_code => $state) {
1041
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1042 1042
 					}
1043 1043
 					?>
1044 1044
                 </select>
1045 1045
 			<?php else : ?>
1046 1046
                 <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1047
-                       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1047
+                       placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
1048 1048
 			<?php endif; ?>
1049 1049
         </p>
1050 1050
 		<?php
@@ -1055,14 +1055,14 @@  discard block
 block discarded – undo
1055 1055
 		 *
1056 1056
 		 * @param int $form_id The form ID.
1057 1057
 		 */
1058
-		do_action( 'give_cc_billing_bottom' );
1058
+		do_action('give_cc_billing_bottom');
1059 1059
 		?>
1060 1060
     </fieldset>
1061 1061
 	<?php
1062 1062
 	echo ob_get_clean();
1063 1063
 }
1064 1064
 
1065
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1065
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1066 1066
 
1067 1067
 
1068 1068
 /**
@@ -1075,24 +1075,24 @@  discard block
 block discarded – undo
1075 1075
  *
1076 1076
  * @return string
1077 1077
  */
1078
-function give_get_register_fields( $form_id ) {
1078
+function give_get_register_fields($form_id) {
1079 1079
 
1080 1080
 	global $user_ID;
1081 1081
 
1082
-	if ( is_user_logged_in() ) {
1083
-		$user_data = get_userdata( $user_ID );
1082
+	if (is_user_logged_in()) {
1083
+		$user_data = get_userdata($user_ID);
1084 1084
 	}
1085 1085
 
1086
-	$show_register_form = give_show_login_register_option( $form_id );
1086
+	$show_register_form = give_show_login_register_option($form_id);
1087 1087
 
1088 1088
 	ob_start(); ?>
1089 1089
     <fieldset id="give-register-fields-<?php echo $form_id; ?>">
1090 1090
 
1091
-		<?php if ( $show_register_form == 'both' ) { ?>
1091
+		<?php if ($show_register_form == 'both') { ?>
1092 1092
             <div class="give-login-account-wrap">
1093
-                <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1094
-                    <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1095
-                       data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1093
+                <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1094
+                    <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1095
+                       data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1096 1096
                 </p>
1097 1097
                 <p class="give-loading-text">
1098 1098
                     <span class="give-loading-animation"></span>
@@ -1108,15 +1108,15 @@  discard block
 block discarded – undo
1108 1108
 		 *
1109 1109
 		 * @param int $form_id The form ID.
1110 1110
 		 */
1111
-		do_action( 'give_register_fields_before', $form_id );
1111
+		do_action('give_register_fields_before', $form_id);
1112 1112
 		?>
1113 1113
 
1114 1114
         <fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1115 1115
             <legend>
1116 1116
 				<?php
1117
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1118
-				if ( ! give_logged_in_only( $form_id ) ) {
1119
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1117
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1118
+				if ( ! give_logged_in_only($form_id)) {
1119
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1120 1120
 				}
1121 1121
 				?>
1122 1122
             </legend>
@@ -1128,54 +1128,54 @@  discard block
 block discarded – undo
1128 1128
 			 *
1129 1129
 			 * @param int $form_id The form ID.
1130 1130
 			 */
1131
-			do_action( 'give_register_account_fields_before', $form_id );
1131
+			do_action('give_register_account_fields_before', $form_id);
1132 1132
 			?>
1133 1133
             <div id="give-user-login-wrap-<?php echo $form_id; ?>"
1134 1134
                  class="form-row form-row-one-third form-row-first form-row-responsive">
1135 1135
                 <label for="give-user-login-<?php echo $form_id; ?>">
1136
-					<?php esc_html_e( 'Username', 'give' ); ?>
1137
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1136
+					<?php esc_html_e('Username', 'give'); ?>
1137
+					<?php if (give_logged_in_only($form_id)) { ?>
1138 1138
                         <span class="give-required-indicator">*</span>
1139 1139
 					<?php } ?>
1140 1140
                     <span class="give-tooltip give-icon give-icon-question"
1141
-                          data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1141
+                          data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1142 1142
                 </label>
1143 1143
 
1144 1144
                 <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1145 1145
                        type="text"
1146
-                       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1146
+                       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1147 1147
             </div>
1148 1148
 
1149 1149
             <div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1150 1150
                  class="form-row form-row-one-third form-row-responsive">
1151 1151
                 <label for="give-user-pass-<?php echo $form_id; ?>">
1152
-					<?php esc_html_e( 'Password', 'give' ); ?>
1153
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1152
+					<?php esc_html_e('Password', 'give'); ?>
1153
+					<?php if (give_logged_in_only($form_id)) { ?>
1154 1154
                         <span class="give-required-indicator">*</span>
1155 1155
 					<?php } ?>
1156 1156
                     <span class="give-tooltip give-icon give-icon-question"
1157
-                          data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1157
+                          data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1158 1158
                 </label>
1159 1159
 
1160 1160
                 <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1161
-                       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1162
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1161
+                       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1162
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1163 1163
             </div>
1164 1164
 
1165 1165
             <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1166 1166
                  class="give-register-password form-row form-row-one-third form-row-responsive">
1167 1167
                 <label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1168
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1169
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1168
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1169
+					<?php if (give_logged_in_only($form_id)) { ?>
1170 1170
                         <span class="give-required-indicator">*</span>
1171 1171
 					<?php } ?>
1172 1172
                     <span class="give-tooltip give-icon give-icon-question"
1173
-                          data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1173
+                          data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1174 1174
                 </label>
1175 1175
 
1176 1176
                 <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1177
-                       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1178
-                       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1177
+                       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1178
+                       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1179 1179
             </div>
1180 1180
 			<?php
1181 1181
 			/**
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 			 *
1186 1186
 			 * @param int $form_id The form ID.
1187 1187
 			 */
1188
-			do_action( 'give_register_account_fields_after', $form_id );
1188
+			do_action('give_register_account_fields_after', $form_id);
1189 1189
 			?>
1190 1190
         </fieldset>
1191 1191
 
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 		 *
1198 1198
 		 * @param int $form_id The form ID.
1199 1199
 		 */
1200
-		do_action( 'give_register_fields_after', $form_id );
1200
+		do_action('give_register_fields_after', $form_id);
1201 1201
 		?>
1202 1202
 
1203 1203
         <input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 		 *
1209 1209
 		 * @since 1.7
1210 1210
 		 */
1211
-		do_action( 'give_donation_form_user_info', $form_id );
1211
+		do_action('give_donation_form_user_info', $form_id);
1212 1212
 		?>
1213 1213
 
1214 1214
     </fieldset>
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 	echo ob_get_clean();
1217 1217
 }
1218 1218
 
1219
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1219
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1220 1220
 
1221 1221
 /**
1222 1222
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1229,27 +1229,27 @@  discard block
 block discarded – undo
1229 1229
  *
1230 1230
  * @return string
1231 1231
  */
1232
-function give_get_login_fields( $form_id ) {
1232
+function give_get_login_fields($form_id) {
1233 1233
 
1234
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1235
-	$show_register_form = give_show_login_register_option( $form_id );
1234
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1235
+	$show_register_form = give_show_login_register_option($form_id);
1236 1236
 
1237 1237
 	ob_start();
1238 1238
 	?>
1239 1239
     <fieldset id="give-login-fields-<?php echo $form_id; ?>">
1240
-        <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1241
-			if ( ! give_logged_in_only( $form_id ) ) {
1242
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1240
+        <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1241
+			if ( ! give_logged_in_only($form_id)) {
1242
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1243 1243
 			} ?>
1244 1244
         </legend>
1245
-		<?php if ( $show_register_form == 'both' ) { ?>
1245
+		<?php if ($show_register_form == 'both') { ?>
1246 1246
             <p class="give-new-account-link">
1247
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1248
-                <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1247
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1248
+                <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1249 1249
                    data-action="give_checkout_register">
1250
-					<?php esc_html_e( 'Register', 'give' );
1251
-					if ( ! give_logged_in_only( $form_id ) ) {
1252
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1250
+					<?php esc_html_e('Register', 'give');
1251
+					if ( ! give_logged_in_only($form_id)) {
1252
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1253 1253
 					} ?>
1254 1254
                 </a>
1255 1255
             </p>
@@ -1265,49 +1265,49 @@  discard block
 block discarded – undo
1265 1265
 		 *
1266 1266
 		 * @param int $form_id The form ID.
1267 1267
 		 */
1268
-		do_action( 'give_checkout_login_fields_before', $form_id );
1268
+		do_action('give_checkout_login_fields_before', $form_id);
1269 1269
 		?>
1270 1270
         <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1271 1271
             <label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1272
-				<?php esc_html_e( 'Username', 'give' ); ?>
1273
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1272
+				<?php esc_html_e('Username', 'give'); ?>
1273
+				<?php if (give_logged_in_only($form_id)) { ?>
1274 1274
                     <span class="give-required-indicator">*</span>
1275 1275
 				<?php } ?>
1276 1276
             </label>
1277 1277
 
1278
-            <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1278
+            <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1279 1279
                    name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1280
-                   placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1280
+                   placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1281 1281
         </div>
1282 1282
 
1283 1283
         <div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1284 1284
              class="give_login_password form-row form-row-last form-row-responsive">
1285 1285
             <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1286
-				<?php esc_html_e( 'Password', 'give' ); ?>
1287
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1286
+				<?php esc_html_e('Password', 'give'); ?>
1287
+				<?php if (give_logged_in_only($form_id)) { ?>
1288 1288
                     <span class="give-required-indicator">*</span>
1289 1289
 				<?php } ?>
1290 1290
             </label>
1291
-            <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1291
+            <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1292 1292
                    type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1293
-                   placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1293
+                   placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1294 1294
             <input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1295 1295
         </div>
1296 1296
 
1297 1297
         <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1298 1298
 			 <span class="give-forgot-password ">
1299 1299
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1300
-                    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1300
+                    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1301 1301
 			 </span>
1302 1302
         </div>
1303 1303
 
1304 1304
         <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1305 1305
             <input type="submit" class="give-submit give-btn button" name="give_login_submit"
1306
-                   value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1307
-			<?php if ( $show_register_form !== 'login' ) { ?>
1306
+                   value="<?php esc_attr_e('Login', 'give'); ?>"/>
1307
+			<?php if ($show_register_form !== 'login') { ?>
1308 1308
                 <input type="button" data-action="give_cancel_login"
1309 1309
                        class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1310
-                       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1310
+                       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1311 1311
 			<?php } ?>
1312 1312
             <span class="give-loading-animation"></span>
1313 1313
         </div>
@@ -1319,14 +1319,14 @@  discard block
 block discarded – undo
1319 1319
 		 *
1320 1320
 		 * @param int $form_id The form ID.
1321 1321
 		 */
1322
-		do_action( 'give_checkout_login_fields_after', $form_id );
1322
+		do_action('give_checkout_login_fields_after', $form_id);
1323 1323
 		?>
1324 1324
     </fieldset><!--end #give-login-fields-->
1325 1325
 	<?php
1326 1326
 	echo ob_get_clean();
1327 1327
 }
1328 1328
 
1329
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1329
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1330 1330
 
1331 1331
 /**
1332 1332
  * Payment Mode Select.
@@ -1342,9 +1342,9 @@  discard block
 block discarded – undo
1342 1342
  *
1343 1343
  * @return void
1344 1344
  */
1345
-function give_payment_mode_select( $form_id ) {
1345
+function give_payment_mode_select($form_id) {
1346 1346
 
1347
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1347
+	$gateways = give_get_enabled_payment_gateways($form_id);
1348 1348
 
1349 1349
 	/**
1350 1350
 	 * Fires while selecting payment gateways, before the fields.
@@ -1353,10 +1353,10 @@  discard block
 block discarded – undo
1353 1353
 	 *
1354 1354
 	 * @param int $form_id The form ID.
1355 1355
 	 */
1356
-	do_action( 'give_payment_mode_top', $form_id );
1356
+	do_action('give_payment_mode_top', $form_id);
1357 1357
 	?>
1358 1358
 
1359
-    <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1359
+    <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1360 1360
 		echo 'style="display: none;"';
1361 1361
 	} ?>>
1362 1362
 		<?php
@@ -1367,10 +1367,10 @@  discard block
 block discarded – undo
1367 1367
 		 *
1368 1368
 		 * @param int $form_id The form ID.
1369 1369
 		 */
1370
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1370
+		do_action('give_payment_mode_before_gateways_wrap');
1371 1371
 		?>
1372 1372
         <legend
1373
-                class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1373
+                class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1374 1374
             <span class="give-loading-text"><span
1375 1375
                         class="give-loading-animation"></span>
1376 1376
             </span>
@@ -1383,26 +1383,26 @@  discard block
 block discarded – undo
1383 1383
 			 *
1384 1384
 			 * @since 1.7
1385 1385
 			 */
1386
-			do_action( 'give_payment_mode_before_gateways' )
1386
+			do_action('give_payment_mode_before_gateways')
1387 1387
 			?>
1388 1388
             <ul id="give-gateway-radio-list">
1389 1389
 				<?php
1390 1390
 				/**
1391 1391
 				 * Loop through the active payment gateways.
1392 1392
 				 */
1393
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1393
+				$selected_gateway = give_get_chosen_gateway($form_id);
1394 1394
 
1395
-				foreach ( $gateways as $gateway_id => $gateway ) :
1395
+				foreach ($gateways as $gateway_id => $gateway) :
1396 1396
 					//Determine the default gateway.
1397
-					$checked = checked( $gateway_id, $selected_gateway, false );
1397
+					$checked = checked($gateway_id, $selected_gateway, false);
1398 1398
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1399 1399
                     <li<?php echo $checked_class ?>>
1400 1400
                         <input type="radio" name="payment-mode" class="give-gateway"
1401
-                               id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1402
-                               value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1403
-                        <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1401
+                               id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1402
+                               value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1403
+                        <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1404 1404
                                class="give-gateway-option"
1405
-                               id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1405
+                               id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1406 1406
                     </li>
1407 1407
 					<?php
1408 1408
 				endforeach;
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
 			 *
1415 1415
 			 * @since 1.7
1416 1416
 			 */
1417
-			do_action( 'give_payment_mode_after_gateways' );
1417
+			do_action('give_payment_mode_after_gateways');
1418 1418
 			?>
1419 1419
         </div>
1420 1420
 		<?php
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 		 *
1426 1426
 		 * @param int $form_id The form ID.
1427 1427
 		 */
1428
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1428
+		do_action('give_payment_mode_after_gateways_wrap');
1429 1429
 		?>
1430 1430
     </fieldset>
1431 1431
 
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 	 *
1438 1438
 	 * @param int $form_id The form ID.
1439 1439
 	 */
1440
-	do_action( 'give_payment_mode_bottom', $form_id );
1440
+	do_action('give_payment_mode_bottom', $form_id);
1441 1441
 	?>
1442 1442
 
1443 1443
     <div id="give_purchase_form_wrap">
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 		 *
1449 1449
 		 * @since 1.7
1450 1450
 		 */
1451
-		do_action( 'give_donation_form', $form_id );
1451
+		do_action('give_donation_form', $form_id);
1452 1452
 		?>
1453 1453
 
1454 1454
     </div>
@@ -1459,10 +1459,10 @@  discard block
 block discarded – undo
1459 1459
 	 *
1460 1460
 	 * @since 1.7
1461 1461
 	 */
1462
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1462
+	do_action('give_donation_form_wrap_bottom', $form_id);
1463 1463
 }
1464 1464
 
1465
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1465
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1466 1466
 
1467 1467
 /**
1468 1468
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1475,31 +1475,31 @@  discard block
 block discarded – undo
1475 1475
  *
1476 1476
  * @return bool
1477 1477
  */
1478
-function give_terms_agreement( $form_id ) {
1479
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1478
+function give_terms_agreement($form_id) {
1479
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1480 1480
 
1481 1481
 	// Bailout if per form and global term and conditions is not setup.
1482 1482
 	if (
1483
-		give_is_setting_enabled( $form_option, 'global' )
1484
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1483
+		give_is_setting_enabled($form_option, 'global')
1484
+		&& give_is_setting_enabled(give_get_option('terms'))
1485 1485
 	) {
1486
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1487
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1488
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1486
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1487
+		$terms         = $terms = give_get_option('agreement_text', '');
1488
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1489 1489
 
1490
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1491
-		$label         = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1492
-		$terms         = get_post_meta( $form_id, '_give_agree_text', true );
1493
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1490
+	} elseif (give_is_setting_enabled($form_option)) {
1491
+		$label         = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1492
+		$terms         = get_post_meta($form_id, '_give_agree_text', true);
1493
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1494 1494
 
1495 1495
 	} else {
1496 1496
 		return false;
1497 1497
 	}
1498 1498
 
1499 1499
 	// Bailout: Check if term and conditions text is empty or not.
1500
-	if ( empty( $terms ) ) {
1501
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1502
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1500
+	if (empty($terms)) {
1501
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1502
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1503 1503
 		}
1504 1504
 
1505 1505
 		return false;
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 
1508 1508
 	?>
1509 1509
     <fieldset id="give_terms_agreement">
1510
-        <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1510
+        <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1511 1511
         <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1512 1512
 			<?php
1513 1513
 			/**
@@ -1515,22 +1515,22 @@  discard block
 block discarded – undo
1515 1515
 			 *
1516 1516
 			 * @since 1.0
1517 1517
 			 */
1518
-			do_action( 'give_before_terms' );
1518
+			do_action('give_before_terms');
1519 1519
 
1520
-			echo wpautop( stripslashes( $terms ) );
1520
+			echo wpautop(stripslashes($terms));
1521 1521
 			/**
1522 1522
 			 * Fires while rendering terms of agreement, after the fields.
1523 1523
 			 *
1524 1524
 			 * @since 1.0
1525 1525
 			 */
1526
-			do_action( 'give_after_terms' );
1526
+			do_action('give_after_terms');
1527 1527
 			?>
1528 1528
         </div>
1529 1529
         <div id="give_show_terms">
1530 1530
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1531
-               aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1531
+               aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1532 1532
             <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1533
-               aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1533
+               aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1534 1534
         </div>
1535 1535
 
1536 1536
         <input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 	<?php
1542 1542
 }
1543 1543
 
1544
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1544
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1545 1545
 
1546 1546
 /**
1547 1547
  * Checkout Final Total.
@@ -1554,29 +1554,29 @@  discard block
 block discarded – undo
1554 1554
  *
1555 1555
  * @return void
1556 1556
  */
1557
-function give_checkout_final_total( $form_id ) {
1557
+function give_checkout_final_total($form_id) {
1558 1558
 
1559
-	if ( isset( $_POST['give_total'] ) ) {
1560
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1559
+	if (isset($_POST['give_total'])) {
1560
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1561 1561
 	} else {
1562 1562
 		//default total.
1563
-		$total = give_get_default_form_amount( $form_id );
1563
+		$total = give_get_default_form_amount($form_id);
1564 1564
 	}
1565 1565
 	//Only proceed if give_total available.
1566
-	if ( empty( $total ) ) {
1566
+	if (empty($total)) {
1567 1567
 		return;
1568 1568
 	}
1569 1569
 	?>
1570 1570
     <p id="give-final-total-wrap" class="form-wrap ">
1571 1571
 		<span
1572
-                class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1572
+                class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1573 1573
         <span class="give-final-total-amount"
1574
-              data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1574
+              data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1575 1575
     </p>
1576 1576
 	<?php
1577 1577
 }
1578 1578
 
1579
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1579
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1580 1580
 
1581 1581
 /**
1582 1582
  * Renders the Checkout Submit section.
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
  *
1588 1588
  * @return void
1589 1589
  */
1590
-function give_checkout_submit( $form_id ) {
1590
+function give_checkout_submit($form_id) {
1591 1591
 	?>
1592 1592
     <fieldset id="give_purchase_submit">
1593 1593
 		<?php
@@ -1596,24 +1596,24 @@  discard block
 block discarded – undo
1596 1596
 		 *
1597 1597
 		 * @since 1.7
1598 1598
 		 */
1599
-		do_action( 'give_donation_form_before_submit', $form_id );
1599
+		do_action('give_donation_form_before_submit', $form_id);
1600 1600
 
1601
-		give_checkout_hidden_fields( $form_id );
1601
+		give_checkout_hidden_fields($form_id);
1602 1602
 
1603
-		echo give_checkout_button_purchase( $form_id );
1603
+		echo give_checkout_button_purchase($form_id);
1604 1604
 
1605 1605
 		/**
1606 1606
 		 * Fire after donation form submit.
1607 1607
 		 *
1608 1608
 		 * @since 1.7
1609 1609
 		 */
1610
-		do_action( 'give_donation_form_after_submit', $form_id );
1610
+		do_action('give_donation_form_after_submit', $form_id);
1611 1611
 		?>
1612 1612
     </fieldset>
1613 1613
 	<?php
1614 1614
 }
1615 1615
 
1616
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1616
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1617 1617
 
1618 1618
 /**
1619 1619
  * Give Checkout Button.
@@ -1626,10 +1626,10 @@  discard block
 block discarded – undo
1626 1626
  *
1627 1627
  * @return string
1628 1628
  */
1629
-function give_checkout_button_purchase( $form_id ) {
1629
+function give_checkout_button_purchase($form_id) {
1630 1630
 
1631
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1632
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1631
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1632
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1633 1633
 	ob_start(); ?>
1634 1634
     <div class="give-submit-button-wrap give-clearfix">
1635 1635
         <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
         <span class="give-loading-animation"></span>
1638 1638
     </div>
1639 1639
 	<?php
1640
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1640
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1641 1641
 }
1642 1642
 
1643 1643
 /**
@@ -1651,18 +1651,18 @@  discard block
 block discarded – undo
1651 1651
  *
1652 1652
  * @return void
1653 1653
  */
1654
-function give_agree_to_terms_js( $form_id ) {
1654
+function give_agree_to_terms_js($form_id) {
1655 1655
 
1656
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1656
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1657 1657
 
1658
-	if ( give_is_setting_enabled( $form_option, array( 'enabled', 'global' ) ) ) {
1658
+	if (give_is_setting_enabled($form_option, array('enabled', 'global'))) {
1659 1659
 		?>
1660 1660
         <script type="text/javascript">
1661 1661
 			jQuery(document).ready(function ($) {
1662
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1662
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1663 1663
 					e.preventDefault();
1664
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1665
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1664
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1665
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1666 1666
 					return false;
1667 1667
 				});
1668 1668
 			});
@@ -1671,7 +1671,7 @@  discard block
 block discarded – undo
1671 1671
 	}
1672 1672
 }
1673 1673
 
1674
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1674
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1675 1675
 
1676 1676
 /**
1677 1677
  * Show Give Goals.
@@ -1685,17 +1685,17 @@  discard block
 block discarded – undo
1685 1685
  *
1686 1686
  * @return mixed
1687 1687
  */
1688
-function give_show_goal_progress( $form_id, $args ) {
1688
+function give_show_goal_progress($form_id, $args) {
1689 1689
 
1690 1690
 	ob_start();
1691
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1691
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1692 1692
 
1693
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1693
+	echo apply_filters('give_goal_output', ob_get_clean());
1694 1694
 
1695 1695
 	return true;
1696 1696
 }
1697 1697
 
1698
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1698
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1699 1699
 
1700 1700
 
1701 1701
 /**
@@ -1708,10 +1708,10 @@  discard block
 block discarded – undo
1708 1708
  *
1709 1709
  * @return mixed|string
1710 1710
  */
1711
-function give_get_form_content_placement( $form_id, $args ) {
1711
+function give_get_form_content_placement($form_id, $args) {
1712 1712
 	$show_content = '';
1713 1713
 
1714
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1714
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1715 1715
 		// Content positions.
1716 1716
 		$content_placement = array(
1717 1717
 			'above' => 'give_pre_form',
@@ -1719,18 +1719,18 @@  discard block
 block discarded – undo
1719 1719
 		);
1720 1720
 
1721 1721
 		// Check if content position already decoded.
1722
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1722
+		if (in_array($args['show_content'], $content_placement)) {
1723 1723
 			return $args['show_content'];
1724 1724
 		}
1725 1725
 
1726
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1726
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1727 1727
 
1728
-	} elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) {
1729
-		$show_content = get_post_meta( $form_id, '_give_content_placement', true );
1728
+	} elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) {
1729
+		$show_content = get_post_meta($form_id, '_give_content_placement', true);
1730 1730
 
1731
-	} elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) {
1731
+	} elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) {
1732 1732
 		// Backward compatibility for _give_content_option for v18.
1733
-		$show_content = get_post_meta( $form_id, '_give_content_option', true );
1733
+		$show_content = get_post_meta($form_id, '_give_content_option', true);
1734 1734
 	}
1735 1735
 
1736 1736
 	return $show_content;
@@ -1746,20 +1746,20 @@  discard block
 block discarded – undo
1746 1746
  *
1747 1747
  * @return void|bool
1748 1748
  */
1749
-function give_form_content( $form_id, $args ) {
1749
+function give_form_content($form_id, $args) {
1750 1750
 
1751
-	$show_content = give_get_form_content_placement( $form_id, $args );
1751
+	$show_content = give_get_form_content_placement($form_id, $args);
1752 1752
 
1753 1753
 	// Bailout.
1754
-	if ( empty( $show_content ) ) {
1754
+	if (empty($show_content)) {
1755 1755
 		return false;
1756 1756
 	}
1757 1757
 
1758 1758
 	// Add action according to value.
1759
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1759
+	add_action($show_content, 'give_form_display_content', 10, 2);
1760 1760
 }
1761 1761
 
1762
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1762
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1763 1763
 
1764 1764
 /**
1765 1765
  * Renders Post Form Content.
@@ -1773,22 +1773,22 @@  discard block
 block discarded – undo
1773 1773
  *
1774 1774
  * @return void
1775 1775
  */
1776
-function give_form_display_content( $form_id, $args ) {
1776
+function give_form_display_content($form_id, $args) {
1777 1777
 
1778
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1779
-	$show_content = give_get_form_content_placement( $form_id, $args );
1778
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1779
+	$show_content = give_get_form_content_placement($form_id, $args);
1780 1780
 
1781
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1782
-		$content = apply_filters( 'the_content', $content );
1781
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1782
+		$content = apply_filters('the_content', $content);
1783 1783
 	}
1784 1784
 
1785
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1785
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1786 1786
 
1787
-	echo apply_filters( 'give_form_content_output', $output );
1787
+	echo apply_filters('give_form_content_output', $output);
1788 1788
 
1789 1789
 	//remove action to prevent content output on addition forms on page.
1790 1790
 	//@see: https://github.com/WordImpress/Give/issues/634.
1791
-	remove_action( $show_content, 'give_form_display_content' );
1791
+	remove_action($show_content, 'give_form_display_content');
1792 1792
 }
1793 1793
 
1794 1794
 /**
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
  *
1801 1801
  * @return void
1802 1802
  */
1803
-function give_checkout_hidden_fields( $form_id ) {
1803
+function give_checkout_hidden_fields($form_id) {
1804 1804
 
1805 1805
 	/**
1806 1806
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1809,13 +1809,13 @@  discard block
 block discarded – undo
1809 1809
 	 *
1810 1810
 	 * @param int $form_id The form ID.
1811 1811
 	 */
1812
-	do_action( 'give_hidden_fields_before', $form_id );
1812
+	do_action('give_hidden_fields_before', $form_id);
1813 1813
 
1814
-	if ( is_user_logged_in() ) { ?>
1814
+	if (is_user_logged_in()) { ?>
1815 1815
         <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1816 1816
 	<?php } ?>
1817 1817
     <input type="hidden" name="give_action" value="purchase"/>
1818
-    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1818
+    <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1819 1819
 	<?php
1820 1820
 	/**
1821 1821
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
 	 *
1825 1825
 	 * @param int $form_id The form ID.
1826 1826
 	 */
1827
-	do_action( 'give_hidden_fields_after', $form_id );
1827
+	do_action('give_hidden_fields_after', $form_id);
1828 1828
 
1829 1829
 }
1830 1830
 
@@ -1839,20 +1839,20 @@  discard block
 block discarded – undo
1839 1839
  *
1840 1840
  * @return string $content Filtered content.
1841 1841
  */
1842
-function give_filter_success_page_content( $content ) {
1842
+function give_filter_success_page_content($content) {
1843 1843
 
1844 1844
 	$give_options = give_get_settings();
1845 1845
 
1846
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1847
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1848
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1846
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1847
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1848
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1849 1849
 		}
1850 1850
 	}
1851 1851
 
1852 1852
 	return $content;
1853 1853
 }
1854 1854
 
1855
-add_filter( 'the_content', 'give_filter_success_page_content' );
1855
+add_filter('the_content', 'give_filter_success_page_content');
1856 1856
 
1857 1857
 /**
1858 1858
  * Test Mode Frontend Warning.
@@ -1863,12 +1863,12 @@  discard block
 block discarded – undo
1863 1863
  */
1864 1864
 function give_test_mode_frontend_warning() {
1865 1865
 
1866
-	if ( give_is_test_mode() ) {
1867
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1866
+	if (give_is_test_mode()) {
1867
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1868 1868
 	}
1869 1869
 }
1870 1870
 
1871
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1871
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1872 1872
 
1873 1873
 /**
1874 1874
  * Members-only Form.
@@ -1882,21 +1882,21 @@  discard block
 block discarded – undo
1882 1882
  *
1883 1883
  * @return string
1884 1884
  */
1885
-function give_members_only_form( $final_output, $args ) {
1885
+function give_members_only_form($final_output, $args) {
1886 1886
 
1887
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1887
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1888 1888
 
1889 1889
 	//Sanity Check: Must have form_id & not be logged in.
1890
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1890
+	if (empty($form_id) || is_user_logged_in()) {
1891 1891
 		return $final_output;
1892 1892
 	}
1893 1893
 
1894 1894
 	//Logged in only and Register / Login set to none.
1895
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1895
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1896 1896
 
1897
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1897
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1898 1898
 
1899
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1899
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1900 1900
 
1901 1901
 	}
1902 1902
 
@@ -1904,4 +1904,4 @@  discard block
 block discarded – undo
1904 1904
 
1905 1905
 }
1906 1906
 
1907
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1907
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1042,9 +1042,12 @@
 block discarded – undo
1042 1042
 					}
1043 1043
 					?>
1044 1044
                 </select>
1045
-			<?php else : ?>
1045
+			<?php else {
1046
+	: ?>
1046 1047
                 <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1047
-                       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1048
+                       placeholder="<?php esc_attr_e( 'State / Province', 'give' );
1049
+}
1050
+?>"/>
1048 1051
 			<?php endif; ?>
1049 1052
         </p>
1050 1053
 		<?php
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -725,9 +725,9 @@
 block discarded – undo
725 725
                         <td class="give-docs-link" colspan="2">
726 726
 							<?php
727 727
 							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
728
-							     . '" target="_blank">'
729
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
730
-							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
728
+								 . '" target="_blank">'
729
+								 . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
730
+								 . '<span class="dashicons dashicons-editor-help"></span></a></p>';
731 731
 							?>
732 732
                         </td>
733 733
                         </tr><?php
Please login to merge, or discard this patch.
Spacing   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		public static function save() {
87 87
 			$current_tab = give_get_current_setting_tab();
88 88
 
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
90
-				die( __( 'Action failed. Please refresh the page and retry.', 'give' ) );
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90
+				die(__('Action failed. Please refresh the page and retry.', 'give'));
91 91
 			}
92 92
 
93 93
 			/**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 			 *
100 100
 			 * @since 1.8
101 101
 			 */
102
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
102
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
103 103
 
104
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
104
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
105 105
 
106 106
 			/**
107 107
 			 * Trigger Action.
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 			 *
113 113
 			 * @since 1.8
114 114
 			 */
115
-			do_action( self::$setting_filter_prefix . '_saved' );
115
+			do_action(self::$setting_filter_prefix.'_saved');
116 116
 		}
117 117
 
118 118
 		/**
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 		 *
126 126
 		 * @return void
127 127
 		 */
128
-		public static function add_message( $code, $message ) {
129
-			self::$messages[ $code ] = $message;
128
+		public static function add_message($code, $message) {
129
+			self::$messages[$code] = $message;
130 130
 		}
131 131
 
132 132
 		/**
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 		 *
140 140
 		 * @return void
141 141
 		 */
142
-		public static function add_error( $code, $message ) {
143
-			self::$errors[ $code ] = $message;
142
+		public static function add_error($code, $message) {
143
+			self::$errors[$code] = $message;
144 144
 		}
145 145
 
146 146
 		/**
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
 			$notice_html = '';
154 154
 			$classes     = 'give-notice settings-error notice is-dismissible';
155 155
 
156
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
157
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
156
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
157
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
158 158
 
159
-			if ( 0 < count( self::$errors ) ) {
160
-				foreach ( self::$errors as $code => $message ) {
161
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>';
159
+			if (0 < count(self::$errors)) {
160
+				foreach (self::$errors as $code => $message) {
161
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>';
162 162
 				}
163 163
 			}
164 164
 
165
-			if ( 0 < count( self::$messages ) ) {
166
-				foreach ( self::$messages as $code => $message ) {
167
-					$notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>';
165
+			if (0 < count(self::$messages)) {
166
+				foreach (self::$messages as $code => $message) {
167
+					$notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>';
168 168
 				}
169 169
 			}
170 170
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			self::$setting_filter_prefix = give_get_current_setting_page();
185 185
 
186 186
 			// Bailout: Exit if setting page is not defined.
187
-			if ( empty( self::$setting_filter_prefix ) ) {
187
+			if (empty(self::$setting_filter_prefix)) {
188 188
 				return false;
189 189
 			}
190 190
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 			 *
198 198
 			 * @since 1.8
199 199
 			 */
200
-			do_action( self::$setting_filter_prefix . '_start' );
200
+			do_action(self::$setting_filter_prefix.'_start');
201 201
 
202 202
 			$current_tab = give_get_current_setting_tab();
203 203
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			self::get_settings_pages();
206 206
 
207 207
 			// Save settings if data has been posted.
208
-			if ( ! empty( $_POST ) ) {
208
+			if ( ! empty($_POST)) {
209 209
 				self::save();
210 210
 			}
211 211
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 			 *
219 219
 			 * @since 1.8
220 220
 			 */
221
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
221
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
222 222
 
223 223
 			include 'views/html-admin-settings.php';
224 224
 
@@ -236,25 +236,25 @@  discard block
 block discarded – undo
236 236
 		 *
237 237
 		 * @return string|bool
238 238
 		 */
239
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
239
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
240 240
 			// Bailout.
241
-			if ( empty( $option_name ) && empty( $field_id ) ) {
241
+			if (empty($option_name) && empty($field_id)) {
242 242
 				return false;
243 243
 			}
244 244
 
245
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
245
+			if ( ! empty($field_id) && ! empty($option_name)) {
246 246
 				// Get field value if any.
247
-				$option_value = get_option( $option_name );
247
+				$option_value = get_option($option_name);
248 248
 
249
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
250
-					? $option_value[ $field_id ]
249
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
250
+					? $option_value[$field_id]
251 251
 					: $default;
252 252
 			} else {
253 253
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
254 254
 				$option_name = ! $option_name ? $field_id : $option_name;
255 255
 
256 256
 				// Get option value if any.
257
-				$option_value = get_option( $option_name, $default );
257
+				$option_value = get_option($option_name, $default);
258 258
 			}
259 259
 
260 260
 			return $option_value;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @return void
274 274
 		 */
275
-		public static function output_fields( $options, $option_name = '' ) {
275
+		public static function output_fields($options, $option_name = '') {
276 276
 			$current_tab = give_get_current_setting_tab();
277 277
 
278 278
 			// Field Default values.
@@ -285,46 +285,46 @@  discard block
 block discarded – undo
285 285
 				'table_html' => true,
286 286
 			);
287 287
 
288
-			foreach ( $options as $value ) {
289
-				if ( ! isset( $value['type'] ) ) {
288
+			foreach ($options as $value) {
289
+				if ( ! isset($value['type'])) {
290 290
 					continue;
291 291
 				}
292 292
 
293 293
 				// Set title.
294
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
294
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
295 295
 
296
-				$value = wp_parse_args( $value, $defaults );
296
+				$value = wp_parse_args($value, $defaults);
297 297
 
298 298
 				// Custom attribute handling.
299 299
 				$custom_attributes = array();
300 300
 
301
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
302
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
303
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
301
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
302
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
303
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
304 304
 					}
305 305
 				}
306 306
 
307 307
 				// Description handling.
308
-				$description          = self::get_field_description( $value );
308
+				$description = self::get_field_description($value);
309 309
 
310 310
 				// Switch based on type.
311
-				switch ( $value['type'] ) {
311
+				switch ($value['type']) {
312 312
 
313 313
 					// Section Titles
314 314
 					case 'title':
315
-						if ( ! empty( $value['title'] ) ) {
316
-							echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>';
315
+						if ( ! empty($value['title'])) {
316
+							echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>';
317 317
 						}
318 318
 
319
-						if ( ! empty( $value['desc'] ) ) {
320
-							echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) );
319
+						if ( ! empty($value['desc'])) {
320
+							echo wpautop(wptexturize(wp_kses_post($value['desc'])));
321 321
 						}
322 322
 
323
-						if ( $value['table_html'] ) {
324
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
323
+						if ($value['table_html']) {
324
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
325 325
 						}
326 326
 
327
-						if ( ! empty( $value['id'] ) ) {
327
+						if ( ! empty($value['id'])) {
328 328
 
329 329
 							/**
330 330
 							 * Trigger Action.
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 							 *
334 334
 							 * @since 1.8
335 335
 							 */
336
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
336
+							do_action('give_settings_'.sanitize_title($value['id']));
337 337
 						}
338 338
 
339 339
 						break;
340 340
 
341 341
 					// Section Ends.
342 342
 					case 'sectionend':
343
-						if ( ! empty( $value['id'] ) ) {
343
+						if ( ! empty($value['id'])) {
344 344
 
345 345
 							/**
346 346
 							 * Trigger Action.
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
 							 *
350 350
 							 * @since 1.8
351 351
 							 */
352
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
352
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
353 353
 						}
354 354
 
355
-						if ( $value['table_html'] ) {
355
+						if ($value['table_html']) {
356 356
 							echo '</table>';
357 357
 						}
358 358
 
359
-						if ( ! empty( $value['id'] ) ) {
359
+						if ( ! empty($value['id'])) {
360 360
 
361 361
 							/**
362 362
 							 * Trigger Action.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 							 *
366 366
 							 * @since 1.8
367 367
 							 */
368
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
368
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
369 369
 						}
370 370
 
371 371
 						break;
@@ -377,22 +377,22 @@  discard block
 block discarded – undo
377 377
 					case 'password' :
378 378
 
379 379
 						$type = $value['type'];
380
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
380
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
381 381
 
382 382
 						?>
383
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
383
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
384 384
                         <th scope="row" class="titledesc">
385
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
385
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
386 386
                         </th>
387
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
387
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
388 388
                             <input
389
-                                    name="<?php echo esc_attr( $value['id'] ); ?>"
390
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
391
-                                    type="<?php echo esc_attr( $type ); ?>"
392
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
393
-                                    value="<?php echo esc_attr( $option_value ); ?>"
394
-                                    class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
395
-								<?php echo implode( ' ', $custom_attributes ); ?>
389
+                                    name="<?php echo esc_attr($value['id']); ?>"
390
+                                    id="<?php echo esc_attr($value['id']); ?>"
391
+                                    type="<?php echo esc_attr($type); ?>"
392
+                                    style="<?php echo esc_attr($value['css']); ?>"
393
+                                    value="<?php echo esc_attr($option_value); ?>"
394
+                                    class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
395
+								<?php echo implode(' ', $custom_attributes); ?>
396 396
                             /> <?php echo $description; ?>
397 397
                         </td>
398 398
                         </tr><?php
@@ -401,23 +401,23 @@  discard block
 block discarded – undo
401 401
 					// Textarea.
402 402
 					case 'textarea':
403 403
 
404
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
404
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
405 405
 
406 406
 						?>
407
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
407
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
408 408
                         <th scope="row" class="titledesc">
409
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
409
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
410 410
                         </th>
411
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
411
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
412 412
 								<textarea
413
-                                        name="<?php echo esc_attr( $value['id'] ); ?>"
414
-                                        id="<?php echo esc_attr( $value['id'] ); ?>"
415
-                                        style="<?php echo esc_attr( $value['css'] ); ?>"
416
-                                        class="<?php echo esc_attr( $value['class'] ); ?>"
413
+                                        name="<?php echo esc_attr($value['id']); ?>"
414
+                                        id="<?php echo esc_attr($value['id']); ?>"
415
+                                        style="<?php echo esc_attr($value['css']); ?>"
416
+                                        class="<?php echo esc_attr($value['class']); ?>"
417 417
                                         rows="10"
418 418
                                         cols="60"
419
-									<?php echo implode( ' ', $custom_attributes ); ?>
420
-                                ><?php echo esc_textarea( $option_value ); ?></textarea>
419
+									<?php echo implode(' ', $custom_attributes); ?>
420
+                                ><?php echo esc_textarea($option_value); ?></textarea>
421 421
 							<?php echo $description; ?>
422 422
                         </td>
423 423
                         </tr><?php
@@ -427,35 +427,35 @@  discard block
 block discarded – undo
427 427
 					case 'select' :
428 428
 					case 'multiselect' :
429 429
 
430
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
430
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
431 431
 
432 432
 						?>
433
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
433
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
434 434
                         <th scope="row" class="titledesc">
435
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
435
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
436 436
                         </th>
437
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
437
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
438 438
                             <select
439
-                                    name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) {
439
+                                    name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') {
440 440
 										echo '[]';
441 441
 									} ?>"
442
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
443
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
444
-                                    class="<?php echo esc_attr( $value['class'] ); ?>"
445
-								<?php echo implode( ' ', $custom_attributes ); ?>
446
-								<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
442
+                                    id="<?php echo esc_attr($value['id']); ?>"
443
+                                    style="<?php echo esc_attr($value['css']); ?>"
444
+                                    class="<?php echo esc_attr($value['class']); ?>"
445
+								<?php echo implode(' ', $custom_attributes); ?>
446
+								<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
447 447
                             >
448 448
 
449 449
 								<?php
450
-								if ( ! empty( $value['options'] ) ) {
451
-									foreach ( $value['options'] as $key => $val ) {
450
+								if ( ! empty($value['options'])) {
451
+									foreach ($value['options'] as $key => $val) {
452 452
 										?>
453
-                                        <option value="<?php echo esc_attr( $key ); ?>" <?php
453
+                                        <option value="<?php echo esc_attr($key); ?>" <?php
454 454
 
455
-										if ( is_array( $option_value ) ) {
456
-											selected( in_array( $key, $option_value ), true );
455
+										if (is_array($option_value)) {
456
+											selected(in_array($key, $option_value), true);
457 457
 										} else {
458
-											selected( $option_value, $key );
458
+											selected($option_value, $key);
459 459
 										}
460 460
 
461 461
 										?>><?php echo $val ?></option>
@@ -471,28 +471,28 @@  discard block
 block discarded – undo
471 471
 
472 472
 					// Radio inputs.
473 473
 					case 'radio_inline' :
474
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
474
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
475 475
 					case 'radio' :
476
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
476
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
477 477
 						?>
478
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
478
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
479 479
                         <th scope="row" class="titledesc">
480
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
480
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
481 481
                         </th>
482
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
482
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
483 483
                             <fieldset>
484 484
                                 <ul>
485 485
 									<?php
486
-									foreach ( $value['options'] as $key => $val ) {
486
+									foreach ($value['options'] as $key => $val) {
487 487
 										?>
488 488
                                         <li>
489 489
                                             <label><input
490
-                                                        name="<?php echo esc_attr( $value['id'] ); ?>"
490
+                                                        name="<?php echo esc_attr($value['id']); ?>"
491 491
                                                         value="<?php echo $key; ?>"
492 492
                                                         type="radio"
493
-                                                        style="<?php echo esc_attr( $value['css'] ); ?>"
494
-													<?php echo implode( ' ', $custom_attributes ); ?>
495
-													<?php checked( $key, $option_value ); ?>
493
+                                                        style="<?php echo esc_attr($value['css']); ?>"
494
+													<?php echo implode(' ', $custom_attributes); ?>
495
+													<?php checked($key, $option_value); ?>
496 496
                                                 /> <?php echo $val ?></label>
497 497
                                         </li>
498 498
 										<?php
@@ -506,21 +506,21 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// Checkbox input.
508 508
 					case 'checkbox' :
509
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
509
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
510 510
 						?>
511
-                        <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
511
+                        <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
512 512
                             <th scope="row" class="titledesc">
513
-                                <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
513
+                                <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
514 514
                             </th>
515 515
                             <td class="give-forminp">
516 516
                                 <input
517
-                                        name="<?php echo esc_attr( $value['id'] ); ?>"
518
-                                        id="<?php echo esc_attr( $value['id'] ); ?>"
517
+                                        name="<?php echo esc_attr($value['id']); ?>"
518
+                                        id="<?php echo esc_attr($value['id']); ?>"
519 519
                                         type="checkbox"
520
-                                        class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
520
+                                        class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
521 521
                                         value="1"
522
-									<?php checked( $option_value, 'on' ); ?>
523
-									<?php echo implode( ' ', $custom_attributes ); ?>
522
+									<?php checked($option_value, 'on'); ?>
523
+									<?php echo implode(' ', $custom_attributes); ?>
524 524
                                 />
525 525
 								<?php echo $description; ?>
526 526
                             </td>
@@ -530,28 +530,28 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// Multi Checkbox input.
532 532
 					case 'multicheck' :
533
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
534
-						$option_value = is_array( $option_value ) ? $option_value : array();
533
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
534
+						$option_value = is_array($option_value) ? $option_value : array();
535 535
 						?>
536
-                        <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
536
+                        <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
537 537
                             <th scope="row" class="titledesc">
538
-                                <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
538
+                                <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
539 539
                             </th>
540
-                            <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
540
+                            <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
541 541
                                 <fieldset>
542 542
                                     <ul>
543 543
 										<?php
544
-										foreach ( $value['options'] as $key => $val ) {
544
+										foreach ($value['options'] as $key => $val) {
545 545
 											?>
546 546
                                             <li>
547 547
                                                 <label>
548 548
                                                     <input
549
-                                                            name="<?php echo esc_attr( $value['id'] ); ?>[]"
549
+                                                            name="<?php echo esc_attr($value['id']); ?>[]"
550 550
                                                             value="<?php echo $key; ?>"
551 551
                                                             type="checkbox"
552
-                                                            style="<?php echo esc_attr( $value['css'] ); ?>"
553
-														<?php echo implode( ' ', $custom_attributes ); ?>
554
-														<?php if ( in_array( $key, $option_value ) ) {
552
+                                                            style="<?php echo esc_attr($value['css']); ?>"
553
+														<?php echo implode(' ', $custom_attributes); ?>
554
+														<?php if (in_array($key, $option_value)) {
555 555
 															echo 'checked="checked"';
556 556
 														} ?>
557 557
                                                     /> <?php echo $val ?>
@@ -569,25 +569,25 @@  discard block
 block discarded – undo
569 569
 
570 570
 					// File input field.
571 571
 					case 'file' :
572
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
572
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
573 573
 						?>
574
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
574
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
575 575
                         <th scope="row" class="titledesc">
576
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
576
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
577 577
                         </th>
578 578
                         <td class="give-forminp">
579 579
                             <div class="give-field-wrap">
580 580
                                 <label for="<?php echo $value['id'] ?>">
581 581
                                     <input
582
-                                            name="<?php echo esc_attr( $value['id'] ); ?>"
583
-                                            id="<?php echo esc_attr( $value['id'] ); ?>"
582
+                                            name="<?php echo esc_attr($value['id']); ?>"
583
+                                            id="<?php echo esc_attr($value['id']); ?>"
584 584
                                             type="text"
585
-                                            class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
585
+                                            class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
586 586
                                             value="<?php echo $option_value; ?>"
587
-                                            style="<?php echo esc_attr( $value['css'] ); ?>"
588
-										<?php echo implode( ' ', $custom_attributes ); ?>
587
+                                            style="<?php echo esc_attr($value['css']); ?>"
588
+										<?php echo implode(' ', $custom_attributes); ?>
589 589
                                     />&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button"
590
-                                                                     value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>">
590
+                                                                     value="<?php echo esc_html__('Add or Upload File', 'give'); ?>">
591 591
 									<?php echo $description ?>
592 592
                                     <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>">
593 593
                                         <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span>
@@ -602,17 +602,17 @@  discard block
 block discarded – undo
602 602
 					// WordPress Editor.
603 603
 					case 'wysiwyg' :
604 604
 						// Get option value.
605
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
605
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
606 606
 
607 607
 						// Get editor settings.
608
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
608
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
609 609
 						?>
610
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
610
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
611 611
                         <th scope="row" class="titledesc">
612
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
612
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
613 613
                         </th>
614 614
                         <td class="give-forminp">
615
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
615
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
616 616
 							<?php echo $description; ?>
617 617
                         </td>
618 618
                         </tr><?php
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 					// Custom: System setting field.
622 622
 					case 'system_info' :
623 623
 						?>
624
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
624
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
625 625
                         <th scope="row" class="titledesc">
626
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
626
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
627 627
                         </th>
628 628
                         <td class="give-forminp">
629 629
 							<?php give_system_info_callback(); ?>
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 
635 635
 					// Custom: Default gateways setting field.
636 636
 					case 'default_gateway' :
637
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
637
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
638 638
 						?>
639
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
639
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
640 640
                         <th scope="row" class="titledesc">
641
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
641
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
642 642
                         </th>
643 643
                         <td class="give-forminp">
644
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
644
+							<?php give_default_gateway_callback($value, $option_value); ?>
645 645
 							<?php echo $description; ?>
646 646
                         </td>
647 647
                         </tr><?php
@@ -649,14 +649,14 @@  discard block
 block discarded – undo
649 649
 
650 650
 					// Custom: Enable gateways setting field.
651 651
 					case 'enabled_gateways' :
652
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
652
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
653 653
 						?>
654
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
654
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
655 655
                         <th scope="row" class="titledesc">
656
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
656
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
657 657
                         </th>
658 658
                         <td class="give-forminp">
659
-							<?php give_enabled_gateways_callback( $value, $option_value ); ?>
659
+							<?php give_enabled_gateways_callback($value, $option_value); ?>
660 660
 							<?php echo $description; ?>
661 661
                         </td>
662 662
                         </tr><?php
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 					// Custom: Email preview buttons field.
666 666
 					case 'email_preview_buttons' :
667 667
 						?>
668
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
668
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
669 669
                         <th scope="row" class="titledesc">
670
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
670
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
671 671
                         </th>
672 672
                         <td class="give-forminp">
673 673
 							<?php give_email_preview_buttons_callback(); ?>
@@ -684,22 +684,22 @@  discard block
 block discarded – undo
684 684
 
685 685
 					// Custom: Gateway API key.
686 686
 					case 'api_key' :
687
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
688
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
687
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
688
+						$type         = ! empty($option_value) ? 'password' : 'text';
689 689
 						?>
690
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
690
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
691 691
                         <th scope="row" class="titledesc">
692
-                            <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
692
+                            <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
693 693
                         </th>
694
-                        <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
694
+                        <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
695 695
                             <input
696
-                                    name="<?php echo esc_attr( $value['id'] ); ?>"
697
-                                    id="<?php echo esc_attr( $value['id'] ); ?>"
698
-                                    type="<?php echo esc_attr( $type ); ?>"
699
-                                    style="<?php echo esc_attr( $value['css'] ); ?>"
700
-                                    value="<?php echo esc_attr( trim( $option_value ) ); ?>"
701
-                                    class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
702
-								<?php echo implode( ' ', $custom_attributes ); ?>
696
+                                    name="<?php echo esc_attr($value['id']); ?>"
697
+                                    id="<?php echo esc_attr($value['id']); ?>"
698
+                                    type="<?php echo esc_attr($type); ?>"
699
+                                    style="<?php echo esc_attr($value['css']); ?>"
700
+                                    value="<?php echo esc_attr(trim($option_value)); ?>"
701
+                                    class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
702
+								<?php echo implode(' ', $custom_attributes); ?>
703 703
                             /> <?php echo $description; ?>
704 704
                         </td>
705 705
                         </tr><?php
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 					// Custom: Give Docs Link field type.
722 722
 					case 'give_docs_link' :
723 723
 						?>
724
-                    <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
724
+                    <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
725 725
                         <td class="give-docs-link" colspan="2">
726 726
 							<?php
727
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
727
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
728 728
 							     . '" target="_blank">'
729
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] )
729
+							     . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title'])
730 730
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
731 731
 							?>
732 732
                         </td>
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 					// You can add or handle your custom field action.
738 738
 					default:
739 739
 						// Get option value.
740
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
741
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
740
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
741
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
742 742
 						break;
743 743
 				}
744 744
 			}
@@ -754,15 +754,15 @@  discard block
 block discarded – undo
754 754
 		 *
755 755
 		 * @return string The HTML description of the field.
756 756
 		 */
757
-		public static function get_field_description( $value ) {
757
+		public static function get_field_description($value) {
758 758
 			$description = '';
759 759
 
760 760
 			// Support for both 'description' and 'desc' args.
761
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
762
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
761
+			$description_key = isset($value['description']) ? 'description' : 'desc';
762
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
763 763
 
764
-			if ( ! empty( $value ) ) {
765
-				$description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>';
764
+			if ( ! empty($value)) {
765
+				$description = '<p class="give-field-description">'.wp_kses_post($value).'</p>';
766 766
 			}
767 767
 
768 768
 			return $description;
@@ -779,11 +779,11 @@  discard block
 block discarded – undo
779 779
 		 *
780 780
 		 * @return array The description and tip as a 2 element array
781 781
 		 */
782
-		public static function get_field_title( $value ) {
783
-			$title = esc_html( $value['title'] );
782
+		public static function get_field_title($value) {
783
+			$title = esc_html($value['title']);
784 784
 
785 785
 			// If html tag detected then allow them to print.
786
-			if ( strip_tags( $title ) ) {
786
+			if (strip_tags($title)) {
787 787
 				$title = $value['title'];
788 788
 			}
789 789
 
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 		 *
803 803
 		 * @return bool
804 804
 		 */
805
-		public static function save_fields( $options, $option_name = '' ) {
806
-			if ( empty( $_POST ) ) {
805
+		public static function save_fields($options, $option_name = '') {
806
+			if (empty($_POST)) {
807 807
 				return false;
808 808
 			}
809 809
 
@@ -811,37 +811,37 @@  discard block
 block discarded – undo
811 811
 			$update_options = array();
812 812
 
813 813
 			// Loop options and get values to save.
814
-			foreach ( $options as $option ) {
815
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
814
+			foreach ($options as $option) {
815
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
816 816
 					continue;
817 817
 				}
818 818
 
819 819
 				// Get posted value.
820
-				if ( strstr( $option['id'], '[' ) ) {
821
-					parse_str( $option['id'], $option_name_array );
822
-					$field_option_name = current( array_keys( $option_name_array ) );
823
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
824
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
820
+				if (strstr($option['id'], '[')) {
821
+					parse_str($option['id'], $option_name_array);
822
+					$field_option_name = current(array_keys($option_name_array));
823
+					$setting_name      = key($option_name_array[$field_option_name]);
824
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
825 825
 				} else {
826 826
 					$field_option_name = $option['id'];
827 827
 					$setting_name      = '';
828
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
828
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
829 829
 				}
830 830
 
831 831
 				// Format the value based on option type.
832
-				switch ( $option['type'] ) {
832
+				switch ($option['type']) {
833 833
 					case 'checkbox' :
834
-						$value = is_null( $raw_value ) ? '' : 'on';
834
+						$value = is_null($raw_value) ? '' : 'on';
835 835
 						break;
836 836
 					case 'wysiwyg'  :
837 837
 					case 'textarea' :
838
-						$value = wp_kses_post( trim( $raw_value ) );
838
+						$value = wp_kses_post(trim($raw_value));
839 839
 						break;
840 840
 					case 'multiselect' :
841
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
841
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
842 842
 						break;
843 843
 					default :
844
-						$value = give_clean( $raw_value );
844
+						$value = give_clean($raw_value);
845 845
 						break;
846 846
 				}
847 847
 
@@ -850,37 +850,37 @@  discard block
 block discarded – undo
850 850
 				 *
851 851
 				 * @since 1.8
852 852
 				 */
853
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
853
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
854 854
 
855 855
 				/**
856 856
 				 * Sanitize the value of an option by option name.
857 857
 				 *
858 858
 				 * @since 1.8
859 859
 				 */
860
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
860
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
861 861
 
862
-				if ( is_null( $value ) ) {
862
+				if (is_null($value)) {
863 863
 					continue;
864 864
 				}
865 865
 
866 866
 				// Check if option is an array and handle that differently to single values.
867
-				if ( $field_option_name && $setting_name ) {
868
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
869
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
867
+				if ($field_option_name && $setting_name) {
868
+					if ( ! isset($update_options[$field_option_name])) {
869
+						$update_options[$field_option_name] = get_option($field_option_name, array());
870 870
 					}
871
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
872
-						$update_options[ $field_option_name ] = array();
871
+					if ( ! is_array($update_options[$field_option_name])) {
872
+						$update_options[$field_option_name] = array();
873 873
 					}
874
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
874
+					$update_options[$field_option_name][$setting_name] = $value;
875 875
 				} else {
876
-					$update_options[ $field_option_name ] = $value;
876
+					$update_options[$field_option_name] = $value;
877 877
 				}
878 878
 			}
879 879
 
880 880
 			// Save all options in our array or there own option name i.e. option id.
881
-			if ( empty( $option_name ) ) {
882
-				foreach ( $update_options as $name => $value ) {
883
-					update_option( $name, $value );
881
+			if (empty($option_name)) {
882
+				foreach ($update_options as $name => $value) {
883
+					update_option($name, $value);
884 884
 
885 885
 					/**
886 886
 					 * Trigger action.
@@ -889,13 +889,13 @@  discard block
 block discarded – undo
889 889
 					 *
890 890
 					 * @since 1.8
891 891
 					 */
892
-					do_action( "give_save_option_{$name}", $value, $name );
892
+					do_action("give_save_option_{$name}", $value, $name);
893 893
 				}
894 894
 			} else {
895
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
896
-				$update_options = array_merge( $old_options, $update_options );
895
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
896
+				$update_options = array_merge($old_options, $update_options);
897 897
 
898
-				update_option( $option_name, $update_options );
898
+				update_option($option_name, $update_options);
899 899
 
900 900
 				/**
901 901
 				 * Trigger action.
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 				 *
905 905
 				 * @since 1.8
906 906
 				 */
907
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name );
907
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name);
908 908
 			}
909 909
 
910 910
 			return true;
Please login to merge, or discard this patch.