x Sorry, these patches are not available anymore due to data migration. Please run a fresh inspection.
Completed
Pull Request — master (#986)
by Rami
20:36
created
includes/admin/reporting/tools/class-give-tools-reset-stats.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
 	public function get_data() {
56 56
 		global $wpdb;
57 57
 
58
-		$items = $this->get_stored_data( 'give_temp_reset_ids' );
58
+		$items = $this->get_stored_data('give_temp_reset_ids');
59 59
 
60
-		if ( ! is_array( $items ) ) {
60
+		if ( ! is_array($items)) {
61 61
 			return false;
62 62
 		}
63 63
 
64
-		$offset     = ( $this->step - 1 ) * $this->per_step;
65
-		$step_items = array_slice( $items, $offset, $this->per_step );
64
+		$offset     = ($this->step - 1) * $this->per_step;
65
+		$step_items = array_slice($items, $offset, $this->per_step);
66 66
 
67
-		if ( $step_items ) {
67
+		if ($step_items) {
68 68
 
69 69
 			$step_ids = array(
70 70
 				'customers'  => array(),
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 				'other'      => array(),
73 73
 			);
74 74
 
75
-			foreach ( $step_items as $item ) {
75
+			foreach ($step_items as $item) {
76 76
 
77
-				switch ( $item['type'] ) {
77
+				switch ($item['type']) {
78 78
 					case 'customer':
79 79
 						$step_ids['customers'][] = $item['id'];
80 80
 						break;
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 						$step_ids['give_forms'][] = $item['id'];
83 83
 						break;
84 84
 					default:
85
-						$item_type                = apply_filters( 'give_reset_item_type', 'other', $item );
86
-						$step_ids[ $item_type ][] = $item['id'];
85
+						$item_type                = apply_filters('give_reset_item_type', 'other', $item);
86
+						$step_ids[$item_type][] = $item['id'];
87 87
 						break;
88 88
 				}
89 89
 
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 
92 92
 			$sql = array();
93 93
 
94
-			foreach ( $step_ids as $type => $ids ) {
94
+			foreach ($step_ids as $type => $ids) {
95 95
 
96
-				if ( empty( $ids ) ) {
96
+				if (empty($ids)) {
97 97
 					continue;
98 98
 				}
99 99
 
100
-				$ids = implode( ',', $ids );
100
+				$ids = implode(',', $ids);
101 101
 
102
-				switch ( $type ) {
102
+				switch ($type) {
103 103
 					case 'customers':
104
-						$table_name = $wpdb->prefix . 'give_customers';
104
+						$table_name = $wpdb->prefix.'give_customers';
105 105
 						$sql[]      = "DELETE FROM $table_name WHERE id IN ($ids)";
106 106
 						break;
107 107
 					case 'forms':
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 						break;
117 117
 				}
118 118
 
119
-				if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) {
119
+				if ( ! in_array($type, array('customers', 'forms', 'other'))) {
120 120
 					// Allows other types of custom post types to filter on their own post_type
121 121
 					// and add items to the query list, for the IDs found in their post type.
122
-					$sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids );
122
+					$sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids);
123 123
 				}
124 124
 
125 125
 		
126 126
 			}
127 127
 
128
-			if ( ! empty( $sql ) ) {
129
-				foreach ( $sql as $query ) {
130
-					$wpdb->query( $query );
128
+			if ( ! empty($sql)) {
129
+				foreach ($sql as $query) {
130
+					$wpdb->query($query);
131 131
 				}
132 132
 			}
133 133
 
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function get_percentage_complete() {
149 149
 
150
-		$items = $this->get_stored_data( 'give_temp_reset_ids', false );
151
-		$total = count( $items );
150
+		$items = $this->get_stored_data('give_temp_reset_ids', false);
151
+		$total = count($items);
152 152
 
153 153
 		$percentage = 100;
154 154
 
155
-		if ( $total > 0 ) {
156
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
155
+		if ($total > 0) {
156
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
157 157
 		}
158 158
 
159
-		if ( $percentage > 100 ) {
159
+		if ($percentage > 100) {
160 160
 			$percentage = 100;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @param array $request The Form Data passed into the batch processing
172 172
 	 */
173
-	public function set_properties( $request ) {
173
+	public function set_properties($request) {
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,30 +181,30 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function process_step() {
183 183
 
184
-		if ( ! $this->can_export() ) {
185
-			wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
184
+		if ( ! $this->can_export()) {
185
+			wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
186 186
 		}
187 187
 
188 188
 		$had_data = $this->get_data();
189 189
 
190
-		if ( $had_data ) {
190
+		if ($had_data) {
191 191
 			$this->done = false;
192 192
 
193 193
 			return true;
194 194
 		} else {
195
-			update_option( 'give_earnings_total', 0 );
196
-			delete_transient( 'give_earnings_total' );
197
-			delete_transient( 'give_estimated_monthly_stats' . true );
198
-			delete_transient( 'give_estimated_monthly_stats' . false );
199
-			$this->delete_data( 'give_temp_reset_ids' );
195
+			update_option('give_earnings_total', 0);
196
+			delete_transient('give_earnings_total');
197
+			delete_transient('give_estimated_monthly_stats'.true);
198
+			delete_transient('give_estimated_monthly_stats'.false);
199
+			$this->delete_data('give_temp_reset_ids');
200 200
 
201 201
 			// Reset the sequential order numbers
202
-			if ( give_get_option( 'enable_sequential' ) ) {
203
-				delete_option( 'give_last_payment_number' );
202
+			if (give_get_option('enable_sequential')) {
203
+				delete_option('give_last_payment_number');
204 204
 			}
205 205
 
206 206
 			$this->done    = true;
207
-			$this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' );
207
+			$this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give');
208 208
 
209 209
 			return false;
210 210
 		}
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
 	 * Headers
215 215
 	 */
216 216
 	public function headers() {
217
-		ignore_user_abort( true );
217
+		ignore_user_abort(true);
218 218
 
219
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-			set_time_limit( 0 );
219
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+			set_time_limit(0);
221 221
 		}
222 222
 	}
223 223
 
@@ -241,35 +241,35 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	public function pre_fetch() {
243 243
 
244
-		if ( $this->step == 1 ) {
245
-			$this->delete_data( 'give_temp_reset_ids' );
244
+		if ($this->step == 1) {
245
+			$this->delete_data('give_temp_reset_ids');
246 246
 		}
247 247
 
248
-		$items = get_option( 'give_temp_reset_ids', false );
248
+		$items = get_option('give_temp_reset_ids', false);
249 249
 
250
-		if ( false === $items ) {
250
+		if (false === $items) {
251 251
 			$items = array();
252 252
 
253
-			$give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' );
254
-			$give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset );
253
+			$give_types_for_reset = array('give_forms', 'give_log', 'give_payment');
254
+			$give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset);
255 255
 
256
-			$args = apply_filters( 'give_tools_reset_stats_total_args', array(
256
+			$args = apply_filters('give_tools_reset_stats_total_args', array(
257 257
 				'post_type'      => $give_types_for_reset,
258 258
 				'post_status'    => 'any',
259
-				'posts_per_page' => - 1,
260
-			) );
259
+				'posts_per_page' => -1,
260
+			));
261 261
 
262
-			$posts = get_posts( $args );
263
-			foreach ( $posts as $post ) {
262
+			$posts = get_posts($args);
263
+			foreach ($posts as $post) {
264 264
 				$items[] = array(
265 265
 					'id'   => (int) $post->ID,
266 266
 					'type' => $post->post_type,
267 267
 				);
268 268
 			}
269 269
 
270
-			$customer_args = array( 'number' => - 1 );
271
-			$customers     = Give()->customers->get_customers( $customer_args );
272
-			foreach ( $customers as $customer ) {
270
+			$customer_args = array('number' => -1);
271
+			$customers     = Give()->customers->get_customers($customer_args);
272
+			foreach ($customers as $customer) {
273 273
 				$items[] = array(
274 274
 					'id'   => (int) $customer->id,
275 275
 					'type' => 'customer',
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
 			// Allow filtering of items to remove with an unassociative array for each item
280 280
 			// The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method
281
-			$items = apply_filters( 'give_reset_store_items', $items );
281
+			$items = apply_filters('give_reset_store_items', $items);
282 282
 
283
-			$this->store_data( 'give_temp_reset_ids', $items );
283
+			$this->store_data('give_temp_reset_ids', $items);
284 284
 		}
285 285
 
286 286
 	}
@@ -294,11 +294,11 @@  discard block
 block discarded – undo
294 294
 	 *
295 295
 	 * @return mixed       Returns the data from the database
296 296
 	 */
297
-	private function get_stored_data( $key ) {
297
+	private function get_stored_data($key) {
298 298
 		global $wpdb;
299
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
299
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
300 300
 
301
-		return empty( $value ) ? false : maybe_unserialize( $value );
301
+		return empty($value) ? false : maybe_unserialize($value);
302 302
 	}
303 303
 
304 304
 	/**
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @return void
313 313
 	 */
314
-	private function store_data( $key, $value ) {
314
+	private function store_data($key, $value) {
315 315
 		global $wpdb;
316 316
 
317
-		$value = maybe_serialize( $value );
317
+		$value = maybe_serialize($value);
318 318
 
319 319
 		$data = array(
320 320
 			'option_name'  => $key,
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			'%s',
329 329
 		);
330 330
 
331
-		$wpdb->replace( $wpdb->options, $data, $formats );
331
+		$wpdb->replace($wpdb->options, $data, $formats);
332 332
 	}
333 333
 
334 334
 	/**
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return void
342 342
 	 */
343
-	private function delete_data( $key ) {
343
+	private function delete_data($key) {
344 344
 		global $wpdb;
345
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
345
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
346 346
 	}
347 347
 
348 348
 }
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,32 +29,32 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 
37
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Give Reports', 'give' ); ?></h1>
37
+		<h1 class="screen-reader-text"><?php esc_html_e('Give Reports', 'give'); ?></h1>
38 38
 
39 39
 		<h2 class="nav-tab-wrapper">
40
-			<a href="<?php echo esc_url( add_query_arg( array(
40
+			<a href="<?php echo esc_url(add_query_arg(array(
41 41
 				'tab'              => 'reports',
42 42
 				'settings-updated' => false
43
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Reports', 'give' ); ?></a>
44
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
45
-				<a href="<?php echo esc_url( add_query_arg( array(
43
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Reports', 'give'); ?></a>
44
+			<?php if (current_user_can('export_give_reports')) { ?>
45
+				<a href="<?php echo esc_url(add_query_arg(array(
46 46
 					'tab'              => 'export',
47 47
 					'settings-updated' => false
48
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a>
48
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a>
49 49
 			<?php } ?>
50
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			<a href="<?php echo esc_url(add_query_arg(array(
51 51
 				'tab'              => 'logs',
52 52
 				'settings-updated' => false
53
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Logs', 'give' ); ?></a>
54
-			<a href="<?php echo esc_url( add_query_arg( array(
53
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Logs', 'give'); ?></a>
54
+			<a href="<?php echo esc_url(add_query_arg(array(
55 55
 				'tab'              => 'tools',
56 56
 				'settings-updated' => false
57
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e( 'Tools', 'give' ); ?></a>
57
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php esc_html_e('Tools', 'give'); ?></a>
58 58
 			<?php
59 59
 			/**
60 60
 			 * Fires in the report tabs.
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 			 *
64 64
 			 * @since 1.0
65 65
 			 */
66
-			do_action( 'give_reports_tabs' );
66
+			do_action('give_reports_tabs');
67 67
 			?>
68 68
 		</h2>
69 69
 
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.0
75 75
 		 */
76
-		do_action( 'give_reports_page_top' );
76
+		do_action('give_reports_page_top');
77 77
 
78 78
 		/**
79 79
 		 * Fires the report page active tab.
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( "give_reports_tab_{$active_tab}" );
83
+		do_action("give_reports_tab_{$active_tab}");
84 84
 
85 85
 		/**
86 86
 		 * Fires after the report page.
87 87
 		 *
88 88
 		 * @since 1.0
89 89
 		 */
90
-		do_action( 'give_reports_page_bottom' );
90
+		do_action('give_reports_page_bottom');
91 91
 		?>
92 92
 	</div><!-- .wrap -->
93 93
 	<?php
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
  */
102 102
 function give_reports_default_views() {
103 103
 	$views = array(
104
-		'earnings' => esc_html__( 'Income', 'give' ),
104
+		'earnings' => esc_html__('Income', 'give'),
105 105
 		'forms'    => give_get_forms_label_plural(),
106
-		'donors'   => esc_html__( 'Donors', 'give' ),
107
-		'gateways' => esc_html__( 'Payment Methods', 'give' )
106
+		'donors'   => esc_html__('Donors', 'give'),
107
+		'gateways' => esc_html__('Payment Methods', 'give')
108 108
 	);
109 109
 
110
-	$views = apply_filters( 'give_report_views', $views );
110
+	$views = apply_filters('give_report_views', $views);
111 111
 
112 112
 	return $views;
113 113
 }
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
  * @return string $view Report View
124 124
  *
125 125
  */
126
-function give_get_reporting_view( $default = 'earnings' ) {
126
+function give_get_reporting_view($default = 'earnings') {
127 127
 
128
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
128
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
129 129
 		$view = $default;
130 130
 	} else {
131 131
 		$view = $_GET['view'];
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_get_reporting_view', $view );
134
+	return apply_filters('give_get_reporting_view', $view);
135 135
 }
136 136
 
137 137
 /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	$current_view = 'earnings';
145 145
 	$views        = give_reports_default_views();
146 146
 
147
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
147
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
148 148
 		$current_view = $_GET['view'];
149 149
 	}
150 150
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 *
154 154
 	 * @since 1.0
155 155
 	 */
156
-	do_action( "give_reports_view_{$current_view}" );
156
+	do_action("give_reports_view_{$current_view}");
157 157
 }
158 158
 
159
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
159
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
160 160
 
161 161
 /**
162 162
  * Renders the Reports Page Views Drop Downs
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function give_report_views() {
168 168
 	$views        = give_reports_default_views();
169
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
169
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
170 170
 	/**
171 171
 	 * Fires before the report page actions form.
172 172
 	 *
173 173
 	 * @since 1.0
174 174
 	 */
175
-	do_action( 'give_report_view_actions_before' );
175
+	do_action('give_report_view_actions_before');
176 176
 	?>
177 177
 	<form id="give-reports-filter" method="get">
178 178
 		<select id="give-reports-view" name="view">
179
-			<option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option>
180
-			<?php foreach ( $views as $view_id => $label ) : ?>
181
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
179
+			<option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option>
180
+			<?php foreach ($views as $view_id => $label) : ?>
181
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
182 182
 			<?php endforeach; ?>
183 183
 		</select>
184 184
 
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 		 *
191 191
 		 * @since 1.0
192 192
 		 */
193
-		do_action( 'give_report_view_actions' );
193
+		do_action('give_report_view_actions');
194 194
 		?>
195 195
 
196 196
 		<input type="hidden" name="post_type" value="give_forms"/>
197 197
 		<input type="hidden" name="page" value="give-reports"/>
198
-		<?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
198
+		<?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?>
199 199
 	</form>
200 200
 	<?php
201 201
 	/**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 *
204 204
 	 * @since 1.0
205 205
 	 */
206
-	do_action( 'give_report_view_actions_after' );
206
+	do_action('give_report_view_actions_after');
207 207
 }
208 208
 
209 209
 /**
@@ -216,18 +216,18 @@  discard block
 block discarded – undo
216 216
  */
217 217
 function give_reports_forms_table() {
218 218
 
219
-	if ( isset( $_GET['form-id'] ) ) {
219
+	if (isset($_GET['form-id'])) {
220 220
 		return;
221 221
 	}
222 222
 
223
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
223
+	include(dirname(__FILE__).'/class-form-reports-table.php');
224 224
 
225 225
 	$give_table = new Give_Form_Reports_Table();
226 226
 	$give_table->prepare_items();
227 227
 	$give_table->display();
228 228
 }
229 229
 
230
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
230
+add_action('give_reports_view_forms', 'give_reports_forms_table');
231 231
 
232 232
 /**
233 233
  * Renders the detailed report for a specific give form
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
  * @return void
237 237
  */
238 238
 function give_reports_form_details() {
239
-	if ( ! isset( $_GET['form-id'] ) ) {
239
+	if ( ! isset($_GET['form-id'])) {
240 240
 		return;
241 241
 	}
242 242
 	?>
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 		<div class="actions bulkactions">
245 245
 			<?php give_report_views(); ?>
246 246
 			&nbsp;
247
-			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button>
247
+			<button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button>
248 248
 		</div>
249 249
 	</div>
250 250
 	<?php
251
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
251
+	give_reports_graph_of_form(absint($_GET['form-id']));
252 252
 }
253 253
 
254
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
254
+add_action('give_reports_view_forms', 'give_reports_form_details');
255 255
 
256 256
 /**
257 257
  * Renders the Reports Donors Table
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
  * @return void
263 263
  */
264 264
 function give_reports_donors_table() {
265
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
265
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
266 266
 
267 267
 	$give_table = new Give_Donor_Reports_Table();
268 268
 	$give_table->prepare_items();
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 		 *
275 275
 		 * @since 1.0
276 276
 		 */
277
-		do_action( 'give_logs_donors_table_top' );
277
+		do_action('give_logs_donors_table_top');
278 278
 		?>
279
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
279
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
280 280
 			<?php
281
-			$give_table->search_box( esc_html__( 'Search', 'give' ), 'give-donors' );
281
+			$give_table->search_box(esc_html__('Search', 'give'), 'give-donors');
282 282
 			$give_table->display();
283 283
 			?>
284 284
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @since 1.0
293 293
 		 */
294
-		do_action( 'give_logs_donors_table_bottom' );
294
+		do_action('give_logs_donors_table_bottom');
295 295
 		?>
296 296
 	</div>
297 297
 	<?php
298 298
 }
299 299
 
300
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
300
+add_action('give_reports_view_donors', 'give_reports_donors_table');
301 301
 
302 302
 
303 303
 /**
@@ -309,14 +309,14 @@  discard block
 block discarded – undo
309 309
  * @return void
310 310
  */
311 311
 function give_reports_gateways_table() {
312
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
312
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
313 313
 
314 314
 	$give_table = new Give_Gateawy_Reports_Table();
315 315
 	$give_table->prepare_items();
316 316
 	$give_table->display();
317 317
 }
318 318
 
319
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
319
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
320 320
 
321 321
 
322 322
 /**
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 function give_reports_earnings() {
329 329
 	?>
330 330
 	<div class="tablenav top reports-table-nav">
331
-		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Income Over Time', 'give' ); ?></span></h3>
331
+		<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Income Over Time', 'give'); ?></span></h3>
332 332
 
333 333
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
334 334
 	</div>
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	give_reports_graph();
337 337
 }
338 338
 
339
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
339
+add_action('give_reports_view_earnings', 'give_reports_earnings');
340 340
 
341 341
 
342 342
 /**
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
 				 *
358 358
 				 * @since 1.0
359 359
 				 */
360
-				do_action( 'give_reports_tab_export_content_top' );
360
+				do_action('give_reports_tab_export_content_top');
361 361
 				?>
362 362
 
363 363
 				<table class="widefat export-options-table give-table">
364 364
 					<thead>
365 365
 					<tr>
366
-						<th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th>
367
-						<th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th>
366
+						<th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th>
367
+						<th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th>
368 368
 					</tr>
369 369
 					</thead>
370 370
 					<tbody>
@@ -376,41 +376,41 @@  discard block
 block discarded – undo
376 376
 					 *
377 377
 					 * @since 1.0
378 378
 					 */
379
-					do_action( 'give_reports_tab_export_table_top' );
379
+					do_action('give_reports_tab_export_table_top');
380 380
 					?>
381 381
 					<tr class="give-export-pdf-sales-earnings">
382 382
 						<td scope="row" class="row-title">
383
-							<h3><span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
384
-							<p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
383
+							<h3><span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span></h3>
384
+							<p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
385 385
 						</td>
386 386
 						<td>
387
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php esc_html_e( 'Generate PDF', 'give' ); ?></a>
387
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php esc_html_e('Generate PDF', 'give'); ?></a>
388 388
 						</td>
389 389
 					</tr>
390 390
 					<tr class="alternate give-export-sales-earnings">
391 391
 						<td scope="row" class="row-title">
392
-							<h3><span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
393
-							<p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
392
+							<h3><span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span></h3>
393
+							<p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p>
394 394
 						</td>
395 395
 						<td>
396 396
 							<form method="post">
397 397
 								<?php
398 398
 									printf(
399 399
 										/* translators: 1: start date dropdown 2: end date dropdown */
400
-										esc_html__( '%1$s to %2$s', 'give' ),
401
-										Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ),
402
-										Give()->html->year_dropdown( 'end_year' )   . ' ' . Give()->html->month_dropdown( 'end_month' )
400
+										esc_html__('%1$s to %2$s', 'give'),
401
+										Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'),
402
+										Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month')
403 403
 									);
404 404
 								?>
405 405
 								<input type="hidden" name="give-action" value="earnings_export"/>
406
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
406
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
407 407
 							</form>
408 408
 						</td>
409 409
 					</tr>
410 410
 					<tr class="give-export-payment-history">
411 411
 						<td scope="row" class="row-title">
412
-							<h3><span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span></h3>
413
-							<p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
412
+							<h3><span><?php esc_html_e('Export Donation History', 'give'); ?></span></h3>
413
+							<p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p>
414 414
 						</td>
415 415
 						<td>
416 416
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -418,29 +418,29 @@  discard block
 block discarded – undo
418 418
 								$args = array(
419 419
 									'id'          => 'give-payment-export-start',
420 420
 									'name'        => 'start',
421
-									'placeholder' => esc_attr__( 'Start date', 'give' )
421
+									'placeholder' => esc_attr__('Start date', 'give')
422 422
 								);
423
-								echo Give()->html->date_field( $args ); ?>
423
+								echo Give()->html->date_field($args); ?>
424 424
 								<?php
425 425
 								$args = array(
426 426
 									'id'          => 'give-payment-export-end',
427 427
 									'name'        => 'end',
428
-									'placeholder' => esc_attr__( 'End date', 'give' )
428
+									'placeholder' => esc_attr__('End date', 'give')
429 429
 								);
430
-								echo Give()->html->date_field( $args ); ?>
430
+								echo Give()->html->date_field($args); ?>
431 431
 								<select name="status">
432
-									<option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option>
432
+									<option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option>
433 433
 									<?php
434 434
 									$statuses = give_get_payment_statuses();
435
-									foreach ( $statuses as $status => $label ) {
436
-										echo '<option value="' . $status . '">' . $label . '</option>';
435
+									foreach ($statuses as $status => $label) {
436
+										echo '<option value="'.$status.'">'.$label.'</option>';
437 437
 									}
438 438
 									?>
439 439
 								</select>
440
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
440
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
441 441
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
442 442
 								<span>
443
-									<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
443
+									<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
444 444
 									<span class="spinner"></span>
445 445
 								</span>
446 446
 							</form>
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 					</tr>
449 449
 					<tr class="alternate give-export-donors">
450 450
 						<td scope="row" class="row-title">
451
-							<h3><span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span></h3>
452
-							<p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
451
+							<h3><span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span></h3>
452
+							<p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
453 453
 						</td>
454 454
 						<td>
455 455
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -460,44 +460,44 @@  discard block
 block discarded – undo
460 460
 										'id'     => 'give_customer_export_form',
461 461
 										'chosen' => true
462 462
 									);
463
-									echo Give()->html->forms_dropdown( $args ); ?>
463
+									echo Give()->html->forms_dropdown($args); ?>
464 464
 								
465
-								<input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
465
+								<input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/>
466 466
 
467 467
 								<div id="export-donor-options-wrap" class="give-clearfix">
468
-									<p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p>
468
+									<p><?php esc_html_e('Export Columns:', 'give'); ?></p>
469 469
 									<ul id="give-export-option-ul">
470 470
 										<li>
471
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?>
471
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?>
472 472
 											</label>
473 473
 										</li>
474 474
 										<li>
475
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?>
475
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php esc_html_e('Email', 'give'); ?>
476 476
 											</label>
477 477
 										</li>
478 478
 										<li>
479
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?>
479
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php esc_html_e('Address', 'give'); ?>
480 480
 											</label>
481 481
 										</li>
482 482
 										<li>
483
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?>
483
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?>
484 484
 											</label>
485 485
 										</li>
486 486
 										<li>
487
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?>
487
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?>
488 488
 											</label>
489 489
 										</li>
490 490
 										<li>
491
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?>
491
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?>
492 492
 											</label>
493 493
 										</li>
494 494
 										<li>
495
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?>
495
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?>
496 496
 											</label>
497 497
 										</li>
498 498
 									</ul>
499 499
 								</div>
500
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
500
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
501 501
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
502 502
 								<input type="hidden" name="give-action" value="email_export"/>
503 503
 							</form>
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 					 *
512 512
 					 * @since 1.0
513 513
 					 */
514
-					do_action( 'give_reports_tab_export_table_bottom' );
514
+					do_action('give_reports_tab_export_table_bottom');
515 515
 					?>
516 516
 					</tbody>
517 517
 				</table>
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 				 *
523 523
 				 * @since 1.0
524 524
 				 */
525
-				do_action( 'give_reports_tab_export_content_bottom' );
525
+				do_action('give_reports_tab_export_content_bottom');
526 526
 				?>
527 527
 
528 528
 			</div>
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	<?php
534 534
 }
535 535
 
536
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
536
+add_action('give_reports_tab_export', 'give_reports_tab_export');
537 537
 
538 538
 /**
539 539
  * Renders the Reports page
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
  */
544 544
 function give_reports_tab_logs() {
545 545
 
546
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
546
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
547 547
 
548 548
 	$current_view = 'sales';
549 549
 	$log_views    = give_log_default_views();
550 550
 
551
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
551
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
552 552
 		$current_view = $_GET['view'];
553 553
 	}
554 554
 
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
 	 *
558 558
 	 * @since 1.0
559 559
 	 */
560
-	do_action( "give_logs_view_{$current_view}" );
560
+	do_action("give_logs_view_{$current_view}");
561 561
 }
562 562
 
563
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
563
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
564 564
 
565 565
 /**
566 566
  * Retrieves estimated monthly earnings and sales
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
  */
571 571
 function give_estimated_monthly_stats() {
572 572
 
573
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
573
+	$estimated = get_transient('give_estimated_monthly_stats');
574 574
 
575
-	if ( false === $estimated ) {
575
+	if (false === $estimated) {
576 576
 
577 577
 		$estimated = array(
578 578
 			'earnings' => 0,
@@ -581,20 +581,20 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$stats = new Give_Payment_Stats;
583 583
 
584
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
585
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
584
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
585
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
586 586
 
587
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
588
-		$current_month = date( 'n', current_time( 'timestamp' ) );
589
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
590
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
587
+		$current_day   = date('d', current_time('timestamp'));
588
+		$current_month = date('n', current_time('timestamp'));
589
+		$current_year  = date('Y', current_time('timestamp'));
590
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
591 591
 
592
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
593
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
592
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
593
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
594 594
 
595 595
 		// Cache for one day
596
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
596
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
597 597
 	}
598 598
 
599
-	return maybe_unserialize( $estimated );
599
+	return maybe_unserialize($estimated);
600 600
 }
Please login to merge, or discard this patch.
includes/admin/reporting/pdf-reports.php 1 patch
Spacing   +146 added lines, -146 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,82 +25,82 @@  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( esc_html__( 'You do not have permission to generate PDF sales reports.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(esc_html__('You do not have permission to generate PDF sales reports.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/fpdf.php';
39
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/fpdf/give_pdf.php';
38
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/fpdf.php';
39
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/fpdf/give_pdf.php';
40 40
 
41 41
 	$daterange = utf8_decode(
42 42
 		sprintf(
43 43
 		/* translators: 1: start date 2: end date */
44
-			esc_html__( '%1$s to %2$s', 'give' ),
45
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
46
-			date_i18n( give_date_format() )
44
+			esc_html__('%1$s to %2$s', 'give'),
45
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
46
+			date_i18n(give_date_format())
47 47
 		)
48 48
 	);
49 49
 
50 50
 	$pdf = new give_pdf();
51
-	$pdf->AddPage( 'L', 'A4' );
51
+	$pdf->AddPage('L', 'A4');
52 52
 
53
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
54
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
55
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
53
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
54
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
55
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
56 56
 
57
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
57
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
58 58
 
59
-	$pdf->SetMargins( 8, 8, 8 );
60
-	$pdf->SetX( 8 );
59
+	$pdf->SetMargins(8, 8, 8);
60
+	$pdf->SetX(8);
61 61
 
62
-	$pdf->SetFont( 'Helvetica', '', 16 );
63
-	$pdf->SetTextColor( 50, 50, 50 );
64
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
62
+	$pdf->SetFont('Helvetica', '', 16);
63
+	$pdf->SetTextColor(50, 50, 50);
64
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
65 65
 
66
-	$pdf->SetFont( 'Helvetica', '', 13 );
66
+	$pdf->SetFont('Helvetica', '', 13);
67 67
 	$pdf->Ln();
68
-	$pdf->SetTextColor( 150, 150, 150 );
69
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
68
+	$pdf->SetTextColor(150, 150, 150);
69
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
70 70
 	$pdf->Ln();
71
-	$pdf->SetTextColor( 50, 50, 50 );
72
-	$pdf->SetFont( 'Helvetica', '', 14 );
73
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
74
-	$pdf->SetFont( 'Helvetica', '', 12 );
71
+	$pdf->SetTextColor(50, 50, 50);
72
+	$pdf->SetFont('Helvetica', '', 14);
73
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
74
+	$pdf->SetFont('Helvetica', '', 12);
75 75
 
76
-	$pdf->SetFillColor( 238, 238, 238 );
77
-	$pdf->Cell( 70, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
78
-	$pdf->Cell( 30, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
79
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
80
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
81
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
82
-	$pdf->Cell( 35, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
76
+	$pdf->SetFillColor(238, 238, 238);
77
+	$pdf->Cell(70, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
78
+	$pdf->Cell(30, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
79
+	$pdf->Cell(50, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
80
+	$pdf->Cell(50, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
81
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
82
+	$pdf->Cell(35, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
83 83
 
84
-	$year       = date( 'Y' );
85
-	$give_forms = get_posts( array( 'post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => - 1 ) );
84
+	$year       = date('Y');
85
+	$give_forms = get_posts(array('post_type' => 'give_forms', 'year' => $year, 'posts_per_page' => -1));
86 86
 
87
-	if ( $give_forms ):
88
-		$pdf->SetWidths( array( 70, 30, 50, 50, 45, 35 ) );
87
+	if ($give_forms):
88
+		$pdf->SetWidths(array(70, 30, 50, 50, 45, 35));
89 89
 
90
-		foreach ( $give_forms as $form ):
91
-			$pdf->SetFillColor( 255, 255, 255 );
90
+		foreach ($give_forms as $form):
91
+			$pdf->SetFillColor(255, 255, 255);
92 92
 
93 93
 			$title = $form->post_title;
94 94
 
95
-			if ( give_has_variable_prices( $form->ID ) ) {
95
+			if (give_has_variable_prices($form->ID)) {
96 96
 
97
-				$prices = give_get_variable_prices( $form->ID );
97
+				$prices = give_get_variable_prices($form->ID);
98 98
 
99 99
 				$first = $prices[0]['_give_amount'];
100
-				$last  = array_pop( $prices );
100
+				$last  = array_pop($prices);
101 101
 				$last  = $last['_give_amount'];
102 102
 
103
-				if ( $first < $last ) {
103
+				if ($first < $last) {
104 104
 					$min = $first;
105 105
 					$max = $last;
106 106
 				} else {
@@ -108,57 +108,57 @@  discard block
 block discarded – undo
108 108
 					$max = $first;
109 109
 				}
110 110
 
111
-				$price = html_entity_decode( give_currency_filter( give_format_amount( $min ) ) . ' - ' . give_currency_filter( give_format_amount( $max ) ) );
111
+				$price = html_entity_decode(give_currency_filter(give_format_amount($min)).' - '.give_currency_filter(give_format_amount($max)));
112 112
 			} else {
113
-				$price = html_entity_decode( give_currency_filter( give_get_form_price( $form->ID ) ) );
113
+				$price = html_entity_decode(give_currency_filter(give_get_form_price($form->ID)));
114 114
 			}
115 115
 
116
-			$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
117
-			$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
116
+			$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
117
+			$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
118 118
 
119
-			$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
120
-			$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
119
+			$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
120
+			$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
121 121
 
122
-			$sales    = give_get_form_sales_stats( $form->ID );
123
-			$link     = get_permalink( $form->ID );
124
-			$earnings = html_entity_decode( give_currency_filter( give_get_form_earnings_stats( $form->ID ) ) );
122
+			$sales    = give_get_form_sales_stats($form->ID);
123
+			$link     = get_permalink($form->ID);
124
+			$earnings = html_entity_decode(give_currency_filter(give_get_form_earnings_stats($form->ID)));
125 125
 
126
-			if ( function_exists( 'iconv' ) ) {
126
+			if (function_exists('iconv')) {
127 127
 				// Ensure characters like euro; are properly converted.
128
-				$price    = iconv( 'UTF-8', 'windows-1252', utf8_encode( $price ) );
129
-				$earnings = iconv( 'UTF-8', 'windows-1252', utf8_encode( $earnings ) );
128
+				$price    = iconv('UTF-8', 'windows-1252', utf8_encode($price));
129
+				$earnings = iconv('UTF-8', 'windows-1252', utf8_encode($earnings));
130 130
 			}
131 131
 
132
-			$pdf->Row( array( $title, $price, $categories, $tags, $sales, $earnings ) );
132
+			$pdf->Row(array($title, $price, $categories, $tags, $sales, $earnings));
133 133
 		endforeach;
134 134
 	else:
135
-		$pdf->SetWidths( array( 280 ) );
135
+		$pdf->SetWidths(array(280));
136 136
 		$title = utf8_decode(
137 137
 			sprintf(
138 138
 			/* translators: %s: form plural label */
139
-				esc_html__( 'No %s found.', 'give' ),
139
+				esc_html__('No %s found.', 'give'),
140 140
 				give_get_forms_label_plural()
141 141
 			)
142 142
 		);
143
-		$pdf->Row( array( $title ) );
143
+		$pdf->Row(array($title));
144 144
 	endif;
145 145
 
146 146
 	$pdf->Ln();
147
-	$pdf->SetTextColor( 50, 50, 50 );
148
-	$pdf->SetFont( 'Helvetica', '', 14 );
149
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
150
-	$pdf->SetFont( 'Helvetica', '', 12 );
151
-
152
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
153
-	$image = str_replace( ' ', '%20', $image );
154
-
155
-	$pdf->SetX( 25 );
156
-	$pdf->Image( $image . '&file=.png' );
157
-	$pdf->Ln( 7 );
158
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
147
+	$pdf->SetTextColor(50, 50, 50);
148
+	$pdf->SetFont('Helvetica', '', 14);
149
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
150
+	$pdf->SetFont('Helvetica', '', 12);
151
+
152
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
153
+	$image = str_replace(' ', '%20', $image);
154
+
155
+	$pdf->SetX(25);
156
+	$pdf->Image($image.'&file=.png');
157
+	$pdf->Ln(7);
158
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
159 159
 }
160 160
 
161
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
161
+add_action('give_generate_pdf', 'give_generate_pdf');
162 162
 
163 163
 /**
164 164
  * Draws Chart for PDF Report.
@@ -175,38 +175,38 @@  discard block
 block discarded – undo
175 175
  * @return string $chart->getUrl() URL for the Google Chart
176 176
  */
177 177
 function give_draw_chart_image() {
178
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
179
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
178
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
179
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
180
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
181 181
 
182
-	$chart = new GoogleChart( 'lc', 900, 330 );
182
+	$chart = new GoogleChart('lc', 900, 330);
183 183
 
184 184
 	$i        = 1;
185 185
 	$earnings = "";
186 186
 	$sales    = "";
187 187
 
188
-	while ( $i <= 12 ) :
189
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
190
-		$sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
191
-		$i ++;
188
+	while ($i <= 12) :
189
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
190
+		$sales .= give_get_sales_by_date(null, $i, date('Y')).",";
191
+		$i++;
192 192
 	endwhile;
193 193
 
194
-	$earnings_array = explode( ",", $earnings );
195
-	$sales_array    = explode( ",", $sales );
194
+	$earnings_array = explode(",", $earnings);
195
+	$sales_array    = explode(",", $sales);
196 196
 
197 197
 	$i = 0;
198
-	while ( $i <= 11 ) {
199
-		if ( empty( $sales_array[ $i ] ) ) {
200
-			$sales_array[ $i ] = 0;
198
+	while ($i <= 11) {
199
+		if (empty($sales_array[$i])) {
200
+			$sales_array[$i] = 0;
201 201
 		}
202
-		$i ++;
202
+		$i++;
203 203
 	}
204 204
 
205 205
 	$min_earnings   = 0;
206
-	$max_earnings   = max( $earnings_array );
207
-	$earnings_scale = round( $max_earnings, - 1 );
206
+	$max_earnings   = max($earnings_array);
207
+	$earnings_scale = round($max_earnings, - 1);
208 208
 
209
-	$data = new GoogleChartData( array(
209
+	$data = new GoogleChartData(array(
210 210
 		$earnings_array[0],
211 211
 		$earnings_array[1],
212 212
 		$earnings_array[2],
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
 		$earnings_array[9],
220 220
 		$earnings_array[10],
221 221
 		$earnings_array[11]
222
-	) );
222
+	));
223 223
 
224
-	$data->setLegend( esc_html__( 'Income', 'give' ) );
225
-	$data->setColor( '1b58a3' );
226
-	$chart->addData( $data );
224
+	$data->setLegend(esc_html__('Income', 'give'));
225
+	$data->setColor('1b58a3');
226
+	$chart->addData($data);
227 227
 
228
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
229
-	$shape_marker->setColor( '000000' );
230
-	$shape_marker->setSize( 7 );
231
-	$shape_marker->setBorder( 2 );
232
-	$shape_marker->setData( $data );
233
-	$chart->addMarker( $shape_marker );
228
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
229
+	$shape_marker->setColor('000000');
230
+	$shape_marker->setSize(7);
231
+	$shape_marker->setBorder(2);
232
+	$shape_marker->setData($data);
233
+	$chart->addMarker($shape_marker);
234 234
 
235
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
236
-	$value_marker->setColor( '000000' );
237
-	$value_marker->setData( $data );
238
-	$chart->addMarker( $value_marker );
235
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
236
+	$value_marker->setColor('000000');
237
+	$value_marker->setData($data);
238
+	$chart->addMarker($value_marker);
239 239
 
240
-	$data = new GoogleChartData( array(
240
+	$data = new GoogleChartData(array(
241 241
 		$sales_array[0],
242 242
 		$sales_array[1],
243 243
 		$sales_array[2],
@@ -250,46 +250,46 @@  discard block
 block discarded – undo
250 250
 		$sales_array[9],
251 251
 		$sales_array[10],
252 252
 		$sales_array[11]
253
-	) );
254
-	$data->setLegend( esc_html__( 'Donations', 'give' ) );
255
-	$data->setColor( 'ff6c1c' );
256
-	$chart->addData( $data );
257
-
258
-	$chart->setTitle( esc_html__( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
259
-
260
-	$chart->setScale( 0, $max_earnings );
261
-
262
-	$y_axis = new GoogleChartAxis( 'y' );
263
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
264
-	$chart->addAxis( $y_axis );
265
-
266
-	$x_axis = new GoogleChartAxis( 'x' );
267
-	$x_axis->setTickMarks( 5 );
268
-	$x_axis->setLabels( array(
269
-		esc_html__( 'Jan', 'give' ),
270
-		esc_html__( 'Feb', 'give' ),
271
-		esc_html__( 'Mar', 'give' ),
272
-		esc_html__( 'Apr', 'give' ),
273
-		esc_html__( 'May', 'give' ),
274
-		esc_html__( 'June', 'give' ),
275
-		esc_html__( 'July', 'give' ),
276
-		esc_html__( 'Aug', 'give' ),
277
-		esc_html__( 'Sept', 'give' ),
278
-		esc_html__( 'Oct', 'give' ),
279
-		esc_html__( 'Nov', 'give' ),
280
-		esc_html__( 'Dec', 'give' )
281
-	) );
282
-	$chart->addAxis( $x_axis );
283
-
284
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
285
-	$shape_marker->setSize( 6 );
286
-	$shape_marker->setBorder( 2 );
287
-	$shape_marker->setData( $data );
288
-	$chart->addMarker( $shape_marker );
289
-
290
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
291
-	$value_marker->setData( $data );
292
-	$chart->addMarker( $value_marker );
253
+	));
254
+	$data->setLegend(esc_html__('Donations', 'give'));
255
+	$data->setColor('ff6c1c');
256
+	$chart->addData($data);
257
+
258
+	$chart->setTitle(esc_html__('Donations by Month for all Give Forms', 'give'), '336699', 18);
259
+
260
+	$chart->setScale(0, $max_earnings);
261
+
262
+	$y_axis = new GoogleChartAxis('y');
263
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
264
+	$chart->addAxis($y_axis);
265
+
266
+	$x_axis = new GoogleChartAxis('x');
267
+	$x_axis->setTickMarks(5);
268
+	$x_axis->setLabels(array(
269
+		esc_html__('Jan', 'give'),
270
+		esc_html__('Feb', 'give'),
271
+		esc_html__('Mar', 'give'),
272
+		esc_html__('Apr', 'give'),
273
+		esc_html__('May', 'give'),
274
+		esc_html__('June', 'give'),
275
+		esc_html__('July', 'give'),
276
+		esc_html__('Aug', 'give'),
277
+		esc_html__('Sept', 'give'),
278
+		esc_html__('Oct', 'give'),
279
+		esc_html__('Nov', 'give'),
280
+		esc_html__('Dec', 'give')
281
+	));
282
+	$chart->addAxis($x_axis);
283
+
284
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
285
+	$shape_marker->setSize(6);
286
+	$shape_marker->setBorder(2);
287
+	$shape_marker->setData($data);
288
+	$chart->addMarker($shape_marker);
289
+
290
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
291
+	$value_marker->setData($data);
292
+	$chart->addMarker($value_marker);
293 293
 
294 294
 	return $chart->getUrl();
295 295
 }
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-earnings.php 1 patch
Spacing   +28 added lines, -28 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
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => esc_html__( 'Date', 'give' ),
65
-			'donations' => esc_html__( 'Donations', 'give' ),
64
+			'date'      => esc_html__('Date', 'give'),
65
+			'donations' => esc_html__('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( esc_html__( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) )
67
+			'earnings'  => sprintf(esc_html__('Income (%s)', 'give'), html_entity_decode(give_currency_filter('')))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if donation ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	<h1 id="transaction-details-heading"><?php
54 54
 		printf(
55 55
 		/* translators: %s: donation number */
56
-			esc_html__( 'Donation %s', 'give' ),
56
+			esc_html__('Donation %s', 'give'),
57 57
 			$number
58 58
 		);
59
-		if ( $payment_mode == 'test' ) {
60
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
59
+		if ($payment_mode == 'test') {
60
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
61 61
 		}
62 62
 		?></h1>
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param int $payment_id Payment id.
71 71
 	 */
72
-	do_action( 'give_view_order_details_before', $payment_id );
72
+	do_action('give_view_order_details_before', $payment_id);
73 73
 	?>
74 74
 	<form id="give-edit-order-form" method="post">
75 75
 		<?php
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @param int $payment_id Payment id.
82 82
 		 */
83
-		do_action( 'give_view_order_details_form_top', $payment_id );
83
+		do_action('give_view_order_details_form_top', $payment_id);
84 84
 		?>
85 85
 		<div id="poststuff">
86 86
 			<div id="give-dashboard-widgets-wrap">
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 							 *
97 97
 							 * @param int $payment_id Payment id.
98 98
 							 */
99
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
99
+							do_action('give_view_order_details_sidebar_before', $payment_id);
100 100
 							?>
101 101
 
102 102
 							<div id="give-order-update" class="postbox give-order-data">
103 103
 
104
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
104
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
105 105
 
106 106
 								<div class="inside">
107 107
 									<div class="give-admin-box">
@@ -114,33 +114,33 @@  discard block
 block discarded – undo
114 114
 										 *
115 115
 										 * @param int $payment_id Payment id.
116 116
 										 */
117
-										do_action( 'give_view_order_details_totals_before', $payment_id );
117
+										do_action('give_view_order_details_totals_before', $payment_id);
118 118
 										?>
119 119
 
120 120
 										<div class="give-admin-box-inside">
121 121
 											<p>
122
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
122
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
123 123
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
124
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
125
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
124
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
125
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
126 126
 													<?php endforeach; ?>
127 127
 												</select>
128
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
128
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
129 129
 											</p>
130 130
 										</div>
131 131
 
132 132
 										<div class="give-admin-box-inside">
133 133
 											<p>
134
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
135
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
134
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
135
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
136 136
 											</p>
137 137
 										</div>
138 138
 
139 139
 										<div class="give-admin-box-inside">
140 140
 											<p>
141
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
142
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
141
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
142
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
143
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
144 144
 											</p>
145 145
 										</div>
146 146
 
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
 										 *
155 155
 										 * @param int $payment_id Payment id.
156 156
 										 */
157
-										do_action( 'give_view_order_details_update_inner', $payment_id );
157
+										do_action('give_view_order_details_update_inner', $payment_id);
158 158
 
159 159
 										//@TODO: Fees
160
-										$fees = give_get_payment_fees( $payment_id );
161
-										if ( ! empty( $fees ) ) : ?>
160
+										$fees = give_get_payment_fees($payment_id);
161
+										if ( ! empty($fees)) : ?>
162 162
 											<div class="give-order-fees give-admin-box-inside">
163
-												<p class="strong"><?php esc_html_e( 'Fees:', 'give' ); ?></p>
163
+												<p class="strong"><?php esc_html_e('Fees:', 'give'); ?></p>
164 164
 												<ul class="give-payment-fees">
165
-													<?php foreach ( $fees as $fee ) : ?>
165
+													<?php foreach ($fees as $fee) : ?>
166 166
 														<li>
167 167
 															<span class="fee-label"><?php echo $fee['label']; ?>:</span>
168
-															<span class="fee-amount" data-fee="<?php echo esc_attr( $fee['amount'] ); ?>"><?php echo give_currency_filter( $fee['amount'], $currency_code ); ?></span>
168
+															<span class="fee-amount" data-fee="<?php echo esc_attr($fee['amount']); ?>"><?php echo give_currency_filter($fee['amount'], $currency_code); ?></span>
169 169
 														</li>
170 170
 													<?php endforeach; ?>
171 171
 												</ul>
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 
175 175
 										<div class="give-order-payment give-admin-box-inside">
176 176
 											<p>
177
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
178
-												<?php echo give_currency_symbol( $payment->currency ); ?>&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
177
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
178
+												<?php echo give_currency_symbol($payment->currency); ?>&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
179 179
 											</p>
180 180
 										</div>
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 										 *
188 188
 										 * @param int $payment_id Payment id.
189 189
 										 */
190
-										do_action( 'give_view_order_details_totals_after', $payment_id );
190
+										do_action('give_view_order_details_totals_after', $payment_id);
191 191
 										?>
192 192
 
193 193
 									</div>
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 									 *
206 206
 									 * @param int $payment_id Payment id.
207 207
 									 */
208
-									do_action( 'give_view_order_details_update_before', $payment_id );
208
+									do_action('give_view_order_details_update_before', $payment_id);
209 209
 									?>
210 210
 
211 211
 									<div id="major-publishing-actions">
212 212
 										<div id="publishing-action">
213
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
214
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
215
-												<a href="<?php echo esc_url( add_query_arg( array(
213
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
214
+											<?php if (give_is_payment_complete($payment_id)) : ?>
215
+												<a href="<?php echo esc_url(add_query_arg(array(
216 216
 													'give-action' => 'email_links',
217 217
 													'purchase_id' => $payment_id
218
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e( 'Resend Receipt', 'give' ); ?></a>
218
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php esc_html_e('Resend Receipt', 'give'); ?></a>
219 219
 											<?php endif; ?>
220 220
 										</div>
221 221
 										<div class="clear"></div>
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 									 *
230 230
 									 * @param int $payment_id Payment id.
231 231
 									 */
232
-									do_action( 'give_view_order_details_update_after', $payment_id );
232
+									do_action('give_view_order_details_update_after', $payment_id);
233 233
 									?>
234 234
 
235 235
 								</div>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 							<div id="give-order-details" class="postbox give-order-data">
242 242
 
243
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
243
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
244 244
 
245 245
 								<div class="inside">
246 246
 									<div class="give-admin-box">
@@ -253,44 +253,44 @@  discard block
 block discarded – undo
253 253
 										 *
254 254
 										 * @param int $payment_id Payment id.
255 255
 										 */
256
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
256
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
257 257
 
258
-										$gateway = give_get_payment_gateway( $payment_id );
259
-										if ( $gateway ) : ?>
258
+										$gateway = give_get_payment_gateway($payment_id);
259
+										if ($gateway) : ?>
260 260
 											<div class="give-order-gateway give-admin-box-inside">
261 261
 												<p>
262
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
263
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
262
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
263
+													<?php echo give_get_gateway_admin_label($gateway); ?>
264 264
 												</p>
265 265
 											</div>
266 266
 										<?php endif; ?>
267 267
 
268 268
 										<div class="give-order-payment-key give-admin-box-inside">
269 269
 											<p>
270
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
271
-												<?php echo give_get_payment_key( $payment_id ); ?>
270
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
271
+												<?php echo give_get_payment_key($payment_id); ?>
272 272
 											</p>
273 273
 										</div>
274 274
 
275 275
 										<div class="give-order-ip give-admin-box-inside">
276 276
 											<p>
277
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
278
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
277
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
278
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
279 279
 											</p>
280 280
 										</div>
281 281
 
282
-										<?php if ( $transaction_id ) : ?>
282
+										<?php if ($transaction_id) : ?>
283 283
 											<div class="give-order-tx-id give-admin-box-inside">
284 284
 												<p>
285
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
286
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
285
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
286
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
287 287
 												</p>
288 288
 											</div>
289 289
 										<?php endif; ?>
290 290
 
291 291
 										<div class="give-admin-box-inside">
292
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
293
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
292
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
293
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
294 294
 											</p>
295 295
 										</div>
296 296
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 										 *
303 303
 										 * @param int $payment_id Payment id.
304 304
 										 */
305
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
305
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
306 306
 										?>
307 307
 
308 308
 									</div>
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 							 *
323 323
 							 * @param int $payment_id Payment id.
324 324
 							 */
325
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
325
+							do_action('give_view_order_details_sidebar_after', $payment_id);
326 326
 							?>
327 327
 
328 328
 						</div>
@@ -342,50 +342,50 @@  discard block
 block discarded – undo
342 342
 							 *
343 343
 							 * @param int $payment_id Payment id.
344 344
 							 */
345
-							do_action( 'give_view_order_details_main_before', $payment_id );
345
+							do_action('give_view_order_details_main_before', $payment_id);
346 346
 							?>
347 347
 
348 348
 							<?php $column_count = 'columns-3'; ?>
349 349
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
350
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
350
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
351 351
 
352 352
 								<div class="inside">
353 353
 
354 354
 									<div class="column-container">
355 355
 										<div class="column">
356 356
 											<p>
357
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
357
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
358 358
 												<?php
359
-												if ( $payment_meta['form_id'] ) :
359
+												if ($payment_meta['form_id']) :
360 360
 													printf(
361 361
 														'<a href="%1$s" target="_blank">#%2$s</a>',
362
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
362
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
363 363
 														$payment_meta['form_id']
364 364
 													);
365 365
 												endif;
366 366
 												?>
367 367
 											</p>
368 368
 											<p>
369
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
370
-												<?php give_get_form_dropdown( array(
369
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
370
+												<?php give_get_form_dropdown(array(
371 371
 													'id'       => $payment_meta['form_id'],
372 372
 													'selected' => $payment_meta['form_id'],
373 373
 													'chosen'   => true
374
-												), true ); ?>
374
+												), true); ?>
375 375
 											</p>
376 376
 										</div>
377 377
 										<div class="column">
378 378
 											<p>
379
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
380
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
379
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
380
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
381 381
 											</p>
382 382
 											<p>
383
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
383
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
384 384
 												<span class="give-donation-level">
385 385
 													<?php
386
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
387
-													if ( empty( $var_prices ) ) {
388
-														echo esc_html__( 'n/a', 'give' );
386
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
387
+													if (empty($var_prices)) {
388
+														echo esc_html__('n/a', 'give');
389 389
 													} else {
390 390
 														// Variable price dropdown options.
391 391
 														$variable_price_dropdown_option = array(
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 															'selected'        => $payment_meta['price_id'],
397 397
 														);
398 398
 														// Render variable prices select tag html.
399
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
399
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
400 400
 													}
401 401
 													?>
402 402
 												</span>
@@ -404,8 +404,8 @@  discard block
 block discarded – undo
404 404
 										</div>
405 405
 										<div class="column">
406 406
 											<p>
407
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
408
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?>
407
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
408
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?>
409 409
 											</p>
410 410
 											<p>
411 411
 												<?php
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 												 *
419 419
 												 * @param int $payment_id Payment id.
420 420
 												 */
421
-												do_action( 'give_donation_details_thead_before', $payment_id );
421
+												do_action('give_donation_details_thead_before', $payment_id);
422 422
 
423 423
 
424 424
 												/**
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 												 *
431 431
 												 * @param int $payment_id Payment id.
432 432
 												 */
433
-												do_action( 'give_donation_details_thead_after', $payment_id );
433
+												do_action('give_donation_details_thead_after', $payment_id);
434 434
 
435 435
 												/**
436 436
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -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_tbody_before', $payment_id );
444
+												do_action('give_donation_details_tbody_before', $payment_id);
445 445
 
446 446
 												/**
447 447
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 												 *
453 453
 												 * @param int $payment_id Payment id.
454 454
 												 */
455
-												do_action( 'give_donation_details_tbody_after', $payment_id );
455
+												do_action('give_donation_details_tbody_after', $payment_id);
456 456
 												?>
457 457
 											</p>
458 458
 										</div>
@@ -472,57 +472,57 @@  discard block
 block discarded – undo
472 472
 							 *
473 473
 							 * @param int $payment_id Payment id.
474 474
 							 */
475
-							do_action( 'give_view_order_details_files_after', $payment_id );
475
+							do_action('give_view_order_details_files_after', $payment_id);
476 476
 							?>
477 477
 
478 478
 							<div id="give-donor-details" class="postbox">
479
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
479
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
480 480
 
481 481
 								<div class="inside">
482 482
 
483
-									<?php $customer = new Give_Customer( $customer_id ); ?>
483
+									<?php $customer = new Give_Customer($customer_id); ?>
484 484
 
485 485
 									<div class="column-container customer-info">
486 486
 										<div class="column">
487 487
 											<p>
488
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
488
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
489 489
 												<?php
490
-												if ( ! empty( $customer->id ) ) :
490
+												if ( ! empty($customer->id)) :
491 491
 													printf(
492 492
 														'<a href="%1$s" target="_blank">#%2$s</a>',
493
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ),
493
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id),
494 494
 														$customer->id
495 495
 													);
496 496
 												endif;
497 497
 												?>
498 498
 											</p>
499 499
 											<p>
500
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
501
-												<?php echo date_i18n( give_date_format(), strtotime( $customer->date_created ) ) ?>
500
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
501
+												<?php echo date_i18n(give_date_format(), strtotime($customer->date_created)) ?>
502 502
 											</p>
503 503
 										</div>
504 504
 										<div class="column">
505 505
 											<p>
506
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
506
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
507 507
 												<?php echo $customer->name; ?>
508 508
 											</p>
509 509
 											<p>
510
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
510
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
511 511
 												<?php echo $customer->email; ?>
512 512
 											</p>
513 513
 										</div>
514 514
 										<div class="column">
515 515
 											<p>
516
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
516
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
517 517
 												<?php
518
-												echo Give()->html->donor_dropdown( array(
518
+												echo Give()->html->donor_dropdown(array(
519 519
 													'selected' => $customer->id,
520 520
 													'name'     => 'customer-id'
521
-												) );
521
+												));
522 522
 												?>
523 523
 											</p>
524 524
 											<p>
525
-												<a href="#new" class="give-payment-new-customer"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
525
+												<a href="#new" class="give-payment-new-customer"><?php esc_html_e('Create New Donor', 'give'); ?></a>
526 526
 											</p>
527 527
 										</div>
528 528
 									</div>
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 									<div class="column-container new-customer" style="display: none">
531 531
 										<div class="column">
532 532
 											<p>
533
-												<label for="give-new-customer-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
533
+												<label for="give-new-customer-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
534 534
 												<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
535 535
 											</p>
536 536
 										</div>
537 537
 										<div class="column">
538 538
 											<p>
539
-												<label for="give-new-customer-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
539
+												<label for="give-new-customer-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
540 540
 												<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
541 541
 											</p>
542 542
 										</div>
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 											<p>
545 545
 												<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
546 546
 												<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
547
-												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
547
+												<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
548 548
 												<br>
549
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
549
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
550 550
 											</p>
551 551
 										</div>
552 552
 									</div>
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 									 * @param array $payment_meta Payment meta.
563 563
 									 * @param array $user_info User information.
564 564
 									 */
565
-									do_action( 'give_donation_personal_details_list', $payment_meta, $user_info );
565
+									do_action('give_donation_personal_details_list', $payment_meta, $user_info);
566 566
 
567 567
 									/**
568 568
 									 * Fires in order details page, in the donor-details metabox.
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 									 *
572 572
 									 * @param int $payment_id Payment id.
573 573
 									 */
574
-									do_action( 'give_donation_view_details', $payment_id );
574
+									do_action('give_donation_view_details', $payment_id);
575 575
 									?>
576 576
 
577 577
 								</div>
@@ -587,11 +587,11 @@  discard block
 block discarded – undo
587 587
 							 *
588 588
 							 * @param int $payment_id Payment id.
589 589
 							 */
590
-							do_action( 'give_view_order_details_billing_before', $payment_id );
590
+							do_action('give_view_order_details_billing_before', $payment_id);
591 591
 							?>
592 592
 
593 593
 							<div id="give-billing-details" class="postbox">
594
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
594
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
595 595
 
596 596
 								<div class="inside">
597 597
 
@@ -601,57 +601,57 @@  discard block
 block discarded – undo
601 601
 											<div class="data column-container">
602 602
 												<div class="column">
603 603
 													<div class="give-wrap-address-line1">
604
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
605
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
604
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
605
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
606 606
 													</div>
607 607
 													<div class="give-wrap-address-line2">
608
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
609
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
608
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
609
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
610 610
 													</div>
611 611
 												</div>
612 612
 												<div class="column">
613 613
 													<div class="give-wrap-address-city">
614
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
615
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
614
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
615
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
616 616
 													</div>
617 617
 													<div class="give-wrap-address-zip">
618
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
619
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
618
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
619
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
620 620
 
621 621
 													</div>
622 622
 												</div>
623 623
 												<div class="column">
624 624
 													<div id="give-order-address-country-wrap">
625
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
625
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
626 626
 														<?php
627
-														echo Give()->html->select( array(
627
+														echo Give()->html->select(array(
628 628
 															'options'          => give_get_country_list(),
629 629
 															'name'             => 'give-payment-address[0][country]',
630 630
 															'selected'         => $address['country'],
631 631
 															'show_option_all'  => false,
632 632
 															'show_option_none' => false,
633 633
 															'chosen'           => true,
634
-															'placeholder'      => esc_attr__( 'Select a country', 'give' )
635
-														) );
634
+															'placeholder'      => esc_attr__('Select a country', 'give')
635
+														));
636 636
 														?>
637 637
 													</div>
638 638
 													<div id="give-order-address-state-wrap">
639
-														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province:', 'give' ); ?></label>
639
+														<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province:', 'give'); ?></label>
640 640
 														<?php
641
-														$states = give_get_states( $address['country'] );
642
-														if ( ! empty( $states ) ) {
643
-															echo Give()->html->select( array(
641
+														$states = give_get_states($address['country']);
642
+														if ( ! empty($states)) {
643
+															echo Give()->html->select(array(
644 644
 																'options'          => $states,
645 645
 																'name'             => 'give-payment-address[0][state]',
646 646
 																'selected'         => $address['state'],
647 647
 																'show_option_all'  => false,
648 648
 																'show_option_none' => false,
649 649
 																'chosen'           => true,
650
-																'placeholder'      => esc_attr__( 'Select a state', 'give' )
651
-															) );
650
+																'placeholder'      => esc_attr__('Select a state', 'give')
651
+															));
652 652
 														} else {
653 653
 															?>
654
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
654
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
655 655
 															<?php
656 656
 														} ?>
657 657
 													</div>
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 									 *
672 672
 									 * @param int $payment_id Payment id.
673 673
 									 */
674
-									do_action( 'give_donation_billing_details', $payment_id );
674
+									do_action('give_donation_billing_details', $payment_id);
675 675
 									?>
676 676
 
677 677
 								</div>
@@ -687,32 +687,32 @@  discard block
 block discarded – undo
687 687
 							 *
688 688
 							 * @param int $payment_id Payment id.
689 689
 							 */
690
-							do_action( 'give_view_order_details_billing_after', $payment_id );
690
+							do_action('give_view_order_details_billing_after', $payment_id);
691 691
 							?>
692 692
 
693 693
 							<div id="give-payment-notes" class="postbox">
694
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
694
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
695 695
 
696 696
 								<div class="inside">
697 697
 									<div id="give-payment-notes-inner">
698 698
 										<?php
699
-										$notes = give_get_payment_notes( $payment_id );
700
-										if ( ! empty( $notes ) ) :
699
+										$notes = give_get_payment_notes($payment_id);
700
+										if ( ! empty($notes)) :
701 701
 											$no_notes_display = ' style="display:none;"';
702
-											foreach ( $notes as $note ) :
702
+											foreach ($notes as $note) :
703 703
 
704
-												echo give_get_payment_note_html( $note, $payment_id );
704
+												echo give_get_payment_note_html($note, $payment_id);
705 705
 
706 706
 											endforeach;
707 707
 										else :
708 708
 											$no_notes_display = '';
709 709
 										endif;
710
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; ?>
710
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; ?>
711 711
 									</div>
712 712
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
713 713
 
714 714
 									<div class="give-clearfix">
715
-										<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>
715
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
716 716
 									</div>
717 717
 
718 718
 								</div>
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 							 *
729 729
 							 * @param int $payment_id Payment id.
730 730
 							 */
731
-							do_action( 'give_view_order_details_main_after', $payment_id );
731
+							do_action('give_view_order_details_main_after', $payment_id);
732 732
 							?>
733 733
 
734 734
 						</div>
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
 		 *
751 751
 		 * @param int $payment_id Payment id.
752 752
 		 */
753
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
753
+		do_action('give_view_order_details_form_bottom', $payment_id);
754 754
 
755
-		wp_nonce_field( 'give_update_payment_details_nonce' );
755
+		wp_nonce_field('give_update_payment_details_nonce');
756 756
 		?>
757
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
757
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
758 758
 		<input type="hidden" name="give_action" value="update_payment_details"/>
759 759
 	</form>
760 760
 	<?php
@@ -765,6 +765,6 @@  discard block
 block discarded – undo
765 765
 	 *
766 766
 	 * @param int $payment_id Payment id.
767 767
 	 */
768
-	do_action( 'give_view_order_details_after', $payment_id );
768
+	do_action('give_view_order_details_after', $payment_id);
769 769
 	?>
770 770
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Payment History Page
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 */
24 24
 function give_payment_history_page() {
25 25
 
26
-	$give_payment = get_post_type_object( 'give_payment' );
26
+	$give_payment = get_post_type_object('give_payment');
27 27
 
28
-	if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) {
29
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php';
28
+	if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) {
29
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php';
30 30
 	} else {
31
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
31
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
32 32
 		$payments_table = new Give_Payment_History_Table();
33 33
 		$payments_table->prepare_items();
34 34
 	?>
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 		 *
43 43
 		 * @since 1.7
44 44
 		 */
45
-		do_action( 'give_donations_page_top' );
45
+		do_action('give_donations_page_top');
46 46
 		?>
47 47
 
48
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
48
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
49 49
 			<input type="hidden" name="post_type" value="give_forms" />
50 50
 			<input type="hidden" name="page" value="give-payment-history" />
51 51
 			<?php $payments_table->views() ?>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.7
61 61
 		 */
62
-		do_action( 'give_donations_page_bottom' );
62
+		do_action('give_donations_page_bottom');
63 63
 		?>
64 64
 
65 65
 	</div>
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
  * @param $title
77 77
  * @return string
78 78
  */
79
-function give_view_order_details_title( $admin_title, $title ) {
79
+function give_view_order_details_title($admin_title, $title) {
80 80
 
81
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
81
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base)
82 82
 		return $admin_title;
83 83
 
84
-	if( ! isset( $_GET['give-action'] ) )
84
+	if ( ! isset($_GET['give-action']))
85 85
 		return $admin_title;
86 86
 
87
-	switch( $_GET['give-action'] ) :
87
+	switch ($_GET['give-action']) :
88 88
 
89 89
 		case 'view-order-details' :
90 90
 			$title = sprintf(
91 91
 				/* translators: %s: admin title */
92
-				esc_html__( 'View Donation Details - %s', 'give' ),
92
+				esc_html__('View Donation Details - %s', 'give'),
93 93
 				$admin_title
94 94
 			);
95 95
 			break;
96 96
 		case 'edit-payment' :
97 97
 			$title = sprintf(
98 98
 				/* translators: %s: admin title */
99
-				esc_html__( 'Edit Donation - %s', 'give' ),
99
+				esc_html__('Edit Donation - %s', 'give'),
100 100
 				$admin_title
101 101
 			);
102 102
 			break;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	return $title;
109 109
 }
110
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
110
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
111 111
 
112 112
 /**
113 113
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
  * @param $context
120 120
  * @return string
121 121
  */
122
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
122
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
123 123
 
124
-	$post = get_post( $post_id );
125
-	if( ! $post )
124
+	$post = get_post($post_id);
125
+	if ( ! $post)
126 126
 		return $url;
127 127
 
128
-	if( 'give_payment' != $post->post_type )
128
+	if ('give_payment' != $post->post_type)
129 129
 		return $url;
130 130
 
131
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
131
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id);
132 132
 
133 133
 	return $url;
134 134
 }
135
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
135
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -118,37 +118,37 @@  discard block
 block discarded – undo
118 118
 	public function __construct() {
119 119
 
120 120
 		// Set parent defaults
121
-		parent::__construct( array(
122
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
123
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
121
+		parent::__construct(array(
122
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
123
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
124 124
 			'ajax'     => false                        // Does this table support ajax?
125
-		) );
125
+		));
126 126
 
127 127
 		$this->get_payment_counts();
128 128
 		$this->process_bulk_action();
129
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
129
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
130 130
 	}
131 131
 
132 132
 	public function advanced_filters() {
133
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
134
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
135
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : '';
133
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
134
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
135
+		$status     = isset($_GET['status']) ? $_GET['status'] : '';
136 136
 		?>
137 137
 		<div id="give-payment-filters">
138 138
 			<span id="give-payment-date-filters">
139
-				<label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label>
139
+				<label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label>
140 140
 				<input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/>
141
-				<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label>
141
+				<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label>
142 142
 				<input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/>
143
-				<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/>
143
+				<input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/>
144 144
 			</span>
145
-			<?php if ( ! empty( $status ) ) : ?>
146
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/>
145
+			<?php if ( ! empty($status)) : ?>
146
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/>
147 147
 			<?php endif; ?>
148
-			<?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?>
149
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a>
148
+			<?php if ( ! empty($start_date) || ! empty($end_date)) : ?>
149
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a>
150 150
 			<?php endif; ?>
151
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
151
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
152 152
 		</div>
153 153
 
154 154
 		<?php
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return void
167 167
 	 */
168
-	public function search_box( $text, $input_id ) {
169
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
168
+	public function search_box($text, $input_id) {
169
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
170 170
 			return;
171 171
 		}
172 172
 
173
-		$input_id = $input_id . '-search-input';
173
+		$input_id = $input_id.'-search-input';
174 174
 
175
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
176
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
175
+		if ( ! empty($_REQUEST['orderby'])) {
176
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
177 177
 		}
178
-		if ( ! empty( $_REQUEST['order'] ) ) {
179
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
178
+		if ( ! empty($_REQUEST['order'])) {
179
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
180 180
 		}
181 181
 		?>
182 182
 		<p class="search-box" role="search">
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 			 *
189 189
 			 * @since 1.7
190 190
 			 */
191
-			do_action( 'give_donation_history_search' );
191
+			do_action('give_donation_history_search');
192 192
 			?>
193 193
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
194 194
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
195
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/>
195
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/>
196 196
 		</p>
197 197
 		<?php
198 198
 	}
@@ -206,52 +206,52 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	public function get_views() {
208 208
 
209
-		$current         = isset( $_GET['status'] ) ? $_GET['status'] : '';
210
-		$total_count     = '&nbsp;<span class="count">(' . $this->total_count . ')</span>';
211
-		$complete_count  = '&nbsp;<span class="count">(' . $this->complete_count . ')</span>';
212
-		$cancelled_count = '&nbsp;<span class="count">(' . $this->cancelled_count . ')</span>';
213
-		$pending_count   = '&nbsp;<span class="count">(' . $this->pending_count . ')</span>';
214
-		$refunded_count  = '&nbsp;<span class="count">(' . $this->refunded_count . ')</span>';
215
-		$failed_count    = '&nbsp;<span class="count">(' . $this->failed_count . ')</span>';
216
-		$abandoned_count = '&nbsp;<span class="count">(' . $this->abandoned_count . ')</span>';
217
-		$revoked_count   = '&nbsp;<span class="count">(' . $this->revoked_count . ')</span>';
209
+		$current         = isset($_GET['status']) ? $_GET['status'] : '';
210
+		$total_count     = '&nbsp;<span class="count">('.$this->total_count.')</span>';
211
+		$complete_count  = '&nbsp;<span class="count">('.$this->complete_count.')</span>';
212
+		$cancelled_count = '&nbsp;<span class="count">('.$this->cancelled_count.')</span>';
213
+		$pending_count   = '&nbsp;<span class="count">('.$this->pending_count.')</span>';
214
+		$refunded_count  = '&nbsp;<span class="count">('.$this->refunded_count.')</span>';
215
+		$failed_count    = '&nbsp;<span class="count">('.$this->failed_count.')</span>';
216
+		$abandoned_count = '&nbsp;<span class="count">('.$this->abandoned_count.')</span>';
217
+		$revoked_count   = '&nbsp;<span class="count">('.$this->revoked_count.')</span>';
218 218
 
219 219
 		$views = array(
220
-			'all'       => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array(
220
+			'all'       => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array(
221 221
 				'status',
222 222
 				'paged'
223
-			) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ),
224
-			'publish'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
223
+			)), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count),
224
+			'publish'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
225 225
 				'status' => 'publish',
226 226
 				'paged'  => false
227
-			) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ),
228
-			'pending'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
227
+			))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count),
228
+			'pending'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
229 229
 				'status' => 'pending',
230 230
 				'paged'  => false
231
-			) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ),
232
-			'refunded'  => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
231
+			))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count),
232
+			'refunded'  => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
233 233
 				'status' => 'refunded',
234 234
 				'paged'  => false
235
-			) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ),
236
-			'revoked'   => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
235
+			))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count),
236
+			'revoked'   => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
237 237
 				'status' => 'revoked',
238 238
 				'paged'  => false
239
-			) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ),
240
-			'failed'    => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
239
+			))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count),
240
+			'failed'    => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
241 241
 				'status' => 'failed',
242 242
 				'paged'  => false
243
-			) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ),
244
-			'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
243
+			))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count),
244
+			'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
245 245
 				'status' => 'cancelled',
246 246
 				'paged'  => false
247
-			) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ),
248
-			'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array(
247
+			))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count),
248
+			'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array(
249 249
 				'status' => 'abandoned',
250 250
 				'paged'  => false
251
-			) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count )
251
+			))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count)
252 252
 		);
253 253
 
254
-		return apply_filters( 'give_donations_table_views', $views );
254
+		return apply_filters('give_donations_table_views', $views);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 	public function get_columns() {
265 265
 		$columns = array(
266 266
 			'cb'            => '<input type="checkbox" />', //Render a checkbox instead of text
267
-			'donation'      => esc_html__( 'Donation', 'give' ),
268
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
269
-			'status'        => esc_html__( 'Status', 'give' ),
270
-			'date'          => esc_html__( 'Date', 'give' ),
271
-			'amount'        => esc_html__( 'Amount', 'give' ),
272
-			'details'       => esc_html__( 'Details', 'give' ),
267
+			'donation'      => esc_html__('Donation', 'give'),
268
+			'donation_form' => esc_html__('Donation Form', 'give'),
269
+			'status'        => esc_html__('Status', 'give'),
270
+			'date'          => esc_html__('Date', 'give'),
271
+			'amount'        => esc_html__('Amount', 'give'),
272
+			'details'       => esc_html__('Details', 'give'),
273 273
 		);
274 274
 
275
-		return apply_filters( 'give_donations_table_columns', $columns );
275
+		return apply_filters('give_donations_table_columns', $columns);
276 276
 	}
277 277
 
278 278
 	/**
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	public function get_sortable_columns() {
286 286
 		$columns = array(
287
-			'donation'      => array( 'ID', true ),
288
-			'donation_form' => array( 'donation_form', false ),
289
-			'status'        => array( 'status', false ),
290
-			'amount'        => array( 'amount', false ),
291
-			'date'          => array( 'date', false )
287
+			'donation'      => array('ID', true),
288
+			'donation_form' => array('donation_form', false),
289
+			'status'        => array('status', false),
290
+			'amount'        => array('amount', false),
291
+			'date'          => array('date', false)
292 292
 		);
293 293
 
294
-		return apply_filters( 'give_donations_table_sortable_columns', $columns );
294
+		return apply_filters('give_donations_table_sortable_columns', $columns);
295 295
 	}
296 296
 
297 297
 	/**
@@ -317,65 +317,65 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return string Column Name
319 319
 	 */
320
-	public function column_default( $payment, $column_name ) {
320
+	public function column_default($payment, $column_name) {
321 321
 
322
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) );
323
-		$row_actions         = $this->get_row_actions( $payment );
322
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details')));
323
+		$row_actions         = $this->get_row_actions($payment);
324 324
 
325
-		switch ( $column_name ) {
325
+		switch ($column_name) {
326 326
 			case 'donation' :
327 327
 				$value = sprintf(
328 328
 					'<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>',
329 329
 					$single_donation_url,
330
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID ),
330
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID),
331 331
 					$payment->ID,
332
-					esc_html__( 'by', 'give' ),
333
-					$this->get_donor( $payment )
332
+					esc_html__('by', 'give'),
333
+					$this->get_donor($payment)
334 334
 				);
335
-				$value .= $this->get_donor_email( $payment );
336
-				$value .= $this->row_actions( $row_actions );
335
+				$value .= $this->get_donor_email($payment);
336
+				$value .= $this->row_actions($row_actions);
337 337
 				break;
338 338
 
339 339
 			case 'amount' :
340
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
341
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
340
+				$amount = ! empty($payment->total) ? $payment->total : 0;
341
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
342 342
 				break;
343 343
 
344 344
 			case 'donation_form' :
345 345
 
346
-				$value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>';
347
-				$level = give_get_payment_form_title( $payment->meta, true );
346
+				$value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>';
347
+				$level = give_get_payment_form_title($payment->meta, true);
348 348
 
349
-				if ( ! empty( $level ) ) {
349
+				if ( ! empty($level)) {
350 350
 					$value .= $level;
351 351
 				}
352 352
 
353 353
 				break;
354 354
 
355 355
 			case 'date' :
356
-				$date  = strtotime( $payment->date );
357
-				$value = date_i18n( give_date_format(), $date );
356
+				$date  = strtotime($payment->date);
357
+				$value = date_i18n(give_date_format(), $date);
358 358
 				break;
359 359
 
360 360
 			case 'status' :
361
-				$value = $this->get_payment_status( $payment );
361
+				$value = $this->get_payment_status($payment);
362 362
 				break;
363 363
 
364 364
 			case 'details' :
365 365
 				$value = sprintf(
366 366
 					'<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>',
367 367
 					$single_donation_url,
368
-					sprintf( esc_attr__( 'View Donation %s', 'give' ), $payment->ID )
368
+					sprintf(esc_attr__('View Donation %s', 'give'), $payment->ID)
369 369
 				);
370 370
 				break;
371 371
 
372 372
 			default:
373
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
373
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
374 374
 				break;
375 375
 
376 376
 		}
377 377
 
378
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, $column_name );
378
+		return apply_filters('give_donations_table_column', $value, $payment->ID, $column_name);
379 379
 	}
380 380
 
381 381
 	/**
@@ -388,17 +388,17 @@  discard block
 block discarded – undo
388 388
 	 *
389 389
 	 * @return string                Data shown in the Email column
390 390
 	 */
391
-	public function get_donor_email( $payment ) {
391
+	public function get_donor_email($payment) {
392 392
 
393
-		$email = give_get_payment_user_email( $payment->ID );
393
+		$email = give_get_payment_user_email($payment->ID);
394 394
 
395
-		if ( empty( $email ) ) {
396
-			$email = esc_html__( '(unknown)', 'give' );
395
+		if (empty($email)) {
396
+			$email = esc_html__('(unknown)', 'give');
397 397
 		}
398 398
 
399
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>';
399
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>';
400 400
 
401
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'email' );
401
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'email');
402 402
 	}
403 403
 
404 404
 	/**
@@ -408,18 +408,18 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return mixed|void
410 410
 	 */
411
-	function get_row_actions( $payment ) {
411
+	function get_row_actions($payment) {
412 412
 
413 413
 		$actions = array();
414
-		$email   = give_get_payment_user_email( $payment->ID );
414
+		$email   = give_get_payment_user_email($payment->ID);
415 415
 
416 416
 		// Add search term string back to base URL
417
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
418
-		if ( ! empty( $search_terms ) ) {
419
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
417
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
418
+		if ( ! empty($search_terms)) {
419
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
420 420
 		}
421 421
 
422
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
422
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
423 423
 
424 424
 			$actions['email_links'] = sprintf(
425 425
 				'<a href="%1$s" aria-label="%2$s">%3$s</a>',
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 					),
434 434
 					'give_payment_nonce'
435 435
 				),
436
-				sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ),
437
-				esc_html__( 'Resend Donation Receipt', 'give' )
436
+				sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID),
437
+				esc_html__('Resend Donation Receipt', 'give')
438 438
 			);
439 439
 
440 440
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 				),
452 452
 				'give_payment_nonce'
453 453
 			),
454
-			sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ),
455
-			esc_html__( 'Delete', 'give' )
454
+			sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID),
455
+			esc_html__('Delete', 'give')
456 456
 		);
457 457
 
458
-		return apply_filters( 'give_donation_row_actions', $actions, $payment );
458
+		return apply_filters('give_donation_row_actions', $actions, $payment);
459 459
 	}
460 460
 
461 461
 
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return string                Data shown in the Email column
471 471
 	 */
472
-	function get_payment_status( $payment ) {
473
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
474
-		if ( $payment->mode == 'test' ) {
475
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
472
+	function get_payment_status($payment) {
473
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
474
+		if ($payment->mode == 'test') {
475
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
476 476
 		}
477 477
 
478 478
 		return $value;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 *
489 489
 	 * @return string Displays a checkbox
490 490
 	 */
491
-	public function column_cb( $payment ) {
491
+	public function column_cb($payment) {
492 492
 		return sprintf(
493 493
 			'<input type="checkbox" name="%1$s[]" value="%2$s" />',
494 494
 			'payment',
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 *
507 507
 	 * @return string Displays a checkbox
508 508
 	 */
509
-	public function get_payment_id( $payment ) {
510
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
509
+	public function get_payment_id($payment) {
510
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
511 511
 	}
512 512
 
513 513
 	/**
@@ -520,19 +520,19 @@  discard block
 block discarded – undo
520 520
 	 *
521 521
 	 * @return string Data shown in the User column
522 522
 	 */
523
-	public function get_donor( $payment ) {
523
+	public function get_donor($payment) {
524 524
 
525
-		$customer_id = give_get_payment_customer_id( $payment->ID );
525
+		$customer_id = give_get_payment_customer_id($payment->ID);
526 526
 
527
-		if ( ! empty( $customer_id ) ) {
528
-			$customer = new Give_Customer( $customer_id );
529
-			$value    = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>';
527
+		if ( ! empty($customer_id)) {
528
+			$customer = new Give_Customer($customer_id);
529
+			$value    = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>';
530 530
 		} else {
531
-			$email = give_get_payment_user_email( $payment->ID );
532
-			$value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
531
+			$email = give_get_payment_user_email($payment->ID);
532
+			$value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
533 533
 		}
534 534
 
535
-		return apply_filters( 'give_donations_table_column', $value, $payment->ID, 'donor' );
535
+		return apply_filters('give_donations_table_column', $value, $payment->ID, 'donor');
536 536
 	}
537 537
 
538 538
 	/**
@@ -544,18 +544,18 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public function get_bulk_actions() {
546 546
 		$actions = array(
547
-			'delete'               => esc_html__( 'Delete', 'give' ),
548
-			'set-status-publish'   => esc_html__( 'Set To Completed', 'give' ),
549
-			'set-status-pending'   => esc_html__( 'Set To Pending', 'give' ),
550
-			'set-status-refunded'  => esc_html__( 'Set To Refunded', 'give' ),
551
-			'set-status-revoked'   => esc_html__( 'Set To Revoked', 'give' ),
552
-			'set-status-failed'    => esc_html__( 'Set To Failed', 'give' ),
553
-			'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ),
554
-			'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ),
555
-			'resend-receipt'       => esc_html__( 'Resend Email Receipts', 'give' )
547
+			'delete'               => esc_html__('Delete', 'give'),
548
+			'set-status-publish'   => esc_html__('Set To Completed', 'give'),
549
+			'set-status-pending'   => esc_html__('Set To Pending', 'give'),
550
+			'set-status-refunded'  => esc_html__('Set To Refunded', 'give'),
551
+			'set-status-revoked'   => esc_html__('Set To Revoked', 'give'),
552
+			'set-status-failed'    => esc_html__('Set To Failed', 'give'),
553
+			'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'),
554
+			'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'),
555
+			'resend-receipt'       => esc_html__('Resend Email Receipts', 'give')
556 556
 		);
557 557
 
558
-		return apply_filters( 'give_donations_table_bulk_actions', $actions );
558
+		return apply_filters('give_donations_table_bulk_actions', $actions);
559 559
 	}
560 560
 
561 561
 	/**
@@ -566,59 +566,59 @@  discard block
 block discarded – undo
566 566
 	 * @return void
567 567
 	 */
568 568
 	public function process_bulk_action() {
569
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
569
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
570 570
 		$action = $this->current_action();
571 571
 
572
-		if ( ! is_array( $ids ) ) {
573
-			$ids = array( $ids );
572
+		if ( ! is_array($ids)) {
573
+			$ids = array($ids);
574 574
 		}
575 575
 
576
-		if ( empty( $action ) ) {
576
+		if (empty($action)) {
577 577
 			return;
578 578
 		}
579 579
 
580
-		foreach ( $ids as $id ) {
580
+		foreach ($ids as $id) {
581 581
 
582 582
 			// Detect when a bulk action is being triggered...
583
-			switch ( $this->current_action() ) {
583
+			switch ($this->current_action()) {
584 584
 
585 585
 				case'delete':
586
-					give_delete_purchase( $id );
586
+					give_delete_purchase($id);
587 587
 					break;
588 588
 
589 589
 				case 'set-status-publish':
590
-					give_update_payment_status( $id, 'publish' );
590
+					give_update_payment_status($id, 'publish');
591 591
 					break;
592 592
 
593 593
 				case 'set-status-pending':
594
-					give_update_payment_status( $id, 'pending' );
594
+					give_update_payment_status($id, 'pending');
595 595
 					break;
596 596
 
597 597
 				case 'set-status-refunded':
598
-					give_update_payment_status( $id, 'refunded' );
598
+					give_update_payment_status($id, 'refunded');
599 599
 					break;
600 600
 				case 'set-status-revoked':
601
-					give_update_payment_status( $id, 'revoked' );
601
+					give_update_payment_status($id, 'revoked');
602 602
 					break;
603 603
 
604 604
 				case 'set-status-failed':
605
-					give_update_payment_status( $id, 'failed' );
605
+					give_update_payment_status($id, 'failed');
606 606
 					break;
607 607
 
608 608
 				case 'set-status-cancelled':
609
-					give_update_payment_status( $id, 'cancelled' );
609
+					give_update_payment_status($id, 'cancelled');
610 610
 					break;
611 611
 
612 612
 				case 'set-status-abandoned':
613
-					give_update_payment_status( $id, 'abandoned' );
613
+					give_update_payment_status($id, 'abandoned');
614 614
 					break;
615 615
 
616 616
 				case 'set-status-preapproval':
617
-					give_update_payment_status( $id, 'preapproval' );
617
+					give_update_payment_status($id, 'preapproval');
618 618
 					break;
619 619
 
620 620
 				case 'resend-receipt':
621
-					give_email_donation_receipt( $id, false );
621
+					give_email_donation_receipt($id, false);
622 622
 					break;
623 623
 			}
624 624
 
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			 * @param int    $id The ID of the payment.
631 631
 			 * @param string $current_action The action that is being triggered.
632 632
 			 */
633
-			do_action( 'give_donations_table_do_bulk_action', $id, $this->current_action() );
633
+			do_action('give_donations_table_do_bulk_action', $id, $this->current_action());
634 634
 		}
635 635
 
636 636
 	}
@@ -646,27 +646,27 @@  discard block
 block discarded – undo
646 646
 
647 647
 		$args = array();
648 648
 
649
-		if ( isset( $_GET['user'] ) ) {
650
-			$args['user'] = urldecode( $_GET['user'] );
651
-		} elseif ( isset( $_GET['s'] ) ) {
652
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
653
-			if ( $is_user ) {
654
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
655
-				unset( $args['s'] );
649
+		if (isset($_GET['user'])) {
650
+			$args['user'] = urldecode($_GET['user']);
651
+		} elseif (isset($_GET['s'])) {
652
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
653
+			if ($is_user) {
654
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
655
+				unset($args['s']);
656 656
 			} else {
657
-				$args['s'] = sanitize_text_field( $_GET['s'] );
657
+				$args['s'] = sanitize_text_field($_GET['s']);
658 658
 			}
659 659
 		}
660 660
 
661
-		if ( ! empty( $_GET['start-date'] ) ) {
662
-			$args['start-date'] = urldecode( $_GET['start-date'] );
661
+		if ( ! empty($_GET['start-date'])) {
662
+			$args['start-date'] = urldecode($_GET['start-date']);
663 663
 		}
664 664
 
665
-		if ( ! empty( $_GET['end-date'] ) ) {
666
-			$args['end-date'] = urldecode( $_GET['end-date'] );
665
+		if ( ! empty($_GET['end-date'])) {
666
+			$args['end-date'] = urldecode($_GET['end-date']);
667 667
 		}
668 668
 
669
-		$payment_count         = give_count_payments( $args );
669
+		$payment_count         = give_count_payments($args);
670 670
 		$this->complete_count  = $payment_count->publish;
671 671
 		$this->pending_count   = $payment_count->pending;
672 672
 		$this->refunded_count  = $payment_count->refunded;
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		$this->cancelled_count = $payment_count->cancelled;
676 676
 		$this->abandoned_count = $payment_count->abandoned;
677 677
 
678
-		foreach ( $payment_count as $count ) {
678
+		foreach ($payment_count as $count) {
679 679
 			$this->total_count += $count;
680 680
 		}
681 681
 	}
@@ -690,26 +690,26 @@  discard block
 block discarded – undo
690 690
 	public function payments_data() {
691 691
 
692 692
 		$per_page   = $this->per_page;
693
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
694
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
695
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
696
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
697
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
698
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
699
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
700
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
701
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
702
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
703
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
704
-
705
-		if ( ! empty( $search ) ) {
693
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
694
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
695
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
696
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
697
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
698
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
699
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
700
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
701
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
702
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
703
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
704
+
705
+		if ( ! empty($search)) {
706 706
 			$status = 'any'; // Force all payment statuses when searching
707 707
 		}
708 708
 
709 709
 		$args = array(
710 710
 			'output'     => 'payments',
711 711
 			'number'     => $per_page,
712
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
712
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
713 713
 			'orderby'    => $orderby,
714 714
 			'order'      => $order,
715 715
 			'user'       => $user,
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 			'end_date'   => $end_date,
724 724
 		);
725 725
 
726
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
726
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
727 727
 
728 728
 			$args['search_in_notes'] = true;
729
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
729
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
730 730
 
731 731
 		}
732 732
 
733
-		$p_query = new Give_Payments_Query( $args );
733
+		$p_query = new Give_Payments_Query($args);
734 734
 
735 735
 		return $p_query->get_payments();
736 736
 
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
 	 */
751 751
 	public function prepare_items() {
752 752
 
753
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
753
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
754 754
 
755 755
 		$columns  = $this->get_columns();
756 756
 		$hidden   = array(); // No hidden columns
757 757
 		$sortable = $this->get_sortable_columns();
758 758
 		$data     = $this->payments_data();
759
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
759
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
760 760
 
761
-		$this->_column_headers = array( $columns, $hidden, $sortable );
761
+		$this->_column_headers = array($columns, $hidden, $sortable);
762 762
 
763
-		switch ( $status ) {
763
+		switch ($status) {
764 764
 			case 'publish':
765 765
 				$total_items = $this->complete_count;
766 766
 				break;
@@ -787,19 +787,19 @@  discard block
 block discarded – undo
787 787
 				break;
788 788
 			default:
789 789
 				// Retrieve the count of the non-default-Give status
790
-				$count       = wp_count_posts( 'give_payment' );
790
+				$count       = wp_count_posts('give_payment');
791 791
 				$total_items = $count->{$status};
792 792
 				break;
793 793
 		}
794 794
 
795 795
 		$this->items = $data;
796 796
 
797
-		$this->set_pagination_args( array(
797
+		$this->set_pagination_args(array(
798 798
 				'total_items' => $total_items,
799 799
 				// WE have to calculate the total number of items
800 800
 				'per_page'    => $this->per_page,
801 801
 				// WE have to determine how many items to show on a page
802
-				'total_pages' => ceil( $total_items / $this->per_page )
802
+				'total_pages' => ceil($total_items / $this->per_page)
803 803
 				// WE have to calculate the total number of pages
804 804
 			)
805 805
 		);
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,52 +23,52 @@
 block discarded – undo
23 23
  */
24 24
 function give_hide_subscription_notices() {
25 25
 
26
-    // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
-        global $current_user;
26
+	// Hide subscription notices permanently.
27
+	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
+		global $current_user;
29 29
 
30
-        // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
-            ? $already_dismiss_notices
33
-            : array();
30
+		// check previously disabled notice ids.
31
+		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
+			? $already_dismiss_notices
33
+			: array();
34 34
 
35
-        // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
35
+		// Get notice id.
36
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
-            $already_dismiss_notices[] = $notice_id;
40
-        }
38
+		if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
+			$already_dismiss_notices[] = $notice_id;
40
+		}
41 41
 
42
-        // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
42
+		// Store subscription ids.
43
+		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
44 44
 
45
-        // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
-        exit();
48
-    }
45
+		// Redirect user.
46
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
+		exit();
48
+	}
49 49
 
50
-    // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
-        global $current_user;
50
+	// Hide subscription notices shortly.
51
+	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
+		global $current_user;
53 53
 
54
-        // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
54
+		// Get notice id.
55
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
56 56
 
57
-        // Transient key name.
58
-        $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
57
+		// Transient key name.
58
+		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
61
-            return;
62
-        }
60
+		if( get_transient( $transient_key ) ) {
61
+			return;
62
+		}
63 63
 
64 64
 
65
-        // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
65
+		// Hide notice for 24 hours.
66
+		set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
67 67
 
68
-        // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
-        exit();
71
-    }
68
+		// Redirect user.
69
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
+		exit();
71
+	}
72 72
 }
73 73
 
74 74
 add_action( 'admin_init', 'give_hide_subscription_notices' );
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 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,51 +24,51 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
     // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+    if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
         global $current_user;
29 29
 
30 30
         // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+        $already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
             ? $already_dismiss_notices
33 33
             : array();
34 34
 
35 35
         // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+        if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
             $already_dismiss_notices[] = $notice_id;
40 40
         }
41 41
 
42 42
         // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+        update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
         // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
         exit();
48 48
     }
49 49
 
50 50
     // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+    if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
         global $current_user;
53 53
 
54 54
         // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
         // Transient key name.
58 58
         $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
60
+        if (get_transient($transient_key)) {
61 61
             return;
62 62
         }
63 63
 
64 64
 
65 65
         // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
66
+        set_transient($transient_key, true, 24 * HOUR_IN_SECONDS);
67 67
 
68 68
         // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
69
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
70 70
         exit();
71 71
     }
72 72
 }
73 73
 
74
-add_action( 'admin_init', 'give_hide_subscription_notices' );
75 74
\ No newline at end of file
75
+add_action('admin_init', 'give_hide_subscription_notices');
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -411,83 +411,83 @@
 block discarded – undo
411 411
  * @since 1.7
412 412
  */
413 413
 function give_upgrade_addon_license_data(){
414
-    global $give_options;
415
-
416
-    $api_url = 'https://givewp.com/give-sl-api/';
417
-
418
-    // Get addons license key.
419
-    $addons = array();
420
-    foreach ( $give_options as $key => $value ) {
421
-        if( false !== strpos( $key, '_license_key' ) ) {
422
-            $addons[$key] = $value;
423
-        }
424
-    }
425
-
426
-    // Bailout: We do not have any addon license data to upgrade.
427
-    if( empty( $addons ) ) {
428
-        return false;
429
-    }
414
+	global $give_options;
415
+
416
+	$api_url = 'https://givewp.com/give-sl-api/';
417
+
418
+	// Get addons license key.
419
+	$addons = array();
420
+	foreach ( $give_options as $key => $value ) {
421
+		if( false !== strpos( $key, '_license_key' ) ) {
422
+			$addons[$key] = $value;
423
+		}
424
+	}
425
+
426
+	// Bailout: We do not have any addon license data to upgrade.
427
+	if( empty( $addons ) ) {
428
+		return false;
429
+	}
430 430
     
431
-    foreach ( $addons as $key => $addon_license ) {
432
-
433
-        // Get addon shortname.
434
-        $shortname = str_replace( '_license_key', '', $key );
435
-
436
-        // Addon license option name.
437
-        $addon_license_option_name = $shortname . '_license_active';
438
-
439
-        // bailout if license is empty.
440
-        if( empty( $addon_license ) ) {
441
-            delete_option( $addon_license_option_name );
442
-            continue;
443
-        }
444
-
445
-        // Get addon name.
446
-        $addon_name = array();
447
-        $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
-        foreach ( $addon_name_parts as $name_part ) {
449
-
450
-            // Fix addon name
451
-            switch ( $name_part ) {
452
-                case 'authorizenet' :
453
-                    $name_part = 'authorize.net';
454
-                    break;
455
-            }
456
-
457
-            $addon_name[] = ucfirst( $name_part );
458
-        }
459
-
460
-        $addon_name = implode( ' ', $addon_name );
461
-
462
-        // Data to send to the API
463
-        $api_params = array(
464
-            'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465
-            'license'    => $addon_license,
466
-            'item_name'  => urlencode( $addon_name ),
467
-            'url'        => home_url()
468
-        );
469
-
470
-        // Call the API
471
-        $response = wp_remote_post(
472
-            $api_url,
473
-            array(
474
-                'timeout'   => 15,
475
-                'sslverify' => false,
476
-                'body'      => $api_params
477
-            )
478
-        );
479
-
480
-        // Make sure there are no errors
481
-        if ( is_wp_error( $response ) ) {
482
-            delete_option( $addon_license_option_name );
483
-            continue;
484
-        }
485
-
486
-        // Tell WordPress to look for updates
487
-        set_site_transient( 'update_plugins', null );
488
-
489
-        // Decode license data
490
-        $license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
-        update_option( $addon_license_option_name, $license_data );
492
-    }
431
+	foreach ( $addons as $key => $addon_license ) {
432
+
433
+		// Get addon shortname.
434
+		$shortname = str_replace( '_license_key', '', $key );
435
+
436
+		// Addon license option name.
437
+		$addon_license_option_name = $shortname . '_license_active';
438
+
439
+		// bailout if license is empty.
440
+		if( empty( $addon_license ) ) {
441
+			delete_option( $addon_license_option_name );
442
+			continue;
443
+		}
444
+
445
+		// Get addon name.
446
+		$addon_name = array();
447
+		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
+		foreach ( $addon_name_parts as $name_part ) {
449
+
450
+			// Fix addon name
451
+			switch ( $name_part ) {
452
+				case 'authorizenet' :
453
+					$name_part = 'authorize.net';
454
+					break;
455
+			}
456
+
457
+			$addon_name[] = ucfirst( $name_part );
458
+		}
459
+
460
+		$addon_name = implode( ' ', $addon_name );
461
+
462
+		// Data to send to the API
463
+		$api_params = array(
464
+			'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465
+			'license'    => $addon_license,
466
+			'item_name'  => urlencode( $addon_name ),
467
+			'url'        => home_url()
468
+		);
469
+
470
+		// Call the API
471
+		$response = wp_remote_post(
472
+			$api_url,
473
+			array(
474
+				'timeout'   => 15,
475
+				'sslverify' => false,
476
+				'body'      => $api_params
477
+			)
478
+		);
479
+
480
+		// Make sure there are no errors
481
+		if ( is_wp_error( $response ) ) {
482
+			delete_option( $addon_license_option_name );
483
+			continue;
484
+		}
485
+
486
+		// Tell WordPress to look for updates
487
+		set_site_transient( 'update_plugins', null );
488
+
489
+		// Decode license data
490
+		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
+		update_option( $addon_license_option_name, $license_data );
492
+	}
493 493
 }
494 494
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_do_automatic_upgrades() {
28 28
 	$did_upgrade  = false;
29
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
29
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
30 30
 
31
-	if ( ! $give_version ) {
31
+	if ( ! $give_version) {
32 32
 		// 1.0 is the first version to use this option so we must add it.
33 33
 		$give_version = '1.0';
34 34
 	}
35 35
 
36
-	switch ( true ) {
36
+	switch (true) {
37 37
 
38
-		case version_compare( $give_version, '1.6', '<' ) :
38
+		case version_compare($give_version, '1.6', '<') :
39 39
 			give_v16_upgrades();
40 40
 			$did_upgrade = true;
41 41
 
42
-		case version_compare( $give_version, '1.7', '<' ) :
42
+		case version_compare($give_version, '1.7', '<') :
43 43
 			give_v17_upgrades();
44 44
 			$did_upgrade = true;
45 45
 	}
46 46
 
47
-	if ( $did_upgrade ) {
48
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
47
+	if ($did_upgrade) {
48
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
49 49
 	}
50 50
 }
51 51
 
52
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
52
+add_action('admin_init', 'give_do_automatic_upgrades');
53 53
 
54 54
 /**
55 55
  * Display Upgrade Notices
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
  */
60 60
 function give_show_upgrade_notices() {
61 61
 
62
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
62
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
63 63
 		return;
64 64
 	} // Don't show notices on the upgrades page
65 65
 
66
-	$give_version = get_option( 'give_version' );
66
+	$give_version = get_option('give_version');
67 67
 
68
-	if ( ! $give_version ) {
68
+	if ( ! $give_version) {
69 69
 		// 1.0 is the first version to use this option so we must add it
70 70
 		$give_version = '1.0';
71 71
 	}
72 72
 
73
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
73
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
74 74
 
75 75
 	/*
76 76
 	 *  NOTICE:
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 
83 83
 	//v1.3.2 Upgrades
84
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
84
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
85 85
 		printf(
86 86
 		/* translators: %s: upgrade URL */
87
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
88
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
87
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
88
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
89 89
 		);
90 90
 	}
91 91
 
92 92
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
93
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
93
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
94 94
 		printf(
95 95
 		/* translators: %s: upgrade URL */
96
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
97
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
96
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
97
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
98 98
 		);
99 99
 	}
100 100
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 }
106 106
 
107
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
107
+add_action('admin_notices', 'give_show_upgrade_notices');
108 108
 
109 109
 /**
110 110
  * Triggers all upgrade functions
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_trigger_upgrades() {
118 118
 
119
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
120
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
119
+	if ( ! current_user_can('manage_give_settings')) {
120
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
121 121
 	}
122 122
 
123
-	$give_version = get_option( 'give_version' );
123
+	$give_version = get_option('give_version');
124 124
 
125
-	if ( ! $give_version ) {
125
+	if ( ! $give_version) {
126 126
 		// 1.0 is the first version to use this option so we must add it
127 127
 		$give_version = '1.0';
128
-		add_option( 'give_version', $give_version );
128
+		add_option('give_version', $give_version);
129 129
 	}
130 130
 
131
-	update_option( 'give_version', GIVE_VERSION );
131
+	update_option('give_version', GIVE_VERSION);
132 132
 
133
-	if ( DOING_AJAX ) {
134
-		die( 'complete' );
133
+	if (DOING_AJAX) {
134
+		die('complete');
135 135
 	} // Let AJAX know that the upgrade is complete
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
138
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
139 139
 
140 140
 /**
141 141
  * Check if the upgrade routine has been run for a specific action
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool                   If the action has been added to the completed actions array
148 148
  */
149
-function give_has_upgrade_completed( $upgrade_action = '' ) {
149
+function give_has_upgrade_completed($upgrade_action = '') {
150 150
 
151
-	if ( empty( $upgrade_action ) ) {
151
+	if (empty($upgrade_action)) {
152 152
 		return false;
153 153
 	}
154 154
 
155 155
 	$completed_upgrades = give_get_completed_upgrades();
156 156
 
157
-	return in_array( $upgrade_action, $completed_upgrades );
157
+	return in_array($upgrade_action, $completed_upgrades);
158 158
 
159 159
 }
160 160
 
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return bool                   If the function was successfully added
169 169
  */
170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
170
+function give_set_upgrade_complete($upgrade_action = '') {
171 171
 
172
-	if ( empty( $upgrade_action ) ) {
172
+	if (empty($upgrade_action)) {
173 173
 		return false;
174 174
 	}
175 175
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	$completed_upgrades[] = $upgrade_action;
178 178
 
179 179
 	// Remove any blanks, and only show uniques
180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
181 181
 
182
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
182
+	return update_option('give_completed_upgrades', $completed_upgrades);
183 183
 }
184 184
 
185 185
 /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function give_get_completed_upgrades() {
192 192
 
193
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
193
+	$completed_upgrades = get_option('give_completed_upgrades');
194 194
 
195
-	if ( false === $completed_upgrades ) {
195
+	if (false === $completed_upgrades) {
196 196
 		$completed_upgrades = array();
197 197
 	}
198 198
 
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function give_v132_upgrade_give_payment_customer_id() {
212 212
 	global $wpdb;
213
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
214
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
213
+	if ( ! current_user_can('manage_give_settings')) {
214
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
215 215
 	}
216 216
 
217
-	ignore_user_abort( true );
217
+	ignore_user_abort(true);
218 218
 
219
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
220
-		@set_time_limit( 0 );
219
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
220
+		@set_time_limit(0);
221 221
 	}
222 222
 
223 223
 	//UPDATE DB METAKEYS
224 224
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
225
-	$query = $wpdb->query( $sql );
225
+	$query = $wpdb->query($sql);
226 226
 
227
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
228
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
229
-	delete_option( 'give_doing_upgrade' );
230
-	wp_redirect( admin_url() );
227
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
228
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
229
+	delete_option('give_doing_upgrade');
230
+	wp_redirect(admin_url());
231 231
 	exit;
232 232
 
233 233
 
234 234
 }
235 235
 
236
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
236
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
237 237
 
238 238
 /**
239 239
  * Upgrades the Offline Status
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
 
248 248
 	global $wpdb;
249 249
 
250
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
251
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
250
+	if ( ! current_user_can('manage_give_settings')) {
251
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
252 252
 	}
253 253
 
254
-	ignore_user_abort( true );
254
+	ignore_user_abort(true);
255 255
 
256
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
257
-		@set_time_limit( 0 );
256
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
257
+		@set_time_limit(0);
258 258
 	}
259 259
 
260 260
 	// Get abandoned offline payments
@@ -264,35 +264,35 @@  discard block
 block discarded – undo
264 264
 	$where .= "AND ( p.post_status = 'abandoned' )";
265 265
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
266 266
 
267
-	$sql            = $select . $join . $where;
268
-	$found_payments = $wpdb->get_col( $sql );
267
+	$sql            = $select.$join.$where;
268
+	$found_payments = $wpdb->get_col($sql);
269 269
 
270 270
 
271
-	foreach ( $found_payments as $payment ) {
271
+	foreach ($found_payments as $payment) {
272 272
 
273 273
 		//Only change ones marked abandoned since our release last week
274 274
 		//because the admin may have marked some abandoned themselves
275
-		$modified_time = get_post_modified_time( 'U', false, $payment );
275
+		$modified_time = get_post_modified_time('U', false, $payment);
276 276
 
277 277
 		//1450124863 =  12/10/2015 20:42:25
278
-		if ( $modified_time >= 1450124863 ) {
278
+		if ($modified_time >= 1450124863) {
279 279
 
280
-			give_update_payment_status( $payment, 'pending' );
280
+			give_update_payment_status($payment, 'pending');
281 281
 
282 282
 		}
283 283
 
284 284
 	}
285 285
 
286
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
287
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
288
-	delete_option( 'give_doing_upgrade' );
289
-	wp_redirect( admin_url() );
286
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
287
+	give_set_upgrade_complete('upgrade_give_offline_status');
288
+	delete_option('give_doing_upgrade');
289
+	wp_redirect(admin_url());
290 290
 	exit;
291 291
 
292 292
 
293 293
 }
294 294
 
295
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
295
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
296 296
 
297 297
 /**
298 298
  * Cleanup User Roles
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
  */
304 304
 function give_v152_cleanup_users() {
305 305
 
306
-	$give_version = get_option( 'give_version' );
306
+	$give_version = get_option('give_version');
307 307
 
308
-	if ( ! $give_version ) {
308
+	if ( ! $give_version) {
309 309
 		// 1.0 is the first version to use this option so we must add it
310 310
 		$give_version = '1.0';
311 311
 	}
312 312
 
313
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
313
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
314 314
 
315 315
 	//v1.5.2 Upgrades
316
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
316
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
317 317
 
318 318
 		//Delete all caps with "ss"
319 319
 		//Also delete all unused "campaign" roles
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 		);
361 361
 
362 362
 		global $wp_roles;
363
-		foreach ( $delete_caps as $cap ) {
364
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
365
-				$wp_roles->remove_cap( $role, $cap );
363
+		foreach ($delete_caps as $cap) {
364
+			foreach (array_keys($wp_roles->roles) as $role) {
365
+				$wp_roles->remove_cap($role, $cap);
366 366
 			}
367 367
 		}
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$roles->add_caps();
373 373
 
374 374
 		//The Update Ran
375
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
376
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
377
-		delete_option( 'give_doing_upgrade' );
375
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
376
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
377
+		delete_option('give_doing_upgrade');
378 378
 
379 379
 	}
380 380
 
381 381
 }
382 382
 
383
-add_action( 'admin_init', 'give_v152_cleanup_users' );
383
+add_action('admin_init', 'give_v152_cleanup_users');
384 384
 
385 385
 /**
386 386
  * 1.6 Upgrade routine to create the customer meta table.
@@ -410,60 +410,60 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @since 1.7
412 412
  */
413
-function give_upgrade_addon_license_data(){
413
+function give_upgrade_addon_license_data() {
414 414
     global $give_options;
415 415
 
416 416
     $api_url = 'https://givewp.com/give-sl-api/';
417 417
 
418 418
     // Get addons license key.
419 419
     $addons = array();
420
-    foreach ( $give_options as $key => $value ) {
421
-        if( false !== strpos( $key, '_license_key' ) ) {
420
+    foreach ($give_options as $key => $value) {
421
+        if (false !== strpos($key, '_license_key')) {
422 422
             $addons[$key] = $value;
423 423
         }
424 424
     }
425 425
 
426 426
     // Bailout: We do not have any addon license data to upgrade.
427
-    if( empty( $addons ) ) {
427
+    if (empty($addons)) {
428 428
         return false;
429 429
     }
430 430
     
431
-    foreach ( $addons as $key => $addon_license ) {
431
+    foreach ($addons as $key => $addon_license) {
432 432
 
433 433
         // Get addon shortname.
434
-        $shortname = str_replace( '_license_key', '', $key );
434
+        $shortname = str_replace('_license_key', '', $key);
435 435
 
436 436
         // Addon license option name.
437
-        $addon_license_option_name = $shortname . '_license_active';
437
+        $addon_license_option_name = $shortname.'_license_active';
438 438
 
439 439
         // bailout if license is empty.
440
-        if( empty( $addon_license ) ) {
441
-            delete_option( $addon_license_option_name );
440
+        if (empty($addon_license)) {
441
+            delete_option($addon_license_option_name);
442 442
             continue;
443 443
         }
444 444
 
445 445
         // Get addon name.
446 446
         $addon_name = array();
447
-        $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
448
-        foreach ( $addon_name_parts as $name_part ) {
447
+        $addon_name_parts = explode('_', str_replace('give_', '', $shortname));
448
+        foreach ($addon_name_parts as $name_part) {
449 449
 
450 450
             // Fix addon name
451
-            switch ( $name_part ) {
451
+            switch ($name_part) {
452 452
                 case 'authorizenet' :
453 453
                     $name_part = 'authorize.net';
454 454
                     break;
455 455
             }
456 456
 
457
-            $addon_name[] = ucfirst( $name_part );
457
+            $addon_name[] = ucfirst($name_part);
458 458
         }
459 459
 
460
-        $addon_name = implode( ' ', $addon_name );
460
+        $addon_name = implode(' ', $addon_name);
461 461
 
462 462
         // Data to send to the API
463 463
         $api_params = array(
464 464
             'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
465 465
             'license'    => $addon_license,
466
-            'item_name'  => urlencode( $addon_name ),
466
+            'item_name'  => urlencode($addon_name),
467 467
             'url'        => home_url()
468 468
         );
469 469
 
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
         );
479 479
 
480 480
         // Make sure there are no errors
481
-        if ( is_wp_error( $response ) ) {
482
-            delete_option( $addon_license_option_name );
481
+        if (is_wp_error($response)) {
482
+            delete_option($addon_license_option_name);
483 483
             continue;
484 484
         }
485 485
 
486 486
         // Tell WordPress to look for updates
487
-        set_site_transient( 'update_plugins', null );
487
+        set_site_transient('update_plugins', null);
488 488
 
489 489
         // Decode license data
490
-        $license_data = json_decode( wp_remote_retrieve_body( $response ) );
491
-        update_option( $addon_license_option_name, $license_data );
490
+        $license_data = json_decode(wp_remote_retrieve_body($response));
491
+        update_option($addon_license_option_name, $license_data);
492 492
     }
493 493
 }
494 494
\ No newline at end of file
Please login to merge, or discard this patch.