Test Failed
Pull Request — master (#2482)
by Devin
05:37
created
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -70,25 +70,25 @@  discard block
 block discarded – undo
70 70
 			// Get current setting page.
71 71
 			$this->current_setting_page = give_get_current_setting_page();
72 72
 
73
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
74
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
75
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
73
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
74
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
75
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
76 76
 
77 77
 			// Output section only if exist.
78 78
 			$sections = $this->get_sections();
79
-			if ( ! empty( $sections ) ) {
80
-				add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array(
79
+			if ( ! empty($sections)) {
80
+				add_action("{$this->current_setting_page}_sections_{$this->id}_page", array(
81 81
 					$this,
82 82
 					'output_sections',
83
-				) );
83
+				));
84 84
 			}
85 85
 
86 86
 			// Save hide button by default.
87 87
 			$GLOBALS['give_hide_save_button'] = true;
88 88
 
89 89
 			// Enable saving feature.
90
-			if ( $this->enable_save ) {
91
-				add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
90
+			if ($this->enable_save) {
91
+				add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
92 92
 			}
93 93
 		}
94 94
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		 *
114 114
 		 * @return string
115 115
 		 */
116
-		function set_default_setting_tab( $setting_tab ) {
116
+		function set_default_setting_tab($setting_tab) {
117 117
 			return $this->default_tab;
118 118
 		}
119 119
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @return array
128 128
 		 */
129
-		public function add_settings_page( $pages ) {
130
-			$pages[ $this->id ] = $this->label;
129
+		public function add_settings_page($pages) {
130
+			$pages[$this->id] = $this->label;
131 131
 
132 132
 			return $pages;
133 133
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 			 *
147 147
 			 * @param  array $settings
148 148
 			 */
149
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
149
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
150 150
 
151 151
 			// Output.
152 152
 			return $settings;
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		 * @return array
160 160
 		 */
161 161
 		public function get_sections() {
162
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
162
+			return apply_filters('give_get_sections_'.$this->id, array());
163 163
 		}
164 164
 
165 165
 		/**
@@ -176,29 +176,29 @@  discard block
 block discarded – undo
176 176
 			$sections = $this->get_sections();
177 177
 
178 178
 			// Show section settings only if setting section exist.
179
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
180
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
179
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
180
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
181 181
 				$GLOBALS['give_hide_save_button'] = true;
182 182
 
183 183
 				return;
184 184
 			}
185 185
 
186 186
 			// Bailout.
187
-			if ( empty( $sections ) ) {
187
+			if (empty($sections)) {
188 188
 				return;
189 189
 			}
190 190
 
191
-			if ( is_null( $this->current_setting_page ) ) {
191
+			if (is_null($this->current_setting_page)) {
192 192
 				$this->current_setting_page = give_get_current_setting_page();
193 193
 			}
194 194
 
195 195
 			echo '<ul class="subsubsub">';
196 196
 
197 197
 			// Get section keys.
198
-			$array_keys = array_keys( $sections );
198
+			$array_keys = array_keys($sections);
199 199
 
200
-			foreach ( $sections as $id => $label ) {
201
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
200
+			foreach ($sections as $id => $label) {
201
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
202 202
 			}
203 203
 
204 204
 			echo '</ul><br class="clear" /><hr>';
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 		 * @return void
214 214
 		 */
215 215
 		public function output() {
216
-			if ( $this->enable_save ) {
216
+			if ($this->enable_save) {
217 217
 				$GLOBALS['give_hide_save_button'] = false;
218 218
 			}
219 219
 
220 220
 			$settings = $this->get_settings();
221 221
 
222
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
222
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
223 223
 		}
224 224
 
225 225
 		/**
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 			$settings        = $this->get_settings();
233 233
 			$current_section = give_get_current_setting_section();
234 234
 
235
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
235
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
236 236
 
237 237
 			/**
238 238
 			 * Trigger Action
239 239
 			 *
240 240
 			 * @since 1.8
241 241
 			 */
242
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
242
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
243 243
 		}
244 244
 
245 245
 		/**
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 			$section         = $this->get_sections();
257 257
 			$current_section = give_get_current_setting_section();
258 258
 
259
-			if ( array_key_exists( $current_section, $section ) ) {
260
-				$heading[] = $section[ $current_section ];
259
+			if (array_key_exists($current_section, $section)) {
260
+				$heading[] = $section[$current_section];
261 261
 			}
262 262
 
263
-			return array_unique( $heading );
263
+			return array_unique($heading);
264 264
 		}
265 265
 
266 266
 		/**
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		public function get_heading_html() {
275 275
 			return sprintf(
276 276
 				'<h1 class="wp-heading-inline">%s</h1><hr class="wp-header-end">',
277
-				implode( ' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading() )
277
+				implode(' <span class="give-settings-heading-sep dashicons dashicons-arrow-right-alt2"></span> ', $this->get_heading())
278 278
 			);
279 279
 		}
280 280
 	}
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( esc_html__( 'Donation ID not supplied. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(esc_html__('Donation ID not supplied. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( esc_html__( 'The specified ID does not belong to a donation. Please try again.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(esc_html__('The specified ID does not belong to a donation. Please try again.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number         = $payment->number;
46 46
 $payment_meta   = $payment->get_meta();
47
-$transaction_id = esc_attr( $payment->transaction_id );
47
+$transaction_id = esc_attr($payment->transaction_id);
48 48
 $user_id        = $payment->user_id;
49 49
 $donor_id       = $payment->customer_id;
50
-$payment_date   = strtotime( $payment->date );
51
-$user_info      = give_get_payment_meta_user_info( $payment_id );
50
+$payment_date   = strtotime($payment->date);
51
+$user_info      = give_get_payment_meta_user_info($payment_id);
52 52
 $address        = $payment->address;
53 53
 $currency_code  = $payment->currency;
54 54
 $gateway        = $payment->gateway;
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	<?php
62 62
 		printf(
63 63
 			/* translators: %s: donation number */
64
-			esc_html__( 'Donation %s', 'give' ),
64
+			esc_html__('Donation %s', 'give'),
65 65
 			$number
66 66
 		);
67
-		if ( $payment_mode == 'test' ) {
68
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . esc_html__( 'Test Donation', 'give' ) . '</span>';
67
+		if ($payment_mode == 'test') {
68
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.esc_html__('Test Donation', 'give').'</span>';
69 69
 		}
70 70
 		?>
71 71
 		</h1>
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param int $payment_id Payment id.
80 80
 	 */
81
-	do_action( 'give_view_order_details_before', $payment_id );
81
+	do_action('give_view_order_details_before', $payment_id);
82 82
 	?>
83 83
 
84 84
 	<hr class="wp-header-end">
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		 *
93 93
 		 * @param int $payment_id Payment id.
94 94
 		 */
95
-		do_action( 'give_view_order_details_form_top', $payment_id );
95
+		do_action('give_view_order_details_form_top', $payment_id);
96 96
 		?>
97 97
 		<div id="poststuff">
98 98
 			<div id="give-dashboard-widgets-wrap">
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 							 *
109 109
 							 * @param int $payment_id Payment id.
110 110
 							 */
111
-							do_action( 'give_view_order_details_sidebar_before', $payment_id );
111
+							do_action('give_view_order_details_sidebar_before', $payment_id);
112 112
 							?>
113 113
 
114 114
 							<div id="give-order-update" class="postbox give-order-data">
115 115
 
116
-								<h3 class="hndle"><?php esc_html_e( 'Update Donation', 'give' ); ?></h3>
116
+								<h3 class="hndle"><?php esc_html_e('Update Donation', 'give'); ?></h3>
117 117
 
118 118
 								<div class="inside">
119 119
 									<div class="give-admin-box">
@@ -126,33 +126,33 @@  discard block
 block discarded – undo
126 126
 										 *
127 127
 										 * @param int $payment_id Payment id.
128 128
 										 */
129
-										do_action( 'give_view_order_details_totals_before', $payment_id );
129
+										do_action('give_view_order_details_totals_before', $payment_id);
130 130
 										?>
131 131
 
132 132
 										<div class="give-admin-box-inside">
133 133
 											<p>
134
-												<label for="give-payment-status" class="strong"><?php esc_html_e( 'Status:', 'give' ); ?></label>&nbsp;
134
+												<label for="give-payment-status" class="strong"><?php esc_html_e('Status:', 'give'); ?></label>&nbsp;
135 135
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
136
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
137
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
136
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
137
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
138 138
 													<?php endforeach; ?>
139 139
 												</select>
140
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
140
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
141 141
 											</p>
142 142
 										</div>
143 143
 
144 144
 										<div class="give-admin-box-inside">
145 145
 											<p>
146
-												<label for="give-payment-date" class="strong"><?php esc_html_e( 'Date:', 'give' ); ?></label>&nbsp;
147
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
146
+												<label for="give-payment-date" class="strong"><?php esc_html_e('Date:', 'give'); ?></label>&nbsp;
147
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
148 148
 											</p>
149 149
 										</div>
150 150
 
151 151
 										<div class="give-admin-box-inside">
152 152
 											<p>
153
-												<label for="give-payment-time-hour" class="strong"><?php esc_html_e( 'Time:', 'give' ); ?></label>&nbsp;
154
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
155
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
153
+												<label for="give-payment-time-hour" class="strong"><?php esc_html_e('Time:', 'give'); ?></label>&nbsp;
154
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
155
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
156 156
 											</p>
157 157
 										</div>
158 158
 
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 										 *
167 167
 										 * @param int $payment_id Payment id.
168 168
 										 */
169
-										do_action( 'give_view_order_details_update_inner', $payment_id );
169
+										do_action('give_view_order_details_update_inner', $payment_id);
170 170
 										?>
171 171
 
172 172
 										<div class="give-order-payment give-admin-box-inside">
173 173
 											<p>
174
-												<label for="give-payment-total" class="strong"><?php esc_html_e( 'Total Donation:', 'give' ); ?></label>&nbsp;
175
-												<?php echo give_currency_symbol( $payment->currency ); ?>
176
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
174
+												<label for="give-payment-total" class="strong"><?php esc_html_e('Total Donation:', 'give'); ?></label>&nbsp;
175
+												<?php echo give_currency_symbol($payment->currency); ?>
176
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
177 177
 											</p>
178 178
 										</div>
179 179
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										 *
186 186
 										 * @param int $payment_id Payment id.
187 187
 										 */
188
-										do_action( 'give_view_order_details_totals_after', $payment_id );
188
+										do_action('give_view_order_details_totals_after', $payment_id);
189 189
 										?>
190 190
 
191 191
 									</div>
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 									 *
204 204
 									 * @param int $payment_id Payment id.
205 205
 									 */
206
-									do_action( 'give_view_order_details_update_before', $payment_id );
206
+									do_action('give_view_order_details_update_before', $payment_id);
207 207
 									?>
208 208
 
209 209
 									<div id="major-publishing-actions">
210 210
 										<div id="publishing-action">
211
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
211
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
212 212
 											<?php
213
-											if ( give_is_payment_complete( $payment_id ) ) {
213
+											if (give_is_payment_complete($payment_id)) {
214 214
 												echo sprintf(
215 215
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
216 216
 													esc_url(
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 															)
222 222
 														)
223 223
 													),
224
-													__( 'Resend Receipt', 'give' )
224
+													__('Resend Receipt', 'give')
225 225
 												);
226 226
 											}
227 227
 											?>
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 									 *
238 238
 									 * @param int $payment_id Payment id.
239 239
 									 */
240
-									do_action( 'give_view_order_details_update_after', $payment_id );
240
+									do_action('give_view_order_details_update_after', $payment_id);
241 241
 									?>
242 242
 
243 243
 								</div>
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 							<div id="give-order-details" class="postbox give-order-data">
250 250
 
251
-								<h3 class="hndle"><?php esc_html_e( 'Donation Meta', 'give' ); ?></h3>
251
+								<h3 class="hndle"><?php esc_html_e('Donation Meta', 'give'); ?></h3>
252 252
 
253 253
 								<div class="inside">
254 254
 									<div class="give-admin-box">
@@ -261,45 +261,45 @@  discard block
 block discarded – undo
261 261
 										 *
262 262
 										 * @param int $payment_id Payment id.
263 263
 										 */
264
-										do_action( 'give_view_order_details_payment_meta_before', $payment_id );
264
+										do_action('give_view_order_details_payment_meta_before', $payment_id);
265 265
 
266
-										$gateway = give_get_payment_gateway( $payment_id );
267
-										if ( $gateway ) :
266
+										$gateway = give_get_payment_gateway($payment_id);
267
+										if ($gateway) :
268 268
 										?>
269 269
 											<div class="give-order-gateway give-admin-box-inside">
270 270
 												<p>
271
-													<strong><?php esc_html_e( 'Gateway:', 'give' ); ?></strong>&nbsp;
272
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
271
+													<strong><?php esc_html_e('Gateway:', 'give'); ?></strong>&nbsp;
272
+													<?php echo give_get_gateway_admin_label($gateway); ?>
273 273
 												</p>
274 274
 											</div>
275 275
 										<?php endif; ?>
276 276
 
277 277
 										<div class="give-order-payment-key give-admin-box-inside">
278 278
 											<p>
279
-												<strong><?php esc_html_e( 'Key:', 'give' ); ?></strong>&nbsp;
280
-												<?php echo give_get_payment_key( $payment_id ); ?>
279
+												<strong><?php esc_html_e('Key:', 'give'); ?></strong>&nbsp;
280
+												<?php echo give_get_payment_key($payment_id); ?>
281 281
 											</p>
282 282
 										</div>
283 283
 
284 284
 										<div class="give-order-ip give-admin-box-inside">
285 285
 											<p>
286
-												<strong><?php esc_html_e( 'IP:', 'give' ); ?></strong>&nbsp;
287
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
286
+												<strong><?php esc_html_e('IP:', 'give'); ?></strong>&nbsp;
287
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
288 288
 											</p>
289 289
 										</div>
290 290
 
291
-										<?php if ( $transaction_id ) : ?>
291
+										<?php if ($transaction_id) : ?>
292 292
 											<div class="give-order-tx-id give-admin-box-inside">
293 293
 												<p>
294
-													<strong><?php esc_html_e( 'Donation ID:', 'give' ); ?></strong>&nbsp;
295
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
294
+													<strong><?php esc_html_e('Donation ID:', 'give'); ?></strong>&nbsp;
295
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
296 296
 												</p>
297 297
 											</div>
298 298
 										<?php endif; ?>
299 299
 
300 300
 										<div class="give-admin-box-inside">
301
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
302
-												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
301
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
302
+												<a href="<?php echo $purchase_url; ?>"><?php esc_html_e('View all donations for this donor &raquo;', 'give'); ?></a>
303 303
 											</p>
304 304
 										</div>
305 305
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 										 *
312 312
 										 * @param int $payment_id Payment id.
313 313
 										 */
314
-										do_action( 'give_view_order_details_payment_meta_after', $payment_id );
314
+										do_action('give_view_order_details_payment_meta_after', $payment_id);
315 315
 										?>
316 316
 
317 317
 									</div>
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 							 *
332 332
 							 * @param int $payment_id Payment id.
333 333
 							 */
334
-							do_action( 'give_view_order_details_sidebar_after', $payment_id );
334
+							do_action('give_view_order_details_sidebar_after', $payment_id);
335 335
 							?>
336 336
 
337 337
 						</div>
@@ -351,31 +351,31 @@  discard block
 block discarded – undo
351 351
 							 *
352 352
 							 * @param int $payment_id Payment id.
353 353
 							 */
354
-							do_action( 'give_view_order_details_main_before', $payment_id );
354
+							do_action('give_view_order_details_main_before', $payment_id);
355 355
 							?>
356 356
 
357 357
 							<?php $column_count = 'columns-3'; ?>
358 358
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
359
-								<h3 class="hndle"><?php esc_html_e( 'Donation Information', 'give' ); ?></h3>
359
+								<h3 class="hndle"><?php esc_html_e('Donation Information', 'give'); ?></h3>
360 360
 
361 361
 								<div class="inside">
362 362
 
363 363
 									<div class="column-container">
364 364
 										<div class="column">
365 365
 											<p>
366
-												<strong><?php esc_html_e( 'Donation Form ID:', 'give' ); ?></strong><br>
366
+												<strong><?php esc_html_e('Donation Form ID:', 'give'); ?></strong><br>
367 367
 												<?php
368
-												if ( $payment_meta['form_id'] ) :
368
+												if ($payment_meta['form_id']) :
369 369
 													printf(
370 370
 														'<a href="%1$s">#%2$s</a>',
371
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
371
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
372 372
 														$payment_meta['form_id']
373 373
 													);
374 374
 												endif;
375 375
 												?>
376 376
 											</p>
377 377
 											<p>
378
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
378
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
379 379
 												<?php
380 380
 												echo Give()->html->forms_dropdown(
381 381
 													array(
@@ -391,21 +391,21 @@  discard block
 block discarded – undo
391 391
 										</div>
392 392
 										<div class="column">
393 393
 											<p>
394
-												<strong><?php esc_html_e( 'Donation Date:', 'give' ); ?></strong><br>
395
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
394
+												<strong><?php esc_html_e('Donation Date:', 'give'); ?></strong><br>
395
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
396 396
 											</p>
397 397
 											<p>
398
-												<strong><?php esc_html_e( 'Donation Level:', 'give' ); ?></strong><br>
398
+												<strong><?php esc_html_e('Donation Level:', 'give'); ?></strong><br>
399 399
 												<span class="give-donation-level">
400 400
 													<?php
401
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
402
-													if ( empty( $var_prices ) ) {
403
-														esc_html_e( 'n/a', 'give' );
401
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
402
+													if (empty($var_prices)) {
403
+														esc_html_e('n/a', 'give');
404 404
 													} else {
405 405
 														$prices_atts = array();
406
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
407
-															foreach ( $variable_prices as $variable_price ) {
408
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
406
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
407
+															foreach ($variable_prices as $variable_price) {
408
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
409 409
 															}
410 410
 														}
411 411
 														// Variable price dropdown options.
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 															'name'             => 'give-variable-price',
415 415
 															'chosen'           => true,
416 416
 															'show_option_all'  => '',
417
-															'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ),
418
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
417
+															'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''),
418
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
419 419
 															'selected'         => $payment_meta['price_id'],
420 420
 														);
421 421
 														// Render variable prices select tag html.
422
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
422
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
423 423
 													}
424 424
 													?>
425 425
 												</span>
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 										</div>
428 428
 										<div class="column">
429 429
 											<p>
430
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
431
-												<?php echo give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); ?>
430
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
431
+												<?php echo give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); ?>
432 432
 											</p>
433 433
 											<p>
434 434
 												<?php
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 												 *
442 442
 												 * @param int $payment_id Payment id.
443 443
 												 */
444
-												do_action( 'give_donation_details_thead_before', $payment_id );
444
+												do_action('give_donation_details_thead_before', $payment_id);
445 445
 
446 446
 
447 447
 												/**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 												 *
454 454
 												 * @param int $payment_id Payment id.
455 455
 												 */
456
-												do_action( 'give_donation_details_thead_after', $payment_id );
456
+												do_action('give_donation_details_thead_after', $payment_id);
457 457
 
458 458
 												/**
459 459
 												 * Fires in order details page, in the donation-information metabox, before the body elements.
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 												 *
465 465
 												 * @param int $payment_id Payment id.
466 466
 												 */
467
-												do_action( 'give_donation_details_tbody_before', $payment_id );
467
+												do_action('give_donation_details_tbody_before', $payment_id);
468 468
 
469 469
 												/**
470 470
 												 * Fires in order details page, in the donation-information metabox, after the body elements.
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 												 *
476 476
 												 * @param int $payment_id Payment id.
477 477
 												 */
478
-												do_action( 'give_donation_details_tbody_after', $payment_id );
478
+												do_action('give_donation_details_tbody_after', $payment_id);
479 479
 												?>
480 480
 											</p>
481 481
 										</div>
@@ -495,58 +495,58 @@  discard block
 block discarded – undo
495 495
 							 *
496 496
 							 * @param int $payment_id Payment id.
497 497
 							 */
498
-							do_action( 'give_view_order_details_files_after', $payment_id );
498
+							do_action('give_view_order_details_files_after', $payment_id);
499 499
 							?>
500 500
 
501 501
 							<div id="give-donor-details" class="postbox">
502
-								<h3 class="hndle"><?php esc_html_e( 'Donor Details', 'give' ); ?></h3>
502
+								<h3 class="hndle"><?php esc_html_e('Donor Details', 'give'); ?></h3>
503 503
 
504 504
 								<div class="inside">
505 505
 
506
-									<?php $donor = new Give_Donor( $donor_id ); ?>
506
+									<?php $donor = new Give_Donor($donor_id); ?>
507 507
 
508 508
 									<div class="column-container donor-info">
509 509
 										<div class="column">
510 510
 											<p>
511
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
511
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
512 512
 												<?php
513
-												if ( ! empty( $donor->id ) ) {
513
+												if ( ! empty($donor->id)) {
514 514
 													printf(
515 515
 														'<a href="%1$s">#%2$s</a>',
516
-														admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ),
516
+														admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id),
517 517
 														$donor->id
518 518
 													);
519 519
 												}
520 520
 												?>
521 521
 											</p>
522 522
 											<p>
523
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
524
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?>
523
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
524
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)); ?>
525 525
 											</p>
526 526
 										</div>
527 527
 										<div class="column">
528 528
 											<p>
529
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
529
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
530 530
 												<?php
531
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
532
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
531
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
532
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
533 533
 
534 534
 												// Check whether the donor name and WP_User name is same or not.
535
-												if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
536
-													echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)';
535
+												if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
536
+													echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)';
537 537
 												} else {
538 538
 													echo $donor_name;
539 539
 												}
540 540
 												?>
541 541
 											</p>
542 542
 											<p>
543
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
543
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
544 544
 												<?php echo $donor->email; ?>
545 545
 											</p>
546 546
 										</div>
547 547
 										<div class="column">
548 548
 											<p>
549
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
549
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
550 550
 												<?php
551 551
 												echo Give()->html->donor_dropdown(
552 552
 													array(
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 												?>
558 558
 											</p>
559 559
 											<p>
560
-												<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>
560
+												<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>
561 561
 											</p>
562 562
 										</div>
563 563
 									</div>
@@ -565,13 +565,13 @@  discard block
 block discarded – undo
565 565
 									<div class="column-container new-donor" style="display: none">
566 566
 										<div class="column">
567 567
 											<p>
568
-												<label for="give-new-donor-name"><?php esc_html_e( 'New Donor Name:', 'give' ); ?></label>
568
+												<label for="give-new-donor-name"><?php esc_html_e('New Donor Name:', 'give'); ?></label>
569 569
 												<input id="give-new-donor-name" type="text" name="give-new-donor-name" value="" class="medium-text"/>
570 570
 											</p>
571 571
 										</div>
572 572
 										<div class="column">
573 573
 											<p>
574
-												<label for="give-new-donor-email"><?php esc_html_e( 'New Donor Email:', 'give' ); ?></label>
574
+												<label for="give-new-donor-email"><?php esc_html_e('New Donor Email:', 'give'); ?></label>
575 575
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
576 576
 											</p>
577 577
 										</div>
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 											<p>
580 580
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
581 581
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
582
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
582
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php esc_html_e('Cancel', 'give'); ?></a>
583 583
 												<br>
584
-												<em><?php esc_html_e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
584
+												<em><?php esc_html_e('Click "Save Donation" to create new donor.', 'give'); ?></em>
585 585
 											</p>
586 586
 										</div>
587 587
 									</div>
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 									 * @param array $payment_meta Payment meta.
598 598
 									 * @param array $user_info    User information.
599 599
 									 */
600
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
600
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
601 601
 
602 602
 									/**
603 603
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 									 *
607 607
 									 * @param int $payment_id Payment id.
608 608
 									 */
609
-									do_action( 'give_payment_view_details', $payment_id );
609
+									do_action('give_payment_view_details', $payment_id);
610 610
 									?>
611 611
 
612 612
 								</div>
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
 							 *
623 623
 							 * @param int $payment_id Payment id.
624 624
 							 */
625
-							do_action( 'give_view_order_details_billing_before', $payment_id );
625
+							do_action('give_view_order_details_billing_before', $payment_id);
626 626
 							?>
627 627
 
628 628
 							<div id="give-billing-details" class="postbox">
629
-								<h3 class="hndle"><?php esc_html_e( 'Billing Address', 'give' ); ?></h3>
629
+								<h3 class="hndle"><?php esc_html_e('Billing Address', 'give'); ?></h3>
630 630
 
631 631
 								<div class="inside">
632 632
 
@@ -636,9 +636,9 @@  discard block
 block discarded – undo
636 636
 											<div class="data column-container">
637 637
 
638 638
 												<?php
639
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
639
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
640 640
 
641
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
641
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
642 642
 
643 643
 												// Get the country list that does not have any states init.
644 644
 												$no_states_country = give_no_states_country_list();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 
647 647
 												<div class="row">
648 648
 													<div id="give-order-address-country-wrap">
649
-														<label class="order-data-address-line"><?php esc_html_e( 'Country:', 'give' ); ?></label>
649
+														<label class="order-data-address-line"><?php esc_html_e('Country:', 'give'); ?></label>
650 650
 														<?php
651 651
 														echo Give()->html->select(
652 652
 															array(
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 																'show_option_all'  => false,
657 657
 																'show_option_none' => false,
658 658
 																'chosen'           => true,
659
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
660
-																'data'             => array( 'search-type' => 'no_ajax' ),
659
+																'placeholder'      => esc_attr__('Select a country', 'give'),
660
+																'data'             => array('search-type' => 'no_ajax'),
661 661
 															)
662 662
 														);
663 663
 														?>
@@ -666,35 +666,35 @@  discard block
 block discarded – undo
666 666
 
667 667
 												<div class="row">
668 668
 													<div class="give-wrap-address-line1">
669
-														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e( 'Address 1:', 'give' ); ?></label>
670
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
669
+														<label for="give-payment-address-line1" class="order-data-address"><?php esc_html_e('Address 1:', 'give'); ?></label>
670
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
671 671
 													</div>
672 672
 												</div>
673 673
 
674 674
 												<div class="row">
675 675
 													<div class="give-wrap-address-line2">
676
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e( 'Address 2:', 'give' ); ?></label>
677
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
676
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php esc_html_e('Address 2:', 'give'); ?></label>
677
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
678 678
 													</div>
679 679
 												</div>
680 680
 
681 681
 												<div class="row">
682 682
 													<div class="give-wrap-address-city">
683
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
684
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
683
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
684
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
685 685
 													</div>
686 686
 												</div>
687 687
 
688 688
 												<?php
689
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
689
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
690 690
 												?>
691 691
 												<div class="row">
692
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
693
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
694
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
692
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
693
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
694
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
695 695
 															<?php
696
-															$states = give_get_states( $address['country'] );
697
-															if ( ! empty( $states ) ) {
696
+															$states = give_get_states($address['country']);
697
+															if ( ! empty($states)) {
698 698
 																echo Give()->html->select(
699 699
 																	array(
700 700
 																		'options'          => $states,
@@ -703,23 +703,23 @@  discard block
 block discarded – undo
703 703
 																		'show_option_all'  => false,
704 704
 																		'show_option_none' => false,
705 705
 																		'chosen'           => true,
706
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
707
-																		'data'             => array( 'search-type' => 'no_ajax' ),
706
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
707
+																		'data'             => array('search-type' => 'no_ajax'),
708 708
 																	)
709 709
 																);
710 710
 															} else {
711 711
 																?>
712
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
712
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
713 713
 																<?php
714 714
 															}
715 715
 															?>
716 716
 														</div>
717 717
 													</div>
718 718
 
719
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
719
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
720 720
 														<div class="give-wrap-address-zip">
721
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label>
722
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
721
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label>
722
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
723 723
 														</div>
724 724
 													</div>
725 725
 												</div>
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 									 *
739 739
 									 * @param int $payment_id Payment id.
740 740
 									 */
741
-									do_action( 'give_payment_billing_details', $payment_id );
741
+									do_action('give_payment_billing_details', $payment_id);
742 742
 									?>
743 743
 
744 744
 								</div>
@@ -754,33 +754,33 @@  discard block
 block discarded – undo
754 754
 							 *
755 755
 							 * @param int $payment_id Payment id.
756 756
 							 */
757
-							do_action( 'give_view_order_details_billing_after', $payment_id );
757
+							do_action('give_view_order_details_billing_after', $payment_id);
758 758
 							?>
759 759
 
760 760
 							<div id="give-payment-notes" class="postbox">
761
-								<h3 class="hndle"><?php esc_html_e( 'Donation Notes', 'give' ); ?></h3>
761
+								<h3 class="hndle"><?php esc_html_e('Donation Notes', 'give'); ?></h3>
762 762
 
763 763
 								<div class="inside">
764 764
 									<div id="give-payment-notes-inner">
765 765
 										<?php
766
-										$notes = give_get_payment_notes( $payment_id );
767
-										if ( ! empty( $notes ) ) {
766
+										$notes = give_get_payment_notes($payment_id);
767
+										if ( ! empty($notes)) {
768 768
 											$no_notes_display = ' style="display:none;"';
769
-											foreach ( $notes as $note ) :
769
+											foreach ($notes as $note) :
770 770
 
771
-												echo give_get_payment_note_html( $note, $payment_id );
771
+												echo give_get_payment_note_html($note, $payment_id);
772 772
 
773 773
 											endforeach;
774 774
 										} else {
775 775
 											$no_notes_display = '';
776 776
 										}
777
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
777
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
778 778
 										?>
779 779
 									</div>
780 780
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
781 781
 
782 782
 									<div class="give-clearfix">
783
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php esc_html_e( 'Add Note', 'give' ); ?></button>
783
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php esc_html_e('Add Note', 'give'); ?></button>
784 784
 									</div>
785 785
 
786 786
 								</div>
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 							 *
797 797
 							 * @param int $payment_id Payment id.
798 798
 							 */
799
-							do_action( 'give_view_order_details_main_after', $payment_id );
799
+							do_action('give_view_order_details_main_after', $payment_id);
800 800
 							?>
801 801
 
802 802
 						</div>
@@ -818,11 +818,11 @@  discard block
 block discarded – undo
818 818
 		 *
819 819
 		 * @param int $payment_id Payment id.
820 820
 		 */
821
-		do_action( 'give_view_order_details_form_bottom', $payment_id );
821
+		do_action('give_view_order_details_form_bottom', $payment_id);
822 822
 
823
-		wp_nonce_field( 'give_update_payment_details_nonce' );
823
+		wp_nonce_field('give_update_payment_details_nonce');
824 824
 		?>
825
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
825
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
826 826
 		<input type="hidden" name="give_action" value="update_payment_details"/>
827 827
 	</form>
828 828
 	<?php
@@ -833,6 +833,6 @@  discard block
 block discarded – undo
833 833
 	 *
834 834
 	 * @param int $payment_id Payment id.
835 835
 	 */
836
-	do_action( 'give_view_order_details_after', $payment_id );
836
+	do_action('give_view_order_details_after', $payment_id);
837 837
 	?>
838 838
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,52 +25,52 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	// Retrieve existing payment meta.
43 43
 	$meta      = $payment->get_meta();
44 44
 	$user_info = $payment->user_info;
45 45
 
46 46
 	$status = $data['give-payment-status'];
47
-	$date   = sanitize_text_field( $data['give-payment-date'] );
48
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
47
+	$date   = sanitize_text_field($data['give-payment-date']);
48
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
49 49
 
50 50
 	// Restrict to our high and low.
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low.
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address = give_clean( $data['give-payment-address'][0] );
66
+	$address = give_clean($data['give-payment-address'][0]);
67 67
 
68 68
 	$curr_total = $payment->total;
69
-	$new_total  = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) );
70
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$new_total  = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0));
70
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
71 71
 
72
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
73
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
72
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
73
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
74 74
 
75 75
 	/**
76 76
 	 * Fires before updating edited donation.
@@ -80,100 +80,100 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $payment_id The ID of the payment.
82 82
 	 */
83
-	do_action( 'give_update_edited_donation', $payment_id );
83
+	do_action('give_update_edited_donation', $payment_id);
84 84
 
85 85
 	$payment->date = $date;
86 86
 	$updated       = $payment->save();
87 87
 
88
-	if ( 0 === $updated ) {
89
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
88
+	if (0 === $updated) {
89
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
90 90
 	}
91 91
 
92 92
 	$donor_changed = false;
93 93
 
94
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
94
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
95 95
 
96
-		$email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
97
-		$names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : '';
96
+		$email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
97
+		$names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : '';
98 98
 
99
-		if ( empty( $email ) || empty( $names ) ) {
100
-			wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
99
+		if (empty($email) || empty($names)) {
100
+			wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
101 101
 		}
102 102
 
103
-		$donor = new Give_Donor( $email );
104
-		if ( empty( $donor->id ) ) {
105
-			$donor_data = array( 'name' => $names, 'email' => $email );
106
-			$user_id       = email_exists( $email );
107
-			if ( false !== $user_id ) {
103
+		$donor = new Give_Donor($email);
104
+		if (empty($donor->id)) {
105
+			$donor_data = array('name' => $names, 'email' => $email);
106
+			$user_id = email_exists($email);
107
+			if (false !== $user_id) {
108 108
 				$donor_data['user_id'] = $user_id;
109 109
 			}
110 110
 
111
-			if ( ! $donor->create( $donor_data ) ) {
111
+			if ( ! $donor->create($donor_data)) {
112 112
 				// Failed to crete the new donor, assume the previous donor.
113 113
 				$donor_changed = false;
114
-				$donor         = new Give_Donor( $curr_donor_id );
115
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
114
+				$donor         = new Give_Donor($curr_donor_id);
115
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
116 116
 			}
117 117
 		}
118 118
 
119 119
 		$new_donor_id = $donor->id;
120 120
 
121
-		$previous_donor = new Give_Donor( $curr_donor_id );
121
+		$previous_donor = new Give_Donor($curr_donor_id);
122 122
 
123 123
 		$donor_changed = true;
124 124
 
125
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
125
+	} elseif ($curr_donor_id !== $new_donor_id) {
126 126
 
127
-		$donor = new Give_Donor( $new_donor_id );
127
+		$donor = new Give_Donor($new_donor_id);
128 128
 		$email    = $donor->email;
129 129
 		$names    = $donor->name;
130 130
 
131
-		$previous_donor = new Give_Donor( $curr_donor_id );
131
+		$previous_donor = new Give_Donor($curr_donor_id);
132 132
 
133 133
 		$donor_changed = true;
134 134
 
135 135
 	} else {
136
-		$donor = new Give_Donor( $curr_donor_id );
136
+		$donor = new Give_Donor($curr_donor_id);
137 137
 		$email    = $donor->email;
138 138
 		$names    = $donor->name;
139 139
 
140 140
 	}
141 141
 
142
-	if ( $donor_changed ) {
142
+	if ($donor_changed) {
143 143
 
144 144
 		// Setup first and last name from input values.
145
-		$names      = explode( ' ', $names );
146
-		$first_name = ! empty( $names[0] ) ? $names[0] : '';
145
+		$names      = explode(' ', $names);
146
+		$first_name = ! empty($names[0]) ? $names[0] : '';
147 147
 		$last_name  = '';
148
-		if ( ! empty( $names[1] ) ) {
149
-			unset( $names[0] );
150
-			$last_name = implode( ' ', $names );
148
+		if ( ! empty($names[1])) {
149
+			unset($names[0]);
150
+			$last_name = implode(' ', $names);
151 151
 		}
152 152
 
153 153
 		$payment->first_name = $first_name;
154 154
 		$payment->last_name  = $last_name;
155 155
 
156 156
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
157
-		$previous_donor->remove_payment( $payment_id, false );
158
-		$donor->attach_payment( $payment_id, false );
157
+		$previous_donor->remove_payment($payment_id, false);
158
+		$donor->attach_payment($payment_id, false);
159 159
 
160
-		if ( 'publish' == $status ) {
160
+		if ('publish' == $status) {
161 161
 
162 162
 			// Reduce previous user donation count and amount.
163 163
 			$previous_donor->decrease_donation_count();
164
-			$previous_donor->decrease_value( $curr_total );
164
+			$previous_donor->decrease_value($curr_total);
165 165
 
166 166
 			// If donation was completed adjust stats of new donors.
167 167
 			$donor->increase_purchase_count();
168
-			$donor->increase_value( $new_total );
168
+			$donor->increase_value($new_total);
169 169
 		}
170 170
 
171 171
 		$payment->customer_id = $donor->id;
172 172
 	} else {
173 173
 
174
-		if ( 'publish' === $status ) {
174
+		if ('publish' === $status) {
175 175
 			// Update user donation stat.
176
-			$donor->update_donation_value( $curr_total, $new_total );
176
+			$donor->update_donation_value($curr_total, $new_total);
177 177
 		}
178 178
 	}
179 179
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	$payment->total      = $new_total;
185 185
 
186 186
 	// Check for payment notes.
187
-	if ( ! empty( $data['give-payment-note'] ) ) {
187
+	if ( ! empty($data['give-payment-note'])) {
188 188
 
189
-		$note = wp_kses( $data['give-payment-note'], array() );
190
-		give_insert_payment_note( $payment_id, $note );
189
+		$note = wp_kses($data['give-payment-note'], array());
190
+		give_insert_payment_note($payment_id, $note);
191 191
 
192 192
 	}
193 193
 
@@ -195,17 +195,17 @@  discard block
 block discarded – undo
195 195
 	$payment->status = $status;
196 196
 
197 197
 	// Adjust total store earnings if the payment total has been changed.
198
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
198
+	if ($new_total !== $curr_total && 'publish' == $status) {
199 199
 
200
-		if ( $new_total > $curr_total ) {
200
+		if ($new_total > $curr_total) {
201 201
 			// Increase if our new total is higher.
202 202
 			$difference = $new_total - $curr_total;
203
-			give_increase_total_earnings( $difference );
203
+			give_increase_total_earnings($difference);
204 204
 
205
-		} elseif ( $curr_total > $new_total ) {
205
+		} elseif ($curr_total > $new_total) {
206 206
 			// Decrease if our new total is lower.
207 207
 			$difference = $curr_total - $new_total;
208
-			give_decrease_total_earnings( $difference );
208
+			give_decrease_total_earnings($difference);
209 209
 
210 210
 		}
211 211
 	}
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 	$payment->save();
214 214
 
215 215
 	// Get new give form ID.
216
-	$new_form_id     = absint( $data['give-payment-form-select'] );
217
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
216
+	$new_form_id     = absint($data['give-payment-form-select']);
217
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
218 218
 
219 219
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
220 220
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
221 221
 	// Check if user want to transfer current payment to new give form id.
222
-	if ( $new_form_id && $new_form_id != $current_form_id ) {
222
+	if ($new_form_id && $new_form_id != $current_form_id) {
223 223
 
224 224
 		// Get new give form title.
225
-		$new_form_title = get_the_title( $new_form_id );
225
+		$new_form_title = get_the_title($new_form_id);
226 226
 
227 227
 		// Update new give form data in payment data.
228 228
 		$payment_meta               = $payment->get_meta();
@@ -230,43 +230,43 @@  discard block
 block discarded – undo
230 230
 		$payment_meta['form_id']    = $new_form_id;
231 231
 
232 232
 		// Update price id post meta data for set donation form.
233
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
233
+		if ( ! give_has_variable_prices($new_form_id)) {
234 234
 			$payment_meta['price_id'] = '';
235 235
 		}
236 236
 
237 237
 		// Update payment give form meta data.
238
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
239
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
240
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
238
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
239
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
240
+		$payment->update_meta('_give_payment_meta', $payment_meta);
241 241
 
242 242
 		// Update price id payment metadata.
243
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
244
-			$payment->update_meta( '_give_payment_price_id', '' );
243
+		if ( ! give_has_variable_prices($new_form_id)) {
244
+			$payment->update_meta('_give_payment_price_id', '');
245 245
 		}
246 246
 
247 247
 		// If donation was completed, adjust stats of forms.
248
-		if ( 'publish' == $status ) {
248
+		if ('publish' == $status) {
249 249
 
250 250
 			// Decrease sale of old give form. For other payment status.
251
-			$current_form = new Give_Donate_Form( $current_form_id );
251
+			$current_form = new Give_Donate_Form($current_form_id);
252 252
 			$current_form->decrease_sales();
253
-			$current_form->decrease_earnings( $curr_total );
253
+			$current_form->decrease_earnings($curr_total);
254 254
 
255 255
 			// Increase sale of new give form.
256
-			$new_form = new Give_Donate_Form( $new_form_id );
256
+			$new_form = new Give_Donate_Form($new_form_id);
257 257
 			$new_form->increase_sales();
258
-			$new_form->increase_earnings( $new_total );
258
+			$new_form->increase_earnings($new_total);
259 259
 		}
260 260
 
261 261
 		// Re setup payment to update new meta value in object.
262
-		$payment->update_payment_setup( $payment->ID );
262
+		$payment->update_payment_setup($payment->ID);
263 263
 	}
264 264
 
265 265
 	// Update price id if current form is variable form.
266 266
 	/* @var Give_Donate_Form $form */
267
-	$form = new Give_Donate_Form( $payment->form_id );
267
+	$form = new Give_Donate_Form($payment->form_id);
268 268
 
269
-	if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) {
269
+	if (isset($data['give-variable-price']) && $form->has_variable_prices()) {
270 270
 
271 271
 		// Get payment meta data.
272 272
 		$payment_meta = $payment->get_meta();
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 		$price_id = '';
276 276
 
277 277
 		// Get price info
278
-		if( 0 <= $data['give-variable-price'] ) {
279
-			foreach ( $form->prices as $variable_price ) {
280
-				if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) {
278
+		if (0 <= $data['give-variable-price']) {
279
+			foreach ($form->prices as $variable_price) {
280
+				if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) {
281 281
 					$price_info = $variable_price;
282 282
 					break;
283 283
 				}
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 
287 287
 		// Set price id.
288
-		if( ! empty( $price_info ) ) {
288
+		if ( ! empty($price_info)) {
289 289
 			$price_id = $data['give-variable-price'];
290 290
 
291
-			if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) {
291
+			if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) {
292 292
 				// Set price id to amount match.
293 293
 				$price_id = $price_info['_give_id']['level_id'];
294 294
 			}
295 295
 
296
-		} elseif( $form->is_custom_price_mode() ){
296
+		} elseif ($form->is_custom_price_mode()) {
297 297
 			$price_id = 'custom';
298 298
 		}
299 299
 
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 		$payment_meta['price_id'] = $price_id;
302 302
 
303 303
 		// Update payment give form meta data.
304
-		$payment->update_meta( '_give_payment_price_id', $price_id );
305
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
304
+		$payment->update_meta('_give_payment_price_id', $price_id);
305
+		$payment->update_meta('_give_payment_meta', $payment_meta);
306 306
 
307 307
 		// Re setup payment to update new meta value in object.
308
-		$payment->update_payment_setup( $payment->ID );
308
+		$payment->update_payment_setup($payment->ID);
309 309
 	}
310 310
 
311 311
 	/**
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 	 *
317 317
 	 * @param int $payment_id The ID of the payment.
318 318
 	 */
319
-	do_action( 'give_updated_edited_donation', $payment_id );
319
+	do_action('give_updated_edited_donation', $payment_id);
320 320
 
321
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) );
321
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id));
322 322
 	exit;
323 323
 }
324 324
 
325
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
325
+add_action('give_update_payment_details', 'give_update_payment_details');
326 326
 
327 327
 /**
328 328
  * Trigger a Donation Deletion.
@@ -333,48 +333,48 @@  discard block
 block discarded – undo
333 333
  *
334 334
  * @return void
335 335
  */
336
-function give_trigger_donation_delete( $data ) {
337
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
336
+function give_trigger_donation_delete($data) {
337
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
338 338
 
339
-		$payment_id = absint( $data['purchase_id'] );
339
+		$payment_id = absint($data['purchase_id']);
340 340
 
341
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
342
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
341
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
342
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
343 343
 		}
344 344
 
345
-		give_delete_donation( $payment_id );
346
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
345
+		give_delete_donation($payment_id);
346
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
347 347
 		give_die();
348 348
 	}
349 349
 }
350 350
 
351
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
351
+add_action('give_delete_payment', 'give_trigger_donation_delete');
352 352
 
353 353
 /**
354 354
  * AJAX Store Donation Note
355 355
  */
356 356
 function give_ajax_store_payment_note() {
357 357
 
358
-	$payment_id = absint( $_POST['payment_id'] );
359
-	$note       = wp_kses( $_POST['note'], array() );
358
+	$payment_id = absint($_POST['payment_id']);
359
+	$note       = wp_kses($_POST['note'], array());
360 360
 
361
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
362
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
361
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
362
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
363 363
 	}
364 364
 
365
-	if ( empty( $payment_id ) ) {
366
-		die( '-1' );
365
+	if (empty($payment_id)) {
366
+		die('-1');
367 367
 	}
368 368
 
369
-	if ( empty( $note ) ) {
370
-		die( '-1' );
369
+	if (empty($note)) {
370
+		die('-1');
371 371
 	}
372 372
 
373
-	$note_id = give_insert_payment_note( $payment_id, $note );
374
-	die( give_get_payment_note_html( $note_id ) );
373
+	$note_id = give_insert_payment_note($payment_id, $note);
374
+	die(give_get_payment_note_html($note_id));
375 375
 }
376 376
 
377
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
377
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
378 378
 
379 379
 /**
380 380
  * Triggers a donation note deletion without ajax
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
  *
386 386
  * @return void
387 387
  */
388
-function give_trigger_payment_note_deletion( $data ) {
388
+function give_trigger_payment_note_deletion($data) {
389 389
 
390
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
390
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
391 391
 		return;
392 392
 	}
393 393
 
394
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
395
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
394
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
395
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
396 396
 	}
397 397
 
398
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
398
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
399 399
 
400
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
400
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
401 401
 
402
-	wp_redirect( $edit_order_url );
402
+	wp_redirect($edit_order_url);
403 403
 }
404 404
 
405
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
405
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
406 406
 
407 407
 /**
408 408
  * Delete a payment note deletion with ajax
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
  */
414 414
 function give_ajax_delete_payment_note() {
415 415
 
416
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
417
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
416
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
417
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
418 418
 	}
419 419
 
420
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
421
-		die( '1' );
420
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
421
+		die('1');
422 422
 	} else {
423
-		die( '-1' );
423
+		die('-1');
424 424
 	}
425 425
 
426 426
 }
427 427
 
428
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
428
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-export.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Export' ) ) :
16
+if ( ! class_exists('Give_Settings_Export')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Export.
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'export';
37
-			$this->label = __( 'Export', 'give' );
37
+			$this->label = __('Export', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 
41
-			add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 );
41
+			add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2);
42 42
 
43 43
 			// Do not use main donor for this tab.
44
-			if( give_get_current_setting_tab() === $this->id ) {
45
-				add_action( 'give-tools_open_form', '__return_empty_string' );
46
-				add_action( 'give-tools_close_form', '__return_empty_string' );
44
+			if (give_get_current_setting_tab() === $this->id) {
45
+				add_action('give-tools_open_form', '__return_empty_string');
46
+				add_action('give-tools_close_form', '__return_empty_string');
47 47
 			}
48 48
 		}
49 49
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			 * @param  array $settings
62 62
 			 */
63 63
 			$settings = apply_filters(
64
-				'give_get_settings_' . $this->id,
64
+				'give_get_settings_'.$this->id,
65 65
 				array(
66 66
 					array(
67 67
 						'id'   => 'give_tools_export',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 					),
71 71
 					array(
72 72
 						'id'   => 'export',
73
-						'name' => __( 'Export', 'give' ),
73
+						'name' => __('Export', 'give'),
74 74
 						'type' => 'tools_export',
75 75
 					),
76 76
 					array(
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		 * @param $field
95 95
 		 * @param $option_value
96 96
 		 */
97
-		public function render_export_field( $field, $option_value ) {
98
-			include_once( 'views/html-admin-page-exports.php' );
97
+		public function render_export_field($field, $option_value) {
98
+			include_once('views/html-admin-page-exports.php');
99 99
 		}
100 100
 	}
101 101
 
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-payments.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function csv_cols() {
41 41
 		$cols = array(
42
-			'id'        => __( 'ID', 'give' ), // unaltered payment ID (use for querying).
43
-			'seq_id'    => __( 'Payment Number', 'give' ), // sequential payment ID.
44
-			'email'     => __( 'Email', 'give' ),
45
-			'first'     => __( 'First Name', 'give' ),
46
-			'last'      => __( 'Last Name', 'give' ),
47
-			'address1'  => __( 'Address 1', 'give' ),
48
-			'address2'  => __( 'Address 2', 'give' ),
49
-			'city'      => __( 'City', 'give' ),
50
-			'state'     => __( 'State', 'give' ),
51
-			'country'   => __( 'Country', 'give' ),
52
-			'zip'       => __( 'Zip / Postal Code', 'give' ),
53
-			'form_id'   => __( 'Form ID', 'give' ),
54
-			'form_name' => __( 'Form Name', 'give' ),
55
-			'amount'    => __( 'Amount', 'give' ) . ' (' . give_currency_symbol( '', true ) . ')',
56
-			'gateway'   => __( 'Payment Method', 'give' ),
57
-			'trans_id'  => __( 'Transaction ID', 'give' ),
58
-			'key'       => __( 'Key', 'give' ),
59
-			'date'      => __( 'Date', 'give' ),
60
-			'user'      => __( 'User', 'give' ),
61
-			'status'    => __( 'Status', 'give' )
42
+			'id'        => __('ID', 'give'), // unaltered payment ID (use for querying).
43
+			'seq_id'    => __('Payment Number', 'give'), // sequential payment ID.
44
+			'email'     => __('Email', 'give'),
45
+			'first'     => __('First Name', 'give'),
46
+			'last'      => __('Last Name', 'give'),
47
+			'address1'  => __('Address 1', 'give'),
48
+			'address2'  => __('Address 2', 'give'),
49
+			'city'      => __('City', 'give'),
50
+			'state'     => __('State', 'give'),
51
+			'country'   => __('Country', 'give'),
52
+			'zip'       => __('Zip / Postal Code', 'give'),
53
+			'form_id'   => __('Form ID', 'give'),
54
+			'form_name' => __('Form Name', 'give'),
55
+			'amount'    => __('Amount', 'give').' ('.give_currency_symbol('', true).')',
56
+			'gateway'   => __('Payment Method', 'give'),
57
+			'trans_id'  => __('Transaction ID', 'give'),
58
+			'key'       => __('Key', 'give'),
59
+			'date'      => __('Date', 'give'),
60
+			'user'      => __('User', 'give'),
61
+			'status'    => __('Status', 'give')
62 62
 		);
63 63
 
64
-		if ( ! give_get_option( 'enable_sequential' ) ) {
65
-			unset( $cols['seq_id'] );
64
+		if ( ! give_get_option('enable_sequential')) {
65
+			unset($cols['seq_id']);
66 66
 		}
67 67
 
68 68
 		return $cols;
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 			'status' => $this->status
87 87
 		);
88 88
 
89
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
89
+		if ( ! empty($this->start) || ! empty($this->end)) {
90 90
 
91 91
 			$args['date_query'] = array(
92 92
 				array(
93
-					'after'     => date( 'Y-n-d 00:00:00', strtotime( $this->start ) ),
94
-					'before'    => date( 'Y-n-d 23:59:59', strtotime( $this->end ) ),
93
+					'after'     => date('Y-n-d 00:00:00', strtotime($this->start)),
94
+					'before'    => date('Y-n-d 23:59:59', strtotime($this->end)),
95 95
 					'inclusive' => true
96 96
 				)
97 97
 			);
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 
101 101
 		// Add category or tag to payment query if any.
102
-		if ( ! empty( $this->categories ) || ! empty( $this->tags ) ) {
102
+		if ( ! empty($this->categories) || ! empty($this->tags)) {
103 103
 			$form_args = array(
104 104
 				'post_type'      => 'give_forms',
105 105
 				'post_status'    => 'publish',
106
-				'posts_per_page' => - 1,
106
+				'posts_per_page' => -1,
107 107
 				'fields'         => 'ids',
108 108
 				'tax_query'      => array(
109 109
 					'relation' => 'AND',
@@ -111,72 +111,72 @@  discard block
 block discarded – undo
111 111
 			);
112 112
 
113 113
 
114
-			if ( ! empty( $this->categories ) ) {
114
+			if ( ! empty($this->categories)) {
115 115
 				$form_args['tax_query'][] = array(
116 116
 					'taxonomy' => 'give_forms_category',
117 117
 					'terms'    => $this->categories,
118 118
 				);
119 119
 			}
120 120
 
121
-			if ( ! empty( $this->tags ) ) {
121
+			if ( ! empty($this->tags)) {
122 122
 				$form_args['tax_query'][] = array(
123 123
 					'taxonomy' => 'give_forms_tag',
124 124
 					'terms'    => $this->tags,
125 125
 				);
126 126
 			}
127 127
 
128
-			$forms = new WP_Query( $form_args );
128
+			$forms = new WP_Query($form_args);
129 129
 
130
-			if ( empty( $forms->posts ) ) {
130
+			if (empty($forms->posts)) {
131 131
 				return array();
132 132
 			}
133 133
 
134 134
 			$args['give_forms'] = $forms->posts;
135 135
 		}
136 136
 
137
-		$payments = give_get_payments( $args );
137
+		$payments = give_get_payments($args);
138 138
 
139
-		if ( $payments ) {
139
+		if ($payments) {
140 140
 
141
-			foreach ( $payments as $payment ) {
142
-				$payment_meta = give_get_payment_meta( $payment->ID );
143
-				$user_info    = give_get_payment_meta_user_info( $payment->ID );
144
-				$total        = give_donation_amount( $payment->ID );
145
-				$user_id      = isset( $user_info['id'] ) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
141
+			foreach ($payments as $payment) {
142
+				$payment_meta = give_get_payment_meta($payment->ID);
143
+				$user_info    = give_get_payment_meta_user_info($payment->ID);
144
+				$total        = give_donation_amount($payment->ID);
145
+				$user_id      = isset($user_info['id']) && $user_info['id'] != - 1 ? $user_info['id'] : $user_info['email'];
146 146
 
147
-				if ( is_numeric( $user_id ) ) {
148
-					$user = get_userdata( $user_id );
147
+				if (is_numeric($user_id)) {
148
+					$user = get_userdata($user_id);
149 149
 				} else {
150 150
 					$user = false;
151 151
 				}
152 152
 
153 153
 				$data[] = array(
154 154
 					'id'        => $payment->ID,
155
-					'seq_id'    => give_get_payment_number( $payment->ID ),
155
+					'seq_id'    => give_get_payment_number($payment->ID),
156 156
 					'email'     => $payment_meta['email'],
157 157
 					'first'     => $user_info['first_name'],
158 158
 					'last'      => $user_info['last_name'],
159
-					'address1'  => isset( $user_info['address']['line1'] ) ? $user_info['address']['line1'] : '',
160
-					'address2'  => isset( $user_info['address']['line2'] ) ? $user_info['address']['line2'] : '',
161
-					'city'      => isset( $user_info['address']['city'] ) ? $user_info['address']['city'] : '',
162
-					'state'     => isset( $user_info['address']['state'] ) ? $user_info['address']['state'] : '',
163
-					'country'   => isset( $user_info['address']['country'] ) ? $user_info['address']['country'] : '',
164
-					'zip'       => isset( $user_info['address']['zip'] ) ? $user_info['address']['zip'] : '',
165
-					'form_id'   => isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : '',
166
-					'form_name' => isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '',
167
-					'amount'    => html_entity_decode( give_format_amount( $total, array( 'sanitize' => false ) ) ),
168
-					'gateway'   => give_get_gateway_admin_label( give_get_meta( $payment->ID, '_give_payment_gateway', true ) ),
169
-					'trans_id'  => give_get_payment_transaction_id( $payment->ID ),
159
+					'address1'  => isset($user_info['address']['line1']) ? $user_info['address']['line1'] : '',
160
+					'address2'  => isset($user_info['address']['line2']) ? $user_info['address']['line2'] : '',
161
+					'city'      => isset($user_info['address']['city']) ? $user_info['address']['city'] : '',
162
+					'state'     => isset($user_info['address']['state']) ? $user_info['address']['state'] : '',
163
+					'country'   => isset($user_info['address']['country']) ? $user_info['address']['country'] : '',
164
+					'zip'       => isset($user_info['address']['zip']) ? $user_info['address']['zip'] : '',
165
+					'form_id'   => isset($payment_meta['form_id']) ? $payment_meta['form_id'] : '',
166
+					'form_name' => isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '',
167
+					'amount'    => html_entity_decode(give_format_amount($total, array('sanitize' => false))),
168
+					'gateway'   => give_get_gateway_admin_label(give_get_meta($payment->ID, '_give_payment_gateway', true)),
169
+					'trans_id'  => give_get_payment_transaction_id($payment->ID),
170 170
 					'key'       => $payment_meta['key'],
171 171
 					'date'      => $payment->post_date,
172
-					'user'      => $user ? $user->display_name : __( 'guest', 'give' ),
173
-					'status'    => give_get_payment_status( $payment, true )
172
+					'user'      => $user ? $user->display_name : __('guest', 'give'),
173
+					'status'    => give_get_payment_status($payment, true)
174 174
 				);
175 175
 
176 176
 			}
177 177
 
178
-			$data = apply_filters( 'give_export_get_data', $data );
179
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
178
+			$data = apply_filters('give_export_get_data', $data);
179
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
180 180
 
181 181
 			return $data;
182 182
 
@@ -196,27 +196,27 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$status = $this->status;
198 198
 		$args   = array(
199
-			'start-date' => date( 'n/d/Y', strtotime( $this->start ) ),
200
-			'end-date'   => date( 'n/d/Y', strtotime( $this->end ) ),
199
+			'start-date' => date('n/d/Y', strtotime($this->start)),
200
+			'end-date'   => date('n/d/Y', strtotime($this->end)),
201 201
 		);
202 202
 
203
-		if ( 'any' == $status ) {
203
+		if ('any' == $status) {
204 204
 
205
-			$total = array_sum( (array) give_count_payments( $args ) );
205
+			$total = array_sum((array) give_count_payments($args));
206 206
 
207 207
 		} else {
208 208
 
209
-			$total = give_count_payments( $args )->$status;
209
+			$total = give_count_payments($args)->$status;
210 210
 
211 211
 		}
212 212
 
213 213
 		$percentage = 100;
214 214
 
215
-		if ( $total > 0 ) {
216
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
215
+		if ($total > 0) {
216
+			$percentage = ((30 * $this->step) / $total) * 100;
217 217
 		}
218 218
 
219
-		if ( $percentage > 100 ) {
219
+		if ($percentage > 100) {
220 220
 			$percentage = 100;
221 221
 		}
222 222
 
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @param array $request The Form Data passed into the batch processing.
232 232
 	 */
233
-	public function set_properties( $request ) {
234
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
235
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
236
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
237
-		$this->categories = isset( $request['give_forms_categories'] ) ? give_clean( $request['give_forms_categories'] ) : array();
238
-		$this->tags       = isset( $request['give_forms_tags'] ) ? give_clean( $request['give_forms_tags'] ) : array();
233
+	public function set_properties($request) {
234
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
235
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
236
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
237
+		$this->categories = isset($request['give_forms_categories']) ? give_clean($request['give_forms_categories']) : array();
238
+		$this->tags       = isset($request['give_forms_tags']) ? give_clean($request['give_forms_tags']) : array();
239 239
 	}
240 240
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly..
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,134 +25,134 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 
61 61
 	if (
62
-		file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) &&
62
+		file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') &&
63 63
 
64 64
 		// RIAL exist for backward compatibility.
65
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
65
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
66 66
 	) {
67
-		TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' );
67
+		TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', '');
68 68
 		$custom_font = 'CODE2000';
69 69
 		$font_style  = 'B';
70 70
 	}
71 71
 
72
-	$pdf->AddPage( 'L', 'A4' );
73
-	$pdf->setImageScale( 1.5 );
74
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
75
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
76
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
72
+	$pdf->AddPage('L', 'A4');
73
+	$pdf->setImageScale(1.5);
74
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
75
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
76
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
77 77
 
78
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_URL . 'assets/images/give-logo-small.png' ), 247, 8 );
78
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_URL.'assets/images/give-logo-small.png'), 247, 8);
79 79
 
80
-	$pdf->SetMargins( 8, 8, 8 );
81
-	$pdf->SetX( 8 );
80
+	$pdf->SetMargins(8, 8, 8);
81
+	$pdf->SetX(8);
82 82
 
83
-	$pdf->SetFont( $default_font, '', 16 );
84
-	$pdf->SetTextColor( 50, 50, 50 );
85
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
83
+	$pdf->SetFont($default_font, '', 16);
84
+	$pdf->SetTextColor(50, 50, 50);
85
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
86 86
 
87
-	$pdf->SetFont( $default_font, '', 13 );
88
-	$pdf->SetTextColor( 150, 150, 150 );
89
-	$pdf->Ln( 1 );
90
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
87
+	$pdf->SetFont($default_font, '', 13);
88
+	$pdf->SetTextColor(150, 150, 150);
89
+	$pdf->Ln(1);
90
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
91 91
 	$pdf->Ln();
92
-	$pdf->SetTextColor( 50, 50, 50 );
93
-	$pdf->SetFont( $default_font, '', 14 );
94
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
95
-	$pdf->SetFont( $default_font, '', 12 );
92
+	$pdf->SetTextColor(50, 50, 50);
93
+	$pdf->SetFont($default_font, '', 14);
94
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
95
+	$pdf->SetFont($default_font, '', 12);
96 96
 
97
-	$pdf->SetFillColor( 238, 238, 238 );
98
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
99
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
100
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
97
+	$pdf->SetFillColor(238, 238, 238);
98
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
99
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
100
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
101 101
 
102 102
 	// Display Categories Heading only, if user has opted for it.
103
-	if ( $categories_enabled ) {
104
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
103
+	if ($categories_enabled) {
104
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
105 105
 	}
106 106
 
107 107
 	// Display Tags Heading only, if user has opted for it.
108
-	if ( $tags_enabled ) {
109
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
108
+	if ($tags_enabled) {
109
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
110 110
 	}
111 111
 
112
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
113
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
112
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
113
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
114 114
 
115 115
 	// Set Custom Font to support various currencies.
116
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
116
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
117 117
 
118
-	$year       = date( 'Y' );
119
-	$give_forms = get_posts( array(
118
+	$year       = date('Y');
119
+	$give_forms = get_posts(array(
120 120
 		'post_type'      => 'give_forms',
121 121
 		'year'           => $year,
122
-		'posts_per_page' => - 1,
122
+		'posts_per_page' => -1,
123 123
 		'supply_filter'  => false,
124
-	) );
124
+	));
125 125
 
126
-	if ( $give_forms ) {
127
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
126
+	if ($give_forms) {
127
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
128 128
 
129
-		foreach ( $give_forms as $form ):
130
-			$pdf->SetFillColor( 255, 255, 255 );
129
+		foreach ($give_forms as $form):
130
+			$pdf->SetFillColor(255, 255, 255);
131 131
 
132 132
 			$title = $form->post_title;
133 133
 
134
-			if ( give_has_variable_prices( $form->ID ) ) {
135
-				$price = html_entity_decode( give_price_range( $form->ID, false ) );
134
+			if (give_has_variable_prices($form->ID)) {
135
+				$price = html_entity_decode(give_price_range($form->ID, false));
136 136
 			} else {
137
-				$price = give_currency_filter( give_get_form_price( $form->ID ), '', true );
137
+				$price = give_currency_filter(give_get_form_price($form->ID), '', true);
138 138
 			}
139 139
 
140 140
 			// Display Categories Data only, if user has opted for it.
141 141
 			$categories = array();
142
-			if ( $categories_enabled ) {
143
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
144
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
142
+			if ($categories_enabled) {
143
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
144
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
145 145
 			}
146 146
 
147 147
 			// Display Tags Data only, if user has opted for it.
148 148
 			$tags = array();
149
-			if ( $tags_enabled ) {
150
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
151
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
149
+			if ($tags_enabled) {
150
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
151
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
152 152
 			}
153 153
 
154
-			$sales    = give_get_form_sales_stats( $form->ID );
155
-			$earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), '', true );
154
+			$sales    = give_get_form_sales_stats($form->ID);
155
+			$earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), '', true);
156 156
 
157 157
 			// This will help filter data before appending it to PDF Receipt.
158 158
 			$prepare_pdf_data   = array();
@@ -160,53 +160,53 @@  discard block
 block discarded – undo
160 160
 			$prepare_pdf_data[] = $price;
161 161
 
162 162
 			// Append Categories Data only, if user has opted for it.
163
-			if ( $categories_enabled ) {
163
+			if ($categories_enabled) {
164 164
 				$prepare_pdf_data[] = $categories;
165 165
 			}
166 166
 
167 167
 			// Append Tags Data only, if user has opted for it.
168
-			if ( $tags_enabled ) {
168
+			if ($tags_enabled) {
169 169
 				$prepare_pdf_data[] = $tags;
170 170
 			}
171 171
 
172 172
 			$prepare_pdf_data[] = $sales;
173 173
 			$prepare_pdf_data[] = $earnings;
174 174
 
175
-			$pdf->Row( $prepare_pdf_data );
175
+			$pdf->Row($prepare_pdf_data);
176 176
 
177 177
 		endforeach;
178 178
 	} else {
179 179
 
180 180
 		// Fix: Minor Styling Alignment Issue for PDF.
181
-		if ( $categories_enabled && $tags_enabled ) {
181
+		if ($categories_enabled && $tags_enabled) {
182 182
 			$no_found_width = 280;
183
-		} elseif ( $categories_enabled || $tags_enabled ) {
183
+		} elseif ($categories_enabled || $tags_enabled) {
184 184
 			$no_found_width = 235;
185 185
 		} else {
186 186
 			$no_found_width = 190;
187 187
 		}
188
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
189
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
188
+		$title = utf8_decode(__('No forms found.', 'give'));
189
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
190 190
 	}// End if().
191 191
 	$pdf->Ln();
192
-	$pdf->SetTextColor( 50, 50, 50 );
193
-	$pdf->SetFont( $default_font, '', 14 );
192
+	$pdf->SetTextColor(50, 50, 50);
193
+	$pdf->SetFont($default_font, '', 14);
194 194
 
195 195
 	// Output Graph on a new page.
196
-	$pdf->AddPage( 'L', 'A4' );
197
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
198
-	$pdf->SetFont( $default_font, '', 12 );
196
+	$pdf->AddPage('L', 'A4');
197
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
198
+	$pdf->SetFont($default_font, '', 12);
199 199
 
200
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
201
-	$image = str_replace( ' ', '%20', $image );
200
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
201
+	$image = str_replace(' ', '%20', $image);
202 202
 
203
-	$pdf->SetX( 25 );
204
-	$pdf->Image( $image . '&file=.png' );
205
-	$pdf->Ln( 7 );
206
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
203
+	$pdf->SetX(25);
204
+	$pdf->Image($image.'&file=.png');
205
+	$pdf->Ln(7);
206
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
207 207
 }
208 208
 
209
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
209
+add_action('give_generate_pdf', 'give_generate_pdf');
210 210
 
211 211
 /**
212 212
  * Draws Chart for PDF Report.
@@ -223,38 +223,38 @@  discard block
 block discarded – undo
223 223
  * @return string $chart->getUrl() URL for the Google Chart
224 224
  */
225 225
 function give_draw_chart_image() {
226
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
227
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
228
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
226
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
227
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
228
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
229 229
 
230
-	$chart = new GoogleChart( 'lc', 900, 330 );
230
+	$chart = new GoogleChart('lc', 900, 330);
231 231
 
232 232
 	$i        = 1;
233 233
 	$earnings = "";
234 234
 	$sales    = "";
235 235
 
236
-	while ( $i <= 12 ) :
237
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
238
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
239
-		$i ++;
236
+	while ($i <= 12) :
237
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
238
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
239
+		$i++;
240 240
 	endwhile;
241 241
 
242
-	$earnings_array = explode( ",", $earnings );
243
-	$sales_array    = explode( ",", $sales );
242
+	$earnings_array = explode(",", $earnings);
243
+	$sales_array    = explode(",", $sales);
244 244
 
245 245
 	$i = 0;
246
-	while ( $i <= 11 ) {
247
-		if ( empty( $sales_array[ $i ] ) ) {
248
-			$sales_array[ $i ] = 0;
246
+	while ($i <= 11) {
247
+		if (empty($sales_array[$i])) {
248
+			$sales_array[$i] = 0;
249 249
 		}
250
-		$i ++;
250
+		$i++;
251 251
 	}
252 252
 
253 253
 	$min_earnings   = 0;
254
-	$max_earnings   = max( $earnings_array );
255
-	$earnings_scale = round( $max_earnings, - 1 );
254
+	$max_earnings   = max($earnings_array);
255
+	$earnings_scale = round($max_earnings, - 1);
256 256
 
257
-	$data = new GoogleChartData( array(
257
+	$data = new GoogleChartData(array(
258 258
 		$earnings_array[0],
259 259
 		$earnings_array[1],
260 260
 		$earnings_array[2],
@@ -267,25 +267,25 @@  discard block
 block discarded – undo
267 267
 		$earnings_array[9],
268 268
 		$earnings_array[10],
269 269
 		$earnings_array[11],
270
-	) );
270
+	));
271 271
 
272
-	$data->setLegend( __( 'Income', 'give' ) );
273
-	$data->setColor( '1b58a3' );
274
-	$chart->addData( $data );
272
+	$data->setLegend(__('Income', 'give'));
273
+	$data->setColor('1b58a3');
274
+	$chart->addData($data);
275 275
 
276
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
277
-	$shape_marker->setColor( '000000' );
278
-	$shape_marker->setSize( 7 );
279
-	$shape_marker->setBorder( 2 );
280
-	$shape_marker->setData( $data );
281
-	$chart->addMarker( $shape_marker );
276
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
277
+	$shape_marker->setColor('000000');
278
+	$shape_marker->setSize(7);
279
+	$shape_marker->setBorder(2);
280
+	$shape_marker->setData($data);
281
+	$chart->addMarker($shape_marker);
282 282
 
283
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
284
-	$value_marker->setColor( '000000' );
285
-	$value_marker->setData( $data );
286
-	$chart->addMarker( $value_marker );
283
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
284
+	$value_marker->setColor('000000');
285
+	$value_marker->setData($data);
286
+	$chart->addMarker($value_marker);
287 287
 
288
-	$data = new GoogleChartData( array(
288
+	$data = new GoogleChartData(array(
289 289
 		$sales_array[0],
290 290
 		$sales_array[1],
291 291
 		$sales_array[2],
@@ -298,46 +298,46 @@  discard block
 block discarded – undo
298 298
 		$sales_array[9],
299 299
 		$sales_array[10],
300 300
 		$sales_array[11],
301
-	) );
302
-	$data->setLegend( __( 'Donations', 'give' ) );
303
-	$data->setColor( 'ff6c1c' );
304
-	$chart->addData( $data );
305
-
306
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
307
-
308
-	$chart->setScale( 0, $max_earnings );
309
-
310
-	$y_axis = new GoogleChartAxis( 'y' );
311
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
312
-	$chart->addAxis( $y_axis );
313
-
314
-	$x_axis = new GoogleChartAxis( 'x' );
315
-	$x_axis->setTickMarks( 5 );
316
-	$x_axis->setLabels( array(
317
-		__( 'Jan', 'give' ),
318
-		__( 'Feb', 'give' ),
319
-		__( 'Mar', 'give' ),
320
-		__( 'Apr', 'give' ),
321
-		__( 'May', 'give' ),
322
-		__( 'June', 'give' ),
323
-		__( 'July', 'give' ),
324
-		__( 'Aug', 'give' ),
325
-		__( 'Sept', 'give' ),
326
-		__( 'Oct', 'give' ),
327
-		__( 'Nov', 'give' ),
328
-		__( 'Dec', 'give' ),
329
-	) );
330
-	$chart->addAxis( $x_axis );
331
-
332
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
333
-	$shape_marker->setSize( 6 );
334
-	$shape_marker->setBorder( 2 );
335
-	$shape_marker->setData( $data );
336
-	$chart->addMarker( $shape_marker );
337
-
338
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
339
-	$value_marker->setData( $data );
340
-	$chart->addMarker( $value_marker );
301
+	));
302
+	$data->setLegend(__('Donations', 'give'));
303
+	$data->setColor('ff6c1c');
304
+	$chart->addData($data);
305
+
306
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
307
+
308
+	$chart->setScale(0, $max_earnings);
309
+
310
+	$y_axis = new GoogleChartAxis('y');
311
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
312
+	$chart->addAxis($y_axis);
313
+
314
+	$x_axis = new GoogleChartAxis('x');
315
+	$x_axis->setTickMarks(5);
316
+	$x_axis->setLabels(array(
317
+		__('Jan', 'give'),
318
+		__('Feb', 'give'),
319
+		__('Mar', 'give'),
320
+		__('Apr', 'give'),
321
+		__('May', 'give'),
322
+		__('June', 'give'),
323
+		__('July', 'give'),
324
+		__('Aug', 'give'),
325
+		__('Sept', 'give'),
326
+		__('Oct', 'give'),
327
+		__('Nov', 'give'),
328
+		__('Dec', 'give'),
329
+	));
330
+	$chart->addAxis($x_axis);
331
+
332
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
333
+	$shape_marker->setSize(6);
334
+	$shape_marker->setBorder(2);
335
+	$shape_marker->setData($data);
336
+	$chart->addMarker($shape_marker);
337
+
338
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
339
+	$value_marker->setData($data);
340
+	$chart->addMarker($value_marker);
341 341
 
342 342
 	return $chart->getUrl();
343 343
 }
Please login to merge, or discard this patch.
includes/admin/tools/export/class-core-settings-export.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 	 * @return void
40 40
 	 */
41 41
 	public function headers() {
42
-		ignore_user_abort( true );
42
+		ignore_user_abort(true);
43 43
 
44
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
45
-			set_time_limit( 0 );
44
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
45
+			set_time_limit(0);
46 46
 		}
47 47
 
48 48
 		nocache_headers();
49
-		header( 'Content-Type: application/json; charset=utf-8' );
50
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_core_settings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.json' );
51
-		header( 'Expires: 0' );
49
+		header('Content-Type: application/json; charset=utf-8');
50
+		header('Content-Disposition: attachment; filename='.apply_filters('give_core_settings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.json');
51
+		header('Expires: 0');
52 52
 	}
53 53
 
54 54
 	/**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @since 1.8.17
59 59
 	 */
60 60
 	public function json_core_settings_export() {
61
-		echo wp_json_encode( get_option( 'give_settings' ) );
61
+		echo wp_json_encode(get_option('give_settings'));
62 62
 	}
63 63
 
64 64
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 * @since  1.8.17
69 69
 	 */
70 70
 	public function export() {
71
-		if ( ! $this->can_export() ) {
72
-			wp_die( __( 'You do not have permission to export data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
71
+		if ( ! $this->can_export()) {
72
+			wp_die(__('You do not have permission to export data.', 'give'), __('Error', 'give'), array('response' => 403));
73 73
 		}
74 74
 
75 75
 		// Set headers.
Please login to merge, or discard this patch.
includes/admin/tools/export/export-actions.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array(
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array(
27 27
 			'response' => 403,
28
-		) );
28
+		));
29 29
 	}
30 30
 
31
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
31
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
32 32
 
33 33
 	/**
34 34
 	 * Fires before batch export.
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param string $class Export class.
39 39
 	 */
40
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
40
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
41 41
 
42 42
 	$export = new $_REQUEST['class'];
43 43
 	$export->export();
44 44
 
45 45
 }
46 46
 
47
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
47
+add_action('give_form_batch_export', 'give_process_batch_export_form');
48 48
 
49 49
 /**
50 50
  * Exports earnings for a specified time period.
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
  * @return void
56 56
  */
57 57
 function give_export_earnings() {
58
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php';
58
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php';
59 59
 
60 60
 	$earnings_export = new Give_Earnings_Export();
61 61
 
62 62
 	$earnings_export->export();
63 63
 }
64 64
 
65
-add_action( 'give_earnings_export', 'give_export_earnings' );
65
+add_action('give_earnings_export', 'give_export_earnings');
66 66
 
67 67
 /**
68 68
  * Exports Give's core settings.
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_core_settings_export() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-core-settings-export.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-core-settings-export.php';
77 77
 
78 78
 	$core_settings = new Give_Core_Settings_Export();
79 79
 
80 80
 	$core_settings->export();
81 81
 }
82 82
 
83
-add_action( 'give_core_settings_export', 'give_core_settings_export' );
83
+add_action('give_core_settings_export', 'give_core_settings_export');
84 84
 
85 85
 
86 86
 /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_register_batch_exporters() {
93
-	if ( is_admin() ) {
93
+	if (is_admin()) {
94 94
 		/**
95 95
 		 * Fires in the admin, while plugins loaded.
96 96
 		 *
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 		 *
101 101
 		 * @param string $class Export class.
102 102
 		 */
103
-		do_action( 'give_register_batch_exporter' );
103
+		do_action('give_register_batch_exporter');
104 104
 	}
105 105
 }
106 106
 
107
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
107
+add_action('plugins_loaded', 'give_register_batch_exporters');
108 108
 
109 109
 /**
110 110
  * Register the payments batch exporter
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
  * @since  1.5
113 113
  */
114 114
 function give_register_payments_batch_export() {
115
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
115
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
116 116
 }
117 117
 
118
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
118
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
119 119
 
120 120
 /**
121 121
  * Loads the payments batch process if needed
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
  *
127 127
  * @return void
128 128
  */
129
-function give_include_payments_batch_processor( $class ) {
129
+function give_include_payments_batch_processor($class) {
130 130
 
131
-	if ( 'Give_Batch_Payments_Export' === $class ) {
132
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php';
131
+	if ('Give_Batch_Payments_Export' === $class) {
132
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php';
133 133
 	}
134 134
 
135 135
 }
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
  * @since  1.5.2
141 141
  */
142 142
 function give_register_donors_batch_export() {
143
-	add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 );
143
+	add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1);
144 144
 }
145 145
 
146
-add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 );
146
+add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10);
147 147
 
148 148
 /**
149 149
  * Loads the donors batch process if needed.
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_include_donors_batch_processor( $class ) {
157
+function give_include_donors_batch_processor($class) {
158 158
 
159
-	if ( 'Give_Batch_Donors_Export' === $class ) {
160
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php';
159
+	if ('Give_Batch_Donors_Export' === $class) {
160
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php';
161 161
 	}
162 162
 
163 163
 }
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
  * @since  1.5
169 169
  */
170 170
 function give_register_forms_batch_export() {
171
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
171
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
172 172
 }
173 173
 
174
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
174
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
175 175
 
176 176
 /**
177 177
  * Loads the file downloads batch process if needed
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
  *
183 183
  * @return void
184 184
  */
185
-function give_include_forms_batch_processor( $class ) {
185
+function give_include_forms_batch_processor($class) {
186 186
 
187
-	if ( 'Give_Batch_Forms_Export' === $class ) {
188
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php';
187
+	if ('Give_Batch_Forms_Export' === $class) {
188
+		require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php';
189 189
 	}
190 190
 
191 191
 }
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-api.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_API' ) ) :
16
+if ( ! class_exists('Give_Settings_API')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_API.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'api';
37
-			$this->label = esc_html__( 'API', 'give' );
37
+			$this->label = esc_html__('API', 'give');
38 38
 
39 39
 			parent::__construct();
40 40
 		}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		 */
48 48
 		public function get_settings() {
49 49
 			// Get settings.
50
-			$settings = apply_filters( 'give_settings_api', array(
50
+			$settings = apply_filters('give_settings_api', array(
51 51
 				array(
52 52
 					'id'   => 'give_tools_api',
53 53
 					'type' => 'title',
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 				),
56 56
 				array(
57 57
 					'id'   => 'api',
58
-					'name' => esc_html__( 'API', 'give' ),
58
+					'name' => esc_html__('API', 'give'),
59 59
 					'type' => 'api',
60 60
 				),
61 61
 				array(
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			 * @since  1.8
72 72
 			 * @param  array $settings
73 73
 			 */
74
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
74
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
75 75
 
76 76
 			// Output.
77 77
 			return $settings;
Please login to merge, or discard this patch.