Completed
Pull Request — master (#801)
by
unknown
18:24
created
give.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 	/**
49 49
 	 * Main Give Class
50 50
 	 *
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 		 * @return    Give
160 160
 		 */
161 161
 		public static function instance() {
162
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
162
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
163 163
 				self::$instance = new Give;
164 164
 				self::$instance->setup_constants();
165 165
 
166
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
166
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
167 167
 
168 168
 				self::$instance->includes();
169 169
 				self::$instance->roles           = new Give_Roles();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 */
196 196
 		public function __clone() {
197 197
 			// Cloning instances of the class is forbidden
198
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' );
198
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0');
199 199
 		}
200 200
 
201 201
 		/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 */
208 208
 		public function __wakeup() {
209 209
 			// Unserializing instances of the class is forbidden
210
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin’ huh?', 'give' ), '1.0' );
210
+			_doing_it_wrong(__FUNCTION__, esc_html__('Cheatin’ huh?', 'give'), '1.0');
211 211
 		}
212 212
 
213 213
 		/**
@@ -220,33 +220,33 @@  discard block
 block discarded – undo
220 220
 		private function setup_constants() {
221 221
 
222 222
 			// Plugin version
223
-			if ( ! defined( 'GIVE_VERSION' ) ) {
224
-				define( 'GIVE_VERSION', '1.5.2' );
223
+			if ( ! defined('GIVE_VERSION')) {
224
+				define('GIVE_VERSION', '1.5.2');
225 225
 			}
226 226
 
227 227
 			// Plugin Folder Path
228
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
229
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
228
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
229
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
230 230
 			}
231 231
 
232 232
 			// Plugin Folder URL
233
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
234
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
233
+			if ( ! defined('GIVE_PLUGIN_URL')) {
234
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
235 235
 			}
236 236
 
237 237
 			// Plugin Basename aka: "give/give.php"
238
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
239
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
238
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
239
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
240 240
 			}
241 241
 
242 242
 			// Plugin Root File
243
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
244
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
243
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
244
+				define('GIVE_PLUGIN_FILE', __FILE__);
245 245
 			}
246 246
 
247 247
 			// Make sure CAL_GREGORIAN is defined
248
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
249
-				define( 'CAL_GREGORIAN', 1 );
248
+			if ( ! defined('CAL_GREGORIAN')) {
249
+				define('CAL_GREGORIAN', 1);
250 250
 			}
251 251
 		}
252 252
 
@@ -260,109 +260,109 @@  discard block
 block discarded – undo
260 260
 		private function includes() {
261 261
 			global $give_options;
262 262
 
263
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
263
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
264 264
 			$give_options = give_get_settings();
265 265
 
266
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
267
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
268
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
269
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
270
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
271
-
272
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
273
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
274
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
279
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
285
-
286
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
287
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
294
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
295
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
301
-
302
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
303
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
307
-
308
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
313
-
314
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
319
-
320
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
321
-
322
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
323
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
324
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
325
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
326
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
327
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
328
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
329
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
330
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
332
-
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
334
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
335
-
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
337
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
341
-
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
343
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
344
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
348
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
349
-
350
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
359
-
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
361
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
266
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
267
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
268
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
269
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
270
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
271
+
272
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
273
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
279
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
285
+
286
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
287
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
294
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
295
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
301
+
302
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
307
+
308
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
313
+
314
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
319
+
320
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
321
+
322
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
323
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
324
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
325
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
326
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
327
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
328
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
329
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
330
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
332
+
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
334
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
335
+
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
337
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
341
+
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
343
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
344
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
348
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
349
+
350
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
359
+
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
361
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
362 362
 
363 363
 			}
364 364
 
365
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
365
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
366 366
 
367 367
 		}
368 368
 
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 		 */
376 376
 		public function load_textdomain() {
377 377
 			// Set filter for Give's languages directory
378
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
379
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
378
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
379
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
380 380
 
381 381
 			// Traditional WordPress plugin locale filter
382
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
383
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
382
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
383
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
384 384
 
385 385
 			// Setup paths to current locale file
386
-			$mofile_local  = $give_lang_dir . $mofile;
387
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
386
+			$mofile_local  = $give_lang_dir.$mofile;
387
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
388 388
 
389
-			if ( file_exists( $mofile_global ) ) {
389
+			if (file_exists($mofile_global)) {
390 390
 				// Look in global /wp-content/languages/give folder
391
-				load_textdomain( 'give', $mofile_global );
392
-			} elseif ( file_exists( $mofile_local ) ) {
391
+				load_textdomain('give', $mofile_global);
392
+			} elseif (file_exists($mofile_local)) {
393 393
 				// Look in local location from filter `give_languages_directory`
394
-				load_textdomain( 'give', $mofile_local );
394
+				load_textdomain('give', $mofile_local);
395 395
 			} else {
396 396
 				// Load the default language files packaged up w/ Give
397
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
397
+				load_plugin_textdomain('give', false, $give_lang_dir);
398 398
 			}
399 399
 		}
400 400
 	}
Please login to merge, or discard this patch.
includes/class-give-html-elements.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return string $output Give forms dropdown
35 35
 	 */
36
-	public function forms_dropdown( $args = array() ) {
36
+	public function forms_dropdown($args = array()) {
37 37
 
38 38
 		$defaults = array(
39 39
 			'name'        => 'forms',
@@ -44,47 +44,47 @@  discard block
 block discarded – undo
44 44
 			'chosen'      => false,
45 45
 			'number'      => 30,
46 46
 			/* translators: %s: form singular label */
47
-			'placeholder' => sprintf( esc_attr__( 'Select a %s', 'give' ), give_get_forms_label_singular() )
47
+			'placeholder' => sprintf(esc_attr__('Select a %s', 'give'), give_get_forms_label_singular())
48 48
 		);
49 49
 
50
-		$args = wp_parse_args( $args, $defaults );
50
+		$args = wp_parse_args($args, $defaults);
51 51
 
52
-		$forms = get_posts( array(
52
+		$forms = get_posts(array(
53 53
 			'post_type'      => 'give_forms',
54 54
 			'orderby'        => 'title',
55 55
 			'order'          => 'ASC',
56 56
 			'posts_per_page' => $args['number']
57
-		) );
57
+		));
58 58
 
59 59
 		$options = array();
60 60
 
61
-		if ( $forms ) {
61
+		if ($forms) {
62 62
 			$options[0] = sprintf(
63 63
 				/* translators: %s: form singular label */
64
-				esc_html__( 'Select a %s', 'give' ),
64
+				esc_html__('Select a %s', 'give'),
65 65
 				give_get_forms_label_singular()
66 66
 			);
67
-			foreach ( $forms as $form ) {
68
-				$options[ absint( $form->ID ) ] = esc_html( $form->post_title );
67
+			foreach ($forms as $form) {
68
+				$options[absint($form->ID)] = esc_html($form->post_title);
69 69
 			}
70 70
 		} else {
71
-			$options[0] = esc_html__( 'No Give Forms Found', 'give' );
71
+			$options[0] = esc_html__('No Give Forms Found', 'give');
72 72
 		}
73 73
 
74 74
 		// This ensures that any selected forms are included in the drop down
75
-		if ( is_array( $args['selected'] ) ) {
76
-			foreach ( $args['selected'] as $item ) {
77
-				if ( ! in_array( $item, $options ) ) {
78
-					$options[ $item ] = get_the_title( $item );
75
+		if (is_array($args['selected'])) {
76
+			foreach ($args['selected'] as $item) {
77
+				if ( ! in_array($item, $options)) {
78
+					$options[$item] = get_the_title($item);
79 79
 				}
80 80
 			}
81
-		} elseif ( is_numeric( $args['selected'] ) && $args['selected'] !== 0 ) {
82
-			if ( ! in_array( $args['selected'], $options ) ) {
83
-				$options[ $args['selected'] ] = get_the_title( $args['selected'] );
81
+		} elseif (is_numeric($args['selected']) && $args['selected'] !== 0) {
82
+			if ( ! in_array($args['selected'], $options)) {
83
+				$options[$args['selected']] = get_the_title($args['selected']);
84 84
 			}
85 85
 		}
86 86
 
87
-		$output = $this->select( array(
87
+		$output = $this->select(array(
88 88
 			'name'             => $args['name'],
89 89
 			'selected'         => $args['selected'],
90 90
 			'id'               => $args['id'],
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			'placeholder'      => $args['placeholder'],
96 96
 			'show_option_all'  => false,
97 97
 			'show_option_none' => false
98
-		) );
98
+		));
99 99
 
100 100
 		return $output;
101 101
 	}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string $output Donor dropdown
112 112
 	 */
113
-	public function donor_dropdown( $args = array() ) {
113
+	public function donor_dropdown($args = array()) {
114 114
 
115 115
 		$defaults = array(
116 116
 			'name'        => 'customers',
@@ -119,38 +119,38 @@  discard block
 block discarded – undo
119 119
 			'multiple'    => false,
120 120
 			'selected'    => 0,
121 121
 			'chosen'      => true,
122
-			'placeholder' => esc_attr__( 'Select a Donor', 'give' ),
122
+			'placeholder' => esc_attr__('Select a Donor', 'give'),
123 123
 			'number'      => 30
124 124
 		);
125 125
 
126
-		$args = wp_parse_args( $args, $defaults );
126
+		$args = wp_parse_args($args, $defaults);
127 127
 
128
-		$customers = Give()->customers->get_customers( array(
128
+		$customers = Give()->customers->get_customers(array(
129 129
 			'number' => $args['number']
130
-		) );
130
+		));
131 131
 
132 132
 		$options = array();
133 133
 
134
-		if ( $customers ) {
135
-			$options[0] = esc_html__( 'No donor attached', 'give' );
136
-			foreach ( $customers as $customer ) {
137
-				$options[ absint( $customer->id ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
134
+		if ($customers) {
135
+			$options[0] = esc_html__('No donor attached', 'give');
136
+			foreach ($customers as $customer) {
137
+				$options[absint($customer->id)] = esc_html($customer->name.' ('.$customer->email.')');
138 138
 			}
139 139
 		} else {
140
-			$options[0] = esc_html__( 'No donors found', 'give' );
140
+			$options[0] = esc_html__('No donors found', 'give');
141 141
 		}
142 142
 
143
-		if ( ! empty( $args['selected'] ) ) {
143
+		if ( ! empty($args['selected'])) {
144 144
 
145 145
 			// If a selected customer has been specified, we need to ensure it's in the initial list of customers displayed
146 146
 
147
-			if ( ! array_key_exists( $args['selected'], $options ) ) {
147
+			if ( ! array_key_exists($args['selected'], $options)) {
148 148
 
149
-				$customer = new Give_Customer( $args['selected'] );
149
+				$customer = new Give_Customer($args['selected']);
150 150
 
151
-				if ( $customer ) {
151
+				if ($customer) {
152 152
 
153
-					$options[ absint( $args['selected'] ) ] = esc_html( $customer->name . ' (' . $customer->email . ')' );
153
+					$options[absint($args['selected'])] = esc_html($customer->name.' ('.$customer->email.')');
154 154
 
155 155
 				}
156 156
 
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 
159 159
 		}
160 160
 
161
-		$output = $this->select( array(
161
+		$output = $this->select(array(
162 162
 			'name'             => $args['name'],
163 163
 			'selected'         => $args['selected'],
164 164
 			'id'               => $args['id'],
165
-			'class'            => $args['class'] . ' give-customer-select',
165
+			'class'            => $args['class'].' give-customer-select',
166 166
 			'options'          => $options,
167 167
 			'multiple'         => $args['multiple'],
168 168
 			'chosen'           => $args['chosen'],
169 169
 			'show_option_all'  => false,
170 170
 			'show_option_none' => false
171
-		) );
171
+		));
172 172
 
173 173
 		return $output;
174 174
 	}
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string $output Category dropdown
187 187
 	 */
188
-	public function category_dropdown( $name = 'give_forms_categories', $selected = 0 ) {
189
-		$categories = get_terms( 'give_forms_category', apply_filters( 'give_forms_category_dropdown', array() ) );
188
+	public function category_dropdown($name = 'give_forms_categories', $selected = 0) {
189
+		$categories = get_terms('give_forms_category', apply_filters('give_forms_category_dropdown', array()));
190 190
 		$options    = array();
191 191
 
192
-		foreach ( $categories as $category ) {
193
-			$options[ absint( $category->term_id ) ] = esc_html( $category->name );
192
+		foreach ($categories as $category) {
193
+			$options[absint($category->term_id)] = esc_html($category->name);
194 194
 		}
195 195
 
196
-		$output = $this->select( array(
196
+		$output = $this->select(array(
197 197
 			'name'             => $name,
198 198
 			'selected'         => $selected,
199 199
 			'options'          => $options,
200
-			'show_option_all'  => esc_html__( 'All Categories', 'give' ),
200
+			'show_option_all'  => esc_html__('All Categories', 'give'),
201 201
 			'show_option_none' => false
202
-		) );
202
+		));
203 203
 
204 204
 		return $output;
205 205
 	}
@@ -217,25 +217,25 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return string $output Year dropdown
219 219
 	 */
220
-	public function year_dropdown( $name = 'year', $selected = 0, $years_before = 5, $years_after = 0 ) {
221
-		$current    = date( 'Y' );
222
-		$start_year = $current - absint( $years_before );
223
-		$end_year   = $current + absint( $years_after );
224
-		$selected   = empty( $selected ) ? date( 'Y' ) : $selected;
220
+	public function year_dropdown($name = 'year', $selected = 0, $years_before = 5, $years_after = 0) {
221
+		$current    = date('Y');
222
+		$start_year = $current - absint($years_before);
223
+		$end_year   = $current + absint($years_after);
224
+		$selected   = empty($selected) ? date('Y') : $selected;
225 225
 		$options    = array();
226 226
 
227
-		while ( $start_year <= $end_year ) {
228
-			$options[ absint( $start_year ) ] = $start_year;
229
-			$start_year ++;
227
+		while ($start_year <= $end_year) {
228
+			$options[absint($start_year)] = $start_year;
229
+			$start_year++;
230 230
 		}
231 231
 
232
-		$output = $this->select( array(
232
+		$output = $this->select(array(
233 233
 			'name'             => $name,
234 234
 			'selected'         => $selected,
235 235
 			'options'          => $options,
236 236
 			'show_option_all'  => false,
237 237
 			'show_option_none' => false
238
-		) );
238
+		));
239 239
 
240 240
 		return $output;
241 241
 	}
@@ -252,23 +252,23 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return string $output Month dropdown
254 254
 	 */
255
-	public function month_dropdown( $name = 'month', $selected = 0 ) {
255
+	public function month_dropdown($name = 'month', $selected = 0) {
256 256
 		$month    = 1;
257 257
 		$options  = array();
258
-		$selected = empty( $selected ) ? date( 'n' ) : $selected;
258
+		$selected = empty($selected) ? date('n') : $selected;
259 259
 
260
-		while ( $month <= 12 ) {
261
-			$options[ absint( $month ) ] = give_month_num_to_name( $month );
262
-			$month ++;
260
+		while ($month <= 12) {
261
+			$options[absint($month)] = give_month_num_to_name($month);
262
+			$month++;
263 263
 		}
264 264
 
265
-		$output = $this->select( array(
265
+		$output = $this->select(array(
266 266
 			'name'             => $name,
267 267
 			'selected'         => $selected,
268 268
 			'options'          => $options,
269 269
 			'show_option_all'  => false,
270 270
 			'show_option_none' => false
271
-		) );
271
+		));
272 272
 
273 273
 		return $output;
274 274
 	}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return string
285 285
 	 */
286
-	public function select( $args = array() ) {
286
+	public function select($args = array()) {
287 287
 		$defaults = array(
288 288
 			'options'          => array(),
289 289
 			'name'             => null,
@@ -293,60 +293,60 @@  discard block
 block discarded – undo
293 293
 			'chosen'           => false,
294 294
 			'placeholder'      => null,
295 295
 			'multiple'         => false,
296
-			'show_option_all'  => esc_html__( 'All', 'give' ),
297
-			'show_option_none' => esc_html__( 'None', 'give' )
296
+			'show_option_all'  => esc_html__('All', 'give'),
297
+			'show_option_none' => esc_html__('None', 'give')
298 298
 		);
299 299
 
300
-		$args = wp_parse_args( $args, $defaults );
300
+		$args = wp_parse_args($args, $defaults);
301 301
 
302 302
 
303
-		if ( $args['multiple'] ) {
303
+		if ($args['multiple']) {
304 304
 			$multiple = ' MULTIPLE';
305 305
 		} else {
306 306
 			$multiple = '';
307 307
 		}
308 308
 
309
-		if ( $args['chosen'] ) {
309
+		if ($args['chosen']) {
310 310
 			$args['class'] .= ' give-select-chosen';
311 311
 		}
312 312
 
313
-		if ( $args['placeholder'] ) {
313
+		if ($args['placeholder']) {
314 314
 			$placeholder = $args['placeholder'];
315 315
 		} else {
316 316
 			$placeholder = '';
317 317
 		}
318 318
 
319
-		$output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( sanitize_key( str_replace( '-', '_', $args['id'] ) ) ) . '" class="give-select ' . esc_attr( $args['class'] ) . '"' . $multiple . ' data-placeholder="' . $placeholder . '">';
319
+		$output = '<select name="'.esc_attr($args['name']).'" id="'.esc_attr(sanitize_key(str_replace('-', '_', $args['id']))).'" class="give-select '.esc_attr($args['class']).'"'.$multiple.' data-placeholder="'.$placeholder.'">';
320 320
 
321
-		if ( $args['show_option_all'] ) {
322
-			if ( $args['multiple'] ) {
323
-				$selected = selected( true, in_array( 0, $args['selected'] ), false );
321
+		if ($args['show_option_all']) {
322
+			if ($args['multiple']) {
323
+				$selected = selected(true, in_array(0, $args['selected']), false);
324 324
 			} else {
325
-				$selected = selected( $args['selected'], 0, false );
325
+				$selected = selected($args['selected'], 0, false);
326 326
 			}
327
-			$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
327
+			$output .= '<option value="all"'.$selected.'>'.esc_html($args['show_option_all']).'</option>';
328 328
 		}
329 329
 
330
-		if ( ! empty( $args['options'] ) ) {
330
+		if ( ! empty($args['options'])) {
331 331
 
332
-			if ( $args['show_option_none'] ) {
333
-				if ( $args['multiple'] ) {
334
-					$selected = selected( true, in_array( - 1, $args['selected'] ), false );
332
+			if ($args['show_option_none']) {
333
+				if ($args['multiple']) {
334
+					$selected = selected(true, in_array( -1, $args['selected'] ), false);
335 335
 				} else {
336
-					$selected = selected( $args['selected'], - 1, false );
336
+					$selected = selected($args['selected'], - 1, false);
337 337
 				}
338
-				$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
338
+				$output .= '<option value="-1"'.$selected.'>'.esc_html($args['show_option_none']).'</option>';
339 339
 			}
340 340
 
341
-			foreach ( $args['options'] as $key => $option ) {
341
+			foreach ($args['options'] as $key => $option) {
342 342
 
343
-				if ( $args['multiple'] && is_array( $args['selected'] ) ) {
344
-					$selected = selected( true, in_array( $key, $args['selected'] ), false );
343
+				if ($args['multiple'] && is_array($args['selected'])) {
344
+					$selected = selected(true, in_array($key, $args['selected']), false);
345 345
 				} else {
346
-					$selected = selected( $args['selected'], $key, false );
346
+					$selected = selected($args['selected'], $key, false);
347 347
 				}
348 348
 
349
-				$output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>';
349
+				$output .= '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option).'</option>';
350 350
 			}
351 351
 		}
352 352
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @return string
367 367
 	 */
368
-	public function checkbox( $args = array() ) {
368
+	public function checkbox($args = array()) {
369 369
 		$defaults = array(
370 370
 			'name'    => null,
371 371
 			'current' => null,
@@ -376,16 +376,16 @@  discard block
 block discarded – undo
376 376
 			)
377 377
 		);
378 378
 
379
-		$args = wp_parse_args( $args, $defaults );
379
+		$args = wp_parse_args($args, $defaults);
380 380
 
381 381
 		$options = '';
382
-		if ( ! empty( $args['options']['disabled'] ) ) {
382
+		if ( ! empty($args['options']['disabled'])) {
383 383
 			$options .= ' disabled="disabled"';
384
-		} elseif ( ! empty( $args['options']['readonly'] ) ) {
384
+		} elseif ( ! empty($args['options']['readonly'])) {
385 385
 			$options .= ' readonly';
386 386
 		}
387 387
 
388
-		$output = '<input type="checkbox"' . $options . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . ' ' . esc_attr( $args['name'] ) . '" ' . checked( 1, $args['current'], false ) . ' />';
388
+		$output = '<input type="checkbox"'.$options.' name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].' '.esc_attr($args['name']).'" '.checked(1, $args['current'], false).' />';
389 389
 
390 390
 		return $output;
391 391
 	}
@@ -400,22 +400,22 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @return string Text field
402 402
 	 */
403
-	public function text( $args = array() ) {
403
+	public function text($args = array()) {
404 404
 		// Backwards compatibility
405
-		if ( func_num_args() > 1 ) {
405
+		if (func_num_args() > 1) {
406 406
 			$args = func_get_args();
407 407
 
408 408
 			$name  = $args[0];
409
-			$value = isset( $args[1] ) ? $args[1] : '';
410
-			$label = isset( $args[2] ) ? $args[2] : '';
411
-			$desc  = isset( $args[3] ) ? $args[3] : '';
409
+			$value = isset($args[1]) ? $args[1] : '';
410
+			$label = isset($args[2]) ? $args[2] : '';
411
+			$desc  = isset($args[3]) ? $args[3] : '';
412 412
 		}
413 413
 
414 414
 		$defaults = array(
415
-			'name'         => isset( $name ) ? $name : 'text',
416
-			'value'        => isset( $value ) ? $value : null,
417
-			'label'        => isset( $label ) ? $label : null,
418
-			'desc'         => isset( $desc ) ? $desc : null,
415
+			'name'         => isset($name) ? $name : 'text',
416
+			'value'        => isset($value) ? $value : null,
417
+			'label'        => isset($label) ? $label : null,
418
+			'desc'         => isset($desc) ? $desc : null,
419 419
 			'placeholder'  => '',
420 420
 			'class'        => 'regular-text',
421 421
 			'disabled'     => false,
@@ -423,29 +423,29 @@  discard block
 block discarded – undo
423 423
 			'data'         => false
424 424
 		);
425 425
 
426
-		$args = wp_parse_args( $args, $defaults );
426
+		$args = wp_parse_args($args, $defaults);
427 427
 
428 428
 		$disabled = '';
429
-		if ( $args['disabled'] ) {
429
+		if ($args['disabled']) {
430 430
 			$disabled = ' disabled="disabled"';
431 431
 		}
432 432
 
433 433
 		$data = '';
434
-		if ( ! empty( $args['data'] ) ) {
435
-			foreach ( $args['data'] as $key => $value ) {
436
-				$data .= 'data-' . $key . '="' . $value . '" ';
434
+		if ( ! empty($args['data'])) {
435
+			foreach ($args['data'] as $key => $value) {
436
+				$data .= 'data-'.$key.'="'.$value.'" ';
437 437
 			}
438 438
 		}
439 439
 
440
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
440
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
441 441
 
442
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
442
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
443 443
 
444
-		if ( ! empty( $args['desc'] ) ) {
445
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
444
+		if ( ! empty($args['desc'])) {
445
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
446 446
 		}
447 447
 
448
-		$output .= '<input type="text" name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" autocomplete="' . esc_attr( $args['autocomplete'] ) . '" value="' . esc_attr( $args['value'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" class="' . $args['class'] . '" ' . $data . '' . $disabled . '/>';
448
+		$output .= '<input type="text" name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" autocomplete="'.esc_attr($args['autocomplete']).'" value="'.esc_attr($args['value']).'" placeholder="'.esc_attr($args['placeholder']).'" class="'.$args['class'].'" '.$data.''.$disabled.'/>';
449 449
 
450 450
 		$output .= '</span>';
451 451
 
@@ -462,15 +462,15 @@  discard block
 block discarded – undo
462 462
 	 *
463 463
 	 * @return string Datepicker field
464 464
 	 */
465
-	public function date_field( $args = array() ) {
465
+	public function date_field($args = array()) {
466 466
 
467
-		if ( empty( $args['class'] ) ) {
467
+		if (empty($args['class'])) {
468 468
 			$args['class'] = 'give_datepicker';
469
-		} elseif ( ! strpos( $args['class'], 'give_datepicker' ) ) {
469
+		} elseif ( ! strpos($args['class'], 'give_datepicker')) {
470 470
 			$args['class'] .= ' give_datepicker';
471 471
 		}
472 472
 
473
-		return $this->text( $args );
473
+		return $this->text($args);
474 474
 	}
475 475
 
476 476
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return string textarea
486 486
 	 */
487
-	public function textarea( $args = array() ) {
487
+	public function textarea($args = array()) {
488 488
 		$defaults = array(
489 489
 			'name'     => 'textarea',
490 490
 			'value'    => null,
@@ -494,21 +494,21 @@  discard block
 block discarded – undo
494 494
 			'disabled' => false
495 495
 		);
496 496
 
497
-		$args = wp_parse_args( $args, $defaults );
497
+		$args = wp_parse_args($args, $defaults);
498 498
 
499 499
 		$disabled = '';
500
-		if ( $args['disabled'] ) {
500
+		if ($args['disabled']) {
501 501
 			$disabled = ' disabled="disabled"';
502 502
 		}
503 503
 
504
-		$output = '<span id="give-' . sanitize_key( $args['name'] ) . '-wrap">';
504
+		$output = '<span id="give-'.sanitize_key($args['name']).'-wrap">';
505 505
 
506
-		$output .= '<label class="give-label" for="give-' . sanitize_key( $args['name'] ) . '">' . esc_html( $args['label'] ) . '</label>';
506
+		$output .= '<label class="give-label" for="give-'.sanitize_key($args['name']).'">'.esc_html($args['label']).'</label>';
507 507
 
508
-		$output .= '<textarea name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( $args['name'] ) . '" class="' . $args['class'] . '"' . $disabled . '>' . esc_attr( $args['value'] ) . '</textarea>';
508
+		$output .= '<textarea name="'.esc_attr($args['name']).'" id="'.esc_attr($args['name']).'" class="'.$args['class'].'"'.$disabled.'>'.esc_attr($args['value']).'</textarea>';
509 509
 
510
-		if ( ! empty( $args['desc'] ) ) {
511
-			$output .= '<span class="give-description">' . esc_html( $args['desc'] ) . '</span>';
510
+		if ( ! empty($args['desc'])) {
511
+			$output .= '<span class="give-description">'.esc_html($args['desc']).'</span>';
512 512
 		}
513 513
 
514 514
 		$output .= '</span>';
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return string text field with ajax search
528 528
 	 */
529
-	public function ajax_user_search( $args = array() ) {
529
+	public function ajax_user_search($args = array()) {
530 530
 
531 531
 		$defaults = array(
532 532
 			'name'         => 'user_id',
533 533
 			'value'        => null,
534
-			'placeholder'  => esc_attr__( 'Enter username', 'give' ),
534
+			'placeholder'  => esc_attr__('Enter username', 'give'),
535 535
 			'label'        => null,
536 536
 			'desc'         => null,
537 537
 			'class'        => '',
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
 			'data'         => false
541 541
 		);
542 542
 
543
-		$args = wp_parse_args( $args, $defaults );
543
+		$args = wp_parse_args($args, $defaults);
544 544
 
545
-		$args['class'] = 'give-ajax-user-search ' . $args['class'];
545
+		$args['class'] = 'give-ajax-user-search '.$args['class'];
546 546
 
547 547
 		$output = '<span class="give_user_search_wrap">';
548
-		$output .= $this->text( $args );
549
-		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="' . esc_attr__( 'Cancel', 'give' ) . '" aria-label="' . esc_attr__( 'Cancel', 'give' ) . '" href="#">x</a><span></span></span>';
548
+		$output .= $this->text($args);
549
+		$output .= '<span class="give_user_search_results hidden"><a class="give-ajax-user-cancel" title="'.esc_attr__('Cancel', 'give').'" aria-label="'.esc_attr__('Cancel', 'give').'" href="#">x</a><span></span></span>';
550 550
 		$output .= '</span>';
551 551
 
552 552
 		return $output;
Please login to merge, or discard this patch.
includes/forms/template.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	$form_classes_array = apply_filters( 'give_form_classes', array(
79 79
 		'give-form',
80 80
 		'give-form-' . $form->ID,
81
-        'give-form-type-' . $form->get_type(),
81
+		'give-form-type-' . $form->get_type(),
82 82
 		$float_labels_option
83 83
 	), $form->ID, $args );
84 84
 
85
-    // Remove empty class names.
86
-    $form_classes_array = array_filter(
87
-        $form_classes_array,
88
-        function( $class ){
89
-            return $class;
90
-        }
91
-    );
85
+	// Remove empty class names.
86
+	$form_classes_array = array_filter(
87
+		$form_classes_array,
88
+		function( $class ){
89
+			return $class;
90
+		}
91
+	);
92 92
 
93 93
 	$form_classes       = implode( ' ', $form_classes_array );
94 94
 
@@ -1231,9 +1231,9 @@  discard block
 block discarded – undo
1231 1231
 
1232 1232
 	//Sanity check - ensure form has goal set to output
1233 1233
 	if ( empty( $form->ID )
1234
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1235
-	     || $goal_option !== 'yes'
1236
-	     || $goal == 0
1234
+		 || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1235
+		 || $goal_option !== 'yes'
1236
+		 || $goal == 0
1237 1237
 	) {
1238 1238
 		//not this form, bail
1239 1239
 		return false;
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 		if ( $goal_format !== 'percentage' ) {
1256 1256
 
1257 1257
 			 // Get formatted amount.
1258
-            $income = give_human_format_large_amount( give_format_amount( $income ) );
1259
-            $goal = give_human_format_large_amount( give_format_amount( $goal ) );
1258
+			$income = give_human_format_large_amount( give_format_amount( $income ) );
1259
+			$goal = give_human_format_large_amount( give_format_amount( $goal ) );
1260 1260
 
1261 1261
 			$output .= sprintf(
1262 1262
 				/* translators: 1: amount of income raised 2: goal target ammount */
Please login to merge, or discard this patch.
Spacing   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,74 +23,74 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55
-	) );
55
+	));
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? 'float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
81
-        'give-form-type-' . $form->get_type(),
80
+		'give-form-'.$form->ID,
81
+        'give-form-type-'.$form->get_type(),
82 82
 		$float_labels_option
83
-	), $form->ID, $args );
83
+	), $form->ID, $args);
84 84
 
85 85
     // Remove empty class names.
86 86
     $form_classes_array = array_filter(
87 87
         $form_classes_array,
88
-        function( $class ){
88
+        function($class) {
89 89
             return $class;
90 90
         }
91 91
     );
92 92
 
93
-	$form_classes       = implode( ' ', $form_classes_array );
93
+	$form_classes = implode(' ', $form_classes_array);
94 94
 
95 95
 
96 96
 	ob_start();
@@ -103,35 +103,35 @@  discard block
 block discarded – undo
103 103
 	 * @param int $form ->ID The current form ID
104 104
 	 * @param array $args An array of form args
105 105
 	 */
106
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
106
+	do_action('give_pre_form_output', $form->ID, $args); ?>
107 107
 
108 108
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
109 109
 
110
-		<?php if ( $form->is_close_donation_form() ) {
110
+		<?php if ($form->is_close_donation_form()) {
111 111
 
112 112
 			//Get Goal thank you message.
113
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
114
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
113
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
114
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
115 115
 
116 116
 			//Print thank you message.
117
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
117
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
118 118
 
119 119
 		} else {
120 120
 
121
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
121
+			if (isset($args['show_title']) && $args['show_title'] == true) {
122 122
 
123
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
123
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
124 124
 
125 125
 			}
126 126
 
127
-			do_action( 'give_pre_form', $form->ID, $args ); ?>
127
+			do_action('give_pre_form', $form->ID, $args); ?>
128 128
 
129 129
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
130 130
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
131
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
132
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
133
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
134
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
131
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
132
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
133
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
134
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
135 135
 
136 136
 				<!-- The following field is for robots only, invisible to humans: -->
137 137
 				<span class="give-hidden" style="display: none !important;">
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 				<?php
143 143
 
144 144
 				//Price ID hidden field for variable (mult-level) donation forms
145
-				if ( give_has_variable_prices( $form_id ) ) {
145
+				if (give_has_variable_prices($form_id)) {
146 146
 					//get default selected price ID
147
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
147
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
148 148
 					$price_id = 0;
149 149
 					//loop through prices
150
-					foreach ( $prices as $price ) {
151
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
150
+					foreach ($prices as $price) {
151
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
152 152
 							$price_id = $price['_give_id']['level_id'];
153 153
 						};
154 154
 					}
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
157 157
 				<?php }
158 158
 
159
-				do_action( 'give_checkout_form_top', $form->ID, $args );
159
+				do_action('give_checkout_form_top', $form->ID, $args);
160 160
 
161
-				do_action( 'give_payment_mode_select', $form->ID, $args );
161
+				do_action('give_payment_mode_select', $form->ID, $args);
162 162
 
163
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
163
+				do_action('give_checkout_form_bottom', $form->ID, $args);
164 164
 
165 165
 				?>
166 166
 			</form>
167 167
 
168
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
168
+			<?php do_action('give_post_form', $form->ID, $args); ?>
169 169
 
170 170
 		<?php } ?>
171 171
 
172
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
172
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
173 173
 	<?php
174 174
 
175 175
 	/**
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	 * @param int $form ->ID The current form ID
181 181
 	 * @param array $args An array of form args
182 182
 	 */
183
-	do_action( 'give_post_form_output', $form->ID, $args );
183
+	do_action('give_post_form_output', $form->ID, $args);
184 184
 
185 185
 	$final_output = ob_get_clean();
186 186
 
187
-	echo apply_filters( 'give_donate_form', $final_output, $args );
187
+	echo apply_filters('give_donate_form', $final_output, $args);
188 188
 }
189 189
 
190 190
 
@@ -203,43 +203,43 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return string
205 205
  */
206
-function give_show_purchase_form( $form_id ) {
206
+function give_show_purchase_form($form_id) {
207 207
 
208
-	$payment_mode = give_get_chosen_gateway( $form_id );
208
+	$payment_mode = give_get_chosen_gateway($form_id);
209 209
 
210
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
210
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
211 211
 		$form_id = $_POST['give_form_id'];
212 212
 	}
213 213
 
214
-	do_action( 'give_purchase_form_top', $form_id );
214
+	do_action('give_purchase_form_top', $form_id);
215 215
 
216
-	if ( give_can_checkout() && isset( $form_id ) ) {
216
+	if (give_can_checkout() && isset($form_id)) {
217 217
 
218
-		do_action( 'give_purchase_form_before_register_login', $form_id );
218
+		do_action('give_purchase_form_before_register_login', $form_id);
219 219
 
220
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
220
+		do_action('give_purchase_form_register_login_fields', $form_id);
221 221
 
222
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
222
+		do_action('give_purchase_form_before_cc_form', $form_id);
223 223
 
224 224
 		// Load the credit card form and allow gateways to load their own if they wish
225
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
226
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
225
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
226
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
227 227
 		} else {
228
-			do_action( 'give_cc_form', $form_id );
228
+			do_action('give_cc_form', $form_id);
229 229
 		}
230 230
 
231
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
231
+		do_action('give_purchase_form_after_cc_form', $form_id);
232 232
 
233 233
 	} else {
234 234
 		// Can't checkout
235
-		do_action( 'give_purchase_form_no_access', $form_id );
235
+		do_action('give_purchase_form_no_access', $form_id);
236 236
 
237 237
 	}
238 238
 
239
-	do_action( 'give_purchase_form_bottom', $form_id );
239
+	do_action('give_purchase_form_bottom', $form_id);
240 240
 }
241 241
 
242
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
242
+add_action('give_purchase_form', 'give_show_purchase_form');
243 243
 
244 244
 /**
245 245
  *
@@ -251,26 +251,26 @@  discard block
 block discarded – undo
251 251
  *
252 252
  * @return void
253 253
  */
254
-function give_show_register_login_fields( $form_id ) {
254
+function give_show_register_login_fields($form_id) {
255 255
 
256
-	$show_register_form = give_show_login_register_option( $form_id );
256
+	$show_register_form = give_show_login_register_option($form_id);
257 257
 
258
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
258
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
259 259
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
260
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
260
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
261 261
 		</div>
262
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
262
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
263 263
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
264
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
264
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
265 265
 		</div>
266 266
 	<?php endif; ?>
267 267
 
268
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
269
-		do_action( 'give_purchase_form_after_user_info', $form_id );
268
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
269
+		do_action('give_purchase_form_after_user_info', $form_id);
270 270
 	}
271 271
 }
272 272
 
273
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
273
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
274 274
 
275 275
 /**
276 276
  * Donation Amount Field
@@ -284,33 +284,33 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @return void
286 286
  */
287
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
287
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
288 288
 
289 289
 	global $give_options;
290 290
 
291
-	$variable_pricing    = give_has_variable_prices( $form_id );
292
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
293
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
294
-	$symbol              = give_currency_symbol( give_get_currency() );
295
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
296
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
297
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
291
+	$variable_pricing    = give_has_variable_prices($form_id);
292
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
293
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
294
+	$symbol              = give_currency_symbol(give_get_currency());
295
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
296
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
297
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
298 298
 
299
-	do_action( 'give_before_donation_levels', $form_id, $args );
299
+	do_action('give_before_donation_levels', $form_id, $args);
300 300
 
301 301
 	//Set Price, No Custom Amount Allowed means hidden price field
302
-	if ( $allow_custom_amount == 'no' ) {
302
+	if ($allow_custom_amount == 'no') {
303 303
 		?>
304 304
 
305
-		<label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
305
+		<label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label>
306 306
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
307 307
 		       value="<?php echo $default_amount; ?>" required>
308 308
 		<div class="set-price give-donation-amount form-row-wide">
309
-			<?php if ( $currency_position == 'before' ) {
309
+			<?php if ($currency_position == 'before') {
310 310
 				echo $currency_output;
311 311
 			} ?>
312 312
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
313
-			<?php if ( $currency_position == 'after' ) {
313
+			<?php if ($currency_position == 'after') {
314 314
 				echo $currency_output;
315 315
 			} ?>
316 316
 		</div>
@@ -320,34 +320,34 @@  discard block
 block discarded – undo
320 320
 		?>
321 321
 		<div class="give-total-wrap">
322 322
 			<div class="give-donation-amount form-row-wide">
323
-				<?php if ( $currency_position == 'before' ) {
323
+				<?php if ($currency_position == 'before') {
324 324
 					echo $currency_output;
325 325
 				} ?>
326
-				<label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
326
+				<label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label>
327 327
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
328
-				<?php if ( $currency_position == 'after' ) {
328
+				<?php if ($currency_position == 'after') {
329 329
 					echo $currency_output;
330 330
 				} ?>
331 331
 			</div>
332 332
 		</div>
333 333
 	<?php }
334 334
 
335
-	do_action( 'give_after_donation_amount', $form_id, $args );
335
+	do_action('give_after_donation_amount', $form_id, $args);
336 336
 
337 337
 	//Custom Amount Text
338
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
338
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
339 339
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
340 340
 	<?php }
341 341
 
342 342
 	//Output Variable Pricing Levels
343
-	if ( $variable_pricing ) {
344
-		give_output_levels( $form_id );
343
+	if ($variable_pricing) {
344
+		give_output_levels($form_id);
345 345
 	}
346 346
 
347
-	do_action( 'give_after_donation_levels', $form_id, $args );
347
+	do_action('give_after_donation_levels', $form_id, $args);
348 348
 }
349 349
 
350
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
350
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
351 351
 
352 352
 
353 353
 /**
@@ -359,32 +359,32 @@  discard block
 block discarded – undo
359 359
  *
360 360
  * @return string
361 361
  */
362
-function give_output_levels( $form_id ) {
362
+function give_output_levels($form_id) {
363 363
 
364 364
 	//Get variable pricing
365
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
366
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
367
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
368
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
369
-	if ( empty( $custom_amount_text ) ) {
370
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
365
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
366
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
367
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
368
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
369
+	if (empty($custom_amount_text)) {
370
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
371 371
 	}
372 372
 
373 373
 	$output  = '';
374 374
 	$counter = 0;
375 375
 
376
-	switch ( $display_style ) {
376
+	switch ($display_style) {
377 377
 		case 'buttons':
378 378
 
379 379
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
380 380
 
381
-			foreach ( $prices as $price ) {
382
-				$counter ++;
383
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
384
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
381
+			foreach ($prices as $price) {
382
+				$counter++;
383
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
384
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
385 385
 
386 386
 				$output .= '<li>';
387
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
387
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
388 388
 				$output .= $level_text;
389 389
 				$output .= '</button>';
390 390
 				$output .= '</li>';
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 			}
393 393
 
394 394
 			//Custom Amount
395
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
395
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
396 396
 				$output .= '<li>';
397 397
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
398 398
 				$output .= $custom_amount_text;
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
 
409 409
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
410 410
 
411
-			foreach ( $prices as $price ) {
412
-				$counter ++;
413
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
414
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
411
+			foreach ($prices as $price) {
412
+				$counter++;
413
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
414
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
415 415
 
416 416
 				$output .= '<li>';
417
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
418
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
417
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
418
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
419 419
 				$output .= '</li>';
420 420
 
421 421
 			}
422 422
 
423 423
 			//Custom Amount
424
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
424
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
425 425
 				$output .= '<li>';
426 426
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
427
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
427
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
428 428
 				$output .= '</li>';
429 429
 			}
430 430
 
@@ -434,23 +434,23 @@  discard block
 block discarded – undo
434 434
 
435 435
 		case 'dropdown':
436 436
 
437
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
438
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
437
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
438
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
439 439
 
440 440
 			//first loop through prices
441
-			foreach ( $prices as $price ) {
442
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
443
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
441
+			foreach ($prices as $price) {
442
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
443
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
444 444
 
445
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
445
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
446 446
 				$output .= $level_text;
447 447
 				$output .= '</option>';
448 448
 
449 449
 			}
450 450
 
451 451
 			//Custom Amount
452
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
453
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
452
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
453
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
454 454
 			}
455 455
 
456 456
 			$output .= '</select>';
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 			break;
459 459
 	}
460 460
 
461
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
461
+	echo apply_filters('give_form_level_output', $output, $form_id);
462 462
 }
463 463
 
464 464
 /**
@@ -470,26 +470,26 @@  discard block
 block discarded – undo
470 470
  * @param array $args
471 471
  *
472 472
  */
473
-function give_display_checkout_button( $form_id, $args ) {
473
+function give_display_checkout_button($form_id, $args) {
474 474
 
475
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
475
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
476 476
 		? $args['display_style']
477
-		: get_post_meta( $form_id, '_give_payment_display', true );
477
+		: get_post_meta($form_id, '_give_payment_display', true);
478 478
 
479 479
 	//no btn for onpage
480
-	if ( $display_option === 'onpage' ) {
480
+	if ($display_option === 'onpage') {
481 481
 		return;
482 482
 	}
483 483
 
484
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
485
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
484
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
485
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
486 486
 
487
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
487
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
488 488
 
489
-	echo apply_filters( 'give_display_checkout_button', $output );
489
+	echo apply_filters('give_display_checkout_button', $output);
490 490
 }
491 491
 
492
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
492
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
493 493
 
494 494
 /**
495 495
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -500,71 +500,71 @@  discard block
 block discarded – undo
500 500
  *
501 501
  * @return void
502 502
  */
503
-function give_user_info_fields( $form_id ) {
503
+function give_user_info_fields($form_id) {
504 504
 
505
-	if ( is_user_logged_in() ) :
506
-		$user_data = get_userdata( get_current_user_id() );
505
+	if (is_user_logged_in()) :
506
+		$user_data = get_userdata(get_current_user_id());
507 507
 	endif;
508 508
 
509
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
509
+	do_action('give_purchase_form_before_personal_info', $form_id);
510 510
 	?>
511 511
 	<fieldset id="give_checkout_user_info">
512
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
512
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
513 513
 		<p id="give-first-name-wrap" class="form-row form-row-first">
514 514
 			<label class="give-label" for="give-first">
515
-				<?php esc_html_e( 'First Name', 'give' ); ?>
516
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
515
+				<?php esc_html_e('First Name', 'give'); ?>
516
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
517 517
 					<span class="give-required-indicator">*</span>
518 518
 				<?php } ?>
519
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
519
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
520 520
 			</label>
521
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
521
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_attr_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
522 522
 				echo ' required ';
523 523
 			} ?>/>
524 524
 		</p>
525 525
 
526 526
 		<p id="give-last-name-wrap" class="form-row form-row-last">
527 527
 			<label class="give-label" for="give-last">
528
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
529
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
528
+				<?php esc_html_e('Last Name', 'give'); ?>
529
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
530 530
 					<span class="give-required-indicator">*</span>
531 531
 				<?php } ?>
532
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
532
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
533 533
 			</label>
534 534
 
535
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
535
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
536 536
 				echo ' required';
537
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
537
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
538 538
 				echo ' required ';
539 539
 			} ?> />
540 540
 		</p>
541 541
 
542
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
542
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
543 543
 		<p id="give-email-wrap" class="form-row form-row-wide">
544 544
 			<label class="give-label" for="give-email">
545
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
546
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
545
+				<?php esc_html_e('Email Address', 'give'); ?>
546
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
547 547
 					<span class="give-required-indicator">*</span>
548 548
 				<?php } ?>
549
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
549
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
550 550
 			</label>
551 551
 
552
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
552
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_attr_e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
553 553
 				echo ' required ';
554 554
 			} ?>/>
555 555
 
556 556
 		</p>
557
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
557
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
558 558
 
559
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
559
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
560 560
 	</fieldset>
561 561
 	<?php
562
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
562
+	do_action('give_purchase_form_after_personal_info', $form_id);
563 563
 
564 564
 }
565 565
 
566
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
567
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
566
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
567
+add_action('give_register_fields_before', 'give_user_info_fields');
568 568
 
569 569
 /**
570 570
  * Renders the credit card info form.
@@ -575,73 +575,73 @@  discard block
 block discarded – undo
575 575
  *
576 576
  * @return void
577 577
  */
578
-function give_get_cc_form( $form_id ) {
578
+function give_get_cc_form($form_id) {
579 579
 
580 580
 	ob_start();
581 581
 
582
-	do_action( 'give_before_cc_fields', $form_id ); ?>
582
+	do_action('give_before_cc_fields', $form_id); ?>
583 583
 
584 584
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
585
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
586
-		<?php if ( is_ssl() ) : ?>
585
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
586
+		<?php if (is_ssl()) : ?>
587 587
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
588 588
 				<span class="give-icon padlock"></span>
589
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
589
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
590 590
 			</div>
591 591
 		<?php endif; ?>
592 592
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
593 593
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
594
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
594
+				<?php esc_html_e('Card Number', 'give'); ?>
595 595
 				<span class="give-required-indicator">*</span>
596
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
596
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
597 597
 				<span class="card-type"></span>
598 598
 			</label>
599 599
 
600
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" required/>
600
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" required/>
601 601
 		</p>
602 602
 
603 603
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
604 604
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
605
-				<?php esc_html_e( 'CVC', 'give' ); ?>
605
+				<?php esc_html_e('CVC', 'give'); ?>
606 606
 				<span class="give-required-indicator">*</span>
607
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
607
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
608 608
 			</label>
609 609
 
610
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" required/>
610
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" required/>
611 611
 		</p>
612 612
 
613 613
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
614 614
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
615
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
615
+				<?php esc_html_e('Name on the Card', 'give'); ?>
616 616
 				<span class="give-required-indicator">*</span>
617
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
617
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
618 618
 			</label>
619 619
 
620
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" required/>
620
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" required/>
621 621
 		</p>
622
-		<?php do_action( 'give_before_cc_expiration' ); ?>
622
+		<?php do_action('give_before_cc_expiration'); ?>
623 623
 		<p class="card-expiration form-row form-row-one-third">
624 624
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
625
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
625
+				<?php esc_html_e('Expiration', 'give'); ?>
626 626
 				<span class="give-required-indicator">*</span>
627
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
627
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
628 628
 			</label>
629 629
 
630 630
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
631 631
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
632 632
 
633
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required/>
633
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required/>
634 634
 		</p>
635
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
635
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
636 636
 
637 637
 	</fieldset>
638 638
 	<?php
639
-	do_action( 'give_after_cc_fields', $form_id );
639
+	do_action('give_after_cc_fields', $form_id);
640 640
 
641 641
 	echo ob_get_clean();
642 642
 }
643 643
 
644
-add_action( 'give_cc_form', 'give_get_cc_form' );
644
+add_action('give_cc_form', 'give_get_cc_form');
645 645
 
646 646
 /**
647 647
  * Outputs the default credit card address fields
@@ -652,110 +652,110 @@  discard block
 block discarded – undo
652 652
  *
653 653
  * @return void
654 654
  */
655
-function give_default_cc_address_fields( $form_id ) {
655
+function give_default_cc_address_fields($form_id) {
656 656
 
657 657
 	$logged_in = is_user_logged_in();
658 658
 
659
-	if ( $logged_in ) {
660
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
659
+	if ($logged_in) {
660
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
661 661
 	}
662
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
663
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
664
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
665
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
662
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
663
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
664
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
665
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
666 666
 	ob_start(); ?>
667 667
 	<fieldset id="give_cc_address" class="cc-address">
668
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
669
-		<?php do_action( 'give_cc_billing_top' ); ?>
668
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
669
+		<?php do_action('give_cc_billing_top'); ?>
670 670
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
671 671
 			<label for="card_address" class="give-label">
672
-				<?php esc_html_e( 'Address', 'give' ); ?>
672
+				<?php esc_html_e('Address', 'give'); ?>
673 673
 				<?php
674
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
674
+				if (give_field_is_required('card_address', $form_id)) { ?>
675 675
 					<span class="give-required-indicator">*</span>
676 676
 				<?php } ?>
677
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
677
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
678 678
 			</label>
679 679
 
680
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
680
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
681 681
 				echo ' required';
682
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
682
+			} ?>" placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
683 683
 				echo '  required ';
684 684
 			} ?>/>
685 685
 		</p>
686 686
 
687 687
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
688 688
 			<label for="card_address_2" class="give-label">
689
-				<?php esc_html_e( 'Address Line 2', 'give' ); ?>
690
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
689
+				<?php esc_html_e('Address Line 2', 'give'); ?>
690
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
691 691
 					<span class="give-required-indicator">*</span>
692 692
 				<?php } ?>
693
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
693
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
694 694
 			</label>
695 695
 
696
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
696
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
697 697
 				echo ' required';
698
-			} ?>" placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
698
+			} ?>" placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
699 699
 				echo ' required ';
700 700
 			} ?>/>
701 701
 		</p>
702 702
 
703 703
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
704 704
 			<label for="card_city" class="give-label">
705
-				<?php esc_html_e( 'City', 'give' ); ?>
706
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
705
+				<?php esc_html_e('City', 'give'); ?>
706
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
707 707
 					<span class="give-required-indicator">*</span>
708 708
 				<?php } ?>
709
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
709
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
710 710
 			</label>
711
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
711
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
712 712
 				echo ' required';
713
-			} ?>" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
713
+			} ?>" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
714 714
 				echo ' required ';
715 715
 			} ?>/>
716 716
 		</p>
717 717
 
718 718
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
719 719
 			<label for="card_zip" class="give-label">
720
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
721
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
720
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
721
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
722 722
 					<span class="give-required-indicator">*</span>
723 723
 				<?php } ?>
724
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
724
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
725 725
 			</label>
726 726
 
727
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
727
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
728 728
 				echo ' required';
729
-			} ?>" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
729
+			} ?>" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
730 730
 				echo ' required ';
731 731
 			} ?>/>
732 732
 		</p>
733 733
 
734 734
 		<p id="give-card-country-wrap" class="form-row form-row-first">
735 735
 			<label for="billing_country" class="give-label">
736
-				<?php esc_html_e( 'Country', 'give' ); ?>
737
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
736
+				<?php esc_html_e('Country', 'give'); ?>
737
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
738 738
 					<span class="give-required-indicator">*</span>
739 739
 				<?php } ?>
740
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
740
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
741 741
 			</label>
742 742
 
743
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
743
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
744 744
 				echo ' required';
745
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
745
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
746 746
 				echo ' required ';
747 747
 			} ?>>
748 748
 				<?php
749 749
 
750 750
 				$selected_country = give_get_country();
751 751
 
752
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
752
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
753 753
 					$selected_country = $user_address['country'];
754 754
 				}
755 755
 
756 756
 				$countries = give_get_country_list();
757
-				foreach ( $countries as $country_code => $country ) {
758
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
757
+				foreach ($countries as $country_code => $country) {
758
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
759 759
 				}
760 760
 				?>
761 761
 			</select>
@@ -763,44 +763,44 @@  discard block
 block discarded – undo
763 763
 
764 764
 		<p id="give-card-state-wrap" class="form-row form-row-last">
765 765
 			<label for="card_state" class="give-label">
766
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
767
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
766
+				<?php esc_html_e('State / Province', 'give'); ?>
767
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
768 768
 					<span class="give-required-indicator">*</span>
769 769
 				<?php } ?>
770
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
770
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
771 771
 			</label>
772 772
 
773 773
 			<?php
774 774
 			$selected_state = give_get_state();
775
-			$states         = give_get_states( $selected_country );
775
+			$states         = give_get_states($selected_country);
776 776
 
777
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
777
+			if ($logged_in && ! empty($user_address['state'])) {
778 778
 				$selected_state = $user_address['state'];
779 779
 			}
780 780
 
781
-			if ( ! empty( $states ) ) : ?>
782
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
781
+			if ( ! empty($states)) : ?>
782
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
783 783
 					echo ' required';
784
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
784
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
785 785
 					echo ' required ';
786 786
 				} ?>>
787 787
 					<?php
788
-					foreach ( $states as $state_code => $state ) {
789
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
788
+					foreach ($states as $state_code => $state) {
789
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
790 790
 					}
791 791
 					?>
792 792
 				</select>
793 793
 			<?php else : ?>
794
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
794
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
795 795
 			<?php endif; ?>
796 796
 		</p>
797
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
797
+		<?php do_action('give_cc_billing_bottom'); ?>
798 798
 	</fieldset>
799 799
 	<?php
800 800
 	echo ob_get_clean();
801 801
 }
802 802
 
803
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
803
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
804 804
 
805 805
 
806 806
 /**
@@ -812,93 +812,93 @@  discard block
 block discarded – undo
812 812
  *
813 813
  * @return string
814 814
  */
815
-function give_get_register_fields( $form_id ) {
815
+function give_get_register_fields($form_id) {
816 816
 
817 817
 	global $user_ID;
818 818
 
819
-	if ( is_user_logged_in() ) {
820
-		$user_data = get_userdata( $user_ID );
819
+	if (is_user_logged_in()) {
820
+		$user_data = get_userdata($user_ID);
821 821
 	}
822 822
 
823
-	$show_register_form = give_show_login_register_option( $form_id );
823
+	$show_register_form = give_show_login_register_option($form_id);
824 824
 
825 825
 	ob_start(); ?>
826 826
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
827 827
 
828
-		<?php if ( $show_register_form == 'both' ) { ?>
828
+		<?php if ($show_register_form == 'both') { ?>
829 829
 			<div class="give-login-account-wrap">
830
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
831
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
830
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
831
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
832 832
 				</p>
833 833
 				<p class="give-loading-text">
834
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
834
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
835 835
 			</div>
836 836
 		<?php } ?>
837 837
 
838
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
838
+		<?php do_action('give_register_fields_before', $form_id); ?>
839 839
 
840 840
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
841
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
842
-				if ( ! give_logged_in_only( $form_id ) ) {
843
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
841
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
842
+				if ( ! give_logged_in_only($form_id)) {
843
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
844 844
 				} ?></legend>
845
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
845
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
846 846
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
847 847
 				<label for="give-user-login-<?php echo $form_id; ?>">
848
-					<?php esc_html_e( 'Username', 'give' ); ?>
849
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
848
+					<?php esc_html_e('Username', 'give'); ?>
849
+					<?php if (give_logged_in_only($form_id)) { ?>
850 850
 						<span class="give-required-indicator">*</span>
851 851
 					<?php } ?>
852
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
852
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
853 853
 				</label>
854 854
 
855
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
855
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
856 856
 					echo 'required ';
857
-				} ?>give-input" type="text" placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>" title="<?php esc_attr_e( 'Username', 'give' ); ?>"/>
857
+				} ?>give-input" type="text" placeholder="<?php esc_attr_e('Username', 'give'); ?>" title="<?php esc_attr_e('Username', 'give'); ?>"/>
858 858
 			</div>
859 859
 
860 860
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
861 861
 				<label for="give-user-pass-<?php echo $form_id; ?>">
862
-					<?php esc_html_e( 'Password', 'give' ); ?>
863
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
862
+					<?php esc_html_e('Password', 'give'); ?>
863
+					<?php if (give_logged_in_only($form_id)) { ?>
864 864
 						<span class="give-required-indicator">*</span>
865 865
 					<?php } ?>
866
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
866
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
867 867
 				</label>
868 868
 
869
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
869
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
870 870
 					echo 'required ';
871
-				} ?>give-input" placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" type="password"/>
871
+				} ?>give-input" placeholder="<?php esc_attr_e('Password', 'give'); ?>" type="password"/>
872 872
 			</div>
873 873
 
874 874
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
875 875
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
876
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
877
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
876
+					<?php esc_html_e('Confirm PW', 'give'); ?>
877
+					<?php if (give_logged_in_only($form_id)) { ?>
878 878
 						<span class="give-required-indicator">*</span>
879 879
 					<?php } ?>
880
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
880
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
881 881
 				</label>
882 882
 
883
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
883
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
884 884
 					echo 'required ';
885
-				} ?>give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" type="password"/>
885
+				} ?>give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" type="password"/>
886 886
 			</div>
887
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
887
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
888 888
 		</fieldset>
889 889
 
890
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
890
+		<?php do_action('give_register_fields_after', $form_id); ?>
891 891
 
892 892
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
893 893
 
894
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
894
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
895 895
 
896 896
 	</fieldset>
897 897
 	<?php
898 898
 	echo ob_get_clean();
899 899
 }
900 900
 
901
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
901
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
902 902
 
903 903
 /**
904 904
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -911,79 +911,79 @@  discard block
 block discarded – undo
911 911
  *
912 912
  * @return string
913 913
  */
914
-function give_get_login_fields( $form_id ) {
914
+function give_get_login_fields($form_id) {
915 915
 
916
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
917
-	$show_register_form = give_show_login_register_option( $form_id );
916
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
917
+	$show_register_form = give_show_login_register_option($form_id);
918 918
 
919 919
 	ob_start();
920 920
 	?>
921 921
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
922
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
923
-			if ( ! give_logged_in_only( $form_id ) ) {
924
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
922
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
923
+			if ( ! give_logged_in_only($form_id)) {
924
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
925 925
 			} ?>
926 926
 		</legend>
927
-		<?php if ( $show_register_form == 'both' ) { ?>
927
+		<?php if ($show_register_form == 'both') { ?>
928 928
 			<p class="give-new-account-link">
929
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
930
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
931
-					<?php esc_html_e( 'Register', 'give' );
932
-					if ( ! give_logged_in_only( $form_id ) ) {
933
-						echo ' ' . esc_html__( 'or checkout as a guest', 'give' ) . ' &raquo;';
929
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
930
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
931
+					<?php esc_html_e('Register', 'give');
932
+					if ( ! give_logged_in_only($form_id)) {
933
+						echo ' '.esc_html__('or checkout as a guest', 'give').' &raquo;';
934 934
 					} ?>
935 935
 				</a>
936 936
 			</p>
937 937
 			<p class="give-loading-text">
938
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
938
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
939 939
 		<?php } ?>
940
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
940
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
941 941
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
942 942
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
943
-				<?php esc_html_e( 'Username', 'give' ); ?>
944
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
943
+				<?php esc_html_e('Username', 'give'); ?>
944
+				<?php if (give_logged_in_only($form_id)) { ?>
945 945
 					<span class="give-required-indicator">*</span>
946 946
 				<?php } ?>
947 947
 			</label>
948 948
 
949
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
949
+			<input class="<?php if (give_logged_in_only($form_id)) {
950 950
 				echo 'required ';
951
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"/>
951
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_attr_e('Your username', 'give'); ?>"/>
952 952
 		</div>
953 953
 
954 954
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
955 955
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
956
-				<?php esc_html_e( 'Password', 'give' ); ?>
957
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
956
+				<?php esc_html_e('Password', 'give'); ?>
957
+				<?php if (give_logged_in_only($form_id)) { ?>
958 958
 					<span class="give-required-indicator">*</span>
959 959
 				<?php } ?>
960 960
 			</label>
961
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
961
+			<input class="<?php if (give_logged_in_only($form_id)) {
962 962
 				echo 'required ';
963
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"/>
963
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_attr_e('Your password', 'give'); ?>"/>
964 964
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
965 965
 		</div>
966 966
 
967 967
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
968 968
 			 <span class="give-forgot-password ">
969
-				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset password?' ) ?></a>
969
+				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset password?') ?></a>
970 970
 			 </span>
971 971
 		</div>
972 972
 
973 973
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
974
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
975
-			<?php if ( $show_register_form !== 'login' ) { ?>
976
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
974
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_attr_e('Login', 'give'); ?>"/>
975
+			<?php if ($show_register_form !== 'login') { ?>
976
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
977 977
 			<?php } ?>
978 978
 			<span class="give-loading-animation"></span>
979 979
 		</div>
980
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
980
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
981 981
 	</fieldset><!--end #give-login-fields-->
982 982
 	<?php
983 983
 	echo ob_get_clean();
984 984
 }
985 985
 
986
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
986
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
987 987
 
988 988
 /**
989 989
  * Payment Mode Select
@@ -999,49 +999,49 @@  discard block
 block discarded – undo
999 999
  *
1000 1000
  * @return void
1001 1001
  */
1002
-function give_payment_mode_select( $form_id ) {
1002
+function give_payment_mode_select($form_id) {
1003 1003
 
1004 1004
 	$gateways = give_get_enabled_payment_gateways();
1005 1005
 
1006
-	do_action( 'give_payment_mode_top', $form_id ); ?>
1006
+	do_action('give_payment_mode_top', $form_id); ?>
1007 1007
 
1008 1008
 	<fieldset id="give-payment-mode-select">
1009
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
1009
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
1010 1010
 		<div id="give-payment-mode-wrap">
1011
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1012
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1011
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1012
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1013 1013
 			</legend>
1014 1014
 			<?php
1015 1015
 
1016
-			do_action( 'give_payment_mode_before_gateways' ) ?>
1016
+			do_action('give_payment_mode_before_gateways') ?>
1017 1017
 
1018 1018
 			<ul id="give-gateway-radio-list">
1019
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1020
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1019
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1020
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1021 1021
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1022
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
1023
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
1022
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
1023
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
1024 1024
 					echo '</label></li>';
1025 1025
 				endforeach; ?>
1026 1026
 			</ul>
1027
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
1027
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1028 1028
 		</div>
1029
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1029
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1030 1030
 	</fieldset>
1031 1031
 
1032
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1032
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1033 1033
 
1034 1034
 	<div id="give_purchase_form_wrap">
1035 1035
 
1036
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1036
+		<?php do_action('give_purchase_form', $form_id); ?>
1037 1037
 
1038 1038
 	</div><!-- the checkout fields are loaded into this-->
1039 1039
 
1040
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1040
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1041 1041
 
1042 1042
 }
1043 1043
 
1044
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1044
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1045 1045
 
1046 1046
 
1047 1047
 /**
@@ -1055,36 +1055,36 @@  discard block
 block discarded – undo
1055 1055
  *
1056 1056
  * @return void
1057 1057
  */
1058
-function give_terms_agreement( $form_id ) {
1058
+function give_terms_agreement($form_id) {
1059 1059
 
1060
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1061
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1062
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1060
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1061
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1062
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1063 1063
 
1064
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1064
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1065 1065
 		<fieldset id="give_terms_agreement">
1066
-			<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1066
+			<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1067 1067
 				<?php
1068
-				do_action( 'give_before_terms' );
1069
-				echo wpautop( stripslashes( $terms ) );
1070
-				do_action( 'give_after_terms' );
1068
+				do_action('give_before_terms');
1069
+				echo wpautop(stripslashes($terms));
1070
+				do_action('give_after_terms');
1071 1071
 				?>
1072 1072
 			</div>
1073 1073
 			<div id="give_show_terms">
1074
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1075
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1074
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a>
1075
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1076 1076
 			</div>
1077 1077
 
1078 1078
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1079 1079
 			<label
1080
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label>
1080
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label>
1081 1081
 
1082 1082
 		</fieldset>
1083 1083
 		<?php
1084 1084
 	}
1085 1085
 }
1086 1086
 
1087
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1087
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1088 1088
 
1089 1089
 /**
1090 1090
  * Checkout Final Total
@@ -1097,27 +1097,27 @@  discard block
 block discarded – undo
1097 1097
  *
1098 1098
  * @return void
1099 1099
  */
1100
-function give_checkout_final_total( $form_id ) {
1100
+function give_checkout_final_total($form_id) {
1101 1101
 
1102
-	if ( isset( $_POST['give_total'] ) ) {
1103
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1102
+	if (isset($_POST['give_total'])) {
1103
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1104 1104
 	} else {
1105 1105
 		//default total
1106
-		$total = give_get_default_form_amount( $form_id );
1106
+		$total = give_get_default_form_amount($form_id);
1107 1107
 	}
1108 1108
 	//Only proceed if give_total available
1109
-	if ( empty( $total ) ) {
1109
+	if (empty($total)) {
1110 1110
 		return;
1111 1111
 	}
1112 1112
 	?>
1113 1113
 	<p id="give-final-total-wrap" class="form-wrap ">
1114
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1115
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1114
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1115
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1116 1116
 	</p>
1117 1117
 	<?php
1118 1118
 }
1119 1119
 
1120
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1120
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1121 1121
 
1122 1122
 
1123 1123
 /**
@@ -1129,22 +1129,22 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return void
1131 1131
  */
1132
-function give_checkout_submit( $form_id ) {
1132
+function give_checkout_submit($form_id) {
1133 1133
 	?>
1134 1134
 	<fieldset id="give_purchase_submit">
1135
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1135
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1136 1136
 
1137
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1137
+		<?php give_checkout_hidden_fields($form_id); ?>
1138 1138
 
1139
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1139
+		<?php echo give_checkout_button_purchase($form_id); ?>
1140 1140
 
1141
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1141
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1142 1142
 
1143 1143
 	</fieldset>
1144 1144
 	<?php
1145 1145
 }
1146 1146
 
1147
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1147
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1148 1148
 
1149 1149
 
1150 1150
 /**
@@ -1157,17 +1157,17 @@  discard block
 block discarded – undo
1157 1157
  *
1158 1158
  * @return string
1159 1159
  */
1160
-function give_checkout_button_purchase( $form_id ) {
1160
+function give_checkout_button_purchase($form_id) {
1161 1161
 
1162
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1163
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1162
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1163
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1164 1164
 	ob_start(); ?>
1165 1165
 	<div class="give-submit-button-wrap give-clearfix">
1166 1166
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1167 1167
 		<span class="give-loading-animation"></span>
1168 1168
 	</div>
1169 1169
 	<?php
1170
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1170
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1171 1171
 }
1172 1172
 
1173 1173
 /**
@@ -1180,18 +1180,18 @@  discard block
 block discarded – undo
1180 1180
  *
1181 1181
  * @return void
1182 1182
  */
1183
-function give_agree_to_terms_js( $form_id ) {
1183
+function give_agree_to_terms_js($form_id) {
1184 1184
 
1185
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1185
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1186 1186
 
1187
-	if ( $form_option === 'yes' ) {
1187
+	if ($form_option === 'yes') {
1188 1188
 		?>
1189 1189
 		<script type="text/javascript">
1190 1190
 			jQuery(document).ready(function ($) {
1191
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1191
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1192 1192
 					e.preventDefault();
1193
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1194
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1193
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1194
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1195 1195
 					return false;
1196 1196
 				});
1197 1197
 			});
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 	}
1201 1201
 }
1202 1202
 
1203
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1203
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1204 1204
 
1205 1205
 /**
1206 1206
  * Show Give Goals
@@ -1213,25 +1213,25 @@  discard block
 block discarded – undo
1213 1213
  * @return mixed
1214 1214
  */
1215 1215
 
1216
-function give_show_goal_progress( $form_id, $args ) {
1216
+function give_show_goal_progress($form_id, $args) {
1217 1217
 
1218
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1219
-	$form        = new Give_Donate_Form( $form_id );
1218
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1219
+	$form        = new Give_Donate_Form($form_id);
1220 1220
 	$goal        = $form->goal;
1221
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1221
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1222 1222
 	$income      = $form->get_earnings();
1223
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1224
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1225
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1223
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1224
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1225
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1226 1226
 
1227 1227
 	//Sanity check - respect shortcode args
1228
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1228
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1229 1229
 		return false;
1230 1230
 	}
1231 1231
 
1232 1232
 	//Sanity check - ensure form has goal set to output
1233
-	if ( empty( $form->ID )
1234
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1233
+	if (empty($form->ID)
1234
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1235 1235
 	     || $goal_option !== 'yes'
1236 1236
 	     || $goal == 0
1237 1237
 	) {
@@ -1239,39 +1239,39 @@  discard block
 block discarded – undo
1239 1239
 		return false;
1240 1240
 	}
1241 1241
 
1242
-	$progress = round( ( $income / $goal ) * 100, 2 );
1242
+	$progress = round(($income / $goal) * 100, 2);
1243 1243
 
1244
-	if ( $income >= $goal ) {
1244
+	if ($income >= $goal) {
1245 1245
 		$progress = 100;
1246 1246
 	}
1247 1247
 
1248 1248
 	$output = '<div class="give-goal-progress">';
1249 1249
 
1250 1250
 	//Goal Progress Text
1251
-	if ( ! empty( $show_text ) ) {
1251
+	if ( ! empty($show_text)) {
1252 1252
 
1253 1253
 		$output .= '<div class="raised">';
1254 1254
 
1255
-		if ( $goal_format !== 'percentage' ) {
1255
+		if ($goal_format !== 'percentage') {
1256 1256
 
1257 1257
 			 // Get formatted amount.
1258
-            $income = give_human_format_large_amount( give_format_amount( $income ) );
1259
-            $goal = give_human_format_large_amount( give_format_amount( $goal ) );
1258
+            $income = give_human_format_large_amount(give_format_amount($income));
1259
+            $goal = give_human_format_large_amount(give_format_amount($goal));
1260 1260
 
1261 1261
 			$output .= sprintf(
1262 1262
 				/* translators: 1: amount of income raised 2: goal target ammount */
1263
-				__( '%1$s of %2$s raised', 'give' ),
1264
-				'<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( $income ) ) . '</span>',
1265
-				'<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( $goal ) ) . '</span>'
1263
+				__('%1$s of %2$s raised', 'give'),
1264
+				'<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter($income)).'</span>',
1265
+				'<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter($goal)).'</span>'
1266 1266
 			);
1267 1267
 
1268 1268
 
1269
-		} elseif ( $goal_format == 'percentage' ) {
1269
+		} elseif ($goal_format == 'percentage') {
1270 1270
 
1271 1271
 			$output .= sprintf(
1272 1272
 				/* translators: %s: percentage of the amount raised compared to the goal target */
1273
-				__( '%s%% funded', 'give' ),
1274
-				'<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>'
1273
+				__('%s%% funded', 'give'),
1274
+				'<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>'
1275 1275
 			);
1276 1276
 		}
1277 1277
 
@@ -1280,11 +1280,11 @@  discard block
 block discarded – undo
1280 1280
 	}
1281 1281
 
1282 1282
 	//Goal Progress Bar
1283
-	if ( ! empty( $show_bar ) ) {
1283
+	if ( ! empty($show_bar)) {
1284 1284
 		$output .= '<div class="give-progress-bar">';
1285
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1286
-		if ( ! empty( $color ) ) {
1287
-			$output .= 'background-color:' . $color;
1285
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1286
+		if ( ! empty($color)) {
1287
+			$output .= 'background-color:'.$color;
1288 1288
 		}
1289 1289
 		$output .= '"></span>';
1290 1290
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
 
1293 1293
 	$output .= '</div><!-- /.goal-progress -->';
1294 1294
 
1295
-	echo apply_filters( 'give_goal_output', $output );
1295
+	echo apply_filters('give_goal_output', $output);
1296 1296
 
1297 1297
 	return false;
1298 1298
 
1299 1299
 }
1300 1300
 
1301
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1301
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1302 1302
 
1303 1303
 /**
1304 1304
  * Adds Actions to Render Form Content
@@ -1310,19 +1310,19 @@  discard block
 block discarded – undo
1310 1310
  *
1311 1311
  * @return void
1312 1312
  */
1313
-function give_form_content( $form_id, $args ) {
1313
+function give_form_content($form_id, $args) {
1314 1314
 
1315
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1315
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1316 1316
 		? $args['show_content']
1317
-		: get_post_meta( $form_id, '_give_content_option', true );
1317
+		: get_post_meta($form_id, '_give_content_option', true);
1318 1318
 
1319
-	if ( $show_content !== 'none' ) {
1319
+	if ($show_content !== 'none') {
1320 1320
 		//add action according to value
1321
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1321
+		add_action($show_content, 'give_form_display_content', 10, 2);
1322 1322
 	}
1323 1323
 }
1324 1324
 
1325
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1325
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1326 1326
 
1327 1327
 /**
1328 1328
  * Renders Post Form Content
@@ -1334,24 +1334,24 @@  discard block
 block discarded – undo
1334 1334
  * @return void
1335 1335
  * @since      1.0
1336 1336
  */
1337
-function give_form_display_content( $form_id, $args ) {
1337
+function give_form_display_content($form_id, $args) {
1338 1338
 
1339
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1340
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1339
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1340
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1341 1341
 		? $args['show_content']
1342
-		: get_post_meta( $form_id, '_give_content_option', true );
1342
+		: get_post_meta($form_id, '_give_content_option', true);
1343 1343
 
1344
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1345
-		$content = apply_filters( 'the_content', $content );
1344
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1345
+		$content = apply_filters('the_content', $content);
1346 1346
 	}
1347 1347
 
1348
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1348
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1349 1349
 
1350
-	echo apply_filters( 'give_form_content_output', $output );
1350
+	echo apply_filters('give_form_content_output', $output);
1351 1351
 
1352 1352
 	//remove action to prevent content output on addition forms on page
1353 1353
 	//@see: https://github.com/WordImpress/Give/issues/634
1354
-	remove_action( $show_content, 'give_form_display_content' );
1354
+	remove_action($show_content, 'give_form_display_content');
1355 1355
 }
1356 1356
 
1357 1357
 
@@ -1364,16 +1364,16 @@  discard block
 block discarded – undo
1364 1364
  *
1365 1365
  * @return void
1366 1366
  */
1367
-function give_checkout_hidden_fields( $form_id ) {
1367
+function give_checkout_hidden_fields($form_id) {
1368 1368
 
1369
-	do_action( 'give_hidden_fields_before', $form_id );
1370
-	if ( is_user_logged_in() ) { ?>
1369
+	do_action('give_hidden_fields_before', $form_id);
1370
+	if (is_user_logged_in()) { ?>
1371 1371
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1372 1372
 	<?php } ?>
1373 1373
 	<input type="hidden" name="give_action" value="purchase"/>
1374
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1374
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1375 1375
 	<?php
1376
-	do_action( 'give_hidden_fields_after', $form_id );
1376
+	do_action('give_hidden_fields_after', $form_id);
1377 1377
 
1378 1378
 }
1379 1379
 
@@ -1388,20 +1388,20 @@  discard block
 block discarded – undo
1388 1388
  *
1389 1389
  * @return string $content Filtered content
1390 1390
  */
1391
-function give_filter_success_page_content( $content ) {
1391
+function give_filter_success_page_content($content) {
1392 1392
 
1393 1393
 	global $give_options;
1394 1394
 
1395
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1396
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1397
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1395
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1396
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1397
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1398 1398
 		}
1399 1399
 	}
1400 1400
 
1401 1401
 	return $content;
1402 1402
 }
1403 1403
 
1404
-add_filter( 'the_content', 'give_filter_success_page_content' );
1404
+add_filter('the_content', 'give_filter_success_page_content');
1405 1405
 
1406 1406
 
1407 1407
 /**
@@ -1413,14 +1413,14 @@  discard block
 block discarded – undo
1413 1413
 
1414 1414
 function give_test_mode_frontend_warning() {
1415 1415
 
1416
-	$test_mode = give_get_option( 'test_mode' );
1416
+	$test_mode = give_get_option('test_mode');
1417 1417
 
1418
-	if ( $test_mode == 'on' ) {
1419
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1418
+	if ($test_mode == 'on') {
1419
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1420 1420
 	}
1421 1421
 }
1422 1422
 
1423
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1423
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1424 1424
 
1425 1425
 
1426 1426
 /**
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
  * @return string
1437 1437
  */
1438 1438
 
1439
-function give_members_only_form( $final_output, $args ) {
1439
+function give_members_only_form($final_output, $args) {
1440 1440
 
1441
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1441
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1442 1442
 
1443 1443
 	//Sanity Check: Must have form_id & not be logged in
1444
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1444
+	if (empty($form_id) || is_user_logged_in()) {
1445 1445
 		return $final_output;
1446 1446
 	}
1447 1447
 
1448 1448
 	//Logged in only and Register / Login set to none
1449
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1449
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1450 1450
 
1451
-		$final_output = give_output_error( esc_html__( 'Please login in order to complete your donation.', 'give' ), false );
1451
+		$final_output = give_output_error(esc_html__('Please login in order to complete your donation.', 'give'), false);
1452 1452
 
1453
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1453
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1454 1454
 
1455 1455
 	}
1456 1456
 
@@ -1458,4 +1458,4 @@  discard block
 block discarded – undo
1458 1458
 
1459 1459
 }
1460 1460
 
1461
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1461
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
17 17
  *
18 18
  * @since 1.0
19 19
  */
20
-class Give_Forms_Widget extends WP_Widget{
20
+class Give_Forms_Widget extends WP_Widget {
21 21
 	/**
22 22
 	 * The widget class name
23 23
 	 *
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * Instantiate the class
30 30
 	 */
31
-	public function __construct(){
32
-		$this->self = get_class( $this );
31
+	public function __construct() {
32
+		$this->self = get_class($this);
33 33
 
34 34
 		parent::__construct(
35
-			strtolower( $this->self ),
36
-			esc_html__( 'Give - Donation Form', 'give' ),
35
+			strtolower($this->self),
36
+			esc_html__('Give - Donation Form', 'give'),
37 37
 			array(
38
-				'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
38
+				'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
39 39
 			)
40 40
 		);
41 41
 
42
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
43
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
42
+		add_action('widgets_init', array($this, 'widget_init'));
43
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
44 44
 	}
45 45
 
46 46
 	/**
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return void
52 52
 	 */
53
-	public function admin_widget_scripts( $hook ){
53
+	public function admin_widget_scripts($hook) {
54 54
 		// Directories of assets
55
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
56
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
57
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
55
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
56
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
57
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
58 58
 
59 59
 		// Use minified libraries if SCRIPT_DEBUG is turned off
60
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
60
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
61 61
 
62 62
 		// Widget Script
63
-		if ( $hook == 'widgets.php' ) {
63
+		if ($hook == 'widgets.php') {
64 64
 
65
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
65
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
66 66
 
67
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
67
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
68 68
 
69
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
69
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
70 70
 		}
71 71
 	}
72 72
 
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 	 *                        before_widget, and after_widget.
78 78
 	 * @param array $instance The settings for the particular instance of the widget.
79 79
 	 */
80
-	public function widget( $args, $instance ){
81
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
82
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
80
+	public function widget($args, $instance) {
81
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
82
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
83 83
 
84 84
 		echo $args['before_widget'];
85 85
 
86
-		do_action( 'give_before_forms_widget' );
86
+		do_action('give_before_forms_widget');
87 87
 
88
-		echo $title ? $args['before_title'] . $title . $args['after_title'] : '';
88
+		echo $title ? $args['before_title'].$title.$args['after_title'] : '';
89 89
 
90
-		give_get_donation_form( $instance );
90
+		give_get_donation_form($instance);
91 91
 
92 92
 		echo $args['after_widget'];
93 93
 
94
-		do_action( 'give_after_forms_widget' );
94
+		do_action('give_after_forms_widget');
95 95
 	}
96 96
 
97 97
 	/**
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @return string
103 103
 	 */
104
-	public function form( $instance ){
104
+	public function form($instance) {
105 105
 		$defaults = array(
106 106
 			'title'        => '',
107 107
 			'id'           => '',
108 108
 			'float_labels' => '',
109 109
 		);
110 110
 
111
-		$instance = wp_parse_args( (array) $instance, $defaults );
111
+		$instance = wp_parse_args((array) $instance, $defaults);
112 112
 
113 113
 		// Query Give Forms
114 114
 		$args = array(
115 115
 			'post_type'      => 'give_forms',
116
-			'posts_per_page' => - 1,
116
+			'posts_per_page' => -1,
117 117
 			'post_status'    => 'publish',
118 118
 		);
119 119
 
120
-		$give_forms = get_posts( $args );
120
+		$give_forms = get_posts($args);
121 121
 
122 122
 		// Widget: Title
123 123
 
124 124
 		?><p>
125
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label>
126
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /><br>
127
-			<small><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
125
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label>
126
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" /><br>
127
+			<small><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small>
128 128
 		</p><?php
129 129
 
130 130
 		// Widget: Give Form
131 131
 
132 132
 		?><p>
133
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php
133
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php
134 134
 				printf(
135 135
 					/* translators: %s: form singular label */
136
-					esc_html__( 'Give %s:', 'give' ),
136
+					esc_html__('Give %s:', 'give'),
137 137
 					give_get_forms_label_singular()
138 138
 				);
139 139
 			?></label>
140
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
141
-				<option value="current"><?php esc_html_e( '— Select —', 'give' ); ?></option>
142
-				<?php foreach ( $give_forms as $give_form ) { ?>
143
-					<option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
140
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
141
+				<option value="current"><?php esc_html_e('— Select —', 'give'); ?></option>
142
+				<?php foreach ($give_forms as $give_form) { ?>
143
+					<option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
144 144
 				<?php } ?>
145 145
 			</select><br>
146
-			<small><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
146
+			<small><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small>
147 147
 		</p><?php
148 148
 
149 149
 		// Widget: Floating Labels
150 150
 
151 151
 		?><p>
152
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label>
153
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
154
-				<option value="" <?php selected( esc_attr( $instance['float_labels'] ), '' ) ?>><?php esc_html_e( '- Select -', 'give' ); ?></option>
155
-				<option value="enabled" <?php selected( esc_attr( $instance['float_labels'] ), 'enabled' ) ?>><?php esc_html_e( 'Enabled', 'give' ); ?></option>
156
-				<option value="disabled" <?php selected( esc_attr( $instance['float_labels'] ), 'disabled' ) ?>><?php esc_html_e( 'Disabled', 'give' ); ?></option>
152
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label>
153
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
154
+				<option value="" <?php selected(esc_attr($instance['float_labels']), '') ?>><?php esc_html_e('- Select -', 'give'); ?></option>
155
+				<option value="enabled" <?php selected(esc_attr($instance['float_labels']), 'enabled') ?>><?php esc_html_e('Enabled', 'give'); ?></option>
156
+				<option value="disabled" <?php selected(esc_attr($instance['float_labels']), 'disabled') ?>><?php esc_html_e('Disabled', 'give'); ?></option>
157 157
 			</select><br>
158 158
 			<small><?php
159 159
 				printf(
160 160
 					/* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */
161
-					__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
162
-					esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' )
161
+					__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
162
+					esc_url('http://bradfrost.com/blog/post/float-label-pattern/')
163 163
 				);
164 164
 			?></small>
165 165
 		</p><?php
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return void
172 172
 	 */
173
-	function widget_init(){
174
-		register_widget( $this->self );
173
+	function widget_init() {
174
+		register_widget($this->self);
175 175
 	}
176 176
 
177 177
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return array
184 184
 	 */
185
-	public function update( $new_instance, $old_instance ){
185
+	public function update($new_instance, $old_instance) {
186 186
 		$this->flush_widget_cache();
187 187
 
188 188
 		return $new_instance;
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return void
195 195
 	 */
196
-	public function flush_widget_cache(){
197
-		wp_cache_delete( $this->self, 'widget' );
196
+	public function flush_widget_cache() {
197
+		wp_cache_delete($this->self, 'widget');
198 198
 	}
199 199
 }
200 200
 
Please login to merge, or discard this patch.
includes/ajax-functions.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -408,30 +408,30 @@
 block discarded – undo
408 408
 		die( '-2' );
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo esc_html__( 'n/a', 'give' );
413
-    } else {
414
-        // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
416
-
417
-        // Payment meta.
418
-        $payment_meta = $payment->get_meta();
419
-
420
-
421
-        // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
423
-            'id'                => $form_id,
424
-            'name'              => 'give-variable-price',
425
-            'chosen'            => true,
426
-            'show_option_all'   => '',
427
-            'selected'          => $payment_meta['price_id'],
428
-        );
429
-
430
-        // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
-    }
433
-
434
-    give_die();
411
+	if ( ! give_has_variable_prices( $form_id ) ) {
412
+		echo esc_html__( 'n/a', 'give' );
413
+	} else {
414
+		// Payment object.
415
+		$payment = new Give_Payment( $payment_id );
416
+
417
+		// Payment meta.
418
+		$payment_meta = $payment->get_meta();
419
+
420
+
421
+		// Variable price dropdown options.
422
+		$variable_price_dropdown_option =  array(
423
+			'id'                => $form_id,
424
+			'name'              => 'give-variable-price',
425
+			'chosen'            => true,
426
+			'show_option_all'   => '',
427
+			'selected'          => $payment_meta['price_id'],
428
+		);
429
+
430
+		// Render variable prices select tag html.
431
+		give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
432
+	}
433
+
434
+	give_die();
435 435
 }
436 436
 
437 437
 add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
 function give_test_ajax_works() {
26 26
 
27 27
 	// Check if the Airplane Mode plugin is installed
28
-	if ( class_exists( 'Airplane_Mode_Core' ) ) {
28
+	if (class_exists('Airplane_Mode_Core')) {
29 29
 
30 30
 		$airplane = Airplane_Mode_Core::getInstance();
31 31
 
32
-		if ( method_exists( $airplane, 'enabled' ) ) {
32
+		if (method_exists($airplane, 'enabled')) {
33 33
 
34
-			if ( $airplane->enabled() ) {
34
+			if ($airplane->enabled()) {
35 35
 				return true;
36 36
 			}
37 37
 
38 38
 		} else {
39 39
 
40
-			if ( $airplane->check_status() == 'on' ) {
40
+			if ($airplane->check_status() == 'on') {
41 41
 				return true;
42 42
 			}
43 43
 		}
44 44
 	}
45 45
 
46
-	add_filter( 'block_local_requests', '__return_false' );
46
+	add_filter('block_local_requests', '__return_false');
47 47
 
48
-	if ( get_transient( '_give_ajax_works' ) ) {
48
+	if (get_transient('_give_ajax_works')) {
49 49
 		return true;
50 50
 	}
51 51
 
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 		)
58 58
 	);
59 59
 
60
-	$ajax  = wp_remote_post( give_get_ajax_url(), $params );
60
+	$ajax  = wp_remote_post(give_get_ajax_url(), $params);
61 61
 	$works = true;
62 62
 
63
-	if ( is_wp_error( $ajax ) ) {
63
+	if (is_wp_error($ajax)) {
64 64
 
65 65
 		$works = false;
66 66
 
67 67
 	} else {
68 68
 
69
-		if ( empty( $ajax['response'] ) ) {
69
+		if (empty($ajax['response'])) {
70 70
 			$works = false;
71 71
 		}
72 72
 
73
-		if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) {
73
+		if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) {
74 74
 			$works = false;
75 75
 		}
76 76
 
77
-		if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) {
77
+		if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) {
78 78
 			$works = false;
79 79
 		}
80 80
 
81
-		if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) {
81
+		if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) {
82 82
 			$works = false;
83 83
 		}
84 84
 
85 85
 	}
86 86
 
87
-	if ( $works ) {
88
-		set_transient( '_give_ajax_works', '1', DAY_IN_SECONDS );
87
+	if ($works) {
88
+		set_transient('_give_ajax_works', '1', DAY_IN_SECONDS);
89 89
 	}
90 90
 
91 91
 	return $works;
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  * @return string
100 100
  */
101 101
 function give_get_ajax_url() {
102
-	$scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin';
102
+	$scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin';
103 103
 
104 104
 	$current_url = give_get_current_page_url();
105
-	$ajax_url    = admin_url( 'admin-ajax.php', $scheme );
105
+	$ajax_url    = admin_url('admin-ajax.php', $scheme);
106 106
 
107
-	if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) {
108
-		$ajax_url = preg_replace( '/^http/', 'https', $ajax_url );
107
+	if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) {
108
+		$ajax_url = preg_replace('/^http/', 'https', $ajax_url);
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_ajax_url', $ajax_url );
111
+	return apply_filters('give_ajax_url', $ajax_url);
112 112
 }
113 113
 
114 114
 /**
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
  * @return void
119 119
  */
120 120
 function give_load_checkout_login_fields() {
121
-	do_action( 'give_purchase_form_login_fields' );
121
+	do_action('give_purchase_form_login_fields');
122 122
 	give_die();
123 123
 }
124 124
 
125
-add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' );
125
+add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields');
126 126
 
127 127
 /**
128 128
  * Load Checkout Fields
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
  * @return void
132 132
  */
133 133
 function give_load_checkout_fields() {
134
-	$form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : '';
134
+	$form_id = isset($_POST['form_id']) ? $_POST['form_id'] : '';
135 135
 
136 136
 	ob_start();
137 137
 
138
-	do_action( 'give_purchase_form_register_login_fields', $form_id );
138
+	do_action('give_purchase_form_register_login_fields', $form_id);
139 139
 
140 140
 	$fields = ob_get_clean();
141 141
 
142
-	wp_send_json( array(
143
-		'fields' => wp_json_encode( $fields ),
144
-		'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ),
145
-	) );
142
+	wp_send_json(array(
143
+		'fields' => wp_json_encode($fields),
144
+		'submit' => wp_json_encode(give_checkout_button_purchase($form_id)),
145
+	));
146 146
 }
147 147
 
148
-add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' );
149
-add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' );
148
+add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields');
149
+add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields');
150 150
 
151 151
 /**
152 152
  * Get Form Title via AJAX (used only in WordPress Admin)
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
  * @return void
156 156
  */
157 157
 function give_ajax_get_form_title() {
158
-	if ( isset( $_POST['form_id'] ) ) {
159
-		$title = get_the_title( $_POST['form_id'] );
160
-		if ( $title ) {
158
+	if (isset($_POST['form_id'])) {
159
+		$title = get_the_title($_POST['form_id']);
160
+		if ($title) {
161 161
 			echo $title;
162 162
 		} else {
163 163
 			echo 'fail';
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	give_die();
167 167
 }
168 168
 
169
-add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' );
170
-add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' );
169
+add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title');
170
+add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title');
171 171
 
172 172
 /**
173 173
  * Retrieve a states drop down
@@ -177,23 +177,23 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function give_ajax_get_states_field() {
179 179
 
180
-	if ( empty( $_POST['country'] ) ) {
180
+	if (empty($_POST['country'])) {
181 181
 		$_POST['country'] = give_get_country();
182 182
 	}
183
-	$states = give_get_states( $_POST['country'] );
183
+	$states = give_get_states($_POST['country']);
184 184
 
185
-	if ( ! empty( $states ) ) {
185
+	if ( ! empty($states)) {
186 186
 
187 187
 		$args = array(
188 188
 			'name'             => $_POST['field_name'],
189 189
 			'id'               => $_POST['field_name'],
190
-			'class'            => $_POST['field_name'] . '  give-select',
191
-			'options'          => give_get_states( $_POST['country'] ),
190
+			'class'            => $_POST['field_name'].'  give-select',
191
+			'options'          => give_get_states($_POST['country']),
192 192
 			'show_option_all'  => false,
193 193
 			'show_option_none' => false
194 194
 		);
195 195
 
196
-		$response = Give()->html->select( $args );
196
+		$response = Give()->html->select($args);
197 197
 
198 198
 	} else {
199 199
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 	give_die();
206 206
 }
207 207
 
208
-add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' );
209
-add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' );
208
+add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field');
209
+add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field');
210 210
 
211 211
 /**
212 212
  * Retrieve a states drop down
@@ -217,17 +217,17 @@  discard block
 block discarded – undo
217 217
 function give_ajax_form_search() {
218 218
 	global $wpdb;
219 219
 
220
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
220
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
221 221
 	$results = array();
222
-	if ( current_user_can( 'edit_give_forms' ) ) {
223
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" );
222
+	if (current_user_can('edit_give_forms')) {
223
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50");
224 224
 	} else {
225
-		$items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" );
225
+		$items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50");
226 226
 	}
227 227
 
228
-	if ( $items ) {
228
+	if ($items) {
229 229
 
230
-		foreach ( $items as $item ) {
230
+		foreach ($items as $item) {
231 231
 
232 232
 			$results[] = array(
233 233
 				'id'   => $item->ID,
@@ -239,18 +239,18 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$items[] = array(
241 241
 			'id'   => 0,
242
-			'name' => esc_html__( 'No results found', 'give' )
242
+			'name' => esc_html__('No results found', 'give')
243 243
 		);
244 244
 
245 245
 	}
246 246
 
247
-	echo json_encode( $results );
247
+	echo json_encode($results);
248 248
 
249 249
 	give_die();
250 250
 }
251 251
 
252
-add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' );
253
-add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' );
252
+add_action('wp_ajax_give_form_search', 'give_ajax_form_search');
253
+add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search');
254 254
 
255 255
 /**
256 256
  * Search the donors database via Ajax
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 function give_ajax_donor_search() {
262 262
 	global $wpdb;
263 263
 
264
-	$search  = esc_sql( sanitize_text_field( $_GET['s'] ) );
264
+	$search  = esc_sql(sanitize_text_field($_GET['s']));
265 265
 	$results = array();
266
-	if ( ! current_user_can( 'view_give_reports' ) ) {
266
+	if ( ! current_user_can('view_give_reports')) {
267 267
 		$donors = array();
268 268
 	} else {
269
-		$donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" );
269
+		$donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50");
270 270
 	}
271 271
 
272
-	if ( $donors ) {
272
+	if ($donors) {
273 273
 
274
-		foreach ( $donors as $donor ) {
274
+		foreach ($donors as $donor) {
275 275
 
276 276
 			$results[] = array(
277 277
 				'id'   => $donor->id,
278
-				'name' => $donor->name . '(' . $donor->email . ')'
278
+				'name' => $donor->name.'('.$donor->email.')'
279 279
 			);
280 280
 		}
281 281
 
@@ -283,17 +283,17 @@  discard block
 block discarded – undo
283 283
 
284 284
 		$donors[] = array(
285 285
 			'id'   => 0,
286
-			'name' => esc_html__( 'No results found', 'give' )
286
+			'name' => esc_html__('No results found', 'give')
287 287
 		);
288 288
 
289 289
 	}
290 290
 
291
-	echo json_encode( $results );
291
+	echo json_encode($results);
292 292
 
293 293
 	give_die();
294 294
 }
295 295
 
296
-add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' );
296
+add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search');
297 297
 
298 298
 
299 299
 /**
@@ -304,42 +304,42 @@  discard block
 block discarded – undo
304 304
  */
305 305
 function give_ajax_search_users() {
306 306
 
307
-	if ( current_user_can( 'manage_give_settings' ) ) {
307
+	if (current_user_can('manage_give_settings')) {
308 308
 
309
-		$search_query = trim( $_POST['user_name'] );
310
-		$exclude      = trim( $_POST['exclude'] );
309
+		$search_query = trim($_POST['user_name']);
310
+		$exclude      = trim($_POST['exclude']);
311 311
 
312 312
 		$get_users_args = array(
313 313
 			'number' => 9999,
314
-			'search' => $search_query . '*'
314
+			'search' => $search_query.'*'
315 315
 		);
316 316
 
317
-		if ( ! empty( $exclude ) ) {
318
-			$exclude_array             = explode( ',', $exclude );
317
+		if ( ! empty($exclude)) {
318
+			$exclude_array             = explode(',', $exclude);
319 319
 			$get_users_args['exclude'] = $exclude_array;
320 320
 		}
321 321
 
322
-		$get_users_args = apply_filters( 'give_search_users_args', $get_users_args );
322
+		$get_users_args = apply_filters('give_search_users_args', $get_users_args);
323 323
 
324
-		$found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query );
324
+		$found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query);
325 325
 
326 326
 		$user_list = '<ul>';
327
-		if ( $found_users ) {
328
-			foreach ( $found_users as $user ) {
329
-				$user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>';
327
+		if ($found_users) {
328
+			foreach ($found_users as $user) {
329
+				$user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>';
330 330
 			}
331 331
 		} else {
332
-			$user_list .= '<li>' . esc_html__( 'No users found', 'give' ) . '</li>';
332
+			$user_list .= '<li>'.esc_html__('No users found', 'give').'</li>';
333 333
 		}
334 334
 		$user_list .= '</ul>';
335 335
 
336
-		echo json_encode( array( 'results' => $user_list ) );
336
+		echo json_encode(array('results' => $user_list));
337 337
 
338 338
 	}
339 339
 	die();
340 340
 }
341 341
 
342
-add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' );
342
+add_action('wp_ajax_give_search_users', 'give_ajax_search_users');
343 343
 
344 344
 
345 345
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  */
351 351
 function give_check_for_form_price_variations() {
352 352
 
353
-	if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
354
-		die( '-1' );
353
+	if ( ! current_user_can('edit_give_forms', get_current_user_id())) {
354
+		die('-1');
355 355
 	}
356 356
 
357
-	$form_id = intval( $_POST['form_id'] );
358
-	$form    = get_post( $form_id );
357
+	$form_id = intval($_POST['form_id']);
358
+	$form    = get_post($form_id);
359 359
 
360
-	if ( 'give_forms' != $form->post_type ) {
361
-		die( '-2' );
360
+	if ('give_forms' != $form->post_type) {
361
+		die('-2');
362 362
 	}
363 363
 
364
-	if ( give_has_variable_prices( $form_id ) ) {
365
-		$variable_prices = give_get_variable_prices( $form_id );
364
+	if (give_has_variable_prices($form_id)) {
365
+		$variable_prices = give_get_variable_prices($form_id);
366 366
 
367
-		if ( $variable_prices ) {
367
+		if ($variable_prices) {
368 368
 			$ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">';
369 369
 
370
-			if ( isset( $_POST['all_prices'] ) ) {
371
-				$ajax_response .= '<option value="">' . esc_html__( 'All Levels', 'give' ) . '</option>';
370
+			if (isset($_POST['all_prices'])) {
371
+				$ajax_response .= '<option value="">'.esc_html__('All Levels', 'give').'</option>';
372 372
 			}
373 373
 
374
-			foreach ( $variable_prices as $key => $price ) {
374
+			foreach ($variable_prices as $key => $price) {
375 375
 
376
-				$level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) );
376
+				$level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount']));
377 377
 				
378
-				$ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>';
378
+				$ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>';
379 379
 			}
380 380
 			$ajax_response .= '</select>';
381 381
 			echo $ajax_response;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 	give_die();
387 387
 }
388 388
 
389
-add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' );
389
+add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations');
390 390
 
391 391
 
392 392
 /**
@@ -396,30 +396,30 @@  discard block
 block discarded – undo
396 396
  * @return void
397 397
  */
398 398
 function give_check_for_form_price_variations_html() {
399
-	if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) {
400
-		die( '-1' );
399
+	if ( ! current_user_can('edit_give_payments', get_current_user_id())) {
400
+		die('-1');
401 401
 	}
402 402
 
403
-	$form_id = intval( $_POST['form_id'] );
404
-	$payment_id = intval( $_POST['payment_id'] );
405
-	$form    = get_post( $form_id );
403
+	$form_id = intval($_POST['form_id']);
404
+	$payment_id = intval($_POST['payment_id']);
405
+	$form    = get_post($form_id);
406 406
 
407
-	if ( 'give_forms' != $form->post_type ) {
408
-		die( '-2' );
407
+	if ('give_forms' != $form->post_type) {
408
+		die('-2');
409 409
 	}
410 410
 
411
-    if ( ! give_has_variable_prices( $form_id ) ) {
412
-        echo esc_html__( 'n/a', 'give' );
411
+    if ( ! give_has_variable_prices($form_id)) {
412
+        echo esc_html__('n/a', 'give');
413 413
     } else {
414 414
         // Payment object.
415
-        $payment = new Give_Payment( $payment_id );
415
+        $payment = new Give_Payment($payment_id);
416 416
 
417 417
         // Payment meta.
418 418
         $payment_meta = $payment->get_meta();
419 419
 
420 420
 
421 421
         // Variable price dropdown options.
422
-        $variable_price_dropdown_option =  array(
422
+        $variable_price_dropdown_option = array(
423 423
             'id'                => $form_id,
424 424
             'name'              => 'give-variable-price',
425 425
             'chosen'            => true,
@@ -428,10 +428,10 @@  discard block
 block discarded – undo
428 428
         );
429 429
 
430 430
         // Render variable prices select tag html.
431
-        give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
431
+        give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
432 432
     }
433 433
 
434 434
     give_die();
435 435
 }
436 436
 
437
-add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' );
437
+add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html');
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the purchase data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the purchase page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_html__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_html__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_html__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_html__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,56 +40,56 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60 60
 		/* translators: %s: form settings url */
61
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url );
62
-		echo wpautop( stripslashes( $offline_instructions ) );
61
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url);
62
+		echo wpautop(stripslashes($offline_instructions));
63 63
 		?>
64 64
 	</fieldset>
65
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
65
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
66 66
 	<?php
67 67
 	echo ob_get_clean();
68 68
 }
69 69
 
70
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
70
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
71 71
 
72 72
 /**
73 73
  * Give Offline Billing Field
74 74
  *
75 75
  * @param $form_id
76 76
  */
77
-function give_offline_billing_fields( $form_id ) {
77
+function give_offline_billing_fields($form_id) {
78 78
 	//Enable Default CC fields (billing info)
79
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
80
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
79
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
80
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
81 81
 
82
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
82
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
83 83
 
84 84
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
85
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
86
-		give_default_cc_address_fields( $form_id );
87
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
-		give_default_cc_address_fields( $form_id );
85
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
86
+		give_default_cc_address_fields($form_id);
87
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
88
+		give_default_cc_address_fields($form_id);
89 89
 	}
90 90
 }
91 91
 
92
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
92
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
93 93
 
94 94
 /**
95 95
  * Process the payment
@@ -100,16 +100,16 @@  discard block
 block discarded – undo
100 100
  *
101 101
  * @return void
102 102
  */
103
-function give_offline_process_payment( $purchase_data ) {
103
+function give_offline_process_payment($purchase_data) {
104 104
 
105
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
105
+	$purchase_summary = give_get_purchase_summary($purchase_data);
106 106
 
107 107
 	// setup the payment details
108 108
 	$payment_data = array(
109 109
 		'price'           => $purchase_data['price'],
110 110
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
111
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
112
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
111
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
112
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
113 113
 		'date'            => $purchase_data['date'],
114 114
 		'user_email'      => $purchase_data['user_email'],
115 115
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	// record the pending payment
124
-	$payment = give_insert_payment( $payment_data );
124
+	$payment = give_insert_payment($payment_data);
125 125
 
126
-	if ( $payment ) {
127
-		give_offline_send_admin_notice( $payment );
128
-		give_offline_send_donor_instructions( $payment );
126
+	if ($payment) {
127
+		give_offline_send_admin_notice($payment);
128
+		give_offline_send_donor_instructions($payment);
129 129
 		give_send_to_success_page();
130 130
 	} else {
131 131
 		// if errors are present, send the user back to the donation form so they can be corrected
132
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
132
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
133 133
 	}
134 134
 
135 135
 }
136 136
 
137
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
137
+add_action('give_gateway_offline', 'give_offline_process_payment');
138 138
 
139 139
 
140 140
 /**
@@ -147,47 +147,47 @@  discard block
 block discarded – undo
147 147
  * @since       1.0
148 148
  * @return void
149 149
  */
150
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
150
+function give_offline_send_donor_instructions($payment_id = 0) {
151 151
 
152
-	$payment_data                      = give_get_payment_meta( $payment_id );
153
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
152
+	$payment_data                      = give_get_payment_meta($payment_id);
153
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
154 154
 
155 155
 	//Customize email content depending on whether the single form has been customized
156
-	$email_content = give_get_option( 'global_offline_donation_email' );
156
+	$email_content = give_get_option('global_offline_donation_email');
157 157
 
158
-	if ( $post_offline_customization_option === 'yes' ) {
159
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
158
+	if ($post_offline_customization_option === 'yes') {
159
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
160 160
 	}
161 161
 
162
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
163
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
162
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
163
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
164 164
 
165
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
166
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
165
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
166
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
167 167
 
168
-	$to_email = give_get_payment_user_email( $payment_id );
168
+	$to_email = give_get_payment_user_email($payment_id);
169 169
 
170
-	$subject = give_get_option( 'offline_donation_subject', esc_html__( 'Offline Donation Instructions', 'give' ) );
171
-	if ( $post_offline_customization_option === 'yes' ) {
172
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
170
+	$subject = give_get_option('offline_donation_subject', esc_html__('Offline Donation Instructions', 'give'));
171
+	if ($post_offline_customization_option === 'yes') {
172
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
173 173
 	}
174 174
 
175
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
176
-	$subject = give_do_email_tags( $subject, $payment_id );
175
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
176
+	$subject = give_do_email_tags($subject, $payment_id);
177 177
 
178
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
179
-	$message     = give_do_email_tags( $email_content, $payment_id );
178
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
179
+	$message     = give_do_email_tags($email_content, $payment_id);
180 180
 
181 181
 	$emails = Give()->emails;
182 182
 
183
-	$emails->__set( 'from_name', $from_name );
184
-	$emails->__set( 'from_email', $from_email );
185
-	$emails->__set( 'heading', esc_html__( 'Offline Donation Instructions', 'give' ) );
183
+	$emails->__set('from_name', $from_name);
184
+	$emails->__set('from_email', $from_email);
185
+	$emails->__set('heading', esc_html__('Offline Donation Instructions', 'give'));
186 186
 
187
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
188
-	$emails->__set( 'headers', $headers );
187
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
188
+	$emails->__set('headers', $headers);
189 189
 
190
-	$emails->send( $to_email, $subject, $message, $attachments );
190
+	$emails->send($to_email, $subject, $message, $attachments);
191 191
 
192 192
 }
193 193
 
@@ -204,50 +204,50 @@  discard block
 block discarded – undo
204 204
  * @return void
205 205
  *
206 206
  */
207
-function give_offline_send_admin_notice( $payment_id = 0 ) {
207
+function give_offline_send_admin_notice($payment_id = 0) {
208 208
 
209 209
 	/* Send an email notification to the admin */
210 210
 	$admin_email = give_get_admin_notice_emails();
211
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
211
+	$user_info   = give_get_payment_meta_user_info($payment_id);
212 212
 
213
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
214
-		$user_data = get_userdata( $user_info['id'] );
213
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
214
+		$user_data = get_userdata($user_info['id']);
215 215
 		$name      = $user_data->display_name;
216
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
217
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
216
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
217
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
218 218
 	} else {
219 219
 		$name = $user_info['email'];
220 220
 	}
221 221
 
222
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
222
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
223 223
 
224
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_html__( 'New Pending Donation', 'give' ), $payment_id );
224
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_html__('New Pending Donation', 'give'), $payment_id);
225 225
 
226
-	$admin_message = esc_html__( 'Dear Admin,', 'give' ) . "\n\n";
227
-	$admin_message .= esc_html__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
228
-	$admin_message .= esc_html__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
226
+	$admin_message = esc_html__('Dear Admin,', 'give')."\n\n";
227
+	$admin_message .= esc_html__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
228
+	$admin_message .= esc_html__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
229 229
 
230 230
 
231
-	$admin_message .= '<strong>' . esc_html__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
232
-	$admin_message .= '<strong>' . esc_html__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
231
+	$admin_message .= '<strong>'.esc_html__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
232
+	$admin_message .= '<strong>'.esc_html__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
233 233
 
234 234
 	$admin_message .= sprintf(
235 235
 		'<a href="%1$s">%2$s</a>',
236
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
237
-		esc_html__( 'Click Here to View and/or Update Donation Details', 'give' )
238
-	) . "\n\n";
236
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
237
+		esc_html__('Click Here to View and/or Update Donation Details', 'give')
238
+	)."\n\n";
239 239
 
240
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
241
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
242
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
240
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
241
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
242
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
243 243
 
244 244
 	//Send Email
245 245
 	$emails = Give()->emails;
246
-	if ( ! empty( $admin_headers ) ) {
247
-		$emails->__set( 'headers', $admin_headers );
246
+	if ( ! empty($admin_headers)) {
247
+		$emails->__set('headers', $admin_headers);
248 248
 	}
249 249
 
250
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
250
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
251 251
 
252 252
 }
253 253
 
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
  * @since  1.0
259 259
  * @return array
260 260
  */
261
-function give_offline_add_settings( $settings ) {
261
+function give_offline_add_settings($settings) {
262 262
 
263 263
 	//Vars
264 264
 	$prefix = '_give_';
265 265
 
266
-	$is_gateway_active = give_is_gateway_active( 'offline' );
266
+	$is_gateway_active = give_is_gateway_active('offline');
267 267
 
268 268
 	//this gateway isn't active
269
-	if ( ! $is_gateway_active ) {
269
+	if ( ! $is_gateway_active) {
270 270
 		//return settings and bounce
271 271
 		return $settings;
272 272
 	}
@@ -275,27 +275,27 @@  discard block
 block discarded – undo
275 275
 	$check_settings = array(
276 276
 
277 277
 		array(
278
-			'name'    => esc_html__( 'Customize Offline Donations', 'give' ),
279
-			'desc'    => esc_html__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
280
-			'id'      => $prefix . 'customize_offline_donations',
278
+			'name'    => esc_html__('Customize Offline Donations', 'give'),
279
+			'desc'    => esc_html__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
280
+			'id'      => $prefix.'customize_offline_donations',
281 281
 			'type'    => 'radio_inline',
282 282
 			'default' => 'no',
283 283
 			'options' => array(
284
-				'yes' => esc_html__( 'Yes', 'give' ),
285
-				'no'  => esc_html__( 'No', 'give' ),
284
+				'yes' => esc_html__('Yes', 'give'),
285
+				'no'  => esc_html__('No', 'give'),
286 286
 			),
287 287
 		),
288 288
 		array(
289
-			'name'        => esc_html__( 'Request Billing Information', 'give' ),
290
-			'desc'        => esc_html__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
291
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
289
+			'name'        => esc_html__('Request Billing Information', 'give'),
290
+			'desc'        => esc_html__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
291
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
292 292
 			'row_classes' => 'give-subfield',
293 293
 			'type'        => 'checkbox'
294 294
 		),
295 295
 		array(
296
-			'id'          => $prefix . 'offline_checkout_notes',
297
-			'name'        => esc_html__( 'Offline Donation Instructions', 'give' ),
298
-			'desc'        => esc_html__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
296
+			'id'          => $prefix.'offline_checkout_notes',
297
+			'name'        => esc_html__('Offline Donation Instructions', 'give'),
298
+			'desc'        => esc_html__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
299 299
 			'default'     => give_get_default_offline_donation_content(),
300 300
 			'type'        => 'wysiwyg',
301 301
 			'row_classes' => 'give-subfield',
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 			)
305 305
 		),
306 306
 		array(
307
-			'id'          => $prefix . 'offline_donation_subject',
308
-			'name'        => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
309
-			'desc'        => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
310
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
307
+			'id'          => $prefix.'offline_donation_subject',
308
+			'name'        => esc_html__('Offline Donation Email Instructions Subject', 'give'),
309
+			'desc'        => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
310
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
311 311
 			'row_classes' => 'give-subfield',
312 312
 			'type'        => 'text'
313 313
 		),
314 314
 		array(
315
-			'id'          => $prefix . 'offline_donation_email',
316
-			'name'        => esc_html__( 'Offline Donation Email Instructions', 'give' ),
317
-			'desc'        => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
315
+			'id'          => $prefix.'offline_donation_email',
316
+			'name'        => esc_html__('Offline Donation Email Instructions', 'give'),
317
+			'desc'        => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
318 318
 			'default'     => give_get_default_offline_donation_email_content(),
319 319
 			'type'        => 'wysiwyg',
320 320
 			'row_classes' => 'give-subfield',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 		)
325 325
 	);
326 326
 
327
-	return array_merge( $settings, $check_settings );
327
+	return array_merge($settings, $check_settings);
328 328
 }
329 329
 
330
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
330
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
331 331
 
332 332
 
333 333
 /**
@@ -339,32 +339,32 @@  discard block
 block discarded – undo
339 339
  */
340 340
 function give_get_default_offline_donation_content() {
341 341
 
342
-	$sitename = get_bloginfo( 'sitename' );
342
+	$sitename = get_bloginfo('sitename');
343 343
 
344
-	$default_text = '<p>' . esc_html__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
344
+	$default_text = '<p>'.esc_html__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
345 345
 	$default_text .= '<ol>';
346 346
 	$default_text .= '<li>';
347 347
 	$default_text .= sprintf(
348 348
 		/* translators: %s: site name */
349
-		__( 'Make a check payable to "%s"', 'give' ),
349
+		__('Make a check payable to "%s"', 'give'),
350 350
 		$sitename
351 351
 	);
352 352
 	$default_text .= '</li>';
353 353
 	$default_text .= '<li>';
354 354
 	$default_text .= sprintf(
355 355
 		/* translators: %s: site name */
356
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
356
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
357 357
 		$sitename
358 358
 	);
359 359
 	$default_text .= '</li>';
360
-	$default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>';
360
+	$default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>';
361 361
 	$default_text .= '</ol>';
362
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
362
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
363 363
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
364 364
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
365
-	$default_text .= '<p>' . esc_html__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
365
+	$default_text .= '<p>'.esc_html__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
366 366
 
367
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
367
+	return apply_filters('give_default_offline_donation_content', $default_text);
368 368
 
369 369
 }
370 370
 
@@ -377,33 +377,33 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_get_default_offline_donation_email_content() {
379 379
 
380
-	$sitename     = get_bloginfo( 'sitename' );
381
-	$default_text = '<p>' . esc_html__( 'Dear {name},', 'give' ) . '</p>';
382
-	$default_text .= '<p>' . esc_html__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
380
+	$sitename     = get_bloginfo('sitename');
381
+	$default_text = '<p>'.esc_html__('Dear {name},', 'give').'</p>';
382
+	$default_text .= '<p>'.esc_html__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
383 383
 	$default_text .= '<ol>';
384 384
 	$default_text .= '<li>';
385 385
 	$default_text .= sprintf(
386 386
 		/* translators: %s: site name */
387
-		__( 'Make a check payable to "%s"', 'give' ),
387
+		__('Make a check payable to "%s"', 'give'),
388 388
 		$sitename
389 389
 	);
390 390
 	$default_text .= '</li>';
391 391
 	$default_text .= '<li>';
392 392
 	$default_text .= sprintf(
393 393
 		/* translators: %s: site name */
394
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
394
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
395 395
 		$sitename
396 396
 	);
397 397
 	$default_text .= '</li>';
398
-	$default_text .= '<li>' . esc_html__( 'Please mail your check to:', 'give' ) . '</li>';
398
+	$default_text .= '<li>'.esc_html__('Please mail your check to:', 'give').'</li>';
399 399
 	$default_text .= '</ol>';
400
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
400
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
401 401
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
402 402
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
403
-	$default_text .= '<p>' . esc_html__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
404
-	$default_text .= '<p>' . esc_html__( 'Sincerely,', 'give' ) . '</p>';
405
-	$default_text .= '<p>' . $sitename . '</p>';
403
+	$default_text .= '<p>'.esc_html__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
404
+	$default_text .= '<p>'.esc_html__('Sincerely,', 'give').'</p>';
405
+	$default_text .= '<p>'.$sitename.'</p>';
406 406
 
407
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
407
+	return apply_filters('give_default_offline_donation_content', $default_text);
408 408
 
409 409
 }
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Purchase
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id = intval( $purchase_data['post_data']['give-form-id'] );
41
+	$form_id = intval($purchase_data['post_data']['give-form-id']);
42 42
 	$price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '';
43 43
 	
44 44
 	// Collect payment data
@@ -57,67 +57,67 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment
60
-	$payment = give_insert_payment( $payment_data );
60
+	$payment = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment
63
-	if ( ! $payment ) {
63
+	if ( ! $payment) {
64 64
 		// Record the error
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 				/* translators: %s: payment data */
69
-				__( 'Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				__('Payment creation failed before sending buyer to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment
73 73
 		);
74 74
 		// Problems? send back
75
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
76 76
 	} else {
77 77
 		// Only send to PayPal if the pending payment is created successfully
78
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
78
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
79 79
 
80 80
 		// Get the success url
81
-		$return_url = add_query_arg( array(
81
+		$return_url = add_query_arg(array(
82 82
 			'payment-confirmation' => 'paypal',
83 83
 			'payment-id'           => $payment
84 84
 
85
-		), get_permalink( give_get_option( 'success_page' ) ) );
85
+		), get_permalink(give_get_option('success_page')));
86 86
 
87 87
 		// Get the PayPal redirect uri
88
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
88
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
89 89
 
90 90
 		//Item name - pass level name if variable priced
91 91
 		$item_name = $purchase_data['post_data']['give-form-title'];
92 92
 
93 93
 		//Verify has variable prices
94
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
94
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
95 95
 
96
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
96
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
97 97
 
98
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
98
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']);
99 99
 
100 100
 			//Donation given doesn't match selected level (must be a custom amount)
101
-			if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) {
102
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
101
+			if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) {
102
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
103 103
 				//user custom amount text if any, fallback to default if not
104
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
104
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
105 105
 
106 106
 			} //Is there any donation level text?
107
-			elseif ( ! empty( $item_price_level_text ) ) {
108
-				$item_name .= ' - ' . $item_price_level_text;
107
+			elseif ( ! empty($item_price_level_text)) {
108
+				$item_name .= ' - '.$item_price_level_text;
109 109
 			}
110 110
 
111 111
 		} //Single donation: Custom Amount
112
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) {
113
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
112
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) {
113
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
114 114
 			//user custom amount text if any, fallback to default if not
115
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
115
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
116 116
 		}
117 117
 
118 118
 		// Setup PayPal arguments
119 119
 		$paypal_args = array(
120
-			'business'      => give_get_option( 'paypal_email', false ),
120
+			'business'      => give_get_option('paypal_email', false),
121 121
 			'email'         => $purchase_data['user_email'],
122 122
 			'invoice'       => $purchase_data['purchase_key'],
123 123
 			'amount'        => $purchase_data['price'],
@@ -128,25 +128,25 @@  discard block
 block discarded – undo
128 128
 			'shipping'      => '0',
129 129
 			'no_note'       => '1',
130 130
 			'currency_code' => give_get_currency(),
131
-			'charset'       => get_bloginfo( 'charset' ),
131
+			'charset'       => get_bloginfo('charset'),
132 132
 			'custom'        => $payment,
133 133
 			'rm'            => '2',
134 134
 			'return'        => $return_url,
135
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment ),
135
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment),
136 136
 			'notify_url'    => $listener_url,
137 137
 			'page_style'    => give_get_paypal_page_style(),
138
-			'cbt'           => get_bloginfo( 'name' ),
138
+			'cbt'           => get_bloginfo('name'),
139 139
 			'bn'            => 'givewp_SP'
140 140
 		);
141 141
 
142
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
142
+		if ( ! empty($purchase_data['user_info']['address'])) {
143 143
 			$paypal_args['address1'] = $purchase_data['user_info']['address']['line1'];
144 144
 			$paypal_args['address2'] = $purchase_data['user_info']['address']['line2'];
145 145
 			$paypal_args['city']     = $purchase_data['user_info']['address']['city'];
146 146
 			$paypal_args['country']  = $purchase_data['user_info']['address']['country'];
147 147
 		}
148 148
 
149
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
149
+		if (give_get_option('paypal_button_type') === 'standard') {
150 150
 			$paypal_extra_args = array(
151 151
 				'cmd' => '_xclick',
152 152
 			);
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 			);
157 157
 		}
158 158
 
159
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
160
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
159
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
160
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
161 161
 
162 162
 		// Build query
163
-		$paypal_redirect .= http_build_query( $paypal_args );
163
+		$paypal_redirect .= http_build_query($paypal_args);
164 164
 
165 165
 		// Fix for some sites that encode the entities
166
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
166
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
167 167
 
168 168
 		// Redirect to PayPal
169
-		wp_redirect( $paypal_redirect );
169
+		wp_redirect($paypal_redirect);
170 170
 		exit;
171 171
 	}
172 172
 
173 173
 }
174 174
 
175
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
175
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
176 176
 
177 177
 /**
178 178
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
  */
183 183
 function give_listen_for_paypal_ipn() {
184 184
 	// Regular PayPal IPN
185
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
186
-		do_action( 'give_verify_paypal_ipn' );
185
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
186
+		do_action('give_verify_paypal_ipn');
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'init', 'give_listen_for_paypal_ipn' );
190
+add_action('init', 'give_listen_for_paypal_ipn');
191 191
 
192 192
 /**
193 193
  * Process PayPal IPN
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 function give_process_paypal_ipn() {
199 199
 
200 200
 	// Check the request method is POST
201
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
201
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
202 202
 		return;
203 203
 	}
204 204
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	$post_data = '';
207 207
 
208 208
 	// Fallback just in case post_max_size is lower than needed
209
-	if ( ini_get( 'allow_url_fopen' ) ) {
210
-		$post_data = file_get_contents( 'php://input' );
209
+	if (ini_get('allow_url_fopen')) {
210
+		$post_data = file_get_contents('php://input');
211 211
 	} else {
212 212
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
213
-		ini_set( 'post_max_size', '12M' );
213
+		ini_set('post_max_size', '12M');
214 214
 	}
215 215
 	// Start the encoded data collection with notification command
216 216
 	$encoded_data = 'cmd=_notify-validate';
@@ -219,40 +219,40 @@  discard block
 block discarded – undo
219 219
 	$arg_separator = give_get_php_arg_separator_output();
220 220
 
221 221
 	// Verify there is a post_data
222
-	if ( $post_data || strlen( $post_data ) > 0 ) {
222
+	if ($post_data || strlen($post_data) > 0) {
223 223
 		// Append the data
224
-		$encoded_data .= $arg_separator . $post_data;
224
+		$encoded_data .= $arg_separator.$post_data;
225 225
 	} else {
226 226
 		// Check if POST is empty
227
-		if ( empty( $_POST ) ) {
227
+		if (empty($_POST)) {
228 228
 			// Nothing to do
229 229
 			return;
230 230
 		} else {
231 231
 			// Loop through each POST
232
-			foreach ( $_POST as $key => $value ) {
232
+			foreach ($_POST as $key => $value) {
233 233
 				// Encode the value and append the data
234
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
234
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
235 235
 			}
236 236
 		}
237 237
 	}
238 238
 
239 239
 	// Convert collected post data to an array
240
-	parse_str( $encoded_data, $encoded_data_array );
240
+	parse_str($encoded_data, $encoded_data_array);
241 241
 
242
-	foreach ( $encoded_data_array as $key => $value ) {
242
+	foreach ($encoded_data_array as $key => $value) {
243 243
 
244
-		if ( false !== strpos( $key, 'amp;' ) ) {
245
-			$new_key = str_replace( '&amp;', '&', $key );
246
-			$new_key = str_replace( 'amp;', '&' , $new_key );
244
+		if (false !== strpos($key, 'amp;')) {
245
+			$new_key = str_replace('&amp;', '&', $key);
246
+			$new_key = str_replace('amp;', '&', $new_key);
247 247
 
248
-			unset( $encoded_data_array[ $key ] );
249
-			$encoded_data_array[ $new_key ] = $value;
248
+			unset($encoded_data_array[$key]);
249
+			$encoded_data_array[$new_key] = $value;
250 250
 		}
251 251
 
252 252
 	}
253 253
 	
254 254
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure
255
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
255
+	if ( ! give_get_option('disable_paypal_verification')) {
256 256
 
257 257
 		$remote_post_vars = array(
258 258
 			'method'      => 'POST',
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 		);
273 273
 
274 274
 		// Validate the IPN
275
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
275
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
276 276
 
277
-		if ( is_wp_error( $api_response ) ) {
277
+		if (is_wp_error($api_response)) {
278 278
 			give_record_gateway_error(
279
-				esc_html__( 'IPN Error', 'give' ),
279
+				esc_html__('IPN Error', 'give'),
280 280
 				sprintf(
281 281
 					/* translators: %s: Paypal IPN response */
282
-					__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
283
-					json_encode( $api_response )
282
+					__('Invalid IPN verification response. IPN data: %s', 'give'),
283
+					json_encode($api_response)
284 284
 				)
285 285
 			);
286 286
 			return; // Something went wrong
287 287
 		}
288 288
 
289
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
289
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
290 290
 			give_record_gateway_error(
291
-				esc_html__( 'IPN Error', 'give' ),
291
+				esc_html__('IPN Error', 'give'),
292 292
 				sprintf(
293 293
 					/* translators: %s: Paypal IPN response */
294
-					__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
295
-					json_encode( $api_response )
294
+					__('Invalid IPN verification response. IPN data: %s', 'give'),
295
+					json_encode($api_response)
296 296
 				)
297 297
 			);
298 298
 			return; // Response not okay
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	}
302 302
 
303 303
 	// Check if $post_data_array has been populated
304
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
304
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
305 305
 		return;
306 306
 	}
307 307
 
@@ -310,21 +310,21 @@  discard block
 block discarded – undo
310 310
 		'payment_status' => ''
311 311
 	);
312 312
 
313
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
313
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
314 314
 
315
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
315
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
316 316
 
317
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
317
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
318 318
 		// Allow PayPal IPN types to be processed separately
319
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
319
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
320 320
 	} else {
321 321
 		// Fallback to web accept just in case the txn_type isn't present
322
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
322
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
323 323
 	}
324 324
 	exit;
325 325
 }
326 326
 
327
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
327
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
328 328
 
329 329
 /**
330 330
  * Process web accept (one time) payment IPNs
@@ -335,224 +335,224 @@  discard block
 block discarded – undo
335 335
  *
336 336
  * @return void
337 337
  */
338
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
338
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
339 339
 
340
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded' ) {
340
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && $data['payment_status'] != 'Refunded') {
341 341
 		return;
342 342
 	}
343 343
 
344
-	if ( empty( $payment_id ) ) {
344
+	if (empty($payment_id)) {
345 345
 		return;
346 346
 	}
347 347
 
348 348
 	// Collect payment details
349
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
349
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
350 350
 	$paypal_amount  = $data['mc_gross'];
351
-	$payment_status = strtolower( $data['payment_status'] );
352
-	$currency_code  = strtolower( $data['mc_currency'] );
353
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
354
-	$payment_meta   = give_get_payment_meta( $payment_id );
351
+	$payment_status = strtolower($data['payment_status']);
352
+	$currency_code  = strtolower($data['mc_currency']);
353
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
354
+	$payment_meta   = give_get_payment_meta($payment_id);
355 355
 
356 356
 
357
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
357
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
358 358
 		return; // this isn't a PayPal standard IPN
359 359
 	}
360 360
 
361 361
 	// Verify payment recipient
362
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
362
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
363 363
 
364 364
 		give_record_gateway_error(
365
-			esc_html__( 'IPN Error', 'give' ),
365
+			esc_html__('IPN Error', 'give'),
366 366
 			sprintf(
367 367
 				/* translators: %s: Paypal IPN response */
368
-				__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
369
-				json_encode( $data )
368
+				__('Invalid business email in IPN response. IPN data: %s', 'give'),
369
+				json_encode($data)
370 370
 			),
371 371
 			$payment_id
372 372
 		);
373
-		give_update_payment_status( $payment_id, 'failed' );
374
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
373
+		give_update_payment_status($payment_id, 'failed');
374
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
375 375
 
376 376
 		return;
377 377
 	}
378 378
 
379 379
 	// Verify payment currency
380
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
380
+	if ($currency_code != strtolower($payment_meta['currency'])) {
381 381
 
382 382
 		give_record_gateway_error(
383
-			esc_html__( 'IPN Error', 'give' ),
383
+			esc_html__('IPN Error', 'give'),
384 384
 			sprintf(
385 385
 				/* translators: %s: Paypal IPN response */
386
-				__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
387
-				json_encode( $data )
386
+				__('Invalid currency in IPN response. IPN data: %s', 'give'),
387
+				json_encode($data)
388 388
 			),
389 389
 			$payment_id
390 390
 		);
391
-		give_update_payment_status( $payment_id, 'failed' );
392
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
391
+		give_update_payment_status($payment_id, 'failed');
392
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
393 393
 
394 394
 		return;
395 395
 	}
396 396
 
397
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
397
+	if ( ! give_get_payment_user_email($payment_id)) {
398 398
 
399 399
 		// No email associated with purchase, so store from PayPal
400
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
400
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
401 401
 
402 402
 		// Setup and store the donors's details
403 403
 		$address            = array();
404
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
405
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
406
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
407
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
408
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
404
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
405
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
406
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
407
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
408
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
409 409
 
410 410
 		$user_info = array(
411 411
 			'id'         => '-1',
412
-			'email'      => sanitize_text_field( $data['payer_email'] ),
413
-			'first_name' => sanitize_text_field( $data['first_name'] ),
414
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
412
+			'email'      => sanitize_text_field($data['payer_email']),
413
+			'first_name' => sanitize_text_field($data['first_name']),
414
+			'last_name'  => sanitize_text_field($data['last_name']),
415 415
 			'discount'   => '',
416 416
 			'address'    => $address
417 417
 		);
418 418
 
419 419
 		$payment_meta['user_info'] = $user_info;
420
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
420
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
421 421
 	}
422 422
 
423
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
423
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
424 424
 
425 425
 		// Process a refund
426
-		give_process_paypal_refund( $data, $payment_id );
426
+		give_process_paypal_refund($data, $payment_id);
427 427
 
428 428
 	} else {
429 429
 
430
-		if ( get_post_status( $payment_id ) == 'publish' ) {
430
+		if (get_post_status($payment_id) == 'publish') {
431 431
 			return; // Only complete payments once
432 432
 		}
433 433
 
434 434
 		// Retrieve the total purchase amount (before PayPal)
435
-		$payment_amount = give_get_payment_amount( $payment_id );
435
+		$payment_amount = give_get_payment_amount($payment_id);
436 436
 
437
-		if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
437
+		if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
438 438
 			// The prices don't match
439 439
 			give_record_gateway_error(
440
-				esc_html__( 'IPN Error', 'give' ),
440
+				esc_html__('IPN Error', 'give'),
441 441
 				sprintf(
442 442
 					/* translators: %s: Paypal IPN response */
443
-					__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
444
-					json_encode( $data )
443
+					__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
444
+					json_encode($data)
445 445
 				),
446 446
 				$payment_id
447 447
 			);
448
-			give_update_payment_status( $payment_id, 'failed' );
449
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
448
+			give_update_payment_status($payment_id, 'failed');
449
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
450 450
 
451 451
 			return;
452 452
 		}
453
-		if ( $purchase_key != give_get_payment_key( $payment_id ) ) {
453
+		if ($purchase_key != give_get_payment_key($payment_id)) {
454 454
 			// Purchase keys don't match
455 455
 			give_record_gateway_error(
456
-				esc_html__( 'IPN Error', 'give' ),
456
+				esc_html__('IPN Error', 'give'),
457 457
 				sprintf(
458 458
 					/* translators: %s: Paypal IPN response */
459
-					__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ),
460
-					json_encode( $data )
459
+					__('Invalid purchase key in IPN response. IPN data: %s', 'give'),
460
+					json_encode($data)
461 461
 				),
462 462
 				$payment_id
463 463
 			);
464
-			give_update_payment_status( $payment_id, 'failed' );
465
-			give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
464
+			give_update_payment_status($payment_id, 'failed');
465
+			give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
466 466
 
467 467
 			return;
468 468
 		}
469 469
 
470
-		if ( $payment_status == 'completed' || give_is_test_mode() ) {
470
+		if ($payment_status == 'completed' || give_is_test_mode()) {
471 471
 			give_insert_payment_note(
472 472
 				$payment_id,
473 473
 				sprintf(
474 474
 					/* translators: %s: Paypal transaction ID */
475
-					esc_html__( 'PayPal Transaction ID: %s', 'give' ),
475
+					esc_html__('PayPal Transaction ID: %s', 'give'),
476 476
 					$data['txn_id']
477 477
 				)
478 478
 			);
479
-			give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
480
-			give_update_payment_status( $payment_id, 'publish' );
481
-		} else if ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
479
+			give_set_payment_transaction_id($payment_id, $data['txn_id']);
480
+			give_update_payment_status($payment_id, 'publish');
481
+		} else if ('pending' == $payment_status && isset($data['pending_reason'])) {
482 482
 
483 483
 			// Look for possible pending reasons, such as an echeck
484 484
 
485 485
 			$note = '';
486 486
 
487
-			switch ( strtolower( $data['pending_reason'] ) ) {
487
+			switch (strtolower($data['pending_reason'])) {
488 488
 
489 489
 				case 'echeck' :
490 490
 
491
-					$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
491
+					$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
492 492
 
493 493
 					break;
494 494
 
495 495
 				case 'address' :
496 496
 
497
-					$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
497
+					$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
498 498
 
499 499
 					break;
500 500
 
501 501
 				case 'intl' :
502 502
 
503
-					$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
503
+					$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
504 504
 
505 505
 					break;
506 506
 
507 507
 				case 'multi-currency' :
508 508
 
509
-					$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
509
+					$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
510 510
 
511 511
 					break;
512 512
 
513 513
 				case 'paymentreview' :
514 514
 				case 'regulatory_review' :
515 515
 
516
-					$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
516
+					$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
517 517
 
518 518
 					break;
519 519
 
520 520
 				case 'unilateral' :
521 521
 
522
-					$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
522
+					$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
523 523
 
524 524
 					break;
525 525
 
526 526
 				case 'upgrade' :
527 527
 
528
-					$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
528
+					$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
529 529
 
530 530
 					break;
531 531
 
532 532
 				case 'verify' :
533 533
 
534
-					$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this payment.', 'give' );
534
+					$note = esc_html__('PayPal account is not verified. Verify account in order to accept this payment.', 'give');
535 535
 
536 536
 					break;
537 537
 
538 538
 				case 'other' :
539 539
 
540
-					$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
540
+					$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
541 541
 
542 542
 					break;
543 543
 
544 544
 			}
545 545
 
546
-			if ( ! empty( $note ) ) {
546
+			if ( ! empty($note)) {
547 547
 
548
-				give_insert_payment_note( $payment_id, $note );
548
+				give_insert_payment_note($payment_id, $note);
549 549
 
550 550
 			}
551 551
 		}
552 552
 	}
553 553
 }
554 554
 
555
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
555
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
556 556
 
557 557
 /**
558 558
  * Process PayPal IPN Refunds
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  *
564 564
  * @return void
565 565
  */
566
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
566
+function give_process_paypal_refund($data, $payment_id = 0) {
567 567
 
568 568
 	// Collect payment details
569 569
 
570
-	if ( empty( $payment_id ) ) {
570
+	if (empty($payment_id)) {
571 571
 		return;
572 572
 	}
573 573
 
574
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
574
+	if (get_post_status($payment_id) == 'refunded') {
575 575
 		return; // Only refund payments once
576 576
 	}
577 577
 
578
-	$payment_amount = give_get_payment_amount( $payment_id );
578
+	$payment_amount = give_get_payment_amount($payment_id);
579 579
 	$refund_amount  = $data['payment_gross'] * - 1;
580 580
 
581
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
581
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
582 582
 
583 583
 		give_insert_payment_note(
584 584
 			$payment_id,
585 585
 			sprintf(
586 586
 				/* translators: %s: Paypal parent transaction ID */
587
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
587
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
588 588
 				$data['parent_txn_id']
589 589
 			)
590 590
 		);
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		$payment_id,
598 598
 		sprintf(
599 599
 			/* translators: 1: Paypal parent transaction ID. 2: Reason code */
600
-			esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ),
600
+			esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'),
601 601
 			$data['parent_txn_id'],
602 602
 			$data['reason_code']
603 603
 		)
@@ -606,11 +606,11 @@  discard block
 block discarded – undo
606 606
 		$payment_id,
607 607
 		sprintf(
608 608
 			/* translators: %s: Paypal transaction ID */
609
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
609
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
610 610
 			$data['txn_id']
611 611
 		)
612 612
 	);
613
-	give_update_payment_status( $payment_id, 'refunded' );
613
+	give_update_payment_status($payment_id, 'refunded');
614 614
 }
615 615
 
616 616
 /**
@@ -622,24 +622,24 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return string
624 624
  */
625
-function give_get_paypal_redirect( $ssl_check = false ) {
625
+function give_get_paypal_redirect($ssl_check = false) {
626 626
 
627
-	if ( is_ssl() || ! $ssl_check ) {
627
+	if (is_ssl() || ! $ssl_check) {
628 628
 		$protocal = 'https://';
629 629
 	} else {
630 630
 		$protocal = 'http://';
631 631
 	}
632 632
 
633 633
 	// Check the current payment mode
634
-	if ( give_is_test_mode() ) {
634
+	if (give_is_test_mode()) {
635 635
 		// Test mode
636
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
636
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
637 637
 	} else {
638 638
 		// Live mode
639
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
639
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
640 640
 	}
641 641
 
642
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
642
+	return apply_filters('give_paypal_uri', $paypal_uri);
643 643
 }
644 644
 
645 645
 /**
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
  * @return string
650 650
  */
651 651
 function give_get_paypal_page_style() {
652
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
653
-	return apply_filters( 'give_paypal_page_style', $page_style );
652
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
653
+	return apply_filters('give_paypal_page_style', $page_style);
654 654
 }
655 655
 
656 656
 /**
@@ -665,27 +665,27 @@  discard block
 block discarded – undo
665 665
  * @return string
666 666
  *
667 667
  */
668
-function give_paypal_success_page_content( $content ) {
668
+function give_paypal_success_page_content($content) {
669 669
 
670
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
670
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
671 671
 		return $content;
672 672
 	}
673 673
 
674
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
674
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
675 675
 
676
-	if ( ! $payment_id ) {
676
+	if ( ! $payment_id) {
677 677
 		$session    = give_get_purchase_session();
678
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
678
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
679 679
 	}
680 680
 
681
-	$payment = get_post( $payment_id );
681
+	$payment = get_post($payment_id);
682 682
 
683
-	if ( $payment && 'pending' == $payment->post_status ) {
683
+	if ($payment && 'pending' == $payment->post_status) {
684 684
 
685 685
 		// Payment is still pending so show processing indicator to fix the Race Condition
686 686
 		ob_start();
687 687
 
688
-		give_get_template_part( 'payment', 'processing' );
688
+		give_get_template_part('payment', 'processing');
689 689
 
690 690
 		$content = ob_get_clean();
691 691
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 
696 696
 }
697 697
 
698
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
698
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
699 699
 
700 700
 /**
701 701
  * Given a Payment ID, extract the transaction ID
@@ -706,22 +706,22 @@  discard block
 block discarded – undo
706 706
  *
707 707
  * @return string                   Transaction ID
708 708
  */
709
-function give_paypal_get_payment_transaction_id( $payment_id ) {
709
+function give_paypal_get_payment_transaction_id($payment_id) {
710 710
 
711 711
 	$transaction_id = '';
712
-	$notes          = give_get_payment_notes( $payment_id );
712
+	$notes          = give_get_payment_notes($payment_id);
713 713
 
714
-	foreach ( $notes as $note ) {
715
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
714
+	foreach ($notes as $note) {
715
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
716 716
 			$transaction_id = $match[1];
717 717
 			continue;
718 718
 		}
719 719
 	}
720 720
 
721
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
721
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
722 722
 }
723 723
 
724
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
724
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
725 725
 
726 726
 /**
727 727
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -733,13 +733,13 @@  discard block
 block discarded – undo
733 733
  *
734 734
  * @return string                 A link to the PayPal transaction details
735 735
  */
736
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
736
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
737 737
 
738 738
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
739
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
739
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
740 740
 
741
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
741
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
742 742
 
743 743
 }
744 744
 
745
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
745
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
Please login to merge, or discard this patch.
includes/install.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
  * @global $wp_version
25 25
  * @return void
26 26
  */
27
-function give_install( $network_wide = false ) {
27
+function give_install($network_wide = false) {
28 28
 
29 29
 	global $wpdb;
30 30
 
31
-	if ( is_multisite() && $network_wide ) {
31
+	if (is_multisite() && $network_wide) {
32 32
 
33
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
33
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
34 34
 
35
-			switch_to_blog( $blog_id );
35
+			switch_to_blog($blog_id);
36 36
 			give_run_install();
37 37
 			restore_current_blog();
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 }
48 48
 
49
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
49
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
50 50
 
51 51
 /**
52 52
  * Run the Give Install process
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 	give_setup_post_types();
63 63
 
64 64
 	// Clear the permalinks
65
-	flush_rewrite_rules( false );
65
+	flush_rewrite_rules(false);
66 66
 
67 67
 	// Add Upgraded From Option
68
-	$current_version = get_option( 'give_version' );
69
-	if ( $current_version ) {
70
-		update_option( 'give_version_upgraded_from', $current_version );
68
+	$current_version = get_option('give_version');
69
+	if ($current_version) {
70
+		update_option('give_version_upgraded_from', $current_version);
71 71
 	}
72 72
 
73 73
 	// Setup some default options
74 74
 	$options = array();
75 75
 
76 76
 	// Checks if the Success Page option exists AND that the page exists
77
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
77
+	if ( ! get_post(give_get_option('success_page'))) {
78 78
 
79 79
 		// Purchase Confirmation (Success) Page
80 80
 		$success = wp_insert_post(
81 81
 			array(
82
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
83
-				'post_content'   => esc_html__( '[give_receipt]', 'give' ),
82
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
83
+				'post_content'   => esc_html__('[give_receipt]', 'give'),
84 84
 				'post_status'    => 'publish',
85 85
 				'post_author'    => 1,
86 86
 				'post_type'      => 'page',
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 
95 95
 	// Checks if the Failure Page option exists AND that the page exists
96
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
96
+	if ( ! get_post(give_get_option('failure_page'))) {
97 97
 
98 98
 		// Failed Purchase Page
99 99
 		$failed = wp_insert_post(
100 100
 			array(
101
-				'post_title'     => esc_html__( 'Transaction Failed', 'give' ),
102
-				'post_content'   => esc_html__( 'We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give' ),
101
+				'post_title'     => esc_html__('Transaction Failed', 'give'),
102
+				'post_content'   => esc_html__('We\'re sorry, your transaction failed to process. Please try again or contact site support.', 'give'),
103 103
 				'post_status'    => 'publish',
104 104
 				'post_author'    => 1,
105 105
 				'post_type'      => 'page',
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 	}
112 112
 
113 113
 	// Checks if the History Page option exists AND that the page exists
114
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
114
+	if ( ! get_post(give_get_option('history_page'))) {
115 115
 		// Purchase History (History) Page
116 116
 		$history = wp_insert_post(
117 117
 			array(
118
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
118
+				'post_title'     => esc_html__('Donation History', 'give'),
119 119
 				'post_content'   => '[donation_history]',
120 120
 				'post_status'    => 'publish',
121 121
 				'post_author'    => 1,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	}
129 129
 
130 130
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency
131
-	if ( empty( $current_version ) ) {
131
+	if (empty($current_version)) {
132 132
 		$options['base_country']       = 'US';
133 133
 		$options['test_mode']          = 1;
134 134
 		$options['currency']           = 'USD';
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 	}
146 146
 
147 147
 	// Populate some default values
148
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
149
-	update_option( 'give_version', GIVE_VERSION );
148
+	update_option('give_settings', array_merge($give_options, $options));
149
+	update_option('give_version', GIVE_VERSION);
150 150
 
151 151
 	//Update Version Number
152
-	if ( $current_version ) {
153
-		update_option( 'give_version_upgraded_from', $current_version );
152
+	if ($current_version) {
153
+		update_option('give_version_upgraded_from', $current_version);
154 154
 	}
155 155
 
156 156
 	// Create Give roles
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	$roles->add_caps();
160 160
 
161 161
 	$api = new Give_API();
162
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
162
+	update_option('give_default_api_version', 'v'.$api->get_version());
163 163
 
164 164
 	// Create the customers database
165 165
 	@Give()->customers->create_table();
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	Give()->session->use_php_sessions();
169 169
 
170 170
 	// Add a temporary option to note that Give pages have been created
171
-	set_transient( '_give_installed', $options, 30 );
171
+	set_transient('_give_installed', $options, 30);
172 172
 	
173
-	if ( ! $current_version ) {
173
+	if ( ! $current_version) {
174 174
 
175
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
175
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
176 176
 
177 177
 		// When new upgrade routines are added, mark them as complete on fresh install
178 178
 		$upgrade_routines = array(
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 			'upgrade_give_offline_status'
182 182
 		);
183 183
 
184
-		foreach ( $upgrade_routines as $upgrade ) {
185
-			give_set_upgrade_complete( $upgrade );
184
+		foreach ($upgrade_routines as $upgrade) {
185
+			give_set_upgrade_complete($upgrade);
186 186
 		}
187 187
 	}
188 188
 
189 189
 	// Bail if activating from network, or bulk
190
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
190
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
191 191
 		return;
192 192
 	}
193 193
 
194 194
 	// Add the transient to redirect
195
-	set_transient( '_give_activation_redirect', true, 30 );
195
+	set_transient('_give_activation_redirect', true, 30);
196 196
 
197 197
 }
198 198
 
199
-register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
199
+register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
200 200
 
201 201
 /**
202 202
  * Network Activated New Site Setup
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
  * @param  int    $site_id The Site ID
213 213
  * @param  array  $meta    Blog Meta
214 214
  */
215
-function on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
215
+function on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
216 216
 
217
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
217
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
218 218
 
219
-		switch_to_blog( $blog_id );
219
+		switch_to_blog($blog_id);
220 220
 		give_install();
221 221
 		restore_current_blog();
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 }
226 226
 
227
-add_action( 'wpmu_new_blog', 'on_create_blog', 10, 6 );
227
+add_action('wpmu_new_blog', 'on_create_blog', 10, 6);
228 228
 
229 229
 
230 230
 /**
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
  *
238 238
  * @return array          The tables to drop
239 239
  */
240
-function give_wpmu_drop_tables( $tables, $blog_id ) {
240
+function give_wpmu_drop_tables($tables, $blog_id) {
241 241
 
242
-	switch_to_blog( $blog_id );
242
+	switch_to_blog($blog_id);
243 243
 	$customers_db = new Give_DB_Customers();
244
-	if ( $customers_db->installed() ) {
244
+	if ($customers_db->installed()) {
245 245
 		$tables[] = $customers_db->table_name;
246 246
 	}
247 247
 	restore_current_blog();
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
 }
252 252
 
253
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
253
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
254 254
 
255 255
 /**
256 256
  * Post-installation
@@ -262,35 +262,35 @@  discard block
 block discarded – undo
262 262
  */
263 263
 function give_after_install() {
264 264
 
265
-	if ( ! is_admin() ) {
265
+	if ( ! is_admin()) {
266 266
 		return;
267 267
 	}
268 268
 
269
-	$give_options     = get_transient( '_give_installed' );
270
-	$give_table_check = get_option( '_give_table_check', false );
269
+	$give_options     = get_transient('_give_installed');
270
+	$give_table_check = get_option('_give_table_check', false);
271 271
 
272
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
272
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
273 273
 
274
-		if ( ! @Give()->customers->installed() ) {
274
+		if ( ! @Give()->customers->installed()) {
275 275
 			// Create the customers database (this ensures it creates it on multisite instances where it is network activated)
276 276
 			@Give()->customers->create_table();
277 277
 
278
-			do_action( 'give_after_install', $give_options );
278
+			do_action('give_after_install', $give_options);
279 279
 		}
280 280
 
281
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
281
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
282 282
 
283 283
 	}
284 284
 
285 285
 	// Delete the transient
286
-	if ( false !== $give_options ) {
287
-		delete_transient( '_give_installed' );
286
+	if (false !== $give_options) {
287
+		delete_transient('_give_installed');
288 288
 	}
289 289
 
290 290
 
291 291
 }
292 292
 
293
-add_action( 'admin_init', 'give_after_install' );
293
+add_action('admin_init', 'give_after_install');
294 294
 
295 295
 
296 296
 /**
@@ -305,11 +305,11 @@  discard block
 block discarded – undo
305 305
 
306 306
 	global $wp_roles;
307 307
 
308
-	if ( ! is_object( $wp_roles ) ) {
308
+	if ( ! is_object($wp_roles)) {
309 309
 		return;
310 310
 	}
311 311
 
312
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
312
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
313 313
 
314 314
 		// Create Give plugin roles
315 315
 		$roles = new Give_Roles();
@@ -320,4 +320,4 @@  discard block
 block discarded – undo
320 320
 
321 321
 }
322 322
 
323
-add_action( 'admin_init', 'give_install_roles_on_network' );
324 323
\ No newline at end of file
324
+add_action('admin_init', 'give_install_roles_on_network');
325 325
\ No newline at end of file
Please login to merge, or discard this patch.