Completed
Pull Request — master (#1857)
by Mehul
18:30
created
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 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
 
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_set_settings_with_disable_prefix( $old_settings, $settings ) {
29
+function give_set_settings_with_disable_prefix($old_settings, $settings) {
30 30
 	// Get old setting names.
31
-	$old_settings   = array_flip( give_v18_renamed_core_settings() );
31
+	$old_settings   = array_flip(give_v18_renamed_core_settings());
32 32
 	$update_setting = false;
33 33
 
34
-	foreach ( $settings as $key => $value ) {
34
+	foreach ($settings as $key => $value) {
35 35
 
36 36
 		// Check 1. Check if new option is really updated or not.
37 37
 		// Check 2. Continue if key is not renamed.
38
-		if ( ! isset( $old_settings[ $key ] ) ) {
38
+		if ( ! isset($old_settings[$key])) {
39 39
 			continue;
40 40
 		}
41 41
 
42 42
 		// Set old setting.
43
-		$settings[ $old_settings[ $key ] ] = 'on';
43
+		$settings[$old_settings[$key]] = 'on';
44 44
 
45 45
 		// Do not need to set old setting if new setting is not set.
46 46
 		if (
47
-			( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) )
48
-			|| ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) )
47
+			(give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_')))
48
+			|| ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_')))
49 49
 
50 50
 		) {
51
-			unset( $settings[ $old_settings[ $key ] ] );
51
+			unset($settings[$old_settings[$key]]);
52 52
 		}
53 53
 
54 54
 		// Tell bot to update setting.
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	// Update setting if any old setting set.
59
-	if ( $update_setting ) {
60
-		update_option( 'give_settings', $settings );
59
+	if ($update_setting) {
60
+		update_option('give_settings', $settings);
61 61
 	}
62 62
 }
63
-add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 );
63
+add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2);
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Sets an error within the donation form if no gateways are enabled.
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 function give_no_gateway_error() {
64 64
 	$gateways = give_get_enabled_payment_gateways();
65 65
 
66
-	if ( empty( $gateways ) ) {
67
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
66
+	if (empty($gateways)) {
67
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
68 68
 	} else {
69
-		give_unset_error( 'no_gateways' );
69
+		give_unset_error('no_gateways');
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'init', 'give_no_gateway_error' );
73
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
includes/admin/reporting/class-donor-reports-table.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 	 *
144 144
 	 * @access public
145 145
 	 * @since  1.0
146
-	 * @return mixed string If search is present, false otherwise
146
+	 * @return string|false string If search is present, false otherwise
147 147
 	 */
148 148
 	public function get_search() {
149 149
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -185,8 +185,8 @@
 block discarded – undo
185 185
 				
186 186
 			case 'num_donations' :
187 187
 				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
188
+						 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
+						 ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
68
-			'ajax'     => false,// Does this table support ajax?
69
-		) );
65
+		parent::__construct(array(
66
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
68
+			'ajax'     => false, // Does this table support ajax?
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return false;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search" role="search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,33 +124,33 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' === $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' === $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<?php if ( 'top' === $which ) { ?>
135
+			<?php if ('top' === $which) { ?>
136 136
 				<h3 class="alignleft reports-earnings-title">
137
-					<span><?php esc_html_e( 'Donors Report', 'give' ); ?></span>
137
+					<span><?php esc_html_e('Donors Report', 'give'); ?></span>
138 138
 				</h3>
139 139
 			<?php } ?>
140 140
 
141 141
 			<div class="alignright tablenav-right">
142 142
 				<div class="actions bulkactions">
143 143
 					<?php
144
-					if ( 'top' === $which ) {
145
-						$this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' );
144
+					if ('top' === $which) {
145
+						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search');
146 146
 					}
147 147
 
148
-					$this->bulk_actions( $which ); ?>
148
+					$this->bulk_actions($which); ?>
149 149
 
150 150
 				</div>
151 151
 				<?php
152
-				$this->extra_tablenav( $which );
153
-				$this->pagination( $which );
152
+				$this->extra_tablenav($which);
153
+				$this->pagination($which);
154 154
 				?>
155 155
 			</div>
156 156
 
@@ -172,33 +172,33 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string Column Name
174 174
 	 */
175
-	public function column_default( $item, $column_name ) {
175
+	public function column_default($item, $column_name) {
176 176
 
177
-		switch ( $column_name ) {
177
+		switch ($column_name) {
178 178
 
179 179
 			case 'name' :
180
-				$name = '#' . $item['id'] . ' ';
181
-				$name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
182
-				$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] );
183
-				$value    = '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>';
180
+				$name = '#'.$item['id'].' ';
181
+				$name .= ! empty($item['name']) ? $item['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
182
+				$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']);
183
+				$value    = '<a href="'.esc_url($view_url).'">'.$name.'</a>';
184 184
 				break;
185 185
 
186 186
 			case 'num_donations' :
187
-				$value = '<a href="' .
188
-				         admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
189
-				         ) . '">' . esc_html( $item['num_donations'] ) . '</a>';
187
+				$value = '<a href="'.
188
+				         admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
189
+				         ).'">'.esc_html($item['num_donations']).'</a>';
190 190
 				break;
191 191
 
192 192
 			case 'amount_spent' :
193
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
193
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
194 194
 				break;
195 195
 
196 196
 			default:
197
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
197
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
198 198
 				break;
199 199
 		}
200 200
 
201
-		return apply_filters( "give_report_column_{$column_name}", $value, $item['id'] );
201
+		return apply_filters("give_report_column_{$column_name}", $value, $item['id']);
202 202
 	}
203 203
 
204 204
 	/**
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function get_columns() {
212 212
 		$columns = array(
213
-			'name'          => __( 'Name', 'give' ),
214
-			'email'         => __( 'Email', 'give' ),
215
-			'num_donations' => __( 'Donations', 'give' ),
216
-			'amount_spent'  => __( 'Total Donated', 'give' ),
213
+			'name'          => __('Name', 'give'),
214
+			'email'         => __('Email', 'give'),
215
+			'num_donations' => __('Donations', 'give'),
216
+			'amount_spent'  => __('Total Donated', 'give'),
217 217
 		);
218 218
 
219
-		return apply_filters( 'give_report_donor_columns', $columns );
219
+		return apply_filters('give_report_donor_columns', $columns);
220 220
 
221 221
 	}
222 222
 
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function get_sortable_columns() {
231 231
 		return array(
232
-			'id'            => array( 'id', true ),
233
-			'name'          => array( 'name', true ),
234
-			'num_donations' => array( 'purchase_count', false ),
235
-			'amount_spent'  => array( 'purchase_value', false ),
232
+			'id'            => array('id', true),
233
+			'name'          => array('name', true),
234
+			'num_donations' => array('purchase_count', false),
235
+			'amount_spent'  => array('purchase_value', false),
236 236
 		);
237 237
 	}
238 238
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @since  1.0
244 244
 	 * @return void
245 245
 	 */
246
-	public function bulk_actions( $which = '' ) {
246
+	public function bulk_actions($which = '') {
247 247
 
248 248
 	}
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return int Current page number
256 256
 	 */
257 257
 	public function get_paged() {
258
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
258
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
259 259
 	}
260 260
 
261 261
 	/**
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	 * @return mixed string If search is present, false otherwise
267 267
 	 */
268 268
 	public function get_search() {
269
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
269
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
270 270
 	}
271 271
 
272 272
 	/**
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 
286 286
 		// Get donor query.
287 287
 		$args   = $this->get_donor_query();
288
-		$donors = Give()->donors->get_donors( $args );
288
+		$donors = Give()->donors->get_donors($args);
289 289
 
290
-		if ( $donors ) {
290
+		if ($donors) {
291 291
 
292
-			$this->count = count( $donors );
292
+			$this->count = count($donors);
293 293
 
294
-			foreach ( $donors as $donor ) {
294
+			foreach ($donors as $donor) {
295 295
 
296
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
296
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
297 297
 
298 298
 				$data[] = array(
299 299
 					'id'            => $donor->id,
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 		$_donor_query = $this->get_donor_query();
321 321
 
322 322
 		$_donor_query['number'] = -1;
323
-		$donors = Give()->donors->get_donors( $_donor_query );
323
+		$donors = Give()->donors->get_donors($_donor_query);
324 324
 
325
-		return count( $donors );
325
+		return count($donors);
326 326
 	}
327 327
 
328 328
 	/**
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function get_donor_query() {
336 336
 		$paged   = $this->get_paged();
337
-		$offset  = $this->per_page * ( $paged - 1 );
337
+		$offset  = $this->per_page * ($paged - 1);
338 338
 		$search  = $this->get_search();
339
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
340
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
339
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
340
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
341 341
 
342 342
 		$args = array(
343 343
 			'number'  => $this->per_page,
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
 			'orderby' => $orderby,
347 347
 		);
348 348
 
349
-		if( $search ) {
350
-			if ( is_email( $search ) ) {
349
+		if ($search) {
350
+			if (is_email($search)) {
351 351
 				$args['email'] = $search;
352
-			} elseif ( is_numeric( $search ) ) {
352
+			} elseif (is_numeric($search)) {
353 353
 				$args['id'] = $search;
354 354
 			} else {
355 355
 				$args['name'] = $search;
@@ -376,16 +376,16 @@  discard block
 block discarded – undo
376 376
 		$hidden   = array(); // No hidden columns
377 377
 		$sortable = $this->get_sortable_columns();
378 378
 
379
-		$this->_column_headers = array( $columns, $hidden, $sortable );
379
+		$this->_column_headers = array($columns, $hidden, $sortable);
380 380
 
381 381
 		$this->items = $this->reports_data();
382 382
 
383 383
 		$this->total = $this->get_donor_count();
384 384
 
385
-		$this->set_pagination_args( array(
385
+		$this->set_pagination_args(array(
386 386
 			'total_items' => $this->total,
387 387
 			'per_page'    => $this->per_page,
388
-			'total_pages' => ceil( $this->total / $this->per_page ),
389
-		) );
388
+			'total_pages' => ceil($this->total / $this->per_page),
389
+		));
390 390
 	}
391 391
 }
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +22 added lines, -22 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.
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 			// Get current setting page.
63 63
 			$this->current_setting_page = give_get_current_setting_page();
64 64
 
65
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
66
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
67
-			add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) );
68
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
69
-			add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
65
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
66
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
67
+			add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections'));
68
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
69
+			add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
70 70
 		}
71 71
 
72 72
 		/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		 *
79 79
 		 * @return string
80 80
 		 */
81
-		function set_default_setting_tab( $setting_tab ) {
81
+		function set_default_setting_tab($setting_tab) {
82 82
 			return $this->default_tab;
83 83
 		}
84 84
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		 *
92 92
 		 * @return array
93 93
 		 */
94
-		public function add_settings_page( $pages ) {
95
-			$pages[ $this->id ] = $this->label;
94
+		public function add_settings_page($pages) {
95
+			$pages[$this->id] = $this->label;
96 96
 
97 97
 			return $pages;
98 98
 		}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			 *
112 112
 			 * @param  array $settings
113 113
 			 */
114
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
114
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
115 115
 
116 116
 			// Output.
117 117
 			return $settings;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		 * @return array
125 125
 		 */
126 126
 		public function get_sections() {
127
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
127
+			return apply_filters('give_get_sections_'.$this->id, array());
128 128
 		}
129 129
 
130 130
 		/**
@@ -141,29 +141,29 @@  discard block
 block discarded – undo
141 141
 			$sections = $this->get_sections();
142 142
 
143 143
 			// Show section settings only if setting section exist.
144
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
145
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
144
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
145
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
146 146
 				$GLOBALS['give_hide_save_button'] = true;
147 147
 
148 148
 				return;
149 149
 			}
150 150
 
151 151
 			// Bailout.
152
-			if ( empty( $sections ) ) {
152
+			if (empty($sections)) {
153 153
 				return;
154 154
 			}
155 155
 
156
-			if ( is_null( $this->current_setting_page ) ) {
156
+			if (is_null($this->current_setting_page)) {
157 157
 				$this->current_setting_page = give_get_current_setting_page();
158 158
 			}
159 159
 
160 160
 			echo '<ul class="subsubsub">';
161 161
 
162 162
 			// Get section keys.
163
-			$array_keys = array_keys( $sections );
163
+			$array_keys = array_keys($sections);
164 164
 
165
-			foreach ( $sections as $id => $label ) {
166
-				echo '<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> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
165
+			foreach ($sections as $id => $label) {
166
+				echo '<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> '.(end($array_keys) == $id ? '' : '|').' </li>';
167 167
 			}
168 168
 
169 169
 			echo '</ul><br class="clear" /><hr>';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		public function output() {
179 179
 			$settings = $this->get_settings();
180 180
 
181
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
181
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
182 182
 		}
183 183
 
184 184
 		/**
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 			$settings        = $this->get_settings();
192 192
 			$current_section = give_get_current_setting_section();
193 193
 
194
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
194
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
195 195
 
196 196
 			/**
197 197
 			 * Trigger Action
198 198
 			 *
199 199
 			 * @since 1.8
200 200
 			 */
201
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
201
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
202 202
 		}
203 203
 	}
204 204
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-gateways.php 1 patch
Spacing   +16 added lines, -16 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_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'gateways';
46
-			$this->label = esc_html__( 'Donation Methods', 'give' );
46
+			$this->label = esc_html__('Donation Methods', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_gateways',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'gateways',
98
-						'name' => esc_html__( 'Gateways', 'give' ),
98
+						'name' => esc_html__('Gateways', 'give'),
99 99
 						'type' => 'report_gateways',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_gateways_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_gateways');
134
+		public function render_report_gateways_field($field, $option_value) {
135
+			do_action('give_reports_view_gateways');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-donors.php 1 patch
Spacing   +16 added lines, -16 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_Donors' ) ) :
16
+if ( ! class_exists('Give_Settings_Donors')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Donors.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'donors';
46
-			$this->label = esc_html__( 'Donors', 'give' );
46
+			$this->label = esc_html__('Donors', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_donors', array( $this, 'render_report_donors_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_donors', array($this, 'render_report_donors_field'), 10, 2);
51 51
 
52 52
 			// Do not use main donor for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_donors',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'donors',
98
-						'name' => esc_html__( 'Donors', 'give' ),
98
+						'name' => esc_html__('Donors', 'give'),
99 99
 						'type' => 'report_donors',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_donors_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_donors');
134
+		public function render_report_donors_field($field, $option_value) {
135
+			do_action('give_reports_view_donors');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-forms.php 1 patch
Spacing   +16 added lines, -16 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_Forms' ) ) :
16
+if ( ! class_exists('Give_Settings_Forms')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Forms.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'forms';
46
-			$this->label = esc_html__( 'Forms', 'give' );
46
+			$this->label = esc_html__('Forms', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_forms',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'forms',
98
-						'name' => esc_html__( 'Forms', 'give' ),
98
+						'name' => esc_html__('Forms', 'give'),
99 99
 						'type' => 'report_forms',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_forms_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_forms');
134
+		public function render_report_forms_field($field, $option_value) {
135
+			do_action('give_reports_view_forms');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-earnings.php 1 patch
Spacing   +16 added lines, -16 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_Earnings' ) ) :
16
+if ( ! class_exists('Give_Settings_Earnings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Earnings.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'earnings';
46
-			$this->label = esc_html__( 'Income', 'give' );
46
+			$this->label = esc_html__('Income', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_tools_earnings',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'earnings',
98
-						'name' => esc_html__( 'Income', 'give' ),
98
+						'name' => esc_html__('Income', 'give'),
99 99
 						'type' => 'report_earnings',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_earnings_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_earnings' );
134
+		public function render_report_earnings_field($field, $option_value) {
135
+			do_action('give_reports_view_earnings');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.