Test Failed
Push — master ( 78a339...f49c98 )
by Ravinder
08:25
created
includes/scripts.php 1 patch
Spacing   +177 added lines, -177 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,26 +25,26 @@  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' ), // Do not use this nonce. Its deprecated.
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'), // Do not use this nonce. Its deprecated.
39 39
 		'currency'            => give_get_currency(),
40
-		'currency_sign'       => give_currency_filter( '' ),
40
+		'currency_sign'       => give_currency_filter(''),
41 41
 		'currency_pos'        => give_get_currency_position(),
42 42
 		'thousands_separator' => give_get_price_thousand_separator(),
43 43
 		'decimal_separator'   => give_get_price_decimal_separator(),
44
-		'no_gateway'          => __( 'Please select a payment method.', 'give' ),
45
-		'bad_minimum'         => __( 'The minimum custom donation amount for this form is', 'give' ),
46
-		'general_loading'     => __( 'Loading...', 'give' ),
47
-		'purchase_loading'    => __( 'Please Wait...', 'give' ),
44
+		'no_gateway'          => __('Please select a payment method.', 'give'),
45
+		'bad_minimum'         => __('The minimum custom donation amount for this form is', 'give'),
46
+		'general_loading'     => __('Loading...', 'give'),
47
+		'purchase_loading'    => __('Please Wait...', 'give'),
48 48
 		'number_decimals'     => give_get_price_decimals(),
49 49
 		'give_version'        => GIVE_VERSION,
50 50
 		'magnific_options'    => apply_filters(
@@ -58,83 +58,83 @@  discard block
 block discarded – undo
58 58
 			'give_form_translation_js',
59 59
 			array(
60 60
 				// Field name               Validation message.
61
-				'payment-mode'           => __( 'Please select payment mode.', 'give' ),
62
-				'give_first'             => __( 'Please enter your first name.', 'give' ),
63
-				'give_email'             => __( 'Please enter a valid email address.', 'give' ),
64
-				'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
65
-				'give_user_pass'         => __( 'Enter a password.', 'give' ),
66
-				'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
67
-				'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
61
+				'payment-mode'           => __('Please select payment mode.', 'give'),
62
+				'give_first'             => __('Please enter your first name.', 'give'),
63
+				'give_email'             => __('Please enter a valid email address.', 'give'),
64
+				'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
65
+				'give_user_pass'         => __('Enter a password.', 'give'),
66
+				'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
67
+				'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
68 68
 			)
69 69
 		),
70
-		'confirm_email_sent_message'         => __( 'Please check your email and click on the link to access your complete donation history.', 'give' ),
71
-	) );
70
+		'confirm_email_sent_message'         => __('Please check your email and click on the link to access your complete donation history.', 'give'),
71
+	));
72 72
 
73
-	$localize_give_ajax = apply_filters( 'give_global_ajax_vars', array(
73
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
74 74
 		'ajaxurl'         => give_get_ajax_url(),
75
-		'ajaxNonce'       => wp_create_nonce( 'give_ajax_nonce' ),
76
-		'loading'         => __( 'Loading', 'give' ),
75
+		'ajaxNonce'       => wp_create_nonce('give_ajax_nonce'),
76
+		'loading'         => __('Loading', 'give'),
77 77
 		// General loading message.
78
-		'select_option'   => __( 'Please select an option', 'give' ),
78
+		'select_option'   => __('Please select an option', 'give'),
79 79
 		// Variable pricing error with multi-donation option enabled.
80
-		'default_gateway' => give_get_default_gateway( null ),
81
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
80
+		'default_gateway' => give_get_default_gateway(null),
81
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
82 82
 		'number_decimals' => give_get_price_decimals(),
83
-	) );
83
+	));
84 84
 
85 85
 	// DEBUG is On.
86
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
86
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
87 87
 
88
-		if ( give_is_cc_verify_enabled() ) {
89
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
90
-			wp_enqueue_script( 'give-cc-validator' );
88
+		if (give_is_cc_verify_enabled()) {
89
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
90
+			wp_enqueue_script('give-cc-validator');
91 91
 		}
92 92
 
93
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
94
-		wp_enqueue_script( 'give-float-labels' );
93
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
94
+		wp_enqueue_script('give-float-labels');
95 95
 
96
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
97
-		wp_enqueue_script( 'give-blockui' );
96
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
97
+		wp_enqueue_script('give-blockui');
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-donations' . $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-donations'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-checkout-global');
107 107
 
108
-		wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
109
-		wp_enqueue_script( 'give-hint.css' );
108
+		wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
109
+		wp_enqueue_script('give-hint.css');
110 110
 
111 111
 		// General scripts.
112
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
113
-		wp_enqueue_script( 'give-scripts' );
112
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
113
+		wp_enqueue_script('give-scripts');
114 114
 
115 115
 		// Load AJAX scripts, if enabled.
116
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
117
-		wp_enqueue_script( 'give-ajax' );
116
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
117
+		wp_enqueue_script('give-ajax');
118 118
 
119 119
 		// Localize / Pass AJAX vars from PHP,
120
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_vars );
121
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
120
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_vars);
121
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
122 122
 
123 123
 	} else {
124 124
 
125 125
 		// DEBUG is OFF (one JS file to rule them all!).
126
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
127
-		wp_enqueue_script( 'give' );
126
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
127
+		wp_enqueue_script('give');
128 128
 
129 129
 		// Localize / Pass AJAX vars from PHP.
130
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
131
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
130
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
131
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
132 132
 
133 133
 	}
134 134
 
135 135
 }
136 136
 
137
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
137
+add_action('wp_enqueue_scripts', 'give_load_scripts');
138 138
 
139 139
 /**
140 140
  * Register styles.
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function give_register_styles() {
149 149
 
150
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
150
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
151 151
 		return;
152 152
 	}
153 153
 
154
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
155
-	wp_enqueue_style( 'give-styles' );
154
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
155
+	wp_enqueue_style('give-styles');
156 156
 
157 157
 }
158 158
 
159
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
159
+add_action('wp_enqueue_scripts', 'give_register_styles');
160 160
 
161 161
 
162 162
 /**
@@ -169,19 +169,19 @@  discard block
 block discarded – undo
169 169
 function give_get_stylesheet_uri() {
170 170
 
171 171
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
172
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
172
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
173 173
 
174 174
 	// LTR or RTL files.
175
-	$direction = ( is_rtl() ) ? '-rtl' : '';
175
+	$direction = (is_rtl()) ? '-rtl' : '';
176 176
 
177
-	$file          = 'give' . $direction . $suffix . '.css';
177
+	$file          = 'give'.$direction.$suffix.'.css';
178 178
 	$templates_dir = give_get_theme_template_dir_name();
179 179
 
180
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
181
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
182
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
183
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
184
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
180
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
181
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
182
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
183
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
184
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
185 185
 
186 186
 	$uri = false;
187 187
 
@@ -191,23 +191,23 @@  discard block
 block discarded – undo
191 191
 	 * followed by non minified version, even if SCRIPT_DEBUG is not enabled.
192 192
 	 * This allows users to copy just give.css to their theme.
193 193
 	 */
194
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
195
-		if ( ! empty( $nonmin ) ) {
196
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
194
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
195
+		if ( ! empty($nonmin)) {
196
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
197 197
 		} else {
198
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
198
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
199 199
 		}
200
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
201
-		if ( ! empty( $nonmin ) ) {
202
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
200
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
201
+		if ( ! empty($nonmin)) {
202
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
203 203
 		} else {
204
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
204
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
205 205
 		}
206
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
207
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
206
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
207
+		$uri = trailingslashit(give_get_templates_url()).$file;
208 208
 	}
209 209
 
210
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
210
+	return apply_filters('give_get_stylesheet_uri', $uri);
211 211
 
212 212
 }
213 213
 
@@ -224,82 +224,82 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return void
226 226
  */
227
-function give_load_admin_scripts( $hook ) {
227
+function give_load_admin_scripts($hook) {
228 228
 
229 229
 	global $post, $post_type;
230 230
 
231 231
 	$give_options = give_get_settings();
232 232
 
233 233
 	// Directories of assets.
234
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
235
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
236
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
234
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
235
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
236
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
237 237
 
238 238
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
239
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
239
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
240 240
 
241 241
 	// LTR or RTL files.
242
-	$direction = ( is_rtl() ) ? '-rtl' : '';
242
+	$direction = (is_rtl()) ? '-rtl' : '';
243 243
 
244 244
 	// Global Admin.
245
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
246
-	wp_enqueue_style( 'give-admin-bar-notification' );
245
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
246
+	wp_enqueue_style('give-admin-bar-notification');
247 247
 
248 248
 	// Give Admin Only.
249
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
249
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
250 250
 		return;
251 251
 	}
252 252
 
253 253
 	// CSS.
254
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
255
-	wp_enqueue_style( 'jquery-ui-css' );
256
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', array(), GIVE_VERSION );
257
-	wp_enqueue_style( 'give-admin' );
258
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
259
-	wp_enqueue_style( 'jquery-chosen' );
260
-	wp_enqueue_style( 'thickbox' );
261
-	wp_enqueue_style( 'wp-color-picker' );
254
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
255
+	wp_enqueue_style('jquery-ui-css');
256
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', array(), GIVE_VERSION);
257
+	wp_enqueue_style('give-admin');
258
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
259
+	wp_enqueue_style('jquery-chosen');
260
+	wp_enqueue_style('thickbox');
261
+	wp_enqueue_style('wp-color-picker');
262 262
 
263 263
 
264 264
 	// JS.
265
-	wp_register_script( 'give-selector-cache', $js_plugins . 'selector-cache' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
266
-	wp_enqueue_script( 'give-selector-cache' );
265
+	wp_register_script('give-selector-cache', $js_plugins.'selector-cache'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
266
+	wp_enqueue_script('give-selector-cache');
267 267
 
268
-	wp_register_script( 'give-ajaxify-fields', $js_plugins . 'give-ajaxify-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
269
-	wp_enqueue_script( 'give-ajaxify-fields' );
268
+	wp_register_script('give-ajaxify-fields', $js_plugins.'give-ajaxify-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
269
+	wp_enqueue_script('give-ajaxify-fields');
270 270
 
271
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
272
-	wp_enqueue_script( 'jquery-chosen' );
271
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
272
+	wp_enqueue_script('jquery-chosen');
273 273
 
274
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
275
-	wp_enqueue_script( 'give-accounting' );
274
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
275
+	wp_enqueue_script('give-accounting');
276 276
 
277
-	wp_enqueue_script( 'wp-color-picker' );
278
-	wp_enqueue_script( 'jquery-ui-datepicker' );
279
-	wp_enqueue_script( 'thickbox' );
277
+	wp_enqueue_script('wp-color-picker');
278
+	wp_enqueue_script('jquery-ui-datepicker');
279
+	wp_enqueue_script('thickbox');
280 280
 
281
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query' ), GIVE_VERSION, false );
282
-	wp_enqueue_script( 'give-admin-scripts' );
281
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery', 'jquery-ui-datepicker', 'wp-color-picker', 'jquery-query'), GIVE_VERSION, false);
282
+	wp_enqueue_script('give-admin-scripts');
283 283
 
284
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
285
-	wp_enqueue_script( 'jquery-flot' );
284
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
285
+	wp_enqueue_script('jquery-flot');
286 286
 
287
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
288
-	wp_enqueue_script( 'give-repeatable-fields' );
287
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
288
+	wp_enqueue_script('give-repeatable-fields');
289 289
 
290
-	wp_register_script( 'give-hint.css', $js_plugins . 'give-hint.css' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
291
-	wp_enqueue_script( 'give-hint.css' );
290
+	wp_register_script('give-hint.css', $js_plugins.'give-hint.css'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
291
+	wp_enqueue_script('give-hint.css');
292 292
 
293 293
 	// Forms CPT Script.
294
-	if ( $post_type === 'give_forms' ) {
295
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
296
-		wp_enqueue_script( 'give-admin-forms-scripts' );
294
+	if ($post_type === 'give_forms') {
295
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
296
+		wp_enqueue_script('give-admin-forms-scripts');
297 297
 	}
298 298
 
299 299
 	// Settings Scripts.
300
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
301
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
302
-		wp_enqueue_script( 'give-admin-settings-scripts' );
300
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
301
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
302
+		wp_enqueue_script('give-admin-settings-scripts');
303 303
 	}
304 304
 
305 305
 	// Price Separators.
@@ -307,91 +307,91 @@  discard block
 block discarded – undo
307 307
 	$decimal_separator  = give_get_price_decimal_separator();
308 308
 
309 309
 	// Localize strings & variables for JS.
310
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
311
-		'post_id'                           => isset( $post->ID ) ? $post->ID : null,
310
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
311
+		'post_id'                           => isset($post->ID) ? $post->ID : null,
312 312
 		'give_version'                      => GIVE_VERSION,
313 313
 		'thousands_separator'               => $thousand_separator,
314 314
 		'decimal_separator'                 => $decimal_separator,
315
-		'quick_edit_warning'                => __( 'Not available for variable priced forms.', 'give' ),
316
-		'delete_payment'                    => __( 'Are you sure you want to delete this payment?', 'give' ),
317
-		'delete_payment_note'               => __( 'Are you sure you want to delete this note?', 'give' ),
318
-		'revoke_api_key'                    => __( 'Are you sure you want to revoke this API key?', 'give' ),
319
-		'regenerate_api_key'                => __( 'Are you sure you want to regenerate this API key?', 'give' ),
320
-		'resend_receipt'                    => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
321
-		'disconnect_user'                   => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
322
-		'one_option'                        => __( 'Choose a form', 'give' ),
323
-		'one_or_more_option'                => __( 'Choose one or more forms', 'give' ),
324
-		'currency_sign'                     => give_currency_filter( '' ),
325
-		'currency_pos'                      => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
315
+		'quick_edit_warning'                => __('Not available for variable priced forms.', 'give'),
316
+		'delete_payment'                    => __('Are you sure you want to delete this payment?', 'give'),
317
+		'delete_payment_note'               => __('Are you sure you want to delete this note?', 'give'),
318
+		'revoke_api_key'                    => __('Are you sure you want to revoke this API key?', 'give'),
319
+		'regenerate_api_key'                => __('Are you sure you want to regenerate this API key?', 'give'),
320
+		'resend_receipt'                    => __('Are you sure you want to resend the donation receipt?', 'give'),
321
+		'disconnect_user'                   => __('Are you sure you want to disconnect the user from this donor?', 'give'),
322
+		'one_option'                        => __('Choose a form', 'give'),
323
+		'one_or_more_option'                => __('Choose one or more forms', 'give'),
324
+		'currency_sign'                     => give_currency_filter(''),
325
+		'currency_pos'                      => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
326 326
 		'currency_decimals'                 => give_get_price_decimals(),
327
-		'batch_export_no_class'             => __( 'You must choose a method.', 'give' ),
328
-		'batch_export_no_reqs'              => __( 'Required fields not completed.', 'give' ),
329
-		'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' ),
330
-		'delete_test_donor'                 => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ),
331
-		'delete_import_donor'               => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
332
-		'price_format_guide'                => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
327
+		'batch_export_no_class'             => __('You must choose a method.', 'give'),
328
+		'batch_export_no_reqs'              => __('Required fields not completed.', 'give'),
329
+		'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'),
330
+		'delete_test_donor'                 => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'),
331
+		'delete_import_donor'               => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'),
332
+		'price_format_guide'                => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
333 333
 		/* translators : %s: Donation form options metabox */
334
-		'confirm_before_remove_row_text'    => __( 'Do you want to delete this item?', 'give' ),
335
-		'matched_success_failure_page'      => __( 'You cannot set the success and failed pages to the same page', 'give' ),
336
-		'dismiss_notice_text'               => __( 'Dismiss this notice.', 'give' ),
337
-		'search_placeholder'                => __( 'Type to search all forms', 'give' ),
338
-		'search_placeholder_donor'          => __( 'Type to search all donors', 'give' ),
339
-		'search_placeholder_country'        => __( 'Type to search all countries', 'give' ),
340
-		'search_placeholder_state'          => __( 'Type to search all states/provinces', 'give' ),
341
-		'unlock_donor_fields'            => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ),
342
-		'remove_from_bulk_delete'           => __( 'Remove from Bulk Delete', 'give' ),
334
+		'confirm_before_remove_row_text'    => __('Do you want to delete this item?', 'give'),
335
+		'matched_success_failure_page'      => __('You cannot set the success and failed pages to the same page', 'give'),
336
+		'dismiss_notice_text'               => __('Dismiss this notice.', 'give'),
337
+		'search_placeholder'                => __('Type to search all forms', 'give'),
338
+		'search_placeholder_donor'          => __('Type to search all donors', 'give'),
339
+		'search_placeholder_country'        => __('Type to search all countries', 'give'),
340
+		'search_placeholder_state'          => __('Type to search all states/provinces', 'give'),
341
+		'unlock_donor_fields'            => __('To edit first name and last name, please go to user profile of the donor.', 'give'),
342
+		'remove_from_bulk_delete'           => __('Remove from Bulk Delete', 'give'),
343 343
 		'donors_bulk_action'                => array(
344
-			'no_donor_selected'  => __( 'You must choose at least one or more donors to delete.', 'give' ),
345
-			'no_action_selected' => __( 'You must select a bulk action to proceed.', 'give' ),
344
+			'no_donor_selected'  => __('You must choose at least one or more donors to delete.', 'give'),
345
+			'no_action_selected' => __('You must select a bulk action to proceed.', 'give'),
346 346
 		),
347 347
 		'donations_bulk_action'             => array(
348 348
 			'delete'         => array(
349
-				'zero'     => __( 'You must choose at least one or more donations to delete.', 'give' ),
350
-				'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
351
-				'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
349
+				'zero'     => __('You must choose at least one or more donations to delete.', 'give'),
350
+				'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
351
+				'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
352 352
 			),
353 353
 			'resend-receipt' => array(
354
-				'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
355
-				'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
356
-				'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
354
+				'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
355
+				'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
356
+				'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
357 357
 			),
358 358
 			'set-to-status'  => array(
359
-				'zero'     => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
360
-				'single'   => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
361
-				'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
359
+				'zero'     => __('You must choose at least one or more donations to set status to {status}.', 'give'),
360
+				'single'   => __('Are you sure you want to set status of this donation to {status}?', 'give'),
361
+				'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
362 362
 			),
363 363
 		),
364 364
 		'updates' => array(
365
-			'ajax_error' => __( 'Please reload this page and try again', 'give' )
365
+			'ajax_error' => __('Please reload this page and try again', 'give')
366 366
 		),
367 367
 		'metabox_fields' => array(
368 368
 			'media' => array(
369
-				'button_title' => __( 'Choose Image', 'give' ),
369
+				'button_title' => __('Choose Image', 'give'),
370 370
 			),
371 371
 			'file'  => array(
372
-				'button_title' => __( 'Choose File', 'give' ),
372
+				'button_title' => __('Choose File', 'give'),
373 373
 			),
374 374
 		),
375 375
 		'chosen'                            => array(
376
-			'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
377
-			'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
376
+			'no_results_msg'  => __('No results match {search_term}', 'give'),
377
+			'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
378 378
 		),
379
-		'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ),
380
-		'db_update_confirmation_msg'        => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
381
-		'error_message'                     => __( 'Something went wrong kindly try again!', 'give' ),
379
+		'db_update_confirmation_msg_button' => __('Run Updates', 'give'),
380
+		'db_update_confirmation_msg'        => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'),
381
+		'error_message'                     => __('Something went wrong kindly try again!', 'give'),
382 382
 		'give_donation_import'              => 'give_donation_import',
383 383
 		'core_settings_import'              => 'give_core_settings_import',
384
-		'setting_not_save_message'          => __( 'Changes you made may not be saved.', 'give' ),
385
-	) );
384
+		'setting_not_save_message'          => __('Changes you made may not be saved.', 'give'),
385
+	));
386 386
 
387
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
387
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
388 388
 		// call for new media manager.
389 389
 		wp_enqueue_media();
390 390
 	}
391 391
 
392 392
 }
393 393
 
394
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
394
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
395 395
 
396 396
 /**
397 397
  * Admin Give Icon
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
 	?>
407 407
 	<style type="text/css" media="screen">
408 408
 
409
-		<?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
409
+		<?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
410 410
 		@font-face {
411 411
 			font-family: 'give-icomoon';
412
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?ngjl88'; ?>');
413
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
414
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
415
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
412
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?ngjl88'; ?>');
413
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
414
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
415
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
416 416
 			font-weight: normal;
417 417
 			font-style: normal;
418 418
 		}
@@ -431,4 +431,4 @@  discard block
 block discarded – undo
431 431
 	<?php
432 432
 }
433 433
 
434
-add_action( 'admin_head', 'give_admin_icon' );
434
+add_action('admin_head', 'give_admin_icon');
Please login to merge, or discard this patch.
includes/donors/backward-compatibility.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
  *
12 12
  * @return string|array
13 13
  */
14
-function __give_v20_bc_user_address( $meta_value, $user_id, $meta_key, $single ) {
14
+function __give_v20_bc_user_address($meta_value, $user_id, $meta_key, $single) {
15 15
 	if (
16
-		give_has_upgrade_completed( 'v20_upgrades_user_address' ) &&
16
+		give_has_upgrade_completed('v20_upgrades_user_address') &&
17 17
 		'_give_user_address' === $meta_key
18 18
 	) {
19
-		$meta_value = give_get_donor_address( $user_id );
19
+		$meta_value = give_get_donor_address($user_id);
20 20
 
21
-		if ( $single ) {
22
-			$meta_value = array( $meta_value );
21
+		if ($single) {
22
+			$meta_value = array($meta_value);
23 23
 		}
24 24
 	}
25 25
 
26 26
 	return $meta_value;
27 27
 }
28 28
 
29
-add_filter( 'get_user_metadata', '__give_v20_bc_user_address', 10, 4 );
30 29
\ No newline at end of file
30
+add_filter('get_user_metadata', '__give_v20_bc_user_address', 10, 4);
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-db-form-meta.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->formmeta    = $this->table_name = $wpdb->prefix . 'give_formmeta';
53
+		$wpdb->formmeta    = $this->table_name = $wpdb->prefix.'give_formmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			KEY meta_key (meta_key)
100 100
 			) {$charset_collate};";
101 101
 
102
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
103
-		dbDelta( $sql );
102
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
103
+		dbDelta($sql);
104 104
 
105
-		update_option( $this->table_name . '_db_version', $this->version );
105
+		update_option($this->table_name.'_db_version', $this->version);
106 106
 	}
107 107
 
108 108
 	/**
@@ -113,6 +113,6 @@  discard block
 block discarded – undo
113 113
 	 * @return bool
114 114
 	 */
115 115
 	protected function is_custom_meta_table_active() {
116
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
116
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
117 117
 	}
118 118
 }
Please login to merge, or discard this patch.
includes/class-give-db-donor-meta.php 1 patch
Spacing   +12 added lines, -12 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
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		/* @var WPDB $wpdb */
54 54
 		global $wpdb;
55 55
 
56
-		$wpdb->donormeta   = $this->table_name = $wpdb->prefix . 'give_donormeta';
56
+		$wpdb->donormeta   = $this->table_name = $wpdb->prefix.'give_donormeta';
57 57
 		$this->primary_key = 'meta_id';
58 58
 		$this->version     = '1.0';
59 59
 
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return  bool  False for failure. True for success.
92 92
 	 */
93
-	public function delete_all_meta( $donor_id = 0 ) {
93
+	public function delete_all_meta($donor_id = 0) {
94 94
 		global $wpdb;
95
-		$status = $wpdb->delete( $this->table_name, array( 'customer_id' => $donor_id ), array( '%d' ) );
95
+		$status = $wpdb->delete($this->table_name, array('customer_id' => $donor_id), array('%d'));
96 96
 
97
-		if( $status ) {
98
-			Give_Cache::delete_group( $donor_id, 'give-donors' );
97
+		if ($status) {
98
+			Give_Cache::delete_group($donor_id, 'give-donors');
99 99
 		}
100 100
 	}
101 101
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function create_table() {
111 111
 
112
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
112
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
113 113
 
114 114
 		$sql = "CREATE TABLE {$this->table_name} (
115 115
 			meta_id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 			KEY meta_key (meta_key)
122 122
 			) CHARACTER SET utf8 COLLATE utf8_general_ci;";
123 123
 
124
-		dbDelta( $sql );
124
+		dbDelta($sql);
125 125
 
126
-		update_option( $this->table_name . '_db_version', $this->version );
126
+		update_option($this->table_name.'_db_version', $this->version);
127 127
 	}
128 128
 
129 129
 	/**
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 		global $wpdb;
139 139
 
140 140
 		if (
141
-			! give_has_upgrade_completed( 'v20_rename_donor_tables' ) &&
142
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) )
141
+			! give_has_upgrade_completed('v20_rename_donor_tables') &&
142
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta"))
143 143
 		) {
144 144
 			$wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta";
145 145
 			$this->meta_type = 'customer';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return bool
160 160
 	 */
161
-	protected function is_valid_post_type( $ID ) {
161
+	protected function is_valid_post_type($ID) {
162 162
 		return $ID && true;
163 163
 	}
164 164
 
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +66 added lines, -66 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
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function __construct() {
104 104
 
105
-		if ( 'none' === $this->get_template() ) {
105
+		if ('none' === $this->get_template()) {
106 106
 			$this->html = false;
107 107
 		}
108 108
 
109
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
110
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
109
+		add_action('give_email_send_before', array($this, 'send_before'));
110
+		add_action('give_email_send_after', array($this, 'send_after'));
111 111
 
112 112
 	}
113 113
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param $key
120 120
 	 * @param $value
121 121
 	 */
122
-	public function __set( $key, $value ) {
122
+	public function __set($key, $value) {
123 123
 		$this->$key = $value;
124 124
 	}
125 125
 
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_from_name() {
132
-		if ( ! $this->from_name ) {
133
-			$this->from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
132
+		if ( ! $this->from_name) {
133
+			$this->from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
134 134
 		}
135 135
 
136
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
136
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 * @since 1.0
143 143
 	 */
144 144
 	public function get_from_address() {
145
-		if ( ! $this->from_address ) {
146
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
145
+		if ( ! $this->from_address) {
146
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
147 147
 		}
148 148
 
149
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
149
+		return apply_filters('give_email_from_address', $this->from_address, $this);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @since 1.0
156 156
 	 */
157 157
 	public function get_content_type() {
158
-		if ( ! $this->content_type  ) {
158
+		if ( ! $this->content_type) {
159 159
 			$this->content_type = $this->html
160
-				? apply_filters( 'give_email_default_content_type', 'text/html', $this )
160
+				? apply_filters('give_email_default_content_type', 'text/html', $this)
161 161
 				: 'text/plain';
162 162
 		}
163 163
 
164
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
164
+		return apply_filters('give_email_content_type', $this->content_type, $this);
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 	 * @since 1.0
171 171
 	 */
172 172
 	public function get_headers() {
173
-		if ( ! $this->headers ) {
173
+		if ( ! $this->headers) {
174 174
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
175 175
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
176 176
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
177 177
 		}
178 178
 
179
-		return apply_filters( 'give_email_headers', $this->headers, $this );
179
+		return apply_filters('give_email_headers', $this->headers, $this);
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function get_templates() {
188 188
 		$templates = array(
189
-			'default' => esc_html__( 'Default Template', 'give' ),
190
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
189
+			'default' => esc_html__('Default Template', 'give'),
190
+			'none'    => esc_html__('No template, plain text only', 'give')
191 191
 		);
192 192
 
193
-		return apply_filters( 'give_email_templates', $templates );
193
+		return apply_filters('give_email_templates', $templates);
194 194
 	}
195 195
 
196 196
 	/**
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @since 1.0
200 200
 	 */
201 201
 	public function get_template() {
202
-		if ( ! $this->template ) {
203
-			$this->template = give_get_option( 'email_template', 'default' );
202
+		if ( ! $this->template) {
203
+			$this->template = give_get_option('email_template', 'default');
204 204
 		}
205 205
 
206
-		return apply_filters( 'give_email_template', $this->template );
206
+		return apply_filters('give_email_template', $this->template);
207 207
 	}
208 208
 
209 209
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @since 1.0
213 213
 	 */
214 214
 	public function get_heading() {
215
-		return apply_filters( 'give_email_heading', $this->heading );
215
+		return apply_filters('give_email_heading', $this->heading);
216 216
 	}
217 217
 
218 218
 	/**
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return mixed
224 224
 	 */
225
-	public function parse_tags( $content ) {
225
+	public function parse_tags($content) {
226 226
 		return $content;
227 227
 	}
228 228
 
@@ -235,34 +235,34 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return string
237 237
 	 */
238
-	public function build_email( $message ) {
238
+	public function build_email($message) {
239 239
 
240
-		if ( false === $this->html ) {
240
+		if (false === $this->html) {
241 241
 
242 242
 			// Added Replacement check to simply behaviour of anchor tags.
243 243
 			$pattern = '/<a.+?href\=(?:["|\'])(.+?)(?:["|\']).*?>(.+?)<\/a>/i';
244 244
 			$message = preg_replace_callback(
245 245
 				$pattern,
246
-				function ( $return ) {
247
-					if ( $return[1] !== $return[2] ) {
246
+				function($return) {
247
+					if ($return[1] !== $return[2]) {
248 248
 						return "{$return[2]} ( {$return[1]} )";
249 249
 					}
250 250
 
251
-					return trailingslashit( $return[1] );
251
+					return trailingslashit($return[1]);
252 252
 				},
253 253
 				$message
254 254
 			);
255 255
 
256
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
256
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
257 257
 		}
258 258
 
259
-		$message = $this->text_to_html( $message );
259
+		$message = $this->text_to_html($message);
260 260
 
261 261
 		$template = $this->get_template();
262 262
 
263 263
 		ob_start();
264 264
 
265
-		give_get_template_part( 'emails/header', $template, true );
265
+		give_get_template_part('emails/header', $template, true);
266 266
 
267 267
 		/**
268 268
 		 * Fires in the email head.
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 		 *
272 272
 		 * @param Give_Emails $this The email object.
273 273
 		 */
274
-		do_action( 'give_email_header', $this );
274
+		do_action('give_email_header', $this);
275 275
 
276
-		if ( has_action( 'give_email_template_' . $template ) ) {
276
+		if (has_action('give_email_template_'.$template)) {
277 277
 			/**
278 278
 			 * Fires in a specific email template.
279 279
 			 *
280 280
 			 * @since 1.0
281 281
 			 */
282
-			do_action( "give_email_template_{$template}" );
282
+			do_action("give_email_template_{$template}");
283 283
 		} else {
284
-			give_get_template_part( 'emails/body', $template, true );
284
+			give_get_template_part('emails/body', $template, true);
285 285
 		}
286 286
 
287 287
 		/**
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @param Give_Emails $this The email object.
293 293
 		 */
294
-		do_action( 'give_email_body', $this );
294
+		do_action('give_email_body', $this);
295 295
 
296
-		give_get_template_part( 'emails/footer', $template, true );
296
+		give_get_template_part('emails/footer', $template, true);
297 297
 
298 298
 		/**
299 299
 		 * Fires in the email footer.
@@ -302,28 +302,28 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @param Give_Emails $this The email object.
304 304
 		 */
305
-		do_action( 'give_email_footer', $this );
305
+		do_action('give_email_footer', $this);
306 306
 
307 307
 		$body    = ob_get_clean();
308 308
 
309 309
 		// Email tag.
310
-		$message = str_replace( '{email}', $message, $body );
310
+		$message = str_replace('{email}', $message, $body);
311 311
 
312 312
 		// Email logo tag.
313
-		$header_img = give_get_meta( $this->form_id, '_give_email_logo', true );
314
-		$header_img = $this->form_id ? $header_img : give_get_option( 'email_logo', '' );
313
+		$header_img = give_get_meta($this->form_id, '_give_email_logo', true);
314
+		$header_img = $this->form_id ? $header_img : give_get_option('email_logo', '');
315 315
 
316
-		if ( ! empty( $header_img ) ) {
316
+		if ( ! empty($header_img)) {
317 317
 			$header_img = sprintf(
318 318
 				'<div id="template_header_image"><p style="margin-top:0;"><img style="max-width:450px;" src="%1$s" alt="%2$s" /></p></div>',
319
-				esc_url( $header_img ),
320
-				get_bloginfo( 'name' )
319
+				esc_url($header_img),
320
+				get_bloginfo('name')
321 321
 			);
322 322
 		}
323 323
 
324
-		$message    = str_replace( '{email_logo}', $header_img, $message );
324
+		$message = str_replace('{email_logo}', $header_img, $message);
325 325
 
326
-		return apply_filters( 'give_email_message', $message, $this );
326
+		return apply_filters('give_email_message', $message, $this);
327 327
 	}
328 328
 
329 329
 	/**
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return bool
338 338
 	 */
339
-	public function send( $to, $subject, $message, $attachments = '' ) {
339
+	public function send($to, $subject, $message, $attachments = '') {
340 340
 
341
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
342
-			give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
341
+		if ( ! did_action('init') && ! did_action('admin_init')) {
342
+			give_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
343 343
 
344 344
 			return false;
345 345
 		}
@@ -351,16 +351,16 @@  discard block
 block discarded – undo
351 351
 		 *
352 352
 		 * @param Give_Emails $this The email object.
353 353
 		 */
354
-		do_action( 'give_email_send_before', $this );
354
+		do_action('give_email_send_before', $this);
355 355
 
356
-		$subject = $this->parse_tags( $subject );
357
-		$message = $this->parse_tags( $message );
356
+		$subject = $this->parse_tags($subject);
357
+		$message = $this->parse_tags($message);
358 358
 
359
-		$message = $this->build_email( $message );
359
+		$message = $this->build_email($message);
360 360
 
361
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
361
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
362 362
 
363
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
363
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
364 364
 
365 365
 		/**
366 366
 		 * Fires after sending an email.
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		 *
370 370
 		 * @param Give_Emails $this The email object.
371 371
 		 */
372
-		do_action( 'give_email_send_after', $this );
372
+		do_action('give_email_send_after', $this);
373 373
 
374 374
 		return $sent;
375 375
 
@@ -381,9 +381,9 @@  discard block
 block discarded – undo
381 381
 	 * @since 1.0
382 382
 	 */
383 383
 	public function send_before() {
384
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
385
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
386
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
384
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
385
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
386
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
387 387
 	}
388 388
 
389 389
 	/**
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	 * @since 1.0
393 393
 	 */
394 394
 	public function send_after() {
395
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
396
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
397
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
395
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
396
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
397
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
398 398
 
399 399
 		// Reset email related params.
400 400
 		$this->heading = '';
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @since 1.0
410 410
 	 */
411
-	public function text_to_html( $message ) {
411
+	public function text_to_html($message) {
412 412
 
413
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
414
-			$message = wpautop( $message );
413
+		if ('text/html' == $this->content_type || true === $this->html) {
414
+			$message = wpautop($message);
415 415
 		}
416 416
 
417 417
 		return $message;
Please login to merge, or discard this patch.
includes/emails/actions.php 1 patch
Spacing   +5 added lines, -5 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return void
25 25
  */
26
-function give_trigger_donation_receipt( $payment_id ) {
26
+function give_trigger_donation_receipt($payment_id) {
27 27
 	// Make sure we don't send a receipt while editing a donation.
28
-	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) {
28
+	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) {
29 29
 		return;
30 30
 	}
31 31
 
32 32
 	// Send email.
33
-	give_email_donation_receipt( $payment_id );
33
+	give_email_donation_receipt($payment_id);
34 34
 }
35 35
 
36
-add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 );
37 36
\ No newline at end of file
37
+add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1);
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 * @param string   $context     Email tag category
58 58
 	 */
59
-	public function add( $tag, $description, $func, $context = '' ) {
60
-		if ( is_callable( $func ) ) {
61
-			$this->tags[ $tag ] = array(
59
+	public function add($tag, $description, $func, $context = '') {
60
+		if (is_callable($func)) {
61
+			$this->tags[$tag] = array(
62 62
 				'tag'         => $tag,
63 63
 				'description' => $description,
64 64
 				'func'        => $func,
65
-				'context'     => give_check_variable( $context, 'empty', 'general' ),
65
+				'context'     => give_check_variable($context, 'empty', 'general'),
66 66
 			);
67 67
 		}
68 68
 	}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param string $tag Email tag to remove hook from
76 76
 	 */
77
-	public function remove( $tag ) {
78
-		unset( $this->tags[ $tag ] );
77
+	public function remove($tag) {
78
+		unset($this->tags[$tag]);
79 79
 	}
80 80
 
81 81
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return bool
89 89
 	 */
90
-	public function email_tag_exists( $tag ) {
91
-		return array_key_exists( $tag, $this->tags );
90
+	public function email_tag_exists($tag) {
91
+		return array_key_exists($tag, $this->tags);
92 92
 	}
93 93
 
94 94
 	/**
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_tags( $context_type = 'all', $field = '' ) {
105
+	public function get_tags($context_type = 'all', $field = '') {
106 106
 		$tags = $this->tags;
107 107
 
108
-		if ( 'all' !== $context_type ) {
108
+		if ('all' !== $context_type) {
109 109
 			$tags = array();
110 110
 
111
-			foreach ( $this->tags as $tag ) {
112
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
111
+			foreach ($this->tags as $tag) {
112
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
113 113
 					continue;
114 114
 				}
115 115
 
116
-				$tags[ $tag['tag'] ] = $tag;
116
+				$tags[$tag['tag']] = $tag;
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
121
-			$tags = wp_list_pluck( $tags, $field );
120
+		if ( ! empty($tags) && ! empty($field)) {
121
+			$tags = wp_list_pluck($tags, $field);
122 122
 		}
123 123
 
124 124
 		return $tags;
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return string Content with email tags filtered out.
138 138
 	 */
139
-	public function do_tags( $content, $tag_args ) {
139
+	public function do_tags($content, $tag_args) {
140 140
 
141 141
 		// Check if there is at least one tag added.
142
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
142
+		if (empty($this->tags) || ! is_array($this->tags)) {
143 143
 			return $content;
144 144
 		}
145 145
 
146 146
 		$this->tag_args = $tag_args;
147 147
 
148
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
148
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
149 149
 
150 150
 		$this->tag_args = null;
151 151
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return mixed
163 163
 	 */
164
-	public function do_tag( $m ) {
164
+	public function do_tag($m) {
165 165
 
166 166
 		// Get tag
167 167
 		$tag = $m[1];
168 168
 
169 169
 		// Return tag if tag not set
170
-		if ( ! $this->email_tag_exists( $tag ) ) {
170
+		if ( ! $this->email_tag_exists($tag)) {
171 171
 			return $m[0];
172 172
 		}
173 173
 
174
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
174
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
175 175
 	}
176 176
 
177 177
 }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $func        Hook to run when email tag is found
187 187
  * @param string   $context     Email tag category
188 188
  */
189
-function give_add_email_tag( $tag, $description, $func, $context = '' ) {
190
-	Give()->email_tags->add( $tag, $description, $func, $context );
189
+function give_add_email_tag($tag, $description, $func, $context = '') {
190
+	Give()->email_tags->add($tag, $description, $func, $context);
191 191
 }
192 192
 
193 193
 /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @param string $tag Email tag to remove hook from
199 199
  */
200
-function give_remove_email_tag( $tag ) {
201
-	Give()->email_tags->remove( $tag );
200
+function give_remove_email_tag($tag) {
201
+	Give()->email_tags->remove($tag);
202 202
 }
203 203
 
204 204
 /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return bool
212 212
  */
213
-function give_email_tag_exists( $tag ) {
214
-	return Give()->email_tags->email_tag_exists( $tag );
213
+function give_email_tag_exists($tag) {
214
+	return Give()->email_tags->email_tag_exists($tag);
215 215
 }
216 216
 
217 217
 /**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	$email_tags = give_get_email_tags();
239 239
 
240 240
 	ob_start();
241
-	if ( count( $email_tags ) > 0 ) : ?>
241
+	if (count($email_tags) > 0) : ?>
242 242
 		<div class="give-email-tags-wrap">
243
-			<?php foreach ( $email_tags as $email_tag ) : ?>
243
+			<?php foreach ($email_tags as $email_tag) : ?>
244 244
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
245 245
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
246 246
 				</span>
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @return string Content with email tags filtered out.
266 266
  */
267
-function give_do_email_tags( $content, $tag_args ) {
267
+function give_do_email_tags($content, $tag_args) {
268 268
 	// Backward compatibility < 2.0
269
-	if ( ! is_array( $tag_args ) ) {
270
-		$tag_args = array( 'payment_id' => $tag_args );
269
+	if ( ! is_array($tag_args)) {
270
+		$tag_args = array('payment_id' => $tag_args);
271 271
 	}
272 272
 
273 273
 	// Replace all tags
274
-	$content = Give()->email_tags->do_tags( $content, $tag_args );
274
+	$content = Give()->email_tags->do_tags($content, $tag_args);
275 275
 
276 276
 	/**
277 277
 	 * Filter the filtered content text.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @since 1.0
280 280
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
281 281
 	 */
282
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
282
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
283 283
 
284 284
 	// Return content
285 285
 	return $content;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.0
300 300
 	 */
301
-	do_action( 'give_add_email_tags' );
301
+	do_action('give_add_email_tags');
302 302
 }
303 303
 
304
-add_action( 'init', 'give_load_email_tags', - 999 );
304
+add_action('init', 'give_load_email_tags', - 999);
305 305
 
306 306
 
307 307
 /**
@@ -316,67 +316,67 @@  discard block
 block discarded – undo
316 316
 		/*	Donation Payment */
317 317
 		array(
318 318
 			'tag'         => 'donation',
319
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
319
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
320 320
 			'function'    => 'give_email_tag_donation',
321 321
 			'context'     => 'donation',
322 322
 		),
323 323
 		array(
324 324
 			'tag'         => 'amount',
325
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
325
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
326 326
 			'function'    => 'give_email_tag_amount',
327 327
 			'context'     => 'donation',
328 328
 		),
329 329
 		array(
330 330
 			'tag'         => 'price',
331
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
331
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
332 332
 			'function'    => 'give_email_tag_price',
333 333
 			'context'     => 'donation',
334 334
 		),
335 335
 		array(
336 336
 			'tag'         => 'billing_address',
337
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
337
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
338 338
 			'function'    => 'give_email_tag_billing_address',
339 339
 			'context'     => 'donation',
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'date',
343
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
343
+			'description' => esc_html__('The date of the donation.', 'give'),
344 344
 			'function'    => 'give_email_tag_date',
345 345
 			'context'     => 'donation',
346 346
 		),
347 347
 		array(
348 348
 			'tag'         => 'payment_id',
349
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
349
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
350 350
 			'function'    => 'give_email_tag_payment_id',
351 351
 			'context'     => 'donation',
352 352
 		),
353 353
 		array(
354 354
 			'tag'         => 'payment_method',
355
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
355
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
356 356
 			'function'    => 'give_email_tag_payment_method',
357 357
 			'context'     => 'donation',
358 358
 		),
359 359
 		array(
360 360
 			'tag'         => 'payment_total',
361
-			'description' => esc_html__( 'The payment total for this donation.', 'give' ),
361
+			'description' => esc_html__('The payment total for this donation.', 'give'),
362 362
 			'function'    => 'give_email_tag_payment_total',
363 363
 			'context'     => 'donation',
364 364
 		),
365 365
 		array(
366 366
 			'tag'         => 'receipt_id',
367
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
367
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
368 368
 			'function'    => 'give_email_tag_receipt_id',
369 369
 			'context'     => 'donation',
370 370
 		),
371 371
 		array(
372 372
 			'tag'         => 'receipt_link',
373
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
373
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
374 374
 			'function'    => 'give_email_tag_receipt_link',
375 375
 			'context'     => 'donation',
376 376
 		),
377 377
 		array(
378 378
 			'tag'         => 'receipt_link_url',
379
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
379
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
380 380
 			'function'    => 'give_email_tag_receipt_link_url',
381 381
 			'context'     => 'donation',
382 382
 		),
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		/* Donation Form */
385 385
 		array(
386 386
 			'tag'         => 'form_title',
387
-			'description' => esc_html__( 'The donation form name.', 'give' ),
387
+			'description' => esc_html__('The donation form name.', 'give'),
388 388
 			'function'    => 'give_email_tag_form_title',
389 389
 			'context'     => 'form',
390 390
 		),
@@ -392,31 +392,31 @@  discard block
 block discarded – undo
392 392
 		/* Donor */
393 393
 		array(
394 394
 			'tag'         => 'name',
395
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
395
+			'description' => esc_html__('The donor\'s first name.', 'give'),
396 396
 			'function'    => 'give_email_tag_first_name',
397 397
 			'context'     => 'donor',
398 398
 		),
399 399
 		array(
400 400
 			'tag'         => 'fullname',
401
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
401
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
402 402
 			'function'    => 'give_email_tag_fullname',
403 403
 			'context'     => 'donor',
404 404
 		),
405 405
 		array(
406 406
 			'tag'         => 'username',
407
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
407
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
408 408
 			'function'    => 'give_email_tag_username',
409 409
 			'context'     => 'donor',
410 410
 		),
411 411
 		array(
412 412
 			'tag'         => 'user_email',
413
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
413
+			'description' => esc_html__('The donor\'s email address.', 'give'),
414 414
 			'function'    => 'give_email_tag_user_email',
415 415
 			'context'     => 'donor',
416 416
 		),
417 417
 		array(
418 418
 			'tag'         => 'email_access_link',
419
-			'description' => esc_html__( 'The donor\'s email access link.', 'give' ),
419
+			'description' => esc_html__('The donor\'s email access link.', 'give'),
420 420
 			'function'    => 'give_email_tag_email_access_link',
421 421
 			'context'     => 'donor',
422 422
 		),
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
 		/* General */
425 425
 		array(
426 426
 			'tag'         => 'sitename',
427
-			'description' => esc_html__( 'The name of your site.', 'give' ),
427
+			'description' => esc_html__('The name of your site.', 'give'),
428 428
 			'function'    => 'give_email_tag_sitename',
429 429
 			'context'     => 'general',
430 430
 		),
431 431
 
432 432
 		array(
433 433
 			'tag'         => 'reset_password_link',
434
-			'description' => esc_html__( 'The reset password link for user.', 'give' ),
434
+			'description' => esc_html__('The reset password link for user.', 'give'),
435 435
 			'function'    => 'give_email_tag_reset_password_link',
436 436
 			'context'     => 'general',
437 437
 		),
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 	);
440 440
 
441 441
 	// Apply give_email_tags filter
442
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
442
+	$email_tags = apply_filters('give_email_tags', $email_tags);
443 443
 
444 444
 	// Add email tags
445
-	foreach ( $email_tags as $email_tag ) {
445
+	foreach ($email_tags as $email_tag) {
446 446
 		give_add_email_tag(
447 447
 			$email_tag['tag'],
448 448
 			$email_tag['description'],
449 449
 			$email_tag['function'],
450
-			( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' )
450
+			( ! empty($email_tag['context']) ? $email_tag['context'] : '')
451 451
 		);
452 452
 	}
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
456
+add_action('give_add_email_tags', 'give_setup_email_tags');
457 457
 
458 458
 
459 459
 /**
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return string $firstname
467 467
  */
468
-function give_email_tag_first_name( $tag_args ) {
468
+function give_email_tag_first_name($tag_args) {
469 469
 	$user_info = array();
470 470
 	$firstname = '';
471 471
 
472 472
 	// Backward compatibility.
473
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
473
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
474 474
 
475
-	switch ( true ) {
476
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
477
-			$payment = new Give_Payment( $tag_args['payment_id'] );
475
+	switch (true) {
476
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
477
+			$payment = new Give_Payment($tag_args['payment_id']);
478 478
 
479 479
 			// Get firstname.
480
-			if ( ! empty( $payment->user_info ) ) {
481
-				$email_names = give_get_email_names( $payment->user_info );
480
+			if ( ! empty($payment->user_info)) {
481
+				$email_names = give_get_email_names($payment->user_info);
482 482
 				$firstname   = $email_names['name'];
483 483
 			}
484 484
 			break;
485 485
 
486
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
487
-			$donor = new Give_Donor( $tag_args['user_id'], true );
486
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
487
+			$donor = new Give_Donor($tag_args['user_id'], true);
488 488
 			$firstname = $donor->get_first_name();
489 489
 			break;
490 490
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 		 *
494 494
 		 * @since 2.0
495 495
 		 */
496
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
497
-			$donor = new Give_Donor( $tag_args['donor_id'] );
496
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
497
+			$donor = new Give_Donor($tag_args['donor_id']);
498 498
 			$firstname = $donor->get_first_name();
499 499
 			break;
500 500
 	}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 * @param string $firstname
508 508
 	 * @param array  $tag_args
509 509
 	 */
510
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
510
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
511 511
 
512 512
 	return $firstname;
513 513
 }
@@ -521,26 +521,26 @@  discard block
 block discarded – undo
521 521
  *
522 522
  * @return string $fullname
523 523
  */
524
-function give_email_tag_fullname( $tag_args ) {
524
+function give_email_tag_fullname($tag_args) {
525 525
 	$fullname = '';
526 526
 
527 527
 	// Backward compatibility.
528
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
528
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
529 529
 
530
-	switch ( true ) {
531
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
532
-			$payment = new Give_Payment( $tag_args['payment_id'] );
530
+	switch (true) {
531
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
532
+			$payment = new Give_Payment($tag_args['payment_id']);
533 533
 
534 534
 			// Get fullname.
535
-			if ( ! empty( $payment->user_info ) ) {
536
-				$email_names = give_get_email_names( $payment->user_info );
535
+			if ( ! empty($payment->user_info)) {
536
+				$email_names = give_get_email_names($payment->user_info);
537 537
 				$fullname    = $email_names['fullname'];
538 538
 			}
539 539
 			break;
540 540
 
541
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
542
-			$donor = new Give_Donor( $tag_args['user_id'], true );
543
-			$fullname  = trim( "{$donor->get_first_name()} {$donor->get_last_name()}" );
541
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
542
+			$donor = new Give_Donor($tag_args['user_id'], true);
543
+			$fullname = trim("{$donor->get_first_name()} {$donor->get_last_name()}");
544 544
 			break;
545 545
 
546 546
 		/**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		 *
549 549
 		 * @since 2.0
550 550
 		 */
551
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
552
-			$donor = new Give_Donor( $tag_args['donor_id'] );
551
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
552
+			$donor = new Give_Donor($tag_args['donor_id']);
553 553
 			$fullname = $donor->name;
554 554
 			break;
555 555
 	}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 * @param string $fullname
563 563
 	 * @param array  $tag_args
564 564
 	 */
565
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
565
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
566 566
 
567 567
 	return $fullname;
568 568
 }
@@ -576,25 +576,25 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return string username.
578 578
  */
579
-function give_email_tag_username( $tag_args ) {
579
+function give_email_tag_username($tag_args) {
580 580
 	$username = '';
581 581
 
582 582
 	// Backward compatibility.
583
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
583
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
584 584
 
585
-	switch ( true ) {
586
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
587
-			$payment = new Give_Payment( $tag_args['payment_id'] );
585
+	switch (true) {
586
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
587
+			$payment = new Give_Payment($tag_args['payment_id']);
588 588
 
589 589
 			// Get username.
590
-			if ( ! empty( $payment->user_info ) ) {
591
-				$email_names = give_get_email_names( $payment->user_info );
590
+			if ( ! empty($payment->user_info)) {
591
+				$email_names = give_get_email_names($payment->user_info);
592 592
 				$username    = $email_names['username'];
593 593
 			}
594 594
 			break;
595 595
 
596
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
597
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
596
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
597
+			$user_info = get_user_by('id', $tag_args['user_id']);
598 598
 			$username  = $user_info->user_login;
599 599
 			break;
600 600
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 		 *
604 604
 		 * @since 2.0
605 605
 		 */
606
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
607
-			$donor = new Give_Donor( $tag_args['donor_id'] );
608
-			if ( ! empty( $donor->id ) && ! empty( $donor->user_id ) ) {
609
-				$user_info = get_user_by( 'id', $donor->user_id );
606
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
607
+			$donor = new Give_Donor($tag_args['donor_id']);
608
+			if ( ! empty($donor->id) && ! empty($donor->user_id)) {
609
+				$user_info = get_user_by('id', $donor->user_id);
610 610
 				$username  = $user_info->user_login;
611 611
 			}
612 612
 			break;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @param string $username
621 621
 	 * @param array  $tag_args
622 622
 	 */
623
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
623
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
624 624
 
625 625
 	return $username;
626 626
 }
@@ -634,20 +634,20 @@  discard block
 block discarded – undo
634 634
  *
635 635
  * @return string user_email
636 636
  */
637
-function give_email_tag_user_email( $tag_args ) {
637
+function give_email_tag_user_email($tag_args) {
638 638
 	$email = '';
639 639
 
640 640
 	// Backward compatibility.
641
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
641
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
642 642
 
643
-	switch ( true ) {
644
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
645
-			$payment = new Give_Payment( $tag_args['payment_id'] );
643
+	switch (true) {
644
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
645
+			$payment = new Give_Payment($tag_args['payment_id']);
646 646
 			$email   = $payment->email;
647 647
 			break;
648 648
 
649
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
650
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
649
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
650
+			$user_info = get_user_by('id', $tag_args['user_id']);
651 651
 			$email     = $user_info->user_email;
652 652
 			break;
653 653
 
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 		 *
657 657
 		 * @since 2.0
658 658
 		 */
659
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
660
-			$donor = new Give_Donor( $tag_args['donor_id'] );
661
-			$email     = $donor->email;
659
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
660
+			$donor = new Give_Donor($tag_args['donor_id']);
661
+			$email = $donor->email;
662 662
 			break;
663 663
 	}
664 664
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * @param string $email
671 671
 	 * @param array  $tag_args
672 672
 	 */
673
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
673
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
674 674
 
675 675
 	return $email;
676 676
 }
@@ -684,15 +684,15 @@  discard block
 block discarded – undo
684 684
  *
685 685
  * @return string billing_address
686 686
  */
687
-function give_email_tag_billing_address( $tag_args ) {
687
+function give_email_tag_billing_address($tag_args) {
688 688
 	$address = '';
689 689
 
690 690
 	// Backward compatibility.
691
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
691
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
692 692
 
693
-	switch ( true ) {
694
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
695
-			$user_info    = give_get_payment_meta_user_info( $tag_args['payment_id'] );
693
+	switch (true) {
694
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
695
+			$user_info    = give_get_payment_meta_user_info($tag_args['payment_id']);
696 696
 			$user_address = give_check_variable(
697 697
 				$user_info,
698 698
 				'isset',
@@ -707,13 +707,13 @@  discard block
 block discarded – undo
707 707
 				'address'
708 708
 			);
709 709
 
710
-			$address = $user_address['line1'] . "\n";
710
+			$address = $user_address['line1']."\n";
711 711
 
712
-			if ( ! empty( $user_address['line2'] ) ) {
713
-				$address .= $user_address['line2'] . "\n";
712
+			if ( ! empty($user_address['line2'])) {
713
+				$address .= $user_address['line2']."\n";
714 714
 			}
715 715
 
716
-			$address .= $user_address['city'] . ' ' . $user_address['zip'] . ' ' . $user_address['state'] . "\n";
716
+			$address .= $user_address['city'].' '.$user_address['zip'].' '.$user_address['state']."\n";
717 717
 			$address .= $user_address['country'];
718 718
 			break;
719 719
 	}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 * @param string $address
727 727
 	 * @param array  $tag_args
728 728
 	 */
729
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
729
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
730 730
 
731 731
 	return $address;
732 732
 }
@@ -740,16 +740,16 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return string date
742 742
  */
743
-function give_email_tag_date( $tag_args ) {
743
+function give_email_tag_date($tag_args) {
744 744
 	$date = '';
745 745
 
746 746
 	// Backward compatibility.
747
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
747
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
748 748
 
749
-	switch ( true ) {
750
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
751
-			$payment = new Give_Payment( $tag_args['payment_id'] );
752
-			$date    = date_i18n( give_date_format(), strtotime( $payment->date ) );
749
+	switch (true) {
750
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
751
+			$payment = new Give_Payment($tag_args['payment_id']);
752
+			$date    = date_i18n(give_date_format(), strtotime($payment->date));
753 753
 			break;
754 754
 	}
755 755
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	 * @param string $date
762 762
 	 * @param array  $tag_args
763 763
 	 */
764
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
764
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
765 765
 
766 766
 	return $date;
767 767
 }
@@ -775,17 +775,17 @@  discard block
 block discarded – undo
775 775
  *
776 776
  * @return string amount
777 777
  */
778
-function give_email_tag_amount( $tag_args ) {
778
+function give_email_tag_amount($tag_args) {
779 779
 	$amount = '';
780 780
 
781 781
 	// Backward compatibility.
782
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
782
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
783 783
 
784
-	switch ( true ) {
785
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
786
-			$payment     = new Give_Payment( $tag_args['payment_id'] );
787
-			$give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), array( 'currency_code' => $payment->currency ) );
788
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
784
+	switch (true) {
785
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
786
+			$payment     = new Give_Payment($tag_args['payment_id']);
787
+			$give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), array('currency_code' => $payment->currency));
788
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
789 789
 			break;
790 790
 	}
791 791
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 * @param string $amount
798 798
 	 * @param array  $tag_args
799 799
 	 */
800
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
800
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
801 801
 
802 802
 	return $amount;
803 803
 }
@@ -811,8 +811,8 @@  discard block
 block discarded – undo
811 811
  *
812 812
  * @return string price
813 813
  */
814
-function give_email_tag_price( $tag_args ) {
815
-	return give_email_tag_amount( $tag_args );
814
+function give_email_tag_price($tag_args) {
815
+	return give_email_tag_amount($tag_args);
816 816
 }
817 817
 
818 818
 /**
@@ -824,15 +824,15 @@  discard block
 block discarded – undo
824 824
  *
825 825
  * @return int payment_id
826 826
  */
827
-function give_email_tag_payment_id( $tag_args ) {
827
+function give_email_tag_payment_id($tag_args) {
828 828
 	$payment_id = '';
829 829
 
830 830
 	// Backward compatibility.
831
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
831
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
832 832
 
833
-	switch ( true ) {
834
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
835
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
833
+	switch (true) {
834
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
835
+			$payment    = new Give_Payment($tag_args['payment_id']);
836 836
 			$payment_id = $payment->number;
837 837
 			break;
838 838
 	}
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	 * @param string $payment_id
846 846
 	 * @param array  $tag_args
847 847
 	 */
848
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
848
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
849 849
 }
850 850
 
851 851
 /**
@@ -857,15 +857,15 @@  discard block
 block discarded – undo
857 857
  *
858 858
  * @return string receipt_id
859 859
  */
860
-function give_email_tag_receipt_id( $tag_args ) {
860
+function give_email_tag_receipt_id($tag_args) {
861 861
 	$receipt_id = '';
862 862
 
863 863
 	// Backward compatibility.
864
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
864
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
865 865
 
866
-	switch ( true ) {
867
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
868
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
866
+	switch (true) {
867
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
868
+			$payment    = new Give_Payment($tag_args['payment_id']);
869 869
 			$receipt_id = $payment->key;
870 870
 			break;
871 871
 	}
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	 * @param string $receipt_id
879 879
 	 * @param array  $tag_args
880 880
 	 */
881
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
881
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
882 882
 }
883 883
 
884 884
 /**
@@ -890,23 +890,23 @@  discard block
 block discarded – undo
890 890
  *
891 891
  * @return string $form_title
892 892
  */
893
-function give_email_tag_donation( $tag_args ) {
893
+function give_email_tag_donation($tag_args) {
894 894
 	$donation_form_title = '';
895 895
 
896 896
 	// Backward compatibility.
897
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
897
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
898 898
 
899
-	switch ( true ) {
900
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
901
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
902
-			$level_title         = give_has_variable_prices( $payment->form_id );
899
+	switch (true) {
900
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
901
+			$payment             = new Give_Payment($tag_args['payment_id']);
902
+			$level_title         = give_has_variable_prices($payment->form_id);
903 903
 			$separator           = $level_title ? '-' : '';
904
-			$donation_form_title = strip_tags( give_check_variable( give_get_donation_form_title(
904
+			$donation_form_title = strip_tags(give_check_variable(give_get_donation_form_title(
905 905
 				$payment,
906 906
 				array(
907 907
 					'separator' => $separator,
908 908
 				)
909
-			), 'empty', '' ) );
909
+			), 'empty', ''));
910 910
 			break;
911 911
 	}
912 912
 
@@ -934,17 +934,17 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return string $form_title
936 936
  */
937
-function give_email_tag_form_title( $tag_args ) {
937
+function give_email_tag_form_title($tag_args) {
938 938
 	$donation_form_title = '';
939 939
 
940 940
 	// Backward compatibility.
941
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
941
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
942 942
 
943
-	switch ( true ) {
944
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
945
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
943
+	switch (true) {
944
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
945
+			$payment             = new Give_Payment($tag_args['payment_id']);
946 946
 			$payment_meta        = $payment->payment_meta;
947
-			$donation_form_title = strip_tags( give_check_variable( $payment_meta, 'empty', '', 'form_title' ) );
947
+			$donation_form_title = strip_tags(give_check_variable($payment_meta, 'empty', '', 'form_title'));
948 948
 			break;
949 949
 	}
950 950
 
@@ -972,19 +972,19 @@  discard block
 block discarded – undo
972 972
  *
973 973
  * @return string gateway
974 974
  */
975
-function give_email_tag_payment_method( $tag_args ) {
975
+function give_email_tag_payment_method($tag_args) {
976 976
 	$payment_method = '';
977 977
 
978 978
 	// Backward compatibility.
979
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
979
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
980 980
 
981 981
 	// Backward compatibility.
982
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
982
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
983 983
 
984
-	switch ( true ) {
985
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
986
-			$payment        = new Give_Payment( $tag_args['payment_id'] );
987
-			$payment_method = give_get_gateway_checkout_label( $payment->gateway );
984
+	switch (true) {
985
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
986
+			$payment        = new Give_Payment($tag_args['payment_id']);
987
+			$payment_method = give_get_gateway_checkout_label($payment->gateway);
988 988
 			break;
989 989
 	}
990 990
 
@@ -1015,16 +1015,16 @@  discard block
 block discarded – undo
1015 1015
  *
1016 1016
  * @return string
1017 1017
  */
1018
-function give_email_tag_payment_total( $tag_args ) {
1018
+function give_email_tag_payment_total($tag_args) {
1019 1019
 	$payment_total = '';
1020 1020
 
1021 1021
 	// Backward compatibility.
1022
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1022
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1023 1023
 
1024
-	switch ( true ) {
1025
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1026
-			$payment       = new Give_Payment( $tag_args['payment_id'] );
1027
-			$payment_total = give_currency_filter( $payment->total );
1024
+	switch (true) {
1025
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1026
+			$payment       = new Give_Payment($tag_args['payment_id']);
1027
+			$payment_total = give_currency_filter($payment->total);
1028 1028
 			break;
1029 1029
 	}
1030 1030
 
@@ -1052,11 +1052,11 @@  discard block
 block discarded – undo
1052 1052
  *
1053 1053
  * @return string
1054 1054
  */
1055
-function give_email_tag_sitename( $tag_args = array() ) {
1056
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1055
+function give_email_tag_sitename($tag_args = array()) {
1056
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1057 1057
 
1058 1058
 	// Backward compatibility.
1059
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1059
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1060 1060
 
1061 1061
 	/**
1062 1062
 	 * Filter the {sitename} email template tag output.
@@ -1082,26 +1082,26 @@  discard block
 block discarded – undo
1082 1082
  *
1083 1083
  * @return string receipt_link
1084 1084
  */
1085
-function give_email_tag_receipt_link( $tag_args ) {
1085
+function give_email_tag_receipt_link($tag_args) {
1086 1086
 	// Backward compatibility.
1087
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1087
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1088 1088
 
1089
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1089
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1090 1090
 
1091 1091
 	// Bailout.
1092
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1092
+	if (give_get_option('email_template') === 'none') {
1093 1093
 		return $receipt_url;
1094 1094
 	}
1095 1095
 
1096 1096
 
1097
-	$receipt_url = esc_url( add_query_arg( array(
1098
-		'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1099
-	), give_get_history_page_uri() ) );
1097
+	$receipt_url = esc_url(add_query_arg(array(
1098
+		'payment_key' => give_get_payment_key($tag_args['payment_id']),
1099
+	), give_get_history_page_uri()));
1100 1100
 
1101
-	$formatted   = sprintf(
1101
+	$formatted = sprintf(
1102 1102
 		'<a href="%1$s">%2$s</a>',
1103 1103
 		$receipt_url,
1104
-		__( 'View it in your browser &raquo;', 'give' )
1104
+		__('View it in your browser &raquo;', 'give')
1105 1105
 	);
1106 1106
 
1107 1107
 	/**
@@ -1130,11 +1130,11 @@  discard block
 block discarded – undo
1130 1130
  *
1131 1131
  * @return string receipt_url
1132 1132
  */
1133
-function give_email_tag_receipt_link_url( $tag_args ) {
1133
+function give_email_tag_receipt_link_url($tag_args) {
1134 1134
 	// Backward compatibility.
1135
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1135
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1136 1136
 
1137
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1137
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1138 1138
 
1139 1139
 	/**
1140 1140
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1161,13 +1161,13 @@  discard block
 block discarded – undo
1161 1161
  *
1162 1162
  * @return string
1163 1163
  */
1164
-function give_get_receipt_url( $payment_id ) {
1164
+function give_get_receipt_url($payment_id) {
1165 1165
 	$receipt_url = '';
1166 1166
 
1167
-	if ( $payment_id ) {
1168
-		$receipt_url = esc_url( add_query_arg( array(
1169
-			'payment_key' => give_get_payment_key( $payment_id ),
1170
-		), give_get_history_page_uri() ) );
1167
+	if ($payment_id) {
1168
+		$receipt_url = esc_url(add_query_arg(array(
1169
+			'payment_key' => give_get_payment_key($payment_id),
1170
+		), give_get_history_page_uri()));
1171 1171
 	}
1172 1172
 
1173 1173
 	return $receipt_url;
@@ -1183,22 +1183,22 @@  discard block
 block discarded – undo
1183 1183
  *
1184 1184
  * @return string
1185 1185
  */
1186
-function give_email_tag_email_access_link( $tag_args ) {
1186
+function give_email_tag_email_access_link($tag_args) {
1187 1187
 	$donor_id          = 0;
1188 1188
 	$donor             = array();
1189 1189
 	$email_access_link = '';
1190 1190
 
1191 1191
 	// Backward compatibility.
1192
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1192
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1193 1193
 
1194
-	switch ( true ) {
1195
-		case ! empty( $tag_args['donor_id'] ):
1194
+	switch (true) {
1195
+		case ! empty($tag_args['donor_id']):
1196 1196
 			$donor_id = $tag_args['donor_id'];
1197
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1197
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1198 1198
 			break;
1199 1199
 
1200
-		case ! empty( $tag_args['user_id'] ):
1201
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1200
+		case ! empty($tag_args['user_id']):
1201
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1202 1202
 			$donor_id = $donor->id;
1203 1203
 			break;
1204 1204
 
@@ -1207,11 +1207,11 @@  discard block
 block discarded – undo
1207 1207
 	}
1208 1208
 
1209 1209
 	// Set email access link if donor exist.
1210
-	if ( $donor_id ) {
1211
-		$verify_key = wp_generate_password( 20, false );
1210
+	if ($donor_id) {
1211
+		$verify_key = wp_generate_password(20, false);
1212 1212
 
1213 1213
 		// Generate a new verify key
1214
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1214
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1215 1215
 
1216 1216
 		$access_url = add_query_arg(
1217 1217
 			array(
@@ -1221,28 +1221,28 @@  discard block
 block discarded – undo
1221 1221
 		);
1222 1222
 
1223 1223
 		// Add Payment Key to email access url, if it exists.
1224
-		if ( ! empty( $_GET['payment_key'] ) ) {
1224
+		if ( ! empty($_GET['payment_key'])) {
1225 1225
 			$access_url = add_query_arg(
1226 1226
 				array(
1227
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1227
+					'payment_key' => give_clean($_GET['payment_key']),
1228 1228
 				),
1229 1229
 				$access_url
1230 1230
 			);
1231 1231
 		}
1232 1232
 
1233
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1233
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1234 1234
 			$email_access_link = sprintf(
1235 1235
 				'<a href="%1$s" target="_blank">%2$s</a>',
1236
-				esc_url( $access_url ),
1237
-				__( 'View your donation history &raquo;', 'give' )
1236
+				esc_url($access_url),
1237
+				__('View your donation history &raquo;', 'give')
1238 1238
 			);
1239 1239
 
1240 1240
 		} else {
1241 1241
 
1242 1242
 			$email_access_link = sprintf(
1243 1243
 				'%1$s: %2$s',
1244
-				__( 'View your donation history', 'give' ),
1245
-				esc_url( $access_url )
1244
+				__('View your donation history', 'give'),
1245
+				esc_url($access_url)
1246 1246
 			);
1247 1247
 		}
1248 1248
 	}
@@ -1274,23 +1274,23 @@  discard block
 block discarded – undo
1274 1274
  *
1275 1275
  * @return array
1276 1276
  */
1277
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1278
-	if ( ! is_array( $tag_args ) ) {
1279
-		switch ( true ) {
1280
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1281
-				$tag_args = array( 'payment_id' => $tag_args );
1277
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1278
+	if ( ! is_array($tag_args)) {
1279
+		switch (true) {
1280
+			case ('give_payment' === get_post_type($tag_args)):
1281
+				$tag_args = array('payment_id' => $tag_args);
1282 1282
 				break;
1283 1283
 
1284
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1285
-				$tag_args = array( 'user_id' => $tag_args );
1284
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1285
+				$tag_args = array('user_id' => $tag_args);
1286 1286
 				break;
1287 1287
 
1288
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1289
-				$tag_args = array( 'donor_id' => $tag_args );
1288
+			case (Give()->donors->get_by('id', $tag_args)):
1289
+				$tag_args = array('donor_id' => $tag_args);
1290 1290
 				break;
1291 1291
 
1292
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1293
-				$tag_args = array( 'user_id' => $tag_args );
1292
+			case (Give()->donors->get_by('user_id', $tag_args)):
1293
+				$tag_args = array('user_id' => $tag_args);
1294 1294
 				break;
1295 1295
 		}
1296 1296
 	}
@@ -1308,39 +1308,39 @@  discard block
 block discarded – undo
1308 1308
  *
1309 1309
  * @return array
1310 1310
  */
1311
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1311
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1312 1312
 
1313 1313
 	$reset_password_url = '';
1314 1314
 
1315
-	switch ( true ) {
1316
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1317
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
1315
+	switch (true) {
1316
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1317
+			$payment    = new Give_Payment($tag_args['payment_id']);
1318 1318
 			$payment_id = $payment->number;
1319 1319
 			break;
1320 1320
 
1321
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1322
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1321
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1322
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1323 1323
 			break;
1324 1324
 
1325
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1325
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1326 1326
 			/* @var Give_Donor $donor */
1327
-			$donor = new Give_Donor( $tag_args['user_id'], true );
1328
-			$reset_password_url = give_get_reset_password_url( $donor->user_id );
1327
+			$donor = new Give_Donor($tag_args['user_id'], true);
1328
+			$reset_password_url = give_get_reset_password_url($donor->user_id);
1329 1329
 			break;
1330 1330
 	}
1331 1331
 
1332
-	if( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1332
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1333 1333
 		// Generate link, if Email content type is html.
1334 1334
 		$reset_password_link = sprintf(
1335 1335
 			'<a href="%1$s" target="_blank">%2$s</a>',
1336
-			esc_url( $reset_password_url ),
1337
-			__( 'Reset your password &raquo;', 'give' )
1336
+			esc_url($reset_password_url),
1337
+			__('Reset your password &raquo;', 'give')
1338 1338
 		);
1339
-	} else{
1339
+	} else {
1340 1340
 		$reset_password_link = sprintf(
1341 1341
 			'%1$s: %2$s',
1342
-			__( 'Reset your password', 'give' ),
1343
-			esc_url( $reset_password_url )
1342
+			__('Reset your password', 'give'),
1343
+			esc_url($reset_password_url)
1344 1344
 		);
1345 1345
 	}
1346 1346
 
@@ -1369,21 +1369,21 @@  discard block
 block discarded – undo
1369 1369
  *
1370 1370
  * @return mixed|string
1371 1371
  */
1372
-function give_get_reset_password_url( $user_id ) {
1372
+function give_get_reset_password_url($user_id) {
1373 1373
 	$reset_password_url = '';
1374 1374
 
1375 1375
 	// Proceed further only, if user_id exists.
1376
-	if ( $user_id ) {
1376
+	if ($user_id) {
1377 1377
 
1378 1378
 		// Get User Object Details.
1379
-		$user = get_user_by( 'ID', $user_id );
1379
+		$user = get_user_by('ID', $user_id);
1380 1380
 
1381 1381
 		// Prepare Reset Password URL.
1382
-		$reset_password_url = esc_url( add_query_arg( array(
1382
+		$reset_password_url = esc_url(add_query_arg(array(
1383 1383
 			'action' => 'rp',
1384
-			'key' => get_password_reset_key( $user ),
1384
+			'key' => get_password_reset_key($user),
1385 1385
 			'login' => $user->user_login,
1386
-		), wp_login_url() ) );
1386
+		), wp_login_url()));
1387 1387
 	}
1388 1388
 
1389 1389
 	return $reset_password_url;
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
30
-	$payment = new Give_Payment( $payment_id );
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30
+	$payment = new Give_Payment($payment_id);
31 31
 
32 32
 	/**
33 33
 	 * Fire the action
34 34
 	 */
35
-	do_action( 'give_donation-receipt_email_notification', $payment_id );
35
+	do_action('give_donation-receipt_email_notification', $payment_id);
36 36
 
37 37
 	// If admin notifications are on, send the admin notice.
38
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
38
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
39 39
 		/**
40 40
 		 * Fires in the donation email receipt.
41 41
 		 *
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		 * @param int   $payment_id   Payment id.
47 47
 		 * @param mixed $payment_data Payment meta data.
48 48
 		 */
49
-		do_action( 'give_new-donation_email_notification', $payment_id, $payment->payment_meta );
49
+		do_action('give_new-donation_email_notification', $payment_id, $payment->payment_meta);
50 50
 	}
51 51
 }
52 52
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return void
61 61
  */
62
-function give_admin_email_notice( $payment_id ) {
62
+function give_admin_email_notice($payment_id) {
63 63
 	/**
64 64
 	 * Fires in the donation email receipt.
65 65
 	 *
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 	 * @param int   $payment_id   Payment id.
71 71
 	 * @param mixed $payment_data Payment meta data.
72 72
 	 */
73
-	do_action( 'give_new-donation_email_notification', $payment_id );
73
+	do_action('give_new-donation_email_notification', $payment_id);
74 74
 }
75 75
 
76
-add_action( 'give_admin_donation_email', 'give_admin_email_notice' );
76
+add_action('give_admin_donation_email', 'give_admin_email_notice');
77 77
 
78 78
 
79 79
 /**
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function give_get_default_donation_notification_email() {
88 88
 
89
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n";
90
-	$default_email_body .= __( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
91
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
92
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
93
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
94
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
95
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n";
96
-	$default_email_body .= '{sitename}' . "\n";
89
+	$default_email_body = __('Hi there,', 'give')."\n\n";
90
+	$default_email_body .= __('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
91
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {name}'."\n";
92
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
93
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
94
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
95
+	$default_email_body .= __('Thank you,', 'give')."\n\n";
96
+	$default_email_body .= '{sitename}'."\n";
97 97
 
98
-	return apply_filters( 'give_default_donation_notification_email', $default_email_body );
98
+	return apply_filters('give_default_donation_notification_email', $default_email_body);
99 99
 }
100 100
 
101 101
 
@@ -109,21 +109,21 @@  discard block
 block discarded – undo
109 109
  */
110 110
 function give_get_default_donation_receipt_email() {
111 111
 
112
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
113
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
114
-	$default_email_body .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
115
-	$default_email_body .= '<strong>' . __( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
116
-	$default_email_body .= '<strong>' . __( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
117
-	$default_email_body .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n";
118
-	$default_email_body .= '<strong>' . __( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
119
-	$default_email_body .= '<strong>' . __( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
120
-	$default_email_body .= '<strong>' . __( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
121
-	$default_email_body .= '{receipt_link}' . "\n\n";
112
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
113
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
114
+	$default_email_body .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
115
+	$default_email_body .= '<strong>'.__('Donation:', 'give').'</strong> {donation}'."\n";
116
+	$default_email_body .= '<strong>'.__('Donation Date:', 'give').'</strong> {date}'."\n";
117
+	$default_email_body .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n";
118
+	$default_email_body .= '<strong>'.__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
119
+	$default_email_body .= '<strong>'.__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
120
+	$default_email_body .= '<strong>'.__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
121
+	$default_email_body .= '{receipt_link}'."\n\n";
122 122
 	$default_email_body .= "\n\n";
123
-	$default_email_body .= __( 'Sincerely,', 'give' ) . "\n";
124
-	$default_email_body .= '{sitename}' . "\n";
123
+	$default_email_body .= __('Sincerely,', 'give')."\n";
124
+	$default_email_body .= '{sitename}'."\n";
125 125
 
126
-	return apply_filters( 'give_default_donation_receipt_email', $default_email_body );
126
+	return apply_filters('give_default_donation_receipt_email', $default_email_body);
127 127
 }
128 128
 
129 129
 /**
@@ -136,22 +136,22 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return array $email_names
138 138
  */
139
-function give_get_email_names( $user_info, $payment = false ) {
139
+function give_get_email_names($user_info, $payment = false) {
140 140
 	$email_names = array();
141 141
 
142
-	if ( is_a( $payment, 'Give_Payment' ) ) {
142
+	if (is_a($payment, 'Give_Payment')) {
143 143
 
144
-		if ( $payment->user_id > 0 ) {
144
+		if ($payment->user_id > 0) {
145 145
 
146
-			$user_data               = get_userdata( $payment->user_id );
146
+			$user_data               = get_userdata($payment->user_id);
147 147
 			$email_names['name']     = $payment->first_name;
148
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
148
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
149 149
 			$email_names['username'] = $user_data->user_login;
150 150
 
151
-		} elseif ( ! empty( $payment->first_name ) ) {
151
+		} elseif ( ! empty($payment->first_name)) {
152 152
 
153 153
 			$email_names['name']     = $payment->first_name;
154
-			$email_names['fullname'] = trim( $payment->first_name . ' ' . $payment->last_name );
154
+			$email_names['fullname'] = trim($payment->first_name.' '.$payment->last_name);
155 155
 			$email_names['username'] = $payment->first_name;
156 156
 
157 157
 		} else {
@@ -164,30 +164,30 @@  discard block
 block discarded – undo
164 164
 	} else {
165 165
 
166 166
 		// Support for old serialized data.
167
-		if ( is_serialized( $user_info ) ) {
167
+		if (is_serialized($user_info)) {
168 168
 
169 169
 			// Security check.
170
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
171
-			if ( ! empty( $matches ) ) {
170
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
171
+			if ( ! empty($matches)) {
172 172
 				return array(
173 173
 					'name'     => '',
174 174
 					'fullname' => '',
175 175
 					'username' => '',
176 176
 				);
177 177
 			} else {
178
-				$user_info = maybe_unserialize( $user_info );
178
+				$user_info = maybe_unserialize($user_info);
179 179
 			}
180 180
 
181 181
 		}
182 182
 
183
-		if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
184
-			$user_data               = get_userdata( $user_info['id'] );
183
+		if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
184
+			$user_data               = get_userdata($user_info['id']);
185 185
 			$email_names['name']     = $user_info['first_name'];
186
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
186
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
187 187
 			$email_names['username'] = $user_data->user_login;
188
-		} elseif ( isset( $user_info['first_name'] ) ) {
188
+		} elseif (isset($user_info['first_name'])) {
189 189
 			$email_names['name']     = $user_info['first_name'];
190
-			$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
190
+			$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
191 191
 			$email_names['username'] = $user_info['first_name'];
192 192
 		} else {
193 193
 			$email_names['name']     = $user_info['email'];
@@ -207,37 +207,37 @@  discard block
 block discarded – undo
207 207
  *
208 208
  * @since 1.8.14
209 209
  */
210
-function give_admin_email_user_donor_disconnection( $user_id, $donor_id ) {
210
+function give_admin_email_user_donor_disconnection($user_id, $donor_id) {
211 211
 
212
-	$user_id  = absint( $user_id );
213
-	$donor_id = absint( $donor_id );
212
+	$user_id  = absint($user_id);
213
+	$donor_id = absint($donor_id);
214 214
 
215 215
 	// Bail Out, if user id doesn't exists.
216
-	if ( empty( $user_id ) ) {
216
+	if (empty($user_id)) {
217 217
 		return;
218 218
 	}
219 219
 
220 220
 	// Bail Out, if donor id doesn't exists.
221
-	if ( empty( $donor_id ) ) {
221
+	if (empty($donor_id)) {
222 222
 		return;
223 223
 	}
224 224
 
225
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
225
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
226 226
 
227
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
227
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
228 228
 
229 229
 	/* translators: %s: payment id */
230
-	$subject = __( 'Attention: User tries to login whose Donor profile is disconnected!', 'give' );
230
+	$subject = __('Attention: User tries to login whose Donor profile is disconnected!', 'give');
231 231
 
232 232
 	/**
233 233
 	 * Filters the Donor-User Disconnection notification subject.
234 234
 	 *
235 235
 	 * @since 1.8.14
236 236
 	 */
237
-	$subject = apply_filters( 'give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags( $subject ) );
237
+	$subject = apply_filters('give_admin_donor_user_disconnection_notification_subject', wp_strip_all_tags($subject));
238 238
 
239
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
240
-	$headers .= "Reply-To: " . $from_email . "\r\n";
239
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
240
+	$headers .= "Reply-To: ".$from_email."\r\n";
241 241
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
242 242
 
243 243
 	/**
@@ -245,25 +245,25 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @since 1.8.14
247 247
 	 */
248
-	$headers = apply_filters( 'give_admin_donor_user_disconnection_notification_headers', $headers );
248
+	$headers = apply_filters('give_admin_donor_user_disconnection_notification_headers', $headers);
249 249
 
250
-	$message = __( 'Hi Admin,', 'give' ) . "\n\n";
251
-	$message .= __( 'This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give' ) . "\n\n";
252
-	$message .= __( 'Do you want to reconnect User and Donor profile again?', 'give' ) . "\n\n";
250
+	$message = __('Hi Admin,', 'give')."\n\n";
251
+	$message .= __('This email is to inform you that a user has tried logging in. But, User was unable to login due to User-Donor profile disconnection.', 'give')."\n\n";
252
+	$message .= __('Do you want to reconnect User and Donor profile again?', 'give')."\n\n";
253 253
 	$message .= sprintf(
254 254
 		'<a href="%1$s">%2$s</a>',
255
-		esc_url( admin_url() . 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&user_id=' . $user_id . '&give-message=reconnect-user' ),
256
-		__( 'Reconnect User', 'give' ) . "\n\n"
255
+		esc_url(admin_url().'edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&user_id='.$user_id.'&give-message=reconnect-user'),
256
+		__('Reconnect User', 'give')."\n\n"
257 257
 	);
258
-	$message .= __( 'Thank you,', 'give' ) . "\n\n";
259
-	$message .= '{sitename}' . "\n";
258
+	$message .= __('Thank you,', 'give')."\n\n";
259
+	$message .= '{sitename}'."\n";
260 260
 
261 261
 	$emails = Give()->emails;
262
-	$emails->__set( 'from_name', $from_name );
263
-	$emails->__set( 'from_email', $from_email );
264
-	$emails->__set( 'headers', $headers );
265
-	$emails->__set( 'heading', __( 'User - Donor Profile Disconnection', 'give' ) );
262
+	$emails->__set('from_name', $from_name);
263
+	$emails->__set('from_email', $from_email);
264
+	$emails->__set('headers', $headers);
265
+	$emails->__set('heading', __('User - Donor Profile Disconnection', 'give'));
266 266
 
267
-	$emails->send( give_get_admin_notice_emails(), $subject, give_do_email_tags( $message ) );
267
+	$emails->send(give_get_admin_notice_emails(), $subject, give_do_email_tags($message));
268 268
 
269 269
 }
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +52 added lines, -52 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
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return string $message Fully formatted message
44 44
  */
45
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
46
-	return give_do_email_tags( $message, $payment_id );
45
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
46
+	return give_do_email_tags($message, $payment_id);
47 47
 }
48 48
 
49 49
 /**
@@ -57,45 +57,45 @@  discard block
 block discarded – undo
57 57
  *
58 58
  * @return string $message Fully formatted message
59 59
  */
60
-function give_email_preview_template_tags( $message ) {
60
+function give_email_preview_template_tags($message) {
61 61
 
62
-	$price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) );
62
+	$price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false)));
63 63
 
64 64
 	$gateway = 'PayPal';
65 65
 
66
-	$receipt_id = strtolower( md5( uniqid() ) );
66
+	$receipt_id = strtolower(md5(uniqid()));
67 67
 
68
-	$payment_id = rand( 1, 100 );
69
-	$receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) );
68
+	$payment_id = rand(1, 100);
69
+	$receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri()));
70 70
 
71 71
 	$receipt_link     = sprintf(
72 72
 		'<a href="%1$s">%2$s</a>',
73 73
 		$receipt_link_url,
74
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
74
+		esc_html__('View the receipt in your browser &raquo;', 'give')
75 75
 	);
76 76
 
77 77
 	// Set user.
78 78
 	$user = wp_get_current_user();
79 79
 
80
-	$message = str_replace( '{name}', $user->display_name, $message );
81
-	$message = str_replace( '{fullname}', $user->display_name, $message );
82
-	$message = str_replace( '{username}', $user->user_login, $message );
83
-	$message = str_replace( '{user_email}', $user->user_email, $message );
84
-	$message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message );
85
-	$message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message );
86
-	$message = str_replace( '{amount}', $price, $message );
87
-	$message = str_replace( '{price}', $price, $message );
88
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
89
-	$message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message );
90
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
91
-	$message = str_replace( '{payment_method}', $gateway, $message );
92
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
93
-	$message = str_replace( '{payment_id}', $payment_id, $message );
94
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
95
-	$message = str_replace( '{receipt_link_url}', $receipt_link_url, $message );
96
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
97
-
98
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
80
+	$message = str_replace('{name}', $user->display_name, $message);
81
+	$message = str_replace('{fullname}', $user->display_name, $message);
82
+	$message = str_replace('{username}', $user->user_login, $message);
83
+	$message = str_replace('{user_email}', $user->user_email, $message);
84
+	$message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message);
85
+	$message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message);
86
+	$message = str_replace('{amount}', $price, $message);
87
+	$message = str_replace('{price}', $price, $message);
88
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
89
+	$message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message);
90
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
91
+	$message = str_replace('{payment_method}', $gateway, $message);
92
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
93
+	$message = str_replace('{payment_id}', $payment_id, $message);
94
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
95
+	$message = str_replace('{receipt_link_url}', $receipt_link_url, $message);
96
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
97
+
98
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
99 99
 }
100 100
 
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @return array
113 113
  */
114
-function give_email_preview_buttons_callback( $field ) {
115
-	$field_id = str_replace( '_preview_buttons', '', $field['id'] );
114
+function give_email_preview_buttons_callback($field) {
115
+	$field_id = str_replace('_preview_buttons', '', $field['id']);
116 116
 
117 117
 	ob_start();
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 		'<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>',
121 121
 		wp_nonce_url(
122 122
 			add_query_arg(
123
-				array( 'give_action' => 'preview_email', 'email_type' => $field_id ),
123
+				array('give_action' => 'preview_email', 'email_type' => $field_id),
124 124
 				home_url()
125 125
 			), 'give-preview-email'
126 126
 		),
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 	echo sprintf(
131 131
 		' <a href="%1$s" aria-label="%2$s" class="button-secondary">%3$s</a>',
132 132
 		wp_nonce_url(
133
-				add_query_arg( array(
133
+				add_query_arg(array(
134 134
 			'give_action'  => 'send_preview_email',
135 135
 			'email_type' => $field_id,
136 136
 			'give-message' => 'sent-test-email',
137
-		) ), 'give-send-preview-email' ),
138
-		esc_attr__( 'Send Test Email.', 'give' ),
139
-		esc_html__( 'Send Test Email', 'give' )
137
+		)), 'give-send-preview-email' ),
138
+		esc_attr__('Send Test Email.', 'give'),
139
+		esc_html__('Send Test Email', 'give')
140 140
 	);
141 141
 
142 142
 	echo ob_get_clean();
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 
156 156
 	//Payment receipt switcher
157 157
 	$payment_count = give_count_payments()->publish;
158
-	$payment_id    = give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' );
158
+	$payment_id    = give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id');
159 159
 
160
-	if ( $payment_count <= 0 ) {
160
+	if ($payment_count <= 0) {
161 161
 		return false;
162 162
 	}
163 163
 
164 164
 	//Get payments.
165
-	$payments = new Give_Payments_Query( array(
165
+	$payments = new Give_Payments_Query(array(
166 166
 		'number' => 100,
167
-	) );
167
+	));
168 168
 	$payments = $payments->get_payments();
169 169
 	$options  = array();
170 170
 
171 171
 	// Default option.
172
-	$options[0] = esc_html__( 'No donations found.', 'give' );
172
+	$options[0] = esc_html__('No donations found.', 'give');
173 173
 
174 174
 	//Provide nice human readable options.
175
-	if ( $payments ) {
176
-		$options[0] = esc_html__( '- Select a donation -', 'give' );
177
-		foreach ( $payments as $payment ) {
175
+	if ($payments) {
176
+		$options[0] = esc_html__('- Select a donation -', 'give');
177
+		foreach ($payments as $payment) {
178 178
 
179
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
179
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
180 180
 
181 181
 		}
182 182
 	}
@@ -185,27 +185,27 @@  discard block
 block discarded – undo
185 185
 	$transaction_header = '<div style="margin:0;padding:10px 0;width:100%;background-color:#FFF;border-bottom:1px solid #eee; text-align:center;">';
186 186
 
187 187
 	// Remove payment id query param if set from request url.
188
-	$request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] );
188
+	$request_url_data = wp_parse_url($_SERVER['REQUEST_URI']);
189 189
 	$query            = $request_url_data['query'];
190
-	$query            = remove_query_arg( array( 'preview_id' ), $query );
190
+	$query            = remove_query_arg(array('preview_id'), $query);
191 191
 
192
-	$request_url = home_url( '/?' . str_replace( '', '', $query ) );
192
+	$request_url = home_url('/?'.str_replace('', '', $query));
193 193
 
194 194
 	$transaction_header .= '<script>
195 195
 				 function change_preview(){
196 196
 				  var transactions = document.getElementById("give_preview_email_payment_id");
197 197
 			        var selected_trans = transactions.options[transactions.selectedIndex];
198 198
 				        if (selected_trans){
199
-				            var url_string = "' . $request_url . '&preview_id=" + selected_trans.value;
199
+				            var url_string = "' . $request_url.'&preview_id=" + selected_trans.value;
200 200
 				                window.location = url_string;
201 201
 				        }
202 202
 				    }
203 203
 			    </script>';
204 204
 
205
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>';
205
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>';
206 206
 
207 207
 	//The select field with 100 latest transactions
208
-	$transaction_header .= Give()->html->select( array(
208
+	$transaction_header .= Give()->html->select(array(
209 209
 		'name'             => 'preview_email_payment_id',
210 210
 		'selected'         => $payment_id,
211 211
 		'id'               => 'give_preview_email_payment_id',
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 		'select_atts'      => 'onchange="change_preview()"',
216 216
 		'show_option_all'  => false,
217 217
 		'show_option_none' => false,
218
-	) );
218
+	));
219 219
 
220 220
 	//Closing tag
221 221
 	$transaction_header .= '</div>';
222 222
 
223
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
223
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
224 224
 
225 225
 }
226 226
\ No newline at end of file
Please login to merge, or discard this patch.