Test Failed
Push — master ( cd44a0...d8bbfb )
by Devin
01:14
created
includes/admin/settings/class-settings-general.php 1 patch
Spacing   +72 added lines, -72 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_General' ) ) :
16
+if ( ! class_exists('Give_Settings_General')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_General.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'general';
30
-			$this->label = __( 'General', 'give' );
30
+			$this->label = __('General', 'give');
31 31
 
32 32
 			$this->default_tab = 'general-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'access-control':
49 49
 					$settings = array(
50 50
 						// Section 3: Access control.
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 						),
55 55
 						array(
56 56
 							'id'      => 'session_lifetime',
57
-							'name'    => __( 'Session Lifetime', 'give' ),
58
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
57
+							'name'    => __('Session Lifetime', 'give'),
58
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
59 59
 							'type'    => 'select',
60 60
 							'options' => array(
61
-								'86400'  => __( '24 Hours', 'give' ),
62
-								'172800' => __( '48 Hours', 'give' ),
63
-								'259200' => __( '72 Hours', 'give' ),
64
-								'604800' => __( '1 Week', 'give' ),
61
+								'86400'  => __('24 Hours', 'give'),
62
+								'172800' => __('48 Hours', 'give'),
63
+								'259200' => __('72 Hours', 'give'),
64
+								'604800' => __('1 Week', 'give'),
65 65
 							),
66 66
 						),
67 67
 						array(
68 68
 							'id'         => 'limit_display_donations',
69
-							'name'       => __( 'Limit Donations Displayed', 'give' ),
70
-							'desc'       => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ),
69
+							'name'       => __('Limit Donations Displayed', 'give'),
70
+							'desc'       => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'),
71 71
 							'default'    => '1',
72 72
 							'type'       => 'number',
73 73
 							'css'        => 'width:50px;',
@@ -77,36 +77,36 @@  discard block
 block discarded – undo
77 77
 							),
78 78
 						),
79 79
 						array(
80
-							'name'    => __( 'Email Access', 'give' ),
81
-							'desc'    => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
80
+							'name'    => __('Email Access', 'give'),
81
+							'desc'    => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
82 82
 							'id'      => 'email_access',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'disabled',
85 85
 							'options' => array(
86
-								'enabled'  => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled'  => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							),
89 89
 						),
90 90
 						array(
91 91
 							'id'      => 'recaptcha_key',
92
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
92
+							'name'    => __('reCAPTCHA Site Key', 'give'),
93 93
 							/* translators: %s: https://www.google.com/recaptcha/ */
94
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ),
94
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')),
95 95
 							'default' => '',
96 96
 							'type'    => 'text',
97 97
 						),
98 98
 						array(
99 99
 							'id'      => 'recaptcha_secret',
100
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
101
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give' ),
100
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
101
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give'),
102 102
 							'default' => '',
103 103
 							'type'    => 'text',
104 104
 						),
105 105
 						array(
106
-							'name'  => __( 'Access Control Docs Link', 'give' ),
106
+							'name'  => __('Access Control Docs Link', 'give'),
107 107
 							'id'    => 'access_control_docs_link',
108
-							'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
109
-							'title' => __( 'Access Control', 'give' ),
108
+							'url'   => esc_url('http://docs.givewp.com/settings-access-control'),
109
+							'title' => __('Access Control', 'give'),
110 110
 							'type'  => 'give_docs_link',
111 111
 						),
112 112
 						array(
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 					break;
118 118
 
119 119
 				case 'currency-settings' :
120
-					$currency_position_before = __( 'Before - %s&#x200e;10', 'give' );
121
-					$currency_position_after  = __( 'After - 10%s&#x200f;', 'give' );
120
+					$currency_position_before = __('Before - %s&#x200e;10', 'give');
121
+					$currency_position_after  = __('After - 10%s&#x200f;', 'give');
122 122
 
123 123
 					$settings = array(
124 124
 						// Section 2: Currency
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 							'id'   => 'give_title_general_settings_2',
128 128
 						),
129 129
 						array(
130
-							'name' => __( 'Currency Settings', 'give' ),
130
+							'name' => __('Currency Settings', 'give'),
131 131
 							'desc' => '',
132 132
 							'type' => 'give_title',
133 133
 							'id'   => 'give_title_general_settings_2',
134 134
 						),
135 135
 						array(
136
-							'name'    => __( 'Currency', 'give' ),
137
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
136
+							'name'    => __('Currency', 'give'),
137
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
138 138
 							'id'      => 'currency',
139 139
 							'class'   => 'give-select-chosen',
140 140
 							'type'    => 'select',
@@ -142,51 +142,51 @@  discard block
 block discarded – undo
142 142
 							'default' => 'USD',
143 143
 						),
144 144
 						array(
145
-							'name'       => __( 'Currency Position', 'give' ),
146
-							'desc'       => __( 'The position of the currency symbol.', 'give' ),
145
+							'name'       => __('Currency Position', 'give'),
146
+							'desc'       => __('The position of the currency symbol.', 'give'),
147 147
 							'id'         => 'currency_position',
148 148
 							'type'       => 'select',
149 149
 							'options'    => array(
150 150
 								/* translators: %s: currency symbol */
151
-								'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ),
151
+								'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())),
152 152
 								/* translators: %s: currency symbol */
153
-								'after'  => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ),
153
+								'after'  => sprintf($currency_position_after, give_currency_symbol(give_get_currency())),
154 154
 							),
155 155
 							'default'    => 'before',
156 156
 							'attributes' => array(
157
-								'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ),
158
-								'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ),
157
+								'data-before-template' => sprintf($currency_position_before, '{currency_pos}'),
158
+								'data-after-template' => sprintf($currency_position_after, '{currency_pos}'),
159 159
 							),
160 160
 						),
161 161
 						array(
162
-							'name'    => __( 'Thousands Separator', 'give' ),
163
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
162
+							'name'    => __('Thousands Separator', 'give'),
163
+							'desc'    => __('The symbol (typically , or .) to separate thousands.', 'give'),
164 164
 							'id'      => 'thousands_separator',
165 165
 							'type'    => 'text',
166 166
 							'default' => ',',
167 167
 							'css'     => 'width:12em;',
168 168
 						),
169 169
 						array(
170
-							'name'    => __( 'Decimal Separator', 'give' ),
171
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
170
+							'name'    => __('Decimal Separator', 'give'),
171
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
172 172
 							'id'      => 'decimal_separator',
173 173
 							'type'    => 'text',
174 174
 							'default' => '.',
175 175
 							'css'     => 'width:12em;',
176 176
 						),
177 177
 						array(
178
-							'name'    => __( 'Number of Decimals', 'give' ),
179
-							'desc'    => __( 'The number of decimal points displayed in amounts.', 'give' ),
178
+							'name'    => __('Number of Decimals', 'give'),
179
+							'desc'    => __('The number of decimal points displayed in amounts.', 'give'),
180 180
 							'id'      => 'number_decimals',
181 181
 							'type'    => 'text',
182 182
 							'default' => 2,
183 183
 							'css'     => 'width:12em;',
184 184
 						),
185 185
 						array(
186
-							'name'  => __( 'Currency Options Docs Link', 'give' ),
186
+							'name'  => __('Currency Options Docs Link', 'give'),
187 187
 							'id'    => 'currency_settings_docs_link',
188
-							'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
189
-							'title' => __( 'Currency Settings', 'give' ),
188
+							'url'   => esc_url('http://docs.givewp.com/settings-currency'),
189
+							'title' => __('Currency Settings', 'give'),
190 190
 							'type'  => 'give_docs_link',
191 191
 						),
192 192
 						array(
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 					$country = give_get_country();
203 203
 
204 204
 					// get the list of the states of which default country is selected.
205
-					$states = give_get_states( $country );
205
+					$states = give_get_states($country);
206 206
 
207 207
 					// Get the country list that does not have any states init.
208 208
 					$no_states_country = give_no_states_country_list();
@@ -214,46 +214,46 @@  discard block
 block discarded – undo
214 214
 							'id'   => 'give_title_general_settings_1',
215 215
 						),
216 216
 						array(
217
-							'name' => __( 'General Settings', 'give' ),
217
+							'name' => __('General Settings', 'give'),
218 218
 							'desc' => '',
219 219
 							'type' => 'give_title',
220 220
 							'id'   => 'give_title_general_settings_1',
221 221
 						),
222 222
 						array(
223
-							'name'    => __( 'Success Page', 'give' ),
223
+							'name'    => __('Success Page', 'give'),
224 224
 							/* translators: %s: [give_receipt] */
225
-							'desc'    => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
225
+							'desc'    => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
226 226
 							'id'      => 'success_page',
227 227
 							'type'    => 'select',
228
-							'options' => give_cmb2_get_post_options( array(
228
+							'options' => give_cmb2_get_post_options(array(
229 229
 								'post_type'   => 'page',
230 230
 								'numberposts' => 999,
231
-							) ),
231
+							)),
232 232
 						),
233 233
 						array(
234
-							'name'    => __( 'Failed Donation Page', 'give' ),
235
-							'desc'    => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
234
+							'name'    => __('Failed Donation Page', 'give'),
235
+							'desc'    => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
236 236
 							'id'      => 'failure_page',
237 237
 							'type'    => 'select',
238
-							'options' => give_cmb2_get_post_options( array(
238
+							'options' => give_cmb2_get_post_options(array(
239 239
 								'post_type'   => 'page',
240 240
 								'numberposts' => 999,
241
-							) ),
241
+							)),
242 242
 						),
243 243
 						array(
244
-							'name'    => __( 'Donation History Page', 'give' ),
244
+							'name'    => __('Donation History Page', 'give'),
245 245
 							/* translators: %s: [donation_history] */
246
-							'desc'    => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
246
+							'desc'    => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
247 247
 							'id'      => 'history_page',
248 248
 							'type'    => 'select',
249
-							'options' => give_cmb2_get_post_options( array(
249
+							'options' => give_cmb2_get_post_options(array(
250 250
 								'post_type'   => 'page',
251 251
 								'numberposts' => 999,
252
-							) ),
252
+							)),
253 253
 						),
254 254
 						array(
255
-							'name'    => __( 'Base Country', 'give' ),
256
-							'desc'    => __( 'The country your site operates from.', 'give' ),
255
+							'name'    => __('Base Country', 'give'),
256
+							'desc'    => __('The country your site operates from.', 'give'),
257 257
 							'id'      => 'base_country',
258 258
 							'type'    => 'select',
259 259
 							'options' => give_get_country_list(),
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
 						 * @since 1.8.14
265 265
 						 */
266 266
 						array(
267
-							'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ),
268
-							'name'          => __( 'Base State/Province', 'give' ),
269
-							'desc'          => __( 'The state/province your site operates from.', 'give' ),
267
+							'wrapper_class' => (array_key_exists($country, $no_states_country) ? 'give-hidden' : ''),
268
+							'name'          => __('Base State/Province', 'give'),
269
+							'desc'          => __('The state/province your site operates from.', 'give'),
270 270
 							'id'            => 'base_state',
271
-							'type'          => ( empty( $states ) ? 'text' : 'select' ),
271
+							'type'          => (empty($states) ? 'text' : 'select'),
272 272
 							'options'       => $states,
273 273
 						),
274 274
 						array(
275
-							'name'  => __( 'General Options Docs Link', 'give' ),
275
+							'name'  => __('General Options Docs Link', 'give'),
276 276
 							'id'    => 'general_options_docs_link',
277
-							'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
278
-							'title' => __( 'General Options', 'give' ),
277
+							'url'   => esc_url('http://docs.givewp.com/settings-general'),
278
+							'title' => __('General Options', 'give'),
279 279
 							'type'  => 'give_docs_link',
280 280
 						),
281 281
 						array(
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 * Filter the general settings.
291 291
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
292 292
 			 */
293
-			$settings = apply_filters( 'give_settings_general', $settings );
293
+			$settings = apply_filters('give_settings_general', $settings);
294 294
 
295 295
 			/**
296 296
 			 * Filter the settings.
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			 *
300 300
 			 * @param  array $settings
301 301
 			 */
302
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
302
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
303 303
 
304 304
 			// Output.
305 305
 			return $settings;
@@ -313,12 +313,12 @@  discard block
 block discarded – undo
313 313
 		 */
314 314
 		public function get_sections() {
315 315
 			$sections = array(
316
-				'general-settings'  => __( 'General', 'give' ),
317
-				'currency-settings' => __( 'Currency', 'give' ),
318
-				'access-control'    => __( 'Access Control', 'give' ),
316
+				'general-settings'  => __('General', 'give'),
317
+				'currency-settings' => __('Currency', 'give'),
318
+				'access-control'    => __('Access Control', 'give'),
319 319
 			);
320 320
 
321
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
321
+			return apply_filters('give_get_sections_'.$this->id, $sections);
322 322
 		}
323 323
 	}
324 324
 
Please login to merge, or discard this patch.
includes/class-give-db-meta.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@
 block discarded – undo
277 277
 	/**
278 278
 	 * Rename query clauses for new meta table
279 279
 	 *
280
-	 * @param $clause
280
+	 * @param string $clause
281 281
 	 * @param $filter
282 282
 	 *
283 283
 	 * @return mixed
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 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
 
@@ -75,40 +75,40 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	function __construct() {
77 77
 		// Bailout.
78
-		if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) {
78
+		if (empty($this->supports) || ! $this->is_custom_meta_table_active()) {
79 79
 			return;
80 80
 		}
81 81
 
82
-		if ( in_array( 'add_post_metadata', $this->supports ) ) {
83
-			add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 );
82
+		if (in_array('add_post_metadata', $this->supports)) {
83
+			add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5);
84 84
 		}
85 85
 
86
-		if ( in_array( 'get_post_metadata', $this->supports ) ) {
87
-			add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 0, 4 );
86
+		if (in_array('get_post_metadata', $this->supports)) {
87
+			add_filter('get_post_metadata', array($this, '__get_meta'), 0, 4);
88 88
 		}
89 89
 
90
-		if ( in_array( 'update_post_metadata', $this->supports ) ) {
91
-			add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 );
90
+		if (in_array('update_post_metadata', $this->supports)) {
91
+			add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5);
92 92
 		}
93 93
 
94
-		if ( in_array( 'delete_post_metadata', $this->supports ) ) {
95
-			add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 );
94
+		if (in_array('delete_post_metadata', $this->supports)) {
95
+			add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5);
96 96
 		}
97 97
 
98
-		if ( in_array( 'posts_where', $this->supports ) ) {
99
-			add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
98
+		if (in_array('posts_where', $this->supports)) {
99
+			add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
100 100
 		}
101 101
 
102
-		if ( in_array( 'posts_join', $this->supports ) ) {
103
-			add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
102
+		if (in_array('posts_join', $this->supports)) {
103
+			add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
104 104
 		}
105 105
 
106
-		if ( in_array( 'posts_groupby', $this->supports ) ) {
107
-			add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
106
+		if (in_array('posts_groupby', $this->supports)) {
107
+			add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
108 108
 		}
109 109
 
110
-		if ( in_array( 'posts_orderby', $this->supports ) ) {
111
-			add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 );
110
+		if (in_array('posts_orderby', $this->supports)) {
111
+			add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2);
112 112
 		}
113 113
 	}
114 114
 
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
 	 * @return  mixed                 Will be an array if $single is false. Will be value of meta data field if $single
127 127
 	 *                                is true.
128 128
 	 */
129
-	public function get_meta( $id = 0, $meta_key = '', $single = false ) {
130
-		$id = $this->sanitize_id( $id );
129
+	public function get_meta($id = 0, $meta_key = '', $single = false) {
130
+		$id = $this->sanitize_id($id);
131 131
 
132 132
 		// Bailout.
133
-		if ( ! $this->is_valid_post_type( $id ) ) {
133
+		if ( ! $this->is_valid_post_type($id)) {
134 134
 			return $this->check;
135 135
 		}
136 136
 
137
-		if ( $this->raw_result ) {
138
-			if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) {
137
+		if ($this->raw_result) {
138
+			if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) {
139 139
 				$value = '';
140 140
 			}
141 141
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 			$this->raw_result = false;
144 144
 
145 145
 		} else {
146
-			$value = get_metadata( $this->meta_type, $id, $meta_key, $single );
146
+			$value = get_metadata($this->meta_type, $id, $meta_key, $single);
147 147
 		}
148 148
 
149 149
 		return $value;
@@ -165,18 +165,18 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return  int|bool                  False for failure. True for success.
167 167
 	 */
168
-	public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) {
169
-		$id = $this->sanitize_id( $id );
168
+	public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) {
169
+		$id = $this->sanitize_id($id);
170 170
 
171 171
 		// Bailout.
172
-		if ( ! $this->is_valid_post_type( $id ) ) {
172
+		if ( ! $this->is_valid_post_type($id)) {
173 173
 			return $this->check;
174 174
 		}
175 175
 
176
-		$meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique );
176
+		$meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique);
177 177
 
178
-		if ( $meta_id ) {
179
-			$this->delete_cache( $id );
178
+		if ($meta_id) {
179
+			$this->delete_cache($id);
180 180
 		}
181 181
 
182 182
 		return $meta_id;
@@ -202,18 +202,18 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @return  int|bool                  False on failure, true if success.
204 204
 	 */
205
-	public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) {
206
-		$id = $this->sanitize_id( $id );
205
+	public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') {
206
+		$id = $this->sanitize_id($id);
207 207
 
208 208
 		// Bailout.
209
-		if ( ! $this->is_valid_post_type( $id ) ) {
209
+		if ( ! $this->is_valid_post_type($id)) {
210 210
 			return $this->check;
211 211
 		}
212 212
 
213
-		$meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value );
213
+		$meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value);
214 214
 
215
-		if ( $meta_id ) {
216
-			$this->delete_cache( $id );
215
+		if ($meta_id) {
216
+			$this->delete_cache($id);
217 217
 		}
218 218
 
219 219
 		return $meta_id;
@@ -236,18 +236,18 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return  bool                  False for failure. True for success.
238 238
 	 */
239
-	public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) {
240
-		$id = $this->sanitize_id( $id );
239
+	public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') {
240
+		$id = $this->sanitize_id($id);
241 241
 
242 242
 		// Bailout.
243
-		if ( ! $this->is_valid_post_type( $id ) ) {
243
+		if ( ! $this->is_valid_post_type($id)) {
244 244
 			return $this->check;
245 245
 		}
246 246
 
247
-		$is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all );
247
+		$is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all);
248 248
 
249
-		if ( $is_meta_deleted ) {
250
-			$this->delete_cache( $id );
249
+		if ($is_meta_deleted) {
250
+			$this->delete_cache($id);
251 251
 		}
252 252
 
253 253
 		return $is_meta_deleted;
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @return string
266 266
 	 */
267
-	public function __rename_meta_table_name_in_query( $clause, $wp_query ) {
267
+	public function __rename_meta_table_name_in_query($clause, $wp_query) {
268 268
 		// Add new table to sql query.
269
-		if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) {
270
-			$clause = $this->__rename_meta_table_name( $clause, current_filter() );
269
+		if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) {
270
+			$clause = $this->__rename_meta_table_name($clause, current_filter());
271 271
 		}
272 272
 
273 273
 		return $clause;
@@ -282,39 +282,39 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * @return mixed
284 284
 	 */
285
-	public function __rename_meta_table_name( $clause, $filter ){
285
+	public function __rename_meta_table_name($clause, $filter) {
286 286
 		global $wpdb;
287 287
 
288
-		$clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause );
289
-		$clause = str_replace( $wpdb->postmeta, $this->table_name, $clause );
288
+		$clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause);
289
+		$clause = str_replace($wpdb->postmeta, $this->table_name, $clause);
290 290
 
291
-		switch( $filter ) {
291
+		switch ($filter) {
292 292
 			case 'posts_join':
293
-				$joins = array( 'INNER JOIN', 'LEFT JOIN' );
293
+				$joins = array('INNER JOIN', 'LEFT JOIN');
294 294
 
295
-				foreach ( $joins as $join ) {
296
-					if( false !== strpos( $clause, $join ) ) {
297
-						$clause = explode( $join, $clause );
295
+				foreach ($joins as $join) {
296
+					if (false !== strpos($clause, $join)) {
297
+						$clause = explode($join, $clause);
298 298
 
299
-						foreach ( $clause as $key => $clause_part ) {
300
-							if( empty( $clause_part ) ) {
299
+						foreach ($clause as $key => $clause_part) {
300
+							if (empty($clause_part)) {
301 301
 								continue;
302 302
 							}
303 303
 
304
-							preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name );
304
+							preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name);
305 305
 
306
-							if( isset( $alias_table_name[1] ) ) {
307
-								$clause[$key] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part );
306
+							if (isset($alias_table_name[1])) {
307
+								$clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part);
308 308
 							}
309 309
 						}
310 310
 
311
-						$clause = implode( "{$join} ", $clause );
311
+						$clause = implode("{$join} ", $clause);
312 312
 					}
313 313
 				}
314 314
 				break;
315 315
 
316 316
 			case 'posts_where':
317
-				$clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array( "mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id" ), $clause );
317
+				$clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array("mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id"), $clause);
318 318
 				break;
319 319
 		}
320 320
 
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 	 *
333 333
 	 * @return bool
334 334
 	 */
335
-	protected function is_post_type_query( $wp_query ) {
335
+	protected function is_post_type_query($wp_query) {
336 336
 		$status = false;
337 337
 
338 338
 		// Check if it is payment query.
339
-		if ( ! empty( $wp_query->query['post_type'] ) ) {
339
+		if ( ! empty($wp_query->query['post_type'])) {
340 340
 			if (
341
-				is_string( $wp_query->query['post_type'] ) &&
341
+				is_string($wp_query->query['post_type']) &&
342 342
 				$this->post_type === $wp_query->query['post_type']
343 343
 			) {
344 344
 				$status = true;
345 345
 			} elseif (
346
-				is_array( $wp_query->query['post_type'] ) &&
347
-				in_array( $this->post_type, $wp_query->query['post_type'] )
346
+				is_array($wp_query->query['post_type']) &&
347
+				in_array($this->post_type, $wp_query->query['post_type'])
348 348
 			) {
349 349
 				$status = true;
350 350
 			}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @return bool
365 365
 	 */
366
-	protected function is_valid_post_type( $ID ) {
367
-		return $ID && ( $this->post_type === get_post_type( $ID ) );
366
+	protected function is_valid_post_type($ID) {
367
+		return $ID && ($this->post_type === get_post_type($ID));
368 368
 	}
369 369
 
370 370
 	/**
@@ -390,8 +390,8 @@  discard block
 block discarded – undo
390 390
 	 *
391 391
 	 * @return void
392 392
 	 */
393
-	private function delete_cache( $id, $meta_type = '' ) {
394
-		$meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type;
393
+	private function delete_cache($id, $meta_type = '') {
394
+		$meta_type = empty($meta_type) ? $this->meta_type : $meta_type;
395 395
 
396 396
 		$group = array(
397 397
 			// 'form'    => 'give-forms',
@@ -401,8 +401,8 @@  discard block
 block discarded – undo
401 401
 			// 'log'     => 'give-logs',
402 402
 		);
403 403
 
404
-		if ( array_key_exists( $meta_type, $group ) ) {
405
-			Give_Cache::delete_group( $id, $group[ $meta_type ] );
404
+		if (array_key_exists($meta_type, $group)) {
405
+			Give_Cache::delete_group($id, $group[$meta_type]);
406 406
 		}
407 407
 	}
408 408
 
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * @return mixed
419 419
 	 */
420
-	public function __call( $name, $arguments ) {
421
-		switch ( $name ) {
420
+	public function __call($name, $arguments) {
421
+		switch ($name) {
422 422
 			case '__add_meta':
423 423
 				$this->check = $arguments[0];
424 424
 				$id          = $arguments[1];
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				$unique      = $arguments[4];
428 428
 
429 429
 				// Bailout.
430
-				if ( ! $this->is_valid_post_type( $id ) ) {
430
+				if ( ! $this->is_valid_post_type($id)) {
431 431
 					return $this->check;
432 432
 				}
433 433
 
434
-				return $this->add_meta( $id, $meta_key, $meta_value, $unique );
434
+				return $this->add_meta($id, $meta_key, $meta_value, $unique);
435 435
 
436 436
 			case '__get_meta':
437 437
 				$this->check = $arguments[0];
@@ -440,13 +440,13 @@  discard block
 block discarded – undo
440 440
 				$single      = $arguments[3];
441 441
 
442 442
 				// Bailout.
443
-				if ( ! $this->is_valid_post_type( $id ) ) {
443
+				if ( ! $this->is_valid_post_type($id)) {
444 444
 					return $this->check;
445 445
 				}
446 446
 
447 447
 				$this->raw_result = true;
448 448
 
449
-				return $this->get_meta( $id, $meta_key, $single );
449
+				return $this->get_meta($id, $meta_key, $single);
450 450
 
451 451
 			case '__update_meta':
452 452
 				$this->check = $arguments[0];
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
 				$meta_value  = $arguments[3];
456 456
 
457 457
 				// Bailout.
458
-				if ( ! $this->is_valid_post_type( $id ) ) {
458
+				if ( ! $this->is_valid_post_type($id)) {
459 459
 					return $this->check;
460 460
 				}
461 461
 
462
-				return $this->update_meta( $id, $meta_key, $meta_value );
462
+				return $this->update_meta($id, $meta_key, $meta_value);
463 463
 
464 464
 			case '__delete_meta':
465 465
 				$this->check = $arguments[0];
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 				$delete_all  = $arguments[3];
470 470
 
471 471
 				// Bailout.
472
-				if ( ! $this->is_valid_post_type( $id ) ) {
472
+				if ( ! $this->is_valid_post_type($id)) {
473 473
 					return $this->check;
474 474
 				}
475 475
 
476
-				return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all );
476
+				return $this->delete_meta($id, $meta_key, $meta_value, $delete_all);
477 477
 		}
478 478
 	}
479 479
 
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 			KEY meta_key (meta_key({$this->min_index_length}))
499 499
 			) {$charset_collate};";
500 500
 
501
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
502
-		dbDelta( $sql );
501
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
502
+		dbDelta($sql);
503 503
 
504
-		update_option( $this->table_name . '_db_version', $this->version );
504
+		update_option($this->table_name.'_db_version', $this->version);
505 505
 	}
506 506
 }
507 507
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +121 added lines, -121 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
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 	 * @param  int|bool $_id   Post id. Default is false.
338 338
 	 * @param  array    $_args Arguments passed.
339 339
 	 */
340
-	public function __construct( $_id = false, $_args = array() ) {
340
+	public function __construct($_id = false, $_args = array()) {
341 341
 
342
-		$donation_form = WP_Post::get_instance( $_id );
342
+		$donation_form = WP_Post::get_instance($_id);
343 343
 
344
-		return $this->setup_donation_form( $donation_form );
344
+		return $this->setup_donation_form($donation_form);
345 345
 	}
346 346
 
347 347
 	/**
@@ -354,23 +354,23 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool                   If the setup was successful or not.
356 356
 	 */
357
-	private function setup_donation_form( $donation_form ) {
357
+	private function setup_donation_form($donation_form) {
358 358
 
359
-		if ( ! is_object( $donation_form ) ) {
359
+		if ( ! is_object($donation_form)) {
360 360
 			return false;
361 361
 		}
362 362
 
363
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
363
+		if ( ! is_a($donation_form, 'WP_Post')) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		if ( 'give_forms' !== $donation_form->post_type ) {
367
+		if ('give_forms' !== $donation_form->post_type) {
368 368
 			return false;
369 369
 		}
370 370
 
371
-		foreach ( $donation_form as $key => $value ) {
371
+		foreach ($donation_form as $key => $value) {
372 372
 
373
-			switch ( $key ) {
373
+			switch ($key) {
374 374
 
375 375
 				default:
376 376
 					$this->$key = $value;
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return mixed
396 396
 	 */
397
-	public function __get( $key ) {
397
+	public function __get($key) {
398 398
 
399
-		if ( method_exists( $this, 'get_' . $key ) ) {
399
+		if (method_exists($this, 'get_'.$key)) {
400 400
 
401
-			return call_user_func( array( $this, 'get_' . $key ) );
401
+			return call_user_func(array($this, 'get_'.$key));
402 402
 
403 403
 		} else {
404 404
 
405 405
 			/* translators: %s: property key */
406
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
406
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
407 407
 
408 408
 		}
409 409
 
@@ -419,30 +419,30 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
421 421
 	 */
422
-	public function create( $data = array() ) {
422
+	public function create($data = array()) {
423 423
 
424
-		if ( $this->id != 0 ) {
424
+		if ($this->id != 0) {
425 425
 			return false;
426 426
 		}
427 427
 
428 428
 		$defaults = array(
429 429
 			'post_type'   => 'give_forms',
430 430
 			'post_status' => 'draft',
431
-			'post_title'  => __( 'New Donation Form', 'give' ),
431
+			'post_title'  => __('New Donation Form', 'give'),
432 432
 		);
433 433
 
434
-		$args = wp_parse_args( $data, $defaults );
434
+		$args = wp_parse_args($data, $defaults);
435 435
 
436 436
 		/**
437 437
 		 * Fired before a donation form is created
438 438
 		 *
439 439
 		 * @param array $args The post object arguments used for creation.
440 440
 		 */
441
-		do_action( 'give_form_pre_create', $args );
441
+		do_action('give_form_pre_create', $args);
442 442
 
443
-		$id = wp_insert_post( $args, true );
443
+		$id = wp_insert_post($args, true);
444 444
 
445
-		$donation_form = WP_Post::get_instance( $id );
445
+		$donation_form = WP_Post::get_instance($id);
446 446
 
447 447
 		/**
448 448
 		 * Fired after a donation form is created
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 		 * @param int   $id   The post ID of the created item.
451 451
 		 * @param array $args The post object arguments used for creation.
452 452
 		 */
453
-		do_action( 'give_form_post_create', $id, $args );
453
+		do_action('give_form_post_create', $id, $args);
454 454
 
455
-		return $this->setup_donation_form( $donation_form );
455
+		return $this->setup_donation_form($donation_form);
456 456
 
457 457
 	}
458 458
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @return string Donation form name.
478 478
 	 */
479 479
 	public function get_name() {
480
-		return get_the_title( $this->ID );
480
+		return get_the_title($this->ID);
481 481
 	}
482 482
 
483 483
 	/**
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 */
491 491
 	public function get_price() {
492 492
 
493
-		if ( ! isset( $this->price ) ) {
493
+		if ( ! isset($this->price)) {
494 494
 
495 495
 			$this->price = give_maybe_sanitize_amount(
496 496
 				give_get_meta(
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 				)
501 501
 			);
502 502
 
503
-			if ( ! $this->price ) {
503
+			if ( ! $this->price) {
504 504
 				$this->price = 0;
505 505
 			}
506 506
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 		 * @param string     $price The donation form price.
515 515
 		 * @param string|int $id    The form ID.
516 516
 		 */
517
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
517
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
518 518
 	}
519 519
 
520 520
 	/**
@@ -527,17 +527,17 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public function get_minimum_price() {
529 529
 
530
-		if ( ! isset( $this->minimum_price ) ) {
530
+		if ( ! isset($this->minimum_price)) {
531 531
 
532
-			$this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true );
532
+			$this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true);
533 533
 
534
-			if ( ! $this->is_custom_price_mode() ) {
534
+			if ( ! $this->is_custom_price_mode()) {
535 535
 				$this->minimum_price = 0;
536 536
 			}
537 537
 
538 538
 		}
539 539
 
540
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
540
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
541 541
 	}
542 542
 
543 543
 	/**
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	public function get_prices() {
552 552
 
553
-		if ( ! isset( $this->prices ) ) {
553
+		if ( ! isset($this->prices)) {
554 554
 
555
-			$this->prices = give_get_meta( $this->ID, '_give_donation_levels', true );
555
+			$this->prices = give_get_meta($this->ID, '_give_donation_levels', true);
556 556
 
557 557
 		}
558 558
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		 * @param array      $prices The array of mulit-level prices.
565 565
 		 * @param int|string $ID     The ID of the form.
566 566
 		 */
567
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
567
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
568 568
 
569 569
 	}
570 570
 
@@ -578,21 +578,21 @@  discard block
 block discarded – undo
578 578
 	 */
579 579
 	public function get_goal() {
580 580
 
581
-		if ( ! isset( $this->goal ) ) {
581
+		if ( ! isset($this->goal)) {
582 582
 
583
-			if ( 'donation' === give_get_form_goal_format( $this->ID ) ) {
584
-				$this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true );
583
+			if ('donation' === give_get_form_goal_format($this->ID)) {
584
+				$this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true);
585 585
 			} else {
586
-				$this->goal = give_get_meta( $this->ID, '_give_set_goal', true );
586
+				$this->goal = give_get_meta($this->ID, '_give_set_goal', true);
587 587
 			}
588 588
 
589
-			if ( ! $this->goal ) {
589
+			if ( ! $this->goal) {
590 590
 				$this->goal = 0;
591 591
 			}
592 592
 
593 593
 		}
594 594
 
595
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
595
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
596 596
 
597 597
 	}
598 598
 
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public function is_single_price_mode() {
608 608
 
609
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
609
+		$option = give_get_meta($this->ID, '_give_price_option', true);
610 610
 		$ret    = 0;
611 611
 
612
-		if ( empty( $option ) || $option === 'set' ) {
612
+		if (empty($option) || $option === 'set') {
613 613
 			$ret = 1;
614 614
 		}
615 615
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		 * @param bool       $ret Is donation form in single price mode?
622 622
 		 * @param int|string $ID The ID of the donation form.
623 623
 		 */
624
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
624
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
625 625
 
626 626
 	}
627 627
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 */
636 636
 	public function is_custom_price_mode() {
637 637
 
638
-		$option = give_get_meta( $this->ID, '_give_custom_amount', true );
638
+		$option = give_get_meta($this->ID, '_give_custom_amount', true);
639 639
 		$ret    = 0;
640 640
 
641
-		if ( give_is_setting_enabled( $option ) ) {
641
+		if (give_is_setting_enabled($option)) {
642 642
 			$ret = 1;
643 643
 		}
644 644
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 		 * @param bool       $ret Is donation form in custom price mode?
651 651
 		 * @param int|string $ID  The ID of the donation form.
652 652
 		 */
653
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
653
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
654 654
 
655 655
 	}
656 656
 
@@ -664,20 +664,20 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @return bool
666 666
 	 */
667
-	public function is_custom_price( $amount ) {
667
+	public function is_custom_price($amount) {
668 668
 		$result = false;
669
-		$amount = give_maybe_sanitize_amount( $amount );
669
+		$amount = give_maybe_sanitize_amount($amount);
670 670
 
671
-		if ( $this->is_custom_price_mode() ) {
671
+		if ($this->is_custom_price_mode()) {
672 672
 
673
-			if ( 'set' === $this->get_type() ) {
674
-				if ( $amount !== $this->get_price() ) {
673
+			if ('set' === $this->get_type()) {
674
+				if ($amount !== $this->get_price()) {
675 675
 					$result = true;
676 676
 				}
677 677
 
678
-			} elseif ( 'multi' === $this->get_type() ) {
679
-				$level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) );
680
-				$result        = ! in_array( $amount, $level_amounts );
678
+			} elseif ('multi' === $this->get_type()) {
679
+				$level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount'));
680
+				$result        = ! in_array($amount, $level_amounts);
681 681
 			}
682 682
 		}
683 683
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 		 *
691 691
 		 * @since 1.8.18
692 692
 		 */
693
-		return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID );
693
+		return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID);
694 694
 	}
695 695
 
696 696
 	/**
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	public function has_variable_prices() {
707 707
 
708
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
708
+		$option = give_get_meta($this->ID, '_give_price_option', true);
709 709
 		$ret    = 0;
710 710
 
711
-		if ( $option === 'multi' ) {
711
+		if ($option === 'multi') {
712 712
 			$ret = 1;
713 713
 		}
714 714
 
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		 * @param bool       $ret Does donation form have variable prices?
719 719
 		 * @param int|string $ID  The ID of the donation form.
720 720
 		 */
721
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
721
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
722 722
 
723 723
 	}
724 724
 
@@ -732,17 +732,17 @@  discard block
 block discarded – undo
732 732
 	 */
733 733
 	public function get_type() {
734 734
 
735
-		if ( ! isset( $this->type ) ) {
735
+		if ( ! isset($this->type)) {
736 736
 
737
-			$this->type = give_get_meta( $this->ID, '_give_price_option', true );
737
+			$this->type = give_get_meta($this->ID, '_give_price_option', true);
738 738
 
739
-			if ( empty( $this->type ) ) {
739
+			if (empty($this->type)) {
740 740
 				$this->type = 'set';
741 741
 			}
742 742
 
743 743
 		}
744 744
 
745
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
745
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
746 746
 
747 747
 	}
748 748
 
@@ -758,23 +758,23 @@  discard block
 block discarded – undo
758 758
 	 *
759 759
 	 * @return string
760 760
 	 */
761
-	public function get_form_classes( $args ) {
761
+	public function get_form_classes($args) {
762 762
 
763
-		$float_labels_option = give_is_float_labels_enabled( $args )
763
+		$float_labels_option = give_is_float_labels_enabled($args)
764 764
 			? 'float-labels-enabled'
765 765
 			: '';
766 766
 
767
-		$form_classes_array = apply_filters( 'give_form_classes', array(
767
+		$form_classes_array = apply_filters('give_form_classes', array(
768 768
 			'give-form',
769
-			'give-form-' . $this->ID,
770
-			'give-form-type-' . $this->get_type(),
769
+			'give-form-'.$this->ID,
770
+			'give-form-type-'.$this->get_type(),
771 771
 			$float_labels_option,
772
-		), $this->ID, $args );
772
+		), $this->ID, $args);
773 773
 
774 774
 		// Remove empty class names.
775
-		$form_classes_array = array_filter( $form_classes_array );
775
+		$form_classes_array = array_filter($form_classes_array);
776 776
 
777
-		return implode( ' ', $form_classes_array );
777
+		return implode(' ', $form_classes_array);
778 778
 
779 779
 	}
780 780
 
@@ -789,22 +789,22 @@  discard block
 block discarded – undo
789 789
 	 *
790 790
 	 * @return string
791 791
 	 */
792
-	public function get_form_wrap_classes( $args ) {
792
+	public function get_form_wrap_classes($args) {
793 793
 		$custom_class = array(
794 794
 			'give-form-wrap',
795 795
 		);
796 796
 
797
-		if ( $this->is_close_donation_form() ) {
797
+		if ($this->is_close_donation_form()) {
798 798
 			$custom_class[] = 'give-form-closed';
799
-		} else{
800
-			$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
799
+		} else {
800
+			$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
801 801
 				? $args['display_style']
802
-				: give_get_meta( $this->ID, '_give_payment_display', true );
802
+				: give_get_meta($this->ID, '_give_payment_display', true);
803 803
 
804 804
 			$custom_class[] = "give-display-{$display_option}";
805 805
 
806 806
 			// If admin want to show only button for form then user inbuilt modal functionality.
807
-			if ( 'button' === $display_option ) {
807
+			if ('button' === $display_option) {
808 808
 				$custom_class[] = 'give-display-button-only';
809 809
 			}
810 810
 		}
@@ -815,10 +815,10 @@  discard block
 block discarded – undo
815 815
 		 *
816 816
 		 * @since 1.0
817 817
 		 */
818
-		$form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args );
818
+		$form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args);
819 819
 
820 820
 
821
-		return implode( ' ', $form_wrap_classes_array );
821
+		return implode(' ', $form_wrap_classes_array);
822 822
 
823 823
 	}
824 824
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	public function is_set_type_donation_form() {
834 834
 		$form_type = $this->get_type();
835 835
 
836
-		return ( 'set' === $form_type ? true : false );
836
+		return ('set' === $form_type ? true : false);
837 837
 	}
838 838
 
839 839
 	/**
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	public function is_multi_type_donation_form() {
848 848
 		$form_type = $this->get_type();
849 849
 
850
-		return ( 'multi' === $form_type ? true : false );
850
+		return ('multi' === $form_type ? true : false);
851 851
 
852 852
 	}
853 853
 
@@ -861,15 +861,15 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	public function get_sales() {
863 863
 
864
-		if ( ! isset( $this->sales ) ) {
864
+		if ( ! isset($this->sales)) {
865 865
 
866
-			if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) {
867
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
866
+			if ('' == give_get_meta($this->ID, '_give_form_sales', true)) {
867
+				add_post_meta($this->ID, '_give_form_sales', 0);
868 868
 			} // End if
869 869
 
870
-			$this->sales = give_get_meta( $this->ID, '_give_form_sales', true );
870
+			$this->sales = give_get_meta($this->ID, '_give_form_sales', true);
871 871
 
872
-			if ( $this->sales < 0 ) {
872
+			if ($this->sales < 0) {
873 873
 				// Never let sales be less than zero.
874 874
 				$this->sales = 0;
875 875
 			}
@@ -890,13 +890,13 @@  discard block
 block discarded – undo
890 890
 	 *
891 891
 	 * @return int|false     New number of total sales.
892 892
 	 */
893
-	public function increase_sales( $quantity = 1 ) {
893
+	public function increase_sales($quantity = 1) {
894 894
 
895
-		$sales       = give_get_form_sales_stats( $this->ID );
896
-		$quantity    = absint( $quantity );
895
+		$sales       = give_get_form_sales_stats($this->ID);
896
+		$quantity    = absint($quantity);
897 897
 		$total_sales = $sales + $quantity;
898 898
 
899
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
899
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
900 900
 
901 901
 			$this->sales = $total_sales;
902 902
 
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 	 *
918 918
 	 * @return int|false     New number of total sales.
919 919
 	 */
920
-	public function decrease_sales( $quantity = 1 ) {
920
+	public function decrease_sales($quantity = 1) {
921 921
 
922
-		$sales = give_get_form_sales_stats( $this->ID );
922
+		$sales = give_get_form_sales_stats($this->ID);
923 923
 
924 924
 		// Only decrease if not already zero
925
-		if ( $sales > 0 ) {
925
+		if ($sales > 0) {
926 926
 
927
-			$quantity    = absint( $quantity );
927
+			$quantity    = absint($quantity);
928 928
 			$total_sales = $sales - $quantity;
929 929
 
930
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
930
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
931 931
 
932 932
 				$this->sales = $sales;
933 933
 
@@ -951,15 +951,15 @@  discard block
 block discarded – undo
951 951
 	 */
952 952
 	public function get_earnings() {
953 953
 
954
-		if ( ! isset( $this->earnings ) ) {
954
+		if ( ! isset($this->earnings)) {
955 955
 
956
-			if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) {
957
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
956
+			if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) {
957
+				add_post_meta($this->ID, '_give_form_earnings', 0);
958 958
 			}
959 959
 
960
-			$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true );
960
+			$this->earnings = give_get_meta($this->ID, '_give_form_earnings', true);
961 961
 
962
-			if ( $this->earnings < 0 ) {
962
+			if ($this->earnings < 0) {
963 963
 				// Never let earnings be less than zero
964 964
 				$this->earnings = 0;
965 965
 			}
@@ -980,12 +980,12 @@  discard block
 block discarded – undo
980 980
 	 *
981 981
 	 * @return float|false
982 982
 	 */
983
-	public function increase_earnings( $amount = 0 ) {
983
+	public function increase_earnings($amount = 0) {
984 984
 
985
-		$earnings   = give_get_form_earnings_stats( $this->ID );
985
+		$earnings   = give_get_form_earnings_stats($this->ID);
986 986
 		$new_amount = $earnings + (float) $amount;
987 987
 
988
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
988
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
989 989
 
990 990
 			$this->earnings = $new_amount;
991 991
 
@@ -1007,16 +1007,16 @@  discard block
 block discarded – undo
1007 1007
 	 *
1008 1008
 	 * @return float|false
1009 1009
 	 */
1010
-	public function decrease_earnings( $amount ) {
1010
+	public function decrease_earnings($amount) {
1011 1011
 
1012
-		$earnings = give_get_form_earnings_stats( $this->ID );
1012
+		$earnings = give_get_form_earnings_stats($this->ID);
1013 1013
 
1014
-		if ( $earnings > 0 ) {
1014
+		if ($earnings > 0) {
1015 1015
 			// Only decrease if greater than zero
1016 1016
 			$new_amount = $earnings - (float) $amount;
1017 1017
 
1018 1018
 
1019
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1019
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
1020 1020
 
1021 1021
 				$this->earnings = $new_amount;
1022 1022
 
@@ -1040,22 +1040,22 @@  discard block
 block discarded – undo
1040 1040
 	 *
1041 1041
 	 * @return bool
1042 1042
 	 */
1043
-	public function is_free( $price_id = false ) {
1043
+	public function is_free($price_id = false) {
1044 1044
 
1045 1045
 		$is_free          = false;
1046
-		$variable_pricing = give_has_variable_prices( $this->ID );
1046
+		$variable_pricing = give_has_variable_prices($this->ID);
1047 1047
 
1048
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
1049
-			$price = give_get_price_option_amount( $this->ID, $price_id );
1050
-		} elseif ( ! $variable_pricing ) {
1051
-			$price = give_get_meta( $this->ID, '_give_set_price', true );
1048
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
1049
+			$price = give_get_price_option_amount($this->ID, $price_id);
1050
+		} elseif ( ! $variable_pricing) {
1051
+			$price = give_get_meta($this->ID, '_give_set_price', true);
1052 1052
 		}
1053 1053
 
1054
-		if ( isset( $price ) && (float) $price == 0 ) {
1054
+		if (isset($price) && (float) $price == 0) {
1055 1055
 			$is_free = true;
1056 1056
 		}
1057 1057
 
1058
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
1058
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
1059 1059
 
1060 1060
 	}
1061 1061
 
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	 */
1075 1075
 	public function is_close_donation_form() {
1076 1076
 
1077
-		$goal_format = give_get_form_goal_format( $this->ID );
1077
+		$goal_format = give_get_form_goal_format($this->ID);
1078 1078
 
1079 1079
 		/**
1080 1080
 		 * Filter the close form result.
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
 		$is_close_form = apply_filters(
1085 1085
 			'give_is_close_donation_form',
1086 1086
 			(
1087
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) &&
1088
-				give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) &&
1089
-				( 'donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings() )
1087
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) &&
1088
+				give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) &&
1089
+				('donation' === $goal_format ? $this->get_goal() <= $this->get_sales() : $this->get_goal() <= $this->get_earnings())
1090 1090
 			),
1091 1091
 			$this->ID
1092 1092
 		);
@@ -1105,17 +1105,17 @@  discard block
 block discarded – undo
1105 1105
 	 *
1106 1106
 	 * @return bool                            The result of the update query.
1107 1107
 	 */
1108
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1108
+	private function update_meta($meta_key = '', $meta_value = '') {
1109 1109
 
1110 1110
 		/* @var WPDB $wpdb */
1111 1111
 		global $wpdb;
1112 1112
 
1113 1113
 		// Bailout.
1114
-		if ( empty( $meta_key ) ) {
1114
+		if (empty($meta_key)) {
1115 1115
 			return false;
1116 1116
 		}
1117 1117
 
1118
-		if ( give_update_meta( $this->ID, $meta_key, $meta_value  ) ) {
1118
+		if (give_update_meta($this->ID, $meta_key, $meta_value)) {
1119 1119
 			return true;
1120 1120
 		}
1121 1121
 
Please login to merge, or discard this patch.
includes/payments/functions.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.0
567 567
  *
568
- * @return int $earnings Earnings
568
+ * @return double $earnings Earnings
569 569
  */
570 570
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @since 1.0
866 866
  *
867
- * @return array $user_info User Info Meta Values.
867
+ * @return string $user_info User Info Meta Values.
868 868
  */
869 869
 function give_get_payment_meta_user_info( $payment_id ) {
870 870
 	$payment = new Give_Payment( $payment_id );
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @since 1.0
883 883
  *
884
- * @return int $form_id Form ID.
884
+ * @return string $form_id Form ID.
885 885
  */
886 886
 function give_get_payment_form_id( $payment_id ) {
887 887
 	$payment = new Give_Payment( $payment_id );
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
  *
1730 1730
  * Retrieves the form title and appends the level name if present.
1731 1731
  *
1732
- * @param int|Give_Payment $donation Donation Data Object.
1732
+ * @param Give_Payment $donation Donation Data Object.
1733 1733
  * @param array            $args     a. only_level = If set to true will only return the level name if multi-level enabled.
1734 1734
  *                                   b. separator  = The separator between the Form Title and the Donation Level.
1735 1735
  *
Please login to merge, or discard this patch.
Spacing   +380 added lines, -382 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,48 +67,48 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
86 86
 			break;
87 87
 
88 88
 		case 'key':
89
-			$payment = give_get_payments( array(
89
+			$payment = give_get_payments(array(
90 90
 				'meta_key'       => '_give_payment_purchase_key',
91 91
 				'meta_value'     => $value,
92 92
 				'posts_per_page' => 1,
93 93
 				'fields'         => 'ids',
94
-			) );
94
+			));
95 95
 
96
-			if ( $payment ) {
97
-				$payment = new Give_Payment( $payment[0] );
96
+			if ($payment) {
97
+				$payment = new Give_Payment($payment[0]);
98 98
 			}
99 99
 
100 100
 			break;
101 101
 
102 102
 		case 'payment_number':
103
-			$payment = give_get_payments( array(
103
+			$payment = give_get_payments(array(
104 104
 				'meta_key'       => '_give_payment_number',
105 105
 				'meta_value'     => $value,
106 106
 				'posts_per_page' => 1,
107 107
 				'fields'         => 'ids',
108
-			) );
108
+			));
109 109
 
110
-			if ( $payment ) {
111
-				$payment = new Give_Payment( $payment[0] );
110
+			if ($payment) {
111
+				$payment = new Give_Payment($payment[0]);
112 112
 			}
113 113
 
114 114
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			return false;
118 118
 	}// End switch().
119 119
 
120
-	if ( $payment ) {
120
+	if ($payment) {
121 121
 		return $payment;
122 122
 	}
123 123
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return int|bool Payment ID if payment is inserted, false otherwise.
135 135
  */
136
-function give_insert_payment( $payment_data = array() ) {
136
+function give_insert_payment($payment_data = array()) {
137 137
 
138
-	if ( empty( $payment_data ) ) {
138
+	if (empty($payment_data)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $payment_data Arguments passed.
148 148
 	 */
149
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
149
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
150 150
 
151 151
 	$payment    = new Give_Payment();
152
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
153
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
154
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
155
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
156
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
152
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
153
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
154
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
155
+	$price_id   = give_get_payment_meta_price_id($payment_data);
156
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
157 157
 
158 158
 	// Set properties.
159 159
 	$payment->total          = $payment_data['price'];
160
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
161
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
160
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
161
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
162 162
 	$payment->user_info      = $payment_data['user_info'];
163 163
 	$payment->gateway        = $gateway;
164 164
 	$payment->form_title     = $form_title;
165 165
 	$payment->form_id        = $form_id;
166 166
 	$payment->price_id       = $price_id;
167
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
167
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
168 168
 	$payment->user_id        = $payment_data['user_info']['id'];
169 169
 	$payment->email          = $payment_data['user_email'];
170 170
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	$payment->email          = $payment_data['user_info']['email'];
173 173
 	$payment->ip             = give_get_ip();
174 174
 	$payment->key            = $payment_data['purchase_key'];
175
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
176
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
175
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
176
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
177 177
 
178 178
 	// Add the donation.
179 179
 	$args = array(
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 		'price_id' => $payment->price_id,
182 182
 	);
183 183
 
184
-	$payment->add_donation( $payment->form_id, $args );
184
+	$payment->add_donation($payment->form_id, $args);
185 185
 
186 186
 
187 187
 	// Set date if present.
188
-	if ( isset( $payment_data['post_date'] ) ) {
188
+	if (isset($payment_data['post_date'])) {
189 189
 		$payment->date = $payment_data['post_date'];
190 190
 	}
191 191
 
192 192
 	// Handle sequential payments.
193
-	if ( give_get_option( 'enable_sequential' ) ) {
193
+	if (give_get_option('enable_sequential')) {
194 194
 		$number          = give_get_next_payment_number();
195
-		$payment->number = give_format_payment_number( $number );
196
-		update_option( 'give_last_payment_number', $number );
195
+		$payment->number = give_format_payment_number($number);
196
+		update_option('give_last_payment_number', $number);
197 197
 	}
198 198
 
199 199
 	// Save payment.
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount   = give_donation_amount( $payment_id );
306
+	$amount   = give_donation_amount($payment_id);
307 307
 	$status   = $payment->post_status;
308
-	$donor_id = give_get_payment_donor_id( $payment_id );
309
-	$donor    = new Give_Donor( $donor_id );
308
+	$donor_id = give_get_payment_donor_id($payment_id);
309
+	$donor    = new Give_Donor($donor_id);
310 310
 
311 311
 	// Only undo donations that aren't these statuses.
312
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
312
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
313 313
 		'pending',
314 314
 		'cancelled',
315
-	) );
315
+	));
316 316
 
317
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
318
-		give_undo_donation( $payment_id );
317
+	if ( ! in_array($status, $dont_undo_statuses)) {
318
+		give_undo_donation($payment_id);
319 319
 	}
320 320
 
321 321
 	// Only undo donations that aren't these statuses.
322
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
322
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
323 323
 
324
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
324
+	if (in_array($status, $status_to_decrease_stats)) {
325 325
 
326 326
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
327
-		give_decrease_total_earnings( $amount );
327
+		give_decrease_total_earnings($amount);
328 328
 
329 329
 		// @todo: Refresh only range related stat cache
330 330
 		give_delete_donation_stats();
331 331
 
332
-		if ( $donor->id && $update_donor ) {
332
+		if ($donor->id && $update_donor) {
333 333
 
334 334
 			// Decrement the stats for the donor.
335 335
 			$donor->decrease_donation_count();
336
-			$donor->decrease_value( $amount );
336
+			$donor->decrease_value($amount);
337 337
 
338 338
 		}
339 339
 	}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @since 1.0
347 347
 	 */
348
-	do_action( 'give_payment_delete', $payment_id );
348
+	do_action('give_payment_delete', $payment_id);
349 349
 
350
-	if ( $donor->id && $update_donor ) {
350
+	if ($donor->id && $update_donor) {
351 351
 		// Remove the payment ID from the donor.
352
-		$donor->remove_payment( $payment_id );
352
+		$donor->remove_payment($payment_id);
353 353
 	}
354 354
 
355 355
 	// Remove the payment.
356
-	wp_delete_post( $payment_id, true );
356
+	wp_delete_post($payment_id, true);
357 357
 
358 358
 	// Remove related sale log entries.
359
-	Give()->logs->delete_logs( $payment_id );
359
+	Give()->logs->delete_logs($payment_id);
360 360
 
361 361
 	/**
362 362
 	 * Fires after payment deleted.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @since 1.0
367 367
 	 */
368
-	do_action( 'give_payment_deleted', $payment_id );
368
+	do_action('give_payment_deleted', $payment_id);
369 369
 }
370 370
 
371 371
 /**
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return void
382 382
  */
383
-function give_undo_donation( $payment_id ) {
383
+function give_undo_donation($payment_id) {
384 384
 
385
-	$payment = new Give_Payment( $payment_id );
385
+	$payment = new Give_Payment($payment_id);
386 386
 
387
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
388
-	if ( true === $maybe_decrease_earnings ) {
387
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
388
+	if (true === $maybe_decrease_earnings) {
389 389
 		// Decrease earnings.
390
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
390
+		give_decrease_form_earnings($payment->form_id, $payment->total);
391 391
 	}
392 392
 
393
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
394
-	if ( true === $maybe_decrease_donations ) {
393
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
394
+	if (true === $maybe_decrease_donations) {
395 395
 		// Decrease donation count.
396
-		give_decrease_donation_count( $payment->form_id );
396
+		give_decrease_donation_count($payment->form_id);
397 397
 	}
398 398
 
399 399
 }
@@ -410,21 +410,21 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return object $stats Contains the number of payments per payment status.
412 412
  */
413
-function give_count_payments( $args = array() ) {
413
+function give_count_payments($args = array()) {
414 414
 	// Backward compatibility.
415
-	if ( ! empty( $args['start-date'] ) ) {
415
+	if ( ! empty($args['start-date'])) {
416 416
 		$args['start_date'] = $args['start-date'];
417
-		unset( $args['start-date'] );
417
+		unset($args['start-date']);
418 418
 	}
419 419
 
420
-	if ( ! empty( $args['end-date'] ) ) {
420
+	if ( ! empty($args['end-date'])) {
421 421
 		$args['end_date'] = $args['end-date'];
422
-		unset( $args['end-date'] );
422
+		unset($args['end-date']);
423 423
 	}
424 424
 
425
-	if ( ! empty( $args['form_id'] ) ) {
425
+	if ( ! empty($args['form_id'])) {
426 426
 		$args['give_forms'] = $args['form_id'];
427
-		unset( $args['form_id'] );
427
+		unset($args['form_id']);
428 428
 	}
429 429
 
430 430
 	// Extract all donations
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$args['group_by']    = 'post_status';
433 433
 	$args['count']       = 'true';
434 434
 
435
-	$donations_obj   = new Give_Payments_Query( $args );
435
+	$donations_obj   = new Give_Payments_Query($args);
436 436
 	$donations_count = $donations_obj->get_payment_by_group();
437 437
 
438 438
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @since 1.0
442 442
 	 */
443
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
443
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
444 444
 }
445 445
 
446 446
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool $exists True if payment exists, false otherwise.
455 455
  */
456
-function give_check_for_existing_payment( $payment_id ) {
456
+function give_check_for_existing_payment($payment_id) {
457 457
 	$exists  = false;
458
-	$payment = new Give_Payment( $payment_id );
458
+	$payment = new Give_Payment($payment_id);
459 459
 
460
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
460
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
461 461
 		$exists = true;
462 462
 	}
463 463
 
@@ -475,41 +475,41 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return bool|mixed True if payment status exists, false otherwise.
477 477
  */
478
-function give_get_payment_status( $payment, $return_label = false ) {
478
+function give_get_payment_status($payment, $return_label = false) {
479 479
 
480
-	if ( is_numeric( $payment ) ) {
480
+	if (is_numeric($payment)) {
481 481
 
482
-		$payment = new Give_Payment( $payment );
482
+		$payment = new Give_Payment($payment);
483 483
 
484
-		if ( ! $payment->ID > 0 ) {
484
+		if ( ! $payment->ID > 0) {
485 485
 			return false;
486 486
 		}
487 487
 
488 488
 	}
489 489
 
490
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
490
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
491 491
 		return false;
492 492
 	}
493 493
 
494 494
 	$statuses = give_get_payment_statuses();
495 495
 
496
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
496
+	if ( ! is_array($statuses) || empty($statuses)) {
497 497
 		return false;
498 498
 	}
499 499
 
500 500
 	// Get payment object if not already given.
501
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
501
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
502 502
 
503
-	if ( array_key_exists( $payment->status, $statuses ) ) {
504
-		if ( true === $return_label ) {
503
+	if (array_key_exists($payment->status, $statuses)) {
504
+		if (true === $return_label) {
505 505
 			// Return translated status label.
506
-			return $statuses[ $payment->status ];
506
+			return $statuses[$payment->status];
507 507
 		} else {
508 508
 			// Account that our 'publish' status is labeled 'Complete'
509 509
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
510 510
 
511 511
 			// Make sure we're matching cases, since they matter
512
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
512
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
513 513
 		}
514 514
 	}
515 515
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function give_get_payment_statuses() {
527 527
 	$payment_statuses = array(
528
-		'pending'     => __( 'Pending', 'give' ),
529
-		'publish'     => __( 'Complete', 'give' ),
530
-		'refunded'    => __( 'Refunded', 'give' ),
531
-		'failed'      => __( 'Failed', 'give' ),
532
-		'cancelled'   => __( 'Cancelled', 'give' ),
533
-		'abandoned'   => __( 'Abandoned', 'give' ),
534
-		'preapproval' => __( 'Pre-Approved', 'give' ),
535
-		'processing'  => __( 'Processing', 'give' ),
536
-		'revoked'     => __( 'Revoked', 'give' ),
528
+		'pending'     => __('Pending', 'give'),
529
+		'publish'     => __('Complete', 'give'),
530
+		'refunded'    => __('Refunded', 'give'),
531
+		'failed'      => __('Failed', 'give'),
532
+		'cancelled'   => __('Cancelled', 'give'),
533
+		'abandoned'   => __('Abandoned', 'give'),
534
+		'preapproval' => __('Pre-Approved', 'give'),
535
+		'processing'  => __('Processing', 'give'),
536
+		'revoked'     => __('Revoked', 'give'),
537 537
 	);
538 538
 
539
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
539
+	return apply_filters('give_payment_statuses', $payment_statuses);
540 540
 }
541 541
 
542 542
 /**
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
  * @return array $payment_status All the available payment statuses.
550 550
  */
551 551
 function give_get_payment_status_keys() {
552
-	$statuses = array_keys( give_get_payment_statuses() );
553
-	asort( $statuses );
552
+	$statuses = array_keys(give_get_payment_statuses());
553
+	asort($statuses);
554 554
 
555
-	return array_values( $statuses );
555
+	return array_values($statuses);
556 556
 }
557 557
 
558 558
 /**
@@ -567,44 +567,44 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return int $earnings Earnings
569 569
  */
570
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
570
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
572 572
 
573 573
 	global $wpdb;
574
-	$meta_table = __give_v20_bc_table_details( 'payment' );
574
+	$meta_table = __give_v20_bc_table_details('payment');
575 575
 
576 576
 	$args = array(
577 577
 		'post_type'              => 'give_payment',
578 578
 		'nopaging'               => true,
579 579
 		'year'                   => $year,
580 580
 		'monthnum'               => $month_num,
581
-		'post_status'            => array( 'publish' ),
581
+		'post_status'            => array('publish'),
582 582
 		'fields'                 => 'ids',
583 583
 		'update_post_term_cache' => false,
584 584
 	);
585
-	if ( ! empty( $day ) ) {
585
+	if ( ! empty($day)) {
586 586
 		$args['day'] = $day;
587 587
 	}
588 588
 
589
-	if ( isset( $hour ) ) {
589
+	if (isset($hour)) {
590 590
 		$args['hour'] = $hour;
591 591
 	}
592 592
 
593
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
594
-	$key  = Give_Cache::get_key( 'give_stats', $args );
593
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
594
+	$key  = Give_Cache::get_key('give_stats', $args);
595 595
 
596
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
596
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
597 597
 		$earnings = false;
598 598
 	} else {
599
-		$earnings = Give_Cache::get( $key );
599
+		$earnings = Give_Cache::get($key);
600 600
 	}
601 601
 
602
-	if ( false === $earnings ) {
603
-		$donations = get_posts( $args );
602
+	if (false === $earnings) {
603
+		$donations = get_posts($args);
604 604
 		$earnings  = 0;
605
-		if ( $donations ) {
606
-			$donations      = implode( ',', $donations );
607
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
605
+		if ($donations) {
606
+			$donations      = implode(',', $donations);
607
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
608 608
 
609 609
 			/**
610 610
 			 * Filter The earnings by dates.
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 			 * @param array $donations      Donations lists.
616 616
 			 * @param array $args           Donation query args.
617 617
 			 */
618
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
618
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
619 619
 		}
620 620
 		// Cache the results for one hour.
621
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
621
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
622 622
 	}
623 623
 
624
-	return round( $earnings, 2 );
624
+	return round($earnings, 2);
625 625
 }
626 626
 
627 627
 /**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return int $count Sales
638 638
  */
639
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
639
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
640 640
 
641 641
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
642 642
 	$args = array(
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		'nopaging'               => true,
645 645
 		'year'                   => $year,
646 646
 		'fields'                 => 'ids',
647
-		'post_status'            => array( 'publish' ),
647
+		'post_status'            => array('publish'),
648 648
 		'update_post_meta_cache' => false,
649 649
 		'update_post_term_cache' => false,
650 650
 	);
651 651
 
652
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
652
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
653 653
 
654
-	if ( false === $show_free ) {
654
+	if (false === $show_free) {
655 655
 		$args['meta_query'] = array(
656 656
 			array(
657 657
 				'key'     => '_give_payment_total',
@@ -662,33 +662,33 @@  discard block
 block discarded – undo
662 662
 		);
663 663
 	}
664 664
 
665
-	if ( ! empty( $month_num ) ) {
665
+	if ( ! empty($month_num)) {
666 666
 		$args['monthnum'] = $month_num;
667 667
 	}
668 668
 
669
-	if ( ! empty( $day ) ) {
669
+	if ( ! empty($day)) {
670 670
 		$args['day'] = $day;
671 671
 	}
672 672
 
673
-	if ( isset( $hour ) ) {
673
+	if (isset($hour)) {
674 674
 		$args['hour'] = $hour;
675 675
 	}
676 676
 
677
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
677
+	$args = apply_filters('give_get_sales_by_date_args', $args);
678 678
 
679
-	$key = Give_Cache::get_key( 'give_stats', $args );
679
+	$key = Give_Cache::get_key('give_stats', $args);
680 680
 
681
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
681
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
682 682
 		$count = false;
683 683
 	} else {
684
-		$count = Give_Cache::get( $key );
684
+		$count = Give_Cache::get($key);
685 685
 	}
686 686
 
687
-	if ( false === $count ) {
688
-		$donations = new WP_Query( $args );
687
+	if (false === $count) {
688
+		$donations = new WP_Query($args);
689 689
 		$count     = (int) $donations->post_count;
690 690
 		// Cache the results for one hour.
691
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
691
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
692 692
 	}
693 693
 
694 694
 	return $count;
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return bool $ret True if complete, false otherwise.
705 705
  */
706
-function give_is_payment_complete( $payment_id ) {
707
-	$payment = new Give_Payment( $payment_id );
706
+function give_is_payment_complete($payment_id) {
707
+	$payment = new Give_Payment($payment_id);
708 708
 
709 709
 	$ret = false;
710 710
 
711
-	if ( $payment->ID > 0 ) {
711
+	if ($payment->ID > 0) {
712 712
 
713
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
713
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
714 714
 			$ret = true;
715 715
 		}
716 716
 	}
717 717
 
718
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
718
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
719 719
 }
720 720
 
721 721
 /**
@@ -741,50 +741,50 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @return float $total Total earnings.
743 743
  */
744
-function give_get_total_earnings( $recalculate = false ) {
744
+function give_get_total_earnings($recalculate = false) {
745 745
 
746
-	$total      = get_option( 'give_earnings_total', 0 );
747
-	$meta_table = __give_v20_bc_table_details( 'payment' );
746
+	$total      = get_option('give_earnings_total', 0);
747
+	$meta_table = __give_v20_bc_table_details('payment');
748 748
 
749 749
 	// Calculate total earnings.
750
-	if ( ! $total || $recalculate ) {
750
+	if ( ! $total || $recalculate) {
751 751
 		global $wpdb;
752 752
 
753 753
 		$total = (float) 0;
754 754
 
755
-		$args = apply_filters( 'give_get_total_earnings_args', array(
755
+		$args = apply_filters('give_get_total_earnings_args', array(
756 756
 			'offset' => 0,
757
-			'number' => - 1,
758
-			'status' => array( 'publish' ),
757
+			'number' => -1,
758
+			'status' => array('publish'),
759 759
 			'fields' => 'ids',
760
-		) );
760
+		));
761 761
 
762
-		$payments = give_get_payments( $args );
763
-		if ( $payments ) {
762
+		$payments = give_get_payments($args);
763
+		if ($payments) {
764 764
 
765 765
 			/**
766 766
 			 * If performing a donation, we need to skip the very last payment in the database,
767 767
 			 * since it calls give_increase_total_earnings() on completion,
768 768
 			 * which results in duplicated earnings for the very first donation.
769 769
 			 */
770
-			if ( did_action( 'give_update_payment_status' ) ) {
771
-				array_pop( $payments );
770
+			if (did_action('give_update_payment_status')) {
771
+				array_pop($payments);
772 772
 			}
773 773
 
774
-			if ( ! empty( $payments ) ) {
775
-				$payments = implode( ',', $payments );
776
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
774
+			if ( ! empty($payments)) {
775
+				$payments = implode(',', $payments);
776
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
777 777
 			}
778 778
 		}
779 779
 
780
-		update_option( 'give_earnings_total', $total, 'no' );
780
+		update_option('give_earnings_total', $total, 'no');
781 781
 	}
782 782
 
783
-	if ( $total < 0 ) {
783
+	if ($total < 0) {
784 784
 		$total = 0; // Don't ever show negative earnings.
785 785
 	}
786 786
 
787
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
787
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
788 788
 }
789 789
 
790 790
 /**
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
  *
797 797
  * @return float $total Total earnings.
798 798
  */
799
-function give_increase_total_earnings( $amount = 0 ) {
799
+function give_increase_total_earnings($amount = 0) {
800 800
 	$total = give_get_total_earnings();
801 801
 	$total += $amount;
802
-	update_option( 'give_earnings_total', $total );
802
+	update_option('give_earnings_total', $total);
803 803
 
804 804
 	return $total;
805 805
 }
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
  *
814 814
  * @return float $total Total earnings.
815 815
  */
816
-function give_decrease_total_earnings( $amount = 0 ) {
816
+function give_decrease_total_earnings($amount = 0) {
817 817
 	$total = give_get_total_earnings();
818 818
 	$total -= $amount;
819
-	if ( $total < 0 ) {
819
+	if ($total < 0) {
820 820
 		$total = 0;
821 821
 	}
822
-	update_option( 'give_earnings_total', $total );
822
+	update_option('give_earnings_total', $total);
823 823
 
824 824
 	return $total;
825 825
 }
@@ -835,10 +835,10 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return mixed $meta Payment Meta.
837 837
  */
838
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
839
-	$payment = new Give_Payment( $payment_id );
838
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
839
+	$payment = new Give_Payment($payment_id);
840 840
 
841
-	return $payment->get_meta( $meta_key, $single );
841
+	return $payment->get_meta($meta_key, $single);
842 842
 }
843 843
 
844 844
 /**
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed Meta ID if successful, false if unsuccessful.
853 853
  */
854
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
855
-	$payment = new Give_Payment( $payment_id );
854
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
855
+	$payment = new Give_Payment($payment_id);
856 856
 
857
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
857
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
858 858
 }
859 859
 
860 860
 /**
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array $user_info User Info Meta Values.
868 868
  */
869
-function give_get_payment_meta_user_info( $payment_id ) {
870
-	$payment = new Give_Payment( $payment_id );
869
+function give_get_payment_meta_user_info($payment_id) {
870
+	$payment = new Give_Payment($payment_id);
871 871
 
872 872
 	return $payment->user_info;
873 873
 }
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return int $form_id Form ID.
885 885
  */
886
-function give_get_payment_form_id( $payment_id ) {
887
-	$payment = new Give_Payment( $payment_id );
886
+function give_get_payment_form_id($payment_id) {
887
+	$payment = new Give_Payment($payment_id);
888 888
 
889 889
 	return $payment->form_id;
890 890
 }
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return string $email User email.
900 900
  */
901
-function give_get_payment_user_email( $payment_id ) {
902
-	$payment = new Give_Payment( $payment_id );
901
+function give_get_payment_user_email($payment_id) {
902
+	$payment = new Give_Payment($payment_id);
903 903
 
904 904
 	return $payment->email;
905 905
 }
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
915 915
  */
916
-function give_is_guest_payment( $payment_id ) {
917
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
918
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
916
+function give_is_guest_payment($payment_id) {
917
+	$payment_user_id  = give_get_payment_user_id($payment_id);
918
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
919 919
 
920
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
920
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
921 921
 }
922 922
 
923 923
 /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return int $user_id User ID.
931 931
  */
932
-function give_get_payment_user_id( $payment_id ) {
933
-	$payment = new Give_Payment( $payment_id );
932
+function give_get_payment_user_id($payment_id) {
933
+	$payment = new Give_Payment($payment_id);
934 934
 
935 935
 	return $payment->user_id;
936 936
 }
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return int $payment->customer_id Donor ID.
946 946
  */
947
-function give_get_payment_donor_id( $payment_id ) {
948
-	$payment = new Give_Payment( $payment_id );
947
+function give_get_payment_donor_id($payment_id) {
948
+	$payment = new Give_Payment($payment_id);
949 949
 
950 950
 	return $payment->customer_id;
951 951
 }
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return string $ip User IP.
961 961
  */
962
-function give_get_payment_user_ip( $payment_id ) {
963
-	$payment = new Give_Payment( $payment_id );
962
+function give_get_payment_user_ip($payment_id) {
963
+	$payment = new Give_Payment($payment_id);
964 964
 
965 965
 	return $payment->ip;
966 966
 }
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
  *
975 975
  * @return string $date The date the payment was completed.
976 976
  */
977
-function give_get_payment_completed_date( $payment_id = 0 ) {
978
-	$payment = new Give_Payment( $payment_id );
977
+function give_get_payment_completed_date($payment_id = 0) {
978
+	$payment = new Give_Payment($payment_id);
979 979
 
980 980
 	return $payment->completed_date;
981 981
 }
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return string $gateway Gateway.
991 991
  */
992
-function give_get_payment_gateway( $payment_id ) {
993
-	$payment = new Give_Payment( $payment_id );
992
+function give_get_payment_gateway($payment_id) {
993
+	$payment = new Give_Payment($payment_id);
994 994
 
995 995
 	return $payment->gateway;
996 996
 }
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  *
1005 1005
  * @return string $currency The currency code.
1006 1006
  */
1007
-function give_get_payment_currency_code( $payment_id = 0 ) {
1008
-	$payment = new Give_Payment( $payment_id );
1007
+function give_get_payment_currency_code($payment_id = 0) {
1008
+	$payment = new Give_Payment($payment_id);
1009 1009
 
1010 1010
 	return $payment->currency;
1011 1011
 }
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
  *
1020 1020
  * @return string $currency The currency name.
1021 1021
  */
1022
-function give_get_payment_currency( $payment_id = 0 ) {
1023
-	$currency = give_get_payment_currency_code( $payment_id );
1022
+function give_get_payment_currency($payment_id = 0) {
1023
+	$currency = give_get_payment_currency_code($payment_id);
1024 1024
 
1025
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1025
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
  *
1035 1035
  * @return string $key Donation key.
1036 1036
  */
1037
-function give_get_payment_key( $payment_id = 0 ) {
1038
-	$payment = new Give_Payment( $payment_id );
1037
+function give_get_payment_key($payment_id = 0) {
1038
+	$payment = new Give_Payment($payment_id);
1039 1039
 
1040 1040
 	return $payment->key;
1041 1041
 }
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return string $number Payment order number.
1053 1053
  */
1054
-function give_get_payment_number( $payment_id = 0 ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_number($payment_id = 0) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->number;
1058 1058
 }
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return string      The formatted payment number.
1068 1068
  */
1069
-function give_format_payment_number( $number ) {
1069
+function give_format_payment_number($number) {
1070 1070
 
1071
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1071
+	if ( ! give_get_option('enable_sequential')) {
1072 1072
 		return $number;
1073 1073
 	}
1074 1074
 
1075
-	if ( ! is_numeric( $number ) ) {
1075
+	if ( ! is_numeric($number)) {
1076 1076
 		return $number;
1077 1077
 	}
1078 1078
 
1079
-	$prefix  = give_get_option( 'sequential_prefix' );
1080
-	$number  = absint( $number );
1081
-	$postfix = give_get_option( 'sequential_postfix' );
1079
+	$prefix  = give_get_option('sequential_prefix');
1080
+	$number  = absint($number);
1081
+	$postfix = give_get_option('sequential_postfix');
1082 1082
 
1083
-	$formatted_number = $prefix . $number . $postfix;
1083
+	$formatted_number = $prefix.$number.$postfix;
1084 1084
 
1085
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1085
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,17 +1096,17 @@  discard block
 block discarded – undo
1096 1096
  */
1097 1097
 function give_get_next_payment_number() {
1098 1098
 
1099
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1099
+	if ( ! give_get_option('enable_sequential')) {
1100 1100
 		return false;
1101 1101
 	}
1102 1102
 
1103
-	$number           = get_option( 'give_last_payment_number' );
1104
-	$start            = give_get_option( 'sequential_start', 1 );
1103
+	$number           = get_option('give_last_payment_number');
1104
+	$start            = give_get_option('sequential_start', 1);
1105 1105
 	$increment_number = true;
1106 1106
 
1107
-	if ( false !== $number ) {
1107
+	if (false !== $number) {
1108 1108
 
1109
-		if ( empty( $number ) ) {
1109
+		if (empty($number)) {
1110 1110
 
1111 1111
 			$number           = $start;
1112 1112
 			$increment_number = false;
@@ -1115,24 +1115,24 @@  discard block
 block discarded – undo
1115 1115
 	} else {
1116 1116
 
1117 1117
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1118
-		$payments     = new Give_Payments_Query( array(
1118
+		$payments = new Give_Payments_Query(array(
1119 1119
 			'number'  => 1,
1120 1120
 			'order'   => 'DESC',
1121 1121
 			'orderby' => 'ID',
1122 1122
 			'output'  => 'posts',
1123 1123
 			'fields'  => 'ids',
1124
-		) );
1124
+		));
1125 1125
 		$last_payment = $payments->get_payments();
1126 1126
 
1127
-		if ( ! empty( $last_payment ) ) {
1127
+		if ( ! empty($last_payment)) {
1128 1128
 
1129
-			$number = give_get_payment_number( $last_payment[0] );
1129
+			$number = give_get_payment_number($last_payment[0]);
1130 1130
 
1131 1131
 		}
1132 1132
 
1133
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1133
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1134 1134
 
1135
-			$number = give_remove_payment_prefix_postfix( $number );
1135
+			$number = give_remove_payment_prefix_postfix($number);
1136 1136
 
1137 1137
 		} else {
1138 1138
 
@@ -1141,13 +1141,13 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 	}// End if().
1143 1143
 
1144
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1144
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1145 1145
 
1146
-	if ( $increment_number ) {
1147
-		$number ++;
1146
+	if ($increment_number) {
1147
+		$number++;
1148 1148
 	}
1149 1149
 
1150
-	return apply_filters( 'give_get_next_payment_number', $number );
1150
+	return apply_filters('give_get_next_payment_number', $number);
1151 1151
 }
1152 1152
 
1153 1153
 /**
@@ -1159,25 +1159,25 @@  discard block
 block discarded – undo
1159 1159
  *
1160 1160
  * @return string The new Payment number without prefix and postfix.
1161 1161
  */
1162
-function give_remove_payment_prefix_postfix( $number ) {
1162
+function give_remove_payment_prefix_postfix($number) {
1163 1163
 
1164
-	$prefix  = give_get_option( 'sequential_prefix' );
1165
-	$postfix = give_get_option( 'sequential_postfix' );
1164
+	$prefix  = give_get_option('sequential_prefix');
1165
+	$postfix = give_get_option('sequential_postfix');
1166 1166
 
1167 1167
 	// Remove prefix.
1168
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1168
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1169 1169
 
1170 1170
 	// Remove the postfix.
1171
-	$length      = strlen( $number );
1172
-	$postfix_pos = strrpos( $number, $postfix );
1173
-	if ( false !== $postfix_pos ) {
1174
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1171
+	$length      = strlen($number);
1172
+	$postfix_pos = strrpos($number, $postfix);
1173
+	if (false !== $postfix_pos) {
1174
+		$number = substr_replace($number, '', $postfix_pos, $length);
1175 1175
 	}
1176 1176
 
1177 1177
 	// Ensure it's a whole number.
1178
-	$number = intval( $number );
1178
+	$number = intval($number);
1179 1179
 
1180
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1180
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1181 1181
 
1182 1182
 }
1183 1183
 
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return string $amount Fully formatted donation amount.
1197 1197
  */
1198
-function give_donation_amount( $donation, $format_args = array() ) {
1198
+function give_donation_amount($donation, $format_args = array()) {
1199 1199
 	/* @var Give_Payment $donation */
1200
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1201
-		$donation = new Give_Payment( absint( $donation ) );
1200
+	if ( ! ($donation instanceof Give_Payment)) {
1201
+		$donation = new Give_Payment(absint($donation));
1202 1202
 	}
1203 1203
 
1204 1204
 	$amount           = $donation->total;
1205 1205
 	$formatted_amount = $amount;
1206 1206
 
1207
-	if ( is_bool( $format_args ) ) {
1207
+	if (is_bool($format_args)) {
1208 1208
 		$format_args = array(
1209 1209
 			'currency' => (bool) $format_args,
1210 1210
 			'amount'   => (bool) $format_args,
@@ -1227,27 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		)
1228 1228
 	);
1229 1229
 
1230
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1230
+	if ($format_args['amount'] || $format_args['currency']) {
1231 1231
 
1232
-		if ( $format_args['amount'] ) {
1232
+		if ($format_args['amount']) {
1233 1233
 
1234 1234
 			$formatted_amount = give_format_amount(
1235 1235
 				$amount,
1236
-				! is_array( $format_args['amount'] ) ?
1236
+				! is_array($format_args['amount']) ?
1237 1237
 					array(
1238 1238
 						'sanitize' => false,
1239 1239
 						'currency' => $donation->currency,
1240
-					) :
1241
-					$format_args['amount']
1240
+					) : $format_args['amount']
1242 1241
 			);
1243 1242
 		}
1244 1243
 
1245
-		if ( $format_args['currency'] ) {
1244
+		if ($format_args['currency']) {
1246 1245
 			$formatted_amount = give_currency_filter(
1247 1246
 				$formatted_amount,
1248
-				! is_array( $format_args['currency'] ) ?
1249
-					array( 'currency_code' => $donation->currency ) :
1250
-					$format_args['currency']
1247
+				! is_array($format_args['currency']) ?
1248
+					array('currency_code' => $donation->currency) : $format_args['currency']
1251 1249
 			);
1252 1250
 		}
1253 1251
 	}
@@ -1262,7 +1260,7 @@  discard block
 block discarded – undo
1262 1260
 	 * @param int    $donation_id      Donation ID.
1263 1261
 	 * @param string $type             Donation amount type.
1264 1262
 	 */
1265
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1263
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1266 1264
 }
1267 1265
 
1268 1266
 /**
@@ -1279,10 +1277,10 @@  discard block
 block discarded – undo
1279 1277
  *
1280 1278
  * @return array Fully formatted payment subtotal.
1281 1279
  */
1282
-function give_payment_subtotal( $payment_id = 0 ) {
1283
-	$subtotal = give_get_payment_subtotal( $payment_id );
1280
+function give_payment_subtotal($payment_id = 0) {
1281
+	$subtotal = give_get_payment_subtotal($payment_id);
1284 1282
 
1285
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1283
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1286 1284
 }
1287 1285
 
1288 1286
 /**
@@ -1296,8 +1294,8 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return float $subtotal Subtotal for payment (non formatted).
1298 1296
  */
1299
-function give_get_payment_subtotal( $payment_id = 0 ) {
1300
-	$payment = new Give_Payment( $payment_id );
1297
+function give_get_payment_subtotal($payment_id = 0) {
1298
+	$payment = new Give_Payment($payment_id);
1301 1299
 
1302 1300
 	return $payment->subtotal;
1303 1301
 }
@@ -1311,8 +1309,8 @@  discard block
 block discarded – undo
1311 1309
  *
1312 1310
  * @return string The donation ID.
1313 1311
  */
1314
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1315
-	$payment = new Give_Payment( $payment_id );
1312
+function give_get_payment_transaction_id($payment_id = 0) {
1313
+	$payment = new Give_Payment($payment_id);
1316 1314
 
1317 1315
 	return $payment->transaction_id;
1318 1316
 }
@@ -1327,15 +1325,15 @@  discard block
 block discarded – undo
1327 1325
  *
1328 1326
  * @return bool|mixed
1329 1327
  */
1330
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1328
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1331 1329
 
1332
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1330
+	if (empty($payment_id) || empty($transaction_id)) {
1333 1331
 		return false;
1334 1332
 	}
1335 1333
 
1336
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1334
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1337 1335
 
1338
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1336
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1339 1337
 }
1340 1338
 
1341 1339
 /**
@@ -1348,10 +1346,10 @@  discard block
 block discarded – undo
1348 1346
  *
1349 1347
  * @return int $purchase Donation ID.
1350 1348
  */
1351
-function give_get_donation_id_by_key( $key ) {
1349
+function give_get_donation_id_by_key($key) {
1352 1350
 	global $wpdb;
1353 1351
 
1354
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1352
+	$meta_table = __give_v20_bc_table_details('payment');
1355 1353
 
1356 1354
 	$purchase = $wpdb->get_var(
1357 1355
 		$wpdb->prepare(
@@ -1367,7 +1365,7 @@  discard block
 block discarded – undo
1367 1365
 		)
1368 1366
 	);
1369 1367
 
1370
-	if ( $purchase != null ) {
1368
+	if ($purchase != null) {
1371 1369
 		return $purchase;
1372 1370
 	}
1373 1371
 
@@ -1385,13 +1383,13 @@  discard block
 block discarded – undo
1385 1383
  *
1386 1384
  * @return int $purchase Donation ID.
1387 1385
  */
1388
-function give_get_purchase_id_by_transaction_id( $key ) {
1386
+function give_get_purchase_id_by_transaction_id($key) {
1389 1387
 	global $wpdb;
1390
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1388
+	$meta_table = __give_v20_bc_table_details('payment');
1391 1389
 
1392
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1390
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1393 1391
 
1394
-	if ( $purchase != null ) {
1392
+	if ($purchase != null) {
1395 1393
 		return $purchase;
1396 1394
 	}
1397 1395
 
@@ -1408,23 +1406,23 @@  discard block
 block discarded – undo
1408 1406
  *
1409 1407
  * @return array $notes Donation Notes
1410 1408
  */
1411
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1409
+function give_get_payment_notes($payment_id = 0, $search = '') {
1412 1410
 
1413
-	if ( empty( $payment_id ) && empty( $search ) ) {
1411
+	if (empty($payment_id) && empty($search)) {
1414 1412
 		return false;
1415 1413
 	}
1416 1414
 
1417
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1418
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1415
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1416
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1419 1417
 
1420
-	$notes = get_comments( array(
1418
+	$notes = get_comments(array(
1421 1419
 		'post_id' => $payment_id,
1422 1420
 		'order'   => 'ASC',
1423 1421
 		'search'  => $search,
1424
-	) );
1422
+	));
1425 1423
 
1426
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1427
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1424
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1425
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1428 1426
 
1429 1427
 	return $notes;
1430 1428
 }
@@ -1440,8 +1438,8 @@  discard block
 block discarded – undo
1440 1438
  *
1441 1439
  * @return int The new note ID
1442 1440
  */
1443
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1444
-	if ( empty( $payment_id ) ) {
1441
+function give_insert_payment_note($payment_id = 0, $note = '') {
1442
+	if (empty($payment_id)) {
1445 1443
 		return false;
1446 1444
 	}
1447 1445
 
@@ -1453,14 +1451,14 @@  discard block
 block discarded – undo
1453 1451
 	 *
1454 1452
 	 * @since 1.0
1455 1453
 	 */
1456
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1454
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1457 1455
 
1458
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1456
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1459 1457
 		'comment_post_ID'      => $payment_id,
1460 1458
 		'comment_content'      => $note,
1461 1459
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1462
-		'comment_date'         => current_time( 'mysql' ),
1463
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1460
+		'comment_date'         => current_time('mysql'),
1461
+		'comment_date_gmt'     => current_time('mysql', 1),
1464 1462
 		'comment_approved'     => 1,
1465 1463
 		'comment_parent'       => 0,
1466 1464
 		'comment_author'       => '',
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 		'comment_author_email' => '',
1470 1468
 		'comment_type'         => 'give_payment_note',
1471 1469
 
1472
-	) ) );
1470
+	)));
1473 1471
 
1474 1472
 	/**
1475 1473
 	 * Fires after payment note inserted.
@@ -1480,7 +1478,7 @@  discard block
 block discarded – undo
1480 1478
 	 *
1481 1479
 	 * @since 1.0
1482 1480
 	 */
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1481
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1482
 
1485 1483
 	return $note_id;
1486 1484
 }
@@ -1495,8 +1493,8 @@  discard block
 block discarded – undo
1495 1493
  *
1496 1494
  * @return bool True on success, false otherwise.
1497 1495
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1496
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1497
+	if (empty($comment_id)) {
1500 1498
 		return false;
1501 1499
 	}
1502 1500
 
@@ -1508,9 +1506,9 @@  discard block
 block discarded – undo
1508 1506
 	 *
1509 1507
 	 * @since 1.0
1510 1508
 	 */
1511
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1509
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1512 1510
 
1513
-	$ret = wp_delete_comment( $comment_id, true );
1511
+	$ret = wp_delete_comment($comment_id, true);
1514 1512
 
1515 1513
 	/**
1516 1514
 	 * Fires after donation note deleted.
@@ -1520,7 +1518,7 @@  discard block
 block discarded – undo
1520 1518
 	 *
1521 1519
 	 * @since 1.0
1522 1520
 	 */
1523
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1521
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1524 1522
 
1525 1523
 	return $ret;
1526 1524
 }
@@ -1535,32 +1533,32 @@  discard block
 block discarded – undo
1535 1533
  *
1536 1534
  * @return string
1537 1535
  */
1538
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1536
+function give_get_payment_note_html($note, $payment_id = 0) {
1539 1537
 
1540
-	if ( is_numeric( $note ) ) {
1541
-		$note = get_comment( $note );
1538
+	if (is_numeric($note)) {
1539
+		$note = get_comment($note);
1542 1540
 	}
1543 1541
 
1544
-	if ( ! empty( $note->user_id ) ) {
1545
-		$user = get_userdata( $note->user_id );
1542
+	if ( ! empty($note->user_id)) {
1543
+		$user = get_userdata($note->user_id);
1546 1544
 		$user = $user->display_name;
1547 1545
 	} else {
1548
-		$user = __( 'System', 'give' );
1546
+		$user = __('System', 'give');
1549 1547
 	}
1550 1548
 
1551
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1549
+	$date_format = give_date_format().', '.get_option('time_format');
1552 1550
 
1553
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1551
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1554 1552
 		'give-action' => 'delete_payment_note',
1555 1553
 		'note_id'     => $note->comment_ID,
1556 1554
 		'payment_id'  => $payment_id,
1557
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1555
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1558 1556
 
1559
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1557
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1560 1558
 	$note_html .= '<p>';
1561
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1559
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1562 1560
 	$note_html .= $note->comment_content;
1563
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1561
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1564 1562
 	$note_html .= '</p>';
1565 1563
 	$note_html .= '</div>';
1566 1564
 
@@ -1578,18 +1576,18 @@  discard block
 block discarded – undo
1578 1576
  *
1579 1577
  * @return void
1580 1578
  */
1581
-function give_hide_payment_notes( $query ) {
1582
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1583
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1584
-		if ( ! is_array( $types ) ) {
1585
-			$types = array( $types );
1579
+function give_hide_payment_notes($query) {
1580
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1581
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1582
+		if ( ! is_array($types)) {
1583
+			$types = array($types);
1586 1584
 		}
1587 1585
 		$types[]                           = 'give_payment_note';
1588 1586
 		$query->query_vars['type__not_in'] = $types;
1589 1587
 	}
1590 1588
 }
1591 1589
 
1592
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1590
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1593 1591
 
1594 1592
 /**
1595 1593
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1601,15 +1599,15 @@  discard block
 block discarded – undo
1601 1599
  *
1602 1600
  * @return array $clauses Updated comment clauses.
1603 1601
  */
1604
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1605
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1602
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1603
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1606 1604
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1607 1605
 	}
1608 1606
 
1609 1607
 	return $clauses;
1610 1608
 }
1611 1609
 
1612
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1610
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1613 1611
 
1614 1612
 
1615 1613
 /**
@@ -1622,15 +1620,15 @@  discard block
 block discarded – undo
1622 1620
  *
1623 1621
  * @return string $where
1624 1622
  */
1625
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1623
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1626 1624
 	global $wpdb;
1627 1625
 
1628
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1626
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1629 1627
 
1630 1628
 	return $where;
1631 1629
 }
1632 1630
 
1633
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1631
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1634 1632
 
1635 1633
 
1636 1634
 /**
@@ -1644,32 +1642,32 @@  discard block
 block discarded – undo
1644 1642
  *
1645 1643
  * @return array|object Array of comment counts.
1646 1644
  */
1647
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1645
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1648 1646
 	global $wpdb, $pagenow;
1649 1647
 
1650
-	if ( 'index.php' != $pagenow ) {
1648
+	if ('index.php' != $pagenow) {
1651 1649
 		return $stats;
1652 1650
 	}
1653 1651
 
1654 1652
 	$post_id = (int) $post_id;
1655 1653
 
1656
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1654
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1657 1655
 		return $stats;
1658 1656
 	}
1659 1657
 
1660
-	$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
1658
+	$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
1661 1659
 
1662
-	if ( ! is_null( $stats ) ) {
1660
+	if ( ! is_null($stats)) {
1663 1661
 		return $stats;
1664 1662
 	}
1665 1663
 
1666 1664
 	$where = 'WHERE comment_type != "give_payment_note"';
1667 1665
 
1668
-	if ( $post_id > 0 ) {
1669
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1666
+	if ($post_id > 0) {
1667
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1670 1668
 	}
1671 1669
 
1672
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1670
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1673 1671
 
1674 1672
 	$total    = 0;
1675 1673
 	$approved = array(
@@ -1679,30 +1677,30 @@  discard block
 block discarded – undo
1679 1677
 		'trash'        => 'trash',
1680 1678
 		'post-trashed' => 'post-trashed',
1681 1679
 	);
1682
-	foreach ( (array) $count as $row ) {
1680
+	foreach ((array) $count as $row) {
1683 1681
 		// Don't count post-trashed toward totals.
1684
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1682
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1685 1683
 			$total += $row['num_comments'];
1686 1684
 		}
1687
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1688
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1685
+		if (isset($approved[$row['comment_approved']])) {
1686
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1689 1687
 		}
1690 1688
 	}
1691 1689
 
1692 1690
 	$stats['total_comments'] = $total;
1693
-	foreach ( $approved as $key ) {
1694
-		if ( empty( $stats[ $key ] ) ) {
1695
-			$stats[ $key ] = 0;
1691
+	foreach ($approved as $key) {
1692
+		if (empty($stats[$key])) {
1693
+			$stats[$key] = 0;
1696 1694
 		}
1697 1695
 	}
1698 1696
 
1699 1697
 	$stats = (object) $stats;
1700
-	Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
1698
+	Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
1701 1699
 
1702 1700
 	return $stats;
1703 1701
 }
1704 1702
 
1705
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1703
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1706 1704
 
1707 1705
 
1708 1706
 /**
@@ -1715,9 +1713,9 @@  discard block
 block discarded – undo
1715 1713
  *
1716 1714
  * @return string $where Modified where clause.
1717 1715
  */
1718
-function give_filter_where_older_than_week( $where = '' ) {
1716
+function give_filter_where_older_than_week($where = '') {
1719 1717
 	// Payments older than one week.
1720
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1718
+	$start = date('Y-m-d', strtotime('-7 days'));
1721 1719
 	$where .= " AND post_date <= '{$start}'";
1722 1720
 
1723 1721
 	return $where;
@@ -1737,13 +1735,13 @@  discard block
 block discarded – undo
1737 1735
  *
1738 1736
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1739 1737
  */
1740
-function give_get_donation_form_title( $donation, $args = array() ) {
1738
+function give_get_donation_form_title($donation, $args = array()) {
1741 1739
 
1742
-	if ( ! $donation instanceof Give_Payment ) {
1743
-		$donation = new Give_Payment( $donation );
1740
+	if ( ! $donation instanceof Give_Payment) {
1741
+		$donation = new Give_Payment($donation);
1744 1742
 	}
1745 1743
 
1746
-	if( ! $donation->ID ) {
1744
+	if ( ! $donation->ID) {
1747 1745
 		return '';
1748 1746
 	}
1749 1747
 
@@ -1752,7 +1750,7 @@  discard block
 block discarded – undo
1752 1750
 		'separator'  => '',
1753 1751
 	);
1754 1752
 
1755
-	$args = wp_parse_args( $args, $defaults );
1753
+	$args = wp_parse_args($args, $defaults);
1756 1754
 
1757 1755
 	$form_id     = $donation->form_id;
1758 1756
 	$price_id    = $donation->price_id;
@@ -1773,32 +1771,32 @@  discard block
 block discarded – undo
1773 1771
 		, false
1774 1772
 	);
1775 1773
 
1776
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1774
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1777 1775
 
1778
-	if ( is_null( $form_title_html ) ) {
1779
-		if ( true === $only_level ) {
1776
+	if (is_null($form_title_html)) {
1777
+		if (true === $only_level) {
1780 1778
 			$form_title = '';
1781 1779
 		}
1782 1780
 
1783 1781
 		$form_title_html = $form_title;
1784 1782
 
1785
-		if ( 'custom' === $price_id ) {
1786
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1787
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1788
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1789
-			$level_label = give_get_price_option_name( $form_id, $price_id, $donation->ID, false );
1783
+		if ('custom' === $price_id) {
1784
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1785
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1786
+		} elseif (give_has_variable_prices($form_id)) {
1787
+			$level_label = give_get_price_option_name($form_id, $price_id, $donation->ID, false);
1790 1788
 		}
1791 1789
 
1792 1790
 		// Only add separator if there is a form title.
1793 1791
 		if (
1794
-			! empty( $form_title_html ) &&
1795
-			! empty( $level_label )
1792
+			! empty($form_title_html) &&
1793
+			! empty($level_label)
1796 1794
 		) {
1797 1795
 			$form_title_html .= " {$separator} ";
1798 1796
 		}
1799 1797
 
1800 1798
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1801
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1799
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1802 1800
 	}
1803 1801
 
1804 1802
 	/**
@@ -1806,7 +1804,7 @@  discard block
 block discarded – undo
1806 1804
 	 *
1807 1805
 	 * @since 1.0
1808 1806
 	 */
1809
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation );
1807
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation);
1810 1808
 }
1811 1809
 
1812 1810
 /**
@@ -1819,19 +1817,19 @@  discard block
 block discarded – undo
1819 1817
  *
1820 1818
  * @return string $price_id
1821 1819
  */
1822
-function give_get_price_id( $form_id, $price ) {
1820
+function give_get_price_id($form_id, $price) {
1823 1821
 	$price_id = null;
1824 1822
 
1825
-	if ( give_has_variable_prices( $form_id ) ) {
1823
+	if (give_has_variable_prices($form_id)) {
1826 1824
 
1827
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1825
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1828 1826
 
1829
-		foreach ( $levels as $level ) {
1827
+		foreach ($levels as $level) {
1830 1828
 
1831
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1829
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1832 1830
 
1833 1831
 			// Check that this indeed the recurring price.
1834
-			if ( $level_amount == $price ) {
1832
+			if ($level_amount == $price) {
1835 1833
 
1836 1834
 				$price_id = $level['_give_id']['level_id'];
1837 1835
 				break;
@@ -1839,13 +1837,13 @@  discard block
 block discarded – undo
1839 1837
 			}
1840 1838
 		}
1841 1839
 
1842
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1840
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1843 1841
 			$price_id = 'custom';
1844 1842
 		}
1845 1843
 	}
1846 1844
 
1847 1845
 	// Price ID must be numeric or string.
1848
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1846
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1849 1847
 
1850 1848
 	/**
1851 1849
 	 * Filter the price id
@@ -1855,7 +1853,7 @@  discard block
 block discarded – undo
1855 1853
 	 * @param string $price_id
1856 1854
 	 * @param int    $form_id
1857 1855
 	 */
1858
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1856
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1859 1857
 }
1860 1858
 
1861 1859
 /**
@@ -1871,10 +1869,10 @@  discard block
 block discarded – undo
1871 1869
  *
1872 1870
  * @return string
1873 1871
  */
1874
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1875
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1872
+function give_get_form_dropdown($args = array(), $echo = false) {
1873
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1876 1874
 
1877
-	if ( ! $echo ) {
1875
+	if ( ! $echo) {
1878 1876
 		return $form_dropdown_html;
1879 1877
 	}
1880 1878
 
@@ -1891,17 +1889,17 @@  discard block
 block discarded – undo
1891 1889
  *
1892 1890
  * @return string|bool
1893 1891
  */
1894
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1892
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1895 1893
 
1896 1894
 	// Check for give form id.
1897
-	if ( empty( $args['id'] ) ) {
1895
+	if (empty($args['id'])) {
1898 1896
 		return false;
1899 1897
 	}
1900 1898
 
1901
-	$form = new Give_Donate_Form( $args['id'] );
1899
+	$form = new Give_Donate_Form($args['id']);
1902 1900
 
1903 1901
 	// Check if form has variable prices or not.
1904
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1902
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1905 1903
 		return false;
1906 1904
 	}
1907 1905
 
@@ -1909,24 +1907,24 @@  discard block
 block discarded – undo
1909 1907
 	$variable_price_options = array();
1910 1908
 
1911 1909
 	// Check if multi donation form support custom donation or not.
1912
-	if ( $form->is_custom_price_mode() ) {
1913
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1910
+	if ($form->is_custom_price_mode()) {
1911
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1914 1912
 	}
1915 1913
 
1916 1914
 	// Get variable price and ID from variable price array.
1917
-	foreach ( $variable_prices as $variable_price ) {
1918
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1915
+	foreach ($variable_prices as $variable_price) {
1916
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1919 1917
 	}
1920 1918
 
1921 1919
 	// Update options.
1922
-	$args = array_merge( $args, array(
1920
+	$args = array_merge($args, array(
1923 1921
 		'options' => $variable_price_options,
1924
-	) );
1922
+	));
1925 1923
 
1926 1924
 	// Generate select html.
1927
-	$form_dropdown_html = Give()->html->select( $args );
1925
+	$form_dropdown_html = Give()->html->select($args);
1928 1926
 
1929
-	if ( ! $echo ) {
1927
+	if ( ! $echo) {
1930 1928
 		return $form_dropdown_html;
1931 1929
 	}
1932 1930
 
@@ -1945,14 +1943,14 @@  discard block
 block discarded – undo
1945 1943
  *
1946 1944
  * @return string
1947 1945
  */
1948
-function give_get_payment_meta_price_id( $payment_meta ) {
1946
+function give_get_payment_meta_price_id($payment_meta) {
1949 1947
 
1950
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1948
+	if (isset($payment_meta['give_price_id'])) {
1951 1949
 		$price_id = $payment_meta['give_price_id'];
1952
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1950
+	} elseif (isset($payment_meta['price_id'])) {
1953 1951
 		$price_id = $payment_meta['price_id'];
1954 1952
 	} else {
1955
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1953
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1956 1954
 	}
1957 1955
 
1958 1956
 	/**
@@ -1963,6 +1961,6 @@  discard block
 block discarded – undo
1963 1961
 	 * @param string $price_id
1964 1962
 	 * @param array  $payment_meta
1965 1963
 	 */
1966
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1964
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1967 1965
 
1968 1966
 }
Please login to merge, or discard this patch.
includes/class-give-db-form-meta.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->formmeta    = $this->table_name = $wpdb->prefix . 'give_formmeta';
53
+		$wpdb->formmeta    = $this->table_name = $wpdb->prefix.'give_formmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +30 added lines, -31 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
 
@@ -18,48 +18,47 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<div class="give-update-panel-content">
25
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
25
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
26 26
 		</div>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
29
+		<?php if ( ! empty($db_updates)) : ?>
30 30
 			<?php
31 31
 			$is_doing_updates = $give_updates->is_doing_updates();
32
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
33
-			$resume_updates   = get_option( 'give_doing_upgrade' );
34
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
32
+			$db_update_url    = add_query_arg(array('type' => 'database',));
33
+			$resume_updates   = get_option('give_doing_upgrade');
34
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
35 35
 			?>
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43
-									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : '';  ?>>
43
+									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
44 44
 										<?php echo sprintf(
45
-										__( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ),
45
+										__('%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give'),
46 46
 										$is_doing_updates ?
47
-											__( 'Give is currently updating the database in the background.', 'give' ) :
48
-											__( 'Give needs to update the database.', 'give' ),
47
+											__('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'),
49 48
 										$db_update_url,
50
-										( $is_doing_updates ? 'give-hidden' : '' ),
51
-										__( 'Update now', 'give' )
49
+										($is_doing_updates ? 'give-hidden' : ''),
50
+										__('Update now', 'give')
52 51
 									);
53 52
 									?>
54 53
 									</span>
55
-									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process()  ? 'style="display:none;"' : '';  ?>>
54
+									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
56 55
 										<?php _e('The updates have been paused.', 'give'); ?>
57 56
 									</span>
58 57
 
59
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
60
-										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"><?php _e( 'Restart Upgrades', 'give' ); ?></button>
61
-									<?php elseif( $give_updates->is_doing_updates() ): ?>
62
-										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"><?php _e( 'Pause Upgrades', 'give' ); ?></button>
58
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
59
+										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"><?php _e('Restart Upgrades', 'give'); ?></button>
60
+									<?php elseif ($give_updates->is_doing_updates()): ?>
61
+										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"><?php _e('Pause Upgrades', 'give'); ?></button>
63 62
 									<?php endif; ?>
64 63
 
65 64
 									<script type="text/javascript">
@@ -67,7 +66,7 @@  discard block
 block discarded – undo
67 66
 											e.preventDefault();
68 67
 											jQuery('.give-doing-update-text-p').hide();
69 68
 											jQuery('.give-update-paused-text-p').show();
70
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to stop the update process now?', 'give' ) ); ?>')) {
69
+											if (window.confirm('<?php echo esc_js(__('Do you want to stop the update process now?', 'give')); ?>')) {
71 70
 												window.location.assign(jQuery(this).data('redirect-url'));
72 71
 											}
73 72
 										});
@@ -75,7 +74,7 @@  discard block
 block discarded – undo
75 74
 											e.preventDefault();
76 75
 											jQuery('.give-doing-update-text-p').show();
77 76
 											jQuery('.give-update-paused-text-p').hide();
78
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to restart the update process?', 'give' ) ); ?>')) {
77
+											if (window.confirm('<?php echo esc_js(__('Do you want to restart the update process?', 'give')); ?>')) {
79 78
 												window.location.assign(jQuery(this).data('redirect-url'));
80 79
 											}
81 80
 										});
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
 									<strong>
88 87
 										<?php
89 88
 										echo sprintf(
90
-											__( 'Update %s of %s', 'give' ),
89
+											__('Update %s of %s', 'give'),
91 90
 											$give_updates->get_running_db_update(),
92 91
 											$give_updates->get_total_new_db_update_count()
93 92
 										);
@@ -95,10 +94,10 @@  discard block
 block discarded – undo
95 94
 									</strong>
96 95
 								</p>
97 96
 								<div class="progress-content">
98
-									<?php if ( $is_doing_updates  ) : ?>
97
+									<?php if ($is_doing_updates) : ?>
99 98
 										<div class="notice-wrap give-clearfix">
100 99
 
101
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) :  ?>
100
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) :  ?>
102 101
 												<span class="spinner is-active"></span>
103 102
 											<?php endif; ?>
104 103
 
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 								</div>
111 110
 							</div>
112 111
 
113
-							<?php if ( ! $is_doing_updates ) : ?>
112
+							<?php if ( ! $is_doing_updates) : ?>
114 113
 								<div class="give-run-database-update"></div>
115 114
 							<?php endif; ?>
116 115
 						</div>
@@ -121,17 +120,17 @@  discard block
 block discarded – undo
121 120
 		<?php endif; ?>
122 121
 
123 122
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
124
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
125
-			<?php $plugin_update_url = add_query_arg( array(
123
+		<?php if ( ! empty($plugin_updates)) : ?>
124
+			<?php $plugin_update_url = add_query_arg(array(
126 125
 				's' => 'Give',
127
-			), admin_url( '/plugins.php' ) ); ?>
126
+			), admin_url('/plugins.php')); ?>
128 127
 			<div id="give-plugin-updates">
129 128
 				<div class="postbox-container">
130 129
 					<div class="postbox">
131
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
130
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
132 131
 						<div class="inside">
133 132
 							<div class="panel-content">
134
-								<p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
133
+								<p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p>
135 134
 								<?php include_once 'plugins-update-section.php'; ?>
136 135
 							</div>
137 136
 						</div>
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +13 added lines, -13 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_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'logs';
37
-			$this->label = __( 'Logs', 'give' );
37
+			$this->label = __('Logs', 'give');
38 38
 
39 39
 			$this->default_tab = 'sales';
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function get_settings() {
52 52
 			// Get settings.
53
-			$settings = apply_filters( 'give_settings_logs', array(
53
+			$settings = apply_filters('give_settings_logs', array(
54 54
 				array(
55 55
 					'id'         => 'give_tools_logs',
56 56
 					'type'       => 'title',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				),
59 59
 				array(
60 60
 					'id'   => 'logs',
61
-					'name' => __( 'Log', 'give' ),
61
+					'name' => __('Log', 'give'),
62 62
 					'type' => 'logs',
63 63
 
64 64
 				),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					'type'       => 'sectionend',
68 68
 					'table_html' => false,
69 69
 				),
70
-			) );
70
+			));
71 71
 
72 72
 			/**
73 73
 			 * Filter the settings.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @param  array $settings
78 78
 			 */
79
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
79
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
80 80
 
81 81
 			// Output.
82 82
 			return $settings;
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 		 */
91 91
 		public function get_sections() {
92 92
 			$sections = array(
93
-				'sales'          => __( 'Donations', 'give' ),
94
-				'gateway_errors' => __( 'Payment Errors', 'give' ),
95
-				'api_requests'   => __( 'API Requests', 'give' ),
96
-				'updates'   => __( 'Updates', 'give' ),
93
+				'sales'          => __('Donations', 'give'),
94
+				'gateway_errors' => __('Payment Errors', 'give'),
95
+				'api_requests'   => __('API Requests', 'give'),
96
+				'updates'   => __('Updates', 'give'),
97 97
 			);
98 98
 
99
-			$sections = apply_filters( 'give_log_views', $sections );
99
+			$sections = apply_filters('give_log_views', $sections);
100 100
 
101
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
101
+			return apply_filters('give_get_sections_'.$this->id, $sections);
102 102
 		}
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
includes/admin/tools/logs/logs.php 1 patch
Spacing   +26 added lines, -26 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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_get_logs_tab() {
24 24
 
25
-	require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' );
25
+	require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php');
26 26
 
27 27
 	// Get current section.
28 28
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( "give_logs_view_{$current_section}" );
35
+	do_action("give_logs_view_{$current_section}");
36 36
 }
37 37
 
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_logs_view_sales() {
48 48
 
49
-	include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php';
49
+	include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php';
50 50
 
51 51
 	$logs_table = new Give_Sales_Log_Table();
52 52
 	$logs_table->prepare_items();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.8.12
61 61
 		 */
62
-		do_action( 'give_logs_donations_top' );
62
+		do_action('give_logs_donations_top');
63 63
 
64 64
 		$logs_table->display(); ?>
65 65
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.8.12
75 75
 		 */
76
-		do_action( 'give_logs_donations_bottom' );
76
+		do_action('give_logs_donations_bottom');
77 77
 		?>
78 78
 
79 79
 	</div>
80 80
 	<?php
81 81
 }
82 82
 
83
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
83
+add_action('give_logs_view_sales', 'give_logs_view_sales');
84 84
 
85 85
 /**
86 86
  * Update Logs
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_logs_view_updates() {
93
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' );
93
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php');
94 94
 
95 95
 	$logs_table = new Give_Update_Log_Table();
96 96
 	$logs_table->prepare_items();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 2.0.1
105 105
 		 */
106
-		do_action( 'give_logs_update_top' );
106
+		do_action('give_logs_update_top');
107 107
 
108 108
 		$logs_table->display(); ?>
109 109
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @since 2.0.1
119 119
 		 */
120
-		do_action( 'give_logs_update_bottom' );
120
+		do_action('give_logs_update_bottom');
121 121
 		?>
122 122
 
123 123
 	</div>
124 124
 	<?php
125 125
 }
126 126
 
127
-add_action( 'give_logs_view_updates', 'give_logs_view_updates' );
127
+add_action('give_logs_view_updates', 'give_logs_view_updates');
128 128
 
129 129
 /**
130 130
  * Gateway Error Logs
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_logs_view_gateway_errors() {
138
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' );
138
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php');
139 139
 
140 140
 	$logs_table = new Give_Gateway_Error_Log_Table();
141 141
 	$logs_table->prepare_items();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.12
150 150
 		 */
151
-		do_action( 'give_logs_payment_error_top' );
151
+		do_action('give_logs_payment_error_top');
152 152
 
153 153
 		$logs_table->display(); ?>
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.8.12
164 164
 		 */
165
-		do_action( 'give_logs_payment_error_bottom' );
165
+		do_action('give_logs_payment_error_bottom');
166 166
 		?>
167 167
 
168 168
 	</div>
169 169
 	<?php
170 170
 }
171 171
 
172
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
172
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
173 173
 
174 174
 /**
175 175
  * API Request Logs
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @return void
181 181
  */
182 182
 function give_logs_view_api_requests() {
183
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' );
183
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php');
184 184
 
185 185
 	$logs_table = new Give_API_Request_Log_Table();
186 186
 	$logs_table->prepare_items();
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @since 1.0
192 192
 	 */
193
-	do_action( 'give_logs_api_requests_top' );
193
+	do_action('give_logs_api_requests_top');
194 194
 
195
-	$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
195
+	$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
196 196
 	$logs_table->display();
197 197
 	?>
198 198
 	<input type="hidden" name="post_type" value="give_forms"/>
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @since 1.0
208 208
 	 */
209
-	do_action( 'give_logs_api_requests_bottom' );
209
+	do_action('give_logs_api_requests_bottom');
210 210
 }
211
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
211
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
212 212
 
213 213
 /**
214 214
  * Renders the log views drop down.
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	$current_section = give_get_current_setting_section();
221 221
 
222 222
 	// If there are not any event attach to action then do not show form.
223
-	if ( ! has_action( 'give_log_view_actions' ) ) {
223
+	if ( ! has_action('give_log_view_actions')) {
224 224
 		return;
225 225
 	}
226 226
 	?>
227
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
227
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
228 228
 		<?php
229 229
 		/**
230 230
 		 * Fires after displaying the reports page views drop down.
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		 *
234 234
 		 * @since 1.0
235 235
 		 */
236
-		do_action( 'give_log_view_actions' );
236
+		do_action('give_log_view_actions');
237 237
 		?>
238 238
 
239 239
 		<input type="hidden" name="post_type" value="give_forms"/>
240 240
 		<input type="hidden" name="page" value="give-tools"/>
241 241
 		<input type="hidden" name="tab" value="logs"/>
242 242
 
243
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
243
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
244 244
 	</form>
245 245
 	<?php
246 246
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return string
254 254
  */
255
-function give_tools_set_form_method( $method ) {
255
+function give_tools_set_form_method($method) {
256 256
 	return 'get';
257 257
 }
258
-add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 );
258
+add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-update-logs-list-table.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
66
+	public function search_box($text, $input_id) {
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_columns() {
78 78
 		$columns = array(
79
-			'ID'      => __( 'Log ID', 'give' ),
80
-			'date'    => __( 'Date', 'give' ),
81
-			'details' => __( 'Process Details', 'give' ),
79
+			'ID'      => __('Log ID', 'give'),
80
+			'date'    => __('Date', 'give'),
81
+			'details' => __('Process Details', 'give'),
82 82
 		);
83 83
 
84 84
 		return $columns;
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string Column Name
97 97
 	 */
98
-	public function column_default( $item, $column_name ) {
99
-		switch ( $column_name ) {
98
+	public function column_default($item, $column_name) {
99
+		switch ($column_name) {
100 100
 			case 'ID':
101 101
 				return sprintf(
102 102
 					'<span class="give-item-label give-item-label-gray">%1$s</span> %2$s',
103
-					esc_attr( $item[ $column_name ] ),
104
-					esc_attr( $item['title'] )
103
+					esc_attr($item[$column_name]),
104
+					esc_attr($item['title'])
105 105
 				);
106 106
 
107 107
 			default:
108
-				return esc_attr( $item[ $column_name ] );
108
+				return esc_attr($item[$column_name]);
109 109
 		}
110 110
 	}
111 111
 
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return void
121 121
 	 */
122
-	public function column_details( $item ) {
123
-		echo Give()->tooltips->render_link( array(
124
-			'label'       => __( 'View Update Log', 'give' ),
122
+	public function column_details($item) {
123
+		echo Give()->tooltips->render_link(array(
124
+			'label'       => __('View Update Log', 'give'),
125 125
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
126 126
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
127 127
 			'attributes'  => array(
128 128
 				'class' => 'thickbox give-error-log-details-link button button-small',
129 129
 			),
130
-		) );
130
+		));
131 131
 		?>
132 132
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
133 133
 			<?php
134 134
 
135 135
 			// Print Log Content, if not empty.
136
-			if ( ! empty( $item['log_content'] ) ) {
136
+			if ( ! empty($item['log_content'])) {
137 137
 				echo sprintf(
138 138
 					'<p><pre>%1$s</pre></div>',
139
-					esc_html( $item['log_content'] )
139
+					esc_html($item['log_content'])
140 140
 				);
141 141
 			}
142 142
 			?>
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $which
159 159
 	 */
160
-	protected function display_tablenav( $which ) {
161
-		if ( 'top' === $which ) {
162
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
160
+	protected function display_tablenav($which) {
161
+		if ('top' === $which) {
162
+			wp_nonce_field('bulk-'.$this->_args['plural']);
163 163
 		}
164 164
 		?>
165
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
165
+		<div class="tablenav <?php echo esc_attr($which); ?>">
166 166
 
167 167
 			<div class="alignleft actions bulkactions">
168
-				<?php $this->bulk_actions( $which ); ?>
168
+				<?php $this->bulk_actions($which); ?>
169 169
 			</div>
170 170
 			<?php
171
-			$this->extra_tablenav( $which );
172
-			$this->pagination( $which );
171
+			$this->extra_tablenav($which);
172
+			$this->pagination($which);
173 173
 			?>
174 174
 
175 175
 			<br class="clear"/>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return int Current page number
187 187
 	 */
188 188
 	public function get_paged() {
189
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
189
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
190 190
 	}
191 191
 
192 192
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return void
201 201
 	 */
202
-	function bulk_actions( $which = '' ) {
202
+	function bulk_actions($which = '') {
203 203
 	}
204 204
 
205 205
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 			'posts_per_page' => $this->per_page,
220 220
 		);
221 221
 
222
-		$logs = Give()->logs->get_connected_logs( $log_query );
222
+		$logs = Give()->logs->get_connected_logs($log_query);
223 223
 
224
-		if ( $logs ) {
225
-			foreach ( $logs as $log ) {
224
+		if ($logs) {
225
+			foreach ($logs as $log) {
226 226
 
227 227
 				$logs_data[] = array(
228 228
 					'ID'          => $log->ID,
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		$columns               = $this->get_columns();
255 255
 		$hidden                = array(); // No hidden columns
256 256
 		$sortable              = $this->get_sortable_columns();
257
-		$this->_column_headers = array( $columns, $hidden, $sortable );
257
+		$this->_column_headers = array($columns, $hidden, $sortable);
258 258
 		$this->items           = $this->get_logs();
259
-		$total_items           = Give()->logs->get_log_count( 0, 'update' );
259
+		$total_items           = Give()->logs->get_log_count(0, 'update');
260 260
 
261
-		$this->set_pagination_args( array(
261
+		$this->set_pagination_args(array(
262 262
 				'total_items' => $total_items,
263 263
 				'per_page'    => $this->per_page,
264
-				'total_pages' => ceil( $total_items / $this->per_page ),
264
+				'total_pages' => ceil($total_items / $this->per_page),
265 265
 			)
266 266
 		);
267 267
 	}
Please login to merge, or discard this patch.