Completed
Pull Request — master (#893)
by Rami
20:06
created
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => esc_html__( 'Log ID', 'give' ),
126
-			'payment_id' => esc_html__( 'Payment ID', 'give' ),
127
-			'error'      => esc_html__( 'Error', 'give' ),
128
-			'message'    => esc_html__( 'Error Message', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'date'       => esc_html__( 'Date', 'give' )
125
+			'ID'         => esc_html__('Log ID', 'give'),
126
+			'payment_id' => esc_html__('Payment ID', 'give'),
127
+			'error'      => esc_html__('Error', 'give'),
128
+			'message'    => esc_html__('Error Message', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'date'       => esc_html__('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
215
+		<div class="tablenav <?php echo esc_attr($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 1 patch
Spacing   +128 added lines, -128 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
 
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		'user_id' => 0
55 55
 	);
56 56
 
57
-	$customer_info = wp_parse_args( $customer_info, $defaults );
57
+	$customer_info = wp_parse_args($customer_info, $defaults);
58 58
 
59
-	if ( ! is_email( $customer_info['email'] ) ) {
60
-		give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) );
59
+	if ( ! is_email($customer_info['email'])) {
60
+		give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give'));
61 61
 	}
62 62
 
63
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
63
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a customer
66
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
67
-			give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
66
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
67
+			give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user
71
-		$user = get_user_by( 'id', $customer_info['user_id'] );
72
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
73
-			give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
71
+		$user = get_user_by('id', $customer_info['user_id']);
72
+		if ( ! empty($customer_info['user_id']) && false === $user) {
73
+			give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
74 74
 		}
75 75
 
76 76
 	}
@@ -78,53 +78,53 @@  discard block
 block discarded – undo
78 78
 	// Record this for later
79 79
 	$previous_user_id = $customer->user_id;
80 80
 
81
-	if ( give_get_errors() ) {
81
+	if (give_get_errors()) {
82 82
 		return;
83 83
 	}
84 84
 
85 85
 	// Setup the customer address, if present
86 86
 	$address = array();
87
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
87
+	if (intval($customer_info['user_id']) > 0) {
88 88
 
89
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
89
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
90 90
 
91
-		if ( false === $current_address ) {
92
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
93
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
94
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
95
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
96
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
97
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
91
+		if (false === $current_address) {
92
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
93
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
94
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
95
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
96
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
97
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
98 98
 		} else {
99
-			$current_address    = wp_parse_args( $current_address, array(
99
+			$current_address    = wp_parse_args($current_address, array(
100 100
 				'line1',
101 101
 				'line2',
102 102
 				'city',
103 103
 				'zip',
104 104
 				'state',
105 105
 				'country'
106
-			) );
107
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
108
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
109
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
110
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
111
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
112
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
106
+			));
107
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
108
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
109
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
110
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
111
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
112
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
113 113
 		}
114 114
 
115 115
 	}
116 116
 
117 117
 	// Sanitize the inputs
118 118
 	$customer_data            = array();
119
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
119
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
120 120
 	$customer_data['email']   = $customer_info['email'];
121 121
 	$customer_data['user_id'] = $customer_info['user_id'];
122 122
 
123
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
124
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
123
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
124
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
125 125
 
126
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
127
-	$address       = array_map( 'sanitize_text_field', $address );
126
+	$customer_data = array_map('sanitize_text_field', $customer_data);
127
+	$address       = array_map('sanitize_text_field', $address);
128 128
 
129 129
 
130 130
 	/**
@@ -136,34 +136,34 @@  discard block
 block discarded – undo
136 136
 	 * @param array $customer_data The customer data.
137 137
 	 * @param array $address       The customer address.
138 138
 	 */
139
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
139
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
140 140
 
141 141
 	$output         = array();
142 142
 	$previous_email = $customer->email;
143 143
 
144
-	if ( $customer->update( $customer_data ) ) {
144
+	if ($customer->update($customer_data)) {
145 145
 
146
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
147
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
146
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
147
+			update_user_meta($customer->user_id, '_give_user_address', $address);
148 148
 		}
149 149
 
150 150
 		// Update some payment meta if we need to
151
-		$payments_array = explode( ',', $customer->payment_ids );
151
+		$payments_array = explode(',', $customer->payment_ids);
152 152
 
153
-		if ( $customer->email != $previous_email ) {
154
-			foreach ( $payments_array as $payment_id ) {
155
-				give_update_payment_meta( $payment_id, 'email', $customer->email );
153
+		if ($customer->email != $previous_email) {
154
+			foreach ($payments_array as $payment_id) {
155
+				give_update_payment_meta($payment_id, 'email', $customer->email);
156 156
 			}
157 157
 		}
158 158
 
159
-		if ( $customer->user_id != $previous_user_id ) {
160
-			foreach ( $payments_array as $payment_id ) {
161
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
159
+		if ($customer->user_id != $previous_user_id) {
160
+			foreach ($payments_array as $payment_id) {
161
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
162 162
 			}
163 163
 		}
164 164
 
165 165
 		$output['success']       = true;
166
-		$customer_data           = array_merge( $customer_data, $address );
166
+		$customer_data           = array_merge($customer_data, $address);
167 167
 		$output['customer_info'] = $customer_data;
168 168
 
169 169
 	} else {
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	 * @param int   $customer_id   The ID of the customer.
181 181
 	 * @param array $customer_data The customer data.
182 182
 	 */
183
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
183
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
184 184
 
185
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
186
-		header( 'Content-Type: application/json' );
187
-		echo json_encode( $output );
185
+	if (defined('DOING_AJAX') && DOING_AJAX) {
186
+		header('Content-Type: application/json');
187
+		echo json_encode($output);
188 188
 		wp_die();
189 189
 	}
190 190
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 }
194 194
 
195
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
195
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
196 196
 
197 197
 /**
198 198
  * Save a customer note being added
@@ -203,36 +203,36 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return int         The Note ID that was saved, or 0 if nothing was saved
205 205
  */
206
-function give_customer_save_note( $args ) {
206
+function give_customer_save_note($args) {
207 207
 
208
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
208
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
209 209
 
210
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
211
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
210
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
211
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
212 212
 	}
213 213
 
214
-	if ( empty( $args ) ) {
214
+	if (empty($args)) {
215 215
 		return;
216 216
 	}
217 217
 
218
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
218
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
219 219
 	$customer_id   = (int) $args['customer_id'];
220 220
 	$nonce         = $args['add_customer_note_nonce'];
221 221
 
222
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
223
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
222
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
223
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
224 224
 	}
225 225
 
226
-	if ( empty( $customer_note ) ) {
227
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
226
+	if (empty($customer_note)) {
227
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
228 228
 	}
229 229
 
230
-	if ( give_get_errors() ) {
230
+	if (give_get_errors()) {
231 231
 		return;
232 232
 	}
233 233
 
234
-	$customer = new Give_Customer( $customer_id );
235
-	$new_note = $customer->add_note( $customer_note );
234
+	$customer = new Give_Customer($customer_id);
235
+	$new_note = $customer->add_note($customer_note);
236 236
 
237 237
 	/**
238 238
 	 * Fires before inserting customer note.
@@ -242,22 +242,22 @@  discard block
 block discarded – undo
242 242
 	 * @param int    $customer_id The ID of the customer.
243 243
 	 * @param string $new_note    Note content.
244 244
 	 */
245
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
245
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
246 246
 
247
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
247
+	if ( ! empty($new_note) && ! empty($customer->id)) {
248 248
 
249 249
 		ob_start();
250 250
 		?>
251 251
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
252 252
 			<span class="note-content-wrap">
253
-				<?php echo stripslashes( $new_note ); ?>
253
+				<?php echo stripslashes($new_note); ?>
254 254
 			</span>
255 255
 		</div>
256 256
 		<?php
257 257
 		$output = ob_get_contents();
258 258
 		ob_end_clean();
259 259
 
260
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
260
+		if (defined('DOING_AJAX') && DOING_AJAX) {
261 261
 			echo $output;
262 262
 			exit;
263 263
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 }
272 272
 
273
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
273
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
274 274
 
275 275
 /**
276 276
  * Delete a customer
@@ -281,37 +281,37 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @return int Whether it was a successful deletion
283 283
  */
284
-function give_customer_delete( $args ) {
284
+function give_customer_delete($args) {
285 285
 
286
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
286
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
287 287
 
288
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
289
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
288
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
289
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
290 290
 	}
291 291
 
292
-	if ( empty( $args ) ) {
292
+	if (empty($args)) {
293 293
 		return;
294 294
 	}
295 295
 
296 296
 	$customer_id = (int) $args['customer_id'];
297
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
298
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
297
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
298
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
299 299
 	$nonce       = $args['_wpnonce'];
300 300
 
301
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
302
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
301
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
302
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
303 303
 	}
304 304
 
305
-	if ( ! $confirm ) {
306
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
305
+	if ( ! $confirm) {
306
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
307 307
 	}
308 308
 
309
-	if ( give_get_errors() ) {
310
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
309
+	if (give_get_errors()) {
310
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
311 311
 		exit;
312 312
 	}
313 313
 
314
-	$customer = new Give_Customer( $customer_id );
314
+	$customer = new Give_Customer($customer_id);
315 315
 
316 316
 	/**
317 317
 	 * Fires before deleting customer.
@@ -322,55 +322,55 @@  discard block
 block discarded – undo
322 322
 	 * @param bool $confirm     Delete confirmation.
323 323
 	 * @param bool $remove_data Records delete confirmation.
324 324
 	 */
325
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
325
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
326 326
 
327 327
 	$success = false;
328 328
 
329
-	if ( $customer->id > 0 ) {
329
+	if ($customer->id > 0) {
330 330
 
331
-		$payments_array = explode( ',', $customer->payment_ids );
332
-		$success        = Give()->customers->delete( $customer->id );
331
+		$payments_array = explode(',', $customer->payment_ids);
332
+		$success        = Give()->customers->delete($customer->id);
333 333
 
334
-		if ( $success ) {
334
+		if ($success) {
335 335
 
336
-			if ( $remove_data ) {
336
+			if ($remove_data) {
337 337
 
338 338
 				// Remove all payments, logs, etc
339
-				foreach ( $payments_array as $payment_id ) {
340
-					give_delete_purchase( $payment_id );
339
+				foreach ($payments_array as $payment_id) {
340
+					give_delete_purchase($payment_id);
341 341
 				}
342 342
 
343 343
 			} else {
344 344
 
345 345
 				// Just set the payments to customer_id of 0
346
-				foreach ( $payments_array as $payment_id ) {
347
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
346
+				foreach ($payments_array as $payment_id) {
347
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
348 348
 				}
349 349
 
350 350
 			}
351 351
 
352
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
352
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
353 353
 
354 354
 		} else {
355 355
 
356
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
357
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
356
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
357
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
358 358
 
359 359
 		}
360 360
 
361 361
 	} else {
362 362
 
363
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
364
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
363
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
364
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
365 365
 
366 366
 	}
367 367
 
368
-	wp_redirect( $redirect );
368
+	wp_redirect($redirect);
369 369
 	exit;
370 370
 
371 371
 }
372 372
 
373
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
373
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
374 374
 
375 375
 /**
376 376
  * Disconnect a user ID from a donor
@@ -381,27 +381,27 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return bool        If the disconnect was successful
383 383
  */
384
-function give_disconnect_customer_user_id( $args ) {
384
+function give_disconnect_customer_user_id($args) {
385 385
 
386
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
386
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
387 387
 
388
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
389
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
388
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
389
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
390 390
 	}
391 391
 
392
-	if ( empty( $args ) ) {
392
+	if (empty($args)) {
393 393
 		return;
394 394
 	}
395 395
 
396 396
 	$customer_id = (int) $args['customer_id'];
397 397
 	$nonce       = $args['_wpnonce'];
398 398
 
399
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
400
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
399
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
400
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
401 401
 	}
402 402
 
403
-	$customer = new Give_Customer( $customer_id );
404
-	if ( empty( $customer->id ) ) {
403
+	$customer = new Give_Customer($customer_id);
404
+	if (empty($customer->id)) {
405 405
 		return false;
406 406
 	}
407 407
 
@@ -415,15 +415,15 @@  discard block
 block discarded – undo
415 415
 	 * @param int $customer_id The ID of the customer.
416 416
 	 * @param int $user_id     The ID of the user.
417 417
 	 */
418
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
418
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
419 419
 
420
-	$customer_args = array( 'user_id' => 0 );
420
+	$customer_args = array('user_id' => 0);
421 421
 
422
-	if ( $customer->update( $customer_args ) ) {
422
+	if ($customer->update($customer_args)) {
423 423
 		global $wpdb;
424 424
 
425
-		if ( ! empty( $customer->payment_ids ) ) {
426
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
425
+		if ( ! empty($customer->payment_ids)) {
426
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
427 427
 		}
428 428
 
429 429
 		$output['success'] = true;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	} else {
432 432
 
433 433
 		$output['success'] = false;
434
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
434
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
435 435
 	}
436 436
 
437 437
 	/**
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @param int $customer_id The ID of the customer.
443 443
 	 */
444
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
444
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
445 445
 
446
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
447
-		header( 'Content-Type: application/json' );
448
-		echo json_encode( $output );
446
+	if (defined('DOING_AJAX') && DOING_AJAX) {
447
+		header('Content-Type: application/json');
448
+		echo json_encode($output);
449 449
 		wp_die();
450 450
 	}
451 451
 
@@ -453,4 +453,4 @@  discard block
 block discarded – undo
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
456
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 2 patches
Spacing   +141 added lines, -141 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,24 +67,24 @@  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();
74 74
 	?>
75 75
 	<div class="wrap">
76
-		<h1><?php esc_html_e( 'Donors', 'give' ); ?></h1>
76
+		<h1><?php esc_html_e('Donors', 'give'); ?></h1>
77 77
 		<?php
78 78
 		/**
79 79
 		 * Fires in donors screen, above the table.
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,27 +142,27 @@  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
-		<?php if ( $customer && $render ) : ?>
151
+		<?php if ($customer && $render) : ?>
152 152
 
153 153
 			<div id="customer-tab-wrapper">
154 154
 				<ul id="customer-tab-wrapper-list" class="nav-tab-wrapper">
155
-					<?php foreach ( $customer_tabs as $key => $tab ) : ?>
155
+					<?php foreach ($customer_tabs as $key => $tab) : ?>
156 156
 						<?php $active = $key === $view ? true : false; ?>
157 157
 						<?php $class = $active ? 'active' : 'inactive'; ?>
158 158
 
159
-						<li class="<?php echo sanitize_html_class( $class ); ?>">
160
-							<?php if ( ! $active ) : ?>
161
-							<a aria-label="<?php esc_attr_e( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>">
159
+						<li class="<?php echo sanitize_html_class($class); ?>">
160
+							<?php if ( ! $active) : ?>
161
+							<a aria-label="<?php esc_attr_e($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>">
162 162
 								<?php endif; ?>
163 163
 
164
-								<span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php esc_html_e( $tab['title'] ); ?>
165
-								<?php if ( ! $active ) : ?>
164
+								<span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($tab['title']); ?>
165
+								<?php if ( ! $active) : ?>
166 166
 							</a>
167 167
 						<?php endif; ?>
168 168
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			</div>
175 175
 
176 176
 			<div id="give-customer-card-wrapper">
177
-				<?php $callbacks[ $view ]( $customer ) ?>
177
+				<?php $callbacks[$view]($customer) ?>
178 178
 			</div>
179 179
 
180 180
 		<?php endif; ?>
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return void
196 196
  */
197
-function give_customers_view( $customer ) {
197
+function give_customers_view($customer) {
198 198
 
199
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
199
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
200 200
 
201 201
 	/**
202 202
 	 * Fires in donor profile screen, above the donor card.
@@ -205,32 +205,32 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @param object $customer The customer object being displayed.
207 207
 	 */
208
-	do_action( 'give_donor_card_top', $customer );
208
+	do_action('give_donor_card_top', $customer);
209 209
 	?>
210 210
 
211 211
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
212 212
 
213
-		<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 ); ?>">
213
+		<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); ?>">
214 214
 
215 215
 			<div class="customer-info">
216 216
 
217 217
 				<div class="donor-bio-header clearfix">
218 218
 
219 219
 					<div class="avatar-wrap left" id="customer-avatar">
220
-						<?php echo get_avatar( $customer->email ); ?>
220
+						<?php echo get_avatar($customer->email); ?>
221 221
 					</div>
222 222
 
223 223
 					<div id="customer-name-wrap" class="left">
224 224
 						<span class="customer-id">#<?php echo $customer->id; ?></span>
225
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span>
225
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span>
226 226
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
227 227
 					</div>
228 228
 					<p class="customer-since info-item">
229
-						<?php esc_html_e( 'Donor since', 'give' ); ?>
230
-						<?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?>
229
+						<?php esc_html_e('Donor since', 'give'); ?>
230
+						<?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?>
231 231
 					</p>
232
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
233
-						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
232
+					<?php if (current_user_can($customer_edit_role)): ?>
233
+						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a>
234 234
 					<?php endif; ?>
235 235
 				</div>
236 236
 				<!-- /donor-bio-header -->
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 					<table class="widefat">
241 241
 						<tbody>
242 242
 						<tr>
243
-							<td><label for="tablecell"><?php esc_html_e( 'Email', 'give' ); ?></label>:</td>
243
+							<td><label for="tablecell"><?php esc_html_e('Email', 'give'); ?></label>:</td>
244 244
 							<td class="row-title">
245
-								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e( 'Donor Email', 'give' ); ?>" /></span>
245
+								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e('Donor Email', 'give'); ?>" /></span>
246 246
 								<span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span>
247 247
 							</td>
248 248
 						</tr>
249 249
 						<tr class="alternate">
250
-							<td><label for="tablecell"><?php esc_html_e( 'User ID', 'give' ); ?></label>:</td>
250
+							<td><label for="tablecell"><?php esc_html_e('User ID', 'give'); ?></label>:</td>
251 251
 							<td class="row-title">
252 252
 								<span class="customer-user-id info-item edit-item">
253 253
 									<?php
@@ -263,38 +263,38 @@  discard block
 block discarded – undo
263 263
 										'data'  => $data_atts,
264 264
 									);
265 265
 
266
-									if ( ! empty( $user_id ) ) {
267
-										$userdata           = get_userdata( $user_id );
266
+									if ( ! empty($user_id)) {
267
+										$userdata           = get_userdata($user_id);
268 268
 										$user_args['value'] = $userdata->user_login;
269 269
 									}
270 270
 
271
-									echo Give()->html->ajax_user_search( $user_args );
271
+									echo Give()->html->ajax_user_search($user_args);
272 272
 									?>
273 273
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
274 274
 								</span>
275 275
 			
276 276
 								<span class="customer-user-id info-item editable">
277
-									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
277
+									<?php if (intval($customer->user_id) > 0) : ?>
278 278
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
279 279
 									<?php else : ?>
280
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
280
+										<span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span>
281 281
 									<?php endif; ?>
282
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
283
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
282
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?>
283
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span>
284 284
 									<?php endif; ?>
285 285
 								</span>
286 286
 							</td>
287 287
 						</tr>
288
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
288
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
289 289
 
290 290
 							<tr>
291
-								<td><?php esc_html_e( 'Address:', 'give' ); ?></td>
291
+								<td><?php esc_html_e('Address:', 'give'); ?></td>
292 292
 								<td class="row-title">
293 293
 
294 294
 									<div class="customer-address-wrapper">
295 295
 
296 296
 										<?php
297
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
297
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
298 298
 										$defaults = array(
299 299
 											'line1'   => '',
300 300
 											'line2'   => '',
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 											'zip'     => ''
305 305
 										);
306 306
 
307
-										$address = wp_parse_args( $address, $defaults );
307
+										$address = wp_parse_args($address, $defaults);
308 308
 										?>
309 309
 
310
-										<?php if ( ! empty( $address ) ) { ?>
310
+										<?php if ( ! empty($address)) { ?>
311 311
 											<span class="customer-address info-item editable">
312 312
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
313 313
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -318,38 +318,38 @@  discard block
 block discarded – undo
318 318
 											</span>
319 319
 										<?php } ?>
320 320
 										<span class="customer-address info-item edit-item">
321
-											<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']; ?>" />
322
-											<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']; ?>" />
323
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
321
+											<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']; ?>" />
322
+											<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']; ?>" />
323
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
324 324
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
325 325
 												<?php
326 326
 
327 327
 												$selected_country = $address['country'];
328 328
 
329 329
 												$countries = give_get_country_list();
330
-												foreach ( $countries as $country_code => $country ) {
331
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
330
+												foreach ($countries as $country_code => $country) {
331
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
332 332
 												}
333 333
 												?>
334 334
 											</select>
335 335
 											<?php
336 336
 											$selected_state = give_get_state();
337
-											$states         = give_get_states( $selected_country );
337
+											$states         = give_get_states($selected_country);
338 338
 
339
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
339
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
340 340
 
341
-											if ( ! empty( $states ) ) : ?>
341
+											if ( ! empty($states)) : ?>
342 342
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
343 343
 													<?php
344
-													foreach ( $states as $state_code => $state ) {
345
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
344
+													foreach ($states as $state_code => $state) {
345
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
346 346
 													}
347 347
 													?>
348 348
 												</select>
349 349
 											<?php else : ?>
350
-												<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' ); ?>" />
350
+												<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'); ?>" />
351 351
 											<?php endif; ?>
352
-											<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']; ?>" />
352
+											<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']; ?>" />
353 353
 													</span>
354 354
 
355 355
 									</div>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 
367 367
 			<span id="customer-edit-actions" class="edit-item">
368 368
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
369
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
369
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
370 370
 				<input type="hidden" name="give_action" value="edit-customer" />
371
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" />
372
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
371
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
372
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
373 373
 			</span>
374 374
 
375 375
 		</form>
@@ -384,24 +384,24 @@  discard block
 block discarded – undo
384 384
 	 *
385 385
 	 * @param object $customer The customer object being displayed.
386 386
 	 */
387
-	do_action( 'give_donor_before_stats', $customer );
387
+	do_action('give_donor_before_stats', $customer);
388 388
 	?>
389 389
 
390 390
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
391 391
 		<ul>
392 392
 			<li>
393
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
393
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
394 394
 					<span class="dashicons dashicons-heart"></span>
395 395
 					<?php
396 396
 					//Completed Donations
397
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
398
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
397
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
398
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
399 399
 					?>
400 400
 				</a>
401 401
 			</li>
402 402
 			<li>
403 403
 				<span class="dashicons dashicons-chart-area"></span>
404
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?>
404
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?>
405 405
 			</li>
406 406
 			<?php
407 407
 			/**
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			 *
414 414
 			 * @param object $customer The customer object being displayed.
415 415
 			 */
416
-			do_action( 'give_donor_stats_list', $customer );
416
+			do_action('give_donor_stats_list', $customer);
417 417
 			?>
418 418
 		</ul>
419 419
 	</div>
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 *
427 427
 	 * @param object $customer The customer object being displayed.
428 428
 	 */
429
-	do_action( 'give_donor_before_tables_wrapper', $customer );
429
+	do_action('give_donor_before_tables_wrapper', $customer);
430 430
 	?>
431 431
 
432 432
 	<div id="customer-tables-wrapper" class="customer-section">
@@ -439,36 +439,36 @@  discard block
 block discarded – undo
439 439
 		 *
440 440
 		 * @param object $customer The customer object being displayed.
441 441
 		 */
442
-		do_action( 'give_donor_before_tables', $customer );
442
+		do_action('give_donor_before_tables', $customer);
443 443
 		?>
444 444
 
445
-		<h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3>
445
+		<h3><?php esc_html_e('Recent Donations', 'give'); ?></h3>
446 446
 		<?php
447
-		$payment_ids = explode( ',', $customer->payment_ids );
448
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
449
-		$payments    = array_slice( $payments, 0, 10 );
447
+		$payment_ids = explode(',', $customer->payment_ids);
448
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
449
+		$payments    = array_slice($payments, 0, 10);
450 450
 		?>
451 451
 		<table class="wp-list-table widefat striped payments">
452 452
 			<thead>
453 453
 			<tr>
454
-				<th><?php esc_html_e( 'ID', 'give' ); ?></th>
455
-				<th><?php esc_html_e( 'Amount', 'give' ); ?></th>
456
-				<th><?php esc_html_e( 'Date', 'give' ); ?></th>
457
-				<th><?php esc_html_e( 'Status', 'give' ); ?></th>
458
-				<th><?php esc_html_e( 'Actions', 'give' ); ?></th>
454
+				<th><?php esc_html_e('ID', 'give'); ?></th>
455
+				<th><?php esc_html_e('Amount', 'give'); ?></th>
456
+				<th><?php esc_html_e('Date', 'give'); ?></th>
457
+				<th><?php esc_html_e('Status', 'give'); ?></th>
458
+				<th><?php esc_html_e('Actions', 'give'); ?></th>
459 459
 			</tr>
460 460
 			</thead>
461 461
 			<tbody>
462
-			<?php if ( ! empty( $payments ) ) : ?>
463
-				<?php foreach ( $payments as $payment ) : ?>
462
+			<?php if ( ! empty($payments)) : ?>
463
+				<?php foreach ($payments as $payment) : ?>
464 464
 					<tr>
465 465
 						<td><?php echo $payment->ID; ?></td>
466
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
467
-						<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td>
468
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
466
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
467
+						<td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td>
468
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
469 469
 						<td>
470
-							<a title="<?php sprintf( esc_attr_e( 'View Details for Donation %s', 'give' ), $payment->ID ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>">
471
-								<?php esc_html_e( 'View Details', 'give' ); ?>
470
+							<a title="<?php sprintf(esc_attr_e('View Details for Donation %s', 'give'), $payment->ID); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>">
471
+								<?php esc_html_e('View Details', 'give'); ?>
472 472
 							</a>
473 473
 							<?php
474 474
 							/**
@@ -481,47 +481,47 @@  discard block
 block discarded – undo
481 481
 							 * @param object $customer The customer object being displayed.
482 482
 							 * @param object $payment  The payment object being displayed.
483 483
 							 */
484
-							do_action( 'give_donor_recent_purchases_actions', $customer, $payment );
484
+							do_action('give_donor_recent_purchases_actions', $customer, $payment);
485 485
 							?>
486 486
 						</td>
487 487
 					</tr>
488 488
 				<?php endforeach; ?>
489 489
 			<?php else: ?>
490 490
 				<tr>
491
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
491
+					<td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td>
492 492
 				</tr>
493 493
 			<?php endif; ?>
494 494
 			</tbody>
495 495
 		</table>
496 496
 
497
-		<h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3>
497
+		<h3><?php esc_html_e('Completed Donations', 'give'); ?></h3>
498 498
 		<?php
499
-		$donations = give_get_users_completed_donations( $customer->email );
499
+		$donations = give_get_users_completed_donations($customer->email);
500 500
 		?>
501 501
 		<table class="wp-list-table widefat striped donations">
502 502
 			<thead>
503 503
 			<tr>
504 504
 				<th><?php echo give_get_forms_label_singular(); ?></th>
505
-				<th width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th>
505
+				<th width="120px"><?php esc_html_e('Actions', 'give'); ?></th>
506 506
 			</tr>
507 507
 			</thead>
508 508
 			<tbody>
509
-			<?php if ( ! empty( $donations ) ) : ?>
510
-				<?php foreach ( $donations as $donation ) : ?>
509
+			<?php if ( ! empty($donations)) : ?>
510
+				<?php foreach ($donations as $donation) : ?>
511 511
 					<tr>
512 512
 						<td><?php echo $donation->post_title; ?></td>
513 513
 						<td>
514 514
 							<a title="<?php
515 515
 								printf(
516 516
 									/* translators: %s: post title */
517
-									esc_attr__( 'View %s', 'give' ),
517
+									esc_attr__('View %s', 'give'),
518 518
 									$donation->post_title
519
-								); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) );
519
+								); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID));
520 520
 							?>">
521 521
 								<?php
522 522
 									printf(
523 523
 										/* translators: %s: forms singular label */
524
-										esc_html__( 'View %s', 'give' ),
524
+										esc_html__('View %s', 'give'),
525 525
 										give_get_forms_label_singular()
526 526
 									);
527 527
 								?>
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 				<?php endforeach; ?>
532 532
 			<?php else: ?>
533 533
 				<tr>
534
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
534
+					<td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td>
535 535
 				</tr>
536 536
 			<?php endif; ?>
537 537
 			</tbody>
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		 *
546 546
 		 * @param object $customer The customer object being displayed.
547 547
 		 */
548
-		do_action( 'give_donor_after_tables', $customer );
548
+		do_action('give_donor_after_tables', $customer);
549 549
 		?>
550 550
 
551 551
 	</div>
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @param object $customer The customer object being displayed.
560 560
 	 */
561
-	do_action( 'give_donor_card_bottom', $customer );
561
+	do_action('give_donor_card_bottom', $customer);
562 562
 
563 563
 }
564 564
 
@@ -571,30 +571,30 @@  discard block
 block discarded – undo
571 571
  *
572 572
  * @return void
573 573
  */
574
-function give_customer_notes_view( $customer ) {
574
+function give_customer_notes_view($customer) {
575 575
 
576
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
577
-	$paged          = absint( $paged );
576
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
577
+	$paged          = absint($paged);
578 578
 	$note_count     = $customer->get_notes_count();
579
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
580
-	$total_pages    = ceil( $note_count / $per_page );
581
-	$customer_notes = $customer->get_notes( $per_page, $paged );
579
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
580
+	$total_pages    = ceil($note_count / $per_page);
581
+	$customer_notes = $customer->get_notes($per_page, $paged);
582 582
 	?>
583 583
 
584 584
 	<div id="customer-notes-wrapper">
585 585
 		<div class="customer-notes-header">
586
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
586
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
587 587
 		</div>
588
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
588
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
589 589
 
590
-		<?php if ( 1 == $paged ) : ?>
590
+		<?php if (1 == $paged) : ?>
591 591
 			<div style="display: block; margin-bottom: 55px;">
592
-				<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 ); ?>">
592
+				<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); ?>">
593 593
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
594 594
 					<br />
595 595
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
596 596
 					<input type="hidden" name="give_action" value="add-customer-note" />
597
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
597
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
598 598
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
599 599
 				</form>
600 600
 			</div>
@@ -609,26 +609,26 @@  discard block
 block discarded – undo
609 609
 			'show_all' => true
610 610
 		);
611 611
 
612
-		echo paginate_links( $pagination_args );
612
+		echo paginate_links($pagination_args);
613 613
 		?>
614 614
 
615 615
 		<div id="give-customer-notes" class="postbox">
616
-			<?php if ( count( $customer_notes ) > 0 ) : ?>
617
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
616
+			<?php if (count($customer_notes) > 0) : ?>
617
+				<?php foreach ($customer_notes as $key => $note) : ?>
618 618
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
619 619
 					<span class="note-content-wrap">
620
-						<?php echo stripslashes( $note ); ?>
620
+						<?php echo stripslashes($note); ?>
621 621
 					</span>
622 622
 					</div>
623 623
 				<?php endforeach; ?>
624 624
 			<?php else: ?>
625 625
 				<div class="give-no-customer-notes">
626
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
626
+					<?php esc_html_e('No donor notes found.', 'give'); ?>
627 627
 				</div>
628 628
 			<?php endif; ?>
629 629
 		</div>
630 630
 
631
-		<?php echo paginate_links( $pagination_args ); ?>
631
+		<?php echo paginate_links($pagination_args); ?>
632 632
 
633 633
 	</div>
634 634
 
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return void
646 646
  */
647
-function give_customers_delete_view( $customer ) {
647
+function give_customers_delete_view($customer) {
648 648
 
649
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
649
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
650 650
 
651 651
 	/**
652 652
 	 * Fires in donor delete screen, above the content.
@@ -655,15 +655,15 @@  discard block
 block discarded – undo
655 655
 	 *
656 656
 	 * @param object $customer The customer object being displayed.
657 657
 	 */
658
-	do_action( 'give_customer_delete_top', $customer );
658
+	do_action('give_customer_delete_top', $customer);
659 659
 	?>
660 660
 
661 661
 	<div class="info-wrapper customer-section">
662 662
 
663
-		<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 ); ?>">
663
+		<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); ?>">
664 664
 
665 665
 			<div class="customer-notes-header">
666
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
666
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
667 667
 			</div>
668 668
 
669 669
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 
672 672
 				<span class="delete-customer-options">
673 673
 					<p>
674
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
675
-						<label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
674
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
675
+						<label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
676 676
 					</p>
677 677
 
678 678
 					<p>
679
-						<?php echo Give()->html->checkbox( array(
679
+						<?php echo Give()->html->checkbox(array(
680 680
 							'name'    => 'give-customer-delete-records',
681
-							'options' => array( 'disabled' => true )
682
-						) ); ?>
683
-						<label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label>
681
+							'options' => array('disabled' => true)
682
+						)); ?>
683
+						<label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label>
684 684
 					</p>
685 685
 
686 686
 					<?php
@@ -693,16 +693,16 @@  discard block
 block discarded – undo
693 693
 					 *
694 694
 					 * @param object $customer The customer object being displayed.
695 695
 					 */
696
-					do_action( 'give_customer_delete_inputs', $customer );
696
+					do_action('give_customer_delete_inputs', $customer);
697 697
 					?>
698 698
 				</span>
699 699
 
700 700
 				<span id="customer-edit-actions">
701 701
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
702
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
702
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
703 703
 					<input type="hidden" name="give_action" value="delete-customer" />
704
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
705
-					<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>
704
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
705
+					<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>
706 706
 				</span>
707 707
 
708 708
 			</div>
@@ -718,5 +718,5 @@  discard block
 block discarded – undo
718 718
 	 *
719 719
 	 * @param object $customer The customer object being displayed.
720 720
 	 */
721
-	do_action( 'give_customer_delete_bottom', $customer );
721
+	do_action('give_customer_delete_bottom', $customer);
722 722
 }
Please login to merge, or discard this patch.
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -276,8 +276,11 @@  discard block
 block discarded – undo
276 276
 								<span class="customer-user-id info-item editable">
277 277
 									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
278 278
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
279
-									<?php else : ?>
280
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
279
+									<?php else {
280
+	: ?>
281
+										<span data-key="user_id"><?php esc_html_e( 'None', 'give' );
282
+}
283
+?></span>
281 284
 									<?php endif; ?>
282 285
 									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
283 286
 										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
@@ -346,8 +349,11 @@  discard block
 block discarded – undo
346 349
 													}
347 350
 													?>
348 351
 												</select>
349
-											<?php else : ?>
350
-												<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' ); ?>" />
352
+											<?php else {
353
+	: ?>
354
+												<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' );
355
+}
356
+?>" />
351 357
 											<?php endif; ?>
352 358
 											<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']; ?>" />
353 359
 													</span>
@@ -486,9 +492,12 @@  discard block
 block discarded – undo
486 492
 						</td>
487 493
 					</tr>
488 494
 				<?php endforeach; ?>
489
-			<?php else: ?>
495
+			<?php else {
496
+	: ?>
490 497
 				<tr>
491
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
498
+					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' );
499
+}
500
+?></td>
492 501
 				</tr>
493 502
 			<?php endif; ?>
494 503
 			</tbody>
@@ -529,9 +538,12 @@  discard block
 block discarded – undo
529 538
 						</td>
530 539
 					</tr>
531 540
 				<?php endforeach; ?>
532
-			<?php else: ?>
541
+			<?php else {
542
+	: ?>
533 543
 				<tr>
534
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
544
+					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' );
545
+}
546
+?></td>
535 547
 				</tr>
536 548
 			<?php endif; ?>
537 549
 			</tbody>
@@ -621,9 +633,12 @@  discard block
 block discarded – undo
621 633
 					</span>
622 634
 					</div>
623 635
 				<?php endforeach; ?>
624
-			<?php else: ?>
636
+			<?php else {
637
+	: ?>
625 638
 				<div class="give-no-customer-notes">
626
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
639
+					<?php esc_html_e( 'No donor notes found.', 'give' );
640
+}
641
+?>
627 642
 				</div>
628 643
 			<?php endif; ?>
629 644
 		</div>
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					esc_html__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 				?></p>
58 58
 
59
-			<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>
59
+			<?php $earnings_today = $stats->get_earnings(0, 'today', false); ?>
60 60
 
61
-			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>
61
+			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p>
62 62
 
63 63
 			<p class="give-orders-today">
64
-				<?php $donations_today = $stats->get_sales( 0, 'today', false ); ?>
65
-				<?php echo give_format_amount( $donations_today, false ); ?>
66
-				<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
64
+				<?php $donations_today = $stats->get_sales(0, 'today', false); ?>
65
+				<?php echo give_format_amount($donations_today, false); ?>
66
+				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span>
67 67
 			</p>
68 68
 
69 69
 
@@ -73,34 +73,34 @@  discard block
 block discarded – undo
73 73
 		<table class="give-table-stats">
74 74
 			<thead style="display: none;">
75 75
 			<tr>
76
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
77
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
78
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
76
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
77
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
78
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
79 79
 			</tr>
80 80
 			</thead>
81 81
 			<tbody>
82 82
 			<tr id="give-table-stats-tr-1">
83 83
 				<td>
84
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
84
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
85 85
 
86
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p>
86
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p>
87 87
 				</td>
88 88
 				<td>
89
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
89
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
90 90
 
91
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p>
91
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p>
92 92
 				</td>
93 93
 			</tr>
94 94
 			<tr id="give-table-stats-tr-2">
95 95
 				<td>
96
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
96
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
97 97
 
98
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p>
98
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p>
99 99
 				</td>
100 100
 				<td>
101
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
101
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
102 102
 
103
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p>
103
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p>
104 104
 				</td>
105 105
 			</tr>
106 106
 			</tbody>
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return array
122 122
  */
123
-function give_dashboard_at_a_glance_widget( $items ) {
124
-	$num_posts = wp_count_posts( 'give_forms' );
123
+function give_dashboard_at_a_glance_widget($items) {
124
+	$num_posts = wp_count_posts('give_forms');
125 125
 
126
-	if ( $num_posts && $num_posts->publish ) {
126
+	if ($num_posts && $num_posts->publish) {
127 127
 
128 128
 		$text = sprintf(
129 129
 		/* translators: 1: number of posts published 2: forms singular label 3: forms plural label */
130
-			_n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ),
130
+			_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'),
131 131
 			$num_posts->publish,
132 132
 			give_get_forms_label_singular(),
133 133
 			give_get_forms_label_plural()
134 134
 		);
135 135
 
136
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
136
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
137 137
 
138
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
139
-			$text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text );
138
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
139
+			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
140 140
 		} else {
141
-			$text = sprintf( '<span class="give-forms-count">%1$s</span>', $text );
141
+			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
142 142
 		}
143 143
 
144 144
 		$items[] = $text;
@@ -147,4 +147,4 @@  discard block
 block discarded – undo
147 147
 	return $items;
148 148
 }
149 149
 
150
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
150
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
34
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
35 35
 
36
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
37
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
36
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
37
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
38 38
 
39
-	$to_email = give_get_payment_user_email( $payment_id );
39
+	$to_email = give_get_payment_user_email($payment_id);
40 40
 
41
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
42
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
43
-	$subject = give_do_email_tags( $subject, $payment_id );
41
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
42
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
43
+	$subject = give_do_email_tags($subject, $payment_id);
44 44
 
45
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
46
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
45
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
46
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
47 47
 
48 48
 	$emails = Give()->emails;
49 49
 
50
-	$emails->__set( 'from_name', $from_name );
51
-	$emails->__set( 'from_email', $from_email );
52
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
50
+	$emails->__set('from_name', $from_name);
51
+	$emails->__set('from_email', $from_email);
52
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
53 53
 
54 54
 
55
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
56
-	$emails->__set( 'headers', $headers );
55
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
56
+	$emails->__set('headers', $headers);
57 57
 
58
-	$emails->send( $to_email, $subject, $message, $attachments );
58
+	$emails->send($to_email, $subject, $message, $attachments);
59 59
 
60
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
61
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
60
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
61
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
62 62
 	}
63 63
 }
64 64
 
@@ -71,29 +71,29 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function give_email_test_donation_receipt() {
73 73
 
74
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
75
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
74
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
75
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
76 76
 
77
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
78
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
77
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
78
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
79 79
 
80
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
81
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
82
-	$subject = give_do_email_tags( $subject, 0 );
80
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
81
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
82
+	$subject = give_do_email_tags($subject, 0);
83 83
 
84
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
84
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
85 85
 
86
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
86
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
87 87
 
88 88
 	$emails = Give()->emails;
89
-	$emails->__set( 'from_name', $from_name );
90
-	$emails->__set( 'from_email', $from_email );
91
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
89
+	$emails->__set('from_name', $from_name);
90
+	$emails->__set('from_email', $from_email);
91
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
92 92
 
93
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
94
-	$emails->__set( 'headers', $headers );
93
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
94
+	$emails->__set('headers', $headers);
95 95
 
96
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
96
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
97 97
 
98 98
 }
99 99
 
@@ -107,50 +107,50 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return void
109 109
  */
110
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
110
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
111 111
 
112
-	$payment_id = absint( $payment_id );
112
+	$payment_id = absint($payment_id);
113 113
 
114
-	if ( empty( $payment_id ) ) {
114
+	if (empty($payment_id)) {
115 115
 		return;
116 116
 	}
117 117
 
118
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
118
+	if ( ! give_get_payment_by('id', $payment_id)) {
119 119
 		return;
120 120
 	}
121 121
 
122
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
123
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
122
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
123
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
124 124
 
125
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
126
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
125
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
126
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
127 127
 
128 128
 	/* translators: %s: payment id */
129
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
130
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
131
-	$subject = give_do_email_tags( $subject, $payment_id );
129
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
130
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
131
+	$subject = give_do_email_tags($subject, $payment_id);
132 132
 
133
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
134
-	$headers .= "Reply-To: " . $from_email . "\r\n";
133
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
134
+	$headers .= "Reply-To: ".$from_email."\r\n";
135 135
 	//$headers  .= "MIME-Version: 1.0\r\n";
136 136
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
137
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
137
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
138 138
 
139
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
139
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
140 140
 
141
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
141
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
142 142
 
143 143
 	$emails = Give()->emails;
144
-	$emails->__set( 'from_name', $from_name );
145
-	$emails->__set( 'from_email', $from_email );
146
-	$emails->__set( 'headers', $headers );
147
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
144
+	$emails->__set('from_name', $from_name);
145
+	$emails->__set('from_email', $from_email);
146
+	$emails->__set('headers', $headers);
147
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
148 148
 
149
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
149
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
150 150
 
151 151
 }
152 152
 
153
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
153
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
154 154
 
155 155
 /**
156 156
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 	$email_option = give_get_option('admin_notice_emails');
164 164
 
165
-	$emails = !empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
166
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
165
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
166
+	$emails = array_map('trim', explode("\n", $emails));
167 167
 
168
-	return apply_filters( 'give_admin_notice_emails', $emails );
168
+	return apply_filters('give_admin_notice_emails', $emails);
169 169
 }
170 170
 
171 171
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return mixed
179 179
  */
180
-function give_admin_notices_disabled( $payment_id = 0 ) {
180
+function give_admin_notices_disabled($payment_id = 0) {
181 181
 
182
-	$retval = give_get_option( 'disable_admin_notices' );
182
+	$retval = give_get_option('disable_admin_notices');
183 183
 
184
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
184
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
185 185
 }
186 186
 
187 187
 /**
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_get_default_donation_notification_email() {
196 196
 
197
-	$default_email_body  = esc_html__( 'Hi there,', 'give' ) . "\n\n";
198
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
199
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
200
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
201
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
202
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
203
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
204
-	$default_email_body .= '{sitename}' . "\n";
197
+	$default_email_body  = esc_html__('Hi there,', 'give')."\n\n";
198
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
199
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
200
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
201
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
202
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
203
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
204
+	$default_email_body .= '{sitename}'."\n";
205 205
 
206
-	$custom_message = give_get_option( 'donation_notification' );
207
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
206
+	$custom_message = give_get_option('donation_notification');
207
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
208 208
 
209
-	return apply_filters( 'give_default_donation_notification_email', $message );
209
+	return apply_filters('give_default_donation_notification_email', $message);
210 210
 }
211 211
 
212 212
 
@@ -220,25 +220,25 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function give_get_default_donation_receipt_email() {
222 222
 
223
-	$default_email_body  = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
224
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
225
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
226
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
227
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
228
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
229
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
230
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
231
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
232
-	$default_email_body .= '{receipt_link}' . "\n\n";
223
+	$default_email_body  = esc_html__('Dear', 'give')." {name},\n\n";
224
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
225
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
226
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
227
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
228
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
229
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
230
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
231
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
232
+	$default_email_body .= '{receipt_link}'."\n\n";
233 233
 	$default_email_body .= "\n\n";
234
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
235
-	$default_email_body .= '{sitename}' . "\n";
234
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
235
+	$default_email_body .= '{sitename}'."\n";
236 236
 
237
-	$custom_message = give_get_option( 'donation_receipt' );
237
+	$custom_message = give_get_option('donation_receipt');
238 238
 
239
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
239
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
240 240
 
241
-	return apply_filters( 'give_default_donation_receipt_email', $message );
241
+	return apply_filters('give_default_donation_receipt_email', $message);
242 242
 }
243 243
 
244 244
 /**
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return array $email_names
252 252
  */
253
-function give_get_email_names( $user_info ) {
253
+function give_get_email_names($user_info) {
254 254
 	$email_names = array();
255
-	$user_info   = maybe_unserialize( $user_info );
255
+	$user_info   = maybe_unserialize($user_info);
256 256
 
257 257
 	$email_names['fullname'] = '';
258
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
259
-		$user_data               = get_userdata( $user_info['id'] );
258
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
259
+		$user_data               = get_userdata($user_info['id']);
260 260
 		$email_names['name']     = $user_info['first_name'];
261
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
261
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
262 262
 		$email_names['username'] = $user_data->user_login;
263
-	} elseif ( isset( $user_info['first_name'] ) ) {
263
+	} elseif (isset($user_info['first_name'])) {
264 264
 		$email_names['name']     = $user_info['first_name'];
265
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
265
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
266 266
 		$email_names['username'] = $user_info['first_name'];
267 267
 	} else {
268 268
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +101 added lines, -101 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
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,38 +56,38 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69 69
 	$receipt_link = sprintf(
70 70
 		'<a href="%1$s">%2$s</a>',
71
-		esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ),
72
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
71
+		esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())),
72
+		esc_html__('View the receipt in your browser &raquo;', 'give')
73 73
 	);
74 74
 
75 75
 	$user = wp_get_current_user();
76 76
 
77
-	$message = str_replace( '{name}', $user->display_name, $message );
78
-	$message = str_replace( '{fullname}', $user->display_name, $message );
79
-	$message = str_replace( '{username}', $user->user_login, $message );
80
-	$message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message );
81
-	$message = str_replace( '{price}', $price, $message );
82
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
83
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
84
-	$message = str_replace( '{payment_method}', $gateway, $message );
85
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
86
-	$message = str_replace( '{payment_id}', $payment_id, $message );
87
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
88
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
89
-
90
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
77
+	$message = str_replace('{name}', $user->display_name, $message);
78
+	$message = str_replace('{fullname}', $user->display_name, $message);
79
+	$message = str_replace('{username}', $user->user_login, $message);
80
+	$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
81
+	$message = str_replace('{price}', $price, $message);
82
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
83
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
84
+	$message = str_replace('{payment_method}', $gateway, $message);
85
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
86
+	$message = str_replace('{payment_id}', $payment_id, $message);
87
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
88
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
89
+
90
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
91 91
 }
92 92
 
93 93
 /**
@@ -99,23 +99,23 @@  discard block
 block discarded – undo
99 99
  * @since  1.0
100 100
  * @return array|bool
101 101
  */
102
-function give_email_template_preview( $array ) {
102
+function give_email_template_preview($array) {
103 103
 
104
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
104
+	if ( ! current_user_can('manage_give_settings')) {
105 105
 		return false;
106 106
 	}
107 107
 	$custom_field = array(
108
-		'name' => esc_html__( 'Preview Email', 'give' ),
109
-		'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ),
108
+		'name' => esc_html__('Preview Email', 'give'),
109
+		'desc' => esc_html__('Click the buttons to preview emails.', 'give'),
110 110
 		'id'   => 'give_email_preview_buttons',
111 111
 		'type' => 'email_preview_buttons'
112 112
 	);
113 113
 
114
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
114
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
115 115
 
116 116
 }
117 117
 
118
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
118
+add_filter('give_settings_emails', 'give_email_template_preview');
119 119
 
120 120
 /**
121 121
  * Output Email Template Preview Buttons.
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 function give_email_preview_buttons_callback() {
128 128
 	ob_start();
129 129
 	?>
130
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
131
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
130
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
131
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
132 132
 		'give_action'  => 'send_test_email',
133 133
 		'give-message' => 'sent-test-email',
134 134
 		'tag'          => 'emails'
135
-	) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
135
+	)), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
136 136
 	<?php
137 137
 	echo ob_get_clean();
138 138
 }
@@ -145,46 +145,46 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function give_display_email_template_preview() {
147 147
 
148
-	if ( empty( $_GET['give_action'] ) ) {
148
+	if (empty($_GET['give_action'])) {
149 149
 		return;
150 150
 	}
151 151
 
152
-	if ( 'preview_email' !== $_GET['give_action'] ) {
152
+	if ('preview_email' !== $_GET['give_action']) {
153 153
 		return;
154 154
 	}
155 155
 
156
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
156
+	if ( ! current_user_can('manage_give_settings')) {
157 157
 		return;
158 158
 	}
159 159
 
160 160
 
161
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
161
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
162 162
 
163
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
163
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
164 164
 
165 165
 	echo give_get_preview_email_header();
166 166
 
167 167
 	//Are we previewing an actual payment?
168
-	if ( ! empty( $payment_id ) ) {
168
+	if ( ! empty($payment_id)) {
169 169
 
170
-		$content = give_get_email_body_content( $payment_id );
170
+		$content = give_get_email_body_content($payment_id);
171 171
 
172
-		$preview_content = give_do_email_tags( $content, $payment_id );
172
+		$preview_content = give_do_email_tags($content, $payment_id);
173 173
 
174 174
 	} else {
175 175
 
176 176
 		//No payment ID, use sample preview content
177
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
177
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
178 178
 	}
179 179
 
180 180
 
181
-	echo Give()->emails->build_email( $preview_content );
181
+	echo Give()->emails->build_email($preview_content);
182 182
 
183 183
 	exit;
184 184
 
185 185
 }
186 186
 
187
-add_action( 'init', 'give_display_email_template_preview' );
187
+add_action('init', 'give_display_email_template_preview');
188 188
 
189 189
 /**
190 190
  * Email Template Body.
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return string $email_body Body of the email
198 198
  */
199
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
199
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
200 200
 
201 201
 	$default_email_body = give_get_default_donation_receipt_email();
202 202
 
203
-	$email_content = give_get_option( 'donation_receipt' );
204
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
203
+	$email_content = give_get_option('donation_receipt');
204
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
205 205
 
206
-	$email_body = wpautop( $email_content );
206
+	$email_body = wpautop($email_content);
207 207
 
208
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
208
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
209 209
 
210
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
210
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
211 211
 }
212 212
 
213 213
 /**
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string $email_body Body of the email
222 222
  */
223
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
223
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
224 224
 
225
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
226
-	$email     = give_get_payment_user_email( $payment_id );
225
+	$user_info = maybe_unserialize($payment_data['user_info']);
226
+	$email     = give_get_payment_user_email($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $email;
235 235
 	}
236 236
 
237
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
237
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
238 238
 
239
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
240
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
239
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
240
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
241 241
 	/* translators: %s: form plural label */
242
-	$default_email_body .= sprintf( esc_html__( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n";
243
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
244
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
245
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
246
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
242
+	$default_email_body .= sprintf(esc_html__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n";
243
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
244
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
245
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
246
+	$default_email_body .= esc_html__('Thank you', 'give');
247 247
 
248
-	$email = give_get_option( 'donation_notification' );
249
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
248
+	$email = give_get_option('donation_notification');
249
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
250 250
 
251
-	$email_body = give_do_email_tags( $email, $payment_id );
251
+	$email_body = give_do_email_tags($email, $payment_id);
252 252
 
253
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
253
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
254 254
 }
255 255
 
256 256
 /**
@@ -263,34 +263,34 @@  discard block
 block discarded – undo
263 263
  * @since  1.0
264 264
  */
265 265
 function give_render_receipt_in_browser() {
266
-	if ( ! isset( $_GET['payment_key'] ) ) {
267
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
266
+	if ( ! isset($_GET['payment_key'])) {
267
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
268 268
 	}
269 269
 
270
-	$key = urlencode( $_GET['payment_key'] );
270
+	$key = urlencode($_GET['payment_key']);
271 271
 
272 272
 	ob_start();
273 273
 	//Disallows caching of the page
274
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
275
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
276
-	header( "Cache-Control: post-check=0, pre-check=0", false );
277
-	header( "Pragma: no-cache" ); // HTTP/1.0
278
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
274
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
275
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
276
+	header("Cache-Control: post-check=0, pre-check=0", false);
277
+	header("Pragma: no-cache"); // HTTP/1.0
278
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
279 279
 	?>
280 280
 	<!DOCTYPE html>
281 281
 	<html lang="en">
282 282
 	<head>
283
-		<?php do_action( 'give_receipt_head' ); ?>
283
+		<?php do_action('give_receipt_head'); ?>
284 284
 	</head>
285
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
285
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
286 286
 
287 287
 	<div id="give_receipt_wrapper">
288
-		<?php do_action( 'give_render_receipt_in_browser_before' ); ?>
289
-		<?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?>
290
-		<?php do_action( 'give_render_receipt_in_browser_after' ); ?>
288
+		<?php do_action('give_render_receipt_in_browser_before'); ?>
289
+		<?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?>
290
+		<?php do_action('give_render_receipt_in_browser_after'); ?>
291 291
 	</div>
292 292
 
293
-	<?php do_action( 'give_receipt_footer' ); ?>
293
+	<?php do_action('give_receipt_footer'); ?>
294 294
 	</body>
295 295
 	</html>
296 296
 	<?php
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	die();
299 299
 }
300 300
 
301
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
301
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
302 302
 
303 303
 
304 304
 /**
@@ -313,29 +313,29 @@  discard block
 block discarded – undo
313 313
 
314 314
 	//Payment receipt switcher
315 315
 	$payment_count = give_count_payments()->publish;
316
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
316
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
317 317
 
318
-	if ( $payment_count <= 0 ) {
318
+	if ($payment_count <= 0) {
319 319
 		return false;
320 320
 	}
321 321
 
322 322
 	//Get payments.
323
-	$payments = new Give_Payments_Query( array(
323
+	$payments = new Give_Payments_Query(array(
324 324
 		'number' => 100
325
-	) );
325
+	));
326 326
 	$payments = $payments->get_payments();
327 327
 	$options  = array();
328 328
 
329 329
 	//Provide nice human readable options.
330
-	if ( $payments ) {
331
-		$options[0] = esc_html__( '- Select a transaction -', 'give' );
332
-		foreach ( $payments as $payment ) {
330
+	if ($payments) {
331
+		$options[0] = esc_html__('- Select a transaction -', 'give');
332
+		foreach ($payments as $payment) {
333 333
 
334
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
334
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
335 335
 
336 336
 		}
337 337
 	} else {
338
-		$options[0] = esc_html__( 'No Transactions Found', 'give' );
338
+		$options[0] = esc_html__('No Transactions Found', 'give');
339 339
 	}
340 340
 
341 341
 	//Start constructing HTML output.
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 			        var selected_trans = transactions.options[transactions.selectedIndex];
349 349
 				        console.log(selected_trans);
350 350
 				        if (selected_trans){
351
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
351
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
352 352
 				                window.location = url_string;
353 353
 				        }
354 354
 				    }
355 355
 			    </script>';
356 356
 
357
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a transaction:', 'give' ) . '</label>';
357
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a transaction:', 'give').'</label>';
358 358
 
359 359
 	//The select field with 100 latest transactions
360
-	$transaction_header .= Give()->html->select( array(
360
+	$transaction_header .= Give()->html->select(array(
361 361
 		'name'             => 'preview_email_payment_id',
362 362
 		'selected'         => $payment_id,
363 363
 		'id'               => 'give_preview_email_payment_id',
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 		'select_atts'      => 'onchange="change_preview()">',
368 368
 		'show_option_all'  => false,
369 369
 		'show_option_none' => false
370
-	) );
370
+	));
371 371
 
372 372
 	//Closing tag
373 373
 	$transaction_header .= '</div>';
374 374
 
375
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
375
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
376 376
 
377 377
 }
378 378
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 function give_receipt_head_content() {
387 387
 
388 388
 	//Title.
389
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
389
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
390 390
 
391 391
 	//Meta.
392 392
 	$output .= '<meta charset="utf-8"/>
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 		<meta name="robots" content="noindex, nofollow"/>';
401 401
 
402 402
 	//CSS
403
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
403
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
404 404
 
405
-	echo apply_filters( 'give_receipt_head_content', $output );
405
+	echo apply_filters('give_receipt_head_content', $output);
406 406
 
407 407
 }
408 408
 
409
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
410 409
\ No newline at end of file
410
+add_action('give_receipt_head', 'give_receipt_head_content');
411 411
\ No newline at end of file
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +18 added lines, -18 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
 
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a purchase receipt while editing a payment
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_purchase', 'give_trigger_donation_receipt', 999, 1 );
36
+add_action('give_complete_purchase', 'give_trigger_donation_receipt', 999, 1);
37 37
 
38 38
 /**
39 39
  * Resend the Email Purchase Receipt. (This can be done from the Payment History page)
@@ -44,29 +44,29 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return void
46 46
  */
47
-function give_resend_donation_receipt( $data ) {
47
+function give_resend_donation_receipt($data) {
48 48
 
49
-	$purchase_id = absint( $data['purchase_id'] );
49
+	$purchase_id = absint($data['purchase_id']);
50 50
 
51
-	if ( empty( $purchase_id ) ) {
51
+	if (empty($purchase_id)) {
52 52
 		return;
53 53
 	}
54 54
 
55
-	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) {
56
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
55
+	if ( ! current_user_can('edit_give_payments', $purchase_id)) {
56
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
57 57
 	}
58 58
 
59
-	give_email_donation_receipt( $purchase_id, false );
59
+	give_email_donation_receipt($purchase_id, false);
60 60
 
61
-	wp_redirect( add_query_arg( array(
61
+	wp_redirect(add_query_arg(array(
62 62
 		'give-message' => 'email_sent',
63 63
 		'give-action'  => false,
64 64
 		'purchase_id'  => false
65
-	) ) );
65
+	)));
66 66
 	exit;
67 67
 }
68 68
 
69
-add_action( 'give_email_links', 'give_resend_donation_receipt' );
69
+add_action('give_email_links', 'give_resend_donation_receipt');
70 70
 
71 71
 /**
72 72
  * Trigger the sending of a Test Email
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
  *
78 78
  * @return void
79 79
  */
80
-function give_send_test_email( $data ) {
81
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) {
80
+function give_send_test_email($data) {
81
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) {
82 82
 		return;
83 83
 	}
84 84
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	give_email_test_donation_receipt();
87 87
 
88 88
 	// Remove the test email query arg
89
-	wp_redirect( remove_query_arg( 'give_action' ) );
89
+	wp_redirect(remove_query_arg('give_action'));
90 90
 	exit;
91 91
 }
92 92
 
93
-add_action( 'give_send_test_email', 'give_send_test_email' );
93
+add_action('give_send_test_email', 'give_send_test_email');
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 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
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => esc_html__( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => esc_html__('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => esc_html__( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => esc_html__( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => esc_html__( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => esc_html__( 'New %1$s', 'give' ),
48
-		'all_items'          => esc_html__( 'All %2$s', 'give' ),
49
-		'view_item'          => esc_html__( 'View %1$s', 'give' ),
50
-		'search_items'       => esc_html__( 'Search %2$s', 'give' ),
51
-		'not_found'          => esc_html__( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => esc_html__( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => esc_html__('Add %1$s', 'give'),
45
+		'add_new_item'       => esc_html__('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => esc_html__('Edit Donation %1$s', 'give'),
47
+		'new_item'           => esc_html__('New %1$s', 'give'),
48
+		'all_items'          => esc_html__('All %2$s', 'give'),
49
+		'view_item'          => esc_html__('View %1$s', 'give'),
50
+		'search_items'       => esc_html__('Search %2$s', 'give'),
51
+		'not_found'          => esc_html__('No %2$s found', 'give'),
52
+		'not_found_in_trash' => esc_html__('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', esc_html__( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', esc_html__( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', esc_html__('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', esc_html__('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Payment Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => esc_html__( 'Add New', 'give' ),
104
-		'add_new_item'       => esc_html__( 'Add New Donation', 'give' ),
105
-		'edit_item'          => esc_html__( 'Edit Donation', 'give' ),
106
-		'new_item'           => esc_html__( 'New Donation', 'give' ),
107
-		'all_items'          => esc_html__( 'All Donations', 'give' ),
108
-		'view_item'          => esc_html__( 'View Donation', 'give' ),
109
-		'search_items'       => esc_html__( 'Search Donations', 'give' ),
110
-		'not_found'          => esc_html__( 'No Donations Found', 'give' ),
111
-		'not_found_in_trash' => esc_html__( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => esc_html__('Add New', 'give'),
104
+		'add_new_item'       => esc_html__('Add New Donation', 'give'),
105
+		'edit_item'          => esc_html__('Edit Donation', 'give'),
106
+		'new_item'           => esc_html__('New Donation', 'give'),
107
+		'all_items'          => esc_html__('All Donations', 'give'),
108
+		'view_item'          => esc_html__('View Donation', 'give'),
109
+		'search_items'       => esc_html__('Search Donations', 'give'),
110
+		'not_found'          => esc_html__('No Donations Found', 'give'),
111
+		'not_found_in_trash' => esc_html__('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => esc_html__( 'Transactions', 'give' )
113
+		'menu_name'          => esc_html__('Transactions', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147 147
 		/* translators: %s: form singular label */
148
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
149
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
150
-		'search_items'      => esc_html__( 'Search Categories', 'give' ),
151
-		'all_items'         => esc_html__( 'All Categories', 'give' ),
152
-		'parent_item'       => esc_html__( 'Parent Category', 'give' ),
153
-		'parent_item_colon' => esc_html__( 'Parent Category:', 'give' ),
154
-		'edit_item'         => esc_html__( 'Edit Category', 'give' ),
155
-		'update_item'       => esc_html__( 'Update Category', 'give' ),
148
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
149
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
150
+		'search_items'      => esc_html__('Search Categories', 'give'),
151
+		'all_items'         => esc_html__('All Categories', 'give'),
152
+		'parent_item'       => esc_html__('Parent Category', 'give'),
153
+		'parent_item_colon' => esc_html__('Parent Category:', 'give'),
154
+		'edit_item'         => esc_html__('Edit Category', 'give'),
155
+		'update_item'       => esc_html__('Update Category', 'give'),
156 156
 		/* translators: %s: form singular label */
157
-		'add_new_item'      => sprintf( esc_html__( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
158
-		'new_item_name'     => esc_html__( 'New Category Name', 'give' ),
159
-		'menu_name'         => esc_html__( 'Categories', 'give' ),
157
+		'add_new_item'      => sprintf(esc_html__('Add New %s Category', 'give'), give_get_forms_label_singular()),
158
+		'new_item_name'     => esc_html__('New Category Name', 'give'),
159
+		'menu_name'         => esc_html__('Categories', 'give'),
160 160
 	);
161 161
 
162
-	$category_args = apply_filters( 'give_forms_category_args', array(
162
+	$category_args = apply_filters('give_forms_category_args', array(
163 163
 			'hierarchical' => true,
164
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
164
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
165 165
 			'show_ui'      => true,
166 166
 			'query_var'    => 'give_forms_category',
167 167
 			'rewrite'      => array(
168
-				'slug'         => $slug . '/category',
168
+				'slug'         => $slug.'/category',
169 169
 				'with_front'   => false,
170 170
 				'hierarchical' => true
171 171
 			),
@@ -179,36 +179,36 @@  discard block
 block discarded – undo
179 179
 	);
180 180
 
181 181
 	//Does the user want categories?
182
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
183
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
184
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
182
+	if (give_get_option('enable_categories') == 'on') {
183
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
184
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
185 185
 	}
186 186
 
187 187
 
188 188
 	/** Tags */
189 189
 	$tag_labels = array(
190 190
 		/* translators: %s: form singular label */
191
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
192
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
193
-		'search_items'          => esc_html__( 'Search Tags', 'give' ),
194
-		'all_items'             => esc_html__( 'All Tags', 'give' ),
195
-		'parent_item'           => esc_html__( 'Parent Tag', 'give' ),
196
-		'parent_item_colon'     => esc_html__( 'Parent Tag:', 'give' ),
197
-		'edit_item'             => esc_html__( 'Edit Tag', 'give' ),
198
-		'update_item'           => esc_html__( 'Update Tag', 'give' ),
199
-		'add_new_item'          => esc_html__( 'Add New Tag', 'give' ),
200
-		'new_item_name'         => esc_html__( 'New Tag Name', 'give' ),
201
-		'menu_name'             => esc_html__( 'Tags', 'give' ),
191
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
192
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
193
+		'search_items'          => esc_html__('Search Tags', 'give'),
194
+		'all_items'             => esc_html__('All Tags', 'give'),
195
+		'parent_item'           => esc_html__('Parent Tag', 'give'),
196
+		'parent_item_colon'     => esc_html__('Parent Tag:', 'give'),
197
+		'edit_item'             => esc_html__('Edit Tag', 'give'),
198
+		'update_item'           => esc_html__('Update Tag', 'give'),
199
+		'add_new_item'          => esc_html__('Add New Tag', 'give'),
200
+		'new_item_name'         => esc_html__('New Tag Name', 'give'),
201
+		'menu_name'             => esc_html__('Tags', 'give'),
202 202
 		/* translators: %s: form singular label */
203
-		'choose_from_most_used' => sprintf( esc_html__( 'Choose from most used %s tags.', 'give' ), give_get_forms_label_singular() ),
203
+		'choose_from_most_used' => sprintf(esc_html__('Choose from most used %s tags.', 'give'), give_get_forms_label_singular()),
204 204
 	);
205 205
 
206
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
206
+	$tag_args = apply_filters('give_forms_tag_args', array(
207 207
 			'hierarchical' => false,
208
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
208
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
209 209
 			'show_ui'      => true,
210 210
 			'query_var'    => 'give_forms_tag',
211
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
211
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
212 212
 			'capabilities' => array(
213 213
 				'manage_terms' => 'manage_give_form_terms',
214 214
 				'edit_terms'   => 'edit_give_form_terms',
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		)
219 219
 	);
220 220
 
221
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
222
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
223
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
221
+	if (give_get_option('enable_tags') == 'on') {
222
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
223
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
224 224
 	}
225 225
 
226 226
 
227 227
 }
228 228
 
229
-add_action( 'init', 'give_setup_taxonomies', 0 );
229
+add_action('init', 'give_setup_taxonomies', 0);
230 230
 
231 231
 
232 232
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  */
238 238
 function give_get_default_form_labels() {
239 239
 	$defaults = array(
240
-		'singular' => esc_html__( 'Form', 'give' ),
241
-		'plural'   => esc_html__( 'Forms', 'give' )
240
+		'singular' => esc_html__('Form', 'give'),
241
+		'plural'   => esc_html__('Forms', 'give')
242 242
 	);
243 243
 
244
-	return apply_filters( 'give_default_form_name', $defaults );
244
+	return apply_filters('give_default_form_name', $defaults);
245 245
 }
246 246
 
247 247
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string $defaults['singular'] Singular label
255 255
  */
256
-function give_get_forms_label_singular( $lowercase = false ) {
256
+function give_get_forms_label_singular($lowercase = false) {
257 257
 	$defaults = give_get_default_form_labels();
258 258
 
259
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
259
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
260 260
 }
261 261
 
262 262
 /**
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
  * @since 1.0
266 266
  * @return string $defaults['plural'] Plural label
267 267
  */
268
-function give_get_forms_label_plural( $lowercase = false ) {
268
+function give_get_forms_label_plural($lowercase = false) {
269 269
 	$defaults = give_get_default_form_labels();
270 270
 
271
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
271
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
272 272
 }
273 273
 
274 274
 /**
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
  *
281 281
  * @return string $title New placeholder text
282 282
  */
283
-function give_change_default_title( $title ) {
283
+function give_change_default_title($title) {
284 284
 	// If a frontend plugin uses this filter (check extensions before changing this function)
285
-	if ( ! is_admin() ) {
285
+	if ( ! is_admin()) {
286 286
 		$title = sprintf(
287 287
 			/* translators: %s: form singular label */
288
-			esc_html__( 'Enter %s title here', 'give' ),
288
+			esc_html__('Enter %s title here', 'give'),
289 289
 			give_get_forms_label_singular()
290 290
 		);
291 291
 
@@ -294,10 +294,10 @@  discard block
 block discarded – undo
294 294
 
295 295
 	$screen = get_current_screen();
296 296
 
297
-	if ( 'give_forms' == $screen->post_type ) {
297
+	if ('give_forms' == $screen->post_type) {
298 298
 		$title = sprintf(
299 299
 			/* translators: %s: form singular label */
300
-			esc_html__( 'Enter %s title here', 'give' ),
300
+			esc_html__('Enter %s title here', 'give'),
301 301
 			give_get_forms_label_singular()
302 302
 		);
303 303
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	return $title;
306 306
 }
307 307
 
308
-add_filter( 'enter_title_here', 'give_change_default_title' );
308
+add_filter('enter_title_here', 'give_change_default_title');
309 309
 
310 310
 /**
311 311
  * Registers Custom Post Statuses which are used by the Payments
@@ -315,50 +315,50 @@  discard block
 block discarded – undo
315 315
  */
316 316
 function give_register_post_type_statuses() {
317 317
 	// Payment Statuses
318
-	register_post_status( 'refunded', array(
319
-		'label'                     => __( 'Refunded', 'give' ),
318
+	register_post_status('refunded', array(
319
+		'label'                     => __('Refunded', 'give'),
320 320
 		'public'                    => true,
321 321
 		'exclude_from_search'       => false,
322 322
 		'show_in_admin_all_list'    => true,
323 323
 		'show_in_admin_status_list' => true,
324
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
325
-	) );
326
-	register_post_status( 'failed', array(
327
-		'label'                     => __( 'Failed', 'give' ),
324
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
325
+	));
326
+	register_post_status('failed', array(
327
+		'label'                     => __('Failed', 'give'),
328 328
 		'public'                    => true,
329 329
 		'exclude_from_search'       => false,
330 330
 		'show_in_admin_all_list'    => true,
331 331
 		'show_in_admin_status_list' => true,
332
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
333
-	) );
334
-	register_post_status( 'revoked', array(
335
-		'label'                     => __( 'Revoked', 'give' ),
332
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
333
+	));
334
+	register_post_status('revoked', array(
335
+		'label'                     => __('Revoked', 'give'),
336 336
 		'public'                    => true,
337 337
 		'exclude_from_search'       => false,
338 338
 		'show_in_admin_all_list'    => true,
339 339
 		'show_in_admin_status_list' => true,
340
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
341
-	) );
342
-	register_post_status( 'cancelled', array(
343
-		'label'                     => __( 'Cancelled', 'give' ),
340
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
341
+	));
342
+	register_post_status('cancelled', array(
343
+		'label'                     => __('Cancelled', 'give'),
344 344
 		'public'                    => true,
345 345
 		'exclude_from_search'       => false,
346 346
 		'show_in_admin_all_list'    => true,
347 347
 		'show_in_admin_status_list' => true,
348
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
349
-	) );
350
-	register_post_status( 'abandoned', array(
351
-		'label'                     => __( 'Abandoned', 'give' ),
348
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
349
+	));
350
+	register_post_status('abandoned', array(
351
+		'label'                     => __('Abandoned', 'give'),
352 352
 		'public'                    => true,
353 353
 		'exclude_from_search'       => false,
354 354
 		'show_in_admin_all_list'    => true,
355 355
 		'show_in_admin_status_list' => true,
356
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
357
-	) );
356
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
357
+	));
358 358
 
359 359
 }
360 360
 
361
-add_action( 'init', 'give_register_post_type_statuses' );
361
+add_action('init', 'give_register_post_type_statuses');
362 362
 
363 363
 /**
364 364
  * Updated Messages
@@ -371,43 +371,43 @@  discard block
 block discarded – undo
371 371
  *
372 372
  * @return array $messages New post updated messages
373 373
  */
374
-function give_updated_messages( $messages ) {
374
+function give_updated_messages($messages) {
375 375
 	global $post, $post_ID;
376 376
 
377
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
377
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
378 378
 	$url2 = give_get_forms_label_singular();
379 379
 	$url3 = '</a>';
380 380
 
381 381
 	$messages['give_forms'] = array(
382
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
383
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
384
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
385
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
386
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
382
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
383
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
384
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
385
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
386
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
387 387
 	);
388 388
 
389 389
 	return $messages;
390 390
 }
391 391
 
392
-add_filter( 'post_updated_messages', 'give_updated_messages' );
392
+add_filter('post_updated_messages', 'give_updated_messages');
393 393
 
394 394
 
395 395
 /**
396 396
  * Setup Post Type Images
397 397
  */
398
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
398
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
399 399
 
400 400
 /**
401 401
  * Ensure post thumbnail support is turned on
402 402
  */
403 403
 function give_add_thumbnail_support() {
404
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
404
+	if (give_get_option('disable_form_featured_img') === 'on') {
405 405
 		return;
406 406
 	}
407
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
408
-		add_theme_support( 'post-thumbnails' );
407
+	if ( ! current_theme_supports('post-thumbnails')) {
408
+		add_theme_support('post-thumbnails');
409 409
 	}
410
-	add_post_type_support( 'give_forms', 'thumbnail' );
410
+	add_post_type_support('give_forms', 'thumbnail');
411 411
 }
412 412
 
413 413
 /**
@@ -419,19 +419,19 @@  discard block
 block discarded – undo
419 419
 function give_widgets_init() {
420 420
 
421 421
 	//Single Give Forms (disabled if single turned off in settings)
422
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
422
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
423 423
 
424
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
425
-			'name'          => esc_html__( 'Give Single Form Sidebar', 'give' ),
424
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
425
+			'name'          => esc_html__('Give Single Form Sidebar', 'give'),
426 426
 			'id'            => 'give-forms-sidebar',
427
-			'description'   => esc_html__( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
427
+			'description'   => esc_html__('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
428 428
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
429 429
 			'after_widget'  => '</div>',
430 430
 			'before_title'  => '<h3 class="widgettitle widget-title">',
431 431
 			'after_title'   => '</h3>',
432
-		) ) );
432
+		)));
433 433
 
434 434
 	}
435 435
 }
436 436
 
437
-add_action( 'widgets_init', 'give_widgets_init', 999 );
437
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -64,50 +64,50 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return bool If the gravatar exists or not
66 66
 	 */
67
-	public function validate_gravatar( $id_or_email ) {
67
+	public function validate_gravatar($id_or_email) {
68 68
 		//id or email code borrowed from wp-includes/pluggable.php
69 69
 		$email = '';
70
-		if ( is_numeric( $id_or_email ) ) {
70
+		if (is_numeric($id_or_email)) {
71 71
 			$id   = (int) $id_or_email;
72
-			$user = get_userdata( $id );
73
-			if ( $user ) {
72
+			$user = get_userdata($id);
73
+			if ($user) {
74 74
 				$email = $user->user_email;
75 75
 			}
76
-		} elseif ( is_object( $id_or_email ) ) {
76
+		} elseif (is_object($id_or_email)) {
77 77
 			// No avatar for pingbacks or trackbacks
78
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
79
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
78
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
79
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
80 80
 				return false;
81 81
 			}
82 82
 
83
-			if ( ! empty( $id_or_email->user_id ) ) {
83
+			if ( ! empty($id_or_email->user_id)) {
84 84
 				$id   = (int) $id_or_email->user_id;
85
-				$user = get_userdata( $id );
86
-				if ( $user ) {
85
+				$user = get_userdata($id);
86
+				if ($user) {
87 87
 					$email = $user->user_email;
88 88
 				}
89
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
89
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
90 90
 				$email = $id_or_email->comment_author_email;
91 91
 			}
92 92
 		} else {
93 93
 			$email = $id_or_email;
94 94
 		}
95 95
 
96
-		$hashkey = md5( strtolower( trim( $email ) ) );
97
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
96
+		$hashkey = md5(strtolower(trim($email)));
97
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
98 98
 
99
-		$data = wp_cache_get( $hashkey );
100
-		if ( false === $data ) {
101
-			$response = wp_remote_head( $uri );
102
-			if ( is_wp_error( $response ) ) {
99
+		$data = wp_cache_get($hashkey);
100
+		if (false === $data) {
101
+			$response = wp_remote_head($uri);
102
+			if (is_wp_error($response)) {
103 103
 				$data = 'not200';
104 104
 			} else {
105 105
 				$data = $response['response']['code'];
106 106
 			}
107
-			wp_cache_set( $hashkey, $data, $group = '', $expire = 60 * 5 );
107
+			wp_cache_set($hashkey, $data, $group = '', $expire = 60 * 5);
108 108
 
109 109
 		}
110
-		if ( $data == '200' ) {
110
+		if ($data == '200') {
111 111
 			return true;
112 112
 		} else {
113 113
 			return false;
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return array        IDs if logs, false otherwise
126 126
 	 */
127
-	public function get_log_ids( $form_id = '' ) {
127
+	public function get_log_ids($form_id = '') {
128 128
 
129 129
 		// get Give_Logging class
130 130
 		global $give_logs;
131 131
 
132 132
 		// get log for this form
133
-		$logs = $give_logs->get_logs( $form_id );
133
+		$logs = $give_logs->get_logs($form_id);
134 134
 
135
-		if ( $logs ) {
135
+		if ($logs) {
136 136
 			// make an array with all the donor IDs
137
-			foreach ( $logs as $log ) {
137
+			foreach ($logs as $log) {
138 138
 				$log_ids[] = $log->ID;
139 139
 			}
140 140
 
@@ -155,49 +155,49 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @return mixed
157 157
 	 */
158
-	public function get_payment_ids( $form_id = '' ) {
158
+	public function get_payment_ids($form_id = '') {
159 159
 
160 160
 		global $give_options;
161 161
 
162
-		$log_ids = $this->get_log_ids( $form_id );
162
+		$log_ids = $this->get_log_ids($form_id);
163 163
 
164
-		if ( $log_ids ) {
164
+		if ($log_ids) {
165 165
 
166 166
 			$payment_ids = array();
167 167
 
168
-			foreach ( $log_ids as $id ) {
168
+			foreach ($log_ids as $id) {
169 169
 				// get the payment ID for each corresponding log ID
170
-				$payment_ids[] = get_post_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = get_post_meta($id, '_give_log_payment_id', true);
171 171
 			}
172 172
 
173 173
 			// remove donors who have purchased more than once so we can have unique avatars
174 174
 			$unique_emails = array();
175 175
 
176
-			foreach ( $payment_ids as $key => $id ) {
176
+			foreach ($payment_ids as $key => $id) {
177 177
 
178
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
178
+				$email = get_post_meta($id, '_give_payment_user_email', true);
179 179
 
180
-				if ( isset ( $give_options['give_donators_gravatars_has_gravatar_account'] ) ) {
181
-					if ( ! $this->validate_gravatar( $email ) ) {
180
+				if (isset ($give_options['give_donators_gravatars_has_gravatar_account'])) {
181
+					if ( ! $this->validate_gravatar($email)) {
182 182
 						continue;
183 183
 					}
184 184
 				}
185 185
 
186
-				$unique_emails[ $id ] = get_post_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = get_post_meta($id, '_give_payment_user_email', true);
187 187
 
188 188
 			}
189 189
 
190 190
 			// strip duplicate emails
191
-			$unique_emails = array_unique( $unique_emails );
191
+			$unique_emails = array_unique($unique_emails);
192 192
 
193 193
 			// convert the unique IDs back into simple array
194
-			foreach ( $unique_emails as $id => $email ) {
194
+			foreach ($unique_emails as $id => $email) {
195 195
 				$unique_ids[] = $id;
196 196
 			}
197 197
 
198 198
 			// randomize the payment IDs if enabled
199
-			if ( isset( $give_options['give_donators_gravatars_random_gravatars'] ) ) {
200
-				shuffle( $unique_ids );
199
+			if (isset($give_options['give_donators_gravatars_random_gravatars'])) {
200
+				shuffle($unique_ids);
201 201
 			}
202 202
 
203 203
 			// return our unique IDs
@@ -218,22 +218,22 @@  discard block
 block discarded – undo
218 218
 	 *
219 219
 	 * @return string
220 220
 	 */
221
-	public function gravatars( $form_id = false, $title = '' ) {
221
+	public function gravatars($form_id = false, $title = '') {
222 222
 
223 223
 		// unique $payment_ids 
224
-		$payment_ids = $this->get_payment_ids( $form_id );
224
+		$payment_ids = $this->get_payment_ids($form_id);
225 225
 
226 226
 		global $give_options;
227 227
 
228 228
 		// return if no ID
229
-		if ( ! $form_id ) {
229
+		if ( ! $form_id) {
230 230
 			return;
231 231
 		}
232 232
 
233 233
 		// minimum amount of purchases before showing gravatars
234 234
 		// if the number of items in array is not greater or equal to the number specified, then exit
235
-		if ( isset( $give_options['give_donators_gravatars_min_purchases_required'] ) && '' != $give_options['give_donators_gravatars_min_purchases_required'] ) {
236
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donators_gravatars_min_purchases_required'] ) ) {
235
+		if (isset($give_options['give_donators_gravatars_min_purchases_required']) && '' != $give_options['give_donators_gravatars_min_purchases_required']) {
236
+			if ( ! (count($payment_ids) >= $give_options['give_donators_gravatars_min_purchases_required'])) {
237 237
 				return;
238 238
 			}
239 239
 		}
@@ -244,51 +244,51 @@  discard block
 block discarded – undo
244 244
 		echo '<div id="give-purchase-gravatars">';
245 245
 
246 246
 
247
-		if ( isset ( $title ) ) {
247
+		if (isset ($title)) {
248 248
 
249
-			if ( $title ) {
250
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' );
251
-			} elseif ( isset( $give_options['give_donators_gravatars_heading'] ) ) {
252
-				echo apply_filters( 'give_donators_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donators_gravatars_heading'] ) . '</h2>' );
249
+			if ($title) {
250
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>');
251
+			} elseif (isset($give_options['give_donators_gravatars_heading'])) {
252
+				echo apply_filters('give_donators_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donators_gravatars_heading']).'</h2>');
253 253
 			}
254 254
 
255 255
 		}
256 256
 		echo '<ul class="give-purchase-gravatars-list">';
257 257
 		$i = 0;
258 258
 
259
-		if ( $payment_ids ) {
260
-			foreach ( $payment_ids as $id ) {
259
+		if ($payment_ids) {
260
+			foreach ($payment_ids as $id) {
261 261
 
262 262
 				// Give saves a blank option even when the control is turned off, hence the extra check
263
-				if ( isset( $give_options['give_donators_gravatars_maximum_number'] ) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number'] ) {
263
+				if (isset($give_options['give_donators_gravatars_maximum_number']) && '' != $give_options['give_donators_gravatars_maximum_number'] && $i == $give_options['give_donators_gravatars_maximum_number']) {
264 264
 					continue;
265 265
 				}
266 266
 
267 267
 				// get the payment meta
268
-				$payment_meta = get_post_meta( $id, '_give_payment_meta', true );
268
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
269 269
 
270 270
 				// unserialize the payment meta
271
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
271
+				$user_info = maybe_unserialize($payment_meta['user_info']);
272 272
 
273 273
 				// get donor's first name
274 274
 				$name = $user_info['first_name'];
275 275
 
276 276
 				// get donor's email
277
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
277
+				$email = get_post_meta($id, '_give_payment_user_email', true);
278 278
 
279 279
 				// set gravatar size and provide filter
280
-				$size = isset( $give_options['give_donators_gravatars_gravatar_size'] ) ? apply_filters( 'give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size'] ) : '';
280
+				$size = isset($give_options['give_donators_gravatars_gravatar_size']) ? apply_filters('give_donators_gravatars_gravatar_size', $give_options['give_donators_gravatars_gravatar_size']) : '';
281 281
 
282 282
 				// default image
283
-				$default_image = apply_filters( 'give_donators_gravatars_gravatar_default_image', false );
283
+				$default_image = apply_filters('give_donators_gravatars_gravatar_default_image', false);
284 284
 
285 285
 				// assemble output
286 286
 				$output .= '<li>';
287 287
 
288
-				$output .= get_avatar( $email, $size, $default_image, $name );
288
+				$output .= get_avatar($email, $size, $default_image, $name);
289 289
 				$output .= '</li>';
290 290
 
291
-				$i ++;
291
+				$i++;
292 292
 
293 293
 			} // end foreach
294 294
 		}
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 		echo '</ul>';
298 298
 		echo '</div>';
299 299
 
300
-		return apply_filters( 'give_donators_gravatars', ob_get_clean() );
300
+		return apply_filters('give_donators_gravatars', ob_get_clean());
301 301
 	}
302 302
 
303 303
 	/**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return void
310 310
 	 */
311 311
 	public function register_widget() {
312
-		register_widget( 'Give_Donators_Gravatars_Widget' );
312
+		register_widget('Give_Donators_Gravatars_Widget');
313 313
 	}
314 314
 
315 315
 	/**
@@ -325,19 +325,19 @@  discard block
 block discarded – undo
325 325
 	 *
326 326
 	 * @todo   Set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
327 327
 	 */
328
-	public function shortcode( $atts, $content = null ) {
328
+	public function shortcode($atts, $content = null) {
329 329
 
330
-		$atts = shortcode_atts( array(
330
+		$atts = shortcode_atts(array(
331 331
 			'id'    => '',
332 332
 			'title' => ''
333
-		), $atts, 'give_donators_gravatars' );
333
+		), $atts, 'give_donators_gravatars');
334 334
 
335 335
 		// if no ID is passed on single give_forms pages, get the correct ID
336
-		if ( is_singular( 'give_forms' ) ) {
336
+		if (is_singular('give_forms')) {
337 337
 			$id = get_the_ID();
338 338
 		}
339 339
 
340
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
340
+		$content = $this->gravatars($atts['id'], $atts['title']);
341 341
 
342 342
 		return $content;
343 343
 
@@ -353,57 +353,57 @@  discard block
 block discarded – undo
353 353
 	 *
354 354
 	 * @return array           Gravatar settings.
355 355
 	 */
356
-	public function settings( $settings ) {
356
+	public function settings($settings) {
357 357
 
358 358
 		$give_gravatar_settings = array(
359 359
 			array(
360
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
360
+				'name' => esc_html__('Donator Gravatars', 'give'),
361 361
 				'desc' => '<hr>',
362 362
 				'id'   => 'give_title',
363 363
 				'type' => 'give_title'
364 364
 			),
365 365
 			array(
366
-				'name' => esc_html__( 'Heading', 'give' ),
367
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
366
+				'name' => esc_html__('Heading', 'give'),
367
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
368 368
 				'type' => 'text',
369 369
 				'id'   => 'give_donators_gravatars_heading'
370 370
 			),
371 371
 			array(
372
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
373
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
372
+				'name'    => esc_html__('Gravatar Size', 'give'),
373
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
374 374
 				'type'    => 'text_small',
375 375
 				'id'      => 'give_donators_gravatars_gravatar_size',
376 376
 				'default' => '64'
377 377
 			),
378 378
 			array(
379
-				'name' => esc_html__( 'Minimum Unique Purchases Required', 'give' ),
379
+				'name' => esc_html__('Minimum Unique Purchases Required', 'give'),
380 380
 				/* translators: %s: form singular label */
381
-				'desc' => sprintf( esc_html__( 'The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ), strtolower( give_get_forms_label_singular() ) ),
381
+				'desc' => sprintf(esc_html__('The minimum number of unique purchases a %s must have before the Gravatars are shown. Leave blank for no minimum.', 'give'), strtolower(give_get_forms_label_singular())),
382 382
 				'type' => 'text_small',
383 383
 				'id'   => 'give_donators_gravatars_min_purchases_required',
384 384
 			),
385 385
 			array(
386
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
387
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
386
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
387
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
388 388
 				'type'    => 'text',
389 389
 				'id'      => 'give_donators_gravatars_maximum_number',
390 390
 				'default' => '20',
391 391
 			),
392 392
 			array(
393
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
394
-				'desc' => esc_html__( 'Show only donators with a Gravatar account.', 'give' ),
393
+				'name' => esc_html__('Gravatar Visibility', 'give'),
394
+				'desc' => esc_html__('Show only donators with a Gravatar account.', 'give'),
395 395
 				'id'   => 'give_donators_gravatars_has_gravatar_account',
396 396
 				'type' => 'checkbox',
397 397
 			),
398 398
 			array(
399
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
400
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
399
+				'name' => esc_html__('Randomize Gravatars', 'give'),
400
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
401 401
 				'id'   => 'give_donators_gravatars_random_gravatars',
402 402
 				'type' => 'checkbox',
403 403
 			),
404 404
 		);
405 405
 
406
-		return array_merge( $settings, $give_gravatar_settings );
406
+		return array_merge($settings, $give_gravatar_settings);
407 407
 	}
408 408
 
409 409
 }
@@ -428,13 +428,13 @@  discard block
 block discarded – undo
428 428
 	 */
429 429
 	public function __construct() {
430 430
 
431
-		$give_label_singular = function_exists( 'give_get_forms_label_singular' ) ? strtolower( give_get_forms_label_singular() ) : null;
431
+		$give_label_singular = function_exists('give_get_forms_label_singular') ? strtolower(give_get_forms_label_singular()) : null;
432 432
 
433 433
 		// widget settings
434 434
 		$widget_ops = array(
435 435
 			'classname'   => 'give-donators-gravatars',
436 436
 			/* translators: 1: form singular label 2: form singular label */
437
-			'description' => sprintf( esc_html__( 'Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give' ), $give_label_singular, $give_label_singular )
437
+			'description' => sprintf(esc_html__('Displays gravatars of people who have donated using your your %1$s. Will only show on the single %2$s page.', 'give'), $give_label_singular, $give_label_singular)
438 438
 		);
439 439
 
440 440
 		// widget control settings
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 		// create the widget
448 448
 		parent::__construct(
449 449
 			'give_donators_gravatars_widget',
450
-			esc_html__( 'Give Donators Gravatars', 'give' ),
450
+			esc_html__('Give Donators Gravatars', 'give'),
451 451
 			$widget_ops,
452 452
 			$control_ops
453 453
 		);
@@ -467,30 +467,30 @@  discard block
 block discarded – undo
467 467
 	 *
468 468
 	 * @return void
469 469
 	 */
470
-	public function widget( $args, $instance ) {
470
+	public function widget($args, $instance) {
471 471
 		global $give_options;
472 472
 
473 473
 		//@TODO: Don't extract it!!!
474
-		extract( $args );
474
+		extract($args);
475 475
 
476
-		if ( ! is_singular( 'give_forms' ) ) {
476
+		if ( ! is_singular('give_forms')) {
477 477
 			return;
478 478
 		}
479 479
 
480 480
 		// Variables from widget settings
481
-		$title = apply_filters( 'widget_title', $instance['title'] );
481
+		$title = apply_filters('widget_title', $instance['title']);
482 482
 
483 483
 		// Used by themes. Opens the widget
484 484
 		echo $before_widget;
485 485
 
486 486
 		// Display the widget title
487
-		if ( $title ) {
488
-			echo $before_title . $title . $after_title;
487
+		if ($title) {
488
+			echo $before_title.$title.$after_title;
489 489
 		}
490 490
 
491 491
 		$gravatars = new Give_Donators_Gravatars();
492 492
 
493
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
493
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
494 494
 
495 495
 		// Used by themes. Closes the widget
496 496
 		echo $after_widget;
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 *
511 511
 	 * @return array Updated settings to save.
512 512
 	 */
513
-	public function update( $new_instance, $old_instance ) {
513
+	public function update($new_instance, $old_instance) {
514 514
 
515 515
 		$instance = $old_instance;
516 516
 
517
-		$instance['title'] = strip_tags( $new_instance['title'] );
517
+		$instance['title'] = strip_tags($new_instance['title']);
518 518
 
519 519
 		return $instance;
520 520
 
@@ -532,19 +532,19 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return void
534 534
 	 */
535
-	public function form( $instance ) {
535
+	public function form($instance) {
536 536
 
537 537
 		// Set up some default widget settings.
538 538
 		$defaults = array(
539 539
 			'title' => '',
540 540
 		);
541 541
 
542
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
542
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
543 543
 
544 544
 		<!-- Title -->
545 545
 		<p>
546
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
547
-			<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $instance['title']; ?>" />
546
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
547
+			<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $instance['title']; ?>" />
548 548
 		</p>
549 549
 
550 550
 		<?php
Please login to merge, or discard this patch.