Completed
Pull Request — master (#1907)
by
unknown
19:56
created
includes/scripts.php 1 patch
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_is_setting_enabled(give_get_option('scripts_footer'))) ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_vars = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_vars = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
39
-		'currency_sign'       => give_currency_filter( '' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39
+		'currency_sign'       => give_currency_filter(''),
40 40
 		'currency_pos'        => give_get_currency_position(),
41 41
 		'thousands_separator' => give_get_price_thousand_separator(),
42 42
 		'decimal_separator'   => give_get_price_decimal_separator(),
43
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
44
-		'bad_minimum'         => __( 'The minimum custom donation amount for this form is', 'give' ),
45
-		'general_loading'     => __( 'Loading...', 'give' ),
46
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
43
+		'no_gateway'          => __('Please select a payment method.', 'give'),
44
+		'bad_minimum'         => __('The minimum custom donation amount for this form is', 'give'),
45
+		'general_loading'     => __('Loading...', 'give'),
46
+		'purchase_loading'    => __('Please Wait...', 'give'),
47 47
 		'number_decimals'     => give_get_price_decimals(),
48 48
 		'give_version'        => GIVE_VERSION,
49 49
 		'magnific_options'    => apply_filters(
@@ -57,81 +57,81 @@  discard block
 block discarded – undo
57 57
 			'give_form_translation_js',
58 58
 			array(
59 59
 				// Field name               Validation message.
60
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
61
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
62
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
63
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
64
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
65
-				'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
66
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
60
+				'payment-mode'           => __('Please select payment mode.', 'give'),
61
+				'give_first'             => __('Please enter your first name.', 'give'),
62
+				'give_email'             => __('Please enter a valid email address.', 'give'),
63
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
64
+				'give_user_pass'         => __('Enter a password.', 'give'),
65
+				'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
66
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
67 67
 			)
68 68
 		),
69
-	) );
69
+	));
70 70
 
71
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
71
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
72 72
 		'ajaxurl'         => give_get_ajax_url(),
73
-		'loading'         => __( 'Loading', 'give' ),
73
+		'loading'         => __('Loading', 'give'),
74 74
 		// General loading message.
75
-		'select_option'   => __( 'Please select an option', 'give' ),
75
+		'select_option'   => __('Please select an option', 'give'),
76 76
 		// Variable pricing error with multi-donation option enabled.
77
-		'default_gateway' => give_get_default_gateway( null ),
78
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
77
+		'default_gateway' => give_get_default_gateway(null),
78
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
79 79
 		'number_decimals' => give_get_price_decimals(),
80
-	) );
80
+	));
81 81
 
82 82
 	// DEBUG is On.
83
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
83
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
84 84
 
85
-		if ( give_is_cc_verify_enabled() ) {
86
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
87
-			wp_enqueue_script( 'give-cc-validator' );
85
+		if (give_is_cc_verify_enabled()) {
86
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
87
+			wp_enqueue_script('give-cc-validator');
88 88
 		}
89 89
 
90
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
91
-		wp_enqueue_script( 'give-float-labels' );
90
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
91
+		wp_enqueue_script('give-float-labels');
92 92
 
93
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
94
-		wp_enqueue_script( 'give-blockui' );
93
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
94
+		wp_enqueue_script('give-blockui');
95 95
 
96
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
97
-		wp_enqueue_script( 'give-qtip' );
96
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
97
+		wp_enqueue_script('give-qtip');
98 98
 
99
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
100
-		wp_enqueue_script( 'give-accounting' );
99
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
100
+		wp_enqueue_script('give-accounting');
101 101
 
102
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
103
-		wp_enqueue_script( 'give-magnific' );
102
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
103
+		wp_enqueue_script('give-magnific');
104 104
 
105
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give-checkout-global' );
105
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-checkout-global');
107 107
 
108 108
 		// General scripts.
109
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
110
-		wp_enqueue_script( 'give-scripts' );
109
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
110
+		wp_enqueue_script('give-scripts');
111 111
 
112 112
 		// Load AJAX scripts, if enabled.
113
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
114
-		wp_enqueue_script( 'give-ajax' );
113
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
114
+		wp_enqueue_script('give-ajax');
115 115
 
116 116
 		// Localize / Pass AJAX vars from PHP,
117
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
118
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
117
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
118
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
119 119
 
120 120
 	} else {
121 121
 
122 122
 		// DEBUG is OFF (one JS file to rule them all!).
123
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
124
-		wp_enqueue_script( 'give' );
123
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
124
+		wp_enqueue_script('give');
125 125
 
126 126
 		// Localize / Pass AJAX vars from PHP.
127
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
128
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
127
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
128
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
129 129
 
130 130
 	}
131 131
 
132 132
 }
133 133
 
134
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
134
+add_action('wp_enqueue_scripts', 'give_load_scripts');
135 135
 
136 136
 /**
137 137
  * Register styles.
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function give_register_styles() {
146 146
 
147
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
147
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
148 148
 		return;
149 149
 	}
150 150
 
151
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
152
-	wp_enqueue_style( 'give-styles' );
151
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
152
+	wp_enqueue_style('give-styles');
153 153
 
154 154
 }
155 155
 
156
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
156
+add_action('wp_enqueue_scripts', 'give_register_styles');
157 157
 
158 158
 
159 159
 /**
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 function give_get_stylesheet_uri() {
167 167
 
168 168
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
169
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
169
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
170 170
 
171 171
 	// LTR or RTL files.
172
-	$direction = ( is_rtl() ) ? '-rtl' : '';
172
+	$direction = (is_rtl()) ? '-rtl' : '';
173 173
 
174
-	$file          = 'give' . $direction . $suffix . '.css';
174
+	$file          = 'give'.$direction.$suffix.'.css';
175 175
 	$templates_dir = give_get_theme_template_dir_name();
176 176
 
177
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
178
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
179
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
180
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
181
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
177
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
178
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
179
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
180
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
181
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
182 182
 
183 183
 	$uri = false;
184 184
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
189 189
 	 * This allows users to copy just give.css to their theme.
190 190
 	 */
191
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
192
-		if ( ! empty( $nonmin ) ) {
193
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
191
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
192
+		if ( ! empty($nonmin)) {
193
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
194 194
 		} else {
195
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
195
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
196 196
 		}
197
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
198
-		if ( ! empty( $nonmin ) ) {
199
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
197
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
198
+		if ( ! empty($nonmin)) {
199
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
200 200
 		} else {
201
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
201
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
202 202
 		}
203
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
204
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
203
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
204
+		$uri = trailingslashit(give_get_templates_url()).$file;
205 205
 	}
206 206
 
207
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
207
+	return apply_filters('give_get_stylesheet_uri', $uri);
208 208
 
209 209
 }
210 210
 
@@ -221,79 +221,79 @@  discard block
 block discarded – undo
221 221
  *
222 222
  * @return void
223 223
  */
224
-function give_load_admin_scripts( $hook ) {
224
+function give_load_admin_scripts($hook) {
225 225
 
226 226
 	global $post, $post_type;
227 227
 
228 228
 	$give_options = give_get_settings();
229 229
 
230 230
 	// Directories of assets.
231
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
232
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
233
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
231
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
232
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
233
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
234 234
 
235 235
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
236
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
236
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
237 237
 
238 238
 	// LTR or RTL files.
239
-	$direction = ( is_rtl() ) ? '-rtl' : '';
239
+	$direction = (is_rtl()) ? '-rtl' : '';
240 240
 
241 241
 	// Global Admin.
242
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
243
-	wp_enqueue_style( 'give-admin-bar-notification' );
242
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
243
+	wp_enqueue_style('give-admin-bar-notification');
244 244
 
245 245
 	// Give Admin Only.
246
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
246
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
247 247
 		return;
248 248
 	}
249 249
 
250 250
 	// CSS.
251
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
252
-	wp_enqueue_style( 'jquery-ui-css' );
253
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION );
254
-	wp_enqueue_style( 'give-admin' );
255
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
256
-	wp_enqueue_style( 'jquery-chosen' );
257
-	wp_enqueue_style( 'thickbox' );
258
-	wp_enqueue_style( 'wp-color-picker' );
251
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
252
+	wp_enqueue_style('jquery-ui-css');
253
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION);
254
+	wp_enqueue_style('give-admin');
255
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
256
+	wp_enqueue_style('jquery-chosen');
257
+	wp_enqueue_style('thickbox');
258
+	wp_enqueue_style('wp-color-picker');
259 259
 
260 260
 
261 261
 	// JS.
262
-	wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
263
-	wp_enqueue_script( 'give-selector-cache' );
262
+	wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
263
+	wp_enqueue_script('give-selector-cache');
264 264
 
265
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
266
-	wp_enqueue_script( 'jquery-chosen' );
265
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
266
+	wp_enqueue_script('jquery-chosen');
267 267
 
268
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
269
-	wp_enqueue_script( 'give-accounting' );
268
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
269
+	wp_enqueue_script('give-accounting');
270 270
 
271
-	wp_enqueue_script( 'wp-color-picker' );
272
-	wp_enqueue_script( 'jquery-ui-datepicker' );
273
-	wp_enqueue_script( 'thickbox' );
271
+	wp_enqueue_script('wp-color-picker');
272
+	wp_enqueue_script('jquery-ui-datepicker');
273
+	wp_enqueue_script('thickbox');
274 274
 
275
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker' ), GIVE_VERSION, false );
276
-	wp_enqueue_script( 'give-admin-scripts' );
275
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker'), GIVE_VERSION, false);
276
+	wp_enqueue_script('give-admin-scripts');
277 277
 
278
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
279
-	wp_enqueue_script( 'jquery-flot' );
278
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
279
+	wp_enqueue_script('jquery-flot');
280 280
 
281
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
282
-	wp_enqueue_script( 'give-qtip' );
281
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
282
+	wp_enqueue_script('give-qtip');
283 283
 
284
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
285
-	wp_enqueue_script( 'give-repeatable-fields' );
284
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
285
+	wp_enqueue_script('give-repeatable-fields');
286 286
 
287 287
 	// Forms CPT Script.
288
-	if ( $post_type === 'give_forms' ) {
289
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
290
-		wp_enqueue_script( 'give-admin-forms-scripts' );
288
+	if ($post_type === 'give_forms') {
289
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
290
+		wp_enqueue_script('give-admin-forms-scripts');
291 291
 	}
292 292
 
293 293
 	// Settings Scripts.
294
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
295
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
296
-		wp_enqueue_script( 'give-admin-settings-scripts' );
294
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
295
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
296
+		wp_enqueue_script('give-admin-settings-scripts');
297 297
 	}
298 298
 
299 299
 	// Price Separators.
@@ -301,75 +301,75 @@  discard block
 block discarded – undo
301 301
 	$decimal_separator  = give_get_price_decimal_separator();
302 302
 
303 303
 	// Localize strings & variables for JS.
304
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
305
-		'post_id'                        => isset( $post->ID ) ? $post->ID : null,
304
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
305
+		'post_id'                        => isset($post->ID) ? $post->ID : null,
306 306
 		'give_version'                   => GIVE_VERSION,
307 307
 		'thousands_separator'            => $thousand_separator,
308 308
 		'decimal_separator'              => $decimal_separator,
309
-		'quick_edit_warning'             => __( 'Not available for variable priced forms.', 'give' ),
310
-		'delete_payment'                 => __( 'Are you sure you want to delete this payment?', 'give' ),
311
-		'delete_payment_note'            => __( 'Are you sure you want to delete this note?', 'give' ),
312
-		'revoke_api_key'                 => __( 'Are you sure you want to revoke this API key?', 'give' ),
313
-		'regenerate_api_key'             => __( 'Are you sure you want to regenerate this API key?', 'give' ),
314
-		'resend_receipt'                 => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
315
-		'disconnect_user'                => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
316
-		'one_option'                     => __( 'Choose a form', 'give' ),
317
-		'one_or_more_option'             => __( 'Choose one or more forms', 'give' ),
318
-		'currency_sign'                  => give_currency_filter( '' ),
319
-		'currency_pos'                   => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
320
-		'currency_decimals'              => give_currency_decimal_filter( give_get_price_decimals() ),
321
-		'batch_export_no_class'          => __( 'You must choose a method.', 'give' ),
322
-		'batch_export_no_reqs'           => __( 'Required fields not completed.', 'give' ),
323
-		'reset_stats_warn'               => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
324
-		'price_format_guide'             => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
309
+		'quick_edit_warning'             => __('Not available for variable priced forms.', 'give'),
310
+		'delete_payment'                 => __('Are you sure you want to delete this payment?', 'give'),
311
+		'delete_payment_note'            => __('Are you sure you want to delete this note?', 'give'),
312
+		'revoke_api_key'                 => __('Are you sure you want to revoke this API key?', 'give'),
313
+		'regenerate_api_key'             => __('Are you sure you want to regenerate this API key?', 'give'),
314
+		'resend_receipt'                 => __('Are you sure you want to resend the donation receipt?', 'give'),
315
+		'disconnect_user'                => __('Are you sure you want to disconnect the user from this donor?', 'give'),
316
+		'one_option'                     => __('Choose a form', 'give'),
317
+		'one_or_more_option'             => __('Choose one or more forms', 'give'),
318
+		'currency_sign'                  => give_currency_filter(''),
319
+		'currency_pos'                   => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
320
+		'currency_decimals'              => give_currency_decimal_filter(give_get_price_decimals()),
321
+		'batch_export_no_class'          => __('You must choose a method.', 'give'),
322
+		'batch_export_no_reqs'           => __('Required fields not completed.', 'give'),
323
+		'reset_stats_warn'               => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
324
+		'price_format_guide'             => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
325 325
 		/* translators : %s: Donation form options metabox */
326
-		'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ),
327
-		'matched_success_failure_page'   => __( 'You cannot set the success and failed pages to the same page', 'give' ),
328
-		'dismiss_notice_text'            => __( 'Dismiss this notice.', 'give' ),
329
-		'search_placeholder'             => __( 'Type to search all forms', 'give' ),
330
-		'search_placeholder_donor'       => __( 'Type to search all donors', 'give' ),
331
-		'search_placeholder_country'     => __( 'Type to search all countries', 'give' ),
332
-		'search_placeholder_state'       => __( 'Type to search all states/provinces', 'give' ),
326
+		'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'),
327
+		'matched_success_failure_page'   => __('You cannot set the success and failed pages to the same page', 'give'),
328
+		'dismiss_notice_text'            => __('Dismiss this notice.', 'give'),
329
+		'search_placeholder'             => __('Type to search all forms', 'give'),
330
+		'search_placeholder_donor'       => __('Type to search all donors', 'give'),
331
+		'search_placeholder_country'     => __('Type to search all countries', 'give'),
332
+		'search_placeholder_state'       => __('Type to search all states/provinces', 'give'),
333 333
 		'bulk_action' => array(
334 334
 			'delete'    => array(
335
-				'zero'     => __( 'You must choose at least one or more payments to delete.', 'give' ),
336
-				'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
337
-				'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
335
+				'zero'     => __('You must choose at least one or more payments to delete.', 'give'),
336
+				'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
337
+				'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
338 338
 			),
339 339
 			'resend-receipt' => array(
340
-				'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
341
-				'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
342
-				'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
340
+				'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
341
+				'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
342
+				'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
343 343
 			),
344 344
 			'set-to-status' => array(
345
-				'zero'      => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
346
-				'single'    => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
347
-				'multiple'  => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
345
+				'zero'      => __('You must choose at least one or more donations to set status to {status}.', 'give'),
346
+				'single'    => __('Are you sure you want to set status of this donation to {status}?', 'give'),
347
+				'multiple'  => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
348 348
 			),
349 349
 		),
350 350
 		'metabox_fields' => array(
351 351
 			'media' => array(
352
-				'button_title' => __( 'Choose Image', 'give' ),
352
+				'button_title' => __('Choose Image', 'give'),
353 353
 			),
354 354
 			'file' => array(
355
-				'button_title' => __( 'Choose File', 'give' ),
355
+				'button_title' => __('Choose File', 'give'),
356 356
 			)
357 357
 		),
358 358
 		'chosen' => array(
359
-			'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
360
-			'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
359
+			'no_results_msg'  => __('No results match {search_term}', 'give'),
360
+			'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
361 361
 		),
362
-		'db_update_confirmation_msg' => __( 'Did you already take backup of database before processing updates?', 'give' )
363
-	) );
362
+		'db_update_confirmation_msg' => __('Did you already take backup of database before processing updates?', 'give')
363
+	));
364 364
 
365
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
365
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
366 366
 		// call for new media manager.
367 367
 		wp_enqueue_media();
368 368
 	}
369 369
 
370 370
 }
371 371
 
372
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
372
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
373 373
 
374 374
 /**
375 375
  * Admin Give Icon
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
 	?>
385 385
 	<style type="text/css" media="screen">
386 386
 
387
-		<?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
387
+		<?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
388 388
 		@font-face {
389 389
 			font-family: 'give-icomoon';
390
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>');
391
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
392
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
393
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
390
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>');
391
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
392
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
393
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
394 394
 			font-weight: normal;
395 395
 			font-style: normal;
396 396
 		}
@@ -409,4 +409,4 @@  discard block
 block discarded – undo
409 409
 	<?php
410 410
 }
411 411
 
412
-add_action( 'admin_head', 'give_admin_icon' );
412
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/process-donation.php 1 patch
Spacing   +247 added lines, -247 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data
36 36
 	$valid_data = give_donation_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array $_POST Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user
58
-	$user = give_get_donation_form_user( $valid_data );
58
+	$user = give_get_donation_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible;
83 83
 		// we're using a slightly modified class-wp-sessions.php
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
103
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
103
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
104 104
 
105 105
 	// Setup donation information
106 106
 	$donation_data = array(
107 107
 		'price'        => $price,
108 108
 		'purchase_key' => $purchase_key,
109 109
 		'user_email'   => $user['user_email'],
110
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
111
-		'user_info'    => stripslashes_deep( $user_info ),
110
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
111
+		'user_info'    => stripslashes_deep($user_info),
112 112
 		'post_data'    => $_POST,
113 113
 		'gateway'      => $valid_data['gateway'],
114 114
 		'card_info'    => $valid_data['cc_info'],
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @param array $user_info Array containing basic user information.
129 129
 	 * @param bool|array $valid_data Validate fields.
130 130
 	 */
131
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
131
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
132 132
 
133 133
 	// Sanity check for price
134
-	if ( ! $donation_data['price'] ) {
134
+	if ( ! $donation_data['price']) {
135 135
 		// Revert to manual
136 136
 		$donation_data['gateway'] = 'manual';
137 137
 		$_POST['give-gateway']    = 'manual';
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @since 1.7
144 144
 	 */
145
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
145
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
146 146
 
147 147
 	// Setup the data we're storing in the donation session
148 148
 	$session_data = $donation_data;
149 149
 
150 150
 	// Make sure credit card numbers are never stored in sessions
151
-	unset( $session_data['card_info']['card_number'] );
152
-	unset( $session_data['post_data']['card_number'] );
151
+	unset($session_data['card_info']['card_number']);
152
+	unset($session_data['post_data']['card_number']);
153 153
 
154 154
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
155
-	give_set_purchase_session( $session_data );
155
+	give_set_purchase_session($session_data);
156 156
 
157 157
 	// Send info to the gateway for payment processing
158
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
158
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
159 159
 	give_die();
160 160
 
161 161
 }
162 162
 
163
-add_action( 'give_purchase', 'give_process_donation_form' );
164
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
165
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
163
+add_action('give_purchase', 'give_process_donation_form');
164
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
165
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
166 166
 
167 167
 
168 168
 /**
@@ -175,29 +175,29 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return void
177 177
  */
178
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
178
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
179 179
 
180 180
 	// Verify that the email address belongs to this customer.
181
-	if ( is_user_logged_in() ) {
181
+	if (is_user_logged_in()) {
182 182
 
183
-		$submitted_email    = $valid_data['logged_in_user']['user_email'];
184
-		$customer = new Give_Donor( get_current_user_id(), true );
183
+		$submitted_email = $valid_data['logged_in_user']['user_email'];
184
+		$customer = new Give_Donor(get_current_user_id(), true);
185 185
 
186 186
 		// If this email address is not registered with this customer, see if it belongs to any other customer
187 187
 		if (
188 188
 			$submitted_email !== $customer->email
189
-			&& ( is_array( $customer->emails ) && ! in_array( $submitted_email, $customer->emails ) )
189
+			&& (is_array($customer->emails) && ! in_array($submitted_email, $customer->emails))
190 190
 		) {
191
-			$found_customer = new Give_Donor( $submitted_email );
191
+			$found_customer = new Give_Donor($submitted_email);
192 192
 
193
-			if ( $found_customer->id > 0 ) {
194
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.' ,'give' ), $customer->email, $submitted_email ) );
193
+			if ($found_customer->id > 0) {
194
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $customer->email, $submitted_email));
195 195
 			}
196 196
 		}
197 197
 	}
198 198
 }
199 199
 
200
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
200
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
201 201
 
202 202
 /**
203 203
  * Process the checkout login form
@@ -207,49 +207,49 @@  discard block
 block discarded – undo
207 207
  * @return      void
208 208
  */
209 209
 function give_process_form_login() {
210
-	$is_ajax = isset( $_POST['give_ajax'] );
210
+	$is_ajax = isset($_POST['give_ajax']);
211 211
 
212 212
 	$user_data = give_donation_form_validate_user_login();
213 213
 
214
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
215
-		if ( $is_ajax ) {
214
+	if (give_get_errors() || $user_data['user_id'] < 1) {
215
+		if ($is_ajax) {
216 216
 			/**
217 217
 			 * Fires when AJAX sends back errors from the donation form.
218 218
 			 *
219 219
 			 * @since 1.0
220 220
 			 */
221 221
 			ob_start();
222
-				do_action( 'give_ajax_donation_errors' );
222
+				do_action('give_ajax_donation_errors');
223 223
 				$message = ob_get_contents();
224 224
 			ob_end_clean();
225
-			wp_send_json_error( $message );
225
+			wp_send_json_error($message);
226 226
 		} else {
227
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
227
+			wp_redirect($_SERVER['HTTP_REFERER']);
228 228
 			exit;
229 229
 		}
230 230
 	}
231 231
 
232
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
232
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
233 233
 
234
-	if ( $is_ajax ) {
234
+	if ($is_ajax) {
235 235
 		$message = Give()->notices->print_frontend_notice(
236 236
 			sprintf(
237 237
 				/* translators: %s: user first name */
238
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
239
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
238
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
239
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
240 240
 			),
241 241
 			false,
242 242
 			'success'
243 243
 		);
244 244
 
245
-		wp_send_json_success( $message );
245
+		wp_send_json_success($message);
246 246
 	} else {
247
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
247
+		wp_redirect($_SERVER['HTTP_REFERER']);
248 248
 	}
249 249
 }
250 250
 
251
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
252
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
251
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
252
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
253 253
 
254 254
 /**
255 255
  * Donation Form Validate Fields.
@@ -261,55 +261,55 @@  discard block
 block discarded – undo
261 261
 function give_donation_form_validate_fields() {
262 262
 
263 263
 	// Check if there is $_POST
264
-	if ( empty( $_POST ) ) {
264
+	if (empty($_POST)) {
265 265
 		return false;
266 266
 	}
267 267
 
268
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
268
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
269 269
 
270 270
 	// Start an array to collect valid data
271 271
 	$valid_data = array(
272 272
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here)
273
-		'need_new_user'    => false,     // New user flag
274
-		'need_user_login'  => false,     // Login user flag
275
-		'logged_user_data' => array(),   // Logged user collected data
276
-		'new_user_data'    => array(),   // New user collected data
277
-		'login_user_data'  => array(),   // Login user collected data
278
-		'guest_user_data'  => array(),   // Guest user collected data
279
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info
273
+		'need_new_user'    => false, // New user flag
274
+		'need_user_login'  => false, // Login user flag
275
+		'logged_user_data' => array(), // Logged user collected data
276
+		'new_user_data'    => array(), // New user collected data
277
+		'login_user_data'  => array(), // Login user collected data
278
+		'guest_user_data'  => array(), // Guest user collected data
279
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info
280 280
 	);
281 281
 
282 282
 	// Validate Honeypot First
283
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
284
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
283
+	if ( ! empty($_POST['give-honeypot'])) {
284
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
285 285
 	}
286 286
 
287 287
 	// Validate agree to terms
288
-	if ( give_is_terms_enabled( $form_id ) ) {
288
+	if (give_is_terms_enabled($form_id)) {
289 289
 		give_donation_form_validate_agree_to_terms();
290 290
 	}
291 291
 
292 292
 	// Stop processing donor registration, if donor registration is optional and donor can do guest checkout.
293 293
 	// If registration form username field is empty that means donor do not want to registration instead want guest checkout.
294 294
 	if (
295
-		! give_logged_in_only( $form_id )
296
-		&& isset( $_POST['give-purchase-var'] )
295
+		! give_logged_in_only($form_id)
296
+		&& isset($_POST['give-purchase-var'])
297 297
 		&& $_POST['give-purchase-var'] == 'needs-to-register'
298
-		&& empty( $_POST['give_user_login'] )
298
+		&& empty($_POST['give_user_login'])
299 299
 	) {
300
-		unset( $_POST['give-purchase-var'] );
300
+		unset($_POST['give-purchase-var']);
301 301
 	}
302 302
 
303
-	if ( is_user_logged_in() ) {
303
+	if (is_user_logged_in()) {
304 304
 		// Collect logged in user data.
305 305
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
306
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
306
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
307 307
 		// Set new user registration as required.
308 308
 		$valid_data['need_new_user'] = true;
309 309
 		// Validate new user data.
310 310
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
311 311
 		// Check if login validation is needed.
312
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
312
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
313 313
 		// Set user login as required.
314 314
 		$valid_data['need_user_login'] = true;
315 315
 		// Validate users login info.
@@ -334,41 +334,41 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function give_donation_form_validate_gateway() {
336 336
 
337
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
338
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
339
-	$gateway = give_get_default_gateway( $form_id );
337
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
338
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
339
+	$gateway = give_get_default_gateway($form_id);
340 340
 
341 341
 	// Check if a gateway value is present.
342
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
342
+	if ( ! empty($_REQUEST['give-gateway'])) {
343 343
 
344
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
344
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
345 345
 
346 346
 		// Is amount being donated in LIVE mode 0.00? If so, error:
347
-		if ( $amount == 0 && ! give_is_test_mode() ) {
347
+		if ($amount == 0 && ! give_is_test_mode()) {
348 348
 
349
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
349
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
350 350
 
351 351
 		} // End if().
352
-		elseif ( ! give_verify_minimum_price() ) {
352
+		elseif ( ! give_verify_minimum_price()) {
353 353
 			// translators: %s: minimum donation amount.
354 354
 			give_set_error(
355 355
 				'invalid_donation_minimum',
356 356
 				sprintf(
357 357
 					/* translators: %s: minimum donation amount */
358
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
359
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
358
+					__('This form has a minimum donation amount of %s.', 'give'),
359
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
360 360
 				)
361 361
 			);
362 362
 
363 363
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
364
-		elseif ( $amount == 0 && give_is_test_mode() ) {
364
+		elseif ($amount == 0 && give_is_test_mode()) {
365 365
 
366 366
 			$gateway = 'manual';
367 367
 
368 368
 		} //Check if this gateway is active.
369
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
369
+		elseif ( ! give_is_gateway_active($gateway)) {
370 370
 
371
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
371
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
372 372
 
373 373
 		}
374 374
 	}
@@ -386,21 +386,21 @@  discard block
 block discarded – undo
386 386
  */
387 387
 function give_verify_minimum_price() {
388 388
 
389
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
390
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
391
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
392
-	$variable_prices = give_has_variable_prices( $form_id );
389
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
390
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
391
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
392
+	$variable_prices = give_has_variable_prices($form_id);
393 393
 
394
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
394
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
395 395
 
396
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
396
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
397 397
 
398
-		if ( $price_level_amount == $amount ) {
398
+		if ($price_level_amount == $amount) {
399 399
 			return true;
400 400
 		}
401 401
 	}
402 402
 
403
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
403
+	if (give_get_form_minimum_price($form_id) > $amount) {
404 404
 		return false;
405 405
 	}
406 406
 
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
  */
417 417
 function give_donation_form_validate_agree_to_terms() {
418 418
 	// Validate agree to terms.
419
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
419
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
420 420
 		// User did not agree.
421
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
421
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
422 422
 	}
423 423
 }
424 424
 
@@ -432,59 +432,59 @@  discard block
 block discarded – undo
432 432
  *
433 433
  * @return      array
434 434
  */
435
-function give_get_required_fields( $form_id ) {
435
+function give_get_required_fields($form_id) {
436 436
 
437
-	$payment_mode = give_get_chosen_gateway( $form_id );
437
+	$payment_mode = give_get_chosen_gateway($form_id);
438 438
 
439 439
 	$required_fields = array(
440 440
 		'give_email' => array(
441 441
 			'error_id'      => 'invalid_email',
442
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
442
+			'error_message' => __('Please enter a valid email address.', 'give'),
443 443
 		),
444 444
 		'give_first' => array(
445 445
 			'error_id'      => 'invalid_first_name',
446
-			'error_message' => __( 'Please enter your first name.', 'give' ),
446
+			'error_message' => __('Please enter your first name.', 'give'),
447 447
 		),
448 448
 	);
449 449
 
450
-	$require_address = give_require_billing_address( $payment_mode );
450
+	$require_address = give_require_billing_address($payment_mode);
451 451
 
452
-	if ( $require_address ) {
453
-		$required_fields['card_address']    = array(
452
+	if ($require_address) {
453
+		$required_fields['card_address'] = array(
454 454
 			'error_id'      => 'invalid_card_address',
455
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
455
+			'error_message' => __('Please enter your primary billing address.', 'give'),
456 456
 		);
457
-		$required_fields['card_zip']        = array(
457
+		$required_fields['card_zip'] = array(
458 458
 			'error_id'      => 'invalid_zip_code',
459
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
459
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
460 460
 		);
461
-		$required_fields['card_city']       = array(
461
+		$required_fields['card_city'] = array(
462 462
 			'error_id'      => 'invalid_city',
463
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
463
+			'error_message' => __('Please enter your billing city.', 'give'),
464 464
 		);
465 465
 		$required_fields['billing_country'] = array(
466 466
 			'error_id'      => 'invalid_country',
467
-			'error_message' => __( 'Please select your billing country.', 'give' ),
467
+			'error_message' => __('Please select your billing country.', 'give'),
468 468
 		);
469 469
 
470 470
 
471
-		$required_fields['card_state']      = array(
471
+		$required_fields['card_state'] = array(
472 472
 			'error_id'      => 'invalid_state',
473
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
473
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
474 474
 		);
475 475
 
476 476
 		// Check if billing country alredy exists.
477
-		if ( ! empty( $_POST['billing_country'] ) ) {
477
+		if ( ! empty($_POST['billing_country'])) {
478 478
 			// Get the value from $_POST.
479
-			$country = sanitize_text_field( $_POST['billing_country'] );
479
+			$country = sanitize_text_field($_POST['billing_country']);
480 480
 
481 481
 			// Get the country list that does not have any states init.
482 482
 			$no_states_country = give_no_states_country_list();
483 483
 
484 484
 			// Check if states is empty or not.
485
-			if ( array_key_exists( $country, $no_states_country ) ) {
485
+			if (array_key_exists($country, $no_states_country)) {
486 486
 				// If states is empty remove the required feilds of state in billing cart.
487
-				unset( $required_fields['card_state'] );
487
+				unset($required_fields['card_state']);
488 488
 			}
489 489
 		}
490 490
 	}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	 *
495 495
 	 * @since 1.7
496 496
 	 */
497
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
497
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
498 498
 
499 499
 	return $required_fields;
500 500
 
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
  *
510 510
  * @return bool
511 511
  */
512
-function give_require_billing_address( $payment_mode ) {
512
+function give_require_billing_address($payment_mode) {
513 513
 
514 514
 	$return = false;
515 515
 
516
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
516
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
517 517
 		$return = true;
518 518
 	}
519 519
 
520 520
 	// Let payment gateways and other extensions determine if address fields should be required.
521
-	return apply_filters( 'give_require_billing_address', $return );
521
+	return apply_filters('give_require_billing_address', $return);
522 522
 
523 523
 }
524 524
 
@@ -532,42 +532,42 @@  discard block
 block discarded – undo
532 532
 function give_donation_form_validate_logged_in_user() {
533 533
 	global $user_ID;
534 534
 
535
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
535
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
536 536
 
537 537
 	// Start empty array to collect valid user data.
538 538
 	$valid_user_data = array(
539 539
 		// Assume there will be errors.
540
-		'user_id' => - 1,
540
+		'user_id' => -1,
541 541
 	);
542 542
 
543 543
 	// Verify there is a user_ID.
544
-	if ( $user_ID > 0 ) {
544
+	if ($user_ID > 0) {
545 545
 		// Get the logged in user data.
546
-		$user_data = get_userdata( $user_ID );
546
+		$user_data = get_userdata($user_ID);
547 547
 
548 548
 		// Loop through required fields and show error messages.
549
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
550
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
551
-				give_set_error( $value['error_id'], $value['error_message'] );
549
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
550
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
551
+				give_set_error($value['error_id'], $value['error_message']);
552 552
 			}
553 553
 		}
554 554
 
555 555
 		// Verify data.
556
-		if ( $user_data ) {
556
+		if ($user_data) {
557 557
 			// Collected logged in user data.
558 558
 			$valid_user_data = array(
559 559
 				'user_id'    => $user_ID,
560
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
561
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
562
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
560
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
561
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
562
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
563 563
 			);
564 564
 
565
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
566
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
565
+			if ( ! is_email($valid_user_data['user_email'])) {
566
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
567 567
 			}
568 568
 		} else {
569 569
 			// Set invalid user error.
570
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
570
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
571 571
 		}
572 572
 	}
573 573
 
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	// Default user data.
587 587
 	$default_user_data = array(
588 588
 		'give-form-id'           => '',
589
-		'user_id'                => - 1, // Assume there will be errors.
589
+		'user_id'                => -1, // Assume there will be errors.
590 590
 		'user_first'             => '',
591 591
 		'user_last'              => '',
592 592
 		'give_user_login'        => false,
@@ -596,14 +596,14 @@  discard block
 block discarded – undo
596 596
 	);
597 597
 
598 598
 	// Get user data.
599
-	$user_data            = wp_parse_args( array_map( 'trim', give_clean( $_POST ) ), $default_user_data );
599
+	$user_data            = wp_parse_args(array_map('trim', give_clean($_POST)), $default_user_data);
600 600
 	$registering_new_user = false;
601
-	$form_id              = absint( $user_data['give-form-id'] );
601
+	$form_id              = absint($user_data['give-form-id']);
602 602
 
603 603
 	// Start an empty array to collect valid user data.
604 604
 	$valid_user_data = array(
605 605
 		// Assume there will be errors.
606
-		'user_id'    => - 1,
606
+		'user_id'    => -1,
607 607
 
608 608
 		// Get first name.
609 609
 		'user_first' => $user_data['give_first'],
@@ -613,25 +613,25 @@  discard block
 block discarded – undo
613 613
 	);
614 614
 
615 615
 	// Loop through required fields and show error messages.
616
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
617
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
618
-			give_set_error( $value['error_id'], $value['error_message'] );
616
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
617
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
618
+			give_set_error($value['error_id'], $value['error_message']);
619 619
 		}
620 620
 	}
621 621
 
622 622
 	// Check if we have an username to register.
623
-	if ( give_validate_username( $user_data['give_user_login'] ) ) {
623
+	if (give_validate_username($user_data['give_user_login'])) {
624 624
 		$registering_new_user          = true;
625 625
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
626 626
 	}
627 627
 
628 628
 	// Check if we have an email to verify.
629
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
629
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
630 630
 		$valid_user_data['user_email'] = $user_data['give_email'];
631 631
 	}
632 632
 
633 633
 	// Check password.
634
-	if ( give_validate_user_password( $user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user ) ) {
634
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
635 635
 		// All is good to go.
636 636
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
637 637
 	}
@@ -651,36 +651,36 @@  discard block
 block discarded – undo
651 651
 	// Start an array to collect valid user data.
652 652
 	$valid_user_data = array(
653 653
 		// Assume there will be errors.
654
-		'user_id' => - 1,
654
+		'user_id' => -1,
655 655
 	);
656 656
 
657 657
 	// Username.
658
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
659
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
658
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
659
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
660 660
 
661 661
 		return $valid_user_data;
662 662
 	}
663 663
 
664 664
 	// Get the user by login.
665
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
665
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
666 666
 
667 667
 	// Check if user exists.
668
-	if ( $user_data ) {
668
+	if ($user_data) {
669 669
 		// Get password.
670
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
670
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
671 671
 
672 672
 		// Check user_pass.
673
-		if ( $user_pass ) {
673
+		if ($user_pass) {
674 674
 			// Check if password is valid.
675
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
675
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
676 676
 				// Incorrect password.
677 677
 				give_set_error(
678 678
 					'password_incorrect',
679 679
 					sprintf(
680 680
 						'%1$s <a href="%2$s">%3$s</a>',
681
-						__( 'The password you entered is incorrect.', 'give' ),
682
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
683
-						__( 'Reset Password', 'give' )
681
+						__('The password you entered is incorrect.', 'give'),
682
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
683
+						__('Reset Password', 'give')
684 684
 					)
685 685
 				);
686 686
 				// All is correct.
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
 			}
698 698
 		} else {
699 699
 			// Empty password.
700
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
700
+			give_set_error('password_empty', __('Enter a password.', 'give'));
701 701
 		}
702 702
 	} else {
703 703
 		// No username.
704
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
704
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
705 705
 	}// End if().
706 706
 
707 707
 	return $valid_user_data;
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function give_donation_form_validate_guest_user() {
718 718
 
719
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
719
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
720 720
 
721 721
 	// Start an array to collect valid user data.
722 722
 	$valid_user_data = array(
@@ -725,38 +725,38 @@  discard block
 block discarded – undo
725 725
 	);
726 726
 
727 727
 	// Show error message if user must be logged in.
728
-	if ( give_logged_in_only( $form_id ) ) {
729
-		give_set_error( 'logged_in_only', __( 'You must be logged in to donate.', 'give' ) );
728
+	if (give_logged_in_only($form_id)) {
729
+		give_set_error('logged_in_only', __('You must be logged in to donate.', 'give'));
730 730
 	}
731 731
 
732 732
 	// Get the guest email.
733
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
733
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
734 734
 
735 735
 	// Check email.
736
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
736
+	if ($guest_email && strlen($guest_email) > 0) {
737 737
 		// Validate email.
738
-		if ( ! is_email( $guest_email ) ) {
738
+		if ( ! is_email($guest_email)) {
739 739
 			// Invalid email.
740
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
740
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
741 741
 		} else {
742 742
 			// All is good to go.
743 743
 			$valid_user_data['user_email'] = $guest_email;
744 744
 
745 745
 			// Get user_id from donor if exist.
746
-			$donor = new Give_Donor( $guest_email );
747
-			if ( $donor->id && $donor->user_id ) {
746
+			$donor = new Give_Donor($guest_email);
747
+			if ($donor->id && $donor->user_id) {
748 748
 				$valid_user_data['user_id'] = $donor->user_id;
749 749
 			}
750 750
 		}
751 751
 	} else {
752 752
 		// No email.
753
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
753
+		give_set_error('email_empty', __('Enter an email.', 'give'));
754 754
 	}
755 755
 
756 756
 	// Loop through required fields and show error messages.
757
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
758
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
759
-			give_set_error( $value['error_id'], $value['error_message'] );
757
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
758
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
759
+			give_set_error($value['error_id'], $value['error_message']);
760 760
 		}
761 761
 	}
762 762
 
@@ -772,36 +772,36 @@  discard block
 block discarded – undo
772 772
  * @since   1.0
773 773
  * @return  integer
774 774
  */
775
-function give_register_and_login_new_user( $user_data = array() ) {
775
+function give_register_and_login_new_user($user_data = array()) {
776 776
 	// Verify the array.
777
-	if ( empty( $user_data ) ) {
778
-		return - 1;
777
+	if (empty($user_data)) {
778
+		return -1;
779 779
 	}
780 780
 
781
-	if ( give_get_errors() ) {
782
-		return - 1;
781
+	if (give_get_errors()) {
782
+		return -1;
783 783
 	}
784 784
 
785
-	$user_args = apply_filters( 'give_insert_user_args', array(
786
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
787
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
788
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
789
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
790
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
791
-		'user_registered' => date( 'Y-m-d H:i:s' ),
792
-		'role'            => get_option( 'default_role' ),
793
-	), $user_data );
785
+	$user_args = apply_filters('give_insert_user_args', array(
786
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
787
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
788
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
789
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
790
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
791
+		'user_registered' => date('Y-m-d H:i:s'),
792
+		'role'            => get_option('default_role'),
793
+	), $user_data);
794 794
 
795 795
 	// Insert new user.
796
-	$user_id = wp_insert_user( $user_args );
796
+	$user_id = wp_insert_user($user_args);
797 797
 
798 798
 	// Validate inserted user.
799
-	if ( is_wp_error( $user_id ) ) {
800
-		return - 1;
799
+	if (is_wp_error($user_id)) {
800
+		return -1;
801 801
 	}
802 802
 
803 803
 	// Allow themes and plugins to filter the user data.
804
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
804
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
805 805
 
806 806
 	/**
807 807
 	 * Fires after inserting user.
@@ -811,10 +811,10 @@  discard block
 block discarded – undo
811 811
 	 * @param int $user_id User id.
812 812
 	 * @param array $user_data Array containing user data.
813 813
 	 */
814
-	do_action( 'give_insert_user', $user_id, $user_data );
814
+	do_action('give_insert_user', $user_id, $user_data);
815 815
 
816 816
 	// Login new user.
817
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
817
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
818 818
 
819 819
 	// Return user id.
820 820
 	return $user_id;
@@ -829,27 +829,27 @@  discard block
 block discarded – undo
829 829
  * @since   1.0
830 830
  * @return  array|bool
831 831
  */
832
-function give_get_donation_form_user( $valid_data = array() ) {
832
+function give_get_donation_form_user($valid_data = array()) {
833 833
 
834 834
 	// Initialize user.
835 835
 	$user    = false;
836
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
836
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
837 837
 
838
-	if ( $is_ajax ) {
838
+	if ($is_ajax) {
839 839
 		// Do not create or login the user during the ajax submission (check for errors only).
840 840
 		return true;
841
-	} elseif ( is_user_logged_in() ) {
841
+	} elseif (is_user_logged_in()) {
842 842
 		// Set the valid user as the logged in collected data.
843 843
 		$user = $valid_data['logged_in_user'];
844
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
844
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
845 845
 		// New user registration.
846
-		if ( $valid_data['need_new_user'] === true ) {
846
+		if ($valid_data['need_new_user'] === true) {
847 847
 			// Set user.
848 848
 			$user = $valid_data['new_user_data'];
849 849
 			// Register and login new user.
850
-			$user['user_id'] = give_register_and_login_new_user( $user );
850
+			$user['user_id'] = give_register_and_login_new_user($user);
851 851
 			// User login
852
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
852
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
853 853
 
854 854
 			/**
855 855
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -861,48 +861,48 @@  discard block
 block discarded – undo
861 861
 			// Set user.
862 862
 			$user = $valid_data['login_user_data'];
863 863
 			// Login user.
864
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
864
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
865 865
 		}
866 866
 	}
867 867
 
868 868
 	// Check guest checkout.
869
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
869
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
870 870
 		// Set user
871 871
 		$user = $valid_data['guest_user_data'];
872 872
 	}
873 873
 
874 874
 	// Verify we have an user.
875
-	if ( false === $user || empty( $user ) ) {
875
+	if (false === $user || empty($user)) {
876 876
 		// Return false.
877 877
 		return false;
878 878
 	}
879 879
 
880 880
 	// Get user first name.
881
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
882
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
881
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
882
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
883 883
 	}
884 884
 
885 885
 	// Get user last name.
886
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
887
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
886
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
887
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
888 888
 	}
889 889
 
890 890
 	// Get the user's billing address details.
891 891
 	$user['address']            = array();
892
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
893
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
894
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
895
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
896
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
897
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
898
-
899
-	if ( empty( $user['address']['country'] ) ) {
892
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
893
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
894
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
895
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
896
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
897
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
898
+
899
+	if (empty($user['address']['country'])) {
900 900
 		$user['address'] = false;
901 901
 	} // End if().
902 902
 
903
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
903
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
904 904
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return donation.
905
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
905
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
906 906
 	}
907 907
 
908 908
 	// Return valid user.
@@ -921,16 +921,16 @@  discard block
 block discarded – undo
921 921
 	$card_data = give_get_donation_cc_info();
922 922
 
923 923
 	// Validate the card zip.
924
-	if ( ! empty( $card_data['card_zip'] ) ) {
925
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
926
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
924
+	if ( ! empty($card_data['card_zip'])) {
925
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
926
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
927 927
 		}
928 928
 	}
929 929
 
930 930
 	// Ensure no spaces.
931
-	if ( ! empty( $card_data['card_number'] ) ) {
932
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
933
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
931
+	if ( ! empty($card_data['card_number'])) {
932
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
933
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
934 934
 	}
935 935
 
936 936
 	// This should validate card numbers at some point too.
@@ -947,17 +947,17 @@  discard block
 block discarded – undo
947 947
 function give_get_donation_cc_info() {
948 948
 
949 949
 	$cc_info                   = array();
950
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
951
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
952
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
953
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
954
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
955
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
956
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
957
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
958
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
959
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
960
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
950
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
951
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
952
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
953
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
954
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
955
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
956
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
957
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
958
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
959
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
960
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
961 961
 
962 962
 	// Return cc info.
963 963
 	return $cc_info;
@@ -973,14 +973,14 @@  discard block
 block discarded – undo
973 973
  *
974 974
  * @return bool|mixed
975 975
  */
976
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
976
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
977 977
 	$ret = false;
978 978
 
979
-	if ( empty( $zip ) || empty( $country_code ) ) {
979
+	if (empty($zip) || empty($country_code)) {
980 980
 		return $ret;
981 981
 	}
982 982
 
983
-	$country_code = strtoupper( $country_code );
983
+	$country_code = strtoupper($country_code);
984 984
 
985 985
 	$zip_regex = array(
986 986
 		'AD' => 'AD\d{3}',
@@ -1140,11 +1140,11 @@  discard block
 block discarded – undo
1140 1140
 		'ZM' => '\d{5}',
1141 1141
 	);
1142 1142
 
1143
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1143
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1144 1144
 		$ret = true;
1145 1145
 	}
1146 1146
 
1147
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1147
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1148 1148
 }
1149 1149
 
1150 1150
 
@@ -1158,36 +1158,36 @@  discard block
 block discarded – undo
1158 1158
  *
1159 1159
  * @return bool
1160 1160
  */
1161
-function give_validate_multi_donation_form_level( $valid_data, $data ) {
1161
+function give_validate_multi_donation_form_level($valid_data, $data) {
1162 1162
 	/* @var Give_Donate_Form $form */
1163
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1163
+	$form = new Give_Donate_Form($data['give-form-id']);
1164 1164
 
1165 1165
 	$donation_level_matched = false;
1166 1166
 
1167
-	if ( $form->is_multi_type_donation_form() ) {
1167
+	if ($form->is_multi_type_donation_form()) {
1168 1168
 
1169 1169
 		// Bailout.
1170
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1170
+		if ( ! ($variable_prices = $form->get_prices())) {
1171 1171
 			return false;
1172 1172
 		}
1173 1173
 
1174 1174
 		// Sanitize donation amount.
1175
-		$data['give-amount'] = give_sanitize_amount( $data['give-amount'] );
1175
+		$data['give-amount'] = give_sanitize_amount($data['give-amount']);
1176 1176
 
1177 1177
 		// Get number of decimals.
1178 1178
 		$default_decimals = give_get_price_decimals();
1179 1179
 
1180
-		if ( $data['give-amount'] === give_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ), $default_decimals ) ) {
1180
+		if ($data['give-amount'] === give_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']), $default_decimals)) {
1181 1181
 			return true;
1182 1182
 		}
1183 1183
 
1184 1184
 		// Find correct donation level from all donation levels.
1185
-		foreach ( $variable_prices as $variable_price ) {
1185
+		foreach ($variable_prices as $variable_price) {
1186 1186
 			// Sanitize level amount.
1187
-			$variable_price['_give_amount'] = give_sanitize_amount( $variable_price['_give_amount'], $default_decimals );
1187
+			$variable_price['_give_amount'] = give_sanitize_amount($variable_price['_give_amount'], $default_decimals);
1188 1188
 
1189 1189
 			// Set first match donation level ID.
1190
-			if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1190
+			if ($data['give-amount'] === $variable_price['_give_amount']) {
1191 1191
 				$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1192 1192
 				$donation_level_matched = true;
1193 1193
 				break;
@@ -1198,19 +1198,19 @@  discard block
 block discarded – undo
1198 1198
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1199 1199
 		if (
1200 1200
 			! $donation_level_matched
1201
-			&& ( give_is_setting_enabled( give_get_meta( $data['give-form-id'], '_give_custom_amount', true ) ) )
1201
+			&& (give_is_setting_enabled(give_get_meta($data['give-form-id'], '_give_custom_amount', true)))
1202 1202
 		) {
1203 1203
 			// Sanitize custom minimum amount.
1204
-			$custom_minimum_amount = give_sanitize_amount( give_get_meta( $data['give-form-id'], '_give_custom_amount_minimum', true ), $default_decimals );
1204
+			$custom_minimum_amount = give_sanitize_amount(give_get_meta($data['give-form-id'], '_give_custom_amount_minimum', true), $default_decimals);
1205 1205
 
1206
-			if ( $data['give-amount'] >= $custom_minimum_amount ) {
1206
+			if ($data['give-amount'] >= $custom_minimum_amount) {
1207 1207
 				$_POST['give-price-id'] = 'custom';
1208 1208
 				$donation_level_matched = true;
1209 1209
 			}
1210 1210
 		}
1211 1211
 	}// End if().
1212 1212
 
1213
-	return ( $donation_level_matched ? true : false );
1213
+	return ($donation_level_matched ? true : false);
1214 1214
 }
1215 1215
 
1216
-add_action( 'give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2 );
1216
+add_action('give_checkout_error_checks', 'give_validate_multi_donation_form_level', 10, 2);
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
57 57
 	 */
58
-	public function __construct( $args = array() ) {
58
+	public function __construct($args = array()) {
59 59
 		$defaults = array(
60 60
 			'output'          => 'payments',
61
-			'post_type'       => array( 'give_payment' ),
61
+			'post_type'       => array('give_payment'),
62 62
 			'start_date'      => false,
63 63
 			'end_date'        => false,
64 64
 			'number'          => 20,
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 			'give_forms'      => null,
80 80
 		);
81 81
 
82
-		$this->args = wp_parse_args( $args, $defaults );
82
+		$this->args = wp_parse_args($args, $defaults);
83 83
 
84 84
 		$this->init();
85 85
 	}
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 * @param $query_var
94 94
 	 * @param $value
95 95
 	 */
96
-	public function __set( $query_var, $value ) {
97
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
98
-			$this->args[ $query_var ][] = $value;
96
+	public function __set($query_var, $value) {
97
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
98
+			$this->args[$query_var][] = $value;
99 99
 		} else {
100
-			$this->args[ $query_var ] = $value;
100
+			$this->args[$query_var] = $value;
101 101
 		}
102 102
 	}
103 103
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param $query_var
111 111
 	 */
112
-	public function __unset( $query_var ) {
113
-		unset( $this->args[ $query_var ] );
112
+	public function __unset($query_var) {
113
+		unset($this->args[$query_var]);
114 114
 	}
115 115
 
116 116
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		$this->children();
146 146
 		$this->give_forms();
147 147
 
148
-		add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 );
148
+		add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2);
149 149
 	}
150 150
 
151 151
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	private function unset_filters() {
158 158
 		$this->date_filter_post();
159
-		remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) );
159
+		remove_filter('posts_orderby', array($this, 'custom_orderby'));
160 160
 	}
161 161
 
162 162
 
@@ -183,27 +183,27 @@  discard block
 block discarded – undo
183 183
 		 *
184 184
 		 * @param Give_Payments_Query $this Payments query object.
185 185
 		 */
186
-		do_action( 'give_pre_get_payments', $this );
186
+		do_action('give_pre_get_payments', $this);
187 187
 
188
-		$query = new WP_Query( $this->args );
188
+		$query = new WP_Query($this->args);
189 189
 
190 190
 		$custom_output = array(
191 191
 			'payments',
192 192
 			'give_payments',
193 193
 		);
194 194
 
195
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
195
+		if ( ! in_array($this->args['output'], $custom_output)) {
196 196
 			return $query->posts;
197 197
 		}
198 198
 
199
-		if ( $query->have_posts() ) {
200
-			while ( $query->have_posts() ) {
199
+		if ($query->have_posts()) {
200
+			while ($query->have_posts()) {
201 201
 				$query->the_post();
202 202
 
203 203
 				$payment_id = get_post()->ID;
204
-				$payment    = new Give_Payment( $payment_id );
204
+				$payment    = new Give_Payment($payment_id);
205 205
 
206
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
206
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
207 207
 			}
208 208
 
209 209
 			wp_reset_postdata();
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		 *
221 221
 		 * @param Give_Payments_Query $this Payments query object.
222 222
 		 */
223
-		do_action( 'give_post_get_payments', $this );
223
+		do_action('give_post_get_payments', $this);
224 224
 
225 225
 		return $this->payments;
226 226
 	}
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 	 * @return void
235 235
 	 */
236 236
 	public function date_filter_pre() {
237
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
237
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
238 238
 			return;
239 239
 		}
240 240
 
241
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
241
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
242 242
 
243
-		add_filter( 'posts_where', array( $this, 'payments_where' ) );
243
+		add_filter('posts_where', array($this, 'payments_where'));
244 244
 	}
245 245
 
246 246
 	/**
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 	 * @return void
254 254
 	 */
255 255
 	public function date_filter_post() {
256
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
256
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
257 257
 			return;
258 258
 		}
259 259
 
260
-		remove_filter( 'posts_where', array( $this, 'payments_where' ) );
260
+		remove_filter('posts_where', array($this, 'payments_where'));
261 261
 	}
262 262
 
263 263
 	/**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 	 * @return void
270 270
 	 */
271 271
 	public function status() {
272
-		if ( ! isset ( $this->args['status'] ) ) {
272
+		if ( ! isset ($this->args['status'])) {
273 273
 			return;
274 274
 		}
275 275
 
276
-		$this->__set( 'post_status', $this->args['status'] );
277
-		$this->__unset( 'status' );
276
+		$this->__set('post_status', $this->args['status']);
277
+		$this->__unset('status');
278 278
 	}
279 279
 
280 280
 	/**
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 	 * @return void
287 287
 	 */
288 288
 	public function page() {
289
-		if ( ! isset ( $this->args['page'] ) ) {
289
+		if ( ! isset ($this->args['page'])) {
290 290
 			return;
291 291
 		}
292 292
 
293
-		$this->__set( 'paged', $this->args['page'] );
294
-		$this->__unset( 'page' );
293
+		$this->__set('paged', $this->args['page']);
294
+		$this->__unset('page');
295 295
 	}
296 296
 
297 297
 	/**
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	public function per_page() {
306 306
 
307
-		if ( ! isset( $this->args['number'] ) ) {
307
+		if ( ! isset($this->args['number'])) {
308 308
 			return;
309 309
 		}
310 310
 
311
-		if ( $this->args['number'] == - 1 ) {
312
-			$this->__set( 'nopaging', true );
311
+		if ($this->args['number'] == - 1) {
312
+			$this->__set('nopaging', true);
313 313
 		} else {
314
-			$this->__set( 'posts_per_page', $this->args['number'] );
314
+			$this->__set('posts_per_page', $this->args['number']);
315 315
 		}
316 316
 
317
-		$this->__unset( 'number' );
317
+		$this->__unset('number');
318 318
 	}
319 319
 
320 320
 	/**
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * @return void
327 327
 	 */
328 328
 	public function month() {
329
-		if ( ! isset ( $this->args['month'] ) ) {
329
+		if ( ! isset ($this->args['month'])) {
330 330
 			return;
331 331
 		}
332 332
 
333
-		$this->__set( 'monthnum', $this->args['month'] );
334
-		$this->__unset( 'month' );
333
+		$this->__set('monthnum', $this->args['month']);
334
+		$this->__unset('month');
335 335
 	}
336 336
 
337 337
 	/**
@@ -343,23 +343,23 @@  discard block
 block discarded – undo
343 343
 	 * @return void
344 344
 	 */
345 345
 	public function orderby() {
346
-		switch ( $this->args['orderby'] ) {
346
+		switch ($this->args['orderby']) {
347 347
 			case 'amount' :
348
-				$this->__set( 'orderby', 'meta_value_num' );
349
-				$this->__set( 'meta_key', '_give_payment_total' );
348
+				$this->__set('orderby', 'meta_value_num');
349
+				$this->__set('meta_key', '_give_payment_total');
350 350
 				break;
351 351
 
352 352
 			case 'status' :
353
-				$this->__set( 'orderby', 'post_status' );
353
+				$this->__set('orderby', 'post_status');
354 354
 				break;
355 355
 
356 356
 			case 'donation_form' :
357
-				$this->__set( 'orderby', 'meta_value' );
358
-				$this->__set( 'meta_key', '_give_payment_form_title' );
357
+				$this->__set('orderby', 'meta_value');
358
+				$this->__set('meta_key', '_give_payment_form_title');
359 359
 				break;
360 360
 
361 361
 			default :
362
-				$this->__set( 'orderby', $this->args['orderby'] );
362
+				$this->__set('orderby', $this->args['orderby']);
363 363
 				break;
364 364
 		}
365 365
 	}
@@ -376,17 +376,17 @@  discard block
 block discarded – undo
376 376
 	 *
377 377
 	 * @return mixed
378 378
 	 */
379
-	public function custom_orderby( $order, $query ) {
379
+	public function custom_orderby($order, $query) {
380 380
 		global $wpdb;
381 381
 
382
-		$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
383
-		if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) {
382
+		$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
383
+		if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) {
384 384
 			return $order;
385 385
 		}
386 386
 
387
-		switch ( $query->query['orderby'] ) {
387
+		switch ($query->query['orderby']) {
388 388
 			case 'post_status':
389
-				$order = $wpdb->posts .'.post_status ' . strtoupper( $query->query['order'] );
389
+				$order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']);
390 390
 				break;
391 391
 		}
392 392
 
@@ -402,20 +402,20 @@  discard block
 block discarded – undo
402 402
 	 * @return void
403 403
 	 */
404 404
 	public function user() {
405
-		if ( is_null( $this->args['user'] ) ) {
405
+		if (is_null($this->args['user'])) {
406 406
 			return;
407 407
 		}
408 408
 
409
-		if ( is_numeric( $this->args['user'] ) ) {
409
+		if (is_numeric($this->args['user'])) {
410 410
 			$user_key = '_give_payment_user_id';
411 411
 		} else {
412 412
 			$user_key = '_give_payment_user_email';
413 413
 		}
414 414
 
415
-		$this->__set( 'meta_query', array(
415
+		$this->__set('meta_query', array(
416 416
 			'key'   => $user_key,
417 417
 			'value' => $this->args['user'],
418
-		) );
418
+		));
419 419
 	}
420 420
 
421 421
 	/**
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
 	 * @return  void
427 427
 	 */
428 428
 	public function donor() {
429
-		if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) {
429
+		if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) {
430 430
 			return;
431 431
 		}
432 432
 
433
-		$this->__set( 'meta_query', array(
433
+		$this->__set('meta_query', array(
434 434
 			'key'   => '_give_payment_customer_id',
435 435
 			'value' => (int) $this->args['donor'],
436
-		) );
436
+		));
437 437
 	}
438 438
 
439 439
 	/**
@@ -446,33 +446,33 @@  discard block
 block discarded – undo
446 446
 	 */
447 447
 	public function search() {
448 448
 
449
-		if ( ! isset( $this->args['s'] ) ) {
449
+		if ( ! isset($this->args['s'])) {
450 450
 			return;
451 451
 		}
452 452
 
453
-		$search = trim( $this->args['s'] );
453
+		$search = trim($this->args['s']);
454 454
 
455
-		if ( empty( $search ) ) {
455
+		if (empty($search)) {
456 456
 			return;
457 457
 		}
458 458
 
459
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
460
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
459
+		$is_email = is_email($search) || strpos($search, '@') !== false;
460
+		$is_user  = strpos($search, strtolower('user:')) !== false;
461 461
 
462
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
462
+		if ( ! empty($this->args['search_in_notes'])) {
463 463
 
464
-			$notes = give_get_payment_notes( 0, $search );
464
+			$notes = give_get_payment_notes(0, $search);
465 465
 
466
-			if ( ! empty( $notes ) ) {
466
+			if ( ! empty($notes)) {
467 467
 
468
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
468
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
469 469
 
470
-				$this->__set( 'post__in', $payment_ids );
470
+				$this->__set('post__in', $payment_ids);
471 471
 			}
472 472
 
473
-			$this->__unset( 's' );
473
+			$this->__unset('s');
474 474
 
475
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
475
+		} elseif ($is_email || strlen($search) == 32) {
476 476
 
477 477
 			$key         = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key';
478 478
 			$search_meta = array(
@@ -481,19 +481,19 @@  discard block
 block discarded – undo
481 481
 				'compare' => 'LIKE',
482 482
 			);
483 483
 
484
-			$this->__set( 'meta_query', $search_meta );
485
-			$this->__unset( 's' );
484
+			$this->__set('meta_query', $search_meta);
485
+			$this->__unset('s');
486 486
 
487
-		} elseif ( $is_user ) {
487
+		} elseif ($is_user) {
488 488
 
489 489
 			$search_meta = array(
490 490
 				'key'   => '_give_payment_user_id',
491
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
491
+				'value' => trim(str_replace('user:', '', strtolower($search))),
492 492
 			);
493 493
 
494
-			$this->__set( 'meta_query', $search_meta );
494
+			$this->__set('meta_query', $search_meta);
495 495
 
496
-			if ( give_get_option( 'enable_sequential' ) ) {
496
+			if (give_get_option('enable_sequential')) {
497 497
 
498 498
 				$search_meta = array(
499 499
 					'key'     => '_give_payment_number',
@@ -501,19 +501,19 @@  discard block
 block discarded – undo
501 501
 					'compare' => 'LIKE',
502 502
 				);
503 503
 
504
-				$this->__set( 'meta_query', $search_meta );
504
+				$this->__set('meta_query', $search_meta);
505 505
 
506 506
 				$this->args['meta_query']['relation'] = 'OR';
507 507
 
508 508
 			}
509 509
 
510
-			$this->__unset( 's' );
510
+			$this->__unset('s');
511 511
 
512 512
 		} elseif (
513
-			give_get_option( 'enable_sequential' ) &&
513
+			give_get_option('enable_sequential') &&
514 514
 			(
515
-				false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) ||
516
-				false !== strpos( $search, give_get_option( 'sequential_postfix' ) )
515
+				false !== strpos($search, give_get_option('sequential_prefix')) ||
516
+				false !== strpos($search, give_get_option('sequential_postfix'))
517 517
 			)
518 518
 		) {
519 519
 
@@ -523,29 +523,29 @@  discard block
 block discarded – undo
523 523
 				'compare' => 'LIKE',
524 524
 			);
525 525
 
526
-			$this->__set( 'meta_query', $search_meta );
527
-			$this->__unset( 's' );
526
+			$this->__set('meta_query', $search_meta);
527
+			$this->__unset('s');
528 528
 
529
-		} elseif ( is_numeric( $search ) ) {
529
+		} elseif (is_numeric($search)) {
530 530
 
531
-			$post = get_post( $search );
531
+			$post = get_post($search);
532 532
 
533
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
533
+			if (is_object($post) && $post->post_type == 'give_payment') {
534 534
 
535 535
 				$arr   = array();
536 536
 				$arr[] = $search;
537
-				$this->__set( 'post__in', $arr );
538
-				$this->__unset( 's' );
537
+				$this->__set('post__in', $arr);
538
+				$this->__unset('s');
539 539
 			}
540
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
540
+		} elseif ('#' == substr($search, 0, 1)) {
541 541
 
542
-			$search = str_replace( '#:', '', $search );
543
-			$search = str_replace( '#', '', $search );
544
-			$this->__set( 'give_forms', $search );
545
-			$this->__unset( 's' );
542
+			$search = str_replace('#:', '', $search);
543
+			$search = str_replace('#', '', $search);
544
+			$this->__set('give_forms', $search);
545
+			$this->__unset('s');
546 546
 
547 547
 		} else {
548
-			$this->__set( 's', $search );
548
+			$this->__set('s', $search);
549 549
 
550 550
 		}
551 551
 
@@ -560,16 +560,16 @@  discard block
 block discarded – undo
560 560
 	 * @return void
561 561
 	 */
562 562
 	public function mode() {
563
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
564
-			$this->__unset( 'mode' );
563
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
564
+			$this->__unset('mode');
565 565
 
566 566
 			return;
567 567
 		}
568 568
 
569
-		$this->__set( 'meta_query', array(
569
+		$this->__set('meta_query', array(
570 570
 			'key'   => '_give_payment_mode',
571 571
 			'value' => $this->args['mode'],
572
-		) );
572
+		));
573 573
 	}
574 574
 
575 575
 	/**
@@ -581,10 +581,10 @@  discard block
 block discarded – undo
581 581
 	 * @return void
582 582
 	 */
583 583
 	public function children() {
584
-		if ( empty( $this->args['children'] ) ) {
585
-			$this->__set( 'post_parent', 0 );
584
+		if (empty($this->args['children'])) {
585
+			$this->__set('post_parent', 0);
586 586
 		}
587
-		$this->__unset( 'children' );
587
+		$this->__unset('children');
588 588
 	}
589 589
 
590 590
 	/**
@@ -597,25 +597,25 @@  discard block
 block discarded – undo
597 597
 	 */
598 598
 	public function give_forms() {
599 599
 
600
-		if ( empty( $this->args['give_forms'] ) ) {
600
+		if (empty($this->args['give_forms'])) {
601 601
 			return;
602 602
 		}
603 603
 
604 604
 		$compare = '=';
605 605
 
606
-		if ( is_array( $this->args['give_forms'] ) ) {
606
+		if (is_array($this->args['give_forms'])) {
607 607
 			$compare = 'IN';
608 608
 		}
609 609
 
610
-		$this->__set( 'meta_query', array(
610
+		$this->__set('meta_query', array(
611 611
 			array(
612 612
 				'key'     => '_give_payment_form_id',
613 613
 				'value'   => $this->args['give_forms'],
614 614
 				'compare' => $compare,
615 615
 			),
616
-		) );
616
+		));
617 617
 
618
-		$this->__unset( 'give_forms' );
618
+		$this->__unset('give_forms');
619 619
 
620 620
 	}
621 621
 
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +153 added lines, -153 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_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('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,9 +40,9 @@  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
 	// Get offline payment instruction.
45
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
45
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
46 46
 
47 47
 	ob_start();
48 48
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param int $form_id Give form id.
55 55
 	 */
56
-	do_action( 'give_before_offline_info_fields', $form_id );
56
+	do_action('give_before_offline_info_fields', $form_id);
57 57
 	?>
58 58
     <fieldset id="give_offline_payment_info">
59
-		<?php echo stripslashes( $offline_instructions ); ?>
59
+		<?php echo stripslashes($offline_instructions); ?>
60 60
     </fieldset>
61 61
 	<?php
62 62
 	/**
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param int $form_id Give form id.
68 68
 	 */
69
-	do_action( 'give_after_offline_info_fields', $form_id );
69
+	do_action('give_after_offline_info_fields', $form_id);
70 70
 
71 71
 	echo ob_get_clean();
72 72
 }
73 73
 
74
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
74
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
75 75
 
76 76
 /**
77 77
  * Give Offline Billing Field
78 78
  *
79 79
  * @param $form_id
80 80
  */
81
-function give_offline_billing_fields( $form_id ) {
81
+function give_offline_billing_fields($form_id) {
82 82
 	//Enable Default CC fields (billing info)
83
-	$post_offline_cc_fields        = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
84
-	$post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
83
+	$post_offline_cc_fields        = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
84
+	$post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
85 85
 
86
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
86
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
87 87
 
88 88
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
89 89
 	if (
90
-		( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) )
91
-		|| ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) )
90
+		(give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields))
91
+		|| (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields))
92 92
 	) {
93
-		give_default_cc_address_fields( $form_id );
93
+		give_default_cc_address_fields($form_id);
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
97
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
98 98
 
99 99
 /**
100 100
  * Process the payment
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
  *
106 106
  * @return void
107 107
  */
108
-function give_offline_process_payment( $purchase_data ) {
108
+function give_offline_process_payment($purchase_data) {
109 109
 
110 110
 	// Setup the payment details.
111 111
 	$payment_data = array(
112 112
 		'price'           => $purchase_data['price'],
113 113
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
114
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
115
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
114
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
115
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
116 116
 		'date'            => $purchase_data['date'],
117 117
 		'user_email'      => $purchase_data['user_email'],
118 118
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
 
125 125
 
126 126
 	// record the pending payment
127
-	$payment = give_insert_payment( $payment_data );
127
+	$payment = give_insert_payment($payment_data);
128 128
 
129
-	if ( $payment ) {
130
-		give_offline_send_admin_notice( $payment );
131
-		give_offline_send_donor_instructions( $payment );
129
+	if ($payment) {
130
+		give_offline_send_admin_notice($payment);
131
+		give_offline_send_donor_instructions($payment);
132 132
 		give_send_to_success_page();
133 133
 	} else {
134 134
 		// if errors are present, send the user back to the donation form so they can be corrected
135
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
135
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
136 136
 	}
137 137
 
138 138
 }
139 139
 
140
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
140
+add_action('give_gateway_offline', 'give_offline_process_payment');
141 141
 
142 142
 
143 143
 /**
@@ -150,59 +150,59 @@  discard block
 block discarded – undo
150 150
  * @since       1.0
151 151
  * @return void
152 152
  */
153
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
153
+function give_offline_send_donor_instructions($payment_id = 0) {
154 154
 
155
-	$payment_data                      = give_get_payment_meta( $payment_id );
156
-	$post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
155
+	$payment_data                      = give_get_payment_meta($payment_id);
156
+	$post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
157 157
 
158 158
 	//Customize email content depending on whether the single form has been customized
159
-	$email_content = give_get_option( 'global_offline_donation_email' );
159
+	$email_content = give_get_option('global_offline_donation_email');
160 160
 
161
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
162
-		$email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
161
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
162
+		$email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true);
163 163
 	}
164 164
 
165
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
165
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
166 166
 
167 167
 	/**
168 168
 	 * Filters the from name.
169 169
 	 *
170 170
 	 * @since 1.7
171 171
 	 */
172
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
172
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
173 173
 
174
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
174
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
175 175
 
176 176
 	/**
177 177
 	 * Filters the from email.
178 178
 	 *
179 179
 	 * @since 1.7
180 180
 	 */
181
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
181
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
182 182
 
183
-	$to_email = give_get_payment_user_email( $payment_id );
183
+	$to_email = give_get_payment_user_email($payment_id);
184 184
 
185
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
186
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
187
-		$subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
185
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
186
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
187
+		$subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
188 188
 	}
189 189
 
190
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
191
-	$subject = give_do_email_tags( $subject, $payment_id );
190
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
191
+	$subject = give_do_email_tags($subject, $payment_id);
192 192
 
193
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
194
-	$message     = give_do_email_tags( $email_content, $payment_id );
193
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
194
+	$message     = give_do_email_tags($email_content, $payment_id);
195 195
 
196 196
 	$emails = Give()->emails;
197 197
 
198
-	$emails->__set( 'from_name', $from_name );
199
-	$emails->__set( 'from_email', $from_email );
200
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
198
+	$emails->__set('from_name', $from_name);
199
+	$emails->__set('from_email', $from_email);
200
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
201 201
 
202
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
203
-	$emails->__set( 'headers', $headers );
202
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
203
+	$emails->__set('headers', $headers);
204 204
 
205
-	$emails->send( $to_email, $subject, $message, $attachments );
205
+	$emails->send($to_email, $subject, $message, $attachments);
206 206
 
207 207
 }
208 208
 
@@ -219,54 +219,54 @@  discard block
 block discarded – undo
219 219
  * @return void
220 220
  *
221 221
  */
222
-function give_offline_send_admin_notice( $payment_id = 0 ) {
222
+function give_offline_send_admin_notice($payment_id = 0) {
223 223
 
224 224
 	/* Send an email notification to the admin */
225 225
 	$admin_email = give_get_admin_notice_emails();
226
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
226
+	$user_info   = give_get_payment_meta_user_info($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $user_info['email'];
235 235
 	}
236 236
 
237
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
237
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
238 238
 
239
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
239
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
240 240
 
241
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
242
-	$admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n";
243
-	$admin_message .= __( '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";
241
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
242
+	$admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n";
243
+	$admin_message .= __('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";
244 244
 
245 245
 
246
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
247
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
246
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
247
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
248 248
 
249 249
 	$admin_message .= sprintf(
250 250
 		                  '<a href="%1$s">%2$s</a>',
251
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
252
-		                  __( 'View Donation Details &raquo;', 'give' )
253
-	                  ) . "\n\n";
251
+		                  admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id),
252
+		                  __('View Donation Details &raquo;', 'give')
253
+	                  )."\n\n";
254 254
 
255
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
256
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
255
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
256
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
257 257
 
258
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
259
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
258
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
259
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
260 260
 
261 261
 	//Send Email
262 262
 	$emails = Give()->emails;
263
-	$emails->__set( 'heading', __( 'New Offline Donation', 'give' ) );
263
+	$emails->__set('heading', __('New Offline Donation', 'give'));
264 264
 
265
-	if ( ! empty( $admin_headers ) ) {
266
-		$emails->__set( 'headers', $admin_headers );
265
+	if ( ! empty($admin_headers)) {
266
+		$emails->__set('headers', $admin_headers);
267 267
 	}
268 268
 
269
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
269
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
270 270
 
271 271
 }
272 272
 
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
  *
279 279
  * @return array
280 280
  */
281
-function give_offline_add_settings( $settings ) {
281
+function give_offline_add_settings($settings) {
282 282
 
283 283
 	// Bailout: Do not show offline gateways setting in to metabox if its disabled globally.
284
-	if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) {
284
+	if (in_array('offline', give_get_option('gateways'))) {
285 285
 		return $settings;
286 286
 	}
287 287
 
288 288
 	//Vars
289 289
 	$prefix = '_give_';
290 290
 
291
-	$is_gateway_active = give_is_gateway_active( 'offline' );
291
+	$is_gateway_active = give_is_gateway_active('offline');
292 292
 
293 293
 	//this gateway isn't active
294
-	if ( ! $is_gateway_active ) {
294
+	if ( ! $is_gateway_active) {
295 295
 		//return settings and bounce
296 296
 		return $settings;
297 297
 	}
@@ -300,34 +300,34 @@  discard block
 block discarded – undo
300 300
 	$check_settings = array(
301 301
 
302 302
 		array(
303
-			'name'    => __( 'Offline Donations', 'give' ),
304
-			'desc'    => __( 'Do you want to customize the donation instructions for this form?', 'give' ),
305
-			'id'      => $prefix . 'customize_offline_donations',
303
+			'name'    => __('Offline Donations', 'give'),
304
+			'desc'    => __('Do you want to customize the donation instructions for this form?', 'give'),
305
+			'id'      => $prefix.'customize_offline_donations',
306 306
 			'type'    => 'radio_inline',
307 307
 			'default' => 'global',
308
-			'options' => apply_filters( 'give_forms_content_options_select', array(
309
-					'global'   => __( 'Global Option', 'give' ),
310
-					'enabled'  => __( 'Customize', 'give' ),
311
-					'disabled' => __( 'Disable', 'give' ),
308
+			'options' => apply_filters('give_forms_content_options_select', array(
309
+					'global'   => __('Global Option', 'give'),
310
+					'enabled'  => __('Customize', 'give'),
311
+					'disabled' => __('Disable', 'give'),
312 312
 				)
313 313
 			),
314 314
 		),
315 315
 		array(
316
-			'name'        => __( 'Billing Fields', 'give' ),
317
-			'desc'        => __( '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' ),
318
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
316
+			'name'        => __('Billing Fields', 'give'),
317
+			'desc'        => __('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'),
318
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
319 319
 			'row_classes' => 'give-subfield',
320 320
 			'type'        => 'radio_inline',
321 321
 			'default'     => 'disabled',
322 322
 			'options'     => array(
323
-				'enabled'  => __( 'Enabled', 'give' ),
324
-				'disabled' => __( 'Disabled', 'give' ),
323
+				'enabled'  => __('Enabled', 'give'),
324
+				'disabled' => __('Disabled', 'give'),
325 325
 			),
326 326
 		),
327 327
 		array(
328
-			'id'          => $prefix . 'offline_checkout_notes',
329
-			'name'        => __( 'Donation Instructions', 'give' ),
330
-			'desc'        => __( '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' ),
328
+			'id'          => $prefix.'offline_checkout_notes',
329
+			'name'        => __('Donation Instructions', 'give'),
330
+			'desc'        => __('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'),
331 331
 			'default'     => give_get_default_offline_donation_content(),
332 332
 			'type'        => 'wysiwyg',
333 333
 			'row_classes' => 'give-subfield',
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 			)
337 337
 		),
338 338
 		array(
339
-			'id'          => $prefix . 'offline_donation_subject',
340
-			'name'        => __( 'Email Subject', 'give' ),
341
-			'desc'        => __( 'Enter the subject line for the donation receipt email.', 'give' ),
342
-			'default'     => __( '{form_title} - Offline Donation Instructions', 'give' ),
339
+			'id'          => $prefix.'offline_donation_subject',
340
+			'name'        => __('Email Subject', 'give'),
341
+			'desc'        => __('Enter the subject line for the donation receipt email.', 'give'),
342
+			'default'     => __('{form_title} - Offline Donation Instructions', 'give'),
343 343
 			'row_classes' => 'give-subfield',
344 344
 			'type'        => 'text'
345 345
 		),
346 346
 		array(
347
-			'id'          => $prefix . 'offline_donation_email',
348
-			'name'        => __( 'Email Instructions', 'give' ),
349
-			'desc'        => __( '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' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
347
+			'id'          => $prefix.'offline_donation_email',
348
+			'name'        => __('Email Instructions', 'give'),
349
+			'desc'        => __('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').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
350 350
 			'default'     => give_get_default_offline_donation_email_content(),
351 351
 			'type'        => 'wysiwyg',
352 352
 			'row_classes' => 'give-subfield',
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
 			'name'  => 'offline_docs',
359 359
 			'type'  => 'docs_link',
360 360
 			'url'   => 'http://docs.givewp.com/settings-gateway-offline-donations',
361
-			'title' => __( 'Offline Donations', 'give' ),
361
+			'title' => __('Offline Donations', 'give'),
362 362
 		),
363 363
 	);
364 364
 
365
-	return array_merge( $settings, $check_settings );
365
+	return array_merge($settings, $check_settings);
366 366
 }
367 367
 
368
-add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' );
368
+add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings');
369 369
 
370 370
 
371 371
 /**
@@ -377,32 +377,32 @@  discard block
 block discarded – undo
377 377
  */
378 378
 function give_get_default_offline_donation_content() {
379 379
 
380
-	$sitename = get_bloginfo( 'sitename' );
380
+	$sitename = get_bloginfo('sitename');
381 381
 
382
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
382
+	$default_text = '<p>'.__('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>' . __( 'Please mail your check to:', 'give' ) . '</li>';
398
+	$default_text .= '<li>'.__('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>111 Not A Real St.</em><br>';
402 402
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
403
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
403
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
404 404
 
405
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
405
+	return apply_filters('give_default_offline_donation_content', $default_text);
406 406
 
407 407
 }
408 408
 
@@ -415,34 +415,34 @@  discard block
 block discarded – undo
415 415
  */
416 416
 function give_get_default_offline_donation_email_content() {
417 417
 
418
-	$sitename     = get_bloginfo( 'sitename' );
419
-	$default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
420
-	$default_text .= '<p>' . __( '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>';
418
+	$sitename     = get_bloginfo('sitename');
419
+	$default_text = '<p>'.__('Dear {name},', 'give').'</p>';
420
+	$default_text .= '<p>'.__('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>';
421 421
 	$default_text .= '<ol>';
422 422
 	$default_text .= '<li>';
423 423
 	$default_text .= sprintf(
424 424
 	/* translators: %s: site name */
425
-		__( 'Make a check payable to "%s"', 'give' ),
425
+		__('Make a check payable to "%s"', 'give'),
426 426
 		$sitename
427 427
 	);
428 428
 	$default_text .= '</li>';
429 429
 	$default_text .= '<li>';
430 430
 	$default_text .= sprintf(
431 431
 	/* translators: %s: site name */
432
-		__( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ),
432
+		__('On the memo line of the check, please indicate that the donation is for "%s"', 'give'),
433 433
 		$sitename
434 434
 	);
435 435
 	$default_text .= '</li>';
436
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
436
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
437 437
 	$default_text .= '</ol>';
438
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
438
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
439 439
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>111 Not A Real St.</em><br>';
440 440
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>Anytown, CA 12345 </em><br>';
441
-	$default_text .= '<p>' . __( '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>';
442
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
443
-	$default_text .= '<p>' . $sitename . '</p>';
441
+	$default_text .= '<p>'.__('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>';
442
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
443
+	$default_text .= '<p>'.$sitename.'</p>';
444 444
 
445
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
445
+	return apply_filters('give_default_offline_donation_content', $default_text);
446 446
 
447 447
 }
448 448
 
@@ -456,17 +456,17 @@  discard block
 block discarded – undo
456 456
  *
457 457
  * @return string
458 458
  */
459
-function give_offline_donation_receipt_status_notice( $notice, $id ) {
460
-	$payment = new Give_Payment( $id );
459
+function give_offline_donation_receipt_status_notice($notice, $id) {
460
+	$payment = new Give_Payment($id);
461 461
 
462
-	if ( 'offline' !== $payment->gateway || $payment->is_completed() ) {
462
+	if ('offline' !== $payment->gateway || $payment->is_completed()) {
463 463
 		return $notice;
464 464
 	}
465 465
 
466
-	return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' );
466
+	return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning');
467 467
 }
468 468
 
469
-add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 );
469
+add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2);
470 470
 
471 471
 /**
472 472
  * Add offline payment instruction on payment receipt.
@@ -477,26 +477,26 @@  discard block
 block discarded – undo
477 477
  *
478 478
  * @return mixed
479 479
  */
480
-function give_offline_payment_receipt_after( $payment ) {
480
+function give_offline_payment_receipt_after($payment) {
481 481
 	// Get payment object.
482
-	$payment = new Give_Payment( $payment->ID );
482
+	$payment = new Give_Payment($payment->ID);
483 483
 
484 484
 	// Bailout.
485
-	if ( 'offline' !== $payment->gateway ) {
485
+	if ('offline' !== $payment->gateway) {
486 486
 		return false;
487 487
 	}
488 488
 
489 489
 	?>
490 490
     <tr>
491
-        <td scope="row"><strong><?php esc_html_e( 'Offline Donations Instructions', 'give' ); ?></strong></td>
491
+        <td scope="row"><strong><?php esc_html_e('Offline Donations Instructions', 'give'); ?></strong></td>
492 492
         <td>
493
-			<?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?>
493
+			<?php echo give_get_offline_payment_instruction($payment->form_id, true); ?>
494 494
         </td>
495 495
     </tr>
496 496
 	<?php
497 497
 }
498 498
 
499
-add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' );
499
+add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after');
500 500
 
501 501
 /**
502 502
  * Get offline payment instructions.
@@ -508,27 +508,27 @@  discard block
 block discarded – undo
508 508
  *
509 509
  * @return string
510 510
  */
511
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
511
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
512 512
 	// Bailout.
513
-	if ( ! $form_id ) {
513
+	if ( ! $form_id) {
514 514
 		return '';
515 515
 	}
516 516
 
517
-	$post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
518
-	$post_offline_instructions         = give_get_meta( $form_id, '_give_offline_checkout_notes', true );
519
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
517
+	$post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
518
+	$post_offline_instructions         = give_get_meta($form_id, '_give_offline_checkout_notes', true);
519
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
520 520
 	$offline_instructions              = $global_offline_instruction;
521 521
 
522
-	if ( give_is_setting_enabled( $post_offline_customization_option ) ) {
522
+	if (give_is_setting_enabled($post_offline_customization_option)) {
523 523
 		$offline_instructions = $post_offline_instructions;
524 524
 	}
525 525
 
526
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
526
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
527 527
 
528 528
 	/* translators: %s: form settings url */
529
-	$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 );
529
+	$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);
530 530
 
531
-	return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions );
531
+	return ($wpautop ? wpautop($offline_instructions) : $offline_instructions);
532 532
 }
533 533
 
534 534
 
@@ -542,24 +542,24 @@  discard block
 block discarded – undo
542 542
  *
543 543
  * @return array
544 544
  */
545
-function give_filter_offline_gateway( $gateway_list, $form_id ) {
545
+function give_filter_offline_gateway($gateway_list, $form_id) {
546 546
 	if (
547 547
 		// Show offline payment gateway if enable for new donation form.
548
-		( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) )
548
+		(false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms'))
549 549
 		&& $form_id
550
-		&& ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array(
550
+		&& ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array(
551 551
 			'enabled',
552 552
 			'global',
553
-		) )
553
+		))
554 554
 	) {
555
-		unset( $gateway_list['offline'] );
555
+		unset($gateway_list['offline']);
556 556
 	}
557 557
 
558 558
 	// Output.
559 559
 	return $gateway_list;
560 560
 }
561 561
 
562
-add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 );
562
+add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2);
563 563
 
564 564
 /**
565 565
  * Set default gateway to global default payment gateway
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
  *
574 574
  * @return void
575 575
  */
576
-function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) {
577
-	if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) {
578
-		give_update_meta( $postid, '_give_default_gateway', 'global' );
576
+function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) {
577
+	if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) {
578
+		give_update_meta($postid, '_give_default_gateway', 'global');
579 579
 	}
580 580
 }
581 581
 
582
-add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 );
582
+add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3);
Please login to merge, or discard this patch.
includes/deprecated/deprecated-functions.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return bool $ret True if guest checkout is enabled, false otherwise
29 29
  */
30
-function give_no_guest_checkout( $form_id ) {
30
+function give_no_guest_checkout($form_id) {
31 31
 
32 32
 	$backtrace = debug_backtrace();
33 33
 
34
-	_give_deprecated_function( __FUNCTION__, '1.4.1', null, $backtrace );
34
+	_give_deprecated_function(__FUNCTION__, '1.4.1', null, $backtrace);
35 35
 
36
-	$ret = give_get_meta( $form_id, '_give_logged_in_only', true );
36
+	$ret = give_get_meta($form_id, '_give_logged_in_only', true);
37 37
 
38
-	return (bool) apply_filters( 'give_no_guest_checkout', give_is_setting_enabled( $ret ) );
38
+	return (bool) apply_filters('give_no_guest_checkout', give_is_setting_enabled($ret));
39 39
 }
40 40
 
41 41
 
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 
51 51
 	$backtrace = debug_backtrace();
52 52
 
53
-	_give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace );
53
+	_give_deprecated_function(__FUNCTION__, '1.8', null, $backtrace);
54 54
 
55 55
 	$views = array(
56
-		'sales'          => __( 'Donations', 'give' ),
57
-		'gateway_errors' => __( 'Payment Errors', 'give' ),
58
-		'api_requests'   => __( 'API Requests', 'give' ),
56
+		'sales'          => __('Donations', 'give'),
57
+		'gateway_errors' => __('Payment Errors', 'give'),
58
+		'api_requests'   => __('API Requests', 'give'),
59 59
 	);
60 60
 
61
-	$views = apply_filters( 'give_log_views', $views );
61
+	$views = apply_filters('give_log_views', $views);
62 62
 
63 63
 	return $views;
64 64
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 	$backtrace = debug_backtrace();
75 75
 
76
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_agree_to_terms', $backtrace );
76
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_agree_to_terms', $backtrace);
77 77
 
78 78
 	// Call new renamed function.
79 79
 	give_donation_form_validate_agree_to_terms();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 	$backtrace = debug_backtrace();
92 92
 
93
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_logged_in_user', $backtrace );
93
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_logged_in_user', $backtrace);
94 94
 
95 95
 	// Call new renamed function.
96 96
 	give_donation_form_validate_logged_in_user();
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	$backtrace = debug_backtrace();
109 109
 
110
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_gateway', $backtrace );
110
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_gateway', $backtrace);
111 111
 
112 112
 	// Call new renamed function.
113 113
 	give_donation_form_validate_gateway();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 	$backtrace = debug_backtrace();
126 126
 
127
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_fields', $backtrace );
127
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_fields', $backtrace);
128 128
 
129 129
 	// Call new renamed function.
130 130
 	give_donation_form_validate_fields();
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	$backtrace = debug_backtrace();
143 143
 
144
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc', $backtrace );
144
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_cc', $backtrace);
145 145
 
146 146
 	// Call new renamed function.
147 147
 	give_donation_form_validate_cc();
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 	$backtrace = debug_backtrace();
160 160
 
161
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_cc_info', $backtrace );
161
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_cc_info', $backtrace);
162 162
 
163 163
 	// Call new renamed function.
164 164
 	give_get_donation_cc_info();
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
  * @param int    $zip
176 176
  * @param string $country_code
177 177
  */
178
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
178
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
179 179
 
180 180
 	$backtrace = debug_backtrace();
181 181
 
182
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_cc_zip', $backtrace );
182
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_cc_zip', $backtrace);
183 183
 
184 184
 	// Call new renamed function.
185
-	give_donation_form_validate_cc_zip( $zip, $country_code );
185
+	give_donation_form_validate_cc_zip($zip, $country_code);
186 186
 
187 187
 }
188 188
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 	$backtrace = debug_backtrace();
198 198
 
199
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_user_login', $backtrace );
199
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_user_login', $backtrace);
200 200
 
201 201
 	// Call new renamed function.
202 202
 	give_donation_form_validate_user_login();
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 	$backtrace = debug_backtrace();
215 215
 
216
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_guest_user', $backtrace );
216
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_guest_user', $backtrace);
217 217
 
218 218
 	// Call new renamed function.
219 219
 	give_donation_form_validate_guest_user();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 	$backtrace = debug_backtrace();
232 232
 
233
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_donation_form_validate_new_user', $backtrace );
233
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_donation_form_validate_new_user', $backtrace);
234 234
 
235 235
 	// Call new renamed function.
236 236
 	give_donation_form_validate_new_user();
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
  *
247 247
  * @param array $valid_data
248 248
  */
249
-function give_get_purchase_form_user( $valid_data = array() ) {
249
+function give_get_purchase_form_user($valid_data = array()) {
250 250
 
251 251
 	$backtrace = debug_backtrace();
252 252
 
253
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace );
253
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace);
254 254
 
255 255
 	// Call new renamed function.
256
-	give_get_donation_form_user( $valid_data );
256
+	give_get_donation_form_user($valid_data);
257 257
 
258 258
 }
259 259
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return string
271 271
  */
272
-function give_checkout_button_purchase( $form_id ) {
272
+function give_checkout_button_purchase($form_id) {
273 273
 	$backtrace = debug_backtrace();
274 274
 
275
-	_give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_submit_button', $backtrace );
275
+	_give_deprecated_function(__FUNCTION__, '1.8.8', 'give_get_donation_form_submit_button', $backtrace);
276 276
 
277
-	return give_get_donation_form_submit_button( $form_id );
277
+	return give_get_donation_form_submit_button($form_id);
278 278
 
279 279
 }
280 280
 
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
  *
288 288
  * @return int $customer_id Customer ID.
289 289
  */
290
-function give_get_payment_customer_id( $payment_id ) {
290
+function give_get_payment_customer_id($payment_id) {
291 291
 
292 292
 	$backtrace = debug_backtrace();
293 293
 
294
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_payment_donor_id', $backtrace );
294
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_payment_donor_id', $backtrace);
295 295
 
296
-	return give_get_payment_donor_id( $payment_id );
296
+	return give_get_payment_donor_id($payment_id);
297 297
 }
298 298
 
299 299
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 
309 309
 	$backtrace = debug_backtrace();
310 310
 
311
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_total_donations', $backtrace );
311
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_total_donations', $backtrace);
312 312
 
313 313
 	return give_get_total_donations();
314 314
 }
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @return      int The total number of donations
328 328
  */
329
-function give_count_purchases_of_customer( $user = null ) {
329
+function give_count_purchases_of_customer($user = null) {
330 330
 
331 331
 	$backtrace = debug_backtrace();
332 332
 
333
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_donations_of_donor', $backtrace );
333
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_count_donations_of_donor', $backtrace);
334 334
 
335
-	return give_count_donations_of_donor( $user );
335
+	return give_count_donations_of_donor($user);
336 336
 }
337 337
 
338 338
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
  *
349 349
  * @return      array
350 350
  */
351
-function give_get_purchase_stats_by_user( $user = '' ) {
351
+function give_get_purchase_stats_by_user($user = '') {
352 352
 
353 353
 	$backtrace = debug_backtrace();
354 354
 
355
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_donation_stats_by_user', $backtrace );
355
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_donation_stats_by_user', $backtrace);
356 356
 
357
-	return give_get_donation_stats_by_user( $user );
357
+	return give_get_donation_stats_by_user($user);
358 358
 
359 359
 }
360 360
 
@@ -372,13 +372,13 @@  discard block
 block discarded – undo
372 372
  *
373 373
  * @return bool|object List of all user donations
374 374
  */
375
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
375
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
376 376
 
377 377
 	$backtrace = debug_backtrace();
378 378
 
379
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_get_users_donations', $backtrace );
379
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_get_users_donations', $backtrace);
380 380
 
381
-	return give_get_users_donations( $user, $number, $pagination, $status );
381
+	return give_get_users_donations($user, $number, $pagination, $status);
382 382
 
383 383
 }
384 384
 
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
  *
396 396
  * @return      bool True if has donated, false other wise.
397 397
  */
398
-function give_has_purchases( $user_id = null ) {
398
+function give_has_purchases($user_id = null) {
399 399
 
400 400
 	$backtrace = debug_backtrace();
401 401
 
402
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_has_donations', $backtrace );
402
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_has_donations', $backtrace);
403 403
 
404
-	return give_has_donations( $user_id );
404
+	return give_has_donations($user_id);
405 405
 }
406 406
 
407 407
 /**
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 function give_count_total_customers() {
416 416
 	$backtrace = debug_backtrace();
417 417
 
418
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_count_total_donors', $backtrace );
418
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_count_total_donors', $backtrace);
419 419
 
420 420
 	return give_count_total_donors();
421 421
 }
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
  *
431 431
  * @return      float The total amount the user has spent
432 432
  */
433
-function give_purchase_total_of_user( $user = null ) {
433
+function give_purchase_total_of_user($user = null) {
434 434
 
435 435
 	$backtrace = debug_backtrace();
436 436
 
437
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_donation_total_of_user', $backtrace );
437
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_donation_total_of_user', $backtrace);
438 438
 
439
-	return give_donation_total_of_user( $user );
439
+	return give_donation_total_of_user($user);
440 440
 }
441 441
 
442 442
 /**
@@ -450,13 +450,13 @@  discard block
 block discarded – undo
450 450
  *
451 451
  * @return void
452 452
  */
453
-function give_delete_purchase( $payment_id = 0, $update_customer = true ) {
453
+function give_delete_purchase($payment_id = 0, $update_customer = true) {
454 454
 
455 455
 	$backtrace = debug_backtrace();
456 456
 
457
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_delete_donation', $backtrace );
457
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_delete_donation', $backtrace);
458 458
 
459
-	give_delete_donation( $payment_id, $update_customer );
459
+	give_delete_donation($payment_id, $update_customer);
460 460
 
461 461
 }
462 462
 
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
  *
475 475
  * @return void
476 476
  */
477
-function give_undo_purchase( $form_id = false, $payment_id ) {
477
+function give_undo_purchase($form_id = false, $payment_id) {
478 478
 
479 479
 	$backtrace = debug_backtrace();
480 480
 
481
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace );
481
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace);
482 482
 
483
-	give_undo_donation( $payment_id );
483
+	give_undo_donation($payment_id);
484 484
 }
485 485
 
486 486
 
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
  *
494 494
  * @return void
495 495
  */
496
-function give_trigger_purchase_delete( $data ) {
496
+function give_trigger_purchase_delete($data) {
497 497
 	$backtrace = debug_backtrace();
498 498
 
499
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_trigger_donation_delete', $backtrace );
499
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_trigger_donation_delete', $backtrace);
500 500
 
501
-	give_trigger_donation_delete( $data );
501
+	give_trigger_donation_delete($data);
502 502
 }
503 503
 
504 504
 
@@ -512,12 +512,12 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @return bool|int
514 514
  */
515
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
515
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
516 516
 	$backtrace = debug_backtrace();
517 517
 
518
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_increase_donation_count', $backtrace );
518
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_increase_donation_count', $backtrace);
519 519
 
520
-	give_increase_donation_count( $form_id, $quantity );
520
+	give_increase_donation_count($form_id, $quantity);
521 521
 }
522 522
 
523 523
 
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
  *
537 537
  * @return void
538 538
  */
539
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
539
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
540 540
 	$backtrace = debug_backtrace();
541 541
 
542
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace );
542
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace);
543 543
 
544
-	give_record_donation_in_log( $give_form_id, $payment_id, $price_id, $sale_date );
544
+	give_record_donation_in_log($give_form_id, $payment_id, $price_id, $sale_date);
545 545
 }
546 546
 
547 547
 /**
@@ -558,12 +558,12 @@  discard block
 block discarded – undo
558 558
  *
559 559
  * @return void
560 560
  */
561
-function give_print_errors( $form_id ) {
561
+function give_print_errors($form_id) {
562 562
 	$backtrace = debug_backtrace();
563 563
 
564
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_errors', $backtrace );
564
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_errors', $backtrace);
565 565
 
566
-	do_action( 'give_frontend_notices', $form_id );
566
+	do_action('give_frontend_notices', $form_id);
567 567
 }
568 568
 
569 569
 /**
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
  *
580 580
  * @return   string  $error
581 581
  */
582
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
582
+function give_output_error($message, $echo = true, $error_id = 'warning') {
583 583
 	$backtrace = debug_backtrace();
584 584
 
585
-	_give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace );
585
+	_give_deprecated_function(__FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace);
586 586
 
587
-	Give()->notices->print_frontend_notice( $message, $echo, $error_id );
587
+	Give()->notices->print_frontend_notice($message, $echo, $error_id);
588 588
 }
589 589
 
590 590
 
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
  *
601 601
  * @return string
602 602
  */
603
-function give_get_purchase_summary( $purchase_data, $email = true ) {
603
+function give_get_purchase_summary($purchase_data, $email = true) {
604 604
 
605 605
 	$backtrace = debug_backtrace();
606 606
 
607
-	_give_deprecated_function( __FUNCTION__, '1.8.12', 'give_payment_gateway_donation_summary', $backtrace );
607
+	_give_deprecated_function(__FUNCTION__, '1.8.12', 'give_payment_gateway_donation_summary', $backtrace);
608 608
 
609 609
 	give_payment_gateway_donation_summary($purchase_data, $email);
610 610
 
Please login to merge, or discard this patch.
includes/misc-functions.php 1 patch
Spacing   +232 added lines, -232 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,9 +23,9 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function give_is_test_mode() {
25 25
 
26
-	$ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );
26
+	$ret = give_is_setting_enabled(give_get_option('test_mode'));
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 
40
-	$currency = give_get_option( 'currency', 'USD' );
40
+	$currency = give_get_option('currency', 'USD');
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 
54
-	$currency_pos = give_get_option( 'currency_position', 'before' );
54
+	$currency_pos = give_get_option('currency_position', 'before');
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => __( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => __( 'Euros (€)', 'give' ),
71
-		'GBP'  => __( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => __( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => __( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => __( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => __( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => __( 'Danish Krone (kr.)', 'give' ),
77
-		'HKD'  => __( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => __( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => __( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => __( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => __( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => __( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => __( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => __( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => __( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => __( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => __( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => __( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => __( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => __( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => __( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => __( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => __( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => __( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => __( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => __( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => __( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => __( 'Russian Rubles (руб)', 'give' ),
69
+		'USD'  => __('US Dollars ($)', 'give'),
70
+		'EUR'  => __('Euros (€)', 'give'),
71
+		'GBP'  => __('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => __('Australian Dollars ($)', 'give'),
73
+		'BRL'  => __('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => __('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => __('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => __('Danish Krone (kr.)', 'give'),
77
+		'HKD'  => __('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => __('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => __('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => __('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => __('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => __('Mexican Peso ($)', 'give'),
83
+		'MAD'  => __('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => __('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => __('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => __('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => __('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => __('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => __('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => __('South African Rand (R)', 'give'),
91
+		'SEK'  => __('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => __('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => __('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => __('Thai Baht (฿)', 'give'),
95
+		'INR'  => __('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => __('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => __('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => __('Russian Rubles (руб)', 'give'),
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
  *
116 116
  * @return string           The symbol to use for the currency
117 117
  */
118
-function give_currency_symbol( $currency = '', $decode_currency = false ) {
118
+function give_currency_symbol($currency = '', $decode_currency = false) {
119 119
 
120
-	if ( empty( $currency ) ) {
120
+	if (empty($currency)) {
121 121
 		$currency = give_get_currency();
122 122
 	}
123
-	switch ( $currency ) :
123
+	switch ($currency) :
124 124
 		case 'GBP' :
125 125
 			$symbol = '&pound;';
126 126
 			break;
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 			break;
199 199
 	endswitch;
200 200
 
201
-	$symbol = ( ! $decode_currency ? $symbol : html_entity_decode( $symbol ) );
201
+	$symbol = ( ! $decode_currency ? $symbol : html_entity_decode($symbol));
202 202
 
203
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
203
+	return apply_filters('give_currency_symbol', $symbol, $currency);
204 204
 }
205 205
 
206 206
 
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
  *
214 214
  * @return string
215 215
  */
216
-function give_get_currency_name( $currency_code ) {
216
+function give_get_currency_name($currency_code) {
217 217
 	$currency_name  = '';
218 218
 	$currency_names = give_get_currencies();
219 219
 
220
-	if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) {
221
-		$currency_name = explode( '(', $currency_names[ $currency_code ] );
222
-		$currency_name = trim( current( $currency_name ) );
220
+	if ($currency_code && array_key_exists($currency_code, $currency_names)) {
221
+		$currency_name = explode('(', $currency_names[$currency_code]);
222
+		$currency_name = trim(current($currency_name));
223 223
 	}
224 224
 
225
-	return apply_filters( 'give_currency_name', $currency_name, $currency_code );
225
+	return apply_filters('give_currency_name', $currency_name, $currency_code);
226 226
 }
227 227
 
228 228
 
@@ -236,21 +236,21 @@  discard block
 block discarded – undo
236 236
 
237 237
 	global $wp;
238 238
 
239
-	if ( get_option( 'permalink_structure' ) ) {
240
-		$base = trailingslashit( home_url( $wp->request ) );
239
+	if (get_option('permalink_structure')) {
240
+		$base = trailingslashit(home_url($wp->request));
241 241
 	} else {
242
-		$base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );
243
-		$base = remove_query_arg( array( 'post_type', 'name' ), $base );
242
+		$base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));
243
+		$base = remove_query_arg(array('post_type', 'name'), $base);
244 244
 	}
245 245
 
246 246
 	$scheme      = is_ssl() ? 'https' : 'http';
247
-	$current_uri = set_url_scheme( $base, $scheme );
247
+	$current_uri = set_url_scheme($base, $scheme);
248 248
 
249
-	if ( is_front_page() ) {
250
-		$current_uri = home_url( '/' );
249
+	if (is_front_page()) {
250
+		$current_uri = home_url('/');
251 251
 	}
252 252
 
253
-	return apply_filters( 'give_get_current_page_url', $current_uri );
253
+	return apply_filters('give_get_current_page_url', $current_uri);
254 254
 
255 255
 }
256 256
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	$gateways = give_get_enabled_payment_gateways();
274 274
 
275
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
275
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
276 276
 		$ret = true;
277
-	} elseif ( count( $gateways ) == 1 ) {
277
+	} elseif (count($gateways) == 1) {
278 278
 		$ret = false;
279
-	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
279
+	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
280 280
 		$ret = false;
281 281
 	}
282 282
 
283
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
283
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
284 284
 }
285 285
 
286 286
 /**
@@ -292,26 +292,26 @@  discard block
 block discarded – undo
292 292
 function give_get_timezone_id() {
293 293
 
294 294
 	// if site timezone string exists, return it.
295
-	if ( $timezone = get_option( 'timezone_string' ) ) {
295
+	if ($timezone = get_option('timezone_string')) {
296 296
 		return $timezone;
297 297
 	}
298 298
 
299 299
 	// get UTC offset, if it isn't set return UTC.
300
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
300
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
301 301
 		return 'UTC';
302 302
 	}
303 303
 
304 304
 	// attempt to guess the timezone string from the UTC offset.
305
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
305
+	$timezone = timezone_name_from_abbr('', $utc_offset);
306 306
 
307 307
 	// last try, guess timezone string manually.
308
-	if ( $timezone === false ) {
308
+	if ($timezone === false) {
309 309
 
310
-		$is_dst = date( 'I' );
310
+		$is_dst = date('I');
311 311
 
312
-		foreach ( timezone_abbreviations_list() as $abbr ) {
313
-			foreach ( $abbr as $city ) {
314
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
312
+		foreach (timezone_abbreviations_list() as $abbr) {
313
+			foreach ($abbr as $city) {
314
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
315 315
 					return $city['timezone_id'];
316 316
 				}
317 317
 			}
@@ -335,17 +335,17 @@  discard block
 block discarded – undo
335 335
 
336 336
 	$ip = '127.0.0.1';
337 337
 
338
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
338
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
339 339
 		// check ip from share internet
340 340
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
341
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
341
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
342 342
 		// to check ip is pass from proxy
343 343
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
344
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
344
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
345 345
 		$ip = $_SERVER['REMOTE_ADDR'];
346 346
 	}
347 347
 
348
-	return apply_filters( 'give_get_ip', $ip );
348
+	return apply_filters('give_get_ip', $ip);
349 349
 }
350 350
 
351 351
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
  *
361 361
  * @uses  Give()->session->set()
362 362
  */
363
-function give_set_purchase_session( $purchase_data = array() ) {
364
-	Give()->session->set( 'give_purchase', $purchase_data );
365
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
363
+function give_set_purchase_session($purchase_data = array()) {
364
+	Give()->session->set('give_purchase', $purchase_data);
365
+	Give()->session->set('give_email', $purchase_data['user_email']);
366 366
 }
367 367
 
368 368
 /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
  * @return mixed array | false
377 377
  */
378 378
 function give_get_purchase_session() {
379
-	return Give()->session->get( 'give_purchase' );
379
+	return Give()->session->get('give_purchase');
380 380
 }
381 381
 
382 382
 /**
@@ -392,39 +392,39 @@  discard block
 block discarded – undo
392 392
  *
393 393
  * @return string
394 394
  */
395
-function give_payment_gateway_donation_summary( $donation_data, $email = true, $length = 255 ) {
395
+function give_payment_gateway_donation_summary($donation_data, $email = true, $length = 255) {
396 396
 
397 397
 	$summary = '';
398 398
 
399
-	$form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';
399
+	$form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';
400 400
 
401 401
 	// Form title.
402
-	if ( isset( $donation_data['post_data']['give-form-title'] ) ) {
402
+	if (isset($donation_data['post_data']['give-form-title'])) {
403 403
 		$summary .= $donation_data['post_data']['give-form-title'];
404 404
 	}
405 405
 	// Form multilevel if applicable.
406
-	if ( isset( $donation_data['post_data']['give-price-id'] ) ) {
407
-		$summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );
406
+	if (isset($donation_data['post_data']['give-price-id'])) {
407
+		$summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);
408 408
 	}
409 409
 
410 410
 	// First name
411
-	if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) {
412
-		$summary .= ' - ' . $donation_data['user_info']['first_name'];
411
+	if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) {
412
+		$summary .= ' - '.$donation_data['user_info']['first_name'];
413 413
 	}
414 414
 
415
-	if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) {
416
-		$summary .= ' ' . $donation_data['user_info']['last_name'];
415
+	if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) {
416
+		$summary .= ' '.$donation_data['user_info']['last_name'];
417 417
 	}
418 418
 
419 419
 	// Add Donors email if requested.
420
-	if ( $email ) {
421
-		$summary .= ' (' . $donation_data['user_email'] . ')';
420
+	if ($email) {
421
+		$summary .= ' ('.$donation_data['user_email'].')';
422 422
 	}
423 423
 
424 424
 	// Cut the length
425
-	$summary = substr( $summary, 0, $length );
425
+	$summary = substr($summary, 0, $length);
426 426
 
427
-	return apply_filters( 'give_payment_gateway_donation_summary', $summary );
427
+	return apply_filters('give_payment_gateway_donation_summary', $summary);
428 428
 }
429 429
 
430 430
 
@@ -439,31 +439,31 @@  discard block
 block discarded – undo
439 439
 function give_get_host() {
440 440
 	$host = false;
441 441
 
442
-	if ( defined( 'WPE_APIKEY' ) ) {
442
+	if (defined('WPE_APIKEY')) {
443 443
 		$host = 'WP Engine';
444
-	} elseif ( defined( 'PAGELYBIN' ) ) {
444
+	} elseif (defined('PAGELYBIN')) {
445 445
 		$host = 'Pagely';
446
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
446
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
447 447
 		$host = 'ICDSoft';
448
-	} elseif ( DB_HOST == 'mysqlv5' ) {
448
+	} elseif (DB_HOST == 'mysqlv5') {
449 449
 		$host = 'NetworkSolutions';
450
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
450
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
451 451
 		$host = 'iPage';
452
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
452
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
453 453
 		$host = 'IPower';
454
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
454
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
455 455
 		$host = 'MediaTemple Grid';
456
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
456
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
457 457
 		$host = 'pair Networks';
458
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
458
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
459 459
 		$host = 'Rackspace Cloud';
460
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
460
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
461 461
 		$host = 'SysFix.eu Power Hosting';
462
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
462
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
463 463
 		$host = 'Flywheel';
464 464
 	} else {
465 465
 		// Adding a general fallback for data gathering
466
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
466
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
467 467
 	}
468 468
 
469 469
 	return $host;
@@ -479,67 +479,67 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return bool true if host matches, false if not
481 481
  */
482
-function give_is_host( $host = false ) {
482
+function give_is_host($host = false) {
483 483
 
484 484
 	$return = false;
485 485
 
486
-	if ( $host ) {
487
-		$host = str_replace( ' ', '', strtolower( $host ) );
486
+	if ($host) {
487
+		$host = str_replace(' ', '', strtolower($host));
488 488
 
489
-		switch ( $host ) {
489
+		switch ($host) {
490 490
 			case 'wpengine':
491
-				if ( defined( 'WPE_APIKEY' ) ) {
491
+				if (defined('WPE_APIKEY')) {
492 492
 					$return = true;
493 493
 				}
494 494
 				break;
495 495
 			case 'pagely':
496
-				if ( defined( 'PAGELYBIN' ) ) {
496
+				if (defined('PAGELYBIN')) {
497 497
 					$return = true;
498 498
 				}
499 499
 				break;
500 500
 			case 'icdsoft':
501
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
501
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
502 502
 					$return = true;
503 503
 				}
504 504
 				break;
505 505
 			case 'networksolutions':
506
-				if ( DB_HOST == 'mysqlv5' ) {
506
+				if (DB_HOST == 'mysqlv5') {
507 507
 					$return = true;
508 508
 				}
509 509
 				break;
510 510
 			case 'ipage':
511
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
511
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
512 512
 					$return = true;
513 513
 				}
514 514
 				break;
515 515
 			case 'ipower':
516
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
516
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
517 517
 					$return = true;
518 518
 				}
519 519
 				break;
520 520
 			case 'mediatemplegrid':
521
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
521
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
522 522
 					$return = true;
523 523
 				}
524 524
 				break;
525 525
 			case 'pairnetworks':
526
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
526
+				if (strpos(DB_HOST, '.pair.com') !== false) {
527 527
 					$return = true;
528 528
 				}
529 529
 				break;
530 530
 			case 'rackspacecloud':
531
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
531
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
532 532
 					$return = true;
533 533
 				}
534 534
 				break;
535 535
 			case 'sysfix.eu':
536 536
 			case 'sysfix.eupowerhosting':
537
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
537
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
538 538
 					$return = true;
539 539
 				}
540 540
 				break;
541 541
 			case 'flywheel':
542
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
542
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
543 543
 					$return = true;
544 544
 				}
545 545
 				break;
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
  * @param string $replacement Optional. The function that should have been called.
573 573
  * @param array  $backtrace   Optional. Contains stack backtrace of deprecated function.
574 574
  */
575
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
575
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
576 576
 
577 577
 	/**
578 578
 	 * Fires while give deprecated function call occurs.
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
 	 * @param string $replacement Optional. The function that should have been called.
586 586
 	 * @param string $version     The plugin version that deprecated the function.
587 587
 	 */
588
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
588
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
589 589
 
590
-	$show_errors = current_user_can( 'manage_options' );
590
+	$show_errors = current_user_can('manage_options');
591 591
 
592 592
 	// Allow plugin to filter the output error trigger.
593
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
594
-		if ( ! is_null( $replacement ) ) {
595
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
596
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
593
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
594
+		if ( ! is_null($replacement)) {
595
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
596
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
597 597
 			// Alternatively we could dump this to a file.
598 598
 		} else {
599
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
600
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
599
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
600
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
601 601
 			// Alternatively we could dump this to a file.
602 602
 		}
603 603
 	}
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
  * @return string $post_id
612 612
  */
613 613
 function give_get_admin_post_id() {
614
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
615
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
614
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
615
+	if ( ! $post_id && isset($_POST['post_id'])) {
616 616
 		$post_id = $_POST['post_id'];
617 617
 	}
618 618
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
  * @return string Arg separator output
627 627
  */
628 628
 function give_get_php_arg_separator_output() {
629
-	return ini_get( 'arg_separator.output' );
629
+	return ini_get('arg_separator.output');
630 630
 }
631 631
 
632 632
 
@@ -641,10 +641,10 @@  discard block
 block discarded – undo
641 641
  *
642 642
  * @return string Short month name
643 643
  */
644
-function give_month_num_to_name( $n ) {
645
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
644
+function give_month_num_to_name($n) {
645
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
646 646
 
647
-	return date_i18n( 'M', $timestamp );
647
+	return date_i18n('M', $timestamp);
648 648
 }
649 649
 
650 650
 
@@ -657,10 +657,10 @@  discard block
 block discarded – undo
657 657
  *
658 658
  * @return bool Whether or not function is disabled.
659 659
  */
660
-function give_is_func_disabled( $function ) {
661
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
660
+function give_is_func_disabled($function) {
661
+	$disabled = explode(',', ini_get('disable_functions'));
662 662
 
663
-	return in_array( $function, $disabled );
663
+	return in_array($function, $disabled);
664 664
 }
665 665
 
666 666
 
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 function give_get_newsletter() {
673 673
 	?>
674 674
 
675
-	<p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
675
+	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
676 676
 
677 677
 	<div class="give-newsletter-form-wrap">
678 678
 
@@ -680,33 +680,33 @@  discard block
 block discarded – undo
680 680
 		      method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"
681 681
 		      target="_blank" novalidate>
682 682
 			<div class="give-newsletter-confirmation">
683
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
683
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
684 684
 			</div>
685 685
 
686 686
 			<table class="form-table give-newsletter-form">
687 687
 				<tr valign="middle">
688 688
 					<td>
689 689
 						<label for="mce-EMAIL"
690
-						       class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>
690
+						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label>
691 691
 						<input type="email" name="EMAIL" id="mce-EMAIL"
692
-						       placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"
692
+						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>"
693 693
 						       class="required email" value="">
694 694
 					</td>
695 695
 					<td>
696 696
 						<label for="mce-FNAME"
697
-						       class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>
697
+						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label>
698 698
 						<input type="text" name="FNAME" id="mce-FNAME"
699
-						       placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">
699
+						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="">
700 700
 					</td>
701 701
 					<td>
702 702
 						<label for="mce-LNAME"
703
-						       class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>
703
+						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label>
704 704
 						<input type="text" name="LNAME" id="mce-LNAME"
705
-						       placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">
705
+						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value="">
706 706
 					</td>
707 707
 					<td>
708 708
 						<input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"
709
-						       value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">
709
+						       value="<?php esc_attr_e('Subscribe', 'give'); ?>">
710 710
 					</td>
711 711
 				</tr>
712 712
 			</table>
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
  *
759 759
  * @return string
760 760
  */
761
-function give_svg_icons( $icon ) {
761
+function give_svg_icons($icon) {
762 762
 
763 763
 	// Store your SVGs in an associative array
764 764
 	$svgs = array(
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	);
771 771
 
772 772
 	// Return the chosen icon's SVG string
773
-	return $svgs[ $icon ];
773
+	return $svgs[$icon];
774 774
 }
775 775
 
776 776
 /**
@@ -782,15 +782,15 @@  discard block
 block discarded – undo
782 782
  *
783 783
  * @return mixed
784 784
  */
785
-function modify_nav_menu_meta_box_object( $post_type ) {
786
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
787
-		$post_type->labels->name = esc_html__( 'Donation Forms', 'give' );
785
+function modify_nav_menu_meta_box_object($post_type) {
786
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
787
+		$post_type->labels->name = esc_html__('Donation Forms', 'give');
788 788
 	}
789 789
 
790 790
 	return $post_type;
791 791
 }
792 792
 
793
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
793
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
794 794
 
795 795
 /**
796 796
  * Enable 'Donation Form' meta enabled by default on Menu page.
@@ -800,22 +800,22 @@  discard block
 block discarded – undo
800 800
 function give_nav_donation_metabox_enabled() {
801 801
 
802 802
 	// Return false, if it fails to retrieve hidden meta box list and is not admin.
803
-	if ( ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) || ! is_admin() ) {
803
+	if (( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) || ! is_admin()) {
804 804
 		return false;
805 805
 	}
806 806
 
807 807
 	// Return false, In case, we don't find 'Donation Form' in hidden meta box list.
808
-	if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) {
808
+	if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) {
809 809
 		return false;
810 810
 	}
811 811
 
812 812
 	// Exclude 'Donation Form' value from hidden meta box's list.
813
-	$hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );
813
+	$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms'));
814 814
 
815 815
 	// Get current user ID.
816 816
 	$user = wp_get_current_user();
817 817
 
818
-	update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
818
+	update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
819 819
 }
820 820
 
821 821
 /**
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
  * @license    https://opensource.org/licenses/MIT MIT
830 830
  */
831 831
 
832
-if ( ! function_exists( 'array_column' ) ) {
832
+if ( ! function_exists('array_column')) {
833 833
 	/**
834 834
 	 * Returns the values from a single column of the input array, identified by
835 835
 	 * the $columnKey.
@@ -848,53 +848,53 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @return array
850 850
 	 */
851
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
851
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
852 852
 		// Using func_get_args() in order to check for proper number of
853 853
 		// parameters and trigger errors exactly as the built-in array_column()
854 854
 		// does in PHP 5.5.
855 855
 		$argc   = func_num_args();
856 856
 		$params = func_get_args();
857 857
 
858
-		if ( $argc < 2 ) {
859
-			trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );
858
+		if ($argc < 2) {
859
+			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING);
860 860
 
861 861
 			return null;
862 862
 		}
863 863
 
864
-		if ( ! is_array( $params[0] ) ) {
865
-			trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );
864
+		if ( ! is_array($params[0])) {
865
+			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING);
866 866
 
867 867
 			return null;
868 868
 		}
869 869
 
870
-		if ( ! is_int( $params[1] )
871
-		     && ! is_float( $params[1] )
872
-		     && ! is_string( $params[1] )
870
+		if ( ! is_int($params[1])
871
+		     && ! is_float($params[1])
872
+		     && ! is_string($params[1])
873 873
 		     && $params[1] !== null
874
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
874
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
875 875
 		) {
876
-			trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );
876
+			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING);
877 877
 
878 878
 			return false;
879 879
 		}
880 880
 
881
-		if ( isset( $params[2] )
882
-		     && ! is_int( $params[2] )
883
-		     && ! is_float( $params[2] )
884
-		     && ! is_string( $params[2] )
885
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
881
+		if (isset($params[2])
882
+		     && ! is_int($params[2])
883
+		     && ! is_float($params[2])
884
+		     && ! is_string($params[2])
885
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
886 886
 		) {
887
-			trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );
887
+			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING);
888 888
 
889 889
 			return false;
890 890
 		}
891 891
 
892 892
 		$paramsInput     = $params[0];
893
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
893
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
894 894
 
895 895
 		$paramsIndexKey = null;
896
-		if ( isset( $params[2] ) ) {
897
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
896
+		if (isset($params[2])) {
897
+			if (is_float($params[2]) || is_int($params[2])) {
898 898
 				$paramsIndexKey = (int) $params[2];
899 899
 			} else {
900 900
 				$paramsIndexKey = (string) $params[2];
@@ -903,26 +903,26 @@  discard block
 block discarded – undo
903 903
 
904 904
 		$resultArray = array();
905 905
 
906
-		foreach ( $paramsInput as $row ) {
906
+		foreach ($paramsInput as $row) {
907 907
 			$key    = $value = null;
908 908
 			$keySet = $valueSet = false;
909 909
 
910
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
910
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
911 911
 				$keySet = true;
912
-				$key    = (string) $row[ $paramsIndexKey ];
912
+				$key    = (string) $row[$paramsIndexKey];
913 913
 			}
914 914
 
915
-			if ( $paramsColumnKey === null ) {
915
+			if ($paramsColumnKey === null) {
916 916
 				$valueSet = true;
917 917
 				$value    = $row;
918
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
918
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
919 919
 				$valueSet = true;
920
-				$value    = $row[ $paramsColumnKey ];
920
+				$value    = $row[$paramsColumnKey];
921 921
 			}
922 922
 
923
-			if ( $valueSet ) {
924
-				if ( $keySet ) {
925
-					$resultArray[ $key ] = $value;
923
+			if ($valueSet) {
924
+				if ($keySet) {
925
+					$resultArray[$key] = $value;
926 926
 				} else {
927 927
 					$resultArray[] = $value;
928 928
 				}
@@ -942,40 +942,40 @@  discard block
 block discarded – undo
942 942
  *
943 943
  * @return bool Whether the receipt is visible or not.
944 944
  */
945
-function give_can_view_receipt( $payment_key = '' ) {
945
+function give_can_view_receipt($payment_key = '') {
946 946
 
947 947
 	$return = false;
948 948
 
949
-	if ( empty( $payment_key ) ) {
949
+	if (empty($payment_key)) {
950 950
 		return $return;
951 951
 	}
952 952
 
953 953
 	global $give_receipt_args;
954 954
 
955
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
955
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
956 956
 
957
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
957
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
958 958
 
959
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
959
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
960 960
 
961
-	if ( is_user_logged_in() ) {
962
-		if ( $user_id === (int) get_current_user_id() ) {
961
+	if (is_user_logged_in()) {
962
+		if ($user_id === (int) get_current_user_id()) {
963 963
 			$return = true;
964
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
964
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
965 965
 			$return = true;
966
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
966
+		} elseif (current_user_can('view_give_sensitive_data')) {
967 967
 			$return = true;
968 968
 		}
969 969
 	}
970 970
 
971 971
 	$session = give_get_purchase_session();
972
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
973
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
972
+	if ( ! empty($session) && ! is_user_logged_in()) {
973
+		if ($session['purchase_key'] === $payment_meta['key']) {
974 974
 			$return = true;
975 975
 		}
976 976
 	}
977 977
 
978
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
978
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
979 979
 
980 980
 }
981 981
 
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
  *
985 985
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
986 986
  */
987
-if ( ! function_exists( 'cal_days_in_month' ) ) {
987
+if ( ! function_exists('cal_days_in_month')) {
988 988
 	/**
989 989
 	 * cal_days_in_month
990 990
 	 *
@@ -994,8 +994,8 @@  discard block
 block discarded – undo
994 994
 	 *
995 995
 	 * @return bool|string
996 996
 	 */
997
-	function cal_days_in_month( $calendar, $month, $year ) {
998
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
997
+	function cal_days_in_month($calendar, $month, $year) {
998
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
999 999
 	}
1000 1000
 }
1001 1001
 
@@ -1014,42 +1014,42 @@  discard block
 block discarded – undo
1014 1014
  */
1015 1015
 function give_get_plugins() {
1016 1016
 	$plugins             = get_plugins();
1017
-	$active_plugin_paths = (array) get_option( 'active_plugins', array() );
1017
+	$active_plugin_paths = (array) get_option('active_plugins', array());
1018 1018
 
1019
-	if ( is_multisite() ) {
1020
-		$network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
1021
-		$active_plugin_paths            = array_merge( $active_plugin_paths, $network_activated_plugin_paths );
1019
+	if (is_multisite()) {
1020
+		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array()));
1021
+		$active_plugin_paths            = array_merge($active_plugin_paths, $network_activated_plugin_paths);
1022 1022
 	}
1023 1023
 
1024
-	foreach ( $plugins as $plugin_path => $plugin_data ) {
1024
+	foreach ($plugins as $plugin_path => $plugin_data) {
1025 1025
 		// Is plugin active?
1026
-		if ( in_array( $plugin_path, $active_plugin_paths ) ) {
1027
-			$plugins[ $plugin_path ]['Status'] = 'active';
1026
+		if (in_array($plugin_path, $active_plugin_paths)) {
1027
+			$plugins[$plugin_path]['Status'] = 'active';
1028 1028
 		} else {
1029
-			$plugins[ $plugin_path ]['Status'] = 'inactive';
1029
+			$plugins[$plugin_path]['Status'] = 'inactive';
1030 1030
 		}
1031 1031
 
1032
-		$dirname = strtolower( dirname( $plugin_path ) );
1032
+		$dirname = strtolower(dirname($plugin_path));
1033 1033
 
1034 1034
 		// Is plugin a Give add-on by WordImpress?
1035
-		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) {
1035
+		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) {
1036 1036
 			// Plugin is a Give-addon.
1037
-			$plugins[ $plugin_path ]['Type'] = 'add-on';
1037
+			$plugins[$plugin_path]['Type'] = 'add-on';
1038 1038
 
1039 1039
 			// Get license info from database.
1040
-			$plugin_name    = str_replace( 'Give - ', '', $plugin_data['Name'] );
1041
-			$db_option      = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';
1042
-			$license_active = get_option( $db_option );
1040
+			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']);
1041
+			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active';
1042
+			$license_active = get_option($db_option);
1043 1043
 
1044 1044
 			// Does a valid license exist?
1045
-			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) {
1046
-				$plugins[ $plugin_path ]['License'] = true;
1045
+			if ( ! empty($license_active) && 'valid' === $license_active->license) {
1046
+				$plugins[$plugin_path]['License'] = true;
1047 1047
 			} else {
1048
-				$plugins[ $plugin_path ]['License'] = false;
1048
+				$plugins[$plugin_path]['License'] = false;
1049 1049
 			}
1050 1050
 		} else {
1051 1051
 			// Plugin is not a Give add-on.
1052
-			$plugins[ $plugin_path ]['Type'] = 'other';
1052
+			$plugins[$plugin_path]['Type'] = 'other';
1053 1053
 		}
1054 1054
 	}
1055 1055
 
@@ -1066,16 +1066,16 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return bool
1068 1068
  */
1069
-function give_is_terms_enabled( $form_id ) {
1070
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1069
+function give_is_terms_enabled($form_id) {
1070
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1071 1071
 
1072 1072
 	if (
1073
-		give_is_setting_enabled( $form_option, 'global' )
1074
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1073
+		give_is_setting_enabled($form_option, 'global')
1074
+		&& give_is_setting_enabled(give_get_option('terms'))
1075 1075
 	) {
1076 1076
 		return true;
1077 1077
 
1078
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1078
+	} elseif (give_is_setting_enabled($form_option)) {
1079 1079
 		return true;
1080 1080
 
1081 1081
 	} else {
@@ -1099,9 +1099,9 @@  discard block
 block discarded – undo
1099 1099
  *
1100 1100
  * @return WP_Error|bool
1101 1101
  */
1102
-function give_delete_donation_stats( $date_range = '', $args = array() ) {
1102
+function give_delete_donation_stats($date_range = '', $args = array()) {
1103 1103
 	// Delete all cache.
1104
-	$status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );
1104
+	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats'));
1105 1105
 
1106 1106
 	/**
1107 1107
 	 * Fire the action when donation stats delete.
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 	 * @param string|array $date_range
1112 1112
 	 * @param array        $args
1113 1113
 	 */
1114
-	do_action( 'give_delete_donation_stats', $status, $date_range, $args );
1114
+	do_action('give_delete_donation_stats', $status, $date_range, $args);
1115 1115
 
1116 1116
 	return $status;
1117 1117
 }
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return mixed
1131 1131
  */
1132
-function give_get_meta( $id, $meta_key, $single = false, $default = false ) {
1132
+function give_get_meta($id, $meta_key, $single = false, $default = false) {
1133 1133
 	/**
1134 1134
 	 * Filter the meta value
1135 1135
 	 *
@@ -1137,14 +1137,14 @@  discard block
 block discarded – undo
1137 1137
 	 */
1138 1138
 	$meta_value = apply_filters(
1139 1139
 		'give_get_meta',
1140
-		get_post_meta( $id, $meta_key, $single ),
1140
+		get_post_meta($id, $meta_key, $single),
1141 1141
 		$id,
1142 1142
 		$meta_key,
1143 1143
 		$default
1144 1144
 	);
1145 1145
 
1146 1146
 	if (
1147
-		( empty( $meta_key ) || empty( $meta_value ) )
1147
+		(empty($meta_key) || empty($meta_value))
1148 1148
 		&& $default
1149 1149
 	) {
1150 1150
 		$meta_value = $default;
@@ -1165,15 +1165,15 @@  discard block
 block discarded – undo
1165 1165
  *
1166 1166
  * @return mixed
1167 1167
  */
1168
-function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) {
1169
-	$status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );
1168
+function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') {
1169
+	$status = update_post_meta($id, $meta_key, $meta_value, $prev_value);
1170 1170
 
1171 1171
 	/**
1172 1172
 	 * Filter the meta value update status
1173 1173
 	 *
1174 1174
 	 * @since 1.8.8
1175 1175
 	 */
1176
-	return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );
1176
+	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value);
1177 1177
 }
1178 1178
 
1179 1179
 /**
@@ -1187,13 +1187,13 @@  discard block
 block discarded – undo
1187 1187
  *
1188 1188
  * @return mixed
1189 1189
  */
1190
-function give_delete_meta( $id, $meta_key, $meta_value = '' ) {
1191
-	$status = delete_post_meta( $id, $meta_key, $meta_value );
1190
+function give_delete_meta($id, $meta_key, $meta_value = '') {
1191
+	$status = delete_post_meta($id, $meta_key, $meta_value);
1192 1192
 
1193 1193
 	/**
1194 1194
 	 * Filter the meta value delete status
1195 1195
 	 *
1196 1196
 	 * @since 1.8.8
1197 1197
 	 */
1198
-	return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );
1198
+	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value);
1199 1199
 }
Please login to merge, or discard this patch.
includes/admin/payments/class-payments-table.php 1 patch
Spacing   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded.
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 	public function __construct() {
127 127
 
128 128
 		// Set parent defaults.
129
-		parent::__construct( array(
130
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
131
-			'plural'   => give_get_forms_label_plural(),      // Plural name of the listed records.
132
-			'ajax'     => false,                              // Does this table support ajax?
133
-		) );
129
+		parent::__construct(array(
130
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
131
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
132
+			'ajax'     => false, // Does this table support ajax?
133
+		));
134 134
 
135 135
 		$this->process_bulk_action();
136 136
 		$this->get_payment_counts();
137
-		$this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
137
+		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
138 138
 	}
139 139
 
140 140
 	/**
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	 * @return void
144 144
 	 */
145 145
 	public function advanced_filters() {
146
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
147
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null;
148
-		$status     = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
149
-		$donor      = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : '';
150
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
151
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
146
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
147
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null;
148
+		$status     = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : '';
149
+		$donor      = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : '';
150
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : '';
151
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0;
152 152
 		?>
153 153
 		<div id="give-payment-filters" class="give-filters">
154
-			<?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?>
154
+			<?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?>
155 155
 			<div id="give-payment-date-filters">
156 156
 				<div class="give-filter give-filter-half">
157 157
 					<label for="start-date"
158
-					       class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label>
158
+					       class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label>
159 159
 					<input type="text" id="start-date" name="start-date" class="give_datepicker"
160 160
 				       value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" />
161 161
 				</div>
162 162
 				<div class="give-filter give-filter-half">
163
-					<label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label>
163
+					<label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label>
164 164
 					<input type="text" id="end-date" name="end-date" class="give_datepicker"
165 165
 				       value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" />
166 166
 		       </div>
167 167
 			</div>
168 168
 			<div id="give-payment-form-filter" class="give-filter">
169 169
 				<label for="-date"
170
-				       class="give-start-date-label"><?php esc_html_e( 'Form', 'give' ); ?></label>
170
+				       class="give-start-date-label"><?php esc_html_e('Form', 'give'); ?></label>
171 171
 				<?php
172 172
 				// Filter Donations by Donation Forms.
173
-				echo Give()->html->forms_dropdown( array(
173
+				echo Give()->html->forms_dropdown(array(
174 174
 					'name'     => 'form_id',
175 175
 					'class'    => 'give-donation-forms-filter',
176 176
 					'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection.
177 177
 					'chosen'   => true,
178
-					'number'   => - 1,
179
-				) );
178
+					'number'   => -1,
179
+				));
180 180
 				?>
181 181
 			</div>
182 182
 
183
-			<?php if ( ! empty( $status ) ) : ?>
184
-				<input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" />
183
+			<?php if ( ! empty($status)) : ?>
184
+				<input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" />
185 185
 			<?php endif; ?>
186 186
 
187 187
 			<div class="give-filter">
188
-				<?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?>
188
+				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?>
189 189
 				<?php
190 190
 				// Clear active filters button.
191
-				if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?>
192
-					<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"
193
-					   class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a>
191
+				if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?>
192
+					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"
193
+					   class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a>
194 194
 				<?php endif; ?>
195 195
 			</div>
196 196
 		</div>
@@ -209,18 +209,18 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return void
211 211
 	 */
212
-	public function search_box( $text, $input_id ) {
213
-		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
212
+	public function search_box($text, $input_id) {
213
+		if (empty($_REQUEST['s']) && ! $this->has_items()) {
214 214
 			return;
215 215
 		}
216 216
 
217
-		$input_id = $input_id . '-search-input';
217
+		$input_id = $input_id.'-search-input';
218 218
 
219
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
220
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
219
+		if ( ! empty($_REQUEST['orderby'])) {
220
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
221 221
 		}
222
-		if ( ! empty( $_REQUEST['order'] ) ) {
223
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
222
+		if ( ! empty($_REQUEST['order'])) {
223
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
224 224
 		}
225 225
 		?>
226 226
 		<div class="give-filter give-filter-search" role="search">
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.7
234 234
 			 */
235
-			do_action( 'give_payment_history_search' );
235
+			do_action('give_payment_history_search');
236 236
 			?>
237 237
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
238 238
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
239
-			<?php submit_button( $text, 'button', false, false, array(
239
+			<?php submit_button($text, 'button', false, false, array(
240 240
 				'ID' => 'search-submit',
241
-			) ); ?><br />
241
+			)); ?><br />
242 242
 		</div>
243 243
 		<?php
244 244
 	}
@@ -252,48 +252,48 @@  discard block
 block discarded – undo
252 252
 	 */
253 253
 	public function get_views() {
254 254
 
255
-		$current = isset( $_GET['status'] ) ? $_GET['status'] : '';
255
+		$current = isset($_GET['status']) ? $_GET['status'] : '';
256 256
 		$views   = array();
257 257
 		$tabs    = array(
258 258
 			'all'        => array(
259 259
 				'total_count',
260
-				esc_html__( 'All', 'give' ),
260
+				esc_html__('All', 'give'),
261 261
 			),
262 262
 			'publish'    => array(
263 263
 				'complete_count',
264
-				esc_html__( 'Completed', 'give' ),
264
+				esc_html__('Completed', 'give'),
265 265
 			),
266 266
 			'pending'    => array(
267 267
 				'pending_count',
268
-				esc_html__( 'Pending', 'give' ),
268
+				esc_html__('Pending', 'give'),
269 269
 			),
270 270
 			'processing' => array(
271 271
 				'processing_count',
272
-				esc_html__( 'Processing', 'give' ),
272
+				esc_html__('Processing', 'give'),
273 273
 			),
274 274
 			'refunded'   => array(
275 275
 				'refunded_count',
276
-				esc_html__( 'Refunded', 'give' ),
276
+				esc_html__('Refunded', 'give'),
277 277
 			),
278 278
 			'revoked'    => array(
279 279
 				'revoked_count',
280
-				esc_html__( 'Revoked', 'give' ),
280
+				esc_html__('Revoked', 'give'),
281 281
 			),
282 282
 			'failed'     => array(
283 283
 				'failed_count',
284
-				esc_html__( 'Failed', 'give' ),
284
+				esc_html__('Failed', 'give'),
285 285
 			),
286 286
 			'cancelled'  => array(
287 287
 				'cancelled_count',
288
-				esc_html__( 'Cancelled', 'give' ),
288
+				esc_html__('Cancelled', 'give'),
289 289
 			),
290 290
 			'abandoned'  => array(
291 291
 				'abandoned_count',
292
-				esc_html__( 'Abandoned', 'give' ),
292
+				esc_html__('Abandoned', 'give'),
293 293
 			),
294 294
 		);
295 295
 
296
-		foreach ( $tabs as $key => $tab ) {
296
+		foreach ($tabs as $key => $tab) {
297 297
 			$count_key = $tab[0];
298 298
 			$name      = $tab[1];
299 299
 			$count     = $this->$count_key;
@@ -308,19 +308,19 @@  discard block
 block discarded – undo
308 308
 			 * @param string $key   Current view tab value.
309 309
 			 * @param int    $count Number of donation inside the tab.
310 310
 			 */
311
-			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) {
311
+			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) {
312 312
 
313
-				$views[ $key ] = sprintf(
313
+				$views[$key] = sprintf(
314 314
 					'<a href="%s" %s >%s&nbsp;<span class="count">(%s)</span></a>',
315
-					esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ) ) ),
316
-					( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '',
315
+					esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false))),
316
+					(('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '',
317 317
 					$name,
318 318
 					$count
319 319
 				);
320 320
 			}
321 321
 		}
322 322
 
323
-		return apply_filters( 'give_payments_table_views', $views );
323
+		return apply_filters('give_payments_table_views', $views);
324 324
 	}
325 325
 
326 326
 	/**
@@ -333,15 +333,15 @@  discard block
 block discarded – undo
333 333
 	public function get_columns() {
334 334
 		$columns = array(
335 335
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
336
-			'donation'      => esc_html__( 'Donation', 'give' ),
337
-			'donation_form' => esc_html__( 'Donation Form', 'give' ),
338
-			'status'        => esc_html__( 'Status', 'give' ),
339
-			'date'          => esc_html__( 'Date', 'give' ),
340
-			'amount'        => esc_html__( 'Amount', 'give' ),
341
-			'details'       => esc_html__( 'Details', 'give' ),
336
+			'donation'      => esc_html__('Donation', 'give'),
337
+			'donation_form' => esc_html__('Donation Form', 'give'),
338
+			'status'        => esc_html__('Status', 'give'),
339
+			'date'          => esc_html__('Date', 'give'),
340
+			'amount'        => esc_html__('Amount', 'give'),
341
+			'details'       => esc_html__('Details', 'give'),
342 342
 		);
343 343
 
344
-		return apply_filters( 'give_payments_table_columns', $columns );
344
+		return apply_filters('give_payments_table_columns', $columns);
345 345
 	}
346 346
 
347 347
 	/**
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function get_sortable_columns() {
355 355
 		$columns = array(
356
-			'donation'      => array( 'ID', true ),
357
-			'donation_form' => array( 'donation_form', false ),
358
-			'status'        => array( 'status', false ),
359
-			'amount'        => array( 'amount', false ),
360
-			'date'          => array( 'date', false ),
356
+			'donation'      => array('ID', true),
357
+			'donation_form' => array('donation_form', false),
358
+			'status'        => array('status', false),
359
+			'amount'        => array('amount', false),
360
+			'date'          => array('date', false),
361 361
 		);
362 362
 
363
-		return apply_filters( 'give_payments_table_sortable_columns', $columns );
363
+		return apply_filters('give_payments_table_sortable_columns', $columns);
364 364
 	}
365 365
 
366 366
 	/**
@@ -386,55 +386,55 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @return string Column Name
388 388
 	 */
389
-	public function column_default( $payment, $column_name ) {
389
+	public function column_default($payment, $column_name) {
390 390
 
391
-		$single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) );
392
-		$row_actions         = $this->get_row_actions( $payment );
391
+		$single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details')));
392
+		$row_actions         = $this->get_row_actions($payment);
393 393
 
394
-		switch ( $column_name ) {
394
+		switch ($column_name) {
395 395
 			case 'donation' :
396
-				$value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) );
397
-				$value .= $this->get_donor_email( $payment );
398
-				$value .= $this->row_actions( $row_actions );
396
+				$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a>&nbsp;%4$s&nbsp;%5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment));
397
+				$value .= $this->get_donor_email($payment);
398
+				$value .= $this->row_actions($row_actions);
399 399
 				break;
400 400
 
401 401
 			case 'amount' :
402
-				$amount = ! empty( $payment->total ) ? $payment->total : 0;
403
-				$value  = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) );
404
-				$value  .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
402
+				$amount = ! empty($payment->total) ? $payment->total : 0;
403
+				$value  = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID));
404
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
405 405
 				break;
406 406
 
407 407
 			case 'donation_form' :
408
-				$form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title;
409
-				$value      = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>';
410
-				$level      = give_get_payment_form_title( $payment->meta, true );
408
+				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title;
409
+				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>';
410
+				$level      = give_get_payment_form_title($payment->meta, true);
411 411
 
412
-				if ( ! empty( $level ) ) {
412
+				if ( ! empty($level)) {
413 413
 					$value .= $level;
414 414
 				}
415 415
 
416 416
 				break;
417 417
 
418 418
 			case 'date' :
419
-				$date  = strtotime( $payment->date );
420
-				$value = date_i18n( give_date_format(), $date );
419
+				$date  = strtotime($payment->date);
420
+				$value = date_i18n(give_date_format(), $date);
421 421
 				break;
422 422
 
423 423
 			case 'status' :
424
-				$value = $this->get_payment_status( $payment );
424
+				$value = $this->get_payment_status($payment);
425 425
 				break;
426 426
 
427 427
 			case 'details' :
428
-				$value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) );
428
+				$value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID));
429 429
 				break;
430 430
 
431 431
 			default:
432
-				$value = isset( $payment->$column_name ) ? $payment->$column_name : '';
432
+				$value = isset($payment->$column_name) ? $payment->$column_name : '';
433 433
 				break;
434 434
 
435 435
 		}// End switch().
436 436
 
437
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name );
437
+		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name);
438 438
 	}
439 439
 
440 440
 	/**
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @return string                Data shown in the Email column
449 449
 	 */
450
-	public function get_donor_email( $payment ) {
450
+	public function get_donor_email($payment) {
451 451
 
452
-		$email = give_get_payment_user_email( $payment->ID );
452
+		$email = give_get_payment_user_email($payment->ID);
453 453
 
454
-		if ( empty( $email ) ) {
455
-			$email = esc_html__( '(unknown)', 'give' );
454
+		if (empty($email)) {
455
+			$email = esc_html__('(unknown)', 'give');
456 456
 		}
457 457
 
458
-		$value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>';
458
+		$value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>';
459 459
 
460
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' );
460
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email');
461 461
 	}
462 462
 
463 463
 	/**
@@ -469,32 +469,32 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @return array $actions
471 471
 	 */
472
-	function get_row_actions( $payment ) {
472
+	function get_row_actions($payment) {
473 473
 
474 474
 		$actions = array();
475
-		$email   = give_get_payment_user_email( $payment->ID );
475
+		$email   = give_get_payment_user_email($payment->ID);
476 476
 
477 477
 		// Add search term string back to base URL.
478
-		$search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' );
479
-		if ( ! empty( $search_terms ) ) {
480
-			$this->base_url = add_query_arg( 's', $search_terms, $this->base_url );
478
+		$search_terms = (isset($_GET['s']) ? trim($_GET['s']) : '');
479
+		if ( ! empty($search_terms)) {
480
+			$this->base_url = add_query_arg('s', $search_terms, $this->base_url);
481 481
 		}
482 482
 
483
-		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) {
483
+		if (give_is_payment_complete($payment->ID) && ! empty($email)) {
484 484
 
485
-			$actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
485
+			$actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
486 486
 				'give-action' => 'email_links',
487 487
 				'purchase_id' => $payment->ID,
488
-			), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) );
488
+			), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give'));
489 489
 
490 490
 		}
491 491
 
492
-		$actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array(
492
+		$actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array(
493 493
 			'give-action' => 'delete_payment',
494 494
 			'purchase_id' => $payment->ID,
495
-		), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) );
495
+		), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give'));
496 496
 
497
-		return apply_filters( 'give_payment_row_actions', $actions, $payment );
497
+		return apply_filters('give_payment_row_actions', $actions, $payment);
498 498
 	}
499 499
 
500 500
 
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return string                Data shown in the Email column
510 510
 	 */
511
-	function get_payment_status( $payment ) {
512
-		$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
513
-		if ( $payment->mode == 'test' ) {
514
-			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>';
511
+	function get_payment_status($payment) {
512
+		$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
513
+		if ($payment->mode == 'test') {
514
+			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>';
515 515
 		}
516 516
 
517 517
 		return $value;
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return string Displays a checkbox.
529 529
 	 */
530
-	public function column_cb( $payment ) {
531
-		return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID );
530
+	public function column_cb($payment) {
531
+		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID);
532 532
 	}
533 533
 
534 534
 	/**
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 *
542 542
 	 * @return string Displays a checkbox.
543 543
 	 */
544
-	public function get_payment_id( $payment ) {
545
-		return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>';
544
+	public function get_payment_id($payment) {
545
+		return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>';
546 546
 	}
547 547
 
548 548
 	/**
@@ -555,32 +555,32 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @return string Data shown in the User column
557 557
 	 */
558
-	public function get_donor( $payment ) {
558
+	public function get_donor($payment) {
559 559
 
560
-		$donor_id           = give_get_payment_donor_id( $payment->ID );
561
-		$donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' );
562
-		$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
560
+		$donor_id           = give_get_payment_donor_id($payment->ID);
561
+		$donor_billing_name = give_get_donor_name_by($payment->ID, 'donation');
562
+		$donor_name         = give_get_donor_name_by($donor_id, 'donor');
563 563
 
564 564
 		$value = '';
565
-		if ( ! empty( $donor_id ) ) {
565
+		if ( ! empty($donor_id)) {
566 566
 
567 567
 			// Check whether the donor name and WP_User name is same or not.
568
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
569
-				$value .= $donor_billing_name . ' (';
568
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
569
+				$value .= $donor_billing_name.' (';
570 570
 			}
571 571
 
572
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>';
572
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>';
573 573
 
574 574
 			// Check whether the donor name and WP_User name is same or not.
575
-			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) {
575
+			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) {
576 576
 				$value .= ')';
577 577
 			}
578 578
 		} else {
579
-			$email = give_get_payment_user_email( $payment->ID );
580
-			$value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>';
579
+			$email = give_get_payment_user_email($payment->ID);
580
+			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>';
581 581
 		}
582 582
 
583
-		return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' );
583
+		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor');
584 584
 	}
585 585
 
586 586
 	/**
@@ -592,20 +592,20 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function get_bulk_actions() {
594 594
 		$actions = array(
595
-			'delete'                 => __( 'Delete', 'give' ),
596
-			'set-status-publish'     => __( 'Set To Completed', 'give' ),
597
-			'set-status-pending'     => __( 'Set To Pending', 'give' ),
598
-			'set-status-processing'  => __( 'Set To Processing', 'give' ),
599
-			'set-status-refunded'    => __( 'Set To Refunded', 'give' ),
600
-			'set-status-revoked'     => __( 'Set To Revoked', 'give' ),
601
-			'set-status-failed'      => __( 'Set To Failed', 'give' ),
602
-			'set-status-cancelled'   => __( 'Set To Cancelled', 'give' ),
603
-			'set-status-abandoned'   => __( 'Set To Abandoned', 'give' ),
604
-			'set-status-preapproval' => __( 'Set To Preapproval', 'give' ),
605
-			'resend-receipt'         => __( 'Resend Email Receipts', 'give' ),
595
+			'delete'                 => __('Delete', 'give'),
596
+			'set-status-publish'     => __('Set To Completed', 'give'),
597
+			'set-status-pending'     => __('Set To Pending', 'give'),
598
+			'set-status-processing'  => __('Set To Processing', 'give'),
599
+			'set-status-refunded'    => __('Set To Refunded', 'give'),
600
+			'set-status-revoked'     => __('Set To Revoked', 'give'),
601
+			'set-status-failed'      => __('Set To Failed', 'give'),
602
+			'set-status-cancelled'   => __('Set To Cancelled', 'give'),
603
+			'set-status-abandoned'   => __('Set To Abandoned', 'give'),
604
+			'set-status-preapproval' => __('Set To Preapproval', 'give'),
605
+			'resend-receipt'         => __('Resend Email Receipts', 'give'),
606 606
 		);
607 607
 
608
-		return apply_filters( 'give_payments_table_bulk_actions', $actions );
608
+		return apply_filters('give_payments_table_bulk_actions', $actions);
609 609
 	}
610 610
 
611 611
 	/**
@@ -616,63 +616,63 @@  discard block
 block discarded – undo
616 616
 	 * @return void
617 617
 	 */
618 618
 	public function process_bulk_action() {
619
-		$ids    = isset( $_GET['payment'] ) ? $_GET['payment'] : false;
619
+		$ids    = isset($_GET['payment']) ? $_GET['payment'] : false;
620 620
 		$action = $this->current_action();
621 621
 
622
-		if ( ! is_array( $ids ) ) {
623
-			$ids = array( $ids );
622
+		if ( ! is_array($ids)) {
623
+			$ids = array($ids);
624 624
 		}
625 625
 
626
-		if ( empty( $action ) ) {
626
+		if (empty($action)) {
627 627
 			return;
628 628
 		}
629 629
 
630
-		foreach ( $ids as $id ) {
630
+		foreach ($ids as $id) {
631 631
 
632 632
 			// Detect when a bulk action is being triggered.
633
-			switch ( $this->current_action() ) {
633
+			switch ($this->current_action()) {
634 634
 
635 635
 				case'delete':
636
-					give_delete_donation( $id );
636
+					give_delete_donation($id);
637 637
 					break;
638 638
 
639 639
 				case 'set-status-publish':
640
-					give_update_payment_status( $id, 'publish' );
640
+					give_update_payment_status($id, 'publish');
641 641
 					break;
642 642
 
643 643
 				case 'set-status-pending':
644
-					give_update_payment_status( $id, 'pending' );
644
+					give_update_payment_status($id, 'pending');
645 645
 					break;
646 646
 
647 647
 				case 'set-status-processing':
648
-					give_update_payment_status( $id, 'processing' );
648
+					give_update_payment_status($id, 'processing');
649 649
 					break;
650 650
 
651 651
 				case 'set-status-refunded':
652
-					give_update_payment_status( $id, 'refunded' );
652
+					give_update_payment_status($id, 'refunded');
653 653
 					break;
654 654
 				case 'set-status-revoked':
655
-					give_update_payment_status( $id, 'revoked' );
655
+					give_update_payment_status($id, 'revoked');
656 656
 					break;
657 657
 
658 658
 				case 'set-status-failed':
659
-					give_update_payment_status( $id, 'failed' );
659
+					give_update_payment_status($id, 'failed');
660 660
 					break;
661 661
 
662 662
 				case 'set-status-cancelled':
663
-					give_update_payment_status( $id, 'cancelled' );
663
+					give_update_payment_status($id, 'cancelled');
664 664
 					break;
665 665
 
666 666
 				case 'set-status-abandoned':
667
-					give_update_payment_status( $id, 'abandoned' );
667
+					give_update_payment_status($id, 'abandoned');
668 668
 					break;
669 669
 
670 670
 				case 'set-status-preapproval':
671
-					give_update_payment_status( $id, 'preapproval' );
671
+					give_update_payment_status($id, 'preapproval');
672 672
 					break;
673 673
 
674 674
 				case 'resend-receipt':
675
-					give_email_donation_receipt( $id, false );
675
+					give_email_donation_receipt($id, false);
676 676
 					break;
677 677
 			}// End switch().
678 678
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 			 * @param int    $id             The ID of the payment.
685 685
 			 * @param string $current_action The action that is being triggered.
686 686
 			 */
687
-			do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() );
687
+			do_action('give_payments_table_do_bulk_action', $id, $this->current_action());
688 688
 		}// End foreach().
689 689
 
690 690
 	}
@@ -700,31 +700,31 @@  discard block
 block discarded – undo
700 700
 
701 701
 		$args = array();
702 702
 
703
-		if ( isset( $_GET['user'] ) ) {
704
-			$args['user'] = urldecode( $_GET['user'] );
705
-		} elseif ( isset( $_GET['donor'] ) ) {
706
-			$args['donor'] = absint( $_GET['donor'] );
707
-		} elseif ( isset( $_GET['s'] ) ) {
708
-			$is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false;
709
-			if ( $is_user ) {
710
-				$args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) );
711
-				unset( $args['s'] );
703
+		if (isset($_GET['user'])) {
704
+			$args['user'] = urldecode($_GET['user']);
705
+		} elseif (isset($_GET['donor'])) {
706
+			$args['donor'] = absint($_GET['donor']);
707
+		} elseif (isset($_GET['s'])) {
708
+			$is_user = strpos($_GET['s'], strtolower('user:')) !== false;
709
+			if ($is_user) {
710
+				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s']))));
711
+				unset($args['s']);
712 712
 			} else {
713
-				$args['s'] = sanitize_text_field( $_GET['s'] );
713
+				$args['s'] = sanitize_text_field($_GET['s']);
714 714
 			}
715 715
 		}
716 716
 
717
-		if ( ! empty( $_GET['start-date'] ) ) {
718
-			$args['start-date'] = urldecode( $_GET['start-date'] );
717
+		if ( ! empty($_GET['start-date'])) {
718
+			$args['start-date'] = urldecode($_GET['start-date']);
719 719
 		}
720 720
 
721
-		if ( ! empty( $_GET['end-date'] ) ) {
722
-			$args['end-date'] = urldecode( $_GET['end-date'] );
721
+		if ( ! empty($_GET['end-date'])) {
722
+			$args['end-date'] = urldecode($_GET['end-date']);
723 723
 		}
724 724
 
725
-		$args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
725
+		$args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
726 726
 
727
-		$payment_count          = give_count_payments( $args );
727
+		$payment_count          = give_count_payments($args);
728 728
 		$this->complete_count   = $payment_count->publish;
729 729
 		$this->pending_count    = $payment_count->pending;
730 730
 		$this->processing_count = $payment_count->processing;
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$this->cancelled_count  = $payment_count->cancelled;
735 735
 		$this->abandoned_count  = $payment_count->abandoned;
736 736
 
737
-		foreach ( $payment_count as $count ) {
737
+		foreach ($payment_count as $count) {
738 738
 			$this->total_count += $count;
739 739
 		}
740 740
 	}
@@ -749,28 +749,28 @@  discard block
 block discarded – undo
749 749
 	public function payments_data() {
750 750
 
751 751
 		$per_page   = $this->per_page;
752
-		$orderby    = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID';
753
-		$order      = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
754
-		$user       = isset( $_GET['user'] ) ? $_GET['user'] : null;
755
-		$donor      = isset( $_GET['donor'] ) ? $_GET['donor'] : null;
756
-		$status     = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys();
757
-		$meta_key   = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null;
758
-		$year       = isset( $_GET['year'] ) ? $_GET['year'] : null;
759
-		$month      = isset( $_GET['m'] ) ? $_GET['m'] : null;
760
-		$day        = isset( $_GET['day'] ) ? $_GET['day'] : null;
761
-		$search     = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null;
762
-		$start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null;
763
-		$end_date   = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date;
764
-		$form_id    = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null;
765
-
766
-		if ( ! empty( $search ) ) {
752
+		$orderby    = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID';
753
+		$order      = isset($_GET['order']) ? $_GET['order'] : 'DESC';
754
+		$user       = isset($_GET['user']) ? $_GET['user'] : null;
755
+		$donor      = isset($_GET['donor']) ? $_GET['donor'] : null;
756
+		$status     = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys();
757
+		$meta_key   = isset($_GET['meta_key']) ? $_GET['meta_key'] : null;
758
+		$year       = isset($_GET['year']) ? $_GET['year'] : null;
759
+		$month      = isset($_GET['m']) ? $_GET['m'] : null;
760
+		$day        = isset($_GET['day']) ? $_GET['day'] : null;
761
+		$search     = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null;
762
+		$start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null;
763
+		$end_date   = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date;
764
+		$form_id    = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null;
765
+
766
+		if ( ! empty($search)) {
767 767
 			$status = 'any'; // Force all payment statuses when searching.
768 768
 		}
769 769
 
770 770
 		$args = array(
771 771
 			'output'     => 'payments',
772 772
 			'number'     => $per_page,
773
-			'page'       => isset( $_GET['paged'] ) ? $_GET['paged'] : null,
773
+			'page'       => isset($_GET['paged']) ? $_GET['paged'] : null,
774 774
 			'orderby'    => $orderby,
775 775
 			'order'      => $order,
776 776
 			'user'       => $user,
@@ -786,12 +786,12 @@  discard block
 block discarded – undo
786 786
 			'give_forms' => $form_id,
787 787
 		);
788 788
 
789
-		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) {
789
+		if (is_string($search) && false !== strpos($search, 'txn:')) {
790 790
 			$args['search_in_notes'] = true;
791
-			$args['s']               = trim( str_replace( 'txn:', '', $args['s'] ) );
791
+			$args['s']               = trim(str_replace('txn:', '', $args['s']));
792 792
 		}
793 793
 
794
-		$p_query = new Give_Payments_Query( $args );
794
+		$p_query = new Give_Payments_Query($args);
795 795
 
796 796
 		return $p_query->get_payments();
797 797
 
@@ -811,17 +811,17 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public function prepare_items() {
813 813
 
814
-		wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) );
814
+		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's'));
815 815
 
816 816
 		$columns  = $this->get_columns();
817 817
 		$hidden   = array(); // No hidden columns.
818 818
 		$sortable = $this->get_sortable_columns();
819 819
 		$data     = $this->payments_data();
820
-		$status   = isset( $_GET['status'] ) ? $_GET['status'] : 'any';
820
+		$status   = isset($_GET['status']) ? $_GET['status'] : 'any';
821 821
 
822
-		$this->_column_headers = array( $columns, $hidden, $sortable );
822
+		$this->_column_headers = array($columns, $hidden, $sortable);
823 823
 
824
-		switch ( $status ) {
824
+		switch ($status) {
825 825
 			case 'publish':
826 826
 				$total_items = $this->complete_count;
827 827
 				break;
@@ -851,20 +851,20 @@  discard block
 block discarded – undo
851 851
 				break;
852 852
 			default:
853 853
 				// Retrieve the count of the non-default-Give status.
854
-				$count       = wp_count_posts( 'give_payment' );
855
-				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0;
854
+				$count       = wp_count_posts('give_payment');
855
+				$total_items = isset($count->{$status} ) ? $count->{$status} : 0;
856 856
 				break;
857 857
 		}
858 858
 
859 859
 		$this->items = $data;
860 860
 
861
-		$this->set_pagination_args( array(
861
+		$this->set_pagination_args(array(
862 862
 			'total_items' => $total_items,
863 863
 			// We have to calculate the total number of items.
864 864
 			'per_page'    => $this->per_page,
865 865
 			// We have to determine how many items to show on a page.
866
-			'total_pages' => ceil( $total_items / $this->per_page ),
866
+			'total_pages' => ceil($total_items / $this->per_page),
867 867
 			// We have to calculate the total number of pages.
868
-		) );
868
+		));
869 869
 	}
870 870
 }
Please login to merge, or discard this patch.