Completed
Pull Request — master (#1201)
by Ravinder
23:20
created
includes/admin/customers/customers.php 1 patch
Spacing   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_customers_page() {
26 26
 	$default_views  = give_customer_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_customer_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_customer_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_customers_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_customer_views', $views );
45
+	return apply_filters('give_customer_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_customer_tabs', $tabs );
59
+	return apply_filters('give_customer_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_customers_list() {
70
-	include( dirname( __FILE__ ) . '/class-customer-table.php' );
70
+	include(dirname(__FILE__).'/class-customer-table.php');
71 71
 
72 72
 	$customers_table = new Give_Customer_Reports_Table();
73 73
 	$customers_table->prepare_items();
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( 'give_donors_table_top' );
83
+		do_action('give_donors_table_top');
84 84
 		?>
85
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
85
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
86 86
 			<?php
87
-			$customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' );
87
+			$customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors');
88 88
 			$customers_table->display();
89 89
 			?>
90 90
 			<input type="hidden" name="post_type" value="give_forms" />
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 *
98 98
 		 * @since 1.0
99 99
 		 */
100
-		do_action( 'give_donors_table_bottom' );
100
+		do_action('give_donors_table_bottom');
101 101
 		?>
102 102
 	</div>
103 103
 	<?php
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return void
115 115
  */
116
-function give_render_customer_view( $view, $callbacks ) {
116
+function give_render_customer_view($view, $callbacks) {
117 117
 
118 118
 	$render = true;
119 119
 
120
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
120
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
121 121
 
122
-	if ( ! current_user_can( $customer_view_role ) ) {
123
-		give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) );
122
+	if ( ! current_user_can($customer_view_role)) {
123
+		give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give'));
124 124
 		$render = false;
125 125
 	}
126 126
  
127
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
128
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
127
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
128
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
129 129
 		$render = false;
130 130
 	}
131 131
 
132 132
 	$customer_id = (int) $_GET['id'];
133
-	$customer    = new Give_Customer( $customer_id );
133
+	$customer    = new Give_Customer($customer_id);
134 134
 
135
-	if ( empty( $customer->id ) ) {
136
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
135
+	if (empty($customer->id)) {
136
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
137 137
 		$render = false;
138 138
 	}
139 139
 
@@ -142,34 +142,34 @@  discard block
 block discarded – undo
142 142
 
143 143
 	<div class='wrap'>
144 144
 
145
-		<?php if ( give_get_errors() ) : ?>
145
+		<?php if (give_get_errors()) : ?>
146 146
 			<div class="error settings-error">
147
-				<?php give_print_errors( 0 ); ?>
147
+				<?php give_print_errors(0); ?>
148 148
 			</div>
149 149
 		<?php endif; ?>
150 150
 
151
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1>
151
+		<h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1>
152 152
 
153
-		<?php if ( $customer && $render ) : ?>
153
+		<?php if ($customer && $render) : ?>
154 154
 
155 155
 			<h2 class="nav-tab-wrapper">
156 156
 			<?php
157
-			foreach ( $customer_tabs as $key => $tab ) :
157
+			foreach ($customer_tabs as $key => $tab) :
158 158
 				$active = $key === $view ? true : false;
159 159
 				$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
160 160
 				printf(
161 161
 					'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
162
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ),
163
-					esc_attr( $class ),
164
-					sanitize_html_class( $tab['dashicon'] ),
165
-					esc_html( $tab['title'] )
162
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)),
163
+					esc_attr($class),
164
+					sanitize_html_class($tab['dashicon']),
165
+					esc_html($tab['title'])
166 166
 				);
167 167
 			endforeach;
168 168
 			?>
169 169
 			</h2>
170 170
 
171 171
 			<div id="give-customer-card-wrapper">
172
-				<?php $callbacks[ $view ]( $customer ) ?>
172
+				<?php $callbacks[$view]($customer) ?>
173 173
 			</div>
174 174
 
175 175
 		<?php endif; ?>
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return void
191 191
  */
192
-function give_customers_view( $customer ) {
192
+function give_customers_view($customer) {
193 193
 
194
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
194
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
195 195
 
196 196
 	/**
197 197
 	 * Fires in donor profile screen, above the donor card.
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param object $customer The customer object being displayed.
202 202
 	 */
203
-	do_action( 'give_donor_card_top', $customer );
203
+	do_action('give_donor_card_top', $customer);
204 204
 	?>
205 205
 
206 206
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
207 207
 
208
-		<form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>">
208
+		<form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>">
209 209
 
210 210
 			<div class="customer-info">
211 211
 
212 212
 				<div class="donor-bio-header clearfix">
213 213
 
214 214
 					<div class="avatar-wrap left" id="customer-avatar">
215
-						<?php echo get_avatar( $customer->email ); ?>
215
+						<?php echo get_avatar($customer->email); ?>
216 216
 					</div>
217 217
 
218 218
 					<div id="customer-name-wrap" class="left">
219 219
 						<span class="customer-id">#<?php echo $customer->id; ?></span>
220
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span>
220
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span>
221 221
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
222 222
 					</div>
223 223
 					<p class="customer-since info-item">
224
-						<?php esc_html_e( 'Donor since', 'give' ); ?>
225
-						<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
224
+						<?php esc_html_e('Donor since', 'give'); ?>
225
+						<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
226 226
 					</p>
227
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
228
-						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
227
+					<?php if (current_user_can($customer_edit_role)): ?>
228
+						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a>
229 229
 					<?php endif; ?>
230 230
 				</div>
231 231
 				<!-- /donor-bio-header -->
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					<table class="widefat">
236 236
 						<tbody>
237 237
 						<tr class="alternate">
238
-							<th scope="col"><label for="tablecell"><?php esc_html_e( 'User ID:', 'give' ); ?></label></th>
238
+							<th scope="col"><label for="tablecell"><?php esc_html_e('User ID:', 'give'); ?></label></th>
239 239
 							<td class="row-title">
240 240
 								<span class="customer-user-id info-item edit-item">
241 241
 									<?php
@@ -251,38 +251,38 @@  discard block
 block discarded – undo
251 251
 										'data'  => $data_atts,
252 252
 									);
253 253
 
254
-									if ( ! empty( $user_id ) ) {
255
-										$userdata           = get_userdata( $user_id );
254
+									if ( ! empty($user_id)) {
255
+										$userdata           = get_userdata($user_id);
256 256
 										$user_args['value'] = $userdata->user_login;
257 257
 									}
258 258
 
259
-									echo Give()->html->ajax_user_search( $user_args );
259
+									echo Give()->html->ajax_user_search($user_args);
260 260
 									?>
261 261
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
262 262
 								</span>
263 263
 			
264 264
 								<span class="customer-user-id info-item editable">
265
-									<?php if ( intval( $customer->user_id ) > 0 ) { ?>
265
+									<?php if (intval($customer->user_id) > 0) { ?>
266 266
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
267 267
 									<?php } else { ?>
268
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
268
+										<span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span>
269 269
 									<?php } ?>
270
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) { ?>
271
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this customer record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
270
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) { ?>
271
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this customer record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span>
272 272
 									<?php } ?>
273 273
 								</span>
274 274
 							</td>
275 275
 						</tr>
276
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
276
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
277 277
 
278 278
 							<tr>
279
-								<th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th>
279
+								<th scope="col"><?php esc_html_e('Address:', 'give'); ?></th>
280 280
 								<td class="row-title">
281 281
 
282 282
 									<div class="customer-address-wrapper">
283 283
 
284 284
 										<?php
285
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
285
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
286 286
 										$defaults = array(
287 287
 											'line1'   => '',
288 288
 											'line2'   => '',
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 											'zip'     => ''
293 293
 										);
294 294
 
295
-										$address = wp_parse_args( $address, $defaults );
295
+										$address = wp_parse_args($address, $defaults);
296 296
 										?>
297 297
 
298
-										<?php if ( ! empty( $address ) ) { ?>
298
+										<?php if ( ! empty($address)) { ?>
299 299
 											<span class="customer-address info-item editable">
300 300
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
301 301
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -306,43 +306,43 @@  discard block
 block discarded – undo
306 306
 											</span>
307 307
 										<?php } ?>
308 308
 										<span class="customer-address info-item edit-item">
309
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
310
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
311
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
309
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
310
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
311
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
312 312
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
313 313
 												<?php
314 314
 
315 315
 												$selected_country = $address['country'];
316 316
 
317 317
 												$countries = give_get_country_list();
318
-												foreach ( $countries as $country_code => $country ) {
319
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
318
+												foreach ($countries as $country_code => $country) {
319
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
320 320
 												}
321 321
 												?>
322 322
 											</select>
323 323
 											<?php
324 324
 											$selected_state = give_get_state();
325
-											$states         = give_get_states( $selected_country );
325
+											$states         = give_get_states($selected_country);
326 326
 
327
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
327
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
328 328
 
329
-											if ( ! empty( $states ) ) {
329
+											if ( ! empty($states)) {
330 330
 												?>
331 331
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
332 332
 													<?php
333
-													foreach ( $states as $state_code => $state ) {
334
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
333
+													foreach ($states as $state_code => $state) {
334
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
335 335
 													}
336 336
 													?>
337 337
 												</select>
338 338
 												<?php
339 339
 											} else {
340 340
 												?>
341
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" />
341
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" />
342 342
 												<?php
343 343
 											}
344 344
 											?>
345
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
345
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
346 346
 										</span>
347 347
 
348 348
 									</div>
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 			<span id="customer-edit-actions" class="edit-item">
360 360
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
361
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
361
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
362 362
 				<input type="hidden" name="give_action" value="edit-customer" />
363
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" />
364
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
363
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
364
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
365 365
 			</span>
366 366
 
367 367
 		</form>
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
 	 *
377 377
 	 * @param object $customer The customer object being displayed.
378 378
 	 */
379
-	do_action( 'give_donor_before_stats', $customer );
379
+	do_action('give_donor_before_stats', $customer);
380 380
 	?>
381 381
 
382 382
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
383 383
 		<ul>
384 384
 			<li>
385
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
385
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
386 386
 					<span class="dashicons dashicons-heart"></span>
387 387
 					<?php
388 388
 					//Completed Donations
389
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
390
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
389
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
390
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
391 391
 					?>
392 392
 				</a>
393 393
 			</li>
394 394
 			<li>
395 395
 				<span class="dashicons dashicons-chart-area"></span>
396
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?>
396
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?>
397 397
 			</li>
398 398
 			<?php
399 399
 			/**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			 *
406 406
 			 * @param object $customer The customer object being displayed.
407 407
 			 */
408
-			do_action( 'give_donor_stats_list', $customer );
408
+			do_action('give_donor_stats_list', $customer);
409 409
 			?>
410 410
 		</ul>
411 411
 	</div>
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param object $customer The customer object being displayed.
420 420
 	 */
421
-	do_action( 'give_donor_before_tables_wrapper', $customer );
421
+	do_action('give_donor_before_tables_wrapper', $customer);
422 422
 	?>
423 423
 
424 424
 	<div id="customer-tables-wrapper" class="customer-section">
@@ -431,40 +431,40 @@  discard block
 block discarded – undo
431 431
 		 *
432 432
 		 * @param object $customer The customer object being displayed.
433 433
 		 */
434
-		do_action( 'give_donor_before_tables', $customer );
434
+		do_action('give_donor_before_tables', $customer);
435 435
 		?>
436 436
 
437
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
437
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
438 438
 
439 439
 		<table class="wp-list-table widefat striped emails">
440 440
 			<thead>
441 441
 				<tr>
442
-					<th><?php _e( 'Email', 'give' ); ?></th>
443
-					<th><?php _e( 'Actions', 'give' ); ?></th>
442
+					<th><?php _e('Email', 'give'); ?></th>
443
+					<th><?php _e('Actions', 'give'); ?></th>
444 444
 				</tr>
445 445
 			</thead>
446 446
 
447 447
 			<tbody>
448
-				<?php if ( ! empty( $customer->emails ) ) { ?>
448
+				<?php if ( ! empty($customer->emails)) { ?>
449 449
 
450
-					<?php foreach ( $customer->emails as $key => $email ) : ?>
450
+					<?php foreach ($customer->emails as $key => $email) : ?>
451 451
 						<tr data-key="<?php echo $key; ?>">
452 452
 							<td>
453 453
 								<?php echo $email; ?>
454
-								<?php if ( 'primary' === $key ) : ?>
454
+								<?php if ('primary' === $key) : ?>
455 455
 									<span class="dashicons dashicons-star-filled primary-email-icon"></span>
456 456
 								<?php endif; ?>
457 457
 							</td>
458 458
 							<td>
459
-								<?php if ( 'primary' !== $key ) : ?>
459
+								<?php if ('primary' !== $key) : ?>
460 460
 									<?php
461
-									$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id );
462
-									$promote_url = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'set_donor_primary_email'), $base_url ), 'give-set-donor-primary-email' );
463
-									$remove_url  = wp_nonce_url( add_query_arg( array( 'email' => rawurlencode( $email ), 'give_action' => 'remove_donor_email' ), $base_url ), 'give-remove-donor-email'      );
461
+									$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id);
462
+									$promote_url = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'set_donor_primary_email'), $base_url), 'give-set-donor-primary-email');
463
+									$remove_url  = wp_nonce_url(add_query_arg(array('email' => rawurlencode($email), 'give_action' => 'remove_donor_email'), $base_url), 'give-remove-donor-email');
464 464
 									?>
465
-									<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
465
+									<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
466 466
 									&nbsp;|&nbsp;
467
-									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
467
+									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
468 468
 								<?php endif; ?>
469 469
 							</td>
470 470
 						</tr>
@@ -474,56 +474,56 @@  discard block
 block discarded – undo
474 474
 						<td colspan="2" class="add-customer-email-td">
475 475
 							<div class="add-customer-email-wrapper">
476 476
 								<input type="hidden" name="customer-id" value="<?php echo $customer->id; ?>" />
477
-								<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
478
-								<input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" />&nbsp;
479
-								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
480
-								<button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e( 'Add Email', 'give' ); ?></button>
477
+								<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
478
+								<input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" />&nbsp;
479
+								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
480
+								<button class="button-secondary give-add-customer-email" id="add-customer-email"><?php _e('Add Email', 'give'); ?></button>
481 481
 								<span class="spinner"></span>
482 482
 							</div>
483 483
 							<div class="notice-wrap"></div>
484 484
 						</td>
485 485
 					</tr>
486 486
 				<?php } else { ?>
487
-					<tr><td colspan="2"><?php _e( 'No Emails Found', 'easy-digital-downloads' ); ?></td></tr>
487
+					<tr><td colspan="2"><?php _e('No Emails Found', 'easy-digital-downloads'); ?></td></tr>
488 488
 				<?php } ?>
489 489
 			</tbody>
490 490
 		</table>
491 491
 
492
-		<h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3>
492
+		<h3><?php esc_html_e('Recent Donations', 'give'); ?></h3>
493 493
 		<?php
494
-		$payment_ids = explode( ',', $customer->payment_ids );
495
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
496
-		$payments    = array_slice( $payments, 0, 10 );
494
+		$payment_ids = explode(',', $customer->payment_ids);
495
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
496
+		$payments    = array_slice($payments, 0, 10);
497 497
 		?>
498 498
 		<table class="wp-list-table widefat striped payments">
499 499
 			<thead>
500 500
 			<tr>
501
-				<th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th>
502
-				<th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th>
503
-				<th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th>
504
-				<th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th>
505
-				<th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th>
501
+				<th scope="col"><?php esc_html_e('ID', 'give'); ?></th>
502
+				<th scope="col"><?php esc_html_e('Amount', 'give'); ?></th>
503
+				<th scope="col"><?php esc_html_e('Date', 'give'); ?></th>
504
+				<th scope="col"><?php esc_html_e('Status', 'give'); ?></th>
505
+				<th scope="col"><?php esc_html_e('Actions', 'give'); ?></th>
506 506
 			</tr>
507 507
 			</thead>
508 508
 			<tbody>
509
-			<?php if ( ! empty( $payments ) ) { ?>
510
-				<?php foreach ( $payments as $payment ) : ?>
509
+			<?php if ( ! empty($payments)) { ?>
510
+				<?php foreach ($payments as $payment) : ?>
511 511
 					<tr>
512 512
 						<td><?php echo $payment->ID; ?></td>
513
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
514
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
515
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
513
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
514
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
515
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
516 516
 						<td>
517 517
 							<?php
518 518
 							printf(
519 519
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
520
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ),
520
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID),
521 521
 								sprintf(
522 522
 									/* translators: %s: Donation ID */
523
-									esc_attr__( 'View Donation %s.', 'give' ),
523
+									esc_attr__('View Donation %s.', 'give'),
524 524
 									$payment->ID
525 525
 								),
526
-								esc_html__( 'View Donation', 'give' )
526
+								esc_html__('View Donation', 'give')
527 527
 							);
528 528
 							?>
529 529
 
@@ -538,46 +538,46 @@  discard block
 block discarded – undo
538 538
 							 * @param object $customer The customer object being displayed.
539 539
 							 * @param object $payment  The payment object being displayed.
540 540
 							 */
541
-							do_action( 'give_donor_recent_purchases_actions', $customer, $payment );
541
+							do_action('give_donor_recent_purchases_actions', $customer, $payment);
542 542
 							?>
543 543
 						</td>
544 544
 					</tr>
545 545
 				<?php endforeach; ?>
546 546
 			<?php } else { ?>
547 547
 				<tr>
548
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
548
+					<td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td>
549 549
 				</tr>
550 550
 			<?php } ?>
551 551
 			</tbody>
552 552
 		</table>
553 553
 
554
-		<h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3>
554
+		<h3><?php esc_html_e('Completed Forms', 'give'); ?></h3>
555 555
 		<?php
556
-		$donations = give_get_users_completed_donations( $customer->email );
556
+		$donations = give_get_users_completed_donations($customer->email);
557 557
 		?>
558 558
 		<table class="wp-list-table widefat striped donations">
559 559
 			<thead>
560 560
 			<tr>
561
-				<th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th>
562
-				<th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th>
561
+				<th scope="col"><?php esc_html_e('Form', 'give'); ?></th>
562
+				<th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th>
563 563
 			</tr>
564 564
 			</thead>
565 565
 			<tbody>
566
-			<?php if ( ! empty( $donations ) ) { ?>
567
-				<?php foreach ( $donations as $donation ) : ?>
566
+			<?php if ( ! empty($donations)) { ?>
567
+				<?php foreach ($donations as $donation) : ?>
568 568
 					<tr>
569 569
 						<td><?php echo $donation->post_title; ?></td>
570 570
 						<td>
571 571
 							<?php
572 572
 							printf(
573 573
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
574
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
574
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
575 575
 								sprintf(
576 576
 									/* translators: %s: form name */
577
-									esc_attr__( 'View Form %s.', 'give' ),
577
+									esc_attr__('View Form %s.', 'give'),
578 578
 									$donation->post_title
579 579
 								),
580
-								esc_html__( 'View Form', 'give' )
580
+								esc_html__('View Form', 'give')
581 581
 							);
582 582
 							?>
583 583
 						</td>
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 				<?php endforeach; ?>
586 586
 			<?php } else { ?>
587 587
 				<tr>
588
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
588
+					<td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td>
589 589
 				</tr>
590 590
 			<?php } ?>
591 591
 			</tbody>
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 		 *
600 600
 		 * @param object $customer The customer object being displayed.
601 601
 		 */
602
-		do_action( 'give_donor_after_tables', $customer );
602
+		do_action('give_donor_after_tables', $customer);
603 603
 		?>
604 604
 
605 605
 	</div>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	 *
613 613
 	 * @param object $customer The customer object being displayed.
614 614
 	 */
615
-	do_action( 'give_donor_card_bottom', $customer );
615
+	do_action('give_donor_card_bottom', $customer);
616 616
 
617 617
 }
618 618
 
@@ -625,30 +625,30 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_customer_notes_view( $customer ) {
628
+function give_customer_notes_view($customer) {
629 629
 
630
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
631
-	$paged          = absint( $paged );
630
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
631
+	$paged          = absint($paged);
632 632
 	$note_count     = $customer->get_notes_count();
633
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
634
-	$total_pages    = ceil( $note_count / $per_page );
635
-	$customer_notes = $customer->get_notes( $per_page, $paged );
633
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
634
+	$total_pages    = ceil($note_count / $per_page);
635
+	$customer_notes = $customer->get_notes($per_page, $paged);
636 636
 	?>
637 637
 
638 638
 	<div id="customer-notes-wrapper">
639 639
 		<div class="customer-notes-header">
640
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
640
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
641 641
 		</div>
642
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
642
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
643 643
 
644
-		<?php if ( 1 == $paged ) : ?>
644
+		<?php if (1 == $paged) : ?>
645 645
 			<div style="display: block; margin-bottom: 55px;">
646
-				<form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>">
646
+				<form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>">
647 647
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
648 648
 					<br />
649 649
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
650 650
 					<input type="hidden" name="give_action" value="add-customer-note" />
651
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
651
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
652 652
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
653 653
 				</form>
654 654
 			</div>
@@ -663,26 +663,26 @@  discard block
 block discarded – undo
663 663
 			'show_all' => true
664 664
 		);
665 665
 
666
-		echo paginate_links( $pagination_args );
666
+		echo paginate_links($pagination_args);
667 667
 		?>
668 668
 
669 669
 		<div id="give-customer-notes" class="postbox">
670
-			<?php if ( count( $customer_notes ) > 0 ) { ?>
671
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
670
+			<?php if (count($customer_notes) > 0) { ?>
671
+				<?php foreach ($customer_notes as $key => $note) : ?>
672 672
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
673 673
 					<span class="note-content-wrap">
674
-						<?php echo stripslashes( $note ); ?>
674
+						<?php echo stripslashes($note); ?>
675 675
 					</span>
676 676
 					</div>
677 677
 				<?php endforeach; ?>
678 678
 			<?php } else { ?>
679 679
 				<div class="give-no-customer-notes">
680
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
680
+					<?php esc_html_e('No donor notes found.', 'give'); ?>
681 681
 				</div>
682 682
 			<?php } ?>
683 683
 		</div>
684 684
 
685
-		<?php echo paginate_links( $pagination_args ); ?>
685
+		<?php echo paginate_links($pagination_args); ?>
686 686
 
687 687
 	</div>
688 688
 
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
  *
699 699
  * @return void
700 700
  */
701
-function give_customers_delete_view( $customer ) {
701
+function give_customers_delete_view($customer) {
702 702
 
703
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
703
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
704 704
 
705 705
 	/**
706 706
 	 * Fires in donor delete screen, above the content.
@@ -709,15 +709,15 @@  discard block
 block discarded – undo
709 709
 	 *
710 710
 	 * @param object $customer The customer object being displayed.
711 711
 	 */
712
-	do_action( 'give_customer_delete_top', $customer );
712
+	do_action('give_customer_delete_top', $customer);
713 713
 	?>
714 714
 
715 715
 	<div class="info-wrapper customer-section">
716 716
 
717
-		<form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>">
717
+		<form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>">
718 718
 
719 719
 			<div class="customer-notes-header">
720
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
720
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
721 721
 			</div>
722 722
 
723 723
 
@@ -725,16 +725,16 @@  discard block
 block discarded – undo
725 725
 
726 726
 				<span class="delete-customer-options">
727 727
 					<p>
728
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
729
-						<label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
728
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
729
+						<label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
730 730
 					</p>
731 731
 
732 732
 					<p>
733
-						<?php echo Give()->html->checkbox( array(
733
+						<?php echo Give()->html->checkbox(array(
734 734
 							'name'    => 'give-customer-delete-records',
735
-							'options' => array( 'disabled' => true )
736
-						) ); ?>
737
-						<label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label>
735
+							'options' => array('disabled' => true)
736
+						)); ?>
737
+						<label for="give-customer-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label>
738 738
 					</p>
739 739
 
740 740
 					<?php
@@ -747,16 +747,16 @@  discard block
 block discarded – undo
747 747
 					 *
748 748
 					 * @param object $customer The customer object being displayed.
749 749
 					 */
750
-					do_action( 'give_customer_delete_inputs', $customer );
750
+					do_action('give_customer_delete_inputs', $customer);
751 751
 					?>
752 752
 				</span>
753 753
 
754 754
 				<span id="customer-edit-actions">
755 755
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
756
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
756
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
757 757
 					<input type="hidden" name="give_action" value="delete-customer" />
758
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
759
-					<a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
758
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
759
+					<a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
760 760
 				</span>
761 761
 
762 762
 			</div>
@@ -772,5 +772,5 @@  discard block
 block discarded – undo
772 772
 	 *
773 773
 	 * @param object $customer The customer object being displayed.
774 774
 	 */
775
-	do_action( 'give_customer_delete_bottom', $customer );
775
+	do_action('give_customer_delete_bottom', $customer);
776 776
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +50 added lines, -50 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
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		if ( is_admin() ) {
37
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
36
+		if (is_admin()) {
37
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
38 38
 
39
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
40
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
41
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
39
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
40
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
41
+			add_action('media_buttons', array($this, 'shortcode_button'));
42 42
 		}
43 43
 
44
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
45
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
44
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
45
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @since 1.0
56 56
 	 */
57
-	public function mce_external_plugins( $plugin_array ) {
57
+	public function mce_external_plugins($plugin_array) {
58 58
 
59
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
59
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
60 60
 			return false;
61 61
 		}
62 62
 
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
65
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
66 66
 
67 67
 		return $plugin_array;
68 68
 	}
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function admin_enqueue_assets() {
78 78
 
79
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
79
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
80 80
 
81 81
 		wp_enqueue_script(
82 82
 			'give_shortcode',
83
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
84
-			array( 'jquery' ),
83
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
84
+			array('jquery'),
85 85
 			GIVE_VERSION,
86 86
 			true
87 87
 		);
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function admin_localize_scripts() {
98 98
 
99
-		if ( ! empty( self::$shortcodes ) ) {
99
+		if ( ! empty(self::$shortcodes)) {
100 100
 
101 101
 			$variables = array();
102 102
 
103
-			foreach ( self::$shortcodes as $shortcode => $values ) {
104
-				if ( ! empty( $values['required'] ) ) {
105
-					$variables[ $shortcode ] = $values['required'];
103
+			foreach (self::$shortcodes as $shortcode => $values) {
104
+				if ( ! empty($values['required'])) {
105
+					$variables[$shortcode] = $values['required'];
106 106
 				}
107 107
 			}
108 108
 
109
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
109
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
110 110
 		}
111 111
 	}
112 112
 
@@ -121,33 +121,33 @@  discard block
 block discarded – undo
121 121
 
122 122
 		$screen = get_current_screen();
123 123
 
124
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
124
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
125 125
 			'post.php',
126 126
 			'page.php',
127 127
 			'post-new.php',
128 128
 			'post-edit.php',
129 129
 			'edit.php',
130 130
 			'edit.php?post_type=page',
131
-		) );
131
+		));
132 132
 
133 133
 		// Only run in admin post/page creation and edit screens
134
-		if ( in_array( $screen->parent_file, $shortcode_button_pages )
135
-		     && apply_filters( 'give_shortcode_button_condition', true )
136
-		     && ! empty( self::$shortcodes )
134
+		if (in_array($screen->parent_file, $shortcode_button_pages)
135
+		     && apply_filters('give_shortcode_button_condition', true)
136
+		     && ! empty(self::$shortcodes)
137 137
 		) {
138 138
 
139 139
 			$shortcodes = array();
140 140
 
141
-			foreach ( self::$shortcodes as $shortcode => $values ) {
141
+			foreach (self::$shortcodes as $shortcode => $values) {
142 142
 
143 143
 				/**
144 144
 				 * Filters the condition for including the current shortcode
145 145
 				 *
146 146
 				 * @since 1.0
147 147
 				 */
148
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
148
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
149 149
 
150
-					$shortcodes[ $shortcode ] = sprintf(
150
+					$shortcodes[$shortcode] = sprintf(
151 151
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%s">%s</div>',
152 152
 						$shortcode,
153 153
 						$values['label'],
@@ -156,37 +156,37 @@  discard block
 block discarded – undo
156 156
 				}
157 157
 			}
158 158
 
159
-			if ( ! empty( $shortcodes ) ) {
159
+			if ( ! empty($shortcodes)) {
160 160
 
161 161
 				// check current WP version
162
-				$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
163
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
164
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
162
+				$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
163
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
164
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
165 165
 
166
-				reset( $shortcodes );
166
+				reset($shortcodes);
167 167
 
168
-				if ( count( $shortcodes ) == 1 ) {
168
+				if (count($shortcodes) == 1) {
169 169
 
170
-					$shortcode = key( $shortcodes );
170
+					$shortcode = key($shortcodes);
171 171
 
172 172
 					printf(
173 173
 						'<button class="button sc-shortcode" data-shortcode="%s">%s</button>',
174 174
 						$shortcode,
175
-						sprintf( '%s %s %s',
175
+						sprintf('%s %s %s',
176 176
 							$img,
177
-							esc_html__( 'Insert', 'give' ),
178
-							self::$shortcodes[ $shortcode ]['label']
177
+							esc_html__('Insert', 'give'),
178
+							self::$shortcodes[$shortcode]['label']
179 179
 						)
180 180
 					);
181 181
 				} else {
182 182
 					printf(
183
-						'<div class="sc-wrap">' .
184
-						'<button class="button sc-button">%s %s</button>' .
185
-						'<div class="sc-menu mce-menu">%s</div>' .
183
+						'<div class="sc-wrap">'.
184
+						'<button class="button sc-button">%s %s</button>'.
185
+						'<div class="sc-menu mce-menu">%s</div>'.
186 186
 						'</div>',
187 187
 						$img,
188
-						esc_html__( 'Give Shortcodes', 'give' ),
189
-						implode( '', array_values( $shortcodes ) )
188
+						esc_html__('Give Shortcodes', 'give'),
189
+						implode('', array_values($shortcodes))
190 190
 					);
191 191
 				}
192 192
 			}
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function shortcode_ajax() {
204 204
 
205
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
205
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
206 206
 		$response  = false;
207 207
 
208
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
208
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
209 209
 
210
-			$data = self::$shortcodes[ $shortcode ];
210
+			$data = self::$shortcodes[$shortcode];
211 211
 
212
-			if ( ! empty( $data['errors'] ) ) {
213
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
212
+			if ( ! empty($data['errors'])) {
213
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
214 214
 			}
215 215
 
216 216
 			$response = array(
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 			);
223 223
 		} else {
224 224
 			// todo: handle error
225
-			error_log( print_r( 'AJAX error!', 1 ) );
225
+			error_log(print_r('AJAX error!', 1));
226 226
 		}
227 227
 
228
-		wp_send_json( $response );
228
+		wp_send_json($response);
229 229
 	}
230 230
 }
231 231
 
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" role="search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,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 echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($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/welcome.php 1 patch
Spacing   +103 added lines, -103 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
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -49,45 +49,45 @@  discard block
 block discarded – undo
49 49
 	 * @return void
50 50
 	 */
51 51
 	public function admin_menus() {
52
-		list( $display_version ) = explode( '-', GIVE_VERSION );
52
+		list($display_version) = explode('-', GIVE_VERSION);
53 53
 
54 54
 		// About Page
55 55
 		add_dashboard_page(
56 56
 			/* translators: %s: Give version */
57
-			sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ),
58
-			esc_html__( 'Welcome to Give', 'give' ),
57
+			sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version),
58
+			esc_html__('Welcome to Give', 'give'),
59 59
 			$this->minimum_capability,
60 60
 			'give-about',
61
-			array( $this, 'about_screen' )
61
+			array($this, 'about_screen')
62 62
 		);
63 63
 
64 64
 		// Changelog Page
65 65
 		add_dashboard_page(
66
-			esc_html__( 'Give Changelog', 'give' ),
67
-			esc_html__( 'Give Changelog', 'give' ),
66
+			esc_html__('Give Changelog', 'give'),
67
+			esc_html__('Give Changelog', 'give'),
68 68
 			$this->minimum_capability,
69 69
 			'give-changelog',
70
-			array( $this, 'changelog_screen' )
70
+			array($this, 'changelog_screen')
71 71
 		);
72 72
 
73 73
 		// Getting Started Page
74 74
 		add_dashboard_page(
75 75
 			/* translators: %s: Give version */
76
-			sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ),
77
-			esc_html__( 'Getting started with Give', 'give' ),
76
+			sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version),
77
+			esc_html__('Getting started with Give', 'give'),
78 78
 			$this->minimum_capability,
79 79
 			'give-getting-started',
80
-			array( $this, 'getting_started_screen' )
80
+			array($this, 'getting_started_screen')
81 81
 		);
82 82
 
83 83
 		// Credits Page
84 84
 		add_dashboard_page(
85 85
 			/* translators: %s: Give version */
86
-			sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ),
87
-			esc_html__( 'The people that build Give', 'give' ),
86
+			sprintf(esc_html__('Give %s - Credits', 'give'), $display_version),
87
+			esc_html__('The people that build Give', 'give'),
88 88
 			$this->minimum_capability,
89 89
 			'give-credits',
90
-			array( $this, 'credits_screen' )
90
+			array($this, 'credits_screen')
91 91
 		);
92 92
 	}
93 93
 
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 	public function admin_head() {
102 102
 
103
-		remove_submenu_page( 'index.php', 'give-about' );
104
-		remove_submenu_page( 'index.php', 'give-changelog' );
105
-		remove_submenu_page( 'index.php', 'give-getting-started' );
106
-		remove_submenu_page( 'index.php', 'give-credits' );
103
+		remove_submenu_page('index.php', 'give-about');
104
+		remove_submenu_page('index.php', 'give-changelog');
105
+		remove_submenu_page('index.php', 'give-getting-started');
106
+		remove_submenu_page('index.php', 'give-credits');
107 107
 
108 108
 		// Badge for welcome page
109
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
109
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
110 110
 
111 111
 		?>
112 112
 		<style type="text/css" media="screen">
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 	 * @return void
187 187
 	 */
188 188
 	public function tabs() {
189
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
189
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
190 190
 		?>
191 191
 		<h2 class="nav-tab-wrapper">
192
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
193
-				<?php esc_html_e( 'About Give', 'give' ); ?>
192
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
193
+				<?php esc_html_e('About Give', 'give'); ?>
194 194
 			</a>
195
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
196
-				<?php esc_html_e( 'Getting Started', 'give' ); ?>
195
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
196
+				<?php esc_html_e('Getting Started', 'give'); ?>
197 197
 			</a>
198
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
199
-				<?php esc_html_e( 'Credits', 'give' ); ?>
198
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
199
+				<?php esc_html_e('Credits', 'give'); ?>
200 200
 			</a>
201
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>">
202
-				<?php esc_html_e( 'Add-ons', 'give' ); ?>
201
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>">
202
+				<?php esc_html_e('Add-ons', 'give'); ?>
203 203
 			</a>
204 204
 		</h2>
205 205
 	<?php
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return void
214 214
 	 */
215 215
 	public function about_screen() {
216
-		list( $display_version ) = explode( '-', GIVE_VERSION );
216
+		list($display_version) = explode('-', GIVE_VERSION);
217 217
 		?>
218 218
 		<div class="wrap about-wrap">
219 219
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 			<p class="about-text"><?php
224 224
 				printf(
225 225
 					/* translators: %s: https://givewp.com/documenation/ */
226
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
227
-					esc_url( 'https://givewp.com/documenation/' )
226
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
227
+					esc_url('https://givewp.com/documenation/')
228 228
 				);
229 229
 			?></p>
230 230
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 			<div class="give-badge"><?php
234 234
 				printf(
235 235
 					/* translators: %s: Give version */
236
-					esc_html__( 'Version %s', 'give' ),
236
+					esc_html__('Version %s', 'give'),
237 237
 					$display_version
238 238
 				);
239 239
 			?></div>
@@ -243,16 +243,16 @@  discard block
 block discarded – undo
243 243
 			<div class="feature-section clearfix introduction">
244 244
 
245 245
 				<div class="video feature-section-item">
246
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>">
246
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" alt="<?php esc_attr_e('A Give donation form', 'give'); ?>">
247 247
 				</div>
248 248
 
249 249
 				<div class="content feature-section-item last-feature">
250 250
 
251
-					<h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
251
+					<h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3>
252 252
 
253
-					<p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
253
+					<p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
254 254
 					<a href="https://givewp.com" target="_blank" class="button-secondary">
255
-						<?php esc_html_e( 'Learn More', 'give' ); ?>
255
+						<?php esc_html_e('Learn More', 'give'); ?>
256 256
 						<span class="dashicons dashicons-external"></span>
257 257
 					</a>
258 258
 
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 
266 266
 				<div class="content feature-section-item">
267 267
 
268
-					<h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3>
268
+					<h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3>
269 269
 
270
-					<p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
270
+					<p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
271 271
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary">
272
-						<?php esc_html_e( 'View Documentation', 'give' ); ?>
272
+						<?php esc_html_e('View Documentation', 'give'); ?>
273 273
 						<span class="dashicons dashicons-external"></span>
274 274
 					</a>
275 275
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 				<div class="content  feature-section-item last-feature">
279 279
 
280
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e( 'Give', 'give' ); ?>">
280
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" alt="<?php esc_attr_e('Give', 'give'); ?>">
281 281
 
282 282
 				</div>
283 283
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @return void
298 298
 	 */
299 299
 	public function changelog_screen() {
300
-		list( $display_version ) = explode( '-', GIVE_VERSION );
300
+		list($display_version) = explode('-', GIVE_VERSION);
301 301
 		?>
302 302
 		<div class="wrap about-wrap">
303 303
 			<h1><?php echo get_admin_page_title(); ?></h1>
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
 			<p class="about-text"><?php
306 306
 				printf(
307 307
 					/* translators: %s: Give version */
308
-					esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
308
+					esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
309 309
 					$display_version
310 310
 				);
311 311
 			?></p>
312 312
 			<div class="give-badge"><?php
313 313
 				printf(
314 314
 					/* translators: %s: Give version */
315
-					esc_html__( 'Version %s', 'give' ),
315
+					esc_html__('Version %s', 'give'),
316 316
 					$display_version
317 317
 				);
318 318
 			?></div>
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			<?php $this->tabs(); ?>
321 321
 
322 322
 			<div class="changelog">
323
-				<h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3>
323
+				<h3><?php esc_html_e('Full Changelog', 'give'); ?></h3>
324 324
 
325 325
 				<div class="feature-section">
326 326
 					<?php echo $this->parse_readme(); ?>
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
 			</div>
329 329
 
330 330
 			<div class="return-to-dashboard">
331
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
331
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
332 332
 					'post_type' => 'give_forms',
333 333
 					'page'      => 'give-settings'
334
-				), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a>
334
+				), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a>
335 335
 			</div>
336 336
 		</div>
337 337
 	<?php
@@ -345,37 +345,37 @@  discard block
 block discarded – undo
345 345
 	 * @return void
346 346
 	 */
347 347
 	public function getting_started_screen() {
348
-		list( $display_version ) = explode( '-', GIVE_VERSION );
348
+		list($display_version) = explode('-', GIVE_VERSION);
349 349
 		?>
350 350
 		<div class="wrap about-wrap get-started">
351 351
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
352 352
 
353 353
 			<?php give_social_media_elements() ?>
354 354
 
355
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
355
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
356 356
 
357 357
 			<?php give_get_newsletter(); ?>
358 358
 
359 359
 			<div class="give-badge"><?php
360 360
 				printf(
361 361
 					/* translators: %s: Give version */
362
-					esc_html__( 'Version %s', 'give' ),
362
+					esc_html__('Version %s', 'give'),
363 363
 					$display_version
364 364
 				);
365 365
 			?></div>
366 366
 
367 367
 			<?php $this->tabs(); ?>
368 368
 
369
-			<p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p>
369
+			<p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p>
370 370
 
371 371
 			<div class="feature-section clearfix">
372 372
 
373 373
 				<div class="content feature-section-item">
374
-					<h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
374
+					<h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3>
375 375
 
376
-					<p><?php esc_html_e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
376
+					<p><?php esc_html_e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
377 377
 
378
-					<p><?php esc_html_e( 'But all of these features begin simply by going to the menu and choosing "Add Form".', 'give' ); ?></p>
378
+					<p><?php esc_html_e('But all of these features begin simply by going to the menu and choosing "Add Form".', 'give'); ?></p>
379 379
 				</div>
380 380
 
381 381
 				<div class="content feature-section-item last-feature">
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 				</div>
393 393
 
394 394
 				<div class="content feature-section-item last-feature">
395
-					<h3><?php esc_html_e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
395
+					<h3><?php esc_html_e('STEP 2: Choose Your Levels', 'give'); ?></h3>
396 396
 
397
-					<p><?php esc_html_e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
397
+					<p><?php esc_html_e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
398 398
 				</div>
399 399
 
400 400
 			</div>
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 			<div class="feature-section clearfix">
404 404
 
405 405
 				<div class="content feature-section-item add-content">
406
-					<h3><?php esc_html_e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
406
+					<h3><?php esc_html_e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
407 407
 
408
-					<p><?php esc_html_e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
408
+					<p><?php esc_html_e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
409 409
 
410
-					<p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
410
+					<p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
411 411
 				</div>
412 412
 
413 413
 				<div class="content feature-section-item last-feature">
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
 				</div>
425 425
 
426 426
 				<div class="content feature-section-item last-feature">
427
-					<h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
427
+					<h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
428 428
 
429
-					<p><?php esc_html_e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
429
+					<p><?php esc_html_e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
430 430
 				</div>
431 431
 
432 432
 
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function credits_screen() {
449
-		list( $display_version ) = explode( '-', GIVE_VERSION );
449
+		list($display_version) = explode('-', GIVE_VERSION);
450 450
 		?>
451 451
 		<div class="wrap about-wrap">
452 452
 			<h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
453 453
 
454 454
 			<?php give_social_media_elements() ?>
455 455
 
456
-			<p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p>
456
+			<p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p>
457 457
 
458
-			<p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p>
458
+			<p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p>
459 459
 
460 460
 			<?php give_get_newsletter(); ?>
461 461
 
462 462
 			<div class="give-badge"><?php
463 463
 				printf(
464 464
 					/* translators: %s: Give version */
465
-					esc_html__( 'Version %s', 'give' ),
465
+					esc_html__('Version %s', 'give'),
466 466
 					$display_version
467 467
 				);
468 468
 			?></div>
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 			<p class="about-description"><?php
473 473
 				printf(
474 474
 					/* translators: %s: https://github.com/WordImpress/give */
475
-					__( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ),
476
-					esc_url( 'https://github.com/WordImpress/give' )
475
+					__('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'),
476
+					esc_url('https://github.com/WordImpress/give')
477 477
 				);
478 478
 			?></p>
479 479
 
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
 	 * @return string $readme HTML formatted readme file
491 491
 	 */
492 492
 	public function parse_readme() {
493
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
493
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
494 494
 
495
-		if ( ! $file ) {
496
-			$readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>';
495
+		if ( ! $file) {
496
+			$readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>';
497 497
 		} else {
498
-			$readme = file_get_contents( $file );
499
-			$readme = nl2br( esc_html( $readme ) );
500
-			$readme = explode( '== Changelog ==', $readme );
501
-			$readme = end( $readme );
502
-
503
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
504
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
505
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
506
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
507
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
498
+			$readme = file_get_contents($file);
499
+			$readme = nl2br(esc_html($readme));
500
+			$readme = explode('== Changelog ==', $readme);
501
+			$readme = end($readme);
502
+
503
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
504
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
505
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
506
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
507
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
508 508
 		}
509 509
 
510 510
 		return $readme;
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	public function contributors() {
522 522
 		$contributors = $this->get_contributors();
523 523
 
524
-		if ( empty( $contributors ) ) {
524
+		if (empty($contributors)) {
525 525
 			return '';
526 526
 		}
527 527
 
528 528
 		$contributor_list = '<ul class="wp-people-group">';
529 529
 
530
-		foreach ( $contributors as $contributor ) {
530
+		foreach ($contributors as $contributor) {
531 531
 			$contributor_list .= '<li class="wp-person">';
532 532
 			$contributor_list .= sprintf(
533 533
 				'<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>',
534
-				esc_url( 'https://github.com/' . $contributor->login ),
535
-				esc_url( $contributor->avatar_url ),
536
-				esc_attr( $contributor->login )
534
+				esc_url('https://github.com/'.$contributor->login),
535
+				esc_url($contributor->avatar_url),
536
+				esc_attr($contributor->login)
537 537
 			);
538 538
 			$contributor_list .= sprintf(
539 539
 				'<a class="web" target="_blank" href="%1$s">%2$s</a>',
540
-				esc_url( 'https://github.com/' . $contributor->login ),
541
-				esc_html( $contributor->login )
540
+				esc_url('https://github.com/'.$contributor->login),
541
+				esc_html($contributor->login)
542 542
 			);
543 543
 			$contributor_list .= '</li>';
544 544
 		}
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	 * @return array $contributors List of contributors
557 557
 	 */
558 558
 	public function get_contributors() {
559
-		$contributors = get_transient( 'give_contributors' );
559
+		$contributors = get_transient('give_contributors');
560 560
 
561
-		if ( false !== $contributors ) {
561
+		if (false !== $contributors) {
562 562
 			return $contributors;
563 563
 		}
564 564
 
565
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
565
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
566 566
 
567
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
567
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
568 568
 			return array();
569 569
 		}
570 570
 
571
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
571
+		$contributors = json_decode(wp_remote_retrieve_body($response));
572 572
 
573
-		if ( ! is_array( $contributors ) ) {
573
+		if ( ! is_array($contributors)) {
574 574
 			return array();
575 575
 		}
576 576
 
577
-		set_transient( 'give_contributors', $contributors, 3600 );
577
+		set_transient('give_contributors', $contributors, 3600);
578 578
 
579 579
 		return $contributors;
580 580
 	}
@@ -592,24 +592,24 @@  discard block
 block discarded – undo
592 592
 		$give_options = give_get_settings();
593 593
 
594 594
 		// Bail if no activation redirect
595
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
595
+		if ( ! get_transient('_give_activation_redirect')) {
596 596
 			return;
597 597
 		}
598 598
 
599 599
 		// Delete the redirect transient
600
-		delete_transient( '_give_activation_redirect' );
600
+		delete_transient('_give_activation_redirect');
601 601
 
602 602
 		// Bail if activating from network, or bulk
603
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
603
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
604 604
 			return;
605 605
 		}
606 606
 
607
-		$upgrade = get_option( 'give_version_upgraded_from' );
607
+		$upgrade = get_option('give_version_upgraded_from');
608 608
 
609
-		if ( ! $upgrade ) { // First time install
610
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
609
+		if ( ! $upgrade) { // First time install
610
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
611 611
 			exit;
612
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
612
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
613 613
 
614 614
 		} else { // Welcome is NOT disabled in settings
615 615
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +185 added lines, -185 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
 /**
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults.
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
123
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
124
-			'ajax'     => false,                              // Does this table support ajax?
125
-		) );
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
124
+			'ajax'     => false, // Does this table support ajax?
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	/**
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
 	 * @return void
136 136
 	 */
137 137
 	public function advanced_filters() {
138
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
139
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
140
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
138
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
139
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
140
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
141 141
 		?>
142 142
 		<div id="give-payment-filters">
143 143
 			<span id="give-payment-date-filters">
144
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
144
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
145 145
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
146
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
146
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
147 147
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
148
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
148
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
149 149
 			</span>
150
-			<?php if ( ! empty( $status ) ) : ?>
151
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
150
+			<?php if ( ! empty($status)) : ?>
151
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
152 152
 			<?php endif; ?>
153
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
154
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
153
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
154
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
155 155
 			<?php endif; ?>
156
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
156
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
157 157
 		</div>
158 158
 
159 159
 		<?php
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return void
172 172
 	 */
173
-	public function search_box( $text, $input_id ) {
174
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
173
+	public function search_box($text, $input_id) {
174
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
175 175
 			return;
176 176
 		}
177 177
 
178
-		$input_id = $input_id . '-search-input';
178
+		$input_id = $input_id.'-search-input';
179 179
 
180
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
181
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
180
+		if ( ! empty($_REQUEST['orderby'])) {
181
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
182 182
 		}
183
-		if ( ! empty( $_REQUEST['order'] ) ) {
184
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
183
+		if ( ! empty($_REQUEST['order'])) {
184
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
185 185
 		}
186 186
 		?>
187 187
 		<p class="search-box" role="search">
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 			 *
194 194
 			 * @since 1.7
195 195
 			 */
196
-			do_action( 'give_payment_history_search' );
196
+			do_action('give_payment_history_search');
197 197
 			?>
198 198
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
199 199
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
200
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
200
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
201 201
 		</p>
202 202
 		<?php
203 203
 	}
@@ -211,52 +211,52 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function get_views() {
213 213
 
214
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
215
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
216
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
217
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
218
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
219
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
220
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
221
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
222
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
214
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
215
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
216
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
217
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
218
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
219
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
220
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
221
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
222
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
223 223
 
224 224
 		$views = array(
225
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
225
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
226 226
 				'status',
227 227
 				'paged',
228
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
229
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
228
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
229
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
230 230
 				'status' => 'publish',
231 231
 				'paged'  => false,
232
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
233
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
232
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
233
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
234 234
 				'status' => 'pending',
235 235
 				'paged'  => false,
236
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
237
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
236
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
237
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
238 238
 				'status' => 'refunded',
239 239
 				'paged'  => false,
240
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
241
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
240
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
241
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
242 242
 				'status' => 'revoked',
243 243
 				'paged'  => false,
244
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
245
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
244
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
245
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
246 246
 				'status' => 'failed',
247 247
 				'paged'  => false,
248
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
249
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
248
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
249
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
250 250
 				'status' => 'cancelled',
251 251
 				'paged'  => false,
252
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
253
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
252
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
253
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
254 254
 				'status' => 'abandoned',
255 255
 				'paged'  => false,
256
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ),
256
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count),
257 257
 		);
258 258
 
259
-		return apply_filters( 'give_payments_table_views', $views );
259
+		return apply_filters('give_payments_table_views', $views);
260 260
 	}
261 261
 
262 262
 	/**
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
 	public function get_columns() {
270 270
 		$columns = array(
271 271
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
272
-			'donation'      => esc_html__( 'Donation', 'give' ),
273
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
274
-			'status'        => esc_html__( 'Status', 'give' ),
275
-			'date'          => esc_html__( 'Date', 'give' ),
276
-			'amount'        => esc_html__( 'Amount', 'give' ),
277
-			'details'       => esc_html__( 'Details', 'give' ),
272
+			'donation'      => esc_html__('Donation', 'give'),
273
+			'donation_form' => esc_html__('Donation Form', 'give'),
274
+			'status'        => esc_html__('Status', 'give'),
275
+			'date'          => esc_html__('Date', 'give'),
276
+			'amount'        => esc_html__('Amount', 'give'),
277
+			'details'       => esc_html__('Details', 'give'),
278 278
 		);
279 279
 
280
-		return apply_filters( 'give_payments_table_columns', $columns );
280
+		return apply_filters('give_payments_table_columns', $columns);
281 281
 	}
282 282
 
283 283
 	/**
@@ -289,14 +289,14 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function get_sortable_columns() {
291 291
 		$columns = array(
292
-			'donation'      => array( 'ID', true ),
293
-			'donation_form' => array( 'donation_form', false ),
294
-			'status'        => array( 'status', false ),
295
-			'amount'        => array( 'amount', false ),
296
-			'date'          => array( 'date', false ),
292
+			'donation'      => array('ID', true),
293
+			'donation_form' => array('donation_form', false),
294
+			'status'        => array('status', false),
295
+			'amount'        => array('amount', false),
296
+			'date'          => array('date', false),
297 297
 		);
298 298
 
299
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
299
+		return apply_filters('give_payments_table_sortable_columns', $columns);
300 300
 	}
301 301
 
302 302
 	/**
@@ -322,65 +322,65 @@  discard block
 block discarded – undo
322 322
 	 *
323 323
 	 * @return string Column Name
324 324
 	 */
325
-	public function column_default( $payment, $column_name ) {
325
+	public function column_default($payment, $column_name) {
326 326
 
327
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
328
-		$row_actions         = $this->get_row_actions( $payment );
327
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
328
+		$row_actions         = $this->get_row_actions($payment);
329 329
 
330
-		switch ( $column_name ) {
330
+		switch ($column_name) {
331 331
 			case 'donation' :
332 332
 				$value = sprintf(
333 333
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
334 334
 					$single_donation_url,
335
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
335
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
336 336
 					$payment->ID,
337
-					esc_html__( 'by', 'give' ),
338
-					$this->get_donor( $payment )
337
+					esc_html__('by', 'give'),
338
+					$this->get_donor($payment)
339 339
 				);
340
-				$value .= $this->get_donor_email( $payment );
341
-				$value .= $this->row_actions( $row_actions );
340
+				$value .= $this->get_donor_email($payment);
341
+				$value .= $this->row_actions($row_actions);
342 342
 				break;
343 343
 
344 344
 			case 'amount' :
345
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
346
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
345
+				$amount = ! empty($payment->total) ? $payment->total : 0;
346
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
347 347
 				break;
348 348
 
349 349
 			case 'donation_form' :
350 350
 
351
-				$value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>';
352
-				$level = give_get_payment_form_title( $payment->meta, true );
351
+				$value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>';
352
+				$level = give_get_payment_form_title($payment->meta, true);
353 353
 
354
-				if ( ! empty( $level ) ) {
354
+				if ( ! empty($level)) {
355 355
 					$value .= $level;
356 356
 				}
357 357
 
358 358
 				break;
359 359
 
360 360
 			case 'date' :
361
-				$date  = strtotime( $payment->date );
362
-				$value = date_i18n( give_date_format(), $date );
361
+				$date  = strtotime($payment->date);
362
+				$value = date_i18n(give_date_format(), $date);
363 363
 				break;
364 364
 
365 365
 			case 'status' :
366
-				$value = $this->get_payment_status( $payment );
366
+				$value = $this->get_payment_status($payment);
367 367
 				break;
368 368
 
369 369
 			case 'details' :
370 370
 				$value = sprintf(
371 371
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
372 372
 					$single_donation_url,
373
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
373
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
374 374
 				);
375 375
 				break;
376 376
 
377 377
 			default:
378
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
378
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
379 379
 				break;
380 380
 
381 381
 		}
382 382
 
383
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
383
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
384 384
 	}
385 385
 
386 386
 	/**
@@ -393,17 +393,17 @@  discard block
 block discarded – undo
393 393
 	 *
394 394
 	 * @return string                Data shown in the Email column
395 395
 	 */
396
-	public function get_donor_email( $payment ) {
396
+	public function get_donor_email($payment) {
397 397
 
398
-		$email = give_get_payment_user_email( $payment->ID );
398
+		$email = give_get_payment_user_email($payment->ID);
399 399
 
400
-		if ( empty( $email ) ) {
401
-			$email = esc_html__( '(unknown)', 'give' );
400
+		if (empty($email)) {
401
+			$email = esc_html__('(unknown)', 'give');
402 402
 		}
403 403
 
404
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
404
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
405 405
 
406
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
406
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
407 407
 	}
408 408
 
409 409
 	/**
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 	 *
414 414
 	 * @return mixed|void
415 415
 	 */
416
-	function get_row_actions( $payment ) {
416
+	function get_row_actions($payment) {
417 417
 
418 418
 		$actions = array();
419
-		$email   = give_get_payment_user_email( $payment->ID );
419
+		$email   = give_get_payment_user_email($payment->ID);
420 420
 
421 421
 		// Add search term string back to base URL.
422
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
423
-		if ( ! empty( $search_terms ) ) {
424
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
422
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
423
+		if ( ! empty($search_terms)) {
424
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
425 425
 		}
426 426
 
427
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
427
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
428 428
 
429 429
 			$actions['email_links'] = sprintf(
430 430
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -438,8 +438,8 @@  discard block
 block discarded – undo
438 438
 					),
439 439
 					'give_payment_nonce'
440 440
 				),
441
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
442
-				esc_html__( 'Resend Donation Receipt', 'give' )
441
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
442
+				esc_html__('Resend Donation Receipt', 'give')
443 443
 			);
444 444
 
445 445
 		}
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 				),
457 457
 				'give_donation_nonce'
458 458
 			),
459
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
460
-			esc_html__( 'Delete', 'give' )
459
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
460
+			esc_html__('Delete', 'give')
461 461
 		);
462 462
 
463
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
463
+		return apply_filters('give_payment_row_actions', $actions, $payment);
464 464
 	}
465 465
 
466 466
 
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @return string                Data shown in the Email column
476 476
 	 */
477
-	function get_payment_status( $payment ) {
478
-		$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>';
479
-		if ( $payment->mode == 'test' ) {
480
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
477
+	function get_payment_status($payment) {
478
+		$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>';
479
+		if ($payment->mode == 'test') {
480
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
481 481
 		}
482 482
 
483 483
 		return $value;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return string Displays a checkbox.
495 495
 	 */
496
-	public function column_cb( $payment ) {
496
+	public function column_cb($payment) {
497 497
 		return sprintf(
498 498
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
499 499
 			'payment',
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	 *
512 512
 	 * @return string Displays a checkbox.
513 513
 	 */
514
-	public function get_payment_id( $payment ) {
515
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
514
+	public function get_payment_id($payment) {
515
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
516 516
 	}
517 517
 
518 518
 	/**
@@ -525,19 +525,19 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return string Data shown in the User column
527 527
 	 */
528
-	public function get_donor( $payment ) {
528
+	public function get_donor($payment) {
529 529
 
530
-		$customer_id = give_get_payment_customer_id( $payment->ID );
530
+		$customer_id = give_get_payment_customer_id($payment->ID);
531 531
 
532
-		if ( ! empty( $customer_id ) ) {
533
-			$customer = new Give_Customer( $customer_id );
534
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
532
+		if ( ! empty($customer_id)) {
533
+			$customer = new Give_Customer($customer_id);
534
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
535 535
 		} else {
536
-			$email = give_get_payment_user_email( $payment->ID );
537
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
536
+			$email = give_get_payment_user_email($payment->ID);
537
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
538 538
 		}
539 539
 
540
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
540
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
541 541
 	}
542 542
 
543 543
 	/**
@@ -549,18 +549,18 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	public function get_bulk_actions() {
551 551
 		$actions = array(
552
-			'delete'               => esc_html__( 'Delete', 'give' ),
553
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
554
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
555
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
556
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
557
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
558
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
559
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
560
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' ),
552
+			'delete'               => esc_html__('Delete', 'give'),
553
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
554
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
555
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
556
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
557
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
558
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
559
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
560
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give'),
561 561
 		);
562 562
 
563
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
563
+		return apply_filters('give_payments_table_bulk_actions', $actions);
564 564
 	}
565 565
 
566 566
 	/**
@@ -571,59 +571,59 @@  discard block
 block discarded – undo
571 571
 	 * @return void
572 572
 	 */
573 573
 	public function process_bulk_action() {
574
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
574
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
575 575
 		$action = $this->current_action();
576 576
 
577
-		if ( ! is_array( $ids ) ) {
578
-			$ids = array( $ids );
577
+		if ( ! is_array($ids)) {
578
+			$ids = array($ids);
579 579
 		}
580 580
 
581
-		if ( empty( $action ) ) {
581
+		if (empty($action)) {
582 582
 			return;
583 583
 		}
584 584
 
585
-		foreach ( $ids as $id ) {
585
+		foreach ($ids as $id) {
586 586
 
587 587
 			// Detect when a bulk action is being triggered.
588
-			switch ( $this->current_action() ) {
588
+			switch ($this->current_action()) {
589 589
 
590 590
 				case'delete':
591
-					give_delete_purchase( $id );
591
+					give_delete_purchase($id);
592 592
 					break;
593 593
 
594 594
 				case 'set-status-publish':
595
-					give_update_payment_status( $id, 'publish' );
595
+					give_update_payment_status($id, 'publish');
596 596
 					break;
597 597
 
598 598
 				case 'set-status-pending':
599
-					give_update_payment_status( $id, 'pending' );
599
+					give_update_payment_status($id, 'pending');
600 600
 					break;
601 601
 
602 602
 				case 'set-status-refunded':
603
-					give_update_payment_status( $id, 'refunded' );
603
+					give_update_payment_status($id, 'refunded');
604 604
 					break;
605 605
 				case 'set-status-revoked':
606
-					give_update_payment_status( $id, 'revoked' );
606
+					give_update_payment_status($id, 'revoked');
607 607
 					break;
608 608
 
609 609
 				case 'set-status-failed':
610
-					give_update_payment_status( $id, 'failed' );
610
+					give_update_payment_status($id, 'failed');
611 611
 					break;
612 612
 
613 613
 				case 'set-status-cancelled':
614
-					give_update_payment_status( $id, 'cancelled' );
614
+					give_update_payment_status($id, 'cancelled');
615 615
 					break;
616 616
 
617 617
 				case 'set-status-abandoned':
618
-					give_update_payment_status( $id, 'abandoned' );
618
+					give_update_payment_status($id, 'abandoned');
619 619
 					break;
620 620
 
621 621
 				case 'set-status-preapproval':
622
-					give_update_payment_status( $id, 'preapproval' );
622
+					give_update_payment_status($id, 'preapproval');
623 623
 					break;
624 624
 
625 625
 				case 'resend-receipt':
626
-					give_email_donation_receipt( $id, false );
626
+					give_email_donation_receipt($id, false);
627 627
 					break;
628 628
 			}
629 629
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			 * @param int    $id             The ID of the payment.
636 636
 			 * @param string $current_action The action that is being triggered.
637 637
 			 */
638
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
638
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
639 639
 		}
640 640
 
641 641
 	}
@@ -651,27 +651,27 @@  discard block
 block discarded – undo
651 651
 
652 652
 		$args = array();
653 653
 
654
-		if ( isset( $_GET['user'] ) ) {
655
-			$args['user'] = urldecode( $_GET['user'] );
656
-		} elseif ( isset( $_GET['s'] ) ) {
657
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
658
-			if ( $is_user ) {
659
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
660
-				unset( $args['s'] );
654
+		if (isset($_GET['user'])) {
655
+			$args['user'] = urldecode($_GET['user']);
656
+		} elseif (isset($_GET['s'])) {
657
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
658
+			if ($is_user) {
659
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
660
+				unset($args['s']);
661 661
 			} else {
662
-				$args['s'] = sanitize_text_field( $_GET['s'] );
662
+				$args['s'] = sanitize_text_field($_GET['s']);
663 663
 			}
664 664
 		}
665 665
 
666
-		if ( ! empty( $_GET['start-date'] ) ) {
667
-			$args['start-date'] = urldecode( $_GET['start-date'] );
666
+		if ( ! empty($_GET['start-date'])) {
667
+			$args['start-date'] = urldecode($_GET['start-date']);
668 668
 		}
669 669
 
670
-		if ( ! empty( $_GET['end-date'] ) ) {
671
-			$args['end-date'] = urldecode( $_GET['end-date'] );
670
+		if ( ! empty($_GET['end-date'])) {
671
+			$args['end-date'] = urldecode($_GET['end-date']);
672 672
 		}
673 673
 
674
-		$payment_count         = give_count_payments( $args );
674
+		$payment_count         = give_count_payments($args);
675 675
 		$this->complete_count  = $payment_count->publish;
676 676
 		$this->pending_count   = $payment_count->pending;
677 677
 		$this->refunded_count  = $payment_count->refunded;
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 		$this->cancelled_count = $payment_count->cancelled;
681 681
 		$this->abandoned_count = $payment_count->abandoned;
682 682
 
683
-		foreach ( $payment_count as $count ) {
683
+		foreach ($payment_count as $count) {
684 684
 			$this->total_count += $count;
685 685
 		}
686 686
 	}
@@ -695,26 +695,26 @@  discard block
 block discarded – undo
695 695
 	public function payments_data() {
696 696
 
697 697
 		$per_page   = $this->per_page;
698
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
699
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
700
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
701
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
702
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
703
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
704
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
705
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
706
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
707
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
708
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
709
-
710
-		if ( ! empty( $search ) ) {
698
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
699
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
700
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
701
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
702
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
703
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
704
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
705
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
706
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
707
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
708
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
709
+
710
+		if ( ! empty($search)) {
711 711
 			$status = 'any'; // Force all payment statuses when searching.
712 712
 		}
713 713
 
714 714
 		$args = array(
715 715
 			'output'     => 'payments',
716 716
 			'number'     => $per_page,
717
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
717
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
718 718
 			'orderby'    => $orderby,
719 719
 			'order'      => $order,
720 720
 			'user'       => $user,
@@ -728,14 +728,14 @@  discard block
 block discarded – undo
728 728
 			'end_date'   => $end_date,
729 729
 		);
730 730
 
731
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
731
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
732 732
 
733 733
 			$args['search_in_notes'] = true;
734
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
734
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
735 735
 
736 736
 		}
737 737
 
738
-		$p_query = new Give_Payments_Query( $args );
738
+		$p_query = new Give_Payments_Query($args);
739 739
 
740 740
 		return $p_query->get_payments();
741 741
 
@@ -755,17 +755,17 @@  discard block
 block discarded – undo
755 755
 	 */
756 756
 	public function prepare_items() {
757 757
 
758
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
758
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
759 759
 
760 760
 		$columns  = $this->get_columns();
761 761
 		$hidden   = array(); // No hidden columns.
762 762
 		$sortable = $this->get_sortable_columns();
763 763
 		$data     = $this->payments_data();
764
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
764
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
765 765
 
766
-		$this->_column_headers = array( $columns, $hidden, $sortable );
766
+		$this->_column_headers = array($columns, $hidden, $sortable);
767 767
 
768
-		switch ( $status ) {
768
+		switch ($status) {
769 769
 			case 'publish':
770 770
 				$total_items = $this->complete_count;
771 771
 				break;
@@ -792,19 +792,19 @@  discard block
 block discarded – undo
792 792
 				break;
793 793
 			default:
794 794
 				// Retrieve the count of the non-default-Give status.
795
-				$count       = wp_count_posts( 'give_payment' );
795
+				$count       = wp_count_posts('give_payment');
796 796
 				$total_items = $count->{$status};
797 797
 				break;
798 798
 		}
799 799
 
800 800
 		$this->items = $data;
801 801
 
802
-		$this->set_pagination_args( array(
802
+		$this->set_pagination_args(array(
803 803
 				'total_items' => $total_items,
804 804
 				// We have to calculate the total number of items.
805 805
 				'per_page'    => $this->per_page,
806 806
 				// We have to determine how many items to show on a page.
807
-				'total_pages' => ceil( $total_items / $this->per_page ),
807
+				'total_pages' => ceil($total_items / $this->per_page),
808 808
 				// We have to calculate the total number of pages.
809 809
 			)
810 810
 		);
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,52 +25,52 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	// Retrieve existing payment meta.
43 43
 	$meta      = $payment->get_meta();
44 44
 	$user_info = $payment->user_info;
45 45
 
46 46
 	$status = $data['give-payment-status'];
47
-	$date   = sanitize_text_field( $data['give-payment-date'] );
48
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
47
+	$date   = sanitize_text_field($data['give-payment-date']);
48
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
49 49
 
50 50
 	// Restrict to our high and low.
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low.
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
66
+	$address = array_map('trim', $data['give-payment-address'][0]);
67 67
 
68
-	$curr_total = give_sanitize_amount( $payment->total );
69
-	$new_total  = give_sanitize_amount( $data['give-payment-total'] );
70
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
68
+	$curr_total = give_sanitize_amount($payment->total);
69
+	$new_total  = give_sanitize_amount($data['give-payment-total']);
70
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
71 71
 
72
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
73
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
72
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
73
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
74 74
 
75 75
 	/**
76 76
 	 * Fires before updating edited donation.
@@ -79,98 +79,98 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @param int $payment_id The ID of the payment.
81 81
 	 */
82
-	do_action( 'give_update_edited_purchase', $payment_id );
82
+	do_action('give_update_edited_purchase', $payment_id);
83 83
 
84 84
 	$payment->date = $date;
85 85
 	$updated       = $payment->save();
86 86
 
87
-	if ( 0 === $updated ) {
88
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
87
+	if (0 === $updated) {
88
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
89 89
 	}
90 90
 
91 91
 	$customer_changed = false;
92 92
 
93
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
93
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
94 94
 
95
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
96
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
95
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
96
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
97 97
 
98
-		if ( empty( $email ) || empty( $names ) ) {
99
-			wp_die( esc_html__( 'New Customers require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
98
+		if (empty($email) || empty($names)) {
99
+			wp_die(esc_html__('New Customers require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
100 100
 		}
101 101
 
102
-		$customer = new Give_Customer( $email );
103
-		if ( empty( $customer->id ) ) {
104
-			$customer_data = array( 'name' => $names, 'email' => $email );
105
-			$user_id       = email_exists( $email );
106
-			if ( false !== $user_id ) {
102
+		$customer = new Give_Customer($email);
103
+		if (empty($customer->id)) {
104
+			$customer_data = array('name' => $names, 'email' => $email);
105
+			$user_id       = email_exists($email);
106
+			if (false !== $user_id) {
107 107
 				$customer_data['user_id'] = $user_id;
108 108
 			}
109 109
 
110
-			if ( ! $customer->create( $customer_data ) ) {
110
+			if ( ! $customer->create($customer_data)) {
111 111
 				// Failed to crete the new donor, assume the previous donor.
112 112
 				$customer_changed = false;
113
-				$customer         = new Give_Customer( $curr_customer_id );
114
-				give_set_error( 'give-payment-new-customer-fail', esc_html__( 'Error creating new donor.', 'give' ) );
113
+				$customer         = new Give_Customer($curr_customer_id);
114
+				give_set_error('give-payment-new-customer-fail', esc_html__('Error creating new donor.', 'give'));
115 115
 			}
116 116
 		}
117 117
 
118 118
 		$new_customer_id = $customer->id;
119 119
 
120
-		$previous_customer = new Give_Customer( $curr_customer_id );
120
+		$previous_customer = new Give_Customer($curr_customer_id);
121 121
 
122 122
 		$customer_changed = true;
123 123
 
124
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
124
+	} elseif ($curr_customer_id !== $new_customer_id) {
125 125
 
126
-		$customer = new Give_Customer( $new_customer_id );
126
+		$customer = new Give_Customer($new_customer_id);
127 127
 		$email    = $customer->email;
128 128
 		$names    = $customer->name;
129 129
 
130
-		$previous_customer = new Give_Customer( $curr_customer_id );
130
+		$previous_customer = new Give_Customer($curr_customer_id);
131 131
 
132 132
 		$customer_changed = true;
133 133
 
134 134
 	} else {
135 135
 
136
-		$customer = new Give_Customer( $curr_customer_id );
136
+		$customer = new Give_Customer($curr_customer_id);
137 137
 		$email    = $customer->email;
138 138
 		$names    = $customer->name;
139 139
 
140 140
 	}
141 141
 
142 142
 	// Setup first and last name from input values.
143
-	$names      = explode( ' ', $names );
144
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
143
+	$names      = explode(' ', $names);
144
+	$first_name = ! empty($names[0]) ? $names[0] : '';
145 145
 	$last_name  = '';
146
-	if ( ! empty( $names[1] ) ) {
147
-		unset( $names[0] );
148
-		$last_name = implode( ' ', $names );
146
+	if ( ! empty($names[1])) {
147
+		unset($names[0]);
148
+		$last_name = implode(' ', $names);
149 149
 	}
150 150
 
151
-	if ( $customer_changed ) {
151
+	if ($customer_changed) {
152 152
 
153 153
 		// Remove the stats and payment from the previous customer and attach it to the new customer.
154
-		$previous_customer->remove_payment( $payment_id, false );
155
-		$customer->attach_payment( $payment_id, false );
154
+		$previous_customer->remove_payment($payment_id, false);
155
+		$customer->attach_payment($payment_id, false);
156 156
 
157
-		if ( 'publish' == $status ) {
157
+		if ('publish' == $status) {
158 158
 
159 159
 			// Reduce previous user donation count and amount.
160 160
 			$previous_customer->decrease_purchase_count();
161
-			$previous_customer->decrease_value( $curr_total );
161
+			$previous_customer->decrease_value($curr_total);
162 162
 
163 163
 			// If donation was completed adjust stats of new customers.
164 164
 			$customer->increase_purchase_count();
165
-			$customer->increase_value( $new_total );
165
+			$customer->increase_value($new_total);
166 166
 		}
167 167
 
168 168
 		$payment->customer_id = $customer->id;
169 169
 	} else {
170 170
 
171
-		if ( 'publish' === $status ) {
171
+		if ('publish' === $status) {
172 172
 			// Update user donation stat.
173
-			$customer->update_donation_value( $curr_total, $new_total );
173
+			$customer->update_donation_value($curr_total, $new_total);
174 174
 		}
175 175
 	}
176 176
 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 	$payment->total      = $new_total;
184 184
 
185 185
 	// Check for payment notes.
186
-	if ( ! empty( $data['give-payment-note'] ) ) {
186
+	if ( ! empty($data['give-payment-note'])) {
187 187
 
188
-		$note = wp_kses( $data['give-payment-note'], array() );
189
-		give_insert_payment_note( $payment_id, $note );
188
+		$note = wp_kses($data['give-payment-note'], array());
189
+		give_insert_payment_note($payment_id, $note);
190 190
 
191 191
 	}
192 192
 
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
 	$payment->status = $status;
195 195
 
196 196
 	// Adjust total store earnings if the payment total has been changed.
197
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
197
+	if ($new_total !== $curr_total && 'publish' == $status) {
198 198
 
199
-		if ( $new_total > $curr_total ) {
199
+		if ($new_total > $curr_total) {
200 200
 			// Increase if our new total is higher.
201 201
 			$difference = $new_total - $curr_total;
202
-			give_increase_total_earnings( $difference );
202
+			give_increase_total_earnings($difference);
203 203
 
204
-		} elseif ( $curr_total > $new_total ) {
204
+		} elseif ($curr_total > $new_total) {
205 205
 			// Decrease if our new total is lower.
206 206
 			$difference = $curr_total - $new_total;
207
-			give_decrease_total_earnings( $difference );
207
+			give_decrease_total_earnings($difference);
208 208
 
209 209
 		}
210 210
 	}
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 	$payment->save();
213 213
 
214 214
 	// Get new give form ID.
215
-	$new_form_id     = absint( $data['forms'] );
216
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
215
+	$new_form_id     = absint($data['forms']);
216
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
217 217
 
218 218
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
219 219
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
220 220
 	// Check if user want to transfer current payment to new give form id.
221
-	if ( $new_form_id != $current_form_id ) {
221
+	if ($new_form_id != $current_form_id) {
222 222
 
223 223
 		// Get new give form title.
224
-		$new_form_title = get_the_title( $new_form_id );
224
+		$new_form_title = get_the_title($new_form_id);
225 225
 
226 226
 		// Update new give form data in payment data.
227 227
 		$payment_meta               = $payment->get_meta();
@@ -229,56 +229,56 @@  discard block
 block discarded – undo
229 229
 		$payment_meta['form_id']    = $new_form_id;
230 230
 
231 231
 		// Update price id post meta data for set donation form.
232
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
232
+		if ( ! give_has_variable_prices($new_form_id)) {
233 233
 			$payment_meta['price_id'] = '';
234 234
 		}
235 235
 
236 236
 		// Update payment give form meta data.
237
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
238
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
239
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
237
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
238
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
239
+		$payment->update_meta('_give_payment_meta', $payment_meta);
240 240
 
241 241
 		// Update price id payment metadata.
242
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
243
-			$payment->update_meta( '_give_payment_price_id', '' );
242
+		if ( ! give_has_variable_prices($new_form_id)) {
243
+			$payment->update_meta('_give_payment_price_id', '');
244 244
 		}
245 245
 
246 246
 		// If donation was completed, adjust stats of forms.
247
-		if ( 'publish' == $status ) {
247
+		if ('publish' == $status) {
248 248
 
249 249
 			// Decrease sale of old give form. For other payment status.
250
-			$current_form = new Give_Donate_Form( $current_form_id );
250
+			$current_form = new Give_Donate_Form($current_form_id);
251 251
 			$current_form->decrease_sales();
252
-			$current_form->decrease_earnings( $curr_total );
252
+			$current_form->decrease_earnings($curr_total);
253 253
 
254 254
 			// Increase sale of new give form.
255
-			$new_form = new Give_Donate_Form( $new_form_id );
255
+			$new_form = new Give_Donate_Form($new_form_id);
256 256
 			$new_form->increase_sales();
257
-			$new_form->increase_earnings( $new_total );
257
+			$new_form->increase_earnings($new_total);
258 258
 		}
259 259
 
260 260
 		// Re setup payment to update new meta value in object.
261
-		$payment->update_payment_setup( $payment->ID );
261
+		$payment->update_payment_setup($payment->ID);
262 262
 	}
263 263
 
264 264
 	// Update price id if current form is variable form.
265
-	if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
265
+	if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
266 266
 
267 267
 		// Get payment meta data.
268 268
 		$payment_meta = $payment->get_meta();
269 269
 
270 270
 		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
271
-		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
271
+		$data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
272 272
 
273 273
 		// Update payment meta data.
274 274
 		$payment_meta['price_id'] = $data['give-variable-price'];
275 275
 
276 276
 		// Update payment give form meta data.
277
-		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
278
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
277
+		$payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
278
+		$payment->update_meta('_give_payment_meta', $payment_meta);
279 279
 
280 280
 		// Re setup payment to update new meta value in object.
281
-		$payment->update_payment_setup( $payment->ID );
281
+		$payment->update_payment_setup($payment->ID);
282 282
 	}
283 283
 
284 284
 	/**
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @param int $payment_id The ID of the payment.
290 290
 	 */
291
-	do_action( 'give_updated_edited_purchase', $payment_id );
291
+	do_action('give_updated_edited_purchase', $payment_id);
292 292
 
293
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
293
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
294 294
 	exit;
295 295
 }
296 296
 
297
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
297
+add_action('give_update_payment_details', 'give_update_payment_details');
298 298
 
299 299
 /**
300 300
  * Trigger a Donation Deletion
@@ -305,48 +305,48 @@  discard block
 block discarded – undo
305 305
  *
306 306
  * @return void
307 307
  */
308
-function give_trigger_purchase_delete( $data ) {
309
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
308
+function give_trigger_purchase_delete($data) {
309
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
310 310
 
311
-		$payment_id = absint( $data['purchase_id'] );
311
+		$payment_id = absint($data['purchase_id']);
312 312
 
313
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
314
-			wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
313
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
314
+			wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
315 315
 		}
316 316
 
317
-		give_delete_purchase( $payment_id );
318
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
317
+		give_delete_purchase($payment_id);
318
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
319 319
 		give_die();
320 320
 	}
321 321
 }
322 322
 
323
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
323
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
324 324
 
325 325
 /**
326 326
  * AJAX Store Donation Note
327 327
  */
328 328
 function give_ajax_store_payment_note() {
329 329
 
330
-	$payment_id = absint( $_POST['payment_id'] );
331
-	$note       = wp_kses( $_POST['note'], array() );
330
+	$payment_id = absint($_POST['payment_id']);
331
+	$note       = wp_kses($_POST['note'], array());
332 332
 
333
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
334
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
333
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
334
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
335 335
 	}
336 336
 
337
-	if ( empty( $payment_id ) ) {
338
-		die( '-1' );
337
+	if (empty($payment_id)) {
338
+		die('-1');
339 339
 	}
340 340
 
341
-	if ( empty( $note ) ) {
342
-		die( '-1' );
341
+	if (empty($note)) {
342
+		die('-1');
343 343
 	}
344 344
 
345
-	$note_id = give_insert_payment_note( $payment_id, $note );
346
-	die( give_get_payment_note_html( $note_id ) );
345
+	$note_id = give_insert_payment_note($payment_id, $note);
346
+	die(give_get_payment_note_html($note_id));
347 347
 }
348 348
 
349
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
349
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
350 350
 
351 351
 /**
352 352
  * Triggers a donation note deletion without ajax
@@ -357,24 +357,24 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @return void
359 359
  */
360
-function give_trigger_payment_note_deletion( $data ) {
360
+function give_trigger_payment_note_deletion($data) {
361 361
 
362
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
362
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
363 363
 		return;
364 364
 	}
365 365
 
366
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
367
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
366
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
367
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
368 368
 	}
369 369
 
370
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
370
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
371 371
 
372
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
372
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
373 373
 
374
-	wp_redirect( $edit_order_url );
374
+	wp_redirect($edit_order_url);
375 375
 }
376 376
 
377
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
377
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
378 378
 
379 379
 /**
380 380
  * Delete a payment note deletion with ajax
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function give_ajax_delete_payment_note() {
387 387
 
388
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
389
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
388
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
389
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
390 390
 	}
391 391
 
392
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
393
-		die( '1' );
392
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
393
+		die('1');
394 394
 	} else {
395
-		die( '-1' );
395
+		die('-1');
396 396
 	}
397 397
 
398 398
 }
399 399
 
400
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
400
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	<h1 id="transaction-details-heading"><?php
54 54
 		printf(
55 55
 			/* translators: %s: donation number */
56
-			esc_html__( 'Donation %s', 'give' ),
56
+			esc_html__('Donation %s', 'give'),
57 57
 			$number
58 58
 		);
59
-		if ( $payment_mode == 'test' ) {
60
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
59
+		if ($payment_mode == 'test') {
60
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
61 61
 		}
62 62
 		?></h1>
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param int $payment_id Payment id.
71 71
 	 */
72
-	do_action( 'give_view_order_details_before', $payment_id );
72
+	do_action('give_view_order_details_before', $payment_id);
73 73
 	?>
74 74
 	<form id="give-edit-order-form" method="post">
75 75
 		<?php
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @param int $payment_id Payment id.
82 82
 		 */
83
-		do_action( 'give_view_order_details_form_top', $payment_id );
83
+		do_action('give_view_order_details_form_top', $payment_id);
84 84
 		?>
85 85
 		<div id="poststuff">
86 86
 			<div id="give-dashboard-widgets-wrap">
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 							 *
97 97
 							 * @param int $payment_id Payment id.
98 98
 							 */
99
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
99
+							do_action('give_view_order_details_sidebar_before', $payment_id);
100 100
 							?>
101 101
 
102 102
 							<div id="give-order-update" class="postbox give-order-data">
103 103
 
104
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
104
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
105 105
 
106 106
 								<div class="inside">
107 107
 									<div class="give-admin-box">
@@ -114,33 +114,33 @@  discard block
 block discarded – undo
114 114
 										 *
115 115
 										 * @param int $payment_id Payment id.
116 116
 										 */
117
-										do_action( 'give_view_order_details_totals_before', $payment_id );
117
+										do_action('give_view_order_details_totals_before', $payment_id);
118 118
 										?>
119 119
 
120 120
 										<div class="give-admin-box-inside">
121 121
 											<p>
122
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
122
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
123 123
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
124
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
125
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
124
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
125
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
126 126
 													<?php endforeach; ?>
127 127
 												</select>
128
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
128
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
129 129
 											</p>
130 130
 										</div>
131 131
 
132 132
 										<div class="give-admin-box-inside">
133 133
 											<p>
134
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
135
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
134
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
135
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
136 136
 											</p>
137 137
 										</div>
138 138
 
139 139
 										<div class="give-admin-box-inside">
140 140
 											<p>
141
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
142
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
141
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
142
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
144 144
 											</p>
145 145
 										</div>
146 146
 
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 										 *
155 155
 										 * @param int $payment_id Payment id.
156 156
 										 */
157
-										do_action( 'give_view_order_details_update_inner', $payment_id );
157
+										do_action('give_view_order_details_update_inner', $payment_id);
158 158
 
159 159
 										// @TODO: Fees
160
-										$fees = give_get_payment_fees( $payment_id );
161
-										if ( ! empty( $fees ) ) : ?>
160
+										$fees = give_get_payment_fees($payment_id);
161
+										if ( ! empty($fees)) : ?>
162 162
 											<div class="give-order-fees give-admin-box-inside">
163
-												<p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p>
163
+												<p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p>
164 164
 												<ul class="give-payment-fees">
165
-													<?php foreach ( $fees as $fee ) : ?>
165
+													<?php foreach ($fees as $fee) : ?>
166 166
 														<li>
167 167
 															<span class="fee-label"><?php echo $fee['label']; ?>:</span>
168
-															<span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span>
168
+															<span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span>
169 169
 														</li>
170 170
 													<?php endforeach; ?>
171 171
 												</ul>
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 
175 175
 										<div class="give-order-payment give-admin-box-inside">
176 176
 											<p>
177
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
178
-												<?php echo give_currency_symbol( $payment->currency ); ?>
179
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
177
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
178
+												<?php echo give_currency_symbol($payment->currency); ?>
179
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
180 180
 											</p>
181 181
 										</div>
182 182
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 										 *
189 189
 										 * @param int $payment_id Payment id.
190 190
 										 */
191
-										do_action( 'give_view_order_details_totals_after', $payment_id );
191
+										do_action('give_view_order_details_totals_after', $payment_id);
192 192
 										?>
193 193
 
194 194
 									</div>
@@ -206,17 +206,17 @@  discard block
 block discarded – undo
206 206
 									 *
207 207
 									 * @param int $payment_id Payment id.
208 208
 									 */
209
-									do_action( 'give_view_order_details_update_before', $payment_id );
209
+									do_action('give_view_order_details_update_before', $payment_id);
210 210
 									?>
211 211
 
212 212
 									<div id="major-publishing-actions">
213 213
 										<div id="publishing-action">
214
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
215
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
216
-												<a href="<?php echo esc_url( add_query_arg( array(
214
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
215
+											<?php if (give_is_payment_complete($payment_id)) : ?>
216
+												<a href="<?php echo esc_url(add_query_arg(array(
217 217
 													'give-action' => 'email_links',
218 218
 													'purchase_id' => $payment_id,
219
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
219
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
220 220
 											<?php endif; ?>
221 221
 										</div>
222 222
 										<div class="clear"></div>
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 									 *
231 231
 									 * @param int $payment_id Payment id.
232 232
 									 */
233
-									do_action( 'give_view_order_details_update_after', $payment_id );
233
+									do_action('give_view_order_details_update_after', $payment_id);
234 234
 									?>
235 235
 
236 236
 								</div>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
 							<div id="give-order-details" class="postbox give-order-data">
243 243
 
244
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
244
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
245 245
 
246 246
 								<div class="inside">
247 247
 									<div class="give-admin-box">
@@ -254,44 +254,44 @@  discard block
 block discarded – undo
254 254
 										 *
255 255
 										 * @param int $payment_id Payment id.
256 256
 										 */
257
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
257
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
258 258
 
259
-										$gateway = give_get_payment_gateway( $payment_id );
260
-										if ( $gateway ) : ?>
259
+										$gateway = give_get_payment_gateway($payment_id);
260
+										if ($gateway) : ?>
261 261
 											<div class="give-order-gateway give-admin-box-inside">
262 262
 												<p>
263
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
264
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
263
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
264
+													<?php echo give_get_gateway_admin_label($gateway); ?>
265 265
 												</p>
266 266
 											</div>
267 267
 										<?php endif; ?>
268 268
 
269 269
 										<div class="give-order-payment-key give-admin-box-inside">
270 270
 											<p>
271
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
272
-												<?php echo give_get_payment_key( $payment_id ); ?>
271
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
272
+												<?php echo give_get_payment_key($payment_id); ?>
273 273
 											</p>
274 274
 										</div>
275 275
 
276 276
 										<div class="give-order-ip give-admin-box-inside">
277 277
 											<p>
278
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
279
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
278
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
279
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
280 280
 											</p>
281 281
 										</div>
282 282
 
283
-										<?php if ( $transaction_id ) : ?>
283
+										<?php if ($transaction_id) : ?>
284 284
 											<div class="give-order-tx-id give-admin-box-inside">
285 285
 												<p>
286
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
287
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
286
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
287
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
288 288
 												</p>
289 289
 											</div>
290 290
 										<?php endif; ?>
291 291
 
292 292
 										<div class="give-admin-box-inside">
293
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
294
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
293
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
294
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
295 295
 											</p>
296 296
 										</div>
297 297
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 										 *
304 304
 										 * @param int $payment_id Payment id.
305 305
 										 */
306
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
306
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
307 307
 										?>
308 308
 
309 309
 									</div>
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 							 *
324 324
 							 * @param int $payment_id Payment id.
325 325
 							 */
326
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
326
+							do_action('give_view_order_details_sidebar_after', $payment_id);
327 327
 							?>
328 328
 
329 329
 						</div>
@@ -343,50 +343,50 @@  discard block
 block discarded – undo
343 343
 							 *
344 344
 							 * @param int $payment_id Payment id.
345 345
 							 */
346
-							do_action( 'give_view_order_details_main_before', $payment_id );
346
+							do_action('give_view_order_details_main_before', $payment_id);
347 347
 							?>
348 348
 
349 349
 							<?php $column_count = 'columns-3'; ?>
350 350
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
351
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
351
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
352 352
 
353 353
 								<div class="inside">
354 354
 
355 355
 									<div class="column-container">
356 356
 										<div class="column">
357 357
 											<p>
358
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
358
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
359 359
 												<?php
360
-												if ( $payment_meta['form_id'] ) :
360
+												if ($payment_meta['form_id']) :
361 361
 													printf(
362 362
 														'<a href="%1$s" target="_blank">#%2$s</a>',
363
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
363
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
364 364
 														$payment_meta['form_id']
365 365
 													);
366 366
 												endif;
367 367
 												?>
368 368
 											</p>
369 369
 											<p>
370
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
371
-												<?php give_get_form_dropdown( array(
370
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
371
+												<?php give_get_form_dropdown(array(
372 372
 													'id'       => $payment_meta['form_id'],
373 373
 													'selected' => $payment_meta['form_id'],
374 374
 													'chosen'   => true,
375
-												), true ); ?>
375
+												), true); ?>
376 376
 											</p>
377 377
 										</div>
378 378
 										<div class="column">
379 379
 											<p>
380
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
381
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
380
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
381
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
382 382
 											</p>
383 383
 											<p>
384
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
384
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
385 385
 												<span class="give-donation-level">
386 386
 													<?php
387
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
388
-													if ( empty( $var_prices ) ) {
389
-														esc_html_e( 'n/a', 'give' );
387
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
388
+													if (empty($var_prices)) {
389
+														esc_html_e('n/a', 'give');
390 390
 													} else {
391 391
 														// Variable price dropdown options.
392 392
 														$variable_price_dropdown_option = array(
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 															'selected'        => $payment_meta['price_id'],
398 398
 														);
399 399
 														// Render variable prices select tag html.
400
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
400
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
401 401
 													}
402 402
 													?>
403 403
 												</span>
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
 										</div>
406 406
 										<div class="column">
407 407
 											<p>
408
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
409
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?>
408
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
409
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?>
410 410
 											</p>
411 411
 											<p>
412 412
 												<?php
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 												 *
420 420
 												 * @param int $payment_id Payment id.
421 421
 												 */
422
-												do_action( 'give_donation_details_thead_before', $payment_id );
422
+												do_action('give_donation_details_thead_before', $payment_id);
423 423
 
424 424
 
425 425
 												/**
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 												 *
432 432
 												 * @param int $payment_id Payment id.
433 433
 												 */
434
-												do_action( 'give_donation_details_thead_after', $payment_id );
434
+												do_action('give_donation_details_thead_after', $payment_id);
435 435
 
436 436
 												/**
437 437
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 												 *
443 443
 												 * @param int $payment_id Payment id.
444 444
 												 */
445
-												do_action( 'give_donation_details_tbody_before', $payment_id );
445
+												do_action('give_donation_details_tbody_before', $payment_id);
446 446
 
447 447
 												/**
448 448
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 												 *
454 454
 												 * @param int $payment_id Payment id.
455 455
 												 */
456
-												do_action( 'give_donation_details_tbody_after', $payment_id );
456
+												do_action('give_donation_details_tbody_after', $payment_id);
457 457
 												?>
458 458
 											</p>
459 459
 										</div>
@@ -473,57 +473,57 @@  discard block
 block discarded – undo
473 473
 							 *
474 474
 							 * @param int $payment_id Payment id.
475 475
 							 */
476
-							do_action( 'give_view_order_details_files_after', $payment_id );
476
+							do_action('give_view_order_details_files_after', $payment_id);
477 477
 							?>
478 478
 
479 479
 							<div id="give-donor-details" class="postbox">
480
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
480
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
481 481
 
482 482
 								<div class="inside">
483 483
 
484
-									<?php $customer = new Give_Customer( $customer_id ); ?>
484
+									<?php $customer = new Give_Customer($customer_id); ?>
485 485
 
486 486
 									<div class="column-container customer-info">
487 487
 										<div class="column">
488 488
 											<p>
489
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
489
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
490 490
 												<?php
491
-												if ( ! empty( $customer->id ) ) {
491
+												if ( ! empty($customer->id)) {
492 492
 													printf(
493 493
 														'<a href="%1$s" target="_blank">#%2$s</a>',
494
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ),
494
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id),
495 495
 														$customer->id
496 496
 													);
497 497
 												}
498 498
 												?>
499 499
 											</p>
500 500
 											<p>
501
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
502
-												<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
501
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
502
+												<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
503 503
 											</p>
504 504
 										</div>
505 505
 										<div class="column">
506 506
 											<p>
507
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
507
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
508 508
 												<?php echo $customer->name; ?>
509 509
 											</p>
510 510
 											<p>
511
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
511
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
512 512
 												<?php echo $customer->email; ?>
513 513
 											</p>
514 514
 										</div>
515 515
 										<div class="column">
516 516
 											<p>
517
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
517
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
518 518
 												<?php
519
-												echo Give()->html->donor_dropdown( array(
519
+												echo Give()->html->donor_dropdown(array(
520 520
 													'selected' => $customer->id,
521 521
 													'name'     => 'customer-id',
522
-												) );
522
+												));
523 523
 												?>
524 524
 											</p>
525 525
 											<p>
526
-												<a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
526
+												<a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a>
527 527
 											</p>
528 528
 										</div>
529 529
 									</div>
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 									<div class="column-container new-customer" style="display: none">
532 532
 										<div class="column">
533 533
 											<p>
534
-												<label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
534
+												<label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
535 535
 												<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
536 536
 											</p>
537 537
 										</div>
538 538
 										<div class="column">
539 539
 											<p>
540
-												<label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
540
+												<label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
541 541
 												<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
542 542
 											</p>
543 543
 										</div>
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
 											<p>
546 546
 												<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
547 547
 												<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
548
-												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
548
+												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
549 549
 												<br>
550
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
550
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
551 551
 											</p>
552 552
 										</div>
553 553
 									</div>
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 									 * @param array $payment_meta Payment meta.
564 564
 									 * @param array $user_info    User information.
565 565
 									 */
566
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
566
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
567 567
 
568 568
 									/**
569 569
 									 * Fires in order details page, in the donor-details metabox.
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 									 *
573 573
 									 * @param int $payment_id Payment id.
574 574
 									 */
575
-									do_action( 'give_payment_view_details', $payment_id );
575
+									do_action('give_payment_view_details', $payment_id);
576 576
 									?>
577 577
 
578 578
 								</div>
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 							 *
589 589
 							 * @param int $payment_id Payment id.
590 590
 							 */
591
-							do_action( 'give_view_order_details_billing_before', $payment_id );
591
+							do_action('give_view_order_details_billing_before', $payment_id);
592 592
 							?>
593 593
 
594 594
 							<div id="give-billing-details" class="postbox">
595
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
595
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
596 596
 
597 597
 								<div class="inside">
598 598
 
@@ -602,57 +602,57 @@  discard block
 block discarded – undo
602 602
 											<div class="data column-container">
603 603
 												<div class="column">
604 604
 													<div class="give-wrap-address-line1">
605
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
606
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
605
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
606
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
607 607
 													</div>
608 608
 													<div class="give-wrap-address-line2">
609
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
610
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
609
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
610
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
611 611
 													</div>
612 612
 												</div>
613 613
 												<div class="column">
614 614
 													<div class="give-wrap-address-city">
615
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
616
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
615
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
616
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
617 617
 													</div>
618 618
 													<div class="give-wrap-address-zip">
619
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
620
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
619
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
620
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
621 621
 
622 622
 													</div>
623 623
 												</div>
624 624
 												<div class="column">
625 625
 													<div id="give-order-address-country-wrap">
626
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
626
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
627 627
 														<?php
628
-														echo Give()->html->select( array(
628
+														echo Give()->html->select(array(
629 629
 															'options'          => give_get_country_list(),
630 630
 															'name'             => 'give-payment-address[0][country]',
631 631
 															'selected'         => $address['country'],
632 632
 															'show_option_all'  => false,
633 633
 															'show_option_none' => false,
634 634
 															'chosen'           => true,
635
-															'placeholder'      => esc_attr__( 'Select a country', 'give' ),
636
-														) );
635
+															'placeholder'      => esc_attr__('Select a country', 'give'),
636
+														));
637 637
 														?>
638 638
 													</div>
639 639
 													<div id="give-order-address-state-wrap">
640
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
640
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
641 641
 														<?php
642
-														$states = give_get_states( $address['country'] );
643
-														if ( ! empty( $states ) ) {
644
-															echo Give()->html->select( array(
642
+														$states = give_get_states($address['country']);
643
+														if ( ! empty($states)) {
644
+															echo Give()->html->select(array(
645 645
 																'options'          => $states,
646 646
 																'name'             => 'give-payment-address[0][state]',
647 647
 																'selected'         => $address['state'],
648 648
 																'show_option_all'  => false,
649 649
 																'show_option_none' => false,
650 650
 																'chosen'           => true,
651
-																'placeholder'      => esc_attr__( 'Select a state', 'give' ),
652
-															) );
651
+																'placeholder'      => esc_attr__('Select a state', 'give'),
652
+															));
653 653
 														} else {
654 654
 															?>
655
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
655
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
656 656
 															<?php
657 657
 														} ?>
658 658
 													</div>
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 									 *
673 673
 									 * @param int $payment_id Payment id.
674 674
 									 */
675
-									do_action( 'give_payment_billing_details', $payment_id );
675
+									do_action('give_payment_billing_details', $payment_id);
676 676
 									?>
677 677
 
678 678
 								</div>
@@ -688,32 +688,32 @@  discard block
 block discarded – undo
688 688
 							 *
689 689
 							 * @param int $payment_id Payment id.
690 690
 							 */
691
-							do_action( 'give_view_order_details_billing_after', $payment_id );
691
+							do_action('give_view_order_details_billing_after', $payment_id);
692 692
 							?>
693 693
 
694 694
 							<div id="give-payment-notes" class="postbox">
695
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
695
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
696 696
 
697 697
 								<div class="inside">
698 698
 									<div id="give-payment-notes-inner">
699 699
 										<?php
700
-										$notes = give_get_payment_notes( $payment_id );
701
-										if ( ! empty( $notes ) ) {
700
+										$notes = give_get_payment_notes($payment_id);
701
+										if ( ! empty($notes)) {
702 702
 											$no_notes_display = ' style="display:none;"';
703
-											foreach ( $notes as $note ) :
703
+											foreach ($notes as $note) :
704 704
 
705
-												echo give_get_payment_note_html( $note, $payment_id );
705
+												echo give_get_payment_note_html($note, $payment_id);
706 706
 
707 707
 											endforeach;
708 708
 										} else {
709 709
 											$no_notes_display = '';
710 710
 										}
711
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
711
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
712 712
 									</div>
713 713
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
714 714
 
715 715
 									<div class="give-clearfix">
716
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
716
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
717 717
 									</div>
718 718
 
719 719
 								</div>
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 							 *
730 730
 							 * @param int $payment_id Payment id.
731 731
 							 */
732
-							do_action( 'give_view_order_details_main_after', $payment_id );
732
+							do_action('give_view_order_details_main_after', $payment_id);
733 733
 							?>
734 734
 
735 735
 						</div>
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
 		 *
752 752
 		 * @param int $payment_id Payment id.
753 753
 		 */
754
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
754
+		do_action('give_view_order_details_form_bottom', $payment_id);
755 755
 
756
-		wp_nonce_field( 'give_update_payment_details_nonce' );
756
+		wp_nonce_field('give_update_payment_details_nonce');
757 757
 		?>
758
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
758
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
759 759
 		<input type="hidden" name="give_action" value="update_donation_details"/>
760 760
 	</form>
761 761
 	<?php
@@ -766,6 +766,6 @@  discard block
 block discarded – undo
766 766
 	 *
767 767
 	 * @param int $payment_id Payment id.
768 768
 	 */
769
-	do_action( 'give_view_order_details_after', $payment_id );
769
+	do_action('give_view_order_details_after', $payment_id);
770 770
 	?>
771 771
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 */
26 26
 function give_payment_history_page() {
27 27
 
28
-	$give_payment = get_post_type_object( 'give_payment' );
28
+	$give_payment = get_post_type_object('give_payment');
29 29
 
30
-	if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) {
31
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php';
30
+	if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) {
31
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php';
32 32
 	} else {
33
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
33
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
34 34
 		$payments_table = new Give_Payment_History_Table();
35 35
 		$payments_table->prepare_items();
36 36
 	?>
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_payments_page_top' );
47
+		do_action('give_payments_page_top');
48 48
 		?>
49 49
 
50
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
50
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
51 51
 			<input type="hidden" name="post_type" value="give_forms" />
52 52
 			<input type="hidden" name="page" value="give-payment-history" />
53 53
 			<?php $payments_table->views() ?>
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		 *
62 62
 		 * @since 1.7
63 63
 		 */
64
-		do_action( 'give_payments_page_bottom' );
64
+		do_action('give_payments_page_bottom');
65 65
 		?>
66 66
 
67 67
 	</div>
@@ -78,29 +78,29 @@  discard block
 block discarded – undo
78 78
  * @param $title
79 79
  * @return string
80 80
  */
81
-function give_view_order_details_title( $admin_title, $title ) {
81
+function give_view_order_details_title($admin_title, $title) {
82 82
 
83
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
83
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base) {
84 84
 		return $admin_title;
85 85
 	}
86 86
 
87
-	if( ! isset( $_GET['give-action'] ) ) {
87
+	if ( ! isset($_GET['give-action'])) {
88 88
 		return $admin_title;
89 89
 	}
90 90
 
91
-	switch( $_GET['give-action'] ) :
91
+	switch ($_GET['give-action']) :
92 92
 
93 93
 		case 'view-order-details' :
94 94
 			$title = sprintf(
95 95
 				/* translators: %s: admin title */
96
-				esc_html__( 'View Donation Details - %s', 'give' ),
96
+				esc_html__('View Donation Details - %s', 'give'),
97 97
 				$admin_title
98 98
 			);
99 99
 			break;
100 100
 		case 'edit-payment' :
101 101
 			$title = sprintf(
102 102
 				/* translators: %s: admin title */
103
-				esc_html__( 'Edit Donation - %s', 'give' ),
103
+				esc_html__('Edit Donation - %s', 'give'),
104 104
 				$admin_title
105 105
 			);
106 106
 			break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 
112 112
 	return $title;
113 113
 }
114
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
114
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
115 115
 
116 116
 /**
117 117
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
  * @param $context
124 124
  * @return string
125 125
  */
126
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
126
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
127 127
 
128
-	$post = get_post( $post_id );
128
+	$post = get_post($post_id);
129 129
 
130
-	if( ! $post ) {
130
+	if ( ! $post) {
131 131
 		return $url;
132 132
 	}
133 133
 
134
-	if( 'give_payment' != $post->post_type ) {
134
+	if ('give_payment' != $post->post_type) {
135 135
 		return $url;
136 136
 	}
137 137
 
138
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
138
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id);
139 139
 
140 140
 	return $url;
141 141
 }
142
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
142
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 2 patches
Indentation   +257 added lines, -257 removed lines patch added patch discarded remove patch
@@ -15,324 +15,324 @@
 block discarded – undo
15 15
  * @version 1.6
16 16
  */
17 17
 class EDD_SL_Plugin_Updater {
18
-    private $api_url   = '';
19
-    private $api_data  = array();
20
-    private $name      = '';
21
-    private $slug      = '';
22
-
23
-    /**
24
-     * Class constructor.
25
-     *
26
-     * @param string  $_api_url     The URL pointing to the custom API endpoint.
27
-     * @param string  $_plugin_file Path to the plugin file.
28
-     * @param array   $_api_data    Optional data to send with API calls.
29
-     */
30
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
31
-        $this->api_url  = trailingslashit( $_api_url );
32
-        $this->api_data = $_api_data;
33
-        $this->name     = plugin_basename( $_plugin_file );
34
-        $this->slug     = basename( $_plugin_file, '.php' );
35
-        $this->version  = $_api_data['version'];
36
-
37
-        // Set up hooks.
38
-        $this->init();
39
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
40
-    }
41
-
42
-    /**
43
-     * Set up WordPress filters to hook into WP's update process.
44
-     *
45
-     * @return void
46
-     */
47
-    public function init() {
48
-
49
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
50
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
51
-
52
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
53
-    }
54
-
55
-    /**
56
-     * Check for Updates at the defined API endpoint and modify the update array.
57
-     *
58
-     * This function dives into the update API just when WordPress creates its update array,
59
-     * then adds a custom API call and injects the custom plugin data retrieved from the API.
60
-     * It is reassembled from parts of the native WordPress plugin update code.
61
-     * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
62
-     *
63
-     * @uses api_request()
18
+	private $api_url   = '';
19
+	private $api_data  = array();
20
+	private $name      = '';
21
+	private $slug      = '';
22
+
23
+	/**
24
+	 * Class constructor.
25
+	 *
26
+	 * @param string  $_api_url     The URL pointing to the custom API endpoint.
27
+	 * @param string  $_plugin_file Path to the plugin file.
28
+	 * @param array   $_api_data    Optional data to send with API calls.
29
+	 */
30
+	function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
31
+		$this->api_url  = trailingslashit( $_api_url );
32
+		$this->api_data = $_api_data;
33
+		$this->name     = plugin_basename( $_plugin_file );
34
+		$this->slug     = basename( $_plugin_file, '.php' );
35
+		$this->version  = $_api_data['version'];
36
+
37
+		// Set up hooks.
38
+		$this->init();
39
+		add_action( 'admin_init', array( $this, 'show_changelog' ) );
40
+	}
41
+
42
+	/**
43
+	 * Set up WordPress filters to hook into WP's update process.
64 44
 	 *
65
-     * @param array   $_transient_data Update array build by WordPress.
66
-     * @return array Modified update array with custom plugin data.
67
-     */
68
-    function check_update( $_transient_data ) {
45
+	 * @return void
46
+	 */
47
+	public function init() {
69 48
 
70
-        $screen = get_current_screen();
49
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
50
+		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
71 51
 
72
-        if( ! is_object( $_transient_data ) ) {
73
-            $_transient_data = new stdClass;
74
-        }
52
+		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
53
+	}
75 54
 
76
-        if( 'plugins.php' == $screen->parent_file && is_multisite() ) {
77
-            return $_transient_data;
78
-        }
55
+	/**
56
+	 * Check for Updates at the defined API endpoint and modify the update array.
57
+	 *
58
+	 * This function dives into the update API just when WordPress creates its update array,
59
+	 * then adds a custom API call and injects the custom plugin data retrieved from the API.
60
+	 * It is reassembled from parts of the native WordPress plugin update code.
61
+	 * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
62
+	 *
63
+	 * @uses api_request()
64
+	 *
65
+	 * @param array   $_transient_data Update array build by WordPress.
66
+	 * @return array Modified update array with custom plugin data.
67
+	 */
68
+	function check_update( $_transient_data ) {
79 69
 
80
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
70
+		$screen = get_current_screen();
81 71
 
82
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
72
+		if( ! is_object( $_transient_data ) ) {
73
+			$_transient_data = new stdClass;
74
+		}
83 75
 
84
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
76
+		if( 'plugins.php' == $screen->parent_file && is_multisite() ) {
77
+			return $_transient_data;
78
+		}
85 79
 
86
-                $this->did_check = true;
80
+		if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
87 81
 
88
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
82
+			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
89 83
 
90
-                    $_transient_data->response[ $this->name ] = $version_info;
84
+			if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
91 85
 
92
-                }
86
+				$this->did_check = true;
93 87
 
94
-                $_transient_data->last_checked = time();
95
-                $_transient_data->checked[ $this->name ] = $this->version;
88
+				if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
96 89
 
97
-            }
90
+					$_transient_data->response[ $this->name ] = $version_info;
98 91
 
99
-        }
92
+				}
100 93
 
101
-        return $_transient_data;
102
-    }
94
+				$_transient_data->last_checked = time();
95
+				$_transient_data->checked[ $this->name ] = $this->version;
103 96
 
104
-    /**
105
-     * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
106
-     *
107
-     * @param string  $file
108
-     * @param array   $plugin
109
-     */
110
-    public function show_update_notification( $file, $plugin ) {
97
+			}
111 98
 
112
-        if( ! current_user_can( 'update_plugins' ) ) {
113
-            return;
114
-        }
99
+		}
100
+
101
+		return $_transient_data;
102
+	}
103
+
104
+	/**
105
+	 * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
106
+	 *
107
+	 * @param string  $file
108
+	 * @param array   $plugin
109
+	 */
110
+	public function show_update_notification( $file, $plugin ) {
111
+
112
+		if( ! current_user_can( 'update_plugins' ) ) {
113
+			return;
114
+		}
115 115
 
116
-        if( ! is_multisite() ) {
117
-            return;
118
-        }
116
+		if( ! is_multisite() ) {
117
+			return;
118
+		}
119 119
 
120
-        if ( $this->name != $file ) {
121
-            return;
122
-        }
120
+		if ( $this->name != $file ) {
121
+			return;
122
+		}
123 123
 
124
-        // Remove our filter on the site transient
125
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
124
+		// Remove our filter on the site transient
125
+		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
126 126
 
127
-        $update_cache = get_site_transient( 'update_plugins' );
127
+		$update_cache = get_site_transient( 'update_plugins' );
128 128
 
129
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
129
+		if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
130 130
 
131
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
132
-            $version_info = get_transient( $cache_key );
131
+			$cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
132
+			$version_info = get_transient( $cache_key );
133 133
 
134
-            if( false === $version_info ) {
134
+			if( false === $version_info ) {
135 135
 
136
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
136
+				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
137 137
 
138
-                set_transient( $cache_key, $version_info, 3600 );
139
-            }
138
+				set_transient( $cache_key, $version_info, 3600 );
139
+			}
140 140
 
141 141
 
142
-            if( ! is_object( $version_info ) ) {
143
-                return;
144
-            }
142
+			if( ! is_object( $version_info ) ) {
143
+				return;
144
+			}
145 145
 
146
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
146
+			if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
147 147
 
148
-                $update_cache->response[ $this->name ] = $version_info;
148
+				$update_cache->response[ $this->name ] = $version_info;
149 149
 
150
-            }
150
+			}
151 151
 
152
-            $update_cache->last_checked = time();
153
-            $update_cache->checked[ $this->name ] = $this->version;
152
+			$update_cache->last_checked = time();
153
+			$update_cache->checked[ $this->name ] = $this->version;
154 154
 
155
-            set_site_transient( 'update_plugins', $update_cache );
155
+			set_site_transient( 'update_plugins', $update_cache );
156 156
 
157
-        } else {
157
+		} else {
158 158
 
159
-            $version_info = $update_cache->response[ $this->name ];
159
+			$version_info = $update_cache->response[ $this->name ];
160 160
 
161
-        }
161
+		}
162 162
 
163
-        // Restore our filter
164
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
163
+		// Restore our filter
164
+		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
165 165
 
166
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
166
+		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
167 167
 
168
-            // build a plugin list row, with update notification
169
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
170
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
168
+			// build a plugin list row, with update notification
169
+			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
170
+			echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
171 171
 
172
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
172
+			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
173 173
 
174
-            if ( empty( $version_info->download_link ) ) {
175
-                printf(
174
+			if ( empty( $version_info->download_link ) ) {
175
+				printf(
176 176
 					/* translators: 1: name 2: changelog URL 3: version */
177
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give' ),
178
-                    esc_html( $version_info->name ),
179
-                    esc_url( $changelog_link ),
180
-                    esc_html( $version_info->new_version )
181
-                );
182
-            } else {
183
-                printf(
177
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give' ),
178
+					esc_html( $version_info->name ),
179
+					esc_url( $changelog_link ),
180
+					esc_html( $version_info->new_version )
181
+				);
182
+			} else {
183
+				printf(
184 184
 					/* translators: 1: name 2: changelog URL 3: version 4: update URL */
185
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give' ),
186
-                    esc_html( $version_info->name ),
187
-                    esc_url( $changelog_link ),
188
-                    esc_html( $version_info->new_version ),
189
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
190
-                );
191
-            }
192
-
193
-            echo '</div></td></tr>';
194
-        }
195
-    }
196
-
197
-
198
-    /**
199
-     * Updates information on the "View version x.x details" page with custom data.
200
-     *
201
-     * @uses api_request()
202
-     *
203
-     * @param mixed   $_data
204
-     * @param string  $_action
205
-     * @param object  $_args
206
-     * @return object $_data
207
-     */
208
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
209
-
210
-
211
-        if ( $_action != 'plugin_information' ) {
212
-
213
-            return $_data;
214
-
215
-        }
216
-
217
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
218
-
219
-            return $_data;
220
-
221
-        }
222
-
223
-        $to_send = array(
224
-            'slug'   => $this->slug,
225
-            'is_ssl' => is_ssl(),
226
-            'fields' => array(
227
-                'banners' => false, // These will be supported soon hopefully
228
-                'reviews' => false
229
-            )
230
-        );
231
-
232
-        $api_response = $this->api_request( 'plugin_information', $to_send );
233
-
234
-        if ( false !== $api_response ) {
235
-            $_data = $api_response;
236
-        }
237
-
238
-        return $_data;
239
-    }
240
-
241
-
242
-    /**
243
-     * Disable SSL verification in order to prevent download update failures
244
-     *
245
-     * @param array   $args
246
-     * @param string  $url
247
-     * @return object $array
248
-     */
249
-    function http_request_args( $args, $url ) {
250
-        // If it is an https request and we are performing a package download, disable ssl verification
251
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
252
-            $args['sslverify'] = false;
253
-        }
254
-        return $args;
255
-    }
256
-
257
-    /**
258
-     * Calls the API and, if successfull, returns the object delivered by the API.
259
-     *
260
-     * @uses get_bloginfo()
261
-     * @uses wp_remote_post()
262
-     * @uses is_wp_error()
263
-     *
264
-     * @param string  $_action The requested action.
265
-     * @param array   $_data   Parameters for the API action.
266
-     * @return false||object
267
-     */
268
-    private function api_request( $_action, $_data ) {
269
-
270
-        $data = array_merge( $this->api_data, $_data );
271
-
272
-        if ( $data['slug'] != $this->slug ) {
273
-            return;
185
+					__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give' ),
186
+					esc_html( $version_info->name ),
187
+					esc_url( $changelog_link ),
188
+					esc_html( $version_info->new_version ),
189
+					esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
190
+				);
191
+			}
192
+
193
+			echo '</div></td></tr>';
194
+		}
195
+	}
196
+
197
+
198
+	/**
199
+	 * Updates information on the "View version x.x details" page with custom data.
200
+	 *
201
+	 * @uses api_request()
202
+	 *
203
+	 * @param mixed   $_data
204
+	 * @param string  $_action
205
+	 * @param object  $_args
206
+	 * @return object $_data
207
+	 */
208
+	function plugins_api_filter( $_data, $_action = '', $_args = null ) {
209
+
210
+
211
+		if ( $_action != 'plugin_information' ) {
212
+
213
+			return $_data;
214
+
215
+		}
216
+
217
+		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
218
+
219
+			return $_data;
220
+
221
+		}
222
+
223
+		$to_send = array(
224
+			'slug'   => $this->slug,
225
+			'is_ssl' => is_ssl(),
226
+			'fields' => array(
227
+				'banners' => false, // These will be supported soon hopefully
228
+				'reviews' => false
229
+			)
230
+		);
231
+
232
+		$api_response = $this->api_request( 'plugin_information', $to_send );
233
+
234
+		if ( false !== $api_response ) {
235
+			$_data = $api_response;
236
+		}
237
+
238
+		return $_data;
239
+	}
240
+
241
+
242
+	/**
243
+	 * Disable SSL verification in order to prevent download update failures
244
+	 *
245
+	 * @param array   $args
246
+	 * @param string  $url
247
+	 * @return object $array
248
+	 */
249
+	function http_request_args( $args, $url ) {
250
+		// If it is an https request and we are performing a package download, disable ssl verification
251
+		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
252
+			$args['sslverify'] = false;
253
+		}
254
+		return $args;
255
+	}
256
+
257
+	/**
258
+	 * Calls the API and, if successfull, returns the object delivered by the API.
259
+	 *
260
+	 * @uses get_bloginfo()
261
+	 * @uses wp_remote_post()
262
+	 * @uses is_wp_error()
263
+	 *
264
+	 * @param string  $_action The requested action.
265
+	 * @param array   $_data   Parameters for the API action.
266
+	 * @return false||object
267
+	 */
268
+	private function api_request( $_action, $_data ) {
269
+
270
+		$data = array_merge( $this->api_data, $_data );
271
+
272
+		if ( $data['slug'] != $this->slug ) {
273
+			return;
274 274
 		}
275 275
 
276
-        if ( empty( $data['license'] ) ) {
277
-            return;
276
+		if ( empty( $data['license'] ) ) {
277
+			return;
278 278
 		}
279 279
 
280
-        if( $this->api_url == home_url() ) {
281
-            return false; // Don't allow a plugin to ping itself
282
-        }
280
+		if( $this->api_url == home_url() ) {
281
+			return false; // Don't allow a plugin to ping itself
282
+		}
283 283
 
284
-        $api_params = array(
285
-            'edd_action' => 'get_version',
286
-            'license'    => $data['license'],
287
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
288
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
289
-            'slug'       => $data['slug'],
290
-            'author'     => $data['author'],
291
-            'url'        => home_url()
292
-        );
284
+		$api_params = array(
285
+			'edd_action' => 'get_version',
286
+			'license'    => $data['license'],
287
+			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
288
+			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
289
+			'slug'       => $data['slug'],
290
+			'author'     => $data['author'],
291
+			'url'        => home_url()
292
+		);
293 293
 
294
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
294
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
295 295
 
296
-        if ( ! is_wp_error( $request ) ) {
297
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
298
-        }
296
+		if ( ! is_wp_error( $request ) ) {
297
+			$request = json_decode( wp_remote_retrieve_body( $request ) );
298
+		}
299 299
 
300
-        if ( $request && isset( $request->sections ) ) {
301
-            $request->sections = maybe_unserialize( $request->sections );
302
-        } else {
303
-            $request = false;
304
-        }
300
+		if ( $request && isset( $request->sections ) ) {
301
+			$request->sections = maybe_unserialize( $request->sections );
302
+		} else {
303
+			$request = false;
304
+		}
305 305
 
306
-        return $request;
307
-    }
306
+		return $request;
307
+	}
308 308
 
309
-    public function show_changelog() {
309
+	public function show_changelog() {
310 310
 
311 311
 
312
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
313
-            return;
314
-        }
312
+		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
313
+			return;
314
+		}
315 315
 
316
-        if( empty( $_REQUEST['plugin'] ) ) {
317
-            return;
318
-        }
316
+		if( empty( $_REQUEST['plugin'] ) ) {
317
+			return;
318
+		}
319 319
 
320
-        if( empty( $_REQUEST['slug'] ) ) {
321
-            return;
322
-        }
320
+		if( empty( $_REQUEST['slug'] ) ) {
321
+			return;
322
+		}
323 323
 
324
-        if( ! current_user_can( 'update_plugins' ) ) {
325
-            wp_die( esc_html__( 'You do not have permission to install plugin updates.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
326
-        }
324
+		if( ! current_user_can( 'update_plugins' ) ) {
325
+			wp_die( esc_html__( 'You do not have permission to install plugin updates.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
326
+		}
327 327
 
328
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
328
+		$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
329 329
 
330
-        if( $response && isset( $response->sections['changelog'] ) ) {
331
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
332
-        }
330
+		if( $response && isset( $response->sections['changelog'] ) ) {
331
+			echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
332
+		}
333 333
 
334 334
 
335
-        exit;
336
-    }
335
+		exit;
336
+	}
337 337
 
338 338
 }
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 //set_site_transient( 'update_plugins', null );
5 5
 
6 6
 // Exit if accessed directly.
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if ( ! defined('ABSPATH')) {
8 8
 	exit;
9 9
 }
10 10
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
      * @param string  $_plugin_file Path to the plugin file.
28 28
      * @param array   $_api_data    Optional data to send with API calls.
29 29
      */
30
-    function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
31
-        $this->api_url  = trailingslashit( $_api_url );
30
+    function __construct($_api_url, $_plugin_file, $_api_data = null) {
31
+        $this->api_url  = trailingslashit($_api_url);
32 32
         $this->api_data = $_api_data;
33
-        $this->name     = plugin_basename( $_plugin_file );
34
-        $this->slug     = basename( $_plugin_file, '.php' );
33
+        $this->name     = plugin_basename($_plugin_file);
34
+        $this->slug     = basename($_plugin_file, '.php');
35 35
         $this->version  = $_api_data['version'];
36 36
 
37 37
         // Set up hooks.
38 38
         $this->init();
39
-        add_action( 'admin_init', array( $this, 'show_changelog' ) );
39
+        add_action('admin_init', array($this, 'show_changelog'));
40 40
     }
41 41
 
42 42
     /**
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function init() {
48 48
 
49
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
50
-        add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
49
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
50
+        add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
51 51
 
52
-        add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
52
+        add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
53 53
     }
54 54
 
55 55
     /**
@@ -65,34 +65,34 @@  discard block
 block discarded – undo
65 65
      * @param array   $_transient_data Update array build by WordPress.
66 66
      * @return array Modified update array with custom plugin data.
67 67
      */
68
-    function check_update( $_transient_data ) {
68
+    function check_update($_transient_data) {
69 69
 
70 70
         $screen = get_current_screen();
71 71
 
72
-        if( ! is_object( $_transient_data ) ) {
72
+        if ( ! is_object($_transient_data)) {
73 73
             $_transient_data = new stdClass;
74 74
         }
75 75
 
76
-        if( 'plugins.php' == $screen->parent_file && is_multisite() ) {
76
+        if ('plugins.php' == $screen->parent_file && is_multisite()) {
77 77
             return $_transient_data;
78 78
         }
79 79
 
80
-        if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
80
+        if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) {
81 81
 
82
-            $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
82
+            $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
83 83
 
84
-            if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
84
+            if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
85 85
 
86 86
                 $this->did_check = true;
87 87
 
88
-                if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
88
+                if (version_compare($this->version, $version_info->new_version, '<')) {
89 89
 
90
-                    $_transient_data->response[ $this->name ] = $version_info;
90
+                    $_transient_data->response[$this->name] = $version_info;
91 91
 
92 92
                 }
93 93
 
94 94
                 $_transient_data->last_checked = time();
95
-                $_transient_data->checked[ $this->name ] = $this->version;
95
+                $_transient_data->checked[$this->name] = $this->version;
96 96
 
97 97
             }
98 98
 
@@ -107,86 +107,86 @@  discard block
 block discarded – undo
107 107
      * @param string  $file
108 108
      * @param array   $plugin
109 109
      */
110
-    public function show_update_notification( $file, $plugin ) {
110
+    public function show_update_notification($file, $plugin) {
111 111
 
112
-        if( ! current_user_can( 'update_plugins' ) ) {
112
+        if ( ! current_user_can('update_plugins')) {
113 113
             return;
114 114
         }
115 115
 
116
-        if( ! is_multisite() ) {
116
+        if ( ! is_multisite()) {
117 117
             return;
118 118
         }
119 119
 
120
-        if ( $this->name != $file ) {
120
+        if ($this->name != $file) {
121 121
             return;
122 122
         }
123 123
 
124 124
         // Remove our filter on the site transient
125
-        remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
125
+        remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
126 126
 
127
-        $update_cache = get_site_transient( 'update_plugins' );
127
+        $update_cache = get_site_transient('update_plugins');
128 128
 
129
-        if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
129
+        if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) {
130 130
 
131
-            $cache_key    = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
132
-            $version_info = get_transient( $cache_key );
131
+            $cache_key    = md5('edd_plugin_'.sanitize_key($this->name).'_version_info');
132
+            $version_info = get_transient($cache_key);
133 133
 
134
-            if( false === $version_info ) {
134
+            if (false === $version_info) {
135 135
 
136
-                $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
136
+                $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug));
137 137
 
138
-                set_transient( $cache_key, $version_info, 3600 );
138
+                set_transient($cache_key, $version_info, 3600);
139 139
             }
140 140
 
141 141
 
142
-            if( ! is_object( $version_info ) ) {
142
+            if ( ! is_object($version_info)) {
143 143
                 return;
144 144
             }
145 145
 
146
-            if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
146
+            if (version_compare($this->version, $version_info->new_version, '<')) {
147 147
 
148
-                $update_cache->response[ $this->name ] = $version_info;
148
+                $update_cache->response[$this->name] = $version_info;
149 149
 
150 150
             }
151 151
 
152 152
             $update_cache->last_checked = time();
153
-            $update_cache->checked[ $this->name ] = $this->version;
153
+            $update_cache->checked[$this->name] = $this->version;
154 154
 
155
-            set_site_transient( 'update_plugins', $update_cache );
155
+            set_site_transient('update_plugins', $update_cache);
156 156
 
157 157
         } else {
158 158
 
159
-            $version_info = $update_cache->response[ $this->name ];
159
+            $version_info = $update_cache->response[$this->name];
160 160
 
161 161
         }
162 162
 
163 163
         // Restore our filter
164
-        add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
164
+        add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
165 165
 
166
-        if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
166
+        if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
167 167
 
168 168
             // build a plugin list row, with update notification
169
-            $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
170
-            echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
169
+            $wp_list_table = _get_list_table('WP_Plugins_List_Table');
170
+            echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
171 171
 
172
-            $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
172
+            $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
173 173
 
174
-            if ( empty( $version_info->download_link ) ) {
174
+            if (empty($version_info->download_link)) {
175 175
                 printf(
176 176
 					/* translators: 1: name 2: changelog URL 3: version */
177
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give' ),
178
-                    esc_html( $version_info->name ),
179
-                    esc_url( $changelog_link ),
180
-                    esc_html( $version_info->new_version )
177
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'give'),
178
+                    esc_html($version_info->name),
179
+                    esc_url($changelog_link),
180
+                    esc_html($version_info->new_version)
181 181
                 );
182 182
             } else {
183 183
                 printf(
184 184
 					/* translators: 1: name 2: changelog URL 3: version 4: update URL */
185
-                    __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give' ),
186
-                    esc_html( $version_info->name ),
187
-                    esc_url( $changelog_link ),
188
-                    esc_html( $version_info->new_version ),
189
-                    esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
185
+                    __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'give'),
186
+                    esc_html($version_info->name),
187
+                    esc_url($changelog_link),
188
+                    esc_html($version_info->new_version),
189
+                    esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name))
190 190
                 );
191 191
             }
192 192
 
@@ -205,16 +205,16 @@  discard block
 block discarded – undo
205 205
      * @param object  $_args
206 206
      * @return object $_data
207 207
      */
208
-    function plugins_api_filter( $_data, $_action = '', $_args = null ) {
208
+    function plugins_api_filter($_data, $_action = '', $_args = null) {
209 209
 
210 210
 
211
-        if ( $_action != 'plugin_information' ) {
211
+        if ($_action != 'plugin_information') {
212 212
 
213 213
             return $_data;
214 214
 
215 215
         }
216 216
 
217
-        if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
217
+        if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
218 218
 
219 219
             return $_data;
220 220
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
             )
230 230
         );
231 231
 
232
-        $api_response = $this->api_request( 'plugin_information', $to_send );
232
+        $api_response = $this->api_request('plugin_information', $to_send);
233 233
 
234
-        if ( false !== $api_response ) {
234
+        if (false !== $api_response) {
235 235
             $_data = $api_response;
236 236
         }
237 237
 
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
      * @param string  $url
247 247
      * @return object $array
248 248
      */
249
-    function http_request_args( $args, $url ) {
249
+    function http_request_args($args, $url) {
250 250
         // If it is an https request and we are performing a package download, disable ssl verification
251
-        if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
251
+        if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
252 252
             $args['sslverify'] = false;
253 253
         }
254 254
         return $args;
@@ -265,40 +265,40 @@  discard block
 block discarded – undo
265 265
      * @param array   $_data   Parameters for the API action.
266 266
      * @return false||object
267 267
      */
268
-    private function api_request( $_action, $_data ) {
268
+    private function api_request($_action, $_data) {
269 269
 
270
-        $data = array_merge( $this->api_data, $_data );
270
+        $data = array_merge($this->api_data, $_data);
271 271
 
272
-        if ( $data['slug'] != $this->slug ) {
272
+        if ($data['slug'] != $this->slug) {
273 273
             return;
274 274
 		}
275 275
 
276
-        if ( empty( $data['license'] ) ) {
276
+        if (empty($data['license'])) {
277 277
             return;
278 278
 		}
279 279
 
280
-        if( $this->api_url == home_url() ) {
280
+        if ($this->api_url == home_url()) {
281 281
             return false; // Don't allow a plugin to ping itself
282 282
         }
283 283
 
284 284
         $api_params = array(
285 285
             'edd_action' => 'get_version',
286 286
             'license'    => $data['license'],
287
-            'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
288
-            'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
287
+            'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
288
+            'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
289 289
             'slug'       => $data['slug'],
290 290
             'author'     => $data['author'],
291 291
             'url'        => home_url()
292 292
         );
293 293
 
294
-        $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
294
+        $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
295 295
 
296
-        if ( ! is_wp_error( $request ) ) {
297
-            $request = json_decode( wp_remote_retrieve_body( $request ) );
296
+        if ( ! is_wp_error($request)) {
297
+            $request = json_decode(wp_remote_retrieve_body($request));
298 298
         }
299 299
 
300
-        if ( $request && isset( $request->sections ) ) {
301
-            $request->sections = maybe_unserialize( $request->sections );
300
+        if ($request && isset($request->sections)) {
301
+            $request->sections = maybe_unserialize($request->sections);
302 302
         } else {
303 303
             $request = false;
304 304
         }
@@ -309,26 +309,26 @@  discard block
 block discarded – undo
309 309
     public function show_changelog() {
310 310
 
311 311
 
312
-        if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
312
+        if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
313 313
             return;
314 314
         }
315 315
 
316
-        if( empty( $_REQUEST['plugin'] ) ) {
316
+        if (empty($_REQUEST['plugin'])) {
317 317
             return;
318 318
         }
319 319
 
320
-        if( empty( $_REQUEST['slug'] ) ) {
320
+        if (empty($_REQUEST['slug'])) {
321 321
             return;
322 322
         }
323 323
 
324
-        if( ! current_user_can( 'update_plugins' ) ) {
325
-            wp_die( esc_html__( 'You do not have permission to install plugin updates.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
324
+        if ( ! current_user_can('update_plugins')) {
325
+            wp_die(esc_html__('You do not have permission to install plugin updates.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
326 326
         }
327 327
 
328
-        $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
328
+        $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug']));
329 329
 
330
-        if( $response && isset( $response->sections['changelog'] ) ) {
331
-            echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
330
+        if ($response && isset($response->sections['changelog'])) {
331
+            echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>';
332 332
         }
333 333
 
334 334
 
Please login to merge, or discard this patch.