Test Failed
Push — master ( 1d3b59...426730 )
by Devin
01:16
created
includes/class-give-db.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105 105
 		// Bailout.
106
-		if ( empty( $row_id ) ) {
106
+		if (empty($row_id)) {
107 107
 			return null;
108 108
 		}
109 109
 
110
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
110
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
111 111
 	}
112 112
 
113 113
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return object
123 123
 	 */
124
-	public function get_by( $column, $row_id ) {
124
+	public function get_by($column, $row_id) {
125 125
 		/* @var WPDB $wpdb */
126 126
 		global $wpdb;
127 127
 
128 128
 		// Bailout.
129
-		if ( empty( $column ) || empty( $row_id ) ) {
129
+		if (empty($column) || empty($row_id)) {
130 130
 			return null;
131 131
 		}
132 132
 
133
-		$column = esc_sql( $column );
133
+		$column = esc_sql($column);
134 134
 
135
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
135
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
136 136
 	}
137 137
 
138 138
 	/**
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return string      Column value.
148 148
 	 */
149
-	public function get_column( $column, $row_id ) {
149
+	public function get_column($column, $row_id) {
150 150
 		/* @var WPDB $wpdb */
151 151
 		global $wpdb;
152 152
 
153 153
 		// Bailout.
154
-		if ( empty( $column ) || empty( $row_id ) ) {
154
+		if (empty($column) || empty($row_id)) {
155 155
 			return null;
156 156
 		}
157 157
 
158
-		$column = esc_sql( $column );
158
+		$column = esc_sql($column);
159 159
 
160
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
160
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
161 161
 	}
162 162
 
163 163
 	/**
@@ -172,19 +172,19 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return string
174 174
 	 */
175
-	public function get_column_by( $column, $column_where, $column_value ) {
175
+	public function get_column_by($column, $column_where, $column_value) {
176 176
 		/* @var WPDB $wpdb */
177 177
 		global $wpdb;
178 178
 
179 179
 		// Bailout.
180
-		if ( empty( $column ) || empty( $column_where ) || empty( $column_value ) ) {
180
+		if (empty($column) || empty($column_where) || empty($column_value)) {
181 181
 			return null;
182 182
 		}
183 183
 
184
-		$column_where = esc_sql( $column_where );
185
-		$column       = esc_sql( $column );
184
+		$column_where = esc_sql($column_where);
185
+		$column       = esc_sql($column);
186 186
 
187
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
187
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
188 188
 	}
189 189
 
190 190
 	/**
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return int
200 200
 	 */
201
-	public function insert( $data, $type = '' ) {
201
+	public function insert($data, $type = '') {
202 202
 		/* @var WPDB $wpdb */
203 203
 		global $wpdb;
204 204
 
205 205
 		// Set default values.
206
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
206
+		$data = wp_parse_args($data, $this->get_column_defaults());
207 207
 
208 208
 		/**
209 209
 		 * Fires before inserting data to the database.
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		 *
213 213
 		 * @param array $data
214 214
 		 */
215
-		do_action( "give_pre_insert_{$type}", $data );
215
+		do_action("give_pre_insert_{$type}", $data);
216 216
 
217 217
 		// Initialise column format array
218 218
 		$column_formats = $this->get_columns();
@@ -221,13 +221,13 @@  discard block
 block discarded – undo
221 221
 		// $data = array_change_key_case( $data );
222 222
 
223 223
 		// White list columns
224
-		$data = array_intersect_key( $data, $column_formats );
224
+		$data = array_intersect_key($data, $column_formats);
225 225
 
226 226
 		// Reorder $column_formats to match the order of columns given in $data
227
-		$data_keys      = array_keys( $data );
228
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
227
+		$data_keys      = array_keys($data);
228
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
229 229
 
230
-		$wpdb->insert( $this->table_name, $data, $column_formats );
230
+		$wpdb->insert($this->table_name, $data, $column_formats);
231 231
 
232 232
 		/**
233 233
 		 * Fires after inserting data to the database.
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @param int   $insert_id
238 238
 		 * @param array $data
239 239
 		 */
240
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
240
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
241 241
 
242 242
 		return $wpdb->insert_id;
243 243
 	}
@@ -254,18 +254,18 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @return bool
256 256
 	 */
257
-	public function update( $row_id, $data = array(), $where = '' ) {
257
+	public function update($row_id, $data = array(), $where = '') {
258 258
 		/* @var WPDB $wpdb */
259 259
 		global $wpdb;
260 260
 
261 261
 		// Row ID must be positive integer
262
-		$row_id = absint( $row_id );
262
+		$row_id = absint($row_id);
263 263
 
264
-		if ( empty( $row_id ) ) {
264
+		if (empty($row_id)) {
265 265
 			return false;
266 266
 		}
267 267
 
268
-		if ( empty( $where ) ) {
268
+		if (empty($where)) {
269 269
 			$where = $this->primary_key;
270 270
 		}
271 271
 
@@ -273,16 +273,16 @@  discard block
 block discarded – undo
273 273
 		$column_formats = $this->get_columns();
274 274
 
275 275
 		// Force fields to lower case
276
-		$data = array_change_key_case( $data );
276
+		$data = array_change_key_case($data);
277 277
 
278 278
 		// White list columns
279
-		$data = array_intersect_key( $data, $column_formats );
279
+		$data = array_intersect_key($data, $column_formats);
280 280
 
281 281
 		// Reorder $column_formats to match the order of columns given in $data
282
-		$data_keys      = array_keys( $data );
283
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
282
+		$data_keys      = array_keys($data);
283
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
284 284
 
285
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
285
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
286 286
 			return false;
287 287
 		}
288 288
 
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return bool
301 301
 	 */
302
-	public function delete( $row_id = 0 ) {
302
+	public function delete($row_id = 0) {
303 303
 		/* @var WPDB $wpdb */
304 304
 		global $wpdb;
305 305
 
306 306
 		// Row ID must be positive integer
307
-		$row_id = absint( $row_id );
307
+		$row_id = absint($row_id);
308 308
 
309
-		if ( empty( $row_id ) ) {
309
+		if (empty($row_id)) {
310 310
 			return false;
311 311
 		}
312 312
 
313
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
313
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
314 314
 			return false;
315 315
 		}
316 316
 
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @return bool          If the table name exists.
329 329
 	 */
330
-	public function table_exists( $table ) {
330
+	public function table_exists($table) {
331 331
 		/* @var WPDB $wpdb */
332 332
 		global $wpdb;
333 333
 
334
-		$table = sanitize_text_field( $table );
334
+		$table = sanitize_text_field($table);
335 335
 
336
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
336
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
337 337
 	}
338 338
 
339 339
 	/**
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 	 *
348 348
 	 * @return bool
349 349
 	 */
350
-	public function does_column_exist( $column_name ) {
350
+	public function does_column_exist($column_name) {
351 351
 
352 352
 		global $wpdb;
353 353
 
354
-		$column = $wpdb->get_results( $wpdb->prepare(
354
+		$column = $wpdb->get_results($wpdb->prepare(
355 355
 			"SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ",
356 356
 			DB_NAME, $this->table_name, $column_name
357
-		) );
357
+		));
358 358
 
359
-		if ( ! empty( $column ) ) {
359
+		if ( ! empty($column)) {
360 360
 			return true;
361 361
 		}
362 362
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
373 373
 	 */
374 374
 	public function installed() {
375
-		return $this->table_exists( $this->table_name );
375
+		return $this->table_exists($this->table_name);
376 376
 	}
377 377
 
378 378
 	/**
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @access public
383 383
 	 */
384 384
 	public function register_table() {
385
-		$current_version = get_option( $this->table_name . '_db_version' );
386
-		if ( ! $current_version || version_compare( $current_version, $this->version, '<' ) ) {
385
+		$current_version = get_option($this->table_name.'_db_version');
386
+		if ( ! $current_version || version_compare($current_version, $this->version, '<')) {
387 387
 			$this->create_table();
388 388
 		}
389 389
 	}
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
 	 *
409 409
 	 * @return int|bool                The normalized log ID or false if it's found to not be valid.
410 410
 	 */
411
-	public function sanitize_id( $id ) {
412
-		if ( ! is_numeric( $id ) ) {
411
+	public function sanitize_id($id) {
412
+		if ( ! is_numeric($id)) {
413 413
 			return false;
414 414
 		}
415 415
 
416 416
 		$id = (int) $id;
417 417
 
418 418
 		// We were given a non positive number.
419
-		if ( absint( $id ) !== $id ) {
419
+		if (absint($id) !== $id) {
420 420
 			return false;
421 421
 		}
422 422
 
423
-		if ( empty( $id ) ) {
423
+		if (empty($id)) {
424 424
 			return false;
425 425
 		}
426 426
 
427
-		return absint( $id );
427
+		return absint($id);
428 428
 
429 429
 	}
430 430
 }
Please login to merge, or discard this patch.
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/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/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.
includes/class-give-translation.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return static
56 56
 	 */
57 57
 	public static function get_instance() {
58
-		if ( null === static::$instance ) {
58
+		if (null === static::$instance) {
59 59
 			self::$instance = new static();
60 60
 		}
61 61
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @access public
80 80
 	 */
81 81
 	public function setup_hooks() {
82
-		add_action( 'init', array( $this, 'load_translated_texts' ), 999 );
82
+		add_action('init', array($this, 'load_translated_texts'), 999);
83 83
 	}
84 84
 
85 85
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return bool|WP_Error false on success otherwise WP_Error object
112 112
 	 */
113
-	public static function add_text( $args = array() ) {
113
+	public static function add_text($args = array()) {
114 114
 		$error = false;
115 115
 
116 116
 		// Set text params.
@@ -126,43 +126,43 @@  discard block
 block discarded – undo
126 126
 
127 127
 		try {
128 128
 			// Check for errors.
129
-			if ( empty( $args['text'] ) ) {
129
+			if (empty($args['text'])) {
130 130
 				/* @var WP_Error $error */
131
-				$error = new WP_Error( 'EMPTY_TEXT', __( 'Empty string is not allowed.', 'give' ), $args );
132
-				throw new Exception( $error->get_error_message( 'EMPTY_TEXT' ) );
131
+				$error = new WP_Error('EMPTY_TEXT', __('Empty string is not allowed.', 'give'), $args);
132
+				throw new Exception($error->get_error_message('EMPTY_TEXT'));
133 133
 
134
-			} elseif ( empty( $args['id'] ) ) {
134
+			} elseif (empty($args['id'])) {
135 135
 				/* @var WP_Error $error */
136
-				$error = new WP_Error( 'EMPTY_ID', __( 'Empty ID is not allowed.', 'give' ), $args );
137
-				throw new Exception( $error->get_error_message( 'EMPTY_ID' ) );
136
+				$error = new WP_Error('EMPTY_ID', __('Empty ID is not allowed.', 'give'), $args);
137
+				throw new Exception($error->get_error_message('EMPTY_ID'));
138 138
 
139 139
 			} elseif (
140
-				empty( $args['group'] ) &&
141
-				array_key_exists( $args['id'], self::$text_configs )
140
+				empty($args['group']) &&
141
+				array_key_exists($args['id'], self::$text_configs)
142 142
 			) {
143 143
 				/* @var WP_Error $error */
144
-				$error = new WP_Error( 'TEXT_ID_ALREADY_EXIST', __( 'Text ID without group already exist.', 'give' ), $args );
145
-				throw new Exception( $error->get_error_message( 'TEXT_ID_ALREADY_EXIST' ) );
144
+				$error = new WP_Error('TEXT_ID_ALREADY_EXIST', __('Text ID without group already exist.', 'give'), $args);
145
+				throw new Exception($error->get_error_message('TEXT_ID_ALREADY_EXIST'));
146 146
 
147 147
 			} elseif (
148
-				! empty( $args['group'] ) &&
149
-				! empty( self::$text_configs[ $args['group'] ] ) &&
150
-				array_key_exists( $args['id'], self::$text_configs[ $args['group'] ] )
148
+				! empty($args['group']) &&
149
+				! empty(self::$text_configs[$args['group']]) &&
150
+				array_key_exists($args['id'], self::$text_configs[$args['group']])
151 151
 			) {
152 152
 				/* @var WP_Error $error */
153
-				$error = new WP_Error( 'TEXT_ID_WITHIN_GROUP_ALREADY_EXIST', __( 'Text ID with in group already exist.', 'give' ), $args );
154
-				throw new Exception( $error->get_error_message( 'TEXT_ID_WITHIN_GROUP_ALREADY_EXIST' ) );
153
+				$error = new WP_Error('TEXT_ID_WITHIN_GROUP_ALREADY_EXIST', __('Text ID with in group already exist.', 'give'), $args);
154
+				throw new Exception($error->get_error_message('TEXT_ID_WITHIN_GROUP_ALREADY_EXIST'));
155 155
 
156 156
 			}
157 157
 
158 158
 			// Add text.
159
-			if ( ! empty( $args['group'] ) ) {
160
-				self::$text_configs[ $args['group'] ][ $args['id'] ] = $args;
159
+			if ( ! empty($args['group'])) {
160
+				self::$text_configs[$args['group']][$args['id']] = $args;
161 161
 			} else {
162
-				self::$text_configs[ $args['id'] ] = $args;
162
+				self::$text_configs[$args['id']] = $args;
163 163
 			}
164
-		} catch ( Exception $e ) {
165
-			error_log( $e->getMessage() );
164
+		} catch (Exception $e) {
165
+			error_log($e->getMessage());
166 166
 		}// End try().
167 167
 
168 168
 		/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		 *
171 171
 		 * @since 2.0
172 172
 		 */
173
-		self::$text_configs = apply_filters( 'give_texts', self::$text_configs );
173
+		self::$text_configs = apply_filters('give_texts', self::$text_configs);
174 174
 
175 175
 		return $error;
176 176
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string
187 187
 	 */
188
-	public static function add_label( $args = array() ) {
188
+	public static function add_label($args = array()) {
189 189
 		// Set text params.
190 190
 		$args = wp_parse_args(
191 191
 			$args,
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 		$args['type'] = 'label';
200 200
 		$args['id']   = "{$args['id']}_label";
201 201
 
202
-		return self::add_text( $args );
202
+		return self::add_text($args);
203 203
 	}
204 204
 
205 205
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return string
214 214
 	 */
215
-	public static function add_tooltip( $args = array() ) {
215
+	public static function add_tooltip($args = array()) {
216 216
 		// Set text params.
217 217
 		$args = wp_parse_args(
218 218
 			$args,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		$args['type'] = 'tooltip';
227 227
 		$args['id']   = "{$args['id']}_tooltip";
228 228
 
229
-		return self::add_text( $args );
229
+		return self::add_text($args);
230 230
 	}
231 231
 
232 232
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string
241 241
 	 */
242
-	public static function add_translation( $args = array() ) {
242
+	public static function add_translation($args = array()) {
243 243
 		$args = wp_parse_args(
244 244
 			$args,
245 245
 			array(
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		);
251 251
 
252 252
 		// Bailout.
253
-		if ( empty( $args['id'] ) ) {
253
+		if (empty($args['id'])) {
254 254
 			return;
255 255
 		}
256 256
 
257
-		if ( ! empty( $args['group'] ) ) {
258
-			self::$text_translations[ $args['group'] ][ $args['id'] ] = $args['text'];
257
+		if ( ! empty($args['group'])) {
258
+			self::$text_translations[$args['group']][$args['id']] = $args['text'];
259 259
 		} else {
260
-			self::$text_translations[ $args['id'] ] = $args['text'];
260
+			self::$text_translations[$args['id']] = $args['text'];
261 261
 		}
262 262
 	}
263 263
 
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @return string
275 275
 	 */
276
-	public static function add_label_translation( $id, $group = '', $text = '' ) {
277
-		return self::get_text( array(
276
+	public static function add_label_translation($id, $group = '', $text = '') {
277
+		return self::get_text(array(
278 278
 			'id' => "{$id}_label",
279 279
 			'group' => $group,
280 280
 			'text' => $text,
281
-		) );
281
+		));
282 282
 	}
283 283
 
284 284
 	/**
@@ -293,12 +293,12 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @return string
295 295
 	 */
296
-	public static function add_tooltip_translation( $id, $group = '', $text = '' ) {
297
-		return self::get_text( array(
296
+	public static function add_tooltip_translation($id, $group = '', $text = '') {
297
+		return self::get_text(array(
298 298
 			'id' => "{$id}_label",
299 299
 			'group' => $group,
300 300
 			'text' => $text,
301
-		) );
301
+		));
302 302
 	}
303 303
 
304 304
 	/**
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return string
314 314
 	 */
315
-	public static function get_label( $id, $group = '' ) {
316
-		return self::get_text( array(
315
+	public static function get_label($id, $group = '') {
316
+		return self::get_text(array(
317 317
 			'id' => "{$id}_label",
318 318
 			'group' => $group,
319 319
 			'type' => 'label',
320
-		) );
320
+		));
321 321
 	}
322 322
 
323 323
 	/**
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 	 *
332 332
 	 * @return string
333 333
 	 */
334
-	public static function get_tooltip( $id, $group = '' ) {
335
-		return self::get_text( array(
334
+	public static function get_tooltip($id, $group = '') {
335
+		return self::get_text(array(
336 336
 			'id' => "{$id}_tooltip",
337 337
 			'group' => $group,
338 338
 			'type' => 'tooltip',
339
-		) );
339
+		));
340 340
 	}
341 341
 
342 342
 	/**
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 	 *
350 350
 	 * @return string
351 351
 	 */
352
-	public static function get_text( $args = array() ) {
352
+	public static function get_text($args = array()) {
353 353
 		$text = '';
354 354
 
355 355
 		// Bailout.
356
-		if ( empty( $args ) ) {
356
+		if (empty($args)) {
357 357
 			return $text;
358 358
 		}
359 359
 
@@ -369,40 +369,40 @@  discard block
 block discarded – undo
369 369
 
370 370
 		// Check if text exist.
371 371
 		if (
372
-			empty( $args['id'] ) ||
373
-			( empty( $args['group'] ) && ! array_key_exists( $args['id'], self::$text_configs ) ) ||
374
-			( ! empty( $args['group'] ) && ! empty( self::$text_configs[ $args['group'] ] ) && ! array_key_exists( $args['id'], self::$text_configs[ $args['group'] ] ) )
372
+			empty($args['id']) ||
373
+			(empty($args['group']) && ! array_key_exists($args['id'], self::$text_configs)) ||
374
+			( ! empty($args['group']) && ! empty(self::$text_configs[$args['group']]) && ! array_key_exists($args['id'], self::$text_configs[$args['group']]))
375 375
 		) {
376 376
 			return $text;
377 377
 		}
378 378
 
379 379
 		// Get text value.
380 380
 		if (
381
-			! empty( $args['group'] ) &&
382
-			array_key_exists( $args['group'], self::$text_configs )
381
+			! empty($args['group']) &&
382
+			array_key_exists($args['group'], self::$text_configs)
383 383
 		) {
384
-			$text = self::$text_configs[ $args['group'] ][ $args['id'] ]['text'];
384
+			$text = self::$text_configs[$args['group']][$args['id']]['text'];
385 385
 
386 386
 			// Get translated text if exist.
387 387
 			if (
388
-				! empty( self::$text_translations ) &&
389
-				! empty( self::$text_translations[ $args['group'] ] ) &&
390
-				array_key_exists( $args['id'], self::$text_translations[ $args['group'] ] )
388
+				! empty(self::$text_translations) &&
389
+				! empty(self::$text_translations[$args['group']]) &&
390
+				array_key_exists($args['id'], self::$text_translations[$args['group']])
391 391
 			) {
392
-				$text = self::$text_translations[ $args['group'] ][ $args['id'] ];
392
+				$text = self::$text_translations[$args['group']][$args['id']];
393 393
 			}
394 394
 		} elseif (
395
-			empty( $args['group'] ) &&
396
-			array_key_exists( $args['id'], self::$text_configs )
395
+			empty($args['group']) &&
396
+			array_key_exists($args['id'], self::$text_configs)
397 397
 		) {
398
-			$text = self::$text_configs[ $args['id'] ]['text'];
398
+			$text = self::$text_configs[$args['id']]['text'];
399 399
 
400 400
 			// Get translated text if exist.
401 401
 			if (
402
-				! empty( self::$text_translations ) &&
403
-				array_key_exists( $args['id'], self::$text_translations )
402
+				! empty(self::$text_translations) &&
403
+				array_key_exists($args['id'], self::$text_translations)
404 404
 			) {
405
-				$text = self::$text_translations[ $args['id'] ];
405
+				$text = self::$text_translations[$args['id']];
406 406
 			}
407 407
 		}
408 408
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		 *
412 412
 		 * @since 2.0
413 413
 		 */
414
-		$text = apply_filters( 'give_text', $text, $args, self::$text_configs, self::$text_translations );
414
+		$text = apply_filters('give_text', $text, $args, self::$text_configs, self::$text_translations);
415 415
 
416 416
 		return $text;
417 417
 	}
Please login to merge, or discard this patch.
includes/forms/functions.php 2 patches
Spacing   +214 added lines, -215 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
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -372,12 +371,12 @@  discard block
 block discarded – undo
372 371
  *
373 372
  * @return void
374 373
  */
375
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
374
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
376 375
 	$log_data = array(
377 376
 		'log_parent'   => $payment_id,
378 377
 		'log_type'     => 'sale',
379
-		'log_date'     => isset( $donation_date ) ? $donation_date : null,
380
-		'log_date_gmt' => isset( $donation_date ) ? $donation_date : null,
378
+		'log_date'     => isset($donation_date) ? $donation_date : null,
379
+		'log_date_gmt' => isset($donation_date) ? $donation_date : null,
381 380
 	);
382 381
 
383 382
 	$log_meta = array(
@@ -385,7 +384,7 @@  discard block
 block discarded – undo
385 384
 		'price_id' => (int) $price_id,
386 385
 	);
387 386
 
388
-	Give()->logs->insert_log( $log_data, $log_meta );
387
+	Give()->logs->insert_log($log_data, $log_meta);
389 388
 }
390 389
 
391 390
 
@@ -399,11 +398,11 @@  discard block
 block discarded – undo
399 398
  *
400 399
  * @return bool|int
401 400
  */
402
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
401
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
403 402
 	$quantity = (int) $quantity;
404
-	$form     = new Give_Donate_Form( $form_id );
403
+	$form     = new Give_Donate_Form($form_id);
405 404
 
406
-	return $form->increase_sales( $quantity );
405
+	return $form->increase_sales($quantity);
407 406
 }
408 407
 
409 408
 /**
@@ -416,11 +415,11 @@  discard block
 block discarded – undo
416 415
  *
417 416
  * @return bool|int
418 417
  */
419
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
418
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
420 419
 	$quantity = (int) $quantity;
421
-	$form     = new Give_Donate_Form( $form_id );
420
+	$form     = new Give_Donate_Form($form_id);
422 421
 
423
-	return $form->decrease_sales( $quantity );
422
+	return $form->decrease_sales($quantity);
424 423
 }
425 424
 
426 425
 /**
@@ -433,10 +432,10 @@  discard block
 block discarded – undo
433 432
  *
434 433
  * @return bool|int
435 434
  */
436
-function give_increase_earnings( $give_form_id = 0, $amount ) {
437
-	$form = new Give_Donate_Form( $give_form_id );
435
+function give_increase_earnings($give_form_id = 0, $amount) {
436
+	$form = new Give_Donate_Form($give_form_id);
438 437
 
439
-	return $form->increase_earnings( $amount );
438
+	return $form->increase_earnings($amount);
440 439
 }
441 440
 
442 441
 /**
@@ -451,11 +450,11 @@  discard block
 block discarded – undo
451 450
  *
452 451
  * @return bool|int
453 452
  */
454
-function give_decrease_form_earnings( $form_id = 0, $amount ) {
453
+function give_decrease_form_earnings($form_id = 0, $amount) {
455 454
 
456
-	$form = new Give_Donate_Form( $form_id );
455
+	$form = new Give_Donate_Form($form_id);
457 456
 
458
-	return $form->decrease_earnings( $amount );
457
+	return $form->decrease_earnings($amount);
459 458
 }
460 459
 
461 460
 
@@ -468,15 +467,15 @@  discard block
 block discarded – undo
468 467
  *
469 468
  * @return int $earnings Earnings for a certain form
470 469
  */
471
-function give_get_form_earnings_stats( $form_id = 0 ) {
472
-	$give_form = new Give_Donate_Form( $form_id );
470
+function give_get_form_earnings_stats($form_id = 0) {
471
+	$give_form = new Give_Donate_Form($form_id);
473 472
 
474 473
 	/**
475 474
 	 * Filter the form earnings
476 475
 	 *
477 476
 	 * @since 1.8.17
478 477
 	 */
479
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
478
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
480 479
 }
481 480
 
482 481
 
@@ -489,8 +488,8 @@  discard block
 block discarded – undo
489 488
  *
490 489
  * @return int $sales Amount of sales for a certain form
491 490
  */
492
-function give_get_form_sales_stats( $give_form_id = 0 ) {
493
-	$give_form = new Give_Donate_Form( $give_form_id );
491
+function give_get_form_sales_stats($give_form_id = 0) {
492
+	$give_form = new Give_Donate_Form($give_form_id);
494 493
 
495 494
 	return $give_form->sales;
496 495
 }
@@ -505,16 +504,16 @@  discard block
 block discarded – undo
505 504
  *
506 505
  * @return float $sales Average monthly sales
507 506
  */
508
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
509
-	$sales        = give_get_form_sales_stats( $form_id );
510
-	$release_date = get_post_field( 'post_date', $form_id );
507
+function give_get_average_monthly_form_sales($form_id = 0) {
508
+	$sales        = give_get_form_sales_stats($form_id);
509
+	$release_date = get_post_field('post_date', $form_id);
511 510
 
512
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
511
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
513 512
 
514
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
513
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
515 514
 
516
-	if ( $months > 0 ) {
517
-		$sales = ( $sales / $months );
515
+	if ($months > 0) {
516
+		$sales = ($sales / $months);
518 517
 	}
519 518
 
520 519
 	return $sales;
@@ -530,16 +529,16 @@  discard block
 block discarded – undo
530 529
  *
531 530
  * @return float $earnings Average monthly earnings
532 531
  */
533
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
534
-	$earnings     = give_get_form_earnings_stats( $form_id );
535
-	$release_date = get_post_field( 'post_date', $form_id );
532
+function give_get_average_monthly_form_earnings($form_id = 0) {
533
+	$earnings     = give_get_form_earnings_stats($form_id);
534
+	$release_date = get_post_field('post_date', $form_id);
536 535
 
537
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
536
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
538 537
 
539
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
538
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
540 539
 
541
-	if ( $months > 0 ) {
542
-		$earnings = ( $earnings / $months );
540
+	if ($months > 0) {
541
+		$earnings = ($earnings / $months);
543 542
 	}
544 543
 
545 544
 	return $earnings < 0 ? 0 : $earnings;
@@ -560,34 +559,34 @@  discard block
 block discarded – undo
560 559
  *
561 560
  * @return string $price_name Name of the price option
562 561
  */
563
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
562
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
564 563
 
565
-	$prices     = give_get_variable_prices( $form_id );
564
+	$prices     = give_get_variable_prices($form_id);
566 565
 	$price_name = '';
567 566
 
568
-	if ( false === $prices ) {
567
+	if (false === $prices) {
569 568
 		return $price_name;
570 569
 	}
571 570
 
572
-	foreach ( $prices as $price ) {
571
+	foreach ($prices as $price) {
573 572
 
574
-		if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) {
573
+		if (intval($price['_give_id']['level_id']) === intval($price_id)) {
575 574
 
576
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
575
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
577 576
 			$price_fallback = $use_fallback ?
578 577
 				give_currency_filter(
579 578
 					give_format_amount(
580 579
 						$price['_give_amount'],
581
-						array( 'sanitize' => false )
580
+						array('sanitize' => false)
582 581
 					),
583
-					array( 'decode_currency' => true )
582
+					array('decode_currency' => true)
584 583
 				) : '';
585
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
584
+			$price_name = ! empty($price_text) ? $price_text : $price_fallback;
586 585
 
587 586
 		}
588 587
 	}
589 588
 
590
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
589
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
591 590
 }
592 591
 
593 592
 
@@ -601,25 +600,25 @@  discard block
 block discarded – undo
601 600
  *
602 601
  * @return string $range A fully formatted price range
603 602
  */
604
-function give_price_range( $form_id = 0, $formatted = true ) {
605
-	$low        = give_get_lowest_price_option( $form_id );
606
-	$high       = give_get_highest_price_option( $form_id );
607
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
603
+function give_price_range($form_id = 0, $formatted = true) {
604
+	$low        = give_get_lowest_price_option($form_id);
605
+	$high       = give_get_highest_price_option($form_id);
606
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
608 607
 
609 608
 	$range = sprintf(
610 609
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
611 610
 		'asc' === $order_type ? 'low' : 'high',
612
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
611
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
613 612
 		'asc' === $order_type ? 'high' : 'low',
614
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
613
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
615 614
 
616 615
 	);
617 616
 
618
-	if ( ! $formatted ) {
619
-		$range = wp_strip_all_tags( $range );
617
+	if ( ! $formatted) {
618
+		$range = wp_strip_all_tags($range);
620 619
 	}
621 620
 
622
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
621
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
623 622
 }
624 623
 
625 624
 
@@ -634,35 +633,35 @@  discard block
 block discarded – undo
634 633
  *
635 634
  * @return int ID of the lowest price
636 635
  */
637
-function give_get_lowest_price_id( $form_id = 0 ) {
636
+function give_get_lowest_price_id($form_id = 0) {
638 637
 
639
-	if ( empty( $form_id ) ) {
638
+	if (empty($form_id)) {
640 639
 		$form_id = get_the_ID();
641 640
 	}
642 641
 
643
-	if ( ! give_has_variable_prices( $form_id ) ) {
644
-		return give_get_form_price( $form_id );
642
+	if ( ! give_has_variable_prices($form_id)) {
643
+		return give_get_form_price($form_id);
645 644
 	}
646 645
 
647
-	$prices = give_get_variable_prices( $form_id );
646
+	$prices = give_get_variable_prices($form_id);
648 647
 
649 648
 	$min = $min_id = 0;
650 649
 
651
-	if ( ! empty( $prices ) ) {
650
+	if ( ! empty($prices)) {
652 651
 
653
-		foreach ( $prices as $key => $price ) {
652
+		foreach ($prices as $key => $price) {
654 653
 
655
-			if ( empty( $price['_give_amount'] ) ) {
654
+			if (empty($price['_give_amount'])) {
656 655
 				continue;
657 656
 			}
658 657
 
659
-			if ( ! isset( $min ) ) {
658
+			if ( ! isset($min)) {
660 659
 				$min = $price['_give_amount'];
661 660
 			} else {
662
-				$min = min( $min, $price['_give_amount'] );
661
+				$min = min($min, $price['_give_amount']);
663 662
 			}
664 663
 
665
-			if ( $price['_give_amount'] == $min ) {
664
+			if ($price['_give_amount'] == $min) {
666 665
 				$min_id = $price['_give_id']['level_id'];
667 666
 			}
668 667
 		}
@@ -680,22 +679,22 @@  discard block
 block discarded – undo
680 679
  *
681 680
  * @return float Amount of the lowest price
682 681
  */
683
-function give_get_lowest_price_option( $form_id = 0 ) {
684
-	if ( empty( $form_id ) ) {
682
+function give_get_lowest_price_option($form_id = 0) {
683
+	if (empty($form_id)) {
685 684
 		$form_id = get_the_ID();
686 685
 	}
687 686
 
688
-	if ( ! give_has_variable_prices( $form_id ) ) {
689
-		return give_get_form_price( $form_id );
687
+	if ( ! give_has_variable_prices($form_id)) {
688
+		return give_get_form_price($form_id);
690 689
 	}
691 690
 
692
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
691
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
693 692
 		// Backward compatibility.
694
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
695
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
693
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
694
+		$low    = ! empty($prices) ? min($prices) : 0;
696 695
 	}
697 696
 
698
-	return give_maybe_sanitize_amount( $low );
697
+	return give_maybe_sanitize_amount($low);
699 698
 }
700 699
 
701 700
 /**
@@ -707,23 +706,23 @@  discard block
 block discarded – undo
707 706
  *
708 707
  * @return float Amount of the highest price
709 708
  */
710
-function give_get_highest_price_option( $form_id = 0 ) {
709
+function give_get_highest_price_option($form_id = 0) {
711 710
 
712
-	if ( empty( $form_id ) ) {
711
+	if (empty($form_id)) {
713 712
 		$form_id = get_the_ID();
714 713
 	}
715 714
 
716
-	if ( ! give_has_variable_prices( $form_id ) ) {
717
-		return give_get_form_price( $form_id );
715
+	if ( ! give_has_variable_prices($form_id)) {
716
+		return give_get_form_price($form_id);
718 717
 	}
719 718
 
720
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
719
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
721 720
 		// Backward compatibility.
722
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
723
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
721
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
722
+		$high   = ! empty($prices) ? max($prices) : 0;
724 723
 	}
725 724
 
726
-	return give_maybe_sanitize_amount( $high );
725
+	return give_maybe_sanitize_amount($high);
727 726
 }
728 727
 
729 728
 /**
@@ -735,15 +734,15 @@  discard block
 block discarded – undo
735 734
  *
736 735
  * @return mixed string|int Price of the form
737 736
  */
738
-function give_get_form_price( $form_id = 0 ) {
737
+function give_get_form_price($form_id = 0) {
739 738
 
740
-	if ( empty( $form_id ) ) {
739
+	if (empty($form_id)) {
741 740
 		return false;
742 741
 	}
743 742
 
744
-	$form = new Give_Donate_Form( $form_id );
743
+	$form = new Give_Donate_Form($form_id);
745 744
 
746
-	return $form->__get( 'price' );
745
+	return $form->__get('price');
747 746
 }
748 747
 
749 748
 /**
@@ -755,13 +754,13 @@  discard block
 block discarded – undo
755 754
  *
756 755
  * @return mixed string|int Minimum price of the form
757 756
  */
758
-function give_get_form_minimum_price( $form_id = 0 ) {
757
+function give_get_form_minimum_price($form_id = 0) {
759 758
 
760
-	if ( empty( $form_id ) ) {
759
+	if (empty($form_id)) {
761 760
 		return false;
762 761
 	}
763 762
 
764
-	$form = new Give_Donate_Form( $form_id );
763
+	$form = new Give_Donate_Form($form_id);
765 764
 
766 765
 	return $form->get_minimum_price();
767 766
 
@@ -778,48 +777,48 @@  discard block
 block discarded – undo
778 777
  *
779 778
  * @return int $formatted_price
780 779
  */
781
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
780
+function give_price($form_id = 0, $echo = true, $price_id = false) {
782 781
 	$price = 0;
783 782
 
784
-	if ( empty( $form_id ) ) {
783
+	if (empty($form_id)) {
785 784
 		$form_id = get_the_ID();
786 785
 	}
787 786
 
788
-	if ( give_has_variable_prices( $form_id ) ) {
787
+	if (give_has_variable_prices($form_id)) {
789 788
 
790
-		$prices = give_get_variable_prices( $form_id );
789
+		$prices = give_get_variable_prices($form_id);
791 790
 
792
-		if ( false !== $price_id ) {
791
+		if (false !== $price_id) {
793 792
 
794 793
 			// loop through multi-prices to see which is default
795
-			foreach ( $prices as $price ) {
794
+			foreach ($prices as $price) {
796 795
 				// this is the default price
797
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
796
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
798 797
 					$price = (float) $price['_give_amount'];
799 798
 				};
800 799
 			}
801 800
 		} else {
802 801
 
803
-			$price = give_get_lowest_price_option( $form_id );
802
+			$price = give_get_lowest_price_option($form_id);
804 803
 		}
805 804
 	} else {
806 805
 
807
-		$price = give_get_form_price( $form_id );
806
+		$price = give_get_form_price($form_id);
808 807
 	}
809 808
 
810
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
811
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
812
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
809
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
810
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
811
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
813 812
 
814
-	if ( $echo ) {
813
+	if ($echo) {
815 814
 		echo $formatted_price;
816 815
 	} else {
817 816
 		return $formatted_price;
818 817
 	}
819 818
 }
820 819
 
821
-add_filter( 'give_form_price', 'give_format_amount', 10 );
822
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
820
+add_filter('give_form_price', 'give_format_amount', 10);
821
+add_filter('give_form_price', 'give_currency_filter', 20);
823 822
 
824 823
 
825 824
 /**
@@ -832,19 +831,19 @@  discard block
 block discarded – undo
832 831
  *
833 832
  * @return float $amount Amount of the price option
834 833
  */
835
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
836
-	$prices = give_get_variable_prices( $form_id );
834
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
835
+	$prices = give_get_variable_prices($form_id);
837 836
 
838 837
 	$amount = 0.00;
839 838
 
840
-	foreach ( $prices as $price ) {
841
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
842
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
839
+	foreach ($prices as $price) {
840
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
841
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
843 842
 			break;
844 843
 		};
845 844
 	}
846 845
 
847
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
846
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
848 847
 }
849 848
 
850 849
 /**
@@ -856,13 +855,13 @@  discard block
 block discarded – undo
856 855
  *
857 856
  * @return mixed string|int Goal of the form
858 857
  */
859
-function give_get_form_goal( $form_id = 0 ) {
858
+function give_get_form_goal($form_id = 0) {
860 859
 
861
-	if ( empty( $form_id ) ) {
860
+	if (empty($form_id)) {
862 861
 		return false;
863 862
 	}
864 863
 
865
-	$form = new Give_Donate_Form( $form_id );
864
+	$form = new Give_Donate_Form($form_id);
866 865
 
867 866
 	return $form->goal;
868 867
 
@@ -877,13 +876,13 @@  discard block
 block discarded – undo
877 876
  *
878 877
  * @return mixed string|int Goal of the form
879 878
  */
880
-function give_get_form_goal_format( $form_id = 0 ) {
879
+function give_get_form_goal_format($form_id = 0) {
881 880
 
882
-	if ( empty( $form_id ) ) {
881
+	if (empty($form_id)) {
883 882
 		return false;
884 883
 	}
885 884
 
886
-	return give_get_meta( $form_id, '_give_goal_format', true );
885
+	return give_get_meta($form_id, '_give_goal_format', true);
887 886
 
888 887
 }
889 888
 
@@ -897,19 +896,19 @@  discard block
 block discarded – undo
897 896
  *
898 897
  * @return string $formatted_goal
899 898
  */
900
-function give_goal( $form_id = 0, $echo = true ) {
899
+function give_goal($form_id = 0, $echo = true) {
901 900
 
902
-	if ( empty( $form_id ) ) {
901
+	if (empty($form_id)) {
903 902
 		$form_id = get_the_ID();
904 903
 	}
905 904
 
906
-	$goal        = give_get_form_goal( $form_id );
905
+	$goal        = give_get_form_goal($form_id);
907 906
 	$goal_format = give_get_form_goal_format($form_id);
908 907
 
909
-	if ( 'donation' === $goal_format ) {
908
+	if ('donation' === $goal_format) {
910 909
 		$goal = "{$goal} donations";
911 910
 	} else {
912
-		$goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
911
+		$goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
913 912
 	}
914 913
 
915 914
 	$formatted_goal = sprintf(
@@ -917,17 +916,17 @@  discard block
 block discarded – undo
917 916
 		$form_id,
918 917
 		$goal
919 918
 	);
920
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
919
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
921 920
 
922
-	if ( $echo ) {
921
+	if ($echo) {
923 922
 		echo $formatted_goal;
924 923
 	} else {
925 924
 		return $formatted_goal;
926 925
 	}
927 926
 }
928 927
 
929
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
930
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
928
+add_filter('give_form_goal', 'give_format_amount', 10);
929
+add_filter('give_form_goal', 'give_currency_filter', 20);
931 930
 
932 931
 
933 932
 /**
@@ -939,15 +938,15 @@  discard block
 block discarded – undo
939 938
  *
940 939
  * @return bool  $ret Whether or not the logged_in_only setting is set
941 940
  */
942
-function give_logged_in_only( $form_id ) {
941
+function give_logged_in_only($form_id) {
943 942
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
944 943
 	// Otherwise it is member only donation form.
945
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
946
-	$val = ! empty( $val ) ? $val : 'enabled';
944
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
945
+	$val = ! empty($val) ? $val : 'enabled';
947 946
 
948
-	$ret = ! give_is_setting_enabled( $val );
947
+	$ret = ! give_is_setting_enabled($val);
949 948
 
950
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
949
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
951 950
 }
952 951
 
953 952
 
@@ -960,11 +959,11 @@  discard block
 block discarded – undo
960 959
  *
961 960
  * @return string
962 961
  */
963
-function give_show_login_register_option( $form_id ) {
962
+function give_show_login_register_option($form_id) {
964 963
 
965
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
964
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
966 965
 
967
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
966
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
968 967
 
969 968
 }
970 969
 
@@ -980,12 +979,12 @@  discard block
 block discarded – undo
980 979
  *
981 980
  * @return array
982 981
  */
983
-function _give_get_prefill_form_field_values( $form_id ) {
982
+function _give_get_prefill_form_field_values($form_id) {
984 983
 	$logged_in_donor_info = array();
985 984
 
986
-	if ( is_user_logged_in() ) :
987
-		$donor_data    = get_userdata( get_current_user_id() );
988
-		$donor_address = give_get_donor_address( get_current_user_id() );
985
+	if (is_user_logged_in()) :
986
+		$donor_data    = get_userdata(get_current_user_id());
987
+		$donor_address = give_get_donor_address(get_current_user_id());
989 988
 
990 989
 		$logged_in_donor_info = array(
991 990
 			// First name.
@@ -1019,21 +1018,21 @@  discard block
 block discarded – undo
1019 1018
 
1020 1019
 	// Bailout: Auto fill form field values only form form which donor is donating.
1021 1020
 	if (
1022
-		empty( $_GET['form-id'] )
1021
+		empty($_GET['form-id'])
1023 1022
 		|| ! $form_id
1024
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
1023
+		|| ($form_id !== absint($_GET['form-id']))
1025 1024
 	) {
1026 1025
 		return $logged_in_donor_info;
1027 1026
 	}
1028 1027
 
1029 1028
 	// Get purchase data.
1030
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
1029
+	$give_purchase_data = Give()->session->get('give_purchase');
1031 1030
 
1032 1031
 	// Get donor info from form data.
1033
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
1032
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1034 1033
 		? array()
1035 1034
 		: $give_purchase_data['post_data'];
1036 1035
 
1037 1036
 	// Output.
1038
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1037
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1039 1038
 }
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  *
156 156
  * Used to redirect a user back to the donation form if there are errors present.
157 157
  *
158
- * @param array|string $args
158
+ * @param string $args
159 159
  *
160 160
  * @access public
161 161
  * @since  1.0
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
  * @since  1.0
302 302
  * @since  1.8.16 Add security check
303 303
  *
304
- * @return bool
304
+ * @return false|null
305 305
  */
306 306
 function give_listen_for_failed_payments() {
307 307
 
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
  *
754 754
  * @param int $form_id ID number of the form to retrieve the minimum price for
755 755
  *
756
- * @return mixed string|int Minimum price of the form
756
+ * @return string string|int Minimum price of the form
757 757
  */
758 758
 function give_get_form_minimum_price( $form_id = 0 ) {
759 759
 
Please login to merge, or discard this patch.