Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
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 a group already exists.', '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 a group already exists.', '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 within a group already exists.', '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 within a group already exists.', '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/class-give-db-sequential-ordering.php 1 patch
Spacing   +9 added lines, -9 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
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		/* @var WPDB $wpdb */
36 36
 		global $wpdb;
37 37
 
38
-		$this->table_name  = $wpdb->prefix . 'give_sequential_ordering';
38
+		$this->table_name  = $wpdb->prefix.'give_sequential_ordering';
39 39
 		$this->primary_key = 'id';
40 40
 		$this->version     = '1.0';
41 41
 
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
         PRIMARY KEY  (id)
109 109
         ) {$charset_collate};";
110 110
 
111
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
112
-		dbDelta( $sql );
111
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
112
+		dbDelta($sql);
113 113
 
114
-		if ( ! empty( $payment_ID ) ) {
114
+		if ( ! empty($payment_ID)) {
115 115
 			$auto_increment = $payment_ID + 1;
116
-			$wpdb->query( "ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};" );
117
-			give_update_option( 'sequential-ordering_number', $auto_increment );
116
+			$wpdb->query("ALTER TABLE {$this->table_name} AUTO_INCREMENT={$auto_increment};");
117
+			give_update_option('sequential-ordering_number', $auto_increment);
118 118
 		} else {
119
-			give_update_option( 'sequential-ordering_number', 1 );
119
+			give_update_option('sequential-ordering_number', 1);
120 120
 		}
121 121
 
122
-		update_option( $this->table_name . '_db_version', $this->version );
122
+		update_option($this->table_name.'_db_version', $this->version);
123 123
 	}
124 124
 
125 125
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +96 added lines, -96 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
 
@@ -62,51 +62,51 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return bool If the gravatar exists or not
64 64
 	 */
65
-	public function validate_gravatar( $id_or_email ) {
65
+	public function validate_gravatar($id_or_email) {
66 66
 		//id or email code borrowed from wp-includes/pluggable.php
67 67
 		$email = '';
68
-		if ( is_numeric( $id_or_email ) ) {
68
+		if (is_numeric($id_or_email)) {
69 69
 			$id   = (int) $id_or_email;
70
-			$user = get_userdata( $id );
71
-			if ( $user ) {
70
+			$user = get_userdata($id);
71
+			if ($user) {
72 72
 				$email = $user->user_email;
73 73
 			}
74
-		} elseif ( is_object( $id_or_email ) ) {
74
+		} elseif (is_object($id_or_email)) {
75 75
 			// No avatar for pingbacks or trackbacks
76
-			$allowed_comment_types = apply_filters( 'get_avatar_comment_types', array( 'comment' ) );
77
-			if ( ! empty( $id_or_email->comment_type ) && ! in_array( $id_or_email->comment_type, (array) $allowed_comment_types ) ) {
76
+			$allowed_comment_types = apply_filters('get_avatar_comment_types', array('comment'));
77
+			if ( ! empty($id_or_email->comment_type) && ! in_array($id_or_email->comment_type, (array) $allowed_comment_types)) {
78 78
 				return false;
79 79
 			}
80 80
 
81
-			if ( ! empty( $id_or_email->user_id ) ) {
81
+			if ( ! empty($id_or_email->user_id)) {
82 82
 				$id   = (int) $id_or_email->user_id;
83
-				$user = get_userdata( $id );
84
-				if ( $user ) {
83
+				$user = get_userdata($id);
84
+				if ($user) {
85 85
 					$email = $user->user_email;
86 86
 				}
87
-			} elseif ( ! empty( $id_or_email->comment_author_email ) ) {
87
+			} elseif ( ! empty($id_or_email->comment_author_email)) {
88 88
 				$email = $id_or_email->comment_author_email;
89 89
 			}
90 90
 		} else {
91 91
 			$email = $id_or_email;
92 92
 		}
93 93
 
94
-		$hashkey = md5( strtolower( trim( $email ) ) );
95
-		$uri     = 'http://www.gravatar.com/avatar/' . $hashkey . '?d=404';
94
+		$hashkey = md5(strtolower(trim($email)));
95
+		$uri     = 'http://www.gravatar.com/avatar/'.$hashkey.'?d=404';
96 96
 
97
-		$data = Give_Cache::get_group( $hashkey );
97
+		$data = Give_Cache::get_group($hashkey);
98 98
 
99
-		if ( is_null( $data ) ) {
100
-			$response = wp_remote_head( $uri );
101
-			if ( is_wp_error( $response ) ) {
99
+		if (is_null($data)) {
100
+			$response = wp_remote_head($uri);
101
+			if (is_wp_error($response)) {
102 102
 				$data = 'not200';
103 103
 			} else {
104 104
 				$data = $response['response']['code'];
105 105
 			}
106
-			Give_Cache::set_group( $hashkey, $data, $group = '', $expire = 60 * 5 );
106
+			Give_Cache::set_group($hashkey, $data, $group = '', $expire = 60 * 5);
107 107
 
108 108
 		}
109
-		if ( $data == '200' ) {
109
+		if ($data == '200') {
110 110
 			return true;
111 111
 		} else {
112 112
 			return false;
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @return array        IDs if logs, false otherwise
125 125
 	 */
126
-	public function get_log_ids( $form_id = '' ) {
126
+	public function get_log_ids($form_id = '') {
127 127
 		// get log for this form
128
-		$logs = Give()->logs->get_logs( $form_id );
128
+		$logs = Give()->logs->get_logs($form_id);
129 129
 
130
-		if ( $logs ) {
130
+		if ($logs) {
131 131
 			$log_ids = array();
132 132
 
133 133
 			// make an array with all the donor IDs
134
-			foreach ( $logs as $log ) {
134
+			foreach ($logs as $log) {
135 135
 				$log_ids[] = $log->ID;
136 136
 			}
137 137
 
@@ -152,51 +152,51 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return mixed
154 154
 	 */
155
-	public function get_payment_ids( $form_id = '' ) {
155
+	public function get_payment_ids($form_id = '') {
156 156
 
157 157
 		$give_options = give_get_settings();
158 158
 
159
-		$log_ids = $this->get_log_ids( $form_id );
159
+		$log_ids = $this->get_log_ids($form_id);
160 160
 
161
-		if ( $log_ids ) {
161
+		if ($log_ids) {
162 162
 
163 163
 			$payment_ids = array();
164 164
 
165
-			foreach ( $log_ids as $id ) {
165
+			foreach ($log_ids as $id) {
166 166
 				// get the payment ID for each corresponding log ID
167
-				$payment_ids[] = give_get_meta( $id, '_give_log_payment_id', true );
167
+				$payment_ids[] = give_get_meta($id, '_give_log_payment_id', true);
168 168
 			}
169 169
 
170 170
 			// remove donors who have donated more than once so we can have unique avatars
171 171
 			$unique_emails = array();
172 172
 
173
-			foreach ( $payment_ids as $key => $id ) {
173
+			foreach ($payment_ids as $key => $id) {
174 174
 
175
-				$email = give_get_meta( $id, '_give_payment_donor_email', true );
175
+				$email = give_get_meta($id, '_give_payment_donor_email', true);
176 176
 
177
-				if ( isset ( $give_options['give_donors_gravatars_has_gravatar_account'] ) ) {
178
-					if ( ! $this->validate_gravatar( $email ) ) {
177
+				if (isset ($give_options['give_donors_gravatars_has_gravatar_account'])) {
178
+					if ( ! $this->validate_gravatar($email)) {
179 179
 						continue;
180 180
 					}
181 181
 				}
182 182
 
183
-				$unique_emails[ $id ] = give_get_meta( $id, '_give_payment_donor_email', true );
183
+				$unique_emails[$id] = give_get_meta($id, '_give_payment_donor_email', true);
184 184
 
185 185
 			}
186 186
 
187 187
 			$unique_ids = array();
188 188
 
189 189
 			// strip duplicate emails
190
-			$unique_emails = array_unique( $unique_emails );
190
+			$unique_emails = array_unique($unique_emails);
191 191
 
192 192
 			// convert the unique IDs back into simple array
193
-			foreach ( $unique_emails as $id => $email ) {
193
+			foreach ($unique_emails as $id => $email) {
194 194
 				$unique_ids[] = $id;
195 195
 			}
196 196
 
197 197
 			// randomize the payment IDs if enabled
198
-			if ( isset( $give_options['give_donors_gravatars_random_gravatars'] ) ) {
199
-				shuffle( $unique_ids );
198
+			if (isset($give_options['give_donors_gravatars_random_gravatars'])) {
199
+				shuffle($unique_ids);
200 200
 			}
201 201
 
202 202
 			// return our unique IDs
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return string
219 219
 	 */
220
-	public function gravatars( $form_id = false, $title = '' ) {
220
+	public function gravatars($form_id = false, $title = '') {
221 221
 
222 222
 		// unique $payment_ids 
223
-		$payment_ids = $this->get_payment_ids( $form_id );
223
+		$payment_ids = $this->get_payment_ids($form_id);
224 224
 
225 225
 		$give_options = give_get_settings();
226 226
 
227 227
 		// return if no ID
228
-		if ( ! $form_id ) {
228
+		if ( ! $form_id) {
229 229
 			return;
230 230
 		}
231 231
 
232 232
 		// minimum amount of donations before showing gravatars
233 233
 		// if the number of items in array is not greater or equal to the number specified, then exit
234
-		if ( isset( $give_options['give_donors_gravatars_min_purchases_required'] ) && '' != $give_options['give_donors_gravatars_min_purchases_required'] ) {
235
-			if ( ! ( count( $payment_ids ) >= $give_options['give_donors_gravatars_min_purchases_required'] ) ) {
234
+		if (isset($give_options['give_donors_gravatars_min_purchases_required']) && '' != $give_options['give_donors_gravatars_min_purchases_required']) {
235
+			if ( ! (count($payment_ids) >= $give_options['give_donors_gravatars_min_purchases_required'])) {
236 236
 				return;
237 237
 			}
238 238
 		}
@@ -243,28 +243,28 @@  discard block
 block discarded – undo
243 243
 		echo '<div id="give-purchase-gravatars">';
244 244
 
245 245
 
246
-		if ( isset ( $title ) ) {
246
+		if (isset ($title)) {
247 247
 
248
-			if ( $title ) {
249
-				echo wp_kses_post( apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $title ) . '</h3>' ) );
250
-			} elseif ( isset( $give_options['give_donors_gravatars_heading'] ) ) {
251
-				echo wp_kses_post( apply_filters( 'give_donors_gravatars_title', '<h3 class="give-gravatars-title">' . esc_attr( $give_options['give_donors_gravatars_heading'] ) . '</h2>' ) );
248
+			if ($title) {
249
+				echo wp_kses_post(apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($title).'</h3>'));
250
+			} elseif (isset($give_options['give_donors_gravatars_heading'])) {
251
+				echo wp_kses_post(apply_filters('give_donors_gravatars_title', '<h3 class="give-gravatars-title">'.esc_attr($give_options['give_donors_gravatars_heading']).'</h2>'));
252 252
 			}
253 253
 
254 254
 		}
255 255
 		echo '<ul class="give-purchase-gravatars-list">';
256 256
 		$i = 0;
257 257
 
258
-		if ( $payment_ids ) {
259
-			foreach ( $payment_ids as $id ) {
258
+		if ($payment_ids) {
259
+			foreach ($payment_ids as $id) {
260 260
 
261 261
 				// Give saves a blank option even when the control is turned off, hence the extra check
262
-				if ( isset( $give_options['give_donors_gravatars_maximum_number'] ) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number'] ) {
262
+				if (isset($give_options['give_donors_gravatars_maximum_number']) && '' != $give_options['give_donors_gravatars_maximum_number'] && $i == $give_options['give_donors_gravatars_maximum_number']) {
263 263
 					continue;
264 264
 				}
265 265
 
266 266
 				// get the payment meta
267
-				$payment_meta = give_get_meta( $id, '_give_payment_meta', true );
267
+				$payment_meta = give_get_meta($id, '_give_payment_meta', true);
268 268
 
269 269
 				$user_info = $payment_meta['user_info'];
270 270
 
@@ -272,30 +272,30 @@  discard block
 block discarded – undo
272 272
 				$name = $user_info['first_name'];
273 273
 
274 274
 				// get donor's email
275
-				$email = give_get_meta( $id, '_give_payment_donor_email', true );
275
+				$email = give_get_meta($id, '_give_payment_donor_email', true);
276 276
 
277 277
 				// set gravatar size and provide filter
278
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
278
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
279 279
 
280 280
 				// default image
281
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
281
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
282 282
 
283 283
 				// assemble output
284 284
 				$output .= '<li>';
285 285
 
286
-				$output .= get_avatar( $email, $size, $default_image, $name );
286
+				$output .= get_avatar($email, $size, $default_image, $name);
287 287
 				$output .= '</li>';
288 288
 
289
-				$i ++;
289
+				$i++;
290 290
 
291 291
 			} // end foreach
292 292
 		}
293 293
 
294
-		echo wp_kses_post( $output );
294
+		echo wp_kses_post($output);
295 295
 		echo '</ul>';
296 296
 		echo '</div>';
297 297
 
298
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
298
+		return apply_filters('give_donors_gravatars', ob_get_clean());
299 299
 	}
300 300
 
301 301
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @return void
308 308
 	 */
309 309
 	public function register_widget() {
310
-		register_widget( 'Give_Donors_Gravatars_Widget' );
310
+		register_widget('Give_Donors_Gravatars_Widget');
311 311
 	}
312 312
 
313 313
 	/**
@@ -321,19 +321,19 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return string
323 323
 	 */
324
-	public function shortcode( $atts, $content = null ) {
324
+	public function shortcode($atts, $content = null) {
325 325
 
326
-		$atts = shortcode_atts( array(
326
+		$atts = shortcode_atts(array(
327 327
 			'id'    => '',
328 328
 			'title' => ''
329
-		), $atts, 'give_donors_gravatars' );
329
+		), $atts, 'give_donors_gravatars');
330 330
 
331 331
 		// if no ID is passed on single give_forms pages, get the correct ID
332
-		if ( is_singular( 'give_forms' ) ) {
332
+		if (is_singular('give_forms')) {
333 333
 			$id = get_the_ID();
334 334
 		}
335 335
 
336
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
336
+		$content = $this->gravatars($atts['id'], $atts['title']);
337 337
 
338 338
 		return $content;
339 339
 
@@ -349,56 +349,56 @@  discard block
 block discarded – undo
349 349
 	 *
350 350
 	 * @return array           Gravatar settings.
351 351
 	 */
352
-	public function settings( $settings ) {
352
+	public function settings($settings) {
353 353
 
354 354
 		$give_gravatar_settings = array(
355 355
 			array(
356
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
356
+				'name' => esc_html__('Donator Gravatars', 'give'),
357 357
 				'desc' => '<hr>',
358 358
 				'id'   => 'give_title',
359 359
 				'type' => 'give_title'
360 360
 			),
361 361
 			array(
362
-				'name' => esc_html__( 'Heading', 'give' ),
363
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
362
+				'name' => esc_html__('Heading', 'give'),
363
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
364 364
 				'type' => 'text',
365 365
 				'id'   => 'give_donors_gravatars_heading'
366 366
 			),
367 367
 			array(
368
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
369
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
368
+				'name'    => esc_html__('Gravatar Size', 'give'),
369
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
370 370
 				'type'    => 'text_small',
371 371
 				'id'      => 'give_donors_gravatars_gravatar_size',
372 372
 				'default' => '64'
373 373
 			),
374 374
 			array(
375
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
376
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
375
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
376
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
377 377
 				'type' => 'text_small',
378 378
 				'id'   => 'give_donors_gravatars_min_purchases_required',
379 379
 			),
380 380
 			array(
381
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
382
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
381
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
382
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
383 383
 				'type'    => 'text',
384 384
 				'id'      => 'give_donors_gravatars_maximum_number',
385 385
 				'default' => '20',
386 386
 			),
387 387
 			array(
388
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
389
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
388
+				'name' => esc_html__('Gravatar Visibility', 'give'),
389
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
390 390
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
391 391
 				'type' => 'checkbox',
392 392
 			),
393 393
 			array(
394
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
395
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
394
+				'name' => esc_html__('Randomize Gravatars', 'give'),
395
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
396 396
 				'id'   => 'give_donors_gravatars_random_gravatars',
397 397
 				'type' => 'checkbox',
398 398
 			),
399 399
 		);
400 400
 
401
-		return array_merge( $settings, $give_gravatar_settings );
401
+		return array_merge($settings, $give_gravatar_settings);
402 402
 	}
403 403
 
404 404
 }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		// widget settings
425 425
 		$widget_ops = array(
426 426
 			'classname'   => 'give-donors-gravatars',
427
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
427
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
428 428
 		);
429 429
 
430 430
 		// widget control settings
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		// create the widget
438 438
 		parent::__construct(
439 439
 			'give_donors_gravatars_widget',
440
-			esc_html__( 'Give Donors Gravatars', 'give' ),
440
+			esc_html__('Give Donors Gravatars', 'give'),
441 441
 			$widget_ops,
442 442
 			$control_ops
443 443
 		);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return void
459 459
 	 */
460
-	public function widget( $args, $instance ) {
460
+	public function widget($args, $instance) {
461 461
 
462 462
 		$defaults = array(
463 463
 			'before_widget' => '',
@@ -466,14 +466,14 @@  discard block
 block discarded – undo
466 466
 			'after_title' => '',
467 467
 		);
468 468
 
469
-		$args = wp_parse_args( $args, $defaults );
469
+		$args = wp_parse_args($args, $defaults);
470 470
 
471
-		if ( ! is_singular( 'give_forms' ) ) {
471
+		if ( ! is_singular('give_forms')) {
472 472
 			return;
473 473
 		}
474 474
 
475 475
 		// Variables from widget settings
476
-		$title = apply_filters( 'widget_title', $instance['title'] );
476
+		$title = apply_filters('widget_title', $instance['title']);
477 477
 
478 478
 		$output = '';
479 479
 
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
 		$output .= $args['before_widget'];
482 482
 
483 483
 		// Display the widget title
484
-		if ( $title ) {
485
-			$output .= $args['before_title'] . $title . $args['after_title'];
484
+		if ($title) {
485
+			$output .= $args['before_title'].$title.$args['after_title'];
486 486
 		}
487 487
 
488 488
 		$gravatars = new Give_Donors_Gravatars();
489 489
 
490
-		$output .= $gravatars->gravatars( get_the_ID(), null ); // remove title
490
+		$output .= $gravatars->gravatars(get_the_ID(), null); // remove title
491 491
 
492 492
 		// Used by themes. Closes the widget
493 493
 		$output .= $args['after_widget'];
494 494
 
495
-		echo wp_kses_post( $output );
495
+		echo wp_kses_post($output);
496 496
 	}
497 497
 
498 498
 	/**
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return array Updated settings to save.
510 510
 	 */
511
-	public function update( $new_instance, $old_instance ) {
511
+	public function update($new_instance, $old_instance) {
512 512
 
513 513
 		$instance = $old_instance;
514 514
 
515
-		$instance['title'] = wp_strip_all_tags( $new_instance['title'] );
515
+		$instance['title'] = wp_strip_all_tags($new_instance['title']);
516 516
 
517 517
 		return $instance;
518 518
 
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	 *
531 531
 	 * @return void
532 532
 	 */
533
-	public function form( $instance ) {
533
+	public function form($instance) {
534 534
 
535 535
 		// Set up some default widget settings.
536 536
 		$defaults = array(
537 537
 			'title' => '',
538 538
 		);
539 539
 
540
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
540
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
541 541
 
542 542
 		<!-- Title -->
543 543
 		<p>
544
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
545
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
544
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'give') ?></label>
545
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
546 546
 		</p>
547 547
 
548 548
 		<?php
Please login to merge, or discard this patch.
includes/payments/actions.php 1 patch
Spacing   +106 added lines, -110 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
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_donation', $payment_id );
61
+	do_action('give_pre_complete_donation', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int   $payment_id   The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount, $payment_id );
83
-	give_increase_donation_count( $form_id );
82
+	give_increase_earnings($form_id, $amount, $payment_id);
83
+	give_increase_donation_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$donor = new Give_Donor( $donor_id );
89
+	$donor = new Give_Donor($donor_id);
90 90
 	$donor->increase_purchase_count();
91
-	$donor->increase_value( $amount );
91
+	$donor->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136
-	$status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
136
+	$status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
137 137
 
138
-	give_insert_payment_note( $payment_id, $status_change );
138
+	give_insert_payment_note($payment_id, $status_change);
139 139
 }
140 140
 
141
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
141
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
142 142
 
143 143
 
144 144
 /**
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_update_old_payments_with_totals( $data ) {
158
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
157
+function give_update_old_payments_with_totals($data) {
158
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
159 159
 		return;
160 160
 	}
161 161
 
162
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
162
+	if (get_option('give_payment_totals_upgraded')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	$payments = give_get_payments( array(
166
+	$payments = give_get_payments(array(
167 167
 		'offset' => 0,
168
-		'number' => - 1,
168
+		'number' => -1,
169 169
 		'mode'   => 'all',
170
-	) );
170
+	));
171 171
 
172
-	if ( $payments ) {
173
-		foreach ( $payments as $payment ) {
172
+	if ($payments) {
173
+		foreach ($payments as $payment) {
174 174
 
175
-			$payment = new Give_Payment( $payment->ID );
175
+			$payment = new Give_Payment($payment->ID);
176 176
 			$meta    = $payment->get_meta();
177 177
 
178 178
 			$payment->total = $meta['amount'];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 		}
182 182
 	}
183 183
 
184
-	add_option( 'give_payment_totals_upgraded', 1 );
184
+	add_option('give_payment_totals_upgraded', 1);
185 185
 }
186 186
 
187
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
187
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
188 188
 
189 189
 /**
190 190
  * Mark Abandoned Donations
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
211
+	if ($payments) {
212 212
 		/**
213 213
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214 214
 		 *
@@ -216,14 +216,14 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param array $skip_payment_gateways Array of payment gateways
218 218
 		 */
219
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
219
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
220 220
 
221 221
 		/* @var Give_Payment $payment */
222
-		foreach ( $payments as $payment ) {
223
-			$gateway = give_get_payment_gateway( $payment->ID );
222
+		foreach ($payments as $payment) {
223
+			$gateway = give_get_payment_gateway($payment->ID);
224 224
 
225 225
 			// Skip payment gateways.
226
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
226
+			if (in_array($gateway, $skip_payment_gateways)) {
227 227
 				continue;
228 228
 			}
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	}
234 234
 }
235 235
 
236
-Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' );
236
+Give_Cron::add_weekly_event('give_mark_abandoned_donations');
237 237
 
238 238
 
239 239
 /**
@@ -245,15 +245,15 @@  discard block
 block discarded – undo
245 245
  *
246 246
  * @return void
247 247
  */
248
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
248
+function give_refresh_thismonth_stat_transients($payment_ID) {
249 249
 	// Monthly stats.
250
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
250
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
251 251
 
252 252
 	// @todo: Refresh only range related stat cache
253 253
 	give_delete_donation_stats();
254 254
 }
255 255
 
256
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
256
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
257 257
 
258 258
 
259 259
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return array
271 271
  */
272
-function give_bc_v20_get_payment_meta( $check, $object_id, $meta_key, $single ) {
272
+function give_bc_v20_get_payment_meta($check, $object_id, $meta_key, $single) {
273 273
 	// Bailout.
274 274
 	if (
275
-		'give_payment' !== get_post_type( $object_id ) ||
275
+		'give_payment' !== get_post_type($object_id) ||
276 276
 		'_give_payment_meta' !== $meta_key ||
277
-		! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' )
277
+		! give_has_upgrade_completed('v20_upgrades_payment_metadata')
278 278
 	) {
279 279
 		return $check;
280 280
 	}
@@ -282,73 +282,69 @@  discard block
 block discarded – undo
282 282
 	$cache_key = "_give_payment_meta_{$object_id}";
283 283
 
284 284
 	// Get already calculate payment meta from cache.
285
-	$payment_meta = Give_Cache::get_db_query( $cache_key );
285
+	$payment_meta = Give_Cache::get_db_query($cache_key);
286 286
 
287
-	if ( is_null( $payment_meta ) ) {
287
+	if (is_null($payment_meta)) {
288 288
 		// Remove filter.
289
-		remove_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999 );
289
+		remove_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999);
290 290
 
291
-		$donation = new Give_Payment( $object_id );
291
+		$donation = new Give_Payment($object_id);
292 292
 
293 293
 		// Get all payment meta.
294
-		$payment_meta = give_get_meta( $object_id );
294
+		$payment_meta = give_get_meta($object_id);
295 295
 
296 296
 		// Set default value to array.
297
-		if ( empty( $payment_meta ) ) {
297
+		if (empty($payment_meta)) {
298 298
 			return $check;
299 299
 		}
300 300
 
301 301
 		// Convert all meta key value to string instead of array
302
-		array_walk( $payment_meta, function ( &$meta, $key ) {
303
-			$meta = current( $meta );
302
+		array_walk($payment_meta, function(&$meta, $key) {
303
+			$meta = current($meta);
304 304
 		} );
305 305
 
306 306
 		/**
307 307
 		 * Add backward compatibility to old meta keys.
308 308
 		 */
309 309
 		// Donation key.
310
-		$payment_meta['key'] = ! empty( $payment_meta['_give_payment_purchase_key'] ) ? $payment_meta['_give_payment_purchase_key'] : '';
310
+		$payment_meta['key'] = ! empty($payment_meta['_give_payment_purchase_key']) ? $payment_meta['_give_payment_purchase_key'] : '';
311 311
 
312 312
 		// Donation form.
313
-		$payment_meta['form_title'] = ! empty( $payment_meta['_give_payment_form_title'] ) ? $payment_meta['_give_payment_form_title'] : '';
313
+		$payment_meta['form_title'] = ! empty($payment_meta['_give_payment_form_title']) ? $payment_meta['_give_payment_form_title'] : '';
314 314
 
315 315
 		// Donor email.
316
-		$payment_meta['email'] = ! empty( $payment_meta['_give_payment_donor_email'] ) ? $payment_meta['_give_payment_donor_email'] : '';
317
-		$payment_meta['email'] = ! empty( $payment_meta['email'] ) ?
318
-			$payment_meta['email'] :
319
-			Give()->donors->get_column( 'email', $donation->donor_id );
316
+		$payment_meta['email'] = ! empty($payment_meta['_give_payment_donor_email']) ? $payment_meta['_give_payment_donor_email'] : '';
317
+		$payment_meta['email'] = ! empty($payment_meta['email']) ?
318
+			$payment_meta['email'] : Give()->donors->get_column('email', $donation->donor_id);
320 319
 
321 320
 		// Form id.
322
-		$payment_meta['form_id'] = ! empty( $payment_meta['_give_payment_form_id'] ) ? $payment_meta['_give_payment_form_id'] : '';
321
+		$payment_meta['form_id'] = ! empty($payment_meta['_give_payment_form_id']) ? $payment_meta['_give_payment_form_id'] : '';
323 322
 
324 323
 		// Price id.
325
-		$payment_meta['price_id'] = ! empty( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : '';
324
+		$payment_meta['price_id'] = ! empty($payment_meta['_give_payment_price_id']) ? $payment_meta['_give_payment_price_id'] : '';
326 325
 
327 326
 		// Date.
328
-		$payment_meta['date'] = ! empty( $payment_meta['_give_payment_date'] ) ? $payment_meta['_give_payment_date'] : '';
329
-		$payment_meta['date'] = ! empty( $payment_meta['date'] ) ?
330
-			$payment_meta['date'] :
331
-			get_post_field( 'post_date', $object_id );
327
+		$payment_meta['date'] = ! empty($payment_meta['_give_payment_date']) ? $payment_meta['_give_payment_date'] : '';
328
+		$payment_meta['date'] = ! empty($payment_meta['date']) ?
329
+			$payment_meta['date'] : get_post_field('post_date', $object_id);
332 330
 
333 331
 
334 332
 		// Currency.
335
-		$payment_meta['currency'] = ! empty( $payment_meta['_give_payment_currency'] ) ? $payment_meta['_give_payment_currency'] : '';
333
+		$payment_meta['currency'] = ! empty($payment_meta['_give_payment_currency']) ? $payment_meta['_give_payment_currency'] : '';
336 334
 
337 335
 		// Decode donor data.
338
-		$donor_id = ! empty( $payment_meta['_give_payment_donor_id'] ) ? $payment_meta['_give_payment_donor_id'] : 0;
339
-		$donor    = new Give_Donor( $donor_id );
336
+		$donor_id = ! empty($payment_meta['_give_payment_donor_id']) ? $payment_meta['_give_payment_donor_id'] : 0;
337
+		$donor    = new Give_Donor($donor_id);
340 338
 
341 339
 		// Donor first name.
342
-		$donor_data['first_name'] = ! empty( $payment_meta['_give_donor_billing_first_name'] ) ? $payment_meta['_give_donor_billing_first_name'] : '';
343
-		$donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ?
344
-			$donor_data['first_name'] :
345
-			$donor->get_first_name();
340
+		$donor_data['first_name'] = ! empty($payment_meta['_give_donor_billing_first_name']) ? $payment_meta['_give_donor_billing_first_name'] : '';
341
+		$donor_data['first_name'] = ! empty($donor_data['first_name']) ?
342
+			$donor_data['first_name'] : $donor->get_first_name();
346 343
 
347 344
 		// Donor last name.
348
-		$donor_data['last_name'] = ! empty( $payment_meta['_give_donor_billing_last_name'] ) ? $payment_meta['_give_donor_billing_last_name'] : '';
349
-		$donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ?
350
-			$donor_data['last_name'] :
351
-			$donor->get_last_name();
345
+		$donor_data['last_name'] = ! empty($payment_meta['_give_donor_billing_last_name']) ? $payment_meta['_give_donor_billing_last_name'] : '';
346
+		$donor_data['last_name'] = ! empty($donor_data['last_name']) ?
347
+			$donor_data['last_name'] : $donor->get_last_name();
352 348
 
353 349
 		// Donor email.
354 350
 		$donor_data['email'] = $payment_meta['email'];
@@ -359,63 +355,63 @@  discard block
 block discarded – undo
359 355
 		$donor_data['address'] = false;
360 356
 
361 357
 		// Address1.
362
-		$address1 = ! empty( $payment_meta['_give_donor_billing_address1'] ) ? $payment_meta['_give_donor_billing_address1'] : '';
363
-		if ( $address1 ) {
358
+		$address1 = ! empty($payment_meta['_give_donor_billing_address1']) ? $payment_meta['_give_donor_billing_address1'] : '';
359
+		if ($address1) {
364 360
 			$donor_data['address']['line1'] = $address1;
365 361
 		}
366 362
 
367 363
 		// Address2.
368
-		$address2 = ! empty( $payment_meta['_give_donor_billing_address2'] ) ? $payment_meta['_give_donor_billing_address2'] : '';
369
-		if ( $address2 ) {
364
+		$address2 = ! empty($payment_meta['_give_donor_billing_address2']) ? $payment_meta['_give_donor_billing_address2'] : '';
365
+		if ($address2) {
370 366
 			$donor_data['address']['line2'] = $address2;
371 367
 		}
372 368
 
373 369
 		// City.
374
-		$city = ! empty( $payment_meta['_give_donor_billing_city'] ) ? $payment_meta['_give_donor_billing_city'] : '';
375
-		if ( $city ) {
370
+		$city = ! empty($payment_meta['_give_donor_billing_city']) ? $payment_meta['_give_donor_billing_city'] : '';
371
+		if ($city) {
376 372
 			$donor_data['address']['city'] = $city;
377 373
 		}
378 374
 
379 375
 		// Zip.
380
-		$zip = ! empty( $payment_meta['_give_donor_billing_zip'] ) ? $payment_meta['_give_donor_billing_zip'] : '';
381
-		if ( $zip ) {
376
+		$zip = ! empty($payment_meta['_give_donor_billing_zip']) ? $payment_meta['_give_donor_billing_zip'] : '';
377
+		if ($zip) {
382 378
 			$donor_data['address']['zip'] = $zip;
383 379
 		}
384 380
 
385 381
 		// State.
386
-		$state = ! empty( $payment_meta['_give_donor_billing_state'] ) ? $payment_meta['_give_donor_billing_state'] : '';
387
-		if ( $state ) {
382
+		$state = ! empty($payment_meta['_give_donor_billing_state']) ? $payment_meta['_give_donor_billing_state'] : '';
383
+		if ($state) {
388 384
 			$donor_data['address']['state'] = $state;
389 385
 		}
390 386
 
391 387
 		// Country.
392
-		$country = ! empty( $payment_meta['_give_donor_billing_country'] ) ? $payment_meta['_give_donor_billing_country'] : '';
393
-		if ( $country ) {
388
+		$country = ! empty($payment_meta['_give_donor_billing_country']) ? $payment_meta['_give_donor_billing_country'] : '';
389
+		if ($country) {
394 390
 			$donor_data['address']['country'] = $country;
395 391
 		}
396 392
 
397 393
 		$payment_meta['user_info'] = $donor_data;
398 394
 
399 395
 		// Add filter
400
-		add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
396
+		add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
401 397
 
402 398
 		// Set custom meta key into payment meta.
403
-		if ( ! empty( $payment_meta['_give_payment_meta'] ) ) {
404
-			$payment_meta = array_merge( maybe_unserialize( $payment_meta['_give_payment_meta'] ), $payment_meta );
399
+		if ( ! empty($payment_meta['_give_payment_meta'])) {
400
+			$payment_meta = array_merge(maybe_unserialize($payment_meta['_give_payment_meta']), $payment_meta);
405 401
 		}
406 402
 
407 403
 		// Set cache.
408
-		Give_Cache::set_db_query( $cache_key, $payment_meta );
404
+		Give_Cache::set_db_query($cache_key, $payment_meta);
409 405
 	}
410 406
 
411
-	if ( $single ) {
407
+	if ($single) {
412 408
 		/**
413 409
 		 * Filter the payment meta
414 410
 		 * Add custom meta key to payment meta
415 411
 		 *
416 412
 		 * @since 2.0
417 413
 		 */
418
-		$new_payment_meta[0] = apply_filters( 'give_get_payment_meta', $payment_meta, $object_id, $meta_key );
414
+		$new_payment_meta[0] = apply_filters('give_get_payment_meta', $payment_meta, $object_id, $meta_key);
419 415
 
420 416
 		$payment_meta = $new_payment_meta;
421 417
 	}
@@ -423,7 +419,7 @@  discard block
 block discarded – undo
423 419
 	return $payment_meta;
424 420
 }
425 421
 
426
-add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
422
+add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
427 423
 
428 424
 /**
429 425
  * Add meta in payment that store page id and page url.
@@ -435,19 +431,19 @@  discard block
 block discarded – undo
435 431
  *
436 432
  * @param int $payment_id Payment id for which the meta value should be updated.
437 433
  */
438
-function give_payment_save_page_data( $payment_id ) {
439
-	$page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false );
434
+function give_payment_save_page_data($payment_id) {
435
+	$page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false);
440 436
 
441 437
 	// Check $page_url is not empty.
442
-	if ( $page_url ) {
443
-		update_post_meta( $payment_id, '_give_current_url', $page_url );
444
-		$page_id = url_to_postid( $page_url );
438
+	if ($page_url) {
439
+		update_post_meta($payment_id, '_give_current_url', $page_url);
440
+		$page_id = url_to_postid($page_url);
445 441
 		// Check $page_id is not empty.
446
-		if ( $page_id ) {
447
-			update_post_meta( $payment_id, '_give_current_page_id', $page_id );
442
+		if ($page_id) {
443
+			update_post_meta($payment_id, '_give_current_page_id', $page_id);
448 444
 		}
449 445
 	}
450 446
 }
451 447
 
452 448
 // Fire when payment is save.
453
-add_action( 'give_insert_payment', 'give_payment_save_page_data' );
454 449
\ No newline at end of file
450
+add_action('give_insert_payment', 'give_payment_save_page_data');
455 451
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/functions.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29 29
 		),
30 30
 		'manual' => array(
31
-			'admin_label'    => __( 'Test Donation', 'give' ),
32
-			'checkout_label' => __( 'Test Donation', 'give' )
31
+			'admin_label'    => __('Test Donation', 'give'),
32
+			'checkout_label' => __('Test Donation', 'give')
33 33
 		),
34 34
 	);
35 35
 
36
-	return apply_filters( 'give_payment_gateways', $gateways );
36
+	return apply_filters('give_payment_gateways', $gateways);
37 37
 
38 38
 }
39 39
 
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array $gateway_list All the available gateways
48 48
  */
49
-function give_get_enabled_payment_gateways( $form_id = 0 ) {
49
+function give_get_enabled_payment_gateways($form_id = 0) {
50 50
 
51 51
 	$gateways = give_get_payment_gateways();
52 52
 
53
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
53
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
54 54
 
55 55
 	$gateway_list = array();
56 56
 
57
-	foreach ( $gateways as $key => $gateway ) {
58
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
59
-			$gateway_list[ $key ] = $gateway;
57
+	foreach ($gateways as $key => $gateway) {
58
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
59
+			$gateway_list[$key] = $gateway;
60 60
 		}
61 61
 	}
62 62
 
63 63
 	// Set order of payment gateway in list.
64
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
64
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
65 65
 
66
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list, $form_id );
66
+	return apply_filters('give_enabled_payment_gateways', $gateway_list, $form_id);
67 67
 }
68 68
 
69 69
 /**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
  *
76 76
  * @return boolean true if enabled, false otherwise
77 77
  */
78
-function give_is_gateway_active( $gateway ) {
78
+function give_is_gateway_active($gateway) {
79 79
 	$gateways = give_get_enabled_payment_gateways();
80 80
 
81
-	$ret = array_key_exists( $gateway, $gateways );
81
+	$ret = array_key_exists($gateway, $gateways);
82 82
 
83
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
83
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
84 84
 }
85 85
 
86 86
 /**
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return string Gateway ID
94 94
  */
95
-function give_get_default_gateway( $form_id ) {
95
+function give_get_default_gateway($form_id) {
96 96
 
97
-	$enabled_gateways = array_keys( give_get_enabled_payment_gateways() );
97
+	$enabled_gateways = array_keys(give_get_enabled_payment_gateways());
98 98
 	$default_gateway  = give_get_option('default_gateway');
99
-	$default          = ! empty( $default_gateway ) && give_is_gateway_active( $default_gateway ) ? $default_gateway : $enabled_gateways[0];
100
-	$form_default     = give_get_meta( $form_id, '_give_default_gateway', true );
99
+	$default          = ! empty($default_gateway) && give_is_gateway_active($default_gateway) ? $default_gateway : $enabled_gateways[0];
100
+	$form_default     = give_get_meta($form_id, '_give_default_gateway', true);
101 101
 
102 102
 	// Single Form settings varies compared to the Global default settings.
103 103
 	if (
104
-		! empty( $form_default ) &&
104
+		! empty($form_default) &&
105 105
 		$form_id !== null &&
106 106
 		$default !== $form_default &&
107 107
 		'global' !== $form_default &&
108
-		give_is_gateway_active( $form_default )
108
+		give_is_gateway_active($form_default)
109 109
 	) {
110 110
 		$default = $form_default;
111 111
 	}
112 112
 
113
-	return apply_filters( 'give_default_gateway', $default );
113
+	return apply_filters('give_default_gateway', $default);
114 114
 }
115 115
 
116 116
 /**
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
  *
123 123
  * @return string Gateway admin label
124 124
  */
125
-function give_get_gateway_admin_label( $gateway ) {
125
+function give_get_gateway_admin_label($gateway) {
126 126
 	$gateways = give_get_payment_gateways();
127
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
127
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
128 128
 
129
-	if ( $gateway == 'manual' ) {
130
-		$label = __( 'Test Donation', 'give' );
129
+	if ($gateway == 'manual') {
130
+		$label = __('Test Donation', 'give');
131 131
 	}
132 132
 
133
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
133
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
134 134
 }
135 135
 
136 136
 /**
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @return string Checkout label for the gateway
144 144
  */
145
-function give_get_gateway_checkout_label( $gateway ) {
145
+function give_get_gateway_checkout_label($gateway) {
146 146
 	$gateways = give_get_payment_gateways();
147
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
147
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
148 148
 
149
-	if ( $gateway == 'manual' ) {
150
-		$label = __( 'Test Donation', 'give' );
149
+	if ($gateway == 'manual') {
150
+		$label = __('Test Donation', 'give');
151 151
 	}
152 152
 
153
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
153
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
154 154
 }
155 155
 
156 156
 /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return array Options the gateway supports
164 164
  */
165
-function give_get_gateway_supports( $gateway ) {
165
+function give_get_gateway_supports($gateway) {
166 166
 	$gateways = give_get_enabled_payment_gateways();
167
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
167
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
168 168
 
169
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
169
+	return apply_filters('give_gateway_supports', $supports, $gateway);
170 170
 }
171 171
 
172 172
 /**
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return void
181 181
  */
182
-function give_send_to_gateway( $gateway, $payment_data ) {
182
+function give_send_to_gateway($gateway, $payment_data) {
183 183
 
184
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
184
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
185 185
 
186 186
 	/**
187 187
 	 * Fires while loading payment gateway via AJAX.
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 *
193 193
 	 * @param array $payment_data All the payment data to be sent to the gateway.
194 194
 	 */
195
-	do_action( "give_gateway_{$gateway}", $payment_data );
195
+	do_action("give_gateway_{$gateway}", $payment_data);
196 196
 }
197 197
 
198 198
 
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
  *
207 207
  * @return string $enabled_gateway The slug of the gateway
208 208
  */
209
-function give_get_chosen_gateway( $form_id ) {
209
+function give_get_chosen_gateway($form_id) {
210 210
 
211
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
211
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
212 212
 
213 213
 	// Back to check if 'form-id' is present.
214
-	if ( empty( $request_form_id ) ) {
215
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
214
+	if (empty($request_form_id)) {
215
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
216 216
 	}
217 217
 
218
-	$request_payment_mode = isset( $_REQUEST['payment-mode'] ) ? $_REQUEST['payment-mode'] : '';
218
+	$request_payment_mode = isset($_REQUEST['payment-mode']) ? $_REQUEST['payment-mode'] : '';
219 219
 	$chosen               = false;
220 220
 
221 221
 	// If both 'payment-mode' and 'form-id' then set for only this form.
222
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
222
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
223 223
 		$chosen = $request_payment_mode;
224
-	} elseif ( empty( $request_form_id ) && $request_payment_mode ) {
224
+	} elseif (empty($request_form_id) && $request_payment_mode) {
225 225
 		// If no 'form-id' but there is 'payment-mode'.
226 226
 		$chosen = $request_payment_mode;
227 227
 	}
228 228
 
229 229
 	// Get the enable gateway based of chosen var.
230
-	if ( $chosen && give_is_gateway_active( $chosen ) ) {
231
-		$enabled_gateway = urldecode( $chosen );
230
+	if ($chosen && give_is_gateway_active($chosen)) {
231
+		$enabled_gateway = urldecode($chosen);
232 232
 	} else {
233
-		$enabled_gateway = give_get_default_gateway( $form_id );
233
+		$enabled_gateway = give_get_default_gateway($form_id);
234 234
 	}
235 235
 
236
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
236
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
237 237
 
238 238
 }
239 239
 
@@ -252,8 +252,8 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return int             ID of the new log entry.
254 254
  */
255
-function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
256
-	return Give()->logs->add( $title, $message, $parent, $type );
255
+function give_record_log($title = '', $message = '', $parent = 0, $type = null) {
256
+	return Give()->logs->add($title, $message, $parent, $type);
257 257
 }
258 258
 
259 259
 /**
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
  *
271 271
  * @return int ID of the new log entry
272 272
  */
273
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
274
-	$title = empty( $title ) ? esc_html__( 'Payment Error', 'give' ) : $title;
273
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
274
+	$title = empty($title) ? esc_html__('Payment Error', 'give') : $title;
275 275
 
276
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
276
+	return give_record_log($title, $message, $parent, 'gateway_error');
277 277
 }
278 278
 
279 279
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @return int
288 288
  */
289
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
289
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
290 290
 
291 291
 	$ret  = 0;
292 292
 	$args = array(
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
 		'fields'      => 'ids',
299 299
 	);
300 300
 
301
-	$payments = new WP_Query( $args );
301
+	$payments = new WP_Query($args);
302 302
 
303
-	if ( $payments ) {
303
+	if ($payments) {
304 304
 		$ret = $payments->post_count;
305 305
 	}
306 306
 
@@ -317,27 +317,27 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return array $gateways All the available gateways
319 319
  */
320
-function give_get_ordered_payment_gateways( $gateways ) {
320
+function give_get_ordered_payment_gateways($gateways) {
321 321
 
322 322
 	// Get gateways setting.
323
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
323
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
324 324
 
325 325
 	// Return from here if we do not have gateways setting.
326
-	if ( empty( $gateways_setting ) ) {
326
+	if (empty($gateways_setting)) {
327 327
 		return $gateways;
328 328
 	}
329 329
 
330 330
 	// Reverse array to order payment gateways.
331
-	$gateways_setting = array_reverse( $gateways_setting );
331
+	$gateways_setting = array_reverse($gateways_setting);
332 332
 
333 333
 	// Reorder gateways array
334
-	foreach ( $gateways_setting as $gateway_key => $value ) {
334
+	foreach ($gateways_setting as $gateway_key => $value) {
335 335
 
336
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
337
-		unset( $gateways[ $gateway_key ] );
336
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
337
+		unset($gateways[$gateway_key]);
338 338
 
339
-		if ( ! empty( $new_gateway_value ) ) {
340
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
339
+		if ( ! empty($new_gateway_value)) {
340
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
341 341
 		}
342 342
 	}
343 343
 
@@ -348,5 +348,5 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @param array $gateways All the available gateways
350 350
 	 */
351
-	return apply_filters( 'give_payment_gateways_order', $gateways );
351
+	return apply_filters('give_payment_gateways_order', $gateways);
352 352
 }
353 353
\ No newline at end of file
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +54 added lines, -56 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,34 +26,34 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_set_settings_with_disable_prefix( $old_settings, $settings ) {
29
+function give_set_settings_with_disable_prefix($old_settings, $settings) {
30 30
 	// Bailout.
31
-	if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) {
31
+	if ( ! function_exists('give_v18_renamed_core_settings')) {
32 32
 		return;
33 33
 	}
34 34
 
35 35
 	// Get old setting names.
36
-	$old_settings   = array_flip( give_v18_renamed_core_settings() );
36
+	$old_settings   = array_flip(give_v18_renamed_core_settings());
37 37
 	$update_setting = false;
38 38
 
39
-	foreach ( $settings as $key => $value ) {
39
+	foreach ($settings as $key => $value) {
40 40
 
41 41
 		// Check 1. Check if new option is really updated or not.
42 42
 		// Check 2. Continue if key is not renamed.
43
-		if ( ! isset( $old_settings[ $key ] ) ) {
43
+		if ( ! isset($old_settings[$key])) {
44 44
 			continue;
45 45
 		}
46 46
 
47 47
 		// Set old setting.
48
-		$settings[ $old_settings[ $key ] ] = 'on';
48
+		$settings[$old_settings[$key]] = 'on';
49 49
 
50 50
 		// Do not need to set old setting if new setting is not set.
51 51
 		if (
52
-			( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) )
53
-			|| ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) )
52
+			(give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_')))
53
+			|| ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_')))
54 54
 
55 55
 		) {
56
-			unset( $settings[ $old_settings[ $key ] ] );
56
+			unset($settings[$old_settings[$key]]);
57 57
 		}
58 58
 
59 59
 		// Tell bot to update setting.
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	// Update setting if any old setting set.
64
-	if ( $update_setting ) {
65
-		update_option( 'give_settings', $settings );
64
+	if ($update_setting) {
65
+		update_option('give_settings', $settings);
66 66
 	}
67 67
 }
68 68
 
69
-add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 );
69
+add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2);
70 70
 
71 71
 /**
72 72
  * Check spam through Akismet.
@@ -80,45 +80,45 @@  discard block
 block discarded – undo
80 80
  *
81 81
  * @return bool|mixed
82 82
  */
83
-function give_akismet( $spam ) {
83
+function give_akismet($spam) {
84 84
 
85 85
 	// Bail out, If spam.
86
-	if ( $spam ) {
86
+	if ($spam) {
87 87
 		return $spam;
88 88
 	}
89 89
 
90 90
 	// Bail out, if Akismet key not exist.
91
-	if ( ! give_check_akismet_key() ) {
91
+	if ( ! give_check_akismet_key()) {
92 92
 		return false;
93 93
 	}
94 94
 
95 95
 	// Build args array.
96 96
 	$args = array();
97 97
 
98
-	$args['comment_author']       = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
99
-	$args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
100
-	$args['blog']                 = get_option( 'home' );
98
+	$args['comment_author']       = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
99
+	$args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false;
100
+	$args['blog']                 = get_option('home');
101 101
 	$args['blog_lang']            = get_locale();
102
-	$args['blog_charset']         = get_option( 'blog_charset' );
102
+	$args['blog_charset']         = get_option('blog_charset');
103 103
 	$args['user_ip']              = $_SERVER['REMOTE_ADDR'];
104 104
 	$args['user_agent']           = $_SERVER['HTTP_USER_AGENT'];
105 105
 	$args['referrer']             = $_SERVER['HTTP_REFERER'];
106 106
 	$args['comment_type']         = 'contact-form';
107 107
 
108
-	$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
108
+	$ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW');
109 109
 
110
-	foreach ( $_SERVER as $key => $value ) {
111
-		if ( ! in_array( $key, (array) $ignore ) ) {
110
+	foreach ($_SERVER as $key => $value) {
111
+		if ( ! in_array($key, (array) $ignore)) {
112 112
 			$args["$key"] = $value;
113 113
 		}
114 114
 	}
115 115
 
116 116
 	// It will return Akismet spam detect API response.
117
-	return give_akismet_spam_check( $args );
117
+	return give_akismet_spam_check($args);
118 118
 
119 119
 }
120 120
 
121
-add_filter( 'give_spam', 'give_akismet' );
121
+add_filter('give_spam', 'give_akismet');
122 122
 
123 123
 /**
124 124
  * Check Akismet API Key.
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
  * @return bool
129 129
  */
130 130
 function give_check_akismet_key() {
131
-	if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+
131
+	if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+
132 132
 		return (bool) Akismet::get_api_key();
133 133
 	}
134 134
 
135
-	if ( function_exists( 'akismet_get_key' ) ) {
135
+	if (function_exists('akismet_get_key')) {
136 136
 		return (bool) akismet_get_key();
137 137
 	}
138 138
 
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
  *
149 149
  * @return bool|mixed
150 150
  */
151
-function give_akismet_spam_check( $args ) {
151
+function give_akismet_spam_check($args) {
152 152
 	global $akismet_api_host, $akismet_api_port;
153 153
 
154 154
 	$spam         = false;
155
-	$query_string = http_build_query( $args );
155
+	$query_string = http_build_query($args);
156 156
 
157
-	if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+
158
-		$response = Akismet::http_post( $query_string, 'comment-check' );
157
+	if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+
158
+		$response = Akismet::http_post($query_string, 'comment-check');
159 159
 	} else {
160
-		$response = akismet_http_post( $query_string, $akismet_api_host,
161
-			'/1.1/comment-check', $akismet_api_port );
160
+		$response = akismet_http_post($query_string, $akismet_api_host,
161
+			'/1.1/comment-check', $akismet_api_port);
162 162
 	}
163 163
 
164 164
 	// It's spam if response status is true.
165
-	if ( 'true' === $response[1] ) {
165
+	if ('true' === $response[1]) {
166 166
 		$spam = true;
167 167
 	}
168 168
 
169 169
 	// Allow developer to modified Akismet spam detection response.
170
-	return apply_filters( 'give_akismet_spam_check', $spam, $args );
170
+	return apply_filters('give_akismet_spam_check', $spam, $args);
171 171
 }
172 172
 
173 173
 /**
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
  *
181 181
  * @return array
182 182
  */
183
-function give_bc_v1817_iranian_currency_code( $currencies ) {
184
-	if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) {
183
+function give_bc_v1817_iranian_currency_code($currencies) {
184
+	if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) {
185 185
 		$currencies['RIAL'] = $currencies['IRR'];
186 186
 	}
187 187
 
188 188
 	return $currencies;
189 189
 }
190 190
 
191
-add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 );
191
+add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0);
192 192
 
193 193
 
194 194
 /**
@@ -202,25 +202,23 @@  discard block
 block discarded – undo
202 202
  *
203 203
  * @return string
204 204
  */
205
-function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) {
206
-	if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) {
205
+function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) {
206
+	if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) {
207 207
 		return $formatted_amount;
208 208
 	}
209 209
 
210 210
 	$formatted_amount = (
211 211
 	'before' === (string) $currency_args['position'] ?
212
-		'&#x202B;' . $price . $currency_args['symbol'] . '&#x202C;' :
213
-		'&#x202A;' . $price . $currency_args['symbol'] . '&#x202C;'
212
+		'&#x202B;'.$price.$currency_args['symbol'].'&#x202C;' : '&#x202A;'.$price.$currency_args['symbol'].'&#x202C;'
214 213
 	);
215 214
 
216 215
 	$formatted_amount = $currency_args['decode_currency'] ?
217
-		html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) :
218
-		$formatted_amount;
216
+		html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount;
219 217
 
220 218
 	return $formatted_amount;
221 219
 }
222 220
 
223
-add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 );
221
+add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3);
224 222
 
225 223
 /**
226 224
  * Validate active gateway value before returning result.
@@ -231,31 +229,31 @@  discard block
 block discarded – undo
231 229
  *
232 230
  * @return array
233 231
  */
234
-function __give_validate_active_gateways( $value ) {
235
-	$gateways = array_keys( give_get_payment_gateways() );
236
-	$active_gateways = is_array( $value ) ? array_keys( $value ) : array();
232
+function __give_validate_active_gateways($value) {
233
+	$gateways = array_keys(give_get_payment_gateways());
234
+	$active_gateways = is_array($value) ? array_keys($value) : array();
237 235
 
238 236
 	// Remove deactivated payment gateways.
239
-	if( ! empty( $active_gateways ) ) {
240
-		foreach ( $active_gateways as $index => $gateway_id ) {
241
-			if( ! in_array( $gateway_id, $gateways ) ) {
242
-				unset( $value[$gateway_id] );
237
+	if ( ! empty($active_gateways)) {
238
+		foreach ($active_gateways as $index => $gateway_id) {
239
+			if ( ! in_array($gateway_id, $gateways)) {
240
+				unset($value[$gateway_id]);
243 241
 			}
244 242
 		}
245 243
 	}
246 244
 
247
-	if ( empty( $value ) ) {
245
+	if (empty($value)) {
248 246
 		/**
249 247
 		 * Filter the default active gateway
250 248
 		 *
251 249
 		 * @since 2.1.0
252 250
 		 */
253
-		$value = apply_filters( 'give_default_active_gateways', array(
251
+		$value = apply_filters('give_default_active_gateways', array(
254 252
 			'manual' => 1,
255
-		) );
253
+		));
256 254
 	}
257 255
 
258 256
 	return $value;
259 257
 }
260 258
 
261
-add_filter( 'give_get_option_gateways', '__give_validate_active_gateways', 10, 1 );
262 259
\ No newline at end of file
260
+add_filter('give_get_option_gateways', '__give_validate_active_gateways', 10, 1);
263 261
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-notices.php 1 patch
Spacing   +107 added lines, -108 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 	 * @since 1.8.9
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 );
57
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
56
+		add_action('admin_notices', array($this, 'render_admin_notices'), 999);
57
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
58 58
 
59
-		add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 );
60
-		add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 );
61
-		add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) );
59
+		add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999);
60
+		add_action('give_pre_form', array($this, 'render_frontend_notices'), 11);
61
+		add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices'));
62 62
 
63 63
 		/**
64 64
 		 * Backward compatibility for deprecated params.
65 65
 		 *
66 66
 		 * @since 1.8.14
67 67
 		 */
68
-		add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) );
69
-		add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) );
70
-		add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) );
68
+		add_filter('give_register_notice_args', array($this, 'bc_deprecated_params'));
69
+		add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params'));
70
+		add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params'));
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return array
82 82
 	 */
83
-	public function bc_deprecated_params( $args ) {
83
+	public function bc_deprecated_params($args) {
84 84
 		/**
85 85
 		 *  Param: auto_dismissible
86 86
 		 *  deprecated in 1.8.14
87 87
 		 *
88 88
 		 *  Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto
89 89
 		 */
90
-		if ( isset( $args['auto_dismissible'] ) ) {
91
-			if ( ! empty( $args['auto_dismissible'] ) ) {
90
+		if (isset($args['auto_dismissible'])) {
91
+			if ( ! empty($args['auto_dismissible'])) {
92 92
 				$args['dismissible'] = 'auto';
93 93
 			}
94 94
 			// unset auto_dismissible as it has been deprecated.
95
-			unset( $args['auto_dismissible'] );
95
+			unset($args['auto_dismissible']);
96 96
 		}
97 97
 
98 98
 		return $args;
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return bool
110 110
 	 */
111
-	public function register_notice( $notice_args ) {
111
+	public function register_notice($notice_args) {
112 112
 		// Bailout.
113
-		if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) {
113
+		if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) {
114 114
 			return false;
115 115
 		}
116 116
 
@@ -159,39 +159,39 @@  discard block
 block discarded – undo
159 159
 		 *
160 160
 		 * @since 1.8.14
161 161
 		 */
162
-		$notice_args = apply_filters( 'give_register_notice_args', $notice_args );
162
+		$notice_args = apply_filters('give_register_notice_args', $notice_args);
163 163
 
164 164
 		// Set extra dismiss links if any.
165
-		if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) {
165
+		if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) {
166 166
 
167
-			preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link );
167
+			preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link);
168 168
 
169
-			if ( ! empty( $extra_notice_dismiss_link ) ) {
170
-				$extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 );
171
-				foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) {
169
+			if ( ! empty($extra_notice_dismiss_link)) {
170
+				$extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3);
171
+				foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) {
172 172
 					// Create array og key ==> value by parsing query string created after renaming data attributes.
173
-					$data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array(
173
+					$data_attribute_query_str = str_replace(array('data-', '-', '"'), array(
174 174
 						'',
175 175
 						'_',
176 176
 						'',
177
-					), implode( '&', $extra_notice_dismiss_link ) );
177
+					), implode('&', $extra_notice_dismiss_link));
178 178
 
179
-					$notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str );
179
+					$notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str);
180 180
 				}
181 181
 			}
182 182
 		}
183 183
 
184 184
 
185
-		self::$notices[ $notice_args['id'] ] = $notice_args;
185
+		self::$notices[$notice_args['id']] = $notice_args;
186 186
 
187 187
 		// Auto set show param if not already set.
188
-		if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) {
189
-			self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true;
188
+		if ( ! isset(self::$notices[$notice_args['id']]['show'])) {
189
+			self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true;
190 190
 		}
191 191
 
192 192
 		// Auto set time interval for shortly.
193
-		if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) {
194
-			self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS;
193
+		if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) {
194
+			self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS;
195 195
 		}
196 196
 
197 197
 		return true;
@@ -205,51 +205,51 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function render_admin_notices() {
207 207
 		// Bailout.
208
-		if ( empty( self::$notices ) ) {
208
+		if (empty(self::$notices)) {
209 209
 			return;
210 210
 		}
211 211
 
212 212
 		$output = '';
213 213
 
214
-		foreach ( self::$notices as $notice_id => $notice ) {
214
+		foreach (self::$notices as $notice_id => $notice) {
215 215
 			// Check flag set to true to show notice.
216
-			if ( ! $notice['show'] ) {
216
+			if ( ! $notice['show']) {
217 217
 				continue;
218 218
 			}
219 219
 
220 220
 
221 221
 			// Render custom html.
222
-			if( ! empty( $notice['description_html'] ) ) {
222
+			if ( ! empty($notice['description_html'])) {
223 223
 				$output .= "{$notice['description_html']} \n";
224 224
 				continue;
225 225
 			}
226 226
 
227 227
 			// Check if notice dismissible or not.
228
-			if ( ! self::$has_auto_dismissible_notice ) {
229
-				self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] );
228
+			if ( ! self::$has_auto_dismissible_notice) {
229
+				self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']);
230 230
 			}
231 231
 
232 232
 			// Check if notice dismissible or not.
233
-			if ( ! self::$has_dismiss_interval_notice ) {
233
+			if ( ! self::$has_dismiss_interval_notice) {
234 234
 				self::$has_dismiss_interval_notice = $notice['dismiss_interval'];
235 235
 			}
236 236
 
237
-			$css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] );
237
+			$css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']);
238 238
 
239
-			$css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}";
240
-			$output    .= sprintf(
241
-				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n",
239
+			$css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}";
240
+			$output .= sprintf(
241
+				'<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n",
242 242
 				$css_id,
243 243
 				$css_class,
244
-				give_clean( $notice['dismissible'] ),
244
+				give_clean($notice['dismissible']),
245 245
 				$notice['dismissible_type'],
246 246
 				$notice['dismiss_interval'],
247 247
 				$notice['id'],
248
-				empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ),
248
+				empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"),
249 249
 				$notice['dismiss_interval_time']
250 250
 			);
251 251
 
252
-			$output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" );
252
+			$output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>");
253 253
 			$output .= "</div> \n";
254 254
 		}
255 255
 
@@ -267,18 +267,18 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @param int $form_id
269 269
 	 */
270
-	public function render_frontend_notices( $form_id = 0 ) {
270
+	public function render_frontend_notices($form_id = 0) {
271 271
 		$errors = give_get_errors();
272 272
 
273
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0;
273
+		$request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0;
274 274
 
275 275
 		// Sanity checks first: Ensure that gateway returned errors display on the appropriate form.
276
-		if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
276
+		if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
277 277
 			return;
278 278
 		}
279 279
 
280
-		if ( $errors ) {
281
-			self::print_frontend_errors( $errors );
280
+		if ($errors) {
281
+			self::print_frontend_errors($errors);
282 282
 
283 283
 			give_clear_errors();
284 284
 		}
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @access private
292 292
 	 */
293 293
 	private function print_js() {
294
-		if ( self::$has_auto_dismissible_notice ) :
294
+		if (self::$has_auto_dismissible_notice) :
295 295
 			?>
296 296
 			<script>
297 297
 				jQuery(document).ready(function () {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			<?php
308 308
 		endif;
309 309
 
310
-		if ( self::$has_dismiss_interval_notice ) :
310
+		if (self::$has_dismiss_interval_notice) :
311 311
 			?>
312 312
 			<script>
313 313
 				jQuery(document).ready(function () {
@@ -386,36 +386,36 @@  discard block
 block discarded – undo
386 386
 	 * @access public
387 387
 	 */
388 388
 	public function dismiss_notices() {
389
-		$_post     = give_clean( $_POST );
390
-		$notice_id = esc_attr( $_post['notice_id'] );
389
+		$_post     = give_clean($_POST);
390
+		$notice_id = esc_attr($_post['notice_id']);
391 391
 
392 392
 		// Bailout.
393 393
 		if (
394
-			empty( $notice_id ) ||
395
-			empty( $_post['dismissible_type'] ) ||
396
-			empty( $_post['dismiss_interval'] ) ||
397
-			! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' )
394
+			empty($notice_id) ||
395
+			empty($_post['dismissible_type']) ||
396
+			empty($_post['dismiss_interval']) ||
397
+			! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce')
398 398
 		) {
399 399
 			wp_send_json_error();
400 400
 		}
401 401
 
402
-		$notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] );
403
-		if ( 'user' === $_post['dismissible_type'] ) {
402
+		$notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']);
403
+		if ('user' === $_post['dismissible_type']) {
404 404
 			$current_user = wp_get_current_user();
405
-			$notice_key   = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID );
405
+			$notice_key   = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID);
406 406
 		}
407 407
 
408
-		$notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null;
408
+		$notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null;
409 409
 
410 410
 		// Save option to hide notice.
411
-		Give_Cache::set( $notice_key, true, $notice_dismiss_time, true );
411
+		Give_Cache::set($notice_key, true, $notice_dismiss_time, true);
412 412
 
413 413
 		/**
414 414
 		 * Fire the action when notice dismissed
415 415
 		 *
416 416
 		 * @since 2.0
417 417
 		 */
418
-		do_action( 'give_dismiss_notices', $_post );
418
+		do_action('give_dismiss_notices', $_post);
419 419
 
420 420
 		wp_send_json_success();
421 421
 	}
@@ -433,18 +433,18 @@  discard block
 block discarded – undo
433 433
 	 *
434 434
 	 * @return string
435 435
 	 */
436
-	public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) {
436
+	public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) {
437 437
 		$notice_key = "_give_notice_{$notice_id}";
438 438
 
439
-		if ( ! empty( $dismiss_interval ) ) {
439
+		if ( ! empty($dismiss_interval)) {
440 440
 			$notice_key .= "_{$dismiss_interval}";
441 441
 		}
442 442
 
443
-		if ( $user_id ) {
443
+		if ($user_id) {
444 444
 			$notice_key .= "_{$user_id}";
445 445
 		}
446 446
 
447
-		$notice_key = sanitize_key( $notice_key );
447
+		$notice_key = sanitize_key($notice_key);
448 448
 
449 449
 		return $notice_key;
450 450
 	}
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
 	 *
458 458
 	 * @return string
459 459
 	 */
460
-	public function get_dismiss_link( $notice_args ) {
460
+	public function get_dismiss_link($notice_args) {
461 461
 		$notice_args = wp_parse_args(
462 462
 			$notice_args,
463 463
 			array(
464
-				'title'                 => __( 'Click here', 'give' ),
464
+				'title'                 => __('Click here', 'give'),
465 465
 				'dismissible_type'      => '',
466 466
 				'dismiss_interval'      => '',
467 467
 				'dismiss_interval_time' => null,
@@ -488,31 +488,31 @@  discard block
 block discarded – undo
488 488
 	 *
489 489
 	 * @return bool|null
490 490
 	 */
491
-	public function is_notice_dismissed( $notice ) {
492
-		$notice_key          = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] );
491
+	public function is_notice_dismissed($notice) {
492
+		$notice_key          = $this->get_notice_key($notice['id'], $notice['dismiss_interval']);
493 493
 		$is_notice_dismissed = false;
494 494
 
495
-		if ( 'user' === $notice['dismissible_type'] ) {
495
+		if ('user' === $notice['dismissible_type']) {
496 496
 			$current_user = wp_get_current_user();
497
-			$notice_key   = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID );
497
+			$notice_key   = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID);
498 498
 		}
499 499
 
500
-		$notice_data = Give_Cache::get( $notice_key, true );
500
+		$notice_data = Give_Cache::get($notice_key, true);
501 501
 
502 502
 		// Find notice dismiss link status if notice has extra dismissible links.
503
-		if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) {
503
+		if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) {
504 504
 
505
-			foreach ( $notice['extra_links'] as $extra_link ) {
506
-				$new_notice_data = wp_parse_args( $extra_link, $notice );
507
-				unset( $new_notice_data['extra_links'] );
505
+			foreach ($notice['extra_links'] as $extra_link) {
506
+				$new_notice_data = wp_parse_args($extra_link, $notice);
507
+				unset($new_notice_data['extra_links']);
508 508
 
509
-				if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) {
509
+				if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) {
510 510
 					return $is_notice_dismissed;
511 511
 				}
512 512
 			}
513 513
 		}
514 514
 
515
-		$is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data );
515
+		$is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data);
516 516
 
517 517
 		return $is_notice_dismissed;
518 518
 	}
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @param array $errors
528 528
 	 */
529
-	public static function print_frontend_errors( $errors ) {
529
+	public static function print_frontend_errors($errors) {
530 530
 		// Bailout.
531
-		if ( ! $errors ) {
531
+		if ( ! $errors) {
532 532
 			return;
533 533
 		}
534 534
 
@@ -543,37 +543,37 @@  discard block
 block discarded – undo
543 543
 		);
544 544
 
545 545
 		// Note: we will remove give_errors class in future.
546
-		$classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) );
546
+		$classes = apply_filters('give_error_class', array('give_notices', 'give_errors'));
547 547
 
548
-		echo sprintf( '<div class="%s">', implode( ' ', $classes ) );
548
+		echo sprintf('<div class="%s">', implode(' ', $classes));
549 549
 
550 550
 		// Loop error codes and display errors.
551
-		foreach ( $errors as $error_id => $error ) {
551
+		foreach ($errors as $error_id => $error) {
552 552
 			// Backward compatibility v<1.8.11
553
-			if ( is_string( $error ) ) {
553
+			if (is_string($error)) {
554 554
 				$error = array(
555 555
 					'message'     => $error,
556 556
 					'notice_args' => array(),
557 557
 				);
558 558
 			}
559 559
 
560
-			$notice_args = wp_parse_args( $error['notice_args'], $default_notice_args );
560
+			$notice_args = wp_parse_args($error['notice_args'], $default_notice_args);
561 561
 
562 562
 			/**
563 563
 			 * Filter to modify Frontend Errors args before errors is display.
564 564
 			 *
565 565
 			 * @since 1.8.14
566 566
 			 */
567
-			$notice_args = apply_filters( 'give_frontend_errors_args', $notice_args );
567
+			$notice_args = apply_filters('give_frontend_errors_args', $notice_args);
568 568
 
569 569
 			echo sprintf(
570 570
 				'<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d">
571 571
 						<p><strong>%4$s</strong>: %5$s</p>
572 572
 					</div>',
573 573
 				$error_id,
574
-				give_clean( $notice_args['dismissible'] ),
575
-				absint( $notice_args['dismiss_interval'] ),
576
-				esc_html__( 'Error', 'give' ),
574
+				give_clean($notice_args['dismissible']),
575
+				absint($notice_args['dismiss_interval']),
576
+				esc_html__('Error', 'give'),
577 577
 				$error['message']
578 578
 			);
579 579
 		}
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 *
596 596
 	 * @return  string
597 597
 	 */
598
-	public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) {
599
-		if ( empty( $message ) ) {
598
+	public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) {
599
+		if (empty($message)) {
600 600
 			return '';
601 601
 		}
602 602
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 			'dismiss_interval' => 5000,
612 612
 		);
613 613
 
614
-		$notice_args = wp_parse_args( $notice_args, $default_notice_args );
614
+		$notice_args = wp_parse_args($notice_args, $default_notice_args);
615 615
 
616 616
 		// Notice dismissible must be true for dismiss type.
617 617
 		$notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type'];
@@ -621,15 +621,14 @@  discard block
 block discarded – undo
621 621
 		 *
622 622
 		 * @since 1.8.14
623 623
 		 */
624
-		$notice_args = apply_filters( 'give_frontend_notice_args', $notice_args );
624
+		$notice_args = apply_filters('give_frontend_notice_args', $notice_args);
625 625
 
626 626
 		$close_icon = 'manual' === $notice_args['dismiss_type'] ?
627 627
 			sprintf(
628 628
 				'<img class="notice-dismiss give-notice-close" src="%s" />',
629
-				esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' )
629
+				esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg')
630 630
 
631
-			) :
632
-			'';
631
+			) : '';
633 632
 
634 633
 		// Note: we will remove give_errors class in future.
635 634
 		$error = sprintf(
@@ -640,15 +639,15 @@  discard block
 block discarded – undo
640 639
 						%6$s
641 640
 					</div>',
642 641
 			$notice_type,
643
-			give_clean( $notice_args['dismissible'] ),
644
-			absint( $notice_args['dismiss_interval'] ),
645
-			give_clean( $notice_args['dismiss_type'] ),
642
+			give_clean($notice_args['dismissible']),
643
+			absint($notice_args['dismiss_interval']),
644
+			give_clean($notice_args['dismiss_type']),
646 645
 			$message,
647 646
 			$close_icon
648 647
 
649 648
 		);
650 649
 
651
-		if ( ! $echo ) {
650
+		if ( ! $echo) {
652 651
 			return $error;
653 652
 		}
654 653
 
@@ -668,24 +667,24 @@  discard block
 block discarded – undo
668 667
 	 *
669 668
 	 * @return string
670 669
 	 */
671
-	public function print_admin_notices( $notice_args = array() ) {
670
+	public function print_admin_notices($notice_args = array()) {
672 671
 		// Bailout.
673
-		if ( empty( $notice_args['description'] ) ) {
672
+		if (empty($notice_args['description'])) {
674 673
 			return '';
675 674
 		}
676 675
 
677
-		$defaults    = array(
676
+		$defaults = array(
678 677
 			'id'          => '',
679 678
 			'echo'        => true,
680 679
 			'notice_type' => 'warning',
681 680
 			'dismissible' => true,
682 681
 		);
683
-		$notice_args = wp_parse_args( $notice_args, $defaults );
682
+		$notice_args = wp_parse_args($notice_args, $defaults);
684 683
 
685 684
 		$output    = '';
686
-		$css_id    = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' );
685
+		$css_id    = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-');
687 686
 		$css_class = "notice-{$notice_args['notice_type']} give-notice notice inline";
688
-		$css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : '';
687
+		$css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : '';
689 688
 		$output    .= sprintf(
690 689
 			'<div id="%1$s" class="%2$s"><p>%3$s</p></div>',
691 690
 			$css_id,
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
 			$notice_args['description']
694 693
 		);
695 694
 
696
-		if ( ! $notice_args['echo'] ) {
695
+		if ( ! $notice_args['echo']) {
697 696
 			return $output;
698 697
 		}
699 698
 
Please login to merge, or discard this patch.
includes/currency-functions.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return string The currency code
22 22
  */
23
-function give_get_currency( $donation_or_form_id = null, $args = array() ) {
23
+function give_get_currency($donation_or_form_id = null, $args = array()) {
24 24
 
25 25
 	// Get currency from donation
26
-	if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) {
27
-		$currency = give_get_meta( $donation_or_form_id, '_give_payment_currency', true );
26
+	if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) {
27
+		$currency = give_get_meta($donation_or_form_id, '_give_payment_currency', true);
28 28
 
29
-		if ( empty( $currency ) ) {
30
-			$currency = give_get_option( 'currency', 'USD' );
29
+		if (empty($currency)) {
30
+			$currency = give_get_option('currency', 'USD');
31 31
 		}
32 32
 	} else {
33
-		$currency = give_get_option( 'currency', 'USD' );
33
+		$currency = give_get_option('currency', 'USD');
34 34
 	}
35 35
 
36 36
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @since 1.0
40 40
 	 */
41
-	return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args );
41
+	return apply_filters('give_currency', $currency, $donation_or_form_id, $args);
42 42
 }
43 43
 
44 44
 /**
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function give_get_currency_position() {
52 52
 
53
-	$currency_pos = give_get_option( 'currency_position', 'before' );
53
+	$currency_pos = give_get_option('currency_position', 'before');
54 54
 
55
-	return apply_filters( 'give_currency_position', $currency_pos );
55
+	return apply_filters('give_currency_position', $currency_pos);
56 56
 }
57 57
 
58 58
 /**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 function give_get_currencies_list() {
66 66
 	$currencies = array(
67 67
 		'USD' => array(
68
-			'admin_label' => sprintf( __('US Dollars (%1$s)', 'give'), '&#36;'),
68
+			'admin_label' => sprintf(__('US Dollars (%1$s)', 'give'), '&#36;'),
69 69
 			'symbol'      => '&#36;',
70 70
 			'setting'     => array(
71 71
 				'currency_position'   => 'before',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			),
76 76
 		),
77 77
 		'EUR' => array(
78
-			'admin_label' => sprintf( __('Euros (%1$s)', 'give'), '&euro;'),
78
+			'admin_label' => sprintf(__('Euros (%1$s)', 'give'), '&euro;'),
79 79
 			'symbol'      => '&euro;',
80 80
 			'setting'     => array(
81 81
 				'currency_position'   => 'before',
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			),
86 86
 		),
87 87
 		'GBP' => array(
88
-			'admin_label' => sprintf( __('Pounds Sterling (%1$s)', 'give'), '&pound;'),
88
+			'admin_label' => sprintf(__('Pounds Sterling (%1$s)', 'give'), '&pound;'),
89 89
 			'symbol'      => '&pound;',
90 90
 			'setting'     => array(
91 91
 				'currency_position'   => 'before',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			),
96 96
 		),
97 97
 		'AUD' => array(
98
-			'admin_label' => sprintf( __('Australian Dollars (%1$s)', 'give'), '&#36;'),
98
+			'admin_label' => sprintf(__('Australian Dollars (%1$s)', 'give'), '&#36;'),
99 99
 			'symbol'      => '&#36;',
100 100
 			'setting'     => array(
101 101
 				'currency_position'   => 'before',
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			),
106 106
 		),
107 107
 		'BRL' => array(
108
-			'admin_label' => sprintf( __('Brazilian Real (%1$s)', 'give'), '&#82;&#36;'),
108
+			'admin_label' => sprintf(__('Brazilian Real (%1$s)', 'give'), '&#82;&#36;'),
109 109
 			'symbol'      => '&#82;&#36;',
110 110
 			'setting'     => array(
111 111
 				'currency_position'   => 'before',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			),
116 116
 		),
117 117
 		'CAD' => array(
118
-			'admin_label' => sprintf( __('Canadian Dollars (%1$s)', 'give'), '&#36;'),
118
+			'admin_label' => sprintf(__('Canadian Dollars (%1$s)', 'give'), '&#36;'),
119 119
 			'symbol'      => '&#36;',
120 120
 			'setting'     => array(
121 121
 				'currency_position'   => 'before',
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 			),
126 126
 		),
127 127
 		'CZK' => array(
128
-			'admin_label' => sprintf( __('Czech Koruna (%1$s)', 'give'), '&#75;&#269;'),
128
+			'admin_label' => sprintf(__('Czech Koruna (%1$s)', 'give'), '&#75;&#269;'),
129 129
 			'symbol'      => '&#75;&#269;',
130 130
 			'setting'     => array(
131 131
 				'currency_position'   => 'after',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			),
136 136
 		),
137 137
 		'DKK' => array(
138
-			'admin_label' => sprintf( __('Danish Krone (%1$s)', 'give'), '&nbsp;kr.&nbsp;'),
138
+			'admin_label' => sprintf(__('Danish Krone (%1$s)', 'give'), '&nbsp;kr.&nbsp;'),
139 139
 			'symbol'      => '&nbsp;kr.&nbsp;',
140 140
 			'setting'     => array(
141 141
 				'currency_position'   => 'before',
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			),
146 146
 		),
147 147
 		'HKD' => array(
148
-			'admin_label' => sprintf( __('Hong Kong Dollar (%1$s)', 'give'), '&#36;'),
148
+			'admin_label' => sprintf(__('Hong Kong Dollar (%1$s)', 'give'), '&#36;'),
149 149
 			'symbol'      => '&#36;',
150 150
 			'setting'     => array(
151 151
 				'currency_position'   => 'before',
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 			),
156 156
 		),
157 157
 		'HUF' => array(
158
-			'admin_label' => sprintf( __('Hungarian Forint (%1$s)', 'give'), '&#70;&#116;'),
158
+			'admin_label' => sprintf(__('Hungarian Forint (%1$s)', 'give'), '&#70;&#116;'),
159 159
 			'symbol'      => '&#70;&#116;',
160 160
 			'setting'     => array(
161 161
 				'currency_position'   => 'after',
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 			),
166 166
 		),
167 167
 		'ILS' => array(
168
-			'admin_label' => sprintf( __('Israeli Shekel (%1$s)', 'give'), '&#8362;'),
168
+			'admin_label' => sprintf(__('Israeli Shekel (%1$s)', 'give'), '&#8362;'),
169 169
 			'symbol'      => '&#8362;',
170 170
 			'setting'     => array(
171 171
 				'currency_position'   => 'after',
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			),
176 176
 		),
177 177
 		'JPY' => array(
178
-			'admin_label' => sprintf( __('Japanese Yen (%1$s)', 'give'), '&yen;'),
178
+			'admin_label' => sprintf(__('Japanese Yen (%1$s)', 'give'), '&yen;'),
179 179
 			'symbol'      => '&yen;',
180 180
 			'setting'     => array(
181 181
 				'currency_position'   => 'before',
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			),
186 186
 		),
187 187
 		'MYR' => array(
188
-			'admin_label' => sprintf( __('Malaysian Ringgits (%1$s)', 'give'), '&#82;&#77;'),
188
+			'admin_label' => sprintf(__('Malaysian Ringgits (%1$s)', 'give'), '&#82;&#77;'),
189 189
 			'symbol'      => '&#82;&#77;',
190 190
 			'setting'     => array(
191 191
 				'currency_position'   => 'before',
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 			),
196 196
 		),
197 197
 		'MXN' => array(
198
-			'admin_label' => sprintf( __('Mexican Peso (%1$s)', 'give'), '&#36;'),
198
+			'admin_label' => sprintf(__('Mexican Peso (%1$s)', 'give'), '&#36;'),
199 199
 			'symbol'      => '&#36;',
200 200
 			'setting'     => array(
201 201
 				'currency_position'   => 'before',
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			),
206 206
 		),
207 207
 		'MAD' => array(
208
-			'admin_label' => sprintf( __('Moroccan Dirham (%1$s)', 'give'), '&#x2e;&#x62f;&#x2e;&#x645;'),
208
+			'admin_label' => sprintf(__('Moroccan Dirham (%1$s)', 'give'), '&#x2e;&#x62f;&#x2e;&#x645;'),
209 209
 			'symbol'      => '&#x2e;&#x62f;&#x2e;&#x645;',
210 210
 			'setting'     => array(
211 211
 				'currency_position'   => 'before',
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			),
216 216
 		),
217 217
 		'NZD' => array(
218
-			'admin_label' => sprintf( __('New Zealand Dollar (%1$s)', 'give'), '&#36;'),
218
+			'admin_label' => sprintf(__('New Zealand Dollar (%1$s)', 'give'), '&#36;'),
219 219
 			'symbol'      => '&#36;',
220 220
 			'setting'     => array(
221 221
 				'currency_position'   => 'before',
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			),
226 226
 		),
227 227
 		'NOK' => array(
228
-			'admin_label' => sprintf( __('Norwegian Krone (%1$s)', 'give'), '&#107;&#114;.'),
228
+			'admin_label' => sprintf(__('Norwegian Krone (%1$s)', 'give'), '&#107;&#114;.'),
229 229
 			'symbol'      => '&#107;&#114;.',
230 230
 			'setting'     => array(
231 231
 				'currency_position'   => 'before',
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 			),
236 236
 		),
237 237
 		'PHP' => array(
238
-			'admin_label' => sprintf( __('Philippine Pesos (%1$s)', 'give'), '&#8369;'),
238
+			'admin_label' => sprintf(__('Philippine Pesos (%1$s)', 'give'), '&#8369;'),
239 239
 			'symbol'      => '&#8369;',
240 240
 			'setting'     => array(
241 241
 				'currency_position'   => 'before',
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 			),
246 246
 		),
247 247
 		'PLN' => array(
248
-			'admin_label' => sprintf( __('Polish Zloty (%1$s)', 'give'), '&#122;&#322;'),
248
+			'admin_label' => sprintf(__('Polish Zloty (%1$s)', 'give'), '&#122;&#322;'),
249 249
 			'symbol'      => '&#122;&#322;',
250 250
 			'setting'     => array(
251 251
 				'currency_position'   => 'after',
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 			),
256 256
 		),
257 257
 		'SGD' => array(
258
-			'admin_label' => sprintf( __('Singapore Dollar (%1$s)', 'give'), '&#36;'),
258
+			'admin_label' => sprintf(__('Singapore Dollar (%1$s)', 'give'), '&#36;'),
259 259
 			'symbol'      => '&#36;',
260 260
 			'setting'     => array(
261 261
 				'currency_position'   => 'before',
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			),
266 266
 		),
267 267
 		'KRW' => array(
268
-			'admin_label' => sprintf( __('South Korean Won (%1$s)', 'give'), '&#8361;'),
268
+			'admin_label' => sprintf(__('South Korean Won (%1$s)', 'give'), '&#8361;'),
269 269
 			'symbol'      => '&#8361;',
270 270
 			'setting'     => array(
271 271
 				'currency_position'   => 'before',
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			),
276 276
 		),
277 277
 		'ZAR' => array(
278
-			'admin_label' => sprintf( __('South African Rand (%1$s)', 'give'), '&#82;'),
278
+			'admin_label' => sprintf(__('South African Rand (%1$s)', 'give'), '&#82;'),
279 279
 			'symbol'      => '&#82;',
280 280
 			'setting'     => array(
281 281
 				'currency_position'   => 'before',
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			),
286 286
 		),
287 287
 		'SEK' => array(
288
-			'admin_label' => sprintf( __('Swedish Krona (%1$s)', 'give'), '&nbsp;kr.&nbsp;'),
288
+			'admin_label' => sprintf(__('Swedish Krona (%1$s)', 'give'), '&nbsp;kr.&nbsp;'),
289 289
 			'symbol'      => '&nbsp;kr.&nbsp;',
290 290
 			'setting'     => array(
291 291
 				'currency_position'   => 'before',
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			),
296 296
 		),
297 297
 		'CHF' => array(
298
-			'admin_label' => sprintf( __('Swiss Franc (%1$s)', 'give'), '&#70;&#114;'),
298
+			'admin_label' => sprintf(__('Swiss Franc (%1$s)', 'give'), '&#70;&#114;'),
299 299
 			'symbol'      => '&#70;&#114;',
300 300
 			'setting'     => array(
301 301
 				'currency_position'   => 'before',
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 			),
306 306
 		),
307 307
 		'TWD' => array(
308
-			'admin_label' => sprintf( __('Taiwan New Dollars (%1$s)', 'give'), '&#78;&#84;&#36;'),
308
+			'admin_label' => sprintf(__('Taiwan New Dollars (%1$s)', 'give'), '&#78;&#84;&#36;'),
309 309
 			'symbol'      => '&#78;&#84;&#36;',
310 310
 			'setting'     => array(
311 311
 				'currency_position'   => 'before',
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 			),
316 316
 		),
317 317
 		'THB' => array(
318
-			'admin_label' => sprintf( __('Thai Baht (%1$s)', 'give'), '&#3647;'),
318
+			'admin_label' => sprintf(__('Thai Baht (%1$s)', 'give'), '&#3647;'),
319 319
 			'symbol'      => '&#3647;',
320 320
 			'setting'     => array(
321 321
 				'currency_position'   => 'before',
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 			),
326 326
 		),
327 327
 		'INR' => array(
328
-			'admin_label' => sprintf( __('Indian Rupee (%1$s)', 'give'), '&#8377;'),
328
+			'admin_label' => sprintf(__('Indian Rupee (%1$s)', 'give'), '&#8377;'),
329 329
 			'symbol'      => '&#8377;',
330 330
 			'setting'     => array(
331 331
 				'currency_position'   => 'before',
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			),
336 336
 		),
337 337
 		'TRY' => array(
338
-			'admin_label' => sprintf( __('Turkish Lira (%1$s)', 'give'), '&#8378;'),
338
+			'admin_label' => sprintf(__('Turkish Lira (%1$s)', 'give'), '&#8378;'),
339 339
 			'symbol'      => '&#8378;',
340 340
 			'setting'     => array(
341 341
 				'currency_position'   => 'after',
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 			),
346 346
 		),
347 347
 		'IRR' => array(
348
-			'admin_label' => sprintf( __('Iranian Rial (%1$s)', 'give'), '&#xfdfc;'),
348
+			'admin_label' => sprintf(__('Iranian Rial (%1$s)', 'give'), '&#xfdfc;'),
349 349
 			'symbol'      => '&#xfdfc;',
350 350
 			'setting'     => array(
351 351
 				'currency_position'   => 'after',
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			),
356 356
 		),
357 357
 		'RUB' => array(
358
-			'admin_label' => sprintf( __('Russian Rubles (%1$s)', 'give'), '&#8381;'),
358
+			'admin_label' => sprintf(__('Russian Rubles (%1$s)', 'give'), '&#8381;'),
359 359
 			'symbol'      => '&#8381;',
360 360
 			'setting'     => array(
361 361
 				'currency_position'   => 'before',
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			),
366 366
 		),
367 367
 		'AED' => array(
368
-			'admin_label' => sprintf( __('United Arab Emirates dirham (%1$s)', 'give'), '&#x62f;.&#x625;'),
368
+			'admin_label' => sprintf(__('United Arab Emirates dirham (%1$s)', 'give'), '&#x62f;.&#x625;'),
369 369
 			'symbol'      => '&#x62f;.&#x625;',
370 370
 			'setting'     => array(
371 371
 				'currency_position'   => 'before',
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			),
376 376
 		),
377 377
 		'AMD' => array(
378
-			'admin_label' => sprintf( __('Armenian dram (%1$s)', 'give'), 'AMD'),
378
+			'admin_label' => sprintf(__('Armenian dram (%1$s)', 'give'), 'AMD'),
379 379
 			'symbol'      => 'AMD', // Add backward compatibility. Using AMD in place of &#1423;
380 380
 			'setting'     => array(
381 381
 				'currency_position'   => 'before',
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 			),
386 386
 		),
387 387
 		'ANG' => array(
388
-			'admin_label' => sprintf( __('Netherlands Antillean guilder (%1$s)', 'give'), '&#402;'),
388
+			'admin_label' => sprintf(__('Netherlands Antillean guilder (%1$s)', 'give'), '&#402;'),
389 389
 			'symbol'      => '&#402;',
390 390
 			'setting'     => array(
391 391
 				'currency_position'   => 'before',
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 			),
396 396
 		),
397 397
 		'ARS' => array(
398
-			'admin_label' => sprintf( __('Argentine peso (%1$s)', 'give'), '&#36;'),
398
+			'admin_label' => sprintf(__('Argentine peso (%1$s)', 'give'), '&#36;'),
399 399
 			'symbol'      => '&#36;',
400 400
 			'setting'     => array(
401 401
 				'currency_position'   => 'before',
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			),
406 406
 		),
407 407
 		'AWG' => array(
408
-			'admin_label' => sprintf( __( 'Aruban florin (%1$s)', 'give' ), '&#402;' ),
408
+			'admin_label' => sprintf(__('Aruban florin (%1$s)', 'give'), '&#402;'),
409 409
 			'symbol'      => '&#402;',
410 410
 			'setting'     => array(
411 411
 				'currency_position'   => 'before',
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 			),
416 416
 		),
417 417
 		'BAM' => array(
418
-			'admin_label' => sprintf( __( 'Bosnia and Herzegovina convertible mark (%1$s)', 'give' ), '&#75;&#77;' ),
418
+			'admin_label' => sprintf(__('Bosnia and Herzegovina convertible mark (%1$s)', 'give'), '&#75;&#77;'),
419 419
 			'symbol'      => '&#75;&#77;',
420 420
 			'setting'     => array(
421 421
 				'currency_position'   => 'before',
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 			),
426 426
 		),
427 427
 		'BDT' => array(
428
-			'admin_label' => sprintf( __( 'Bangladeshi taka (%1$s)', 'give' ), '&#2547;' ),
428
+			'admin_label' => sprintf(__('Bangladeshi taka (%1$s)', 'give'), '&#2547;'),
429 429
 			'symbol'      => '&#2547;',
430 430
 			'setting'     => array(
431 431
 				'currency_position'   => 'before',
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			),
436 436
 		),
437 437
 		'BHD' => array(
438
-			'admin_label' => sprintf( __( 'Bahraini dinar (%1$s)', 'give' ), '.&#x62f;.&#x628;' ),
438
+			'admin_label' => sprintf(__('Bahraini dinar (%1$s)', 'give'), '.&#x62f;.&#x628;'),
439 439
 			'symbol'      => '.&#x62f;.&#x628;',
440 440
 			'setting'     => array(
441 441
 				'currency_position'   => 'before',
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 			),
446 446
 		),
447 447
 		'BMD' => array(
448
-			'admin_label' => sprintf( __( 'Bermudian dollar (%1$s)', 'give' ), '&#66;&#68;&#36;' ),
448
+			'admin_label' => sprintf(__('Bermudian dollar (%1$s)', 'give'), '&#66;&#68;&#36;'),
449 449
 			'symbol'      => '&#66;&#68;&#36;',
450 450
 			'setting'     => array(
451 451
 				'currency_position'   => 'before',
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 			),
456 456
 		),
457 457
 		'BND' => array(
458
-			'admin_label' => sprintf( __( 'Brunei dollar (%1$s)', 'give' ), '&#66;&#36;' ),
458
+			'admin_label' => sprintf(__('Brunei dollar (%1$s)', 'give'), '&#66;&#36;'),
459 459
 			'symbol'      => '&#66;&#36;',
460 460
 			'setting'     => array(
461 461
 				'currency_position'   => 'before',
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 			),
466 466
 		),
467 467
 		'BOB' => array(
468
-			'admin_label' => sprintf( __( 'Bolivian boliviano (%1$s)', 'give' ), '&#66;&#115;&#46;' ),
468
+			'admin_label' => sprintf(__('Bolivian boliviano (%1$s)', 'give'), '&#66;&#115;&#46;'),
469 469
 			'symbol'      => '&#66;&#115;&#46;',
470 470
 			'setting'     => array(
471 471
 				'currency_position'   => 'before',
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			),
476 476
 		),
477 477
 		'BSD' => array(
478
-			'admin_label' => sprintf( __( 'Bahamian dollar (%1$s)', 'give' ), '&#66;&#36;' ),
478
+			'admin_label' => sprintf(__('Bahamian dollar (%1$s)', 'give'), '&#66;&#36;'),
479 479
 			'symbol'      => '&#66;&#36;',
480 480
 			'setting'     => array(
481 481
 				'currency_position'   => 'before',
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 			),
486 486
 		),
487 487
 		'BWP' => array(
488
-			'admin_label' => sprintf( __( 'Botswana pula (%1$s)', 'give' ), '&#80;' ),
488
+			'admin_label' => sprintf(__('Botswana pula (%1$s)', 'give'), '&#80;'),
489 489
 			'symbol'      => '&#80;',
490 490
 			'setting'     => array(
491 491
 				'currency_position'   => 'before',
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 			),
496 496
 		),
497 497
 		'BZD' => array(
498
-			'admin_label' => sprintf( __( 'Belizean dollar (%1$s)', 'give' ), '&#66;&#90;&#36;' ),
498
+			'admin_label' => sprintf(__('Belizean dollar (%1$s)', 'give'), '&#66;&#90;&#36;'),
499 499
 			'symbol'      => '&#66;&#90;&#36;',
500 500
 			'setting'     => array(
501 501
 				'currency_position'   => 'before',
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 			),
506 506
 		),
507 507
 		'CLP' => array(
508
-			'admin_label' => sprintf( __( 'Chilean peso (%1$s)', 'give' ), '&#36;' ),
508
+			'admin_label' => sprintf(__('Chilean peso (%1$s)', 'give'), '&#36;'),
509 509
 			'symbol'      => '&#36;',
510 510
 			'setting'     => array(
511 511
 				'currency_position'   => 'before',
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 			),
516 516
 		),
517 517
 		'CNY' => array(
518
-			'admin_label' => sprintf( __( 'Chinese yuan (%1$s)', 'give' ), '&yen;' ),
518
+			'admin_label' => sprintf(__('Chinese yuan (%1$s)', 'give'), '&yen;'),
519 519
 			'symbol'      => '&yen;',
520 520
 			'setting'     => array(
521 521
 				'currency_position'   => 'before',
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 			),
526 526
 		),
527 527
 		'COP' => array(
528
-			'admin_label' => sprintf( __( 'Colombian peso (%1$s)', 'give' ), '&#36;' ),
528
+			'admin_label' => sprintf(__('Colombian peso (%1$s)', 'give'), '&#36;'),
529 529
 			'symbol'      => '&#36;',
530 530
 			'setting'     => array(
531 531
 				'currency_position'   => 'before',
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 			),
536 536
 		),
537 537
 		'CRC' => array(
538
-			'admin_label' => sprintf( __( 'Costa Rican colón (%1$s)', 'give' ), '&#8353;' ),
538
+			'admin_label' => sprintf(__('Costa Rican colón (%1$s)', 'give'), '&#8353;'),
539 539
 			'symbol'      => '&#8353;',
540 540
 			'setting'     => array(
541 541
 				'currency_position'   => 'before',
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 			),
546 546
 		),
547 547
 		'CUC' => array(
548
-			'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '&#8369;' ),
548
+			'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '&#8369;'),
549 549
 			'symbol'      => '&#8369;',
550 550
 			'setting'     => array(
551 551
 				'currency_position'   => 'before',
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			),
556 556
 		),
557 557
 		'CUP' => array(
558
-			'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '&#8369;' ),
558
+			'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '&#8369;'),
559 559
 			'symbol'      => '&#8369;',
560 560
 			'setting'     => array(
561 561
 				'currency_position'   => 'before',
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			),
566 566
 		),
567 567
 		'DOP' => array(
568
-			'admin_label' => sprintf( __( 'Dominican peso (%1$s)', 'give' ), '&#82;&#68;&#36;' ),
568
+			'admin_label' => sprintf(__('Dominican peso (%1$s)', 'give'), '&#82;&#68;&#36;'),
569 569
 			'symbol'      => '&#82;&#68;&#36;',
570 570
 			'setting'     => array(
571 571
 				'currency_position'   => 'before',
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 			),
576 576
 		),
577 577
 		'EGP' => array(
578
-			'admin_label' => sprintf( __( 'Egyptian pound (%1$s)', 'give' ), '&#69;&pound;' ),
578
+			'admin_label' => sprintf(__('Egyptian pound (%1$s)', 'give'), '&#69;&pound;'),
579 579
 			'symbol'      => '&#69;&pound;',
580 580
 			'setting'     => array(
581 581
 				'currency_position'   => 'before',
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 			),
586 586
 		),
587 587
 		'GIP' => array(
588
-			'admin_label' => sprintf( __( 'Gibraltar pound (%1$s)', 'give' ), '&pound;' ),
588
+			'admin_label' => sprintf(__('Gibraltar pound (%1$s)', 'give'), '&pound;'),
589 589
 			'symbol'      => '&pound;',
590 590
 			'setting'     => array(
591 591
 				'currency_position'   => 'before',
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 			),
596 596
 		),
597 597
 		'GTQ' => array(
598
-			'admin_label' => sprintf( __( 'Guatemalan quetzal (%1$s)', 'give' ), '&#81;' ),
598
+			'admin_label' => sprintf(__('Guatemalan quetzal (%1$s)', 'give'), '&#81;'),
599 599
 			'symbol'      => '&#81;',
600 600
 			'setting'     => array(
601 601
 				'currency_position'   => 'before',
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 			),
606 606
 		),
607 607
 		'HNL' => array(
608
-			'admin_label' => sprintf( __( 'Honduran lempira (%1$s)', 'give' ), '&#76;' ),
608
+			'admin_label' => sprintf(__('Honduran lempira (%1$s)', 'give'), '&#76;'),
609 609
 			'symbol'      => '&#76;',
610 610
 			'setting'     => array(
611 611
 				'currency_position'   => 'before',
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 			),
616 616
 		),
617 617
 		'HRK' => array(
618
-			'admin_label' => sprintf( __( 'Croatian kuna (%1$s)', 'give' ), '&#107;&#110;' ),
618
+			'admin_label' => sprintf(__('Croatian kuna (%1$s)', 'give'), '&#107;&#110;'),
619 619
 			'symbol'      => '&#107;&#110;',
620 620
 			'setting'     => array(
621 621
 				'currency_position'   => 'after',
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 			),
626 626
 		),
627 627
 		'IDR' => array(
628
-			'admin_label' => sprintf( __( 'Indonesian rupiah (%1$s)', 'give' ), '&#82;&#112;' ),
628
+			'admin_label' => sprintf(__('Indonesian rupiah (%1$s)', 'give'), '&#82;&#112;'),
629 629
 			'symbol'      => '&#82;&#112;',
630 630
 			'setting'     => array(
631 631
 				'currency_position'   => 'before',
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 			),
636 636
 		),
637 637
 		'ISK' => array(
638
-			'admin_label' => sprintf( __( 'Icelandic króna (%1$s)', 'give' ), '&#107;&#114;' ),
638
+			'admin_label' => sprintf(__('Icelandic króna (%1$s)', 'give'), '&#107;&#114;'),
639 639
 			'symbol'      => '&#107;&#114;',
640 640
 			'setting'     => array(
641 641
 				'currency_position'   => 'after',
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 			),
646 646
 		),
647 647
 		'JMD' => array(
648
-			'admin_label' => sprintf( __( 'Jamaican dollar (%1$s)', 'give' ), '&#106;&#36;' ),
648
+			'admin_label' => sprintf(__('Jamaican dollar (%1$s)', 'give'), '&#106;&#36;'),
649 649
 			'symbol'      => '&#106;&#36;',
650 650
 			'setting'     => array(
651 651
 				'currency_position'   => 'before',
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 			),
656 656
 		),
657 657
 		'JOD' => array(
658
-			'admin_label' => sprintf( __( 'Jordanian dinar (%1$s)', 'give' ), '&#x62f;.&#x627;' ),
658
+			'admin_label' => sprintf(__('Jordanian dinar (%1$s)', 'give'), '&#x62f;.&#x627;'),
659 659
 			'symbol'      => '&#x62f;.&#x627;',
660 660
 			'setting'     => array(
661 661
 				'currency_position'   => 'before',
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 			),
666 666
 		),
667 667
 		'KES' => array(
668
-			'admin_label' => sprintf( __( 'Kenyan shilling (%1$s)', 'give' ), '&#75;&#83;&#104;' ),
668
+			'admin_label' => sprintf(__('Kenyan shilling (%1$s)', 'give'), '&#75;&#83;&#104;'),
669 669
 			'symbol'      => '&#75;&#83;&#104;',
670 670
 			'setting'     => array(
671 671
 				'currency_position'   => 'before',
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			),
676 676
 		),
677 677
 		'KWD' => array(
678
-			'admin_label' => sprintf( __( 'Kuwaiti dinar (%1$s)', 'give' ), '&#x62f;.&#x643;' ),
678
+			'admin_label' => sprintf(__('Kuwaiti dinar (%1$s)', 'give'), '&#x62f;.&#x643;'),
679 679
 			'symbol'      => '&#x62f;.&#x643;',
680 680
 			'setting'     => array(
681 681
 				'currency_position'   => 'before',
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 			),
686 686
 		),
687 687
 		'KYD' => array(
688
-			'admin_label' => sprintf( __( 'Cayman Islands dollar (%1$s)', 'give' ), '&#75;&#89;&#36;' ),
688
+			'admin_label' => sprintf(__('Cayman Islands dollar (%1$s)', 'give'), '&#75;&#89;&#36;'),
689 689
 			'symbol'      => '&#75;&#89;&#36;',
690 690
 			'setting'     => array(
691 691
 				'currency_position'   => 'before',
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 			),
696 696
 		),
697 697
 		'MKD' => array(
698
-			'admin_label' => sprintf( __( 'Macedonian denar (%1$s)', 'give' ), '&#x434;&#x435;&#x43d;' ),
698
+			'admin_label' => sprintf(__('Macedonian denar (%1$s)', 'give'), '&#x434;&#x435;&#x43d;'),
699 699
 			'symbol'      => '&#x434;&#x435;&#x43d;',
700 700
 			'setting'     => array(
701 701
 				'currency_position'   => 'before',
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 			),
706 706
 		),
707 707
 		'NPR' => array(
708
-			'admin_label' => sprintf( __( 'Nepalese rupee (%1$s)', 'give' ), '&#8360;' ),
708
+			'admin_label' => sprintf(__('Nepalese rupee (%1$s)', 'give'), '&#8360;'),
709 709
 			'symbol'      => '&#8360;',
710 710
 			'setting'     => array(
711 711
 				'currency_position'   => 'before',
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 			),
716 716
 		),
717 717
 		'OMR' => array(
718
-			'admin_label' => sprintf( __( 'Omani rial (%1$s)', 'give' ), '&#x631;.&#x639;&#46;' ),
718
+			'admin_label' => sprintf(__('Omani rial (%1$s)', 'give'), '&#x631;.&#x639;&#46;'),
719 719
 			'symbol'      => '&#x631;.&#x639;&#46;',
720 720
 			'setting'     => array(
721 721
 				'currency_position'   => 'before',
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			),
726 726
 		),
727 727
 		'PEN' => array(
728
-			'admin_label' => sprintf( __( 'Peruvian nuevo sol (%1$s)', 'give' ), 'S/.' ),
728
+			'admin_label' => sprintf(__('Peruvian nuevo sol (%1$s)', 'give'), 'S/.'),
729 729
 			'symbol'      => 'S/.',
730 730
 			'setting'     => array(
731 731
 				'currency_position'   => 'before',
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 			),
736 736
 		),
737 737
 		'PKR' => array(
738
-			'admin_label' => sprintf( __( 'Pakistani rupee (%1$s)', 'give' ), '&#8360;' ),
738
+			'admin_label' => sprintf(__('Pakistani rupee (%1$s)', 'give'), '&#8360;'),
739 739
 			'symbol'      => '&#8360;',
740 740
 			'setting'     => array(
741 741
 				'currency_position'   => 'before',
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			),
746 746
 		),
747 747
 		'RON' => array(
748
-			'admin_label' => sprintf( __( 'Romanian leu (%1$s)', 'give' ), '&#76;' ),
748
+			'admin_label' => sprintf(__('Romanian leu (%1$s)', 'give'), '&#76;'),
749 749
 			'symbol'      => '&#76;',
750 750
 			'setting'     => array(
751 751
 				'currency_position'   => 'after',
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			),
756 756
 		),
757 757
 		'SAR' => array(
758
-			'admin_label' => sprintf( __( 'Saudi riyal (%1$s)', 'give' ), '&#x631;.&#x633;' ),
758
+			'admin_label' => sprintf(__('Saudi riyal (%1$s)', 'give'), '&#x631;.&#x633;'),
759 759
 			'symbol'      => '&#x631;.&#x633;',
760 760
 			'setting'     => array(
761 761
 				'currency_position'   => 'before',
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			),
766 766
 		),
767 767
 		'SZL' => array(
768
-			'admin_label' => sprintf( __( 'Swazi lilangeni (%1$s)', 'give' ), '&#76;'),
768
+			'admin_label' => sprintf(__('Swazi lilangeni (%1$s)', 'give'), '&#76;'),
769 769
 			'symbol'      => '&#76;',
770 770
 			'setting'     => array(
771 771
 				'currency_position'   => 'before',
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 			),
776 776
 		),
777 777
 		'TOP' => array(
778
-			'admin_label' => sprintf( __( 'Tongan paʻanga (%1$s)', 'give' ), '&#84;&#36;'),
778
+			'admin_label' => sprintf(__('Tongan paʻanga (%1$s)', 'give'), '&#84;&#36;'),
779 779
 			'symbol'      => '&#84;&#36;',
780 780
 			'setting'     => array(
781 781
 				'currency_position'   => 'before',
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			),
786 786
 		),
787 787
 		'TZS' => array(
788
-			'admin_label' => sprintf( __( 'Tanzanian shilling (%1$s)', 'give' ), '&#84;&#83;&#104;'),
788
+			'admin_label' => sprintf(__('Tanzanian shilling (%1$s)', 'give'), '&#84;&#83;&#104;'),
789 789
 			'symbol'      => '&#84;&#83;&#104;',
790 790
 			'setting'     => array(
791 791
 				'currency_position'   => 'before',
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 			),
796 796
 		),
797 797
 		'UAH' => array(
798
-			'admin_label' => sprintf( __( 'Ukrainian hryvnia (%1$s)', 'give' ), '&#8372;'),
798
+			'admin_label' => sprintf(__('Ukrainian hryvnia (%1$s)', 'give'), '&#8372;'),
799 799
 			'symbol'      => '&#8372;',
800 800
 			'setting'     => array(
801 801
 				'currency_position'   => 'before',
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 			),
806 806
 		),
807 807
 		'UYU' => array(
808
-			'admin_label' => sprintf( __( 'Uruguayan peso (%1$s)', 'give' ), '&#36;&#85;'),
808
+			'admin_label' => sprintf(__('Uruguayan peso (%1$s)', 'give'), '&#36;&#85;'),
809 809
 			'symbol'      => '&#36;&#85;',
810 810
 			'setting'     => array(
811 811
 				'currency_position'   => 'before',
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 			),
816 816
 		),
817 817
 		'VEF' => array(
818
-			'admin_label' => sprintf( __( 'Venezuelan bolívar (%1$s)', 'give' ), '&#66;&#115;'),
818
+			'admin_label' => sprintf(__('Venezuelan bolívar (%1$s)', 'give'), '&#66;&#115;'),
819 819
 			'symbol'      => '&#66;&#115;',
820 820
 			'setting'     => array(
821 821
 				'currency_position'   => 'before',
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 			),
826 826
 		),
827 827
 		'XCD' => array(
828
-			'admin_label' => sprintf( __( 'East Caribbean dollar (%1$s)', 'give' ), '&#69;&#67;&#36;'),
828
+			'admin_label' => sprintf(__('East Caribbean dollar (%1$s)', 'give'), '&#69;&#67;&#36;'),
829 829
 			'symbol'      => '&#69;&#67;&#36;',
830 830
 			'setting'     => array(
831 831
 				'currency_position'   => 'before',
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 *
851 851
 	 * @param array $currencies
852 852
 	 */
853
-	return (array) apply_filters( 'give_currencies', $currencies );
853
+	return (array) apply_filters('give_currencies', $currencies);
854 854
 }
855 855
 
856 856
 /**
@@ -862,22 +862,22 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return array $currencies A list of the available currencies
864 864
  */
865
-function give_get_currencies( $info = 'admin_label' ) {
865
+function give_get_currencies($info = 'admin_label') {
866 866
 
867 867
 	$currencies = give_get_currencies_list();
868 868
 
869 869
 	// Backward compatibility: handle old way of currency registration.
870 870
 	// Backward compatibility: Return desired result.
871
-	if ( ! empty( $currencies ) ) {
872
-		foreach ( $currencies as $currency_code => $currency_setting ) {
873
-			if ( is_string( $currency_setting ) ) {
874
-				$currencies[ $currency_code ] = array(
871
+	if ( ! empty($currencies)) {
872
+		foreach ($currencies as $currency_code => $currency_setting) {
873
+			if (is_string($currency_setting)) {
874
+				$currencies[$currency_code] = array(
875 875
 					'admin_label' => $currency_setting,
876 876
 				);
877 877
 			}
878 878
 
879
-			$currencies[ $currency_code ] = wp_parse_args(
880
-				$currencies[ $currency_code ],
879
+			$currencies[$currency_code] = wp_parse_args(
880
+				$currencies[$currency_code],
881 881
 				array(
882 882
 					'admin_label' => '',
883 883
 					'symbol'      => $currency_code,
@@ -886,8 +886,8 @@  discard block
 block discarded – undo
886 886
 			);
887 887
 		}
888 888
 
889
-		if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) {
890
-			$currencies = wp_list_pluck( $currencies, $info );
889
+		if ( ! empty($info) && is_string($info) && 'all' !== $info) {
890
+			$currencies = wp_list_pluck($currencies, $info);
891 891
 		}
892 892
 	}
893 893
 
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @return array
906 906
  */
907
-function give_currency_symbols( $decode_currencies = false ) {
908
-	$currencies = give_get_currencies( 'symbol' );
907
+function give_currency_symbols($decode_currencies = false) {
908
+	$currencies = give_get_currencies('symbol');
909 909
 
910
-	if ( $decode_currencies ) {
911
-		array_walk( $currencies, function ( &$currency_symbol ) {
912
-			$currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' );
910
+	if ($decode_currencies) {
911
+		array_walk($currencies, function(&$currency_symbol) {
912
+			$currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8');
913 913
 		} );
914 914
 	}
915 915
 
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	 *
921 921
 	 * @param array $currencies
922 922
 	 */
923
-	return apply_filters( 'give_currency_symbols', $currencies );
923
+	return apply_filters('give_currency_symbols', $currencies);
924 924
 }
925 925
 
926 926
 
@@ -937,14 +937,14 @@  discard block
 block discarded – undo
937 937
  *
938 938
  * @return string           The symbol to use for the currency
939 939
  */
940
-function give_currency_symbol( $currency = '', $decode_currency = false ) {
940
+function give_currency_symbol($currency = '', $decode_currency = false) {
941 941
 
942
-	if ( empty( $currency ) ) {
942
+	if (empty($currency)) {
943 943
 		$currency = give_get_currency();
944 944
 	}
945 945
 
946
-	$currencies = give_currency_symbols( $decode_currency );
947
-	$symbol     = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency;
946
+	$currencies = give_currency_symbols($decode_currency);
947
+	$symbol     = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency;
948 948
 
949 949
 	/**
950 950
 	 * Filter the currency symbol
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 * @param string $symbol
955 955
 	 * @param string $currency
956 956
 	 */
957
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
957
+	return apply_filters('give_currency_symbol', $symbol, $currency);
958 958
 }
959 959
 
960 960
 
@@ -967,13 +967,13 @@  discard block
 block discarded – undo
967 967
  *
968 968
  * @return string
969 969
  */
970
-function give_get_currency_name( $currency_code ) {
970
+function give_get_currency_name($currency_code) {
971 971
 	$currency_name  = '';
972 972
 	$currency_names = give_get_currencies();
973 973
 
974
-	if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) {
975
-		$currency_name = explode( '(', $currency_names[ $currency_code ] );
976
-		$currency_name = trim( current( $currency_name ) );
974
+	if ($currency_code && array_key_exists($currency_code, $currency_names)) {
975
+		$currency_name = explode('(', $currency_names[$currency_code]);
976
+		$currency_name = trim(current($currency_name));
977 977
 	}
978 978
 
979 979
 	/**
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @param string $currency_name
985 985
 	 * @param string $currency_code
986 986
 	 */
987
-	return apply_filters( 'give_currency_name', $currency_name, $currency_code );
987
+	return apply_filters('give_currency_name', $currency_name, $currency_code);
988 988
 }
989 989
 
990 990
 /**
@@ -997,20 +997,20 @@  discard block
 block discarded – undo
997 997
  *
998 998
  * @return mixed|string
999 999
  */
1000
-function give_currency_filter( $price = '', $args = array() ) {
1000
+function give_currency_filter($price = '', $args = array()) {
1001 1001
 
1002 1002
 	// Get functions arguments.
1003 1003
 	$func_args = func_get_args();
1004 1004
 
1005 1005
 	// Backward compatibility: modify second param to array
1006
-	if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) {
1006
+	if (isset($func_args[1]) && is_string($func_args[1])) {
1007 1007
 		$args = array(
1008
-			'currency_code'   => isset( $func_args[1] ) ? $func_args[1] : '',
1009
-			'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false,
1010
-			'form_id'         => isset( $func_args[3] ) ? $func_args[3] : '',
1008
+			'currency_code'   => isset($func_args[1]) ? $func_args[1] : '',
1009
+			'decode_currency' => isset($func_args[2]) ? $func_args[2] : false,
1010
+			'form_id'         => isset($func_args[3]) ? $func_args[3] : '',
1011 1011
 		);
1012 1012
 
1013
-		give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION );
1013
+		give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION);
1014 1014
 	}
1015 1015
 
1016 1016
 	// Set default values.
@@ -1023,22 +1023,22 @@  discard block
 block discarded – undo
1023 1023
 		)
1024 1024
 	);
1025 1025
 
1026
-	if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) {
1027
-		$args['currency_code'] = give_get_currency( $args['form_id'] );
1026
+	if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) {
1027
+		$args['currency_code'] = give_get_currency($args['form_id']);
1028 1028
 	}
1029 1029
 
1030
-	$args['position'] = give_get_option( 'currency_position', 'before' );
1030
+	$args['position'] = give_get_option('currency_position', 'before');
1031 1031
 
1032 1032
 	$negative = $price < 0;
1033 1033
 
1034
-	if ( $negative ) {
1034
+	if ($negative) {
1035 1035
 		// Remove proceeding "-".
1036
-		$price = substr( $price, 1 );
1036
+		$price = substr($price, 1);
1037 1037
 	}
1038 1038
 
1039
-	$args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] );
1039
+	$args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']);
1040 1040
 
1041
-	switch ( $args['currency_code'] ) :
1041
+	switch ($args['currency_code']) :
1042 1042
 		case 'GBP' :
1043 1043
 		case 'BRL' :
1044 1044
 		case 'EUR' :
@@ -1068,13 +1068,13 @@  discard block
 block discarded – undo
1068 1068
 		case 'MAD' :
1069 1069
 		case 'KRW' :
1070 1070
 		case 'ZAR' :
1071
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] );
1071
+			$formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']);
1072 1072
 			break;
1073 1073
 		case 'NOK':
1074
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] );
1074
+			$formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']);
1075 1075
 			break;
1076 1076
 		default:
1077
-			$formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] );
1077
+			$formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']);
1078 1078
 			break;
1079 1079
 	endswitch;
1080 1080
 
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 	 *
1084 1084
 	 * @since 1.8.17
1085 1085
 	 */
1086
-	$formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price );
1086
+	$formatted = apply_filters('give_currency_filter', $formatted, $args, $price);
1087 1087
 
1088 1088
 	/**
1089 1089
 	 * Filter formatted amount with currency
@@ -1097,16 +1097,16 @@  discard block
 block discarded – undo
1097 1097
 	 *           filter name will be give_usd_currency_filter_after
1098 1098
 	 */
1099 1099
 	$formatted = apply_filters(
1100
-		'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}",
1100
+		'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}",
1101 1101
 		$formatted,
1102 1102
 		$args['currency_code'],
1103 1103
 		$price,
1104 1104
 		$args
1105 1105
 	);
1106 1106
 
1107
-	if ( $negative ) {
1107
+	if ($negative) {
1108 1108
 		// Prepend the minus sign before the currency sign.
1109
-		$formatted = '-' . $formatted;
1109
+		$formatted = '-'.$formatted;
1110 1110
 	}
1111 1111
 
1112 1112
 	return $formatted;
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
  *
1124 1124
  * @return bool
1125 1125
  */
1126
-function give_is_zero_based_currency( $currency = '' ) {
1126
+function give_is_zero_based_currency($currency = '') {
1127 1127
 	$zero_based_currency = array(
1128 1128
 		'PYG', // Paraguayan Guarani.
1129 1129
 		'GNF', // Guinean Franc.
@@ -1143,12 +1143,12 @@  discard block
 block discarded – undo
1143 1143
 	);
1144 1144
 
1145 1145
 	// Set default currency.
1146
-	if ( empty( $currency ) ) {
1146
+	if (empty($currency)) {
1147 1147
 		$currency = give_get_currency();
1148 1148
 	}
1149 1149
 
1150 1150
 	// Check for Zero Based Currency.
1151
-	if ( in_array( $currency, $zero_based_currency ) ) {
1151
+	if (in_array($currency, $zero_based_currency)) {
1152 1152
 		return true;
1153 1153
 	}
1154 1154
 
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
  *
1164 1164
  * @return bool
1165 1165
  */
1166
-function give_is_right_to_left_supported_currency( $currency = '' ) {
1166
+function give_is_right_to_left_supported_currency($currency = '') {
1167 1167
 	$zero_based_currency = apply_filters(
1168 1168
 		'give_right_to_left_supported_currency',
1169 1169
 		array(
@@ -1179,12 +1179,12 @@  discard block
 block discarded – undo
1179 1179
 	);
1180 1180
 
1181 1181
 	// Set default currency.
1182
-	if ( empty( $currency ) ) {
1182
+	if (empty($currency)) {
1183 1183
 		$currency = give_get_currency();
1184 1184
 	}
1185 1185
 
1186 1186
 	// Check for Zero Based Currency.
1187
-	if ( in_array( $currency, $zero_based_currency ) ) {
1187
+	if (in_array($currency, $zero_based_currency)) {
1188 1188
 		return true;
1189 1189
 	}
1190 1190
 
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 2 patches
Spacing   +34 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -18,56 +18,55 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end"
23 23
 
24 24
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
25
-		<?php if ( ! empty( $db_updates ) ) : ?>
25
+		<?php if ( ! empty($db_updates)) : ?>
26 26
 			<?php
27 27
 			$is_doing_updates = $give_updates->is_doing_updates();
28
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
29
-			$resume_updates   = get_option( 'give_doing_upgrade' );
30
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
28
+			$db_update_url    = add_query_arg(array('type' => 'database',));
29
+			$resume_updates   = get_option('give_doing_upgrade');
30
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
31 31
 			?>
32 32
 			<div class="give-update-panel-content">
33
-				<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
33
+				<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
34 34
 			</div>
35 35
 
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43
-									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : '';  ?>>
43
+									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
44 44
 										<?php echo sprintf(
45
-										__( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ),
45
+										__('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'),
46 46
 										$is_doing_updates ?
47
-											__( 'Give is currently updating the database in the background.', 'give' ) :
48
-											__( 'Give needs to update the database.', 'give' ),
47
+											__('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'),
49 48
 										$db_update_url,
50
-										( $is_doing_updates ? 'give-hidden' : '' ),
51
-										__( 'Update now', 'give' )
49
+										($is_doing_updates ? 'give-hidden' : ''),
50
+										__('Update now', 'give')
52 51
 									);
53 52
 									?>
54 53
 									</span>
55
-									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process()  ? 'style="display:none;"' : '';  ?>>
56
-										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
57
-											&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
54
+									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
55
+										<?php if (get_option('give_upgrade_error')) : ?>
56
+											&nbsp;<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
58 57
 										<?php else : ?>
59
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
58
+											<?php _e('The updates have been paused.', 'give'); ?>
60 59
 
61 60
 										<?php endif; ?>
62 61
 									</span>
63 62
 
64
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
65
-										<?php  $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?>
66
-										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button>
67
-									<?php elseif( $give_updates->is_doing_updates() ): ?>
68
-										<?php  $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?>
69
-										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>>
70
-											<?php _e( 'Pause Upgrades', 'give' ); ?>
63
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
64
+										<?php  $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?>
65
+										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button>
66
+									<?php elseif ($give_updates->is_doing_updates()): ?>
67
+										<?php  $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?>
68
+										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>>
69
+											<?php _e('Pause Upgrades', 'give'); ?>
71 70
 										</button>
72 71
 									<?php endif; ?>
73 72
 								</p>
@@ -77,7 +76,7 @@  discard block
 block discarded – undo
77 76
 									<strong>
78 77
 										<?php
79 78
 										echo sprintf(
80
-											__( 'Update %s of %s', 'give' ),
79
+											__('Update %s of %s', 'give'),
81 80
 											$give_updates->get_running_db_update(),
82 81
 											$give_updates->get_total_new_db_update_count()
83 82
 										);
@@ -85,10 +84,10 @@  discard block
 block discarded – undo
85 84
 									</strong>
86 85
 								</p>
87 86
 								<div class="progress-content">
88
-									<?php if ( $is_doing_updates  ) : ?>
87
+									<?php if ($is_doing_updates) : ?>
89 88
 										<div class="notice-wrap give-clearfix">
90 89
 
91
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) :  ?>
90
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) :  ?>
92 91
 												<span class="spinner is-active"></span>
93 92
 											<?php endif; ?>
94 93
 
@@ -100,7 +99,7 @@  discard block
 block discarded – undo
100 99
 								</div>
101 100
 							</div>
102 101
 
103
-							<?php if ( ! $is_doing_updates ) : ?>
102
+							<?php if ( ! $is_doing_updates) : ?>
104 103
 								<div class="give-run-database-update"></div>
105 104
 							<?php endif; ?>
106 105
 						</div>
@@ -108,18 +107,18 @@  discard block
 block discarded – undo
108 107
 					</div><!-- .postbox -->
109 108
 				</div>
110 109
 			</div>
111
-			<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?>
110
+			<?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?>
112 111
 		<?php endif; ?>
113 112
 
114 113
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
115
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
116
-			<?php $plugin_update_url = add_query_arg( array(
114
+		<?php if ( ! empty($plugin_updates)) : ?>
115
+			<?php $plugin_update_url = add_query_arg(array(
117 116
 				'plugin_status' => 'give',
118
-			), admin_url( '/plugins.php' ) ); ?>
117
+			), admin_url('/plugins.php')); ?>
119 118
 			<div id="give-plugin-updates">
120 119
 				<div class="postbox-container">
121 120
 					<div class="postbox">
122
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
121
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
123 122
 						<div class="inside">
124 123
 							<div class="panel-content">
125 124
 								<p>
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,11 @@  discard block
 block discarded – undo
55 55
 									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process()  ? 'style="display:none;"' : '';  ?>>
56 56
 										<?php if ( get_option( 'give_upgrade_error' ) ) : ?>
57 57
 											&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
58
-										<?php else : ?>
59
-											<?php _e( 'The updates have been paused.', 'give' ); ?>
58
+										<?php else {
59
+	: ?>
60
+											<?php _e( 'The updates have been paused.', 'give' );
61
+}
62
+?>
60 63
 
61 64
 										<?php endif; ?>
62 65
 									</span>
@@ -108,7 +111,10 @@  discard block
 block discarded – undo
108 111
 					</div><!-- .postbox -->
109 112
 				</div>
110 113
 			</div>
111
-			<?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?>
114
+			<?php else {
115
+	: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';
116
+}
117
+?>
112 118
 		<?php endif; ?>
113 119
 
114 120
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
Please login to merge, or discard this patch.