Completed
Push — master ( 5c06e9...0975de )
by Devin
13s
created
includes/admin/shortcodes/abstract-shortcode-generator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -248,8 +248,8 @@
 block discarded – undo
248 248
 
249 249
 			// do not reindex array!
250 250
 			$field['options'] = array(
251
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
-			                    ) + $field['options'];
251
+									'' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
252
+								) + $field['options'];
253 253
 
254 254
 			foreach ( $field['options'] as $value => $text ) {
255 255
 				$new_listbox['values'][] = array(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since       1.3
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Class Give_Shortcode_Generator
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @since 1.0
61 61
 	 */
62
-	public function __construct( $shortcode ) {
62
+	public function __construct($shortcode) {
63 63
 
64 64
 
65 65
 		$this->shortcode_tag = $shortcode;
66 66
 
67
-		add_action( 'admin_init', array( $this, 'init' ) );
67
+		add_action('admin_init', array($this, 'init'));
68 68
 
69 69
 	}
70 70
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function init() {
77 77
 
78
-		if ( $this->shortcode_tag ) {
78
+		if ($this->shortcode_tag) {
79 79
 
80
-			$this->self = get_class( $this );
80
+			$this->self = get_class($this);
81 81
 
82 82
 			$this->errors   = array();
83 83
 			$this->required = array();
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 			$fields = $this->get_fields();
87 87
 
88 88
 			$defaults = array(
89
-				'btn_close' => esc_html__( 'Close', 'give' ),
90
-				'btn_okay'  => esc_html__( 'Insert Shortcode', 'give' ),
89
+				'btn_close' => esc_html__('Close', 'give'),
90
+				'btn_okay'  => esc_html__('Insert Shortcode', 'give'),
91 91
 				'errors'    => $this->errors,
92 92
 				'fields'    => $fields,
93
-				'label'     => '[' . $this->shortcode_tag . ']',
93
+				'label'     => '['.$this->shortcode_tag.']',
94 94
 				'required'  => $this->required,
95
-				'title'     => esc_html__( 'Insert Shortcode', 'give' ),
95
+				'title'     => esc_html__('Insert Shortcode', 'give'),
96 96
 			);
97 97
 
98
-			if ( user_can_richedit() ) {
98
+			if (user_can_richedit()) {
99 99
 
100
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
100
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
101 101
 
102 102
 			}
103 103
 		}
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @since 1.0
128 128
 	 */
129
-	protected function generate_fields( $defined_fields ) {
129
+	protected function generate_fields($defined_fields) {
130 130
 
131 131
 		$fields = array();
132 132
 
133
-		if ( is_array( $defined_fields ) ) {
133
+		if (is_array($defined_fields)) {
134 134
 
135
-			foreach ( $defined_fields as $field ) {
135
+			foreach ($defined_fields as $field) {
136 136
 
137 137
 				$defaults = array(
138 138
 					'label'       => false,
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 					'type'        => '',
144 144
 				);
145 145
 
146
-				$field  = wp_parse_args( (array) $field, $defaults );
147
-				$method = 'generate_' . strtolower( $field['type'] );
146
+				$field  = wp_parse_args((array) $field, $defaults);
147
+				$method = 'generate_'.strtolower($field['type']);
148 148
 
149
-				if ( method_exists( $this, $method ) ) {
149
+				if (method_exists($this, $method)) {
150 150
 
151
-					$field = call_user_func( array( $this, $method ), $field );
151
+					$field = call_user_func(array($this, $method), $field);
152 152
 
153
-					if ( $field ) {
153
+					if ($field) {
154 154
 						$fields[] = $field;
155 155
 					}
156 156
 				}
@@ -170,22 +170,22 @@  discard block
 block discarded – undo
170 170
 	protected function get_fields() {
171 171
 
172 172
 		$defined_fields   = $this->define_fields();
173
-		$generated_fields = $this->generate_fields( $defined_fields );
173
+		$generated_fields = $this->generate_fields($defined_fields);
174 174
 
175 175
 		$errors = array();
176 176
 
177
-		if ( ! empty( $this->errors ) ) {
178
-			foreach ( $this->required as $name => $alert ) {
179
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
177
+		if ( ! empty($this->errors)) {
178
+			foreach ($this->required as $name => $alert) {
179
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
180 180
 
181
-					$errors[] = $this->errors[ $name ];
181
+					$errors[] = $this->errors[$name];
182 182
 				}
183 183
 			}
184 184
 
185 185
 			$this->errors = $errors;
186 186
 		}
187 187
 
188
-		if ( ! empty( $errors ) ) {
188
+		if ( ! empty($errors)) {
189 189
 
190 190
 			return $errors;
191 191
 		}
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @since 1.0
204 204
 	 */
205
-	protected function generate_container( $field ) {
205
+	protected function generate_container($field) {
206 206
 
207
-		if ( array_key_exists( 'html', $field ) ) {
207
+		if (array_key_exists('html', $field)) {
208 208
 
209 209
 			return array(
210 210
 				'type' => $field['type'],
@@ -224,36 +224,36 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @since 1.0
226 226
 	 */
227
-	protected function generate_listbox( $field ) {
227
+	protected function generate_listbox($field) {
228 228
 
229
-		$listbox = shortcode_atts( array(
229
+		$listbox = shortcode_atts(array(
230 230
 			'label'    => '',
231 231
 			'minWidth' => '',
232 232
 			'name'     => false,
233 233
 			'tooltip'  => '',
234 234
 			'type'     => '',
235 235
 			'value'    => '',
236
-		), $field );
236
+		), $field);
237 237
 
238
-		if ( $this->validate( $field ) ) {
238
+		if ($this->validate($field)) {
239 239
 
240 240
 			$new_listbox = array();
241 241
 
242
-			foreach ( $listbox as $key => $value ) {
242
+			foreach ($listbox as $key => $value) {
243 243
 
244
-				if ( $key == 'value' && empty( $value ) ) {
245
-					$new_listbox[ $key ] = $listbox['name'];
246
-				} else if ( $value ) {
247
-					$new_listbox[ $key ] = $value;
244
+				if ($key == 'value' && empty($value)) {
245
+					$new_listbox[$key] = $listbox['name'];
246
+				} else if ($value) {
247
+					$new_listbox[$key] = $value;
248 248
 				}
249 249
 			}
250 250
 
251 251
 			// do not reindex array!
252 252
 			$field['options'] = array(
253
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
253
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')),
254 254
 			                    ) + $field['options'];
255 255
 
256
-			foreach ( $field['options'] as $value => $text ) {
256
+			foreach ($field['options'] as $value => $text) {
257 257
 				$new_listbox['values'][] = array(
258 258
 					'text'  => $text,
259 259
 					'value' => $value,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @since 1.0
277 277
 	 */
278
-	protected function generate_post( $field ) {
278
+	protected function generate_post($field) {
279 279
 
280 280
 		$args = array(
281 281
 			'post_type'      => 'post',
@@ -284,23 +284,23 @@  discard block
 block discarded – undo
284 284
 			'posts_per_page' => 30,
285 285
 		);
286 286
 
287
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
288
-		$posts   = get_posts( $args );
287
+		$args    = wp_parse_args((array) $field['query_args'], $args);
288
+		$posts   = get_posts($args);
289 289
 		$options = array();
290 290
 
291
-		if ( $posts ) {
292
-			foreach ( $posts as $post ) {
293
-				$options[ absint( $post->ID ) ] = esc_html( $post->post_title );
291
+		if ($posts) {
292
+			foreach ($posts as $post) {
293
+				$options[absint($post->ID)] = esc_html($post->post_title);
294 294
 			}
295 295
 
296 296
 			$field['type']    = 'listbox';
297 297
 			$field['options'] = $options;
298 298
 
299
-			return $this->generate_listbox( $field );
299
+			return $this->generate_listbox($field);
300 300
 		}
301 301
 
302 302
 		// perform validation here before returning false
303
-		$this->validate( $field );
303
+		$this->validate($field);
304 304
 
305 305
 		return false;
306 306
 	}
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @since 1.0
316 316
 	 */
317
-	protected function generate_textbox( $field ) {
317
+	protected function generate_textbox($field) {
318 318
 
319
-		$textbox = shortcode_atts( array(
319
+		$textbox = shortcode_atts(array(
320 320
 			'label'     => '',
321 321
 			'maxLength' => '',
322 322
 			'minHeight' => '',
@@ -326,10 +326,10 @@  discard block
 block discarded – undo
326 326
 			'tooltip'   => '',
327 327
 			'type'      => '',
328 328
 			'value'     => '',
329
-		), $field );
329
+		), $field);
330 330
 
331
-		if ( $this->validate( $field ) ) {
332
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
331
+		if ($this->validate($field)) {
332
+			return array_filter($textbox, array($this, 'return_textbox_value'));
333 333
 		}
334 334
 
335 335
 		return false;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @return bool
344 344
 	 */
345
-	function return_textbox_value( $value ) {
345
+	function return_textbox_value($value) {
346 346
 		return $value !== '';
347 347
 	}
348 348
 
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @since 1.0
360 360
 	 */
361
-	protected function validate( $field ) {
361
+	protected function validate($field) {
362 362
 
363
-		extract( shortcode_atts(
363
+		extract(shortcode_atts(
364 364
 				array(
365 365
 					'name'     => false,
366 366
 					'required' => false,
@@ -368,36 +368,36 @@  discard block
 block discarded – undo
368 368
 				), $field )
369 369
 		);
370 370
 
371
-		if ( $name ) {
371
+		if ($name) {
372 372
 
373
-			if ( isset( $required['error'] ) ) {
373
+			if (isset($required['error'])) {
374 374
 
375 375
 				$error = array(
376 376
 					'type' => 'container',
377 377
 					'html' => $required['error'],
378 378
 				);
379 379
 
380
-				$this->errors[ $name ] = $this->generate_container( $error );
380
+				$this->errors[$name] = $this->generate_container($error);
381 381
 			}
382 382
 
383
-			if ( ! ! $required || is_array( $required ) ) {
383
+			if ( ! ! $required || is_array($required)) {
384 384
 
385
-				$alert = esc_html__( 'Some of the shortcode options are required.', 'give' );
385
+				$alert = esc_html__('Some of the shortcode options are required.', 'give');
386 386
 
387
-				if ( isset( $required['alert'] ) ) {
387
+				if (isset($required['alert'])) {
388 388
 
389 389
 					$alert = $required['alert'];
390 390
 
391
-				} else if ( ! empty( $label ) ) {
391
+				} else if ( ! empty($label)) {
392 392
 
393 393
 					$alert = sprintf(
394 394
 					/* translators: %s: option label */
395
-						esc_html__( 'The "%s" option is required.', 'give' ),
396
-						str_replace( ':', '', $label )
395
+						esc_html__('The "%s" option is required.', 'give'),
396
+						str_replace(':', '', $label)
397 397
 					);
398 398
 				}
399 399
 
400
-				$this->required[ $name ] = $alert;
400
+				$this->required[$name] = $alert;
401 401
 			}
402 402
 
403 403
 			return true;
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +55 added lines, -55 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
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99 99
 			'title'            => give_get_forms_label_singular(),
100
-			'sales'            => esc_html__( 'Donations', 'give' ),
101
-			'earnings'         => esc_html__( 'Income', 'give' ),
102
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
104
-			'details'          => esc_html__( 'Detailed Report', 'give' )
100
+			'sales'            => esc_html__('Donations', 'give'),
101
+			'earnings'         => esc_html__('Income', 'give'),
102
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
103
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
104
+			'details'          => esc_html__('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 		// These aren't really bulk actions but this outputs the markup in the right place
175 175
 		give_report_views();
176 176
 	}
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param string $which
185 185
 	 */
186
-	protected function display_tablenav( $which ) {
186
+	protected function display_tablenav($which) {
187 187
 
188
-		if ( 'top' == $which ) {
189
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
188
+		if ('top' == $which) {
189
+			wp_nonce_field('bulk-'.$this->_args['plural']);
190 190
 		}
191 191
 		?>
192
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
192
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
193 193
 
194
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span></h3>
194
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Forms Report', 'give'); ?></span></h3>
195 195
 
196 196
 			<div class="alignright tablenav-right">
197 197
 				<div class="actions bulkactions">
198
-					<?php $this->bulk_actions( $which ); ?>
198
+					<?php $this->bulk_actions($which); ?>
199 199
 				</div>
200 200
 				<?php
201
-				$this->extra_tablenav( $which );
202
-				$this->pagination( $which );
201
+				$this->extra_tablenav($which);
202
+				$this->pagination($which);
203 203
 				?>
204 204
 			</div>
205 205
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function category_filter() {
221 221
 
222
-		$categories = get_terms( 'form_category' );
223
-		if ( $categories && ! is_wp_error( $categories ) ) {
224
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
222
+		$categories = get_terms('form_category');
223
+		if ($categories && ! is_wp_error($categories)) {
224
+			echo Give()->html->category_dropdown('category', $this->get_category());
225 225
 		}
226 226
 	}
227 227
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function query() {
237 237
 
238
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
239
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
238
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
239
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
240 240
 		$category = $this->get_category();
241 241
 
242 242
 		$args = array(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			'suppress_filters' => true
250 250
 		);
251 251
 
252
-		if ( ! empty( $category ) ) {
252
+		if ( ! empty($category)) {
253 253
 			$args['tax_query'] = array(
254 254
 				array(
255 255
 					'taxonomy' => 'form_category',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		}
260 260
 
261
-		switch ( $orderby ) :
261
+		switch ($orderby) :
262 262
 			case 'title' :
263 263
 				$args['orderby'] = 'title';
264 264
 				break;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				break;
275 275
 		endswitch;
276 276
 
277
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
277
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
278 278
 
279
-		$this->products = new WP_Query( $args );
279
+		$this->products = new WP_Query($args);
280 280
 
281 281
 	}
282 282
 
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$give_forms = $this->products->posts;
294 294
 
295
-		if ( $give_forms ) {
296
-			foreach ( $give_forms as $form ) {
295
+		if ($give_forms) {
296
+			foreach ($give_forms as $form) {
297 297
 				$reports_data[] = array(
298 298
 					'ID'               => $form,
299
-					'title'            => get_the_title( $form ),
300
-					'sales'            => give_get_form_sales_stats( $form ),
301
-					'earnings'         => give_get_form_earnings_stats( $form ),
302
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
303
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
299
+					'title'            => get_the_title($form),
300
+					'sales'            => give_get_form_sales_stats($form),
301
+					'earnings'         => give_get_form_earnings_stats($form),
302
+					'average_sales'    => give_get_average_monthly_form_sales($form),
303
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
304 304
 				);
305 305
 			}
306 306
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$sortable = $this->get_sortable_columns();
330 330
 
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 
333 333
 		$data = $this->reports_data();
334 334
 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->items = $data;
338 338
 
339
-		$this->set_pagination_args( array(
339
+		$this->set_pagination_args(array(
340 340
 				'total_items' => $total_items,
341 341
 				'per_page'    => $this->per_page,
342
-				'total_pages' => ceil( $total_items / $this->per_page )
342
+				'total_pages' => ceil($total_items / $this->per_page)
343 343
 			)
344 344
 		);
345 345
 	}
Please login to merge, or discard this patch.
includes/admin/customers/customer-functions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views
25 25
  */
26
-function give_register_default_customer_views( $views ) {
26
+function give_register_default_customer_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_customers_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_customer_notes_view'
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 );
38
+add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single customer view
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_customer_tabs( $tabs ) {
49
+function give_register_default_customer_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52
-		'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => esc_html__( 'Donor Profile', 'give' ) ),
53
-		'notes'    => array( 'dashicon' => 'dashicons-admin-comments', 'title' => esc_html__( 'Donor Notes', 'give' ) )
52
+		'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => esc_html__('Donor Profile', 'give')),
53
+		'notes'    => array('dashicon' => 'dashicons-admin-comments', 'title' => esc_html__('Donor Notes', 'give'))
54 54
 	);
55 55
 
56
-	return array_merge( $tabs, $default_tabs );
56
+	return array_merge($tabs, $default_tabs);
57 57
 }
58 58
 
59
-add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 );
59
+add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1);
60 60
 
61 61
 /**
62 62
  * Register the Delete icon as late as possible so it's at the bottom
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array       The altered list of tabs, with 'delete' at the bottom
69 69
  */
70
-function give_register_delete_customer_tab( $tabs ) {
70
+function give_register_delete_customer_tab($tabs) {
71 71
 
72
-	$tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => esc_html__( 'Delete Donor', 'give' ) );
72
+	$tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => esc_html__('Delete Donor', 'give'));
73 73
 
74 74
 	return $tabs;
75 75
 }
76 76
 
77
-add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 );
77
+add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.
includes/class-give-cron.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @see   Give_Cron::weekly_events()
30 30
 	 */
31 31
 	public function __construct() {
32
-		add_filter( 'cron_schedules', array( $this, 'add_schedules' ) );
33
-		add_action( 'wp', array( $this, 'schedule_Events' ) );
32
+		add_filter('cron_schedules', array($this, 'add_schedules'));
33
+		add_action('wp', array($this, 'schedule_Events'));
34 34
 	}
35 35
 
36 36
 	/**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @return array
44 44
 	 */
45
-	public function add_schedules( $schedules = array() ) {
45
+	public function add_schedules($schedules = array()) {
46 46
 		// Adds once weekly to the existing schedules.
47 47
 		$schedules['weekly'] = array(
48 48
 			'interval' => 604800,
49
-			'display'  => esc_html__( 'Once Weekly', 'give' )
49
+			'display'  => esc_html__('Once Weekly', 'give')
50 50
 		);
51 51
 
52 52
 		return $schedules;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	private function weekly_events() {
75
-		if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) {
76
-			wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' );
75
+		if ( ! wp_next_scheduled('give_weekly_scheduled_events')) {
76
+			wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events');
77 77
 		}
78 78
 	}
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @return void
86 86
 	 */
87 87
 	private function daily_events() {
88
-		if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) {
89
-			wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' );
88
+		if ( ! wp_next_scheduled('give_daily_scheduled_events')) {
89
+			wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events');
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @param $url
91 91
 	 *
92
-	 * @return mixed
92
+	 * @return string
93 93
 	 */
94 94
 	public function give_update_cmb_meta_box_url( $url ) {
95 95
 		//Path to Give's CMB
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
  * @since 1.0
874 874
  *
875 875
  * @param string          $key The Key to update
876
- * @param string|bool|int $value The value to set the key to
876
+ * @param integer $value The value to set the key to
877 877
  *
878 878
  * @return boolean True if updated, false if not.
879 879
  */
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  * @since      1.3.5
975 975
  *
976 976
  * @param $array
977
- * @param $position |int|string Expects an array key or 'id' of the settings field to appear after
977
+ * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after
978 978
  * @param $insert |array a valid array of options to insert
979 979
  *
980 980
  * @return array
Please login to merge, or discard this patch.
Spacing   +305 added lines, -305 removed lines patch added patch discarded remove patch
@@ -41,26 +41,26 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function __construct() {
43 43
 
44
-		add_action( 'admin_init', array( $this, 'init' ) );
44
+		add_action('admin_init', array($this, 'init'));
45 45
 
46 46
 		//Customize CMB2 URL
47
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
47
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
48 48
 
49 49
 		//Custom CMB2 Settings Fields
50
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
51
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
52
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
53
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
54
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
55
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
56
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
57
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
58
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
50
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
51
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
52
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
53
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
54
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
55
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
56
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
57
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
58
+		add_action('admin_notices', array($this, 'settings_notices'));
59 59
 
60 60
 		// Include CMB CSS in the head to avoid FOUC
61
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
61
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
62 62
 
63
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
63
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
64 64
 
65 65
 	}
66 66
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @since  1.0
72 72
 	 */
73 73
 	public function init() {
74
-		register_setting( $this->key, $this->key );
74
+		register_setting($this->key, $this->key);
75 75
 
76 76
 	}
77 77
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return mixed
87 87
 	 */
88
-	public function give_update_cmb_meta_box_url( $url ) {
88
+	public function give_update_cmb_meta_box_url($url) {
89 89
 		//Path to Give's CMB
90
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
90
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
91 91
 	}
92 92
 
93 93
 
@@ -99,27 +99,27 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function give_get_settings_tabs() {
101 101
 
102
-		$settings = $this->give_settings( null );
102
+		$settings = $this->give_settings(null);
103 103
 
104 104
 		$tabs             = array();
105
-		$tabs['general']  = esc_html__( 'General', 'give' );
106
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
107
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
108
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
105
+		$tabs['general']  = esc_html__('General', 'give');
106
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
107
+		$tabs['display']  = esc_html__('Display Options', 'give');
108
+		$tabs['emails']   = esc_html__('Emails', 'give');
109 109
 
110
-		if ( ! empty( $settings['addons']['fields'] ) ) {
111
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
110
+		if ( ! empty($settings['addons']['fields'])) {
111
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
112 112
 		}
113 113
 
114
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
115
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
114
+		if ( ! empty($settings['licenses']['fields'])) {
115
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
116 116
 		}
117 117
 
118
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
119
-		$tabs['api']         = esc_html__( 'API', 'give' );
120
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
118
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
119
+		$tabs['api']         = esc_html__('API', 'give');
120
+		$tabs['system_info'] = esc_html__('System Info', 'give');
121 121
 
122
-		return apply_filters( 'give_settings_tabs', $tabs );
122
+		return apply_filters('give_settings_tabs', $tabs);
123 123
 	}
124 124
 
125 125
 
@@ -129,32 +129,32 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function admin_page_display() {
131 131
 
132
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
132
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
133 133
 
134 134
 		?>
135 135
 
136 136
 		<div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>">
137 137
 
138
-			<h1 class="screen-reader-text"><?php esc_html_e( 'Give Settings', 'give' ); ?></h1>
138
+			<h1 class="screen-reader-text"><?php esc_html_e('Give Settings', 'give'); ?></h1>
139 139
 
140 140
 			<h2 class="nav-tab-wrapper">
141 141
 				<?php
142
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
142
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
143 143
 
144
-					$tab_url = esc_url( add_query_arg( array(
144
+					$tab_url = esc_url(add_query_arg(array(
145 145
 						'settings-updated' => false,
146 146
 						'tab'              => $tab_id
147
-					) ) );
147
+					)));
148 148
 
149 149
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
150 150
 
151
-					echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
151
+					echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
152 152
 
153 153
 				}
154 154
 				?>
155 155
 			</h2>
156 156
 
157
-			<?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?>
157
+			<?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?>
158 158
 
159 159
 		</div><!-- .wrap -->
160 160
 
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @return string
178 178
 	 */
179
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
179
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
180 180
 
181 181
 		//only modify the give settings form
182
-		if ( 'give_settings' == $object_id ) {
182
+		if ('give_settings' == $object_id) {
183 183
 
184
-			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>';
184
+			return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>';
185 185
 
186 186
 		}
187 187
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return array
200 200
 	 */
201
-	public function give_settings( $active_tab ) {
201
+	public function give_settings($active_tab) {
202 202
 
203 203
 		$give_settings = array(
204 204
 			/**
@@ -206,99 +206,99 @@  discard block
 block discarded – undo
206 206
 			 */
207 207
 			'general'     => array(
208 208
 				'id'         => 'general_settings',
209
-				'give_title' => esc_html__( 'General Settings', 'give' ),
210
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
211
-				'fields'     => apply_filters( 'give_settings_general', array(
209
+				'give_title' => esc_html__('General Settings', 'give'),
210
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
211
+				'fields'     => apply_filters('give_settings_general', array(
212 212
 						array(
213
-							'name' => esc_html__( 'General Settings', 'give' ),
213
+							'name' => esc_html__('General Settings', 'give'),
214 214
 							'desc' => '',
215 215
 							'type' => 'give_title',
216 216
 							'id'   => 'give_title_general_settings_1'
217 217
 						),
218 218
 						array(
219
-							'name'    => esc_html__( 'Success Page', 'give' ),
219
+							'name'    => esc_html__('Success Page', 'give'),
220 220
 							/* translators: %s: [give_receipt] */
221
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
221
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
222 222
 							'id'      => 'success_page',
223 223
 							'type'    => 'select',
224
-							'options' => give_cmb2_get_post_options( array(
224
+							'options' => give_cmb2_get_post_options(array(
225 225
 								'post_type'   => 'page',
226
-								'numberposts' => - 1
227
-							) ),
226
+								'numberposts' => -1
227
+							)),
228 228
 						),
229 229
 						array(
230
-							'name'    => esc_html__( 'Failed Transaction Page', 'give' ),
231
-							'desc'    => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
230
+							'name'    => esc_html__('Failed Transaction Page', 'give'),
231
+							'desc'    => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
232 232
 							'id'      => 'failure_page',
233 233
 							'type'    => 'select',
234
-							'options' => give_cmb2_get_post_options( array(
234
+							'options' => give_cmb2_get_post_options(array(
235 235
 								'post_type'   => 'page',
236
-								'numberposts' => - 1
237
-							) ),
236
+								'numberposts' => -1
237
+							)),
238 238
 						),
239 239
 						array(
240
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
240
+							'name'    => esc_html__('Donation History Page', 'give'),
241 241
 							/* translators: %s: [donation_history] */
242
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
242
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
243 243
 							'id'      => 'history_page',
244 244
 							'type'    => 'select',
245
-							'options' => give_cmb2_get_post_options( array(
245
+							'options' => give_cmb2_get_post_options(array(
246 246
 								'post_type'   => 'page',
247
-								'numberposts' => - 1
248
-							) ),
247
+								'numberposts' => -1
248
+							)),
249 249
 						),
250 250
 						array(
251
-							'name'    => esc_html__( 'Base Country', 'give' ),
252
-							'desc'    => esc_html__( 'Where does your site operate from?', 'give' ),
251
+							'name'    => esc_html__('Base Country', 'give'),
252
+							'desc'    => esc_html__('Where does your site operate from?', 'give'),
253 253
 							'id'      => 'base_country',
254 254
 							'type'    => 'select',
255 255
 							'options' => give_get_country_list(),
256 256
 						),
257 257
 						array(
258
-							'name' => esc_html__( 'Currency Settings', 'give' ),
258
+							'name' => esc_html__('Currency Settings', 'give'),
259 259
 							'desc' => '',
260 260
 							'type' => 'give_title',
261 261
 							'id'   => 'give_title_general_settings_2'
262 262
 						),
263 263
 						array(
264
-							'name'    => esc_html__( 'Currency', 'give' ),
265
-							'desc'    => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'give' ),
264
+							'name'    => esc_html__('Currency', 'give'),
265
+							'desc'    => esc_html__('Choose your currency. Note that some payment gateways have currency restrictions.', 'give'),
266 266
 							'id'      => 'currency',
267 267
 							'type'    => 'select',
268 268
 							'options' => give_get_currencies(),
269 269
 							'default' => 'USD',
270 270
 						),
271 271
 						array(
272
-							'name'    => esc_html__( 'Currency Position', 'give' ),
273
-							'desc'    => esc_html__( 'Choose the position of the currency sign.', 'give' ),
272
+							'name'    => esc_html__('Currency Position', 'give'),
273
+							'desc'    => esc_html__('Choose the position of the currency sign.', 'give'),
274 274
 							'id'      => 'currency_position',
275 275
 							'type'    => 'select',
276 276
 							'options' => array(
277 277
 								/* translators: %s: currency symbol */
278
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
278
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
279 279
 								/* translators: %s: currency symbol */
280
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
280
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
281 281
 							),
282 282
 							'default' => 'before',
283 283
 						),
284 284
 						array(
285
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
286
-							'desc'            => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
285
+							'name'            => esc_html__('Thousands Separator', 'give'),
286
+							'desc'            => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
287 287
 							'id'              => 'thousands_separator',
288 288
 							'type'            => 'text_small',
289 289
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
290 290
 							'default'         => ',',
291 291
 						),
292 292
 						array(
293
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
294
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
293
+							'name'    => esc_html__('Decimal Separator', 'give'),
294
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
295 295
 							'id'      => 'decimal_separator',
296 296
 							'type'    => 'text_small',
297 297
 							'default' => '.',
298 298
 						),
299 299
 						array(
300
-							'name'            => __( 'Number of Decimals', 'give' ),
301
-							'desc'            => __( 'This sets the number of decimal points shown in displayed prices.', 'give' ),
300
+							'name'            => __('Number of Decimals', 'give'),
301
+							'desc'            => __('This sets the number of decimal points shown in displayed prices.', 'give'),
302 302
 							'id'              => 'number_decimals',
303 303
 							'type'            => 'text_small',
304 304
 							'default'         => 2,
@@ -312,83 +312,83 @@  discard block
 block discarded – undo
312 312
 			 */
313 313
 			'gateways'    => array(
314 314
 				'id'         => 'payment_gateways',
315
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
316
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
317
-				'fields'     => apply_filters( 'give_settings_gateways', array(
315
+				'give_title' => esc_html__('Payment Gateways', 'give'),
316
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
317
+				'fields'     => apply_filters('give_settings_gateways', array(
318 318
 						array(
319
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
319
+							'name' => esc_html__('Gateways Settings', 'give'),
320 320
 							'desc' => '',
321 321
 							'id'   => 'give_title_gateway_settings_1',
322 322
 							'type' => 'give_title'
323 323
 						),
324 324
 						array(
325
-							'name' => esc_html__( 'Test Mode', 'give' ),
326
-							'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
325
+							'name' => esc_html__('Test Mode', 'give'),
326
+							'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
327 327
 							'id'   => 'test_mode',
328 328
 							'type' => 'checkbox'
329 329
 						),
330 330
 						array(
331
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
332
-							'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
331
+							'name' => esc_html__('Enabled Gateways', 'give'),
332
+							'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
333 333
 							'id'   => 'gateways',
334 334
 							'type' => 'enabled_gateways'
335 335
 						),
336 336
 						array(
337
-							'name' => esc_html__( 'Default Gateway', 'give' ),
338
-							'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ),
337
+							'name' => esc_html__('Default Gateway', 'give'),
338
+							'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'),
339 339
 							'id'   => 'default_gateway',
340 340
 							'type' => 'default_gateway'
341 341
 						),
342 342
 						array(
343
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
343
+							'name' => esc_html__('PayPal Standard', 'give'),
344 344
 							'desc' => '',
345 345
 							'type' => 'give_title',
346 346
 							'id'   => 'give_title_gateway_settings_2',
347 347
 						),
348 348
 						array(
349
-							'name' => esc_html__( 'PayPal Email', 'give' ),
350
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
349
+							'name' => esc_html__('PayPal Email', 'give'),
350
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
351 351
 							'id'   => 'paypal_email',
352 352
 							'type' => 'text_email',
353 353
 						),
354 354
 						array(
355
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
356
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
355
+							'name' => esc_html__('PayPal Page Style', 'give'),
356
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
357 357
 							'id'   => 'paypal_page_style',
358 358
 							'type' => 'text',
359 359
 						),
360 360
 						array(
361
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
362
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
361
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
362
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
363 363
 							'id'      => 'paypal_button_type',
364 364
 							'type'    => 'radio_inline',
365 365
 							'options' => array(
366
-								'donation' => esc_html__( 'Donation', 'give' ),
367
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
366
+								'donation' => esc_html__('Donation', 'give'),
367
+								'standard' => esc_html__('Standard Transaction', 'give')
368 368
 							),
369 369
 							'default' => 'donation',
370 370
 						),
371 371
 						array(
372
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
373
-							'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
372
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
373
+							'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
374 374
 							'id'   => 'disable_paypal_verification',
375 375
 							'type' => 'checkbox'
376 376
 						),
377 377
 						array(
378
-							'name' => esc_html__( 'Offline Donations', 'give' ),
378
+							'name' => esc_html__('Offline Donations', 'give'),
379 379
 							'desc' => '',
380 380
 							'type' => 'give_title',
381 381
 							'id'   => 'give_title_gateway_settings_3',
382 382
 						),
383 383
 						array(
384
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
385
-							'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
384
+							'name' => esc_html__('Collect Billing Details', 'give'),
385
+							'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
386 386
 							'id'   => 'give_offline_donation_enable_billing_fields',
387 387
 							'type' => 'checkbox'
388 388
 						),
389 389
 						array(
390
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
391
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
390
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
391
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
392 392
 							'id'      => 'global_offline_donation_content',
393 393
 							'default' => give_get_default_offline_donation_content(),
394 394
 							'type'    => 'wysiwyg',
@@ -397,15 +397,15 @@  discard block
 block discarded – undo
397 397
 							)
398 398
 						),
399 399
 						array(
400
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
401
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
400
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
401
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
402 402
 							'id'      => 'offline_donation_subject',
403
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
403
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
404 404
 							'type'    => 'text'
405 405
 						),
406 406
 						array(
407
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
408
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
407
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
408
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
409 409
 							'id'      => 'global_offline_donation_email',
410 410
 							'default' => give_get_default_offline_donation_email_content(),
411 411
 							'type'    => 'wysiwyg',
@@ -419,95 +419,95 @@  discard block
 block discarded – undo
419 419
 			/** Display Settings */
420 420
 			'display'     => array(
421 421
 				'id'         => 'display_settings',
422
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
423
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
424
-				'fields'     => apply_filters( 'give_settings_display', array(
422
+				'give_title' => esc_html__('Display Settings', 'give'),
423
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
424
+				'fields'     => apply_filters('give_settings_display', array(
425 425
 						array(
426
-							'name' => esc_html__( 'Display Settings', 'give' ),
426
+							'name' => esc_html__('Display Settings', 'give'),
427 427
 							'desc' => '',
428 428
 							'id'   => 'give_title_display_settings_1',
429 429
 							'type' => 'give_title'
430 430
 						),
431 431
 						array(
432
-							'name' => esc_html__( 'Disable CSS', 'give' ),
433
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
432
+							'name' => esc_html__('Disable CSS', 'give'),
433
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
434 434
 							'id'   => 'disable_css',
435 435
 							'type' => 'checkbox'
436 436
 						),
437 437
 						array(
438
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
438
+							'name' => esc_html__('Enable Floating Labels', 'give'),
439 439
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
440
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
440
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
441 441
 							'id'   => 'enable_floatlabels',
442 442
 							'type' => 'checkbox'
443 443
 						),
444 444
 						array(
445
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
445
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
446 446
 							/* translators: %s: about page URL */
447
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
447
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), array('a' => array('href' => array()))), esc_url(admin_url('index.php?page=give-about'))),
448 448
 							'id'   => 'disable_welcome',
449 449
 							'type' => 'checkbox'
450 450
 						),
451 451
 						array(
452
-							'name' => esc_html__( 'Post Types', 'give' ),
452
+							'name' => esc_html__('Post Types', 'give'),
453 453
 							'desc' => '',
454 454
 							'id'   => 'give_title_display_settings_2',
455 455
 							'type' => 'give_title'
456 456
 						),
457 457
 						array(
458
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
459
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
458
+							'name' => esc_html__('Disable Form Single Views', 'give'),
459
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
460 460
 							'id'   => 'disable_forms_singular',
461 461
 							'type' => 'checkbox'
462 462
 						),
463 463
 						array(
464
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
465
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
464
+							'name' => esc_html__('Disable Form Archives', 'give'),
465
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
466 466
 							'id'   => 'disable_forms_archives',
467 467
 							'type' => 'checkbox'
468 468
 						),
469 469
 						array(
470
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
471
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
470
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
471
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
472 472
 							'id'   => 'disable_forms_excerpt',
473 473
 							'type' => 'checkbox'
474 474
 						),
475 475
 
476 476
 						array(
477
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
478
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
477
+							'name'    => esc_html__('Featured Image Size', 'give'),
478
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
479 479
 							'id'      => 'featured_image_size',
480 480
 							'type'    => 'select',
481 481
 							'default' => 'large',
482 482
 							'options' => give_get_featured_image_sizes()
483 483
 						),
484 484
 						array(
485
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
486
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
485
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
486
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
487 487
 							'id'   => 'disable_form_featured_img',
488 488
 							'type' => 'checkbox'
489 489
 						),
490 490
 						array(
491
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
492
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
491
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
492
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
493 493
 							'id'   => 'disable_form_sidebar',
494 494
 							'type' => 'checkbox'
495 495
 						),
496 496
 						array(
497
-							'name' => esc_html__( 'Taxonomies', 'give' ),
497
+							'name' => esc_html__('Taxonomies', 'give'),
498 498
 							'desc' => '',
499 499
 							'id'   => 'give_title_display_settings_3',
500 500
 							'type' => 'give_title'
501 501
 						),
502 502
 						array(
503
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
504
-							'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
503
+							'name' => esc_html__('Enable Form Categories', 'give'),
504
+							'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
505 505
 							'id'   => 'enable_categories',
506 506
 							'type' => 'checkbox'
507 507
 						),
508 508
 						array(
509
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
510
-							'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
509
+							'name' => esc_html__('Enable Form Tags', 'give'),
510
+							'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
511 511
 							'id'   => 'enable_tags',
512 512
 							'type' => 'checkbox'
513 513
 						),
@@ -520,95 +520,95 @@  discard block
 block discarded – undo
520 520
 			 */
521 521
 			'emails'      => array(
522 522
 				'id'         => 'email_settings',
523
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
524
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
525
-				'fields'     => apply_filters( 'give_settings_emails', array(
523
+				'give_title' => esc_html__('Email Settings', 'give'),
524
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
525
+				'fields'     => apply_filters('give_settings_emails', array(
526 526
 						array(
527
-							'name' => esc_html__( 'Email Settings', 'give' ),
527
+							'name' => esc_html__('Email Settings', 'give'),
528 528
 							'desc' => '',
529 529
 							'id'   => 'give_title_email_settings_1',
530 530
 							'type' => 'give_title'
531 531
 						),
532 532
 						array(
533 533
 							'id'      => 'email_template',
534
-							'name'    => esc_html__( 'Email Template', 'give' ),
535
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
534
+							'name'    => esc_html__('Email Template', 'give'),
535
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
536 536
 							'type'    => 'select',
537 537
 							'options' => give_get_email_templates()
538 538
 						),
539 539
 						array(
540 540
 							'id'   => 'email_logo',
541
-							'name' => esc_html__( 'Logo', 'give' ),
542
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
541
+							'name' => esc_html__('Logo', 'give'),
542
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
543 543
 							'type' => 'file'
544 544
 						),
545 545
 						array(
546 546
 							'id'      => 'from_name',
547
-							'name'    => esc_html__( 'From Name', 'give' ),
548
-							'desc'    => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
549
-							'default' => get_bloginfo( 'name' ),
547
+							'name'    => esc_html__('From Name', 'give'),
548
+							'desc'    => esc_html__('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
549
+							'default' => get_bloginfo('name'),
550 550
 							'type'    => 'text'
551 551
 						),
552 552
 						array(
553 553
 							'id'      => 'from_email',
554
-							'name'    => esc_html__( 'From Email', 'give' ),
555
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
556
-							'default' => get_bloginfo( 'admin_email' ),
554
+							'name'    => esc_html__('From Email', 'give'),
555
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
556
+							'default' => get_bloginfo('admin_email'),
557 557
 							'type'    => 'text'
558 558
 						),
559 559
 						array(
560
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
560
+							'name' => esc_html__('Donation Receipt', 'give'),
561 561
 							'desc' => '',
562 562
 							'id'   => 'give_title_email_settings_2',
563 563
 							'type' => 'give_title'
564 564
 						),
565 565
 						array(
566 566
 							'id'      => 'donation_subject',
567
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
568
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
569
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
567
+							'name'    => esc_html__('Donation Email Subject', 'give'),
568
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
569
+							'default' => esc_attr__('Donation Receipt', 'give'),
570 570
 							'type'    => 'text'
571 571
 						),
572 572
 						array(
573 573
 							'id'      => 'donation_receipt',
574
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
574
+							'name'    => esc_html__('Donation Receipt', 'give'),
575 575
 							/* translators: %s: emails tags list */
576
-							'desc'    => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
576
+							'desc'    => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
577 577
 							'type'    => 'wysiwyg',
578 578
 							'default' => give_get_default_donation_receipt_email()
579 579
 						),
580 580
 						array(
581
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
581
+							'name' => esc_html__('New Donation Notification', 'give'),
582 582
 							'desc' => '',
583 583
 							'id'   => 'give_title_email_settings_3',
584 584
 							'type' => 'give_title'
585 585
 						),
586 586
 						array(
587 587
 							'id'      => 'donation_notification_subject',
588
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
589
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
588
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
589
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
590 590
 							'type'    => 'text',
591
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
591
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
592 592
 						),
593 593
 						array(
594 594
 							'id'      => 'donation_notification',
595
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
595
+							'name'    => esc_html__('Donation Notification', 'give'),
596 596
 							/* translators: %s: emails tags list */
597
-							'desc'    => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
597
+							'desc'    => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
598 598
 							'type'    => 'wysiwyg',
599 599
 							'default' => give_get_default_donation_notification_email()
600 600
 						),
601 601
 						array(
602 602
 							'id'      => 'admin_notice_emails',
603
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
604
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
603
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
604
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
605 605
 							'type'    => 'textarea',
606
-							'default' => get_bloginfo( 'admin_email' )
606
+							'default' => get_bloginfo('admin_email')
607 607
 						),
608 608
 						array(
609 609
 							'id'   => 'disable_admin_notices',
610
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
611
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
610
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
611
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
612 612
 							'type' => 'checkbox'
613 613
 						)
614 614
 					)
@@ -617,99 +617,99 @@  discard block
 block discarded – undo
617 617
 			/** Extension Settings */
618 618
 			'addons'      => array(
619 619
 				'id'         => 'addons',
620
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
621
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
622
-				'fields'     => apply_filters( 'give_settings_addons', array()
620
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
621
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
622
+				'fields'     => apply_filters('give_settings_addons', array()
623 623
 				)
624 624
 			),
625 625
 			/** Licenses Settings */
626 626
 			'licenses'    => array(
627 627
 				'id'         => 'licenses',
628
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
629
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
630
-				'fields'     => apply_filters( 'give_settings_licenses', array()
628
+				'give_title' => esc_html__('Give Licenses', 'give'),
629
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
630
+				'fields'     => apply_filters('give_settings_licenses', array()
631 631
 				)
632 632
 			),
633 633
 			/** Advanced Options */
634 634
 			'advanced'    => array(
635 635
 				'id'         => 'advanced_options',
636
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
637
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
638
-				'fields'     => apply_filters( 'give_settings_advanced', array(
636
+				'give_title' => esc_html__('Advanced Options', 'give'),
637
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
638
+				'fields'     => apply_filters('give_settings_advanced', array(
639 639
 						array(
640
-							'name' => esc_html__( 'Access Control', 'give' ),
640
+							'name' => esc_html__('Access Control', 'give'),
641 641
 							'desc' => '',
642 642
 							'id'   => 'give_title_session_control_1',
643 643
 							'type' => 'give_title'
644 644
 						),
645 645
 						array(
646 646
 							'id'      => 'session_lifetime',
647
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
648
-							'desc'    => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
647
+							'name'    => esc_html__('Session Lifetime', 'give'),
648
+							'desc'    => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
649 649
 							'type'    => 'select',
650 650
 							'options' => array(
651
-								'86400'  => esc_html__( '24 Hours', 'give' ),
652
-								'172800' => esc_html__( '48 Hours', 'give' ),
653
-								'259200' => esc_html__( '72 Hours', 'give' ),
654
-								'604800' => esc_html__( '1 Week', 'give' ),
651
+								'86400'  => esc_html__('24 Hours', 'give'),
652
+								'172800' => esc_html__('48 Hours', 'give'),
653
+								'259200' => esc_html__('72 Hours', 'give'),
654
+								'604800' => esc_html__('1 Week', 'give'),
655 655
 							)
656 656
 						),
657 657
 						array(
658
-							'name' => esc_html__( 'Email Access', 'give' ),
659
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
658
+							'name' => esc_html__('Email Access', 'give'),
659
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
660 660
 							'id'   => 'email_access',
661 661
 							'type' => 'checkbox',
662 662
 						),
663 663
 						array(
664 664
 							'id'      => 'recaptcha_key',
665
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
665
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
666 666
 							/* translators: %s: https://www.google.com/recaptcha/ */
667
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
667
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
668 668
 							'default' => '',
669 669
 							'type'    => 'text'
670 670
 						),
671 671
 						array(
672 672
 							'id'      => 'recaptcha_secret',
673
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
674
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
673
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
674
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
675 675
 							'default' => '',
676 676
 							'type'    => 'text'
677 677
 						),
678 678
 						array(
679
-							'name' => esc_html__( 'Data Control', 'give' ),
679
+							'name' => esc_html__('Data Control', 'give'),
680 680
 							'desc' => '',
681 681
 							'id'   => 'give_title_data_control_2',
682 682
 							'type' => 'give_title'
683 683
 						),
684 684
 						array(
685
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
686
-							'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
685
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
686
+							'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
687 687
 							'id'   => 'uninstall_on_delete',
688 688
 							'type' => 'checkbox'
689 689
 						),
690 690
 						array(
691
-							'name' => esc_html__( 'Filter Control', 'give' ),
691
+							'name' => esc_html__('Filter Control', 'give'),
692 692
 							'desc' => '',
693 693
 							'id'   => 'give_title_filter_control',
694 694
 							'type' => 'give_title'
695 695
 						),
696 696
 						array(
697 697
 							/* translators: %s: the_content */
698
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
698
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
699 699
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
700
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
700
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
701 701
 							'id'   => 'disable_the_content_filter',
702 702
 							'type' => 'checkbox'
703 703
 						),
704 704
 						array(
705
-							'name' => esc_html__( 'Script Loading', 'give' ),
705
+							'name' => esc_html__('Script Loading', 'give'),
706 706
 							'desc' => '',
707 707
 							'id'   => 'give_title_script_control',
708 708
 							'type' => 'give_title'
709 709
 						),
710 710
 						array(
711
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
712
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
711
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
712
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
713 713
 							'id'   => 'scripts_footer',
714 714
 							'type' => 'checkbox'
715 715
 						)
@@ -719,13 +719,13 @@  discard block
 block discarded – undo
719 719
 			/** API Settings */
720 720
 			'api'         => array(
721 721
 				'id'         => 'api',
722
-				'give_title' => esc_html__( 'API', 'give' ),
723
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
722
+				'give_title' => esc_html__('API', 'give'),
723
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
724 724
 				'show_names' => false, // Hide field names on the left
725
-				'fields'     => apply_filters( 'give_settings_system', array(
725
+				'fields'     => apply_filters('give_settings_system', array(
726 726
 						array(
727 727
 							'id'   => 'api',
728
-							'name' => esc_html__( 'API', 'give' ),
728
+							'name' => esc_html__('API', 'give'),
729 729
 							'type' => 'api'
730 730
 						)
731 731
 					)
@@ -734,13 +734,13 @@  discard block
 block discarded – undo
734 734
 			/** Licenses Settings */
735 735
 			'system_info' => array(
736 736
 				'id'         => 'system_info',
737
-				'give_title' => esc_html__( 'System Info', 'give' ),
738
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
739
-				'fields'     => apply_filters( 'give_settings_system', array(
737
+				'give_title' => esc_html__('System Info', 'give'),
738
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
739
+				'fields'     => apply_filters('give_settings_system', array(
740 740
 						array(
741 741
 							'id'   => 'system_info',
742
-							'name' => esc_html__( 'System Info', 'give' ),
743
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
742
+							'name' => esc_html__('System Info', 'give'),
743
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
744 744
 							'type' => 'system_info'
745 745
 						)
746 746
 					)
@@ -749,15 +749,15 @@  discard block
 block discarded – undo
749 749
 		);
750 750
 
751 751
 		//Return all settings array if no active tab
752
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
752
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
753 753
 
754
-			return apply_filters( 'give_registered_settings', $give_settings );
754
+			return apply_filters('give_registered_settings', $give_settings);
755 755
 
756 756
 		}
757 757
 
758 758
 
759 759
 		// Add other tabs and settings fields as needed
760
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
760
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
761 761
 
762 762
 	}
763 763
 
@@ -766,11 +766,11 @@  discard block
 block discarded – undo
766 766
 	 */
767 767
 	public function settings_notices() {
768 768
 
769
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
769
+		if ( ! isset($_POST['give_settings_saved'])) {
770 770
 			return;
771 771
 		}
772 772
 
773
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
773
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
774 774
 
775 775
 	}
776 776
 
@@ -784,17 +784,17 @@  discard block
 block discarded – undo
784 784
 	 *
785 785
 	 * @return mixed          Field value or exception is thrown
786 786
 	 */
787
-	public function __get( $field ) {
787
+	public function __get($field) {
788 788
 
789 789
 		// Allowed fields to retrieve
790
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
790
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
791 791
 			return $this->{$field};
792 792
 		}
793
-		if ( 'option_metabox' === $field ) {
793
+		if ('option_metabox' === $field) {
794 794
 			return $this->option_metabox();
795 795
 		}
796 796
 
797
-		throw new Exception( 'Invalid property: ' . $field );
797
+		throw new Exception('Invalid property: '.$field);
798 798
 	}
799 799
 
800 800
 
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
  *
813 813
  * @return mixed        Option value
814 814
  */
815
-function give_get_option( $key = '', $default = false ) {
815
+function give_get_option($key = '', $default = false) {
816 816
 	global $give_options;
817
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
818
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
817
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
818
+	$value = apply_filters('give_get_option', $value, $key, $default);
819 819
 
820
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
820
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
821 821
 }
822 822
 
823 823
 
@@ -835,33 +835,33 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return boolean True if updated, false if not.
837 837
  */
838
-function give_update_option( $key = '', $value = false ) {
838
+function give_update_option($key = '', $value = false) {
839 839
 
840 840
 	// If no key, exit
841
-	if ( empty( $key ) ) {
841
+	if (empty($key)) {
842 842
 		return false;
843 843
 	}
844 844
 
845
-	if ( empty( $value ) ) {
846
-		$remove_option = give_delete_option( $key );
845
+	if (empty($value)) {
846
+		$remove_option = give_delete_option($key);
847 847
 
848 848
 		return $remove_option;
849 849
 	}
850 850
 
851 851
 	// First let's grab the current settings
852
-	$options = get_option( 'give_settings' );
852
+	$options = get_option('give_settings');
853 853
 
854 854
 	// Let's let devs alter that value coming in
855
-	$value = apply_filters( 'give_update_option', $value, $key );
855
+	$value = apply_filters('give_update_option', $value, $key);
856 856
 
857 857
 	// Next let's try to update the value
858
-	$options[ $key ] = $value;
859
-	$did_update      = update_option( 'give_settings', $options );
858
+	$options[$key] = $value;
859
+	$did_update      = update_option('give_settings', $options);
860 860
 
861 861
 	// If it updated, let's update the global variable
862
-	if ( $did_update ) {
862
+	if ($did_update) {
863 863
 		global $give_options;
864
-		$give_options[ $key ] = $value;
864
+		$give_options[$key] = $value;
865 865
 	}
866 866
 
867 867
 	return $did_update;
@@ -878,27 +878,27 @@  discard block
 block discarded – undo
878 878
  *
879 879
  * @return boolean True if updated, false if not.
880 880
  */
881
-function give_delete_option( $key = '' ) {
881
+function give_delete_option($key = '') {
882 882
 
883 883
 	// If no key, exit
884
-	if ( empty( $key ) ) {
884
+	if (empty($key)) {
885 885
 		return false;
886 886
 	}
887 887
 
888 888
 	// First let's grab the current settings
889
-	$options = get_option( 'give_settings' );
889
+	$options = get_option('give_settings');
890 890
 
891 891
 	// Next let's try to update the value
892
-	if ( isset( $options[ $key ] ) ) {
892
+	if (isset($options[$key])) {
893 893
 
894
-		unset( $options[ $key ] );
894
+		unset($options[$key]);
895 895
 
896 896
 	}
897 897
 
898
-	$did_update = update_option( 'give_settings', $options );
898
+	$did_update = update_option('give_settings', $options);
899 899
 
900 900
 	// If it updated, let's update the global variable
901
-	if ( $did_update ) {
901
+	if ($did_update) {
902 902
 		global $give_options;
903 903
 		$give_options = $options;
904 904
 	}
@@ -917,9 +917,9 @@  discard block
 block discarded – undo
917 917
  */
918 918
 function give_get_settings() {
919 919
 
920
-	$settings = get_option( 'give_settings' );
920
+	$settings = get_option('give_settings');
921 921
 
922
-	return (array) apply_filters( 'give_get_settings', $settings );
922
+	return (array) apply_filters('give_get_settings', $settings);
923 923
 
924 924
 }
925 925
 
@@ -937,25 +937,25 @@  discard block
 block discarded – undo
937 937
  *
938 938
  * @return array
939 939
  */
940
-function give_settings_array_insert( $array, $position, $insert ) {
941
-	if ( is_int( $position ) ) {
942
-		array_splice( $array, $position, 0, $insert );
940
+function give_settings_array_insert($array, $position, $insert) {
941
+	if (is_int($position)) {
942
+		array_splice($array, $position, 0, $insert);
943 943
 	} else {
944 944
 
945
-		foreach ( $array as $index => $subarray ) {
946
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
945
+		foreach ($array as $index => $subarray) {
946
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
947 947
 				$pos = $index;
948 948
 			}
949 949
 		}
950 950
 
951
-		if ( ! isset( $pos ) ) {
951
+		if ( ! isset($pos)) {
952 952
 			return $array;
953 953
 		}
954 954
 
955 955
 		$array = array_merge(
956
-			array_slice( $array, 0, $pos ),
956
+			array_slice($array, 0, $pos),
957 957
 			$insert,
958
-			array_slice( $array, $pos )
958
+			array_slice($array, $pos)
959 959
 		);
960 960
 	}
961 961
 
@@ -978,31 +978,31 @@  discard block
 block discarded – undo
978 978
  *
979 979
  * @return void
980 980
  */
981
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
981
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
982 982
 
983 983
 	$id                = $field_type_object->field->args['id'];
984 984
 	$field_description = $field_type_object->field->args['desc'];
985
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
985
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
986 986
 
987 987
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
988 988
 
989
-	foreach ( $gateways as $key => $option ) :
989
+	foreach ($gateways as $key => $option) :
990 990
 
991
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
991
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
992 992
 			$enabled = '1';
993 993
 		} else {
994 994
 			$enabled = null;
995 995
 		}
996 996
 
997
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
998
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
997
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
998
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
999 999
 
1000 1000
 	endforeach;
1001 1001
 
1002 1002
 	echo '</ul>';
1003 1003
 
1004
-	if ( $field_description ) {
1005
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1004
+	if ($field_description) {
1005
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1006 1006
 	}
1007 1007
 
1008 1008
 }
@@ -1018,31 +1018,31 @@  discard block
 block discarded – undo
1018 1018
  *
1019 1019
  * @return void
1020 1020
  */
1021
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1021
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1022 1022
 
1023 1023
 	$id                = $field_type_object->field->args['id'];
1024 1024
 	$field_description = $field_type_object->field->args['desc'];
1025 1025
 	$gateways          = give_get_enabled_payment_gateways();
1026 1026
 
1027
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1027
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1028 1028
 
1029 1029
 	//Add a field to the Give Form admin single post view of this field
1030
-	if ( $field_type_object->field->object_type === 'post' ) {
1031
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1030
+	if ($field_type_object->field->object_type === 'post') {
1031
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1032 1032
 	}
1033 1033
 
1034
-	foreach ( $gateways as $key => $option ) :
1034
+	foreach ($gateways as $key => $option) :
1035 1035
 
1036
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1036
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1037 1037
 
1038 1038
 
1039
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1039
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1040 1040
 
1041 1041
 	endforeach;
1042 1042
 
1043 1043
 	echo '</select>';
1044 1044
 
1045
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1045
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1046 1046
 
1047 1047
 }
1048 1048
 
@@ -1057,13 +1057,13 @@  discard block
 block discarded – undo
1057 1057
  *
1058 1058
  * @return void
1059 1059
  */
1060
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1060
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1061 1061
 
1062 1062
 	$id                = $field_type_object->field->args['id'];
1063 1063
 	$title             = $field_type_object->field->args['name'];
1064 1064
 	$field_description = $field_type_object->field->args['desc'];
1065 1065
 
1066
-	echo '<hr>' . $field_description;
1066
+	echo '<hr>'.$field_description;
1067 1067
 
1068 1068
 }
1069 1069
 
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
  *
1079 1079
  * @return void
1080 1080
  */
1081
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1081
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1082 1082
 
1083 1083
 	$id                = $field_type_object->field->args['id'];
1084 1084
 	$title             = $field_type_object->field->args['name'];
@@ -1098,25 +1098,25 @@  discard block
 block discarded – undo
1098 1098
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1099 1099
  * @return array An array of options that matches the CMB2 options array
1100 1100
  */
1101
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1101
+function give_cmb2_get_post_options($query_args, $force = false) {
1102 1102
 
1103
-	$post_options = array( '' => '' ); // Blank option
1103
+	$post_options = array('' => ''); // Blank option
1104 1104
 
1105
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1105
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1106 1106
 		return $post_options;
1107 1107
 	}
1108 1108
 
1109
-	$args = wp_parse_args( $query_args, array(
1109
+	$args = wp_parse_args($query_args, array(
1110 1110
 		'post_type'   => 'page',
1111 1111
 		'numberposts' => 10,
1112
-	) );
1112
+	));
1113 1113
 
1114
-	$posts = get_posts( $args );
1114
+	$posts = get_posts($args);
1115 1115
 
1116
-	if ( $posts ) {
1117
-		foreach ( $posts as $post ) {
1116
+	if ($posts) {
1117
+		foreach ($posts as $post) {
1118 1118
 
1119
-			$post_options[ $post->ID ] = $post->post_title;
1119
+			$post_options[$post->ID] = $post->post_title;
1120 1120
 
1121 1121
 		}
1122 1122
 	}
@@ -1136,17 +1136,17 @@  discard block
 block discarded – undo
1136 1136
 	global $_wp_additional_image_sizes;
1137 1137
 	$sizes = array();
1138 1138
 
1139
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1139
+	foreach (get_intermediate_image_sizes() as $_size) {
1140 1140
 
1141
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1142
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1143
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1144
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1141
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1142
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1143
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1144
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1145 1145
 		}
1146 1146
 
1147 1147
 	}
1148 1148
 
1149
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1149
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1150 1150
 }
1151 1151
 
1152 1152
 
@@ -1161,34 +1161,34 @@  discard block
 block discarded – undo
1161 1161
  *
1162 1162
  * @return void
1163 1163
  */
1164
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1164
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1165 1165
 
1166 1166
 	$id                = $field_type_object->field->args['id'];
1167 1167
 	$field_description = $field_type_object->field->args['desc'];
1168
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1168
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1169 1169
 	$field_classes     = 'regular-text give-license-field';
1170
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1170
+	$type              = empty($escaped_value) ? 'text' : 'password';
1171 1171
 
1172
-	if ( $license_status === 'valid' ) {
1172
+	if ($license_status === 'valid') {
1173 1173
 		$field_classes .= ' give-license-active';
1174 1174
 	}
1175 1175
 
1176
-	$html = $field_type_object->input( array(
1176
+	$html = $field_type_object->input(array(
1177 1177
 		'class' => $field_classes,
1178 1178
 		'type'  => $type
1179
-	) );
1179
+	));
1180 1180
 
1181 1181
 	//License is active so show deactivate button
1182
-	if ( $license_status === 'valid' ) {
1183
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1182
+	if ($license_status === 'valid') {
1183
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1184 1184
 	} else {
1185 1185
 		//This license is not valid so delete it
1186
-		give_delete_option( $id );
1186
+		give_delete_option($id);
1187 1187
 	}
1188 1188
 
1189
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1189
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1190 1190
 
1191
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1191
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1192 1192
 
1193 1193
 	echo $html;
1194 1194
 }
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
  */
1203 1203
 function give_api_callback() {
1204 1204
 
1205
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1205
+	if ( ! current_user_can('manage_give_settings')) {
1206 1206
 		return;
1207 1207
 	}
1208 1208
 
@@ -1211,9 +1211,9 @@  discard block
 block discarded – undo
1211 1211
 	 *
1212 1212
 	 * @since 1.0
1213 1213
 	 */
1214
-	do_action( 'give_tools_api_keys_before' );
1214
+	do_action('give_tools_api_keys_before');
1215 1215
 
1216
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1216
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1217 1217
 
1218 1218
 	$api_keys_table = new Give_API_Keys_Table();
1219 1219
 	$api_keys_table->prepare_items();
@@ -1222,9 +1222,9 @@  discard block
 block discarded – undo
1222 1222
 	<span class="cmb2-metabox-description api-description">
1223 1223
 		<?php echo sprintf(
1224 1224
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1225
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1226
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1227
-			esc_url( 'https://givewp.com/addons/zapier/' )
1225
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1226
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1227
+			esc_url('https://givewp.com/addons/zapier/')
1228 1228
 		); ?>
1229 1229
 	</span>
1230 1230
 	<?php
@@ -1234,10 +1234,10 @@  discard block
 block discarded – undo
1234 1234
 	 *
1235 1235
 	 * @since 1.0
1236 1236
 	 */
1237
-	do_action( 'give_tools_api_keys_after' );
1237
+	do_action('give_tools_api_keys_after');
1238 1238
 }
1239 1239
 
1240
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1240
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1241 1241
 
1242 1242
 /**
1243 1243
  * Hook Callback
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
  *
1251 1251
  * @return void
1252 1252
  */
1253
-function give_hook_callback( $args ) {
1254
-	do_action( 'give_' . $args['id'] );
1253
+function give_hook_callback($args) {
1254
+	do_action('give_'.$args['id']);
1255 1255
 }
1256 1256
 
1257 1257
 /**
@@ -1262,10 +1262,10 @@  discard block
 block discarded – undo
1262 1262
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1263 1263
  */
1264 1264
 
1265
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1266
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1267
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1268
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1269
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1270
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1265
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1266
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1267
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1268
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1269
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1270
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1271 1271
 }
1272 1272
\ No newline at end of file
Please login to merge, or discard this patch.
includes/formatting.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
  * @param $field_args
243 243
  * @param $field
244 244
  *
245
- * @return bool
245
+ * @return false|null
246 246
  */
247 247
 function give_format_admin_multilevel_amount( $field_args, $field ) {
248 248
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
  * @param array  $field_args
392 392
  * @param object $field
393 393
  *
394
- * @return mixed
394
+ * @return string
395 395
  */
396 396
 function give_sanitize_thousand_separator( $value, $field_args, $field ){
397 397
     return $value;
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
  * @param array  $field_args
423 423
  * @param object $field
424 424
  *
425
- * @return mixed
425
+ * @return string
426 426
  */
427 427
 function give_sanitize_price_field_value( $value, $field_args, $field ){
428 428
     return give_sanitize_amount( $value );
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-    return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+	return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-    return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option( 'thousands_separator', ',' );
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-    return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option( 'decimal_separator', '.' );
49 49
 }
50 50
 
51 51
 /**
@@ -64,65 +64,65 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
66 66
 
67
-    // Bailout.
68
-    if( empty( $number ) ) {
69
-        return $number;
70
-    }
67
+	// Bailout.
68
+	if( empty( $number ) ) {
69
+		return $number;
70
+	}
71 71
 
72 72
 	// Remove slash from amount.
73 73
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
74 74
 	// To prevent notices and warning remove slash from amount/number.
75 75
 	$number = wp_unslash( $number );
76 76
 
77
-    $thousand_separator = give_get_price_thousand_separator();
77
+	$thousand_separator = give_get_price_thousand_separator();
78 78
 
79
-    $locale   = localeconv();
80
-    $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
79
+	$locale   = localeconv();
80
+	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
81 81
 
82
-    // Remove locale from string
83
-    if ( ! is_float( $number ) ) {
84
-        $number = str_replace( $decimals, '.', $number );
85
-    }
82
+	// Remove locale from string
83
+	if ( ! is_float( $number ) ) {
84
+		$number = str_replace( $decimals, '.', $number );
85
+	}
86 86
 
87
-    // Remove thousand amount formatting if amount has.
88
-    // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
89
-    // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
90
-    if(  ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
91
-        $number = str_replace( $thousand_separator, '', $number );
92
-    } elseif ( in_array( $thousand_separator, $decimals ) ) {
87
+	// Remove thousand amount formatting if amount has.
88
+	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
89
+	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
90
+	if(  ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
91
+		$number = str_replace( $thousand_separator, '', $number );
92
+	} elseif ( in_array( $thousand_separator, $decimals ) ) {
93 93
 		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
94 94
 	}
95 95
 
96
-    // Remove non numeric entity before decimal separator.
97
-    $number     = preg_replace( '/[^0-9\.]/', '', $number );
98
-    $default_dp = give_get_price_decimals();
96
+	// Remove non numeric entity before decimal separator.
97
+	$number     = preg_replace( '/[^0-9\.]/', '', $number );
98
+	$default_dp = give_get_price_decimals();
99 99
 
100
-    // Format number of decimals in number.
101
-    if( false !== $dp ) {
102
-        $dp     = intval(  empty( $dp ) ? $default_dp : $dp );
103
-        $dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
104
-        $number = number_format( floatval( $number ), $dp, '.', '' );
105
-    }
100
+	// Format number of decimals in number.
101
+	if( false !== $dp ) {
102
+		$dp     = intval(  empty( $dp ) ? $default_dp : $dp );
103
+		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
104
+		$number = number_format( floatval( $number ), $dp, '.', '' );
105
+	}
106 106
 
107
-    // Reset negative amount to zero.
107
+	// Reset negative amount to zero.
108 108
 	if ( 0 > $number ) {
109 109
 		$number = number_format( 0, $default_dp, '.' );
110 110
 	}
111 111
 
112
-    // If number does not have decimal then add number of decimals to it.
113
-    if(
114
-        false === strpos( $number, '.' )
115
-        || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) )
116
-    ) {
117
-        $number = number_format( $number, $default_dp, '.', '' );
118
-    }
112
+	// If number does not have decimal then add number of decimals to it.
113
+	if(
114
+		false === strpos( $number, '.' )
115
+		|| ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) )
116
+	) {
117
+		$number = number_format( $number, $default_dp, '.', '' );
118
+	}
119 119
 
120
-    // Trim zeros.
121
-    if ( $trim_zeros && strstr( $number, '.' ) ) {
122
-        $number = rtrim( rtrim( $number, '0' ), '.' );
123
-    }
120
+	// Trim zeros.
121
+	if ( $trim_zeros && strstr( $number, '.' ) ) {
122
+		$number = rtrim( rtrim( $number, '0' ), '.' );
123
+	}
124 124
 
125
-    return apply_filters( 'give_sanitize_amount', $number );
125
+	return apply_filters( 'give_sanitize_amount', $number );
126 126
 }
127 127
 
128 128
 /**
@@ -168,31 +168,31 @@  discard block
 block discarded – undo
168 168
  */
169 169
 function give_human_format_large_amount( $amount ) {
170 170
 
171
-    // Get thousand separator.
172
-    $thousands_sep = give_get_price_thousand_separator();
171
+	// Get thousand separator.
172
+	$thousands_sep = give_get_price_thousand_separator();
173 173
 
174
-    // Sanitize amount.
175
-    $sanitize_amount = give_sanitize_amount( $amount );
174
+	// Sanitize amount.
175
+	$sanitize_amount = give_sanitize_amount( $amount );
176 176
 
177
-    // Explode amount to calculate name of large numbers.
177
+	// Explode amount to calculate name of large numbers.
178 178
 	$amount_array = explode( $thousands_sep, $amount );
179 179
 
180
-    // Calculate amount parts count.
181
-    $amount_count_parts = count( $amount_array );
180
+	// Calculate amount parts count.
181
+	$amount_count_parts = count( $amount_array );
182 182
 
183 183
 	// Human format amount (default).
184 184
 	$human_format_amount = $amount;
185 185
 
186
-    // Calculate large number formatted amount.
187
-    if ( 4 < $amount_count_parts ){
188
-        $human_format_amount =  sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
-    } elseif ( 3 < $amount_count_parts ){
190
-        $human_format_amount =  sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
191
-    } elseif ( 2 < $amount_count_parts  ) {
192
-        $human_format_amount =  sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
193
-    }
186
+	// Calculate large number formatted amount.
187
+	if ( 4 < $amount_count_parts ){
188
+		$human_format_amount =  sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
+	} elseif ( 3 < $amount_count_parts ){
190
+		$human_format_amount =  sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
191
+	} elseif ( 2 < $amount_count_parts  ) {
192
+		$human_format_amount =  sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
193
+	}
194 194
 
195
-    return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
195
+	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
196 196
 }
197 197
 
198 198
 /**
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
  * @return string $amount Newly formatted amount or Price Not Available
207 207
  */
208 208
 function give_format_decimal( $amount, $dp = false ){
209
-    $decimal_separator = give_get_price_decimal_separator();
210
-    $formatted_amount  = give_sanitize_amount( $amount, $dp );
209
+	$decimal_separator = give_get_price_decimal_separator();
210
+	$formatted_amount  = give_sanitize_amount( $amount, $dp );
211 211
 
212
-    if( false !== strpos( $formatted_amount, '.' ) ) {
213
-        $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
214
-    }
212
+	if( false !== strpos( $formatted_amount, '.' ) ) {
213
+		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
214
+	}
215 215
 
216
-    return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
216
+	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
217 217
 }
218 218
 
219 219
 
@@ -257,66 +257,66 @@  discard block
 block discarded – undo
257 257
 	$negative = $price < 0;
258 258
 
259 259
 	if ( $negative ) {
260
-        // Remove proceeding "-".
260
+		// Remove proceeding "-".
261 261
 		$price = substr( $price, 1 );
262 262
 	}
263 263
 
264 264
 	$symbol = give_currency_symbol( $currency );
265 265
 
266
-    switch ( $currency ):
267
-        case 'GBP' :
268
-        case 'BRL' :
269
-        case 'EUR' :
270
-        case 'USD' :
271
-        case 'AUD' :
272
-        case 'CAD' :
273
-        case 'HKD' :
274
-        case 'MXN' :
275
-        case 'NZD' :
276
-        case 'SGD' :
277
-        case 'JPY' :
278
-        case 'THB' :
279
-        case 'INR' :
280
-        case 'RIAL' :
281
-        case 'TRY' :
282
-        case 'RUB' :
283
-        case 'SEK' :
284
-        case 'PLN' :
285
-        case 'PHP' :
286
-        case 'TWD' :
287
-        case 'MYR' :
288
-        case 'CZK' :
289
-        case 'DKK' :
290
-        case 'HUF' :
291
-        case 'ILS' :
292
-        case 'MAD' :
293
-        case 'KRW' :
294
-        case 'ZAR' :
295
-            $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
296
-            break;
297
-        case 'NOK' :
298
-            $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
299
-            break;
300
-        default :
301
-            $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
302
-            break;
303
-    endswitch;
304
-
305
-    /**
306
-     * Filter formatted amount with currency
307
-     *
308
-     * Filter name depends upon current value of currency and currency position.
309
-     * For example :
310
-     *           if currency is USD and currency position is before then
311
-     *           filter name will be give_usd_currency_filter_before
312
-     *
313
-     *           and if currency is USD and currency position is after then
314
-     *           filter name will be give_usd_currency_filter_after
315
-     *
316
-     */
317
-    $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
318
-
319
-    if ( $negative ) {
266
+	switch ( $currency ):
267
+		case 'GBP' :
268
+		case 'BRL' :
269
+		case 'EUR' :
270
+		case 'USD' :
271
+		case 'AUD' :
272
+		case 'CAD' :
273
+		case 'HKD' :
274
+		case 'MXN' :
275
+		case 'NZD' :
276
+		case 'SGD' :
277
+		case 'JPY' :
278
+		case 'THB' :
279
+		case 'INR' :
280
+		case 'RIAL' :
281
+		case 'TRY' :
282
+		case 'RUB' :
283
+		case 'SEK' :
284
+		case 'PLN' :
285
+		case 'PHP' :
286
+		case 'TWD' :
287
+		case 'MYR' :
288
+		case 'CZK' :
289
+		case 'DKK' :
290
+		case 'HUF' :
291
+		case 'ILS' :
292
+		case 'MAD' :
293
+		case 'KRW' :
294
+		case 'ZAR' :
295
+			$formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
296
+			break;
297
+		case 'NOK' :
298
+			$formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
299
+			break;
300
+		default :
301
+			$formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
302
+			break;
303
+	endswitch;
304
+
305
+	/**
306
+	 * Filter formatted amount with currency
307
+	 *
308
+	 * Filter name depends upon current value of currency and currency position.
309
+	 * For example :
310
+	 *           if currency is USD and currency position is before then
311
+	 *           filter name will be give_usd_currency_filter_before
312
+	 *
313
+	 *           and if currency is USD and currency position is after then
314
+	 *           filter name will be give_usd_currency_filter_after
315
+	 *
316
+	 */
317
+	$formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
318
+
319
+	if ( $negative ) {
320 320
 		// Prepend the minus sign before the currency sign.
321 321
 		$formatted = '-' . $formatted;
322 322
 	}
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function give_currency_decimal_filter() {
336 336
 
337
-    remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
337
+	remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
338 338
 
339
-    // Set default number of decimals.
340
-    $decimals = give_get_price_decimals();
339
+	// Set default number of decimals.
340
+	$decimals = give_get_price_decimals();
341 341
 
342
-    add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
342
+	add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
343 343
 
344 344
 
345
-    // Get number of decimals with backward compatibility ( version < 1.6 )
346
-    if( 1 <= func_num_args() ){
347
-        $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
348
-    }
345
+	// Get number of decimals with backward compatibility ( version < 1.6 )
346
+	if( 1 <= func_num_args() ){
347
+		$decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
348
+	}
349 349
 
350 350
 	$currency = give_get_currency();
351 351
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
  * @return mixed
378 378
  */
379 379
 function give_sanitize_thousand_separator( $value, $field_args, $field ){
380
-    return stripslashes( $value );
380
+	return stripslashes( $value );
381 381
 }
382 382
 
383 383
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
  * @return mixed
409 409
  */
410 410
 function give_sanitize_price_field_value( $value, $field_args, $field ){
411
-    return give_sanitize_amount( $value );
411
+	return give_sanitize_amount( $value );
412 412
 }
413 413
 
414 414
 
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-    return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+    return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0));
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-    return give_get_option( 'thousands_separator', ',' );
37
+    return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-    return give_get_option( 'decimal_separator', '.' );
48
+    return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -62,67 +62,67 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string $amount Newly sanitized amount
64 64
  */
65
-function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
65
+function give_sanitize_amount($number, $dp = false, $trim_zeros = false) {
66 66
 
67 67
     // Bailout.
68
-    if( empty( $number ) ) {
68
+    if (empty($number)) {
69 69
         return $number;
70 70
     }
71 71
 
72 72
 	// Remove slash from amount.
73 73
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
74 74
 	// To prevent notices and warning remove slash from amount/number.
75
-	$number = wp_unslash( $number );
75
+	$number = wp_unslash($number);
76 76
 
77 77
     $thousand_separator = give_get_price_thousand_separator();
78 78
 
79 79
     $locale   = localeconv();
80
-    $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
80
+    $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
81 81
 
82 82
     // Remove locale from string
83
-    if ( ! is_float( $number ) ) {
84
-        $number = str_replace( $decimals, '.', $number );
83
+    if ( ! is_float($number)) {
84
+        $number = str_replace($decimals, '.', $number);
85 85
     }
86 86
 
87 87
     // Remove thousand amount formatting if amount has.
88 88
     // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
89 89
     // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
90
-    if(  ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
91
-        $number = str_replace( $thousand_separator, '', $number );
92
-    } elseif ( in_array( $thousand_separator, $decimals ) ) {
93
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
90
+    if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
91
+        $number = str_replace($thousand_separator, '', $number);
92
+    } elseif (in_array($thousand_separator, $decimals)) {
93
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
94 94
 	}
95 95
 
96 96
     // Remove non numeric entity before decimal separator.
97
-    $number     = preg_replace( '/[^0-9\.]/', '', $number );
97
+    $number     = preg_replace('/[^0-9\.]/', '', $number);
98 98
     $default_dp = give_get_price_decimals();
99 99
 
100 100
     // Format number of decimals in number.
101
-    if( false !== $dp ) {
102
-        $dp     = intval(  empty( $dp ) ? $default_dp : $dp );
103
-        $dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
104
-        $number = number_format( floatval( $number ), $dp, '.', '' );
101
+    if (false !== $dp) {
102
+        $dp     = intval(empty($dp) ? $default_dp : $dp);
103
+        $dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
104
+        $number = number_format(floatval($number), $dp, '.', '');
105 105
     }
106 106
 
107 107
     // Reset negative amount to zero.
108
-	if ( 0 > $number ) {
109
-		$number = number_format( 0, $default_dp, '.' );
108
+	if (0 > $number) {
109
+		$number = number_format(0, $default_dp, '.');
110 110
 	}
111 111
 
112 112
     // If number does not have decimal then add number of decimals to it.
113
-    if(
114
-        false === strpos( $number, '.' )
115
-        || ( $default_dp > strlen( substr( $number, strpos( $number , '.' ) + 1 ) ) )
113
+    if (
114
+        false === strpos($number, '.')
115
+        || ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
116 116
     ) {
117
-        $number = number_format( $number, $default_dp, '.', '' );
117
+        $number = number_format($number, $default_dp, '.', '');
118 118
     }
119 119
 
120 120
     // Trim zeros.
121
-    if ( $trim_zeros && strstr( $number, '.' ) ) {
122
-        $number = rtrim( rtrim( $number, '0' ), '.' );
121
+    if ($trim_zeros && strstr($number, '.')) {
122
+        $number = rtrim(rtrim($number, '0'), '.');
123 123
     }
124 124
 
125
-    return apply_filters( 'give_sanitize_amount', $number );
125
+    return apply_filters('give_sanitize_amount', $number);
126 126
 }
127 127
 
128 128
 /**
@@ -135,22 +135,22 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return string $amount Newly formatted amount or Price Not Available
137 137
  */
138
-function give_format_amount( $amount, $decimals = true ) {
139
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
140
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
138
+function give_format_amount($amount, $decimals = true) {
139
+	$thousands_sep = give_get_option('thousands_separator', ',');
140
+	$decimal_sep   = give_get_option('decimal_separator', '.');
141 141
 
142
-	if ( empty( $amount ) ) {
142
+	if (empty($amount)) {
143 143
 		$amount = 0;
144 144
 	} else {
145 145
 		// Sanitize amount before formatting.
146
-		$amount = give_sanitize_amount( $amount );
146
+		$amount = give_sanitize_amount($amount);
147 147
 	}
148 148
 
149 149
 	$decimals = give_get_price_decimals();
150 150
 
151
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
151
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
152 152
 
153
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
153
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
154 154
 }
155 155
 
156 156
 
@@ -166,33 +166,33 @@  discard block
 block discarded – undo
166 166
  * @param string $amount formatted amount number.
167 167
  * @return float|string  formatted amount number with large number names.
168 168
  */
169
-function give_human_format_large_amount( $amount ) {
169
+function give_human_format_large_amount($amount) {
170 170
 
171 171
     // Get thousand separator.
172 172
     $thousands_sep = give_get_price_thousand_separator();
173 173
 
174 174
     // Sanitize amount.
175
-    $sanitize_amount = give_sanitize_amount( $amount );
175
+    $sanitize_amount = give_sanitize_amount($amount);
176 176
 
177 177
     // Explode amount to calculate name of large numbers.
178
-	$amount_array = explode( $thousands_sep, $amount );
178
+	$amount_array = explode($thousands_sep, $amount);
179 179
 
180 180
     // Calculate amount parts count.
181
-    $amount_count_parts = count( $amount_array );
181
+    $amount_count_parts = count($amount_array);
182 182
 
183 183
 	// Human format amount (default).
184 184
 	$human_format_amount = $amount;
185 185
 
186 186
     // Calculate large number formatted amount.
187
-    if ( 4 < $amount_count_parts ){
188
-        $human_format_amount =  sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
189
-    } elseif ( 3 < $amount_count_parts ){
190
-        $human_format_amount =  sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
191
-    } elseif ( 2 < $amount_count_parts  ) {
192
-        $human_format_amount =  sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
187
+    if (4 < $amount_count_parts) {
188
+        $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
189
+    } elseif (3 < $amount_count_parts) {
190
+        $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
191
+    } elseif (2 < $amount_count_parts) {
192
+        $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
193 193
     }
194 194
 
195
-    return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
195
+    return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
196 196
 }
197 197
 
198 198
 /**
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
  *
206 206
  * @return string $amount Newly formatted amount or Price Not Available
207 207
  */
208
-function give_format_decimal( $amount, $dp = false ){
208
+function give_format_decimal($amount, $dp = false) {
209 209
     $decimal_separator = give_get_price_decimal_separator();
210
-    $formatted_amount  = give_sanitize_amount( $amount, $dp );
210
+    $formatted_amount  = give_sanitize_amount($amount, $dp);
211 211
 
212
-    if( false !== strpos( $formatted_amount, '.' ) ) {
213
-        $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
212
+    if (false !== strpos($formatted_amount, '.')) {
213
+        $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
214 214
     }
215 215
 
216
-    return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
216
+    return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
217 217
 }
218 218
 
219 219
 
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @return bool
229 229
  */
230
-function give_format_admin_multilevel_amount( $field_args, $field ) {
230
+function give_format_admin_multilevel_amount($field_args, $field) {
231 231
 
232
-	if ( empty( $field->value ) ) {
232
+	if (empty($field->value)) {
233 233
 		return false;
234 234
 	}
235 235
 
236
-	$field->value = give_format_decimal( $field->value );
236
+	$field->value = give_format_decimal($field->value);
237 237
 }
238 238
 
239 239
 /**
@@ -246,24 +246,24 @@  discard block
 block discarded – undo
246 246
  *
247 247
  * @return mixed|string|void
248 248
  */
249
-function give_currency_filter( $price = '', $currency = '' ) {
249
+function give_currency_filter($price = '', $currency = '') {
250 250
 
251
-	if ( empty( $currency ) ) {
251
+	if (empty($currency)) {
252 252
 		$currency = give_get_currency();
253 253
 	}
254 254
 
255
-	$position = give_get_option( 'currency_position', 'before' );
255
+	$position = give_get_option('currency_position', 'before');
256 256
 
257 257
 	$negative = $price < 0;
258 258
 
259
-	if ( $negative ) {
259
+	if ($negative) {
260 260
         // Remove proceeding "-".
261
-		$price = substr( $price, 1 );
261
+		$price = substr($price, 1);
262 262
 	}
263 263
 
264
-	$symbol = give_currency_symbol( $currency );
264
+	$symbol = give_currency_symbol($currency);
265 265
 
266
-    switch ( $currency ):
266
+    switch ($currency):
267 267
         case 'GBP' :
268 268
         case 'BRL' :
269 269
         case 'EUR' :
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
         case 'MAD' :
293 293
         case 'KRW' :
294 294
         case 'ZAR' :
295
-            $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
295
+            $formatted = ('before' === $position ? $symbol.$price : $price.$symbol);
296 296
             break;
297 297
         case 'NOK' :
298
-            $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
298
+            $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol);
299 299
             break;
300 300
         default :
301
-            $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
301
+            $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency);
302 302
             break;
303 303
     endswitch;
304 304
 
@@ -314,11 +314,11 @@  discard block
 block discarded – undo
314 314
      *           filter name will be give_usd_currency_filter_after
315 315
      *
316 316
      */
317
-    $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
317
+    $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price);
318 318
 
319
-    if ( $negative ) {
319
+    if ($negative) {
320 320
 		// Prepend the minus sign before the currency sign.
321
-		$formatted = '-' . $formatted;
321
+		$formatted = '-'.$formatted;
322 322
 	}
323 323
 
324 324
 	return $formatted;
@@ -334,22 +334,22 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function give_currency_decimal_filter() {
336 336
 
337
-    remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
337
+    remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
338 338
 
339 339
     // Set default number of decimals.
340 340
     $decimals = give_get_price_decimals();
341 341
 
342
-    add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
342
+    add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
343 343
 
344 344
 
345 345
     // Get number of decimals with backward compatibility ( version < 1.6 )
346
-    if( 1 <= func_num_args() ){
347
-        $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
346
+    if (1 <= func_num_args()) {
347
+        $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0)));
348 348
     }
349 349
 
350 350
 	$currency = give_get_currency();
351 351
 
352
-	switch ( $currency ) {
352
+	switch ($currency) {
353 353
 		case 'RIAL' :
354 354
 		case 'JPY' :
355 355
 		case 'TWD' :
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 			break;
360 360
 	}
361 361
 
362
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
362
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
363 363
 }
364 364
 
365
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
366
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
365
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
366
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
367 367
 
368 368
 /**
369 369
  * Sanitize thousand separator
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
  *
377 377
  * @return mixed
378 378
  */
379
-function give_sanitize_thousand_separator( $value, $field_args, $field ){
380
-    return stripslashes( $value );
379
+function give_sanitize_thousand_separator($value, $field_args, $field) {
380
+    return stripslashes($value);
381 381
 }
382 382
 
383 383
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
  *
393 393
  * @return mixed
394 394
  */
395
-function give_sanitize_number_decimals( $value, $field_args, $field ){
395
+function give_sanitize_number_decimals($value, $field_args, $field) {
396 396
 	return absint($value);
397 397
 }
398 398
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
  *
408 408
  * @return mixed
409 409
  */
410
-function give_sanitize_price_field_value( $value, $field_args, $field ){
411
-    return give_sanitize_amount( $value );
410
+function give_sanitize_price_field_value($value, $field_args, $field) {
411
+    return give_sanitize_amount($value);
412 412
 }
413 413
 
414 414
 
@@ -422,29 +422,29 @@  discard block
 block discarded – undo
422 422
  *
423 423
  * @return void
424 424
  */
425
-function give_cmb_amount_field_render_row_cb( $field_args, $field ) {
425
+function give_cmb_amount_field_render_row_cb($field_args, $field) {
426 426
 
427 427
 	// Get args.
428 428
 	$id          = $field->args('id');
429
-	$label       = $field->args( 'name' );
430
-	$name        = $field->args( '_name' );
431
-	$description = $field->args( 'description' );
432
-	$attributes  = $field->args( 'attributes' );
429
+	$label       = $field->args('name');
430
+	$name        = $field->args('_name');
431
+	$description = $field->args('description');
432
+	$attributes  = $field->args('attributes');
433 433
 	$attributes_string  = '';
434 434
 	$row_class          = $field->row_classes();
435 435
 
436 436
 	// Get attributes.
437
-	if( ! empty( $attributes ) ) {
438
-		foreach ( $attributes as $attribute_name => $attribute_val ) {
437
+	if ( ! empty($attributes)) {
438
+		foreach ($attributes as $attribute_name => $attribute_val) {
439 439
 			$attributes_string[] = "$attribute_name=\"$attribute_val\"";
440 440
 		}
441 441
 
442
-		$attributes_string = implode( ' ', $attributes_string );
442
+		$attributes_string = implode(' ', $attributes_string);
443 443
 	}
444 444
 
445 445
 	// Get row class.
446
-	if( ! empty( $row_class ) && is_array( $row_class ) ) {
447
-		$row_class = implode( ' ', $row_class );
446
+	if ( ! empty($row_class) && is_array($row_class)) {
447
+		$row_class = implode(' ', $row_class);
448 448
 	}
449 449
 	?>
450 450
 	<div class="cmb-row <?php echo $row_class; ?>">
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 			<label for="<?php echo $id; ?>"><?php echo $label; ?></label>
453 453
 		</div>
454 454
 		<div class="cmb-td">
455
-			<?php echo ( give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); ?>
455
+			<?php echo (give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); ?>
456 456
 			<input id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>" <?php echo $attributes_string?>/>
457
-			<?php echo ( give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); ?>
457
+			<?php echo (give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); ?>
458 458
 
459 459
 			<span class="cmb2-metabox-description"><?php echo $description; ?></span>
460 460
 		</div>
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        esc_html_e( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		esc_html_e( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -26,27 +26,27 @@  discard block
 block discarded – undo
26 26
 function give_test_ajax_works() {
27 27
 
28 28
 	// Check if the Airplane Mode plugin is installed
29
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
29
+	if (class_exists('Airplane_Mode_Core')) {
30 30
 
31 31
 		$airplane = Airplane_Mode_Core::getInstance();
32 32
 
33
-		if ( method_exists( $airplane, 'enabled' ) ) {
33
+		if (method_exists($airplane, 'enabled')) {
34 34
 
35
-			if ( $airplane->enabled() ) {
35
+			if ($airplane->enabled()) {
36 36
 				return true;
37 37
 			}
38 38
 
39 39
 		} else {
40 40
 
41
-			if ( $airplane->check_status() == 'on' ) {
41
+			if ($airplane->check_status() == 'on') {
42 42
 				return true;
43 43
 			}
44 44
 		}
45 45
 	}
46 46
 
47
-	add_filter( 'block_local_requests', '__return_false' );
47
+	add_filter('block_local_requests', '__return_false');
48 48
 
49
-	if ( get_transient( '_give_ajax_works' ) ) {
49
+	if (get_transient('_give_ajax_works')) {
50 50
 		return true;
51 51
 	}
52 52
 
@@ -58,35 +58,35 @@  discard block
 block discarded – undo
58 58
 		)
59 59
 	);
60 60
 
61
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
61
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
62 62
 	$works = true;
63 63
 
64
-	if ( is_wp_error( $ajax ) ) {
64
+	if (is_wp_error($ajax)) {
65 65
 
66 66
 		$works = false;
67 67
 
68 68
 	} else {
69 69
 
70
-		if ( empty( $ajax['response'] ) ) {
70
+		if (empty($ajax['response'])) {
71 71
 			$works = false;
72 72
 		}
73 73
 
74
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
74
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
75 75
 			$works = false;
76 76
 		}
77 77
 
78
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
78
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
79 79
 			$works = false;
80 80
 		}
81 81
 
82
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
82
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
83 83
 			$works = false;
84 84
 		}
85 85
 
86 86
 	}
87 87
 
88
-	if ( $works ) {
89
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
88
+	if ($works) {
89
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
90 90
 	}
91 91
 
92 92
 	return $works;
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
  * @return string
102 102
  */
103 103
 function give_get_ajax_url() {
104
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
104
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
105 105
 
106 106
 	$current_url = give_get_current_page_url();
107
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
107
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
108 108
 
109
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
110
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
109
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
110
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
111 111
 	}
112 112
 
113
-	return apply_filters( 'give_ajax_url', $ajax_url );
113
+	return apply_filters('give_ajax_url', $ajax_url);
114 114
 }
115 115
 
116 116
 /**
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
  * @return void
122 122
  */
123 123
 function give_load_checkout_login_fields() {
124
-	do_action( 'give_purchase_form_login_fields' );
124
+	do_action('give_purchase_form_login_fields');
125 125
 	give_die();
126 126
 }
127 127
 
128
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
128
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
129 129
 
130 130
 /**
131 131
  * Load Checkout Fields
@@ -135,22 +135,22 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_load_checkout_fields() {
138
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
138
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
139 139
 
140 140
 	ob_start();
141 141
 
142
-	do_action( 'give_purchase_form_register_login_fields', $form_id );
142
+	do_action('give_purchase_form_register_login_fields', $form_id);
143 143
 
144 144
 	$fields = ob_get_clean();
145 145
 
146
-	wp_send_json( array(
147
-		'fields' => wp_json_encode( $fields ),
148
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
149
-	) );
146
+	wp_send_json(array(
147
+		'fields' => wp_json_encode($fields),
148
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
149
+	));
150 150
 }
151 151
 
152
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
153
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
152
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
153
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
154 154
 
155 155
 /**
156 156
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
  * @return void
161 161
  */
162 162
 function give_ajax_get_form_title() {
163
-	if ( isset( $_POST['form_id'] ) ) {
164
-		$title = get_the_title( $_POST['form_id'] );
165
-		if ( $title ) {
163
+	if (isset($_POST['form_id'])) {
164
+		$title = get_the_title($_POST['form_id']);
165
+		if ($title) {
166 166
 			echo $title;
167 167
 		} else {
168 168
 			echo 'fail';
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	give_die();
172 172
 }
173 173
 
174
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
175
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
174
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
175
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
176 176
 
177 177
 /**
178 178
  * Retrieve a states drop down
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
  */
184 184
 function give_ajax_get_states_field() {
185 185
 
186
-	if ( empty( $_POST['country'] ) ) {
186
+	if (empty($_POST['country'])) {
187 187
 		$_POST['country'] = give_get_country();
188 188
 	}
189
-	$states = give_get_states( $_POST['country'] );
189
+	$states = give_get_states($_POST['country']);
190 190
 
191
-	if ( ! empty( $states ) ) {
191
+	if ( ! empty($states)) {
192 192
 
193 193
 		$args = array(
194 194
 			'name'             => $_POST['field_name'],
195 195
 			'id'               => $_POST['field_name'],
196
-			'class'            => $_POST['field_name'] . '  give-select',
197
-			'options'          => give_get_states( $_POST['country'] ),
196
+			'class'            => $_POST['field_name'].'  give-select',
197
+			'options'          => give_get_states($_POST['country']),
198 198
 			'show_option_all'  => false,
199 199
 			'show_option_none' => false
200 200
 		);
201 201
 
202
-		$response = Give()->html->select( $args );
202
+		$response = Give()->html->select($args);
203 203
 
204 204
 	} else {
205 205
 
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 	give_die();
212 212
 }
213 213
 
214
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
215
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
214
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
215
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
216 216
 
217 217
 /**
218 218
  * Retrieve a states drop down
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 function give_ajax_form_search() {
225 225
 	global $wpdb;
226 226
 
227
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
227
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
228 228
 	$results = array();
229
-	if ( current_user_can( 'edit_give_forms' ) ) {
230
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
229
+	if (current_user_can('edit_give_forms')) {
230
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
231 231
 	} else {
232
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
232
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
233 233
 	}
234 234
 
235
-	if ( $items ) {
235
+	if ($items) {
236 236
 
237
-		foreach ( $items as $item ) {
237
+		foreach ($items as $item) {
238 238
 
239 239
 			$results[] = array(
240 240
 				'id'   => $item->ID,
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 
247 247
 		$items[] = array(
248 248
 			'id'   => 0,
249
-			'name' => esc_html__( 'No results found', 'give' )
249
+			'name' => esc_html__('No results found', 'give')
250 250
 		);
251 251
 
252 252
 	}
253 253
 
254
-	echo json_encode( $results );
254
+	echo json_encode($results);
255 255
 
256 256
 	give_die();
257 257
 }
258 258
 
259
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
260
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
259
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
260
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
261 261
 
262 262
 /**
263 263
  * Search the donors database via Ajax
@@ -269,21 +269,21 @@  discard block
 block discarded – undo
269 269
 function give_ajax_donor_search() {
270 270
 	global $wpdb;
271 271
 
272
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
272
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
273 273
 	$results = array();
274
-	if ( ! current_user_can( 'view_give_reports' ) ) {
274
+	if ( ! current_user_can('view_give_reports')) {
275 275
 		$donors = array();
276 276
 	} else {
277
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
277
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
278 278
 	}
279 279
 
280
-	if ( $donors ) {
280
+	if ($donors) {
281 281
 
282
-		foreach ( $donors as $donor ) {
282
+		foreach ($donors as $donor) {
283 283
 
284 284
 			$results[] = array(
285 285
 				'id'   => $donor->id,
286
-				'name' => $donor->name . '(' . $donor->email . ')'
286
+				'name' => $donor->name.'('.$donor->email.')'
287 287
 			);
288 288
 		}
289 289
 
@@ -291,17 +291,17 @@  discard block
 block discarded – undo
291 291
 
292 292
 		$donors[] = array(
293 293
 			'id'   => 0,
294
-			'name' => esc_html__( 'No results found', 'give' )
294
+			'name' => esc_html__('No results found', 'give')
295 295
 		);
296 296
 
297 297
 	}
298 298
 
299
-	echo json_encode( $results );
299
+	echo json_encode($results);
300 300
 
301 301
 	give_die();
302 302
 }
303 303
 
304
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
304
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
305 305
 
306 306
 
307 307
 /**
@@ -313,42 +313,42 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function give_ajax_search_users() {
315 315
 
316
-	if ( current_user_can( 'manage_give_settings' ) ) {
316
+	if (current_user_can('manage_give_settings')) {
317 317
 
318
-		$search_query = trim( $_POST['user_name'] );
319
-		$exclude      = trim( $_POST['exclude'] );
318
+		$search_query = trim($_POST['user_name']);
319
+		$exclude      = trim($_POST['exclude']);
320 320
 
321 321
 		$get_users_args = array(
322 322
 			'number' => 9999,
323
-			'search' => $search_query . '*'
323
+			'search' => $search_query.'*'
324 324
 		);
325 325
 
326
-		if ( ! empty( $exclude ) ) {
327
-			$exclude_array             = explode( ',', $exclude );
326
+		if ( ! empty($exclude)) {
327
+			$exclude_array             = explode(',', $exclude);
328 328
 			$get_users_args['exclude'] = $exclude_array;
329 329
 		}
330 330
 
331
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
331
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
332 332
 
333
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
333
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
334 334
 
335 335
 		$user_list = '<ul>';
336
-		if ( $found_users ) {
337
-			foreach ( $found_users as $user ) {
338
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
336
+		if ($found_users) {
337
+			foreach ($found_users as $user) {
338
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
339 339
 			}
340 340
 		} else {
341
-			$user_list .= '<li>' . esc_html__( 'No users found', 'give' ) . '</li>';
341
+			$user_list .= '<li>'.esc_html__('No users found', 'give').'</li>';
342 342
 		}
343 343
 		$user_list .= '</ul>';
344 344
 
345
-		echo json_encode( array( 'results' => $user_list ) );
345
+		echo json_encode(array('results' => $user_list));
346 346
 
347 347
 	}
348 348
 	die();
349 349
 }
350 350
 
351
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
351
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
352 352
 
353 353
 
354 354
 /**
@@ -360,32 +360,32 @@  discard block
 block discarded – undo
360 360
  */
361 361
 function give_check_for_form_price_variations() {
362 362
 
363
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
364
-		die( '-1' );
363
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
364
+		die('-1');
365 365
 	}
366 366
 
367
-	$form_id = intval( $_POST['form_id'] );
368
-	$form    = get_post( $form_id );
367
+	$form_id = intval($_POST['form_id']);
368
+	$form    = get_post($form_id);
369 369
 
370
-	if ( 'give_forms' != $form->post_type ) {
371
-		die( '-2' );
370
+	if ('give_forms' != $form->post_type) {
371
+		die('-2');
372 372
 	}
373 373
 
374
-	if ( give_has_variable_prices( $form_id ) ) {
375
-		$variable_prices = give_get_variable_prices( $form_id );
374
+	if (give_has_variable_prices($form_id)) {
375
+		$variable_prices = give_get_variable_prices($form_id);
376 376
 
377
-		if ( $variable_prices ) {
377
+		if ($variable_prices) {
378 378
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
379 379
 
380
-			if ( isset( $_POST['all_prices'] ) ) {
381
-				$ajax_response .= '<option value="">' . esc_html__( 'All Levels', 'give' ) . '</option>';
380
+			if (isset($_POST['all_prices'])) {
381
+				$ajax_response .= '<option value="">'.esc_html__('All Levels', 'give').'</option>';
382 382
 			}
383 383
 
384
-			foreach ( $variable_prices as $key => $price ) {
384
+			foreach ($variable_prices as $key => $price) {
385 385
 
386
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
386
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
387 387
 				
388
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
388
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
389 389
 			}
390 390
 			$ajax_response .= '</select>';
391 391
 			echo $ajax_response;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	give_die();
397 397
 }
398 398
 
399
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
399
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
400 400
 
401 401
 
402 402
 /**
@@ -407,30 +407,30 @@  discard block
 block discarded – undo
407 407
  * @return void
408 408
  */
409 409
 function give_check_for_form_price_variations_html() {
410
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
410
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
411 411
 		wp_die();
412 412
 	}
413 413
 
414
-	$form_id = intval( $_POST['form_id'] );
415
-	$payment_id = intval( $_POST['payment_id'] );
416
-	$form    = get_post( $form_id );
414
+	$form_id = intval($_POST['form_id']);
415
+	$payment_id = intval($_POST['payment_id']);
416
+	$form    = get_post($form_id);
417 417
 
418
-	if ( 'give_forms' != $form->post_type ) {
418
+	if ('give_forms' != $form->post_type) {
419 419
 		wp_die();
420 420
 	}
421 421
 
422
-    if ( ! give_has_variable_prices( $form_id ) ) {
423
-        esc_html_e( 'n/a', 'give' );
422
+    if ( ! give_has_variable_prices($form_id)) {
423
+        esc_html_e('n/a', 'give');
424 424
     } else {
425 425
         // Payment object.
426
-        $payment = new Give_Payment( $payment_id );
426
+        $payment = new Give_Payment($payment_id);
427 427
 
428 428
         // Payment meta.
429 429
         $payment_meta = $payment->get_meta();
430 430
 
431 431
 
432 432
         // Variable price dropdown options.
433
-        $variable_price_dropdown_option =  array(
433
+        $variable_price_dropdown_option = array(
434 434
             'id'                => $form_id,
435 435
             'name'              => 'give-variable-price',
436 436
             'chosen'            => true,
@@ -439,10 +439,10 @@  discard block
 block discarded – undo
439 439
         );
440 440
 
441 441
         // Render variable prices select tag html.
442
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
442
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
443 443
     }
444 444
 
445 445
     give_die();
446 446
 }
447 447
 
448
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
448
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +97 added lines, -97 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
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
34
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
35 35
 
36
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
37
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
36
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
37
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
38 38
 
39
-	$to_email = give_get_payment_user_email( $payment_id );
39
+	$to_email = give_get_payment_user_email($payment_id);
40 40
 
41
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
42
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
43
-	$subject = give_do_email_tags( $subject, $payment_id );
41
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
42
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
43
+	$subject = give_do_email_tags($subject, $payment_id);
44 44
 
45
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
46
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
45
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
46
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
47 47
 
48 48
 	$emails = Give()->emails;
49 49
 
50
-	$emails->__set( 'from_name', $from_name );
51
-	$emails->__set( 'from_email', $from_email );
52
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
50
+	$emails->__set('from_name', $from_name);
51
+	$emails->__set('from_email', $from_email);
52
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
53 53
 
54 54
 
55
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
56
-	$emails->__set( 'headers', $headers );
55
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
56
+	$emails->__set('headers', $headers);
57 57
 
58
-	$emails->send( $to_email, $subject, $message, $attachments );
58
+	$emails->send($to_email, $subject, $message, $attachments);
59 59
 
60
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
61
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
60
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
61
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
62 62
 	}
63 63
 }
64 64
 
@@ -71,29 +71,29 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function give_email_test_donation_receipt() {
73 73
 
74
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
75
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
74
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
75
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
76 76
 
77
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
78
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
77
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
78
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
79 79
 
80
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
81
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
82
-	$subject = give_do_email_tags( $subject, 0 );
80
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
81
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
82
+	$subject = give_do_email_tags($subject, 0);
83 83
 
84
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
84
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
85 85
 
86
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
86
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
87 87
 
88 88
 	$emails = Give()->emails;
89
-	$emails->__set( 'from_name', $from_name );
90
-	$emails->__set( 'from_email', $from_email );
91
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
89
+	$emails->__set('from_name', $from_name);
90
+	$emails->__set('from_email', $from_email);
91
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
92 92
 
93
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
94
-	$emails->__set( 'headers', $headers );
93
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
94
+	$emails->__set('headers', $headers);
95 95
 
96
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
96
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
97 97
 
98 98
 }
99 99
 
@@ -107,50 +107,50 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return void
109 109
  */
110
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
110
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
111 111
 
112
-	$payment_id = absint( $payment_id );
112
+	$payment_id = absint($payment_id);
113 113
 
114
-	if ( empty( $payment_id ) ) {
114
+	if (empty($payment_id)) {
115 115
 		return;
116 116
 	}
117 117
 
118
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
118
+	if ( ! give_get_payment_by('id', $payment_id)) {
119 119
 		return;
120 120
 	}
121 121
 
122
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
123
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
122
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
123
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
124 124
 
125
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
126
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
125
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
126
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
127 127
 
128 128
 	/* translators: %s: payment id */
129
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
130
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
131
-	$subject = give_do_email_tags( $subject, $payment_id );
129
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
130
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
131
+	$subject = give_do_email_tags($subject, $payment_id);
132 132
 
133
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
134
-	$headers .= "Reply-To: " . $from_email . "\r\n";
133
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
134
+	$headers .= "Reply-To: ".$from_email."\r\n";
135 135
 	//$headers  .= "MIME-Version: 1.0\r\n";
136 136
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
137
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
137
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
138 138
 
139
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
139
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
140 140
 
141
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
141
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
142 142
 
143 143
 	$emails = Give()->emails;
144
-	$emails->__set( 'from_name', $from_name );
145
-	$emails->__set( 'from_email', $from_email );
146
-	$emails->__set( 'headers', $headers );
147
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
144
+	$emails->__set('from_name', $from_name);
145
+	$emails->__set('from_email', $from_email);
146
+	$emails->__set('headers', $headers);
147
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
148 148
 
149
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
149
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
150 150
 
151 151
 }
152 152
 
153
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
153
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
154 154
 
155 155
 /**
156 156
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 	$email_option = give_get_option('admin_notice_emails');
164 164
 
165
-	$emails = !empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
166
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
165
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
166
+	$emails = array_map('trim', explode("\n", $emails));
167 167
 
168
-	return apply_filters( 'give_admin_notice_emails', $emails );
168
+	return apply_filters('give_admin_notice_emails', $emails);
169 169
 }
170 170
 
171 171
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return mixed
179 179
  */
180
-function give_admin_notices_disabled( $payment_id = 0 ) {
180
+function give_admin_notices_disabled($payment_id = 0) {
181 181
 
182
-	$retval = give_get_option( 'disable_admin_notices' );
182
+	$retval = give_get_option('disable_admin_notices');
183 183
 
184
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
184
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
185 185
 }
186 186
 
187 187
 /**
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_get_default_donation_notification_email() {
196 196
 
197
-	$default_email_body  = esc_html__( 'Hi there,', 'give' ) . "\n\n";
198
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
199
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
200
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
201
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
202
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
203
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
204
-	$default_email_body .= '{sitename}' . "\n";
197
+	$default_email_body  = esc_html__('Hi there,', 'give')."\n\n";
198
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website: ', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
199
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
200
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
201
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
202
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
203
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
204
+	$default_email_body .= '{sitename}'."\n";
205 205
 
206
-	$custom_message = give_get_option( 'donation_notification' );
207
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
206
+	$custom_message = give_get_option('donation_notification');
207
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
208 208
 
209
-	return apply_filters( 'give_default_donation_notification_email', $message );
209
+	return apply_filters('give_default_donation_notification_email', $message);
210 210
 }
211 211
 
212 212
 
@@ -220,25 +220,25 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function give_get_default_donation_receipt_email() {
222 222
 
223
-	$default_email_body  = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
224
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
225
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
226
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
227
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
228
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
229
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
230
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
231
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
232
-	$default_email_body .= '{receipt_link}' . "\n\n";
223
+	$default_email_body  = esc_html__('Dear', 'give')." {name},\n\n";
224
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
225
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
226
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
227
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
228
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
229
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
230
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
231
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
232
+	$default_email_body .= '{receipt_link}'."\n\n";
233 233
 	$default_email_body .= "\n\n";
234
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
235
-	$default_email_body .= '{sitename}' . "\n";
234
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
235
+	$default_email_body .= '{sitename}'."\n";
236 236
 
237
-	$custom_message = give_get_option( 'donation_receipt' );
237
+	$custom_message = give_get_option('donation_receipt');
238 238
 
239
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
239
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
240 240
 
241
-	return apply_filters( 'give_default_donation_receipt_email', $message );
241
+	return apply_filters('give_default_donation_receipt_email', $message);
242 242
 }
243 243
 
244 244
 /**
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return array $email_names
252 252
  */
253
-function give_get_email_names( $user_info ) {
253
+function give_get_email_names($user_info) {
254 254
 	$email_names = array();
255
-	$user_info   = maybe_unserialize( $user_info );
255
+	$user_info   = maybe_unserialize($user_info);
256 256
 
257 257
 	$email_names['fullname'] = '';
258
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
259
-		$user_data               = get_userdata( $user_info['id'] );
258
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
259
+		$user_data               = get_userdata($user_info['id']);
260 260
 		$email_names['name']     = $user_info['first_name'];
261
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
261
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
262 262
 		$email_names['username'] = $user_data->user_login;
263
-	} elseif ( isset( $user_info['first_name'] ) ) {
263
+	} elseif (isset($user_info['first_name'])) {
264 264
 		$email_names['name']     = $user_info['first_name'];
265
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
265
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
266 266
 		$email_names['username'] = $user_info['first_name'];
267 267
 	} else {
268 268
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/class-give-db-customer-meta.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		/* @var WPDB $wpdb */
32 32
 		global $wpdb;
33 33
 
34
-		$this->table_name  = $wpdb->prefix . 'give_customermeta';
34
+		$this->table_name  = $wpdb->prefix.'give_customermeta';
35 35
 		$this->primary_key = 'meta_id';
36 36
 		$this->version     = '1.0';
37 37
 
38
-		add_action( 'plugins_loaded', array( $this, 'register_table' ), 11 );
38
+		add_action('plugins_loaded', array($this, 'register_table'), 11);
39 39
 
40 40
 	}
41 41
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 * @access  private
80 80
 	 * @since   1.6
81 81
 	 */
82
-	public function get_meta( $customer_id = 0, $meta_key = '', $single = false ) {
83
-		$customer_id = $this->sanitize_customer_id( $customer_id );
84
-		if ( false === $customer_id ) {
82
+	public function get_meta($customer_id = 0, $meta_key = '', $single = false) {
83
+		$customer_id = $this->sanitize_customer_id($customer_id);
84
+		if (false === $customer_id) {
85 85
 			return false;
86 86
 		}
87 87
 
88
-		return get_metadata( 'customer', $customer_id, $meta_key, $single );
88
+		return get_metadata('customer', $customer_id, $meta_key, $single);
89 89
 	}
90 90
 
91 91
 	/**
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 * @access  private
104 104
 	 * @since   1.6
105 105
 	 */
106
-	public function add_meta( $customer_id = 0, $meta_key = '', $meta_value, $unique = false ) {
107
-		$customer_id = $this->sanitize_customer_id( $customer_id );
108
-		if ( false === $customer_id ) {
106
+	public function add_meta($customer_id = 0, $meta_key = '', $meta_value, $unique = false) {
107
+		$customer_id = $this->sanitize_customer_id($customer_id);
108
+		if (false === $customer_id) {
109 109
 			return false;
110 110
 		}
111 111
 
112
-		return add_metadata( 'customer', $customer_id, $meta_key, $meta_value, $unique );
112
+		return add_metadata('customer', $customer_id, $meta_key, $meta_value, $unique);
113 113
 	}
114 114
 
115 115
 	/**
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 	 * @access  private
133 133
 	 * @since   1.6
134 134
 	 */
135
-	public function update_meta( $customer_id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
136
-		$customer_id = $this->sanitize_customer_id( $customer_id );
137
-		if ( false === $customer_id ) {
135
+	public function update_meta($customer_id = 0, $meta_key = '', $meta_value, $prev_value = '') {
136
+		$customer_id = $this->sanitize_customer_id($customer_id);
137
+		if (false === $customer_id) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		return update_metadata( 'customer', $customer_id, $meta_key, $meta_value, $prev_value );
141
+		return update_metadata('customer', $customer_id, $meta_key, $meta_value, $prev_value);
142 142
 	}
143 143
 
144 144
 	/**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @access  private
160 160
 	 * @since   1.6
161 161
 	 */
162
-	public function delete_meta( $customer_id = 0, $meta_key = '', $meta_value = '' ) {
163
-		return delete_metadata( 'customer', $customer_id, $meta_key, $meta_value );
162
+	public function delete_meta($customer_id = 0, $meta_key = '', $meta_value = '') {
163
+		return delete_metadata('customer', $customer_id, $meta_key, $meta_value);
164 164
 	}
165 165
 
166 166
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function create_table() {
173 173
 
174
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
174
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
175 175
 
176 176
 		$sql = "CREATE TABLE {$this->table_name} (
177 177
 			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 			KEY meta_key (meta_key)
184 184
 			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
185 185
 
186
-		dbDelta( $sql );
186
+		dbDelta($sql);
187 187
 
188
-		update_option( $this->table_name . '_db_version', $this->version );
188
+		update_option($this->table_name.'_db_version', $this->version);
189 189
 	}
190 190
 
191 191
 	/**
@@ -197,23 +197,23 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return int|bool                The normalized customer ID or false if it's found to not be valid.
199 199
 	 */
200
-	private function sanitize_customer_id( $customer_id ) {
201
-		if ( ! is_numeric( $customer_id ) ) {
200
+	private function sanitize_customer_id($customer_id) {
201
+		if ( ! is_numeric($customer_id)) {
202 202
 			return false;
203 203
 		}
204 204
 
205 205
 		$customer_id = (int) $customer_id;
206 206
 
207 207
 		// We were given a non positive number
208
-		if ( absint( $customer_id ) !== $customer_id ) {
208
+		if (absint($customer_id) !== $customer_id) {
209 209
 			return false;
210 210
 		}
211 211
 
212
-		if ( empty( $customer_id ) ) {
212
+		if (empty($customer_id)) {
213 213
 			return false;
214 214
 		}
215 215
 
216
-		return absint( $customer_id );
216
+		return absint($customer_id);
217 217
 
218 218
 	}
219 219
 
Please login to merge, or discard this patch.