Test Failed
Push — master ( 7af02d...c58786 )
by Devin
04:53
created
includes/admin/tools/data/class-give-tools-reset-stats.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
 	public function get_data() {
59 59
 		global $wpdb;
60 60
 
61
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
61
+		$items = $this->get_stored_data('give_temp_reset_ids');
62 62
 
63
-		if ( ! is_array( $items ) ) {
63
+		if ( ! is_array($items)) {
64 64
 			return false;
65 65
 		}
66 66
 
67
-		$offset     = ( $this->step - 1 ) * $this->per_step;
68
-		$step_items = array_slice( $items, $offset, $this->per_step );
67
+		$offset     = ($this->step - 1) * $this->per_step;
68
+		$step_items = array_slice($items, $offset, $this->per_step);
69 69
 
70
-		if ( $step_items ) {
70
+		if ($step_items) {
71 71
 
72 72
 			$step_ids = array(
73 73
 				'customers' => array(),
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 				'other'     => array(),
76 76
 			);
77 77
 
78
-			foreach ( $step_items as $item ) {
78
+			foreach ($step_items as $item) {
79 79
 
80
-				switch ( $item['type'] ) {
80
+				switch ($item['type']) {
81 81
 					case 'customer':
82 82
 						$step_ids['customers'][] = $item['id'];
83 83
 						break;
@@ -85,26 +85,26 @@  discard block
 block discarded – undo
85 85
 						$step_ids['give_forms'][] = $item['id'];
86 86
 						break;
87 87
 					default:
88
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
89
-						$step_ids[ $item_type ][] = $item['id'];
88
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
89
+						$step_ids[$item_type][] = $item['id'];
90 90
 						break;
91 91
 				}
92 92
 			}
93 93
 
94 94
 			$sql = array();
95 95
 
96
-			foreach ( $step_ids as $type => $ids ) {
96
+			foreach ($step_ids as $type => $ids) {
97 97
 
98
-				if ( empty( $ids ) ) {
98
+				if (empty($ids)) {
99 99
 					continue;
100 100
 				}
101 101
 
102
-				$ids = implode( ',', $ids );
102
+				$ids = implode(',', $ids);
103 103
 
104
-				switch ( $type ) {
104
+				switch ($type) {
105 105
 					case 'customers':
106
-						$table_name = $wpdb->prefix . 'give_customers';
107
-						$meta_table_name = $wpdb->prefix . 'give_customermeta';
106
+						$table_name = $wpdb->prefix.'give_customers';
107
+						$meta_table_name = $wpdb->prefix.'give_customermeta';
108 108
 						$sql[]      = "DELETE FROM $table_name WHERE id IN ($ids)";
109 109
 						$sql[]      = "DELETE FROM $meta_table_name WHERE customer_id IN ($ids)";
110 110
 						break;
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 						break;
121 121
 				}
122 122
 
123
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
123
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
124 124
 					// Allows other types of custom post types to filter on their own post_type
125 125
 					// and add items to the query list, for the IDs found in their post type.
126
-					$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
126
+					$sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids);
127 127
 				}
128 128
 			}
129 129
 
130
-			if ( ! empty( $sql ) ) {
131
-				foreach ( $sql as $query ) {
132
-					$wpdb->query( $query );
130
+			if ( ! empty($sql)) {
131
+				foreach ($sql as $query) {
132
+					$wpdb->query($query);
133 133
 				}
134 134
 			}
135 135
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function get_percentage_complete() {
151 151
 
152
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
153
-		$total = count( $items );
152
+		$items = $this->get_stored_data('give_temp_reset_ids');
153
+		$total = count($items);
154 154
 
155 155
 		$percentage = 100;
156 156
 
157
-		if ( $total > 0 ) {
158
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
157
+		if ($total > 0) {
158
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
159 159
 		}
160 160
 
161
-		if ( $percentage > 100 ) {
161
+		if ($percentage > 100) {
162 162
 			$percentage = 100;
163 163
 		}
164 164
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @param array $request The Form Data passed into the batch processing.
174 174
 	 */
175
-	public function set_properties( $request ) {
175
+	public function set_properties($request) {
176 176
 	}
177 177
 
178 178
 	/**
@@ -183,31 +183,31 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function process_step() {
185 185
 
186
-		if ( ! $this->can_export() ) {
187
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array(
186
+		if ( ! $this->can_export()) {
187
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array(
188 188
 				'response' => 403,
189
-			) );
189
+			));
190 190
 		}
191 191
 
192 192
 		$had_data = $this->get_data();
193 193
 
194
-		if ( $had_data ) {
194
+		if ($had_data) {
195 195
 			$this->done = false;
196 196
 
197 197
 			return true;
198 198
 		} else {
199
-			update_option( 'give_earnings_total', 0 );
200
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
199
+			update_option('give_earnings_total', 0);
200
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
201 201
 
202
-			$this->delete_data( 'give_temp_reset_ids' );
202
+			$this->delete_data('give_temp_reset_ids');
203 203
 
204 204
 			// Reset the sequential order numbers
205
-			if ( give_get_option( 'enable_sequential' ) ) {
206
-				delete_option( 'give_last_payment_number' );
205
+			if (give_get_option('enable_sequential')) {
206
+				delete_option('give_last_payment_number');
207 207
 			}
208 208
 
209 209
 			$this->done    = true;
210
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
210
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
211 211
 
212 212
 			return false;
213 213
 		}
@@ -240,26 +240,26 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function pre_fetch() {
242 242
 
243
-		if ( $this->step == 1 ) {
244
-			$this->delete_data( 'give_temp_reset_ids' );
243
+		if ($this->step == 1) {
244
+			$this->delete_data('give_temp_reset_ids');
245 245
 		}
246 246
 
247
-		$items = get_option( 'give_temp_reset_ids', false );
247
+		$items = get_option('give_temp_reset_ids', false);
248 248
 
249
-		if ( false === $items ) {
249
+		if (false === $items) {
250 250
 			$items = array();
251 251
 
252
-			$give_types_for_reset = array( 'give_forms', 'give_payment' );
253
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
252
+			$give_types_for_reset = array('give_forms', 'give_payment');
253
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
254 254
 
255
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
255
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
256 256
 				'post_type'      => $give_types_for_reset,
257 257
 				'post_status'    => 'any',
258
-				'posts_per_page' => - 1,
259
-			) );
258
+				'posts_per_page' => -1,
259
+			));
260 260
 
261
-			$posts = get_posts( $args );
262
-			foreach ( $posts as $post ) {
261
+			$posts = get_posts($args);
262
+			foreach ($posts as $post) {
263 263
 				$items[] = array(
264 264
 					'id'   => (int) $post->ID,
265 265
 					'type' => $post->post_type,
@@ -267,10 +267,10 @@  discard block
 block discarded – undo
267 267
 			}
268 268
 
269 269
 			$donor_args = array(
270
-				'number' => - 1,
270
+				'number' => -1,
271 271
 			);
272
-			$donors     = Give()->donors->get_donors( $donor_args );
273
-			foreach ( $donors as $donor ) {
272
+			$donors     = Give()->donors->get_donors($donor_args);
273
+			foreach ($donors as $donor) {
274 274
 				$items[] = array(
275 275
 					'id'   => (int) $donor->id,
276 276
 					'type' => 'customer',
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
 
280 280
 			// Allow filtering of items to remove with an unassociative array for each item
281 281
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
282
-			$items = apply_filters( 'give_reset_items', $items );
282
+			$items = apply_filters('give_reset_items', $items);
283 283
 
284
-			$this->store_data( 'give_temp_reset_ids', $items );
284
+			$this->store_data('give_temp_reset_ids', $items);
285 285
 		}// End if().
286 286
 
287 287
 	}
@@ -295,17 +295,17 @@  discard block
 block discarded – undo
295 295
 	 *
296 296
 	 * @return mixed       Returns the data from the database.
297 297
 	 */
298
-	private function get_stored_data( $key ) {
298
+	private function get_stored_data($key) {
299 299
 		global $wpdb;
300
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
300
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
301 301
 
302
-		if ( empty( $value ) ) {
302
+		if (empty($value)) {
303 303
 			return false;
304 304
 		}
305 305
 
306
-		$maybe_json = json_decode( $value );
307
-		if ( ! is_null( $maybe_json ) ) {
308
-			$value = json_decode( $value, true );
306
+		$maybe_json = json_decode($value);
307
+		if ( ! is_null($maybe_json)) {
308
+			$value = json_decode($value, true);
309 309
 		}
310 310
 
311 311
 		return $value;
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return void
323 323
 	 */
324
-	private function store_data( $key, $value ) {
324
+	private function store_data($key, $value) {
325 325
 		global $wpdb;
326 326
 
327
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
327
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
328 328
 
329 329
 		$data = array(
330 330
 			'option_name'  => $key,
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 			'%s',
339 339
 		);
340 340
 
341
-		$wpdb->replace( $wpdb->options, $data, $formats );
341
+		$wpdb->replace($wpdb->options, $data, $formats);
342 342
 	}
343 343
 
344 344
 	/**
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @return void
352 352
 	 */
353
-	private function delete_data( $key ) {
353
+	private function delete_data($key) {
354 354
 		global $wpdb;
355
-		$wpdb->delete( $wpdb->options, array(
355
+		$wpdb->delete($wpdb->options, array(
356 356
 			'option_name' => $key,
357
-		) );
357
+		));
358 358
 	}
359 359
 
360 360
 }
361 361
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-delete-test-transactions.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 	 * @return array|bool $data The data for the CSV file
54 54
 	 */
55 55
 	public function get_data() {
56
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids' );
56
+		$items = $this->get_stored_data('give_temp_delete_test_ids');
57 57
 
58
-		if ( ! is_array( $items ) ) {
58
+		if ( ! is_array($items)) {
59 59
 			return false;
60 60
 		}
61 61
 
62
-		$offset     = ( $this->step - 1 ) * $this->per_step;
63
-		$step_items = array_slice( $items, $offset, $this->per_step );
62
+		$offset     = ($this->step - 1) * $this->per_step;
63
+		$step_items = array_slice($items, $offset, $this->per_step);
64 64
 
65
-		if ( $step_items ) {
66
-			foreach ( $step_items as $item ) {
65
+		if ($step_items) {
66
+			foreach ($step_items as $item) {
67 67
 				// Delete the main payment.
68
-				give_delete_donation( absint( $item['id'] ) );
68
+				give_delete_donation(absint($item['id']));
69 69
 			}
70 70
 			return true;
71 71
 		}
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function get_percentage_complete() {
83 83
 
84
-		$items = $this->get_stored_data( 'give_temp_delete_test_ids', false );
85
-		$total = count( $items );
84
+		$items = $this->get_stored_data('give_temp_delete_test_ids', false);
85
+		$total = count($items);
86 86
 
87 87
 		$percentage = 100;
88 88
 
89
-		if ( $total > 0 ) {
90
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
89
+		if ($total > 0) {
90
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
91 91
 		}
92 92
 
93
-		if ( $percentage > 100 ) {
93
+		if ($percentage > 100) {
94 94
 			$percentage = 100;
95 95
 		}
96 96
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @param array $request The Form Data passed into the batch processing
106 106
 	 */
107
-	public function set_properties( $request ) {
107
+	public function set_properties($request) {
108 108
 	}
109 109
 
110 110
 	/**
@@ -115,29 +115,29 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function process_step() {
117 117
 
118
-		if ( ! $this->can_export() ) {
119
-			wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
118
+		if ( ! $this->can_export()) {
119
+			wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403));
120 120
 		}
121 121
 
122 122
 		$had_data = $this->get_data();
123 123
 
124
-		if ( $had_data ) {
124
+		if ($had_data) {
125 125
 			$this->done = false;
126 126
 
127 127
 			return true;
128 128
 		} else {
129
-			update_option( 'give_earnings_total', give_get_total_earnings( true ) );
130
-			Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
129
+			update_option('give_earnings_total', give_get_total_earnings(true));
130
+			Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
131 131
 
132
-			$this->delete_data( 'give_temp_delete_test_ids' );
132
+			$this->delete_data('give_temp_delete_test_ids');
133 133
 
134 134
 			// Reset the sequential order numbers
135
-			if ( give_get_option( 'enable_sequential' ) ) {
136
-				delete_option( 'give_last_payment_number' );
135
+			if (give_get_option('enable_sequential')) {
136
+				delete_option('give_last_payment_number');
137 137
 			}
138 138
 
139 139
 			$this->done    = true;
140
-			$this->message = __( 'Test transactions successfully deleted.', 'give' );
140
+			$this->message = __('Test transactions successfully deleted.', 'give');
141 141
 
142 142
 			return false;
143 143
 		}
@@ -170,27 +170,27 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function pre_fetch() {
172 172
 
173
-		if ( $this->step == 1 ) {
174
-			$this->delete_data( 'give_temp_delete_test_ids' );
173
+		if ($this->step == 1) {
174
+			$this->delete_data('give_temp_delete_test_ids');
175 175
 		}
176 176
 
177
-		$items = get_option( 'give_temp_delete_test_ids', false );
177
+		$items = get_option('give_temp_delete_test_ids', false);
178 178
 
179
-		if ( false === $items ) {
179
+		if (false === $items) {
180 180
 			$items = array();
181 181
 
182
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
182
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
183 183
 				'post_status' => 'any',
184
-				'number'      => - 1,
184
+				'number'      => -1,
185 185
 				'meta_key'    => '_give_payment_mode',
186 186
 				'meta_value'  => 'test'
187
-			) );
187
+			));
188 188
 
189
-			$posts    = new Give_Payments_Query( $args );
189
+			$posts    = new Give_Payments_Query($args);
190 190
 			$payments = $posts->get_payments();
191 191
 
192 192
 			/* @var Give_Payment $payment */
193
-			foreach ( $payments as $payment ) {
193
+			foreach ($payments as $payment) {
194 194
 				$items[] = array(
195 195
 					'id'   => (int) $payment->ID,
196 196
 					'type' => 'give_payment',
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 			
200 200
 			// Allow filtering of items to remove with an unassociative array for each item.
201 201
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method.
202
-			$items = apply_filters( 'give_delete_test_items', $items );
202
+			$items = apply_filters('give_delete_test_items', $items);
203 203
 
204
-			$this->store_data( 'give_temp_delete_test_ids', $items );
204
+			$this->store_data('give_temp_delete_test_ids', $items);
205 205
 		}
206 206
 
207 207
 	}
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 	 *
216 216
 	 * @return mixed       Returns the data from the database
217 217
 	 */
218
-	private function get_stored_data( $key ) {
218
+	private function get_stored_data($key) {
219 219
 		global $wpdb;
220
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
220
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
221 221
 
222
-		if ( empty( $value ) ) {
222
+		if (empty($value)) {
223 223
 			return false;
224 224
 		}
225 225
 
226
-		$maybe_json = json_decode( $value );
227
-		if ( ! is_null( $maybe_json ) ) {
228
-			$value = json_decode( $value, true );
226
+		$maybe_json = json_decode($value);
227
+		if ( ! is_null($maybe_json)) {
228
+			$value = json_decode($value, true);
229 229
 		}
230 230
 
231 231
 		return $value;
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @return void
243 243
 	 */
244
-	private function store_data( $key, $value ) {
244
+	private function store_data($key, $value) {
245 245
 		global $wpdb;
246 246
 
247
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
247
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
248 248
 
249 249
 		$data = array(
250 250
 			'option_name'  => $key,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			'%s',
259 259
 		);
260 260
 
261
-		$wpdb->replace( $wpdb->options, $data, $formats );
261
+		$wpdb->replace($wpdb->options, $data, $formats);
262 262
 	}
263 263
 
264 264
 	/**
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return void
272 272
 	 */
273
-	private function delete_data( $key ) {
273
+	private function delete_data($key) {
274 274
 		global $wpdb;
275
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
275
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
276 276
 	}
277 277
 
278 278
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-payments.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => __( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => __( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => __( 'Email', 'give' ),
45
-			'first'     => __( 'First Name', 'give' ),
46
-			'last'      => __( 'Last Name', 'give' ),
47
-			'address1'  => __( 'Address 1', 'give' ),
48
-			'address2'  => __( 'Address 2', 'give' ),
49
-			'city'      => __( 'City', 'give' ),
50
-			'state'     => __( 'State', 'give' ),
51
-			'country'   => __( 'Country', 'give' ),
52
-			'zip'       => __( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => __( 'Form ID', 'give' ),
54
-			'form_name' => __( 'Form Name', 'give' ),
55
-			'amount'    => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')',
56
-			'gateway'   => __( 'Payment Method', 'give' ),
57
-			'trans_id'  => __( 'Transaction ID', 'give' ),
58
-			'key'       => __( 'Key', 'give' ),
59
-			'date'      => __( 'Date', 'give' ),
60
-			'user'      => __( 'User', 'give' ),
61
-			'status'    => __( 'Status', 'give' )
42
+			'id'        => __('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => __('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => __('Email', 'give'),
45
+			'first'     => __('First Name', 'give'),
46
+			'last'      => __('Last Name', 'give'),
47
+			'address1'  => __('Address 1', 'give'),
48
+			'address2'  => __('Address 2', 'give'),
49
+			'city'      => __('City', 'give'),
50
+			'state'     => __('State', 'give'),
51
+			'country'   => __('Country', 'give'),
52
+			'zip'       => __('Zip / Postal Code', 'give'),
53
+			'form_id'   => __('Form ID', 'give'),
54
+			'form_name' => __('Form Name', 'give'),
55
+			'amount'    => __('Amount', 'give').' ('.give_currency_symbol('', true).')',
56
+			'gateway'   => __('Payment Method', 'give'),
57
+			'trans_id'  => __('Transaction ID', 'give'),
58
+			'key'       => __('Key', 'give'),
59
+			'date'      => __('Date', 'give'),
60
+			'user'      => __('User', 'give'),
61
+			'status'    => __('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			'status' => $this->status
87 87
 		);
88 88
 
89
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
89
+		if ( ! empty($this->start) || ! empty($this->end)) {
90 90
 
91 91
 			$args['date_query'] = array(
92 92
 				array(
93
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
94
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
93
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
94
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
95 95
 					'inclusive' => true
96 96
 				)
97 97
 			);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 
101 101
 		// Add category or tag to payment query if any.
102
-		if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) {
102
+		if ( ! empty($this->categories) || ! empty($this->tags)) {
103 103
 			$form_args = array(
104 104
 				'post_type'      => 'give_forms',
105 105
 				'post_status'    => 'publish',
106
-				'posts_per_page' => - 1,
106
+				'posts_per_page' => -1,
107 107
 				'fields'         => 'ids',
108 108
 				'tax_query'      => array(
109 109
 					'relation' => 'AND',
@@ -111,72 +111,72 @@  discard block
 block discarded – undo
111 111
 			);
112 112
 
113 113
 
114
-			if ( ! empty( $this->categories ) ) {
114
+			if ( ! empty($this->categories)) {
115 115
 				$form_args['tax_query'][] = array(
116 116
 					'taxonomy' => 'give_forms_category',
117 117
 					'terms'    => $this->categories,
118 118
 				);
119 119
 			}
120 120
 
121
-			if ( ! empty( $this->tags ) ) {
121
+			if ( ! empty($this->tags)) {
122 122
 				$form_args['tax_query'][] = array(
123 123
 					'taxonomy' => 'give_forms_tag',
124 124
 					'terms'    => $this->tags,
125 125
 				);
126 126
 			}
127 127
 
128
-			$forms = new WP_Query( $form_args );
128
+			$forms = new WP_Query($form_args);
129 129
 
130
-			if ( empty( $forms->posts ) ) {
130
+			if (empty($forms->posts)) {
131 131
 				return array();
132 132
 			}
133 133
 
134 134
 			$args['give_forms'] = $forms->posts;
135 135
 		}
136 136
 
137
-		$payments = give_get_payments( $args );
137
+		$payments = give_get_payments($args);
138 138
 
139
-		if ( $payments ) {
139
+		if ($payments) {
140 140
 
141
-			foreach ( $payments as $payment ) {
142
-				$payment_meta = give_get_payment_meta( $payment->ID );
143
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
144
-				$total        = give_donation_amount( $payment->ID, array( 'type' => 'stats' ) );
145
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
141
+			foreach ($payments as $payment) {
142
+				$payment_meta = give_get_payment_meta($payment->ID);
143
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
144
+				$total        = give_donation_amount($payment->ID, array('type' => 'stats'));
145
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
146 146
 
147
-				if ( is_numeric( $user_id ) ) {
148
-					$user = get_userdata( $user_id );
147
+				if (is_numeric($user_id)) {
148
+					$user = get_userdata($user_id);
149 149
 				} else {
150 150
 					$user = false;
151 151
 				}
152 152
 
153 153
 				$data[] = array(
154 154
 					'id'        => $payment->ID,
155
-					'seq_id'    => give_get_payment_number( $payment->ID ),
155
+					'seq_id'    => give_get_payment_number($payment->ID),
156 156
 					'email'     => $payment_meta['email'],
157 157
 					'first'     => $user_info['first_name'],
158 158
 					'last'      => $user_info['last_name'],
159
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
160
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
161
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
162
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
163
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
164
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
165
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
166
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
167
-					'amount'    => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ),
168
-					'gateway'   => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ),
169
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
159
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
160
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
161
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
162
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
163
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
164
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
165
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
166
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
167
+					'amount'    => html_entity_decode(give_format_amount($total, array('sanitize' => false))),
168
+					'gateway'   => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)),
169
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
170 170
 					'key'       => $payment_meta['key'],
171 171
 					'date'      => $payment->post_date,
172
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
173
-					'status'    => give_get_payment_status( $payment, true )
172
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
173
+					'status'    => give_get_payment_status($payment, true)
174 174
 				);
175 175
 
176 176
 			}
177 177
 
178
-			$data = apply_filters( 'give_export_get_data', $data );
179
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
178
+			$data = apply_filters('give_export_get_data', $data);
179
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
180 180
 
181 181
 			return $data;
182 182
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$status = $this->status;
198 198
 		$args   = array(
199
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
200
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
199
+			'start-date' => date('n/d/Y', strtotime($this->start)),
200
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
201 201
 		);
202 202
 
203
-		if ( 'any' == $status ) {
203
+		if ('any' == $status) {
204 204
 
205
-			$total = array_sum( (array) give_count_payments( $args ) );
205
+			$total = array_sum((array) give_count_payments($args));
206 206
 
207 207
 		} else {
208 208
 
209
-			$total = give_count_payments( $args )->$status;
209
+			$total = give_count_payments($args)->$status;
210 210
 
211 211
 		}
212 212
 
213 213
 		$percentage = 100;
214 214
 
215
-		if ( $total > 0 ) {
216
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
215
+		if ($total > 0) {
216
+			$percentage = ((30 * $this->step) / $total) * 100;
217 217
 		}
218 218
 
219
-		if ( $percentage > 100 ) {
219
+		if ($percentage > 100) {
220 220
 			$percentage = 100;
221 221
 		}
222 222
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param array $request The Form Data passed into the batch processing.
232 232
 	 */
233
-	public function set_properties( $request ) {
234
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
235
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
236
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
237
-		$this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array();
238
-		$this->tags       = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array();
233
+	public function set_properties($request) {
234
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
235
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
236
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
237
+		$this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array();
238
+		$this->tags       = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array();
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly..
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,134 +25,134 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 
61 61
 	if (
62
-		file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) &&
62
+		file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') &&
63 63
 
64 64
 		// RIAL exist for backward compatibility.
65
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
65
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
66 66
 	) {
67
-		TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' );
67
+		TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', '');
68 68
 		$custom_font = 'CODE2000';
69 69
 		$font_style  = 'B';
70 70
 	}
71 71
 
72
-	$pdf->AddPage( 'L', 'A4' );
73
-	$pdf->setImageScale( 1.5 );
74
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
75
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
76
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
72
+	$pdf->AddPage('L', 'A4');
73
+	$pdf->setImageScale(1.5);
74
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
75
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
76
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
77 77
 
78
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
78
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
79 79
 
80
-	$pdf->SetMargins( 8, 8, 8 );
81
-	$pdf->SetX( 8 );
80
+	$pdf->SetMargins(8, 8, 8);
81
+	$pdf->SetX(8);
82 82
 
83
-	$pdf->SetFont( $default_font, '', 16 );
84
-	$pdf->SetTextColor( 50, 50, 50 );
85
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
83
+	$pdf->SetFont($default_font, '', 16);
84
+	$pdf->SetTextColor(50, 50, 50);
85
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
86 86
 
87
-	$pdf->SetFont( $default_font, '', 13 );
88
-	$pdf->SetTextColor( 150, 150, 150 );
89
-	$pdf->Ln( 1 );
90
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
87
+	$pdf->SetFont($default_font, '', 13);
88
+	$pdf->SetTextColor(150, 150, 150);
89
+	$pdf->Ln(1);
90
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
91 91
 	$pdf->Ln();
92
-	$pdf->SetTextColor( 50, 50, 50 );
93
-	$pdf->SetFont( $default_font, '', 14 );
94
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
95
-	$pdf->SetFont( $default_font, '', 12 );
92
+	$pdf->SetTextColor(50, 50, 50);
93
+	$pdf->SetFont($default_font, '', 14);
94
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
95
+	$pdf->SetFont($default_font, '', 12);
96 96
 
97
-	$pdf->SetFillColor( 238, 238, 238 );
98
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
99
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
100
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
97
+	$pdf->SetFillColor(238, 238, 238);
98
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
99
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
100
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
101 101
 
102 102
 	// Display Categories Heading only, if user has opted for it.
103
-	if ( $categories_enabled ) {
104
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
103
+	if ($categories_enabled) {
104
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
105 105
 	}
106 106
 
107 107
 	// Display Tags Heading only, if user has opted for it.
108
-	if ( $tags_enabled ) {
109
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
108
+	if ($tags_enabled) {
109
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
110 110
 	}
111 111
 
112
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
113
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
112
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
113
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
114 114
 
115 115
 	// Set Custom Font to support various currencies.
116
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
116
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
117 117
 
118
-	$year       = date( 'Y' );
119
-	$give_forms = get_posts( array(
118
+	$year       = date('Y');
119
+	$give_forms = get_posts(array(
120 120
 		'post_type'      => 'give_forms',
121 121
 		'year'           => $year,
122
-		'posts_per_page' => - 1,
122
+		'posts_per_page' => -1,
123 123
 		'supply_filter'  => false,
124
-	) );
124
+	));
125 125
 
126
-	if ( $give_forms ) {
127
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
126
+	if ($give_forms) {
127
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
128 128
 
129
-		foreach ( $give_forms as $form ):
130
-			$pdf->SetFillColor( 255, 255, 255 );
129
+		foreach ($give_forms as $form):
130
+			$pdf->SetFillColor(255, 255, 255);
131 131
 
132 132
 			$title = $form->post_title;
133 133
 
134
-			if ( give_has_variable_prices( $form->ID ) ) {
135
-				$price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' );
134
+			if (give_has_variable_prices($form->ID)) {
135
+				$price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8');
136 136
 			} else {
137
-				$price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) );
137
+				$price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true));
138 138
 			}
139 139
 
140 140
 			// Display Categories Data only, if user has opted for it.
141 141
 			$categories = array();
142
-			if ( $categories_enabled ) {
143
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
144
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
142
+			if ($categories_enabled) {
143
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
144
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
145 145
 			}
146 146
 
147 147
 			// Display Tags Data only, if user has opted for it.
148 148
 			$tags = array();
149
-			if ( $tags_enabled ) {
150
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
151
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
149
+			if ($tags_enabled) {
150
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
151
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
152 152
 			}
153 153
 
154
-			$sales    = give_get_form_sales_stats( $form->ID );
155
-			$earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) );
154
+			$sales    = give_get_form_sales_stats($form->ID);
155
+			$earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), array('decode_currency' => true));
156 156
 
157 157
 			// This will help filter data before appending it to PDF Receipt.
158 158
 			$prepare_pdf_data   = array();
@@ -160,54 +160,54 @@  discard block
 block discarded – undo
160 160
 			$prepare_pdf_data[] = $price;
161 161
 
162 162
 			// Append Categories Data only, if user has opted for it.
163
-			if ( $categories_enabled ) {
163
+			if ($categories_enabled) {
164 164
 				$prepare_pdf_data[] = $categories;
165 165
 			}
166 166
 
167 167
 			// Append Tags Data only, if user has opted for it.
168
-			if ( $tags_enabled ) {
168
+			if ($tags_enabled) {
169 169
 				$prepare_pdf_data[] = $tags;
170 170
 			}
171 171
 
172 172
 			$prepare_pdf_data[] = $sales;
173 173
 			$prepare_pdf_data[] = $earnings;
174 174
 
175
-			$pdf->Row( $prepare_pdf_data );
175
+			$pdf->Row($prepare_pdf_data);
176 176
 
177 177
 		endforeach;
178 178
 	} else {
179 179
 
180 180
 		// Fix: Minor Styling Alignment Issue for PDF.
181
-		if ( $categories_enabled && $tags_enabled ) {
181
+		if ($categories_enabled && $tags_enabled) {
182 182
 			$no_found_width = 280;
183
-		} elseif ( $categories_enabled || $tags_enabled ) {
183
+		} elseif ($categories_enabled || $tags_enabled) {
184 184
 			$no_found_width = 235;
185 185
 		} else {
186 186
 			$no_found_width = 190;
187 187
 		}
188
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
189
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
188
+		$title = utf8_decode(__('No forms found.', 'give'));
189
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
190 190
 	}// End if().
191 191
 	$pdf->Ln();
192
-	$pdf->SetTextColor( 50, 50, 50 );
193
-	$pdf->SetFont( $default_font, '', 14 );
192
+	$pdf->SetTextColor(50, 50, 50);
193
+	$pdf->SetFont($default_font, '', 14);
194 194
 
195 195
 	// Output Graph on a new page.
196
-	$pdf->AddPage( 'L', 'A4' );
197
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
198
-	$pdf->SetFont( $default_font, '', 12 );
196
+	$pdf->AddPage('L', 'A4');
197
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
198
+	$pdf->SetFont($default_font, '', 12);
199 199
 
200
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
201
-	$image = str_replace( ' ', '%20', $image );
200
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
201
+	$image = str_replace(' ', '%20', $image);
202 202
 
203
-	$pdf->SetX( 25 );
204
-	$pdf->Image( $image . '&file=.png' );
205
-	$pdf->Ln( 7 );
206
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
203
+	$pdf->SetX(25);
204
+	$pdf->Image($image.'&file=.png');
205
+	$pdf->Ln(7);
206
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
207 207
 	exit();
208 208
 }
209 209
 
210
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
210
+add_action('give_generate_pdf', 'give_generate_pdf');
211 211
 
212 212
 /**
213 213
  * Draws Chart for PDF Report.
@@ -224,38 +224,38 @@  discard block
 block discarded – undo
224 224
  * @return string $chart->getUrl() URL for the Google Chart
225 225
  */
226 226
 function give_draw_chart_image() {
227
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
228
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
229
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
227
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
228
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
229
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
230 230
 
231
-	$chart = new GoogleChart( 'lc', 900, 330 );
231
+	$chart = new GoogleChart('lc', 900, 330);
232 232
 
233 233
 	$i        = 1;
234 234
 	$earnings = "";
235 235
 	$sales    = "";
236 236
 
237
-	while ( $i <= 12 ) :
238
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
239
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
240
-		$i ++;
237
+	while ($i <= 12) :
238
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
239
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
240
+		$i++;
241 241
 	endwhile;
242 242
 
243
-	$earnings_array = explode( ",", $earnings );
244
-	$sales_array    = explode( ",", $sales );
243
+	$earnings_array = explode(",", $earnings);
244
+	$sales_array    = explode(",", $sales);
245 245
 
246 246
 	$i = 0;
247
-	while ( $i <= 11 ) {
248
-		if ( empty( $sales_array[ $i ] ) ) {
249
-			$sales_array[ $i ] = 0;
247
+	while ($i <= 11) {
248
+		if (empty($sales_array[$i])) {
249
+			$sales_array[$i] = 0;
250 250
 		}
251
-		$i ++;
251
+		$i++;
252 252
 	}
253 253
 
254 254
 	$min_earnings   = 0;
255
-	$max_earnings   = max( $earnings_array );
256
-	$earnings_scale = round( $max_earnings, - 1 );
255
+	$max_earnings   = max($earnings_array);
256
+	$earnings_scale = round($max_earnings, - 1);
257 257
 
258
-	$data = new GoogleChartData( array(
258
+	$data = new GoogleChartData(array(
259 259
 		$earnings_array[0],
260 260
 		$earnings_array[1],
261 261
 		$earnings_array[2],
@@ -268,25 +268,25 @@  discard block
 block discarded – undo
268 268
 		$earnings_array[9],
269 269
 		$earnings_array[10],
270 270
 		$earnings_array[11],
271
-	) );
271
+	));
272 272
 
273
-	$data->setLegend( __( 'Income', 'give' ) );
274
-	$data->setColor( '1b58a3' );
275
-	$chart->addData( $data );
273
+	$data->setLegend(__('Income', 'give'));
274
+	$data->setColor('1b58a3');
275
+	$chart->addData($data);
276 276
 
277
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
278
-	$shape_marker->setColor( '000000' );
279
-	$shape_marker->setSize( 7 );
280
-	$shape_marker->setBorder( 2 );
281
-	$shape_marker->setData( $data );
282
-	$chart->addMarker( $shape_marker );
277
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
278
+	$shape_marker->setColor('000000');
279
+	$shape_marker->setSize(7);
280
+	$shape_marker->setBorder(2);
281
+	$shape_marker->setData($data);
282
+	$chart->addMarker($shape_marker);
283 283
 
284
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
285
-	$value_marker->setColor( '000000' );
286
-	$value_marker->setData( $data );
287
-	$chart->addMarker( $value_marker );
284
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
285
+	$value_marker->setColor('000000');
286
+	$value_marker->setData($data);
287
+	$chart->addMarker($value_marker);
288 288
 
289
-	$data = new GoogleChartData( array(
289
+	$data = new GoogleChartData(array(
290 290
 		$sales_array[0],
291 291
 		$sales_array[1],
292 292
 		$sales_array[2],
@@ -299,46 +299,46 @@  discard block
 block discarded – undo
299 299
 		$sales_array[9],
300 300
 		$sales_array[10],
301 301
 		$sales_array[11],
302
-	) );
303
-	$data->setLegend( __( 'Donations', 'give' ) );
304
-	$data->setColor( 'ff6c1c' );
305
-	$chart->addData( $data );
306
-
307
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
308
-
309
-	$chart->setScale( 0, $max_earnings );
310
-
311
-	$y_axis = new GoogleChartAxis( 'y' );
312
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
313
-	$chart->addAxis( $y_axis );
314
-
315
-	$x_axis = new GoogleChartAxis( 'x' );
316
-	$x_axis->setTickMarks( 5 );
317
-	$x_axis->setLabels( array(
318
-		__( 'Jan', 'give' ),
319
-		__( 'Feb', 'give' ),
320
-		__( 'Mar', 'give' ),
321
-		__( 'Apr', 'give' ),
322
-		__( 'May', 'give' ),
323
-		__( 'June', 'give' ),
324
-		__( 'July', 'give' ),
325
-		__( 'Aug', 'give' ),
326
-		__( 'Sept', 'give' ),
327
-		__( 'Oct', 'give' ),
328
-		__( 'Nov', 'give' ),
329
-		__( 'Dec', 'give' ),
330
-	) );
331
-	$chart->addAxis( $x_axis );
332
-
333
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
334
-	$shape_marker->setSize( 6 );
335
-	$shape_marker->setBorder( 2 );
336
-	$shape_marker->setData( $data );
337
-	$chart->addMarker( $shape_marker );
338
-
339
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
340
-	$value_marker->setData( $data );
341
-	$chart->addMarker( $value_marker );
302
+	));
303
+	$data->setLegend(__('Donations', 'give'));
304
+	$data->setColor('ff6c1c');
305
+	$chart->addData($data);
306
+
307
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
308
+
309
+	$chart->setScale(0, $max_earnings);
310
+
311
+	$y_axis = new GoogleChartAxis('y');
312
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
313
+	$chart->addAxis($y_axis);
314
+
315
+	$x_axis = new GoogleChartAxis('x');
316
+	$x_axis->setTickMarks(5);
317
+	$x_axis->setLabels(array(
318
+		__('Jan', 'give'),
319
+		__('Feb', 'give'),
320
+		__('Mar', 'give'),
321
+		__('Apr', 'give'),
322
+		__('May', 'give'),
323
+		__('June', 'give'),
324
+		__('July', 'give'),
325
+		__('Aug', 'give'),
326
+		__('Sept', 'give'),
327
+		__('Oct', 'give'),
328
+		__('Nov', 'give'),
329
+		__('Dec', 'give'),
330
+	));
331
+	$chart->addAxis($x_axis);
332
+
333
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
334
+	$shape_marker->setSize(6);
335
+	$shape_marker->setBorder(2);
336
+	$shape_marker->setData($data);
337
+	$chart->addMarker($shape_marker);
338
+
339
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
340
+	$value_marker->setData($data);
341
+	$chart->addMarker($value_marker);
342 342
 
343 343
 	return $chart->getUrl();
344 344
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		give_ignore_user_abort();
43 43
 
44 44
 		nocache_headers();
45
-		header( 'Content-Type: application/json; charset=utf-8' );
46
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
47
-		header( 'Expires: 0' );
45
+		header('Content-Type: application/json; charset=utf-8');
46
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
47
+		header('Expires: 0');
48 48
 	}
49 49
 
50 50
 	/**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @since 1.8.17
55 55
 	 */
56 56
 	public function json_core_settings_export() {
57
-		echo wp_json_encode( get_option( 'give_settings' ) );
57
+		echo wp_json_encode(get_option('give_settings'));
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @since  1.8.17
65 65
 	 */
66 66
 	public function export() {
67
-		if ( ! $this->can_export() ) {
68
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
67
+		if ( ! $this->can_export()) {
68
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
69 69
 		}
70 70
 
71 71
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		give_ignore_user_abort();
52 52
 
53 53
 		nocache_headers();
54
-		header( 'Content-Type: text/csv; charset=utf-8' );
55
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
56
-		header( "Expires: 0" );
54
+		header('Content-Type: text/csv; charset=utf-8');
55
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
56
+		header("Expires: 0");
57 57
 	}
58 58
 
59 59
 	/**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public function csv_cols() {
67 67
 		$cols = array(
68
-			'id'   => __( 'ID', 'give' ),
69
-			'date' => __( 'Date', 'give' )
68
+			'id'   => __('ID', 'give'),
69
+			'date' => __('Date', 'give')
70 70
 		);
71 71
 
72 72
 		return $cols;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	public function get_csv_cols() {
83 83
 		$cols = $this->csv_cols();
84 84
 
85
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
85
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
86 86
 	}
87 87
 
88 88
 	/**
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	public function csv_cols_out() {
97 97
 		$cols = $this->get_csv_cols();
98 98
 		$i    = 1;
99
-		foreach ( $cols as $col_id => $column ) {
100
-			echo '"' . addslashes( $column ) . '"';
101
-			echo $i == count( $cols ) ? '' : ',';
102
-			$i ++;
99
+		foreach ($cols as $col_id => $column) {
100
+			echo '"'.addslashes($column).'"';
101
+			echo $i == count($cols) ? '' : ',';
102
+			$i++;
103 103
 		}
104 104
 		echo "\r\n";
105 105
 	}
@@ -116,16 +116,16 @@  discard block
 block discarded – undo
116 116
 		$data = array(
117 117
 			0 => array(
118 118
 				'id'   => '',
119
-				'data' => date( 'F j, Y' )
119
+				'data' => date('F j, Y')
120 120
 			),
121 121
 			1 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			)
125 125
 		);
126 126
 
127
-		$data = apply_filters( 'give_export_get_data', $data );
128
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
127
+		$data = apply_filters('give_export_get_data', $data);
128
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
129 129
 
130 130
 		return $data;
131 131
 	}
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 		$cols = $this->get_csv_cols();
144 144
 
145 145
 		// Output each row
146
-		foreach ( $data as $row ) {
146
+		foreach ($data as $row) {
147 147
 			$i = 1;
148
-			foreach ( $row as $col_id => $column ) {
148
+			foreach ($row as $col_id => $column) {
149 149
 				// Make sure the column is valid
150
-				if ( array_key_exists( $col_id, $cols ) ) {
151
-					echo '"' . addslashes( $column ) . '"';
152
-					echo $i == count( $cols ) ? '' : ',';
153
-					$i ++;
150
+				if (array_key_exists($col_id, $cols)) {
151
+					echo '"'.addslashes($column).'"';
152
+					echo $i == count($cols) ? '' : ',';
153
+					$i++;
154 154
 				}
155 155
 			}
156 156
 			echo "\r\n";
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * @return void
170 170
 	 */
171 171
 	public function export() {
172
-		if ( ! $this->can_export() ) {
173
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
172
+		if ( ! $this->can_export()) {
173
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
174 174
 		}
175 175
 
176 176
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/tools/export/class-export-earnings.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 		give_ignore_user_abort();
42 42
 
43 43
 		nocache_headers();
44
-		header( 'Content-Type: text/csv; charset=utf-8' );
45
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
46
-		header( "Expires: 0" );
44
+		header('Content-Type: text/csv; charset=utf-8');
45
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
46
+		header("Expires: 0");
47 47
 
48 48
 	}
49 49
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	public function csv_cols() {
58 58
 
59 59
 		$cols = array(
60
-			'date'      => __( 'Date', 'give' ),
61
-			'donations' => __( 'Donations', 'give' ),
60
+			'date'      => __('Date', 'give'),
61
+			'donations' => __('Donations', 'give'),
62 62
 			/* translators: %s: currency */
63
-			'earnings'  => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) )
63
+			'earnings'  => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true))
64 64
 		);
65 65
 
66 66
 		return $cols;
@@ -75,28 +75,28 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function get_data() {
77 77
 
78
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
79
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
80
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
81
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
78
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
79
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
80
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
81
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
82 82
 
83 83
 		$data  = array();
84 84
 		$year  = $start_year;
85 85
 		$stats = new Give_Payment_Stats;
86 86
 
87
-		while ( $year <= $end_year ) {
87
+		while ($year <= $end_year) {
88 88
 
89
-			if ( $year == $start_year && $year == $end_year ) {
89
+			if ($year == $start_year && $year == $end_year) {
90 90
 
91 91
 				$m1 = $start_month;
92 92
 				$m2 = $end_month;
93 93
 
94
-			} elseif ( $year == $start_year ) {
94
+			} elseif ($year == $start_year) {
95 95
 
96 96
 				$m1 = $start_month;
97 97
 				$m2 = 12;
98 98
 
99
-			} elseif ( $year == $end_year ) {
99
+			} elseif ($year == $end_year) {
100 100
 
101 101
 				$m1 = 1;
102 102
 				$m2 = $end_month;
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
 
109 109
 			}
110 110
 
111
-			while ( $m1 <= $m2 ) {
111
+			while ($m1 <= $m2) {
112 112
 
113
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
114
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
113
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
114
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
115 115
 
116 116
 				$data[] = array(
117
-					'date'      => date_i18n( 'F Y', $date1 ),
118
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
119
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ),
117
+					'date'      => date_i18n('F Y', $date1),
118
+					'donations' => $stats->get_sales(0, $date1, $date2),
119
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)),
120 120
 				);
121 121
 
122
-				$m1 ++;
122
+				$m1++;
123 123
 
124 124
 			}
125 125
 
126 126
 
127
-			$year ++;
127
+			$year++;
128 128
 
129 129
 		}
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 1 patch
Spacing   +170 added lines, -170 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_donors_page() {
26 26
 	$default_views  = give_donor_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_donor_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_donor_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_donors_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_donor_views', $views );
45
+	return apply_filters('give_donor_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_donor_tabs', $tabs );
59
+	return apply_filters('give_donor_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_donors_list() {
70
-	include dirname( __FILE__ ) . '/class-donor-table.php';
70
+	include dirname(__FILE__).'/class-donor-table.php';
71 71
 
72 72
 	$donors_table = new Give_Donor_List_Table();
73 73
 	$donors_table->prepare_items();
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( 'give_donors_table_top' );
83
+		do_action('give_donors_table_top');
84 84
 		?>
85 85
 
86 86
 		<hr class="wp-header-end">
87
-		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
88
-			<?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?>
87
+		<form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
88
+			<?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?>
89 89
 			<input type="hidden" name="post_type" value="give_forms" />
90 90
 			<input type="hidden" name="page" value="give-donors" />
91 91
 			<input type="hidden" name="view" value="donors" />
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		 *
103 103
 		 * @since 1.0
104 104
 		 */
105
-		do_action( 'give_donors_table_bottom' );
105
+		do_action('give_donors_table_bottom');
106 106
 		?>
107 107
 	</div>
108 108
 	<?php
@@ -118,33 +118,33 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @return void
120 120
  */
121
-function give_render_donor_view( $view, $callbacks ) {
121
+function give_render_donor_view($view, $callbacks) {
122 122
 
123 123
 	$render = true;
124 124
 
125
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
125
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
126 126
 
127
-	if ( ! current_user_can( $donor_view_role ) ) {
128
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
127
+	if ( ! current_user_can($donor_view_role)) {
128
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
129 129
 		$render = false;
130 130
 	}
131 131
 
132
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
133
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
132
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
133
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
134 134
 		$render = false;
135 135
 	}
136 136
 
137 137
 	$donor_id          = (int) $_GET['id'];
138
-	$reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : '';
139
-	$donor             = new Give_Donor( $donor_id );
138
+	$reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : '';
139
+	$donor             = new Give_Donor($donor_id);
140 140
 
141 141
 	// Reconnect User with Donor profile.
142
-	if( $reconnect_user_id ) {
143
-		give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() );
142
+	if ($reconnect_user_id) {
143
+		give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array());
144 144
 	}
145 145
 
146
-	if ( empty( $donor->id ) ) {
147
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
146
+	if (empty($donor->id)) {
147
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
148 148
 		$render = false;
149 149
 	}
150 150
 
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 
154 154
 	<div class='wrap'>
155 155
 
156
-		<?php if ( give_get_errors() ) : ?>
156
+		<?php if (give_get_errors()) : ?>
157 157
 			<div class="error settings-error">
158
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
158
+				<?php Give()->notices->render_frontend_notices(0); ?>
159 159
 			</div>
160 160
 		<?php endif; ?>
161 161
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			<?php
164 164
 			printf(
165 165
 			/* translators: %s: donor number */
166
-				esc_html__( 'Donor %s', 'give' ),
166
+				esc_html__('Donor %s', 'give'),
167 167
 				$donor_id
168 168
 			);
169 169
 			?>
@@ -171,26 +171,26 @@  discard block
 block discarded – undo
171 171
 
172 172
 		<hr class="wp-header-end">
173 173
 		
174
-		<?php if ( $donor && $render ) : ?>
174
+		<?php if ($donor && $render) : ?>
175 175
 
176 176
 			<h2 class="nav-tab-wrapper">
177 177
 				<?php
178
-				foreach ( $donor_tabs as $key => $tab ) :
178
+				foreach ($donor_tabs as $key => $tab) :
179 179
 					$active = $key === $view ? true : false;
180 180
 					$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
181 181
 					printf(
182
-						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
183
-						esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
184
-						esc_attr( $class ),
185
-						sanitize_html_class( $tab['dashicon'] ),
186
-						esc_html( $tab['title'] )
182
+						'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
183
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
184
+						esc_attr($class),
185
+						sanitize_html_class($tab['dashicon']),
186
+						esc_html($tab['title'])
187 187
 					);
188 188
 				endforeach;
189 189
 				?>
190 190
 			</h2>
191 191
 
192 192
 			<div id="give-donor-card-wrapper">
193
-				<?php $callbacks[ $view ]( $donor ) ?>
193
+				<?php $callbacks[$view]($donor) ?>
194 194
 			</div>
195 195
 
196 196
 		<?php endif; ?>
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return void
212 212
  */
213
-function give_donor_view( $donor ) {
213
+function give_donor_view($donor) {
214 214
 
215
-	$donor_edit_role   = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
215
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
216 216
 
217 217
 	/**
218 218
 	 * Fires in donor profile screen, above the donor card.
@@ -221,32 +221,32 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @param object $donor The donor object being displayed.
223 223
 	 */
224
-	do_action( 'give_donor_card_top', $donor );
224
+	do_action('give_donor_card_top', $donor);
225 225
 	?>
226 226
 
227 227
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
228 228
 
229
-		<form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
229
+		<form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
230 230
 
231 231
 			<div class="donor-info">
232 232
 
233 233
 				<div class="donor-bio-header clearfix">
234 234
 
235 235
 					<div class="avatar-wrap left" id="donor-avatar">
236
-						<?php echo get_avatar( $donor->email ); ?>
236
+						<?php echo get_avatar($donor->email); ?>
237 237
 					</div>
238 238
 
239 239
 					<div id="donor-name-wrap" class="left">
240 240
 						<span class="donor-id">#<?php echo $donor->id; ?></span>
241
-						<span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php _e( 'Donor Name', 'give' ); ?>" /></span>
241
+						<span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php _e('Donor Name', 'give'); ?>" /></span>
242 242
 						<span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span>
243 243
 					</div>
244 244
 					<p class="donor-since info-item">
245
-						<?php _e( 'Donor since', 'give' ); ?>
246
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
245
+						<?php _e('Donor since', 'give'); ?>
246
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
247 247
 					</p>
248
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
249
-						<a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a>
248
+					<?php if (current_user_can($donor_edit_role)) : ?>
249
+						<a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a>
250 250
 					<?php endif; ?>
251 251
 				</div>
252 252
 				<!-- /donor-bio-header -->
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					<table class="widefat">
257 257
 						<tbody>
258 258
 						<tr class="alternate">
259
-							<th scope="col"><label for="tablecell"><?php _e( 'User:', 'give' ); ?></label></th>
259
+							<th scope="col"><label for="tablecell"><?php _e('User:', 'give'); ?></label></th>
260 260
 							<td>
261 261
 								<span class="donor-user-id info-item edit-item">
262 262
 									<?php
@@ -273,48 +273,48 @@  discard block
 block discarded – undo
273 273
 										'data'  => $data_atts,
274 274
 									);
275 275
 
276
-									if ( ! empty( $user_id ) ) {
277
-										$userdata           = get_userdata( $user_id );
276
+									if ( ! empty($user_id)) {
277
+										$userdata = get_userdata($user_id);
278 278
 										$user_args['selected'] = $user_id;
279 279
 									}
280 280
 
281
-									echo Give()->html->ajax_user_search( $user_args );
281
+									echo Give()->html->ajax_user_search($user_args);
282 282
 									?>
283 283
 								</span>
284 284
 
285 285
 								<span class="donor-user-id info-item editable">
286
-									<?php if ( ! empty( $userdata ) ) { ?>
287
-										<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
286
+									<?php if ( ! empty($userdata)) { ?>
287
+										<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
288 288
 									<?php } else { ?>
289
-										<span data-key="user_id"><?php _e( 'None', 'give' ); ?></span>
289
+										<span data-key="user_id"><?php _e('None', 'give'); ?></span>
290 290
 									<?php } ?>
291
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?>
291
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?>
292 292
 										<span class="disconnect-user">
293 293
  											-
294
- 											<a id="disconnect-donor" href="#disconnect" aria-label="<?php _e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>">
295
- 												<?php _e( 'Disconnect User', 'give' ); ?>
294
+ 											<a id="disconnect-donor" href="#disconnect" aria-label="<?php _e('Disconnects the current user ID from this donor record.', 'give'); ?>">
295
+ 												<?php _e('Disconnect User', 'give'); ?>
296 296
 											</a>
297 297
  										</span>
298 298
 										<span class="view-user-profile">
299 299
  											|
300
- 											<a id="view-user-profile" href="<?php echo 'user-edit.php?user_id=' . $donor->user_id; ?>" aria-label="<?php _e( 'View User Profile of current user ID.', 'give' ); ?>">
301
- 												<?php _e( 'View User Profile', 'give' ); ?>
300
+ 											<a id="view-user-profile" href="<?php echo 'user-edit.php?user_id='.$donor->user_id; ?>" aria-label="<?php _e('View User Profile of current user ID.', 'give'); ?>">
301
+ 												<?php _e('View User Profile', 'give'); ?>
302 302
 											</a>
303 303
  										</span>
304 304
 									<?php } ?>
305 305
 								</span>
306 306
 							</td>
307 307
 						</tr>
308
-						<?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?>
308
+						<?php if (isset($donor->user_id) && $donor->user_id > 0) : ?>
309 309
 
310 310
 							<tr>
311
-								<th scope="col"><?php _e( 'Address:', 'give' ); ?></th>
311
+								<th scope="col"><?php _e('Address:', 'give'); ?></th>
312 312
 								<td class="row-title">
313 313
 
314 314
 									<div class="donor-address-wrapper">
315 315
 
316 316
 										<?php
317
-										$address  = get_user_meta( $donor->user_id, '_give_user_address', true );
317
+										$address  = get_user_meta($donor->user_id, '_give_user_address', true);
318 318
 										$defaults = array(
319 319
 											'line1'   => '',
320 320
 											'line2'   => '',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 											'zip'     => '',
325 325
 										);
326 326
 
327
-										$address = wp_parse_args( $address, $defaults );
327
+										$address = wp_parse_args($address, $defaults);
328 328
 										?>
329 329
 
330
-										<?php if ( ! empty( $address ) ) { ?>
330
+										<?php if ( ! empty($address)) { ?>
331 331
 											<span class="donor-address info-item editable">
332 332
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
333 333
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 
345 345
 										// For State.
346 346
 										$selected_state = give_get_state();
347
-										$states         = give_get_states( $selected_country );
348
-										$selected_state = ( isset( $address['state'] ) ? $address['state'] : $selected_state );
347
+										$states         = give_get_states($selected_country);
348
+										$selected_state = (isset($address['state']) ? $address['state'] : $selected_state);
349 349
 
350 350
 										// Get the country list that does not have any states init.
351 351
 										$no_states_country = give_no_states_country_list();
@@ -353,32 +353,32 @@  discard block
 block discarded – undo
353 353
 										<span class="donor-address info-item edit-item">
354 354
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
355 355
 												<?php
356
-												foreach ( $countries as $country_code => $country ) {
357
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
356
+												foreach ($countries as $country_code => $country) {
357
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
358 358
 												}
359 359
 												?>
360 360
 											</select>
361
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
362
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
363
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
361
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php _e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
362
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php _e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
363
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
364 364
 											<?php
365
-											if ( ! empty( $states ) ) {
365
+											if ( ! empty($states)) {
366 366
 												?>
367 367
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
368 368
 													<?php
369
-													foreach ( $states as $state_code => $state ) {
370
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
369
+													foreach ($states as $state_code => $state) {
370
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
371 371
 													}
372 372
 													?>
373 373
 												</select>
374 374
 												<?php
375 375
 											} else {
376 376
 												?>
377
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ? 'give-hidden' : '' ); ?>" placeholder="<?php _e( 'State / Province / County', 'give' ); ?>" />
377
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country) ? 'give-hidden' : ''); ?>" placeholder="<?php _e('State / Province / County', 'give'); ?>" />
378 378
 												<?php
379 379
 											}
380 380
 											?>
381
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
381
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
382 382
 										</span>
383 383
 
384 384
 									</div>
@@ -394,10 +394,10 @@  discard block
 block discarded – undo
394 394
 
395 395
 			<span id="donor-edit-actions" class="edit-item">
396 396
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" />
397
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
397
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
398 398
 				<input type="hidden" name="give_action" value="edit-donor" />
399
-				<input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e( 'Update Donor', 'give' ); ?>" />
400
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
399
+				<input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php _e('Update Donor', 'give'); ?>" />
400
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a>
401 401
 			</span>
402 402
 
403 403
 		</form>
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
 	 *
413 413
 	 * @param object $donor The donor object being displayed.
414 414
 	 */
415
-	do_action( 'give_donor_before_stats', $donor );
415
+	do_action('give_donor_before_stats', $donor);
416 416
 	?>
417 417
 
418 418
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
419 419
 		<ul>
420 420
 			<li>
421
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>">
421
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>">
422 422
 					<span class="dashicons dashicons-heart"></span>
423 423
 					<?php
424 424
 					// Completed Donations.
425
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
426
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
425
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
426
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
427 427
 					?>
428 428
 				</a>
429 429
 			</li>
430 430
 			<li>
431 431
 				<span class="dashicons dashicons-chart-area"></span>
432
-				<?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?>
432
+				<?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?>
433 433
 			</li>
434 434
 			<?php
435 435
 			/**
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 			 *
442 442
 			 * @param object $donor The donor object being displayed.
443 443
 			 */
444
-			do_action( 'give_donor_stats_list', $donor );
444
+			do_action('give_donor_stats_list', $donor);
445 445
 			?>
446 446
 		</ul>
447 447
 	</div>
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @param object $donor The donor object being displayed.
456 456
 	 */
457
-	do_action( 'give_donor_before_tables_wrapper', $donor );
457
+	do_action('give_donor_before_tables_wrapper', $donor);
458 458
 	?>
459 459
 
460 460
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -467,46 +467,46 @@  discard block
 block discarded – undo
467 467
 		 *
468 468
 		 * @param object $donor The donor object being displayed.
469 469
 		 */
470
-		do_action( 'give_donor_before_tables', $donor );
470
+		do_action('give_donor_before_tables', $donor);
471 471
 		?>
472 472
 
473
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
473
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
474 474
 
475 475
 		<table class="wp-list-table widefat striped emails">
476 476
 			<thead>
477 477
 			<tr>
478
-				<th><?php _e( 'Email', 'give' ); ?></th>
479
-				<th><?php _e( 'Actions', 'give' ); ?></th>
478
+				<th><?php _e('Email', 'give'); ?></th>
479
+				<th><?php _e('Actions', 'give'); ?></th>
480 480
 			</tr>
481 481
 			</thead>
482 482
 
483 483
 			<tbody>
484
-			<?php if ( ! empty( $donor->emails ) ) { ?>
484
+			<?php if ( ! empty($donor->emails)) { ?>
485 485
 
486
-				<?php foreach ( $donor->emails as $key => $email ) : ?>
486
+				<?php foreach ($donor->emails as $key => $email) : ?>
487 487
 					<tr data-key="<?php echo $key; ?>">
488 488
 						<td>
489 489
 							<?php echo $email; ?>
490
-							<?php if ( 'primary' === $key ) : ?>
490
+							<?php if ('primary' === $key) : ?>
491 491
 								<span class="dashicons dashicons-star-filled primary-email-icon"></span>
492 492
 							<?php endif; ?>
493 493
 						</td>
494 494
 						<td>
495
-							<?php if ( 'primary' !== $key ) : ?>
495
+							<?php if ('primary' !== $key) : ?>
496 496
 								<?php
497
-								$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
498
-								$promote_url = wp_nonce_url( add_query_arg( array(
499
-									'email' => rawurlencode( $email ),
497
+								$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
498
+								$promote_url = wp_nonce_url(add_query_arg(array(
499
+									'email' => rawurlencode($email),
500 500
 									'give_action' => 'set_donor_primary_email',
501
-								), $base_url ), 'give-set-donor-primary-email' );
502
-								$remove_url  = wp_nonce_url( add_query_arg( array(
503
-									'email' => rawurlencode( $email ),
501
+								), $base_url), 'give-set-donor-primary-email');
502
+								$remove_url = wp_nonce_url(add_query_arg(array(
503
+									'email' => rawurlencode($email),
504 504
 									'give_action' => 'remove_donor_email',
505
-								), $base_url ), 'give-remove-donor-email' );
505
+								), $base_url), 'give-remove-donor-email');
506 506
 								?>
507
-								<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
507
+								<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
508 508
 								&nbsp;|&nbsp;
509
-								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
509
+								<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
510 510
 							<?php endif; ?>
511 511
 						</td>
512 512
 					</tr>
@@ -516,59 +516,59 @@  discard block
 block discarded – undo
516 516
 					<td colspan="2" class="add-donor-email-td">
517 517
 						<div class="add-donor-email-wrapper">
518 518
 							<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" />
519
-							<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
520
-							<input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" />&nbsp;
521
-							<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
522
-							<button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
519
+							<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
520
+							<input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" />&nbsp;
521
+							<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
522
+							<button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
523 523
 							<span class="spinner"></span>
524 524
 						</div>
525 525
 						<div class="notice-wrap"></div>
526 526
 					</td>
527 527
 				</tr>
528 528
 			<?php } else { ?>
529
-				<tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr>
529
+				<tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr>
530 530
 			<?php }// End if().
531 531
 			?>
532 532
 			</tbody>
533 533
 		</table>
534 534
 
535
-		<h3><?php _e( 'Recent Donations', 'give' ); ?></h3>
535
+		<h3><?php _e('Recent Donations', 'give'); ?></h3>
536 536
 		<?php
537
-		$payment_ids = explode( ',', $donor->payment_ids );
538
-		$payments    = give_get_payments( array(
537
+		$payment_ids = explode(',', $donor->payment_ids);
538
+		$payments    = give_get_payments(array(
539 539
 			'post__in' => $payment_ids,
540
-		) );
541
-		$payments    = array_slice( $payments, 0, 10 );
540
+		));
541
+		$payments    = array_slice($payments, 0, 10);
542 542
 		?>
543 543
 		<table class="wp-list-table widefat striped payments">
544 544
 			<thead>
545 545
 			<tr>
546
-				<th scope="col"><?php _e( 'ID', 'give' ); ?></th>
547
-				<th scope="col"><?php _e( 'Amount', 'give' ); ?></th>
548
-				<th scope="col"><?php _e( 'Date', 'give' ); ?></th>
549
-				<th scope="col"><?php _e( 'Status', 'give' ); ?></th>
550
-				<th scope="col"><?php _e( 'Actions', 'give' ); ?></th>
546
+				<th scope="col"><?php _e('ID', 'give'); ?></th>
547
+				<th scope="col"><?php _e('Amount', 'give'); ?></th>
548
+				<th scope="col"><?php _e('Date', 'give'); ?></th>
549
+				<th scope="col"><?php _e('Status', 'give'); ?></th>
550
+				<th scope="col"><?php _e('Actions', 'give'); ?></th>
551 551
 			</tr>
552 552
 			</thead>
553 553
 			<tbody>
554
-			<?php if ( ! empty( $payments ) ) { ?>
555
-				<?php foreach ( $payments as $payment ) : ?>
554
+			<?php if ( ! empty($payments)) { ?>
555
+				<?php foreach ($payments as $payment) : ?>
556 556
 					<tr>
557 557
 						<td><?php echo $payment->ID; ?></td>
558
-						<td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td>
559
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
560
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
558
+						<td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td>
559
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
560
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
561 561
 						<td>
562 562
 							<?php
563 563
 							printf(
564 564
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
565
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
565
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
566 566
 								sprintf(
567 567
 								/* translators: %s: Donation ID */
568
-									esc_attr__( 'View Donation %s.', 'give' ),
568
+									esc_attr__('View Donation %s.', 'give'),
569 569
 									$payment->ID
570 570
 								),
571
-								__( 'View Donation', 'give' )
571
+								__('View Donation', 'give')
572 572
 							);
573 573
 							?>
574 574
 
@@ -583,47 +583,47 @@  discard block
 block discarded – undo
583 583
 							 * @param object $donor The donor object being displayed.
584 584
 							 * @param object $payment  The payment object being displayed.
585 585
 							 */
586
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
586
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
587 587
 							?>
588 588
 						</td>
589 589
 					</tr>
590 590
 				<?php endforeach; ?>
591 591
 			<?php } else { ?>
592 592
 				<tr>
593
-					<td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td>
593
+					<td colspan="5"><?php _e('No donations found.', 'give'); ?></td>
594 594
 				</tr>
595 595
 			<?php }// End if().
596 596
 			?>
597 597
 			</tbody>
598 598
 		</table>
599 599
 
600
-		<h3><?php _e( 'Completed Forms', 'give' ); ?></h3>
600
+		<h3><?php _e('Completed Forms', 'give'); ?></h3>
601 601
 		<?php
602
-		$donations = give_get_users_completed_donations( $donor->email );
602
+		$donations = give_get_users_completed_donations($donor->email);
603 603
 		?>
604 604
 		<table class="wp-list-table widefat striped donations">
605 605
 			<thead>
606 606
 			<tr>
607
-				<th scope="col"><?php _e( 'Form', 'give' ); ?></th>
608
-				<th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th>
607
+				<th scope="col"><?php _e('Form', 'give'); ?></th>
608
+				<th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th>
609 609
 			</tr>
610 610
 			</thead>
611 611
 			<tbody>
612
-			<?php if ( ! empty( $donations ) ) { ?>
613
-				<?php foreach ( $donations as $donation ) : ?>
612
+			<?php if ( ! empty($donations)) { ?>
613
+				<?php foreach ($donations as $donation) : ?>
614 614
 					<tr>
615 615
 						<td><?php echo $donation->post_title; ?></td>
616 616
 						<td>
617 617
 							<?php
618 618
 							printf(
619 619
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
620
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
620
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
621 621
 								sprintf(
622 622
 								/* translators: %s: form name */
623
-									esc_attr__( 'View Form %s.', 'give' ),
623
+									esc_attr__('View Form %s.', 'give'),
624 624
 									$donation->post_title
625 625
 								),
626
-								__( 'View Form', 'give' )
626
+								__('View Form', 'give')
627 627
 							);
628 628
 							?>
629 629
 						</td>
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 				<?php endforeach; ?>
632 632
 			<?php } else { ?>
633 633
 				<tr>
634
-					<td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td>
634
+					<td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td>
635 635
 				</tr>
636 636
 			<?php } ?>
637 637
 			</tbody>
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 		 *
646 646
 		 * @param object $donor The donor object being displayed.
647 647
 		 */
648
-		do_action( 'give_donor_after_tables', $donor );
648
+		do_action('give_donor_after_tables', $donor);
649 649
 		?>
650 650
 
651 651
 	</div>
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	 *
659 659
 	 * @param object $donor The donor object being displayed.
660 660
 	 */
661
-	do_action( 'give_donor_card_bottom', $donor );
661
+	do_action('give_donor_card_bottom', $donor);
662 662
 
663 663
 }
664 664
 
@@ -671,30 +671,30 @@  discard block
 block discarded – undo
671 671
  *
672 672
  * @return void
673 673
  */
674
-function give_donor_notes_view( $donor ) {
674
+function give_donor_notes_view($donor) {
675 675
 
676
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
677
-	$paged          = absint( $paged );
676
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
677
+	$paged          = absint($paged);
678 678
 	$note_count     = $donor->get_notes_count();
679
-	$per_page       = apply_filters( 'give_donor_notes_per_page', 20 );
680
-	$total_pages    = ceil( $note_count / $per_page );
681
-	$donor_notes = $donor->get_notes( $per_page, $paged );
679
+	$per_page       = apply_filters('give_donor_notes_per_page', 20);
680
+	$total_pages    = ceil($note_count / $per_page);
681
+	$donor_notes = $donor->get_notes($per_page, $paged);
682 682
 	?>
683 683
 
684 684
 	<div id="donor-notes-wrapper">
685 685
 		<div class="donor-notes-header">
686
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
686
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
687 687
 		</div>
688
-		<h3><?php _e( 'Notes', 'give' ); ?></h3>
688
+		<h3><?php _e('Notes', 'give'); ?></h3>
689 689
 
690
-		<?php if ( 1 == $paged ) : ?>
690
+		<?php if (1 == $paged) : ?>
691 691
 			<div style="display: block; margin-bottom: 55px;">
692
-				<form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
692
+				<form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
693 693
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
694 694
 					<br />
695 695
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" />
696 696
 					<input type="hidden" name="give_action" value="add-donor-note" />
697
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
697
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
698 698
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" />
699 699
 				</form>
700 700
 			</div>
@@ -709,26 +709,26 @@  discard block
 block discarded – undo
709 709
 			'show_all' => true,
710 710
 		);
711 711
 
712
-		echo paginate_links( $pagination_args );
712
+		echo paginate_links($pagination_args);
713 713
 		?>
714 714
 
715 715
 		<div id="give-donor-notes" class="postbox">
716
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
717
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
716
+			<?php if (count($donor_notes) > 0) { ?>
717
+				<?php foreach ($donor_notes as $key => $note) : ?>
718 718
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
719 719
 					<span class="note-content-wrap">
720
-						<?php echo stripslashes( $note ); ?>
720
+						<?php echo stripslashes($note); ?>
721 721
 					</span>
722 722
 					</div>
723 723
 				<?php endforeach; ?>
724 724
 			<?php } else { ?>
725 725
 				<div class="give-no-donor-notes">
726
-					<?php _e( 'No donor notes found.', 'give' ); ?>
726
+					<?php _e('No donor notes found.', 'give'); ?>
727 727
 				</div>
728 728
 			<?php } ?>
729 729
 		</div>
730 730
 
731
-		<?php echo paginate_links( $pagination_args ); ?>
731
+		<?php echo paginate_links($pagination_args); ?>
732 732
 
733 733
 	</div>
734 734
 
@@ -744,9 +744,9 @@  discard block
 block discarded – undo
744 744
  *
745 745
  * @return void
746 746
  */
747
-function give_donor_delete_view( $donor ) {
747
+function give_donor_delete_view($donor) {
748 748
 
749
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
749
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
750 750
 
751 751
 	/**
752 752
 	 * Fires in donor delete screen, above the content.
@@ -755,15 +755,15 @@  discard block
 block discarded – undo
755 755
 	 *
756 756
 	 * @param object $donor The donor object being displayed.
757 757
 	 */
758
-	do_action( 'give_donor_delete_top', $donor );
758
+	do_action('give_donor_delete_top', $donor);
759 759
 	?>
760 760
 
761 761
 	<div class="info-wrapper donor-section">
762 762
 
763
-		<form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
763
+		<form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
764 764
 
765 765
 			<div class="donor-notes-header">
766
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
766
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
767 767
 			</div>
768 768
 
769 769
 
@@ -771,20 +771,20 @@  discard block
 block discarded – undo
771 771
 
772 772
 				<span class="delete-donor-options">
773 773
 					<p>
774
-						<?php echo Give()->html->checkbox( array(
774
+						<?php echo Give()->html->checkbox(array(
775 775
 							'name' => 'give-donor-delete-confirm',
776
-						) ); ?>
777
-						<label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
776
+						)); ?>
777
+						<label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label>
778 778
 					</p>
779 779
 
780 780
 					<p>
781
-						<?php echo Give()->html->checkbox( array(
781
+						<?php echo Give()->html->checkbox(array(
782 782
 							'name'    => 'give-donor-delete-records',
783 783
 							'options' => array(
784 784
 								'disabled' => true,
785 785
 							),
786
-						) ); ?>
787
-						<label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label>
786
+						)); ?>
787
+						<label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label>
788 788
 					</p>
789 789
 
790 790
 					<?php
@@ -797,16 +797,16 @@  discard block
 block discarded – undo
797 797
 					 *
798 798
 					 * @param object $donor The donor object being displayed.
799 799
 					 */
800
-					do_action( 'give_donor_delete_inputs', $donor );
800
+					do_action('give_donor_delete_inputs', $donor);
801 801
 					?>
802 802
 				</span>
803 803
 
804 804
 				<span id="donor-edit-actions">
805 805
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" />
806
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
806
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
807 807
 					<input type="hidden" name="give_action" value="delete-donor" />
808
-					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e( 'Delete Donor', 'give' ); ?>" />
809
-					<a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php _e( 'Cancel', 'give' ); ?></a>
808
+					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php _e('Delete Donor', 'give'); ?>" />
809
+					<a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php _e('Cancel', 'give'); ?></a>
810 810
 				</span>
811 811
 
812 812
 			</div>
@@ -822,5 +822,5 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @param object $donor The donor object being displayed.
824 824
 	 */
825
-	do_action( 'give_donor_delete_bottom', $donor );
825
+	do_action('give_donor_delete_bottom', $donor);
826 826
 }
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number         = $payment->number;
46 46
 $payment_meta   = $payment->get_meta();
47
-$transaction_id = esc_attr( $payment->transaction_id );
47
+$transaction_id = esc_attr($payment->transaction_id);
48 48
 $user_id        = $payment->user_id;
49 49
 $donor_id       = $payment->customer_id;
50
-$payment_date   = strtotime( $payment->date );
51
-$user_info      = give_get_payment_meta_user_info( $payment_id );
50
+$payment_date   = strtotime($payment->date);
51
+$user_info      = give_get_payment_meta_user_info($payment_id);
52 52
 $address        = $payment->address;
53 53
 $currency_code  = $payment->currency;
54 54
 $gateway        = $payment->gateway;
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	<?php
62 62
 		printf(
63 63
 			/* translators: %s: donation number */
64
-			esc_html__( 'Donation %s', 'give' ),
64
+			esc_html__('Donation %s', 'give'),
65 65
 			$number
66 66
 		);
67
-		if ( $payment_mode == 'test' ) {
68
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
67
+		if ($payment_mode == 'test') {
68
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
69 69
 		}
70 70
 		?>
71 71
 		</h1>
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param int $payment_id Payment id.
80 80
 	 */
81
-	do_action( 'give_view_order_details_before', $payment_id );
81
+	do_action('give_view_order_details_before', $payment_id);
82 82
 	?>
83 83
 
84 84
 	<hr class="wp-header-end">
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		 *
93 93
 		 * @param int $payment_id Payment id.
94 94
 		 */
95
-		do_action( 'give_view_order_details_form_top', $payment_id );
95
+		do_action('give_view_order_details_form_top', $payment_id);
96 96
 		?>
97 97
 		<div id="poststuff">
98 98
 			<div id="give-dashboard-widgets-wrap">
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 							 *
109 109
 							 * @param int $payment_id Payment id.
110 110
 							 */
111
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
111
+							do_action('give_view_order_details_sidebar_before', $payment_id);
112 112
 							?>
113 113
 
114 114
 							<div id="give-order-update" class="postbox give-order-data">
115 115
 
116
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
116
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
117 117
 
118 118
 								<div class="inside">
119 119
 									<div class="give-admin-box">
@@ -126,33 +126,33 @@  discard block
 block discarded – undo
126 126
 										 *
127 127
 										 * @param int $payment_id Payment id.
128 128
 										 */
129
-										do_action( 'give_view_order_details_totals_before', $payment_id );
129
+										do_action('give_view_order_details_totals_before', $payment_id);
130 130
 										?>
131 131
 
132 132
 										<div class="give-admin-box-inside">
133 133
 											<p>
134
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
134
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
135 135
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
136
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
137
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
136
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
137
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
138 138
 													<?php endforeach; ?>
139 139
 												</select>
140
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
140
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
141 141
 											</p>
142 142
 										</div>
143 143
 
144 144
 										<div class="give-admin-box-inside">
145 145
 											<p>
146
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
147
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
146
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
147
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
148 148
 											</p>
149 149
 										</div>
150 150
 
151 151
 										<div class="give-admin-box-inside">
152 152
 											<p>
153
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
154
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
155
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
153
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
154
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
155
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
156 156
 											</p>
157 157
 										</div>
158 158
 
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 										 *
167 167
 										 * @param int $payment_id Payment id.
168 168
 										 */
169
-										do_action( 'give_view_order_details_update_inner', $payment_id );
169
+										do_action('give_view_order_details_update_inner', $payment_id);
170 170
 										?>
171 171
 
172 172
 										<div class="give-order-payment give-admin-box-inside">
173 173
 											<p>
174
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
175
-												<?php echo give_currency_symbol( $payment->currency ); ?>
176
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
174
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
175
+												<?php echo give_currency_symbol($payment->currency); ?>
176
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
177 177
 											</p>
178 178
 										</div>
179 179
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										 *
186 186
 										 * @param int $payment_id Payment id.
187 187
 										 */
188
-										do_action( 'give_view_order_details_totals_after', $payment_id );
188
+										do_action('give_view_order_details_totals_after', $payment_id);
189 189
 										?>
190 190
 
191 191
 									</div>
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 									 *
204 204
 									 * @param int $payment_id Payment id.
205 205
 									 */
206
-									do_action( 'give_view_order_details_update_before', $payment_id );
206
+									do_action('give_view_order_details_update_before', $payment_id);
207 207
 									?>
208 208
 
209 209
 									<div id="major-publishing-actions">
210 210
 										<div id="publishing-action">
211
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
211
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
212 212
 											<?php
213
-											if ( give_is_payment_complete( $payment_id ) ) {
213
+											if (give_is_payment_complete($payment_id)) {
214 214
 												echo sprintf(
215 215
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
216 216
 													esc_url(
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 															)
222 222
 														)
223 223
 													),
224
-													__( 'Resend Receipt', 'give' )
224
+													__('Resend Receipt', 'give')
225 225
 												);
226 226
 											}
227 227
 											?>
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 									 *
238 238
 									 * @param int $payment_id Payment id.
239 239
 									 */
240
-									do_action( 'give_view_order_details_update_after', $payment_id );
240
+									do_action('give_view_order_details_update_after', $payment_id);
241 241
 									?>
242 242
 
243 243
 								</div>
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 							<div id="give-order-details" class="postbox give-order-data">
250 250
 
251
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
251
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
252 252
 
253 253
 								<div class="inside">
254 254
 									<div class="give-admin-box">
@@ -261,45 +261,45 @@  discard block
 block discarded – undo
261 261
 										 *
262 262
 										 * @param int $payment_id Payment id.
263 263
 										 */
264
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
264
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
265 265
 
266
-										$gateway = give_get_payment_gateway( $payment_id );
267
-										if ( $gateway ) :
266
+										$gateway = give_get_payment_gateway($payment_id);
267
+										if ($gateway) :
268 268
 										?>
269 269
 											<div class="give-order-gateway give-admin-box-inside">
270 270
 												<p>
271
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
272
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
271
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
272
+													<?php echo give_get_gateway_admin_label($gateway); ?>
273 273
 												</p>
274 274
 											</div>
275 275
 										<?php endif; ?>
276 276
 
277 277
 										<div class="give-order-payment-key give-admin-box-inside">
278 278
 											<p>
279
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
280
-												<?php echo give_get_payment_key( $payment_id ); ?>
279
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
280
+												<?php echo give_get_payment_key($payment_id); ?>
281 281
 											</p>
282 282
 										</div>
283 283
 
284 284
 										<div class="give-order-ip give-admin-box-inside">
285 285
 											<p>
286
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
287
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
286
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
287
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
288 288
 											</p>
289 289
 										</div>
290 290
 
291
-										<?php if ( $transaction_id ) : ?>
291
+										<?php if ($transaction_id) : ?>
292 292
 											<div class="give-order-tx-id give-admin-box-inside">
293 293
 												<p>
294
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
295
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
294
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
295
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
296 296
 												</p>
297 297
 											</div>
298 298
 										<?php endif; ?>
299 299
 
300 300
 										<div class="give-admin-box-inside">
301
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
302
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
301
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
302
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
303 303
 											</p>
304 304
 										</div>
305 305
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 										 *
312 312
 										 * @param int $payment_id Payment id.
313 313
 										 */
314
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
314
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
315 315
 										?>
316 316
 
317 317
 									</div>
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 							 *
332 332
 							 * @param int $payment_id Payment id.
333 333
 							 */
334
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
334
+							do_action('give_view_order_details_sidebar_after', $payment_id);
335 335
 							?>
336 336
 
337 337
 						</div>
@@ -351,31 +351,31 @@  discard block
 block discarded – undo
351 351
 							 *
352 352
 							 * @param int $payment_id Payment id.
353 353
 							 */
354
-							do_action( 'give_view_order_details_main_before', $payment_id );
354
+							do_action('give_view_order_details_main_before', $payment_id);
355 355
 							?>
356 356
 
357 357
 							<?php $column_count = 'columns-3'; ?>
358 358
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
359
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
359
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
360 360
 
361 361
 								<div class="inside">
362 362
 
363 363
 									<div class="column-container">
364 364
 										<div class="column">
365 365
 											<p>
366
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
366
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
367 367
 												<?php
368
-												if ( $payment_meta['form_id'] ) :
368
+												if ($payment_meta['form_id']) :
369 369
 													printf(
370 370
 														'<a href="%1$s">#%2$s</a>',
371
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
371
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
372 372
 														$payment_meta['form_id']
373 373
 													);
374 374
 												endif;
375 375
 												?>
376 376
 											</p>
377 377
 											<p>
378
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
378
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
379 379
 												<?php
380 380
 												echo Give()->html->forms_dropdown(
381 381
 													array(
@@ -391,21 +391,21 @@  discard block
 block discarded – undo
391 391
 										</div>
392 392
 										<div class="column">
393 393
 											<p>
394
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
395
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
394
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
395
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
396 396
 											</p>
397 397
 											<p>
398
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
398
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
399 399
 												<span class="give-donation-level">
400 400
 													<?php
401
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
402
-													if ( empty( $var_prices ) ) {
403
-														esc_html_e( 'n/a', 'give' );
401
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
402
+													if (empty($var_prices)) {
403
+														esc_html_e('n/a', 'give');
404 404
 													} else {
405 405
 														$prices_atts = array();
406
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
407
-															foreach ( $variable_prices as $variable_price ) {
408
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
406
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
407
+															foreach ($variable_prices as $variable_price) {
408
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
409 409
 															}
410 410
 														}
411 411
 														// Variable price dropdown options.
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 															'name'             => 'give-variable-price',
415 415
 															'chosen'           => true,
416 416
 															'show_option_all'  => '',
417
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
418
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
417
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
418
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
419 419
 															'selected'         => $payment_meta['price_id'],
420 420
 														);
421 421
 														// Render variable prices select tag html.
422
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
422
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
423 423
 													}
424 424
 													?>
425 425
 												</span>
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 										</div>
428 428
 										<div class="column">
429 429
 											<p>
430
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
431
-												<?php echo give_donation_amount( $payment, true ); ?>
430
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
431
+												<?php echo give_donation_amount($payment, true); ?>
432 432
 											</p>
433 433
 											<p>
434 434
 												<?php
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 												 *
442 442
 												 * @param int $payment_id Payment id.
443 443
 												 */
444
-												do_action( 'give_donation_details_thead_before', $payment_id );
444
+												do_action('give_donation_details_thead_before', $payment_id);
445 445
 
446 446
 
447 447
 												/**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 												 *
454 454
 												 * @param int $payment_id Payment id.
455 455
 												 */
456
-												do_action( 'give_donation_details_thead_after', $payment_id );
456
+												do_action('give_donation_details_thead_after', $payment_id);
457 457
 
458 458
 												/**
459 459
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 												 *
465 465
 												 * @param int $payment_id Payment id.
466 466
 												 */
467
-												do_action( 'give_donation_details_tbody_before', $payment_id );
467
+												do_action('give_donation_details_tbody_before', $payment_id);
468 468
 
469 469
 												/**
470 470
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 												 *
476 476
 												 * @param int $payment_id Payment id.
477 477
 												 */
478
-												do_action( 'give_donation_details_tbody_after', $payment_id );
478
+												do_action('give_donation_details_tbody_after', $payment_id);
479 479
 												?>
480 480
 											</p>
481 481
 										</div>
@@ -495,58 +495,58 @@  discard block
 block discarded – undo
495 495
 							 *
496 496
 							 * @param int $payment_id Payment id.
497 497
 							 */
498
-							do_action( 'give_view_order_details_files_after', $payment_id );
498
+							do_action('give_view_order_details_files_after', $payment_id);
499 499
 							?>
500 500
 
501 501
 							<div id="give-donor-details" class="postbox">
502
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
502
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
503 503
 
504 504
 								<div class="inside">
505 505
 
506
-									<?php $donor = new Give_Donor( $donor_id ); ?>
506
+									<?php $donor = new Give_Donor($donor_id); ?>
507 507
 
508 508
 									<div class="column-container donor-info">
509 509
 										<div class="column">
510 510
 											<p>
511
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
511
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
512 512
 												<?php
513
-												if ( ! empty( $donor->id ) ) {
513
+												if ( ! empty($donor->id)) {
514 514
 													printf(
515 515
 														'<a href="%1$s">#%2$s</a>',
516
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
516
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
517 517
 														$donor->id
518 518
 													);
519 519
 												}
520 520
 												?>
521 521
 											</p>
522 522
 											<p>
523
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
524
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?>
523
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
524
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)); ?>
525 525
 											</p>
526 526
 										</div>
527 527
 										<div class="column">
528 528
 											<p>
529
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
529
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
530 530
 												<?php
531
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
532
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
531
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
532
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
533 533
 
534 534
 												// Check whether the donor name and WP_User name is same or not.
535
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
536
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
535
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
536
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
537 537
 												} else {
538 538
 													echo $donor_name;
539 539
 												}
540 540
 												?>
541 541
 											</p>
542 542
 											<p>
543
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
543
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
544 544
 												<?php echo $donor->email; ?>
545 545
 											</p>
546 546
 										</div>
547 547
 										<div class="column">
548 548
 											<p>
549
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
549
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
550 550
 												<?php
551 551
 												echo Give()->html->donor_dropdown(
552 552
 													array(
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 												?>
558 558
 											</p>
559 559
 											<p>
560
-												<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
560
+												<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>
561 561
 											</p>
562 562
 										</div>
563 563
 									</div>
@@ -565,13 +565,13 @@  discard block
 block discarded – undo
565 565
 									<div class="column-container new-donor" style="display: none">
566 566
 										<div class="column">
567 567
 											<p>
568
-												<label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
568
+												<label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
569 569
 												<input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/>
570 570
 											</p>
571 571
 										</div>
572 572
 										<div class="column">
573 573
 											<p>
574
-												<label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
574
+												<label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
575 575
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
576 576
 											</p>
577 577
 										</div>
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 											<p>
580 580
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
581 581
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
582
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
582
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
583 583
 												<br>
584
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
584
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
585 585
 											</p>
586 586
 										</div>
587 587
 									</div>
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 									 * @param array $payment_meta Payment meta.
598 598
 									 * @param array $user_info    User information.
599 599
 									 */
600
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
600
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
601 601
 
602 602
 									/**
603 603
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 									 *
607 607
 									 * @param int $payment_id Payment id.
608 608
 									 */
609
-									do_action( 'give_payment_view_details', $payment_id );
609
+									do_action('give_payment_view_details', $payment_id);
610 610
 									?>
611 611
 
612 612
 								</div>
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
 							 *
623 623
 							 * @param int $payment_id Payment id.
624 624
 							 */
625
-							do_action( 'give_view_order_details_billing_before', $payment_id );
625
+							do_action('give_view_order_details_billing_before', $payment_id);
626 626
 							?>
627 627
 
628 628
 							<div id="give-billing-details" class="postbox">
629
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
629
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
630 630
 
631 631
 								<div class="inside">
632 632
 
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 											<div class="data column-container">
637 637
 
638 638
 												<?php
639
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
639
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
640 640
 
641
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
641
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
642 642
 
643 643
 												// Get the country list that does not have any states init.
644 644
 												$no_states_country = give_no_states_country_list();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 
647 647
 												<div class="row">
648 648
 													<div id="give-order-address-country-wrap">
649
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
649
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
650 650
 														<?php
651 651
 														echo Give()->html->select(
652 652
 															array(
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 																'show_option_all'  => false,
657 657
 																'show_option_none' => false,
658 658
 																'chosen'           => true,
659
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
660
-																'data'             => array( 'search-type' => 'no_ajax' ),
659
+																'placeholder'      => esc_attr__('Select a country', 'give'),
660
+																'data'             => array('search-type' => 'no_ajax'),
661 661
 															)
662 662
 														);
663 663
 														?>
@@ -666,35 +666,35 @@  discard block
 block discarded – undo
666 666
 
667 667
 												<div class="row">
668 668
 													<div class="give-wrap-address-line1">
669
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
670
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
669
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
670
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
671 671
 													</div>
672 672
 												</div>
673 673
 
674 674
 												<div class="row">
675 675
 													<div class="give-wrap-address-line2">
676
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
677
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
676
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
677
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
678 678
 													</div>
679 679
 												</div>
680 680
 
681 681
 												<div class="row">
682 682
 													<div class="give-wrap-address-city">
683
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
684
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
683
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
684
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
685 685
 													</div>
686 686
 												</div>
687 687
 
688 688
 												<?php
689
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
689
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
690 690
 												?>
691 691
 												<div class="row">
692
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
693
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
694
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
692
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
693
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
694
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
695 695
 															<?php
696
-															$states = give_get_states( $address['country'] );
697
-															if ( ! empty( $states ) ) {
696
+															$states = give_get_states($address['country']);
697
+															if ( ! empty($states)) {
698 698
 																echo Give()->html->select(
699 699
 																	array(
700 700
 																		'options'          => $states,
@@ -703,23 +703,23 @@  discard block
 block discarded – undo
703 703
 																		'show_option_all'  => false,
704 704
 																		'show_option_none' => false,
705 705
 																		'chosen'           => true,
706
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
707
-																		'data'             => array( 'search-type' => 'no_ajax' ),
706
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
707
+																		'data'             => array('search-type' => 'no_ajax'),
708 708
 																	)
709 709
 																);
710 710
 															} else {
711 711
 																?>
712
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
712
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
713 713
 																<?php
714 714
 															}
715 715
 															?>
716 716
 														</div>
717 717
 													</div>
718 718
 
719
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
719
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
720 720
 														<div class="give-wrap-address-zip">
721
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
722
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
721
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
722
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
723 723
 														</div>
724 724
 													</div>
725 725
 												</div>
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 									 *
739 739
 									 * @param int $payment_id Payment id.
740 740
 									 */
741
-									do_action( 'give_payment_billing_details', $payment_id );
741
+									do_action('give_payment_billing_details', $payment_id);
742 742
 									?>
743 743
 
744 744
 								</div>
@@ -754,33 +754,33 @@  discard block
 block discarded – undo
754 754
 							 *
755 755
 							 * @param int $payment_id Payment id.
756 756
 							 */
757
-							do_action( 'give_view_order_details_billing_after', $payment_id );
757
+							do_action('give_view_order_details_billing_after', $payment_id);
758 758
 							?>
759 759
 
760 760
 							<div id="give-payment-notes" class="postbox">
761
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
761
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
762 762
 
763 763
 								<div class="inside">
764 764
 									<div id="give-payment-notes-inner">
765 765
 										<?php
766
-										$notes = give_get_payment_notes( $payment_id );
767
-										if ( ! empty( $notes ) ) {
766
+										$notes = give_get_payment_notes($payment_id);
767
+										if ( ! empty($notes)) {
768 768
 											$no_notes_display = ' style="display:none;"';
769
-											foreach ( $notes as $note ) :
769
+											foreach ($notes as $note) :
770 770
 
771
-												echo give_get_payment_note_html( $note, $payment_id );
771
+												echo give_get_payment_note_html($note, $payment_id);
772 772
 
773 773
 											endforeach;
774 774
 										} else {
775 775
 											$no_notes_display = '';
776 776
 										}
777
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
777
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
778 778
 										?>
779 779
 									</div>
780 780
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
781 781
 
782 782
 									<div class="give-clearfix">
783
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
783
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
784 784
 									</div>
785 785
 
786 786
 								</div>
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 							 *
797 797
 							 * @param int $payment_id Payment id.
798 798
 							 */
799
-							do_action( 'give_view_order_details_main_after', $payment_id );
799
+							do_action('give_view_order_details_main_after', $payment_id);
800 800
 							?>
801 801
 
802 802
 						</div>
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 		 *
819 819
 		 * @param int $payment_id Payment id.
820 820
 		 */
821
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
821
+		do_action('give_view_order_details_form_bottom', $payment_id);
822 822
 
823
-		wp_nonce_field( 'give_update_payment_details_nonce' );
823
+		wp_nonce_field('give_update_payment_details_nonce');
824 824
 		?>
825
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
825
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
826 826
 		<input type="hidden" name="give_action" value="update_payment_details"/>
827 827
 	</form>
828 828
 	<?php
@@ -833,6 +833,6 @@  discard block
 block discarded – undo
833 833
 	 *
834 834
 	 * @param int $payment_id Payment id.
835 835
 	 */
836
-	do_action( 'give_view_order_details_after', $payment_id );
836
+	do_action('give_view_order_details_after', $payment_id);
837 837
 	?>
838 838
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.