Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +76 added lines, -76 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,70 +66,70 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) );
83
+					echo give_price($post_id, false);
84
+					printf('<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr($post_id), esc_attr(give_get_form_price($post_id)));
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89 89
 
90
-					echo give_admin_form_goal_stats( $post_id );
90
+					echo give_admin_form_goal_stats($post_id);
91 91
 
92 92
 				} else {
93
-					_e( 'No Goal Set', 'give' );
93
+					_e('No Goal Set', 'give');
94 94
 				}
95 95
 
96 96
 				printf(
97 97
 					'<input type="hidden" class="formgoal-%1$s" value="%2$s" />',
98
-					esc_attr( $post_id ),
99
-					give_get_form_goal( $post_id )
98
+					esc_attr($post_id),
99
+					give_get_form_goal($post_id)
100 100
 				);
101 101
 
102 102
 				break;
103 103
 			case 'donations':
104
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
104
+				if (current_user_can('view_give_form_stats', $post_id)) {
105 105
 					printf(
106 106
 						'<a href="%1$s">%2$s</a>',
107
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ),
108
-						give_get_form_sales_stats( $post_id )
107
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)),
108
+						give_get_form_sales_stats($post_id)
109 109
 					);
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'earnings':
115
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
115
+				if (current_user_can('view_give_form_stats', $post_id)) {
116 116
 					printf(
117 117
 						'<a href="%1$s">%2$s</a>',
118
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ),
119
-						give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) )
118
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)),
119
+						give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)))
120 120
 					);
121 121
 				} else {
122 122
 					echo '-';
123 123
 				}
124 124
 				break;
125 125
 			case 'shortcode':
126
-				printf( '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint( $post_id ) );
126
+				printf('<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;%s&#34;]"', absint($post_id));
127 127
 				break;
128 128
 		}// End switch().
129 129
 	}// End if().
130 130
 }
131 131
 
132
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
132
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
133 133
 
134 134
 /**
135 135
  * Registers the sortable columns in the list table
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  *
141 141
  * @return array $columns Array of sortable columns
142 142
  */
143
-function give_sortable_form_columns( $columns ) {
143
+function give_sortable_form_columns($columns) {
144 144
 	$columns['price']     = 'amount';
145 145
 	$columns['sales']     = 'sales';
146 146
 	$columns['earnings']  = 'earnings';
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	return $columns;
151 151
 }
152 152
 
153
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
153
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
154 154
 
155 155
 /**
156 156
  * Sorts Columns in the Forms List Table
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
  *
162 162
  * @return array $vars Array of all the sort variables.
163 163
  */
164
-function give_sort_forms( $vars ) {
164
+function give_sort_forms($vars) {
165 165
 	// Check if we're viewing the "give_forms" post type.
166
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
166
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
167 167
 		return $vars;
168 168
 	}
169 169
 
170
-	switch ( $vars['orderby'] ) {
170
+	switch ($vars['orderby']) {
171 171
 		// Check if 'orderby' is set to "sales".
172 172
 		case 'sales':
173 173
 			$vars = array_merge(
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 		// Check if "orderby" is set to "price/amount".
194 194
 		case 'amount':
195
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
195
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
196 196
 
197 197
 			$vars['orderby']    = 'meta_value_num';
198 198
 			$vars['meta_query'] = array(
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return array       Array of all sort variables.
246 246
  */
247
-function give_filter_forms( $vars ) {
248
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
247
+function give_filter_forms($vars) {
248
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
249 249
 
250 250
 		// If an author ID was passed, use it
251
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
251
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
252 252
 
253 253
 			$author_id = $_REQUEST['author'];
254
-			if ( (int) $author_id !== get_current_user_id() ) {
255
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
254
+			if ((int) $author_id !== get_current_user_id()) {
255
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
256 256
 					'response' => 403,
257
-				) );
257
+				));
258 258
 			}
259 259
 			$vars = array_merge(
260 260
 				$vars,
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
  * @return void
279 279
  */
280 280
 function give_forms_load() {
281
-	add_filter( 'request', 'give_sort_forms' );
282
-	add_filter( 'request', 'give_filter_forms' );
281
+	add_filter('request', 'give_sort_forms');
282
+	add_filter('request', 'give_filter_forms');
283 283
 }
284 284
 
285
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
285
+add_action('load-edit.php', 'give_forms_load', 9999);
286 286
 
287 287
 /**
288 288
  * Remove Forms Month Filter
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
  * @global      $typenow The post type we are viewing.
297 297
  * @return array Empty array disables the dropdown.
298 298
  */
299
-function give_remove_month_filter( $dates ) {
299
+function give_remove_month_filter($dates) {
300 300
 	global $typenow;
301 301
 
302
-	if ( $typenow == 'give_forms' ) {
302
+	if ($typenow == 'give_forms') {
303 303
 		$dates = array();
304 304
 	}
305 305
 
306 306
 	return $dates;
307 307
 }
308 308
 
309
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
309
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
310 310
 
311 311
 /**
312 312
  * Updates price when saving post
@@ -318,33 +318,33 @@  discard block
 block discarded – undo
318 318
  *
319 319
  * @return int|null
320 320
  */
321
-function give_price_save_quick_edit( $post_id ) {
322
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
321
+function give_price_save_quick_edit($post_id) {
322
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
323 323
 		return;
324 324
 	}
325
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
325
+	if ( ! current_user_can('edit_post', $post_id)) {
326 326
 		return $post_id;
327 327
 	}
328
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
328
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
329 329
 		return $post_id;
330 330
 	}
331 331
 
332
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
333
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
332
+	if (isset($_REQUEST['_give_regprice'])) {
333
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
334 334
 	}
335 335
 
336 336
 	// Override the Donation minimum amount.
337 337
 	if (
338
-		isset( $_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'] )
338
+		isset($_REQUEST['_give_custom_amount'], $_REQUEST['_give_set_price'], $_REQUEST['_give_price_option'], $_REQUEST['_give_custom_amount_range'])
339 339
 		&& 'set' === $_REQUEST['_give_price_option']
340
-		&& give_is_setting_enabled( $_REQUEST['_give_custom_amount'] )
341
-		&& give_maybe_sanitize_amount( $_REQUEST['_give_set_price'] ) < give_maybe_sanitize_amount( $_REQUEST['_give_custom_amount_range']['minimum'] )
340
+		&& give_is_setting_enabled($_REQUEST['_give_custom_amount'])
341
+		&& give_maybe_sanitize_amount($_REQUEST['_give_set_price']) < give_maybe_sanitize_amount($_REQUEST['_give_custom_amount_range']['minimum'])
342 342
 	) {
343
-		give_update_meta( $post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db( $_REQUEST['_give_set_price'] ) );
343
+		give_update_meta($post_id, '_give_custom_amount_range_minimum', give_sanitize_amount_for_db($_REQUEST['_give_set_price']));
344 344
 	}
345 345
 }
346 346
 
347
-add_action( 'save_post', 'give_price_save_quick_edit' );
347
+add_action('save_post', 'give_price_save_quick_edit');
348 348
 
349 349
 /**
350 350
  * Process bulk edit actions via AJAX
@@ -354,18 +354,18 @@  discard block
 block discarded – undo
354 354
  */
355 355
 function give_save_bulk_edit() {
356 356
 
357
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
357
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
358 358
 
359
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
360
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
361
-		foreach ( $post_ids as $post_id ) {
359
+	if ( ! empty($post_ids) && is_array($post_ids)) {
360
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
361
+		foreach ($post_ids as $post_id) {
362 362
 
363
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
363
+			if ( ! current_user_can('edit_post', $post_id)) {
364 364
 				continue;
365 365
 			}
366 366
 
367
-			if ( ! empty( $price ) ) {
368
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
367
+			if ( ! empty($price)) {
368
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
369 369
 			}
370 370
 		}
371 371
 	}
@@ -373,4 +373,4 @@  discard block
 block discarded – undo
373 373
 	die();
374 374
 }
375 375
 
376
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
376
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +34 added lines, -34 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_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,40 +176,40 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Bailout.
179
-			if ( empty( $sections ) ) {
179
+			if (empty($sections)) {
180 180
 				return;
181 181
 			}
182 182
 
183 183
 			// Show section settings only if setting section exist.
184
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ), true ) ) {
185
-				echo wp_kses_post( '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>' );
184
+			if ($current_section && ! in_array($current_section, array_keys($sections), true)) {
185
+				echo wp_kses_post('<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>');
186 186
 				$GLOBALS['give_hide_save_button'] = true;
187 187
 
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			$section_list = array();
196
-			foreach ( $sections as $id => $label ) {
196
+			foreach ($sections as $id => $label) {
197 197
 				/**
198 198
 				 * Fire the filter to hide particular section on tab.
199 199
 				 *
200 200
 				 * @since 2.0
201 201
 				 */
202
-				if ( apply_filters( "give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id ) ) {
202
+				if (apply_filters("give_hide_section_{$id}_on_{$this->id}_page", false, $sections, $this->id)) {
203 203
 					continue;
204 204
 				}
205 205
 
206
-				$section_list[] = '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section === $id ? 'current' : '' ) . '">' . $label . '</a>';
206
+				$section_list[] = '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section === $id ? 'current' : '').'">'.$label.'</a>';
207 207
 			}
208 208
 
209
-			echo wp_kses_post( sprintf(
209
+			echo wp_kses_post(sprintf(
210 210
 				'<ul class="give-subsubsub">%s</ul><br class="clear" /><hr>',
211
-				implode( ' | </li>', $section_list )
212
-			) );
211
+				implode(' | </li>', $section_list)
212
+			));
213 213
 		}
214 214
 
215 215
 		/**
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		 * @return void
222 222
 		 */
223 223
 		public function output() {
224
-			if ( $this->enable_save ) {
224
+			if ($this->enable_save) {
225 225
 				$GLOBALS['give_hide_save_button'] = false;
226 226
 			}
227 227
 
228 228
 			$settings = $this->get_settings();
229 229
 
230
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
230
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
231 231
 		}
232 232
 
233 233
 		/**
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 			 *
246 246
 			 * @since 2.1
247 247
 			 */
248
-			if ( apply_filters( "give_save_options_{$this->id}_{$current_section}", true ) ) {
249
-				Give_Admin_Settings::save_fields( $settings, 'give_settings' );
248
+			if (apply_filters("give_save_options_{$this->id}_{$current_section}", true)) {
249
+				Give_Admin_Settings::save_fields($settings, 'give_settings');
250 250
 			}
251 251
 
252 252
 			/**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			 *
255 255
 			 * @since 1.8
256 256
 			 */
257
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
257
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
258 258
 		}
259 259
 
260 260
 		/**
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 			$section         = $this->get_sections();
272 272
 			$current_section = give_get_current_setting_section();
273 273
 
274
-			if ( array_key_exists( $current_section, $section ) ) {
275
-				$heading[] = $section[ $current_section ];
274
+			if (array_key_exists($current_section, $section)) {
275
+				$heading[] = $section[$current_section];
276 276
 			}
277 277
 
278
-			return array_unique( $heading );
278
+			return array_unique($heading);
279 279
 		}
280 280
 
281 281
 		/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		public function get_heading_html() {
290 290
 			return sprintf(
291 291
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
292
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
292
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
293 293
 			);
294 294
 		}
295 295
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-functions.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 	$post_type = 'give_payment';
18 18
 	$responses = array();
19 19
 
20
-	$form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : '';
20
+	$form_id = isset($_POST['form_id']) ? intval($_POST['form_id']) : '';
21 21
 
22
-	if ( empty( $form_id ) ) {
22
+	if (empty($form_id)) {
23 23
 		return false;
24 24
 	}
25 25
 
26
-	$args          = array(
27
-		'give_forms'     => array( $form_id ),
28
-		'posts_per_page' => - 1,
26
+	$args = array(
27
+		'give_forms'     => array($form_id),
28
+		'posts_per_page' => -1,
29 29
 		'fields'         => 'ids',
30 30
 	);
31
-	$donation_list = implode( ',', (array) give_get_payments( $args ) );
31
+	$donation_list = implode(',', (array) give_get_payments($args));
32 32
 
33 33
 	$query_and = sprintf(
34 34
 		"AND $wpdb->posts.ID IN (%s) 
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
         LEFT JOIN $wpdb->paymentmeta 
44 44
         ON $wpdb->posts.ID = $wpdb->paymentmeta.payment_id
45 45
         WHERE $wpdb->posts.post_type = '%s'
46
-    " . $query_and;
46
+    ".$query_and;
47 47
 
48
-	$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
48
+	$meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
49 49
 
50
-	if ( ! empty( $meta_keys ) ) {
51
-		$responses['standard_fields'] = array_values( $meta_keys );
50
+	if ( ! empty($meta_keys)) {
51
+		$responses['standard_fields'] = array_values($meta_keys);
52 52
 	}
53 53
 
54 54
 	$query_and = sprintf(
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
         LEFT JOIN $wpdb->paymentmeta 
65 65
         ON $wpdb->posts.ID = $wpdb->paymentmeta.payment_id 
66 66
         WHERE $wpdb->posts.post_type = '%s'
67
-    " . $query_and;
67
+    ".$query_and;
68 68
 
69
-	$hidden_meta_keys   = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
69
+	$hidden_meta_keys = $wpdb->get_col($wpdb->prepare($query, $post_type));
70 70
 
71 71
 	/**
72 72
 	 * Filter to modify hidden keys that are going to be ignore when displaying the hidden keys
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @return array $ignore_hidden_keys Hidden keys that are going to be ignore
80 80
 	 */
81
-	$ignore_hidden_keys = apply_filters( 'give_export_donations_ignore_hidden_keys', array(
81
+	$ignore_hidden_keys = apply_filters('give_export_donations_ignore_hidden_keys', array(
82 82
 		'_give_payment_meta',
83 83
 		'_give_payment_gateway',
84 84
 		'_give_payment_form_title',
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	);
112 112
 
113 113
 	// Unset ignored hidden keys.
114
-	foreach ( $ignore_hidden_keys as $key ) {
115
-		if ( ( $key = array_search( $key, $hidden_meta_keys ) ) !== false ) {
116
-			unset( $hidden_meta_keys[ $key ] );
114
+	foreach ($ignore_hidden_keys as $key) {
115
+		if (($key = array_search($key, $hidden_meta_keys)) !== false) {
116
+			unset($hidden_meta_keys[$key]);
117 117
 		}
118 118
 	}
119 119
 
120
-	if ( ! empty( $hidden_meta_keys ) ) {
121
-		$responses['hidden_fields'] = array_values( $hidden_meta_keys );
120
+	if ( ! empty($hidden_meta_keys)) {
121
+		$responses['hidden_fields'] = array_values($hidden_meta_keys);
122 122
 	}
123 123
 
124 124
 	/**
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return array $responses
133 133
 	 */
134
-	wp_send_json( (array) apply_filters( 'give_export_donations_get_custom_fields', $responses, $form_id ) );
134
+	wp_send_json((array) apply_filters('give_export_donations_get_custom_fields', $responses, $form_id));
135 135
 
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields' );
138
+add_action('wp_ajax_give_export_donations_get_custom_fields', 'give_export_donations_get_custom_fields');
139 139
 
140 140
 /**
141 141
  * Register the payments batch exporter
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
  * @since  1.0
144 144
  */
145 145
 function give_register_export_donations_batch_export() {
146
-	add_action( 'give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1 );
146
+	add_action('give_batch_export_class_include', 'give_export_donations_include_export_class', 10, 1);
147 147
 }
148 148
 
149
-add_action( 'give_register_batch_exporter', 'give_register_export_donations_batch_export', 10 );
149
+add_action('give_register_batch_exporter', 'give_register_export_donations_batch_export', 10);
150 150
 
151 151
 
152 152
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @param $class Give_Export_Donations_CSV
156 156
  */
157
-function give_export_donations_include_export_class( $class ) {
158
-	if ( 'Give_Export_Donations_CSV' === $class ) {
159
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-exporter.php';
157
+function give_export_donations_include_export_class($class) {
158
+	if ('Give_Export_Donations_CSV' === $class) {
159
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-exporter.php';
160 160
 	}
161 161
 }
162 162
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
  *
169 169
  * @return string
170 170
  */
171
-function give_export_donations_create_column_key( $string ) {
172
-	return sanitize_key( str_replace( ' ', '_', $string ) );
171
+function give_export_donations_create_column_key($string) {
172
+	return sanitize_key(str_replace(' ', '_', $string));
173 173
 }
174 174
 
175 175
 /**
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
  *
182 182
  * @return array
183 183
  */
184
-function give_export_donation_form_search_args( $args ) {
185
-	if ( empty( $_POST['fields'] ) ) {
184
+function give_export_donation_form_search_args($args) {
185
+	if (empty($_POST['fields'])) {
186 186
 		return $args;
187 187
 	}
188 188
 
189
-	$fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null;
190
-	parse_str( $fields );
189
+	$fields = isset($_POST['fields']) ? $_POST['fields'] : null;
190
+	parse_str($fields);
191 191
 
192
-	if ( ! empty( $give_forms_categories ) && ! empty( $give_forms_tags ) ) {
192
+	if ( ! empty($give_forms_categories) && ! empty($give_forms_tags)) {
193 193
 		$args['tax_query']['relation'] = 'AND';
194 194
 	}
195 195
 
196
-	if ( ! empty( $give_forms_categories ) ) {
196
+	if ( ! empty($give_forms_categories)) {
197 197
 		$args['tax_query'][] = array(
198 198
 			'taxonomy' => 'give_forms_category',
199 199
 			'field'    => 'term_id',
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		);
203 203
 	}
204 204
 
205
-	if ( ! empty( $give_forms_tags ) ) {
205
+	if ( ! empty($give_forms_tags)) {
206 206
 		$args['tax_query'][] = array(
207 207
 			'taxonomy' => 'give_forms_tag',
208 208
 			'field'    => 'term_id',
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	return $args;
215 215
 }
216 216
 
217
-add_filter( 'give_ajax_form_search_args', 'give_export_donation_form_search_args' );
217
+add_filter('give_ajax_form_search_args', 'give_export_donation_form_search_args');
218 218
 
219 219
 /**
220 220
  * Add Donation standard fields in export donation page
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	?>
226 226
 	<tr>
227 227
 		<td scope="row" class="row-title">
228
-			<label><?php _e( 'Standard Columns:', 'give' ); ?></label>
228
+			<label><?php _e('Standard Columns:', 'give'); ?></label>
229 229
 		</td>
230 230
 		<td>
231 231
 			<div class="give-clearfix">
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 							<li class="give-export-option-label give-export-option-donation-label">
237 237
 								<span>
238
-									<?php _e( 'Donation Payment Fields', 'give' ); ?>
238
+									<?php _e('Donation Payment Fields', 'give'); ?>
239 239
 								</span>
240 240
 							</li>
241 241
 
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
 								<label for="give-export-donation-id">
244 244
 									<input type="checkbox" checked
245 245
 									       name="give_give_donations_export_option[donation_id]"
246
-									       id="give-export-donation-id"><?php _e( 'Donation ID', 'give' ); ?>
246
+									       id="give-export-donation-id"><?php _e('Donation ID', 'give'); ?>
247 247
 								</label>
248 248
 							</li>
249 249
 
250 250
 							<?php
251
-							if ( give_is_setting_enabled( give_get_option( 'sequential-ordering_status', 'disabled' ) ) ) {
251
+							if (give_is_setting_enabled(give_get_option('sequential-ordering_status', 'disabled'))) {
252 252
 								?>
253 253
 								<li>
254 254
 									<label for="give-export-seq-id">
255 255
 										<input type="checkbox" checked
256 256
 										       name="give_give_donations_export_option[seq_id]"
257
-										       id="give-export-seq-id"><?php _e( 'Donation Number', 'give' ); ?>
257
+										       id="give-export-seq-id"><?php _e('Donation Number', 'give'); ?>
258 258
 									</label>
259 259
 								</li>
260 260
 								<?php
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 								<label for="give-export-donation-sum">
266 266
 									<input type="checkbox" checked
267 267
 									       name="give_give_donations_export_option[donation_total]"
268
-									       id="give-export-donation-sum"><?php _e( 'Donation Total', 'give' ); ?>
268
+									       id="give-export-donation-sum"><?php _e('Donation Total', 'give'); ?>
269 269
 								</label>
270 270
 							</li>
271 271
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 								<label for="give-export-donation-currency_code">
274 274
 									<input type="checkbox" checked
275 275
 									       name="give_give_donations_export_option[currency_code]"
276
-									       id="give-export-donation-currency_code"><?php _e( 'Currency Code', 'give' ); ?>
276
+									       id="give-export-donation-currency_code"><?php _e('Currency Code', 'give'); ?>
277 277
 								</label>
278 278
 							</li>
279 279
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 								<label for="give-export-donation-currency_symbol">
282 282
 									<input type="checkbox" checked
283 283
 									       name="give_give_donations_export_option[currency_symbol]"
284
-									       id="give-export-donation-currency_symbol"><?php _e( 'Currency Symbol', 'give' ); ?>
284
+									       id="give-export-donation-currency_symbol"><?php _e('Currency Symbol', 'give'); ?>
285 285
 								</label>
286 286
 							</li>
287 287
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 								<label for="give-export-donation-status">
290 290
 									<input type="checkbox" checked
291 291
 									       name="give_give_donations_export_option[donation_status]"
292
-									       id="give-export-donation-status"><?php _e( 'Donation Status', 'give' ); ?>
292
+									       id="give-export-donation-status"><?php _e('Donation Status', 'give'); ?>
293 293
 								</label>
294 294
 							</li>
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 								<label for="give-export-donation-date">
298 298
 									<input type="checkbox" checked
299 299
 									       name="give_give_donations_export_option[donation_date]"
300
-									       id="give-export-donation-date"><?php _e( 'Donation Date', 'give' ); ?>
300
+									       id="give-export-donation-date"><?php _e('Donation Date', 'give'); ?>
301 301
 								</label>
302 302
 							</li>
303 303
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 								<label for="give-export-donation-time">
306 306
 									<input type="checkbox" checked
307 307
 									       name="give_give_donations_export_option[donation_time]"
308
-									       id="give-export-donation-time"><?php _e( 'Donation Time', 'give' ); ?>
308
+									       id="give-export-donation-time"><?php _e('Donation Time', 'give'); ?>
309 309
 								</label>
310 310
 							</li>
311 311
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 								<label for="give-export-payment-gateway">
314 314
 									<input type="checkbox" checked
315 315
 									       name="give_give_donations_export_option[payment_gateway]"
316
-									       id="give-export-payment-gateway"><?php _e( 'Payment Gateway', 'give' ); ?>
316
+									       id="give-export-payment-gateway"><?php _e('Payment Gateway', 'give'); ?>
317 317
 								</label>
318 318
 							</li>
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 							 *
324 324
 							 * @since 2.1
325 325
 							 */
326
-							do_action( 'give_export_donation_standard_payment_fields' );
326
+							do_action('give_export_donation_standard_payment_fields');
327 327
 							?>
328 328
 						</ul>
329 329
 					</li>
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
 							<li class="give-export-option-label give-export-option-Form-label">
335 335
 								<span>
336
-									<?php _e( 'Donation Form Fields', 'give' ); ?>
336
+									<?php _e('Donation Form Fields', 'give'); ?>
337 337
 								</span>
338 338
 							</li>
339 339
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 								<label for="give-export-donation-form-id">
343 343
 									<input type="checkbox" checked
344 344
 									       name="give_give_donations_export_option[form_id]"
345
-									       id="give-export-donation-form-id"><?php _e( 'Donation Form ID', 'give' ); ?>
345
+									       id="give-export-donation-form-id"><?php _e('Donation Form ID', 'give'); ?>
346 346
 								</label>
347 347
 							</li>
348 348
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 								<label for="give-export-donation-form-title">
351 351
 									<input type="checkbox" checked
352 352
 									       name="give_give_donations_export_option[form_title]"
353
-									       id="give-export-donation-form-title"><?php _e( 'Donation Form Title', 'give' ); ?>
353
+									       id="give-export-donation-form-title"><?php _e('Donation Form Title', 'give'); ?>
354 354
 								</label>
355 355
 							</li>
356 356
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 								<label for="give-export-donation-form-level-id">
359 359
 									<input type="checkbox" checked
360 360
 									       name="give_give_donations_export_option[form_level_id]"
361
-									       id="give-export-donation-form-level-id"><?php _e( 'Donation Form Level ID', 'give' ); ?>
361
+									       id="give-export-donation-form-level-id"><?php _e('Donation Form Level ID', 'give'); ?>
362 362
 								</label>
363 363
 							</li>
364 364
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 								<label for="give-export-donation-form-level-title">
367 367
 									<input type="checkbox" checked
368 368
 									       name="give_give_donations_export_option[form_level_title]"
369
-									       id="give-export-donation-form-level-title"><?php _e( 'Donation Form Level Title', 'give' ); ?>
369
+									       id="give-export-donation-form-level-title"><?php _e('Donation Form Level Title', 'give'); ?>
370 370
 								</label>
371 371
 							</li>
372 372
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 							 *
377 377
 							 * @since 2.1
378 378
 							 */
379
-							do_action( 'give_export_donation_standard_form_fields' );
379
+							do_action('give_export_donation_standard_form_fields');
380 380
 							?>
381 381
 						</ul>
382 382
 					</li>
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 							<li class="give-export-option-label give-export-option-donor-label">
388 388
 								<span>
389
-									<?php _e( 'Donor Fields', 'give' ); ?>
389
+									<?php _e('Donor Fields', 'give'); ?>
390 390
 								</span>
391 391
 							</li>
392 392
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 								<label for="give-export-first-name">
395 395
 									<input type="checkbox" checked
396 396
 									       name="give_give_donations_export_option[first_name]"
397
-									       id="give-export-first-name"><?php _e( 'Donor\'s First Name', 'give' ); ?>
397
+									       id="give-export-first-name"><?php _e('Donor\'s First Name', 'give'); ?>
398 398
 								</label>
399 399
 							</li>
400 400
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 								<label for="give-export-last-name">
403 403
 									<input type="checkbox" checked
404 404
 									       name="give_give_donations_export_option[last_name]"
405
-									       id="give-export-last-name"><?php _e( 'Donor\'s Last Name', 'give' ); ?>
405
+									       id="give-export-last-name"><?php _e('Donor\'s Last Name', 'give'); ?>
406 406
 								</label>
407 407
 							</li>
408 408
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 								<label for="give-export-email">
411 411
 									<input type="checkbox" checked
412 412
 									       name="give_give_donations_export_option[email]"
413
-									       id="give-export-email"><?php _e( 'Donor\'s Email', 'give' ); ?>
413
+									       id="give-export-email"><?php _e('Donor\'s Email', 'give'); ?>
414 414
 								</label>
415 415
 							</li>
416 416
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 								<label for="give-export-company">
419 419
 									<input type="checkbox" checked
420 420
 									       name="give_give_donations_export_option[company]"
421
-									       id="give-export-company"><?php _e( 'Company Name', 'give' ); ?>
421
+									       id="give-export-company"><?php _e('Company Name', 'give'); ?>
422 422
 								</label>
423 423
 							</li>
424 424
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 								<label for="give-export-address">
427 427
 									<input type="checkbox" checked
428 428
 									       name="give_give_donations_export_option[address]"
429
-									       id="give-export-address"><?php _e( 'Donor\'s Billing Address', 'give' ); ?>
429
+									       id="give-export-address"><?php _e('Donor\'s Billing Address', 'give'); ?>
430 430
 								</label>
431 431
 							</li>
432 432
 
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 								<label for="give-export-userid">
435 435
 									<input type="checkbox" checked
436 436
 									       name="give_give_donations_export_option[userid]"
437
-									       id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
437
+									       id="give-export-userid"><?php _e('User ID', 'give'); ?>
438 438
 								</label>
439 439
 							</li>
440 440
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 								<label for="give-export-donorid">
443 443
 									<input type="checkbox" checked
444 444
 									       name="give_give_donations_export_option[donorid]"
445
-									       id="give-export-donorid"><?php _e( 'Donor ID', 'give' ); ?>
445
+									       id="give-export-donorid"><?php _e('Donor ID', 'give'); ?>
446 446
 								</label>
447 447
 							</li>
448 448
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 								<label for="give-export-donor-ip">
451 451
 									<input type="checkbox" checked
452 452
 									       name="give_give_donations_export_option[donor_ip]"
453
-									       id="give-export-donor-ip"><?php _e( 'Donor IP Address', 'give' ); ?>
453
+									       id="give-export-donor-ip"><?php _e('Donor IP Address', 'give'); ?>
454 454
 								</label>
455 455
 							</li>
456 456
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 							 *
461 461
 							 * @since 2.1
462 462
 							 */
463
-							do_action( 'give_export_donation_standard_donor_fields' );
463
+							do_action('give_export_donation_standard_donor_fields');
464 464
 							?>
465 465
 						</ul>
466 466
 					</li>
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 					 *
472 472
 					 * @since 2.1.4
473 473
 					 */
474
-					do_action( 'give_export_donation_add_custom_column' );
474
+					do_action('give_export_donation_add_custom_column');
475 475
 					?>
476 476
 				</ul>
477 477
 			</div>
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	<?php
481 481
 }
482 482
 
483
-add_action( 'give_export_donation_fields', 'give_export_donation_standard_fields', 10 );
483
+add_action('give_export_donation_fields', 'give_export_donation_standard_fields', 10);
484 484
 
485 485
 /**
486 486
  * Add Donation Custom fields in export donation page
@@ -492,19 +492,19 @@  discard block
 block discarded – undo
492 492
 	<tr
493 493
 		class="give-hidden give-export-donations-hide give-export-donations-standard-fields">
494 494
 		<td scope="row" class="row-title">
495
-			<label><?php _e( 'Custom Field Columns:', 'give' ); ?></label>
495
+			<label><?php _e('Custom Field Columns:', 'give'); ?></label>
496 496
 		</td>
497 497
 		<td class="give-field-wrap">
498 498
 			<div class="give-clearfix">
499 499
 				<ul class="give-export-option-ul"></ul>
500
-				<p class="give-field-description"><?php _e( 'The following fields may have been created by custom code, or another plugin.', 'give' ); ?></p>
500
+				<p class="give-field-description"><?php _e('The following fields may have been created by custom code, or another plugin.', 'give'); ?></p>
501 501
 			</div>
502 502
 		</td>
503 503
 	</tr>
504 504
 	<?php
505 505
 }
506 506
 
507
-add_action( 'give_export_donation_fields', 'give_export_donation_custom_fields', 30 );
507
+add_action('give_export_donation_fields', 'give_export_donation_custom_fields', 30);
508 508
 
509 509
 
510 510
 /**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 
518 518
 	<tr class="give-hidden give-export-donations-hide give-export-donations-hidden-fields">
519 519
 		<td scope="row" class="row-title">
520
-			<label><?php _e( 'Hidden Custom Field Columns:', 'give' ); ?></label>
520
+			<label><?php _e('Hidden Custom Field Columns:', 'give'); ?></label>
521 521
 		</td>
522 522
 		<td class="give-field-wrap">
523 523
 			<div class="give-clearfix">
524 524
 				<ul class="give-export-option-ul"></ul>
525
-				<p class="give-field-description"><?php _e( 'The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give' ); ?></p>
525
+				<p class="give-field-description"><?php _e('The following hidden custom fields contain data created by Give Core, a Give Add-on, another plugin, etc.<br/>Hidden fields are generally used for programming logic, but you may contain data you would like to export.', 'give'); ?></p>
526 526
 			</div>
527 527
 		</td>
528 528
 	</tr>
529 529
 	<?php
530 530
 }
531 531
 
532
-add_action( 'give_export_donation_fields', 'give_export_donation_hidden_fields', 40 );
532
+add_action('give_export_donation_fields', 'give_export_donation_hidden_fields', 40);
533 533
 
Please login to merge, or discard this patch.
includes/admin/class-admin-settings.php 1 patch
Spacing   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Admin_Settings' ) ) :
16
+if ( ! class_exists('Give_Admin_Settings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Admin_Settings Class.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			 *
73 73
 			 * @param array $settings Array of settings class object.
74 74
 			 */
75
-			self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() );
75
+			self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array());
76 76
 
77 77
 			return self::$settings;
78 78
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 * @return bool
87 87
 		 */
88 88
 		public static function verify_nonce() {
89
-			if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) {
89
+			if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) {
90 90
 				return false;
91 91
 			}
92 92
 
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 		public static function save() {
103 103
 			$current_tab = give_get_current_setting_tab();
104 104
 
105
-			if ( ! self::verify_nonce() ) {
106
-				echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>';
105
+			if ( ! self::verify_nonce()) {
106
+				echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>';
107 107
 				die();
108 108
 			}
109 109
 
110 110
 			// Show error message if Akismet not configured and Admin try to save 'enabled' option.
111
-			if ( isset( $_POST['akismet_spam_protection'] )
112
-			     && give_is_setting_enabled( $_POST['akismet_spam_protection'] )
111
+			if (isset($_POST['akismet_spam_protection'])
112
+			     && give_is_setting_enabled($_POST['akismet_spam_protection'])
113 113
 			     && ! give_check_akismet_key()
114 114
 			) {
115
-				self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) );
115
+				self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give'));
116 116
 
117 117
 				return;
118 118
 			}
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 			 *
127 127
 			 * @since 1.8
128 128
 			 */
129
-			do_action( self::$setting_filter_prefix . '_save_' . $current_tab );
129
+			do_action(self::$setting_filter_prefix.'_save_'.$current_tab);
130 130
 
131
-			self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) );
131
+			self::add_message('give-setting-updated', __('Your settings have been saved.', 'give'));
132 132
 
133 133
 			/**
134 134
 			 * Trigger Action.
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 			 *
140 140
 			 * @since 1.8
141 141
 			 */
142
-			do_action( self::$setting_filter_prefix . '_saved' );
142
+			do_action(self::$setting_filter_prefix.'_saved');
143 143
 		}
144 144
 
145 145
 		/**
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		 *
153 153
 		 * @return void
154 154
 		 */
155
-		public static function add_message( $code, $message ) {
156
-			self::$messages[ $code ] = $message;
155
+		public static function add_message($code, $message) {
156
+			self::$messages[$code] = $message;
157 157
 		}
158 158
 
159 159
 		/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 		 *
167 167
 		 * @return void
168 168
 		 */
169
-		public static function add_error( $code, $message ) {
170
-			self::$errors[ $code ] = $message;
169
+		public static function add_error($code, $message) {
170
+			self::$errors[$code] = $message;
171 171
 		}
172 172
 
173 173
 		/**
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 			$notice_html = '';
181 181
 			$classes     = 'give-notice settings-error notice is-dismissible';
182 182
 
183
-			self::$errors   = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors );
184
-			self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages );
183
+			self::$errors   = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors);
184
+			self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages);
185 185
 
186
-			if ( 0 < count( self::$errors ) ) {
187
-				foreach ( self::$errors as $code => $message ) {
186
+			if (0 < count(self::$errors)) {
187
+				foreach (self::$errors as $code => $message) {
188 188
 					$notice_html .= sprintf(
189 189
 						'<div id="setting-error-%1$s" class="%2$s error" style="display: none"><p><strong>%3$s</strong></p></div>',
190 190
 						$code,
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 				}
195 195
 			}
196 196
 
197
-			if ( 0 < count( self::$messages ) ) {
198
-				foreach ( self::$messages as $code => $message ) {
197
+			if (0 < count(self::$messages)) {
198
+				foreach (self::$messages as $code => $message) {
199 199
 					$notice_html .= sprintf(
200 200
 						'<div id="setting-error-%1$s" class="%2$s updated" style="display: none"><p><strong>%3$s</strong></p></div>',
201 201
 						$code,
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			self::$setting_filter_prefix = give_get_current_setting_page();
222 222
 
223 223
 			// Bailout: Exit if setting page is not defined.
224
-			if ( empty( self::$setting_filter_prefix ) ) {
224
+			if (empty(self::$setting_filter_prefix)) {
225 225
 				return false;
226 226
 			}
227 227
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			 *
235 235
 			 * @since 1.8
236 236
 			 */
237
-			do_action( self::$setting_filter_prefix . '_start' );
237
+			do_action(self::$setting_filter_prefix.'_start');
238 238
 
239 239
 			$current_tab = give_get_current_setting_tab();
240 240
 
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
 			/* @var object $current_setting_obj */
245 245
 			$current_setting_obj = new StdClass;
246 246
 
247
-			foreach ( $all_setting as $setting ) {
247
+			foreach ($all_setting as $setting) {
248 248
 				if (
249
-					method_exists( $setting, 'get_id' ) &&
249
+					method_exists($setting, 'get_id') &&
250 250
 					$current_tab === $setting->get_id()
251 251
 				) {
252 252
 					$current_setting_obj = $setting;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			}
256 256
 
257 257
 			// Save settings if data has been posted.
258
-			if ( ! empty( $_POST ) ) {
258
+			if ( ! empty($_POST)) {
259 259
 				self::save();
260 260
 			}
261 261
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 			 *
269 269
 			 * @since 1.8
270 270
 			 */
271
-			$tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() );
271
+			$tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array());
272 272
 
273 273
 			include 'views/html-admin-settings.php';
274 274
 
@@ -286,25 +286,25 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @return string|bool
288 288
 		 */
289
-		public static function get_option( $option_name = '', $field_id = '', $default = false ) {
289
+		public static function get_option($option_name = '', $field_id = '', $default = false) {
290 290
 			// Bailout.
291
-			if ( empty( $option_name ) && empty( $field_id ) ) {
291
+			if (empty($option_name) && empty($field_id)) {
292 292
 				return false;
293 293
 			}
294 294
 
295
-			if ( ! empty( $field_id ) && ! empty( $option_name ) ) {
295
+			if ( ! empty($field_id) && ! empty($option_name)) {
296 296
 				// Get field value if any.
297
-				$option_value = get_option( $option_name );
297
+				$option_value = get_option($option_name);
298 298
 
299
-				$option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) )
300
-					? $option_value[ $field_id ]
299
+				$option_value = (is_array($option_value) && array_key_exists($field_id, $option_value))
300
+					? $option_value[$field_id]
301 301
 					: $default;
302 302
 			} else {
303 303
 				// If option name is empty but not field name then this means, setting is direct store to option table under there field name.
304 304
 				$option_name = ! $option_name ? $field_id : $option_name;
305 305
 
306 306
 				// Get option value if any.
307
-				$option_value = get_option( $option_name, $default );
307
+				$option_value = get_option($option_name, $default);
308 308
 			}
309 309
 
310 310
 			return $option_value;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @return void
325 325
 		 */
326
-		public static function output_fields( $options, $option_name = '' ) {
326
+		public static function output_fields($options, $option_name = '') {
327 327
 			$current_tab = give_get_current_setting_tab();
328 328
 
329 329
 			// Field Default values.
@@ -335,62 +335,62 @@  discard block
 block discarded – undo
335 335
 				'desc'                => '',
336 336
 				'table_html'          => true,
337 337
 				'repeat'              => false,
338
-				'repeat_btn_title'    => __( 'Add Field', 'give' ),
338
+				'repeat_btn_title'    => __('Add Field', 'give'),
339 339
 			);
340 340
 
341
-			foreach ( $options as $value ) {
342
-				if ( ! isset( $value['type'] ) ) {
341
+			foreach ($options as $value) {
342
+				if ( ! isset($value['type'])) {
343 343
 					continue;
344 344
 				}
345 345
 
346 346
 				// Set title.
347
-				$defaults['title'] = isset( $value['name'] ) ? $value['name'] : '';
347
+				$defaults['title'] = isset($value['name']) ? $value['name'] : '';
348 348
 
349 349
 				// Set default setting.
350
-				$value = wp_parse_args( $value, $defaults );
350
+				$value = wp_parse_args($value, $defaults);
351 351
 
352 352
 				// Colorpicker field.
353
-				$value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] );
354
-				$value['type']  = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] );
353
+				$value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']);
354
+				$value['type']  = ('colorpicker' === $value['type'] ? 'text' : $value['type']);
355 355
 
356 356
 
357 357
 				// Custom attribute handling.
358 358
 				$custom_attributes = array();
359 359
 
360
-				if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) {
361
-					foreach ( $value['attributes'] as $attribute => $attribute_value ) {
362
-						$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
360
+				if ( ! empty($value['attributes']) && is_array($value['attributes'])) {
361
+					foreach ($value['attributes'] as $attribute => $attribute_value) {
362
+						$custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"';
363 363
 					}
364 364
 				}
365 365
 
366 366
 				// Description handling.
367
-				$description = self::get_field_description( $value );
367
+				$description = self::get_field_description($value);
368 368
 
369 369
 				// Switch based on type.
370
-				switch ( $value['type'] ) {
370
+				switch ($value['type']) {
371 371
 
372 372
 					// Section Titles
373 373
 					case 'title':
374
-						if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) {
374
+						if ( ! empty($value['title']) || ! empty($value['desc'])) {
375 375
 							?>
376 376
 							<div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>">
377
-								<?php if ( ! empty( $value['title'] ) ) : ?>
378
-									<h2><?php echo self::get_field_title( $value ); ?></h2>
377
+								<?php if ( ! empty($value['title'])) : ?>
378
+									<h2><?php echo self::get_field_title($value); ?></h2>
379 379
 									<hr>
380 380
 								<?php endif; ?>
381 381
 
382
-								<?php if ( ! empty( $value['desc'] ) ) : ?>
383
-									<?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?>
382
+								<?php if ( ! empty($value['desc'])) : ?>
383
+									<?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?>
384 384
 								<?php endif; ?>
385 385
 							</div>
386 386
 							<?php
387 387
 						}
388 388
 
389
-						if ( $value['table_html'] ) {
390
-							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n";
389
+						if ($value['table_html']) {
390
+							echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n";
391 391
 						}
392 392
 
393
-						if ( ! empty( $value['id'] ) ) {
393
+						if ( ! empty($value['id'])) {
394 394
 
395 395
 							/**
396 396
 							 * Trigger Action.
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 							 *
400 400
 							 * @since 1.8
401 401
 							 */
402
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) );
402
+							do_action('give_settings_'.sanitize_title($value['id']));
403 403
 						}
404 404
 
405 405
 						break;
406 406
 
407 407
 					// Section Ends.
408 408
 					case 'sectionend':
409
-						if ( ! empty( $value['id'] ) ) {
409
+						if ( ! empty($value['id'])) {
410 410
 
411 411
 							/**
412 412
 							 * Trigger Action.
@@ -415,14 +415,14 @@  discard block
 block discarded – undo
415 415
 							 *
416 416
 							 * @since 1.8
417 417
 							 */
418
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' );
418
+							do_action('give_settings_'.sanitize_title($value['id']).'_end');
419 419
 						}
420 420
 
421
-						if ( $value['table_html'] ) {
421
+						if ($value['table_html']) {
422 422
 							echo '</table>';
423 423
 						}
424 424
 
425
-						if ( ! empty( $value['id'] ) ) {
425
+						if ( ! empty($value['id'])) {
426 426
 
427 427
 							/**
428 428
 							 * Trigger Action.
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 							 *
432 432
 							 * @since 1.8
433 433
 							 */
434
-							do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' );
434
+							do_action('give_settings_'.sanitize_title($value['id']).'_after');
435 435
 						}
436 436
 
437 437
 						break;
@@ -439,51 +439,51 @@  discard block
 block discarded – undo
439 439
 					// Standard text inputs and subtypes like 'number'.
440 440
 					case 'colorpicker':
441 441
 					case 'hidden' :
442
-						$value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden';
442
+						$value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden';
443 443
 					case 'text':
444 444
 					case 'email':
445 445
 					case 'number':
446 446
 					case 'password' :
447 447
 						$type = $value['type'];
448
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
448
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
449 449
 
450 450
 						// Set default value for repeater field if not any value set yet.
451
-						if ( $value['repeat'] && is_string( $option_value ) ) {
452
-							$option_value = array( $value['default'] );
451
+						if ($value['repeat'] && is_string($option_value)) {
452
+							$option_value = array($value['default']);
453 453
 						}
454 454
 						?>
455
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
455
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
456 456
 						<th scope="row" class="titledesc">
457 457
 							<label
458
-								for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
458
+								for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
459 459
 						</th>
460
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
461
-							<?php if ( $value['repeat'] ) : ?>
462
-								<?php foreach ( $option_value as $index => $field_value ) : ?>
460
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
461
+							<?php if ($value['repeat']) : ?>
462
+								<?php foreach ($option_value as $index => $field_value) : ?>
463 463
 									<p>
464 464
 										<input
465
-											name="<?php echo esc_attr( $value['id'] ); ?>[]"
466
-											type="<?php echo esc_attr( $type ); ?>"
467
-											style="<?php echo esc_attr( $value['css'] ); ?>"
468
-											value="<?php echo esc_attr( $field_value ); ?>"
469
-											class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>"
470
-											<?php echo implode( ' ', $custom_attributes ); ?>
465
+											name="<?php echo esc_attr($value['id']); ?>[]"
466
+											type="<?php echo esc_attr($type); ?>"
467
+											style="<?php echo esc_attr($value['css']); ?>"
468
+											value="<?php echo esc_attr($field_value); ?>"
469
+											class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>"
470
+											<?php echo implode(' ', $custom_attributes); ?>
471 471
 										/>
472 472
 										<span class="give-remove-setting-field"
473
-										      title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span>
473
+										      title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span>
474 474
 									</p>
475 475
 								<?php endforeach; ?>
476 476
 								<a href="#" data-id="<?php echo $value['id']; ?>"
477 477
 								   class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a>
478 478
 							<?php else : ?>
479 479
 								<input
480
-									name="<?php echo esc_attr( $value['id'] ); ?>"
481
-									id="<?php echo esc_attr( $value['id'] ); ?>"
482
-									type="<?php echo esc_attr( $type ); ?>"
483
-									style="<?php echo esc_attr( $value['css'] ); ?>"
484
-									value="<?php echo esc_attr( $option_value ); ?>"
485
-									class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
486
-									<?php echo implode( ' ', $custom_attributes ); ?>
480
+									name="<?php echo esc_attr($value['id']); ?>"
481
+									id="<?php echo esc_attr($value['id']); ?>"
482
+									type="<?php echo esc_attr($type); ?>"
483
+									style="<?php echo esc_attr($value['css']); ?>"
484
+									value="<?php echo esc_attr($option_value); ?>"
485
+									class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
486
+									<?php echo implode(' ', $custom_attributes); ?>
487 487
 								/>
488 488
 							<?php endif; ?>
489 489
 							<?php echo $description; ?>
@@ -494,24 +494,24 @@  discard block
 block discarded – undo
494 494
 					// Textarea.
495 495
 					case 'textarea':
496 496
 
497
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
497
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
498 498
 
499 499
 						?>
500
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
500
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
501 501
 							<th scope="row" class="titledesc">
502 502
 								<label
503
-									for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
503
+									for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
504 504
 							</th>
505
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
505
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
506 506
 									<textarea
507
-										name="<?php echo esc_attr( $value['id'] ); ?>"
508
-										id="<?php echo esc_attr( $value['id'] ); ?>"
509
-										style="<?php echo esc_attr( $value['css'] ); ?>"
510
-										class="<?php echo esc_attr( $value['class'] ); ?>"
507
+										name="<?php echo esc_attr($value['id']); ?>"
508
+										id="<?php echo esc_attr($value['id']); ?>"
509
+										style="<?php echo esc_attr($value['css']); ?>"
510
+										class="<?php echo esc_attr($value['class']); ?>"
511 511
 										rows="10"
512 512
 										cols="60"
513
-										<?php echo implode( ' ', $custom_attributes ); ?>
514
-									><?php echo esc_textarea( $option_value ); ?></textarea>
513
+										<?php echo implode(' ', $custom_attributes); ?>
514
+									><?php echo esc_textarea($option_value); ?></textarea>
515 515
 								<?php echo $description; ?>
516 516
 							</td>
517 517
 						</tr><?php
@@ -520,47 +520,47 @@  discard block
 block discarded – undo
520 520
 					// Select boxes.
521 521
 					case 'select' :
522 522
 					case 'multiselect' :
523
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
523
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
524 524
 
525 525
 						/**
526 526
 						 * insert page in option if missing.
527 527
 						 *
528 528
 						 * check success_page setting in general settings.
529 529
 						 */
530
-						if(
531
-							isset( $value['attributes' ] ) &&
532
-							false !== strpos( $value['class'], 'give-select-chosen' ) &&
533
-							in_array( 'data-search-type', array_keys( $value['attributes' ] ) ) &&
534
-							'pages' == $value['attributes' ]['data-search-type'] &&
535
-							! in_array( $option_value, array_keys( $value['options'] ) )
530
+						if (
531
+							isset($value['attributes']) &&
532
+							false !== strpos($value['class'], 'give-select-chosen') &&
533
+							in_array('data-search-type', array_keys($value['attributes'])) &&
534
+							'pages' == $value['attributes']['data-search-type'] &&
535
+							! in_array($option_value, array_keys($value['options']))
536 536
 						) {
537
-							$value['options'][$option_value] = get_the_title( $option_value );
537
+							$value['options'][$option_value] = get_the_title($option_value);
538 538
 						}
539 539
 						?>
540
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
540
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
541 541
 							<th scope="row" class="titledesc">
542
-								<label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
542
+								<label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
543 543
 							</th>
544
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
544
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
545 545
 								<select
546
-									name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>"
547
-									id="<?php echo esc_attr( $value['id'] ); ?>"
548
-									style="<?php echo esc_attr( $value['css'] ); ?>"
549
-									class="<?php echo esc_attr( $value['class'] ); ?>"
550
-									<?php echo implode( ' ', $custom_attributes ); ?>
551
-									<?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?>
546
+									name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') echo '[]'; ?>"
547
+									id="<?php echo esc_attr($value['id']); ?>"
548
+									style="<?php echo esc_attr($value['css']); ?>"
549
+									class="<?php echo esc_attr($value['class']); ?>"
550
+									<?php echo implode(' ', $custom_attributes); ?>
551
+									<?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?>
552 552
 								>
553 553
 
554 554
 									<?php
555
-									if ( ! empty( $value['options'] ) ) {
556
-										foreach ( $value['options'] as $key => $val ) {
555
+									if ( ! empty($value['options'])) {
556
+										foreach ($value['options'] as $key => $val) {
557 557
 											?>
558
-											<option value="<?php echo esc_attr( $key ); ?>" <?php
558
+											<option value="<?php echo esc_attr($key); ?>" <?php
559 559
 
560
-											if ( is_array( $option_value ) ) {
561
-												selected( in_array( $key, $option_value ), true );
560
+											if (is_array($option_value)) {
561
+												selected(in_array($key, $option_value), true);
562 562
 											} else {
563
-												selected( $option_value, $key );
563
+												selected($option_value, $key);
564 564
 											}
565 565
 
566 566
 											?>><?php echo $val ?></option>
@@ -576,29 +576,29 @@  discard block
 block discarded – undo
576 576
 
577 577
 					// Radio inputs.
578 578
 					case 'radio_inline' :
579
-						$value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline';
579
+						$value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline';
580 580
 					case 'radio' :
581
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
581
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
582 582
 						?>
583
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
583
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
584 584
 							<th scope="row" class="titledesc">
585 585
 								<label
586
-									for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
586
+									for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
587 587
 							</th>
588
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
588
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
589 589
 								<fieldset>
590 590
 									<ul>
591 591
 										<?php
592
-										foreach ( $value['options'] as $key => $val ) {
592
+										foreach ($value['options'] as $key => $val) {
593 593
 											?>
594 594
 											<li>
595 595
 												<label><input
596
-														name="<?php echo esc_attr( $value['id'] ); ?>"
596
+														name="<?php echo esc_attr($value['id']); ?>"
597 597
 														value="<?php echo $key; ?>"
598 598
 														type="radio"
599
-														style="<?php echo esc_attr( $value['css'] ); ?>"
600
-														<?php echo implode( ' ', $custom_attributes ); ?>
601
-														<?php checked( $key, $option_value ); ?>
599
+														style="<?php echo esc_attr($value['css']); ?>"
600
+														<?php echo implode(' ', $custom_attributes); ?>
601
+														<?php checked($key, $option_value); ?>
602 602
 													/> <?php echo $val ?></label>
603 603
 											</li>
604 604
 											<?php
@@ -612,22 +612,22 @@  discard block
 block discarded – undo
612 612
 
613 613
 					// Checkbox input.
614 614
 					case 'checkbox' :
615
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
615
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
616 616
 						?>
617
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
617
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
618 618
 							<th scope="row" class="titledesc">
619 619
 								<label
620
-									for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
620
+									for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
621 621
 							</th>
622 622
 							<td class="give-forminp">
623 623
 								<input
624
-									name="<?php echo esc_attr( $value['id'] ); ?>"
625
-									id="<?php echo esc_attr( $value['id'] ); ?>"
624
+									name="<?php echo esc_attr($value['id']); ?>"
625
+									id="<?php echo esc_attr($value['id']); ?>"
626 626
 									type="checkbox"
627
-									class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>"
627
+									class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>"
628 628
 									value="1"
629
-									<?php checked( $option_value, 'on' ); ?>
630
-									<?php echo implode( ' ', $custom_attributes ); ?>
629
+									<?php checked($option_value, 'on'); ?>
630
+									<?php echo implode(' ', $custom_attributes); ?>
631 631
 								/>
632 632
 								<?php echo $description; ?>
633 633
 							</td>
@@ -637,29 +637,29 @@  discard block
 block discarded – undo
637 637
 
638 638
 					// Multi Checkbox input.
639 639
 					case 'multicheck' :
640
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
641
-						$option_value = is_array( $option_value ) ? $option_value : array();
640
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
641
+						$option_value = is_array($option_value) ? $option_value : array();
642 642
 						?>
643
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
643
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
644 644
 							<th scope="row" class="titledesc">
645 645
 								<label
646
-									for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
646
+									for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
647 647
 							</th>
648
-							<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>">
648
+							<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>">
649 649
 								<fieldset>
650 650
 									<ul>
651 651
 										<?php
652
-										foreach ( $value['options'] as $key => $val ) {
652
+										foreach ($value['options'] as $key => $val) {
653 653
 											?>
654 654
 											<li>
655 655
 												<label>
656 656
 													<input
657
-														name="<?php echo esc_attr( $value['id'] ); ?>[]"
657
+														name="<?php echo esc_attr($value['id']); ?>[]"
658 658
 														value="<?php echo $key; ?>"
659 659
 														type="checkbox"
660
-														style="<?php echo esc_attr( $value['css'] ); ?>"
661
-														<?php echo implode( ' ', $custom_attributes ); ?>
662
-														<?php if ( in_array( $key, $option_value ) ) {
660
+														style="<?php echo esc_attr($value['css']); ?>"
661
+														<?php echo implode(' ', $custom_attributes); ?>
662
+														<?php if (in_array($key, $option_value)) {
663 663
 															echo 'checked="checked"';
664 664
 														} ?>
665 665
 													/> <?php echo $val ?>
@@ -678,31 +678,31 @@  discard block
 block discarded – undo
678 678
 					// File input field.
679 679
 					case 'file' :
680 680
 					case 'media' :
681
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
682
-						$button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $value['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) );
683
-						$fvalue       = empty( $value['fvalue'] ) ? 'url' : $value['fvalue'];
684
-
685
-						$allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );
686
-						$preview_image_src        = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '';
687
-						$preview_image_extension  = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';
688
-						$is_show_preview          = in_array( $preview_image_extension, $allow_media_preview_tags );
681
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
682
+						$button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $value['type'] ? __('File', 'give') : __('Image', 'give')));
683
+						$fvalue       = empty($value['fvalue']) ? 'url' : $value['fvalue'];
684
+
685
+						$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico');
686
+						$preview_image_src        = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '';
687
+						$preview_image_extension  = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';
688
+						$is_show_preview          = in_array($preview_image_extension, $allow_media_preview_tags);
689 689
 						?>
690
-						<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
690
+						<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
691 691
 							<th scope="row" class="titledesc">
692 692
 								<label
693
-									for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
693
+									for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
694 694
 							</th>
695 695
 							<td class="give-forminp">
696 696
 								<div class="give-field-wrap">
697 697
 									<label for="<?php echo $value['id'] ?>">
698 698
 										<input
699
-											name="<?php echo esc_attr( $value['id'] ); ?>"
700
-											id="<?php echo esc_attr( $value['id'] ); ?>"
699
+											name="<?php echo esc_attr($value['id']); ?>"
700
+											id="<?php echo esc_attr($value['id']); ?>"
701 701
 											type="text"
702
-											class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>"
702
+											class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>"
703 703
 											value="<?php echo $option_value; ?>"
704
-											style="<?php echo esc_attr( $value['css'] ); ?>"
705
-											<?php echo implode( ' ', $custom_attributes ); ?>
704
+											style="<?php echo esc_attr($value['css']); ?>"
705
+											<?php echo implode(' ', $custom_attributes); ?>
706 706
 										/>&nbsp;&nbsp;&nbsp;&nbsp;<input class="give-upload-button button" type="button"
707 707
 										                                 data-fvalue="<?php echo $fvalue; ?>"
708 708
 										                                 data-field-type="<?php echo $value['type']; ?>"
@@ -723,18 +723,18 @@  discard block
 block discarded – undo
723 723
 					// WordPress Editor.
724 724
 					case 'wysiwyg' :
725 725
 						// Get option value.
726
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
726
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
727 727
 
728 728
 						// Get editor settings.
729
-						$editor_settings = ! empty( $value['options'] ) ? $value['options'] : array();
729
+						$editor_settings = ! empty($value['options']) ? $value['options'] : array();
730 730
 						?>
731
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
731
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
732 732
 						<th scope="row" class="titledesc">
733 733
 							<label
734
-								for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
734
+								for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
735 735
 						</th>
736 736
 						<td class="give-forminp">
737
-							<?php wp_editor( $option_value, $value['id'], $editor_settings ); ?>
737
+							<?php wp_editor($option_value, $value['id'], $editor_settings); ?>
738 738
 							<?php echo $description; ?>
739 739
 						</td>
740 740
 						</tr><?php
@@ -742,15 +742,15 @@  discard block
 block discarded – undo
742 742
 
743 743
 					// Custom: Default gateways setting field.
744 744
 					case 'default_gateway' :
745
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
745
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
746 746
 						?>
747
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
747
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
748 748
 						<th scope="row" class="titledesc">
749 749
 							<label
750
-								for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
750
+								for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
751 751
 						</th>
752 752
 						<td class="give-forminp">
753
-							<?php give_default_gateway_callback( $value, $option_value ); ?>
753
+							<?php give_default_gateway_callback($value, $option_value); ?>
754 754
 							<?php echo $description; ?>
755 755
 						</td>
756 756
 						</tr><?php
@@ -759,13 +759,13 @@  discard block
 block discarded – undo
759 759
 					// Custom: Email preview buttons field.
760 760
 					case 'email_preview_buttons' :
761 761
 						?>
762
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
762
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
763 763
 						<th scope="row" class="titledesc">
764 764
 							<label
765
-								for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
765
+								for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
766 766
 						</th>
767 767
 						<td class="give-forminp">
768
-							<?php give_email_preview_buttons_callback( $value ); ?>
768
+							<?php give_email_preview_buttons_callback($value); ?>
769 769
 							<?php echo $description; ?>
770 770
 						</td>
771 771
 						</tr><?php
@@ -779,23 +779,23 @@  discard block
 block discarded – undo
779 779
 
780 780
 					// Custom: Gateway API key.
781 781
 					case 'api_key' :
782
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
783
-						$type         = ! empty( $option_value ) ? 'password' : 'text';
782
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
783
+						$type         = ! empty($option_value) ? 'password' : 'text';
784 784
 						?>
785
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
785
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
786 786
 						<th scope="row" class="titledesc">
787 787
 							<label
788
-								for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label>
788
+								for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label>
789 789
 						</th>
790
-						<td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>">
790
+						<td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>">
791 791
 							<input
792
-								name="<?php echo esc_attr( $value['id'] ); ?>"
793
-								id="<?php echo esc_attr( $value['id'] ); ?>"
794
-								type="<?php echo esc_attr( $type ); ?>"
795
-								style="<?php echo esc_attr( $value['css'] ); ?>"
796
-								value="<?php echo esc_attr( trim( $option_value ) ); ?>"
797
-								class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>"
798
-								<?php echo implode( ' ', $custom_attributes ); ?>
792
+								name="<?php echo esc_attr($value['id']); ?>"
793
+								id="<?php echo esc_attr($value['id']); ?>"
794
+								type="<?php echo esc_attr($type); ?>"
795
+								style="<?php echo esc_attr($value['css']); ?>"
796
+								value="<?php echo esc_attr(trim($option_value)); ?>"
797
+								class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>"
798
+								<?php echo implode(' ', $custom_attributes); ?>
799 799
 							/> <?php echo $description; ?>
800 800
 						</td>
801 801
 						</tr><?php
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 						 *
813 813
 						 * @since 1.0
814 814
 						 */
815
-						do_action( "give_logs_view_{$current_section}" );
815
+						do_action("give_logs_view_{$current_section}");
816 816
 
817 817
 						echo $description;
818 818
 						break;
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 					// Custom: Data field.
821 821
 					case 'data' :
822 822
 
823
-						include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php';
823
+						include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php';
824 824
 
825 825
 						echo $description;
826 826
 						break;
@@ -828,12 +828,12 @@  discard block
 block discarded – undo
828 828
 					// Custom: Give Docs Link field type.
829 829
 					case 'give_docs_link' :
830 830
 						?>
831
-					<tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>>
831
+					<tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>>
832 832
 						<td class="give-docs-link" colspan="2">
833 833
 							<?php
834
-							echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] )
834
+							echo '<p class="give-docs-link"><a href="'.esc_url($value['url'])
835 835
 							     . '" target="_blank">'
836
-							     . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] )
836
+							     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title'])
837 837
 							     . '<span class="dashicons dashicons-editor-help"></span></a></p>';
838 838
 							?>
839 839
 						</td>
@@ -844,8 +844,8 @@  discard block
 block discarded – undo
844 844
 					// You can add or handle your custom field action.
845 845
 					default:
846 846
 						// Get option value.
847
-						$option_value = self::get_option( $option_name, $value['id'], $value['default'] );
848
-						do_action( 'give_admin_field_' . $value['type'], $value, $option_value );
847
+						$option_value = self::get_option($option_name, $value['id'], $value['default']);
848
+						do_action('give_admin_field_'.$value['type'], $value, $option_value);
849 849
 						break;
850 850
 				}
851 851
 			}
@@ -861,15 +861,15 @@  discard block
 block discarded – undo
861 861
 		 *
862 862
 		 * @return string The HTML description of the field.
863 863
 		 */
864
-		public static function get_field_description( $value ) {
864
+		public static function get_field_description($value) {
865 865
 			$description = '';
866 866
 
867 867
 			// Support for both 'description' and 'desc' args.
868
-			$description_key = isset( $value['description'] ) ? 'description' : 'desc';
869
-			$value           = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : '';
868
+			$description_key = isset($value['description']) ? 'description' : 'desc';
869
+			$value           = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : '';
870 870
 
871
-			if ( ! empty( $value ) ) {
872
-				$description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>';
871
+			if ( ! empty($value)) {
872
+				$description = '<div class="give-field-description">'.wp_kses_post($value).'</div>';
873 873
 			}
874 874
 
875 875
 			return $description;
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
 		 *
887 887
 		 * @return array The description and tip as a 2 element array
888 888
 		 */
889
-		public static function get_field_title( $value ) {
890
-			$title = esc_html( $value['title'] );
889
+		public static function get_field_title($value) {
890
+			$title = esc_html($value['title']);
891 891
 
892 892
 			// If html tag detected then allow them to print.
893
-			if ( strip_tags( $title ) ) {
893
+			if (strip_tags($title)) {
894 894
 				$title = $value['title'];
895 895
 			}
896 896
 
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
 		 *
910 910
 		 * @return bool
911 911
 		 */
912
-		public static function save_fields( $options, $option_name = '' ) {
913
-			if ( empty( $_POST ) ) {
912
+		public static function save_fields($options, $option_name = '') {
913
+			if (empty($_POST)) {
914 914
 				return false;
915 915
 			}
916 916
 
@@ -918,37 +918,37 @@  discard block
 block discarded – undo
918 918
 			$update_options = array();
919 919
 
920 920
 			// Loop options and get values to save.
921
-			foreach ( $options as $option ) {
922
-				if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) {
921
+			foreach ($options as $option) {
922
+				if ( ! isset($option['id']) || ! isset($option['type'])) {
923 923
 					continue;
924 924
 				}
925 925
 
926 926
 				// Get posted value.
927
-				if ( strstr( $option['id'], '[' ) ) {
928
-					parse_str( $option['id'], $option_name_array );
929
-					$field_option_name = current( array_keys( $option_name_array ) );
930
-					$setting_name      = key( $option_name_array[ $field_option_name ] );
931
-					$raw_value         = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null;
927
+				if (strstr($option['id'], '[')) {
928
+					parse_str($option['id'], $option_name_array);
929
+					$field_option_name = current(array_keys($option_name_array));
930
+					$setting_name      = key($option_name_array[$field_option_name]);
931
+					$raw_value         = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null;
932 932
 				} else {
933 933
 					$field_option_name = $option['id'];
934 934
 					$setting_name      = '';
935
-					$raw_value         = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null;
935
+					$raw_value         = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null;
936 936
 				}
937 937
 
938 938
 				// Format the value based on option type.
939
-				switch ( $option['type'] ) {
939
+				switch ($option['type']) {
940 940
 					case 'checkbox' :
941
-						$value = is_null( $raw_value ) ? '' : 'on';
941
+						$value = is_null($raw_value) ? '' : 'on';
942 942
 						break;
943 943
 					case 'wysiwyg'  :
944 944
 					case 'textarea' :
945
-						$value = wp_kses_post( trim( $raw_value ) );
945
+						$value = wp_kses_post(trim($raw_value));
946 946
 						break;
947 947
 					case 'multiselect' :
948
-						$value = array_filter( array_map( 'give_clean', (array) $raw_value ) );
948
+						$value = array_filter(array_map('give_clean', (array) $raw_value));
949 949
 						break;
950 950
 					default :
951
-						$value = give_clean( $raw_value );
951
+						$value = give_clean($raw_value);
952 952
 						break;
953 953
 				}
954 954
 
@@ -957,37 +957,37 @@  discard block
 block discarded – undo
957 957
 				 *
958 958
 				 * @since 1.8
959 959
 				 */
960
-				$value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value );
960
+				$value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value);
961 961
 
962 962
 				/**
963 963
 				 * Sanitize the value of an option by option name.
964 964
 				 *
965 965
 				 * @since 1.8
966 966
 				 */
967
-				$value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value );
967
+				$value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value);
968 968
 
969
-				if ( is_null( $value ) ) {
969
+				if (is_null($value)) {
970 970
 					continue;
971 971
 				}
972 972
 
973 973
 				// Check if option is an array and handle that differently to single values.
974
-				if ( $field_option_name && $setting_name ) {
975
-					if ( ! isset( $update_options[ $field_option_name ] ) ) {
976
-						$update_options[ $field_option_name ] = get_option( $field_option_name, array() );
974
+				if ($field_option_name && $setting_name) {
975
+					if ( ! isset($update_options[$field_option_name])) {
976
+						$update_options[$field_option_name] = get_option($field_option_name, array());
977 977
 					}
978
-					if ( ! is_array( $update_options[ $field_option_name ] ) ) {
979
-						$update_options[ $field_option_name ] = array();
978
+					if ( ! is_array($update_options[$field_option_name])) {
979
+						$update_options[$field_option_name] = array();
980 980
 					}
981
-					$update_options[ $field_option_name ][ $setting_name ] = $value;
981
+					$update_options[$field_option_name][$setting_name] = $value;
982 982
 				} else {
983
-					$update_options[ $field_option_name ] = $value;
983
+					$update_options[$field_option_name] = $value;
984 984
 				}
985 985
 			}
986 986
 
987 987
 			// Save all options in our array or there own option name i.e. option id.
988
-			if ( empty( $option_name ) ) {
989
-				foreach ( $update_options as $name => $value ) {
990
-					update_option( $name, $value );
988
+			if (empty($option_name)) {
989
+				foreach ($update_options as $name => $value) {
990
+					update_option($name, $value);
991 991
 
992 992
 					/**
993 993
 					 * Trigger action.
@@ -996,13 +996,13 @@  discard block
 block discarded – undo
996 996
 					 *
997 997
 					 * @since 1.8
998 998
 					 */
999
-					do_action( "give_save_option_{$name}", $value, $name );
999
+					do_action("give_save_option_{$name}", $value, $name);
1000 1000
 				}
1001 1001
 			} else {
1002
-				$old_options    = ( $old_options = get_option( $option_name ) ) ? $old_options : array();
1003
-				$update_options = array_merge( $old_options, $update_options );
1002
+				$old_options    = ($old_options = get_option($option_name)) ? $old_options : array();
1003
+				$update_options = array_merge($old_options, $update_options);
1004 1004
 
1005
-				update_option( $option_name, $update_options );
1005
+				update_option($option_name, $update_options);
1006 1006
 
1007 1007
 				/**
1008 1008
 				 * Trigger action.
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 				 *
1012 1012
 				 * @since 1.8
1013 1013
 				 */
1014
-				do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options );
1014
+				do_action("give_save_settings_{$option_name}", $update_options, $option_name, $old_options);
1015 1015
 			}
1016 1016
 
1017 1017
 			return true;
@@ -1040,21 +1040,21 @@  discard block
 block discarded – undo
1040 1040
 		 *
1041 1041
 		 * @return bool
1042 1042
 		 */
1043
-		public static function is_setting_page( $tab = '', $section = '' ) {
1043
+		public static function is_setting_page($tab = '', $section = '') {
1044 1044
 			$is_setting_page = false;
1045 1045
 
1046
-			if( ! is_admin() ) {
1046
+			if ( ! is_admin()) {
1047 1047
 				return $is_setting_page;
1048 1048
 			}
1049 1049
 
1050 1050
 			// Check fo setting tab.
1051
-			if ( ! empty( $tab ) ) {
1052
-				$is_setting_page = ( $tab === give_get_current_setting_tab() );
1051
+			if ( ! empty($tab)) {
1052
+				$is_setting_page = ($tab === give_get_current_setting_tab());
1053 1053
 			}
1054 1054
 
1055 1055
 			// Check fo setting section.
1056
-			if ( ! empty( $section ) ) {
1057
-				$is_setting_page = ( $section === give_get_current_setting_section() );
1056
+			if ( ! empty($section)) {
1057
+				$is_setting_page = ($section === give_get_current_setting_section());
1058 1058
 			}
1059 1059
 
1060 1060
 			return $is_setting_page;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-license.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_License' ) ) :
16
+if ( ! class_exists('Give_Settings_License')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_License.
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'licenses';
30
-			$this->label = esc_html__( 'Licenses', 'give' );
30
+			$this->label = esc_html__('Licenses', 'give');
31 31
 
32 32
 			parent::__construct();
33 33
 
34 34
 			// Filter to remove the license tab.
35
-			add_filter( 'give-settings_tabs_array', array( $this, 'remove_license_tab' ), 9999999, 1 );
35
+			add_filter('give-settings_tabs_array', array($this, 'remove_license_tab'), 9999999, 1);
36 36
 
37 37
 		}
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 			 * Filter the licenses settings.
50 50
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
51 51
 			 */
52
-			$settings = apply_filters( 'give_settings_licenses', $settings );
52
+			$settings = apply_filters('give_settings_licenses', $settings);
53 53
 
54 54
 			/**
55 55
 			 * Filter the settings.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			 *
59 59
 			 * @param  array $settings
60 60
 			 */
61
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
61
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
62 62
 
63 63
 			// Output.
64 64
 			return $settings;
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 		 *
75 75
 		 * @return array
76 76
 		 */
77
-		public function remove_license_tab( $tabs ) {
77
+		public function remove_license_tab($tabs) {
78 78
 			/**
79 79
 			 * Remove the license tab if no Give licensed addon
80 80
 			 * is activated.
81 81
 			 */
82
-			if ( ! $this->is_show_setting_page() ) {
83
-				unset( $tabs['licenses'] );
82
+			if ( ! $this->is_show_setting_page()) {
83
+				unset($tabs['licenses']);
84 84
 			}
85 85
 
86 86
 			return $tabs;
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 		 */
98 98
 		private function is_show_setting_page() {
99 99
 			$licensed_addons   = Give_License::get_licensed_addons();
100
-			$activated_plugins = get_option( 'active_plugins', array() );
100
+			$activated_plugins = get_option('active_plugins', array());
101 101
 
102
-			return (bool) count( array_intersect( $activated_plugins, $licensed_addons ) );
102
+			return (bool) count(array_intersect($activated_plugins, $licensed_addons));
103 103
 		}
104 104
 	}
105 105
 
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-cmb2-backward-compatibility.php 1 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/admin/emails/class-donation-receipt-email.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donation_Receipt_Email' ) ) :
18
+if ( ! class_exists('Give_Donation_Receipt_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donation_Receipt_Email
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                   => 'donation-receipt',
42
-				'label'                => __( 'Donation Receipt', 'give' ),
43
-				'description'          => __( 'Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give' ),
42
+				'label'                => __('Donation Receipt', 'give'),
43
+				'description'          => __('Sent to the donor when their donation completes or a pending donation is marked as complete.', 'give'),
44 44
 				'notification_status'  => 'enabled',
45 45
 				'form_metabox_setting' => true,
46
-				'recipient_group_name' => __( 'Donor', 'give' ),
47
-				'default_email_subject' => esc_attr__( 'Donation Receipt', 'give' ),
46
+				'recipient_group_name' => __('Donor', 'give'),
47
+				'default_email_subject' => esc_attr__('Donation Receipt', 'give'),
48 48
 				'default_email_message' => give_get_default_donation_receipt_email(),
49
-				'default_email_header'  => __( 'Donation Receipt', 'give' ),
50
-			) );
49
+				'default_email_header'  => __('Donation Receipt', 'give'),
50
+			));
51 51
 
52
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_donation_receipt' ) );
53
-			add_action( 'give_email_links', array( $this, 'resend_donation_receipt' ) );
52
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_donation_receipt'));
53
+			add_action('give_email_links', array($this, 'resend_donation_receipt'));
54 54
 		}
55 55
 
56 56
 		/**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		 * @param int $form_id
63 63
 		 * @return string
64 64
 		 */
65
-		public function get_email_subject( $form_id = null ) {
65
+		public function get_email_subject($form_id = null) {
66 66
 			$subject = wp_strip_all_tags(
67 67
 				Give_Email_Notification_Util::get_value(
68 68
 					$this,
69
-					Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject',
69
+					Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject',
70 70
 					$form_id,
71 71
 					$this->config['default_email_subject']
72 72
 				)
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 		 * @param int $form_id
110 110
 		 * @return string
111 111
 		 */
112
-		public function get_email_message( $form_id = null ) {
112
+		public function get_email_message($form_id = null) {
113 113
 			$message = Give_Email_Notification_Util::get_value(
114 114
 				$this,
115
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
115
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
116 116
 				$form_id,
117 117
 				$this->config['default_email_message']
118 118
 			);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			 * @since 1.0
125 125
 			 */
126 126
 			$message = apply_filters(
127
-				'give_donation_receipt_' . Give()->emails->get_template(),
127
+				'give_donation_receipt_'.Give()->emails->get_template(),
128 128
 				$message,
129 129
 				$this->payment->ID,
130 130
 				$this->payment->payment_meta
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		 * @param int $form_id
168 168
 		 * @return array
169 169
 		 */
170
-		public function get_email_attachments( $form_id = null) {
170
+		public function get_email_attachments($form_id = null) {
171 171
 			/**
172 172
 			 * Filter the attachments.
173 173
 			 * Note: this filter will deprecate soon.
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 				$this->payment->payment_meta
237 237
 			);
238 238
 
239
-			Give()->emails->__set( 'from_name', $from_name );
240
-			Give()->emails->__set( 'from_email', $from_email );
241
-			Give()->emails->__set( 'heading', $this->get_email_header() );
239
+			Give()->emails->__set('from_name', $from_name);
240
+			Give()->emails->__set('from_email', $from_email);
241
+			Give()->emails->__set('heading', $this->get_email_header());
242 242
 
243 243
 			/**
244 244
 			 * Filters the donation receipt's email headers.
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 				$this->payment->payment_meta
256 256
 			);
257 257
 
258
-			Give()->emails->__set( 'headers', $headers );
258
+			Give()->emails->__set('headers', $headers);
259 259
 		}
260 260
 
261 261
 		/**
@@ -266,16 +266,16 @@  discard block
 block discarded – undo
266 266
 		 *
267 267
 		 * @param $payment_id
268 268
 		 */
269
-		public function send_donation_receipt( $payment_id ) {
270
-			$this->payment = new Give_Payment( $payment_id );
269
+		public function send_donation_receipt($payment_id) {
270
+			$this->payment = new Give_Payment($payment_id);
271 271
 
272 272
 			// Setup email data.
273 273
 			$this->setup_email_data();
274 274
 
275 275
 			// Send email.
276
-			$this->send_email_notification( array(
276
+			$this->send_email_notification(array(
277 277
 				'payment_id' => $this->payment->ID,
278
-			) );
278
+			));
279 279
 		}
280 280
 
281 281
 		/**
@@ -286,35 +286,35 @@  discard block
 block discarded – undo
286 286
 		 *
287 287
 		 * @param array $data Donation details.
288 288
 		 */
289
-		public function resend_donation_receipt( $data ) {
290
-			$purchase_id = absint( $data['purchase_id'] );
289
+		public function resend_donation_receipt($data) {
290
+			$purchase_id = absint($data['purchase_id']);
291 291
 
292
-			if ( empty( $purchase_id ) ) {
292
+			if (empty($purchase_id)) {
293 293
 				return;
294 294
 			}
295 295
 
296 296
 			// Get donation payment information.
297
-			$this->payment = new Give_Payment( $purchase_id );
297
+			$this->payment = new Give_Payment($purchase_id);
298 298
 
299
-			if ( ! current_user_can( 'edit_give_payments', $this->payment->ID ) ) {
300
-				wp_die( esc_html__( 'You do not have permission to edit donations.', 'give' ), esc_html__( 'Error', 'give' ), array(
299
+			if ( ! current_user_can('edit_give_payments', $this->payment->ID)) {
300
+				wp_die(esc_html__('You do not have permission to edit donations.', 'give'), esc_html__('Error', 'give'), array(
301 301
 					'response' => 403,
302
-				) );
302
+				));
303 303
 			}
304 304
 
305 305
 			// Setup email data.
306 306
 			$this->setup_email_data();
307 307
 
308 308
 			// Send email.
309
-			$this->send_email_notification( array(
309
+			$this->send_email_notification(array(
310 310
 				'payment_id' => $this->payment->ID,
311
-			) );
311
+			));
312 312
 
313
-			wp_redirect( add_query_arg( array(
313
+			wp_redirect(add_query_arg(array(
314 314
 				'give-messages[]' => 'email-sent',
315 315
 				'give-action'     => false,
316 316
 				'purchase_id'     => false,
317
-			) ) );
317
+			)));
318 318
 			exit;
319 319
 		}
320 320
 	}
Please login to merge, or discard this patch.
includes/admin/emails/filters.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return array
21 21
  */
22
-function give_email_notification_row_actions_callback( $row_actions, $email ) {
23
-	if( Give_Email_Notification_Util::is_email_preview( $email ) ) {
22
+function give_email_notification_row_actions_callback($row_actions, $email) {
23
+	if (Give_Email_Notification_Util::is_email_preview($email)) {
24 24
 		$preview_link = sprintf(
25 25
 			'<a href="%1$s" target="_blank">%2$s</a>',
26 26
 			wp_nonce_url(
27 27
 				add_query_arg(
28
-					array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ),
28
+					array('give_action' => 'preview_email', 'email_type' => $email->config['id']),
29 29
 					home_url()
30 30
 				), 'give-preview-email'
31 31
 			),
32
-			__( 'Preview', 'give' )
32
+			__('Preview', 'give')
33 33
 		);
34 34
 
35 35
 		$send_preview_email_link = sprintf(
36 36
 			'<a href="%1$s">%2$s</a>',
37 37
 			wp_nonce_url(
38
-				add_query_arg( array(
38
+				add_query_arg(array(
39 39
 					'give_action'  => 'send_preview_email',
40 40
 					'email_type' => $email->config['id'],
41 41
 					'give-messages[]' => 'sent-test-email',
42
-				) ), 'give-send-preview-email' ),
43
-			__( 'Send test email', 'give' )
42
+				)), 'give-send-preview-email' ),
43
+			__('Send test email', 'give')
44 44
 		);
45 45
 
46 46
 		$row_actions['email_preview'] = $preview_link;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	return $row_actions;
51 51
 }
52
-add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 );
52
+add_filter('give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2);
53 53
 
54 54
 /**
55 55
  * This help to decode all email template tags.
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string
63 63
  */
64
-function give_decode_email_tags( $message, $email_obj ) {
65
-	if ( ! empty( $email_obj->tag_args ) ) {
66
-		$message = give_do_email_tags( $message, $email_obj->tag_args );
64
+function give_decode_email_tags($message, $email_obj) {
65
+	if ( ! empty($email_obj->tag_args)) {
66
+		$message = give_do_email_tags($message, $email_obj->tag_args);
67 67
 	}
68 68
 
69 69
 	return $message;
70 70
 }
71 71
 
72
-add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 );
73 72
\ No newline at end of file
73
+add_filter('give_email_message', 'give_decode_email_tags', 10, 2);
74 74
\ No newline at end of file
Please login to merge, or discard this patch.