Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/error-tracking.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
  *
66 66
  * @since 1.0
67 67
  * @uses  Give_Session::get()
68
- * @return mixed array if errors are present, false if none found
68
+ * @return string array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71 71
 	return Give()->session->get( 'give_errors' );
Please login to merge, or discard this patch.
includes/login-register.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
-    }
36
+	if ( empty( $logout_redirect ) ) {
37
+		$logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
38
+	}
39 39
 
40 40
 
41
-    // Add user_logout action to logout url.
42
-    $logout_redirect = add_query_arg(
43
-        array(
44
-            'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
47
-        ),
48
-        home_url('/')
49
-    );
41
+	// Add user_logout action to logout url.
42
+	$logout_redirect = add_query_arg(
43
+		array(
44
+			'give_action'       => 'user_logout',
45
+			'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
+			'give_logout_redirect' => urlencode( $logout_redirect )
47
+		),
48
+		home_url('/')
49
+	);
50 50
 
51 51
 	$give_login_redirect = $login_redirect;
52 52
 	$give_logout_redirect = $logout_redirect;
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
  * @return void
137 137
  */
138 138
 function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
139
+	if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
140 140
 
141
-        // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
141
+		// Prevent occurring of any custom action on wp_logout.
142
+		remove_all_actions( 'wp_logout' );
143 143
 
144
-        // Before logout give action.
145
-        do_action( 'give_before_user_logout' );
144
+		// Before logout give action.
145
+		do_action( 'give_before_user_logout' );
146 146
 
147
-        // Logout user.
148
-        wp_logout();
147
+		// Logout user.
148
+		wp_logout();
149 149
 
150
-        // After logout give action.
151
-        do_action( 'give_after_user_logout' );
150
+		// After logout give action.
151
+		do_action( 'give_after_user_logout' );
152 152
 
153
-        wp_redirect( $data['give_logout_redirect'] );
154
-        give_die();
155
-    }
153
+		wp_redirect( $data['give_logout_redirect'] );
154
+		give_die();
155
+	}
156 156
 }
157 157
 
158 158
 add_action( 'give_user_logout', 'give_process_user_logout' );
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return string Login form
28 28
  */
29
-function give_login_form( $login_redirect = '', $logout_redirect = '' ) {
30
-	global $give_login_redirect, $give_logout_redirect;;
29
+function give_login_form($login_redirect = '', $logout_redirect = '') {
30
+	global $give_login_redirect, $give_logout_redirect; ;
31 31
 
32
-	if ( empty( $login_redirect ) ) {
32
+	if (empty($login_redirect)) {
33 33
 		$login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url());
34 34
 	}
35 35
 
36
-    if ( empty( $logout_redirect ) ) {
37
-        $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() );
36
+    if (empty($logout_redirect)) {
37
+        $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url());
38 38
     }
39 39
 
40 40
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     $logout_redirect = add_query_arg(
43 43
         array(
44 44
             'give_action'       => 'user_logout',
45
-            'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ),
46
-            'give_logout_redirect' => urlencode( $logout_redirect )
45
+            'give_logout_nonce' => wp_create_nonce('give-logout-nonce'),
46
+            'give_logout_redirect' => urlencode($logout_redirect)
47 47
         ),
48 48
         home_url('/')
49 49
     );
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
 	ob_start();
55 55
 
56
-	give_get_template_part( 'shortcode', 'login' );
56
+	give_get_template_part('shortcode', 'login');
57 57
 
58
-	return apply_filters( 'give_login_form', ob_get_clean() );
58
+	return apply_filters('give_login_form', ob_get_clean());
59 59
 }
60 60
 
61 61
 /**
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @return string Register form
71 71
  */
72
-function give_register_form( $redirect = '' ) {
72
+function give_register_form($redirect = '') {
73 73
 	global $give_options, $give_register_redirect;
74 74
 
75
-	if ( empty( $redirect ) ) {
75
+	if (empty($redirect)) {
76 76
 		$redirect = give_get_current_page_url();
77 77
 	}
78 78
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 
81 81
 	ob_start();
82 82
 
83
-	if ( ! is_user_logged_in() ) {
84
-		give_get_template_part( 'shortcode', 'register' );
83
+	if ( ! is_user_logged_in()) {
84
+		give_get_template_part('shortcode', 'register');
85 85
 	}
86 86
 
87
-	return apply_filters( 'give_register_form', ob_get_clean() );
87
+	return apply_filters('give_register_form', ob_get_clean());
88 88
 }
89 89
 
90 90
 /**
@@ -96,34 +96,34 @@  discard block
 block discarded – undo
96 96
  *
97 97
  * @return void
98 98
  */
99
-function give_process_login_form( $data ) {
100
-	if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) {
101
-		$user_data = get_user_by( 'login', $data['give_user_login'] );
102
-		if ( ! $user_data ) {
103
-			$user_data = get_user_by( 'email', $data['give_user_login'] );
99
+function give_process_login_form($data) {
100
+	if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) {
101
+		$user_data = get_user_by('login', $data['give_user_login']);
102
+		if ( ! $user_data) {
103
+			$user_data = get_user_by('email', $data['give_user_login']);
104 104
 		}
105
-		if ( $user_data ) {
105
+		if ($user_data) {
106 106
 			$user_ID    = $user_data->ID;
107 107
 			$user_email = $user_data->user_email;
108
-			if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) {
109
-				give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] );
108
+			if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) {
109
+				give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']);
110 110
 			} else {
111
-				give_set_error( 'password_incorrect', __( 'The password you entered is incorrect.', 'give' ) );
111
+				give_set_error('password_incorrect', __('The password you entered is incorrect.', 'give'));
112 112
 			}
113 113
 		} else {
114
-			give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
114
+			give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
115 115
 		}
116 116
 		// Check for errors and redirect if none present
117 117
 		$errors = give_get_errors();
118
-		if ( ! $errors ) {
119
-			$redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID );
120
-			wp_redirect( $redirect );
118
+		if ( ! $errors) {
119
+			$redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID);
120
+			wp_redirect($redirect);
121 121
 			give_die();
122 122
 		}
123 123
 	}
124 124
 }
125 125
 
126
-add_action( 'give_user_login', 'give_process_login_form' );
126
+add_action('give_user_login', 'give_process_login_form');
127 127
 
128 128
 
129 129
 /**
@@ -135,27 +135,27 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return void
137 137
  */
138
-function give_process_user_logout( $data ) {
139
-    if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) {
138
+function give_process_user_logout($data) {
139
+    if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) {
140 140
 
141 141
         // Prevent occurring of any custom action on wp_logout.
142
-        remove_all_actions( 'wp_logout' );
142
+        remove_all_actions('wp_logout');
143 143
 
144 144
         // Before logout give action.
145
-        do_action( 'give_before_user_logout' );
145
+        do_action('give_before_user_logout');
146 146
 
147 147
         // Logout user.
148 148
         wp_logout();
149 149
 
150 150
         // After logout give action.
151
-        do_action( 'give_after_user_logout' );
151
+        do_action('give_after_user_logout');
152 152
 
153
-        wp_redirect( $data['give_logout_redirect'] );
153
+        wp_redirect($data['give_logout_redirect']);
154 154
         give_die();
155 155
     }
156 156
 }
157 157
 
158
-add_action( 'give_user_logout', 'give_process_user_logout' );
158
+add_action('give_user_logout', 'give_process_user_logout');
159 159
 
160 160
 /**
161 161
  * Log User In
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
  *
169 169
  * @return void
170 170
  */
171
-function give_log_user_in( $user_id, $user_login, $user_pass ) {
172
-	if ( $user_id < 1 ) {
171
+function give_log_user_in($user_id, $user_login, $user_pass) {
172
+	if ($user_id < 1) {
173 173
 		return;
174 174
 	}
175 175
 
176
-	wp_set_auth_cookie( $user_id );
177
-	wp_set_current_user( $user_id, $user_login );
178
-	do_action( 'wp_login', $user_login, get_userdata( $user_id ) );
179
-	do_action( 'give_log_user_in', $user_id, $user_login, $user_pass );
176
+	wp_set_auth_cookie($user_id);
177
+	wp_set_current_user($user_id, $user_login);
178
+	do_action('wp_login', $user_login, get_userdata($user_id));
179
+	do_action('give_log_user_in', $user_id, $user_login, $user_pass);
180 180
 }
181 181
 
182 182
 
@@ -189,70 +189,70 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return void
191 191
  */
192
-function give_process_register_form( $data ) {
192
+function give_process_register_form($data) {
193 193
 
194
-	if ( is_user_logged_in() ) {
194
+	if (is_user_logged_in()) {
195 195
 		return;
196 196
 	}
197 197
 
198
-	if ( empty( $_POST['give_register_submit'] ) ) {
198
+	if (empty($_POST['give_register_submit'])) {
199 199
 		return;
200 200
 	}
201 201
 
202
-	do_action( 'give_pre_process_register_form' );
202
+	do_action('give_pre_process_register_form');
203 203
 
204
-	if ( empty( $data['give_user_login'] ) ) {
205
-		give_set_error( 'empty_username', __( 'Invalid username.', 'give' ) );
204
+	if (empty($data['give_user_login'])) {
205
+		give_set_error('empty_username', __('Invalid username.', 'give'));
206 206
 	}
207 207
 
208
-	if ( username_exists( $data['give_user_login'] ) ) {
209
-		give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) );
208
+	if (username_exists($data['give_user_login'])) {
209
+		give_set_error('username_unavailable', __('Username already taken.', 'give'));
210 210
 	}
211 211
 
212
-	if ( ! validate_username( $data['give_user_login'] ) ) {
213
-		give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) );
212
+	if ( ! validate_username($data['give_user_login'])) {
213
+		give_set_error('username_invalid', __('Invalid username.', 'give'));
214 214
 	}
215 215
 
216
-	if ( email_exists( $data['give_user_email'] ) ) {
217
-		give_set_error( 'email_unavailable', __( 'Email address already taken.', 'give' ) );
216
+	if (email_exists($data['give_user_email'])) {
217
+		give_set_error('email_unavailable', __('Email address already taken.', 'give'));
218 218
 	}
219 219
 
220
-	if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) {
221
-		give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
220
+	if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) {
221
+		give_set_error('email_invalid', __('Invalid email.', 'give'));
222 222
 	}
223 223
 
224
-	if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) {
225
-		give_set_error( 'payment_email_invalid', __( 'Invalid payment email.', 'give' ) );
224
+	if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) {
225
+		give_set_error('payment_email_invalid', __('Invalid payment email.', 'give'));
226 226
 	}
227 227
 
228
-	if ( empty( $_POST['give_user_pass'] ) ) {
229
-		give_set_error( 'empty_password', __( 'Please enter a password.', 'give' ) );
228
+	if (empty($_POST['give_user_pass'])) {
229
+		give_set_error('empty_password', __('Please enter a password.', 'give'));
230 230
 	}
231 231
 
232
-	if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) {
233
-		give_set_error( 'password_mismatch', __( 'Passwords don\'t match.', 'give' ) );
232
+	if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) {
233
+		give_set_error('password_mismatch', __('Passwords don\'t match.', 'give'));
234 234
 	}
235 235
 
236
-	do_action( 'give_process_register_form' );
236
+	do_action('give_process_register_form');
237 237
 
238 238
 	// Check for errors and redirect if none present
239 239
 	$errors = give_get_errors();
240 240
 
241
-	if ( empty( $errors ) ) {
241
+	if (empty($errors)) {
242 242
 
243
-		$redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] );
243
+		$redirect = apply_filters('give_register_redirect', $data['give_redirect']);
244 244
 
245
-		give_register_and_login_new_user( array(
245
+		give_register_and_login_new_user(array(
246 246
 			'user_login'      => $data['give_user_login'],
247 247
 			'user_pass'       => $data['give_user_pass'],
248 248
 			'user_email'      => $data['give_user_email'],
249
-			'user_registered' => date( 'Y-m-d H:i:s' ),
250
-			'role'            => get_option( 'default_role' )
251
-		) );
249
+			'user_registered' => date('Y-m-d H:i:s'),
250
+			'role'            => get_option('default_role')
251
+		));
252 252
 
253
-		wp_redirect( $redirect );
253
+		wp_redirect($redirect);
254 254
 		give_die();
255 255
 	}
256 256
 }
257 257
 
258
-add_action( 'give_user_register', 'give_process_register_form' );
259 258
\ No newline at end of file
259
+add_action('give_user_register', 'give_process_register_form');
260 260
\ No newline at end of file
Please login to merge, or discard this patch.
includes/api/class-give-api.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 	 * Determines whether results should be displayed in XML or JSON
1438 1438
 	 *
1439 1439
 	 * @since 1.1
1440
-     * @access public
1440
+	 * @access public
1441 1441
 	 *
1442 1442
 	 * @return mixed|void
1443 1443
 	 */
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 	 *
1456 1456
 	 * @access private
1457 1457
 	 * @since  1.1
1458
-     *
1458
+	 *
1459 1459
 	 * @global Give_Logging $give_logs
1460 1460
 	 * @global WP_Query     $wp_query
1461 1461
 	 *
@@ -1468,15 +1468,15 @@  discard block
 block discarded – undo
1468 1468
 			return;
1469 1469
 		}
1470 1470
 
1471
-        /**
1472
-         * @var Give_Logging $give_logs
1473
-         */
1471
+		/**
1472
+		 * @var Give_Logging $give_logs
1473
+		 */
1474 1474
 		global $give_logs;
1475 1475
 
1476
-        /**
1477
-         * @var WP_Query $wp_query
1478
-         */
1479
-        global $wp_query;
1476
+		/**
1477
+		 * @var WP_Query $wp_query
1478
+		 */
1479
+		global $wp_query;
1480 1480
 
1481 1481
 		$query = array(
1482 1482
 			'give-api'    => $wp_query->query_vars['give-api'],
@@ -1534,9 +1534,9 @@  discard block
 block discarded – undo
1534 1534
 	 * @param int $status_code
1535 1535
 	 */
1536 1536
 	public function output( $status_code = 200 ) {
1537
-        /**
1538
-         * @var WP_Query $wp_query
1539
-         */
1537
+		/**
1538
+		 * @var WP_Query $wp_query
1539
+		 */
1540 1540
 		global $wp_query;
1541 1541
 
1542 1542
 		$format = $this->get_output_format();
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-login.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,16 +42,16 @@
 block discarded – undo
42 42
 				'minWidth' => 320,
43 43
 				'tooltip'  => __( 'Enter an URL here to redirect to after login.', 'give' ),
44 44
 			),
45
-            array(
46
-                'type' => 'container',
47
-                'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ),
48
-            ),
49
-            array(
50
-                'type'     => 'textbox',
51
-                'name'     => 'logout-redirect',
52
-                'minWidth' => 320,
53
-                'tooltip'  => __( 'Enter an URL here to redirect to after logout.', 'give' ),
54
-            ),
45
+			array(
46
+				'type' => 'container',
47
+				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ),
48
+			),
49
+			array(
50
+				'type'     => 'textbox',
51
+				'name'     => 'logout-redirect',
52
+				'minWidth' => 320,
53
+				'tooltip'  => __( 'Enter an URL here to redirect to after logout.', 'give' ),
54
+			),
55 55
 		);
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Login extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Login', 'give' );
22
-		$this->shortcode['label'] = __( 'Login', 'give' );
21
+		$this->shortcode['title'] = __('Login', 'give');
22
+		$this->shortcode['label'] = __('Login', 'give');
23 23
 
24
-		parent::__construct( 'give_login' );
24
+		parent::__construct('give_login');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Login Redirect URL (optional):', 'give' ) ),
37
+				'html' => sprintf('<p class="no-margin">%s</p>', __('Login Redirect URL (optional):', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'     => 'textbox',
41 41
 				'name'     => 'login-redirect',
42 42
 				'minWidth' => 320,
43
-				'tooltip'  => __( 'Enter an URL here to redirect to after login.', 'give' ),
43
+				'tooltip'  => __('Enter an URL here to redirect to after login.', 'give'),
44 44
 			),
45 45
             array(
46 46
                 'type' => 'container',
47
-                'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ),
47
+                'html' => sprintf('<p class="no-margin">%s</p>', __('Logout Redirect URL (optional):', 'give')),
48 48
             ),
49 49
             array(
50 50
                 'type'     => 'textbox',
51 51
                 'name'     => 'logout-redirect',
52 52
                 'minWidth' => 320,
53
-                'tooltip'  => __( 'Enter an URL here to redirect to after logout.', 'give' ),
53
+                'tooltip'  => __('Enter an URL here to redirect to after logout.', 'give'),
54 54
             ),
55 55
 		);
56 56
 	}
Please login to merge, or discard this patch.
includes/shortcodes.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 		//validate display_style and float_labels value
93 93
 		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
94
+			 || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
95 95
 		) {
96 96
 
97 97
 			$atts[ $key ] = '';
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
  */
170 170
 function give_login_form_shortcode( $atts, $content = null ) {
171 171
 	$atts = shortcode_atts( array(
172
-        // Add backward compatibility for redirect attribute.
173
-        'redirect'          => '',
172
+		// Add backward compatibility for redirect attribute.
173
+		'redirect'          => '',
174 174
 
175 175
 		'login-redirect'    => '',
176 176
 		'logout-redirect'   => '',
177 177
 	), $atts, 'give_login' );
178 178
 
179
-    // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
-    $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
179
+	// Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
+	$atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
181 181
 
182 182
 	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
183 183
 }
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,28 +25,28 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_donation_history() {
27 27
 
28
-	$email_access = give_get_option( 'email_access' );
28
+	$email_access = give_get_option('email_access');
29 29
 
30 30
 	//Is user logged in? Does a session exist? Does an email-access token exist?
31
-	if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) {
31
+	if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) {
32 32
 		ob_start();
33
-		give_get_template_part( 'history', 'donations' );
33
+		give_get_template_part('history', 'donations');
34 34
 
35 35
 		return ob_get_clean();
36 36
 	} //Is Email-based access enabled?
37
-	elseif ( $email_access == 'on' ) {
37
+	elseif ($email_access == 'on') {
38 38
 
39 39
 		ob_start();
40
-		give_get_template_part( 'email', 'login-form' );
40
+		give_get_template_part('email', 'login-form');
41 41
 
42 42
 		return ob_get_clean();
43 43
 	} else {
44
-		$message = __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' );
45
-		echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message );
44
+		$message = __('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give');
45
+		echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message);
46 46
 	}
47 47
 }
48 48
 
49
-add_shortcode( 'donation_history', 'give_donation_history' );
49
+add_shortcode('donation_history', 'give_donation_history');
50 50
 
51 51
 /**
52 52
  * Donation Form Shortcode
@@ -60,53 +60,53 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string
62 62
  */
63
-function give_form_shortcode( $atts, $content = null ) {
64
-	$atts = shortcode_atts( array(
63
+function give_form_shortcode($atts, $content = null) {
64
+	$atts = shortcode_atts(array(
65 65
 		'id'            => '',
66 66
 		'show_title'    => true,
67 67
 		'show_goal'     => true,
68 68
 		'show_content'  => '',
69 69
 		'float_labels'  => '',
70 70
 		'display_style' => '',
71
-	), $atts, 'give_form' );
71
+	), $atts, 'give_form');
72 72
 
73
-	foreach ( $atts as $key => $value ) {
73
+	foreach ($atts as $key => $value) {
74 74
 		//convert shortcode_atts values to booleans
75
-		if ( $key == 'show_title' ) {
76
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
77
-		} elseif ( $key == 'show_goal' ) {
78
-			$atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN );
75
+		if ($key == 'show_title') {
76
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
77
+		} elseif ($key == 'show_goal') {
78
+			$atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN);
79 79
 		}
80 80
 
81 81
 		//validate show_content value
82
-		if ( $key == 'show_content' ) {
83
-			if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) {
84
-				$atts[ $key ] = '';
85
-			} else if ( $value == 'above' ) {
86
-				$atts[ $key ] = 'give_pre_form';
87
-			} else if ( $value == 'below' ) {
88
-				$atts[ $key ] = 'give_post_form';
82
+		if ($key == 'show_content') {
83
+			if ( ! in_array($value, array('none', 'above', 'below'))) {
84
+				$atts[$key] = '';
85
+			} else if ($value == 'above') {
86
+				$atts[$key] = 'give_pre_form';
87
+			} else if ($value == 'below') {
88
+				$atts[$key] = 'give_post_form';
89 89
 			}
90 90
 		}
91 91
 
92 92
 		//validate display_style and float_labels value
93
-		if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) )
94
-		     || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) )
93
+		if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal')))
94
+		     || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled')))
95 95
 		) {
96 96
 
97
-			$atts[ $key ] = '';
97
+			$atts[$key] = '';
98 98
 		}
99 99
 	}
100 100
 
101 101
 	//get the Give Form
102 102
 	ob_start();
103
-	give_get_donation_form( $atts );
103
+	give_get_donation_form($atts);
104 104
 	$final_output = ob_get_clean();
105 105
 
106
-	return apply_filters( 'give_donate_form', $final_output, $atts );
106
+	return apply_filters('give_donate_form', $final_output, $atts);
107 107
 }
108 108
 
109
-add_shortcode( 'give_form', 'give_form_shortcode' );
109
+add_shortcode('give_form', 'give_form_shortcode');
110 110
 
111 111
 /**
112 112
  * Donation Form Goal Shortcode
@@ -120,37 +120,37 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string
122 122
  */
123
-function give_goal_shortcode( $atts, $content = null ) {
124
-	$atts = shortcode_atts( array(
123
+function give_goal_shortcode($atts, $content = null) {
124
+	$atts = shortcode_atts(array(
125 125
 		'id'        => '',
126 126
 		'show_text' => true,
127 127
 		'show_bar'  => true,
128
-	), $atts, 'give_goal' );
128
+	), $atts, 'give_goal');
129 129
 
130 130
 
131 131
 	//get the Give Form
132 132
 	ob_start();
133 133
 
134 134
 	//Sanity check 1: ensure there is an ID Provided
135
-	if ( empty( $atts['id'] ) ) {
136
-		give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true );
135
+	if (empty($atts['id'])) {
136
+		give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true);
137 137
 	}
138 138
 
139 139
 	//Sanity check 2: Check that this form even has Goals enabled
140
-	$goal_option = get_post_meta( $atts['id'], '_give_goal_option', true );
141
-	if ( empty( $goal_option ) || $goal_option !== 'yes' ) {
142
-		give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true );
140
+	$goal_option = get_post_meta($atts['id'], '_give_goal_option', true);
141
+	if (empty($goal_option) || $goal_option !== 'yes') {
142
+		give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true);
143 143
 	} else {
144 144
 		//Passed all sanity checks: output Goal
145
-		give_show_goal_progress( $atts['id'], $atts );
145
+		give_show_goal_progress($atts['id'], $atts);
146 146
 	}
147 147
 
148 148
 	$final_output = ob_get_clean();
149 149
 
150
-	return apply_filters( 'give_goal_shortcode_output', $final_output, $atts );
150
+	return apply_filters('give_goal_shortcode_output', $final_output, $atts);
151 151
 }
152 152
 
153
-add_shortcode( 'give_goal', 'give_goal_shortcode' );
153
+add_shortcode('give_goal', 'give_goal_shortcode');
154 154
 
155 155
 
156 156
 /**
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
  * @uses  give_login_form()
168 168
  * @return string
169 169
  */
170
-function give_login_form_shortcode( $atts, $content = null ) {
171
-	$atts = shortcode_atts( array(
170
+function give_login_form_shortcode($atts, $content = null) {
171
+	$atts = shortcode_atts(array(
172 172
         // Add backward compatibility for redirect attribute.
173 173
         'redirect'          => '',
174 174
 
175 175
 		'login-redirect'    => '',
176 176
 		'logout-redirect'   => '',
177
-	), $atts, 'give_login' );
177
+	), $atts, 'give_login');
178 178
 
179 179
     // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute.
180
-    $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' );
180
+    $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : '');
181 181
 
182
-	return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] );
182
+	return give_login_form($atts['login-redirect'], $atts['logout-redirect']);
183 183
 }
184 184
 
185
-add_shortcode( 'give_login', 'give_login_form_shortcode' );
185
+add_shortcode('give_login', 'give_login_form_shortcode');
186 186
 
187 187
 /**
188 188
  * Register Shortcode
@@ -197,15 +197,15 @@  discard block
 block discarded – undo
197 197
  * @uses  give_register_form()
198 198
  * @return string
199 199
  */
200
-function give_register_form_shortcode( $atts, $content = null ) {
201
-	$atts = shortcode_atts( array(
200
+function give_register_form_shortcode($atts, $content = null) {
201
+	$atts = shortcode_atts(array(
202 202
 		'redirect' => '',
203
-	), $atts, 'give_register' );
203
+	), $atts, 'give_register');
204 204
 
205
-	return give_register_form( $atts['redirect'] );
205
+	return give_register_form($atts['redirect']);
206 206
 }
207 207
 
208
-add_shortcode( 'give_register', 'give_register_form_shortcode' );
208
+add_shortcode('give_register', 'give_register_form_shortcode');
209 209
 
210 210
 
211 211
 /**
@@ -220,62 +220,62 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string
222 222
  */
223
-function give_receipt_shortcode( $atts, $content = null ) {
223
+function give_receipt_shortcode($atts, $content = null) {
224 224
 
225 225
 	global $give_receipt_args, $payment;
226 226
 
227
-	$give_receipt_args = shortcode_atts( array(
228
-		'error'          => esc_html__( 'Sorry, you are missing the payment key to view this donation receipt.', 'give' ),
227
+	$give_receipt_args = shortcode_atts(array(
228
+		'error'          => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'),
229 229
 		'price'          => true,
230 230
 		'donor'          => true,
231 231
 		'date'           => true,
232 232
 		'payment_key'    => false,
233 233
 		'payment_method' => true,
234 234
 		'payment_id'     => true
235
-	), $atts, 'give_receipt' );
235
+	), $atts, 'give_receipt');
236 236
 
237 237
 	//set $session var
238 238
 	$session = give_get_purchase_session();
239 239
 
240 240
 	//set payment key var
241
-	if ( isset( $_GET['payment_key'] ) ) {
242
-		$payment_key = urldecode( $_GET['payment_key'] );
243
-	} elseif ( $session ) {
241
+	if (isset($_GET['payment_key'])) {
242
+		$payment_key = urldecode($_GET['payment_key']);
243
+	} elseif ($session) {
244 244
 		$payment_key = $session['purchase_key'];
245
-	} elseif ( $give_receipt_args['payment_key'] ) {
245
+	} elseif ($give_receipt_args['payment_key']) {
246 246
 		$payment_key = $give_receipt_args['payment_key'];
247 247
 	}
248 248
 
249
-	$email_access = give_get_option( 'email_access' );
249
+	$email_access = give_get_option('email_access');
250 250
 
251 251
 	// No payment_key found & Email Access is Turned on:
252
-	if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) {
252
+	if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) {
253 253
 
254 254
 		ob_start();
255 255
 
256
-		give_get_template_part( 'email-login-form' );
256
+		give_get_template_part('email-login-form');
257 257
 
258 258
 		return ob_get_clean();
259 259
 
260
-	} elseif ( ! isset( $payment_key ) ) {
260
+	} elseif ( ! isset($payment_key)) {
261 261
 
262
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
262
+		return give_output_error($give_receipt_args['error'], false, 'error');
263 263
 
264 264
 	}
265 265
 
266
-	$payment_id    = give_get_purchase_id_by_key( $payment_key );
267
-	$user_can_view = give_can_view_receipt( $payment_key );
266
+	$payment_id    = give_get_purchase_id_by_key($payment_key);
267
+	$user_can_view = give_can_view_receipt($payment_key);
268 268
 
269 269
 	// Key was provided, but user is logged out. Offer them the ability to login and view the receipt
270
-	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) {
270
+	if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) {
271 271
 
272 272
 		ob_start();
273 273
 
274
-		give_get_template_part( 'email-login-form' );
274
+		give_get_template_part('email-login-form');
275 275
 
276 276
 		return ob_get_clean();
277 277
 
278
-	} elseif ( ! $user_can_view ) {
278
+	} elseif ( ! $user_can_view) {
279 279
 
280 280
 		global $give_login_redirect;
281 281
 
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 
284 284
 		ob_start();
285 285
 
286
-		give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation payment receipt.', 'give' ) ) );
286
+		give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give')));
287 287
 
288
-		give_get_template_part( 'shortcode', 'login' );
288
+		give_get_template_part('shortcode', 'login');
289 289
 
290 290
 		$login_form = ob_get_clean();
291 291
 
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
 	 * Or if user is logged in and the user can view sensitive shop data
303 303
 	 *
304 304
 	 */
305
-	if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) {
306
-		return give_output_error( $give_receipt_args['error'], false, 'error' );
305
+	if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) {
306
+		return give_output_error($give_receipt_args['error'], false, 'error');
307 307
 	}
308 308
 
309 309
 	ob_start();
310 310
 
311
-	give_get_template_part( 'shortcode', 'receipt' );
311
+	give_get_template_part('shortcode', 'receipt');
312 312
 
313 313
 	$display = ob_get_clean();
314 314
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 }
319 319
 
320
-add_shortcode( 'give_receipt', 'give_receipt_shortcode' );
320
+add_shortcode('give_receipt', 'give_receipt_shortcode');
321 321
 
322 322
 /**
323 323
  * Profile Editor Shortcode
@@ -337,18 +337,18 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @return string Output generated from the profile editor
339 339
  */
340
-function give_profile_editor_shortcode( $atts, $content = null ) {
340
+function give_profile_editor_shortcode($atts, $content = null) {
341 341
 
342 342
 	ob_start();
343 343
 
344
-	give_get_template_part( 'shortcode', 'profile-editor' );
344
+	give_get_template_part('shortcode', 'profile-editor');
345 345
 
346 346
 	$display = ob_get_clean();
347 347
 
348 348
 	return $display;
349 349
 }
350 350
 
351
-add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' );
351
+add_shortcode('give_profile_editor', 'give_profile_editor_shortcode');
352 352
 
353 353
 /**
354 354
  * Process Profile Updater Form
@@ -361,30 +361,30 @@  discard block
 block discarded – undo
361 361
  *
362 362
  * @return false
363 363
  */
364
-function give_process_profile_editor_updates( $data ) {
364
+function give_process_profile_editor_updates($data) {
365 365
 	// Profile field change request
366
-	if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) {
366
+	if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) {
367 367
 		return false;
368 368
 	}
369 369
 
370 370
 	// Nonce security
371
-	if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) {
371
+	if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) {
372 372
 		return false;
373 373
 	}
374 374
 
375 375
 	$user_id       = get_current_user_id();
376
-	$old_user_data = get_userdata( $user_id );
377
-
378
-	$display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name;
379
-	$first_name   = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name;
380
-	$last_name    = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name;
381
-	$email        = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email;
382
-	$line1        = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' );
383
-	$line2        = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' );
384
-	$city         = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' );
385
-	$state        = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' );
386
-	$zip          = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' );
387
-	$country      = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' );
376
+	$old_user_data = get_userdata($user_id);
377
+
378
+	$display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name;
379
+	$first_name   = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name;
380
+	$last_name    = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name;
381
+	$email        = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email;
382
+	$line1        = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : '');
383
+	$line2        = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : '');
384
+	$city         = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : '');
385
+	$state        = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : '');
386
+	$zip          = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : '');
387
+	$country      = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : '');
388 388
 
389 389
 	$userdata = array(
390 390
 		'ID'           => $user_id,
@@ -404,45 +404,45 @@  discard block
 block discarded – undo
404 404
 		'country' => $country
405 405
 	);
406 406
 
407
-	do_action( 'give_pre_update_user_profile', $user_id, $userdata );
407
+	do_action('give_pre_update_user_profile', $user_id, $userdata);
408 408
 
409 409
 	// New password
410
-	if ( ! empty( $data['give_new_user_pass1'] ) ) {
411
-		if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) {
412
-			give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) );
410
+	if ( ! empty($data['give_new_user_pass1'])) {
411
+		if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) {
412
+			give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give'));
413 413
 		} else {
414 414
 			$userdata['user_pass'] = $data['give_new_user_pass1'];
415 415
 		}
416 416
 	}
417 417
 
418 418
 	// Make sure the new email doesn't belong to another user
419
-	if ( $email != $old_user_data->user_email ) {
420
-		if ( email_exists( $email ) ) {
421
-			give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) );
419
+	if ($email != $old_user_data->user_email) {
420
+		if (email_exists($email)) {
421
+			give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give'));
422 422
 		}
423 423
 	}
424 424
 
425 425
 	// Check for errors
426 426
 	$errors = give_get_errors();
427 427
 
428
-	if ( $errors ) {
428
+	if ($errors) {
429 429
 		// Send back to the profile editor if there are errors
430
-		wp_redirect( $data['give_redirect'] );
430
+		wp_redirect($data['give_redirect']);
431 431
 		give_die();
432 432
 	}
433 433
 
434 434
 	// Update the user
435
-	$meta    = update_user_meta( $user_id, '_give_user_address', $address );
436
-	$updated = wp_update_user( $userdata );
435
+	$meta    = update_user_meta($user_id, '_give_user_address', $address);
436
+	$updated = wp_update_user($userdata);
437 437
 
438
-	if ( $updated ) {
439
-		do_action( 'give_user_profile_updated', $user_id, $userdata );
440
-		wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) );
438
+	if ($updated) {
439
+		do_action('give_user_profile_updated', $user_id, $userdata);
440
+		wp_redirect(add_query_arg('updated', 'true', $data['give_redirect']));
441 441
 		give_die();
442 442
 	}
443 443
 
444 444
 	return false;
445 445
 }
446 446
 
447
-add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' );
447
+add_action('give_edit_user_profile', 'give_process_profile_editor_updates');
448 448
 
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@
 block discarded – undo
182 182
 	 *
183 183
 	 * @param  array $data Array of attributes for a donation form
184 184
 	 *
185
-	 * @return mixed  false if data isn't passed and class not instantiated for creation, or New Form ID
185
+	 * @return boolean  false if data isn't passed and class not instantiated for creation, or New Form ID
186 186
 	 */
187 187
 	public function create( $data = array() ) {
188 188
 
Please login to merge, or discard this patch.
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 	 * @param bool $_id
101 101
 	 * @param array $_args
102 102
 	 */
103
-	public function __construct( $_id = false, $_args = array() ) {
103
+	public function __construct($_id = false, $_args = array()) {
104 104
 
105 105
 
106
-		$donation_form = WP_Post::get_instance( $_id );
106
+		$donation_form = WP_Post::get_instance($_id);
107 107
 
108
-		return $this->setup_donation_form( $donation_form );
108
+		return $this->setup_donation_form($donation_form);
109 109
 	}
110 110
 
111 111
 	/**
@@ -119,23 +119,23 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return bool             If the setup was successful or not
121 121
 	 */
122
-	private function setup_donation_form( $donation_form ) {
122
+	private function setup_donation_form($donation_form) {
123 123
 
124
-		if ( ! is_object( $donation_form ) ) {
124
+		if ( ! is_object($donation_form)) {
125 125
 			return false;
126 126
 		}
127 127
 
128
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
128
+		if ( ! is_a($donation_form, 'WP_Post')) {
129 129
 			return false;
130 130
 		}
131 131
 
132
-		if ( 'give_forms' !== $donation_form->post_type ) {
132
+		if ('give_forms' !== $donation_form->post_type) {
133 133
 			return false;
134 134
 		}
135 135
 
136
-		foreach ( $donation_form as $key => $value ) {
136
+		foreach ($donation_form as $key => $value) {
137 137
 
138
-			switch ( $key ) {
138
+			switch ($key) {
139 139
 
140 140
 				default:
141 141
 					$this->$key = $value;
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
 	 * @return mixed
160 160
 	 * @throws Exception
161 161
 	 */
162
-	public function __get( $key ) {
162
+	public function __get($key) {
163 163
 
164
-		if ( method_exists( $this, 'get_' . $key ) ) {
164
+		if (method_exists($this, 'get_'.$key)) {
165 165
 
166
-			return call_user_func( array( $this, 'get_' . $key ) );
166
+			return call_user_func(array($this, 'get_'.$key));
167 167
 
168 168
 		} else {
169 169
 
170 170
 			/* translators: %s: property key */
171
-			return new WP_Error( 'give-form-invalid-property', sprintf( __( 'Can\'t get property %s.', 'give' ), $key ) );
171
+			return new WP_Error('give-form-invalid-property', sprintf(__('Can\'t get property %s.', 'give'), $key));
172 172
 
173 173
 		}
174 174
 
@@ -184,30 +184,30 @@  discard block
 block discarded – undo
184 184
 	 *
185 185
 	 * @return mixed  false if data isn't passed and class not instantiated for creation, or New Form ID
186 186
 	 */
187
-	public function create( $data = array() ) {
187
+	public function create($data = array()) {
188 188
 
189
-		if ( $this->id != 0 ) {
189
+		if ($this->id != 0) {
190 190
 			return false;
191 191
 		}
192 192
 
193 193
 		$defaults = array(
194 194
 			'post_type'   => 'give_forms',
195 195
 			'post_status' => 'draft',
196
-			'post_title'  => __( 'New Donation Form', 'give' )
196
+			'post_title'  => __('New Donation Form', 'give')
197 197
 		);
198 198
 
199
-		$args = wp_parse_args( $data, $defaults );
199
+		$args = wp_parse_args($data, $defaults);
200 200
 
201 201
 		/**
202 202
 		 * Fired before a donation form is created
203 203
 		 *
204 204
 		 * @param array $args The post object arguments used for creation.
205 205
 		 */
206
-		do_action( 'give_form_pre_create', $args );
206
+		do_action('give_form_pre_create', $args);
207 207
 
208
-		$id = wp_insert_post( $args, true );
208
+		$id = wp_insert_post($args, true);
209 209
 
210
-		$donation_form = WP_Post::get_instance( $id );
210
+		$donation_form = WP_Post::get_instance($id);
211 211
 
212 212
 		/**
213 213
 		 * Fired after a donation form is created
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 		 * @param int $id The post ID of the created item.
216 216
 		 * @param array $args The post object arguments used for creation.
217 217
 		 */
218
-		do_action( 'give_form_post_create', $id, $args );
218
+		do_action('give_form_post_create', $id, $args);
219 219
 
220
-		return $this->setup_donation_form( $donation_form );
220
+		return $this->setup_donation_form($donation_form);
221 221
 
222 222
 	}
223 223
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @return string Name of the donation form
241 241
 	 */
242 242
 	public function get_name() {
243
-		return get_the_title( $this->ID );
243
+		return get_the_title($this->ID);
244 244
 	}
245 245
 
246 246
 	/**
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function get_price() {
253 253
 
254
-		if ( ! isset( $this->price ) ) {
254
+		if ( ! isset($this->price)) {
255 255
 
256
-			$this->price = get_post_meta( $this->ID, '_give_set_price', true );
256
+			$this->price = get_post_meta($this->ID, '_give_set_price', true);
257 257
 
258
-			if ( $this->price ) {
258
+			if ($this->price) {
259 259
 
260
-				$this->price = give_sanitize_amount( $this->price );
260
+				$this->price = give_sanitize_amount($this->price);
261 261
 
262 262
 			} else {
263 263
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		 * @param string $price The donation form price.
276 276
 		 * @param string|int $id The form ID.
277 277
 		 */
278
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
278
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
279 279
 	}
280 280
 
281 281
 	/**
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function get_minimum_price() {
288 288
 
289
-		if ( ! isset( $this->minimum_price ) ) {
289
+		if ( ! isset($this->minimum_price)) {
290 290
 
291
-			$allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true );
292
-			$this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true );
291
+			$allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true);
292
+			$this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true);
293 293
 
294
-			if ( $allow_custom_amount != 'no' && $this->minimum_price ) {
294
+			if ($allow_custom_amount != 'no' && $this->minimum_price) {
295 295
 
296
-				$this->minimum_price = give_sanitize_amount( $this->minimum_price );
296
+				$this->minimum_price = give_sanitize_amount($this->minimum_price);
297 297
 
298 298
 			} else {
299 299
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
 		}
305 305
 
306
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
306
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
307 307
 	}
308 308
 
309 309
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 */
315 315
 	public function get_prices() {
316 316
 
317
-		if ( ! isset( $this->prices ) ) {
317
+		if ( ! isset($this->prices)) {
318 318
 
319
-			$this->prices = get_post_meta( $this->ID, '_give_donation_levels', true );
319
+			$this->prices = get_post_meta($this->ID, '_give_donation_levels', true);
320 320
 
321 321
 		}
322 322
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		 * @param array $prices The array of mulit-level prices.
329 329
 		 * @param int|string The ID of the form.
330 330
 		 */
331
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
331
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
332 332
 
333 333
 	}
334 334
 
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function get_goal() {
342 342
 
343
-		if ( ! isset( $this->goal ) ) {
343
+		if ( ! isset($this->goal)) {
344 344
 
345
-			$this->goal = get_post_meta( $this->ID, '_give_set_goal', true );
345
+			$this->goal = get_post_meta($this->ID, '_give_set_goal', true);
346 346
 
347
-			if ( $this->goal ) {
347
+			if ($this->goal) {
348 348
 
349
-				$this->goal = give_sanitize_amount( $this->goal );
349
+				$this->goal = give_sanitize_amount($this->goal);
350 350
 
351 351
 			} else {
352 352
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
 		}
358 358
 
359
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
359
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
360 360
 
361 361
 	}
362 362
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 	 */
369 369
 	public function is_single_price_mode() {
370 370
 
371
-		$option = get_post_meta( $this->ID, '_give_price_options_mode', true );
371
+		$option = get_post_meta($this->ID, '_give_price_options_mode', true);
372 372
 		$ret    = 0;
373 373
 
374
-		if ( empty( $option ) || $option === 'set' ) {
374
+		if (empty($option) || $option === 'set') {
375 375
 			$ret = 1;
376 376
 		}
377 377
 		
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		 * @param bool $ret Is donation form in single price mode?
384 384
 		 * @param int|string The ID of the donation form.
385 385
 		 */
386
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
386
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
387 387
 
388 388
 	}
389 389
 
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function is_custom_price_mode() {
397 397
 
398
-		$option = get_post_meta( $this->ID, '_give_custom_amount', true );
398
+		$option = get_post_meta($this->ID, '_give_custom_amount', true);
399 399
 		$ret    = 0;
400 400
 
401
-		if ( $option === 'yes' ) {
401
+		if ($option === 'yes') {
402 402
 			$ret = 1;
403 403
 		}
404 404
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 		 * @param bool $ret Is donation form in custom price mode?
411 411
 		 * @param int|string The ID of the donation form.
412 412
 		 */
413
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
413
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
414 414
 
415 415
 	}
416 416
 
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	public function has_variable_prices() {
426 426
 
427
-		$option = get_post_meta( $this->ID, '_give_price_option', true );
427
+		$option = get_post_meta($this->ID, '_give_price_option', true);
428 428
 		$ret    = 0;
429 429
 
430
-		if ( $option === 'multi' ) {
430
+		if ($option === 'multi') {
431 431
 			$ret = 1;
432 432
 		}
433 433
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		 * @param bool $ret Does donation form have variable prices?
438 438
 		 * @param int|string The ID of the donation form.
439 439
 		 */
440
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
440
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
441 441
 
442 442
 	}
443 443
 
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
 	 */
450 450
 	public function get_type() {
451 451
 
452
-		if ( ! isset( $this->type ) ) {
452
+		if ( ! isset($this->type)) {
453 453
 
454
-			$this->type = get_post_meta( $this->ID, '_give_price_option', true );
454
+			$this->type = get_post_meta($this->ID, '_give_price_option', true);
455 455
 
456
-			if ( empty( $this->type ) ) {
456
+			if (empty($this->type)) {
457 457
 				$this->type = 'set';
458 458
 			}
459 459
 
460 460
 		}
461 461
 
462
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
462
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
463 463
 
464 464
 	}
465 465
 
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
 	 */
472 472
 	public function get_sales() {
473 473
 
474
-		if ( ! isset( $this->sales ) ) {
474
+		if ( ! isset($this->sales)) {
475 475
 
476
-			if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) {
477
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
476
+			if ('' == get_post_meta($this->ID, '_give_form_sales', true)) {
477
+				add_post_meta($this->ID, '_give_form_sales', 0);
478 478
 			} // End if
479 479
 
480
-			$this->sales = get_post_meta( $this->ID, '_give_form_sales', true );
480
+			$this->sales = get_post_meta($this->ID, '_give_form_sales', true);
481 481
 
482
-			if ( $this->sales < 0 ) {
482
+			if ($this->sales < 0) {
483 483
 				// Never let sales be less than zero
484 484
 				$this->sales = 0;
485 485
 			}
@@ -499,13 +499,13 @@  discard block
 block discarded – undo
499 499
 	 *
500 500
 	 * @return int|false  New number of total sales
501 501
 	 */
502
-	public function increase_sales( $quantity = 1 ) {
502
+	public function increase_sales($quantity = 1) {
503 503
 
504
-		$sales       = give_get_form_sales_stats( $this->ID );
505
-		$quantity    = absint( $quantity );
504
+		$sales       = give_get_form_sales_stats($this->ID);
505
+		$quantity    = absint($quantity);
506 506
 		$total_sales = $sales + $quantity;
507 507
 
508
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
508
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
509 509
 
510 510
 			$this->sales = $total_sales;
511 511
 
@@ -525,17 +525,17 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @return int|false  New number of total sales
527 527
 	 */
528
-	public function decrease_sales( $quantity = 1 ) {
528
+	public function decrease_sales($quantity = 1) {
529 529
 
530
-		$sales = give_get_form_sales_stats( $this->ID );
530
+		$sales = give_get_form_sales_stats($this->ID);
531 531
 
532 532
 		// Only decrease if not already zero
533
-		if ( $sales > 0 ) {
533
+		if ($sales > 0) {
534 534
 
535
-			$quantity    = absint( $quantity );
535
+			$quantity    = absint($quantity);
536 536
 			$total_sales = $sales - $quantity;
537 537
 
538
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
538
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
539 539
 
540 540
 				$this->sales = $sales;
541 541
 
@@ -557,15 +557,15 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	public function get_earnings() {
559 559
 
560
-		if ( ! isset( $this->earnings ) ) {
560
+		if ( ! isset($this->earnings)) {
561 561
 
562
-			if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) {
563
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
562
+			if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) {
563
+				add_post_meta($this->ID, '_give_form_earnings', 0);
564 564
 			}
565 565
 
566
-			$this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true );
566
+			$this->earnings = get_post_meta($this->ID, '_give_form_earnings', true);
567 567
 
568
-			if ( $this->earnings < 0 ) {
568
+			if ($this->earnings < 0) {
569 569
 				// Never let earnings be less than zero
570 570
 				$this->earnings = 0;
571 571
 			}
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
 	 * 
586 586
 	 * @return float|false
587 587
 	 */
588
-	public function increase_earnings( $amount = 0 ) {
588
+	public function increase_earnings($amount = 0) {
589 589
 
590
-		$earnings   = give_get_form_earnings_stats( $this->ID );
590
+		$earnings   = give_get_form_earnings_stats($this->ID);
591 591
 		$new_amount = $earnings + (float) $amount;
592 592
 
593
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
593
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
594 594
 
595 595
 			$this->earnings = $new_amount;
596 596
 
@@ -608,16 +608,16 @@  discard block
 block discarded – undo
608 608
 	 * @since 1.0
609 609
 	 * @return float|false
610 610
 	 */
611
-	public function decrease_earnings( $amount ) {
611
+	public function decrease_earnings($amount) {
612 612
 
613
-		$earnings = give_get_form_earnings_stats( $this->ID );
613
+		$earnings = give_get_form_earnings_stats($this->ID);
614 614
 
615
-		if ( $earnings > 0 ) {
615
+		if ($earnings > 0) {
616 616
 			// Only decrease if greater than zero
617 617
 			$new_amount = $earnings - (float) $amount;
618 618
 
619 619
 
620
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
620
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
621 621
 
622 622
 				$this->earnings = $new_amount;
623 623
 
@@ -637,22 +637,22 @@  discard block
 block discarded – undo
637 637
 	 * @since 1.0
638 638
 	 * @return bool
639 639
 	 */
640
-	public function is_free( $price_id = false ) {
640
+	public function is_free($price_id = false) {
641 641
 
642 642
 		$is_free          = false;
643
-		$variable_pricing = give_has_variable_prices( $this->ID );
643
+		$variable_pricing = give_has_variable_prices($this->ID);
644 644
 
645
-		if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) {
646
-			$price = give_get_price_option_amount( $this->ID, $price_id );
647
-		} elseif ( ! $variable_pricing ) {
648
-			$price = get_post_meta( $this->ID, '_give_set_price', true );
645
+		if ($variable_pricing && ! is_null($price_id) && $price_id !== false) {
646
+			$price = give_get_price_option_amount($this->ID, $price_id);
647
+		} elseif ( ! $variable_pricing) {
648
+			$price = get_post_meta($this->ID, '_give_set_price', true);
649 649
 		}
650 650
 
651
-		if ( isset( $price ) && (float) $price == 0 ) {
651
+		if (isset($price) && (float) $price == 0) {
652 652
 			$is_free = true;
653 653
 		}
654 654
 
655
-		return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id );
655
+		return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id);
656 656
 
657 657
 	}
658 658
 
@@ -669,9 +669,9 @@  discard block
 block discarded – undo
669 669
 	 */
670 670
 	public function is_close_donation_form() {
671 671
 		return (
672
-				'yes' === get_post_meta( $this->ID, '_give_goal_option', true ) )
673
-				&& ( 'yes' === get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) )
674
-				&& ( $this->get_goal() <= $this->get_earnings()
672
+				'yes' === get_post_meta($this->ID, '_give_goal_option', true) )
673
+				&& ('yes' === get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true))
674
+				&& ($this->get_goal() <= $this->get_earnings()
675 675
 		);
676 676
 	}
677 677
 
@@ -687,29 +687,29 @@  discard block
 block discarded – undo
687 687
 	 *
688 688
 	 * @return bool                             The result of the update query
689 689
 	 */
690
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
690
+	private function update_meta($meta_key = '', $meta_value = '') {
691 691
 
692 692
 		/* @var WPDB $wpdb */
693 693
 		global $wpdb;
694 694
 
695
-		if ( empty( $meta_key ) || empty( $meta_value ) ) {
695
+		if (empty($meta_key) || empty($meta_value)) {
696 696
 			return false;
697 697
 		}
698 698
 
699 699
 		// Make sure if it needs to be serialized, we do
700
-		$meta_value = maybe_serialize( $meta_value );
700
+		$meta_value = maybe_serialize($meta_value);
701 701
 
702
-		if ( is_numeric( $meta_value ) ) {
703
-			$value_type = is_float( $meta_value ) ? '%f' : '%d';
702
+		if (is_numeric($meta_value)) {
703
+			$value_type = is_float($meta_value) ? '%f' : '%d';
704 704
 		} else {
705 705
 			$value_type = "'%s'";
706 706
 		}
707 707
 
708
-		$sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key );
708
+		$sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key);
709 709
 
710
-		if ( $wpdb->query( $sql ) ) {
710
+		if ($wpdb->query($sql)) {
711 711
 
712
-			clean_post_cache( $this->ID );
712
+			clean_post_cache($this->ID);
713 713
 
714 714
 			return true;
715 715
 
Please login to merge, or discard this patch.
includes/class-give-logging.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @param array $log_data Log entry data
215 215
 	 * @param array $log_meta Log entry meta
216 216
 	 *
217
-	 * @return bool True if successful, false otherwise
217
+	 * @return boolean|null True if successful, false otherwise
218 218
 	 */
219 219
 	public function update_log( $log_data = array(), $log_meta = array() ) {
220 220
 
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
  * @param string $title
393 393
  * @param string $message
394 394
  * @param int $parent
395
- * @param null $type
395
+ * @param string $type
396 396
  *
397 397
  * @global $give_logs GIVE Logs Object
398 398
  *
399 399
  * @uses Give_Logging::add()
400 400
  *
401
- * @return mixed ID of the new log entry
401
+ * @return integer ID of the new log entry
402 402
  */
403 403
 function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) {
404 404
 	/* @var Give_Logging $give_logs */
Please login to merge, or discard this patch.
includes/class-give-session.php 2 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -175,10 +175,9 @@
 block discarded – undo
175 175
 	 * @access public
176 176
 	 * @since 1.0
177 177
 	 *
178
-	 * @param $key $_SESSION key
179
-	 * @param $value $_SESSION variable
180 178
 	 *
181
-	 * @return mixed Session variable
179
+	 * @param string $key
180
+	 * @return string Session variable
182 181
 	 */
183 182
 	public function set( $key, $value ) {
184 183
 
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 	/**
173 173
 	 * Set a session variable
174
-     *
174
+	 *
175 175
 	 * @access public
176 176
 	 * @since 1.0
177 177
 	 *
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	/**
295 295
 	 * Determines if we should start sessions
296 296
 	 *
297
-     * @access public
297
+	 * @access public
298 298
 	 * @since  1.4
299 299
 	 * @return bool
300 300
 	 */
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 	/**
333 333
 	 * Maybe Start Session
334 334
 	 * Starts a new session if one hasn't started yet.
335
-     *
336
-     * @access public
335
+	 *
336
+	 * @access public
337 337
 	 * @see    http://php.net/manual/en/function.session-set-cookie-params.php
338 338
 	 */
339 339
 	public function maybe_start_session() {
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 	/**
353 353
 	 * Get Session Expiration
354 354
 	 * Looks at the session cookies and returns the expiration date for this session if applicable
355
-     *
356
-     * @access public
357
-     *
358
-     * @return string Formatted date string
355
+	 *
356
+	 * @access public
357
+	 *
358
+	 * @return string Formatted date string
359 359
 	 */
360 360
 	public function get_session_expiration() {
361 361
 
Please login to merge, or discard this patch.
includes/formatting.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
  * @use  give_get_price_thousand_separator Get thousand separator.
164 164
  *
165 165
  * @param string $amount formatted amount number.
166
- * @return float|string  formatted amount number with large number names.
166
+ * @return string  formatted amount number with large number names.
167 167
  */
168 168
 function give_human_format_large_amount( $amount ) {
169 169
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
  * @param $field_args
221 221
  * @param $field
222 222
  *
223
- * @return bool
223
+ * @return false|null
224 224
  */
225 225
 function give_format_admin_multilevel_amount( $field_args, $field ) {
226 226
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
  * @param array  $field_args
382 382
  * @param object $field
383 383
  *
384
- * @return mixed
384
+ * @return string
385 385
  */
386 386
 function give_sanitize_thousand_separator( $value, $field_args, $field ){
387 387
     return $value;
Please login to merge, or discard this patch.
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-    return apply_filters( 'give_sanitize_amount_decimals', 2 );
26
+	return apply_filters( 'give_sanitize_amount_decimals', 2 );
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-    return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option( 'thousands_separator', ',' );
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-    return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option( 'decimal_separator', '.' );
49 49
 }
50 50
 
51 51
 /**
@@ -62,39 +62,39 @@  discard block
 block discarded – undo
62 62
  * @return string $amount Newly sanitized amount
63 63
  */
64 64
 function give_sanitize_amount( $number, $trim_zeros = false ) {
65
-    $thousand_separator = give_get_price_thousand_separator();
65
+	$thousand_separator = give_get_price_thousand_separator();
66 66
 
67
-    $locale   = localeconv();
68
-    $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
67
+	$locale   = localeconv();
68
+	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
69 69
 
70
-    // Remove locale from string
71
-    if ( ! is_float( $number ) ) {
72
-        $number = str_replace( $decimals, '.', $number );
73
-    }
70
+	// Remove locale from string
71
+	if ( ! is_float( $number ) ) {
72
+		$number = str_replace( $decimals, '.', $number );
73
+	}
74 74
 
75
-    // Remove thousand amount formatting if amount has.
76
-    // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
77
-    if( false !== strpos( $number, $thousand_separator ) ) {
78
-        $number = str_replace( $thousand_separator, '', $number );
79
-    }
75
+	// Remove thousand amount formatting if amount has.
76
+	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
77
+	if( false !== strpos( $number, $thousand_separator ) ) {
78
+		$number = str_replace( $thousand_separator, '', $number );
79
+	}
80 80
 
81
-    // Remove non numeric entity before decimal separator.
82
-    $number   = preg_replace( '/[^0-9\.]/', '', $number );
81
+	// Remove non numeric entity before decimal separator.
82
+	$number   = preg_replace( '/[^0-9\.]/', '', $number );
83 83
 
84
-    $decimals = give_get_price_decimals();
85
-    $decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number );
84
+	$decimals = give_get_price_decimals();
85
+	$decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number );
86 86
 
87
-    $number = number_format( floatval( $number ), $decimals, '.', '' );
87
+	$number = number_format( floatval( $number ), $decimals, '.', '' );
88 88
 
89
-    // Reset negative amount to zero.
89
+	// Reset negative amount to zero.
90 90
 	if ( 0 > $number ) {
91 91
 		$number = number_format( 0, 2, '.' );
92 92
 	}
93 93
 
94
-    // Trim zeros.
95
-    if ( $trim_zeros && strstr( $number, '.' ) ) {
96
-        $number = rtrim( rtrim( $number, '0' ), '.' );
97
-    }
94
+	// Trim zeros.
95
+	if ( $trim_zeros && strstr( $number, '.' ) ) {
96
+		$number = rtrim( rtrim( $number, '0' ), '.' );
97
+	}
98 98
 
99 99
 	return apply_filters( 'give_sanitize_amount', $number );
100 100
 }
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
  */
168 168
 function give_human_format_large_amount( $amount ) {
169 169
 
170
-    // Get thousand separator.
171
-    $thousands_sep = give_get_price_thousand_separator();
170
+	// Get thousand separator.
171
+	$thousands_sep = give_get_price_thousand_separator();
172 172
 
173
-    // Sanitize amount.
174
-    $sanitize_amount = give_sanitize_amount( $amount );
173
+	// Sanitize amount.
174
+	$sanitize_amount = give_sanitize_amount( $amount );
175 175
 
176
-    // Explode amount to calculate name of large numbers.
176
+	// Explode amount to calculate name of large numbers.
177 177
 	$amount_array = explode( $thousands_sep, $amount );
178 178
 
179
-    // Calculate amount parts count.
180
-    $amount_count_parts = count( $amount_array );
179
+	// Calculate amount parts count.
180
+	$amount_count_parts = count( $amount_array );
181 181
 
182
-    // Calculate large number formatted amount.
183
-    if ( 4 < $amount_count_parts ){
184
-        $sanitize_amount =  sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
185
-    } elseif ( 3 < $amount_count_parts ){
186
-        $sanitize_amount =  sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
187
-    } elseif ( 2 < $amount_count_parts  ) {
188
-        $sanitize_amount =  sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
189
-    }
182
+	// Calculate large number formatted amount.
183
+	if ( 4 < $amount_count_parts ){
184
+		$sanitize_amount =  sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
185
+	} elseif ( 3 < $amount_count_parts ){
186
+		$sanitize_amount =  sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
187
+	} elseif ( 2 < $amount_count_parts  ) {
188
+		$sanitize_amount =  sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
189
+	}
190 190
 
191
-    return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount );
191
+	return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount );
192 192
 }
193 193
 
194 194
 /**
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
  * @return string $amount Newly formatted amount or Price Not Available
202 202
  */
203 203
 function give_format_decimal( $amount ){
204
-    $decimal_separator = give_get_price_decimal_separator();
205
-    $formatted_amount  = give_sanitize_amount( $amount );
204
+	$decimal_separator = give_get_price_decimal_separator();
205
+	$formatted_amount  = give_sanitize_amount( $amount );
206 206
 
207
-    if( false !== strpos( $formatted_amount, '.' ) ) {
208
-        $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
209
-    }
207
+	if( false !== strpos( $formatted_amount, '.' ) ) {
208
+		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
209
+	}
210 210
 
211
-    return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
211
+	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
212 212
 }
213 213
 
214 214
 
@@ -384,5 +384,5 @@  discard block
 block discarded – undo
384 384
  * @return mixed
385 385
  */
386 386
 function give_sanitize_thousand_separator( $value, $field_args, $field ){
387
-    return $value;
387
+	return $value;
388 388
 }
389 389
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-    return apply_filters( 'give_sanitize_amount_decimals', 2 );
26
+    return apply_filters('give_sanitize_amount_decimals', 2);
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-    return give_get_option( 'thousands_separator', ',' );
37
+    return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-    return give_get_option( 'decimal_separator', '.' );
48
+    return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -61,42 +61,42 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string $amount Newly sanitized amount
63 63
  */
64
-function give_sanitize_amount( $number, $trim_zeros = false ) {
64
+function give_sanitize_amount($number, $trim_zeros = false) {
65 65
     $thousand_separator = give_get_price_thousand_separator();
66 66
 
67 67
     $locale   = localeconv();
68
-    $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
68
+    $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
69 69
 
70 70
     // Remove locale from string
71
-    if ( ! is_float( $number ) ) {
72
-        $number = str_replace( $decimals, '.', $number );
71
+    if ( ! is_float($number)) {
72
+        $number = str_replace($decimals, '.', $number);
73 73
     }
74 74
 
75 75
     // Remove thousand amount formatting if amount has.
76 76
     // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
77
-    if( false !== strpos( $number, $thousand_separator ) ) {
78
-        $number = str_replace( $thousand_separator, '', $number );
77
+    if (false !== strpos($number, $thousand_separator)) {
78
+        $number = str_replace($thousand_separator, '', $number);
79 79
     }
80 80
 
81 81
     // Remove non numeric entity before decimal separator.
82
-    $number   = preg_replace( '/[^0-9\.]/', '', $number );
82
+    $number   = preg_replace('/[^0-9\.]/', '', $number);
83 83
 
84 84
     $decimals = give_get_price_decimals();
85
-    $decimals = apply_filters( 'give_sanitize_amount_decimals', $decimals, $number );
85
+    $decimals = apply_filters('give_sanitize_amount_decimals', $decimals, $number);
86 86
 
87
-    $number = number_format( floatval( $number ), $decimals, '.', '' );
87
+    $number = number_format(floatval($number), $decimals, '.', '');
88 88
 
89 89
     // Reset negative amount to zero.
90
-	if ( 0 > $number ) {
91
-		$number = number_format( 0, 2, '.' );
90
+	if (0 > $number) {
91
+		$number = number_format(0, 2, '.');
92 92
 	}
93 93
 
94 94
     // Trim zeros.
95
-    if ( $trim_zeros && strstr( $number, '.' ) ) {
96
-        $number = rtrim( rtrim( $number, '0' ), '.' );
95
+    if ($trim_zeros && strstr($number, '.')) {
96
+        $number = rtrim(rtrim($number, '0'), '.');
97 97
     }
98 98
 
99
-	return apply_filters( 'give_sanitize_amount', $number );
99
+	return apply_filters('give_sanitize_amount', $number);
100 100
 }
101 101
 
102 102
 /**
@@ -109,47 +109,47 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return string $amount Newly formatted amount or Price Not Available
111 111
  */
112
-function give_format_amount( $amount, $decimals = true ) {
112
+function give_format_amount($amount, $decimals = true) {
113 113
 
114
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
115
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
114
+	$thousands_sep = give_get_option('thousands_separator', ',');
115
+	$decimal_sep   = give_get_option('decimal_separator', '.');
116 116
 
117 117
 	// Format the amount
118
-	if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
119
-		$whole  = substr( $amount, 0, $sep_found );
120
-		$part   = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
121
-		$amount = $whole . '.' . $part;
118
+	if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
119
+		$whole  = substr($amount, 0, $sep_found);
120
+		$part   = substr($amount, $sep_found + 1, (strlen($amount) - 1));
121
+		$amount = $whole.'.'.$part;
122 122
 	}
123 123
 
124 124
 	// Strip , from the amount (if set as the thousands separator)
125
-	if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
126
-		$amount = str_replace( ',', '', $amount );
125
+	if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
126
+		$amount = str_replace(',', '', $amount);
127 127
 	}
128 128
 
129 129
 	// Strip . from the amount (if set as the thousands separator) AND , set to decimal separator
130
-	if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
131
-		$amount      = explode( '.', $amount );
132
-		$array_count = count( $amount );
133
-		if ( $decimals == true ) {
134
-			unset( $amount[ $array_count - 1 ] );
130
+	if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
131
+		$amount      = explode('.', $amount);
132
+		$array_count = count($amount);
133
+		if ($decimals == true) {
134
+			unset($amount[$array_count - 1]);
135 135
 		}
136
-		$amount = implode( '', $amount );
136
+		$amount = implode('', $amount);
137 137
 	}
138 138
 
139 139
 	// Strip ' ' from the amount (if set as the thousands separator)
140
-	if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
141
-		$amount = str_replace( ' ', '', $amount );
140
+	if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
141
+		$amount = str_replace(' ', '', $amount);
142 142
 	}
143 143
 
144
-	if ( empty( $amount ) ) {
144
+	if (empty($amount)) {
145 145
 		$amount = 0;
146 146
 	}
147 147
 
148 148
 	$decimals = give_get_price_decimals();
149 149
 
150
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
150
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
151 151
 
152
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
152
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
153 153
 }
154 154
 
155 155
 
@@ -165,30 +165,30 @@  discard block
 block discarded – undo
165 165
  * @param string $amount formatted amount number.
166 166
  * @return float|string  formatted amount number with large number names.
167 167
  */
168
-function give_human_format_large_amount( $amount ) {
168
+function give_human_format_large_amount($amount) {
169 169
 
170 170
     // Get thousand separator.
171 171
     $thousands_sep = give_get_price_thousand_separator();
172 172
 
173 173
     // Sanitize amount.
174
-    $sanitize_amount = give_sanitize_amount( $amount );
174
+    $sanitize_amount = give_sanitize_amount($amount);
175 175
 
176 176
     // Explode amount to calculate name of large numbers.
177
-	$amount_array = explode( $thousands_sep, $amount );
177
+	$amount_array = explode($thousands_sep, $amount);
178 178
 
179 179
     // Calculate amount parts count.
180
-    $amount_count_parts = count( $amount_array );
180
+    $amount_count_parts = count($amount_array);
181 181
 
182 182
     // Calculate large number formatted amount.
183
-    if ( 4 < $amount_count_parts ){
184
-        $sanitize_amount =  sprintf( __( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
185
-    } elseif ( 3 < $amount_count_parts ){
186
-        $sanitize_amount =  sprintf( __( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ));
187
-    } elseif ( 2 < $amount_count_parts  ) {
188
-        $sanitize_amount =  sprintf( __( '%s million', 'give' ), round( ( $sanitize_amount / 1000000), 2 ) );
183
+    if (4 < $amount_count_parts) {
184
+        $sanitize_amount = sprintf(__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
185
+    } elseif (3 < $amount_count_parts) {
186
+        $sanitize_amount = sprintf(__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
187
+    } elseif (2 < $amount_count_parts) {
188
+        $sanitize_amount = sprintf(__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
189 189
     }
190 190
 
191
-    return apply_filters( 'give_human_format_large_amount', $sanitize_amount, $amount );
191
+    return apply_filters('give_human_format_large_amount', $sanitize_amount, $amount);
192 192
 }
193 193
 
194 194
 /**
@@ -200,15 +200,15 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return string $amount Newly formatted amount or Price Not Available
202 202
  */
203
-function give_format_decimal( $amount ){
203
+function give_format_decimal($amount) {
204 204
     $decimal_separator = give_get_price_decimal_separator();
205
-    $formatted_amount  = give_sanitize_amount( $amount );
205
+    $formatted_amount  = give_sanitize_amount($amount);
206 206
 
207
-    if( false !== strpos( $formatted_amount, '.' ) ) {
208
-        $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
207
+    if (false !== strpos($formatted_amount, '.')) {
208
+        $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
209 209
     }
210 210
 
211
-    return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
211
+    return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
212 212
 }
213 213
 
214 214
 
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
  *
223 223
  * @return bool
224 224
  */
225
-function give_format_admin_multilevel_amount( $field_args, $field ) {
225
+function give_format_admin_multilevel_amount($field_args, $field) {
226 226
 
227
-	if ( empty( $field->value ) ) {
227
+	if (empty($field->value)) {
228 228
 		return false;
229 229
 	}
230 230
 
231
-	$field->value = give_format_decimal( $field->value );
231
+	$field->value = give_format_decimal($field->value);
232 232
 }
233 233
 
234 234
 /**
@@ -241,24 +241,24 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return mixed|string|void
243 243
  */
244
-function give_currency_filter( $price = '', $currency = '' ) {
244
+function give_currency_filter($price = '', $currency = '') {
245 245
 
246
-	if ( empty( $currency ) ) {
246
+	if (empty($currency)) {
247 247
 		$currency = give_get_currency();
248 248
 	}
249 249
 
250
-	$position = give_get_option( 'currency_position', 'before' );
250
+	$position = give_get_option('currency_position', 'before');
251 251
 
252 252
 	$negative = $price < 0;
253 253
 
254
-	if ( $negative ) {
255
-		$price = substr( $price, 1 ); // Remove proceeding "-" -
254
+	if ($negative) {
255
+		$price = substr($price, 1); // Remove proceeding "-" -
256 256
 	}
257 257
 
258
-	$symbol = give_currency_symbol( $currency );
258
+	$symbol = give_currency_symbol($currency);
259 259
 
260
-	if ( $position == 'before' ):
261
-		switch ( $currency ):
260
+	if ($position == 'before'):
261
+		switch ($currency):
262 262
 			case 'GBP' :
263 263
 			case 'BRL' :
264 264
 			case 'EUR' :
@@ -287,18 +287,18 @@  discard block
 block discarded – undo
287 287
 			case 'MAD' :
288 288
 			case 'KRW' :
289 289
 			case 'ZAR' :
290
-				$formatted = $symbol . $price;
290
+				$formatted = $symbol.$price;
291 291
 				break;
292 292
 			case 'NOK' :
293
-				$formatted = $symbol . ' ' . $price;
293
+				$formatted = $symbol.' '.$price;
294 294
 				break;
295 295
 			default :
296
-				$formatted = $currency . ' ' . $price;
296
+				$formatted = $currency.' '.$price;
297 297
 				break;
298 298
 		endswitch;
299
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price );
299
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price);
300 300
 	else :
301
-		switch ( $currency ) :
301
+		switch ($currency) :
302 302
 			case 'GBP' :
303 303
 			case 'BRL' :
304 304
 			case 'EUR' :
@@ -326,18 +326,18 @@  discard block
 block discarded – undo
326 326
 			case 'MAD' :
327 327
 			case 'KRW' :
328 328
 			case 'ZAR' :
329
-				$formatted = $price . $symbol;
329
+				$formatted = $price.$symbol;
330 330
 				break;
331 331
 			default :
332
-				$formatted = $price . ' ' . $currency;
332
+				$formatted = $price.' '.$currency;
333 333
 				break;
334 334
 		endswitch;
335
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price );
335
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price);
336 336
 	endif;
337 337
 
338
-	if ( $negative ) {
338
+	if ($negative) {
339 339
 		// Prepend the mins sign before the currency sign
340
-		$formatted = '-' . $formatted;
340
+		$formatted = '-'.$formatted;
341 341
 	}
342 342
 
343 343
 	return $formatted;
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
  *
353 353
  * @return int $decimals
354 354
  */
355
-function give_currency_decimal_filter( $decimals = 2 ) {
355
+function give_currency_decimal_filter($decimals = 2) {
356 356
 
357 357
 	$currency = give_get_currency();
358 358
 
359
-	switch ( $currency ) {
359
+	switch ($currency) {
360 360
 		case 'RIAL' :
361 361
 		case 'JPY' :
362 362
 		case 'TWD' :
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 			break;
367 367
 	}
368 368
 
369
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
369
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
370 370
 }
371 371
 
372
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
373
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
372
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
373
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
374 374
 
375 375
 /**
376 376
  * Sanitize thousand separator
@@ -383,6 +383,6 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return mixed
385 385
  */
386
-function give_sanitize_thousand_separator( $value, $field_args, $field ){
386
+function give_sanitize_thousand_separator($value, $field_args, $field) {
387 387
     return $value;
388 388
 }
389 389
\ No newline at end of file
Please login to merge, or discard this patch.