Completed
Push — develop ( 47c1de...5901ab )
by Zack
19:00 queued 11s
created
trustedlogin/trustedlogin/client/src/SecurityChecks.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
 		$user_identifier = $passed_user_identifier;
85 85
 
86
-		if ( $this->in_lockdown() ){
86
+		if ( $this->in_lockdown() ) {
87 87
 
88 88
 			$this->logging->log( 'Site is in lockdown mode, aborting login.', __METHOD__, 'error' );
89 89
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$approved = $this->check_approved_identifier( $secret_id );
112 112
 
113 113
 		// Don't lock-down the site, since there could have been errors related to remote validation
114
-		if ( is_wp_error( $approved ) ){
114
+		if ( is_wp_error( $approved ) ) {
115 115
 
116 116
 			$this->logging->log(
117 117
 				sprintf(
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$notified = $this->report_lockdown();
304 304
 
305
-		if ( is_wp_error( $notified ) ){
305
+		if ( is_wp_error( $notified ) ) {
306 306
 			$this->logging->log( sprintf( 'Could not notify TrustedLogin (%s)', $notified->get_error_message() ), __METHOD__, 'error' );
307 307
 		}
308 308
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return int|false Int: in lockdown. The value returned is the timestamp when lockdown ends. False: not in lockdown, or overridden by a constant.
357 357
 	 */
358
-	public function in_lockdown(){
358
+	public function in_lockdown() {
359 359
 
360 360
 		if ( $this->in_local_development() ) {
361 361
 			return false;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 		$user_identifier = $passed_user_identifier;
85 85
 
86
-		if ( $this->in_lockdown() ){
86
+		if ( $this->in_lockdown() ) {
87 87
 
88 88
 			$this->logging->log( 'Site is in lockdown mode, aborting login.', __METHOD__, 'error' );
89 89
 
90
-			return new WP_Error( 'in_lockdown', __( 'TrustedLogin temporarily disabled.' , 'gravityview') );
90
+			return new WP_Error( 'in_lockdown', __( 'TrustedLogin temporarily disabled.', 'gravityview' ) );
91 91
 		}
92 92
 
93 93
 		// When passed in the endpoint URL, the unique ID will be the raw value, not the hash.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		$approved = $this->check_approved_identifier( $secret_id );
112 112
 
113 113
 		// Don't lock-down the site, since there could have been errors related to remote validation
114
-		if ( is_wp_error( $approved ) ){
114
+		if ( is_wp_error( $approved ) ) {
115 115
 
116 116
 			$this->logging->log(
117 117
 				sprintf(
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 				'notice'
153 153
 			);
154 154
 
155
-			return new WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.');
155
+			return new WP_Error( 'brute_force_detected', 'Login aborted due to potential brute force detection.' );
156 156
 		}
157 157
 
158 158
 		return true;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	private function maybe_add_used_accesskey( $user_identifier = '' ) {
167 167
 
168
-		$used_accesskeys = (array) get_site_transient( $this->used_accesskey_transient );
168
+		$used_accesskeys = (array)get_site_transient( $this->used_accesskey_transient );
169 169
 
170 170
 		// This is a new access key
171 171
 		if ( ! in_array( $user_identifier, $used_accesskeys, true ) ) {
172 172
 
173
-			$used_accesskeys[] = $user_identifier;
173
+			$used_accesskeys[ ] = $user_identifier;
174 174
 
175 175
 			$transient_set = set_site_transient( $this->used_accesskey_transient, $used_accesskeys, self::ACCESSKEY_LIMIT_EXPIRY );
176 176
 
@@ -190,19 +190,19 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	private function get_ip() {
192 192
 
193
-		if ( ! isset( $_SERVER['REMOTE_ADDR'] ) ) {
193
+		if ( ! isset( $_SERVER[ 'REMOTE_ADDR' ] ) ) {
194 194
 			return null;
195 195
 		}
196 196
 
197
-		$ip = wp_unslash( $_SERVER['REMOTE_ADDR'] );
197
+		$ip = wp_unslash( $_SERVER[ 'REMOTE_ADDR' ] );
198 198
 
199 199
 		$ip = trim( $ip );
200 200
 
201
-		if ( ! defined('TL_DOING_TESTS') ) {
201
+		if ( ! defined( 'TL_DOING_TESTS' ) ) {
202 202
 			$ip = filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE | FILTER_FLAG_NO_PRIV_RANGE );
203 203
 		}
204 204
 
205
-		return (string) $ip;
205
+		return (string)$ip;
206 206
 	}
207 207
 
208 208
 	/**
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		 */
227 227
 		$body = array(
228 228
 			'timestamp'  => time(),
229
-			'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '',
229
+			'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '',
230 230
 			'user_ip'    => $this->get_ip(),
231 231
 			'site_url'   => get_site_url(),
232 232
 		);
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 		 */
266 266
 		$body = array(
267 267
 			'timestamp'  => time(),
268
-			'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 255 ) : '',
268
+			'user_agent' => isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) ? substr( $_SERVER[ 'HTTP_USER_AGENT' ], 0, 255 ) : '',
269 269
 			'user_ip'	 => $this->get_ip(),
270 270
 			'site_url'	 => get_site_url(),
271 271
 		);
272 272
 
273 273
 		$remote = new Remote( $this->config, $this->logging );
274
-		$api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT , $body, 'POST' );
274
+		$api_response = $remote->send( self::BRUTE_FORCE_ENDPOINT, $body, 'POST' );
275 275
 
276 276
 		if ( is_wp_error( $api_response ) ) {
277 277
 			return $api_response;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 		$notified = $this->report_lockdown();
304 304
 
305
-		if ( is_wp_error( $notified ) ){
305
+		if ( is_wp_error( $notified ) ) {
306 306
 			$this->logging->log( sprintf( 'Could not notify TrustedLogin (%s)', $notified->get_error_message() ), __METHOD__, 'error' );
307 307
 		}
308 308
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return int|false Int: in lockdown. The value returned is the timestamp when lockdown ends. False: not in lockdown, or overridden by a constant.
357 357
 	 */
358
-	public function in_lockdown(){
358
+	public function in_lockdown() {
359 359
 
360 360
 		if ( $this->in_local_development() ) {
361 361
 			return false;
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Logging.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		$configured_logging_dir = $config->get_setting( 'logging/directory', '' );
70 70
 
71
-		if( ! empty( $configured_logging_dir ) ) {
71
+		if ( ! empty( $configured_logging_dir ) ) {
72 72
 
73 73
 			$logging_directory = $this->check_directory( $configured_logging_dir );
74 74
 
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
 		}
83 83
 
84 84
 		// Directory cannot be found or created. Cannot log.
85
-		if( ! $logging_directory ) {
85
+		if ( ! $logging_directory ) {
86 86
 			return false;
87 87
 		}
88 88
 
89 89
 		// Directory cannot be written to
90
-		if( ! $this->check_directory( $logging_directory ) ) {
90
+		if ( ! $this->check_directory( $logging_directory ) ) {
91 91
 			return false;
92 92
 		}
93 93
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 			$options = wp_parse_args( $settings_options, $default_options );
111 111
 
112
-			$klogger = new Logger (
112
+			$klogger = new Logger(
113 113
 				$logging_directory,
114 114
 				$config->get_setting( 'logging/threshold', 'notice' ),
115 115
 				$options
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	private function check_directory( $dirpath ) {
136 136
 
137
-		$dirpath = (string) $dirpath;
137
+		$dirpath = (string)$dirpath;
138 138
 		$file_exists = file_exists( $dirpath );
139 139
 		$is_writable = wp_is_writable( $dirpath );
140 140
 
141 141
 		// If the configured setting path exists and is writeable, use it.
142
-		if( $file_exists && $is_writable ) {
142
+		if ( $file_exists && $is_writable ) {
143 143
 			return $dirpath;
144 144
 		}
145 145
 
146 146
 		// Otherwise, try and log default errors
147
-		if( ! $file_exists ) {
147
+		if ( ! $file_exists ) {
148 148
 			$this->log( 'The defined logging directory does not exist: ' . $dirpath, __METHOD__, 'error' );
149 149
 		}
150 150
 
151
-		if( ! $is_writable ) {
151
+		if ( ! $is_writable ) {
152 152
 			$this->log( 'The defined logging directory exists but could not be written to: ' . $dirpath, __METHOD__, 'error' );
153 153
 		}
154 154
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 
167 167
 		$upload_dir = wp_upload_dir();
168 168
 
169
-		$log_dir = trailingslashit( $upload_dir['basedir'] ) . self::DIRECTORY_PATH;
169
+		$log_dir = trailingslashit( $upload_dir[ 'basedir' ] ) . self::DIRECTORY_PATH;
170 170
 
171 171
 		// Directory exists; return early
172
-		if( file_exists( $log_dir ) ) {
172
+		if ( file_exists( $log_dir ) ) {
173 173
 
174 174
 			$this->prevent_directory_browsing( $log_dir );
175 175
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 		$folder_created = wp_mkdir_p( $log_dir );
181 181
 
182 182
 		// Something went wrong mapping the directory
183
-		if( ! $folder_created ) {
183
+		if ( ! $folder_created ) {
184 184
 			$this->log( 'The log directory could not be created: ' . $log_dir, __METHOD__, 'error' );
185 185
 			return false;
186 186
 		}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		 */
242 242
 		$is_enabled = apply_filters( 'trustedlogin/' . $this->ns . '/logging/enabled', $is_enabled );
243 243
 
244
-		return (bool) $is_enabled;
244
+		return (bool)$is_enabled;
245 245
 	}
246 246
 
247 247
 	/**
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 			return;
320 320
 		}
321 321
 
322
-		$this->klogger->{$level}( $log_message, (array) $data );
322
+		$this->klogger->{$level}( $log_message, (array)$data );
323 323
 	}
324 324
 
325 325
 }
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Config.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 namespace GravityView\TrustedLogin;
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined('ABSPATH') ) {
16
+if ( ! defined( 'ABSPATH' ) ) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -112,51 +112,51 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function validate() {
114 114
 
115
-		if ( in_array( __NAMESPACE__, array( 'ReplaceMe', 'ReplaceMe\GravityView\GravityView\TrustedLogin' ) ) && ! defined('TL_DOING_TESTS') ) {
115
+		if ( in_array( __NAMESPACE__, array( 'ReplaceMe', 'ReplaceMe\GravityView\GravityView\TrustedLogin' ) ) && ! defined( 'TL_DOING_TESTS' ) ) {
116 116
 			throw new Exception( 'Developer: make sure to change the namespace for the TrustedLogin class. See https://trustedlogin.com/configuration/ for more information.', 501 );
117 117
 		}
118 118
 
119 119
 		$errors = array();
120 120
 
121
-		if ( ! isset( $this->settings['auth']['api_key'] ) ) {
122
-			$errors[] = new WP_Error( 'missing_configuration', 'You need to set an API key. Get yours at https://app.trustedlogin.com' );
121
+		if ( ! isset( $this->settings[ 'auth' ][ 'api_key' ] ) ) {
122
+			$errors[ ] = new WP_Error( 'missing_configuration', 'You need to set an API key. Get yours at https://app.trustedlogin.com' );
123 123
 		}
124 124
 
125
-		if ( isset( $this->settings['vendor']['website'] ) && 'https://www.example.com' === $this->settings['vendor']['website'] && ! defined('TL_DOING_TESTS') ) {
126
-			$errors[] = new WP_Error( 'missing_configuration', 'You need to configure the "website" URL to point to the URL where the Vendor plugin is installed.' );
125
+		if ( isset( $this->settings[ 'vendor' ][ 'website' ] ) && 'https://www.example.com' === $this->settings[ 'vendor' ][ 'website' ] && ! defined( 'TL_DOING_TESTS' ) ) {
126
+			$errors[ ] = new WP_Error( 'missing_configuration', 'You need to configure the "website" URL to point to the URL where the Vendor plugin is installed.' );
127 127
 		}
128 128
 
129 129
 		foreach ( array( 'namespace', 'title', 'website', 'support_url', 'email' ) as $required_vendor_field ) {
130
-			if ( ! isset( $this->settings['vendor'][ $required_vendor_field ] ) ) {
131
-				$errors[] = new WP_Error( 'missing_configuration', sprintf( 'Missing required configuration: `vendor/%s`', $required_vendor_field ) );
130
+			if ( ! isset( $this->settings[ 'vendor' ][ $required_vendor_field ] ) ) {
131
+				$errors[ ] = new WP_Error( 'missing_configuration', sprintf( 'Missing required configuration: `vendor/%s`', $required_vendor_field ) );
132 132
 			}
133 133
 		}
134 134
 
135
-		if ( isset( $this->settings['decay'] ) ) {
136
-			if ( ! is_int( $this->settings['decay'] ) ) {
137
-				$errors[] = new WP_Error( 'invalid_configuration', 'Decay must be an integer (number of seconds).' );
138
-			} elseif ( $this->settings['decay'] > MONTH_IN_SECONDS ) {
139
-				$errors[] = new WP_Error( 'invalid_configuration', 'Decay must be less than or equal to 30 days.' );
140
-			} elseif ( $this->settings['decay'] < DAY_IN_SECONDS ) {
141
-				$errors[] = new WP_Error( 'invalid_configuration', 'Decay must be greater than 1 day.' );
135
+		if ( isset( $this->settings[ 'decay' ] ) ) {
136
+			if ( ! is_int( $this->settings[ 'decay' ] ) ) {
137
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'Decay must be an integer (number of seconds).' );
138
+			} elseif ( $this->settings[ 'decay' ] > MONTH_IN_SECONDS ) {
139
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'Decay must be less than or equal to 30 days.' );
140
+			} elseif ( $this->settings[ 'decay' ] < DAY_IN_SECONDS ) {
141
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'Decay must be greater than 1 day.' );
142 142
 			}
143 143
 		}
144 144
 
145
-		if ( isset( $this->settings['vendor']['namespace'] ) ) {
145
+		if ( isset( $this->settings[ 'vendor' ][ 'namespace' ] ) ) {
146 146
 
147 147
 			// This seems like a reasonable max limit on namespace length.
148 148
 			// @see https://developer.wordpress.org/reference/functions/set_transient/#more-information
149
-			if ( strlen( $this->settings['vendor']['namespace'] ) > 96 ) {
150
-				$errors[] = new WP_Error( 'invalid_configuration', 'Namespace length must be shorter than 96 characters.' );
149
+			if ( strlen( $this->settings[ 'vendor' ][ 'namespace' ] ) > 96 ) {
150
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'Namespace length must be shorter than 96 characters.' );
151 151
 			}
152 152
 
153
-			if ( in_array( strtolower( $this->settings['vendor']['namespace'] ), self::$reserved_namespaces, true ) ) {
154
-				$errors[] = new WP_Error( 'invalid_configuration', 'The defined namespace is reserved.' );
153
+			if ( in_array( strtolower( $this->settings[ 'vendor' ][ 'namespace' ] ), self::$reserved_namespaces, true ) ) {
154
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'The defined namespace is reserved.' );
155 155
 			}
156 156
 		}
157 157
 
158
-		if ( isset( $this->settings['vendor'][ 'email' ] ) && ! filter_var( $this->settings['vendor'][ 'email' ], FILTER_VALIDATE_EMAIL ) ) {
159
-			$errors[] = new WP_Error( 'invalid_configuration', 'An invalid `vendor/email` setting was passed to the TrustedLogin Client.' );
158
+		if ( isset( $this->settings[ 'vendor' ][ 'email' ] ) && ! filter_var( $this->settings[ 'vendor' ][ 'email' ], FILTER_VALIDATE_EMAIL ) ) {
159
+			$errors[ ] = new WP_Error( 'invalid_configuration', 'An invalid `vendor/email` setting was passed to the TrustedLogin Client.' );
160 160
 		}
161 161
 
162 162
 		// TODO: Add namespace collision check?
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 			$value = $this->get_setting( $settings_key, null, $this->settings );
165 165
 			$url   = wp_kses_bad_protocol( $value, array( 'http', 'https' ) );
166 166
 			if ( $value && ! filter_var( $url, FILTER_VALIDATE_URL ) ) {
167
-				$errors[] = new WP_Error(
167
+				$errors[ ] = new WP_Error(
168 168
 					'invalid_configuration',
169 169
 					sprintf( 'An invalid `%s` setting was passed to the TrustedLogin Client: %s',
170 170
 						$settings_key,
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 		foreach ( SupportRole::$prevented_caps as $invalid_cap ) {
180 180
 			if ( array_key_exists( $invalid_cap, $added_caps ) ) {
181
-				$errors[] = new WP_Error( 'invalid_configuration', 'TrustedLogin users cannot be allowed to: ' . $invalid_cap );
181
+				$errors[ ] = new WP_Error( 'invalid_configuration', 'TrustedLogin users cannot be allowed to: ' . $invalid_cap );
182 182
 			}
183 183
 		}
184 184
 
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$error_text = array();
187 187
 			foreach ( $errors as $error ) {
188 188
 				if ( is_wp_error( $error ) ) {
189
-					$error_text[] = $error->get_error_message();
189
+					$error_text[ ] = $error->get_error_message();
190 190
 				}
191 191
 			}
192 192
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
 		$time = current_time( 'timestamp', $gmt );
223 223
 
224
-		return $time + (int) $decay_time;
224
+		return $time + (int)$decay_time;
225 225
 	}
226 226
 
227 227
 	/**
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 
282 282
 		$default_settings = $this->default_settings;
283 283
 
284
-		$default_settings['paths']['css'] = plugin_dir_url( __FILE__ ) . 'assets/trustedlogin.css';
285
-		$default_settings['paths']['js']  = plugin_dir_url( __FILE__ ) . 'assets/trustedlogin.js';
284
+		$default_settings[ 'paths' ][ 'css' ] = plugin_dir_url( __FILE__ ) . 'assets/trustedlogin.css';
285
+		$default_settings[ 'paths' ][ 'js' ]  = plugin_dir_url( __FILE__ ) . 'assets/trustedlogin.js';
286 286
 
287 287
 		return $default_settings;
288 288
 	}
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Envelope.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 namespace GravityView\TrustedLogin;
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined('ABSPATH') ) {
16
+if ( ! defined( 'ABSPATH' ) ) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$e_keys = $this->encryption->generate_keys();
83 83
 
84
-		if ( is_wp_error( $e_keys ) ){
84
+		if ( is_wp_error( $e_keys ) ) {
85 85
 			return $e_keys;
86 86
 		}
87 87
 
88 88
 		$nonce = $this->encryption->get_nonce();
89 89
 
90
-		if ( is_wp_error( $nonce ) ){
90
+		if ( is_wp_error( $nonce ) ) {
91 91
 			return $nonce;
92 92
 		}
93 93
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,13 +81,13 @@
 block discarded – undo
81 81
 
82 82
 		$e_keys = $this->encryption->generate_keys();
83 83
 
84
-		if ( is_wp_error( $e_keys ) ){
84
+		if ( is_wp_error( $e_keys ) ) {
85 85
 			return $e_keys;
86 86
 		}
87 87
 
88 88
 		$nonce = $this->encryption->get_nonce();
89 89
 
90
-		if ( is_wp_error( $nonce ) ){
90
+		if ( is_wp_error( $nonce ) ) {
91 91
 			return $nonce;
92 92
 		}
93 93
 
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Ajax.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 namespace GravityView\TrustedLogin;
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined('ABSPATH') ) {
12
+if ( ! defined( 'ABSPATH' ) ) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function ajax_generate_support() {
59 59
 
60
-		if ( empty( $_POST['vendor'] ) ) {
60
+		if ( empty( $_POST[ 'vendor' ] ) ) {
61 61
 
62 62
 			$this->logging->log( 'Vendor not defined in TrustedLogin configuration.', __METHOD__, 'critical' );
63 63
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 		// There are multiple TrustedLogin instances, and this is not the one being called.
68 68
 		// This should not occur, since the AJAX action is namespaced.
69
-		if ( $this->config->ns() !== $_POST['vendor'] ) {
69
+		if ( $this->config->ns() !== $_POST[ 'vendor' ] ) {
70 70
 
71 71
 			$this->logging->log( 'Vendor does not match TrustedLogin configuration.', __METHOD__, 'critical' );
72 72
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 			return;
75 75
 		}
76 76
 
77
-		if ( empty( $_POST['_nonce'] ) ) {
77
+		if ( empty( $_POST[ '_nonce' ] ) ) {
78 78
 			wp_send_json_error( array( 'message' => 'Nonce not sent in the request.' ) );
79 79
 		}
80 80
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		if ( is_wp_error( $response ) ) {
97 97
 
98 98
 			$error_data = $response->get_error_data();
99
-			$error_code = isset( $error_data['error_code'] ) ? $error_data['error_code'] : 500;
99
+			$error_code = isset( $error_data[ 'error_code' ] ) ? $error_data[ 'error_code' ] : 500;
100 100
 
101 101
 			wp_send_json_error( array( 'message' => $response->get_error_message() ), $error_code );
102 102
 		}
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Endpoint.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 
246 246
 		add_rewrite_endpoint( $endpoint, EP_ROOT );
247 247
 
248
-		$this->logging->log( "Endpoint {$endpoint} added.", __METHOD__, 'debug' );
248
+		$this->logging->log( "endpoint {$endpoint} added.", __METHOD__, 'debug' );
249 249
 
250 250
 		if ( get_site_option( self::PERMALINK_FLUSH_OPTION_NAME ) ) {
251 251
 			return;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
 			return;
211 211
 		}
212 212
 
213
-		if ( ! isset( $_REQUEST['_wpnonce'] ) ) {
213
+		if ( ! isset( $_REQUEST[ '_wpnonce' ] ) ) {
214 214
 			return;
215 215
 		}
216 216
 
217
-		$verify_nonce = wp_verify_nonce( $_REQUEST['_wpnonce'], self::REVOKE_SUPPORT_QUERY_PARAM );
217
+		$verify_nonce = wp_verify_nonce( $_REQUEST[ '_wpnonce' ], self::REVOKE_SUPPORT_QUERY_PARAM );
218 218
 
219 219
 		if ( ! $verify_nonce ) {
220 220
 			$this->logging->log( 'Removing user failed: Nonce expired (Nonce value: ' . $verify_nonce . ')', __METHOD__, 'error' );
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @return string
307 307
 	 */
308 308
 	public function get() {
309
-		return (string) get_site_option( $this->option_name );
309
+		return (string)get_site_option( $this->option_name );
310 310
 	}
311 311
 
312 312
 	/**
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/SiteAccess.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 			return $response_json;
90 90
 		}
91 91
 
92
-		if ( empty( $response_json['success'] ) ) {
92
+		if ( empty( $response_json[ 'success' ] ) ) {
93 93
 			return new WP_Error( 'sync_error', __( 'Could not sync to TrustedLogin server', 'gravityview' ) );
94 94
 		}
95 95
 
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Encryption.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 namespace GravityView\TrustedLogin;
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined('ABSPATH') ) {
16
+if ( ! defined( 'ABSPATH' ) ) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		}
144 144
 
145 145
 		try {
146
-			$hash_bin = sodium_crypto_generichash( $string, '', (int) $length );
146
+			$hash_bin = sodium_crypto_generichash( $string, '', (int)$length );
147 147
 			$hash     = sodium_bin2hex( $hash_bin );
148 148
 		} catch ( \TypeError $e ) {
149 149
 			return new WP_Error(
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 
252 252
 		if ( is_wp_error( $response_json ) ) {
253 253
 
254
-			if ( 'not_found' == $response_json->get_error_code() ){
254
+			if ( 'not_found' == $response_json->get_error_code() ) {
255 255
 				return new WP_Error( 'not_found', __( 'Encryption key could not be fetched, Vendor site returned 404.', 'gravityview' ) );
256 256
 			}
257 257
 
258 258
 			return $response_json;
259 259
 		}
260 260
 
261
-		return $response_json['publicKey'];
261
+		return $response_json[ 'publicKey' ];
262 262
 	}
263 263
 
264 264
 	/**
@@ -366,6 +366,6 @@  discard block
 block discarded – undo
366 366
 			'privateKey' => sodium_crypto_box_secretkey( $aliceKeypair )
367 367
 		);
368 368
 
369
-		return (object) $alice_keys;
369
+		return (object)$alice_keys;
370 370
 	}
371 371
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
 
252 252
 		if ( is_wp_error( $response_json ) ) {
253 253
 
254
-			if ( 'not_found' == $response_json->get_error_code() ){
254
+			if ( 'not_found' == $response_json->get_error_code() ) {
255 255
 				return new WP_Error( 'not_found', __( 'Encryption key could not be fetched, Vendor site returned 404.', 'gravityview' ) );
256 256
 			}
257 257
 
Please login to merge, or discard this patch.
trustedlogin/trustedlogin/client/src/Remote.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 namespace GravityView\TrustedLogin;
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined('ABSPATH') ) {
16
+if ( ! defined( 'ABSPATH' ) ) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 		);
150 150
 
151 151
 		if ( ! empty( $data ) && ! in_array( $method, array( 'GET', 'HEAD' ), true ) ) {
152
-			$request_options['body'] = wp_json_encode( $data );
152
+			$request_options[ 'body' ] = wp_json_encode( $data );
153 153
 		}
154 154
 
155 155
 		try {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 				return new WP_Error( 'invalid_response', esc_html__( 'Invalid response.', 'gravityview' ), $api_response );
262 262
 
263 263
 			default:
264
-				return (int) $response_code;
264
+				return (int)$response_code;
265 265
 		}
266 266
 	}
267 267
 
@@ -304,20 +304,20 @@  discard block
 block discarded – undo
304 304
 			return new WP_Error( 'invalid_response', esc_html__( 'Invalid response.', 'gravityview' ), $response_body );
305 305
 		}
306 306
 
307
-		if ( isset( $response_json['errors'] ) ) {
307
+		if ( isset( $response_json[ 'errors' ] ) ) {
308 308
 
309 309
 			$errors = '';
310 310
 
311 311
 			// Multi-dimensional; we flatten.
312
-			foreach ( $response_json['errors'] as $key => $error ) {
313
-				$error  = is_array( $error ) ? reset( $error ) : $error;
312
+			foreach ( $response_json[ 'errors' ] as $key => $error ) {
313
+				$error = is_array( $error ) ? reset( $error ) : $error;
314 314
 				$errors .= $error;
315 315
 			}
316 316
 
317 317
 			return new WP_Error( 'errors_in_response', esc_html( $errors ), $response_body );
318 318
 		}
319 319
 
320
-		foreach ( (array) $required_keys as $required_key ) {
320
+		foreach ( (array)$required_keys as $required_key ) {
321 321
 			if ( ! isset( $response_json[ $required_key ] ) ) {
322 322
 				return new WP_Error( 'missing_required_key', sprintf( esc_html__( 'Invalid response. Missing key: %s', 'gravityview' ), $required_key ), $response_body );
323 323
 			}
Please login to merge, or discard this patch.