Test Failed
Push — issue/3417 ( 9726e4 )
by Ravinder
1141:09 queued 1139:41
created
includes/admin/settings/class-settings-cmb2-backward-compatibility.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
 		 *
86 86
 		 * @since  1.8
87 87
 		 *
88
-		 * @param  $setting_tab
88
+		 * @param  string $setting_tab
89 89
 		 *
90 90
 		 * @return string
91 91
 		 */
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) :
12
+if ( ! class_exists('Give_CMB2_Settings_Loader')) :
13 13
 
14 14
 	/**
15 15
 	 * This class loads the cmb2 settings.
@@ -52,30 +52,30 @@  discard block
 block discarded – undo
52 52
 
53 53
 			// Get current tab.
54 54
 			$this->current_tab     = give_get_current_setting_tab();
55
-			$this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] );
55
+			$this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']);
56 56
 
57 57
 			// Tab ID.
58 58
 			$this->id = $this->current_tab;
59 59
 
60 60
 			// Add addon tabs.
61
-			add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 );
61
+			add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999);
62 62
 
63 63
 			// Add save hook to addons.
64
-			add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 );
64
+			add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999);
65 65
 
66 66
 			// Add backward compatibility filters plugin settings.
67
-			$setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' );
67
+			$setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses');
68 68
 
69 69
 			// Filter Payment Gateways settings.
70
-			if ( in_array( $this->current_tab, $setting_tabs ) ) {
71
-				add_filter( "give_get_settings_{$this->current_tab}", array(
70
+			if (in_array($this->current_tab, $setting_tabs)) {
71
+				add_filter("give_get_settings_{$this->current_tab}", array(
72 72
 					$this,
73 73
 					'get_filtered_addon_settings',
74
-				), 999999, 1 );
75
-				add_filter( "give_get_sections_{$this->current_tab}", array(
74
+				), 999999, 1);
75
+				add_filter("give_get_sections_{$this->current_tab}", array(
76 76
 					$this,
77 77
 					'get_filtered_addon_sections',
78
-				), 999999, 1 );
78
+				), 999999, 1);
79 79
 			}
80 80
 		}
81 81
 
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @return string
90 90
 		 */
91
-		function set_default_setting_tab( $setting_tab ) {
91
+		function set_default_setting_tab($setting_tab) {
92 92
 			$default_tab = '';
93 93
 
94 94
 			// Set default tab to first setting tab.
95
-			if ( $sections = array_keys( $this->get_sections() ) ) {
96
-				$default_tab = current( $sections );
95
+			if ($sections = array_keys($this->get_sections())) {
96
+				$default_tab = current($sections);
97 97
 			}
98 98
 
99 99
 			return $default_tab;
@@ -108,29 +108,29 @@  discard block
 block discarded – undo
108 108
 		 *
109 109
 		 * @return mixed
110 110
 		 */
111
-		function add_addon_settings_page( $pages ) {
111
+		function add_addon_settings_page($pages) {
112 112
 			// Previous setting page.
113 113
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
114 114
 
115 115
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
116
-			unset( $previous_pages['api'] );
117
-			unset( $previous_pages['system_info'] );
116
+			unset($previous_pages['api']);
117
+			unset($previous_pages['system_info']);
118 118
 
119 119
 			// Tab is not register.
120
-			$pages_diff = array_keys( array_diff( $previous_pages, $pages ) );
120
+			$pages_diff = array_keys(array_diff($previous_pages, $pages));
121 121
 
122 122
 			// Merge old settings with new settings.
123
-			$pages = array_merge( $pages, $previous_pages );
123
+			$pages = array_merge($pages, $previous_pages);
124 124
 
125
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
125
+			if (in_array($this->current_tab, $pages_diff)) {
126 126
 				// Filter & actions.
127
-				add_filter( "give_default_setting_tab_section_{$this->current_tab}", array(
127
+				add_filter("give_default_setting_tab_section_{$this->current_tab}", array(
128 128
 					$this,
129 129
 					'set_default_setting_tab',
130
-				), 10 );
131
-				add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) );
132
-				add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 );
133
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
130
+				), 10);
131
+				add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections'));
132
+				add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10);
133
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
134 134
 			}
135 135
 
136 136
 			return $pages;
@@ -146,29 +146,29 @@  discard block
 block discarded – undo
146 146
 		 *
147 147
 		 * @return mixed
148 148
 		 */
149
-		function setup_addon_save_hook( $pages ) {
149
+		function setup_addon_save_hook($pages) {
150 150
 			$page_ids = array();
151 151
 
152
-			foreach ( $pages as $page ) {
153
-				$page_ids = $page->add_settings_page( $page_ids );
152
+			foreach ($pages as $page) {
153
+				$page_ids = $page->add_settings_page($page_ids);
154 154
 			}
155 155
 
156 156
 			// Previous setting page.
157 157
 			$previous_pages = $this->prev_settings->give_get_settings_tabs();
158 158
 
159 159
 			// API and System Info setting tab merge to Tools setting tab, so remove them from tabs.
160
-			unset( $previous_pages['api'] );
161
-			unset( $previous_pages['system_info'] );
160
+			unset($previous_pages['api']);
161
+			unset($previous_pages['system_info']);
162 162
 
163 163
 			// Tab is not register.
164
-			$pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) );
164
+			$pages_diff = array_keys(array_diff($previous_pages, $page_ids));
165 165
 
166 166
 			// Merge old settings with new settings.
167 167
 			// $pages = array_merge( $page_ids, $previous_pages );
168 168
 
169
-			if ( in_array( $this->current_tab, $pages_diff ) ) {
169
+			if (in_array($this->current_tab, $pages_diff)) {
170 170
 				// Filter & actions.
171
-				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) );
171
+				add_action("give-settings_save_{$this->current_tab}", array($this, 'save'));
172 172
 			}
173 173
 
174 174
 			return $pages;
@@ -183,16 +183,16 @@  discard block
 block discarded – undo
183 183
 		 *
184 184
 		 * @return string
185 185
 		 */
186
-		function get_section_name( $field_name ) {
186
+		function get_section_name($field_name) {
187 187
 			// Bailout.
188
-			if ( empty( $field_name ) ) {
188
+			if (empty($field_name)) {
189 189
 				return $field_name;
190 190
 			}
191 191
 
192
-			$section_name = explode( ' ', $field_name );
192
+			$section_name = explode(' ', $field_name);
193 193
 
194 194
 			// Output.
195
-			return strip_tags( implode( ' ', $section_name ) );
195
+			return strip_tags(implode(' ', $section_name));
196 196
 		}
197 197
 
198 198
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 *
208 208
 		 * @return mixed
209 209
 		 */
210
-		public function en_translation( $translation, $text ) {
210
+		public function en_translation($translation, $text) {
211 211
 			return $text;
212 212
 		}
213 213
 
@@ -221,59 +221,59 @@  discard block
 block discarded – undo
221 221
 		 *
222 222
 		 * @return mixed
223 223
 		 */
224
-		function get_filtered_addon_sections( $sections = array() ) {
224
+		function get_filtered_addon_sections($sections = array()) {
225 225
 			// New sections.
226 226
 			$new_sections = array();
227
-			$sections_ID  = array_keys( $sections );
228
-			$setting_fields = $this->prev_settings->give_settings( $this->current_tab );
227
+			$sections_ID  = array_keys($sections);
228
+			$setting_fields = $this->prev_settings->give_settings($this->current_tab);
229 229
 
230 230
 			// We need untranslated settings for backward compatibility.
231
-			add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 );
232
-			$en_setting_fields = $this->prev_settings->give_settings( $this->current_tab );
233
-			remove_filter( 'gettext', array( $this, 'en_translation' ), 10 );
231
+			add_filter('gettext', array($this, 'en_translation'), 10, 2);
232
+			$en_setting_fields = $this->prev_settings->give_settings($this->current_tab);
233
+			remove_filter('gettext', array($this, 'en_translation'), 10);
234 234
 
235
-			if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) {
235
+			if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) {
236 236
 
237
-				foreach ( $setting_fields['fields'] as $index => $field ) {
237
+				foreach ($setting_fields['fields'] as $index => $field) {
238 238
 					// Collect new sections from addons.
239
-					if ( 'give_title' !== $field['type'] ) {
239
+					if ('give_title' !== $field['type']) {
240 240
 						continue;
241 241
 					}
242 242
 
243 243
 					// Untranslated setting name.
244
-					$en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : '';
244
+					$en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : '';
245 245
 
246 246
 					// Section name.
247
-					$field['name'] = isset( $field['name'] ) ? $field['name'] : '';
248
-					$section_name  = $this->get_section_name( $field['name'] );
247
+					$field['name'] = isset($field['name']) ? $field['name'] : '';
248
+					$section_name  = $this->get_section_name($field['name']);
249 249
 
250 250
 					// Check if section name exit and section title array is not empty.
251
-					if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) {
251
+					if ( ! empty($sections) && ! empty($en_setting_field_name)) {
252 252
 
253 253
 						// Bailout: Do not load section if it is already exist.
254 254
 						if (
255
-							in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id.
256
-							|| in_array( $section_name, $sections )                            // Check section name.
255
+							in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id.
256
+							|| in_array($section_name, $sections)                            // Check section name.
257 257
 						) {
258 258
 							continue;
259 259
 						}
260 260
 					}
261 261
 
262 262
 					// Collect new sections from addons.
263
-					$new_sections[ sanitize_title( $field['name'] ) ] = $section_name;
263
+					$new_sections[sanitize_title($field['name'])] = $section_name;
264 264
 				}
265 265
 			}
266 266
 
267 267
 			// Add new section.
268
-			if ( ! empty( $new_sections ) ) {
269
-				$sections = array_merge( $sections, $new_sections );
268
+			if ( ! empty($new_sections)) {
269
+				$sections = array_merge($sections, $new_sections);
270 270
 			}
271 271
 
272 272
 			// Remove section tab conditionally.
273
-			switch ( give_get_current_setting_tab() ) {
273
+			switch (give_get_current_setting_tab()) {
274 274
 				case 'emails':
275 275
 					// unset( $sections['donation-receipt'] );
276
-					unset( $sections['new-donation-notification'] );
276
+					unset($sections['new-donation-notification']);
277 277
 			}
278 278
 
279 279
 			// Output.
@@ -291,23 +291,23 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @return array
293 293
 		 */
294
-		function get_filtered_addon_settings( $settings, $setting_fields = array() ) {
294
+		function get_filtered_addon_settings($settings, $setting_fields = array()) {
295 295
 			global $wp_filter;
296 296
 
297 297
 			$new_setting_fields = array();
298 298
 
299
-			if ( ! empty( $settings ) ) {
299
+			if ( ! empty($settings)) {
300 300
 				// Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ).
301
-				if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) {
301
+				if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) {
302 302
 					$last_sectionend_pos = 0;
303
-					foreach ( $settings as $index => $setting ) {
303
+					foreach ($settings as $index => $setting) {
304 304
 						// We need setting till last section end.
305
-						if ( 'sectionend' === $setting['type'] ) {
305
+						if ('sectionend' === $setting['type']) {
306 306
 							$last_sectionend_pos = ++ $index;
307 307
 						}
308 308
 					}
309 309
 
310
-					$settings = array_slice( $settings, 0, $last_sectionend_pos );
310
+					$settings = array_slice($settings, 0, $last_sectionend_pos);
311 311
 
312 312
 					return $settings;
313 313
 				}
@@ -316,24 +316,24 @@  discard block
 block discarded – undo
316 316
 				$prev_title_field_id = '';
317 317
 
318 318
 				// Create new setting fields.
319
-				foreach ( $settings as $index => $field ) {
319
+				foreach ($settings as $index => $field) {
320 320
 
321 321
 					// Bailout: Must need field type to process.
322
-					if ( ! isset( $field['type'] ) ) {
322
+					if ( ! isset($field['type'])) {
323 323
 						continue;
324 324
 					}
325 325
 
326 326
 					// Set wrapper class if any.
327
-					if ( ! empty( $field['row_classes'] ) ) {
327
+					if ( ! empty($field['row_classes'])) {
328 328
 						$field['wrapper_class'] = $field['row_classes'];
329
-						unset( $field['row_classes'] );
329
+						unset($field['row_classes']);
330 330
 					}
331 331
 
332
-					$field['name'] = ! isset( $field['name'] ) ? '' : $field['name'];
333
-					$field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc'];
332
+					$field['name'] = ! isset($field['name']) ? '' : $field['name'];
333
+					$field['desc'] = ! isset($field['desc']) ? '' : $field['desc'];
334 334
 
335 335
 					// Modify cmb2 setting fields.
336
-					switch ( $field['type'] ) {
336
+					switch ($field['type']) {
337 337
 						case 'text' :
338 338
 						case 'file' :
339 339
 							$field['css'] = 'width:25em;';
@@ -357,18 +357,18 @@  discard block
 block discarded – undo
357 357
 							$field['type'] = 'title';
358 358
 
359 359
 							// Since we are showing sections, so there now ned to show horizontal rules.
360
-							if ( '<hr>' === $field['desc'] ) {
360
+							if ('<hr>' === $field['desc']) {
361 361
 								$field['desc'] = '';
362 362
 							}
363 363
 
364 364
 							break;
365 365
 					}
366 366
 
367
-					if ( 'title' === $field['type'] ) {
367
+					if ('title' === $field['type']) {
368 368
 
369 369
 						// If we do not have first element as title then these field will be skip from frontend
370 370
 						// because there are not belong to any section, so put all abandon fields under first section.
371
-						if ( $index && empty( $prev_title_field_id ) ) {
371
+						if ($index && empty($prev_title_field_id)) {
372 372
 							array_unshift(
373 373
 								$new_setting_fields,
374 374
 								array(
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 							$prev_title_field_id = $field['id'];
383 383
 
384 384
 							continue;
385
-						} elseif ( $index ) {
385
+						} elseif ($index) {
386 386
 							// Section end.
387 387
 							$new_setting_fields[] = array(
388 388
 								'type' => 'sectionend',
@@ -414,52 +414,52 @@  discard block
 block discarded – undo
414 414
 
415 415
 				// Check if setting page has title section or not.
416 416
 				// If setting page does not have title section  then add title section to it and fix section end array id.
417
-				if ( 'title' !== $new_setting_fields[0]['type'] ) {
417
+				if ('title' !== $new_setting_fields[0]['type']) {
418 418
 					array_unshift(
419 419
 						$new_setting_fields,
420 420
 						array(
421
-							'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ),
421
+							'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''),
422 422
 							'type'  => 'title',
423
-							'desc'  => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '',
424
-							'id'    => ( isset( $settings['id'] ) ? $settings['id'] : '' ),
423
+							'desc'  => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '',
424
+							'id'    => (isset($settings['id']) ? $settings['id'] : ''),
425 425
 						)
426 426
 					);
427 427
 
428 428
 					// Update id in section end array if does not contain.
429
-					if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) {
430
-						$new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' );
429
+					if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) {
430
+						$new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : '');
431 431
 					}
432 432
 				}
433 433
 
434 434
 				// Return only section related settings.
435
-				if ( $sections = $this->get_filtered_addon_sections() ) {
436
-					$new_setting_fields = $this->get_section_settings( $new_setting_fields );
435
+				if ($sections = $this->get_filtered_addon_sections()) {
436
+					$new_setting_fields = $this->get_section_settings($new_setting_fields);
437 437
 				}
438 438
 
439 439
 				// Third party plugin backward compatibility.
440
-				$wp_filter_keys = array_keys( $wp_filter );
441
-				foreach ( $new_setting_fields as $index => $field ) {
442
-					if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) {
440
+				$wp_filter_keys = array_keys($wp_filter);
441
+				foreach ($new_setting_fields as $index => $field) {
442
+					if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) {
443 443
 						continue;
444 444
 					}
445 445
 
446 446
 					$cmb2_filter_name = "cmb2_render_{$field['type']}";
447 447
 
448
-					if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) {
448
+					if (in_array($cmb2_filter_name, $wp_filter_keys)) {
449 449
 
450
-						if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) {
451
-							$cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks );
450
+						if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) {
451
+							$cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks);
452 452
 						} else {
453
-							$cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] );
453
+							$cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]);
454 454
 						}
455 455
 
456
-						if ( ! empty( $cmb2_filter_arr ) ) {
456
+						if ( ! empty($cmb2_filter_arr)) {
457 457
 							// Note: function can be called either globally or with class object, it depends on how developer invoke it.
458
-							$new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr );
459
-							add_action( "give_admin_field_{$field['type']}", array(
458
+							$new_setting_fields[$index]['func'] = current($cmb2_filter_arr);
459
+							add_action("give_admin_field_{$field['type']}", array(
460 460
 								$this,
461 461
 								'addon_setting_field',
462
-							), 10, 2 );
462
+							), 10, 2);
463 463
 						}
464 464
 					}
465 465
 				}
@@ -480,31 +480,31 @@  discard block
 block discarded – undo
480 480
 		 *
481 481
 		 * @return array
482 482
 		 */
483
-		function get_section_settings( $tab_settings ) {
483
+		function get_section_settings($tab_settings) {
484 484
 			$current_section = give_get_current_setting_section();
485 485
 
486 486
 			// Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section
487 487
 			// because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section
488 488
 			// This is hack to fix this.
489
-			if ( empty( $current_section ) ) {
490
-				$current_section = $this->set_default_setting_tab( $current_section );
489
+			if (empty($current_section)) {
490
+				$current_section = $this->set_default_setting_tab($current_section);
491 491
 			}
492 492
 
493 493
 			$section_start               = false;
494 494
 			$section_end                 = false;
495 495
 			$section_only_setting_fields = array();
496 496
 
497
-			foreach ( $tab_settings as $field ) {
498
-				if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) {
497
+			foreach ($tab_settings as $field) {
498
+				if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) {
499 499
 					$section_start = true;
500 500
 				}
501 501
 
502
-				if ( ! $section_start || $section_end ) {
502
+				if ( ! $section_start || $section_end) {
503 503
 					continue;
504 504
 				}
505 505
 
506
-				if ( $section_start && ! $section_end ) {
507
-					if ( 'sectionend' == $field['type'] ) {
506
+				if ($section_start && ! $section_end) {
507
+					if ('sectionend' == $field['type']) {
508 508
 						$section_end = true;
509 509
 					}
510 510
 					$section_only_setting_fields[] = $field;
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			// Remove title from setting, prevent it from render in setting tab.
515 515
 			$section_only_setting_fields[0]['title'] = '';
516 516
 
517
-			return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings );
517
+			return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings);
518 518
 		}
519 519
 
520 520
 
@@ -528,17 +528,17 @@  discard block
 block discarded – undo
528 528
 		 *
529 529
 		 * @return void
530 530
 		 */
531
-		function addon_setting_field( $field, $saved_value ) {
531
+		function addon_setting_field($field, $saved_value) {
532 532
 			// Create object for cmb2  function callback backward compatibility.
533 533
 			// Note: Do not call any cmb2 function on these objects
534
-			$field_obj      = (object) array( 'args' => $field );
535
-			$field_type_obj = (object) array( 'field' => $field_obj );
534
+			$field_obj      = (object) array('args' => $field);
535
+			$field_type_obj = (object) array('field' => $field_obj);
536 536
 
537
-			switch ( $this->current_tab ) :
537
+			switch ($this->current_tab) :
538 538
 				case 'licenses':
539 539
 					?>
540 540
 					<div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>">
541
-						<?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?>
541
+						<?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?>
542 542
 					</div>
543 543
 					<?php break;
544 544
 
@@ -546,21 +546,21 @@  discard block
 block discarded – undo
546 546
 					$colspan = 'colspan="2"';
547 547
 					?>
548 548
 					<tr valign="top">
549
-						<?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( '&nbsp;' ) ) ) : ?>
549
+						<?php if ( ! empty($field['name']) && ! in_array($field['name'], array('&nbsp;'))) : ?>
550 550
 							<th scope="row" class="titledesc">
551
-								<label for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label>
551
+								<label for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label>
552 552
 							</th>
553 553
 							<?php $colspan = ''; ?>
554 554
 						<?php endif; ?>
555 555
 						<td class="give-forminp" <?php echo $colspan; ?>>
556 556
 							<?php
557
-							if ( is_array( $field['func']['function'] ) ) {
557
+							if (is_array($field['func']['function'])) {
558 558
 								$classname = $field['func']['function'][0];
559 559
 								$function_name = $field['func']['function'][1];
560
-								$classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj );
560
+								$classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj);
561 561
 							} else {
562 562
 								$function_name = $field['func']['function'];
563
-								$function_name( $field_obj, $saved_value, '', '', $field_type_obj );
563
+								$function_name($field_obj, $saved_value, '', '', $field_type_obj);
564 564
 							}
565 565
 							?>
566 566
 						</td>
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 		public function get_sections() {
579 579
 			$sections = array();
580 580
 
581
-			if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) {
582
-				foreach ( $setting_fields['fields'] as $field ) {
583
-					if ( 'give_title' == $field['type'] ) {
584
-						$sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] );
581
+			if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) {
582
+				foreach ($setting_fields['fields'] as $field) {
583
+					if ('give_title' == $field['type']) {
584
+						$sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']);
585 585
 					}
586 586
 				}
587 587
 			}
@@ -601,16 +601,16 @@  discard block
 block discarded – undo
601 601
 
602 602
 			$new_setting_fields = array();
603 603
 
604
-			if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) {
605
-				if ( isset( $setting_fields['fields'] ) ) {
604
+			if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) {
605
+				if (isset($setting_fields['fields'])) {
606 606
 
607 607
 					$tab_data = array(
608 608
 						'id'         => $setting_fields['id'],
609 609
 						'give_title' => $setting_fields['give_title'],
610
-						'desc'       => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ),
610
+						'desc'       => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''),
611 611
 					);
612 612
 
613
-					$new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data );
613
+					$new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data);
614 614
 				}
615 615
 			}
616 616
 
@@ -627,24 +627,24 @@  discard block
 block discarded – undo
627 627
 			$sections = $this->get_sections();
628 628
 
629 629
 			// Show section settings only if setting section exist.
630
-			if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) {
631
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
630
+			if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) {
631
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
632 632
 				$GLOBALS['give_hide_save_button'] = true;
633 633
 
634 634
 				return;
635 635
 			}
636 636
 
637 637
 			// Bailout.
638
-			if ( empty( $sections ) ) {
638
+			if (empty($sections)) {
639 639
 				return;
640 640
 			}
641 641
 
642 642
 			echo '<ul class="give-subsubsub">';
643 643
 
644
-			$array_keys = array_keys( $sections );
644
+			$array_keys = array_keys($sections);
645 645
 
646
-			foreach ( $sections as $id => $label ) {
647
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
646
+			foreach ($sections as $id => $label) {
647
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'&section='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
648 648
 			}
649 649
 
650 650
 			echo '</ul><br class="clear" /><hr>';
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		public function output() {
660 660
 			$settings = $this->get_settings();
661 661
 
662
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
662
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
663 663
 		}
664 664
 
665 665
 		/**
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		public function save() {
672 672
 			$settings = $this->get_settings();
673 673
 
674
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
674
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
675 675
 		}
676 676
 	}
677 677
 endif;
Please login to merge, or discard this patch.
includes/class-give-template-loader.php 1 patch
Spacing   +23 added lines, -23 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
 
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
 		/**
37 37
 		 * Templates
38 38
 		 */
39
-		add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
39
+		add_filter('template_include', array(__CLASS__, 'template_loader'));
40 40
 
41 41
 		/**
42 42
 		 * Content Wrappers
43 43
 		 */
44
-		add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );
45
-		add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );
44
+		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
45
+		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
46 46
 
47 47
 		/**
48 48
 		 * Entry Summary Classes
49 49
 		 */
50
-		add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );
50
+		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
51 51
 
52 52
 		/**
53 53
 		 * Sidebar
54 54
 		 */
55
-		add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );
55
+		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
56 56
 
57 57
 		/**
58 58
 		 * Single Forms Summary Box
59 59
 		 */
60
-		add_action( 'give_single_form_summary', 'give_template_single_title', 5 );
61
-		add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );
60
+		add_action('give_single_form_summary', 'give_template_single_title', 5);
61
+		add_action('give_single_form_summary', 'give_get_donation_form', 10);
62 62
 
63 63
 	}
64 64
 
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string $classes List of space separated class names.
75 75
 	 */
76
-	public function give_set_single_summary_classes( $classes ) {
76
+	public function give_set_single_summary_classes($classes) {
77 77
 
78 78
 		//Add full width class when feature image is disabled AND no widgets are present
79
-		if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
79
+		if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) {
80 80
 			$classes .= ' give-full-width';
81 81
 		}
82 82
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function give_output_sidebar_option() {
98 98
 
99 99
 		//Add full width class when feature image is disabled AND no widgets are present
100
-		if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
101
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );
102
-			add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );
103
-			add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );
104
-			add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );
100
+		if (give_is_setting_enabled(give_get_option('form_sidebar'))) {
101
+			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
102
+			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
103
+			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
104
+			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
105 105
 		}
106 106
 
107 107
 	}
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return string $template
125 125
 	 */
126
-	public static function template_loader( $template ) {
127
-		$find = array( 'give.php' );
126
+	public static function template_loader($template) {
127
+		$find = array('give.php');
128 128
 		$file = '';
129 129
 
130
-		if ( is_single() && get_post_type() == 'give_forms' ) {
130
+		if (is_single() && get_post_type() == 'give_forms') {
131 131
 			$file   = 'single-give-form.php';
132 132
 			$find[] = $file;
133
-			$find[] = apply_filters( 'give_template_path', 'give/' ) . $file;
133
+			$find[] = apply_filters('give_template_path', 'give/').$file;
134 134
 		}
135 135
 
136
-		if ( $file ) {
137
-			$template = locate_template( array_unique( $find ) );
138
-			if ( ! $template ) {
139
-				$template = GIVE_PLUGIN_DIR . '/templates/' . $file;
136
+		if ($file) {
137
+			$template = locate_template(array_unique($find));
138
+			if ( ! $template) {
139
+				$template = GIVE_PLUGIN_DIR.'/templates/'.$file;
140 140
 			}
141 141
 		}
142 142
 
Please login to merge, or discard this patch.
includes/admin/give-metabox-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1283,7 +1283,7 @@
 block discarded – undo
1283 1283
  *
1284 1284
  * @param $field
1285 1285
  *
1286
- * @return string
1286
+ * @return integer
1287 1287
  */
1288 1288
 function _give_set_field_give_id_default_value( $field ) {
1289 1289
 	return 0;
Please login to merge, or discard this patch.
Spacing   +404 added lines, -406 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 9
  * @since       1.8
10 10
  */
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit; // Exit if accessed directly
13 13
 }
14 14
 
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool|string
24 24
  */
25
-function give_is_field_callback_exist( $field ) {
26
-	return ( give_get_field_callback( $field ) ? true : false );
25
+function give_is_field_callback_exist($field) {
26
+	return (give_get_field_callback($field) ? true : false);
27 27
 }
28 28
 
29 29
 /**
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return bool|string
37 37
  */
38
-function give_get_field_callback( $field ) {
38
+function give_get_field_callback($field) {
39 39
 	$func_name_prefix = 'give';
40 40
 	$func_name        = '';
41 41
 
42 42
 	// Set callback function on basis of cmb2 field name.
43
-	switch ( $field['type'] ) {
43
+	switch ($field['type']) {
44 44
 		case 'radio_inline':
45 45
 			$func_name = "{$func_name_prefix}_radio";
46 46
 			break;
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		default:
87 87
 
88 88
 			if (
89
-				array_key_exists( 'callback', $field )
90
-				&& ! empty( $field['callback'] )
89
+				array_key_exists('callback', $field)
90
+				&& ! empty($field['callback'])
91 91
 			) {
92 92
 				$func_name = $field['callback'];
93 93
 			} else {
@@ -100,15 +100,15 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @since 1.8
102 102
 	 */
103
-	$func_name = apply_filters( 'give_get_field_callback', $func_name, $field );
103
+	$func_name = apply_filters('give_get_field_callback', $func_name, $field);
104 104
 
105 105
 	// Exit if not any function exist.
106 106
 	// Check if render callback exist or not.
107
-	if ( empty( $func_name ) ) {
107
+	if (empty($func_name)) {
108 108
 		return false;
109
-	} elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) {
109
+	} elseif (is_string($func_name) && ! function_exists("$func_name")) {
110 110
 		return false;
111
-	} elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) {
111
+	} elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) {
112 112
 		return false;
113 113
 	}
114 114
 
@@ -124,35 +124,35 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return bool
126 126
  */
127
-function give_render_field( $field ) {
127
+function give_render_field($field) {
128 128
 
129 129
 	// Check if render callback exist or not.
130
-	if ( ! ( $func_name = give_get_field_callback( $field ) ) ) {
130
+	if ( ! ($func_name = give_get_field_callback($field))) {
131 131
 		return false;
132 132
 	}
133 133
 
134 134
 	// CMB2 compatibility: Push all classes to attributes's class key
135
-	if ( empty( $field['class'] ) ) {
135
+	if (empty($field['class'])) {
136 136
 		$field['class'] = '';
137 137
 	}
138 138
 
139
-	if ( empty( $field['attributes']['class'] ) ) {
139
+	if (empty($field['attributes']['class'])) {
140 140
 		$field['attributes']['class'] = '';
141 141
 	}
142 142
 
143
-	$field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" );
144
-	unset( $field['class'] );
143
+	$field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}");
144
+	unset($field['class']);
145 145
 
146 146
 	// CMB2 compatibility: Set wrapper class if any.
147
-	if ( ! empty( $field['row_classes'] ) ) {
147
+	if ( ! empty($field['row_classes'])) {
148 148
 		$field['wrapper_class'] = $field['row_classes'];
149
-		unset( $field['row_classes'] );
149
+		unset($field['row_classes']);
150 150
 	}
151 151
 
152 152
 	// Set field params on basis of cmb2 field name.
153
-	switch ( $field['type'] ) {
153
+	switch ($field['type']) {
154 154
 		case 'radio_inline':
155
-			if ( empty( $field['wrapper_class'] ) ) {
155
+			if (empty($field['wrapper_class'])) {
156 156
 				$field['wrapper_class'] = '';
157 157
 			}
158 158
 			$field['wrapper_class'] .= ' give-inline-radio-fields';
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 		case 'text-small' :
166 166
 		case 'text_small' :
167 167
 			// CMB2 compatibility: Set field type to text.
168
-			$field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text';
168
+			$field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text';
169 169
 
170 170
 			// CMB2 compatibility: Set data type to price.
171 171
 			if (
172
-				empty( $field['data_type'] )
173
-				&& ! empty( $field['attributes']['class'] )
172
+				empty($field['data_type'])
173
+				&& ! empty($field['attributes']['class'])
174 174
 				&& (
175
-					false !== strpos( $field['attributes']['class'], 'money' )
176
-					|| false !== strpos( $field['attributes']['class'], 'amount' )
175
+					false !== strpos($field['attributes']['class'], 'money')
176
+					|| false !== strpos($field['attributes']['class'], 'amount')
177 177
 				)
178 178
 			) {
179 179
 				$field['data_type'] = 'decimal';
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 		case 'give_default_radio_inline':
193 193
 			$field['type']    = 'radio';
194 194
 			$field['options'] = array(
195
-				'default' => __( 'Default' ),
195
+				'default' => __('Default'),
196 196
 			);
197 197
 			break;
198 198
 
199 199
 		case 'donation_limit':
200
-			$field['type']  = 'donation_limit';
200
+			$field['type'] = 'donation_limit';
201 201
 			break;
202 202
 	} // End switch().
203 203
 
204 204
 	// CMB2 compatibility: Add support to define field description by desc & description param.
205 205
 	// We encourage you to use description param.
206
-	$field['description'] = ( ! empty( $field['description'] )
206
+	$field['description'] = ( ! empty($field['description'])
207 207
 		? $field['description']
208
-		: ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) );
208
+		: ( ! empty($field['desc']) ? $field['desc'] : ''));
209 209
 
210 210
 	// Call render function.
211
-	if ( is_array( $func_name ) ) {
212
-		$func_name[0]->{$func_name[1]}( $field );
211
+	if (is_array($func_name)) {
212
+		$func_name[0]->{$func_name[1]}($field);
213 213
 	} else {
214
-		$func_name( $field );
214
+		$func_name($field);
215 215
 	}
216 216
 
217 217
 	return true;
@@ -241,29 +241,29 @@  discard block
 block discarded – undo
241 241
  * }
242 242
  * @return void
243 243
  */
244
-function give_text_input( $field ) {
244
+function give_text_input($field) {
245 245
 	global $thepostid, $post;
246 246
 
247
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
248
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
249
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
250
-	$field['value']         = give_get_field_value( $field, $thepostid );
251
-	$field['type']          = isset( $field['type'] ) ? $field['type'] : 'text';
247
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
248
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
249
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
250
+	$field['value']         = give_get_field_value($field, $thepostid);
251
+	$field['type']          = isset($field['type']) ? $field['type'] : 'text';
252 252
 	$field['before_field']  = '';
253 253
 	$field['after_field']   = '';
254
-	$data_type              = empty( $field['data_type'] ) ? '' : $field['data_type'];
254
+	$data_type              = empty($field['data_type']) ? '' : $field['data_type'];
255 255
 
256
-	switch ( $data_type ) {
256
+	switch ($data_type) {
257 257
 		case 'price' :
258
-			$field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] );
258
+			$field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']);
259 259
 
260
-			$field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' );
261
-			$field['after_field']  = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' );
260
+			$field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '');
261
+			$field['after_field']  = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '');
262 262
 			break;
263 263
 
264 264
 		case 'decimal' :
265 265
 			$field['attributes']['class'] .= ' give_input_decimal';
266
-			$field['value']               = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] );
266
+			$field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']);
267 267
 			break;
268 268
 
269 269
 		default :
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
 	}
272 272
 
273 273
 	?>
274
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
275
-	<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
274
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
275
+	<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
276 276
 	<?php echo $field['before_field']; ?>
277 277
 	<input
278
-			type="<?php echo esc_attr( $field['type'] ); ?>"
279
-			style="<?php echo esc_attr( $field['style'] ); ?>"
280
-			name="<?php echo give_get_field_name( $field ); ?>"
281
-			id="<?php echo esc_attr( $field['id'] ); ?>"
282
-			value="<?php echo esc_attr( $field['value'] ); ?>"
283
-		<?php echo give_get_custom_attributes( $field ); ?>
278
+			type="<?php echo esc_attr($field['type']); ?>"
279
+			style="<?php echo esc_attr($field['style']); ?>"
280
+			name="<?php echo give_get_field_name($field); ?>"
281
+			id="<?php echo esc_attr($field['id']); ?>"
282
+			value="<?php echo esc_attr($field['value']); ?>"
283
+		<?php echo give_get_custom_attributes($field); ?>
284 284
 	/>
285 285
 	<?php echo $field['after_field']; ?>
286 286
 	<?php
287
-	echo give_get_field_description( $field );
287
+	echo give_get_field_description($field);
288 288
 	echo '</p>';
289 289
 }
290 290
 
@@ -314,59 +314,57 @@  discard block
 block discarded – undo
314 314
  *
315 315
  * @return void
316 316
  */
317
-function give_chosen_input( $field ) {
317
+function give_chosen_input($field) {
318 318
 	global $thepostid, $post;
319 319
 
320
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
321
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
322
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
320
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
321
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
322
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
323 323
 	$field['before_field']  = '';
324 324
 	$field['after_field']   = '';
325
-	$placeholder            = isset( $field['placeholder'] ) ? 'data-placeholder="' . $field['placeholder'] . '"' : '';
326
-	$data_type              = ! empty( $field['data_type'] ) ? $field['data_type'] : '';
325
+	$placeholder            = isset($field['placeholder']) ? 'data-placeholder="'.$field['placeholder'].'"' : '';
326
+	$data_type              = ! empty($field['data_type']) ? $field['data_type'] : '';
327 327
 	$type                   = '';
328 328
 	$allow_new_values       = '';
329
-	$field['value']         = give_get_field_value( $field, $thepostid );
330
-	$field['value']         = is_array( $field['value'] ) ?
331
-		array_fill_keys( array_filter( $field['value'] ), 'selected' ) :
332
-		$field['value'];
333
-	$title_prefixes_value   = ( is_array( $field['value'] ) && count( $field['value'] ) > 0 ) ?
334
-		array_merge( $field['options'], $field['value'] ) :
335
-		$field['options'];
329
+	$field['value']         = give_get_field_value($field, $thepostid);
330
+	$field['value']         = is_array($field['value']) ?
331
+		array_fill_keys(array_filter($field['value']), 'selected') : $field['value'];
332
+	$title_prefixes_value   = (is_array($field['value']) && count($field['value']) > 0) ?
333
+		array_merge($field['options'], $field['value']) : $field['options'];
336 334
 
337 335
 	// Set attributes based on multiselect datatype.
338
-	if ( 'multiselect' === $data_type ) {
336
+	if ('multiselect' === $data_type) {
339 337
 		$type = 'multiple';
340 338
 		$allow_new_values = 'data-allows-new-values="true"';
341 339
 	}
342 340
 
343 341
 	?>
344
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
345
-		<label for="<?php echo esc_attr( give_get_field_name( $field ) ); ?>">
346
-			<?php echo wp_kses_post( $field['name'] ); ?>
342
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
343
+		<label for="<?php echo esc_attr(give_get_field_name($field)); ?>">
344
+			<?php echo wp_kses_post($field['name']); ?>
347 345
 		</label>
348
-		<?php echo esc_attr( $field['before_field'] ); ?>
346
+		<?php echo esc_attr($field['before_field']); ?>
349 347
 		<select
350 348
 				class="give-select-chosen give-chosen-settings"
351
-				style="<?php echo esc_attr( $field['style'] ); ?>"
352
-				name="<?php echo esc_attr( give_get_field_name( $field ) ); ?>[]"
353
-				id="<?php echo esc_attr( $field['id'] ); ?>"
349
+				style="<?php echo esc_attr($field['style']); ?>"
350
+				name="<?php echo esc_attr(give_get_field_name($field)); ?>[]"
351
+				id="<?php echo esc_attr($field['id']); ?>"
354 352
 			<?php echo "{$type} {$allow_new_values} {$placeholder}"; ?>
355 353
 		>
356 354
 			<?php
357
-			if ( is_array( $title_prefixes_value ) && count( $title_prefixes_value ) > 0 ) {
358
-				foreach ( $title_prefixes_value as $key => $value ) {
355
+			if (is_array($title_prefixes_value) && count($title_prefixes_value) > 0) {
356
+				foreach ($title_prefixes_value as $key => $value) {
359 357
 					echo sprintf(
360 358
 						'<option %1$s value="%2$s">%2$s</option>',
361
-						( 'selected' === $value ) ? 'selected="selected"' : '',
362
-						esc_attr( $key )
359
+						('selected' === $value) ? 'selected="selected"' : '',
360
+						esc_attr($key)
363 361
 					);
364 362
 				}
365 363
 			}
366 364
 			?>
367 365
 		</select>
368
-		<?php echo esc_attr( $field['after_field'] ); ?>
369
-		<?php echo give_get_field_description( $field ); ?>
366
+		<?php echo esc_attr($field['after_field']); ?>
367
+		<?php echo give_get_field_description($field); ?>
370 368
 	</p>
371 369
 	<?php
372 370
 }
@@ -397,107 +395,107 @@  discard block
 block discarded – undo
397 395
  *
398 396
  * @return void
399 397
  */
400
-function give_donation_limit( $field ) {
398
+function give_donation_limit($field) {
401 399
 	global $thepostid, $post;
402 400
 
403 401
 	// Get Give donation form ID.
404
-	$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
402
+	$thepostid = empty($thepostid) ? $post->ID : $thepostid;
405 403
 
406 404
 	// Default arguments.
407 405
 	$default_options = array(
408 406
 		'style'         => '',
409 407
 		'wrapper_class' => '',
410
-		'value'         => give_get_field_value( $field, $thepostid ),
408
+		'value'         => give_get_field_value($field, $thepostid),
411 409
 		'data_type'     => 'decimal',
412 410
 		'before_field'  => '',
413 411
 		'after_field'   => '',
414 412
 	);
415 413
 
416 414
 	// Field options.
417
-	$field['options'] = ! empty( $field['options'] ) ? $field['options'] : array();
415
+	$field['options'] = ! empty($field['options']) ? $field['options'] : array();
418 416
 
419 417
 	// Default field option arguments.
420
-	$field['options'] = wp_parse_args( $field['options'], array(
418
+	$field['options'] = wp_parse_args($field['options'], array(
421 419
 			'display_label' => '',
422
-			'minimum'       => give_format_decimal( '1.00', false, false ),
423
-			'maximum'       => give_format_decimal( '999999.99', false, false ),
420
+			'minimum'       => give_format_decimal('1.00', false, false),
421
+			'maximum'       => give_format_decimal('999999.99', false, false),
424 422
 		)
425 423
 	);
426 424
 
427 425
 	// Set default field options.
428
-	$field_options = wp_parse_args( $field, $default_options );
426
+	$field_options = wp_parse_args($field, $default_options);
429 427
 
430 428
 	// Get default minimum value, if empty.
431
-	$field_options['value']['minimum'] = ! empty( $field_options['value']['minimum'] )
429
+	$field_options['value']['minimum'] = ! empty($field_options['value']['minimum'])
432 430
 		? $field_options['value']['minimum']
433 431
 		: $field_options['options']['minimum'];
434 432
 
435 433
 	// Get default maximum value, if empty.
436
-	$field_options['value']['maximum'] = ! empty( $field_options['value']['maximum'] )
434
+	$field_options['value']['maximum'] = ! empty($field_options['value']['maximum'])
437 435
 		? $field_options['value']['maximum']
438 436
 		: $field_options['options']['maximum'];
439 437
 	?>
440
-	<p class="give-field-wrap <?php echo esc_attr( $field_options['id'] ); ?>_field <?php echo esc_attr( $field_options['wrapper_class'] ); ?>">
441
-	<label for="<?php echo give_get_field_name( $field_options ); ?>"><?php echo wp_kses_post( $field_options['name'] ); ?></label>
438
+	<p class="give-field-wrap <?php echo esc_attr($field_options['id']); ?>_field <?php echo esc_attr($field_options['wrapper_class']); ?>">
439
+	<label for="<?php echo give_get_field_name($field_options); ?>"><?php echo wp_kses_post($field_options['name']); ?></label>
442 440
 	<span class="give_donation_limit_display">
443 441
 		<?php
444
-		foreach ( $field_options['value'] as $amount_range => $amount_value ) {
442
+		foreach ($field_options['value'] as $amount_range => $amount_value) {
445 443
 
446
-			switch ( $field_options['data_type'] ) {
444
+			switch ($field_options['data_type']) {
447 445
 				case 'price' :
448
-					$currency_position = give_get_option( 'currency_position', 'before' );
449
-					$price_field_labels     = 'minimum' === $amount_range ? __( 'Minimum amount', 'give' ) : __( 'Maximum amount', 'give' );
446
+					$currency_position = give_get_option('currency_position', 'before');
447
+					$price_field_labels = 'minimum' === $amount_range ? __('Minimum amount', 'give') : __('Maximum amount', 'give');
450 448
 
451 449
 					$tooltip_html = array(
452
-						'before' => Give()->tooltips->render_span( array(
450
+						'before' => Give()->tooltips->render_span(array(
453 451
 							'label'       => $price_field_labels,
454
-							'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol() ),
455
-						) ),
456
-						'after'  => Give()->tooltips->render_span( array(
452
+							'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol()),
453
+						)),
454
+						'after'  => Give()->tooltips->render_span(array(
457 455
 							'label'       => $price_field_labels,
458
-							'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol() ),
459
-						) ),
456
+							'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol()),
457
+						)),
460 458
 					);
461 459
 
462
-					$before_html = ! empty( $field_options['before_field'] )
460
+					$before_html = ! empty($field_options['before_field'])
463 461
 						? $field_options['before_field']
464
-						: ( 'before' === $currency_position ? $tooltip_html['before'] : '' );
462
+						: ('before' === $currency_position ? $tooltip_html['before'] : '');
465 463
 
466
-					$after_html = ! empty( $field_options['after_field'] )
464
+					$after_html = ! empty($field_options['after_field'])
467 465
 						? $field_options['after_field']
468
-						: ( 'after' === $currency_position ? $tooltip_html['after'] : '' );
466
+						: ('after' === $currency_position ? $tooltip_html['after'] : '');
469 467
 
470
-					$field_options['attributes']['class']    .= ' give-text_small';
471
-					$field_options['value'][ $amount_range ] = $amount_value;
468
+					$field_options['attributes']['class'] .= ' give-text_small';
469
+					$field_options['value'][$amount_range] = $amount_value;
472 470
 					break;
473 471
 
474 472
 				case 'decimal' :
475
-					$field_options['attributes']['class']    .= ' give_input_decimal give-text_small';
476
-					$field_options['value'][ $amount_range ] = $amount_value;
473
+					$field_options['attributes']['class'] .= ' give_input_decimal give-text_small';
474
+					$field_options['value'][$amount_range] = $amount_value;
477 475
 					break;
478 476
 			}
479 477
 
480 478
 			echo '<span class=give-minmax-wrap>';
481
-			printf( '<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr( $field_options['id'] ), esc_attr( $amount_range ), esc_html( $price_field_labels ) );
479
+			printf('<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr($field_options['id']), esc_attr($amount_range), esc_html($price_field_labels));
482 480
 
483
-			echo isset( $before_html ) ? $before_html : '';
481
+			echo isset($before_html) ? $before_html : '';
484 482
 			?>
485 483
 			<input
486
-					name="<?php echo give_get_field_name( $field_options ); ?>[<?php echo esc_attr( $amount_range ); ?>]"
484
+					name="<?php echo give_get_field_name($field_options); ?>[<?php echo esc_attr($amount_range); ?>]"
487 485
 					type="text"
488 486
 					id="<?php echo $field_options['id']; ?>_give_donation_limit_<?php echo $amount_range; ?>"
489
-					data-range_type="<?php echo esc_attr( $amount_range ); ?>"
490
-					value="<?php echo give_format_decimal( esc_attr( $field_options['value'][ $amount_range ] ) ); ?>"
491
-					placeholder="<?php echo give_format_decimal( $field_options['options'][ $amount_range ] ); ?>"
492
-				<?php echo give_get_custom_attributes( $field_options ); ?>
487
+					data-range_type="<?php echo esc_attr($amount_range); ?>"
488
+					value="<?php echo give_format_decimal(esc_attr($field_options['value'][$amount_range])); ?>"
489
+					placeholder="<?php echo give_format_decimal($field_options['options'][$amount_range]); ?>"
490
+				<?php echo give_get_custom_attributes($field_options); ?>
493 491
 			/>
494 492
 			<?php
495
-			echo isset( $after_html ) ? $after_html : '';
493
+			echo isset($after_html) ? $after_html : '';
496 494
 			echo '</span>';
497 495
 		}
498 496
 		?>
499 497
 	</span>
500
-		<?php echo give_get_field_description( $field_options ); ?>
498
+		<?php echo give_get_field_description($field_options); ?>
501 499
 	</p>
502 500
 	<?php
503 501
 }
@@ -520,29 +518,29 @@  discard block
 block discarded – undo
520 518
  * }
521 519
  * @return void
522 520
  */
523
-function give_hidden_input( $field ) {
521
+function give_hidden_input($field) {
524 522
 	global $thepostid, $post;
525 523
 
526
-	$thepostid      = empty( $thepostid ) ? $post->ID : $thepostid;
527
-	$field['value'] = give_get_field_value( $field, $thepostid );
524
+	$thepostid      = empty($thepostid) ? $post->ID : $thepostid;
525
+	$field['value'] = give_get_field_value($field, $thepostid);
528 526
 
529 527
 	// Custom attribute handling
530 528
 	$custom_attributes = array();
531 529
 
532
-	if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
530
+	if ( ! empty($field['attributes']) && is_array($field['attributes'])) {
533 531
 
534
-		foreach ( $field['attributes'] as $attribute => $value ) {
535
-			$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
532
+		foreach ($field['attributes'] as $attribute => $value) {
533
+			$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"';
536 534
 		}
537 535
 	}
538 536
 	?>
539 537
 
540 538
 	<input
541 539
 			type="hidden"
542
-			name="<?php echo give_get_field_name( $field ); ?>"
543
-			id="<?php echo esc_attr( $field['id'] ); ?>"
544
-			value="<?php echo esc_attr( $field['value'] ); ?>"
545
-		<?php echo give_get_custom_attributes( $field ); ?>
540
+			name="<?php echo give_get_field_name($field); ?>"
541
+			id="<?php echo esc_attr($field['id']); ?>"
542
+			value="<?php echo esc_attr($field['value']); ?>"
543
+		<?php echo give_get_custom_attributes($field); ?>
546 544
 	/>
547 545
 	<?php
548 546
 }
@@ -568,28 +566,28 @@  discard block
 block discarded – undo
568 566
  * }
569 567
  * @return void
570 568
  */
571
-function give_textarea_input( $field ) {
569
+function give_textarea_input($field) {
572 570
 	global $thepostid, $post;
573 571
 
574
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
575
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
576
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
577
-	$field['value']         = give_get_field_value( $field, $thepostid );
572
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
573
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
574
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
575
+	$field['value']         = give_get_field_value($field, $thepostid);
578 576
 	$default_attributes = array(
579 577
 		'cols' => 20,
580 578
 		'rows' => 10
581 579
 	);
582 580
 	?>
583
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
584
-	<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
581
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
582
+	<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
585 583
 	<textarea
586
-			style="<?php echo esc_attr( $field['style'] ); ?>"
587
-			name="<?php echo give_get_field_name( $field ); ?>"
588
-			id="<?php echo esc_attr( $field['id'] ); ?>"
589
-		<?php echo give_get_attribute_str( $field, $default_attributes ); ?>
590
-	><?php echo esc_textarea( $field['value'] ); ?></textarea>
584
+			style="<?php echo esc_attr($field['style']); ?>"
585
+			name="<?php echo give_get_field_name($field); ?>"
586
+			id="<?php echo esc_attr($field['id']); ?>"
587
+		<?php echo give_get_attribute_str($field, $default_attributes); ?>
588
+	><?php echo esc_textarea($field['value']); ?></textarea>
591 589
 	<?php
592
-	echo give_get_field_description( $field );
590
+	echo give_get_field_description($field);
593 591
 	echo '</p>';
594 592
 }
595 593
 
@@ -613,29 +611,29 @@  discard block
 block discarded – undo
613 611
  * }
614 612
  * @return void
615 613
  */
616
-function give_wysiwyg( $field ) {
614
+function give_wysiwyg($field) {
617 615
 	global $thepostid, $post;
618 616
 
619
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
620
-	$field['value']         = give_get_field_value( $field, $thepostid );
621
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
622
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
617
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
618
+	$field['value']         = give_get_field_value($field, $thepostid);
619
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
620
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
623 621
 
624
-	$field['unique_field_id'] = give_get_field_name( $field );
622
+	$field['unique_field_id'] = give_get_field_name($field);
625 623
 	$editor_attributes        = array(
626
-		'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'],
624
+		'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'],
627 625
 		'textarea_rows' => '10',
628
-		'editor_css'    => esc_attr( $field['style'] ),
626
+		'editor_css'    => esc_attr($field['style']),
629 627
 		'editor_class'  => $field['attributes']['class'],
630 628
 	);
631
-	$data_wp_editor           = ' data-wp-editor="' . base64_encode( json_encode( array(
629
+	$data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array(
632 630
 			$field['value'],
633 631
 			$field['unique_field_id'],
634 632
 			$editor_attributes,
635
-		) ) ) . '"';
636
-	$data_wp_editor           = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : '';
633
+		))).'"';
634
+	$data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : '';
637 635
 
638
-	echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>';
636
+	echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>';
639 637
 
640 638
 	wp_editor(
641 639
 		$field['value'],
@@ -643,7 +641,7 @@  discard block
 block discarded – undo
643 641
 		$editor_attributes
644 642
 	);
645 643
 
646
-	echo give_get_field_description( $field );
644
+	echo give_get_field_description($field);
647 645
 	echo '</div>';
648 646
 }
649 647
 
@@ -668,29 +666,29 @@  discard block
 block discarded – undo
668 666
  * }
669 667
  * @return void
670 668
  */
671
-function give_checkbox( $field ) {
669
+function give_checkbox($field) {
672 670
 	global $thepostid, $post;
673 671
 
674
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
675
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
676
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
677
-	$field['value']         = give_get_field_value( $field, $thepostid );
678
-	$field['cbvalue']       = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on';
679
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
672
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
673
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
674
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
675
+	$field['value']         = give_get_field_value($field, $thepostid);
676
+	$field['cbvalue']       = isset($field['cbvalue']) ? $field['cbvalue'] : 'on';
677
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
680 678
 	?>
681
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
682
-	<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
679
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
680
+	<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
683 681
 	<input
684 682
 			type="checkbox"
685
-			style="<?php echo esc_attr( $field['style'] ); ?>"
686
-			name="<?php echo give_get_field_name( $field ); ?>"
687
-			id="<?php echo esc_attr( $field['id'] ); ?>"
688
-			value="<?php echo esc_attr( $field['cbvalue'] ); ?>"
689
-		<?php echo checked( $field['value'], $field['cbvalue'], false ); ?>
690
-		<?php echo give_get_custom_attributes( $field ); ?>
683
+			style="<?php echo esc_attr($field['style']); ?>"
684
+			name="<?php echo give_get_field_name($field); ?>"
685
+			id="<?php echo esc_attr($field['id']); ?>"
686
+			value="<?php echo esc_attr($field['cbvalue']); ?>"
687
+		<?php echo checked($field['value'], $field['cbvalue'], false); ?>
688
+		<?php echo give_get_custom_attributes($field); ?>
691 689
 	/>
692 690
 	<?php
693
-	echo give_get_field_description( $field );
691
+	echo give_get_field_description($field);
694 692
 	echo '</p>';
695 693
 }
696 694
 
@@ -716,29 +714,29 @@  discard block
 block discarded – undo
716 714
  * }
717 715
  * @return void
718 716
  */
719
-function give_select( $field ) {
717
+function give_select($field) {
720 718
 	global $thepostid, $post;
721 719
 
722
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
723
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
724
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
725
-	$field['value']         = give_get_field_value( $field, $thepostid );
726
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
720
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
721
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
722
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
723
+	$field['value']         = give_get_field_value($field, $thepostid);
724
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
727 725
 	?>
728
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
729
-	<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
726
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
727
+	<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
730 728
 	<select
731
-	id="<?php echo esc_attr( $field['id'] ); ?>"
732
-	name="<?php echo give_get_field_name( $field ); ?>"
733
-	style="<?php echo esc_attr( $field['style'] ) ?>"
734
-	<?php echo give_get_custom_attributes( $field ); ?>
729
+	id="<?php echo esc_attr($field['id']); ?>"
730
+	name="<?php echo give_get_field_name($field); ?>"
731
+	style="<?php echo esc_attr($field['style']) ?>"
732
+	<?php echo give_get_custom_attributes($field); ?>
735 733
 	>
736 734
 	<?php
737
-	foreach ( $field['options'] as $key => $value ) {
738
-		echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';
735
+	foreach ($field['options'] as $key => $value) {
736
+		echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>';
739 737
 	}
740 738
 	echo '</select>';
741
-	echo give_get_field_description( $field );
739
+	echo give_get_field_description($field);
742 740
 	echo '</p>';
743 741
 }
744 742
 
@@ -765,32 +763,32 @@  discard block
 block discarded – undo
765 763
  * }
766 764
  * @return void
767 765
  */
768
-function give_radio( $field ) {
766
+function give_radio($field) {
769 767
 	global $thepostid, $post;
770 768
 
771
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
772
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
773
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
774
-	$field['value']         = give_get_field_value( $field, $thepostid );
775
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
769
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
770
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
771
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
772
+	$field['value']         = give_get_field_value($field, $thepostid);
773
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
776 774
 
777
-	echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">';
775
+	echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">';
778 776
 
779
-	foreach ( $field['options'] as $key => $value ) {
777
+	foreach ($field['options'] as $key => $value) {
780 778
 
781 779
 		echo '<li><label><input
782
-				name="' . give_get_field_name( $field ) . '"
783
-				value="' . esc_attr( $key ) . '"
780
+				name="' . give_get_field_name($field).'"
781
+				value="' . esc_attr($key).'"
784 782
 				type="radio"
785
-				style="' . esc_attr( $field['style'] ) . '"
786
-				' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' '
787
-		     . give_get_custom_attributes( $field ) . '
788
-				/> ' . esc_html( $value ) . '</label>
783
+				style="' . esc_attr($field['style']).'"
784
+				' . checked(esc_attr($field['value']), esc_attr($key), false).' '
785
+		     . give_get_custom_attributes($field).'
786
+				/> ' . esc_html($value).'</label>
789 787
 		</li>';
790 788
 	}
791 789
 	echo '</ul>';
792 790
 
793
-	echo give_get_field_description( $field );
791
+	echo give_get_field_description($field);
794 792
 	echo '</fieldset>';
795 793
 }
796 794
 
@@ -814,27 +812,27 @@  discard block
 block discarded – undo
814 812
  * }
815 813
  * @return void
816 814
  */
817
-function give_colorpicker( $field ) {
815
+function give_colorpicker($field) {
818 816
 	global $thepostid, $post;
819 817
 
820
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
821
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
822
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
823
-	$field['value']         = give_get_field_value( $field, $thepostid );
824
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
818
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
819
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
820
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
821
+	$field['value']         = give_get_field_value($field, $thepostid);
822
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
825 823
 	$field['type']          = 'text';
826 824
 	?>
827
-	<p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
828
-	<label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
825
+	<p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
826
+	<label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>
829 827
 	<input
830
-			type="<?php echo esc_attr( $field['type'] ); ?>"
831
-			style="<?php echo esc_attr( $field['style'] ); ?>"
832
-			name="<?php echo give_get_field_name( $field ); ?>"
833
-			id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>"
834
-		<?php echo give_get_custom_attributes( $field ); ?>
828
+			type="<?php echo esc_attr($field['type']); ?>"
829
+			style="<?php echo esc_attr($field['style']); ?>"
830
+			name="<?php echo give_get_field_name($field); ?>"
831
+			id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>"
832
+		<?php echo give_get_custom_attributes($field); ?>
835 833
 	/>
836 834
 	<?php
837
-	echo give_get_field_description( $field );
835
+	echo give_get_field_description($field);
838 836
 	echo '</p>';
839 837
 }
840 838
 
@@ -845,8 +843,8 @@  discard block
 block discarded – undo
845 843
  *
846 844
  * @param array $field
847 845
  */
848
-function give_file( $field ) {
849
-	give_media( $field );
846
+function give_file($field) {
847
+	give_media($field);
850 848
 }
851 849
 
852 850
 
@@ -857,37 +855,37 @@  discard block
 block discarded – undo
857 855
  *
858 856
  * @param array $field
859 857
  */
860
-function give_media( $field ) {
858
+function give_media($field) {
861 859
 	global $thepostid, $post;
862 860
 
863
-	$thepostid    = empty( $thepostid ) ? $post->ID : $thepostid;
864
-	$button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $field['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) );
861
+	$thepostid    = empty($thepostid) ? $post->ID : $thepostid;
862
+	$button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $field['type'] ? __('File', 'give') : __('Image', 'give')));
865 863
 
866
-	$field['style']               = isset( $field['style'] ) ? $field['style'] : '';
867
-	$field['wrapper_class']       = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
868
-	$field['value']               = give_get_field_value( $field, $thepostid );
869
-	$field['name']                = isset( $field['name'] ) ? $field['name'] : $field['id'];
864
+	$field['style']               = isset($field['style']) ? $field['style'] : '';
865
+	$field['wrapper_class']       = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
866
+	$field['value']               = give_get_field_value($field, $thepostid);
867
+	$field['name']                = isset($field['name']) ? $field['name'] : $field['id'];
870 868
 	$field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium";
871 869
 
872 870
 	// Allow developer to save attachment ID or attachment url as metadata.
873
-	$field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url';
871
+	$field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url';
874 872
 
875
-	$allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );
876
-	$preview_image_src        = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#';
877
-	$preview_image_extension  = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';
878
-	$is_show_preview          = in_array( $preview_image_extension, $allow_media_preview_tags );
873
+	$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico');
874
+	$preview_image_src        = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#';
875
+	$preview_image_extension  = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';
876
+	$is_show_preview          = in_array($preview_image_extension, $allow_media_preview_tags);
879 877
 	?>
880
-	<fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">
881
-		<label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>
878
+	<fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">
879
+		<label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label>
882 880
 		<input
883
-				name="<?php echo give_get_field_name( $field ); ?>"
884
-				id="<?php echo esc_attr( $field['id'] ); ?>"
881
+				name="<?php echo give_get_field_name($field); ?>"
882
+				id="<?php echo esc_attr($field['id']); ?>"
885 883
 				type="text"
886 884
 				value="<?php echo $field['value']; ?>"
887
-				style="<?php echo esc_attr( $field['style'] ); ?>"
888
-			<?php echo give_get_custom_attributes( $field ); ?>
885
+				style="<?php echo esc_attr($field['style']); ?>"
886
+			<?php echo give_get_custom_attributes($field); ?>
889 887
 		/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>">
890
-		<?php echo give_get_field_description( $field ); ?>
888
+		<?php echo give_get_field_description($field); ?>
891 889
 		<div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>">
892 890
 			<span class="give-delete-image-thumb dashicons dashicons-no-alt"></span>
893 891
 			<img src="<?php echo $preview_image_src; ?>" alt="">
@@ -905,27 +903,27 @@  discard block
 block discarded – undo
905 903
  *
906 904
  * @return void
907 905
  */
908
-function give_default_gateway( $field ) {
906
+function give_default_gateway($field) {
909 907
 	global $thepostid, $post;
910 908
 
911 909
 	// get all active payment gateways.
912
-	$gateways         = give_get_enabled_payment_gateways( $thepostid );
910
+	$gateways         = give_get_enabled_payment_gateways($thepostid);
913 911
 	$field['options'] = array();
914 912
 
915 913
 	// Set field option value.
916
-	if ( ! empty( $gateways ) ) {
917
-		foreach ( $gateways as $key => $option ) {
918
-			$field['options'][ $key ] = $option['admin_label'];
914
+	if ( ! empty($gateways)) {
915
+		foreach ($gateways as $key => $option) {
916
+			$field['options'][$key] = $option['admin_label'];
919 917
 		}
920 918
 	}
921 919
 
922 920
 	// Add a field to the Give Form admin single post view of this field
923
-	if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
924
-		$field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] );
921
+	if (is_object($post) && 'give_forms' === $post->post_type) {
922
+		$field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']);
925 923
 	}
926 924
 
927 925
 	// Render select field.
928
-	give_select( $field );
926
+	give_select($field);
929 927
 }
930 928
 
931 929
 /**
@@ -947,13 +945,13 @@  discard block
 block discarded – undo
947 945
  * @return void
948 946
  */
949 947
 
950
-function give_docs_link( $field ) {
951
-	$field['url']   = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation';
952
-	$field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation';
948
+function give_docs_link($field) {
949
+	$field['url']   = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation';
950
+	$field['title'] = isset($field['title']) ? $field['title'] : 'Documentation';
953 951
 
954
-	echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] )
952
+	echo '<p class="give-docs-link"><a href="'.esc_url($field['url'])
955 953
 	     . '" target="_blank">'
956
-	     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] )
954
+	     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title'])
957 955
 	     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
958 956
 }
959 957
 
@@ -965,15 +963,15 @@  discard block
 block discarded – undo
965 963
  *
966 964
  * @param $field
967 965
  */
968
-function give_email_preview_buttons( $field ) {
966
+function give_email_preview_buttons($field) {
969 967
 	/* @var WP_Post $post */
970 968
 	global $post;
971 969
 
972
-	$field_id = str_replace( array( '_give_', '_preview_buttons' ), '', $field['id'] );
970
+	$field_id = str_replace(array('_give_', '_preview_buttons'), '', $field['id']);
973 971
 
974 972
 	ob_start();
975 973
 
976
-	echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>';
974
+	echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>';
977 975
 
978 976
 	echo sprintf(
979 977
 		'<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>',
@@ -1001,12 +999,12 @@  discard block
 block discarded – undo
1001 999
 					'form_id'      => $post->ID,
1002 1000
 				)
1003 1001
 			), 'give-send-preview-email' ),
1004
-		esc_attr__( 'Send Test Email.', 'give' ),
1005
-		esc_html__( 'Send Test Email', 'give' )
1002
+		esc_attr__('Send Test Email.', 'give'),
1003
+		esc_html__('Send Test Email', 'give')
1006 1004
 	);
1007 1005
 
1008
-	if ( ! empty( $field['description'] ) ) {
1009
-		echo '<span class="give-field-description">' . wp_kses_post( $field['desc'] ) . '</span>';
1006
+	if ( ! empty($field['description'])) {
1007
+		echo '<span class="give-field-description">'.wp_kses_post($field['desc']).'</span>';
1010 1008
 	}
1011 1009
 
1012 1010
 	echo '</p>';
@@ -1027,29 +1025,29 @@  discard block
 block discarded – undo
1027 1025
  *
1028 1026
  * @return mixed
1029 1027
  */
1030
-function give_get_field_value( $field, $postid ) {
1031
-	if ( isset( $field['attributes']['value'] ) ) {
1028
+function give_get_field_value($field, $postid) {
1029
+	if (isset($field['attributes']['value'])) {
1032 1030
 		return $field['attributes']['value'];
1033 1031
 	}
1034 1032
 
1035 1033
 	// If field is range slider.
1036
-	if ( 'donation_limit' === $field['type'] ) {
1034
+	if ('donation_limit' === $field['type']) {
1037 1035
 
1038 1036
 		// Get minimum value.
1039
-		$minimum = give_get_meta( $postid, $field['id'] . '_minimum', true );
1037
+		$minimum = give_get_meta($postid, $field['id'].'_minimum', true);
1040 1038
 
1041 1039
 		// Give < 2.1
1042
-		if ( '_give_custom_amount_range' === $field['id'] && empty( $minimum ) ) {
1043
-			$minimum = give_get_meta( $postid, '_give_custom_amount_minimum', true );
1040
+		if ('_give_custom_amount_range' === $field['id'] && empty($minimum)) {
1041
+			$minimum = give_get_meta($postid, '_give_custom_amount_minimum', true);
1044 1042
 		}
1045 1043
 
1046 1044
 		$field_value = array(
1047 1045
 			'minimum' => $minimum,
1048
-			'maximum' => give_get_meta( $postid, $field['id'] . '_maximum', true ),
1046
+			'maximum' => give_get_meta($postid, $field['id'].'_maximum', true),
1049 1047
 		);
1050 1048
 	} else {
1051 1049
 		// Get value from db.
1052
-		$field_value = give_get_meta( $postid, $field['id'], true );
1050
+		$field_value = give_get_meta($postid, $field['id'], true);
1053 1051
 	}
1054 1052
 
1055 1053
 	/**
@@ -1059,10 +1057,10 @@  discard block
 block discarded – undo
1059 1057
 	 *
1060 1058
 	 * @param mixed $field_value Field value.
1061 1059
 	 */
1062
-	$field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid );
1060
+	$field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid);
1063 1061
 
1064 1062
 	// Set default value if no any data saved to db.
1065
-	if ( ! $field_value && isset( $field['default'] ) ) {
1063
+	if ( ! $field_value && isset($field['default'])) {
1066 1064
 		$field_value = $field['default'];
1067 1065
 	}
1068 1066
 
@@ -1079,20 +1077,20 @@  discard block
 block discarded – undo
1079 1077
  *
1080 1078
  * @return string
1081 1079
  */
1082
-function give_get_field_description( $field ) {
1080
+function give_get_field_description($field) {
1083 1081
 	$field_desc_html = '';
1084 1082
 	$description     = '';
1085 1083
 
1086 1084
 	// Check for both `description` and `desc`.
1087
-	if ( isset( $field['description'] ) ) {
1085
+	if (isset($field['description'])) {
1088 1086
 		$description = $field['description'];
1089
-	} elseif ( isset( $field['desc'] ) ) {
1087
+	} elseif (isset($field['desc'])) {
1090 1088
 		$description = $field['desc'];
1091 1089
 	}
1092 1090
 
1093 1091
 	// Set if there is a description.
1094
-	if ( ! empty( $description ) ) {
1095
-		$field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>';
1092
+	if ( ! empty($description)) {
1093
+		$field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>';
1096 1094
 	}
1097 1095
 
1098 1096
 	return $field_desc_html;
@@ -1112,8 +1110,8 @@  discard block
 block discarded – undo
1112 1110
  *
1113 1111
  * @return string
1114 1112
  */
1115
-function give_get_repeater_field_value( $field, $field_group, $fields ) {
1116
-	$field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' );
1113
+function give_get_repeater_field_value($field, $field_group, $fields) {
1114
+	$field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : '');
1117 1115
 
1118 1116
 	/**
1119 1117
 	 * Filter the specific repeater field value
@@ -1122,7 +1120,7 @@  discard block
 block discarded – undo
1122 1120
 	 *
1123 1121
 	 * @param string $field_id
1124 1122
 	 */
1125
-	$field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields );
1123
+	$field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields);
1126 1124
 
1127 1125
 	/**
1128 1126
 	 * Filter the repeater field value
@@ -1131,7 +1129,7 @@  discard block
 block discarded – undo
1131 1129
 	 *
1132 1130
 	 * @param string $field_id
1133 1131
 	 */
1134
-	$field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields );
1132
+	$field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields);
1135 1133
 
1136 1134
 	return $field_value;
1137 1135
 }
@@ -1149,7 +1147,7 @@  discard block
 block discarded – undo
1149 1147
  *
1150 1148
  * @return string
1151 1149
  */
1152
-function give_get_repeater_field_id( $field, $fields, $default = false ) {
1150
+function give_get_repeater_field_id($field, $fields, $default = false) {
1153 1151
 	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}';
1154 1152
 
1155 1153
 	// Get field id.
@@ -1162,7 +1160,7 @@  discard block
 block discarded – undo
1162 1160
 	 *
1163 1161
 	 * @param string $field_id
1164 1162
 	 */
1165
-	$field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default );
1163
+	$field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default);
1166 1164
 
1167 1165
 	/**
1168 1166
 	 * Filter the repeater field id
@@ -1171,7 +1169,7 @@  discard block
 block discarded – undo
1171 1169
 	 *
1172 1170
 	 * @param string $field_id
1173 1171
 	 */
1174
-	$field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default );
1172
+	$field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default);
1175 1173
 
1176 1174
 	return $field_id;
1177 1175
 }
@@ -1186,8 +1184,8 @@  discard block
 block discarded – undo
1186 1184
  *
1187 1185
  * @return string
1188 1186
  */
1189
-function give_get_field_name( $field ) {
1190
-	$field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] );
1187
+function give_get_field_name($field) {
1188
+	$field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']);
1191 1189
 
1192 1190
 	/**
1193 1191
 	 * Filter the field name.
@@ -1196,7 +1194,7 @@  discard block
 block discarded – undo
1196 1194
 	 *
1197 1195
 	 * @param string $field_name
1198 1196
 	 */
1199
-	$field_name = apply_filters( 'give_get_field_name', $field_name, $field );
1197
+	$field_name = apply_filters('give_get_field_name', $field_name, $field);
1200 1198
 
1201 1199
 	return $field_name;
1202 1200
 }
@@ -1213,40 +1211,40 @@  discard block
 block discarded – undo
1213 1211
  *
1214 1212
  * @return void
1215 1213
  */
1216
-function _give_metabox_form_data_repeater_fields( $fields ) {
1214
+function _give_metabox_form_data_repeater_fields($fields) {
1217 1215
 	global $thepostid, $post;
1218 1216
 
1219 1217
 	// Bailout.
1220
-	if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) {
1218
+	if ( ! isset($fields['fields']) || empty($fields['fields'])) {
1221 1219
 		return;
1222 1220
 	}
1223 1221
 
1224
-	$group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0;
1225
-	$close_tabs      = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0;
1226
-	$wrapper_class   = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : '';
1222
+	$group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0;
1223
+	$close_tabs      = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0;
1224
+	$wrapper_class   = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : '';
1227 1225
 	?>
1228
-	<div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>"
1226
+	<div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>"
1229 1227
 	     data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>">
1230
-		<?php if ( ! empty( $fields['name'] ) ) : ?>
1228
+		<?php if ( ! empty($fields['name'])) : ?>
1231 1229
 			<p class="give-repeater-field-name"><?php echo $fields['name']; ?></p>
1232 1230
 		<?php endif; ?>
1233 1231
 
1234
-		<?php if ( ! empty( $fields['description'] ) ) : ?>
1232
+		<?php if ( ! empty($fields['description'])) : ?>
1235 1233
 			<p class="give-repeater-field-description"><?php echo $fields['description']; ?></p>
1236 1234
 		<?php endif; ?>
1237 1235
 
1238 1236
 		<table class="give-repeatable-fields-section-wrapper" cellspacing="0">
1239 1237
 			<?php
1240
-			$repeater_field_values = give_get_meta( $thepostid, $fields['id'], true );
1241
-			$header_title          = isset( $fields['options']['header_title'] )
1238
+			$repeater_field_values = give_get_meta($thepostid, $fields['id'], true);
1239
+			$header_title          = isset($fields['options']['header_title'])
1242 1240
 				? $fields['options']['header_title']
1243
-				: esc_attr__( 'Group', 'give' );
1241
+				: esc_attr__('Group', 'give');
1244 1242
 
1245 1243
 			$add_default_donation_field = false;
1246 1244
 
1247 1245
 			// Check if level is not created or we have to add default level.
1248
-			if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) {
1249
-				$repeater_field_values = array_values( $repeater_field_values );
1246
+			if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) {
1247
+				$repeater_field_values = array_values($repeater_field_values);
1250 1248
 			} else {
1251 1249
 				$fields_count               = 1;
1252 1250
 				$add_default_donation_field = true;
@@ -1259,77 +1257,77 @@  discard block
 block discarded – undo
1259 1257
 					<div class="give-row-head give-move">
1260 1258
 						<button type="button" class="handlediv button-link"><span class="toggle-indicator"></span>
1261 1259
 						</button>
1262
-						<span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span>
1260
+						<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span>
1263 1261
 						<h2>
1264 1262
 							<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
1265 1263
 						</h2>
1266 1264
 					</div>
1267 1265
 					<div class="give-row-body">
1268
-						<?php foreach ( $fields['fields'] as $field ) : ?>
1266
+						<?php foreach ($fields['fields'] as $field) : ?>
1269 1267
 							<?php
1270
-							if ( ! give_is_field_callback_exist( $field ) ) {
1268
+							if ( ! give_is_field_callback_exist($field)) {
1271 1269
 								continue;
1272 1270
 							}
1273 1271
 							?>
1274 1272
 							<?php
1275 1273
 							$field['repeat']              = true;
1276
-							$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields );
1274
+							$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields);
1277 1275
 							$field['id']                  = str_replace(
1278
-								array( '[', ']' ),
1279
-								array( '_', '', ),
1276
+								array('[', ']'),
1277
+								array('_', '',),
1280 1278
 								$field['repeatable_field_id']
1281 1279
 							);
1282 1280
 							?>
1283
-							<?php give_render_field( $field ); ?>
1281
+							<?php give_render_field($field); ?>
1284 1282
 						<?php endforeach; ?>
1285 1283
 					</div>
1286 1284
 				</td>
1287 1285
 			</tr>
1288 1286
 
1289
-			<?php if ( ! empty( $repeater_field_values ) ) : ?>
1287
+			<?php if ( ! empty($repeater_field_values)) : ?>
1290 1288
 				<!--Stored repeater field group-->
1291
-				<?php foreach ( $repeater_field_values as $index => $field_group ) : ?>
1289
+				<?php foreach ($repeater_field_values as $index => $field_group) : ?>
1292 1290
 					<tr class="give-row">
1293 1291
 						<td class="give-repeater-field-wrap give-column" colspan="2">
1294 1292
 							<div class="give-row-head give-move">
1295 1293
 								<button type="button" class="handlediv button-link">
1296 1294
 									<span class="toggle-indicator"></span></button>
1297
-								<span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-
1295
+								<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-
1298 1296
 								</span>
1299 1297
 								<h2>
1300 1298
 									<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
1301 1299
 								</h2>
1302 1300
 							</div>
1303 1301
 							<div class="give-row-body">
1304
-								<?php foreach ( $fields['fields'] as $field ) : ?>
1305
-									<?php if ( ! give_is_field_callback_exist( $field ) ) {
1302
+								<?php foreach ($fields['fields'] as $field) : ?>
1303
+									<?php if ( ! give_is_field_callback_exist($field)) {
1306 1304
 										continue;
1307 1305
 									} ?>
1308 1306
 									<?php
1309 1307
 									$field['repeat']              = true;
1310
-									$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index );
1311
-									$field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields );
1308
+									$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index);
1309
+									$field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields);
1312 1310
 									$field['id']                  = str_replace(
1313
-										array( '[', ']' ),
1314
-										array( '_', '', ),
1311
+										array('[', ']'),
1312
+										array('_', '',),
1315 1313
 										$field['repeatable_field_id']
1316 1314
 									);
1317 1315
 									?>
1318
-									<?php give_render_field( $field ); ?>
1316
+									<?php give_render_field($field); ?>
1319 1317
 								<?php endforeach; ?>
1320 1318
 							</div>
1321 1319
 						</td>
1322 1320
 					</tr>
1323
-				<?php endforeach;; ?>
1321
+				<?php endforeach; ; ?>
1324 1322
 
1325
-			<?php elseif ( $add_default_donation_field ) : ?>
1323
+			<?php elseif ($add_default_donation_field) : ?>
1326 1324
 				<!--Default repeater field group-->
1327 1325
 				<tr class="give-row">
1328 1326
 					<td class="give-repeater-field-wrap give-column" colspan="2">
1329 1327
 						<div class="give-row-head give-move">
1330 1328
 							<button type="button" class="handlediv button-link">
1331 1329
 								<span class="toggle-indicator"></span></button>
1332
-							<span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-
1330
+							<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-
1333 1331
 							</span>
1334 1332
 							<h2>
1335 1333
 								<span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>
@@ -1337,25 +1335,25 @@  discard block
 block discarded – undo
1337 1335
 						</div>
1338 1336
 						<div class="give-row-body">
1339 1337
 							<?php
1340
-							foreach ( $fields['fields'] as $field ) :
1341
-								if ( ! give_is_field_callback_exist( $field ) ) {
1338
+							foreach ($fields['fields'] as $field) :
1339
+								if ( ! give_is_field_callback_exist($field)) {
1342 1340
 									continue;
1343 1341
 								}
1344 1342
 
1345 1343
 								$field['repeat']              = true;
1346
-								$field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 );
1344
+								$field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0);
1347 1345
 								$field['attributes']['value'] = apply_filters(
1348 1346
 									"give_default_field_group_field_{$field['id']}_value",
1349
-									( ! empty( $field['default'] ) ? $field['default'] : '' ),
1347
+									( ! empty($field['default']) ? $field['default'] : ''),
1350 1348
 									$field,
1351 1349
 									$fields
1352 1350
 								);
1353
-								$field['id']                  = str_replace(
1354
-									array( '[', ']' ),
1355
-									array( '_', '', ),
1351
+								$field['id'] = str_replace(
1352
+									array('[', ']'),
1353
+									array('_', '',),
1356 1354
 									$field['repeatable_field_id']
1357 1355
 								);
1358
-								give_render_field( $field );
1356
+								give_render_field($field);
1359 1357
 
1360 1358
 							endforeach;
1361 1359
 							?>
@@ -1367,9 +1365,9 @@  discard block
 block discarded – undo
1367 1365
 			<tfoot>
1368 1366
 			<tr>
1369 1367
 				<?php
1370
-				$add_row_btn_title = isset( $fields['options']['add_button'] )
1368
+				$add_row_btn_title = isset($fields['options']['add_button'])
1371 1369
 					? $add_row_btn_title = $fields['options']['add_button']
1372
-					: esc_html__( 'Add Row', 'give' );
1370
+					: esc_html__('Add Row', 'give');
1373 1371
 				?>
1374 1372
 				<td colspan="2" class="give-add-repeater-field-section-row-wrap">
1375 1373
 					<span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span>
@@ -1399,10 +1397,10 @@  discard block
 block discarded – undo
1399 1397
 	 *
1400 1398
 	 * @param string
1401 1399
 	 */
1402
-	$default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' );
1400
+	$default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general');
1403 1401
 
1404 1402
 	// Get current tab.
1405
-	$current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] );
1403
+	$current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']);
1406 1404
 
1407 1405
 	// Output.
1408 1406
 	return $current_tab;
@@ -1426,10 +1424,10 @@  discard block
 block discarded – undo
1426 1424
 	 *
1427 1425
 	 * @param string
1428 1426
 	 */
1429
-	$default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' );
1427
+	$default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", '');
1430 1428
 
1431 1429
 	// Get current section.
1432
-	$current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] );
1430
+	$current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']);
1433 1431
 
1434 1432
 	// Output.
1435 1433
 	return $current_section;
@@ -1443,7 +1441,7 @@  discard block
 block discarded – undo
1443 1441
  */
1444 1442
 function give_get_current_setting_page() {
1445 1443
 	// Get current page.
1446
-	$setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : '';
1444
+	$setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : '';
1447 1445
 
1448 1446
 	// Output.
1449 1447
 	return $setting_page;
@@ -1463,13 +1461,13 @@  discard block
 block discarded – undo
1463 1461
  *
1464 1462
  * @return string
1465 1463
  */
1466
-function _give_display_content_field_value( $field_value, $field, $postid ) {
1467
-	$show_content = give_get_meta( $postid, '_give_content_option', true );
1464
+function _give_display_content_field_value($field_value, $field, $postid) {
1465
+	$show_content = give_get_meta($postid, '_give_content_option', true);
1468 1466
 
1469 1467
 	if (
1470
-		! give_get_meta( $postid, '_give_display_content', true )
1468
+		! give_get_meta($postid, '_give_display_content', true)
1471 1469
 		&& $show_content
1472
-		&& ( 'none' !== $show_content )
1470
+		&& ('none' !== $show_content)
1473 1471
 	) {
1474 1472
 		$field_value = 'enabled';
1475 1473
 	}
@@ -1477,7 +1475,7 @@  discard block
 block discarded – undo
1477 1475
 	return $field_value;
1478 1476
 }
1479 1477
 
1480
-add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 );
1478
+add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3);
1481 1479
 
1482 1480
 
1483 1481
 /**
@@ -1494,12 +1492,12 @@  discard block
 block discarded – undo
1494 1492
  *
1495 1493
  * @return string
1496 1494
  */
1497
-function _give_content_placement_field_value( $field_value, $field, $postid ) {
1498
-	$show_content = give_get_meta( $postid, '_give_content_option', true );
1495
+function _give_content_placement_field_value($field_value, $field, $postid) {
1496
+	$show_content = give_get_meta($postid, '_give_content_option', true);
1499 1497
 
1500 1498
 	if (
1501
-		! give_get_meta( $postid, '_give_content_placement', true )
1502
-		&& ( 'none' !== $show_content )
1499
+		! give_get_meta($postid, '_give_content_placement', true)
1500
+		&& ('none' !== $show_content)
1503 1501
 	) {
1504 1502
 		$field_value = $show_content;
1505 1503
 	}
@@ -1507,7 +1505,7 @@  discard block
 block discarded – undo
1507 1505
 	return $field_value;
1508 1506
 }
1509 1507
 
1510
-add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 );
1508
+add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3);
1511 1509
 
1512 1510
 
1513 1511
 /**
@@ -1523,17 +1521,17 @@  discard block
 block discarded – undo
1523 1521
  *
1524 1522
  * @return string
1525 1523
  */
1526
-function _give_terms_option_field_value( $field_value, $field, $postid ) {
1527
-	$term_option = give_get_meta( $postid, '_give_terms_option', true );
1524
+function _give_terms_option_field_value($field_value, $field, $postid) {
1525
+	$term_option = give_get_meta($postid, '_give_terms_option', true);
1528 1526
 
1529
-	if ( in_array( $term_option, array( 'none', 'yes' ) ) ) {
1530
-		$field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' );
1527
+	if (in_array($term_option, array('none', 'yes'))) {
1528
+		$field_value = ('yes' === $term_option ? 'enabled' : 'disabled');
1531 1529
 	}
1532 1530
 
1533 1531
 	return $field_value;
1534 1532
 }
1535 1533
 
1536
-add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 );
1534
+add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3);
1537 1535
 
1538 1536
 
1539 1537
 /**
@@ -1550,17 +1548,17 @@  discard block
 block discarded – undo
1550 1548
  *
1551 1549
  * @return string
1552 1550
  */
1553
-function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) {
1554
-	$offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true );
1551
+function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) {
1552
+	$offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true);
1555 1553
 
1556
-	if ( 'on' === $offline_donation ) {
1554
+	if ('on' === $offline_donation) {
1557 1555
 		$field_value = 'enabled';
1558 1556
 	}
1559 1557
 
1560 1558
 	return $field_value;
1561 1559
 }
1562 1560
 
1563
-add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 );
1561
+add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3);
1564 1562
 
1565 1563
 
1566 1564
 /**
@@ -1576,17 +1574,17 @@  discard block
 block discarded – undo
1576 1574
  *
1577 1575
  * @return string
1578 1576
  */
1579
-function _give_custom_amount_field_value( $field_value, $field, $postid ) {
1580
-	$custom_amount = give_get_meta( $postid, '_give_custom_amount', true );
1577
+function _give_custom_amount_field_value($field_value, $field, $postid) {
1578
+	$custom_amount = give_get_meta($postid, '_give_custom_amount', true);
1581 1579
 
1582
-	if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) {
1583
-		$field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' );
1580
+	if (in_array($custom_amount, array('yes', 'no'))) {
1581
+		$field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled');
1584 1582
 	}
1585 1583
 
1586 1584
 	return $field_value;
1587 1585
 }
1588 1586
 
1589
-add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 );
1587
+add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3);
1590 1588
 
1591 1589
 
1592 1590
 /**
@@ -1602,17 +1600,17 @@  discard block
 block discarded – undo
1602 1600
  *
1603 1601
  * @return string
1604 1602
  */
1605
-function _give_goal_option_field_value( $field_value, $field, $postid ) {
1606
-	$goal_option = give_get_meta( $postid, '_give_goal_option', true );
1603
+function _give_goal_option_field_value($field_value, $field, $postid) {
1604
+	$goal_option = give_get_meta($postid, '_give_goal_option', true);
1607 1605
 
1608
-	if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) {
1609
-		$field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' );
1606
+	if (in_array($goal_option, array('yes', 'no'))) {
1607
+		$field_value = ('yes' === $goal_option ? 'enabled' : 'disabled');
1610 1608
 	}
1611 1609
 
1612 1610
 	return $field_value;
1613 1611
 }
1614 1612
 
1615
-add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 );
1613
+add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3);
1616 1614
 
1617 1615
 /**
1618 1616
  * Set value for Donation Goal --> close Form.
@@ -1628,17 +1626,17 @@  discard block
 block discarded – undo
1628 1626
  *
1629 1627
  * @return string
1630 1628
  */
1631
-function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) {
1632
-	$close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true );
1629
+function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) {
1630
+	$close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true);
1633 1631
 
1634
-	if ( in_array( $close_form, array( 'yes', 'no' ) ) ) {
1635
-		$field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' );
1632
+	if (in_array($close_form, array('yes', 'no'))) {
1633
+		$field_value = ('yes' === $close_form ? 'enabled' : 'disabled');
1636 1634
 	}
1637 1635
 
1638 1636
 	return $field_value;
1639 1637
 }
1640 1638
 
1641
-add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 );
1639
+add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3);
1642 1640
 
1643 1641
 
1644 1642
 /**
@@ -1654,17 +1652,17 @@  discard block
 block discarded – undo
1654 1652
  *
1655 1653
  * @return string
1656 1654
  */
1657
-function _give_logged_in_only_value( $field_value, $field, $postid ) {
1658
-	$guest_donation = give_get_meta( $postid, '_give_logged_in_only', true );
1655
+function _give_logged_in_only_value($field_value, $field, $postid) {
1656
+	$guest_donation = give_get_meta($postid, '_give_logged_in_only', true);
1659 1657
 
1660
-	if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) {
1661
-		$field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' );
1658
+	if (in_array($guest_donation, array('yes', 'no'))) {
1659
+		$field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled');
1662 1660
 	}
1663 1661
 
1664 1662
 	return $field_value;
1665 1663
 }
1666 1664
 
1667
-add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 );
1665
+add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3);
1668 1666
 
1669 1667
 /**
1670 1668
  * Set value for Offline Donations --> Offline Donations.
@@ -1680,17 +1678,17 @@  discard block
 block discarded – undo
1680 1678
  *
1681 1679
  * @return string
1682 1680
  */
1683
-function _give_customize_offline_donations_value( $field_value, $field, $postid ) {
1684
-	$customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true );
1681
+function _give_customize_offline_donations_value($field_value, $field, $postid) {
1682
+	$customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true);
1685 1683
 
1686
-	if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) {
1687
-		$field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' );
1684
+	if (in_array($customize_offline_text, array('yes', 'no'))) {
1685
+		$field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled');
1688 1686
 	}
1689 1687
 
1690 1688
 	return $field_value;
1691 1689
 }
1692 1690
 
1693
-add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 );
1691
+add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3);
1694 1692
 
1695 1693
 
1696 1694
 /**
@@ -1705,14 +1703,14 @@  discard block
 block discarded – undo
1705 1703
  *
1706 1704
  * @return mixed
1707 1705
  */
1708
-function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) {
1706
+function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) {
1709 1707
 	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}';
1710 1708
 	$field_id        = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]";
1711 1709
 
1712 1710
 	return $field_id;
1713 1711
 }
1714 1712
 
1715
-add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 );
1713
+add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4);
1716 1714
 
1717 1715
 /**
1718 1716
  * Set repeater field value for multi donation form.
@@ -1726,13 +1724,13 @@  discard block
 block discarded – undo
1726 1724
  *
1727 1725
  * @return mixed
1728 1726
  */
1729
-function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) {
1730
-	$field_value = $field_group[ $field['id'] ]['level_id'];
1727
+function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) {
1728
+	$field_value = $field_group[$field['id']]['level_id'];
1731 1729
 
1732 1730
 	return $field_value;
1733 1731
 }
1734 1732
 
1735
-add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 );
1733
+add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4);
1736 1734
 
1737 1735
 /**
1738 1736
  * Set default value for _give_id field.
@@ -1743,11 +1741,11 @@  discard block
 block discarded – undo
1743 1741
  *
1744 1742
  * @return string
1745 1743
  */
1746
-function _give_set_field_give_id_default_value( $field ) {
1744
+function _give_set_field_give_id_default_value($field) {
1747 1745
 	return 0;
1748 1746
 }
1749 1747
 
1750
-add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' );
1748
+add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value');
1751 1749
 
1752 1750
 /**
1753 1751
  * Set default value for _give_default field.
@@ -1758,11 +1756,11 @@  discard block
 block discarded – undo
1758 1756
  *
1759 1757
  * @return string
1760 1758
  */
1761
-function _give_set_field_give_default_default_value( $field ) {
1759
+function _give_set_field_give_default_default_value($field) {
1762 1760
 	return 'default';
1763 1761
 }
1764 1762
 
1765
-add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' );
1763
+add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value');
1766 1764
 
1767 1765
 /**
1768 1766
  * Set repeater field editor id for field type wysiwyg.
@@ -1774,15 +1772,15 @@  discard block
 block discarded – undo
1774 1772
  *
1775 1773
  * @return string
1776 1774
  */
1777
-function give_repeater_field_set_editor_id( $field_name, $field ) {
1778
-	if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) {
1779
-		$field_name = '_give_repeater_' . uniqid() . '_wysiwyg';
1775
+function give_repeater_field_set_editor_id($field_name, $field) {
1776
+	if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) {
1777
+		$field_name = '_give_repeater_'.uniqid().'_wysiwyg';
1780 1778
 	}
1781 1779
 
1782 1780
 	return $field_name;
1783 1781
 }
1784 1782
 
1785
-add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 );
1783
+add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2);
1786 1784
 
1787 1785
 /**
1788 1786
  * Output Donation form radio input box.
@@ -1807,45 +1805,45 @@  discard block
 block discarded – undo
1807 1805
  * }
1808 1806
  * @return void
1809 1807
  */
1810
-function give_donation_form_goal( $field ) {
1808
+function give_donation_form_goal($field) {
1811 1809
 	global $thepostid, $post;
1812 1810
 
1813
-	$thepostid              = empty( $thepostid ) ? $post->ID : $thepostid;
1814
-	$field['style']         = isset( $field['style'] ) ? $field['style'] : '';
1815
-	$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
1816
-	$field['value']         = give_get_field_value( $field, $thepostid );
1817
-	$field['name']          = isset( $field['name'] ) ? $field['name'] : $field['id'];
1811
+	$thepostid              = empty($thepostid) ? $post->ID : $thepostid;
1812
+	$field['style']         = isset($field['style']) ? $field['style'] : '';
1813
+	$field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
1814
+	$field['value']         = give_get_field_value($field, $thepostid);
1815
+	$field['name']          = isset($field['name']) ? $field['name'] : $field['id'];
1818 1816
 
1819 1817
 
1820 1818
 	printf(
1821 1819
 		'<fieldset class="give-field-wrap %s_field %s">',
1822
-		esc_attr( $field['id'] ),
1823
-		esc_attr( $field['wrapper_class'] )
1820
+		esc_attr($field['id']),
1821
+		esc_attr($field['wrapper_class'])
1824 1822
 	);
1825 1823
 
1826 1824
 	printf(
1827 1825
 		'<span class="give-field-label">%s</span>',
1828
-		esc_html( $field['name'] )
1826
+		esc_html($field['name'])
1829 1827
 	);
1830 1828
 
1831 1829
 	printf(
1832 1830
 		'<legend class="screen-reader-text">%s</legend>',
1833
-		esc_html( $field['name'] )
1831
+		esc_html($field['name'])
1834 1832
 	);
1835 1833
 	?>
1836 1834
 
1837 1835
     <ul class="give-radios">
1838 1836
 		<?php
1839
-		foreach ( $field['options'] as $key => $value ) {
1840
-			$attributes = empty( $field['attributes'] ) ? '' : give_get_attribute_str( $field['attributes'] );
1837
+		foreach ($field['options'] as $key => $value) {
1838
+			$attributes = empty($field['attributes']) ? '' : give_get_attribute_str($field['attributes']);
1841 1839
 			printf(
1842 1840
 				'<li><label><input name="%s" value="%s" type="radio" style="%s" %s %s /> %s </label></li>',
1843
-				give_get_field_name( $field ),
1844
-				esc_attr( $key ),
1845
-				esc_attr( $field['style'] ),
1846
-				checked( esc_attr( $field['value'] ), esc_attr( $key ), false ),
1841
+				give_get_field_name($field),
1842
+				esc_attr($key),
1843
+				esc_attr($field['style']),
1844
+				checked(esc_attr($field['value']), esc_attr($key), false),
1847 1845
 				$attributes,
1848
-				esc_html( $value )
1846
+				esc_html($value)
1849 1847
 			);
1850 1848
 		}
1851 1849
 		?>
@@ -1859,9 +1857,9 @@  discard block
 block discarded – undo
1859 1857
 	 *
1860 1858
 	 * @param array $field Array of radio field arguments.
1861 1859
 	 */
1862
-	do_action( 'give_donation_form_goal_before_description', $field );
1860
+	do_action('give_donation_form_goal_before_description', $field);
1863 1861
 
1864
-	echo give_get_field_description( $field );
1862
+	echo give_get_field_description($field);
1865 1863
 
1866 1864
 	echo '</fieldset>';
1867 1865
 }
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.6.3
567 567
  *
568
- * @param $pending_reason
568
+ * @param string $pending_reason
569 569
  *
570 570
  * @return string
571 571
  */
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
  * @param int   $payment_id   Payment ID
643 643
  * @param array $payment_data Array of payment data.
644 644
  *
645
- * @return mixed|string
645
+ * @return string
646 646
  */
647 647
 function give_build_paypal_url( $payment_id, $payment_data ) {
648 648
 	// Only send to PayPal if the pending payment is created successfully.
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
  *
23 23
  * @return bool
24 24
  */
25
-function give_paypal_standard_billing_fields( $form_id ) {
25
+function give_paypal_standard_billing_fields($form_id) {
26 26
 
27
-	if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) {
28
-		give_default_cc_address_fields( $form_id );
27
+	if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) {
28
+		give_default_cc_address_fields($form_id);
29 29
 
30 30
 		return true;
31 31
 	}
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 }
36 36
 
37
-add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' );
37
+add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields');
38 38
 
39 39
 /**
40 40
  * Process PayPal Payment.
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
  *
46 46
  * @return void
47 47
  */
48
-function give_process_paypal_payment( $payment_data ) {
48
+function give_process_paypal_payment($payment_data) {
49 49
 
50 50
 	// Validate nonce.
51
-	give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' );
51
+	give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway');
52 52
 
53
-	$payment_id = give_create_payment( $payment_data );
53
+	$payment_id = give_create_payment($payment_data);
54 54
 
55 55
 	// Check payment.
56
-	if ( empty( $payment_id ) ) {
56
+	if (empty($payment_id)) {
57 57
 		// Record the error.
58
-		give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */
59
-			__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id );
58
+		give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */
59
+			__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id);
60 60
 		// Problems? Send back.
61
-		give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] );
61
+		give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']);
62 62
 	}
63 63
 
64 64
 	// Redirect to PayPal.
65
-	wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) );
65
+	wp_redirect(give_build_paypal_url($payment_id, $payment_data));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_gateway_paypal', 'give_process_paypal_payment' );
69
+add_action('give_gateway_paypal', 'give_process_paypal_payment');
70 70
 
71 71
 /**
72 72
  * Listens for a PayPal IPN requests and then sends to the processing function.
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
 function give_listen_for_paypal_ipn() {
78 78
 
79 79
 	// Regular PayPal IPN.
80
-	if ( isset( $_GET['give-listener'] ) && 'IPN' === $_GET['give-listener'] ) {
80
+	if (isset($_GET['give-listener']) && 'IPN' === $_GET['give-listener']) {
81 81
 		/**
82 82
 		 * Fires while verifying PayPal IPN
83 83
 		 *
84 84
 		 * @since 1.0
85 85
 		 */
86
-		do_action( 'give_verify_paypal_ipn' );
86
+		do_action('give_verify_paypal_ipn');
87 87
 	}
88 88
 }
89 89
 
90
-add_action( 'init', 'give_listen_for_paypal_ipn' );
90
+add_action('init', 'give_listen_for_paypal_ipn');
91 91
 
92 92
 /**
93 93
  * Process PayPal IPN
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 function give_process_paypal_ipn() {
99 99
 
100 100
 	// Check the request method is POST.
101
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
101
+	if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) {
102 102
 		return;
103 103
 	}
104 104
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 	$post_data = '';
107 107
 
108 108
 	// Fallback just in case post_max_size is lower than needed.
109
-	if ( ini_get( 'allow_url_fopen' ) ) {
110
-		$post_data = file_get_contents( 'php://input' );
109
+	if (ini_get('allow_url_fopen')) {
110
+		$post_data = file_get_contents('php://input');
111 111
 	} else {
112 112
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough.
113
-		ini_set( 'post_max_size', '12M' );
113
+		ini_set('post_max_size', '12M');
114 114
 	}
115 115
 	// Start the encoded data collection with notification command.
116 116
 	$encoded_data = 'cmd=_notify-validate';
@@ -119,41 +119,41 @@  discard block
 block discarded – undo
119 119
 	$arg_separator = give_get_php_arg_separator_output();
120 120
 
121 121
 	// Verify there is a post_data.
122
-	if ( $post_data || strlen( $post_data ) > 0 ) {
122
+	if ($post_data || strlen($post_data) > 0) {
123 123
 		// Append the data.
124
-		$encoded_data .= $arg_separator . $post_data;
124
+		$encoded_data .= $arg_separator.$post_data;
125 125
 	} else {
126 126
 		// Check if POST is empty.
127
-		if ( empty( $_POST ) ) {
127
+		if (empty($_POST)) {
128 128
 			// Nothing to do.
129 129
 			return;
130 130
 		} else {
131 131
 			// Loop through each POST.
132
-			foreach ( $_POST as $key => $value ) {
132
+			foreach ($_POST as $key => $value) {
133 133
 				// Encode the value and append the data.
134
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
134
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
135 135
 			}
136 136
 		}
137 137
 	}
138 138
 
139 139
 	// Convert collected post data to an array.
140
-	parse_str( $encoded_data, $encoded_data_array );
140
+	parse_str($encoded_data, $encoded_data_array);
141 141
 
142
-	foreach ( $encoded_data_array as $key => $value ) {
142
+	foreach ($encoded_data_array as $key => $value) {
143 143
 
144
-		if ( false !== strpos( $key, 'amp;' ) ) {
145
-			$new_key = str_replace( '&amp;', '&', $key );
146
-			$new_key = str_replace( 'amp;', '&', $new_key );
144
+		if (false !== strpos($key, 'amp;')) {
145
+			$new_key = str_replace('&amp;', '&', $key);
146
+			$new_key = str_replace('amp;', '&', $new_key);
147 147
 
148
-			unset( $encoded_data_array[ $key ] );
149
-			$encoded_data_array[ $new_key ] = $value;
148
+			unset($encoded_data_array[$key]);
149
+			$encoded_data_array[$new_key] = $value;
150 150
 		}
151 151
 	}
152 152
 
153 153
 	$api_response = false;
154 154
 
155 155
 	// Validate IPN request w/ PayPal if user hasn't disabled this security measure.
156
-	if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) {
156
+	if (give_is_setting_enabled(give_get_option('paypal_verification'))) {
157 157
 
158 158
 		$remote_post_vars = array(
159 159
 			'method'      => 'POST',
@@ -173,25 +173,25 @@  discard block
 block discarded – undo
173 173
 		);
174 174
 
175 175
 		// Validate the IPN.
176
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
176
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
177 177
 
178
-		if ( is_wp_error( $api_response ) ) {
179
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
180
-				__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
178
+		if (is_wp_error($api_response)) {
179
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
180
+				__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
181 181
 
182 182
 			return; // Something went wrong.
183 183
 		}
184 184
 
185
-		if ( 'VERIFIED' !== $api_response['body'] ) {
186
-			give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
187
-				__( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) );
185
+		if ('VERIFIED' !== $api_response['body']) {
186
+			give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
187
+				__('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) ));
188 188
 
189 189
 			return; // Response not okay.
190 190
 		}
191 191
 	}// End if().
192 192
 
193 193
 	// Check if $post_data_array has been populated.
194
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
194
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
195 195
 		return;
196 196
 	}
197 197
 
@@ -200,28 +200,28 @@  discard block
 block discarded – undo
200 200
 		'payment_status' => '',
201 201
 	);
202 202
 
203
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
203
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
204 204
 
205
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
205
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
206 206
 	$txn_type   = $encoded_data_array['txn_type'];
207 207
 
208 208
 	// Check for PayPal IPN Notifications and update data based on it.
209
-	$current_timestamp = current_time( 'timestamp' );
209
+	$current_timestamp = current_time('timestamp');
210 210
 	$paypal_ipn_vars   = array(
211
-		'auth_status'    => isset( $api_response['body'] ) ? $api_response['body'] : 'N/A',
212
-		'transaction_id' => isset( $encoded_data_array['txn_id'] ) ? $encoded_data_array['txn_id'] : 'N/A',
211
+		'auth_status'    => isset($api_response['body']) ? $api_response['body'] : 'N/A',
212
+		'transaction_id' => isset($encoded_data_array['txn_id']) ? $encoded_data_array['txn_id'] : 'N/A',
213 213
 		'payment_id'     => $payment_id,
214 214
 	);
215
-	update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars, false );
216
-	give_insert_payment_note( $payment_id, sprintf(
217
-			__( 'IPN received on %s at %s', 'give' ),
218
-			date_i18n( 'm/d/Y', $current_timestamp ),
219
-			date_i18n( 'H:i', $current_timestamp )
215
+	update_option('give_last_paypal_ipn_received', $paypal_ipn_vars, false);
216
+	give_insert_payment_note($payment_id, sprintf(
217
+			__('IPN received on %s at %s', 'give'),
218
+			date_i18n('m/d/Y', $current_timestamp),
219
+			date_i18n('H:i', $current_timestamp)
220 220
 		)
221 221
 	);
222
-	give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp );
222
+	give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp);
223 223
 
224
-	if ( has_action( 'give_paypal_' . $txn_type ) ) {
224
+	if (has_action('give_paypal_'.$txn_type)) {
225 225
 		/**
226 226
 		 * Fires while processing PayPal IPN $txn_type.
227 227
 		 *
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		 * @param array $encoded_data_array Encoded data.
233 233
 		 * @param int   $payment_id         Payment id.
234 234
 		 */
235
-		do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id );
235
+		do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id);
236 236
 	} else {
237 237
 		/**
238 238
 		 * Fires while process PayPal IPN.
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 		 * @param array $encoded_data_array Encoded data.
245 245
 		 * @param int   $payment_id         Payment id.
246 246
 		 */
247
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
247
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
248 248
 	}
249 249
 	exit;
250 250
 }
251 251
 
252
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
252
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
253 253
 
254 254
 /**
255 255
  * Process web accept (one time) payment IPNs.
@@ -261,99 +261,99 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return void
263 263
  */
264
-function give_process_paypal_web_accept( $data, $payment_id ) {
264
+function give_process_paypal_web_accept($data, $payment_id) {
265 265
 
266 266
 	// Only allow through these transaction types.
267
-	if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) {
267
+	if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) {
268 268
 		return;
269 269
 	}
270 270
 
271 271
 	// Need $payment_id to continue.
272
-	if ( empty( $payment_id ) ) {
272
+	if (empty($payment_id)) {
273 273
 		return;
274 274
 	}
275 275
 
276 276
 	// Collect donation payment details.
277 277
 	$paypal_amount  = $data['mc_gross'];
278
-	$payment_status = strtolower( $data['payment_status'] );
279
-	$currency_code  = strtolower( $data['mc_currency'] );
280
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
281
-	$payment_meta   = give_get_payment_meta( $payment_id );
278
+	$payment_status = strtolower($data['payment_status']);
279
+	$currency_code  = strtolower($data['mc_currency']);
280
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
281
+	$payment_meta   = give_get_payment_meta($payment_id);
282 282
 
283 283
 	// Must be a PayPal standard IPN.
284
-	if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) {
284
+	if ('paypal' !== give_get_payment_gateway($payment_id)) {
285 285
 		return;
286 286
 	}
287 287
 
288 288
 	// Verify payment recipient.
289
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) {
289
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) {
290 290
 
291
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
292
-			__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
293
-		give_update_payment_status( $payment_id, 'failed' );
294
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) );
291
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
292
+			__('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
293
+		give_update_payment_status($payment_id, 'failed');
294
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give'));
295 295
 
296 296
 		return;
297 297
 	}
298 298
 
299 299
 	// Verify payment currency.
300
-	if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) {
300
+	if ($currency_code !== strtolower($payment_meta['currency'])) {
301 301
 
302
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
303
-			__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
304
-		give_update_payment_status( $payment_id, 'failed' );
305
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
302
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
303
+			__('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
304
+		give_update_payment_status($payment_id, 'failed');
305
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give'));
306 306
 
307 307
 		return;
308 308
 	}
309 309
 
310 310
 	// Process refunds & reversed.
311
-	if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) {
312
-		give_process_paypal_refund( $data, $payment_id );
311
+	if ('refunded' === $payment_status || 'reversed' === $payment_status) {
312
+		give_process_paypal_refund($data, $payment_id);
313 313
 
314 314
 		return;
315 315
 	}
316 316
 
317 317
 	// Only complete payments once.
318
-	if ( 'publish' === get_post_status( $payment_id ) ) {
318
+	if ('publish' === get_post_status($payment_id)) {
319 319
 		return;
320 320
 	}
321 321
 
322 322
 	// Retrieve the total donation amount (before PayPal).
323
-	$payment_amount = give_donation_amount( $payment_id );
323
+	$payment_amount = give_donation_amount($payment_id);
324 324
 
325 325
 	// Check that the donation PP and local db amounts match.
326
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
326
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
327 327
 		// The prices don't match
328
-		give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */
329
-			__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id );
330
-		give_update_payment_status( $payment_id, 'failed' );
331
-		give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
328
+		give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */
329
+			__('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id);
330
+		give_update_payment_status($payment_id, 'failed');
331
+		give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give'));
332 332
 
333 333
 		return;
334 334
 	}
335 335
 
336 336
 	// Process completed donations.
337
-	if ( 'completed' === $payment_status || give_is_test_mode() ) {
337
+	if ('completed' === $payment_status || give_is_test_mode()) {
338 338
 
339
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
340
-			__( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) );
341
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
342
-		give_update_payment_status( $payment_id, 'publish' );
339
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
340
+			__('PayPal Transaction ID: %s', 'give'), $data['txn_id'] ));
341
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
342
+		give_update_payment_status($payment_id, 'publish');
343 343
 
344
-	} elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) {
344
+	} elseif ('pending' === $payment_status && isset($data['pending_reason'])) {
345 345
 
346 346
 		// Look for possible pending reasons, such as an echeck.
347
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
347
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
348 348
 
349
-		if ( ! empty( $note ) ) {
350
-			give_insert_payment_note( $payment_id, $note );
349
+		if ( ! empty($note)) {
350
+			give_insert_payment_note($payment_id, $note);
351 351
 		}
352 352
 	}
353 353
 
354 354
 }
355 355
 
356
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 );
356
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2);
357 357
 
358 358
 /**
359 359
  * Process PayPal IPN Refunds
@@ -365,35 +365,35 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return void
367 367
  */
368
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
368
+function give_process_paypal_refund($data, $payment_id = 0) {
369 369
 
370 370
 	// Collect payment details.
371
-	if ( empty( $payment_id ) ) {
371
+	if (empty($payment_id)) {
372 372
 		return;
373 373
 	}
374 374
 
375 375
 	// Only refund payments once.
376
-	if ( 'refunded' === get_post_status( $payment_id ) ) {
376
+	if ('refunded' === get_post_status($payment_id)) {
377 377
 		return;
378 378
 	}
379 379
 
380
-	$payment_amount = give_donation_amount( $payment_id );
380
+	$payment_amount = give_donation_amount($payment_id);
381 381
 	$refund_amount  = $data['payment_gross'] * - 1;
382 382
 
383
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
383
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
384 384
 
385
-		give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
386
-			__( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) );
385
+		give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */
386
+			__('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] ));
387 387
 
388 388
 		return; // This is a partial refund
389 389
 
390 390
 	}
391 391
 
392
-	give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
393
-		__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) );
394
-	give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */
395
-		__( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) );
396
-	give_update_payment_status( $payment_id, 'refunded' );
392
+	give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */
393
+		__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] ));
394
+	give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */
395
+		__('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] ));
396
+	give_update_payment_status($payment_id, 'refunded');
397 397
 }
398 398
 
399 399
 /**
@@ -405,24 +405,24 @@  discard block
 block discarded – undo
405 405
  *
406 406
  * @return string
407 407
  */
408
-function give_get_paypal_redirect( $ssl_check = false ) {
408
+function give_get_paypal_redirect($ssl_check = false) {
409 409
 
410
-	if ( is_ssl() || ! $ssl_check ) {
410
+	if (is_ssl() || ! $ssl_check) {
411 411
 		$protocol = 'https://';
412 412
 	} else {
413 413
 		$protocol = 'http://';
414 414
 	}
415 415
 
416 416
 	// Check the current payment mode
417
-	if ( give_is_test_mode() ) {
417
+	if (give_is_test_mode()) {
418 418
 		// Test mode
419
-		$paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr';
419
+		$paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr';
420 420
 	} else {
421 421
 		// Live mode
422
-		$paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr';
422
+		$paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr';
423 423
 	}
424 424
 
425
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
425
+	return apply_filters('give_paypal_uri', $paypal_uri);
426 426
 }
427 427
 
428 428
 /**
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
  * @return string
433 433
  */
434 434
 function give_get_paypal_page_style() {
435
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
435
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
436 436
 
437
-	return apply_filters( 'give_paypal_page_style', $page_style );
437
+	return apply_filters('give_paypal_page_style', $page_style);
438 438
 }
439 439
 
440 440
 /**
@@ -448,26 +448,26 @@  discard block
 block discarded – undo
448 448
  *
449 449
  * @return string
450 450
  */
451
-function give_paypal_success_page_content( $content ) {
451
+function give_paypal_success_page_content($content) {
452 452
 
453
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
453
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
454 454
 		return $content;
455 455
 	}
456 456
 
457
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
457
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
458 458
 
459
-	if ( ! $payment_id ) {
459
+	if ( ! $payment_id) {
460 460
 		$session    = give_get_purchase_session();
461
-		$payment_id = give_get_donation_id_by_key( $session['purchase_key'] );
461
+		$payment_id = give_get_donation_id_by_key($session['purchase_key']);
462 462
 	}
463 463
 
464
-	$payment = get_post( $payment_id );
465
-	if ( $payment && 'pending' === $payment->post_status ) {
464
+	$payment = get_post($payment_id);
465
+	if ($payment && 'pending' === $payment->post_status) {
466 466
 
467 467
 		// Payment is still pending so show processing indicator to fix the race condition.
468 468
 		ob_start();
469 469
 
470
-		give_get_template_part( 'payment', 'processing' );
470
+		give_get_template_part('payment', 'processing');
471 471
 
472 472
 		$content = ob_get_clean();
473 473
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
 }
479 479
 
480
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
480
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
481 481
 
482 482
 /**
483 483
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @return string                 A link to the PayPal transaction details
491 491
  */
492
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
492
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
493 493
 
494 494
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
495
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
495
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
496 496
 
497
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
497
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
498 498
 
499 499
 }
500 500
 
501
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
501
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
502 502
 
503 503
 
504 504
 /**
@@ -510,64 +510,64 @@  discard block
 block discarded – undo
510 510
  *
511 511
  * @return string
512 512
  */
513
-function give_paypal_get_pending_donation_note( $pending_reason ) {
513
+function give_paypal_get_pending_donation_note($pending_reason) {
514 514
 
515 515
 	$note = '';
516 516
 
517
-	switch ( $pending_reason ) {
517
+	switch ($pending_reason) {
518 518
 
519 519
 		case 'echeck' :
520 520
 
521
-			$note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
521
+			$note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
522 522
 
523 523
 			break;
524 524
 
525 525
 		case 'address' :
526 526
 
527
-			$note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
527
+			$note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
528 528
 
529 529
 			break;
530 530
 
531 531
 		case 'intl' :
532 532
 
533
-			$note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
533
+			$note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
534 534
 
535 535
 			break;
536 536
 
537 537
 		case 'multi-currency' :
538 538
 
539
-			$note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
539
+			$note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
540 540
 
541 541
 			break;
542 542
 
543 543
 		case 'paymentreview' :
544 544
 		case 'regulatory_review' :
545 545
 
546
-			$note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
546
+			$note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
547 547
 
548 548
 			break;
549 549
 
550 550
 		case 'unilateral' :
551 551
 
552
-			$note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
552
+			$note = __('Payment was sent to non-confirmed or non-registered email address.', 'give');
553 553
 
554 554
 			break;
555 555
 
556 556
 		case 'upgrade' :
557 557
 
558
-			$note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
558
+			$note = __('PayPal account must be upgraded before this payment can be accepted.', 'give');
559 559
 
560 560
 			break;
561 561
 
562 562
 		case 'verify' :
563 563
 
564
-			$note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
564
+			$note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
565 565
 
566 566
 			break;
567 567
 
568 568
 		case 'other' :
569 569
 
570
-			$note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
570
+			$note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
571 571
 
572 572
 			break;
573 573
 
@@ -585,49 +585,49 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return mixed|string
587 587
  */
588
-function give_build_paypal_url( $payment_id, $payment_data ) {
588
+function give_build_paypal_url($payment_id, $payment_data) {
589 589
 	// Only send to PayPal if the pending payment is created successfully.
590
-	$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
590
+	$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
591 591
 
592 592
 	// Get the success url.
593
-	$return_url = add_query_arg( array(
593
+	$return_url = add_query_arg(array(
594 594
 		'payment-confirmation' => 'paypal',
595 595
 		'payment-id'           => $payment_id,
596 596
 
597
-	), get_permalink( give_get_option( 'success_page' ) ) );
597
+	), get_permalink(give_get_option('success_page')));
598 598
 
599 599
 	// Get the PayPal redirect uri.
600
-	$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
600
+	$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
601 601
 
602 602
 	// Item name.
603
-	$item_name = give_payment_gateway_item_title( $payment_data );
603
+	$item_name = give_payment_gateway_item_title($payment_data);
604 604
 
605 605
 	// Setup PayPal API params.
606 606
 	$paypal_args = array(
607
-		'business'      => give_get_option( 'paypal_email', false ),
607
+		'business'      => give_get_option('paypal_email', false),
608 608
 		'first_name'    => $payment_data['user_info']['first_name'],
609 609
 		'last_name'     => $payment_data['user_info']['last_name'],
610 610
 		'email'         => $payment_data['user_email'],
611 611
 		'invoice'       => $payment_data['purchase_key'],
612 612
 		'amount'        => $payment_data['price'],
613
-		'item_name'     => stripslashes( $item_name ),
613
+		'item_name'     => stripslashes($item_name),
614 614
 		'no_shipping'   => '1',
615 615
 		'shipping'      => '0',
616 616
 		'no_note'       => '1',
617
-		'currency_code' => give_get_currency( $payment_id, $payment_data ),
618
-		'charset'       => get_bloginfo( 'charset' ),
617
+		'currency_code' => give_get_currency($payment_id, $payment_data),
618
+		'charset'       => get_bloginfo('charset'),
619 619
 		'custom'        => $payment_id,
620 620
 		'rm'            => '2',
621 621
 		'return'        => $return_url,
622
-		'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
622
+		'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
623 623
 		'notify_url'    => $listener_url,
624 624
 		'page_style'    => give_get_paypal_page_style(),
625
-		'cbt'           => get_bloginfo( 'name' ),
625
+		'cbt'           => get_bloginfo('name'),
626 626
 		'bn'            => 'givewp_SP',
627 627
 	);
628 628
 
629 629
 	// Add user address if present.
630
-	if ( ! empty( $payment_data['user_info']['address'] ) ) {
630
+	if ( ! empty($payment_data['user_info']['address'])) {
631 631
 		$default_address = array(
632 632
 			'line1'   => '',
633 633
 			'line2'   => '',
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 			'country' => '',
638 638
 		);
639 639
 
640
-		$address = wp_parse_args( $payment_data['user_info']['address'], $default_address );
640
+		$address = wp_parse_args($payment_data['user_info']['address'], $default_address);
641 641
 
642 642
 		$paypal_args['address1'] = $address['line1'];
643 643
 		$paypal_args['address2'] = $address['line2'];
@@ -658,13 +658,13 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @since 1.8
660 660
 	 */
661
-	$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data );
661
+	$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data);
662 662
 
663 663
 	// Build query.
664
-	$paypal_redirect .= http_build_query( $paypal_args );
664
+	$paypal_redirect .= http_build_query($paypal_args);
665 665
 
666 666
 	// Fix for some sites that encode the entities.
667
-	$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
667
+	$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
668 668
 
669 669
 	return $paypal_redirect;
670 670
 }
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 function give_get_paypal_button_type() {
680 680
 	// paypal_button_type can be donation or standard.
681 681
 	$paypal_button_type = '_donations';
682
-	if ( 'standard' === give_get_option( 'paypal_button_type' ) ) {
682
+	if ('standard' === give_get_option('paypal_button_type')) {
683 683
 		$paypal_button_type = '_xclick';
684 684
 	}
685 685
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-addon.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Addon' ) ) :
16
+if ( ! class_exists('Give_Settings_Addon')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Addon.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		 */
27 27
 		public function __construct() {
28 28
 			$this->id    = 'addons';
29
-			$this->label = esc_html__( 'Add-ons', 'give' );
29
+			$this->label = esc_html__('Add-ons', 'give');
30 30
 
31 31
 			parent::__construct();
32 32
 		}
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 		 * @param  $setting_tab
39 39
 		 * @return string
40 40
 		 */
41
-		function set_default_setting_tab( $setting_tab ) {
41
+		function set_default_setting_tab($setting_tab) {
42 42
 			$default_tab = '';
43 43
 
44 44
 			// Set default tab to first setting tab.
45
-			if( $sections = array_keys( $this->get_sections() ) ) {
46
-				$default_tab = current( $sections );
45
+			if ($sections = array_keys($this->get_sections())) {
46
+				$default_tab = current($sections);
47 47
 			}
48 48
 			return $default_tab;
49 49
 		}
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 		 * @param  array $pages Lst of pages.
56 56
 		 * @return array
57 57
 		 */
58
-		public function add_settings_page( $pages ) {
58
+		public function add_settings_page($pages) {
59 59
 			$setting = $this->get_settings();
60 60
 			// Bailout: Do not add addons setting tab if it does not contain any setting fields.
61
-			if( ! empty( $setting ) ) {
62
-				$pages[ $this->id ] = $this->label;
61
+			if ( ! empty($setting)) {
62
+				$pages[$this->id] = $this->label;
63 63
 			}
64 64
 
65 65
 			return $pages;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			 * Filter the addons settings.
79 79
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
80 80
 			 */
81
-			$settings = apply_filters( 'give_settings_addons', $settings );
81
+			$settings = apply_filters('give_settings_addons', $settings);
82 82
 
83 83
 			/**
84 84
 			 * Filter the settings.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @since  1.8
87 87
 			 * @param  array $settings
88 88
 			 */
89
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
89
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
90 90
 
91 91
 			// Output.
92 92
 			return $settings;
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_add_shortcode_to_publish_metabox() {
24 24
 
25
-	if ( 'give_forms' !== get_post_type() ) {
25
+	if ('give_forms' !== get_post_type()) {
26 26
 		return false;
27 27
 	}
28 28
 	global $post;
29 29
 
30 30
 	//Only enqueue scripts for CPT on post type screen
31
-	if ( 'give_forms' === $post->post_type ) {
31
+	if ('give_forms' === $post->post_type) {
32 32
 		//Shortcode column with select all input
33
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
34
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
33
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
34
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
35 35
 
36 36
 	}
37 37
 
38 38
 }
39 39
 
40
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
40
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-login.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Login', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Login', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Login', 'give');
25
+		$this->shortcode['label'] = esc_html__('Login', 'give');
26 26
 
27
-		parent::__construct( 'give_login' );
27
+		parent::__construct('give_login');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Login Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Login Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'login-redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after login.', 'give'),
47 47
 			),
48 48
             array(
49 49
                 'type' => 'container',
50
-                'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),
50
+                'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Logout Redirect URL (optional):', 'give')),
51 51
             ),
52 52
             array(
53 53
                 'type'     => 'textbox',
54 54
                 'name'     => 'logout-redirect',
55 55
                 'minWidth' => 320,
56
-                'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),
56
+                'tooltip'  => esc_attr__('Enter an URL here to redirect to after logout.', 'give'),
57 57
             ),
58 58
 		);
59 59
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Profile Editor', 'give');
25 25
 
26
-		parent::__construct( 'give_profile_editor' );
26
+		parent::__construct('give_profile_editor');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.