Completed
Pull Request — master (#782)
by
unknown
20:41
created
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52 52
 			/* translators: %s: upgrade URL */
53
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
54
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
53
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
54
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
55 55
 		);
56 56
 	}
57 57
 
58 58
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
59
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
59
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
60 60
 		printf(
61 61
 			/* translators: %s: upgrade URL */
62
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
63
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
62
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
63
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
64 64
 		);
65 65
 	}
66 66
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 }
72 72
 
73
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
73
+add_action('admin_notices', 'give_show_upgrade_notices');
74 74
 
75 75
 /**
76 76
  * Triggers all upgrade functions
@@ -82,26 +82,26 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function give_trigger_upgrades() {
84 84
 
85
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
86
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
85
+	if ( ! current_user_can('manage_give_settings')) {
86
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
87 87
 	}
88 88
 
89
-	$give_version = get_option( 'give_version' );
89
+	$give_version = get_option('give_version');
90 90
 
91
-	if ( ! $give_version ) {
91
+	if ( ! $give_version) {
92 92
 		// 1.0 is the first version to use this option so we must add it
93 93
 		$give_version = '1.0';
94
-		add_option( 'give_version', $give_version );
94
+		add_option('give_version', $give_version);
95 95
 	}
96 96
 
97
-	update_option( 'give_version', GIVE_VERSION );
97
+	update_option('give_version', GIVE_VERSION);
98 98
 
99
-	if ( DOING_AJAX ) {
100
-		die( 'complete' );
99
+	if (DOING_AJAX) {
100
+		die('complete');
101 101
 	} // Let AJAX know that the upgrade is complete
102 102
 }
103 103
 
104
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
104
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
105 105
 
106 106
 /**
107 107
  * Check if the upgrade routine has been run for a specific action
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
  *
113 113
  * @return bool                   If the action has been added to the completed actions array
114 114
  */
115
-function give_has_upgrade_completed( $upgrade_action = '' ) {
115
+function give_has_upgrade_completed($upgrade_action = '') {
116 116
 
117
-	if ( empty( $upgrade_action ) ) {
117
+	if (empty($upgrade_action)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	$completed_upgrades = give_get_completed_upgrades();
122 122
 
123
-	return in_array( $upgrade_action, $completed_upgrades );
123
+	return in_array($upgrade_action, $completed_upgrades);
124 124
 
125 125
 }
126 126
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return bool                   If the function was successfully added
135 135
  */
136
-function give_set_upgrade_complete( $upgrade_action = '' ) {
136
+function give_set_upgrade_complete($upgrade_action = '') {
137 137
 
138
-	if ( empty( $upgrade_action ) ) {
138
+	if (empty($upgrade_action)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	$completed_upgrades[] = $upgrade_action;
144 144
 
145 145
 	// Remove any blanks, and only show uniques
146
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
146
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
147 147
 
148
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
148
+	return update_option('give_completed_upgrades', $completed_upgrades);
149 149
 }
150 150
 
151 151
 /**
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function give_get_completed_upgrades() {
158 158
 
159
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
159
+	$completed_upgrades = get_option('give_completed_upgrades');
160 160
 
161
-	if ( false === $completed_upgrades ) {
161
+	if (false === $completed_upgrades) {
162 162
 		$completed_upgrades = array();
163 163
 	}
164 164
 
@@ -177,30 +177,30 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_v132_upgrade_give_payment_customer_id() {
179 179
 	global $wpdb;
180
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
181
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
180
+	if ( ! current_user_can('manage_give_settings')) {
181
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
182 182
 	}
183 183
 
184
-	ignore_user_abort( true );
184
+	ignore_user_abort(true);
185 185
 
186
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
187
-		@set_time_limit( 0 );
186
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
187
+		@set_time_limit(0);
188 188
 	}
189 189
 
190 190
 	//UPDATE DB METAKEYS
191 191
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
192
-	$query = $wpdb->query( $sql );
192
+	$query = $wpdb->query($sql);
193 193
 
194
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
195
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
196
-	delete_option( 'give_doing_upgrade' );
197
-	wp_redirect( admin_url() );
194
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
195
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
196
+	delete_option('give_doing_upgrade');
197
+	wp_redirect(admin_url());
198 198
 	exit;
199 199
 
200 200
 
201 201
 }
202 202
 
203
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
203
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
204 204
 
205 205
 /**
206 206
  * Upgrades the Offline Status
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 
215 215
 	global $wpdb;
216 216
 
217
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
218
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
217
+	if ( ! current_user_can('manage_give_settings')) {
218
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
219 219
 	}
220 220
 
221
-	ignore_user_abort( true );
221
+	ignore_user_abort(true);
222 222
 
223
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
224
-		@set_time_limit( 0 );
223
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
224
+		@set_time_limit(0);
225 225
 	}
226 226
 
227 227
 	// Get abandoned offline payments
@@ -231,35 +231,35 @@  discard block
 block discarded – undo
231 231
 	$where .= "AND ( p.post_status = 'abandoned' )";
232 232
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
233 233
 
234
-	$sql            = $select . $join . $where;
235
-	$found_payments = $wpdb->get_col( $sql );
234
+	$sql            = $select.$join.$where;
235
+	$found_payments = $wpdb->get_col($sql);
236 236
 
237 237
 
238
-	foreach ( $found_payments as $payment ) {
238
+	foreach ($found_payments as $payment) {
239 239
 
240 240
 		//Only change ones marked abandoned since our release last week
241 241
 		//because the admin may have marked some abandoned themselves
242
-		$modified_time = get_post_modified_time( 'U', false, $payment );
242
+		$modified_time = get_post_modified_time('U', false, $payment);
243 243
 
244 244
 		//1450124863 =  12/10/2015 20:42:25
245
-		if ( $modified_time >= 1450124863 ) {
245
+		if ($modified_time >= 1450124863) {
246 246
 
247
-			give_update_payment_status( $payment, 'pending' );
247
+			give_update_payment_status($payment, 'pending');
248 248
 
249 249
 		}
250 250
 
251 251
 	}
252 252
 
253
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
254
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
255
-	delete_option( 'give_doing_upgrade' );
256
-	wp_redirect( admin_url() );
253
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
254
+	give_set_upgrade_complete('upgrade_give_offline_status');
255
+	delete_option('give_doing_upgrade');
256
+	wp_redirect(admin_url());
257 257
 	exit;
258 258
 
259 259
 
260 260
 }
261 261
 
262
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
262
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
263 263
 
264 264
 
265 265
 /**
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
  */
272 272
 function give_v152_cleanup_users() {
273 273
 
274
-	$give_version = get_option( 'give_version' );
274
+	$give_version = get_option('give_version');
275 275
 
276
-	if ( ! $give_version ) {
276
+	if ( ! $give_version) {
277 277
 		// 1.0 is the first version to use this option so we must add it
278 278
 		$give_version = '1.0';
279 279
 	}
280 280
 
281
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
281
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
282 282
 
283 283
 	//v1.5.2 Upgrades
284
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
284
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
285 285
 
286 286
 		//Delete all caps with "ss"
287 287
 		//Also delete all unused "campaign" roles
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
 		);
329 329
 	
330 330
 		global $wp_roles;
331
-		foreach ( $delete_caps as $cap ) {
332
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
333
-				$wp_roles->remove_cap( $role, $cap );
331
+		foreach ($delete_caps as $cap) {
332
+			foreach (array_keys($wp_roles->roles) as $role) {
333
+				$wp_roles->remove_cap($role, $cap);
334 334
 			}
335 335
 		}
336 336
 	
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
 		$roles->add_caps();
341 341
 		
342 342
 		//The Update Ran
343
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
344
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
345
-		delete_option( 'give_doing_upgrade' );
343
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
344
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
345
+		delete_option('give_doing_upgrade');
346 346
 
347 347
 	}
348 348
 
349 349
 }
350 350
 
351
-add_action( 'admin_init', 'give_v152_cleanup_users' );
352 351
\ No newline at end of file
352
+add_action('admin_init', 'give_v152_cleanup_users');
353 353
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99 99
 			'title'            => give_get_forms_label_singular(),
100
-			'sales'            => esc_html__( 'Donations', 'give' ),
101
-			'earnings'         => esc_html__( 'Income', 'give' ),
102
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
104
-			'details'          => esc_html__( 'Detailed Report', 'give' )
100
+			'sales'            => esc_html__('Donations', 'give'),
101
+			'earnings'         => esc_html__('Income', 'give'),
102
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
103
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
104
+			'details'          => esc_html__('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 		// These aren't really bulk actions but this outputs the markup in the right place
175 175
 		give_report_views();
176 176
 	}
@@ -183,23 +183,23 @@  discard block
 block discarded – undo
183 183
 	 *
184 184
 	 * @param string $which
185 185
 	 */
186
-	protected function display_tablenav( $which ) {
186
+	protected function display_tablenav($which) {
187 187
 
188
-		if ( 'top' == $which ) {
189
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
188
+		if ('top' == $which) {
189
+			wp_nonce_field('bulk-'.$this->_args['plural']);
190 190
 		}
191 191
 		?>
192
-		<div class="tablenav give-clearfix <?php esc_attr_e( $which ); ?>">
192
+		<div class="tablenav give-clearfix <?php esc_attr_e($which); ?>">
193 193
 
194
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span></h3>
194
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Forms Report', 'give'); ?></span></h3>
195 195
 
196 196
 			<div class="alignright tablenav-right">
197 197
 				<div class="actions bulkactions">
198
-					<?php $this->bulk_actions( $which ); ?>
198
+					<?php $this->bulk_actions($which); ?>
199 199
 				</div>
200 200
 				<?php
201
-				$this->extra_tablenav( $which );
202
-				$this->pagination( $which );
201
+				$this->extra_tablenav($which);
202
+				$this->pagination($which);
203 203
 				?>
204 204
 			</div>
205 205
 
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 	 */
220 220
 	public function category_filter() {
221 221
 
222
-		$categories = get_terms( 'form_category' );
223
-		if ( $categories && ! is_wp_error( $categories ) ) {
224
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
222
+		$categories = get_terms('form_category');
223
+		if ($categories && ! is_wp_error($categories)) {
224
+			echo Give()->html->category_dropdown('category', $this->get_category());
225 225
 		}
226 226
 	}
227 227
 
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	 */
236 236
 	public function query() {
237 237
 
238
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
239
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
238
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
239
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
240 240
 		$category = $this->get_category();
241 241
 
242 242
 		$args = array(
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			'suppress_filters' => true
250 250
 		);
251 251
 
252
-		if ( ! empty( $category ) ) {
252
+		if ( ! empty($category)) {
253 253
 			$args['tax_query'] = array(
254 254
 				array(
255 255
 					'taxonomy' => 'form_category',
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			);
259 259
 		}
260 260
 
261
-		switch ( $orderby ) :
261
+		switch ($orderby) :
262 262
 			case 'title' :
263 263
 				$args['orderby'] = 'title';
264 264
 				break;
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 				break;
275 275
 		endswitch;
276 276
 
277
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
277
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
278 278
 
279
-		$this->products = new WP_Query( $args );
279
+		$this->products = new WP_Query($args);
280 280
 
281 281
 	}
282 282
 
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 
293 293
 		$give_forms = $this->products->posts;
294 294
 
295
-		if ( $give_forms ) {
296
-			foreach ( $give_forms as $form ) {
295
+		if ($give_forms) {
296
+			foreach ($give_forms as $form) {
297 297
 				$reports_data[] = array(
298 298
 					'ID'               => $form,
299
-					'title'            => get_the_title( $form ),
300
-					'sales'            => give_get_form_sales_stats( $form ),
301
-					'earnings'         => give_get_form_earnings_stats( $form ),
302
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
303
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
299
+					'title'            => get_the_title($form),
300
+					'sales'            => give_get_form_sales_stats($form),
301
+					'earnings'         => give_get_form_earnings_stats($form),
302
+					'average_sales'    => give_get_average_monthly_form_sales($form),
303
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
304 304
 				);
305 305
 			}
306 306
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
 		$sortable = $this->get_sortable_columns();
330 330
 
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 
333 333
 		$data = $this->reports_data();
334 334
 
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 
337 337
 		$this->items = $data;
338 338
 
339
-		$this->set_pagination_args( array(
339
+		$this->set_pagination_args(array(
340 340
 				'total_items' => $total_items,
341 341
 				'per_page'    => $this->per_page,
342
-				'total_pages' => ceil( $total_items / $this->per_page )
342
+				'total_pages' => ceil($total_items / $this->per_page)
343 343
 			)
344 344
 		);
345 345
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-payments.php 1 patch
Spacing   +80 added lines, -80 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,29 +39,29 @@  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', 'give' ),
48
-			'address2' => esc_html__( 'Address (Line 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
-			'products' => esc_html__( 'Products', 'give' ),
54
-			'amount'   => esc_html__( 'Amount', 'give' ) . ' (' . html_entity_decode( give_currency_filter( '' ) ) . ')',
55
-			'gateway'  => esc_html__( 'Payment Method', 'give' ),
56
-			'trans_id' => esc_html__( 'Transaction ID', 'give' ),
57
-			'key'      => esc_html__( 'Purchase Key', 'give' ),
58
-			'date'     => esc_html__( 'Date', 'give' ),
59
-			'user'     => esc_html__( 'User', 'give' ),
60
-			'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', 'give'),
48
+			'address2' => esc_html__('Address (Line 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
+			'products' => esc_html__('Products', 'give'),
54
+			'amount'   => esc_html__('Amount', 'give').' ('.html_entity_decode(give_currency_filter('')).')',
55
+			'gateway'  => esc_html__('Payment Method', 'give'),
56
+			'trans_id' => esc_html__('Transaction ID', 'give'),
57
+			'key'      => esc_html__('Purchase Key', 'give'),
58
+			'date'     => esc_html__('Date', 'give'),
59
+			'user'     => esc_html__('User', 'give'),
60
+			'status'   => esc_html__('Status', 'give')
61 61
 		);
62 62
 
63
-		if ( ! give_get_option( 'enable_sequential' ) ) {
64
-			unset( $cols['seq_id'] );
63
+		if ( ! give_get_option('enable_sequential')) {
64
+			unset($cols['seq_id']);
65 65
 		}
66 66
 
67 67
 		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,104 +101,104 @@  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 ( $downloads ) {
117
-					foreach ( $downloads as $key => $download ) {
116
+				if ($downloads) {
117
+					foreach ($downloads as $key => $download) {
118 118
 
119 119
 						// Form ID
120
-						$id  = isset( $payment_meta['cart_details'] ) ? $download['id'] : $download;
121
-						$qty = isset( $download['quantity'] ) ? $download['quantity'] : 1;
120
+						$id  = isset($payment_meta['cart_details']) ? $download['id'] : $download;
121
+						$qty = isset($download['quantity']) ? $download['quantity'] : 1;
122 122
 
123
-						if ( isset( $download['price'] ) ) {
123
+						if (isset($download['price'])) {
124 124
 							$price = $download['price'];
125 125
 						} else {
126 126
 							// If the download has variable prices, override the default price
127
-							$price_override = isset( $payment_meta['cart_details'] ) ? $download['price'] : null;
128
-							$price          = give_get_download_final_price( $id, $user_info, $price_override );
127
+							$price_override = isset($payment_meta['cart_details']) ? $download['price'] : null;
128
+							$price          = give_get_download_final_price($id, $user_info, $price_override);
129 129
 						}
130 130
 
131 131
 
132 132
 						// Display the Downoad Name
133
-						$products .= html_entity_decode( get_the_title( $id ) );
133
+						$products .= html_entity_decode(get_the_title($id));
134 134
 
135
-						if ( $qty > 1 ) {
136
-							$products .= html_entity_decode( ' (' . $qty . ')' );
135
+						if ($qty > 1) {
136
+							$products .= html_entity_decode(' ('.$qty.')');
137 137
 						}
138 138
 
139 139
 						$products .= ' - ';
140 140
 
141
-						if ( give_use_skus() ) {
142
-							$sku = give_get_download_sku( $id );
141
+						if (give_use_skus()) {
142
+							$sku = give_get_download_sku($id);
143 143
 
144
-							if ( ! empty( $sku ) ) {
144
+							if ( ! empty($sku)) {
145 145
 								$skus .= $sku;
146 146
 							}
147 147
 						}
148 148
 
149
-						if ( isset( $downloads[ $key ]['item_number'] ) && isset( $downloads[ $key ]['item_number']['options'] ) ) {
150
-							$price_options = $downloads[ $key ]['item_number']['options'];
149
+						if (isset($downloads[$key]['item_number']) && isset($downloads[$key]['item_number']['options'])) {
150
+							$price_options = $downloads[$key]['item_number']['options'];
151 151
 
152
-							if ( isset( $price_options['price_id'] ) ) {
153
-								$products .= html_entity_decode( give_get_price_option_name( $id, $price_options['price_id'], $payment->ID ) ) . ' - ';
152
+							if (isset($price_options['price_id'])) {
153
+								$products .= html_entity_decode(give_get_price_option_name($id, $price_options['price_id'], $payment->ID)).' - ';
154 154
 							}
155 155
 						}
156 156
 
157
-						$products .= html_entity_decode( give_currency_filter( give_format_amount( $price ) ) );
157
+						$products .= html_entity_decode(give_currency_filter(give_format_amount($price)));
158 158
 
159
-						if ( $key != ( count( $downloads ) - 1 ) ) {
159
+						if ($key != (count($downloads) - 1)) {
160 160
 							$products .= ' / ';
161 161
 
162
-							if ( give_use_skus() ) {
162
+							if (give_use_skus()) {
163 163
 								$skus .= ' / ';
164 164
 							}
165 165
 						}
166 166
 					}
167 167
 				}
168 168
 
169
-				if ( is_numeric( $user_id ) ) {
170
-					$user = get_userdata( $user_id );
169
+				if (is_numeric($user_id)) {
170
+					$user = get_userdata($user_id);
171 171
 				} else {
172 172
 					$user = false;
173 173
 				}
174 174
 
175 175
 				$data[] = array(
176 176
 					'id'       => $payment->ID,
177
-					'seq_id'   => give_get_payment_number( $payment->ID ),
177
+					'seq_id'   => give_get_payment_number($payment->ID),
178 178
 					'email'    => $payment_meta['email'],
179 179
 					'first'    => $user_info['first_name'],
180 180
 					'last'     => $user_info['last_name'],
181
-					'address1' => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
182
-					'address2' => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
183
-					'city'     => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
184
-					'state'    => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
185
-					'country'  => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
186
-					'zip'      => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
181
+					'address1' => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
182
+					'address2' => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
183
+					'city'     => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
184
+					'state'    => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
185
+					'country'  => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
186
+					'zip'      => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
187 187
 					'products' => $products,
188 188
 					'skus'     => $skus,
189
-					'amount'   => html_entity_decode( give_format_amount( $total ) ),
190
-					'gateway'  => give_get_gateway_admin_label( get_post_meta( $payment->ID, '_give_payment_gateway', true ) ),
191
-					'trans_id' => give_get_payment_transaction_id( $payment->ID ),
189
+					'amount'   => html_entity_decode(give_format_amount($total)),
190
+					'gateway'  => give_get_gateway_admin_label(get_post_meta($payment->ID, '_give_payment_gateway', true)),
191
+					'trans_id' => give_get_payment_transaction_id($payment->ID),
192 192
 					'key'      => $payment_meta['key'],
193 193
 					'date'     => $payment->post_date,
194
-					'user'     => $user ? $user->display_name : esc_html__( 'guest', 'give' ),
195
-					'status'   => give_get_payment_status( $payment, true )
194
+					'user'     => $user ? $user->display_name : esc_html__('guest', 'give'),
195
+					'status'   => give_get_payment_status($payment, true)
196 196
 				);
197 197
 
198 198
 			}
199 199
 
200
-			$data = apply_filters( 'give_export_get_data', $data );
201
-			$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
200
+			$data = apply_filters('give_export_get_data', $data);
201
+			$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
202 202
 
203 203
 			return $data;
204 204
 
@@ -218,27 +218,27 @@  discard block
 block discarded – undo
218 218
 
219 219
 		$status = $this->status;
220 220
 		$args   = array(
221
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
222
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
221
+			'start-date' => date('n/d/Y', strtotime($this->start)),
222
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
223 223
 		);
224 224
 
225
-		if ( 'any' == $status ) {
225
+		if ('any' == $status) {
226 226
 
227
-			$total = array_sum( (array) give_count_payments( $args ) );
227
+			$total = array_sum((array) give_count_payments($args));
228 228
 
229 229
 		} else {
230 230
 
231
-			$total = give_count_payments( $args )->$status;
231
+			$total = give_count_payments($args)->$status;
232 232
 
233 233
 		}
234 234
 
235 235
 		$percentage = 100;
236 236
 
237
-		if ( $total > 0 ) {
238
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
237
+		if ($total > 0) {
238
+			$percentage = ((30 * $this->step) / $total) * 100;
239 239
 		}
240 240
 
241
-		if ( $percentage > 100 ) {
241
+		if ($percentage > 100) {
242 242
 			$percentage = 100;
243 243
 		}
244 244
 
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param array $request The Form Data passed into the batch processing
254 254
 	 */
255
-	public function set_properties( $request ) {
256
-		$this->start  = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
257
-		$this->end    = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
258
-		$this->status = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
255
+	public function set_properties($request) {
256
+		$this->start  = isset($request['start']) ? sanitize_text_field($request['start']) : '';
257
+		$this->end    = isset($request['end']) ? sanitize_text_field($request['end']) : '';
258
+		$this->status = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
259 259
 	}
260 260
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-functions.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  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
 
18
-require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export.php';
19
-require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-actions.php';
18
+require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export.php';
19
+require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-actions.php';
20 20
 
21 21
 /**
22 22
  * Process batch exports via ajax
@@ -26,79 +26,79 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_do_ajax_export() {
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31
-	parse_str( $_POST['form'], $form );
31
+	parse_str($_POST['form'], $form);
32 32
 
33 33
 	$_REQUEST = $form = (array) $form;
34 34
 
35
-	if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) {
36
-		die( '-2' );
35
+	if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) {
36
+		die('-2');
37 37
 	}
38 38
 
39
-	do_action( 'give_batch_export_class_include', $form['give-export-class'] );
39
+	do_action('give_batch_export_class_include', $form['give-export-class']);
40 40
 
41
-	$step   = absint( $_POST['step'] );
42
-	$class  = sanitize_text_field( $form['give-export-class'] );
41
+	$step   = absint($_POST['step']);
42
+	$class  = sanitize_text_field($form['give-export-class']);
43 43
 
44
-	$export = new $class( $step );
44
+	$export = new $class($step);
45 45
 
46
-	if ( ! $export->can_export() ) {
47
-		die( '-1' );
46
+	if ( ! $export->can_export()) {
47
+		die('-1');
48 48
 	}
49 49
 
50
-	if ( ! $export->is_writable ) {
50
+	if ( ! $export->is_writable) {
51 51
 		$json_args = array(
52 52
 			'error'   => true,
53
-			'message' => esc_html__( 'Export location or file not writable.', 'give' )
53
+			'message' => esc_html__('Export location or file not writable.', 'give')
54 54
 		);
55 55
 		echo json_encode($json_args);
56 56
 		exit;
57 57
 	}
58 58
 
59
-	$export->set_properties( $_REQUEST );
59
+	$export->set_properties($_REQUEST);
60 60
 
61 61
 	$export->pre_fetch();
62 62
 
63
-	$ret = $export->process_step( $step );
63
+	$ret = $export->process_step($step);
64 64
 
65 65
 	$percentage = $export->get_percentage_complete();
66 66
 
67
-	if ( $ret ) {
67
+	if ($ret) {
68 68
 
69 69
 		$step += 1;
70
-		echo json_encode( array( 'step' => $step, 'percentage' => $percentage ) );
70
+		echo json_encode(array('step' => $step, 'percentage' => $percentage));
71 71
 		exit;
72 72
 
73
-	} elseif ( true === $export->is_empty ) {
73
+	} elseif (true === $export->is_empty) {
74 74
 
75
-		echo json_encode( array(
75
+		echo json_encode(array(
76 76
 			'error'   => true,
77
-			'message' => esc_html__( 'No data found for export parameters.', 'give' )
78
-		) );
77
+			'message' => esc_html__('No data found for export parameters.', 'give')
78
+		));
79 79
 		exit;
80 80
 
81
-	} elseif ( true === $export->done && true === $export->is_void ) {
81
+	} elseif (true === $export->done && true === $export->is_void) {
82 82
 
83
-		$message = ! empty( $export->message ) ? $export->message : esc_html__( 'Batch Processing Complete', 'give' );
84
-		echo json_encode( array( 'success' => true, 'message' => $message ) );
83
+		$message = ! empty($export->message) ? $export->message : esc_html__('Batch Processing Complete', 'give');
84
+		echo json_encode(array('success' => true, 'message' => $message));
85 85
 		exit;
86 86
 
87 87
 	} else {
88 88
 		
89
-		$args = array_merge( $_REQUEST, array(
89
+		$args = array_merge($_REQUEST, array(
90 90
 			'step'        => $step,
91 91
 			'class'       => $class,
92
-			'nonce'       => wp_create_nonce( 'give-batch-export' ),
92
+			'nonce'       => wp_create_nonce('give-batch-export'),
93 93
 			'give_action' => 'form_batch_export',
94
-		) );
94
+		));
95 95
 
96
-		$download_url = add_query_arg( $args, admin_url() );
96
+		$download_url = add_query_arg($args, admin_url());
97 97
 
98
-		echo json_encode( array( 'step' => 'done', 'url' => $download_url ) );
98
+		echo json_encode(array('step' => 'done', 'url' => $download_url));
99 99
 		exit;
100 100
 
101 101
 	}
102 102
 }
103 103
 
104
-add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' );
104
+add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export');
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-actions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
27 27
 	}
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
31
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
32 32
 
33 33
 	$export = new $_REQUEST['class'];
34 34
 	$export->export();
35 35
 
36 36
 }
37 37
 
38
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
38
+add_action('give_form_batch_export', 'give_process_batch_export_form');
39 39
 
40 40
 /**
41 41
  * Exports earnings for a specified time period
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
  * @return void
47 47
  */
48 48
 function give_export_earnings() {
49
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
49
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php';
50 50
 
51 51
 	$earnings_export = new Give_Earnings_Export();
52 52
 
53 53
 	$earnings_export->export();
54 54
 }
55 55
 
56
-add_action( 'give_earnings_export', 'give_export_earnings' );
56
+add_action('give_earnings_export', 'give_export_earnings');
57 57
 
58 58
 
59 59
 /**
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
  * @return void
67 67
  */
68 68
 function give_export_all_customers() {
69
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
69
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php';
70 70
 
71 71
 	$customer_export = new Give_Donors_Export();
72 72
 
73 73
 	$customer_export->export();
74 74
 }
75 75
 
76
-add_action( 'give_email_export', 'give_export_all_customers' );
76
+add_action('give_email_export', 'give_export_all_customers');
77 77
 
78 78
 /**
79 79
  * Add a hook allowing extensions to register a hook on the batch export process
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
  * @return void
83 83
  */
84 84
 function give_register_batch_exporters() {
85
-	if ( is_admin() ) {
86
-		do_action( 'give_register_batch_exporter' );
85
+	if (is_admin()) {
86
+		do_action('give_register_batch_exporter');
87 87
 	}
88 88
 }
89 89
 
90
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
90
+add_action('plugins_loaded', 'give_register_batch_exporters');
91 91
 
92 92
 /**
93 93
  * Register the payments batch exporter
94 94
  * @since  1.5
95 95
  */
96 96
 function give_register_payments_batch_export() {
97
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
97
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
98 98
 }
99 99
 
100
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
100
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
101 101
 
102 102
 /**
103 103
  * Loads the payments batch process if needed
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
  *
109 109
  * @return void
110 110
  */
111
-function give_include_payments_batch_processor( $class ) {
111
+function give_include_payments_batch_processor($class) {
112 112
 
113
-	if ( 'Give_Batch_Payments_Export' === $class ) {
114
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
113
+	if ('Give_Batch_Payments_Export' === $class) {
114
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php';
115 115
 	}
116 116
 
117 117
 }
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
  * @since  1.5.2
122 122
  */
123 123
 function give_register_customers_batch_export() {
124
-	add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 );
124
+	add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1);
125 125
 }
126 126
 
127
-add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 );
127
+add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10);
128 128
 
129 129
 /**
130 130
  * Loads the customers batch process if needed
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return void
137 137
  */
138
-function give_include_customers_batch_processor( $class ) {
138
+function give_include_customers_batch_processor($class) {
139 139
 
140
-	if ( 'Give_Batch_Customers_Export' === $class ) {
141
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
140
+	if ('Give_Batch_Customers_Export' === $class) {
141
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php';
142 142
 	}
143 143
 
144 144
 }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
  * @since  1.5
150 150
  */
151 151
 function give_register_forms_batch_export() {
152
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
152
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
153 153
 }
154 154
 
155
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
155
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
156 156
 
157 157
 /**
158 158
  * Loads the file downloads batch process if needed
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return void
165 165
  */
166
-function give_include_forms_batch_processor( $class ) {
166
+function give_include_forms_batch_processor($class) {
167 167
 
168
-	if ( 'Give_Batch_Forms_Export' === $class ) {
169
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php';
168
+	if ('Give_Batch_Forms_Export' === $class) {
169
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php';
170 170
 	}
171 171
 
172 172
 }
173 173
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-forms.php 1 patch
Spacing   +53 added lines, -53 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
 
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	public function csv_cols() {
42 42
 
43 43
 		$cols = array(
44
-			'ID'                      => esc_html__( 'ID', 'give' ),
45
-			'post_name'               => esc_html__( 'Slug', 'give' ),
46
-			'post_title'              => esc_html__( 'Name', 'give' ),
47
-			'post_date'               => esc_html__( 'Date Created', 'give' ),
48
-			'post_author'             => esc_html__( 'Author', 'give' ),
49
-			'post_content'            => esc_html__( 'Description', 'give' ),
50
-			'post_excerpt'            => esc_html__( 'Excerpt', 'give' ),
51
-			'post_status'             => esc_html__( 'Status', 'give' ),
52
-			'categories'              => esc_html__( 'Categories', 'give' ),
53
-			'tags'                    => esc_html__( 'Tags', 'give' ),
54
-			'give_price'              => esc_html__( 'Price', 'give' ),
55
-			'_thumbnail_id'           => esc_html__( 'Featured Image', 'give' ),
56
-			'_give_form_sales'        => esc_html__( 'Donations', 'give' ),
57
-			'_give_download_earnings' => esc_html__( 'Income', 'give' ),
44
+			'ID'                      => esc_html__('ID', 'give'),
45
+			'post_name'               => esc_html__('Slug', 'give'),
46
+			'post_title'              => esc_html__('Name', 'give'),
47
+			'post_date'               => esc_html__('Date Created', 'give'),
48
+			'post_author'             => esc_html__('Author', 'give'),
49
+			'post_content'            => esc_html__('Description', 'give'),
50
+			'post_excerpt'            => esc_html__('Excerpt', 'give'),
51
+			'post_status'             => esc_html__('Status', 'give'),
52
+			'categories'              => esc_html__('Categories', 'give'),
53
+			'tags'                    => esc_html__('Tags', 'give'),
54
+			'give_price'              => esc_html__('Price', 'give'),
55
+			'_thumbnail_id'           => esc_html__('Featured Image', 'give'),
56
+			'_give_form_sales'        => esc_html__('Donations', 'give'),
57
+			'_give_download_earnings' => esc_html__('Income', 'give'),
58 58
 		);
59 59
 
60 60
 		return $cols;
@@ -86,43 +86,43 @@  discard block
 block discarded – undo
86 86
 			'paged'          => $this->step
87 87
 		);
88 88
 
89
-		$downloads = new WP_Query( $args );
89
+		$downloads = new WP_Query($args);
90 90
 
91
-		if ( $downloads->posts ) {
92
-			foreach ( $downloads->posts as $download ) {
91
+		if ($downloads->posts) {
92
+			foreach ($downloads->posts as $download) {
93 93
 
94 94
 				$row = array();
95 95
 
96
-				foreach ( $this->csv_cols() as $key => $value ) {
96
+				foreach ($this->csv_cols() as $key => $value) {
97 97
 
98 98
 					// Setup default value
99
-					$row[ $key ] = '';
99
+					$row[$key] = '';
100 100
 
101
-					if ( in_array( $key, $meta ) ) {
101
+					if (in_array($key, $meta)) {
102 102
 
103
-						switch ( $key ) {
103
+						switch ($key) {
104 104
 
105 105
 							case '_thumbnail_id' :
106 106
 
107
-								$image_id    = get_post_thumbnail_id( $download->ID );
108
-								$row[ $key ] = wp_get_attachment_url( $image_id );
107
+								$image_id    = get_post_thumbnail_id($download->ID);
108
+								$row[$key] = wp_get_attachment_url($image_id);
109 109
 
110 110
 								break;
111 111
 
112 112
 							case 'give_price' :
113 113
 
114
-								if ( give_has_variable_prices( $download->ID ) ) {
114
+								if (give_has_variable_prices($download->ID)) {
115 115
 
116 116
 									$prices = array();
117
-									foreach ( give_get_variable_prices( $download->ID ) as $price ) {
118
-										$prices[] = $price['name'] . ': ' . $price['amount'];
117
+									foreach (give_get_variable_prices($download->ID) as $price) {
118
+										$prices[] = $price['name'].': '.$price['amount'];
119 119
 									}
120 120
 
121
-									$row[ $key ] = implode( ' | ', $prices );
121
+									$row[$key] = implode(' | ', $prices);
122 122
 
123 123
 								} else {
124 124
 
125
-									$row[ $key ] = give_get_download_price( $download->ID );
125
+									$row[$key] = give_get_download_price($download->ID);
126 126
 
127 127
 								}
128 128
 
@@ -132,54 +132,54 @@  discard block
 block discarded – undo
132 132
 
133 133
 
134 134
 								$files = array();
135
-								foreach ( give_get_download_files( $download->ID ) as $file ) {
135
+								foreach (give_get_download_files($download->ID) as $file) {
136 136
 									$files[] = $file['file'];
137 137
 								}
138 138
 
139
-								$row[ $key ] = implode( ' | ', $files );
139
+								$row[$key] = implode(' | ', $files);
140 140
 
141 141
 								break;
142 142
 
143 143
 							default :
144 144
 
145
-								$row[ $key ] = get_post_meta( $download->ID, $key, true );
145
+								$row[$key] = get_post_meta($download->ID, $key, true);
146 146
 
147 147
 								break;
148 148
 
149 149
 						}
150 150
 
151
-					} elseif ( isset( $download->$key ) ) {
151
+					} elseif (isset($download->$key)) {
152 152
 
153
-						switch ( $key ) {
153
+						switch ($key) {
154 154
 
155 155
 							case 'post_author' :
156 156
 
157
-								$row[ $key ] = get_the_author_meta( 'user_login', $download->post_author );
157
+								$row[$key] = get_the_author_meta('user_login', $download->post_author);
158 158
 
159 159
 								break;
160 160
 
161 161
 							default :
162 162
 
163
-								$row[ $key ] = $download->$key;
163
+								$row[$key] = $download->$key;
164 164
 
165 165
 								break;
166 166
 						}
167 167
 
168
-					} elseif ( 'tags' == $key ) {
168
+					} elseif ('tags' == $key) {
169 169
 
170
-						$terms = get_the_terms( $download->ID, 'download_tag' );
171
-						if ( $terms ) {
172
-							$terms       = wp_list_pluck( $terms, 'name' );
173
-							$row[ $key ] = implode( ' | ', $terms );
170
+						$terms = get_the_terms($download->ID, 'download_tag');
171
+						if ($terms) {
172
+							$terms       = wp_list_pluck($terms, 'name');
173
+							$row[$key] = implode(' | ', $terms);
174 174
 						}
175 175
 
176 176
 
177
-					} elseif ( 'categories' == $key ) {
177
+					} elseif ('categories' == $key) {
178 178
 
179
-						$terms = get_the_terms( $download->ID, 'download_category' );
180
-						if ( $terms ) {
181
-							$terms       = wp_list_pluck( $terms, 'name' );
182
-							$row[ $key ] = implode( ' | ', $terms );
179
+						$terms = get_the_terms($download->ID, 'download_category');
180
+						if ($terms) {
181
+							$terms       = wp_list_pluck($terms, 'name');
182
+							$row[$key] = implode(' | ', $terms);
183 183
 						}
184 184
 
185 185
 					}
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 
191 191
 			}
192 192
 
193
-			$data = apply_filters( 'give_export_get_data', $data );
194
-			$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
193
+			$data = apply_filters('give_export_get_data', $data);
194
+			$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
195 195
 
196 196
 			return $data;
197 197
 		}
@@ -210,20 +210,20 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$args = array(
212 212
 			'post_type'      => 'give_forms',
213
-			'posts_per_page' => - 1,
213
+			'posts_per_page' => -1,
214 214
 			'post_status'    => 'any',
215 215
 			'fields'         => 'ids',
216 216
 		);
217 217
 
218
-		$downloads  = new WP_Query( $args );
218
+		$downloads  = new WP_Query($args);
219 219
 		$total      = (int) $downloads->post_count;
220 220
 		$percentage = 100;
221 221
 
222
-		if ( $total > 0 ) {
223
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
222
+		if ($total > 0) {
223
+			$percentage = ((30 * $this->step) / $total) * 100;
224 224
 		}
225 225
 
226
-		if ( $percentage > 100 ) {
226
+		if ($percentage > 100) {
227 227
 			$percentage = 100;
228 228
 		}
229 229
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-export.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => esc_html__( 'ID', 'give' ),
73
-			'date' => esc_html__( 'Date', 'give' )
72
+			'id'   => esc_html__('ID', 'give'),
73
+			'date' => esc_html__('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( 'give_export_csv_cols_' . $this->export_type, $cols );
89
+		return apply_filters('give_export_csv_cols_'.$this->export_type, $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( 'give_export_get_data_' . $this->export_type, $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters('give_export_get_data_'.$this->export_type, $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/reporting/class-donor-reports-table.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,8 @@
 block discarded – undo
173 173
 
174 174
 			case 'num_purchases' :
175 175
 				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>';
176
+						 admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
+						 ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => esc_html__( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => esc_html__( 'Donors', 'give' ),    // Plural name of the listed records
65
+		parent::__construct(array(
66
+			'singular' => esc_html__('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => esc_html__('Donors', 'give'), // Plural name of the listed records
68 68
 			'ajax'     => false                        // Does this table support ajax?
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr__( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr__($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr__( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr__($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' == $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' == $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php esc_attr_e( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php esc_attr_e($which); ?>">
134 134
 
135
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donors Report', 'give' ); ?></span></h3>
135
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donors Report', 'give'); ?></span></h3>
136 136
 
137 137
 			<div class="alignright tablenav-right">
138 138
 				<div class="actions bulkactions">
139 139
 					<?php
140
-					if ( 'top' == $which ) {
141
-						$this->give_search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors-report-search' );
140
+					if ('top' == $which) {
141
+						$this->give_search_box(esc_html__('Search Donors', 'give'), 'give-donors-report-search');
142 142
 					}
143 143
 
144
-					$this->bulk_actions( $which ); ?>
144
+					$this->bulk_actions($which); ?>
145 145
 
146 146
 				</div>
147 147
 				<?php
148
-				$this->extra_tablenav( $which );
149
-				$this->pagination( $which );
148
+				$this->extra_tablenav($which);
149
+				$this->pagination($which);
150 150
 				?>
151 151
 			</div>
152 152
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Column Name
170 170
 	 */
171
-	public function column_default( $item, $column_name ) {
172
-		switch ( $column_name ) {
171
+	public function column_default($item, $column_name) {
172
+		switch ($column_name) {
173 173
 
174 174
 			case 'num_purchases' :
175
-				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html__( $item['num_purchases'] ) . '</a>';
175
+				$value = '<a href="'.
176
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
177
+				         ).'">'.esc_html__($item['num_purchases']).'</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
181
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
181
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
182 182
 				break;
183 183
 
184 184
 			default:
185
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
185
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
186 186
 				break;
187 187
 		}
188 188
 
189
-		return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] );
189
+		return apply_filters('give_report_column_'.$column_name, $value, $item['id']);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function get_columns() {
200 200
 		$columns = array(
201
-			'name'          => esc_html__( 'Name', 'give' ),
202
-			'id'            => esc_html__( 'ID', 'give' ),
203
-			'email'         => esc_html__( 'Email', 'give' ),
204
-			'num_purchases' => esc_html__( 'Purchases', 'give' ),
205
-			'amount_spent'  => esc_html__( 'Total Spent', 'give' )
201
+			'name'          => esc_html__('Name', 'give'),
202
+			'id'            => esc_html__('ID', 'give'),
203
+			'email'         => esc_html__('Email', 'give'),
204
+			'num_purchases' => esc_html__('Purchases', 'give'),
205
+			'amount_spent'  => esc_html__('Total Spent', 'give')
206 206
 		);
207 207
 
208
-		return apply_filters( 'give_report_donor_columns', $columns );
208
+		return apply_filters('give_report_donor_columns', $columns);
209 209
 
210 210
 	}
211 211
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function get_sortable_columns() {
220 220
 		return array(
221
-			'id'            => array( 'id', true ),
222
-			'name'          => array( 'name', true ),
223
-			'num_purchases' => array( 'purchase_count', false ),
224
-			'amount_spent'  => array( 'purchase_value', false ),
221
+			'id'            => array('id', true),
222
+			'name'          => array('name', true),
223
+			'num_purchases' => array('purchase_count', false),
224
+			'amount_spent'  => array('purchase_value', false),
225 225
 		);
226 226
 	}
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @return void
234 234
 	 */
235
-	public function bulk_actions( $which = '' ) {
235
+	public function bulk_actions($which = '') {
236 236
 		// These aren't really bulk actions but this outputs the markup in the right place
237 237
 		give_report_views();
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		}
293 293
 
294
-		$donors = Give()->customers->get_customers( $args );
294
+		$donors = Give()->customers->get_customers($args);
295 295
 
296
-		if ( $donors ) {
296
+		if ($donors) {
297 297
 
298
-			$this->count = count( $donors );
298
+			$this->count = count($donors);
299 299
 
300
-			foreach ( $donors as $donor ) {
300
+			foreach ($donors as $donor) {
301 301
 
302
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
302
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $donor->id,
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = $this->get_sortable_columns();
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$this->items = $this->reports_data();
338 338
 
339 339
 		$this->total = give_count_total_customers();
340 340
 
341
-		$this->set_pagination_args( array(
341
+		$this->set_pagination_args(array(
342 342
 			'total_items' => $this->total,
343 343
 			'per_page'    => $this->per_page,
344
-			'total_pages' => ceil( $this->total / $this->per_page )
345
-		) );
344
+			'total_pages' => ceil($this->total / $this->per_page)
345
+		));
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 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
 /**
@@ -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,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e( 'View Log Message', 'give' ); ?> "><?php esc_html_e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php esc_attr_e('View Log Message', 'give'); ?> "><?php esc_html_e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => esc_html__( 'Log ID', 'give' ),
126
-			'payment_id' => esc_html__( 'Payment ID', 'give' ),
127
-			'error'      => esc_html__( 'Error', 'give' ),
128
-			'message'    => esc_html__( 'Error Message', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'date'       => esc_html__( 'Date', 'give' )
125
+			'ID'         => esc_html__('Log ID', 'give'),
126
+			'payment_id' => esc_html__('Payment ID', 'give'),
127
+			'error'      => esc_html__('Error', 'give'),
128
+			'message'    => esc_html__('Error Message', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'date'       => esc_html__('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php esc_attr_e( $which ); ?>">
215
+		<div class="tablenav <?php esc_attr_e($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.