Completed
Pull Request — master (#893)
by Rami
20:06
created
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since       1.3.0
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) or exit;
11
+defined('ABSPATH') or exit;
12 12
 
13 13
 /**
14 14
  * Class Give_Shortcode_Donation_Form_Goal
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	public function __construct() {
22 22
 
23
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
24
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
23
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
24
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
25 25
 
26
-		parent::__construct( 'give_goal' );
26
+		parent::__construct('give_goal');
27 27
 	}
28 28
 
29 29
 	/**
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 
36 36
 		$create_form_link = sprintf(
37 37
 		/* translators: %s: create new form URL */
38
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
39
-			admin_url( 'post-new.php?post_type=give_forms' )
38
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
39
+			admin_url('post-new.php?post_type=give_forms')
40 40
 		);
41 41
 
42 42
 		return array(
@@ -46,35 +46,35 @@  discard block
 block discarded – undo
46 46
 					'post_type' => 'give_forms',
47 47
 				),
48 48
 				'name'        => 'id',
49
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
50
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
49
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
50
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
51 51
 				'required'    => array(
52
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
53
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ),
52
+					'alert' => esc_html__('You must first select a Form!', 'give'),
53
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link),
54 54
 				),
55 55
 			),
56 56
 			array(
57 57
 				'type' => 'container',
58
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
58
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
59 59
 			),
60 60
 			array(
61 61
 				'type'    => 'listbox',
62 62
 				'name'    => 'show_text',
63
-				'label'   => esc_attr__( 'Show Text:', 'give' ),
64
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
63
+				'label'   => esc_attr__('Show Text:', 'give'),
64
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
65 65
 				'options' => array(
66
-					'true'  => esc_html__( 'Show', 'give' ),
67
-					'false' => esc_html__( 'Hide', 'give' ),
66
+					'true'  => esc_html__('Show', 'give'),
67
+					'false' => esc_html__('Hide', 'give'),
68 68
 				),
69 69
 			),
70 70
 			array(
71 71
 				'type'    => 'listbox',
72 72
 				'name'    => 'show_bar',
73
-				'label'   => esc_attr__( 'Show Progress Bar:', 'give' ),
74
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
73
+				'label'   => esc_attr__('Show Progress Bar:', 'give'),
74
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
75 75
 				'options' => array(
76
-					'true'  => esc_html__( 'Show', 'give' ),
77
-					'false' => esc_html__( 'Hide', 'give' ),
76
+					'true'  => esc_html__('Show', 'give'),
77
+					'false' => esc_html__('Hide', 'give'),
78 78
 				),
79 79
 			),
80 80
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 /**
15 15
  * Class Give_Shortcode_Donation_Form
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
25
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
24
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
25
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
26 26
 
27
-		parent::__construct( 'give_form' );
27
+		parent::__construct('give_form');
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 		$create_form_link = sprintf(
38 38
 			/* translators: %s: create new form URL */
39
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
40
-			admin_url( 'post-new.php?post_type=give_forms' )
39
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
40
+			admin_url('post-new.php?post_type=give_forms')
41 41
 		);
42 42
 
43 43
 		return array(
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 					'post_type' => 'give_forms',
48 48
 				),
49 49
 				'name'        => 'id',
50
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
51
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
50
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
51
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
52 52
 				'required'    => array(
53
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
54
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms found.', 'give' ), $create_form_link ),
53
+					'alert' => esc_html__('You must first select a Form!', 'give'),
54
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms found.', 'give'), $create_form_link),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type' => 'container',
59
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
59
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
60 60
 			),
61 61
 			array(
62 62
 				'type'    => 'listbox',
63 63
 				'name'    => 'show_title',
64
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
65
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
64
+				'label'   => esc_attr__('Show Title:', 'give'),
65
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
66 66
 				'options' => array(
67
-					'true'  => esc_html__( 'Show', 'give' ),
68
-					'false' => esc_html__( 'Hide', 'give' ),
67
+					'true'  => esc_html__('Show', 'give'),
68
+					'false' => esc_html__('Hide', 'give'),
69 69
 				),
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
75
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
74
+				'label'   => esc_attr__('Show Goal:', 'give'),
75
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_content',
84 84
 				'minWidth' => 240,
85
-				'label'   => esc_attr__( 'Display Content:', 'give' ),
86
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
85
+				'label'   => esc_attr__('Display Content:', 'give'),
86
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
87 87
 				'options' => array(
88
-					'none'  => esc_html__( 'No Content', 'give' ),
89
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
90
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
88
+					'none'  => esc_html__('No Content', 'give'),
89
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
90
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
91 91
 				),
92 92
 			),
93 93
 			array(
94 94
 				'type'    => 'listbox',
95 95
 				'name'    => 'display_style',
96
-				'label'   => esc_attr__( 'Payment Fields:', 'give' ),
97
-				'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ),
96
+				'label'   => esc_attr__('Payment Fields:', 'give'),
97
+				'tooltip' => esc_attr__('How would you like to display payment information?', 'give'),
98 98
 				'options' => array(
99
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
100
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
101
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
99
+					'onpage' => esc_html__('Show on Page', 'give'),
100
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
101
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'listbox',
106 106
 				'name'    => 'float_labels',
107
-				'label'   => esc_attr__( 'Floating Labels:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form.', 'give' ),
107
+				'label'   => esc_attr__('Floating Labels:', 'give'),
108
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form.', 'give'),
109 109
 				'options' => array(
110
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
111
-					'disabled' => esc_html__( 'Disabled', 'give' ),
110
+					'enabled'  => esc_html__('Enabled', 'give'),
111
+					'disabled' => esc_html__('Disabled', 'give'),
112 112
 				),
113 113
 			),
114 114
 		);
Please login to merge, or discard this patch.
includes/admin/reporting/class-sales-logs-list-table.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 		global $status, $page;
45 45
 
46 46
 		// Set parent defaults
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
50 50
 			'ajax'     => false                        // Does this table support ajax?
51
-		) );
51
+		));
52 52
 
53
-		add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) );
53
+		add_action('give_log_view_actions', array($this, 'give_forms_filter'));
54 54
 	}
55 55
 
56 56
 	/**
@@ -64,37 +64,37 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
67
+	public function column_default($item, $column_name) {
68 68
 
69
-		$payment = give_get_payment_by( 'id', $item['payment_id'] );
69
+		$payment = give_get_payment_by('id', $item['payment_id']);
70 70
 
71
-		switch ( $column_name ) {
71
+		switch ($column_name) {
72 72
 			case 'form' :
73
-				return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . get_the_title( $item[ $column_name ] ) . '</a>';
73
+				return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.get_the_title($item[$column_name]).'</a>';
74 74
 
75 75
 			case 'user_id' :
76
-				return '<a href="' .
77
-				       admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) .
78
-				       '">' . $item['user_name'] . '</a>';
76
+				return '<a href="'.
77
+				       admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))).
78
+				       '">'.$item['user_name'].'</a>';
79 79
 
80 80
 			case 'amount' :
81
-				return give_currency_filter( give_format_amount( $item['amount'] ) );
81
+				return give_currency_filter(give_format_amount($item['amount']));
82 82
 
83 83
 			case 'status' :
84 84
 
85
-				$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
85
+				$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
86 86
 
87
-				if ( $payment->mode == 'test' ) {
88
-					$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
87
+				if ($payment->mode == 'test') {
88
+					$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
89 89
 				}
90 90
 
91 91
 				return $value;
92 92
 
93 93
 			case 'payment_id' :
94
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>';
94
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>';
95 95
 
96 96
 			default:
97
-				return $item[ $column_name ];
97
+				return $item[$column_name];
98 98
 		}
99 99
 	}
100 100
 
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function get_columns() {
109 109
 		$columns = array(
110
-			'ID'         => esc_html__( 'Log ID', 'give' ),
111
-			'user_id'    => esc_html__( 'Donor', 'give' ),
110
+			'ID'         => esc_html__('Log ID', 'give'),
111
+			'user_id'    => esc_html__('Donor', 'give'),
112 112
 			'form'       => give_get_forms_label_singular(),
113
-			'amount'     => esc_html__( 'Donation Amount', 'give' ),
114
-			'status'     => esc_html__( 'Status', 'give' ),
115
-			'payment_id' => esc_html__( 'Transaction ID', 'give' ),
116
-			'date'       => esc_html__( 'Date', 'give' )
113
+			'amount'     => esc_html__('Donation Amount', 'give'),
114
+			'status'     => esc_html__('Status', 'give'),
115
+			'payment_id' => esc_html__('Transaction ID', 'give'),
116
+			'date'       => esc_html__('Date', 'give')
117 117
 		);
118 118
 
119 119
 		return $columns;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @return int Current page number
128 128
 	 */
129 129
 	public function get_paged() {
130
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
130
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
131 131
 	}
132 132
 
133 133
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return mixed int If User ID, string If Email/Login
139 139
 	 */
140 140
 	public function get_filtered_user() {
141
-		return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false;
141
+		return isset($_GET['user']) ? absint($_GET['user']) : false;
142 142
 	}
143 143
 
144 144
 	/**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @return int Download ID
150 150
 	 */
151 151
 	public function get_filtered_give_form() {
152
-		return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false;
152
+		return ! empty($_GET['form']) ? absint($_GET['form']) : false;
153 153
 	}
154 154
 
155 155
 	/**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed string If search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
163
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
164 164
 	}
165 165
 
166 166
 
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $which
178 178
 	 */
179
-	protected function display_tablenav( $which ) {
179
+	protected function display_tablenav($which) {
180 180
 
181
-		if ( 'top' === $which ) {
182
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
181
+		if ('top' === $which) {
182
+			wp_nonce_field('bulk-'.$this->_args['plural']);
183 183
 		}
184 184
 		?>
185
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
185
+		<div class="tablenav <?php echo esc_attr($which); ?>">
186 186
 
187 187
 			<div class="alignleft actions bulkactions">
188
-				<?php $this->bulk_actions( $which ); ?>
188
+				<?php $this->bulk_actions($which); ?>
189 189
 			</div>
190 190
 			<?php
191
-			$this->extra_tablenav( $which );
192
-			$this->pagination( $which );
191
+			$this->extra_tablenav($which);
192
+			$this->pagination($which);
193 193
 			?>
194 194
 
195 195
 			<br class="clear"/>
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 		$meta_query = array();
214 214
 
215
-		if ( $user ) {
215
+		if ($user) {
216 216
 			// Show only logs from a specific user
217 217
 			$meta_query[] = array(
218 218
 				'key'   => '_give_log_user_id',
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 		}
222 222
 
223 223
 		$search = $this->get_search();
224
-		if ( $search ) {
225
-			if ( is_email( $search ) ) {
224
+		if ($search) {
225
+			if (is_email($search)) {
226 226
 				// This is an email search. We use this to ensure it works for guest users and logged-in users
227 227
 				$key     = '_give_log_user_info';
228 228
 				$compare = 'LIKE';
@@ -231,32 +231,32 @@  discard block
 block discarded – undo
231 231
 				$key     = '_give_log_user_id';
232 232
 				$compare = 'LIKE';
233 233
 
234
-				if ( ! is_numeric( $search ) ) {
234
+				if ( ! is_numeric($search)) {
235 235
 					// Searching for user by username
236
-					$user = get_user_by( 'login', $search );
236
+					$user = get_user_by('login', $search);
237 237
 
238
-					if ( $user ) {
238
+					if ($user) {
239 239
 						// Found one, set meta value to user's ID
240 240
 						$search = $user->ID;
241 241
 					} else {
242 242
 						// No user found so let's do a real search query
243
-						$users = new WP_User_Query( array(
243
+						$users = new WP_User_Query(array(
244 244
 							'search'         => $search,
245
-							'search_columns' => array( 'user_url', 'user_nicename' ),
245
+							'search_columns' => array('user_url', 'user_nicename'),
246 246
 							'number'         => 1,
247 247
 							'fields'         => 'ids'
248
-						) );
248
+						));
249 249
 
250 250
 						$found_user = $users->get_results();
251 251
 
252
-						if ( $found_user ) {
252
+						if ($found_user) {
253 253
 							$search = $found_user[0];
254 254
 						}
255 255
 					}
256 256
 				}
257 257
 			}
258 258
 
259
-			if ( ! $this->file_search ) {
259
+			if ( ! $this->file_search) {
260 260
 				// Meta query only works for non file name searche
261 261
 				$meta_query[] = array(
262 262
 					'key'     => $key,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @since  1.0
278 278
 	 * @return void
279 279
 	 */
280
-	function bulk_actions( $which = '' ) {
280
+	function bulk_actions($which = '') {
281 281
 		give_log_views();
282 282
 	}
283 283
 
@@ -289,22 +289,22 @@  discard block
 block discarded – undo
289 289
 	 * @return void
290 290
 	 */
291 291
 	public function give_forms_filter() {
292
-		$give_forms = get_posts( array(
292
+		$give_forms = get_posts(array(
293 293
 			'post_type'              => 'give_forms',
294 294
 			'post_status'            => 'any',
295
-			'posts_per_page'         => - 1,
295
+			'posts_per_page'         => -1,
296 296
 			'orderby'                => 'title',
297 297
 			'order'                  => 'ASC',
298 298
 			'fields'                 => 'ids',
299 299
 			'update_post_meta_cache' => false,
300 300
 			'update_post_term_cache' => false
301
-		) );
301
+		));
302 302
 
303
-		if ( $give_forms ) {
303
+		if ($give_forms) {
304 304
 			echo '<select name="form" id="give-log-form-filter">';
305
-			echo '<option value="0">' . esc_html__( 'All', 'give' ) . '</option>';
306
-			foreach ( $give_forms as $form ) {
307
-				echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( get_the_title( $form ) ) . '</option>';
305
+			echo '<option value="0">'.esc_html__('All', 'give').'</option>';
306
+			foreach ($give_forms as $form) {
307
+				echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html(get_the_title($form)).'</option>';
308 308
 			}
309 309
 			echo '</select>';
310 310
 		}
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 		global $give_logs;
323 323
 
324 324
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
325
-		wp_suspend_cache_addition( true );
325
+		wp_suspend_cache_addition(true);
326 326
 
327 327
 		$logs_data = array();
328 328
 		$paged     = $this->get_paged();
329
-		$give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null;
329
+		$give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null;
330 330
 		$user      = $this->get_filtered_user();
331 331
 
332 332
 		$log_query = array(
@@ -336,26 +336,26 @@  discard block
 block discarded – undo
336 336
 			'meta_query'  => $this->get_meta_query()
337 337
 		);
338 338
 
339
-		$logs = $give_logs->get_connected_logs( $log_query );
339
+		$logs = $give_logs->get_connected_logs($log_query);
340 340
 
341
-		if ( $logs ) {
342
-			foreach ( $logs as $log ) {
343
-				$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
341
+		if ($logs) {
342
+			foreach ($logs as $log) {
343
+				$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
344 344
 
345 345
 				// Make sure this payment hasn't been deleted
346
-				if ( get_post( $payment_id ) ) :
347
-					$user_info      = give_get_payment_meta_user_info( $payment_id );
348
-					$payment_meta   = give_get_payment_meta( $payment_id );
349
-					$payment_amount = give_get_payment_amount( $payment_id );
346
+				if (get_post($payment_id)) :
347
+					$user_info      = give_get_payment_meta_user_info($payment_id);
348
+					$payment_meta   = give_get_payment_meta($payment_id);
349
+					$payment_amount = give_get_payment_amount($payment_id);
350 350
 
351 351
 					$logs_data[] = array(
352
-						'ID'         => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>',
352
+						'ID'         => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>',
353 353
 						'payment_id' => $payment_id,
354 354
 						'form'       => $log->post_parent,
355 355
 						'amount'     => $payment_amount,
356 356
 						'user_id'    => $user_info['id'],
357
-						'user_name'  => $user_info['first_name'] . ' ' . $user_info['last_name'],
358
-						'date'       => get_post_field( 'post_date', $payment_id )
357
+						'user_name'  => $user_info['first_name'].' '.$user_info['last_name'],
358
+						'date'       => get_post_field('post_date', $payment_id)
359 359
 					);
360 360
 
361 361
 				endif;
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
 		$columns               = $this->get_columns();
385 385
 		$hidden                = array();
386 386
 		$sortable              = $this->get_sortable_columns();
387
-		$this->_column_headers = array( $columns, $hidden, $sortable );
387
+		$this->_column_headers = array($columns, $hidden, $sortable);
388 388
 		$current_page          = $this->get_pagenum();
389 389
 		$this->items           = $this->get_logs();
390
-		$total_items           = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() );
390
+		$total_items           = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query());
391 391
 
392
-		$this->set_pagination_args( array(
392
+		$this->set_pagination_args(array(
393 393
 				'total_items' => $total_items,
394 394
 				'per_page'    => $this->per_page,
395
-				'total_pages' => ceil( $total_items / $this->per_page )
395
+				'total_pages' => ceil($total_items / $this->per_page)
396 396
 			)
397 397
 		);
398 398
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => esc_html__( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => esc_html__( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => esc_html__( 'Email', 'give' ),
45
-			'first'     => esc_html__( 'First Name', 'give' ),
46
-			'last'      => esc_html__( 'Last Name', 'give' ),
47
-			'address1'  => esc_html__( 'Address 1', 'give' ),
48
-			'address2'  => esc_html__( 'Address 2', 'give' ),
49
-			'city'      => esc_html__( 'City', 'give' ),
50
-			'state'     => esc_html__( 'State', 'give' ),
51
-			'country'   => esc_html__( 'Country', 'give' ),
52
-			'zip'       => esc_html__( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => esc_html__( 'Form ID', 'give' ),
54
-			'form_name' => esc_html__( 'Form Name', 'give' ),
55
-			'amount'    => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
56
-			'gateway'   => esc_html__( 'Payment Method', 'give' ),
57
-			'trans_id'  => esc_html__( 'Transaction ID', 'give' ),
58
-			'key'       => esc_html__( 'Purchase Key', 'give' ),
59
-			'date'      => esc_html__( 'Date', 'give' ),
60
-			'user'      => esc_html__( 'User', 'give' ),
61
-			'status'    => esc_html__( 'Status', 'give' )
42
+			'id'        => esc_html__('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => esc_html__('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => esc_html__('Email', 'give'),
45
+			'first'     => esc_html__('First Name', 'give'),
46
+			'last'      => esc_html__('Last Name', 'give'),
47
+			'address1'  => esc_html__('Address 1', 'give'),
48
+			'address2'  => esc_html__('Address 2', 'give'),
49
+			'city'      => esc_html__('City', 'give'),
50
+			'state'     => esc_html__('State', 'give'),
51
+			'country'   => esc_html__('Country', 'give'),
52
+			'zip'       => esc_html__('Zip / Postal Code', 'give'),
53
+			'form_id'   => esc_html__('Form ID', 'give'),
54
+			'form_name' => esc_html__('Form Name', 'give'),
55
+			'amount'    => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
56
+			'gateway'   => esc_html__('Payment Method', 'give'),
57
+			'trans_id'  => esc_html__('Transaction ID', 'give'),
58
+			'key'       => esc_html__('Purchase Key', 'give'),
59
+			'date'      => esc_html__('Date', 'give'),
60
+			'user'      => esc_html__('User', 'give'),
61
+			'status'    => esc_html__('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 			'status' => $this->status
88 88
 		);
89 89
 
90
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
90
+		if ( ! empty($this->start) || ! empty($this->end)) {
91 91
 
92 92
 			$args['date_query'] = array(
93 93
 				array(
94
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
95
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
94
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
95
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
96 96
 					'inclusive' => true
97 97
 				)
98 98
 			);
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
 
102 102
 		//echo json_encode($args ); exit;
103 103
 
104
-		$payments = give_get_payments( $args );
104
+		$payments = give_get_payments($args);
105 105
 
106
-		if ( $payments ) {
106
+		if ($payments) {
107 107
 
108
-			foreach ( $payments as $payment ) {
109
-				$payment_meta = give_get_payment_meta( $payment->ID );
110
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
111
-				$total        = give_get_payment_amount( $payment->ID );
112
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
108
+			foreach ($payments as $payment) {
109
+				$payment_meta = give_get_payment_meta($payment->ID);
110
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
111
+				$total        = give_get_payment_amount($payment->ID);
112
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
113 113
 				$products     = '';
114 114
 				$skus         = '';
115 115
 
116
-				if ( is_numeric( $user_id ) ) {
117
-					$user = get_userdata( $user_id );
116
+				if (is_numeric($user_id)) {
117
+					$user = get_userdata($user_id);
118 118
 				} else {
119 119
 					$user = false;
120 120
 				}
121 121
 
122 122
 				$data[] = array(
123 123
 					'id'        => $payment->ID,
124
-					'seq_id'    => give_get_payment_number( $payment->ID ),
124
+					'seq_id'    => give_get_payment_number($payment->ID),
125 125
 					'email'     => $payment_meta['email'],
126 126
 					'first'     => $user_info['first_name'],
127 127
 					'last'      => $user_info['last_name'],
128
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
129
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
130
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
131
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
132
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
133
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
134
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
135
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
128
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
129
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
130
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
131
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
132
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
133
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
134
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
135
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
136 136
 					'skus'      => $skus,
137
-					'amount'    => html_entity_decode( give_format_amount( $total ) ),
138
-					'gateway'   => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
139
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
137
+					'amount'    => html_entity_decode(give_format_amount($total)),
138
+					'gateway'   => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
139
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
140 140
 					'key'       => $payment_meta['key'],
141 141
 					'date'      => $payment->post_date,
142
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
143
-					'status'    => give_get_payment_status( $payment, true )
142
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
143
+					'status'    => give_get_payment_status($payment, true)
144 144
 				);
145 145
 
146 146
 			}
147 147
 
148
-			$data = apply_filters( 'give_export_get_data', $data );
149
-			$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
148
+			$data = apply_filters('give_export_get_data', $data);
149
+			$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
150 150
 
151 151
 			return $data;
152 152
 
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$status = $this->status;
168 168
 		$args   = array(
169
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
170
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
169
+			'start-date' => date('n/d/Y', strtotime($this->start)),
170
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
171 171
 		);
172 172
 
173
-		if ( 'any' == $status ) {
173
+		if ('any' == $status) {
174 174
 
175
-			$total = array_sum( (array) give_count_payments( $args ) );
175
+			$total = array_sum((array) give_count_payments($args));
176 176
 
177 177
 		} else {
178 178
 
179
-			$total = give_count_payments( $args )->$status;
179
+			$total = give_count_payments($args)->$status;
180 180
 
181 181
 		}
182 182
 
183 183
 		$percentage = 100;
184 184
 
185
-		if ( $total > 0 ) {
186
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
185
+		if ($total > 0) {
186
+			$percentage = ((30 * $this->step) / $total) * 100;
187 187
 		}
188 188
 
189
-		if ( $percentage > 100 ) {
189
+		if ($percentage > 100) {
190 190
 			$percentage = 100;
191 191
 		}
192 192
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param array $request The Form Data passed into the batch processing.
202 202
 	 */
203
-	public function set_properties( $request ) {
204
-		$this->start  = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
205
-		$this->end    = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
206
-		$this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
203
+	public function set_properties($request) {
204
+		$this->start  = isset($request['start']) ? sanitize_text_field($request['start']) : '';
205
+		$this->end    = isset($request['end']) ? sanitize_text_field($request['end']) : '';
206
+		$this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
207 207
 	}
208 208
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
 	 *
47 47
 	 * @param array $request The Form Data passed into the batch processing
48 48
 	 */
49
-	public function set_properties( $request ) {
49
+	public function set_properties($request) {
50 50
 
51 51
 		//Set data from form submission
52
-		if ( isset( $_POST['form'] ) ) {
53
-			parse_str( $_POST['form'], $this->data );
52
+		if (isset($_POST['form'])) {
53
+			parse_str($_POST['form'], $this->data);
54 54
 		}
55 55
 
56 56
 		$this->form = $this->data['forms'];
57 57
 
58
-		$this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
58
+		$this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
59 59
 
60 60
 	}
61 61
 
@@ -70,36 +70,36 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$cols = array();
72 72
 
73
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
73
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
74 74
 
75
-		if ( empty( $columns ) ) {
75
+		if (empty($columns)) {
76 76
 			return false;
77 77
 		}
78
-		if ( ! empty( $columns['full_name'] ) ) {
79
-			$cols['full_name'] = esc_html__( 'Full Name', 'give' );
78
+		if ( ! empty($columns['full_name'])) {
79
+			$cols['full_name'] = esc_html__('Full Name', 'give');
80 80
 		}
81
-		if ( ! empty( $columns['email'] ) ) {
82
-			$cols['email'] = esc_html__( 'Email Address', 'give' );
81
+		if ( ! empty($columns['email'])) {
82
+			$cols['email'] = esc_html__('Email Address', 'give');
83 83
 		}
84
-		if ( ! empty( $columns['address'] ) ) {
85
-			$cols['address_line1']   = esc_html__( 'Address 1', 'give' );
86
-			$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
87
-			$cols['address_city']    = esc_html__( 'City', 'give' );
88
-			$cols['address_state']   = esc_html__( 'State', 'give' );
89
-			$cols['address_zip']     = esc_html__( 'Zip', 'give' );
90
-			$cols['address_country'] = esc_html__( 'Country', 'give' );
84
+		if ( ! empty($columns['address'])) {
85
+			$cols['address_line1']   = esc_html__('Address 1', 'give');
86
+			$cols['address_line2']   = esc_html__('Address 2', 'give');
87
+			$cols['address_city']    = esc_html__('City', 'give');
88
+			$cols['address_state']   = esc_html__('State', 'give');
89
+			$cols['address_zip']     = esc_html__('Zip', 'give');
90
+			$cols['address_country'] = esc_html__('Country', 'give');
91 91
 		}
92
-		if ( ! empty( $columns['userid'] ) ) {
93
-			$cols['userid'] = esc_html__( 'User ID', 'give' );
92
+		if ( ! empty($columns['userid'])) {
93
+			$cols['userid'] = esc_html__('User ID', 'give');
94 94
 		}
95
-		if ( ! empty( $columns['date_first_donated'] ) ) {
96
-			$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
95
+		if ( ! empty($columns['date_first_donated'])) {
96
+			$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
97 97
 		}
98
-		if ( ! empty( $columns['donations'] ) ) {
99
-			$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
98
+		if ( ! empty($columns['donations'])) {
99
+			$cols['donations'] = esc_html__('Number of Donations', 'give');
100 100
 		}
101
-		if ( ! empty( $columns['donation_sum'] ) ) {
102
-			$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
101
+		if ( ! empty($columns['donation_sum'])) {
102
+			$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
103 103
 		}
104 104
 
105 105
 		return $cols;
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$i = 0;
121 121
 
122
-		if ( ! empty( $this->form ) ) {
122
+		if ( ! empty($this->form)) {
123 123
 
124 124
 			// Export donors of a specific product
125 125
 			global $give_logs;
126 126
 
127 127
 			$args = array(
128
-				'post_parent'    => absint( $this->form ),
128
+				'post_parent'    => absint($this->form),
129 129
 				'log_type'       => 'sale',
130 130
 				'posts_per_page' => 30,
131 131
 				'paged'          => $this->step
132 132
 			);
133 133
 
134 134
 			//Check for price option
135
-			if ( null !== $this->price_id ) {
135
+			if (null !== $this->price_id) {
136 136
 				$args['meta_query'] = array(
137 137
 					array(
138 138
 						'key'   => '_give_log_price_id',
@@ -141,33 +141,33 @@  discard block
 block discarded – undo
141 141
 				);
142 142
 			}
143 143
 
144
-			$logs = $give_logs->get_connected_logs( $args );
144
+			$logs = $give_logs->get_connected_logs($args);
145 145
 
146
-			if ( $logs ) {
147
-				foreach ( $logs as $log ) {
148
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
149
-					$payment    = new Give_Payment( $payment_id );
150
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
151
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
152
-					$i ++;
146
+			if ($logs) {
147
+				foreach ($logs as $log) {
148
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
149
+					$payment    = new Give_Payment($payment_id);
150
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
151
+					$data[]     = $this->set_donor_data($i, $data, $donor);
152
+					$i++;
153 153
 				}
154 154
 			}
155 155
 
156 156
 		} else {
157 157
 
158 158
 			// Export all customers
159
-			$offset = 30 * ( $this->step - 1 );
160
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
159
+			$offset = 30 * ($this->step - 1);
160
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
161 161
 
162
-			foreach ( $donors as $donor ) {
162
+			foreach ($donors as $donor) {
163 163
 
164
-				$data[] = $this->set_donor_data( $i, $data, $donor );
165
-				$i ++;
164
+				$data[] = $this->set_donor_data($i, $data, $donor);
165
+				$i++;
166 166
 			}
167 167
 		}
168 168
 
169
-		$data = apply_filters( 'give_export_get_data', $data );
170
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
169
+		$data = apply_filters('give_export_get_data', $data);
170
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
171 171
 
172 172
 		return $data;
173 173
 	}
@@ -183,19 +183,19 @@  discard block
 block discarded – undo
183 183
 		$percentage = 0;
184 184
 
185 185
 		// We can't count the number when getting them for a specific form
186
-		if ( empty( $this->form ) ) {
186
+		if (empty($this->form)) {
187 187
 
188 188
 			$total = Give()->customers->count();
189 189
 
190
-			if ( $total > 0 ) {
190
+			if ($total > 0) {
191 191
 
192
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
192
+				$percentage = ((30 * $this->step) / $total) * 100;
193 193
 
194 194
 			}
195 195
 
196 196
 		}
197 197
 
198
-		if ( $percentage > 100 ) {
198
+		if ($percentage > 100) {
199 199
 			$percentage = 100;
200 200
 		}
201 201
 
@@ -207,46 +207,46 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param $donor
209 209
 	 */
210
-	private function set_donor_data( $i, $data, $donor ) {
210
+	private function set_donor_data($i, $data, $donor) {
211 211
 
212 212
 		$columns = $this->csv_cols();
213 213
 
214 214
 		//Set address variable
215 215
 		$address = '';
216
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
217
-			$address = give_get_donor_address( $donor->user_id );
216
+		if (isset($donor->user_id) && $donor->user_id > 0) {
217
+			$address = give_get_donor_address($donor->user_id);
218 218
 		}
219 219
 
220 220
 		//Set columns
221
-		if ( ! empty( $columns['full_name'] ) ) {
222
-			$data[ $i ]['full_name'] = $donor->name;
221
+		if ( ! empty($columns['full_name'])) {
222
+			$data[$i]['full_name'] = $donor->name;
223 223
 		}
224
-		if ( ! empty( $columns['email'] ) ) {
225
-			$data[ $i ]['email'] = $donor->email;
224
+		if ( ! empty($columns['email'])) {
225
+			$data[$i]['email'] = $donor->email;
226 226
 		}
227
-		if ( ! empty( $columns['address_line1'] ) ) {
227
+		if ( ! empty($columns['address_line1'])) {
228 228
 
229
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
230
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
231
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
232
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
233
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
234
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
229
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
230
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
231
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
232
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
233
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
234
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
235 235
 		}
236
-		if ( ! empty( $columns['userid'] ) ) {
237
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
236
+		if ( ! empty($columns['userid'])) {
237
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
238 238
 		}
239
-		if ( ! empty( $columns['date_first_donated'] ) ) {
240
-			$data[ $i ]['date_first_donated'] = date_i18n( get_option( 'date_format' ), strtotime( $donor->date_created ) );
239
+		if ( ! empty($columns['date_first_donated'])) {
240
+			$data[$i]['date_first_donated'] = date_i18n(get_option('date_format'), strtotime($donor->date_created));
241 241
 		}
242
-		if ( ! empty( $columns['donations'] ) ) {
243
-			$data[ $i ]['donations'] = $donor->purchase_count;
242
+		if ( ! empty($columns['donations'])) {
243
+			$data[$i]['donations'] = $donor->purchase_count;
244 244
 		}
245
-		if ( ! empty( $columns['donation_sum'] ) ) {
246
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
245
+		if ( ! empty($columns['donation_sum'])) {
246
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
247 247
 		}
248 248
 
249
-		return $data[ $i ];
249
+		return $data[$i];
250 250
 
251 251
 	}
252 252
 
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,39 +29,39 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 
37
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Give Reports', 'give' ); ?></h1>
37
+		<h1 class="screen-reader-text"><?php esc_html_e('Give Reports', 'give'); ?></h1>
38 38
 
39 39
 		<h2 class="nav-tab-wrapper">
40
-			<a href="<?php echo esc_url( add_query_arg( array(
40
+			<a href="<?php echo esc_url(add_query_arg(array(
41 41
 				'tab'              => 'reports',
42 42
 				'settings-updated' => false
43
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a>
44
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
45
-				<a href="<?php echo esc_url( add_query_arg( array(
43
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a>
44
+			<?php if (current_user_can('export_give_reports')) { ?>
45
+				<a href="<?php echo esc_url(add_query_arg(array(
46 46
 					'tab'              => 'export',
47 47
 					'settings-updated' => false
48
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
48
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
49 49
 			<?php } ?>
50
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			<a href="<?php echo esc_url(add_query_arg(array(
51 51
 				'tab'              => 'logs',
52 52
 				'settings-updated' => false
53
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a>
54
-			<a href="<?php echo esc_url( add_query_arg( array(
53
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a>
54
+			<a href="<?php echo esc_url(add_query_arg(array(
55 55
 				'tab'              => 'tools',
56 56
 				'settings-updated' => false
57
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a>
58
-			<?php do_action( 'give_reports_tabs' ); ?>
57
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a>
58
+			<?php do_action('give_reports_tabs'); ?>
59 59
 		</h2>
60 60
 
61 61
 		<?php
62
-		do_action( 'give_reports_page_top' );
63
-		do_action( 'give_reports_tab_' . $active_tab );
64
-		do_action( 'give_reports_page_bottom' );
62
+		do_action('give_reports_page_top');
63
+		do_action('give_reports_tab_'.$active_tab);
64
+		do_action('give_reports_page_bottom');
65 65
 		?>
66 66
 	</div><!-- .wrap -->
67 67
 	<?php
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
  */
76 76
 function give_reports_default_views() {
77 77
 	$views = array(
78
-		'earnings' => esc_html__( 'Income', 'give' ),
78
+		'earnings' => esc_html__('Income', 'give'),
79 79
 		'forms'    => give_get_forms_label_plural(),
80
-		'donors'   => esc_html__( 'Donors', 'give' ),
81
-		'gateways' => esc_html__( 'Payment Methods', 'give' )
80
+		'donors'   => esc_html__('Donors', 'give'),
81
+		'gateways' => esc_html__('Payment Methods', 'give')
82 82
 	);
83 83
 
84
-	$views = apply_filters( 'give_report_views', $views );
84
+	$views = apply_filters('give_report_views', $views);
85 85
 
86 86
 	return $views;
87 87
 }
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
  * @return string $view Report View
98 98
  *
99 99
  */
100
-function give_get_reporting_view( $default = 'earnings' ) {
100
+function give_get_reporting_view($default = 'earnings') {
101 101
 
102
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
102
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
103 103
 		$view = $default;
104 104
 	} else {
105 105
 		$view = $_GET['view'];
106 106
 	}
107 107
 
108
-	return apply_filters( 'give_get_reporting_view', $view );
108
+	return apply_filters('give_get_reporting_view', $view);
109 109
 }
110 110
 
111 111
 /**
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 	$current_view = 'earnings';
119 119
 	$views        = give_reports_default_views();
120 120
 
121
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
121
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
122 122
 		$current_view = $_GET['view'];
123 123
 	}
124 124
 
125
-	do_action( 'give_reports_view_' . $current_view );
125
+	do_action('give_reports_view_'.$current_view);
126 126
 }
127 127
 
128
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
128
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
129 129
 
130 130
 /**
131 131
  * Renders the Reports Page Views Drop Downs
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function give_report_views() {
137 137
 	$views        = give_reports_default_views();
138
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
139
-	do_action( 'give_report_view_actions_before' );
138
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
139
+	do_action('give_report_view_actions_before');
140 140
 	?>
141 141
 	<form id="give-reports-filter" method="get">
142 142
 		<select id="give-reports-view" name="view">
143
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
144
-			<?php foreach ( $views as $view_id => $label ) : ?>
145
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
143
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
144
+			<?php foreach ($views as $view_id => $label) : ?>
145
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
146 146
 			<?php endforeach; ?>
147 147
 		</select>
148 148
 
149
-		<?php do_action( 'give_report_view_actions' ); ?>
149
+		<?php do_action('give_report_view_actions'); ?>
150 150
 
151 151
 		<input type="hidden" name="post_type" value="give_forms"/>
152 152
 		<input type="hidden" name="page" value="give-reports"/>
153
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
153
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
154 154
 	</form>
155 155
 	<?php
156
-	do_action( 'give_report_view_actions_after' );
156
+	do_action('give_report_view_actions_after');
157 157
 }
158 158
 
159 159
 /**
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function give_reports_forms_table() {
168 168
 
169
-	if ( isset( $_GET['form-id'] ) ) {
169
+	if (isset($_GET['form-id'])) {
170 170
 		return;
171 171
 	}
172 172
 
173
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
173
+	include(dirname(__FILE__).'/class-form-reports-table.php');
174 174
 
175 175
 	$give_table = new Give_Form_Reports_Table();
176 176
 	$give_table->prepare_items();
177 177
 	$give_table->display();
178 178
 }
179 179
 
180
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
180
+add_action('give_reports_view_forms', 'give_reports_forms_table');
181 181
 
182 182
 /**
183 183
  * Renders the detailed report for a specific give form
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
  * @return void
187 187
  */
188 188
 function give_reports_form_details() {
189
-	if ( ! isset( $_GET['form-id'] ) ) {
189
+	if ( ! isset($_GET['form-id'])) {
190 190
 		return;
191 191
 	}
192 192
 	?>
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 		<div class="actions bulkactions">
195 195
 			<?php give_report_views(); ?>
196 196
 			&nbsp;
197
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
197
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
198 198
 		</div>
199 199
 	</div>
200 200
 	<?php
201
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
201
+	give_reports_graph_of_form(absint($_GET['form-id']));
202 202
 }
203 203
 
204
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
204
+add_action('give_reports_view_forms', 'give_reports_form_details');
205 205
 
206 206
 /**
207 207
  * Renders the Reports Donors Table
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
  * @return void
213 213
  */
214 214
 function give_reports_donors_table() {
215
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
215
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
216 216
 
217 217
 	$give_table = new Give_Donor_Reports_Table();
218 218
 	$give_table->prepare_items();
219 219
 	?>
220 220
 	<div class="wrap give-reports-donors-wrap">
221
-		<?php do_action( 'give_logs_donors_table_top' ); ?>
222
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
221
+		<?php do_action('give_logs_donors_table_top'); ?>
222
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
223 223
 			<?php
224
-			$give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' );
224
+			$give_table->search_box(esc_html__('Search', 'give'), 'give-donors');
225 225
 			$give_table->display();
226 226
 			?>
227 227
 			<input type="hidden" name="post_type" value="give_forms"/>
228 228
 			<input type="hidden" name="page" value="give-reports"/>
229 229
 			<input type="hidden" name="view" value="donors"/>
230 230
 		</form>
231
-		<?php do_action( 'give_logs_donors_table_bottom' ); ?>
231
+		<?php do_action('give_logs_donors_table_bottom'); ?>
232 232
 	</div>
233 233
 	<?php
234 234
 }
235 235
 
236
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
236
+add_action('give_reports_view_donors', 'give_reports_donors_table');
237 237
 
238 238
 
239 239
 /**
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
  * @return void
246 246
  */
247 247
 function give_reports_gateways_table() {
248
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
248
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
249 249
 
250 250
 	$give_table = new Give_Gateawy_Reports_Table();
251 251
 	$give_table->prepare_items();
252 252
 	$give_table->display();
253 253
 }
254 254
 
255
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
255
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
256 256
 
257 257
 
258 258
 /**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 function give_reports_earnings() {
265 265
 	?>
266 266
 	<div class="tablenav top reports-table-nav">
267
-		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3>
267
+		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3>
268 268
 
269 269
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
270 270
 	</div>
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	give_reports_graph();
273 273
 }
274 274
 
275
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
275
+add_action('give_reports_view_earnings', 'give_reports_earnings');
276 276
 
277 277
 
278 278
 /**
@@ -287,53 +287,53 @@  discard block
 block discarded – undo
287 287
 		<div id="post-body">
288 288
 			<div id="post-body-content">
289 289
 
290
-				<?php do_action( 'give_reports_tab_export_content_top' ); ?>
290
+				<?php do_action('give_reports_tab_export_content_top'); ?>
291 291
 
292 292
 				<table class="widefat export-options-table give-table">
293 293
 					<thead>
294 294
 					<tr>
295
-						<th class="row-title"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
296
-						<th><?php esc_html_e( 'Export Options', 'give' ); ?></th>
295
+						<th class="row-title"><?php esc_html_e('Export Type', 'give'); ?></th>
296
+						<th><?php esc_html_e('Export Options', 'give'); ?></th>
297 297
 					</tr>
298 298
 					</thead>
299 299
 					<tbody>
300
-					<?php do_action( 'give_reports_tab_export_table_top' ); ?>
300
+					<?php do_action('give_reports_tab_export_table_top'); ?>
301 301
 					<tr class="give-export-pdf-sales-earnings">
302 302
 						<td class="row-title">
303
-							<h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
303
+							<h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3>
304 304
 
305
-							<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
305
+							<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
306 306
 						</td>
307 307
 						<td>
308
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a>
308
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a>
309 309
 						</td>
310 310
 					</tr>
311 311
 					<tr class="alternate give-export-sales-earnings">
312 312
 						<td class="row-title">
313
-							<h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
313
+							<h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3>
314 314
 
315
-							<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
315
+							<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
316 316
 						</td>
317 317
 						<td>
318 318
 							<form method="post">
319 319
 								<?php
320 320
 									printf(
321 321
 										/* translators: 1: start date dropdown 2: end date dropdown */
322
-										esc_html__( '%1$s to %2$s', 'give' ),
323
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
324
-										Give()->html->year_dropdown( 'end_year' )   . ' ' . Give()->html->month_dropdown( 'end_month' )
322
+										esc_html__('%1$s to %2$s', 'give'),
323
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
324
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
325 325
 									);
326 326
 								?>
327 327
 								<input type="hidden" name="give-action" value="earnings_export"/>
328
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
328
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
329 329
 							</form>
330 330
 						</td>
331 331
 					</tr>
332 332
 					<tr class="give-export-payment-history">
333 333
 						<td class="row-title">
334
-							<h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3>
334
+							<h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3>
335 335
 
336
-							<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
336
+							<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
337 337
 						</td>
338 338
 						<td>
339 339
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -341,29 +341,29 @@  discard block
 block discarded – undo
341 341
 								$args = array(
342 342
 									'id'          => 'give-payment-export-start',
343 343
 									'name'        => 'start',
344
-									'placeholder' => esc_attr__( 'Start date', 'give' )
344
+									'placeholder' => esc_attr__('Start date', 'give')
345 345
 								);
346
-								echo Give()->html->date_field( $args ); ?>
346
+								echo Give()->html->date_field($args); ?>
347 347
 								<?php
348 348
 								$args = array(
349 349
 									'id'          => 'give-payment-export-end',
350 350
 									'name'        => 'end',
351
-									'placeholder' => esc_attr__( 'End date', 'give' )
351
+									'placeholder' => esc_attr__('End date', 'give')
352 352
 								);
353
-								echo Give()->html->date_field( $args ); ?>
353
+								echo Give()->html->date_field($args); ?>
354 354
 								<select name="status">
355
-									<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
355
+									<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
356 356
 									<?php
357 357
 									$statuses = give_get_payment_statuses();
358
-									foreach ( $statuses as $status => $label ) {
359
-										echo '<option value="' . $status . '">' . $label . '</option>';
358
+									foreach ($statuses as $status => $label) {
359
+										echo '<option value="'.$status.'">'.$label.'</option>';
360 360
 									}
361 361
 									?>
362 362
 								</select>
363
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
363
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
364 364
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
365 365
 								<span>
366
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
366
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
367 367
 									<span class="spinner"></span>
368 368
 								</span>
369 369
 							</form>
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 					</tr>
373 373
 					<tr class="alternate give-export-donors">
374 374
 						<td class="row-title">
375
-							<h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3>
375
+							<h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3>
376 376
 
377
-							<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
377
+							<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
378 378
 						</td>
379 379
 						<td>
380 380
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -385,54 +385,54 @@  discard block
 block discarded – undo
385 385
 										'id'     => 'give_customer_export_form',
386 386
 										'chosen' => true
387 387
 									);
388
-									echo Give()->html->forms_dropdown( $args ); ?>
388
+									echo Give()->html->forms_dropdown($args); ?>
389 389
 								
390
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
390
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
391 391
 
392 392
 								<div id="export-donor-options-wrap" class="give-clearfix">
393
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
393
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
394 394
 									<ul id="give-export-option-ul">
395 395
 										<li>
396
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
396
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
397 397
 											</label>
398 398
 										</li>
399 399
 										<li>
400
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
400
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
401 401
 											</label>
402 402
 										</li>
403 403
 										<li>
404
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
404
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
405 405
 											</label>
406 406
 										</li>
407 407
 										<li>
408
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
408
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
409 409
 											</label>
410 410
 										</li>
411 411
 										<li>
412
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
412
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
413 413
 											</label>
414 414
 										</li>
415 415
 										<li>
416
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
416
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
417 417
 											</label>
418 418
 										</li>
419 419
 										<li>
420
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
420
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
421 421
 											</label>
422 422
 										</li>
423 423
 									</ul>
424 424
 								</div>
425
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
425
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
426 426
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
427 427
 								<input type="hidden" name="give-action" value="email_export"/>
428 428
 							</form>
429 429
 						</td>
430 430
 					</tr>
431
-					<?php do_action( 'give_reports_tab_export_table_bottom' ); ?>
431
+					<?php do_action('give_reports_tab_export_table_bottom'); ?>
432 432
 					</tbody>
433 433
 				</table>
434 434
 
435
-				<?php do_action( 'give_reports_tab_export_content_bottom' ); ?>
435
+				<?php do_action('give_reports_tab_export_content_bottom'); ?>
436 436
 
437 437
 			</div>
438 438
 			<!-- .post-body-content -->
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	<?php
443 443
 }
444 444
 
445
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
445
+add_action('give_reports_tab_export', 'give_reports_tab_export');
446 446
 
447 447
 /**
448 448
  * Renders the Reports page
@@ -452,19 +452,19 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function give_reports_tab_logs() {
454 454
 
455
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
455
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
456 456
 
457 457
 	$current_view = 'sales';
458 458
 	$log_views    = give_log_default_views();
459 459
 
460
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
460
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
461 461
 		$current_view = $_GET['view'];
462 462
 	}
463 463
 
464
-	do_action( 'give_logs_view_' . $current_view );
464
+	do_action('give_logs_view_'.$current_view);
465 465
 }
466 466
 
467
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
467
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
468 468
 
469 469
 /**
470 470
  * Retrieves estimated monthly earnings and sales
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
  */
475 475
 function give_estimated_monthly_stats() {
476 476
 
477
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
477
+	$estimated = get_transient('give_estimated_monthly_stats');
478 478
 
479
-	if ( false === $estimated ) {
479
+	if (false === $estimated) {
480 480
 
481 481
 		$estimated = array(
482 482
 			'earnings' => 0,
@@ -485,20 +485,20 @@  discard block
 block discarded – undo
485 485
 
486 486
 		$stats = new Give_Payment_Stats;
487 487
 
488
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
489
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
488
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
489
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
490 490
 
491
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
492
-		$current_month = date( 'n', current_time( 'timestamp' ) );
493
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
494
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
491
+		$current_day   = date('d', current_time('timestamp'));
492
+		$current_month = date('n', current_time('timestamp'));
493
+		$current_year  = date('Y', current_time('timestamp'));
494
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
495 495
 
496
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
497
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
496
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
497
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
498 498
 
499 499
 		// Cache for one day
500
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
500
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
501 501
 	}
502 502
 
503
-	return maybe_unserialize( $estimated );
503
+	return maybe_unserialize($estimated);
504 504
 }
Please login to merge, or discard this patch.
includes/admin/reporting/class-api-requests-logs-list-table.php 1 patch
Spacing   +64 added lines, -64 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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
67
-		$input_id = $input_id . '-search-input';
66
+	public function search_box($text, $input_id) {
67
+		$input_id = $input_id.'-search-input';
68 68
 
69
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
70
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
69
+		if ( ! empty($_REQUEST['orderby'])) {
70
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
71 71
 		}
72
-		if ( ! empty( $_REQUEST['order'] ) ) {
73
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
72
+		if ( ! empty($_REQUEST['order'])) {
73
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
74 74
 		}
75 75
 		?>
76 76
 		<p class="search-box">
77 77
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
78 78
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
79
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
79
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
80 80
 		</p>
81 81
 	<?php
82 82
 	}
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function get_columns() {
92 92
 		$columns = array(
93
-			'ID'      => esc_html__( 'Log ID', 'give' ),
94
-			'details' => esc_html__( 'Request Details', 'give' ),
95
-			'ip'      => esc_html__( 'Request IP', 'give' ),
96
-			'date'    => esc_html__( 'Date', 'give' )
93
+			'ID'      => esc_html__('Log ID', 'give'),
94
+			'details' => esc_html__('Request Details', 'give'),
95
+			'ip'      => esc_html__('Request IP', 'give'),
96
+			'date'    => esc_html__('Date', 'give')
97 97
 		);
98 98
 
99 99
 		return $columns;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string Column Name
112 112
 	 */
113
-	public function column_default( $item, $column_name ) {
114
-		switch ( $column_name ) {
113
+	public function column_default($item, $column_name) {
114
+		switch ($column_name) {
115 115
 			default:
116
-				return $item[ $column_name ];
116
+				return $item[$column_name];
117 117
 		}
118 118
 	}
119 119
 
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return void
129 129
 	 */
130
-	public function column_details( $item ) {
130
+	public function column_details($item) {
131 131
 		?>
132
-		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a>
132
+		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a>
133 133
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
134 134
 			<?php
135 135
 
136
-			$request = get_post_field( 'post_excerpt', $item['ID'] );
137
-			$error   = get_post_field( 'post_content', $item['ID'] );
138
-			echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>';
139
-			echo '<div>' . $request . '</div>';
140
-			if ( ! empty( $error ) ) {
141
-				echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>';
142
-				echo '<div>' . esc_html( $error ) . '</div>';
136
+			$request = get_post_field('post_excerpt', $item['ID']);
137
+			$error   = get_post_field('post_content', $item['ID']);
138
+			echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>';
139
+			echo '<div>'.$request.'</div>';
140
+			if ( ! empty($error)) {
141
+				echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>';
142
+				echo '<div>'.esc_html($error).'</div>';
143 143
 			}
144
-			echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>';
145
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>';
146
-			echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>';
147
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>';
148
-			echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>';
149
-			echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>';
144
+			echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>';
145
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>';
146
+			echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>';
147
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>';
148
+			echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>';
149
+			echo '<div>'.get_post_field('post_date', $item['ID']).'</div>';
150 150
 			?>
151 151
 		</div>
152 152
 	<?php
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed String if search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
163
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
164 164
 	}
165 165
 
166 166
 
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $which
178 178
 	 */
179
-	protected function display_tablenav( $which ) {
180
-		if ( 'top' === $which ) {
181
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
179
+	protected function display_tablenav($which) {
180
+		if ('top' === $which) {
181
+			wp_nonce_field('bulk-'.$this->_args['plural']);
182 182
 		}
183 183
 		?>
184
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
184
+		<div class="tablenav <?php echo esc_attr($which); ?>">
185 185
 
186 186
 			<div class="alignleft actions bulkactions">
187
-				<?php $this->bulk_actions( $which ); ?>
187
+				<?php $this->bulk_actions($which); ?>
188 188
 			</div>
189 189
 			<?php
190
-			$this->extra_tablenav( $which );
191
-			$this->pagination( $which );
190
+			$this->extra_tablenav($which);
191
+			$this->pagination($which);
192 192
 			?>
193 193
 
194 194
 			<br class="clear"/>
@@ -210,31 +210,31 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$search = $this->get_search();
212 212
 
213
-		if ( $search ) {
214
-			if ( filter_var( $search, FILTER_VALIDATE_IP ) ) {
213
+		if ($search) {
214
+			if (filter_var($search, FILTER_VALIDATE_IP)) {
215 215
 				// This is an IP address search
216 216
 				$key = '_give_log_request_ip';
217
-			} else if ( is_email( $search ) ) {
217
+			} else if (is_email($search)) {
218 218
 				// This is an email search
219
-				$userdata = get_user_by( 'email', $search );
219
+				$userdata = get_user_by('email', $search);
220 220
 
221
-				if ( $userdata ) {
221
+				if ($userdata) {
222 222
 					$search = $userdata->ID;
223 223
 				}
224 224
 
225 225
 				$key = '_give_log_user';
226
-			} elseif ( strlen( $search ) == 32 ) {
226
+			} elseif (strlen($search) == 32) {
227 227
 				// Look for an API key
228 228
 				$key = '_give_log_key';
229
-			} elseif ( stristr( $search, 'token:' ) ) {
229
+			} elseif (stristr($search, 'token:')) {
230 230
 				// Look for an API token
231
-				$search = str_ireplace( 'token:', '', $search );
231
+				$search = str_ireplace('token:', '', $search);
232 232
 				$key    = '_give_log_token';
233 233
 			} else {
234 234
 				// This is (probably) a user ID search
235
-				$userdata = get_userdata( $search );
235
+				$userdata = get_userdata($search);
236 236
 
237
-				if ( $userdata ) {
237
+				if ($userdata) {
238 238
 					$search = $userdata->ID;
239 239
 				}
240 240
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @return int Current page number
261 261
 	 */
262 262
 	public function get_paged() {
263
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
263
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
264 264
 	}
265 265
 
266 266
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @since  1.0
271 271
 	 * @return void
272 272
 	 */
273
-	function bulk_actions( $which = '' ) {
273
+	function bulk_actions($which = '') {
274 274
 		give_log_views();
275 275
 	}
276 276
 
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 			'meta_query' => $this->get_meta_query()
294 294
 		);
295 295
 
296
-		$logs = $give_logs->get_connected_logs( $log_query );
296
+		$logs = $give_logs->get_connected_logs($log_query);
297 297
 
298
-		if ( $logs ) {
299
-			foreach ( $logs as $log ) {
298
+		if ($logs) {
299
+			foreach ($logs as $log) {
300 300
 
301 301
 				$logs_data[] = array(
302 302
 					'ID'   => $log->ID,
303
-					'ip'   => get_post_meta( $log->ID, '_give_log_request_ip', true ),
303
+					'ip'   => get_post_meta($log->ID, '_give_log_request_ip', true),
304 304
 					'date' => $log->post_date
305 305
 				);
306 306
 			}
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 		$columns               = $this->get_columns();
329 329
 		$hidden                = array(); // No hidden columns
330 330
 		$sortable              = $this->get_sortable_columns();
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 		$this->items           = $this->get_logs();
333
-		$total_items           = $give_logs->get_log_count( 0, 'api_requests' );
333
+		$total_items           = $give_logs->get_log_count(0, 'api_requests');
334 334
 
335
-		$this->set_pagination_args( array(
335
+		$this->set_pagination_args(array(
336 336
 				'total_items' => $total_items,
337 337
 				'per_page'    => $this->per_page,
338
-				'total_pages' => ceil( $total_items / $this->per_page )
338
+				'total_pages' => ceil($total_items / $this->per_page)
339 339
 			)
340 340
 		);
341 341
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-reset-stats.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $wpdb;
57 57
 
58
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
58
+		$items = $this->get_stored_data('give_temp_reset_ids');
59 59
 
60
-		if ( ! is_array( $items ) ) {
60
+		if ( ! is_array($items)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$offset     = ( $this->step - 1 ) * $this->per_step;
65
-		$step_items = array_slice( $items, $offset, $this->per_step );
64
+		$offset     = ($this->step - 1) * $this->per_step;
65
+		$step_items = array_slice($items, $offset, $this->per_step);
66 66
 
67
-		if ( $step_items ) {
67
+		if ($step_items) {
68 68
 
69 69
 			$step_ids = array(
70 70
 				'customers'  => array(),
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 				'other'      => array(),
73 73
 			);
74 74
 
75
-			foreach ( $step_items as $item ) {
75
+			foreach ($step_items as $item) {
76 76
 
77
-				switch ( $item['type'] ) {
77
+				switch ($item['type']) {
78 78
 					case 'customer':
79 79
 						$step_ids['customers'][] = $item['id'];
80 80
 						break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 						$step_ids['give_forms'][] = $item['id'];
83 83
 						break;
84 84
 					default:
85
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
86
-						$step_ids[ $item_type ][] = $item['id'];
85
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
86
+						$step_ids[$item_type][] = $item['id'];
87 87
 						break;
88 88
 				}
89 89
 
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 
92 92
 			$sql = array();
93 93
 
94
-			foreach ( $step_ids as $type => $ids ) {
94
+			foreach ($step_ids as $type => $ids) {
95 95
 
96
-				if ( empty( $ids ) ) {
96
+				if (empty($ids)) {
97 97
 					continue;
98 98
 				}
99 99
 
100
-				$ids = implode( ',', $ids );
100
+				$ids = implode(',', $ids);
101 101
 
102
-				switch ( $type ) {
102
+				switch ($type) {
103 103
 					case 'customers':
104
-						$table_name = $wpdb->prefix . 'give_customers';
104
+						$table_name = $wpdb->prefix.'give_customers';
105 105
 						$sql[]      = "DELETE FROM $table_name WHERE id IN ($ids)";
106 106
 						break;
107 107
 					case 'forms':
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 						break;
117 117
 				}
118 118
 
119
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
119
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
120 120
 					// Allows other types of custom post types to filter on their own post_type
121 121
 					// and add items to the query list, for the IDs found in their post type.
122
-					$sql = apply_filters( 'give_reset_add_queries_' . $type, $sql, $ids );
122
+					$sql = apply_filters('give_reset_add_queries_'.$type, $sql, $ids);
123 123
 				}
124 124
 
125 125
 		
126 126
 			}
127 127
 
128
-			if ( ! empty( $sql ) ) {
129
-				foreach ( $sql as $query ) {
130
-					$wpdb->query( $query );
128
+			if ( ! empty($sql)) {
129
+				foreach ($sql as $query) {
130
+					$wpdb->query($query);
131 131
 				}
132 132
 			}
133 133
 
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149 149
 
150
-		$items = $this->get_stored_data( 'give_temp_reset_ids', false );
151
-		$total = count( $items );
150
+		$items = $this->get_stored_data('give_temp_reset_ids', false);
151
+		$total = count($items);
152 152
 
153 153
 		$percentage = 100;
154 154
 
155
-		if ( $total > 0 ) {
156
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
155
+		if ($total > 0) {
156
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
157 157
 		}
158 158
 
159
-		if ( $percentage > 100 ) {
159
+		if ($percentage > 100) {
160 160
 			$percentage = 100;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param array $request The Form Data passed into the batch processing
172 172
 	 */
173
-	public function set_properties( $request ) {
173
+	public function set_properties($request) {
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,30 +181,30 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function process_step() {
183 183
 
184
-		if ( ! $this->can_export() ) {
185
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
184
+		if ( ! $this->can_export()) {
185
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
186 186
 		}
187 187
 
188 188
 		$had_data = $this->get_data();
189 189
 
190
-		if ( $had_data ) {
190
+		if ($had_data) {
191 191
 			$this->done = false;
192 192
 
193 193
 			return true;
194 194
 		} else {
195
-			update_option( 'give_earnings_total', 0 );
196
-			delete_transient( 'give_earnings_total' );
197
-			delete_transient( 'give_estimated_monthly_stats' . true );
198
-			delete_transient( 'give_estimated_monthly_stats' . false );
199
-			$this->delete_data( 'give_temp_reset_ids' );
195
+			update_option('give_earnings_total', 0);
196
+			delete_transient('give_earnings_total');
197
+			delete_transient('give_estimated_monthly_stats'.true);
198
+			delete_transient('give_estimated_monthly_stats'.false);
199
+			$this->delete_data('give_temp_reset_ids');
200 200
 
201 201
 			// Reset the sequential order numbers
202
-			if ( give_get_option( 'enable_sequential' ) ) {
203
-				delete_option( 'give_last_payment_number' );
202
+			if (give_get_option('enable_sequential')) {
203
+				delete_option('give_last_payment_number');
204 204
 			}
205 205
 
206 206
 			$this->done    = true;
207
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
207
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
208 208
 
209 209
 			return false;
210 210
 		}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * Headers
215 215
 	 */
216 216
 	public function headers() {
217
-		ignore_user_abort( true );
217
+		ignore_user_abort(true);
218 218
 
219
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-			set_time_limit( 0 );
219
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+			set_time_limit(0);
221 221
 		}
222 222
 	}
223 223
 
@@ -241,35 +241,35 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function pre_fetch() {
243 243
 
244
-		if ( $this->step == 1 ) {
245
-			$this->delete_data( 'give_temp_reset_ids' );
244
+		if ($this->step == 1) {
245
+			$this->delete_data('give_temp_reset_ids');
246 246
 		}
247 247
 
248
-		$items = get_option( 'give_temp_reset_ids', false );
248
+		$items = get_option('give_temp_reset_ids', false);
249 249
 
250
-		if ( false === $items ) {
250
+		if (false === $items) {
251 251
 			$items = array();
252 252
 
253
-			$give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' );
254
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
253
+			$give_types_for_reset = array('give_forms', 'give_log', 'give_payment');
254
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
255 255
 
256
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
256
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
257 257
 				'post_type'      => $give_types_for_reset,
258 258
 				'post_status'    => 'any',
259
-				'posts_per_page' => - 1,
260
-			) );
259
+				'posts_per_page' => -1,
260
+			));
261 261
 
262
-			$posts = get_posts( $args );
263
-			foreach ( $posts as $post ) {
262
+			$posts = get_posts($args);
263
+			foreach ($posts as $post) {
264 264
 				$items[] = array(
265 265
 					'id'   => (int) $post->ID,
266 266
 					'type' => $post->post_type,
267 267
 				);
268 268
 			}
269 269
 
270
-			$customer_args = array( 'number' => - 1 );
271
-			$customers     = Give()->customers->get_customers( $customer_args );
272
-			foreach ( $customers as $customer ) {
270
+			$customer_args = array('number' => -1);
271
+			$customers     = Give()->customers->get_customers($customer_args);
272
+			foreach ($customers as $customer) {
273 273
 				$items[] = array(
274 274
 					'id'   => (int) $customer->id,
275 275
 					'type' => 'customer',
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
 			// Allow filtering of items to remove with an unassociative array for each item
280 280
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
281
-			$items = apply_filters( 'give_reset_store_items', $items );
281
+			$items = apply_filters('give_reset_store_items', $items);
282 282
 
283
-			$this->store_data( 'give_temp_reset_ids', $items );
283
+			$this->store_data('give_temp_reset_ids', $items);
284 284
 		}
285 285
 
286 286
 	}
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return mixed       Returns the data from the database
296 296
 	 */
297
-	private function get_stored_data( $key ) {
297
+	private function get_stored_data($key) {
298 298
 		global $wpdb;
299
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
299
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
300 300
 
301
-		return empty( $value ) ? false : maybe_unserialize( $value );
301
+		return empty($value) ? false : maybe_unserialize($value);
302 302
 	}
303 303
 
304 304
 	/**
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @return void
313 313
 	 */
314
-	private function store_data( $key, $value ) {
314
+	private function store_data($key, $value) {
315 315
 		global $wpdb;
316 316
 
317
-		$value = maybe_serialize( $value );
317
+		$value = maybe_serialize($value);
318 318
 
319 319
 		$data = array(
320 320
 			'option_name'  => $key,
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			'%s',
329 329
 		);
330 330
 
331
-		$wpdb->replace( $wpdb->options, $data, $formats );
331
+		$wpdb->replace($wpdb->options, $data, $formats);
332 332
 	}
333 333
 
334 334
 	/**
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return void
342 342
 	 */
343
-	private function delete_data( $key ) {
343
+	private function delete_data($key) {
344 344
 		global $wpdb;
345
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
345
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
346 346
 	}
347 347
 
348 348
 }
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
171
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.